summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-05-27 17:39:31 +0100
committerPedro Alvarez <pedro.alvarez@codethink.co.uk>2016-05-27 17:53:32 +0100
commit26c75cf8267919f81a1759c9c965a52c660233f9 (patch)
treecf2a39cf56c2c8ac45760854413ab233e6263974
parent56892c1d217baea02092b51a09bbc924130ca84c (diff)
downloadgcc-tarball-baserock/pedroalvarez/gcc-5.3.0-gmp432.tar.gz
-rw-r--r--.gitignore49
-rw-r--r--gmp/.gdbinit32
-rw-r--r--gmp/AUTHORS103
-rw-r--r--gmp/COPYING.LIB (renamed from gmp/COPYING.LESSERv3)0
-rw-r--r--gmp/COPYINGv2339
-rw-r--r--gmp/COPYINGv3674
-rw-r--r--gmp/ChangeLog9553
-rw-r--r--gmp/INSTALL37
-rw-r--r--gmp/INSTALL.autoconf3
-rw-r--r--gmp/Makefile.am260
-rw-r--r--gmp/Makefile.in1209
-rw-r--r--gmp/NEWS460
-rw-r--r--gmp/README31
-rw-r--r--gmp/acinclude.m4288
-rw-r--r--gmp/aclocal.m410654
-rw-r--r--gmp/ansi2knr.136
-rw-r--r--gmp/ansi2knr.c739
-rw-r--r--gmp/assert.c25
-rw-r--r--gmp/bootstrap.c146
-rw-r--r--gmp/compat.c25
-rwxr-xr-xgmp/config.guess488
-rw-r--r--gmp/config.in177
-rwxr-xr-xgmp/config.sub52
-rwxr-xr-xgmp/configfsf.guess584
-rwxr-xr-x[-rw-r--r--]gmp/configfsf.sub324
-rwxr-xr-xgmp/configure33225
-rw-r--r--gmp/configure.in (renamed from gmp/configure.ac)1483
-rw-r--r--gmp/cxx/Makefile.am37
-rw-r--r--gmp/cxx/Makefile.in295
-rw-r--r--gmp/cxx/dummy.cc25
-rw-r--r--gmp/cxx/isfuns.cc25
-rw-r--r--gmp/cxx/ismpf.cc29
-rw-r--r--gmp/cxx/ismpq.cc27
-rw-r--r--gmp/cxx/ismpz.cc25
-rw-r--r--gmp/cxx/ismpznw.cc27
-rw-r--r--gmp/cxx/limits.cc62
-rw-r--r--gmp/cxx/osdoprnti.cc29
-rw-r--r--gmp/cxx/osfuns.cc25
-rw-r--r--gmp/cxx/osmpf.cc27
-rw-r--r--gmp/cxx/osmpq.cc25
-rw-r--r--gmp/cxx/osmpz.cc25
-rw-r--r--gmp/demos/Makefile.am37
-rw-r--r--gmp/demos/Makefile.in450
-rw-r--r--gmp/demos/calc/Makefile.am35
-rw-r--r--gmp/demos/calc/Makefile.in345
-rw-r--r--gmp/demos/calc/README2
-rw-r--r--gmp/demos/calc/calc-common.h2
-rw-r--r--gmp/demos/calc/calc-config-h.in2
-rw-r--r--gmp/demos/calc/calc.c2554
-rw-r--r--gmp/demos/calc/calc.h174
-rw-r--r--gmp/demos/calc/calc.y4
-rw-r--r--gmp/demos/calc/calclex.c1467
-rw-r--r--gmp/demos/calc/calclex.l4
-rw-r--r--gmp/demos/calc/calcread.c2
-rw-r--r--gmp/demos/expr/Makefile.am35
-rw-r--r--gmp/demos/expr/Makefile.in332
-rw-r--r--gmp/demos/expr/README29
-rw-r--r--gmp/demos/expr/expr-impl.h178
-rw-r--r--gmp/demos/expr/expr.c33
-rw-r--r--gmp/demos/expr/expr.h69
-rw-r--r--gmp/demos/expr/exprf.c48
-rw-r--r--gmp/demos/expr/exprfa.c33
-rw-r--r--gmp/demos/expr/exprq.c48
-rw-r--r--gmp/demos/expr/exprqa.c31
-rw-r--r--gmp/demos/expr/exprv.c25
-rw-r--r--gmp/demos/expr/exprz.c48
-rw-r--r--gmp/demos/expr/exprza.c33
-rw-r--r--gmp/demos/expr/run-expr.c27
-rw-r--r--gmp/demos/expr/t-expr.c27
-rw-r--r--gmp/demos/factorize.c530
-rw-r--r--gmp/demos/isprime.c8
-rw-r--r--gmp/demos/perl/GMP.pm66
-rw-r--r--gmp/demos/perl/GMP.xs27
-rw-r--r--gmp/demos/perl/GMP/Mpf.pm33
-rw-r--r--gmp/demos/perl/GMP/Mpq.pm33
-rw-r--r--gmp/demos/perl/GMP/Mpz.pm35
-rw-r--r--gmp/demos/perl/GMP/Rand.pm33
-rw-r--r--gmp/demos/perl/INSTALL25
-rw-r--r--gmp/demos/perl/Makefile.PL33
-rw-r--r--gmp/demos/perl/sample.pl33
-rw-r--r--gmp/demos/perl/test.pl35
-rw-r--r--gmp/demos/perl/test2.pl33
-rw-r--r--gmp/demos/perl/typemap35
-rw-r--r--gmp/demos/pexpr-config-h.in2
-rw-r--r--gmp/demos/pexpr.c34
-rw-r--r--gmp/demos/primes.c12
-rw-r--r--gmp/demos/primes.h552
-rw-r--r--gmp/demos/qcn.c4
-rw-r--r--gmp/doc/Makefile.am33
-rw-r--r--gmp/doc/Makefile.in441
-rw-r--r--gmp/doc/configuration90
-rw-r--r--gmp/doc/fdl-1.3.texi4
-rw-r--r--gmp/doc/gmp.info177
-rw-r--r--gmp/doc/gmp.info-12310
-rw-r--r--gmp/doc/gmp.info-21505
-rw-r--r--gmp/doc/gmp.texi1974
-rw-r--r--gmp/doc/isa_abi_headache25
-rwxr-xr-xgmp/doc/mdate-sh87
-rw-r--r--gmp/doc/projects.html258
-rw-r--r--gmp/doc/stamp-vti8
-rw-r--r--gmp/doc/tasks.html96
-rw-r--r--gmp/doc/texinfo.tex3042
-rw-r--r--gmp/doc/version.texi8
-rw-r--r--gmp/dumbmp.c887
-rw-r--r--gmp/errno.c25
-rw-r--r--gmp/extract-dbl.c29
-rw-r--r--gmp/gen-bases.c127
-rw-r--r--gmp/gen-fac.c285
-rw-r--r--gmp/gen-fac_ui.c159
-rw-r--r--gmp/gen-fib.c33
-rw-r--r--gmp/gen-jacobitab.c128
-rw-r--r--gmp/gen-psqr.c50
-rw-r--r--gmp/gen-trialdivtab.c300
-rw-r--r--gmp/gmp-h.in959
-rw-r--r--gmp/gmp-impl.h4224
-rw-r--r--gmp/gmpxx.h2140
-rwxr-xr-xgmp/install-sh580
-rw-r--r--gmp/invalid.c25
-rw-r--r--gmp/libmp.sym18
-rw-r--r--gmp/longlong.h561
-rw-r--r--gmp/ltmain.sh10023
-rw-r--r--gmp/macos/README241
-rwxr-xr-xgmp/macos/configure519
-rw-r--r--gmp/macos/unix2mac1
-rw-r--r--gmp/memory.c54
-rw-r--r--gmp/mini-gmp/README77
-rw-r--r--gmp/mini-gmp/mini-gmp.c4386
-rw-r--r--gmp/mini-gmp/mini-gmp.h294
-rw-r--r--gmp/mini-gmp/tests/Makefile60
-rw-r--r--gmp/mini-gmp/tests/hex-random.c434
-rw-r--r--gmp/mini-gmp/tests/hex-random.h50
-rw-r--r--gmp/mini-gmp/tests/mini-random.c142
-rw-r--r--gmp/mini-gmp/tests/mini-random.h33
-rwxr-xr-xgmp/mini-gmp/tests/run-tests123
-rw-r--r--gmp/mini-gmp/tests/t-add.c57
-rw-r--r--gmp/mini-gmp/tests/t-aorsmul.c77
-rw-r--r--gmp/mini-gmp/tests/t-bitops.c103
-rw-r--r--gmp/mini-gmp/tests/t-cmp_d.c283
-rw-r--r--gmp/mini-gmp/tests/t-comb.c164
-rw-r--r--gmp/mini-gmp/tests/t-cong.c212
-rw-r--r--gmp/mini-gmp/tests/t-div.c254
-rw-r--r--gmp/mini-gmp/tests/t-div_2exp.c82
-rw-r--r--gmp/mini-gmp/tests/t-double.c138
-rw-r--r--gmp/mini-gmp/tests/t-gcd.c176
-rw-r--r--gmp/mini-gmp/tests/t-import.c99
-rw-r--r--gmp/mini-gmp/tests/t-invert.c98
-rw-r--r--gmp/mini-gmp/tests/t-lcm.c73
-rw-r--r--gmp/mini-gmp/tests/t-limbs.c106
-rw-r--r--gmp/mini-gmp/tests/t-logops.c112
-rw-r--r--gmp/mini-gmp/tests/t-mul.c113
-rw-r--r--gmp/mini-gmp/tests/t-powm.c61
-rw-r--r--gmp/mini-gmp/tests/t-pprime_p.c182
-rw-r--r--gmp/mini-gmp/tests/t-reuse.c663
-rw-r--r--gmp/mini-gmp/tests/t-root.c95
-rw-r--r--gmp/mini-gmp/tests/t-scan.c90
-rw-r--r--gmp/mini-gmp/tests/t-signed.c142
-rw-r--r--gmp/mini-gmp/tests/t-sqrt.c181
-rw-r--r--gmp/mini-gmp/tests/t-str.c307
-rw-r--r--gmp/mini-gmp/tests/t-sub.c71
-rw-r--r--gmp/mini-gmp/tests/testutils.c173
-rw-r--r--gmp/mini-gmp/tests/testutils.h37
-rwxr-xr-xgmp/missing201
-rw-r--r--gmp/mp-h.in163
-rw-r--r--gmp/mp_bpl.c27
-rw-r--r--gmp/mp_clz_tab.c30
-rw-r--r--gmp/mp_dv_tab.c30
-rw-r--r--gmp/mp_get_fns.c27
-rw-r--r--gmp/mp_minv_tab.c25
-rw-r--r--gmp/mp_set_fns.c27
-rw-r--r--gmp/mpbsd/Makefile.am37
-rw-r--r--gmp/mpbsd/Makefile.in716
-rw-r--r--gmp/mpbsd/itom.c47
-rw-r--r--gmp/mpbsd/mfree.c29
-rw-r--r--gmp/mpbsd/min.c89
-rw-r--r--gmp/mpbsd/mout.c92
-rw-r--r--gmp/mpbsd/mtox.c61
-rw-r--r--gmp/mpbsd/rpow.c32
-rw-r--r--gmp/mpbsd/sdiv.c67
-rw-r--r--gmp/mpbsd/xtom.c88
-rw-r--r--gmp/mpf/Makefile.am42
-rw-r--r--gmp/mpf/Makefile.in481
-rw-r--r--gmp/mpf/abs.c27
-rw-r--r--gmp/mpf/add.c27
-rw-r--r--gmp/mpf/add_ui.c25
-rw-r--r--gmp/mpf/ceilfloor.c29
-rw-r--r--gmp/mpf/clear.c29
-rw-r--r--gmp/mpf/clears.c49
-rw-r--r--gmp/mpf/cmp.c27
-rw-r--r--gmp/mpf/cmp_d.c25
-rw-r--r--gmp/mpf/cmp_si.c41
-rw-r--r--gmp/mpf/cmp_ui.c29
-rw-r--r--gmp/mpf/div.c112
-rw-r--r--gmp/mpf/div_2exp.c30
-rw-r--r--gmp/mpf/div_ui.c42
-rw-r--r--gmp/mpf/dump.c27
-rw-r--r--gmp/mpf/eq.c74
-rw-r--r--gmp/mpf/fits_s.h27
-rw-r--r--gmp/mpf/fits_sint.c25
-rw-r--r--gmp/mpf/fits_slong.c25
-rw-r--r--gmp/mpf/fits_sshort.c25
-rw-r--r--gmp/mpf/fits_u.h37
-rw-r--r--gmp/mpf/fits_uint.c25
-rw-r--r--gmp/mpf/fits_ulong.c25
-rw-r--r--gmp/mpf/fits_ushort.c25
-rw-r--r--gmp/mpf/get_d.c27
-rw-r--r--gmp/mpf/get_d_2exp.c27
-rw-r--r--gmp/mpf/get_dfl_prec.c29
-rw-r--r--gmp/mpf/get_prc.c29
-rw-r--r--gmp/mpf/get_si.c29
-rw-r--r--gmp/mpf/get_str.c43
-rw-r--r--gmp/mpf/get_ui.c27
-rw-r--r--gmp/mpf/init.c29
-rw-r--r--gmp/mpf/init2.c31
-rw-r--r--gmp/mpf/inits.c49
-rw-r--r--gmp/mpf/inp_str.c27
-rw-r--r--gmp/mpf/int_p.c27
-rw-r--r--gmp/mpf/iset.c29
-rw-r--r--gmp/mpf/iset_d.c29
-rw-r--r--gmp/mpf/iset_si.c31
-rw-r--r--gmp/mpf/iset_str.c27
-rw-r--r--gmp/mpf/iset_ui.c30
-rw-r--r--gmp/mpf/mul.c27
-rw-r--r--gmp/mpf/mul_2exp.c30
-rw-r--r--gmp/mpf/mul_ui.c25
-rw-r--r--gmp/mpf/neg.c27
-rw-r--r--gmp/mpf/out_str.c28
-rw-r--r--gmp/mpf/pow_ui.c37
-rw-r--r--gmp/mpf/random2.c27
-rw-r--r--gmp/mpf/reldiff.c29
-rw-r--r--gmp/mpf/set.c27
-rw-r--r--gmp/mpf/set_d.c28
-rw-r--r--gmp/mpf/set_dfl_prec.c29
-rw-r--r--gmp/mpf/set_prc.c29
-rw-r--r--gmp/mpf/set_prc_raw.c27
-rw-r--r--gmp/mpf/set_q.c25
-rw-r--r--gmp/mpf/set_si.c30
-rw-r--r--gmp/mpf/set_str.c67
-rw-r--r--gmp/mpf/set_ui.c27
-rw-r--r--gmp/mpf/set_z.c25
-rw-r--r--gmp/mpf/size.c29
-rw-r--r--gmp/mpf/sqrt.c33
-rw-r--r--gmp/mpf/sqrt_ui.c27
-rw-r--r--gmp/mpf/sub.c40
-rw-r--r--gmp/mpf/sub_ui.c25
-rw-r--r--gmp/mpf/swap.c73
-rw-r--r--gmp/mpf/trunc.c25
-rw-r--r--gmp/mpf/ui_div.c33
-rw-r--r--gmp/mpf/ui_sub.c30
-rw-r--r--gmp/mpf/urandomb.c29
-rw-r--r--gmp/mpn/Makeasm.am36
-rw-r--r--gmp/mpn/Makefile.am73
-rw-r--r--gmp/mpn/Makefile.in597
-rw-r--r--gmp/mpn/README25
-rw-r--r--gmp/mpn/a29k/add_n.s118
-rw-r--r--gmp/mpn/a29k/addmul_1.s111
-rw-r--r--gmp/mpn/a29k/lshift.s91
-rw-r--r--gmp/mpn/a29k/mul_1.s95
-rw-r--r--gmp/mpn/a29k/rshift.s87
-rw-r--r--gmp/mpn/a29k/sub_n.s118
-rw-r--r--gmp/mpn/a29k/submul_1.s114
-rw-r--r--gmp/mpn/a29k/udiv.s28
-rw-r--r--gmp/mpn/a29k/umul.s27
-rw-r--r--gmp/mpn/alpha/README34
-rw-r--r--gmp/mpn/alpha/add_n.asm239
-rw-r--r--gmp/mpn/alpha/addmul_1.asm31
-rw-r--r--gmp/mpn/alpha/alpha-defs.m433
-rw-r--r--gmp/mpn/alpha/aorslsh1_n.asm226
-rw-r--r--gmp/mpn/alpha/aorslsh2_n.asm167
-rw-r--r--gmp/mpn/alpha/bdiv_dbm1c.asm31
-rw-r--r--gmp/mpn/alpha/cntlz.asm31
-rw-r--r--gmp/mpn/alpha/copyd.asm31
-rw-r--r--gmp/mpn/alpha/copyi.asm31
-rw-r--r--gmp/mpn/alpha/default.m449
-rw-r--r--gmp/mpn/alpha/dive_1.c27
-rw-r--r--gmp/mpn/alpha/diveby3.asm (renamed from gmp/mpn/alpha/ev5/diveby3.asm)40
-rw-r--r--gmp/mpn/alpha/divrem_2.asm38
-rw-r--r--gmp/mpn/alpha/ev5/add_n.asm146
-rw-r--r--gmp/mpn/alpha/ev5/com_n.asm (renamed from gmp/mpn/alpha/com.asm)39
-rw-r--r--gmp/mpn/alpha/ev5/gmp-mparam.h242
-rw-r--r--gmp/mpn/alpha/ev5/lshift.asm171
-rw-r--r--gmp/mpn/alpha/ev5/rshift.asm169
-rw-r--r--gmp/mpn/alpha/ev5/sub_n.asm146
-rw-r--r--gmp/mpn/alpha/ev6/add_n.asm31
-rw-r--r--gmp/mpn/alpha/ev6/aorslsh1_n.asm172
-rw-r--r--gmp/mpn/alpha/ev6/aorsmul_1.asm33
-rw-r--r--gmp/mpn/alpha/ev6/gmp-mparam.h257
-rw-r--r--gmp/mpn/alpha/ev6/mod_1_4.asm337
-rw-r--r--gmp/mpn/alpha/ev6/mul_1.asm35
-rw-r--r--gmp/mpn/alpha/ev6/nails/README27
-rw-r--r--gmp/mpn/alpha/ev6/nails/addmul_1.asm35
-rw-r--r--gmp/mpn/alpha/ev6/nails/addmul_2.asm33
-rw-r--r--gmp/mpn/alpha/ev6/nails/addmul_3.asm33
-rw-r--r--gmp/mpn/alpha/ev6/nails/addmul_4.asm33
-rw-r--r--gmp/mpn/alpha/ev6/nails/aors_n.asm33
-rw-r--r--gmp/mpn/alpha/ev6/nails/gmp-mparam.h38
-rw-r--r--gmp/mpn/alpha/ev6/nails/mul_1.asm37
-rw-r--r--gmp/mpn/alpha/ev6/nails/submul_1.asm37
-rw-r--r--[-rwxr-xr-x]gmp/mpn/alpha/ev6/slot.pl39
-rw-r--r--gmp/mpn/alpha/ev6/sqr_diagonal.asm115
-rw-r--r--gmp/mpn/alpha/ev6/sub_n.asm31
-rw-r--r--gmp/mpn/alpha/ev67/gcd_1.asm31
-rw-r--r--gmp/mpn/alpha/ev67/hamdist.asm31
-rw-r--r--gmp/mpn/alpha/ev67/popcount.asm31
-rw-r--r--gmp/mpn/alpha/gmp-mparam.h45
-rw-r--r--gmp/mpn/alpha/invert_limb.asm399
-rw-r--r--gmp/mpn/alpha/lshift.asm193
-rw-r--r--gmp/mpn/alpha/mod_34lsub1.asm31
-rw-r--r--gmp/mpn/alpha/mode1o.asm33
-rw-r--r--gmp/mpn/alpha/mul_1.asm31
-rw-r--r--gmp/mpn/alpha/rshift.asm193
-rw-r--r--gmp/mpn/alpha/sec_tabselect.asm137
-rw-r--r--gmp/mpn/alpha/sqr_diag_addlsh1.asm93
-rw-r--r--gmp/mpn/alpha/sqr_diagonal.asm65
-rw-r--r--gmp/mpn/alpha/sub_n.asm243
-rw-r--r--gmp/mpn/alpha/submul_1.asm31
-rw-r--r--gmp/mpn/alpha/umul.asm31
-rw-r--r--gmp/mpn/alpha/unicos.m438
-rw-r--r--gmp/mpn/arm/README35
-rw-r--r--gmp/mpn/arm/add_n.asm69
-rw-r--r--gmp/mpn/arm/addmul_1.asm107
-rw-r--r--gmp/mpn/arm/aors_n.asm112
-rw-r--r--gmp/mpn/arm/aorslsh1_n.asm167
-rw-r--r--gmp/mpn/arm/aorsmul_1.asm135
-rw-r--r--gmp/mpn/arm/arm-defs.m467
-rw-r--r--gmp/mpn/arm/bdiv_dbm1c.asm113
-rw-r--r--gmp/mpn/arm/cnd_aors_n.asm134
-rw-r--r--gmp/mpn/arm/com.asm75
-rw-r--r--gmp/mpn/arm/copyd.asm86
-rw-r--r--gmp/mpn/arm/copyi.asm82
-rw-r--r--gmp/mpn/arm/dive_1.asm151
-rw-r--r--gmp/mpn/arm/gmp-mparam.h184
-rw-r--r--gmp/mpn/arm/invert_limb.asm164
-rw-r--r--gmp/mpn/arm/logops_n.asm139
-rw-r--r--gmp/mpn/arm/lshift.asm88
-rw-r--r--gmp/mpn/arm/lshiftc.asm95
-rw-r--r--gmp/mpn/arm/mod_34lsub1.asm121
-rw-r--r--gmp/mpn/arm/mode1o.asm92
-rw-r--r--gmp/mpn/arm/mul_1.asm58
-rw-r--r--gmp/mpn/arm/neon/README2
-rw-r--r--gmp/mpn/arm/neon/hamdist.asm194
-rw-r--r--gmp/mpn/arm/neon/lorrshift.asm279
-rw-r--r--gmp/mpn/arm/neon/lshiftc.asm257
-rw-r--r--gmp/mpn/arm/neon/popcount.asm166
-rw-r--r--gmp/mpn/arm/neon/sec_tabselect.asm140
-rw-r--r--gmp/mpn/arm/rsh1aors_n.asm124
-rw-r--r--gmp/mpn/arm/rshift.asm86
-rw-r--r--gmp/mpn/arm/sec_tabselect.asm131
-rw-r--r--gmp/mpn/arm/sub_n.asm71
-rw-r--r--gmp/mpn/arm/submul_1.asm107
-rw-r--r--gmp/mpn/arm/udiv.asm39
-rw-r--r--gmp/mpn/arm/v5/gcd_1.asm120
-rw-r--r--gmp/mpn/arm/v5/mod_1_1.asm129
-rw-r--r--gmp/mpn/arm/v5/mod_1_2.asm156
-rw-r--r--gmp/mpn/arm/v6/addmul_1.asm111
-rw-r--r--gmp/mpn/arm/v6/addmul_2.asm138
-rw-r--r--gmp/mpn/arm/v6/addmul_3.asm187
-rw-r--r--gmp/mpn/arm/v6/dive_1.asm149
-rw-r--r--gmp/mpn/arm/v6/gmp-mparam.h157
-rw-r--r--gmp/mpn/arm/v6/mode1o.asm95
-rw-r--r--gmp/mpn/arm/v6/mul_1.asm114
-rw-r--r--gmp/mpn/arm/v6/mul_2.asm131
-rw-r--r--gmp/mpn/arm/v6/popham.asm138
-rw-r--r--gmp/mpn/arm/v6/sqr_basecase.asm518
-rw-r--r--gmp/mpn/arm/v6/submul_1.asm125
-rw-r--r--gmp/mpn/arm/v6t2/divrem_1.asm212
-rw-r--r--gmp/mpn/arm/v6t2/gcd_1.asm115
-rw-r--r--gmp/mpn/arm/v7a/cora15/addmul_1.asm145
-rw-r--r--gmp/mpn/arm/v7a/cora15/aors_n.asm162
-rw-r--r--gmp/mpn/arm/v7a/cora15/cnd_aors_n.asm158
-rw-r--r--gmp/mpn/arm/v7a/cora15/com.asm180
-rw-r--r--gmp/mpn/arm/v7a/cora15/gmp-mparam.h197
-rw-r--r--gmp/mpn/arm/v7a/cora15/logops_n.asm253
-rw-r--r--gmp/mpn/arm/v7a/cora15/mul_1.asm104
-rw-r--r--gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm43
-rw-r--r--gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm43
-rw-r--r--gmp/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm144
-rw-r--r--gmp/mpn/arm/v7a/cora15/neon/com.asm97
-rw-r--r--gmp/mpn/arm/v7a/cora15/neon/copyd.asm110
-rw-r--r--gmp/mpn/arm/v7a/cora15/neon/copyi.asm90
-rw-r--r--gmp/mpn/arm/v7a/cora15/neon/rsh1aors_n.asm177
-rw-r--r--gmp/mpn/arm/v7a/cora15/submul_1.asm159
-rw-r--r--gmp/mpn/arm/v7a/cora9/gmp-mparam.h209
-rw-r--r--gmp/mpn/arm64/aors_n.asm98
-rw-r--r--gmp/mpn/arm64/aorsmul_1.asm122
-rw-r--r--gmp/mpn/arm64/cnd_aors_n.asm99
-rw-r--r--gmp/mpn/arm64/copyd.asm93
-rw-r--r--gmp/mpn/arm64/copyi.asm77
-rw-r--r--gmp/mpn/arm64/gcd_1.asm125
-rw-r--r--gmp/mpn/arm64/invert_limb.asm83
-rw-r--r--gmp/mpn/arm64/logops_n.asm106
-rw-r--r--gmp/mpn/arm64/mul_1.asm98
-rw-r--r--gmp/mpn/asm-defs.m4188
-rw-r--r--gmp/mpn/clipper/add_n.s46
-rw-r--r--gmp/mpn/clipper/mul_1.s45
-rw-r--r--gmp/mpn/clipper/sub_n.s46
-rwxr-xr-xgmp/mpn/cpp-ccas33
-rw-r--r--gmp/mpn/cray/README31
-rw-r--r--gmp/mpn/cray/add_n.c25
-rw-r--r--gmp/mpn/cray/cfp/addmul_1.c25
-rw-r--r--gmp/mpn/cray/cfp/mul_1.c25
-rw-r--r--gmp/mpn/cray/cfp/mulwwc90.s45
-rw-r--r--gmp/mpn/cray/cfp/mulwwj90.s45
-rw-r--r--gmp/mpn/cray/cfp/submul_1.c25
-rw-r--r--gmp/mpn/cray/gmp-mparam.h38
-rw-r--r--gmp/mpn/cray/hamdist.c25
-rw-r--r--gmp/mpn/cray/ieee/addmul_1.c27
-rw-r--r--gmp/mpn/cray/ieee/gmp-mparam.h39
-rw-r--r--gmp/mpn/cray/ieee/invert_limb.c31
-rw-r--r--gmp/mpn/cray/ieee/mul_1.c25
-rw-r--r--gmp/mpn/cray/ieee/mul_basecase.c25
-rw-r--r--gmp/mpn/cray/ieee/sqr_basecase.c25
-rw-r--r--gmp/mpn/cray/ieee/submul_1.c27
-rw-r--r--gmp/mpn/cray/lshift.c27
-rw-r--r--gmp/mpn/cray/mulww.f55
-rw-r--r--gmp/mpn/cray/popcount.c25
-rw-r--r--gmp/mpn/cray/rshift.c27
-rw-r--r--gmp/mpn/cray/sub_n.c25
-rw-r--r--gmp/mpn/generic/add.c25
-rw-r--r--gmp/mpn/generic/add_1.c25
-rw-r--r--gmp/mpn/generic/add_err1_n.c101
-rw-r--r--gmp/mpn/generic/add_err2_n.c117
-rw-r--r--gmp/mpn/generic/add_err3_n.c132
-rw-r--r--gmp/mpn/generic/add_n.c35
-rw-r--r--gmp/mpn/generic/addmul_1.c28
-rw-r--r--gmp/mpn/generic/addsub_n.c (renamed from gmp/mpn/generic/add_n_sub_n.c)51
-rw-r--r--gmp/mpn/generic/bdiv_dbm1c.c25
-rw-r--r--gmp/mpn/generic/bdiv_q.c77
-rw-r--r--gmp/mpn/generic/bdiv_q_1.c126
-rw-r--r--gmp/mpn/generic/bdiv_qr.c85
-rw-r--r--gmp/mpn/generic/bdivmod.c124
-rw-r--r--gmp/mpn/generic/binvert.c91
-rw-r--r--gmp/mpn/generic/broot.c196
-rw-r--r--gmp/mpn/generic/brootinv.c140
-rw-r--r--gmp/mpn/generic/bsqrt.c48
-rw-r--r--gmp/mpn/generic/bsqrtinv.c105
-rw-r--r--gmp/mpn/generic/cmp.c25
-rw-r--r--gmp/mpn/generic/cnd_add_n.c70
-rw-r--r--gmp/mpn/generic/cnd_sub_n.c70
-rw-r--r--gmp/mpn/generic/com.c45
-rw-r--r--gmp/mpn/generic/comb_tables.c48
-rw-r--r--gmp/mpn/generic/copyd.c41
-rw-r--r--gmp/mpn/generic/copyi.c43
-rw-r--r--gmp/mpn/generic/dc_bdiv_q.c137
-rw-r--r--gmp/mpn/generic/dc_bdiv_qr.c (renamed from gmp/mpn/generic/dcpi1_bdiv_qr.c)70
-rw-r--r--gmp/mpn/generic/dc_div_q.c57
-rw-r--r--gmp/mpn/generic/dc_div_qr.c203
-rw-r--r--gmp/mpn/generic/dc_divappr_q.c196
-rw-r--r--gmp/mpn/generic/dc_divrem_n.c121
-rw-r--r--gmp/mpn/generic/dcpi1_bdiv_q.c160
-rw-r--r--gmp/mpn/generic/dcpi1_div_q.c87
-rw-r--r--gmp/mpn/generic/dcpi1_div_qr.c249
-rw-r--r--gmp/mpn/generic/dcpi1_divappr_q.c257
-rw-r--r--gmp/mpn/generic/div_q.c323
-rw-r--r--gmp/mpn/generic/div_qr_1.c126
-rw-r--r--gmp/mpn/generic/div_qr_1n_pi1.c277
-rw-r--r--gmp/mpn/generic/div_qr_1n_pi2.c195
-rw-r--r--gmp/mpn/generic/div_qr_1u_pi2.c228
-rw-r--r--gmp/mpn/generic/div_qr_2.c332
-rw-r--r--gmp/mpn/generic/div_qr_2n_pi1.c85
-rw-r--r--gmp/mpn/generic/div_qr_2u_pi1.c77
-rw-r--r--gmp/mpn/generic/dive_1.c60
-rw-r--r--gmp/mpn/generic/diveby3.c27
-rw-r--r--gmp/mpn/generic/divexact.c138
-rw-r--r--gmp/mpn/generic/divis.c175
-rw-r--r--gmp/mpn/generic/divrem.c43
-rw-r--r--gmp/mpn/generic/divrem_1.c60
-rw-r--r--gmp/mpn/generic/divrem_2.c186
-rw-r--r--gmp/mpn/generic/dump.c27
-rw-r--r--gmp/mpn/generic/fib2_ui.c108
-rw-r--r--gmp/mpn/generic/gcd.c312
-rw-r--r--gmp/mpn/generic/gcd_1.c100
-rw-r--r--gmp/mpn/generic/gcd_lehmer.c160
-rw-r--r--gmp/mpn/generic/gcd_subdiv_step.c209
-rw-r--r--gmp/mpn/generic/gcdext.c168
-rw-r--r--gmp/mpn/generic/gcdext_1.c265
-rw-r--r--gmp/mpn/generic/gcdext_lehmer.c168
-rw-r--r--gmp/mpn/generic/gcdext_subdiv_step.c197
-rw-r--r--gmp/mpn/generic/get_d.c564
-rw-r--r--gmp/mpn/generic/get_str.c47
-rw-r--r--gmp/mpn/generic/gmp-mparam.h27
-rw-r--r--gmp/mpn/generic/hgcd.c632
-rw-r--r--gmp/mpn/generic/hgcd2.c62
-rw-r--r--gmp/mpn/generic/hgcd2_jacobi.c366
-rw-r--r--gmp/mpn/generic/hgcd_appr.c268
-rw-r--r--gmp/mpn/generic/hgcd_jacobi.c244
-rw-r--r--gmp/mpn/generic/hgcd_matrix.c266
-rw-r--r--gmp/mpn/generic/hgcd_reduce.c247
-rw-r--r--gmp/mpn/generic/hgcd_step.c128
-rw-r--r--gmp/mpn/generic/invert.c113
-rw-r--r--gmp/mpn/generic/invertappr.c314
-rw-r--r--gmp/mpn/generic/jacbase.c117
-rw-r--r--gmp/mpn/generic/jacobi.c295
-rw-r--r--gmp/mpn/generic/jacobi_2.c352
-rw-r--r--gmp/mpn/generic/logops_n.c78
-rw-r--r--gmp/mpn/generic/lshift.c28
-rw-r--r--gmp/mpn/generic/lshiftc.c74
-rw-r--r--gmp/mpn/generic/matrix22_mul.c258
-rw-r--r--gmp/mpn/generic/matrix22_mul1_inverse_vector.c65
-rw-r--r--gmp/mpn/generic/mod_1.c136
-rw-r--r--gmp/mpn/generic/mod_1_1.c310
-rw-r--r--gmp/mpn/generic/mod_1_2.c96
-rw-r--r--gmp/mpn/generic/mod_1_3.c123
-rw-r--r--gmp/mpn/generic/mod_1_4.c145
-rw-r--r--gmp/mpn/generic/mod_34lsub1.c27
-rw-r--r--gmp/mpn/generic/mode1o.c29
-rw-r--r--gmp/mpn/generic/mu_bdiv_q.c234
-rw-r--r--gmp/mpn/generic/mu_bdiv_qr.c290
-rw-r--r--gmp/mpn/generic/mu_div_q.c192
-rw-r--r--gmp/mpn/generic/mu_div_qr.c405
-rw-r--r--gmp/mpn/generic/mu_divappr_q.c329
-rw-r--r--gmp/mpn/generic/mul.c410
-rw-r--r--gmp/mpn/generic/mul_1.c28
-rw-r--r--gmp/mpn/generic/mul_basecase.c31
-rw-r--r--gmp/mpn/generic/mul_fft.c484
-rw-r--r--gmp/mpn/generic/mul_n.c803
-rw-r--r--gmp/mpn/generic/mullo_basecase.c52
-rw-r--r--gmp/mpn/generic/mullo_n.c256
-rw-r--r--gmp/mpn/generic/mullow_basecase.c41
-rw-r--r--gmp/mpn/generic/mullow_n.c111
-rw-r--r--gmp/mpn/generic/mulmid.c256
-rw-r--r--gmp/mpn/generic/mulmid_basecase.c83
-rw-r--r--gmp/mpn/generic/mulmid_n.c62
-rw-r--r--gmp/mpn/generic/mulmod_bnm1.c355
-rw-r--r--gmp/mpn/generic/neg.c34
-rw-r--r--gmp/mpn/generic/neg_n.c23
-rw-r--r--gmp/mpn/generic/nussbaumer_mul.c71
-rw-r--r--gmp/mpn/generic/perfpow.c417
-rw-r--r--gmp/mpn/generic/perfsqr.c61
-rw-r--r--gmp/mpn/generic/popham.c34
-rw-r--r--gmp/mpn/generic/pow_1.c48
-rw-r--r--gmp/mpn/generic/powlo.c72
-rw-r--r--gmp/mpn/generic/powm.c546
-rw-r--r--gmp/mpn/generic/powm_sec.c272
-rw-r--r--gmp/mpn/generic/pre_divrem_1.c35
-rw-r--r--gmp/mpn/generic/pre_mod_1.c34
-rw-r--r--gmp/mpn/generic/random.c25
-rw-r--r--gmp/mpn/generic/random2.c36
-rw-r--r--gmp/mpn/generic/redc_1.c40
-rw-r--r--gmp/mpn/generic/redc_2.c41
-rw-r--r--gmp/mpn/generic/redc_n.c81
-rw-r--r--gmp/mpn/generic/remove.c172
-rw-r--r--gmp/mpn/generic/rootrem.c152
-rw-r--r--gmp/mpn/generic/rshift.c28
-rw-r--r--gmp/mpn/generic/sb_bdiv_q.c91
-rw-r--r--gmp/mpn/generic/sb_bdiv_qr.c (renamed from gmp/mpn/generic/sbpi1_bdiv_qr.c)51
-rw-r--r--gmp/mpn/generic/sb_div_q.c240
-rw-r--r--gmp/mpn/generic/sb_div_qr.c91
-rw-r--r--gmp/mpn/generic/sb_divappr_q.c136
-rw-r--r--gmp/mpn/generic/sb_divrem_mn.c205
-rw-r--r--gmp/mpn/generic/sbpi1_bdiv_q.c100
-rw-r--r--gmp/mpn/generic/sbpi1_div_q.c303
-rw-r--r--gmp/mpn/generic/sbpi1_div_qr.c110
-rw-r--r--gmp/mpn/generic/sbpi1_divappr_q.c199
-rw-r--r--gmp/mpn/generic/scan0.c30
-rw-r--r--gmp/mpn/generic/scan1.c30
-rw-r--r--gmp/mpn/generic/sec_aors_1.c60
-rw-r--r--gmp/mpn/generic/sec_div.c133
-rw-r--r--gmp/mpn/generic/sec_invert.c195
-rw-r--r--gmp/mpn/generic/sec_mul.c49
-rw-r--r--gmp/mpn/generic/sec_pi1_div.c173
-rw-r--r--gmp/mpn/generic/sec_powm.c438
-rw-r--r--gmp/mpn/generic/sec_sqr.c48
-rw-r--r--gmp/mpn/generic/sec_tabselect.c55
-rw-r--r--gmp/mpn/generic/set_str.c54
-rw-r--r--gmp/mpn/generic/sizeinbase.c54
-rw-r--r--gmp/mpn/generic/sqr.c99
-rw-r--r--gmp/mpn/generic/sqr_basecase.c95
-rw-r--r--gmp/mpn/generic/sqrmod_bnm1.c313
-rw-r--r--gmp/mpn/generic/sqrtrem.c141
-rw-r--r--gmp/mpn/generic/sub.c25
-rw-r--r--gmp/mpn/generic/sub_1.c25
-rw-r--r--gmp/mpn/generic/sub_err1_n.c101
-rw-r--r--gmp/mpn/generic/sub_err2_n.c117
-rw-r--r--gmp/mpn/generic/sub_err3_n.c132
-rw-r--r--gmp/mpn/generic/sub_n.c35
-rw-r--r--gmp/mpn/generic/subcnd_n.c85
-rw-r--r--gmp/mpn/generic/submul_1.c28
-rw-r--r--gmp/mpn/generic/tdiv_qr.c144
-rw-r--r--gmp/mpn/generic/toom22_mul.c53
-rw-r--r--gmp/mpn/generic/toom2_sqr.c49
-rw-r--r--gmp/mpn/generic/toom32_mul.c316
-rw-r--r--gmp/mpn/generic/toom33_mul.c143
-rw-r--r--gmp/mpn/generic/toom3_sqr.c127
-rw-r--r--gmp/mpn/generic/toom42_mul.c97
-rw-r--r--gmp/mpn/generic/toom42_mulmid.c238
-rw-r--r--gmp/mpn/generic/toom43_mul.c234
-rw-r--r--gmp/mpn/generic/toom44_mul.c348
-rw-r--r--gmp/mpn/generic/toom4_sqr.c213
-rw-r--r--gmp/mpn/generic/toom52_mul.c257
-rw-r--r--gmp/mpn/generic/toom53_mul.c286
-rw-r--r--gmp/mpn/generic/toom54_mul.c143
-rw-r--r--gmp/mpn/generic/toom62_mul.c291
-rw-r--r--gmp/mpn/generic/toom63_mul.c232
-rw-r--r--gmp/mpn/generic/toom6_sqr.c182
-rw-r--r--gmp/mpn/generic/toom6h_mul.c263
-rw-r--r--gmp/mpn/generic/toom8_sqr.c226
-rw-r--r--gmp/mpn/generic/toom8h_mul.c306
-rw-r--r--gmp/mpn/generic/toom_couple_handling.c81
-rw-r--r--gmp/mpn/generic/toom_eval_dgr3_pm1.c73
-rw-r--r--gmp/mpn/generic/toom_eval_dgr3_pm2.c98
-rw-r--r--gmp/mpn/generic/toom_eval_pm1.c90
-rw-r--r--gmp/mpn/generic/toom_eval_pm2.c131
-rw-r--r--gmp/mpn/generic/toom_eval_pm2exp.c128
-rw-r--r--gmp/mpn/generic/toom_eval_pm2rexp.c102
-rw-r--r--gmp/mpn/generic/toom_interpolate_12pts.c361
-rw-r--r--gmp/mpn/generic/toom_interpolate_16pts.c527
-rw-r--r--gmp/mpn/generic/toom_interpolate_5pts.c149
-rw-r--r--gmp/mpn/generic/toom_interpolate_6pts.c240
-rw-r--r--gmp/mpn/generic/toom_interpolate_7pts.c239
-rw-r--r--gmp/mpn/generic/toom_interpolate_8pts.c212
-rw-r--r--gmp/mpn/generic/trialdiv.c132
-rw-r--r--gmp/mpn/generic/udiv_w_sdiv.c42
-rw-r--r--gmp/mpn/generic/zero.c42
-rw-r--r--gmp/mpn/i960/README9
-rw-r--r--gmp/mpn/i960/add_n.s41
-rw-r--r--gmp/mpn/i960/addmul_1.s46
-rw-r--r--gmp/mpn/i960/mul_1.s43
-rw-r--r--gmp/mpn/i960/sub_n.s41
-rw-r--r--gmp/mpn/ia64/README38
-rw-r--r--gmp/mpn/ia64/add_n_sub_n.asm309
-rw-r--r--gmp/mpn/ia64/addmul_1.asm36
-rw-r--r--gmp/mpn/ia64/addmul_2.asm1107
-rw-r--r--gmp/mpn/ia64/aors_n.asm1343
-rw-r--r--gmp/mpn/ia64/aorslsh1_n.asm323
-rw-r--r--gmp/mpn/ia64/aorsorrlsh1_n.asm48
-rw-r--r--gmp/mpn/ia64/aorsorrlsh2_n.asm48
-rw-r--r--gmp/mpn/ia64/aorsorrlshC_n.asm397
-rw-r--r--gmp/mpn/ia64/bdiv_dbm1c.asm33
-rw-r--r--gmp/mpn/ia64/cnd_aors_n.asm259
-rw-r--r--gmp/mpn/ia64/copyd.asm33
-rw-r--r--gmp/mpn/ia64/copyi.asm33
-rw-r--r--gmp/mpn/ia64/dive_1.asm47
-rw-r--r--gmp/mpn/ia64/divrem_1.asm33
-rw-r--r--gmp/mpn/ia64/divrem_2.asm466
-rw-r--r--gmp/mpn/ia64/gcd_1.asm169
-rw-r--r--gmp/mpn/ia64/gmp-mparam.h258
-rw-r--r--gmp/mpn/ia64/hamdist.asm38
-rw-r--r--gmp/mpn/ia64/ia64-defs.m449
-rw-r--r--gmp/mpn/ia64/invert_limb.asm35
-rw-r--r--gmp/mpn/ia64/logops_n.asm33
-rw-r--r--gmp/mpn/ia64/lorrshift.asm452
-rw-r--r--gmp/mpn/ia64/lshiftc.asm463
-rw-r--r--gmp/mpn/ia64/mod_34lsub1.asm236
-rw-r--r--gmp/mpn/ia64/mode1o.asm37
-rw-r--r--gmp/mpn/ia64/mul_1.asm37
-rw-r--r--gmp/mpn/ia64/mul_2.asm1021
-rw-r--r--gmp/mpn/ia64/popcount.asm37
-rw-r--r--gmp/mpn/ia64/rsh1aors_n.asm37
-rw-r--r--gmp/mpn/ia64/sec_tabselect.asm150
-rw-r--r--gmp/mpn/ia64/sqr_diag_addlsh1.asm144
-rw-r--r--gmp/mpn/ia64/sqr_diagonal.asm79
-rw-r--r--gmp/mpn/ia64/submul_1.asm35
-rw-r--r--gmp/mpn/lisp/gmpasm-mode.el43
-rwxr-xr-xgmp/mpn/m4-ccas33
-rw-r--r--gmp/mpn/m68k/README25
-rw-r--r--gmp/mpn/m68k/aors_n.asm36
-rw-r--r--gmp/mpn/m68k/gmp-mparam.h37
-rw-r--r--gmp/mpn/m68k/lshift.asm42
-rw-r--r--gmp/mpn/m68k/m68k-defs.m435
-rw-r--r--gmp/mpn/m68k/mc68020/aorsmul_1.asm37
-rw-r--r--gmp/mpn/m68k/mc68020/mul_1.asm36
-rw-r--r--gmp/mpn/m68k/mc68020/udiv.asm35
-rw-r--r--gmp/mpn/m68k/mc68020/umul.asm35
-rw-r--r--gmp/mpn/m68k/rshift.asm52
-rw-r--r--gmp/mpn/m68k/t-m68k-defs.pl33
-rw-r--r--gmp/mpn/m88k/README25
-rw-r--r--gmp/mpn/m88k/add_n.s39
-rw-r--r--gmp/mpn/m88k/mc88110/add_n.S39
-rw-r--r--gmp/mpn/m88k/mc88110/addmul_1.s39
-rw-r--r--gmp/mpn/m88k/mc88110/mul_1.s39
-rw-r--r--gmp/mpn/m88k/mc88110/sub_n.S39
-rw-r--r--gmp/mpn/m88k/mul_1.s39
-rw-r--r--gmp/mpn/m88k/sub_n.s39
-rw-r--r--gmp/mpn/minithres/gmp-mparam.h135
-rw-r--r--gmp/mpn/mips32/add_n.asm31
-rw-r--r--gmp/mpn/mips32/addmul_1.asm31
-rw-r--r--gmp/mpn/mips32/gmp-mparam.h40
-rw-r--r--gmp/mpn/mips32/lshift.asm31
-rw-r--r--gmp/mpn/mips32/mips-defs.m427
-rw-r--r--gmp/mpn/mips32/mips.m427
-rw-r--r--gmp/mpn/mips32/mul_1.asm31
-rw-r--r--gmp/mpn/mips32/rshift.asm31
-rw-r--r--gmp/mpn/mips32/sub_n.asm31
-rw-r--r--gmp/mpn/mips32/submul_1.asm31
-rw-r--r--gmp/mpn/mips32/umul.asm31
-rw-r--r--gmp/mpn/mips64/README27
-rw-r--r--gmp/mpn/mips64/add_n.asm46
-rw-r--r--gmp/mpn/mips64/addmul_1.asm34
-rw-r--r--gmp/mpn/mips64/gmp-mparam.h40
-rw-r--r--gmp/mpn/mips64/lshift.asm33
-rw-r--r--gmp/mpn/mips64/mul_1.asm34
-rw-r--r--gmp/mpn/mips64/rshift.asm33
-rw-r--r--gmp/mpn/mips64/sqr_diagonal.asm31
-rw-r--r--gmp/mpn/mips64/sub_n.asm46
-rw-r--r--gmp/mpn/mips64/submul_1.asm34
-rw-r--r--gmp/mpn/mips64/umul.asm31
-rw-r--r--gmp/mpn/ns32k/add_n.s44
-rw-r--r--gmp/mpn/ns32k/addmul_1.s46
-rw-r--r--gmp/mpn/ns32k/mul_1.s45
-rw-r--r--gmp/mpn/ns32k/sub_n.s44
-rw-r--r--gmp/mpn/ns32k/submul_1.s46
-rw-r--r--gmp/mpn/pa32/README25
-rw-r--r--gmp/mpn/pa32/add_n.asm33
-rw-r--r--gmp/mpn/pa32/gmp-mparam.h50
-rw-r--r--gmp/mpn/pa32/hppa1_1/addmul_1.asm34
-rw-r--r--gmp/mpn/pa32/hppa1_1/gmp-mparam.h38
-rw-r--r--gmp/mpn/pa32/hppa1_1/mul_1.asm34
-rw-r--r--gmp/mpn/pa32/hppa1_1/pa7100/add_n.asm34
-rw-r--r--gmp/mpn/pa32/hppa1_1/pa7100/addmul_1.asm33
-rw-r--r--gmp/mpn/pa32/hppa1_1/pa7100/lshift.asm34
-rw-r--r--gmp/mpn/pa32/hppa1_1/pa7100/rshift.asm34
-rw-r--r--gmp/mpn/pa32/hppa1_1/pa7100/sub_n.asm34
-rw-r--r--gmp/mpn/pa32/hppa1_1/pa7100/submul_1.asm33
-rw-r--r--gmp/mpn/pa32/hppa1_1/sqr_diagonal.asm31
-rw-r--r--gmp/mpn/pa32/hppa1_1/submul_1.asm34
-rw-r--r--gmp/mpn/pa32/hppa1_1/udiv.asm31
-rw-r--r--gmp/mpn/pa32/hppa1_1/umul.asm31
-rw-r--r--gmp/mpn/pa32/hppa2_0/add_n.asm33
-rw-r--r--gmp/mpn/pa32/hppa2_0/gmp-mparam.h222
-rw-r--r--gmp/mpn/pa32/hppa2_0/sqr_diagonal.asm31
-rw-r--r--gmp/mpn/pa32/hppa2_0/sub_n.asm33
-rw-r--r--gmp/mpn/pa32/lshift.asm33
-rw-r--r--gmp/mpn/pa32/pa-defs.m435
-rw-r--r--gmp/mpn/pa32/rshift.asm33
-rw-r--r--gmp/mpn/pa32/sub_n.asm33
-rw-r--r--gmp/mpn/pa32/udiv.asm33
-rw-r--r--gmp/mpn/pa64/README25
-rw-r--r--gmp/mpn/pa64/add_n.asm93
-rw-r--r--gmp/mpn/pa64/addmul_1.asm33
-rw-r--r--gmp/mpn/pa64/aors_n.asm130
-rw-r--r--gmp/mpn/pa64/aorslsh1_n.asm31
-rw-r--r--gmp/mpn/pa64/gmp-mparam.h293
-rw-r--r--gmp/mpn/pa64/lshift.asm31
-rw-r--r--gmp/mpn/pa64/mul_1.asm33
-rw-r--r--gmp/mpn/pa64/rshift.asm31
-rw-r--r--gmp/mpn/pa64/sqr_diagonal.asm33
-rw-r--r--gmp/mpn/pa64/sub_n.asm93
-rw-r--r--gmp/mpn/pa64/submul_1.asm33
-rw-r--r--gmp/mpn/pa64/udiv.asm33
-rw-r--r--gmp/mpn/pa64/umul.asm34
-rw-r--r--gmp/mpn/power/add_n.asm34
-rw-r--r--gmp/mpn/power/addmul_1.asm33
-rw-r--r--gmp/mpn/power/gmp-mparam.h33
-rw-r--r--gmp/mpn/power/lshift.asm33
-rw-r--r--gmp/mpn/power/mul_1.asm33
-rw-r--r--gmp/mpn/power/rshift.asm33
-rw-r--r--gmp/mpn/power/sdiv.asm31
-rw-r--r--gmp/mpn/power/sub_n.asm34
-rw-r--r--gmp/mpn/power/submul_1.asm33
-rw-r--r--gmp/mpn/power/umul.asm31
-rw-r--r--gmp/mpn/powerpc32/750/com.asm79
-rw-r--r--gmp/mpn/powerpc32/750/com_n.asm68
-rw-r--r--gmp/mpn/powerpc32/750/gmp-mparam.h230
-rw-r--r--gmp/mpn/powerpc32/750/lshift.asm31
-rw-r--r--gmp/mpn/powerpc32/750/rshift.asm31
-rw-r--r--gmp/mpn/powerpc32/README25
-rw-r--r--gmp/mpn/powerpc32/addlsh1_n.asm31
-rw-r--r--gmp/mpn/powerpc32/addmul_1.asm34
-rw-r--r--gmp/mpn/powerpc32/aix.m435
-rw-r--r--gmp/mpn/powerpc32/aors_n.asm50
-rw-r--r--gmp/mpn/powerpc32/bdiv_dbm1c.asm31
-rw-r--r--gmp/mpn/powerpc32/darwin.m441
-rw-r--r--gmp/mpn/powerpc32/diveby3.asm33
-rw-r--r--gmp/mpn/powerpc32/divrem_2.asm41
-rw-r--r--gmp/mpn/powerpc32/eabi.m433
-rw-r--r--gmp/mpn/powerpc32/elf.m440
-rw-r--r--gmp/mpn/powerpc32/gmp-mparam.h256
-rw-r--r--gmp/mpn/powerpc32/invert_limb.asm142
-rw-r--r--gmp/mpn/powerpc32/lshift.asm38
-rw-r--r--gmp/mpn/powerpc32/lshiftc.asm168
-rw-r--r--gmp/mpn/powerpc32/mod_34lsub1.asm31
-rw-r--r--gmp/mpn/powerpc32/mode1o.asm33
-rw-r--r--gmp/mpn/powerpc32/mul_1.asm31
-rw-r--r--gmp/mpn/powerpc32/p3-p7/aors_n.asm186
-rw-r--r--gmp/mpn/powerpc32/p3/gmp-mparam.h155
-rw-r--r--gmp/mpn/powerpc32/p4/gmp-mparam.h204
-rw-r--r--gmp/mpn/powerpc32/p5/gmp-mparam.h156
-rw-r--r--gmp/mpn/powerpc32/p6/gmp-mparam.h165
-rw-r--r--gmp/mpn/powerpc32/p7/gmp-mparam.h159
-rw-r--r--gmp/mpn/powerpc32/powerpc-defs.m433
-rw-r--r--gmp/mpn/powerpc32/rshift.asm38
-rw-r--r--gmp/mpn/powerpc32/sec_tabselect.asm141
-rw-r--r--gmp/mpn/powerpc32/sqr_diag_addlsh1.asm80
-rw-r--r--gmp/mpn/powerpc32/sqr_diagonal.asm103
-rw-r--r--gmp/mpn/powerpc32/sublsh1_n.asm31
-rw-r--r--gmp/mpn/powerpc32/submul_1.asm31
-rw-r--r--gmp/mpn/powerpc32/umul.asm37
-rw-r--r--gmp/mpn/powerpc32/vmx/copyd.asm33
-rw-r--r--gmp/mpn/powerpc32/vmx/copyi.asm33
-rw-r--r--gmp/mpn/powerpc32/vmx/logops_n.asm31
-rw-r--r--gmp/mpn/powerpc32/vmx/mod_34lsub1.asm47
-rw-r--r--gmp/mpn/powerpc32/vmx/popcount.asm36
-rw-r--r--gmp/mpn/powerpc64/README31
-rw-r--r--gmp/mpn/powerpc64/aix.m449
-rw-r--r--gmp/mpn/powerpc64/com.asm136
-rw-r--r--gmp/mpn/powerpc64/com_n.asm74
-rw-r--r--gmp/mpn/powerpc64/copyd.asm40
-rw-r--r--gmp/mpn/powerpc64/copyi.asm40
-rw-r--r--gmp/mpn/powerpc64/darwin.m445
-rw-r--r--gmp/mpn/powerpc64/elf.m472
-rw-r--r--gmp/mpn/powerpc64/gmp-mparam.h63
-rw-r--r--gmp/mpn/powerpc64/logops_n.asm42
-rw-r--r--gmp/mpn/powerpc64/lshift.asm283
-rw-r--r--gmp/mpn/powerpc64/lshiftc.asm210
-rw-r--r--gmp/mpn/powerpc64/mode32/add_n.asm33
-rw-r--r--gmp/mpn/powerpc64/mode32/addmul_1.asm33
-rw-r--r--gmp/mpn/powerpc64/mode32/mul_1.asm33
-rw-r--r--gmp/mpn/powerpc64/mode32/p4/gmp-mparam.h173
-rw-r--r--gmp/mpn/powerpc64/mode32/sqr_diagonal.asm117
-rw-r--r--gmp/mpn/powerpc64/mode32/sub_n.asm33
-rw-r--r--gmp/mpn/powerpc64/mode32/submul_1.asm33
-rw-r--r--gmp/mpn/powerpc64/mode64/addlsh1_n.asm82
-rw-r--r--gmp/mpn/powerpc64/mode64/addmul_1.asm185
-rw-r--r--gmp/mpn/powerpc64/mode64/aors_n.asm76
-rw-r--r--gmp/mpn/powerpc64/mode64/aorsmul_1.asm225
-rw-r--r--gmp/mpn/powerpc64/mode64/aorsorrlsh1_n.asm43
-rw-r--r--gmp/mpn/powerpc64/mode64/aorsorrlsh2_n.asm43
-rw-r--r--gmp/mpn/powerpc64/mode64/aorsorrlshC_n.asm187
-rw-r--r--gmp/mpn/powerpc64/mode64/bdiv_dbm1c.asm70
-rw-r--r--gmp/mpn/powerpc64/mode64/cnd_aors_n.asm196
-rw-r--r--gmp/mpn/powerpc64/mode64/dive_1.asm64
-rw-r--r--gmp/mpn/powerpc64/mode64/diveby3.asm83
-rw-r--r--gmp/mpn/powerpc64/mode64/divrem_1.asm136
-rw-r--r--gmp/mpn/powerpc64/mode64/divrem_2.asm51
-rw-r--r--gmp/mpn/powerpc64/mode64/gcd_1.asm122
-rw-r--r--gmp/mpn/powerpc64/mode64/gmp-mparam.h83
-rw-r--r--gmp/mpn/powerpc64/mode64/invert_limb.asm159
-rw-r--r--gmp/mpn/powerpc64/mode64/mod_1_1.asm164
-rw-r--r--gmp/mpn/powerpc64/mode64/mod_1_4.asm270
-rw-r--r--gmp/mpn/powerpc64/mode64/mod_34lsub1.asm43
-rw-r--r--gmp/mpn/powerpc64/mode64/mode1o.asm47
-rw-r--r--gmp/mpn/powerpc64/mode64/mul_1.asm59
-rw-r--r--gmp/mpn/powerpc64/mode64/mul_basecase.asm46
-rw-r--r--gmp/mpn/powerpc64/mode64/p3/gmp-mparam.h179
-rw-r--r--gmp/mpn/powerpc64/mode64/p4/gmp-mparam.h208
-rw-r--r--gmp/mpn/powerpc64/mode64/p5/gmp-mparam.h219
-rw-r--r--gmp/mpn/powerpc64/mode64/p6/aorsmul_1.asm183
-rw-r--r--gmp/mpn/powerpc64/mode64/p6/gmp-mparam.h160
-rw-r--r--gmp/mpn/powerpc64/mode64/p6/mul_basecase.asm589
-rw-r--r--gmp/mpn/powerpc64/mode64/p7/aormul_2.asm135
-rw-r--r--gmp/mpn/powerpc64/mode64/p7/aors_n.asm128
-rw-r--r--gmp/mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm43
-rw-r--r--gmp/mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm43
-rw-r--r--gmp/mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm129
-rw-r--r--gmp/mpn/powerpc64/mode64/p7/gcd_1.asm110
-rw-r--r--gmp/mpn/powerpc64/mode64/p7/gmp-mparam.h243
-rw-r--r--gmp/mpn/powerpc64/mode64/rsh1add_n.asm104
-rw-r--r--gmp/mpn/powerpc64/mode64/rsh1aors_n.asm172
-rw-r--r--gmp/mpn/powerpc64/mode64/rsh1sub_n.asm102
-rw-r--r--gmp/mpn/powerpc64/mode64/sqr_basecase.asm863
-rw-r--r--gmp/mpn/powerpc64/mode64/sublsh1_n.asm83
-rw-r--r--gmp/mpn/powerpc64/mode64/submul_1.asm62
-rw-r--r--gmp/mpn/powerpc64/p6/lshift.asm132
-rw-r--r--gmp/mpn/powerpc64/p6/lshiftc.asm136
-rw-r--r--gmp/mpn/powerpc64/p6/rshift.asm131
-rw-r--r--gmp/mpn/powerpc64/p7/copyd.asm128
-rw-r--r--gmp/mpn/powerpc64/p7/copyi.asm129
-rw-r--r--gmp/mpn/powerpc64/p7/hamdist.asm110
-rw-r--r--gmp/mpn/powerpc64/p7/popcount.asm90
-rw-r--r--gmp/mpn/powerpc64/rshift.asm264
-rw-r--r--gmp/mpn/powerpc64/sec_tabselect.asm147
-rw-r--r--gmp/mpn/powerpc64/sqr_diagonal.asm55
-rw-r--r--gmp/mpn/powerpc64/umul.asm37
-rw-r--r--gmp/mpn/powerpc64/vmx/popcount.asm192
-rw-r--r--gmp/mpn/pyr/add_n.s74
-rw-r--r--gmp/mpn/pyr/addmul_1.s43
-rw-r--r--gmp/mpn/pyr/mul_1.s40
-rw-r--r--gmp/mpn/pyr/sub_n.s74
-rw-r--r--gmp/mpn/s390/README (renamed from gmp/mpn/s390_32/README)0
-rw-r--r--gmp/mpn/s390/addmul_1.asm (renamed from gmp/mpn/s390_32/addmul_1.asm)31
-rw-r--r--gmp/mpn/s390/gmp-mparam.h54
-rw-r--r--gmp/mpn/s390/mul_1.asm (renamed from gmp/mpn/s390_32/mul_1.asm)31
-rw-r--r--gmp/mpn/s390/submul_1.asm (renamed from gmp/mpn/s390_32/submul_1.asm)31
-rw-r--r--gmp/mpn/s390_32/copyd.asm145
-rw-r--r--gmp/mpn/s390_32/copyi.asm69
-rw-r--r--gmp/mpn/s390_32/esame/addmul_1.asm72
-rw-r--r--gmp/mpn/s390_32/esame/aors_n.asm137
-rw-r--r--gmp/mpn/s390_32/esame/aorslsh1_n.asm173
-rw-r--r--gmp/mpn/s390_32/esame/bdiv_dbm1c.asm65
-rw-r--r--gmp/mpn/s390_32/esame/gmp-mparam.h207
-rw-r--r--gmp/mpn/s390_32/esame/mul_1.asm66
-rw-r--r--gmp/mpn/s390_32/esame/mul_basecase.asm130
-rw-r--r--gmp/mpn/s390_32/esame/sqr_basecase.asm203
-rw-r--r--gmp/mpn/s390_32/esame/submul_1.asm70
-rw-r--r--gmp/mpn/s390_32/gmp-mparam.h138
-rw-r--r--gmp/mpn/s390_32/logops_n.asm295
-rw-r--r--gmp/mpn/s390_32/lshift.asm144
-rw-r--r--gmp/mpn/s390_32/lshiftc.asm156
-rw-r--r--gmp/mpn/s390_32/rshift.asm138
-rw-r--r--gmp/mpn/s390_64/README88
-rw-r--r--gmp/mpn/s390_64/addmul_1.asm72
-rw-r--r--gmp/mpn/s390_64/aorrlsh1_n.asm168
-rw-r--r--gmp/mpn/s390_64/aors_n.asm136
-rw-r--r--gmp/mpn/s390_64/bdiv_dbm1c.asm65
-rw-r--r--gmp/mpn/s390_64/copyd.asm144
-rw-r--r--gmp/mpn/s390_64/copyi.asm68
-rw-r--r--gmp/mpn/s390_64/gmp-mparam.h175
-rw-r--r--gmp/mpn/s390_64/invert_limb.asm94
-rw-r--r--gmp/mpn/s390_64/logops_n.asm291
-rw-r--r--gmp/mpn/s390_64/lshift.asm196
-rw-r--r--gmp/mpn/s390_64/lshiftc.asm207
-rw-r--r--gmp/mpn/s390_64/mod_34lsub1.asm109
-rw-r--r--gmp/mpn/s390_64/mul_1.asm66
-rw-r--r--gmp/mpn/s390_64/mul_basecase.asm130
-rw-r--r--gmp/mpn/s390_64/rshift.asm195
-rw-r--r--gmp/mpn/s390_64/sqr_basecase.asm203
-rw-r--r--gmp/mpn/s390_64/sublsh1_n.asm169
-rw-r--r--gmp/mpn/s390_64/submul_1.asm70
-rw-r--r--gmp/mpn/s390_64/z10/gmp-mparam.h231
-rw-r--r--gmp/mpn/sh/add_n.asm59
-rw-r--r--gmp/mpn/sh/add_n.s45
-rw-r--r--gmp/mpn/sh/sh2/addmul_1.asm65
-rw-r--r--gmp/mpn/sh/sh2/addmul_1.s51
-rw-r--r--gmp/mpn/sh/sh2/mul_1.asm62
-rw-r--r--gmp/mpn/sh/sh2/mul_1.s48
-rw-r--r--gmp/mpn/sh/sh2/submul_1.asm65
-rw-r--r--gmp/mpn/sh/sh2/submul_1.s51
-rw-r--r--gmp/mpn/sh/sub_n.asm59
-rw-r--r--gmp/mpn/sh/sub_n.s45
-rw-r--r--gmp/mpn/sparc32/README25
-rw-r--r--gmp/mpn/sparc32/add_n.asm31
-rw-r--r--gmp/mpn/sparc32/addmul_1.asm33
-rw-r--r--gmp/mpn/sparc32/gmp-mparam.h34
-rw-r--r--gmp/mpn/sparc32/lshift.asm31
-rw-r--r--gmp/mpn/sparc32/mul_1.asm33
-rw-r--r--gmp/mpn/sparc32/rshift.asm31
-rw-r--r--gmp/mpn/sparc32/sparc-defs.m466
-rw-r--r--gmp/mpn/sparc32/sub_n.asm31
-rw-r--r--gmp/mpn/sparc32/submul_1.asm33
-rw-r--r--gmp/mpn/sparc32/udiv.asm31
-rw-r--r--gmp/mpn/sparc32/udiv_nfp.asm31
-rw-r--r--gmp/mpn/sparc32/ultrasparct1/add_n.asm70
-rw-r--r--gmp/mpn/sparc32/ultrasparct1/addmul_1.asm90
-rw-r--r--gmp/mpn/sparc32/ultrasparct1/gmp-mparam.h153
-rw-r--r--gmp/mpn/sparc32/ultrasparct1/mul_1.asm83
-rw-r--r--gmp/mpn/sparc32/ultrasparct1/sqr_diagonal.asm55
-rw-r--r--gmp/mpn/sparc32/ultrasparct1/sub_n.asm70
-rw-r--r--gmp/mpn/sparc32/ultrasparct1/submul_1.asm91
-rw-r--r--gmp/mpn/sparc32/umul.asm31
-rw-r--r--gmp/mpn/sparc32/v8/addmul_1.asm33
-rw-r--r--gmp/mpn/sparc32/v8/gmp-mparam.h38
-rw-r--r--gmp/mpn/sparc32/v8/mul_1.asm31
-rw-r--r--gmp/mpn/sparc32/v8/submul_1.asm33
-rw-r--r--gmp/mpn/sparc32/v8/supersparc/gmp-mparam.h38
-rw-r--r--gmp/mpn/sparc32/v8/supersparc/udiv.asm31
-rw-r--r--gmp/mpn/sparc32/v8/udiv.asm31
-rw-r--r--gmp/mpn/sparc32/v8/umul.asm31
-rw-r--r--gmp/mpn/sparc32/v9/add_n.asm31
-rw-r--r--gmp/mpn/sparc32/v9/addmul_1.asm31
-rw-r--r--gmp/mpn/sparc32/v9/gmp-mparam.h257
-rw-r--r--gmp/mpn/sparc32/v9/mul_1.asm31
-rw-r--r--gmp/mpn/sparc32/v9/sqr_diagonal.asm31
-rw-r--r--gmp/mpn/sparc32/v9/sub_n.asm31
-rw-r--r--gmp/mpn/sparc32/v9/submul_1.asm31
-rw-r--r--gmp/mpn/sparc32/v9/udiv.asm31
-rw-r--r--gmp/mpn/sparc64/README29
-rw-r--r--gmp/mpn/sparc64/add_n.asm (renamed from gmp/mpn/sparc64/ultrasparc1234/add_n.asm)137
-rw-r--r--gmp/mpn/sparc64/addmul_1.asm (renamed from gmp/mpn/sparc64/ultrasparc1234/addmul_1.asm)44
-rw-r--r--gmp/mpn/sparc64/addmul_2.asm (renamed from gmp/mpn/sparc64/ultrasparc1234/addmul_2.asm)31
-rw-r--r--gmp/mpn/sparc64/copyd.asm48
-rw-r--r--gmp/mpn/sparc64/copyi.asm48
-rw-r--r--gmp/mpn/sparc64/dive_1.c25
-rw-r--r--gmp/mpn/sparc64/divrem_1.c29
-rw-r--r--gmp/mpn/sparc64/gcd_1.asm135
-rw-r--r--gmp/mpn/sparc64/gmp-mparam.h201
-rw-r--r--gmp/mpn/sparc64/lshift.asm256
-rw-r--r--gmp/mpn/sparc64/lshiftc.asm147
-rw-r--r--gmp/mpn/sparc64/mod_1.c82
-rw-r--r--gmp/mpn/sparc64/mod_1_4.c236
-rw-r--r--gmp/mpn/sparc64/mode1o.c27
-rw-r--r--gmp/mpn/sparc64/mul_1.asm (renamed from gmp/mpn/sparc64/ultrasparc1234/mul_1.asm)43
-rw-r--r--gmp/mpn/sparc64/rshift.asm255
-rw-r--r--gmp/mpn/sparc64/sec_tabselect.asm162
-rw-r--r--gmp/mpn/sparc64/sparc64.h43
-rw-r--r--gmp/mpn/sparc64/sqr_diagonal.asm (renamed from gmp/mpn/sparc64/ultrasparc1234/sqr_diagonal.asm)31
-rw-r--r--gmp/mpn/sparc64/sub_n.asm (renamed from gmp/mpn/sparc64/ultrasparc1234/sub_n.asm)109
-rw-r--r--gmp/mpn/sparc64/submul_1.asm (renamed from gmp/mpn/sparc64/ultrasparc1234/submul_1.asm)33
-rw-r--r--gmp/mpn/sparc64/ultrasparc1234/lshiftc.asm165
-rw-r--r--gmp/mpn/sparc64/ultrasparc34/gmp-mparam.h219
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/add_n.asm68
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/addlsh1_n.asm41
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/addlsh2_n.asm41
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/addlshC_n.asm69
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/addmul_1.asm86
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/gmp-mparam.h154
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/mul_1.asm82
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/rsblsh1_n.asm41
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/rsblsh2_n.asm41
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/rsblshC_n.asm69
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/sub_n.asm68
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/sublsh1_n.asm41
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/sublsh2_n.asm41
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/sublshC_n.asm69
-rw-r--r--gmp/mpn/sparc64/ultrasparct1/submul_1.asm86
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/add_n.asm126
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/addmul_1.asm182
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/aormul_2.asm228
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/aormul_4.asm219
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/aorslsh_n.asm147
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm147
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/cnd_aors_n.asm143
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/dive_1.asm129
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/hamdist.asm78
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/invert_limb.asm92
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/missing.asm77
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/missing.m488
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/mod_1_4.asm233
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/mod_34lsub1.asm117
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/mode1o.asm82
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/mul_1.asm174
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/popcount.asm70
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm93
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/sub_n.asm144
-rw-r--r--gmp/mpn/sparc64/ultrasparct3/submul_1.asm170
-rw-r--r--gmp/mpn/thumb/add_n.asm63
-rw-r--r--gmp/mpn/thumb/add_n.s48
-rw-r--r--gmp/mpn/thumb/sub_n.asm63
-rw-r--r--gmp/mpn/thumb/sub_n.s48
-rw-r--r--gmp/mpn/vax/add_n.asm64
-rw-r--r--gmp/mpn/vax/add_n.s59
-rw-r--r--gmp/mpn/vax/addmul_1.asm124
-rw-r--r--gmp/mpn/vax/addmul_1.s124
-rw-r--r--gmp/mpn/vax/elf.m454
-rw-r--r--gmp/mpn/vax/gmp-mparam.h35
-rw-r--r--gmp/mpn/vax/lshift.asm59
-rw-r--r--gmp/mpn/vax/lshift.s56
-rw-r--r--gmp/mpn/vax/mul_1.asm118
-rw-r--r--gmp/mpn/vax/mul_1.s121
-rw-r--r--gmp/mpn/vax/rshift.asm57
-rw-r--r--gmp/mpn/vax/rshift.s54
-rw-r--r--gmp/mpn/vax/sub_n.asm64
-rw-r--r--gmp/mpn/vax/sub_n.s59
-rw-r--r--gmp/mpn/vax/submul_1.asm124
-rw-r--r--gmp/mpn/vax/submul_1.s124
-rw-r--r--gmp/mpn/x86/README27
-rw-r--r--gmp/mpn/x86/aors_n.asm50
-rw-r--r--gmp/mpn/x86/aorsmul_1.asm61
-rw-r--r--gmp/mpn/x86/atom/aorrlsh1_n.asm53
-rw-r--r--gmp/mpn/x86/atom/aorrlsh2_n.asm53
-rw-r--r--gmp/mpn/x86/atom/aorrlshC_n.asm156
-rw-r--r--gmp/mpn/x86/atom/aors_n.asm159
-rw-r--r--gmp/mpn/x86/atom/aorslshC_n.asm247
-rw-r--r--gmp/mpn/x86/atom/bdiv_q_1.asm35
-rw-r--r--gmp/mpn/x86/atom/cnd_add_n.asm113
-rw-r--r--gmp/mpn/x86/atom/cnd_sub_n.asm124
-rw-r--r--gmp/mpn/x86/atom/dive_1.asm34
-rw-r--r--gmp/mpn/x86/atom/gmp-mparam.h201
-rw-r--r--gmp/mpn/x86/atom/logops_n.asm151
-rw-r--r--gmp/mpn/x86/atom/lshift.asm218
-rw-r--r--gmp/mpn/x86/atom/lshiftc.asm159
-rw-r--r--gmp/mpn/x86/atom/mmx/copyd.asm34
-rw-r--r--gmp/mpn/x86/atom/mmx/copyi.asm34
-rw-r--r--gmp/mpn/x86/atom/mmx/hamdist.asm34
-rw-r--r--gmp/mpn/x86/atom/mod_34lsub1.asm34
-rw-r--r--gmp/mpn/x86/atom/mode1o.asm34
-rw-r--r--gmp/mpn/x86/atom/rshift.asm152
-rw-r--r--gmp/mpn/x86/atom/sse2/aorsmul_1.asm174
-rw-r--r--gmp/mpn/x86/atom/sse2/bdiv_dbm1c.asm34
-rw-r--r--gmp/mpn/x86/atom/sse2/divrem_1.asm34
-rw-r--r--gmp/mpn/x86/atom/sse2/mod_1_1.asm34
-rw-r--r--gmp/mpn/x86/atom/sse2/mod_1_4.asm34
-rw-r--r--gmp/mpn/x86/atom/sse2/mul_1.asm124
-rw-r--r--gmp/mpn/x86/atom/sse2/mul_basecase.asm501
-rw-r--r--gmp/mpn/x86/atom/sse2/popcount.asm35
-rw-r--r--gmp/mpn/x86/atom/sse2/sqr_basecase.asm634
-rw-r--r--gmp/mpn/x86/atom/sublsh1_n.asm34
-rw-r--r--gmp/mpn/x86/atom/sublsh2_n.asm57
-rw-r--r--gmp/mpn/x86/bd1/gmp-mparam.h208
-rw-r--r--gmp/mpn/x86/bd2/gmp-mparam.h209
-rw-r--r--gmp/mpn/x86/bdiv_dbm1c.asm71
-rw-r--r--gmp/mpn/x86/bdiv_q_1.asm208
-rw-r--r--gmp/mpn/x86/bobcat/gmp-mparam.h197
-rw-r--r--gmp/mpn/x86/cnd_aors_n.asm124
-rw-r--r--gmp/mpn/x86/copyd.asm45
-rw-r--r--gmp/mpn/x86/copyi.asm45
-rw-r--r--gmp/mpn/x86/core2/gmp-mparam.h200
-rw-r--r--gmp/mpn/x86/coreihwl/gmp-mparam.h210
-rw-r--r--gmp/mpn/x86/coreinhm/gmp-mparam.h224
-rw-r--r--gmp/mpn/x86/coreisbr/gmp-mparam.h203
-rw-r--r--gmp/mpn/x86/darwin.m482
-rw-r--r--gmp/mpn/x86/dive_1.asm35
-rw-r--r--gmp/mpn/x86/divrem_1.asm36
-rw-r--r--gmp/mpn/x86/divrem_2.asm35
-rw-r--r--gmp/mpn/x86/fat/com.c32
-rw-r--r--gmp/mpn/x86/fat/diveby3.c21
-rw-r--r--gmp/mpn/x86/fat/fat.c228
-rw-r--r--gmp/mpn/x86/fat/fat_entry.asm37
-rw-r--r--gmp/mpn/x86/fat/gcd_1.c25
-rw-r--r--gmp/mpn/x86/fat/gmp-mparam.h42
-rw-r--r--gmp/mpn/x86/fat/lshiftc.c32
-rw-r--r--gmp/mpn/x86/fat/mod_1.c32
-rw-r--r--gmp/mpn/x86/fat/mod_1_1.c36
-rw-r--r--gmp/mpn/x86/fat/mod_1_2.c36
-rw-r--r--gmp/mpn/x86/fat/mod_1_4.c36
-rw-r--r--gmp/mpn/x86/fat/mode1o.c25
-rw-r--r--gmp/mpn/x86/fat/mullo_basecase.c32
-rw-r--r--gmp/mpn/x86/fat/redc_1.c32
-rw-r--r--gmp/mpn/x86/fat/redc_2.c32
-rw-r--r--gmp/mpn/x86/geode/gmp-mparam.h141
-rw-r--r--gmp/mpn/x86/gmp-mparam.h31
-rw-r--r--gmp/mpn/x86/i486/gmp-mparam.h37
-rw-r--r--gmp/mpn/x86/k10/gmp-mparam.h211
-rw-r--r--gmp/mpn/x86/k6/README25
-rw-r--r--gmp/mpn/x86/k6/aors_n.asm35
-rw-r--r--gmp/mpn/x86/k6/aorsmul_1.asm56
-rwxr-xr-xgmp/mpn/x86/k6/cross.pl33
-rw-r--r--gmp/mpn/x86/k6/divrem_1.asm36
-rw-r--r--gmp/mpn/x86/k6/gcd_1.asm35
-rw-r--r--gmp/mpn/x86/k6/gmp-mparam.h202
-rw-r--r--gmp/mpn/x86/k6/k62mmx/copyd.asm33
-rw-r--r--gmp/mpn/x86/k6/k62mmx/lshift.asm33
-rw-r--r--gmp/mpn/x86/k6/k62mmx/rshift.asm33
-rw-r--r--gmp/mpn/x86/k6/mmx/com_n.asm (renamed from gmp/mpn/x86/k6/mmx/com.asm)41
-rw-r--r--gmp/mpn/x86/k6/mmx/dive_1.asm37
-rw-r--r--gmp/mpn/x86/k6/mmx/logops_n.asm35
-rw-r--r--gmp/mpn/x86/k6/mmx/lshift.asm33
-rw-r--r--gmp/mpn/x86/k6/mmx/popham.asm35
-rw-r--r--gmp/mpn/x86/k6/mmx/rshift.asm33
-rw-r--r--gmp/mpn/x86/k6/mod_34lsub1.asm35
-rw-r--r--gmp/mpn/x86/k6/mode1o.asm37
-rw-r--r--gmp/mpn/x86/k6/mul_1.asm47
-rw-r--r--gmp/mpn/x86/k6/mul_basecase.asm35
-rw-r--r--gmp/mpn/x86/k6/pre_mod_1.asm33
-rw-r--r--gmp/mpn/x86/k6/sqr_basecase.asm57
-rw-r--r--gmp/mpn/x86/k7/README25
-rw-r--r--gmp/mpn/x86/k7/addlsh1_n.asm196
-rw-r--r--gmp/mpn/x86/k7/aors_n.asm35
-rw-r--r--gmp/mpn/x86/k7/aorsmul_1.asm50
-rw-r--r--gmp/mpn/x86/k7/bdiv_q_1.asm244
-rw-r--r--gmp/mpn/x86/k7/dive_1.asm35
-rw-r--r--gmp/mpn/x86/k7/gcd_1.asm481
-rw-r--r--gmp/mpn/x86/k7/gmp-mparam.h292
-rw-r--r--gmp/mpn/x86/k7/invert_limb.asm193
-rw-r--r--gmp/mpn/x86/k7/mmx/com_n.asm (renamed from gmp/mpn/x86/k7/mmx/com.asm)39
-rw-r--r--gmp/mpn/x86/k7/mmx/copyd.asm33
-rw-r--r--gmp/mpn/x86/k7/mmx/copyi.asm33
-rw-r--r--gmp/mpn/x86/k7/mmx/divrem_1.asm49
-rw-r--r--gmp/mpn/x86/k7/mmx/lshift.asm35
-rw-r--r--gmp/mpn/x86/k7/mmx/mod_1.asm509
-rw-r--r--gmp/mpn/x86/k7/mmx/popham.asm37
-rw-r--r--gmp/mpn/x86/k7/mmx/rshift.asm35
-rw-r--r--gmp/mpn/x86/k7/mod_1_1.asm221
-rw-r--r--gmp/mpn/x86/k7/mod_1_4.asm260
-rw-r--r--gmp/mpn/x86/k7/mod_34lsub1.asm36
-rw-r--r--gmp/mpn/x86/k7/mode1o.asm37
-rw-r--r--gmp/mpn/x86/k7/mul_1.asm46
-rw-r--r--gmp/mpn/x86/k7/mul_basecase.asm35
-rw-r--r--gmp/mpn/x86/k7/sqr_basecase.asm47
-rw-r--r--gmp/mpn/x86/k7/sublsh1_n.asm173
-rw-r--r--gmp/mpn/x86/k8/gmp-mparam.h198
-rw-r--r--gmp/mpn/x86/lshift.asm48
-rw-r--r--gmp/mpn/x86/mmx/sec_tabselect.asm163
-rw-r--r--gmp/mpn/x86/mod_1.asm163
-rw-r--r--gmp/mpn/x86/mod_34lsub1.asm45
-rw-r--r--gmp/mpn/x86/mul_1.asm56
-rw-r--r--gmp/mpn/x86/mul_basecase.asm46
-rw-r--r--gmp/mpn/x86/nano/gmp-mparam.h162
-rw-r--r--gmp/mpn/x86/p6/README27
-rw-r--r--gmp/mpn/x86/p6/aors_n.asm37
-rw-r--r--gmp/mpn/x86/p6/aorsmul_1.asm53
-rw-r--r--gmp/mpn/x86/p6/bdiv_q_1.asm286
-rw-r--r--gmp/mpn/x86/p6/copyd.asm33
-rw-r--r--gmp/mpn/x86/p6/dive_1.asm37
-rw-r--r--gmp/mpn/x86/p6/gcd_1.asm156
-rw-r--r--gmp/mpn/x86/p6/gmp-mparam.h240
-rw-r--r--gmp/mpn/x86/p6/lshsub_n.asm29
-rw-r--r--gmp/mpn/x86/p6/mmx/divrem_1.asm35
-rw-r--r--gmp/mpn/x86/p6/mmx/gmp-mparam.h255
-rw-r--r--gmp/mpn/x86/p6/mmx/lshift.asm33
-rw-r--r--gmp/mpn/x86/p6/mmx/popham.asm33
-rw-r--r--gmp/mpn/x86/p6/mmx/rshift.asm33
-rw-r--r--gmp/mpn/x86/p6/mod_1.asm472
-rw-r--r--gmp/mpn/x86/p6/mod_34lsub1.asm35
-rw-r--r--gmp/mpn/x86/p6/mode1o.asm39
-rw-r--r--gmp/mpn/x86/p6/mul_basecase.asm35
-rw-r--r--gmp/mpn/x86/p6/p3mmx/popham.asm33
-rw-r--r--gmp/mpn/x86/p6/sqr_basecase.asm45
-rw-r--r--gmp/mpn/x86/p6/sse2/addmul_1.asm33
-rw-r--r--gmp/mpn/x86/p6/sse2/gmp-mparam.h233
-rw-r--r--gmp/mpn/x86/p6/sse2/mod_1_1.asm34
-rw-r--r--gmp/mpn/x86/p6/sse2/mod_1_4.asm34
-rw-r--r--gmp/mpn/x86/p6/sse2/mul_1.asm33
-rw-r--r--gmp/mpn/x86/p6/sse2/mul_basecase.asm33
-rw-r--r--gmp/mpn/x86/p6/sse2/popcount.asm33
-rw-r--r--gmp/mpn/x86/p6/sse2/sqr_basecase.asm33
-rw-r--r--gmp/mpn/x86/p6/sse2/submul_1.asm33
-rw-r--r--gmp/mpn/x86/pentium/README27
-rw-r--r--gmp/mpn/x86/pentium/aors_n.asm40
-rw-r--r--gmp/mpn/x86/pentium/aorsmul_1.asm33
-rw-r--r--gmp/mpn/x86/pentium/bdiv_q_1.asm260
-rw-r--r--gmp/mpn/x86/pentium/com_n.asm (renamed from gmp/mpn/x86/pentium/com.asm)39
-rw-r--r--gmp/mpn/x86/pentium/copyd.asm33
-rw-r--r--gmp/mpn/x86/pentium/copyi.asm33
-rw-r--r--gmp/mpn/x86/pentium/dive_1.asm35
-rw-r--r--gmp/mpn/x86/pentium/gmp-mparam.h38
-rw-r--r--gmp/mpn/x86/pentium/hamdist.asm33
-rw-r--r--gmp/mpn/x86/pentium/logops_n.asm33
-rw-r--r--gmp/mpn/x86/pentium/lshift.asm36
-rw-r--r--gmp/mpn/x86/pentium/mmx/gmp-mparam.h194
-rw-r--r--gmp/mpn/x86/pentium/mmx/hamdist.asm33
-rw-r--r--gmp/mpn/x86/pentium/mmx/lshift.asm35
-rw-r--r--gmp/mpn/x86/pentium/mmx/mul_1.asm35
-rw-r--r--gmp/mpn/x86/pentium/mmx/rshift.asm33
-rw-r--r--gmp/mpn/x86/pentium/mod_1.asm454
-rw-r--r--gmp/mpn/x86/pentium/mod_34lsub1.asm35
-rw-r--r--gmp/mpn/x86/pentium/mode1o.asm37
-rw-r--r--gmp/mpn/x86/pentium/mul_1.asm33
-rw-r--r--gmp/mpn/x86/pentium/mul_2.asm33
-rw-r--r--gmp/mpn/x86/pentium/mul_basecase.asm35
-rw-r--r--gmp/mpn/x86/pentium/popcount.asm33
-rw-r--r--gmp/mpn/x86/pentium/rshift.asm36
-rw-r--r--gmp/mpn/x86/pentium/sqr_basecase.asm35
-rw-r--r--gmp/mpn/x86/pentium4/README25
-rw-r--r--gmp/mpn/x86/pentium4/copyd.asm36
-rw-r--r--gmp/mpn/x86/pentium4/copyi.asm36
-rw-r--r--gmp/mpn/x86/pentium4/mmx/lshift.asm33
-rw-r--r--gmp/mpn/x86/pentium4/mmx/popham.asm35
-rw-r--r--gmp/mpn/x86/pentium4/mmx/rshift.asm33
-rw-r--r--gmp/mpn/x86/pentium4/sse2/add_n.asm79
-rw-r--r--gmp/mpn/x86/pentium4/sse2/addlsh1_n.asm76
-rw-r--r--gmp/mpn/x86/pentium4/sse2/addmul_1.asm64
-rw-r--r--gmp/mpn/x86/pentium4/sse2/bdiv_dbm1c.asm141
-rw-r--r--gmp/mpn/x86/pentium4/sse2/bdiv_q_1.asm233
-rw-r--r--gmp/mpn/x86/pentium4/sse2/cnd_add_n.asm95
-rw-r--r--gmp/mpn/x86/pentium4/sse2/cnd_sub_n.asm114
-rw-r--r--gmp/mpn/x86/pentium4/sse2/dive_1.asm49
-rw-r--r--gmp/mpn/x86/pentium4/sse2/divrem_1.asm36
-rw-r--r--gmp/mpn/x86/pentium4/sse2/gmp-mparam.h252
-rw-r--r--gmp/mpn/x86/pentium4/sse2/mod_1.asm391
-rw-r--r--gmp/mpn/x86/pentium4/sse2/mod_1_1.asm166
-rw-r--r--gmp/mpn/x86/pentium4/sse2/mod_1_4.asm269
-rw-r--r--gmp/mpn/x86/pentium4/sse2/mod_34lsub1.asm35
-rw-r--r--gmp/mpn/x86/pentium4/sse2/mode1o.asm49
-rw-r--r--gmp/mpn/x86/pentium4/sse2/mul_1.asm64
-rw-r--r--gmp/mpn/x86/pentium4/sse2/mul_basecase.asm27
-rw-r--r--gmp/mpn/x86/pentium4/sse2/popcount.asm76
-rw-r--r--gmp/mpn/x86/pentium4/sse2/rsh1add_n.asm35
-rw-r--r--gmp/mpn/x86/pentium4/sse2/sqr_basecase.asm29
-rw-r--r--gmp/mpn/x86/pentium4/sse2/sub_n.asm82
-rw-r--r--gmp/mpn/x86/pentium4/sse2/submul_1.asm176
-rw-r--r--gmp/mpn/x86/rshift.asm48
-rw-r--r--gmp/mpn/x86/sec_tabselect.asm115
-rw-r--r--gmp/mpn/x86/sqr_basecase.asm37
-rwxr-xr-xgmp/mpn/x86/t-zdisp.sh33
-rwxr-xr-xgmp/mpn/x86/t-zdisp2.pl41
-rw-r--r--gmp/mpn/x86/udiv.asm33
-rw-r--r--gmp/mpn/x86/umul.asm33
-rw-r--r--gmp/mpn/x86/x86-defs.m487
-rw-r--r--gmp/mpn/x86_64/README25
-rw-r--r--gmp/mpn/x86_64/addaddmul_1msb0.asm53
-rw-r--r--gmp/mpn/x86_64/addlsh1_n.asm (renamed from gmp/mpn/x86_64/aorrlsh1_n.asm)97
-rw-r--r--gmp/mpn/x86_64/addmul_2.asm175
-rw-r--r--gmp/mpn/x86_64/aorrlsh2_n.asm53
-rw-r--r--gmp/mpn/x86_64/aorrlshC_n.asm160
-rw-r--r--gmp/mpn/x86_64/aorrlsh_n.asm159
-rw-r--r--gmp/mpn/x86_64/aors_err1_n.asm225
-rw-r--r--gmp/mpn/x86_64/aors_err2_n.asm172
-rw-r--r--gmp/mpn/x86_64/aors_err3_n.asm156
-rw-r--r--gmp/mpn/x86_64/aors_n.asm149
-rw-r--r--gmp/mpn/x86_64/aorsmul_1.asm99
-rw-r--r--gmp/mpn/x86_64/atom/addmul_2.asm186
-rw-r--r--gmp/mpn/x86_64/atom/aorrlsh1_n.asm238
-rw-r--r--gmp/mpn/x86_64/atom/aorrlsh2_n.asm191
-rw-r--r--gmp/mpn/x86_64/atom/aors_n.asm155
-rw-r--r--gmp/mpn/x86_64/atom/aorsmul_1.asm190
-rw-r--r--gmp/mpn/x86_64/atom/com.asm37
-rw-r--r--gmp/mpn/x86_64/atom/copyd.asm37
-rw-r--r--gmp/mpn/x86_64/atom/copyi.asm37
-rw-r--r--gmp/mpn/x86_64/atom/dive_1.asm37
-rw-r--r--gmp/mpn/x86_64/atom/gmp-mparam.h276
-rw-r--r--gmp/mpn/x86_64/atom/lshift.asm123
-rw-r--r--gmp/mpn/x86_64/atom/lshiftc.asm127
-rw-r--r--gmp/mpn/x86_64/atom/mul_1.asm143
-rw-r--r--gmp/mpn/x86_64/atom/mul_2.asm186
-rw-r--r--gmp/mpn/x86_64/atom/popcount.asm35
-rw-r--r--gmp/mpn/x86_64/atom/redc_1.asm574
-rw-r--r--gmp/mpn/x86_64/atom/rsh1aors_n.asm287
-rw-r--r--gmp/mpn/x86_64/atom/rshift.asm121
-rw-r--r--gmp/mpn/x86_64/atom/sublsh1_n.asm242
-rw-r--r--gmp/mpn/x86_64/bd1/README11
-rw-r--r--gmp/mpn/x86_64/bd1/aorrlsh1_n.asm37
-rw-r--r--gmp/mpn/x86_64/bd1/aorsmul_1.asm181
-rw-r--r--gmp/mpn/x86_64/bd1/com.asm37
-rw-r--r--gmp/mpn/x86_64/bd1/copyd.asm37
-rw-r--r--gmp/mpn/x86_64/bd1/copyi.asm37
-rw-r--r--gmp/mpn/x86_64/bd1/gcd_1.asm37
-rw-r--r--gmp/mpn/x86_64/bd1/gmp-mparam.h236
-rw-r--r--gmp/mpn/x86_64/bd1/hamdist.asm38
-rw-r--r--gmp/mpn/x86_64/bd1/mul_1.asm184
-rw-r--r--gmp/mpn/x86_64/bd1/mul_2.asm192
-rw-r--r--gmp/mpn/x86_64/bd1/mul_basecase.asm416
-rw-r--r--gmp/mpn/x86_64/bd1/popcount.asm38
-rw-r--r--gmp/mpn/x86_64/bd1/sec_tabselect.asm37
-rw-r--r--gmp/mpn/x86_64/bd1/sublsh1_n.asm37
-rw-r--r--gmp/mpn/x86_64/bd2/gmp-mparam.h237
-rw-r--r--gmp/mpn/x86_64/bdiv_dbm1c.asm146
-rw-r--r--gmp/mpn/x86_64/bdiv_q_1.asm167
-rw-r--r--gmp/mpn/x86_64/bobcat/aors_n.asm150
-rw-r--r--gmp/mpn/x86_64/bobcat/aorsmul_1.asm183
-rw-r--r--gmp/mpn/x86_64/bobcat/copyd.asm91
-rw-r--r--gmp/mpn/x86_64/bobcat/copyi.asm94
-rw-r--r--gmp/mpn/x86_64/bobcat/gmp-mparam.h208
-rw-r--r--gmp/mpn/x86_64/bobcat/mul_1.asm187
-rw-r--r--gmp/mpn/x86_64/bobcat/mul_basecase.asm486
-rw-r--r--gmp/mpn/x86_64/bobcat/redc_1.asm502
-rw-r--r--gmp/mpn/x86_64/bobcat/sqr_basecase.asm565
-rw-r--r--gmp/mpn/x86_64/cnd_aors_n.asm183
-rw-r--r--gmp/mpn/x86_64/com.asm95
-rw-r--r--gmp/mpn/x86_64/com_n.asm77
-rw-r--r--gmp/mpn/x86_64/copyd.asm119
-rw-r--r--gmp/mpn/x86_64/copyi.asm117
-rw-r--r--gmp/mpn/x86_64/core2/aorrlsh1_n.asm53
-rw-r--r--gmp/mpn/x86_64/core2/aorrlsh2_n.asm53
-rw-r--r--gmp/mpn/x86_64/core2/aorrlsh_n.asm38
-rw-r--r--gmp/mpn/x86_64/core2/aors_err1_n.asm225
-rw-r--r--gmp/mpn/x86_64/core2/aors_n.asm130
-rw-r--r--gmp/mpn/x86_64/core2/aorslsh1_n.asm (renamed from gmp/mpn/x86_64/core2/sublshC_n.asm)85
-rw-r--r--gmp/mpn/x86_64/core2/aorsmul_1.asm193
-rw-r--r--gmp/mpn/x86_64/core2/copyd.asm37
-rw-r--r--gmp/mpn/x86_64/core2/copyi.asm37
-rw-r--r--gmp/mpn/x86_64/core2/divrem_1.asm237
-rw-r--r--gmp/mpn/x86_64/core2/gcd_1.asm144
-rw-r--r--gmp/mpn/x86_64/core2/gmp-mparam.h275
-rw-r--r--gmp/mpn/x86_64/core2/lshift.asm100
-rw-r--r--gmp/mpn/x86_64/core2/lshiftc.asm159
-rw-r--r--gmp/mpn/x86_64/core2/mul_basecase.asm975
-rw-r--r--gmp/mpn/x86_64/core2/mullo_basecase.asm427
-rw-r--r--gmp/mpn/x86_64/core2/popcount.asm32
-rw-r--r--gmp/mpn/x86_64/core2/redc_1.asm425
-rw-r--r--gmp/mpn/x86_64/core2/rsh1aors_n.asm169
-rw-r--r--gmp/mpn/x86_64/core2/rshift.asm100
-rw-r--r--gmp/mpn/x86_64/core2/sec_tabselect.asm37
-rw-r--r--gmp/mpn/x86_64/core2/sqr_basecase.asm984
-rw-r--r--gmp/mpn/x86_64/core2/sublsh1_n.asm47
-rw-r--r--gmp/mpn/x86_64/core2/sublsh2_n.asm47
-rw-r--r--gmp/mpn/x86_64/coreihwl/addmul_2.asm238
-rw-r--r--gmp/mpn/x86_64/coreihwl/aorsmul_1.asm198
-rw-r--r--gmp/mpn/x86_64/coreihwl/gmp-mparam.h237
-rw-r--r--gmp/mpn/x86_64/coreihwl/mul_1.asm155
-rw-r--r--gmp/mpn/x86_64/coreihwl/mul_2.asm173
-rw-r--r--gmp/mpn/x86_64/coreihwl/mul_basecase.asm441
-rw-r--r--gmp/mpn/x86_64/coreihwl/mullo_basecase.asm426
-rw-r--r--gmp/mpn/x86_64/coreihwl/redc_1.asm433
-rw-r--r--gmp/mpn/x86_64/coreihwl/sqr_basecase.asm506
-rw-r--r--gmp/mpn/x86_64/coreinhm/aorrlsh_n.asm200
-rw-r--r--gmp/mpn/x86_64/coreinhm/aorsmul_1.asm187
-rw-r--r--gmp/mpn/x86_64/coreinhm/gmp-mparam.h231
-rw-r--r--gmp/mpn/x86_64/coreinhm/hamdist.asm38
-rw-r--r--gmp/mpn/x86_64/coreinhm/popcount.asm38
-rw-r--r--gmp/mpn/x86_64/coreinhm/redc_1.asm544
-rw-r--r--gmp/mpn/x86_64/coreinhm/sec_tabselect.asm37
-rw-r--r--gmp/mpn/x86_64/coreisbr/addmul_2.asm224
-rw-r--r--gmp/mpn/x86_64/coreisbr/aorrlsh1_n.asm54
-rw-r--r--gmp/mpn/x86_64/coreisbr/aorrlsh2_n.asm56
-rw-r--r--gmp/mpn/x86_64/coreisbr/aorrlshC_n.asm173
-rw-r--r--gmp/mpn/x86_64/coreisbr/aorrlsh_n.asm215
-rw-r--r--gmp/mpn/x86_64/coreisbr/aors_n.asm198
-rw-r--r--gmp/mpn/x86_64/coreisbr/aorsmul_1.asm209
-rw-r--r--gmp/mpn/x86_64/coreisbr/divrem_1.asm37
-rw-r--r--gmp/mpn/x86_64/coreisbr/gmp-mparam.h224
-rw-r--r--gmp/mpn/x86_64/coreisbr/lshift.asm37
-rw-r--r--gmp/mpn/x86_64/coreisbr/lshiftc.asm37
-rw-r--r--gmp/mpn/x86_64/coreisbr/mul_1.asm161
-rw-r--r--gmp/mpn/x86_64/coreisbr/mul_2.asm163
-rw-r--r--gmp/mpn/x86_64/coreisbr/mul_basecase.asm407
-rw-r--r--gmp/mpn/x86_64/coreisbr/mullo_basecase.asm384
-rw-r--r--gmp/mpn/x86_64/coreisbr/popcount.asm118
-rw-r--r--gmp/mpn/x86_64/coreisbr/redc_1.asm541
-rw-r--r--gmp/mpn/x86_64/coreisbr/rsh1aors_n.asm193
-rw-r--r--gmp/mpn/x86_64/coreisbr/rshift.asm37
-rw-r--r--gmp/mpn/x86_64/coreisbr/sec_tabselect.asm37
-rw-r--r--gmp/mpn/x86_64/coreisbr/sqr_basecase.asm484
-rw-r--r--gmp/mpn/x86_64/darwin.m475
-rw-r--r--gmp/mpn/x86_64/div_qr_1n_pi1.asm247
-rw-r--r--gmp/mpn/x86_64/div_qr_2n_pi1.asm158
-rw-r--r--gmp/mpn/x86_64/div_qr_2u_pi1.asm200
-rw-r--r--gmp/mpn/x86_64/dive_1.asm197
-rw-r--r--gmp/mpn/x86_64/divrem_1.asm233
-rw-r--r--gmp/mpn/x86_64/divrem_2.asm288
-rw-r--r--gmp/mpn/x86_64/dos64.m4100
-rw-r--r--gmp/mpn/x86_64/fastavx/copyd.asm171
-rw-r--r--gmp/mpn/x86_64/fastavx/copyi.asm168
-rw-r--r--gmp/mpn/x86_64/fastsse/README21
-rw-r--r--gmp/mpn/x86_64/fastsse/com-palignr.asm302
-rw-r--r--gmp/mpn/x86_64/fastsse/com.asm161
-rw-r--r--gmp/mpn/x86_64/fastsse/copyd-palignr.asm251
-rw-r--r--gmp/mpn/x86_64/fastsse/copyd.asm145
-rw-r--r--gmp/mpn/x86_64/fastsse/copyi-palignr.asm295
-rw-r--r--gmp/mpn/x86_64/fastsse/copyi.asm166
-rw-r--r--gmp/mpn/x86_64/fastsse/lshift-movdqu2.asm182
-rw-r--r--gmp/mpn/x86_64/fastsse/lshift.asm169
-rw-r--r--gmp/mpn/x86_64/fastsse/lshiftc-movdqu2.asm193
-rw-r--r--gmp/mpn/x86_64/fastsse/lshiftc.asm179
-rw-r--r--gmp/mpn/x86_64/fastsse/rshift-movdqu2.asm201
-rw-r--r--gmp/mpn/x86_64/fastsse/sec_tabselect.asm192
-rw-r--r--gmp/mpn/x86_64/fat/fat.c368
-rw-r--r--gmp/mpn/x86_64/fat/fat_entry.asm204
-rw-r--r--gmp/mpn/x86_64/fat/gmp-mparam.h72
-rw-r--r--gmp/mpn/x86_64/fat/mod_1.c32
-rw-r--r--gmp/mpn/x86_64/fat/mul_basecase.c32
-rw-r--r--gmp/mpn/x86_64/fat/mullo_basecase.c32
-rw-r--r--gmp/mpn/x86_64/fat/redc_1.c32
-rw-r--r--gmp/mpn/x86_64/fat/redc_2.c32
-rw-r--r--gmp/mpn/x86_64/fat/sqr_basecase.c32
-rw-r--r--gmp/mpn/x86_64/gcd_1.asm163
-rw-r--r--gmp/mpn/x86_64/gmp-mparam.h275
-rw-r--r--gmp/mpn/x86_64/invert_limb.asm178
-rw-r--r--gmp/mpn/x86_64/invert_limb_table.asm50
-rw-r--r--gmp/mpn/x86_64/k10/gcd_1.asm37
-rw-r--r--gmp/mpn/x86_64/k10/gmp-mparam.h222
-rw-r--r--gmp/mpn/x86_64/k10/hamdist.asm103
-rw-r--r--gmp/mpn/x86_64/k10/lshift.asm37
-rw-r--r--gmp/mpn/x86_64/k10/lshiftc.asm37
-rw-r--r--gmp/mpn/x86_64/k10/popcount.asm138
-rw-r--r--gmp/mpn/x86_64/k10/rshift.asm37
-rw-r--r--gmp/mpn/x86_64/k10/sec_tabselect.asm37
-rw-r--r--gmp/mpn/x86_64/k8/aorrlsh_n.asm217
-rw-r--r--gmp/mpn/x86_64/k8/div_qr_1n_pi1.asm249
-rw-r--r--gmp/mpn/x86_64/k8/gmp-mparam.h236
-rw-r--r--gmp/mpn/x86_64/k8/mullo_basecase.asm436
-rw-r--r--gmp/mpn/x86_64/k8/mulmid_basecase.asm559
-rw-r--r--gmp/mpn/x86_64/k8/redc_1.asm590
-rw-r--r--gmp/mpn/x86_64/logops_n.asm77
-rw-r--r--gmp/mpn/x86_64/lshift.asm153
-rw-r--r--gmp/mpn/x86_64/lshiftc.asm182
-rw-r--r--gmp/mpn/x86_64/lshsub_n.asm106
-rw-r--r--gmp/mpn/x86_64/missing-call.m453
-rw-r--r--gmp/mpn/x86_64/missing-inline.m4100
-rw-r--r--gmp/mpn/x86_64/missing.asm130
-rw-r--r--gmp/mpn/x86_64/mod_1_1.asm235
-rw-r--r--gmp/mpn/x86_64/mod_1_2.asm238
-rw-r--r--gmp/mpn/x86_64/mod_1_4.asm269
-rw-r--r--gmp/mpn/x86_64/mod_34lsub1.asm230
-rw-r--r--gmp/mpn/x86_64/mode1o.asm193
-rw-r--r--gmp/mpn/x86_64/mul_1.asm105
-rw-r--r--gmp/mpn/x86_64/mul_2.asm49
-rw-r--r--gmp/mpn/x86_64/mul_basecase.asm (renamed from gmp/mpn/x86_64/k8/mul_basecase.asm)68
-rw-r--r--gmp/mpn/x86_64/mulx/adx/addmul_1.asm149
-rw-r--r--gmp/mpn/x86_64/mulx/aorsmul_1.asm161
-rw-r--r--gmp/mpn/x86_64/mulx/mul_1.asm154
-rw-r--r--gmp/mpn/x86_64/nano/copyd.asm37
-rw-r--r--gmp/mpn/x86_64/nano/copyi.asm37
-rw-r--r--gmp/mpn/x86_64/nano/dive_1.asm166
-rw-r--r--gmp/mpn/x86_64/nano/gcd_1.asm37
-rw-r--r--gmp/mpn/x86_64/nano/gmp-mparam.h243
-rw-r--r--gmp/mpn/x86_64/nano/popcount.asm35
-rw-r--r--gmp/mpn/x86_64/pentium4/aors_n.asm64
-rw-r--r--gmp/mpn/x86_64/pentium4/aorslsh1_n.asm212
-rw-r--r--gmp/mpn/x86_64/pentium4/aorslsh2_n.asm50
-rw-r--r--gmp/mpn/x86_64/pentium4/aorslshC_n.asm203
-rw-r--r--gmp/mpn/x86_64/pentium4/gmp-mparam.h282
-rw-r--r--gmp/mpn/x86_64/pentium4/lshift.asm78
-rw-r--r--gmp/mpn/x86_64/pentium4/lshiftc.asm179
-rw-r--r--gmp/mpn/x86_64/pentium4/mod_34lsub1.asm167
-rw-r--r--gmp/mpn/x86_64/pentium4/popcount.asm32
-rw-r--r--gmp/mpn/x86_64/pentium4/rsh1aors_n.asm334
-rw-r--r--gmp/mpn/x86_64/pentium4/rshift.asm78
-rw-r--r--gmp/mpn/x86_64/pentium4/sec_tabselect.asm37
-rw-r--r--gmp/mpn/x86_64/popham.asm208
-rw-r--r--gmp/mpn/x86_64/redc_1.asm335
-rw-r--r--gmp/mpn/x86_64/rsh1add_n.asm146
-rw-r--r--gmp/mpn/x86_64/rsh1aors_n.asm189
-rw-r--r--gmp/mpn/x86_64/rsh1sub_n.asm146
-rw-r--r--gmp/mpn/x86_64/rshift.asm128
-rw-r--r--gmp/mpn/x86_64/sec_tabselect.asm176
-rw-r--r--gmp/mpn/x86_64/sqr_basecase.asm (renamed from gmp/mpn/x86_64/k8/sqr_basecase.asm)442
-rw-r--r--gmp/mpn/x86_64/sqr_diag_addlsh1.asm116
-rw-r--r--gmp/mpn/x86_64/sublsh1_n.asm54
-rw-r--r--gmp/mpn/x86_64/x86_64-defs.m4245
-rw-r--r--gmp/mpn/z8000/README45
-rw-r--r--gmp/mpn/z8000/add_n.s51
-rw-r--r--gmp/mpn/z8000/gmp-mparam.h21
-rw-r--r--gmp/mpn/z8000/mul_1.s66
-rw-r--r--gmp/mpn/z8000/sub_n.s52
-rw-r--r--gmp/mpn/z8000x/add_n.s54
-rw-r--r--gmp/mpn/z8000x/sub_n.s54
-rw-r--r--gmp/mpq/Makefile.am39
-rw-r--r--gmp/mpq/Makefile.in381
-rw-r--r--gmp/mpq/abs.c46
-rw-r--r--gmp/mpq/aors.c75
-rw-r--r--gmp/mpq/canonicalize.c48
-rw-r--r--gmp/mpq/clear.c37
-rw-r--r--gmp/mpq/clears.c52
-rw-r--r--gmp/mpq/cmp.c61
-rw-r--r--gmp/mpq/cmp_si.c41
-rw-r--r--gmp/mpq/cmp_ui.c44
-rw-r--r--gmp/mpq/div.c67
-rw-r--r--gmp/mpq/equal.c43
-rw-r--r--gmp/mpq/get_d.c42
-rw-r--r--gmp/mpq/get_den.c40
-rw-r--r--gmp/mpq/get_num.c39
-rw-r--r--gmp/mpq/get_str.c47
-rw-r--r--gmp/mpq/init.c45
-rw-r--r--gmp/mpq/inits.c49
-rw-r--r--gmp/mpq/inp_str.c39
-rw-r--r--gmp/mpq/inv.c70
-rw-r--r--gmp/mpq/md_2exp.c54
-rw-r--r--gmp/mpq/mul.c58
-rw-r--r--gmp/mpq/neg.c48
-rw-r--r--gmp/mpq/out_str.c25
-rw-r--r--gmp/mpq/set.c50
-rw-r--r--gmp/mpq/set_d.c52
-rw-r--r--gmp/mpq/set_den.c39
-rw-r--r--gmp/mpq/set_f.c54
-rw-r--r--gmp/mpq/set_num.c39
-rw-r--r--gmp/mpq/set_si.c41
-rw-r--r--gmp/mpq/set_str.c29
-rw-r--r--gmp/mpq/set_ui.c39
-rw-r--r--gmp/mpq/set_z.c41
-rw-r--r--gmp/mpq/swap.c75
-rw-r--r--gmp/mpz/2fac_ui.c100
-rw-r--r--gmp/mpz/Makefile.am55
-rw-r--r--gmp/mpz/Makefile.in734
-rw-r--r--gmp/mpz/abs.c40
-rw-r--r--gmp/mpz/add.c25
-rw-r--r--gmp/mpz/add_ui.c25
-rw-r--r--gmp/mpz/and.c140
-rw-r--r--gmp/mpz/aors.h62
-rw-r--r--gmp/mpz/aors_ui.h52
-rw-r--r--gmp/mpz/aorsmul.c66
-rw-r--r--gmp/mpz/aorsmul_i.c145
-rw-r--r--gmp/mpz/array_init.c42
-rw-r--r--gmp/mpz/bin_ui.c52
-rw-r--r--gmp/mpz/bin_uiui.c753
-rw-r--r--gmp/mpz/cdiv_q.c33
-rw-r--r--gmp/mpz/cdiv_q_ui.c33
-rw-r--r--gmp/mpz/cdiv_qr.c33
-rw-r--r--gmp/mpz/cdiv_qr_ui.c35
-rw-r--r--gmp/mpz/cdiv_r.c31
-rw-r--r--gmp/mpz/cdiv_r_ui.c32
-rw-r--r--gmp/mpz/cdiv_ui.c29
-rw-r--r--gmp/mpz/cfdiv_q_2exp.c39
-rw-r--r--gmp/mpz/cfdiv_r_2exp.c97
-rw-r--r--gmp/mpz/clear.c30
-rw-r--r--gmp/mpz/clears.c49
-rw-r--r--gmp/mpz/clrbit.c141
-rw-r--r--gmp/mpz/cmp.c37
-rw-r--r--gmp/mpz/cmp_d.c31
-rw-r--r--gmp/mpz/cmp_si.c72
-rw-r--r--gmp/mpz/cmp_ui.c30
-rw-r--r--gmp/mpz/cmpabs.c31
-rw-r--r--gmp/mpz/cmpabs_d.c29
-rw-r--r--gmp/mpz/cmpabs_ui.c30
-rw-r--r--gmp/mpz/com.c72
-rw-r--r--gmp/mpz/combit.c125
-rw-r--r--gmp/mpz/cong.c117
-rw-r--r--gmp/mpz/cong_2exp.c137
-rw-r--r--gmp/mpz/cong_ui.c45
-rw-r--r--gmp/mpz/dive_ui.c32
-rw-r--r--gmp/mpz/divegcd.c139
-rw-r--r--gmp/mpz/divexact.c127
-rw-r--r--gmp/mpz/divis.c25
-rw-r--r--gmp/mpz/divis_2exp.c30
-rw-r--r--gmp/mpz/divis_ui.c33
-rw-r--r--gmp/mpz/dump.c27
-rw-r--r--gmp/mpz/export.c128
-rw-r--r--gmp/mpz/fac_ui.c434
-rw-r--r--gmp/mpz/fdiv_q.c33
-rw-r--r--gmp/mpz/fdiv_q_ui.c32
-rw-r--r--gmp/mpz/fdiv_qr.c33
-rw-r--r--gmp/mpz/fdiv_qr_ui.c32
-rw-r--r--gmp/mpz/fdiv_r.c31
-rw-r--r--gmp/mpz/fdiv_r_ui.c32
-rw-r--r--gmp/mpz/fdiv_ui.c29
-rw-r--r--gmp/mpz/fib2_ui.c33
-rw-r--r--gmp/mpz/fib_ui.c60
-rw-r--r--gmp/mpz/fits_s.h33
-rw-r--r--gmp/mpz/fits_sint.c27
-rw-r--r--gmp/mpz/fits_slong.c25
-rw-r--r--gmp/mpz/fits_sshort.c25
-rw-r--r--gmp/mpz/fits_uint.c25
-rw-r--r--gmp/mpz/fits_ulong.c25
-rw-r--r--gmp/mpz/fits_ushort.c25
-rw-r--r--gmp/mpz/gcd.c94
-rw-r--r--gmp/mpz/gcd_ui.c30
-rw-r--r--gmp/mpz/gcdext.c158
-rw-r--r--gmp/mpz/get_d.c27
-rw-r--r--gmp/mpz/get_d_2exp.c31
-rw-r--r--gmp/mpz/get_si.c38
-rw-r--r--gmp/mpz/get_str.c60
-rw-r--r--gmp/mpz/get_ui.c27
-rw-r--r--gmp/mpz/getlimbn.c27
-rw-r--r--gmp/mpz/hamdist.c185
-rw-r--r--gmp/mpz/import.c112
-rw-r--r--gmp/mpz/init.c36
-rw-r--r--gmp/mpz/init2.c27
-rw-r--r--gmp/mpz/inits.c49
-rw-r--r--gmp/mpz/inp_raw.c148
-rw-r--r--gmp/mpz/inp_str.c40
-rw-r--r--gmp/mpz/invert.c43
-rw-r--r--gmp/mpz/ior.c82
-rw-r--r--gmp/mpz/iset.c39
-rw-r--r--gmp/mpz/iset_d.c33
-rw-r--r--gmp/mpz/iset_si.c40
-rw-r--r--gmp/mpz/iset_str.c46
-rw-r--r--gmp/mpz/iset_ui.c49
-rw-r--r--gmp/mpz/jacobi.c343
-rw-r--r--gmp/mpz/kronsz.c101
-rw-r--r--gmp/mpz/kronuz.c105
-rw-r--r--gmp/mpz/kronzs.c33
-rw-r--r--gmp/mpz/kronzu.c33
-rw-r--r--gmp/mpz/lcm.c50
-rw-r--r--gmp/mpz/lcm_ui.c25
-rw-r--r--gmp/mpz/limbs_finish.c40
-rw-r--r--gmp/mpz/limbs_modify.c39
-rw-r--r--gmp/mpz/limbs_read.c38
-rw-r--r--gmp/mpz/limbs_write.c39
-rw-r--r--gmp/mpz/lucnum2_ui.c33
-rw-r--r--gmp/mpz/lucnum_ui.c177
-rw-r--r--gmp/mpz/mfac_uiui.c140
-rw-r--r--gmp/mpz/millerrabin.c38
-rw-r--r--gmp/mpz/mod.c57
-rw-r--r--gmp/mpz/mul.c104
-rw-r--r--gmp/mpz/mul_2exp.c88
-rw-r--r--gmp/mpz/mul_i.h47
-rw-r--r--gmp/mpz/mul_si.c25
-rw-r--r--gmp/mpz/mul_ui.c25
-rw-r--r--gmp/mpz/n_pow_ui.c368
-rw-r--r--gmp/mpz/neg.c40
-rw-r--r--gmp/mpz/nextprime.c37
-rw-r--r--gmp/mpz/oddfac_1.c427
-rw-r--r--gmp/mpz/out_raw.c155
-rw-r--r--gmp/mpz/out_str.c69
-rw-r--r--gmp/mpz/perfpow.c282
-rw-r--r--gmp/mpz/perfsqr.c25
-rw-r--r--gmp/mpz/popcount.c25
-rw-r--r--gmp/mpz/pow_ui.c25
-rw-r--r--gmp/mpz/powm.c524
-rw-r--r--gmp/mpz/powm_sec.c104
-rw-r--r--gmp/mpz/powm_ui.c361
-rw-r--r--gmp/mpz/pprime_p.c42
-rw-r--r--gmp/mpz/primorial_ui.c164
-rw-r--r--gmp/mpz/prodlimbs.c109
-rw-r--r--gmp/mpz/random.c25
-rw-r--r--gmp/mpz/random2.c35
-rw-r--r--gmp/mpz/realloc.c28
-rw-r--r--gmp/mpz/realloc2.c27
-rw-r--r--gmp/mpz/remove.c173
-rw-r--r--gmp/mpz/roinit_n.c44
-rw-r--r--gmp/mpz/root.c31
-rw-r--r--gmp/mpz/rootrem.c39
-rw-r--r--gmp/mpz/rrandomb.c44
-rw-r--r--gmp/mpz/scan0.c109
-rw-r--r--gmp/mpz/scan1.c139
-rw-r--r--gmp/mpz/set.c51
-rw-r--r--gmp/mpz/set_d.c32
-rw-r--r--gmp/mpz/set_f.c32
-rw-r--r--gmp/mpz/set_q.c25
-rw-r--r--gmp/mpz/set_si.c36
-rw-r--r--gmp/mpz/set_str.c42
-rw-r--r--gmp/mpz/set_ui.c33
-rw-r--r--gmp/mpz/setbit.c132
-rw-r--r--gmp/mpz/size.c27
-rw-r--r--gmp/mpz/sizeinbase.c29
-rw-r--r--gmp/mpz/sqrt.c87
-rw-r--r--gmp/mpz/sqrtrem.c110
-rw-r--r--gmp/mpz/sub.c25
-rw-r--r--gmp/mpz/sub_ui.c25
-rw-r--r--gmp/mpz/swap.c53
-rw-r--r--gmp/mpz/tdiv_q.c56
-rw-r--r--gmp/mpz/tdiv_q_2exp.c63
-rw-r--r--gmp/mpz/tdiv_q_ui.c32
-rw-r--r--gmp/mpz/tdiv_qr.c49
-rw-r--r--gmp/mpz/tdiv_qr_ui.c35
-rw-r--r--gmp/mpz/tdiv_r.c41
-rw-r--r--gmp/mpz/tdiv_r_2exp.c50
-rw-r--r--gmp/mpz/tdiv_r_ui.c34
-rw-r--r--gmp/mpz/tdiv_ui.c29
-rw-r--r--gmp/mpz/tstbit.c45
-rw-r--r--gmp/mpz/ui_pow_ui.c25
-rw-r--r--gmp/mpz/ui_sub.c25
-rw-r--r--gmp/mpz/urandomb.c29
-rw-r--r--gmp/mpz/urandomm.c29
-rw-r--r--gmp/mpz/xor.c95
-rw-r--r--gmp/nextprime.c167
-rw-r--r--gmp/primesieve.c295
-rw-r--r--gmp/printf/Makefile.am33
-rw-r--r--gmp/printf/Makefile.in354
-rw-r--r--gmp/printf/asprintf.c44
-rw-r--r--gmp/printf/asprntffuns.c32
-rw-r--r--gmp/printf/doprnt.c38
-rw-r--r--gmp/printf/doprntf.c45
-rw-r--r--gmp/printf/doprnti.c32
-rw-r--r--gmp/printf/fprintf.c45
-rw-r--r--gmp/printf/obprintf.c43
-rw-r--r--gmp/printf/obprntffuns.c30
-rw-r--r--gmp/printf/obvprintf.c30
-rw-r--r--gmp/printf/printf.c43
-rw-r--r--gmp/printf/printffuns.c34
-rw-r--r--gmp/printf/repl-vsnprintf.c31
-rw-r--r--gmp/printf/snprintf.c46
-rw-r--r--gmp/printf/snprntffuns.c34
-rw-r--r--gmp/printf/sprintf.c45
-rw-r--r--gmp/printf/sprintffuns.c32
-rw-r--r--gmp/printf/vasprintf.c32
-rw-r--r--gmp/printf/vfprintf.c32
-rw-r--r--gmp/printf/vprintf.c32
-rw-r--r--gmp/printf/vsnprintf.c32
-rw-r--r--gmp/printf/vsprintf.c32
-rw-r--r--gmp/rand.c64
-rw-r--r--gmp/rand/Makefile.am38
-rw-r--r--gmp/rand/Makefile.in556
-rw-r--r--gmp/rand/rand.c52
-rw-r--r--gmp/rand/randclr.c38
-rw-r--r--gmp/rand/randdef.c38
-rw-r--r--gmp/rand/randiset.c39
-rw-r--r--gmp/rand/randmt.h51
-rw-r--r--gmp/rand/randsd.c39
-rw-r--r--gmp/randbui.c (renamed from gmp/rand/randbui.c)25
-rw-r--r--gmp/randclr.c27
-rw-r--r--gmp/randdef.c27
-rw-r--r--gmp/randiset.c28
-rw-r--r--gmp/randlc2s.c (renamed from gmp/rand/randlc2s.c)29
-rw-r--r--gmp/randlc2x.c (renamed from gmp/rand/randlc2x.c)43
-rw-r--r--gmp/randmt.c (renamed from gmp/rand/randmt.c)33
-rw-r--r--gmp/randmt.h40
-rw-r--r--gmp/randmts.c (renamed from gmp/rand/randmts.c)50
-rw-r--r--gmp/randmui.c (renamed from gmp/rand/randmui.c)25
-rw-r--r--gmp/rands.c (renamed from gmp/rand/rands.c)25
-rw-r--r--gmp/randsd.c28
-rw-r--r--gmp/randsdui.c (renamed from gmp/rand/randsdui.c)25
-rw-r--r--gmp/scanf/Makefile.am33
-rw-r--r--gmp/scanf/Makefile.in316
-rw-r--r--gmp/scanf/doscan.c36
-rw-r--r--gmp/scanf/fscanf.c45
-rw-r--r--gmp/scanf/fscanffuns.c31
-rw-r--r--gmp/scanf/scanf.c43
-rw-r--r--gmp/scanf/sscanf.c45
-rw-r--r--gmp/scanf/sscanffuns.c27
-rw-r--r--gmp/scanf/vfscanf.c32
-rw-r--r--gmp/scanf/vscanf.c31
-rw-r--r--gmp/scanf/vsscanf.c31
-rw-r--r--gmp/tal-debug.c25
-rw-r--r--gmp/tal-notreent.c27
-rw-r--r--gmp/tal-reent.c27
-rw-r--r--gmp/tests/Makefile.am29
-rw-r--r--gmp/tests/Makefile.in623
-rw-r--r--gmp/tests/amd64call.asm170
-rw-r--r--gmp/tests/amd64check.c44
-rw-r--r--gmp/tests/arm32call.asm83
-rw-r--r--gmp/tests/arm32check.c96
-rw-r--r--gmp/tests/cxx/Makefile.am43
-rw-r--r--gmp/tests/cxx/Makefile.in515
-rw-r--r--gmp/tests/cxx/clocale.c22
-rw-r--r--gmp/tests/cxx/t-assign.cc116
-rw-r--r--gmp/tests/cxx/t-binary.cc43
-rw-r--r--gmp/tests/cxx/t-cast.cc22
-rw-r--r--gmp/tests/cxx/t-constr.cc25
-rw-r--r--gmp/tests/cxx/t-cxx11.cc220
-rw-r--r--gmp/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc38
-rw-r--r--gmp/tests/cxx/t-headers.cc22
-rw-r--r--gmp/tests/cxx/t-iostream.cc107
-rw-r--r--gmp/tests/cxx/t-istream.cc119
-rw-r--r--gmp/tests/cxx/t-locale.cc28
-rw-r--r--gmp/tests/cxx/t-misc.cc63
-rw-r--r--gmp/tests/cxx/t-mix.cc83
-rw-r--r--gmp/tests/cxx/t-ops.cc27
-rw-r--r--gmp/tests/cxx/t-ops2.cc256
-rw-r--r--gmp/tests/cxx/t-ops3.cc133
-rw-r--r--gmp/tests/cxx/t-ostream.cc26
-rw-r--r--gmp/tests/cxx/t-prec.cc24
-rw-r--r--gmp/tests/cxx/t-rand.cc35
-rw-r--r--gmp/tests/cxx/t-ternary.cc24
-rw-r--r--gmp/tests/cxx/t-unary.cc24
-rw-r--r--gmp/tests/devel/Makefile.am26
-rw-r--r--gmp/tests/devel/Makefile.in349
-rw-r--r--gmp/tests/devel/README22
-rw-r--r--gmp/tests/devel/anymul_1.c43
-rw-r--r--gmp/tests/devel/aors_n.c73
-rw-r--r--gmp/tests/devel/copy.c68
-rw-r--r--gmp/tests/devel/divmod_1.c28
-rw-r--r--gmp/tests/devel/divrem.c27
-rw-r--r--gmp/tests/devel/logops_n.c27
-rw-r--r--gmp/tests/devel/shift.c73
-rw-r--r--gmp/tests/devel/try.c1059
-rw-r--r--gmp/tests/devel/tst-addsub.c30
-rw-r--r--gmp/tests/memory.c83
-rw-r--r--gmp/tests/misc.c42
-rw-r--r--gmp/tests/misc/Makefile.am22
-rw-r--r--gmp/tests/misc/Makefile.in370
-rw-r--r--gmp/tests/misc/t-locale.c46
-rw-r--r--gmp/tests/misc/t-printf.c61
-rw-r--r--gmp/tests/misc/t-scanf.c47
-rw-r--r--gmp/tests/mpbsd/Makefile.am35
-rw-r--r--gmp/tests/mpbsd/Makefile.in581
-rw-r--r--gmp/tests/mpbsd/allfuns.c56
-rw-r--r--gmp/tests/mpbsd/t-itom.c74
-rw-r--r--gmp/tests/mpbsd/t-mtox.c86
-rw-r--r--gmp/tests/mpf/Makefile.am27
-rw-r--r--gmp/tests/mpf/Makefile.in583
-rw-r--r--gmp/tests/mpf/reuse.c66
-rw-r--r--gmp/tests/mpf/t-add.c22
-rw-r--r--gmp/tests/mpf/t-cmp_d.c22
-rw-r--r--gmp/tests/mpf/t-cmp_si.c22
-rw-r--r--gmp/tests/mpf/t-conv.c24
-rw-r--r--gmp/tests/mpf/t-div.c22
-rw-r--r--gmp/tests/mpf/t-dm2exp.c22
-rw-r--r--gmp/tests/mpf/t-eq.c218
-rw-r--r--gmp/tests/mpf/t-fits.c39
-rw-r--r--gmp/tests/mpf/t-get_d.c26
-rw-r--r--gmp/tests/mpf/t-get_d_2exp.c22
-rw-r--r--gmp/tests/mpf/t-get_si.c22
-rw-r--r--gmp/tests/mpf/t-get_ui.c22
-rw-r--r--gmp/tests/mpf/t-gsprec.c22
-rw-r--r--gmp/tests/mpf/t-inp_str.c23
-rw-r--r--gmp/tests/mpf/t-int_p.c22
-rw-r--r--gmp/tests/mpf/t-mul_ui.c24
-rw-r--r--gmp/tests/mpf/t-muldiv.c24
-rw-r--r--gmp/tests/mpf/t-set.c89
-rw-r--r--gmp/tests/mpf/t-set_q.c22
-rw-r--r--gmp/tests/mpf/t-set_si.c22
-rw-r--r--gmp/tests/mpf/t-set_ui.c24
-rw-r--r--gmp/tests/mpf/t-sqrt.c22
-rw-r--r--gmp/tests/mpf/t-sqrt_ui.c22
-rw-r--r--gmp/tests/mpf/t-sub.c24
-rw-r--r--gmp/tests/mpf/t-trunc.c22
-rw-r--r--gmp/tests/mpf/t-ui_div.c22
-rw-r--r--gmp/tests/mpn/Makefile.am36
-rw-r--r--gmp/tests/mpn/Makefile.in759
-rw-r--r--gmp/tests/mpn/logic.c134
-rw-r--r--gmp/tests/mpn/t-aors_1.c71
-rw-r--r--gmp/tests/mpn/t-asmtype.c22
-rw-r--r--gmp/tests/mpn/t-bdiv.c368
-rw-r--r--gmp/tests/mpn/t-broot.c105
-rw-r--r--gmp/tests/mpn/t-brootinv.c106
-rw-r--r--gmp/tests/mpn/t-div.c505
-rw-r--r--gmp/tests/mpn/t-divrem_1.c27
-rw-r--r--gmp/tests/mpn/t-fat.c40
-rw-r--r--gmp/tests/mpn/t-get_d.c36
-rw-r--r--gmp/tests/mpn/t-hgcd.c55
-rw-r--r--gmp/tests/mpn/t-hgcd_appr.c564
-rw-r--r--gmp/tests/mpn/t-instrument.c36
-rw-r--r--gmp/tests/mpn/t-invert.c161
-rw-r--r--gmp/tests/mpn/t-iord_u.c22
-rw-r--r--gmp/tests/mpn/t-matrix22.c25
-rw-r--r--gmp/tests/mpn/t-minvert.c179
-rw-r--r--gmp/tests/mpn/t-mod_1.c129
-rw-r--r--gmp/tests/mpn/t-mp_bases.c22
-rw-r--r--gmp/tests/mpn/t-mul.c101
-rw-r--r--gmp/tests/mpn/t-mullo.c142
-rw-r--r--gmp/tests/mpn/t-mulmid.c93
-rw-r--r--gmp/tests/mpn/t-mulmod_bnm1.c218
-rw-r--r--gmp/tests/mpn/t-perfsqr.c22
-rw-r--r--gmp/tests/mpn/t-scan.c22
-rw-r--r--gmp/tests/mpn/t-sizeinbase.c108
-rw-r--r--gmp/tests/mpn/t-sqrmod_bnm1.c191
-rw-r--r--gmp/tests/mpn/t-toom2-sqr.c6
-rw-r--r--gmp/tests/mpn/t-toom22.c10
-rw-r--r--gmp/tests/mpn/t-toom3-sqr.c6
-rw-r--r--gmp/tests/mpn/t-toom32.c8
-rw-r--r--gmp/tests/mpn/t-toom33.c11
-rw-r--r--gmp/tests/mpn/t-toom4-sqr.c6
-rw-r--r--gmp/tests/mpn/t-toom42.c8
-rw-r--r--gmp/tests/mpn/t-toom43.c8
-rw-r--r--gmp/tests/mpn/t-toom44.c11
-rw-r--r--gmp/tests/mpn/t-toom52.c8
-rw-r--r--gmp/tests/mpn/t-toom53.c8
-rw-r--r--gmp/tests/mpn/t-toom54.c8
-rw-r--r--gmp/tests/mpn/t-toom6-sqr.c8
-rw-r--r--gmp/tests/mpn/t-toom62.c8
-rw-r--r--gmp/tests/mpn/t-toom63.c8
-rw-r--r--gmp/tests/mpn/t-toom6h.c13
-rw-r--r--gmp/tests/mpn/t-toom8-sqr.c8
-rw-r--r--gmp/tests/mpn/t-toom8h.c18
-rw-r--r--gmp/tests/mpn/toom-shared.h158
-rw-r--r--gmp/tests/mpn/toom-sqr-shared.h129
-rw-r--r--gmp/tests/mpq/Makefile.am26
-rw-r--r--gmp/tests/mpq/Makefile.in480
-rw-r--r--gmp/tests/mpq/io.c137
-rw-r--r--gmp/tests/mpq/reuse.c230
-rw-r--r--gmp/tests/mpq/t-aors.c22
-rw-r--r--gmp/tests/mpq/t-cmp.c27
-rw-r--r--gmp/tests/mpq/t-cmp_si.c22
-rw-r--r--gmp/tests/mpq/t-cmp_ui.c39
-rw-r--r--gmp/tests/mpq/t-equal.c25
-rw-r--r--gmp/tests/mpq/t-get_d.c77
-rw-r--r--gmp/tests/mpq/t-get_str.c26
-rw-r--r--gmp/tests/mpq/t-inp_str.c22
-rw-r--r--gmp/tests/mpq/t-inv.c61
-rw-r--r--gmp/tests/mpq/t-md_2exp.c89
-rw-r--r--gmp/tests/mpq/t-set_f.c22
-rw-r--r--gmp/tests/mpq/t-set_str.c22
-rw-r--r--gmp/tests/mpz/Makefile.am33
-rw-r--r--gmp/tests/mpz/Makefile.in937
-rw-r--r--gmp/tests/mpz/bit.c71
-rw-r--r--gmp/tests/mpz/convert.c45
-rw-r--r--gmp/tests/mpz/dive.c31
-rw-r--r--gmp/tests/mpz/dive_ui.c22
-rw-r--r--gmp/tests/mpz/io.c35
-rw-r--r--gmp/tests/mpz/logic.c67
-rw-r--r--gmp/tests/mpz/reuse.c417
-rw-r--r--gmp/tests/mpz/t-addsub.c28
-rw-r--r--gmp/tests/mpz/t-aorsmul.c32
-rw-r--r--gmp/tests/mpz/t-bin.c186
-rw-r--r--gmp/tests/mpz/t-cdiv_ui.c30
-rw-r--r--gmp/tests/mpz/t-cmp.c22
-rw-r--r--gmp/tests/mpz/t-cmp_d.c33
-rw-r--r--gmp/tests/mpz/t-cmp_si.c22
-rw-r--r--gmp/tests/mpz/t-cong.c130
-rw-r--r--gmp/tests/mpz/t-cong_2exp.c102
-rw-r--r--gmp/tests/mpz/t-div_2exp.c22
-rw-r--r--gmp/tests/mpz/t-divis.c35
-rw-r--r--gmp/tests/mpz/t-divis_2exp.c22
-rw-r--r--gmp/tests/mpz/t-export.c22
-rw-r--r--gmp/tests/mpz/t-fac_ui.c65
-rw-r--r--gmp/tests/mpz/t-fdiv.c26
-rw-r--r--gmp/tests/mpz/t-fdiv_ui.c30
-rw-r--r--gmp/tests/mpz/t-fib_ui.c26
-rw-r--r--gmp/tests/mpz/t-fits.c24
-rw-r--r--gmp/tests/mpz/t-gcd.c296
-rw-r--r--gmp/tests/mpz/t-gcd_ui.c22
-rw-r--r--gmp/tests/mpz/t-get_d.c28
-rw-r--r--gmp/tests/mpz/t-get_d_2exp.c51
-rw-r--r--gmp/tests/mpz/t-get_si.c22
-rw-r--r--gmp/tests/mpz/t-hamdist.c22
-rw-r--r--gmp/tests/mpz/t-import.c22
-rw-r--r--gmp/tests/mpz/t-inp_str.c41
-rw-r--r--gmp/tests/mpz/t-invert.c121
-rw-r--r--gmp/tests/mpz/t-io_raw.c24
-rw-r--r--gmp/tests/mpz/t-jac.c295
-rw-r--r--gmp/tests/mpz/t-lcm.c29
-rw-r--r--gmp/tests/mpz/t-limbs.c233
-rw-r--r--gmp/tests/mpz/t-lucnum_ui.c24
-rw-r--r--gmp/tests/mpz/t-mfac_uiui.c136
-rw-r--r--gmp/tests/mpz/t-mul.c161
-rw-r--r--gmp/tests/mpz/t-mul_i.c22
-rw-r--r--gmp/tests/mpz/t-nextprime.c24
-rw-r--r--gmp/tests/mpz/t-oddeven.c22
-rw-r--r--gmp/tests/mpz/t-perfpow.c159
-rw-r--r--gmp/tests/mpz/t-perfsqr.c24
-rw-r--r--gmp/tests/mpz/t-popcount.c27
-rw-r--r--gmp/tests/mpz/t-pow.c24
-rw-r--r--gmp/tests/mpz/t-powm.c81
-rw-r--r--gmp/tests/mpz/t-powm_ui.c95
-rw-r--r--gmp/tests/mpz/t-pprime_p.c101
-rw-r--r--gmp/tests/mpz/t-primorial_ui.c97
-rw-r--r--gmp/tests/mpz/t-remove.c147
-rw-r--r--gmp/tests/mpz/t-root.c44
-rw-r--r--gmp/tests/mpz/t-scan.c26
-rw-r--r--gmp/tests/mpz/t-set_d.c24
-rw-r--r--gmp/tests/mpz/t-set_f.c28
-rw-r--r--gmp/tests/mpz/t-set_si.c24
-rw-r--r--gmp/tests/mpz/t-set_str.c68
-rw-r--r--gmp/tests/mpz/t-sizeinbase.c22
-rw-r--r--gmp/tests/mpz/t-sqrtrem.c38
-rw-r--r--gmp/tests/mpz/t-tdiv.c33
-rw-r--r--gmp/tests/mpz/t-tdiv_ui.c30
-rw-r--r--gmp/tests/rand/Makefile.am24
-rw-r--r--gmp/tests/rand/Makefile.in460
-rw-r--r--gmp/tests/rand/findlc.c24
-rw-r--r--gmp/tests/rand/gen.c24
-rw-r--r--gmp/tests/rand/gmpstat.h22
-rw-r--r--gmp/tests/rand/spect.c24
-rw-r--r--gmp/tests/rand/stat.c22
-rw-r--r--gmp/tests/rand/statlib.c24
-rw-r--r--gmp/tests/rand/t-iset.c22
-rw-r--r--gmp/tests/rand/t-lc2exp.c25
-rw-r--r--gmp/tests/rand/t-mt.c22
-rw-r--r--gmp/tests/rand/t-rand.c100
-rw-r--r--gmp/tests/rand/t-urbui.c24
-rw-r--r--gmp/tests/rand/t-urmui.c22
-rw-r--r--gmp/tests/rand/t-urndmm.c22
-rw-r--r--gmp/tests/rand/zdiv_round.c22
-rw-r--r--gmp/tests/refmpf.c42
-rw-r--r--gmp/tests/refmpn.c714
-rw-r--r--gmp/tests/refmpq.c22
-rw-r--r--gmp/tests/refmpz.c71
-rw-r--r--gmp/tests/spinner.c26
-rw-r--r--gmp/tests/t-bswap.c22
-rw-r--r--gmp/tests/t-constants.c65
-rw-r--r--gmp/tests/t-count_zeros.c28
-rw-r--r--gmp/tests/t-gmpmax.c32
-rw-r--r--gmp/tests/t-hightomask.c22
-rw-r--r--gmp/tests/t-modlinv.c24
-rw-r--r--gmp/tests/t-parity.c26
-rw-r--r--gmp/tests/t-popc.c38
-rw-r--r--gmp/tests/t-sub.c22
-rw-r--r--gmp/tests/tests.h682
-rw-r--r--gmp/tests/trace.c27
-rw-r--r--gmp/tests/x86call.asm162
-rw-r--r--gmp/tests/x86check.c76
-rw-r--r--gmp/tune/Makefile.am134
-rw-r--r--gmp/tune/Makefile.in640
-rw-r--r--gmp/tune/README68
-rw-r--r--gmp/tune/alpha.asm33
-rw-r--r--gmp/tune/common.c1218
-rw-r--r--gmp/tune/div_qr_1_tune.c47
-rw-r--r--gmp/tune/div_qr_1n_pi1_1.c39
-rw-r--r--gmp/tune/div_qr_1n_pi1_2.c39
-rw-r--r--gmp/tune/divrem1div.c25
-rw-r--r--gmp/tune/divrem1inv.c25
-rw-r--r--gmp/tune/divrem2div.c25
-rw-r--r--gmp/tune/divrem2inv.c25
-rw-r--r--gmp/tune/freq.c31
-rw-r--r--gmp/tune/gcdext_double.c25
-rw-r--r--gmp/tune/gcdext_single.c25
-rw-r--r--gmp/tune/gcdextod.c25
-rw-r--r--gmp/tune/gcdextos.c25
-rw-r--r--gmp/tune/hgcd_appr_lehmer.c40
-rw-r--r--gmp/tune/hgcd_lehmer.c40
-rw-r--r--gmp/tune/hgcd_reduce_1.c41
-rw-r--r--gmp/tune/hgcd_reduce_2.c40
-rw-r--r--gmp/tune/hppa.asm33
-rw-r--r--gmp/tune/hppa2.asm33
-rw-r--r--gmp/tune/hppa2w.asm33
-rw-r--r--gmp/tune/ia64.asm33
-rw-r--r--gmp/tune/jacbase1.c25
-rw-r--r--gmp/tune/jacbase2.c25
-rw-r--r--gmp/tune/jacbase3.c25
-rw-r--r--gmp/tune/jacbase4.c38
-rwxr-xr-x[-rw-r--r--]gmp/tune/many.pl48
-rw-r--r--gmp/tune/mod_1_1-1.c41
-rw-r--r--gmp/tune/mod_1_1-2.c41
-rw-r--r--gmp/tune/mod_1_div.c29
-rw-r--r--gmp/tune/mod_1_inv.c29
-rw-r--r--gmp/tune/modlinv.c35
-rw-r--r--gmp/tune/noop.c25
-rw-r--r--gmp/tune/pentium.asm33
-rw-r--r--gmp/tune/powerpc.asm35
-rw-r--r--gmp/tune/powerpc64.asm35
-rw-r--r--gmp/tune/powm_mod.c25
-rw-r--r--gmp/tune/powm_redc.c25
-rw-r--r--gmp/tune/pre_divrem_1.c25
-rw-r--r--gmp/tune/sb_div.c30
-rw-r--r--gmp/tune/sb_inv.c30
-rw-r--r--gmp/tune/set_strb.c25
-rw-r--r--gmp/tune/set_strp.c25
-rw-r--r--gmp/tune/set_strs.c25
-rw-r--r--gmp/tune/sparcv9.asm33
-rw-r--r--gmp/tune/speed-ext.c37
-rw-r--r--gmp/tune/speed.c249
-rw-r--r--gmp/tune/speed.h2050
-rw-r--r--gmp/tune/time.c98
-rw-r--r--gmp/tune/tune-gcd-p.c225
-rw-r--r--gmp/tune/tuneup.c1722
-rw-r--r--gmp/tune/x86_64.asm35
-rw-r--r--gmp/version.c27
-rwxr-xr-xgmp/ylwrap226
2038 files changed, 91722 insertions, 218505 deletions
diff --git a/.gitignore b/.gitignore
deleted file mode 100644
index ab97ac67cb..0000000000
--- a/.gitignore
+++ /dev/null
@@ -1,49 +0,0 @@
-*.diff
-*.patch
-*.orig
-*.rej
-
-*~
-.#*
-*#
-
-*.flt
-*.gmo
-*.info
-*.la
-*.lo
-*.o
-*.pyc
-*.tmp
-
-.deps
-.libs
-
-autom4te.cache
-config.cache
-config.h
-config.intl
-config.log
-config.status
-libtool
-POTFILES
-*-POTFILES
-
-TAGS
-TAGS.sub
-
-.local.vimrc
-.lvimrc
-
-.gdbinit
-.gdb_history
-
-# ignore core files, but not java/net/protocol/core/
-core
-!core/
-
-lost+found
-
-# ignore ./contrib/gcc_update output
-LAST_UPDATED
-REVISION
diff --git a/gmp/.gdbinit b/gmp/.gdbinit
new file mode 100644
index 0000000000..6328dc95d7
--- /dev/null
+++ b/gmp/.gdbinit
@@ -0,0 +1,32 @@
+# Copyright 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.
+#
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 pz
+set __gmpz_dump ($)
+end
+
+define pq
+set __gmpz_dump ($->_mp_num)
+echo /
+set __gmpz_dump ($->_mp_den)
+end
+
+define pf
+set __gmpf_dump ($)
+end
+
diff --git a/gmp/AUTHORS b/gmp/AUTHORS
index fbe298d61b..ea16d78a8b 100644
--- a/gmp/AUTHORS
+++ b/gmp/AUTHORS
@@ -1,100 +1,25 @@
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
-
-Paul Zimmermann mpn/generic/mul_fft.c, now defunct dc_divrem_n.c,
- rootrem.c, old mpz/powm.c, old toom3 code.
-
-Ken Weber Now defunct mpn/generic/bdivmod.c, old mpn/generic/gcd.c
-
-Bennet Yee Previous versions of mpz/jacobi.c mpz/legendre.c
-
-Andreas Schwab mpn/m68k/lshift.asm, mpn/m68k/rshift.asm
-
-Robert Harley Old mpn/generic/mul_n.c, previous versions of files in
- mpn/arm
-
+Paul Zimmermann mpn/generic/mul_fft.c, dc_divrem_n.c, rootrem.c,
+ old mpz/powm.c, old toom3 code.
+Ken Weber mpn/generic/bdivmod.c, old mpn/generic/gcd.c
+Bennet Yee mpz/jacobi.c mpz/legendre.c
+Andreas Schwab mpn/m68k/lshift.S, mpn/m68k/rshift.S
+Robert Harley Old mpn/generic/mul_n.c, files in mpn/arm
Linus Nordberg Random number framework, original autoconfery
-
-Kent Boortz MacOS 9 port, now defunct.
-
+Kent Boortz MacOS 9 port
Kevin Ryde Most x86 assembly, new autoconfery, and countless other
things (please see the GMP manual for complete list)
-
Gerardo Ballabio gmpxx.h and C++ istream input
-
Pedro Gimeno Mersenne Twister random generator, other random number
revisions
-
-Jason Moxham Previous versions of mpz/fac_ui.c and gen-fac_ui.c
-
-Niels Möller gen-jacobitab.c,
- mpn/generic/hgcd2.c, hgcd.c, hgcd_step.c,
- hgcd_appr.c, hgcd_matrix.c, hgcd_reduce.c,
- gcd.c, gcdext.c, matrix22_mul.c,
- gcdext_1.c, gcd_subdiv_step.c, gcd_lehmer.c,
+Jason Moxham New mpz/fac_ui.c and gen-fac_ui.c
+Niels Möller mpn/generic/hgcd2.c, gcd.c, gcdext.c, matrix22_mul.c,
+ hgcd.c, gcdext_1.c, gcd_subdiv_step.c, gcd_lehmer.c,
gcdext_subdiv_step.c, gcdext_lehmer.c,
- jacobi_2.c, jacbase.c, hgcd_jacobi.c, hgcd2_jacobi.c
- 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,
- div_qr_2n_pi1.c, div_qr_2u_pi1.c, broot.c,
- brootinv.c,
- mpn/x86/k7/invert_limb.asm, mod_1_1.asm,
- mpn/x86_64/invert_limb.asm,
- invert_limb_table.asm, mod_1_1.asm,
- div_qr_2n_pi1.asm, div_qr_2u_pi1.asm,
- mpn/x86_64/core2/aorsmul_1.asm,
- mpz/nextprime.c, divexact.c, gcd.c, gcdext.c,
- jacobi.c, combit.c, mini-gmp/mini-gmp.c.
-
+ toom_interpolate_7pts, mpz/nextprime.c.
Marco Bodrato mpn/generic/toom44_mul.c, toom4_sqr.c, toom53_mul.c,
- toom62_mul.c, toom43_mul.c, toom52_mul.c, toom54_mul.c,
- toom_interpolate_6pts.c, toom_couple_handling.c,
- toom63_mul.c, toom_interpolate_8pts.c,
- toom6h_mul.c, toom6_sqr.c, toom_interpolate_12pts.c,
- toom8h_mul.c, toom8_sqr.c, toom_interpolate_16pts.c,
- mulmod_bnm1.c, sqrmod_bnm1.c, nussbaumer_mul.c,
- toom_eval_pm2.c, toom_eval_pm2rexp.c,
- mullo_n.c, invert.c, invertappr.c;
- mpz/fac_ui.c, 2fac_ui.c, mfac_uiui.c, oddfac_1.c,
- primorial_ui.c, prodlimbs.c, goetgheluck_bin_uiui.c.
-
-David Harvey mpn/generic/add_err1_n.c, add_err2_n.c,
- add_err3_n.c, sub_err1_n.c, sub_err2_n.c,
- sub_err3_n.c, mulmid_basecase.c, mulmid_n.c,
- toom42_mulmid.c,
- mpn/x86_64/mul_basecase.asm, aors_err1_n.asm,
- aors_err2_n.asm, aors_err3_n.asm,
- mulmid_basecase.asm,
- mpn/x86_64/core2/aors_err1_n.asm.
-
-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.
+ toom62_mul.c
+David Harvey mpn/x86_64/mul_basecase.asm.
diff --git a/gmp/COPYING.LESSERv3 b/gmp/COPYING.LIB
index fc8a5de7ed..fc8a5de7ed 100644
--- a/gmp/COPYING.LESSERv3
+++ b/gmp/COPYING.LIB
diff --git a/gmp/COPYINGv2 b/gmp/COPYINGv2
deleted file mode 100644
index d159169d10..0000000000
--- a/gmp/COPYINGv2
+++ /dev/null
@@ -1,339 +0,0 @@
- 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/gmp/COPYINGv3 b/gmp/COPYINGv3
deleted file mode 100644
index 2a000655e9..0000000000
--- a/gmp/COPYINGv3
+++ /dev/null
@@ -1,674 +0,0 @@
- 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>.
diff --git a/gmp/ChangeLog b/gmp/ChangeLog
index 540c025c51..f1b91c8bca 100644
--- a/gmp/ChangeLog
+++ b/gmp/ChangeLog
@@ -1,8012 +1,24 @@
-2014-03-24 Torbjorn Granlund <tege@gmplib.org>
-
- * 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.
-
-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>
-
- * configure.ac (arm*-*-*): Set up path also for plainest CPU variants.
-
-2013-04-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/v6/popham.asm: New file.
-
- * mpn/arm/v7a/cora15/cnd-aors_n.asm: New file.
-
-2013-04-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/mod_34lsub1.asm: Clear carry smarter.
-
- * mpn/arm/v7a/cora15/logops_n.asm: Conditionally suppress conditionally
- used code.
-
- * mpn/arm/v7a/cora15/submul_1.asm: New file.
-
-2013-04-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/v7a/cora15/com.asm: New file.
-
- * mpn/arm/v7a/cora15/logops_n.asm: New file.
-
-2013-04-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/v7a/cora15/aors_n.asm: New file.
-
- * mpn/arm/v7a/cora15/addmul_1.asm: Rewrite.
-
-2013-04-18 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/alpha/tabselect.asm: New file.
-
-2013-04-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc32/tabselect.asm: New file.
-
- * longlong.h (arm64 count_trailing_zeros): New.
-
- * mpn/arm64/invert_limb.asm: New file.
-
- * mpn/generic/dive_1.c: Rewrite to use Hensel division also for
- size = 1.
-
- * mpn/generic/mod_1_1.c (add_mssaaaa): Provide VIS3 variant.
-
- * configure.ac: Remove "missing" from extra_functions_64 for coreibwl.
-
- * mpn/sparc64/ultrasparct3/mul_1.asm: Decrease loop alignment.
- * mpn/sparc64/ultrasparct3/aormul_2.asm: Likewise.
-
-2013-04-16 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.
-
-2013-04-15 David S. Miller <davem@davemloft.net>
-
- * 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/sparc64/gcd_1.asm: Use RODATA, TYPE, and SIZE.
-
-2013-04-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sparc64/ultrasparct3/invert_limb.asm: Avoid addend for GOT entry,
- it is not portable.
-
- * mpn/sparc64/tabselect.asm: New file.
-
- * 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.
-
-2013-03-18 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.ac (arm*-*-*): Define CALLING_CONVENTIONS_OBJS.
-
- * tests/arm32call.asm: New file.
- * tests/arm32check.c: New file.
-
- * 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>
-
- * 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-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.
-
- * mini-gmp/tests/testutils.c (testfree): New function. Use it
- everywhere where test programs deallocate storage allocated via
- the mini-gmp allocation functions, including uses of mpz_get_str
- for various test failure messages.
-
- * mpz/limbs_finish.c (mpz_limbs_finish): New file and function.
- * mpz/limbs_modify.c (mpz_limbs_modify): New file and function.
- * mpz/limbs_read.c (mpz_limbs_read): New file and function.
- * 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>
- and <cstring> (revert 2002-12-21).
-
- * tests/cxx/Makefile.am: Link with libm.
- * 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.
-
-2013-02-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * 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>
-
- * tests/mpz/t-jac.c (check_large_quotients): Rewrote. Now uses a
- more efficient method for generating the test inputs.
-
-2013-02-05 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/t-div.c: Limit random dbits to avoid an infinite loop.
-
-2013-02-03 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/reuse.c: Fix typo causing the same negation condition to be
- applied to all operands. Fix condition for when to invoke mpz_remove.
- Make different-size random operands.
-
-2013-02-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/remove.c: Correct the sign in case of reuse.
-
-2013-02-01 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (DIGITS_IN_BASE_PER_LIMB): Add a cast.
- (LIMBS_PER_DIGIT_IN_BASE): Likewise.
-
- * tests/refmpn.c (refmpn_mul): Use toom6h instead of toom44 for the
- largest operands.
-
-2013-01-31 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom44_mul.c: Revert last change in favour of a simple
- change (thanks Marco!).
- * mpn/generic/toom4_sqr.c: Likewise.
-
-2013-01-30 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom44_mul.c (MAYBE_mul_toom44): Take toom6h and toom8h
- into account, using new macro MUL_NEXTALG_THRESHOLD.
- * mpn/generic/toom4_sqr.c (MAYBE_sqr_toom4): Likewise.
-
-2013-01-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/remove.c: init+set=init_set, cast before shifting.
-
- * mpz/cmp_si.c: Use ABS_CAST.
-
-2013-01-26 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/logic.c: Set things up to always test library logops, not
- gmp-impl.h's inlined variants. Test also mpn_com.
-
- * tests/mpn/t-mod_1.c: Test also mpn_mod_1s_3p.
-
- * mpn/generic/mod_1_3.c: Swap some lines to make it similar to mod_4.c.
-
- * tests/mpz/reuse.c: Fix typo in last change.
-
-2013-01-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpz_cmpabs_d, mpz_cmp_d): Simplify.
- (mpz_set_str): Behaviour more adherent to the real GMP.
-
- * mini-gmp/tests/t-str.c: Cast size_t to unsigned long, for printf.
- * mini-gmp/tests/t-import.c: Likewise.
- * mini-gmp/tests/t-comb.c: Remove an unused var.
- * mini-gmp/tests/t-div.c: Remove unused args passed to fprintf.
- * mini-gmp/tests/t-double.c: Use float immediates with float vars.
-
-2013-01-22 Torbjorn Granlund <tege@gmplib.org>
-
- * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
- * gmp-h.in: Bump version.
-
- * tests/mpz/reuse.c: Delete always zero 'failures' and code depending
- on it. Replace rotating progress with real measure.
-
- * Makefile.am (check-mini-gmp): Fix typo in last change.
-
-2013-01-22 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/mini-gmp.c (mpz_cmp_d): Simplified, just sort out
- signs, then call mpz_cmpabs_d.
-
- * mini-gmp/tests/testutils.h: Include stdio.h and stdlib.h.
- (numberof): New define.
-
- * mini-gmp/tests/t-cmp_d.c: New file, copied from
- tests/mpz/t-cmp_d.c with minor changes.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-cmp_d,
-
- * mini-gmp/mini-gmp.c (mpz_cmpabs_d): New function.
- * mini-gmp/mini-gmp.h: Declare it.
-
-2013-01-21 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (testmain): Test mpz_out_str, using
- the tmpfile function for i/o.
-
-2013-01-20 Torbjorn Granlund <tege@gmplib.org>
-
- * Makefile.am (check-mini-gmp): Set also DYLD_LIBRARY_PATH for the
- benefit of Darwin.
-
- * tests/mpn/t-div.c: Test mpn_sb_div_qr_sec and mpn_sb_div_r_sec.
- (main): Separate divisor into normalised (dnp) and unnormalised (dup),
- pass appropriate variant to each function.
- (main): Make negative `test' index value mean divisor bits, for better
- small operands coverage.
- (main): Put random junk at qp[] instead of zeroing.
-
- * tests/mpz/t-remove.c: Back out last change which left `divisor_size'
- uninitialised; achieve change's aim with a parameter tweak.
-
-2013-01-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/testutils.c (testhalves): New function, test default
- memory functions.
- * mini-gmp/tests/testutils.h (testhalves): Declare it
- * mini-gmp/tests/t-logops.c: Use testhalves.
-
- * mini-gmp/mini-gmp.c (mpz_init_set_str): New function.
- * mini-gmp/mini-gmp.h (mpz_init_set_str): Declare it.
- * mini-gmp/tests/t-str.c: Test mpz_init_set_str.
-
-2013-01-20 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/memory.c (PTRLIMB): New macro, used for conformant casting.
-
-2013-01-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-double.c (testmain): Get the current free
- function using mp_get_memory_functions.
- * mini-gmp/tests/t-str.c (testmain): Likewise.
-
- * mini-gmp/tests/testutils.h (tu_free): Remove declaration.
-
- * mini-gmp/tests/testutils.c (block_check, tu_free): Mark static.
-
- * tests/mpz/t-set_str.c: Check also failing conditions.
-
- * tests/mpz/t-remove.c: Test removal of 1.
-
-2013-01-18 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (test_small): New function, exercising
- parsing of whitespace and base prefixes.
- (testmain): Call it.
-
- * mini-gmp/tests/t-gcd.c (gcdext_valid_p): Fixed memory leak.
-
- * mini-gmp/tests/t-double.c (testmain): Call tu_free rather than
- free, for storage allocated by mpz_get_str.
- * mini-gmp/tests/t-str.c (testmain): Likewise.
-
- * mini-gmp/tests/testutils.c (block_init, block_check): New
- functions.
- (tu_alloc, tu_realloc, tu_free): New functions.
- (main): Use mp_set_memory_functions.
- * mini-gmp/tests/testutils.h (tu_free): Declare.
-
- * mini-gmp/tests/testutils.h: New file, declarations for test
- programs.
-
- * mini-gmp/tests/testutils.c (main): New file, with shared main
- function for all the test programs. Also includes mini-gmp.c.
- Calls testmain after initialization. All other test programs
- updated to define testmain rather than main.
-
-2013-01-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-signed.c: Slightly larger coverage.
- * mini-gmp/tests/t-double.c: Test also mpz_init_set_d.
-
-2013-01-18 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/set_str.c (normalization_steps): Eliminate set-but-unused
- variable.
-
- * mini-gmp/tests/t-div.c: Test mpz_divisible_p and mpz_divisible_ui_p.
-
- * tests/tests.h (TESTS_REPS): Fix printf argument type clashes.
-
- * mini-gmp/tests/t-div.c: Test also mpz_mod, mpz_mod_ui. Compare
- mpz_divisible_p just to ceil, to save time.
-
- * mini-gmp/mini-gmp.c: Prefix some names with GMP_.
-
-2013-01-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-double.c: Test mpz_cmp_d.
- * mini-gmp/mini-gmp.c (mpz_cmp_d): Correct multiword comparison.
-
- * mini-gmp/mini-gmp.c (mpz_set_str): Handle the empty string.
- * mini-gmp/tests/t-str.c: Test base <= 0.
-
-2013-01-15 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (main): Use x->_mp_d rather than x[0]._mp_d.
- * mini-gmp/tests/t-invert.c (main): Likewise.
-
- * mini-gmp/tests/t-mul.c (main): Test mpn_mul_n and mpn_sqr.
-
- * mini-gmp/tests/hex-random.h (enum hex_random_op): New value
- OP_SQR.
-
- * mini-gmp/tests/mini-random.c (mini_random_op3): Renamed, from...
- (mini_random_op): ... old name. Updated callers.
- (mini_random_op2): New function.
-
- * mini-gmp/tests/hex-random.c (hex_random_op3): Renamed, from...
- (hex_random_op): ... old name. Updated callers.
- (hex_random_op2): New function.
-
-2013-01-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-logops.c: Improve popcount/hamdist testing.
- * mini-gmp/tests/t-signed.c: Test more cases.
-
-2013-01-15 Torbjorn Granlund <tege@gmplib.org>
-
- From Mike Frysinger:
- * configure.ac: Add x32 ABI for x86_64.
-
-2013-01-14 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-str.c (main): Added tests for mpn_get_str and
- mpn_set_str.
-
-2013-01-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * doc/gmp.texi (gmp_version): Remove "was used" repetition.
- (Upward compatibility): Mention mpn_bdivmod, GMP 4 -> GMP 5.
-
-2013-01-13 Marc Glisse <marc.glisse@inria.fr>
-
- * doc/gmp.texi: Let mpn_sqrtrem reference mpn_perfect_square_p instead
- of mpz_perfect_square_p.
-
-2013-01-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-comb.c: New test program, testing both
- mpz_fac_ui and mpz_bin_uiui.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-comb.
-
- * mini-gmp/mini-gmp.c (mpz_mul_si): Simplify.
- (mpz_mul_ui, mpz_mul, mpz_div_qr): Replace init+REALLOC with init2.
-
- * mini-gmp/mini-gmp.c (NEG_CAST): New macro.
- (mpz_mul_si, mpz_set_si, mpz_cmp_si): Use NEG_CAST.
-
- * mini-gmp/mini-gmp.c (mpz_set_si, mpz_cmp_si): Simplify by using
- the _ui variant.
-
- * mini-gmp/tests/t-root.c: Use mpz_ui_pow_ui, when base fits an ui.
-
- * mini-gmp/tests/t-mul.c: Test also mpz_mul_si.
- * mini-gmp/tests/t-sub.c: Test also mpz_ui_sub.
-
- * mini-gmp/mini-gmp.c (mpz_fits_slong_p): Correct range.
- * mini-gmp/tests/t-signed.c: New test program, for get/set/cmp_si.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-signed.
-
- * mini-gmp/mini-gmp.c (mpz_hamdist): Handle different sizes.
- * mini-gmp/tests/t-logops.c: Test also popcount and hamdist.
-
-2013-01-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/export.c: Less restrictive ASSERTs.
- * mini-gmp/mini-gmp.c (mpz_export, mpz_import): Likewise.
- * mini-gmp/tests/t-import.c: Test also size=0 or count=0.
-
-2013-01-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mini-gmp/tests/t-import.c (main): Don't drop off function end.
-
- * Makefile.am (check-mini-gmp): Set LD_LIBRARY_PATH to allow testing
- with dynamic main GMP build.
-
-2013-01-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c (mpz_export): Support op=0 countp=NULL.
-
-2013-01-08 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-import.c: New test program, testing both
- mpz_import and mpz_export.
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): Added t-import.
-
- * mini-gmp/tests/mini-random.c (mini_rrandomb_export): New
- function.
- * mini-gmp/tests/mini-random.h: Declare it.
- * mini-gmp/tests/hex-random.c (hex_rrandomb_export): New function.
- * mini-gmp/tests/hex-random.h: Declare it.
-
- * mini-gmp/mini-gmp.c (mpz_export): Compute accurate word count up
- front, to avoid generating any high zero words.
-
-2013-01-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/README: Document base limitation for conversions.
- * mini-gmp/mini-gmp.c (mpz_set_str): Remove goto.
- (mpz_import, mpz_export): Correctly use order/endianness.
-
-2013-01-05 Torbjorn Granlund <tege@gmplib.org>
-
- * longlong.h (aarch64): Make add_ssaaaa and sub_ddmmss actually work.
-
-2013-01-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- From shuax:
- * mini-gmp/mini-gmp.c (mpz_import): Reset limb after storing it.
-
-2013-01-04 Torbjorn Granlund <tege@gmplib.org>
-
- From Marko Lindqvist:
- * configure.ac: Use AC_CONFIG_HEADERS instead of the obsolete
- AM_CONFIG_HEADER.
-
-2013-01-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpz/bit.c: Wider testing for mpz_combit.
- * tests/mpz/logic.c: Check the -2^n case.
-
- * mpz/ior.c: Fixed an allocation bug in the -2^n case.
-
-2012-12-31 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/get_d.c: Minor reorg, add vax D code.
-
- * gmp-impl.h (double_extract): New union type for vax D floats.
-
- * tests/mpq/t-get_d.c (check_random): Limit exponents on vax.
-
-2012-12-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpz/bit.c (check_clr_extend): Check _set shrink.
-
-2012-12-29 Torbjorn Granlund <tege@gmplib.org>
-
- * demos/calc/calc.c: Remove generated file from repo.
- * demos/calc/calc.h: Likewise.
- * demos/calc/calclex.c: Likewise.
-
-2012-12-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/get_d.c: Complete rewrite of non-IEEE code.
-
- * tests/mpq/t-get_d.c (main): Suppress check_random for vax.
-
-2012-12-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/bdiv_q_1.asm: Use LEA for binvert_limb_table.
-
-2012-12-23 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-get_d.c (check_onebit): Decrease vax limit to avoid
- overflow in last, unused 'want' value.
-
- * config.guess: Recognise AMD family 22 as a future bobcat.
-
-2012-12-21 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.ac: Rename configure.in.
-
-2012-12-17 Torbjorn Granlund <tege@gmplib.org>
-
- * Version 5.1.0 released.
-
- * configure.in (none-*-*): Allow this again, but print a warning.
-
-2012-12-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/n_pow_ui.c: Fix typos in an ASSERT.
-
-2012-12-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mu_div_qr.c (mpn_preinv_mu_div_qr): Explicitly use
- MPN_COPY_INCR for slightly overlapping copy.
-
-2012-12-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpn/toom-sqr-shared.h: Skip ALLOCs if the test is skipped.
-
-2012-12-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/dos64.m4 (PIC): Move definition early.
- (JMPENT): Remove PIC variant.
-
- * mpn/x86_64/darwin.m4 (JUMPTABSECT): Define to .text, instead of
- something sensible.
-
-2012-12-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/x86_64-defs.m4 (JMPENT): New macro.
- * mpn/x86_64/dos64.m4: Likewise.
- * mpn/x86_64/darwin.m4: Likewise.
- * mpn/x86_64/mod_34lsub1.asm: Use JMPENT to properly support PIC.
- * mpn/x86_64/mullo_basecase.asm: Likewise.
- * mpn/x86_64/sqr_basecase.asm: Likewise.
-
-2012-12-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mod_34lsub1.asm: Try different jump table for the benefit
- of broken Apple linkers.
-
-2012-12-09 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Make GMP_NONSTD_ABI ABI specific.
-
-2012-12-08 Torbjorn Granlund <tege@gmplib.org>
-
- * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Bump version info.
- * gmp-h.in: Bump version.
-
-2012-12-06 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpq/reuse.c: New test (adapted from mpf/reuse.c).
- * tests/mpq/Makefile.am (check_PROGRAMS): Add reuse.
-
- * mpz/abs.c: Use NEWALLOC.
- * mpz/neg.c: Likewise.
- * mpz/com.c: Reduce branches.
-
-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.
-
- * mpz/jacobi.c (mpz_jacobi): Check for asize == 0 or bsize == 0
- before using the low limbs.
-
-2012-12-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/set_str.c (mpn_dc_set_str): Work around a valgrind issue.
-
- * mpz/powm_ui.c: Don't assume >= 2 limbs in mod argument.
-
- * tests/tests.h (TESTS_REPS): Handle float GMP_CHECK_REPFACTOR.
-
- * longlong.h: Refine cpp test for vax.
- * tests/mpn/t-get_d.c: Likewise.
- * tests/mpz/t-get_d.c: Likewise.
- * tests/mpz/t-cmp_d.c: Likewise.
- * tests/mpz/t-get_d.c: Likewise.
- * tests/mpq/t-get_d.c: Likewise.
- * tests/mpf/t-get_d.c: Likewise.
-
-2012-11-30 Torbjorn Granlund <tege@gmplib.org>
-
- * gen-fac.c (gen_consts): Correct printf types.
-
- * mpn/arm/v7a/cora15/gmp-mparam.h: New file.
-
- * configure.in (arm*-*-*): New compiler optional "tune". Pass value for
- selected processors. Add more specific path components.
-
-2012-11-29 Torbjorn Granlund <tege@gmplib.org>
-
- From Andoni Morales Alastruey:
- * longlong.h: Conditionalise ARM asm on !__thumb__.
-
-2012-11-28 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess (arm*-*-*): Support specific ARM processors.
- * config.sub: Match arm CPUs.
- * configure.in (arm*-*-*): Likewise.
-
- * mpz/powm.c: Move new_b out since it lives on through b.
-
- * configure.in (arm*-*-*): Pass -marm to deal with compilers defaulting
- to thumb code.
-
-2012-11-26 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/cxx/t-ops2.cc (checkz): Reduce huge numbers to avoid vax
- overflow.
-
-2012-11-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/get_d.c: Reinsert non-IEEE code.
-
- * mpn/vax/add_n.asm: New file.
- * mpn/vax/add_n.s: Remove.
- * mpn/vax/addmul_1.asm: New file.
- * mpn/vax/addmul_1.s: Remove.
- * mpn/vax/lshift.asm: New file.
- * mpn/vax/lshift.s: Remove.
- * mpn/vax/mul_1.asm: New file.
- * mpn/vax/mul_1.s: Remove.
- * mpn/vax/rshift.asm: New file.
- * mpn/vax/rshift.s: Remove.
- * mpn/vax/sub_n.asm: New file.
- * mpn/vax/sub_n.s: Remove.
- * mpn/vax/submul_1.asm: New file.
- * mpn/vax/submul_1.s: Remove.
-
- * mpn/vax/elf.m4: New file.
- * configure.in (vax*-*-*elf*): New case, grabbing vax/elf.m4.
-
- * tests/mpn/t-get_d.c (check_onebit): Get vax bounds right.
- (main): Switch off check_rand for vax.
-
-2012-11-22 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/run-tests: Copied latest version from GNU Nettle.
- Minor fix to the use of $EMULATOR, and proper copyright notice.
-
-2012-11-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm_sec.c (redcify): Use mpn_sb_div_r_sec.
-
- * mpn/generic/sb_div_sec.c: New file.
- * mpn/generic/sbpi1_div_sec.c: New file.
- * configure.in (gmp_mpn_functions): Add new files.
- * gmp-impl.h: Declare new functions.
-
-2012-11-12 Torbjorn Granlund <tege@gmplib.org>
-
- * longlong.h: Add ARM64 support.
- * longlong.h: Add AVR support.
-
- * mpn/powerpc64/mode64/divrem_1.asm: Tune, simplify.
-
- * mpq/md_2exp.c: Use MPN_COPY_INCR, not MPN_COPY_DECR.
- * tests/mpq/t-md_2exp.c (check_random): New function.
-
-2012-11-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/remove.c (mpn_bdiv_qr_wrap): Make static.
-
-2012-11-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/powm_ui.c: Rewrite.
-
-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
- limb.
- * mpn/generic/perfpow.c (is_kth_power): Update mpn_brootinv call.
- * tests/mpn/t-brootinv.c (main): Likewise.
- * tune/speed.h (SPEED_ROUTINE_MPN_BROOTINV): Likewise.
- * gmp-impl.h (mpn_brootinv): Updated prototype.
-
- * mpn/generic/hgcd2.c (mpn_hgcd2): Removed redundant loop exit
- tests in the single-precision loop.
-
- * mpz/combit.c (mpz_combit): Rewrite, optimizing for the common
- case.
-
-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
-
- * mpn/generic/broot.c (mpn_broot_invm1): Avoid a mullo_n in the
- loop, and do powering as a plain mpn_sqr followed by mpn_powlo.
-
- * tune/speed.c (routine): Added mpn_broot, mpn_broot_invm1,
- mpn_brootinv.
-
- * tune/common.c (speed_mpn_broot, speed_mpn_broot_invm1)
- (speed_mpn_brootinv): New functions.
- * tune/speed.h (SPEED_ROUTINE_MPN_BROOT)
- (SPEED_ROUTINE_MPN_BROOTINV): New macros.
-
- * mpn/generic/broot.c (mpn_broot_invm1): Made non-static (mainly
- for benchmarking).
- * gmp-impl.h (mpn_broot_invm1): Declare it.
-
-2012-10-28 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (gmp_mpn_functions): Add new files.
- * gmp-impl.h: Declare new functions.
- * mpn/generic/perfpow.c: Overhaul.
- (binv_root, binv_sqroot): Remove.
- * mpn/generic/brootinv.c: New file, code from overhauled binv_root.
- * mpn/generic/bsqrtinv.c: New file, code from overhauled binv_sqroot.
- * mpn/generic/bsqrt.c: New file.
-
- * tests/mpn/t-broot.c: Add a forgotten TMP_MARK.
-
-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.
- * gmp-impl.h (mpn_broot): Declare.
- * tests/mpn/t-broot.c: New testcase.
- * tests/mpn/Makefile.am (check_PROGRAMS): Added t-broot.
-
-2012-10-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/remove.c: Get remainder allocation right.
-
-2012-10-25 Torbjorn Granlund <tege@gmplib.org>
-
- * longlong.h: De-support old POWER asm syntax.
-
- * tests/mpz/t-remove.c: Run more tests, but use a tad smaller operands.
-
- * mpn/generic/remove.c (mpn_bdiv_qr_wrap): New function.
- (mpn_remove): Call mpn_bdiv_qr_wrap.
- * mpz/remove.c: Enable suppressed mpn_remove call.
-
-2012-10-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/powm_ui.c (mpz_powm_ui): Deflect to mpz_powm for large exponent.
-
-2012-09-10 Torbjorn Granlund <tege@gmplib.org>
-
- * demos/factorize.c: Rewrite no more current form. Implement Lucas
- prime proving, and make its use the default.
- * demos/primes.h: New file.
-
-2012-08-24 Torbjorn Granlund <tege@gmplib.org>
-
- * demos/factorize.c: Overhaul.
-
-2012-08-06 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * doc/gmp.texi (mpn_neg): Correctly document returned type.
-
- * gmp-impl.h (_mpz_newalloc, log_n_max): mark with inline (spotted by Niels).
-
-2012-07-28 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (std::common_type): New partial specializations with builtin
- types.
- * tests/cxx/t-cxx11.cc: Test it.
-
-2012-07-21 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc32/vmx/mod_34lsub1.asm: Fix r0 clobbering issue with
- "large" code affecting elf+darwin PIC.
-
-2012-07-21 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__GMPXX_CONSTANT): Disable for g++-3.4.
-
-2012-06-26 Torbjorn Granlund <tege@gmplib.org>
-
- * Makefile.am (LIBMP_LT_*): Remove these.
-
-2012-06-26 Marc Glisse <marc.glisse@inria.fr>
-
- * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*): Update comment for 5.1.0.
-
-2012-06-24 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * configure.in (CALLING_CONVENTIONS_OBJS): Disable any use of
- assembly code with the --disable-assembly option.
- * mpz/oddfac_1.c: Use the ASSERT_CODE macro.
- * gen-trialdivtab.c (mpz_log2): Use mpz_sizeinbase (., 2).
-
- * gmp-impl.h (MPN_SIZEINBASE_16): Replace with MPN_SIZEINBASE_2EXP
- from mpz/export.c .
- * mpz/export.c (MPN_SIZEINBASE_2EXP): Removed.
- * mpn/generic/sizeinbase.c: Use MPN_SIZEINBASE.
-
- * mpz/nextprime.c: Use MPN_SIZEINBASE_2EXP to count bits.
- * mpn/generic/perfpow.c: Likewise.
- * mpn/generic/rootrem.c: Likewise.
- * mpz/get_d_2exp.c: Likewise.
- * mpn/generic/powm_sec.c: Likewise, nailify.
- * mpn/generic/powlo.c: Likewise.
- * mpn/generic/powm.c: Likewise.
-
- * mini-gmp/mini-gmp.c (mpz_div_r_2exp, mpz_div_q_2exp): Improve
- adjustment condition.
-
-2012-06-23 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (numeric_limits): Make content public.
- * cxx/limits.cc: New file, proper declarations.
- * Makefile.am: List new file.
- * cxx/Makefile.am: Likewise.
- * cxx/t-misc.cc: Add minimal test for numeric_limits.
-
-2012-06-09 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__gmp_resolve_expr::srcptr_type): New typedef.
- (__gmp_temp): Wrapper for mp*_class, the constructor copies the
- precision of its second argument for mpf_t.
- (__gmp_expr::eval(p, prec)): Remove.
- (__gmp_expr::eval(p)): Use __gmp_temp.
- (__gmp_set_expr): Never pass prec to eval().
-
-2012-06-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h (__GMP_WITHIN_CONFIGURE): Use the same #if as in gmp-h.in.
- (MPN_NORMALIZE_NOT_ZERO): Tighter ASSERT.
- (MPZ_NEWALLOC): New macro.
- * mpq: Use the new macro when possible.
- * mpz/bin_uiui.c: Likewise.
- * mpz/oddfac_1.c: Likewise.
- * mpz/prodlimbs.c: Likewise.
-
- * mini-gmp/mini-gmp.c (mpz_realloc): remove a branch.
-
-2012-06-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/aix.m4 (ASM_START): Claim machine type "any".
-
-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.
-
-2012-06-02 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/lshiftc.asm: New file.
-
-2012-06-01 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/aorslsh1_n.asm: Use cmp/cmn instead of subs/adds in more
- places.
-
- * mpz/get_str.c: Don't strip leading zeros since current mpn_get_str
- won't generate any. Misc streamlining.
- * mpz/out_str.c: Analogous changes.
-
- * tests/mpz/io.c: Use a wider range of bases.
-
- * tests/mpz/t-cong.c (check_random): Rewrite random generation for
- exponentially distributed operand sizes.
-
-2012-06-01 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpq: Use more macros and MPZ_REALLOC return value when possible.
-
- * gmp-impl.h (LIMBS): Removed, was an alias for PTR.
- * mpz/combit.c: Use PTR and CNST_LIMB.
-
- * tests/mpn/t-bdiv.c: Test also mpn_bdiv_qr.
- * mpn/generic/bdiv_qr.c: Add an ASSERT.
-
- * mpn/generic/remove.c: Add a zero limb to use bdiv_qr...
-
-2012-05-31 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (mpq_class::mpq_class): Handle mpq_class(0,1).
- * tests/cxx/t-constr.cc: Test it.
-
-2012-05-30 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64 (FUNC_ENTRY): New name for DOS64_ENTRY.
- * mpn/x86_64 (FUNC_EXIT): New name for DOS64_EXIT.
-
-2012-05-29 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/remove.c: Optimise branches.
-
- * mpn/generic/toom6h_mul.c: less branches in the LIKELY balanced path.
- * mpn/generic/toom8h_mul.c: Likewise.
-
-2012-05-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/v5/mod_1_1.asm: New file.
-
-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
- ASSERT improvements.
-
-2012-05-27 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: Add new x86 CPUs.
- * mpn/x86/fat/fat.c: Likewise.
- * mpn/x86_64/fat/fat.c: Likewise.
-
-2012-05-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86_64/fat/fat.c: abort iff longmode-capable-bit is turned off.
-
- * mpn/generic/toom8h_mul.c: mark UNLIKELY branches.
-
-2012-05-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz: Use MPZ_REALLOC return value when possible.
-
-2012-05-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/tests/t-div.c: Test all _qr, _q, _r variants.
- * mini-gmp/tests/t-lcm.c: Test the _ui variant.
-
- * mini-gmp/mini-gmp.c (mpz_mod, mpz_mod_ui): New functions.
- * mini-gmp/mini-gmp.h (mpz_mod, mpz_mod_ui): Prototypes.
-
- * mpz/scan1.c: Simplify, and add a shortcut for scan1(z, 0).
-
-2012-05-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/n_pow_ui.c: Cast non-limb count_leading_zeros argument.
-
-2012-05-24 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/remove.c: Support negative divisor.
- * tests/mpz/t-remove.c: Test negative divisor.
-
-2012-05-23 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/reuse.c: Major rewrite.
-
-2012-05-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/sqrt.c: Further simplify.
- * mpz/sqrtrem.c: Likewise.
-
- * Mark failing branches with UNLIKELY. Many files affected.
-
-2012-05-22 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/sqrt.c: Allocate less for overlapping operands, simplify.
- * mpz/sqrtrem.c: Likewise.
-
-2012-05-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom8_sqr.c: Reduce branches for recursion.
- * mpn/generic/toom8h_mul.c: Likewise.
-
- * tests/mpn/t-toom8h.c: Don't use GMP_NUMB_BITS when not yet defined.
-
-2012-05-20 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-gcd.c: Rewrite.
-
-2012-05-19 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-gcd.c: Generate larger operands for better gcd code
- coverage; distribute size exponentially.
-
-2012-05-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpf/pow_ui.c: Simplify.
- * tests/mpf/reuse.c (dsi_func): Exercise pow_ui.
-
- * tests/mpf/t-set_ui.c (check_data): LONG_HIGHBIT -> ULONG_HIGHBIT.
- * tests/mpf/t-set.c (check_random): New check, both set and init_set.
-
- * tests/cxx/t-ops.cc (check_mpq): Check squaring.
- * tests/mpq/t-equal.c (check_various): Check different den-size.
-
- * mpn/generic/mullo_n.c: Disable MAYBE_ if WANT_FAT_BINARY.
- * mpz/cmpabs_d.c: Remove an unused branch.
-
- * tests/mpz/t-get_d_2exp.c (check_zero): New check.
- * tests/mpz/t-inp_str.c: A few more cases.
- * tests/mpz/t-cmp_d.c: More bases and symbols, a few cases.
-
- * mpz/rootrem.c: Correctly handle odd roots of negatives.
- * tests/mpz/t-root.c: Test it.
-
-2012-05-16 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpf/t-eq.c (check_random): New function, meat from old main().
- (check_data): New function.
-
-2012-05-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/rsh1aors_n.asm: New file.
- * mpn/arm/v5/mod_1_2.asm: New file.
-
-2012-05-11 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (explicit operator bool): New functions.
- * tests/cxx/t-cxx11.cc: Test the above.
-
-2012-05-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h (__gmpn_cpuvec_initialized): Was __gmpn_cpuvec.initialized
- * mpn/x86/fat/fat.c: Use separated _initialized variable.
- * mpn/x86_64/fat/fat.c: Likewise.
- * tests/mpn/t-fat.c: Likewise.
-
- * mpn/generic/toom2_sqr.c: Override global __gmpn_cpuvec_initialized.
- * mpn/generic/toom22_mul.c: Likewise.
- * mpn/generic/toom3_sqr.c: Likewise.
- * mpn/generic/toom33_mul.c: Likewise.
-
-2012-05-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.c: merge mpz_rootrem and mpz_sqrtrem.
-
- * mpn/generic/sqrtrem.c (invsqrttab): Reduce size removing common byte.
-
- * mpz/bin_uiui.c (mul3, mul4, mul8): Remove unneeded shifts.
- (MAXFACS): Redefine, using the shared (safer) log_n_max.
-
-2012-05-08 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/minithres/gmp-mparam.h (REDC_1_TO_REDC_N_THRESHOLD): Up to 9, for
- coherency with ASSERT in mpn/generic/redc_n.c.
-
-2012-05-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/minithres/gmp-mparam.h: Updated TOOM6 and FAC_DSC.
- * tests/mpn/toom-sqr-shared.h: Don't test if no range.
-
- * mpz/oddfac_1.c: Add ASSERTs to warn about small threshold.
- * tune/tuneup.c: Update minimal threshold for FAC_DSC.
-
-2012-05-06 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/v6/sqr_basecase.asm: Simplify n=4 code.
-
-2012-05-05 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/invert.c: Mark a branch UNLIKELY.
- * tune/tuneup.c (tune_fac_u): Update DSC_THRESHOLD minimum.
- * gmp-impl.h (FAC_???_THRESHOLD): Update default values.
- (ABOVE_THRESHOLD): New definition with __builtin_constant_p.
-
- * mpn/generic/toom22_mul.c: Disable MAYBE_ if WANT_FAT_BINARY.
- * mpn/generic/toom33_mul.c: Likewise.
- * mpn/generic/toom2_sqr.c: Likewise.
- * mpn/generic/toom3_sqr.c: Likewise.
-
-2012-05-04 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c: Measure POWM_SEC_TABLE after the REDC thresholds.
-
-2012-05-03 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm_sec.c: Use redc_2.
- (INNERLOOP): Use this mechanism, like plain powm.c.
- (WANT_CACHE_SECURITY): Remove, feature now unconditional.
-
-2012-05-02 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/bin_uiui.c: Make use of CNST_LIMB.
-
-2012-05-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/mfac_uiui.c: Support limb != ui.
-
-2012-05-02 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/logops_n.asm: Work around register clobbering issue.
-
- * mpn/arm/aorscnd_n.asm: New file.
-
-2012-05-01 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Put arm dirs in path in proper prio order.
-
- * mpn/arm/logops_n.asm: New file.
-
- * mpz/2fac_ui.c: Fix assumed typo.
-
- * mpn/arm/v6/gmp-mparam.h: New file.
-
- * mpn/arm/v5/gcd_1.asm: Hack for undefined BMOD_1_TO_MOD_1_THRESHOLD.
- * mpn/arm/v6t2/gcd_1.asm: Likewise.
-
-2012-04-30 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/v6/sqr_basecase.asm: New file.
-
-2012-04-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/comb_tables.c: New file.
- * configure.in: Add it.
- * gen-fac.c: Define table limits.
- * gmp-impl.h: Declare tables.
- (log_n_max): New static function.
- * mpz/2fac_ui.c: Use shared tables.
- * mpz/bin_uiui.c: Likewise.
- * mpz/oddfac_1.c: Likewise.
- * mpz/primorial_ui.c: Likewise.
-
- * mpz/mfac_uiui.c: New file.
- * Makefile.am: Compile it.
- * mpz/Makefile.am (libmpz_la_SOURCES): Add mpz_mfac_uiui.c
- * gmp-h.in (mpz_mfac_uiui): Declare.
-
- * tests/mpz/t-mfac_uiui.c: New file.
- * tests/mpz/Makefile.am: Run it.
-
- * doc/gmp.texi: Document mpz_mfac_uiui, collapsing with other factorial functions.
-
- * tests/mpz/t-lcm.c: Test zero too.
-
- * mpz/prodlimbs.c: Simplify threshold (should be tuned, not guessed).
-
-2012-04-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/aors_n.asm: Tune for more stable performance.
-
- * mpn/arm/aorslsh1_n.asm: New file.
-
- * mpn/arm/mod_34lsub1.asm: New file.
-
- * mpn/arm/v6t2/divrem_1.asm: New file.
-
-2012-04-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/thumb/add_n.asm: New file.
- * mpn/thumb/sub_n.asm: New file.
- * mpn/thumb/add_n.s: Remove broken code.
- * mpn/thumb/sub_n.s: Likewise.
-
- * mpn/arm/v6/addmul_1.asm: Rewrite for stable speed, smaller size.
- * mpn/arm/v6/mul_1.asm: Likewise.
-
-2012-04-27 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Search arm/v6t2 for arm7.
-
- * mpn/arm/v5/gcd_1.asm: New file.
- * mpn/arm/v6t2/gcd_1.asm: New file.
-
- * mpn/arm/mode1o.asm: New file.
- * mpn/arm/v6t2/mode1o.asm: New file.
-
- * mpn/arm/arm-defs.m4 (LEA): New define.
- * mpn/arm/invert_limb.asm: Use LEA.
-
-2012-04-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/bin_uiui.c (bc_bin_uiui): Nail support.
- * tests/cxx/t-ops2.cc: Test 0/3.
- * oddfac_1.c: assume n > 26.
- * tests/mpz/t-jac.c (mpn_jacobi_n): Enlarge tested sizes.
-
-2012-04-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/v6/addmul_2.asm: New file.
- * mpn/arm/v6/mul_2.asm: New file.
-
-2012-04-23 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/aorsmul_1.asm: Tweak loop control for a 6% speed increase.
-
-2012-04-22 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Recognise ARM sub-architectures.
-
- * configfsf.guess: Update to current FSF version.
- * configfsf.sub: Likewise.
-
- * mpn/arm/bdiv_dbm1c.asm: New file.
-
- * mpn/arm/v6/mul_1.asm: New file.
- * mpn/arm/v6/addmul_1.asm: New file.
-
-2012-04-22 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gen-fac.c: Renamed, was gen-fac_ui.c .
- * Makefile.am: Renamed gen-fac.c and fac_table.h .
- * gmp-impl.h: #include "fac_table.h".
- * mpz/oddfac_1.c: Use generated constant.
- * mpz/bin_ui.c: Small optimisations.
-
- * tune/common.c (speed_mpz_bin_ui): New function.
- * tune/speed.h: Declare it.
- * tune/speed.c: Use it.
-
-2012-04-21 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/mul_1.asm: Cleanup.
- * mpn/arm/copyi.asm: Cleanup, assume allocate-on-write cache.
- * mpn/arm/copyd.asm: Likewise.
-
- * mpn/arm/add_n.asm: Delete.
- * mpn/arm/sub_n.asm: Delete.
- * mpn/arm/aors_n.asm: New file, made from old files.
-
- * mpn/arm/addmul_1.asm: Delete.
- * mpn/arm/submul_1.asm: Delete.
- * mpn/arm/aorsmul_1.asm: New file, made from old files.
-
- * mpn/arm/com.asm: New file.
- * mpn/arm/lshift.asm: New file.
- * mpn/arm/rshift.asm: New file.
-
-2012-04-20 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpq/io.c: New file.
- * tests/mpq/Makefile.am: Run it.
-
- * mpz/clrbit.c: Simplify along the lines of setbit.c.
-
-2012-04-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/setbit.c: Simplify.
-
- * gmp-impl.h (LOG2C): Define.
- * mpz/fac_ui.c (LOG2C): Remove.
- * mpz/2fac_ui.c (LOG2C): Remove.
- * mpz/oddfac_1.c (LOG2C): Remove.
- * mpn/generic/binvert.c (LOG2C): Remove.
- * mpn/generic/invertappr.c (LOG2C): Remove.
-
- * mpz/bin_uiui.c (mpz_goetgheluck_bin_uiui): Move declarations,
- and assume that n and k are not small.
-
-2012-04-19 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/Makefile.am (check_PROGRAMS): Add t-remove.
-
- * tests/mpz/t-remove.c: Clear out mpz variables.
-
- * tests/mpz/t-cong.c (check_random): Use much larger numbers.
- (check_data): Check congruences mod 0.
-
- * tests/mpz/t-divis.c: Test divisibility by zero.
-
- * tests/mpz/reuse.c: Test mpz_mod.
-
- * mpz/setbit.c: Remove dead code. Use CNST_LIMB.
- * mpz/clrbit.c: Use CNST_LIMB.
-
-2012-04-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * primesieve.c: New file, with functions from mpz/oddfac_1.c .
- * mpz/oddfac_1.c (bitwise_primesieve): Re-moved.
- * Makefile.am (libgmp_la_SOURCES): Add primesieve.c .
- * gmp-impl.h (gmp_primesieve): Declare.
-
- * mpz/bin_uiui.c (mpz_goetgheluck_bin_uiui): New, factor-based
- implementation.
- * tests/mpz/t-bin.c: Extend tests, to cover _goetgheluck.
-
- * mpz/primorial_ui.c: New file.
- * mpz/Makefile.am (libmpz_la_SOURCES): Add mpz/primorial_ui.c
- * Makefile.am (MPZ_OBJECTS): Add mpz/primorial_ui$U.lo
- * gmp-h.in (mpz_primorial_ui): Declare.
- * tests/mpz/t-primorial_ui.c: New test for the new function.
- * tests/mpz/Makefile.am (check_PROGRAMS): Add t-primorial_ui.
- * doc/gmp.texi: Short documentation for the new function.
-
-2012-04-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/coreisbr/aorsmul_1.asm: Fix some DOS64 issues.
- * mpn/x86_64/coreisbr/mul_1.asm: Likewise.
-
- * mpn/x86_64/fastsse/lshiftc-movdqu2.asm: Adhere to DOS64 register
- partitioning rules.
-
- * mpn/x86_64/fastsse/copyi-palignr.asm: Implement temporary workaround
- to overlap issue.
-
-2012-04-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/bin_uiui.c: Support small limbs (fallback on bin_ui).
-
- * tests/mpn/toom-sqr-shared.h: Use a restricted range.
- * tests/mpn/t-toom2-sqr.c: Specify correct range.
- * tests/mpn/t-toom3-sqr.c: Likewise.
- * tests/mpn/t-toom4-sqr.c: Likewise.
- * tests/mpn/t-toom6-sqr.c: Likewise.
- * tests/mpn/t-toom8-sqr.c: Likewise, but extended.
- * tests/mpn/Makefile.am (check_PROGRAMS): Add t-toom?-sqr tests.
-
- * mpn/generic/sbpi1_bdiv_q.c: Move ASSERTs, to support qp = np.
-
-2012-04-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/copyd.asm: Rewrite.
- * mpn/x86_64/copyi.asm: Rewrite.
-
-2012-04-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fastsse/lshift-movdqu2.asm: Add DOS entry/exit sequences.
- * mpn/x86_64/fastsse/rshift-movdqu2.asm: Likewise.
- * mpn/x86_64/fastsse/lshiftc-movdqu2.asm: Likewise.
-
- * mpn/x86_64/x86_64-defs.m4 (palignr): New macro.
- (x86_opcode_regxmm, x86_opcode_regxmm_list): New, made from x86 mmx
- counterparts.
- (x86_lookup): Copy from x86/x86-defs.m4.
- * mpn/x86_64/fastsse/copyd-palignr.asm: Use palignr macro.
- * mpn/x86_64/fastsse/copyi-palignr.asm: Likewise.
-
-2012-04-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpz/t-bin.c: Add more tests on small values.
- * mpz/bin_uiui.c (mpz_bdiv_bin_uiui): Smaller temporary areas.
-
-2012-04-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fastsse/copyd-palignr.asm: New file.
- * mpn/x86_64/fastsse/copyi-palignr.asm: New file.
- * mpn/x86_64/core2/copyd.asm: New file.
- * mpn/x86_64/core2/copyi.asm: New file.
- * mpn/x86_64/nano/copyd.asm: New file.
- * mpn/x86_64/nano/copyi.asm: New file.
- * mpn/x86_64/atom/copyd.asm: New file.
- * mpn/x86_64/atom/copyi.asm: New file.
-
-2012-04-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/bin_uiui.c: Rewrite (some parts are Torbjorn's).
- * gen-fac_ui.c: Generate new constants for bin_uiui.
-
- * mini-gmp/mini-gmp.h (mpz_fac_ui, mpz_bin_uiui): New definitions.
- * mini-gmp/mini-gmp.c (mpz_fac_ui, mpz_bin_uiui): Trivial
- implementation.
-
- * tests/mpz/t-fac_ui.c: Check Wilson's theorem on a big value.
-
- * mpn/generic/invert.c: Remove support for scratch == NULL.
- * tune/speed.h (SPEED_ROUTINE_MPN_MUPI_DIV_QR): Allocate scratch
- space for mpn_invert.
-
- * mpz/mul_i.h: Small clean-up.
-
- * tests/mpn/toom-sqr-shared.h: New file.
- * tests/mpn/t-toom2-sqr.c: New file.
- * tests/mpn/t-toom3-sqr.c: New file.
- * tests/mpn/t-toom4-sqr.c: New file.
- * tests/mpn/t-toom6-sqr.c: New file.
- * tests/mpn/t-toom8-sqr.c: New file.
- * tests/mpn/Makefile.am (EXTRA_DIST): Add toom-sqr-shared.h .
-
- * mpn/generic/toom62_mul.c: Use add_n, sub_n, when possible.
-
-2012-04-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fastsse/lshift-movdqu2.asm: New file.
- * mpn/x86_64/fastsse/rshift-movdqu2.asm: New file.
- * mpn/x86_64/fastsse/lshiftc-movdqu2.asm: New file.
- * mpn/x86_64/coreisbr/lshift.asm: New file.
- * mpn/x86_64/coreisbr/rshift.asm: New file.
- * mpn/x86_64/coreisbr/lshiftc.asm: New file.
- * mpn/x86_64/k10/lshift.asm: New file.
- * mpn/x86_64/k10/rshift.asm: New file.
- * mpn/x86_64/k10/lshiftc.asm: New file.
-
- * mpn/x86_64/fastsse/lshift.asm: Simplify to very basic form.
-
-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-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mini-gmp/mini-gmp.h (mpz_root, mpz_rootrem): define (correctly).
- * mini-gmp/mini-gmp.c (mpz_rootrem): Extended code from _root.
- (mpz_root): Use mpz_rootrem.
- (mpz_mul_ui): Correctly handle negative operands.
-
- * mini-gmp/tests/Makefile (CHECK_PROGRAMS): add t-root.
- * mini-gmp/tests/t-root.c: New file.
- * mini-gmp/tests/t-reuse.c: Enable root{,rem} tests.
-
-2012-04-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gen-fac_ui.c (mpz_root): Remove.
- * mini-gmp/mini-gmp.c (mpz_root): New, support negative operands.
- * mini-gmp/mini-gmp.h (mpz_root): define.
- (mpz_out_str): Test also __STDIO_LOADED (for VMS).
- * mpz/2fac_ui.c: Cosmetic change.
-
-2012-04-07 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/ia64/gcd_1.asm: Rewrite inner loop to use ctz table.
-
-2012-04-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/p7/popcount.asm: Properly extend arg n for mode32.
- * mpn/powerpc64/p7/hamdist.asm: Likewise.
-
-2012-04-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/p7/popcount.asm: New file.
- * mpn/powerpc64/p7/hamdist.asm: New file.
-
- * longlong.h (ARM count_leading_zeros): Enable for more arch versions.
-
- * mpn/x86_64/gcd_1.asm: Make room for DOS64 regparm shadow area.
- * mpn/x86_64/core2/gcd_1.asm: Likewise.
-
-2012-04-03 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/coreisbr/aorrlsh_n.asm: Make it actually work for DOS64.
-
-2012-04-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/oddfac_1.c: Initialize size for ASSERT.
-
-2012-04-02 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-h.in (_GMP_H_HAVE_FILE): Test also __STDIO_LOADED (for VMS).
-
- * gmp-impl.h (doprnt_format_t, etc): Remove bogus __GMP_DECLSPECs.
-
-2012-03-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86_64/sqr_basecase.asm: Speed-up for small cases.
-
-2012-03-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sparc64/gcd_1.asm: New file.
-
-2012-03-27 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: Fix typo in coreisbr recognition.
-
-2012-03-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86_64/gcd_1.asm: Reduce latency.
- * mpn/x86_64/mul_basecase.asm: Save one jump.
-
- * mpz/iset_ui.c: Don't realloc.
-
-2012-03-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mp_clz_tab.c: Add __clz_tab[128].
- * longlong.h (count_trailing_zeros): Use it in pure C variant.
-
-2012-03-20 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (x86 fat_path): Add many missing directories.
- * mpn/x86/fat/fat.c (__gmpn_cpuvec_init): Rewrite.
- (fake_cpuid_table): Add many more CPUs.
-
- * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Minor spacing cleanup.
-
-2012-03-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/x86-defs.m4 (CALL, PIC_WITH_EBX): New macros.
- * mpn/x86/darwin.m4: Likewise.
- * mpn/x86/k7/gcd_1.asm: Use new macros to support PIC.
- * mpn/x86/p6/gcd_1.asm: Likewise.
-
-2012-03-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gen-fac_ui.c: Generate more constants (possible mini-mpz_root).
- * mpz/oddfac_1.c: Improve ASSERTs.
- (log_n_max): Use precomputed table.
-
- * longlong.h (_PROTO): Remove.
-
-2012-03-18 Torbjorn Granlund <tege@gmplib.org>
-
- * longlong.h (count_trailing_zeros): Write better pure C default
- variant.
-
- * mpn/x86/p6/gcd_1.asm: Remove forgotten x86_64 reference.
-
- * mpn/x86/p6/gmp-mparam.h: Update, to get BMOD_1_TO_MOD_1_THRESHOLD
- defined for fat binaries.
-
-2012-03-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/k7/gcd_1.asm: Rewrite.
- * mpn/x86/p6/gcd_1.asm: New file.
-
- * mpn/x86_64/core2/gcd_1.asm: Conditionally suppress reduction calls.
- * mpn/x86_64/gcd_1.asm: Rewrite.
-
-2012-03-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/gcd_1.c: Parameterise zerotab code.
-
- * mpn/x86_64/nano/gcd_1.asm: New file, grabbing core2 asm file.
-
- * mpn/x86_64/core2/gcd_1.asm: Speed up loop code, simplify non-loop
- code.
-
-2012-03-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/core2/gcd_1.asm: Add hack to support fat builds.
-
- * mpn/x86_64/core2/gcd_1.asm: Shorten critical path.
-
-2012-03-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/core2/gcd_1.asm: New file.
- * mpn/x86_64/k10/gcd_1.asm: New file, grabbing core2 asm file.
- * mpn/x86_64/bd1/gcd_1.asm: Likewise.
-
- * mpn/x86_64/bobcat/sqr_basecase.asm: New file.
- * mpn/x86_64/bobcat/mul_basecase.asm: Minor tuning.
-
-2012-03-10 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (fat_functions): Add addlsh1_n, addlsh2_n, addmul_2,
- mullo_basecase, redc_1, redc_2, sublsh1_n.
-
- * gmp-impl.h (struct cpuvec_t): Add fields for new fat functions.
- * gmp-impl.h: Adjust corresponding declarations.
-
- * mpn/generic/redc_2.c (mpn_addmul_2): Make static.
-
- * mpn/x86_64/fat/fat_entry.asm (FAT_INIT): Expand before fat_init to
- reduce branch offsets. Pass plain 0,1,3... in %al since we'd else run
- out of 8-bit range.
-
- * mpn/x86_64/fat/fat_entry.asm (fat_init): Scale passed index value.
- * mpn/x86/fat/fat_entry.asm (fat_init): Use movzbl for expanding index
- value.
-
- * 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.
-
- * mpn/x86_64/fat/redc_2.c: New file.
- * mpn/x86/fat/mullo_basecase.c: New file.
- * mpn/x86/fat/redc_1.c: New file.
- * mpn/x86/fat/redc_2.c: New file.
-
- * tests/mpn/t-fat.c: Test mullo_basecase.
-
-2012-03-08 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/coreisbr/addmul_2.asm: Port to DOS64.
-
-2012-02-29 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h: Ignore partial C++11 support in g++-4.6.
- * tests/cxx/t-cxx11.cc: Likewise.
-
- * gmpxx.h (operator""): New functions.
- * tests/cxx/t-cxx11.cc: Test the above.
- * doc/gmp.texi: Document the above.
-
-2012-03-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * acinclude.m4 (GMP_H_ANSI): Remove.
- * configure.in: Don't use GMP_H_ANSI.
- * gmp-h.in (__GMP_HAVE_PROTOTYPES): Remove.
-
-2012-03-08 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fat/fat.c (fake_cpuid_table): Recognise "bulldozer".
- (__gmpn_cpuvec_init): Overhaul to match configure.in.
-
- * configure.in: Adjust bulldozer path_64.
-
-2012-03-07 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (x86_64 fat_path): List recently added AMD directories.
-
- * mpn/x86_64/bobcat/copyi.asm: New file.
- * mpn/x86_64/bobcat/copyd.asm: New file.
-
- * config.guess: Handle AMD 11h correctly.
-
- * tune/tuneup.c (tune_redc): Better handle situation where redc_2 is
- never faster.
-
-2012-03-06 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/bobcat/mul_basecase.asm: New file.
-
-2012-03-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/bobcat/mul_1.asm: New file.
- * mpn/x86_64/bobcat/aorsmul_1.asm: New file.
-
-2012-03-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/invert.c: Remove mod 0 branch.
- * tests/mpz/t-invert.c: Avoid testing mod 0.
- * doc/gmp.texi (mpz_invert): Specify mod 0 is not handled.
-
- * gmp-h.in (__gmp_signed, __gmp_const): Remove.
- (__GMP_HAVE_TOKEN_PASTE, __GMP_HAVE_CONST): Remove.
- * gmp-impl.h: Strip __GMP_HAVE_TOKEN_PASTE and __GMP_HAVE_CONST.
- * demos/expr/: Strip __gmp_const usage from all files.
-
- * tests/mpz/t-powm.c (allsizes_seen): Require unsigned*.
-
-2012-03-03 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/k8/gmp-mparam.h: New file.
- * mpn/x86_64/k10/gmp-mparam.h: New file.
-
- * mpn/generic/hgcd_step.c (mpn_hgcd_step): Remove unused variables.
- * mpn/generic/hgcd_jacobi.c (hgcd_jacobi_step): Likewise.
- * mpn/generic/hgcd_reduce.c (hgcd_matrix_apply): Likewise.
- * mpn/generic/mu_bdiv_qr.c: Likewise.
- * mpz/jacobi.c: Likewise.
- * mpz/mod.c: Likewise.
-
- * mpn/generic/toom42_mul.c: Remove unread variable.
- * mpn/generic/set_str.c (mpn_set_str_compute_powtab): Likewise.
- * mpn/generic/rootrem.c (mpn_rootrem_internal): Likewise.
- * tests/refmpn.c (refmpn_mul): Likewise.
- * mpn/generic/hgcd_appr.c (mpn_hgcd_appr): Propagate mask computation
- into ASSERT, remove variable.
-
- * gmp-h.in (__GMP_PROTO): Remove.
- * Strip __GMP_PROTO usage from all files.
- * Strip prototype parameter names from all files.
-
-2012-03-01 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * doc/gmp.texi (mpz_invert): Correctly document result range.
- * tests/mpz/t-invert.c: Small range correction.
-
-2012-03-01 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mullo_basecase.asm: New file.
-
-2012-02-29 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (std::numeric_limits): New partial specialization.
-
-2012-02-29 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp/tests/t-reuse.c: New test case, based on
- tests/mpz/reuse.c.
-
- * mini-gmp/mini-gmp.c (mpz_cdiv_r_ui): New function.
- (mpz_fdiv_r_ui): New function.
- (mpz_tdiv_r_ui): New function.
- (mpz_powm_ui): New function.
- (mpz_pow_ui): New function.
- (mpz_ui_pow_ui): Use mpz_pow_ui.
- (mpz_gcdext): Fixed input/output overlap, for the case of one
- input being zero.
- (mpz_sqrtrem): Fix for the case r NULL, U zero.
-
- * Makefile.am (check-mini-gmp): Use $(MAKE).
- (clean-mini-gmp): New target.
- (clean-local, distclean-local): New automake targets. Depend on
- clean-mini-gmp.
-
-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/tests/Makefile (srcdir, MINI_GMP_DIR): New make
- variables. These can be overridden when using a separate build
- directory.
- (EXTRA_CFLAGS): Renamed, was OPTFLAGS.
-
- * mini-gmp/mini-gmp.c (mpz_abs_add): Don't cache limb pointers
- over MPZ_REALLOC, since that breaks in-place operation. Bug
- spotted by Torbjörn.
- (mpz_and, mpz_ior, mpz_xor): Likewise.
- (mpz_cmp): Fixed comparison of negative numbers.
-
-2012-02-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fastsse/lshiftc.asm: New file.
- * mpn/x86_64/fastsse/com.asm: New file.
-
- * mpn/x86_64/bd1/popcount.asm: New file.
- * mpn/x86_64/bd1/hamdist.asm: New file.
-
- * mpn/x86_64/fastsse/copyi.asm: New file.
- * mpn/x86_64/fastsse/copyd.asm: New file.
- * mpn/x86_64/fastsse/lshift.asm: New file.
-
-2012-02-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/coreisbr/addmul_2.asm: New file.
-
- * tests/devel/try.c (param_init): Don't require addmul_N to handle
- overlap.
-
- * mpn/x86_64/bd1/mul_1.asm: New file.
- * mpn/x86_64/bd1/aorsmul_1.asm: New file.
-
-2012-02-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/2fac_ui.c: New file: implements n!!.
- * Makefile.am (MPZ_OBJECTS): Add mpz/2fac_ui.
- * gmp-h.in: Declare mpz_2fac_ui.
- * tests/mpz/t-fac.c: Test mpz_2fac_ui.
- * doc/gmp.texi: Document mpz_2fac_ui.
- * mpz/Makefile.am (libmpz_la_SOURCES): Add 2fac_ui.c.
-
- * mpz/oddfac_1.c (mpz_oddfac_1): Use umul_ppmm when size = 2.
-
-2012-02-26 Niels Möller <nisse@lysator.liu.se>
-
- * mini-gmp: New subdirectory. For use by GMP bootstrap, and as a
- fallback for applications needing bignums but not high
- performance.
-
- * bootstrap.c: New file, replacing dumbmp.c. Uses mini-gmp for the
- standard GMP functions, and then defines the few functions
- particular for the bootstrap.
- * dumbmp.c: Deleted file. A few functions moved to bootstrap.c.
-
- * gen-bases.c: Include bootstrap.c, not dumbmp.c.
- * gen-fac_ui.c: Likewise.
- * gen-trialdivtab.c: Likewise.
- * gen-fib.c: Include bootstrap.c, not dumbmp.c. Use assert rather
- than ASSERT. Deleted casts of xmalloc return value.
- * gen-psqr.c: Likewise.
- (COLLAPSE_ELEMENT): Use memmove rather than mem_copyi.
-
- * Makefile.am: Replaced all uses of dumbmp.c by bootstrap.c.
- (EXTRA_DIST, dist-hook): Arrange for distribution of the mini-gmp
- files.
-
-2012-02-24 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/invert.c: Use ABSIZ, MPZ_EQUAL_1_P.
- * mpz/abs.c: Collapse MPZ_REALLOC(x,.) and PTR(x).
- * mpz/aors_ui.h: Likewise.
- * mpz/com.c: Likewise.
- * mpz/neg.c: Likewise.
-
- * mpz/invert.c: Reply "no-inverse" when modulus is zero.
- * tests/mpz/t-invert.c: Add more checks.
- * doc/gmp.texi (mpz_invert): Inverse can not be zero.
-
-2012-02-24 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/logic.c: New file.
- * tests/mpn/Makefile.am (check_PROGRAMS): Add logic.
-
- * tests/mpz/t-invert.c: New file.
- * tests/mpz/Makefile.am (check_PROGRAMS): Add t-invert.
-
-2012-02-24 Marc Glisse <marc.glisse@inria.fr>
-
- * tests/mpq/t-cmp.c: Move NUM and DEN macros...
- * tests/mpq/t-cmp_ui.c: Likewise...
- * gmp-impl.h: ... to here.
-
- * mpq/abs.c: Use NUM, DEN, SIZ, ALLOC, PTR, MPZ_REALLOC.
- * mpq/aors.c: Likewise.
- * mpq/canonicalize.c: Likewise.
- * mpq/clear.c: Likewise.
- * mpq/cmp.c: Likewise.
- * mpq/cmp_si.c: Likewise.
- * mpq/cmp_ui.c: Likewise.
- * mpq/div.c: Likewise.
- * mpq/equal.c: Likewise.
- * mpq/get_d.c: Likewise.
- * mpq/get_den.c: Likewise.
- * mpq/get_num.c: Likewise.
- * mpq/get_str.c: Likewise.
- * mpq/init.c: Likewise.
- * mpq/inp_str.c: Likewise.
- * mpq/inv.c: Likewise.
- * mpq/md_2exp.c: Likewise.
- * mpq/mul.c: Likewise.
- * mpq/neg.c: Likewise.
- * mpq/set.c: Likewise.
- * mpq/set_d.c: Likewise.
- * mpq/set_den.c: Likewise.
- * mpq/set_f.c: Likewise.
- * mpq/set_num.c: Likewise.
- * mpq/set_si.c: Likewise.
- * mpq/set_str.c: Likewise.
- * mpq/set_ui.c: Likewise.
- * mpq/set_z.c: Likewise.
- * mpq/swap.c: Likewise.
-
- * tests/mpq/t-inv.c: New test file.
- * tests/mpq/Makefile.am: Add the above.
-
- * gmpxx.h (__gmp_set_expr): Use mpq_set_z.
-
- * mpq/md_2exp.c: Collapse MPZ_REALLOC(x,.) and PTR(x).
- * mpq/set_d.c: Likewise.
- * mpq/set_f.c: Likewise.
-
-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.
-
-2012-02-23 Marc Glisse <marc.glisse@inria.fr>
-
- * mpz/abs.c: Use ALLOC, SIZ, ABSIZ, PTR, MPZ_REALLOC.
- * mpz/aors_ui.h: Likewise.
- * mpz/array_init.c: Likewise.
- * mpz/cdiv_q.c: Likewise.
- * mpz/cdiv_qr.c: Likewise.
- * mpz/cdiv_r.c: Likewise.
- * mpz/clear.c: Likewise.
- * mpz/clrbit.c: Likewise.
- * mpz/cmp_si.c: Likewise.
- * mpz/com.c: Likewise.
- * mpz/fdiv_q.c: Likewise.
- * mpz/fdiv_qr.c: Likewise.
- * mpz/fdiv_r.c: Likewise.
- * mpz/get_si.c: Likewise.
- * mpz/get_str.c: Likewise.
- * mpz/init.c: Likewise.
- * mpz/inp_str.c: Likewise.
- * mpz/iset.c: Likewise.
- * mpz/iset_d.c: Likewise.
- * mpz/iset_si.c: Likewise.
- * mpz/iset_str.c: Likewise.
- * mpz/iset_ui.c: Likewise.
- * mpz/mod.c: Likewise.
- * mpz/neg.c: Likewise.
- * mpz/out_str.c: Likewise.
- * mpz/random2.c: Likewise.
- * mpz/set_si.c: Likewise.
- * mpz/set_str.c: Likewise.
- * mpz/set_ui.c: Likewise.
- * mpz/setbit.c: Likewise.
- * mpz/sqrt.c: Likewise.
- * mpz/swap.c: Likewise.
- * mpz/tdiv_r_2exp.c: Likewise.
-
- * tests/cxx/t-ops.cc: Test mpz_abs reallocation.
-
-2012-02-23 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/core2/rsh1aors_n.asm: Complete rewrite.
- * mpn/x86_64/coreisbr/rsh1aors_n.asm: Move old core2 code here.
-
- * mpn/x86_64/redc_1.asm: Make it work for DOS64 (broken in last edit).
-
-2012-02-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_interpolate_8pts.c: Compute carry iif non-trivial.
-
- * mpz/gcdext.c: Adapt to relaxed mpn_gcdext's input requirements.
-
- * mpz/and.c: Use mpn_ logic everywhere. Reduce branches.
- * mpz/ior.c: Likewise.
- * mpz/xor.c: Likewise.
-
-2012-02-20 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/coreisbr/mul_1.asm: New file.
-
- * mpn/x86_64/coreisbr/aorsmul_1.asm: New file.
-
- * mpn/x86_64/mod_34lsub1.asm: Avoid ",pt" branch hint since many
- assemblers don't support it.
-
-2012-02-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/redc_1.c: Put back mpn_add_n call, return its carry.
- Reintroduce previously removed RP argument.
- * mpn/x86_64/redc_1.asm: Likewise.
-
- * mpn/generic/redc_2.c: Remove mpn_sub_n call, return carry from
- mpn_add_n call.
-
- * gmp-impl.h (mpn_redc_1, mpn_redc_2): Now return an mp_limb_t.
-
- * tune/speed.h (SPEED_ROUTINE_REDC_1): Adopt to pass RP argument.
-
- * tests/refmpn.c (refmpn_redc_1): Adopt to new redc_1 interface.
-
- * mpn/generic/powm.c (MPN_REDC_1): Pass rp parameter to mpn_redc_1.
- * mpn/generic/powm_sec.c (MPN_REDC_1_SEC): Likewise.
- * mpn/generic/powm.c (MPN_REDC_2): New macro, use for mpn_redc_2.
-
-2012-02-18 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (std::common_type): New partial specialization in C++11.
- * tests/cxx/t-cxx11.cc: Test it.
-
- * gmpxx.h: Don't declare long double functions that are never defined.
-
- * gmpxx.h (__gmp_binary_expr): Let things happen in place: q=q*q+z*z
- becomes tmp=z*z, q=q*q, q+=tmp.
- * tests/cxx/t-binary.cc: More variable reuse tests.
-
-2012-02-17 Marc Glisse <marc.glisse@inria.fr>
-
- * gmp-h.in (__GMP_WITHIN_GMP): Test with #ifdef instead of #if, for
- the benefit of applications using gcc -Wundef.
- (__GMP_WITHIN_GMPXX): Likewise.
-
-2012-02-16 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__gmp_binary_expr): Let things happen in place: e=a*b-c*d
- 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>
-
- * tune/tuneup.c (mul_toom43_to_toom54_threshold): New global.
- (tune_mul): Added tuning of MUL_TOOM43_TO_TOOM54_THRESHOLD.
- * tune/speed.h (SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM54_MUL): New macro.
- (SPEED_ROUTINE_MPN_TOOM54_FOR_TOOM43_MUL): New macro.
- Prototypes for corresponding functions.
- * tune/common.c (speed_mpn_toom43_for_toom54_mul): New function.
- (speed_mpn_toom54_for_toom43_mul): New function.
-
- * gmp-impl.h (MPN_TOOM43_MUL_MINSIZE): Corrected constant.
- (MPN_TOOM53_MUL_MINSIZE): Likewise.
- (MPN_TOOM54_MUL_MINSIZE): New constant.
- (mpn_toom54_mul): Added prototype.
- (MUL_TOOM43_TO_TOOM54_THRESHOLD): New threshold. Default value and
- tuning setup.
-
-2012-02-14 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/toom54_mul.c: New file, originally contributed by
- Marco.
- * gmp-impl.h (mpn_toom54_mul_itch): New function.
- * configure.in (gmp_mpn_functions): Added toom54_mul.
- * 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>
-
- * configure.in: Display summary of options.
-
-2012-02-11 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/tests.h (TESTS_REPS): Print any non-standard repetitions.
-
-2012-02-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * doc/gmp.texi (Factorial): Shortly describe current algorithm.
- (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>
-
- * tests/mpz/t-gcd.c (gcdext_valid_p): Enforce slightly stricter
- bound for cofactors.
-
- * mpn/generic/gcdext_lehmer.c (mpn_gcdext_hook): Corrected
- handling of unlikely (maybe impossible?) case u1n < un. Related to
- the 2012-02-05 bugfix of gcdext_subdiv_step.c in the gmp-5.0 repo.
-
-2012-02-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h (mpn_toom3*_itch): Support any recursion depth.
- * tests/refmpn.c (refmpn_mul): Restore tight allocations.
-
- * mpz/oddfac_1.c (mpz_oddfac_1): Get ready for n!!
- * gmp-impl.h (mpz_oddfac_1): Update signature.
- * mpz/fac_ui.c (mpz_fac_ui): Update call to mpz_oddfac_1.
-
-2012-02-09 Marc Glisse <marc.glisse@inria.fr>
-
- * gmp-impl.h (ABS_CAST): New macro.
- * mpf/cmp_si.c: Use ABS_CAST.
- * mpf/get_si.c: Use ABS_CAST.
- * mpf/iset_si.c: Use ABS_CAST.
- * mpf/set_si.c: Use ABS_CAST.
- * mpq/set_si.c: Use ABS_CAST.
- * mpz/cmp_si.c: Use ABS_CAST.
- * mpz/get_si.c: Use ABS_CAST.
- * mpz/iset_si.c: Use ABS_CAST.
- * mpz/mul_i.h: Use ABS_CAST.
- * mpz/set_si.c: Use ABS_CAST.
-
-2012-02-08 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc32/divrem_2.asm: Fix off-by-one condition in invert_limb
- code.
-
-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>
-
- * 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>
-
- * mpn/generic/hgcd_matrix.c (hgcd_matrix_update_q): Fixed carry
- handling bug. Fix copied from gmp-5.0 repo, where the function is
- found in hgcd.c.
-
- * tests/mpz/t-gcd.c (main): Use mpz_rrandomb for test operands,
- not mpz_urandomb. Change copied from gmp-5.0 repo.
- * tests/mpn/t-hgcd.c (main): Likewise.
-
-2012-02-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/refmpn.c (refmpn_mul): More conservative allocations.
-
-2012-02-03 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/bd1/gmp-mparam.h: New file.
-
- * longlong.h (udiv_qrnnd from sdiv_qrnnd): Declare udiv_w_sdiv.
-
- * mpn/generic/udiv_w_sdiv.c: Use c89 function header.
-
-2012-02-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/fac_ui.c: mpz_oddfac_1 removed, with many related functions.
- * mpz/oddfac_1.c: New file, mpz_oddfac_1 implementation.
- * gmp-impl.h: mpz_oddfac_1 declaration.
- * Makefile.am (MPZ_OBJECTS): add mpz/oddfac_1$U.lo .
- * mpz/Makefile.am (libmpz_la_SOURCES): add oddfac_1.c .
- * tune/Makefile.am (fac_ui.c): include mpz/oddfac_1.c .
-
-2012-02-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_interpolate_16pts.c: Correct an unlikely 32-bit bug.
-
-2012-02-02 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom63_mul.c: Allow s+t==n by adjusting an ASSERT.
- * mpn/generic/toom_interpolate_8pts.c: Perform final incr iff s+t!=n.
-
- * tests/mpn/t-toom6h.c (MIN_BN): Make more consistent with ASSERT in
- tested function.
-
-2012-02-01 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/t-mul.c: New file.
- * tests/mpn/Makefile.am: Compile it.
-
-2012-02-01 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h: Remove check for g++ older than 2.91.
-
-2012-02-01 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/mul.c: Added diagram on where toom functions can be
- called.
-
-2012-02-01 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__gmp_unary_expr): Make the constructor explicit.
- (__gmp_expr(__gmp_expr&&)): New move constructors.
- (__gmp_expr::operator=(__gmp_expr&&)): New move assignments.
- (swap): Mark as noexcept.
- (__GMPXX_USE_CXX11): New macro.
- (__GMPXX_NOEXCEPT): New macro.
- * tests/cxx/t-cxx11.cc: New file.
- * tests/cxx/Makefile.am: Added t-cxx11.
-
-2012-01-31 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm_sec.c (SQR_BASECASE_LIM): New name for
- SQR_BASECASE_MAX.
- (SQR_BASECASE_LIM, fat variant): Define to read __gmpn_cpuvec.
- (SQR_BASECASE_LIM, native variant): Define to SQR_TOOM2_THRESHOLD
- straight, without arithmetic.
- (mpn_local_sqr): Use BELOW_THRESHOLD as per Marco's suggestion.
-
-2012-01-30 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-powm.c: Ensure all sizes are seen.
-
-2012-01-30 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__gmp_binary_expr): Let things happen in place: d=a+b+c
- when d != c.
- * tests/cxx/t-binary.cc: Test variable reuse: c=a+b+c.
-
-2012-01-28 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h: Don't compute -LONG_MIN.
-
- * doc/gmp.texi (gmp_randclass::get_z_bits): Use mp_bitcnt_t.
- * gmpxx.h: Replace unsigned long with mp_bitcnt_t.
-
-2012-01-27 Torbjorn Granlund <tege@gmplib.org>
-
- * Upgrade to libtool 2.4.2.
-
-2012-01-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpz/t-fac_ui.c: Increase default test cases.
-
- * mpz/prodlimbs.c: New file, mpz_prodlimbs implementation.
- * gmp-impl.h: mpz_prodlimbs declaration.
- * Makefile.am (MPZ_OBJECTS): add mpz/prodlimbs$U.lo .
- * mpz/Makefile.am (libmpz_la_SOURCES): add prodlimbs.c .
- (fac_ui.h): remove target (moved up one directory).
- * mpz/fac_ui.c: mpz_prodlimbs removed, micro-optimisations.
-
-2012-01-25 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c: Remove unused tuneup variables.
-
-2012-01-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/fac_ui.c: Reduce branches in basecases.
-
-2012-01-18 Marc Glisse <marc.glisse@inria.fr>
-
- * doc/gmp.texi (mpf_class::mpf_class): Use mp_bitcnt_t.
-
-2012-01-17 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Add ultrasparc T4 support.
-
- * demos/isprime.c (main): Run 25 millerrabin tests.
-
-2012-01-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/fac_ui.c (SIEVE_SEED): Define value for small limb size.
- (mpz_oddswing_1): Reduce the number of divisions.
- (mpz_oddfac_1): Reduce memory usage.
- * 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>
-
- * mpz/scan0.c (mpz_scan0): Use ~(mp_bitcnt_t) 0, rather than
- ULONG_MAX, when returning "infinity".
- * mpz/scan1.c (mpz_scan1): Likewise.
-
-2012-01-12 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/t-popc.c: Test longer bit strings.
-
-2012-01-12 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/divexact.c: Tight realloc, delayed if variables are reused.
- * mpz/lcm.c: Smaller temp space, avoid goto.
- * gmp-impl.h (popc_limb): avoid double & (for 8-bits limb).
-
-2012-01-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/minithres/gmp-mparam.h: New FAC_ODD_ and FAC_DSC_ thresholds.
- * tune/tuneup.c (tune_fac_ui): Correct minimum for FAC_DSC_.
-
-2012-01-07 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/mul_2exp.c: Rewrite.
- * mpz/tdiv_q_2exp.c: Rewrite.
-
-2012-01-05 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gen-fac_ui.c: Remove currently unused constants; add new odd
- double factorial table.
- * mpz/fac_ui.c (RECURSIVE_PROD_THRESHOLD): Increase default.
- (mpz_oddfac_1): New function: a merge of _bc_odd and _dsc_odd.
- (mpz_prodlimbs): More in-place computations.
-
- * tune/tuneup.c (tune_fac_ui): min_is_always for FAC_ODD_.
-
-2012-01-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tune/tuneup.c (tune_fac_ui): Compute FAC_DSC before FAC_ODD.
-
-2011-12-31 Torbjorn Granlund <tege@gmplib.org>
-
- * Makefile.am (fac_ui.h): Put file in top-level dir, not in mpz.
-
-2011-12-31 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tune/Makefile.am (fac_ui.c): New target.
- (nodist_tuneup_SOURCES,CLEANFILES): Add fac_ui.c.
- * tune/tuneup.c (mpz_fac_ui_tune): Declare prototype.
- (fac_odd_threshold,fac_dsc_threshold): New global variables.
- (speed_mpz_fac_ui_tune,tune_fac_ui): New functions.
- (all): Call tune_fac_ui.
- * gmp-impl.h (FAC_ODD_THRESHOLD,FAC_DSC_THRESHOLD):
- New thresholds: default values, and setup for tuning.
- (FAC_DSC_THRESHOLD_LIMIT): Define (when tuning).
- * mpz/fac_ui.c (FAC_ODD_THRESHOLD,FAC_DSC_THRESHOLD):
- Default values removed.
-
-2011-12-30 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/hamdist.c: Fix typo in a return statement.
-
- * mpn/generic/powm_sec.c (SQR_BASECASE_MAX): Set safely from
- SQR_TOOM2_THRESHOLD.
-
-2011-12-17 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-perfpow.c: Decrease default # of tests.
-
-2011-12-16 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/refmpn.c (AORS_1): Fix typo in variable type.
-
-2011-12-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/sbpi1_bdiv_q.c: Delay quotient limb stores in order to
- allow quotient and dividend to completely overlap.
- * mpn/generic/sbpi1_bdiv_qr.c: Likewise.
-
-2011-12-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/fac_ui.c: fac_bc_ui inlined in fac_ui.
-
-2011-12-08 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm_sec.c: Handle fat binaries better.
-
- * mpz/fac_ui.c (mpz_bc_fac_1): Fix typo in allocation size.
-
- * mpn/x86/fat/com.c: New file.
-
- * mpn/x86_64/pentium4/aors_n.asm: Make it actually work for DOS64.
- * mpn/x86_64/pentium4/rsh1aors_n.asm: Conditionalise jump on DOS64
- to avoid overhead for standard ABIs.
-
- * mpn/x86_64/gcd_1.asm: Support DOS64.
-
-2011-12-07 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Fix typo making HAVE_NATIVE_mpn_X fail for fat
- functions.
-
- * mpn/x86_64/fat/fat.c (__gmpn_cpuvec_init): Add a missing break.
-
-2011-12-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gen-fac_ui.c: Generate two more tables: odd factorial, swing.
-
- * mpz/fac_ui.c: Rewrite.
-
-2011-12-06 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/hgcd.c (mpn_hgcd): Use hgcd_reduce for first
- recursive call.
-
-2011-12-06 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/mod_1_1-1.c: Redefine the mpn_ functions, not __gmpn_ (for the
- benefit of fat builds).
- * tune/mod_1_1-2.c: Likewise.
-
-2011-12-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/fat/lshiftc.c: New file.
- * mpn/x86/fat/mod_1_1.c: New file.
- * mpn/x86/fat/mod_1_2.c: New file.
- * mpn/x86/fat/mod_1_4.c: New file.
-
- * mpn/x86/fat/diveby3.c: Remove no longer fat function.
- * mpn/x86_64/fat/diveby3.c: Likewise.
-
- * mpn/x86_64/fat/gcd_1.c: Remove since always provided as asm.
- * mpn/x86_64/fat/mode1o.c: Likewise.
-
- * configure.in (fat_functions): Update to more relevant function set.
- Add special handling for mod_1_N_cps functions.
- * gmp-impl.h (struct cpuvec_t) : Corresponding changes. Also add
- vrious declarations for new functions.
- * mpn/x86/x86-defs.m4 (CPUVEC_FUNCS_LIST): Corresponding changes.
- * mpn/x86_64/x86_64-defs.m4 (CPUVEC_FUNCS_LIST): Corresponding changes.
- * mpn/x86/fat/fat.c (__gmpn_cpuvec): Corresponding changes.
- * mpn/x86_64/fat/fat.c (__gmpn_cpuvec): Corresponding changes.
-
- * mpn/x86_64: Port most remaining x86_64 files to DOS64.
-
- * mpn/x86_64/coreisbr/aors_n.asm: Add forgotten DOS64_EXIT.
-
- * mpn/x86_64/x86_64-defs.m4 (LEA): Handle non-PIC code.
- * mpn/x86_64/darwin.m4 (LEA): Likewise.
-
-2011-12-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fat/fat.c (MAKE_FMS): Rewrite to handle modern CPUs.
- * mpn/x86/fat/fat.c (MAKE_FMS): Likewise.
-
- * mpn/x86_64/darwin.m4 (PROTECT): Define to potentially useful value.
-
-2011-12-02 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/invert_limb_table.asm: Use PROTECT.
- * mpn/x86_64/invert_limb.asm: Likewise.
-
- * mpn/x86_64/darwin.m4 (PROTECT, IFELF): New defines.
- * mpn/x86_64/dos64.m4 (PROTECT, IFELF): New defines.
- * mpn/x86_64/x86_64-defs.m4 (PROTECT, IFELF): New defines.
-
-2011-12-01 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fat/fat.c: Copy fake cpuid code from x86/fat/fat.c.
-
- * mpn/x86_64 (STD64, IFSTD): New names for ELF64, IFELF (since these
- denote all standard calling conventions).
-
- * mpn/x86_64: Add DOS64 ABI support to more files.
-
- * mpn/x86_64/mod_1_1.asm: Finish DOS64 support.
- * mpn/x86_64/mod_1_2.asm: Likewise.
- * mpn/x86_64/mod_1_4.asm: Likewise.
-
- * configure.in: Add GMP_NONSTD_ABI also for fat builds.
-
- * mpn/x86_64/fat/fat_entry.asm: Rewrite to support DOS64.
-
- * mpn/x86_64/dos64.m4 (IFDOS, IFSTD): New defines.
- * mpn/x86_64/x86_64-defs (IFDOS, IFSTD): New defines.
-
- * mpn/x86_64/dive_1.asm: Add DOS64 ABI support.
- * mpn/x86_64/mode1o.asm: Likewise.
-
- * mpn/x86_64/mod_34lsub1.asm: Enable for DOS64.
-
- * mpn/x86_64/invert_limb.asm: Wrap .protected decl.
-
- * gmp-impl.h (DECL_divexact_1): Fix typo in return type.
-
- * mpn/x86_64/dos64.m4 (LEA): New define.
- (PIC): Define.
-
-2011-11-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64: Add DOS64 ABI support to most files.
-
-2011-11-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mul_basecase.asm: Support ABI DOS64.
- * mpn/x86_64/sqr_basecase.asm: Support ABI DOS64.
- * mpn/x86_64/aorsmul_1.asm: Support ABI DOS64.
- * mpn/x86_64/mul_1.asm: Support ABI DOS64.
-
- * mpn/x86_64/x86_64-defs.m4 (DOS64_ENTRY, DOS64_EXIT): New, empty defs.
-
- * mpn/x86_64/dos64.m4: New file.
-
- * mpn/asm-defs.m4 (ABI_SUPPORT): New dummy macro.
-
- * configure.in (64-bit mingw/cygwin): Define HOST_DOS64,GMP_NONSTD_ABI.
- No longer clear out path_64.
- (mpn code selection loop): Handle GMP_NONSTD_ABI.
-
- * mpn/generic/udiv_w_sdiv.c: Use CNST_LIMB for some constants.
-
-2011-11-25 Torbjorn Granlund <tege@gmplib.org>
-
- * x86/*: Many new gmp-mparam.h file for 64-bit CPUs in 32-bit mode.
-
- * configure.in: Overhaul x86/x86_64 support, merging three case
- statements into one.
-
-2011-11-24 Torbjorn Granlund <tege@gmplib.org>
-
- * doc/gmp.texi (Formatted Output Strings): Clarify rules for mpf_t
- precision.
-
- * mpn/powerpc32/p7/gmp-mparam.h: New file.
-
- * tune/tuneup.c (tune_mu_div, tune_mu_bdiv): Up min_size to karatsuba's
- threshold.
-
-2011-11-22 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/p6/aorsmul_1.asm: New file.
-
- * configure.in: Don't fail fat builds under 64-bit DOS.
-
- * mpn/powerpc64/mode64/aors_n.asm: Align loop for slightly better
- power5 performance.
-
-2011-11-21 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-h.in (__GNU_MP_RELEASE): Renamed from typo name.
-
-2011-11-20 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Split x86 CPUs into more subtypes for more accurate
- passing of gcc flags.
-
- * mpn/powerpc32/p3-p7/aors_n.asm: New file.
-
- * configure.in: Pass -m32 for powerpc64 with abi=32, using via _maybe
- mechanism.
-
- * configure.in: Support powerpc32/p3-p7 directory for affected CPUs.
-
-2011-11-17 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.c (routine): Add mpn_tabselect.
- * tune/common.c (speed_mpn_tabselect): New function.
- * tune/speed.h (SPEED_ROUTINE_MPN_COPY_CALL): New macro, made from
- old SPEED_ROUTINE_MPN_COPY.
- (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>
-
- * tune/tuneup.c (tune_hgcd_appr): Increase stop_since_change.
-
-2011-11-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc32/tabselect.asm: New file.
-
- * mpn/powerpc64/mode64/aorscnd_n.asm: New file.
-
-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_hgcd_appr_lehmer): Likewise.
- (mpn_hgcd_appr_lehmer_itch): Likewise.
- (MPN_HGCD_LEHMER_ITCH): Deleted macro.
-
- * tune/speed.c (routine): Added mpn_hgcd_appr_lehmer.
-
- * tune/common.c (speed_mpn_hgcd_lehmer): Use mpn_hgcd_lehmer_itch
- rather than similarly named macro.
- (speed_mpn_hgcd_appr_lehmer): New function.
-
- * tune/Makefile.am (libspeed_la_SOURCES): Added
- hgcd_appr_lehmer.c.
-
- * tune/hgcd_appr_lehmer.c: New file.
-
- * tune/tuneup.c (tune_hgcd_appr): Increased min_size to 50; some
- machines got small thresholds which appear to be bogus.
-
-2011-11-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm_sec.c (mpn_local_sqr): Remove forgotten TMP_* calls.
- (redcify): Likewise.
- (mpn_powm_sec): Likewise.
-
- * mpn/generic/powm_sec.c (mpn_powm_sec): Rework scratch usage
- (mpn_powm_sec_itch): Rewrite.
-
- * mpn/generic/powm_sec.c (mpn_powm_sec): Use mpn_tabselect also in
- initialisation.
-
- * configure.in: Amend 2011-11-03 gcc_cflags change.
-
- * mpn/powerpc64/tabselect.asm: New file.
- * mpn/x86_64/tabselect.asm: New file.
- * mpn/x86/tabselect.asm: New file.
- * mpn/ia64/tabselect.asm: New file.
-
- * mpn/asm-defs.m4 (define_mpn): Add tabselect.
-
- * configure.in (gmp_mpn_functions): Add tabselect.
- (HAVE_NATIVE): Add entries for addncd_n, subcnd_n, tabselect.
-
- * mpn/generic/powm_sec.c: Remove mpn_tabselect implementation.
- * mpn/generic/tabselect.c: New file with removed code.
-
-2011-11-13 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add powm_sec.c.
-
- * mpn/generic/powm_sec.c (win_size): Use POWM_SEC_TABLE
- (POWM_SEC_TABLE): Define default.
-
- * tune/tuneup.c (tune_powm_sec): New function computing POWM_SEC_TABLE.
- (all): Call new function.
-
- * 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>
-
- * tune/tuneup.c (tune_hgcd_appr): Use default min_size.
- (tune_hgcd_reduce): Increase max_size and step_factor, to 7000
- and 0.04, respectively.
-
-2011-11-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/sqr_diag_addlsh1.asm: Remove.
-
-2011-11-11 Niels Möller <nisse@lysator.liu.se>
-
- * tune/hgcd_reduce_2.c: New file.
- * tune/hgcd_reduce_1.c: New file.
-
- * tune/tuneup.c (hgcd_appr_threshold): New threshold variable.
- (hgcd_reduce_threshold): Likewise.
- (tune_hgcd_appr): New function.
- (tune_hgcd_reduce): New function.
- (all): Call tune_hgcd_appr and tune_hgcd_reduce.
-
- * tune/speed.h (speed_mpn_hgcd_reduce): Declaration.
- (speed_mpn_hgcd_reduce_[12]): Likewise.
- (mpn_hgcd_reduce_[12]): Likewise.
- (SPEED_ROUTINE_MPN_HGCD_REDUCE_CALL): New macro.
-
- * tune/speed.c (routine): Added mpn_hgcd_reduce,
- mpn_hgcd_reduce_1, and mpn_hgcd_reduce_2.
-
- * tune/common.c (speed_mpn_hgcd_reduce): New function.
- (speed_mpn_hgcd_reduce_[12]): Likewise.
-
- * tune/Makefile.am (libspeed_la_SOURCES): Added hgcd_reduce_1.c
- hgcd_reduce_2.c.
- (TUNE_MPN_SRCS_BASIC): Added hgcd_appr.c and hgcd_reduce.c.
-
- * mpn/generic/hgcd_appr.c (submul, hgcd_matrix_apply): Deleted
- functions, earlier copied to hgcd_reduce.c.
- (mpn_hgcd_appr): Use hgcd_reduce.
-
-2011-11-09 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/sqr_basecase.asm: New file.
-
- * mpn/x86_64/aorscnd_n.asm: New file.
-
- * tune/speed.c (routine): Add measuring of mpn_addcnd_n, mpn_subcnd_n.
- * tune/common.c (speed_mpn_addcnd_n,speed_mpn_subcnd_n): New functions.
- * tune/speed.h: Declare them.
-
- * tests/devel/try.c: Add tests for mpn_addcnd_n and mpn_subcnd_n.
- * tests/refmpn.c (refmpn_addcnd_n, refmpn_subcnd_n): New functions.
- * tests/tests.h: Declare them.
-
- * configure.in (gmp_mpn_functions): Add addcnd_n and subcnd_n.
-
-2011-11-07 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/redc_1.c: Just reduce U operand using Hensel norm, but
- not fully canonically; leave add_n and conditional sub_n to caller.
- Therefore omit R argument.
-
- * mpn/generic/redc_1_sec.c: Remove.
-
- * gmp-impl.h (mpn_redc_1): Update declaration.
- (mpn_redc_1_sec): Remove declaration.
-
- * configure.in (gmp_mpn_functions): Remove redc_1.
-
- * mpn/x86_64/redc_1.asm: Adopt to new defined functionality/interface.
- * tune/speed.h (SPEED_ROUTINE_REDC_1): Likewise.
-
- * tests/refmpn.c (refmpn_redc_1): Likewise; also call refmpn_addmul_1
- instead of mpn_addmul_1.
-
- * mpn/generic/powm.c (MPN_REDC_1): New macro, use for mpn_redc_1.
- * mpn/generic/powm_sec.c (MPN_REDC_1_SEC): New macro, use for
- mpn_redc_1_sec.
-
-2011-11-03 Torbjorn Granlund <tege@gmplib.org>
-
- * dumbmp.c (mpz_sub): Abort for non-handled case.
-
- * mpn/powerpc64/mode64/lshiftc.asm: Move file from here...
- * mpn/powerpc64/lshiftc.asm: ...to here, with trivial modifications.
-
- * configure.in: Pass -m32 in more cases, using _maybe mechanism.
- Inherit default gcc_cflags in more places.
-
- * mpn/powerpc64/mode64/p7/gmp-mparam.h: New file.
-
-2011-11-02 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/invert_limb.asm: Slight optimisation.
-
- * configure.in (s390): Set gcc_32_cflags_maybe.
-
- * mpn/s390_32/gmp-mparam.h: Put in proper data.
- * mpn/s390_32/esame/gmp-mparam.h: New file.
-
- * mpn/x86_64/bobcat/gmp-mparam.h: New file.
-
- * mpn/s390_32/lshift.asm: New file.
- * mpn/s390_32/rshift.asm: New file.
- * mpn/s390_32/lshiftc.asm: New file.
-
-2011-10-31 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/sqr_diagonal.asm: Move from here...
- * mpn/powerpc64/mode32/sqr_diagonal.asm: ...to here.
-
- * mpn/powerpc64/mode64/sqr_diag_addlsh1.asm: New file.
-
- * mpn/s390_64/sqr_basecase.asm: Rewrite sqr_diag_addlsh1 code.
- * mpn/s390_32/esame/sqr_basecase.asm: Likewise.
-
-2011-10-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/lshift.asm: Complete rewrite.
- * mpn/s390_64/rshift.asm: Likewise.
-
- * mpn/s390_64/lshiftc.asm: New file.
-
-2011-10-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_32/esame/aors_n.asm: New file, with rewritten add/sub code.
-
-2011-10-27 Torbjorn Granlund <tege@gmplib.org>
-
- From Per Olofsson:
- * gmp-impl.h (BSWAP_LIMB): Rename variable to avoid BSWAP_LIMB_FETCH
- clash.
-
- * mpn/s390_32/esame/mul_basecase.asm: New file.
-
- * mpn/s390_32/esame/sqr_basecase.asm: New file.
-
- * mpn/s390_32/logops_n.asm: 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>
-
- * gmp-impl.h (mpn_hgcd_reduce, mpn_hgcd_reduce_itch): Added
- prototypes.
- (HGCD_APPR_THRESHOLD): Set up threshold for tuning.
- (HGCD_REDUCE_THRESHOLD): Likewise.
-
- * configure.in (gmp_mpn_functions): Added hgcd_reduce.
-
- * mpn/generic/hgcd_reduce.c: New file.
-
-2011-10-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/sqr_basecase.asm: Put intermediate result into R, don't
- allocate any stack space.
-
-2011-10-23 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/logops_n.asm: Use nc, oc, xc when possible.
-
- * tune/common.c (speed_mpn_and_n, speed_mpn_andn_n, etc):
- Pass correct input args.
-
- * mpn/s390_64/mod_34lsub1.asm: Use llgfr for zero extensions.
-
- * mpn/s390_64/mul_basecase.asm: New file.
-
- * mpn/s390_64/sqr_basecase.asm: New file.
- * mpn/s390_64/sqr_diag_addlsh1.asm: Removed, lives on in sqr_basecase.
-
- * mpn/s390_64/bdiv_dbm1c.asm: Shave off 1 c/l.
-
- * mpn/s390_64/aorrlsh1_n.asm: New file, developed from aorslsh1_n.asm.
- * mpn/s390_64/sublsh1_n.asm: New file.
- * mpn/s390_64/aorslsh1_n.asm: Remove file.
-
-2011-10-22 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/logops_n.asm: New file.
-
- * mpn/s390_64/aors_n.asm: New file, with rewritten add/sub code.
-
-2011-10-20 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.h (SPEED_ROUTINE_MPN_SQR_DIAL_ADDLSH1_CALL): New macro.
- * tune/common.c (speed_mpn_sqr_diag_addlsh1): New function.
- * tune/speed.c (routine): Measure mpn_sqr_diag_addlsh1.
-
- * mpn/s390_64/sqr_diag_addlsh1.asm: Rewrite like s390_32/esame code.
-
- * mpn/s390_32/esame/sqr_diag_addlsh1.asm: Save just needed registers.
-
-2011-10-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_32/esame/add_n.asm: Rewrite, similar to s390_64 code.
- * mpn/s390_32/esame/add_n.asm: Likewise.
-
-2011-10-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_32/esame/aorslsh1_n.asm: New file.
-
-2011-10-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_32/esame/sqr_diag_addlsh1.asm: New file.
-
- * mpn/s390_32/copyi.asm: New file.
- * mpn/s390_32/copyd.asm: New file.
-
- * mpn/s390_64/copyd.asm: Optimise.
-
- * mpn/s390_64/copyi.asm: Rewrite along the lines of glibc memcpy.
-
- * mpn/s390_64/aorslsh1_n.asm: New file.
-
- * mpn/s390_64/mod_34lsub1.asm: New file.
-
- * mpn/s390_64/sqr_diag_addlsh1.asm: New file.
-
-2011-10-15 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (s390): Rewrite support to handle known CPUs.
- * config.guess: Recognise s390 CPUs.
- * config.sub: Match s390 CPUs.
- * acinclude.m4 (S390_PATTERN, S390X_PATTERN): New defines.
-
-2011-10-14 Torbjorn Granlund <tege@gmplib.org>
-
- From Per Olofsson:
- * mpn/generic/popham.c: Add __GMP_NOTHROW to make it match gmp.h.
- * mpn/generic/gcd_1.c: Separate declarations and initialisers for the
- benefit of C++.
-
- * configure.in: AC_DEFINE HAVE_HOST_CPU_s390_zarch.
- * longlong.h (s390): Use it.
- (s390 umul_ppmm): Fix typo in pure C variant.
-
-2011-10-13 Torbjorn Granlund <tege@gmplib.org>
-
- * longlong.h (s390): Put back an accidentally deleted #else.
-
- * configure.in (s390): Unset extra_functions for s390x.
-
-2011-10-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/lshift.asm: Reduce register usage.
- * mpn/s390_64/rshift.asm: Likewise.
-
- * longlong.h (s390 umul_ppmm): With new-enough gcc, avoid asm.
-
- From Andreas Krebbel:
- * longlong.h (s390 umul_ppmm): Support 32-bit limbs with gcc using
- 64-bit registers.
- (s390 udiv_qrnnd): Likewise.
-
-2011-10-11 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (s390x): Pass -mzarch to gcc in 32-bit mode.
-
- * longlong.h (s390x): Add __CLOBBER_CC for relevant asm patterns.
- * mpn/generic/mod_1_1.c (s390x add_mssaaaa): Likewise.
-
- * mpn/s390_64/copyd.asm: New file.
-
-2011-10-10 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/hgcd_appr.c: Deleted debugging code.
-
- * tests/mpn/t-hgcd_appr.c (main): Added -v flag.
- (hgcd_appr_valid_p): Increased margin of non-minimality for
- divide-and-conquer algorithm. Display bit counts only if
- -v is used.
-
- * mpn/generic/hgcd_appr.c (submul): New (static) function.
- (hgcd_matrix_apply): New function.
- (mpn_hgcd_appr_itch): Account for divide-and-conquer algorithm.
- (mpn_hgcd_appr): Implemented divide-and-conquer.
-
-2011-10-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_1.c (add_mssaaaa): Add s390x variant. Put arm code
- inside __GNUC__.
-
- * tune/time.c (STCK): Use proper memory constraint.
-
- From Marco Trudel:
- * tests/mpz/t-scan.c (check_ref): Fix loop end bound.
-
-2011-10-10 Niels Möller <nisse@lysator.liu.se>
-
- * gmp-impl.h: (HGCD_APPR_THRESHOLD): New threshold.
-
- * mpn/generic/hgcd_appr.c (mpn_hgcd_appr): Interface change.
- Destroy inputs, let caller make working copies if needed.
- (mpn_hgcd_appr_itch): Reduced scratch need.
- * gmp-impl.h: Updated mpn_hgcd_appr prototype.
- * tests/mpn/t-hgcd_appr.c (one_test): Make working copies for
- hgcd_appr.
- * tune/common.c (speed_mpn_hgcd_appr): Use SPEED_ROUTINE_MPN_HGCD_CALL.
- * tune/speed.h (SPEED_ROUTINE_MPN_HGCD_APPR_CALL): Deleted.
-
-2011-10-09 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/copyi.asm: New file.
- * mpn/s390_64/lshift.asm: New file.
- * mpn/s390_64/rshift.asm: New file.
-
- * mpn/s390_64/add_n.asm: Rewrite using lmg/stmg.
- * mpn/s390_64/sub_n.asm: Likewise.
-
- * mpn/s390_64/invert_limb.asm: Save a callee-saves register less.
-
- * tune/time.c (getrusage_backwards_p): Properly cast printed values.
-
- * longlong.h (s390x): Put back UDItype casts to make gcc reloading use
- right more for constants.
- (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>
-
- * mpn/generic/hgcd_matrix.c (mpn_hgcd_matrix_adjust): Declare
- matrix argument const.
-
-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.
-
- * mpn/generic/hgcd_appr.c (mpn_hgcd_appr): Fixed handling of
- extra_bits, starting at zero, to ensure that we don't produce too
- small remainders. Added a final reduction loop when we we
- otherwise terminate with extra_bits > 0, to make the returned
- remainders closer to minimal.
-
-2011-10-07 Torbjorn Granlund <tege@gmplib.org>
-
- * 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>
-
- * tune/speed.h (speed_mpn_hgcd_appr): New prototype.
- (SPEED_ROUTINE_MPN_HGCD_APPR_CALL): New macro.
- * tune/common.c (speed_mpn_hgcd_appr): New function.
- * tune/speed.c (routine): Added mpn_hgcd_appr.
-
- * tests/mpn/t-hgcd_appr.c: New file.
- * tests/mpn/Makefile.am (check_PROGRAMS): Added t-hgcd_appr.
-
- * configure.in (gmp_mpn_functions): Added hgcd_step and hgcd_appr.
-
- * gmp-impl.h: Added prototypes for mpn_hgcd_step,
- mpn_hgcd_appr_itch and mpn_hgcd_appr.
-
- * mpn/generic/hgcd_appr.c: New file.
-
- * mpn/generic/hgcd_step.c: New file, extracted from hgcd.c.
- (mpn_hgcd_step): Renamed, from...
- * mpn/generic/hgcd.c (hgcd_step): ...old name. Renamed and moved
- to hgcd_step.c.
- (hgcd_hook): Also moved to hgcd_step.c.
- (mpn_hgcd): Updated for hgcd_step renaming.
-
-2011-10-06 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/invert_limb.asm: New file.
-
-2011-10-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/s390_64/submul_1.asm: New file.
- * mpn/s390_32/esame/submul_1.asm: New file.
-
- * mpn/generic/mulmid.c (mpn_mulmid): Move a TMP_DECL to block start.
-
- * mpn/Makefile.am (TARG_DIST): Add s390_32 and s390_64, remove s390 and
- z8000x.
-
- * doc/gmp.texi (Custom Allocation): Rephrase a paragraph.
-
- * demos/factorize.c: Run 25 Miller-Rabin tests.
-
- * mpz/nextprime.c: Run 25 mpz_millerrabin tests (was 10).
-
-2011-10-03 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Support s390x.
-
- * longlong.h: Add support for 64-bit s390x.
-
- * mpn/s390_64: New directory.
- * mpn/s390_64/add_n.asm: New file.
- * mpn/s390_64/sub_n.asm: New file.
- * mpn/s390_64/mul_1.asm: New file.
- * mpn/s390_64/addmul_1.asm: New file.
- * mpn/s390_64/bdiv_dbm1c.asm: New file.
- * mpn/s390_64/gmp-mparam.h: New file, taken from x86_64.
-
- * mpn/s390_32: Directory renamed from mpn/s390.
- * mpn/s390_32/gmp-mparam.h: New file, taken from x86_64.
- * mpn/s390_32/esame/add_n.asm: New file.
- * mpn/s390_32/esame/sub_n.asm: New file.
- * mpn/s390_32/esame/mul_1.asm: New file.
- * 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>
-
- * tests/mpn/Makefile.am (check_PROGRAMS): Added t-mulmid.
- * tests/mpn/t-mulmid.c: New file.
-
- mulmid-related assembly for x86_64, from David Harvey:
- * mpn/asm-defs.m4 (define_mpn): Added [add,sub]_err[1,2,3]_n and
- mulmid_basecase. Also use m4_not_for_expansion on the
- corresponding OPERATION_* symbols.
- * mpn/x86_64/aors_err1_n.asm: New file.
- * mpn/x86_64/aors_err2_n.asm: Likewise.
- * mpn/x86_64/aors_err3_n.asm: Likewise.
- * mpn/x86_64/mulmid_basecase.asm: Likewise.
- * mpn/x86_64/core2/aors_err1_n.asm: Likewise.
- * mpn/x86_64/gmp-mparam.h (MULMID_TOOM42_THRESHOLD): New value.
- * mpn/x86_64/core2/gmp-mparam.h (MULMID_TOOM42_THRESHOLD): Likewise.
-
- Tuning of mulmid, from David Harvey:
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Added mulmid.c
- mulmid_n.c toom42_mulmid.c.
- * tune/speed.h: Prototypes for mulmid-related functions.
- (struct speed_params): Increased max number of sources to 5.
- (SPEED_ROUTINE_MPN_BINARY_ERR_N_CALL): New macro.
- (SPEED_ROUTINE_MPN_BINARY_ERR1_N): Likewise.
- (SPEED_ROUTINE_MPN_BINARY_ERR2_N): Likewise.
- (SPEED_ROUTINE_MPN_BINARY_ERR3_N): Likewise.
- (SPEED_ROUTINE_MPN_MULMID): Likewise.
- (SPEED_ROUTINE_MPN_MULMID_N): Likewise.
- (SPEED_ROUTINE_MPN_TOOM42_MULMID): Likewise.
- * tune/common.c (mpn_[add,sub]_err[1,2,3]_n): New functions.
- (speed_mpn_mulmid_basecase): New function.
- (speed_mpn_mulmid): New function.
- (speed_mpn_mulmid_n): New function.
- (speed_mpn_toom42_mulmid): New function.
- * tune/speed.c (routine): Added mpn_[add,sub]_err[1,2,3]_n,
- mpn_mulmid_basecase, mpn_toom42_mulmid, mpn_mulmid_n, and
- mpn_mulmid.
- * tune/tuneup.c (mulmid_toom42_threshold): New threshold variable.
- (tune_mulmid): New function.
- (all): Call tune_mulmid.
-
- Testing of mulmid, from David Harvey:
- * tests/refmpn.c (AORS_ERR1_N): New macro.
- (refmpn_add_err1_n, refmpn_sub_err1_n): New functions.
- (AORS_ERR2_N): New macro.
- (refmpn_add_err2_n, refmpn_sub_err2_n): New functions.
- (AORS_ERR3_N): New macro.
- (refmpn_add_err3_n, refmpn_sub_err3_n): New functions.
- (refmpn_mulmid_basecase): New function.
- (refmpn_toom42_mulmid): New function, wrapper for
- refmpn_mulmid_basecase.
- (refmpn_mulmid_n): Likewise.
- (refmpn_mulmid): Likewise.
- * tests/tests.h: Prototypes for new functions.
- * tests/devel/try.c (NUM_SOURCES): Increased to 5.
- (struct try_t): Use NUM_SOURCES and NUM_DESTS constants.
- (SIZE_4, SIZE_6, SIZE_DIFF_PLUS_3, SIZE_ODD): New constants.
- (OVERLAP_NOT_DST2): New flag.
- (param_init): New mulmid-related operation types.
- (mpn_toom42_mulmid_fun): New function.
- (choice_array): Added mulmid-related entries.
- (overlap_array): Extended for larger NUM_SOURCES.
- (OVERLAP_COUNT): Handle OVERLAP_NOT_DST2.
- (call): Support mulmid-related functions.
- (pointer_setup): Handle SIZE_4, SIZE_6, and SIZE_DIFF_PLUS_3.
- (SIZE_ITERATION): Handle SIZE_ODD.
- (SIZE2_FIRST): Handle SIZE_CEIL_HALF.
- (SIZE2_LAST): Likewise.
-
- Implementation of mulmid, from David Harvey:
- * mpn/generic/add_err1_n.c (mpn_add_err1_n): New file and function.
- * mpn/generic/add_err2_n.c (mpn_add_err2_n): Likewise.
- * mpn/generic/add_err3_n.c (mpn_add_err3_n): Likewise.
- * mpn/generic/sub_err1_n.c (mpn_sub_err1_n): Likewise.
- * mpn/generic/sub_err2_n.c (mpn_sub_err2_n): Likewise.
- * mpn/generic/sub_err3_n.c (mpn_sub_err3_n): Likewise.
- * mpn/generic/mulmid_basecase.c (mpn_mulmid_basecase): Likewise.
- * mpn/generic/mulmid_n.c (mpn_mulmid_n): Likewise.
- * mpn/generic/toom42_mulmid.c (mpn_toom42_mulmid): Likewise.
- * configure.in (gmp_mpn_functions): Added mulmid-related
- functions.
- (GMP_MULFUNC_CHOICES): Handle aors_err1_n, aors_err2_n, and
- aors_err3_n.
- * gmp-impl.h: Added prototypes for mulmid functions.
- (MPN_TOOM42_MULMID_MINSIZE): New constant.
- (MULMID_TOOM42_THRESHOLD): New threshold.
- (mpn_toom42_mulmid_itch): New macro.
-
-2011-10-03 Niels Möller <nisse@lysator.liu.se>
-
- * tune/tune-gcd-p.c (main): Fixed broken loop conditions.
-
-2011-09-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sh/sh2/submul_1.asm: Make this old submul_1 implementation
- actually compute intended function.
-
- * longlong.h (SH): Recognise predefs for all SH processors as defined
- by current gcc versions.
-
-2011-09-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sh: Migrate files to '.asm'.
- * configure.in: Recognise sh3 and sh4.
-
-2011-09-21 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (mpz_class::swap): New function.
- (mpq_class::swap): Likewise.
- (mpf_class::swap): Likewise.
- (swap): New function.
- * tests/cxx/t-assign.cc: Test the above.
- * doc/gmp.texi (swap): Document the above.
-
-2011-08-21 Marc Glisse <marc.glisse@inria.fr>
-
- * tests/cxx/t-ops2.cc: check mul-div by 2.
-
- * gmpxx.h (__GMPXX_CONSTANT): New macro (__builtin_constant_p).
- (__gmp_binary_lshift): Move before multiplication. Optimize x << 0.
- (__gmp_binary_rshift): Move before division. Optimize x >> 0.
- (__gmp_binary_plus): Optimize x + 0. Rewrite rational + integer.
- (__gmp_binary_minus): Optimize x - 0 and 0 - x.
- Rewrite rational - integer.
- (__gmp_binary_multiplies): Optimize x * 2^n.
- (__gmp_binary_divides): Optimize x / 2^n.
- (__gmp_binary_*): Deduplicate code for symmetric operations.
-
-2011-08-18 Torbjorn Granlund <tege@gmplib.org>
-
- * printf/doprntf.c (__gmp_doprnt_mpf): For DOPRNT_CONV_FIXED, ask for
- one more digit.
-
-2011-08-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpf/sub.c: Fix typo in copy condition. Delay an allocation.
-
-2011-08-12 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (LIMBS_PER_DIGIT_IN_BASE): Fix typo.
-
-2011-08-10 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (DIGITS_IN_BASEGT2_FROM_BITS): New.
- (DIGITS_IN_BASE_FROM_BITS): Compute more accurate result.
- (MPN_SIZEINBASE): Use DIGITS_IN_BASEGT2_FROM_BITS.
-
- * tests/rand/t-lc2exp.c (check_bigc): Call abort after reporting error.
-
-2011-08-09 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/out_str.c (mpz_out_str): Reinsert accidentally deleted str_size
- adjustment.
-
- * gmp-impl.h (DIGITS_IN_BASE_FROM_BITS): Simplify, also avoiding
- overflow for base 2.
-
-2011-08-07 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (struct bases): Add log2b and logb2 field, remove
- chars_per_limb_exactly field.
- (DIGITS_IN_BASE_FROM_BITS): New.
- (DIGITS_IN_BASE_PER_LIMB): New.
- (LIMBS_PER_DIGIT_IN_BASE): New.
- * gen-bases.c: Generate log2b and logb2 fields; do not generate
- chars_per_limb_exactly field.
- * mpf/get_str.c mpf/out_str.c mpf/set_str.c mpn/generic/get_str.c
- mpn/generic/sizeinbase.c mpq/get_str.c mpz/inp_str.c mpz/out_str.c
- mpz/set_str.c printf/doprntf.c tune/speed.h tune/tuneup.c:
- Use new macros.
-
-2011-08-04 Torbjorn Granlund <tege@gmplib.org>
-
- * dumbmp.c (mpz_root): Reinsert accidentally removed line.
-
-2011-08-03 Torbjorn Granlund <tege@gmplib.org>
-
- * dumbmp.c (mpz_tdiv_qr): Correctly handle dividend value being equal
- to divisor value.
- (mpz_root): Create reasonable starting approximation.
- (mpz_sqrt): New function.
- (mpz_mul_2exp): Add faster block shifting code, disabled for now.
-
-2011-07-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/arm/invert_limb.asm: Swap around some registers to silence 'as'
- warnings.
-
-2011-07-14 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/dcpi1_bdiv_q.c (mpn_dcpi1_bdiv_q): Get mpn_sub_1 size
- argument right.
-
-2011-07-04 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/misc/t-locale.c: Disable test for mingw.
-
- * configure.in (x86_64 *-*-mingw*): Handle also cygwin here; clear out
- extra_functions_64.
-
-2011-07-02 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: Don't print newline in x86 cpuid function.
- Rewrite x86-64 cpu recognition asm code to work under Windoze.
-
-2011-06-16 Torbjorn Granlund <tege@gmplib.org>
-
- * acinclude.m4 (GMP_ASM_RODATA): Fix typo in 2011-04-20 change.
-
- * configure.in: Surround tr ranges with [] for portability.
-
-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>
-
- * tune/Makefile.am (EXTRA_PROGRAMS): Added tune-gcd-p. Also added
- related automake variables.
-
- * mpn/Makefile.am (tune-gcd-p): Deleted target.
-
- * tune/tune-gcd-p.c: New file, extracted from mpn/generic/gcd.c
- and updated.
- * mpn/generic/gcd.c: Deleted the corresponding code, including
- main function.
-
-2011-05-23 Niels Möller <nisse@lysator.liu.se>
-
- * 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>
-
- * 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>
-
- * mpz/jacobi.c (mpz_jacobi): The handling of asize == 1 was
- broken. Rewrote it.
-
- * tests/mpz/t-jac.c (mpz_nextprime_step): Sanity check that prime
- candidate and step has no common factor.
- (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>
-
- * gmp-impl.h: Jacobi-related prototypes.
-
- * configure.in (gmp_mpn_functions): Added jacobi_2, jacobi,
- hgcd2_jacobi, hgcd_jacobi, and removed jacobi_lehmer.
-
- * mpz/jacobi.c (STRIP_TWOS): Deleted macro.
- (mpz_jacobi): Partially rewritten, to no longer makes the A
- operand odd. Use new mpn_jacobi_n.
-
- * mpn/generic/jacobi_lehmer.c: Deleted file.
-
- * mpn/generic/jacobi.c (mpn_jacobi_n): New subquadratic jacobi
- implementation. Supersedes jacobi_lehmer.c.
-
- * mpn/generic/hgcd_jacobi.c (mpn_hgcd_jacobi): New file and
- function. A copy of mpn_hgcd, using mpn_hgcd2_jacobi, and with calls to
- mpn_jacobi_update when appropriate.
-
- * mpn/generic/jacobi_2.c (mpn_jacobi_2): New file. Extracted from
- jacobi_lehmer.c.
- * mpn/generic/hgcd2_jacobi.c (mpn_hgcd2_jacobi): Likewise.
-
- * mpn/generic/hgcd.c (hgcd_hook): Avoid using NULL.
-
-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.
-
- * configure.in (gmp_mpn_functions): Added hgcd_matrix.
-
- * mpn/generic/hgcd.c (hgcd_matrix_update_1): Deleted. Several other
- helper functions moved to hgcd_matrix.c, see below.
- (hgcd_hook): New function.
- (hgcd_step): Simplified, using mpn_gcd_subdiv_step and hgcd_hook.
-
- * mpn/generic/hgcd_matrix.c: New file.
- (mpn_hgcd_matrix_init): Moved here, from hgcd.c.
- (mpn_hgcd_matrix_update_q): Likewise.
- (mpn_hgcd_matrix_mul_1): Likewise.
- (mpn_hgcd_matrix_mul): Likewise.
- (mpn_hgcd_matrix_adjust): Likewise.
-
- * mpn/generic/gcd_subdiv_step.c (mpn_gcd_subdiv_step): New
- argument s, for use by hgcd.
- * gmp-impl.h (mpn_gcd_subdiv_step): Update declaration.
-
- * mpn/generic/gcd.c (mpn_gcd): Pass s = 0 to mpn_gcd_subdiv_step.
- * mpn/generic/gcdext.c (mpn_gcdext): Likewise. Also added an ASSERT.
- * mpn/generic/gcdext_lehmer.c (mpn_gcdext_lehmer_n): Likewise.
- (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>
-
- * doc/gmp.texi (mpn_gcd, mpn_gcdext): Document input requirements:
- Must have un >= vn > 0, and V normalized.
- * mpn/generic/gcdext.c (mpn_gcdext): Added ASSERT for input
- normalization.
- * mpn/generic/gcd.c (mpn_gcd): Added ASSERTs for input
- requirements.
-
-2011-05-15 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (operator<<): Dedup.
- * tests/cxx/t-iostream.cc: Test on compound types.
-
- * gmpxx.h (__gmp_binary_expr): Let things happen in place: c=(a+b)/2.
-
-2011-05-10 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__gmp_unary_expr): Let things happen in place: c=-(a+b).
- (operator>>): Clean the commenting out.
- * tests/cxx/t-iostream.cc: New file.
- * tests/cxx/Makefile.am: Added t-iostream.
-
-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>
-
- * mpz/gcdext.c (mpz_gcdext): Increased sp allocation to bsize+1 limbs.
- * doc/gmp.texi (mpn_gcdext): Fixed documentation of allocation
- requirements; one extra limb is still needed for S.
-
-2011-05-09 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/fat/gmp-mparam.h (BMOD_1_TO_MOD_1_THRESHOLD): Define.
- * mpn/x86_64/fat/gmp-mparam.h (BMOD_1_TO_MOD_1_THRESHOLD): Define.
-
-2011-05-08 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h: Replace unsigned long with mp_bitcnt_t in many places.
- * doc/gmp.texi: Likewise.
-
-2011-05-06 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (mpz_class): Make constructor from mp[qf]_class explicit.
- (mpq_class): Make constructor from mpf_class explicit.
- * doc/gmp.texi: Document the above.
- * NEWS: Likewise, and mention the EOF istream fix.
- * tests/cxx/t-mix.cc: New file.
- * tests/cxx/Makefile.am: Added t-mix.
-
- * tests/cxx/t-assign.cc: Minor tweak.
- * tests/cxx/t-misc.cc: Likewise.
-
- * gmpxx.h (__gmp_resolve_temp): Remove.
- (__gmp_set_expr): Remove some overloads.
- (mpq_class): mpz_init_set the numerator and denominator instead of
- mpq_init + mpq_set.
- (mpz_class): Dedup the string constructors.
- (mpq_class): Likewise.
-
- * tests/cxx/t-ops3.cc: New file.
- * tests/cxx/Makefile.am: Added t-ops3.
-
-2011-05-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/gcdext.c: Correct sgn computation.
- Use MPZ_REALLOC.
-
-2011-05-05 Marc Glisse <marc.glisse@inria.fr>
-
- * mpn/x86_64/fat/fat.c: Update for Sandy Bridge.
- * config.guess: warning to keep it in sync with fat.c.
-
-2011-05-05 Torbjorn Granlund <tege@gmplib.org>
-
- * 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>
-
- * 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 Möller)
-
-2011-05-02 Marc Glisse <marc.glisse@inria.fr>
-
- * .bootstrap: libtoolize doesn't need -c.
-
- * 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>
-
- * 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>
-
- * mpn/generic/div_qr_2u_pi1.c (mpn_div_qr_2u_pi1): Fixed ASSERT.
-
-2011-04-30 Marc Glisse <marc.glisse@inria.fr>
-
- * gmp-h.in (mpz_cdiv_q_2exp): Use mp_bitcnt_t to match the definition
- and the documentation.
- (mpz_remove): Likewise.
- (mpf_eq): Likewise.
-
- * ltmain.sh: Remove.
- * .bootstrap: Let libtoolize generate ltmain.sh.
-
- * tests/cxx/t-ops2.cc: Add a couple tests.
- * tests/cxx/t-rand.cc: Likewise.
-
- * doc/gmp.texi (mpf_urandomb): Explicit the fact that it does not
- change the precision.
-
- * gmp-h.in (__GMP_EXTERN_INLINE): Recent g++ uses gnu_inline.
-
-2011-04-28 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (x86_64): Support bobcat specifically.
- (x86): Match bobcat and bulldozer, handle like k10.
-
-2011-04-28 David Harvey <dmharvey@cims.nyu.edu>
-
- * README.HG: update autotools version numbers.
-
-2011-04-27 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.h (speed_cyclecounter): Always use PIC variant when
- compiled with Apple's GCC.
-
- * mpn/x86/darwin.m4 (LEA): Complete rewrite.
- (m4append): New macro.
-
-2011-04-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sparc32/sparc-defs.m4 (changecom): Don't redefine '!' as it
- interferes with expressions.
-
-2011-04-20 Torbjorn Granlund <tege@gmplib.org>
-
- * acinclude.m4 (GMP_ASM_RODATA): Make 'foo' larger to avoid clang
- problems.
-
-2011-04-12 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/x86_64/invert_limb.asm [PIC]: Declare mpn_invert_limb_table
- as .protected.
-
-2011-04-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/k7/invert_limb.asm: Use deflit for Darwin bug workaround.
- Undo 2011-03-28 change.
-
- * mpn/asm-defs.m4 (define_mpn): Use deflit.
-
-2011-04-10 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/asm-defs.m4 (define_mpn): Added invert_limb_table.
-
- * configure.in: Add invert_limb_table to extra_functions_64 on
- x86_64.
-
- * mpn/x86_64/invert_limb.asm: Changed references from approx_tab
- mpn_invert_limb_table.
-
- * mpn/x86_64/invert_limb_table.asm (mpn_invert_limb_table): New
- file. Extracted approximation table from invert_limb.asm, renamed
- and made global.
-
-2011-03-30 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/x86_64/div_qr_2u_pi1.asm: New file.
-
- * configure.in (gmp_mpn_functions): Add div_qr_2u_pi1.
-
- * gmp-impl.h (mpn_div_qr_2u_pi1): Declare.
-
- * mpn/generic/div_qr_2u_pi1.c (mpn_div_qr_2u_pi1): Moved to
- separate file, from...
- * mpn/generic/div_qr_2.c: ... old location.
-
- * mpn/generic/div_qr_2n_pi1.c: Renamed file, from...
- * mpn/generic/div_qr_2_pi1_norm.c: ...old name.
- * mpn/x86_64/div_qr_2n_pi1.asm: Renamed file, from...
- * mpn/x86_64/div_qr_2_pi1_norm.asm: ...old name.
-
- * gmp-impl.h (mpn_div_qr_2n_pi1): Use new name in declaration.
- * tune/speed.h (speed_mpn_div_qr_2n): Likewise.
- (speed_mpn_div_qr_2u): Likewise.
-
- * tune/tuneup.c (tune_div_qr_2): Use new name speed_mpn_div_qr_2n.
-
- * tune/speed.c (routine): Use new names mpn_div_qr_2n and
- mpn_div_qr_2u, also on the command line.
-
- * tune/common.c (speed_mpn_div_qr_2n): Renamed, from...
- (speed_mpn_div_qr_2_norm): ... old name.
- (speed_mpn_div_qr_2u): Renamed, from...
- (speed_mpn_div_qr_2_unnorm): ... old name.
-
- * mpn/generic/div_qr_2_pi1_norm.c (mpn_div_qr_2n_pi1): Renamed,
- from...
- (mpn_div_qr_2_pi1_norm): ...old name.
- * mpn/x86_64/div_qr_2_pi1_norm.asm: Likewise.
-
- * mpn/generic/div_qr_2.c (mpn_div_qr_2n_pi2): Renamed, from...
- (mpn_div_qr_2_pi2_norm): ... old name.
- (mpn_div_qr_2u_pi1): Renamed, from...
- (mpn_div_qr_2_pi1_unnorm): ... old name.
- (mpn_div_qr_2): Call functions using new names.
-
- * mpn/asm-defs.m4: Renamed div_qr_2-functions to new names.
-
-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.
-
- * gmp-impl.h (mpn_div_qr_2_pi1_norm): Updated declaration.
- * gmp-h.in (mpn_div_qr_2): Likewise.
-
- * tests/mpn/t-div.c (main): Adapted to new mpn_div_qr2 interface.
- * tune/speed.h (SPEED_ROUTINE_MPN_DIV_QR_2): Likewise.
-
- * mpn/generic/div_qr_2.c (mpn_div_qr_2_pi2_norm): Added rp
- argument. Don't clobber the input dividend.
- (mpn_div_qr_2_pi1_unnorm): Likewise.
- (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>
-
- * mpn/x86/k7/invert_limb.asm: Use mov rather than push and pop.
- Earlier load of divisor from stack.
-
-2011-03-28 Torbjorn Granlund <tege@gmplib.org>
-
- * 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>
-
- * mpn/x86_64/div_qr_2_pi1_norm.asm: Copied optimized inner loop
- from divrem_2.asm.
-
- * mpn/x86_64/div_qr_2_pi1_norm.asm: First working, but poorly
- optimized, implementation.
-
- * mpn/asm-defs.m4 (define_mpn): Added div_qr_2_pi[12]_*norm.
-
- * mpn/generic/div_qr_2_pi1_norm.c (mpn_div_qr_2_pi1_norm): Moved
- to separate file, from...
- * mpn/generic/div_qr_2.c: ... old location.
-
- * gmp-impl.h (mpn_div_qr_2_pi1_norm): Declare.
-
- * configure.in (gmp_mpn_functions): Added div_qr_2_pi1_norm.
-
-2011-03-22 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (powerpc): Reinsert lost AIX cpu_path 32-bit handling.
- Reinsert lost linux/bsd cpu_path handling.
-
- * mpn/generic/mod_1_1.c: Disable powerpc asm for _LONG_LONG_LIMB.
- * mpn/generic/div_qr_2.c: Likewise.
-
- * mpn/generic/div_qr_2.c: Use asm just for gcc.
- Make powerpc add_sssaaaa work for 32-bit case, and use less strict
- constraints.
-
-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.
- (all): Call tune_div_qr_2.
-
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Added div_qr_2.c.
-
- * gmp-impl.h (DIV_QR_2_PI2_THRESHOLD): Setup for tuning.
-
- 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.
- (mpn_div_qr_2_pi2_norm): New function.
- (DIV_QR_2_PI2_THRESHOLD): New threshold.
- (mpn_div_qr_2_pi1_norm): Renamed, from...
- (mpn_div_qr_2_norm): ... old name.
- (mpn_div_qr_2_pi1_unnorm): Renamed, from...
- (mpn_div_qr_2_unnorm): ... old name.
- (mpn_div_qr_2): Use mpn_div_qr_2_pi2_norm for large enough
- normalized divisors.
-
- * gmp-impl.h (udiv_qr_3by2): Avoid a copy.
-
-2011-03-21 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (hppa): Under linux, treat 64-bit processors as if they
- were 32-bit processors.
-
- * mpn/generic/addcnd_n.c: New file.
- * mpn/asm-defs.m4 (define_mpn): Add addcnd_n and subcnd_n.
- * configure.in (gmp_mpn_functions): Add addcnd_n.
- * gmp-impl.h (mpn_addcnd_n): Declare.
-
- * mpn/generic/subcnd_n.c: Combine nails and non-nails functions.
-
- * gmp-impl.h (invert_pi1): Prepend _ to local variables, protect
- parameters within () where necessary.
-
- * mpn/asm-defs.m4 (define_mpn): Add div_qr_2.
- * configure.in (gmp_mpn_functions): Reinsert mercurial-bug-removed
- line.
-
-2011-03-20 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (powerpc): Add cpu_path for all three ABIs.
- Rename "aix64" to "mode64" for consistency.
-
-2011-03-16 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__gmp_binary_not_equal): Remove, use !__gmp_binary_equal.
- (__gmp_binary_less_equal): Remove, use !__gmp_binary_greater.
- (__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>
-
- * tune/common.c (speed_mpn_div_qr_2_norm): New function.
- (speed_mpn_div_qr_2_unnorm): New function.
- * tune/speed.c (routine): Recognize above functions.
- * tune/speed.h: Declarations for above functions.
- (SPEED_ROUTINE_MPN_DIV_QR_2): New macro.
-
- * tests/mpn/t-div.c (main): Added tests for mpn_divrem_2 and
- mpn_div_qr_2.
-
- * mpn/generic/div_qr_2.c (mpn_div_qr_2): New file and function.
- Intended to eventually replace divrem_2.
- * configure.in (gmp_mpn_functions): Add div_qr_2.
-
-2011-03-16 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__gmp_set_expr): Remove broken declarations.
-
-2011-03-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/fac_ui.c (mpz_fac_ui): Use MPZ_REALLOC for standard, conditional
- reallocation.
-
-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.
-
-2011-03-16 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__mpz_set_ui_safe): New inline function.
- (__mpz_set_si_safe): Likewise.
- (__GMPXX_TMPZ_UI): Use the new function.
- (__GMPXX_TMPZ_SI): Likewise.
- (__GMPXX_TMPQ_UI): Likewise.
- (__GMPXX_TMPQ_SI): Likewise.
- * tests/cxx/t-ops2.cc: test converting 0 to stack mpq_t.
-
-2011-03-15 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h (__GMPXX_TMPQ_UI): New macro.
- (__GMPXX_TMPQ_SI): New macro.
- (struct __gmp_binary_multiplies): Rewrite, using the new macros.
- (struct __gmp_binary_divides): Likewise.
-
- * gmpxx.h (__GMPZ_ULI_LIMBS): Rewrite.
- * tests/cxx/t-ops2.cc: test converting ULONG_MIN to stack mpq_t.
-
-2011-03-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_interpolate_16pts.c: Remove ambiguity.
-
-2011-03-14 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mul): Set tuning min size considering print skew.
-
- * doc/gmp.texi: Make reference to "Formatted I/O" chapters from type
- specific I/O sections.
-
- * mpn/alpha/add_n.asm: Add _nc entry point.
- * mpn/alpha/sub_n.asm: Likewise.
- * mpn/mips64/add_n.asm: Likewise.
- * mpn/mips64/sub_n.asm: Likewise.
- * mpn/sparc64/ultrasparc1234/add_n.asm: Likewise.
- * mpn/sparc64/ultrasparc1234/sub_n: Likewise.
-
-2011-03-13 Marc Glisse <marc.glisse@inria.fr>
-
- * tests/cxx/t-ops2.cc: New file.
- * tests/cxx/Makefile.am: Added t-ops2.
-
-2011-03-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom32_mul.c (mpn_toom32_mul): Make 'hi' be limb-sized
- for better code.
-
- * gmp-impl.h (MPN_IORD_U): Handle x86_64 as well as x86_32. Generate
- no code for incrementing by constant 0.
-
-2011-03-12 Marc Glisse <marc.glisse@inria.fr>
-
- * gmpxx.h: Rename __GMPXX_TMP_* to __GMPXX_TMPZ_*. Use in more places.
-
-2011-03-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/rshift.asm: Accept/return values correctly also for
- 32-bit ABI.
- * mpn/powerpc64/lshift.asm: Likewise.
-
- * tune/powerpc.asm: Use powerpc syntax, not power syntax.
-
- * tune/common.c (speed_udiv_qrnnd_preinv1, etc): Remove.
- * tune/speed.c (routine): Remove udiv_qrnnd_preinv1, etc.
-
-2011-03-12 Marc Glisse <marc.glisse@inria.fr>
-
- * tests/cxx/t-istream.cc: Restrict mpq test in t-istream -s.
-
- * gmpxx.h: Remove leftover #undefs.
-
-2011-03-11 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (udiv_qrnnd_preinv1, udiv_qrnnd_preinv2,
- udiv_qrnnd_preinv2gen): Remove obsolete macros.
- (udiv_qrnnd_preinv): New name for udiv_qrnnd_preinv3.
-
-2011-03-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h: Declare many mpn_{sub,add}lsh*_n_ip[12] functions/macros.
- * mpn/generic/toom_interpolate_5pts.c: Use mpn_sublsh1_n_ip1.
-
- * tests/devel/try.c: Tests for {add,sub}lsh*_n_ip[12].
- * tests/refmpn.c: New reference for mpn_{add,sub}lsh*_n_ip[12].
- * tests/tests.h: Declarations for reference functions above.
-
- * tune/common.c: New speed_mpn_{add,sub}lsh*_n_ip[12] functions.
- * tune/speed.h: Prototypes for functions above.
- * tune/speed.c: Support for mpn_{add,sub}lsh*_n_ip[12].
-
- * mpn/x86/k7/sublsh1_n.asm: Replaced generic sublsh1 code with faster _ip1.
- * mpn/x86/atom/sublsh1_n.asm: Changed PROLOGUE accordingly.
-
- * configure.in: Define HAVE_NATIVE_mpn_addlsh*_n*_ip[12].
- * mpn/asm-defs.m4: Declare mpn_addlsh*_n*_ip[12].
-
-2011-03-10 Marc Glisse <marc.glisse@inria.fr>
-
- * tests/cxx/t-istream.cc: Explicit conversion to streampos.
-
-2011-03-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/atom/sse2/mul_basecase.asm: Suppress wind-down rp updates.
-
- * Move new aorrlsh_n.asm to new k8 dir. Revert
- mpn/x86_64/aorrlsh_n.asm.
- * configure.in: Setup path for new k8 directory.
-
-2011-03-10 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/pentium4/sse2/bdiv_dbm1c.asm: New file, was in atom.
- * mpn/x86/atom/sse2/bdiv_dbm1c.asm: Grab file above.
-
-2011-03-09 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/aorrlsh_n.asm: Complete rewrite.
-
- * mpn/x86_64/core2/aorrlsh_n.asm: New file, grabbing another asm file.
-
-2011-03-09 Marc Glisse <marc.glisse@inria.fr>
-
- * tests/cxx/t-ostream.cc: Use bool instead of int.
- * tests/cxx/t-istream.cc: Likewise.
- * tests/cxx/t-misc.cc: Likewise.
-
- * cxx/ismpznw.cc: Don't clear eofbit.
- * cxx/ismpq.cc: Likewise.
- * cxx/ismpf.cc: Likewise.
- * tests/cxx/t-istream.cc: Test accordingly.
-
-2011-03-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/sse2/bdiv_dbm1c.asm: New file.
-
-2011-03-09 Marc Glisse <marc.glisse@inria.fr>
-
- * doc/gmp.texi: Remove void return type from constructors. Document
- explicit constructors. Document mpf_class::mpf_class(mpf_t).
-
-2011-03-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/sse2/sqr_basecase.asm: Postponed pushes. Cleaned
- outer loop exit.
-
-2011-03-07 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/gcd_1.asm: Workaround Oracle assembler bug.
-
- * mpn/x86/atom/sse2/mul_basecase.asm: Replace addmul_1 loops.
- Tweak outer loop rp updates.
-
-2011-03-06 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/atom/sse2/sqr_basecase.asm: New file.
-
-2011-03-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/bdiv_dbm1c.asm: Write proper feed-in code.
-
-2011-03-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/addmul_2.asm: Rewrite for linear performance.
-
-2011-03-03 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_1.c (add_mssaaaa): Canonicalise layout. Add arm
- variant. Enable sparc64 code and powerpc code (the latter for 32-bit
- and 64-bit).
-
- * mpn/generic/sqrtrem.c (mpn_dc_sqrtrem): Use mpn_addlsh1_n.
-
- * gmp-impl.h (mpn_addlsh_nc, mpn_rsblsh_nc): Declare.
- * mpn/asm-defs.m4: Likewise.
-
- * mpn/x86_64/coreisbr/aorrlsh_n.asm: Disable mpn_rsblsh_n due to
- carry-in issues.
- * 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>
-
- * mpn/generic/mod_1_1.c (add_mssaaaa): For x86 and x86_64, treat m
- as in output operand only. Added sparc32 implementation. Also
- added #if:ed out attempts at sparc64 and powerpc64.
-
- * 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 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_mod_1_1p_cps) [TUNE_PROGRAM_BUILD]: Likewise.
-
- * gmp-impl.h (MOD_1_1P_METHOD) [TUNE_PROGRAM_BUILD]: Define macro.
- (mod_1_1p_method) [TUNE_PROGRAM_BUILD]: Declare variable.
-
-2011-03-02 Torbjorn Granlund <tege@gmplib.org>
-
- * 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>
-
- * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p_cps): Eliminated a neg and
- two mov instructions.
-
- * mpn/x86/k7/mod_1_1.asm (mpn_mod_1_1p_cps): Simplified
- computation, analogous to recent x86_64/mod_1_1.asm changes.
- (mpn_mod_1_1p): Corresponding changes. Don't shift b.
-
- * mpn/sparc64/mod_1_4.c (mpn_mod_1s_4p_cps): Use udiv_rnnd_preinv
- rather than udiv_rnd_preinv.
- (mpn_mod_1s_4p): Likewise.
-
-2011-03-01 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/pentium4/sse2/mul_1.asm: Swap entry insns to share more code
- between entry points.
- * mpn/x86/pentium4/sse2/addmul_1.asm: Likewise.
-
- * mpz/divegcd.c: Rewrite, as per Marc Glisse's suggestion. Also fix
- problem with passing a longlong limb to a _ui function.
-
- * gmp-impl.h (udiv_qrnnd_preinv3): Cast truth value to mask's type.
- (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>
-
- * mpn/generic/mod_1_1.c (add_mssaaaa): Typo fix, define
- add_mssaaaa, not add_sssaaaa.
-
- * tune/tuneup.c (tune_mod_1): Measure mpn_mod_1_1_1 and
- mpn_mod_1_1_2, to set MOD_1_1P_METHOD.
-
- * tune/speed.c (routine): Added mpn_mod_1_1_1 and mpn_mod_1_1_2.
-
- * tune/speed.h: Declare speed_mpn_mod_1_1_1, speed_mpn_mod_1_1_2,
- mpn_mod_1_1p_1, mpn_mod_1_1p_2, mpn_mod_1_1p_cps_1, and
- mpn_mod_1_1p_cps_2.
-
- * tune/common.c (speed_mpn_mod_1_1_1): New function.
- (speed_mpn_mod_1_1_2): New function.
-
- * tune/Makefile.am (libspeed_la_SOURCES): Added mod_1_1-1.c
- mod_1_1-2.c.
-
- * tune/mod_1_1-1.c: New file.
- * tune/mod_1_1-2.c: New file.
-
- * mpn/generic/mod_1_1.c: Implemented an algorithm with fewer
- multiplications, configured via MOD_1_1P_METHOD.
-
- * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p_cps): Simplified
- computation of B2modb, use B^2 mod (normalized b).
- (mpn_mod_1_1p): Corresponding changes. Don't shift b.
-
- * mpn/generic/mod_1_1.c (mpn_mod_1_1p_cps): Use udiv_rnnd_preinv rather
- than udiv_rnd_preinv.
- (mpn_mod_1_1p): Likewise.
- * mpn/generic/mod_1_4.c: Analogous changes.
- * mpn/generic/mod_1_3.c: Analogous changes.
- * mpn/generic/mod_1_2.c: Analogous changes.
- * mpn/generic/mod_1.c: Analogous changes.
- * mpn/generic/pre_mod_1.c: Analogous changes.
-
- * gmp-impl.h (udiv_qrnnd_preinv3): Eliminated unpredictable branch
- using masking logic. Further optimization of the nl == constant 0
- case, similar to udiv_rnd_preinv.
- (udiv_rnnd_preinv): Likewise.
- (udiv_rnd_preinv): Deleted, use udiv_rnnd_preinv with nl == 0
- instead.
-
- * tests/mpn/t-divrem_1.c (check_data): Added testcase to exercise
- the nl == constant 0 special case in udiv_qrnnd_preinv3.
-
-2011-02-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/rootrem.c (mpn_rootrem): Combine two similar scalar
- divisions. Misc minor cleanup.
-
- * mpn/x86/atom/sse2/aorsmul_1.asm: Shorten software pipeline.
-
- * mpn/x86/atom/mul_basecase.asm: Remove file no longer used.
-
- * mpn/generic/rootrem.c (mpn_rootrem_internal): Delay O(log(U))
- allocations until they are known to be needed.
-
-2011-02-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/sse2/mul_1.asm: New code.
-
-2011-02-27 Niels Möller <nisse@lysator.liu.se>
-
- * gmp-impl.h (udiv_rnnd_preinv): New macro.
-
-2011-02-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/atom/sse2/mul_basecase.asm: New file.
-
-2011-02-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/sse2/aorsmul_1.asm: Optimise non-loop code.
-
-2011-02-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/aorsmul_1.asm: Add MULFUNC_PROLOGUE.
- * mpn/m68k/mc68020/aorsmul_1.asm: Likewise.
-
- * mpn/powerpc64/mode64/aorsmul_1.asm: Add missing MULFUNC_PROLOGUE.
- * mpn/m68k/mc68020/aorsmul_1.asm: Likewise.
-
-2011-02-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/atom/sse2/aorsmul_1.asm: New file.
- * mpn/x86/atom/aorsmul_1.asm: File removed.
-
-2011-02-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/sse2/divrem_1.asm: New file (was in x86/atom).
- * mpn/x86/atom/sse2/mul_1.asm: Likewise.
- * mpn/x86/atom/sse2/popcount.asm: Likewise.
- * mpn/x86/atom/divrem_1.asm: ReMoved (in sse2/ now).
- * mpn/x86/atom/mul_1.asm: Likewise.
- * mpn/x86/atom/popcount.asm: Likewise.
-
- * configure.in: Set up mmx path for atom.
- * mpn/x86/atom/mmx/copyd.asm: New file (was in x86/atom).
- * mpn/x86/atom/mmx/copyi.asm: Likewise.
- * mpn/x86/atom/mmx/hamdist.asm: Likewise.
- * mpn/x86/atom/copyd.asm: ReMoved (in mmx/ now).
- * mpn/x86/atom/copyi.asm: Likewise.
- * mpn/x86/atom/hamdist.asm: Likewise.
-
-2011-02-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/atom/sse2/mod_1_1.asm: New file.
- * mpn/x86/atom/sse2/mod_1_4.asm: New file.
- * configure.in: Set up sse2 path for atom.
-
- * 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>
-
- * mpn/x86/k7/mod_1_1.asm (mpn_mod_1_1p): Rewrite using the same
- algorithm as the x86_64 version.
-
-2011-02-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/logops_n.asm: New file (same loop as aors_n).
-
-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
- registers slightly, and no longer needs the callee-save register
- %r12.
-
-2011-02-22 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Export SHLD_SLOW and SHRD_SLOW to config.m4, also
- fixing typo in exporting code.
-
- * 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>
-
- * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p): Rewrite.
-
-2011-02-22 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/lshiftc.asm: New file (a copy of lshift.asm with a handful of neg added).
-
-2011-02-21 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/aors_n.asm: Move _nc entry to after main code. Align loop
- and _n entry for claimed performance. Normalise mnemonic usage.
-
- * mpn/x86/atom/aorrlsh1_n.asm: New file (code from rsblsh_1, slightly
- slower for addlsh_1 for large operands, but much faster for small).
- * mpn/x86/atom/addlsh1_n.asm: Remove.
- * mpn/x86/atom/rsblsh1_n.asm: Remove.
-
-2011-02-20 Marc Glisse <marc.glisse@inria.fr>
-
- * mpq/aors.c: Rewrite to remove redundant division.
-
-2011-02-20 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/atom/lshift.asm: New file.
- * mpn/x86/atom/rshift.asm: Normalise mnemonic usage.
-
- * gmp-impl.h (mpn_divexact_by7): Relax inclusion condition.
-
- * mpz/divegcd.c (mpz_divexact_by5): New conditionally enabled function.
- (mpz_divexact_by3): Wrap inside appropriate conditions.
- (mpz_divexact_gcd): Rewrite.
-
- * mpn/x86/bdiv_dbm1c.asm: Save a jump.
-
-2011-02-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/aorslshC_n.asm: New file.
- * mpn/x86/atom/sublsh2_n.asm: New file.
-
- * mpn/x86/atom/aors_n.asm: New code.
- * mpn/x86/atom/rshift.asm: Atom64 code adapted to 32-bit.
- * mpn/x86/atom/lshift.asm: Likewise.
-
-2011-02-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/atom/rsh1aors_n.asm: New file.
-
- * mpn/x86_64/atom/lshift.asm: New file.
- * mpn/x86_64/atom/rshift.asm: New file.
- * mpn/x86_64/atom/lshiftc.asm: New file.
-
-2011-02-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/aorsmul_1.asm: Small improvements for small sizes.
- * mpn/x86/atom/aorrlshC_n.asm: Tiny size improvements.
-
-2011-02-16 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Fix k8/k10 32-bit path setup problem.
-
-2011-02-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/aorsmul_1.asm: Revive an old k7/aorsmul.
-
-2011-02-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h (mpn_sublsh_n): Declare.
- * mpn/asm-defs.m4: Likewise.
-
- * mpn/x86/atom/aorrlshC_n.asm: New file (was k7).
- * mpn/x86/k7/aorrlshC_n.asm: ReMoved.
- * mpn/x86/atom/aorrlsh2_n.asm: Grab atom/aorrlshC_n.asm.
- * mpn/x86/atom/rsblsh1_n.asm: Grab atom/aorrlshC_n.asm.
-
-2011-02-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/atom/aorrlsh2_n.asm: New file.
-
-2011-02-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/aorrlsh_n.asm: Minor tweaks, update c/l numbers.
-
- * mpn/x86_64/atom/sublsh1_n.asm: New file.
-
- * mpn/x86_64/atom/aorrlsh1_n.asm: New file.
-
-2011-02-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/mod_1_1.asm: Fix Darwin syntax issues.
-
-2011-02-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/mod_1_4.asm: Tune away a cycle for 970.
-
-2011-02-11 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/k7/addlsh1_n.asm: Faster core loop (Torbjorn's).
-
- * configure.in: Add HAVE_NATIVE_{add,sub,rsb}lsh{,1,2}_nc.
- * tests/tests.h: refmpn_{add,sub,rsb}lsh{,1,2}_nc prototypes.
- * tests/refmpn.c: New refmpn_{add,sub,rsb}lsh{,1,2}_nc.
- * tests/devel/try.c: Tests for mpn_{add,sub,rsb}lsh{,1,2}_nc.
-
- * mpn/x86/k7/aorrlshC_n.asm: New file.
- * mpn/x86/atom/aorrlsh2_n.asm: Grab k7/aorrlshC_n.asm.
- * mpn/x86/atom/rsblsh1_n.asm: Grab k7/aorrlshC_n.asm.
-
-2011-02-06 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/k7/addlsh1_n.asm: New file.
- * mpn/x86/k7/sublsh1_n.asm: New file.
- * mpn/x86/atom/addlsh1_n.asm: Grab k7/addlsh1_n.asm.
- * mpn/x86/atom/sublsh1_n.asm: Grab k7/sublsh1_n.asm.
-
-2011-02-05 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (mpn_addlsh1_nc, mpn_addlsh2_nc, mpn_sublsh1_nc,
- mpn_sublsh2_nc, mpn_rsblsh1_nc, mpn_rsblsh2_nc): Declare.
- * mpn/asm-defs.m4: Likewise.
-
- * mpn/x86_64/coreisbr/aorrlshC_n.asm: New file.
- * mpn/x86_64/coreisbr/aorrlsh1_n.asm: New file.
- * mpn/x86_64/coreisbr/aorrlsh2_n.asm: New file.
-
- * mpn/x86_64/coreisbr/aors_n.asm: New file, based on old
- atom/aors_n.asm.
- * mpn/x86_64/atom/aors_n.asm: Grab coreisbr/aors_n.asm.
-
-2011-02-05 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h (mpn_toom6_mul_n_itch): Handle threshold == zero.
- (mpn_toom8_mul_n_itch): Likewise.
- (MPN_TOOM6H_MIN, MPN_TOOM8H_MIN): Define.
- * tests/mpn/t-toom6h.c: No tests below MPN_TOOM6H_MIN.
- * tests/mpn/t-toom8h.c: No tests below MPN_TOOM8H_MIN.
-
- * mpz/lucnum_ui.c: Use mpn_addlsh2_n.
-
-2011-02-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/atom/rsh1aors_n.asm: Add a MULFUNC_PROLOGUE.
- * mpn/x86_64/atom/dive_1.asm: Likewise.
- * mpn/x86_64/atom/popcount.asm: Likewise.
- * mpn/x86_64/core2/popcount.asm: Likewise.
- * mpn/x86_64/coreinhm/hamdist.asm: Likewise.
- * mpn/x86_64/coreinhm/popcount.asm: Likewise.
- * mpn/x86_64/nano/popcount.asm: Likewise.
- * mpn/x86_64/pentium4/popcount.asm: Likewise.
-
-2011-02-04 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * 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>
-
- * tune/speed.h (SPEED_ROUTINE_MPN_HGCD_CALL): Fixed one
- speed_operand_dst call.
-
-2011-02-01 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.h (struct speed_params): Allow for 4 dst operands.
- * tune/common.c (TOLERANCE): Increase from 0.5% to 1%.
-
- * tune/speed.h (SPEED_ROUTINE_MPN_HGCD_CALL): New macro, mainly based
- on old speed_mpn_hgcd, but with speed_operand_src calls (as suggested
- by Niels).
- * tune/common.c (speed_mpn_hgcd): Invoke SPEED_ROUTINE_MPN_HGCD_CALL.
- (speed_mpn_hgcd_lehmer): Likewise.
-
- * configure.in: Set up 32-bit x86 paths for new corei* CPU strings.
-
-2011-01-31 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: Recognise new Intel processors.
-
- * config.guess: Support 'coreinhm' and 'coreisbr'.
- * config.sub: Likewise.
- * configure.in: Likewise.
-
-2011-01-30 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Support x86/geode.
- * mpn/x86/geode/gmp-mparam.h: New file.
-
-2011-01-29 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/addlsh1_n.asm: Removed.
- * mpn/x86/atom/rsh1add_n.asm: Likewise.
-
-2011-01-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/alpha/ev6/slot.pl: Add some missing insns.
-
-2011-01-28 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/atom/copyd.asm: New file, grabbing another asm file.
- * mpn/x86/atom/copyi.asm: Likewise.
- * mpn/x86/atom/aors_n.asm: Likewise.
- * mpn/x86/atom/addlsh1_n.asm: Likewise.
- * mpn/x86/atom/aorsmul_1.asm: Likewise.
- * mpn/x86/atom/bdiv_q_1.asm: Likewise.
- * mpn/x86/atom/dive_1.asm: Likewise.
- * mpn/x86/atom/divrem_1.asm: Likewise.
- * mpn/x86/atom/hamdist.asm: Likewise.
- * mpn/x86/atom/logops_n.asm: Likewise.
- * mpn/x86/atom/lshift.asm: Likewise.
- * mpn/x86/atom/mod_34lsub1.asm: Likewise.
- * mpn/x86/atom/mul_1.asm: Likewise.
- * mpn/x86/atom/mul_basecase.asm: Likewise.
- * mpn/x86/atom/popcount.asm: Likewise.
- * mpn/x86/atom/rsh1add_n.asm: Likewise.
- * mpn/x86/atom/rshift.asm: Likewise.
- * mpn/x86/atom/sqr_basecase.asm: Likewise.
-
-2011-01-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/atom/rsh1aors_n.asm: New file, grabbing another asm file.
- * mpn/x86_64/atom/popcount.asm: Likewise.
- * mpn/x86_64/atom/dive_1.asm: Likewise.
- * mpn/x86_64/nano/popcount.asm: Likewise.
-
-2011-01-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/alpha/invert_limb.asm: Complete rewrite.
-
-2011-01-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc32/invert_limb.asm: New file.
-
-2011-01-25 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/pentium4/sse2/bdiv_q_1.asm: New file.
- * mpn/x86/k7/bdiv_q_1.asm: New file.
-
-2011-01-24 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mul_n, tune_sqr): Loop, re-measuring thresholds
- until no tiny ranges remain.
-
-2011-01-23 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/ia64/mul_2.asm: Tweak to 1.5 c/l, less overhead.
-
- * mpn/ia64/addmul_2.asm: Rewrite, adding mpn_addmul_2s entry point.
-
-2011-01-22 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/ia64/aors_n.asm: Fix some incorrect bundle types.
-
- * mpn/ia64/sqr_diagonal.asm: Remove.
-
- * mpn/ia64/sqr_diag_addlsh1.asm: New file.
-
- * mpn/ia64/ia64-defs.m4: Define some shorter convenience mnemonics.
-
- * mpn/generic/sqr_basecase.c (MPN_SQR_DIAG_ADDLSH1): New macro, using
- new function mpn_sqr_diag_addlsh1 or defining its equivalent.
-
- * gmp-impl.h (mpn_addmul_2s): Declare.
- (mpn_sqr_diag_addlsh1): Declare.
- * mpn/asm-defs.m4 (define_mpn): Add addmul_2s and sqr_diag_addlsh1.
-
- * configure.in: Add HAVE_NATIVEs for mpn_sqr_diag_addlsh1 and
- mpn_addmul_2s.
- (gmp_mpn_functions_optional): Add sqr_diag_addlsh1.
-
-2011-01-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/devel/try.c: Initial support for mpn_bdiv_q_1.
- * mpn/x86/pentium/bdiv_q_1.asm: New file.
- * mpn/x86/p6/bdiv_q_1.asm: New file.
-
-2011-01-20 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.c (run_gnuplot): Update to current gnuplot syntax.
-
- * mpn/powerpc64/mode64/aorsmul_1.asm: Trim away 0.5 c/l for submul_1
- for POWER5.
-
-2011-01-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/core2/rsh1aors_n.asm: New file.
-
-2011-01-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/x86/bdiv_q_1.asm: New file (same core alg. as dive_1).
-
-2011-01-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/divexact.c: Avoid COPY if not needed.
-
-2011-01-14 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (struct cpuvec_t): Add field bmod_1_to_mod_1_threshold.
- * configure.in (fat_thresholds): Add BMOD_1_TO_MOD_1_THRESHOLD.
-
-2011-01-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/mul.c: Remove redundant size computation.
-
-2011-01-08 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/devel/try.c (types enum): Add TYPE_MUL_5 and TYPE_MUL_6.
- (param_init): Support new types.
- (choice_array): Support testing of mpn_mul_5 and mpn_mul_6.
- (call): Support new routines.
-
- * tests/refmpn.c (refmpn_mul_5, refmpn_mul_6): New functions.
- * tests/tests.h (refmpn_mul_5, refmpn_mul_6): Declare.
- Remove parameter names from some other functions.
-
- * gmp-impl.h (mpn_mul_5, mpn_mul_6): Declare.
- * mpn/asm-defs.m4: Likewise, also declare mpn_addmul_5, mpn_addmul_6,
- mpn_addmul_7, and mpn_addmul_8.
-
- * configure.in (gmp_mpn_functions_optional): Add mul_5 and mul_6.
-
- * tune/speed.c (routine): Add measuring of mpn_mul_5 and mpn_mul_6.
- * tune/common.c (speed_mpn_mul_5, speed_mpn_mul_6): New functions.
- * tune/speed.h: Declare new functions.
-
-2011-01-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpz/aors.h: Remove #ifdef BERKELEY_MP, and cleanup.
- * mpz/cmp.c: Likewise.
- * mpz/gcd.c: Likewise.
- * mpz/mul.c: Likewise.
- * mpz/powm.c: Likewise.
- * mpz/set.c: Likewise.
- * mpz/sqrtrem.c: Likewise.
- * mpz/tdiv_qr.c: Likewise.
-
-2010-12-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/minithres/gmp-mparam.h: Update with several recent thresholds.
-
-2010-12-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/k7/mod_1_1.asm: Canonicalise cmov forms.
- * mpn/x86/k7/mod_1_4.asm: Likewise.
- * mpn/x86/pentium4/sse2/mod_1_1.asm: Likewise.
- * mpn/x86/pentium4/sse2/mod_1_4.asm: Likewise.
- * mpn/x86_64/core2/divrem_1.asm: Likewise.
- * mpn/x86_64/divrem_1.asm: Likewise.
- * mpn/x86_64/mod_1_1.asm: Likewise.
- * mpn/x86_64/mod_1_2.asm: Likewise.
- * mpn/x86_64/mod_1_4.asm: Likewise.
-
- * mpn/x86/k7/gcd_1.asm: Rewrite. Remove slow 'div' loop. Call
- mpn_mod_1 for operands with mode than BMOD_1_TO_MOD_1_THRESHOLD limbs.
- Misc cleanups.
-
-2010-12-18 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/gcd_1.asm: Call mpn_mod_1 for operands with mode than
- BMOD_1_TO_MOD_1_THRESHOLD limbs.
-
- * configure.in: Generalise code for putting THRESHOLDs in config.m4.
- Add BMOD_1_TO_MOD_1_THRESHOLD to list.
-
- * mpn/x86_64/core2/divrem_1.asm: Tweak slightly, correct cycle counts.
-
- * mpn/x86_64/addmul_2.asm: Remove constant index.
- * mpn/x86_64/lshiftc.asm: Likewise.
- * mpn/x86_64/pentium4/lshift.asm: Likewise.
- * mpn/x86_64/pentium4/lshiftc.asm: Likewise.
- * mpn/x86_64/pentium4/rshift.asm: Likewise.
-
-2010-12-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mod_34lsub1.asm: Complete rewrite.
- * mpn/x86_64/pentium4/mod_34lsub1.asm: New file, old
- mpn/x86_64/mod_34lsub1.asm.
-
-2010-12-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/vmx/popcount.asm: Rewrite to use vperm count table.
-
-2010-12-14 Torbjorn Granlund <tege@gmplib.org>
-
- * mp-h.in: Remove.
- * configure.in: Remove mp-h.in from AC_OUTPUT invocation.
-
-2010-12-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/mod.c: Rewrite.
-
- * mpn/x86_64/corei/popcount.asm: New file.
- * mpn/x86_64/corei/hamdist.asm: New file.
-
- * mpn/x86_64/k10/hamdist.asm: New file.
-
- * configure.in: Amend last change for lame /bin/sh.
-
-2010-12-12 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Comment out M4=m4-not-needed.
-
- * mpn/x86_64/k10/popcount.asm: New file.
- * configure.in: Setup special path for k10 and later AMD CPUs.
- Remove special x86_64'k8' path, since directory is non-existent.
-
-2010-12-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sparc32/ultrasparct1: New directory.
- * mpn/sparc32/ultrasparct1/add_n.asm: New file.
- * mpn/sparc32/ultrasparct1/sub_n.asm: New file.
- * mpn/sparc32/ultrasparct1/mul_1.asm: New file.
- * mpn/sparc32/ultrasparct1/addmul_1.asm: New file.
- * mpn/sparc32/ultrasparct1/submul_1.asm: New file.
- * mpn/sparc32/ultrasparct1/sqr_diagonal.asm: New file.
-
- * config.guess: Support Ultrasparc T2 and T3.
- * config.sub: Likewise.
- * configure.in: Likewise.
-
- * config.guess: Generalise BSD Sparc recognition by allowing any
- caps (needed for OpenBSD which spells things innovatively).
-
-2010-12-01 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: Match new AMD processors, allow finer distinctions
- among old ones.
- * acinclude.m4 (X86_64_PATTERN): Likewise.
- * config.sub: Likewise.
- * configure.in: Rudimentarily support new AMD processors.
-
- * configure.in (--enable_assembly): New option.
- (target none-*-*): Disable, give error.
-
-2010-11-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/x86-defs.m4 (LEA): Support non-PIC code.
- * mpn/x86/darwin.m4 (LEA): Likewise.
-
- * tests/amd64call.asm: Rewrite for code size, and to match calls and
- returns.
-
- * tests/x86call.asm: Rewrite for code size, to support PIC, and to
- match calls and returns.
- * tests/x86check.c: Rewrite.
-
-2010-11-22 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/get_str.c: Make all bases either work or return an error.
- * mpz/out_str.c: Likewise.
- * mpq/get_str.c: Likewise.
- * mpf/get_str.c: Likewise.
-
-2010-11-14 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/misc/t-printf.c: Add explicit casts for type conversions.
- * mpn/generic/toom62_mul.c: Likewise.
-
-2010-11-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/get_d.c: Misc cleanup. Fail with a syntax error for
- non-IEEE fp formats.
-
- * tests/devel/try.c (malloc_region): Add explicit casts for type
- conversions.
-
- * acinclude.m4 (GMP_ASM_RODATA): Make test code snippet C++ compatible.
- (GMP_C_DOUBLE_FORMAT): Likewise.
- (GMP_FUNC_VSNPRINTF): Likewise.
-
- * config.guess (x86): Make test C snippet C++ compatible.
-
-2010-11-12 Torbjorn Granlund <tege@gmplib.org>
-
- * Makefile.am: Remove mpbsd.
- * configure.in: Remove mpbsd.
- * doc/configuration: Remove mpbsd mentions.
- * doc/gmp.texi: Remove mpbsd docs.
- * tests/Makefile.am: Remove mpbsd.
- * libmp.sym: Remove.
- * mpbsd: Remove directory and files.
- * tests/mpbsd: Remove directory and files.
-
-2010-11-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/atom/aors_n.asm: Don't rely on ZF after 'bt' insn.
- Use 64-bit 'test' to support operands of 2^32 limbs and more.
-
- * rand: New directory, move rand*.c and randmt.h here.
- * rand/Makefile.am: New file.
- * Makefile.am (SUBDIRS): Add rand.
- (RANDOM_OBJECTS): New variable.
- (libgmp_la_SOURCES): Remove random objects.
- (libgmp_la_DEPENDENCIES): Add RANDOM_OBJECTS.
- * configure.in (AC_OUTPUT): Add rand/Makefile.
-
- * ansi2knr.1: File removed.
- * ansi2knr.c: File removed.
-
-2010-11-10 Torbjorn Granlund <tege@gmplib.org>
-
- Make it possible to compile GMP with g++:
-
- * gmp-impl.h: Declare __gmp_digit_value_tab here.
- * mpbsd/min.c: ...not here.
- * mpbsd/xtom.c: ...nor here.
- * mpf/set_str.c: ...nor here.
- * mpz/inp_str.c: ...nor here.
- * mpz/set_str.c: ...nor here.
-
- * mpn/generic/toom43_mul.c: Add casts for logical operations on enums.
- * mpn/generic/toom44_mul.c: Likewise.
- * mpn/generic/toom4_sqr.c: Likewise.
- * mpn/generic/toom52_mul.c: Likewise.
- * mpn/generic/toom53_mul.c: Likewise.
- * mpn/generic/toom62_mul.c: Likewise.
-
- * mpz/clrbit.c: Clean up typing using MPZ_REALLOC.
- * mpz/setbit.c: Likewise.
-
- * mpz/powm.c: Avoid variable name 'new'.
-
- * randlc2x.c: Add explicit casts for type conversions.
- * tests/misc/t-printf.c: Likewise.
- * tests/misc/t-scanf.c: Likewise.
- * tests/misc.c: Likewise.
- * tests/mpz/convert.c: Likewise.
- * tests/refmpn.c: Likewise.
-
- * tests/tests.h: Unconditionally use <sstream> for now.
-
- * tests/memory.c: Include "tests.h.
-
- * mp_get_fns.c: Add a __GMP_NOTHROW for coherency with prototype.
- * mp_set_fns.c: Likewise.
- * mpf/cmp.c: Likewise.
- * mpf/cmp_si.c: Likewise.
- * mpf/cmp_ui.c: Likewise.
- * mpf/fits_s.h: Likewise.
- * mpf/fits_u.h: Likewise.
- * mpf/get_dfl_prec.c: Likewise.
- * mpf/get_prc.c: Likewise.
- * mpf/get_si.c: Likewise.
- * mpf/get_ui.c: Likewise.
- * mpf/int_p.c: Likewise.
- * mpf/set_dfl_prec.c: Likewise.
- * mpf/set_prc_raw.c: Likewise.
- * mpf/size.c: Likewise.
- * mpf/swap.c: Likewise.
- * mpq/equal.c: Likewise.
- * mpq/swap.c: Likewise.
- * mpz/cmp.c: Likewise.
- * mpz/cmp_si.c: Likewise.
- * mpz/cmp_ui.c: Likewise.
- * mpz/cmpabs.c: Likewise.
- * mpz/cmpabs_ui.c: Likewise.
- * mpz/cong_2exp.c: Likewise.
- * mpz/divis_2exp.c: Likewise.
- * mpz/fits_s.h: Likewise.
- * mpz/get_si.c: Likewise.
- * mpz/hamdist.c: Likewise.
- * mpz/scan0.c: Likewise.
- * mpz/scan1.c: Likewise.
- * mpz/sizeinbase.c: Likewise.
- * mpz/swap.c: Likewise.
- * mpz/tstbit.c: Likewise.
- * tal-reent.c: Likewise.
-
-2010-11-09 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Get rid of K&R support.
- * Makefile.am: Likewise.
- * mpn/Makefile.am: Likewise.
- * doc/configuration: Update docs wrt K&R support.
- * doc/gmp.texi: Likewise.
-
- * configure.in (AC_INIT): Amend bug reporting address with manual
- reference.
-
-2010-11-06 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: If cpuid says we have 32bit-only x86 but
- configfsf.guess return x86_64, return the latter.
-
- * mpn/x86_64/aors_n.asm: Rewrite not to rely on ZF after 'bt' insn.
-
-2010-10-09 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/trialdiv.c: Update documentation.
-
-2010-10-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/gcd_1.asm: Use m4_lshift to avoid << operator.
- * mpn/x86_64/aorrlshC_n.asm: Likewise.
- * 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>
-
- Suggested by Ozkan Sezer:
- * configure.in: If $M4 is already set in the environment, don't
- touch it. Fixed the case that no assembler files are used, and
- GMP_PROG_M4 is omitted.
-
-2010-08-08 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/fat/fat.c: Recognise many more processors.
-
-2010-06-30 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/divrem_2.asm: Tune.
-
-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.
-
-2010-06-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p_cps): Rewrite.
- * mpn/x86_64/mod_1_2.asm (mpn_mod_1s_2p_cps): Rewrite.
- * mpn/x86_64/mod_1_4.asm (mpn_mod_1s_4p_cps): Rewrite.
-
- * gmp-impl.h (udiv_rnd_preinv): Simplify.
-
- * mpn/x86/k7/mod_1_1.asm: New file.
- * mpn/x86/pentium4/sse2/mod_1_1.asm (mpn_mod_1_1p_cps): Rewrite.
- * mpn/x86/k7/mod_1_4.asm (mpn_mod_1s_4p_cps): Rewrite.
- * mpn/x86/pentium4/sse2/mod_1_4.asm (mpn_mod_1s_4p_cps): Rewrite.
-
- * mpn/generic/mod_1_1.c (mpn_mod_1_1p_cps): Store results as they are
- computed.
- * mpn/generic/mod_1_2.c (mpn_mod_1s_2p_cps): Likewise.
- * mpn/generic/mod_1_4.c (mpn_mod_1s_4p_cps): Likewise.
-
- * mpn/x86/k7/invert_limb.asm: Moved from mpn/x86/invert_limb.asm.
-
-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.
-
-2010-05-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mu_div_qr.c (mpn_preinv_mu_div_qr_itch): Trim out space
- for inverse, since that is passed in already.
-
-2010-05-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mu_div_qr.c (mpn_preinv_mu_div_qr_itch): New function.
- * gmp-impl.h: Declare it.
- * tune/common.c (speed_mpn_mupi_div_qr): Use new itch function.
- * tune/speed.h (SPEED_ROUTINE_MPN_MUPI_DIV_QR): Pass parameters right
- for new itch function.
-
- * mpn/powerpc32/lshiftc.asm: New file.
-
-2010-05-22 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mod_1): Revert to version of 2010-05-06.
-
-2010-05-17 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (ia64): Get 32-bit sizeof test right.
-
- * tune/tuneup.c (tune_mod_1): Undo unintensional change to tuning of
- PREINV_MOD_1_TO_MOD_1_THRESHOLD.
-
-2010-05-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sparc64/mod_1.c: Rewrite.
- * mpn/sparc64/sparc64.h (umul_ppmm_s): New macro.
- * mpn/sparc64/mod_1_4.c: New file.
-
- * mpn/generic/divrem_1.c: Minor cleanup.
- * mpn/generic/mod_1.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.
-
- * configure.in (ia64-hpux): Do sizeof tests for 32-bit and 64-bit ABI.
-
- * tune/tuneup.c (tune_mod_1): Completely finish MOD_1_N tuning before
- tuning MOD_1U_TO_MOD_1_1_THRESHOLD.
-
-2010-05-14 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/redc_2.c: Use asm code just for GNU C.
-
-2010-05-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sparc64/ultrasparc1234: New directory. Move all code that uses
- floating-point into this directory.
- * configure.in: Point to ultrasparc1234 for appropriate CPUs.
-
- * mpn/sparc64/ultrasparct1/add_n.asm: New file.
- * mpn/sparc64/ultrasparct1/addlsh2_n.asm: New file.
- * mpn/sparc64/ultrasparct1/addmul_1.asm: New file.
- * mpn/sparc64/ultrasparct1/lshift.asm: New file.
- * mpn/sparc64/ultrasparct1/mul_1.asm: New file.
- * mpn/sparc64/ultrasparct1/rsblsh2_n.asm: New file.
- * mpn/sparc64/ultrasparct1/rshift.asm: New file.
- * mpn/sparc64/ultrasparct1/sublsh1_n.asm: New file.
- * mpn/sparc64/ultrasparct1/sublshC_n.asm: New file.
- * mpn/sparc64/ultrasparct1/addlsh1_n.asm: New file.
- * mpn/sparc64/ultrasparct1/addlshC_n.asm: New file.
- * mpn/sparc64/ultrasparct1/lshiftc.asm: New file.
- * mpn/sparc64/ultrasparct1/rsblsh1_n.asm: New file.
- * mpn/sparc64/ultrasparct1/rsblshC_n.asm: New file.
- * mpn/sparc64/ultrasparct1/sub_n.asm: New file.
- * mpn/sparc64/ultrasparct1/sublsh2_n.asm: New file.
- * mpn/sparc64/ultrasparct1/submul_1.asm: New file.
- * mpn/sparc64/ultrasparct1/gmp-mparam.h: New file.
-
- * configure.in: Give ultrasparct1 and ultrasparct2 special code path.
-
- * mpn/x86_64/pentium4/gmp-mparam.h: Disable mpn_addlsh_n, mpn_rsblsh_n.
-
-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.
-
- * tune/common.c (speed_mpz_powm_sec): New function.
- * tune/speed.h: Declare speed_mpz_powm_sec.
- * tune/speed.c (routine): Added speed_mpz_powm_sec.
-
- * tune/common.c (speed_mpn_addlsh_n, speed_mpn_sublsh_n)
- (speed_mpn_rsblsh_n): New functions.
- * tune/speed.h: Declare new functions.
- * tune/speed.c (routine): Add new functions.
-
-2010-05-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mod_1_4.asm: Tune for more processors.
-
- * mpn/x86_64/pentium4/lshiftc.asm: New file.
-
-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.
-
- * tests/mpz/t-jac.c (check_large_quotients): Reduced test sizes.
- (check_data): One more input pair related to a fixed bug.
- (main): Enable check_large_quotients.
-
-2010-05-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/aorrlsh2_n.asm: Fix typo.
-
-2010-05-09 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/aorrlshC_n.asm: New file based on aorrlsh2_n.asm.
- * mpn/x86_64/aorrlsh2_n.asm: Now just include aorrlshC_n.asm.
- * mpn/x86_64/core2/aorrlsh1_n.asm: New file, include ../aorrlshC_n.asm.
- * mpn/x86_64/core2/aorrlsh2_n.asm: Likewise.
-
- * mpn/x86_64/core2/sublshC_n.asm: New file based on aorslsh1_n.asm.
- * mpn/x86_64/core2/aorslsh1_n.asm: Remove.
- * mpn/x86_64/core2/sublsh1_n.asm: Just include sublshC_n.asm.
- * mpn/x86_64/core2/sublsh2_n.asm: Likewise.
-
-2010-05-08 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/atom/gmp-mparam.h: Disable mpn_rsh1add_n, mpn_rsh1sub_n.
-
- * mpn/x86_64/pentium4/aorslshC_n.asm: New file based on aorslsh1_n.asm.
- * mpn/x86_64/pentium4/aorslsh1_n.asm: Now just include aorslshC_n.asm.
- * mpn/x86_64/pentium4/aorslsh2_n.asm: New file.
-
-2010-05-07 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/sparc64: Support operands of >= 2^32 limbs.
-
- * mpn/sparc64/lshiftc.asm: New file.
-
- * mpn/ia64/divrem_2.asm: Complete rewrite.
-
-2010-05-06 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (all): Don't call tune_divrem_2.
-
- * mpn/generic/divrem_2.c: Complete rewrite.
-
- * tune/tuneup.c (tune_mod_1): Fix typo.
-
-2010-05-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mod_1_1.asm (mpn_mod_1_1p): Use macro register names.
- (mpn_mod_1_1p_cps): Rewrite.
-
- * mpn/generic/mod_1_1.c (mpn_mod_1_1p_cps): Micro-optimise.
-
- * longlong.h: Undo 2009-03-01 change for powerpc64, it gives poor code.
-
- * mpn/x86/pentium4/sse2/mod_1_1.asm: New file.
-
- * mpn/powerpc64/mode64/mod_1_1.asm: New file.
-
- * tune/tuneup.c (tune_mod_1): Use more typical divisor, for the benefit
- of machines with early-out multipliers.
-
-2010-05-04 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mod_1): Fix typo.
-
- * 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>
-
- * mpn/generic/jacobi_lehmer.c (jacobi_hook): New function.
- (mpn_jacobi_subdiv_step): Deleted function.
- (mpn_jacobi_lehmer): Use general mpn_gcd_subdiv_step.
-
- * mpn/generic/gcd_subdiv_step.c (mpn_gcd_subdiv_step): Reorganized
- to use a single hook function.
- * mpn/generic/gcdext.c (mpn_gcdext): Adapted to new hook
- interface.
- * mpn/generic/gcdext_lehmer.c (mpn_gcdext_hook): New unified hook
- function.
- * mpn/generic/gcd.c (gcd_hook): Renamed from gcd_done, and adapted
- to new hook interface.
- * gmp-impl.h (gcd_subdiv_step_hook): New typedef, now a function
- type, not a struct.
- (mpn_gcdext_hook): Declare.
-
-2010-05-03 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_1.c: Avoid multiply for 2 limb feed-in.
- * mpn/generic/mod_1_2.c: Likewise.
- * mpn/generic/mod_1_3.c: Likewise.
- * mpn/generic/mod_1_4.c: Likewise.
- * mpn/x86_64/mod_1_1.asm: Likewise.
- * mpn/x86_64/mod_1_2.asm: Likewise.
- * mpn/x86_64/mod_1_4.asm: Likewise.
- * mpn/x86/k7/mod_1_4.asm: Likewise.
- * mpn/x86/pentium4/sse2/mod_1_4.asm: Likewise.
- * mpn/alpha/ev6/mod_1_4.asm: Likewise.
-
- * tune/tuneup.c (tune_mod_1): Measure MOD_1_1_TO_MOD_1_2_THRESHOLD and
- MOD_1_2_TO_MOD_1_4_THRESHOLD before MOD_1U_TO_MOD_1_1_THRESHOLD for
- correctness.
-
- * mpn/powerpc64/sqr_diagonal.asm: Complete rewrite.
-
- * mpn/powerpc64/mode64/mod_1_4.asm: New file.
-
-2010-05-02 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: Recognise power7.
-
- * configure.in: Major overhaul of powerpc support.
-
- * mpn/powerpc64/p6/lshift.asm: New file.
- * mpn/powerpc64/p6/lshiftc.asm: Likewise.
- * mpn/powerpc64/p6/rshift.asm: Likewise.
-
-2010-04-30 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (powerpc64): Support CPU specific mode-less subdirs.
-
- * mpn/powerpc64/aix.m4 (PROLOGUE_cpu): Use "named csect" making
- requested alignment actually honoured.
-
-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>
-
- * configure.in (gmp_mpn_functions): Deleted gcdext_subdiv_step.
-
- * mpn/generic/gcdext.c (mpn_gcdext): Use new generalized
- mpn_gcd_subdiv_step.
-
- * mpn/generic/gcdext_lehmer.c (gcdext_update): New function.
- (gcdext_done): New function.
- (gcdext_hook): New const hook struct.
- (mpn_gcdext_lehmer_n): Use new generalized mpn_gcd_subdiv_step.
-
- * mpn/generic/gcd.c (gcd_done): New function.
- (gcd_hook): New const hook struct.
- (mpn_gcd): Adapted to new mpn_gcd_subdiv_step interface.
-
- * mpn/generic/gcd_subdiv_step.c (mpn_gcd_subdiv_step): Reorganized
- function. Added hook function pointers to the argument list, so
- the same function can be used for gcd, gcdext, and jacobi.
-
- * gmp-impl.h (struct gcd_subdiv_step_hook): New struct.
- (mpn_gcdext_subdiv_step): Deleted prototype.
- (struct gcdext_ctx): New struct.
- (gcdext_hook): Declare const struct.
- (mpn_gcd_subdiv_step): Updated prototype.
-
- * mpn/generic/gcdext_subdiv_step.c: Deleted file.
-
-2010-04-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/lshift.asm: Rewrite.
- * mpn/powerpc64/rshift.asm: Likewise.
- * mpn/powerpc64/mode64/lshiftc.asm: New file.
-
- * mpn/powerpc64/aix.m4: Align functions to 32-byte boundary.
- * mpn/powerpc64/darwin.m4: Likewise.
- * mpn/powerpc64/elf.m4: Likewise.
-
-2010-04-28 Niels Möller <nisse@lysator.liu.se>
-
- * tests/mpz/t-jac.c (check_data): Added some more test cases.
-
- * mpn/generic/jacobi_lehmer.c (mpn_jacobi_2): Bugfix, count
- trailing zeros, not leading.
-
-2010-04-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/p6/mul_basecase.asm: New file.
-
-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/generic/gcd.c (gcd_2): Moved from gcd_lehmer.c.
- (mpn_gcd): Inlined the code from mpn_gcd_lehmer_n. Also use
- MPN_GCD_SUBDIV_STEP_ITCH rather than MPN_GCD_LEHMER_N_ITCH.
-
-2010-04-22 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/bdiv_dbm1c.asm: Swap multiply insns to make them
- consecutive, for the benefit of POWER6.
-
- * mpn/powerpc64/mode64/p6/gmp-mparam.h: New file.
-
-2010-04-21 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/gcd_lehmer.c: Deleted file.
-
- * mpn/powerpc64/mode64/divrem_1.asm: Swap multiply insns to make them
- consecutive, for the benefit of POWER6.
- * mpn/powerpc64/mode64/dive_1.asm: Likewise.
- * mpn/powerpc64/mode64/divrem_2.asm: Likewise.
- * mpn/powerpc64/mode64/mul_1.asm: Likewise.
- * mpn/powerpc64/mode64/aorsmul_1.asm: Likewise.
-
- * 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>
-
- * mpz/jacobi.c (mpz_jacobi): New implementation using
- mpn_jacobi_lehmer. Currently #if:ed out.
-
- * mpn/generic/jacbase.c (mpn_jacobi_base)
- [JACOBI_BASE_METHOD < 4]: Support inputs with a >= b.
-
- * gmp-impl.h (mpn_jacobi_lehmer): Added prototype.
- (jacobi_table): Declare.
- (mpn_jacobi_init): New inline function.
- (mpn_jacobi_finish): Likewise.
- (mpn_jacobi_update): Likewise.
-
- * mpn/generic/jacobi_lehmer.c (mpn_jacobi_lehmer): New file, new
- function.
-
- * configure.in (gmp_mpn_functions): Added jacobi_lehmer.
-
-2010-04-14 Niels Möller <nisse@lysator.liu.se>
-
- * configure.in (gmp_mpn_functions): Added
- matrix22_mul1_inverse_vector.
- * mpn/Makefile.am (nodist_EXTRA_libmpn_la_SOURCES): Added
- matrix22_mul1_inverse_vector.c.
-
- * gmp-impl.h (mpn_matrix22_mul1_inverse_vector): Updated for
- rename of mpn_matrix22_mul1_inverse_vector.
- * mpn/generic/gcd_lehmer.c (mpn_gcd_lehmer_n): Likewise.
- * mpn/generic/gcdext_lehmer.c (mpn_gcdext_lehmer_n): Likewise.
- * mpn/generic/hgcd.c (hgcd_step): Likewise.
-
- * mpn/generic/matrix22_mul1_inverse_vector.c
- (mpn_matrix22_mul1_inverse_vector): New file, function moved and
- renamed...
- * mpn/generic/hgcd2.c (mpn_hgcd_mul_matrix1_inverse_vector):
- ...from here.
-
-2010-04-12 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/t-toom6h.c (SIZE_LOG): Define.
- * tests/mpn/t-toom8h.c (SIZE_LOG): Likewise.
-
-2010-04-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/ia64/lorrshift.asm: Rewrite feed-in and wind-down code.
-
- * mpn/ia64/aorslsh1_n.asm: Adapt to new aorslsh1_n.
- * mpn/ia64/aorslsh1_n.asm: Likewise.
-
- * mpn/ia64/aors_n.asm: Complete rewrite.
- * mpn/ia64/aorslsh1_n.asm: Likewise.
-
- * mpn/ia64/add_n_sub_n.asm: Misc cleanups. Add slotting comments.
-
- * mpn/ia64/lshiftc.asm: New file.
-
- * mpn/x86_64/pentium4/gmp-mparam.h: No longer disable rsh1add_n and
- rsh1sub_n; instead disable rsblsh1_n, addlsh2_n, rsblsh2_n.
-
- * mpn/x86/divrem_2.asm: Use "orb" instead of "or" to work around
- Solaris assembler bug.
- * mpn/x86_64/mpn/x86_64/divrem_2.asm: Likewise.
-
- * mpn/x86/aors_n.asm: Use operand-less shift-by-1 insn form.
- * mpn/x86/pentium/aors_n.asm: Likewise.
- * mpn/x86_64/invert_limb.asm: Likewise.
-
- * mpn/x86_64/pentium4/aors_n.asm: Let non-nc code fall into nc code.
-
- * mpn/x86_64/pentium4/rsh1aors_n.asm: New file.
-
-2010-03-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/ia64/add_n_sub_n.asm: New file.
-
- * mpn/generic/toom33_mul.c: Fix mpn_add_n_sub_n usage.
- * mpn/generic/toom3_sqr.c: Likewise.
- * mpn/generic/toom63_mul.c: Likewise.
-
- * mpn/generic/add_n_sub_n.c: Renamed from addsub_n.c.
-
-2010-03-23 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/divrem_2.asm: Use mpn_invert_limb instead of div insn.
-
- * mpn/ia64/aorslshC_n.asm: New file, generalised from last iteration of
- aorslsh1_n.asm.
- * mpn/ia64/aorslsh1_n.asm: Use aorslshC_n.asm.
- * mpn/ia64/aorslsh1_n.asm: New file, use aorslshC_n.asm.
-
-2010-03-20 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/invert_limb.asm: Rewrite to exploit cancellation
- in the Newton iteration.
-
-2010-03-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_interpolate_8pts.c: Use mpn_sublsh2_n.
-
-2010-03-20 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/powerpc64/mode64/aorslshC_n.asm: New file, generalised from
- last iteration of aorslsh1_n.asm.
- * mpn/powerpc64/mode64/aorslsh1_n.asm: Use aorslshC_n.asm.
- * mpn/powerpc64/mode64/aorslsh1_n.asm: New file, use aorslshC_n.asm.
-
-2010-03-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/nano/dive_1.asm: New file.
-
- * mpn/x86_64/divrem_1.asm: Avoid shld since it is slow on several CPU
- types. Unconditionally provide code for normalised and unnormalised
- divisors. Cleanup labels.
-
- * mpn/x86_64/core2/divrem_1.asm: Remove special code for normalised
- divisors. Cleanup labels.
-
- * mpn/generic/toom_interpolate_6pts.c: Call mpn_sublsh2_n and
- mpn_sublsh_n with correct args.
-
- * tests/devel/try.c: Use enum for TYPE_*.
-
- * tests/devel/try.c: Test mpn_sublsh2_n.
- * tests/refmpn.c (refmpn_sublsh2_n): New function.
- * tests/tests.h (refmpn_sublsh2_n): Declare.
-
- * mpn/powerpc64/mode64/aorslsh1_n.asm: New file, with faster
- mpn_addlsh1_n and mpn_sublsh1_n.
- * mpn/powerpc64/mode64/addlsh1_n.asm: Delete.
- * mpn/powerpc64/mode64/sublsh1_n.asm: Delete.
-
-2010-03-18 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (*-*-aix): Define gcc_32_cflags_maybe, ar_32_flags and
- nm_32_flags.
-
- * mpn/x86/pentium4/sse2/addlsh1_n.asm: Tune for slightly better speed.
- Misc cleanups. Add cycle table.
-
- * mpn/x86_64/copyi.asm: Update cycle table.
- * mpn/x86_64/copyd.asm: Likewise.
- * mpn/x86_64/rsh1aors_n.asm: Likewise.
- * mpn/x86_64/dive_1.asm: Likewise.
-
- * mpn/x86/pentium4/sse2/add_n.asm: Misc cleanups. Add cycle table.
- * mpn/x86/pentium4/sse2/sub_n.asm: Likewise.
-
-2010-03-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/divrem_1.asm: Use mpn_invert_limb instead of div insn.
- * mpn/x86_64/core2/divrem_1.asm: Likewise.
-
- * tune/speed.c (routine): Add FLAG_R_OPTIONAL for many binops.
-
-2010-03-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/alpha/ev6/mod_1_4.asm (mpn_mod_1s_4p_cps): Rewrite.
-
- * mpn/ia64/aors_n.asm: Insert explicitly typed nops to trigger intended
- bundling.
- * mpn/ia64/aorslsh1_n.asm: Likewise.
- * mpn/ia64/dive_1.asm: Likewise.
-
-2010-03-13 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/pentium4/sse2/submul_1.asm: Rewrite.
-
- * mpn/powerpc64/mode64/aorsmul_1.asm: New file, faster than old code
- for both mpn_addmul_1 and mpn_submul_1.
- * mpn/powerpc64/mode64/addmul_1.asm: Remove.
- * mpn/powerpc64/mode64/submul_1.asm: Remove.
-
-2010-03-11 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/gcd_lehmer.c (gcd_2): Use sub_ddmmss.
-
- * mpn/generic/jacbase.c (mpn_jacobi_base): Reorganized the
- JACOBI_BASE_METHOD 4 slightly. Now requires that b > 1.
-
-2010-03-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/divrem_1.asm: Make fraction code take documented # of
- cycles. Annotate code for more CPUs. Misc cleanups.
- * mpn/x86_64/core2/divrem_1.asm: Annotate code for more CPUs.
-
- * mpn/alpha/ev6/mod_1_4.asm: New file.
-
- * mpn/ia64/mod_34lsub1.asm: New file.
-
- * doc/gmp.texi (Language Bindings): Update Python site, add Ruby.
-
-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.
- * tune/common.c (speed_mpn_jacobi_base_4): New function.
- * tune/speed.h (speed_mpn_jacobi_base_4): Declare it.
- * tune/Makefile.am (libspeed_la_SOURCES): Added jacbase4.c.
- * tune/jacbase4.c: New file.
-
- * mpn/generic/jacbase.c (mpn_jacobi_base): New function, for
- JACOBI_BASE_METHOD 4.
-
-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.
-
-2010-03-09 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpz/t-bin.c (randomwalk): New test-generator function.
-
-2010-03-07 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.c (routine): Force r argument for several mod_1 calls.
-
-2010-03-06 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/divrem_1.asm: Disable SPECIAL_CODE_FOR_NORMALIZED_DIVISOR.
- Misc clean up.
-
- * mpn/x86_64/mod_1_1.asm: New file.
- * mpn/x86_64/mod_1_2.asm: New file.
- * mpn/x86_64/mod_1_4.asm: Update cycle counts.
-
- * tests/tests.h (TESTS_REPS): Fix typo.
-
-2010-03-03 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/core2/divrem_1.asm: New file.
-
-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>
-
- * tests/mpz/t-jac.c (check_large_quotients): New test. Currently
- disabled, since it's quite slow.
- (mpz_nextprime_step): New function.
-
-2010-02-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/pa64/aors_n.asm: Fix typo in last change.
-
-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.
-
- * tests/devel/try.c (param_init, call): Don't pass negative values
- for the second argument to mpz_jacobi and refmpz_jacobi.
-
- * tests/refmpz.c (refmpz_jacobi): Require that b is odd and positive.
-
- * tests/devel/try.c (param_init): Support mpz_legendre.
- (choice_array): Added mpz_kronecker (apparently forgotten) and
- mpz_legendre.
- (call): Added TYPE_MPZ_LEGENDRE.
- (try_one): Added support for DATA_SRC1_ODD_PRIME.
-
- * tests/refmpz.c (refmpz_legendre): Rewrote using powm.
-
-2010-02-25 Torbjorn Granlund <tege@gmplib.org>
-
- * config.guess: Make "corei" default for unrecognised Intel P6 CPUs.
-
- * tests/mpz/t-perfpow.c (check_random): Use mp_limb_t type for limb
- variables.
-
- * tests/mpn/t-toom6h.c (COUNT): Define.
- * tests/mpn/t-toom8h.c (COUNT): Define.
-
- * tests/mpn/t-div.c: Cast a switch index to placate HP's cc.
- * tests/mpn/t-bdiv.c: Likewise.
-
- * mpn/pa64/aors_n.asm: Fix support of the 2.0n ABI.
-
-2010-02-24 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpz/t-bin.c (data): Replace (2k,k), tested by twos ().
- * tests/mpf/t-inp_str.c (data): Test also "+" in the exponent.
-
-2010-02-23 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_3.c: Cast a switch index to placate HP's cc.
-
- * mpn/generic/sqrtrem.c: Use CNST_LIMB.
-
-2010-02-20 Niels Möller <nisse@lysator.liu.se>
-
- * tune/speed.h (mpn_gcd_accel): Deleted prototype.
- (mpn_hgcd_lehmer): New prototype.
- (MPN_HGCD_LEHMER_ITCH): New macro (previously in gmp-impl.h).
-
- * tune/Makefile.am (libspeed_la_SOURCES): Added hgcd_lehmer.c.
- * tune/hgcd_lehmer.c: New file.
- * tune/gcd_accel.c: Deleted obsolete file.
-
- * gmp-impl.h (MPN_HGCD_LEHMER_ITCH): Deleted macro.
-
- * mpn/generic/hgcd.c (mpn_hgcd_lehmer): Deleted function,
- (mpn_hgcd): Don't call mpn_hgcd_lehmer, instead use inlined loop
- around hgcd_step.
- (mpn_hgcd_itch): Substitute n for MPN_HGCD_LEHMER_ITCH (n).
-
-2010-02-19 Niels Möller <nisse@lysator.liu.se>
-
- * Makefile.am (mpn/jacobitab.h): Added the rules needed to
- generate this file.
-
- * gen-jacobitab.c: New file.
-
-2010-02-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm.c: Honour SQR_BASECASE_THRESHOLD in innerloop
- expansions.
-
-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>
-
- * tune/time.c (speed_time_init): Make use of cycle counter
- configurable, via the speed_option_cycles_broken flag.
- * tune/common.c (speed_option_cycles_broken): New global variable.
- (speed_option_set): Recognize option "cycles-broken".
-
- * tune/time.c (cycles_works_p): Deleted hack to disable cycle
- counter on linux. Needs to be replaced by something more
- selective.
-
-2010-02-11 Niels Möller <nisse@lysator.liu.se>
-
- * tune/time.c (speed_time_init): Fix speed_time_string when using
- clock_gettime.
- (cycles_works_p): On linux, don't use the cycle counter.
-
- * tune/Makefile.am: Add $(TUNE_LIBS) when linking programs.
-
- * configure.in: Check if -lrt is needed for clock_gettime, and if
- so, add that flag to TUNE_LIBS.
-
-2010-02-07 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_redc): Set min_size and min_is_always when
- measuring REDC_1_TO_REDC_2_THRESHOLD.
- (tune_mod_1): Set min_size for PREINV_MOD_1_TO_MOD_1_THRESHOLD.
-
- * mpn/x86_64/aorrlsh_n.asm (cnt): Fix a typo.
- * mpn/x86_64/lshsub_n.asm: Likewise.
-
-2010-02-05 Torbjorn Granlund <tege@gmplib.org>
-
- * Version 5.0.1 released.
-
- * mpn/generic/powm.c: Use rp target area for power table computation in
- order to use less scratch.
-
- * mpn/generic/binvert.c (mpn_binvert_itch): Enable more economical
- mpn_mulmod_bnm1_itch call.
-
- * mpn/generic/mu_div_qr.c: Remove always true #if.
- * mpn/generic/mu_divappr_q.c: Likewise.
- * mpn/generic/mu_bdiv_q.c: Likewise.
- * mpn/generic/mu_bdiv_qr.c: Likewise.
-
-2010-02-01 Torbjorn Granlund <tege@gmplib.org>
-
- * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*, LIBMP_LT_*):
- Bump version info.
-
- * mpn/powerpc64/mode64/gmp-mparam.h: Remove {MUL,SQR}_FFT_TABLE2.
- * mpn/x86/p6/gmp-mparam.h: Likewise.
- * mpn/x86/p6/mmx/gmp-mparam.h: Likewise.
- * mpn/generic/mul_fft.c: Don't depend on FFT_TABLE2, it was broken.
-
-2010-01-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mul_fft.c (mpn_mul_fft_internal): Remove arguments n, m,
- k and rec; add argument sqr. Don't call mpn_mul_fft_decompose here,
- instead do that in all callers.
- (mpn_mul_fft): Trim allocation when squaring, and use TMP_ALLOC*, not
- explicit alloc/free.
- (mpn_fft_div_2exp_modF): Avoid a scalar division.
- (mpn_fft_mul_modF_K): Replace some multiplies by K with shifting by k.
- (mpn_fft_mul_2exp_modF): Make function more symmetrical.
-
-2010-01-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mu_div_q.c (mpn_mu_div_q_itch): Rewrite.
- * mpn/generic/mu_div_qr.c (mpn_mu_div_qr_itch): Re-enable
- better mulmod itch estimate.
- * mpn/generic/mu_divappr_q.c (mpn_mu_divappr_q_itch): Likewise.
- * mpn/generic/mu_bdiv_qr.c (mpn_mu_bdiv_qr_itch): Likewise.
- * mpn/generic/mu_bdiv_q.c (mpn_mu_bdiv_q_itch): Likewise.
-
-2010-01-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mu_div_qr.c (mpn_mu_div_qr_itch): Disabled guessed
- estimate, enabled a conservative one.
- * mpn/generic/mu_divappr_q.c (mpn_mu_divappr_q_itch): Likewise.
- * mpn/generic/mu_bdiv_qr.c (mpn_mu_bdiv_qr_itch): Likewise.
- * mpn/generic/mu_bdiv_q.c (mpn_mu_bdiv_q_itch): Likewise.
-
-2010-01-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1): Partial rewrite to
- reduce memory usage.
- * mpn/generic/sqrmod_bnm1.c (mpn_sqrmod_bnm1): Likewise.
- (mpn_sqrmod_bnm1_next_size): New function.
-
- * gmp-impl.h (mpn_mulmod_bnm1_itch): Accepts 3 parameters now.
- (mpn_sqrmod_bnm1_itch): New inline function.
- (mpn_sqrmod_bnm1_next_size): Declaration and mangling.
- * mpn/generic/nussbaumer_mul.c: Use the new functions.
-
- * mpn/generic/invertappr.c (mpn_ni_invertappr): Use new syntax for
- mpn_mulmod_bnm1_itch.
- * mpn/generic/mu_divappr_q.c (mpn_mu_divappr_q_itch): Likewise.
- * mpn/generic/mu_bdiv_qr.c (mpn_mu_bdiv_qr_itch): Likewise.
- * mpn/generic/mu_bdiv_q.c (mpn_mu_bdiv_q_itch): Likewise.
- * mpn/generic/mu_div_qr.c (mpn_mu_div_qr_itch): Likewise.
- * mpn/generic/binvert.c (mpn_binvert_itch): Likewise.
- * tune/speed.h (SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL): Likewise.
- (SPEED_ROUTINE_MPN_MULMOD_BNM1_ROUNDED): Likewise.
-
- * tests/mpn/t-sqrmod_bnm1.c, tests/mpn/t-mulmod_bnm1.c: Test
- reduced memory usage.
-
-2010-01-25 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (INSERT_FFTTAB): New macro, like old insertion code but
- also inserting a sentinel.
- (fftmes): Use INSERT_FFTTAB for inserting new measurements.
- Limit k range to best_k - 4 ... best_k + 4.
-
-2010-01-23 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-h.in (__GNU_MP_VERSION_PATCHLEVEL): Bump.
- (__GMP_MP_RELEASE): New macro.
-
- * mpf/div.c: Rewrite to use mpn_div_q.
-
-2010-01-21 Torbjorn Granlund <tege@gmplib.org>
-
- * Add FFT_TABLE3 tables for a basic set of machines.
-
- * configure.in: Use -mtune=nocona for 64-bit pentium4.
-
- * config.guess: Recognise many more Intel processors.
-
- * tune/common.c: Whitespace cleanup.
- (speed_mpn_matrix22_mul): Rewrite.
-
-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.
-
- * tests/mpn/t-mulmod_bnm1.c (ref_mulmod_bnm1, main): Adapted to
- mpn_mulmod_bnm1 interface change.
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1): Interface change,
- in case an + bn < rn, only write an + bn output limbs. New input
- requirement, an + bn > rn/2.
- * mpn/generic/sqrmod_bnm1.c (mpn_sqrmod_bnm1): Corresponding
- changes.
-
-2010-01-19 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (fftmes): Round up initial n according to initial k.
- Limit k to 24 in loop. Remove an obsolete always-true condition.
- Remove a redundant trace printout.
-
-2010-01-18 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (fftmes): New function
- (fft): Rewrite.
- (mpn_mul_fft_lcm): New function, copied from mpn/generic/mul_fft.c.
- (fftfill): New function, code taken from mul_fft.c (mpn_mul_fft).
- (cached_measure): New function.
-
- * gmp-impl.h (struct fft_table_nk): Moved from mul_fft.c.
- (MUL_FFT_TABLE3, SQR_FFT_TABLE3): Provide dummy versions for tuneup
- builds.
- (FFT_TABLE3_SIZE): Increase value for tuneup builds.
-
- * mpn/generic/mul_fft.c: Handle a new FFT threshold table type ("3").
- Misc cleanups to old table type code.
-
-2010-01-16 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/darwin.m4: Fix typo in last change.
-
-2010-01-15 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-h.in (__GMP_EXTERN_INLINE): Remove "extern" for newer Sun C.
-
- * gmp-impl.h (GMP_LIMB_BYTES): New define.
-
- * mpn/x86_64/darwin.m4 (LEA): New define.
-
- * mpn/x86/invert_limb.asm (approx_tab): Use DEF_OBJECT.
- Rename and globalise it to work around Mac OS bug.
-
- With Philip McLaughlin:
- * mpn/x86_64/gcd_1.asm (ctz_table): Don't use local prefix, but
- use DEF_OBJECT...END_OBJECT.
- Keep stack pointer at ABI mandated alignment over call.
-
-2010-01-12 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.c (routine): Remove obsolete mpn_dc_tdiv_qr and
- mpn_dc_div_qr_n.
- * tune/common.c (speed_mpn_dc_tdiv_qr, speed_mpn_dcpi1_div_qr_n):
- Remove now unused functions.
- * tune/speed.h (SPEED_ROUTINE_MPN_DC_DIVREM_N,
- SPEED_ROUTINE_MPN_DC_DIVREM_SB, SPEED_ROUTINE_MPN_DC_TDIV_QR): Remove
- now unused macros.
-
- * mpn/x86_64/fat/fat_entry.asm (mpn_cpuid_available): Remove function.
-
- * ltmain.sh: Upgrade from 1.5.24 to 2.2.6b.
- * ylwrap: New file.
- * .bootstrap: Remove explicit versions.
-
- * doc/gmp.texi (Block-wise Barrett Division): New node.
-
- * mpn/generic/powm.c: Change some #if to plain 'if' to avoid fat build
- problems.
-
-2010-01-11 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.h (SPEED_ROUTINE_MPN_PI1_DIV): Accept arguments for size
- restrictions.
- * tune/common.c (speed_mpn_sbpi1_div_qr, speed_mpn_dcpi1_div_qr,
- (speed_mpn_sbpi1_divappr_q, speed_mpn_dcpi1_divappr_q): Pass size
- limits for SPEED_ROUTINE_MPN_PI1_DIV.
-
- * tune/speed.c (routine): Allow .r argument for mpn_sbpi1_divappr_q and
- mpn_dcpi1_divappr_q.
-
-2010-01-08 Torbjorn Granlund <tege@gmplib.org>
-
- * Version 5.0.0 released.
-
- * mpn/generic/div_q.c: Handle mpn_*_divappr_q returning high limb
- everywhere.
-
2010-01-07 Torbjorn Granlund <tege@gmplib.org>
- * Update MUL_FFT_TABLE2 and SQR_FFT_TABLE2 for many machines.
-
- * mpn/generic/mu_div_q.c: Account for divisor truncation error as well
- as mpn_mu_divappr_q's error.
-
- * mpn/generic/mu_div_q.c: Handle mpn_preinv_mu_divappr_q returning a
- high limb.
-
- * tests/mpn/t-bdiv.c: Move a random call for debugability.
- * tests/mpn/t-div.c: Likewise.
-
- * mpn/generic/mu_divappr_q.c: Rewrite quotient round-up code.
-
- * mpn/generic/mu_div_qr.c: Handle carry-out from a carry propagation
- subtract.
- * mpn/generic/mu_divappr_q.c: Likewise.
-
- * mpn/generic/mu_divappr_q.c
- (mpn_preinv_mu_divappr_q, mpn_mu_divappr_q): Declare dividend constant.
- * gmp-impl.h: Likewise.
-
- * perfpow.c (mpn_perfect_power_p): Call mpn_divexact instead of
- mpn_bdiv_q (with too little scratch space!).
-
- From Niels Möller:
- * tests/mpn/t-div.c (check_one): Get rid of the poorly managed variable
- tn.
-
- * mpn/minithres/gmp-mparam.h: Add all lately defined thresholds.
-
- * 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>
-
- * tests/mpn/t-div.c (check_one): Checking based on multiplication,
- refmpn_mul, rather than refmpn_tdiv_qr.
-
-2010-01-06 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom8h_mul.c: Avoid overflows of mp_size_t.
-
-2010-01-06 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-h.in (__GNU_MP__): Bump.
- (__GNU_MP_VERSION,__GNU_MP_VERSION_MINOR,__GNU_MP_VERSION_PATCHLEVEL):
- Bump version info.
- * mp-h.in (__GNU_MP__): Bump.
- * Makefile.am (LIBGMP_LT_*, LIBGMPXX_LT_*, LIBMP_LT_*):
- Bump version info.
-
- * doc/gmp.texi: Rewrite mpn_gcdext text. Remove some out-of-date
- text in Algorithms chapter.
-
- * mpn/generic/div_q.c: Properly handle np=scratch. Fix critical typo
- in final adjustment code. Misc cleanups.
-
- * mpn/generic/rootrem.c: Use mpn_div_q.
- * mpz/tdiv_q.c: Likewise.
-
- * tests/mpn/t-div.c: Test mpn_div_q.
- (SIZE_LOG): Up to 17.
-
- * mpn/generic/div_q.c: New file.
- * configure.in (gmp_mpn_functions): Add div_q.
-
- * mpn/generic/mu_div_q.c: Actually declare dividend constant.
-
-2010-01-04 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (fft): Separate tuning of modf and full products.
- (struct fft_param_t): New field, mul_modf_function.
- (tune_fft_sqr): Fix typo.
- (tune_fft_mul, tune_fft_sqr): Initialise mul_modf_function field.
- * tune/common.c (speed_mpn_fft_mul, speed_mpn_fft_sqr): New functions.
-
- * tune/speed.h (SPEED_ROUTINE_MPN_MULMOD_BNM1_ROUNDED): Clean up.
-
- * mpn/generic/mul.c: Simplify rational expression.
-
- * gmp-impl.h: Cleanup threshold variables; remove obsolete ones and
- make all possibly needed definitions for existing ones.
- * tune/tuneup.c (tune_mul): Write fractions-compensated values to
- threshold variables.
-
-2010-01-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tune/common.c, tune/speed.c, tune/speed.h: Support measuring
- mpn_toom43_mul.
-
- * mpn/generic/toom_interpolate_6pts.c: Small reorganisation.
-
-2010-01-03 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD): Default to
- INV_MULMOD_BNM1_THRESHOLD/2 instead.
-
- * gmp-impl.h (INV_APPR_THRESHOLD, INV_MULMOD_BNM1_THRESHOLD): Default
- here...
- * mpn/generic/invert.c, mpn/generic/invertappr.c: ...not here.
-
- * tests/mpn/t-div.c: Rewrite operand generation code.
-
-2010-01-02 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD): Default to
- INV_MULMOD_BNM1_THRESHOLD.
-
-2010-01-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/dcpi1_div_q.c: Handle divappr approximation problem more
- efficiently.
- * mpn/generic/mu_div_q.c: Likewise.
-
- * mpn/generic/invert.c: Remove duplicated code.
-
-2010-01-01 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD): Default to 0.
-
- * mpn/generic/mu_div_qr.c: Rewrite to use mpn_mulmod_bnm1. Clean up
- scratch usage. Improve itch functions.
- * mpn/generic/mu_divappr_q.c: Likewise.
- * mpn/generic/mu_bdiv_qr.c: Likewise.
- * mpn/generic/mu_div_q.c: Likewise.
-
- * mpn/generic/dcpi1_bdiv_qr.c: Add parameter ASSERTs.
- * mpn/generic/dcpi1_bdiv_q.c: Likewise.
-
- * tests/mpn/t-bdiv.c: Replace with unit testing code, based on t-div.c.
- Increase COUNT to 500.
-
- * tests/mpn/t-div.c: Avoid generating too small test operands.
- Move SB suppression limit downwards. Increase COUNT to 200.
-
-2009-12-31 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/tdiv_qr.c: Handle numerator/remainder overlap in MU case.
-
- * tests/tests.h (TESTS_REPS): New macro.
- * tests/mpz/dive.c: Use larger operands, decrease default reps, use
- TESTS_REPS.
- * tests/mpz/convert.c: Likewise.
- * tests/mpz/t-sqrtrem.c: Likewise.
- * tests/mpz/reuse: Likewise.
- * tests/mpz/t-root.c: Likewise.
- * tests/mpz/t-tdiv.c: Likewise.
- * tests/mpz/t-gcd.c: Likewise.
- * tests/mpz/t-powm.c: Likewise.
-
-2009-12-31 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom8_sqr.c (SQR_TOOM8_MAX): Avoid overflow.
- * mpn/generic/toom6_sqr.c (SQR_TOOM6_MAX): Likewise.
-
- * mpn/generic/mulmod_bnm1.c: Don't mention MISUSE any more,
- simply consider UNLIKELY any unexpected size.
-
-2009-12-31 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (speed_mpn_sbordcpi1_div_qr): New function.
- (tune_mu_div): Use it.
-
-2009-12-30 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mu_bdiv, tune_dc_bdiv, tune_mu_div)
- (tune_dc_div): Clear global s.r to make speed functions do 2n/n.
-
- * tune/speed.c (routine): New entries for mpn_mu_div_qr and
- mpn_mupi_div_qr. Allow .r parameter for mpn_sbpi1_div_qr,
- mpn_dcpi1_div_qr.
- * tune/speed.h (SPEED_ROUTINE_MPN_PI1_DIV, SPEED_ROUTINE_MPN_MU_DIV_QR)
- (SPEED_ROUTINE_MPN_MUPI_DIV_QR): Handle .r parameter.
-
- * tests/mpz/t-tdiv.c: Increase operands size again.
-
- * mpn/generic/tdiv_qr.c: Attempt to choose between DC and MU cleverer.
-
- * mpn/generic/tdiv_qr.c: Don't overwrite rp with unnecessary temporary
- alloc.
-
-2009-12-29 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mu_div): Tune MUPI_DIV_QR_THRESHOLD.
- * tune/speed.h (struct speed_params): Allow 3 source operands.
- (SPEED_ROUTINE_MPN_MUPI_DIV_QR): New macro.
- * tune/common.c (speed_mpn_mupi_div_qr): New function.
-
- * mpn/generic/tdiv_qr.c: Call mpn_mu_div_qr.
-
- * tests/mpz/t-tdiv.c: Use larger test operands.
-
- * mpn/generic/mu_div_qr.c (mpn_mu_div_qr2): Remove code for dn==1.
-
- * mpz/mul.c: Call mpn_sqr directly. Use PTR,SIZ,ALLOC.
-
- * tune/tuneup.c (tune_mu_div): Set min_size to 6, DC functions require
- this.
-
- * tests/mpn/t-div.c: Call mu_div functions with operands that generate
- a high quotient limb.
-
- * mpn/generic/mu_div_qr.c: Rewrite to return a high quotient limb,
- to let dividend argument be constant, and as a general cleanup.
- * mpn/generic/mu_divappr_q.c: Likewise.
- * mpn/generic/mu_div_q.c: Likewise.
- * gmp-impl.h: Update declarations of changed functions.
-
- * mpn/generic/invertappr.c (mpn_invertappr): Allocate scratch space
- when caller passed NULL.
-
-2009-12-28 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom_couple_handling.c: Prefix name with mpn_.
- * gmp-impl.h: Likewise.
- * mpn/generic/toom63_mul.c: Likewise.
- * mpn/generic/toom6_sqr.c: Likewise.
- * mpn/generic/toom6h_mul.c: Likewise.
- * mpn/generic/toom8_sqr.c: Likewise.
- * mpn/generic/toom8h_mul.c: Likewise.
-
- * configure.in (gmp_mpn_functions_optional) Move "com" from here...
- (gmp_mpn_functions): ...to here.
- * mpn/generic/com.c: New file.
- * (mpn_com): New name for mpn_com_n. Make public.
- * (mpn_neg): Analogous changes.
-
- * tune/tuneup.c (tune_mu_div, tune_mu_bdiv): Set step_factor.
-
- * tune/common.c, tune/speed.c, tune/speed.h: Support measuring
- mpn_lshiftc.
-
- * tests/devel/try.c: Test mpn_lshiftc.
- * tests/refmpn.c (refmpn_com): New function.
- (refmpn_lshiftc): Likewise.
-
- * configure.in (gmp_mpn_functions_optional) Move lshiftc from here...
- (gmp_mpn_functions): ...to here.
- * mpn/generic/lshiftc.c: New file.
- * mpn/x86_64/lshiftc.asm: New file.
- * mpn/x86_64/core2/lshiftc.asm: New file.
- * mpn/generic/mul_fft.c (mpn_lshiftc): Remove.
-
- * mpn/x86_64/core2/lshift.asm: Tweak for better Core iN performance.
- * mpn/x86_64/core2/rshift.asm: Likewise.
-
-2009-12-27 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mul.c: Use toom6h and toom8h for almost balanced.
-
- * mpn/generic/mullo_n.c (mpn_dc_mullo_n): New ratio, to be used in
- Toom-8 range.
+ * Version 4.3.2 released.
2009-12-27 Torbjorn Granlund <tege@gmplib.org>
- * (mpn_sqr): New name for mpn_sqr_n. Many files affected.
-
- * tune/tuneup.c (tune_mullo): Up step_factor for MULLO_MUL_N_THRESHOLD.
- (tune_invertappr, tune_invert, tune_binvert): Let max_size default.
-
- * tune/tuneup.c (tune_mu_div, tune_mu_bdiv) New functions.
- * tune/speed.h (SPEED_ROUTINE_MPN_MU_DIV_Q): New macro.
- (SPEED_ROUTINE_MPN_MU_DIV_QR): Likewise.
- (SPEED_ROUTINE_MPN_MU_BDIV_Q): Likewise.
- (SPEED_ROUTINE_MPN_MU_BDIV_QR): Likewise.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add bdiv_q.c and bdiv_qr.c.
- * tune/common.c (speed_mpn_mu_div_qr): New function.
- (speed_mpn_mu_divappr_q): Likewise.
- (speed_mpn_mu_div_q): Likewise.
- (speed_mpn_mu_bdiv_q): Likewise.
- (speed_mpn_mu_bdiv_qr): Likewise.
-
- * mpn/*/gmp-mparam.h: Fix incorrect MOD_1U_TO_MOD_1_1_THRESHOLD 0
- values.
-
- * gmp-impl.h (MODEXACT_1_ODD_THRESHOLD): Remove.
- (BMOD_1_TO_MOD_1_THRESHOLD): New parameter, with the reverse meaning of
- MODEXACT_1_ODD_THRESHOLD.
- (MPN_MOD_OR_MODEXACT_1_ODD): Use BMOD_1_TO_MOD_1_THRESHOLD.
- * mpn/generic/divis.c, mpz/{cong.c,cong_ui.c,divis_ui.c}: Likewise.
- * tune/tuneup.c (tune_modexact_1_odd): Tune BMOD_1_TO_MOD_1_THRESHOLD;
- Do not assume native mpn_modexact_1_odd is faster than mpn_mod_1.
- (tuned_speed_mpn_mod_1): Remove variable.
- (tune_mod_1): Fix thinkos. Suppress printing of "always" etc.
- (all): Measure for divrem_1, mod_1, divexact_1, etc first, since Toom
- depends on some of them.
-
- * 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>
-
- * tests/mpn/t-toom32.c (MIN_AN, MIN_BN, MAX_BN): Relax
- requirements a bit.
-
- * mpn/generic/toom32_mul.c (mpn_toom32_mul): Relax requirement on
- input sizes, to support s+t>=n (used to be s+t>=n+2). Keep high
- limbs of the evaluated values in scalar variables.
-
- * mpn/generic/sbpi1_divappr_q.c (mpn_sbpi1_divappr_q): Remove
- unused variables.
-
- * mpn/generic/toom32_mul.c (mpn_toom32_mul): Fixed left-over use
- of mpn_addsub_n which should be mpn_add_n_sub_n.
-
-2009-12-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add new toom files (spotted by Torbjorn).
-
- * gmp-impl.h (mpn_toom6_sqr_itch): Rename to mpn_toom6_mul_n_itch and redefine.
- (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>
+ * (mpn_sqr): New name for mpn_sqr_n. Make minimal changes,
+ leaving internal references still to old name.
- * tests/mpn/t-toom32.c (MIN_AN, MIN_BN, MAX_BN): Tightened requirements.
- * gmp-impl.h (mpn_toom32_mul_itch): Updated. Less scratch needed
- by toom32 itself, and also the pointwise multiplications are
- currently mpn_mul_n with no supplied scratch.
- * mpn/generic/toom32_mul.c (mpn_toom32_mul): Reorganized
- interpolation to use less scratch space. No longer supports the
- most extreme size ratios.
-
-2009-12-25 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_preinv_mod_1): Purge.
- (tune_mod_1): Use speed_mpn_mod_1_tune for
- PREINV_MOD_1_TO_MOD_1_THRESHOLD
-
- * mpn/generic/dcpi1_divappr_q.c: Handle 2n/n properly. Don't use full
- precision in mpn_sbpi1_divappr_q call. Misc cleanup.
-
- * tune/tuneup.c (tune_mod_1): Add a check_size for
- PREINV_MOD_1_TO_MOD_1_THRESHOLD.
-
-2009-12-24 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/mod_1_div.c (MOD_1N_TO_MOD_1_1_THRESHOLD,
- (MOD_1U_TO_MOD_1_1_THRESHOLD): Set.
- * tune/mod_1_inv.c (MOD_1N_TO_MOD_1_1_THRESHOLD,
- (MOD_1U_TO_MOD_1_1_THRESHOLD): Set.
-
- * gmp-impl.h (USE_PREINV_MOD_1): Remove.
- (MPN_MOD_OR_PREINV_MOD_1): Define to choose functions dynamically in
- terms of PREINV_MOD_1_TO_MOD_1_THRESHOLD (used to choose statically
- using USE_PREINV_MOD_1).
- * mpn/generic/perfsqr.c (PERFSQR_MOD_PP): Corresponding updates.
-
- * tune/tuneup.c (tune_mod_1): Rewrite.
- * gmp-impl.h (MOD_1N_TO_MOD_1_1_THRESHOLD): New.
- (MOD_1U_TO_MOD_1_1_THRESHOLD): New name for MOD_1_1_THRESHOLD.
- (MOD_1_1_TO_MOD_1_2_THRESHOLD): Mew name for MOD_1_2_THRESHOLD.
- (MOD_1_2_TO_MOD_1_4_THRESHOLD): New name for MOD_1_4_THRESHOLD.
- * mpn/generic/mod_1.c: Corresponding updates.
-
-2009-12-24 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mul_n.c: Use also toom6h and toom8h.
- * mpn/generic/sqr_n.c: Use also toom6 and toom8.
- * gmp-impl.h: Initial support for tuning of Toom-6half and Toom-8half.
- * tune/tuneup.c: Tune Toom-6half and Toom-8half thresholds.
-
-2009-12-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_4.c: Get ASSERT right.
- * mpn/generic/mod_1_3.c: Likewise.
- * mpn/generic/mod_1_2.c: Likewise.
-
- * mpn/generic/powm_sec.c: Use SQR_TOOM2_THRESHOLD as limit for a native
- mpn_sqr_basecase, not TUNE_SQR_TOOM2_MAX.
-
-2009-12-23 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tune/common.c, tune/speed.c, tune/speed.h: Support for measuring
- mpn_toom8h_mul and mpn_toom8_sqr speed.
-
- * mpn/generic/toom_eval_pm2exp.c: Fix ASSERTs.
-
- * mpn/generic/toom8h_mul.c: New file.
- * mpn/generic/toom8_sqr.c: New file.
- * mpn/generic/toom_interpolate_16pts.c: New file.
- * gmp-impl.h: Provide corresponding declarations.
- * configure.in (gmp_mpn_functions): List toom_interpolate_16pts,
- toom8h_mul, and toom8h_sqr.
- * tests/mpn/t-toom8h.c: New test program.
-
- * mpn/generic/toom6_sqr.c: New file, was part of toom6h_mul.
- * mpn/generic/toom6h_mul.c: Removed _sqr.
-
- * mpn/generic/mulmod_bnm1.c: Nailify CRT.
- * mpn/generic/sqrmod_bnm1.c: Likewise.
-
- * mpn/generic/mullo_n.c: Split dc_mullo_n function;
- ALLOC memory at once.
-
- * mpn/Makefile.am (nodist_EXTRA_libmpn_la_SOURCES): Update.
-
- * mpn/generic/toom6h_mul.c: Add prefix to toom_interpolate_12pts.
- * mpn/generic/toom_interpolate_12pts.c: Likewise.
-
- * mpn/generic/invertappr.c (mpn_bc_invertappr): Use mpn_divrem_2.
- * mpn/generic/invert.c: Faster basecase, use mpn_sbpi1_div_q.
-
- * mpn/generic/toom_eval_pm2exp.c: Assert support for degree 3.
- * mpn/generic/toom6h_mul.c: Avoid obsolete _itch function.
-
-2009-12-23 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/common.c, tune/speed.c, tune/speed.h: Support for measuring
- mpn_mod_1_1p, mpn_mod_1s_2p, mpn_mod_1s_3p, mpn_mod_1s_4p.
-
- * tests/mpz/t-powm.c: Test mpz_powm_sec.
-
- * mpz/powm_sec.c: New file.
- * gmp-h.in: Declare it.
- * Makefile.am, mpz/Makefile.am: Compile it.
- * doc/gmp.texi: Document it.
-
- * mpn/generic/powm_sec.c (mpn_powm_sec_itch): New function.
- (mpn_powm_sec): Use passed scratch, no local allocation.
- Allow exp argument = 1.
- (win_size): Start loop from 1.
-
- * mpn/generic/powm.c (win_size): Start loop from 1.
-
-2009-12-22 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/t-div.c: New file.
- * tests/mpn/Makefile.am: Compile it.
-
- * mpn/generic/mu_divappr_q.c: Handle quotient overflow.
-
- * mpn/generic/mu_div_q.c (mpn_mu_div_q_itch): New function.
-
-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/sbpi1_divappr_q.c: For the last call to udiv_qr_3by2,
- avoid using memory locations as output parameters, and revert to
- explicitly copying n1 and n0 to memory.
-
- * gmp-impl.h (udiv_qr_3by2): Tweaked to expand to precisely the
- same code as was used before the introduction of this macro.
- Eliminated some local variables, instead do multiple updates to
- the output parameters.
-
-2009-12-22 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/t-toom6h.c (MIN_AN): Set to MUL_TOOM6H_THRESHOLD to avoid
- invalid recursive sizes.
-
- * tests/mpn/t-bdiv.c: Get itch function calls right.
-
- * mpn/generic/mu_bdiv_q.c (mpn_mu_bdiv_q_itch): Rewrite.
- * mpn/generic/mu_bdiv_qr.c (mpn_mu_bdiv_qr_itch): Simplify.
-
- * 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>
-
- * tests/mpn/t-bdiv.c: Add red-zones.
+ * gmp-impl.h: Update mpn_mul_fft declaration.
2009-12-21 Torbjorn Granlund <tege@gmplib.org>
- * mpn/generic/sbpi1_div_q.c: Fix fixup code to work for qn = 0.
-
- * mpn/generic/dcpi1_divappr_q.c: Handle qn = 1 and qn = 2 for initial
- quotient block (code block copied from dcpi1_div_qr.c).
-
- * mpn/generic/dcpi1_div_qr.c: Rewrite singular case giving q limb of
- GMP_NUMB_MAX. Remove an impossible qn = 0 case.
-
- * mpn/generic/dcpi1_bdiv_q.c: Remove a spurious mpn_sub_1.
-
- * mpn/generic/mul.c: Put back call to mpn_mul_n.
-
- * tune/tuneup.c (all): Call tune_mulmod_bnm1 before tuning fft due to
- dependency on mulmod_bnm1 from both mul_fft_mul and from mullo_n.
-
- * mpn/generic/dcpi1_divappr_q.c: ASSERT that dn >= 6 and nn > dn.
- * mpn/generic/dcpi1_div_q.c: ASSERT that dn >= 6 and nn-dn >= 3.
- * mpn/generic/dcpi1_div_qr.c: ASSERT that dn >= 6 and nn-dn >= 3.
-
- * mpn/generic/bdiv_q_1.c (mpn_pi1_bdiv_q_1): Renamed from
- mpn_bdiv_q_1_pi1.
- * All references changed.
-
- * configure.in: Add --enable-old-fft-full.
- * tune/speed.c (routine): Conditionalise mpn_mul_fft_full references on
- WANT_OLD_FFT_FULL.
- * tune/common.c (speed_mpn_mul_fft_full)
- (speed_mpn_mul_fft_full_sqr): Likewise.
- * mpn/generic/mul_fft.c (mpn_mul_fft_full): Include iff
- WANT_OLD_FFT_FULL.
-
-2009-12-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h (mpn_toom6h_mul_itch): New inline function.
- (MUL_TOOM6H_THRESHOLD): Default value.
- (SQR_TOOM6_THRESHOLD): Default value.
- * mpn/generic/toom6h_mul.c: Remove definitions moved to gmp-impl.h.
- * tune/common.c, tune/speed.c, tune/speed.h: Support for measuring
- mpn_toom6h_mul and mpn_toom6_sqr speed.
-
- * mpn/generic/toom63_mul.c: Remove unused TMP_*.
-
- * mpn/generic/toom_eval_pm2rexp.c: New file.
- * gmp-impl.h: Provide corresponding declaration.
- * configure.in (gmp_mpn_functions): List toom_eval_pm2rexp.
- * mpn/generic/toom6h_mul.c: Use shared toom_eval_pm2rexp.
-
- * mpn/generic/toom_couple_handling.c: New file, helper function
- for high degree Toom.
- * gmp-impl.h: Provide corresponding declaration.
- * configure.in (gmp_mpn_functions): List toom_couple_handling.
- * mpn/generic/toom6h_mul.c: Use shared toom_couple_handling.
- * mpn/generic/toom63_mul.c: Likewise.
-
- * mpn/generic/toom6h_mul.c: New file.
- * mpn/generic/toom_interpolate_12pts.c: New file.
- * gmp-impl.h: Provide corresponding declarations.
- * configure.in (gmp_mpn_functions): List toom_interpolate_12pts,
- toom6h_mul.
- * tests/mpn/t-toom6h.c: New test program.
-
- * tests/mpn/t-mulmod_bnm1.c (ref_mulmod_bnm1): Use ref_mul.
- * tests/mpn/t-sqrmod_bnm1.c (ref_sqrmod_bnm1): Likewise.
-
-2009-12-20 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1): New CRT.
- * mpn/generic/sqrmod_bnm1.c (mpn_sqrmod_bnm1): Likewise.
-
-2009-12-20 Torbjorn Granlund <tege@gmplib.org>
-
- * Change all bit counts for bignums to use mp_bitcnt_t.
-
- * mpn/generic/bdivmod.c: File removed. All references purged.
-
- * mpn/generic/mul_fft.c (mpn_mul_fft_full): Disable.
-
- * gmp-impl.h: Define mpn_fft_mul as an alias for mpn_nussbaumer_mul.
- * mpn/generic/mul.c: Refer mpn_fft_mul.
- * mpn/generic/mul_n.c: Likewise.
- * mpn/generic/sqr_n.c: Likewise.
- * mpn/generic/mullo_n.c: Likewise.
-
- * mpn/generic/mul.c: Loop also over mpn_nussbaumer_mul, as suggested by
- Marco. Use TMP_SALLOC_LIMBS in more places. Clean up ws allocation.
-
-2009-12-19 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_interpolate_8pts.c: Nailify.
-
-2009-12-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mul.c: Major rewrite. Use toom43, toom53, toom63.
- Call mpn_nussbaumer_mul for largest operands.
-
- * tune/speed.h (SPEED_ROUTINE_MPN_TOOM32_FOR_TOOM43_MUL): New macro.
- (SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM32_MUL): New macro.
- (SPEED_ROUTINE_MPN_TOOM32_FOR_TOOM53_MUL): New macro.
- (SPEED_ROUTINE_MPN_TOOM53_FOR_TOOM32_MUL): New macro.
- (SPEED_ROUTINE_MPN_TOOM42_FOR_TOOM53_MUL): New macro.
- (SPEED_ROUTINE_MPN_TOOM53_FOR_TOOM42_MUL): New macro.
- * tune/common.c (speed_mpn_toom63_mul): New function.
- (speed_mpn_toom32_for_toom43_mul): New function.
- (speed_mpn_toom43_for_toom32_mul): New function.
- (speed_mpn_toom32_for_toom53_mul): New function.
- (speed_mpn_toom53_for_toom32_mul): New function.
- (speed_mpn_toom42_for_toom53_mul): New function.
- (speed_mpn_toom53_for_toom42_mul): New function.
- * tune/tuneup.c (tune_mul_n): New name for old tune_mul.
- (tune_sqr_n): New name for old tune_sqr.
- (tune_mul): New function, for unbalanced multiplication.
- * gmp-impl.h: Provide declarations for corresponding threshold vars.
-
- * gmp-impl.h (mpn_rsh1add_nc, mpn_rsh1sub_nc): Declare.
- * mpn/asm-defs.m4: Likewise.
- * 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>
-
- * mpz/divexact.c: Rewrite to use mpn_divexact.
-
- * mpn/generic/bdiv_q_1.c (mpn_bdiv_q_1): Deleted some unused
- variables.
-
- * mpn/generic/toom52_mul.c (mpn_toom52_mul)
- [HAVE_NATIVE_mpn_add_n_sub_n]: Moved declaration of cy to avoid a
- compiler warning.
-
- * gmp-impl.h (gmp_pi1_t): Eliminated inv21 member.
- (invert_pi1): ...and don't store it here.
-
- * mpn/generic/toom63_mul.c (mpn_toom63_mul): Simplified
- calculation of block size n.
- * gmp-impl.h (mpn_toom63_mul_itch): Likewise.
-
- * mpn/generic/toom_eval_pm2exp.c (mpn_toom_eval_pm2exp): Fixed
- output asserts.
-
-2009-12-18 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/t-toom63.c: New test program.
-
-2009-12-18 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/invert.c: Nailify.
- * mpn/generic/invertappr.c: Nailify.
- * mpn/generic/mulmod_bnm1.c: Nailify.
- * mpn/generic/sqrmod_bnm1.c: Nailify.
-
- * tests/mpn/t-invert.c: New test program.
-
- * mpn/generic/toom63_mul.c: New file.
- * mpn/generic/toom_interpolate_8pts.c: New file.
- * gmp-impl.h: Provide corresponding declarations.
- * configure.in (gmp_mpn_functions): List toom_interpolate_8pts and
- toom63_mul.
+ * gmp-h.in (__GNU_MP_VERSION_PATCHLEVEL): Bump.
2009-12-17 Torbjorn Granlund <tege@gmplib.org>
- * mpn/generic/mul.c: Move allocation of ws to where it is used.
- Identify toom22, 32, 42, in that order (in two places). Use midline
- between toom22, 32, 42.
- * mpn/generic/toom22_mul.c (TOOM22_MUL_MN_REC): Call also
- mpn_toom32_mul.
-
* doc/gmp.texi: Update References section. Update Contributors
section. Misc updates.
- * gmp-impl.h: Renew default values for all THRESHOLDs.
-
-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
- shifting, allocate and process only the low qn+1 limbs. Eliminated
- code for the impossible case nn < qn.
-
- * mpn/generic/dcpi1_div_qr.c (mpn_dcpi1_div_qr): Added some input
- asserts.
-
- * mpn/generic/dcpi1_div_qr.c (mpn_dcpi1_div_qr): In the case that
- the initial quotient block is a single limb, use 3/2 division,
- thereby eliminating the only use of gmp_pi1_t->inv21.
-
-2009-12-17 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/invert.c: Added some comment.
- * mpn/generic/invertappr.c: Slightly better threshold handling.
- * gmp-impl.h (INV_NEWTON_THRESHOLD): Default to 200.
-
- * mpn/generic/nussbaumer_mul.c: New file.
- * configure.in (gmp_mpn_functions): Add nussbaumer_mul.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add nussbaumer_mul.
- * gmp-impl.h (mpn_nussbaumer_mul): Added prototype and name-mangling.
- * tune/speed.h (speed_mpn_nussbaumer_mul): Declare function.
- * tune/common.c (speed_mpn_nussbaumer_mul): New function.
- * tune/speed.c (routine): Add speed_mpn_nussbaumer_mul.
-
- * mpn/generic/sqrmod_bnm1.c: New file.
- * configure.in (gmp_mpn_functions): Add sqrmod_bnm1.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add sqrmod_bnm1.
- * gmp-impl.h (mpn_sqrmod_bnm1): Added prototype and name-mangling.
- (SQRMOD_BNM1_THRESHOLD): support for the new threshold.
- * tune/speed.h (speed_mpn_sqrmod_bnm1): Declare function.
- * tune/common.c (speed_mpn_sqrmod_bnm1): New function.
- * tune/speed.c (routine): Add speed_mpn_sqrmod_bnm1.
- * tests/mpn/t-mulmod_bnm1.c: Attribution.
- * tests/mpn/t-sqrmod_bnm1.c: New test file.
- * tests/mpn/Makefile.am (check_PROGRAMS): Add t-sqrmod_bnm1.
-
- * tune/tuneup.c: Tune SQRMOD_BNM1_THRESHOLD.
-
- * mpn/generic/nussbaumer_mul.c (mpn_nussbaumer_mul): Mimic fft_mul,
- use squaring if operands coincide.
- * tune/speed.h (speed_mpn_nussbaumer_mul_sqr): Declare function.
- * tune/common.c (speed_mpn_nussbaumer_mul_sqr): New function.
- * tune/speed.c (routine): Add speed_mpn_nussbaumer_mul_sqr.
-
-2009-12-17 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/bdiv_q.c (mpn_bdiv_q_itch): Rewrite.
-
-2009-12-16 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpn/t-bdiv.c (bdiv_q_valid_p, bdiv_qr_valid_p): Call refmpn_mul
- instead of refmpn_mul_basecase.
- * tests/mpn/toom-shared.h: Likewise.
- * tests/refmpn.c (refmpn_mullo_n,refmpn_sqr,refmpn_mul_any): Likewise.
-
- * minithres/gmp-mparam.h: Add new thresholds, trim old values.
-
- * mpn/generic/powm.c: Use mp_bitcnt_t for bit counts.
- Handle REDC_1_TO_REDC_N_THRESHOLD < MUL_TOOM22_THRESHOLD in
- 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.
@@ -8014,302 +26,16 @@
* mpn/generic/gcdext_lehmer.c (mpn_gcdext_lehmer_n): Get ASSERT
right.
-2009-12-16 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-mul.c: Misc cleanups.
- (mul_basecase): Remove.
- (ref_mpn_mul): Remove.
- * tests/refmpn.c (refmpn_mul): New function, mainly from t-mul.c's
- ref_mpn_mul.
- (refmpn_mullo_n): Add a missing free.
-
- * tune/speed.c (routine): Measure speed_mpn_{sb,dc}pi1_div_qr,
- mpn_{sb,dc}pi1_divappr_q, mpn_{sb,dc}pi1_bdiv_qr, and
- mpn_{sb,dc}pi1_bdiv_q.
-
- * mpn/generic/invertappr.c: New file, meat from invert.c.
- * mpn/generic/invert.c: Leave just mpn_invert.c.
- * configure.in (gmp_mpn_functions): Add invertappr.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add invertappr.c.
- * gmp-impl.h (mpn_invert_itch, mpn_invertappr_itch): New macros.
-
2009-12-15 Torbjorn Granlund <tege@gmplib.org>
* mpn/generic/gcdext_subdiv_step.c: Get an ASSERT right.
-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.
-
-2009-12-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * 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>
-
- * mpn/generic/sbpi1_divappr_q.c (mpn_sbpi1_divappr_q): Use
- udiv_qr_3by2.
-
-2009-12-14 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_binvert): Remove BINV_MULMOD_BNM1_THRESHOLD
- tuning, it was always zero and caused BINV_NEWTON_THRESHOLD to be
- wrong (as pointed out by Marco).
- * (BINV_MULMOD_BNM1_THRESHOLD): Clean from other files too.
-
-2009-12-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * 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>
-
- * gmp-impl.h (udiv_qr_3by2): Fix typo in argument list.
-
-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.
-
2009-12-13 Torbjorn Granlund <tege@gmplib.org>
- * mpn/generic/dcpi1_divappr_q.c (mpn_dcpi1_divappr_q): Avoid a buffer
- overrun.
-
* mpn/generic/mul_fft.c (mpn_mul_fft_full): Handle carry-out from 2nd
mpn_mul_fft, add an ASSERT for the 1st mpn_mul_fft. Replace some
comments on cc's range with ASSERTs.
- * mpn/generic/gcdext.c (compute_v): Normalise tp[] after mpn_mul.
-
- * mpz/powm.c: Rework buffer handling.
-
-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
- considerably.
-
-2009-12-13 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/invert.c (mpn_invertapp): Split in _bc and _ni.
- (mpn_bc_invertappr): New function, the basecase.
- (mpn_ni_invertapp): New function, Newton iteration.
- (mpn_invert): Use mpn_ni_invertapp.
- * tune/tuneup.c (tune_invert): Min for INV_APPR_THRESHOLD.
- (tune_invertappr): Min for INV_NEWTON_THRESHOLD.
-
- * tune/speed.h (SPEED_ROUTINE_MPN_NI_INVERTAPPR): New macro.
- (speed_mpn_ni_invertappr): Declare function.
- * tune/common.c (speed_mpn_ni_invertappr): New function.
- * tune/speed.c (routine): Add speed_mpn_ni_invertappr.
-
- * tune/tuneup.c (tune_invertappr): Use speed_mpn_ni_invertappr to
- tune INV_MULMOD_BNM1_THRESHOLD.
-
-2009-12-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mu_bdiv_qr.c (mpn_mu_bdiv_qr_itch): Rewrite.
-
-2009-12-12 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpn/t-mulmod_bnm1.c (main): Disable B^n+1 stressing test
- for odd sizes.
-
- * mpn/generic/invert.c: Complete rewrite. Uses Newton iterations.
- * gmp-impl.h (mpn_invertappr): Added prototype and name-mangling.
- (mpn_invertappr_itch): Added prototype and name-mangling.
- (INV_APPR_THRESHOLD): Support for a new tunable const.
- * tune/speed.h (SPEED_ROUTINE_MPN_INVERTAPPR): New macro.
- (speed_mpn_invertappr): Declare function.
- * tune/common.c (speed_mpn_invertappr): New function.
- * tune/speed.c (routine): Add speed_mpn_invertappr.
- * tune/tuneup.c (tune_invertappr): New function: was tune_invert.
- (tune_invert): Now tune only INV_APPR_THRESHOLD.
- (all): Enable call to tune_invert and tune_invertappr.
-
-2009-12-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/binvert.c: Use mpn_mulmod_bnm1 instead of FFT wrapping.
- Old, evidently broken wrapping code removed.
- * tune/tuneup.c (tune_binvert): Tune BINV_MULMOD_BNM1_THRESHOLD.
- * gmp-impl.h: Provide declarations for corresponding threshold var.
-
- * tests/mpn/t-bdiv.c (COUNT): Decrease to keep run time reasonable.
-
- * tune/tuneup.c (tune_invert): Tune INV_MULMOD_BNM1_THRESHOLD.
- * gmp-impl.h: Provide declarations for corresponding threshold var.
-
- * tests/mpn/t-mulmod_bnm1.c: Avoid a division by zero.
-
- * configure.in: Set up different paths for different 64-bit sparc
- processors.
- * mpn/sparc64/ultrasparc34/gmp-mparam.h: New file.
-
-2009-12-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/*/gmp-mparam.h: Regenerate many of these files.
-
-2009-12-10 Niels Möller <nisse@lysator.liu.se>
-
- * gmp-impl.h (mpn_divexact): Removed scratch pointer from
- prototype.
- * mpn/generic/gcdext.c (divexact): Deleted, moved to...
- * mpn/generic/divexact.c (mpn_divexact): New implementation (moved
- from gcdext.c). The bidirectional divexact is kept but #if:ed out.
- Interface change, since the new code doesn't take a scratch
- argument.
-
- * tests/mpn/t-mulmod_bnm1.c (main): Ensure that an >= bn. Lowered
- MIN_N to 1. Various fixes to handle n == 1 properly.
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1): Small interface
- change, require an >= bn.
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1): Fixed non-recursive
- case to not write beyond end of result area.
-
-2009-12-09 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.h (SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL): New macro, made
- from now deleted SPEED_ROUTINE_MPN_MULMOD_BNM1.
- * tune/common.c (speed_mpn_bc_mulmod_bnm1): New function.
- (speed_mpn_mulmod_bnm1): Use SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL.
- * tune/speed.c (routine): Add mpn_bc_mulmod_bnm1.
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1_next_size): Rewrite.
-
- * tune/tuneup.c (tune_mulmod_bnm1): Rewrite.
-
-2009-12-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * 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).
- (mpn_mulmod_bnm1): Calls changed accordingly.
-
-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
- disabled by default.
-
- * mpn/generic/gcdext.c (divexact): Local definition of divexact,
- using mpn_bdiv_q.
- (compute_v): Use it.
-
- * tests/mpn/Makefile.am (check_PROGRAMS): Added t-bdiv.
-
- * tests/mpn/t-bdiv.c: New file.
-
- * mpn/generic/bdiv_q.c (mpn_bdiv_q): Fixed bad quotient length,
- should have qn == nn.
-
- * mpn/generic/bdiv_qr.c (mpn_bdiv_qr): Pass correct nn length to
- the lower-level functions.
-
-2009-12-08 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.h (SPEED_ROUTINE_MPN_MULMOD_BNM1_ROUNDED): New define.
- * tune/common.c (speed_mpn_mulmod_bnm1_rounded): New function.
- * tune/speed.c (routine): Add mpn_mulmod_bnm1_rounded for measuring
- mpn_mulmod_bnm1 at recommended sizes.
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1_next_size): Rewrite.
- (mpn_bc_mulmod_bnm1): Use mpn_add_n instead of mpn_add.
-
- * tune/speed.c (routine): Add mpn_invert.
-
- * tune/tuneup.c (tune_invert): New function.
- * tune/speed.h (SPEED_ROUTINE_MPN_INVERT): New macro.
- * tune/common.c (speed_mpn_invert): New function.
- * gmp-impl.h: Provide declarations for corresponding threshold var.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add invert.c.
-
-2009-12-08 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/devel/try.c: Test mpn_addlsh2_n and mpn_{add,sub}lsh_n;
- mpn_rsblsh_n now tests all shift values.
- * tests/refmpn.c (refmpn_addlsh_n, refmpn_sublsh_n): New functions.
- (refmpn_addlsh1_n): Use generic refmpn_addlsh_n.
- (refmpn_sublsh1_n): Use generic refmpn_sublsh_n.
- (refmpn_addlsh2_n): New function.
- * tests/tests.h: Declare new functions.
-
-2009-12-06 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mulmod_bnm1): Up min_size to 12.
-
- * Globally: Rename *mullow* to *mullo*, *MULLOW* to *MULLO*.
-
- * configure.in: Don't include ev5 directory for ev6* and ev7. Misc
- alpha path cleanups.
- * mpn/alpha/add_n.asm: Replaced by mpn/alpha/ev5/add_n.asm.
- * mpn/alpha/sub_n.asm: Replaced by mpn/alpha/ev5/sub_n.asm.
- * mpn/alpha/lshift.asm: Replaced by mpn/alpha/ev5/lshift.asm.
- * mpn/alpha/rshift.asm: Replaced by mpn/alpha/ev5/rshift.asm.
- * mpn/alpha/com_n.asm: New, moved from mpn/alpha/ev5/rshift.asm.
- * mpn/alpha/ev5/diveby3.asm: New, moved from mpn/alpha/diveby3.asm.
-
- * mpn/powerpc64/mode64/diveby3.asm: Remove, it is slower than
- mpn_bdiv_dbm1c on all hardware.
-
- * mpn/generic/powm_sec.c: Rework logic for mpn_sqr_basecase size limit.
-
- * gmp-impl.h (mpn_redc_1_sec): Declare.
- * configure.in (gmp_mpn_functions): Add redc_1_sec.
-
-2009-12-06 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/devel/try.c (try_one): DATA_SRC0_HIGHBIT sets the high bit.
-
-2009-12-05 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_eval_dgr3_pm1.c: Change return value: 0 or ~0.
- * mpn/generic/toom_eval_dgr3_pm2.c: Likewise.
- * mpn/generic/toom_eval_pm1.c: Likewise.
- * mpn/generic/toom_eval_pm2exp.c: Likewise.
- * mpn/generic/toom_eval_pm2.c: Rewrite to use mpn_addlsh2_n.
-
- * mpn/generic/toom_interpolate_5pts.c: Param sa is a flag, not a sign.
-
- * mpn/generic/toom33_mul.c: Adapt to changes above.
- * mpn/generic/toom3_sqr.c: Likewise.
- * mpn/generic/toom42_mul.c: Likewise.
- * mpn/generic/toom43_mul.c: Reduce branches.
- * mpn/generic/toom44_mul.c: Likewise.
- * mpn/generic/toom53_mul.c: Likewise.
- * mpn/generic/toom62_mul.c: Likewise.
-
- * mpn/generic/toom52_mul.c: Use toom_eval_ functions.
-
- * mpn/generic/toom4_sqr.c: Avoid C99 construct.
- * mpn/generic/toom_interpolate_7pts.c: Likewise.
-
-2009-12-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/redc_1_sec.c: New file.
- * mpn/generic/powm_sec.c: Use redc_1_sec. Use dummy full subtract
- instead of mpn_cmp since the latter leaks to the side channel.
- (mpn_local_sqr_n): New function, with associated macros.
- (mpn_powm_sec): Use mpn_local_sqr_n.
-
- * configure.in (HAVE_NATIVE): Add missing functions, then sort.
-
-2009-12-04 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_dc_div): Up min_size to 6.
- (tune_mod_1): Set MOD_1_1_THRESHOLD min_size to 2.
-
- * tune/speed.h: Negate "binvert"-type inverses, as required.
-
- * mpn/generic/redc_1.c: Add ASSERTs.
- * mpn/generic/redc_2.c: Likewise.
-
- * mpn/generic/sbpi1_bdiv_q.c: Simplify loops, indexing.
-
2009-12-03 Yann Droneaud <yann@droneaud.fr>
* acinclude.m4 ([long long reliability test 1]): Add a "static" for C99
@@ -8317,44 +43,16 @@
2009-12-03 Torbjorn Granlund <tege@gmplib.org>
- * configure.in: Move intptr_t test into common AC_CHECK_TYPES.
-
* mpn/generic/gcdext.c: Add a TMP_FREE.
-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.
-
- * mpn/generic/gcdext_1.c (mpn_gcdext_1) [GCDEXT_1_USE_BINARY]:
- Reimplemented binary gcdext, with proper canonicalization.
+2009-12-03 Niels Möller <nisse@lysator.liu.se>
* mpn/generic/gcdext_lehmer.c (mpn_gcdext_lehmer_n): Handle v == 0
from mpn_gcdext_1.
* mpn/generic/gcdext_1.c (mpn_gcdext_1): Allow inputs with a < b,
assertions fixed accordingly.
-2009-12-03 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c: Tune DC_DIVAPPR_Q_THRESHOLD. Rewrite
- DC_DIV_QR_THRESHOLD tuning code.
- (tune_dc_div): Rewrite.
- * tune/speed.h (SPEED_ROUTINE_MPN_PI1_DIV): New macro.
- * tune/common.c (speed_mpn_sbpi1_div_qr, speed_mpn_dcpi1_div_qr,
- speed_mpn_sbpi1_divappr_q, speed_mpn_sbpi1_bdiv_qr): New functions.
- * gmp-impl.h: Provide declarations for corresponding threshold vars.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add dcpi1_divappr_q.c.
-
- * tune/tuneup.c (tune_binvert): Up max_size.
-
-2009-12-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/devel/try.c: Test mpn_rsblsh2_n and mpn_rsblsh_n.
- * tests/refmpn.c (refmpn_rsblsh_n, refmpn_rsblsh2_n): New functions.
- (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.
@@ -8364,7 +62,7 @@
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
@@ -8376,726 +74,39 @@
* doc/gmp.texi (Low-level Functions): Document mpn_sqr_n.
- * tune/speed.c (routine): Add mpn_binvert.
-
- * tune/tuneup.c: Tune BINV_NEWTON_THRESHOLD.
- (tune_binvert): New function.
- * tune/speed.h (SPEED_ROUTINE_MPN_BINVERT): New macro.
- * tune/common.c (speed_mpn_binvert): New function.
- * gmp-impl.h: Provide declarations for corresponding threshold var.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add binvert.c.
-
- * tune/tuneup.c: Tune DC_BDIV_QR_THRESHOLD and DC_BDIV_Q_THRESHOLD.
- (tune_dc_bdiv): New function.
- (tune_dc_div): New name for tune_dc.
- * tune/speed.h (SPEED_ROUTINE_MPN_PI1_BDIV_QR,
- SPEED_ROUTINE_MPN_PI1_BDIV_Q): New macros.
- * tune/common.c (speed_mpn_sbpi1_bdiv_qr, speed_mpn_dcpi1_bdiv_qr,
- speed_mpn_sbpi1_bdiv_q, speed_mpn_dcpi1_bdiv_q): New functions.
- * gmp-impl.h: Provide declarations for corresponding threshold vars.
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add dcpi1_bdiv_qr.c and
- dcpi1_bdiv_q.c.
-
-2009-12-01 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom53_mul.c: Removed double computation of vinf.
-
- * mpn/x86_64/aorrlsh_n.asm: Correct return value for rsblsh_n.
- * mpn/asm-defs.m4 (define_mpn): Add rsblsh_n.
- * gmp-impl.h (mpn_rsblsh_n): Added prototype and name-mangling.
-
- * mpn/generic/fib2_ui.c: Reduce the amount of temporary storage.
- Use mpn_rsblsh_n.
-
-2009-12-01 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/redc_n.c: Rework temp allocation.
-
- * mpn/generic/dcpi1_bdiv_qr.c (mpn_dcpi1_bdiv_qr_n_itch): Add pi1 also
- to this function.
-
- * mpn/generic/dcpi1_bdiv_q.c: Get the mpn_sbpi1_bdiv_q call right.
- Misc cleanups.
-
- * tune/speed.c (routine): Fix typo in last change.
- Add mpn_redc_2.
-
- * tune/speed.h (SPEED_ROUTINE_REDC_N): Set min size properly.
-
-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.
- (speed_mpn_toom42_mul): Declare function.
- * tune/common.c (speed_mpn_toom42_mul): New function.
- * gmp-impl.h (MPN_TOOM42_MUL_MINSIZE): New constant.
-
-2009-11-30 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/fib2_ui.c: Use mpn_rsblsh2_n.
-
-2009-11-29 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/pentium4/gmp-mparam.h
- (HAVE_NATIVE_mpn_addlsh1_n, HAVE_NATIVE_mpn_sublsh1_n): Don't undef.
-
- * Makefile.am (EXTRA_DIST): Remove macos.
-
-2009-11-28 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_redc): Set min_size to 16 for redc_n tuning.
-
- * mpn/x86_64/sqr_basecase.asm (SQR_TOOM2_THRESHOLD_MAX): Avoid quoting
- to allow configure.in parse it more easily. Trim from 120 to 80.
-
-2009-11-28 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mulmod_bnm1.c: Basecases made simpler, this also corrects
- a bug affecting previous version.
-
-2009-11-28 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Handle atom also in 32-bit mode.
- * mpn/x86/atom/gmp-mparam.h: New file.
-
- * gmp-impl.h (MULMOD_BNM1_THRESHOLD): Default.
-
- * mpn/generic/redc_n.c: Use mpn_mulmod_bnm1 instead of mpn_mul_n.
-
- * Use TMP_ALLOC_LIMBS consistently.
- * Finish renaming BITS_PER_MP_LIMB to GMP_LIMB_BITS.
-
- * macos: Remove entire directory.
-
-2009-11-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/corei/gmp-mparam.h: New file.
- * mpn/x86_64/core2/gmp-mparam.h: Now for just core2.
- * mpn/powerpc64/mode64/p3/gmp-mparam.h: New file.
- * mpn/powerpc64/mode64/p4/gmp-mparam.h: New file.
- * mpn/powerpc64/mode64/p5/gmp-mparam.h: New file.
-
- * config.guess: Return "corei" for core i7 and core i5.
- * config.sub: Recognise "corei".
- * acinclude.m4 (X86_64_PATTERN): Add corei.
- * configure.in (powerpc): Set up more CPU-specific paths.
- (x86): Handle corei.
-
- * mpz/powm.c: Allow input operand overlap also when exponent = 1.
- Misc cleanups.
-
-2009-11-26 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * tests/mpn/t-mulmod_bnm1.c: New test file.
- * tests/mpn/Makefile.am (check_PROGRAMS): Add t-mulmod_bnm1.
-
- * mpn/generic/mullow_n.c: Comments on Mulders' trick implementation.
-
-2009-11-26 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm.c: Make comments reflect current code state.
-
- * tests/devel/try.c: Make mpn_mullow_n testing actually work.
-
-2009-11-25 Torbjorn Granlund <tege@gmplib.org>
-
- * mpz/powm.c: Clean up unused defs.
-
-2009-11-24 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_redc): Rewrite.
- * mpn/generic/powm.c: Use REDC_1_TO_REDC_2_THRESHOLD,
- REDC_1_TO_REDC_N_THRESHOLD, and REDC_2_TO_REDC_N_THRESHOLD.
- Get rid of previous REDC params, including LOCAL_REDC_N_THRESHOLD.
- (WANT_REDC_2): Define.
- * gmp-impl.h: Corresponding changes.
-
-2009-11-23 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/powm.c: Fix typo.
- Define LOCAL_REDC_N_THRESHOLD, use in REDC_2_THRESHOLD...
- REDC_N_THRESHOLD chain.
-
-2009-11-22 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mullow): Set min_size to 1.
-
- * mpn/generic/powm_sec.c: Use just mpn_mul_basecase and
- mpn_sqr_basecase for multiplication and squaring.
-
- * tune/tuneup.c: Tune REDC_2_THRESHOLD and REDC_N_THRESHOLD.
- (tune_redc): New function.
- (tune_powm): Remove function.
- * tune/speed.h (SPEED_ROUTINE_REDC_2, SPEED_ROUTINE_REDC_N): New.
- * tune/common.c (speed_mpn_redc_2, speed_mpn_redc_n): New.
-
- * mpz/powm.c: Complete rewrite. Use mpn_powm and mpn_powlo.
- * mpn/generic/powm.c: Rewrite.
- * mpn/generic/redc_n.c: New file.
- * configure.in (gmp_mpn_functions): Add redc_n.
- * gmp-impl.h (REDC_2_THRESHOLD, REDC_N_THRESHOLD): Default, and define
- for tuneup.
-
-2009-11-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mullow_n.c: Disable Mulders' trick for small operands,
- use fft for bigger ones.
- * tests/mpn/t-mullo.c: New test file.
-
-2009-11-22 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/tuneup.c (tune_mullow): Rewrite.
-
-2009-11-21 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * gmp-impl.h: Removed unused macros (CACHED_ABOVE_THRESHOLD and
- CACHED_BELOW_THRESHOLD).
-
- * mpn/generic/mullow_n.c: Use Mulders' trick.
- * tune/tuneup.c (tune_mullow): MULLOW_MUL_N_THRESHOLD range of
- search depends on FFT tuning;
- (all): Anticipate tune_fft_{mul,sqr}.
-
- * tune/speed.c (routine): Add entry related to mpn_mulmod_bnm1.
-
-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
- (spotted by Marco Bodrato).
- * mpn/generic/toom_eval_pm2.c (mpn_toom_eval_pm2): Likewise.
- * mpn/generic/toom_eval_pm2exp.c (mpn_toom_eval_pm2exp): Likewise.
-
- * mpn/generic/toom_eval_pm2.c (mpn_toom_eval_pm2) [HAVE_NATIVE_mpn_addlsh_n]:
- Fixed missing declaration.
-
- * 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>
-
- * 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.
- * mpn/generic/toom62_mul.c (mpn_toom62_mul): Likewise.
- * configure.in (gmp_mpn_functions): Added toom_eval_dgr3_pm2.
-
-2009-11-18 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (mpn_and_n, etc): Adapt to now-public logic functions.
-
- * config.guess: Recognise VIA nano.
- * config.sub: Likewise.
- * configure.in: Generalise x86_64 support; recognise VIA nano.
-
-2009-11-16 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.c (routine): Add measurement of mpn_addlsh2_n,
- mpn_sublsh2_n, mpn_rsblsh2_n.
- * tune/common.c: Add speed routines for lsh2 functions.
-
- * mpn/generic/divis.c: Use MU_BDIV_QR_THRESHOLD.
-
- * configure.in (gmp_mpn_functions_optional): Add *lsh_n functions.
-
- * mpn/generic/toom_eval_pm2exp.c: Make HAVE_NATIVE_mpn_addlsh_n code
- work.
-
- * mpn/x86_64/aorrlsh2_n.asm: Optimise inner loop.
-
- * configure.in (gmp_mpn_functions_optional): Remove copyi,copyd, they
- are now in gmp_mpn_functions. Analogously move logical functions.
-
-2009-11-16 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom53_mul.c: Use addlsh2 for evaluation (and fix typo).
- * mpn/generic/toom_eval_dgr3_pm2.c: Likewise (affects toom44 and 43).
-
- * mpn/asm-defs.m4: Fix comments for op_lsh2 new functions.
- * gmp-impl.h: Likewise.
- * tests/mpz/t-fac_ui.c: Fix a comment.
-
-2009-11-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/aorrlsh2_n.asm: New file.
- * configure.in: Add support for addlsh2_n, sublsh2_n, and rsblsh2_n,
- including mulfuncs.
- * gmp-impl.h (mpn_addlsh2_n, mpn_sublsh2_n, mpn_rsblsh2_n): Declare.
- * mpn/asm-defs.m4: Likewise.
-
- * mpn/generic/copyi.c: New file.
- * mpn/generic/copyd.c: Likewise.
- * mpn/generic/zero.c: Likewise.
- * gmp-h.in: Declare new functions.
- * configure.in (gmp_mpn_functions): Add new functions.
-
-2009-11-15 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1_next_size): fix typo
-
- * mpn/generic/toom33_mul.c: Use rsblsh1 for evaluation.
- * mpn/generic/toom3_sqr.c: Likewise.
-
-2009-11-14 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom52_mul.c: Use mpn_addlsh1_n.
-
- * mpn/generic/toom52_mul.c: Toggle the right flag bit in an
- HAVE_NATIVE_mpn_add_n_sub_n arm.
-
- * tests/mpz/t-remove.c: New file.
-
- * mpn/generic/remove.c: Major overhaul. Add parameter 'cap'.
-
- * mpn/generic/binvert.c: Fix typo in last change.
-
- * mpn/generic/bdiv_qr.c: Make it actually work. Also use passed-in
- scratch space.
-
- * mpn/generic/mu_bdiv_qr.c: Reset FFT parameters for each call.
-
-2009-11-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/k7/gcd_1.asm (MASK): Compute from MAXSHIFT.
-
-2009-11-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/binvert.c: Simplify, fix comments.
-
- * tests/devel/try.c: Test mpn_invert and mpn_binvert.
-
- * tests/refmpn.c (refmpn_invert, refmpn_binvert): New functions.
- * tests/tests.h: Declare new functions.
-
-2009-11-10 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Supply compiler options for atom in 32-bit mode.
-
- * acinclude.m4 (X86_64_PATTERN): New.
- * configure.in: Setup and use X86_64_PATTERN.
-
- * mpn/x86_64/fat/fat.c: New file.
- * mpn/x86_64/fat/fat_entry.asm: New file.
- * mpn/x86_64/fat: Copy C placeholder files from mpn/x86/fat.
- * mpn/x86_64/x86_64-defs.m4 (CPUVEC_FUNCS_LIST): New, copied from
- mpn/x86/x86-defs.m4.
- * configure.in: Move down x86 fat setup code until after ABI has been
- determined; generalise to handle x86_64.
-
2009-11-09 Torbjorn Granlund <tege@gmplib.org>
- * mpn/x86/fat/mod_1.c: New file.
-
* acinclude.m4 (GMP_C_FOR_BUILD_ANSI): Avoid poor quoting.
-2009-11-08 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (MPN_LOGOPS_N_INLINE): Rewrite, update interface. Callers
- updated.
- * mpn/generic/logops_n.c: New file.
- * doc/gmp.texi (Low-level Functions): Document logical mpn functions.
-
-2009-11-07 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/speed.h (SPEED_ROUTINE_MPN_MULMOD_BNM1): Adapt to new
- mpn_mulmod_bnm1 interface.
-
-2009-11-07 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/mulmod_bnm1.c: New interface, with size
- specified for all operands in mpn_mulmod_bnm1.
- * gmp-impl.h: Changed mpn_mulmod_bnm1 prototype.
-
-2009-11-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/k7/gcd_1.asm: Actually use div-reduced value.
- Mnemonic cleanup.
-
- * mpn/x86_64/gcd_1.asm: New file.
-
-2009-11-03 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add sqr_n.c.
-
-2009-11-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_interpolate_6pts.c: removed an addmul_1 and cleanup.
-
-2009-11-02 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (gmp_mpn_functions): Remove obsolete functions
- dc_divrem_n and sb_divrem_mn.
- * gmp-impl.h: Misc cleanup.
- (mpn_sb_divrem_mn, mpn_dc_divrem_n): Remove.
- (DIV_DC_THRESHOLD): Remove.
- * mpn/generic/dc_divrem_n.c: Remove.
- * mpn/generic/sb_divrem_mn.c: Remove.
- * mpn/generic/tdiv_qr.c: Use DC_DIV_QR_THRESHOLD, not DIV_DC_THRESHOLD.
-
- * tests/devel/try.c: Replace mpn_sb_divrem_mn by mpn_sbpi1_div_qr.
- * tests/refmpn.c (refmpn_sb_div_qr): New name for refmpn_sb_divrem_mn.
-
- * tune/Makefile.am (libspeed_la_SOURCES): Remove sb_div.c and sb_inv.c.
- (TUNE_MPN_SRCS_BASIC): Remove sb_divrem_mn.c.
- * tune/common.c (speed_mpn_dcpi1_div_qr_n): New function.
- Remove mpn_sb_divrem_mn related functions.
- * tune/speed.c (routine): Remove entries related to mpn_dc_divrem and
- mpn_sb_divrem.
- (routine): New entry for mpn_dc_div_qr_n.
- * tune/speed.h (SPEED_ROUTINE_MPN_DC_DIVREM_CALL): Compute inverse
- needed by pi1 calls.
- (SPEED_ROUTINE_MPN_SB_DIVREM_M3): Remove.
- * tune/tuneup.c (tune_sb_preinv): Remove.
- (tune_dc): Update to measure DC_DIV_QR_THRESHOLD.
-
- * mpn/generic/sb_divappr_q.c: Remove.
-
-2009-11-01 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h: Misc minor cleanups.
-
-2009-10-31 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (toom itch functions): Simplify, make some into macros.
- (MPN_KARA_MUL_N_TSIZE, MPN_KARA_SQR_N_TSIZE): Remove.
- * mpn/generic/mul_n.c (mpn_toom3_mul_n, mpn_toom3_sqr_n): Remove.
- * mpn/generic/mul_n.c (mpn_sqr_n): Move from here...
- * mpn/generic/sqr_n.c: ...to this new file.
- * configure.in (gmp_mpn_functions): Add sqr_n.
-
- * Globally change
- MUL_TOOM3_THRESHOLD => MUL_TOOM33_THRESHOLD,
- MUL_KARATSUBA_THRESHOLD => MUL_TOOM22_THRESHOLD,
- SQR_KARATSUBA_THRESHOLD => SQR_TOOM2_THRESHOLD,
- and associated names analogously.
-
-2009-10-31 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/toom_interpolate_7pts.c: Changed evaluation points,
- replacing -1/2 by -2.
- * mpn/generic/toom44_mul.c: Updated to use new evaluation points,
- and use mpn_toom_eval_dgr3_pm2.
- * mpn/generic/toom4_sqr.c (mpn_toom4_sqr): Likewise.
- * mpn/generic/toom53_mul.c (mpn_toom53_mul): Updated to use new
- evaluation points, and use mpn_toom_eval_pm1 and
- mpn_toom_eval_pm2exp.
- * mpn/generic/toom62_mul.c (mpn_toom62_mul): Likewise.
-
- * mpn/generic/toom_eval_pm2exp.c: New file.
- * mpn/generic/toom_eval_pm1.c: New file.
-
- * mpn/generic/toom43_mul.c (mpn_toom43_mul): Use
- mpn_toom_eval_dgr3_pm2.
-
-2009-10-30 Torbjorn Granlund <tege@gmplib.org>
-
- * tune/Makefile.am (TUNE_MPN_SRCS_BASIC): Add toom2* and toom3* files.
-
-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>
-
- * mpn/generic/toom43_mul.c (mpn_toom43_mul): Use
- mpn_toom_eval_dgr3_pm1.
- * mpn/generic/toom42_mul.c (mpn_toom42_mul): Likewise.
-
2009-10-29 Torbjorn Granlund <tege@gmplib.org>
- * mpn/generic/mulmod_bnm1.c: Replace some add_1 by INCR.
-
- * gmp-impl.h (mpn_mulmod_bnm1_itch): New macro.
-
- * mpn/generic/mulmod_bnm1.c (mpn_mulmod_bnm1): Call mpn_mul_fft.
- (mpn_mulmod_bnm1_next_size): Adopt to SS FFT.
-
* 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.
- * configure.in (gmp_mpn_functions): Add mulmod_bnm1.
- * gmp-impl.h: Add related declarations.
- * tune/tuneup.c: Tune MULMOD_BNM1_THRESHOLD.
- * tune/speed.h (SPEED_ROUTINE_MPN_MULMOD_BNM1): New macro.
- * tune/common.c (speed_mpn_mulmod_bnm1): New function.
- * Makefile.am (TUNE_MPN_SRCS_BASIC): Add mulmod_bnm1.c.
-
- * gmp-impl.h (mpn_kara_mul_n, mpn_kara_sqr_n): Remove declarations.
- * tune/common.c: Remove/rename kara functions.
- * tune/speed.h: Likewise.
-
- * tests/devel/try.c: Clean up usage of %p printf arguments.
-
- * gmp-impl.h: Update MUL/SQR MINSIZE macros to reflect new function
- names and limitations
- * tune/tuneup.c: Use updated macro names.
- * 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>
-
- * tune/speed.c: Added support for mpn_toom4_sqr,
-
- * tune/speed.h (SPEED_ROUTINE_MPN_TOOM4_SQR): New macro.
- (SPEED_ROUTINE_MPN_KARA_MUL_N): Deleted.
- (SPEED_ROUTINE_MPN_TOOM3_MUL_N): Deleted.
- (SPEED_ROUTINE_MPN_TOOM2_SQR): Use mpn_toom2_sqr_itch.
-
- * gmp-impl.h (mpn_toom3_mul_n, mpn_toom3_sqr_n): Remove
- declarations.
- (mpn_toom2_sqr_itch): Add margin for recursive calls.
-
-2009-10-28 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/mul_n.c (mpn_kara_mul_n): Deleted old Karatsuba
- implementation.
- (mpn_kara_sqr_n): Likewise deleted.
-
- * mpn/generic/mul_n.c (mpn_sqr_n): Use mpn_toom2_sqr and
- mpn_toom3_sqr, not the old implementations.
-
- * gmp-impl.h (MPN_TOOM3_MUL_N_TSIZE): Deleted, replaced by
- mpn_toom33_mul_itch.
- (MPN_TOOM3_SQR_N_TSIZE): Deleted, replaced by
- mpn_toom3_sqr_itch.
- (mpn_toom33_mul_itch): Needs more scratch.
- (mpn_toom3_sqr_itch): Likewise.
- * tune/speed.h (SPEED_ROUTINE_MPN_TOOM3_MUL_N): Use
- mpn_toom33_mul_itch.
- (SPEED_ROUTINE_MPN_TOOM3_SQR_N): Use mpn_toom3_sqr_itch.
- * mpn/generic/mul_n.c (mpn_mul_n): Use mpn_toom33_mul_itch.
- (mpn_sqr_n): Use mpn_toom3_sqr_itch.
-
- * mpn/generic/toom33_mul.c (mpn_toom33_mul): Avoid TMP_ALLOC. Needs
- some more supplied scratch instead.
- * mpn/generic/toom3_sqr.c (mpn_toom3_sqr): Likewise.
-
-2009-10-26 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (invert_pi1): Streamline, as suggested by Niels.
-
-2009-10-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/bdiv_q.c: Update to call new functions.
- * mpn/generic/bdiv_qr.c: Likewise.
- * mpn/generic/binvert.c: Likewise.
- * mpn/generic/divexact.c: Likewise.
- * mpn/generic/divis.c: Likewise.
- * mpn/generic/perfpow.c: Likewise.
- * mpn/generic/tdiv_qr.c: Likewise.
- * mpn/generic/dcpi1_bdiv_q.c: New file.
- * mpn/generic/dcpi1_bdiv_qr.c: New file.
- * mpn/generic/dcpi1_div_q.c: New file.
- * mpn/generic/dcpi1_div_qr.c: New file.
- * mpn/generic/dcpi1_divappr_q.c: New file.
- * mpn/generic/sbpi1_bdiv_q.c: New file.
- * mpn/generic/sbpi1_bdiv_qr.c: New file.
- * mpn/generic/sbpi1_div_q.c: New file.
- * mpn/generic/sbpi1_div_qr.c: New file.
- * mpn/generic/sbpi1_divappr_q.c: New file.
- * mpn/generic/dc_bdiv_q.c: Removed.
- * mpn/generic/dc_bdiv_qr.c: Removed.
- * mpn/generic/dc_div_q.c: Removed.
- * mpn/generic/dc_div_qr.c: Removed.
- * mpn/generic/dc_divappr_q.c: Removed.
- * mpn/generic/sb_bdiv_q.c: Removed.
- * mpn/generic/sb_bdiv_qr.c: Removed.
- * mpn/generic/sb_div_q.c: Removed.
- * mpn/generic/sb_div_qr.c: Removed.
-
- * configure.in (gmp_mpn_functions): Add new division functions, remove
- obsolete division functions.
-
- * gmp-impl.h: Add declarations of new division functions, remove
- corresponding obsolete declarations.
- (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>
-
- * gmp-impl.h (mpn_toom62_mul_itch): New function.
-
- * tests/mpn/t-toom53.c: New test program.
- * tests/mpn/t-toom62.c: New test program.
-
2009-10-23 Torbjorn Granlund <tege@gmplib.org>
* 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>
-
- * mpn/generic/toom52_mul.c (mpn_toom52_mul): Use supplied scratch
- space, not TMP_ALLOC. Interface change, now requires input sizes
- such that s + t >= 5.
-
- * gmp-impl.h (mpn_toom52_mul_itch): New function.
-
- * tests/mpn/t-toom52.c: New test program.
-
-2009-10-22 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/sqr_basecase.asm: Tune for speed and a 7% size decrease.
-
-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/mpn/toom-shared.h (main): Reorganized input generation.
- Users are now supposed to define macros MAX_AN, MIN_BN and MAX_BN.
- Updated existing toom test programs.
-
-2009-10-22 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/devel/try.c: Fix typos in last change.
-
-2009-10-21 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/asm-defs.m4 (define_mpn): Add mullow_basecase.
-
- * tests/devel/try.c: Test mpn_mullow_n.
-
- * tests/refmpn.c (refmpn_mullow_n): New function.
- * tests/tests.h: Declare it.
-
-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.
-
- * gmp-impl.h (mpn_toom43_mul_itch): New function.
-
- * mpn/generic/toom43_mul.c (mpn_toom43_mul): Use supplied scratch
- 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>
-
- * tests/mpn/toom-shared.h (MIN_BLOCK): New constant, which can be
- overridden by users. Needed by t-toom42 and t-toom43.
-
- * tests/mpn/Makefile.am (check_PROGRAMS): Added t-toom32,
- t-toom42 and t-toom43.
- * tests/mpn/t-toom43.c: New test program.
- * tests/mpn/t-toom42.c: New test program.
- * tests/mpn/t-toom32.c: New test program.
-
- * tests/mpn/Makefile.am (check_PROGRAMS): Added t-toom22.
- * tests/mpn/t-toom22.c: New test file.
- * tests/mpn/toom-shared.h: New file. Test framework for Toom
- functions.
-
-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%.
-
-2009-10-14 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/matrix22_mul.c (mpn_matrix22_mul_strassen): New
- Strassen-like algorithm, to reduce the amount of temporary
- storage.
- (mpn_matrix22_mul_itch): Updated to reflect the reduced storage
- need.
-
-2009-10-03 Torbjorn Granlund <tege@gmplib.org>
-
- * Rename mpn_addsub_n to mpn_add_n_sub_n.
-
-2009-10-01 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/tdiv_qr.c: Call mpn_divrem_1 and mpn_dc_div_qr instead of
- old functions.
-
- * mpn/generic/mul_n.c: Call toom22 and toom33 instead of old functions.
-
- * mpn/generic/toom42_mul.c (TOOM42_MUL_N_REC): Renamed from
- 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>
-
- * mpn/x86_64/invert_limb.asm: Rewrite. Exploit cancellation in the
- Newton iteration.
-
-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>
-
- * mpn/x86/invert_limb.asm: New file.
-
-2009-09-24 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom33_mul.c: Use new toom functions for all recursive
- products.
- * mpn/generic/toom3_sqr.c: Likewise.
- * mpn/generic/toom44_mul.c: Likewise.
- * mpn/generic/toom4_sqr.c: Likewise.
-
- * mpn/generic/add_n.c: Relax operand overlap ASSERTs.
- * mpn/generic/sub_n.c: Likewise.
-
2009-09-15 Torbjorn Granlund <tege@gmplib.org>
Suggested by Uwe Mueller:
* printf/doprnt.c: Use "%ld" for exponent printing.
* printf/doprntf.c (__gmp_doprnt_mpf): Make expval "long".
-2009-09-14 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Handle mingw64.
- * gmp-impl.h (gmp_intptr_t): Declare.
- * tests/amd64check.c (calling_conventions_values): Use CNST_LIMB.
- * tests/memory.c: Use gmp_intptr_t; print pointers using C90 "%p".
- * tests/misc.c: Use gmp_intptr_t.
- * tests/mpq/t-get_str.c: Print pointers using C90 "%p".
-
-2009-08-12 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_1.c (mpn_mod_1_1p_cps): Remove silly ASSERT code.
-
- * mpn/asm-defs.m4 (define_mpn): Remove mod_1s_1p, add mod_1_1p.
-
- * mpn/arm/invert_limb.asm: Complete rewrite.
-
- * longlong.h: Document LONGLONG_STANDALONE and NO_ASM.
-
2009-08-05 Torbjorn Granlund <tege@gmplib.org>
* tests/mpz/dive_ui.c (check_random): Avoid zero divisors.
-2009-07-31 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_1.c: Tweak to handle any modulus (possibility
- pointed out by Per Austrin).
- (mpn_mod_1_1p): Renamed from mpn_mod_1s_1p.
- (mpn_mod_1_1p_cps): Renamed from mpn_mod_1s_1p_cps.
- *mpn/generic/mod_1.c (mpn_mod_1): Reorganise to call mpn_mod_1_1p for
- any modulus.
-
-2009-07-28 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in: Pass arch for x86 also in 64-bit mode.
-
2009-07-26 Torbjorn Granlund <tege@swox.com>
- * config.guess (_cpuid): Recognise more Intel "Core" processors.
+ * config.guess (_cpuid): Recognize more Intel "Core" processors.
2009-07-13 Torbjorn Granlund <tege@gmplib.org>
* mpf/eq.c: Rewrite.
- * tests/mpf/t-eq.c: New test.
-
-2009-07-06 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (__mp_bases): Remove this alias.
+2009-07-05 Torbjorn Granlund <tege@gmplib.org>
* mpf/get_str.c: Use less overflow prone expression for computing limb
allocation.
@@ -9103,176 +114,13 @@
* mpf/set_str.c: Likewise.
* mpz/set_str.c: Likewise.
-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.
-
-2009-06-28 Torbjorn Granlund <tege@gmplib.org>
-
- * demos/factorize.c (factor_using_pollard_rho): Rewrite.
-
- * mpz/clears.c: New file.
- * mpq/clears.c: New file.
- * mpf/clears.c: New file.
- * gmp-h.in (mpz_clears, mpq_clears, mpf_clears): Declare.
- * mpz/Makefile.am: Add clears.c.
- * mpq/Makefile.am: Add clears.c.
- * mpf/Makefile.am: Add clears.c.
- * Makefile.am: Add these also to respective OBJECTS variables.
- * doc/gmp.texi: Document inits function and clears functions.
-
-2009-06-20 Torbjorn Granlund <tege@gmplib.org>
-
- * mp-h.in (mp_bitcnt_t): Declare here too.
-
-2009-06-19 Torbjorn Granlund <tege@gmplib.org>
-
- * mpq/inits.c: New file.
- * mpf/inits.c: New file.
- * gmp-h.in (mpz_inits, mpq_inits, mpf_inits): Declare .
-
- * mpn/generic/remove.c: New file.
- * configure.in (gmp_mpn_functions): Add remove.
- * gmp-impl.h (mpn_remove): Declare.
-
- * gmp-h.in (mp_bitcnt_t): New basic type.
- * mpn/generic/perfpow.c (mp_bitcnt_t): Remove private definition.
-
- * mpn/generic/bdiv_qr.c: Make it actually work.
-
- * mpn/x86_64/core2/aorsmul_1.asm: Rewrite to use shorter pipeline and
- to need fewer registers.
-
2009-06-17 Torbjorn Granlund <tege@gmplib.org>
- * mpn/x86_64/rsh1aors_n.asm: New file.
- * mpn/x86_64/rsh1add_n.asm: Remove.
- * mpn/x86_64/rsh1sub_n.asm: Remove.
-
- * mpz/inits.c: New file.
-
- * gen-trialdivtab.c: Wrap limb constants into CNST_LIMB.
-
- With Martin Boij:
- * mpn/generic/perfpow.c (binv_root, binv_sqroot): Change from being
- recursive to being iterative.
- (mpn_perfect_power_p): Reorganise temp memory usage to avoid a buffer
- overrun. Trim allocation of next and prev. Never create oversize
- products in the multiplicity binary search.
-
- * mpn/generic/dc_div_q.c: Add missing TMP_FREE.
-
-2009-06-16 Torbjorn Granlund <tege@gmplib.org>
-
- Revert:
- * mpn/generic/perfpow.c (perfpow): Test exponents up to ub, inclusive.
-
-2009-06-16 Martin Boij <mboij@kth.se>
-
- * mpn/generic/perfpow.c (logs): Use more conservative table.
-
-2009-06-15 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/pa64/aors_n.asm: New file.
- * mpn/pa64/add_n.asm: Remove.
- * mpn/pa64/sub_n.asm: Remove.
-
- * mpn/generic/perfpow.c (perfpow): Test exponents up to ub, inclusive.
-
-2009-06-14 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/bdiv_q_1.asm: Optimise away a mov insn.
- * mpn/x86_64/dive_1.asm: Likewise.
-
- * mpn/generic/perfpow.c (binv_root): Use mpn_bdiv_q_1, not
- mpn_divexact_itch for 2-adic division.
- (all functions): Micro optimise.
-
- * Makefile.am (libmp_la_SOURCES): Add nextprime.c.
-
-2009-06-13 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-h.in (mpn_perfect_power_p): Declare.
- * configure.in (gmp_mpn_functions): Add perfpow.
- * mpz/perfpow.c: Now trivial, simply calls mpn_perfect_power_p.
-
-2009-06-13 Martin Boij <mboij@kth.se>
-
- * mpn/generic/perfpow.c: New file.
- * tests/mpz/t-perfpow.c: Rewrite.
+ * mpn/generic/toom44_mul.c: Use TMP_ALLOC for unbounded allocations.
2009-06-12 Torbjorn Granlund <tege@gmplib.org>
- * mpn/generic/bdiv_qr.c: New file.
- * mpn/generic/bdiv_q.c: New file.
- * configure.in (gmp_mpn_functions): Add bdiv_qr and bdiv_q.
- * gmp-impl.h: Declare new functions.
-
- * nextprime.c: New file.
- * gmp-impl.h (gmp_primesieve_t, gmp_init_primesieve, gmp_nextprime):
- Declare.
- * Makefile.am (libgmp_la_SOURCES): Add nextprime.c.
-
-2009-06-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/trialdiv.c: New file.
- * gen-trialdivtab.c: New file.
- * configure.in (gmp_mpn_functions): Add trialdiv.
- * gmp-impl.h (mpn_trialdiv): Declare
- * Makefile.am: Add rules for gen-trialdivtab and trialdiv.
-
- * longlong.h (arm count_leading_zeros): Define for armv5.
-
- * gmp-impl.h: Move down toom itch functions to after we've #defined
- all THRESHOLDs.
-
- * dumbmp.c (isprime): Replace with slightly less inefficient code.
- (mpz_tdiv_r): New function.
-
-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.
- * tune/speed.h (SPEED_ROUTINE_MPN_TOOM32_MUL): New macro.
- * tune/common.c (speed_mpn_toom32_mul): New function.
-
- * gmp-impl.h (mpn_toom32_mul_itch): Count scratch space needed
- for the calls to mpn_toom22_mul.
- (ABOVE_THRESHOLD): Moved this and related macros so it can be used
- by mpn_toom32_mul_itch.
- (mpn_toom22_mul_itch): Count scratch space for recursive calls.
-
-2009-06-11 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/k7/mod_1_4.asm: New file, mainly for k7, but perhaps useful
- also for k6 and non-sse p6.
-
-2009-06-10 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/mod_1_4.asm: Minor size reducing tweaks.
-
- * mpn/x86/mod_1.asm: Remove obsolete file.
- * mpn/x86/k7/mmx/mod_1.asm: Likewise.
- * mpn/x86/pentium4/sse2/mod_1.asm: Likewise.
- * mpn/x86/p6/mod_1.asm: Likewise.
- * mpn/x86/pentium/mod_1.asm: Likewise.
-
-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
- mpn_toom_eval_dgr3_pm1.
-
- * mpn/generic/toom_interpolate_6pts.c (mpn_toom_interpolate_6pts):
- Stricter ASSERTs based on maximum size of polynomial coefficients.
- Improved comments on the signedness of intermediate values.
-
-2009-06-07 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom2_sqr.c: Make it actually work.
-
- * mpn/generic/toom3_sqr.c: Reduce local scratch space.
+ * mpn/generic/mul.c: Use TMP_ALLOC_LIMBS for unbounded allocations.
2009-06-05 Torbjorn Granlund <tege@gmplib.org>
@@ -9281,187 +129,16 @@
FFT_TABLE2_SIZE if they are defined.
(struct nk): Use bit field.
-2009-06-05 Niels Möller <nisse@lysator.liu.se>
-
- * mpn/generic/toom44_mul.c (mpn_toom44_mult): Use
- mpn_toom_eval_dgr3_pm1.
-
- * mpn/generic/toom_eval_dgr3_pm1.c: New file.
-
- * mpn/generic/toom_interpolate_7pts.c (mpn_toom_interpolate_7pts):
- Minor cleanup, use mpn_add rather than mpn_add_n + MPN_INCR_U.
-
- * mpn/generic/toom44_mul.c (mpn_toom44_mul): Reorganized, to
- reduce the need for scratch space, and get rid of TMP_ALLOC.
-
-2009-06-05 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom_interpolate_7pts.c: Fall back mpn_divexact_byN to
- mpn_bdiv_q_1_pi1, if the latter is NATIVE.
-
-2009-06-04 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86_64/bdiv_q_1.asm: New file.
-
- * configure.in (HAVE_NATIVE): Add recently added functions.
- (GMP_MULFUNC_CHOICES): Handle addlsh_n, sublsh_n, rsblsh_n.
-
- * tune/common.c (speed_mpn_bdiv_q_1, speed_mpn_bdiv_q_1_pi1):
- New functions.
- * tune/speed.c (routine): Add mpn_bdiv_q_1 and mpn_bdiv_q_1_pi1.
- * tune/speed.h (SPEED_ROUTINE_MPN_BDIV_Q_1_PI1): New #define.
- (SPEED_ROUTINE_MPN_BDIV_Q_1): Mew #define.
-
- * configure.in (gmp_mpn_functions): Add bdiv_q_1.
- * mpn/generic/bdiv_q_1.c: New file.
- * mpn/asm-defs.m4 (define_mpn): Add mpn_bdiv_q_1 and mpn_bdiv_q_1_pi1.
- * gmp-impl.h (mpn_bdiv_q_1, mpn_bdiv_q_1_pi1): Declare.
-
- * mpn/x86_64/lshift.asm: Cleanup.
- * mpn/x86_64/rshift.asm: Cleanup.
-
- * mpn/x86_64/addlsh1_n.asm: Removed.
- * mpn/x86_64/aorrlsh1_n.asm: Generalised addlsh1_n.asm to handle
- addlsh1_n and rsblsh1_n functionality.
-
- * tests/refmpn.c (refmpn_rsblsh1_n): New function.
- * tests/devel/try.c: Test mpn_rsblsh1_n.
- * tests/tests.h: Declare refmpn_rsblsh1_n.
- * tune/common.c (speed_mpn_rsblsh1_n): New function.
- * tune/speed.c (routine): Add mpn_rsblsh1_n.
- * tune/speed.h (mpn_rsblsh1_n): Declare.
-
- * configure.in (gmp_mpn_functions_optional): Add rsblsh1_n.
- (GMP_MULFUNC_CHOICES): Handle rsblsh1_n defined with a mulfunc.
- * mpn/asm-defs.m4 (define_mpn): Add rsblsh1_n.
- * gmp-impl.h (mpn_rsblsh1_n): Declare.
-
- * mpn/generic/toom32_mul.c: Consistently use TOOM22_MUL_N_REC.
-
-2009-06-03 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom43_mul.c: New file.
- * mpn/generic/toom52_mul.c: New file.
- * mpn/generic/toom_interpolate_6pts.c: New file.
-
-2009-06-03 Torbjorn Granlund <tege@gmplib.org>
-
- * configure.in (gmp_mpn_functions): Add toom43_mul, toom52_mul, and
- toom_interpolate_6pts, but also some previously forgotten functions.
- * mpn/Makefile.am (nodist_EXTRA_libmpn_la_SOURCES): Likewise.
- * gmp-impl.h: Declare new functions. Sort toom function declarations.
-
- * gmp-impl.h: Rename toom4_* flags enum to toom7_*. Relevant C files
- updated.
-
- * mpn/generic/toom_interpolate_7pts (divexact_2exp): Remove.
-
-2009-06-02 Torbjorn Granlund <tege@gmplib.org>
-
- * demos/factorize.c: Add -q command line option.
-
-2009-06-02 Marco Bodrato <bodrato@mail.dm.unipi.it>
-
- * mpn/generic/toom_interpolate_7pts.c: Streamline, resulting in speed
- improvements.
-
- * mpn/generic/toom_interpolate_5pts.c: Likewise, but also completely
- do away with explicit scratch space.
- * gmp-impl.h (mpn_toom_interpolate_5pts): Update prototype.
-
- * mpn/generic/mul_n.c (mpn_toom3_sqr_n, mpn_toom3_mul_n):
- Update toom_interpolate_5pts call without scratch space parameter.
- * mpn/generic/toom3_sqr.c: Likewise.
- * mpn/generic/toom42_mul.c: Likewise.
- * mpn/generic/toom33_mul.c: Likewise.
-
- * mpn/generic/toom33_mul.c: Reduce local scratch space.
- * mpn/generic/toom32_mul.c: Rewrite to not use local scratch space.
-
-2009-06-02 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/toom22_mul.c (TOOM22_MUL_MN_REC): New macro, use it for
- oo point.
-
2009-06-01 Torbjorn Granlund <tege@gmplib.org>
- * mpn/generic/mul.c: Loop to avoid excessive recursion in toom33 and
- toom44 slicing code.
-
* mpz/remove.c: Correctly handle multiplicity that does not fit an int.
* Makefile.am (dist-hook): Check library version consistency.
- * mpn/generic/mul.c: Rewrite.
-
-2009-05-29 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-divis.c (check_random): Create huge test operands.
-
- * mpn/generic/toom44_mul.c: Allocate temp space using one TMP_ALLOC
- call, not multiple TMP_SALLOC.
- * mpn/generic/toom4_sqr.c: Likewise.
-
- * gmp-impl.h (mpn_toom22_mul_itch): Replace totally wrong code.
-
- * mpn/generic/mullow_n.c: Relax overlap requirement implied by ASSERT.
-
- * mpn/generic/divis.c: Rewrite.
-
- * gmp-impl.h (mpn_mu_bdiv_qr): Now returns mp_limb_t.
- (mpn_toom2_sqr_itch): Simplify.
-
- * mpn/generic/mu_bdiv_qr.c: Implement properly.
-
-2009-05-27 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/generic/mod_1_1.c: Add proper ASSERT functionality cps function.
- * mpn/generic/mod_1_2.c: Likewise.
- * mpn/generic/mod_1_3.c: Likewise.
- * mpn/generic/mod_1_4.c: Likewise.
-
- * tune: Add speed measuring of toom22, toom33, and toom44.
-
- * mpn/generic/toom22_mul.c: Handle potentially unbalanced coefficient
- product better.
-
-2009-05-26 Torbjorn Granlund <tege@gmplib.org>
-
- * tests/mpz/t-mul.c (ref_mpn_mul): Use mpn_toom44_mul in FFT range for
- better huge-operands performance.
-
2009-05-24 Torbjorn Granlund <tege@gmplib.org>
* acinclude.m4 (GMP_ASM_LSYM_PREFIX): Try "$L" too, before "$".
-2009-05-23 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-impl.h (mpn_mod_1s_1p,mpn_mod_1s_2p,mpn_mod_1s_3p,mpn_mod_1s_4p):
- Declare using __GMP_ATTRIBUTE_PURE.
-
- * tune/tuneup.c (tune_mod_1): Specify check_size for measuring mod_1_N
- functions.
- (one): Remove redundant size loop exit condition.
-
-2009-05-20 Torbjorn Granlund <tege@gmplib.org>
-
- * mpn/x86/pentium4/sse2/mod_1_4.asm: New file.
- * mpn/x86/p6/sse2/mod_1_4.asm: New file (grabbing pentium4 code).
-
-2009-05-18 Torbjorn Granlund <tege@gmplib.org>
-
- * gmp-h.in (__GNU_MP_VERSION_MINOR): Bump to 4.
- (__GNU_MP_VERSION_PATCHLEVEL): Set to -1.
-
- * mpn/x86_64/mod_1_4.asm: New file.
-
- * mpn/asm-defs.m4: Correct names for mod_1_N functions.
- Add defines for corresponding cps functions.
-
- * mpn/generic/mod_1_2.c: Support any sizes > 1.
- * mpn/generic/mod_1_3.c: Likewise.
- * mpn/generic/mod_1_4.c: Likewise.
-
2009-05-12 Torbjorn Granlund <tege@gmplib.org>
* Version 4.3.1 released.
@@ -9531,7 +208,7 @@
2009-04-26 Torbjorn Granlund <tege@gmplib.org>
- * config.guess: Recognise more POWER processor types.
+ * config.guess: Recognize more POWER processor types.
2009-04-25 Torbjorn Granlund <tege@gmplib.org>
@@ -9554,9 +231,6 @@
* mpn/x86_64/darwin.m4: Likewise.
* mpn/x86_64/sqr_basecase.asm: Rework switch code using JUMPTABSECT.
- * tune/common.c (speed_mpn_hgcd, speed_mpn_hgcd_lehmer):
- Remove an unused variable.
-
* mpn/x86/x86-defs.m4 (LEA): Get SIZE arguments right.
2009-04-14 Torbjorn Granlund <tege@gmplib.org>
@@ -9597,7 +271,7 @@
2009-03-09 Torbjorn Granlund <tege@gmplib.org>
- * mpn/x86_64/divrem_1.asm: Add a nop to save a cycle in unnormalised
+ * mpn/x86_64/divrem_1.asm: Add a nop to save a cycle in unnormalized
case.
2009-03-05 Torbjorn Granlund <tege@gmplib.org>
@@ -9657,7 +331,7 @@
* tune/tuneup.c (tune_mod_1): Run MOD_1_x_THRESHOLD tests also when
longlong.h specified UDIV_PREINV_ALWAYS.
- * mpn/generic/mod_1.c (mpn_mod_1): Properly check for normalisation
+ * mpn/generic/mod_1.c (mpn_mod_1): Properly check for normalization
divisor.
2009-01-13 Torbjorn Granlund <tege@gmplib.org>
@@ -9686,7 +360,7 @@
* 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>
@@ -9698,7 +372,7 @@
* 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.
@@ -10009,7 +683,7 @@
* 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)
@@ -10045,7 +719,7 @@
* 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.
@@ -10067,7 +741,7 @@
* 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.
@@ -10078,7 +752,7 @@
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.
@@ -10090,7 +764,7 @@
* 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.
@@ -10137,7 +811,7 @@
* 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.
@@ -10158,7 +832,7 @@
* 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.
@@ -10177,7 +851,7 @@
* 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.
@@ -10206,7 +880,7 @@
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.
@@ -10251,14 +925,14 @@
(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
@@ -10309,7 +983,7 @@
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.
@@ -10318,14 +992,14 @@
Deleted rn argument.
(mpn_gcdext): Updated calls to addmul2_n, and added assertions.
- * gmp-impl.h (MPN_HGCD_MATRIX_INIT_ITCH): Increased storage by 4 limbs.
+ * gmp-impl.h (MPN_HGCD_MATRIX_INIT_ITCH): Increased storage by four 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. Tighter bounds
+ (mpn_hgcd_matrix_mul): Deleted normalization code. Tigher bounds
for the element size of the product. Needs two extra limbs of
storage for the elements.
(mpn_hgcd_itch): Updated storage calculation.
@@ -10335,7 +1009,7 @@
* 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.
@@ -10347,7 +1021,7 @@
(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.
@@ -10359,7 +1033,7 @@
* 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.
@@ -10384,14 +1058,14 @@
* 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
@@ -10423,7 +1097,7 @@
* 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.
@@ -10455,7 +1129,7 @@
* 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.
@@ -10508,7 +1182,7 @@
* 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.
@@ -10546,7 +1220,7 @@
* 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
@@ -10766,6 +1440,7 @@
usable for local symbols.
(LEA): Replace with code for external references.
+
* mpn/powerpc32/vmx/mod_34lsub1.asm: Use LEAL.
2007-10-07 Torbjorn Granlund <tege@swox.com>
@@ -10783,7 +1458,7 @@
* mpn/x86/p6/aors_n.asm: Table cycle counts.
- * mpn/x86/k7/mod_34lsub1.asm: Fix over-optimistic cycle count claims.
+ * mpn/x86/k7/mod_34lsub1.asm: Fix over-optimisitc cycle count claims.
* mpn/x86/x86-defs.m4 (DEF_OBJECT, END_OBJECT): New define's.
@@ -10828,12 +1503,12 @@
* mpz/get_str.c: Cast a char index to int to shut up compilers.
- * mpn/generic/dc_div_qr.c: Pass dummy scratch argument to mpn_invert.
- * mpn/generic/dc_divappr_q.c: Likewise.
- * mpn/generic/mu_div_qr.c: Likewise.
- * mpn/generic/mu_divappr_q.c: Likewise.
- * mpn/generic/mu_div_q.c: Likewise.
- * mpn/generic/divexact.c: Likewise.
+ * dc_div_qr.c: Pass dummy scratch argument to mpn_invert.
+ * dc_divappr_q.c: Likewise.
+ * mu_div_qr.c: Likewise.
+ * mu_divappr_q.c: Likewise.
+ * mu_div_q.c: Likewise.
+ * divexact.c: Likewise.
* mpn/generic/invert.c: New file, placeholder for now.
@@ -11736,7 +2411,7 @@
* 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
@@ -12032,7 +2707,7 @@
* 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.
@@ -12043,7 +2718,7 @@
* 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
@@ -12415,14 +3090,14 @@
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.
@@ -12460,7 +3135,7 @@
(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.
@@ -12574,7 +3249,7 @@
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,
@@ -12680,7 +3355,7 @@
(what_objects): Only demand 9 object files, as for instance occurs in
the scanf directory.
(asm files): Transform labels L(foo) -> Lfoo. Take func name from
- PROLOGUE to support empty "EPILOGUE()". Recognise and substitute
+ PROLOGUE to support empty "EPILOGUE()". Recognise and subsitute
register name "define()"s.
* macos/Makefile.in (CmnObjs): Add tal-notreent.o.
@@ -12704,7 +3379,7 @@
* 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.
@@ -12956,7 +3631,7 @@
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.
@@ -13023,7 +3698,7 @@
* 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.
@@ -13103,7 +3778,7 @@
* tests/mpn/t-hgcd.c: Remove unused variables.
* mpn/ia64/hamdist.asm: Remove bundling incompatible with HP-UX
- assembler. Misc HP-UX changes.
+ assember. Misc HP-UX changes.
* mpn/ia64/gcd_1.asm: Add some syntax to placid the HP-UX assembler.
2004-02-11 Kevin Ryde <kevin@swox.se>
@@ -13133,11 +3808,11 @@
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.
@@ -13154,7 +3829,7 @@
* 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.
@@ -13210,7 +3885,7 @@
* 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.
@@ -13234,7 +3909,7 @@
* 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.
@@ -13250,13 +3925,13 @@
* 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.
* mpn/generic/hgcd.c (mpn_hgcd_lehmer_itch, mpn_hgcd_lehmer)
- (mpn_hgcd_equal): Deleted functions.
+ (mpn_hgcd_equal): Deleted functions.
* mpn/generic/gcd.c (hgcd_start_row_p): Deleted function.
(gcd_schoenhage): Deleted assertion code using mpn_hgcd_lehmer.
@@ -13293,7 +3968,7 @@
(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.
@@ -13317,7 +3992,7 @@
(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.
@@ -13330,7 +4005,7 @@
* 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.
@@ -13339,7 +4014,7 @@
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
@@ -13523,7 +4198,7 @@
* 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.
@@ -13564,7 +4239,7 @@
(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.
@@ -13592,7 +4267,7 @@
* 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.
@@ -13612,7 +4287,7 @@
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.
@@ -13620,7 +4295,7 @@
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.
@@ -13672,7 +4347,7 @@
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.
@@ -13778,7 +4453,7 @@
* 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.
@@ -13842,7 +4517,7 @@
(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.
@@ -13883,7 +4558,7 @@
numbers.
(hgcd_tdiv): New function.
(gcd_lehmer): New function, currently #if:ed out.
- (hgcd_start_row_p): New function, duplicated from hgcd.c.
+ (hgcd_start_row_p): New function, duplicatd from hgcd.c.
(gcd_schoenhage_itch): New function.
(gcd_schoenhage): New function.
(mpn_gcd): New advertised gcd function, which calls
@@ -13896,12 +4571,12 @@
* 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).
@@ -13912,7 +4587,7 @@
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.
@@ -13923,7 +4598,7 @@
* 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)
@@ -14321,7 +4996,7 @@
2003-10-21 Torbjorn Granlund <tege@swox.com>
- * mpn/ia64/submul_1.asm: Slightly reschedule loop to accommodate
+ * mpn/ia64/submul_1.asm: Slightly reschedule loop to accomodate
Itanium 2 getf.sig latency.
2003-10-21 Kevin Ryde <kevin@swox.se>
@@ -14756,7 +5431,7 @@
2003-09-24 Torbjorn Granlund <tege@swox.com>
- * tune/speed.c (routine): Add entries for mpn_addlsh1_n, mpn_sublsh1_n,
+ * tune/speed.c (routine): Add entires 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,
@@ -14850,7 +5525,7 @@
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): Accommodate
+ * gmp-impl.h (MPN_TOOM3_MUL_N_TSIZE, MPN_TOOM3_SQR_N_TSIZE): Accomodate
latest toom3 code.
2003-09-19 Kevin Ryde <kevin@swox.se>
@@ -15106,7 +5781,7 @@
* 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.
@@ -15243,7 +5918,7 @@
* mpn/sparc32/v9/udiv.asm: Amend heading, this file is for sparc v9.
* tests/cxx/Makefile.am (TESTS_ENVIRONMENT): In libtool openbsd hack,
- discard error messages from cp, for the benefit of --disable-shared or
+ disard 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
@@ -15715,7 +6390,7 @@
* mpz/get_str.c: Likewise.
* mpf/get_str.c: Likewise.
- * mpz/inp_str.c: Restructure to allocate more string space just
+ * mpz/inp_str.c: Restucture to allocate more string space just
before needed.
* mpbsd/min.c: Likewise.
@@ -15762,7 +6437,7 @@
* 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>
@@ -16942,7 +7617,7 @@
* tune/tuneup.c (sqr_karatsuba_threshold): Initialize to
TUNE_SQR_KARATSUBA_MAX so mpn_sqr_n works for randmt initialization.
- * gmp.texi (Integer Comparisons): Remove mention of non-existent
+ * gmp.texi (Integer Comparisons): Remove mention of non-existant
mpz_cmpabs_si, reported by Conrad Curry.
* tune/speed.c, tune/speed.h, tune/common.c: Add gmp_randseed,
@@ -18035,7 +8710,7 @@
* mpf/fits_u.h: Rewrite - nailify.
* mpf/fits_s.h: Likewise.
- * mpz/mod.c: Disambiguate if-statement with extra {}.
+ * mpz/mod.c: Disambiguate if-statament with extra {}.
* mpf/int_p.c: Fix type of size variables.
* mpf/get_ui: Likewise.
@@ -19193,7 +9868,7 @@
* mpn/mp_bases.c: Add entries for base 256. Remove __ prefix from
table name.
- * gmp-impl.h (__mp_bases): Remove superfluous mp_ part of name, making
+ * gmp-impl.h (__mp_bases): Remove superflous `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.
@@ -24794,7 +15469,7 @@
* mp.h (mp_set_memory_functions): Add missing #define.
* mpbsd/tests/allfuns.c (mp_set_memory_functions): Verify its
- existence.
+ existance.
* mpf/tests/t-misc.c (check_mpf_getset_prec): New test, verifying
reverted behaviour of mpf_get_prec.
@@ -26101,7 +16776,7 @@
* mpn/powerpc32: Use dnl/C instead of `#' for comments.
* config.guess: Get "model" limit between pentium 2 and pentium3 right.
- Get rid of code determining `_' prefix; use double labels instead.
+ Get rid of code determining `_' prefix; use double labels instead.
* config.guess: Partially merge with FSF version of April 22.
(Don't bring over NetBSD changes for now.)
@@ -26273,7 +16948,7 @@
2000-04-16 Torbjorn Granlund <tege@swox.com>
- * mpn/generic/dump.c: Suppress output of leading zeros.
+ * mpn/generic/dump.c: Suppress output of leadign zeros.
* mpz/inp_str.c: Fix memory leakage.
@@ -26669,8 +17344,8 @@
* mpn/Makefile.am: Remove incorrect comment.
* mpn/Makefile.in: Regenerate.
- * gmp.h: Rename most of the random number functions, structs and some
- of the struct members.
+ * gmp.h: Rename most of the random number functions, structs and
+ some of the struct members.
* rand.c (gmp_randinit): Likewise.
* randclr.c (gmp_randclear): Likewise.
* randlc.c (gmp_randinit_lc): Likewise.
@@ -26907,7 +17582,7 @@
* randraw.c (gmp_rand_getraw): Handle the case where (1) the LC
scheme doesn't generate even limbs and (2) more than one LC
- invocation is necessary to produce the requested number of bits.
+ invokation is necessary to produce the requested number of bits.
2000-04-05 Torbjorn Granlund <tege@swox.com>
@@ -27180,7 +17855,7 @@
tests/rand/Makefile.
* acinclude.m4 (AC_CANONICAL_BUILD): Define to
- `_AC_CANONICAL_BUILD' to deal with incompatibilities between
+ `_AC_CANONICAL_BUILD' to deal with incompabilities between
Autoconf and Libtool.
(AC_CHECK_TOOL_PREFIX): Likewise.
@@ -28027,7 +18702,7 @@
appropriate.
(athlon-*-*): Fix typo.
- * config.guess: Update x86 recog code to initially match
+ * config.guess: Update x86 recog code to intiallly match
more than just i386.
Call K6-2 and K6-III for "k62" and "k63" respectively.
@@ -28959,7 +19634,7 @@ Wed Mar 4 19:29:16 1998 Torbjorn Granlund <tege@matematik.su.se>
* configure.in (i[3456]86* etc): Check if using gcc before
choosing mt-x86.
- * configure.in (m68*-*-*): New alternative.
+ * configure.in (m68*-*-*): New alterantive.
* config/mt-m68k: New file.
* mpn/alpha/invert-limb.s: Put tables in text segment,
@@ -28981,7 +19656,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
- numbers specifically; check small factors, then perform a fermat test.
+ numers specifically; check small factors, then perform a fermat test.
Tue Jan 13 14:58:28 1998 Torbjorn Granlund <tege@tunnis.tmg.se>
@@ -29283,7 +19958,7 @@ Fri Oct 18 03:13:54 1996 Torbjorn Granlund <tege@quiet.matematik.su.se>
* mpn/x86/pentium/[lr]shift.S: Likewise.
* mpn/config/t-oldgas (SFLAGS): Pass -DOLD_GAS.
- * gmp-impl.h: In code for determining endianness, test also
+ * gmp-impl.h: In code for determining endianess, test also
__BIG_ENDIAN__ and __hppa__. Remove test of __NeXT__.
Wed Oct 16 03:50:34 1996 Torbjorn Granlund <tege@quiet.matematik.su.se>
@@ -31758,7 +22433,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: Clarify comment.
+ * bsd/sdiv.c: Clearify comment.
Sun Apr 25 00:31:28 1993 Torbjorn Granlund (tege@pde.nada.kth.se)
@@ -32018,7 +22693,7 @@ Fri Dec 13 23:10:02 1991 Torbjorn Granlund (tege@zevs.sics.se)
* mpz_do_sqrt: Simplify special case for U == 0.
* m*sqrt*.c, mpz_perfsqr.c (mpz_perfect_square_p):
- Rename _mpz_impl_sqrt to _mpz_do_sqrt.
+ Rename _mpz_impl_sqrt to _mpz_do_sqrt.
Fri Dec 13 12:52:28 1991 Torbjorn Granlund (tege@zevs.sics.se)
@@ -32559,7 +23234,7 @@ Thu Jul 11 10:08:21 1991 Torbjorn Granlund (tege@zevs.sics.se)
* dist-Makefile: Go via tmp- files for cre* redirection.
* dist-Makefile: Add tmp* to "clean" target.
- * dist-Makefile: Use LOCAL_CC for cre*, to simplify cross
+ * dist-Makefile: Use LOCAL_CC for cre*, to simplyfy cross
compilation.
* gmp.h, mp.h: Don't define NULL here.
@@ -32586,7 +23261,7 @@ Tue Jul 9 18:40:30 1991 Torbjorn Granlund (tege@zevs.sics.se)
* gmp.h: Add declaration of mpq_clear.
- * dist-Makefile: Check if "ranlib" exists, before using it.
+ * dist-Makefile: Chack 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".
@@ -32734,7 +23409,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 described in the manual.
+ * Fold in many missing routines descibed in the manual.
* Update Makefile.
Wed May 22 13:48:46 1991 Torbjorn Granlund (tege@zevs.sics.se)
@@ -32797,7 +23472,7 @@ Sun Apr 28 20:21:04 1991 Torbjorn Granlund (tege@zevs.sics.se)
Sat Apr 27 21:03:11 1991 Torbjorn Granlund (tege@zevs.sics.se)
- * Install multiplication using Karatsuba's algorithm as default.
+ * Install multplication using Karatsuba's algorithm as default.
Fri Apr 26 01:03:57 1991 Torbjorn Granlund (tege@zevs.sics.se)
@@ -32815,7 +23490,7 @@ Wed Apr 24 21:39:22 1991 Torbjorn Granlund (tege@zevs.sics.se)
Mon Apr 22 01:31:57 1991 Torbjorn Granlund (tege@zevs.sics.se)
- * karatsuba.c: New file for Karatsuba's multiplication algorithm.
+ * karatsuba.c: New file for Karatsuba's multplication algorithm.
* mpz_random, mpz_init, mpz_mod_2exp: New files and functions.
@@ -32910,7 +23585,7 @@ Fri Mar 15 00:26:29 1991 Torbjorn Granlund (tege@musta.nada.kth.se)
Thu Mar 14 18:45:28 1991 Torbjorn Granlund (tege@musta.nada.kth.se)
- * mpq_mul.c: New file for rational multiplication.
+ * mpq_mul.c: New file for rational multplication.
* gmp.h: Add definitions for rational arithmetics.
diff --git a/gmp/INSTALL b/gmp/INSTALL
index 75199a1aba..53427abed5 100644
--- a/gmp/INSTALL
+++ b/gmp/INSTALL
@@ -1,30 +1,20 @@
-Copyright 1996, 1997, 1999-2002, 2006 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -37,9 +27,12 @@ see https://www.gnu.org/licenses/.
These instructions are only for the impatient. Others should read the install
instructions in gmp.info. Use
- info -f doc/gmp.info
+ info -f ./gmp.info
+
+or in emacs
+
+ C-u C-h i gmp.info
-from the gmp source directory.
Here are some brief instructions on how to install GMP. First you need to
compile. Since you're impatient, try this
@@ -70,7 +63,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: https://gmplib.org/.
+The GMP web site is located here: http://gmplib.org/.
----------------
diff --git a/gmp/INSTALL.autoconf b/gmp/INSTALL.autoconf
index 0600b32390..54caf7c190 100644
--- a/gmp/INSTALL.autoconf
+++ b/gmp/INSTALL.autoconf
@@ -1,4 +1,5 @@
-Copyright (C) 1994-1996, 1999-2002 Free Software Foundation, Inc.
+Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+Foundation, Inc.
This file is free documentation; the Free Software Foundation gives
unlimited permission to copy, distribute and modify it.
diff --git a/gmp/Makefile.am b/gmp/Makefile.am
index 8567c0e3f6..6a2bd13657 100644
--- a/gmp/Makefile.am
+++ b/gmp/Makefile.am
@@ -1,34 +1,23 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1991, 1993, 1994, 1996, 1997, 1999-2004, 2006-2009, 2011-2014 Free
-# Software Foundation, Inc.
+# Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2006, 2007, 2008, 2009 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have 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 following options are the same as AM_INIT_AUTOMAKE in configure.in,
@@ -36,7 +25,7 @@
# Makefiles in subdirectories, but here we must omit it so automake gives
# the actual ansi2knr build rule, not "cd $(top_builddir) && make ansi2knr".
#
-# AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies
+AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies ansi2knr
# Libtool -version-info for libgmp.la and libmp.la. See "Versioning" in the
@@ -76,16 +65,6 @@
# 4.3.0 8:0:5 5:0:1 4:14:1
# 4.3.1 8:1:5 5:1:1 4:15:1 WRONG Really used same as 4.3.0
# 4.3.2 8:2:5 5:2:1 4:16:1
-# 5.0.0 9:0:6 6:0:2 4:20:1 Should have been 10:0:0
-# 5.0.1 10:1:0 6:1:2 4:21:1
-# 5.0.2 10:2:0 6:2:2 4:22:1
-# 5.0.3 10:3:0 6:3:2 4:23:1
-# 5.0.4 10:4:0 6:4:2 4:24:1
-# 5.0.5 10:5:0 6:5:2 4:25:1
-# 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 -
-# 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
@@ -98,20 +77,22 @@
# 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 = 12
-LIBGMP_LT_REVISION = 0
-LIBGMP_LT_AGE = 2
+LIBGMP_LT_CURRENT = 8
+LIBGMP_LT_REVISION = 2
+LIBGMP_LT_AGE = 5
-LIBGMPXX_LT_CURRENT = 8
-LIBGMPXX_LT_REVISION = 0
-LIBGMPXX_LT_AGE = 4
+LIBGMPXX_LT_CURRENT = 5
+LIBGMPXX_LT_REVISION = 2
+LIBGMPXX_LT_AGE = 1
+LIBMP_LT_CURRENT = 4
+LIBMP_LT_REVISION = 16
+LIBMP_LT_AGE = 1
-SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
-EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
- COPYING.LESSERv3 COPYINGv2 COPYINGv3
+SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune doc
+EXTRA_DIST = macos configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf
if WANT_CXX
GMPXX_HEADERS_OPTION = gmpxx.h
@@ -124,13 +105,13 @@ EXTRA_DIST += gmpxx.h
#
# $exec_prefix/include is not in the default include path for gcc built to
# the same $prefix and $exec_prefix, which might mean gmp.h is not found,
-# but anyone knowledgeable enough to be playing with exec_prefix will be able
+# but anyone knowledgable enough to be playing with exec_prefix will be able
# to address that.
#
includeexecdir = $(exec_prefix)/include
include_HEADERS = $(GMPXX_HEADERS_OPTION)
-nodist_includeexec_HEADERS = gmp.h
-lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION)
+nodist_includeexec_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION)
+lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION) $(MPBSD_LTLIBRARIES_OPTION)
BUILT_SOURCES = gmp.h
@@ -140,14 +121,14 @@ DISTCLEANFILES = $(BUILT_SOURCES) config.m4 @gmp_srclinks@
INCLUDES=-D__GMP_WITHIN_GMP
-MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/inits$U.lo mpf/set$U.lo \
- mpf/set_ui$U.lo mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo \
- mpf/set_z$U.lo mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo \
- mpf/iset_str$U.lo mpf/iset_d$U.lo mpf/clear$U.lo mpf/clears$U.lo \
- mpf/get_str$U.lo mpf/dump$U.lo mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo \
- mpf/sqrt$U.lo mpf/random2$U.lo mpf/inp_str$U.lo mpf/out_str$U.lo \
- mpf/add$U.lo mpf/add_ui$U.lo mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo \
- mpf/mul$U.lo mpf/mul_ui$U.lo mpf/div$U.lo mpf/div_ui$U.lo \
+MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/set$U.lo mpf/set_ui$U.lo \
+ mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo mpf/set_z$U.lo \
+ mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo mpf/iset_str$U.lo \
+ mpf/iset_d$U.lo mpf/clear$U.lo mpf/get_str$U.lo mpf/dump$U.lo \
+ mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo mpf/sqrt$U.lo mpf/random2$U.lo \
+ mpf/inp_str$U.lo mpf/out_str$U.lo mpf/add$U.lo mpf/add_ui$U.lo \
+ mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo mpf/mul$U.lo mpf/mul_ui$U.lo \
+ mpf/div$U.lo mpf/div_ui$U.lo \
mpf/cmp$U.lo mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \
mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \
mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo mpf/set_dfl_prec$U.lo \
@@ -167,39 +148,35 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/cdiv_qr$U.lo mpz/cdiv_qr_ui$U.lo \
mpz/cdiv_r$U.lo mpz/cdiv_r_ui$U.lo mpz/cdiv_ui$U.lo \
mpz/cfdiv_q_2exp$U.lo mpz/cfdiv_r_2exp$U.lo \
- mpz/clear$U.lo mpz/clears$U.lo mpz/clrbit$U.lo \
+ mpz/clear$U.lo mpz/clrbit$U.lo \
mpz/cmp$U.lo mpz/cmp_d$U.lo mpz/cmp_si$U.lo mpz/cmp_ui$U.lo \
mpz/cmpabs$U.lo mpz/cmpabs_d$U.lo mpz/cmpabs_ui$U.lo \
mpz/com$U.lo mpz/combit$U.lo \
mpz/cong$U.lo mpz/cong_2exp$U.lo mpz/cong_ui$U.lo \
mpz/divexact$U.lo mpz/divegcd$U.lo mpz/dive_ui$U.lo \
mpz/divis$U.lo mpz/divis_ui$U.lo mpz/divis_2exp$U.lo mpz/dump$U.lo \
- mpz/export$U.lo mpz/mfac_uiui$U.lo \
- mpz/2fac_ui$U.lo mpz/fac_ui$U.lo mpz/oddfac_1$U.lo mpz/prodlimbs$U.lo \
+ mpz/export$U.lo mpz/fac_ui$U.lo mpz/fdiv_q$U.lo \
mpz/fdiv_q_ui$U.lo mpz/fdiv_qr$U.lo mpz/fdiv_qr_ui$U.lo \
- mpz/fdiv_r$U.lo mpz/fdiv_r_ui$U.lo mpz/fdiv_q$U.lo \
+ mpz/fdiv_r$U.lo mpz/fdiv_r_ui$U.lo \
mpz/fdiv_ui$U.lo mpz/fib_ui$U.lo mpz/fib2_ui$U.lo mpz/fits_sint$U.lo \
mpz/fits_slong$U.lo mpz/fits_sshort$U.lo mpz/fits_uint$U.lo \
mpz/fits_ulong$U.lo mpz/fits_ushort$U.lo mpz/gcd$U.lo \
mpz/gcd_ui$U.lo mpz/gcdext$U.lo mpz/get_d$U.lo mpz/get_d_2exp$U.lo \
mpz/get_si$U.lo mpz/get_str$U.lo mpz/get_ui$U.lo mpz/getlimbn$U.lo \
mpz/hamdist$U.lo \
- mpz/import$U.lo mpz/init$U.lo mpz/init2$U.lo mpz/inits$U.lo \
- mpz/inp_raw$U.lo mpz/inp_str$U.lo mpz/invert$U.lo \
+ mpz/import$U.lo mpz/init$U.lo mpz/init2$U.lo mpz/inp_raw$U.lo \
+ mpz/inp_str$U.lo mpz/invert$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/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/lcm$U.lo mpz/lcm_ui$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 \
mpz/out_raw$U.lo mpz/out_str$U.lo mpz/perfpow$U.lo mpz/perfsqr$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/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_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/roinit_n$U.lo \
+ mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$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 \
@@ -213,10 +190,10 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/urandomm$U.lo mpz/xor$U.lo
MPQ_OBJECTS = mpq/abs$U.lo mpq/aors$U.lo \
- mpq/canonicalize$U.lo mpq/clear$U.lo mpq/clears$U.lo \
+ mpq/canonicalize$U.lo mpq/clear$U.lo \
mpq/cmp$U.lo mpq/cmp_si$U.lo mpq/cmp_ui$U.lo mpq/div$U.lo \
mpq/get_d$U.lo mpq/get_den$U.lo mpq/get_num$U.lo mpq/get_str$U.lo \
- mpq/init$U.lo mpq/inits$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \
+ mpq/init$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \
mpq/md_2exp$U.lo mpq/mul$U.lo mpq/neg$U.lo mpq/out_str$U.lo \
mpq/set$U.lo mpq/set_den$U.lo mpq/set_num$U.lo \
mpq/set_si$U.lo mpq/set_str$U.lo mpq/set_ui$U.lo \
@@ -242,18 +219,19 @@ SCANF_OBJECTS = \
scanf/scanf$U.lo scanf/sscanf$U.lo scanf/sscanffuns$U.lo \
scanf/vfscanf$U.lo scanf/vscanf$U.lo scanf/vsscanf$U.lo
-RANDOM_OBJECTS = \
- rand/rand$U.lo rand/randclr$U.lo rand/randdef$U.lo rand/randiset$U.lo \
- rand/randlc2s$U.lo rand/randlc2x$U.lo rand/randmt$U.lo \
- rand/randmts$U.lo rand/rands$U.lo rand/randsd$U.lo rand/randsdui$U.lo \
- rand/randbui$U.lo rand/randmui$U.lo
-
# no $U for C++ files
CXX_OBJECTS = \
cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo \
- cxx/limits.lo cxx/osdoprnti.lo cxx/osfuns.lo \
+ cxx/osdoprnti.lo cxx/osfuns.lo \
cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo
+MPBSD_OBJECTS = mpbsd/add$U.lo mpbsd/tdiv_qr$U.lo mpbsd/set$U.lo \
+ mpbsd/powm$U.lo mpbsd/sub$U.lo mpbsd/cmp$U.lo mpbsd/mfree$U.lo \
+ mpbsd/mtox$U.lo mpbsd/realloc$U.lo mpbsd/gcd$U.lo mpbsd/itom$U.lo \
+ mpbsd/min$U.lo mpbsd/mul$U.lo mpbsd/mout$U.lo mpbsd/rpow$U.lo \
+ mpbsd/sdiv$U.lo mpbsd/sqrtrem$U.lo mpbsd/xtom$U.lo
+
+
# In libtool 1.5 it doesn't work to build libgmp.la from the convenience
# libraries like mpz/libmpz.la. Or rather it works, but it ends up putting
# PIC objects into libgmp.a if shared and static are both built. (The PIC
@@ -268,15 +246,16 @@ CXX_OBJECTS = \
# -export-symbols, since the tune and speed programs, and perhaps some of
# the test programs, want to access undocumented symbols.
-libgmp_la_SOURCES = gmp-impl.h longlong.h \
+libgmp_la_SOURCES = gmp-impl.h longlong.h randmt.h \
assert.c compat.c errno.c extract-dbl.c invalid.c memory.c \
mp_bpl.c mp_clz_tab.c mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c \
- version.c nextprime.c primesieve.c
+ rand.c randclr.c randdef.c randiset.c randlc2s.c randlc2x.c randmt.c \
+ randmts.c rands.c randsd.c randsdui.c randbui.c randmui.c version.c
EXTRA_libgmp_la_SOURCES = tal-debug.c tal-notreent.c tal-reent.c
libgmp_la_DEPENDENCIES = @TAL_OBJECT@ \
$(MPF_OBJECTS) $(MPZ_OBJECTS) $(MPQ_OBJECTS) \
$(MPN_OBJECTS) @mpn_objs_in_libgmp@ \
- $(PRINTF_OBJECTS) $(SCANF_OBJECTS) $(RANDOM_OBJECTS)
+ $(PRINTF_OBJECTS) $(SCANF_OBJECTS)
libgmp_la_LIBADD = $(libgmp_la_DEPENDENCIES)
libgmp_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMP_LDFLAGS) \
-version-info $(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE)
@@ -296,6 +275,28 @@ libgmpxx_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMPXX_LDFLAGS) \
-version-info $(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE)
+# The selected mpz objects here support mpz/powm.c (built as mpbsd/powm.lo)
+# and can probably be removed when that switches to an mpn implementation.
+# (Apart from mpz/n_pow_ui$U.lo, which supports mpbsd/rpow.c)
+
+if WANT_MPBSD
+MPBSD_HEADERS_OPTION = mp.h
+MPBSD_LTLIBRARIES_OPTION = libmp.la
+endif
+BUILT_SOURCES += mp.h
+libmp_la_SOURCES = assert.c errno.c memory.c mp_bpl.c mp_clz_tab.c \
+ mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c
+libmp_la_DEPENDENCIES = $(srcdir)/libmp.sym \
+ @TAL_OBJECT@ $(MPBSD_OBJECTS) $(MPN_OBJECTS) @mpn_objs_in_libmp@ \
+ mpz/add$U.lo mpz/gcdext$U.lo mpz/invert$U.lo mpz/mul$U.lo \
+ mpz/n_pow_ui$U.lo mpz/realloc$U.lo mpz/set$U.lo mpz/sub$U.lo \
+ mpz/tdiv_q$U.lo
+libmp_la_LIBADD = $(libmp_la_DEPENDENCIES)
+libmp_la_LDFLAGS = $(GMP_LDFLAGS) \
+ -version-info $(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE) \
+ -export-symbols $(srcdir)/libmp.sym
+EXTRA_DIST += libmp.sym
+
install-data-hook:
@echo ''
@@ -314,6 +315,9 @@ install-data-hook:
@echo ''
+# The ansi2knr setups for the build programs are the same as the normal
+# automake ansi2knr rules, but using $(CC_FOR_BUILD) instead of $(CC).
+#
# The "test -f" support for srcdir!=builddir is similar to the automake .c.o
# etc rules, but with each foo.c explicitly, since $< is not portable
# outside an inference rule.
@@ -330,78 +334,67 @@ install-data-hook:
# the .h files are not properly expressed for the various objects that use
# them.
-EXTRA_DIST += bootstrap.c
+EXTRA_DIST += dumbmp.c
+
+mpz/fac_ui.h: gen-fac_ui$(EXEEXT_FOR_BUILD)
+ ./gen-fac_ui $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpz/fac_ui.h || (rm -f mpz/fac_ui.h; exit 1)
+BUILT_SOURCES += mpz/fac_ui.h
-fac_table.h: gen-fac$(EXEEXT_FOR_BUILD)
- ./gen-fac $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fac_table.h || (rm -f fac_table.h; exit 1)
-BUILT_SOURCES += fac_table.h
+gen-fac_ui$(EXEEXT_FOR_BUILD): gen-fac_ui$(U_FOR_BUILD).c dumbmp.c
+ $(CC_FOR_BUILD) `test -f 'gen-fac_ui$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fac_ui$(U_FOR_BUILD).c -o gen-fac_ui$(EXEEXT_FOR_BUILD)
+DISTCLEANFILES += gen-fac_ui$(EXEEXT_FOR_BUILD)
+EXTRA_DIST += gen-fac_ui.c
-gen-fac$(EXEEXT_FOR_BUILD): gen-fac$(U_FOR_BUILD).c bootstrap.c
- $(CC_FOR_BUILD) `test -f 'gen-fac$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fac$(U_FOR_BUILD).c -o gen-fac$(EXEEXT_FOR_BUILD)
-DISTCLEANFILES += gen-fac$(EXEEXT_FOR_BUILD)
-EXTRA_DIST += gen-fac.c
+gen-fac_ui_.c: gen-fac_ui.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fac_ui.c; then echo $(srcdir)/gen-fac_ui.c; else echo gen-fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fac_ui_.c || rm -f gen-fac_ui_.c
fib_table.h: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1)
+ ./gen-fib header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1)
BUILT_SOURCES += fib_table.h
mpn/fib_table.c: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
+ ./gen-fib table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
BUILT_SOURCES += mpn/fib_table.c
-gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c bootstrap.c
+gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c dumbmp.c
$(CC_FOR_BUILD) `test -f 'gen-fib$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fib$(U_FOR_BUILD).c -o gen-fib$(EXEEXT_FOR_BUILD)
DISTCLEANFILES += gen-fib$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-fib.c
+gen-fib_.c: gen-fib.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fib.c; then echo $(srcdir)/gen-fib.c; else echo gen-fib.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fib_.c || rm -f gen-fib_.c
+
mp_bases.h: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1)
+ ./gen-bases header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1)
BUILT_SOURCES += mp_bases.h
mpn/mp_bases.c: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
+ ./gen-bases table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
BUILT_SOURCES += mpn/mp_bases.c
-gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c bootstrap.c
+gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c dumbmp.c
$(CC_FOR_BUILD) `test -f 'gen-bases$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-bases$(U_FOR_BUILD).c -o gen-bases$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD)
DISTCLEANFILES += gen-bases$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-bases.c
-
-trialdivtab.h: gen-trialdivtab$(EXEEXT_FOR_BUILD)
- ./gen-trialdivtab $(GMP_LIMB_BITS) 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1)
-BUILT_SOURCES += trialdivtab.h
-
-gen-trialdivtab$(EXEEXT_FOR_BUILD): gen-trialdivtab$(U_FOR_BUILD).c bootstrap.c
- $(CC_FOR_BUILD) `test -f 'gen-trialdivtab$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-trialdivtab$(U_FOR_BUILD).c -o gen-trialdivtab$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD)
-DISTCLEANFILES += gen-trialdivtab$(EXEEXT_FOR_BUILD)
-EXTRA_DIST += gen-trialdivtab.c
-
-
-mpn/jacobitab.h: gen-jacobitab$(EXEEXT_FOR_BUILD)
- ./gen-jacobitab >mpn/jacobitab.h || (rm -f mpn/jacobitab.h; exit 1)
-BUILT_SOURCES += mpn/jacobitab.h
-
-gen-jacobitab$(EXEEXT_FOR_BUILD): gen-jacobitab$(U_FOR_BUILD).c
- $(CC_FOR_BUILD) `test -f 'gen-jacobitab$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-jacobitab$(U_FOR_BUILD).c -o gen-jacobitab$(EXEEXT_FOR_BUILD)
-DISTCLEANFILES += gen-jacobitab$(EXEEXT_FOR_BUILD)
-EXTRA_DIST += gen-jacobitab.c
+gen-bases_.c: gen-bases.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-bases.c; then echo $(srcdir)/gen-bases.c; else echo gen-bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-bases_.c || rm -f gen-bases_.c
mpn/perfsqr.h: gen-psqr$(EXEEXT_FOR_BUILD)
- ./gen-psqr $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
+ ./gen-psqr $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
BUILT_SOURCES += mpn/perfsqr.h
-gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c bootstrap.c
+gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c dumbmp.c
$(CC_FOR_BUILD) `test -f 'gen-psqr$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-psqr$(U_FOR_BUILD).c -o gen-psqr$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD)
DISTCLEANFILES += gen-psqr$(EXEEXT_FOR_BUILD)
EXTRA_DIST += gen-psqr.c
-# Distribute mini-gmp. Test sources copied by dist-hook.
-EXTRA_DIST += mini-gmp/README mini-gmp/mini-gmp.c mini-gmp/mini-gmp.h \
- mini-gmp/tests/Makefile mini-gmp/tests/run-tests
+gen-psqr_.c: gen-psqr.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-psqr.c; then echo $(srcdir)/gen-psqr.c; else echo gen-psqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-psqr_.c || rm -f gen-psqr_.c
+
# Avoid: CVS - cvs directories
# *~ - emacs backups
@@ -413,33 +406,6 @@ EXTRA_DIST += mini-gmp/README mini-gmp/mini-gmp.c mini-gmp/mini-gmp.h \
dist-hook:
-find $(distdir) \( -name CVS -type d \) -o -name "*~" -o -name ".#*" \
| xargs rm -rf
- cp "$(srcdir)"/mini-gmp/tests/*.[ch] "$(distdir)/mini-gmp/tests"
-# grep -F $(VERSION) $(srcdir)/Makefile.am \
-# | grep -q "^# *$(VERSION) *$(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) *$(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE)"
-# test -z "`sed -n 's/^# *[0-9]*\.[0-9]*\.[0-9]* *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\).*/A\1\nB\2\nC\3/p' $(srcdir)/Makefile.am | grep -v 'A6:3:3\|B3:5:0\|C4:7:1' | sort | uniq -d`"
-
-.PHONY: check-mini-gmp clean-mini-gmp
-
-check-mini-gmp:
- abs_srcdir="`cd $(srcdir) && pwd`" ; \
- $(MKDIR_P) mini-gmp/tests \
- && cd mini-gmp/tests \
- && LD_LIBRARY_PATH="../../.libs:$$LD_LIBRARY_PATH" \
- DYLD_LIBRARY_PATH="../../.libs:$$DYLD_LIBRARY_PATH" \
- $(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" \
- VPATH="$$abs_srcdir/mini-gmp/tests" \
- srcdir="$$abs_srcdir/mini-gmp/tests" \
- MINI_GMP_DIR="$$abs_srcdir/mini-gmp" \
- LDFLAGS="-L../../.libs" \
- LIBS="-lgmp -lm" \
- CC="$(CC_FOR_BUILD)" EXTRA_CFLAGS="-g -I../.." check
-
-clean-mini-gmp:
- if [ -d mini-gmp/tests ] ; then \
- abs_srcdir="`cd $(srcdir) && pwd`" ; \
- cd mini-gmp/tests \
- && $(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" clean ; \
- fi
-
-clean-local: clean-mini-gmp
-distclean-local: clean-mini-gmp
+ grep -F $(VERSION) $(srcdir)/Makefile.am \
+ | grep -q "^# *$(VERSION) *$(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) *$(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE) *$(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE)"
+ test -z "`sed -n 's/^# *[0-9]*\.[0-9]*\.[0-9]* *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\).*/A\1\nB\2\nC\3/p' $(srcdir)/Makefile.am | grep -v 'A6:3:3\|B3:5:0\|C4:7:1' | sort | uniq -d`"
diff --git a/gmp/Makefile.in b/gmp/Makefile.in
index 122305d624..eaab1bb9c7 100644
--- a/gmp/Makefile.in
+++ b/gmp/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,125 +14,36 @@
@SET_MAKE@
-# Copyright 1991, 1993, 1994, 1996, 1997, 1999-2004, 2006-2009, 2011-2014 Free
-# Software Foundation, Inc.
+# Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2004,
+# 2006, 2007, 2008, 2009 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have 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 following options are the same as AM_INIT_AUTOMAKE in configure.in,
-# except no $(top_builddir) on ansi2knr. That directory is wanted for the
-# Makefiles in subdirectories, but here we must omit it so automake gives
-# the actual ansi2knr build rule, not "cd $(top_builddir) && make ansi2knr".
-#
-# AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies
-
-# Libtool -version-info for libgmp.la and libmp.la. See "Versioning" in the
-# libtool manual.
-#
-# CURRENT:REVISION:AGE
-#
-# 1. No interfaces changed, only implementations (good): Increment REVISION.
-#
-# 2. Interfaces added, none removed (good): Increment CURRENT, increment
-# AGE, set REVISION to 0.
-#
-# 3. Interfaces removed (BAD, breaks upward compatibility): Increment
-# CURRENT, set AGE and REVISION to 0.
-#
-# Do this separately for libgmp, libgmpxx and libmp, and only for releases.
-#
-# GMP -version-info
-# release libgmp libgmpxx libmp
-# 2.0.x - - -
-# 3.0 3:0:0 - 3:0:0
-# 3.0.1 3:1:0 - 3:0:0
-# 3.1 4:0:1 - 4:0:1
-# 3.1.1 4:1:1 - 4:1:1
-# 4.0 5:0:2 3:0:0 4:2:1
-# 4.0.1 5:1:2 3:1:0 4:3:1
-# 4.1 6:0:3 3:2:0 4:4:1
-# 4.1.1 6:1:3 3:3:0 4:5:1
-# 4.1.2 6:2:3 3:4:0 4:6:1
-# 4.1.3 6:3:3 3:5:0 4:7:1
-# 4.1.4 6:3:3 3:5:0 4:7:1 WRONG, same as 4.1.3!
-# 4.2 6:0:3 3:2:0 4:4:1 REALLY WRONG, same as 4.1!
-# 4.2.1 7:1:4 4:1:1 4:10:1 WRONG for libgmpxx
-# 4.2.2 7:2:4 4:2:0 4:11:1
-# 4.2.3 7:3:4 4:3:0 4:12:1
-# 4.2.4 7:4:4 4:4:0 4:13:1
-# 4.3.0 8:0:5 5:0:1 4:14:1
-# 4.3.1 8:1:5 5:1:1 4:15:1 WRONG Really used same as 4.3.0
-# 4.3.2 8:2:5 5:2:1 4:16:1
-# 5.0.0 9:0:6 6:0:2 4:20:1 Should have been 10:0:0
-# 5.0.1 10:1:0 6:1:2 4:21:1
-# 5.0.2 10:2:0 6:2:2 4:22:1
-# 5.0.3 10:3:0 6:3:2 4:23:1
-# 5.0.4 10:4:0 6:4:2 4:24:1
-# 5.0.5 10:5:0 6:5:2 4:25:1
-# 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 -
-# 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
-# packages of gmp 2. Pretend gmp 2 was 2:0:0, so the interface changes for
-# gmp 3 mean 3:0:0 is right.
-#
-# We interpret "implementation changed" in item "1." above as meaning any
-# release, ie. the REVISION is incremented every time (if nothing else).
-# Even if we thought the code generated will be identical on all systems,
-# 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.
+SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) $(libgmpxx_la_SOURCES) $(libmp_la_SOURCES)
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = .
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -145,116 +55,179 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
-subdir = .
+ANSI2KNR = @ANSI2KNR@
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 ChangeLog INSTALL NEWS config.guess config.sub \
- install-sh ltmain.sh missing ylwrap
+ $(srcdir)/config.in $(srcdir)/gmp-h.in $(srcdir)/mp-h.in \
+ $(top_srcdir)/configure AUTHORS COPYING COPYING.LIB ChangeLog \
+ INSTALL NEWS ansi2knr.1 ansi2knr.c config.guess config.sub \
+ install-sh ltmain.sh missing
+subdir = .
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
- configure.lineno config.status.lineno
-mkinstalldirs = $(install_sh) -d
+ configure.lineno configure.status.lineno
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = config.h
-CONFIG_CLEAN_FILES = gmp.h gmp-mparam.h
-CONFIG_CLEAN_VPATH_FILES =
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
-am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" \
- "$(DESTDIR)$(includeexecdir)"
+CONFIG_CLEAN_FILES = gmp.h mp.h gmp-mparam.h
+am__installdirs = "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includeexecdir)"
+libLTLIBRARIES_INSTALL = $(INSTALL)
LTLIBRARIES = $(lib_LTLIBRARIES)
-am__DEPENDENCIES_1 = $(MPF_OBJECTS) $(MPZ_OBJECTS) $(MPQ_OBJECTS) \
- $(MPN_OBJECTS) $(PRINTF_OBJECTS) $(SCANF_OBJECTS) \
- $(RANDOM_OBJECTS)
-am_libgmp_la_OBJECTS = assert.lo compat.lo errno.lo extract-dbl.lo \
- invalid.lo memory.lo mp_bpl.lo mp_clz_tab.lo mp_dv_tab.lo \
- mp_minv_tab.lo mp_get_fns.lo mp_set_fns.lo version.lo \
- nextprime.lo primesieve.lo
+am__DEPENDENCIES_1 = mpf/init$U.lo mpf/init2$U.lo mpf/set$U.lo \
+ mpf/set_ui$U.lo mpf/set_si$U.lo mpf/set_str$U.lo \
+ mpf/set_d$U.lo mpf/set_z$U.lo mpf/iset$U.lo mpf/iset_ui$U.lo \
+ mpf/iset_si$U.lo mpf/iset_str$U.lo mpf/iset_d$U.lo \
+ mpf/clear$U.lo mpf/get_str$U.lo mpf/dump$U.lo mpf/size$U.lo \
+ mpf/eq$U.lo mpf/reldiff$U.lo mpf/sqrt$U.lo mpf/random2$U.lo \
+ mpf/inp_str$U.lo mpf/out_str$U.lo mpf/add$U.lo mpf/add_ui$U.lo \
+ mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo mpf/mul$U.lo \
+ mpf/mul_ui$U.lo mpf/div$U.lo mpf/div_ui$U.lo mpf/cmp$U.lo \
+ mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \
+ mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \
+ mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo \
+ mpf/set_dfl_prec$U.lo mpf/set_prc$U.lo mpf/set_prc_raw$U.lo \
+ mpf/get_dfl_prec$U.lo mpf/get_prc$U.lo mpf/ui_div$U.lo \
+ mpf/sqrt_ui$U.lo mpf/ceilfloor$U.lo mpf/trunc$U.lo \
+ mpf/pow_ui$U.lo mpf/urandomb$U.lo mpf/swap$U.lo \
+ mpf/fits_sint$U.lo mpf/fits_slong$U.lo mpf/fits_sshort$U.lo \
+ mpf/fits_uint$U.lo mpf/fits_ulong$U.lo mpf/fits_ushort$U.lo \
+ mpf/get_si$U.lo mpf/get_ui$U.lo mpf/int_p$U.lo
+am__DEPENDENCIES_2 = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
+ mpz/aorsmul$U.lo mpz/aorsmul_i$U.lo mpz/and$U.lo \
+ mpz/array_init$U.lo mpz/bin_ui$U.lo mpz/bin_uiui$U.lo \
+ mpz/cdiv_q$U.lo mpz/cdiv_q_ui$U.lo mpz/cdiv_qr$U.lo \
+ mpz/cdiv_qr_ui$U.lo mpz/cdiv_r$U.lo mpz/cdiv_r_ui$U.lo \
+ mpz/cdiv_ui$U.lo mpz/cfdiv_q_2exp$U.lo mpz/cfdiv_r_2exp$U.lo \
+ mpz/clear$U.lo mpz/clrbit$U.lo mpz/cmp$U.lo mpz/cmp_d$U.lo \
+ mpz/cmp_si$U.lo mpz/cmp_ui$U.lo mpz/cmpabs$U.lo \
+ mpz/cmpabs_d$U.lo mpz/cmpabs_ui$U.lo mpz/com$U.lo \
+ mpz/combit$U.lo mpz/cong$U.lo mpz/cong_2exp$U.lo \
+ mpz/cong_ui$U.lo mpz/divexact$U.lo mpz/divegcd$U.lo \
+ mpz/dive_ui$U.lo mpz/divis$U.lo mpz/divis_ui$U.lo \
+ mpz/divis_2exp$U.lo mpz/dump$U.lo mpz/export$U.lo \
+ mpz/fac_ui$U.lo mpz/fdiv_q$U.lo mpz/fdiv_q_ui$U.lo \
+ mpz/fdiv_qr$U.lo mpz/fdiv_qr_ui$U.lo mpz/fdiv_r$U.lo \
+ mpz/fdiv_r_ui$U.lo mpz/fdiv_ui$U.lo mpz/fib_ui$U.lo \
+ mpz/fib2_ui$U.lo mpz/fits_sint$U.lo mpz/fits_slong$U.lo \
+ mpz/fits_sshort$U.lo mpz/fits_uint$U.lo mpz/fits_ulong$U.lo \
+ mpz/fits_ushort$U.lo mpz/gcd$U.lo mpz/gcd_ui$U.lo \
+ mpz/gcdext$U.lo mpz/get_d$U.lo mpz/get_d_2exp$U.lo \
+ mpz/get_si$U.lo mpz/get_str$U.lo mpz/get_ui$U.lo \
+ mpz/getlimbn$U.lo mpz/hamdist$U.lo mpz/import$U.lo \
+ mpz/init$U.lo mpz/init2$U.lo mpz/inp_raw$U.lo mpz/inp_str$U.lo \
+ mpz/invert$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/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 mpz/out_raw$U.lo mpz/out_str$U.lo \
+ mpz/perfpow$U.lo mpz/perfsqr$U.lo mpz/popcount$U.lo \
+ mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_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/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 mpz/setbit$U.lo mpz/size$U.lo \
+ mpz/sizeinbase$U.lo mpz/sqrt$U.lo mpz/sqrtrem$U.lo \
+ mpz/sub$U.lo mpz/sub_ui$U.lo mpz/swap$U.lo mpz/tdiv_ui$U.lo \
+ mpz/tdiv_q$U.lo mpz/tdiv_q_2exp$U.lo mpz/tdiv_q_ui$U.lo \
+ mpz/tdiv_qr$U.lo mpz/tdiv_qr_ui$U.lo mpz/tdiv_r$U.lo \
+ mpz/tdiv_r_2exp$U.lo mpz/tdiv_r_ui$U.lo mpz/tstbit$U.lo \
+ mpz/ui_pow_ui$U.lo mpz/ui_sub$U.lo mpz/urandomb$U.lo \
+ mpz/urandomm$U.lo mpz/xor$U.lo
+am__DEPENDENCIES_3 = mpq/abs$U.lo mpq/aors$U.lo mpq/canonicalize$U.lo \
+ mpq/clear$U.lo mpq/cmp$U.lo mpq/cmp_si$U.lo mpq/cmp_ui$U.lo \
+ mpq/div$U.lo mpq/get_d$U.lo mpq/get_den$U.lo mpq/get_num$U.lo \
+ mpq/get_str$U.lo mpq/init$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \
+ mpq/md_2exp$U.lo mpq/mul$U.lo mpq/neg$U.lo mpq/out_str$U.lo \
+ mpq/set$U.lo mpq/set_den$U.lo mpq/set_num$U.lo mpq/set_si$U.lo \
+ mpq/set_str$U.lo mpq/set_ui$U.lo mpq/equal$U.lo mpq/set_z$U.lo \
+ mpq/set_d$U.lo mpq/set_f$U.lo mpq/swap$U.lo
+am__DEPENDENCIES_4 = mpn/fib_table$U.lo mpn/mp_bases$U.lo
+am__DEPENDENCIES_5 = printf/asprintf$U.lo printf/asprntffuns$U.lo \
+ printf/doprnt$U.lo printf/doprntf$U.lo printf/doprnti$U.lo \
+ printf/fprintf$U.lo printf/obprintf$U.lo printf/obvprintf$U.lo \
+ printf/obprntffuns$U.lo printf/printf$U.lo \
+ printf/printffuns$U.lo printf/snprintf$U.lo \
+ printf/snprntffuns$U.lo printf/sprintf$U.lo \
+ printf/sprintffuns$U.lo printf/vasprintf$U.lo \
+ printf/vfprintf$U.lo printf/vprintf$U.lo printf/vsnprintf$U.lo \
+ printf/vsprintf$U.lo printf/repl-vsnprintf$U.lo
+am__DEPENDENCIES_6 = scanf/doscan$U.lo scanf/fscanf$U.lo \
+ scanf/fscanffuns$U.lo scanf/scanf$U.lo scanf/sscanf$U.lo \
+ scanf/sscanffuns$U.lo scanf/vfscanf$U.lo scanf/vscanf$U.lo \
+ scanf/vsscanf$U.lo
+am__DEPENDENCIES_7 = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2) \
+ $(am__DEPENDENCIES_3) $(am__DEPENDENCIES_4) \
+ $(am__DEPENDENCIES_5) $(am__DEPENDENCIES_6)
+am_libgmp_la_OBJECTS = assert$U.lo compat$U.lo errno$U.lo \
+ extract-dbl$U.lo invalid$U.lo memory$U.lo mp_bpl$U.lo \
+ mp_clz_tab$U.lo mp_dv_tab$U.lo mp_minv_tab$U.lo \
+ mp_get_fns$U.lo mp_set_fns$U.lo rand$U.lo randclr$U.lo \
+ randdef$U.lo randiset$U.lo randlc2s$U.lo randlc2x$U.lo \
+ randmt$U.lo randmts$U.lo rands$U.lo randsd$U.lo randsdui$U.lo \
+ randbui$U.lo randmui$U.lo version$U.lo
libgmp_la_OBJECTS = $(am_libgmp_la_OBJECTS)
-libgmp_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libgmp_la_LDFLAGS) $(LDFLAGS) -o $@
+am__DEPENDENCIES_8 = cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo \
+ cxx/ismpz.lo cxx/ismpznw.lo cxx/osdoprnti.lo cxx/osfuns.lo \
+ cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo
+am__DEPENDENCIES_9 = $(am__DEPENDENCIES_8) libgmp.la
am_libgmpxx_la_OBJECTS = dummy.lo
libgmpxx_la_OBJECTS = $(am_libgmpxx_la_OBJECTS)
-libgmpxx_la_LINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CXXLD) $(AM_CXXFLAGS) \
- $(CXXFLAGS) $(libgmpxx_la_LDFLAGS) $(LDFLAGS) -o $@
-@WANT_CXX_TRUE@am_libgmpxx_la_rpath = -rpath $(libdir)
-DEFAULT_INCLUDES = -I.@am__isrc@
+am__DEPENDENCIES_10 = mpbsd/add$U.lo mpbsd/tdiv_qr$U.lo mpbsd/set$U.lo \
+ mpbsd/powm$U.lo mpbsd/sub$U.lo mpbsd/cmp$U.lo mpbsd/mfree$U.lo \
+ mpbsd/mtox$U.lo mpbsd/realloc$U.lo mpbsd/gcd$U.lo \
+ mpbsd/itom$U.lo mpbsd/min$U.lo mpbsd/mul$U.lo mpbsd/mout$U.lo \
+ mpbsd/rpow$U.lo mpbsd/sdiv$U.lo mpbsd/sqrtrem$U.lo \
+ mpbsd/xtom$U.lo
+am__DEPENDENCIES_11 = $(srcdir)/libmp.sym $(am__DEPENDENCIES_10) \
+ $(am__DEPENDENCIES_4) mpz/add$U.lo mpz/gcdext$U.lo \
+ mpz/invert$U.lo mpz/mul$U.lo mpz/n_pow_ui$U.lo \
+ mpz/realloc$U.lo mpz/set$U.lo mpz/sub$U.lo mpz/tdiv_q$U.lo
+am_libmp_la_OBJECTS = assert$U.lo errno$U.lo memory$U.lo mp_bpl$U.lo \
+ mp_clz_tab$U.lo mp_dv_tab$U.lo mp_minv_tab$U.lo \
+ mp_get_fns$U.lo mp_set_fns$U.lo
+libmp_la_OBJECTS = $(am_libmp_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I.
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) \
- $(libgmpxx_la_SOURCES)
+ $(libgmpxx_la_SOURCES) $(libmp_la_SOURCES)
DIST_SOURCES = $(libgmp_la_SOURCES) $(EXTRA_libgmp_la_SOURCES) \
- $(libgmpxx_la_SOURCES)
+ $(libgmpxx_la_SOURCES) $(libmp_la_SOURCES)
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
am__include_HEADERS_DIST = gmpxx.h
+includeHEADERS_INSTALL = $(INSTALL_HEADER)
+nodist_includeexecHEADERS_INSTALL = $(INSTALL_HEADER)
HEADERS = $(include_HEADERS) $(nodist_includeexec_HEADERS)
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir dist dist-all distcheck
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
@@ -262,41 +235,12 @@ DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
distdir = $(PACKAGE)-$(VERSION)
top_distdir = $(distdir)
am__remove_distdir = \
- if test -d "$(distdir)"; then \
- find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
- && rm -rf "$(distdir)" \
- || { sleep 5 && rm -rf "$(distdir)"; }; \
- else :; fi
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
+ { test ! -d $(distdir) \
+ || { find $(distdir) -type d ! -perm -200 -exec chmod u+w {} ';' \
+ && rm -fr $(distdir); }; }
DIST_ARCHIVES = $(distdir).tar.gz
GZIP_ENV = --best
distuninstallcheck_listfiles = find . -type f -print
-am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
- | sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
distcleancheck_listfiles = find . -type f -print
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -308,6 +252,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -323,17 +268,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -347,12 +291,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -367,26 +309,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -396,31 +332,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -444,6 +375,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -451,20 +383,78 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-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 following options are the same as AM_INIT_AUTOMAKE in configure.in,
+# except no $(top_builddir) on ansi2knr. That directory is wanted for the
+# Makefiles in subdirectories, but here we must omit it so automake gives
+# the actual ansi2knr build rule, not "cd $(top_builddir) && make ansi2knr".
+#
+AUTOMAKE_OPTIONS = 1.8 gnu no-dependencies ansi2knr
+
+# Libtool -version-info for libgmp.la and libmp.la. See "Versioning" in the
+# libtool manual.
+#
+# CURRENT:REVISION:AGE
+#
+# 1. No interfaces changed, only implementations (good): Increment REVISION.
+#
+# 2. Interfaces added, none removed (good): Increment CURRENT, increment
+# AGE, set REVISION to 0.
+#
+# 3. Interfaces removed (BAD, breaks upward compatibility): Increment
+# CURRENT, set AGE and REVISION to 0.
+#
+# Do this separately for libgmp, libgmpxx and libmp, and only for releases.
+#
+# GMP -version-info
+# release libgmp libgmpxx libmp
+# 2.0.x - - -
+# 3.0 3:0:0 - 3:0:0
+# 3.0.1 3:1:0 - 3:0:0
+# 3.1 4:0:1 - 4:0:1
+# 3.1.1 4:1:1 - 4:1:1
+# 4.0 5:0:2 3:0:0 4:2:1
+# 4.0.1 5:1:2 3:1:0 4:3:1
+# 4.1 6:0:3 3:2:0 4:4:1
+# 4.1.1 6:1:3 3:3:0 4:5:1
+# 4.1.2 6:2:3 3:4:0 4:6:1
+# 4.1.3 6:3:3 3:5:0 4:7:1
+# 4.1.4 6:3:3 3:5:0 4:7:1 WRONG, same as 4.1.3!
+# 4.2 6:0:3 3:2:0 4:4:1 REALLY WRONG, same as 4.1!
+# 4.2.1 7:1:4 4:1:1 4:10:1 WRONG for libgmpxx
+# 4.2.2 7:2:4 4:2:0 4:11:1
+# 4.2.3 7:3:4 4:3:0 4:12:1
+# 4.2.4 7:4:4 4:4:0 4:13:1
+# 4.3.0 8:0:5 5:0:1 4:14:1
+# 4.3.1 8:1:5 5:1:1 4:15:1 WRONG Really used same as 4.3.0
+# 4.3.2 8:2:5 5:2:1 4:16:1
+#
+# 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
+# packages of gmp 2. Pretend gmp 2 was 2:0:0, so the interface changes for
+# gmp 3 mean 3:0:0 is right.
+#
+# We interpret "implementation changed" in item "1." above as meaning any
+# release, ie. the REVISION is incremented every time (if nothing else).
+# Even if we thought the code generated will be identical on all systems,
+# 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 = 8
+LIBGMP_LT_REVISION = 2
+LIBGMP_LT_AGE = 5
+LIBGMPXX_LT_CURRENT = 5
+LIBGMPXX_LT_REVISION = 2
+LIBGMPXX_LT_AGE = 1
+LIBMP_LT_CURRENT = 4
+LIBMP_LT_REVISION = 16
+LIBMP_LT_AGE = 1
+SUBDIRS = tests mpn mpz mpq mpf printf scanf cxx mpbsd demos tune doc
+
+# The ansi2knr setups for the build programs are the same as the normal
+# automake ansi2knr rules, but using $(CC_FOR_BUILD) instead of $(CC).
+#
# The "test -f" support for srcdir!=builddir is similar to the automake .c.o
# etc rules, but with each foo.c explicitly, since $< is not portable
# outside an inference rule.
@@ -480,14 +470,7 @@ SUBDIRS = tests mpn mpz mpq mpf printf scanf rand cxx demos tune doc
# build-system stuff over and done with at the start. Also, dependencies on
# the .h files are not properly expressed for the various objects that use
# them.
-
-# Distribute mini-gmp. Test sources copied by dist-hook.
-EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
- 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
+EXTRA_DIST = macos configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf gmpxx.h libmp.sym dumbmp.c gen-fac_ui.c gen-fib.c gen-bases.c gen-psqr.c
@WANT_CXX_TRUE@GMPXX_HEADERS_OPTION = gmpxx.h
# gmp.h and mp.h are architecture dependent, mainly since they encode the
@@ -496,32 +479,26 @@ EXTRA_DIST = configfsf.guess configfsf.sub .gdbinit INSTALL.autoconf \
#
# $exec_prefix/include is not in the default include path for gcc built to
# the same $prefix and $exec_prefix, which might mean gmp.h is not found,
-# but anyone knowledgeable enough to be playing with exec_prefix will be able
+# but anyone knowledgable enough to be playing with exec_prefix will be able
# to address that.
#
includeexecdir = $(exec_prefix)/include
include_HEADERS = $(GMPXX_HEADERS_OPTION)
-nodist_includeexec_HEADERS = gmp.h
-lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION)
-BUILT_SOURCES = gmp.h fac_table.h fib_table.h mpn/fib_table.c \
- mp_bases.h mpn/mp_bases.c trialdivtab.h mpn/jacobitab.h \
- mpn/perfsqr.h
-DISTCLEANFILES = $(BUILT_SOURCES) config.m4 @gmp_srclinks@ \
- gen-fac$(EXEEXT_FOR_BUILD) gen-fib$(EXEEXT_FOR_BUILD) \
- gen-bases$(EXEEXT_FOR_BUILD) \
- gen-trialdivtab$(EXEEXT_FOR_BUILD) \
- gen-jacobitab$(EXEEXT_FOR_BUILD) gen-psqr$(EXEEXT_FOR_BUILD)
+nodist_includeexec_HEADERS = gmp.h $(MPBSD_HEADERS_OPTION)
+lib_LTLIBRARIES = libgmp.la $(GMPXX_LTLIBRARIES_OPTION) $(MPBSD_LTLIBRARIES_OPTION)
+BUILT_SOURCES = gmp.h mp.h mpz/fac_ui.h fib_table.h mpn/fib_table.c mp_bases.h mpn/mp_bases.c mpn/perfsqr.h
+DISTCLEANFILES = $(BUILT_SOURCES) config.m4 @gmp_srclinks@ gen-fac_ui$(EXEEXT_FOR_BUILD) gen-fib$(EXEEXT_FOR_BUILD) gen-bases$(EXEEXT_FOR_BUILD) gen-psqr$(EXEEXT_FOR_BUILD)
# Tell gmp.h it's building gmp, not an application, used by windows DLL stuff.
INCLUDES = -D__GMP_WITHIN_GMP
-MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/inits$U.lo mpf/set$U.lo \
- mpf/set_ui$U.lo mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo \
- mpf/set_z$U.lo mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo \
- mpf/iset_str$U.lo mpf/iset_d$U.lo mpf/clear$U.lo mpf/clears$U.lo \
- mpf/get_str$U.lo mpf/dump$U.lo mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo \
- mpf/sqrt$U.lo mpf/random2$U.lo mpf/inp_str$U.lo mpf/out_str$U.lo \
- mpf/add$U.lo mpf/add_ui$U.lo mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo \
- mpf/mul$U.lo mpf/mul_ui$U.lo mpf/div$U.lo mpf/div_ui$U.lo \
+MPF_OBJECTS = mpf/init$U.lo mpf/init2$U.lo mpf/set$U.lo mpf/set_ui$U.lo \
+ mpf/set_si$U.lo mpf/set_str$U.lo mpf/set_d$U.lo mpf/set_z$U.lo \
+ mpf/iset$U.lo mpf/iset_ui$U.lo mpf/iset_si$U.lo mpf/iset_str$U.lo \
+ mpf/iset_d$U.lo mpf/clear$U.lo mpf/get_str$U.lo mpf/dump$U.lo \
+ mpf/size$U.lo mpf/eq$U.lo mpf/reldiff$U.lo mpf/sqrt$U.lo mpf/random2$U.lo \
+ mpf/inp_str$U.lo mpf/out_str$U.lo mpf/add$U.lo mpf/add_ui$U.lo \
+ mpf/sub$U.lo mpf/sub_ui$U.lo mpf/ui_sub$U.lo mpf/mul$U.lo mpf/mul_ui$U.lo \
+ mpf/div$U.lo mpf/div_ui$U.lo \
mpf/cmp$U.lo mpf/cmp_d$U.lo mpf/cmp_ui$U.lo mpf/cmp_si$U.lo \
mpf/mul_2exp$U.lo mpf/div_2exp$U.lo mpf/abs$U.lo mpf/neg$U.lo \
mpf/set_q$U.lo mpf/get_d$U.lo mpf/get_d_2exp$U.lo mpf/set_dfl_prec$U.lo \
@@ -541,39 +518,35 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/cdiv_qr$U.lo mpz/cdiv_qr_ui$U.lo \
mpz/cdiv_r$U.lo mpz/cdiv_r_ui$U.lo mpz/cdiv_ui$U.lo \
mpz/cfdiv_q_2exp$U.lo mpz/cfdiv_r_2exp$U.lo \
- mpz/clear$U.lo mpz/clears$U.lo mpz/clrbit$U.lo \
+ mpz/clear$U.lo mpz/clrbit$U.lo \
mpz/cmp$U.lo mpz/cmp_d$U.lo mpz/cmp_si$U.lo mpz/cmp_ui$U.lo \
mpz/cmpabs$U.lo mpz/cmpabs_d$U.lo mpz/cmpabs_ui$U.lo \
mpz/com$U.lo mpz/combit$U.lo \
mpz/cong$U.lo mpz/cong_2exp$U.lo mpz/cong_ui$U.lo \
mpz/divexact$U.lo mpz/divegcd$U.lo mpz/dive_ui$U.lo \
mpz/divis$U.lo mpz/divis_ui$U.lo mpz/divis_2exp$U.lo mpz/dump$U.lo \
- mpz/export$U.lo mpz/mfac_uiui$U.lo \
- mpz/2fac_ui$U.lo mpz/fac_ui$U.lo mpz/oddfac_1$U.lo mpz/prodlimbs$U.lo \
+ mpz/export$U.lo mpz/fac_ui$U.lo mpz/fdiv_q$U.lo \
mpz/fdiv_q_ui$U.lo mpz/fdiv_qr$U.lo mpz/fdiv_qr_ui$U.lo \
- mpz/fdiv_r$U.lo mpz/fdiv_r_ui$U.lo mpz/fdiv_q$U.lo \
+ mpz/fdiv_r$U.lo mpz/fdiv_r_ui$U.lo \
mpz/fdiv_ui$U.lo mpz/fib_ui$U.lo mpz/fib2_ui$U.lo mpz/fits_sint$U.lo \
mpz/fits_slong$U.lo mpz/fits_sshort$U.lo mpz/fits_uint$U.lo \
mpz/fits_ulong$U.lo mpz/fits_ushort$U.lo mpz/gcd$U.lo \
mpz/gcd_ui$U.lo mpz/gcdext$U.lo mpz/get_d$U.lo mpz/get_d_2exp$U.lo \
mpz/get_si$U.lo mpz/get_str$U.lo mpz/get_ui$U.lo mpz/getlimbn$U.lo \
mpz/hamdist$U.lo \
- mpz/import$U.lo mpz/init$U.lo mpz/init2$U.lo mpz/inits$U.lo \
- mpz/inp_raw$U.lo mpz/inp_str$U.lo mpz/invert$U.lo \
+ mpz/import$U.lo mpz/init$U.lo mpz/init2$U.lo mpz/inp_raw$U.lo \
+ mpz/inp_str$U.lo mpz/invert$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/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/lcm$U.lo mpz/lcm_ui$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 \
mpz/out_raw$U.lo mpz/out_str$U.lo mpz/perfpow$U.lo mpz/perfsqr$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/popcount$U.lo mpz/pow_ui$U.lo mpz/powm$U.lo mpz/powm_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/roinit_n$U.lo \
+ mpz/realloc$U.lo mpz/realloc2$U.lo mpz/remove$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 \
@@ -587,10 +560,10 @@ MPZ_OBJECTS = mpz/abs$U.lo mpz/add$U.lo mpz/add_ui$U.lo \
mpz/urandomm$U.lo mpz/xor$U.lo
MPQ_OBJECTS = mpq/abs$U.lo mpq/aors$U.lo \
- mpq/canonicalize$U.lo mpq/clear$U.lo mpq/clears$U.lo \
+ mpq/canonicalize$U.lo mpq/clear$U.lo \
mpq/cmp$U.lo mpq/cmp_si$U.lo mpq/cmp_ui$U.lo mpq/div$U.lo \
mpq/get_d$U.lo mpq/get_den$U.lo mpq/get_num$U.lo mpq/get_str$U.lo \
- mpq/init$U.lo mpq/inits$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \
+ mpq/init$U.lo mpq/inp_str$U.lo mpq/inv$U.lo \
mpq/md_2exp$U.lo mpq/mul$U.lo mpq/neg$U.lo mpq/out_str$U.lo \
mpq/set$U.lo mpq/set_den$U.lo mpq/set_num$U.lo \
mpq/set_si$U.lo mpq/set_str$U.lo mpq/set_ui$U.lo \
@@ -615,19 +588,19 @@ SCANF_OBJECTS = \
scanf/scanf$U.lo scanf/sscanf$U.lo scanf/sscanffuns$U.lo \
scanf/vfscanf$U.lo scanf/vscanf$U.lo scanf/vsscanf$U.lo
-RANDOM_OBJECTS = \
- rand/rand$U.lo rand/randclr$U.lo rand/randdef$U.lo rand/randiset$U.lo \
- rand/randlc2s$U.lo rand/randlc2x$U.lo rand/randmt$U.lo \
- rand/randmts$U.lo rand/rands$U.lo rand/randsd$U.lo rand/randsdui$U.lo \
- rand/randbui$U.lo rand/randmui$U.lo
-
# no $U for C++ files
CXX_OBJECTS = \
cxx/isfuns.lo cxx/ismpf.lo cxx/ismpq.lo cxx/ismpz.lo cxx/ismpznw.lo \
- cxx/limits.lo cxx/osdoprnti.lo cxx/osfuns.lo \
+ cxx/osdoprnti.lo cxx/osfuns.lo \
cxx/osmpf.lo cxx/osmpq.lo cxx/osmpz.lo
+MPBSD_OBJECTS = mpbsd/add$U.lo mpbsd/tdiv_qr$U.lo mpbsd/set$U.lo \
+ mpbsd/powm$U.lo mpbsd/sub$U.lo mpbsd/cmp$U.lo mpbsd/mfree$U.lo \
+ mpbsd/mtox$U.lo mpbsd/realloc$U.lo mpbsd/gcd$U.lo mpbsd/itom$U.lo \
+ mpbsd/min$U.lo mpbsd/mul$U.lo mpbsd/mout$U.lo mpbsd/rpow$U.lo \
+ mpbsd/sdiv$U.lo mpbsd/sqrtrem$U.lo mpbsd/xtom$U.lo
+
# In libtool 1.5 it doesn't work to build libgmp.la from the convenience
# libraries like mpz/libmpz.la. Or rather it works, but it ends up putting
@@ -642,16 +615,17 @@ CXX_OBJECTS = \
# Currently, for libgmp, unlike libmp below, we're not using
# -export-symbols, since the tune and speed programs, and perhaps some of
# the test programs, want to access undocumented symbols.
-libgmp_la_SOURCES = gmp-impl.h longlong.h \
+libgmp_la_SOURCES = gmp-impl.h longlong.h randmt.h \
assert.c compat.c errno.c extract-dbl.c invalid.c memory.c \
mp_bpl.c mp_clz_tab.c mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c \
- version.c nextprime.c primesieve.c
+ rand.c randclr.c randdef.c randiset.c randlc2s.c randlc2x.c randmt.c \
+ randmts.c rands.c randsd.c randsdui.c randbui.c randmui.c version.c
EXTRA_libgmp_la_SOURCES = tal-debug.c tal-notreent.c tal-reent.c
libgmp_la_DEPENDENCIES = @TAL_OBJECT@ \
$(MPF_OBJECTS) $(MPZ_OBJECTS) $(MPQ_OBJECTS) \
$(MPN_OBJECTS) @mpn_objs_in_libgmp@ \
- $(PRINTF_OBJECTS) $(SCANF_OBJECTS) $(RANDOM_OBJECTS)
+ $(PRINTF_OBJECTS) $(SCANF_OBJECTS)
libgmp_la_LIBADD = $(libgmp_la_DEPENDENCIES)
libgmp_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMP_LDFLAGS) \
@@ -668,26 +642,46 @@ libgmpxx_la_LIBADD = $(libgmpxx_la_DEPENDENCIES)
libgmpxx_la_LDFLAGS = $(GMP_LDFLAGS) $(LIBGMPXX_LDFLAGS) \
-version-info $(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE)
+
+# The selected mpz objects here support mpz/powm.c (built as mpbsd/powm.lo)
+# and can probably be removed when that switches to an mpn implementation.
+# (Apart from mpz/n_pow_ui$U.lo, which supports mpbsd/rpow.c)
+@WANT_MPBSD_TRUE@MPBSD_HEADERS_OPTION = mp.h
+@WANT_MPBSD_TRUE@MPBSD_LTLIBRARIES_OPTION = libmp.la
+libmp_la_SOURCES = assert.c errno.c memory.c mp_bpl.c mp_clz_tab.c \
+ mp_dv_tab.c mp_minv_tab.c mp_get_fns.c mp_set_fns.c
+
+libmp_la_DEPENDENCIES = $(srcdir)/libmp.sym \
+ @TAL_OBJECT@ $(MPBSD_OBJECTS) $(MPN_OBJECTS) @mpn_objs_in_libmp@ \
+ mpz/add$U.lo mpz/gcdext$U.lo mpz/invert$U.lo mpz/mul$U.lo \
+ mpz/n_pow_ui$U.lo mpz/realloc$U.lo mpz/set$U.lo mpz/sub$U.lo \
+ mpz/tdiv_q$U.lo
+
+libmp_la_LIBADD = $(libmp_la_DEPENDENCIES)
+libmp_la_LDFLAGS = $(GMP_LDFLAGS) \
+ -version-info $(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE) \
+ -export-symbols $(srcdir)/libmp.sym
+
all: $(BUILT_SOURCES) config.h
$(MAKE) $(AM_MAKEFLAGS) all-recursive
.SUFFIXES:
.SUFFIXES: .c .cc .lo .o .obj
-am--refresh: Makefile
+am--refresh:
@:
$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- echo ' cd $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps'; \
- $(am__cd) $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps \
+ echo ' cd $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps'; \
+ cd $(srcdir) && $(AUTOMAKE) --gnu --ignore-deps \
&& exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -703,20 +697,21 @@ $(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENC
$(SHELL) ./config.status --recheck
$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- $(am__cd) $(srcdir) && $(AUTOCONF)
+ cd $(srcdir) && $(AUTOCONF)
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- $(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
-$(am__aclocal_m4_deps):
+ cd $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
config.h: stamp-h1
- @if test ! -f $@; then rm -f stamp-h1; else :; fi
- @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) stamp-h1; else :; fi
+ @if test ! -f $@; then \
+ rm -f stamp-h1; \
+ $(MAKE) stamp-h1; \
+ else :; fi
stamp-h1: $(srcdir)/config.in $(top_builddir)/config.status
@rm -f stamp-h1
cd $(top_builddir) && $(SHELL) ./config.status config.h
$(srcdir)/config.in: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- ($(am__cd) $(top_srcdir) && $(AUTOHEADER))
+ cd $(top_srcdir) && $(AUTOHEADER)
rm -f stamp-h1
touch $@
@@ -724,48 +719,56 @@ distclean-hdr:
-rm -f config.h stamp-h1
gmp.h: $(top_builddir)/config.status $(srcdir)/gmp-h.in
cd $(top_builddir) && $(SHELL) ./config.status $@
+mp.h: $(top_builddir)/config.status $(srcdir)/mp-h.in
+ cd $(top_builddir) && $(SHELL) ./config.status $@
install-libLTLIBRARIES: $(lib_LTLIBRARIES)
@$(NORMAL_INSTALL)
- @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
- list2=; for p in $$list; do \
+ test -z "$(libdir)" || $(mkdir_p) "$(DESTDIR)$(libdir)"
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
if test -f $$p; then \
- list2="$$list2 $$p"; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) '$$p' '$(DESTDIR)$(libdir)/$$f'"; \
+ $(LIBTOOL) --mode=install $(libLTLIBRARIES_INSTALL) $(INSTALL_STRIP_FLAG) "$$p" "$(DESTDIR)$(libdir)/$$f"; \
else :; fi; \
- done; \
- test -z "$$list2" || { \
- echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
- }
+ done
uninstall-libLTLIBRARIES:
@$(NORMAL_UNINSTALL)
- @list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
- $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
+ @list='$(lib_LTLIBRARIES)'; for p in $$list; do \
+ p="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(LIBTOOL) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$p'"; \
+ $(LIBTOOL) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$p"; \
done
clean-libLTLIBRARIES:
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
@list='$(lib_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libgmp.la: $(libgmp_la_OBJECTS) $(libgmp_la_DEPENDENCIES) $(EXTRA_libgmp_la_DEPENDENCIES)
- $(libgmp_la_LINK) -rpath $(libdir) $(libgmp_la_OBJECTS) $(libgmp_la_LIBADD) $(LIBS)
-libgmpxx.la: $(libgmpxx_la_OBJECTS) $(libgmpxx_la_DEPENDENCIES) $(EXTRA_libgmpxx_la_DEPENDENCIES)
- $(libgmpxx_la_LINK) $(am_libgmpxx_la_rpath) $(libgmpxx_la_OBJECTS) $(libgmpxx_la_LIBADD) $(LIBS)
+libgmp.la: $(libgmp_la_OBJECTS) $(libgmp_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libgmp_la_LDFLAGS) $(libgmp_la_OBJECTS) $(libgmp_la_LIBADD) $(LIBS)
+libgmpxx.la: $(libgmpxx_la_OBJECTS) $(libgmpxx_la_DEPENDENCIES)
+ $(CXXLINK) -rpath $(libdir) $(libgmpxx_la_LDFLAGS) $(libgmpxx_la_OBJECTS) $(libgmpxx_la_LIBADD) $(LIBS)
+libmp.la: $(libmp_la_OBJECTS) $(libmp_la_DEPENDENCIES)
+ $(LINK) -rpath $(libdir) $(libmp_la_LDFLAGS) $(libmp_la_OBJECTS) $(libmp_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+ansi2knr: ansi2knr.$(OBJEXT)
+ $(LINK) ansi2knr.$(OBJEXT) $(LIBS)
+ansi2knr.$(OBJEXT): $(CONFIG_HEADER)
+
+clean-krextra:
+ -rm -f ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -775,6 +778,80 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+assert_.c: assert.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/assert.c; then echo $(srcdir)/assert.c; else echo assert.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+compat_.c: compat.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/compat.c; then echo $(srcdir)/compat.c; else echo compat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+errno_.c: errno.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/errno.c; then echo $(srcdir)/errno.c; else echo errno.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+extract-dbl_.c: extract-dbl.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/extract-dbl.c; then echo $(srcdir)/extract-dbl.c; else echo extract-dbl.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+invalid_.c: invalid.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/invalid.c; then echo $(srcdir)/invalid.c; else echo invalid.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+memory_.c: memory.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memory.c; then echo $(srcdir)/memory.c; else echo memory.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp_bpl_.c: mp_bpl.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_bpl.c; then echo $(srcdir)/mp_bpl.c; else echo mp_bpl.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp_clz_tab_.c: mp_clz_tab.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_clz_tab.c; then echo $(srcdir)/mp_clz_tab.c; else echo mp_clz_tab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp_dv_tab_.c: mp_dv_tab.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_dv_tab.c; then echo $(srcdir)/mp_dv_tab.c; else echo mp_dv_tab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp_get_fns_.c: mp_get_fns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_get_fns.c; then echo $(srcdir)/mp_get_fns.c; else echo mp_get_fns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp_minv_tab_.c: mp_minv_tab.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_minv_tab.c; then echo $(srcdir)/mp_minv_tab.c; else echo mp_minv_tab.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp_set_fns_.c: mp_set_fns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_set_fns.c; then echo $(srcdir)/mp_set_fns.c; else echo mp_set_fns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rand_.c: rand.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rand.c; then echo $(srcdir)/rand.c; else echo rand.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randbui_.c: randbui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randbui.c; then echo $(srcdir)/randbui.c; else echo randbui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randclr_.c: randclr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randclr.c; then echo $(srcdir)/randclr.c; else echo randclr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randdef_.c: randdef.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randdef.c; then echo $(srcdir)/randdef.c; else echo randdef.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randiset_.c: randiset.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randiset.c; then echo $(srcdir)/randiset.c; else echo randiset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randlc2s_.c: randlc2s.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randlc2s.c; then echo $(srcdir)/randlc2s.c; else echo randlc2s.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randlc2x_.c: randlc2x.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randlc2x.c; then echo $(srcdir)/randlc2x.c; else echo randlc2x.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randmt_.c: randmt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randmt.c; then echo $(srcdir)/randmt.c; else echo randmt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randmts_.c: randmts.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randmts.c; then echo $(srcdir)/randmts.c; else echo randmts.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randmui_.c: randmui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randmui.c; then echo $(srcdir)/randmui.c; else echo randmui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rands_.c: rands.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rands.c; then echo $(srcdir)/rands.c; else echo rands.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randsd_.c: randsd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randsd.c; then echo $(srcdir)/randsd.c; else echo randsd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+randsdui_.c: randsdui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/randsdui.c; then echo $(srcdir)/randsdui.c; else echo randsdui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tal-debug_.c: tal-debug.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tal-debug.c; then echo $(srcdir)/tal-debug.c; else echo tal-debug.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tal-notreent_.c: tal-notreent.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tal-notreent.c; then echo $(srcdir)/tal-notreent.c; else echo tal-notreent.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tal-reent_.c: tal-reent.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tal-reent.c; then echo $(srcdir)/tal-reent.c; else echo tal-reent.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+version_.c: version.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/version.c; then echo $(srcdir)/version.c; else echo version.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+assert_.$(OBJEXT) assert_.lo compat_.$(OBJEXT) compat_.lo \
+errno_.$(OBJEXT) errno_.lo extract-dbl_.$(OBJEXT) extract-dbl_.lo \
+invalid_.$(OBJEXT) invalid_.lo memory_.$(OBJEXT) memory_.lo \
+mp_bpl_.$(OBJEXT) mp_bpl_.lo mp_clz_tab_.$(OBJEXT) mp_clz_tab_.lo \
+mp_dv_tab_.$(OBJEXT) mp_dv_tab_.lo mp_get_fns_.$(OBJEXT) \
+mp_get_fns_.lo mp_minv_tab_.$(OBJEXT) mp_minv_tab_.lo \
+mp_set_fns_.$(OBJEXT) mp_set_fns_.lo rand_.$(OBJEXT) rand_.lo \
+randbui_.$(OBJEXT) randbui_.lo randclr_.$(OBJEXT) randclr_.lo \
+randdef_.$(OBJEXT) randdef_.lo randiset_.$(OBJEXT) randiset_.lo \
+randlc2s_.$(OBJEXT) randlc2s_.lo randlc2x_.$(OBJEXT) randlc2x_.lo \
+randmt_.$(OBJEXT) randmt_.lo randmts_.$(OBJEXT) randmts_.lo \
+randmui_.$(OBJEXT) randmui_.lo rands_.$(OBJEXT) rands_.lo \
+randsd_.$(OBJEXT) randsd_.lo randsdui_.$(OBJEXT) randsdui_.lo \
+tal-debug_.$(OBJEXT) tal-debug_.lo tal-notreent_.$(OBJEXT) \
+tal-notreent_.lo tal-reent_.$(OBJEXT) tal-reent_.lo version_.$(OBJEXT) \
+version_.lo : $(ANSI2KNR)
.cc.o:
$(CXXCOMPILE) -c -o $@ $<
@@ -785,8 +862,14 @@ distclean-compile:
.cc.lo:
$(LTCXXCOMPILE) -c -o $@ $<
+dummy.o: cxx/dummy.cc
+ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.o `test -f 'cxx/dummy.cc' || echo '$(srcdir)/'`cxx/dummy.cc
+
+dummy.obj: cxx/dummy.cc
+ $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.obj `if test -f 'cxx/dummy.cc'; then $(CYGPATH_W) 'cxx/dummy.cc'; else $(CYGPATH_W) '$(srcdir)/cxx/dummy.cc'; fi`
+
dummy.lo: cxx/dummy.cc
- $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.lo `test -f 'cxx/dummy.cc' || echo '$(srcdir)/'`cxx/dummy.cc
+ $(LIBTOOL) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o dummy.lo `test -f 'cxx/dummy.cc' || echo '$(srcdir)/'`cxx/dummy.cc
mostlyclean-libtool:
-rm -f *.lo
@@ -795,49 +878,42 @@ clean-libtool:
-rm -rf .libs _libs
distclean-libtool:
- -rm -f libtool config.lt
+ -rm -f libtool
+uninstall-info-am:
install-includeHEADERS: $(include_HEADERS)
@$(NORMAL_INSTALL)
- @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(includedir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(includedir)" || exit 1; \
- fi; \
- for p in $$list; do \
+ test -z "$(includedir)" || $(mkdir_p) "$(DESTDIR)$(includedir)"
+ @list='$(include_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includedir)'"; \
- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includedir)" || exit $$?; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(includeHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includedir)/$$f'"; \
+ $(includeHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includedir)/$$f"; \
done
uninstall-includeHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(include_HEADERS)'; test -n "$(includedir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(includedir)'; $(am__uninstall_files_from_dir)
+ @list='$(include_HEADERS)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(includedir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includedir)/$$f"; \
+ done
install-nodist_includeexecHEADERS: $(nodist_includeexec_HEADERS)
@$(NORMAL_INSTALL)
- @list='$(nodist_includeexec_HEADERS)'; test -n "$(includeexecdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(includeexecdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(includeexecdir)" || exit 1; \
- fi; \
- for p in $$list; do \
+ test -z "$(includeexecdir)" || $(mkdir_p) "$(DESTDIR)$(includeexecdir)"
+ @list='$(nodist_includeexec_HEADERS)'; for p in $$list; do \
if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_HEADER) $$files '$(DESTDIR)$(includeexecdir)'"; \
- $(INSTALL_HEADER) $$files "$(DESTDIR)$(includeexecdir)" || exit $$?; \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " $(nodist_includeexecHEADERS_INSTALL) '$$d$$p' '$(DESTDIR)$(includeexecdir)/$$f'"; \
+ $(nodist_includeexecHEADERS_INSTALL) "$$d$$p" "$(DESTDIR)$(includeexecdir)/$$f"; \
done
uninstall-nodist_includeexecHEADERS:
@$(NORMAL_UNINSTALL)
- @list='$(nodist_includeexec_HEADERS)'; test -n "$(includeexecdir)" || list=; \
- files=`for p in $$list; do echo $$p; done | sed -e 's|^.*/||'`; \
- dir='$(DESTDIR)$(includeexecdir)'; $(am__uninstall_files_from_dir)
+ @list='$(nodist_includeexec_HEADERS)'; for p in $$list; do \
+ f="`echo $$p | sed -e 's|^.*/||'`"; \
+ echo " rm -f '$(DESTDIR)$(includeexecdir)/$$f'"; \
+ rm -f "$(DESTDIR)$(includeexecdir)/$$f"; \
+ done
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
@@ -846,13 +922,7 @@ uninstall-nodist_includeexecHEADERS:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -863,21 +933,16 @@ $(RECURSIVE_TARGETS):
else \
local_target="$$target"; \
fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -897,16 +962,16 @@ $(RECURSIVE_CLEAN_TARGETS):
else \
local_target="$$target"; \
fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -914,14 +979,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
@@ -932,101 +997,83 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ test -f $$subdir/TAGS && \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) config.in $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) config.in $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
$(am__remove_distdir)
- test -d "$(distdir)" || mkdir "$(distdir)"
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ mkdir $(distdir)
+ $(mkdir_p) $(distdir)/. $(distdir)/demos $(distdir)/demos/calc
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- $(am__make_dryrun) \
- || test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
distdir) \
|| exit 1; \
fi; \
@@ -1034,35 +1081,21 @@ distdir: $(DISTFILES)
$(MAKE) $(AM_MAKEFLAGS) \
top_distdir="$(top_distdir)" distdir="$(distdir)" \
dist-hook
- -test -n "$(am__skip_mode_fix)" \
- || find "$(distdir)" -type d ! -perm -755 \
- -exec chmod u+rwx,go+rx {} \; -o \
+ -find $(distdir) -type d ! -perm -777 -exec chmod a+rwx {} \; -o \
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
- ! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
- || chmod -R a+r "$(distdir)"
+ ! -type d ! -perm -444 -exec $(SHELL) $(install_sh) -c -m a+r {} {} \; \
+ || chmod -R a+r $(distdir)
dist-gzip: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
dist-bzip2: distdir
- tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
- $(am__remove_distdir)
-
-dist-lzip: distdir
- tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
- $(am__remove_distdir)
-
-dist-lzma: distdir
- tardir=$(distdir) && $(am__tar) | lzma -9 -c >$(distdir).tar.lzma
- $(am__remove_distdir)
-
-dist-xz: distdir
- tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
+ $(AMTAR) chof - $(distdir) | bzip2 -9 -c >$(distdir).tar.bz2
$(am__remove_distdir)
dist-tarZ: distdir
- tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
+ $(AMTAR) chof - $(distdir) | compress -c >$(distdir).tar.Z
$(am__remove_distdir)
dist-shar: distdir
@@ -1075,7 +1108,7 @@ dist-zip: distdir
$(am__remove_distdir)
dist dist-all: distdir
- tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
+ $(AMTAR) chof - $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
$(am__remove_distdir)
# This target untars the dist file and tries a VPATH configuration. Then
@@ -1084,33 +1117,24 @@ dist dist-all: distdir
distcheck: dist
case '$(DIST_ARCHIVES)' in \
*.tar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).tar.gz | $(AMTAR) xf - ;;\
*.tar.bz2*) \
- bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
- *.tar.lzma*) \
- lzma -dc $(distdir).tar.lzma | $(am__untar) ;;\
- *.tar.lz*) \
- lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
- *.tar.xz*) \
- xz -dc $(distdir).tar.xz | $(am__untar) ;;\
+ bunzip2 -c $(distdir).tar.bz2 | $(AMTAR) xf - ;;\
*.tar.Z*) \
- uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
+ uncompress -c $(distdir).tar.Z | $(AMTAR) xf - ;;\
*.shar.gz*) \
- GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
+ GZIP=$(GZIP_ENV) gunzip -c $(distdir).shar.gz | unshar ;;\
*.zip*) \
unzip $(distdir).zip ;;\
esac
- chmod -R a-w $(distdir); chmod u+w $(distdir)
+ chmod -R a-w $(distdir); chmod a+w $(distdir)
mkdir $(distdir)/_build
mkdir $(distdir)/_inst
chmod a-w $(distdir)
- test -d $(distdir)/_build || exit 0; \
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
- && am__cwd=`pwd` \
- && $(am__cd) $(distdir)/_build \
+ && cd $(distdir)/_build \
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
- $(AM_DISTCHECK_CONFIGURE_FLAGS) \
$(DISTCHECK_CONFIGURE_FLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) \
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
@@ -1131,24 +1155,14 @@ distcheck: dist
&& rm -rf "$$dc_destdir" \
&& $(MAKE) $(AM_MAKEFLAGS) dist \
&& rm -rf $(DIST_ARCHIVES) \
- && $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
- && cd "$$am__cwd" \
- || exit 1
+ && $(MAKE) $(AM_MAKEFLAGS) distcleancheck
$(am__remove_distdir)
@(echo "$(distdir) archives ready for distribution: "; \
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
- sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
+ sed -e '1{h;s/./=/g;p;x;}' -e '$${p;x;}'
distuninstallcheck:
- @test -n '$(distuninstallcheck_dir)' || { \
- echo 'ERROR: trying to run $@ with an empty' \
- '$$(distuninstallcheck_dir)' >&2; \
- exit 1; \
- }; \
- $(am__cd) '$(distuninstallcheck_dir)' || { \
- echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
- exit 1; \
- }; \
- test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
+ @cd $(distuninstallcheck_dir) \
+ && test `$(distuninstallcheck_listfiles) | wc -l` -le 1 \
|| { echo "ERROR: files left after uninstall:" ; \
if test -n "$(DESTDIR)"; then \
echo " (check DESTDIR support)"; \
@@ -1167,11 +1181,11 @@ distcleancheck: distclean
check-am: all-am
check: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) check-recursive
-all-am: Makefile $(LTLIBRARIES) $(HEADERS) config.h
+all-am: Makefile $(ANSI2KNR) $(LTLIBRARIES) $(HEADERS) config.h
installdirs: installdirs-recursive
installdirs-am:
for dir in "$(DESTDIR)$(libdir)" "$(DESTDIR)$(includedir)" "$(DESTDIR)$(includeexecdir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: $(BUILT_SOURCES)
$(MAKE) $(AM_MAKEFLAGS) install-recursive
@@ -1184,22 +1198,16 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@@ -1208,14 +1216,14 @@ maintainer-clean-generic:
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
clean: clean-recursive
-clean-am: clean-generic clean-libLTLIBRARIES clean-libtool clean-local \
- mostlyclean-am
+clean-am: clean-generic clean-krextra clean-libLTLIBRARIES \
+ clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-hdr distclean-libtool distclean-local distclean-tags
+ distclean-hdr distclean-libtool distclean-tags
dvi: dvi-recursive
@@ -1223,8 +1231,6 @@ dvi-am:
html: html-recursive
-html-am:
-
info: info-recursive
info-am:
@@ -1232,31 +1238,14 @@ info-am:
install-data-am: install-includeHEADERS
@$(NORMAL_INSTALL)
$(MAKE) $(AM_MAKEFLAGS) install-data-hook
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
install-exec-am: install-libLTLIBRARIES \
install-nodist_includeexecHEADERS
-install-html: install-html-recursive
-
-install-html-am:
-
install-info: install-info-recursive
-install-info-am:
-
install-man:
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-recursive
@@ -1267,7 +1256,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-recursive
@@ -1278,34 +1267,30 @@ ps: ps-recursive
ps-am:
-uninstall-am: uninstall-includeHEADERS uninstall-libLTLIBRARIES \
- uninstall-nodist_includeexecHEADERS
-
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) all check \
- ctags-recursive install install-am install-data-am \
- install-strip tags-recursive
-
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am am--refresh check check-am clean clean-generic \
- clean-libLTLIBRARIES clean-libtool clean-local ctags \
- ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-hook \
- dist-lzip dist-lzma dist-shar dist-tarZ dist-xz dist-zip \
- distcheck distclean distclean-compile distclean-generic \
- distclean-hdr distclean-libtool distclean-local distclean-tags \
- distcleancheck distdir distuninstallcheck dvi dvi-am html \
- html-am info info-am install install-am install-data \
- install-data-am install-data-hook install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-includeHEADERS install-info install-info-am \
- install-libLTLIBRARIES install-man \
- install-nodist_includeexecHEADERS install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+uninstall-am: uninstall-includeHEADERS uninstall-info-am \
+ uninstall-libLTLIBRARIES uninstall-nodist_includeexecHEADERS
+
+uninstall-info: uninstall-info-recursive
+
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am am--refresh check \
+ check-am clean clean-generic clean-krextra \
+ clean-libLTLIBRARIES clean-libtool clean-recursive ctags \
+ ctags-recursive dist dist-all dist-bzip2 dist-gzip dist-shar \
+ dist-tarZ dist-zip distcheck distclean distclean-compile \
+ distclean-generic distclean-hdr distclean-libtool \
+ distclean-recursive distclean-tags distcleancheck distdir \
+ distuninstallcheck dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-includeHEADERS install-info \
+ install-info-am install-libLTLIBRARIES install-man \
+ install-nodist_includeexecHEADERS install-strip installcheck \
installcheck-am installdirs installdirs-am maintainer-clean \
- maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags tags-recursive uninstall uninstall-am \
- uninstall-includeHEADERS uninstall-libLTLIBRARIES \
- uninstall-nodist_includeexecHEADERS
+ maintainer-clean-generic maintainer-clean-recursive \
+ mostlyclean mostlyclean-compile mostlyclean-generic \
+ mostlyclean-kr mostlyclean-libtool mostlyclean-recursive pdf \
+ pdf-am ps ps-am tags tags-recursive uninstall uninstall-am \
+ uninstall-includeHEADERS uninstall-info-am \
+ uninstall-libLTLIBRARIES uninstall-nodist_includeexecHEADERS
install-data-hook:
@@ -1324,48 +1309,48 @@ install-data-hook:
@echo '+-------------------------------------------------------------+'
@echo ''
-fac_table.h: gen-fac$(EXEEXT_FOR_BUILD)
- ./gen-fac $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fac_table.h || (rm -f fac_table.h; exit 1)
+mpz/fac_ui.h: gen-fac_ui$(EXEEXT_FOR_BUILD)
+ ./gen-fac_ui $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpz/fac_ui.h || (rm -f mpz/fac_ui.h; exit 1)
+
+gen-fac_ui$(EXEEXT_FOR_BUILD): gen-fac_ui$(U_FOR_BUILD).c dumbmp.c
+ $(CC_FOR_BUILD) `test -f 'gen-fac_ui$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fac_ui$(U_FOR_BUILD).c -o gen-fac_ui$(EXEEXT_FOR_BUILD)
-gen-fac$(EXEEXT_FOR_BUILD): gen-fac$(U_FOR_BUILD).c bootstrap.c
- $(CC_FOR_BUILD) `test -f 'gen-fac$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fac$(U_FOR_BUILD).c -o gen-fac$(EXEEXT_FOR_BUILD)
+gen-fac_ui_.c: gen-fac_ui.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fac_ui.c; then echo $(srcdir)/gen-fac_ui.c; else echo gen-fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fac_ui_.c || rm -f gen-fac_ui_.c
fib_table.h: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1)
+ ./gen-fib header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >fib_table.h || (rm -f fib_table.h; exit 1)
mpn/fib_table.c: gen-fib$(EXEEXT_FOR_BUILD)
- ./gen-fib table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
+ ./gen-fib table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/fib_table.c || (rm -f mpn/fib_table.c; exit 1)
-gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c bootstrap.c
+gen-fib$(EXEEXT_FOR_BUILD): gen-fib$(U_FOR_BUILD).c dumbmp.c
$(CC_FOR_BUILD) `test -f 'gen-fib$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-fib$(U_FOR_BUILD).c -o gen-fib$(EXEEXT_FOR_BUILD)
+gen-fib_.c: gen-fib.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-fib.c; then echo $(srcdir)/gen-fib.c; else echo gen-fib.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-fib_.c || rm -f gen-fib_.c
+
mp_bases.h: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases header $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1)
+ ./gen-bases header $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mp_bases.h || (rm -f mp_bases.h; exit 1)
mpn/mp_bases.c: gen-bases$(EXEEXT_FOR_BUILD)
- ./gen-bases table $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
+ ./gen-bases table $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/mp_bases.c || (rm -f mpn/mp_bases.c; exit 1)
-gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c bootstrap.c
+gen-bases$(EXEEXT_FOR_BUILD): gen-bases$(U_FOR_BUILD).c dumbmp.c
$(CC_FOR_BUILD) `test -f 'gen-bases$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-bases$(U_FOR_BUILD).c -o gen-bases$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD)
-trialdivtab.h: gen-trialdivtab$(EXEEXT_FOR_BUILD)
- ./gen-trialdivtab $(GMP_LIMB_BITS) 8000 >trialdivtab.h || (rm -f trialdivtab.h; exit 1)
-
-gen-trialdivtab$(EXEEXT_FOR_BUILD): gen-trialdivtab$(U_FOR_BUILD).c bootstrap.c
- $(CC_FOR_BUILD) `test -f 'gen-trialdivtab$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-trialdivtab$(U_FOR_BUILD).c -o gen-trialdivtab$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD)
-
-mpn/jacobitab.h: gen-jacobitab$(EXEEXT_FOR_BUILD)
- ./gen-jacobitab >mpn/jacobitab.h || (rm -f mpn/jacobitab.h; exit 1)
-
-gen-jacobitab$(EXEEXT_FOR_BUILD): gen-jacobitab$(U_FOR_BUILD).c
- $(CC_FOR_BUILD) `test -f 'gen-jacobitab$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-jacobitab$(U_FOR_BUILD).c -o gen-jacobitab$(EXEEXT_FOR_BUILD)
+gen-bases_.c: gen-bases.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-bases.c; then echo $(srcdir)/gen-bases.c; else echo gen-bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-bases_.c || rm -f gen-bases_.c
mpn/perfsqr.h: gen-psqr$(EXEEXT_FOR_BUILD)
- ./gen-psqr $(GMP_LIMB_BITS) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
+ ./gen-psqr $(BITS_PER_MP_LIMB) $(GMP_NAIL_BITS) >mpn/perfsqr.h || (rm -f mpn/perfsqr.h; exit 1)
-gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c bootstrap.c
+gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c dumbmp.c
$(CC_FOR_BUILD) `test -f 'gen-psqr$(U_FOR_BUILD).c' || echo '$(srcdir)/'`gen-psqr$(U_FOR_BUILD).c -o gen-psqr$(EXEEXT_FOR_BUILD) $(LIBM_FOR_BUILD)
+gen-psqr_.c: gen-psqr.c $(ANSI2KNR)
+ $(CPP_FOR_BUILD) `if test -f $(srcdir)/gen-psqr.c; then echo $(srcdir)/gen-psqr.c; else echo gen-psqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > gen-psqr_.c || rm -f gen-psqr_.c
+
# Avoid: CVS - cvs directories
# *~ - emacs backups
# .#* - cvs merge originals
@@ -1376,37 +1361,9 @@ gen-psqr$(EXEEXT_FOR_BUILD): gen-psqr$(U_FOR_BUILD).c bootstrap.c
dist-hook:
-find $(distdir) \( -name CVS -type d \) -o -name "*~" -o -name ".#*" \
| xargs rm -rf
- cp "$(srcdir)"/mini-gmp/tests/*.[ch] "$(distdir)/mini-gmp/tests"
-# grep -F $(VERSION) $(srcdir)/Makefile.am \
-# | grep -q "^# *$(VERSION) *$(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) *$(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE)"
-# test -z "`sed -n 's/^# *[0-9]*\.[0-9]*\.[0-9]* *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\).*/A\1\nB\2\nC\3/p' $(srcdir)/Makefile.am | grep -v 'A6:3:3\|B3:5:0\|C4:7:1' | sort | uniq -d`"
-
-.PHONY: check-mini-gmp clean-mini-gmp
-
-check-mini-gmp:
- abs_srcdir="`cd $(srcdir) && pwd`" ; \
- $(MKDIR_P) mini-gmp/tests \
- && cd mini-gmp/tests \
- && LD_LIBRARY_PATH="../../.libs:$$LD_LIBRARY_PATH" \
- DYLD_LIBRARY_PATH="../../.libs:$$DYLD_LIBRARY_PATH" \
- $(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" \
- VPATH="$$abs_srcdir/mini-gmp/tests" \
- srcdir="$$abs_srcdir/mini-gmp/tests" \
- MINI_GMP_DIR="$$abs_srcdir/mini-gmp" \
- LDFLAGS="-L../../.libs" \
- LIBS="-lgmp -lm" \
- CC="$(CC_FOR_BUILD)" EXTRA_CFLAGS="-g -I../.." check
-
-clean-mini-gmp:
- if [ -d mini-gmp/tests ] ; then \
- abs_srcdir="`cd $(srcdir) && pwd`" ; \
- cd mini-gmp/tests \
- && $(MAKE) -f "$$abs_srcdir/mini-gmp/tests/Makefile" clean ; \
- fi
-
-clean-local: clean-mini-gmp
-distclean-local: clean-mini-gmp
-
+ grep -F $(VERSION) $(srcdir)/Makefile.am \
+ | grep -q "^# *$(VERSION) *$(LIBGMP_LT_CURRENT):$(LIBGMP_LT_REVISION):$(LIBGMP_LT_AGE) *$(LIBGMPXX_LT_CURRENT):$(LIBGMPXX_LT_REVISION):$(LIBGMPXX_LT_AGE) *$(LIBMP_LT_CURRENT):$(LIBMP_LT_REVISION):$(LIBMP_LT_AGE)"
+ test -z "`sed -n 's/^# *[0-9]*\.[0-9]*\.[0-9]* *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\) *\([0-9]*:[0-9]*:[0-9]*\).*/A\1\nB\2\nC\3/p' $(srcdir)/Makefile.am | grep -v 'A6:3:3\|B3:5:0\|C4:7:1' | sort | uniq -d`"
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/NEWS b/gmp/NEWS
index 5f77bce1e1..488ae51014 100644
--- a/gmp/NEWS
+++ b/gmp/NEWS
@@ -1,458 +1,8 @@
-Copyright 1996, 1999-2014 Free Software Foundation, Inc.
+Copyright 1996, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008,
+2009, 2010 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 6.0.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
- * The internal functions mpn_sbpi1_div_qr_sec mpn_sbpi1_div_r_sec could
- compute garbage with a low probability. They are now rewritten, and the
- test code has been improved.
-
- * A bug in the ia64 implementation of mpn_divrem_2, clobbering some
- callee-save registers, has been fixed. This is an internal
- function, with the bug manifesting itself as miscomputation in,
- e.g., mpn_sqrtrem.
-
- * The documentation now correctly says 'const' for input arguments.
-
- SPEEDUPS
- * None.
-
- FEATURES
- * None.
-
- 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.
-
- * 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.
-
- SPEEDUPS
- * None.
-
- FEATURES
- * None.
-
- MISC
- * Fixes and generalisations to the test suite.
-
- * Minor portability enhancements.
-
-
-Changes between GMP version 5.1.0 and 5.1.1
-
- BUGS FIXED
- * On Windows 64-bit, an error causing link errors about
- __gmp_binvert_limb_table has been fixed.
-
- * Aarch64 alias ARM64 support now works.
-
- * A possible buffer overrun in mpz_ior has been fixed.
-
- * A rare sign flip in mpz_remove has been fixed.
-
- * A bug causing problems with mpf numbers with absolute value >= 2^31 has
- been fixed.
-
- * Several bugs in mini-gmp have been fixed.
-
- * A bug caused by automake, related to the 'distcheck' target, has been fixed
- by upgrading the automake used for GMP release engineering.
-
- SPEEDUPS
- * None.
-
- FEATURES
- * Preliminary support for the x32 ABI under x86-64.
-
- MISC
- * The mini-gmp testsuite now tests the entire set of functions.
-
- * Various improvements of the GMP testsuite.
-
-
-Changes between GMP version 5.0.* and 5.1.0
-
- BUGS FIXED
- * When reading a C++ number (like mpz_class) in an istream reaches the end
- of the stream, the eofbit is now set.
-
- * The result sign of mpz_rootrem's remainder is now always correct.
-
- * The mpz_remove function now handles negative divisors.
-
- * Contains all fixes from release 5.0.5.
-
- SPEEDUPS
- * The n-factorial and n-over-k functions have been reimplemented for great
- speedups for small and large operands.
-
- * New subquadratic algorithm for the Kronecker/Jacobi/Legendre symbol.
-
- * Major speedup for ARM, in particular ARM Cortex-A9 and A15, thanks to broad
- assembly support.
-
- * Significant speedup for POWER6 and POWER7 thanks to improved assembly.
-
- * The performance under M$ Windows' 64-bit ABI has been greatly improved
- thanks to complete assembly support.
-
- * Minor speed improvements of many functions and for many platforms.
-
- FEATURES
- * Many new CPUs recognised.
-
- * New functions for multi-factorials, and primorial: mpz_2fac_ui,
- mpz_mfac_uiui and mpz_primorial_ui.
-
- * The mpz_powm_sec function now uses side-channel silent division for
- converting into Montgomery residues.
-
- * The fat binary mechanism is now more robust in its CPU recognition.
-
- MISC
- * Inclusion of assembly code is now controlled by the configure options
- --enable-assembly and --disable-assembly. The "none" CPU target is gone.
-
- * In C++, the conversions mpq_class->mpz_class, mpf_class->mpz_class and
- mpf_class->mpq_class are now explicit.
-
- * Includes "mini-gmp", a small, portable, but less efficient, implementation
- of a subset of GMP's mpn and mpz interfaces. Used in GMP bootstrap, but it
- can also be bundled with applications as a fallback when the real GMP
- library is unavailable.
-
- * The ABIs under AIX are no longer called aix32 and aix64, but mode64 and 32.
- This is more consistent with other powerpc systems.
-
- * The coverage of the testsuite has been improved, using the lcov tool. See
- also https://gmplib.org/devel/lcov/.
-
- * It is now possible to compile GMP using a C++ compiler.
-
- * K&R C compilers are no longer supported.
-
- * The BSD MP compatibility functions have been removed.
-
-
-Changes between GMP version 5.0.4 and 5.0.5
-
- BUGS FIXED
- * A bug causing AMD 11h processors to be treated like AMD 10h has been fixed.
- The 11h processors do not correctly handle all 10h (aka K10) instructions,
- and GMP's use of these instructions results in major miscomputations (not
- as one would have hoped CPU traps of some 'illegal instruction' sort).
-
- * A bug affecting recent Intel Sandy Bridge CPUs resulting in configuration
- failures has been fixed.
-
- SPEEDUPS
- * None.
-
- FEATURES
- * A couple of tests added to the self-check suite.
-
- MISC
- * None.
-
-
-Changes between GMP version 5.0.3 and 5.0.4
-
- BUGS FIXED
- * Thresholds in mpn_powm_sec for both fat and non-fat builds are now used
- safely, plugging a one-word buffer overrun introduced in the 5.0.3 release
- (for non-fat) and a multi-word buffer overrun that existed since 5.0 (for
- fat). (We have not been able to provoke malign stack smashing in any of
- the ~100 configurations explored by the GMP nightly builds, but the bug
- should be assumed to be exploitable.)
-
- * Two bugs in multiplication code causing incorrect computation with
- extremely low probability have been fixed.
-
- * A bug in the test suite causing buffer overruns during "make check",
- sometimes leading to subsequent malloc crashes, has been fixed.
-
- * Two bugs in the gcd code have been fixed. They could lead to incorrect
- results, but for uniformly distributed random operands, the likelihood for
- that is infinitesimally small. (There was also a third bug, but that was
- an incorrect ASSERT, which furthermore was not enabled by default.)
-
- * A bug affecting 32-bit PowerPC division has been fixed. The bug caused
- miscomputation for certain divisors in the range 2^32 ... 2^64-1 (about 1
- in 2^30 of these).
-
- SPEEDUPS
- * None, except indirectly through recognition of new CPUs, and through better
- tuning parameters.
-
- FEATURES
- * Some more tests added to the self-check suite.
-
- * The AMD "Bulldozer" CPU is now recognised.
-
- MISC
- * None.
-
-
-Changes between GMP version 5.0.2 and 5.0.3
-
- BUGS FIXED
- * A few minor bugs related to portability fixed.
-
- * A slight timing leak of the powm_sec functions have been sealed. (This
- leak could possibly be used to extract the most significant few bits of the
- exponent. "Few" here means at most 10.)
-
- * The mpz_nextprime function now runs a safer number of pseudo-random prime
- tests.
-
- * A bug in division code possibly causing incorrect computation was fixed.
-
- SPEEDUPS
- * None, except indirectly through recognition of new CPUs, and through better
- tuning parameters.
-
- FEATURES
- * New CPUs recognised.
-
- * IBM S/390 are now supported in both 31/32-bit and 64-bit mode. (We have
- not been able to fully test this on any multilib machine, since IBM expired
- our guest account a few days before our release.)
-
- MISC
- * None.
-
-
-Changes between GMP version 5.0.1 and 5.0.2
-
- BUGS FIXED
- * Many minor bugs related to portability fixed.
-
- * The support for HPPA 2.0N now works, after an assembly bug fix.
-
- * A test case type error has been fixed. The symptom of this bug was
- spurious 'make check' failures.
-
- SPEEDUPS
- * None, except indirectly through recognition of new CPUs.
-
- FEATURES
- * Fat builds are now supported for 64-bit x86 processors also under Darwin.
-
- MISC
- * None.
-
-
-Changes between GMP version 5.0.0 and 5.0.1
-
- BUGS FIXED
- * Fat builds fixed.
-
- * Fixed crash for huge multiplies when old FFT_TABLE2 type of parameter
- selection tables' sentinel was smaller than multiplied operands.
-
- * The solib numbers now reflect the removal of the documented but preliminary
- mpn_bdivmod function; we correctly flag incompatibility with GMP 4.3. GMP
- 5.0.0 has this wrong, and should perhaps be uninstalled to avoid confusion.
-
- SPEEDUPS
- * Multiplication of large numbers has indirectly been sped up through better
- FFT tuning and processor recognition. Since many operations depend on
- multiplication, there will be a general speedup.
-
- FEATURES
- * More Core i3, i5 an Core i7 processor models are recognised.
-
- * Fixes and workarounds for Mac OS quirks should make this GMP version build
- using many of the different versions of "Xcode".
-
- MISC
- * The amount of scratch memory needed for multiplication of huge numbers has
- been reduced substantially (but is still larger than in GMP 4.3.)
-
- * Likewise, the amount of scratch memory needed for division of large numbers
- has been reduced substantially.
-
- * The FFT tuning code of tune/tuneup.c has been completely rewritten, and
- new, large FFT parameter selection tables are provided for many machines.
-
- * Upgraded to the latest autoconf, automake, libtool.
-
-
-Changes between GMP version 4.3.X and 5.0.0
-
- BUGS FIXED
- * None (contains the same fixes as release 4.3.2).
-
- SPEEDUPS
- * Multiplication has been overhauled:
- (1) Multiplication of larger same size operands has been improved with
- the addition of two new Toom functions and a new internal function
- mpn_mulmod_bnm1 (computing U * V mod (B^n-1), B being the word base.
- This latter function is used for the largest products, waiting for a
- better Schoenhage-Strassen U * V mod (B^n+1) implementation.
- (2) Likewise for squaring.
- (3) Multiplication of different size operands has been improved with the
- addition of many new Toom function, and by selecting underlying
- functions better from the main multiply functions.
-
- * Division and mod have been overhauled:
- (1) Plain "schoolbook" division is reimplemented using faster quotient
- approximation.
- (2) Division Q = N/D, R = N mod D where both the quotient and remainder
- are needed now runs in time O(M(log(N))). This is an improvement of
- a factor log(log(N))
- (3) Division where just the quotient is needed is now O(M(log(Q))) on
- average.
- (4) Modulo operations using Montgomery REDC form now take time O(M(n)).
- (5) Exact division Q = N/D by means of mpz_divexact has been improved
- for all sizes, and now runs in time O(M(log(N))).
-
- * The function mpz_powm is now faster for all sizes. Its complexity has
- gone from O(M(n)log(n)m) to O(M(n)m) where n is the size of the modulo
- argument and m is the size of the exponent. It is also radically
- faster for even modulus, since it now partially factors such modulus
- and performs two smaller modexp operations, then uses CRT.
-
- * The internal support for multiplication yielding just the lower n limbs
- has been improved by using Mulders' algorithm.
-
- * Computation of inverses, both plain 1/N and 1/N mod B^n have been
- improved by using well-tuned Newton iterations, and wrap-around
- multiplication using mpn_mulmod_bnm1.
-
- * A new algorithm makes mpz_perfect_power_p asymptotically faster.
-
- * The function mpz_remove uses a much faster algorithm, is better tuned,
- and also benefits from the division improvements.
-
- * Intel Atom and VIA Nano specific optimisations.
-
- * Plus hundreds of smaller improvements and tweaks!
-
- FEATURES
- * New mpz function: mpz_powm_sec for side-channel quiet modexp
- computations.
-
- * New mpn functions: mpn_sqr, mpn_and_n, mpn_ior_n, mpn_xor_n, mpn_nand_n,
- mpn_nior_n, mpn_xnor_n, mpn_andn_n, mpn_iorn_n, mpn_com, mpn_neg,
- mpn_copyi, mpn_copyd, mpn_zero.
-
- * The function mpn_tdiv_qr now allows certain argument overlap.
-
- * Support for fat binaries for 64-bit x86 processors has been added.
-
- * A new type, mp_bitcnt_t for bignum bit counts, has been introduced.
-
- * Support for Windows64 through mingw64 has been added.
-
- * The cofactors of mpz_gcdext and mpn_gcdext are now more strictly
- normalised, returning to how GMP 4.2 worked. (Note that also release
- 4.3.2 has this change.)
-
- MISC
- * The mpn_mul function should no longer be used for squaring,
- instead use the new mpn_sqr.
-
- * The algorithm selection has been improved, the number of thresholds have
- more than doubled, and the tuning and use of existing thresholds have
- been improved.
-
- * The tune/speed program can measure many of new functions.
-
- * The mpn_bdivmod function has been removed. We do not consider this an
- incompatible change, since the function was marked as preliminary.
-
- * The testsuite has been enhanced in various ways.
+Verbatim copying and distribution of this entire article is permitted
+in any medium, provided this notice is preserved.
Changes between GMP version 4.3.1 and 4.3.2
@@ -589,7 +139,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 https://gmplib.org/macos.html for more information.)
+ (Please see http://gmplib.org/macos.html for more information.)
Changes between GMP version 4.2 and 4.2.1
diff --git a/gmp/README b/gmp/README
index 013899dc09..03ffb7ff30 100644
--- a/gmp/README
+++ b/gmp/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -49,8 +38,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* (see the manual for information on which license(s) applies to
-which components of GNU MP).
+files COPYING.LIB and COPYING (most of GNU MP is under the former, some under
+the latter).
@@ -98,7 +87,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 https://gmplib.org/, under
+You should first check the GNU MP web pages at http://gmplib.org/, under
"Status of the current release". There will be patches for all known serious
bugs there.
diff --git a/gmp/acinclude.m4 b/gmp/acinclude.m4
index 227712a5db..f3d6ef0ec8 100644
--- a/gmp/acinclude.m4
+++ b/gmp/acinclude.m4
@@ -1,33 +1,23 @@
dnl GMP specific autoconf macros
-dnl Copyright 2000-2006, 2009, 2011, 2013, 2014 Free Software Foundation, Inc.
+dnl Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2009 Free Software
+dnl 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Some tests use, or must delete, the default compiler output. The
@@ -53,17 +43,9 @@ define(M68K_PATTERN,
define(POWERPC64_PATTERN,
[[powerpc64-*-* | powerpc64le-*-* | powerpc620-*-* | powerpc630-*-* | powerpc970-*-* | power[3-9]-*-*]])
-define(S390_PATTERN,
-[[s390-*-* | z900esa-*-* | z990esa-*-* | z9esa-*-* | z10esa-*-* | z196esa-*-*]])
-
-define(S390X_PATTERN,
-[[s390x-*-* | z900-*-* | z990-*-* | z9-*-* | z10-*-* | z196-*-*]])
-
define(X86_PATTERN,
-[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*]])
+[[i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-*]])
-define(X86_64_PATTERN,
-[[athlon64-*-* | k8-*-* | k10-*-* | bobcat-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*]])
dnl GMP_FAT_SUFFIX(DSTVAR, DIRECTORY)
dnl ---------------------------------
@@ -128,12 +110,13 @@ dnl Expand to the right way to #include gmp-h.in. This must be used
dnl instead of gmp.h, since that file isn't generated until the end of the
dnl configure.
dnl
-dnl Dummy value for GMP_LIMB_BITS is enough
+dnl Dummy values for __GMP_BITS_PER_MP_LIMB and GMP_LIMB_BITS are enough
dnl for all current configure-time uses of gmp.h.
define(GMP_INCLUDE_GMP_H,
[[#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
#define GMP_LIMB_BITS 123
$DEFN_LONG_LONG_LIMB
#include "$srcdir/gmp-h.in"]
@@ -320,9 +303,7 @@ 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(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
+')ifelse(t1`'t2,YY,`good
')]
EOF
dnl ' <- balance the quotes for emacs sh-mode
@@ -687,7 +668,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 partial garbage to
+ "icc -O3", After several calls, the function writes parial 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. */
@@ -1843,7 +1824,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 "Suppressing this warning by omitting 0x90" 1>&AC_FD_CC
+ echo "Supressing this warning by omitting 0x90" 1>&AC_FD_CC
gmp_cv_asm_align_fill_0x90=no
else
gmp_cv_asm_align_fill_0x90=yes
@@ -1959,8 +1940,7 @@ X86_PATTERN | x86_64-*-*)
esac
cat >conftest.c <<EOF
-extern const int foo[[]]; /* Suppresses C++'s suppression of foo */
-const int foo[[]] = {1,2,3};
+const int foo = 123;
EOF
echo "Test program:" >&AC_FD_CC
cat conftest.c >&AC_FD_CC
@@ -2618,83 +2598,6 @@ 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.
@@ -3102,57 +3005,6 @@ 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 ---------------------
@@ -3239,17 +3091,14 @@ dnl -------------------
dnl Determine the floating point format.
dnl
dnl The object file is grepped, in order to work when cross compiling. A
-dnl start and end sequence is included to avoid false matches, and allowance
-dnl is made for the desired data crossing an "od -b" line boundary. The test
-dnl number is a small integer so it should appear exactly, no rounding or
-dnl truncation etc.
+dnl start and end sequence is included to avoid false matches, and
+dnl allowance is made for the desired data crossing an "od -b" line
+dnl boundary. The test number is a small integer so it should appear
+dnl exactly, no rounding or truncation etc.
dnl
dnl "od -b", incidentally, is supported even by Unix V7, and the awk script
dnl used doesn't have functions or anything, so even an "old" awk should
dnl suffice.
-dnl
-dnl The C code here declares the variable foo as extern; without that, some
-dnl C++ compilers will not put foo in the object file.
AC_DEFUN([GMP_C_DOUBLE_FORMAT],
[AC_REQUIRE([AC_PROG_CC])
@@ -3258,13 +3107,11 @@ AC_CACHE_CHECK([format of `double' floating point],
gmp_cv_c_double_format,
[gmp_cv_c_double_format=unknown
cat >conftest.c <<\EOF
-[struct foo {
+[struct {
char before[8];
double x;
char after[8];
-};
-extern struct foo foo;
-struct foo foo = {
+} foo = {
{ '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
-123456789.0,
{ '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
@@ -3481,7 +3328,7 @@ esac
dnl GMP_C_STDARG
dnl ------------
-dnl Test whether to use <stdarg.h>.
+dnl Test whether to use <stdarg.h> or <varargs.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.
@@ -3491,26 +3338,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.
-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 ])
+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 GMP_FUNC_ALLOCA
@@ -3664,7 +3511,8 @@ 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_CHECK_FUNC(vsnprintf,
+[AC_REQUIRE([GMP_C_STDARG])
+AC_CHECK_FUNC(vsnprintf,
[gmp_vsnprintf_exists=yes],
[gmp_vsnprintf_exists=no])
if test "$gmp_vsnprintf_exists" = no; then
@@ -3673,30 +3521,45 @@ else
AC_CACHE_CHECK([whether vsnprintf works],
gmp_cv_func_vsnprintf,
[gmp_cv_func_vsnprintf=yes
- for i in 'return check ("hello world");' 'int n; return check ("%nhello world", &n);'; do
+ for i in 'check ("hello world");' 'int n; check ("%nhello world", &n);'; do
AC_TRY_RUN([
#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);
if (strcmp (buf, "hel") != 0)
- return 1;
+ exit (1);
/* allowed return values */
if (ret != -1 && ret != 3 && ret != 11)
- return 2;
+ exit (2);
return 0;
}
@@ -3705,6 +3568,7 @@ int
main ()
{
$i
+ exit (0);
}
],
[:],
@@ -3723,6 +3587,28 @@ fi
])
+dnl GMP_H_ANSI
+dnl ----------
+dnl Check whether gmp.h recognises the compiler as ANSI capable.
+
+AC_DEFUN([GMP_H_ANSI],
+[AC_REQUIRE([AC_PROG_CC_STDC])
+case $ac_cv_prog_cc_stdc in
+ no)
+ ;;
+ *)
+ AC_TRY_COMPILE(
+GMP_INCLUDE_GMP_H
+[#if ! __GMP_HAVE_PROTOTYPES
+die die die
+#endif
+],,,
+ [AC_MSG_WARN([gmp.h doesnt recognise compiler as ANSI, prototypes and "const" will be unavailable])])
+ ;;
+esac
+])
+
+
dnl GMP_H_EXTERN_INLINE
dnl -------------------
dnl If the compiler has an "inline" of some sort, check whether the
@@ -3914,8 +3800,6 @@ dnl GMP_C_FOR_BUILD_ANSI
dnl --------------------
dnl Determine whether CC_FOR_BUILD is ANSI, and establish U_FOR_BUILD
dnl accordingly.
-dnl
-dnl FIXME: Use AC_PROG_CC sets ac_cv_prog_cc_c89 which could be used instead
AC_DEFUN([GMP_C_FOR_BUILD_ANSI],
[AC_REQUIRE([GMP_PROG_CC_FOR_BUILD])
diff --git a/gmp/aclocal.m4 b/gmp/aclocal.m4
index 11222f5a23..c2bb369ec7 100644
--- a/gmp/aclocal.m4
+++ b/gmp/aclocal.m4
@@ -1,8 +1,7 @@
-# generated automatically by aclocal 1.11.6 -*- Autoconf -*-
+# generated automatically by aclocal 1.8.4 -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software Foundation,
-# Inc.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
# This file is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -12,208 +11,103 @@
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
# PARTICULAR PURPOSE.
-m4_ifndef([AC_AUTOCONF_VERSION],
- [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],,
-[m4_warning([this file was generated for autoconf 2.69.
-You have another version of autoconf. It may work, but is not guaranteed to.
-If you have problems, you may need to regenerate the build system entirely.
-To do so, use the procedure documented by the package, typically `autoreconf'.])])
-
# libtool.m4 - Configure libtool for the host system. -*-Autoconf-*-
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
-# Written by Gordon Matzigkeit, 1996
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-m4_define([_LT_COPYING], [dnl
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
-# Written by Gordon Matzigkeit, 1996
-#
-# This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that 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 GNU Libtool; see the file COPYING. If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-])
-
-# serial 57 LT_INIT
-
-# LT_PREREQ(VERSION)
-# ------------------
-# Complain and exit if this libtool version is less that VERSION.
-m4_defun([LT_PREREQ],
-[m4_if(m4_version_compare(m4_defn([LT_PACKAGE_VERSION]), [$1]), -1,
- [m4_default([$3],
- [m4_fatal([Libtool version $1 or higher is required],
- 63)])],
- [$2])])
+# serial 51 AC_PROG_LIBTOOL
-# _LT_CHECK_BUILDDIR
-# ------------------
-# Complain if the absolute build directory name contains unusual characters
-m4_defun([_LT_CHECK_BUILDDIR],
-[case `pwd` in
- *\ * | *\ *)
- AC_MSG_WARN([Libtool does not cope well with whitespace in `pwd`]) ;;
-esac
-])
+# AC_PROVIDE_IFELSE(MACRO-NAME, IF-PROVIDED, IF-NOT-PROVIDED)
+# -----------------------------------------------------------
+# If this macro is not defined by Autoconf, define it here.
+m4_ifdef([AC_PROVIDE_IFELSE],
+ [],
+ [m4_define([AC_PROVIDE_IFELSE],
+ [m4_ifdef([AC_PROVIDE_$1],
+ [$2], [$3])])])
-# LT_INIT([OPTIONS])
-# ------------------
-AC_DEFUN([LT_INIT],
-[AC_PREREQ([2.58])dnl We use AC_INCLUDES_DEFAULT
-AC_REQUIRE([AC_CONFIG_AUX_DIR_DEFAULT])dnl
-AC_BEFORE([$0], [LT_LANG])dnl
-AC_BEFORE([$0], [LT_OUTPUT])dnl
-AC_BEFORE([$0], [LTDL_INIT])dnl
-m4_require([_LT_CHECK_BUILDDIR])dnl
-
-dnl Autoconf doesn't catch unexpanded LT_ macros by default:
-m4_pattern_forbid([^_?LT_[A-Z_]+$])dnl
-m4_pattern_allow([^(_LT_EOF|LT_DLGLOBAL|LT_DLLAZY_OR_NOW|LT_MULTI_MODULE)$])dnl
-dnl aclocal doesn't pull ltoptions.m4, ltsugar.m4, or ltversion.m4
-dnl unless we require an AC_DEFUNed macro:
-AC_REQUIRE([LTOPTIONS_VERSION])dnl
-AC_REQUIRE([LTSUGAR_VERSION])dnl
-AC_REQUIRE([LTVERSION_VERSION])dnl
-AC_REQUIRE([LTOBSOLETE_VERSION])dnl
-m4_require([_LT_PROG_LTMAIN])dnl
-
-_LT_SHELL_INIT([SHELL=${CONFIG_SHELL-/bin/sh}])
-
-dnl Parse OPTIONS
-_LT_SET_OPTIONS([$0], [$1])
+# AC_PROG_LIBTOOL
+# ---------------
+AC_DEFUN([AC_PROG_LIBTOOL],
+[AC_REQUIRE([_AC_PROG_LIBTOOL])dnl
+dnl If AC_PROG_CXX has already been expanded, run AC_LIBTOOL_CXX
+dnl immediately, otherwise, hook it in at the end of AC_PROG_CXX.
+ AC_PROVIDE_IFELSE([AC_PROG_CXX],
+ [AC_LIBTOOL_CXX],
+ [define([AC_PROG_CXX], defn([AC_PROG_CXX])[AC_LIBTOOL_CXX
+ ])])
+dnl And a similar setup for Fortran 77 support
+ AC_PROVIDE_IFELSE([AC_PROG_F77],
+ [AC_LIBTOOL_F77],
+ [define([AC_PROG_F77], defn([AC_PROG_F77])[AC_LIBTOOL_F77
+])])
+
+dnl Quote A][M_PROG_GCJ so that aclocal doesn't bring it in needlessly.
+dnl If either AC_PROG_GCJ or A][M_PROG_GCJ have already been expanded, run
+dnl AC_LIBTOOL_GCJ immediately, otherwise, hook it in at the end of both.
+ AC_PROVIDE_IFELSE([AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],
+ [AC_LIBTOOL_GCJ],
+ [ifdef([AC_PROG_GCJ],
+ [define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([A][M_PROG_GCJ],
+ [define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[AC_LIBTOOL_GCJ])])
+ ifdef([LT_AC_PROG_GCJ],
+ [define([LT_AC_PROG_GCJ],
+ defn([LT_AC_PROG_GCJ])[AC_LIBTOOL_GCJ])])])])
+])])# AC_PROG_LIBTOOL
+
+
+# _AC_PROG_LIBTOOL
+# ----------------
+AC_DEFUN([_AC_PROG_LIBTOOL],
+[AC_REQUIRE([AC_LIBTOOL_SETUP])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_CXX])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_F77])dnl
+AC_BEFORE([$0],[AC_LIBTOOL_GCJ])dnl
# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
# Always use our own libtool.
LIBTOOL='$(SHELL) $(top_builddir)/libtool'
AC_SUBST(LIBTOOL)dnl
-_LT_SETUP
-
-# Only expand once:
-m4_define([LT_INIT])
-])# LT_INIT
+# Prevent multiple expansion
+define([AC_PROG_LIBTOOL], [])
+])# _AC_PROG_LIBTOOL
-# Old names:
-AU_ALIAS([AC_PROG_LIBTOOL], [LT_INIT])
-AU_ALIAS([AM_PROG_LIBTOOL], [LT_INIT])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PROG_LIBTOOL], [])
-dnl AC_DEFUN([AM_PROG_LIBTOOL], [])
-
-# _LT_CC_BASENAME(CC)
-# -------------------
-# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
-m4_defun([_LT_CC_BASENAME],
-[for cc_temp in $1""; 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-%%"`
-])
-
-
-# _LT_FILEUTILS_DEFAULTS
-# ----------------------
-# It is okay to use these file commands and assume they have been set
-# sensibly after `m4_require([_LT_FILEUTILS_DEFAULTS])'.
-m4_defun([_LT_FILEUTILS_DEFAULTS],
-[: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-])# _LT_FILEUTILS_DEFAULTS
-
-
-# _LT_SETUP
-# ---------
-m4_defun([_LT_SETUP],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+# AC_LIBTOOL_SETUP
+# ----------------
+AC_DEFUN([AC_LIBTOOL_SETUP],
+[AC_PREREQ(2.50)dnl
+AC_REQUIRE([AC_ENABLE_SHARED])dnl
+AC_REQUIRE([AC_ENABLE_STATIC])dnl
+AC_REQUIRE([AC_ENABLE_FAST_INSTALL])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_REQUIRE([_LT_PREPARE_SED_QUOTE_VARS])dnl
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])dnl
-
-_LT_DECL([], [PATH_SEPARATOR], [1], [The PATH separator for the build system])dnl
-dnl
-_LT_DECL([], [host_alias], [0], [The host system])dnl
-_LT_DECL([], [host], [0])dnl
-_LT_DECL([], [host_os], [0])dnl
-dnl
-_LT_DECL([], [build_alias], [0], [The build system])dnl
-_LT_DECL([], [build], [0])dnl
-_LT_DECL([], [build_os], [0])dnl
-dnl
AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-dnl
+AC_REQUIRE([AC_PROG_LD])dnl
+AC_REQUIRE([AC_PROG_LD_RELOAD_FLAG])dnl
+AC_REQUIRE([AC_PROG_NM])dnl
+
AC_REQUIRE([AC_PROG_LN_S])dnl
-test -z "$LN_S" && LN_S="ln -s"
-_LT_DECL([], [LN_S], [1], [Whether we need soft or hard links])dnl
+AC_REQUIRE([AC_DEPLIBS_CHECK_METHOD])dnl
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+AC_REQUIRE([AC_OBJEXT])dnl
+AC_REQUIRE([AC_EXEEXT])dnl
dnl
-AC_REQUIRE([LT_CMD_MAX_LEN])dnl
-_LT_DECL([objext], [ac_objext], [0], [Object file suffix (normally "o")])dnl
-_LT_DECL([], [exeext], [0], [Executable file suffix (normally "")])dnl
-dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
-m4_require([_LT_PATH_CONVERSION_FUNCTIONS])dnl
-m4_require([_LT_CMD_RELOAD])dnl
-m4_require([_LT_CHECK_MAGIC_METHOD])dnl
-m4_require([_LT_CHECK_SHAREDLIB_FROM_LINKLIB])dnl
-m4_require([_LT_CMD_OLD_ARCHIVE])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_WITH_SYSROOT])dnl
-
-_LT_CONFIG_LIBTOOL_INIT([
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
-fi
-])
-if test -n "${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
-fi
-_LT_CHECK_OBJDIR
+AC_LIBTOOL_SYS_MAX_CMD_LEN
+AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+AC_LIBTOOL_OBJDIR
-m4_require([_LT_TAG_COMPILER])dnl
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+_LT_AC_PROG_ECHO_BACKSLASH
case $host_os in
aix3*)
@@ -227,706 +121,116 @@ aix3*)
;;
esac
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+[sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g']
+
+# Same as above, but do not quote variable references.
+[double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g']
+
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
+
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
+
+# Constants:
+rm="rm -f"
+
# Global variables:
-ofile=libtool
+default_ofile=libtool
can_build_shared=yes
# All known linkers require a `.a' archive for static linking (except MSVC,
# which needs '.lib').
libext=a
-
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
with_gnu_ld="$lt_cv_prog_gnu_ld"
+AC_CHECK_TOOL(AR, ar, false)
+AC_CHECK_TOOL(RANLIB, ranlib, :)
+AC_CHECK_TOOL(STRIP, strip, :)
+
old_CC="$CC"
old_CFLAGS="$CFLAGS"
# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
test -z "$CC" && CC=cc
test -z "$LTCC" && LTCC=$CC
test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
test -z "$ac_objext" && ac_objext=o
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
_LT_CC_BASENAME([$compiler])
# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- _LT_PATH_MAGIC
+ AC_PATH_MAGIC
fi
;;
esac
-# Use C for the default configuration in the libtool script
-LT_SUPPORTED_TAG([CC])
-_LT_LANG_C_CONFIG
-_LT_LANG_DEFAULT_CONFIG
-_LT_CONFIG_COMMANDS
-])# _LT_SETUP
-
-
-# _LT_PREPARE_SED_QUOTE_VARS
-# --------------------------
-# Define a few sed substitution that help us do robust quoting.
-m4_defun([_LT_PREPARE_SED_QUOTE_VARS],
-[# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\([["`$\\]]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\([["`\\]]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-])
-
-# _LT_PROG_LTMAIN
-# ---------------
-# Note that this code is called both from `configure', and `config.status'
-# now that we use AC_CONFIG_COMMANDS to generate libtool. Notably,
-# `config.status' has no value for ac_aux_dir unless we are using Automake,
-# so we pass a copy along to make sure it has a sensible value anyway.
-m4_defun([_LT_PROG_LTMAIN],
-[m4_ifdef([AC_REQUIRE_AUX_FILE], [AC_REQUIRE_AUX_FILE([ltmain.sh])])dnl
-_LT_CONFIG_LIBTOOL_INIT([ac_aux_dir='$ac_aux_dir'])
-ltmain="$ac_aux_dir/ltmain.sh"
-])# _LT_PROG_LTMAIN
-
-
-
-# So that we can recreate a full libtool script including additional
-# tags, we accumulate the chunks of code to send to AC_CONFIG_COMMANDS
-# in macros and then make a single call at the end using the `libtool'
-# label.
-
-
-# _LT_CONFIG_LIBTOOL_INIT([INIT-COMMANDS])
-# ----------------------------------------
-# Register INIT-COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL_INIT],
-[m4_ifval([$1],
- [m4_append([_LT_OUTPUT_LIBTOOL_INIT],
- [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_INIT])
-
-
-# _LT_CONFIG_LIBTOOL([COMMANDS])
-# ------------------------------
-# Register COMMANDS to be passed to AC_CONFIG_COMMANDS later.
-m4_define([_LT_CONFIG_LIBTOOL],
-[m4_ifval([$1],
- [m4_append([_LT_OUTPUT_LIBTOOL_COMMANDS],
- [$1
-])])])
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS])
-
-
-# _LT_CONFIG_SAVE_COMMANDS([COMMANDS], [INIT_COMMANDS])
-# -----------------------------------------------------
-m4_defun([_LT_CONFIG_SAVE_COMMANDS],
-[_LT_CONFIG_LIBTOOL([$1])
-_LT_CONFIG_LIBTOOL_INIT([$2])
-])
-
-
-# _LT_FORMAT_COMMENT([COMMENT])
-# -----------------------------
-# Add leading comment marks to the start of each line, and a trailing
-# full-stop to the whole comment if one is not present already.
-m4_define([_LT_FORMAT_COMMENT],
-[m4_ifval([$1], [
-m4_bpatsubst([m4_bpatsubst([$1], [^ *], [# ])],
- [['`$\]], [\\\&])]m4_bmatch([$1], [[!?.]$], [], [.])
-)])
-
-
-
-
-
-# _LT_DECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION], [IS-TAGGED?])
-# -------------------------------------------------------------------
-# CONFIGNAME is the name given to the value in the libtool script.
-# VARNAME is the (base) name used in the configure script.
-# VALUE may be 0, 1 or 2 for a computed quote escaped value based on
-# VARNAME. Any other value will be used directly.
-m4_define([_LT_DECL],
-[lt_if_append_uniq([lt_decl_varnames], [$2], [, ],
- [lt_dict_add_subkey([lt_decl_dict], [$2], [libtool_name],
- [m4_ifval([$1], [$1], [$2])])
- lt_dict_add_subkey([lt_decl_dict], [$2], [value], [$3])
- m4_ifval([$4],
- [lt_dict_add_subkey([lt_decl_dict], [$2], [description], [$4])])
- lt_dict_add_subkey([lt_decl_dict], [$2],
- [tagged?], [m4_ifval([$5], [yes], [no])])])
-])
-
-
-# _LT_TAGDECL([CONFIGNAME], VARNAME, VALUE, [DESCRIPTION])
-# --------------------------------------------------------
-m4_define([_LT_TAGDECL], [_LT_DECL([$1], [$2], [$3], [$4], [yes])])
-
-
-# lt_decl_tag_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_tag_varnames],
-[_lt_decl_filter([tagged?], [yes], $@)])
-
-
-# _lt_decl_filter(SUBKEY, VALUE, [SEPARATOR], [VARNAME1..])
-# ---------------------------------------------------------
-m4_define([_lt_decl_filter],
-[m4_case([$#],
- [0], [m4_fatal([$0: too few arguments: $#])],
- [1], [m4_fatal([$0: too few arguments: $#: $1])],
- [2], [lt_dict_filter([lt_decl_dict], [$1], [$2], [], lt_decl_varnames)],
- [3], [lt_dict_filter([lt_decl_dict], [$1], [$2], [$3], lt_decl_varnames)],
- [lt_dict_filter([lt_decl_dict], $@)])[]dnl
-])
-
-
-# lt_decl_quote_varnames([SEPARATOR], [VARNAME1...])
-# --------------------------------------------------
-m4_define([lt_decl_quote_varnames],
-[_lt_decl_filter([value], [1], $@)])
-
-
-# lt_decl_dquote_varnames([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_dquote_varnames],
-[_lt_decl_filter([value], [2], $@)])
-
-
-# lt_decl_varnames_tagged([SEPARATOR], [VARNAME1...])
-# ---------------------------------------------------
-m4_define([lt_decl_varnames_tagged],
-[m4_assert([$# <= 2])dnl
-_$0(m4_quote(m4_default([$1], [[, ]])),
- m4_ifval([$2], [[$2]], [m4_dquote(lt_decl_tag_varnames)]),
- m4_split(m4_normalize(m4_quote(_LT_TAGS)), [ ]))])
-m4_define([_lt_decl_varnames_tagged],
-[m4_ifval([$3], [lt_combine([$1], [$2], [_], $3)])])
-
-
-# lt_decl_all_varnames([SEPARATOR], [VARNAME1...])
-# ------------------------------------------------
-m4_define([lt_decl_all_varnames],
-[_$0(m4_quote(m4_default([$1], [[, ]])),
- m4_if([$2], [],
- m4_quote(lt_decl_varnames),
- m4_quote(m4_shift($@))))[]dnl
-])
-m4_define([_lt_decl_all_varnames],
-[lt_join($@, lt_decl_varnames_tagged([$1],
- lt_decl_tag_varnames([[, ]], m4_shift($@))))dnl
-])
-
-
-# _LT_CONFIG_STATUS_DECLARE([VARNAME])
-# ------------------------------------
-# Quote a variable value, and forward it to `config.status' so that its
-# declaration there will have the same value as in `configure'. VARNAME
-# must have a single quote delimited value for this to work.
-m4_define([_LT_CONFIG_STATUS_DECLARE],
-[$1='`$ECHO "$][$1" | $SED "$delay_single_quote_subst"`'])
-
+AC_PROVIDE_IFELSE([AC_LIBTOOL_DLOPEN], enable_dlopen=yes, enable_dlopen=no)
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+enable_win32_dll=yes, enable_win32_dll=no)
-# _LT_CONFIG_STATUS_DECLARATIONS
-# ------------------------------
-# We delimit libtool config variables with single quotes, so when
-# we write them to config.status, we have to be sure to quote all
-# embedded single quotes properly. In configure, this macro expands
-# each variable declared with _LT_DECL (and _LT_TAGDECL) into:
-#
-# <var>='`$ECHO "$<var>" | $SED "$delay_single_quote_subst"`'
-m4_defun([_LT_CONFIG_STATUS_DECLARATIONS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_all_varnames),
- [m4_n([_LT_CONFIG_STATUS_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAGS
-# ----------------
-# Output comment and list of tags supported by the script
-m4_defun([_LT_LIBTOOL_TAGS],
-[_LT_FORMAT_COMMENT([The names of the tagged configurations supported by this script])dnl
-available_tags="_LT_TAGS"dnl
-])
-
-
-# _LT_LIBTOOL_DECLARE(VARNAME, [TAG])
-# -----------------------------------
-# Extract the dictionary values for VARNAME (optionally with TAG) and
-# expand to a commented shell variable setting:
-#
-# # Some comment about what VAR is for.
-# visible_name=$lt_internal_name
-m4_define([_LT_LIBTOOL_DECLARE],
-[_LT_FORMAT_COMMENT(m4_quote(lt_dict_fetch([lt_decl_dict], [$1],
- [description])))[]dnl
-m4_pushdef([_libtool_name],
- m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [libtool_name])))[]dnl
-m4_case(m4_quote(lt_dict_fetch([lt_decl_dict], [$1], [value])),
- [0], [_libtool_name=[$]$1],
- [1], [_libtool_name=$lt_[]$1],
- [2], [_libtool_name=$lt_[]$1],
- [_libtool_name=lt_dict_fetch([lt_decl_dict], [$1], [value])])[]dnl
-m4_ifval([$2], [_$2])[]m4_popdef([_libtool_name])[]dnl
-])
-
-
-# _LT_LIBTOOL_CONFIG_VARS
-# -----------------------
-# Produce commented declarations of non-tagged libtool config variables
-# suitable for insertion in the LIBTOOL CONFIG section of the `libtool'
-# script. Tagged libtool config variables (even for the LIBTOOL CONFIG
-# section) are produced by _LT_LIBTOOL_TAG_VARS.
-m4_defun([_LT_LIBTOOL_CONFIG_VARS],
-[m4_foreach([_lt_var],
- m4_quote(_lt_decl_filter([tagged?], [no], [], lt_decl_varnames)),
- [m4_n([_LT_LIBTOOL_DECLARE(_lt_var)])])])
-
-
-# _LT_LIBTOOL_TAG_VARS(TAG)
-# -------------------------
-m4_define([_LT_LIBTOOL_TAG_VARS],
-[m4_foreach([_lt_var], m4_quote(lt_decl_tag_varnames),
- [m4_n([_LT_LIBTOOL_DECLARE(_lt_var, [$1])])])])
+AC_ARG_ENABLE([libtool-lock],
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+AC_ARG_WITH([pic],
+ [AC_HELP_STRING([--with-pic],
+ [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
+ [pic_mode="$withval"],
+ [pic_mode=default])
+test -z "$pic_mode" && pic_mode=default
-# _LT_TAGVAR(VARNAME, [TAGNAME])
-# ------------------------------
-m4_define([_LT_TAGVAR], [m4_ifval([$2], [$1_$2], [$1])])
+# Use C for the default configuration in the libtool script
+tagname=
+AC_LIBTOOL_LANG_C_CONFIG
+_LT_AC_TAGCONFIG
+])# AC_LIBTOOL_SETUP
-# _LT_CONFIG_COMMANDS
+# _LT_AC_SYS_COMPILER
# -------------------
-# Send accumulated output to $CONFIG_STATUS. Thanks to the lists of
-# variables for single and double quote escaping we saved from calls
-# to _LT_DECL, we can put quote escaped variables declarations
-# into `config.status', and then the shell code to quote escape them in
-# for loops in `config.status'. Finally, any additional code accumulated
-# from calls to _LT_CONFIG_LIBTOOL_INIT is expanded.
-m4_defun([_LT_CONFIG_COMMANDS],
-[AC_PROVIDE_IFELSE([LT_OUTPUT],
- dnl If the libtool generation code has been placed in $CONFIG_LT,
- dnl instead of duplicating it all over again into config.status,
- dnl then we will have config.status run $CONFIG_LT later, so it
- dnl needs to know what name is stored there:
- [AC_CONFIG_COMMANDS([libtool],
- [$SHELL $CONFIG_LT || AS_EXIT(1)], [CONFIG_LT='$CONFIG_LT'])],
- dnl If the libtool generation code is destined for config.status,
- dnl expand the accumulated commands and init code now:
- [AC_CONFIG_COMMANDS([libtool],
- [_LT_OUTPUT_LIBTOOL_COMMANDS], [_LT_OUTPUT_LIBTOOL_COMMANDS_INIT])])
-])#_LT_CONFIG_COMMANDS
-
-
-# Initialize.
-m4_define([_LT_OUTPUT_LIBTOOL_COMMANDS_INIT],
-[
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-sed_quote_subst='$sed_quote_subst'
-double_quote_subst='$double_quote_subst'
-delay_variable_subst='$delay_variable_subst'
-_LT_CONFIG_STATUS_DECLARATIONS
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
- eval 'cat <<_LTECHO_EOF
-\$[]1
-_LTECHO_EOF'
-}
-
-# Quote evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_quote_varnames); do
- case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
- *[[\\\\\\\`\\"\\\$]]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
- ;;
- *)
- eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
- ;;
- esac
-done
-
-# Double-quote double-evaled strings.
-for var in lt_decl_all_varnames([[ \
-]], lt_decl_dquote_varnames); do
- case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
- *[[\\\\\\\`\\"\\\$]]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED -e \\"\\\$double_quote_subst\\" -e \\"\\\$sed_quote_subst\\" -e \\"\\\$delay_variable_subst\\"\\\`\\\\\\""
- ;;
- *)
- eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
- ;;
- esac
-done
-
-_LT_OUTPUT_LIBTOOL_INIT
-])
-
-# _LT_GENERATED_FILE_INIT(FILE, [COMMENT])
-# ------------------------------------
-# Generate a child script FILE with all initialization necessary to
-# reuse the environment learned by the parent script, and make the
-# file executable. If COMMENT is supplied, it is inserted after the
-# `#!' sequence but before initialization text begins. After this
-# macro, additional text can be appended to FILE to form the body of
-# the child script. The macro ends with non-zero status if the
-# file could not be fully written (such as if the disk is full).
-m4_ifdef([AS_INIT_GENERATED],
-[m4_defun([_LT_GENERATED_FILE_INIT],[AS_INIT_GENERATED($@)])],
-[m4_defun([_LT_GENERATED_FILE_INIT],
-[m4_require([AS_PREPARE])]dnl
-[m4_pushdef([AS_MESSAGE_LOG_FD])]dnl
-[lt_write_fail=0
-cat >$1 <<_ASEOF || lt_write_fail=1
-#! $SHELL
-# Generated by $as_me.
-$2
-SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$1 <<\_ASEOF || lt_write_fail=1
-AS_SHELL_SANITIZE
-_AS_PREPARE
-exec AS_MESSAGE_FD>&1
-_ASEOF
-test $lt_write_fail = 0 && chmod +x $1[]dnl
-m4_popdef([AS_MESSAGE_LOG_FD])])])# _LT_GENERATED_FILE_INIT
-
-# LT_OUTPUT
-# ---------
-# This macro allows early generation of the libtool script (before
-# AC_OUTPUT is called), incase it is used in configure for compilation
-# tests.
-AC_DEFUN([LT_OUTPUT],
-[: ${CONFIG_LT=./config.lt}
-AC_MSG_NOTICE([creating $CONFIG_LT])
-_LT_GENERATED_FILE_INIT(["$CONFIG_LT"],
-[# Run this file to recreate a libtool stub with the current configuration.])
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-lt_cl_silent=false
-exec AS_MESSAGE_LOG_FD>>config.log
-{
- echo
- AS_BOX([Running $as_me.])
-} >&AS_MESSAGE_LOG_FD
-
-lt_cl_help="\
-\`$as_me' creates a local libtool stub from the current configuration,
-for use in further configure time tests before the real libtool is
-generated.
-
-Usage: $[0] [[OPTIONS]]
-
- -h, --help print this help, then exit
- -V, --version print version number, then exit
- -q, --quiet do not print progress messages
- -d, --debug don't remove temporary files
-
-Report bugs to <bug-libtool@gnu.org>."
-
-lt_cl_version="\
-m4_ifset([AC_PACKAGE_NAME], [AC_PACKAGE_NAME ])config.lt[]dnl
-m4_ifset([AC_PACKAGE_VERSION], [ AC_PACKAGE_VERSION])
-configured by $[0], generated by m4_PACKAGE_STRING.
-
-Copyright (C) 2011 Free Software Foundation, Inc.
-This config.lt script is free software; the Free Software Foundation
-gives unlimited permision to copy, distribute and modify it."
-
-while test $[#] != 0
-do
- case $[1] in
- --version | --v* | -V )
- echo "$lt_cl_version"; exit 0 ;;
- --help | --h* | -h )
- echo "$lt_cl_help"; exit 0 ;;
- --debug | --d* | -d )
- debug=: ;;
- --quiet | --q* | --silent | --s* | -q )
- lt_cl_silent=: ;;
-
- -*) AC_MSG_ERROR([unrecognized option: $[1]
-Try \`$[0] --help' for more information.]) ;;
-
- *) AC_MSG_ERROR([unrecognized argument: $[1]
-Try \`$[0] --help' for more information.]) ;;
- esac
- shift
-done
-
-if $lt_cl_silent; then
- exec AS_MESSAGE_FD>/dev/null
-fi
-_LTEOF
-
-cat >>"$CONFIG_LT" <<_LTEOF
-_LT_OUTPUT_LIBTOOL_COMMANDS_INIT
-_LTEOF
-
-cat >>"$CONFIG_LT" <<\_LTEOF
-AC_MSG_NOTICE([creating $ofile])
-_LT_OUTPUT_LIBTOOL_COMMANDS
-AS_EXIT(0)
-_LTEOF
-chmod +x "$CONFIG_LT"
-
-# configure is writing to config.log, but config.lt does its own redirection,
-# appending to config.log, which fails on DOS, as config.log is still kept
-# open by configure. Here we exec the FD to /dev/null, effectively closing
-# config.log, so it can be properly (re)opened and appended to by config.lt.
-lt_cl_success=:
-test "$silent" = yes &&
- lt_config_lt_args="$lt_config_lt_args --quiet"
-exec AS_MESSAGE_LOG_FD>/dev/null
-$SHELL "$CONFIG_LT" $lt_config_lt_args || lt_cl_success=false
-exec AS_MESSAGE_LOG_FD>>config.log
-$lt_cl_success || AS_EXIT(1)
-])# LT_OUTPUT
-
-
-# _LT_CONFIG(TAG)
-# ---------------
-# If TAG is the built-in tag, create an initial libtool script with a
-# default configuration from the untagged config vars. Otherwise add code
-# to config.status for appending the configuration named by TAG from the
-# matching tagged config vars.
-m4_defun([_LT_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_CONFIG_SAVE_COMMANDS([
- m4_define([_LT_TAG], m4_if([$1], [], [C], [$1]))dnl
- m4_if(_LT_TAG, [C], [
- # See if we are running on zsh, and set the options which allow our
- # commands through without removal of \ escapes.
- if test -n "${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
- fi
-
- cfgfile="${ofile}T"
- trap "$RM \"$cfgfile\"; exit 1" 1 2 15
- $RM "$cfgfile"
-
- cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-_LT_COPYING
-_LT_LIBTOOL_TAGS
-
-# ### BEGIN LIBTOOL CONFIG
-_LT_LIBTOOL_CONFIG_VARS
-_LT_LIBTOOL_TAG_VARS
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
- case $host_os in
- aix3*)
- cat <<\_LT_EOF >> "$cfgfile"
-# AIX sometimes has problems with the GCC collect2 program. For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
- COLLECT_NAMES=
- export COLLECT_NAMES
-fi
-_LT_EOF
- ;;
- esac
-
- _LT_PROG_LTMAIN
-
- # We use sed instead of cat because bash on DJGPP gets confused if
- # if finds mixed CR/LF and LF-only lines. Since sed operates in
- # text mode, it properly converts lines to CR/LF. This bash problem
- # is reportedly fixed, but why not run on old versions too?
- sed '$q' "$ltmain" >> "$cfgfile" \
- || (rm -f "$cfgfile"; exit 1)
-
- _LT_PROG_REPLACE_SHELLFNS
-
- mv -f "$cfgfile" "$ofile" ||
- (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
- chmod +x "$ofile"
-],
-[cat <<_LT_EOF >> "$ofile"
-
-dnl Unfortunately we have to use $1 here, since _LT_TAG is not expanded
-dnl in a comment (ie after a #).
-# ### BEGIN LIBTOOL TAG CONFIG: $1
-_LT_LIBTOOL_TAG_VARS(_LT_TAG)
-# ### END LIBTOOL TAG CONFIG: $1
-_LT_EOF
-])dnl /m4_if
-],
-[m4_if([$1], [], [
- PACKAGE='$PACKAGE'
- VERSION='$VERSION'
- TIMESTAMP='$TIMESTAMP'
- RM='$RM'
- ofile='$ofile'], [])
-])dnl /_LT_CONFIG_SAVE_COMMANDS
-])# _LT_CONFIG
-
-
-# LT_SUPPORTED_TAG(TAG)
-# ---------------------
-# Trace this macro to discover what tags are supported by the libtool
-# --tag option, using:
-# autoconf --trace 'LT_SUPPORTED_TAG:$1'
-AC_DEFUN([LT_SUPPORTED_TAG], [])
-
-
-# C support is built-in for now
-m4_define([_LT_LANG_C_enabled], [])
-m4_define([_LT_TAGS], [])
-
-
-# LT_LANG(LANG)
-# -------------
-# Enable libtool support for the given language if not already enabled.
-AC_DEFUN([LT_LANG],
-[AC_BEFORE([$0], [LT_OUTPUT])dnl
-m4_case([$1],
- [C], [_LT_LANG(C)],
- [C++], [_LT_LANG(CXX)],
- [Go], [_LT_LANG(GO)],
- [Java], [_LT_LANG(GCJ)],
- [Fortran 77], [_LT_LANG(F77)],
- [Fortran], [_LT_LANG(FC)],
- [Windows Resource], [_LT_LANG(RC)],
- [m4_ifdef([_LT_LANG_]$1[_CONFIG],
- [_LT_LANG($1)],
- [m4_fatal([$0: unsupported language: "$1"])])])dnl
-])# LT_LANG
-
-
-# _LT_LANG(LANGNAME)
-# ------------------
-m4_defun([_LT_LANG],
-[m4_ifdef([_LT_LANG_]$1[_enabled], [],
- [LT_SUPPORTED_TAG([$1])dnl
- m4_append([_LT_TAGS], [$1 ])dnl
- m4_define([_LT_LANG_]$1[_enabled], [])dnl
- _LT_LANG_$1_CONFIG($1)])dnl
-])# _LT_LANG
-
-
-m4_ifndef([AC_PROG_GO], [
-# NOTE: This macro has been submitted for inclusion into #
-# GNU Autoconf as AC_PROG_GO. When it is available in #
-# a released version of Autoconf we should remove this #
-# macro and use it instead. #
-m4_defun([AC_PROG_GO],
-[AC_LANG_PUSH(Go)dnl
-AC_ARG_VAR([GOC], [Go compiler command])dnl
-AC_ARG_VAR([GOFLAGS], [Go compiler flags])dnl
-_AC_ARG_VAR_LDFLAGS()dnl
-AC_CHECK_TOOL(GOC, gccgo)
-if test -z "$GOC"; then
- if test -n "$ac_tool_prefix"; then
- AC_CHECK_PROG(GOC, [${ac_tool_prefix}gccgo], [${ac_tool_prefix}gccgo])
- fi
-fi
-if test -z "$GOC"; then
- AC_CHECK_PROG(GOC, gccgo, gccgo, false)
-fi
-])#m4_defun
-])#m4_ifndef
-
-
-# _LT_LANG_DEFAULT_CONFIG
-# -----------------------
-m4_defun([_LT_LANG_DEFAULT_CONFIG],
-[AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [LT_LANG(CXX)],
- [m4_define([AC_PROG_CXX], defn([AC_PROG_CXX])[LT_LANG(CXX)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_F77],
- [LT_LANG(F77)],
- [m4_define([AC_PROG_F77], defn([AC_PROG_F77])[LT_LANG(F77)])])
-
-AC_PROVIDE_IFELSE([AC_PROG_FC],
- [LT_LANG(FC)],
- [m4_define([AC_PROG_FC], defn([AC_PROG_FC])[LT_LANG(FC)])])
-
-dnl The call to [A][M_PROG_GCJ] is quoted like that to stop aclocal
-dnl pulling things in needlessly.
-AC_PROVIDE_IFELSE([AC_PROG_GCJ],
- [LT_LANG(GCJ)],
- [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],
- [LT_LANG(GCJ)],
- [AC_PROVIDE_IFELSE([LT_PROG_GCJ],
- [LT_LANG(GCJ)],
- [m4_ifdef([AC_PROG_GCJ],
- [m4_define([AC_PROG_GCJ], defn([AC_PROG_GCJ])[LT_LANG(GCJ)])])
- m4_ifdef([A][M_PROG_GCJ],
- [m4_define([A][M_PROG_GCJ], defn([A][M_PROG_GCJ])[LT_LANG(GCJ)])])
- m4_ifdef([LT_PROG_GCJ],
- [m4_define([LT_PROG_GCJ], defn([LT_PROG_GCJ])[LT_LANG(GCJ)])])])])])
-
-AC_PROVIDE_IFELSE([AC_PROG_GO],
- [LT_LANG(GO)],
- [m4_define([AC_PROG_GO], defn([AC_PROG_GO])[LT_LANG(GO)])])
-
-AC_PROVIDE_IFELSE([LT_PROG_RC],
- [LT_LANG(RC)],
- [m4_define([LT_PROG_RC], defn([LT_PROG_RC])[LT_LANG(RC)])])
-])# _LT_LANG_DEFAULT_CONFIG
-
-# Obsolete macros:
-AU_DEFUN([AC_LIBTOOL_CXX], [LT_LANG(C++)])
-AU_DEFUN([AC_LIBTOOL_F77], [LT_LANG(Fortran 77)])
-AU_DEFUN([AC_LIBTOOL_FC], [LT_LANG(Fortran)])
-AU_DEFUN([AC_LIBTOOL_GCJ], [LT_LANG(Java)])
-AU_DEFUN([AC_LIBTOOL_RC], [LT_LANG(Windows Resource)])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_CXX], [])
-dnl AC_DEFUN([AC_LIBTOOL_F77], [])
-dnl AC_DEFUN([AC_LIBTOOL_FC], [])
-dnl AC_DEFUN([AC_LIBTOOL_GCJ], [])
-dnl AC_DEFUN([AC_LIBTOOL_RC], [])
-
-
-# _LT_TAG_COMPILER
-# ----------------
-m4_defun([_LT_TAG_COMPILER],
+AC_DEFUN([_LT_AC_SYS_COMPILER],
[AC_REQUIRE([AC_PROG_CC])dnl
-_LT_DECL([LTCC], [CC], [1], [A C compiler])dnl
-_LT_DECL([LTCFLAGS], [CFLAGS], [1], [LTCC compiler flags])dnl
-_LT_TAGDECL([CC], [compiler], [1], [A language specific compiler])dnl
-_LT_TAGDECL([with_gcc], [GCC], [0], [Is the compiler the GNU compiler?])dnl
-
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
@@ -935,20 +239,36 @@ LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
-])# _LT_TAG_COMPILER
+])# _LT_AC_SYS_COMPILER
+
+
+# _LT_CC_BASENAME(CC)
+# -------------------
+# Calculate cc_basename. Skip known compiler wrappers and cross-prefix.
+AC_DEFUN([_LT_CC_BASENAME],
+[for cc_temp in $1""; do
+ case $cc_temp in
+ compile | *[[\\/]]compile | ccache | *[[\\/]]ccache ) ;;
+ distcc | *[[\\/]]distcc | purify | *[[\\/]]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+])
# _LT_COMPILER_BOILERPLATE
# ------------------------
# Check for compiler boilerplate output or warnings with
# the simple compiler test code.
-m4_defun([_LT_COMPILER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
+AC_DEFUN([_LT_COMPILER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
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*
+$rm conftest*
])# _LT_COMPILER_BOILERPLATE
@@ -956,323 +276,216 @@ $RM conftest*
# ----------------------
# Check for linker boilerplate output or warnings with
# the simple link test code.
-m4_defun([_LT_LINKER_BOILERPLATE],
-[m4_require([_LT_DECL_SED])dnl
+AC_DEFUN([_LT_LINKER_BOILERPLATE],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
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*
+$rm conftest*
])# _LT_LINKER_BOILERPLATE
-# _LT_REQUIRED_DARWIN_CHECKS
-# -------------------------
-m4_defun_once([_LT_REQUIRED_DARWIN_CHECKS],[
- case $host_os in
- rhapsody* | darwin*)
- AC_CHECK_TOOL([DSYMUTIL], [dsymutil], [:])
- AC_CHECK_TOOL([NMEDIT], [nmedit], [:])
- AC_CHECK_TOOL([LIPO], [lipo], [:])
- AC_CHECK_TOOL([OTOOL], [otool], [:])
- AC_CHECK_TOOL([OTOOL64], [otool64], [:])
- _LT_DECL([], [DSYMUTIL], [1],
- [Tool to manipulate archived DWARF debug symbol files on Mac OS X])
- _LT_DECL([], [NMEDIT], [1],
- [Tool to change global to local symbols on Mac OS X])
- _LT_DECL([], [LIPO], [1],
- [Tool to manipulate fat objects and archives on Mac OS X])
- _LT_DECL([], [OTOOL], [1],
- [ldd/readelf like tool for Mach-O binaries on Mac OS X])
- _LT_DECL([], [OTOOL64], [1],
- [ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4])
-
- AC_CACHE_CHECK([for -single_module linker flag],[lt_cv_apple_cc_single_mod],
- [lt_cv_apple_cc_single_mod=no
- if test -z "${LT_MULTI_MODULE}"; then
- # By default we will add the -single_module flag. You can override
- # by either setting the environment variable LT_MULTI_MODULE
- # non-empty at configure time, or by adding -multi_module to the
- # link flags.
- rm -rf libconftest.dylib*
- echo "int foo(void){return 1;}" > conftest.c
- echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&AS_MESSAGE_LOG_FD
- $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
- -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
- _lt_result=$?
- # If there is a non-empty error log, and "single_module"
- # appears in it, assume the flag caused a linker warning
- if test -s conftest.err && $GREP single_module conftest.err; then
- cat conftest.err >&AS_MESSAGE_LOG_FD
- # Otherwise, if the output was created with a 0 exit code from
- # the compiler, it worked.
- elif test -f libconftest.dylib && test $_lt_result -eq 0; then
- lt_cv_apple_cc_single_mod=yes
- else
- cat conftest.err >&AS_MESSAGE_LOG_FD
- fi
- rm -rf libconftest.dylib*
- rm -f conftest.*
- fi])
-
- AC_CACHE_CHECK([for -exported_symbols_list linker flag],
- [lt_cv_ld_exported_symbols_list],
- [lt_cv_ld_exported_symbols_list=no
- save_LDFLAGS=$LDFLAGS
- echo "_main" > conftest.sym
- LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
- AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
- [lt_cv_ld_exported_symbols_list=yes],
- [lt_cv_ld_exported_symbols_list=no])
- LDFLAGS="$save_LDFLAGS"
- ])
-
- AC_CACHE_CHECK([for -force_load linker flag],[lt_cv_ld_force_load],
- [lt_cv_ld_force_load=no
- cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
- echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&AS_MESSAGE_LOG_FD
- $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&AS_MESSAGE_LOG_FD
- echo "$AR cru libconftest.a conftest.o" >&AS_MESSAGE_LOG_FD
- $AR cru libconftest.a conftest.o 2>&AS_MESSAGE_LOG_FD
- echo "$RANLIB libconftest.a" >&AS_MESSAGE_LOG_FD
- $RANLIB libconftest.a 2>&AS_MESSAGE_LOG_FD
- cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
- echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&AS_MESSAGE_LOG_FD
- $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
- _lt_result=$?
- if test -s conftest.err && $GREP force_load conftest.err; then
- cat conftest.err >&AS_MESSAGE_LOG_FD
- elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
- lt_cv_ld_force_load=yes
- else
- cat conftest.err >&AS_MESSAGE_LOG_FD
- fi
- rm -f conftest.err libconftest.a conftest conftest.c
- rm -rf conftest.dSYM
- ])
- case $host_os in
- rhapsody* | darwin1.[[012]])
- _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
- darwin1.*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*) # darwin 5.x on
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[[91]]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[[012]]*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- esac
- ;;
- esac
- if test "$lt_cv_apple_cc_single_mod" = "yes"; then
- _lt_dar_single_mod='$single_module'
- fi
- if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
- _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
- else
- _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
- _lt_dsymutil='~$DSYMUTIL $lib || :'
- else
- _lt_dsymutil=
- fi
- ;;
- esac
-])
-
-# _LT_DARWIN_LINKER_FEATURES([TAG])
-# ---------------------------------
-# Checks for linker and compiler features on darwin
-m4_defun([_LT_DARWIN_LINKER_FEATURES],
-[
- m4_require([_LT_REQUIRED_DARWIN_CHECKS])
- _LT_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_TAGVAR(hardcode_direct, $1)=no
- _LT_TAGVAR(hardcode_automatic, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- if test "$lt_cv_ld_force_load" = "yes"; then
- _LT_TAGVAR(whole_archive_flag_spec, $1)='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
- m4_case([$1], [F77], [_LT_TAGVAR(compiler_needs_object, $1)=yes],
- [FC], [_LT_TAGVAR(compiler_needs_object, $1)=yes])
- else
- _LT_TAGVAR(whole_archive_flag_spec, $1)=''
- fi
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- _LT_TAGVAR(allow_undefined_flag, $1)="$_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
- _LT_TAGVAR(archive_cmds, $1)="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
- _LT_TAGVAR(module_cmds, $1)="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="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}"
- _LT_TAGVAR(module_expsym_cmds, $1)="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}"
- m4_if([$1], [CXX],
-[ if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- _LT_TAGVAR(archive_cmds, $1)="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
- _LT_TAGVAR(archive_expsym_cmds, $1)="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
- fi
-],[])
- else
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
-])
-
-# _LT_SYS_MODULE_PATH_AIX([TAGNAME])
-# ----------------------------------
+# _LT_AC_SYS_LIBPATH_AIX
+# ----------------------
# Links a minimal program and checks the executable
# for the system default hardcoded library path. In most cases,
# this is /usr/lib:/lib, but when the MPI compilers are used
# the location of the communication and MPI libs are included too.
# If we don't find anything, use the default library path according
# to the aix ld manual.
-# Store the results from the different compilers for each TAGNAME.
-# Allow to override them for all tags through lt_cv_aix_libpath.
-m4_defun([_LT_SYS_MODULE_PATH_AIX],
-[m4_require([_LT_DECL_SED])dnl
-if test "${lt_cv_aix_libpath+set}" = set; then
- aix_libpath=$lt_cv_aix_libpath
-else
- AC_CACHE_VAL([_LT_TAGVAR([lt_cv_aix_libpath_], [$1])],
- [AC_LINK_IFELSE([AC_LANG_PROGRAM],[
- lt_aix_libpath_sed='[
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\([^ ]*\) *$/\1/
- p
- }
- }]'
- _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`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_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
- _LT_TAGVAR([lt_cv_aix_libpath_], [$1])=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
- fi],[])
- if test -z "$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])"; then
- _LT_TAGVAR([lt_cv_aix_libpath_], [$1])="/usr/lib:/lib"
- fi
- ])
- aix_libpath=$_LT_TAGVAR([lt_cv_aix_libpath_], [$1])
-fi
-])# _LT_SYS_MODULE_PATH_AIX
+AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_LINK_IFELSE(AC_LANG_PROGRAM,[
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi],[])
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+])# _LT_AC_SYS_LIBPATH_AIX
-# _LT_SHELL_INIT(ARG)
-# -------------------
-m4_define([_LT_SHELL_INIT],
-[m4_divert_text([M4SH-INIT], [$1
-])])# _LT_SHELL_INIT
+# _LT_AC_SHELL_INIT(ARG)
+# ----------------------
+AC_DEFUN([_LT_AC_SHELL_INIT],
+[ifdef([AC_DIVERSION_NOTICE],
+ [AC_DIVERT_PUSH(AC_DIVERSION_NOTICE)],
+ [AC_DIVERT_PUSH(NOTICE)])
+$1
+AC_DIVERT_POP
+])# _LT_AC_SHELL_INIT
+# _LT_AC_PROG_ECHO_BACKSLASH
+# --------------------------
+# Add some code to the start of the generated configure script which
+# will find an echo command which doesn't interpret backslashes.
+AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH],
+[_LT_AC_SHELL_INIT([
+# Check that we are running under the correct shell.
+SHELL=${CONFIG_SHELL-/bin/sh}
+
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\[$]\\[$]0,'[$]0','`
+ ;;
+esac
-# _LT_PROG_ECHO_BACKSLASH
-# -----------------------
-# Find how we can fake an echo command that does not interpret backslash.
-# In particular, with Autoconf 2.60 or later we add some code to the start
-# of the generated configure script which will find a shell with a builtin
-# printf (which we can use as an echo command).
-m4_defun([_LT_PROG_ECHO_BACKSLASH],
-[ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-AC_MSG_CHECKING([how to print strings])
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
- test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
- ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
- ECHO='printf %s\n'
+echo=${ECHO-echo}
+if test "X[$]1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X[$]1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
else
- # Use this function as a fallback that always works.
- func_fallback_echo ()
- {
- eval 'cat <<_LTECHO_EOF
-$[]1
-_LTECHO_EOF'
- }
- ECHO='func_fallback_echo'
+ # Restart under the correct shell.
+ exec $SHELL "[$]0" --no-reexec ${1+"[$]@"}
fi
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
- $ECHO "$*"
-}
+if test "X[$]1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+[$]*
+EOF
+ exit 0
+fi
-case "$ECHO" in
- printf*) AC_MSG_RESULT([printf]) ;;
- print*) AC_MSG_RESULT([print -r]) ;;
- *) AC_MSG_RESULT([cat]) ;;
-esac
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-m4_ifdef([_AS_DETECT_SUGGESTED],
-[_AS_DETECT_SUGGESTED([
- test -n "${ZSH_VERSION+set}${BASH_VERSION+set}" || (
- ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
- ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
- ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
- PATH=/empty FPATH=/empty; export PATH FPATH
- test "X`printf %s $ECHO`" = "X$ECHO" \
- || test "X`print -r -- $ECHO`" = "X$ECHO" )])])
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "[$]0"' 'sed 20q "[$]0"' 'sed 10q "[$]0"' 'sed 2q "[$]0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
-_LT_DECL([], [SHELL], [1], [Shell to use when invoking shell scripts])
-_LT_DECL([], [ECHO], [1], [An echo program that protects backslashes])
-])# _LT_PROG_ECHO_BACKSLASH
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
-# _LT_WITH_SYSROOT
-# ----------------
-AC_DEFUN([_LT_WITH_SYSROOT],
-[AC_MSG_CHECKING([for sysroot])
-AC_ARG_WITH([sysroot],
-[ --with-sysroot[=DIR] Search for dependent libraries within DIR
- (or the compiler's sysroot if not specified).],
-[], [with_sysroot=no])
-
-dnl lt_sysroot will always be passed unquoted. We quote it here
-dnl in case the user passed a directory name.
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
- if test "$GCC" = yes; then
- lt_sysroot=`$CC --print-sysroot 2>/dev/null`
- fi
- ;; #(
- /*)
- lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
- ;; #(
- no|'')
- ;; #(
- *)
- AC_MSG_RESULT([${with_sysroot}])
- AC_MSG_ERROR([The sysroot must be an absolute path.])
- ;;
-esac
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "[$]0" --no-reexec ${1+"[$]@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "[$]0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL [$]0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
- AC_MSG_RESULT([${lt_sysroot:-no}])
-_LT_DECL([], [lt_sysroot], [0], [The root where to search for ]dnl
-[dependent libraries, and in which our libraries should be installed.])])
+ for cmd in 'echo test' 'sed 2q "[$]0"' 'sed 10q "[$]0"' 'sed 20q "[$]0"' 'sed 50q "[$]0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
-# _LT_ENABLE_LOCK
-# ---------------
-m4_defun([_LT_ENABLE_LOCK],
+ if test "$prev" != 'sed 50q "[$]0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "[$]0" ${1+"[$]@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL [$]0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\[$]0 --fallback-echo"
+fi
+
+AC_SUBST(ECHO)
+])])# _LT_AC_PROG_ECHO_BACKSLASH
+
+
+# _LT_AC_LOCK
+# -----------
+AC_DEFUN([_LT_AC_LOCK],
[AC_ARG_ENABLE([libtool-lock],
- [AS_HELP_STRING([--disable-libtool-lock],
- [avoid locking (might break parallel builds)])])
+ [AC_HELP_STRING([--disable-libtool-lock],
+ [avoid locking (might break parallel builds)])])
test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
# Some flags need to be propagated to the compiler or linker for good
@@ -1283,93 +496,93 @@ ia64-*-hpux*)
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.$ac_objext` in
- *ELF-32*)
- HPUX_IA64_MODE="32"
- ;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
- ;;
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
esac
fi
rm -rf conftest*
;;
*-*-irix6*)
# Find out which ABI we are using.
- echo '[#]line '$LINENO' "configure"' > conftest.$ac_ext
+ echo '[#]line __oline__ "configure"' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
- if test "$lt_cv_prog_gnu_ld" = yes; then
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -melf32bsmip"
- ;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
- ;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
- ;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
fi
rm -rf conftest*
;;
x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
+s390*-*linux*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
- *32-bit*)
- case $host in
- x86_64-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_i386_fbsd"
- ;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
- ;;
- ppc64-*linux*|powerpc64-*linux*)
- LD="${LD-ld} -m elf32ppclinux"
- ;;
- s390x-*linux*)
- LD="${LD-ld} -m elf_s390"
- ;;
- sparc64-*linux*)
- LD="${LD-ld} -m elf32_sparc"
- ;;
- esac
- ;;
- *64-bit*)
- case $host in
- x86_64-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_x86_64_fbsd"
- ;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- ppc*-*linux*|powerpc*-*linux*)
- LD="${LD-ld} -m elf64ppc"
- ;;
- s390*-*linux*|s390*-*tpf*)
- LD="${LD-ld} -m elf64_s390"
- ;;
- sparc*-*linux*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- ;;
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
esac
fi
rm -rf conftest*
@@ -1381,144 +594,52 @@ s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
CFLAGS="$CFLAGS -belf"
AC_CACHE_CHECK([whether the C compiler needs -belf], lt_cv_cc_needs_belf,
[AC_LANG_PUSH(C)
- AC_LINK_IFELSE([AC_LANG_PROGRAM([[]],[[]])],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
+ AC_TRY_LINK([],[],[lt_cv_cc_needs_belf=yes],[lt_cv_cc_needs_belf=no])
AC_LANG_POP])
if test x"$lt_cv_cc_needs_belf" != x"yes"; then
# this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
CFLAGS="$SAVE_CFLAGS"
fi
;;
-*-*solaris*)
+sparc*-*solaris*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
if AC_TRY_EVAL(ac_compile); then
case `/usr/bin/file conftest.o` in
*64-bit*)
case $lt_cv_prog_gnu_ld in
- yes*)
- case $host in
- i?86-*-solaris*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- sparc*-*-solaris*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
- if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
- LD="${LD-ld}_sol2"
- fi
- ;;
- *)
- if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
- LD="${LD-ld} -64"
- fi
- ;;
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *) LD="${LD-ld} -64" ;;
esac
;;
esac
fi
rm -rf conftest*
;;
-esac
-
-need_locks="$enable_libtool_lock"
-])# _LT_ENABLE_LOCK
-
-# _LT_PROG_AR
-# -----------
-m4_defun([_LT_PROG_AR],
-[AC_CHECK_TOOLS(AR, [ar], false)
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-_LT_DECL([], [AR], [1], [The archiver])
-_LT_DECL([], [AR_FLAGS], [1], [Flags to create an archive])
-
-AC_CACHE_CHECK([for archiver @FILE support], [lt_cv_ar_at_file],
- [lt_cv_ar_at_file=no
- AC_COMPILE_IFELSE([AC_LANG_PROGRAM],
- [echo conftest.$ac_objext > conftest.lst
- lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&AS_MESSAGE_LOG_FD'
- AC_TRY_EVAL([lt_ar_try])
- if test "$ac_status" -eq 0; then
- # Ensure the archiver fails upon bogus file names.
- rm -f conftest.$ac_objext libconftest.a
- AC_TRY_EVAL([lt_ar_try])
- if test "$ac_status" -ne 0; then
- lt_cv_ar_at_file=@
- fi
- fi
- rm -f conftest.* libconftest.a
- ])
+AC_PROVIDE_IFELSE([AC_LIBTOOL_WIN32_DLL],
+[*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ AC_CHECK_TOOL(DLLTOOL, dlltool, false)
+ AC_CHECK_TOOL(AS, as, false)
+ AC_CHECK_TOOL(OBJDUMP, objdump, false)
+ ;;
])
+esac
-if test "x$lt_cv_ar_at_file" = xno; then
- archiver_list_spec=
-else
- archiver_list_spec=$lt_cv_ar_at_file
-fi
-_LT_DECL([], [archiver_list_spec], [1],
- [How to feed a file listing to the archiver])
-])# _LT_PROG_AR
-
-
-# _LT_CMD_OLD_ARCHIVE
-# -------------------
-m4_defun([_LT_CMD_OLD_ARCHIVE],
-[_LT_PROG_AR
-
-AC_CHECK_TOOL(STRIP, strip, :)
-test -z "$STRIP" && STRIP=:
-_LT_DECL([], [STRIP], [1], [A symbol stripping program])
-
-AC_CHECK_TOOL(RANLIB, ranlib, :)
-test -z "$RANLIB" && RANLIB=:
-_LT_DECL([], [RANLIB], [1],
- [Commands used to install an old-style archive])
-
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
- case $host_os in
- openbsd*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
- ;;
- *)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
- ;;
- esac
- old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
-fi
+need_locks="$enable_libtool_lock"
-case $host_os in
- darwin*)
- lock_old_archive_extraction=yes ;;
- *)
- lock_old_archive_extraction=no ;;
-esac
-_LT_DECL([], [old_postinstall_cmds], [2])
-_LT_DECL([], [old_postuninstall_cmds], [2])
-_LT_TAGDECL([], [old_archive_cmds], [2],
- [Commands used to build an old-style archive])
-_LT_DECL([], [lock_old_archive_extraction], [0],
- [Whether to use a lock for old archive extraction])
-])# _LT_CMD_OLD_ARCHIVE
+])# _LT_AC_LOCK
-# _LT_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# AC_LIBTOOL_COMPILER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
# [OUTPUT-FILE], [ACTION-SUCCESS], [ACTION-FAILURE])
# ----------------------------------------------------------------
# Check whether the given compiler option works
-AC_DEFUN([_LT_COMPILER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
+AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])
AC_CACHE_CHECK([$1], [$2],
[$2=no
- m4_if([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
+ ifelse([$4], , [ac_outfile=conftest.$ac_objext], [ac_outfile=$4])
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$3"
# Insert the option either (1) after the last *FLAGS variable, or
@@ -1530,43 +651,37 @@ AC_CACHE_CHECK([$1], [$2],
-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\"" >&AS_MESSAGE_LOG_FD)
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&AS_MESSAGE_LOG_FD
- echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
fi
fi
- $RM conftest*
+ $rm conftest*
])
if test x"[$]$2" = xyes; then
- m4_if([$5], , :, [$5])
+ ifelse([$5], , :, [$5])
else
- m4_if([$6], , :, [$6])
+ ifelse([$6], , :, [$6])
fi
-])# _LT_COMPILER_OPTION
+])# AC_LIBTOOL_COMPILER_OPTION
-# Old name:
-AU_ALIAS([AC_LIBTOOL_COMPILER_OPTION], [_LT_COMPILER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_COMPILER_OPTION], [])
-
-# _LT_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
-# [ACTION-SUCCESS], [ACTION-FAILURE])
-# ----------------------------------------------------
-# Check whether the given linker option works
-AC_DEFUN([_LT_LINKER_OPTION],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_SED])dnl
+# AC_LIBTOOL_LINKER_OPTION(MESSAGE, VARIABLE-NAME, FLAGS,
+# [ACTION-SUCCESS], [ACTION-FAILURE])
+# ------------------------------------------------------------
+# Check whether the given compiler option works
+AC_DEFUN([AC_LIBTOOL_LINKER_OPTION],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
AC_CACHE_CHECK([$1], [$2],
[$2=no
save_LDFLAGS="$LDFLAGS"
@@ -1578,7 +693,7 @@ AC_CACHE_CHECK([$1], [$2],
if test -s conftest.err; then
# Append any errors to the config.log.
cat conftest.err 1>&AS_MESSAGE_LOG_FD
- $ECHO "$_lt_linker_boilerplate" | $SED '/^$/d' > conftest.exp
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
$SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
if diff conftest.exp conftest.er2 >/dev/null; then
$2=yes
@@ -1587,28 +702,22 @@ AC_CACHE_CHECK([$1], [$2],
$2=yes
fi
fi
- $RM -r conftest*
+ $rm conftest*
LDFLAGS="$save_LDFLAGS"
])
if test x"[$]$2" = xyes; then
- m4_if([$4], , :, [$4])
+ ifelse([$4], , :, [$4])
else
- m4_if([$5], , :, [$5])
+ ifelse([$5], , :, [$5])
fi
-])# _LT_LINKER_OPTION
+])# AC_LIBTOOL_LINKER_OPTION
-# Old name:
-AU_ALIAS([AC_LIBTOOL_LINKER_OPTION], [_LT_LINKER_OPTION])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_LINKER_OPTION], [])
-
-# LT_CMD_MAX_LEN
-#---------------
-AC_DEFUN([LT_CMD_MAX_LEN],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-# find the maximum length of command line arguments
+# AC_LIBTOOL_SYS_MAX_CMD_LEN
+# --------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN],
+[# find the maximum length of command line arguments
AC_MSG_CHECKING([the maximum length of command line arguments])
AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
i=0
@@ -1630,7 +739,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=-1;
;;
- cygwin* | mingw* | cegcc*)
+ cygwin* | mingw*)
# On Win9x/ME, this test blows up -- it succeeds, but takes
# about 5 minutes as the teststring grows exponentially.
# Worse, since 9x/ME are not pre-emptively multitasking,
@@ -1641,11 +750,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=8192;
;;
- mint*)
- # On MiNT this can take a long time and run out of memory.
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
amigaos*)
# On AmigaOS with pdksh, this test takes hours, literally.
# So we just punt and use a minimum line length of 8192.
@@ -1671,11 +775,6 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=196608
;;
- os2*)
- # The test takes a long time on OS/2.
- lt_cv_sys_max_cmd_len=8192
- ;;
-
osf*)
# Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
# due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
@@ -1695,7 +794,7 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
sysv5* | sco5v6* | sysv4.2uw2*)
kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[[ ]]//'`
else
lt_cv_sys_max_cmd_len=32768
fi
@@ -1706,28 +805,20 @@ AC_CACHE_VAL([lt_cv_sys_max_cmd_len], [dnl
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
else
- # Make teststring a little bigger before we do anything with it.
- # a 1K string should be a reasonable start.
- for i in 1 2 3 4 5 6 7 8 ; do
- teststring=$teststring$teststring
- done
SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
- # If test is not a shell built-in, we'll probably end up computing a
- # maximum length that is only half of the actual maximum length, but
- # we can't tell.
- while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
- = "X$teststring$teststring"; } >/dev/null 2>&1 &&
+ while (test "X"`$SHELL [$]0 --fallback-echo "X$teststring" 2>/dev/null` \
+ = "XX$teststring") >/dev/null 2>&1 &&
+ new_result=`expr "X$teststring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
test $i != 17 # 1/2 MB should be enough
do
i=`expr $i + 1`
teststring=$teststring$teststring
done
- # Only check the string length outside the loop.
- lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
teststring=
- # Add a significant safety factor because C++ compilers can tack on
- # massive amounts of additional arguments before passing them to the
- # linker. It appears as though 1/2 is a usable value.
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
fi
;;
@@ -1738,36 +829,28 @@ if test -n $lt_cv_sys_max_cmd_len ; then
else
AC_MSG_RESULT(none)
fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
-_LT_DECL([], [max_cmd_len], [0],
- [What is the maximum length of a command?])
-])# LT_CMD_MAX_LEN
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_SYS_MAX_CMD_LEN], [LT_CMD_MAX_LEN])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_SYS_MAX_CMD_LEN], [])
+])# AC_LIBTOOL_SYS_MAX_CMD_LEN
-# _LT_HEADER_DLFCN
-# ----------------
-m4_defun([_LT_HEADER_DLFCN],
-[AC_CHECK_HEADERS([dlfcn.h], [], [], [AC_INCLUDES_DEFAULT])dnl
-])# _LT_HEADER_DLFCN
+# _LT_AC_CHECK_DLFCN
+# ------------------
+AC_DEFUN([_LT_AC_CHECK_DLFCN],
+[AC_CHECK_HEADERS(dlfcn.h)dnl
+])# _LT_AC_CHECK_DLFCN
-# _LT_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
-# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
-# ----------------------------------------------------------------
-m4_defun([_LT_TRY_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
+# _LT_AC_TRY_DLOPEN_SELF (ACTION-IF-TRUE, ACTION-IF-TRUE-W-USCORE,
+# ACTION-IF-FALSE, ACTION-IF-CROSS-COMPILING)
+# ---------------------------------------------------------------------
+AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
if test "$cross_compiling" = yes; then :
[$4]
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
-[#line $LINENO "configure"
+ cat > conftest.$ac_ext <<EOF
+[#line __oline__ "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -1808,13 +891,11 @@ else
# endif
#endif
-/* When -fvisbility=hidden is used, assume the code has been annotated
- correspondingly for the symbols needed. */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
+#ifdef __cplusplus
+extern "C" void exit (int);
#endif
-int fnord () { return 42; }
+void fnord() { int i=42;}
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -1823,19 +904,15 @@ int main ()
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
- else
- {
- if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
- else puts (dlerror ());
- }
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
/* dlclose (self); */
}
else
puts (dlerror ());
- return status;
+ exit (status);
}]
-_LT_EOF
+EOF
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&AS_MESSAGE_LOG_FD 2>/dev/null
lt_status=$?
@@ -1850,13 +927,13 @@ _LT_EOF
fi
fi
rm -fr conftest*
-])# _LT_TRY_DLOPEN_SELF
+])# _LT_AC_TRY_DLOPEN_SELF
-# LT_SYS_DLOPEN_SELF
-# ------------------
-AC_DEFUN([LT_SYS_DLOPEN_SELF],
-[m4_require([_LT_HEADER_DLFCN])dnl
+# AC_LIBTOOL_DLOPEN_SELF
+# ----------------------
+AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF],
+[AC_REQUIRE([_LT_AC_CHECK_DLFCN])dnl
if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
@@ -1872,15 +949,15 @@ else
lt_cv_dlopen_self=yes
;;
- mingw* | pw32* | cegcc*)
+ mingw* | pw32*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
- ;;
+ ;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
- ;;
+ ;;
darwin*)
# if libdl is installed we need to link against it
@@ -1890,13 +967,13 @@ else
lt_cv_dlopen_libs=
lt_cv_dlopen_self=yes
])
- ;;
+ ;;
*)
AC_CHECK_FUNC([shl_load],
[lt_cv_dlopen="shl_load"],
[AC_CHECK_LIB([dld], [shl_load],
- [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"],
+ [lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"],
[AC_CHECK_FUNC([dlopen],
[lt_cv_dlopen="dlopen"],
[AC_CHECK_LIB([dl], [dlopen],
@@ -1904,7 +981,7 @@ else
[AC_CHECK_LIB([svld], [dlopen],
[lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"],
[AC_CHECK_LIB([dld], [dld_link],
- [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"])
+ [lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"])
])
])
])
@@ -1932,7 +1009,7 @@ else
AC_CACHE_CHECK([whether a program can dlopen itself],
lt_cv_dlopen_self, [dnl
- _LT_TRY_DLOPEN_SELF(
+ _LT_AC_TRY_DLOPEN_SELF(
lt_cv_dlopen_self=yes, lt_cv_dlopen_self=yes,
lt_cv_dlopen_self=no, lt_cv_dlopen_self=cross)
])
@@ -1940,8 +1017,8 @@ else
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
AC_CACHE_CHECK([whether a statically linked program can dlopen itself],
- lt_cv_dlopen_self_static, [dnl
- _LT_TRY_DLOPEN_SELF(
+ lt_cv_dlopen_self_static, [dnl
+ _LT_AC_TRY_DLOPEN_SELF(
lt_cv_dlopen_self_static=yes, lt_cv_dlopen_self_static=yes,
lt_cv_dlopen_self_static=no, lt_cv_dlopen_self_static=cross)
])
@@ -1963,32 +1040,19 @@ else
*) enable_dlopen_self_static=unknown ;;
esac
fi
-_LT_DECL([dlopen_support], [enable_dlopen], [0],
- [Whether dlopen is supported])
-_LT_DECL([dlopen_self], [enable_dlopen_self], [0],
- [Whether dlopen of programs is supported])
-_LT_DECL([dlopen_self_static], [enable_dlopen_self_static], [0],
- [Whether dlopen of statically linked programs is supported])
-])# LT_SYS_DLOPEN_SELF
-
-# Old name:
-AU_ALIAS([AC_LIBTOOL_DLOPEN_SELF], [LT_SYS_DLOPEN_SELF])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN_SELF], [])
+])# AC_LIBTOOL_DLOPEN_SELF
-# _LT_COMPILER_C_O([TAGNAME])
-# ---------------------------
-# Check to see if options -c and -o are simultaneously supported by compiler.
-# This macro does not hard code the compiler like AC_PROG_CC_C_O.
-m4_defun([_LT_COMPILER_C_O],
-[m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
+# AC_LIBTOOL_PROG_CC_C_O([TAGNAME])
+# ---------------------------------
+# Check to see if options -c and -o are simultaneously supported by compiler
+AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
- [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
- [_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
- $RM -r conftest 2>/dev/null
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)],
+ [_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=no
+ $rm -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
@@ -2003,50 +1067,46 @@ AC_CACHE_CHECK([if $compiler supports -c -o file.$ac_objext],
-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\"" >&AS_MESSAGE_LOG_FD)
+ (eval echo "\"\$as_me:__oline__: $lt_compile\"" >&AS_MESSAGE_LOG_FD)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&AS_MESSAGE_LOG_FD
- echo "$as_me:$LINENO: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
+ echo "$as_me:__oline__: \$? = $ac_status" >&AS_MESSAGE_LOG_FD
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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
fi
fi
chmod u+w . 2>&AS_MESSAGE_LOG_FD
- $RM conftest*
+ $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
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
cd ..
- $RM -r conftest
- $RM conftest*
+ rmdir conftest
+ $rm conftest*
])
-_LT_TAGDECL([compiler_c_o], [lt_cv_prog_compiler_c_o], [1],
- [Does compiler simultaneously support -c and -o options?])
-])# _LT_COMPILER_C_O
+])# AC_LIBTOOL_PROG_CC_C_O
-# _LT_COMPILER_FILE_LOCKS([TAGNAME])
-# ----------------------------------
+# AC_LIBTOOL_SYS_HARD_LINK_LOCKS([TAGNAME])
+# -----------------------------------------
# Check to see if we can do hard links to lock some files if needed
-m4_defun([_LT_COMPILER_FILE_LOCKS],
-[m4_require([_LT_ENABLE_LOCK])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-_LT_COMPILER_C_O([$1])
+AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS],
+[AC_REQUIRE([_LT_AC_LOCK])dnl
hard_links="nottested"
-if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
+if test "$_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" != no; then
# do not overwrite the value of need_locks provided by the user
AC_MSG_CHECKING([if we can lock with hard links])
hard_links=yes
- $RM conftest*
+ $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
@@ -2059,13 +1119,12 @@ if test "$_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)" = no && test "$need_locks" !=
else
need_locks=no
fi
-_LT_DECL([], [need_locks], [1], [Must we lock files when doing compilation?])
-])# _LT_COMPILER_FILE_LOCKS
+])# AC_LIBTOOL_SYS_HARD_LINK_LOCKS
-# _LT_CHECK_OBJDIR
-# ----------------
-m4_defun([_LT_CHECK_OBJDIR],
+# AC_LIBTOOL_OBJDIR
+# -----------------
+AC_DEFUN([AC_LIBTOOL_OBJDIR],
[AC_CACHE_CHECK([for objdir], [lt_cv_objdir],
[rm -f .libs 2>/dev/null
mkdir .libs 2>/dev/null
@@ -2077,46 +1136,40 @@ else
fi
rmdir .libs 2>/dev/null])
objdir=$lt_cv_objdir
-_LT_DECL([], [objdir], [0],
- [The name of the directory that contains temporary libtool files])dnl
-m4_pattern_allow([LT_OBJDIR])dnl
-AC_DEFINE_UNQUOTED(LT_OBJDIR, "$lt_cv_objdir/",
- [Define to the sub-directory in which libtool stores uninstalled libraries.])
-])# _LT_CHECK_OBJDIR
+])# AC_LIBTOOL_OBJDIR
-# _LT_LINKER_HARDCODE_LIBPATH([TAGNAME])
-# --------------------------------------
+# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH([TAGNAME])
+# ----------------------------------------------
# Check hardcoding attributes.
-m4_defun([_LT_LINKER_HARDCODE_LIBPATH],
+AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH],
[AC_MSG_CHECKING([how to hardcode library paths into programs])
-_LT_TAGVAR(hardcode_action, $1)=
-if test -n "$_LT_TAGVAR(hardcode_libdir_flag_spec, $1)" ||
- test -n "$_LT_TAGVAR(runpath_var, $1)" ||
- test "X$_LT_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
+_LT_AC_TAGVAR(hardcode_action, $1)=
+if test -n "$_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)" || \
+ test -n "$_LT_AC_TAGVAR(runpath_var, $1)" || \
+ test "X$_LT_AC_TAGVAR(hardcode_automatic, $1)" = "Xyes" ; then
- # We can hardcode non-existent directories.
- if test "$_LT_TAGVAR(hardcode_direct, $1)" != no &&
+ # We can hardcode non-existant directories.
+ if test "$_LT_AC_TAGVAR(hardcode_direct, $1)" != 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, $1)" != no &&
- test "$_LT_TAGVAR(hardcode_minus_L, $1)" != no; then
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)" != no &&
+ test "$_LT_AC_TAGVAR(hardcode_minus_L, $1)" != no; then
# Linking always hardcodes the temporary library directory.
- _LT_TAGVAR(hardcode_action, $1)=relink
+ _LT_AC_TAGVAR(hardcode_action, $1)=relink
else
# We can link without hardcoding, and we can hardcode nonexisting dirs.
- _LT_TAGVAR(hardcode_action, $1)=immediate
+ _LT_AC_TAGVAR(hardcode_action, $1)=immediate
fi
else
# We cannot hardcode anything, or else we can only hardcode existing
# directories.
- _LT_TAGVAR(hardcode_action, $1)=unsupported
+ _LT_AC_TAGVAR(hardcode_action, $1)=unsupported
fi
-AC_MSG_RESULT([$_LT_TAGVAR(hardcode_action, $1)])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(hardcode_action, $1)])
-if test "$_LT_TAGVAR(hardcode_action, $1)" = relink ||
- test "$_LT_TAGVAR(inherit_rpath, $1)" = yes; then
+if test "$_LT_AC_TAGVAR(hardcode_action, $1)" = relink; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
@@ -2124,79 +1177,74 @@ elif test "$shlibpath_overrides_runpath" = yes ||
# Fast installation is not necessary
enable_fast_install=needless
fi
-_LT_TAGDECL([], [hardcode_action], [0],
- [How to hardcode a shared library path into an executable])
-])# _LT_LINKER_HARDCODE_LIBPATH
+])# AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH
-# _LT_CMD_STRIPLIB
-# ----------------
-m4_defun([_LT_CMD_STRIPLIB],
-[m4_require([_LT_DECL_EGREP])
-striplib=
+# AC_LIBTOOL_SYS_LIB_STRIP
+# ------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP],
+[striplib=
old_striplib=
AC_MSG_CHECKING([whether stripping libraries is possible])
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
test -z "$striplib" && striplib="$STRIP --strip-unneeded"
AC_MSG_RESULT([yes])
else
# FIXME - insert some real tests, host_os isn't really good enough
case $host_os in
- darwin*)
- if test -n "$STRIP" ; then
- striplib="$STRIP -x"
- old_striplib="$STRIP -S"
- AC_MSG_RESULT([yes])
- else
- AC_MSG_RESULT([no])
- fi
- ;;
- *)
- AC_MSG_RESULT([no])
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ AC_MSG_RESULT([yes])
+ else
+ AC_MSG_RESULT([no])
+fi
+ ;;
+ *)
+ AC_MSG_RESULT([no])
;;
esac
fi
-_LT_DECL([], [old_striplib], [1], [Commands to strip libraries])
-_LT_DECL([], [striplib], [1])
-])# _LT_CMD_STRIPLIB
+])# AC_LIBTOOL_SYS_LIB_STRIP
-# _LT_SYS_DYNAMIC_LINKER([TAG])
+# AC_LIBTOOL_SYS_DYNAMIC_LINKER
# -----------------------------
# PORTME Fill in your ld.so characteristics
-m4_defun([_LT_SYS_DYNAMIC_LINKER],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_OBJDUMP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CHECK_SHELL_FEATURES])dnl
+AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
AC_MSG_CHECKING([dynamic linker characteristics])
-m4_if([$1],
- [], [
+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"
+m4_if($1,[],[
if test "$GCC" = yes; then
case $host_os in
darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
*) lt_awk_arg="/^libraries:/" ;;
esac
- case $host_os in
- mingw* | cegcc*) lt_sed_strip_eq="s,=\([[A-Za-z]]:\),\1,g" ;;
- *) lt_sed_strip_eq="s,=/,/,g" ;;
- esac
- lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
- case $lt_search_path_spec in
- *\;*)
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
- ;;
- *)
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
- ;;
- esac
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
# Ok, now we have the path, separated by spaces, we can step through it
# and add multilib dir if necessary.
lt_tmp_lt_search_path_spec=
@@ -2209,7 +1257,7 @@ if test "$GCC" = yes; then
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
fi
done
- lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+ lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
BEGIN {RS=" "; FS="/|\n";} {
lt_foo="";
lt_count=0;
@@ -2229,29 +1277,10 @@ BEGIN {RS=" "; FS="/|\n";} {
if (lt_foo != "") { lt_freq[[lt_foo]]++; }
if (lt_freq[[lt_foo]] == 1) { print lt_foo; }
}'`
- # AWK program above erroneously prepends '/' to C:/dos/paths
- # for these hosts.
- case $host_os in
- mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
- $SED 's,/\([[A-Za-z]]:\),\1,g'` ;;
- esac
- sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+ sys_lib_search_path_spec=`echo $lt_search_path_spec`
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi])
-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
@@ -2261,7 +1290,7 @@ need_version=unknown
case $host_os in
aix3*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
@@ -2269,8 +1298,8 @@ aix3*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
-aix[[4-9]]*)
- version_type=linux # correct to gnu/linux during the next big refactor
+aix4* | aix5*)
+ version_type=linux
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
@@ -2288,7 +1317,7 @@ aix[[4-9]]*)
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
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
:
else
can_build_shared=no
@@ -2314,18 +1343,9 @@ aix[[4-9]]*)
;;
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
+ 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=`$echo "X$lib" | $Xsed -e '\''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'
;;
beos*)
@@ -2335,7 +1355,7 @@ beos*)
;;
bsdi[[45]]*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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'
@@ -2348,112 +1368,61 @@ bsdi[[45]]*)
# libtool to hard-code these into programs
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32*)
version_type=windows
shrext_cmds=".dll"
need_version=no
need_lib_prefix=no
- case $GCC,$cc_basename in
- yes,*)
- # gcc
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
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'\''`~
+ 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'
+ chmod a+x \$dldir/$dlname'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
- $RM \$dlpath'
+ $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}'
-m4_if([$1], [],[
- sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"])
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
;;
- mingw* | cegcc*)
+ mingw*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[[.]]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | [grep ';[c-zC-Z]:/' >/dev/null]; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ 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
;;
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
+ dynamic_linker='Win32 ld.exe'
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
@@ -2463,18 +1432,18 @@ darwin* | rhapsody*)
version_type=darwin
need_lib_prefix=no
need_version=no
- library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${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`'
-m4_if([$1], [],[
- sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
+ m4_if([$1], [],[
+ sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/local/lib"])
sys_lib_dlsearch_path_spec='/usr/local/lib /lib /usr/lib'
;;
dgux*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -2482,6 +1451,10 @@ dgux*)
shlibpath_var=LD_LIBRARY_PATH
;;
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
@@ -2489,7 +1462,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[[23]].*) objformat=aout ;;
+ freebsd[[123]]*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -2507,7 +1480,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2.*)
+ freebsd2*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[[01]]* | freebsdelf3.[[01]]*)
@@ -2527,26 +1500,12 @@ freebsd* | dragonfly*)
;;
gnu*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
;;
@@ -2572,18 +1531,18 @@ hpux9* | hpux10* | hpux11*)
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
- ;;
- *)
+ 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
@@ -2592,14 +1551,12 @@ hpux9* | hpux10* | hpux11*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
esac
- # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ # 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
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -2615,7 +1572,7 @@ irix5* | irix6* | nonstopux*)
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
+ version_type=linux
else
version_type=irix
fi ;;
@@ -2652,9 +1609,9 @@ 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
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2662,22 +1619,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
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
- AC_CACHE_VAL([lt_cv_shlibpath_overrides_runpath],
- [lt_cv_shlibpath_overrides_runpath=no
- save_LDFLAGS=$LDFLAGS
- save_libdir=$libdir
- eval "libdir=/foo; wl=\"$_LT_TAGVAR(lt_prog_compiler_wl, $1)\"; \
- LDFLAGS=\"\$LDFLAGS $_LT_TAGVAR(hardcode_libdir_flag_spec, $1)\""
- AC_LINK_IFELSE([AC_LANG_PROGRAM([],[])],
- [AS_IF([ ($OBJDUMP -p conftest$ac_exeext) 2>/dev/null | grep "RUNPATH.*$libdir" >/dev/null],
- [lt_cv_shlibpath_overrides_runpath=yes])])
- LDFLAGS=$save_LDFLAGS
- libdir=$save_libdir
- ])
- 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.
@@ -2685,7 +1626,7 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
# 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' ' '`
+ 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;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
@@ -2702,7 +1643,7 @@ netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ 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'
@@ -2717,22 +1658,20 @@ netbsd*)
;;
newsos6)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
+nto-qnx*)
+ version_type=linux
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'
+ shlibpath_overrides_runpath=yes
;;
openbsd*)
@@ -2741,13 +1680,13 @@ openbsd*)
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 ;;
+ 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
+ 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
@@ -2786,7 +1725,7 @@ rdos*)
;;
solaris*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -2811,7 +1750,7 @@ sunos4*)
;;
sysv4 | sysv4.3*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
@@ -2819,6 +1758,7 @@ sysv4 | sysv4.3*)
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
runpath_var=LD_RUN_PATH
;;
siemens)
@@ -2835,7 +1775,7 @@ sysv4 | sysv4.3*)
sysv4*MP*)
if test -d /usr/nec ;then
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
@@ -2849,12 +1789,13 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
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'
+ shlibpath_overrides_runpath=no
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
@@ -2864,19 +1805,8 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
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
+ version_type=linux
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
@@ -2893,56 +1823,277 @@ 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
+])# AC_LIBTOOL_SYS_DYNAMIC_LINKER
-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"
+
+# _LT_AC_TAGCONFIG
+# ----------------
+AC_DEFUN([_LT_AC_TAGCONFIG],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_ARG_WITH([tags],
+ [AC_HELP_STRING([--with-tags@<:@=TAGS@:>@],
+ [include additional configurations @<:@automatic@:>@])],
+ [tagnames="$withval"])
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ AC_MSG_WARN([output file `$ofile' does not exist])
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ AC_MSG_WARN([output file `$ofile' does not look like a libtool script])
+ else
+ AC_MSG_WARN([using `LTCC=$LTCC', extracted from `$ofile'])
+ fi
+ fi
+ if test -z "$LTCFLAGS"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]]::g'` in
+ "") ;;
+ *) AC_MSG_ERROR([invalid tag name: $tagname])
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ AC_MSG_ERROR([tag name \"$tagname\" already exists])
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_LIBTOOL_LANG_CXX_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+ AC_LIBTOOL_LANG_F77_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+ AC_LIBTOOL_LANG_GCJ_CONFIG
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+ AC_LIBTOOL_LANG_RC_CONFIG
+ ;;
+
+ *)
+ AC_MSG_ERROR([Unsupported tag name: $tagname])
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ AC_MSG_ERROR([unable to update list of available tagged configurations.])
+ fi
fi
+])# _LT_AC_TAGCONFIG
+
-_LT_DECL([], [variables_saved_for_relink], [1],
- [Variables whose values should be saved in libtool wrapper scripts and
- restored at link time])
-_LT_DECL([], [need_lib_prefix], [0],
- [Do we need the "lib" prefix for modules?])
-_LT_DECL([], [need_version], [0], [Do we need a version for libraries?])
-_LT_DECL([], [version_type], [0], [Library versioning type])
-_LT_DECL([], [runpath_var], [0], [Shared library runtime path variable])
-_LT_DECL([], [shlibpath_var], [0],[Shared library path variable])
-_LT_DECL([], [shlibpath_overrides_runpath], [0],
- [Is shlibpath searched before the hard-coded library search path?])
-_LT_DECL([], [libname_spec], [1], [Format of library name prefix])
-_LT_DECL([], [library_names_spec], [1],
- [[List of archive names. First name is the real one, the rest are links.
- The last name is the one that the linker finds with -lNAME]])
-_LT_DECL([], [soname_spec], [1],
- [[The coded name of the library, if different from the real name]])
-_LT_DECL([], [install_override_mode], [1],
- [Permission mode override for installation of shared libraries])
-_LT_DECL([], [postinstall_cmds], [2],
- [Command to use after installation of a shared archive])
-_LT_DECL([], [postuninstall_cmds], [2],
- [Command to use after uninstallation of a shared archive])
-_LT_DECL([], [finish_cmds], [2],
- [Commands used to finish a libtool library installation in a directory])
-_LT_DECL([], [finish_eval], [1],
- [[As "finish_cmds", except a single script fragment to be evaled but
- not shown]])
-_LT_DECL([], [hardcode_into_libs], [0],
- [Whether we should hardcode library paths into libraries])
-_LT_DECL([], [sys_lib_search_path_spec], [2],
- [Compile-time system search path for libraries])
-_LT_DECL([], [sys_lib_dlsearch_path_spec], [2],
- [Run-time system search path for libraries])
-])# _LT_SYS_DYNAMIC_LINKER
-
-
-# _LT_PATH_TOOL_PREFIX(TOOL)
+# AC_LIBTOOL_DLOPEN
+# -----------------
+# enable checks for dlopen support
+AC_DEFUN([AC_LIBTOOL_DLOPEN],
+ [AC_BEFORE([$0],[AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_DLOPEN
+
+
+# AC_LIBTOOL_WIN32_DLL
+# --------------------
+# declare package support for building win32 DLLs
+AC_DEFUN([AC_LIBTOOL_WIN32_DLL],
+[AC_BEFORE([$0], [AC_LIBTOOL_SETUP])
+])# AC_LIBTOOL_WIN32_DLL
+
+
+# AC_ENABLE_SHARED([DEFAULT])
+# ---------------------------
+# implement the --enable-shared flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_SHARED],
+[define([AC_ENABLE_SHARED_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([shared],
+ [AC_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
+ [build shared libraries @<:@default=]AC_ENABLE_SHARED_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_shared=]AC_ENABLE_SHARED_DEFAULT)
+])# AC_ENABLE_SHARED
+
+
+# AC_DISABLE_SHARED
+# -----------------
+# set the default shared flag to --disable-shared
+AC_DEFUN([AC_DISABLE_SHARED],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_SHARED(no)
+])# AC_DISABLE_SHARED
+
+
+# AC_ENABLE_STATIC([DEFAULT])
+# ---------------------------
+# implement the --enable-static flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_STATIC],
+[define([AC_ENABLE_STATIC_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([static],
+ [AC_HELP_STRING([--enable-static@<:@=PKGS@:>@],
+ [build static libraries @<:@default=]AC_ENABLE_STATIC_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_static=]AC_ENABLE_STATIC_DEFAULT)
+])# AC_ENABLE_STATIC
+
+
+# AC_DISABLE_STATIC
+# -----------------
+# set the default static flag to --disable-static
+AC_DEFUN([AC_DISABLE_STATIC],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_STATIC(no)
+])# AC_DISABLE_STATIC
+
+
+# AC_ENABLE_FAST_INSTALL([DEFAULT])
+# ---------------------------------
+# implement the --enable-fast-install flag
+# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
+AC_DEFUN([AC_ENABLE_FAST_INSTALL],
+[define([AC_ENABLE_FAST_INSTALL_DEFAULT], ifelse($1, no, no, yes))dnl
+AC_ARG_ENABLE([fast-install],
+ [AC_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
+ [optimize for fast installation @<:@default=]AC_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
+ [p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac],
+ [enable_fast_install=]AC_ENABLE_FAST_INSTALL_DEFAULT)
+])# AC_ENABLE_FAST_INSTALL
+
+
+# AC_DISABLE_FAST_INSTALL
+# -----------------------
+# set the default to --disable-fast-install
+AC_DEFUN([AC_DISABLE_FAST_INSTALL],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+AC_ENABLE_FAST_INSTALL(no)
+])# AC_DISABLE_FAST_INSTALL
+
+
+# AC_LIBTOOL_PICMODE([MODE])
# --------------------------
+# implement the --with-pic flag
+# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
+AC_DEFUN([AC_LIBTOOL_PICMODE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+pic_mode=ifelse($#,1,$1,default)
+])# AC_LIBTOOL_PICMODE
+
+
+# AC_PROG_EGREP
+# -------------
+# This is predefined starting with Autoconf 2.54, so this conditional
+# definition can be removed once we require Autoconf 2.54 or later.
+m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP],
+[AC_CACHE_CHECK([for egrep], [ac_cv_prog_egrep],
+ [if echo a | (grep -E '(a|b)') >/dev/null 2>&1
+ then ac_cv_prog_egrep='grep -E'
+ else ac_cv_prog_egrep='egrep'
+ fi])
+ EGREP=$ac_cv_prog_egrep
+ AC_SUBST([EGREP])
+])])
+
+
+# AC_PATH_TOOL_PREFIX
+# -------------------
# find a file program which can recognize shared library
-AC_DEFUN([_LT_PATH_TOOL_PREFIX],
-[m4_require([_LT_DECL_EGREP])dnl
+AC_DEFUN([AC_PATH_TOOL_PREFIX],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
AC_MSG_CHECKING([for $1])
AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
[case $MAGIC_CMD in
@@ -2955,7 +2106,7 @@ AC_CACHE_VAL(lt_cv_path_MAGIC_CMD,
dnl $ac_dummy forces splitting on constant user-supplied paths.
dnl POSIX.2 word splitting is done only on the output of word expansions,
dnl not every word. This closes a longstanding sh security hole.
- ac_dummy="m4_if([$2], , $PATH, [$2])"
+ ac_dummy="ifelse([$2], , $PATH, [$2])"
for ac_dir in $ac_dummy; do
IFS="$lt_save_ifs"
test -z "$ac_dir" && ac_dir=.
@@ -2970,7 +2121,7 @@ dnl not every word. This closes a longstanding sh security hole.
$EGREP "$file_magic_regex" > /dev/null; then
:
else
- cat <<_LT_EOF 1>&2
+ cat <<EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
@@ -2981,7 +2132,7 @@ dnl not every word. This closes a longstanding sh security hole.
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
-_LT_EOF
+EOF
fi ;;
esac
fi
@@ -2998,48 +2149,37 @@ if test -n "$MAGIC_CMD"; then
else
AC_MSG_RESULT(no)
fi
-_LT_DECL([], [MAGIC_CMD], [0],
- [Used to examine libraries when file_magic_cmd begins with "file"])dnl
-])# _LT_PATH_TOOL_PREFIX
+])# AC_PATH_TOOL_PREFIX
-# Old name:
-AU_ALIAS([AC_PATH_TOOL_PREFIX], [_LT_PATH_TOOL_PREFIX])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_PATH_TOOL_PREFIX], [])
-
-# _LT_PATH_MAGIC
-# --------------
+# AC_PATH_MAGIC
+# -------------
# find a file program which can recognize a shared library
-m4_defun([_LT_PATH_MAGIC],
-[_LT_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
+AC_DEFUN([AC_PATH_MAGIC],
+[AC_PATH_TOOL_PREFIX(${ac_tool_prefix}file, /usr/bin$PATH_SEPARATOR$PATH)
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
- _LT_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
+ AC_PATH_TOOL_PREFIX(file, /usr/bin$PATH_SEPARATOR$PATH)
else
MAGIC_CMD=:
fi
fi
-])# _LT_PATH_MAGIC
+])# AC_PATH_MAGIC
-# LT_PATH_LD
+# AC_PROG_LD
# ----------
# find the pathname to the GNU or non-GNU linker
-AC_DEFUN([LT_PATH_LD],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PROG_ECHO_BACKSLASH])dnl
-
-AC_ARG_WITH([gnu-ld],
- [AS_HELP_STRING([--with-gnu-ld],
+AC_DEFUN([AC_PROG_LD],
+[AC_ARG_WITH([gnu-ld],
+ [AC_HELP_STRING([--with-gnu-ld],
[assume the C compiler uses GNU ld @<:@default=no@:>@])],
[test "$withval" = no || with_gnu_ld=yes],
- [with_gnu_ld=no])dnl
-
+ [with_gnu_ld=no])
+AC_REQUIRE([LT_AC_PROG_SED])dnl
+AC_REQUIRE([AC_PROG_CC])dnl
+AC_REQUIRE([AC_CANONICAL_HOST])dnl
+AC_REQUIRE([AC_CANONICAL_BUILD])dnl
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
@@ -3056,9 +2196,9 @@ if test "$GCC" = yes; then
[[\\/]]* | ?:[[\\/]]*)
re_direlt='/[[^/]][[^/]]*/\.\./'
# Canonicalize the pathname of ld
- ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
- while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
@@ -3108,24 +2248,15 @@ else
AC_MSG_RESULT(no)
fi
test -z "$LD" && AC_MSG_ERROR([no acceptable ld found in \$PATH])
-_LT_PATH_LD_GNU
-AC_SUBST([LD])
-
-_LT_TAGDECL([], [LD], [1], [The linker used to build libraries])
-])# LT_PATH_LD
+AC_PROG_LD_GNU
+])# AC_PROG_LD
-# Old names:
-AU_ALIAS([AM_PROG_LD], [LT_PATH_LD])
-AU_ALIAS([AC_PROG_LD], [LT_PATH_LD])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_LD], [])
-dnl AC_DEFUN([AC_PROG_LD], [])
-
-# _LT_PATH_LD_GNU
-#- --------------
-m4_defun([_LT_PATH_LD_GNU],
-[AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
+# AC_PROG_LD_GNU
+# --------------
+AC_DEFUN([AC_PROG_LD_GNU],
+[AC_REQUIRE([AC_PROG_EGREP])dnl
+AC_CACHE_CHECK([if the linker ($LD) is GNU ld], lt_cv_prog_gnu_ld,
[# I'd rather use --version here, but apparently some GNU lds only accept -v.
case `$LD -v 2>&1 </dev/null` in
*GNU* | *'with BFD'*)
@@ -3136,14 +2267,14 @@ case `$LD -v 2>&1 </dev/null` in
;;
esac])
with_gnu_ld=$lt_cv_prog_gnu_ld
-])# _LT_PATH_LD_GNU
+])# AC_PROG_LD_GNU
-# _LT_CMD_RELOAD
-# --------------
+# AC_PROG_LD_RELOAD_FLAG
+# ----------------------
# find reload flag for linker
# -- PORTME Some linkers may need a different reload flag.
-m4_defun([_LT_CMD_RELOAD],
+AC_DEFUN([AC_PROG_LD_RELOAD_FLAG],
[AC_CACHE_CHECK([for $LD option to reload object files],
lt_cv_ld_reload_flag,
[lt_cv_ld_reload_flag='-r'])
@@ -3154,11 +2285,6 @@ case $reload_flag in
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
- if test "$GCC" != yes; then
- reload_cmds=false
- fi
- ;;
darwin*)
if test "$GCC" = yes; then
reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -3167,19 +2293,15 @@ case $host_os in
fi
;;
esac
-_LT_TAGDECL([], [reload_flag], [1], [How to create reloadable object files])dnl
-_LT_TAGDECL([], [reload_cmds], [2])dnl
-])# _LT_CMD_RELOAD
+])# AC_PROG_LD_RELOAD_FLAG
-# _LT_CHECK_MAGIC_METHOD
-# ----------------------
+# AC_DEPLIBS_CHECK_METHOD
+# -----------------------
# how to check for library dependencies
# -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_MAGIC_METHOD],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-AC_CACHE_CHECK([how to recognize dependent libraries],
+AC_DEFUN([AC_DEPLIBS_CHECK_METHOD],
+[AC_CACHE_CHECK([how to recognize dependent libraries],
lt_cv_deplibs_check_method,
[lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
@@ -3196,7 +2318,7 @@ lt_cv_deplibs_check_method='unknown'
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
-aix[[4-9]]*)
+aix4* | aix5*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -3220,29 +2342,21 @@ mingw* | pw32*)
# Base MSYS/MinGW do not provide the 'file' command needed by
# func_win32_libid shell function, so use a weaker test based on 'objdump',
# unless we find 'file', for example because we are cross-compiling.
- # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
- if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ if ( file / ) >/dev/null 2>&1; then
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
- # Keep this pattern in sync with the one in func_win32_libid.
- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
-cegcc*)
- # use the weaker test based on 'objdump'. See mingw*.
- lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- ;;
-
darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
freebsd* | dragonfly*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
@@ -3261,10 +2375,6 @@ gnu*)
lt_cv_deplibs_check_method=pass_all
;;
-haiku*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=/usr/bin/file
case $host_cpu in
@@ -3273,11 +2383,11 @@ hpux10.20* | hpux11*)
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
;;
hppa*64*)
- [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]']
+ [lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]']
lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
;;
*)
- lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]]\.[[0-9]]) shared library'
+ lt_cv_deplibs_check_method='file_magic (s[[0-9]][[0-9]][[0-9]]|PA-RISC[[0-9]].[[0-9]]) shared library'
lt_cv_file_magic_test_file=/usr/lib/libc.sl
;;
esac
@@ -3298,13 +2408,13 @@ irix5* | irix6* | nonstopux*)
lt_cv_deplibs_check_method=pass_all
;;
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
lt_cv_deplibs_check_method=pass_all
;;
netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so|_pic\.a)$'
@@ -3317,12 +2427,12 @@ newos6*)
lt_cv_file_magic_test_file=/usr/lib/libnls.so
;;
-*nto* | *qnx*)
- lt_cv_deplibs_check_method=pass_all
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
;;
openbsd*)
- if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|\.so|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[[^/]]+(\.so\.[[0-9]]+\.[[0-9]]+|_pic\.a)$'
@@ -3341,10 +2451,6 @@ solaris*)
lt_cv_deplibs_check_method=pass_all
;;
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
sysv4 | sysv4.3*)
case $host_vendor in
motorola)
@@ -3372,47 +2478,22 @@ sysv4 | sysv4.3*)
esac
;;
-tpf*)
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
esac
])
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
- case $host_os in
- mingw* | pw32*)
- if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
- want_nocaseglob=yes
- else
- file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[[\1]]\/[[\1]]\/g;/g"`
- fi
- ;;
- esac
-fi
-
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
-
-_LT_DECL([], [deplibs_check_method], [1],
- [Method to check whether dependent libraries are shared objects])
-_LT_DECL([], [file_magic_cmd], [1],
- [Command to use when deplibs_check_method = "file_magic"])
-_LT_DECL([], [file_magic_glob], [1],
- [How to find potential files when deplibs_check_method = "file_magic"])
-_LT_DECL([], [want_nocaseglob], [1],
- [Find potential files using nocaseglob when deplibs_check_method = "file_magic"])
-])# _LT_CHECK_MAGIC_METHOD
+])# AC_DEPLIBS_CHECK_METHOD
-# LT_PATH_NM
+# AC_PROG_NM
# ----------
-# find the pathname to a BSD- or MS-compatible name lister
-AC_DEFUN([LT_PATH_NM],
-[AC_REQUIRE([AC_PROG_CC])dnl
-AC_CACHE_CHECK([for BSD- or MS-compatible name lister (nm)], lt_cv_path_NM,
+# find the pathname to a BSD-compatible name lister
+AC_DEFUN([AC_PROG_NM],
+[AC_CACHE_CHECK([for BSD-compatible nm], lt_cv_path_NM,
[if test -n "$NM"; then
# Let the user override the test.
lt_cv_path_NM="$NM"
@@ -3454,184 +2535,2196 @@ else
done
IFS="$lt_save_ifs"
done
- : ${lt_cv_path_NM=no}
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
fi])
-if test "$lt_cv_path_NM" != "no"; then
- NM="$lt_cv_path_NM"
-else
- # Didn't find any BSD compatible name lister, look for dumpbin.
- if test -n "$DUMPBIN"; then :
- # Let the user override the test.
+NM="$lt_cv_path_NM"
+])# AC_PROG_NM
+
+
+# AC_CHECK_LIBM
+# -------------
+# check for math library
+AC_DEFUN([AC_CHECK_LIBM],
+[AC_REQUIRE([AC_CANONICAL_HOST])dnl
+LIBM=
+case $host in
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
+ # These system don't have libm, or don't need it
+ ;;
+*-ncr-sysv4.3*)
+ AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
+ AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+ ;;
+*)
+ AC_CHECK_LIB(m, cos, LIBM="-lm")
+ ;;
+esac
+])# AC_CHECK_LIBM
+
+
+# AC_LIBLTDL_CONVENIENCE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl convenience library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-convenience to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# it is assumed to be `libltdl'. LIBLTDL will be prefixed with
+# '${top_builddir}/' and LTDLINCL will be prefixed with '${top_srcdir}/'
+# (note the single quotes!). If your package is not flat and you're not
+# using automake, define top_builddir and top_srcdir appropriately in
+# the Makefiles.
+AC_DEFUN([AC_LIBLTDL_CONVENIENCE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ case $enable_ltdl_convenience in
+ no) AC_MSG_ERROR([this package needs a convenience libltdl]) ;;
+ "") enable_ltdl_convenience=yes
+ ac_configure_args="$ac_configure_args --enable-ltdl-convenience" ;;
+ esac
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdlc.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_CONVENIENCE
+
+
+# AC_LIBLTDL_INSTALLABLE([DIRECTORY])
+# -----------------------------------
+# sets LIBLTDL to the link flags for the libltdl installable library and
+# LTDLINCL to the include flags for the libltdl header and adds
+# --enable-ltdl-install to the configure arguments. Note that
+# AC_CONFIG_SUBDIRS is not called here. If DIRECTORY is not provided,
+# and an installed libltdl is not found, it is assumed to be `libltdl'.
+# LIBLTDL will be prefixed with '${top_builddir}/'# and LTDLINCL with
+# '${top_srcdir}/' (note the single quotes!). If your package is not
+# flat and you're not using automake, define top_builddir and top_srcdir
+# appropriately in the Makefiles.
+# In the future, this macro may have to be called after AC_PROG_LIBTOOL.
+AC_DEFUN([AC_LIBLTDL_INSTALLABLE],
+[AC_BEFORE([$0],[AC_LIBTOOL_SETUP])dnl
+ AC_CHECK_LIB(ltdl, lt_dlinit,
+ [test x"$enable_ltdl_install" != xyes && enable_ltdl_install=no],
+ [if test x"$enable_ltdl_install" = xno; then
+ AC_MSG_WARN([libltdl not installed, but installation disabled])
+ else
+ enable_ltdl_install=yes
+ fi
+ ])
+ if test x"$enable_ltdl_install" = x"yes"; then
+ ac_configure_args="$ac_configure_args --enable-ltdl-install"
+ LIBLTDL='${top_builddir}/'ifelse($#,1,[$1],['libltdl'])/libltdl.la
+ LTDLINCL='-I${top_srcdir}/'ifelse($#,1,[$1],['libltdl'])
else
- AC_CHECK_TOOLS(DUMPBIN, [dumpbin "link -dump"], :)
- case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
- *COFF*)
- DUMPBIN="$DUMPBIN -symbols"
- ;;
- *)
- DUMPBIN=:
- ;;
- esac
+ ac_configure_args="$ac_configure_args --enable-ltdl-install=no"
+ LIBLTDL="-lltdl"
+ LTDLINCL=
+ fi
+ # For backwards non-gettext consistent compatibility...
+ INCLTDL="$LTDLINCL"
+])# AC_LIBLTDL_INSTALLABLE
+
+
+# AC_LIBTOOL_CXX
+# --------------
+# enable support for C++ libraries
+AC_DEFUN([AC_LIBTOOL_CXX],
+[AC_REQUIRE([_LT_AC_LANG_CXX])
+])# AC_LIBTOOL_CXX
+
+
+# _LT_AC_LANG_CXX
+# ---------------
+AC_DEFUN([_LT_AC_LANG_CXX],
+[AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}CXX])
+])# _LT_AC_LANG_CXX
+
+# _LT_AC_PROG_CXXCPP
+# ------------------
+AC_DEFUN([_LT_AC_PROG_CXXCPP],
+[
+AC_REQUIRE([AC_PROG_CXX])
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ AC_PROG_CXXCPP
+fi
+])# _LT_AC_PROG_CXXCPP
+
+# AC_LIBTOOL_F77
+# --------------
+# enable support for Fortran 77 libraries
+AC_DEFUN([AC_LIBTOOL_F77],
+[AC_REQUIRE([_LT_AC_LANG_F77])
+])# AC_LIBTOOL_F77
+
+
+# _LT_AC_LANG_F77
+# ---------------
+AC_DEFUN([_LT_AC_LANG_F77],
+[AC_REQUIRE([AC_PROG_F77])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}F77])
+])# _LT_AC_LANG_F77
+
+
+# AC_LIBTOOL_GCJ
+# --------------
+# enable support for GCJ libraries
+AC_DEFUN([AC_LIBTOOL_GCJ],
+[AC_REQUIRE([_LT_AC_LANG_GCJ])
+])# AC_LIBTOOL_GCJ
+
+
+# _LT_AC_LANG_GCJ
+# ---------------
+AC_DEFUN([_LT_AC_LANG_GCJ],
+[AC_PROVIDE_IFELSE([AC_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([A][M_PROG_GCJ],[],
+ [AC_PROVIDE_IFELSE([LT_AC_PROG_GCJ],[],
+ [ifdef([AC_PROG_GCJ],[AC_REQUIRE([AC_PROG_GCJ])],
+ [ifdef([A][M_PROG_GCJ],[AC_REQUIRE([A][M_PROG_GCJ])],
+ [AC_REQUIRE([A][C_PROG_GCJ_OR_A][M_PROG_GCJ])])])])])])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}GCJ])
+])# _LT_AC_LANG_GCJ
+
+
+# AC_LIBTOOL_RC
+# -------------
+# enable support for Windows resource files
+AC_DEFUN([AC_LIBTOOL_RC],
+[AC_REQUIRE([LT_AC_PROG_RC])
+_LT_AC_SHELL_INIT([tagnames=${tagnames+${tagnames},}RC])
+])# AC_LIBTOOL_RC
+
+
+# AC_LIBTOOL_LANG_C_CONFIG
+# ------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG], [_LT_AC_LANG_C_CONFIG])
+AC_DEFUN([_LT_AC_LANG_C_CONFIG],
+[lt_save_CC="$CC"
+AC_LANG_PUSH(C)
+
+# Source file extension for C test sources.
+ac_ext=c
+
+# Object file extension for compiled C test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(){return(0);}'
+
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+AC_LIBTOOL_SYS_LIB_STRIP
+AC_LIBTOOL_DLOPEN_SELF
+
+# Report which library types will actually be built
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+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
- AC_SUBST([DUMPBIN])
- if test "$DUMPBIN" != ":"; then
- NM="$DUMPBIN"
+ ;;
+
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
fi
+ ;;
+esac
+AC_MSG_RESULT([$enable_shared])
+
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_C_CONFIG
+
+
+# AC_LIBTOOL_LANG_CXX_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG], [_LT_AC_LANG_CXX_CONFIG(CXX)])
+AC_DEFUN([_LT_AC_LANG_CXX_CONFIG],
+[AC_LANG_PUSH(C++)
+AC_REQUIRE([AC_PROG_CXX])
+AC_REQUIRE([_LT_AC_PROG_CXXCPP])
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+
+# Dependencies to place before and after the object being linked:
+_LT_AC_TAGVAR(predep_objects, $1)=
+_LT_AC_TAGVAR(postdep_objects, $1)=
+_LT_AC_TAGVAR(predeps, $1)=
+_LT_AC_TAGVAR(postdeps, $1)=
+_LT_AC_TAGVAR(compiler_lib_search_path, $1)=
+
+# Source file extension for C++ test sources.
+ac_ext=cpp
+
+# Object file extension for compiled C++ test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ $as_unset lt_cv_prog_gnu_ld
fi
-test -z "$NM" && NM=nm
-AC_SUBST([NM])
-_LT_DECL([], [NM], [1], [A BSD- or MS-compatible name lister])dnl
-
-AC_CACHE_CHECK([the name lister ($NM) interface], [lt_cv_nm_interface],
- [lt_cv_nm_interface="BSD nm"
- echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&AS_MESSAGE_LOG_FD)
- (eval "$ac_compile" 2>conftest.err)
- cat conftest.err >&AS_MESSAGE_LOG_FD
- (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&AS_MESSAGE_LOG_FD)
- (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
- cat conftest.err >&AS_MESSAGE_LOG_FD
- (eval echo "\"\$as_me:$LINENO: output\"" >&AS_MESSAGE_LOG_FD)
- cat conftest.out >&AS_MESSAGE_LOG_FD
- if $GREP 'External.*some_variable' conftest.out > /dev/null; then
- lt_cv_nm_interface="MS dumpbin"
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+else
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+fi
+
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
+
+ AC_PROG_LD
+
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
+
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
fi
- rm -f conftest*])
-])# LT_PATH_NM
-
-# Old names:
-AU_ALIAS([AM_PROG_NM], [LT_PATH_NM])
-AU_ALIAS([AC_PROG_NM], [LT_PATH_NM])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_PROG_NM], [])
-dnl AC_DEFUN([AC_PROG_NM], [])
-
-# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
-# --------------------------------
-# how to determine the name of the shared library
-# associated with a specific link library.
-# -- PORTME fill in with the dynamic library characteristics
-m4_defun([_LT_CHECK_SHAREDLIB_FROM_LINKLIB],
-[m4_require([_LT_DECL_EGREP])
-m4_require([_LT_DECL_OBJDUMP])
-m4_require([_LT_DECL_DLLTOOL])
-AC_CACHE_CHECK([how to associate runtime and link libraries],
-lt_cv_sharedlib_from_linklib_cmd,
-[lt_cv_sharedlib_from_linklib_cmd='unknown'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+
+# PORTME: fill in a description of your system's C++ link characteristics
+AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
+_LT_AC_TAGVAR(ld_shlibs, $1)=yes
case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
- # two different shell functions defined in ltmain.sh
- # decide which to use based on capabilities of $DLLTOOL
- case `$DLLTOOL --help 2>&1` in
- *--identify-strict*)
- lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
+ aix3*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aix4* | aix5*)
+ 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
+ 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]].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ 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.
+
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = 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
+ _LT_AC_TAGVAR(hardcode_direct, $1)=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
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ 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
+
+ # It seems that -bexpall does not export symbols beginning with
+ # underscore (_), so it is better to generate a list of symbols to export.
+ _LT_AC_TAGVAR(always_export_symbols, $1)=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.
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
+ if test "$host_cpu" = ia64; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$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.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${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.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$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
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ # as there is no search path for DLLs.
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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...
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ if test "$GXX" = yes ; then
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ fi
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
+ ;;
+
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ freebsd[[12]]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ freebsd-elf*)
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[[-]]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ case $host_cpu in
+ hppa*64*|ia64*) ;;
+ *)
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ ;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+ *)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
+
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ interix[[3-9]]*)
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${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.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='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'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
+ fi
+ fi
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ ;;
+ esac
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc*)
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
+ ;;
+ pgCC*)
+ # Portland Group C++ compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+
+ runpath_var=LD_RUN_PATH
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ else
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
+
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ _LT_AC_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs'
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ cxx*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ fi
+ ;;
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ _LT_AC_TAGVAR(archive_cmds_need_lc,$1)=yes
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -zdefs'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=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'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ ;;
+ esac
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+
+ # The C++ compiler must be used to create the archive.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
+
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
+ *)
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ 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.
+ # 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.
+ # So that behaviour is only enabled if SCOABSPATH is set to a
+ # non-empty value in the environment. Most likely only useful for
+ # creating official distributions of packages.
+ # This is a hack until libtool officially supports absolute path
+ # names for shared libraries.
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
*)
- lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
+ # FIXME: insert proper C++ library support
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+esac
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
+
+_LT_AC_TAGVAR(GCC, $1)="$GXX"
+_LT_AC_TAGVAR(LD, $1)="$LD"
+
+AC_LIBTOOL_POSTDEP_PREDEP($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_POP
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+])# AC_LIBTOOL_LANG_CXX_CONFIG
+
+# AC_LIBTOOL_POSTDEP_PREDEP([TAGNAME])
+# ------------------------------------
+# Figure out "hidden" library dependencies from verbose
+# compiler output when linking a shared library.
+# Parse the compiler output and extract the necessary
+# objects, libraries and library flags.
+AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP],[
+dnl we can't use the lt_simple_compile_test_code here,
+dnl because it contains code intended for an executable,
+dnl not a library. It's possible we should let each
+dnl tag define a new lt_????_link_test_code variable,
+dnl but it's only used here...
+ifelse([$1],[],[cat > conftest.$ac_ext <<EOF
+int a;
+void foo (void) { a = 0; }
+EOF
+],[$1],[CXX],[cat > conftest.$ac_ext <<EOF
+class Foo
+{
+public:
+ Foo (void) { a = 0; }
+private:
+ int a;
+};
+EOF
+],[$1],[F77],[cat > conftest.$ac_ext <<EOF
+ subroutine foo
+ implicit none
+ integer*4 a
+ a=0
+ return
+ end
+EOF
+],[$1],[GCJ],[cat > conftest.$ac_ext <<EOF
+public class foo {
+ private int a;
+ public void bar (void) {
+ a = 0;
+ }
+};
+EOF
+])
+dnl Parse the compiler output and extract the necessary
+dnl objects, libraries and library flags.
+if AC_TRY_EVAL(ac_compile); then
+ # Parse the compiler output and extract the necessary
+ # objects, libraries and library flags.
+
+ # Sentinel used to keep track of whether or not we are before
+ # the conftest object file.
+ pre_test_object_deps_done=no
+
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
+
+ -L* | -R* | -l*)
+ # Some compilers place space between "-{L,R}" and the path.
+ # Remove the space.
+ if test $p = "-L" \
+ || test $p = "-R"; then
+ prev=$p
+ continue
+ else
+ prev=
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ case $p in
+ -L* | -R*)
+ # Internal compiler library paths should come after those
+ # provided the user. The postdeps already come after the
+ # user supplied libs so there is no need to process them.
+ if test -z "$_LT_AC_TAGVAR(compiler_lib_search_path, $1)"; then
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1)="${_LT_AC_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
+ fi
+ ;;
+ # The "-l" case would never come before the object being
+ # linked, so don't bother handling this case.
+ esac
+ else
+ if test -z "$_LT_AC_TAGVAR(postdeps, $1)"; then
+ _LT_AC_TAGVAR(postdeps, $1)="${prev}${p}"
+ else
+ _LT_AC_TAGVAR(postdeps, $1)="${_LT_AC_TAGVAR(postdeps, $1)} ${prev}${p}"
+ fi
+ fi
+ ;;
+
+ *.$objext)
+ # This assumes that the test object file only shows up
+ # once in the compiler output.
+ if test "$p" = "conftest.$objext"; then
+ pre_test_object_deps_done=yes
+ continue
+ fi
+
+ if test "$pre_test_object_deps_done" = no; then
+ if test -z "$_LT_AC_TAGVAR(predep_objects, $1)"; then
+ _LT_AC_TAGVAR(predep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(predep_objects, $1)="$_LT_AC_TAGVAR(predep_objects, $1) $p"
+ fi
+ else
+ if test -z "$_LT_AC_TAGVAR(postdep_objects, $1)"; then
+ _LT_AC_TAGVAR(postdep_objects, $1)="$p"
+ else
+ _LT_AC_TAGVAR(postdep_objects, $1)="$_LT_AC_TAGVAR(postdep_objects, $1) $p"
+ fi
+ fi
+ ;;
+
+ *) ;; # Ignore the rest.
+
+ esac
+ done
+
+ # Clean up.
+ rm -f a.out a.exe
+else
+ echo "libtool.m4: error: problem compiling $1 test program"
+fi
+
+$rm -f confest.$objext
+
+# PORTME: override above test on systems where it is broken
+ifelse([$1],[CXX],
+[case $host_os in
+interix[[3-9]]*)
+ # Interix 3.5 installs completely hosed .la files for C++, so rather than
+ # hack all around it, let's just trust "g++" to DTRT.
+ _LT_AC_TAGVAR(predep_objects,$1)=
+ _LT_AC_TAGVAR(postdep_objects,$1)=
+ _LT_AC_TAGVAR(postdeps,$1)=
+ ;;
+
+linux*)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ #
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
;;
esac
;;
-*)
- # fallback: assume linklib IS sharedlib
- lt_cv_sharedlib_from_linklib_cmd="$ECHO"
+
+solaris*)
+ case $cc_basename in
+ CC*)
+ # The more standards-conforming stlport4 library is
+ # incompatible with the Cstd library. Avoid specifying
+ # it if it's in CXXFLAGS. Ignore libCrun as
+ # -library=stlport4 depends on it.
+ case " $CXX $CXXFLAGS " in
+ *" -library=stlport4 "*)
+ solaris_use_stlport4=yes
+ ;;
+ esac
+
+ # Adding this requires a known-good setup of shared libraries for
+ # Sun compiler versions before 5.6, else PIC objects from an old
+ # archive will be linked into the output, leading to subtle bugs.
+ if test "$solaris_use_stlport4" != yes; then
+ _LT_AC_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
+ fi
+ ;;
+ esac
;;
esac
])
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-_LT_DECL([], [sharedlib_from_linklib_cmd], [1],
- [Command to associate shared and link libraries])
-])# _LT_CHECK_SHAREDLIB_FROM_LINKLIB
+case " $_LT_AC_TAGVAR(postdeps, $1) " in
+*" -lc "*) _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no ;;
+esac
+])# AC_LIBTOOL_POSTDEP_PREDEP
+# AC_LIBTOOL_LANG_F77_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG], [_LT_AC_LANG_F77_CONFIG(F77)])
+AC_DEFUN([_LT_AC_LANG_F77_CONFIG],
+[AC_REQUIRE([AC_PROG_F77])
+AC_LANG_PUSH(Fortran 77)
+
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+_LT_AC_TAGVAR(allow_undefined_flag, $1)=
+_LT_AC_TAGVAR(always_export_symbols, $1)=no
+_LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_direct, $1)=no
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+_LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+_LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+_LT_AC_TAGVAR(hardcode_automatic, $1)=no
+_LT_AC_TAGVAR(module_cmds, $1)=
+_LT_AC_TAGVAR(module_expsym_cmds, $1)=
+_LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+_LT_AC_TAGVAR(no_undefined_flag, $1)=
+_LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-# _LT_PATH_MANIFEST_TOOL
-# ----------------------
-# locate the manifest tool
-m4_defun([_LT_PATH_MANIFEST_TOOL],
-[AC_CHECK_TOOL(MANIFEST_TOOL, mt, :)
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-AC_CACHE_CHECK([if $MANIFEST_TOOL is a manifest tool], [lt_cv_path_mainfest_tool],
- [lt_cv_path_mainfest_tool=no
- echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&AS_MESSAGE_LOG_FD
- $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
- cat conftest.err >&AS_MESSAGE_LOG_FD
- if $GREP 'Manifest Tool' conftest.out > /dev/null; then
- lt_cv_path_mainfest_tool=yes
- fi
- rm -f conftest*])
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
- MANIFEST_TOOL=:
-fi
-_LT_DECL([], [MANIFEST_TOOL], [1], [Manifest tool])dnl
-])# _LT_PATH_MANIFEST_TOOL
+# Source file extension for f77 test sources.
+ac_ext=f
+# Object file extension for compiled f77 test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
-# LT_LIB_M
-# --------
-# check for math library
-AC_DEFUN([LT_LIB_M],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-LIBM=
-case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
- # These system don't have libm, or don't need it
- ;;
-*-ncr-sysv4.3*)
- AC_CHECK_LIB(mw, _mwvalidcheckl, LIBM="-lmw")
- AC_CHECK_LIB(m, cos, LIBM="$LIBM -lm")
+# 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.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+AC_MSG_CHECKING([if libtool supports shared libraries])
+AC_MSG_RESULT([$can_build_shared])
+
+AC_MSG_CHECKING([whether to build shared libraries])
+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
;;
-*)
- AC_CHECK_LIB(m, cos, LIBM="-lm")
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
;;
esac
-AC_SUBST([LIBM])
-])# LT_LIB_M
+AC_MSG_RESULT([$enable_shared])
-# Old name:
-AU_ALIAS([AC_CHECK_LIBM], [LT_LIB_M])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_CHECK_LIBM], [])
+AC_MSG_CHECKING([whether to build static libraries])
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+AC_MSG_RESULT([$enable_static])
+_LT_AC_TAGVAR(GCC, $1)="$G77"
+_LT_AC_TAGVAR(LD, $1)="$LD"
-# _LT_COMPILER_NO_RTTI([TAGNAME])
-# -------------------------------
-m4_defun([_LT_COMPILER_NO_RTTI],
-[m4_require([_LT_TAG_COMPILER])dnl
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
-_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+AC_LIBTOOL_CONFIG($1)
-if test "$GCC" = yes; then
- case $cc_basename in
- nvcc*)
- _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -Xcompiler -fno-builtin' ;;
- *)
- _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin' ;;
+AC_LANG_POP
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_F77_CONFIG
+
+
+# AC_LIBTOOL_LANG_GCJ_CONFIG
+# --------------------------
+# Ensure that the configuration vars for the C compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG], [_LT_AC_LANG_GCJ_CONFIG(GCJ)])
+AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+_LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+
+_LT_AC_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
+
+AC_LIBTOOL_PROG_COMPILER_NO_RTTI($1)
+AC_LIBTOOL_PROG_COMPILER_PIC($1)
+AC_LIBTOOL_PROG_CC_C_O($1)
+AC_LIBTOOL_SYS_HARD_LINK_LOCKS($1)
+AC_LIBTOOL_PROG_LD_SHLIBS($1)
+AC_LIBTOOL_SYS_DYNAMIC_LINKER($1)
+AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH($1)
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_GCJ_CONFIG
+
+
+# AC_LIBTOOL_LANG_RC_CONFIG
+# -------------------------
+# Ensure that the configuration vars for the Windows resource compiler are
+# suitably defined. Those variables are subsequently used by
+# AC_LIBTOOL_CONFIG to write the compiler configuration to `libtool'.
+AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG], [_LT_AC_LANG_RC_CONFIG(RC)])
+AC_DEFUN([_LT_AC_LANG_RC_CONFIG],
+[AC_LANG_SAVE
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+_LT_AC_TAGVAR(objext, $1)=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
+_LT_AC_SYS_COMPILER
+
+# save warnings/boilerplate of simple test code
+_LT_COMPILER_BOILERPLATE
+_LT_LINKER_BOILERPLATE
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+_LT_AC_TAGVAR(compiler, $1)=$CC
+_LT_CC_BASENAME([$compiler])
+_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
+
+AC_LIBTOOL_CONFIG($1)
+
+AC_LANG_RESTORE
+CC="$lt_save_CC"
+])# AC_LIBTOOL_LANG_RC_CONFIG
+
+
+# AC_LIBTOOL_CONFIG([TAGNAME])
+# ----------------------------
+# If TAGNAME is not passed, then create an initial libtool script
+# with a default configuration from the untagged config vars. Otherwise
+# add code to config.status for appending the configuration named by
+# TAGNAME from the matching tagged config vars.
+AC_DEFUN([AC_LIBTOOL_CONFIG],
+[# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ _LT_AC_TAGVAR(compiler, $1) \
+ _LT_AC_TAGVAR(CC, $1) \
+ _LT_AC_TAGVAR(LD, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1) \
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) \
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1) \
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1) \
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1) \
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1) \
+ _LT_AC_TAGVAR(old_archive_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) \
+ _LT_AC_TAGVAR(predep_objects, $1) \
+ _LT_AC_TAGVAR(postdep_objects, $1) \
+ _LT_AC_TAGVAR(predeps, $1) \
+ _LT_AC_TAGVAR(postdeps, $1) \
+ _LT_AC_TAGVAR(compiler_lib_search_path, $1) \
+ _LT_AC_TAGVAR(archive_cmds, $1) \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(postinstall_cmds, $1) \
+ _LT_AC_TAGVAR(postuninstall_cmds, $1) \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) \
+ _LT_AC_TAGVAR(allow_undefined_flag, $1) \
+ _LT_AC_TAGVAR(no_undefined_flag, $1) \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1) \
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1) \
+ _LT_AC_TAGVAR(hardcode_automatic, $1) \
+ _LT_AC_TAGVAR(module_cmds, $1) \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) \
+ _LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1) \
+ _LT_AC_TAGVAR(fix_srcfile_path, $1) \
+ _LT_AC_TAGVAR(exclude_expsyms, $1) \
+ _LT_AC_TAGVAR(include_expsyms, $1); do
+
+ case $var in
+ _LT_AC_TAGVAR(old_archive_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_new_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_cmds, $1) | \
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(module_cmds, $1) | \
+ _LT_AC_TAGVAR(module_expsym_cmds, $1) | \
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1) | \
+ _LT_AC_TAGVAR(export_symbols_cmds, $1) | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\[$]0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\[$]0 --fallback-echo"[$]/[$]0 --fallback-echo"/'`
+ ;;
esac
- _LT_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
+ifelse([$1], [],
+ [cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ AC_MSG_NOTICE([creating $ofile])],
+ [cfgfile="$ofile"])
+
+ cat <<__EOF__ >> "$cfgfile"
+ifelse([$1], [],
+[#! $SHELL
+
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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.
+#
+# 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.
+
+# A sed program that does not truncate output.
+SED=$lt_SED
+
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+# The names of the tagged configurations supported by this script.
+available_tags=
+
+# ### BEGIN LIBTOOL CONFIG],
+[# ### BEGIN LIBTOOL TAG CONFIG: $tagname])
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$_LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_[]_LT_AC_TAGVAR(compiler, $1)
+
+# Is the compiler the GNU C compiler?
+with_gcc=$_LT_AC_TAGVAR(GCC, $1)
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_[]_LT_AC_TAGVAR(LD, $1)
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_[]_LT_AC_TAGVAR(lt_cv_prog_compiler_c_o, $1)
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_static, $1)
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_[]_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_[]_LT_AC_TAGVAR(export_dynamic_flag_spec, $1)
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_[]_LT_AC_TAGVAR(whole_archive_flag_spec, $1)
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_[]_LT_AC_TAGVAR(thread_safe_flag_spec, $1)
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_cmds, $1)
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_new_cmds, $1)
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_[]_LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_[]_LT_AC_TAGVAR(archive_cmds, $1)
+archive_expsym_cmds=$lt_[]_LT_AC_TAGVAR(archive_expsym_cmds, $1)
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_[]_LT_AC_TAGVAR(module_cmds, $1)
+module_expsym_cmds=$lt_[]_LT_AC_TAGVAR(module_expsym_cmds, $1)
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_[]_LT_AC_TAGVAR(predep_objects, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_[]_LT_AC_TAGVAR(postdep_objects, $1)
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_[]_LT_AC_TAGVAR(predeps, $1)
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_[]_LT_AC_TAGVAR(postdeps, $1)
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_[]_LT_AC_TAGVAR(compiler_lib_search_path, $1)
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_[]_LT_AC_TAGVAR(allow_undefined_flag, $1)
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_[]_LT_AC_TAGVAR(no_undefined_flag, $1)
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$_LT_AC_TAGVAR(hardcode_action, $1)
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# Flag to hardcode \$libdir into a binary during linking.
+# This must work even if \$libdir does not exist.
+hardcode_libdir_flag_spec=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_[]_LT_AC_TAGVAR(hardcode_libdir_separator, $1)
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$_LT_AC_TAGVAR(hardcode_direct, $1)
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$_LT_AC_TAGVAR(hardcode_minus_L, $1)
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$_LT_AC_TAGVAR(hardcode_shlibpath_var, $1)
+
+# 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=$_LT_AC_TAGVAR(hardcode_automatic, $1)
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$_LT_AC_TAGVAR(link_all_deplibs, $1)
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$_LT_AC_TAGVAR(always_export_symbols, $1)
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_[]_LT_AC_TAGVAR(export_symbols_cmds, $1)
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_[]_LT_AC_TAGVAR(exclude_expsyms, $1)
+
+# Symbols that must always be exported.
+include_expsyms=$lt_[]_LT_AC_TAGVAR(include_expsyms, $1)
+
+ifelse([$1],[],
+[# ### END LIBTOOL CONFIG],
+[# ### END LIBTOOL TAG CONFIG: $tagname])
+
+__EOF__
+
+ifelse([$1],[], [
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
+fi
+EOF
+ ;;
+ esac
+
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
+])
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+])# AC_LIBTOOL_CONFIG
+
+
+# AC_LIBTOOL_PROG_COMPILER_NO_RTTI([TAGNAME])
+# -------------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI],
+[AC_REQUIRE([_LT_AC_SYS_COMPILER])dnl
+
+_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
+
+if test "$GCC" = yes; then
+ _LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
+
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler supports -fno-rtti -fno-exceptions],
lt_cv_prog_compiler_rtti_exceptions,
[-fno-rtti -fno-exceptions], [],
- [_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
+ [_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1) -fno-rtti -fno-exceptions"])
fi
-_LT_TAGDECL([no_builtin_flag], [lt_prog_compiler_no_builtin_flag], [1],
- [Compiler flag to turn off builtin functions])
-])# _LT_COMPILER_NO_RTTI
+])# AC_LIBTOOL_PROG_COMPILER_NO_RTTI
-# _LT_CMD_GLOBAL_SYMBOLS
-# ----------------------
-m4_defun([_LT_CMD_GLOBAL_SYMBOLS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_PROG_CC])dnl
-AC_REQUIRE([AC_PROG_AWK])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-AC_REQUIRE([LT_PATH_LD])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_TAG_COMPILER])dnl
-
+# AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
+# ---------------------------------
+AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE],
+[AC_REQUIRE([AC_CANONICAL_HOST])
+AC_REQUIRE([LT_AC_PROG_SED])
+AC_REQUIRE([AC_PROG_NM])
+AC_REQUIRE([AC_OBJEXT])
# Check for command to grab the raw symbol name followed by C symbol from nm.
AC_MSG_CHECKING([command to parse $NM output from $compiler object])
AC_CACHE_VAL([lt_cv_sys_global_symbol_pipe],
@@ -3645,18 +4738,33 @@ symcode='[[BCDEGRST]]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([[_A-Za-z]][[_A-Za-z0-9]]*\)'
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
# Define system-specific variables.
case $host_os in
aix*)
symcode='[[BCDT]]'
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32*)
symcode='[[ABCDGISTW]]'
;;
-hpux*)
+hpux*) # Its linker distinguishes data from code symbols
if test "$host_cpu" = ia64; then
symcode='[[ABCDEGRST]]'
fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+linux* | k*bsd*-gnu)
+ if test "$host_cpu" = ia64; then
+ symcode='[[ABCDGIRSTW]]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
;;
irix* | nonstopux*)
symcode='[[BCDEGRST]]'
@@ -3681,79 +4789,49 @@ sysv4)
;;
esac
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
- symcode='[[ABCDGIRSTW]]' ;;
-esac
-
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([[^ ]]*\)[[ ]]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([[^ ]]*\) \(lib[[^ ]]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([[^ ]]*\) \([[^ ]]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
-
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
- opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
;;
esac
-# Try without a prefix underscore, then with it.
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[[ABCDGIRSTW]]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
# Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
symxfrm="\\1 $ac_symprfx\\2 \\2"
# Write the raw and C identifiers.
- if test "$lt_cv_nm_interface" = "MS dumpbin"; then
- # Fake it for dumpbin and say T for any non-static function
- # and D for any global variable.
- # Also find C++ and __fastcall symbols from MSVC++,
- # which start with @ or ?.
- lt_cv_sys_global_symbol_pipe="$AWK ['"\
-" {last_section=section; section=\$ 3};"\
-" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
-" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-" \$ 0!~/External *\|/{next};"\
-" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-" {if(hide[section]) next};"\
-" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-" s[1]~/^[@?]/{print s[1], s[1]; next};"\
-" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-" ' prfx=^$ac_symprfx]"
- else
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
- fi
- lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[[ ]]\($symcode$symcode*\)[[ ]][[ ]]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
# Check to see that the pipe works correctly.
pipe_works=no
rm -f conftest*
- cat > conftest.$ac_ext <<_LT_EOF
+ cat > conftest.$ac_ext <<EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
+void nm_test_func(){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
+EOF
if AC_TRY_EVAL(ac_compile); then
# Now try to grab the symbols.
nlist=conftest.nm
- if AC_TRY_EVAL(NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) && test -s "$nlist"; then
+ if AC_TRY_EVAL(NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
@@ -3762,67 +4840,53 @@ _LT_EOF
fi
# Make sure that we snagged all the symbols we need.
- if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
- if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
- cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
- relocations are performed -- see ld's documentation on pseudo-relocs. */
-# define LT@&t@_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data. */
-# define LT@&t@_DLSYM_CONST
-#else
-# define LT@&t@_DLSYM_CONST const
-#endif
-
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
#ifdef __cplusplus
extern "C" {
#endif
-_LT_EOF
+EOF
# Now generate the symbol file.
- eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
- cat <<_LT_EOF >> conftest.$ac_ext
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
-/* The mapping between symbol names and symbols. */
-LT@&t@_DLSYM_CONST struct {
+/* The mapping between symbol names and symbols. */
+const struct {
const char *name;
- void *address;
+ lt_ptr_t address;
}
-lt__PROGRAM__LTX_preloaded_symbols[[]] =
+lt_preloaded_symbols[[]] =
{
- { "@PROGRAM@", (void *) 0 },
-_LT_EOF
- $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
- cat <<\_LT_EOF >> conftest.$ac_ext
- {0, (void *) 0}
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
};
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
-
#ifdef __cplusplus
}
#endif
-_LT_EOF
+EOF
# Now try linking the two files.
mv conftest.$ac_objext conftstm.$ac_objext
- lt_globsym_save_LIBS=$LIBS
- lt_globsym_save_CFLAGS=$CFLAGS
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
LIBS="conftstm.$ac_objext"
- CFLAGS="$CFLAGS$_LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
+ CFLAGS="$CFLAGS$_LT_AC_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)"
if AC_TRY_EVAL(ac_link) && test -s conftest${ac_exeext}; then
pipe_works=yes
fi
- LIBS=$lt_globsym_save_LIBS
- CFLAGS=$lt_globsym_save_CFLAGS
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
else
echo "cannot find nm_test_func in $nlist" >&AS_MESSAGE_LOG_FD
fi
@@ -3836,7 +4900,7 @@ _LT_EOF
echo "$progname: failed program was:" >&AS_MESSAGE_LOG_FD
cat conftest.$ac_ext >&5
fi
- rm -rf conftest* conftst*
+ rm -f conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
@@ -3854,91 +4918,55 @@ if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; the
else
AC_MSG_RESULT(ok)
fi
+]) # AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
- nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[[@]]FILE' >/dev/null; then
- nm_file_list_spec='@'
-fi
-_LT_DECL([global_symbol_pipe], [lt_cv_sys_global_symbol_pipe], [1],
- [Take the output of nm and produce a listing of raw symbols and C names])
-_LT_DECL([global_symbol_to_cdecl], [lt_cv_sys_global_symbol_to_cdecl], [1],
- [Transform the output of nm in a proper C declaration])
-_LT_DECL([global_symbol_to_c_name_address],
- [lt_cv_sys_global_symbol_to_c_name_address], [1],
- [Transform the output of nm in a C name address pair])
-_LT_DECL([global_symbol_to_c_name_address_lib_prefix],
- [lt_cv_sys_global_symbol_to_c_name_address_lib_prefix], [1],
- [Transform the output of nm in a C name address pair when lib prefix is needed])
-_LT_DECL([], [nm_file_list_spec], [1],
- [Specify filename containing input files for $NM])
-]) # _LT_CMD_GLOBAL_SYMBOLS
-
-
-# _LT_COMPILER_PIC([TAGNAME])
-# ---------------------------
-m4_defun([_LT_COMPILER_PIC],
-[m4_require([_LT_TAG_COMPILER])dnl
-_LT_TAGVAR(lt_prog_compiler_wl, $1)=
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=
-_LT_TAGVAR(lt_prog_compiler_static, $1)=
+# AC_LIBTOOL_PROG_COMPILER_PIC([TAGNAME])
+# ---------------------------------------
+AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC],
+[_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=
-m4_if([$1], [CXX], [
+AC_MSG_CHECKING([for $compiler option to produce PIC])
+ ifelse([$1],[CXX],[
# C++ specific cases for pic, static, wl, etc.
if test "$GXX" = yes; then
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
-
amigaos*)
- case $host_cpu in
- powerpc)
- # see comment about AmigaOS4 .so support
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
- esac
+ # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
-
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | os2* | pw32* | cegcc*)
+ mingw* | cygwin* | os2* | pw32*)
# 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
- m4_if([$1], [GCJ], [],
- [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
*djgpp*)
# DJGPP does not support shared libraries at all
- _LT_TAGVAR(lt_prog_compiler_pic, $1)=
- ;;
- haiku*)
- # PIC is the default for Haiku.
- # The "-static" flag exists, but is broken.
- _LT_TAGVAR(lt_prog_compiler_static, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
;;
interix[[3-9]]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
@@ -3946,63 +4974,61 @@ m4_if([$1], [CXX], [
;;
sysv4*MP*)
if test -d /usr/nec; then
- _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
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.
+ # 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*)
+ hppa*64*|ia64*)
;;
*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
;;
- *qnx* | *nto*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
- ;;
*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
else
case $host_os in
- aix[[4-9]]*)
+ aix4* | aix5*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
chorus*)
case $cc_basename in
cxch68*)
# Green Hills C++ Compiler
- # _LT_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, $1)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
;;
esac
;;
- mingw* | cygwin* | os2* | pw32* | 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).
- m4_if([$1], [GCJ], [],
- [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
- ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
dgux*)
case $cc_basename in
ec++*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
ghcx*)
# Green Hills C++ Compiler
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
@@ -4014,21 +5040,21 @@ m4_if([$1], [CXX], [
hpux9* | hpux10* | hpux11*)
case $cc_basename in
CC*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
if test "$host_cpu" != ia64; then
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
fi
;;
aCC*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
case $host_cpu in
hppa*64*|ia64*)
# +Z the default
;;
*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
;;
@@ -4043,60 +5069,47 @@ m4_if([$1], [CXX], [
irix5* | irix6* | nonstopux*)
case $cc_basename in
CC*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
# CC pic flag -KPIC is the default.
;;
*)
;;
esac
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu)
case $cc_basename in
KCC*)
# KAI C++ Compiler
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- ecpc* )
- # old Intel C++ for x86_64 which still supported -KPIC.
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
- icpc* )
- # Intel C++, used to be incompatible with GCC.
- # ICC 10 doesn't accept -KPIC any more.
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ icpc* | ecpc*)
+ # Intel C++
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
- pgCC* | pgcpp*)
- # Portland Group C++ compiler
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ pgCC*)
+ # Portland Group C++ compiler.
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
cxx*)
# Compaq C++
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
- _LT_TAGVAR(lt_prog_compiler_pic, $1)=
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
- ;;
- xlc* | xlC* | bgxl[[cC]]* | mpixl[[cC]]*)
- # IBM XL 8.0, 9.0 on PPC and BlueGene
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-qstaticlink'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
esac
;;
@@ -4109,7 +5122,7 @@ m4_if([$1], [CXX], [
mvs*)
case $cc_basename in
cxx*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-W c,exportall'
;;
*)
;;
@@ -4117,27 +5130,22 @@ m4_if([$1], [CXX], [
;;
netbsd*)
;;
- *qnx* | *nto*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
- ;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='--backend -Wl,'
;;
RCC*)
# Rational C++ 2.4.1
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
cxx*)
# Digital/Compaq C++
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# Make sure the PIC flag is empty. It appears that all Alpha
# Linux and Compaq Tru64 Unix objects are PIC.
- _LT_TAGVAR(lt_prog_compiler_pic, $1)=
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
*)
;;
@@ -4147,15 +5155,15 @@ m4_if([$1], [CXX], [
;;
solaris*)
case $cc_basename in
- CC* | sunCC*)
+ CC*)
# Sun C++ 4.2, 5.x and Centerline C++
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
;;
gcx*)
# Green Hills C++ Compiler
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
;;
*)
;;
@@ -4165,110 +5173,81 @@ m4_if([$1], [CXX], [
case $cc_basename in
CC*)
# Sun C++ 4.x
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
lcc*)
# Lucid
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
;;
*)
;;
esac
;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- case $cc_basename in
- CC*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- esac
- ;;
tandem*)
case $cc_basename in
NCC*)
# NonStop-UX NCC 3.20
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
;;
*)
;;
esac
;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+ esac
+ ;;
vxworks*)
;;
*)
- _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
],
[
if test "$GCC" = yes; then
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
case $host_os in
aix*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
amigaos*)
- case $host_cpu in
- powerpc)
- # see comment about AmigaOS4 .so support
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
- ;;
- esac
+ # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-m68020 -resident32 -malways-restore-a4'
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | pw32* | os2*)
# 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
- m4_if([$1], [GCJ], [],
- [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
darwin* | rhapsody*)
# PIC is the default on this platform
# Common symbols not allowed in MH_DYLIB files
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
- ;;
-
- haiku*)
- # PIC is the default for Haiku.
- # The "-static" flag exists, but is broken.
- _LT_TAGVAR(lt_prog_compiler_static, $1)=
- ;;
-
- 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_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- ;;
- esac
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fno-common'
;;
interix[[3-9]]*)
@@ -4279,57 +5258,64 @@ m4_if([$1], [CXX], [
msdosdjgpp*)
# Just because we use GCC doesn't mean we suddenly get shared libraries
# on systems that don't support them.
- _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
enable_shared=no
;;
- *nto* | *qnx*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
- ;;
-
sysv4*MP*)
if test -d /usr/nec; then
- _LT_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=-Kconform_pic
fi
;;
- *)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ hpux*)
+ # 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_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
+ ;;
+ esac
;;
- esac
- case $cc_basename in
- nvcc*) # Cuda Compiler Driver 2.2
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Xlinker '
- if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
- _LT_TAGVAR(lt_prog_compiler_pic, $1)="-Xcompiler $_LT_TAGVAR(lt_prog_compiler_pic, $1)"
- fi
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
;;
esac
else
# PORTME Check for flag to pass linker flags through the system compiler.
case $host_os in
aix*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
else
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-bnso -bI:/lib/syscalls.exp'
fi
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-qnocommon'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ ;;
+ esac
+ ;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | pw32* | os2*)
# 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).
- m4_if([$1], [GCJ], [],
- [_LT_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'])
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-DDLL_EXPORT'
;;
hpux9* | hpux10* | hpux11*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC is the default for IA64 HP-UX and 64-bit HP-UX, but
# not for PA HP-UX.
case $host_cpu in
@@ -4337,309 +5323,231 @@ m4_if([$1], [CXX], [
# +Z the default
;;
*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='+Z'
;;
esac
# Is there a better lt_prog_compiler_static that works with the bundled CC?
- _LT_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='${wl}-a ${wl}archive'
;;
irix5* | irix6* | nonstopux*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# PIC (with -KPIC) is the default.
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ newsos6)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
case $cc_basename in
- # old Intel for x86_64 which still supported -KPIC.
- ecc*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ icc* | ecc*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-static'
;;
- # icc used to be incompatible with GCC.
- # ICC 10 doesn't accept -KPIC any more.
- icc* | ifort*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
- ;;
- # Lahey Fortran 8.1.
- lf95*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='--shared'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='--static'
- ;;
- nagfor*)
- # NAG Fortran compiler
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,-Wl,,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
- pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ pgcc* | pgf77* | pgf90* | pgf95*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
ccc*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All Alpha code is PIC.
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
- xl* | bgxl* | bgf* | mpixl*)
- # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-qpic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-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_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)=''
- ;;
- *Sun\ F* | *Sun*Fortran*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
- ;;
+ case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C 5.9
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- ;;
- *Intel*\ [[CF]]*Compiler*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-static'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
;;
- *Portland\ Group*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fpic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)=''
;;
esac
;;
esac
;;
- newsos6)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
- ;;
-
- *nto* | *qnx*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-fPIC -shared'
- ;;
-
osf3* | osf4* | osf5*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
# All OSF/1 code is PIC.
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
rdos*)
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-non_shared'
;;
solaris*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
case $cc_basename in
- f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
+ f77* | f90* | f95*)
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld ';;
*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,';;
esac
;;
sunos4*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Qoption ld '
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-PIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4 | sysv4.2uw2* | sysv4.3*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
sysv4*MP*)
if test -d /usr/nec ;then
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-Kconform_pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
fi
;;
sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-KPIC'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
unicos*)
- _LT_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
- _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ _LT_AC_TAGVAR(lt_prog_compiler_wl, $1)='-Wl,'
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
uts4*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
- _LT_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)='-pic'
+ _LT_AC_TAGVAR(lt_prog_compiler_static, $1)='-Bstatic'
;;
*)
- _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no
;;
esac
fi
])
-case $host_os in
- # For platforms which do not support PIC, -DPIC is meaningless:
- *djgpp*)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)=
- ;;
- *)
- _LT_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])"
- ;;
-esac
-
-AC_CACHE_CHECK([for $compiler option to produce PIC],
- [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)],
- [_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_prog_compiler_pic, $1)])
-_LT_TAGVAR(lt_prog_compiler_pic, $1)=$_LT_TAGVAR(lt_cv_prog_compiler_pic, $1)
+AC_MSG_RESULT([$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)])
#
# Check to make sure the PIC flag actually works.
#
-if test -n "$_LT_TAGVAR(lt_prog_compiler_pic, $1)"; then
- _LT_COMPILER_OPTION([if $compiler PIC flag $_LT_TAGVAR(lt_prog_compiler_pic, $1) works],
- [_LT_TAGVAR(lt_cv_prog_compiler_pic_works, $1)],
- [$_LT_TAGVAR(lt_prog_compiler_pic, $1)@&t@m4_if([$1],[],[ -DPIC],[m4_if([$1],[CXX],[ -DPIC],[])])], [],
- [case $_LT_TAGVAR(lt_prog_compiler_pic, $1) in
+if test -n "$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)"; then
+ AC_LIBTOOL_COMPILER_OPTION([if $compiler PIC flag $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) works],
+ _LT_AC_TAGVAR(lt_prog_compiler_pic_works, $1),
+ [$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])], [],
+ [case $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1) in
"" | " "*) ;;
- *) _LT_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_TAGVAR(lt_prog_compiler_pic, $1)" ;;
+ *) _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=" $_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)" ;;
esac],
- [_LT_TAGVAR(lt_prog_compiler_pic, $1)=
- _LT_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
+ [_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ _LT_AC_TAGVAR(lt_prog_compiler_can_build_shared, $1)=no])
fi
-_LT_TAGDECL([pic_flag], [lt_prog_compiler_pic], [1],
- [Additional compiler flags for building library objects])
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)=
+ ;;
+ *)
+ _LT_AC_TAGVAR(lt_prog_compiler_pic, $1)="$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)ifelse([$1],[],[ -DPIC],[ifelse([$1],[CXX],[ -DPIC],[])])"
+ ;;
+esac
-_LT_TAGDECL([wl], [lt_prog_compiler_wl], [1],
- [How to pass a linker flag through the compiler])
#
# Check to make sure the static flag actually works.
#
-wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_TAGVAR(lt_prog_compiler_static, $1)\"
-_LT_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
- _LT_TAGVAR(lt_cv_prog_compiler_static_works, $1),
+wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1) eval lt_tmp_static_flag=\"$_LT_AC_TAGVAR(lt_prog_compiler_static, $1)\"
+AC_LIBTOOL_LINKER_OPTION([if $compiler static flag $lt_tmp_static_flag works],
+ _LT_AC_TAGVAR(lt_prog_compiler_static_works, $1),
$lt_tmp_static_flag,
[],
- [_LT_TAGVAR(lt_prog_compiler_static, $1)=])
-_LT_TAGDECL([link_static_flag], [lt_prog_compiler_static], [1],
- [Compiler flag to prevent dynamic linking])
-])# _LT_COMPILER_PIC
+ [_LT_AC_TAGVAR(lt_prog_compiler_static, $1)=])
+])
-# _LT_LINKER_SHLIBS([TAGNAME])
-# ----------------------------
+# AC_LIBTOOL_PROG_LD_SHLIBS([TAGNAME])
+# ------------------------------------
# See if the linker supports building shared libraries.
-m4_defun([_LT_LINKER_SHLIBS],
-[AC_REQUIRE([LT_PATH_LD])dnl
-AC_REQUIRE([LT_PATH_NM])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_DECL_SED])dnl
-m4_require([_LT_CMD_GLOBAL_SYMBOLS])dnl
-m4_require([_LT_TAG_COMPILER])dnl
+AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS],
+[AC_REQUIRE([LT_AC_PROG_SED])dnl
AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
-m4_if([$1], [CXX], [
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ifelse([$1],[CXX],[
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
case $host_os in
- aix[[4-9]]*)
+ aix4* | aix5*)
# 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
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
else
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
fi
;;
pw32*)
- _LT_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
- ;;
- cygwin* | mingw* | cegcc*)
- case $cc_basename in
- cl*)
- _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
- ;;
- *)
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
- _LT_TAGVAR(exclude_expsyms, $1)=['[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname']
- ;;
- esac
- ;;
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;/^.*[[ ]]__nm__/s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+ ;;
*)
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- ;;
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
esac
-], [
+],[
runpath_var=
- _LT_TAGVAR(allow_undefined_flag, $1)=
- _LT_TAGVAR(always_export_symbols, $1)=no
- _LT_TAGVAR(archive_cmds, $1)=
- _LT_TAGVAR(archive_expsym_cmds, $1)=
- _LT_TAGVAR(compiler_needs_object, $1)=no
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
- _LT_TAGVAR(export_dynamic_flag_spec, $1)=
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- _LT_TAGVAR(hardcode_automatic, $1)=no
- _LT_TAGVAR(hardcode_direct, $1)=no
- _LT_TAGVAR(hardcode_direct_absolute, $1)=no
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
- _LT_TAGVAR(hardcode_libdir_separator, $1)=
- _LT_TAGVAR(hardcode_minus_L, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
- _LT_TAGVAR(inherit_rpath, $1)=no
- _LT_TAGVAR(link_all_deplibs, $1)=unknown
- _LT_TAGVAR(module_cmds, $1)=
- _LT_TAGVAR(module_expsym_cmds, $1)=
- _LT_TAGVAR(old_archive_from_new_cmds, $1)=
- _LT_TAGVAR(old_archive_from_expsyms_cmds, $1)=
- _LT_TAGVAR(thread_safe_flag_spec, $1)=
- _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)=
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)=
+ _LT_AC_TAGVAR(old_archive_from_expsyms_cmds, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(thread_safe_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=unknown
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=no
+ _LT_AC_TAGVAR(module_cmds, $1)=
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)=
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
- _LT_TAGVAR(include_expsyms, $1)=
+ _LT_AC_TAGVAR(include_expsyms, $1)=
# 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'.
- _LT_TAGVAR(exclude_expsyms, $1)=['_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*']
+ _LT_AC_TAGVAR(exclude_expsyms, $1)="_GLOBAL_OFFSET_TABLE_"
# 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.
-dnl Note also adjust exclude_expsyms for C++ above.
extract_expsyms_cmds=
-
+ # Just being paranoid about ensuring that cc_basename is set.
+ _LT_CC_BASENAME([$compiler])
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | mingw* | pw32*)
# 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++.
@@ -4656,34 +5564,8 @@ dnl Note also adjust exclude_expsyms for C++ above.
;;
esac
- _LT_TAGVAR(ld_shlibs, $1)=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
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
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}'
@@ -4691,17 +5573,16 @@ dnl Note also adjust exclude_expsyms for C++ above.
# are reset later if shared libraries are not supported. Putting them
# here allows them to be overridden if necessary.
runpath_var=LD_RUN_PATH
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${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
- _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
- _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
fi
supports_anon_versioning=no
- case `$LD -v 2>&1` in
- *GNU\ gold*) supports_anon_versioning=yes ;;
+ case `$LD -v 2>/dev/null` in
*\ [[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 ...
@@ -4711,65 +5592,61 @@ dnl Note also adjust exclude_expsyms for C++ above.
# See if GNU ld supports shared libraries.
case $host_os in
- aix[[3-9]]*)
+ aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
- _LT_TAGVAR(ld_shlibs, $1)=no
- cat <<_LT_EOF 1>&2
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
-*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** Warning: the GNU linker, at least up to release 2.9.1, 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.
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
-_LT_EOF
+EOF
fi
;;
amigaos*)
- case $host_cpu in
- powerpc)
- # see comment about AmigaOS4 .so support
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)=''
- ;;
- m68k)
- _LT_TAGVAR(archive_cmds, $1)='$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)'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- ;;
- esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$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)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
beos*)
- if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
- _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
else
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
- cygwin* | mingw* | pw32* | cegcc*)
- # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
# as there is no search path for DLLs.
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=no
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/;s/^.*[[ ]]__nm__\([[^ ]]*\)[[ ]][[^ ]]*/\1 DATA/;/^I[[ ]]/d;/^[[AITW]][[ ]]/s/.* //'\'' | sort | uniq > $export_symbols'
- _LT_TAGVAR(exclude_expsyms, $1)=['[_]+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
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=no
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1 DATA/'\'' -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$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...
- _LT_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='if test "x`$SED 1q $export_symbols`" = xEXPORTS; then
cp $export_symbols $output_objdir/$soname.def;
else
echo EXPORTS > $output_objdir/$soname.def;
@@ -4777,118 +5654,79 @@ _LT_EOF
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
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
- haiku*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- ;;
-
interix[[3-9]]*)
- _LT_TAGVAR(hardcode_direct, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${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.
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='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'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='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'
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
case $cc_basename,$host_cpu in
- pgcc*) # Portland Group C compiler
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${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'
+ pgcc*) # Portland Group C compiler
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
- pgf77* | pgf90* | pgf95* | pgfortran*)
- # Portland Group f77 and f90 compilers
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${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'
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
- ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ 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
- _LT_TAGVAR(whole_archive_flag_spec, $1)=
- 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
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${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'
- _LT_TAGVAR(compiler_needs_object, $1)=yes
- ;;
esac
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${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'
- _LT_TAGVAR(compiler_needs_object, $1)=yes
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
esac
- _LT_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
-
- if test "x$supports_anon_versioning" = xyes; then
- _LT_TAGVAR(archive_expsym_cmds, $1)='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
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- case $cc_basename in
- xlf* | bgf* | bgxlf* | mpixlf*)
- # IBM XL Fortran 10.1 on PPC cannot create shared libs itself
- _LT_TAGVAR(whole_archive_flag_spec, $1)='--whole-archive$convenience --no-whole-archive'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
- if test "x$supports_anon_versioning" = xyes; then
- _LT_TAGVAR(archive_expsym_cmds, $1)='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
+ if test $supports_anon_versioning = yes; then
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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
else
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $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
- _LT_TAGVAR(ld_shlibs, $1)=no
- cat <<_LT_EOF 1>&2
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ cat <<EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
@@ -4897,19 +5735,19 @@ _LT_EOF
*** 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
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
case `$LD -v 2>&1` in
*\ [[01]].* | *\ 2.[[0-9]].* | *\ 2.1[[0-5]].*)
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
cat <<_LT_EOF 1>&2
*** Warning: Releases of the GNU linker prior to 2.16.91.0.3 can not
@@ -4922,62 +5760,58 @@ _LT_EOF
_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
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
else
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
;;
sunos4*)
- _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
wlarc=
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
- if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
esac
- if test "$_LT_TAGVAR(ld_shlibs, $1)" = no; then
+ if test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no; then
runpath_var=
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
- _LT_TAGVAR(export_dynamic_flag_spec, $1)=
- _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=
fi
else
# PORTME fill in a description of your system's linker (not GNU ld)
case $host_os in
aix3*)
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=yes
- _LT_TAGVAR(archive_expsym_cmds, $1)='$LD -o $output_objdir/$soname $libobjs $deplibs $linker_flags -bE:$export_symbols -T512 -H512 -bM:SRE~$AR $AR_FLAGS $lib $output_objdir/$soname'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(always_export_symbols, $1)=yes
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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.
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
if test "$GCC" = yes && test -z "$lt_prog_compiler_static"; then
# Neither direct hardcoding nor static linking is supported with a
# broken collect2.
- _LT_TAGVAR(hardcode_direct, $1)=unsupported
+ _LT_AC_TAGVAR(hardcode_direct, $1)=unsupported
fi
;;
- aix[[4-9]]*)
+ aix4* | aix5*)
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.
@@ -4987,24 +5821,22 @@ _LT_EOF
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
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\[$]2 == "T") || (\[$]2 == "D") || (\[$]2 == "B")) && ([substr](\[$]3,1,1) != ".")) { print \[$]3 } }'\'' | sort -u > $export_symbols'
else
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && ([substr](\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ _LT_AC_TAGVAR(export_symbols_cmds, $1)='$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]]*)
+ case $host_os in aix4.[[23]]|aix4.[[23]].*|aix5*)
for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
done
;;
esac
@@ -5019,32 +5851,30 @@ _LT_EOF
# CXXFLAGS/CFLAGS for g++/gcc. In the cases where that is not
# enough to fix the problem, add -Wl,-bbigtoc to LDFLAGS.
- _LT_TAGVAR(archive_cmds, $1)=''
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
- _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
+ _LT_AC_TAGVAR(archive_cmds, $1)=''
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
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
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
then
- # We have reworked collect2
- :
+ # We have reworked collect2
+ :
else
- # We have old collect2
- _LT_TAGVAR(hardcode_direct, $1)=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
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=
+ # We have old collect2
+ _LT_AC_TAGVAR(hardcode_direct, $1)=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
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=
fi
;;
esac
@@ -5055,8 +5885,8 @@ _LT_EOF
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:
+ # 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
@@ -5067,139 +5897,130 @@ _LT_EOF
fi
fi
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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.
- _LT_TAGVAR(always_export_symbols, $1)=yes
+ _LT_AC_TAGVAR(always_export_symbols, $1)=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.
- _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
- # Determine the default libpath from the value encoded in an
- # empty executable.
- _LT_SYS_MODULE_PATH_AIX([$1])
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
- _LT_TAGVAR(archive_expsym_cmds, $1)='$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
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${wl}${allow_undefined_flag}"; else :; fi` '"\${wl}$exp_sym_flag:\$export_symbols $shared_flag"
+ else
if test "$host_cpu" = ia64; then
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
- _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
- _LT_TAGVAR(archive_expsym_cmds, $1)="\$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"
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$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.
- _LT_SYS_MODULE_PATH_AIX([$1])
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
+ # Determine the default libpath from the value encoded in an empty executable.
+ _LT_AC_SYS_LIBPATH_AIX
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${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.
- _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
- _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
- if test "$with_gnu_ld" = yes; then
- # We only use this code for GNU lds that support --whole-archive.
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- else
- # Exported symbols can be pulled into shared objects from archives
- _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- fi
- _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
# This is similar to how AIX traditionally builds its shared libraries.
- _LT_TAGVAR(archive_expsym_cmds, $1)="\$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'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)="\$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
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)=''
- ;;
- m68k)
- _LT_TAGVAR(archive_cmds, $1)='$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)'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- ;;
- esac
+ _LT_AC_TAGVAR(archive_cmds, $1)='$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)'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ # see comment about different semantics on the GNU ld section
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
bsdi[[45]]*)
- _LT_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)=-rdynamic
;;
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | mingw* | pw32*)
# 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
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=yes
- _LT_TAGVAR(file_list_spec, $1)='@'
- # 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.
- _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- _LT_TAGVAR(archive_expsym_cmds, $1)='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, $1)='true'
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- _LT_TAGVAR(exclude_expsyms, $1)='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
- _LT_TAGVAR(export_symbols_cmds, $1)='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[[BCDGRS]][[ ]]/s/.*[[ ]]\([[^ ]]*\)/\1,DATA/'\'' | $SED -e '\''/^[[AITW]][[ ]]/s/.*[[ ]]//'\'' | sort | uniq > $export_symbols'
- # Don't use ranlib
- _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
- _LT_TAGVAR(postlink_cmds, $1)='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
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_TAGVAR(allow_undefined_flag, $1)=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.
- _LT_TAGVAR(archive_cmds, $1)='$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.
- _LT_TAGVAR(old_archive_from_new_cmds, $1)='true'
- # FIXME: Should let the user specify the lib program.
- _LT_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- ;;
- esac
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=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.
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='true'
+ # FIXME: Should let the user specify the lib program.
+ _LT_AC_TAGVAR(old_archive_cmds, $1)='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ _LT_AC_TAGVAR(fix_srcfile_path, $1)='`cygpath -w "$srcfile"`'
+ _LT_AC_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
;;
darwin* | rhapsody*)
- _LT_DARWIN_LINKER_FEATURES($1)
+ case $host_os in
+ rhapsody* | darwin1.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[[012]])
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_automatic, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)=''
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ _LT_AC_TAGVAR(module_cmds, $1)='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ _LT_AC_TAGVAR(module_expsym_cmds, $1)='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
+ ;;
+ esac
+ fi
;;
dgux*)
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ ;;
+
+ freebsd1*)
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
# FreeBSD 2.2.[012] allows us to include c++rt0.o to get C++ constructor
@@ -5207,112 +6028,106 @@ _LT_EOF
# does not break anything, and helps significantly (at the cost of a little
# extra space).
freebsd2.2*)
- _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2.*)
- _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ freebsd2*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
hpux9*)
if test "$GCC" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$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'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$rm $output_objdir/$soname~$CC -shared -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $libobjs $deplibs $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
else
- _LT_TAGVAR(archive_cmds, $1)='$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'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$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
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
;;
hpux10*)
- if test "$GCC" = yes && test "$with_gnu_ld" = no; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
- _LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
fi
if test "$with_gnu_ld" = no; then
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
fi
;;
hpux11*)
- if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
case $host_cpu in
hppa*64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
case $host_cpu in
hppa*64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
- m4_if($1, [], [
- # Older versions of the 11.00 compiler do not understand -b yet
- # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
- _LT_LINKER_OPTION([if $CC understands -b],
- _LT_TAGVAR(lt_cv_prog_compiler__b, $1), [-b],
- [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'],
- [_LT_TAGVAR(archive_cmds, $1)='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'])],
- [_LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'])
+ _LT_AC_TAGVAR(archive_cmds, $1)='$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
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
case $host_cpu in
hppa*64*|ia64*)
- _LT_TAGVAR(hardcode_direct, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='+b $libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
;;
esac
fi
@@ -5320,236 +6135,194 @@ _LT_EOF
irix5* | irix6* | nonstopux*)
if test "$GCC" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$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.
- AC_CACHE_CHECK([whether the $host_os linker accepts -exported_symbol],
- [lt_cv_irix_exported_symbol],
- [save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -shared ${wl}-exported_symbol ${wl}foo ${wl}-update_registry ${wl}/dev/null"
- AC_LINK_IFELSE(
- [AC_LANG_SOURCE(
- [AC_LANG_CASE([C], [[int foo (void) { return 0; }]],
- [C++], [[int foo (void) { return 0; }]],
- [Fortran 77], [[
- subroutine foo
- end]],
- [Fortran], [[
- subroutine foo
- end]])])],
- [lt_cv_irix_exported_symbol=yes],
- [lt_cv_irix_exported_symbol=no])
- LDFLAGS="$save_LDFLAGS"])
- if test "$lt_cv_irix_exported_symbol" = yes; then
- _LT_TAGVAR(archive_expsym_cmds, $1)='$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
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
- _LT_TAGVAR(archive_cmds, $1)='$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'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$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'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec_ld, $1)='-rpath $libdir'
fi
- _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_TAGVAR(inherit_rpath, $1)=yes
- _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
;;
netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
- _LT_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
fi
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
newsos6)
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
-
- *nto* | *qnx*)
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
openbsd*)
if test -f /usr/libexec/ld.so; then
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
- if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
else
case $host_os in
openbsd[[01]].* | openbsd2.[[0-7]] | openbsd2.[[0-7]].*)
- _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
;;
*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
;;
esac
- fi
+ fi
else
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
fi
;;
os2*)
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(archive_cmds, $1)='$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'
- _LT_TAGVAR(old_archive_from_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=unsupported
+ _LT_AC_TAGVAR(archive_cmds, $1)='$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'
+ _LT_AC_TAGVAR(old_archive_From_new_cmds, $1)='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
;;
osf3*)
if test "$GCC" = yes; then
- _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_TAGVAR(archive_cmds, $1)='$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'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
- _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_TAGVAR(archive_cmds, $1)='$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'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
fi
- _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
;;
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test "$GCC" = yes; then
- _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_TAGVAR(archive_cmds, $1)='$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'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
else
- _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_TAGVAR(archive_cmds, $1)='$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'
- _LT_TAGVAR(archive_expsym_cmds, $1)='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'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
fi
- _LT_TAGVAR(archive_cmds_need_lc, $1)='no'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=:
;;
solaris*)
- _LT_TAGVAR(no_undefined_flag, $1)=' -z defs'
+ _LT_AC_TAGVAR(no_undefined_flag, $1)=' -z text'
if test "$GCC" = yes; then
wlarc='${wl}'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='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'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${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=''
- _LT_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='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}'
- _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='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
+ wlarc=''
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$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'
fi
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=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?)
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
- _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
+ _LT_AC_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
fi
;;
esac
- _LT_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=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.
- _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
else
- _LT_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
fi
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes
+ _LT_AC_TAGVAR(hardcode_minus_L, $1)=yes
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4)
case $host_vendor in
sni)
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_direct, $1)=yes # is this really true???
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=yes # is this really true???
;;
siemens)
## LD is ld it makes a PLAMLIB
## CC just makes a GrossModule.
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
- _LT_TAGVAR(hardcode_direct, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(reload_cmds, $1)='$CC -r -o $output$reload_objs'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no
;;
motorola)
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_direct, $1)=no #Motorola manual says yes, but my tests say they lie
;;
esac
runpath_var='LD_RUN_PATH'
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
sysv4.3*)
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='-Bexport'
;;
sysv4*MP*)
if test -d /usr/nec; then
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var=LD_RUN_PATH
hardcode_runpath_var=yes
- _LT_TAGVAR(ld_shlibs, $1)=yes
+ _LT_AC_TAGVAR(ld_shlibs, $1)=yes
fi
;;
sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
- _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
else
- _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
@@ -5560,65 +6333,50 @@ _LT_EOF
# 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.
- _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
+ _LT_AC_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ _LT_AC_TAGVAR(hardcode_libdir_separator, $1)=':'
+ _LT_AC_TAGVAR(link_all_deplibs, $1)=yes
+ _LT_AC_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
else
- _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ _LT_AC_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
uts4*)
- _LT_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
+ _LT_AC_TAGVAR(archive_cmds, $1)='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ _LT_AC_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
+ _LT_AC_TAGVAR(hardcode_shlibpath_var, $1)=no
;;
*)
- _LT_TAGVAR(ld_shlibs, $1)=no
+ _LT_AC_TAGVAR(ld_shlibs, $1)=no
;;
esac
-
- if test x$host_vendor = xsni; then
- case $host in
- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Blargedynsym'
- ;;
- esac
- fi
fi
])
-AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
-test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
-_LT_TAGVAR(with_gnu_ld, $1)=$with_gnu_ld
-
-_LT_DECL([], [libext], [0], [Old archive suffix (normally "a")])dnl
-_LT_DECL([], [shrext_cmds], [1], [Shared library suffix (normally ".so")])dnl
-_LT_DECL([], [extract_expsyms_cmds], [2],
- [The commands to extract the exported symbol list from a shared archive])
+AC_MSG_RESULT([$_LT_AC_TAGVAR(ld_shlibs, $1)])
+test "$_LT_AC_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
#
# Do we need to explicitly link libc?
#
-case "x$_LT_TAGVAR(archive_cmds_need_lc, $1)" in
+case "x$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)" in
x|xyes)
# Assume -lc should be added
- _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
if test "$enable_shared" = yes && test "$GCC" = yes; then
- case $_LT_TAGVAR(archive_cmds, $1) in
+ case $_LT_AC_TAGVAR(archive_cmds, $1) in
*'~'*)
# FIXME: we may have to deal with multi-command sequences.
;;
@@ -5626,2091 +6384,144 @@ x|xyes)
# 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.
- AC_CACHE_CHECK([whether -lc should be explicitly linked in],
- [lt_cv_]_LT_TAGVAR(archive_cmds_need_lc, $1),
- [$RM conftest*
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
-
- if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
- soname=conftest
- lib=conftest
- libobjs=conftest.$ac_objext
- deplibs=
- wl=$_LT_TAGVAR(lt_prog_compiler_wl, $1)
- pic_flag=$_LT_TAGVAR(lt_prog_compiler_pic, $1)
- compiler_flags=-v
- linker_flags=-v
- verstring=
- output_objdir=.
- libname=conftest
- lt_save_allow_undefined_flag=$_LT_TAGVAR(allow_undefined_flag, $1)
- _LT_TAGVAR(allow_undefined_flag, $1)=
- if AC_TRY_EVAL(_LT_TAGVAR(archive_cmds, $1) 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1)
- then
- lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=no
- else
- lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)=yes
- fi
- _LT_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
- else
- cat conftest.err 1>&5
- fi
- $RM conftest*
- ])
- _LT_TAGVAR(archive_cmds_need_lc, $1)=$lt_cv_[]_LT_TAGVAR(archive_cmds_need_lc, $1)
- ;;
- esac
- fi
- ;;
-esac
-
-_LT_TAGDECL([build_libtool_need_lc], [archive_cmds_need_lc], [0],
- [Whether or not to add -lc for building shared libraries])
-_LT_TAGDECL([allow_libtool_libs_with_static_runtimes],
- [enable_shared_with_static_runtimes], [0],
- [Whether or not to disallow shared libs when runtime libs are static])
-_LT_TAGDECL([], [export_dynamic_flag_spec], [1],
- [Compiler flag to allow reflexive dlopens])
-_LT_TAGDECL([], [whole_archive_flag_spec], [1],
- [Compiler flag to generate shared objects directly from archives])
-_LT_TAGDECL([], [compiler_needs_object], [1],
- [Whether the compiler copes with passing no objects directly])
-_LT_TAGDECL([], [old_archive_from_new_cmds], [2],
- [Create an old-style archive from a shared archive])
-_LT_TAGDECL([], [old_archive_from_expsyms_cmds], [2],
- [Create a temporary old-style archive to link instead of a shared archive])
-_LT_TAGDECL([], [archive_cmds], [2], [Commands used to build a shared archive])
-_LT_TAGDECL([], [archive_expsym_cmds], [2])
-_LT_TAGDECL([], [module_cmds], [2],
- [Commands used to build a loadable module if different from building
- a shared archive.])
-_LT_TAGDECL([], [module_expsym_cmds], [2])
-_LT_TAGDECL([], [with_gnu_ld], [1],
- [Whether we are building with GNU ld or not])
-_LT_TAGDECL([], [allow_undefined_flag], [1],
- [Flag that allows shared libraries with undefined symbols to be built])
-_LT_TAGDECL([], [no_undefined_flag], [1],
- [Flag that enforces no undefined symbols])
-_LT_TAGDECL([], [hardcode_libdir_flag_spec], [1],
- [Flag to hardcode $libdir into a binary during linking.
- This must work even if $libdir does not exist])
-_LT_TAGDECL([], [hardcode_libdir_separator], [1],
- [Whether we need a single "-rpath" flag with a separated argument])
-_LT_TAGDECL([], [hardcode_direct], [0],
- [Set to "yes" if using DIR/libNAME${shared_ext} during linking hardcodes
- DIR into the resulting binary])
-_LT_TAGDECL([], [hardcode_direct_absolute], [0],
- [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])
-_LT_TAGDECL([], [hardcode_minus_L], [0],
- [Set to "yes" if using the -LDIR flag during linking hardcodes DIR
- into the resulting binary])
-_LT_TAGDECL([], [hardcode_shlibpath_var], [0],
- [Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
- into the resulting binary])
-_LT_TAGDECL([], [hardcode_automatic], [0],
- [Set to "yes" if building a shared library automatically hardcodes DIR
- into the library and all subsequent libraries and executables linked
- against it])
-_LT_TAGDECL([], [inherit_rpath], [0],
- [Set to yes if linker adds runtime paths of dependent libraries
- to runtime path list])
-_LT_TAGDECL([], [link_all_deplibs], [0],
- [Whether libtool must link a program against all its dependency libraries])
-_LT_TAGDECL([], [always_export_symbols], [0],
- [Set to "yes" if exported symbols are required])
-_LT_TAGDECL([], [export_symbols_cmds], [2],
- [The commands to list exported symbols])
-_LT_TAGDECL([], [exclude_expsyms], [1],
- [Symbols that should not be listed in the preloaded symbols])
-_LT_TAGDECL([], [include_expsyms], [1],
- [Symbols that must always be exported])
-_LT_TAGDECL([], [prelink_cmds], [2],
- [Commands necessary for linking programs (against libraries) with templates])
-_LT_TAGDECL([], [postlink_cmds], [2],
- [Commands necessary for finishing linking programs])
-_LT_TAGDECL([], [file_list_spec], [1],
- [Specify filename containing input files])
-dnl FIXME: Not yet implemented
-dnl _LT_TAGDECL([], [thread_safe_flag_spec], [1],
-dnl [Compiler flag to generate thread safe objects])
-])# _LT_LINKER_SHLIBS
-
-
-# _LT_LANG_C_CONFIG([TAG])
-# ------------------------
-# Ensure that the configuration variables for a C compiler are suitably
-# defined. These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_C_CONFIG],
-[m4_require([_LT_DECL_EGREP])dnl
-lt_save_CC="$CC"
-AC_LANG_PUSH(C)
-
-# Source file extension for C test sources.
-ac_ext=c
-
-# Object file extension for compiled C test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="int some_variable = 0;"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='int main(){return(0);}'
-
-_LT_TAG_COMPILER
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$CC
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-if test -n "$compiler"; then
- _LT_COMPILER_NO_RTTI($1)
- _LT_COMPILER_PIC($1)
- _LT_COMPILER_C_O($1)
- _LT_COMPILER_FILE_LOCKS($1)
- _LT_LINKER_SHLIBS($1)
- _LT_SYS_DYNAMIC_LINKER($1)
- _LT_LINKER_HARDCODE_LIBPATH($1)
- LT_SYS_DLOPEN_SELF
- _LT_CMD_STRIPLIB
-
- # Report which library types will actually be built
- AC_MSG_CHECKING([if libtool supports shared libraries])
- AC_MSG_RESULT([$can_build_shared])
-
- AC_MSG_CHECKING([whether to build shared libraries])
- 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
- AC_MSG_RESULT([$enable_shared])
-
- AC_MSG_CHECKING([whether to build static libraries])
- # Make sure either enable_shared or enable_static is yes.
- test "$enable_shared" = yes || enable_static=yes
- AC_MSG_RESULT([$enable_static])
-
- _LT_CONFIG($1)
-fi
-AC_LANG_POP
-CC="$lt_save_CC"
-])# _LT_LANG_C_CONFIG
-
-
-# _LT_LANG_CXX_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a C++ compiler are suitably
-# defined. These variables are subsequently used by _LT_CONFIG to write
-# the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_CXX_CONFIG],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-m4_require([_LT_DECL_EGREP])dnl
-m4_require([_LT_PATH_MANIFEST_TOOL])dnl
-if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
- ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
- (test "X$CXX" != "Xg++"))) ; then
- AC_PROG_CXXCPP
-else
- _lt_caught_CXX_error=yes
-fi
-
-AC_LANG_PUSH(C++)
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(compiler_needs_object, $1)=no
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_shlibpath_var, $1)=unsupported
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for C++ test sources.
-ac_ext=cpp
-
-# Object file extension for compiled C++ test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the CXX 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_caught_CXX_error" != yes; then
- # Code to be used in simple compile tests
- lt_simple_compile_test_code="int some_variable = 0;"
-
- # Code to be used in simple link tests
- lt_simple_link_test_code='int main(int, char *[[]]) { return(0); }'
-
- # ltmain only uses $CC for tagged configurations so make sure $CC is set.
- _LT_TAG_COMPILER
-
- # save warnings/boilerplate of simple test code
- _LT_COMPILER_BOILERPLATE
- _LT_LINKER_BOILERPLATE
-
- # Allow CC to be a program name with arguments.
- lt_save_CC=$CC
- lt_save_CFLAGS=$CFLAGS
- lt_save_LD=$LD
- lt_save_GCC=$GCC
- GCC=$GXX
- lt_save_with_gnu_ld=$with_gnu_ld
- lt_save_path_LD=$lt_cv_path_LD
- if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
- lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
- else
- $as_unset lt_cv_prog_gnu_ld
- fi
- if test -n "${lt_cv_path_LDCXX+set}"; then
- lt_cv_path_LD=$lt_cv_path_LDCXX
- else
- $as_unset lt_cv_path_LD
- fi
- test -z "${LDCXX+set}" || LD=$LDCXX
- CC=${CXX-"c++"}
- CFLAGS=$CXXFLAGS
- compiler=$CC
- _LT_TAGVAR(compiler, $1)=$CC
- _LT_CC_BASENAME([$compiler])
-
- if test -n "$compiler"; then
- # We don't want -fno-exception when compiling C++ code, so set the
- # no_builtin_flag separately
- if test "$GXX" = yes; then
- _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=' -fno-builtin'
- else
- _LT_TAGVAR(lt_prog_compiler_no_builtin_flag, $1)=
- fi
-
- if test "$GXX" = yes; then
- # Set up default GNU C++ configuration
-
- LT_PATH_LD
-
- # Check if GNU C++ uses GNU ld as the underlying linker, since the
- # archiving commands below assume that GNU ld is being used.
- if test "$with_gnu_ld" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
- # If archive_cmds runs LD, not CC, wlarc should be empty
- # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
- # investigate it a little bit more. (MM)
- wlarc='${wl}'
-
- # ancient GNU ld didn't support --whole-archive et. al.
- if eval "`$CC -print-prog-name=ld` --help 2>&1" |
- $GREP 'no-whole-archive' > /dev/null; then
- _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ AC_MSG_CHECKING([whether -lc should be explicitly linked in])
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if AC_TRY_EVAL(ac_compile) 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$_LT_AC_TAGVAR(lt_prog_compiler_wl, $1)
+ pic_flag=$_LT_AC_TAGVAR(lt_prog_compiler_pic, $1)
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$_LT_AC_TAGVAR(allow_undefined_flag, $1)
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=
+ if AC_TRY_EVAL(_LT_AC_TAGVAR(archive_cmds, $1) 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1)
+ then
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=no
else
- _LT_TAGVAR(whole_archive_flag_spec, $1)=
+ _LT_AC_TAGVAR(archive_cmds_need_lc, $1)=yes
fi
+ _LT_AC_TAGVAR(allow_undefined_flag, $1)=$lt_save_allow_undefined_flag
else
- with_gnu_ld=no
- wlarc=
-
- # A generic and very simple default shared library creation
- # command for GNU C++ for the case where it uses the native
- # linker, instead of GNU ld. If possible, this setting should
- # overridden to take advantage of the native linker features on
- # the platform it is being used on.
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ cat conftest.err 1>&5
fi
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-
- else
- GXX=no
- with_gnu_ld=no
- wlarc=
- fi
-
- # PORTME: fill in a description of your system's C++ link characteristics
- AC_MSG_CHECKING([whether the $compiler linker ($LD) supports shared libraries])
- _LT_TAGVAR(ld_shlibs, $1)=yes
- case $host_os in
- aix3*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- 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
- 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
- case $ld_flag in
- *-brtl*)
- aix_use_runtimelinking=yes
- break
- ;;
- esac
- 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.
-
- _LT_TAGVAR(archive_cmds, $1)=''
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
- _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- _LT_TAGVAR(file_list_spec, $1)='${wl}-f,'
-
- if test "$GXX" = 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
- _LT_TAGVAR(hardcode_direct, $1)=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
- _LT_TAGVAR(hardcode_minus_L, $1)=yes
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=
- 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
-
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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.
- _LT_TAGVAR(always_export_symbols, $1)=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.
- _LT_TAGVAR(allow_undefined_flag, $1)='-berok'
- # Determine the default libpath from the value encoded in an empty
- # executable.
- _LT_SYS_MODULE_PATH_AIX([$1])
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-blibpath:$libdir:'"$aix_libpath"
-
- _LT_TAGVAR(archive_expsym_cmds, $1)='$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
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $libdir:/usr/lib:/lib'
- _LT_TAGVAR(allow_undefined_flag, $1)="-z nodefs"
- _LT_TAGVAR(archive_expsym_cmds, $1)="\$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.
- _LT_SYS_MODULE_PATH_AIX([$1])
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${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.
- _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-bernotok'
- _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-berok'
- if test "$with_gnu_ld" = yes; then
- # We only use this code for GNU lds that support --whole-archive.
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- else
- # Exported symbols can be pulled into shared objects from archives
- _LT_TAGVAR(whole_archive_flag_spec, $1)='$convenience'
- fi
- _LT_TAGVAR(archive_cmds_need_lc, $1)=yes
- # This is similar to how AIX traditionally builds its shared
- # libraries.
- _LT_TAGVAR(archive_expsym_cmds, $1)="\$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
- ;;
-
- beos*)
- if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
- # support --undefined. This deserves some investigation. FIXME
- _LT_TAGVAR(archive_cmds, $1)='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- else
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- chorus*)
- case $cc_basename in
- *)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
-
- cygwin* | mingw* | pw32* | cegcc*)
- case $GXX,$cc_basename in
- ,cl* | no,cl*)
- # Native MSVC
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)=' '
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=yes
- _LT_TAGVAR(file_list_spec, $1)='@'
- # 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.
- _LT_TAGVAR(archive_cmds, $1)='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- _LT_TAGVAR(archive_expsym_cmds, $1)='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, $1)='true'
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
- # Don't use ranlib
- _LT_TAGVAR(old_postinstall_cmds, $1)='chmod 644 $oldlib'
- _LT_TAGVAR(postlink_cmds, $1)='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~
- func_to_tool_file "$lt_outputfile"~
- 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'
- ;;
- *)
- # g++
- # _LT_TAGVAR(hardcode_libdir_flag_spec, $1) is actually meaningless,
- # as there is no search path for DLLs.
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-L$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-all-symbols'
- _LT_TAGVAR(allow_undefined_flag, $1)=unsupported
- _LT_TAGVAR(always_export_symbols, $1)=no
- _LT_TAGVAR(enable_shared_with_static_runtimes, $1)=yes
-
- if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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...
- _LT_TAGVAR(archive_expsym_cmds, $1)='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
- else
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
- darwin* | rhapsody*)
- _LT_DARWIN_LINKER_FEATURES($1)
- ;;
-
- dgux*)
- case $cc_basename in
- ec++*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- ghcx*)
- # Green Hills C++ Compiler
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
-
- freebsd2.*)
- # C++ shared libraries reported to be fairly broken before
- # switch to ELF
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- freebsd-elf*)
- _LT_TAGVAR(archive_cmds_need_lc, $1)=no
- ;;
-
- freebsd* | dragonfly*)
- # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
- # conventions
- _LT_TAGVAR(ld_shlibs, $1)=yes
- ;;
-
- gnu*)
- ;;
-
- haiku*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- ;;
-
- hpux9*)
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
- # but as the default
- # location of the library.
-
- case $cc_basename in
- CC*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- aCC*)
- _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
- ;;
- *)
- if test "$GXX" = yes; then
- _LT_TAGVAR(archive_cmds, $1)='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- else
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
-
- hpux10*|hpux11*)
- if test $with_gnu_ld = no; then
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}+b ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
- case $host_cpu in
- hppa*64*|ia64*)
- ;;
- *)
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- ;;
- esac
- fi
- case $host_cpu in
- hppa*64*|ia64*)
- _LT_TAGVAR(hardcode_direct, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- ;;
- *)
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
- _LT_TAGVAR(hardcode_minus_L, $1)=yes # Not in the search PATH,
- # but as the default
- # location of the library.
- ;;
- esac
-
- case $cc_basename in
- CC*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- aCC*)
- case $host_cpu in
- hppa*64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- esac
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
- ;;
- *)
- if test "$GXX" = yes; then
- if test $with_gnu_ld = no; then
- case $host_cpu in
- hppa*64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- esac
- fi
- else
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
-
- interix[[3-9]]*)
- _LT_TAGVAR(hardcode_direct, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${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.
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-h,$soname ${wl}--image-base,`expr ${RANDOM-$$} % 4096 / 2 \* 262144 + 1342177280` -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='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'
- ;;
- irix5* | irix6*)
- case $cc_basename in
- CC*)
- # SGI C++
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-
- # Archives containing C++ object files must be created using
- # "CC -ar", where "CC" is the IRIX C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- _LT_TAGVAR(old_archive_cmds, $1)='$CC -ar -WR,-u -o $oldlib $oldobjs'
- ;;
- *)
- if test "$GXX" = yes; then
- if test "$with_gnu_ld" = no; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
- fi
- fi
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- ;;
- esac
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
- _LT_TAGVAR(inherit_rpath, $1)=yes
- ;;
-
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
- case $cc_basename in
- KCC*)
- # Kuck and Associates, Inc. (KAI) C++ Compiler
-
- # KCC will only create a shared library if the output file
- # ends with ".so" (or ".sl" for HP-UX), so rename the library
- # to its proper name (with version) after linking.
- _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
-
- # Archives containing C++ object files must be created using
- # "CC -Bstatic", where "CC" is the KAI C++ compiler.
- _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs'
- ;;
- icpc* | ecpc* )
- # Intel C++
- with_gnu_ld=yes
- # version 8.0 and above of icpc choke on multiply defined symbols
- # if we add $predep_objects and $postdep_objects, however 7.1 and
- # earlier do not add the objects themselves.
- case `$CC -V 2>&1` in
- *"Version 7."*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- *) # Version 8.0 or newer
- tmp_idyn=
- case $host_cpu in
- ia64*) tmp_idyn=' -i_dynamic';;
- esac
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- esac
- _LT_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- ;;
- pgCC* | pgcpp*)
- # Portland Group C++ compiler
- case `$CC -V` in
- *pgCC\ [[1-5]].* | *pgcpp\ [[1-5]].*)
- _LT_TAGVAR(prelink_cmds, $1)='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
- compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
- _LT_TAGVAR(old_archive_cmds, $1)='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
- $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
- $RANLIB $oldlib'
- _LT_TAGVAR(archive_cmds, $1)='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
- ;;
- *) # Version 6 and above use weak symbols
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
- ;;
- esac
-
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}--rpath ${wl}$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${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'
- ;;
- cxx*)
- # Compaq C++
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
-
- runpath_var=LD_RUN_PATH
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
- ;;
- xl* | mpixl* | bgxl*)
- # IBM XL 8.0 on PPC, with GNU ld
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}--export-dynamic'
- _LT_TAGVAR(archive_cmds, $1)='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- if test "x$supports_anon_versioning" = xyes; then
- _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $output_objdir/$libname.ver~
- cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
- echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
- fi
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
- _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${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'
- _LT_TAGVAR(compiler_needs_object, $1)=yes
-
- # Not sure whether something based on
- # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
- # would be better.
- output_verbose_link_cmd='func_echo_all'
-
- # Archives containing C++ object files must be created using
- # "CC -xar", where "CC" is the Sun C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
- ;;
- esac
- ;;
- esac
- ;;
-
- lynxos*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- m88k*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- mvs*)
- case $cc_basename in
- cxx*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
-
- netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
- wlarc=
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- fi
- # Workaround some broken pre-1.5 toolchains
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
- ;;
-
- *nto* | *qnx*)
- _LT_TAGVAR(ld_shlibs, $1)=yes
- ;;
-
- openbsd2*)
- # C++ shared libraries are fairly broken
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- openbsd*)
- if test -f /usr/libexec/ld.so; then
- _LT_TAGVAR(hardcode_direct, $1)=yes
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_TAGVAR(hardcode_direct_absolute, $1)=yes
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-E'
- _LT_TAGVAR(whole_archive_flag_spec, $1)="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- fi
- output_verbose_link_cmd=func_echo_all
- else
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
-
- osf3* | osf4* | osf5*)
- case $cc_basename in
- KCC*)
- # Kuck and Associates, Inc. (KAI) C++ Compiler
-
- # KCC will only create a shared library if the output file
- # ends with ".so" (or ".sl" for HP-UX), so rename the library
- # to its proper name (with version) after linking.
- _LT_TAGVAR(archive_cmds, $1)='tempext=`echo $shared_ext | $SED -e '\''s/\([[^()0-9A-Za-z{}]]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath,$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Archives containing C++ object files must be created using
- # the KAI C++ compiler.
- case $host in
- osf3*) _LT_TAGVAR(old_archive_cmds, $1)='$CC -Bstatic -o $oldlib $oldobjs' ;;
- *) _LT_TAGVAR(old_archive_cmds, $1)='$CC -o $oldlib $oldobjs' ;;
- esac
- ;;
- RCC*)
- # Rational C++ 2.4.1
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- cxx*)
- case $host in
- osf3*)
- _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- ;;
- *)
- _LT_TAGVAR(allow_undefined_flag, $1)=' -expect_unresolved \*'
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
- echo "-hidden">> $lib.exp~
- $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
- $RM $lib.exp'
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-rpath $libdir'
- ;;
- esac
-
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
- ;;
- *)
- if test "$GXX" = yes && test "$with_gnu_ld" = no; then
- _LT_TAGVAR(allow_undefined_flag, $1)=' ${wl}-expect_unresolved ${wl}\*'
- case $host in
- osf3*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $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'
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $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'
- ;;
- esac
-
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-rpath ${wl}$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-
- else
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- fi
- ;;
- esac
- ;;
-
- psos*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- sunos4*)
- case $cc_basename in
- CC*)
- # Sun C++ 4.x
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- lcc*)
- # Lucid
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
-
- solaris*)
- case $cc_basename in
- CC* | sunCC*)
- # Sun C++ 4.2, 5.x and Centerline C++
- _LT_TAGVAR(archive_cmds_need_lc,$1)=yes
- _LT_TAGVAR(no_undefined_flag, $1)=' -zdefs'
- _LT_TAGVAR(archive_cmds, $1)='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='-R$libdir'
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=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'.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- _LT_TAGVAR(whole_archive_flag_spec, $1)='-z allextract$convenience -z defaultextract'
- ;;
- esac
- _LT_TAGVAR(link_all_deplibs, $1)=yes
-
- output_verbose_link_cmd='func_echo_all'
-
- # Archives containing C++ object files must be created using
- # "CC -xar", where "CC" is the Sun C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- _LT_TAGVAR(old_archive_cmds, $1)='$CC -xar -o $oldlib $oldobjs'
- ;;
- gcx*)
- # Green Hills C++ Compiler
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
- # The C++ compiler must be used to create the archive.
- _LT_TAGVAR(old_archive_cmds, $1)='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
- ;;
- *)
- # GNU C++ compiler with Solaris linker
- if test "$GXX" = yes && test "$with_gnu_ld" = no; then
- _LT_TAGVAR(no_undefined_flag, $1)=' ${wl}-z ${wl}defs'
- if $CC --version | $GREP -v '^2\.7' > /dev/null; then
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
- else
- # g++ 2.7 appears to require `-G' NOT `-shared' on this
- # platform.
- _LT_TAGVAR(archive_cmds, $1)='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
- _LT_TAGVAR(archive_expsym_cmds, $1)='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
- fi
-
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R $wl$libdir'
- case $host_os in
- solaris2.[[0-5]] | solaris2.[[0-5]].*) ;;
- *)
- _LT_TAGVAR(whole_archive_flag_spec, $1)='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- ;;
- esac
- fi
- ;;
- esac
- ;;
-
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[[01]].[[10]]* | unixware7* | sco3.2v5.0.[[024]]*)
- _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
+ $rm conftest*
+ AC_MSG_RESULT([$_LT_AC_TAGVAR(archive_cmds_need_lc, $1)])
;;
-
- 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.
- _LT_TAGVAR(no_undefined_flag, $1)='${wl}-z,text'
- _LT_TAGVAR(allow_undefined_flag, $1)='${wl}-z,nodefs'
- _LT_TAGVAR(archive_cmds_need_lc, $1)=no
- _LT_TAGVAR(hardcode_shlibpath_var, $1)=no
- _LT_TAGVAR(hardcode_libdir_flag_spec, $1)='${wl}-R,$libdir'
- _LT_TAGVAR(hardcode_libdir_separator, $1)=':'
- _LT_TAGVAR(link_all_deplibs, $1)=yes
- _LT_TAGVAR(export_dynamic_flag_spec, $1)='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
-
- case $cc_basename in
- CC*)
- _LT_TAGVAR(archive_cmds, $1)='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(old_archive_cmds, $1)='$CC -Tprelink_objects $oldobjs~
- '"$_LT_TAGVAR(old_archive_cmds, $1)"
- _LT_TAGVAR(reload_cmds, $1)='$CC -Tprelink_objects $reload_objs~
- '"$_LT_TAGVAR(reload_cmds, $1)"
- ;;
- *)
- _LT_TAGVAR(archive_cmds, $1)='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- _LT_TAGVAR(archive_expsym_cmds, $1)='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
-
- tandem*)
- case $cc_basename in
- NCC*)
- # NonStop-UX NCC 3.20
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
- esac
- ;;
-
- vxworks*)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
-
- *)
- # FIXME: insert proper C++ library support
- _LT_TAGVAR(ld_shlibs, $1)=no
- ;;
esac
-
- AC_MSG_RESULT([$_LT_TAGVAR(ld_shlibs, $1)])
- test "$_LT_TAGVAR(ld_shlibs, $1)" = no && can_build_shared=no
-
- _LT_TAGVAR(GCC, $1)="$GXX"
- _LT_TAGVAR(LD, $1)="$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_SYS_HIDDEN_LIBDEPS($1)
- _LT_COMPILER_PIC($1)
- _LT_COMPILER_C_O($1)
- _LT_COMPILER_FILE_LOCKS($1)
- _LT_LINKER_SHLIBS($1)
- _LT_SYS_DYNAMIC_LINKER($1)
- _LT_LINKER_HARDCODE_LIBPATH($1)
-
- _LT_CONFIG($1)
- fi # test -n "$compiler"
-
- CC=$lt_save_CC
- CFLAGS=$lt_save_CFLAGS
- LDCXX=$LD
- LD=$lt_save_LD
- GCC=$lt_save_GCC
- with_gnu_ld=$lt_save_with_gnu_ld
- lt_cv_path_LDCXX=$lt_cv_path_LD
- lt_cv_path_LD=$lt_save_path_LD
- lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
- lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-fi # test "$_lt_caught_CXX_error" != yes
-
-AC_LANG_POP
-])# _LT_LANG_CXX_CONFIG
-
-
-# _LT_FUNC_STRIPNAME_CNF
-# ----------------------
-# func_stripname_cnf prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-#
-# This function is identical to the (non-XSI) version of func_stripname,
-# except this one can be used by m4 code that may be executed by configure,
-# rather than the libtool script.
-m4_defun([_LT_FUNC_STRIPNAME_CNF],[dnl
-AC_REQUIRE([_LT_DECL_SED])
-AC_REQUIRE([_LT_PROG_ECHO_BACKSLASH])
-func_stripname_cnf ()
-{
- case ${2} in
- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
- esac
-} # func_stripname_cnf
-])# _LT_FUNC_STRIPNAME_CNF
-
-# _LT_SYS_HIDDEN_LIBDEPS([TAGNAME])
-# ---------------------------------
-# Figure out "hidden" library dependencies from verbose
-# compiler output when linking a shared library.
-# Parse the compiler output and extract the necessary
-# objects, libraries and library flags.
-m4_defun([_LT_SYS_HIDDEN_LIBDEPS],
-[m4_require([_LT_FILEUTILS_DEFAULTS])dnl
-AC_REQUIRE([_LT_FUNC_STRIPNAME_CNF])dnl
-# Dependencies to place before and after the object being linked:
-_LT_TAGVAR(predep_objects, $1)=
-_LT_TAGVAR(postdep_objects, $1)=
-_LT_TAGVAR(predeps, $1)=
-_LT_TAGVAR(postdeps, $1)=
-_LT_TAGVAR(compiler_lib_search_path, $1)=
-
-dnl we can't use the lt_simple_compile_test_code here,
-dnl because it contains code intended for an executable,
-dnl not a library. It's possible we should let each
-dnl tag define a new lt_????_link_test_code variable,
-dnl but it's only used here...
-m4_if([$1], [], [cat > conftest.$ac_ext <<_LT_EOF
-int a;
-void foo (void) { a = 0; }
-_LT_EOF
-], [$1], [CXX], [cat > conftest.$ac_ext <<_LT_EOF
-class Foo
-{
-public:
- Foo (void) { a = 0; }
-private:
- int a;
-};
-_LT_EOF
-], [$1], [F77], [cat > conftest.$ac_ext <<_LT_EOF
- subroutine foo
- implicit none
- integer*4 a
- a=0
- return
- end
-_LT_EOF
-], [$1], [FC], [cat > conftest.$ac_ext <<_LT_EOF
- subroutine foo
- implicit none
- integer a
- a=0
- return
- end
-_LT_EOF
-], [$1], [GCJ], [cat > conftest.$ac_ext <<_LT_EOF
-public class foo {
- private int a;
- public void bar (void) {
- a = 0;
- }
-};
-_LT_EOF
-], [$1], [GO], [cat > conftest.$ac_ext <<_LT_EOF
-package foo
-func foo() {
-}
-_LT_EOF
-])
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
-
-dnl Parse the compiler output and extract the necessary
-dnl objects, libraries and library flags.
-if AC_TRY_EVAL(ac_compile); then
- # Parse the compiler output and extract the necessary
- # objects, libraries and library flags.
-
- # Sentinel used to keep track of whether or not we are before
- # the conftest object file.
- pre_test_object_deps_done=no
-
- for p in `eval "$output_verbose_link_cmd"`; do
- case ${prev}${p} in
-
- -L* | -R* | -l*)
- # Some compilers place space between "-{L,R}" and the path.
- # Remove the space.
- if test $p = "-L" ||
- test $p = "-R"; then
- prev=$p
- continue
- fi
-
- # Expand the sysroot to ease extracting the directories later.
- if test -z "$prev"; then
- case $p in
- -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
- -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
- -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
- esac
- fi
- case $p in
- =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
- esac
- if test "$pre_test_object_deps_done" = no; then
- case ${prev} in
- -L | -R)
- # Internal compiler library paths should come after those
- # provided the user. The postdeps already come after the
- # user supplied libs so there is no need to process them.
- if test -z "$_LT_TAGVAR(compiler_lib_search_path, $1)"; then
- _LT_TAGVAR(compiler_lib_search_path, $1)="${prev}${p}"
- else
- _LT_TAGVAR(compiler_lib_search_path, $1)="${_LT_TAGVAR(compiler_lib_search_path, $1)} ${prev}${p}"
- fi
- ;;
- # The "-l" case would never come before the object being
- # linked, so don't bother handling this case.
- esac
- else
- if test -z "$_LT_TAGVAR(postdeps, $1)"; then
- _LT_TAGVAR(postdeps, $1)="${prev}${p}"
- else
- _LT_TAGVAR(postdeps, $1)="${_LT_TAGVAR(postdeps, $1)} ${prev}${p}"
- fi
- fi
- prev=
- ;;
-
- *.lto.$objext) ;; # Ignore GCC LTO objects
- *.$objext)
- # This assumes that the test object file only shows up
- # once in the compiler output.
- if test "$p" = "conftest.$objext"; then
- pre_test_object_deps_done=yes
- continue
- fi
-
- if test "$pre_test_object_deps_done" = no; then
- if test -z "$_LT_TAGVAR(predep_objects, $1)"; then
- _LT_TAGVAR(predep_objects, $1)="$p"
- else
- _LT_TAGVAR(predep_objects, $1)="$_LT_TAGVAR(predep_objects, $1) $p"
- fi
- else
- if test -z "$_LT_TAGVAR(postdep_objects, $1)"; then
- _LT_TAGVAR(postdep_objects, $1)="$p"
- else
- _LT_TAGVAR(postdep_objects, $1)="$_LT_TAGVAR(postdep_objects, $1) $p"
- fi
- fi
- ;;
-
- *) ;; # Ignore the rest.
-
- esac
- done
-
- # Clean up.
- rm -f a.out a.exe
-else
- echo "libtool.m4: error: problem compiling $1 test program"
-fi
-
-$RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
-
-# PORTME: override above test on systems where it is broken
-m4_if([$1], [CXX],
-[case $host_os in
-interix[[3-9]]*)
- # Interix 3.5 installs completely hosed .la files for C++, so rather than
- # hack all around it, let's just trust "g++" to DTRT.
- _LT_TAGVAR(predep_objects,$1)=
- _LT_TAGVAR(postdep_objects,$1)=
- _LT_TAGVAR(postdeps,$1)=
- ;;
-
-linux*)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
-
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
-
- if test "$solaris_use_stlport4" != yes; then
- _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
- fi
- ;;
- esac
- ;;
-
-solaris*)
- case $cc_basename in
- CC* | sunCC*)
- # The more standards-conforming stlport4 library is
- # incompatible with the Cstd library. Avoid specifying
- # it if it's in CXXFLAGS. Ignore libCrun as
- # -library=stlport4 depends on it.
- case " $CXX $CXXFLAGS " in
- *" -library=stlport4 "*)
- solaris_use_stlport4=yes
- ;;
- esac
-
- # Adding this requires a known-good setup of shared libraries for
- # Sun compiler versions before 5.6, else PIC objects from an old
- # archive will be linked into the output, leading to subtle bugs.
- if test "$solaris_use_stlport4" != yes; then
- _LT_TAGVAR(postdeps,$1)='-library=Cstd -library=Crun'
- fi
- ;;
- esac
+ fi
;;
esac
-])
-
-case " $_LT_TAGVAR(postdeps, $1) " in
-*" -lc "*) _LT_TAGVAR(archive_cmds_need_lc, $1)=no ;;
-esac
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=
-if test -n "${_LT_TAGVAR(compiler_lib_search_path, $1)}"; then
- _LT_TAGVAR(compiler_lib_search_dirs, $1)=`echo " ${_LT_TAGVAR(compiler_lib_search_path, $1)}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-_LT_TAGDECL([], [compiler_lib_search_dirs], [1],
- [The directories searched by this compiler when creating a shared library])
-_LT_TAGDECL([], [predep_objects], [1],
- [Dependencies to place before and after the objects being linked to
- create a shared library])
-_LT_TAGDECL([], [postdep_objects], [1])
-_LT_TAGDECL([], [predeps], [1])
-_LT_TAGDECL([], [postdeps], [1])
-_LT_TAGDECL([], [compiler_lib_search_path], [1],
- [The library search path used internally by the compiler when linking
- a shared library])
-])# _LT_SYS_HIDDEN_LIBDEPS
-
-
-# _LT_LANG_F77_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for a Fortran 77 compiler are
-# suitably defined. These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_F77_CONFIG],
-[AC_LANG_PUSH(Fortran 77)
-if test -z "$F77" || test "X$F77" = "Xno"; then
- _lt_disable_F77=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for f77 test sources.
-ac_ext=f
-
-# Object file extension for compiled f77 test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$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.
- _LT_TAG_COMPILER
-
- # save warnings/boilerplate of simple test code
- _LT_COMPILER_BOILERPLATE
- _LT_LINKER_BOILERPLATE
-
- # 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
- _LT_TAGVAR(compiler, $1)=$CC
- _LT_CC_BASENAME([$compiler])
- GCC=$G77
- if test -n "$compiler"; then
- AC_MSG_CHECKING([if libtool supports shared libraries])
- AC_MSG_RESULT([$can_build_shared])
-
- AC_MSG_CHECKING([whether to build shared libraries])
- 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
- AC_MSG_RESULT([$enable_shared])
-
- AC_MSG_CHECKING([whether to build static libraries])
- # Make sure either enable_shared or enable_static is yes.
- test "$enable_shared" = yes || enable_static=yes
- AC_MSG_RESULT([$enable_static])
-
- _LT_TAGVAR(GCC, $1)="$G77"
- _LT_TAGVAR(LD, $1)="$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_COMPILER_PIC($1)
- _LT_COMPILER_C_O($1)
- _LT_COMPILER_FILE_LOCKS($1)
- _LT_LINKER_SHLIBS($1)
- _LT_SYS_DYNAMIC_LINKER($1)
- _LT_LINKER_HARDCODE_LIBPATH($1)
-
- _LT_CONFIG($1)
- fi # test -n "$compiler"
-
- GCC=$lt_save_GCC
- CC="$lt_save_CC"
- CFLAGS="$lt_save_CFLAGS"
-fi # test "$_lt_disable_F77" != yes
-
-AC_LANG_POP
-])# _LT_LANG_F77_CONFIG
-
-
-# _LT_LANG_FC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for a Fortran compiler are
-# suitably defined. These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_FC_CONFIG],
-[AC_LANG_PUSH(Fortran)
-
-if test -z "$FC" || test "X$FC" = "Xno"; then
- _lt_disable_FC=yes
-fi
-
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-_LT_TAGVAR(allow_undefined_flag, $1)=
-_LT_TAGVAR(always_export_symbols, $1)=no
-_LT_TAGVAR(archive_expsym_cmds, $1)=
-_LT_TAGVAR(export_dynamic_flag_spec, $1)=
-_LT_TAGVAR(hardcode_direct, $1)=no
-_LT_TAGVAR(hardcode_direct_absolute, $1)=no
-_LT_TAGVAR(hardcode_libdir_flag_spec, $1)=
-_LT_TAGVAR(hardcode_libdir_separator, $1)=
-_LT_TAGVAR(hardcode_minus_L, $1)=no
-_LT_TAGVAR(hardcode_automatic, $1)=no
-_LT_TAGVAR(inherit_rpath, $1)=no
-_LT_TAGVAR(module_cmds, $1)=
-_LT_TAGVAR(module_expsym_cmds, $1)=
-_LT_TAGVAR(link_all_deplibs, $1)=unknown
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-_LT_TAGVAR(no_undefined_flag, $1)=
-_LT_TAGVAR(whole_archive_flag_spec, $1)=
-_LT_TAGVAR(enable_shared_with_static_runtimes, $1)=no
-
-# Source file extension for fc test sources.
-ac_ext=${ac_fc_srcext-f}
-
-# Object file extension for compiled fc test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# No sense in running all these tests if we already determined that
-# the FC 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_FC" != 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.
- _LT_TAG_COMPILER
-
- # save warnings/boilerplate of simple test code
- _LT_COMPILER_BOILERPLATE
- _LT_LINKER_BOILERPLATE
-
- # Allow CC to be a program name with arguments.
- lt_save_CC="$CC"
- lt_save_GCC=$GCC
- lt_save_CFLAGS=$CFLAGS
- CC=${FC-"f95"}
- CFLAGS=$FCFLAGS
- compiler=$CC
- GCC=$ac_cv_fc_compiler_gnu
-
- _LT_TAGVAR(compiler, $1)=$CC
- _LT_CC_BASENAME([$compiler])
-
- if test -n "$compiler"; then
- AC_MSG_CHECKING([if libtool supports shared libraries])
- AC_MSG_RESULT([$can_build_shared])
-
- AC_MSG_CHECKING([whether to build shared libraries])
- 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
- AC_MSG_RESULT([$enable_shared])
-
- AC_MSG_CHECKING([whether to build static libraries])
- # Make sure either enable_shared or enable_static is yes.
- test "$enable_shared" = yes || enable_static=yes
- AC_MSG_RESULT([$enable_static])
-
- _LT_TAGVAR(GCC, $1)="$ac_cv_fc_compiler_gnu"
- _LT_TAGVAR(LD, $1)="$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_SYS_HIDDEN_LIBDEPS($1)
- _LT_COMPILER_PIC($1)
- _LT_COMPILER_C_O($1)
- _LT_COMPILER_FILE_LOCKS($1)
- _LT_LINKER_SHLIBS($1)
- _LT_SYS_DYNAMIC_LINKER($1)
- _LT_LINKER_HARDCODE_LIBPATH($1)
-
- _LT_CONFIG($1)
- fi # test -n "$compiler"
-
- GCC=$lt_save_GCC
- CC=$lt_save_CC
- CFLAGS=$lt_save_CFLAGS
-fi # test "$_lt_disable_FC" != yes
-
-AC_LANG_POP
-])# _LT_LANG_FC_CONFIG
-
-
-# _LT_LANG_GCJ_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Java Compiler compiler
-# are suitably defined. These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GCJ_CONFIG],
-[AC_REQUIRE([LT_PROG_GCJ])dnl
-AC_LANG_SAVE
-
-# Source file extension for Java test sources.
-ac_ext=java
-
-# Object file extension for compiled Java test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="class foo {}"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='public class conftest { public static void main(String[[]] argv) {}; }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
+])# AC_LIBTOOL_PROG_LD_SHLIBS
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GCJ-"gcj"}
-CFLAGS=$GCJFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# GCJ did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-if test -n "$compiler"; then
- _LT_COMPILER_NO_RTTI($1)
- _LT_COMPILER_PIC($1)
- _LT_COMPILER_C_O($1)
- _LT_COMPILER_FILE_LOCKS($1)
- _LT_LINKER_SHLIBS($1)
- _LT_LINKER_HARDCODE_LIBPATH($1)
-
- _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GCJ_CONFIG
-
-
-# _LT_LANG_GO_CONFIG([TAG])
-# --------------------------
-# Ensure that the configuration variables for the GNU Go compiler
-# are suitably defined. These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_GO_CONFIG],
-[AC_REQUIRE([LT_PROG_GO])dnl
-AC_LANG_SAVE
-
-# Source file extension for Go test sources.
-ac_ext=go
-
-# Object file extension for compiled Go test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code="package main; func main() { }"
-
-# Code to be used in simple link tests
-lt_simple_link_test_code='package main; func main() { }'
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC=$CC
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=yes
-CC=${GOC-"gccgo"}
-CFLAGS=$GOFLAGS
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_TAGVAR(LD, $1)="$LD"
-_LT_CC_BASENAME([$compiler])
-
-# Go did not exist at the time GCC didn't implicitly link libc in.
-_LT_TAGVAR(archive_cmds_need_lc, $1)=no
-
-_LT_TAGVAR(old_archive_cmds, $1)=$old_archive_cmds
-_LT_TAGVAR(reload_flag, $1)=$reload_flag
-_LT_TAGVAR(reload_cmds, $1)=$reload_cmds
-
-if test -n "$compiler"; then
- _LT_COMPILER_NO_RTTI($1)
- _LT_COMPILER_PIC($1)
- _LT_COMPILER_C_O($1)
- _LT_COMPILER_FILE_LOCKS($1)
- _LT_LINKER_SHLIBS($1)
- _LT_LINKER_HARDCODE_LIBPATH($1)
-
- _LT_CONFIG($1)
-fi
-
-AC_LANG_RESTORE
-
-GCC=$lt_save_GCC
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_GO_CONFIG
-
-
-# _LT_LANG_RC_CONFIG([TAG])
-# -------------------------
-# Ensure that the configuration variables for the Windows resource compiler
-# are suitably defined. These variables are subsequently used by _LT_CONFIG
-# to write the compiler configuration to `libtool'.
-m4_defun([_LT_LANG_RC_CONFIG],
-[AC_REQUIRE([LT_PROG_RC])dnl
-AC_LANG_SAVE
-
-# Source file extension for RC test sources.
-ac_ext=rc
-
-# Object file extension for compiled RC test sources.
-objext=o
-_LT_TAGVAR(objext, $1)=$objext
-
-# Code to be used in simple compile tests
-lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
-
-# Code to be used in simple link tests
-lt_simple_link_test_code="$lt_simple_compile_test_code"
-
-# ltmain only uses $CC for tagged configurations so make sure $CC is set.
-_LT_TAG_COMPILER
-
-# save warnings/boilerplate of simple test code
-_LT_COMPILER_BOILERPLATE
-_LT_LINKER_BOILERPLATE
-
-# Allow CC to be a program name with arguments.
-lt_save_CC="$CC"
-lt_save_CFLAGS=$CFLAGS
-lt_save_GCC=$GCC
-GCC=
-CC=${RC-"windres"}
-CFLAGS=
-compiler=$CC
-_LT_TAGVAR(compiler, $1)=$CC
-_LT_CC_BASENAME([$compiler])
-_LT_TAGVAR(lt_cv_prog_compiler_c_o, $1)=yes
-
-if test -n "$compiler"; then
- :
- _LT_CONFIG($1)
-fi
-
-GCC=$lt_save_GCC
-AC_LANG_RESTORE
-CC=$lt_save_CC
-CFLAGS=$lt_save_CFLAGS
-])# _LT_LANG_RC_CONFIG
+# _LT_AC_FILE_LTDLL_C
+# -------------------
+# Be careful that the start marker always follows a newline.
+AC_DEFUN([_LT_AC_FILE_LTDLL_C], [
+# /* ltdll.c starts here */
+# #define WIN32_LEAN_AND_MEAN
+# #include <windows.h>
+# #undef WIN32_LEAN_AND_MEAN
+# #include <stdio.h>
+#
+# #ifndef __CYGWIN__
+# # ifdef __CYGWIN32__
+# # define __CYGWIN__ __CYGWIN32__
+# # endif
+# #endif
+#
+# #ifdef __cplusplus
+# extern "C" {
+# #endif
+# BOOL APIENTRY DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved);
+# #ifdef __cplusplus
+# }
+# #endif
+#
+# #ifdef __CYGWIN__
+# #include <cygwin/cygwin_dll.h>
+# DECLARE_CYGWIN_DLL( DllMain );
+# #endif
+# HINSTANCE __hDllInstance_base;
+#
+# BOOL APIENTRY
+# DllMain (HINSTANCE hInst, DWORD reason, LPVOID reserved)
+# {
+# __hDllInstance_base = hInst;
+# return TRUE;
+# }
+# /* ltdll.c ends here */
+])# _LT_AC_FILE_LTDLL_C
-# LT_PROG_GCJ
-# -----------
-AC_DEFUN([LT_PROG_GCJ],
-[m4_ifdef([AC_PROG_GCJ], [AC_PROG_GCJ],
- [m4_ifdef([A][M_PROG_GCJ], [A][M_PROG_GCJ],
- [AC_CHECK_TOOL(GCJ, gcj,)
- test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
- AC_SUBST(GCJFLAGS)])])[]dnl
-])
-# Old name:
-AU_ALIAS([LT_AC_PROG_GCJ], [LT_PROG_GCJ])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_GCJ], [])
+# _LT_AC_TAGVAR(VARNAME, [TAGNAME])
+# ---------------------------------
+AC_DEFUN([_LT_AC_TAGVAR], [ifelse([$2], [], [$1], [$1_$2])])
-# LT_PROG_GO
-# ----------
-AC_DEFUN([LT_PROG_GO],
-[AC_CHECK_TOOL(GOC, gccgo,)
-])
+# old names
+AC_DEFUN([AM_PROG_LIBTOOL], [AC_PROG_LIBTOOL])
+AC_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
+AC_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
+AC_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
+AC_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
+AC_DEFUN([AM_PROG_LD], [AC_PROG_LD])
+AC_DEFUN([AM_PROG_NM], [AC_PROG_NM])
+# This is just to silence aclocal about the macro not being used
+ifelse([AC_DISABLE_FAST_INSTALL])
-# LT_PROG_RC
-# ----------
-AC_DEFUN([LT_PROG_RC],
-[AC_CHECK_TOOL(RC, windres,)
+AC_DEFUN([LT_AC_PROG_GCJ],
+[AC_CHECK_TOOL(GCJ, gcj, no)
+ test "x${GCJFLAGS+set}" = xset || GCJFLAGS="-g -O2"
+ AC_SUBST(GCJFLAGS)
])
-# Old name:
-AU_ALIAS([LT_AC_PROG_RC], [LT_PROG_RC])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_RC], [])
-
-
-# _LT_DECL_EGREP
-# --------------
-# If we don't have a new enough Autoconf to choose the best grep
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_EGREP],
-[AC_REQUIRE([AC_PROG_EGREP])dnl
-AC_REQUIRE([AC_PROG_FGREP])dnl
-test -z "$GREP" && GREP=grep
-_LT_DECL([], [GREP], [1], [A grep program that handles long lines])
-_LT_DECL([], [EGREP], [1], [An ERE matcher])
-_LT_DECL([], [FGREP], [1], [A literal string matcher])
-dnl Non-bleeding-edge autoconf doesn't subst GREP, so do it here too
-AC_SUBST([GREP])
+AC_DEFUN([LT_AC_PROG_RC],
+[AC_CHECK_TOOL(RC, windres, no)
])
-# _LT_DECL_OBJDUMP
-# --------------
-# If we don't have a new enough Autoconf to choose the best objdump
-# available, choose the one first in the user's PATH.
-m4_defun([_LT_DECL_OBJDUMP],
-[AC_CHECK_TOOL(OBJDUMP, objdump, false)
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [An object symbol dumper])
-AC_SUBST([OBJDUMP])
-])
+# Cheap backport of AS_EXECUTABLE_P and required macros
+# from Autoconf 2.59; we should not use $as_executable_p directly.
-# _LT_DECL_DLLTOOL
+# _AS_TEST_PREPARE
# ----------------
-# Ensure DLLTOOL variable is set.
-m4_defun([_LT_DECL_DLLTOOL],
-[AC_CHECK_TOOL(DLLTOOL, dlltool, false)
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])
-AC_SUBST([DLLTOOL])
-])
+m4_ifndef([_AS_TEST_PREPARE],
+[m4_defun([_AS_TEST_PREPARE],
+[if test -x / >/dev/null 2>&1; then
+ as_executable_p='test -x'
+else
+ as_executable_p='test -f'
+fi
+])])# _AS_TEST_PREPARE
-# _LT_DECL_SED
-# ------------
-# Check for a fully-functional sed program, that truncates
-# as few characters as possible. Prefer GNU sed if found.
-m4_defun([_LT_DECL_SED],
-[AC_PROG_SED
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-_LT_DECL([], [SED], [1], [A sed program that does not truncate output])
-_LT_DECL([], [Xsed], ["\$SED -e 1s/^X//"],
- [Sed that helps us avoid accidentally triggering echo(1) options like -n])
-])# _LT_DECL_SED
+# AS_EXECUTABLE_P
+# ---------------
+# Check whether a file is executable.
+m4_ifndef([AS_EXECUTABLE_P],
+[m4_defun([AS_EXECUTABLE_P],
+[AS_REQUIRE([_AS_TEST_PREPARE])dnl
+$as_executable_p $1[]dnl
+])])# AS_EXECUTABLE_P
-m4_ifndef([AC_PROG_SED], [
# NOTE: This macro has been submitted for inclusion into #
# GNU Autoconf as AC_PROG_SED. When it is available in #
# a released version of Autoconf we should remove this #
# macro and use it instead. #
-
-m4_defun([AC_PROG_SED],
+# LT_AC_PROG_SED
+# --------------
+# Check for a fully-functional sed program, that truncates
+# as few characters as possible. Prefer GNU sed if found.
+AC_DEFUN([LT_AC_PROG_SED],
[AC_MSG_CHECKING([for a sed that does not truncate output])
AC_CACHE_VAL(lt_cv_path_SED,
[# Loop through the user's path and test for sed and gsed.
@@ -7722,7 +6533,7 @@ do
test -z "$as_dir" && as_dir=.
for lt_ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if $as_executable_p "$as_dir/$lt_ac_prog$ac_exec_ext"; then
+ if AS_EXECUTABLE_P(["$as_dir/$lt_ac_prog$ac_exec_ext"]); then
lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
fi
done
@@ -7763,898 +6574,57 @@ done
SED=$lt_cv_path_SED
AC_SUBST([SED])
AC_MSG_RESULT([$SED])
-])#AC_PROG_SED
-])#m4_ifndef
-
-# Old name:
-AU_ALIAS([LT_AC_PROG_SED], [AC_PROG_SED])
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([LT_AC_PROG_SED], [])
-
-
-# _LT_CHECK_SHELL_FEATURES
-# ------------------------
-# Find out whether the shell is Bourne or XSI compatible,
-# or has some other useful features.
-m4_defun([_LT_CHECK_SHELL_FEATURES],
-[AC_MSG_CHECKING([whether the shell understands some XSI constructs])
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
- test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
- = c,a/b,b/c, \
- && eval 'test $(( 1 + 1 )) -eq 2 \
- && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
- && xsi_shell=yes
-AC_MSG_RESULT([$xsi_shell])
-_LT_CONFIG_LIBTOOL_INIT([xsi_shell='$xsi_shell'])
-
-AC_MSG_CHECKING([whether the shell understands "+="])
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$[1]+=\$[2]" && test "$foo" = barbaz ) \
- >/dev/null 2>&1 \
- && lt_shell_append=yes
-AC_MSG_RESULT([$lt_shell_append])
-_LT_CONFIG_LIBTOOL_INIT([lt_shell_append='$lt_shell_append'])
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- lt_unset=unset
-else
- lt_unset=false
-fi
-_LT_DECL([], [lt_unset], [0], [whether the shell understands "unset"])dnl
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
- # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
- lt_SP2NL='tr \040 \012'
- lt_NL2SP='tr \015\012 \040\040'
- ;;
- *) # EBCDIC based system
- lt_SP2NL='tr \100 \n'
- lt_NL2SP='tr \r\n \100\100'
- ;;
-esac
-_LT_DECL([SP2NL], [lt_SP2NL], [1], [turn spaces into newlines])dnl
-_LT_DECL([NL2SP], [lt_NL2SP], [1], [turn newlines into spaces])dnl
-])# _LT_CHECK_SHELL_FEATURES
-
-
-# _LT_PROG_FUNCTION_REPLACE (FUNCNAME, REPLACEMENT-BODY)
-# ------------------------------------------------------
-# In `$cfgfile', look for function FUNCNAME delimited by `^FUNCNAME ()$' and
-# '^} FUNCNAME ', and replace its body with REPLACEMENT-BODY.
-m4_defun([_LT_PROG_FUNCTION_REPLACE],
-[dnl {
-sed -e '/^$1 ()$/,/^} # $1 /c\
-$1 ()\
-{\
-m4_bpatsubsts([$2], [$], [\\], [^\([ ]\)], [\\\1])
-} # Extended-shell $1 implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-])
-
-
-# _LT_PROG_REPLACE_SHELLFNS
-# -------------------------
-# Replace existing portable implementations of several shell functions with
-# equivalent extended shell implementations where those features are available..
-m4_defun([_LT_PROG_REPLACE_SHELLFNS],
-[if test x"$xsi_shell" = xyes; then
- _LT_PROG_FUNCTION_REPLACE([func_dirname], [dnl
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac])
-
- _LT_PROG_FUNCTION_REPLACE([func_basename], [dnl
- func_basename_result="${1##*/}"])
-
- _LT_PROG_FUNCTION_REPLACE([func_dirname_and_basename], [dnl
- case ${1} in
- */*) func_dirname_result="${1%/*}${2}" ;;
- * ) func_dirname_result="${3}" ;;
- esac
- func_basename_result="${1##*/}"])
-
- _LT_PROG_FUNCTION_REPLACE([func_stripname], [dnl
- # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are
- # positional parameters, so assign one to ordinary parameter first.
- func_stripname_result=${3}
- func_stripname_result=${func_stripname_result#"${1}"}
- func_stripname_result=${func_stripname_result%"${2}"}])
-
- _LT_PROG_FUNCTION_REPLACE([func_split_long_opt], [dnl
- func_split_long_opt_name=${1%%=*}
- func_split_long_opt_arg=${1#*=}])
-
- _LT_PROG_FUNCTION_REPLACE([func_split_short_opt], [dnl
- func_split_short_opt_arg=${1#??}
- func_split_short_opt_name=${1%"$func_split_short_opt_arg"}])
-
- _LT_PROG_FUNCTION_REPLACE([func_lo2o], [dnl
- case ${1} in
- *.lo) func_lo2o_result=${1%.lo}.${objext} ;;
- *) func_lo2o_result=${1} ;;
- esac])
-
- _LT_PROG_FUNCTION_REPLACE([func_xform], [ func_xform_result=${1%.*}.lo])
-
- _LT_PROG_FUNCTION_REPLACE([func_arith], [ func_arith_result=$(( $[*] ))])
-
- _LT_PROG_FUNCTION_REPLACE([func_len], [ func_len_result=${#1}])
-fi
-
-if test x"$lt_shell_append" = xyes; then
- _LT_PROG_FUNCTION_REPLACE([func_append], [ eval "${1}+=\\${2}"])
-
- _LT_PROG_FUNCTION_REPLACE([func_append_quoted], [dnl
- func_quote_for_eval "${2}"
-dnl m4 expansion turns \\\\ into \\, and then the shell eval turns that into \
- eval "${1}+=\\\\ \\$func_quote_for_eval_result"])
-
- # Save a `func_append' function call where possible by direct use of '+='
- sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
- test 0 -eq $? || _lt_function_replace_fail=:
-else
- # Save a `func_append' function call even when '+=' is not available
- sed -e 's%func_append \([[a-zA-Z_]]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
- test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
- AC_MSG_WARN([Unable to substitute extended shell functions in $ofile])
-fi
-])
-
-# _LT_PATH_CONVERSION_FUNCTIONS
-# -----------------------------
-# Determine which file name conversion functions should be used by
-# func_to_host_file (and, implicitly, by func_to_host_path). These are needed
-# for certain cross-compile configurations and native mingw.
-m4_defun([_LT_PATH_CONVERSION_FUNCTIONS],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-AC_REQUIRE([AC_CANONICAL_BUILD])dnl
-AC_MSG_CHECKING([how to convert $build file names to $host format])
-AC_CACHE_VAL(lt_cv_to_host_file_cmd,
-[case $host in
- *-*-mingw* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
- ;;
- *-*-cygwin* )
- lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
- ;;
- * ) # otherwise, assume *nix
- lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
- ;;
- esac
- ;;
- *-*-cygwin* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
- ;;
- *-*-cygwin* )
- lt_cv_to_host_file_cmd=func_convert_file_noop
- ;;
- * ) # otherwise, assume *nix
- lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
- ;;
- esac
- ;;
- * ) # unhandled hosts (and "normal" native builds)
- lt_cv_to_host_file_cmd=func_convert_file_noop
- ;;
-esac
-])
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-AC_MSG_RESULT([$lt_cv_to_host_file_cmd])
-_LT_DECL([to_host_file_cmd], [lt_cv_to_host_file_cmd],
- [0], [convert $build file names to $host format])dnl
-
-AC_MSG_CHECKING([how to convert $build file names to toolchain format])
-AC_CACHE_VAL(lt_cv_to_tool_file_cmd,
-[#assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
- *-*-mingw* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
- ;;
- esac
- ;;
-esac
-])
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-AC_MSG_RESULT([$lt_cv_to_tool_file_cmd])
-_LT_DECL([to_tool_file_cmd], [lt_cv_to_tool_file_cmd],
- [0], [convert $build files to toolchain format])dnl
-])# _LT_PATH_CONVERSION_FUNCTIONS
-
-# Helper functions for option handling. -*- Autoconf -*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation,
-# Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 7 ltoptions.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])])
-
-
-# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME)
-# ------------------------------------------
-m4_define([_LT_MANGLE_OPTION],
-[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])])
-
-
-# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME)
-# ---------------------------------------
-# Set option OPTION-NAME for macro MACRO-NAME, and if there is a
-# matching handler defined, dispatch to it. Other OPTION-NAMEs are
-# saved as a flag.
-m4_define([_LT_SET_OPTION],
-[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl
-m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]),
- _LT_MANGLE_DEFUN([$1], [$2]),
- [m4_warning([Unknown $1 option `$2'])])[]dnl
-])
-
-
-# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET])
-# ------------------------------------------------------------
-# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise.
-m4_define([_LT_IF_OPTION],
-[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])])
-
-
-# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET)
-# -------------------------------------------------------
-# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME
-# are set.
-m4_define([_LT_UNLESS_OPTIONS],
-[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
- [m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option),
- [m4_define([$0_found])])])[]dnl
-m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3
-])[]dnl
-])
-
-
-# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST)
-# ----------------------------------------
-# OPTION-LIST is a space-separated list of Libtool options associated
-# with MACRO-NAME. If any OPTION has a matching handler declared with
-# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about
-# the unknown option and exit.
-m4_defun([_LT_SET_OPTIONS],
-[# Set options
-m4_foreach([_LT_Option], m4_split(m4_normalize([$2])),
- [_LT_SET_OPTION([$1], _LT_Option)])
-
-m4_if([$1],[LT_INIT],[
- dnl
- dnl Simply set some default values (i.e off) if boolean options were not
- dnl specified:
- _LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no
- ])
- _LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no
- ])
- dnl
- dnl If no reference was made to various pairs of opposing options, then
- dnl we run the default mode handler for the pair. For example, if neither
- dnl `shared' nor `disable-shared' was passed, we enable building of shared
- dnl archives by default:
- _LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED])
- _LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC])
- _LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC])
- _LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install],
- [_LT_ENABLE_FAST_INSTALL])
- ])
-])# _LT_SET_OPTIONS
-
-
-
-# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME)
-# -----------------------------------------
-m4_define([_LT_MANGLE_DEFUN],
-[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])])
-
-
-# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE)
-# -----------------------------------------------
-m4_define([LT_OPTION_DEFINE],
-[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl
-])# LT_OPTION_DEFINE
-
-
-# dlopen
-# ------
-LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes
-])
-
-AU_DEFUN([AC_LIBTOOL_DLOPEN],
-[_LT_SET_OPTION([LT_INIT], [dlopen])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `dlopen' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], [])
-
-
-# win32-dll
-# ---------
-# Declare package support for building win32 dll's.
-LT_OPTION_DEFINE([LT_INIT], [win32-dll],
-[enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
- AC_CHECK_TOOL(AS, as, false)
- AC_CHECK_TOOL(DLLTOOL, dlltool, false)
- AC_CHECK_TOOL(OBJDUMP, objdump, false)
- ;;
-esac
-
-test -z "$AS" && AS=as
-_LT_DECL([], [AS], [1], [Assembler program])dnl
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl
-])# win32-dll
-
-AU_DEFUN([AC_LIBTOOL_WIN32_DLL],
-[AC_REQUIRE([AC_CANONICAL_HOST])dnl
-_LT_SET_OPTION([LT_INIT], [win32-dll])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `win32-dll' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], [])
-
-
-# _LT_ENABLE_SHARED([DEFAULT])
-# ----------------------------
-# implement the --enable-shared flag, and supports the `shared' and
-# `disable-shared' LT_INIT options.
-# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_SHARED],
-[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([shared],
- [AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@],
- [build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])],
- [p=${PACKAGE-default}
- case $enableval in
- yes) enable_shared=yes ;;
- no) enable_shared=no ;;
- *)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac],
- [enable_shared=]_LT_ENABLE_SHARED_DEFAULT)
-
- _LT_DECL([build_libtool_libs], [enable_shared], [0],
- [Whether or not to build shared libraries])
-])# _LT_ENABLE_SHARED
-
-LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared])
-])
-
-AC_DEFUN([AC_DISABLE_SHARED],
-[_LT_SET_OPTION([LT_INIT], [disable-shared])
-])
-
-AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)])
-AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_SHARED], [])
-dnl AC_DEFUN([AM_DISABLE_SHARED], [])
-
-
-
-# _LT_ENABLE_STATIC([DEFAULT])
-# ----------------------------
-# implement the --enable-static flag, and support the `static' and
-# `disable-static' LT_INIT options.
-# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_STATIC],
-[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([static],
- [AS_HELP_STRING([--enable-static@<:@=PKGS@:>@],
- [build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])],
- [p=${PACKAGE-default}
- case $enableval in
- yes) enable_static=yes ;;
- no) enable_static=no ;;
- *)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac],
- [enable_static=]_LT_ENABLE_STATIC_DEFAULT)
-
- _LT_DECL([build_old_libs], [enable_static], [0],
- [Whether or not to build static libraries])
-])# _LT_ENABLE_STATIC
-
-LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])])
-
-# Old names:
-AC_DEFUN([AC_ENABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static])
-])
-
-AC_DEFUN([AC_DISABLE_STATIC],
-[_LT_SET_OPTION([LT_INIT], [disable-static])
-])
-
-AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)])
-AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AM_ENABLE_STATIC], [])
-dnl AC_DEFUN([AM_DISABLE_STATIC], [])
-
-
-
-# _LT_ENABLE_FAST_INSTALL([DEFAULT])
-# ----------------------------------
-# implement the --enable-fast-install flag, and support the `fast-install'
-# and `disable-fast-install' LT_INIT options.
-# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'.
-m4_define([_LT_ENABLE_FAST_INSTALL],
-[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl
-AC_ARG_ENABLE([fast-install],
- [AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@],
- [optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])],
- [p=${PACKAGE-default}
- case $enableval in
- yes) enable_fast_install=yes ;;
- no) enable_fast_install=no ;;
- *)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac],
- [enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT)
-
-_LT_DECL([fast_install], [enable_fast_install], [0],
- [Whether or not to optimize for fast installation])dnl
-])# _LT_ENABLE_FAST_INSTALL
-
-LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])])
-LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])])
-
-# Old names:
-AU_DEFUN([AC_ENABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `fast-install' option into LT_INIT's first parameter.])
-])
-
-AU_DEFUN([AC_DISABLE_FAST_INSTALL],
-[_LT_SET_OPTION([LT_INIT], [disable-fast-install])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you put
-the `disable-fast-install' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], [])
-dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], [])
-
-
-# _LT_WITH_PIC([MODE])
-# --------------------
-# implement the --with-pic flag, and support the `pic-only' and `no-pic'
-# LT_INIT options.
-# MODE is either `yes' or `no'. If omitted, it defaults to `both'.
-m4_define([_LT_WITH_PIC],
-[AC_ARG_WITH([pic],
- [AS_HELP_STRING([--with-pic@<:@=PKGS@:>@],
- [try to use only PIC/non-PIC objects @<:@default=use both@:>@])],
- [lt_p=${PACKAGE-default}
- case $withval in
- yes|no) pic_mode=$withval ;;
- *)
- pic_mode=default
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for lt_pkg in $withval; do
- IFS="$lt_save_ifs"
- if test "X$lt_pkg" = "X$lt_p"; then
- pic_mode=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac],
- [pic_mode=default])
-
-test -z "$pic_mode" && pic_mode=m4_default([$1], [default])
-
-_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl
-])# _LT_WITH_PIC
-
-LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])])
-LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])])
-
-# Old name:
-AU_DEFUN([AC_LIBTOOL_PICMODE],
-[_LT_SET_OPTION([LT_INIT], [pic-only])
-AC_DIAGNOSE([obsolete],
-[$0: Remove this warning and the call to _LT_SET_OPTION when you
-put the `pic-only' option into LT_INIT's first parameter.])
-])
-
-dnl aclocal-1.4 backwards compatibility:
-dnl AC_DEFUN([AC_LIBTOOL_PICMODE], [])
-
-
-m4_define([_LTDL_MODE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive],
- [m4_define([_LTDL_MODE], [nonrecursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [recursive],
- [m4_define([_LTDL_MODE], [recursive])])
-LT_OPTION_DEFINE([LTDL_INIT], [subproject],
- [m4_define([_LTDL_MODE], [subproject])])
-
-m4_define([_LTDL_TYPE], [])
-LT_OPTION_DEFINE([LTDL_INIT], [installable],
- [m4_define([_LTDL_TYPE], [installable])])
-LT_OPTION_DEFINE([LTDL_INIT], [convenience],
- [m4_define([_LTDL_TYPE], [convenience])])
-
-# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc.
-# Written by Gary V. Vaughan, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# serial 6 ltsugar.m4
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])])
-
-
-# lt_join(SEP, ARG1, [ARG2...])
-# -----------------------------
-# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their
-# associated separator.
-# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier
-# versions in m4sugar had bugs.
-m4_define([lt_join],
-[m4_if([$#], [1], [],
- [$#], [2], [[$2]],
- [m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])])
-m4_define([_lt_join],
-[m4_if([$#$2], [2], [],
- [m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])])
-
-
-# lt_car(LIST)
-# lt_cdr(LIST)
-# ------------
-# Manipulate m4 lists.
-# These macros are necessary as long as will still need to support
-# Autoconf-2.59 which quotes differently.
-m4_define([lt_car], [[$1]])
-m4_define([lt_cdr],
-[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])],
- [$#], 1, [],
- [m4_dquote(m4_shift($@))])])
-m4_define([lt_unquote], $1)
-
-
-# lt_append(MACRO-NAME, STRING, [SEPARATOR])
-# ------------------------------------------
-# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'.
-# Note that neither SEPARATOR nor STRING are expanded; they are appended
-# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked).
-# No SEPARATOR is output if MACRO-NAME was previously undefined (different
-# than defined and empty).
-#
-# This macro is needed until we can rely on Autoconf 2.62, since earlier
-# versions of m4sugar mistakenly expanded SEPARATOR but not STRING.
-m4_define([lt_append],
-[m4_define([$1],
- m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])])
-
-
-
-# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...])
-# ----------------------------------------------------------
-# Produce a SEP delimited list of all paired combinations of elements of
-# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list
-# has the form PREFIXmINFIXSUFFIXn.
-# Needed until we can rely on m4_combine added in Autoconf 2.62.
-m4_define([lt_combine],
-[m4_if(m4_eval([$# > 3]), [1],
- [m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl
-[[m4_foreach([_Lt_prefix], [$2],
- [m4_foreach([_Lt_suffix],
- ]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[,
- [_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])])
-
-
-# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ])
-# -----------------------------------------------------------------------
-# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited
-# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ.
-m4_define([lt_if_append_uniq],
-[m4_ifdef([$1],
- [m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1],
- [lt_append([$1], [$2], [$3])$4],
- [$5])],
- [lt_append([$1], [$2], [$3])$4])])
-
-
-# lt_dict_add(DICT, KEY, VALUE)
-# -----------------------------
-m4_define([lt_dict_add],
-[m4_define([$1($2)], [$3])])
-
-
-# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE)
-# --------------------------------------------
-m4_define([lt_dict_add_subkey],
-[m4_define([$1($2:$3)], [$4])])
-
-
-# lt_dict_fetch(DICT, KEY, [SUBKEY])
-# ----------------------------------
-m4_define([lt_dict_fetch],
-[m4_ifval([$3],
- m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]),
- m4_ifdef([$1($2)], [m4_defn([$1($2)])]))])
-
-
-# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE])
-# -----------------------------------------------------------------
-m4_define([lt_if_dict_fetch],
-[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4],
- [$5],
- [$6])])
-
-
-# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...])
-# --------------------------------------------------------------
-m4_define([lt_dict_filter],
-[m4_if([$5], [], [],
- [lt_join(m4_quote(m4_default([$4], [[, ]])),
- lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]),
- [lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl
-])
-
-# ltversion.m4 -- version numbers -*- Autoconf -*-
-#
-# Copyright (C) 2004 Free Software Foundation, Inc.
-# Written by Scott James Remnant, 2004
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
-
-# @configure_input@
-
-# serial 3337 ltversion.m4
-# This file is part of GNU Libtool
-
-m4_define([LT_PACKAGE_VERSION], [2.4.2])
-m4_define([LT_PACKAGE_REVISION], [1.3337])
-
-AC_DEFUN([LTVERSION_VERSION],
-[macro_version='2.4.2'
-macro_revision='1.3337'
-_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?])
-_LT_DECL(, macro_revision, 0)
])
-# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*-
-#
-# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc.
-# Written by Scott James Remnant, 2004.
-#
-# This file is free software; the Free Software Foundation gives
-# unlimited permission to copy and/or distribute it, with or without
-# modifications, as long as this notice is preserved.
+# -*- Autoconf -*-
+# Copyright (C) 2002, 2003 Free Software Foundation, Inc.
+# Generated from amversion.in; do not edit by hand.
-# serial 5 lt~obsolete.m4
+# 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, or (at your option)
+# any later version.
-# These exist entirely to fool aclocal when bootstrapping libtool.
-#
-# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN)
-# which have later been changed to m4_define as they aren't part of the
-# exported API, or moved to Autoconf or Automake where they belong.
-#
-# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN
-# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us
-# using a macro with the same name in our local m4/libtool.m4 it'll
-# pull the old libtool.m4 in (it doesn't see our shiny new m4_define
-# and doesn't know about Autoconf macros at all.)
-#
-# So we provide this file, which has a silly filename so it's always
-# included after everything else. This provides aclocal with the
-# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything
-# because those macros already exist, or will be overwritten later.
-# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6.
-#
-# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here.
-# Yes, that means every name once taken will need to remain here until
-# we give up compatibility with versions before 1.7, at which point
-# we need to keep only those names which we still refer to.
-
-# This is to help aclocal find these macros, as it can't see m4_define.
-AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])])
-
-m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])])
-m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])])
-m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])])
-m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])])
-m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])])
-m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])])
-m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])])
-m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])])
-m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])])
-m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])])
-m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])])
-m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])])
-m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])])
-m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])])
-m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])])
-m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])])
-m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])])
-m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])])
-m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])])
-m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])])
-m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])])
-m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])])
-m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])])
-m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])])
-m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])])
-m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])])
-m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])])
-m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])])
-m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])])
-m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])])
-m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])])
-m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])])
-m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])])
-m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])])
-m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])])
-m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])])
-m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])])
-m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])])
-m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])])
-m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])])
-m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])])
-m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])])
-m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])])
-m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])])
-m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])])
-m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])])
-m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])])
-m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])])
-m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])])
-m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])])
-m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])])
-m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])])
-m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])])
-m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])])
-m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])])
-
-# Copyright (C) 2002, 2003, 2005, 2006, 2007, 2008, 2011 Free Software
-# Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# 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.
-# serial 1
+# 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.
# AM_AUTOMAKE_VERSION(VERSION)
# ----------------------------
# Automake X.Y traces this macro to ensure aclocal.m4 has been
# generated from the m4 files accompanying Automake X.Y.
-# (This private macro should not be called outside this file.)
-AC_DEFUN([AM_AUTOMAKE_VERSION],
-[am__api_version='1.11'
-dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to
-dnl require some minimum version. Point them to the right macro.
-m4_if([$1], [1.11.6], [],
- [AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl
-])
-
-# _AM_AUTOCONF_VERSION(VERSION)
-# -----------------------------
-# aclocal traces this macro to find the Autoconf version.
-# This is a private macro too. Using m4_define simplifies
-# the logic in aclocal, which can simply ignore this definition.
-m4_define([_AM_AUTOCONF_VERSION], [])
+AC_DEFUN([AM_AUTOMAKE_VERSION], [am__api_version="1.8"])
# AM_SET_CURRENT_AUTOMAKE_VERSION
# -------------------------------
-# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced.
-# This function is AC_REQUIREd by AM_INIT_AUTOMAKE.
+# Call AM_AUTOMAKE_VERSION so it can be traced.
+# This function is AC_REQUIREd by AC_INIT_AUTOMAKE.
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION],
-[AM_AUTOMAKE_VERSION([1.11.6])dnl
-m4_ifndef([AC_AUTOCONF_VERSION],
- [m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl
-_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))])
+ [AM_AUTOMAKE_VERSION([1.8.4])])
-# AM_AUX_DIR_EXPAND -*- Autoconf -*-
+# AM_AUX_DIR_EXPAND
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 2001, 2003 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 Foundation; either version 2, 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.
-# serial 1
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets
# $ac_aux_dir to `$srcdir/foo'. In other projects, it is set to
@@ -8701,16 +6671,26 @@ AC_PREREQ([2.50])dnl
am_aux_dir=`cd $ac_aux_dir && pwd`
])
-# AM_CONDITIONAL -*- Autoconf -*-
+# AM_CONDITIONAL -*- Autoconf -*-
-# Copyright (C) 1997, 2000, 2001, 2003, 2004, 2005, 2006, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 1997, 2000, 2001, 2003 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 Foundation; either version 2, 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.
-# serial 9
+
+# serial 6
# AM_CONDITIONAL(NAME, SHELL-CONDITION)
# -------------------------------------
@@ -8719,11 +6699,8 @@ AC_DEFUN([AM_CONDITIONAL],
[AC_PREREQ(2.52)dnl
ifelse([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])],
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl
-AC_SUBST([$1_TRUE])dnl
-AC_SUBST([$1_FALSE])dnl
-_AM_SUBST_NOTMAKE([$1_TRUE])dnl
-_AM_SUBST_NOTMAKE([$1_FALSE])dnl
-m4_define([_AM_COND_VALUE_$1], [$2])dnl
+AC_SUBST([$1_TRUE])
+AC_SUBST([$1_FALSE])
if $2; then
$1_TRUE=
$1_FALSE='#'
@@ -8733,24 +6710,58 @@ else
fi
AC_CONFIG_COMMANDS_PRE(
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then
- AC_MSG_ERROR([[conditional "$1" was never defined.
-Usually this means the macro was only invoked conditionally.]])
+ AC_MSG_ERROR([conditional "$1" was never defined.
+Usually this means the macro was only invoked conditionally.])
fi])])
-# Do all the work for Automake. -*- Autoconf -*-
+# Like AC_CONFIG_HEADER, but automatically create stamp file. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004,
-# 2005, 2006, 2008, 2009 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 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 Foundation; either version 2, 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.
+
+# serial 7
+
+# AM_CONFIG_HEADER is obsolete. It has been replaced by AC_CONFIG_HEADERS.
+AU_DEFUN([AM_CONFIG_HEADER], [AC_CONFIG_HEADERS($@)])
-# serial 16
+# Do all the work for Automake. -*- Autoconf -*-
-# This macro actually does too much. Some checks are only needed if
+# This macro actually does too much some checks are only needed if
# your package does certain things. But this isn't really a big deal.
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
+# 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 Foundation; either version 2, 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.
+
+
+# serial 11
+
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE])
# AM_INIT_AUTOMAKE([OPTIONS])
# -----------------------------------------------
@@ -8763,20 +6774,16 @@ fi])])
# arguments mandatory, and then we can depend on a new Autoconf
# release and drop the old call support.
AC_DEFUN([AM_INIT_AUTOMAKE],
-[AC_PREREQ([2.62])dnl
+[AC_PREREQ([2.58])dnl
dnl Autoconf wants to disallow AM_ names. We explicitly allow
dnl the ones we care about.
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl
AC_REQUIRE([AC_PROG_INSTALL])dnl
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
- # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
- # is not polluted with repeated "-I."
- AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl
- # test to see if srcdir already configured
- if test -f $srcdir/config.status; then
- AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
- fi
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ AC_MSG_ERROR([source directory already configured; run "make distclean" there first])
fi
# test whether we have cygpath
@@ -8796,9 +6803,6 @@ m4_ifval([$2],
AC_SUBST([PACKAGE], [$1])dnl
AC_SUBST([VERSION], [$2])],
[_AM_SET_OPTIONS([$1])dnl
-dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT.
-m4_if(m4_ifdef([AC_PACKAGE_NAME], 1)m4_ifdef([AC_PACKAGE_VERSION], 1), 11,,
- [m4_fatal([AC_INIT should be called with package and version arguments])])dnl
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl
@@ -8814,46 +6818,28 @@ AM_MISSING_PROG(AUTOCONF, autoconf)
AM_MISSING_PROG(AUTOMAKE, automake-${am__api_version})
AM_MISSING_PROG(AUTOHEADER, autoheader)
AM_MISSING_PROG(MAKEINFO, makeinfo)
-AC_REQUIRE([AM_PROG_INSTALL_SH])dnl
-AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl
+AM_MISSING_PROG(AMTAR, tar)
+AM_PROG_INSTALL_SH
+AM_PROG_INSTALL_STRIP
AC_REQUIRE([AM_PROG_MKDIR_P])dnl
# We need awk for the "check" target. The system "awk" is bad on
# some platforms.
AC_REQUIRE([AC_PROG_AWK])dnl
AC_REQUIRE([AC_PROG_MAKE_SET])dnl
AC_REQUIRE([AM_SET_LEADING_DOT])dnl
-_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])],
- [_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])],
- [_AM_PROG_TAR([v7])])])
+
_AM_IF_OPTION([no-dependencies],,
[AC_PROVIDE_IFELSE([AC_PROG_CC],
- [_AM_DEPENDENCIES(CC)],
- [define([AC_PROG_CC],
- defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
+ [_AM_DEPENDENCIES(CC)],
+ [define([AC_PROG_CC],
+ defn([AC_PROG_CC])[_AM_DEPENDENCIES(CC)])])dnl
AC_PROVIDE_IFELSE([AC_PROG_CXX],
- [_AM_DEPENDENCIES(CXX)],
- [define([AC_PROG_CXX],
- defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
-AC_PROVIDE_IFELSE([AC_PROG_OBJC],
- [_AM_DEPENDENCIES(OBJC)],
- [define([AC_PROG_OBJC],
- defn([AC_PROG_OBJC])[_AM_DEPENDENCIES(OBJC)])])dnl
+ [_AM_DEPENDENCIES(CXX)],
+ [define([AC_PROG_CXX],
+ defn([AC_PROG_CXX])[_AM_DEPENDENCIES(CXX)])])dnl
])
-_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl
-dnl The `parallel-tests' driver may need to know about EXEEXT, so add the
-dnl `am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro
-dnl is hooked onto _AC_COMPILER_EXEEXT early, see below.
-AC_CONFIG_COMMANDS_PRE(dnl
-[m4_provide_if([_AM_COMPILER_EXEEXT],
- [AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl
])
-dnl Hook into `_AC_COMPILER_EXEEXT' early to learn its expansion. Do not
-dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further
-dnl mangled by Autoconf and run in a shell conditional statement.
-m4_define([_AC_COMPILER_EXEEXT],
-m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
-
# When config.status generates a header, we must update the stamp-h file.
# This file resides in the same directory as the config header
@@ -8864,49 +6850,62 @@ m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])])
# our stamp files there.
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK],
[# Compute $1's index in $config_headers.
-_am_arg=$1
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
- $_am_arg | $_am_arg:* )
+ $1 | $1:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
-echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count])
-
-# Copyright (C) 2001, 2003, 2005, 2008, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
+echo "timestamp for $1" >`AS_DIRNAME([$1])`/stamp-h[]$_am_stamp_count])
# AM_PROG_INSTALL_SH
# ------------------
# Define $install_sh.
+
+# Copyright (C) 2001, 2003 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 Foundation; either version 2, 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.
+
+
AC_DEFUN([AM_PROG_INSTALL_SH],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-if test x"${install_sh}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
- *)
- install_sh="\${SHELL} $am_aux_dir/install-sh"
- esac
-fi
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
AC_SUBST(install_sh)])
-# Copyright (C) 2003, 2005 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# -*- Autoconf -*-
+# Copyright (C) 2003 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 Foundation; either version 2, 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.
-# serial 2
+
+# serial 1
# Check whether the underlying file-system supports filenames
# with a leading dot. For instance MS-DOS doesn't.
@@ -8921,14 +6920,26 @@ fi
rmdir .tst 2>/dev/null
AC_SUBST([am__leading_dot])])
-# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003, 2005
+
+# Copyright (C) 1998, 1999, 2000, 2001, 2002, 2003
# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-# serial 5
+# 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, 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.
+
+
+# serial 4
# AM_PROG_LEX
# -----------
@@ -8942,56 +6953,67 @@ if test "$LEX" = :; then
LEX=${am_missing_run}flex
fi])
-# Add --enable-maintainer-mode option to configure. -*- Autoconf -*-
+# Add --enable-maintainer-mode option to configure.
# From Jim Meyering
-# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004, 2005, 2008,
-# 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Copyright (C) 1996, 1998, 2000, 2001, 2002, 2003, 2004
+# Free Software Foundation, Inc.
-# serial 5
+# 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, 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.
+
+
+# serial 3
-# AM_MAINTAINER_MODE([DEFAULT-MODE])
-# ----------------------------------
-# Control maintainer-specific portions of Makefiles.
-# Default is to disable them, unless `enable' is passed literally.
-# For symmetry, `disable' may be passed as well. Anyway, the user
-# can override the default with the --enable/--disable switch.
AC_DEFUN([AM_MAINTAINER_MODE],
-[m4_case(m4_default([$1], [disable]),
- [enable], [m4_define([am_maintainer_other], [disable])],
- [disable], [m4_define([am_maintainer_other], [enable])],
- [m4_define([am_maintainer_other], [enable])
- m4_warn([syntax], [unexpected argument to AM@&t@_MAINTAINER_MODE: $1])])
-AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
- dnl maintainer-mode's default is 'disable' unless 'enable' is passed
- AC_ARG_ENABLE([maintainer-mode],
-[ --][am_maintainer_other][-maintainer-mode am_maintainer_other make rules and dependencies not useful
+[AC_MSG_CHECKING([whether to enable maintainer-specific portions of Makefiles])
+ dnl maintainer-mode is disabled by default
+ AC_ARG_ENABLE(maintainer-mode,
+[ --enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer],
- [USE_MAINTAINER_MODE=$enableval],
- [USE_MAINTAINER_MODE=]m4_if(am_maintainer_other, [enable], [no], [yes]))
+ USE_MAINTAINER_MODE=$enableval,
+ USE_MAINTAINER_MODE=no)
AC_MSG_RESULT([$USE_MAINTAINER_MODE])
- AM_CONDITIONAL([MAINTAINER_MODE], [test $USE_MAINTAINER_MODE = yes])
+ AM_CONDITIONAL(MAINTAINER_MODE, [test $USE_MAINTAINER_MODE = yes])
MAINT=$MAINTAINER_MODE_TRUE
- AC_SUBST([MAINT])dnl
+ AC_SUBST(MAINT)dnl
]
)
AU_DEFUN([jm_MAINTAINER_MODE], [AM_MAINTAINER_MODE])
-# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*-
+# -*- Autoconf -*-
-# Copyright (C) 1997, 1999, 2000, 2001, 2003, 2004, 2005, 2008
-# Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-# serial 6
+# Copyright (C) 1997, 1999, 2000, 2001, 2003 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 Foundation; either version 2, 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.
+
+
+# serial 3
# AM_MISSING_PROG(NAME, PROGRAM)
# ------------------------------
@@ -9007,15 +7029,7 @@ AC_SUBST($1)])
# If it does, set am_missing_run to use it, otherwise, to nothing.
AC_DEFUN([AM_MISSING_HAS_RUN],
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl
-AC_REQUIRE_AUX_FILE([missing])dnl
-if test x"${MISSING+set}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
- *)
- MISSING="\${SHELL} $am_aux_dir/missing" ;;
- esac
-fi
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
@@ -9025,45 +7039,92 @@ else
fi
])
-# Copyright (C) 2003, 2004, 2005, 2006, 2011 Free Software Foundation,
-# Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 1
-
# AM_PROG_MKDIR_P
# ---------------
-# Check for `mkdir -p'.
-AC_DEFUN([AM_PROG_MKDIR_P],
-[AC_PREREQ([2.60])dnl
-AC_REQUIRE([AC_PROG_MKDIR_P])dnl
-dnl Automake 1.8 to 1.9.6 used to define mkdir_p. We now use MKDIR_P,
-dnl while keeping a definition of mkdir_p for backward compatibility.
-dnl @MKDIR_P@ is magic: AC_OUTPUT adjusts its value for each Makefile.
-dnl However we cannot define mkdir_p as $(MKDIR_P) for the sake of
-dnl Makefile.ins that do not define MKDIR_P, so we do our own
-dnl adjustment using top_builddir (which is defined more often than
-dnl MKDIR_P).
-AC_SUBST([mkdir_p], ["$MKDIR_P"])dnl
-case $mkdir_p in
- [[\\/$]]* | ?:[[\\/]]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
-])
+# Check whether `mkdir -p' is supported, fallback to mkinstalldirs otherwise.
-# Helper functions for option handling. -*- Autoconf -*-
+# Copyright (C) 2003, 2004 Free Software Foundation, Inc.
-# Copyright (C) 2001, 2002, 2003, 2005, 2008, 2010 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 Foundation; either version 2, 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.
+
+
+# Automake 1.8 used `mkdir -m 0755 -p --' to ensure that directories
+# created by `make install' are always world readable, even if the
+# installer happens to have an overly restrictive umask (e.g. 077).
+# This was a mistake. There are at least two reasons why we must not
+# use `-m 0755':
+# - it causes special bits like SGID to be ignored,
+# - it may be too restrictive (some setups expect 775 directories).
#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Do not use -m 0755 and let people choose whatever they expect by
+# setting umask.
+#
+# We cannot accept any implementation of `mkdir' that recognizes `-p'.
+# Some implementations (such as Solaris 8's) are not thread-safe: if a
+# parallel make tries to run `mkdir -p a/b' and `mkdir -p a/c'
+# concurrently, both version can detect that a/ is missing, but only
+# one can create it and the other will error out. Consequently we
+# restrict ourselves to GNU make (using the --version option ensures
+# this.)
+AC_DEFUN([AM_PROG_MKDIR_P],
+[if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # Keeping the `.' argument allows $(mkdir_p) to be used without
+ # argument. Indeed, we sometimes output rules like
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined.
+ # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
+ # expensive solution, as it forces Make to start a sub-shell.)
+ mkdir_p='mkdir -p -- .'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
+ done
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
+ else
+ mkdir_p='$(install_sh) -d'
+ fi
+fi
+AC_SUBST([mkdir_p])])
+
+# Helper functions for option handling. -*- Autoconf -*-
-# serial 5
+# Copyright (C) 2001, 2002, 2003 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 Foundation; either version 2, 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.
+
+
+# serial 2
# _AM_MANGLE_OPTION(NAME)
# -----------------------
@@ -9071,16 +7132,16 @@ AC_DEFUN([_AM_MANGLE_OPTION],
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])])
# _AM_SET_OPTION(NAME)
-# --------------------
+# ------------------------------
# Set option NAME. Presently that only means defining a flag for this option.
AC_DEFUN([_AM_SET_OPTION],
[m4_define(_AM_MANGLE_OPTION([$1]), 1)])
# _AM_SET_OPTIONS(OPTIONS)
-# ------------------------
+# ----------------------------------
# OPTIONS is a space-separated list of Automake options.
AC_DEFUN([_AM_SET_OPTIONS],
-[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
+[AC_FOREACH([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])])
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET])
# -------------------------------------------
@@ -9088,16 +7149,65 @@ AC_DEFUN([_AM_SET_OPTIONS],
AC_DEFUN([_AM_IF_OPTION],
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])])
-# Check to make sure that the build environment is sane. -*- Autoconf -*-
-# Copyright (C) 1996, 1997, 2000, 2001, 2003, 2005, 2008
+# Copyright (C) 1996, 1997, 1998, 2000, 2001, 2002, 2003
# 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 Foundation; either version 2, 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.
+
+
+# serial 3
+
+AC_DEFUN([AM_C_PROTOTYPES],
+[AC_REQUIRE([AC_C_PROTOTYPES])
+if test "$ac_cv_prog_cc_stdc" != no; then
+ U= ANSI2KNR=
+else
+ U=_ ANSI2KNR=./ansi2knr
+fi
+# Ensure some checks needed by ansi2knr itself.
+AC_REQUIRE([AC_HEADER_STDC])
+AC_CHECK_HEADERS(string.h)
+AC_SUBST(U)dnl
+AC_SUBST(ANSI2KNR)dnl
+])
+
+AU_DEFUN([fp_C_PROTOTYPES], [AM_C_PROTOTYPES])
+
#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# Check to make sure that the build environment is sane.
+#
+
+# Copyright (C) 1996, 1997, 2000, 2001, 2003 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 Foundation; either version 2, 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.
+
-# serial 5
+# serial 3
# AM_SANITY_CHECK
# ---------------
@@ -9106,29 +7216,16 @@ AC_DEFUN([AM_SANITY_CHECK],
# Just in case
sleep 1
echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name. Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
- *[[\\\"\#\$\&\'\`$am_lf]]*)
- AC_MSG_ERROR([unsafe absolute working directory name]);;
-esac
-case $srcdir in
- *[[\\\"\#\$\&\'\`$am_lf\ \ ]]*)
- AC_MSG_ERROR([unsafe srcdir value: `$srcdir']);;
-esac
-
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$[*]" = "X"; then
# -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
+ set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$[*]" != "X $srcdir/configure conftest.file" \
@@ -9153,16 +7250,25 @@ Check your system clock])
fi
AC_MSG_RESULT(yes)])
-# Copyright (C) 2001, 2003, 2005, 2011 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
+# AM_PROG_INSTALL_STRIP
+
+# Copyright (C) 2001, 2003 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 Foundation; either version 2, 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.
-# serial 1
-# AM_PROG_INSTALL_STRIP
-# ---------------------
# One issue with vendor `install' (even GNU) is that you can't
# specify the program used to strip binaries. This is especially
# annoying in cross-compiling environments, where the build's strip
@@ -9180,123 +7286,7 @@ dnl Don't test for $cross_compiling = yes, because it might be `maybe'.
if test "$cross_compiling" != no; then
AC_CHECK_TOOL([STRIP], [strip], :)
fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
AC_SUBST([INSTALL_STRIP_PROGRAM])])
-# Copyright (C) 2006, 2008, 2010 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 3
-
-# _AM_SUBST_NOTMAKE(VARIABLE)
-# ---------------------------
-# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in.
-# This macro is traced by Automake.
-AC_DEFUN([_AM_SUBST_NOTMAKE])
-
-# AM_SUBST_NOTMAKE(VARIABLE)
-# --------------------------
-# Public sister of _AM_SUBST_NOTMAKE.
-AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)])
-
-# Check how to create a tarball. -*- Autoconf -*-
-
-# Copyright (C) 2004, 2005, 2012 Free Software Foundation, Inc.
-#
-# This file is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# serial 2
-
-# _AM_PROG_TAR(FORMAT)
-# --------------------
-# Check how to create a tarball in format FORMAT.
-# FORMAT should be one of `v7', `ustar', or `pax'.
-#
-# Substitute a variable $(am__tar) that is a command
-# writing to stdout a FORMAT-tarball containing the directory
-# $tardir.
-# tardir=directory && $(am__tar) > result.tar
-#
-# Substitute a variable $(am__untar) that extract such
-# a tarball read from stdin.
-# $(am__untar) < result.tar
-AC_DEFUN([_AM_PROG_TAR],
-[# Always define AMTAR for backward compatibility. Yes, it's still used
-# in the wild :-( We should find a proper way to deprecate it ...
-AC_SUBST([AMTAR], ['$${TAR-tar}'])
-m4_if([$1], [v7],
- [am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'],
- [m4_case([$1], [ustar],, [pax],,
- [m4_fatal([Unknown tar format])])
-AC_MSG_CHECKING([how to create a $1 tar archive])
-# Loop over all known methods to create a tar archive until one works.
-_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none'
-_am_tools=${am_cv_prog_tar_$1-$_am_tools}
-# Do not fold the above two line into one, because Tru64 sh and
-# Solaris sh will not grok spaces in the rhs of `-'.
-for _am_tool in $_am_tools
-do
- case $_am_tool in
- gnutar)
- for _am_tar in tar gnutar gtar;
- do
- AM_RUN_LOG([$_am_tar --version]) && break
- done
- am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"'
- am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"'
- am__untar="$_am_tar -xf -"
- ;;
- plaintar)
- # Must skip GNU tar: if it does not support --format= it doesn't create
- # ustar tarball either.
- (tar --version) >/dev/null 2>&1 && continue
- am__tar='tar chf - "$$tardir"'
- am__tar_='tar chf - "$tardir"'
- am__untar='tar xf -'
- ;;
- pax)
- am__tar='pax -L -x $1 -w "$$tardir"'
- am__tar_='pax -L -x $1 -w "$tardir"'
- am__untar='pax -r'
- ;;
- cpio)
- am__tar='find "$$tardir" -print | cpio -o -H $1 -L'
- am__tar_='find "$tardir" -print | cpio -o -H $1 -L'
- am__untar='cpio -i -H $1 -d'
- ;;
- none)
- am__tar=false
- am__tar_=false
- am__untar=false
- ;;
- esac
-
- # If the value was cached, stop now. We just wanted to have am__tar
- # and am__untar set.
- test -n "${am_cv_prog_tar_$1}" && break
-
- # tar/untar a dummy directory, and stop if the command works
- rm -rf conftest.dir
- mkdir conftest.dir
- echo GrepMe > conftest.dir/file
- AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar])
- rm -rf conftest.dir
- if test -s conftest.tar; then
- AM_RUN_LOG([$am__untar <conftest.tar])
- grep GrepMe conftest.dir/file >/dev/null 2>&1 && break
- fi
-done
-rm -rf conftest.dir
-
-AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool])
-AC_MSG_RESULT([$am_cv_prog_tar_$1])])
-AC_SUBST([am__tar])
-AC_SUBST([am__untar])
-]) # _AM_PROG_TAR
-
m4_include([acinclude.m4])
diff --git a/gmp/ansi2knr.1 b/gmp/ansi2knr.1
new file mode 100644
index 0000000000..f9ee5a631c
--- /dev/null
+++ b/gmp/ansi2knr.1
@@ -0,0 +1,36 @@
+.TH ANSI2KNR 1 "19 Jan 1996"
+.SH NAME
+ansi2knr \- convert ANSI C to Kernighan & Ritchie C
+.SH SYNOPSIS
+.I ansi2knr
+[--varargs] input_file [output_file]
+.SH DESCRIPTION
+If no output_file is supplied, output goes to stdout.
+.br
+There are no error messages.
+.sp
+.I ansi2knr
+recognizes function definitions by seeing a non-keyword identifier at the left
+margin, followed by a left parenthesis, with a right parenthesis as the last
+character on the line, and with a left brace as the first token on the
+following line (ignoring possible intervening comments). It will recognize a
+multi-line header provided that no intervening line ends with a left or right
+brace or a semicolon. These algorithms ignore whitespace and comments, except
+that the function name must be the first thing on the line.
+.sp
+The following constructs will confuse it:
+.br
+ - Any other construct that starts at the left margin and follows the
+above syntax (such as a macro or function call).
+.br
+ - Some macros that tinker with the syntax of the function header.
+.sp
+The --varargs switch is obsolete, and is recognized only for
+backwards compatibility. The present version of
+.I ansi2knr
+will always attempt to convert a ... argument to va_alist and va_dcl.
+.SH AUTHOR
+L. Peter Deutsch <ghost@aladdin.com> wrote the original ansi2knr and
+continues to maintain the current version; most of the code in the current
+version is his work. ansi2knr also includes contributions by Francois
+Pinard <pinard@iro.umontreal.ca> and Jim Avera <jima@netcom.com>.
diff --git a/gmp/ansi2knr.c b/gmp/ansi2knr.c
new file mode 100644
index 0000000000..b646b857af
--- /dev/null
+++ b/gmp/ansi2knr.c
@@ -0,0 +1,739 @@
+/* Copyright (C) 1989, 2000 Aladdin Enterprises. All rights reserved. */
+
+/*$Id$*/
+/* Convert ANSI C function definitions to K&R ("traditional C") syntax */
+
+/*
+ansi2knr is distributed in the hope that it will be useful, but WITHOUT ANY
+WARRANTY. No author or distributor accepts responsibility to anyone for the
+consequences of using it or for whether it serves any particular purpose or
+works at all, unless he says so in writing. Refer to the GNU General Public
+License (the "GPL") for full details.
+
+Everyone is granted permission to copy, modify and redistribute ansi2knr,
+but only under the conditions described in the GPL. A copy of this license
+is supposed to have been given to you along with ansi2knr so you can know
+your rights and responsibilities. It should be in a file named COPYLEFT,
+or, if there is no file named COPYLEFT, a file named COPYING. Among other
+things, the copyright notice and this notice must be preserved on all
+copies.
+
+We explicitly state here what we believe is already implied by the GPL: if
+the ansi2knr program is distributed as a separate set of sources and a
+separate executable file which are aggregated on a storage medium together
+with another program, this in itself does not bring the other program under
+the GPL, nor does the mere fact that such a program or the procedures for
+constructing it invoke the ansi2knr executable bring any other part of the
+program under the GPL.
+*/
+
+/*
+ * Usage:
+ ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]
+ * --filename provides the file name for the #line directive in the output,
+ * overriding input_file (if present).
+ * If no input_file is supplied, input is read from stdin.
+ * If no output_file is supplied, output goes to stdout.
+ * There are no error messages.
+ *
+ * ansi2knr recognizes function definitions by seeing a non-keyword
+ * identifier at the left margin, followed by a left parenthesis, with a
+ * right parenthesis as the last character on the line, and with a left
+ * brace as the first token on the following line (ignoring possible
+ * intervening comments and/or preprocessor directives), except that a line
+ * consisting of only
+ * identifier1(identifier2)
+ * will not be considered a function definition unless identifier2 is
+ * the word "void", and a line consisting of
+ * identifier1(identifier2, <<arbitrary>>)
+ * will not be considered a function definition.
+ * ansi2knr will recognize a multi-line header provided that no intervening
+ * line ends with a left or right brace or a semicolon. These algorithms
+ * ignore whitespace, comments, and preprocessor directives, except that
+ * the function name must be the first thing on the line. The following
+ * constructs will confuse it:
+ * - Any other construct that starts at the left margin and
+ * follows the above syntax (such as a macro or function call).
+ * - Some macros that tinker with the syntax of function headers.
+ */
+
+/*
+ * The original and principal author of ansi2knr is L. Peter Deutsch
+ * <ghost@aladdin.com>. Other authors are noted in the change history
+ * that follows (in reverse chronological order):
+
+ lpd 2000-04-12 backs out Eggert's changes because of bugs:
+ - concatlits didn't declare the type of its bufend argument;
+ - concatlits didn't recognize when it was inside a comment;
+ - scanstring could scan backward past the beginning of the string; when
+ - the check for \ + newline in scanstring was unnecessary.
+
+ 2000-03-05 Paul Eggert <eggert@twinsun.com>
+
+ Add support for concatenated string literals.
+ * ansi2knr.c (concatlits): New decl.
+ (main): Invoke concatlits to concatenate string literals.
+ (scanstring): Handle backslash-newline correctly. Work with
+ character constants. Fix bug when scanning backwards through
+ backslash-quote. Check for unterminated strings.
+ (convert1): Parse character constants, too.
+ (appendline, concatlits): New functions.
+ * ansi2knr.1: Document this.
+
+ lpd 1999-08-17 added code to allow preprocessor directives
+ wherever comments are allowed
+ lpd 1999-04-12 added minor fixes from Pavel Roskin
+ <pavel_roskin@geocities.com> for clean compilation with
+ gcc -W -Wall
+ lpd 1999-03-22 added hack to recognize lines consisting of
+ identifier1(identifier2, xxx) as *not* being procedures
+ lpd 1999-02-03 made indentation of preprocessor commands consistent
+ lpd 1999-01-28 fixed two bugs: a '/' in an argument list caused an
+ endless loop; quoted strings within an argument list
+ confused the parser
+ lpd 1999-01-24 added a check for write errors on the output,
+ suggested by Jim Meyering <meyering@ascend.com>
+ lpd 1998-11-09 added further hack to recognize identifier(void)
+ as being a procedure
+ lpd 1998-10-23 added hack to recognize lines consisting of
+ identifier1(identifier2) as *not* being procedures
+ lpd 1997-12-08 made input_file optional; only closes input and/or
+ output file if not stdin or stdout respectively; prints
+ usage message on stderr rather than stdout; adds
+ --filename switch (changes suggested by
+ <ceder@lysator.liu.se>)
+ lpd 1996-01-21 added code to cope with not HAVE_CONFIG_H and with
+ compilers that don't understand void, as suggested by
+ Tom Lane
+ lpd 1996-01-15 changed to require that the first non-comment token
+ on the line following a function header be a left brace,
+ to reduce sensitivity to macros, as suggested by Tom Lane
+ <tgl@sss.pgh.pa.us>
+ lpd 1995-06-22 removed #ifndefs whose sole purpose was to define
+ undefined preprocessor symbols as 0; changed all #ifdefs
+ for configuration symbols to #ifs
+ lpd 1995-04-05 changed copyright notice to make it clear that
+ including ansi2knr in a program does not bring the entire
+ program under the GPL
+ lpd 1994-12-18 added conditionals for systems where ctype macros
+ don't handle 8-bit characters properly, suggested by
+ Francois Pinard <pinard@iro.umontreal.ca>;
+ removed --varargs switch (this is now the default)
+ lpd 1994-10-10 removed CONFIG_BROKETS conditional
+ lpd 1994-07-16 added some conditionals to help GNU `configure',
+ suggested by Francois Pinard <pinard@iro.umontreal.ca>;
+ properly erase prototype args in function parameters,
+ contributed by Jim Avera <jima@netcom.com>;
+ correct error in writeblanks (it shouldn't erase EOLs)
+ lpd 1989-xx-xx original version
+ */
+
+/* Most of the conditionals here are to make ansi2knr work with */
+/* or without the GNU configure machinery. */
+
+#if HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <stdio.h>
+#include <ctype.h>
+
+#if HAVE_CONFIG_H
+
+/*
+ For properly autoconfiguring ansi2knr, use AC_CONFIG_HEADER(config.h).
+ This will define HAVE_CONFIG_H and so, activate the following lines.
+ */
+
+# if STDC_HEADERS || HAVE_STRING_H
+# include <string.h>
+# else
+# include <strings.h>
+# endif
+
+#else /* not HAVE_CONFIG_H */
+
+/* Otherwise do it the hard way */
+
+# ifdef BSD
+# include <strings.h>
+# else
+# ifdef VMS
+ extern int strlen(), strncmp();
+# else
+# include <string.h>
+# endif
+# endif
+
+#endif /* not HAVE_CONFIG_H */
+
+#if STDC_HEADERS
+# include <stdlib.h>
+#else
+/*
+ malloc and free should be declared in stdlib.h,
+ but if you've got a K&R compiler, they probably aren't.
+ */
+# ifdef MSDOS
+# include <malloc.h>
+# else
+# ifdef VMS
+ extern char *malloc();
+ extern void free();
+# else
+ extern char *malloc();
+ extern int free();
+# endif
+# endif
+
+#endif
+
+/* Define NULL (for *very* old compilers). */
+#ifndef NULL
+# define NULL (0)
+#endif
+
+/*
+ * The ctype macros don't always handle 8-bit characters correctly.
+ * Compensate for this here.
+ */
+#ifdef isascii
+# undef HAVE_ISASCII /* just in case */
+# define HAVE_ISASCII 1
+#else
+#endif
+#if STDC_HEADERS || !HAVE_ISASCII
+# define is_ascii(c) 1
+#else
+# define is_ascii(c) isascii(c)
+#endif
+
+#define is_space(c) (is_ascii(c) && isspace(c))
+#define is_alpha(c) (is_ascii(c) && isalpha(c))
+#define is_alnum(c) (is_ascii(c) && isalnum(c))
+
+/* Scanning macros */
+#define isidchar(ch) (is_alnum(ch) || (ch) == '_')
+#define isidfirstchar(ch) (is_alpha(ch) || (ch) == '_')
+
+/* Forward references */
+char *ppdirforward();
+char *ppdirbackward();
+char *skipspace();
+char *scanstring();
+int writeblanks();
+int test1();
+int convert1();
+
+/* The main program */
+int
+main(argc, argv)
+ int argc;
+ char *argv[];
+{ FILE *in = stdin;
+ FILE *out = stdout;
+ char *filename = 0;
+ char *program_name = argv[0];
+ char *output_name = 0;
+#define bufsize 5000 /* arbitrary size */
+ char *buf;
+ char *line;
+ char *more;
+ char *usage =
+ "Usage: ansi2knr [--filename FILENAME] [INPUT_FILE [OUTPUT_FILE]]\n";
+ /*
+ * In previous versions, ansi2knr recognized a --varargs switch.
+ * If this switch was supplied, ansi2knr would attempt to convert
+ * a ... argument to va_alist and va_dcl; if this switch was not
+ * supplied, ansi2knr would simply drop any such arguments.
+ * Now, ansi2knr always does this conversion, and we only
+ * check for this switch for backward compatibility.
+ */
+ int convert_varargs = 1;
+ int output_error;
+
+ while ( argc > 1 && argv[1][0] == '-' ) {
+ if ( !strcmp(argv[1], "--varargs") ) {
+ convert_varargs = 1;
+ argc--;
+ argv++;
+ continue;
+ }
+ if ( !strcmp(argv[1], "--filename") && argc > 2 ) {
+ filename = argv[2];
+ argc -= 2;
+ argv += 2;
+ continue;
+ }
+ fprintf(stderr, "%s: Unrecognized switch: %s\n", program_name,
+ argv[1]);
+ fprintf(stderr, usage);
+ exit(1);
+ }
+ switch ( argc )
+ {
+ default:
+ fprintf(stderr, usage);
+ exit(0);
+ case 3:
+ output_name = argv[2];
+ out = fopen(output_name, "w");
+ if ( out == NULL ) {
+ fprintf(stderr, "%s: Cannot open output file %s\n",
+ program_name, output_name);
+ exit(1);
+ }
+ /* falls through */
+ case 2:
+ in = fopen(argv[1], "r");
+ if ( in == NULL ) {
+ fprintf(stderr, "%s: Cannot open input file %s\n",
+ program_name, argv[1]);
+ exit(1);
+ }
+ if ( filename == 0 )
+ filename = argv[1];
+ /* falls through */
+ case 1:
+ break;
+ }
+ if ( filename )
+ fprintf(out, "#line 1 \"%s\"\n", filename);
+ buf = malloc(bufsize);
+ if ( buf == NULL )
+ {
+ fprintf(stderr, "Unable to allocate read buffer!\n");
+ exit(1);
+ }
+ line = buf;
+ while ( fgets(line, (unsigned)(buf + bufsize - line), in) != NULL )
+ {
+test: line += strlen(line);
+ switch ( test1(buf) )
+ {
+ case 2: /* a function header */
+ convert1(buf, out, 1, convert_varargs);
+ break;
+ case 1: /* a function */
+ /* Check for a { at the start of the next line. */
+ more = ++line;
+f: if ( line >= buf + (bufsize - 1) ) /* overflow check */
+ goto wl;
+ if ( fgets(line, (unsigned)(buf + bufsize - line), in) == NULL )
+ goto wl;
+ switch ( *skipspace(ppdirforward(more), 1) )
+ {
+ case '{':
+ /* Definitely a function header. */
+ convert1(buf, out, 0, convert_varargs);
+ fputs(more, out);
+ break;
+ case 0:
+ /* The next line was blank or a comment: */
+ /* keep scanning for a non-comment. */
+ line += strlen(line);
+ goto f;
+ default:
+ /* buf isn't a function header, but */
+ /* more might be. */
+ fputs(buf, out);
+ strcpy(buf, more);
+ line = buf;
+ goto test;
+ }
+ break;
+ case -1: /* maybe the start of a function */
+ if ( line != buf + (bufsize - 1) ) /* overflow check */
+ continue;
+ /* falls through */
+ default: /* not a function */
+wl: fputs(buf, out);
+ break;
+ }
+ line = buf;
+ }
+ if ( line != buf )
+ fputs(buf, out);
+ free(buf);
+ if ( output_name ) {
+ output_error = ferror(out);
+ output_error |= fclose(out);
+ } else { /* out == stdout */
+ fflush(out);
+ output_error = ferror(out);
+ }
+ if ( output_error ) {
+ fprintf(stderr, "%s: error writing to %s\n", program_name,
+ (output_name ? output_name : "stdout"));
+ exit(1);
+ }
+ if ( in != stdin )
+ fclose(in);
+ return 0;
+}
+
+/*
+ * Skip forward or backward over one or more preprocessor directives.
+ */
+char *
+ppdirforward(p)
+ char *p;
+{
+ for (; *p == '#'; ++p) {
+ for (; *p != '\r' && *p != '\n'; ++p)
+ if (*p == 0)
+ return p;
+ if (*p == '\r' && p[1] == '\n')
+ ++p;
+ }
+ return p;
+}
+char *
+ppdirbackward(p, limit)
+ char *p;
+ char *limit;
+{
+ char *np = p;
+
+ for (;; p = --np) {
+ if (*np == '\n' && np[-1] == '\r')
+ --np;
+ for (; np > limit && np[-1] != '\r' && np[-1] != '\n'; --np)
+ if (np[-1] == 0)
+ return np;
+ if (*np != '#')
+ return p;
+ }
+}
+
+/*
+ * Skip over whitespace, comments, and preprocessor directives,
+ * in either direction.
+ */
+char *
+skipspace(p, dir)
+ char *p;
+ int dir; /* 1 for forward, -1 for backward */
+{
+ for ( ; ; ) {
+ while ( is_space(*p) )
+ p += dir;
+ if ( !(*p == '/' && p[dir] == '*') )
+ break;
+ p += dir; p += dir;
+ while ( !(*p == '*' && p[dir] == '/') ) {
+ if ( *p == 0 )
+ return p; /* multi-line comment?? */
+ p += dir;
+ }
+ p += dir; p += dir;
+ }
+ return p;
+}
+
+/* Scan over a quoted string, in either direction. */
+char *
+scanstring(p, dir)
+ char *p;
+ int dir;
+{
+ for (p += dir; ; p += dir)
+ if (*p == '"' && p[-dir] != '\\')
+ return p + dir;
+}
+
+/*
+ * Write blanks over part of a string.
+ * Don't overwrite end-of-line characters.
+ */
+int
+writeblanks(start, end)
+ char *start;
+ char *end;
+{ char *p;
+ for ( p = start; p < end; p++ )
+ if ( *p != '\r' && *p != '\n' )
+ *p = ' ';
+ return 0;
+}
+
+/*
+ * Test whether the string in buf is a function definition.
+ * The string may contain and/or end with a newline.
+ * Return as follows:
+ * 0 - definitely not a function definition;
+ * 1 - definitely a function definition;
+ * 2 - definitely a function prototype (NOT USED);
+ * -1 - may be the beginning of a function definition,
+ * append another line and look again.
+ * The reason we don't attempt to convert function prototypes is that
+ * Ghostscript's declaration-generating macros look too much like
+ * prototypes, and confuse the algorithms.
+ */
+int
+test1(buf)
+ char *buf;
+{ char *p = buf;
+ char *bend;
+ char *endfn;
+ int contin;
+
+ if ( !isidfirstchar(*p) )
+ return 0; /* no name at left margin */
+ bend = skipspace(ppdirbackward(buf + strlen(buf) - 1, buf), -1);
+ switch ( *bend )
+ {
+ case ';': contin = 0 /*2*/; break;
+ case ')': contin = 1; break;
+ case '{': return 0; /* not a function */
+ case '}': return 0; /* not a function */
+ default: contin = -1;
+ }
+ while ( isidchar(*p) )
+ p++;
+ endfn = p;
+ p = skipspace(p, 1);
+ if ( *p++ != '(' )
+ return 0; /* not a function */
+ p = skipspace(p, 1);
+ if ( *p == ')' )
+ return 0; /* no parameters */
+ /* Check that the apparent function name isn't a keyword. */
+ /* We only need to check for keywords that could be followed */
+ /* by a left parenthesis (which, unfortunately, is most of them). */
+ { static char *words[] =
+ { "asm", "auto", "case", "char", "const", "double",
+ "extern", "float", "for", "if", "int", "long",
+ "register", "return", "short", "signed", "sizeof",
+ "static", "switch", "typedef", "unsigned",
+ "void", "volatile", "while", 0
+ };
+ char **key = words;
+ char *kp;
+ unsigned len = endfn - buf;
+
+ while ( (kp = *key) != 0 )
+ { if ( strlen(kp) == len && !strncmp(kp, buf, len) )
+ return 0; /* name is a keyword */
+ key++;
+ }
+ }
+ {
+ char *id = p;
+ int len;
+ /*
+ * Check for identifier1(identifier2) and not
+ * identifier1(void), or identifier1(identifier2, xxxx).
+ */
+
+ while ( isidchar(*p) )
+ p++;
+ len = p - id;
+ p = skipspace(p, 1);
+ if (*p == ',' ||
+ (*p == ')' && (len != 4 || strncmp(id, "void", 4)))
+ )
+ return 0; /* not a function */
+ }
+ /*
+ * If the last significant character was a ), we need to count
+ * parentheses, because it might be part of a formal parameter
+ * that is a procedure.
+ */
+ if (contin > 0) {
+ int level = 0;
+
+ for (p = skipspace(buf, 1); *p; p = skipspace(p + 1, 1))
+ level += (*p == '(' ? 1 : *p == ')' ? -1 : 0);
+ if (level > 0)
+ contin = -1;
+ }
+ return contin;
+}
+
+/* Convert a recognized function definition or header to K&R syntax. */
+int
+convert1(buf, out, header, convert_varargs)
+ char *buf;
+ FILE *out;
+ int header; /* Boolean */
+ int convert_varargs; /* Boolean */
+{ char *endfn;
+ char *p;
+ /*
+ * The breaks table contains pointers to the beginning and end
+ * of each argument.
+ */
+ char **breaks;
+ unsigned num_breaks = 2; /* for testing */
+ char **btop;
+ char **bp;
+ char **ap;
+ char *vararg = 0;
+
+ /* Pre-ANSI implementations don't agree on whether strchr */
+ /* is called strchr or index, so we open-code it here. */
+ for ( endfn = buf; *(endfn++) != '('; )
+ ;
+top: p = endfn;
+ breaks = (char **)malloc(sizeof(char *) * num_breaks * 2);
+ if ( breaks == NULL )
+ { /* Couldn't allocate break table, give up */
+ fprintf(stderr, "Unable to allocate break table!\n");
+ fputs(buf, out);
+ return -1;
+ }
+ btop = breaks + num_breaks * 2 - 2;
+ bp = breaks;
+ /* Parse the argument list */
+ do
+ { int level = 0;
+ char *lp = NULL;
+ char *rp = NULL;
+ char *end = NULL;
+
+ if ( bp >= btop )
+ { /* Filled up break table. */
+ /* Allocate a bigger one and start over. */
+ free((char *)breaks);
+ num_breaks <<= 1;
+ goto top;
+ }
+ *bp++ = p;
+ /* Find the end of the argument */
+ for ( ; end == NULL; p++ )
+ { switch(*p)
+ {
+ case ',':
+ if ( !level ) end = p;
+ break;
+ case '(':
+ if ( !level ) lp = p;
+ level++;
+ break;
+ case ')':
+ if ( --level < 0 ) end = p;
+ else rp = p;
+ break;
+ case '/':
+ if (p[1] == '*')
+ p = skipspace(p, 1) - 1;
+ break;
+ case '"':
+ p = scanstring(p, 1) - 1;
+ break;
+ default:
+ ;
+ }
+ }
+ /* Erase any embedded prototype parameters. */
+ if ( lp && rp )
+ writeblanks(lp + 1, rp);
+ p--; /* back up over terminator */
+ /* Find the name being declared. */
+ /* This is complicated because of procedure and */
+ /* array modifiers. */
+ for ( ; ; )
+ { p = skipspace(p - 1, -1);
+ switch ( *p )
+ {
+ case ']': /* skip array dimension(s) */
+ case ')': /* skip procedure args OR name */
+ { int level = 1;
+ while ( level )
+ switch ( *--p )
+ {
+ case ']': case ')':
+ level++;
+ break;
+ case '[': case '(':
+ level--;
+ break;
+ case '/':
+ if (p > buf && p[-1] == '*')
+ p = skipspace(p, -1) + 1;
+ break;
+ case '"':
+ p = scanstring(p, -1) + 1;
+ break;
+ default: ;
+ }
+ }
+ if ( *p == '(' && *skipspace(p + 1, 1) == '*' )
+ { /* We found the name being declared */
+ while ( !isidfirstchar(*p) )
+ p = skipspace(p, 1) + 1;
+ goto found;
+ }
+ break;
+ default:
+ goto found;
+ }
+ }
+found: if ( *p == '.' && p[-1] == '.' && p[-2] == '.' )
+ { if ( convert_varargs )
+ { *bp++ = "va_alist";
+ vararg = p-2;
+ }
+ else
+ { p++;
+ if ( bp == breaks + 1 ) /* sole argument */
+ writeblanks(breaks[0], p);
+ else
+ writeblanks(bp[-1] - 1, p);
+ bp--;
+ }
+ }
+ else
+ { while ( isidchar(*p) ) p--;
+ *bp++ = p+1;
+ }
+ p = end;
+ }
+ while ( *p++ == ',' );
+ *bp = p;
+ /* Make a special check for 'void' arglist */
+ if ( bp == breaks+2 )
+ { p = skipspace(breaks[0], 1);
+ if ( !strncmp(p, "void", 4) )
+ { p = skipspace(p+4, 1);
+ if ( p == breaks[2] - 1 )
+ { bp = breaks; /* yup, pretend arglist is empty */
+ writeblanks(breaks[0], p + 1);
+ }
+ }
+ }
+ /* Put out the function name and left parenthesis. */
+ p = buf;
+ while ( p != endfn ) putc(*p, out), p++;
+ /* Put out the declaration. */
+ if ( header )
+ { fputs(");", out);
+ for ( p = breaks[0]; *p; p++ )
+ if ( *p == '\r' || *p == '\n' )
+ putc(*p, out);
+ }
+ else
+ { for ( ap = breaks+1; ap < bp; ap += 2 )
+ { p = *ap;
+ while ( isidchar(*p) )
+ putc(*p, out), p++;
+ if ( ap < bp - 1 )
+ fputs(", ", out);
+ }
+ fputs(") ", out);
+ /* Put out the argument declarations */
+ for ( ap = breaks+2; ap <= bp; ap += 2 )
+ (*ap)[-1] = ';';
+ if ( vararg != 0 )
+ { *vararg = 0;
+ fputs(breaks[0], out); /* any prior args */
+ fputs("va_dcl", out); /* the final arg */
+ fputs(bp[0], out);
+ }
+ else
+ fputs(breaks[0], out);
+ }
+ free((char *)breaks);
+ return 0;
+}
diff --git a/gmp/assert.c b/gmp/assert.c
index 2e85e6bf63..b9b55592ab 100644
--- a/gmp/assert.c
+++ b/gmp/assert.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/bootstrap.c b/gmp/bootstrap.c
deleted file mode 100644
index bff960ed83..0000000000
--- a/gmp/bootstrap.c
+++ /dev/null
@@ -1,146 +0,0 @@
-/* Functions needed for bootstrapping the gmp build, based on mini-gmp.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 "mini-gmp/mini-gmp.c"
-
-#define MIN(l,o) ((l) < (o) ? (l) : (o))
-#define PTR(x) ((x)->_mp_d)
-#define SIZ(x) ((x)->_mp_size)
-
-#define xmalloc gmp_default_alloc
-
-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;
-}
-
-int
-log2_ceil (int n)
-{
- int e;
- assert (n >= 1);
- for (e = 0; ; e++)
- if ((1 << e) >= n)
- break;
- return e;
-}
-
-/* Set inv to the inverse of d, in the style of invert_limb, ie. for
- udiv_qrnnd_preinv. */
-void
-mpz_preinv_invert (mpz_t inv, mpz_t d, int numb_bits)
-{
- mpz_t t;
- int norm;
- assert (SIZ(d) > 0);
-
- norm = numb_bits - mpz_sizeinbase (d, 2);
- assert (norm >= 0);
- mpz_init_set_ui (t, 1L);
- mpz_mul_2exp (t, t, 2*numb_bits - norm);
- mpz_tdiv_q (inv, t, d);
- mpz_set_ui (t, 1L);
- mpz_mul_2exp (t, t, numb_bits);
- mpz_sub (inv, inv, t);
-
- mpz_clear (t);
-}
-
-/* Calculate r satisfying r*d == 1 mod 2^n. */
-void
-mpz_invert_2exp (mpz_t r, mpz_t a, unsigned long n)
-{
- unsigned long i;
- mpz_t inv, prod;
-
- assert (mpz_odd_p (a));
-
- mpz_init_set_ui (inv, 1L);
- mpz_init (prod);
-
- for (i = 1; i < n; i++)
- {
- mpz_mul (prod, inv, a);
- if (mpz_tstbit (prod, i) != 0)
- mpz_setbit (inv, i);
- }
-
- mpz_mul (prod, inv, a);
- mpz_tdiv_r_2exp (prod, prod, n);
- assert (mpz_cmp_ui (prod, 1L) == 0);
-
- mpz_set (r, inv);
-
- mpz_clear (inv);
- mpz_clear (prod);
-}
-
-/* Calculate inv satisfying r*a == 1 mod 2^n. */
-void
-mpz_invert_ui_2exp (mpz_t r, unsigned long a, unsigned long n)
-{
- mpz_t az;
- mpz_init_set_ui (az, a);
- mpz_invert_2exp (r, az, n);
- mpz_clear (az);
-}
diff --git a/gmp/compat.c b/gmp/compat.c
index b896f8489f..7251beff09 100644
--- a/gmp/compat.c
+++ b/gmp/compat.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
diff --git a/gmp/config.guess b/gmp/config.guess
index 02b61f45aa..c64ba970ec 100755
--- a/gmp/config.guess
+++ b/gmp/config.guess
@@ -3,33 +3,23 @@
# GMP config.guess wrapper.
-# Copyright 2000-2006, 2008, 2011-2014 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: config.guess
@@ -88,46 +78,36 @@ exact_cpu=
# files, since lame C compilers generate these even when not asked.
#
-# 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= ;'
+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
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.
@@ -135,7 +115,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}0.s
+ cat <<EOF >$dummy.s
.data
Lformat:
.byte 37,100,45,37,120,10,0 # "%d-%x\n"
@@ -158,9 +138,9 @@ main:
jsr \$26,exit
.end main
EOF
- $CC_FOR_BUILD ${dummy}0.s -o $dummy 2>/dev/null
+ $CC_FOR_BUILD $dummy.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 ;;
@@ -170,41 +150,10 @@ EOF
2-1307) exact_cpu=alphaev68 ;;
esac
fi
- ;;
-
-arm*-*-*)
- cpu_code=`sed -n 's/^CPU part.*\(0x.*\)$/\1/p' /proc/cpuinfo 2>/dev/null`
- case "$cpu_code" in
- 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
- 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
- 0xc14) exact_cpu="armcortexr4";; # v7r
- 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`"
+ rm -f $dummy.s $dummy.o $dummy
;;
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.
@@ -215,7 +164,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}0.s <<EOF
+ cat >${dummy}a.s <<EOF
.text
.global _getcpuid
.proc _getcpuid
@@ -230,7 +179,7 @@ getcpuid:
br.ret.sptk.many rp ;;
.endp getcpuid
EOF
- cat >$dummy.c <<EOF
+ cat >${dummy}b.c <<EOF
#include <stdio.h>
unsigned long long getcpuid ();
int
@@ -248,9 +197,10 @@ main ()
return 0;
}
EOF
- if $CC_FOR_BUILD ${dummy}0.s $dummy.c -o $dummy >/dev/null 2>&1; then
- exact_cpu=`$dummy`
+ if $CC_FOR_BUILD ${dummy}a.s ${dummy}b.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]*)
@@ -259,7 +209,6 @@ 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'`
@@ -274,7 +223,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}0.s <<EOF
+ cat >$dummy.s <<EOF
.text
.globl main
.globl _main
@@ -283,15 +232,14 @@ _main:
.byte 0x70, 0x00
.byte 0x4e, 0x75
EOF
+ if ($CC_FOR_BUILD $dummy.s -o $dummy && ./$dummy) >/dev/null 2>&1; then
- 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)
+ # $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}0.s <<EOF
+ cat >$dummy.s <<EOF
.text
.globl main
.globl _main
@@ -300,8 +248,8 @@ _main:
.byte 0x70, 0x00
.byte 0x4e, 0x74, 0x00, 0x00
EOF
- if $CC_FOR_BUILD ${dummy}0.s -o $dummy >/dev/null 2>&1; then
- $SHELL -c $dummy >/dev/null 2>&1
+ if $CC_FOR_BUILD $dummy.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
@@ -314,7 +262,7 @@ EOF
# rts
# Another possibility for identifying 68000 and 68010 is the
# different value stored by "movem a0,(a0)+"
- cat >${dummy}0.s <<EOF
+ cat >$dummy.s <<EOF
.text
.globl main
.globl _main
@@ -324,8 +272,8 @@ _main:
.byte 0x70, 0x00
.byte 0x4e, 0x75
EOF
- if $CC_FOR_BUILD ${dummy}0.s -o $dummy >/dev/null 2>&1; then
- $SHELL -c $dummy >/dev/null 2>&1
+ if $CC_FOR_BUILD $dummy.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
@@ -336,7 +284,7 @@ EOF
# Try: bfffo %d1{0:31},%d0
# movel #0,%d0
# rts
- cat >${dummy}0.s <<EOF
+ cat >$dummy.s <<EOF
.text
.globl main
.globl _main
@@ -346,8 +294,8 @@ _main:
.byte 0x70, 0x00
.byte 0x4e, 0x75
EOF
- if $CC_FOR_BUILD ${dummy}0.s -o $dummy >/dev/null 2>&1; then
- $SHELL -c $dummy >/dev/null 2>&1
+ if $CC_FOR_BUILD $dummy.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
@@ -359,6 +307,7 @@ 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
@@ -388,7 +337,6 @@ 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 {
@@ -435,12 +383,13 @@ 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
@@ -453,8 +402,7 @@ EOF
601) exact_cpu="power" ;;
603ev) exact_cpu="powerpc603e" ;;
604ev5) exact_cpu="powerpc604e" ;;
- 970??) exact_cpu="powerpc970" ;;
- 603 | 603e | 604 | 604e | 750 | 821 | 860)
+ 603 | 603e | 604 | 604e | 750 | 821 | 860 | 970)
exact_cpu="powerpc$x" ;;
POWER[4-9])
exact_cpu=`echo $x | sed "s;POWER;power;"` ;;
@@ -506,9 +454,6 @@ main ()
#ifdef POWER_6
case POWER_6: puts ("power6"); break;
#endif
-#ifdef POWER_7
- case POWER_7: puts ("power7"); break;
-#endif
default:
if (_system_configuration.architecture == POWER_RS)
puts ("power");
@@ -519,11 +464,12 @@ 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
@@ -562,11 +508,12 @@ 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
;;
@@ -592,13 +539,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
- exact_cpu="ultrasparct2"
elif grep 'cpu.*UltraSparc T1' /proc/cpuinfo >/dev/null; then
+ # this grep pattern has not been tested against any Linux
exact_cpu="ultrasparct1"
elif grep 'cpu.*UltraSparc III' /proc/cpuinfo >/dev/null; then
exact_cpu="ultrasparc3"
@@ -611,9 +553,6 @@ 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
@@ -621,17 +560,18 @@ sparc-*-* | sparc64-*-*)
#
if test -z "$exact_cpu"; then
for i in sysinfo /usr/kvm/sysinfo; do
- if $SHELL -c $i 2>/dev/null >$dummy; then
- if grep 'cpu0 is a "SuperSPARC' $dummy >/dev/null; then
+ if $SHELL -c $i 2>/dev/null >conftest.dat; then
+ if grep 'cpu0 is a "SuperSPARC' conftest.dat >/dev/null; then
exact_cpu=supersparc
break
- elif grep 'cpu0 is a .*TMS390Z5.' $dummy >/dev/null; then
+ elif grep 'cpu0 is a .*TMS390Z5.' conftest.dat >/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.
@@ -654,34 +594,31 @@ sparc-*-* | sparc64-*-*)
#
for prtconfopt in "" "-vp"; do
if test -z "$exact_cpu"; 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' $dummy >/dev/null; then
- exact_cpu=ultrasparct2
- elif grep 'SUNW,UltraSPARC-T1' $dummy >/dev/null; then
+ if $SHELL -c "/usr/sbin/prtconf $prtconfopt" 2>/dev/null >conftest.dat; then
+ if grep 'SUNW,UltraSPARC-T1' conftest.dat >/dev/null; then
exact_cpu=ultrasparct1
- elif grep 'SUNW,UltraSPARC-III' $dummy >/dev/null; then
+ elif grep 'SUNW,UltraSPARC-III' conftest.dat >/dev/null; then
exact_cpu=ultrasparc3
- elif grep 'SUNW,UltraSPARC-IIi' $dummy >/dev/null; then
+ elif grep 'SUNW,UltraSPARC-IIi' conftest.dat >/dev/null; then
exact_cpu=ultrasparc2i
- elif grep 'SUNW,UltraSPARC-II' $dummy >/dev/null; then
+ elif grep 'SUNW,UltraSPARC-II' conftest.dat >/dev/null; then
exact_cpu=ultrasparc2
- elif grep 'SUNW,UltraSPARC' $dummy >/dev/null; then
+ elif grep 'SUNW,UltraSPARC' conftest.dat >/dev/null; then
exact_cpu=ultrasparc
- elif grep 'Ross,RT62.' $dummy >/dev/null; then
+ elif grep 'Ross,RT62.' conftest.dat >/dev/null; then
# RT620, RT625, RT626 hypersparcs (v8).
exact_cpu=sparcv8
- elif grep 'TI,TMS390Z5.' $dummy >/dev/null; then
+ elif grep 'TI,TMS390Z5.' conftest.dat >/dev/null; then
# TMS390Z50 and TMS390Z55
exact_cpu=supersparc
- elif grep 'TI,TMS390S10' $dummy >/dev/null; then
+ elif grep 'TI,TMS390S10' conftest.dat >/dev/null; then
exact_cpu=microsparc
- elif grep 'FMI,MB86904' $dummy >/dev/null; then
+ elif grep 'FMI,MB86904' conftest.dat >/dev/null; then
# actually MicroSPARC-II
exact_cpu=microsparc
fi
fi
+ rm -f conftest.dat
fi
done
@@ -692,33 +629,31 @@ sparc-*-* | sparc64-*-*)
# hw.model: Sun Microsystems UltraSparc-IIi
#
if test -z "$exact_cpu"; 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' $dummy >/dev/null; then
- exact_cpu=ultrasparct2
- elif grep -i 'UltraSparc-T1' $dummy >/dev/null; then
+ if $SHELL -c "/sbin/sysctl hw.model" 2>/dev/null >conftest.dat; then
+ if grep 'UltraSparc-T1' conftest.dat >/dev/null; then
+ # this grep pattern has not been tested against any BSD
exact_cpu=ultrasparct1
- elif grep -i 'UltraSparc-III' $dummy >/dev/null; then
+ elif grep 'UltraSparc-III' conftest.dat >/dev/null; then
exact_cpu=ultrasparc3
- elif grep -i 'UltraSparc-IIi' $dummy >/dev/null; then
+ elif grep 'UltraSparc-IIi' conftest.dat >/dev/null; then
exact_cpu=ultrasparc2i
- elif grep -i 'UltraSparc-II' $dummy >/dev/null; then
+ elif grep 'UltraSparc-II' conftest.dat >/dev/null; then
exact_cpu=ultrasparc2
- elif grep -i 'UltraSparc' $dummy >/dev/null; then
+ elif grep 'UltraSparc' conftest.dat >/dev/null; then
exact_cpu=ultrasparc
- elif grep 'TMS390Z5.' $dummy >/dev/null; then
+ elif grep 'TMS390Z5.' conftest.dat >/dev/null; then
# TMS390Z50 and TMS390Z55
exact_cpu=supersparc
- elif grep 'TMS390S10' $dummy >/dev/null; then
+ elif grep 'TMS390S10' conftest.dat >/dev/null; then
exact_cpu=microsparc
- elif grep 'MB86904' $dummy >/dev/null; then
+ elif grep 'MB86904' conftest.dat >/dev/null; then
# actually MicroSPARC-II
exact_cpu=microsparc
- elif grep 'MB86907' $dummy >/dev/null; then
+ elif grep 'MB86907' conftest.dat >/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
@@ -731,48 +666,59 @@ sparc-*-* | sparc64-*-*)
fi
;;
-
-# Recognise x86 processors using a tricky cpuid with 4 arguments, repeating
-# arguments; for x86-64 we effectively pass the 1st in rdx and the 2nd in rcx.
-# This allows the same asm to work for both standard and Windoze calling
-# conventions.
-
i?86-*-* | amd64-*-* | x86_64-*-*)
- eval $set_cc_for_build
-
- cat <<EOF >$dummy.c
-#include <string.h>
-#include <stdio.h>
-#define CPUID(a,b) cpuid(b,a,a,b)
-#if __cplusplus
-extern "C"
-#endif
-unsigned int cpuid (int, char *, char *, int);
-int
+ cat <<EOF >${dummy}0.s
+ .globl cpuid
+ .globl _cpuid
+cpuid:
+_cpuid:
+ pushl %esi
+ pushl %ebx
+ movl 16(%esp),%eax
+ .byte 0x0f
+ .byte 0xa2
+ movl 12(%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 %esi,%eax
+ .byte 0x0f
+ .byte 0xa2
+ mov %ebx,(%rdi)
+ mov %edx,4(%rdi)
+ mov %ecx,8(%rdi)
+ pop %rbx
+ ret
+EOF
+ cat <<EOF >${dummy}2.c
main ()
{
char vendor_string[13];
char dummy_string[12];
long fms;
int family, model, stepping;
- const char *modelstr;
- int cpu_64bit = 0;
- int cpuid_64bit;
+ char *modelstr;
- CPUID (vendor_string, 0);
+ cpuid (vendor_string, 0);
vendor_string[12] = 0;
- fms = CPUID (dummy_string, 1);
+ fms = cpuid (dummy_string, 1);
family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
stepping = fms & 0xf;
modelstr = "$guess_cpu";
-
- /**************************************************/
- /*** WARNING: keep this list in sync with fat.c ***/
- /**************************************************/
if (strcmp (vendor_string, "GenuineIntel") == 0)
{
switch (family)
@@ -782,51 +728,19 @@ 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 == 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";
- }
-
+ 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 <= 12) modelstr = "pentium3";
+ else if (model <= 14) modelstr = "pentiumm";
+ else if (model <= 25) modelstr = "core2";
+ else if (model <= 27) modelstr = "core2"; /* core i5, i7 */
+ else if (model == 28) modelstr = "atom";
+ else if (model == 29) modelstr = "core2";
break;
case 15:
- cpu_64bit = 1, modelstr = "pentium4";
+ modelstr = "pentium4";
break;
}
}
@@ -845,37 +759,9 @@ main ()
case 6:
modelstr = "athlon";
break;
- case 15: /* K8, K9 */
- cpu_64bit = 1, modelstr = "k8";
- break;
- case 16: /* K10 */
- cpu_64bit = 1, modelstr = "k10";
- break;
- case 17: /* Hybrid k8/k10, claim k8 */
- cpu_64bit = 1, modelstr = "k8";
- break;
- case 18: /* Llano, uses K10 core */
- cpu_64bit = 1, modelstr = "k10";
- break;
- case 19: /* AMD Internal, assume future K10 */
- cpu_64bit = 1, modelstr = "k10";
- break;
- case 20: /* Bobcat */
- cpu_64bit = 1, modelstr = "bobcat";
- break;
- case 21: /* 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 = "jaguar";
+ case 15:
+ case 16:
+ modelstr = "athlon64";
break;
}
}
@@ -889,49 +775,17 @@ main ()
{
case 6:
if (model < 9) modelstr = "viac3";
- else if (model < 15) modelstr = "viac32";
- else cpu_64bit = 1, modelstr = "nano";
+ else modelstr = "viac32";
break;
}
}
- 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);
+ printf ("%s\n", modelstr);
return 0;
}
EOF
-# 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
+ if ($CC_FOR_BUILD ${dummy}1.s ${dummy}2.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.
#
@@ -939,34 +793,14 @@ 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.c -o $dummy) >/dev/null 2>&1; then
+ if ($CC_FOR_BUILD ${dummy}0.s ${dummy}2.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.
#
@@ -974,7 +808,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
@@ -983,21 +817,7 @@ EOF
# We need to remove some .o files here since lame C compilers
# generate these even when not asked.
- ;;
-
-s390*-*-*)
- model=`grep "^processor 0: version =" /proc/cpuinfo | sed -e 's/.*machine = //'`
- case $model in
- 2064 | 2066) zcpu="z900" ;;
- 2084 | 2086) zcpu="z990" ;;
- 2094 | 2096) zcpu="z9" ;;
- 2097 | 2098) zcpu="z10" ;;
- 2817 | 2818 | *) zcpu="z196" ;;
- esac
- case "$guess_full" in
- s390x-*-*) exact_cpu=${zcpu} ;;
- s390-*-*) exact_cpu=${zcpu}esa ;;
- esac
+ rm -f ${dummy}0.s ${dummy}0.o ${dummy}1.s ${dummy}1.o ${dummy}2.c ${dummy}2.o $dummy
;;
esac
diff --git a/gmp/config.in b/gmp/config.in
index e94acd7c03..2aed4937b7 100644
--- a/gmp/config.in
+++ b/gmp/config.in
@@ -1,39 +1,26 @@
-/* config.in. Generated from configure.ac by autoheader. */
+/* config.in. Generated from configure.in by autoheader. */
/*
-Copyright 1996-2014 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 if building universal (internal helper macro) */
-#undef AC_APPLE_UNIVERSAL_BUILD
-
/* The gmp-mparam.h file (a string) the tune program should suggest updating.
*/
#undef GMP_MPARAM_H_SUGGEST
@@ -71,7 +58,7 @@ see https://www.gnu.org/licenses/.
/* Define to 1 if you have the `clock' function. */
#undef HAVE_CLOCK
-/* Define to 1 if you have the `clock_gettime' function */
+/* Define to 1 if you have the `clock_gettime' function. */
#undef HAVE_CLOCK_GETTIME
/* Define to 1 if you have the `cputime' function. */
@@ -146,7 +133,6 @@ see https://www.gnu.org/licenses/.
#undef HAVE_HOST_CPU_FAMILY_power
#undef HAVE_HOST_CPU_FAMILY_powerpc
#undef HAVE_HOST_CPU_FAMILY_x86
-#undef HAVE_HOST_CPU_FAMILY_x86_64
/* Define one of the following to 1 for the host CPU, as per the output of
./config.guess. If your CPU is not listed here, leave all undefined. */
@@ -171,21 +157,10 @@ see https://www.gnu.org/licenses/.
#undef HAVE_HOST_CPU_pentiumpro
#undef HAVE_HOST_CPU_pentium2
#undef HAVE_HOST_CPU_pentium3
-#undef HAVE_HOST_CPU_s390_z900
-#undef HAVE_HOST_CPU_s390_z990
-#undef HAVE_HOST_CPU_s390_z9
-#undef HAVE_HOST_CPU_s390_z10
-#undef HAVE_HOST_CPU_s390_z196
-
-/* Define to 1 iff we have a s390 with 64-bit registers. */
-#undef HAVE_HOST_CPU_s390_zarch
/* Define to 1 if the system has the type `intmax_t'. */
#undef HAVE_INTMAX_T
-/* Define to 1 if the system has the type `intptr_t'. */
-#undef HAVE_INTPTR_T
-
/* Define to 1 if you have the <inttypes.h> header file. */
#undef HAVE_INTTYPES_H
@@ -231,27 +206,8 @@ see https://www.gnu.org/licenses/.
/* Define to 1 each of the following for which a native (ie. CPU specific)
implementation of the corresponding routine exists. */
#undef HAVE_NATIVE_mpn_add_n
-#undef HAVE_NATIVE_mpn_add_n_sub_n
#undef HAVE_NATIVE_mpn_add_nc
-#undef HAVE_NATIVE_mpn_addaddmul_1msb0
#undef HAVE_NATIVE_mpn_addlsh1_n
-#undef HAVE_NATIVE_mpn_addlsh2_n
-#undef HAVE_NATIVE_mpn_addlsh_n
-#undef HAVE_NATIVE_mpn_addlsh1_nc
-#undef HAVE_NATIVE_mpn_addlsh2_nc
-#undef HAVE_NATIVE_mpn_addlsh_nc
-#undef HAVE_NATIVE_mpn_addlsh1_n_ip1
-#undef HAVE_NATIVE_mpn_addlsh2_n_ip1
-#undef HAVE_NATIVE_mpn_addlsh_n_ip1
-#undef HAVE_NATIVE_mpn_addlsh1_nc_ip1
-#undef HAVE_NATIVE_mpn_addlsh2_nc_ip1
-#undef HAVE_NATIVE_mpn_addlsh_nc_ip1
-#undef HAVE_NATIVE_mpn_addlsh1_n_ip2
-#undef HAVE_NATIVE_mpn_addlsh2_n_ip2
-#undef HAVE_NATIVE_mpn_addlsh_n_ip2
-#undef HAVE_NATIVE_mpn_addlsh1_nc_ip2
-#undef HAVE_NATIVE_mpn_addlsh2_nc_ip2
-#undef HAVE_NATIVE_mpn_addlsh_nc_ip2
#undef HAVE_NATIVE_mpn_addmul_1c
#undef HAVE_NATIVE_mpn_addmul_2
#undef HAVE_NATIVE_mpn_addmul_3
@@ -260,89 +216,50 @@ see https://www.gnu.org/licenses/.
#undef HAVE_NATIVE_mpn_addmul_6
#undef HAVE_NATIVE_mpn_addmul_7
#undef HAVE_NATIVE_mpn_addmul_8
-#undef HAVE_NATIVE_mpn_addmul_2s
+#undef HAVE_NATIVE_mpn_addsub_n
+#undef HAVE_NATIVE_mpn_addaddmul_1msb0
#undef HAVE_NATIVE_mpn_and_n
#undef HAVE_NATIVE_mpn_andn_n
#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_com_n
#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
#undef HAVE_NATIVE_mpn_divrem_1
#undef HAVE_NATIVE_mpn_divrem_1c
#undef HAVE_NATIVE_mpn_divrem_2
#undef HAVE_NATIVE_mpn_gcd_1
-#undef HAVE_NATIVE_mpn_hamdist
#undef HAVE_NATIVE_mpn_invert_limb
#undef HAVE_NATIVE_mpn_ior_n
#undef HAVE_NATIVE_mpn_iorn_n
-#undef HAVE_NATIVE_mpn_lshift
#undef HAVE_NATIVE_mpn_lshiftc
-#undef HAVE_NATIVE_mpn_lshsub_n
#undef HAVE_NATIVE_mpn_mod_1
-#undef HAVE_NATIVE_mpn_mod_1_1p
#undef HAVE_NATIVE_mpn_mod_1c
-#undef HAVE_NATIVE_mpn_mod_1s_2p
-#undef HAVE_NATIVE_mpn_mod_1s_4p
-#undef HAVE_NATIVE_mpn_mod_34lsub1
#undef HAVE_NATIVE_mpn_modexact_1_odd
#undef HAVE_NATIVE_mpn_modexact_1c_odd
-#undef HAVE_NATIVE_mpn_mul_1
#undef HAVE_NATIVE_mpn_mul_1c
#undef HAVE_NATIVE_mpn_mul_2
#undef HAVE_NATIVE_mpn_mul_3
#undef HAVE_NATIVE_mpn_mul_4
-#undef HAVE_NATIVE_mpn_mul_5
-#undef HAVE_NATIVE_mpn_mul_6
-#undef HAVE_NATIVE_mpn_mul_basecase
#undef HAVE_NATIVE_mpn_nand_n
#undef HAVE_NATIVE_mpn_nior_n
-#undef HAVE_NATIVE_mpn_popcount
#undef HAVE_NATIVE_mpn_preinv_divrem_1
#undef HAVE_NATIVE_mpn_preinv_mod_1
#undef HAVE_NATIVE_mpn_redc_1
#undef HAVE_NATIVE_mpn_redc_2
-#undef HAVE_NATIVE_mpn_rsblsh1_n
-#undef HAVE_NATIVE_mpn_rsblsh2_n
-#undef HAVE_NATIVE_mpn_rsblsh_n
-#undef HAVE_NATIVE_mpn_rsblsh1_nc
-#undef HAVE_NATIVE_mpn_rsblsh2_nc
-#undef HAVE_NATIVE_mpn_rsblsh_nc
#undef HAVE_NATIVE_mpn_rsh1add_n
-#undef HAVE_NATIVE_mpn_rsh1add_nc
#undef HAVE_NATIVE_mpn_rsh1sub_n
-#undef HAVE_NATIVE_mpn_rsh1sub_nc
-#undef HAVE_NATIVE_mpn_rshift
#undef HAVE_NATIVE_mpn_sqr_basecase
#undef HAVE_NATIVE_mpn_sqr_diagonal
-#undef HAVE_NATIVE_mpn_sqr_diag_addlsh1
#undef HAVE_NATIVE_mpn_sub_n
#undef HAVE_NATIVE_mpn_sub_nc
#undef HAVE_NATIVE_mpn_sublsh1_n
-#undef HAVE_NATIVE_mpn_sublsh2_n
-#undef HAVE_NATIVE_mpn_sublsh_n
-#undef HAVE_NATIVE_mpn_sublsh1_nc
-#undef HAVE_NATIVE_mpn_sublsh2_nc
-#undef HAVE_NATIVE_mpn_sublsh_nc
-#undef HAVE_NATIVE_mpn_sublsh1_n_ip1
-#undef HAVE_NATIVE_mpn_sublsh2_n_ip1
-#undef HAVE_NATIVE_mpn_sublsh_n_ip1
-#undef HAVE_NATIVE_mpn_sublsh1_nc_ip1
-#undef HAVE_NATIVE_mpn_sublsh2_nc_ip1
-#undef HAVE_NATIVE_mpn_sublsh_nc_ip1
#undef HAVE_NATIVE_mpn_submul_1c
-#undef HAVE_NATIVE_mpn_tabselect
-#undef HAVE_NATIVE_mpn_udiv_qrnnd
-#undef HAVE_NATIVE_mpn_udiv_qrnnd_r
#undef HAVE_NATIVE_mpn_umul_ppmm
#undef HAVE_NATIVE_mpn_umul_ppmm_r
+#undef HAVE_NATIVE_mpn_udiv_qrnnd
+#undef HAVE_NATIVE_mpn_udiv_qrnnd_r
#undef HAVE_NATIVE_mpn_xor_n
#undef HAVE_NATIVE_mpn_xnor_n
@@ -398,6 +315,9 @@ see https://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
@@ -500,16 +420,9 @@ see https://www.gnu.org/licenses/.
/* Define to 1 if you have the `vsnprintf' function and it works properly. */
#undef HAVE_VSNPRINTF
-/* Define to 1 for Windos/64 */
-#undef HOST_DOS64
-
/* Assembler local label prefix */
#undef LSYM_PREFIX
-/* Define to the sub-directory in which libtool stores uninstalled libraries.
- */
-#undef LT_OBJDIR
-
/* Name of package */
#undef PACKAGE
@@ -525,12 +438,12 @@ see https://www.gnu.org/licenses/.
/* Define to the one symbol short name of this package. */
#undef PACKAGE_TARNAME
-/* Define to the home page for this package. */
-#undef PACKAGE_URL
-
/* Define to the version of this package. */
#undef PACKAGE_VERSION
+/* Define to 1 if the C compiler supports function prototypes. */
+#undef PROTOTYPES
+
/* Define as the return type of signal handlers (`int' or `void'). */
#undef RETSIGTYPE
@@ -546,9 +459,6 @@ see https://www.gnu.org/licenses/.
/* The size of `unsigned short', as computed by sizeof. */
#undef SIZEOF_UNSIGNED_SHORT
-/* The size of `void *', as computed by sizeof. */
-#undef SIZEOF_VOID_P
-
/* Define to 1 if sscanf requires writable inputs */
#undef SSCANF_WRITABLE_INPUT
@@ -558,31 +468,21 @@ see https://www.gnu.org/licenses/.
/* Define to 1 if you can safely include both <sys/time.h> and <time.h>. */
#undef TIME_WITH_SYS_TIME
-/* Maximum size the tune program can test for SQR_TOOM2_THRESHOLD */
-#undef TUNE_SQR_TOOM2_MAX
+/* Maximum size the tune program can test for SQR_KARATSUBA_THRESHOLD */
+#undef TUNE_SQR_KARATSUBA_MAX
/* Version number of package */
#undef VERSION
-/* Defined to 1 as per --enable-assembly */
-#undef WANT_ASSEMBLY
-
/* 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
/* Define to 1 to enable FFTs for multiplication, per --enable-fft */
#undef WANT_FFT
-/* Define to 1 to enable old mpn_mul_fft_full for multiplication, per
- --enable-old-fft-full */
-#undef WANT_OLD_FFT_FULL
-
/* Define to 1 if --enable-profiling=gprof */
#undef WANT_PROFILING_GPROF
@@ -599,41 +499,22 @@ see https://www.gnu.org/licenses/.
#undef WANT_TMP_NOTREENTRANT
#undef WANT_TMP_DEBUG
-/* Define WORDS_BIGENDIAN to 1 if your processor stores words with the most
- significant byte first (like Motorola and SPARC, unlike Intel). */
-#if defined AC_APPLE_UNIVERSAL_BUILD
-# if defined __BIG_ENDIAN__
-# define WORDS_BIGENDIAN 1
-# endif
-#else
-# ifndef WORDS_BIGENDIAN
-# undef WORDS_BIGENDIAN
-# endif
-#endif
-
/* Define to 1 if `lex' declares `yytext' as a `char *' by default, not a
`char[]'. */
#undef YYTEXT_POINTER
+/* Define like PROTOTYPES; this can be used by system headers. */
+#undef __PROTOTYPES
+
/* Define to `__inline__' or `__inline' if that's what the C compiler
calls it, or to nothing if 'inline' is not supported under any name. */
#ifndef __cplusplus
#undef inline
#endif
-/* Define to the equivalent of the C99 'restrict' keyword, or to
- nothing if this is not supported. Do not define if restrict is
- supported directly. */
+/* Define to equivalent of C99 restrict keyword, or to nothing if this is not
+ supported. Do not define if restrict is supported directly. */
#undef restrict
-/* Work around a bug in Sun C++: it does not support _Restrict or
- __restrict__, even though the corresponding Sun C compiler ends up with
- "#define restrict _Restrict" or "#define restrict __restrict__" in the
- previous line. Perhaps some future version of Sun C++ will work with
- restrict; if so, hopefully it defines __RESTRICT like Sun C does. */
-#if defined __SUNPRO_CC && !defined __RESTRICT
-# define _Restrict
-# define __restrict__
-#endif
/* Define to empty if the keyword `volatile' does not work. Warning: valid
code using `volatile' can become incorrect without. Disable with care. */
diff --git a/gmp/config.sub b/gmp/config.sub
index d734c43458..1686176ab3 100755
--- a/gmp/config.sub
+++ b/gmp/config.sub
@@ -3,33 +3,22 @@
# GMP config.sub wrapper.
-# Copyright 2000-2003, 2006, 2009-2014 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2006 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: config.sub CPU-VENDOR-OS
@@ -100,9 +89,9 @@ given_full="$given_cpu$given_rest"
case "$given_cpu" in
itanium | itanium2)
test_cpu=ia64 ;;
-pentium | pentiummmx | pentiumpro | pentium[234m] | k[567] | k6[23] | geode | athlon | viac3*)
+pentium | pentiummmx | pentiumpro | pentium[234m] | k[56] | k6[23] | geode | athlon | viac3*)
test_cpu=i386 ;;
-athlon64 | atom | core2 | corei | coreinhm | coreiwsm | coreisbr | coreihwl | coreibwl | opteron | k[89] | k10 | bobcat | jaguar | bulldozer | piledriver | steamroller | excavator | nano)
+athlon64 | atom | core2 | opteron)
test_cpu=x86_64 ;;
power[2-9] | power2sc)
test_cpu=power ;;
@@ -117,22 +106,11 @@ powerpc801 | powerpc821 | powerpc823 | powerpc860 | \
powerpc64)
test_cpu=powerpc ;;
sparcv8 | supersparc | microsparc | \
-ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct[1234])
+ultrasparc | ultrasparc2 | ultrasparc2i | ultrasparc3 | ultrasparct1)
test_cpu=sparc ;;
sh2)
test_cpu=sh ;;
-z900 | z990 | z9 | z10 | z196)
- test_cpu=s390x;;
-z900esa | z990esa | z9esa | z10esa | z196esa)
- test_cpu=s390;;
-
-armsa1 | armxscale | arm9tdmi | arm9te | \
-arm10* | arm11mpcore | armsa1 | arm1136 | arm1156 | arm1176 | \
-armcortexa5 | armcortexa7 | armcortexa8 | armcortexa9 | armcortexa15 | \
-armcortexr4 | armcortexr5 | armcortexm3)
- test_cpu="arm";;
-
*)
# Don't need or want to change the given name, just run configfsf.sub
$SHELL $configfsf_sub "$given_full"
diff --git a/gmp/configfsf.guess b/gmp/configfsf.guess
index 9afd676206..c7607c74f1 100755
--- a/gmp/configfsf.guess
+++ b/gmp/configfsf.guess
@@ -1,12 +1,14 @@
#! /bin/sh
# Attempt to guess a canonical system name.
-# Copyright 1992-2013 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
-timestamp='2013-11-29'
+timestamp='2008-04-14'
# 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
+# 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
@@ -15,22 +17,26 @@ timestamp='2013-11-29'
# 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/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
#
# 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. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
-#
-# Originally written by Per Bothner.
+# the same distribution terms that you use for the rest of that program.
+
+
+# Originally written by Per Bothner <per@bothner.com>.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
#
-# 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
+# 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.
#
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
-
+# The plan is that this can be called by configure scripts if you
+# don't specify an explicit build system type.
me=`echo "$0" | sed -e 's,.*/,,'`
@@ -50,7 +56,8 @@ version="\
GNU config.guess ($timestamp)
Originally written by Per Bothner.
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
@@ -132,33 +139,12 @@ 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
*:NetBSD:*:*)
# NetBSD (nbsd) targets should (where applicable) match one or
- # more of the tuples: *-*-netbsdelf*, *-*-netbsdaout*,
+ # more of the tupples: *-*-netbsdelf*, *-*-netbsdaout*,
# *-*-netbsdecoff* and *-*-netbsd*. For targets that recently
# switched to ELF, *-*-netbsd* would select the old
# object file format. This provides both forward
@@ -184,7 +170,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
arm*|i386|m68k|ns32k|sh3*|sparc|vax)
eval $set_cc_for_build
if echo __ELF__ | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ELF__
+ | grep __ELF__ >/dev/null
then
# Once all utilities can be ECOFF (netbsdecoff) or a.out (netbsdaout).
# Return netbsd for either. FIX?
@@ -194,7 +180,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
fi
;;
*)
- os=netbsd
+ os=netbsd
;;
esac
# The OS release
@@ -215,10 +201,6 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM is used.
echo "${machine}-${os}${release}"
exit ;;
- *:Bitrig:*:*)
- UNAME_MACHINE_ARCH=`arch | sed 's/Bitrig.//'`
- echo ${UNAME_MACHINE_ARCH}-unknown-bitrig${UNAME_RELEASE}
- exit ;;
*:OpenBSD:*:*)
UNAME_MACHINE_ARCH=`arch | sed 's/OpenBSD.//'`
echo ${UNAME_MACHINE_ARCH}-unknown-openbsd${UNAME_RELEASE}
@@ -241,7 +223,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $3}'`
;;
*5.*)
- UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
+ UNAME_RELEASE=`/usr/sbin/sizer -v | awk '{print $4}'`
;;
esac
# According to Compaq, /usr/sbin/psrinfo has been available on
@@ -287,10 +269,7 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# A Xn.n version is an unreleased experimental baselevel.
# 1.2 uses "1.2" for uname -r.
echo ${UNAME_MACHINE}-dec-osf`echo ${UNAME_RELEASE} | sed -e 's/^[PVTX]//' | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- # Reset EXIT trap before exiting to avoid spurious non-zero exit code.
- exitcode=$?
- trap '' 0
- exit $exitcode ;;
+ exit ;;
Alpha\ *:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# Should we change UNAME_MACHINE based on the output of uname instead
@@ -316,12 +295,12 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
echo s390-ibm-zvmoe
exit ;;
*:OS400:*:*)
- echo powerpc-ibm-os400
+ echo powerpc-ibm-os400
exit ;;
arm:RISC*:1.[012]*:*|arm:riscix:1.[012]*:*)
echo arm-acorn-riscix${UNAME_RELEASE}
exit ;;
- arm*:riscos:*:*|arm*:RISCOS:*:*)
+ arm:riscos:*:*|arm:RISCOS:*:*)
echo arm-unknown-riscos
exit ;;
SR2?01:HI-UX/MPP:*:* | SR8000:HI-UX/MPP:*:*)
@@ -345,33 +324,14 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
case `/usr/bin/uname -p` in
sparc) echo sparc-icl-nx7; exit ;;
esac ;;
- s390x:SunOS:*:*)
- echo ${UNAME_MACHINE}-ibm-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
- exit ;;
sun4H:SunOS:5.*:*)
echo sparc-hal-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:5.*:* | tadpole*:SunOS:5.*:*)
echo sparc-sun-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
- i86pc:AuroraUX:5.*:* | i86xen:AuroraUX:5.*:*)
- echo i386-pc-auroraux${UNAME_RELEASE}
- exit ;;
i86pc:SunOS:5.*:* | i86xen:SunOS:5.*:*)
- eval $set_cc_for_build
- SUN_ARCH="i386"
- # If there is a compiler, see if it is configured for 64-bit objects.
- # Note that the Sun cc does not turn __LP64__ into 1 like gcc does.
- # This test works for both compilers.
- if [ "$CC_FOR_BUILD" != 'no_compiler_found' ]; then
- if (echo '#ifdef __amd64'; echo IS_64BIT_ARCH; echo '#endif') | \
- (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) | \
- grep IS_64BIT_ARCH >/dev/null
- then
- SUN_ARCH="x86_64"
- fi
- fi
- echo ${SUN_ARCH}-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
+ echo i386-pc-solaris2`echo ${UNAME_RELEASE}|sed -e 's/[^.]*//'`
exit ;;
sun4*:SunOS:6*:*)
# According to config.sub, this is the proper way to canonicalize
@@ -415,23 +375,23 @@ case "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" in
# MiNT. But MiNT is downward compatible to TOS, so this should
# be no problem.
atarist[e]:*MiNT:*:* | atarist[e]:*mint:*:* | atarist[e]:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
atari*:*MiNT:*:* | atari*:*mint:*:* | atarist[e]:*TOS:*:*)
echo m68k-atari-mint${UNAME_RELEASE}
- exit ;;
+ exit ;;
*falcon*:*MiNT:*:* | *falcon*:*mint:*:* | *falcon*:*TOS:*:*)
- echo m68k-atari-mint${UNAME_RELEASE}
+ echo m68k-atari-mint${UNAME_RELEASE}
exit ;;
milan*:*MiNT:*:* | milan*:*mint:*:* | *milan*:*TOS:*:*)
- echo m68k-milan-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-milan-mint${UNAME_RELEASE}
+ exit ;;
hades*:*MiNT:*:* | hades*:*mint:*:* | *hades*:*TOS:*:*)
- echo m68k-hades-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-hades-mint${UNAME_RELEASE}
+ exit ;;
*:*MiNT:*:* | *:*mint:*:* | *:*TOS:*:*)
- echo m68k-unknown-mint${UNAME_RELEASE}
- exit ;;
+ echo m68k-unknown-mint${UNAME_RELEASE}
+ exit ;;
m68k:machten:*:*)
echo m68k-apple-machten${UNAME_RELEASE}
exit ;;
@@ -501,8 +461,8 @@ EOF
echo m88k-motorola-sysv3
exit ;;
AViiON:dgux:*:*)
- # DG/UX returns AViiON for all architectures
- UNAME_PROCESSOR=`/usr/bin/uname -p`
+ # DG/UX returns AViiON for all architectures
+ UNAME_PROCESSOR=`/usr/bin/uname -p`
if [ $UNAME_PROCESSOR = mc88100 ] || [ $UNAME_PROCESSOR = mc88110 ]
then
if [ ${TARGET_BINARY_INTERFACE}x = m88kdguxelfx ] || \
@@ -515,7 +475,7 @@ EOF
else
echo i586-dg-dgux${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
M88*:DolphinOS:*:*) # DolphinOS (SVR3)
echo m88k-dolphin-sysv3
exit ;;
@@ -572,7 +532,7 @@ EOF
echo rs6000-ibm-aix3.2
fi
exit ;;
- *:AIX:*:[4567])
+ *:AIX:*:[456])
IBM_CPU_ID=`/usr/sbin/lsdev -C -c processor -S available | sed 1q | awk '{ print $1 }'`
if /usr/sbin/lsattr -El ${IBM_CPU_ID} | grep ' POWER' >/dev/null 2>&1; then
IBM_ARCH=rs6000
@@ -615,52 +575,52 @@ EOF
9000/[678][0-9][0-9])
if [ -x /usr/bin/getconf ]; then
sc_cpu_version=`/usr/bin/getconf SC_CPU_VERSION 2>/dev/null`
- sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
- case "${sc_cpu_version}" in
- 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
- 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
- 532) # CPU_PA_RISC2_0
- case "${sc_kernel_bits}" in
- 32) HP_ARCH="hppa2.0n" ;;
- 64) HP_ARCH="hppa2.0w" ;;
+ sc_kernel_bits=`/usr/bin/getconf SC_KERNEL_BITS 2>/dev/null`
+ case "${sc_cpu_version}" in
+ 523) HP_ARCH="hppa1.0" ;; # CPU_PA_RISC1_0
+ 528) HP_ARCH="hppa1.1" ;; # CPU_PA_RISC1_1
+ 532) # CPU_PA_RISC2_0
+ case "${sc_kernel_bits}" in
+ 32) HP_ARCH="hppa2.0n" ;;
+ 64) HP_ARCH="hppa2.0w" ;;
'') HP_ARCH="hppa2.0" ;; # HP-UX 10.20
- esac ;;
- esac
+ esac ;;
+ esac
fi
if [ "${HP_ARCH}" = "" ]; then
eval $set_cc_for_build
- sed 's/^ //' << EOF >$dummy.c
+ sed 's/^ //' << EOF >$dummy.c
- #define _HPUX_SOURCE
- #include <stdlib.h>
- #include <unistd.h>
+ #define _HPUX_SOURCE
+ #include <stdlib.h>
+ #include <unistd.h>
- int main ()
- {
- #if defined(_SC_KERNEL_BITS)
- long bits = sysconf(_SC_KERNEL_BITS);
- #endif
- long cpu = sysconf (_SC_CPU_VERSION);
+ int main ()
+ {
+ #if defined(_SC_KERNEL_BITS)
+ long bits = sysconf(_SC_KERNEL_BITS);
+ #endif
+ long cpu = sysconf (_SC_CPU_VERSION);
- switch (cpu)
- {
- case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
- case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
- case CPU_PA_RISC2_0:
- #if defined(_SC_KERNEL_BITS)
- switch (bits)
- {
- case 64: puts ("hppa2.0w"); break;
- case 32: puts ("hppa2.0n"); break;
- default: puts ("hppa2.0"); break;
- } break;
- #else /* !defined(_SC_KERNEL_BITS) */
- puts ("hppa2.0"); break;
- #endif
- default: puts ("hppa1.0"); break;
- }
- exit (0);
- }
+ switch (cpu)
+ {
+ case CPU_PA_RISC1_0: puts ("hppa1.0"); break;
+ case CPU_PA_RISC1_1: puts ("hppa1.1"); break;
+ case CPU_PA_RISC2_0:
+ #if defined(_SC_KERNEL_BITS)
+ switch (bits)
+ {
+ case 64: puts ("hppa2.0w"); break;
+ case 32: puts ("hppa2.0n"); break;
+ default: puts ("hppa2.0"); break;
+ } break;
+ #else /* !defined(_SC_KERNEL_BITS) */
+ puts ("hppa2.0"); break;
+ #endif
+ default: puts ("hppa1.0"); break;
+ }
+ exit (0);
+ }
EOF
(CCOPTS= $CC_FOR_BUILD -o $dummy $dummy.c 2>/dev/null) && HP_ARCH=`$dummy`
test -z "$HP_ARCH" && HP_ARCH=hppa
@@ -680,7 +640,7 @@ EOF
# => hppa64-hp-hpux11.23
if echo __LP64__ | (CCOPTS= $CC_FOR_BUILD -E - 2>/dev/null) |
- grep -q __LP64__
+ grep __LP64__ >/dev/null
then
HP_ARCH="hppa2.0w"
else
@@ -751,22 +711,22 @@ EOF
exit ;;
C1*:ConvexOS:*:* | convex:ConvexOS:C1*:*)
echo c1-convex-bsd
- exit ;;
+ exit ;;
C2*:ConvexOS:*:* | convex:ConvexOS:C2*:*)
if getsysinfo -f scalar_acc
then echo c32-convex-bsd
else echo c2-convex-bsd
fi
- exit ;;
+ exit ;;
C34*:ConvexOS:*:* | convex:ConvexOS:C34*:*)
echo c34-convex-bsd
- exit ;;
+ exit ;;
C38*:ConvexOS:*:* | convex:ConvexOS:C38*:*)
echo c38-convex-bsd
- exit ;;
+ exit ;;
C4*:ConvexOS:*:* | convex:ConvexOS:C4*:*)
echo c4-convex-bsd
- exit ;;
+ exit ;;
CRAY*Y-MP:*:*:*)
echo ymp-cray-unicos${UNAME_RELEASE} | sed -e 's/\.[^.]*$/.X/'
exit ;;
@@ -790,14 +750,14 @@ EOF
exit ;;
F30[01]:UNIX_System_V:*:* | F700:UNIX_System_V:*:*)
FUJITSU_PROC=`uname -m | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz'`
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
- echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
- exit ;;
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | sed -e 's/ /_/'`
+ echo "${FUJITSU_PROC}-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ exit ;;
5000:UNIX_System_V:4.*:*)
- FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
- FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
- echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
+ FUJITSU_SYS=`uname -p | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/\///'`
+ FUJITSU_REL=`echo ${UNAME_RELEASE} | tr 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' 'abcdefghijklmnopqrstuvwxyz' | sed -e 's/ /_/'`
+ echo "sparc-fujitsu-${FUJITSU_SYS}${FUJITSU_REL}"
exit ;;
i*86:BSD/386:*:* | i*86:BSD/OS:*:* | *:Ascend\ Embedded/OS:*:*)
echo ${UNAME_MACHINE}-pc-bsdi${UNAME_RELEASE}
@@ -809,39 +769,34 @@ EOF
echo ${UNAME_MACHINE}-unknown-bsdi${UNAME_RELEASE}
exit ;;
*:FreeBSD:*:*)
- UNAME_PROCESSOR=`/usr/bin/uname -p`
- case ${UNAME_PROCESSOR} in
+ case ${UNAME_MACHINE} in
+ pc98)
+ echo i386-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
amd64)
echo x86_64-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
*)
- echo ${UNAME_PROCESSOR}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
+ echo ${UNAME_MACHINE}-unknown-freebsd`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'` ;;
esac
exit ;;
i*:CYGWIN*:*)
echo ${UNAME_MACHINE}-pc-cygwin
exit ;;
- *:MINGW64*:*)
- echo ${UNAME_MACHINE}-pc-mingw64
- exit ;;
*:MINGW*:*)
echo ${UNAME_MACHINE}-pc-mingw32
exit ;;
- i*:MSYS*:*)
- echo ${UNAME_MACHINE}-pc-msys
- exit ;;
i*:windows32*:*)
- # uname -m includes "-pc" on this system.
- echo ${UNAME_MACHINE}-mingw32
+ # uname -m includes "-pc" on this system.
+ echo ${UNAME_MACHINE}-mingw32
exit ;;
i*:PW*:*)
echo ${UNAME_MACHINE}-pc-pw32
exit ;;
- *:Interix*:*)
- case ${UNAME_MACHINE} in
+ *:Interix*:[3456]*)
+ case ${UNAME_MACHINE} in
x86)
echo i586-pc-interix${UNAME_RELEASE}
exit ;;
- authenticamd | genuineintel | EM64T)
+ EM64T | authenticamd)
echo x86_64-unknown-interix${UNAME_RELEASE}
exit ;;
IA64)
@@ -851,9 +806,6 @@ EOF
[345]86:Windows_95:* | [345]86:Windows_98:* | [345]86:Windows_NT:*)
echo i${UNAME_MACHINE}-pc-mks
exit ;;
- 8664:Windows_NT:*)
- echo x86_64-pc-mks
- exit ;;
i*:Windows_NT*:* | Pentium*:Windows_NT*:*)
# How do we know it's Interix rather than the generic POSIX subsystem?
# It also conflicts with pre-2.0 versions of AT&T UWIN. Should we
@@ -874,157 +826,207 @@ EOF
exit ;;
*:GNU:*:*)
# the GNU system
- echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-${LIBC}`echo ${UNAME_RELEASE}|sed -e 's,/.*$,,'`
+ echo `echo ${UNAME_MACHINE}|sed -e 's,[-/].*$,,'`-unknown-gnu`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/[-(].*//'`-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-`echo ${UNAME_SYSTEM} | sed 's,^[^/]*/,,' | tr '[A-Z]' '[a-z]'``echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`-gnu
exit ;;
i*86:Minix:*:*)
echo ${UNAME_MACHINE}-pc-minix
exit ;;
- aarch64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- aarch64_be:Linux:*:*)
- UNAME_MACHINE=aarch64_be
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- alpha:Linux:*:*)
- case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
- EV5) UNAME_MACHINE=alphaev5 ;;
- EV56) UNAME_MACHINE=alphaev56 ;;
- PCA56) UNAME_MACHINE=alphapca56 ;;
- PCA57) UNAME_MACHINE=alphapca56 ;;
- EV6) UNAME_MACHINE=alphaev6 ;;
- EV67) UNAME_MACHINE=alphaev67 ;;
- EV68*) UNAME_MACHINE=alphaev68 ;;
- esac
- objdump --private-headers /bin/sh | grep -q ld.so.1
- 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-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
else
- if echo __ARM_PCS_VFP | $CC_FOR_BUILD -E - 2>/dev/null \
- | grep -q __ARM_PCS_VFP
- then
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabi
- else
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}eabihf
- fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnueabi
fi
exit ;;
avr32*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
cris:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ echo cris-axis-linux-gnu
exit ;;
crisv32:Linux:*:*)
- echo ${UNAME_MACHINE}-axis-linux-${LIBC}
+ echo crisv32-axis-linux-gnu
exit ;;
frv:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- hexagon:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- i*86:Linux:*:*)
- echo ${UNAME_MACHINE}-pc-linux-${LIBC}
+ echo frv-unknown-linux-gnu
exit ;;
ia64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m32r*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
m68*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
- mips:Linux:*:* | mips64:Linux:*:*)
+ mips:Linux:*:*)
eval $set_cc_for_build
sed 's/^ //' << EOF >$dummy.c
#undef CPU
- #undef ${UNAME_MACHINE}
- #undef ${UNAME_MACHINE}el
+ #undef mips
+ #undef mipsel
#if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
- CPU=${UNAME_MACHINE}el
+ CPU=mipsel
#else
#if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
- CPU=${UNAME_MACHINE}
+ CPU=mips
#else
CPU=
#endif
#endif
EOF
- eval `$CC_FOR_BUILD -E $dummy.c 2>/dev/null | grep '^CPU'`
- test x"${CPU}" != x && { echo "${CPU}-unknown-linux-${LIBC}"; exit; }
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
+ ;;
+ mips64:Linux:*:*)
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #undef CPU
+ #undef mips64
+ #undef mips64el
+ #if defined(__MIPSEL__) || defined(__MIPSEL) || defined(_MIPSEL) || defined(MIPSEL)
+ CPU=mips64el
+ #else
+ #if defined(__MIPSEB__) || defined(__MIPSEB) || defined(_MIPSEB) || defined(MIPSEB)
+ CPU=mips64
+ #else
+ CPU=
+ #endif
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^CPU/{
+ s: ::g
+ p
+ }'`"
+ test x"${CPU}" != x && { echo "${CPU}-unknown-linux-gnu"; exit; }
;;
- or1k:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
or32:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo or32-unknown-linux-gnu
exit ;;
- padre:Linux:*:*)
- echo sparc-unknown-linux-${LIBC}
+ ppc:Linux:*:*)
+ echo powerpc-unknown-linux-gnu
exit ;;
- parisc64:Linux:*:* | hppa64:Linux:*:*)
- echo hppa64-unknown-linux-${LIBC}
+ ppc64:Linux:*:*)
+ echo powerpc64-unknown-linux-gnu
+ exit ;;
+ alpha:Linux:*:*)
+ case `sed -n '/^cpu model/s/^.*: \(.*\)/\1/p' < /proc/cpuinfo` in
+ EV5) UNAME_MACHINE=alphaev5 ;;
+ EV56) UNAME_MACHINE=alphaev56 ;;
+ PCA56) UNAME_MACHINE=alphapca56 ;;
+ PCA57) UNAME_MACHINE=alphapca56 ;;
+ EV6) UNAME_MACHINE=alphaev6 ;;
+ EV67) UNAME_MACHINE=alphaev67 ;;
+ EV68*) UNAME_MACHINE=alphaev68 ;;
+ esac
+ objdump --private-headers /bin/sh | grep ld.so.1 >/dev/null
+ if test "$?" = 0 ; then LIBC="libc1" ; else LIBC="" ; fi
+ echo ${UNAME_MACHINE}-unknown-linux-gnu${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-${LIBC} ;;
- PA8*) echo hppa2.0-unknown-linux-${LIBC} ;;
- *) echo hppa-unknown-linux-${LIBC} ;;
+ PA7*) echo hppa1.1-unknown-linux-gnu ;;
+ PA8*) echo hppa2.0-unknown-linux-gnu ;;
+ *) echo hppa-unknown-linux-gnu ;;
esac
exit ;;
- ppc64:Linux:*:*)
- echo powerpc64-unknown-linux-${LIBC}
- exit ;;
- ppc:Linux:*:*)
- echo powerpc-unknown-linux-${LIBC}
- exit ;;
- ppc64le:Linux:*:*)
- echo powerpc64le-unknown-linux-${LIBC}
- exit ;;
- ppcle:Linux:*:*)
- echo powerpcle-unknown-linux-${LIBC}
+ parisc64:Linux:*:* | hppa64:Linux:*:*)
+ echo hppa64-unknown-linux-gnu
exit ;;
s390:Linux:*:* | s390x:Linux:*:*)
- echo ${UNAME_MACHINE}-ibm-linux-${LIBC}
+ echo ${UNAME_MACHINE}-ibm-linux
exit ;;
sh64*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sh*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
sparc:Linux:*:* | sparc64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
- exit ;;
- tile*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
vax:Linux:*:*)
- echo ${UNAME_MACHINE}-dec-linux-${LIBC}
+ echo ${UNAME_MACHINE}-dec-linux-gnu
exit ;;
x86_64:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo x86_64-unknown-linux-gnu
exit ;;
xtensa*:Linux:*:*)
- echo ${UNAME_MACHINE}-unknown-linux-${LIBC}
+ echo ${UNAME_MACHINE}-unknown-linux-gnu
exit ;;
+ i*86:Linux:*:*)
+ # The BFD linker knows what the default object file format is, so
+ # first see if it will tell us. cd to the root directory to prevent
+ # problems with other programs or directories called `ld' in the path.
+ # Set LC_ALL=C to ensure ld outputs messages in English.
+ ld_supported_targets=`cd /; LC_ALL=C ld --help 2>&1 \
+ | sed -ne '/supported targets:/!d
+ s/[ ][ ]*/ /g
+ s/.*supported targets: *//
+ s/ .*//
+ p'`
+ case "$ld_supported_targets" in
+ elf32-i386)
+ TENTATIVE="${UNAME_MACHINE}-pc-linux-gnu"
+ ;;
+ a.out-i386-linux)
+ echo "${UNAME_MACHINE}-pc-linux-gnuaout"
+ exit ;;
+ "")
+ # Either a pre-BFD a.out linker (linux-gnuoldld) or
+ # one that does not give us useful --help.
+ echo "${UNAME_MACHINE}-pc-linux-gnuoldld"
+ exit ;;
+ esac
+ # Determine whether the default compiler is a.out or elf
+ eval $set_cc_for_build
+ sed 's/^ //' << EOF >$dummy.c
+ #include <features.h>
+ #ifdef __ELF__
+ # ifdef __GLIBC__
+ # if __GLIBC__ >= 2
+ LIBC=gnu
+ # else
+ LIBC=gnulibc1
+ # endif
+ # else
+ LIBC=gnulibc1
+ # endif
+ #else
+ #if defined(__INTEL_COMPILER) || defined(__PGI) || defined(__SUNPRO_C) || defined(__SUNPRO_CC)
+ LIBC=gnu
+ #else
+ LIBC=gnuaout
+ #endif
+ #endif
+ #ifdef __dietlibc__
+ LIBC=dietlibc
+ #endif
+EOF
+ eval "`$CC_FOR_BUILD -E $dummy.c 2>/dev/null | sed -n '
+ /^LIBC/{
+ s: ::g
+ p
+ }'`"
+ test x"${LIBC}" != x && {
+ echo "${UNAME_MACHINE}-pc-linux-${LIBC}"
+ exit
+ }
+ test x"${TENTATIVE}" != x && { echo "${TENTATIVE}"; exit; }
+ ;;
i*86:DYNIX/ptx:4*:*)
# ptx 4.0 does uname -s correctly, with DYNIX/ptx in there.
# earlier versions are messed up and put the nodename in both
@@ -1032,11 +1034,11 @@ EOF
echo i386-sequent-sysv4
exit ;;
i*86:UNIX_SV:4.2MP:2.*)
- # Unixware is an offshoot of SVR4, but it has its own version
- # number series starting with 2...
- # I am not positive that other SVR4 systems won't match this,
+ # Unixware is an offshoot of SVR4, but it has its own version
+ # number series starting with 2...
+ # I am not positive that other SVR4 systems won't match this,
# I just have to hope. -- rms.
- # Use sysv4.2uw... so that sysv4* matches it.
+ # Use sysv4.2uw... so that sysv4* matches it.
echo ${UNAME_MACHINE}-pc-sysv4.2uw${UNAME_VERSION}
exit ;;
i*86:OS/2:*:*)
@@ -1053,7 +1055,7 @@ EOF
i*86:syllable:*:*)
echo ${UNAME_MACHINE}-pc-syllable
exit ;;
- i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.[02]*:*)
+ i*86:LynxOS:2.*:* | i*86:LynxOS:3.[01]*:* | i*86:LynxOS:4.0*:*)
echo i386-unknown-lynxos${UNAME_RELEASE}
exit ;;
i*86:*DOS:*:*)
@@ -1068,7 +1070,7 @@ EOF
fi
exit ;;
i*86:*:5:[678]*)
- # UnixWare 7.x, OpenUNIX and OpenServer 6.
+ # UnixWare 7.x, OpenUNIX and OpenServer 6.
case `/bin/uname -X | grep "^Machine"` in
*486*) UNAME_MACHINE=i486 ;;
*Pentium) UNAME_MACHINE=i586 ;;
@@ -1096,13 +1098,10 @@ EOF
exit ;;
pc:*:*:*)
# Left here for compatibility:
- # uname -m prints for DJGPP always 'pc', but it prints nothing about
- # the processor, so we play safe by assuming i586.
- # Note: whatever this is, it MUST be the same as what config.sub
- # prints for the "djgpp" host, or else GDB configury will decide that
- # this is a cross-build.
- echo i586-pc-msdosdjgpp
- exit ;;
+ # uname -m prints for DJGPP always 'pc', but it prints nothing about
+ # the processor, so we play safe by assuming i386.
+ echo i386-pc-msdosdjgpp
+ exit ;;
Intel:Mach:3*:*)
echo i386-pc-mach3
exit ;;
@@ -1137,18 +1136,8 @@ EOF
/bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
&& { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
3[34]??:*:4.0:* | 3[34]??,*:*:4.0:*)
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4; exit; } ;;
- NCR*:*:4.2:* | MPRAS*:*:4.2:*)
- OS_REL='.3'
- test -r /etc/.relid \
- && OS_REL=.`sed -n 's/[^ ]* [^ ]* \([0-9][0-9]\).*/\1/p' < /etc/.relid`
- /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
- && { echo i486-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep entium >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; }
- /bin/uname -p 2>/dev/null | /bin/grep pteron >/dev/null \
- && { echo i586-ncr-sysv4.3${OS_REL}; exit; } ;;
+ /bin/uname -p 2>/dev/null | grep 86 >/dev/null \
+ && { echo i486-ncr-sysv4; exit; } ;;
m68*:LynxOS:2.*:* | m68*:LynxOS:3.0*:*)
echo m68k-unknown-lynxos${UNAME_RELEASE}
exit ;;
@@ -1161,7 +1150,7 @@ EOF
rs6000:LynxOS:2.*:*)
echo rs6000-unknown-lynxos${UNAME_RELEASE}
exit ;;
- PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.[02]*:*)
+ PowerPC:LynxOS:2.*:* | PowerPC:LynxOS:3.[01]*:* | PowerPC:LynxOS:4.0*:*)
echo powerpc-unknown-lynxos${UNAME_RELEASE}
exit ;;
SM[BE]S:UNIX_SV:*:*)
@@ -1181,10 +1170,10 @@ EOF
echo ns32k-sni-sysv
fi
exit ;;
- PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
- # says <Richard.M.Bartel@ccMail.Census.GOV>
- echo i586-unisys-sysv4
- exit ;;
+ PENTIUM:*:4.0*:*) # Unisys `ClearPath HMP IX 4000' SVR4/MP effort
+ # says <Richard.M.Bartel@ccMail.Census.GOV>
+ echo i586-unisys-sysv4
+ exit ;;
*:UNIX_System_V:4*:FTX*)
# From Gerald Hewes <hewes@openmarket.com>.
# How about differentiating between stratus architectures? -djm
@@ -1210,11 +1199,11 @@ EOF
exit ;;
R[34]000:*System_V*:*:* | R4000:UNIX_SYSV:*:* | R*000:UNIX_SV:*:*)
if [ -d /usr/nec ]; then
- echo mips-nec-sysv${UNAME_RELEASE}
+ echo mips-nec-sysv${UNAME_RELEASE}
else
- echo mips-unknown-sysv${UNAME_RELEASE}
+ echo mips-unknown-sysv${UNAME_RELEASE}
fi
- exit ;;
+ exit ;;
BeBox:BeOS:*:*) # BeOS running on hardware made by Be, PPC only.
echo powerpc-be-beos
exit ;;
@@ -1227,9 +1216,6 @@ EOF
BePC:Haiku:*:*) # Haiku running on Intel PC compatible.
echo i586-pc-haiku
exit ;;
- x86_64:Haiku:*:*)
- echo x86_64-unknown-haiku
- exit ;;
SX-4:SUPER-UX:*:*)
echo sx4-nec-superux${UNAME_RELEASE}
exit ;;
@@ -1256,31 +1242,9 @@ EOF
exit ;;
*:Darwin:*:*)
UNAME_PROCESSOR=`uname -p` || UNAME_PROCESSOR=unknown
- 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
+ case $UNAME_PROCESSOR in
+ unknown) UNAME_PROCESSOR=powerpc ;;
+ esac
echo ${UNAME_PROCESSOR}-apple-darwin${UNAME_RELEASE}
exit ;;
*:procnto*:*:* | *:QNX:[0123456789]*:*)
@@ -1294,10 +1258,7 @@ EOF
*:QNX:*:4*)
echo i386-pc-qnx
exit ;;
- NEO-?:NONSTOP_KERNEL:*:*)
- echo neo-tandem-nsk${UNAME_RELEASE}
- exit ;;
- NSE-*:NONSTOP_KERNEL:*:*)
+ NSE-?:NONSTOP_KERNEL:*:*)
echo nse-tandem-nsk${UNAME_RELEASE}
exit ;;
NSR-?:NONSTOP_KERNEL:*:*)
@@ -1342,13 +1303,13 @@ EOF
echo pdp10-unknown-its
exit ;;
SEI:*:*:SEIUX)
- echo mips-sei-seiux${UNAME_RELEASE}
+ echo mips-sei-seiux${UNAME_RELEASE}
exit ;;
*:DragonFly:*:*)
echo ${UNAME_MACHINE}-unknown-dragonfly`echo ${UNAME_RELEASE}|sed -e 's/[-(].*//'`
exit ;;
*:*VMS:*:*)
- UNAME_MACHINE=`(uname -p) 2>/dev/null`
+ UNAME_MACHINE=`(uname -p) 2>/dev/null`
case "${UNAME_MACHINE}" in
A*) echo alpha-dec-vms ; exit ;;
I*) echo ia64-dec-vms ; exit ;;
@@ -1363,14 +1324,11 @@ EOF
i*86:rdos:*:*)
echo ${UNAME_MACHINE}-pc-rdos
exit ;;
- i*86:AROS:*:*)
- echo ${UNAME_MACHINE}-pc-aros
- exit ;;
- x86_64:VMkernel:*:*)
- echo ${UNAME_MACHINE}-unknown-esx
- exit ;;
esac
+#echo '(No uname command or uname output not recognized.)' 1>&2
+#echo "${UNAME_MACHINE}:${UNAME_SYSTEM}:${UNAME_RELEASE}:${UNAME_VERSION}" 1>&2
+
eval $set_cc_for_build
cat >$dummy.c <<EOF
#ifdef _SEQUENT_
@@ -1388,11 +1346,11 @@ main ()
#include <sys/param.h>
printf ("m68k-sony-newsos%s\n",
#ifdef NEWSOS4
- "4"
+ "4"
#else
- ""
+ ""
#endif
- ); exit (0);
+ ); exit (0);
#endif
#endif
diff --git a/gmp/configfsf.sub b/gmp/configfsf.sub
index 61cb4bc22d..a649350a6c 100644..100755
--- a/gmp/configfsf.sub
+++ b/gmp/configfsf.sub
@@ -1,40 +1,44 @@
#! /bin/sh
# Configuration validation subroutine script.
-# Copyright 1992-2013 Free Software Foundation, Inc.
+# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
+# 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008
+# Free Software Foundation, Inc.
-timestamp='2013-10-01'
+timestamp='2008-06-16'
-# 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
+# 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
# (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/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston, MA
+# 02110-1301, USA.
#
# 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. This Exception is an additional permission under section 7
-# of the GNU General Public License, version 3 ("GPLv3").
+# the same distribution terms that you use for the rest of that program.
-# Please send patches with a ChangeLog entry to config-patches@gnu.org.
+# Please send patches to <config-patches@gnu.org>. Submit a context
+# diff and a properly formatted ChangeLog entry.
#
# Configuration subroutine to validate and canonicalize a configuration type.
# Supply the specified configuration type as an argument.
# If it is invalid, we print an error message on stderr and exit with code 1.
# Otherwise, we print the canonical config type on stdout and succeed.
-# You can get the latest version of this script from:
-# http://git.savannah.gnu.org/gitweb/?p=config.git;a=blob_plain;f=config.sub;hb=HEAD
-
# This file is supposed to be the same for all GNU packages
# and recognize all the CPU types, system types and aliases
# that are meaningful with *any* GNU software.
@@ -68,7 +72,8 @@ Report bugs and patches to <config-patches@gnu.org>."
version="\
GNU config.sub ($timestamp)
-Copyright 1992-2013 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006, 2007, 2008 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."
@@ -115,18 +120,12 @@ esac
# Here we must recognize all the valid KERNEL-OS combinations.
maybe_os=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\2/'`
case $maybe_os in
- nto-qnx* | linux-gnu* | linux-android* | linux-dietlibc | linux-newlib* | \
- linux-musl* | linux-uclibc* | uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | \
- knetbsd*-gnu* | netbsd*-gnu* | \
- kopensolaris*-gnu* | \
+ nto-qnx* | linux-gnu* | linux-dietlibc | linux-newlib* | linux-uclibc* | \
+ uclinux-uclibc* | uclinux-gnu* | kfreebsd*-gnu* | knetbsd*-gnu* | netbsd*-gnu* | \
storm-chaos* | os2-emx* | rtmk-nova*)
os=-$maybe_os
basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`
;;
- android-linux)
- os=-linux-android
- basic_machine=`echo $1 | sed 's/^\(.*\)-\([^-]*-[^-]*\)$/\1/'`-unknown
- ;;
*)
basic_machine=`echo $1 | sed 's/-[^-]*$//'`
if [ $basic_machine != $1 ]
@@ -149,13 +148,10 @@ case $os in
-convergent* | -ncr* | -news | -32* | -3600* | -3100* | -hitachi* |\
-c[123]* | -convex* | -sun | -crds | -omron* | -dg | -ultra | -tti* | \
-harris | -dolphin | -highlevel | -gould | -cbm | -ns | -masscomp | \
- -apple | -axis | -knuth | -cray | -microblaze*)
+ -apple | -axis | -knuth | -cray)
os=
basic_machine=$1
;;
- -bluegene*)
- os=-cnk
- ;;
-sim | -cisco | -oki | -wec | -winbond)
os=
basic_machine=$1
@@ -170,10 +166,10 @@ case $os in
os=-chorusos
basic_machine=$1
;;
- -chorusrdb)
- os=-chorusrdb
+ -chorusrdb)
+ os=-chorusrdb
basic_machine=$1
- ;;
+ ;;
-hiux*)
os=-hiuxwe2
;;
@@ -218,12 +214,6 @@ case $os in
-isc*)
basic_machine=`echo $1 | sed -e 's/86-.*/86-pc/'`
;;
- -lynx*178)
- os=-lynxos178
- ;;
- -lynx*5)
- os=-lynxos5
- ;;
-lynx*)
os=-lynxos
;;
@@ -248,28 +238,19 @@ case $basic_machine in
# Some are omitted here because they have special meanings below.
1750a | 580 \
| a29k \
- | aarch64 | aarch64_be \
| alpha | alphaev[4-8] | alphaev56 | alphaev6[78] | alphapca5[67] \
| alpha64 | alpha64ev[4-8] | alpha64ev56 | alpha64ev6[78] | alpha64pca5[67] \
| am33_2.0 \
- | arc | arceb \
- | arm | arm[bl]e | arme[lb] | armv[2-8] | armv[3-8][lb] | armv7[arm] \
- | avr | avr32 \
- | be32 | be64 \
+ | arc | arm | arm[bl]e | arme[lb] | armv[2345] | armv[345][lb] | avr | avr32 \
| bfin \
- | c4x | c8051 | clipper \
+ | c4x | clipper \
| d10v | d30v | dlx | dsp16xx \
- | epiphany \
| fido | fr30 | frv \
| h8300 | h8500 | hppa | hppa1.[01] | hppa2.0 | hppa2.0[nw] | hppa64 \
- | hexagon \
| i370 | i860 | i960 | ia64 \
| ip2k | iq2000 \
- | k1om \
- | le32 | le64 \
- | lm32 \
| m32c | m32r | m32rle | m68000 | m68k | m88k \
- | maxq | mb | microblaze | microblazeel | mcore | mep | metag \
+ | maxq | mb | microblaze | mcore | mep | metag \
| mips | mipsbe | mipseb | mipsel | mipsle \
| mips16 \
| mips64 | mips64el \
@@ -287,45 +268,31 @@ case $basic_machine in
| mipsisa64r2 | mipsisa64r2el \
| mipsisa64sb1 | mipsisa64sb1el \
| mipsisa64sr71k | mipsisa64sr71kel \
- | mipsr5900 | mipsr5900el \
| mipstx39 | mipstx39el \
| mn10200 | mn10300 \
- | moxie \
| mt \
| msp430 \
- | nds32 | nds32le | nds32be \
- | nios | nios2 | nios2eb | nios2el \
+ | nios | nios2 \
| ns16k | ns32k \
- | open8 \
- | or1k | or32 \
+ | or32 \
| pdp10 | pdp11 | pj | pjl \
- | powerpc | powerpc64 | powerpc64le | powerpcle \
+ | powerpc | powerpc64 | powerpc64le | powerpcle | ppcbe \
| pyramid \
- | rl78 | rx \
| score \
- | sh | sh[1234] | sh[24]a | sh[24]aeb | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
+ | sh | sh[1234] | sh[24]a | sh[23]e | sh[34]eb | sheb | shbe | shle | sh[1234]le | sh3ele \
| sh64 | sh64le \
| sparc | sparc64 | sparc64b | sparc64v | sparc86x | sparclet | sparclite \
| sparcv8 | sparcv9 | sparcv9b | sparcv9v \
- | spu \
- | tahoe | tic4x | tic54x | tic55x | tic6x | tic80 | tron \
- | ubicom32 \
- | v850 | v850e | v850e1 | v850e2 | v850es | v850e2v3 \
+ | spu | strongarm \
+ | tahoe | thumb | tic4x | tic80 | tron \
+ | v850 | v850e \
| we32k \
- | x86 | xc16x | xstormy16 | xtensa \
- | z8k | z80)
+ | x86 | xc16x | xscale | xscalee[bl] | xstormy16 | xtensa \
+ | z8k)
basic_machine=$basic_machine-unknown
;;
- c54x)
- basic_machine=tic54x-unknown
- ;;
- c55x)
- basic_machine=tic55x-unknown
- ;;
- c6x)
- basic_machine=tic6x-unknown
- ;;
- m6811 | m68hc11 | m6812 | m68hc12 | m68hcs12x | nvptx | picochip)
+ m6811 | m68hc11 | m6812 | m68hc12)
+ # Motorola 68HC11/12.
basic_machine=$basic_machine-unknown
os=-none
;;
@@ -335,21 +302,6 @@ case $basic_machine in
basic_machine=mt-unknown
;;
- strongarm | thumb | xscale)
- basic_machine=arm-unknown
- ;;
- xgate)
- basic_machine=$basic_machine-unknown
- os=-none
- ;;
- xscaleeb)
- basic_machine=armeb-unknown
- ;;
-
- xscaleel)
- basic_machine=armel-unknown
- ;;
-
# We use `pc' rather than `unknown'
# because (1) that's what they normally are, and
# (2) the word "unknown" tends to confuse beginning users.
@@ -364,31 +316,24 @@ case $basic_machine in
# Recognize the basic CPU types with company name.
580-* \
| a29k-* \
- | aarch64-* | aarch64_be-* \
| alpha-* | alphaev[4-8]-* | alphaev56-* | alphaev6[78]-* \
| alpha64-* | alpha64ev[4-8]-* | alpha64ev56-* | alpha64ev6[78]-* \
- | alphapca5[67]-* | alpha64pca5[67]-* | arc-* | arceb-* \
+ | alphapca5[67]-* | alpha64pca5[67]-* | arc-* \
| arm-* | armbe-* | armle-* | armeb-* | armv*-* \
| avr-* | avr32-* \
- | be32-* | be64-* \
| bfin-* | bs2000-* \
- | c[123]* | c30-* | [cjt]90-* | c4x-* \
- | c8051-* | clipper-* | craynv-* | cydra-* \
+ | c[123]* | c30-* | [cjt]90-* | c4x-* | c54x-* | c55x-* | c6x-* \
+ | clipper-* | craynv-* | cydra-* \
| d10v-* | d30v-* | dlx-* \
| elxsi-* \
| f30[01]-* | f700-* | fido-* | fr30-* | frv-* | fx80-* \
| h8300-* | h8500-* \
| hppa-* | hppa1.[01]-* | hppa2.0-* | hppa2.0[nw]-* | hppa64-* \
- | hexagon-* \
| i*86-* | i860-* | i960-* | ia64-* \
| ip2k-* | iq2000-* \
- | k1om-* \
- | le32-* | le64-* \
- | lm32-* \
| m32c-* | m32r-* | m32rle-* \
| m68000-* | m680[012346]0-* | m68360-* | m683?2-* | m68k-* \
| m88110-* | m88k-* | maxq-* | mcore-* | metag-* \
- | microblaze-* | microblazeel-* \
| mips-* | mipsbe-* | mipseb-* | mipsel-* | mipsle-* \
| mips16-* \
| mips64-* | mips64el-* \
@@ -406,37 +351,31 @@ case $basic_machine in
| mipsisa64r2-* | mipsisa64r2el-* \
| mipsisa64sb1-* | mipsisa64sb1el-* \
| mipsisa64sr71k-* | mipsisa64sr71kel-* \
- | mipsr5900-* | mipsr5900el-* \
| mipstx39-* | mipstx39el-* \
| mmix-* \
| mt-* \
| msp430-* \
- | nds32-* | nds32le-* | nds32be-* \
- | nios-* | nios2-* | nios2eb-* | nios2el-* \
+ | nios-* | nios2-* \
| none-* | np1-* | ns16k-* | ns32k-* \
- | open8-* \
| orion-* \
| pdp10-* | pdp11-* | pj-* | pjl-* | pn-* | power-* \
- | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* \
+ | powerpc-* | powerpc64-* | powerpc64le-* | powerpcle-* | ppcbe-* \
| pyramid-* \
- | rl78-* | romp-* | rs6000-* | rx-* \
- | sh-* | sh[1234]-* | sh[24]a-* | sh[24]aeb-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
+ | romp-* | rs6000-* \
+ | sh-* | sh[1234]-* | sh[24]a-* | sh[23]e-* | sh[34]eb-* | sheb-* | shbe-* \
| shle-* | sh[1234]le-* | sh3ele-* | sh64-* | sh64le-* \
| sparc-* | sparc64-* | sparc64b-* | sparc64v-* | sparc86x-* | sparclet-* \
| sparclite-* \
- | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | sv1-* | sx?-* \
- | tahoe-* \
- | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* \
- | tile*-* \
+ | sparcv8-* | sparcv9-* | sparcv9b-* | sparcv9v-* | strongarm-* | sv1-* | sx?-* \
+ | tahoe-* | thumb-* \
+ | tic30-* | tic4x-* | tic54x-* | tic55x-* | tic6x-* | tic80-* | tile-* \
| tron-* \
- | ubicom32-* \
- | v850-* | v850e-* | v850e1-* | v850es-* | v850e2-* | v850e2v3-* \
- | vax-* \
+ | v850-* | v850e-* | vax-* \
| we32k-* \
- | x86-* | x86_64-* | xc16x-* | xps100-* \
+ | x86-* | x86_64-* | xc16x-* | xps100-* | xscale-* | xscalee[bl]-* \
| xstormy16-* | xtensa*-* \
| ymp-* \
- | z8k-* | z80-*)
+ | z8k-*)
;;
# Recognize the basic CPU types without company name, with glob match.
xtensa*)
@@ -458,7 +397,7 @@ case $basic_machine in
basic_machine=a29k-amd
os=-udi
;;
- abacus)
+ abacus)
basic_machine=abacus-unknown
;;
adobe68k)
@@ -504,10 +443,6 @@ case $basic_machine in
basic_machine=m68k-apollo
os=-bsd
;;
- aros)
- basic_machine=i386-pc
- os=-aros
- ;;
aux)
basic_machine=m68k-apple
os=-aux
@@ -524,24 +459,11 @@ case $basic_machine in
basic_machine=bfin-`echo $basic_machine | sed 's/^[^-]*-//'`
os=-linux
;;
- bluegene*)
- basic_machine=powerpc-ibm
- os=-cnk
- ;;
- c54x-*)
- basic_machine=tic54x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c55x-*)
- basic_machine=tic55x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
- c6x-*)
- basic_machine=tic6x-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
c90)
basic_machine=c90-cray
os=-unicos
;;
- cegcc)
+ cegcc)
basic_machine=arm-unknown
os=-cegcc
;;
@@ -573,7 +495,7 @@ case $basic_machine in
basic_machine=craynv-cray
os=-unicosmp
;;
- cr16 | cr16-*)
+ cr16)
basic_machine=cr16-unknown
os=-elf
;;
@@ -731,6 +653,7 @@ case $basic_machine in
i370-ibm* | ibm*)
basic_machine=i370-ibm
;;
+# I'm not sure what "Sysv32" means. Should this be sysv3.2?
i*86v32)
basic_machine=`echo $1 | sed -e 's/86.*/86-pc/'`
os=-sysv32
@@ -788,15 +711,8 @@ case $basic_machine in
basic_machine=ns32k-utek
os=-sysv
;;
- microblaze*)
- basic_machine=microblaze-xilinx
- ;;
- mingw64)
- basic_machine=x86_64-pc
- os=-mingw64
- ;;
mingw32)
- basic_machine=i686-pc
+ basic_machine=i386-pc
os=-mingw32
;;
mingw32ce)
@@ -831,18 +747,10 @@ case $basic_machine in
ms1-*)
basic_machine=`echo $basic_machine | sed -e 's/ms1-/mt-/'`
;;
- msys)
- basic_machine=i686-pc
- os=-msys
- ;;
mvs)
basic_machine=i370-ibm
os=-mvs
;;
- nacl)
- basic_machine=le32-unknown
- os=-nacl
- ;;
ncr3000)
basic_machine=i486-ncr
os=-sysv4
@@ -907,12 +815,6 @@ case $basic_machine in
np1)
basic_machine=np1-gould
;;
- neo-tandem)
- basic_machine=neo-tandem
- ;;
- nse-tandem)
- basic_machine=nse-tandem
- ;;
nsr-tandem)
basic_machine=nsr-tandem
;;
@@ -995,10 +897,9 @@ case $basic_machine in
;;
power) basic_machine=power-ibm
;;
- ppc | ppcbe) basic_machine=powerpc-unknown
+ ppc) basic_machine=powerpc-unknown
;;
- ppc-* | ppcbe-*)
- basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
+ ppc-*) basic_machine=powerpc-`echo $basic_machine | sed 's/^[^-]*-//'`
;;
ppcle | powerpclittle | ppc-le | powerpc-little)
basic_machine=powerpcle-unknown
@@ -1023,11 +924,7 @@ case $basic_machine in
basic_machine=i586-unknown
os=-pw32
;;
- rdos | rdos64)
- basic_machine=x86_64-pc
- os=-rdos
- ;;
- rdos32)
+ rdos)
basic_machine=i386-pc
os=-rdos
;;
@@ -1096,9 +993,6 @@ case $basic_machine in
basic_machine=i860-stratus
os=-sysv4
;;
- strongarm-* | thumb-*)
- basic_machine=arm-`echo $basic_machine | sed 's/^[^-]*-//'`
- ;;
sun2)
basic_machine=m68000-sun
;;
@@ -1155,8 +1049,20 @@ case $basic_machine in
basic_machine=t90-cray
os=-unicos
;;
+ tic54x | c54x*)
+ basic_machine=tic54x-unknown
+ os=-coff
+ ;;
+ tic55x | c55x*)
+ basic_machine=tic55x-unknown
+ os=-coff
+ ;;
+ tic6x | c6x*)
+ basic_machine=tic6x-unknown
+ os=-coff
+ ;;
tile*)
- basic_machine=$basic_machine-unknown
+ basic_machine=tile-unknown
os=-linux-gnu
;;
tx39)
@@ -1226,9 +1132,6 @@ case $basic_machine in
xps | xps100)
basic_machine=xps100-honeywell
;;
- xscale-* | xscalee[bl]-*)
- basic_machine=`echo $basic_machine | sed 's/^xscale/arm/'`
- ;;
ymp)
basic_machine=ymp-cray
os=-unicos
@@ -1237,10 +1140,6 @@ case $basic_machine in
basic_machine=z8k-unknown
os=-sim
;;
- z80-*-coff)
- basic_machine=z80-unknown
- os=-sim
- ;;
none)
basic_machine=none-none
os=-none
@@ -1279,7 +1178,7 @@ case $basic_machine in
we32k)
basic_machine=we32k-att
;;
- sh[1234] | sh[24]a | sh[24]aeb | sh[34]eb | sh[1234]le | sh[23]ele)
+ sh[1234] | sh[24]a | sh[34]eb | sh[1234]le | sh[23]ele)
basic_machine=sh-unknown
;;
sparc | sparcv8 | sparcv9 | sparcv9b | sparcv9v)
@@ -1326,12 +1225,9 @@ esac
if [ x"$os" != x"" ]
then
case $os in
- # First match some system type aliases
- # that might get confused with valid system types.
+ # First match some system type aliases
+ # that might get confused with valid system types.
# -solaris* is a basic system type, with this one exception.
- -auroraux)
- os=-auroraux
- ;;
-solaris1 | -solaris1.*)
os=`echo $os | sed -e 's|solaris1|sunos4|'`
;;
@@ -1352,23 +1248,21 @@ case $os in
# Each alternative MUST END IN A *, to match a version number.
# -sysv* is not here because it comes later, after sysvr4.
-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* | -plan9* \
+ | -*vms* | -sco* | -esix* | -isc* | -aix* | -sunos | -sunos[34]*\
+ | -hpux* | -unos* | -osf* | -luna* | -dgux* | -solaris* | -sym* \
| -amigaos* | -amigados* | -msdos* | -newsos* | -unicos* | -aof* \
- | -aos* | -aros* \
+ | -aos* \
| -nindy* | -vxsim* | -vxworks* | -ebmon* | -hms* | -mvs* \
| -clix* | -riscos* | -uniplus* | -iris* | -rtu* | -xenix* \
| -hiux* | -386bsd* | -knetbsd* | -mirbsd* | -netbsd* \
- | -bitrig* | -openbsd* | -solidbsd* \
+ | -openbsd* | -solidbsd* \
| -ekkobsd* | -kfreebsd* | -freebsd* | -riscix* | -lynxos* \
| -bosx* | -nextstep* | -cxux* | -aout* | -elf* | -oabi* \
| -ptx* | -coff* | -ecoff* | -winnt* | -domain* | -vsta* \
| -udi* | -eabi* | -lites* | -ieee* | -go32* | -aux* \
| -chorusos* | -chorusrdb* | -cegcc* \
- | -cygwin* | -msys* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
- | -mingw32* | -mingw64* | -linux-gnu* | -linux-android* \
- | -linux-newlib* | -linux-musl* | -linux-uclibc* \
+ | -cygwin* | -pe* | -psos* | -moss* | -proelf* | -rtems* \
+ | -mingw32* | -linux-gnu* | -linux-newlib* | -linux-uclibc* \
| -uxpv* | -beos* | -mpeix* | -udk* \
| -interix* | -uwin* | -mks* | -rhapsody* | -darwin* | -opened* \
| -openstep* | -oskit* | -conix* | -pw32* | -nonstopux* \
@@ -1376,7 +1270,7 @@ case $os in
| -os2* | -vos* | -palmos* | -uclinux* | -nucleus* \
| -morphos* | -superux* | -rtmk* | -rtmk-nova* | -windiss* \
| -powermax* | -dnix* | -nx6 | -nx7 | -sei* | -dragonfly* \
- | -skyos* | -haiku* | -rdos* | -toppers* | -drops* | -es*)
+ | -skyos* | -haiku* | -rdos* | -toppers* | -drops*)
# Remember, each alternative MUST END IN *, to match a version number.
;;
-qnx*)
@@ -1415,7 +1309,7 @@ case $os in
-opened*)
os=-openedition
;;
- -os400*)
+ -os400*)
os=-os400
;;
-wince*)
@@ -1464,7 +1358,7 @@ case $os in
-sinix*)
os=-sysv4
;;
- -tpf*)
+ -tpf*)
os=-tpf
;;
-triton*)
@@ -1500,14 +1394,15 @@ case $os in
-aros*)
os=-aros
;;
+ -kaos*)
+ os=-kaos
+ ;;
-zvmoe)
os=-zvmoe
;;
-dicos*)
os=-dicos
;;
- -nacl*)
- ;;
-none)
;;
*)
@@ -1530,10 +1425,10 @@ else
# system, and we'll never get to this point.
case $basic_machine in
- score-*)
+ score-*)
os=-elf
;;
- spu-*)
+ spu-*)
os=-elf
;;
*-acorn)
@@ -1545,23 +1440,8 @@ case $basic_machine in
arm*-semi)
os=-aout
;;
- c4x-* | tic4x-*)
- os=-coff
- ;;
- c8051-*)
- os=-elf
- ;;
- hexagon-*)
- os=-elf
- ;;
- tic54x-*)
- os=-coff
- ;;
- tic55x-*)
- os=-coff
- ;;
- tic6x-*)
- os=-coff
+ c4x-* | tic4x-*)
+ os=-coff
;;
# This must come before the *-dec entry.
pdp10-*)
@@ -1581,11 +1461,14 @@ case $basic_machine in
;;
m68000-sun)
os=-sunos3
+ # This also exists in the configure program, but was not the
+ # default.
+ # os=-sunos4
;;
m68*-cisco)
os=-aout
;;
- mep-*)
+ mep-*)
os=-elf
;;
mips*-cisco)
@@ -1594,9 +1477,6 @@ case $basic_machine in
mips*-*)
os=-elf
;;
- or1k-*)
- os=-elf
- ;;
or32-*)
os=-coff
;;
@@ -1615,7 +1495,7 @@ case $basic_machine in
*-ibm)
os=-aix
;;
- *-knuth)
+ *-knuth)
os=-mmixware
;;
*-wec)
@@ -1720,7 +1600,7 @@ case $basic_machine in
-sunos*)
vendor=sun
;;
- -cnk*|-aix*)
+ -aix*)
vendor=ibm
;;
-beos*)
diff --git a/gmp/configure b/gmp/configure
index 60c6bd55eb..215ea71ce2 100755
--- a/gmp/configure
+++ b/gmp/configure
@@ -1,115 +1,84 @@
#! /bin/sh
-# From configure.ac Revision.
+# From configure.in Revision.
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for GNU MP 6.0.0.
+# Generated by GNU Autoconf 2.61 for GNU MP 4.3.2.
#
-# Report bugs to <gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html>.
+# Report bugs to <gmp-bugs@gmplib.org>.
#
#
#
-# Copyright 1996-2014 Free Software Foundation, Inc.
+# Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+# 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 either:
-#
-# * the GNU Lesser General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your
-# option) any later version.
-#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
+# it under the terms of the GNU 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 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/.
-#
-#
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
#
-# Copyright (C) 1992-1996, 1998-2012 Free Software Foundation, Inc.
+# You should have 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 (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+# 2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
# This configure script is free software; the Free Software Foundation
# gives unlimited permission to copy, distribute and modify it.
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+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
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
esac
+
fi
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='print -r --'
- as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in #(
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
fi
@@ -118,19 +87,20 @@ fi
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
+as_nl='
+'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
+case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
- done
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
IFS=$as_save_IFS
;;
@@ -141,376 +111,354 @@ if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- exit 1
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
fi
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there. '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ fi
+done
+
+# Required to use basename.
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
+if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
+ as_basename=basename
+else
+ as_basename=false
+fi
+
+
+# Name of the executable.
+as_me=`$as_basename -- "$0" ||
+$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X/"$0" |
+ sed '/^.*\/\([^/][^/]*\)\/*$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\/\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+$as_unset CDPATH
+
-# Use a proper internal environment variable to ensure we don't fall
- # into an infinite loop, continuously re-executing ourselves.
- if test x"${_as_can_reexec}" != xno && test "x$CONFIG_SHELL" != x; then
- _as_can_reexec=no; export _as_can_reexec;
- # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-as_fn_exit 255
- fi
- # We don't want this to propagate to other subprocesses.
- { _as_can_reexec=; unset _as_can_reexec;}
if test "x$CONFIG_SHELL" = x; then
- as_bourne_compatible="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
+ if (eval ":") 2>/dev/null; then
+ as_have_required=yes
else
- case \`(set -o) 2>/dev/null\` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
-esac
+ as_have_required=no
fi
-"
- as_required="as_fn_return () { (exit \$1); }
-as_fn_success () { as_fn_return 0; }
-as_fn_failure () { as_fn_return 1; }
-as_fn_ret_success () { return 0; }
-as_fn_ret_failure () { return 1; }
+
+ if test $as_have_required = yes && (eval ":
+(as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
exitcode=0
-as_fn_success || { exitcode=1; echo as_fn_success failed.; }
-as_fn_failure && { exitcode=1; echo as_fn_failure succeeded.; }
-as_fn_ret_success || { exitcode=1; echo as_fn_ret_success failed.; }
-as_fn_ret_failure && { exitcode=1; echo as_fn_ret_failure succeeded.; }
-if ( set x; as_fn_ret_success y && test x = \"\$1\" ); then :
-
-else
- exitcode=1; echo positional parameters were not saved.
-fi
-test x\$exitcode = x0 || exit 1
-test -x / || exit 1"
- as_suggested=" as_lineno_1=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_1a=\$LINENO
- as_lineno_2=";as_suggested=$as_suggested$LINENO;as_suggested=$as_suggested" as_lineno_2a=\$LINENO
- eval 'test \"x\$as_lineno_1'\$as_run'\" != \"x\$as_lineno_2'\$as_run'\" &&
- test \"x\`expr \$as_lineno_1'\$as_run' + 1\`\" = \"x\$as_lineno_2'\$as_run'\"' || exit 1
-test \$(( 1 + 1 )) = 2 || exit 1
-
- test -n \"\${ZSH_VERSION+set}\${BASH_VERSION+set}\" || (
- ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
- ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
- ECHO=\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO\$ECHO
- PATH=/empty FPATH=/empty; export PATH FPATH
- test \"X\`printf %s \$ECHO\`\" = \"X\$ECHO\" \\
- || test \"X\`print -r -- \$ECHO\`\" = \"X\$ECHO\" ) || exit 1"
- if (eval "$as_required") 2>/dev/null; then :
- as_have_required=yes
+if as_func_success; then
+ :
else
- as_have_required=no
+ exitcode=1
+ echo as_func_success failed.
+fi
+
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
fi
- if test x$as_have_required = xyes && (eval "$as_suggested") 2>/dev/null; then :
+if as_func_ret_success; then
+ :
else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-as_found=false
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
+else
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+
+test \$exitcode = 0) || { (exit 1); exit 1; }
+
+(
+ as_lineno_1=\$LINENO
+ as_lineno_2=\$LINENO
+ test \"x\$as_lineno_1\" != \"x\$as_lineno_2\" &&
+ test \"x\`expr \$as_lineno_1 + 1\`\" = \"x\$as_lineno_2\") || { (exit 1); exit 1; }
+") 2> /dev/null; then
+ :
+else
+ as_candidate_shells=
+ as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in /bin$PATH_SEPARATOR/usr/bin$PATH_SEPARATOR$PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- as_found=:
- case $as_dir in #(
+ case $as_dir in
/*)
for as_base in sh bash ksh sh5; do
- # Try only shells that exist, to save several forks.
- as_shell=$as_dir/$as_base
- if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$as_shell"; } 2>/dev/null; then :
- CONFIG_SHELL=$as_shell as_have_required=yes
- if { $as_echo "$as_bourne_compatible""$as_suggested" | as_run=a "$as_shell"; } 2>/dev/null; then :
- break 2
-fi
-fi
+ as_candidate_shells="$as_candidate_shells $as_dir/$as_base"
done;;
esac
- as_found=false
done
-$as_found || { if { test -f "$SHELL" || test -f "$SHELL.exe"; } &&
- { $as_echo "$as_bourne_compatible""$as_required" | as_run=a "$SHELL"; } 2>/dev/null; then :
- CONFIG_SHELL=$SHELL as_have_required=yes
-fi; }
IFS=$as_save_IFS
- if test "x$CONFIG_SHELL" != x; then :
- export CONFIG_SHELL
- # We cannot yet assume a decent shell, so we have to provide a
-# neutralization value for shells without unset; and this also
-# works around shells that cannot unset nonexistent variables.
-# Preserve -v and -x to the replacement shell.
-BASH_ENV=/dev/null
-ENV=/dev/null
-(unset BASH_ENV) >/dev/null 2>&1 && unset BASH_ENV ENV
-case $- in # ((((
- *v*x* | *x*v* ) as_opts=-vx ;;
- *v* ) as_opts=-v ;;
- *x* ) as_opts=-x ;;
- * ) as_opts= ;;
-esac
-exec $CONFIG_SHELL $as_opts "$as_myself" ${1+"$@"}
-# Admittedly, this is quite paranoid, since all the known shells bail
-# out after a failed `exec'.
-$as_echo "$0: could not re-execute with $CONFIG_SHELL" >&2
-exit 255
-fi
-
- if test x$as_have_required = xno; then :
- $as_echo "$0: This script requires a shell more modern than all"
- $as_echo "$0: the shells that I found on your system."
- if test x${ZSH_VERSION+set} = xset ; then
- $as_echo "$0: In particular, zsh $ZSH_VERSION has bugs and should"
- $as_echo "$0: be upgraded to zsh 4.3.4 or later."
- else
- $as_echo "$0: Please tell bug-autoconf@gnu.org and
-$0: gmp-bugs@gmplib.org, see
-$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
-fi
+ for as_shell in $as_candidate_shells $SHELL; do
+ # Try only shells that exist, to save several forks.
+ if { test -f "$as_shell" || test -f "$as_shell.exe"; } &&
+ { ("$as_shell") 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
+
fi
-SHELL=${CONFIG_SHELL-/bin/sh}
-export SHELL
-# Unset more variables known to interfere with behavior of common tools.
-CLICOLOR_FORCE= GREP_OPTIONS=
-unset CLICOLOR_FORCE GREP_OPTIONS
-## --------------------- ##
-## M4sh Shell Functions. ##
-## --------------------- ##
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
- { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
- return $1
-} # as_fn_set_status
+:
+_ASEOF
+}; then
+ CONFIG_SHELL=$as_shell
+ as_have_required=yes
+ if { "$as_shell" 2> /dev/null <<\_ASEOF
+if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '${1+"$@"}'='"$@"'
+ setopt NO_GLOB_SUBST
+else
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
+esac
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
- set +e
- as_fn_set_status $1
- exit $1
-} # as_fn_exit
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
+fi
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || eval $as_mkdir_p || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
+:
+(as_func_return () {
+ (exit $1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
+else
+ exitcode=1
+ echo as_func_success failed.
+fi
-} # as_fn_mkdir_p
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
- test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
- eval 'as_fn_append ()
- {
- eval $1+=\$2
- }'
+if as_func_ret_success; then
+ :
else
- as_fn_append ()
- {
- eval $1=\$$1\$2
- }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
- eval 'as_fn_arith ()
- {
- as_val=$(( $* ))
- }'
+ exitcode=1
+ echo as_func_ret_success failed.
+fi
+
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = "$1" ); then
+ :
else
- as_fn_arith ()
- {
- as_val=`expr "$@" || test $? -eq 1`
- }
-fi # as_fn_arith
+ exitcode=1
+ echo positional parameters were not saved.
+fi
+test $exitcode = 0) || { (exit 1); exit 1; }
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
- as_status=$1; test $as_status -eq 0 && as_status=1
- if test "$4"; then
- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
- fi
- $as_echo "$as_me: error: $2" >&2
- as_fn_exit $as_status
-} # as_fn_error
+(
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2") || { (exit 1); exit 1; }
-if expr a : '\(a\)' >/dev/null 2>&1 &&
- test "X`expr 00001 : '.*\(...\)'`" = X001; then
- as_expr=expr
+_ASEOF
+}; then
+ break
+fi
+
+fi
+
+ done
+
+ if test "x$CONFIG_SHELL" != x; then
+ for as_var in BASH_ENV ENV
+ do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
+ done
+ export CONFIG_SHELL
+ exec "$CONFIG_SHELL" "$as_myself" ${1+"$@"}
+fi
+
+
+ if test $as_have_required = no; then
+ echo This script requires a shell more modern than all the
+ echo shells that I found on your system. Please install a
+ echo modern shell, or manually run the script under such a
+ echo shell if you do have one.
+ { (exit 1); exit 1; }
+fi
+
+
+fi
+
+fi
+
+
+
+(eval "as_func_return () {
+ (exit \$1)
+}
+as_func_success () {
+ as_func_return 0
+}
+as_func_failure () {
+ as_func_return 1
+}
+as_func_ret_success () {
+ return 0
+}
+as_func_ret_failure () {
+ return 1
+}
+
+exitcode=0
+if as_func_success; then
+ :
else
- as_expr=false
+ exitcode=1
+ echo as_func_success failed.
fi
-if (basename -- /) >/dev/null 2>&1 && test "X`basename -- / 2>&1`" = "X/"; then
- as_basename=basename
+if as_func_failure; then
+ exitcode=1
+ echo as_func_failure succeeded.
+fi
+
+if as_func_ret_success; then
+ :
else
- as_basename=false
+ exitcode=1
+ echo as_func_ret_success failed.
fi
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
+if as_func_ret_failure; then
+ exitcode=1
+ echo as_func_ret_failure succeeded.
+fi
+
+if ( set x; as_func_ret_success y && test x = \"\$1\" ); then
+ :
else
- as_dirname=false
+ exitcode=1
+ echo positional parameters were not saved.
fi
-as_me=`$as_basename -- "$0" ||
-$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
- X"$0" : 'X\(//\)$' \| \
- X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
- sed '/^.*\/\([^/][^/]*\)\/*$/{
- s//\1/
- q
- }
- /^X\/\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\/\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
+test \$exitcode = 0") || {
+ echo No shell found that supports shell functions.
+ echo Please tell autoconf@gnu.org about your system,
+ echo including any error possibly output before this
+ echo message
+}
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
- as_lineno_1=$LINENO as_lineno_1a=$LINENO
- as_lineno_2=$LINENO as_lineno_2a=$LINENO
- eval 'test "x$as_lineno_1'$as_run'" != "x$as_lineno_2'$as_run'" &&
- test "x`expr $as_lineno_1'$as_run' + 1`" = "x$as_lineno_2'$as_run'"' || {
- # Blame Lee E. McMahon (1931-1989) for sed's syntax. :-)
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
sed -n '
p
/[$]LINENO/=
@@ -527,12 +475,9 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
s/-\n.*//
' >$as_me.lineno &&
chmod +x "$as_me.lineno" ||
- { $as_echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2; as_fn_exit 1; }
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
- # If we had to re-execute with $CONFIG_SHELL, we're ensured to have
- # already done that, so ensure we don't try to do so again and fall
- # in an infinite loop. This has already happened in practice.
- _as_can_reexec=no; export _as_can_reexec
# Don't try to exec as it changes $[0], causing all sort of problems
# (the dirname of $[0] is not the place where we might find the
# original and so on. Autoconf is especially sensitive to this).
@@ -541,55 +486,84 @@ as_cr_alnum=$as_cr_Letters$as_cr_digits
exit
}
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
+
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
+case `echo -n x` in
-n*)
- case `echo 'xy\c'` in
+ case `echo 'x\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- xy) ECHO_C='\c';;
- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
- ECHO_T=' ';;
+ *) ECHO_C='\c';;
esac;;
*)
ECHO_N='-n';;
esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -pR'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -pR'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -pR'
- fi
-else
- as_ln_s='cp -pR'
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
if mkdir -p . 2>/dev/null; then
- as_mkdir_p='mkdir -p "$as_dir"'
+ as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -597,14 +571,166 @@ as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
# Sed expression to map a string onto a valid variable name.
as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
+
+
+
+# Check that we are running under the correct shell.
SHELL=${CONFIG_SHELL-/bin/sh}
+case X$ECHO in
+X*--fallback-echo)
+ # Remove one level of quotation (which was required for Make).
+ ECHO=`echo "$ECHO" | sed 's,\\\\\$\\$0,'$0','`
+ ;;
+esac
+
+echo=${ECHO-echo}
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t' ; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell.
+ exec $SHELL "$0" --no-reexec ${1+"$@"}
+fi
-test -n "$DJDIR" || exec 7<&0 </dev/null
-exec 6>&1
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit 0
+fi
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+if test -z "$ECHO"; then
+if test "X${echo_test_string+set}" != Xset; then
+# find a string as large as possible, as long as the shell can cope with it
+ for cmd in 'sed 50q "$0"' 'sed 20q "$0"' 'sed 10q "$0"' 'sed 2q "$0"' 'echo test'; do
+ # expected sizes: less than 2Kb, 1Kb, 512 bytes, 16 bytes, ...
+ if (echo_test_string=`eval $cmd`) 2>/dev/null &&
+ echo_test_string=`eval $cmd` &&
+ (test "X$echo_test_string" = "X$echo_test_string") 2>/dev/null
+ then
+ break
+ fi
+ done
+fi
+
+if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ :
+else
+ # The Solaris, AIX, and Digital Unix default echo programs unquote
+ # backslashes. This makes it impossible to quote backslashes using
+ # echo "$something" | sed 's/\\/\\\\/g'
+ #
+ # So, first we look for a working echo in the user's PATH.
+
+ lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
+ for dir in $PATH /usr/ucb; do
+ IFS="$lt_save_ifs"
+ if (test -f $dir/echo || test -f $dir/echo$ac_exeext) &&
+ test "X`($dir/echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($dir/echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$dir/echo"
+ break
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ if test "X$echo" = Xecho; then
+ # We didn't find a better echo, so look for alternatives.
+ if test "X`(print -r '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`(print -r "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # This shell has a builtin print -r that does the trick.
+ echo='print -r'
+ elif (test -f /bin/ksh || test -f /bin/ksh$ac_exeext) &&
+ test "X$CONFIG_SHELL" != X/bin/ksh; then
+ # If we have ksh, try running configure again with it.
+ ORIGINAL_CONFIG_SHELL=${CONFIG_SHELL-/bin/sh}
+ export ORIGINAL_CONFIG_SHELL
+ CONFIG_SHELL=/bin/ksh
+ export CONFIG_SHELL
+ exec $CONFIG_SHELL "$0" --no-reexec ${1+"$@"}
+ else
+ # Try using printf.
+ echo='printf %s\n'
+ if test "X`($echo '\t') 2>/dev/null`" = 'X\t' &&
+ echo_testing_string=`($echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ # Cool, printf works
+ :
+ elif echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($ORIGINAL_CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ CONFIG_SHELL=$ORIGINAL_CONFIG_SHELL
+ export CONFIG_SHELL
+ SHELL="$CONFIG_SHELL"
+ export SHELL
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ elif echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo '\t') 2>/dev/null` &&
+ test "X$echo_testing_string" = 'X\t' &&
+ echo_testing_string=`($CONFIG_SHELL "$0" --fallback-echo "$echo_test_string") 2>/dev/null` &&
+ test "X$echo_testing_string" = "X$echo_test_string"; then
+ echo="$CONFIG_SHELL $0 --fallback-echo"
+ else
+ # maybe with a smaller string...
+ prev=:
+
+ for cmd in 'echo test' 'sed 2q "$0"' 'sed 10q "$0"' 'sed 20q "$0"' 'sed 50q "$0"'; do
+ if (test "X$echo_test_string" = "X`eval $cmd`") 2>/dev/null
+ then
+ break
+ fi
+ prev="$cmd"
+ done
+
+ if test "$prev" != 'sed 50q "$0"'; then
+ echo_test_string=`eval $prev`
+ export echo_test_string
+ exec ${ORIGINAL_CONFIG_SHELL-${CONFIG_SHELL-/bin/sh}} "$0" ${1+"$@"}
+ else
+ # Oops. We lost completely, so just stick with echo.
+ echo=echo
+ fi
+ fi
+ fi
+ fi
+fi
+fi
+
+# Copy echo and quote the copy suitably for passing to libtool from
+# the Makefile, instead of quoting the original, which is used later.
+ECHO=$echo
+if test "X$ECHO" = "X$CONFIG_SHELL $0 --fallback-echo"; then
+ ECHO="$CONFIG_SHELL \\\$\$0 --fallback-echo"
+fi
+
+
+
+
+tagnames=${tagnames+${tagnames},}CXX
+
+tagnames=${tagnames+${tagnames},}F77
+
+exec 7<&0 </dev/null 6>&1
# Name of the host.
-# hostname on some systems (SVR3.2, old GNU/Linux) returns a bogus exit status,
+# hostname on some systems (SVR3.2, Linux) returns a bogus exit status,
# so uname gets run too.
ac_hostname=`(hostname || uname -n) 2>/dev/null | sed 1q`
@@ -619,14 +745,14 @@ cross_compiling=no
subdirs=
MFLAGS=
MAKEFLAGS=
+SHELL=${CONFIG_SHELL-/bin/sh}
# Identity of this package.
PACKAGE_NAME='GNU MP'
PACKAGE_TARNAME='gmp'
-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/'
+PACKAGE_VERSION='4.3.2'
+PACKAGE_STRING='GNU MP 4.3.2'
+PACKAGE_BUGREPORT='gmp-bugs@gmplib.org'
ac_unique_file="gmp-impl.h"
# Factoring default headers for most tests.
@@ -665,188 +791,151 @@ ac_includes_default="\
# include <unistd.h>
#endif"
-ac_subst_vars='am__EXEEXT_FALSE
-am__EXEEXT_TRUE
-LTLIBOBJS
-LIBOBJS
-LEXLIB
-LEX_OUTPUT_ROOT
-LEX
-YFLAGS
-YACC
-LIBREADLINE
-WITH_READLINE_01
-LIBCURSES
-HAVE_STACK_T_01
-HAVE_SYS_RESOURCE_H_01
-HAVE_SIGSTACK_01
-HAVE_SIGALTSTACK_01
-HAVE_SIGACTION_01
-HAVE_GETTIMEOFDAY_01
-HAVE_GETRUSAGE_01
-HAVE_CPUTIME_01
-HAVE_CLOCK_01
-TUNE_SQR_OBJ
-gmp_srclinks
-mpn_objs_in_libgmp
-mpn_objects
-GMP_LIMB_BITS
-M4
-TUNE_LIBS
-TAL_OBJECT
-LIBM
-ENABLE_STATIC_FALSE
-ENABLE_STATIC_TRUE
-OTOOL64
-OTOOL
-LIPO
-NMEDIT
-DSYMUTIL
-MANIFEST_TOOL
-RANLIB
-ac_ct_AR
-LN_S
-LD
-FGREP
-SED
-LIBTOOL
+ac_subst_vars='SHELL
+PATH_SEPARATOR
+PACKAGE_NAME
+PACKAGE_TARNAME
+PACKAGE_VERSION
+PACKAGE_STRING
+PACKAGE_BUGREPORT
+exec_prefix
+prefix
+program_transform_name
+bindir
+sbindir
+libexecdir
+datarootdir
+datadir
+sysconfdir
+sharedstatedir
+localstatedir
+includedir
+oldincludedir
+docdir
+infodir
+htmldir
+dvidir
+pdfdir
+psdir
+libdir
+localedir
+mandir
+DEFS
+ECHO_C
+ECHO_N
+ECHO_T
+LIBS
+build_alias
+host_alias
+target_alias
+build
+build_cpu
+build_vendor
+build_os
+host
+host_cpu
+host_vendor
+host_os
+INSTALL_PROGRAM
+INSTALL_SCRIPT
+INSTALL_DATA
+CYGPATH_W
+PACKAGE
+VERSION
+ACLOCAL
+AUTOCONF
+AUTOMAKE
+AUTOHEADER
+MAKEINFO
+AMTAR
+install_sh
+STRIP
+INSTALL_STRIP_PROGRAM
+mkdir_p
+AWK
+SET_MAKE
+am__leading_dot
+MAINTAINER_MODE_TRUE
+MAINTAINER_MODE_FALSE
+MAINT
+WANT_MPBSD_TRUE
+WANT_MPBSD_FALSE
+GMP_NAIL_BITS
+ABI
+HAVE_HOST_CPU_FAMILY_power
+HAVE_HOST_CPU_FAMILY_powerpc
+GMP_LDFLAGS
+LIBGMP_LDFLAGS
+LIBGMPXX_LDFLAGS
+SPEED_CYCLECOUNTER_OBJ
+CALLING_CONVENTIONS_OBJS
+DEFN_LONG_LONG_LIMB
+CC
+CFLAGS
+LDFLAGS
+CPPFLAGS
+ac_ct_CC
+EXEEXT
+OBJEXT
+CPP
+CC_FOR_BUILD
+CPP_FOR_BUILD
+EXEEXT_FOR_BUILD
+U_FOR_BUILD
+LIBM_FOR_BUILD
+CCAS
+CXX
+CXXFLAGS
+ac_ct_CXX
+WANT_CXX_TRUE
+WANT_CXX_FALSE
+CXXCPP
+GREP
+EGREP
+U
+ANSI2KNR
+ASMFLAGS
+AR
LIBGMP_DLL
-OBJDUMP
+SED
+LN_S
+ECHO
+RANLIB
DLLTOOL
AS
-NM
-ac_ct_DUMPBIN
-DUMPBIN
-AR
-ASMFLAGS
-EGREP
-GREP
-CXXCPP
-WANT_CXX_FALSE
-WANT_CXX_TRUE
-ac_ct_CXX
-CXXFLAGS
-CXX
-CCAS
-LIBM_FOR_BUILD
-U_FOR_BUILD
-EXEEXT_FOR_BUILD
-CPP_FOR_BUILD
-CC_FOR_BUILD
-CPP
-OBJEXT
-EXEEXT
-ac_ct_CC
-CPPFLAGS
-LDFLAGS
-CFLAGS
-CC
-DEFN_LONG_LONG_LIMB
-CALLING_CONVENTIONS_OBJS
-SPEED_CYCLECOUNTER_OBJ
-LIBGMPXX_LDFLAGS
-LIBGMP_LDFLAGS
-GMP_LDFLAGS
-HAVE_HOST_CPU_FAMILY_powerpc
-HAVE_HOST_CPU_FAMILY_power
-ABI
-GMP_NAIL_BITS
-MAINT
-MAINTAINER_MODE_FALSE
-MAINTAINER_MODE_TRUE
-am__untar
-am__tar
-AMTAR
-am__leading_dot
-SET_MAKE
-AWK
-mkdir_p
-MKDIR_P
-INSTALL_STRIP_PROGRAM
-STRIP
-install_sh
-MAKEINFO
-AUTOHEADER
-AUTOMAKE
-AUTOCONF
-ACLOCAL
-VERSION
-PACKAGE
-CYGPATH_W
-am__isrc
-INSTALL_DATA
-INSTALL_SCRIPT
-INSTALL_PROGRAM
-host_os
-host_vendor
-host_cpu
-host
-build_os
-build_vendor
-build_cpu
-build
-target_alias
-host_alias
-build_alias
-LIBS
-ECHO_T
-ECHO_N
-ECHO_C
-DEFS
-mandir
-localedir
-libdir
-psdir
-pdfdir
-dvidir
-htmldir
-infodir
-docdir
-oldincludedir
-includedir
-localstatedir
-sharedstatedir
-sysconfdir
-datadir
-datarootdir
-libexecdir
-sbindir
-bindir
-program_transform_name
-prefix
-exec_prefix
-PACKAGE_URL
-PACKAGE_BUGREPORT
-PACKAGE_STRING
-PACKAGE_VERSION
-PACKAGE_TARNAME
-PACKAGE_NAME
-PATH_SEPARATOR
-SHELL'
+OBJDUMP
+LIBTOOL
+ENABLE_STATIC_TRUE
+ENABLE_STATIC_FALSE
+LIBM
+TAL_OBJECT
+M4
+BITS_PER_MP_LIMB
+mpn_objs_in_libmp
+mpn_objects
+mpn_objs_in_libgmp
+gmp_srclinks
+TUNE_SQR_OBJ
+HAVE_CLOCK_01
+HAVE_CPUTIME_01
+HAVE_GETRUSAGE_01
+HAVE_GETTIMEOFDAY_01
+HAVE_SIGACTION_01
+HAVE_SIGALTSTACK_01
+HAVE_SIGSTACK_01
+HAVE_SYS_RESOURCE_H_01
+HAVE_STACK_T_01
+LIBCURSES
+WITH_READLINE_01
+LIBREADLINE
+YACC
+YFLAGS
+LEX
+LEX_OUTPUT_ROOT
+LEXLIB
+LIBOBJS
+LTLIBOBJS'
ac_subst_files=''
-ac_user_opts='
-enable_option_checking
-enable_maintainer_mode
-enable_assert
-enable_alloca
-enable_cxx
-enable_assembly
-enable_fft
-enable_old_fft_full
-enable_nails
-enable_profiling
-with_readline
-enable_fat
-enable_minithres
-enable_fake_cpuid
-enable_shared
-enable_static
-with_pic
-enable_fast_install
-with_gnu_ld
-with_sysroot
-enable_libtool_lock
-'
ac_precious_vars='build_alias
host_alias
target_alias
@@ -871,8 +960,6 @@ YFLAGS'
# Initialize some variables set by options.
ac_init_help=
ac_init_version=false
-ac_unrecognized_opts=
-ac_unrecognized_sep=
# The variables have the same names as the options, with
# dashes changed to underlines.
cache_file=/dev/null
@@ -928,9 +1015,8 @@ do
fi
case $ac_option in
- *=?*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
- *=) ac_optarg= ;;
- *) ac_optarg=yes ;;
+ *=*) ac_optarg=`expr "X$ac_option" : '[^=]*=\(.*\)'` ;;
+ *) ac_optarg=yes ;;
esac
# Accept the important Cygnus configure options, so we can diagnose typos.
@@ -972,20 +1058,13 @@ do
datarootdir=$ac_optarg ;;
-disable-* | --disable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
+ ac_feature=`expr "x$ac_option" : 'x-*disable-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid feature name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--disable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=no ;;
+ expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+ eval enable_$ac_feature=no ;;
-docdir | --docdir | --docdi | --doc | --do)
ac_prev=docdir ;;
@@ -998,20 +1077,13 @@ do
dvidir=$ac_optarg ;;
-enable-* | --enable-*)
- ac_useropt=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
+ ac_feature=`expr "x$ac_option" : 'x-*enable-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid feature name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"enable_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--enable-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval enable_$ac_useropt=\$ac_optarg ;;
+ expr "x$ac_feature" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid feature name: $ac_feature" >&2
+ { (exit 1); exit 1; }; }
+ ac_feature=`echo $ac_feature | sed 's/[-.]/_/g'`
+ eval enable_$ac_feature=\$ac_optarg ;;
-exec-prefix | --exec_prefix | --exec-prefix | --exec-prefi \
| --exec-pref | --exec-pre | --exec-pr | --exec-p | --exec- \
@@ -1202,36 +1274,22 @@ do
ac_init_version=: ;;
-with-* | --with-*)
- ac_useropt=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
+ ac_package=`expr "x$ac_option" : 'x-*with-\([^=]*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid package name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--with-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=\$ac_optarg ;;
+ expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+ eval with_$ac_package=\$ac_optarg ;;
-without-* | --without-*)
- ac_useropt=`expr "x$ac_option" : 'x-*without-\(.*\)'`
+ ac_package=`expr "x$ac_option" : 'x-*without-\(.*\)'`
# Reject names that are not valid shell variable names.
- expr "x$ac_useropt" : ".*[^-+._$as_cr_alnum]" >/dev/null &&
- as_fn_error $? "invalid package name: $ac_useropt"
- ac_useropt_orig=$ac_useropt
- ac_useropt=`$as_echo "$ac_useropt" | sed 's/[-+.]/_/g'`
- case $ac_user_opts in
- *"
-"with_$ac_useropt"
-"*) ;;
- *) ac_unrecognized_opts="$ac_unrecognized_opts$ac_unrecognized_sep--without-$ac_useropt_orig"
- ac_unrecognized_sep=', ';;
- esac
- eval with_$ac_useropt=no ;;
+ expr "x$ac_package" : ".*[^-._$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid package name: $ac_package" >&2
+ { (exit 1); exit 1; }; }
+ ac_package=`echo $ac_package | sed 's/[-.]/_/g'`
+ eval with_$ac_package=no ;;
--x)
# Obsolete; use --with-x.
@@ -1251,26 +1309,26 @@ do
| --x-librar=* | --x-libra=* | --x-libr=* | --x-lib=* | --x-li=* | --x-l=*)
x_libraries=$ac_optarg ;;
- -*) as_fn_error $? "unrecognized option: \`$ac_option'
-Try \`$0 --help' for more information"
+ -*) { echo "$as_me: error: unrecognized option: $ac_option
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; }
;;
*=*)
ac_envvar=`expr "x$ac_option" : 'x\([^=]*\)='`
# Reject names that are not valid shell variable names.
- case $ac_envvar in #(
- '' | [0-9]* | *[!_$as_cr_alnum]* )
- as_fn_error $? "invalid variable name: \`$ac_envvar'" ;;
- esac
+ expr "x$ac_envvar" : ".*[^_$as_cr_alnum]" >/dev/null &&
+ { echo "$as_me: error: invalid variable name: $ac_envvar" >&2
+ { (exit 1); exit 1; }; }
eval $ac_envvar=\$ac_optarg
export $ac_envvar ;;
*)
# FIXME: should be removed in autoconf 3.0.
- $as_echo "$as_me: WARNING: you should use --build, --host, --target" >&2
+ echo "$as_me: WARNING: you should use --build, --host, --target" >&2
expr "x$ac_option" : ".*[^-._$as_cr_alnum]" >/dev/null &&
- $as_echo "$as_me: WARNING: invalid host type: $ac_option" >&2
- : "${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}"
+ echo "$as_me: WARNING: invalid host type: $ac_option" >&2
+ : ${build_alias=$ac_option} ${host_alias=$ac_option} ${target_alias=$ac_option}
;;
esac
@@ -1278,36 +1336,23 @@ done
if test -n "$ac_prev"; then
ac_option=--`echo $ac_prev | sed 's/_/-/g'`
- as_fn_error $? "missing argument to $ac_option"
-fi
-
-if test -n "$ac_unrecognized_opts"; then
- case $enable_option_checking in
- no) ;;
- fatal) as_fn_error $? "unrecognized options: $ac_unrecognized_opts" ;;
- *) $as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2 ;;
- esac
+ { echo "$as_me: error: missing argument to $ac_option" >&2
+ { (exit 1); exit 1; }; }
fi
-# Check all directory arguments for consistency.
+# Be sure to have absolute directory names.
for ac_var in exec_prefix prefix bindir sbindir libexecdir datarootdir \
datadir sysconfdir sharedstatedir localstatedir includedir \
oldincludedir docdir infodir htmldir dvidir pdfdir psdir \
libdir localedir mandir
do
eval ac_val=\$$ac_var
- # Remove trailing slashes.
- case $ac_val in
- */ )
- ac_val=`expr "X$ac_val" : 'X\(.*[^/]\)' \| "X$ac_val" : 'X\(.*\)'`
- eval $ac_var=\$ac_val;;
- esac
- # Be sure to have absolute directory names.
case $ac_val in
[\\/$]* | ?:[\\/]* ) continue;;
NONE | '' ) case $ac_var in *prefix ) continue;; esac;;
esac
- as_fn_error $? "expected an absolute directory name for --$ac_var: $ac_val"
+ { echo "$as_me: error: expected an absolute directory name for --$ac_var: $ac_val" >&2
+ { (exit 1); exit 1; }; }
done
# There might be people who depend on the old broken behavior: `$host'
@@ -1321,6 +1366,8 @@ target=$target_alias
if test "x$host_alias" != x; then
if test "x$build_alias" = x; then
cross_compiling=maybe
+ echo "$as_me: WARNING: If you wanted to set the --build type, don't use --host.
+ If a cross compiler is detected then cross compile mode will be used." >&2
elif test "x$build_alias" != "x$host_alias"; then
cross_compiling=yes
fi
@@ -1335,21 +1382,23 @@ test "$silent" = yes && exec 6>/dev/null
ac_pwd=`pwd` && test -n "$ac_pwd" &&
ac_ls_di=`ls -di .` &&
ac_pwd_ls_di=`cd "$ac_pwd" && ls -di .` ||
- as_fn_error $? "working directory cannot be determined"
+ { echo "$as_me: error: Working directory cannot be determined" >&2
+ { (exit 1); exit 1; }; }
test "X$ac_ls_di" = "X$ac_pwd_ls_di" ||
- as_fn_error $? "pwd does not report name of working directory"
+ { echo "$as_me: error: pwd does not report name of working directory" >&2
+ { (exit 1); exit 1; }; }
# Find the source files, if location was not specified.
if test -z "$srcdir"; then
ac_srcdir_defaulted=yes
# Try the directory containing this script, then the parent directory.
- ac_confdir=`$as_dirname -- "$as_myself" ||
-$as_expr X"$as_myself" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_myself" : 'X\(//\)[^/]' \| \
- X"$as_myself" : 'X\(//\)$' \| \
- X"$as_myself" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_myself" |
+ ac_confdir=`$as_dirname -- "$0" ||
+$as_expr X"$0" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$0" : 'X\(//\)[^/]' \| \
+ X"$0" : 'X\(//\)$' \| \
+ X"$0" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$0" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -1376,11 +1425,13 @@ else
fi
if test ! -r "$srcdir/$ac_unique_file"; then
test "$ac_srcdir_defaulted" = yes && srcdir="$ac_confdir or .."
- as_fn_error $? "cannot find sources ($ac_unique_file) in $srcdir"
+ { echo "$as_me: error: cannot find sources ($ac_unique_file) in $srcdir" >&2
+ { (exit 1); exit 1; }; }
fi
ac_msg="sources are in $srcdir, but \`cd $srcdir' does not work"
ac_abs_confdir=`(
- cd "$srcdir" && test -r "./$ac_unique_file" || as_fn_error $? "$ac_msg"
+ cd "$srcdir" && test -r "./$ac_unique_file" || { echo "$as_me: error: $ac_msg" >&2
+ { (exit 1); exit 1; }; }
pwd)`
# When building in place, set srcdir=.
if test "$ac_abs_confdir" = "$ac_pwd"; then
@@ -1406,7 +1457,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 6.0.0 to adapt to many kinds of systems.
+\`configure' configures GNU MP 4.3.2 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1420,7 +1471,7 @@ Configuration:
--help=short display options specific to this package
--help=recursive display the short help of all the included packages
-V, --version display version information and exit
- -q, --quiet, --silent do not print \`checking ...' messages
+ -q, --quiet, --silent do not print \`checking...' messages
--cache-file=FILE cache test results in FILE [disabled]
-C, --config-cache alias for \`--cache-file=config.cache'
-n, --no-create do not create output files
@@ -1428,9 +1479,9 @@ Configuration:
Installation directories:
--prefix=PREFIX install architecture-independent files in PREFIX
- [$ac_default_prefix]
+ [$ac_default_prefix]
--exec-prefix=EPREFIX install architecture-dependent files in EPREFIX
- [PREFIX]
+ [PREFIX]
By default, \`make install' will install all the files in
\`$ac_default_prefix/bin', \`$ac_default_prefix/lib' etc. You can specify
@@ -1440,25 +1491,25 @@ for instance \`--prefix=\$HOME'.
For better control, use the options below.
Fine tuning of the installation directories:
- --bindir=DIR user executables [EPREFIX/bin]
- --sbindir=DIR system admin executables [EPREFIX/sbin]
- --libexecdir=DIR program executables [EPREFIX/libexec]
- --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
- --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
- --localstatedir=DIR modifiable single-machine data [PREFIX/var]
- --libdir=DIR object code libraries [EPREFIX/lib]
- --includedir=DIR C header files [PREFIX/include]
- --oldincludedir=DIR C header files for non-gcc [/usr/include]
- --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
- --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
- --infodir=DIR info documentation [DATAROOTDIR/info]
- --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
- --mandir=DIR man documentation [DATAROOTDIR/man]
- --docdir=DIR documentation root [DATAROOTDIR/doc/gmp]
- --htmldir=DIR html documentation [DOCDIR]
- --dvidir=DIR dvi documentation [DOCDIR]
- --pdfdir=DIR pdf documentation [DOCDIR]
- --psdir=DIR ps documentation [DOCDIR]
+ --bindir=DIR user executables [EPREFIX/bin]
+ --sbindir=DIR system admin executables [EPREFIX/sbin]
+ --libexecdir=DIR program executables [EPREFIX/libexec]
+ --sysconfdir=DIR read-only single-machine data [PREFIX/etc]
+ --sharedstatedir=DIR modifiable architecture-independent data [PREFIX/com]
+ --localstatedir=DIR modifiable single-machine data [PREFIX/var]
+ --libdir=DIR object code libraries [EPREFIX/lib]
+ --includedir=DIR C header files [PREFIX/include]
+ --oldincludedir=DIR C header files for non-gcc [/usr/include]
+ --datarootdir=DIR read-only arch.-independent data root [PREFIX/share]
+ --datadir=DIR read-only architecture-independent data [DATAROOTDIR]
+ --infodir=DIR info documentation [DATAROOTDIR/info]
+ --localedir=DIR locale-dependent data [DATAROOTDIR/locale]
+ --mandir=DIR man documentation [DATAROOTDIR/man]
+ --docdir=DIR documentation root [DATAROOTDIR/doc/gmp]
+ --htmldir=DIR html documentation [DOCDIR]
+ --dvidir=DIR dvi documentation [DOCDIR]
+ --pdfdir=DIR pdf documentation [DOCDIR]
+ --psdir=DIR ps documentation [DOCDIR]
_ACEOF
cat <<\_ACEOF
@@ -1476,29 +1527,26 @@ fi
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of GNU MP 6.0.0:";;
+ short | recursive ) echo "Configuration of GNU MP 4.3.2:";;
esac
cat <<\_ACEOF
Optional Features:
- --disable-option-checking ignore unrecognized --enable/--with options
--disable-FEATURE do not include FEATURE (same as --enable-FEATURE=no)
--enable-FEATURE[=ARG] include FEATURE [ARG=yes]
--enable-maintainer-mode enable make rules and dependencies not useful
(and sometimes confusing) to the casual installer
- --enable-assert enable ASSERT checking [[default=no]]
- --enable-alloca how to get temp memory [[default=reentrant]]
- --enable-cxx enable C++ support [[default=no]]
- --enable-assembly enable the use of assembly loops [[default=yes]]
- --enable-fft enable FFTs for multiplication [[default=yes]]
- --enable-old-fft-full enable old mpn_mul_fft_full for multiplication
- [[default=no]]
- --enable-nails use nails on limbs [[default=no]]
- --enable-profiling build with profiler support [[default=no]]
+ --enable-assert enable ASSERT checking [default=no]
+ --enable-alloca how to get temp memory [default=reentrant]
+ --enable-cxx enable C++ support [default=no]
+ --enable-fft enable FFTs for multiplication [default=yes]
+ --enable-mpbsd build Berkeley MP compatibility library
+ [default=no]
+ --enable-nails use nails on limbs [default=no]
+ --enable-profiling build with profiler support [default=no]
--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]]
+ [default=no]
+ --enable-minithres choose minimal thresholds for testing [default=no]
--enable-shared[=PKGS] build shared libraries [default=yes]
--enable-static[=PKGS] build static libraries [default=yes]
--enable-fast-install[=PKGS]
@@ -1509,12 +1557,11 @@ Optional Packages:
--with-PACKAGE[=ARG] use PACKAGE [ARG=yes]
--without-PACKAGE do not use PACKAGE (same as --with-PACKAGE=no)
--with-readline readline support in calc demo program
- [[default=detect]]
- --with-pic[=PKGS] try to use only PIC/non-PIC objects [default=use
- both]
+ [default=detect]
--with-gnu-ld assume the C compiler uses GNU ld [default=no]
- --with-sysroot=DIR Search for dependent libraries within DIR
- (or the compiler's sysroot if not specified).
+ --with-pic try to use only PIC/non-PIC objects [default=use
+ both]
+ --with-tags[=TAGS] include additional configurations [automatic]
Some influential environment variables:
ABI desired ABI (for processors supporting more than one ABI)
@@ -1523,7 +1570,7 @@ Some influential environment variables:
LDFLAGS linker flags, e.g. -L<lib dir> if you have libraries in a
nonstandard directory <lib dir>
LIBS libraries to pass to the linker, e.g. -l<library>
- CPPFLAGS (Objective) C/C++ preprocessor flags, e.g. -I<include dir> if
+ CPPFLAGS C/C++/Objective C preprocessor flags, e.g. -I<include dir> if
you have headers in a nonstandard directory <include dir>
CPP C preprocessor
CC_FOR_BUILD
@@ -1534,9 +1581,8 @@ Some influential environment variables:
CXXFLAGS C++ compiler flags
CXXCPP C++ preprocessor
M4 m4 macro processor
- YACC The `Yet Another Compiler Compiler' implementation to use.
- Defaults to the first program found out of: `bison -y', `byacc',
- `yacc'.
+ YACC The `Yet Another C Compiler' implementation to use. Defaults to
+ the first program found out of: `bison -y', `byacc', `yacc'.
YFLAGS The list of arguments that will be passed by default to $YACC.
This script will default YFLAGS to the empty string to avoid a
default value of `-d' given by some make applications.
@@ -1544,9 +1590,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 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/>.
+Report bugs to <gmp-bugs@gmplib.org>.
_ACEOF
ac_status=$?
fi
@@ -1554,17 +1598,15 @@ fi
if test "$ac_init_help" = "recursive"; then
# If there are subdirs, report their specific --help.
for ac_dir in : $ac_subdirs_all; do test "x$ac_dir" = x: && continue
- test -d "$ac_dir" ||
- { cd "$srcdir" && ac_pwd=`pwd` && srcdir=. && test -d "$ac_dir"; } ||
- continue
+ test -d "$ac_dir" || continue
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -1600,7 +1642,7 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
echo &&
$SHELL "$ac_srcdir/configure" --help=recursive
else
- $as_echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
+ echo "$as_me: WARNING: no configuration information is in $ac_dir" >&2
fi || ac_status=$?
cd "$ac_pwd" || { ac_status=$?; break; }
done
@@ -1609,1014 +1651,43 @@ fi
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-GNU MP configure 6.0.0
-generated by GNU Autoconf 2.69
+GNU MP configure 4.3.2
+generated by GNU Autoconf 2.61
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000, 2001,
+2002, 2003, 2004, 2005, 2006 Free Software Foundation, Inc.
This configure script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it.
-Copyright 1996-2014 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
_ACEOF
exit
fi
-
-## ------------------------ ##
-## Autoconf initialization. ##
-## ------------------------ ##
-
-# ac_fn_c_try_compile LINENO
-# --------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- rm -f conftest.$ac_objext
- if { { ac_try="$ac_compile"
-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_compile") 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_c_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_compile
-
-# ac_fn_c_try_cpp LINENO
-# ----------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_try_cpp ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { { ac_try="$ac_cpp conftest.$ac_ext"
-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_cpp conftest.$ac_ext") 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; } > conftest.i && {
- test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
- test ! -s conftest.err
- }; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_try_cpp
-
-# ac_fn_cxx_try_compile LINENO
-# ----------------------------
-# Try to compile conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_try_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- rm -f conftest.$ac_objext
- if { { ac_try="$ac_compile"
-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_compile") 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_cxx_werror_flag" ||
- test ! -s conftest.err
- } && test -s conftest.$ac_objext; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_cxx_try_compile
-
-# ac_fn_cxx_try_cpp LINENO
-# ------------------------
-# Try to preprocess conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_try_cpp ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if { { ac_try="$ac_cpp conftest.$ac_ext"
-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_cpp conftest.$ac_ext") 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; } > conftest.i && {
- test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
- test ! -s conftest.err
- }; then :
- ac_retval=0
-else
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=1
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_cxx_try_cpp
-
-# ac_fn_c_try_link LINENO
-# -----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_c_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_c_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_c_try_link
-
-# ac_fn_c_check_header_compile LINENO HEADER VAR INCLUDES
-# -------------------------------------------------------
-# Tests whether HEADER exists and can be compiled using the include files in
-# INCLUDES, setting the cache variable VAR accordingly.
-ac_fn_c_check_header_compile ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_compile
-
-# ac_fn_c_try_run LINENO
-# ----------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded. Assumes
-# that executables *can* be run.
-ac_fn_c_try_run ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- 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>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && { ac_try='./conftest$ac_exeext'
- { { 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_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :
- ac_retval=0
-else
- $as_echo "$as_me: program exited with status $ac_status" >&5
- $as_echo "$as_me: failed program was:" >&5
-sed 's/^/| /' conftest.$ac_ext >&5
-
- ac_retval=$ac_status
-fi
- 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_c_try_run
-
-# ac_fn_c_check_func LINENO FUNC VAR
-# ----------------------------------
-# Tests whether FUNC exists, setting the cache variable VAR accordingly
-ac_fn_c_check_func ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-/* Define $2 to an innocuous variant, in case <limits.h> declares $2.
- For example, HP-UX 11i <limits.h> declares gettimeofday. */
-#define $2 innocuous_$2
-
-/* System header to define __stub macros and hopefully few prototypes,
- which can conflict with char $2 (); below.
- Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- <limits.h> exists even on freestanding compilers. */
-
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
-
-#undef $2
-
-/* Override any GCC internal prototype to avoid an error.
- Use char because int might match the return type of a GCC
- builtin and then its argument prototype would still apply. */
-#ifdef __cplusplus
-extern "C"
-#endif
-char $2 ();
-/* The GNU C library defines this for functions which it implements
- to always fail with ENOSYS. Some functions are actually named
- something starting with __ and the normal name is an alias. */
-#if defined __stub_$2 || defined __stub___$2
-choke me
-#endif
-
-int
-main ()
-{
-return $2 ();
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_func
-
-# ac_fn_cxx_try_link LINENO
-# -------------------------
-# Try to link conftest.$ac_ext, and return whether this succeeded.
-ac_fn_cxx_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_cxx_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_cxx_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
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_c_check_header_mongrel ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if eval \${$3+:} false; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_header_compiler=yes
-else
- ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <$2>
-_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
- ac_header_preproc=yes
-else
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in #((
- yes:no: )
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
- ;;
- no:yes:* )
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ssssssssssssssssssssssssssssssssss ##
-## Report this to gmp-bugs@gmplib.org ##
-## ssssssssssssssssssssssssssssssssss ##"
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_header_mongrel
-
-# ac_fn_c_check_decl LINENO SYMBOL VAR INCLUDES
-# ---------------------------------------------
-# Tests whether SYMBOL is declared in INCLUDES, setting cache variable VAR
-# accordingly.
-ac_fn_c_check_decl ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- as_decl_name=`echo $2|sed 's/ *(.*//'`
- as_decl_use=`echo $2|sed -e 's/(/((/' -e 's/)/) 0&/' -e 's/,/) 0& (/g'`
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $as_decl_name is declared" >&5
-$as_echo_n "checking whether $as_decl_name is declared... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-#ifndef $as_decl_name
-#ifdef __cplusplus
- (void) $as_decl_use;
-#else
- (void) $as_decl_name;
-#endif
-#endif
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$3=yes"
-else
- eval "$3=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_decl
-
-# ac_fn_c_check_type LINENO TYPE VAR INCLUDES
-# -------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_c_check_type ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=no"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof ($2))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
-else
- eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_type
-
-# ac_fn_c_check_member LINENO AGGR MEMBER VAR INCLUDES
-# ----------------------------------------------------
-# Tries to find if the field MEMBER exists in type AGGR, after including
-# INCLUDES, setting cache variable VAR accordingly.
-ac_fn_c_check_member ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2.$3" >&5
-$as_echo_n "checking for $2.$3... " >&6; }
-if eval \${$4+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (ac_aggr.$3)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$4=yes"
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$5
-int
-main ()
-{
-static $2 ac_aggr;
-if (sizeof ac_aggr.$3)
-return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- eval "$4=yes"
-else
- eval "$4=no"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$4
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_c_check_member
-
-# ac_fn_cxx_check_header_mongrel LINENO HEADER VAR INCLUDES
-# ---------------------------------------------------------
-# Tests whether HEADER exists, giving a warning if it cannot be compiled using
-# the include files in INCLUDES and setting the cache variable VAR
-# accordingly.
-ac_fn_cxx_check_header_mongrel ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if eval \${$3+:} false; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-else
- # Is the header compilable?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 usability" >&5
-$as_echo_n "checking $2 usability... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-#include <$2>
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
- ac_header_compiler=yes
-else
- ac_header_compiler=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_compiler" >&5
-$as_echo "$ac_header_compiler" >&6; }
-
-# Is the header present?
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking $2 presence" >&5
-$as_echo_n "checking $2 presence... " >&6; }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <$2>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
- ac_header_preproc=yes
-else
- ac_header_preproc=no
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_header_preproc" >&5
-$as_echo "$ac_header_preproc" >&6; }
-
-# So? What about this header?
-case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in #((
- yes:no: )
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&5
-$as_echo "$as_me: WARNING: $2: accepted by the compiler, rejected by the preprocessor!" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
- ;;
- no:yes:* )
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: present but cannot be compiled" >&5
-$as_echo "$as_me: WARNING: $2: present but cannot be compiled" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: check for missing prerequisite headers?" >&5
-$as_echo "$as_me: WARNING: $2: check for missing prerequisite headers?" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: see the Autoconf documentation" >&5
-$as_echo "$as_me: WARNING: $2: see the Autoconf documentation" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&5
-$as_echo "$as_me: WARNING: $2: section \"Present But Cannot Be Compiled\"" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $2: proceeding with the compiler's result" >&5
-$as_echo "$as_me: WARNING: $2: proceeding with the compiler's result" >&2;}
-( $as_echo "## ssssssssssssssssssssssssssssssssss ##
-## Report this to gmp-bugs@gmplib.org ##
-## ssssssssssssssssssssssssssssssssss ##"
- ) | sed "s/^/$as_me: WARNING: /" >&2
- ;;
-esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=\$ac_header_compiler"
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
-fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_cxx_check_header_mongrel
-
-# ac_fn_cxx_check_type LINENO TYPE VAR INCLUDES
-# ---------------------------------------------
-# Tests whether TYPE exists after having included INCLUDES, setting cache
-# variable VAR accordingly.
-ac_fn_cxx_check_type ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $2" >&5
-$as_echo_n "checking for $2... " >&6; }
-if eval \${$3+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- eval "$3=no"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof ($2))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-if (sizeof (($2)))
- return 0;
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
-else
- eval "$3=yes"
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-eval ac_res=\$$3
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_res" >&5
-$as_echo "$ac_res" >&6; }
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
-
-} # ac_fn_cxx_check_type
-
-# ac_fn_c_compute_int LINENO EXPR VAR INCLUDES
-# --------------------------------------------
-# Tries to find the compile-time value of EXPR in a program that includes
-# INCLUDES, setting VAR accordingly. Returns whether the value could be
-# computed
-ac_fn_c_compute_int ()
-{
- as_lineno=${as_lineno-"$1"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- if test "$cross_compiling" = yes; then
- # Depending upon the size, compute the lo and hi bounds.
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=0 ac_mid=0
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid; break
-else
- as_fn_arith $ac_mid + 1 && ac_lo=$as_val
- if test $ac_lo -le $ac_mid; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid + 1 && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) < 0)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=-1 ac_mid=-1
- while :; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) >= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_lo=$ac_mid; break
-else
- as_fn_arith '(' $ac_mid ')' - 1 && ac_hi=$as_val
- if test $ac_mid -le $ac_hi; then
- ac_lo= ac_hi=
- break
- fi
- as_fn_arith 2 '*' $ac_mid && ac_mid=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- done
-else
- ac_lo= ac_hi=
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-# Binary search between lo and hi bounds.
-while test "x$ac_lo" != "x$ac_hi"; do
- as_fn_arith '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo && ac_mid=$as_val
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-int
-main ()
-{
-static int test_array [1 - 2 * !(($2) <= $ac_mid)];
-test_array [0] = 0;
-return test_array [0];
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_hi=$ac_mid
-else
- as_fn_arith '(' $ac_mid ')' + 1 && ac_lo=$as_val
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-done
-case $ac_lo in #((
-?*) eval "$3=\$ac_lo"; ac_retval=0 ;;
-'') ac_retval=1 ;;
-esac
- else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-$4
-static long int longval () { return $2; }
-static unsigned long int ulongval () { return $2; }
-#include <stdio.h>
-#include <stdlib.h>
-int
-main ()
-{
-
- FILE *f = fopen ("conftest.val", "w");
- if (! f)
- return 1;
- if (($2) < 0)
- {
- long int i = longval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%ld", i);
- }
- else
- {
- unsigned long int i = ulongval ();
- if (i != ($2))
- return 1;
- fprintf (f, "%lu", i);
- }
- /* Do not output a trailing newline, as this causes \r\n confusion
- on some platforms. */
- return ferror (f) || fclose (f) != 0;
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
- echo >>conftest.val; read $3 <conftest.val; ac_retval=0
-else
- ac_retval=1
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-rm -f conftest.val
-
- fi
- eval $as_lineno_stack; ${as_lineno_stack:+:} unset as_lineno
- as_fn_set_status $ac_retval
-
-} # ac_fn_c_compute_int
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 6.0.0, which was
-generated by GNU Autoconf 2.69. Invocation command line was
+It was created by GNU MP $as_me 4.3.2, which was
+generated by GNU Autoconf 2.61. Invocation command line was
$ $0 $@
@@ -2652,8 +1723,8 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- $as_echo "PATH: $as_dir"
- done
+ echo "PATH: $as_dir"
+done
IFS=$as_save_IFS
} >&5
@@ -2687,12 +1758,12 @@ do
| -silent | --silent | --silen | --sile | --sil)
continue ;;
*\'*)
- ac_arg=`$as_echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
+ ac_arg=`echo "$ac_arg" | sed "s/'/'\\\\\\\\''/g"` ;;
esac
case $ac_pass in
- 1) as_fn_append ac_configure_args0 " '$ac_arg'" ;;
+ 1) ac_configure_args0="$ac_configure_args0 '$ac_arg'" ;;
2)
- as_fn_append ac_configure_args1 " '$ac_arg'"
+ ac_configure_args1="$ac_configure_args1 '$ac_arg'"
if test $ac_must_keep_next = true; then
ac_must_keep_next=false # Got value, back to normal.
else
@@ -2708,13 +1779,13 @@ do
-* ) ac_must_keep_next=true ;;
esac
fi
- as_fn_append ac_configure_args " '$ac_arg'"
+ ac_configure_args="$ac_configure_args '$ac_arg'"
;;
esac
done
done
-{ ac_configure_args0=; unset ac_configure_args0;}
-{ ac_configure_args1=; unset ac_configure_args1;}
+$as_unset ac_configure_args0 || test "${ac_configure_args0+set}" != set || { ac_configure_args0=; export ac_configure_args0; }
+$as_unset ac_configure_args1 || test "${ac_configure_args1+set}" != set || { ac_configure_args1=; export ac_configure_args1; }
# When interrupted or exit'd, cleanup temporary files, and complete
# config.log. We remove comments because anyway the quotes in there
@@ -2726,9 +1797,11 @@ trap 'exit_status=$?
{
echo
- $as_echo "## ---------------- ##
+ cat <<\_ASBOX
+## ---------------- ##
## Cache variables. ##
-## ---------------- ##"
+## ---------------- ##
+_ASBOX
echo
# The following way of writing the cache mishandles newlines in values,
(
@@ -2737,13 +1810,12 @@ trap 'exit_status=$?
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) { eval $ac_var=; unset $ac_var;} ;;
+ *) $as_unset $ac_var ;;
esac ;;
esac
done
@@ -2762,136 +1834,128 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
)
echo
- $as_echo "## ----------------- ##
+ cat <<\_ASBOX
+## ----------------- ##
## Output variables. ##
-## ----------------- ##"
+## ----------------- ##
+_ASBOX
echo
for ac_var in $ac_subst_vars
do
eval ac_val=\$$ac_var
case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
- $as_echo "$ac_var='\''$ac_val'\''"
+ echo "$ac_var='\''$ac_val'\''"
done | sort
echo
if test -n "$ac_subst_files"; then
- $as_echo "## ------------------- ##
+ cat <<\_ASBOX
+## ------------------- ##
## File substitutions. ##
-## ------------------- ##"
+## ------------------- ##
+_ASBOX
echo
for ac_var in $ac_subst_files
do
eval ac_val=\$$ac_var
case $ac_val in
- *\'\''*) ac_val=`$as_echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
+ *\'\''*) ac_val=`echo "$ac_val" | sed "s/'\''/'\''\\\\\\\\'\'''\''/g"`;;
esac
- $as_echo "$ac_var='\''$ac_val'\''"
+ echo "$ac_var='\''$ac_val'\''"
done | sort
echo
fi
if test -s confdefs.h; then
- $as_echo "## ----------- ##
+ cat <<\_ASBOX
+## ----------- ##
## confdefs.h. ##
-## ----------- ##"
+## ----------- ##
+_ASBOX
echo
cat confdefs.h
echo
fi
test "$ac_signal" != 0 &&
- $as_echo "$as_me: caught signal $ac_signal"
- $as_echo "$as_me: exit $exit_status"
+ echo "$as_me: caught signal $ac_signal"
+ echo "$as_me: exit $exit_status"
} >&5
rm -f core *.core core.conftest.* &&
rm -f -r conftest* confdefs* conf$$* $ac_clean_files &&
exit $exit_status
' 0
for ac_signal in 1 2 13 15; do
- trap 'ac_signal='$ac_signal'; as_fn_exit 1' $ac_signal
+ trap 'ac_signal='$ac_signal'; { (exit 1); exit 1; }' $ac_signal
done
ac_signal=0
# confdefs.h avoids OS command line length limits that DEFS can exceed.
rm -f -r conftest* confdefs.h
-$as_echo "/* confdefs.h */" > confdefs.h
-
# Predefined preprocessor variables.
cat >>confdefs.h <<_ACEOF
#define PACKAGE_NAME "$PACKAGE_NAME"
_ACEOF
+
cat >>confdefs.h <<_ACEOF
#define PACKAGE_TARNAME "$PACKAGE_TARNAME"
_ACEOF
+
cat >>confdefs.h <<_ACEOF
#define PACKAGE_VERSION "$PACKAGE_VERSION"
_ACEOF
+
cat >>confdefs.h <<_ACEOF
#define PACKAGE_STRING "$PACKAGE_STRING"
_ACEOF
-cat >>confdefs.h <<_ACEOF
-#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
-_ACEOF
cat >>confdefs.h <<_ACEOF
-#define PACKAGE_URL "$PACKAGE_URL"
+#define PACKAGE_BUGREPORT "$PACKAGE_BUGREPORT"
_ACEOF
# Let the site file select an alternate cache file if it wants to.
-# Prefer an explicitly selected file to automatically selected ones.
-ac_site_file1=NONE
-ac_site_file2=NONE
+# Prefer explicitly selected file to automatically selected ones.
if test -n "$CONFIG_SITE"; then
- # We do not want a PATH search for config.site.
- case $CONFIG_SITE in #((
- -*) ac_site_file1=./$CONFIG_SITE;;
- */*) ac_site_file1=$CONFIG_SITE;;
- *) ac_site_file1=./$CONFIG_SITE;;
- esac
+ set x "$CONFIG_SITE"
elif test "x$prefix" != xNONE; then
- ac_site_file1=$prefix/share/config.site
- ac_site_file2=$prefix/etc/config.site
+ set x "$prefix/share/config.site" "$prefix/etc/config.site"
else
- ac_site_file1=$ac_default_prefix/share/config.site
- ac_site_file2=$ac_default_prefix/etc/config.site
+ set x "$ac_default_prefix/share/config.site" \
+ "$ac_default_prefix/etc/config.site"
fi
-for ac_site_file in "$ac_site_file1" "$ac_site_file2"
+shift
+for ac_site_file
do
- test "x$ac_site_file" = xNONE && continue
- if test /dev/null != "$ac_site_file" && test -r "$ac_site_file"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: loading site script $ac_site_file" >&5
-$as_echo "$as_me: loading site script $ac_site_file" >&6;}
+ if test -r "$ac_site_file"; then
+ { echo "$as_me:$LINENO: loading site script $ac_site_file" >&5
+echo "$as_me: loading site script $ac_site_file" >&6;}
sed 's/^/| /' "$ac_site_file" >&5
- . "$ac_site_file" \
- || { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "failed to load site script $ac_site_file
-See \`config.log' for more details" "$LINENO" 5; }
+ . "$ac_site_file"
fi
done
if test -r "$cache_file"; then
- # Some versions of bash will fail to source /dev/null (special files
- # actually), so we avoid doing that. DJGPP emulates it as a regular file.
- if test /dev/null != "$cache_file" && test -f "$cache_file"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: loading cache $cache_file" >&5
-$as_echo "$as_me: loading cache $cache_file" >&6;}
+ # Some versions of bash will fail to source /dev/null (special
+ # files actually), so we avoid doing that.
+ if test -f "$cache_file"; then
+ { echo "$as_me:$LINENO: loading cache $cache_file" >&5
+echo "$as_me: loading cache $cache_file" >&6;}
case $cache_file in
[\\/]* | ?:[\\/]* ) . "$cache_file";;
*) . "./$cache_file";;
esac
fi
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: creating cache $cache_file" >&5
-$as_echo "$as_me: creating cache $cache_file" >&6;}
+ { echo "$as_me:$LINENO: creating cache $cache_file" >&5
+echo "$as_me: creating cache $cache_file" >&6;}
>$cache_file
fi
@@ -2905,56 +1969,68 @@ for ac_var in $ac_precious_vars; do
eval ac_new_val=\$ac_env_${ac_var}_value
case $ac_old_set,$ac_new_set in
set,)
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
+ { echo "$as_me:$LINENO: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was set to \`$ac_old_val' in the previous run" >&2;}
ac_cache_corrupted=: ;;
,set)
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' was not set in the previous run" >&5
-$as_echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
+ { echo "$as_me:$LINENO: error: \`$ac_var' was not set in the previous run" >&5
+echo "$as_me: error: \`$ac_var' was not set in the previous run" >&2;}
ac_cache_corrupted=: ;;
,);;
*)
if test "x$ac_old_val" != "x$ac_new_val"; then
- # differences in whitespace do not lead to failure.
- ac_old_val_w=`echo x $ac_old_val`
- ac_new_val_w=`echo x $ac_new_val`
- if test "$ac_old_val_w" != "$ac_new_val_w"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: \`$ac_var' has changed since the previous run:" >&5
-$as_echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
- ac_cache_corrupted=:
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&5
-$as_echo "$as_me: warning: ignoring whitespace changes in \`$ac_var' since the previous run:" >&2;}
- eval $ac_var=\$ac_old_val
- fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: former value: \`$ac_old_val'" >&5
-$as_echo "$as_me: former value: \`$ac_old_val'" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: current value: \`$ac_new_val'" >&5
-$as_echo "$as_me: current value: \`$ac_new_val'" >&2;}
+ { echo "$as_me:$LINENO: error: \`$ac_var' has changed since the previous run:" >&5
+echo "$as_me: error: \`$ac_var' has changed since the previous run:" >&2;}
+ { echo "$as_me:$LINENO: former value: $ac_old_val" >&5
+echo "$as_me: former value: $ac_old_val" >&2;}
+ { echo "$as_me:$LINENO: current value: $ac_new_val" >&5
+echo "$as_me: current value: $ac_new_val" >&2;}
+ ac_cache_corrupted=:
fi;;
esac
# Pass precious variables to config.status.
if test "$ac_new_set" = set; then
case $ac_new_val in
- *\'*) ac_arg=$ac_var=`$as_echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
+ *\'*) ac_arg=$ac_var=`echo "$ac_new_val" | sed "s/'/'\\\\\\\\''/g"` ;;
*) ac_arg=$ac_var=$ac_new_val ;;
esac
case " $ac_configure_args " in
*" '$ac_arg' "*) ;; # Avoid dups. Use of quotes ensures accuracy.
- *) as_fn_append ac_configure_args " '$ac_arg'" ;;
+ *) ac_configure_args="$ac_configure_args '$ac_arg'" ;;
esac
fi
done
if $ac_cache_corrupted; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: error: changes in the environment can compromise the build" >&5
-$as_echo "$as_me: error: changes in the environment can compromise the build" >&2;}
- as_fn_error $? "run \`make distclean' and/or \`rm $cache_file' and start over" "$LINENO" 5
+ { echo "$as_me:$LINENO: error: changes in the environment can compromise the build" >&5
+echo "$as_me: error: changes in the environment can compromise the build" >&2;}
+ { { echo "$as_me:$LINENO: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&5
+echo "$as_me: error: run \`make distclean' and/or \`rm $cache_file' and start over" >&2;}
+ { (exit 1); exit 1; }; }
fi
-## -------------------- ##
-## Main body of script. ##
-## -------------------- ##
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -2971,18 +2047,21 @@ 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
# "athlon-pc-freebsd3.5".
#
if test -n "$target_alias" && test "$target_alias" != "$host_alias"; then
- as_fn_error $? "--target is not appropriate for GMP
+ { { echo "$as_me:$LINENO: error: --target is not appropriate for GMP
Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system
explicitly. Use --host if cross-compiling (see \"Installing GMP\" in the
-manual for more on this)." "$LINENO" 5
+manual for more on this)." >&5
+echo "$as_me: error: --target is not appropriate for GMP
+Use --build=CPU-VENDOR-OS if you need to specify your CPU and/or system
+explicitly. Use --host if cross-compiling (see \"Installing GMP\" in the
+manual for more on this)." >&2;}
+ { (exit 1); exit 1; }; }
fi
gmp_configm4="config.m4"
@@ -3021,7 +2100,9 @@ for ac_dir in "$srcdir" "$srcdir/.." "$srcdir/../.."; do
fi
done
if test -z "$ac_aux_dir"; then
- as_fn_error $? "cannot find install-sh, install.sh, or shtool in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&5
+echo "$as_me: error: cannot find install-sh or install.sh in \"$srcdir\" \"$srcdir/..\" \"$srcdir/../..\"" >&2;}
+ { (exit 1); exit 1; }; }
fi
# These three variables are undocumented and unsupported,
@@ -3035,27 +2116,35 @@ ac_configure="$SHELL $ac_aux_dir/configure" # Please don't use this var.
# Make sure we can run config.sub.
$SHELL "$ac_aux_dir/config.sub" sun4 >/dev/null 2>&1 ||
- as_fn_error $? "cannot run $SHELL $ac_aux_dir/config.sub" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot run $SHELL $ac_aux_dir/config.sub" >&5
+echo "$as_me: error: cannot run $SHELL $ac_aux_dir/config.sub" >&2;}
+ { (exit 1); exit 1; }; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking build system type" >&5
-$as_echo_n "checking build system type... " >&6; }
-if ${ac_cv_build+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking build system type" >&5
+echo $ECHO_N "checking build system type... $ECHO_C" >&6; }
+if test "${ac_cv_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_build_alias=$build_alias
test "x$ac_build_alias" = x &&
ac_build_alias=`$SHELL "$ac_aux_dir/config.guess"`
test "x$ac_build_alias" = x &&
- as_fn_error $? "cannot guess build type; you must specify one" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot guess build type; you must specify one" >&5
+echo "$as_me: error: cannot guess build type; you must specify one" >&2;}
+ { (exit 1); exit 1; }; }
ac_cv_build=`$SHELL "$ac_aux_dir/config.sub" $ac_build_alias` ||
- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $ac_build_alias failed" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $ac_build_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_build" >&5
-$as_echo "$ac_cv_build" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_build" >&5
+echo "${ECHO_T}$ac_cv_build" >&6; }
case $ac_cv_build in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical build" "$LINENO" 5;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical build" >&5
+echo "$as_me: error: invalid value of canonical build" >&2;}
+ { (exit 1); exit 1; }; };;
esac
build=$ac_cv_build
ac_save_IFS=$IFS; IFS='-'
@@ -3071,24 +2160,28 @@ IFS=$ac_save_IFS
case $build_os in *\ *) build_os=`echo "$build_os" | sed 's/ /-/g'`;; esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking host system type" >&5
-$as_echo_n "checking host system type... " >&6; }
-if ${ac_cv_host+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking host system type" >&5
+echo $ECHO_N "checking host system type... $ECHO_C" >&6; }
+if test "${ac_cv_host+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "x$host_alias" = x; then
ac_cv_host=$ac_cv_build
else
ac_cv_host=`$SHELL "$ac_aux_dir/config.sub" $host_alias` ||
- as_fn_error $? "$SHELL $ac_aux_dir/config.sub $host_alias failed" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&5
+echo "$as_me: error: $SHELL $ac_aux_dir/config.sub $host_alias failed" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_host" >&5
-$as_echo "$ac_cv_host" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_host" >&5
+echo "${ECHO_T}$ac_cv_host" >&6; }
case $ac_cv_host in
*-*-*) ;;
-*) as_fn_error $? "invalid value of canonical host" "$LINENO" 5;;
+*) { { echo "$as_me:$LINENO: error: invalid value of canonical host" >&5
+echo "$as_me: error: invalid value of canonical host" >&2;}
+ { (exit 1); exit 1; }; };;
esac
host=$ac_cv_host
ac_save_IFS=$IFS; IFS='-'
@@ -3105,8 +2198,7 @@ case $host_os in *\ *) host_os=`echo "$host_os" | sed 's/ /-/g'`;; esac
-am__api_version='1.11'
-
+am__api_version="1.8"
# Find a good install program. We prefer a C program (faster),
# so one script is as good as another. But avoid the broken or
# incompatible versions:
@@ -3120,23 +2212,22 @@ am__api_version='1.11'
# SVR4 /usr/ucb/install, which tries to use the nonexistent group "staff"
# OS/2's system install, which has a completely different semantic
# ./install, which can be erroneously created by make from ./install.sh.
-# Reject install programs that cannot install multiple files.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a BSD-compatible install" >&5
-$as_echo_n "checking for a BSD-compatible install... " >&6; }
+{ echo "$as_me:$LINENO: checking for a BSD-compatible install" >&5
+echo $ECHO_N "checking for a BSD-compatible install... $ECHO_C" >&6; }
if test -z "$INSTALL"; then
-if ${ac_cv_path_install+:} false; then :
- $as_echo_n "(cached) " >&6
+if test "${ac_cv_path_install+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- # Account for people who put trailing slashes in PATH elements.
-case $as_dir/ in #((
- ./ | .// | /[cC]/* | \
+ # Account for people who put trailing slashes in PATH elements.
+case $as_dir/ in
+ ./ | .// | /cC/* | \
/etc/* | /usr/sbin/* | /usr/etc/* | /sbin/* | /usr/afsws/bin/* | \
- ?:[\\/]os2[\\/]install[\\/]* | ?:[\\/]OS2[\\/]INSTALL[\\/]* | \
+ ?:\\/os2\\/install\\/* | ?:\\/OS2\\/INSTALL\\/* | \
/usr/ucb/* ) ;;
*)
# OSF1 and SCO ODT 3.0 have their own names for install.
@@ -3144,7 +2235,7 @@ case $as_dir/ in #((
# by default.
for ac_prog in ginstall scoinst install; do
for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext"; then
+ if { test -f "$as_dir/$ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$ac_prog$ac_exec_ext"; }; then
if test $ac_prog = install &&
grep dspmsg "$as_dir/$ac_prog$ac_exec_ext" >/dev/null 2>&1; then
# AIX install. It has an incompatible calling convention.
@@ -3154,29 +2245,17 @@ case $as_dir/ in #((
# program-specific install script used by HP pwplus--don't use.
:
else
- rm -rf conftest.one conftest.two conftest.dir
- echo one > conftest.one
- echo two > conftest.two
- mkdir conftest.dir
- if "$as_dir/$ac_prog$ac_exec_ext" -c conftest.one conftest.two "`pwd`/conftest.dir" &&
- test -s conftest.one && test -s conftest.two &&
- test -s conftest.dir/conftest.one &&
- test -s conftest.dir/conftest.two
- then
- ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
- break 3
- fi
+ ac_cv_path_install="$as_dir/$ac_prog$ac_exec_ext -c"
+ break 3
fi
fi
done
done
;;
esac
-
- done
+done
IFS=$as_save_IFS
-rm -rf conftest.one conftest.two conftest.dir
fi
if test "${ac_cv_path_install+set}" = set; then
@@ -3189,8 +2268,8 @@ fi
INSTALL=$ac_install_sh
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $INSTALL" >&5
-$as_echo "$INSTALL" >&6; }
+{ echo "$as_me:$LINENO: result: $INSTALL" >&5
+echo "${ECHO_T}$INSTALL" >&6; }
# Use test -z because SunOS4 sh mishandles braces in ${var-val}.
# It thinks the first close brace ends the variable substitution.
@@ -3200,34 +2279,21 @@ test -z "$INSTALL_SCRIPT" && INSTALL_SCRIPT='${INSTALL}'
test -z "$INSTALL_DATA" && INSTALL_DATA='${INSTALL} -m 644'
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build environment is sane" >&5
-$as_echo_n "checking whether build environment is sane... " >&6; }
+{ echo "$as_me:$LINENO: checking whether build environment is sane" >&5
+echo $ECHO_N "checking whether build environment is sane... $ECHO_C" >&6; }
# Just in case
sleep 1
echo timestamp > conftest.file
-# Reject unsafe characters in $srcdir or the absolute working directory
-# name. Accept space and tab only in the latter.
-am_lf='
-'
-case `pwd` in
- *[\\\"\#\$\&\'\`$am_lf]*)
- as_fn_error $? "unsafe absolute working directory name" "$LINENO" 5;;
-esac
-case $srcdir in
- *[\\\"\#\$\&\'\`$am_lf\ \ ]*)
- as_fn_error $? "unsafe srcdir value: \`$srcdir'" "$LINENO" 5;;
-esac
-
# Do `set' in a subshell so we don't clobber the current shell's
# arguments. Must try -L first in case configure is actually a
# symlink; some systems play weird games with the mod time of symlinks
# (eg FreeBSD returns the mod time of the symlink's containing
# directory).
if (
- set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null`
+ set X `ls -Lt $srcdir/configure conftest.file 2> /dev/null`
if test "$*" = "X"; then
# -L didn't work.
- set X `ls -t "$srcdir/configure" conftest.file`
+ set X `ls -t $srcdir/configure conftest.file`
fi
rm -f conftest.file
if test "$*" != "X $srcdir/configure conftest.file" \
@@ -3237,8 +2303,11 @@ if (
# if, for instance, CONFIG_SHELL is bash and it inherits a
# broken ls alias from the environment. This has actually
# happened. Such a system could not be considered "sane".
- as_fn_error $? "ls -t appears to fail. Make sure there is not a broken
-alias in your environment" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&5
+echo "$as_me: error: ls -t appears to fail. Make sure there is not a broken
+alias in your environment" >&2;}
+ { (exit 1); exit 1; }; }
fi
test "$2" = conftest.file
@@ -3247,206 +2316,73 @@ then
# Ok.
:
else
- as_fn_error $? "newly created file is older than distributed files!
-Check your system clock" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: newly created file is older than distributed files!
+Check your system clock" >&5
+echo "$as_me: error: newly created file is older than distributed files!
+Check your system clock" >&2;}
+ { (exit 1); exit 1; }; }
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
test "$program_prefix" != NONE &&
program_transform_name="s&^&$program_prefix&;$program_transform_name"
# Use a double $ so make ignores it.
test "$program_suffix" != NONE &&
program_transform_name="s&\$&$program_suffix&;$program_transform_name"
-# Double any \ or $.
+# Double any \ or $. echo might interpret backslashes.
# By default was `s,x,x', remove it if useless.
-ac_script='s/[\\$]/&&/g;s/;s,x,x,$//'
-program_transform_name=`$as_echo "$program_transform_name" | sed "$ac_script"`
+cat <<\_ACEOF >conftest.sed
+s/[\\$]/&&/g;s/;s,x,x,$//
+_ACEOF
+program_transform_name=`echo $program_transform_name | sed -f conftest.sed`
+rm -f conftest.sed
# expand $ac_aux_dir to an absolute path
am_aux_dir=`cd $ac_aux_dir && pwd`
-if test x"${MISSING+set}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;;
- *)
- MISSING="\${SHELL} $am_aux_dir/missing" ;;
- esac
-fi
+test x"${MISSING+set}" = xset || MISSING="\${SHELL} $am_aux_dir/missing"
# Use eval to expand $SHELL
if eval "$MISSING --run true"; then
am_missing_run="$MISSING --run "
else
am_missing_run=
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \`missing' script is too old or missing" >&5
-$as_echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
-fi
-
-if test x"${install_sh}" != xset; then
- case $am_aux_dir in
- *\ * | *\ *)
- install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;;
- *)
- install_sh="\${SHELL} $am_aux_dir/install-sh"
- esac
-fi
-
-# Installed binaries are usually stripped using `strip' when the user
-# run `make install-strip'. However `strip' might not be the right
-# tool to use in cross-compilation environments, therefore Automake
-# will honor the `STRIP' environment variable to overrule this program.
-if test "$cross_compiling" != no; then
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_STRIP="${ac_tool_prefix}strip"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_STRIP"; then
- ac_ct_STRIP=$STRIP
- # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_STRIP"; then
- ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_STRIP="strip"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- STRIP=$ac_ct_STRIP
- fi
-else
- STRIP="$ac_cv_prog_STRIP"
-fi
-
-fi
-INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s"
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a thread-safe mkdir -p" >&5
-$as_echo_n "checking for a thread-safe mkdir -p... " >&6; }
-if test -z "$MKDIR_P"; then
- if ${ac_cv_path_mkdir+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/opt/sfw/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in mkdir gmkdir; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- as_fn_executable_p "$as_dir/$ac_prog$ac_exec_ext" || continue
- case `"$as_dir/$ac_prog$ac_exec_ext" --version 2>&1` in #(
- 'mkdir (GNU coreutils) '* | \
- 'mkdir (coreutils) '* | \
- 'mkdir (fileutils) '4.1*)
- ac_cv_path_mkdir=$as_dir/$ac_prog$ac_exec_ext
- break 3;;
- esac
- done
- done
+ { echo "$as_me:$LINENO: WARNING: \`missing' script is too old or missing" >&5
+echo "$as_me: WARNING: \`missing' script is too old or missing" >&2;}
+fi
+
+if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
+ # Keeping the `.' argument allows $(mkdir_p) to be used without
+ # argument. Indeed, we sometimes output rules like
+ # $(mkdir_p) $(somedir)
+ # where $(somedir) is conditionally defined.
+ # (`test -n '$(somedir)' && $(mkdir_p) $(somedir)' is a more
+ # expensive solution, as it forces Make to start a sub-shell.)
+ mkdir_p='mkdir -p -- .'
+else
+ # On NextStep and OpenStep, the `mkdir' command does not
+ # recognize any option. It will interpret all options as
+ # directories to create, and then abort because `.' already
+ # exists.
+ for d in ./-p ./--version;
+ do
+ test -d $d && rmdir $d
done
-IFS=$as_save_IFS
-
-fi
-
- test -d ./--version && rmdir ./--version
- if test "${ac_cv_path_mkdir+set}" = set; then
- MKDIR_P="$ac_cv_path_mkdir -p"
+ # $(mkinstalldirs) is defined by Automake if mkinstalldirs exists.
+ if test -f "$ac_aux_dir/mkinstalldirs"; then
+ mkdir_p='$(mkinstalldirs)'
else
- # As a last resort, use the slow shell script. Don't cache a
- # value for MKDIR_P within a source directory, because that will
- # break other packages using the cache if that directory is
- # removed, or if the value is a relative name.
- MKDIR_P="$ac_install_sh -d"
+ mkdir_p='$(install_sh) -d'
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $MKDIR_P" >&5
-$as_echo "$MKDIR_P" >&6; }
-
-mkdir_p="$MKDIR_P"
-case $mkdir_p in
- [\\/$]* | ?:[\\/]*) ;;
- */*) mkdir_p="\$(top_builddir)/$mkdir_p" ;;
-esac
for ac_prog in gawk mawk nawk awk
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AWK+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AWK+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AWK"; then
ac_cv_prog_AWK="$AWK" # Let the user override the test.
@@ -3456,44 +2392,43 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AWK="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
AWK=$ac_cv_prog_AWK
if test -n "$AWK"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AWK" >&5
-$as_echo "$AWK" >&6; }
+ { echo "$as_me:$LINENO: result: $AWK" >&5
+echo "${ECHO_T}$AWK" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
test -n "$AWK" && break
done
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ${MAKE-make} sets \$(MAKE)" >&5
-$as_echo_n "checking whether ${MAKE-make} sets \$(MAKE)... " >&6; }
-set x ${MAKE-make}
-ac_make=`$as_echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
-if eval \${ac_cv_prog_make_${ac_make}_set+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether ${MAKE-make} sets \$(MAKE)" >&5
+echo $ECHO_N "checking whether ${MAKE-make} sets \$(MAKE)... $ECHO_C" >&6; }
+set x ${MAKE-make}; ac_make=`echo "$2" | sed 's/+/p/g; s/[^a-zA-Z0-9_]/_/g'`
+if { as_var=ac_cv_prog_make_${ac_make}_set; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.make <<\_ACEOF
SHELL = /bin/sh
all:
@echo '@@@%%%=$(MAKE)=@@@%%%'
_ACEOF
-# GNU make sometimes prints "make[1]: Entering ...", which would confuse us.
+# GNU make sometimes prints "make[1]: Entering...", which would confuse us.
case `${MAKE-make} -f conftest.make 2>/dev/null` in
*@@@%%%=?*=@@@%%%*)
eval ac_cv_prog_make_${ac_make}_set=yes;;
@@ -3503,12 +2438,12 @@ esac
rm -f conftest.make
fi
if eval test \$ac_cv_prog_make_${ac_make}_set = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
SET_MAKE=
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
SET_MAKE="MAKE=${MAKE-make}"
fi
@@ -3521,14 +2456,12 @@ else
fi
rmdir .tst 2>/dev/null
-if test "`cd $srcdir && pwd`" != "`pwd`"; then
- # Use -I$(srcdir) only when $(srcdir) != ., so that make's output
- # is not polluted with repeated "-I."
- am__isrc=' -I$(srcdir)'
- # test to see if srcdir already configured
- if test -f $srcdir/config.status; then
- as_fn_error $? "source directory already configured; run \"make distclean\" there first" "$LINENO" 5
- fi
+# test to see if srcdir already configured
+if test "`cd $srcdir && pwd`" != "`pwd`" &&
+ test -f $srcdir/config.status; then
+ { { echo "$as_me:$LINENO: error: source directory already configured; run \"make distclean\" there first" >&5
+echo "$as_me: error: source directory already configured; run \"make distclean\" there first" >&2;}
+ { (exit 1); exit 1; }; }
fi
# test whether we have cygpath
@@ -3543,7 +2476,7 @@ fi
# Define the identity of the package.
PACKAGE='gmp'
- VERSION='6.0.0'
+ VERSION='4.3.2'
cat >>confdefs.h <<_ACEOF
@@ -3571,33 +2504,136 @@ AUTOHEADER=${AUTOHEADER-"${am_missing_run}autoheader"}
MAKEINFO=${MAKEINFO-"${am_missing_run}makeinfo"}
-# We need awk for the "check" target. The system "awk" is bad on
-# some platforms.
-# Always define AMTAR for backward compatibility. Yes, it's still used
-# in the wild :-( We should find a proper way to deprecate it ...
-AMTAR='$${TAR-tar}'
-am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'
+AMTAR=${AMTAR-"${am_missing_run}tar"}
+
+install_sh=${install_sh-"$am_aux_dir/install-sh"}
+
+# Installed binaries are usually stripped using `strip' when the user
+# run `make install-strip'. However `strip' might not be the right
+# tool to use in cross-compilation environments, therefore Automake
+# will honor the `STRIP' environment variable to overrule this program.
+if test "$cross_compiling" != no; then
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+
+fi
+fi
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+fi
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+else
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+for as_dir in $PATH
+do
+ IFS=$as_save_IFS
+ test -z "$as_dir" && as_dir=.
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
+ break 2
+ fi
+done
+done
+IFS=$as_save_IFS
+fi
+fi
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
+ else
+ case $cross_compiling:$ac_tool_warned in
+yes:)
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
+ac_tool_warned=yes ;;
+esac
+ STRIP=$ac_ct_STRIP
+ fi
+else
+ STRIP="$ac_cv_prog_STRIP"
+fi
+
+fi
+INSTALL_STRIP_PROGRAM="\${SHELL} \$(install_sh) -c -s"
+
+# We need awk for the "check" target. The system "awk" is bad on
+# some platforms.
-ac_config_headers="$ac_config_headers config.h:config.in"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether to enable maintainer-specific portions of Makefiles" >&5
-$as_echo_n "checking whether to enable maintainer-specific portions of Makefiles... " >&6; }
+ac_config_headers="$ac_config_headers config.h:config.in"
+
+{ echo "$as_me:$LINENO: checking whether to enable maintainer-specific portions of Makefiles" >&5
+echo $ECHO_N "checking whether to enable maintainer-specific portions of Makefiles... $ECHO_C" >&6; }
# Check whether --enable-maintainer-mode was given.
-if test "${enable_maintainer_mode+set}" = set; then :
+if test "${enable_maintainer_mode+set}" = set; then
enableval=$enable_maintainer_mode; USE_MAINTAINER_MODE=$enableval
else
USE_MAINTAINER_MODE=no
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $USE_MAINTAINER_MODE" >&5
-$as_echo "$USE_MAINTAINER_MODE" >&6; }
- if test $USE_MAINTAINER_MODE = yes; then
+ { echo "$as_me:$LINENO: result: $USE_MAINTAINER_MODE" >&5
+echo "${ECHO_T}$USE_MAINTAINER_MODE" >&6; }
+
+
+if test $USE_MAINTAINER_MODE = yes; then
MAINTAINER_MODE_TRUE=
MAINTAINER_MODE_FALSE='#'
else
@@ -3611,10 +2647,12 @@ fi
# Check whether --enable-assert was given.
-if test "${enable_assert+set}" = set; then :
+if test "${enable_assert+set}" = set; then
enableval=$enable_assert; case $enableval in
yes|no) ;;
-*) as_fn_error $? "bad value $enableval for --enable-assert, need yes or no" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-assert, need yes or no" >&5
+echo "$as_me: error: bad value $enableval for --enable-assert, need yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_assert=no
@@ -3623,7 +2661,9 @@ fi
if test "$enable_assert" = "yes"; then
-$as_echo "#define WANT_ASSERT 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define WANT_ASSERT 1
+_ACEOF
want_assert_01=1
else
@@ -3635,14 +2675,17 @@ echo "define(<WANT_ASSERT>,$want_assert_01)" >> $gmp_tmpconfigm4
# Check whether --enable-alloca was given.
-if test "${enable_alloca+set}" = set; then :
+if test "${enable_alloca+set}" = set; then
enableval=$enable_alloca; case $enableval in
alloca|malloc-reentrant|malloc-notreentrant) ;;
yes|no|reentrant|notreentrant) ;;
debug) ;;
*)
- as_fn_error $? "bad value $enableval for --enable-alloca, need one of:
-yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug" "$LINENO" 5 ;;
+ { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-alloca, need one of:
+yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug" >&5
+echo "$as_me: error: bad value $enableval for --enable-alloca, need one of:
+yes no reentrant notreentrant alloca malloc-reentrant malloc-notreentrant debug" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_alloca=reentrant
@@ -3663,10 +2706,12 @@ fi
# wanted.
#
# Check whether --enable-cxx was given.
-if test "${enable_cxx+set}" = set; then :
+if test "${enable_cxx+set}" = set; then
enableval=$enable_cxx; case $enableval in
yes|no|detect) ;;
-*) as_fn_error $? "bad value $enableval for --enable-cxx, need yes/no/detect" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-cxx, need yes/no/detect" >&5
+echo "$as_me: error: bad value $enableval for --enable-cxx, need yes/no/detect" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_cxx=no
@@ -3674,29 +2719,13 @@ fi
-# Check whether --enable-assembly was given.
-if test "${enable_assembly+set}" = set; then :
- enableval=$enable_assembly; case $enableval in
-yes|no) ;;
-*) as_fn_error $? "bad value $enableval for --enable-assembly, need yes or no" "$LINENO" 5 ;;
-esac
-else
- enable_assembly=yes
-fi
-
-
-if test "$enable_assembly" = "yes"; then
-
-$as_echo "#define WANT_ASSEMBLY 1" >>confdefs.h
-
-fi
-
-
# Check whether --enable-fft was given.
-if test "${enable_fft+set}" = set; then :
+if test "${enable_fft+set}" = set; then
enableval=$enable_fft; case $enableval in
yes|no) ;;
-*) as_fn_error $? "bad value $enableval for --enable-fft, need yes or no" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-fft, need yes or no" >&5
+echo "$as_me: error: bad value $enableval for --enable-fft, need yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_fft=yes
@@ -3705,37 +2734,49 @@ fi
if test "$enable_fft" = "yes"; then
-$as_echo "#define WANT_FFT 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define WANT_FFT 1
+_ACEOF
fi
-# Check whether --enable-old-fft-full was given.
-if test "${enable_old_fft_full+set}" = set; then :
- enableval=$enable_old_fft_full; case $enableval in
+# Check whether --enable-mpbsd was given.
+if test "${enable_mpbsd+set}" = set; then
+ enableval=$enable_mpbsd; case $enableval in
yes|no) ;;
-*) as_fn_error $? "bad value $enableval for --enable-old-fft-full, need yes or no" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-mpbsd, need yes or no" >&5
+echo "$as_me: error: bad value $enableval for --enable-mpbsd, need yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
- enable_old_fft_full=no
+ enable_mpbsd=no
fi
-if test "$enable_old_fft_full" = "yes"; then
-
-$as_echo "#define WANT_OLD_FFT_FULL 1" >>confdefs.h
+if test "$enable_mpbsd" = "yes"; then
+ WANT_MPBSD_TRUE=
+ WANT_MPBSD_FALSE='#'
+else
+ WANT_MPBSD_TRUE='#'
+ WANT_MPBSD_FALSE=
fi
+
# Check whether --enable-nails was given.
-if test "${enable_nails+set}" = set; then :
+if test "${enable_nails+set}" = set; then
enableval=$enable_nails; case $enableval in
yes|no|[02468]|[0-9][02468]) ;;
*[13579])
- as_fn_error $? "bad value $enableval for --enable-nails, only even nail sizes supported" "$LINENO" 5 ;;
+ { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-nails, only even nail sizes supported" >&5
+echo "$as_me: error: bad value $enableval for --enable-nails, only even nail sizes supported" >&2;}
+ { (exit 1); exit 1; }; } ;;
*)
- as_fn_error $? "bad value $enableval for --enable-nails, need yes/no/number" "$LINENO" 5 ;;
+ { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-nails, need yes/no/number" >&5
+echo "$as_me: error: bad value $enableval for --enable-nails, need yes/no/number" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_nails=no
@@ -3751,10 +2792,12 @@ esac
# Check whether --enable-profiling was given.
-if test "${enable_profiling+set}" = set; then :
+if test "${enable_profiling+set}" = set; then
enableval=$enable_profiling; case $enableval in
no|prof|gprof|instrument) ;;
-*) as_fn_error $? "bad value $enableval for --enable-profiling, need no/prof/gprof/instrument" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-profiling, need no/prof/gprof/instrument" >&5
+echo "$as_me: error: bad value $enableval for --enable-profiling, need no/prof/gprof/instrument" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_profiling=no
@@ -3764,17 +2807,23 @@ fi
case $enable_profiling in
prof)
-$as_echo "#define WANT_PROFILING_PROF 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define WANT_PROFILING_PROF 1
+_ACEOF
;;
gprof)
-$as_echo "#define WANT_PROFILING_GPROF 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define WANT_PROFILING_GPROF 1
+_ACEOF
;;
instrument)
-$as_echo "#define WANT_PROFILING_INSTRUMENT 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define WANT_PROFILING_INSTRUMENT 1
+_ACEOF
;;
esac
@@ -3793,10 +2842,12 @@ fi
# Check whether --with-readline was given.
-if test "${with_readline+set}" = set; then :
+if test "${with_readline+set}" = set; then
withval=$with_readline; case $withval in
yes|no|detect) ;;
-*) as_fn_error $? "bad value $withval for --with-readline, need yes/no/detect" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $withval for --with-readline, need yes/no/detect" >&5
+echo "$as_me: error: bad value $withval for --with-readline, need yes/no/detect" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
with_readline=detect
@@ -3805,10 +2856,12 @@ fi
# Check whether --enable-fat was given.
-if test "${enable_fat+set}" = set; then :
+if test "${enable_fat+set}" = set; then
enableval=$enable_fat; case $enableval in
yes|no) ;;
-*) as_fn_error $? "bad value $enableval for --enable-fat, need yes or no" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-fat, need yes or no" >&5
+echo "$as_me: error: bad value $enableval for --enable-fat, need yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_fat=no
@@ -3817,10 +2870,12 @@ fi
# Check whether --enable-minithres was given.
-if test "${enable_minithres+set}" = set; then :
+if test "${enable_minithres+set}" = set; then
enableval=$enable_minithres; case $enableval in
yes|no) ;;
-*) as_fn_error $? "bad value $enableval for --enable-minithres, need yes or no" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: bad value $enableval for --enable-minithres, need yes or no" >&5
+echo "$as_me: error: bad value $enableval for --enable-minithres, need yes or no" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
else
enable_minithres=no
@@ -3828,32 +2883,6 @@ 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
@@ -3868,6 +2897,7 @@ echo "define_not_for_expansion(\`HAVE_HOST_CPU_$tmp_host')" >> $gmp_tmpconfigm4p
+
# Table of compilers, options, and mpn paths. This code has various related
# purposes
#
@@ -3992,24 +3022,25 @@ HAVE_HOST_CPU_FAMILY_powerpc=0
case $host in
+ a29k*-*-*)
+ path="a29k"
+ ;;
+
+
alpha*-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_alpha 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_HOST_CPU_FAMILY_alpha 1
+_ACEOF
case $host_cpu in
- alphaev5* | alphapca5*)
- path="alpha/ev5 alpha" ;;
+ alphaev5* | alphapca5*) path="alpha/ev5 alpha" ;;
alphaev67 | alphaev68 | alphaev7*)
- path="alpha/ev67 alpha/ev6 alpha" ;;
- alphaev6)
- path="alpha/ev6 alpha" ;;
- *)
- path="alpha" ;;
+ path="alpha/ev67 alpha/ev6 alpha/ev5 alpha" ;;
+ alphaev6* | alphaev7*) path="alpha/ev6 alpha/ev5 alpha" ;;
+ *) path="alpha" ;;
esac
- if test "$enable_assembly" = "yes" ; then
- extra_functions="cntlz"
- fi
+ extra_functions="cntlz"
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.
@@ -4139,82 +3170,18 @@ echo "include_mpn(\`alpha/default.m4')" >> $gmp_tmpconfigm4i
;;
- arm64*-*-* | aarch64*-*-*)
- path="arm64"
- ;;
-
-
arm*-*-*)
+ path="arm"
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- gcc_cflags_optlist="arch neon tune"
- gcc_cflags_maybe="-marm"
gcc_testlist="gcc-arm-umodsi"
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 | arm9tdmi | armv4*)
- path="arm"
- gcc_cflags_arch="-march=armv4"
- ;;
- armxscale | arm9te | arm10 | armv5*)
- path="arm/v5 arm"
- gcc_cflags_arch="-march=armv5"
- ;;
- arm11mpcore | arm1136 | arm1176 | armv6*)
- path="arm/v6 arm/v5 arm"
- gcc_cflags_arch="-march=armv6"
- ;;
- arm1156)
- 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"
- ;;
- 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"
- ;;
- esac
+
+ clipper*-*-*)
+ path="clipper"
;;
@@ -4238,6 +3205,7 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
# checking sizeof(long), either 4 or 8 bytes respectively. Do this in
# ABI=1.0 too, in case someone tries to build that with a 2.0w gcc.
#
+ gcc_cflags="-O2"
gcc_cflags_optlist="arch"
gcc_testlist="sizeof-long-4"
SPEED_CYCLECOUNTER_OBJ=hppa.lo
@@ -4290,7 +3258,7 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
# -mpa-risc-2-0 is only an optional flag, in case an old gcc is
# used. Assembler support for 2.0 is essential though, for our asm
# files.
- gcc_20n_cflags="$gcc_cflags"
+ gcc_20n_cflags="-O2"
gcc_20n_cflags_optlist="arch"
gcc_20n_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1"
gcc_20n_testlist="sizeof-long-4 hppa-level-2.0"
@@ -4308,12 +3276,11 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
# systems (GNU/Linux for instance), but lets assume they're ok.
case $host in
*-*-hpux[1-9] | *-*-hpux[1-9].* | *-*-hpux10 | *-*-hpux10.*) ;;
- *-*-linux*) abilist="1.0" ;; # due to linux permanent kernel bug
*) abilist="2.0w $abilist" ;;
esac
cclist_20w="gcc cc"
- gcc_20w_cflags="$gcc_cflags -mpa-risc-2-0"
+ gcc_20w_cflags="-O2 -mpa-risc-2-0"
cc_20w_cflags="+DD64 +O2"
cc_20w_testlist="hpc-hppa-2-0"
path_20w="pa64"
@@ -4327,13 +3294,17 @@ echo "include_mpn(\`arm/arm-defs.m4')" >> $gmp_tmpconfigm4i
;;
+ i960*-*-*)
+ path="i960"
+ ;;
+
+
ia64*-*-* | itanium-*-* | itanium2-*-*)
abilist="64"
echo "include_mpn(\`ia64/ia64-defs.m4')" >> $gmp_tmpconfigm4i
SPEED_CYCLECOUNTER_OBJ=ia64.lo
- any_32_testlist="sizeof-long-4"
case $host_cpu in
itanium) path="ia64/itanium ia64" ;;
@@ -4367,14 +3338,13 @@ echo "include_mpn(\`ia64/ia64-defs.m4')" >> $gmp_tmpconfigm4i
# let us use whatever seems to work.
#
abilist="32 64"
- any_64_testlist="sizeof-long-8"
cclist_32="gcc cc"
path_32="ia64"
cc_32_cflags=""
cc_32_cflags_optlist="opt"
cc_32_cflags_opt="+O3 +O2 +O1"
- gcc_32_cflags="$gcc_cflags -milp32"
+ gcc_32_cflags="-milp32 -O2"
limb_32=longlong
SPEED_CYCLECOUNTER_OBJ_32=ia64.lo
cyclecounter_size_32=2
@@ -4389,7 +3359,7 @@ echo "include_mpn(\`ia64/ia64-defs.m4')" >> $gmp_tmpconfigm4i
cc_64_cppflags="+DD64"
cc_64_cflags_optlist="opt"
cc_64_cflags_opt="+O3 +O2 +O1"
- gcc_64_cflags="$gcc_cflags -mlp64"
+ gcc_64_cflags="$gcc_64_cflags -mlp64"
;;
esac
;;
@@ -4398,7 +3368,9 @@ echo "include_mpn(\`ia64/ia64-defs.m4')" >> $gmp_tmpconfigm4i
# Motorola 68k
#
m68k-*-* | m68[0-9][0-9][0-9]-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_m68k 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_HOST_CPU_FAMILY_m68k 1
+_ACEOF
echo "include_mpn(\`m68k/m68k-defs.m4')" >> $gmp_tmpconfigm4i
@@ -4439,6 +3411,12 @@ 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
@@ -4469,13 +3447,13 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
abilist="n32 64 o32"
cclist_n32="gcc cc"
- gcc_n32_cflags="$gcc_cflags -mabi=n32"
+ gcc_n32_cflags="-O2 -mabi=n32"
cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations
limb_n32=longlong
path_n32="mips64"
cclist_64="gcc cc"
- gcc_64_cflags="$gcc_cflags -mabi=64"
+ gcc_64_cflags="$gcc_64_cflags -mabi=64"
gcc_64_ldflags="-Wc,-mabi=64"
cc_64_cflags="-O2 -64" # no -g, it disables all optimizations
cc_64_ldflags="-Wc,-64"
@@ -4508,19 +3486,20 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
# "-arch ppc" or some such, but that's already the default.)
#
powerpc*-*-* | power[3-9]-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_powerpc 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_HOST_CPU_FAMILY_powerpc 1
+_ACEOF
HAVE_HOST_CPU_FAMILY_powerpc=1
abilist="32"
cclist="gcc cc"
cc_cflags="-O2"
- gcc_32_cflags="$gcc_cflags -mpowerpc"
+ gcc_cflags="$gcc_cflags -mpowerpc"
gcc_cflags_optlist="precomp subtype asm cpu"
gcc_cflags_precomp="-no-cpp-precomp"
gcc_cflags_subtype="-force_cpusubtype_ALL" # for vmx on darwin
gcc_cflags_asm=""
gcc_cflags_cpu=""
- vmx_path=""
# grab this object, though it's not a true cycle counter routine
SPEED_CYCLECOUNTER_OBJ=powerpc.lo
@@ -4537,28 +3516,32 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
path="powerpc32" ;;
esac
+ # gcc 2.7.2 knows -mcpu=403, 601, 603, 604.
+ # gcc 2.95 adds 401, 505, 602, 603e, ec603e, 604e, 620, 740, 750,
+ # 801, 821, 823, 860.
+ # gcc 3.0 adds 630, rs64a.
+ # gcc 3.1 adds 405, 7400, 7450.
+ # gcc 3.2 adds nothing.
+ # gcc 3.3 adds power3, power4, 8540. power3 seems to be a synonym for 630.
+ # gcc pre-release 3.4 adds 405fp, 440, 440fp, 970.
+ #
+ # FIXME: The way 603e falls back to 603 for gcc 2.7.2 should be
+ # done for all the others too. But what would be the correct
+ # arrangements?
+ #
case $host_cpu in
powerpc401) gcc_cflags_cpu="-mcpu=401" ;;
- powerpc403) gcc_cflags_cpu="-mcpu=403"
- xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
+ powerpc403) gcc_cflags_cpu="-mcpu=403" ;;
powerpc405) gcc_cflags_cpu="-mcpu=405" ;;
powerpc505) gcc_cflags_cpu="-mcpu=505" ;;
- powerpc601) gcc_cflags_cpu="-mcpu=601"
- xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
- powerpc602) gcc_cflags_cpu="-mcpu=602"
- xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
- powerpc603) gcc_cflags_cpu="-mcpu=603"
- xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603"
- xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc604) gcc_cflags_cpu="-mcpu=604"
- xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
- powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604"
- xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ powerpc601) gcc_cflags_cpu="-mcpu=601" ;;
+ powerpc602) gcc_cflags_cpu="-mcpu=602" ;;
+ powerpc603) gcc_cflags_cpu="-mcpu=603" ;;
+ powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603" ;;
+ powerpc604) gcc_cflags_cpu="-mcpu=604" ;;
+ powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604" ;;
powerpc620) gcc_cflags_cpu="-mcpu=620" ;;
- powerpc630) gcc_cflags_cpu="-mcpu=630"
- xlc_cflags_arch="-qarch=pwr3"
- cpu_path="p3 p3-p7" ;;
+ powerpc630) gcc_cflags_cpu="-mcpu=630" ;;
powerpc740) gcc_cflags_cpu="-mcpu=740" ;;
powerpc7400 | powerpc7410)
gcc_cflags_asm="-Wa,-maltivec"
@@ -4571,78 +3554,71 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
powerpc821) gcc_cflags_cpu="-mcpu=821" ;;
powerpc823) gcc_cflags_cpu="-mcpu=823" ;;
powerpc860) gcc_cflags_cpu="-mcpu=860" ;;
- powerpc970) gcc_cflags_cpu="-mtune=970"
- xlc_cflags_arch="-qarch=970 -qarch=pwr3"
- vmx_path="powerpc64/vmx"
- cpu_path="p4 p3-p7" ;;
- power4) gcc_cflags_cpu="-mtune=power4"
- xlc_cflags_arch="-qarch=pwr4"
- cpu_path="p4 p3-p7" ;;
- power5) gcc_cflags_cpu="-mtune=power5 -mtune=power4"
- xlc_cflags_arch="-qarch=pwr5"
- cpu_path="p5 p4 p3-p7" ;;
- power6) gcc_cflags_cpu="-mtune=power6"
- xlc_cflags_arch="-qarch=pwr6"
- cpu_path="p6 p3-p7" ;;
- power7) gcc_cflags_cpu="-mtune=power7 -mtune=power5"
- xlc_cflags_arch="-qarch=pwr7 -qarch=pwr5"
- cpu_path="p7 p5 p4 p3-p7" ;;
+ powerpc970) gcc_cflags_cpu="-mcpu=970" ;;
esac
case $host in
*-*-aix*)
- cclist="gcc xlc cc"
- gcc_32_cflags_maybe="-maix32"
- xlc_cflags="-O2 -qmaxmem=20000"
- xlc_cflags_optlist="arch"
- xlc_32_cflags_maybe="-q32"
- ar_32_flags="-X32"
- nm_32_flags="-X32"
+ cclist="gcc xlc cc"
+ xlc_cflags="-O2 -qmaxmem=20000"
+ xlc_cflags_optlist="arch"
+
+ # xlc (what version?) knows -qarch=ppc, ppcgr, 601, 602, 603, 604,
+ # 403, rs64a
+ # -qarch=ppc is needed, so ensure everything falls back to that.
+ # FIXME: Perhaps newer versions know more flavours.
+ #
+ case $host_cpu in
+ powerpc403) xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
+ powerpc601) xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
+ powerpc602) xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
+ powerpc603) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
+ powerpc603e) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
+ powerpc604) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ powerpc604e) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ *) xlc_cflags_arch="-qarch=ppc" ;;
+ esac
+ ;;
esac
case $host in
powerpc64-*-* | powerpc64le-*-* | powerpc620-*-* | powerpc630-*-* | powerpc970-*-* | power[3-9]-*-*)
- case $host in
- *-*-aix*)
- # On AIX a true 64-bit ABI is available.
- # Need -Wc to pass object type flags through to the linker.
- abilist="mode64 $abilist"
- cclist_mode64="gcc xlc"
- gcc_mode64_cflags="$gcc_cflags -maix64 -mpowerpc64"
- gcc_mode64_cflags_optlist="cpu"
- gcc_mode64_ldflags="-Wc,-maix64"
- xlc_mode64_cflags="-O2 -q64 -qmaxmem=20000"
- xlc_mode64_cflags_optlist="arch"
- xlc_mode64_ldflags="-Wc,-q64"
- # Must indicate object type to ar and nm
- ar_mode64_flags="-X64"
- nm_mode64_flags="-X64"
- path_mode64=""
- p=""
- for i in $cpu_path
- do path_mode64="${path_mode64}powerpc64/mode64/$i "
- path_mode64="${path_mode64}powerpc64/$i "
- p="${p} powerpc32/$i "
- done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- path="$p $path"
- # grab this object, though it's not a true cycle counter routine
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
- ;;
- *-*-darwin*)
- # On Darwin we can use 64-bit instructions with a longlong limb,
- # but the chip still in 32-bit mode.
- # In theory this can be used on any OS which knows how to save
- # 64-bit registers in a context switch.
- #
- # Note that we must use -mpowerpc64 with gcc, since the
- # longlong.h macros expect limb operands in a single 64-bit
- # register, not two 32-bit registers as would be given for a
- # long long without -mpowerpc64. In theory we could detect and
- # accommodate both styles, but the proper 64-bit registers will
- # be fastest and are what we really want to use.
- #
+ case $host_cpu in
+ powerpc970) vmx_path="powerpc64/vmx" ;;
+ *) vmx_path="" ;;
+ esac
+ case $host in
+ *-*-aix*)
+ # On AIX a true 64-bit ABI is available.
+ # Need -Wc to pass object type flags through to the linker.
+ abilist="aix64 $abilist"
+ cclist_aix64="gcc xlc"
+ gcc_aix64_cflags="-O2 -maix64 -mpowerpc64"
+ gcc_aix64_cflags_optlist="cpu"
+ gcc_aix64_ldflags="-Wc,-maix64"
+ xlc_aix64_cflags="-O2 -q64 -qtune=pwr3 -qmaxmem=20000"
+ xlc_aix64_ldflags="-Wc,-q64"
+ # Must indicate object type to ar and nm
+ ar_aix64_flags="-X64"
+ nm_aix64_flags="-X64"
+ path_aix64="powerpc64/mode64 $vmx_path powerpc64"
+ # grab this object, though it's not a true cycle counter routine
+ SPEED_CYCLECOUNTER_OBJ_aix64=powerpc64.lo
+ cyclecounter_size_aix64=0
+ ;;
+ *-*-darwin*)
+ # On Darwin we can use 64-bit instructions with a longlong limb,
+ # but the chip still in 32-bit mode.
+ # In theory this can be used on any OS which knows how to save
+ # 64-bit registers in a context switch.
+ #
+ # Note that we must use -mpowerpc64 with gcc, since the
+ # longlong.h macros expect limb operands in a single 64-bit
+ # register, not two 32-bit registers as would be given for a
+ # long long without -mpowerpc64. In theory we could detect and
+ # accomodate both styles, but the proper 64-bit registers will
+ # be fastest and are what we really want to use.
+ #
# One would think -mpowerpc64 would set the assembler in the right
# mode to handle 64-bit instructions. But for that, also
# -force_cpusubtype_ALL is needed.
@@ -4651,34 +3627,21 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
# incompatible with a shared library.
#
abilist="mode64 mode32 $abilist"
- gcc_32_cflags_maybe="-m32"
gcc_cflags_opt="-O3 -O2 -O1" # will this become used?
cclist_mode32="gcc"
- gcc_mode32_cflags_maybe="-m32"
gcc_mode32_cflags="-mpowerpc64"
gcc_mode32_cflags_optlist="subtype cpu opt"
gcc_mode32_cflags_subtype="-force_cpusubtype_ALL"
gcc_mode32_cflags_opt="-O3 -O2 -O1"
+ path_mode32="powerpc64/mode32 $vmx_path powerpc64"
limb_mode32=longlong
cclist_mode64="gcc"
gcc_mode64_cflags="-m64"
gcc_mode64_cflags_optlist="cpu opt"
gcc_mode64_cflags_opt="-O3 -O2 -O1"
- path_mode64=""
- path_mode32=""
- p=""
- for i in $cpu_path
- do path_mode64="${path_mode64}powerpc64/mode64/$i "
- path_mode64="${path_mode64}powerpc64/$i "
- path_mode32="${path_mode32}powerpc64/mode32/$i "
- path_mode32="${path_mode32}powerpc64/$i "
- p="${p} powerpc32/$i "
- done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64"
- path="$p $path"
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
+ path_mode64="powerpc64/mode64 $vmx_path powerpc64"
+ SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
+ cyclecounter_size_mode64=0
any_mode64_testlist="sizeof-long-8"
;;
*-*-linux* | *-*-*bsd*)
@@ -4687,53 +3650,42 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
# others require -m64, hence the use of cflags_maybe. The
# sizeof-long-8 test checks the mode is right (for the no option
# case).
- #
- # -mpowerpc64 is not used, since it should be the default in
- # 64-bit mode. (We need its effect for the various longlong.h
- # asm macros to be right of course.)
- #
- # gcc64 was an early port of gcc to 64-bit mode, but should be
- # obsolete before too long. We prefer plain gcc when it knows
- # 64-bits.
+ #
+ # -mpowerpc64 is not used, since it should be the default in
+ # 64-bit mode. (We need its effect for the various longlong.h
+ # asm macros to be right of course.)
+ #
+ # gcc64 was an early port of gcc to 64-bit mode, but should be
+ # obsolete before too long. We prefer plain gcc when it knows
+ # 64-bits.
#
abilist="mode64 mode32 $abilist"
- gcc_32_cflags_maybe="-m32"
cclist_mode32="gcc"
- gcc_mode32_cflags_maybe="-m32"
gcc_mode32_cflags="-mpowerpc64"
gcc_mode32_cflags_optlist="cpu opt"
gcc_mode32_cflags_opt="-O3 -O2 -O1"
+ path_mode32="powerpc64/mode32 $vmx_path powerpc64"
limb_mode32=longlong
cclist_mode64="gcc gcc64"
gcc_mode64_cflags_maybe="-m64"
gcc_mode64_cflags_optlist="cpu opt"
gcc_mode64_cflags_opt="-O3 -O2 -O1"
- path_mode64=""
- path_mode32=""
- p=""
- for i in $cpu_path
- do path_mode64="${path_mode64}powerpc64/mode64/$i "
- path_mode64="${path_mode64}powerpc64/$i "
- path_mode32="${path_mode32}powerpc64/mode32/$i "
- path_mode32="${path_mode32}powerpc64/$i "
- p="${p} powerpc32/$i "
- done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64"
- path="$p $path"
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
+ path_mode64="powerpc64/mode64 $vmx_path powerpc64"
+ SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
+ cyclecounter_size_mode64=0
any_mode64_testlist="sizeof-long-8"
;;
- esac
- ;;
+ esac
+ ;;
esac
;;
- # POWER 32-bit
+ # POWER
power-*-* | power[12]-*-* | power2sc-*-*)
- $as_echo "#define HAVE_HOST_CPU_FAMILY_power 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_HOST_CPU_FAMILY_power 1
+_ACEOF
HAVE_HOST_CPU_FAMILY_power=1
cclist="gcc"
@@ -4761,100 +3713,21 @@ echo "include_mpn(\`mips32/mips-defs.m4')" >> $gmp_tmpconfigm4i
;;
- # IBM System/390 and z/Architecture
- s390-*-* | z900esa-*-* | z990esa-*-* | z9esa-*-* | z10esa-*-* | z196esa-*-* | s390x-*-* | z900-*-* | z990-*-* | z9-*-* | z10-*-* | z196-*-*)
- abilist="32"
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- gcc_cflags_optlist="arch"
- path="s390_32"
- extra_functions="udiv_w_sdiv"
- gcc_32_cflags_maybe="-m31"
-
- case $host_cpu in
- s390)
- ;;
- z900 | z900esa)
- cpu="z900"
- gccarch="$cpu"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- cat >>confdefs.h <<_ACEOF
-#define HAVE_HOST_CPU_s390_$cpu 1
-_ACEOF
-
- $as_echo "#define HAVE_HOST_CPU_s390_zarch 1" >>confdefs.h
-
- extra_functions=""
- ;;
- z990 | z990esa)
- cpu="z990"
- gccarch="$cpu"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- cat >>confdefs.h <<_ACEOF
-#define HAVE_HOST_CPU_s390_$cpu 1
-_ACEOF
-
- $as_echo "#define HAVE_HOST_CPU_s390_zarch 1" >>confdefs.h
-
- extra_functions=""
- ;;
- z9 | z9esa)
- cpu="z9"
- gccarch="z9-109"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- cat >>confdefs.h <<_ACEOF
-#define HAVE_HOST_CPU_s390_$cpu 1
-_ACEOF
-
- $as_echo "#define HAVE_HOST_CPU_s390_zarch 1" >>confdefs.h
-
- extra_functions=""
- ;;
- z10 | z10esa)
- cpu="z10"
- gccarch="z10"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- cat >>confdefs.h <<_ACEOF
-#define HAVE_HOST_CPU_s390_$cpu 1
-_ACEOF
-
- $as_echo "#define HAVE_HOST_CPU_s390_zarch 1" >>confdefs.h
-
- extra_functions=""
- ;;
- z196 | z196esa)
- cpu="z196"
- gccarch="z196"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- cat >>confdefs.h <<_ACEOF
-#define HAVE_HOST_CPU_s390_$cpu 1
-_ACEOF
-
- $as_echo "#define HAVE_HOST_CPU_s390_zarch 1" >>confdefs.h
+ pyramid-*-*)
+ path="pyr"
+ ;;
- extra_functions=""
- ;;
- esac
- case $host in
- s390x-*-* | z900-*-* | z990-*-* | z9-*-* | z10-*-* | z196-*-*)
- abilist="64 32"
- cclist_64="gcc"
- gcc_64_cflags_optlist="arch"
- gcc_64_cflags="$gcc_cflags -m64"
- path_64="s390_64/$host_cpu s390_64"
- extra_functions=""
- ;;
- esac
+ # IBM s/370 and similar
+ s3[6-9]0*-*-*)
+ gcc_cflags="$gcc_cflags $fomit_frame_pointer"
+ path="s390"
+ extra_functions="udiv_w_sdiv"
;;
sh-*-*) path="sh" ;;
- sh[2-4]-*-*) path="sh/sh2 sh" ;;
+ sh2-*-*) path="sh/sh2 sh" ;;
*sparc*-*-*)
@@ -4878,10 +3751,8 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
path="sparc32/v8 sparc32" ;;
supersparc)
path="sparc32/v8/supersparc sparc32/v8 sparc32" ;;
- sparc64 | sparcv9* | ultrasparc | ultrasparc[234]*)
+ sparc64 | sparcv9* | ultrasparc*)
path="sparc32/v9 sparc32/v8 sparc32" ;;
- ultrasparct[12345])
- path="sparc32/ultrasparct1 sparc32/v8 sparc32" ;;
*)
path="sparc32" ;;
esac
@@ -4900,49 +3771,32 @@ 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
+ sparc64 | sparcv9* | ultrasparc*)
+ gcc_cflags="$gcc_cflags -Wa,-xarch=v8plus" ;;
+ *)
+ gcc_cflags="$gcc_cflags" ;;
+ esac
gcc_32_cflags_maybe="-m32"
- gcc_cflags_optlist="cpu asm"
+ gcc_cflags_optlist="cpu"
# 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"
- 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="";;
+ 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" ;;
esac
# SunPRO cc and acc, and SunOS bundled cc
@@ -4958,14 +3812,10 @@ 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 | 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" ;;
+ sparcv8 | microsparc | supersparc | turbosparc)
+ cc_cflags_arch="-xarch=v8" ;;
+ 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.
@@ -4973,21 +3823,17 @@ 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 -xchip=ultra" ;;
- ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i -xchip=ultra2 -xchip=ultra" ;;
+ ultrasparc2) cc_cflags_cpu="-xchip=ultra2" ;;
+ ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i" ;;
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
@@ -5019,19 +3865,7 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
*) abilist="64 32" ;;
esac
- case $host_cpu in
- ultrasparc | ultrasparc2 | ultrasparc2i)
- path_64="sparc64/ultrasparc1234 sparc64" ;;
- ultrasparc[34])
- path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
- ultrasparct[12])
- path_64="sparc64/ultrasparct1 sparc64" ;;
- ultrasparct[345])
- path_64="sparc64/ultrasparct3 sparc64" ;;
- *)
- path_64="sparc64"
- esac
-
+ path_64="sparc64"
cclist_64="gcc"
any_64_testlist="sizeof-long-8"
@@ -5046,9 +3880,9 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
# it until we're sure. (Might want -xarch=v9a or -xarch=v9b for the
# higher cpu types instead.)
#
- gcc_64_cflags="$gcc_cflags -m64 -mptr64"
+ gcc_64_cflags="$gcc_64_cflags -m64 -mptr64"
gcc_64_ldflags="-Wc,-m64"
- gcc_64_cflags_optlist="cpu asm"
+ gcc_64_cflags_optlist="cpu"
case $host in
*-*-solaris*)
@@ -5059,13 +3893,8 @@ 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
@@ -5080,18 +3909,10 @@ echo "include_mpn(\`sparc32/sparc-defs.m4')" >> $gmp_tmpconfigm4i
# VAX
- vax*-*-*elf*)
- # Use elf conventions (i.e., '%' register prefix, no global prefix)
- #
-
-echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
-
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- path="vax"
- extra_functions="udiv_w_sdiv"
- ;;
vax*-*-*)
- # Default to aout conventions (i.e., no register prefix, '_' global prefix)
+ # Currently gcc (version 3.0) on vax always uses a frame pointer
+ # (config/vax/vax.h FRAME_POINTER_REQUIRED=1), so -fomit-frame-pointer
+ # will be ignored.
#
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
path="vax"
@@ -5114,7 +3935,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-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
+ i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*)
abilist="32"
cclist="gcc icc cc"
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
@@ -5165,233 +3986,166 @@ echo "include_mpn(\`vax/elf.m4')" >> $gmp_tmpconfigm4i
gcc_cflags_optlist="cpu arch"
case $host_cpu in
i386*)
- gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
- gcc_cflags_arch="-march=i386"
- path="x86"
- ;;
+ gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
+ gcc_cflags_arch="-march=i386"
+ ;;
i486*)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- path="x86/i486 x86"
- ;;
+ gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=i486"
+ ;;
i586 | pentium)
- gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
- gcc_cflags_arch="-march=pentium"
- path="x86/pentium x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
+ gcc_cflags_arch="-march=pentium"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
+ gcc_cflags_arch="-march=pentium-mmx -march=pentium"
+ ;;
i686 | pentiumpro)
- gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentiumpro -march=pentium"
- path="x86/p6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentiumpro -march=pentium"
+ ;;
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/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/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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
+ ;;
+ pentium3 | pentiumm)
+ gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
+ ;;
k6)
- gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6"
- path="x86/k6/mmx x86/k6 x86/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-2 -march=k6"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-3 -march=k6"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-3 -march=k6"
+ ;;
athlon)
- # Athlon instruction costs are close to P6 (3 cycle load latency,
- # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
- # 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/mmx x86"
- ;;
+ # Athlon instruction costs are close to P6 (3 cycle load latency,
+ # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
+ # 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"
+ ;;
i786 | pentium4)
- # pentiumpro is the primary fallback when gcc doesn't know pentium4.
- # This gets us cmov to eliminate branches. Maybe "athlon" would be
- # a possibility on gcc 3.0.
- #
- 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/mmx x86"
- path_64="x86_64/pentium4 x86_64"
- ;;
+ # pentiumpro is the primary fallback when gcc doesn't know pentium4.
+ # This gets us cmov to eliminate branches. Maybe "athlon" would be
+ # a possibility on gcc 3.0.
+ #
+ 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"
+ ;;
viac32)
- # Not sure of the best fallbacks here for -mcpu.
- # 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/mmx x86"
- ;;
+ # Not sure of the best fallbacks here for -mcpu.
+ # 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"
+ ;;
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/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/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/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/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/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"
- ;;
+ # 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"
+ ;;
+ athlon64 | 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"
+ ;;
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/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/mmx x86"
- path_64="x86_64/coreinhm x86_64/core2 x86_64"
- ;;
- 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/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/mmx x86"
- path_64="x86_64/atom x86_64"
- ;;
- nano)
- gcc_cflags_cpu="-mtune=nano"
- gcc_cflags_arch="-march=nano"
- path="x86/nano x86/mmx x86"
- path_64="x86_64/nano x86_64"
- ;;
+ gcc_cflags_cpu="-mtune=core2 -mtune=k8"
+ gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
+ ;;
*)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- path="x86"
- path_64="x86_64"
- ;;
+ gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=i486"
+ ;;
esac
- case $host in
- 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 cc"
- gcc_x32_cflags="$gcc_cflags -mx32"
- gcc_x32_cflags_optlist="$gcc_64_cflags_optlist"
- CALLING_CONVENTIONS_OBJS_x32="$CALLING_CONVENTIONS_OBJS_64"
- SPEED_CYCLECOUNTER_OBJ_x32="$SPEED_CYCLECOUNTER_OBJ_64"
- cyclecounter_size_x32="$cyclecounter_size_64"
- path_x32="$path_64"
- limb_x32=longlong
- any_x32_testlist="sizeof-long-4"
-
- abilist="64 x32 32"
- if test "$enable_assembly" = "yes" ; then
- extra_functions_64="$extra_functions_64 invert_limb_table"
- extra_functions_x32=$extra_functions_64
- fi
+ case $host_cpu in
+ i386*) path="x86" ;;
+ i486*) path="x86/i486 x86" ;;
+ i586 | pentium) path="x86/pentium x86" ;;
+ pentiummmx) path="x86/pentium/mmx x86/pentium x86" ;;
+ i686 | pentiumpro) path="x86/p6 x86" ;;
+ pentium2) path="x86/p6/mmx x86/p6 x86" ;;
+ pentium3) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ pentiumm | core2) path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ k6[23]) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
+ k6) path="x86/k6/mmx x86/k6 x86" ;;
+ geode) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
+ # we don't have any specific 32-bit code for athlon64/opteron, the
+ # athlon code should be reasonable
+ athlon | athlon64) path="x86/k7/mmx x86/k7 x86" ;;
+ i786 | pentium4) path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86" ;;
+ # VIA/Centaur processors, sold as CyrixIII and C3.
+ viac32) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ viac3*) path="x86/pentium/mmx x86/pentium x86";;
+ *) path="x86" ;;
+ esac
- case $host in
- *-*-solaris*)
- # Sun cc.
- cc_64_cflags="-xO3 -m64"
- ;;
- *-*-mingw* | *-*-cygwin)
- limb_64=longlong
- CALLING_CONVENTIONS_OBJS_64=""
+ # 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=""
+ extra_functions="$extra_functions fat fat_entry"
+ path="x86/fat x86"
+ fat_path="x86 x86/fat x86/i486
+ x86/k6 x86/k6/mmx x86/k6/k62mmx
+ x86/k7 x86/k7/mmx
+ x86/pentium x86/pentium/mmx
+ x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
+ x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2"
+ fat_functions="add_n addmul_1 copyd copyi
+ dive_1 diveby3 divrem_1 gcd_1 lshift
+ mod_1 mod_34lsub1 mode1o mul_1 mul_basecase
+ pre_divrem_1 pre_mod_1 rshift
+ sqr_basecase sub_n submul_1"
+ fat_thresholds="MUL_KARATSUBA_THRESHOLD MUL_TOOM3_THRESHOLD
+ SQR_KARATSUBA_THRESHOLD SQR_TOOM3_THRESHOLD"
+ fi
-$as_echo "#define HOST_DOS64 1" >>confdefs.h
+ case $host_cpu in
+ athlon64 | atom | core2 | pentium4 | x86_64)
+ cclist_64="gcc"
+ gcc_64_cflags="$gcc_64_cflags -m64"
+ gcc_64_cflags_optlist="cpu"
+ CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo'
+ SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo
+ cyclecounter_size_64=2
+
+ case $host in
+ *-*-solaris*)
+ # Sun cc.
+ cclist_64="$cclist_64 cc"
+ cc_64_cflags="-xO3 -m64"
+ ;;
+ esac
- GMP_NONSTD_ABI_64=DOS64
+ case $host_cpu in
+ athlon64 | x86_64)
+ abilist="64 32"
+ path_64="x86_64"
+ ;;
+ pentium4)
+ abilist="64 32"
+ path_64="x86_64/pentium4 x86_64"
+ ;;
+ core2)
+ abilist="64 32"
+ path_64="x86_64/core2 x86_64"
+ ;;
+ atom)
+ # The AMD K8/K9/K10 code seems best for Intel Atom
+ abilist="64 32"
+ path_64="x86_64/atom x86_64"
;;
esac
;;
@@ -5399,11 +4153,33 @@ $as_echo "#define HOST_DOS64 1" >>confdefs.h
;;
- # Special CPU "none" used to select generic C, now this is obsolete.
+ # 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" selects generic C. -DNO_ASM is used to disable gcc
+ # asm blocks in longlong.h (since they're driven by cpp pre-defined
+ # symbols like __alpha rather than the configured $host_cpu).
+ #
none-*-*)
- enable_assembly=no
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: the \"none\" host is obsolete, use --disable-assembly" >&5
-$as_echo "$as_me: WARNING: the \"none\" host is obsolete, use --disable-assembly" >&2;}
+ abilist="long longlong"
+ cclist_long=$cclist
+ gcc_long_cflags=$gcc_cflags
+ gcc_long_cppflags="-DNO_ASM"
+ cc_long_cflags=$cc_cflags
+ cclist_longlong=$cclist
+ gcc_longlong_cflags=$gcc_cflags
+ gcc_longlong_cppflags="-DNO_ASM"
+ cc_longlong_cflags=$cc_cflags
+ limb_longlong=longlong
;;
esac
@@ -5453,7 +4229,9 @@ if test -n "$ABI"; then
if test $abi = "$ABI"; then found=yes; break; fi
done
if test $found = no; then
- as_fn_error $? "ABI=$ABI is not among the following valid choices: $abilist" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: ABI=$ABI is not among the following valid choices: $abilist" >&5
+echo "$as_me: error: ABI=$ABI is not among the following valid choices: $abilist" >&2;}
+ { (exit 1); exit 1; }; }
fi
abilist="$ABI"
fi
@@ -5543,16 +4321,16 @@ for abi in $abilist; do
#endif
EOF
gmp_compile="$cc -c conftest.c >&5"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
rm -f conftest*
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $cc is gcc" >&5
-$as_echo_n "checking whether $cc is gcc... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+ { echo "$as_me:$LINENO: checking whether $cc is gcc" >&5
+echo $ECHO_N "checking whether $cc is gcc... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
ccbase=gcc
else
rm -f conftest*
@@ -5565,15 +4343,15 @@ fi
# then change $ccbase and make the default xlc flags available.
if test $ccbase != xlc; then
gmp_command="$cc 2>&1 | grep xlc >/dev/null"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_command\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_command\"") >&5
(eval $gmp_command) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $cc is xlc" >&5
-$as_echo_n "checking whether $cc is xlc... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ { echo "$as_me:$LINENO: checking whether $cc is xlc" >&5
+echo $ECHO_N "checking whether $cc is xlc... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
ccbase=xlc
else
:
@@ -5605,10 +4383,10 @@ fi
cflags="$cflags_maybe $cflags"
fi
- # Any user CFLAGS, even an empty string, takes precedence
+ # Any user CFLAGS, even an empty string, takes precendence
if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi
- # Any user CPPFLAGS, even an empty string, takes precedence
+ # Any user CPPFLAGS, even an empty string, takes precendence
eval cppflags=\"\$${ccbase}${abi1}_cppflags\"
test -n "$cppflags" || eval cppflags=\"\$${ccbase}${abi2}_cppflags\"
if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi
@@ -5622,8 +4400,8 @@ fi
instrument) cflags="$cflags -finstrument-functions" ;;
esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags $cppflags" >&5
-$as_echo_n "checking compiler $cc $cflags $cppflags... " >&6; }
+ { echo "$as_me:$LINENO: checking compiler $cc $cflags $cppflags" >&5
+echo $ECHO_N "checking compiler $cc $cflags $cppflags... $ECHO_C" >&6; }
gmp_prog_cc_works=yes
# first see a simple "main()" works, then go on to other checks
@@ -5636,19 +4414,19 @@ int main () { return 0; }
EOF
echo "Test compile: " >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -5690,19 +4468,19 @@ int main () { return 0; }
EOF
echo "Test compile: function pointer return" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -5746,19 +4524,19 @@ int main () { return 0; }
EOF
echo "Test compile: cmov instruction" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -5803,19 +4581,19 @@ int main () { return 0; }
EOF
echo "Test compile: double -> ulong conversion" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -5858,19 +4636,19 @@ int main () { return 0; }
EOF
echo "Test compile: double negation" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -5914,19 +4692,19 @@ int main () { return 0; }
EOF
echo "Test compile: double -> float conversion" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -5999,19 +4777,19 @@ int main () { return 0; }
EOF
echo "Test compile: gnupro alpha ev6 char spilling" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6050,19 +4828,19 @@ int k; int foo () { __builtin_alloca (k); }
EOF
echo "Test compile: __builtin_alloca availability" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6096,19 +4874,19 @@ int main () { return 0; }
EOF
echo "Test compile: alloca array" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6174,19 +4952,19 @@ int main () { return 0; }
EOF
echo "Test compile: abs int -> double conversion" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6238,19 +5016,19 @@ int main () { return 0; }
EOF
echo "Test compile: long long reliability test 1" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6298,19 +5076,19 @@ int main () { return 0; }
EOF
echo "Test compile: long long reliability test 2" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6397,19 +5175,19 @@ main ()
EOF
echo "Test compile: mpn_lshift_com optimization" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6442,7 +5220,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 partial garbage to
+ "icc -O3", After several calls, the function writes parial 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. */
@@ -6505,19 +5283,19 @@ main ()
EOF
echo "Test compile: mpn_lshift_com optimization 2" >&5
gmp_compile="$cc $cflags $cppflags conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -6551,7 +5329,7 @@ fi
#
if test "$gmp_prog_cc_works" = yes; then
case $host in
- i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*)
+ i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-*)
# this problem only arises in PIC code, so don't need to test when
# --disable-shared. We don't necessarily have $enable_shared set to
# yes at this point, it will still be unset for the default (which is
@@ -6564,11 +5342,11 @@ int bar () { return foo; }
EOF
tmp_got_emitted=no
gmp_compile="$cc $cflags $cppflags -fPIC -S conftest.c >&5 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if grep "addl.*_GLOBAL_OFFSET_TABLE_.*eax" conftest.s >/dev/null; then
tmp_got_emitted=yes
fi
@@ -6638,11 +5416,11 @@ cat >conftest.s <<\EOF
EOF
tmp_got_good=yes
gmp_compile="$cc $cflags $cppflags -fPIC -o conftest.o -c conftest.s >&5 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
tmp_got_good=`od -b conftest.o | $AWK -f conftest.awk`
fi
rm -f conftest.*
@@ -6662,8 +5440,8 @@ fi
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_prog_cc_works" >&5
-$as_echo "$gmp_prog_cc_works" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_prog_cc_works" >&5
+echo "${ECHO_T}$gmp_prog_cc_works" >&6; }
case $gmp_prog_cc_works in
yes)
@@ -6679,8 +5457,8 @@ esac
eval limb_chosen=\"\$limb$abi1\"
test -n "$limb_chosen" || eval limb_chosen=\"\$limb$abi2\"
if test "$limb_chosen" = longlong; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags $cppflags has long long" >&5
-$as_echo_n "checking compiler $cc $cflags $cppflags has long long... " >&6; }
+ { echo "$as_me:$LINENO: checking compiler $cc $cflags $cppflags has long long" >&5
+echo $ECHO_N "checking compiler $cc $cflags $cppflags has long long... $ECHO_C" >&6; }
cat >conftest.c <<EOF
long long foo;
long long bar () { return foo; }
@@ -6688,19 +5466,19 @@ int main () { return 0; }
EOF
gmp_prog_cc_works=no
gmp_compile="$cc $cflags $cppflags -c conftest.c >&5"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
gmp_prog_cc_works=yes
else
echo "failed program was:" >&5
cat conftest.c >&5
fi
rm -f conftest* a.out b.out a.exe a_out.exe
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_prog_cc_works" >&5
-$as_echo "$gmp_prog_cc_works" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_prog_cc_works" >&5
+echo "${ECHO_T}$gmp_prog_cc_works" >&6; }
if test $gmp_prog_cc_works = yes; then
:
else
@@ -6718,8 +5496,8 @@ fi
testlist_pass=yes
for tst in $testlist; do
case $tst in
- hpc-hppa-2-0) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether HP compiler $cc is good for 64-bits" >&5
-$as_echo_n "checking whether HP compiler $cc is good for 64-bits... " >&6; }
+ hpc-hppa-2-0) { echo "$as_me:$LINENO: checking whether HP compiler $cc is good for 64-bits" >&5
+echo $ECHO_N "checking whether HP compiler $cc is good for 64-bits... $ECHO_C" >&6; }
# Bad compiler output:
# ccom: HP92453-01 G.10.32.05 HP C Compiler
# Good compiler output:
@@ -6762,16 +5540,16 @@ fi
gmp_hpc_64bit=$gmp_compare_ge
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_hpc_64bit" >&5
-$as_echo "$gmp_hpc_64bit" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_hpc_64bit" >&5
+echo "${ECHO_T}$gmp_hpc_64bit" >&6; }
if test $gmp_hpc_64bit = yes; then
:
else
testlist_pass=no
fi
;;
- gcc-arm-umodsi) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ARM gcc unsigned division works" >&5
-$as_echo_n "checking whether ARM gcc unsigned division works... " >&6; }
+ gcc-arm-umodsi) { echo "$as_me:$LINENO: checking whether ARM gcc unsigned division works" >&5
+echo $ECHO_N "checking whether ARM gcc unsigned division works... $ECHO_C" >&6; }
tmp_version=`$cc --version`
echo "$tmp_version" >&5
case $tmp_version in
@@ -6782,11 +5560,11 @@ case $tmp_version in
:
gmp_gcc_arm_umodsi_result=yes ;;
esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_gcc_arm_umodsi_result" >&5
-$as_echo "$gmp_gcc_arm_umodsi_result" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_gcc_arm_umodsi_result" >&5
+echo "${ECHO_T}$gmp_gcc_arm_umodsi_result" >&6; }
;;
- gcc-mips-o32) { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc supports o32" >&5
-$as_echo_n "checking whether gcc supports o32... " >&6; }
+ gcc-mips-o32) { echo "$as_me:$LINENO: checking whether gcc supports o32" >&5
+echo $ECHO_N "checking whether gcc supports o32... $ECHO_C" >&6; }
echo 'int x;' >conftest.c
echo "$cc -mabi=32 -c conftest.c" >&5
if $cc -mabi=32 -c conftest.c >conftest.out 2>&1; then
@@ -6800,34 +5578,34 @@ else
fi
fi
rm -f conftest.*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
-$as_echo "$result" >&6; }
+{ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
if test $result = yes; then
:
else
testlist_pass=no
fi
;;
- hppa-level-2.0) { $as_echo "$as_me:${as_lineno-$LINENO}: checking $cc $cflags assembler knows hppa 2.0" >&5
-$as_echo_n "checking $cc $cflags assembler knows hppa 2.0... " >&6; }
+ hppa-level-2.0) { echo "$as_me:$LINENO: checking $cc $cflags assembler knows hppa 2.0" >&5
+echo $ECHO_N "checking $cc $cflags assembler knows hppa 2.0... $ECHO_C" >&6; }
result=no
cat >conftest.s <<EOF
.level 2.0
EOF
gmp_compile="$cc $cflags -c conftest.s >&5 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
result=yes
else
echo "failed program was" >&5
cat conftest.s >&5
fi
rm -f conftest*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
-$as_echo "$result" >&6; }
+{ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
if test "$result" = yes; then
:
else
@@ -6837,8 +5615,8 @@ fi
sizeof*) echo "configure: testlist $tst" >&5
gmp_sizeof_type=`echo "$tst" | sed 's/sizeof-\([a-z]*\).*/\1/'`
gmp_sizeof_want=`echo "$tst" | sed 's/sizeof-[a-z]*-\([0-9]*\).*/\1/'`
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want" >&5
-$as_echo_n "checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want... " >&6; }
+{ echo "$as_me:$LINENO: checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want" >&5
+echo $ECHO_N "checking compiler $cc $cflags has sizeof($gmp_sizeof_type)==$gmp_sizeof_want... $ECHO_C" >&6; }
cat >conftest.c <<EOF
int
main ()
@@ -6850,16 +5628,16 @@ main ()
EOF
gmp_c_testlist_sizeof=no
gmp_compile="$cc $cflags -c conftest.c >&5"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
gmp_c_testlist_sizeof=yes
fi
rm -f conftest*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_c_testlist_sizeof" >&5
-$as_echo "$gmp_c_testlist_sizeof" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_c_testlist_sizeof" >&5
+echo "${ECHO_T}$gmp_c_testlist_sizeof" >&6; }
if test $gmp_c_testlist_sizeof = yes; then
:
else
@@ -6900,55 +5678,11 @@ done
# C on MS-DOS systems).
#
if test $found_compiler = no && test -n "$path"; then
- as_fn_error $? "could not find a working compiler, see config.log for details" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: could not find a working compiler, see config.log for details" >&5
+echo "$as_me: error: could not find a working compiler, see config.log for details" >&2;}
+ { (exit 1); exit 1; }; }
fi
-case $host in
- 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 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
- redc_2 rshift sqr_basecase sub_n submul_1"
-
- if test "$abi" = 32; then
- extra_functions="$extra_functions fat fat_entry"
- path="x86/fat x86"
- fat_path="x86 x86/fat x86/i486
- x86/k6 x86/k6/mmx x86/k6/k62mmx
- x86/k7 x86/k7/mmx
- x86/k8 x86/k10 x86/bobcat
- x86/pentium x86/pentium/mmx
- x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
- x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2
- x86/core2 x86/coreinhm x86/coreisbr
- x86/atom x86/atom/mmx x86/atom/sse2 x86/nano"
- fi
-
- if test "$abi" = 64; then
- gcc_64_cflags=""
- extra_functions_64="$extra_functions_64 fat fat_entry"
- path_64="x86_64/fat x86_64"
- fat_path="x86_64 x86_64/fat
- x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bobcat
- x86_64/pentium4 x86_64/core2 x86_64/coreinhm x86_64/coreisbr
- x86_64/coreihwl x86_64/atom x86_64/nano"
- fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
- fi
-
- fat_thresholds="MUL_TOOM22_THRESHOLD MUL_TOOM33_THRESHOLD
- SQR_TOOM2_THRESHOLD SQR_TOOM3_THRESHOLD
- BMOD_1_TO_MOD_1_THRESHOLD"
- fi
- ;;
-esac
-
if test $found_compiler = yes; then
@@ -6983,24 +5717,24 @@ if test $found_compiler = yes; then
# pentium4 case.
#
if test "$abi" = 32; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc is good for sse2" >&5
-$as_echo_n "checking whether gcc is good for sse2... " >&6; }
+ { echo "$as_me:$LINENO: checking whether gcc is good for sse2" >&5
+echo $ECHO_N "checking whether gcc is good for sse2... $ECHO_C" >&6; }
case `$cc $cflags $cppflags -dumpversion` in
3.[012] | 3.[012].*) result=no ;;
*) result=yes ;;
esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
-$as_echo "$result" >&6; }
+{ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
if test "$result" = yes; then
:
else
continue
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the operating system supports XMM registers" >&5
-$as_echo_n "checking whether the operating system supports XMM registers... " >&6; }
-if ${gmp_cv_os_x86_xmm+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking whether the operating system supports XMM registers" >&5
+echo $ECHO_N "checking whether the operating system supports XMM registers... $ECHO_C" >&6; }
+if test "${gmp_cv_os_x86_xmm+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$build" = "$host"; then
# remove anything that might look like compiler output to our "||" expression
@@ -7016,24 +5750,24 @@ _main:
ret
EOF
gmp_compile="$cc $cflags $cppflags conftest.s -o conftest >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
gmp_cv_os_x86_xmm=yes
else
gmp_cv_os_x86_xmm=no
fi
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Oops, cannot compile test program" >&5
-$as_echo "$as_me: WARNING: Oops, cannot compile test program" >&2;}
+ { echo "$as_me:$LINENO: WARNING: Oops, cannot compile test program" >&5
+echo "$as_me: WARNING: Oops, cannot compile test program" >&2;}
fi
rm -f conftest*
fi
@@ -7050,14 +5784,14 @@ if test -z "$gmp_cv_os_x86_xmm"; then
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_os_x86_xmm" >&5
-$as_echo "$gmp_cv_os_x86_xmm" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_os_x86_xmm" >&5
+echo "${ECHO_T}$gmp_cv_os_x86_xmm" >&6; }
if test "$gmp_cv_os_x86_xmm" = probably; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Not certain of OS support for xmm when cross compiling." >&5
-$as_echo "$as_me: WARNING: Not certain of OS support for xmm when cross compiling." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&5
-$as_echo "$as_me: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&2;}
+ { echo "$as_me:$LINENO: WARNING: Not certain of OS support for xmm when cross compiling." >&5
+echo "$as_me: WARNING: Not certain of OS support for xmm when cross compiling." >&2;}
+ { echo "$as_me:$LINENO: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&5
+echo "$as_me: WARNING: Will assume it's ok, expect a SIGILL if this is wrong." >&2;}
fi
case $gmp_cv_os_x86_xmm in
@@ -7074,18 +5808,18 @@ esac
-no-cpp-precomp)
# special check, avoiding a warning
if test "$ccbase" = gcc; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags -no-cpp-precomp" >&5
-$as_echo_n "checking compiler $cc $cflags -no-cpp-precomp... " >&6; }
+ { echo "$as_me:$LINENO: checking compiler $cc $cflags -no-cpp-precomp" >&5
+echo $ECHO_N "checking compiler $cc $cflags -no-cpp-precomp... $ECHO_C" >&6; }
result=no
cat >conftest.c <<EOF
int main () { return 0; }
EOF
gmp_compile="$cc $cflags -no-cpp-precomp conftest.c >conftest.out 2>&1"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if grep "unrecognized option.*-no-cpp-precomp" conftest.out >/dev/null; then : ;
else
result=yes
@@ -7093,8 +5827,8 @@ EOF
fi
cat conftest.out >&5
rm -f conftest* a.out b.out a.exe a_out.exe
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
-$as_echo "$result" >&6; }
+ { echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
if test "$result" = yes; then
cflags="$cflags $flag"
break
@@ -7107,18 +5841,18 @@ fi
-Wa,-m*)
case $host in
alpha*-*-*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler $cc $cflags $flag" >&5
-$as_echo_n "checking assembler $cc $cflags $flag... " >&6; }
+ { echo "$as_me:$LINENO: checking assembler $cc $cflags $flag" >&5
+echo $ECHO_N "checking assembler $cc $cflags $flag... $ECHO_C" >&6; }
result=no
cat >conftest.c <<EOF
int main () {}
EOF
gmp_compile="$cc $cflags $flag -c conftest.c >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if grep "Unknown CPU identifier" conftest.out >/dev/null; then : ;
else
result=yes
@@ -7126,8 +5860,8 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
fi
cat conftest.out >&5
rm -f conftest*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
-$as_echo "$result" >&6; }
+{ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
if test "$result" = yes; then
:
else
@@ -7138,33 +5872,33 @@ fi
esac
;;
-Wa,-oldas)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $cc $cflags $cppflags -Wa,-oldas" >&5
-$as_echo_n "checking for $cc $cflags $cppflags -Wa,-oldas... " >&6; }
+ { echo "$as_me:$LINENO: checking for $cc $cflags $cppflags -Wa,-oldas" >&5
+echo $ECHO_N "checking for $cc $cflags $cppflags -Wa,-oldas... $ECHO_C" >&6; }
result=no
cat >conftest.c <<EOF
EOF
echo "with empty conftest.c" >&5
gmp_compile="$cc $cflags $cppflags -c conftest.c >&5 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then : ;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then : ;
else
# empty fails
gmp_compile="$cc $cflags $cppflags -Wa,-oldas -c conftest.c >&5 2>&1"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
# but with -Wa,-oldas it works
result=yes
fi
fi
rm -f conftest*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $result" >&5
-$as_echo "$result" >&6; }
+{ echo "$as_me:$LINENO: result: $result" >&5
+echo "${ECHO_T}$result" >&6; }
if test "$result" = yes; then
cflags="$cflags $flag"
break
@@ -7175,8 +5909,8 @@ fi
;;
esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking compiler $cc $cflags $cppflags $flag" >&5
-$as_echo_n "checking compiler $cc $cflags $cppflags $flag... " >&6; }
+ { echo "$as_me:$LINENO: checking compiler $cc $cflags $cppflags $flag" >&5
+echo $ECHO_N "checking compiler $cc $cflags $cppflags $flag... $ECHO_C" >&6; }
gmp_prog_cc_works=yes
# first see a simple "main()" works, then go on to other checks
@@ -7189,19 +5923,19 @@ int main () { return 0; }
EOF
echo "Test compile: " >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7243,19 +5977,19 @@ int main () { return 0; }
EOF
echo "Test compile: function pointer return" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7299,19 +6033,19 @@ int main () { return 0; }
EOF
echo "Test compile: cmov instruction" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7356,19 +6090,19 @@ int main () { return 0; }
EOF
echo "Test compile: double -> ulong conversion" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7411,19 +6145,19 @@ int main () { return 0; }
EOF
echo "Test compile: double negation" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7467,19 +6201,19 @@ int main () { return 0; }
EOF
echo "Test compile: double -> float conversion" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7552,19 +6286,19 @@ int main () { return 0; }
EOF
echo "Test compile: gnupro alpha ev6 char spilling" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7603,19 +6337,19 @@ int k; int foo () { __builtin_alloca (k); }
EOF
echo "Test compile: __builtin_alloca availability" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7649,19 +6383,19 @@ int main () { return 0; }
EOF
echo "Test compile: alloca array" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7727,19 +6461,19 @@ int main () { return 0; }
EOF
echo "Test compile: abs int -> double conversion" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7791,19 +6525,19 @@ int main () { return 0; }
EOF
echo "Test compile: long long reliability test 1" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7851,19 +6585,19 @@ int main () { return 0; }
EOF
echo "Test compile: long long reliability test 2" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7950,19 +6684,19 @@ main ()
EOF
echo "Test compile: mpn_lshift_com optimization" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -7995,7 +6729,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 partial garbage to
+ "icc -O3", After several calls, the function writes parial 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. */
@@ -8058,19 +6792,19 @@ main ()
EOF
echo "Test compile: mpn_lshift_com optimization 2" >&5
gmp_compile="$cc $cflags $cppflags $flag conftest.c >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cc_works_part=yes
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
cc_works_part=norun
fi
@@ -8104,7 +6838,7 @@ fi
#
if test "$gmp_prog_cc_works" = yes; then
case $host in
- i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-*)
+ i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-*)
# this problem only arises in PIC code, so don't need to test when
# --disable-shared. We don't necessarily have $enable_shared set to
# yes at this point, it will still be unset for the default (which is
@@ -8117,11 +6851,11 @@ int bar () { return foo; }
EOF
tmp_got_emitted=no
gmp_compile="$cc $cflags $cppflags $flag -fPIC -S conftest.c >&5 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if grep "addl.*_GLOBAL_OFFSET_TABLE_.*eax" conftest.s >/dev/null; then
tmp_got_emitted=yes
fi
@@ -8191,11 +6925,11 @@ cat >conftest.s <<\EOF
EOF
tmp_got_good=yes
gmp_compile="$cc $cflags $cppflags $flag -fPIC -o conftest.o -c conftest.s >&5 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
tmp_got_good=`od -b conftest.o | $AWK -f conftest.awk`
fi
rm -f conftest.*
@@ -8215,8 +6949,8 @@ fi
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_prog_cc_works" >&5
-$as_echo "$gmp_prog_cc_works" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_prog_cc_works" >&5
+echo "${ECHO_T}$gmp_prog_cc_works" >&6; }
case $gmp_prog_cc_works in
yes)
cflags="$cflags $flag"
@@ -8235,7 +6969,7 @@ esac
CC="$cc"
CFLAGS="$cflags"
CPPFLAGS="$cppflags"
- eval GMP_NONSTD_ABI=\"\$GMP_NONSTD_ABI_$ABI\"
+
# Could easily have this in config.h too, if desired.
ABI_nodots=`echo $ABI | sed 's/\./_/'`
@@ -8283,15 +7017,13 @@ _ACEOF
#
eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi1\"
test -n "$tmp" || eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi2\"
- if test "$enable_assembly" = "yes"; then
- CALLING_CONVENTIONS_OBJS="$tmp"
- else
- CALLING_CONVENTIONS_OBJS=""
- fi
+ CALLING_CONVENTIONS_OBJS="$tmp"
if test -n "$CALLING_CONVENTIONS_OBJS"; then
-$as_echo "#define HAVE_CALLING_CONVENTIONS 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_CALLING_CONVENTIONS 1
+_ACEOF
fi
@@ -8328,10 +7060,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}gcc", so it can be a program name with args.
set dummy ${ac_tool_prefix}gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -8341,25 +7073,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}gcc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -8368,10 +7100,10 @@ if test -z "$ac_cv_prog_CC"; then
ac_ct_CC=$CC
# Extract the first word of "gcc", so it can be a program name with args.
set dummy gcc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -8381,25 +7113,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="gcc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_CC" = x; then
@@ -8407,8 +7139,12 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
@@ -8421,10 +7157,10 @@ if test -z "$CC"; then
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}cc", so it can be a program name with args.
set dummy ${ac_tool_prefix}cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -8434,25 +7170,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="${ac_tool_prefix}cc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -8461,10 +7197,10 @@ fi
if test -z "$CC"; then
# Extract the first word of "cc", so it can be a program name with args.
set dummy cc; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -8475,18 +7211,18 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
if test "$as_dir/$ac_word$ac_exec_ext" = "/usr/ucb/cc"; then
ac_prog_rejected=yes
continue
fi
ac_cv_prog_CC="cc"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
if test $ac_prog_rejected = yes; then
@@ -8505,11 +7241,11 @@ fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -8520,10 +7256,10 @@ if test -z "$CC"; then
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CC+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CC"; then
ac_cv_prog_CC="$CC" # Let the user override the test.
@@ -8533,25 +7269,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CC="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
CC=$ac_cv_prog_CC
if test -n "$CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CC" >&5
-$as_echo "$CC" >&6; }
+ { echo "$as_me:$LINENO: result: $CC" >&5
+echo "${ECHO_T}$CC" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -8564,10 +7300,10 @@ if test -z "$CC"; then
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CC+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CC"; then
ac_cv_prog_ac_ct_CC="$ac_ct_CC" # Let the user override the test.
@@ -8577,25 +7313,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CC="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
ac_ct_CC=$ac_cv_prog_ac_ct_CC
if test -n "$ac_ct_CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CC" >&5
-$as_echo "$ac_ct_CC" >&6; }
+ { echo "$as_me:$LINENO: result: $ac_ct_CC" >&5
+echo "${ECHO_T}$ac_ct_CC" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -8607,8 +7343,12 @@ done
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
CC=$ac_ct_CC
@@ -8618,37 +7358,51 @@ fi
fi
-test -z "$CC" && { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "no acceptable C compiler found in \$PATH
-See \`config.log' for more details" "$LINENO" 5; }
+test -z "$CC" && { { echo "$as_me:$LINENO: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&5
+echo "$as_me: error: no acceptable C compiler found in \$PATH
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
- { { ac_try="$ac_compiler $ac_option >&5"
+echo "$as_me:$LINENO: checking for C compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
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_compiler $ac_option >&5") 2>conftest.err
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
- if test -s conftest.err; then
- sed '10a\
-... rest of stderr output deleted ...
- 10q' conftest.err >conftest.er1
- cat conftest.er1 >&5
- fi
- rm -f conftest.er1 conftest.err
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
-done
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -8660,38 +7414,42 @@ main ()
}
_ACEOF
ac_clean_files_save=$ac_clean_files
-ac_clean_files="$ac_clean_files a.out a.out.dSYM a.exe b.out"
+ac_clean_files="$ac_clean_files a.out a.exe b.out"
# Try to create an executable without -o first, disregard a.out.
# It will help us diagnose broken compilers, and finding out an intuition
# of exeext.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler works" >&5
-$as_echo_n "checking whether the C compiler works... " >&6; }
-ac_link_default=`$as_echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
-
-# The possible output files:
-ac_files="a.out conftest.exe conftest a.exe a_out.exe b.out conftest.*"
-
+{ echo "$as_me:$LINENO: checking for C compiler default output file name" >&5
+echo $ECHO_N "checking for C compiler default output file name... $ECHO_C" >&6; }
+ac_link_default=`echo "$ac_link" | sed 's/ -o *conftest[^ ]*//'`
+#
+# List of possible output files, starting from the most likely.
+# The algorithm is not robust to junk in `.', hence go to wildcards (a.*)
+# only as a last resort. b.out is created by i960 compilers.
+ac_files='a_out.exe a.exe conftest.exe a.out conftest a.* conftest.* b.out'
+#
+# The IRIX 6 linker writes into existing files which may not be
+# executable, retaining their permissions. Remove them first so a
+# subsequent execution test works.
ac_rmfiles=
for ac_file in $ac_files
do
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
* ) ac_rmfiles="$ac_rmfiles $ac_file";;
esac
done
rm -f $ac_rmfiles
-if { { ac_try="$ac_link_default"
+if { (ac_try="$ac_link_default"
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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link_default") 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
# Autoconf-2.13 could set the ac_cv_exeext variable to `no'.
# So ignore a value of `no', otherwise this would lead to `EXEEXT = no'
# in a Makefile. We should not override ac_cv_exeext if it was cached,
@@ -8701,14 +7459,14 @@ for ac_file in $ac_files ''
do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj )
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj )
;;
[ab].out )
# We found the default executable, but exeext='' is most
# certainly right.
break;;
*.* )
- if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
+ if test "${ac_cv_exeext+set}" = set && test "$ac_cv_exeext" != no;
then :; else
ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
fi
@@ -8727,41 +7485,78 @@ test "$ac_cv_exeext" = no && ac_cv_exeext=
else
ac_file=''
fi
-if test -z "$ac_file"; then :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-$as_echo "$as_me: failed program was:" >&5
+
+{ echo "$as_me:$LINENO: result: $ac_file" >&5
+echo "${ECHO_T}$ac_file" >&6; }
+if test -z "$ac_file"; then
+ echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "C compiler cannot create executables
-See \`config.log' for more details" "$LINENO" 5; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
+{ { echo "$as_me:$LINENO: error: C compiler cannot create executables
+See \`config.log' for more details." >&5
+echo "$as_me: error: C compiler cannot create executables
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C compiler default output file name" >&5
-$as_echo_n "checking for C compiler default output file name... " >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_file" >&5
-$as_echo "$ac_file" >&6; }
+
ac_exeext=$ac_cv_exeext
-rm -f -r a.out a.out.dSYM a.exe conftest$ac_cv_exeext b.out
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether the C compiler works" >&5
+echo $ECHO_N "checking whether the C compiler works... $ECHO_C" >&6; }
+# FIXME: These cross compiler hacks should be removed for Autoconf 3.0
+# If not cross compiling, check that we can run a simple program.
+if test "$cross_compiling" != yes; then
+ if { ac_try='./$ac_file'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ cross_compiling=no
+ else
+ if test "$cross_compiling" = maybe; then
+ cross_compiling=yes
+ else
+ { { echo "$as_me:$LINENO: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot run C compiled programs.
+If you meant to cross compile, use \`--host'.
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+ fi
+fi
+{ echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+rm -f a.out a.exe conftest$ac_cv_exeext b.out
ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of executables" >&5
-$as_echo_n "checking for suffix of executables... " >&6; }
-if { { ac_try="$ac_link"
+# Check that the compiler produces executables we can run. If not, either
+# the compiler is broken, or we cross compile.
+{ echo "$as_me:$LINENO: checking whether we are cross compiling" >&5
+echo $ECHO_N "checking whether we are cross compiling... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $cross_compiling" >&5
+echo "${ECHO_T}$cross_compiling" >&6; }
+
+{ echo "$as_me:$LINENO: checking for suffix of executables" >&5
+echo $ECHO_N "checking for suffix of executables... $ECHO_C" >&6; }
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_link") 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
# If both `conftest.exe' and `conftest' are `present' (well, observable)
# catch `conftest.exe'. For instance with Cygwin, `ls conftest' will
# work properly (i.e., refer to `conftest.exe'), while it won't with
@@ -8769,90 +7564,37 @@ $as_echo "$ac_try_echo"; } >&5
for ac_file in conftest.exe conftest conftest.*; do
test -f "$ac_file" || continue
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM | *.o | *.obj ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.o | *.obj ) ;;
*.* ) ac_cv_exeext=`expr "$ac_file" : '[^.]*\(\..*\)'`
break;;
* ) break;;
esac
done
else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of executables: cannot compile and link
-See \`config.log' for more details" "$LINENO" 5; }
+ { { echo "$as_me:$LINENO: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of executables: cannot compile and link
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
-rm -f conftest conftest$ac_cv_exeext
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_exeext" >&5
-$as_echo "$ac_cv_exeext" >&6; }
+
+rm -f conftest$ac_cv_exeext
+{ echo "$as_me:$LINENO: result: $ac_cv_exeext" >&5
+echo "${ECHO_T}$ac_cv_exeext" >&6; }
rm -f conftest.$ac_ext
EXEEXT=$ac_cv_exeext
ac_exeext=$EXEEXT
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdio.h>
-int
-main ()
-{
-FILE *f = fopen ("conftest.out", "w");
- return ferror (f) || fclose (f) != 0;
-
- ;
- return 0;
-}
-_ACEOF
-ac_clean_files="$ac_clean_files conftest.out"
-# Check that the compiler produces executables we can run. If not, either
-# the compiler is broken, or we cross compile.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are cross compiling" >&5
-$as_echo_n "checking whether we are cross compiling... " >&6; }
-if test "$cross_compiling" != yes; then
- { { 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>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
- if { ac_try='./conftest$ac_cv_exeext'
- { { 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_try") 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then
- cross_compiling=no
- else
- if test "$cross_compiling" = maybe; then
- cross_compiling=yes
- else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot run C compiled programs.
-If you meant to cross compile, use \`--host'.
-See \`config.log' for more details" "$LINENO" 5; }
- fi
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cross_compiling" >&5
-$as_echo "$cross_compiling" >&6; }
-
-rm -f conftest.$ac_ext conftest$ac_cv_exeext conftest.out
-ac_clean_files=$ac_clean_files_save
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suffix of object files" >&5
-$as_echo_n "checking for suffix of object files... " >&6; }
-if ${ac_cv_objext+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for suffix of object files" >&5
+echo $ECHO_N "checking for suffix of object files... $ECHO_C" >&6; }
+if test "${ac_cv_objext+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -8864,46 +7606,51 @@ main ()
}
_ACEOF
rm -f conftest.o conftest.obj
-if { { ac_try="$ac_compile"
+if { (ac_try="$ac_compile"
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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$ac_compile") 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then :
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
for ac_file in conftest.o conftest.obj conftest.*; do
test -f "$ac_file" || continue;
case $ac_file in
- *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf | *.dSYM ) ;;
+ *.$ac_ext | *.xcoff | *.tds | *.d | *.pdb | *.xSYM | *.bb | *.bbg | *.map | *.inf ) ;;
*) ac_cv_objext=`expr "$ac_file" : '.*\.\(.*\)'`
break;;
esac
done
else
- $as_echo "$as_me: failed program was:" >&5
+ echo "$as_me: failed program was:" >&5
sed 's/^/| /' conftest.$ac_ext >&5
-{ { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "cannot compute suffix of object files: cannot compile
-See \`config.log' for more details" "$LINENO" 5; }
+{ { echo "$as_me:$LINENO: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute suffix of object files: cannot compile
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
+
rm -f conftest.$ac_cv_objext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_objext" >&5
-$as_echo "$ac_cv_objext" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_objext" >&5
+echo "${ECHO_T}$ac_cv_objext" >&6; }
OBJEXT=$ac_cv_objext
ac_objext=$OBJEXT
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C compiler" >&5
-$as_echo_n "checking whether we are using the GNU C compiler... " >&6; }
-if ${ac_cv_c_compiler_gnu+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C compiler... $ECHO_C" >&6; }
+if test "${ac_cv_c_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -8917,34 +7664,54 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_compiler_gnu=yes
else
- ac_compiler_gnu=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_c_compiler_gnu=$ac_compiler_gnu
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_compiler_gnu" >&5
-$as_echo "$ac_cv_c_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
- GCC=yes
-else
- GCC=
-fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_c_compiler_gnu" >&6; }
+GCC=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CFLAGS=${CFLAGS+set}
ac_save_CFLAGS=$CFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CC accepts -g" >&5
-$as_echo_n "checking whether $CC accepts -g... " >&6; }
-if ${ac_cv_prog_cc_g+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether $CC accepts -g" >&5
+echo $ECHO_N "checking whether $CC accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_save_c_werror_flag=$ac_c_werror_flag
ac_c_werror_flag=yes
ac_cv_prog_cc_g=no
CFLAGS="-g"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -8955,11 +7722,34 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_prog_cc_g=yes
else
- CFLAGS=""
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -8970,12 +7760,35 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
else
- ac_c_werror_flag=$ac_save_c_werror_flag
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_c_werror_flag=$ac_save_c_werror_flag
CFLAGS="-g"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -8986,18 +7799,42 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_prog_cc_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_c_werror_flag=$ac_save_c_werror_flag
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_g" >&5
-$as_echo "$ac_cv_prog_cc_g" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cc_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_g" >&6; }
if test "$ac_test_CFLAGS" = set; then
CFLAGS=$ac_save_CFLAGS
elif test $ac_cv_prog_cc_g = yes; then
@@ -9013,18 +7850,23 @@ else
CFLAGS=
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-struct stat;
+#include <sys/types.h>
+#include <sys/stat.h>
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -9076,9 +7918,31 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
- if ac_fn_c_try_compile "$LINENO"; then :
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
+
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
@@ -9089,19 +7953,17 @@ fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
xno)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
-fi
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -9109,18 +7971,20 @@ 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
- case $ac_cv_prog_cc_stdc in #(
- no) :
- ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;; #(
- *) :
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C99" >&5
-$as_echo_n "checking for $CC option to accept ISO C99... " >&6; }
-if ${ac_cv_prog_cc_c99+:} false; then :
- $as_echo_n "(cached) " >&6
+ case $ac_cv_prog_cc_stdc in
+ no) ac_cv_prog_cc_c99=no; ac_cv_prog_cc_c89=no ;;
+ *) { echo "$as_me:$LINENO: checking for $CC option to accept ISO C99" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C99... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c99+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_c99=no
ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdarg.h>
#include <stdbool.h>
@@ -9259,12 +8123,34 @@ main ()
return 0;
}
_ACEOF
-for ac_arg in '' -std=gnu99 -std=c99 -c99 -AC99 -D_STDC_C99= -qlanglvl=extc99
+for ac_arg in '' -std=gnu99 -c99 -qlanglvl=extc99
do
CC="$ac_save_CC $ac_arg"
- if ac_fn_c_try_compile "$LINENO"; then :
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_prog_cc_c99=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
+
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c99" != "xno" && break
done
@@ -9275,31 +8161,36 @@ fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c99" in
x)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
xno)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c99"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c99" >&5
-$as_echo "$ac_cv_prog_cc_c99" >&6; } ;;
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c99" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c99" >&6; } ;;
esac
-if test "x$ac_cv_prog_cc_c99" != xno; then :
+if test "x$ac_cv_prog_cc_c99" != xno; then
ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c99
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO C89" >&5
-$as_echo_n "checking for $CC option to accept ISO C89... " >&6; }
-if ${ac_cv_prog_cc_c89+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for $CC option to accept ISO C89" >&5
+echo $ECHO_N "checking for $CC option to accept ISO C89... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cc_c89+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_prog_cc_c89=no
ac_save_CC=$CC
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdarg.h>
#include <stdio.h>
-struct stat;
+#include <sys/types.h>
+#include <sys/stat.h>
/* Most of the following tests are stolen from RCS 5.7's src/conf.sh. */
struct buf { int x; };
FILE * (*rcsopen) (struct buf *, struct stat *, int);
@@ -9351,9 +8242,31 @@ for ac_arg in '' -qlanglvl=extc89 -qlanglvl=ansi -std \
-Ae "-Aa -D_HPUX_SOURCE" "-Xc -D__EXTENSIONS__"
do
CC="$ac_save_CC $ac_arg"
- if ac_fn_c_try_compile "$LINENO"; then :
+ rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_prog_cc_c89=$ac_arg
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
+
rm -f core conftest.err conftest.$ac_objext
test "x$ac_cv_prog_cc_c89" != "xno" && break
done
@@ -9364,57 +8277,57 @@ fi
# AC_CACHE_VAL
case "x$ac_cv_prog_cc_c89" in
x)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;;
+ { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
xno)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;;
+ { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
*)
CC="$CC $ac_cv_prog_cc_c89"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_c89" >&5
-$as_echo "$ac_cv_prog_cc_c89" >&6; } ;;
+ { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_c89" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_c89" >&6; } ;;
esac
-if test "x$ac_cv_prog_cc_c89" != xno; then :
+if test "x$ac_cv_prog_cc_c89" != xno; then
ac_cv_prog_cc_stdc=$ac_cv_prog_cc_c89
else
ac_cv_prog_cc_stdc=no
fi
+
fi
+
;;
esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for $CC option to accept ISO Standard C" >&5
-$as_echo_n "checking for $CC option to accept ISO Standard C... " >&6; }
- if ${ac_cv_prog_cc_stdc+:} false; then :
- $as_echo_n "(cached) " >&6
-fi
-
- case $ac_cv_prog_cc_stdc in #(
- no) :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: unsupported" >&5
-$as_echo "unsupported" >&6; } ;; #(
- '') :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none needed" >&5
-$as_echo "none needed" >&6; } ;; #(
- *) :
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cc_stdc" >&5
-$as_echo "$ac_cv_prog_cc_stdc" >&6; } ;;
+ { echo "$as_me:$LINENO: checking for $CC option to accept ISO Standard C" >&5
+echo $ECHO_N "checking for $CC option to accept ISO Standard C... $ECHO_C" >&6; }
+ if test "${ac_cv_prog_cc_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+
+ case $ac_cv_prog_cc_stdc in
+ no) { echo "$as_me:$LINENO: result: unsupported" >&5
+echo "${ECHO_T}unsupported" >&6; } ;;
+ '') { echo "$as_me:$LINENO: result: none needed" >&5
+echo "${ECHO_T}none needed" >&6; } ;;
+ *) { echo "$as_me:$LINENO: result: $ac_cv_prog_cc_stdc" >&5
+echo "${ECHO_T}$ac_cv_prog_cc_stdc" >&6; } ;;
esac
+
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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C preprocessor" >&5
-$as_echo_n "checking how to run the C preprocessor... " >&6; }
+{ echo "$as_me:$LINENO: checking how to run the C preprocessor" >&5
+echo $ECHO_N "checking how to run the C preprocessor... $ECHO_C" >&6; }
# On Suns, sometimes $CPP names a directory.
if test -n "$CPP" && test -d "$CPP"; then
CPP=
fi
if test -z "$CPP"; then
- if ${ac_cv_prog_CPP+:} false; then :
- $as_echo_n "(cached) " >&6
+ if test "${ac_cv_prog_CPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CPP needs to be expanded
for CPP in "$CC -E" "$CC -E -traditional-cpp" "/lib/cpp"
@@ -9428,7 +8341,11 @@ do
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
@@ -9437,34 +8354,76 @@ do
#endif
Syntax error
_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
# Broken: success on invalid input.
continue
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
break
fi
@@ -9476,8 +8435,8 @@ fi
else
ac_cv_prog_CPP=$CPP
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP" >&5
-$as_echo "$CPP" >&6; }
+{ echo "$as_me:$LINENO: result: $CPP" >&5
+echo "${ECHO_T}$CPP" >&6; }
ac_preproc_ok=false
for ac_c_preproc_warn_flag in '' yes
do
@@ -9487,7 +8446,11 @@ do
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
@@ -9496,40 +8459,83 @@ do
#endif
Syntax error
_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
-
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if ac_fn_c_try_cpp "$LINENO"; then :
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
# Broken: success on invalid input.
continue
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C preprocessor \"$CPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+ { { echo "$as_me:$LINENO: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C preprocessor \"$CPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
ac_ext=c
@@ -9540,11 +8546,72 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
+case $ac_cv_prog_cc_stdc in
+ no)
+ ;;
+ *)
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
+#define GMP_LIMB_BITS 123
+$DEFN_LONG_LONG_LIMB
+#include "$srcdir/gmp-h.in"
+
+#if ! __GMP_HAVE_PROTOTYPES
+die die die
+#endif
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: WARNING: gmp.h doesnt recognise compiler as ANSI, prototypes and \"const\" will be unavailable" >&5
+echo "$as_me: WARNING: gmp.h doesnt recognise compiler as ANSI, prototypes and \"const\" will be unavailable" >&2;}
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ ;;
+esac
+
+
+
# The C compiler on the build system, and associated tests.
if test -n "$CC_FOR_BUILD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system compiler $CC_FOR_BUILD" >&5
-$as_echo_n "checking build system compiler $CC_FOR_BUILD... " >&6; }
+ { echo "$as_me:$LINENO: checking build system compiler $CC_FOR_BUILD" >&5
+echo $ECHO_N "checking build system compiler $CC_FOR_BUILD... $ECHO_C" >&6; }
# remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF
@@ -9556,27 +8623,29 @@ main ()
EOF
gmp_compile="$CC_FOR_BUILD conftest.c"
cc_for_build_works=no
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&5 2>&1; then
cc_for_build_works=yes
fi
fi
rm -f conftest* a.out b.out a.exe a_out.exe
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cc_for_build_works" >&5
-$as_echo "$cc_for_build_works" >&6; }
+{ echo "$as_me:$LINENO: result: $cc_for_build_works" >&5
+echo "${ECHO_T}$cc_for_build_works" >&6; }
if test "$cc_for_build_works" = yes; then
:
else
- as_fn_error $? "Specified CC_FOR_BUILD doesn't seem to work" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Specified CC_FOR_BUILD doesn't seem to work" >&5
+echo "$as_me: error: Specified CC_FOR_BUILD doesn't seem to work" >&2;}
+ { (exit 1); exit 1; }; }
fi
elif test -n "$HOST_CC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system compiler $HOST_CC" >&5
-$as_echo_n "checking build system compiler $HOST_CC... " >&6; }
+ { echo "$as_me:$LINENO: checking build system compiler $HOST_CC" >&5
+echo $ECHO_N "checking build system compiler $HOST_CC... $ECHO_C" >&6; }
# remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF
@@ -9588,28 +8657,30 @@ main ()
EOF
gmp_compile="$HOST_CC conftest.c"
cc_for_build_works=no
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&5 2>&1; then
cc_for_build_works=yes
fi
fi
rm -f conftest* a.out b.out a.exe a_out.exe
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cc_for_build_works" >&5
-$as_echo "$cc_for_build_works" >&6; }
+{ echo "$as_me:$LINENO: result: $cc_for_build_works" >&5
+echo "${ECHO_T}$cc_for_build_works" >&6; }
if test "$cc_for_build_works" = yes; then
CC_FOR_BUILD=$HOST_CC
else
- as_fn_error $? "Specified HOST_CC doesn't seem to work" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Specified HOST_CC doesn't seem to work" >&5
+echo "$as_me: error: Specified HOST_CC doesn't seem to work" >&2;}
+ { (exit 1); exit 1; }; }
fi
else
for i in "$CC" "$CC $CFLAGS $CPPFLAGS" cc gcc c89 c99; do
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking build system compiler $i" >&5
-$as_echo_n "checking build system compiler $i... " >&6; }
+ { echo "$as_me:$LINENO: checking build system compiler $i" >&5
+echo $ECHO_N "checking build system compiler $i... $ECHO_C" >&6; }
# remove anything that might look like compiler output to our "||" expression
rm -f conftest* a.out b.out a.exe a_out.exe
cat >conftest.c <<EOF
@@ -9621,18 +8692,18 @@ main ()
EOF
gmp_compile="$i conftest.c"
cc_for_build_works=no
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if (./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest) >&5 2>&1; then
cc_for_build_works=yes
fi
fi
rm -f conftest* a.out b.out a.exe a_out.exe
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cc_for_build_works" >&5
-$as_echo "$cc_for_build_works" >&6; }
+{ echo "$as_me:$LINENO: result: $cc_for_build_works" >&5
+echo "${ECHO_T}$cc_for_build_works" >&6; }
if test "$cc_for_build_works" = yes; then
CC_FOR_BUILD=$i
break
@@ -9642,7 +8713,9 @@ fi
done
if test -z "$CC_FOR_BUILD"; then
- as_fn_error $? "Cannot find a build system compiler" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot find a build system compiler" >&5
+echo "$as_me: error: Cannot find a build system compiler" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
@@ -9650,46 +8723,48 @@ fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system preprocessor" >&5
-$as_echo_n "checking for build system preprocessor... " >&6; }
+{ echo "$as_me:$LINENO: checking for build system preprocessor" >&5
+echo $ECHO_N "checking for build system preprocessor... $ECHO_C" >&6; }
if test -z "$CPP_FOR_BUILD"; then
- if ${gmp_cv_prog_cpp_for_build+:} false; then :
- $as_echo_n "(cached) " >&6
+ if test "${gmp_cv_prog_cpp_for_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.c <<EOF
#define FOO BAR
EOF
for i in "$CC_FOR_BUILD -E" "$CC_FOR_BUILD -E -traditional-cpp" "/lib/cpp"; do
gmp_compile="$i conftest.c"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } >&5 2>&1; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >&5 2>&1; then
gmp_cv_prog_cpp_for_build=$i
break
fi
done
rm -f conftest* a.out b.out a.exe a_out.exe
if test -z "$gmp_cv_prog_cpp_for_build"; then
- as_fn_error $? "Cannot find build system C preprocessor." "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot find build system C preprocessor." >&5
+echo "$as_me: error: Cannot find build system C preprocessor." >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
CPP_FOR_BUILD=$gmp_cv_prog_cpp_for_build
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CPP_FOR_BUILD" >&5
-$as_echo "$CPP_FOR_BUILD" >&6; }
+{ echo "$as_me:$LINENO: result: $CPP_FOR_BUILD" >&5
+echo "${ECHO_T}$CPP_FOR_BUILD" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system executable suffix" >&5
-$as_echo_n "checking for build system executable suffix... " >&6; }
-if ${gmp_cv_prog_exeext_for_build+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for build system executable suffix" >&5
+echo $ECHO_N "checking for build system executable suffix... $ECHO_C" >&6; }
+if test "${gmp_cv_prog_exeext_for_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.c <<EOF
int
@@ -9700,11 +8775,11 @@ main ()
EOF
for i in .exe ,ff8 ""; do
gmp_compile="$CC_FOR_BUILD conftest.c -o conftest$i"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if (./conftest) 2>&5; then
gmp_cv_prog_exeext_for_build=$i
break
@@ -9713,20 +8788,22 @@ for i in .exe ,ff8 ""; do
done
rm -f conftest*
if test "${gmp_cv_prog_exeext_for_build+set}" != set; then
- as_fn_error $? "Cannot determine executable suffix" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot determine executable suffix" >&5
+echo "$as_me: error: Cannot determine executable suffix" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_prog_exeext_for_build" >&5
-$as_echo "$gmp_cv_prog_exeext_for_build" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_prog_exeext_for_build" >&5
+echo "${ECHO_T}$gmp_cv_prog_exeext_for_build" >&6; }
EXEEXT_FOR_BUILD=$gmp_cv_prog_exeext_for_build
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether build system compiler is ANSI" >&5
-$as_echo_n "checking whether build system compiler is ANSI... " >&6; }
-if ${gmp_cv_c_for_build_ansi+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether build system compiler is ANSI" >&5
+echo $ECHO_N "checking whether build system compiler is ANSI... $ECHO_C" >&6; }
+if test "${gmp_cv_c_for_build_ansi+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.c <<EOF
int
@@ -9736,11 +8813,11 @@ main (int argc, char **argv)
}
EOF
gmp_compile="$CC_FOR_BUILD conftest.c"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
gmp_cv_c_for_build_ansi=yes
else
gmp_cv_c_for_build_ansi=no
@@ -9748,8 +8825,8 @@ fi
rm -f conftest* a.out b.out a.exe a_out.exe
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_c_for_build_ansi" >&5
-$as_echo "$gmp_cv_c_for_build_ansi" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_c_for_build_ansi" >&5
+echo "${ECHO_T}$gmp_cv_c_for_build_ansi" >&6; }
if test "$gmp_cv_c_for_build_ansi" = yes; then
U_FOR_BUILD=
else
@@ -9758,10 +8835,10 @@ else
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for build system compiler math library" >&5
-$as_echo_n "checking for build system compiler math library... " >&6; }
-if ${gmp_cv_check_libm_for_build+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for build system compiler math library" >&5
+echo $ECHO_N "checking for build system compiler math library... $ECHO_C" >&6; }
+if test "${gmp_cv_check_libm_for_build+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.c <<EOF
int
@@ -9777,11 +8854,11 @@ foo ()
}
EOF
gmp_compile="$CC_FOR_BUILD conftest.c -lm"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
gmp_cv_check_libm_for_build=-lm
else
gmp_cv_check_libm_for_build=no
@@ -9789,8 +8866,8 @@ fi
rm -f conftest* a.out b.out a.exe a_out.exe
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_check_libm_for_build" >&5
-$as_echo "$gmp_cv_check_libm_for_build" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_check_libm_for_build" >&5
+echo "${ECHO_T}$gmp_cv_check_libm_for_build" >&6; }
case $gmp_cv_check_libm_for_build in
yes) LIBM_FOR_BUILD=-lm
;;
@@ -9826,10 +8903,10 @@ if test -z "$CXX"; then
do
# Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$CXX"; then
ac_cv_prog_CXX="$CXX" # Let the user override the test.
@@ -9839,25 +8916,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_CXX="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
CXX=$ac_cv_prog_CXX
if test -n "$CXX"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXX" >&5
-$as_echo "$CXX" >&6; }
+ { echo "$as_me:$LINENO: result: $CXX" >&5
+echo "${ECHO_T}$CXX" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -9870,10 +8947,10 @@ if test -z "$CXX"; then
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_CXX"; then
ac_cv_prog_ac_ct_CXX="$ac_ct_CXX" # Let the user override the test.
@@ -9883,25 +8960,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_CXX="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
ac_ct_CXX=$ac_cv_prog_ac_ct_CXX
if test -n "$ac_ct_CXX"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_CXX" >&5
-$as_echo "$ac_ct_CXX" >&6; }
+ { echo "$as_me:$LINENO: result: $ac_ct_CXX" >&5
+echo "${ECHO_T}$ac_ct_CXX" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -9913,8 +8990,12 @@ done
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
CXX=$ac_ct_CXX
@@ -9924,36 +9005,49 @@ fi
fi
fi
# Provide some information about the compiler.
-$as_echo "$as_me:${as_lineno-$LINENO}: checking for C++ compiler version" >&5
-set X $ac_compile
-ac_compiler=$2
-for ac_option in --version -v -V -qversion; do
- { { ac_try="$ac_compiler $ac_option >&5"
+echo "$as_me:$LINENO: checking for C++ compiler version" >&5
+ac_compiler=`set X $ac_compile; echo $2`
+{ (ac_try="$ac_compiler --version >&5"
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_compiler $ac_option >&5") 2>conftest.err
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler --version >&5") 2>&5
ac_status=$?
- if test -s conftest.err; then
- sed '10a\
-... rest of stderr output deleted ...
- 10q' conftest.err >conftest.er1
- cat conftest.er1 >&5
- fi
- rm -f conftest.er1 conftest.err
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
-done
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -v >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -v >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ (ac_try="$ac_compiler -V >&5"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compiler -V >&5") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether we are using the GNU C++ compiler" >&5
-$as_echo_n "checking whether we are using the GNU C++ compiler... " >&6; }
-if ${ac_cv_cxx_compiler_gnu+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether we are using the GNU C++ compiler" >&5
+echo $ECHO_N "checking whether we are using the GNU C++ compiler... $ECHO_C" >&6; }
+if test "${ac_cv_cxx_compiler_gnu+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -9967,34 +9061,54 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_compiler_gnu=yes
else
- ac_compiler_gnu=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_compiler_gnu=no
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cv_cxx_compiler_gnu=$ac_compiler_gnu
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_cxx_compiler_gnu" >&5
-$as_echo "$ac_cv_cxx_compiler_gnu" >&6; }
-if test $ac_compiler_gnu = yes; then
- GXX=yes
-else
- GXX=
-fi
+{ echo "$as_me:$LINENO: result: $ac_cv_cxx_compiler_gnu" >&5
+echo "${ECHO_T}$ac_cv_cxx_compiler_gnu" >&6; }
+GXX=`test $ac_compiler_gnu = yes && echo yes`
ac_test_CXXFLAGS=${CXXFLAGS+set}
ac_save_CXXFLAGS=$CXXFLAGS
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether $CXX accepts -g" >&5
-$as_echo_n "checking whether $CXX accepts -g... " >&6; }
-if ${ac_cv_prog_cxx_g+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether $CXX accepts -g" >&5
+echo $ECHO_N "checking whether $CXX accepts -g... $ECHO_C" >&6; }
+if test "${ac_cv_prog_cxx_g+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_save_cxx_werror_flag=$ac_cxx_werror_flag
ac_cxx_werror_flag=yes
ac_cv_prog_cxx_g=no
CXXFLAGS="-g"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -10005,11 +9119,34 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_prog_cxx_g=yes
else
- CXXFLAGS=""
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ CXXFLAGS=""
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -10020,12 +9157,35 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
-
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
else
- ac_cxx_werror_flag=$ac_save_cxx_werror_flag
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cxx_werror_flag=$ac_save_cxx_werror_flag
CXXFLAGS="-g"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -10036,18 +9196,42 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_cxx_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_prog_cxx_g=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
ac_cxx_werror_flag=$ac_save_cxx_werror_flag
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_cxx_g" >&5
-$as_echo "$ac_cv_prog_cxx_g" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_cxx_g" >&5
+echo "${ECHO_T}$ac_cv_prog_cxx_g" >&6; }
if test "$ac_test_CXXFLAGS" = set; then
CXXFLAGS=$ac_save_CXXFLAGS
elif test $ac_cv_prog_cxx_g = yes; then
@@ -10096,8 +9280,8 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
#
for cxxflags_choice in $cxxflags_list; do
eval CXXFLAGS=\"\$cxxflags_$cxxflags_choice\"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking C++ compiler $CXX $CPPFLAGS $CXXFLAGS" >&5
-$as_echo_n "checking C++ compiler $CXX $CPPFLAGS $CXXFLAGS... " >&6; }
+ { echo "$as_me:$LINENO: checking C++ compiler $CXX $CPPFLAGS $CXXFLAGS" >&5
+echo $ECHO_N "checking C++ compiler $CXX $CPPFLAGS $CXXFLAGS... $ECHO_C" >&6; }
gmp_prog_cxx_works=yes
# start with a plain "main()", then go on to further checks
@@ -10110,18 +9294,18 @@ int main (void) { return 0; }
EOF
echo "Test compile: " >&5
gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_cxxcompile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_cxxcompile\"") >&5
(eval $gmp_cxxcompile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
gmp_prog_cxx_works="no, program does not run"
fi
@@ -10150,18 +9334,18 @@ int main (void) { return 0; }
EOF
echo "Test compile: namespace" >&5
gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_cxxcompile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_cxxcompile\"") >&5
(eval $gmp_cxxcompile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
gmp_prog_cxx_works="no, namespace, program does not run"
fi
@@ -10196,18 +9380,18 @@ int main (void) { return 0; }
EOF
echo "Test compile: std iostream" >&5
gmp_cxxcompile="$CXX $CPPFLAGS $CXXFLAGS conftest.cc >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_cxxcompile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_cxxcompile\"") >&5
(eval $gmp_cxxcompile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if test "$cross_compiling" = no; then
if { ac_try='./a.out || ./b.out || ./a.exe || ./a_out.exe || ./conftest'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }; then :;
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then :;
else
gmp_prog_cxx_works="no, std iostream, program does not run"
fi
@@ -10225,8 +9409,8 @@ EOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_prog_cxx_works" >&5
-$as_echo "$gmp_prog_cxx_works" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_prog_cxx_works" >&5
+echo "${ECHO_T}$gmp_prog_cxx_works" >&6; }
case $gmp_prog_cxx_works in
yes)
want_cxx=yes
@@ -10241,11 +9425,15 @@ esac
# If --enable-cxx=yes but a C++ compiler can't be found, then abort.
if test $want_cxx = no && test $enable_cxx = yes; then
- as_fn_error $? "C++ compiler not available, see config.log for details" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: C++ compiler not available, see config.log for details" >&5
+echo "$as_me: error: C++ compiler not available, see config.log for details" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
- if test $want_cxx = yes; then
+
+
+if test $want_cxx = yes; then
WANT_CXX_TRUE=
WANT_CXX_FALSE='#'
else
@@ -10265,11 +9453,11 @@ ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
-$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
if test -z "$CXXCPP"; then
- if ${ac_cv_prog_CXXCPP+:} false; then :
- $as_echo_n "(cached) " >&6
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# Double quotes because CXXCPP needs to be expanded
for CXXCPP in "$CXX -E" "/lib/cpp"
@@ -10283,7 +9471,11 @@ do
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
@@ -10292,34 +9484,76 @@ do
#endif
Syntax error
_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
# Broken: success on invalid input.
continue
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
break
fi
@@ -10331,8 +9565,8 @@ fi
else
ac_cv_prog_CXXCPP=$CXXCPP
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
-$as_echo "$CXXCPP" >&6; }
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
ac_preproc_ok=false
for ac_cxx_preproc_warn_flag in '' yes
do
@@ -10342,7 +9576,11 @@ do
# <limits.h> exists even on freestanding compilers.
# On the NeXT, cc -E runs the code through the compiler's parser,
# not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef __STDC__
# include <limits.h>
@@ -10351,40 +9589,83 @@ do
#endif
Syntax error
_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
-
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Broken: fails on valid input.
continue
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
# OK, works on sane cases. Now check whether nonexistent headers
# can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ac_nonexistent.h>
_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
# Broken: success on invalid input.
continue
else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
# Passes both tests.
ac_preproc_ok=:
break
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+
+rm -f conftest.err conftest.$ac_ext
done
# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
-
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
fi
ac_ext=c
@@ -10400,41 +9681,45 @@ fi
# deciding the compiler.
#
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for grep that handles long lines and -e" >&5
-$as_echo_n "checking for grep that handles long lines and -e... " >&6; }
-if ${ac_cv_path_GREP+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for grep that handles long lines and -e" >&5
+echo $ECHO_N "checking for grep that handles long lines and -e... $ECHO_C" >&6; }
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Extract the first word of "grep ggrep" to use in msg output
+if test -z "$GREP"; then
+set dummy grep ggrep; ac_prog_name=$2
+if test "${ac_cv_path_GREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -z "$GREP"; then
ac_path_GREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in grep ggrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_GREP" || continue
-# Check for GNU ac_path_GREP and select it if it is found.
+ for ac_prog in grep ggrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_GREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_GREP" && $as_test_x "$ac_path_GREP"; } || continue
+ # Check for GNU ac_path_GREP and select it if it is found.
# Check for GNU $ac_path_GREP
case `"$ac_path_GREP" --version 2>&1` in
*GNU*)
ac_cv_path_GREP="$ac_path_GREP" ac_path_GREP_found=:;;
*)
ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
- $as_echo 'GREP' >> "conftest.nl"
+ echo 'GREP' >> "conftest.nl"
"$ac_path_GREP" -e 'GREP$' -e '-(cannot match)-' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
+ ac_count=`expr $ac_count + 1`
if test $ac_count -gt ${ac_path_GREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_GREP="$ac_path_GREP"
@@ -10446,61 +9731,77 @@ case `"$ac_path_GREP" --version 2>&1` in
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
- $ac_path_GREP_found && break 3
- done
- done
+
+ $ac_path_GREP_found && break 3
done
+done
+
+done
IFS=$as_save_IFS
- if test -z "$ac_cv_path_GREP"; then
- as_fn_error $? "no acceptable grep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
+
+
+fi
+
+GREP="$ac_cv_path_GREP"
+if test -z "$GREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
else
ac_cv_path_GREP=$GREP
fi
+
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_GREP" >&5
-$as_echo "$ac_cv_path_GREP" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_path_GREP" >&5
+echo "${ECHO_T}$ac_cv_path_GREP" >&6; }
GREP="$ac_cv_path_GREP"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for egrep" >&5
-$as_echo_n "checking for egrep... " >&6; }
-if ${ac_cv_path_EGREP+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for egrep" >&5
+echo $ECHO_N "checking for egrep... $ECHO_C" >&6; }
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if echo a | $GREP -E '(a|b)' >/dev/null 2>&1
then ac_cv_path_EGREP="$GREP -E"
else
- if test -z "$EGREP"; then
+ # Extract the first word of "egrep" to use in msg output
+if test -z "$EGREP"; then
+set dummy egrep; ac_prog_name=$2
+if test "${ac_cv_path_EGREP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
ac_path_EGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+# Loop through the user's path and test for each of PROGNAME-LIST
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in egrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_EGREP" || continue
-# Check for GNU ac_path_EGREP and select it if it is found.
+ for ac_prog in egrep; do
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ ac_path_EGREP="$as_dir/$ac_prog$ac_exec_ext"
+ { test -f "$ac_path_EGREP" && $as_test_x "$ac_path_EGREP"; } || continue
+ # Check for GNU ac_path_EGREP and select it if it is found.
# Check for GNU $ac_path_EGREP
case `"$ac_path_EGREP" --version 2>&1` in
*GNU*)
ac_cv_path_EGREP="$ac_path_EGREP" ac_path_EGREP_found=:;;
*)
ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
+ echo $ECHO_N "0123456789$ECHO_C" >"conftest.in"
while :
do
cat "conftest.in" "conftest.in" >"conftest.tmp"
mv "conftest.tmp" "conftest.in"
cp "conftest.in" "conftest.nl"
- $as_echo 'EGREP' >> "conftest.nl"
+ echo 'EGREP' >> "conftest.nl"
"$ac_path_EGREP" 'EGREP$' < "conftest.nl" >"conftest.out" 2>/dev/null || break
diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
+ ac_count=`expr $ac_count + 1`
if test $ac_count -gt ${ac_path_EGREP_max-0}; then
# Best one so far, save it but keep looking for a better one
ac_cv_path_EGREP="$ac_path_EGREP"
@@ -10512,35 +9813,50 @@ case `"$ac_path_EGREP" --version 2>&1` in
rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
esac
- $ac_path_EGREP_found && break 3
- done
- done
+
+ $ac_path_EGREP_found && break 3
done
+done
+
+done
IFS=$as_save_IFS
- if test -z "$ac_cv_path_EGREP"; then
- as_fn_error $? "no acceptable egrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
+
+
+fi
+
+EGREP="$ac_cv_path_EGREP"
+if test -z "$EGREP"; then
+ { { echo "$as_me:$LINENO: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&5
+echo "$as_me: error: no acceptable $ac_prog_name could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" >&2;}
+ { (exit 1); exit 1; }; }
+fi
+
else
ac_cv_path_EGREP=$EGREP
fi
+
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_EGREP" >&5
-$as_echo "$ac_cv_path_EGREP" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_path_EGREP" >&5
+echo "${ECHO_T}$ac_cv_path_EGREP" >&6; }
EGREP="$ac_cv_path_EGREP"
case $host_cpu in
c90 | t90)
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifdef _CRAYIEEE
yes
#endif
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "yes" >/dev/null 2>&1; then :
+ $EGREP "yes" >/dev/null 2>&1; then
add_path="cray/ieee"
else
add_path="cray/cfp"; extra_functions="mulwwc90"
@@ -10590,24 +9906,24 @@ done
# enough assembler.
#
case $host in
- 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-*-*)
+ i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*)
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
-$as_echo_n "checking if the assembler knows about MMX instructions... " >&6; }
-if ${gmp_cv_asm_x86_mmx+:} false; then :
- $as_echo_n "(cached) " >&6
+ *mmx*) { echo "$as_me:$LINENO: checking if the assembler knows about MMX instructions" >&5
+echo $ECHO_N "checking if the assembler knows about MMX instructions... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_x86_mmx+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
.text
movq %mm0, %mm1
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_x86_mmx=yes
case $host in
@@ -10617,8 +9933,8 @@ case $host in
gmp_cv_asm_x86_mmx=movq-bug
fi
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"dis\" not available to check for \"as\" movq bug" >&5
-$as_echo "$as_me: WARNING: \"dis\" not available to check for \"as\" movq bug" >&2;}
+ { echo "$as_me:$LINENO: WARNING: \"dis\" not available to check for \"as\" movq bug" >&5
+echo "$as_me: WARNING: \"dis\" not available to check for \"as\" movq bug" >&2;}
fi
esac
else
@@ -10630,45 +9946,45 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_x86_mmx" >&5
-$as_echo "$gmp_cv_asm_x86_mmx" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_mmx" >&5
+echo "${ECHO_T}$gmp_cv_asm_x86_mmx" >&6; }
case $gmp_cv_asm_x86_mmx in
movq-bug)
- { $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 MMX code, but the assembler" >&5
-$as_echo "$as_me: WARNING: | Host CPU has MMX code, but the assembler" >&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: | has the Solaris 2.6 and 2.7 bug where register to register" >&5
-$as_echo "$as_me: WARNING: | has the Solaris 2.6 and 2.7 bug where register to register" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | movq operands are reversed." >&5
-$as_echo "$as_me: WARNING: | movq operands are reversed." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | Non-MMX replacements will be used." >&5
-$as_echo "$as_me: WARNING: | Non-MMX replacements 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;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | WARNING WARNING WARNING" >&5
+echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Host CPU has MMX code, but the assembler" >&5
+echo "$as_me: WARNING: | Host CPU has MMX code, but the assembler" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&5
+echo "$as_me: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | has the Solaris 2.6 and 2.7 bug where register to register" >&5
+echo "$as_me: WARNING: | has the Solaris 2.6 and 2.7 bug where register to register" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | movq operands are reversed." >&5
+echo "$as_me: WARNING: | movq operands are reversed." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Non-MMX replacements will be used." >&5
+echo "$as_me: WARNING: | Non-MMX replacements will be used." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | This will be an inferior build." >&5
+echo "$as_me: WARNING: | This will be an inferior build." >&2;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
;;
no)
- { $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 MMX code, but it can't be assembled by" >&5
-$as_echo "$as_me: WARNING: | Host CPU has MMX code, but it 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: | Non-MMX replacements will be used." >&5
-$as_echo "$as_me: WARNING: | Non-MMX replacements 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;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | WARNING WARNING WARNING" >&5
+echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Host CPU has MMX code, but it can't be assembled by" >&5
+echo "$as_me: WARNING: | Host CPU has MMX code, but it can't be assembled by" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&5
+echo "$as_me: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Non-MMX replacements will be used." >&5
+echo "$as_me: WARNING: | Non-MMX replacements will be used." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | This will be an inferior build." >&5
+echo "$as_me: WARNING: | This will be an inferior build." >&2;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
;;
esac
if test "$gmp_cv_asm_x86_mmx" = yes; then
@@ -10697,21 +10013,21 @@ fi
;;
esac
case "$path $fat_path" in
- *sse2*) { $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler knows about SSE2 instructions" >&5
-$as_echo_n "checking if the assembler knows about SSE2 instructions... " >&6; }
-if ${gmp_cv_asm_x86_sse2+:} false; then :
- $as_echo_n "(cached) " >&6
+ *sse2*) { echo "$as_me:$LINENO: checking if the assembler knows about SSE2 instructions" >&5
+echo $ECHO_N "checking if the assembler knows about SSE2 instructions... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_x86_sse2+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
.text
paddq %mm0, %mm1
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_x86_sse2=yes
else
@@ -10724,27 +10040,27 @@ rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_x86_sse2" >&5
-$as_echo "$gmp_cv_asm_x86_sse2" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_sse2" >&5
+echo "${ECHO_T}$gmp_cv_asm_x86_sse2" >&6; }
case $gmp_cv_asm_x86_sse2 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 SSE2 code, but it can't be assembled by" >&5
-$as_echo "$as_me: WARNING: | Host CPU has SSE2 code, but it 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: | Non-SSE2 replacements will be used." >&5
-$as_echo "$as_me: WARNING: | Non-SSE2 replacements 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;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | WARNING WARNING WARNING" >&5
+echo "$as_me: WARNING: | WARNING WARNING WARNING" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Host CPU has SSE2 code, but it can't be assembled by" >&5
+echo "$as_me: WARNING: | Host CPU has SSE2 code, but it can't be assembled by" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&5
+echo "$as_me: WARNING: | $CCAS $CFLAGS $CPPFLAGS" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Non-SSE2 replacements will be used." >&5
+echo "$as_me: WARNING: | Non-SSE2 replacements will be used." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | This will be an inferior build." >&5
+echo "$as_me: WARNING: | This will be an inferior build." >&2;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
tmp_path=
for i in $path; do
case $i in
@@ -10769,215 +10085,475 @@ 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
+ ;;
+esac
+
+
+cat >&5 <<EOF
+Decided:
+ABI=$ABI
+CC=$CC
+CFLAGS=$CFLAGS
+CPPFLAGS=$CPPFLAGS
+GMP_LDFLAGS=$GMP_LDFLAGS
+CXX=$CXX
+CXXFLAGS=$CXXFLAGS
+path=$path
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
+echo "using ABI=\"$ABI\""
+echo " CC=\"$CC\""
+echo " CFLAGS=\"$CFLAGS\""
+echo " CPPFLAGS=\"$CPPFLAGS\""
+if test $want_cxx = yes; then
+ echo " CXX=\"$CXX\""
+ echo " CXXFLAGS=\"$CXXFLAGS\""
+fi
+echo " MPN_PATH=\"$path\""
+
+
+# Automake ansi2knr support.
+{ echo "$as_me:$LINENO: checking for function prototypes" >&5
+echo $ECHO_N "checking for function prototypes... $ECHO_C" >&6; }
+if test "$ac_cv_prog_cc_c89" != no; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+
+cat >>confdefs.h <<\_ACEOF
+#define PROTOTYPES 1
+_ACEOF
+
+
+cat >>confdefs.h <<\_ACEOF
+#define __PROTOTYPES 1
+_ACEOF
+
+else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+#include <stdarg.h>
+#include <string.h>
+#include <float.h>
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
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
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_header_stdc=yes
else
- cat conftest.out >&5
- echo "configure: failed program was:" >&5
- cat conftest.s >&5
- gmp_cv_asm_x86_mulx=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
fi
-rm -f conftest*
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if test $ac_cv_header_stdc = yes; then
+ # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <string.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
+else
+ ac_cv_header_stdc=no
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)
+rm -f conftest*
+
+fi
+
+if test $ac_cv_header_stdc = yes; then
+ # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdlib.h>
+
+_ACEOF
+if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
+ $EGREP "free" >/dev/null 2>&1; then
:
- ;;
-*)
- { $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"
+else
+ ac_cv_header_stdc=no
+fi
+rm -f conftest*
-tmp_path=
-for i in $fat_path; do
- case $i in
- */mulx) ;;
- *) tmp_path="$tmp_path $i" ;;
- esac
-done
-fat_path="$tmp_path"
+fi
+if test $ac_cv_header_stdc = yes; then
+ # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
+ if test "$cross_compiling" = yes; then
+ :
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ctype.h>
+#include <stdlib.h>
+#if ((' ' & 0x0FF) == 0x020)
+# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
+# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
+#else
+# define ISLOWER(c) \
+ (('a' <= (c) && (c) <= 'i') \
+ || ('j' <= (c) && (c) <= 'r') \
+ || ('s' <= (c) && (c) <= 'z'))
+# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
+#endif
- ;;
+#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
+int
+main ()
+{
+ int i;
+ for (i = 0; i < 256; i++)
+ if (XOR (islower (i), ISLOWER (i))
+ || toupper (i) != TOUPPER (i))
+ return 2;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
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
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
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
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
+fi
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+
+
+fi
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
+if test $ac_cv_header_stdc = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
+
+fi
+
+# On IRIX 5.3, sys/types and inttypes.h are conflicting.
+
+
+
+
+
+
+
+
+
+for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
+ inttypes.h stdint.h unistd.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
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
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
else
- cat conftest.out >&5
- echo "configure: failed program was:" >&5
- cat conftest.s >&5
- gmp_cv_asm_x86_adx=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
fi
-rm -f conftest*
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
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"
- ;;
+
+if test "$ac_cv_prog_cc_stdc" != no; then
+ U= ANSI2KNR=
+else
+ U=_ ANSI2KNR=./ansi2knr
+fi
+# Ensure some checks needed by ansi2knr itself.
+
+
+for ac_header in string.h
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
esac
- ;;
- esac
- ;;
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
-if test "$enable_assembly" = "no"; then
- path="generic"
- CFLAGS="$CFLAGS -DNO_ASM"
-# for abi in $abilist; do
-# eval unset "path_\$abi"
-# eval gcc_${abi}_cflags=\"\$gcc_${abi}_cflags -DNO_ASM\"
-# done
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ---------------------------------- ##
+## Report this to gmp-bugs@gmplib.org ##
+## ---------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
-cat >&5 <<EOF
-Decided:
-ABI=$ABI
-CC=$CC
-CFLAGS=$CFLAGS
-CPPFLAGS=$CPPFLAGS
-GMP_LDFLAGS=$GMP_LDFLAGS
-CXX=$CXX
-CXXFLAGS=$CXXFLAGS
-path=$path
-EOF
-echo "using ABI=\"$ABI\""
-echo " CC=\"$CC\""
-echo " CFLAGS=\"$CFLAGS\""
-echo " CPPFLAGS=\"$CPPFLAGS\""
-if test $want_cxx = yes; then
- echo " CXX=\"$CXX\""
- echo " CXXFLAGS=\"$CXXFLAGS\""
fi
-echo " MPN_PATH=\"$path\""
+
+done
+
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether assembler supports --noexecstack option" >&5
-$as_echo_n "checking whether assembler supports --noexecstack option... " >&6; }
-if ${cl_cv_as_noexecstack+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether assembler supports --noexecstack option" >&5
+echo $ECHO_N "checking whether assembler supports --noexecstack option... $ECHO_C" >&6; }
+if test "${cl_cv_as_noexecstack+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat > conftest.c <<EOF
void foo() {}
EOF
if { ac_try='${CC} $CFLAGS $CPPFLAGS
-S -o conftest.s conftest.c >/dev/null'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; } \
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; } \
&& grep .note.GNU-stack conftest.s >/dev/null \
&& { ac_try='${CC} $CFLAGS $CPPFLAGS -Wa,--noexecstack
-c -o conftest.o conftest.s >/dev/null'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
+ { (eval echo "$as_me:$LINENO: \"$ac_try\"") >&5
(eval $ac_try) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; }
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }
then
cl_cv_as_noexecstack=yes
else
@@ -10985,8 +10561,8 @@ EOF
fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $cl_cv_as_noexecstack" >&5
-$as_echo "$cl_cv_as_noexecstack" >&6; }
+{ echo "$as_me:$LINENO: result: $cl_cv_as_noexecstack" >&5
+echo "${ECHO_T}$cl_cv_as_noexecstack" >&6; }
if test "$cl_cv_as_noexecstack" = yes; then
ASMFLAGS="$ASMFLAGS -Wa,--noexecstack"
fi
@@ -10998,10 +10574,10 @@ gmp_user_AR=$AR
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
set dummy ${ac_tool_prefix}ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$AR"; then
ac_cv_prog_AR="$AR" # Let the user override the test.
@@ -11011,25 +10587,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_AR="${ac_tool_prefix}ar"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
AR=$ac_cv_prog_AR
if test -n "$AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
+ { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -11038,10 +10614,10 @@ if test -z "$ac_cv_prog_AR"; then
ac_ct_AR=$AR
# Extract the first word of "ar", so it can be a program name with args.
set dummy ar; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_AR"; then
ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
@@ -11051,25 +10627,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_AR="ar"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
ac_ct_AR=$ac_cv_prog_ac_ct_AR
if test -n "$ac_ct_AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
+ { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_AR" = x; then
@@ -11077,8 +10653,12 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
AR=$ac_ct_AR
@@ -11091,13 +10671,13 @@ if test -z "$gmp_user_AR"; then
eval arflags=\"\$ar${abi1}_flags\"
test -n "$arflags" || eval arflags=\"\$ar${abi2}_flags\"
if test -n "$arflags"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra ar flags" >&5
-$as_echo_n "checking for extra ar flags... " >&6; }
+ { echo "$as_me:$LINENO: checking for extra ar flags" >&5
+echo $ECHO_N "checking for extra ar flags... $ECHO_C" >&6; }
AR="$AR $arflags"
ac_cv_prog_AR="$AR $arflags"
ac_cv_prog_ac_ct_AR="$AR $arflags"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $arflags" >&5
-$as_echo "$arflags" >&6; }
+ { echo "$as_me:$LINENO: result: $arflags" >&5
+echo "${ECHO_T}$arflags" >&6; }
fi
fi
if test -z "$AR_FLAGS"; then
@@ -11106,10 +10686,10 @@ fi
gmp_user_NM=$NM
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
-$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if ${lt_cv_path_NM+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$NM"; then
# Let the user override the test.
@@ -11152,161 +10732,12 @@ else
done
IFS="$lt_save_ifs"
done
- : ${lt_cv_path_NM=no}
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
-$as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
- NM="$lt_cv_path_NM"
-else
- # Didn't find any BSD compatible name lister, look for dumpbin.
- if test -n "$DUMPBIN"; then :
- # Let the user override the test.
- else
- if test -n "$ac_tool_prefix"; then
- for ac_prog in dumpbin "link -dump"
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DUMPBIN+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$DUMPBIN"; then
- ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-DUMPBIN=$ac_cv_prog_DUMPBIN
-if test -n "$DUMPBIN"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
-$as_echo "$DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$DUMPBIN" && break
- done
-fi
-if test -z "$DUMPBIN"; then
- ac_ct_DUMPBIN=$DUMPBIN
- for ac_prog in dumpbin "link -dump"
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_DUMPBIN"; then
- ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
-if test -n "$ac_ct_DUMPBIN"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
-$as_echo "$ac_ct_DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$ac_ct_DUMPBIN" && break
-done
-
- if test "x$ac_ct_DUMPBIN" = x; then
- DUMPBIN=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- DUMPBIN=$ac_ct_DUMPBIN
- fi
-fi
-
- case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
- *COFF*)
- DUMPBIN="$DUMPBIN -symbols"
- ;;
- *)
- DUMPBIN=:
- ;;
- esac
- fi
-
- if test "$DUMPBIN" != ":"; then
- NM="$DUMPBIN"
- fi
-fi
-test -z "$NM" && NM=nm
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
-$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if ${lt_cv_nm_interface+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_nm_interface="BSD nm"
- echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
- (eval "$ac_compile" 2>conftest.err)
- cat conftest.err >&5
- (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
- (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
- cat conftest.err >&5
- (eval echo "\"\$as_me:$LINENO: output\"" >&5)
- cat conftest.out >&5
- if $GREP 'External.*some_variable' conftest.out > /dev/null; then
- lt_cv_nm_interface="MS dumpbin"
- fi
- rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
-$as_echo "$lt_cv_nm_interface" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
# FIXME: When cross compiling (ie. $ac_tool_prefix not empty), libtool
@@ -11321,10 +10752,10 @@ if test -z "$gmp_user_NM" && test -n "$ac_tool_prefix" && test "$NM" = nm; then
gmp_save_ac_tool_prefix=$ac_tool_prefix
ac_tool_prefix=
NM=
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for BSD- or MS-compatible name lister (nm)" >&5
-$as_echo_n "checking for BSD- or MS-compatible name lister (nm)... " >&6; }
-if ${lt_cv_path_NM+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for BSD-compatible nm" >&5
+echo $ECHO_N "checking for BSD-compatible nm... $ECHO_C" >&6; }
+if test "${lt_cv_path_NM+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$NM"; then
# Let the user override the test.
@@ -11367,158 +10798,12 @@ else
done
IFS="$lt_save_ifs"
done
- : ${lt_cv_path_NM=no}
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_NM" >&5
-$as_echo "$lt_cv_path_NM" >&6; }
-if test "$lt_cv_path_NM" != "no"; then
- NM="$lt_cv_path_NM"
-else
- # Didn't find any BSD compatible name lister, look for dumpbin.
- if test -n "$DUMPBIN"; then :
- # Let the user override the test.
- else
- if test -n "$ac_tool_prefix"; then
- for ac_prog in dumpbin "link -dump"
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DUMPBIN+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$DUMPBIN"; then
- ac_cv_prog_DUMPBIN="$DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_DUMPBIN="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-DUMPBIN=$ac_cv_prog_DUMPBIN
-if test -n "$DUMPBIN"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DUMPBIN" >&5
-$as_echo "$DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
- test -n "$DUMPBIN" && break
- done
-fi
-if test -z "$DUMPBIN"; then
- ac_ct_DUMPBIN=$DUMPBIN
- for ac_prog in dumpbin "link -dump"
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DUMPBIN+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_DUMPBIN"; then
- ac_cv_prog_ac_ct_DUMPBIN="$ac_ct_DUMPBIN" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_DUMPBIN="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
+ test -z "$lt_cv_path_NM" && lt_cv_path_NM=nm
fi
-ac_ct_DUMPBIN=$ac_cv_prog_ac_ct_DUMPBIN
-if test -n "$ac_ct_DUMPBIN"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DUMPBIN" >&5
-$as_echo "$ac_ct_DUMPBIN" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
fi
-
-
- test -n "$ac_ct_DUMPBIN" && break
-done
-
- if test "x$ac_ct_DUMPBIN" = x; then
- DUMPBIN=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- DUMPBIN=$ac_ct_DUMPBIN
- fi
-fi
-
- case `$DUMPBIN -symbols /dev/null 2>&1 | sed '1q'` in
- *COFF*)
- DUMPBIN="$DUMPBIN -symbols"
- ;;
- *)
- DUMPBIN=:
- ;;
- esac
- fi
-
- if test "$DUMPBIN" != ":"; then
- NM="$DUMPBIN"
- fi
-fi
-test -z "$NM" && NM=nm
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the name lister ($NM) interface" >&5
-$as_echo_n "checking the name lister ($NM) interface... " >&6; }
-if ${lt_cv_nm_interface+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_nm_interface="BSD nm"
- echo "int some_variable = 0;" > conftest.$ac_ext
- (eval echo "\"\$as_me:$LINENO: $ac_compile\"" >&5)
- (eval "$ac_compile" 2>conftest.err)
- cat conftest.err >&5
- (eval echo "\"\$as_me:$LINENO: $NM \\\"conftest.$ac_objext\\\"\"" >&5)
- (eval "$NM \"conftest.$ac_objext\"" 2>conftest.err > conftest.out)
- cat conftest.err >&5
- (eval echo "\"\$as_me:$LINENO: output\"" >&5)
- cat conftest.out >&5
- if $GREP 'External.*some_variable' conftest.out > /dev/null; then
- lt_cv_nm_interface="MS dumpbin"
- fi
- rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_nm_interface" >&5
-$as_echo "$lt_cv_nm_interface" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_path_NM" >&5
+echo "${ECHO_T}$lt_cv_path_NM" >&6; }
+NM="$lt_cv_path_NM"
ac_tool_prefix=$gmp_save_ac_tool_prefix
fi
@@ -11527,11 +10812,11 @@ if test -z "$gmp_user_NM"; then
eval nmflags=\"\$nm${abi1}_flags\"
test -n "$nmflags" || eval nmflags=\"\$nm${abi2}_flags\"
if test -n "$nmflags"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for extra nm flags" >&5
-$as_echo_n "checking for extra nm flags... " >&6; }
+ { echo "$as_me:$LINENO: checking for extra nm flags" >&5
+echo $ECHO_N "checking for extra nm flags... $ECHO_C" >&6; }
NM="$NM $nmflags"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $nmflags" >&5
-$as_echo "$nmflags" >&6; }
+ { echo "$as_me:$LINENO: result: $nmflags" >&5
+echo "${ECHO_T}$nmflags" >&6; }
fi
fi
@@ -11555,307 +10840,6 @@ esac
# Configs for Windows DLLs.
-enable_win32_dll=yes
-
-case $host in
-*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*)
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
-set dummy ${ac_tool_prefix}as; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AS+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$AS"; then
- ac_cv_prog_AS="$AS" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_AS="${ac_tool_prefix}as"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-AS=$ac_cv_prog_AS
-if test -n "$AS"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AS" >&5
-$as_echo "$AS" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_AS"; then
- ac_ct_AS=$AS
- # Extract the first word of "as", so it can be a program name with args.
-set dummy as; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AS+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_AS"; then
- ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_AS="as"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_AS=$ac_cv_prog_ac_ct_AS
-if test -n "$ac_ct_AS"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AS" >&5
-$as_echo "$ac_ct_AS" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_AS" = x; then
- AS="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- AS=$ac_ct_AS
- fi
-else
- AS="$ac_cv_prog_AS"
-fi
-
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$DLLTOOL"; then
- ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-DLLTOOL=$ac_cv_prog_DLLTOOL
-if test -n "$DLLTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DLLTOOL"; then
- ac_ct_DLLTOOL=$DLLTOOL
- # Extract the first word of "dlltool", so it can be a program name with args.
-set dummy dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_DLLTOOL"; then
- ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_DLLTOOL="dlltool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
-if test -n "$ac_ct_DLLTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_DLLTOOL" = x; then
- DLLTOOL="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- DLLTOOL=$ac_ct_DLLTOOL
- fi
-else
- DLLTOOL="$ac_cv_prog_DLLTOOL"
-fi
-
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
-set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJDUMP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$OBJDUMP"; then
- ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-OBJDUMP=$ac_cv_prog_OBJDUMP
-if test -n "$OBJDUMP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
-$as_echo "$OBJDUMP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OBJDUMP"; then
- ac_ct_OBJDUMP=$OBJDUMP
- # Extract the first word of "objdump", so it can be a program name with args.
-set dummy objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_OBJDUMP"; then
- ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_OBJDUMP="objdump"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
-if test -n "$ac_ct_OBJDUMP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
-$as_echo "$ac_ct_OBJDUMP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_OBJDUMP" = x; then
- OBJDUMP="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- OBJDUMP=$ac_ct_OBJDUMP
- fi
-else
- OBJDUMP="$ac_cv_prog_OBJDUMP"
-fi
-
- ;;
-esac
-
-test -z "$AS" && AS=as
-
-
-
-
-
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-
-
-
-
-
-test -z "$OBJDUMP" && OBJDUMP=objdump
-
-
-
-
-
@@ -11869,8 +10853,11 @@ case $host in
fi
# Don't allow both static and DLL.
if test "$enable_shared" != no && test "$enable_static" != no; then
- as_fn_error $? "cannot build both static and DLL, since gmp.h is different for each.
-Use \"--disable-static --enable-shared\" to build just a DLL." "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot build both static and DLL, since gmp.h is different for each.
+Use \"--disable-static --enable-shared\" to build just a DLL." >&5
+echo "$as_me: error: cannot build both static and DLL, since gmp.h is different for each.
+Use \"--disable-static --enable-shared\" to build just a DLL." >&2;}
+ { (exit 1); exit 1; }; }
fi
# "-no-undefined" is required when building a DLL, see documentation on
@@ -11946,273 +10933,142 @@ 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
- *\ * | *\ *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&5
-$as_echo "$as_me: WARNING: Libtool does not cope well with whitespace in \`pwd\`" >&2;} ;;
-esac
-
-macro_version='2.4.2'
-macro_revision='1.3337'
-
-
-
-
-
-
-
-
-
-
-
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
-# Backslashify metacharacters that are still active within
-# double-quoted strings.
-sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution to delay expansion of an escaped shell variable in a
-# double_quote_subst'ed string.
-delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-
-# Sed substitution to delay expansion of an escaped single quote.
-delay_single_quote_subst='s/'\''/'\'\\\\\\\'\''/g'
-
-# Sed substitution to avoid accidental globbing in evaled expressions
-no_glob_subst='s/\*/\\\*/g'
-
-ECHO='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO
-ECHO=$ECHO$ECHO$ECHO$ECHO$ECHO$ECHO
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to print strings" >&5
-$as_echo_n "checking how to print strings... " >&6; }
-# Test print first, because it will be a builtin if present.
-if test "X`( print -r -- -n ) 2>/dev/null`" = X-n && \
- test "X`print -r -- $ECHO 2>/dev/null`" = "X$ECHO"; then
- ECHO='print -r --'
-elif test "X`printf %s $ECHO 2>/dev/null`" = "X$ECHO"; then
- ECHO='printf %s\n'
-else
- # Use this function as a fallback that always works.
- func_fallback_echo ()
- {
- eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
- }
- ECHO='func_fallback_echo'
+# Check whether --enable-shared was given.
+if test "${enable_shared+set}" = set; then
+ enableval=$enable_shared; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_shared=yes ;;
+ no) enable_shared=no ;;
+ *)
+ enable_shared=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_shared=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_shared=yes
fi
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
- $ECHO ""
-}
-
-case "$ECHO" in
- printf*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: printf" >&5
-$as_echo "printf" >&6; } ;;
- print*) { $as_echo "$as_me:${as_lineno-$LINENO}: result: print -r" >&5
-$as_echo "print -r" >&6; } ;;
- *) { $as_echo "$as_me:${as_lineno-$LINENO}: result: cat" >&5
-$as_echo "cat" >&6; } ;;
-esac
-
-
-
-
-
-
-
-
-
+# Check whether --enable-static was given.
+if test "${enable_static+set}" = set; then
+ enableval=$enable_static; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_static=yes ;;
+ no) enable_static=no ;;
+ *)
+ enable_static=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_static=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_static=yes
+fi
+# Check whether --enable-fast-install was given.
+if test "${enable_fast_install+set}" = set; then
+ enableval=$enable_fast_install; p=${PACKAGE-default}
+ case $enableval in
+ yes) enable_fast_install=yes ;;
+ no) enable_fast_install=no ;;
+ *)
+ enable_fast_install=no
+ # Look at the argument we got. We use all the common list separators.
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for pkg in $enableval; do
+ IFS="$lt_save_ifs"
+ if test "X$pkg" = "X$p"; then
+ enable_fast_install=yes
+ fi
+ done
+ IFS="$lt_save_ifs"
+ ;;
+ esac
+else
+ enable_fast_install=yes
+fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for a sed that does not truncate output" >&5
-$as_echo_n "checking for a sed that does not truncate output... " >&6; }
-if ${ac_cv_path_SED+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for a sed that does not truncate output" >&5
+echo $ECHO_N "checking for a sed that does not truncate output... $ECHO_C" >&6; }
+if test "${lt_cv_path_SED+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_script=s/aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb/
- for ac_i in 1 2 3 4 5 6 7; do
- ac_script="$ac_script$as_nl$ac_script"
- done
- echo "$ac_script" 2>/dev/null | sed 99q >conftest.sed
- { ac_script=; unset ac_script;}
- if test -z "$SED"; then
- ac_path_SED_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
+ # Loop through the user's path and test for sed and gsed.
+# Then use that list of sed's as ones to test for truncation.
+as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_prog in sed gsed; do
+ for lt_ac_prog in sed gsed; do
for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_SED="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_SED" || continue
-# Check for GNU ac_path_SED and select it if it is found.
- # Check for GNU $ac_path_SED
-case `"$ac_path_SED" --version 2>&1` in
-*GNU*)
- ac_cv_path_SED="$ac_path_SED" ac_path_SED_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo '' >> "conftest.nl"
- "$ac_path_SED" -f conftest.sed < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_SED_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_SED="$ac_path_SED"
- ac_path_SED_max=$ac_count
- fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_SED_found && break 3
+ if { test -f "$as_dir/$lt_ac_prog$ac_exec_ext" && $as_test_x "$as_dir/$lt_ac_prog$ac_exec_ext"; }; then
+ lt_ac_sed_list="$lt_ac_sed_list $as_dir/$lt_ac_prog$ac_exec_ext"
+ fi
done
done
- done
+done
IFS=$as_save_IFS
- if test -z "$ac_cv_path_SED"; then
- as_fn_error $? "no acceptable sed could be found in \$PATH" "$LINENO" 5
+lt_ac_max=0
+lt_ac_count=0
+# Add /usr/xpg4/bin/sed as it is typically found on Solaris
+# along with /bin/sed that truncates output.
+for lt_ac_sed in $lt_ac_sed_list /usr/xpg4/bin/sed; do
+ test ! -f $lt_ac_sed && continue
+ cat /dev/null > conftest.in
+ lt_ac_count=0
+ echo $ECHO_N "0123456789$ECHO_C" >conftest.in
+ # Check for GNU sed and select it if it is found.
+ if "$lt_ac_sed" --version 2>&1 < /dev/null | grep 'GNU' > /dev/null; then
+ lt_cv_path_SED=$lt_ac_sed
+ break
fi
-else
- ac_cv_path_SED=$SED
-fi
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_SED" >&5
-$as_echo "$ac_cv_path_SED" >&6; }
- SED="$ac_cv_path_SED"
- rm -f conftest.sed
-
-test -z "$SED" && SED=sed
-Xsed="$SED -e 1s/^X//"
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for fgrep" >&5
-$as_echo_n "checking for fgrep... " >&6; }
-if ${ac_cv_path_FGREP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if echo 'ab*c' | $GREP -F 'ab*c' >/dev/null 2>&1
- then ac_cv_path_FGREP="$GREP -F"
- else
- if test -z "$FGREP"; then
- ac_path_FGREP_found=false
- # Loop through the user's path and test for each of PROGNAME-LIST
- as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH$PATH_SEPARATOR/usr/xpg4/bin
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_prog in fgrep; do
- for ac_exec_ext in '' $ac_executable_extensions; do
- ac_path_FGREP="$as_dir/$ac_prog$ac_exec_ext"
- as_fn_executable_p "$ac_path_FGREP" || continue
-# Check for GNU ac_path_FGREP and select it if it is found.
- # Check for GNU $ac_path_FGREP
-case `"$ac_path_FGREP" --version 2>&1` in
-*GNU*)
- ac_cv_path_FGREP="$ac_path_FGREP" ac_path_FGREP_found=:;;
-*)
- ac_count=0
- $as_echo_n 0123456789 >"conftest.in"
- while :
- do
- cat "conftest.in" "conftest.in" >"conftest.tmp"
- mv "conftest.tmp" "conftest.in"
- cp "conftest.in" "conftest.nl"
- $as_echo 'FGREP' >> "conftest.nl"
- "$ac_path_FGREP" FGREP < "conftest.nl" >"conftest.out" 2>/dev/null || break
- diff "conftest.out" "conftest.nl" >/dev/null 2>&1 || break
- as_fn_arith $ac_count + 1 && ac_count=$as_val
- if test $ac_count -gt ${ac_path_FGREP_max-0}; then
- # Best one so far, save it but keep looking for a better one
- ac_cv_path_FGREP="$ac_path_FGREP"
- ac_path_FGREP_max=$ac_count
+ while true; do
+ cat conftest.in conftest.in >conftest.tmp
+ mv conftest.tmp conftest.in
+ cp conftest.in conftest.nl
+ echo >>conftest.nl
+ $lt_ac_sed -e 's/a$//' < conftest.nl >conftest.out || break
+ cmp -s conftest.out conftest.nl || break
+ # 10000 chars as input seems more than enough
+ test $lt_ac_count -gt 10 && break
+ lt_ac_count=`expr $lt_ac_count + 1`
+ if test $lt_ac_count -gt $lt_ac_max; then
+ lt_ac_max=$lt_ac_count
+ lt_cv_path_SED=$lt_ac_sed
fi
- # 10*(2^10) chars as input seems more than enough
- test $ac_count -gt 10 && break
- done
- rm -f conftest.in conftest.tmp conftest.nl conftest.out;;
-esac
-
- $ac_path_FGREP_found && break 3
- done
- done
done
-IFS=$as_save_IFS
- if test -z "$ac_cv_path_FGREP"; then
- as_fn_error $? "no acceptable fgrep could be found in $PATH$PATH_SEPARATOR/usr/xpg4/bin" "$LINENO" 5
- fi
-else
- ac_cv_path_FGREP=$FGREP
-fi
+done
- fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_path_FGREP" >&5
-$as_echo "$ac_cv_path_FGREP" >&6; }
- FGREP="$ac_cv_path_FGREP"
-
-
-test -z "$GREP" && GREP=grep
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+SED=$lt_cv_path_SED
+{ echo "$as_me:$LINENO: result: $SED" >&5
+echo "${ECHO_T}$SED" >&6; }
# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then :
+if test "${with_gnu_ld+set}" = set; then
withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
@@ -12221,8 +11077,8 @@ fi
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
-$as_echo_n "checking for ld used by $CC... " >&6; }
+ { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -12235,9 +11091,9 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
[\\/]* | ?:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
# Canonicalize the pathname of ld
- ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
- while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
@@ -12251,14 +11107,14 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
;;
esac
elif test "$with_gnu_ld" = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
+ { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
+ { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
fi
-if ${lt_cv_path_LD+:} false; then :
- $as_echo_n "(cached) " >&6
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -z "$LD"; then
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
@@ -12288,17 +11144,19 @@ fi
LD="$lt_cv_path_LD"
if test -n "$LD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${lt_cv_prog_gnu_ld+:} false; then :
- $as_echo_n "(cached) " >&6
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# I'd rather use --version here, but apparently some GNU lds only accept -v.
case `$LD -v 2>&1 </dev/null` in
@@ -12310,315 +11168,20 @@ case `$LD -v 2>&1 </dev/null` in
;;
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
-$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
with_gnu_ld=$lt_cv_prog_gnu_ld
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether ln -s works" >&5
-$as_echo_n "checking whether ln -s works... " >&6; }
-LN_S=$as_ln_s
-if test "$LN_S" = "ln -s"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no, using $LN_S" >&5
-$as_echo "no, using $LN_S" >&6; }
-fi
-
-# find the maximum length of command line arguments
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking the maximum length of command line arguments" >&5
-$as_echo_n "checking the maximum length of command line arguments... " >&6; }
-if ${lt_cv_sys_max_cmd_len+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- i=0
- teststring="ABCD"
-
- case $build_os in
- msdosdjgpp*)
- # On DJGPP, this test can blow up pretty badly due to problems in libc
- # (any single argument exceeding 2000 bytes causes a buffer overrun
- # during glob expansion). Even if it were fixed, the result of this
- # check would be larger than it should be.
- lt_cv_sys_max_cmd_len=12288; # 12K is about right
- ;;
-
- gnu*)
- # Under GNU Hurd, this test is not required because there is
- # no limit to the length of command line arguments.
- # Libtool will interpret -1 as no limit whatsoever
- lt_cv_sys_max_cmd_len=-1;
- ;;
-
- cygwin* | mingw* | cegcc*)
- # On Win9x/ME, this test blows up -- it succeeds, but takes
- # about 5 minutes as the teststring grows exponentially.
- # Worse, since 9x/ME are not pre-emptively multitasking,
- # you end up with a "frozen" computer, even though with patience
- # the test eventually succeeds (with a max line length of 256k).
- # Instead, let's just punt: use the minimum linelength reported by
- # all of the supported platforms: 8192 (on NT/2K/XP).
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- mint*)
- # On MiNT this can take a long time and run out of memory.
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- amigaos*)
- # On AmigaOS with pdksh, this test takes hours, literally.
- # So we just punt and use a minimum line length of 8192.
- lt_cv_sys_max_cmd_len=8192;
- ;;
-
- netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
- # This has been around since 386BSD, at least. Likely further.
- if test -x /sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
- elif test -x /usr/sbin/sysctl; then
- lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
- else
- lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
- fi
- # And add a safety zone
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
- ;;
-
- interix*)
- # We know the value 262144 and hardcode it with a safety zone (like BSD)
- lt_cv_sys_max_cmd_len=196608
- ;;
-
- os2*)
- # The test takes a long time on OS/2.
- lt_cv_sys_max_cmd_len=8192
- ;;
-
- osf*)
- # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
- # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
- # nice to cause kernel panics so lets avoid the loop below.
- # First set a reasonable default.
- lt_cv_sys_max_cmd_len=16384
- #
- if test -x /sbin/sysconfig; then
- case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
- *1*) lt_cv_sys_max_cmd_len=-1 ;;
- esac
- fi
- ;;
- sco3.2v5*)
- lt_cv_sys_max_cmd_len=102400
- ;;
- sysv5* | sco5v6* | sysv4.2uw2*)
- kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
- if test -n "$kargmax"; then
- lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
- else
- lt_cv_sys_max_cmd_len=32768
- fi
- ;;
- *)
- lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
- if test -n "$lt_cv_sys_max_cmd_len"; then
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
- else
- # Make teststring a little bigger before we do anything with it.
- # a 1K string should be a reasonable start.
- for i in 1 2 3 4 5 6 7 8 ; do
- teststring=$teststring$teststring
- done
- SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
- # If test is not a shell built-in, we'll probably end up computing a
- # maximum length that is only half of the actual maximum length, but
- # we can't tell.
- while { test "X"`env echo "$teststring$teststring" 2>/dev/null` \
- = "X$teststring$teststring"; } >/dev/null 2>&1 &&
- test $i != 17 # 1/2 MB should be enough
- do
- i=`expr $i + 1`
- teststring=$teststring$teststring
- done
- # Only check the string length outside the loop.
- lt_cv_sys_max_cmd_len=`expr "X$teststring" : ".*" 2>&1`
- teststring=
- # Add a significant safety factor because C++ compilers can tack on
- # massive amounts of additional arguments before passing them to the
- # linker. It appears as though 1/2 is a usable value.
- lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
- fi
- ;;
- esac
-
-fi
-
-if test -n $lt_cv_sys_max_cmd_len ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sys_max_cmd_len" >&5
-$as_echo "$lt_cv_sys_max_cmd_len" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: none" >&5
-$as_echo "none" >&6; }
-fi
-max_cmd_len=$lt_cv_sys_max_cmd_len
-
-
-
-
-
-
-: ${CP="cp -f"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands some XSI constructs" >&5
-$as_echo_n "checking whether the shell understands some XSI constructs... " >&6; }
-# Try some XSI features
-xsi_shell=no
-( _lt_dummy="a/b/c"
- test "${_lt_dummy##*/},${_lt_dummy%/*},${_lt_dummy#??}"${_lt_dummy%"$_lt_dummy"}, \
- = c,a/b,b/c, \
- && eval 'test $(( 1 + 1 )) -eq 2 \
- && test "${#_lt_dummy}" -eq 5' ) >/dev/null 2>&1 \
- && xsi_shell=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $xsi_shell" >&5
-$as_echo "$xsi_shell" >&6; }
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the shell understands \"+=\"" >&5
-$as_echo_n "checking whether the shell understands \"+=\"... " >&6; }
-lt_shell_append=no
-( foo=bar; set foo baz; eval "$1+=\$2" && test "$foo" = barbaz ) \
- >/dev/null 2>&1 \
- && lt_shell_append=yes
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_shell_append" >&5
-$as_echo "$lt_shell_append" >&6; }
-
-
-if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
- lt_unset=unset
-else
- lt_unset=false
-fi
-
-
-
-
-
-# test EBCDIC or ASCII
-case `echo X|tr X '\101'` in
- A) # ASCII based system
- # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
- lt_SP2NL='tr \040 \012'
- lt_NL2SP='tr \015\012 \040\040'
- ;;
- *) # EBCDIC based system
- lt_SP2NL='tr \100 \n'
- lt_NL2SP='tr \r\n \100\100'
- ;;
-esac
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to $host format" >&5
-$as_echo_n "checking how to convert $build file names to $host format... " >&6; }
-if ${lt_cv_to_host_file_cmd+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- case $host in
- *-*-mingw* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_host_file_cmd=func_convert_file_msys_to_w32
- ;;
- *-*-cygwin* )
- lt_cv_to_host_file_cmd=func_convert_file_cygwin_to_w32
- ;;
- * ) # otherwise, assume *nix
- lt_cv_to_host_file_cmd=func_convert_file_nix_to_w32
- ;;
- esac
- ;;
- *-*-cygwin* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_host_file_cmd=func_convert_file_msys_to_cygwin
- ;;
- *-*-cygwin* )
- lt_cv_to_host_file_cmd=func_convert_file_noop
- ;;
- * ) # otherwise, assume *nix
- lt_cv_to_host_file_cmd=func_convert_file_nix_to_cygwin
- ;;
- esac
- ;;
- * ) # unhandled hosts (and "normal" native builds)
- lt_cv_to_host_file_cmd=func_convert_file_noop
- ;;
-esac
-
-fi
-
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_host_file_cmd" >&5
-$as_echo "$lt_cv_to_host_file_cmd" >&6; }
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to convert $build file names to toolchain format" >&5
-$as_echo_n "checking how to convert $build file names to toolchain format... " >&6; }
-if ${lt_cv_to_tool_file_cmd+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- #assume ordinary cross tools, or native build.
-lt_cv_to_tool_file_cmd=func_convert_file_noop
-case $host in
- *-*-mingw* )
- case $build in
- *-*-mingw* ) # actually msys
- lt_cv_to_tool_file_cmd=func_convert_file_msys_to_w32
- ;;
- esac
- ;;
-esac
-
-fi
-
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_to_tool_file_cmd" >&5
-$as_echo "$lt_cv_to_tool_file_cmd" >&6; }
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $LD option to reload object files" >&5
-$as_echo_n "checking for $LD option to reload object files... " >&6; }
-if ${lt_cv_ld_reload_flag+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $LD option to reload object files" >&5
+echo $ECHO_N "checking for $LD option to reload object files... $ECHO_C" >&6; }
+if test "${lt_cv_ld_reload_flag+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_ld_reload_flag='-r'
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_reload_flag" >&5
-$as_echo "$lt_cv_ld_reload_flag" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_ld_reload_flag" >&5
+echo "${ECHO_T}$lt_cv_ld_reload_flag" >&6; }
reload_flag=$lt_cv_ld_reload_flag
case $reload_flag in
"" | " "*) ;;
@@ -12626,11 +11189,6 @@ case $reload_flag in
esac
reload_cmds='$LD$reload_flag -o $output$reload_objs'
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
- if test "$GCC" != yes; then
- reload_cmds=false
- fi
- ;;
darwin*)
if test "$GCC" = yes; then
reload_cmds='$LTCC $LTCFLAGS -nostdlib ${wl}-r -o $output$reload_objs'
@@ -12640,117 +11198,21 @@ case $host_os in
;;
esac
-
-
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
-set dummy ${ac_tool_prefix}objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OBJDUMP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$OBJDUMP"; then
- ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-OBJDUMP=$ac_cv_prog_OBJDUMP
-if test -n "$OBJDUMP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OBJDUMP" >&5
-$as_echo "$OBJDUMP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OBJDUMP"; then
- ac_ct_OBJDUMP=$OBJDUMP
- # Extract the first word of "objdump", so it can be a program name with args.
-set dummy objdump; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OBJDUMP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_OBJDUMP"; then
- ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_OBJDUMP="objdump"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
-if test -n "$ac_ct_OBJDUMP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OBJDUMP" >&5
-$as_echo "$ac_ct_OBJDUMP" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_OBJDUMP" = x; then
- OBJDUMP="false"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- OBJDUMP=$ac_ct_OBJDUMP
- fi
+{ echo "$as_me:$LINENO: checking whether ln -s works" >&5
+echo $ECHO_N "checking whether ln -s works... $ECHO_C" >&6; }
+LN_S=$as_ln_s
+if test "$LN_S" = "ln -s"; then
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
else
- OBJDUMP="$ac_cv_prog_OBJDUMP"
+ { echo "$as_me:$LINENO: result: no, using $LN_S" >&5
+echo "${ECHO_T}no, using $LN_S" >&6; }
fi
-test -z "$OBJDUMP" && OBJDUMP=objdump
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to recognize dependent libraries" >&5
-$as_echo_n "checking how to recognize dependent libraries... " >&6; }
-if ${lt_cv_deplibs_check_method+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking how to recognize dependent libraries" >&5
+echo $ECHO_N "checking how to recognize dependent libraries... $ECHO_C" >&6; }
+if test "${lt_cv_deplibs_check_method+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_file_magic_cmd='$MAGIC_CMD'
lt_cv_file_magic_test_file=
@@ -12767,7 +11229,7 @@ lt_cv_deplibs_check_method='unknown'
# whether `pass_all' will *always* work, you probably want this one.
case $host_os in
-aix[4-9]*)
+aix4* | aix5*)
lt_cv_deplibs_check_method=pass_all
;;
@@ -12791,29 +11253,21 @@ mingw* | pw32*)
# Base MSYS/MinGW do not provide the 'file' command needed by
# func_win32_libid shell function, so use a weaker test based on 'objdump',
# unless we find 'file', for example because we are cross-compiling.
- # func_win32_libid assumes BSD nm, so disallow it if using MS dumpbin.
- if ( test "$lt_cv_nm_interface" = "BSD nm" && file / ) >/dev/null 2>&1; then
+ if ( file / ) >/dev/null 2>&1; then
lt_cv_deplibs_check_method='file_magic ^x86 archive import|^x86 DLL'
lt_cv_file_magic_cmd='func_win32_libid'
else
- # Keep this pattern in sync with the one in func_win32_libid.
- lt_cv_deplibs_check_method='file_magic file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)'
+ lt_cv_deplibs_check_method='file_magic file format pei*-i386(.*architecture: i386)?'
lt_cv_file_magic_cmd='$OBJDUMP -f'
fi
;;
-cegcc*)
- # use the weaker test based on 'objdump'. See mingw*.
- lt_cv_deplibs_check_method='file_magic file format pe-arm-.*little(.*architecture: arm)?'
- lt_cv_file_magic_cmd='$OBJDUMP -f'
- ;;
-
darwin* | rhapsody*)
lt_cv_deplibs_check_method=pass_all
;;
freebsd* | dragonfly*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
case $host_cpu in
i*86 )
# Not sure whether the presence of OpenBSD here was a mistake.
@@ -12832,10 +11286,6 @@ gnu*)
lt_cv_deplibs_check_method=pass_all
;;
-haiku*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
hpux10.20* | hpux11*)
lt_cv_file_magic_cmd=/usr/bin/file
case $host_cpu in
@@ -12844,11 +11294,11 @@ hpux10.20* | hpux11*)
lt_cv_file_magic_test_file=/usr/lib/hpux32/libc.so
;;
hppa*64*)
- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF[ -][0-9][0-9])(-bit)?( [LM]SB)? shared object( file)?[, -]* PA-RISC [0-9]\.[0-9]'
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|ELF-[0-9][0-9]) shared object file - PA-RISC [0-9].[0-9]'
lt_cv_file_magic_test_file=/usr/lib/pa20_64/libc.sl
;;
*)
- lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9]\.[0-9]) shared library'
+ lt_cv_deplibs_check_method='file_magic (s[0-9][0-9][0-9]|PA-RISC[0-9].[0-9]) shared library'
lt_cv_file_magic_test_file=/usr/lib/libc.sl
;;
esac
@@ -12869,13 +11319,13 @@ irix5* | irix6* | nonstopux*)
lt_cv_deplibs_check_method=pass_all
;;
-# This must be glibc/ELF.
-linux* | k*bsd*-gnu | kopensolaris*-gnu)
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
lt_cv_deplibs_check_method=pass_all
;;
netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ > /dev/null; then
+ if echo __ELF__ | $CC -E - | grep __ELF__ > /dev/null; then
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so|_pic\.a)$'
@@ -12888,12 +11338,12 @@ newos6*)
lt_cv_file_magic_test_file=/usr/lib/libnls.so
;;
-*nto* | *qnx*)
- lt_cv_deplibs_check_method=pass_all
+nto-qnx*)
+ lt_cv_deplibs_check_method=unknown
;;
openbsd*)
- if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|\.so|_pic\.a)$'
else
lt_cv_deplibs_check_method='match_pattern /lib[^/]+(\.so\.[0-9]+\.[0-9]+|_pic\.a)$'
@@ -12912,10 +11362,6 @@ solaris*)
lt_cv_deplibs_check_method=pass_all
;;
-sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
- lt_cv_deplibs_check_method=pass_all
- ;;
-
sysv4 | sysv4.3*)
case $host_vendor in
motorola)
@@ -12943,29 +11389,14 @@ sysv4 | sysv4.3*)
esac
;;
-tpf*)
+sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
lt_cv_deplibs_check_method=pass_all
;;
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_deplibs_check_method" >&5
-$as_echo "$lt_cv_deplibs_check_method" >&6; }
-
-file_magic_glob=
-want_nocaseglob=no
-if test "$build" = "$host"; then
- case $host_os in
- mingw* | pw32*)
- if ( shopt | grep nocaseglob ) >/dev/null 2>&1; then
- want_nocaseglob=yes
- else
- file_magic_glob=`echo aAbBcCdDeEfFgGhHiIjJkKlLmMnNoOpPqQrRsStTuUvVwWxXyYzZ | $SED -e "s/\(..\)/s\/[\1]\/[\1]\/g;/g"`
- fi
- ;;
- esac
-fi
-
+{ echo "$as_me:$LINENO: result: $lt_cv_deplibs_check_method" >&5
+echo "${ECHO_T}$lt_cv_deplibs_check_method" >&6; }
file_magic_cmd=$lt_cv_file_magic_cmd
deplibs_check_method=$lt_cv_deplibs_check_method
test -z "$deplibs_check_method" && deplibs_check_method=unknown
@@ -12973,31 +11404,234 @@ test -z "$deplibs_check_method" && deplibs_check_method=unknown
+# 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
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval=$enable_libtool_lock;
+fi
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+# Some flags need to be propagated to the compiler or linker for good
+# libtool support.
+case $host in
+ia64-*-hpux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *ELF-32*)
+ HPUX_IA64_MODE="32"
+ ;;
+ *ELF-64*)
+ HPUX_IA64_MODE="64"
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-irix6*)
+ # Find out which ABI we are using.
+ echo '#line 11447 "configure"' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ if test "$lt_cv_prog_gnu_ld" = yes; then
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -melf32bsmip"
+ ;;
+ *N32*)
+ LD="${LD-ld} -melf32bmipn32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -melf64bmip"
+ ;;
+ esac
+ else
+ case `/usr/bin/file conftest.$ac_objext` in
+ *32-bit*)
+ LD="${LD-ld} -32"
+ ;;
+ *N32*)
+ LD="${LD-ld} -n32"
+ ;;
+ *64-bit*)
+ LD="${LD-ld} -64"
+ ;;
+ esac
+ fi
+ fi
+ rm -rf conftest*
+ ;;
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+s390*-*linux*|sparc*-*linux*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *32-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_i386_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_i386"
+ ;;
+ ppc64-*linux*|powerpc64-*linux*)
+ LD="${LD-ld} -m elf32ppclinux"
+ ;;
+ s390x-*linux*)
+ LD="${LD-ld} -m elf_s390"
+ ;;
+ sparc64-*linux*)
+ LD="${LD-ld} -m elf32_sparc"
+ ;;
+ esac
+ ;;
+ *64-bit*)
+ case $host in
+ x86_64-*kfreebsd*-gnu)
+ LD="${LD-ld} -m elf_x86_64_fbsd"
+ ;;
+ x86_64-*linux*)
+ LD="${LD-ld} -m elf_x86_64"
+ ;;
+ ppc*-*linux*|powerpc*-*linux*)
+ LD="${LD-ld} -m elf64ppc"
+ ;;
+ s390*-*linux*)
+ LD="${LD-ld} -m elf64_s390"
+ ;;
+ sparc*-*linux*)
+ LD="${LD-ld} -m elf64_sparc"
+ ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
+*-*-sco3.2v5*)
+ # On SCO OpenServer 5, we need -belf to get full-featured binaries.
+ SAVE_CFLAGS="$CFLAGS"
+ CFLAGS="$CFLAGS -belf"
+ { echo "$as_me:$LINENO: checking whether the C compiler needs -belf" >&5
+echo $ECHO_N "checking whether the C compiler needs -belf... $ECHO_C" >&6; }
+if test "${lt_cv_cc_needs_belf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ 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
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+int
+main ()
+{
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ lt_cv_cc_needs_belf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ lt_cv_cc_needs_belf=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+ 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
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_cc_needs_belf" >&5
+echo "${ECHO_T}$lt_cv_cc_needs_belf" >&6; }
+ if test x"$lt_cv_cc_needs_belf" != x"yes"; then
+ # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
+ CFLAGS="$SAVE_CFLAGS"
+ fi
+ ;;
+sparc*-*solaris*)
+ # Find out which ABI we are using.
+ echo 'int i;' > conftest.$ac_ext
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
+ case `/usr/bin/file conftest.o` in
+ *64-bit*)
+ case $lt_cv_prog_gnu_ld in
+ yes*) LD="${LD-ld} -m elf64_sparc" ;;
+ *) LD="${LD-ld} -64" ;;
+ esac
+ ;;
+ esac
+ fi
+ rm -rf conftest*
+ ;;
-
-
-
-
-if test -n "$ac_tool_prefix"; then
+*-*-cygwin* | *-*-mingw* | *-*-pw32*)
+ if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}dlltool", so it can be a program name with args.
set dummy ${ac_tool_prefix}dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DLLTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_DLLTOOL+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$DLLTOOL"; then
ac_cv_prog_DLLTOOL="$DLLTOOL" # Let the user override the test.
@@ -13007,25 +11641,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_DLLTOOL="${ac_tool_prefix}dlltool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
DLLTOOL=$ac_cv_prog_DLLTOOL
if test -n "$DLLTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DLLTOOL" >&5
-$as_echo "$DLLTOOL" >&6; }
+ { echo "$as_me:$LINENO: result: $DLLTOOL" >&5
+echo "${ECHO_T}$DLLTOOL" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -13034,10 +11668,10 @@ if test -z "$ac_cv_prog_DLLTOOL"; then
ac_ct_DLLTOOL=$DLLTOOL
# Extract the first word of "dlltool", so it can be a program name with args.
set dummy dlltool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DLLTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_DLLTOOL+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_DLLTOOL"; then
ac_cv_prog_ac_ct_DLLTOOL="$ac_ct_DLLTOOL" # Let the user override the test.
@@ -13047,25 +11681,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_DLLTOOL="dlltool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
ac_ct_DLLTOOL=$ac_cv_prog_ac_ct_DLLTOOL
if test -n "$ac_ct_DLLTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DLLTOOL" >&5
-$as_echo "$ac_ct_DLLTOOL" >&6; }
+ { echo "$as_me:$LINENO: result: $ac_ct_DLLTOOL" >&5
+echo "${ECHO_T}$ac_ct_DLLTOOL" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_DLLTOOL" = x; then
@@ -13073,8 +11707,12 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
DLLTOOL=$ac_ct_DLLTOOL
@@ -13083,498 +11721,717 @@ else
DLLTOOL="$ac_cv_prog_DLLTOOL"
fi
-test -z "$DLLTOOL" && DLLTOOL=dlltool
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to associate runtime and link libraries" >&5
-$as_echo_n "checking how to associate runtime and link libraries... " >&6; }
-if ${lt_cv_sharedlib_from_linklib_cmd+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_sharedlib_from_linklib_cmd='unknown'
-
-case $host_os in
-cygwin* | mingw* | pw32* | cegcc*)
- # two different shell functions defined in ltmain.sh
- # decide which to use based on capabilities of $DLLTOOL
- case `$DLLTOOL --help 2>&1` in
- *--identify-strict*)
- lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib
- ;;
- *)
- lt_cv_sharedlib_from_linklib_cmd=func_cygming_dll_for_implib_fallback
- ;;
- esac
- ;;
-*)
- # fallback: assume linklib IS sharedlib
- lt_cv_sharedlib_from_linklib_cmd="$ECHO"
- ;;
-esac
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_sharedlib_from_linklib_cmd" >&5
-$as_echo "$lt_cv_sharedlib_from_linklib_cmd" >&6; }
-sharedlib_from_linklib_cmd=$lt_cv_sharedlib_from_linklib_cmd
-test -z "$sharedlib_from_linklib_cmd" && sharedlib_from_linklib_cmd=$ECHO
-
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
- for ac_prog in ar
- do
- # Extract the first word of "$ac_tool_prefix$ac_prog", so it can be a program name with args.
-set dummy $ac_tool_prefix$ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_AR+:} false; then :
- $as_echo_n "(cached) " >&6
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}as", so it can be a program name with args.
+set dummy ${ac_tool_prefix}as; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AS+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$AR"; then
- ac_cv_prog_AR="$AR" # Let the user override the test.
+ if test -n "$AS"; then
+ ac_cv_prog_AS="$AS" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_AR="$ac_tool_prefix$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AS="${ac_tool_prefix}as"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
-AR=$ac_cv_prog_AR
-if test -n "$AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $AR" >&5
-$as_echo "$AR" >&6; }
+AS=$ac_cv_prog_AS
+if test -n "$AS"; then
+ { echo "$as_me:$LINENO: result: $AS" >&5
+echo "${ECHO_T}$AS" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- test -n "$AR" && break
- done
fi
-if test -z "$AR"; then
- ac_ct_AR=$AR
- for ac_prog in ar
-do
- # Extract the first word of "$ac_prog", so it can be a program name with args.
-set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_AR+:} false; then :
- $as_echo_n "(cached) " >&6
+if test -z "$ac_cv_prog_AS"; then
+ ac_ct_AS=$AS
+ # Extract the first word of "as", so it can be a program name with args.
+set dummy as; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AS+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$ac_ct_AR"; then
- ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
+ if test -n "$ac_ct_AS"; then
+ ac_cv_prog_ac_ct_AS="$ac_ct_AS" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_AR="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AS="as"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
-ac_ct_AR=$ac_cv_prog_ac_ct_AR
-if test -n "$ac_ct_AR"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_AR" >&5
-$as_echo "$ac_ct_AR" >&6; }
+ac_ct_AS=$ac_cv_prog_ac_ct_AS
+if test -n "$ac_ct_AS"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_AS" >&5
+echo "${ECHO_T}$ac_ct_AS" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
-
- test -n "$ac_ct_AR" && break
-done
-
- if test "x$ac_ct_AR" = x; then
- AR="false"
+ if test "x$ac_ct_AS" = x; then
+ AS="false"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
- AR=$ac_ct_AR
+ AS=$ac_ct_AS
fi
-fi
-
-: ${AR=ar}
-: ${AR_FLAGS=cru}
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for archiver @FILE support" >&5
-$as_echo_n "checking for archiver @FILE support... " >&6; }
-if ${lt_cv_ar_at_file+:} false; then :
- $as_echo_n "(cached) " >&6
else
- lt_cv_ar_at_file=no
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- echo conftest.$ac_objext > conftest.lst
- lt_ar_try='$AR $AR_FLAGS libconftest.a @conftest.lst >&5'
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
- (eval $lt_ar_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
- if test "$ac_status" -eq 0; then
- # Ensure the archiver fails upon bogus file names.
- rm -f conftest.$ac_objext libconftest.a
- { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$lt_ar_try\""; } >&5
- (eval $lt_ar_try) 2>&5
- ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
- if test "$ac_status" -ne 0; then
- lt_cv_ar_at_file=@
- fi
- fi
- rm -f conftest.* libconftest.a
-
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ar_at_file" >&5
-$as_echo "$lt_cv_ar_at_file" >&6; }
-
-if test "x$lt_cv_ar_at_file" = xno; then
- archiver_list_spec=
-else
- archiver_list_spec=$lt_cv_ar_at_file
+ AS="$ac_cv_prog_AS"
fi
-
-
-
-
-
-
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
-set dummy ${ac_tool_prefix}strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_STRIP+:} false; then :
- $as_echo_n "(cached) " >&6
+ if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}objdump", so it can be a program name with args.
+set dummy ${ac_tool_prefix}objdump; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_OBJDUMP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$STRIP"; then
- ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
+ if test -n "$OBJDUMP"; then
+ ac_cv_prog_OBJDUMP="$OBJDUMP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_STRIP="${ac_tool_prefix}strip"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_OBJDUMP="${ac_tool_prefix}objdump"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
-STRIP=$ac_cv_prog_STRIP
-if test -n "$STRIP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $STRIP" >&5
-$as_echo "$STRIP" >&6; }
+OBJDUMP=$ac_cv_prog_OBJDUMP
+if test -n "$OBJDUMP"; then
+ { echo "$as_me:$LINENO: result: $OBJDUMP" >&5
+echo "${ECHO_T}$OBJDUMP" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
fi
-if test -z "$ac_cv_prog_STRIP"; then
- ac_ct_STRIP=$STRIP
- # Extract the first word of "strip", so it can be a program name with args.
-set dummy strip; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_STRIP+:} false; then :
- $as_echo_n "(cached) " >&6
+if test -z "$ac_cv_prog_OBJDUMP"; then
+ ac_ct_OBJDUMP=$OBJDUMP
+ # Extract the first word of "objdump", so it can be a program name with args.
+set dummy objdump; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_OBJDUMP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$ac_ct_STRIP"; then
- ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
+ if test -n "$ac_ct_OBJDUMP"; then
+ ac_cv_prog_ac_ct_OBJDUMP="$ac_ct_OBJDUMP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_STRIP="strip"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_OBJDUMP="objdump"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
-ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
-if test -n "$ac_ct_STRIP"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_STRIP" >&5
-$as_echo "$ac_ct_STRIP" >&6; }
+ac_ct_OBJDUMP=$ac_cv_prog_ac_ct_OBJDUMP
+if test -n "$ac_ct_OBJDUMP"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_OBJDUMP" >&5
+echo "${ECHO_T}$ac_ct_OBJDUMP" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- if test "x$ac_ct_STRIP" = x; then
- STRIP=":"
+ if test "x$ac_ct_OBJDUMP" = x; then
+ OBJDUMP="false"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
- STRIP=$ac_ct_STRIP
+ OBJDUMP=$ac_ct_OBJDUMP
fi
else
- STRIP="$ac_cv_prog_STRIP"
+ OBJDUMP="$ac_cv_prog_OBJDUMP"
fi
-test -z "$STRIP" && STRIP=:
-
+ ;;
+esac
+need_locks="$enable_libtool_lock"
-if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
-set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$RANLIB"; then
- ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
+for ac_header in dlfcn.h
do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-RANLIB=$ac_cv_prog_RANLIB
-if test -n "$RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
fi
-
-
-fi
-if test -z "$ac_cv_prog_RANLIB"; then
- ac_ct_RANLIB=$RANLIB
- # Extract the first word of "ranlib", so it can be a program name with args.
-set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
else
- if test -n "$ac_ct_RANLIB"; then
- ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_RANLIB="ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-fi
-fi
-ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
-if test -n "$ac_ct_RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ ac_header_compiler=no
fi
- if test "x$ac_ct_RANLIB" = x; then
- RANLIB=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
esac
- RANLIB=$ac_ct_RANLIB
- fi
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
else
- RANLIB="$ac_cv_prog_RANLIB"
-fi
-
-test -z "$RANLIB" && RANLIB=:
-
-
-
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_header_preproc=no
+fi
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
-# Determine commands to create old-style static archives.
-old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
-old_postinstall_cmds='chmod 644 $oldlib'
-old_postuninstall_cmds=
-
-if test -n "$RANLIB"; then
- case $host_os in
- openbsd*)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$tool_oldlib"
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
;;
- *)
- old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$tool_oldlib"
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ---------------------------------- ##
+## Report this to gmp-bugs@gmplib.org ##
+## ---------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
;;
- esac
- old_archive_cmds="$old_archive_cmds~\$RANLIB \$tool_oldlib"
-fi
-
-case $host_os in
- darwin*)
- lock_old_archive_extraction=yes ;;
- *)
- lock_old_archive_extraction=no ;;
esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
+_ACEOF
+fi
+done
+if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+{ echo "$as_me:$LINENO: checking how to run the C++ preprocessor" >&5
+echo $ECHO_N "checking how to run the C++ preprocessor... $ECHO_C" >&6; }
+if test -z "$CXXCPP"; then
+ if test "${ac_cv_prog_CXXCPP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ # Double quotes because CXXCPP needs to be expanded
+ for CXXCPP in "$CXX -E" "/lib/cpp"
+ do
+ ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ break
+fi
+ done
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+ CXXCPP=$ac_cv_prog_CXXCPP
+else
+ ac_cv_prog_CXXCPP=$CXXCPP
+fi
+{ echo "$as_me:$LINENO: result: $CXXCPP" >&5
+echo "${ECHO_T}$CXXCPP" >&6; }
+ac_preproc_ok=false
+for ac_cxx_preproc_warn_flag in '' yes
+do
+ # Use a header file that comes with gcc, so configuring glibc
+ # with a fresh cross-compiler works.
+ # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ # <limits.h> exists even on freestanding compilers.
+ # On the NeXT, cc -E runs the code through the compiler's parser,
+ # not just through cpp. "Syntax error" is here to catch this case.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+ Syntax error
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ :
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ # Broken: fails on valid input.
+continue
+fi
+rm -f conftest.err conftest.$ac_ext
+ # OK, works on sane cases. Now check whether nonexistent headers
+ # can be detected and how.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <ac_nonexistent.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ # Broken: success on invalid input.
+continue
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ # Passes both tests.
+ac_preproc_ok=:
+break
+fi
+rm -f conftest.err conftest.$ac_ext
+done
+# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
+rm -f conftest.err conftest.$ac_ext
+if $ac_preproc_ok; then
+ :
+else
+ { { echo "$as_me:$LINENO: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&5
+echo "$as_me: error: C++ preprocessor \"$CXXCPP\" fails sanity check
+See \`config.log' for more details." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+ac_ext=cpp
+ac_cpp='$CXXCPP $CPPFLAGS'
+ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
+ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
+ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+fi
+# Autoconf 2.13's AC_OBJEXT and AC_EXEEXT macros only works for C compilers!
+# find the maximum length of command line arguments
+{ echo "$as_me:$LINENO: checking the maximum length of command line arguments" >&5
+echo $ECHO_N "checking the maximum length of command line arguments... $ECHO_C" >&6; }
+if test "${lt_cv_sys_max_cmd_len+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ i=0
+ teststring="ABCD"
+ case $build_os in
+ msdosdjgpp*)
+ # On DJGPP, this test can blow up pretty badly due to problems in libc
+ # (any single argument exceeding 2000 bytes causes a buffer overrun
+ # during glob expansion). Even if it were fixed, the result of this
+ # check would be larger than it should be.
+ lt_cv_sys_max_cmd_len=12288; # 12K is about right
+ ;;
+ gnu*)
+ # Under GNU Hurd, this test is not required because there is
+ # no limit to the length of command line arguments.
+ # Libtool will interpret -1 as no limit whatsoever
+ lt_cv_sys_max_cmd_len=-1;
+ ;;
+ cygwin* | mingw*)
+ # On Win9x/ME, this test blows up -- it succeeds, but takes
+ # about 5 minutes as the teststring grows exponentially.
+ # Worse, since 9x/ME are not pre-emptively multitasking,
+ # you end up with a "frozen" computer, even though with patience
+ # the test eventually succeeds (with a max line length of 256k).
+ # Instead, let's just punt: use the minimum linelength reported by
+ # all of the supported platforms: 8192 (on NT/2K/XP).
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+ amigaos*)
+ # On AmigaOS with pdksh, this test takes hours, literally.
+ # So we just punt and use a minimum line length of 8192.
+ lt_cv_sys_max_cmd_len=8192;
+ ;;
+ netbsd* | freebsd* | openbsd* | darwin* | dragonfly*)
+ # This has been around since 386BSD, at least. Likely further.
+ if test -x /sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/sbin/sysctl -n kern.argmax`
+ elif test -x /usr/sbin/sysctl; then
+ lt_cv_sys_max_cmd_len=`/usr/sbin/sysctl -n kern.argmax`
+ else
+ lt_cv_sys_max_cmd_len=65536 # usable default for all BSDs
+ fi
+ # And add a safety zone
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ ;;
+ interix*)
+ # We know the value 262144 and hardcode it with a safety zone (like BSD)
+ lt_cv_sys_max_cmd_len=196608
+ ;;
+ osf*)
+ # Dr. Hans Ekkehard Plesser reports seeing a kernel panic running configure
+ # due to this test when exec_disable_arg_limit is 1 on Tru64. It is not
+ # nice to cause kernel panics so lets avoid the loop below.
+ # First set a reasonable default.
+ lt_cv_sys_max_cmd_len=16384
+ #
+ if test -x /sbin/sysconfig; then
+ case `/sbin/sysconfig -q proc exec_disable_arg_limit` in
+ *1*) lt_cv_sys_max_cmd_len=-1 ;;
+ esac
+ fi
+ ;;
+ sco3.2v5*)
+ lt_cv_sys_max_cmd_len=102400
+ ;;
+ sysv5* | sco5v6* | sysv4.2uw2*)
+ kargmax=`grep ARG_MAX /etc/conf/cf.d/stune 2>/dev/null`
+ if test -n "$kargmax"; then
+ lt_cv_sys_max_cmd_len=`echo $kargmax | sed 's/.*[ ]//'`
+ else
+ lt_cv_sys_max_cmd_len=32768
+ fi
+ ;;
+ *)
+ lt_cv_sys_max_cmd_len=`(getconf ARG_MAX) 2> /dev/null`
+ if test -n "$lt_cv_sys_max_cmd_len"; then
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 4`
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \* 3`
+ else
+ SHELL=${SHELL-${CONFIG_SHELL-/bin/sh}}
+ while (test "X"`$SHELL $0 --fallback-echo "X$teststring" 2>/dev/null` \
+ = "XX$teststring") >/dev/null 2>&1 &&
+ new_result=`expr "X$teststring" : ".*" 2>&1` &&
+ lt_cv_sys_max_cmd_len=$new_result &&
+ test $i != 17 # 1/2 MB should be enough
+ do
+ i=`expr $i + 1`
+ teststring=$teststring$teststring
+ done
+ teststring=
+ # Add a significant safety factor because C++ compilers can tack on massive
+ # amounts of additional arguments before passing them to the linker.
+ # It appears as though 1/2 is a usable value.
+ lt_cv_sys_max_cmd_len=`expr $lt_cv_sys_max_cmd_len \/ 2`
+ fi
+ ;;
+ esac
+fi
+if test -n $lt_cv_sys_max_cmd_len ; then
+ { echo "$as_me:$LINENO: result: $lt_cv_sys_max_cmd_len" >&5
+echo "${ECHO_T}$lt_cv_sys_max_cmd_len" >&6; }
+else
+ { echo "$as_me:$LINENO: result: none" >&5
+echo "${ECHO_T}none" >&6; }
+fi
-# 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
# Check for command to grab the raw symbol name followed by C symbol from nm.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking command to parse $NM output from $compiler object" >&5
-$as_echo_n "checking command to parse $NM output from $compiler object... " >&6; }
-if ${lt_cv_sys_global_symbol_pipe+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking command to parse $NM output from $compiler object" >&5
+echo $ECHO_N "checking command to parse $NM output from $compiler object... $ECHO_C" >&6; }
+if test "${lt_cv_sys_global_symbol_pipe+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# These are sane defaults that work on at least a few old systems.
@@ -13586,18 +12443,33 @@ symcode='[BCDEGRST]'
# Regexp to match symbols that can be accessed directly from C.
sympat='\([_A-Za-z][_A-Za-z0-9]*\)'
+# Transform an extracted symbol line into a proper C declaration
+lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^. .* \(.*\)$/extern int \1;/p'"
+
+# Transform an extracted symbol line into symbol name and symbol address
+lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+
# Define system-specific variables.
case $host_os in
aix*)
symcode='[BCDT]'
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32*)
symcode='[ABCDGISTW]'
;;
-hpux*)
+hpux*) # Its linker distinguishes data from code symbols
if test "$host_cpu" = ia64; then
symcode='[ABCDEGRST]'
fi
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ ;;
+linux* | k*bsd*-gnu)
+ if test "$host_cpu" = ia64; then
+ symcode='[ABCDGIRSTW]'
+ lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
+ lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\) $/ {\\\"\1\\\", (lt_ptr) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (lt_ptr) \&\2},/p'"
+ fi
;;
irix* | nonstopux*)
symcode='[BCDEGRST]'
@@ -13622,87 +12494,57 @@ sysv4)
;;
esac
-# If we're using GNU nm, then use its standard symbol codes.
-case `$NM -V 2>&1` in
-*GNU* | *'with BFD'*)
- symcode='[ABCDGIRSTW]' ;;
-esac
-
-# Transform an extracted symbol line into a proper C declaration.
-# Some systems (esp. on ia64) link data and code symbols differently,
-# so use this general approach.
-lt_cv_sys_global_symbol_to_cdecl="sed -n -e 's/^T .* \(.*\)$/extern int \1();/p' -e 's/^$symcode* .* \(.*\)$/extern char \1;/p'"
-
-# Transform an extracted symbol line into symbol name and symbol address
-lt_cv_sys_global_symbol_to_c_name_address="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"\2\", (void *) \&\2},/p'"
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix="sed -n -e 's/^: \([^ ]*\)[ ]*$/ {\\\"\1\\\", (void *) 0},/p' -e 's/^$symcode* \([^ ]*\) \(lib[^ ]*\)$/ {\"\2\", (void *) \&\2},/p' -e 's/^$symcode* \([^ ]*\) \([^ ]*\)$/ {\"lib\2\", (void *) \&\2},/p'"
-
# Handle CRLF in mingw tool chain
opt_cr=
case $build_os in
mingw*)
- opt_cr=`$ECHO 'x\{0,1\}' | tr x '\015'` # option cr in regexp
+ opt_cr=`echo 'x\{0,1\}' | tr x '\015'` # option cr in regexp
;;
esac
-# Try without a prefix underscore, then with it.
+# If we're using GNU nm, then use its standard symbol codes.
+case `$NM -V 2>&1` in
+*GNU* | *'with BFD'*)
+ symcode='[ABCDGIRSTW]' ;;
+esac
+
+# Try without a prefix undercore, then with it.
for ac_symprfx in "" "_"; do
# Transform symcode, sympat, and symprfx into a raw symbol and a C symbol.
symxfrm="\\1 $ac_symprfx\\2 \\2"
# Write the raw and C identifiers.
- if test "$lt_cv_nm_interface" = "MS dumpbin"; then
- # Fake it for dumpbin and say T for any non-static function
- # and D for any global variable.
- # Also find C++ and __fastcall symbols from MSVC++,
- # which start with @ or ?.
- lt_cv_sys_global_symbol_pipe="$AWK '"\
-" {last_section=section; section=\$ 3};"\
-" /^COFF SYMBOL TABLE/{for(i in hide) delete hide[i]};"\
-" /Section length .*#relocs.*(pick any)/{hide[last_section]=1};"\
-" \$ 0!~/External *\|/{next};"\
-" / 0+ UNDEF /{next}; / UNDEF \([^|]\)*()/{next};"\
-" {if(hide[section]) next};"\
-" {f=0}; \$ 0~/\(\).*\|/{f=1}; {printf f ? \"T \" : \"D \"};"\
-" {split(\$ 0, a, /\||\r/); split(a[2], s)};"\
-" s[1]~/^[@?]/{print s[1], s[1]; next};"\
-" s[1]~prfx {split(s[1],t,\"@\"); print t[1], substr(t[1],length(prfx))}"\
-" ' prfx=^$ac_symprfx"
- else
- lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
- fi
- lt_cv_sys_global_symbol_pipe="$lt_cv_sys_global_symbol_pipe | sed '/ __gnu_lto/d'"
+ lt_cv_sys_global_symbol_pipe="sed -n -e 's/^.*[ ]\($symcode$symcode*\)[ ][ ]*$ac_symprfx$sympat$opt_cr$/$symxfrm/p'"
# Check to see that the pipe works correctly.
pipe_works=no
rm -f conftest*
- cat > conftest.$ac_ext <<_LT_EOF
+ cat > conftest.$ac_ext <<EOF
#ifdef __cplusplus
extern "C" {
#endif
char nm_test_var;
-void nm_test_func(void);
-void nm_test_func(void){}
+void nm_test_func(){}
#ifdef __cplusplus
}
#endif
int main(){nm_test_var='a';nm_test_func();return(0);}
-_LT_EOF
+EOF
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ if { (eval echo "$as_me:$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; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
# Now try to grab the symbols.
nlist=conftest.nm
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist\""; } >&5
- (eval $NM conftest.$ac_objext \| "$lt_cv_sys_global_symbol_pipe" \> $nlist) 2>&5
+ if { (eval echo "$as_me:$LINENO: \"$NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist\"") >&5
+ (eval $NM conftest.$ac_objext \| $lt_cv_sys_global_symbol_pipe \> $nlist) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && test -s "$nlist"; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s "$nlist"; then
# Try sorting and uniquifying the output.
if sort "$nlist" | uniq > "$nlist"T; then
mv -f "$nlist"T "$nlist"
@@ -13711,71 +12553,57 @@ _LT_EOF
fi
# Make sure that we snagged all the symbols we need.
- if $GREP ' nm_test_var$' "$nlist" >/dev/null; then
- if $GREP ' nm_test_func$' "$nlist" >/dev/null; then
- cat <<_LT_EOF > conftest.$ac_ext
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
- relocations are performed -- see ld's documentation on pseudo-relocs. */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data. */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
+ if grep ' nm_test_var$' "$nlist" >/dev/null; then
+ if grep ' nm_test_func$' "$nlist" >/dev/null; then
+ cat <<EOF > conftest.$ac_ext
#ifdef __cplusplus
extern "C" {
#endif
-_LT_EOF
+EOF
# Now generate the symbol file.
- eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | $GREP -v main >> conftest.$ac_ext'
+ eval "$lt_cv_sys_global_symbol_to_cdecl"' < "$nlist" | grep -v main >> conftest.$ac_ext'
- cat <<_LT_EOF >> conftest.$ac_ext
+ cat <<EOF >> conftest.$ac_ext
+#if defined (__STDC__) && __STDC__
+# define lt_ptr_t void *
+#else
+# define lt_ptr_t char *
+# define const
+#endif
-/* The mapping between symbol names and symbols. */
-LT_DLSYM_CONST struct {
+/* The mapping between symbol names and symbols. */
+const struct {
const char *name;
- void *address;
+ lt_ptr_t address;
}
-lt__PROGRAM__LTX_preloaded_symbols[] =
+lt_preloaded_symbols[] =
{
- { "@PROGRAM@", (void *) 0 },
-_LT_EOF
- $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (void *) \&\2},/" < "$nlist" | $GREP -v main >> conftest.$ac_ext
- cat <<\_LT_EOF >> conftest.$ac_ext
- {0, (void *) 0}
+EOF
+ $SED "s/^$symcode$symcode* \(.*\) \(.*\)$/ {\"\2\", (lt_ptr_t) \&\2},/" < "$nlist" | grep -v main >> conftest.$ac_ext
+ cat <<\EOF >> conftest.$ac_ext
+ {0, (lt_ptr_t) 0}
};
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt__PROGRAM__LTX_preloaded_symbols;
-}
-#endif
-
#ifdef __cplusplus
}
#endif
-_LT_EOF
+EOF
# Now try linking the two files.
mv conftest.$ac_objext conftstm.$ac_objext
- lt_globsym_save_LIBS=$LIBS
- lt_globsym_save_CFLAGS=$CFLAGS
+ lt_save_LIBS="$LIBS"
+ lt_save_CFLAGS="$CFLAGS"
LIBS="conftstm.$ac_objext"
CFLAGS="$CFLAGS$lt_prog_compiler_no_builtin_flag"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && test -s conftest${ac_exeext}; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext}; then
pipe_works=yes
fi
- LIBS=$lt_globsym_save_LIBS
- CFLAGS=$lt_globsym_save_CFLAGS
+ LIBS="$lt_save_LIBS"
+ CFLAGS="$lt_save_CFLAGS"
else
echo "cannot find nm_test_func in $nlist" >&5
fi
@@ -13789,7 +12617,7 @@ _LT_EOF
echo "$progname: failed program was:" >&5
cat conftest.$ac_ext >&5
fi
- rm -rf conftest* conftst*
+ rm -f conftest* conftst*
# Do not use the global_symbol_pipe unless it works.
if test "$pipe_works" = yes; then
@@ -13805,1441 +12633,404 @@ if test -z "$lt_cv_sys_global_symbol_pipe"; then
lt_cv_sys_global_symbol_to_cdecl=
fi
if test -z "$lt_cv_sys_global_symbol_pipe$lt_cv_sys_global_symbol_to_cdecl"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: failed" >&5
-$as_echo "failed" >&6; }
+ { echo "$as_me:$LINENO: result: failed" >&5
+echo "${ECHO_T}failed" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ok" >&5
-$as_echo "ok" >&6; }
-fi
-
-# Response file support.
-if test "$lt_cv_nm_interface" = "MS dumpbin"; then
- nm_file_list_spec='@'
-elif $NM --help 2>/dev/null | grep '[@]FILE' >/dev/null; then
- nm_file_list_spec='@'
+ { echo "$as_me:$LINENO: result: ok" >&5
+echo "${ECHO_T}ok" >&6; }
fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for sysroot" >&5
-$as_echo_n "checking for sysroot... " >&6; }
-
-# Check whether --with-sysroot was given.
-if test "${with_sysroot+set}" = set; then :
- withval=$with_sysroot;
+{ echo "$as_me:$LINENO: checking for objdir" >&5
+echo $ECHO_N "checking for objdir... $ECHO_C" >&6; }
+if test "${lt_cv_objdir+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- with_sysroot=no
+ rm -f .libs 2>/dev/null
+mkdir .libs 2>/dev/null
+if test -d .libs; then
+ lt_cv_objdir=.libs
+else
+ # MS-DOS does not allow filenames that begin with a dot.
+ lt_cv_objdir=_libs
fi
-
-
-lt_sysroot=
-case ${with_sysroot} in #(
- yes)
- if test "$GCC" = yes; then
- lt_sysroot=`$CC --print-sysroot 2>/dev/null`
- fi
- ;; #(
- /*)
- lt_sysroot=`echo "$with_sysroot" | sed -e "$sed_quote_subst"`
- ;; #(
- no|'')
- ;; #(
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${with_sysroot}" >&5
-$as_echo "${with_sysroot}" >&6; }
- as_fn_error $? "The sysroot must be an absolute path." "$LINENO" 5
- ;;
-esac
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: ${lt_sysroot:-no}" >&5
-$as_echo "${lt_sysroot:-no}" >&6; }
-
+rmdir .libs 2>/dev/null
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_objdir" >&5
+echo "${ECHO_T}$lt_cv_objdir" >&6; }
+objdir=$lt_cv_objdir
-# Check whether --enable-libtool-lock was given.
-if test "${enable_libtool_lock+set}" = set; then :
- enableval=$enable_libtool_lock;
-fi
-test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
-
-# Some flags need to be propagated to the compiler or linker for good
-# libtool support.
-case $host in
-ia64-*-hpux*)
- # Find out which ABI we are using.
- echo 'int i;' > 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; }; then
- case `/usr/bin/file conftest.$ac_objext` in
- *ELF-32*)
- HPUX_IA64_MODE="32"
- ;;
- *ELF-64*)
- HPUX_IA64_MODE="64"
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-*-*-irix6*)
- # Find out which ABI we are using.
- echo '#line '$LINENO' "configure"' > 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; }; then
- if test "$lt_cv_prog_gnu_ld" = yes; then
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -melf32bsmip"
- ;;
- *N32*)
- LD="${LD-ld} -melf32bmipn32"
- ;;
- *64-bit*)
- LD="${LD-ld} -melf64bmip"
- ;;
- esac
- else
- case `/usr/bin/file conftest.$ac_objext` in
- *32-bit*)
- LD="${LD-ld} -32"
- ;;
- *N32*)
- LD="${LD-ld} -n32"
- ;;
- *64-bit*)
- LD="${LD-ld} -64"
- ;;
- esac
- fi
+case $host_os in
+aix3*)
+ # AIX sometimes has problems with the GCC collect2 program. For some
+ # reason, if we set the COLLECT_NAMES environment variable, the problems
+ # vanish in a puff of smoke.
+ if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
fi
- rm -rf conftest*
;;
+esac
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
-s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
- # Find out which ABI we are using.
- echo 'int i;' > 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; }; then
- case `/usr/bin/file conftest.o` in
- *32-bit*)
- case $host in
- x86_64-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_i386_fbsd"
- ;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_i386"
- ;;
- ppc64-*linux*|powerpc64-*linux*)
- LD="${LD-ld} -m elf32ppclinux"
- ;;
- s390x-*linux*)
- LD="${LD-ld} -m elf_s390"
- ;;
- sparc64-*linux*)
- LD="${LD-ld} -m elf32_sparc"
- ;;
- esac
- ;;
- *64-bit*)
- case $host in
- x86_64-*kfreebsd*-gnu)
- LD="${LD-ld} -m elf_x86_64_fbsd"
- ;;
- x86_64-*linux*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- ppc*-*linux*|powerpc*-*linux*)
- LD="${LD-ld} -m elf64ppc"
- ;;
- s390*-*linux*|s390*-*tpf*)
- LD="${LD-ld} -m elf64_s390"
- ;;
- sparc*-*linux*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='sed -e 1s/^X//'
+sed_quote_subst='s/\([\\"\\`$\\\\]\)/\\\1/g'
-*-*-sco3.2v5*)
- # On SCO OpenServer 5, we need -belf to get full-featured binaries.
- SAVE_CFLAGS="$CFLAGS"
- CFLAGS="$CFLAGS -belf"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether the C compiler needs -belf" >&5
-$as_echo_n "checking whether the C compiler needs -belf... " >&6; }
-if ${lt_cv_cc_needs_belf+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- 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
+# Same as above, but do not quote variable references.
+double_quote_subst='s/\([\\"\\`\\\\]\)/\\\1/g'
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+# Sed substitution to delay expansion of an escaped shell variable in a
+# double_quote_subst'ed string.
+delay_variable_subst='s/\\\\\\\\\\\$/\\\\\\$/g'
-int
-main ()
-{
+# Sed substitution to avoid accidental globbing in evaled expressions
+no_glob_subst='s/\*/\\\*/g'
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- lt_cv_cc_needs_belf=yes
-else
- lt_cv_cc_needs_belf=no
-fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- 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
+# Constants:
+rm="rm -f"
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_cc_needs_belf" >&5
-$as_echo "$lt_cv_cc_needs_belf" >&6; }
- if test x"$lt_cv_cc_needs_belf" != x"yes"; then
- # this is probably gcc 2.8.0, egcs 1.0 or newer; no need for -belf
- CFLAGS="$SAVE_CFLAGS"
- fi
- ;;
-*-*solaris*)
- # Find out which ABI we are using.
- echo 'int i;' > 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; }; then
- case `/usr/bin/file conftest.o` in
- *64-bit*)
- case $lt_cv_prog_gnu_ld in
- yes*)
- case $host in
- i?86-*-solaris*)
- LD="${LD-ld} -m elf_x86_64"
- ;;
- sparc*-*-solaris*)
- LD="${LD-ld} -m elf64_sparc"
- ;;
- esac
- # GNU ld 2.21 introduced _sol2 emulations. Use them if available.
- if ${LD-ld} -V | grep _sol2 >/dev/null 2>&1; then
- LD="${LD-ld}_sol2"
- fi
- ;;
- *)
- if ${LD-ld} -64 -r -o conftest2.o conftest.o >/dev/null 2>&1; then
- LD="${LD-ld} -64"
- fi
- ;;
- esac
- ;;
- esac
- fi
- rm -rf conftest*
- ;;
-esac
+# Global variables:
+default_ofile=libtool
+can_build_shared=yes
-need_locks="$enable_libtool_lock"
+# All known linkers require a `.a' archive for static linking (except MSVC,
+# which needs '.lib').
+libext=a
+ltmain="$ac_aux_dir/ltmain.sh"
+ofile="$default_ofile"
+with_gnu_ld="$lt_cv_prog_gnu_ld"
if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}mt", so it can be a program name with args.
-set dummy ${ac_tool_prefix}mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_MANIFEST_TOOL+:} false; then :
- $as_echo_n "(cached) " >&6
+ # Extract the first word of "${ac_tool_prefix}ar", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$MANIFEST_TOOL"; then
- ac_cv_prog_MANIFEST_TOOL="$MANIFEST_TOOL" # Let the user override the test.
+ if test -n "$AR"; then
+ ac_cv_prog_AR="$AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_MANIFEST_TOOL="${ac_tool_prefix}mt"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_AR="${ac_tool_prefix}ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-MANIFEST_TOOL=$ac_cv_prog_MANIFEST_TOOL
-if test -n "$MANIFEST_TOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MANIFEST_TOOL" >&5
-$as_echo "$MANIFEST_TOOL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_MANIFEST_TOOL"; then
- ac_ct_MANIFEST_TOOL=$MANIFEST_TOOL
- # Extract the first word of "mt", so it can be a program name with args.
-set dummy mt; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_MANIFEST_TOOL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_MANIFEST_TOOL"; then
- ac_cv_prog_ac_ct_MANIFEST_TOOL="$ac_ct_MANIFEST_TOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_MANIFEST_TOOL="mt"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
done
- done
IFS=$as_save_IFS
fi
fi
-ac_ct_MANIFEST_TOOL=$ac_cv_prog_ac_ct_MANIFEST_TOOL
-if test -n "$ac_ct_MANIFEST_TOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_MANIFEST_TOOL" >&5
-$as_echo "$ac_ct_MANIFEST_TOOL" >&6; }
+AR=$ac_cv_prog_AR
+if test -n "$AR"; then
+ { echo "$as_me:$LINENO: result: $AR" >&5
+echo "${ECHO_T}$AR" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- if test "x$ac_ct_MANIFEST_TOOL" = x; then
- MANIFEST_TOOL=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- MANIFEST_TOOL=$ac_ct_MANIFEST_TOOL
- fi
-else
- MANIFEST_TOOL="$ac_cv_prog_MANIFEST_TOOL"
-fi
-test -z "$MANIFEST_TOOL" && MANIFEST_TOOL=mt
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if $MANIFEST_TOOL is a manifest tool" >&5
-$as_echo_n "checking if $MANIFEST_TOOL is a manifest tool... " >&6; }
-if ${lt_cv_path_mainfest_tool+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_path_mainfest_tool=no
- echo "$as_me:$LINENO: $MANIFEST_TOOL '-?'" >&5
- $MANIFEST_TOOL '-?' 2>conftest.err > conftest.out
- cat conftest.err >&5
- if $GREP 'Manifest Tool' conftest.out > /dev/null; then
- lt_cv_path_mainfest_tool=yes
- fi
- rm -f conftest*
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_path_mainfest_tool" >&5
-$as_echo "$lt_cv_path_mainfest_tool" >&6; }
-if test "x$lt_cv_path_mainfest_tool" != xyes; then
- MANIFEST_TOOL=:
fi
-
-
-
-
-
-
- case $host_os in
- rhapsody* | darwin*)
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}dsymutil", so it can be a program name with args.
-set dummy ${ac_tool_prefix}dsymutil; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_DSYMUTIL+:} false; then :
- $as_echo_n "(cached) " >&6
+if test -z "$ac_cv_prog_AR"; then
+ ac_ct_AR=$AR
+ # Extract the first word of "ar", so it can be a program name with args.
+set dummy ar; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_AR+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$DSYMUTIL"; then
- ac_cv_prog_DSYMUTIL="$DSYMUTIL" # Let the user override the test.
+ if test -n "$ac_ct_AR"; then
+ ac_cv_prog_ac_ct_AR="$ac_ct_AR" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_DSYMUTIL="${ac_tool_prefix}dsymutil"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_AR="ar"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-DSYMUTIL=$ac_cv_prog_DSYMUTIL
-if test -n "$DSYMUTIL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $DSYMUTIL" >&5
-$as_echo "$DSYMUTIL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_DSYMUTIL"; then
- ac_ct_DSYMUTIL=$DSYMUTIL
- # Extract the first word of "dsymutil", so it can be a program name with args.
-set dummy dsymutil; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_DSYMUTIL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_DSYMUTIL"; then
- ac_cv_prog_ac_ct_DSYMUTIL="$ac_ct_DSYMUTIL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_DSYMUTIL="dsymutil"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
done
- done
IFS=$as_save_IFS
fi
fi
-ac_ct_DSYMUTIL=$ac_cv_prog_ac_ct_DSYMUTIL
-if test -n "$ac_ct_DSYMUTIL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_DSYMUTIL" >&5
-$as_echo "$ac_ct_DSYMUTIL" >&6; }
+ac_ct_AR=$ac_cv_prog_ac_ct_AR
+if test -n "$ac_ct_AR"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_AR" >&5
+echo "${ECHO_T}$ac_ct_AR" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- if test "x$ac_ct_DSYMUTIL" = x; then
- DSYMUTIL=":"
+ if test "x$ac_ct_AR" = x; then
+ AR="false"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
- DSYMUTIL=$ac_ct_DSYMUTIL
- fi
-else
- DSYMUTIL="$ac_cv_prog_DSYMUTIL"
-fi
-
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}nmedit", so it can be a program name with args.
-set dummy ${ac_tool_prefix}nmedit; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_NMEDIT+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$NMEDIT"; then
- ac_cv_prog_NMEDIT="$NMEDIT" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_NMEDIT="${ac_tool_prefix}nmedit"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
+ AR=$ac_ct_AR
fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-NMEDIT=$ac_cv_prog_NMEDIT
-if test -n "$NMEDIT"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $NMEDIT" >&5
-$as_echo "$NMEDIT" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ AR="$ac_cv_prog_AR"
fi
-
-fi
-if test -z "$ac_cv_prog_NMEDIT"; then
- ac_ct_NMEDIT=$NMEDIT
- # Extract the first word of "nmedit", so it can be a program name with args.
-set dummy nmedit; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_NMEDIT+:} false; then :
- $as_echo_n "(cached) " >&6
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
+set dummy ${ac_tool_prefix}ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$ac_ct_NMEDIT"; then
- ac_cv_prog_ac_ct_NMEDIT="$ac_ct_NMEDIT" # Let the user override the test.
+ if test -n "$RANLIB"; then
+ ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_NMEDIT="nmedit"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_NMEDIT=$ac_cv_prog_ac_ct_NMEDIT
-if test -n "$ac_ct_NMEDIT"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_NMEDIT" >&5
-$as_echo "$ac_ct_NMEDIT" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_NMEDIT" = x; then
- NMEDIT=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- NMEDIT=$ac_ct_NMEDIT
- fi
-else
- NMEDIT="$ac_cv_prog_NMEDIT"
-fi
-
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}lipo", so it can be a program name with args.
-set dummy ${ac_tool_prefix}lipo; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_LIPO+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$LIPO"; then
- ac_cv_prog_LIPO="$LIPO" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_LIPO="${ac_tool_prefix}lipo"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
done
- done
IFS=$as_save_IFS
fi
fi
-LIPO=$ac_cv_prog_LIPO
-if test -n "$LIPO"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LIPO" >&5
-$as_echo "$LIPO" >&6; }
+RANLIB=$ac_cv_prog_RANLIB
+if test -n "$RANLIB"; then
+ { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
fi
-if test -z "$ac_cv_prog_LIPO"; then
- ac_ct_LIPO=$LIPO
- # Extract the first word of "lipo", so it can be a program name with args.
-set dummy lipo; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_LIPO+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_LIPO"; then
- ac_cv_prog_ac_ct_LIPO="$ac_ct_LIPO" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_LIPO="lipo"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
-done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-ac_ct_LIPO=$ac_cv_prog_ac_ct_LIPO
-if test -n "$ac_ct_LIPO"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_LIPO" >&5
-$as_echo "$ac_ct_LIPO" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
- if test "x$ac_ct_LIPO" = x; then
- LIPO=":"
- else
- case $cross_compiling:$ac_tool_warned in
-yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
-ac_tool_warned=yes ;;
-esac
- LIPO=$ac_ct_LIPO
- fi
-else
- LIPO="$ac_cv_prog_LIPO"
-fi
-
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}otool", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
+if test -z "$ac_cv_prog_RANLIB"; then
+ ac_ct_RANLIB=$RANLIB
+ # Extract the first word of "ranlib", so it can be a program name with args.
+set dummy ranlib; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$OTOOL"; then
- ac_cv_prog_OTOOL="$OTOOL" # Let the user override the test.
+ if test -n "$ac_ct_RANLIB"; then
+ ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_OTOOL="${ac_tool_prefix}otool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_RANLIB="ranlib"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
-IFS=$as_save_IFS
-
-fi
-fi
-OTOOL=$ac_cv_prog_OTOOL
-if test -n "$OTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL" >&5
-$as_echo "$OTOOL" >&6; }
-else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
-fi
-
-
-fi
-if test -z "$ac_cv_prog_OTOOL"; then
- ac_ct_OTOOL=$OTOOL
- # Extract the first word of "otool", so it can be a program name with args.
-set dummy otool; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OTOOL+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- if test -n "$ac_ct_OTOOL"; then
- ac_cv_prog_ac_ct_OTOOL="$ac_ct_OTOOL" # Let the user override the test.
-else
-as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
-for as_dir in $PATH
-do
- IFS=$as_save_IFS
- test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_OTOOL="otool"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
- break 2
- fi
done
- done
IFS=$as_save_IFS
fi
fi
-ac_ct_OTOOL=$ac_cv_prog_ac_ct_OTOOL
-if test -n "$ac_ct_OTOOL"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL" >&5
-$as_echo "$ac_ct_OTOOL" >&6; }
+ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
+if test -n "$ac_ct_RANLIB"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- if test "x$ac_ct_OTOOL" = x; then
- OTOOL=":"
+ if test "x$ac_ct_RANLIB" = x; then
+ RANLIB=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
- OTOOL=$ac_ct_OTOOL
+ RANLIB=$ac_ct_RANLIB
fi
else
- OTOOL="$ac_cv_prog_OTOOL"
+ RANLIB="$ac_cv_prog_RANLIB"
fi
- if test -n "$ac_tool_prefix"; then
- # Extract the first word of "${ac_tool_prefix}otool64", so it can be a program name with args.
-set dummy ${ac_tool_prefix}otool64; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_OTOOL64+:} false; then :
- $as_echo_n "(cached) " >&6
+if test -n "$ac_tool_prefix"; then
+ # Extract the first word of "${ac_tool_prefix}strip", so it can be a program name with args.
+set dummy ${ac_tool_prefix}strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$OTOOL64"; then
- ac_cv_prog_OTOOL64="$OTOOL64" # Let the user override the test.
+ if test -n "$STRIP"; then
+ ac_cv_prog_STRIP="$STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_OTOOL64="${ac_tool_prefix}otool64"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_STRIP="${ac_tool_prefix}strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
-OTOOL64=$ac_cv_prog_OTOOL64
-if test -n "$OTOOL64"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $OTOOL64" >&5
-$as_echo "$OTOOL64" >&6; }
+STRIP=$ac_cv_prog_STRIP
+if test -n "$STRIP"; then
+ { echo "$as_me:$LINENO: result: $STRIP" >&5
+echo "${ECHO_T}$STRIP" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
fi
-if test -z "$ac_cv_prog_OTOOL64"; then
- ac_ct_OTOOL64=$OTOOL64
- # Extract the first word of "otool64", so it can be a program name with args.
-set dummy otool64; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_OTOOL64+:} false; then :
- $as_echo_n "(cached) " >&6
+if test -z "$ac_cv_prog_STRIP"; then
+ ac_ct_STRIP=$STRIP
+ # Extract the first word of "strip", so it can be a program name with args.
+set dummy strip; ac_word=$2
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_STRIP+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if test -n "$ac_ct_OTOOL64"; then
- ac_cv_prog_ac_ct_OTOOL64="$ac_ct_OTOOL64" # Let the user override the test.
+ if test -n "$ac_ct_STRIP"; then
+ ac_cv_prog_ac_ct_STRIP="$ac_ct_STRIP" # Let the user override the test.
else
as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
- ac_cv_prog_ac_ct_OTOOL64="otool64"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
+ ac_cv_prog_ac_ct_STRIP="strip"
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
-ac_ct_OTOOL64=$ac_cv_prog_ac_ct_OTOOL64
-if test -n "$ac_ct_OTOOL64"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_OTOOL64" >&5
-$as_echo "$ac_ct_OTOOL64" >&6; }
+ac_ct_STRIP=$ac_cv_prog_ac_ct_STRIP
+if test -n "$ac_ct_STRIP"; then
+ { echo "$as_me:$LINENO: result: $ac_ct_STRIP" >&5
+echo "${ECHO_T}$ac_ct_STRIP" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
- if test "x$ac_ct_OTOOL64" = x; then
- OTOOL64=":"
+ if test "x$ac_ct_STRIP" = x; then
+ STRIP=":"
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
- OTOOL64=$ac_ct_OTOOL64
+ STRIP=$ac_ct_STRIP
fi
else
- OTOOL64="$ac_cv_prog_OTOOL64"
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -single_module linker flag" >&5
-$as_echo_n "checking for -single_module linker flag... " >&6; }
-if ${lt_cv_apple_cc_single_mod+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_apple_cc_single_mod=no
- if test -z "${LT_MULTI_MODULE}"; then
- # By default we will add the -single_module flag. You can override
- # by either setting the environment variable LT_MULTI_MODULE
- # non-empty at configure time, or by adding -multi_module to the
- # link flags.
- rm -rf libconftest.dylib*
- echo "int foo(void){return 1;}" > conftest.c
- echo "$LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
--dynamiclib -Wl,-single_module conftest.c" >&5
- $LTCC $LTCFLAGS $LDFLAGS -o libconftest.dylib \
- -dynamiclib -Wl,-single_module conftest.c 2>conftest.err
- _lt_result=$?
- # If there is a non-empty error log, and "single_module"
- # appears in it, assume the flag caused a linker warning
- if test -s conftest.err && $GREP single_module conftest.err; then
- cat conftest.err >&5
- # Otherwise, if the output was created with a 0 exit code from
- # the compiler, it worked.
- elif test -f libconftest.dylib && test $_lt_result -eq 0; then
- lt_cv_apple_cc_single_mod=yes
- else
- cat conftest.err >&5
- fi
- rm -rf libconftest.dylib*
- rm -f conftest.*
- fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_apple_cc_single_mod" >&5
-$as_echo "$lt_cv_apple_cc_single_mod" >&6; }
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -exported_symbols_list linker flag" >&5
-$as_echo_n "checking for -exported_symbols_list linker flag... " >&6; }
-if ${lt_cv_ld_exported_symbols_list+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_ld_exported_symbols_list=no
- save_LDFLAGS=$LDFLAGS
- echo "_main" > conftest.sym
- LDFLAGS="$LDFLAGS -Wl,-exported_symbols_list,conftest.sym"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
- lt_cv_ld_exported_symbols_list=yes
-else
- lt_cv_ld_exported_symbols_list=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_ld_exported_symbols_list" >&5
-$as_echo "$lt_cv_ld_exported_symbols_list" >&6; }
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for -force_load linker flag" >&5
-$as_echo_n "checking for -force_load linker flag... " >&6; }
-if ${lt_cv_ld_force_load+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_ld_force_load=no
- cat > conftest.c << _LT_EOF
-int forced_loaded() { return 2;}
-_LT_EOF
- echo "$LTCC $LTCFLAGS -c -o conftest.o conftest.c" >&5
- $LTCC $LTCFLAGS -c -o conftest.o conftest.c 2>&5
- echo "$AR cru libconftest.a conftest.o" >&5
- $AR cru libconftest.a conftest.o 2>&5
- echo "$RANLIB libconftest.a" >&5
- $RANLIB libconftest.a 2>&5
- cat > conftest.c << _LT_EOF
-int main() { return 0;}
-_LT_EOF
- echo "$LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a" >&5
- $LTCC $LTCFLAGS $LDFLAGS -o conftest conftest.c -Wl,-force_load,./libconftest.a 2>conftest.err
- _lt_result=$?
- if test -s conftest.err && $GREP force_load conftest.err; then
- cat conftest.err >&5
- elif test -f conftest && test $_lt_result -eq 0 && $GREP forced_load conftest >/dev/null 2>&1 ; then
- lt_cv_ld_force_load=yes
- else
- cat conftest.err >&5
- fi
- rm -f conftest.err libconftest.a conftest conftest.c
- rm -rf conftest.dSYM
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_ld_force_load" >&5
-$as_echo "$lt_cv_ld_force_load" >&6; }
- case $host_os in
- rhapsody* | darwin1.[012])
- _lt_dar_allow_undefined='${wl}-undefined ${wl}suppress' ;;
- darwin1.*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- darwin*) # darwin 5.x on
- # if running on 10.5 or later, the deployment target defaults
- # to the OS version, if on x86, and 10.4, the deployment
- # target defaults to 10.4. Don't you love it?
- case ${MACOSX_DEPLOYMENT_TARGET-10.0},$host in
- 10.0,*86*-darwin8*|10.0,*-darwin[91]*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- 10.[012]*)
- _lt_dar_allow_undefined='${wl}-flat_namespace ${wl}-undefined ${wl}suppress' ;;
- 10.*)
- _lt_dar_allow_undefined='${wl}-undefined ${wl}dynamic_lookup' ;;
- esac
- ;;
- esac
- if test "$lt_cv_apple_cc_single_mod" = "yes"; then
- _lt_dar_single_mod='$single_module'
- fi
- if test "$lt_cv_ld_exported_symbols_list" = "yes"; then
- _lt_dar_export_syms=' ${wl}-exported_symbols_list,$output_objdir/${libname}-symbols.expsym'
- else
- _lt_dar_export_syms='~$NMEDIT -s $output_objdir/${libname}-symbols.expsym ${lib}'
- fi
- if test "$DSYMUTIL" != ":" && test "$lt_cv_ld_force_load" = "no"; then
- _lt_dsymutil='~$DSYMUTIL $lib || :'
- else
- _lt_dsymutil=
- fi
- ;;
- esac
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-#include <stdarg.h>
-#include <string.h>
-#include <float.h>
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- ac_cv_header_stdc=yes
-else
- ac_cv_header_stdc=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
-
-if test $ac_cv_header_stdc = yes; then
- # SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <string.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <stdlib.h>
-
-_ACEOF
-if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f conftest*
-
-fi
-
-if test $ac_cv_header_stdc = yes; then
- # /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
- :
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ctype.h>
-#include <stdlib.h>
-#if ((' ' & 0x0FF) == 0x020)
-# define ISLOWER(c) ('a' <= (c) && (c) <= 'z')
-# define TOUPPER(c) (ISLOWER(c) ? 'A' + ((c) - 'a') : (c))
-#else
-# define ISLOWER(c) \
- (('a' <= (c) && (c) <= 'i') \
- || ('j' <= (c) && (c) <= 'r') \
- || ('s' <= (c) && (c) <= 'z'))
-# define TOUPPER(c) (ISLOWER(c) ? ((c) | 0x40) : (c))
-#endif
-
-#define XOR(e, f) (((e) && !(f)) || (!(e) && (f)))
-int
-main ()
-{
- int i;
- for (i = 0; i < 256; i++)
- if (XOR (islower (i), ISLOWER (i))
- || toupper (i) != TOUPPER (i))
- return 2;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
-else
- ac_cv_header_stdc=no
-fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
-fi
-
-fi
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
-if test $ac_cv_header_stdc = yes; then
-
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
-
-fi
-
-# On IRIX 5.3, sys/types and inttypes.h are conflicting.
-for ac_header in sys/types.h sys/stat.h stdlib.h string.h memory.h strings.h \
- inttypes.h stdint.h unistd.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_compile "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default
-"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
-_ACEOF
-
-fi
-
-done
-
-
-for ac_header in dlfcn.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "dlfcn.h" "ac_cv_header_dlfcn_h" "$ac_includes_default
-"
-if test "x$ac_cv_header_dlfcn_h" = xyes; then :
- cat >>confdefs.h <<_ACEOF
-#define HAVE_DLFCN_H 1
-_ACEOF
-
-fi
-
-done
-
-
-
-
-func_stripname_cnf ()
-{
- case ${2} in
- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
- esac
-} # func_stripname_cnf
-
-
-
-
-
-# Set options
-
-
-
- enable_dlopen=no
-
-
-
- # Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then :
- enableval=$enable_shared; p=${PACKAGE-default}
- case $enableval in
- yes) enable_shared=yes ;;
- no) enable_shared=no ;;
- *)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac
-else
- enable_shared=yes
-fi
-
-
-
-
-
-
-
-
-
- # Check whether --enable-static was given.
-if test "${enable_static+set}" = set; then :
- enableval=$enable_static; p=${PACKAGE-default}
- case $enableval in
- yes) enable_static=yes ;;
- no) enable_static=no ;;
- *)
- enable_static=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_static=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac
-else
- enable_static=yes
-fi
-
-
-
-
-
-
-
-
-
-
-# Check whether --with-pic was given.
-if test "${with_pic+set}" = set; then :
- withval=$with_pic; lt_p=${PACKAGE-default}
- case $withval in
- yes|no) pic_mode=$withval ;;
- *)
- pic_mode=default
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for lt_pkg in $withval; do
- IFS="$lt_save_ifs"
- if test "X$lt_pkg" = "X$lt_p"; then
- pic_mode=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac
-else
- pic_mode=default
-fi
-
-
-test -z "$pic_mode" && pic_mode=default
-
-
-
-
-
-
-
- # Check whether --enable-fast-install was given.
-if test "${enable_fast_install+set}" = set; then :
- enableval=$enable_fast_install; p=${PACKAGE-default}
- case $enableval in
- yes) enable_fast_install=yes ;;
- no) enable_fast_install=no ;;
- *)
- enable_fast_install=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_fast_install=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac
-else
- enable_fast_install=yes
-fi
-
-
-
-
-
-
-
-
-
-
-
-# This can be used to rebuild libtool when needed
-LIBTOOL_DEPS="$ltmain"
-
-# Always use our own libtool.
-LIBTOOL='$(SHELL) $(top_builddir)/libtool'
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-test -z "$LN_S" && LN_S="ln -s"
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-if test -n "${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
-fi
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for objdir" >&5
-$as_echo_n "checking for objdir... " >&6; }
-if ${lt_cv_objdir+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- rm -f .libs 2>/dev/null
-mkdir .libs 2>/dev/null
-if test -d .libs; then
- lt_cv_objdir=.libs
-else
- # MS-DOS does not allow filenames that begin with a dot.
- lt_cv_objdir=_libs
-fi
-rmdir .libs 2>/dev/null
+ STRIP="$ac_cv_prog_STRIP"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_objdir" >&5
-$as_echo "$lt_cv_objdir" >&6; }
-objdir=$lt_cv_objdir
-
-
-
-
-
-cat >>confdefs.h <<_ACEOF
-#define LT_OBJDIR "$lt_cv_objdir/"
-_ACEOF
-
-
-
-
-case $host_os in
-aix3*)
- # AIX sometimes has problems with the GCC collect2 program. For some
- # reason, if we set the COLLECT_NAMES environment variable, the problems
- # vanish in a puff of smoke.
- if test "X${COLLECT_NAMES+set}" != Xset; then
- COLLECT_NAMES=
- export COLLECT_NAMES
- fi
- ;;
-esac
-# Global variables:
-ofile=libtool
-can_build_shared=yes
-
-# All known linkers require a `.a' archive for static linking (except MSVC,
-# which needs '.lib').
-libext=a
-
-with_gnu_ld="$lt_cv_prog_gnu_ld"
old_CC="$CC"
old_CFLAGS="$CFLAGS"
# Set sane defaults for various variables
+test -z "$AR" && AR=ar
+test -z "$AR_FLAGS" && AR_FLAGS=cru
+test -z "$AS" && AS=as
test -z "$CC" && CC=cc
test -z "$LTCC" && LTCC=$CC
test -z "$LTCFLAGS" && LTCFLAGS=$CFLAGS
+test -z "$DLLTOOL" && DLLTOOL=dlltool
test -z "$LD" && LD=ld
+test -z "$LN_S" && LN_S="ln -s"
+test -z "$MAGIC_CMD" && MAGIC_CMD=file
+test -z "$NM" && NM=nm
+test -z "$SED" && SED=sed
+test -z "$OBJDUMP" && OBJDUMP=objdump
+test -z "$RANLIB" && RANLIB=:
+test -z "$STRIP" && STRIP=:
test -z "$ac_objext" && ac_objext=o
+# Determine commands to create old-style static archives.
+old_archive_cmds='$AR $AR_FLAGS $oldlib$oldobjs'
+old_postinstall_cmds='chmod 644 $oldlib'
+old_postuninstall_cmds=
+
+if test -n "$RANLIB"; then
+ case $host_os in
+ openbsd*)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB -t \$oldlib"
+ ;;
+ *)
+ old_postinstall_cmds="$old_postinstall_cmds~\$RANLIB \$oldlib"
+ ;;
+ esac
+ old_archive_cmds="$old_archive_cmds~\$RANLIB \$oldlib"
+fi
+
for cc_temp in $compiler""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
@@ -15248,18 +13039,17 @@ for cc_temp in $compiler""; do
*) break;;
esac
done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
# Only perform the check for file, if the check method requires it
-test -z "$MAGIC_CMD" && MAGIC_CMD=file
case $deplibs_check_method in
file_magic*)
if test "$file_magic_cmd" = '$MAGIC_CMD'; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ${ac_tool_prefix}file" >&5
-$as_echo_n "checking for ${ac_tool_prefix}file... " >&6; }
-if ${lt_cv_path_MAGIC_CMD+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for ${ac_tool_prefix}file" >&5
+echo $ECHO_N "checking for ${ac_tool_prefix}file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $MAGIC_CMD in
[\\/*] | ?:[\\/]*)
@@ -15283,7 +13073,7 @@ else
$EGREP "$file_magic_regex" > /dev/null; then
:
else
- cat <<_LT_EOF 1>&2
+ cat <<EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
@@ -15294,7 +13084,7 @@ else
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
-_LT_EOF
+EOF
fi ;;
esac
fi
@@ -15309,23 +13099,19 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
+ { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
-
-
-
-
if test -z "$lt_cv_path_MAGIC_CMD"; then
if test -n "$ac_tool_prefix"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for file" >&5
-$as_echo_n "checking for file... " >&6; }
-if ${lt_cv_path_MAGIC_CMD+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for file" >&5
+echo $ECHO_N "checking for file... $ECHO_C" >&6; }
+if test "${lt_cv_path_MAGIC_CMD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $MAGIC_CMD in
[\\/*] | ?:[\\/]*)
@@ -15349,7 +13135,7 @@ else
$EGREP "$file_magic_regex" > /dev/null; then
:
else
- cat <<_LT_EOF 1>&2
+ cat <<EOF 1>&2
*** Warning: the command libtool uses to detect shared libraries,
*** $file_magic_cmd, produces output that libtool cannot recognize.
@@ -15360,7 +13146,7 @@ else
*** may want to report the problem to your system manager and/or to
*** bug-libtool@gnu.org
-_LT_EOF
+EOF
fi ;;
esac
fi
@@ -15375,14 +13161,13 @@ fi
MAGIC_CMD="$lt_cv_path_MAGIC_CMD"
if test -n "$MAGIC_CMD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $MAGIC_CMD" >&5
-$as_echo "$MAGIC_CMD" >&6; }
+ { echo "$as_me:$LINENO: result: $MAGIC_CMD" >&5
+echo "${ECHO_T}$MAGIC_CMD" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
-
else
MAGIC_CMD=:
fi
@@ -15392,8 +13177,28 @@ fi
;;
esac
-# Use C for the default configuration in the libtool script
+enable_dlopen=no
+enable_win32_dll=yes
+
+# Check whether --enable-libtool-lock was given.
+if test "${enable_libtool_lock+set}" = set; then
+ enableval=$enable_libtool_lock;
+fi
+
+test "x$enable_libtool_lock" != xno && enable_libtool_lock=yes
+
+
+# Check whether --with-pic was given.
+if test "${with_pic+set}" = set; then
+ withval=$with_pic; pic_mode="$withval"
+else
+ pic_mode=default
+fi
+test -z "$pic_mode" && pic_mode=default
+
+# Use C for the default configuration in the libtool script
+tagname=
lt_save_CC="$CC"
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -15416,11 +13221,6 @@ lt_simple_compile_test_code="int some_variable = 0;"
lt_simple_link_test_code='int main(){return(0);}'
-
-
-
-
-
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
@@ -15430,43 +13230,35 @@ LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
# Allow CC to be a program name with arguments.
compiler=$CC
-# Save the default compiler, since it gets overwritten when the other
-# tags are being tested, and _LT_TAGVAR(compiler, []) is a NOP.
-compiler_DEFAULT=$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*
+$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*
+$rm conftest*
-if test -n "$compiler"; then
lt_prog_compiler_no_builtin_flag=
if test "$GCC" = yes; then
- case $cc_basename in
- nvcc*)
- lt_prog_compiler_no_builtin_flag=' -Xcompiler -fno-builtin' ;;
- *)
- lt_prog_compiler_no_builtin_flag=' -fno-builtin' ;;
- esac
+ lt_prog_compiler_no_builtin_flag=' -fno-builtin'
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
-$as_echo_n "checking if $compiler supports -fno-rtti -fno-exceptions... " >&6; }
-if ${lt_cv_prog_compiler_rtti_exceptions+:} false; then :
- $as_echo_n "(cached) " >&6
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_prog_compiler_rtti_exceptions=no
- ac_outfile=conftest.$ac_objext
+ ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="-fno-rtti -fno-exceptions"
# Insert the option either (1) after the last *FLAGS variable, or
@@ -15478,25 +13270,25 @@ else
-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 echo "\"\$as_me:13273: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ echo "$as_me:13277: \$? = $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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_rtti_exceptions=yes
fi
fi
- $RM conftest*
+ $rm conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
-$as_echo "$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
lt_prog_compiler_no_builtin_flag="$lt_prog_compiler_no_builtin_flag -fno-rtti -fno-exceptions"
@@ -15506,15 +13298,12 @@ fi
fi
-
-
-
-
-
- lt_prog_compiler_wl=
+lt_prog_compiler_wl=
lt_prog_compiler_pic=
lt_prog_compiler_static=
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
if test "$GCC" = yes; then
lt_prog_compiler_wl='-Wl,'
@@ -15530,25 +13319,17 @@ lt_prog_compiler_static=
;;
amigaos*)
- case $host_cpu in
- powerpc)
- # see comment about AmigaOS4 .so support
- lt_prog_compiler_pic='-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='-m68020 -resident32 -malways-restore-a4'
- ;;
- esac
+ # 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='-m68020 -resident32 -malways-restore-a4'
;;
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | pw32* | os2*)
# 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
@@ -15562,26 +13343,6 @@ lt_prog_compiler_static=
lt_prog_compiler_pic='-fno-common'
;;
- haiku*)
- # PIC is the default for Haiku.
- # The "-static" flag exists, but is broken.
- lt_prog_compiler_static=
- ;;
-
- 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='-fPIC'
- ;;
- esac
- ;;
-
interix[3-9]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
@@ -15594,29 +13355,27 @@ lt_prog_compiler_static=
enable_shared=no
;;
- *nto* | *qnx*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- lt_prog_compiler_pic='-fPIC -shared'
- ;;
-
sysv4*MP*)
if test -d /usr/nec; then
lt_prog_compiler_pic=-Kconform_pic
fi
;;
- *)
- lt_prog_compiler_pic='-fPIC'
+ hpux*)
+ # 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='-fPIC'
+ ;;
+ esac
;;
- esac
- case $cc_basename in
- nvcc*) # Cuda Compiler Driver 2.2
- lt_prog_compiler_wl='-Xlinker '
- if test -n "$lt_prog_compiler_pic"; then
- lt_prog_compiler_pic="-Xcompiler $lt_prog_compiler_pic"
- fi
+ *)
+ lt_prog_compiler_pic='-fPIC'
;;
esac
else
@@ -15631,8 +13390,18 @@ lt_prog_compiler_static=
lt_prog_compiler_static='-bnso -bI:/lib/syscalls.exp'
fi
;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic='-qnocommon'
+ lt_prog_compiler_wl='-Wl,'
+ ;;
+ esac
+ ;;
- mingw* | cygwin* | pw32* | os2* | cegcc*)
+ mingw* | cygwin* | pw32* | os2*)
# 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='-DDLL_EXPORT'
@@ -15660,34 +13429,19 @@ lt_prog_compiler_static=
lt_prog_compiler_static='-non_shared'
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ newsos6)
+ lt_prog_compiler_pic='-KPIC'
+ lt_prog_compiler_static='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
case $cc_basename in
- # old Intel for x86_64 which still supported -KPIC.
- ecc*)
+ icc* | ecc*)
lt_prog_compiler_wl='-Wl,'
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-static'
;;
- # icc used to be incompatible with GCC.
- # ICC 10 doesn't accept -KPIC any more.
- icc* | ifort*)
- lt_prog_compiler_wl='-Wl,'
- lt_prog_compiler_pic='-fPIC'
- lt_prog_compiler_static='-static'
- ;;
- # Lahey Fortran 8.1.
- lf95*)
- lt_prog_compiler_wl='-Wl,'
- lt_prog_compiler_pic='--shared'
- lt_prog_compiler_static='--static'
- ;;
- nagfor*)
- # NAG Fortran compiler
- lt_prog_compiler_wl='-Wl,-Wl,,'
- lt_prog_compiler_pic='-PIC'
- lt_prog_compiler_static='-Bstatic'
- ;;
- pgcc* | pgf77* | pgf90* | pgf95* | pgfortran*)
+ pgcc* | pgf77* | pgf90* | pgf95*)
# Portland Group compilers (*not* the Pentium gcc compiler,
# which looks to be a dead project)
lt_prog_compiler_wl='-Wl,'
@@ -15699,57 +13453,25 @@ lt_prog_compiler_static=
# All Alpha code is PIC.
lt_prog_compiler_static='-non_shared'
;;
- xl* | bgxl* | bgf* | mpixl*)
- # IBM XL C 8.0/Fortran 10.1, 11.1 on PPC and BlueGene
- lt_prog_compiler_wl='-Wl,'
- lt_prog_compiler_pic='-qpic'
- lt_prog_compiler_static='-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='-KPIC'
- lt_prog_compiler_static='-Bstatic'
- lt_prog_compiler_wl=''
- ;;
- *Sun\ F* | *Sun*Fortran*)
- lt_prog_compiler_pic='-KPIC'
- lt_prog_compiler_static='-Bstatic'
- lt_prog_compiler_wl='-Qoption ld '
- ;;
+ case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C 5.9
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
lt_prog_compiler_wl='-Wl,'
;;
- *Intel*\ [CF]*Compiler*)
- lt_prog_compiler_wl='-Wl,'
- lt_prog_compiler_pic='-fPIC'
- lt_prog_compiler_static='-static'
- ;;
- *Portland\ Group*)
- lt_prog_compiler_wl='-Wl,'
- lt_prog_compiler_pic='-fpic'
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
+ lt_prog_compiler_wl=''
;;
esac
;;
esac
;;
- newsos6)
- lt_prog_compiler_pic='-KPIC'
- lt_prog_compiler_static='-Bstatic'
- ;;
-
- *nto* | *qnx*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- lt_prog_compiler_pic='-fPIC -shared'
- ;;
-
osf3* | osf4* | osf5*)
lt_prog_compiler_wl='-Wl,'
# All OSF/1 code is PIC.
@@ -15764,7 +13486,7 @@ lt_prog_compiler_static=
lt_prog_compiler_pic='-KPIC'
lt_prog_compiler_static='-Bstatic'
case $cc_basename in
- f77* | f90* | f95* | sunf77* | sunf90* | sunf95*)
+ f77* | f90* | f95*)
lt_prog_compiler_wl='-Qoption ld ';;
*)
lt_prog_compiler_wl='-Wl,';;
@@ -15812,38 +13534,21 @@ lt_prog_compiler_static=
esac
fi
-case $host_os in
- # For platforms which do not support PIC, -DPIC is meaningless:
- *djgpp*)
- lt_prog_compiler_pic=
- ;;
- *)
- lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
- ;;
-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+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_prog_compiler_pic=$lt_prog_compiler_pic
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic" >&5
-$as_echo "$lt_cv_prog_compiler_pic" >&6; }
-lt_prog_compiler_pic=$lt_cv_prog_compiler_pic
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic" >&6; }
#
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic works... " >&6; }
-if ${lt_cv_prog_compiler_pic_works+:} false; then :
- $as_echo_n "(cached) " >&6
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- lt_cv_prog_compiler_pic_works=no
- ac_outfile=conftest.$ac_objext
+ lt_prog_compiler_pic_works=no
+ ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$lt_prog_compiler_pic -DPIC"
# Insert the option either (1) after the last *FLAGS variable, or
@@ -15855,27 +13560,27 @@ else
-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 echo "\"\$as_me:13563: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ echo "$as_me:13567: \$? = $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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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=yes
+ lt_prog_compiler_pic_works=yes
fi
fi
- $RM conftest*
+ $rm conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works" >&6; }
-if test x"$lt_cv_prog_compiler_pic_works" = xyes; then
+if test x"$lt_prog_compiler_pic_works" = xyes; then
case $lt_prog_compiler_pic in
"" | " "*) ;;
*) lt_prog_compiler_pic=" $lt_prog_compiler_pic" ;;
@@ -15886,27 +13591,26 @@ else
fi
fi
-
-
-
-
-
-
-
-
-
-
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic=
+ ;;
+ *)
+ lt_prog_compiler_pic="$lt_prog_compiler_pic -DPIC"
+ ;;
+esac
#
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl eval lt_tmp_static_flag=\"$lt_prog_compiler_static\"
-{ $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+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- lt_cv_prog_compiler_static_works=no
+ lt_prog_compiler_static_works=no
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
echo "$lt_simple_link_test_code" > conftest.$ac_ext
@@ -15916,96 +13620,36 @@ else
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
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/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=yes
+ lt_prog_compiler_static_works=yes
fi
else
- lt_cv_prog_compiler_static_works=yes
+ lt_prog_compiler_static_works=yes
fi
fi
- $RM -r conftest*
+ $rm conftest*
LDFLAGS="$save_LDFLAGS"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works" >&5
-$as_echo "$lt_cv_prog_compiler_static_works" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works" >&6; }
-if test x"$lt_cv_prog_compiler_static_works" = xyes; then
+if test x"$lt_prog_compiler_static_works" = xyes; then
:
else
lt_prog_compiler_static=
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+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_prog_compiler_c_o=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=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" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&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+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_prog_compiler_c_o=no
- $RM -r conftest 2>/dev/null
+ $rm -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
@@ -16020,92 +13664,83 @@ else
-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 echo "\"\$as_me:13667: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ echo "$as_me:13671: \$? = $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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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=yes
fi
fi
chmod u+w . 2>&5
- $RM conftest*
+ $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
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
cd ..
- $RM -r conftest
- $RM conftest*
+ rmdir conftest
+ $rm conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o" >&5
-$as_echo "$lt_cv_prog_compiler_c_o" >&6; }
-
-
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o" >&6; }
hard_links="nottested"
if test "$lt_cv_prog_compiler_c_o" = 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; }
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
hard_links=yes
- $RM conftest*
+ $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; }
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$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;}
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+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; }
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
runpath_var=
allow_undefined_flag=
- always_export_symbols=no
+ enable_shared_with_static_runtimes=no
archive_cmds=
archive_expsym_cmds=
- compiler_needs_object=no
- enable_shared_with_static_runtimes=no
+ old_archive_From_new_cmds=
+ old_archive_from_expsyms_cmds=
export_dynamic_flag_spec=
- export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- hardcode_automatic=no
- hardcode_direct=no
- hardcode_direct_absolute=no
+ whole_archive_flag_spec=
+ thread_safe_flag_spec=
hardcode_libdir_flag_spec=
+ hardcode_libdir_flag_spec_ld=
hardcode_libdir_separator=
+ hardcode_direct=no
hardcode_minus_L=no
hardcode_shlibpath_var=unsupported
- inherit_rpath=no
link_all_deplibs=unknown
+ hardcode_automatic=no
module_cmds=
module_expsym_cmds=
- old_archive_from_new_cmds=
- old_archive_from_expsyms_cmds=
- thread_safe_flag_spec=
- whole_archive_flag_spec=
+ always_export_symbols=no
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
# include_expsyms should be a list of space-separated symbols to be *always*
# included in the symbol list
include_expsyms=
@@ -16113,17 +13748,26 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
# 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='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
+ exclude_expsyms="_GLOBAL_OFFSET_TABLE_"
# 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=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | mingw* | pw32*)
# 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++.
@@ -16141,33 +13785,7 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
esac
ld_shlibs=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}'
@@ -16175,17 +13793,16 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
# 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='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_flag_spec='${wl}--rpath ${wl}$libdir'
export_dynamic_flag_spec='${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="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
- whole_archive_flag_spec=
+ if $LD --help 2>&1 | grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec=
fi
supports_anon_versioning=no
- case `$LD -v 2>&1` in
- *GNU\ gold*) supports_anon_versioning=yes ;;
+ case `$LD -v 2>/dev/null` in
*\ [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 ...
@@ -16195,40 +13812,38 @@ $as_echo_n "checking whether the $compiler linker ($LD) supports shared librarie
# See if GNU ld supports shared libraries.
case $host_os in
- aix[3-9]*)
+ aix3* | aix4* | aix5*)
# On AIX/PPC, the GNU linker is very broken
if test "$host_cpu" != ia64; then
ld_shlibs=no
- cat <<_LT_EOF 1>&2
+ cat <<EOF 1>&2
-*** Warning: the GNU linker, at least up to release 2.19, is reported
+*** Warning: the GNU linker, at least up to release 2.9.1, 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.
+*** really care for shared libraries, you may want to modify your PATH
+*** so that a non-GNU linker is found, and then restart.
-_LT_EOF
+EOF
fi
;;
amigaos*)
- case $host_cpu in
- powerpc)
- # see comment about AmigaOS4 .so support
- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds=''
- ;;
- m68k)
- archive_cmds='$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='-L$libdir'
- hardcode_minus_L=yes
- ;;
- esac
+ archive_cmds='$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='-L$libdir'
+ hardcode_minus_L=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs=no
;;
beos*)
- if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
allow_undefined_flag=unsupported
# Joseph Beckenbach <jrb3@best.com> says some releases of gcc
# support --undefined. This deserves some investigation. FIXME
@@ -16238,18 +13853,16 @@ _LT_EOF
fi
;;
- cygwin* | mingw* | pw32* | cegcc*)
- # _LT_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, ) is actually meaningless,
# as there is no search path for DLLs.
hardcode_libdir_flag_spec='-L$libdir'
- export_dynamic_flag_spec='${wl}--export-all-symbols'
allow_undefined_flag=unsupported
always_export_symbols=no
enable_shared_with_static_runtimes=yes
- export_symbols_cmds='$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='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+ export_symbols_cmds='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
- if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
archive_cmds='$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...
@@ -16265,11 +13878,6 @@ _LT_EOF
fi
;;
- haiku*)
- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- link_all_deplibs=yes
- ;;
-
interix[3-9]*)
hardcode_direct=no
hardcode_shlibpath_var=no
@@ -16285,94 +13893,60 @@ _LT_EOF
archive_expsym_cmds='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'
+ gnu* | linux* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
case $cc_basename,$host_cpu in
- pgcc*) # Portland Group C compiler
- whole_archive_flag_spec='${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'
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag'
;;
- pgf77* | pgf90* | pgf95* | pgfortran*)
- # Portland Group f77 and f90 compilers
- whole_archive_flag_spec='${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'
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_addflag=' $pic_flag -Mnomain' ;;
- ecc*,ia64* | icc*,ia64*) # Intel C compiler on ia64
+ 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=
- 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='${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=yes
- ;;
esac
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*) # Sun C 5.9
- whole_archive_flag_spec='${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=yes
+ whole_archive_flag_spec='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
tmp_sharedflag='-G' ;;
*Sun\ F*) # Sun Fortran 8.3
tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
esac
archive_cmds='$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='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='--whole-archive$convenience --no-whole-archive'
- hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
- archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname -o $lib'
- if test "x$supports_anon_versioning" = xyes; then
- archive_expsym_cmds='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
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds='$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
else
- ld_shlibs=no
+ ld_shlibs=no
fi
;;
netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
wlarc=
else
- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $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
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
ld_shlibs=no
- cat <<_LT_EOF 1>&2
+ cat <<EOF 1>&2
*** Warning: The releases 2.8.* of the GNU linker cannot reliably
*** create shared libraries on Solaris systems. Therefore, libtool
@@ -16381,10 +13955,10 @@ _LT_EOF
*** 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='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
@@ -16406,14 +13980,10 @@ _LT_EOF
_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='${wl}-rpath ${wl}$libdir'
- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
else
ld_shlibs=no
fi
@@ -16429,9 +13999,9 @@ _LT_EOF
;;
*)
- if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
- archive_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds='$CC -shared $pic_flag $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
else
ld_shlibs=no
fi
@@ -16461,7 +14031,7 @@ _LT_EOF
fi
;;
- aix[4-9]*)
+ aix4* | aix5*)
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.
@@ -16471,24 +14041,22 @@ _LT_EOF
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='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B") || (\$ 2 == "W")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
else
- export_symbols_cmds='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ export_symbols_cmds='$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]*)
+ case $host_os in aix4.[23]|aix4.[23].*|aix5*)
for ld_flag in $LDFLAGS; do
- if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
- aix_use_runtimelinking=yes
- break
- fi
+ if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
+ aix_use_runtimelinking=yes
+ break
+ fi
done
;;
esac
@@ -16505,30 +14073,28 @@ _LT_EOF
archive_cmds=''
hardcode_direct=yes
- hardcode_direct_absolute=yes
hardcode_libdir_separator=':'
link_all_deplibs=yes
- file_list_spec='${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
+ if test -f "$collect2name" && \
+ strings "$collect2name" | grep resolve_lib_name >/dev/null
then
- # We have reworked collect2
- :
+ # We have reworked collect2
+ :
else
- # We have old collect2
- hardcode_direct=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=yes
- hardcode_libdir_flag_spec='-L$libdir'
- hardcode_libdir_separator=
+ # We have old collect2
+ hardcode_direct=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=yes
+ hardcode_libdir_flag_spec='-L$libdir'
+ hardcode_libdir_separator=
fi
;;
esac
@@ -16539,8 +14105,8 @@ _LT_EOF
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:
+ # 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
@@ -16551,7 +14117,6 @@ _LT_EOF
fi
fi
- export_dynamic_flag_spec='${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=yes
@@ -16559,15 +14124,12 @@ _LT_EOF
# Warning - without using the other runtime loading flags (-brtl),
# -berok will link without error, but may produce a broken library.
allow_undefined_flag='-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_+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -16578,49 +14140,62 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
- lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\([^ ]*\) *$/\1/
- p
- }
- }'
- lt_cv_aix_libpath_=`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_"; then
- lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
- fi
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- if test -z "$lt_cv_aix_libpath_"; then
- lt_cv_aix_libpath_="/usr/lib:/lib"
- fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-fi
- aix_libpath=$lt_cv_aix_libpath_
fi
- hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
- archive_expsym_cmds='$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
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${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='${wl}-R $libdir:/usr/lib:/lib'
allow_undefined_flag="-z nodefs"
archive_expsym_cmds="\$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_+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -16631,44 +14206,55 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
-
- lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\([^ ]*\) *$/\1/
- p
- }
- }'
- lt_cv_aix_libpath_=`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_"; then
- lt_cv_aix_libpath_=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
- fi
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- if test -z "$lt_cv_aix_libpath_"; then
- lt_cv_aix_libpath_="/usr/lib:/lib"
- fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-fi
- aix_libpath=$lt_cv_aix_libpath_
fi
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
hardcode_libdir_flag_spec='${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=' ${wl}-bernotok'
allow_undefined_flag=' ${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='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- else
- # Exported symbols can be pulled into shared objects from archives
- whole_archive_flag_spec='$convenience'
- fi
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec='$convenience'
archive_cmds_need_lc=yes
# This is similar to how AIX traditionally builds its shared libraries.
archive_expsym_cmds="\$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'
@@ -16677,119 +14263,86 @@ fi
;;
amigaos*)
- case $host_cpu in
- powerpc)
- # see comment about AmigaOS4 .so support
- archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds=''
- ;;
- m68k)
- archive_cmds='$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='-L$libdir'
- hardcode_minus_L=yes
- ;;
- esac
+ archive_cmds='$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='-L$libdir'
+ hardcode_minus_L=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs=no
;;
bsdi[45]*)
export_dynamic_flag_spec=-rdynamic
;;
- cygwin* | mingw* | pw32* | cegcc*)
+ cygwin* | mingw* | pw32*)
# 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=' '
- allow_undefined_flag=unsupported
- always_export_symbols=yes
- file_list_spec='@'
- # 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='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- archive_expsym_cmds='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, )='true'
- enable_shared_with_static_runtimes=yes
- exclude_expsyms='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
- export_symbols_cmds='$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='chmod 644 $oldlib'
- postlink_cmds='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=' '
- allow_undefined_flag=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='$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='true'
- # FIXME: Should let the user specify the lib program.
- old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
- enable_shared_with_static_runtimes=yes
- ;;
- esac
+ hardcode_libdir_flag_spec=' '
+ allow_undefined_flag=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='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes=yes
;;
darwin* | rhapsody*)
-
-
- archive_cmds_need_lc=no
- hardcode_direct=no
- hardcode_automatic=yes
- hardcode_shlibpath_var=unsupported
- if test "$lt_cv_ld_force_load" = "yes"; then
- whole_archive_flag_spec='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-
- else
- whole_archive_flag_spec=''
- fi
- link_all_deplibs=yes
- allow_undefined_flag="$_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="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
- module_cmds="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds="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="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=no
- fi
-
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc=no
+ hardcode_direct=no
+ hardcode_automatic=yes
+ hardcode_shlibpath_var=unsupported
+ whole_archive_flag_spec=''
+ link_all_deplibs=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs=no
+ ;;
+ esac
+ fi
;;
dgux*)
@@ -16798,6 +14351,10 @@ fi
hardcode_shlibpath_var=no
;;
+ freebsd1*)
+ ld_shlibs=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
@@ -16810,7 +14367,7 @@ fi
;;
# Unfortunately, older versions of FreeBSD 2 do not have this feature.
- freebsd2.*)
+ freebsd2*)
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
hardcode_direct=yes
hardcode_minus_L=yes
@@ -16819,7 +14376,7 @@ fi
# FreeBSD 3 and greater uses gcc -shared to do shared libraries.
freebsd* | dragonfly*)
- archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
hardcode_libdir_flag_spec='-R$libdir'
hardcode_direct=yes
hardcode_shlibpath_var=no
@@ -16827,9 +14384,9 @@ fi
hpux9*)
if test "$GCC" = yes; then
- archive_cmds='$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'
+ archive_cmds='$rm $output_objdir/$soname~$CC -shared -fPIC ${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='$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'
+ archive_cmds='$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='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
@@ -16842,17 +14399,18 @@ fi
;;
hpux10*)
- if test "$GCC" = yes && test "$with_gnu_ld" = no; then
- archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
else
archive_cmds='$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='${wl}+b ${wl}$libdir'
hardcode_libdir_separator=:
+
hardcode_direct=yes
- hardcode_direct_absolute=yes
export_dynamic_flag_spec='${wl}-E'
+
# hardcode_minus_L: Not really in the search PATH,
# but as the default location of the library.
hardcode_minus_L=yes
@@ -16860,16 +14418,16 @@ fi
;;
hpux11*)
- if test "$GCC" = yes && test "$with_gnu_ld" = no; then
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
case $host_cpu in
hppa*64*)
archive_cmds='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
;;
ia64*)
- archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
- archive_cmds='$CC -shared $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
else
@@ -16881,46 +14439,7 @@ fi
archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
;;
*)
-
- # Older versions of the 11.00 compiler do not understand -b yet
- # (HP92453-01 A.11.01.20 doesn't, HP92453-01 B.11.X.35175-35176.GP does)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $CC understands -b" >&5
-$as_echo_n "checking if $CC understands -b... " >&6; }
-if ${lt_cv_prog_compiler__b+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_prog_compiler__b=no
- save_LDFLAGS="$LDFLAGS"
- LDFLAGS="$LDFLAGS -b"
- 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__b=yes
- fi
- else
- lt_cv_prog_compiler__b=yes
- fi
- fi
- $RM -r conftest*
- LDFLAGS="$save_LDFLAGS"
-
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler__b" >&5
-$as_echo "$lt_cv_prog_compiler__b" >&6; }
-
-if test x"$lt_cv_prog_compiler__b" = xyes; then
- archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
-else
- archive_cmds='$LD -b +h $soname +b $install_libdir -o $lib $libobjs $deplibs $linker_flags'
-fi
-
+ archive_cmds='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
;;
esac
fi
@@ -16930,12 +14449,12 @@ fi
case $host_cpu in
hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld='+b $libdir'
hardcode_direct=no
hardcode_shlibpath_var=no
;;
*)
hardcode_direct=yes
- hardcode_direct_absolute=yes
export_dynamic_flag_spec='${wl}-E'
# hardcode_minus_L: Not really in the search PATH,
@@ -16948,49 +14467,18 @@ fi
irix5* | irix6* | nonstopux*)
if test "$GCC" = yes; then
- archive_cmds='$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 confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-int foo (void) { return 0; }
-_ACEOF
-if ac_fn_c_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='$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
+ archive_cmds='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
- archive_cmds='$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='$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'
+ archive_cmds='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld='-rpath $libdir'
fi
- archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
- inherit_rpath=yes
link_all_deplibs=yes
;;
netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
archive_cmds='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
else
archive_cmds='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
@@ -17008,15 +14496,11 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
hardcode_shlibpath_var=no
;;
- *nto* | *qnx*)
- ;;
-
openbsd*)
if test -f /usr/libexec/ld.so; then
hardcode_direct=yes
hardcode_shlibpath_var=no
- hardcode_direct_absolute=yes
- if test -z "`echo __ELF__ | $CC -E - | $GREP __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
archive_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
archive_expsym_cmds='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
@@ -17032,7 +14516,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
;;
esac
- fi
+ fi
else
ld_shlibs=no
fi
@@ -17042,19 +14526,18 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
hardcode_libdir_flag_spec='-L$libdir'
hardcode_minus_L=yes
allow_undefined_flag=unsupported
- archive_cmds='$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='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ archive_cmds='$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='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
;;
osf3*)
if test "$GCC" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
- archive_cmds='$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'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
allow_undefined_flag=' -expect_unresolved \*'
- archive_cmds='$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'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
fi
- archive_cmds_need_lc='no'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator=:
;;
@@ -17062,43 +14545,32 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
osf4* | osf5*) # as osf3* with the addition of -msym flag
if test "$GCC" = yes; then
allow_undefined_flag=' ${wl}-expect_unresolved ${wl}\*'
- archive_cmds='$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'
+ archive_cmds='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
else
allow_undefined_flag=' -expect_unresolved \*'
- archive_cmds='$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='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'
+ archive_cmds='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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='-rpath $libdir'
fi
- archive_cmds_need_lc='no'
hardcode_libdir_separator=:
;;
solaris*)
- no_undefined_flag=' -z defs'
+ no_undefined_flag=' -z text'
if test "$GCC" = yes; then
wlarc='${wl}'
- archive_cmds='$CC -shared $pic_flag ${wl}-z ${wl}text ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds='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'
+ archive_cmds='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${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='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
- archive_expsym_cmds='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='$CC -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds='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
+ wlarc=''
+ archive_cmds='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds='$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'
fi
hardcode_libdir_flag_spec='-R$libdir'
hardcode_shlibpath_var=no
@@ -17108,7 +14580,7 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
# 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?)
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
if test "$GCC" = yes; then
whole_archive_flag_spec='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
else
@@ -17197,18 +14669,18 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
allow_undefined_flag='${wl}-z,nodefs'
archive_cmds_need_lc=no
hardcode_shlibpath_var=no
- hardcode_libdir_flag_spec='${wl}-R,$libdir'
+ hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
hardcode_libdir_separator=':'
link_all_deplibs=yes
export_dynamic_flag_spec='${wl}-Bexport'
runpath_var='LD_RUN_PATH'
if test "$GCC" = yes; then
- archive_cmds='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
else
- archive_cmds='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_cmds='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
fi
;;
@@ -17222,36 +14694,12 @@ $as_echo "$lt_cv_irix_exported_symbol" >&6; }
ld_shlibs=no
;;
esac
-
- if test x$host_vendor = xsni; then
- case $host in
- sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
- export_dynamic_flag_spec='${wl}-Blargedynsym'
- ;;
- esac
- fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs" >&5
-$as_echo "$ld_shlibs" >&6; }
+{ echo "$as_me:$LINENO: result: $ld_shlibs" >&5
+echo "${ECHO_T}$ld_shlibs" >&6; }
test "$ld_shlibs" = no && can_build_shared=no
-with_gnu_ld=$with_gnu_ld
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
#
# Do we need to explicitly link libc?
#
@@ -17269,234 +14717,83 @@ x|xyes)
# 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+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- $RM conftest*
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ if { (eval echo "$as_me:$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
- pic_flag=$lt_prog_compiler_pic
- compiler_flags=-v
- linker_flags=-v
- verstring=
- output_objdir=.
- libname=conftest
- lt_save_allow_undefined_flag=$allow_undefined_flag
- allow_undefined_flag=
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
- (eval $archive_cmds 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=no
- else
- lt_cv_archive_cmds_need_lc=yes
- fi
- allow_undefined_flag=$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" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc" >&6; }
- archive_cmds_need_lc=$lt_cv_archive_cmds_need_lc
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl
+ pic_flag=$lt_prog_compiler_pic
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag
+ allow_undefined_flag=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc=no
+ else
+ archive_cmds_need_lc=yes
+ fi
+ allow_undefined_flag=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc" >&5
+echo "${ECHO_T}$archive_cmds_need_lc" >&6; }
;;
esac
fi
;;
esac
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&6; }
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&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"
if test "$GCC" = yes; then
case $host_os in
darwin*) lt_awk_arg="/^libraries:/,/LR/" ;;
*) lt_awk_arg="/^libraries:/" ;;
esac
- case $host_os in
- mingw* | cegcc*) lt_sed_strip_eq="s,=\([A-Za-z]:\),\1,g" ;;
- *) lt_sed_strip_eq="s,=/,/,g" ;;
- esac
- lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e $lt_sed_strip_eq`
- case $lt_search_path_spec in
- *\;*)
+ lt_search_path_spec=`$CC -print-search-dirs | awk $lt_awk_arg | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$lt_search_path_spec" | grep ';' >/dev/null ; then
# if the path contains ";" then we assume it to be the separator
# otherwise default to the standard path separator (i.e. ":") - it is
# assumed that no part of a normal pathname contains ";" but that should
# okay in the real world where ";" in dirpaths is itself problematic.
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED 's/;/ /g'`
- ;;
- *)
- lt_search_path_spec=`$ECHO "$lt_search_path_spec" | $SED "s/$PATH_SEPARATOR/ /g"`
- ;;
- esac
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e 's/;/ /g'`
+ else
+ lt_search_path_spec=`echo "$lt_search_path_spec" | $SED -e "s/$PATH_SEPARATOR/ /g"`
+ fi
# Ok, now we have the path, separated by spaces, we can step through it
# and add multilib dir if necessary.
lt_tmp_lt_search_path_spec=
@@ -17509,7 +14806,7 @@ if test "$GCC" = yes; then
lt_tmp_lt_search_path_spec="$lt_tmp_lt_search_path_spec $lt_sys_path"
fi
done
- lt_search_path_spec=`$ECHO "$lt_tmp_lt_search_path_spec" | awk '
+ lt_search_path_spec=`echo $lt_tmp_lt_search_path_spec | awk '
BEGIN {RS=" "; FS="/|\n";} {
lt_foo="";
lt_count=0;
@@ -17529,29 +14826,10 @@ BEGIN {RS=" "; FS="/|\n";} {
if (lt_foo != "") { lt_freq[lt_foo]++; }
if (lt_freq[lt_foo] == 1) { print lt_foo; }
}'`
- # AWK program above erroneously prepends '/' to C:/dos/paths
- # for these hosts.
- case $host_os in
- mingw* | cegcc*) lt_search_path_spec=`$ECHO "$lt_search_path_spec" |\
- $SED 's,/\([A-Za-z]:\),\1,g'` ;;
- esac
- sys_lib_search_path_spec=`$ECHO "$lt_search_path_spec" | $lt_NL2SP`
+ sys_lib_search_path_spec=`echo $lt_search_path_spec`
else
sys_lib_search_path_spec="/lib /usr/lib /usr/local/lib"
fi
-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
@@ -17561,7 +14839,7 @@ need_version=unknown
case $host_os in
aix3*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
@@ -17569,8 +14847,8 @@ aix3*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
-aix[4-9]*)
- version_type=linux # correct to gnu/linux during the next big refactor
+aix4* | aix5*)
+ version_type=linux
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
@@ -17588,7 +14866,7 @@ aix[4-9]*)
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
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
:
else
can_build_shared=no
@@ -17614,18 +14892,9 @@ aix[4-9]*)
;;
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
+ 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=`$echo "X$lib" | $Xsed -e '\''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'
;;
beos*)
@@ -17635,7 +14904,7 @@ beos*)
;;
bsdi[45]*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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'
@@ -17648,112 +14917,61 @@ bsdi[45]*)
# libtool to hard-code these into programs
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32*)
version_type=windows
shrext_cmds=".dll"
need_version=no
need_lib_prefix=no
- case $GCC,$cc_basename in
- yes,*)
- # gcc
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
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'\''`~
+ 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'
+ chmod a+x \$dldir/$dlname'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
- $RM \$dlpath'
+ $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}'
-
- sys_lib_search_path_spec="$sys_lib_search_path_spec /usr/lib/w32api"
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
;;
- mingw* | cegcc*)
+ mingw*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ 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
;;
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
+ dynamic_linker='Win32 ld.exe'
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
@@ -17763,7 +14981,7 @@ darwin* | rhapsody*)
version_type=darwin
need_lib_prefix=no
need_version=no
- library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
soname_spec='${libname}${release}${major}$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
@@ -17774,7 +14992,7 @@ darwin* | rhapsody*)
;;
dgux*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -17782,6 +15000,10 @@ dgux*)
shlibpath_var=LD_LIBRARY_PATH
;;
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
@@ -17789,7 +15011,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[23].*) objformat=aout ;;
+ freebsd[123]*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -17807,7 +15029,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2.*)
+ freebsd2*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -17827,26 +15049,12 @@ freebsd* | dragonfly*)
;;
gnu*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
;;
@@ -17872,18 +15080,18 @@ hpux9* | hpux10* | hpux11*)
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
- ;;
- *)
+ 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
@@ -17892,14 +15100,12 @@ hpux9* | hpux10* | hpux11*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
esac
- # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ # 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
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -17915,7 +15121,7 @@ irix5* | irix6* | nonstopux*)
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
+ version_type=linux
else
version_type=irix
fi ;;
@@ -17952,9 +15158,9 @@ 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
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -17962,41 +15168,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
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\"; \
- LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec\""
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_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.
@@ -18004,7 +15175,7 @@ fi
# 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' ' '`
+ 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;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
@@ -18021,7 +15192,7 @@ netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ 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'
@@ -18036,22 +15207,20 @@ netbsd*)
;;
newsos6)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
+nto-qnx*)
+ version_type=linux
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'
+ shlibpath_overrides_runpath=yes
;;
openbsd*)
@@ -18060,13 +15229,13 @@ openbsd*)
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 ;;
+ 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
+ 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
@@ -18105,7 +15274,7 @@ rdos*)
;;
solaris*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -18130,7 +15299,7 @@ sunos4*)
;;
sysv4 | sysv4.3*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
@@ -18138,6 +15307,7 @@ sysv4 | sysv4.3*)
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
runpath_var=LD_RUN_PATH
;;
siemens)
@@ -18154,7 +15324,7 @@ sysv4 | sysv4.3*)
sysv4*MP*)
if test -d /usr/nec ;then
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
@@ -18168,12 +15338,13 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
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'
+ shlibpath_overrides_runpath=no
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
@@ -18183,19 +15354,8 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
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
+ version_type=linux
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
@@ -18205,8 +15365,8 @@ uts4*)
dynamic_linker=no
;;
esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
-$as_echo "$dynamic_linker" >&6; }
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -18214,117 +15374,19 @@ 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; }
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
hardcode_action=
-if test -n "$hardcode_libdir_flag_spec" ||
- test -n "$runpath_var" ||
+if test -n "$hardcode_libdir_flag_spec" || \
+ test -n "$runpath_var" || \
test "X$hardcode_automatic" = "Xyes" ; then
- # We can hardcode non-existent directories.
+ # We can hardcode non-existant directories.
if test "$hardcode_direct" != 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, )" != no &&
+ ## test "$_LT_AC_TAGVAR(hardcode_shlibpath_var, )" != no &&
test "$hardcode_minus_L" != no; then
# Linking always hardcodes the temporary library directory.
hardcode_action=relink
@@ -18337,11 +15399,10 @@ else
# directories.
hardcode_action=unsupported
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action" >&5
-$as_echo "$hardcode_action" >&6; }
+{ echo "$as_me:$LINENO: result: $hardcode_action" >&5
+echo "${ECHO_T}$hardcode_action" >&6; }
-if test "$hardcode_action" = relink ||
- test "$inherit_rpath" = yes; then
+if test "$hardcode_action" = relink; then
# Fast installation is not supported
enable_fast_install=no
elif test "$shlibpath_overrides_runpath" = yes ||
@@ -18350,12 +15411,37 @@ elif test "$shlibpath_overrides_runpath" = yes ||
enable_fast_install=needless
fi
+striplib=
+old_striplib=
+{ echo "$as_me:$LINENO: checking whether stripping libraries is possible" >&5
+echo $ECHO_N "checking whether stripping libraries is possible... $ECHO_C" >&6; }
+if test -n "$STRIP" && $STRIP -V 2>&1 | grep "GNU strip" >/dev/null; then
+ test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
+ test -z "$striplib" && striplib="$STRIP --strip-unneeded"
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+else
+# FIXME - insert some real tests, host_os isn't really good enough
+ case $host_os in
+ darwin*)
+ if test -n "$STRIP" ; then
+ striplib="$STRIP -x"
+ old_striplib="$STRIP -S"
+ { echo "$as_me:$LINENO: result: yes" >&5
+echo "${ECHO_T}yes" >&6; }
+ else
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+fi
+ ;;
+ *)
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
+ ;;
+ esac
+fi
-
-
-
-
- if test "x$enable_dlopen" != xyes; then
+if test "x$enable_dlopen" != xyes; then
enable_dlopen=unknown
enable_dlopen_self=unknown
enable_dlopen_self_static=unknown
@@ -18370,26 +15456,30 @@ else
lt_cv_dlopen_self=yes
;;
- mingw* | pw32* | cegcc*)
+ mingw* | pw32*)
lt_cv_dlopen="LoadLibrary"
lt_cv_dlopen_libs=
- ;;
+ ;;
cygwin*)
lt_cv_dlopen="dlopen"
lt_cv_dlopen_libs=
- ;;
+ ;;
darwin*)
# if libdl is installed we need to link against it
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -18407,18 +15497,39 @@ return dlopen ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_dl_dlopen=yes
else
- ac_cv_lib_dl_dlopen=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
@@ -18428,21 +15539,105 @@ else
fi
- ;;
+ ;;
*)
- ac_fn_c_check_func "$LINENO" "shl_load" "ac_cv_func_shl_load"
-if test "x$ac_cv_func_shl_load" = xyes; then :
+ { echo "$as_me:$LINENO: checking for shl_load" >&5
+echo $ECHO_N "checking for shl_load... $ECHO_C" >&6; }
+if test "${ac_cv_func_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define shl_load to an innocuous variant, in case <limits.h> declares shl_load.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define shl_load innocuous_shl_load
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char shl_load (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef shl_load
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char shl_load ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_shl_load || defined __stub___shl_load
+choke me
+#endif
+
+int
+main ()
+{
+return shl_load ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_shl_load=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_shl_load=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_shl_load" >&5
+echo "${ECHO_T}$ac_cv_func_shl_load" >&6; }
+if test $ac_cv_func_shl_load = yes; then
lt_cv_dlopen="shl_load"
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for shl_load in -ldld" >&5
-$as_echo_n "checking for shl_load in -ldld... " >&6; }
-if ${ac_cv_lib_dld_shl_load+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for shl_load in -ldld" >&5
+echo $ECHO_N "checking for shl_load in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_shl_load+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -18460,32 +15655,137 @@ return shl_load ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_dld_shl_load=yes
else
- ac_cv_lib_dld_shl_load=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_shl_load=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_shl_load" >&5
-$as_echo "$ac_cv_lib_dld_shl_load" >&6; }
-if test "x$ac_cv_lib_dld_shl_load" = xyes; then :
- lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-ldld"
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_shl_load" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_shl_load" >&6; }
+if test $ac_cv_lib_dld_shl_load = yes; then
+ lt_cv_dlopen="shl_load" lt_cv_dlopen_libs="-dld"
+else
+ { echo "$as_me:$LINENO: checking for dlopen" >&5
+echo $ECHO_N "checking for dlopen... $ECHO_C" >&6; }
+if test "${ac_cv_func_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_fn_c_check_func "$LINENO" "dlopen" "ac_cv_func_dlopen"
-if test "x$ac_cv_func_dlopen" = xyes; then :
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define dlopen to an innocuous variant, in case <limits.h> declares dlopen.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define dlopen innocuous_dlopen
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char dlopen (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef dlopen
+
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char dlopen ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_dlopen || defined __stub___dlopen
+choke me
+#endif
+
+int
+main ()
+{
+return dlopen ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_dlopen=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_func_dlopen=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_dlopen" >&5
+echo "${ECHO_T}$ac_cv_func_dlopen" >&6; }
+if test $ac_cv_func_dlopen = yes; then
lt_cv_dlopen="dlopen"
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -ldl" >&5
-$as_echo_n "checking for dlopen in -ldl... " >&6; }
-if ${ac_cv_lib_dl_dlopen+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for dlopen in -ldl" >&5
+echo $ECHO_N "checking for dlopen in -ldl... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dl_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldl $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -18503,28 +15803,53 @@ return dlopen ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_dl_dlopen=yes
else
- ac_cv_lib_dl_dlopen=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dl_dlopen=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dl_dlopen" >&5
-$as_echo "$ac_cv_lib_dl_dlopen" >&6; }
-if test "x$ac_cv_lib_dl_dlopen" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dl_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_dl_dlopen" >&6; }
+if test $ac_cv_lib_dl_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-ldl"
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dlopen in -lsvld" >&5
-$as_echo_n "checking for dlopen in -lsvld... " >&6; }
-if ${ac_cv_lib_svld_dlopen+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for dlopen in -lsvld" >&5
+echo $ECHO_N "checking for dlopen in -lsvld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_svld_dlopen+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lsvld $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -18542,28 +15867,53 @@ return dlopen ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_svld_dlopen=yes
else
- ac_cv_lib_svld_dlopen=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_svld_dlopen=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_svld_dlopen" >&5
-$as_echo "$ac_cv_lib_svld_dlopen" >&6; }
-if test "x$ac_cv_lib_svld_dlopen" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_svld_dlopen" >&5
+echo "${ECHO_T}$ac_cv_lib_svld_dlopen" >&6; }
+if test $ac_cv_lib_svld_dlopen = yes; then
lt_cv_dlopen="dlopen" lt_cv_dlopen_libs="-lsvld"
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for dld_link in -ldld" >&5
-$as_echo_n "checking for dld_link in -ldld... " >&6; }
-if ${ac_cv_lib_dld_dld_link+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for dld_link in -ldld" >&5
+echo $ECHO_N "checking for dld_link in -ldld... $ECHO_C" >&6; }
+if test "${ac_cv_lib_dld_dld_link+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-ldld $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -18581,19 +15931,40 @@ return dld_link ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_dld_dld_link=yes
else
- ac_cv_lib_dld_dld_link=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_dld_dld_link=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_dld_dld_link" >&5
-$as_echo "$ac_cv_lib_dld_dld_link" >&6; }
-if test "x$ac_cv_lib_dld_dld_link" = xyes; then :
- lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-ldld"
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_dld_dld_link" >&5
+echo "${ECHO_T}$ac_cv_lib_dld_dld_link" >&6; }
+if test $ac_cv_lib_dld_dld_link = yes; then
+ lt_cv_dlopen="dld_link" lt_cv_dlopen_libs="-dld"
fi
@@ -18631,18 +16002,18 @@ fi
save_LIBS="$LIBS"
LIBS="$lt_cv_dlopen_libs $LIBS"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a program can dlopen itself" >&5
-$as_echo_n "checking whether a program can dlopen itself... " >&6; }
-if ${lt_cv_dlopen_self+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking whether a program can dlopen itself" >&5
+echo $ECHO_N "checking whether a program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then :
lt_cv_dlopen_self=cross
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
-#line $LINENO "configure"
+ cat > conftest.$ac_ext <<EOF
+#line 16016 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18683,13 +16054,11 @@ else
# endif
#endif
-/* When -fvisbility=hidden is used, assume the code has been annotated
- correspondingly for the symbols needed. */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
+#ifdef __cplusplus
+extern "C" void exit (int);
#endif
-int fnord () { return 42; }
+void fnord() { int i=42;}
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -18698,24 +16067,20 @@ int main ()
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
- else
- {
- if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
- else puts (dlerror ());
- }
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
/* dlclose (self); */
}
else
puts (dlerror ());
- return status;
+ exit (status);
}
-_LT_EOF
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&5 2>/dev/null
lt_status=$?
case x$lt_status in
@@ -18732,23 +16097,23 @@ rm -fr conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self" >&5
-$as_echo "$lt_cv_dlopen_self" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self" >&6; }
if test "x$lt_cv_dlopen_self" = xyes; then
wl=$lt_prog_compiler_wl eval LDFLAGS=\"\$LDFLAGS $lt_prog_compiler_static\"
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether a statically linked program can dlopen itself" >&5
-$as_echo_n "checking whether a statically linked program can dlopen itself... " >&6; }
-if ${lt_cv_dlopen_self_static+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking whether a statically linked program can dlopen itself" >&5
+echo $ECHO_N "checking whether a statically linked program can dlopen itself... $ECHO_C" >&6; }
+if test "${lt_cv_dlopen_self_static+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test "$cross_compiling" = yes; then :
lt_cv_dlopen_self_static=cross
else
lt_dlunknown=0; lt_dlno_uscore=1; lt_dlneed_uscore=2
lt_status=$lt_dlunknown
- cat > conftest.$ac_ext <<_LT_EOF
-#line $LINENO "configure"
+ cat > conftest.$ac_ext <<EOF
+#line 16116 "configure"
#include "confdefs.h"
#if HAVE_DLFCN_H
@@ -18789,13 +16154,11 @@ else
# endif
#endif
-/* When -fvisbility=hidden is used, assume the code has been annotated
- correspondingly for the symbols needed. */
-#if defined(__GNUC__) && (((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)) || (__GNUC__ > 3))
-int fnord () __attribute__((visibility("default")));
+#ifdef __cplusplus
+extern "C" void exit (int);
#endif
-int fnord () { return 42; }
+void fnord() { int i=42;}
int main ()
{
void *self = dlopen (0, LT_DLGLOBAL|LT_DLLAZY_OR_NOW);
@@ -18804,24 +16167,20 @@ int main ()
if (self)
{
if (dlsym (self,"fnord")) status = $lt_dlno_uscore;
- else
- {
- if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
- else puts (dlerror ());
- }
+ else if (dlsym( self,"_fnord")) status = $lt_dlneed_uscore;
/* dlclose (self); */
}
else
puts (dlerror ());
- return status;
+ exit (status);
}
-_LT_EOF
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_link\""; } >&5
+EOF
+ if { (eval echo "$as_me:$LINENO: \"$ac_link\"") >&5
(eval $ac_link) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; } && test -s conftest${ac_exeext} 2>/dev/null; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && test -s conftest${ac_exeext} 2>/dev/null; then
(./conftest; exit; ) >&5 2>/dev/null
lt_status=$?
case x$lt_status in
@@ -18838,8 +16197,8 @@ rm -fr conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_dlopen_self_static" >&5
-$as_echo "$lt_cv_dlopen_self_static" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_dlopen_self_static" >&5
+echo "${ECHO_T}$lt_cv_dlopen_self_static" >&6; }
fi
CPPFLAGS="$save_CPPFLAGS"
@@ -18860,281 +16219,628 @@ $as_echo "$lt_cv_dlopen_self_static" >&6; }
fi
+# Report which library types will actually be built
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&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
+ ;;
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler \
+ CC \
+ LD \
+ lt_prog_compiler_wl \
+ lt_prog_compiler_pic \
+ lt_prog_compiler_static \
+ lt_prog_compiler_no_builtin_flag \
+ export_dynamic_flag_spec \
+ thread_safe_flag_spec \
+ whole_archive_flag_spec \
+ enable_shared_with_static_runtimes \
+ old_archive_cmds \
+ old_archive_from_new_cmds \
+ predep_objects \
+ postdep_objects \
+ predeps \
+ postdeps \
+ compiler_lib_search_path \
+ archive_cmds \
+ archive_expsym_cmds \
+ postinstall_cmds \
+ postuninstall_cmds \
+ old_archive_from_expsyms_cmds \
+ allow_undefined_flag \
+ no_undefined_flag \
+ export_symbols_cmds \
+ hardcode_libdir_flag_spec \
+ hardcode_libdir_flag_spec_ld \
+ hardcode_libdir_separator \
+ hardcode_automatic \
+ module_cmds \
+ module_expsym_cmds \
+ lt_cv_prog_compiler_c_o \
+ fix_srcfile_path \
+ exclude_expsyms \
+ include_expsyms; do
+
+ case $var in
+ old_archive_cmds | \
+ old_archive_from_new_cmds | \
+ archive_cmds | \
+ archive_expsym_cmds | \
+ module_cmds | \
+ module_expsym_cmds | \
+ old_archive_from_expsyms_cmds | \
+ export_symbols_cmds | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+cfgfile="${ofile}T"
+ trap "$rm \"$cfgfile\"; exit 1" 1 2 15
+ $rm -f "$cfgfile"
+ { echo "$as_me:$LINENO: creating $ofile" >&5
+echo "$as_me: creating $ofile" >&6;}
+ cat <<__EOF__ >> "$cfgfile"
+#! $SHELL
+# `$echo "$cfgfile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
+# Generated automatically by $PROGRAM (GNU $PACKAGE $VERSION$TIMESTAMP)
+# NOTE: Changes made to this file will be lost: look at ltmain.sh.
+#
+# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007
+# Free Software Foundation, Inc.
+#
+# This file is part of GNU Libtool:
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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.
+#
+# 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.
+# A sed program that does not truncate output.
+SED=$lt_SED
+# Sed that helps us avoid accidentally triggering echo(1) options like -n.
+Xsed="$SED -e 1s/^X//"
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+# The names of the tagged configurations supported by this script.
+available_tags=
+# ### BEGIN LIBTOOL CONFIG
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
-striplib=
-old_striplib=
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether stripping libraries is possible" >&5
-$as_echo_n "checking whether stripping libraries is possible... " >&6; }
-if test -n "$STRIP" && $STRIP -V 2>&1 | $GREP "GNU strip" >/dev/null; then
- test -z "$old_striplib" && old_striplib="$STRIP --strip-debug"
- test -z "$striplib" && striplib="$STRIP --strip-unneeded"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
-else
-# FIXME - insert some real tests, host_os isn't really good enough
- case $host_os in
- darwin*)
- if test -n "$STRIP" ; then
- striplib="$STRIP -x"
- old_striplib="$STRIP -S"
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
-$as_echo "yes" >&6; }
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- fi
- ;;
- *)
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
- ;;
- esac
-fi
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+# A C compiler.
+LTCC=$lt_LTCC
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+# A language-specific compiler.
+CC=$lt_compiler
- # Report which library types will actually be built
- { $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; }
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC
- { $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
+# An ERE matcher.
+EGREP=$lt_EGREP
- # 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
- ;;
+# The linker used to build libraries.
+LD=$lt_LD
- 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; }
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
- { $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; }
+# A BSD-compatible nm program.
+NM=$lt_NM
+# A symbol stripping program
+STRIP=$lt_STRIP
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
-fi
-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
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
-CC="$lt_save_CC"
+# Used on cygwin: assembler.
+AS="$AS"
- if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
- ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
- (test "X$CXX" != "Xg++"))) ; then
- ac_ext=cpp
-ac_cpp='$CXXCPP $CPPFLAGS'
-ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
-ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
-ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to run the C++ preprocessor" >&5
-$as_echo_n "checking how to run the C++ preprocessor... " >&6; }
-if test -z "$CXXCPP"; then
- if ${ac_cv_prog_CXXCPP+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- # Double quotes because CXXCPP needs to be expanded
- for CXXCPP in "$CXX -E" "/lib/cpp"
- do
- ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
- break
-fi
+# Object file suffix (normally "o").
+objext="$ac_objext"
- done
- ac_cv_prog_CXXCPP=$CXXCPP
+# Old archive suffix (normally "a").
+libext="$libext"
-fi
- CXXCPP=$ac_cv_prog_CXXCPP
-else
- ac_cv_prog_CXXCPP=$CXXCPP
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $CXXCPP" >&5
-$as_echo "$CXXCPP" >&6; }
-ac_preproc_ok=false
-for ac_cxx_preproc_warn_flag in '' yes
-do
- # Use a header file that comes with gcc, so configuring glibc
- # with a fresh cross-compiler works.
- # Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
- # <limits.h> exists even on freestanding compilers.
- # On the NeXT, cc -E runs the code through the compiler's parser,
- # not just through cpp. "Syntax error" is here to catch this case.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifdef __STDC__
-# include <limits.h>
-#else
-# include <assert.h>
-#endif
- Syntax error
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
-else
- # Broken: fails on valid input.
-continue
-fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+# Executable file suffix (normally "").
+exeext="$exeext"
- # OK, works on sane cases. Now check whether nonexistent headers
- # can be detected and how.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <ac_nonexistent.h>
-_ACEOF
-if ac_fn_cxx_try_cpp "$LINENO"; then :
- # Broken: success on invalid input.
-continue
-else
- # Passes both tests.
-ac_preproc_ok=:
-break
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds
+archive_expsym_cmds=$lt_archive_expsym_cmds
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds
+module_expsym_cmds=$lt_module_expsym_cmds
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# 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
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var
+
+# 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
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms
+
+# ### END LIBTOOL CONFIG
+
+__EOF__
+
+
+ case $host_os in
+ aix3*)
+ cat <<\EOF >> "$cfgfile"
+
+# AIX sometimes has problems with the GCC collect2 program. For some
+# reason, if we set the COLLECT_NAMES environment variable, the problems
+# vanish in a puff of smoke.
+if test "X${COLLECT_NAMES+set}" != Xset; then
+ COLLECT_NAMES=
+ export COLLECT_NAMES
fi
-rm -f conftest.err conftest.i conftest.$ac_ext
+EOF
+ ;;
+ esac
-done
-# Because of `break', _AC_PREPROC_IFELSE's cleaning code was skipped.
-rm -f conftest.i conftest.err conftest.$ac_ext
-if $ac_preproc_ok; then :
+ # We use sed instead of cat because bash on DJGPP gets confused if
+ # if finds mixed CR/LF and LF-only lines. Since sed operates in
+ # text mode, it properly converts lines to CR/LF. This bash problem
+ # is reportedly fixed, but why not run on old versions too?
+ sed '$q' "$ltmain" >> "$cfgfile" || (rm -f "$cfgfile"; exit 1)
+
+ mv -f "$cfgfile" "$ofile" || \
+ (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
+ chmod +x "$ofile"
else
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error $? "C++ preprocessor \"$CXXCPP\" fails sanity check
-See \`config.log' for more details" "$LINENO" 5; }
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
fi
+
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
-else
- _lt_caught_CXX_error=yes
+CC="$lt_save_CC"
+
+
+# Check whether --with-tags was given.
+if test "${with_tags+set}" = set; then
+ withval=$with_tags; tagnames="$withval"
fi
-ac_ext=cpp
+
+if test -f "$ltmain" && test -n "$tagnames"; then
+ if test ! -f "${ofile}"; then
+ { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not exist" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not exist" >&2;}
+ fi
+
+ if test -z "$LTCC"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCC='`"
+ if test -z "$LTCC"; then
+ { echo "$as_me:$LINENO: WARNING: output file \`$ofile' does not look like a libtool script" >&5
+echo "$as_me: WARNING: output file \`$ofile' does not look like a libtool script" >&2;}
+ else
+ { echo "$as_me:$LINENO: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&5
+echo "$as_me: WARNING: using \`LTCC=$LTCC', extracted from \`$ofile'" >&2;}
+ fi
+ fi
+ if test -z "$LTCFLAGS"; then
+ eval "`$SHELL ${ofile} --config | grep '^LTCFLAGS='`"
+ fi
+
+ # Extract list of available tagged configurations in $ofile.
+ # Note that this assumes the entire list is on one line.
+ available_tags=`grep "^available_tags=" "${ofile}" | $SED -e 's/available_tags=\(.*$\)/\1/' -e 's/\"//g'`
+
+ lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
+ for tagname in $tagnames; do
+ IFS="$lt_save_ifs"
+ # Check whether tagname contains only valid characters
+ case `$echo "X$tagname" | $Xsed -e 's:[-_ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890,/]::g'` in
+ "") ;;
+ *) { { echo "$as_me:$LINENO: error: invalid tag name: $tagname" >&5
+echo "$as_me: error: invalid tag name: $tagname" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "${ofile}" > /dev/null
+ then
+ { { echo "$as_me:$LINENO: error: tag name \"$tagname\" already exists" >&5
+echo "$as_me: error: tag name \"$tagname\" already exists" >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+
+ # Update the list of available tags.
+ if test -n "$tagname"; then
+ echo appending configuration tag \"$tagname\" to $ofile
+
+ case $tagname in
+ CXX)
+ if test -n "$CXX" && ( test "X$CXX" != "Xno" &&
+ ( (test "X$CXX" = "Xg++" && `g++ -v >/dev/null 2>&1` ) ||
+ (test "X$CXX" != "Xg++"))) ; then
+ ac_ext=cpp
ac_cpp='$CXXCPP $CPPFLAGS'
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
+
+
+
archive_cmds_need_lc_CXX=no
allow_undefined_flag_CXX=
always_export_symbols_CXX=no
archive_expsym_cmds_CXX=
-compiler_needs_object_CXX=no
export_dynamic_flag_spec_CXX=
hardcode_direct_CXX=no
-hardcode_direct_absolute_CXX=no
hardcode_libdir_flag_spec_CXX=
+hardcode_libdir_flag_spec_ld_CXX=
hardcode_libdir_separator_CXX=
hardcode_minus_L_CXX=no
hardcode_shlibpath_var_CXX=unsupported
hardcode_automatic_CXX=no
-inherit_rpath_CXX=no
module_cmds_CXX=
module_expsym_cmds_CXX=
link_all_deplibs_CXX=unknown
old_archive_cmds_CXX=$old_archive_cmds
-reload_flag_CXX=$reload_flag
-reload_cmds_CXX=$reload_cmds
no_undefined_flag_CXX=
whole_archive_flag_spec_CXX=
enable_shared_with_static_runtimes_CXX=no
+# Dependencies to place before and after the object being linked:
+predep_objects_CXX=
+postdep_objects_CXX=
+predeps_CXX=
+postdeps_CXX=
+compiler_lib_search_path_CXX=
+
# Source file extension for C++ test sources.
ac_ext=cpp
@@ -19142,23 +16848,13 @@ ac_ext=cpp
objext=o
objext_CXX=$objext
-# No sense in running all these tests if we already determined that
-# the CXX 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_caught_CXX_error" != yes; then
- # Code to be used in simple compile tests
- lt_simple_compile_test_code="int some_variable = 0;"
-
- # Code to be used in simple link tests
- lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
-
- # ltmain only uses $CC for tagged configurations so make sure $CC is set.
-
-
-
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="int some_variable = 0;"
+# Code to be used in simple link tests
+lt_simple_link_test_code='int main(int, char *[]) { return(0); }'
+# ltmain only uses $CC for tagged configurations so make sure $CC is set.
# If no C compiler was specified, use CC.
LTCC=${LTCC-"$CC"}
@@ -19170,44 +16866,42 @@ LTCFLAGS=${LTCFLAGS-"$CFLAGS"}
compiler=$CC
- # save warnings/boilerplate of simple test code
- ac_outfile=conftest.$ac_objext
+# 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*
+$rm conftest*
- ac_outfile=conftest.$ac_objext
+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_CFLAGS=$CFLAGS
- lt_save_LD=$LD
- lt_save_GCC=$GCC
- GCC=$GXX
- lt_save_with_gnu_ld=$with_gnu_ld
- lt_save_path_LD=$lt_cv_path_LD
- if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
- lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
- else
- $as_unset lt_cv_prog_gnu_ld
- fi
- if test -n "${lt_cv_path_LDCXX+set}"; then
- lt_cv_path_LD=$lt_cv_path_LDCXX
- else
- $as_unset lt_cv_path_LD
- fi
- test -z "${LDCXX+set}" || LD=$LDCXX
- CC=${CXX-"c++"}
- CFLAGS=$CXXFLAGS
- compiler=$CC
- compiler_CXX=$CC
- for cc_temp in $compiler""; do
+$rm conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC=$CC
+lt_save_LD=$LD
+lt_save_GCC=$GCC
+GCC=$GXX
+lt_save_with_gnu_ld=$with_gnu_ld
+lt_save_path_LD=$lt_cv_path_LD
+if test -n "${lt_cv_prog_gnu_ldcxx+set}"; then
+ lt_cv_prog_gnu_ld=$lt_cv_prog_gnu_ldcxx
+else
+ $as_unset lt_cv_prog_gnu_ld
+fi
+if test -n "${lt_cv_path_LDCXX+set}"; then
+ lt_cv_path_LD=$lt_cv_path_LDCXX
+else
+ $as_unset lt_cv_path_LD
+fi
+test -z "${LDCXX+set}" || LD=$LDCXX
+CC=${CXX-"c++"}
+compiler=$CC
+compiler_CXX=$CC
+for cc_temp in $compiler""; do
case $cc_temp in
compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
@@ -19215,25 +16909,23 @@ $RM -r conftest*
*) break;;
esac
done
-cc_basename=`$ECHO "$cc_temp" | $SED "s%.*/%%; s%^$host_alias-%%"`
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
- if test -n "$compiler"; then
- # We don't want -fno-exception when compiling C++ code, so set the
- # no_builtin_flag separately
- if test "$GXX" = yes; then
- lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
- else
- lt_prog_compiler_no_builtin_flag_CXX=
- fi
-
- if test "$GXX" = yes; then
- # Set up default GNU C++ configuration
+# We don't want -fno-exception wen compiling C++ code, so set the
+# no_builtin_flag separately
+if test "$GXX" = yes; then
+ lt_prog_compiler_no_builtin_flag_CXX=' -fno-builtin'
+else
+ lt_prog_compiler_no_builtin_flag_CXX=
+fi
+if test "$GXX" = yes; then
+ # Set up default GNU C++ configuration
# Check whether --with-gnu-ld was given.
-if test "${with_gnu_ld+set}" = set; then :
+if test "${with_gnu_ld+set}" = set; then
withval=$with_gnu_ld; test "$withval" = no || with_gnu_ld=yes
else
with_gnu_ld=no
@@ -19242,8 +16934,8 @@ fi
ac_prog=ld
if test "$GCC" = yes; then
# Check if gcc -print-prog-name=ld gives a path.
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for ld used by $CC" >&5
-$as_echo_n "checking for ld used by $CC... " >&6; }
+ { echo "$as_me:$LINENO: checking for ld used by $CC" >&5
+echo $ECHO_N "checking for ld used by $CC... $ECHO_C" >&6; }
case $host in
*-*-mingw*)
# gcc leaves a trailing carriage return which upsets mingw
@@ -19256,9 +16948,9 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
[\\/]* | ?:[\\/]*)
re_direlt='/[^/][^/]*/\.\./'
# Canonicalize the pathname of ld
- ac_prog=`$ECHO "$ac_prog"| $SED 's%\\\\%/%g'`
- while $ECHO "$ac_prog" | $GREP "$re_direlt" > /dev/null 2>&1; do
- ac_prog=`$ECHO $ac_prog| $SED "s%$re_direlt%/%"`
+ ac_prog=`echo $ac_prog| $SED 's%\\\\%/%g'`
+ while echo $ac_prog | grep "$re_direlt" > /dev/null 2>&1; do
+ ac_prog=`echo $ac_prog| $SED "s%$re_direlt%/%"`
done
test -z "$LD" && LD="$ac_prog"
;;
@@ -19272,14 +16964,14 @@ $as_echo_n "checking for ld used by $CC... " >&6; }
;;
esac
elif test "$with_gnu_ld" = yes; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for GNU ld" >&5
-$as_echo_n "checking for GNU ld... " >&6; }
+ { echo "$as_me:$LINENO: checking for GNU ld" >&5
+echo $ECHO_N "checking for GNU ld... $ECHO_C" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for non-GNU ld" >&5
-$as_echo_n "checking for non-GNU ld... " >&6; }
+ { echo "$as_me:$LINENO: checking for non-GNU ld" >&5
+echo $ECHO_N "checking for non-GNU ld... $ECHO_C" >&6; }
fi
-if ${lt_cv_path_LD+:} false; then :
- $as_echo_n "(cached) " >&6
+if test "${lt_cv_path_LD+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -z "$LD"; then
lt_save_ifs="$IFS"; IFS=$PATH_SEPARATOR
@@ -19309,17 +17001,19 @@ fi
LD="$lt_cv_path_LD"
if test -n "$LD"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LD" >&5
-$as_echo "$LD" >&6; }
+ { echo "$as_me:$LINENO: result: $LD" >&5
+echo "${ECHO_T}$LD" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
-test -z "$LD" && as_fn_error $? "no acceptable ld found in \$PATH" "$LINENO" 5
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the linker ($LD) is GNU ld" >&5
-$as_echo_n "checking if the linker ($LD) is GNU ld... " >&6; }
-if ${lt_cv_prog_gnu_ld+:} false; then :
- $as_echo_n "(cached) " >&6
+test -z "$LD" && { { echo "$as_me:$LINENO: error: no acceptable ld found in \$PATH" >&5
+echo "$as_me: error: no acceptable ld found in \$PATH" >&2;}
+ { (exit 1); exit 1; }; }
+{ echo "$as_me:$LINENO: checking if the linker ($LD) is GNU ld" >&5
+echo $ECHO_N "checking if the linker ($LD) is GNU ld... $ECHO_C" >&6; }
+if test "${lt_cv_prog_gnu_ld+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# I'd rather use --version here, but apparently some GNU lds only accept -v.
case `$LD -v 2>&1 </dev/null` in
@@ -19331,169 +17025,159 @@ case `$LD -v 2>&1 </dev/null` in
;;
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_gnu_ld" >&5
-$as_echo "$lt_cv_prog_gnu_ld" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_gnu_ld" >&5
+echo "${ECHO_T}$lt_cv_prog_gnu_ld" >&6; }
with_gnu_ld=$lt_cv_prog_gnu_ld
+ # Check if GNU C++ uses GNU ld as the underlying linker, since the
+ # archiving commands below assume that GNU ld is being used.
+ if test "$with_gnu_ld" = yes; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ # If archive_cmds runs LD, not CC, wlarc should be empty
+ # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
+ # investigate it a little bit more. (MM)
+ wlarc='${wl}'
+ # ancient GNU ld didn't support --whole-archive et. al.
+ if eval "`$CC -print-prog-name=ld` --help 2>&1" | \
+ grep 'no-whole-archive' > /dev/null; then
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_CXX=
+ fi
+ else
+ with_gnu_ld=no
+ wlarc=
- # Check if GNU C++ uses GNU ld as the underlying linker, since the
- # archiving commands below assume that GNU ld is being used.
- if test "$with_gnu_ld" = yes; then
- archive_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds_CXX='$CC $pic_flag -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
-
- hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-
- # If archive_cmds runs LD, not CC, wlarc should be empty
- # XXX I think wlarc can be eliminated in ltcf-cxx, but I need to
- # investigate it a little bit more. (MM)
- wlarc='${wl}'
+ # A generic and very simple default shared library creation
+ # command for GNU C++ for the case where it uses the native
+ # linker, instead of GNU ld. If possible, this setting should
+ # overridden to take advantage of the native linker features on
+ # the platform it is being used on.
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ fi
- # ancient GNU ld didn't support --whole-archive et. al.
- if eval "`$CC -print-prog-name=ld` --help 2>&1" |
- $GREP 'no-whole-archive' > /dev/null; then
- whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- else
- whole_archive_flag_spec_CXX=
- fi
- else
- with_gnu_ld=no
- wlarc=
-
- # A generic and very simple default shared library creation
- # command for GNU C++ for the case where it uses the native
- # linker, instead of GNU ld. If possible, this setting should
- # overridden to take advantage of the native linker features on
- # the platform it is being used on.
- archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- fi
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
+else
+ GXX=no
+ with_gnu_ld=no
+ wlarc=
+fi
+# PORTME: fill in a description of your system's C++ link characteristics
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ld_shlibs_CXX=yes
+case $host_os in
+ aix3*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aix4* | aix5*)
+ 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
- GXX=no
- with_gnu_ld=no
- wlarc=
+ 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].*|aix5*)
+ for ld_flag in $LDFLAGS; do
+ case $ld_flag in
+ *-brtl*)
+ aix_use_runtimelinking=yes
+ break
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ exp_sym_flag='-bexport'
+ no_entry_flag='-bnoentry'
fi
- # PORTME: fill in a description of your system's C++ link characteristics
- { $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; }
- ld_shlibs_CXX=yes
- case $host_os in
- aix3*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- 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
- 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
- case $ld_flag in
- *-brtl*)
- aix_use_runtimelinking=yes
- break
- ;;
- esac
- done
- ;;
- esac
+ # 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.
- exp_sym_flag='-bexport'
- no_entry_flag='-bnoentry'
- fi
+ archive_cmds_CXX=''
+ hardcode_direct_CXX=yes
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
- # 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_CXX=''
- hardcode_direct_CXX=yes
- hardcode_direct_absolute_CXX=yes
- hardcode_libdir_separator_CXX=':'
- link_all_deplibs_CXX=yes
- file_list_spec_CXX='${wl}-f,'
-
- if test "$GXX" = 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_CXX=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_CXX=yes
- hardcode_libdir_flag_spec_CXX='-L$libdir'
- hardcode_libdir_separator_CXX=
- 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
+ if test "$GXX" = 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_CXX=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_CXX=yes
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ hardcode_libdir_separator_CXX=
+ 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_CXX='${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_CXX=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_CXX='-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__CXX+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ # 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_CXX=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_CXX='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -19504,50 +17188,63 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-
- lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\([^ ]*\) *$/\1/
- p
- }
- }'
- lt_cv_aix_libpath__CXX=`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__CXX"; then
- lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
- fi
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- if test -z "$lt_cv_aix_libpath__CXX"; then
- lt_cv_aix_libpath__CXX="/usr/lib:/lib"
- fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-fi
- aix_libpath=$lt_cv_aix_libpath__CXX
fi
- hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
- archive_expsym_cmds_CXX='$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_CXX='${wl}-R $libdir:/usr/lib:/lib'
- allow_undefined_flag_CXX="-z nodefs"
- archive_expsym_cmds_CXX="\$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__CXX+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ hardcode_libdir_flag_spec_CXX='${wl}-blibpath:$libdir:'"$aix_libpath"
+
+ archive_expsym_cmds_CXX="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${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_CXX='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_CXX="-z nodefs"
+ archive_expsym_cmds_CXX="\$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.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -19558,858 +17255,810 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_cxx_try_link "$LINENO"; then :
-
- lt_aix_libpath_sed='
- /Import File Strings/,/^$/ {
- /^0/ {
- s/^0 *\([^ ]*\) *$/\1/
- p
- }
- }'
- lt_cv_aix_libpath__CXX=`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__CXX"; then
- lt_cv_aix_libpath__CXX=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
- fi
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
- if test -z "$lt_cv_aix_libpath__CXX"; then
- lt_cv_aix_libpath__CXX="/usr/lib:/lib"
- fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-fi
- aix_libpath=$lt_cv_aix_libpath__CXX
fi
- hardcode_libdir_flag_spec_CXX='${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_CXX=' ${wl}-bernotok'
- allow_undefined_flag_CXX=' ${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_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- else
- # Exported symbols can be pulled into shared objects from archives
- whole_archive_flag_spec_CXX='$convenience'
- fi
- archive_cmds_need_lc_CXX=yes
- # This is similar to how AIX traditionally builds its shared
- # libraries.
- archive_expsym_cmds_CXX="\$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
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_CXX='${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_CXX=' ${wl}-bernotok'
+ allow_undefined_flag_CXX=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_CXX='$convenience'
+ archive_cmds_need_lc_CXX=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_CXX="\$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
+ ;;
+
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_CXX=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+
+ chorus*)
+ case $cc_basename in
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_CXX='-L$libdir'
+ allow_undefined_flag_CXX=unsupported
+ always_export_symbols_CXX=no
+ enable_shared_with_static_runtimes_CXX=yes
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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_CXX='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_CXX='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_CXX='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_CXX='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_direct_CXX=no
+ hardcode_automatic_CXX=yes
+ hardcode_shlibpath_var_CXX=unsupported
+ whole_archive_flag_spec_CXX=''
+ link_all_deplibs_CXX=yes
+
+ if test "$GXX" = yes ; then
+ lt_int_apple_cc_single_mod=no
+ output_verbose_link_cmd='echo'
+ if $CC -dumpspecs 2>&1 | $EGREP 'single_module' >/dev/null ; then
+ lt_int_apple_cc_single_mod=yes
+ fi
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ archive_cmds_CXX='$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ else
+ archive_cmds_CXX='$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
fi
+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ if test "X$lt_int_apple_cc_single_mod" = Xyes ; then
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib -single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -r -keep_private_externs -nostdlib -o ${lib}-master.o $libobjs~$CC -dynamiclib $allow_undefined_flag -o $lib ${lib}-master.o $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ fi
+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_CXX='$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds_CXX='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj ${wl}-single_module $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_CXX='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ fi
;;
- beos*)
- if $LD --help 2>&1 | $GREP ': supported targets:.* elf' > /dev/null; then
- allow_undefined_flag_CXX=unsupported
- # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
- # support --undefined. This deserves some investigation. FIXME
- archive_cmds_CXX='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- else
- ld_shlibs_CXX=no
- fi
+ dgux*)
+ case $cc_basename in
+ ec++*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ ghcx*)
+ # Green Hills C++ Compiler
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
;;
+ esac
+ ;;
+ freebsd[12]*)
+ # C++ shared libraries reported to be fairly broken before switch to ELF
+ ld_shlibs_CXX=no
+ ;;
+ freebsd-elf*)
+ archive_cmds_need_lc_CXX=no
+ ;;
+ freebsd* | dragonfly*)
+ # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
+ # conventions
+ ld_shlibs_CXX=yes
+ ;;
+ gnu*)
+ ;;
+ hpux9*)
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
- chorus*)
- case $cc_basename in
- *)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- esac
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "[-]L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ archive_cmds_CXX='$rm $output_objdir/$soname~$CC -shared -nostdlib -fPIC ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ hpux10*|hpux11*)
+ if test $with_gnu_ld = no; then
+ hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+
+ case $host_cpu in
+ hppa*64*|ia64*) ;;
+ *)
+ export_dynamic_flag_spec_CXX='${wl}-E'
;;
+ esac
+ fi
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ ;;
+ *)
+ hardcode_direct_CXX=yes
+ hardcode_minus_L_CXX=yes # Not in the search PATH,
+ # but as the default
+ # location of the library.
+ ;;
+ esac
- cygwin* | mingw* | pw32* | cegcc*)
- case $GXX,$cc_basename in
- ,cl* | no,cl*)
- # Native MSVC
- # hardcode_libdir_flag_spec is actually meaningless, as there is
- # no search path for DLLs.
- hardcode_libdir_flag_spec_CXX=' '
- allow_undefined_flag_CXX=unsupported
- always_export_symbols_CXX=yes
- file_list_spec_CXX='@'
- # 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_CXX='$CC -o $output_objdir/$soname $libobjs $compiler_flags $deplibs -Wl,-dll~linknames='
- archive_expsym_cmds_CXX='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, CXX)='true'
- enable_shared_with_static_runtimes_CXX=yes
- # Don't use ranlib
- old_postinstall_cmds_CXX='chmod 644 $oldlib'
- postlink_cmds_CXX='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~
- func_to_tool_file "$lt_outputfile"~
- 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'
+ case $cc_basename in
+ CC*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ aCC*)
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
;;
*)
- # g++
- # _LT_TAGVAR(hardcode_libdir_flag_spec, CXX) is actually meaningless,
- # as there is no search path for DLLs.
- hardcode_libdir_flag_spec_CXX='-L$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-all-symbols'
- allow_undefined_flag_CXX=unsupported
- always_export_symbols_CXX=no
- enable_shared_with_static_runtimes_CXX=yes
-
- if $LD --help 2>&1 | $GREP 'auto-import' > /dev/null; then
- archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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_CXX='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 -nostdlib $output_objdir/$soname.def $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $output_objdir/$soname ${wl}--enable-auto-image-base -Xlinker --out-implib -Xlinker $lib'
+ archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | grep "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test $with_gnu_ld = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ ;;
+ esac
+ fi
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ esac
+ ;;
+ interix[3-9]*)
+ hardcode_direct_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${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_CXX='$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_CXX='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'
+ ;;
+ irix5* | irix6*)
+ case $cc_basename in
+ CC*)
+ # SGI C++
+ archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+
+ # Archives containing C++ object files must be created using
+ # "CC -ar", where "CC" is the IRIX C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
+ ;;
+ *)
+ if test "$GXX" = yes; then
+ if test "$with_gnu_ld" = no; then
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
else
- ld_shlibs_CXX=no
+ archive_cmds_CXX='$CC -shared -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` -o $lib'
fi
+ fi
+ link_all_deplibs_CXX=yes
+ ;;
+ esac
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
+ ;;
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
+
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
+ archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | grep "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
+ ;;
+ icpc*)
+ # Intel C++
+ with_gnu_ld=yes
+ # version 8.0 and above of icpc choke on multiply defined symbols
+ # if we add $predep_objects and $postdep_objects, however 7.1 and
+ # earlier do not add the objects themselves.
+ case `$CC -V 2>&1` in
+ *"Version 7."*)
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ ;;
+ *) # Version 8.0 or newer
+ tmp_idyn=
+ case $host_cpu in
+ ia64*) tmp_idyn=' -i_dynamic';;
+ esac
+ archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
;;
esac
+ archive_cmds_need_lc_CXX=no
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
;;
- darwin* | rhapsody*)
-
-
- archive_cmds_need_lc_CXX=no
- hardcode_direct_CXX=no
- hardcode_automatic_CXX=yes
- hardcode_shlibpath_var_CXX=unsupported
- if test "$lt_cv_ld_force_load" = "yes"; then
- whole_archive_flag_spec_CXX='`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience ${wl}-force_load,$conv\"; done; func_echo_all \"$new_convenience\"`'
-
- else
- whole_archive_flag_spec_CXX=''
- fi
- link_all_deplibs_CXX=yes
- allow_undefined_flag_CXX="$_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_CXX="\$CC -dynamiclib \$allow_undefined_flag -o \$lib \$libobjs \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring $_lt_dar_single_mod${_lt_dsymutil}"
- module_cmds_CXX="\$CC \$allow_undefined_flag -o \$lib -bundle \$libobjs \$deplibs \$compiler_flags${_lt_dsymutil}"
- archive_expsym_cmds_CXX="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_CXX="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}"
- if test "$lt_cv_apple_cc_single_mod" != "yes"; then
- archive_cmds_CXX="\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dsymutil}"
- archive_expsym_cmds_CXX="sed 's,^,_,' < \$export_symbols > \$output_objdir/\${libname}-symbols.expsym~\$CC -r -keep_private_externs -nostdlib -o \${lib}-master.o \$libobjs~\$CC -dynamiclib \$allow_undefined_flag -o \$lib \${lib}-master.o \$deplibs \$compiler_flags -install_name \$rpath/\$soname \$verstring${_lt_dar_export_syms}${_lt_dsymutil}"
- fi
+ pgCC*)
+ # Portland Group C++ compiler
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
+
+ hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ ;;
+ cxx*)
+ # Compaq C++
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
- else
- ld_shlibs_CXX=no
- fi
+ runpath_var=LD_RUN_PATH
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C++ 5.9
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ whole_archive_flag_spec_CXX='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+
+ # Not sure whether something based on
+ # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
+ # would be better.
+ output_verbose_link_cmd='echo'
+
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+ lynxos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ m88k*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ mvs*)
+ case $cc_basename in
+ cxx*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
+ wlarc=
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ fi
+ # Workaround some broken pre-1.5 toolchains
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
+ ;;
+ openbsd2*)
+ # C++ shared libraries are fairly broken
+ ld_shlibs_CXX=no
+ ;;
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_CXX=yes
+ hardcode_shlibpath_var_CXX=no
+ archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
+ export_dynamic_flag_spec_CXX='${wl}-E'
+ whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ fi
+ output_verbose_link_cmd='echo'
+ else
+ ld_shlibs_CXX=no
+ fi
+ ;;
+ osf3*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
- dgux*)
- case $cc_basename in
- ec++*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- ghcx*)
- # Green Hills C++ Compiler
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- esac
- ;;
-
- freebsd2.*)
- # C++ shared libraries reported to be fairly broken before
- # switch to ELF
- ld_shlibs_CXX=no
- ;;
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
- freebsd-elf*)
- archive_cmds_need_lc_CXX=no
- ;;
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
- freebsd* | dragonfly*)
- # FreeBSD 3 and later use GNU C++ and GNU ld with standard ELF
- # conventions
- ld_shlibs_CXX=yes
- ;;
+ # Archives containing C++ object files must be created using
+ # "CC -Bstatic", where "CC" is the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
- gnu*)
- ;;
+ ;;
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ cxx*)
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && echo ${wl}-set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
- haiku*)
- archive_cmds_CXX='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- link_all_deplibs_CXX=yes
- ;;
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
- hpux9*)
- hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
- hardcode_libdir_separator_CXX=:
- export_dynamic_flag_spec_CXX='${wl}-E'
- hardcode_direct_CXX=yes
- hardcode_minus_L_CXX=yes # Not in the search PATH,
- # but as the default
- # location of the library.
-
- case $cc_basename in
- CC*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- aCC*)
- archive_cmds_CXX='$RM $output_objdir/$soname~$CC -b ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $EGREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
- ;;
- *)
- if test "$GXX" = yes; then
- archive_cmds_CXX='$RM $output_objdir/$soname~$CC -shared -nostdlib $pic_flag ${wl}+b ${wl}$install_libdir -o $output_objdir/$soname $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~test $output_objdir/$soname = $lib || mv $output_objdir/$soname $lib'
- else
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- fi
- ;;
- esac
- ;;
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
+ ;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- hpux10*|hpux11*)
- if test $with_gnu_ld = no; then
- hardcode_libdir_flag_spec_CXX='${wl}+b ${wl}$libdir'
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
hardcode_libdir_separator_CXX=:
- case $host_cpu in
- hppa*64*|ia64*)
- ;;
- *)
- export_dynamic_flag_spec_CXX='${wl}-E'
- ;;
- esac
- fi
- case $host_cpu in
- hppa*64*|ia64*)
- hardcode_direct_CXX=no
- hardcode_shlibpath_var_CXX=no
- ;;
- *)
- hardcode_direct_CXX=yes
- hardcode_direct_absolute_CXX=yes
- hardcode_minus_L_CXX=yes # Not in the search PATH,
- # but as the default
- # location of the library.
- ;;
- esac
-
- case $cc_basename in
- CC*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- aCC*)
- case $host_cpu in
- hppa*64*)
- archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- archive_cmds_CXX='$CC -b ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- esac
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`($CC -b $CFLAGS -v conftest.$objext 2>&1) | $GREP "\-L"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
- ;;
- *)
- if test "$GXX" = yes; then
- if test $with_gnu_ld = no; then
- case $host_cpu in
- hppa*64*)
- archive_cmds_CXX='$CC -shared -nostdlib -fPIC ${wl}+h ${wl}$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- ia64*)
- archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- *)
- archive_cmds_CXX='$CC -shared -nostdlib $pic_flag ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- ;;
- esac
- fi
- else
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- fi
- ;;
- esac
- ;;
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
- interix[3-9]*)
- hardcode_direct_CXX=no
- hardcode_shlibpath_var_CXX=no
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_CXX='${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_CXX='$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_CXX='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'
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ fi
;;
- irix5* | irix6*)
- case $cc_basename in
- CC*)
- # SGI C++
- archive_cmds_CXX='$CC -shared -all -multigot $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -soname $soname `test -n "$verstring" && func_echo_all "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
-
- # Archives containing C++ object files must be created using
- # "CC -ar", where "CC" is the IRIX C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- old_archive_cmds_CXX='$CC -ar -WR,-u -o $oldlib $oldobjs'
- ;;
- *)
- if test "$GXX" = yes; then
- if test "$with_gnu_ld" = no; then
- archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $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
- archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && func_echo_all "${wl}-set_version ${wl}$verstring"` -o $lib'
- fi
- fi
- link_all_deplibs_CXX=yes
- ;;
- esac
- hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator_CXX=:
- inherit_rpath_CXX=yes
- ;;
-
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
- case $cc_basename in
- KCC*)
- # Kuck and Associates, Inc. (KAI) C++ Compiler
-
- # KCC will only create a shared library if the output file
- # ends with ".so" (or ".sl" for HP-UX), so rename the library
- # to its proper name (with version) after linking.
- archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
- archive_expsym_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib ${wl}-retain-symbols-file,$export_symbols; mv \$templib $lib'
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1 | $GREP "ld"`; rm -f libconftest$shared_ext; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
-
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
-
- # Archives containing C++ object files must be created using
- # "CC -Bstatic", where "CC" is the KAI C++ compiler.
- old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs'
- ;;
- icpc* | ecpc* )
- # Intel C++
- with_gnu_ld=yes
- # version 8.0 and above of icpc choke on multiply defined symbols
- # if we add $predep_objects and $postdep_objects, however 7.1 and
- # earlier do not add the objects themselves.
- case `$CC -V 2>&1` in
- *"Version 7."*)
- archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- *) # Version 8.0 or newer
- tmp_idyn=
- case $host_cpu in
- ia64*) tmp_idyn=' -i_dynamic';;
- esac
- archive_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds_CXX='$CC -shared'"$tmp_idyn"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
- ;;
- esac
- archive_cmds_need_lc_CXX=no
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
- whole_archive_flag_spec_CXX='${wl}--whole-archive$convenience ${wl}--no-whole-archive'
- ;;
- pgCC* | pgcpp*)
- # Portland Group C++ compiler
- case `$CC -V` in
- *pgCC\ [1-5].* | *pgcpp\ [1-5].*)
- prelink_cmds_CXX='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $objs $libobjs $compile_deplibs~
- compile_command="$compile_command `find $tpldir -name \*.o | sort | $NL2SP`"'
- old_archive_cmds_CXX='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $oldobjs$old_deplibs~
- $AR $AR_FLAGS $oldlib$oldobjs$old_deplibs `find $tpldir -name \*.o | sort | $NL2SP`~
- $RANLIB $oldlib'
- archive_cmds_CXX='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
- archive_expsym_cmds_CXX='tpldir=Template.dir~
- rm -rf $tpldir~
- $CC --prelink_objects --instantiation_dir $tpldir $predep_objects $libobjs $deplibs $convenience $postdep_objects~
- $CC -shared $pic_flag $predep_objects $libobjs $deplibs `find $tpldir -name \*.o | sort | $NL2SP` $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
- ;;
- *) # Version 6 and above use weak symbols
- archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname -o $lib'
- archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname ${wl}$soname ${wl}-retain-symbols-file ${wl}$export_symbols -o $lib'
- ;;
- esac
+ esac
+ ;;
+ osf4* | osf5*)
+ case $cc_basename in
+ KCC*)
+ # Kuck and Associates, Inc. (KAI) C++ Compiler
- hardcode_libdir_flag_spec_CXX='${wl}--rpath ${wl}$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
- whole_archive_flag_spec_CXX='${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'
- ;;
- cxx*)
- # Compaq C++
- archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib'
- archive_expsym_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $wl$soname -o $lib ${wl}-retain-symbols-file $wl$export_symbols'
+ # KCC will only create a shared library if the output file
+ # ends with ".so" (or ".sl" for HP-UX), so rename the library
+ # to its proper name (with version) after linking.
+ archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo $lib | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
- runpath_var=LD_RUN_PATH
- hardcode_libdir_flag_spec_CXX='-rpath $libdir'
- hardcode_libdir_separator_CXX=:
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
+ hardcode_libdir_separator_CXX=:
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld .*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "X$list" | $Xsed'
- ;;
- xl* | mpixl* | bgxl*)
- # IBM XL 8.0 on PPC, with GNU ld
- hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
- export_dynamic_flag_spec_CXX='${wl}--export-dynamic'
- archive_cmds_CXX='$CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
- if test "x$supports_anon_versioning" = xyes; then
- archive_expsym_cmds_CXX='echo "{ global:" > $output_objdir/$libname.ver~
- cat $export_symbols | sed -e "s/\(.*\)/\1;/" >> $output_objdir/$libname.ver~
- echo "local: *; };" >> $output_objdir/$libname.ver~
- $CC -qmkshrobj $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-version-script ${wl}$output_objdir/$libname.ver -o $lib'
- fi
- ;;
- *)
- case `$CC -V 2>&1 | sed 5q` in
- *Sun\ C*)
- # Sun C++ 5.9
- no_undefined_flag_CXX=' -zdefs'
- archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- archive_expsym_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file ${wl}$export_symbols'
- hardcode_libdir_flag_spec_CXX='-R$libdir'
- whole_archive_flag_spec_CXX='${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_CXX=yes
-
- # Not sure whether something based on
- # $CC $CFLAGS -v conftest.$objext -o libconftest$shared_ext 2>&1
- # would be better.
- output_verbose_link_cmd='func_echo_all'
-
- # Archives containing C++ object files must be created using
- # "CC -xar", where "CC" is the Sun C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
- ;;
- esac
- ;;
- esac
+ # Archives containing C++ object files must be created using
+ # the KAI C++ compiler.
+ old_archive_cmds_CXX='$CC -o $oldlib $oldobjs'
;;
-
- lynxos*)
- # FIXME: insert proper C++ library support
+ RCC*)
+ # Rational C++ 2.4.1
+ # FIXME: insert proper C++ library support
ld_shlibs_CXX=no
;;
-
- m88k*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
+ cxx*)
+ allow_undefined_flag_CXX=' -expect_unresolved \*'
+ archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
+ echo "-hidden">> $lib.exp~
+ $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname -Wl,-input -Wl,$lib.exp `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib~
+ $rm $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-rpath $libdir'
+ hardcode_libdir_separator_CXX=:
+
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ #
+ # There doesn't appear to be a way to prevent this compiler from
+ # explicitly linking system object files so we need to strip them
+ # from the output so that they don't get included in the library
+ # dependencies.
+ output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "ld" | grep -v "ld:"`; templist=`echo $templist | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; echo $list'
;;
+ *)
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
- mvs*)
- case $cc_basename in
- cxx*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- esac
- ;;
+ hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_CXX=:
- netbsd*)
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
- archive_cmds_CXX='$LD -Bshareable -o $lib $predep_objects $libobjs $deplibs $postdep_objects $linker_flags'
- wlarc=
- hardcode_libdir_flag_spec_CXX='-R$libdir'
- hardcode_direct_CXX=yes
- hardcode_shlibpath_var_CXX=no
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep "\-L"'
+
+ else
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
fi
- # Workaround some broken pre-1.5 toolchains
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP conftest.$objext | $SED -e "s:-lgcc -lc -lgcc::"'
;;
-
- *nto* | *qnx*)
- ld_shlibs_CXX=yes
+ esac
+ ;;
+ psos*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ sunos4*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.x
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
;;
-
- openbsd2*)
- # C++ shared libraries are fairly broken
+ lcc*)
+ # Lucid
+ # FIXME: insert proper C++ library support
ld_shlibs_CXX=no
;;
-
- openbsd*)
- if test -f /usr/libexec/ld.so; then
- hardcode_direct_CXX=yes
- hardcode_shlibpath_var_CXX=no
- hardcode_direct_absolute_CXX=yes
- archive_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -o $lib'
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
- archive_expsym_cmds_CXX='$CC -shared $pic_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-retain-symbols-file,$export_symbols -o $lib'
- export_dynamic_flag_spec_CXX='${wl}-E'
- whole_archive_flag_spec_CXX="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
- fi
- output_verbose_link_cmd=func_echo_all
- else
- ld_shlibs_CXX=no
- fi
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
;;
-
- osf3* | osf4* | osf5*)
- case $cc_basename in
- KCC*)
- # Kuck and Associates, Inc. (KAI) C++ Compiler
-
- # KCC will only create a shared library if the output file
- # ends with ".so" (or ".sl" for HP-UX), so rename the library
- # to its proper name (with version) after linking.
- archive_cmds_CXX='tempext=`echo $shared_ext | $SED -e '\''s/\([^()0-9A-Za-z{}]\)/\\\\\1/g'\''`; templib=`echo "$lib" | $SED -e "s/\${tempext}\..*/.so/"`; $CC $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags --soname $soname -o \$templib; mv \$templib $lib'
-
- hardcode_libdir_flag_spec_CXX='${wl}-rpath,$libdir'
- hardcode_libdir_separator_CXX=:
-
- # Archives containing C++ object files must be created using
- # the KAI C++ compiler.
- case $host in
- osf3*) old_archive_cmds_CXX='$CC -Bstatic -o $oldlib $oldobjs' ;;
- *) old_archive_cmds_CXX='$CC -o $oldlib $oldobjs' ;;
- esac
- ;;
- RCC*)
- # Rational C++ 2.4.1
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- cxx*)
- case $host in
- osf3*)
- allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
- archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-soname $soname `test -n "$verstring" && func_echo_all "${wl}-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib'
- hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
- ;;
- *)
- allow_undefined_flag_CXX=' -expect_unresolved \*'
- archive_cmds_CXX='$CC -shared${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $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_CXX='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done~
- echo "-hidden">> $lib.exp~
- $CC -shared$allow_undefined_flag $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags -msym -soname $soname ${wl}-input ${wl}$lib.exp `test -n "$verstring" && $ECHO "-set_version $verstring"` -update_registry ${output_objdir}/so_locations -o $lib~
- $RM $lib.exp'
- hardcode_libdir_flag_spec_CXX='-rpath $libdir'
- ;;
- esac
-
- hardcode_libdir_separator_CXX=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- #
- # There doesn't appear to be a way to prevent this compiler from
- # explicitly linking system object files so we need to strip them
- # from the output so that they don't get included in the library
- # dependencies.
- output_verbose_link_cmd='templist=`$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP "ld" | $GREP -v "ld:"`; templist=`func_echo_all "$templist" | $SED "s/\(^.*ld.*\)\( .*ld.*$\)/\1/"`; list=""; for z in $templist; do case $z in conftest.$objext) list="$list $z";; *.$objext);; *) list="$list $z";;esac; done; func_echo_all "$list"'
- ;;
+ esac
+ ;;
+ solaris*)
+ case $cc_basename in
+ CC*)
+ # Sun C++ 4.2, 5.x and Centerline C++
+ archive_cmds_need_lc_CXX=yes
+ no_undefined_flag_CXX=' -zdefs'
+ archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
+
+ hardcode_libdir_flag_spec_CXX='-R$libdir'
+ hardcode_shlibpath_var_CXX=no
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
*)
- if test "$GXX" = yes && test "$with_gnu_ld" = no; then
- allow_undefined_flag_CXX=' ${wl}-expect_unresolved ${wl}\*'
- case $host in
- osf3*)
- archive_cmds_CXX='$CC -shared -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $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'
- ;;
- *)
- archive_cmds_CXX='$CC -shared $pic_flag -nostdlib ${allow_undefined_flag} $predep_objects $libobjs $deplibs $postdep_objects $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'
- ;;
- esac
-
- hardcode_libdir_flag_spec_CXX='${wl}-rpath ${wl}$libdir'
- hardcode_libdir_separator_CXX=:
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
-
- else
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- fi
+ # The compiler driver will combine and reorder linker options,
+ # but understands `-z linker_flag'.
+ # Supported since Solaris 2.6 (maybe 2.5.1?)
+ whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
;;
- esac
- ;;
-
- psos*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
-
- sunos4*)
- case $cc_basename in
- CC*)
- # Sun C++ 4.x
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- lcc*)
- # Lucid
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- esac
- ;;
-
- solaris*)
- case $cc_basename in
- CC* | sunCC*)
- # Sun C++ 4.2, 5.x and Centerline C++
- archive_cmds_need_lc_CXX=yes
- no_undefined_flag_CXX=' -zdefs'
- archive_cmds_CXX='$CC -G${allow_undefined_flag} -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags'
- archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -G${allow_undefined_flag} ${wl}-M ${wl}$lib.exp -h$soname -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
- hardcode_libdir_flag_spec_CXX='-R$libdir'
- hardcode_shlibpath_var_CXX=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'.
- # Supported since Solaris 2.6 (maybe 2.5.1?)
- whole_archive_flag_spec_CXX='-z allextract$convenience -z defaultextract'
- ;;
- esac
- link_all_deplibs_CXX=yes
+ esac
+ link_all_deplibs_CXX=yes
- output_verbose_link_cmd='func_echo_all'
+ output_verbose_link_cmd='echo'
- # Archives containing C++ object files must be created using
- # "CC -xar", where "CC" is the Sun C++ compiler. This is
- # necessary to make sure instantiated templates are included
- # in the archive.
- old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
- ;;
- gcx*)
- # Green Hills C++ Compiler
- archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
-
- # The C++ compiler must be used to create the archive.
- old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
- ;;
- *)
- # GNU C++ compiler with Solaris linker
- if test "$GXX" = yes && test "$with_gnu_ld" = no; then
- no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
- if $CC --version | $GREP -v '^2\.7' > /dev/null; then
- archive_cmds_CXX='$CC -shared $pic_flag -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
- archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -shared $pic_flag -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -shared $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
- else
- # g++ 2.7 appears to require `-G' NOT `-shared' on this
- # platform.
- archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
- archive_expsym_cmds_CXX='echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~echo "local: *; };" >> $lib.exp~
- $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$RM $lib.exp'
-
- # Commands to make compiler produce verbose output that lists
- # what "hidden" libraries, object files and flags are used when
- # linking a shared library.
- output_verbose_link_cmd='$CC -G $CFLAGS -v conftest.$objext 2>&1 | $GREP -v "^Configured with:" | $GREP "\-L"'
- fi
-
- hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
- case $host_os in
- solaris2.[0-5] | solaris2.[0-5].*) ;;
- *)
- whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
- ;;
- esac
- fi
- ;;
- esac
- ;;
+ # Archives containing C++ object files must be created using
+ # "CC -xar", where "CC" is the Sun C++ compiler. This is
+ # necessary to make sure instantiated templates are included
+ # in the archive.
+ old_archive_cmds_CXX='$CC -xar -o $oldlib $oldobjs'
+ ;;
+ gcx*)
+ # Green Hills C++ Compiler
+ archive_cmds_CXX='$CC -shared $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
- sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
- no_undefined_flag_CXX='${wl}-z,text'
- archive_cmds_need_lc_CXX=no
- hardcode_shlibpath_var_CXX=no
- runpath_var='LD_RUN_PATH'
+ # The C++ compiler must be used to create the archive.
+ old_archive_cmds_CXX='$CC $LDFLAGS -archive -o $oldlib $oldobjs'
+ ;;
+ *)
+ # GNU C++ compiler with Solaris linker
+ if test "$GXX" = yes && test "$with_gnu_ld" = no; then
+ no_undefined_flag_CXX=' ${wl}-z ${wl}defs'
+ if $CC --version | grep -v '^2\.7' > /dev/null; then
+ archive_cmds_CXX='$CC -shared -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
- case $cc_basename in
- CC*)
- archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- *)
- archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- ;;
- esac
- ;;
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -shared $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ else
+ # g++ 2.7 appears to require `-G' NOT `-shared' on this
+ # platform.
+ archive_cmds_CXX='$CC -G -nostdlib $LDFLAGS $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags ${wl}-h $wl$soname -o $lib'
+ archive_expsym_cmds_CXX='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -G -nostdlib ${wl}-M $wl$lib.exp -o $lib $predep_objects $libobjs $deplibs $postdep_objects $compiler_flags~$rm $lib.exp'
- 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_CXX='${wl}-z,text'
- allow_undefined_flag_CXX='${wl}-z,nodefs'
- archive_cmds_need_lc_CXX=no
- hardcode_shlibpath_var_CXX=no
- hardcode_libdir_flag_spec_CXX='${wl}-R,$libdir'
- hardcode_libdir_separator_CXX=':'
- link_all_deplibs_CXX=yes
- export_dynamic_flag_spec_CXX='${wl}-Bexport'
- runpath_var='LD_RUN_PATH'
+ # Commands to make compiler produce verbose output that lists
+ # what "hidden" libraries, object files and flags are used when
+ # linking a shared library.
+ output_verbose_link_cmd="$CC -G $CFLAGS -v conftest.$objext 2>&1 | grep \"\-L\""
+ fi
- case $cc_basename in
- CC*)
- archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- old_archive_cmds_CXX='$CC -Tprelink_objects $oldobjs~
- '"$old_archive_cmds_CXX"
- reload_cmds_CXX='$CC -Tprelink_objects $reload_objs~
- '"$reload_cmds_CXX"
- ;;
+ hardcode_libdir_flag_spec_CXX='${wl}-R $wl$libdir'
+ case $host_os in
+ solaris2.[0-5] | solaris2.[0-5].*) ;;
*)
- archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
- archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ whole_archive_flag_spec_CXX='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
;;
- esac
- ;;
-
- tandem*)
- case $cc_basename in
- NCC*)
- # NonStop-UX NCC 3.20
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- *)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
- esac
- ;;
-
- vxworks*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
+ esac
+ fi
+ ;;
+ esac
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_CXX='${wl}-z,text'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ runpath_var='LD_RUN_PATH'
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
*)
- # FIXME: insert proper C++ library support
- ld_shlibs_CXX=no
- ;;
+ archive_cmds_CXX='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
esac
+ ;;
+ 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.
+ # 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.
+ # So that behaviour is only enabled if SCOABSPATH is set to a
+ # non-empty value in the environment. Most likely only useful for
+ # creating official distributions of packages.
+ # This is a hack until libtool officially supports absolute path
+ # names for shared libraries.
+ no_undefined_flag_CXX='${wl}-z,text'
+ allow_undefined_flag_CXX='${wl}-z,nodefs'
+ archive_cmds_need_lc_CXX=no
+ hardcode_shlibpath_var_CXX=no
+ hardcode_libdir_flag_spec_CXX='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_CXX=':'
+ link_all_deplibs_CXX=yes
+ export_dynamic_flag_spec_CXX='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
-$as_echo "$ld_shlibs_CXX" >&6; }
- test "$ld_shlibs_CXX" = no && can_build_shared=no
+ case $cc_basename in
+ CC*)
+ archive_cmds_CXX='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_CXX='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_CXX='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ esac
+ ;;
+ tandem*)
+ case $cc_basename in
+ NCC*)
+ # NonStop-UX NCC 3.20
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ esac
+ ;;
+ vxworks*)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+ *)
+ # FIXME: insert proper C++ library support
+ ld_shlibs_CXX=no
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
- GCC_CXX="$GXX"
- LD_CXX="$LD"
+GCC_CXX="$GXX"
+LD_CXX="$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...
- # Dependencies to place before and after the object being linked:
-predep_objects_CXX=
-postdep_objects_CXX=
-predeps_CXX=
-postdeps_CXX=
-compiler_lib_search_path_CXX=
-cat > conftest.$ac_ext <<_LT_EOF
+cat > conftest.$ac_ext <<EOF
class Foo
{
public:
@@ -20417,21 +18066,13 @@ public:
private:
int a;
};
-_LT_EOF
-
-
-_lt_libdeps_save_CFLAGS=$CFLAGS
-case "$CC $CFLAGS " in #(
-*\ -flto*\ *) CFLAGS="$CFLAGS -fno-lto" ;;
-*\ -fwhopr*\ *) CFLAGS="$CFLAGS -fno-whopr" ;;
-*\ -fuse-linker-plugin*\ *) CFLAGS="$CFLAGS -fno-use-linker-plugin" ;;
-esac
+EOF
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+if { (eval echo "$as_me:$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; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
# Parse the compiler output and extract the necessary
# objects, libraries and library flags.
@@ -20439,32 +18080,28 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
# the conftest object file.
pre_test_object_deps_done=no
- for p in `eval "$output_verbose_link_cmd"`; do
- case ${prev}${p} in
+ # The `*' in the case matches for architectures that use `case' in
+ # $output_verbose_cmd can trigger glob expansion during the loop
+ # eval without this substitution.
+ output_verbose_link_cmd=`$echo "X$output_verbose_link_cmd" | $Xsed -e "$no_glob_subst"`
+
+ for p in `eval $output_verbose_link_cmd`; do
+ case $p in
-L* | -R* | -l*)
# Some compilers place space between "-{L,R}" and the path.
# Remove the space.
- if test $p = "-L" ||
- test $p = "-R"; then
+ if test $p = "-L" \
+ || test $p = "-R"; then
prev=$p
continue
+ else
+ prev=
fi
- # Expand the sysroot to ease extracting the directories later.
- if test -z "$prev"; then
- case $p in
- -L*) func_stripname_cnf '-L' '' "$p"; prev=-L; p=$func_stripname_result ;;
- -R*) func_stripname_cnf '-R' '' "$p"; prev=-R; p=$func_stripname_result ;;
- -l*) func_stripname_cnf '-l' '' "$p"; prev=-l; p=$func_stripname_result ;;
- esac
- fi
- case $p in
- =*) func_stripname_cnf '=' '' "$p"; p=$lt_sysroot$func_stripname_result ;;
- esac
if test "$pre_test_object_deps_done" = no; then
- case ${prev} in
- -L | -R)
+ case $p in
+ -L* | -R*)
# Internal compiler library paths should come after those
# provided the user. The postdeps already come after the
# user supplied libs so there is no need to process them.
@@ -20484,10 +18121,8 @@ if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
postdeps_CXX="${postdeps_CXX} ${prev}${p}"
fi
fi
- prev=
;;
- *.lto.$objext) ;; # Ignore GCC LTO objects
*.$objext)
# This assumes that the test object file only shows up
# once in the compiler output.
@@ -20522,8 +18157,7 @@ else
echo "libtool.m4: error: problem compiling CXX test program"
fi
-$RM -f confest.$objext
-CFLAGS=$_lt_libdeps_save_CFLAGS
+$rm -f confest.$objext
# PORTME: override above test on systems where it is broken
case $host_os in
@@ -20539,7 +18173,7 @@ linux*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
# Sun C++ 5.9
-
+ #
# The more standards-conforming stlport4 library is
# incompatible with the Cstd library. Avoid specifying
# it if it's in CXXFLAGS. Ignore libCrun as
@@ -20549,7 +18183,6 @@ linux*)
solaris_use_stlport4=yes
;;
esac
-
if test "$solaris_use_stlport4" != yes; then
postdeps_CXX='-library=Cstd -library=Crun'
fi
@@ -20559,7 +18192,7 @@ linux*)
solaris*)
case $cc_basename in
- CC* | sunCC*)
+ CC*)
# The more standards-conforming stlport4 library is
# incompatible with the Cstd library. Avoid specifying
# it if it's in CXXFLAGS. Ignore libCrun as
@@ -20585,45 +18218,13 @@ esac
case " $postdeps_CXX " in
*" -lc "*) archive_cmds_need_lc_CXX=no ;;
esac
- compiler_lib_search_dirs_CXX=
-if test -n "${compiler_lib_search_path_CXX}"; then
- compiler_lib_search_dirs_CXX=`echo " ${compiler_lib_search_path_CXX}" | ${SED} -e 's! -L! !g' -e 's!^ !!'`
-fi
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
- lt_prog_compiler_wl_CXX=
+lt_prog_compiler_wl_CXX=
lt_prog_compiler_pic_CXX=
lt_prog_compiler_static_CXX=
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
# C++ specific cases for pic, static, wl, etc.
if test "$GXX" = yes; then
@@ -20638,26 +18239,16 @@ lt_prog_compiler_static_CXX=
lt_prog_compiler_static_CXX='-Bstatic'
fi
;;
-
amigaos*)
- case $host_cpu in
- powerpc)
- # see comment about AmigaOS4 .so support
- lt_prog_compiler_pic_CXX='-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_CXX='-m68020 -resident32 -malways-restore-a4'
- ;;
- esac
+ # 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_CXX='-m68020 -resident32 -malways-restore-a4'
;;
-
beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
# PIC is the default for these OSes.
;;
- mingw* | cygwin* | os2* | pw32* | cegcc*)
+ mingw* | cygwin* | os2* | pw32*)
# 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
@@ -20673,11 +18264,6 @@ lt_prog_compiler_static_CXX=
# DJGPP does not support shared libraries at all
lt_prog_compiler_pic_CXX=
;;
- haiku*)
- # PIC is the default for Haiku.
- # The "-static" flag exists, but is broken.
- lt_prog_compiler_static_CXX=
- ;;
interix[3-9]*)
# Interix 3.x gcc -fpic/-fPIC options generate broken code.
# Instead, we relocate shared libraries at runtime.
@@ -20688,29 +18274,23 @@ lt_prog_compiler_static_CXX=
fi
;;
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.
+ # 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*)
+ hppa*64*|ia64*)
;;
*)
lt_prog_compiler_pic_CXX='-fPIC'
;;
esac
;;
- *qnx* | *nto*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- lt_prog_compiler_pic_CXX='-fPIC -shared'
- ;;
*)
lt_prog_compiler_pic_CXX='-fPIC'
;;
esac
else
case $host_os in
- aix[4-9]*)
+ aix4* | aix5*)
# All AIX code is PIC.
if test "$host_cpu" = ia64; then
# AIX 5 now supports IA64 processor
@@ -20723,15 +18303,20 @@ lt_prog_compiler_static_CXX=
case $cc_basename in
cxch68*)
# Green Hills C++ Compiler
- # _LT_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
+ # _LT_AC_TAGVAR(lt_prog_compiler_static, CXX)="--no_auto_instantiation -u __main -u __premain -u _abort -r $COOL_DIR/lib/libOrb.a $MVME_DIR/lib/CC/libC.a $MVME_DIR/lib/classix/libcx.s.a"
;;
esac
;;
- mingw* | cygwin* | os2* | pw32* | 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_CXX='-DDLL_EXPORT'
- ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_CXX='-qnocommon'
+ lt_prog_compiler_wl_CXX='-Wl,'
+ ;;
+ esac
+ ;;
dgux*)
case $cc_basename in
ec++*)
@@ -20788,28 +18373,21 @@ lt_prog_compiler_static_CXX=
;;
esac
;;
- linux* | k*bsd*-gnu | kopensolaris*-gnu)
+ linux* | k*bsd*-gnu)
case $cc_basename in
KCC*)
# KAI C++ Compiler
lt_prog_compiler_wl_CXX='--backend -Wl,'
lt_prog_compiler_pic_CXX='-fPIC'
;;
- ecpc* )
- # old Intel C++ for x86_64 which still supported -KPIC.
+ icpc* | ecpc*)
+ # Intel C++
lt_prog_compiler_wl_CXX='-Wl,'
lt_prog_compiler_pic_CXX='-KPIC'
lt_prog_compiler_static_CXX='-static'
;;
- icpc* )
- # Intel C++, used to be incompatible with GCC.
- # ICC 10 doesn't accept -KPIC any more.
- lt_prog_compiler_wl_CXX='-Wl,'
- lt_prog_compiler_pic_CXX='-fPIC'
- lt_prog_compiler_static_CXX='-static'
- ;;
- pgCC* | pgcpp*)
- # Portland Group C++ compiler
+ pgCC*)
+ # Portland Group C++ compiler.
lt_prog_compiler_wl_CXX='-Wl,'
lt_prog_compiler_pic_CXX='-fpic'
lt_prog_compiler_static_CXX='-Bstatic'
@@ -20821,12 +18399,6 @@ lt_prog_compiler_static_CXX=
lt_prog_compiler_pic_CXX=
lt_prog_compiler_static_CXX='-non_shared'
;;
- xlc* | xlC* | bgxl[cC]* | mpixl[cC]*)
- # IBM XL 8.0, 9.0 on PPC and BlueGene
- lt_prog_compiler_wl_CXX='-Wl,'
- lt_prog_compiler_pic_CXX='-qpic'
- lt_prog_compiler_static_CXX='-qstaticlink'
- ;;
*)
case `$CC -V 2>&1 | sed 5q` in
*Sun\ C*)
@@ -20854,11 +18426,6 @@ lt_prog_compiler_static_CXX=
;;
netbsd*)
;;
- *qnx* | *nto*)
- # QNX uses GNU C++, but need to define -shared option too, otherwise
- # it will coredump.
- lt_prog_compiler_pic_CXX='-fPIC -shared'
- ;;
osf3* | osf4* | osf5*)
case $cc_basename in
KCC*)
@@ -20884,7 +18451,7 @@ lt_prog_compiler_static_CXX=
;;
solaris*)
case $cc_basename in
- CC* | sunCC*)
+ CC*)
# Sun C++ 4.2, 5.x and Centerline C++
lt_prog_compiler_pic_CXX='-KPIC'
lt_prog_compiler_static_CXX='-Bstatic'
@@ -20913,15 +18480,6 @@ lt_prog_compiler_static_CXX=
;;
esac
;;
- sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
- case $cc_basename in
- CC*)
- lt_prog_compiler_wl_CXX='-Wl,'
- lt_prog_compiler_pic_CXX='-KPIC'
- lt_prog_compiler_static_CXX='-Bstatic'
- ;;
- esac
- ;;
tandem*)
case $cc_basename in
NCC*)
@@ -20932,6 +18490,15 @@ lt_prog_compiler_static_CXX=
;;
esac
;;
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ case $cc_basename in
+ CC*)
+ lt_prog_compiler_wl_CXX='-Wl,'
+ lt_prog_compiler_pic_CXX='-KPIC'
+ lt_prog_compiler_static_CXX='-Bstatic'
+ ;;
+ esac
+ ;;
vxworks*)
;;
*)
@@ -20940,38 +18507,21 @@ lt_prog_compiler_static_CXX=
esac
fi
-case $host_os in
- # For platforms which do not support PIC, -DPIC is meaningless:
- *djgpp*)
- lt_prog_compiler_pic_CXX=
- ;;
- *)
- lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
- ;;
-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_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- lt_cv_prog_compiler_pic_CXX=$lt_prog_compiler_pic_CXX
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_pic_CXX" >&6; }
-lt_prog_compiler_pic_CXX=$lt_cv_prog_compiler_pic_CXX
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_CXX" >&6; }
#
# Check to make sure the PIC flag actually works.
#
if test -n "$lt_prog_compiler_pic_CXX"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
-$as_echo_n "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... " >&6; }
-if ${lt_cv_prog_compiler_pic_works_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_CXX works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- lt_cv_prog_compiler_pic_works_CXX=no
- ac_outfile=conftest.$ac_objext
+ lt_prog_compiler_pic_works_CXX=no
+ ac_outfile=conftest.$ac_objext
echo "$lt_simple_compile_test_code" > conftest.$ac_ext
lt_compiler_flag="$lt_prog_compiler_pic_CXX -DPIC"
# Insert the option either (1) after the last *FLAGS variable, or
@@ -20983,27 +18533,27 @@ else
-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 echo "\"\$as_me:18536: $lt_compile\"" >&5)
(eval "$lt_compile" 2>conftest.err)
ac_status=$?
cat conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ echo "$as_me:18540: \$? = $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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_CXX=yes
+ lt_prog_compiler_pic_works_CXX=yes
fi
fi
- $RM conftest*
+ $rm conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_pic_works_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_pic_works_CXX" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_CXX" >&6; }
-if test x"$lt_cv_prog_compiler_pic_works_CXX" = xyes; then
+if test x"$lt_prog_compiler_pic_works_CXX" = xyes; then
case $lt_prog_compiler_pic_CXX in
"" | " "*) ;;
*) lt_prog_compiler_pic_CXX=" $lt_prog_compiler_pic_CXX" ;;
@@ -21014,21 +18564,26 @@ else
fi
fi
-
-
-
-
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_CXX=
+ ;;
+ *)
+ lt_prog_compiler_pic_CXX="$lt_prog_compiler_pic_CXX -DPIC"
+ ;;
+esac
#
# Check to make sure the static flag actually works.
#
wl=$lt_prog_compiler_wl_CXX eval lt_tmp_static_flag=\"$lt_prog_compiler_static_CXX\"
-{ $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_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- lt_cv_prog_compiler_static_works_CXX=no
+ lt_prog_compiler_static_works_CXX=no
save_LDFLAGS="$LDFLAGS"
LDFLAGS="$LDFLAGS $lt_tmp_static_flag"
echo "$lt_simple_link_test_code" > conftest.$ac_ext
@@ -21038,38 +18593,36 @@ else
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
+ $echo "X$_lt_linker_boilerplate" | $Xsed -e '/^$/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_CXX=yes
+ lt_prog_compiler_static_works_CXX=yes
fi
else
- lt_cv_prog_compiler_static_works_CXX=yes
+ lt_prog_compiler_static_works_CXX=yes
fi
fi
- $RM -r conftest*
+ $rm conftest*
LDFLAGS="$save_LDFLAGS"
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_static_works_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_static_works_CXX" >&6; }
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_CXX" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_CXX" >&6; }
-if test x"$lt_cv_prog_compiler_static_works_CXX" = xyes; then
+if test x"$lt_prog_compiler_static_works_CXX" = xyes; then
:
else
lt_prog_compiler_static_CXX=
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_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_CXX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
lt_cv_prog_compiler_c_o_CXX=no
- $RM -r conftest 2>/dev/null
+ $rm -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
@@ -21084,44 +18637,1658 @@ else
-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 echo "\"\$as_me:18640: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ echo "$as_me:18644: \$? = $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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_CXX=yes
fi
fi
chmod u+w . 2>&5
- $RM conftest*
+ $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
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
cd ..
- $RM -r conftest
- $RM conftest*
+ rmdir conftest
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_CXX" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_CXX" >&6; }
+
+
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&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
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+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
+
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ case $host_os in
+ aix4* | aix5*)
+ # 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
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_CXX='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ fi
+ ;;
+ pw32*)
+ export_symbols_cmds_CXX="$ltdll_cmds"
+ ;;
+ cygwin* | mingw*)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/;/^.*[ ]__nm__/s/^.*[ ]__nm__\([^ ]*\)[ ][^ ]*/\1 DATA/;/^I[ ]/d;/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+ ;;
+ *)
+ export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ ;;
+ esac
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_CXX" >&5
+echo "${ECHO_T}$ld_shlibs_CXX" >&6; }
+test "$ld_shlibs_CXX" = no && can_build_shared=no
+
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_CXX" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_CXX=yes
+
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_CXX 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.
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_CXX
+ pic_flag=$lt_prog_compiler_pic_CXX
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
+ allow_undefined_flag_CXX=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_CXX 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_CXX=no
+ else
+ archive_cmds_need_lc_CXX=yes
+ fi
+ allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_CXX" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_CXX" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&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
+ 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'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ 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*)
+ 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=`$echo "X$lib" | $Xsed -e '\''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'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ 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*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ 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'
+ 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}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ 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
+ ;;
+ 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
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # 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}${versuffix}$shared_ext ${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
+ 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
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+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[123]*) 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
+ 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
+ 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'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ 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
+ 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 Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ 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
+ # 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;/^$/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
+ 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=linux
+ 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
+ ;;
+
+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
+ 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
+ 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
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ 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
+ 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
+ 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'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ 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'
+ ;;
+
+uts4*)
+ version_type=linux
+ 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
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$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
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_CXX=
+if test -n "$hardcode_libdir_flag_spec_CXX" || \
+ test -n "$runpath_var_CXX" || \
+ test "X$hardcode_automatic_CXX" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_CXX" != 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_AC_TAGVAR(hardcode_shlibpath_var, CXX)" != no &&
+ test "$hardcode_minus_L_CXX" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_CXX=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_CXX=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_CXX=unsupported
+fi
+{ echo "$as_me:$LINENO: result: $hardcode_action_CXX" >&5
+echo "${ECHO_T}$hardcode_action_CXX" >&6; }
+
+if test "$hardcode_action_CXX" = relink; 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
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_CXX \
+ CC_CXX \
+ LD_CXX \
+ lt_prog_compiler_wl_CXX \
+ lt_prog_compiler_pic_CXX \
+ lt_prog_compiler_static_CXX \
+ lt_prog_compiler_no_builtin_flag_CXX \
+ export_dynamic_flag_spec_CXX \
+ thread_safe_flag_spec_CXX \
+ whole_archive_flag_spec_CXX \
+ enable_shared_with_static_runtimes_CXX \
+ old_archive_cmds_CXX \
+ old_archive_from_new_cmds_CXX \
+ predep_objects_CXX \
+ postdep_objects_CXX \
+ predeps_CXX \
+ postdeps_CXX \
+ compiler_lib_search_path_CXX \
+ archive_cmds_CXX \
+ archive_expsym_cmds_CXX \
+ postinstall_cmds_CXX \
+ postuninstall_cmds_CXX \
+ old_archive_from_expsyms_cmds_CXX \
+ allow_undefined_flag_CXX \
+ no_undefined_flag_CXX \
+ export_symbols_cmds_CXX \
+ hardcode_libdir_flag_spec_CXX \
+ hardcode_libdir_flag_spec_ld_CXX \
+ hardcode_libdir_separator_CXX \
+ hardcode_automatic_CXX \
+ module_cmds_CXX \
+ module_expsym_cmds_CXX \
+ lt_cv_prog_compiler_c_o_CXX \
+ fix_srcfile_path_CXX \
+ exclude_expsyms_CXX \
+ include_expsyms_CXX; do
+
+ case $var in
+ old_archive_cmds_CXX | \
+ old_archive_from_new_cmds_CXX | \
+ archive_cmds_CXX | \
+ archive_expsym_cmds_CXX | \
+ module_cmds_CXX | \
+ module_expsym_cmds_CXX | \
+ old_archive_from_expsyms_cmds_CXX | \
+ export_symbols_cmds_CXX | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_CXX
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_CXX
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_CXX
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_CXX
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_CXX
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_CXX
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_CXX
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_CXX
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_CXX
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_CXX
+archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_CXX
+module_expsym_cmds=$lt_module_expsym_cmds_CXX
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_CXX
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_CXX
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_CXX
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_CXX
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_CXX
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_CXX
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# 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_CXX
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_CXX
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_CXX
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_CXX
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
+
+# 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_CXX
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_CXX
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_CXX
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_CXX
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_CXX
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_CXX
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
- { $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_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
else
- lt_cv_prog_compiler_c_o_CXX=no
- $RM -r conftest 2>/dev/null
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+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
+
+CC=$lt_save_CC
+LDCXX=$LD
+LD=$lt_save_LD
+GCC=$lt_save_GCC
+with_gnu_ldcxx=$with_gnu_ld
+with_gnu_ld=$lt_save_with_gnu_ld
+lt_cv_path_LDCXX=$lt_cv_path_LD
+lt_cv_path_LD=$lt_save_path_LD
+lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
+lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ F77)
+ if test -n "$F77" && test "X$F77" != "Xno"; then
+
+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
+
+
+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_libdir_flag_spec_F77=
+hardcode_libdir_flag_spec_ld_F77=
+hardcode_libdir_separator_F77=
+hardcode_minus_L_F77=no
+hardcode_automatic_F77=no
+module_cmds_F77=
+module_expsym_cmds_F77=
+link_all_deplibs_F77=unknown
+old_archive_cmds_F77=$old_archive_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
+
+# 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 conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${F77-"f77"}
+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 "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+{ echo "$as_me:$LINENO: checking if libtool supports shared libraries" >&5
+echo $ECHO_N "checking if libtool supports shared libraries... $ECHO_C" >&6; }
+{ echo "$as_me:$LINENO: result: $can_build_shared" >&5
+echo "${ECHO_T}$can_build_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build shared libraries" >&5
+echo $ECHO_N "checking whether to build shared libraries... $ECHO_C" >&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
+ ;;
+aix4* | aix5*)
+ if test "$host_cpu" != ia64 && test "$aix_use_runtimelinking" = no ; then
+ test "$enable_shared" = yes && enable_static=no
+ fi
+ ;;
+esac
+{ echo "$as_me:$LINENO: result: $enable_shared" >&5
+echo "${ECHO_T}$enable_shared" >&6; }
+
+{ echo "$as_me:$LINENO: checking whether to build static libraries" >&5
+echo $ECHO_N "checking whether to build static libraries... $ECHO_C" >&6; }
+# Make sure either enable_shared or enable_static is yes.
+test "$enable_shared" = yes || enable_static=yes
+{ echo "$as_me:$LINENO: result: $enable_static" >&5
+echo "${ECHO_T}$enable_static" >&6; }
+
+GCC_F77="$G77"
+LD_F77="$LD"
+
+lt_prog_compiler_wl_F77=
+lt_prog_compiler_pic_F77=
+lt_prog_compiler_static_F77=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+ 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*)
+ # 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'
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # 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'
+ ;;
+
+ 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
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_F77=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # 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='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic_F77='-fPIC'
+ ;;
+ 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
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_F77='-qnocommon'
+ lt_prog_compiler_wl_F77='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # 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'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl_F77='-Wl,'
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # 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'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic_F77='-KPIC'
+ lt_prog_compiler_static_F77='-Bstatic'
+ lt_prog_compiler_wl_F77='-Wl,'
+ ;;
+ *Sun\ F*)
+ # 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=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ 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*)
+ 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
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_F77" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_F77"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_F77 works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_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:20202: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:20206: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works_F77=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_F77" >&6; }
+
+if test x"$lt_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
+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
+
+#
+# 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\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works_F77=yes
+ fi
+ else
+ lt_prog_compiler_static_works_F77=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_F77" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_F77" >&6; }
+
+if test x"$lt_prog_compiler_static_works_F77" = xyes; then
+ :
+else
+ lt_prog_compiler_static_F77=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_F77+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o_F77=no
+ $rm -r conftest 2>/dev/null
mkdir conftest
cd conftest
mkdir out
@@ -21136,119 +20303,1032 @@ else
-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 echo "\"\$as_me:20306: $lt_compile\"" >&5)
(eval "$lt_compile" 2>out/conftest.err)
ac_status=$?
cat out/conftest.err >&5
- echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ echo "$as_me:20310: \$? = $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
+ $echo "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_CXX=yes
+ lt_cv_prog_compiler_c_o_F77=yes
fi
fi
chmod u+w . 2>&5
- $RM conftest*
+ $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
+ test -d out/ii_files && $rm out/ii_files/* && rmdir out/ii_files
+ $rm out/* && rmdir out
cd ..
- $RM -r conftest
- $RM conftest*
+ rmdir conftest
+ $rm conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_prog_compiler_c_o_CXX" >&5
-$as_echo "$lt_cv_prog_compiler_c_o_CXX" >&6; }
-
-
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_F77" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_F77" >&6; }
hard_links="nottested"
-if test "$lt_cv_prog_compiler_c_o_CXX" = no && test "$need_locks" != no; then
+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; }
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&6; }
hard_links=yes
- $RM conftest*
+ $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; }
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$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;}
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+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
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ runpath_var=
+ allow_undefined_flag_F77=
+ enable_shared_with_static_runtimes_F77=no
+ archive_cmds_F77=
+ archive_expsym_cmds_F77=
+ old_archive_From_new_cmds_F77=
+ old_archive_from_expsyms_cmds_F77=
+ export_dynamic_flag_spec_F77=
+ whole_archive_flag_spec_F77=
+ thread_safe_flag_spec_F77=
+ hardcode_libdir_flag_spec_F77=
+ hardcode_libdir_flag_spec_ld_F77=
+ hardcode_libdir_separator_F77=
+ hardcode_direct_F77=no
+ hardcode_minus_L_F77=no
+ hardcode_shlibpath_var_F77=unsupported
+ link_all_deplibs_F77=unknown
+ hardcode_automatic_F77=no
+ module_cmds_F77=
+ module_expsym_cmds_F77=
+ always_export_symbols_F77=no
+ export_symbols_cmds_F77='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # 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_"
+ # 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.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
- { $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; }
-
- export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- exclude_expsyms_CXX='_GLOBAL_OFFSET_TABLE_|_GLOBAL__F[ID]_.*'
case $host_os in
- aix[4-9]*)
- # 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_CXX='$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_CXX='$NM -BCpg $libobjs $convenience | awk '\''{ if (((\$ 2 == "T") || (\$ 2 == "D") || (\$ 2 == "B")) && (substr(\$ 3,1,1) != ".")) { print \$ 3 } }'\'' | sort -u > $export_symbols'
+ cygwin* | mingw* | pw32*)
+ # 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
;;
- pw32*)
- export_symbols_cmds_CXX="$ltdll_cmds"
+ interix*)
+ # we just hope/assume this is gcc and not c89 (= MSVC++)
+ with_gnu_ld=yes
;;
- cygwin* | mingw* | cegcc*)
- case $cc_basename in
- cl*)
- exclude_expsyms_CXX='_NULL_IMPORT_DESCRIPTOR|_IMPORT_DESCRIPTOR_.*'
+ openbsd*)
+ with_gnu_ld=no
+ ;;
+ esac
+
+ ld_shlibs_F77=yes
+ if test "$with_gnu_ld" = 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>/dev/null` in
+ *\ [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
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs_F77=no
+ cat <<EOF 1>&2
+
+*** Warning: the GNU linker, at least up to release 2.9.1, 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 modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+
+EOF
+ fi
+ ;;
+
+ amigaos*)
+ 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
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs_F77=no
+ ;;
+
+ 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*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, F77) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_F77='-L$libdir'
+ 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/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ 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
+ ;;
+
+ 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* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ 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; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # 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; $echo \"$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' ;;
+ 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; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ archive_cmds_F77='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+
+ if test $supports_anon_versioning = yes; 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
+ 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 $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'
+ fi
+ ;;
+
+ solaris*)
+ if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
+ ld_shlibs_F77=no
+ cat <<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.
+
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ 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
+ ;;
+
+ 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
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec_F77='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds_F77='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$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
;;
+
*)
- export_symbols_cmds_CXX='$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_CXX='[_]+GLOBAL_OFFSET_TABLE_|[_]+GLOBAL__[FID]_.*|[_]+head_[A-Za-z0-9_]+_dll|[A-Za-z0-9_]+_dll_iname'
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ 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
- ;;
- *)
- export_symbols_cmds_CXX='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
- ;;
- esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ld_shlibs_CXX" >&5
-$as_echo "$ld_shlibs_CXX" >&6; }
-test "$ld_shlibs_CXX" = no && can_build_shared=no
+ 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
+ ;;
+
+ aix4* | aix5*)
+ 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
+ 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")) && (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].*|aix5*)
+ 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_libdir_separator_F77=':'
+ link_all_deplibs_F77=yes
+
+ 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
+
+ # 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.
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_f77_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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 echo "${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.
+ cat >conftest.$ac_ext <<_ACEOF
+ program main
+
+ end
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_f77_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
-with_gnu_ld_CXX=$with_gnu_ld
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; 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'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_F77='$convenience'
+ 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*)
+ 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
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs_F77=no
+ ;;
+ bsdi[45]*)
+ export_dynamic_flag_spec_F77=-rdynamic
+ ;;
+ cygwin* | mingw* | pw32*)
+ # 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.
+ 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 `echo "$deplibs" | $SED -e '\''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'
+ fix_srcfile_path_F77='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes_F77=yes
+ ;;
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_F77='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_F77='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_F77='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_F77=no
+ hardcode_direct_F77=no
+ hardcode_automatic_F77=yes
+ hardcode_shlibpath_var_F77=unsupported
+ whole_archive_flag_spec_F77=''
+ link_all_deplibs_F77=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_F77='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds_F77='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_F77='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_F77=no
+ ;;
+ esac
+ 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
+ ;;
+
+ freebsd1*)
+ ld_shlibs_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 -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 -fPIC ${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 -a "$with_gnu_ld" = no; then
+ archive_cmds_F77='$CC -shared -fPIC ${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
+ 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 -a "$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 ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_F77='$CC -shared -fPIC ${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_libdir_flag_spec_ld_F77='+b $libdir'
+ hardcode_direct_F77=no
+ hardcode_shlibpath_var_F77=no
+ ;;
+ *)
+ hardcode_direct_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 $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_F77='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld_F77='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec_F77='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_F77=:
+ 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
+ ;;
+
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_F77=yes
+ hardcode_shlibpath_var_F77=no
+ 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" && echo ${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='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ 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} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${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='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -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; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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
+ hardcode_libdir_separator_F77=:
+ ;;
+
+ solaris*)
+ no_undefined_flag_F77=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds_F77='$CC -shared ${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 ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ 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'
+ 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='`test -z "$SCOABSPATH" && echo ${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,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_F77='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_F77='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$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
+ fi
+
+{ echo "$as_me:$LINENO: result: $ld_shlibs_F77" >&5
+echo "${ECHO_T}$ld_shlibs_F77" >&6; }
+test "$ld_shlibs_F77" = no && can_build_shared=no
#
# Do we need to explicitly link libc?
#
-case "x$archive_cmds_need_lc_CXX" in
+case "x$archive_cmds_need_lc_F77" in
x|xyes)
# Assume -lc should be added
- archive_cmds_need_lc_CXX=yes
+ archive_cmds_need_lc_F77=yes
if test "$enable_shared" = yes && test "$GCC" = yes; then
- case $archive_cmds_CXX in
+ case $archive_cmds_F77 in
*'~'*)
# FIXME: we may have to deal with multi-command sequences.
;;
@@ -21256,122 +21336,2655 @@ x|xyes)
# 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_CXX+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- $RM conftest*
- echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_compile\""; } >&5
+ if { (eval echo "$as_me:$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_CXX
- pic_flag=$lt_prog_compiler_pic_CXX
- compiler_flags=-v
- linker_flags=-v
- verstring=
- output_objdir=.
- libname=conftest
- lt_save_allow_undefined_flag=$allow_undefined_flag_CXX
- allow_undefined_flag_CXX=
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$archive_cmds_CXX 2\>\&1 \| $GREP \" -lc \" \>/dev/null 2\>\&1\""; } >&5
- (eval $archive_cmds_CXX 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_CXX=no
- else
- lt_cv_archive_cmds_need_lc_CXX=yes
- fi
- allow_undefined_flag_CXX=$lt_save_allow_undefined_flag
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 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:$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=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_F77=no
+ else
+ 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*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_F77" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_F77" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&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
+ 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'
+ ;;
+
+aix4* | aix5*)
+ version_type=linux
+ 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*)
+ 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=`$echo "X$lib" | $Xsed -e '\''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'
+ ;;
+
+beos*)
+ library_names_spec='${libname}${shared_ext}'
+ dynamic_linker="$host_os ld.so"
+ shlibpath_var=LIBRARY_PATH
+ ;;
+
+bsdi[45]*)
+ version_type=linux
+ 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*)
+ version_type=windows
+ shrext_cmds=".dll"
+ need_version=no
+ need_lib_prefix=no
+
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
+ 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'
+ 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}'
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
+ ;;
+ mingw*)
+ # MinGW DLLs use traditional 'lib' prefix
+ soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ 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
+ ;;
+ 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
+ ;;
+
+ *)
+ library_names_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext} $libname.lib'
+ ;;
+ esac
+ dynamic_linker='Win32 ld.exe'
+ # 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}${versuffix}$shared_ext ${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
+ 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
+ ;;
+
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
+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[123]*) 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
+ 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
+ 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'
+ ;;
+
+interix[3-9]*)
+ version_type=linux
+ 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
+ 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 Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
+ 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
+ # 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;/^$/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
+ 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=linux
+ 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
+ ;;
+
+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
+ 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
+ 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
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
+ 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
+ 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
+ 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'
+ shlibpath_overrides_runpath=no
+ else
+ sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
+ 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'
+ ;;
+
+uts4*)
+ version_type=linux
+ 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
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$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
+
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&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-existant 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_AC_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
+{ echo "$as_me:$LINENO: result: $hardcode_action_F77" >&5
+echo "${ECHO_T}$hardcode_action_F77" >&6; }
+
+if test "$hardcode_action_F77" = relink; 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
+
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_F77 \
+ CC_F77 \
+ LD_F77 \
+ lt_prog_compiler_wl_F77 \
+ lt_prog_compiler_pic_F77 \
+ lt_prog_compiler_static_F77 \
+ lt_prog_compiler_no_builtin_flag_F77 \
+ export_dynamic_flag_spec_F77 \
+ thread_safe_flag_spec_F77 \
+ whole_archive_flag_spec_F77 \
+ enable_shared_with_static_runtimes_F77 \
+ old_archive_cmds_F77 \
+ old_archive_from_new_cmds_F77 \
+ predep_objects_F77 \
+ postdep_objects_F77 \
+ predeps_F77 \
+ postdeps_F77 \
+ compiler_lib_search_path_F77 \
+ archive_cmds_F77 \
+ archive_expsym_cmds_F77 \
+ postinstall_cmds_F77 \
+ postuninstall_cmds_F77 \
+ old_archive_from_expsyms_cmds_F77 \
+ allow_undefined_flag_F77 \
+ no_undefined_flag_F77 \
+ export_symbols_cmds_F77 \
+ hardcode_libdir_flag_spec_F77 \
+ hardcode_libdir_flag_spec_ld_F77 \
+ hardcode_libdir_separator_F77 \
+ hardcode_automatic_F77 \
+ module_cmds_F77 \
+ module_expsym_cmds_F77 \
+ lt_cv_prog_compiler_c_o_F77 \
+ fix_srcfile_path_F77 \
+ exclude_expsyms_F77 \
+ include_expsyms_F77; do
+
+ case $var in
+ old_archive_cmds_F77 | \
+ old_archive_from_new_cmds_F77 | \
+ archive_cmds_F77 | \
+ archive_expsym_cmds_F77 | \
+ module_cmds_F77 | \
+ module_expsym_cmds_F77 | \
+ old_archive_from_expsyms_cmds_F77 | \
+ export_symbols_cmds_F77 | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# 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
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_F77
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_F77
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_F77
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_F77
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_F77
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_F77
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_F77
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_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
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_F77
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_F77
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# 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 and install a shared archive.
+archive_cmds=$lt_archive_cmds_F77
+archive_expsym_cmds=$lt_archive_expsym_cmds_F77
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_F77
+module_expsym_cmds=$lt_module_expsym_cmds_F77
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_F77
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_F77
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+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
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_F77
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_F77
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_F77
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# 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
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_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 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
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_F77
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# 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
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# 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
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
+
+
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
+
+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
+
+CC="$lt_save_CC"
+
else
- cat conftest.err 1>&5
+ tagname=""
fi
- $RM conftest*
+ ;;
+
+ GCJ)
+ if test -n "$GCJ" && test "X$GCJ" != "Xno"; then
+
+
+# Source file extension for Java test sources.
+ac_ext=java
+
+# Object file extension for compiled Java test sources.
+objext=o
+objext_GCJ=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code="class foo {}"
+
+# Code to be used in simple link tests
+lt_simple_link_test_code='public class conftest { public static void main(String[] argv) {}; }'
+
+# 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 conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${GCJ-"gcj"}
+compiler=$CC
+compiler_GCJ=$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 "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+
+# GCJ did not exist at the time GCC didn't implicitly link libc in.
+archive_cmds_need_lc_GCJ=no
+
+old_archive_cmds_GCJ=$old_archive_cmds
+
+
+lt_prog_compiler_no_builtin_flag_GCJ=
+
+if test "$GCC" = yes; then
+ lt_prog_compiler_no_builtin_flag_GCJ=' -fno-builtin'
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -fno-rtti -fno-exceptions" >&5
+echo $ECHO_N "checking if $compiler supports -fno-rtti -fno-exceptions... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_rtti_exceptions+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_rtti_exceptions=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="-fno-rtti -fno-exceptions"
+ # 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:22493: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:22497: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_rtti_exceptions=yes
+ fi
+ fi
+ $rm conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $lt_cv_archive_cmds_need_lc_CXX" >&5
-$as_echo "$lt_cv_archive_cmds_need_lc_CXX" >&6; }
- archive_cmds_need_lc_CXX=$lt_cv_archive_cmds_need_lc_CXX
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_rtti_exceptions" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_rtti_exceptions" >&6; }
+
+if test x"$lt_cv_prog_compiler_rtti_exceptions" = xyes; then
+ lt_prog_compiler_no_builtin_flag_GCJ="$lt_prog_compiler_no_builtin_flag_GCJ -fno-rtti -fno-exceptions"
+else
+ :
+fi
+
+fi
+
+lt_prog_compiler_wl_GCJ=
+lt_prog_compiler_pic_GCJ=
+lt_prog_compiler_static_GCJ=
+
+{ echo "$as_me:$LINENO: checking for $compiler option to produce PIC" >&5
+echo $ECHO_N "checking for $compiler option to produce PIC... $ECHO_C" >&6; }
+
+ if test "$GCC" = yes; then
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_static_GCJ='-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_GCJ='-Bstatic'
+ fi
+ ;;
+
+ amigaos*)
+ # 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_GCJ='-m68020 -resident32 -malways-restore-a4'
+ ;;
+
+ beos* | irix5* | irix6* | nonstopux* | osf3* | osf4* | osf5*)
+ # PIC is the default for these OSes.
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # 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_GCJ='-DDLL_EXPORT'
+ ;;
+
+ darwin* | rhapsody*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ lt_prog_compiler_pic_GCJ='-fno-common'
+ ;;
+
+ 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_GCJ=no
+ enable_shared=no
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ lt_prog_compiler_pic_GCJ=-Kconform_pic
+ fi
+ ;;
+
+ hpux*)
+ # 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_GCJ='-fPIC'
+ ;;
+ esac
+ ;;
+
+ *)
+ lt_prog_compiler_pic_GCJ='-fPIC'
+ ;;
+ esac
+ else
+ # PORTME Check for flag to pass linker flags through the system compiler.
+ case $host_os in
+ aix*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ if test "$host_cpu" = ia64; then
+ # AIX 5 now supports IA64 processor
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ else
+ lt_prog_compiler_static_GCJ='-bnso -bI:/lib/syscalls.exp'
+ fi
+ ;;
+ darwin*)
+ # PIC is the default on this platform
+ # Common symbols not allowed in MH_DYLIB files
+ case $cc_basename in
+ xlc*)
+ lt_prog_compiler_pic_GCJ='-qnocommon'
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ ;;
+ esac
+ ;;
+
+ mingw* | cygwin* | pw32* | os2*)
+ # 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_GCJ='-DDLL_EXPORT'
+ ;;
+
+ hpux9* | hpux10* | hpux11*)
+ lt_prog_compiler_wl_GCJ='-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_GCJ='+Z'
+ ;;
+ esac
+ # Is there a better lt_prog_compiler_static that works with the bundled CC?
+ lt_prog_compiler_static_GCJ='${wl}-a ${wl}archive'
+ ;;
+
+ irix5* | irix6* | nonstopux*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # PIC (with -KPIC) is the default.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ newsos6)
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ linux* | k*bsd*-gnu)
+ case $cc_basename in
+ icc* | ecc*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-static'
+ ;;
+ pgcc* | pgf77* | pgf90* | pgf95*)
+ # Portland Group compilers (*not* the Pentium gcc compiler,
+ # which looks to be a dead project)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-fpic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+ ccc*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # All Alpha code is PIC.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+ *)
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*)
+ # Sun C 5.9
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ ;;
+ *Sun\ F*)
+ # Sun Fortran 8.3 passes all unrecognized flags to the linker
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ lt_prog_compiler_wl_GCJ=''
+ ;;
+ esac
+ ;;
+ esac
+ ;;
+
+ osf3* | osf4* | osf5*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ # All OSF/1 code is PIC.
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ rdos*)
+ lt_prog_compiler_static_GCJ='-non_shared'
+ ;;
+
+ solaris*)
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ case $cc_basename in
+ f77* | f90* | f95*)
+ lt_prog_compiler_wl_GCJ='-Qoption ld ';;
+ *)
+ lt_prog_compiler_wl_GCJ='-Wl,';;
+ esac
+ ;;
+
+ sunos4*)
+ lt_prog_compiler_wl_GCJ='-Qoption ld '
+ lt_prog_compiler_pic_GCJ='-PIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ sysv4 | sysv4.2uw2* | sysv4.3*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ sysv4*MP*)
+ if test -d /usr/nec ;then
+ lt_prog_compiler_pic_GCJ='-Kconform_pic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ fi
+ ;;
+
+ sysv5* | unixware* | sco3.2v5* | sco5v6* | OpenUNIX*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_pic_GCJ='-KPIC'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ unicos*)
+ lt_prog_compiler_wl_GCJ='-Wl,'
+ lt_prog_compiler_can_build_shared_GCJ=no
+ ;;
+
+ uts4*)
+ lt_prog_compiler_pic_GCJ='-pic'
+ lt_prog_compiler_static_GCJ='-Bstatic'
+ ;;
+
+ *)
+ lt_prog_compiler_can_build_shared_GCJ=no
;;
esac
fi
- ;;
+
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_GCJ" >&6; }
+
+#
+# Check to make sure the PIC flag actually works.
+#
+if test -n "$lt_prog_compiler_pic_GCJ"; then
+
+{ echo "$as_me:$LINENO: checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works" >&5
+echo $ECHO_N "checking if $compiler PIC flag $lt_prog_compiler_pic_GCJ works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_pic_works_GCJ+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_pic_works_GCJ=no
+ ac_outfile=conftest.$ac_objext
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
+ lt_compiler_flag="$lt_prog_compiler_pic_GCJ"
+ # 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:22783: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>conftest.err)
+ ac_status=$?
+ cat conftest.err >&5
+ echo "$as_me:22787: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/d' >conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if test ! -s conftest.er2 || diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_pic_works_GCJ=yes
+ fi
+ fi
+ $rm conftest*
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_pic_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_pic_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_pic_works_GCJ" = xyes; then
+ case $lt_prog_compiler_pic_GCJ in
+ "" | " "*) ;;
+ *) lt_prog_compiler_pic_GCJ=" $lt_prog_compiler_pic_GCJ" ;;
+ esac
+else
+ lt_prog_compiler_pic_GCJ=
+ lt_prog_compiler_can_build_shared_GCJ=no
+fi
+
+fi
+case $host_os in
+ # For platforms which do not support PIC, -DPIC is meaningless:
+ *djgpp*)
+ lt_prog_compiler_pic_GCJ=
+ ;;
+ *)
+ lt_prog_compiler_pic_GCJ="$lt_prog_compiler_pic_GCJ"
+ ;;
esac
+#
+# Check to make sure the static flag actually works.
+#
+wl=$lt_prog_compiler_wl_GCJ eval lt_tmp_static_flag=\"$lt_prog_compiler_static_GCJ\"
+{ echo "$as_me:$LINENO: checking if $compiler static flag $lt_tmp_static_flag works" >&5
+echo $ECHO_N "checking if $compiler static flag $lt_tmp_static_flag works... $ECHO_C" >&6; }
+if test "${lt_prog_compiler_static_works_GCJ+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_prog_compiler_static_works_GCJ=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 "X$_lt_linker_boilerplate" | $Xsed -e '/^$/d' > conftest.exp
+ $SED '/^$/d; /^ *+/d' conftest.err >conftest.er2
+ if diff conftest.exp conftest.er2 >/dev/null; then
+ lt_prog_compiler_static_works_GCJ=yes
+ fi
+ else
+ lt_prog_compiler_static_works_GCJ=yes
+ fi
+ fi
+ $rm conftest*
+ LDFLAGS="$save_LDFLAGS"
+
+fi
+{ echo "$as_me:$LINENO: result: $lt_prog_compiler_static_works_GCJ" >&5
+echo "${ECHO_T}$lt_prog_compiler_static_works_GCJ" >&6; }
+
+if test x"$lt_prog_compiler_static_works_GCJ" = xyes; then
+ :
+else
+ lt_prog_compiler_static_GCJ=
+fi
+
+
+{ echo "$as_me:$LINENO: checking if $compiler supports -c -o file.$ac_objext" >&5
+echo $ECHO_N "checking if $compiler supports -c -o file.$ac_objext... $ECHO_C" >&6; }
+if test "${lt_cv_prog_compiler_c_o_GCJ+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ lt_cv_prog_compiler_c_o_GCJ=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:22887: $lt_compile\"" >&5)
+ (eval "$lt_compile" 2>out/conftest.err)
+ ac_status=$?
+ cat out/conftest.err >&5
+ echo "$as_me:22891: \$? = $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 "X$_lt_compiler_boilerplate" | $Xsed -e '/^$/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_GCJ=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 ..
+ rmdir conftest
+ $rm conftest*
+fi
+{ echo "$as_me:$LINENO: result: $lt_cv_prog_compiler_c_o_GCJ" >&5
+echo "${ECHO_T}$lt_cv_prog_compiler_c_o_GCJ" >&6; }
+hard_links="nottested"
+if test "$lt_cv_prog_compiler_c_o_GCJ" = no && test "$need_locks" != no; then
+ # do not overwrite the value of need_locks provided by the user
+ { echo "$as_me:$LINENO: checking if we can lock with hard links" >&5
+echo $ECHO_N "checking if we can lock with hard links... $ECHO_C" >&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
+ { echo "$as_me:$LINENO: result: $hard_links" >&5
+echo "${ECHO_T}$hard_links" >&6; }
+ if test "$hard_links" = no; then
+ { echo "$as_me:$LINENO: WARNING: \`$CC' does not support \`-c -o', so \`make -j' may be unsafe" >&5
+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
+{ echo "$as_me:$LINENO: checking whether the $compiler linker ($LD) supports shared libraries" >&5
+echo $ECHO_N "checking whether the $compiler linker ($LD) supports shared libraries... $ECHO_C" >&6; }
+ runpath_var=
+ allow_undefined_flag_GCJ=
+ enable_shared_with_static_runtimes_GCJ=no
+ archive_cmds_GCJ=
+ archive_expsym_cmds_GCJ=
+ old_archive_From_new_cmds_GCJ=
+ old_archive_from_expsyms_cmds_GCJ=
+ export_dynamic_flag_spec_GCJ=
+ whole_archive_flag_spec_GCJ=
+ thread_safe_flag_spec_GCJ=
+ hardcode_libdir_flag_spec_GCJ=
+ hardcode_libdir_flag_spec_ld_GCJ=
+ hardcode_libdir_separator_GCJ=
+ hardcode_direct_GCJ=no
+ hardcode_minus_L_GCJ=no
+ hardcode_shlibpath_var_GCJ=unsupported
+ link_all_deplibs_GCJ=unknown
+ hardcode_automatic_GCJ=no
+ module_cmds_GCJ=
+ module_expsym_cmds_GCJ=
+ always_export_symbols_GCJ=no
+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED '\''s/.* //'\'' | sort | uniq > $export_symbols'
+ # include_expsyms should be a list of space-separated symbols to be *always*
+ # included in the symbol list
+ include_expsyms_GCJ=
+ # 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_GCJ="_GLOBAL_OFFSET_TABLE_"
+ # 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.
+ extract_expsyms_cmds=
+ # Just being paranoid about ensuring that cc_basename is set.
+ for cc_temp in $compiler""; do
+ case $cc_temp in
+ compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
+ distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
+ \-*) ;;
+ *) break;;
+ esac
+done
+cc_basename=`$echo "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+ case $host_os in
+ cygwin* | mingw* | pw32*)
+ # 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_GCJ=yes
+ if test "$with_gnu_ld" = 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_GCJ='${wl}--rpath ${wl}$libdir'
+ export_dynamic_flag_spec_GCJ='${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_GCJ="$wlarc"'--whole-archive$convenience '"$wlarc"'--no-whole-archive'
+ else
+ whole_archive_flag_spec_GCJ=
+ fi
+ supports_anon_versioning=no
+ case `$LD -v 2>/dev/null` in
+ *\ [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
+ aix3* | aix4* | aix5*)
+ # On AIX/PPC, the GNU linker is very broken
+ if test "$host_cpu" != ia64; then
+ ld_shlibs_GCJ=no
+ cat <<EOF 1>&2
+*** Warning: the GNU linker, at least up to release 2.9.1, 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 modify your PATH
+*** so that a non-GNU linker is found, and then restart.
+EOF
+ fi
+ ;;
+ amigaos*)
+ archive_cmds_GCJ='$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_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+
+ # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
+ # that the semantics of dynamic libraries on AmigaOS, at least up
+ # to version 4, is to share data among multiple programs linked
+ # with the same dynamic library. Since this doesn't match the
+ # behavior of shared libraries on other platforms, we can't use
+ # them.
+ ld_shlibs_GCJ=no
+ ;;
+ beos*)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ allow_undefined_flag_GCJ=unsupported
+ # Joseph Beckenbach <jrb3@best.com> says some releases of gcc
+ # support --undefined. This deserves some investigation. FIXME
+ archive_cmds_GCJ='$CC -nostart $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ cygwin* | mingw* | pw32*)
+ # _LT_AC_TAGVAR(hardcode_libdir_flag_spec, GCJ) is actually meaningless,
+ # as there is no search path for DLLs.
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ allow_undefined_flag_GCJ=unsupported
+ always_export_symbols_GCJ=no
+ enable_shared_with_static_runtimes_GCJ=yes
+ export_symbols_cmds_GCJ='$NM $libobjs $convenience | $global_symbol_pipe | $SED -e '\''/^[BCDGRS][ ]/s/.*[ ]\([^ ]*\)/\1 DATA/'\'' -e '\''/^[AITW][ ]/s/.*[ ]//'\'' | sort | uniq > $export_symbols'
+
+ if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
+ archive_cmds_GCJ='$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_GCJ='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_GCJ=no
+ fi
+ ;;
+ interix[3-9]*)
+ hardcode_direct_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_GCJ='${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_GCJ='$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_GCJ='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* | k*bsd*-gnu)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ tmp_addflag=
+ case $cc_basename,$host_cpu in
+ pgcc*) # Portland Group C compiler
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_addflag=' $pic_flag'
+ ;;
+ pgf77* | pgf90* | pgf95*) # Portland Group f77 and f90 compilers
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`for conv in $convenience\"\"; do test -n \"$conv\" && new_convenience=\"$new_convenience,$conv\"; done; $echo \"$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' ;;
+ esac
+ case `$CC -V 2>&1 | sed 5q` in
+ *Sun\ C*) # Sun C 5.9
+ whole_archive_flag_spec_GCJ='${wl}--whole-archive`new_convenience=; for conv in $convenience\"\"; do test -z \"$conv\" || new_convenience=\"$new_convenience,$conv\"; done; $echo \"$new_convenience\"` ${wl}--no-whole-archive'
+ tmp_sharedflag='-G' ;;
+ *Sun\ F*) # Sun Fortran 8.3
+ tmp_sharedflag='-G' ;;
+ *)
+ tmp_sharedflag='-shared' ;;
+ esac
+ archive_cmds_GCJ='$CC '"$tmp_sharedflag""$tmp_addflag"' $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ if test $supports_anon_versioning = yes; then
+ archive_expsym_cmds_GCJ='$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
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_GCJ='$LD -Bshareable $libobjs $deplibs $linker_flags -o $lib'
+ wlarc=
+ else
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $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_GCJ=no
+ cat <<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.
+EOF
+ elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
+ case `$LD -v 2>&1` in
+ *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
+ ld_shlibs_GCJ=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
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname,\${SCOABSPATH:+${install_libdir}/}$soname,-retain-symbols-file,$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ esac
+ ;;
+ sunos4*)
+ archive_cmds_GCJ='$LD -assert pure-text -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ wlarc=
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ *)
+ if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname -o $lib'
+ archive_expsym_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname $wl$soname ${wl}-retain-symbols-file $wl$export_symbols -o $lib'
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ esac
+ if test "$ld_shlibs_GCJ" = no; then
+ runpath_var=
+ hardcode_libdir_flag_spec_GCJ=
+ export_dynamic_flag_spec_GCJ=
+ whole_archive_flag_spec_GCJ=
+ fi
+ else
+ # PORTME fill in a description of your system's linker (not GNU ld)
+ case $host_os in
+ aix3*)
+ allow_undefined_flag_GCJ=unsupported
+ always_export_symbols_GCJ=yes
+ archive_expsym_cmds_GCJ='$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_GCJ=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_GCJ=unsupported
+ fi
+ ;;
+ aix4* | aix5*)
+ 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
+ if $NM -V 2>&1 | grep 'GNU' > /dev/null; then
+ export_symbols_cmds_GCJ='$NM -Bpg $libobjs $convenience | awk '\''{ if (((\$2 == "T") || (\$2 == "D") || (\$2 == "B")) && (substr(\$3,1,1) != ".")) { print \$3 } }'\'' | sort -u > $export_symbols'
+ else
+ export_symbols_cmds_GCJ='$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].*|aix5*)
+ 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_GCJ=''
+ hardcode_direct_GCJ=yes
+ hardcode_libdir_separator_GCJ=':'
+ link_all_deplibs_GCJ=yes
+
+ 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_GCJ=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_GCJ=yes
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_libdir_separator_GCJ=
+ 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
+
+ # 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_GCJ=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_GCJ='-berok'
+ # Determine the default libpath from the value encoded in an empty executable.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_GCJ='${wl}-blibpath:$libdir:'"$aix_libpath"
+ archive_expsym_cmds_GCJ="\$CC"' -o $output_objdir/$soname $libobjs $deplibs '"\${wl}$no_entry_flag"' $compiler_flags `if test "x${allow_undefined_flag}" != "x"; then echo "${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_GCJ='${wl}-R $libdir:/usr/lib:/lib'
+ allow_undefined_flag_GCJ="-z nodefs"
+ archive_expsym_cmds_GCJ="\$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.
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+
+int
+main ()
+{
+
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+
+lt_aix_libpath_sed='
+ /Import File Strings/,/^$/ {
+ /^0/ {
+ s/^0 *\(.*\)$/\1/
+ p
+ }
+ }'
+aix_libpath=`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 "$aix_libpath"; then
+ aix_libpath=`dump -HX64 conftest$ac_exeext 2>/dev/null | $SED -n -e "$lt_aix_libpath_sed"`
+fi
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+if test -z "$aix_libpath"; then aix_libpath="/usr/lib:/lib"; fi
+
+ hardcode_libdir_flag_spec_GCJ='${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_GCJ=' ${wl}-bernotok'
+ allow_undefined_flag_GCJ=' ${wl}-berok'
+ # Exported symbols can be pulled into shared objects from archives
+ whole_archive_flag_spec_GCJ='$convenience'
+ archive_cmds_need_lc_GCJ=yes
+ # This is similar to how AIX traditionally builds its shared libraries.
+ archive_expsym_cmds_GCJ="\$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*)
+ archive_cmds_GCJ='$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_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+ # see comment about different semantics on the GNU ld section
+ ld_shlibs_GCJ=no
+ ;;
+
+ bsdi[45]*)
+ export_dynamic_flag_spec_GCJ=-rdynamic
+ ;;
+ cygwin* | mingw* | pw32*)
+ # 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.
+ hardcode_libdir_flag_spec_GCJ=' '
+ allow_undefined_flag_GCJ=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_GCJ='$CC -o $lib $libobjs $compiler_flags `echo "$deplibs" | $SED -e '\''s/ -lc$//'\''` -link -dll~linknames='
+ # The linker will automatically build a .lib file if we build a DLL.
+ old_archive_From_new_cmds_GCJ='true'
+ # FIXME: Should let the user specify the lib program.
+ old_archive_cmds_GCJ='lib -OUT:$oldlib$oldobjs$old_deplibs'
+ fix_srcfile_path_GCJ='`cygpath -w "$srcfile"`'
+ enable_shared_with_static_runtimes_GCJ=yes
+ ;;
+ darwin* | rhapsody*)
+ case $host_os in
+ rhapsody* | darwin1.[012])
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}suppress'
+ ;;
+ *) # Darwin 1.3 on
+ if test -z ${MACOSX_DEPLOYMENT_TARGET} ; then
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ else
+ case ${MACOSX_DEPLOYMENT_TARGET} in
+ 10.[012])
+ allow_undefined_flag_GCJ='${wl}-flat_namespace ${wl}-undefined ${wl}suppress'
+ ;;
+ 10.*)
+ allow_undefined_flag_GCJ='${wl}-undefined ${wl}dynamic_lookup'
+ ;;
+ esac
+ fi
+ ;;
+ esac
+ archive_cmds_need_lc_GCJ=no
+ hardcode_direct_GCJ=no
+ hardcode_automatic_GCJ=yes
+ hardcode_shlibpath_var_GCJ=unsupported
+ whole_archive_flag_spec_GCJ=''
+ link_all_deplibs_GCJ=yes
+ if test "$GCC" = yes ; then
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ='$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring'
+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -dynamiclib $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags -install_name $rpath/$soname $verstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ else
+ case $cc_basename in
+ xlc*)
+ output_verbose_link_cmd='echo'
+ archive_cmds_GCJ='$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}`echo $rpath/$soname` $xlcverstring'
+ module_cmds_GCJ='$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags'
+ # Don't fix this by using the ld -exported_symbols_list flag, it doesn't exist in older darwin lds
+ archive_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC -qmkshrobj $allow_undefined_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-install_name ${wl}$rpath/$soname $xlcverstring~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ module_expsym_cmds_GCJ='sed -e "s,#.*,," -e "s,^[ ]*,," -e "s,^\(..*\),_&," < $export_symbols > $output_objdir/${libname}-symbols.expsym~$CC $allow_undefined_flag -o $lib -bundle $libobjs $deplibs$compiler_flags~nmedit -s $output_objdir/${libname}-symbols.expsym ${lib}'
+ ;;
+ *)
+ ld_shlibs_GCJ=no
+ ;;
+ esac
+ fi
+ ;;
+ dgux*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ freebsd1*)
+ ld_shlibs_GCJ=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_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags /usr/lib/c++rt0.o'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ # Unfortunately, older versions of FreeBSD 2 do not have this feature.
+ freebsd2*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes
+ hardcode_minus_L_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ # FreeBSD 3 and greater uses gcc -shared to do shared libraries.
+ freebsd* | dragonfly*)
+ archive_cmds_GCJ='$CC -shared -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+
+ hpux9*)
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$rm $output_objdir/$soname~$CC -shared -fPIC ${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_GCJ='$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_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ hardcode_direct_GCJ=yes
+
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ ;;
+
+ hpux10*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ archive_cmds_GCJ='$CC -shared -fPIC ${wl}+h ${wl}$soname ${wl}+b ${wl}$install_libdir -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$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_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ hardcode_direct_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ fi
+ ;;
+ hpux11*)
+ if test "$GCC" = yes -a "$with_gnu_ld" = no; then
+ case $host_cpu in
+ hppa*64*)
+ archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_GCJ='$CC -shared ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -shared -fPIC ${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_GCJ='$CC -b ${wl}+h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ ia64*)
+ archive_cmds_GCJ='$CC -b ${wl}+h ${wl}$soname ${wl}+nodefaultrpath -o $lib $libobjs $deplibs $compiler_flags'
+ ;;
+ *)
+ archive_cmds_GCJ='$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_GCJ='${wl}+b ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ case $host_cpu in
+ hppa*64*|ia64*)
+ hardcode_libdir_flag_spec_ld_GCJ='+b $libdir'
+ hardcode_direct_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ *)
+ hardcode_direct_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ # hardcode_minus_L: Not really in the search PATH,
+ # but as the default location of the library.
+ hardcode_minus_L_GCJ=yes
+ ;;
+ esac
+ fi
+ ;;
+ irix5* | irix6* | nonstopux*)
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ archive_cmds_GCJ='$LD -shared $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_ld_GCJ='-rpath $libdir'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ link_all_deplibs_GCJ=yes
+ ;;
+ netbsd*)
+ if echo __ELF__ | $CC -E - | grep __ELF__ >/dev/null; then
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags' # a.out
+ else
+ archive_cmds_GCJ='$LD -shared -o $lib $libobjs $deplibs $linker_flags' # ELF
+ fi
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ newsos6)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ openbsd*)
+ if test -f /usr/libexec/ld.so; then
+ hardcode_direct_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags ${wl}-retain-symbols-file,$export_symbols'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ export_dynamic_flag_spec_GCJ='${wl}-E'
+ else
+ case $host_os in
+ openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
+ archive_cmds_GCJ='$LD -Bshareable -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ ;;
+ *)
+ archive_cmds_GCJ='$CC -shared $pic_flag -o $lib $libobjs $deplibs $compiler_flags'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath,$libdir'
+ ;;
+ esac
+ fi
+ else
+ ld_shlibs_GCJ=no
+ fi
+ ;;
+ os2*)
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_minus_L_GCJ=yes
+ allow_undefined_flag_GCJ=unsupported
+ archive_cmds_GCJ='$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_GCJ='emximp -o $output_objdir/$libname.a $output_objdir/$libname.def'
+ ;;
+ osf3*)
+ if test "$GCC" = yes; then
+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ else
+ allow_undefined_flag_GCJ=' -expect_unresolved \*'
+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ fi
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ hardcode_libdir_separator_GCJ=:
+ ;;
+ osf4* | osf5*) # as osf3* with the addition of -msym flag
+ if test "$GCC" = yes; then
+ allow_undefined_flag_GCJ=' ${wl}-expect_unresolved ${wl}\*'
+ archive_cmds_GCJ='$CC -shared${allow_undefined_flag} $libobjs $deplibs $compiler_flags ${wl}-msym ${wl}-soname ${wl}$soname `test -n "$verstring" && echo ${wl}-set_version ${wl}$verstring` ${wl}-update_registry ${wl}${output_objdir}/so_locations -o $lib'
+ hardcode_libdir_flag_spec_GCJ='${wl}-rpath ${wl}$libdir'
+ else
+ allow_undefined_flag_GCJ=' -expect_unresolved \*'
+ archive_cmds_GCJ='$LD -shared${allow_undefined_flag} $libobjs $deplibs $linker_flags -msym -soname $soname `test -n "$verstring" && echo -set_version $verstring` -update_registry ${output_objdir}/so_locations -o $lib'
+ archive_expsym_cmds_GCJ='for i in `cat $export_symbols`; do printf "%s %s\\n" -exported_symbol "\$i" >> $lib.exp; done; echo "-hidden">> $lib.exp~
+ $LD -shared${allow_undefined_flag} -input $lib.exp $linker_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_GCJ='-rpath $libdir'
+ fi
+ hardcode_libdir_separator_GCJ=:
+ ;;
+ solaris*)
+ no_undefined_flag_GCJ=' -z text'
+ if test "$GCC" = yes; then
+ wlarc='${wl}'
+ archive_cmds_GCJ='$CC -shared ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$echo "{ global:" > $lib.exp~cat $export_symbols | $SED -e "s/\(.*\)/\1;/" >> $lib.exp~$echo "local: *; };" >> $lib.exp~
+ $CC -shared ${wl}-M ${wl}$lib.exp ${wl}-h ${wl}$soname -o $lib $libobjs $deplibs $compiler_flags~$rm $lib.exp'
+ else
+ wlarc=''
+ archive_cmds_GCJ='$LD -G${allow_undefined_flag} -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ archive_expsym_cmds_GCJ='$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'
+ fi
+ hardcode_libdir_flag_spec_GCJ='-R$libdir'
+ hardcode_shlibpath_var_GCJ=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_GCJ='${wl}-z ${wl}allextract$convenience ${wl}-z ${wl}defaultextract'
+ else
+ whole_archive_flag_spec_GCJ='-z allextract$convenience -z defaultextract'
+ fi
+ ;;
+ esac
+ link_all_deplibs_GCJ=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_GCJ='$CC -G ${wl}-h $soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$LD -assert pure-text -Bstatic -o $lib $libobjs $deplibs $linker_flags'
+ fi
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_direct_GCJ=yes
+ hardcode_minus_L_GCJ=yes
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ sysv4)
+ case $host_vendor in
+ sni)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=yes # is this really true???
+ ;;
+ siemens)
+ ## LD is ld it makes a PLAMLIB
+ ## CC just makes a GrossModule.
+ archive_cmds_GCJ='$LD -G -o $lib $libobjs $deplibs $linker_flags'
+ reload_cmds_GCJ='$CC -r -o $output$reload_objs'
+ hardcode_direct_GCJ=no
+ ;;
+ motorola)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_direct_GCJ=no #Motorola manual says yes, but my tests say they lie
+ ;;
+ esac
+ runpath_var='LD_RUN_PATH'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ sysv4.3*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_GCJ=no
+ export_dynamic_flag_spec_GCJ='-Bexport'
+ ;;
+ sysv4*MP*)
+ if test -d /usr/nec; then
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_shlibpath_var_GCJ=no
+ runpath_var=LD_RUN_PATH
+ hardcode_runpath_var=yes
+ ld_shlibs_GCJ=yes
+ fi
+ ;;
+ sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7* | sco3.2v5.0.[024]*)
+ no_undefined_flag_GCJ='${wl}-z,text'
+ archive_cmds_need_lc_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ runpath_var='LD_RUN_PATH'
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$CC -G ${wl}-h,$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$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_GCJ='${wl}-z,text'
+ allow_undefined_flag_GCJ='${wl}-z,nodefs'
+ archive_cmds_need_lc_GCJ=no
+ hardcode_shlibpath_var_GCJ=no
+ hardcode_libdir_flag_spec_GCJ='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
+ hardcode_libdir_separator_GCJ=':'
+ link_all_deplibs_GCJ=yes
+ export_dynamic_flag_spec_GCJ='${wl}-Bexport'
+ runpath_var='LD_RUN_PATH'
+ if test "$GCC" = yes; then
+ archive_cmds_GCJ='$CC -shared ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -shared ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ else
+ archive_cmds_GCJ='$CC -G ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ archive_expsym_cmds_GCJ='$CC -G ${wl}-Bexport:$export_symbols ${wl}-h,\${SCOABSPATH:+${install_libdir}/}$soname -o $lib $libobjs $deplibs $compiler_flags'
+ fi
+ ;;
+ uts4*)
+ archive_cmds_GCJ='$LD -G -h $soname -o $lib $libobjs $deplibs $linker_flags'
+ hardcode_libdir_flag_spec_GCJ='-L$libdir'
+ hardcode_shlibpath_var_GCJ=no
+ ;;
+ *)
+ ld_shlibs_GCJ=no
+ ;;
+ esac
+ fi
+{ echo "$as_me:$LINENO: result: $ld_shlibs_GCJ" >&5
+echo "${ECHO_T}$ld_shlibs_GCJ" >&6; }
+test "$ld_shlibs_GCJ" = no && can_build_shared=no
+#
+# Do we need to explicitly link libc?
+#
+case "x$archive_cmds_need_lc_GCJ" in
+x|xyes)
+ # Assume -lc should be added
+ archive_cmds_need_lc_GCJ=yes
+ if test "$enable_shared" = yes && test "$GCC" = yes; then
+ case $archive_cmds_GCJ 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.
+ { echo "$as_me:$LINENO: checking whether -lc should be explicitly linked in" >&5
+echo $ECHO_N "checking whether -lc should be explicitly linked in... $ECHO_C" >&6; }
+ $rm conftest*
+ echo "$lt_simple_compile_test_code" > conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking dynamic linker characteristics" >&5
-$as_echo_n "checking dynamic linker characteristics... " >&6; }
+ if { (eval echo "$as_me:$LINENO: \"$ac_compile\"") >&5
+ (eval $ac_compile) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } 2>conftest.err; then
+ soname=conftest
+ lib=conftest
+ libobjs=conftest.$ac_objext
+ deplibs=
+ wl=$lt_prog_compiler_wl_GCJ
+ pic_flag=$lt_prog_compiler_pic_GCJ
+ compiler_flags=-v
+ linker_flags=-v
+ verstring=
+ output_objdir=.
+ libname=conftest
+ lt_save_allow_undefined_flag=$allow_undefined_flag_GCJ
+ allow_undefined_flag_GCJ=
+ if { (eval echo "$as_me:$LINENO: \"$archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1\"") >&5
+ (eval $archive_cmds_GCJ 2\>\&1 \| grep \" -lc \" \>/dev/null 2\>\&1) 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+ then
+ archive_cmds_need_lc_GCJ=no
+ else
+ archive_cmds_need_lc_GCJ=yes
+ fi
+ allow_undefined_flag_GCJ=$lt_save_allow_undefined_flag
+ else
+ cat conftest.err 1>&5
+ fi
+ $rm conftest*
+ { echo "$as_me:$LINENO: result: $archive_cmds_need_lc_GCJ" >&5
+echo "${ECHO_T}$archive_cmds_need_lc_GCJ" >&6; }
+ ;;
+ esac
+ fi
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking dynamic linker characteristics" >&5
+echo $ECHO_N "checking dynamic linker characteristics... $ECHO_C" >&6; }
library_names_spec=
libname_spec='lib$name'
soname_spec=
@@ -21385,6 +23998,7 @@ 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
@@ -21394,7 +24008,7 @@ need_version=unknown
case $host_os in
aix3*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
library_names_spec='${libname}${release}${shared_ext}$versuffix $libname.a'
shlibpath_var=LIBPATH
@@ -21402,8 +24016,8 @@ aix3*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
-aix[4-9]*)
- version_type=linux # correct to gnu/linux during the next big refactor
+aix4* | aix5*)
+ version_type=linux
need_lib_prefix=no
need_version=no
hardcode_into_libs=yes
@@ -21421,7 +24035,7 @@ aix[4-9]*)
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
+ echo '#endif'; } | ${CC} -E - | grep yes > /dev/null; then
:
else
can_build_shared=no
@@ -21447,18 +24061,9 @@ aix[4-9]*)
;;
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
+ 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=`$echo "X$lib" | $Xsed -e '\''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'
;;
beos*)
@@ -21468,7 +24073,7 @@ beos*)
;;
bsdi[45]*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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'
@@ -21481,111 +24086,61 @@ bsdi[45]*)
# libtool to hard-code these into programs
;;
-cygwin* | mingw* | pw32* | cegcc*)
+cygwin* | mingw* | pw32*)
version_type=windows
shrext_cmds=".dll"
need_version=no
need_lib_prefix=no
- case $GCC,$cc_basename in
- yes,*)
- # gcc
+ case $GCC,$host_os in
+ yes,cygwin* | yes,mingw* | yes,pw32*)
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'\''`~
+ 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'
+ chmod a+x \$dldir/$dlname'
postuninstall_cmds='dldll=`$SHELL 2>&1 -c '\''. $file; echo \$dlname'\''`~
dlpath=$dir/\$dldll~
- $RM \$dlpath'
+ $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}'
-
+ sys_lib_search_path_spec="/usr/lib /lib/w32api /lib /usr/local/lib"
;;
- mingw* | cegcc*)
+ mingw*)
# MinGW DLLs use traditional 'lib' prefix
soname_spec='${libname}`echo ${release} | $SED -e 's/[.]/-/g'`${versuffix}${shared_ext}'
+ sys_lib_search_path_spec=`$CC -print-search-dirs | grep "^libraries:" | $SED -e "s/^libraries://" -e "s,=/,/,g"`
+ if echo "$sys_lib_search_path_spec" | grep ';[c-zC-Z]:/' >/dev/null; then
+ # It is most probably a Windows format PATH printed by
+ # mingw gcc, but we are running on Cygwin. Gcc prints its search
+ # path with ; separators, and with drive letters. We can handle the
+ # drive letters (cygwin fileutils understands them), so leave them,
+ # especially as we might pass files found there to a mingw objdump,
+ # which wouldn't understand a cygwinified path. Ahh.
+ 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
;;
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
+ dynamic_linker='Win32 ld.exe'
# FIXME: first we should search . and the directory the executable is in
shlibpath_var=PATH
;;
@@ -21595,7 +24150,7 @@ darwin* | rhapsody*)
version_type=darwin
need_lib_prefix=no
need_version=no
- library_names_spec='${libname}${release}${major}$shared_ext ${libname}$shared_ext'
+ library_names_spec='${libname}${release}${versuffix}$shared_ext ${libname}${release}${major}$shared_ext ${libname}$shared_ext'
soname_spec='${libname}${release}${major}$shared_ext'
shlibpath_overrides_runpath=yes
shlibpath_var=DYLD_LIBRARY_PATH
@@ -21605,7 +24160,7 @@ darwin* | rhapsody*)
;;
dgux*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname$shared_ext'
@@ -21613,6 +24168,10 @@ dgux*)
shlibpath_var=LD_LIBRARY_PATH
;;
+freebsd1*)
+ dynamic_linker=no
+ ;;
+
freebsd* | dragonfly*)
# DragonFly does not have aout. When/if they implement a new
# versioning mechanism, adjust this.
@@ -21620,7 +24179,7 @@ freebsd* | dragonfly*)
objformat=`/usr/bin/objformat`
else
case $host_os in
- freebsd[23].*) objformat=aout ;;
+ freebsd[123]*) objformat=aout ;;
*) objformat=elf ;;
esac
fi
@@ -21638,7 +24197,7 @@ freebsd* | dragonfly*)
esac
shlibpath_var=LD_LIBRARY_PATH
case $host_os in
- freebsd2.*)
+ freebsd2*)
shlibpath_overrides_runpath=yes
;;
freebsd3.[01]* | freebsdelf3.[01]*)
@@ -21658,26 +24217,12 @@ freebsd* | dragonfly*)
;;
gnu*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
;;
@@ -21703,18 +24248,18 @@ hpux9* | hpux10* | hpux11*)
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
- ;;
- *)
+ 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
@@ -21723,14 +24268,12 @@ hpux9* | hpux10* | hpux11*)
soname_spec='${libname}${release}${shared_ext}$major'
;;
esac
- # HP-UX runs *really* slowly unless shared libraries are mode 555, ...
+ # 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
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major ${libname}${shared_ext}'
@@ -21746,7 +24289,7 @@ irix5* | irix6* | nonstopux*)
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
+ version_type=linux
else
version_type=irix
fi ;;
@@ -21783,9 +24326,9 @@ 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
+# This must be Linux ELF.
+linux* | k*bsd*-gnu)
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -21793,41 +24336,6 @@ linux* | k*bsd*-gnu | kopensolaris*-gnu)
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_CXX\"; \
- LDFLAGS=\"\$LDFLAGS $hardcode_libdir_flag_spec_CXX\""
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
-int
-main ()
-{
-
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_cxx_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.
@@ -21835,7 +24343,7 @@ fi
# 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' ' '`
+ 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;/^$/d' | tr '\n' ' '`
sys_lib_dlsearch_path_spec="/lib /usr/lib $lt_ld_extra"
fi
@@ -21852,7 +24360,7 @@ netbsd*)
version_type=sunos
need_lib_prefix=no
need_version=no
- if echo __ELF__ | $CC -E - | $GREP __ELF__ >/dev/null; then
+ 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'
@@ -21867,22 +24375,20 @@ netbsd*)
;;
newsos6)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
+nto-qnx*)
+ version_type=linux
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'
+ shlibpath_overrides_runpath=yes
;;
openbsd*)
@@ -21891,13 +24397,13 @@ openbsd*)
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 ;;
+ 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
+ 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
@@ -21936,7 +24442,7 @@ rdos*)
;;
solaris*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
need_lib_prefix=no
need_version=no
library_names_spec='${libname}${release}${shared_ext}$versuffix ${libname}${release}${shared_ext}$major $libname${shared_ext}'
@@ -21961,7 +24467,7 @@ sunos4*)
;;
sysv4 | sysv4.3*)
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
@@ -21969,6 +24475,7 @@ sysv4 | sysv4.3*)
sni)
shlibpath_overrides_runpath=no
need_lib_prefix=no
+ export_dynamic_flag_spec='${wl}-Blargedynsym'
runpath_var=LD_RUN_PATH
;;
siemens)
@@ -21985,7 +24492,7 @@ sysv4 | sysv4.3*)
sysv4*MP*)
if test -d /usr/nec ;then
- version_type=linux # correct to gnu/linux during the next big refactor
+ version_type=linux
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
@@ -21999,12 +24506,13 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
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'
+ shlibpath_overrides_runpath=no
else
sys_lib_search_path_spec='/usr/ccs/lib /usr/lib'
+ shlibpath_overrides_runpath=yes
case $host_os in
sco3.2v5*)
sys_lib_search_path_spec="$sys_lib_search_path_spec /lib"
@@ -22014,19 +24522,8 @@ sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
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
+ version_type=linux
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
@@ -22036,8 +24533,8 @@ uts4*)
dynamic_linker=no
;;
esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $dynamic_linker" >&5
-$as_echo "$dynamic_linker" >&6; }
+{ echo "$as_me:$LINENO: result: $dynamic_linker" >&5
+echo "${ECHO_T}$dynamic_linker" >&6; }
test "$dynamic_linker" = no && can_build_shared=no
variables_saved_for_relink="PATH $shlibpath_var $runpath_var"
@@ -22045,107 +24542,933 @@ 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"
+{ echo "$as_me:$LINENO: checking how to hardcode library paths into programs" >&5
+echo $ECHO_N "checking how to hardcode library paths into programs... $ECHO_C" >&6; }
+hardcode_action_GCJ=
+if test -n "$hardcode_libdir_flag_spec_GCJ" || \
+ test -n "$runpath_var_GCJ" || \
+ test "X$hardcode_automatic_GCJ" = "Xyes" ; then
+
+ # We can hardcode non-existant directories.
+ if test "$hardcode_direct_GCJ" != 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_AC_TAGVAR(hardcode_shlibpath_var, GCJ)" != no &&
+ test "$hardcode_minus_L_GCJ" != no; then
+ # Linking always hardcodes the temporary library directory.
+ hardcode_action_GCJ=relink
+ else
+ # We can link without hardcoding, and we can hardcode nonexisting dirs.
+ hardcode_action_GCJ=immediate
+ fi
+else
+ # We cannot hardcode anything, or else we can only hardcode existing
+ # directories.
+ hardcode_action_GCJ=unsupported
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"
+{ echo "$as_me:$LINENO: result: $hardcode_action_GCJ" >&5
+echo "${ECHO_T}$hardcode_action_GCJ" >&6; }
+
+if test "$hardcode_action_GCJ" = relink; 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
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_GCJ \
+ CC_GCJ \
+ LD_GCJ \
+ lt_prog_compiler_wl_GCJ \
+ lt_prog_compiler_pic_GCJ \
+ lt_prog_compiler_static_GCJ \
+ lt_prog_compiler_no_builtin_flag_GCJ \
+ export_dynamic_flag_spec_GCJ \
+ thread_safe_flag_spec_GCJ \
+ whole_archive_flag_spec_GCJ \
+ enable_shared_with_static_runtimes_GCJ \
+ old_archive_cmds_GCJ \
+ old_archive_from_new_cmds_GCJ \
+ predep_objects_GCJ \
+ postdep_objects_GCJ \
+ predeps_GCJ \
+ postdeps_GCJ \
+ compiler_lib_search_path_GCJ \
+ archive_cmds_GCJ \
+ archive_expsym_cmds_GCJ \
+ postinstall_cmds_GCJ \
+ postuninstall_cmds_GCJ \
+ old_archive_from_expsyms_cmds_GCJ \
+ allow_undefined_flag_GCJ \
+ no_undefined_flag_GCJ \
+ export_symbols_cmds_GCJ \
+ hardcode_libdir_flag_spec_GCJ \
+ hardcode_libdir_flag_spec_ld_GCJ \
+ hardcode_libdir_separator_GCJ \
+ hardcode_automatic_GCJ \
+ module_cmds_GCJ \
+ module_expsym_cmds_GCJ \
+ lt_cv_prog_compiler_c_o_GCJ \
+ fix_srcfile_path_GCJ \
+ exclude_expsyms_GCJ \
+ include_expsyms_GCJ; do
+
+ case $var in
+ old_archive_cmds_GCJ | \
+ old_archive_from_new_cmds_GCJ | \
+ archive_cmds_GCJ | \
+ archive_expsym_cmds_GCJ | \
+ module_cmds_GCJ | \
+ module_expsym_cmds_GCJ | \
+ old_archive_from_expsyms_cmds_GCJ | \
+ export_symbols_cmds_GCJ | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+cfgfile="$ofile"
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_GCJ
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_GCJ
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+# A C compiler.
+LTCC=$lt_LTCC
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+# A language-specific compiler.
+CC=$lt_compiler_GCJ
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_GCJ
+# An ERE matcher.
+EGREP=$lt_EGREP
+# The linker used to build libraries.
+LD=$lt_LD_GCJ
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+# A BSD-compatible nm program.
+NM=$lt_NM
+# A symbol stripping program
+STRIP=$lt_STRIP
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+# Used on cygwin: assembler.
+AS="$AS"
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_GCJ
+# Object file suffix (normally "o").
+objext="$ac_objext"
+# Old archive suffix (normally "a").
+libext="$libext"
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+# Executable file suffix (normally "").
+exeext="$exeext"
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_GCJ
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_GCJ
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_GCJ
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_GCJ
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_GCJ
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_GCJ
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_GCJ
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_GCJ
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_GCJ
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_GCJ
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_GCJ
+archive_expsym_cmds=$lt_archive_expsym_cmds_GCJ
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_GCJ
+module_expsym_cmds=$lt_module_expsym_cmds_GCJ
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_GCJ
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_GCJ
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_GCJ
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_GCJ
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_GCJ
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_GCJ
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_GCJ
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# 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_GCJ
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_GCJ
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_GCJ
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_GCJ
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_GCJ
+
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_GCJ
+
+# 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_GCJ
+
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_GCJ
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_GCJ
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_GCJ
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_GCJ
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_GCJ
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+
+__EOF__
- { $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_CXX=
-if test -n "$hardcode_libdir_flag_spec_CXX" ||
- test -n "$runpath_var_CXX" ||
- test "X$hardcode_automatic_CXX" = "Xyes" ; then
- # We can hardcode non-existent directories.
- if test "$hardcode_direct_CXX" != 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, CXX)" != no &&
- test "$hardcode_minus_L_CXX" != no; then
- # Linking always hardcodes the temporary library directory.
- hardcode_action_CXX=relink
- else
- # We can link without hardcoding, and we can hardcode nonexisting dirs.
- hardcode_action_CXX=immediate
- fi
else
- # We cannot hardcode anything, or else we can only hardcode existing
- # directories.
- hardcode_action_CXX=unsupported
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $hardcode_action_CXX" >&5
-$as_echo "$hardcode_action_CXX" >&6; }
-if test "$hardcode_action_CXX" = relink ||
- test "$inherit_rpath_CXX" = 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
+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
+
+CC="$lt_save_CC"
+
+ else
+ tagname=""
+ fi
+ ;;
+
+ RC)
+
+
+# Source file extension for RC test sources.
+ac_ext=rc
+
+# Object file extension for compiled RC test sources.
+objext=o
+objext_RC=$objext
+
+# Code to be used in simple compile tests
+lt_simple_compile_test_code='sample MENU { MENUITEM "&Soup", 100, CHECKED }'
+
+# Code to be used in simple link tests
+lt_simple_link_test_code="$lt_simple_compile_test_code"
+
+# 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 conftest*
+
+
+# Allow CC to be a program name with arguments.
+lt_save_CC="$CC"
+CC=${RC-"windres"}
+compiler=$CC
+compiler_RC=$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 "X$cc_temp" | $Xsed -e 's%.*/%%' -e "s%^$host_alias-%%"`
+
+lt_cv_prog_compiler_c_o_RC=yes
+
+# The else clause should only fire when bootstrapping the
+# libtool distribution, otherwise you forgot to ship ltmain.sh
+# with your package, and you will get complaints that there are
+# no rules to generate ltmain.sh.
+if test -f "$ltmain"; then
+ # See if we are running on zsh, and set the options which allow our commands through
+ # without removal of \ escapes.
+ if test -n "${ZSH_VERSION+set}" ; then
+ setopt NO_GLOB_SUBST
+ fi
+ # Now quote all the things that may contain metacharacters while being
+ # careful not to overquote the AC_SUBSTed values. We take copies of the
+ # variables and quote the copies for generation of the libtool script.
+ for var in echo old_CC old_CFLAGS AR AR_FLAGS EGREP RANLIB LN_S LTCC LTCFLAGS NM \
+ SED SHELL STRIP \
+ libname_spec library_names_spec soname_spec extract_expsyms_cmds \
+ old_striplib striplib file_magic_cmd finish_cmds finish_eval \
+ deplibs_check_method reload_flag reload_cmds need_locks \
+ lt_cv_sys_global_symbol_pipe lt_cv_sys_global_symbol_to_cdecl \
+ lt_cv_sys_global_symbol_to_c_name_address \
+ sys_lib_search_path_spec sys_lib_dlsearch_path_spec \
+ old_postinstall_cmds old_postuninstall_cmds \
+ compiler_RC \
+ CC_RC \
+ LD_RC \
+ lt_prog_compiler_wl_RC \
+ lt_prog_compiler_pic_RC \
+ lt_prog_compiler_static_RC \
+ lt_prog_compiler_no_builtin_flag_RC \
+ export_dynamic_flag_spec_RC \
+ thread_safe_flag_spec_RC \
+ whole_archive_flag_spec_RC \
+ enable_shared_with_static_runtimes_RC \
+ old_archive_cmds_RC \
+ old_archive_from_new_cmds_RC \
+ predep_objects_RC \
+ postdep_objects_RC \
+ predeps_RC \
+ postdeps_RC \
+ compiler_lib_search_path_RC \
+ archive_cmds_RC \
+ archive_expsym_cmds_RC \
+ postinstall_cmds_RC \
+ postuninstall_cmds_RC \
+ old_archive_from_expsyms_cmds_RC \
+ allow_undefined_flag_RC \
+ no_undefined_flag_RC \
+ export_symbols_cmds_RC \
+ hardcode_libdir_flag_spec_RC \
+ hardcode_libdir_flag_spec_ld_RC \
+ hardcode_libdir_separator_RC \
+ hardcode_automatic_RC \
+ module_cmds_RC \
+ module_expsym_cmds_RC \
+ lt_cv_prog_compiler_c_o_RC \
+ fix_srcfile_path_RC \
+ exclude_expsyms_RC \
+ include_expsyms_RC; do
+
+ case $var in
+ old_archive_cmds_RC | \
+ old_archive_from_new_cmds_RC | \
+ archive_cmds_RC | \
+ archive_expsym_cmds_RC | \
+ module_cmds_RC | \
+ module_expsym_cmds_RC | \
+ old_archive_from_expsyms_cmds_RC | \
+ export_symbols_cmds_RC | \
+ extract_expsyms_cmds | reload_cmds | finish_cmds | \
+ postinstall_cmds | postuninstall_cmds | \
+ old_postinstall_cmds | old_postuninstall_cmds | \
+ sys_lib_search_path_spec | sys_lib_dlsearch_path_spec)
+ # Double-quote double-evaled strings.
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$double_quote_subst\" -e \"\$sed_quote_subst\" -e \"\$delay_variable_subst\"\`\\\""
+ ;;
+ *)
+ eval "lt_$var=\\\"\`\$echo \"X\$$var\" | \$Xsed -e \"\$sed_quote_subst\"\`\\\""
+ ;;
+ esac
+ done
+
+ case $lt_echo in
+ *'\$0 --fallback-echo"')
+ lt_echo=`$echo "X$lt_echo" | $Xsed -e 's/\\\\\\\$0 --fallback-echo"$/$0 --fallback-echo"/'`
+ ;;
+ esac
+
+cfgfile="$ofile"
+
+ cat <<__EOF__ >> "$cfgfile"
+# ### BEGIN LIBTOOL TAG CONFIG: $tagname
+
+# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
+
+# Shell to use when invoking shell scripts.
+SHELL=$lt_SHELL
+
+# Whether or not to build shared libraries.
+build_libtool_libs=$enable_shared
+
+# Whether or not to build static libraries.
+build_old_libs=$enable_static
+
+# Whether or not to add -lc for building shared libraries.
+build_libtool_need_lc=$archive_cmds_need_lc_RC
+
+# Whether or not to disallow shared libs when runtime libs are static
+allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_RC
+
+# Whether or not to optimize for fast installation.
+fast_install=$enable_fast_install
+
+# The host system.
+host_alias=$host_alias
+host=$host
+host_os=$host_os
+
+# The build system.
+build_alias=$build_alias
+build=$build
+build_os=$build_os
+
+# An echo program that does not interpret backslashes.
+echo=$lt_echo
+
+# The archiver.
+AR=$lt_AR
+AR_FLAGS=$lt_AR_FLAGS
+
+# A C compiler.
+LTCC=$lt_LTCC
+
+# LTCC compiler flags.
+LTCFLAGS=$lt_LTCFLAGS
+
+# A language-specific compiler.
+CC=$lt_compiler_RC
+
+# Is the compiler the GNU C compiler?
+with_gcc=$GCC_RC
+
+# An ERE matcher.
+EGREP=$lt_EGREP
+
+# The linker used to build libraries.
+LD=$lt_LD_RC
+
+# Whether we need hard or soft links.
+LN_S=$lt_LN_S
+
+# A BSD-compatible nm program.
+NM=$lt_NM
+
+# A symbol stripping program
+STRIP=$lt_STRIP
+
+# Used to examine libraries when file_magic_cmd begins "file"
+MAGIC_CMD=$MAGIC_CMD
+
+# Used on cygwin: DLL creation program.
+DLLTOOL="$DLLTOOL"
+
+# Used on cygwin: object dumper.
+OBJDUMP="$OBJDUMP"
+
+# Used on cygwin: assembler.
+AS="$AS"
+
+# The name of the directory that contains temporary libtool files.
+objdir=$objdir
+
+# How to create reloadable object files.
+reload_flag=$lt_reload_flag
+reload_cmds=$lt_reload_cmds
+
+# How to pass a linker flag through the compiler.
+wl=$lt_lt_prog_compiler_wl_RC
+
+# Object file suffix (normally "o").
+objext="$ac_objext"
+
+# Old archive suffix (normally "a").
+libext="$libext"
+
+# Shared library suffix (normally ".so").
+shrext_cmds='$shrext_cmds'
+
+# Executable file suffix (normally "").
+exeext="$exeext"
+
+# Additional compiler flags for building library objects.
+pic_flag=$lt_lt_prog_compiler_pic_RC
+pic_mode=$pic_mode
+
+# What is the maximum length of a command?
+max_cmd_len=$lt_cv_sys_max_cmd_len
+
+# Does compiler simultaneously support -c and -o options?
+compiler_c_o=$lt_lt_cv_prog_compiler_c_o_RC
+
+# Must we lock files when doing compilation?
+need_locks=$lt_need_locks
+
+# Do we need the lib prefix for modules?
+need_lib_prefix=$need_lib_prefix
+
+# Do we need a version for libraries?
+need_version=$need_version
+
+# Whether dlopen is supported.
+dlopen_support=$enable_dlopen
+
+# Whether dlopen of programs is supported.
+dlopen_self=$enable_dlopen_self
+
+# Whether dlopen of statically linked programs is supported.
+dlopen_self_static=$enable_dlopen_self_static
+
+# Compiler flag to prevent dynamic linking.
+link_static_flag=$lt_lt_prog_compiler_static_RC
+
+# Compiler flag to turn off builtin functions.
+no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_RC
+
+# Compiler flag to allow reflexive dlopens.
+export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_RC
+
+# Compiler flag to generate shared objects directly from archives.
+whole_archive_flag_spec=$lt_whole_archive_flag_spec_RC
+
+# Compiler flag to generate thread-safe objects.
+thread_safe_flag_spec=$lt_thread_safe_flag_spec_RC
+
+# Library versioning type.
+version_type=$version_type
+
+# Format of library name prefix.
+libname_spec=$lt_libname_spec
+
+# List of archive names. First name is the real one, the rest are links.
+# The last name is the one that the linker finds with -lNAME.
+library_names_spec=$lt_library_names_spec
+
+# The coded name of the library, if different from the real name.
+soname_spec=$lt_soname_spec
+
+# Commands used to build and install an old-style archive.
+RANLIB=$lt_RANLIB
+old_archive_cmds=$lt_old_archive_cmds_RC
+old_postinstall_cmds=$lt_old_postinstall_cmds
+old_postuninstall_cmds=$lt_old_postuninstall_cmds
+
+# Create an old-style archive from a shared archive.
+old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_RC
+
+# Create a temporary old-style archive to link instead of a shared archive.
+old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_RC
+
+# Commands used to build and install a shared archive.
+archive_cmds=$lt_archive_cmds_RC
+archive_expsym_cmds=$lt_archive_expsym_cmds_RC
+postinstall_cmds=$lt_postinstall_cmds
+postuninstall_cmds=$lt_postuninstall_cmds
+
+# Commands used to build a loadable module (assumed same as above if empty)
+module_cmds=$lt_module_cmds_RC
+module_expsym_cmds=$lt_module_expsym_cmds_RC
+
+# Commands to strip libraries.
+old_striplib=$lt_old_striplib
+striplib=$lt_striplib
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predep_objects=$lt_predep_objects_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdep_objects=$lt_postdep_objects_RC
+
+# Dependencies to place before the objects being linked to create a
+# shared library.
+predeps=$lt_predeps_RC
+
+# Dependencies to place after the objects being linked to create a
+# shared library.
+postdeps=$lt_postdeps_RC
+
+# The library search path used internally by the compiler when linking
+# a shared library.
+compiler_lib_search_path=$lt_compiler_lib_search_path_RC
+
+# Method to check whether dependent libraries are shared objects.
+deplibs_check_method=$lt_deplibs_check_method
+
+# Command to use when deplibs_check_method == file_magic.
+file_magic_cmd=$lt_file_magic_cmd
+
+# Flag that allows shared libraries with undefined symbols to be built.
+allow_undefined_flag=$lt_allow_undefined_flag_RC
+
+# Flag that forces no undefined symbols.
+no_undefined_flag=$lt_no_undefined_flag_RC
+
+# Commands used to finish a libtool library installation in a directory.
+finish_cmds=$lt_finish_cmds
+
+# Same as above, but a single script fragment to be evaled but not shown.
+finish_eval=$lt_finish_eval
+
+# Take the output of nm and produce a listing of raw symbols and C names.
+global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
+
+# Transform the output of nm in a proper C declaration
+global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
+
+# Transform the output of nm in a C name address pair
+global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
+
+# This is the shared library runtime path variable.
+runpath_var=$runpath_var
+
+# This is the shared library path variable.
+shlibpath_var=$shlibpath_var
+
+# Is shlibpath searched before the hard-coded library search path?
+shlibpath_overrides_runpath=$shlibpath_overrides_runpath
+
+# How to hardcode a shared library path into an executable.
+hardcode_action=$hardcode_action_RC
+
+# Whether we should hardcode library paths into libraries.
+hardcode_into_libs=$hardcode_into_libs
+
+# 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_RC
+
+# If ld is used when linking, flag to hardcode \$libdir into
+# a binary during linking. This must work even if \$libdir does
+# not exist.
+hardcode_libdir_flag_spec_ld=$lt_hardcode_libdir_flag_spec_ld_RC
+
+# Whether we need a single -rpath flag with a separated argument.
+hardcode_libdir_separator=$lt_hardcode_libdir_separator_RC
+
+# Set to yes if using DIR/libNAME${shared_ext} during linking hardcodes DIR into the
+# resulting binary.
+hardcode_direct=$hardcode_direct_RC
+
+# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
+# resulting binary.
+hardcode_minus_L=$hardcode_minus_L_RC
+# Set to yes if using SHLIBPATH_VAR=DIR during linking hardcodes DIR into
+# the resulting binary.
+hardcode_shlibpath_var=$hardcode_shlibpath_var_RC
+# 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_RC
+# Variables whose values should be saved in libtool wrapper scripts and
+# restored at relink time.
+variables_saved_for_relink="$variables_saved_for_relink"
+
+# Whether libtool must link a program against all its dependency libraries.
+link_all_deplibs=$link_all_deplibs_RC
+
+# Compile-time system search path for libraries
+sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
+
+# Run-time system search path for libraries
+sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
+
+# Fix the shell variable \$srcfile for the compiler.
+fix_srcfile_path=$lt_fix_srcfile_path
+
+# Set to yes if exported symbols are required.
+always_export_symbols=$always_export_symbols_RC
+
+# The commands to list exported symbols.
+export_symbols_cmds=$lt_export_symbols_cmds_RC
+
+# The commands to extract the exported symbol list from a shared archive.
+extract_expsyms_cmds=$lt_extract_expsyms_cmds
+# Symbols that should not be listed in the preloaded symbols.
+exclude_expsyms=$lt_exclude_expsyms_RC
+
+# Symbols that must always be exported.
+include_expsyms=$lt_include_expsyms_RC
+
+# ### END LIBTOOL TAG CONFIG: $tagname
+__EOF__
- fi # test -n "$compiler"
- CC=$lt_save_CC
- CFLAGS=$lt_save_CFLAGS
- LDCXX=$LD
- LD=$lt_save_LD
- GCC=$lt_save_GCC
- with_gnu_ld=$lt_save_with_gnu_ld
- lt_cv_path_LDCXX=$lt_cv_path_LD
- lt_cv_path_LD=$lt_save_path_LD
- lt_cv_prog_gnu_ldcxx=$lt_cv_prog_gnu_ld
- lt_cv_prog_gnu_ld=$lt_save_with_gnu_ld
-fi # test "$_lt_caught_CXX_error" != yes
+else
+ # If there is no Makefile yet, we rely on a make rule to execute
+ # `config.status --recheck' to rerun these tests and create the
+ # libtool script then.
+ ltmain_in=`echo $ltmain | sed -e 's/\.sh$/.in/'`
+ if test -f "$ltmain_in"; then
+ test -f Makefile && make "$ltmain"
+ fi
+fi
+
ac_ext=c
ac_cpp='$CPP $CPPFLAGS'
@@ -22153,6 +25476,46 @@ 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
+CC="$lt_save_CC"
+
+ ;;
+
+ *)
+ { { echo "$as_me:$LINENO: error: Unsupported tag name: $tagname" >&5
+echo "$as_me: error: Unsupported tag name: $tagname" >&2;}
+ { (exit 1); exit 1; }; }
+ ;;
+ esac
+
+ # Append the new tag name to the list of available tags.
+ if test -n "$tagname" ; then
+ available_tags="$available_tags $tagname"
+ fi
+ fi
+ done
+ IFS="$lt_save_ifs"
+
+ # Now substitute the updated list of available tags.
+ if eval "sed -e 's/^available_tags=.*\$/available_tags=\"$available_tags\"/' \"$ofile\" > \"${ofile}T\""; then
+ mv "${ofile}T" "$ofile"
+ chmod +x "$ofile"
+ else
+ rm -f "${ofile}T"
+ { { echo "$as_me:$LINENO: error: unable to update list of available tagged configurations." >&5
+echo "$as_me: error: unable to update list of available tagged configurations." >&2;}
+ { (exit 1); exit 1; }; }
+ fi
+fi
+
+
+
+# This can be used to rebuild libtool when needed
+LIBTOOL_DEPS="$ac_aux_dir/ltmain.sh"
+
+# Always use our own libtool.
+LIBTOOL='$(SHELL) $(top_builddir)/libtool'
+
+# Prevent multiple expansion
@@ -22167,12 +25530,10 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
- ac_config_commands="$ac_config_commands libtool"
-# Only expand once:
@@ -22183,12 +25544,16 @@ ac_compiler_gnu=$ac_cv_c_compiler_gnu
if test "$enable_shared" = yes && test "$enable_static" = yes; then
case $library_names_spec in
*libname.a*)
- as_fn_error $? "cannot create both shared and static libraries on this system, --disable one of the two" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot create both shared and static libraries on this system, --disable one of the two" >&5
+echo "$as_me: error: cannot create both shared and static libraries on this system, --disable one of the two" >&2;}
+ { (exit 1); exit 1; }; }
;;
esac
fi
- if test "$enable_static" = yes; then
+
+
+if test "$enable_static" = yes; then
ENABLE_STATIC_TRUE=
ENABLE_STATIC_FALSE='#'
else
@@ -22201,12 +25566,16 @@ fi
# Many of these library and header checks are for the benefit of
# supplementary programs. libgmp doesn't use anything too weird.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for ANSI C header files" >&5
-$as_echo_n "checking for ANSI C header files... " >&6; }
-if ${ac_cv_header_stdc+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for ANSI C header files" >&5
+echo $ECHO_N "checking for ANSI C header files... $ECHO_C" >&6; }
+if test "${ac_cv_header_stdc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
#include <stdarg.h>
@@ -22221,23 +25590,47 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_header_stdc=yes
else
- ac_cv_header_stdc=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_stdc=no
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
if test $ac_cv_header_stdc = yes; then
# SunOS 4.x string.h does not declare mem*, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <string.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "memchr" >/dev/null 2>&1; then :
-
+ $EGREP "memchr" >/dev/null 2>&1; then
+ :
else
ac_cv_header_stdc=no
fi
@@ -22247,14 +25640,18 @@ fi
if test $ac_cv_header_stdc = yes; then
# ISC 2.0.2 stdlib.h does not declare free, contrary to ANSI.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdlib.h>
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "free" >/dev/null 2>&1; then :
-
+ $EGREP "free" >/dev/null 2>&1; then
+ :
else
ac_cv_header_stdc=no
fi
@@ -22264,10 +25661,14 @@ fi
if test $ac_cv_header_stdc = yes; then
# /bin/cc in Irix-4.0.5 gets non-ANSI ctype macros unless using -ansi.
- if test "$cross_compiling" = yes; then :
+ if test "$cross_compiling" = yes; then
:
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <ctype.h>
#include <stdlib.h>
@@ -22294,31 +25695,61 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
-
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ :
else
- ac_cv_header_stdc=no
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_header_stdc=no
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_stdc" >&5
-$as_echo "$ac_cv_header_stdc" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_stdc" >&5
+echo "${ECHO_T}$ac_cv_header_stdc" >&6; }
if test $ac_cv_header_stdc = yes; then
-$as_echo "#define STDC_HEADERS 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define STDC_HEADERS 1
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether time.h and sys/time.h may both be included" >&5
-$as_echo_n "checking whether time.h and sys/time.h may both be included... " >&6; }
-if ${ac_cv_header_time+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether time.h and sys/time.h may both be included" >&5
+echo $ECHO_N "checking whether time.h and sys/time.h may both be included... $ECHO_C" >&6; }
+if test "${ac_cv_header_time+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <sys/time.h>
@@ -22333,18 +25764,40 @@ return 0;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_header_time=yes
else
- ac_cv_header_time=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_header_time=no
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_header_time" >&5
-$as_echo "$ac_cv_header_time" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_header_time" >&5
+echo "${ECHO_T}$ac_cv_header_time" >&6; }
if test $ac_cv_header_time = yes; then
-$as_echo "#define TIME_WITH_SYS_TIME 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define TIME_WITH_SYS_TIME 1
+_ACEOF
fi
@@ -22374,13 +25827,161 @@ fi
# inttypes.h, stdint.h, unistd.h and sys/types.h are already in the autoconf
# default tests
#
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
for ac_header in fcntl.h float.h invent.h langinfo.h locale.h nl_types.h sys/attributes.h sys/iograph.h sys/mman.h sys/param.h sys/processor.h sys/pstat.h sys/sysinfo.h sys/syssgi.h sys/systemcfg.h sys/time.h sys/times.h
-do :
- as_ac_Header=`$as_echo "ac_cv_header_$ac_header" | $as_tr_sh`
-ac_fn_c_check_header_mongrel "$LINENO" "$ac_header" "$as_ac_Header" "$ac_includes_default"
-if eval test \"x\$"$as_ac_Header"\" = x"yes"; then :
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ---------------------------------- ##
+## Report this to gmp-bugs@gmplib.org ##
+## ---------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_header" | $as_tr_cpp` 1
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
@@ -22389,9 +25990,22 @@ done
# On SunOS, sys/resource.h needs sys/time.h (for struct timeval)
+
for ac_header in sys/resource.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "sys/resource.h" "ac_cv_header_sys_resource_h" "#if TIME_WITH_SYS_TIME
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if TIME_WITH_SYS_TIME
# include <sys/time.h>
# include <time.h>
#else
@@ -22401,10 +26015,42 @@ do :
# include <time.h>
# endif
#endif
-"
-if test "x$ac_cv_header_sys_resource_h" = xyes; then :
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_RESOURCE_H 1
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
@@ -22413,15 +26059,60 @@ done
# On NetBSD and OpenBSD, sys/sysctl.h needs sys/param.h for various constants
+
for ac_header in sys/sysctl.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "sys/sysctl.h" "ac_cv_header_sys_sysctl_h" "#if HAVE_SYS_PARAM_H
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_SYS_PARAM_H
# include <sys/param.h>
#endif
-"
-if test "x$ac_cv_header_sys_sysctl_h" = xyes; then :
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_SYS_SYSCTL_H 1
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
@@ -22430,15 +26121,60 @@ done
# On OSF 4.0, <machine/hal_sysinfo.h> must have <sys/sysinfo.h> for ulong_t
+
for ac_header in machine/hal_sysinfo.h
-do :
- ac_fn_c_check_header_compile "$LINENO" "machine/hal_sysinfo.h" "ac_cv_header_machine_hal_sysinfo_h" "#if HAVE_SYS_SYSINFO_H
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#if HAVE_SYS_SYSINFO_H
# include <sys/sysinfo.h>
#endif
-"
-if test "x$ac_cv_header_machine_hal_sysinfo_h" = xyes; then :
+
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ eval "$as_ac_Header=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_Header=no"
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_MACHINE_HAL_SYSINFO_H 1
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
@@ -22457,89 +26193,487 @@ done
# sys_errlist and sys_nerr are supposed to be in <errno.h> on SunOS according
# to the man page (but aren't), in glibc they're in stdio.h.
#
-ac_fn_c_check_decl "$LINENO" "fgetc" "ac_cv_have_decl_fgetc" "$ac_includes_default"
-if test "x$ac_cv_have_decl_fgetc" = xyes; then :
- ac_have_decl=1
+{ echo "$as_me:$LINENO: checking whether fgetc is declared" >&5
+echo $ECHO_N "checking whether fgetc is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_fgetc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef fgetc
+ (void) fgetc;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_fgetc=yes
else
- ac_have_decl=0
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_fgetc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fgetc" >&5
+echo "${ECHO_T}$ac_cv_have_decl_fgetc" >&6; }
+if test $ac_cv_have_decl_fgetc = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_FGETC $ac_have_decl
+#define HAVE_DECL_FGETC 1
_ACEOF
-ac_fn_c_check_decl "$LINENO" "fscanf" "ac_cv_have_decl_fscanf" "$ac_includes_default"
-if test "x$ac_cv_have_decl_fscanf" = xyes; then :
- ac_have_decl=1
+
+
else
- ac_have_decl=0
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FGETC 0
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking whether fscanf is declared" >&5
+echo $ECHO_N "checking whether fscanf is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_fscanf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef fscanf
+ (void) fscanf;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_fscanf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_fscanf=no
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_fscanf" >&5
+echo "${ECHO_T}$ac_cv_have_decl_fscanf" >&6; }
+if test $ac_cv_have_decl_fscanf = yes; then
+
cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_FSCANF $ac_have_decl
+#define HAVE_DECL_FSCANF 1
_ACEOF
-ac_fn_c_check_decl "$LINENO" "optarg" "ac_cv_have_decl_optarg" "$ac_includes_default"
-if test "x$ac_cv_have_decl_optarg" = xyes; then :
- ac_have_decl=1
+
+
else
- ac_have_decl=0
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_FSCANF 0
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking whether optarg is declared" >&5
+echo $ECHO_N "checking whether optarg is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_optarg+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef optarg
+ (void) optarg;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_optarg=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_optarg=no
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_optarg" >&5
+echo "${ECHO_T}$ac_cv_have_decl_optarg" >&6; }
+if test $ac_cv_have_decl_optarg = yes; then
+
cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_OPTARG $ac_have_decl
+#define HAVE_DECL_OPTARG 1
_ACEOF
-ac_fn_c_check_decl "$LINENO" "ungetc" "ac_cv_have_decl_ungetc" "$ac_includes_default"
-if test "x$ac_cv_have_decl_ungetc" = xyes; then :
- ac_have_decl=1
+
+
else
- ac_have_decl=0
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_OPTARG 0
+_ACEOF
+
+
fi
+{ echo "$as_me:$LINENO: checking whether ungetc is declared" >&5
+echo $ECHO_N "checking whether ungetc is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_ungetc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef ungetc
+ (void) ungetc;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_ungetc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_ungetc=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_ungetc" >&5
+echo "${ECHO_T}$ac_cv_have_decl_ungetc" >&6; }
+if test $ac_cv_have_decl_ungetc = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_UNGETC $ac_have_decl
+#define HAVE_DECL_UNGETC 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_UNGETC 0
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking whether vfprintf is declared" >&5
+echo $ECHO_N "checking whether vfprintf is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_vfprintf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+int
+main ()
+{
+#ifndef vfprintf
+ (void) vfprintf;
+#endif
+
+ ;
+ return 0;
+}
_ACEOF
-ac_fn_c_check_decl "$LINENO" "vfprintf" "ac_cv_have_decl_vfprintf" "$ac_includes_default"
-if test "x$ac_cv_have_decl_vfprintf" = xyes; then :
- ac_have_decl=1
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_vfprintf=yes
else
- ac_have_decl=0
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_vfprintf=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_vfprintf" >&5
+echo "${ECHO_T}$ac_cv_have_decl_vfprintf" >&6; }
+if test $ac_cv_have_decl_vfprintf = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_VFPRINTF $ac_have_decl
+#define HAVE_DECL_VFPRINTF 1
+_ACEOF
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_VFPRINTF 0
_ACEOF
-ac_fn_c_check_decl "$LINENO" "sys_errlist" "ac_cv_have_decl_sys_errlist" "#include <stdio.h>
+
+fi
+
+
+{ echo "$as_me:$LINENO: checking whether sys_errlist is declared" >&5
+echo $ECHO_N "checking whether sys_errlist is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_sys_errlist+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdio.h>
#include <errno.h>
-"
-if test "x$ac_cv_have_decl_sys_errlist" = xyes; then :
- ac_have_decl=1
+
+int
+main ()
+{
+#ifndef sys_errlist
+ (void) sys_errlist;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_sys_errlist=yes
else
- ac_have_decl=0
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_sys_errlist=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_errlist" >&5
+echo "${ECHO_T}$ac_cv_have_decl_sys_errlist" >&6; }
+if test $ac_cv_have_decl_sys_errlist = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_SYS_ERRLIST $ac_have_decl
+#define HAVE_DECL_SYS_ERRLIST 1
_ACEOF
-ac_fn_c_check_decl "$LINENO" "sys_nerr" "ac_cv_have_decl_sys_nerr" "#include <stdio.h>
+
+
+else
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYS_ERRLIST 0
+_ACEOF
+
+
+fi
+{ echo "$as_me:$LINENO: checking whether sys_nerr is declared" >&5
+echo $ECHO_N "checking whether sys_nerr is declared... $ECHO_C" >&6; }
+if test "${ac_cv_have_decl_sys_nerr+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <stdio.h>
#include <errno.h>
-"
-if test "x$ac_cv_have_decl_sys_nerr" = xyes; then :
- ac_have_decl=1
+
+int
+main ()
+{
+#ifndef sys_nerr
+ (void) sys_nerr;
+#endif
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_have_decl_sys_nerr=yes
else
- ac_have_decl=0
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_have_decl_sys_nerr=no
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_have_decl_sys_nerr" >&5
+echo "${ECHO_T}$ac_cv_have_decl_sys_nerr" >&6; }
+if test $ac_cv_have_decl_sys_nerr = yes; then
+
cat >>confdefs.h <<_ACEOF
-#define HAVE_DECL_SYS_NERR $ac_have_decl
+#define HAVE_DECL_SYS_NERR 1
_ACEOF
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking return type of signal handlers" >&5
-$as_echo_n "checking return type of signal handlers... " >&6; }
-if ${ac_cv_type_signal+:} false; then :
- $as_echo_n "(cached) " >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >>confdefs.h <<_ACEOF
+#define HAVE_DECL_SYS_NERR 0
+_ACEOF
+
+
+fi
+
+
+
+{ echo "$as_me:$LINENO: checking return type of signal handlers" >&5
+echo $ECHO_N "checking return type of signal handlers... $ECHO_C" >&6; }
+if test "${ac_cv_type_signal+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
#include <signal.h>
@@ -22552,15 +26686,35 @@ return *(signal (0, 0)) (0) == 1;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_type_signal=int
else
- ac_cv_type_signal=void
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_signal=void
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_type_signal" >&5
-$as_echo "$ac_cv_type_signal" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_type_signal" >&5
+echo "${ECHO_T}$ac_cv_type_signal" >&6; }
cat >>confdefs.h <<_ACEOF
#define RETSIGTYPE $ac_cv_type_signal
@@ -22578,8 +26732,60 @@ _ACEOF
#
# the default includes are sufficient for all these types
#
-ac_fn_c_check_type "$LINENO" "intmax_t" "ac_cv_type_intmax_t" "$ac_includes_default"
-if test "x$ac_cv_type_intmax_t" = xyes; then :
+{ echo "$as_me:$LINENO: checking for intmax_t" >&5
+echo $ECHO_N "checking for intmax_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_intmax_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef intmax_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_intmax_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_intmax_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_intmax_t" >&5
+echo "${ECHO_T}$ac_cv_type_intmax_t" >&6; }
+if test $ac_cv_type_intmax_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_INTMAX_T 1
@@ -22587,8 +26793,60 @@ _ACEOF
fi
-ac_fn_c_check_type "$LINENO" "long double" "ac_cv_type_long_double" "$ac_includes_default"
-if test "x$ac_cv_type_long_double" = xyes; then :
+{ echo "$as_me:$LINENO: checking for long double" >&5
+echo $ECHO_N "checking for long double... $ECHO_C" >&6; }
+if test "${ac_cv_type_long_double+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef long double ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_long_double=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_long_double=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_double" >&5
+echo "${ECHO_T}$ac_cv_type_long_double" >&6; }
+if test $ac_cv_type_long_double = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LONG_DOUBLE 1
@@ -22596,8 +26854,60 @@ _ACEOF
fi
-ac_fn_c_check_type "$LINENO" "long long" "ac_cv_type_long_long" "$ac_includes_default"
-if test "x$ac_cv_type_long_long" = xyes; then :
+{ echo "$as_me:$LINENO: checking for long long" >&5
+echo $ECHO_N "checking for long long... $ECHO_C" >&6; }
+if test "${ac_cv_type_long_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef long long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_long_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_long_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_long_long" >&5
+echo "${ECHO_T}$ac_cv_type_long_long" >&6; }
+if test $ac_cv_type_long_long = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_LONG_LONG 1
@@ -22605,8 +26915,60 @@ _ACEOF
fi
-ac_fn_c_check_type "$LINENO" "ptrdiff_t" "ac_cv_type_ptrdiff_t" "$ac_includes_default"
-if test "x$ac_cv_type_ptrdiff_t" = xyes; then :
+{ echo "$as_me:$LINENO: checking for ptrdiff_t" >&5
+echo $ECHO_N "checking for ptrdiff_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_ptrdiff_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef ptrdiff_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_ptrdiff_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_ptrdiff_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_ptrdiff_t" >&5
+echo "${ECHO_T}$ac_cv_type_ptrdiff_t" >&6; }
+if test $ac_cv_type_ptrdiff_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_PTRDIFF_T 1
@@ -22614,8 +26976,60 @@ _ACEOF
fi
-ac_fn_c_check_type "$LINENO" "quad_t" "ac_cv_type_quad_t" "$ac_includes_default"
-if test "x$ac_cv_type_quad_t" = xyes; then :
+{ echo "$as_me:$LINENO: checking for quad_t" >&5
+echo $ECHO_N "checking for quad_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_quad_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef quad_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_quad_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_quad_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_quad_t" >&5
+echo "${ECHO_T}$ac_cv_type_quad_t" >&6; }
+if test $ac_cv_type_quad_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_QUAD_T 1
@@ -22623,39 +27037,86 @@ _ACEOF
fi
-ac_fn_c_check_type "$LINENO" "uint_least32_t" "ac_cv_type_uint_least32_t" "$ac_includes_default"
-if test "x$ac_cv_type_uint_least32_t" = xyes; then :
-
-cat >>confdefs.h <<_ACEOF
-#define HAVE_UINT_LEAST32_T 1
+{ echo "$as_me:$LINENO: checking for uint_least32_t" >&5
+echo $ECHO_N "checking for uint_least32_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_uint_least32_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef uint_least32_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_uint_least32_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_cv_type_uint_least32_t=no
+fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-ac_fn_c_check_type "$LINENO" "intptr_t" "ac_cv_type_intptr_t" "$ac_includes_default"
-if test "x$ac_cv_type_intptr_t" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_type_uint_least32_t" >&5
+echo "${ECHO_T}$ac_cv_type_uint_least32_t" >&6; }
+if test $ac_cv_type_uint_least32_t = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_INTPTR_T 1
+#define HAVE_UINT_LEAST32_T 1
_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for preprocessor stringizing operator" >&5
-$as_echo_n "checking for preprocessor stringizing operator... " >&6; }
-if ${ac_cv_c_stringize+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for preprocessor stringizing operator" >&5
+echo $ECHO_N "checking for preprocessor stringizing operator... $ECHO_C" >&6; }
+if test "${ac_cv_c_stringize+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define x(y) #y
char *s = x(teststring);
_ACEOF
if (eval "$ac_cpp conftest.$ac_ext") 2>&5 |
- $EGREP "#teststring" >/dev/null 2>&1; then :
+ $EGREP "#teststring" >/dev/null 2>&1; then
ac_cv_c_stringize=no
else
ac_cv_c_stringize=yes
@@ -22663,11 +27124,13 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_stringize" >&5
-$as_echo "$ac_cv_c_stringize" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_c_stringize" >&5
+echo "${ECHO_T}$ac_cv_c_stringize" >&6; }
if test $ac_cv_c_stringize = yes; then
-$as_echo "#define HAVE_STRINGIZE 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STRINGIZE 1
+_ACEOF
fi
@@ -22675,12 +27138,16 @@ fi
# FIXME: Really want #ifndef __cplusplus around the #define volatile
# replacement autoconf gives, since volatile is always available in C++.
# But we don't use it in C++ currently.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working volatile" >&5
-$as_echo_n "checking for working volatile... " >&6; }
-if ${ac_cv_c_volatile+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for working volatile" >&5
+echo $ECHO_N "checking for working volatile... $ECHO_C" >&6; }
+if test "${ac_cv_c_volatile+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int
@@ -22694,61 +27161,112 @@ return !x && !y;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_c_volatile=yes
else
- ac_cv_c_volatile=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_volatile=no
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_volatile" >&5
-$as_echo "$ac_cv_c_volatile" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_c_volatile" >&5
+echo "${ECHO_T}$ac_cv_c_volatile" >&6; }
if test $ac_cv_c_volatile = no; then
-$as_echo "#define volatile /**/" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define volatile
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for C/C++ restrict keyword" >&5
-$as_echo_n "checking for C/C++ restrict keyword... " >&6; }
-if ${ac_cv_c_restrict+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for C/C++ restrict keyword" >&5
+echo $ECHO_N "checking for C/C++ restrict keyword... $ECHO_C" >&6; }
+if test "${ac_cv_c_restrict+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_c_restrict=no
- # The order here caters to the fact that C++ does not require restrict.
- for ac_kw in __restrict __restrict__ _Restrict restrict; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ # Try the official restrict keyword, then gcc's __restrict, and
+ # the less common variants.
+ for ac_kw in restrict __restrict __restrict__ _Restrict; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
typedef int * int_ptr;
- int foo (int_ptr $ac_kw ip) {
- return ip[0];
+ int foo (int_ptr $ac_kw ip) {
+ return ip[0];
}
int
main ()
{
int s[1];
- int * $ac_kw t = s;
- t[0] = 0;
- return foo(t)
+ int * $ac_kw t = s;
+ t[0] = 0;
+ return foo(t)
;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_c_restrict=$ac_kw
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test "$ac_cv_c_restrict" != no && break
done
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_restrict" >&5
-$as_echo "$ac_cv_c_restrict" >&6; }
-
+{ echo "$as_me:$LINENO: result: $ac_cv_c_restrict" >&5
+echo "${ECHO_T}$ac_cv_c_restrict" >&6; }
case $ac_cv_c_restrict in
restrict) ;;
- no) $as_echo "#define restrict /**/" >>confdefs.h
+ no)
+cat >>confdefs.h <<\_ACEOF
+#define restrict
+_ACEOF
;;
*) cat >>confdefs.h <<_ACEOF
#define restrict $ac_cv_c_restrict
@@ -22757,13 +27275,83 @@ _ACEOF
esac
-# 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 :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether <stdarg.h> exists and works" >&5
+echo $ECHO_N "checking whether <stdarg.h> exists and works... $ECHO_C" >&6; }
+if test "${gmp_cv_c_stdarg+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* 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
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ gmp_cv_c_stdarg=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gmp_cv_c_stdarg=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+
+fi
+{ echo "$as_me:$LINENO: result: $gmp_cv_c_stdarg" >&5
+echo "${ECHO_T}$gmp_cv_c_stdarg" >&6; }
+if test $gmp_cv_c_stdarg = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_STDARG 1
+_ACEOF
+
+fi
+
+{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((const)) works" >&5
+echo $ECHO_N "checking whether gcc __attribute__ ((const)) works... $ECHO_C" >&6; }
+if test "${gmp_cv_c_attribute_const+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
int foo (int x) __attribute__ ((const));
int
@@ -22774,36 +27362,58 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
gmp_cv_c_attribute_const=yes
else
- gmp_cv_c_attribute_const=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gmp_cv_c_attribute_const=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_attribute_const" >&5
-$as_echo "$gmp_cv_c_attribute_const" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_const" >&5
+echo "${ECHO_T}$gmp_cv_c_attribute_const" >&6; }
if test $gmp_cv_c_attribute_const = yes; then
-$as_echo "#define HAVE_ATTRIBUTE_CONST 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATTRIBUTE_CONST 1
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc __attribute__ ((malloc)) works" >&5
-$as_echo_n "checking whether gcc __attribute__ ((malloc)) works... " >&6; }
-if ${gmp_cv_c_attribute_malloc+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((malloc)) works" >&5
+echo $ECHO_N "checking whether gcc __attribute__ ((malloc)) works... $ECHO_C" >&6; }
+if test "${gmp_cv_c_attribute_malloc+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.c <<EOF
void *foo (int x) __attribute__ ((malloc));
EOF
gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if grep "attribute directive ignored" conftest.out >/dev/null; then
gmp_cv_c_attribute_malloc=no
else
@@ -22816,20 +27426,26 @@ cat conftest.out >&5
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_c_attribute_malloc" >&5
-$as_echo "$gmp_cv_c_attribute_malloc" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_malloc" >&5
+echo "${ECHO_T}$gmp_cv_c_attribute_malloc" >&6; }
if test $gmp_cv_c_attribute_malloc = yes; then
-$as_echo "#define HAVE_ATTRIBUTE_MALLOC 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATTRIBUTE_MALLOC 1
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc __attribute__ ((mode (XX))) works" >&5
-$as_echo_n "checking whether gcc __attribute__ ((mode (XX))) works... " >&6; }
-if ${gmp_cv_c_attribute_mode+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((mode (XX))) works" >&5
+echo $ECHO_N "checking whether gcc __attribute__ ((mode (XX))) works... $ECHO_C" >&6; }
+if test "${gmp_cv_c_attribute_mode+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
typedef int SItype __attribute__ ((mode (SI)));
int
@@ -22840,28 +27456,54 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
gmp_cv_c_attribute_mode=yes
else
- gmp_cv_c_attribute_mode=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gmp_cv_c_attribute_mode=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_attribute_mode" >&5
-$as_echo "$gmp_cv_c_attribute_mode" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_mode" >&5
+echo "${ECHO_T}$gmp_cv_c_attribute_mode" >&6; }
if test $gmp_cv_c_attribute_mode = yes; then
-$as_echo "#define HAVE_ATTRIBUTE_MODE 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATTRIBUTE_MODE 1
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether gcc __attribute__ ((noreturn)) works" >&5
-$as_echo_n "checking whether gcc __attribute__ ((noreturn)) works... " >&6; }
-if ${gmp_cv_c_attribute_noreturn+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether gcc __attribute__ ((noreturn)) works" >&5
+echo $ECHO_N "checking whether gcc __attribute__ ((noreturn)) works... $ECHO_C" >&6; }
+if test "${gmp_cv_c_attribute_noreturn+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
void foo (int x) __attribute__ ((noreturn));
int
@@ -22872,31 +27514,57 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
gmp_cv_c_attribute_noreturn=yes
else
- gmp_cv_c_attribute_noreturn=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gmp_cv_c_attribute_noreturn=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_attribute_noreturn" >&5
-$as_echo "$gmp_cv_c_attribute_noreturn" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_c_attribute_noreturn" >&5
+echo "${ECHO_T}$gmp_cv_c_attribute_noreturn" >&6; }
if test $gmp_cv_c_attribute_noreturn = yes; then
-$as_echo "#define HAVE_ATTRIBUTE_NORETURN 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ATTRIBUTE_NORETURN 1
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for inline" >&5
-$as_echo_n "checking for inline... " >&6; }
-if ${ac_cv_c_inline+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for inline" >&5
+echo $ECHO_N "checking for inline... $ECHO_C" >&6; }
+if test "${ac_cv_c_inline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_cv_c_inline=no
for ac_kw in inline __inline__ __inline; do
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#ifndef __cplusplus
typedef int foo_t;
@@ -22905,16 +27573,39 @@ $ac_kw foo_t foo () {return 0; }
#endif
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_c_inline=$ac_kw
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
test "$ac_cv_c_inline" != no && break
done
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_inline" >&5
-$as_echo "$ac_cv_c_inline" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_c_inline" >&5
+echo "${ECHO_T}$ac_cv_c_inline" >&6; }
+
case $ac_cv_c_inline in
inline | yes) ;;
@@ -22935,11 +27626,16 @@ esac
case $ac_cv_c_inline in
no) ;;
*)
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define __GMP_WITHIN_CONFIGURE_INLINE 1
#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
#define GMP_LIMB_BITS 123
$DEFN_LONG_LONG_LIMB
#include "$srcdir/gmp-h.in"
@@ -22956,16 +27652,36 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
else
- case $ac_cv_c_inline in
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ case $ac_cv_c_inline in
yes) tmp_inline=inline ;;
*) tmp_inline=$ac_cv_c_inline ;;
esac
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gmp.h doesnt recognise compiler \"$tmp_inline\", inlines will be unavailable" >&5
-$as_echo "$as_me: WARNING: gmp.h doesnt recognise compiler \"$tmp_inline\", inlines will be unavailable" >&2;}
+ { echo "$as_me:$LINENO: WARNING: gmp.h doesnt recognise compiler \"$tmp_inline\", inlines will be unavailable" >&5
+echo "$as_me: WARNING: gmp.h doesnt recognise compiler \"$tmp_inline\", inlines will be unavailable" >&2;}
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
;;
esac
@@ -22974,18 +27690,22 @@ esac
# from libtool
LIBM=
case $host in
-*-*-beos* | *-*-cegcc* | *-*-cygwin* | *-*-haiku* | *-*-pw32* | *-*-darwin*)
+*-*-beos* | *-*-cygwin* | *-*-pw32* | *-*-darwin*)
# These system don't have libm, or don't need it
;;
*-ncr-sysv4.3*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for _mwvalidcheckl in -lmw" >&5
-$as_echo_n "checking for _mwvalidcheckl in -lmw... " >&6; }
-if ${ac_cv_lib_mw__mwvalidcheckl+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for _mwvalidcheckl in -lmw" >&5
+echo $ECHO_N "checking for _mwvalidcheckl in -lmw... $ECHO_C" >&6; }
+if test "${ac_cv_lib_mw__mwvalidcheckl+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lmw $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -23003,29 +27723,54 @@ return _mwvalidcheckl ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_mw__mwvalidcheckl=yes
else
- ac_cv_lib_mw__mwvalidcheckl=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_mw__mwvalidcheckl=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
-$as_echo "$ac_cv_lib_mw__mwvalidcheckl" >&6; }
-if test "x$ac_cv_lib_mw__mwvalidcheckl" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_mw__mwvalidcheckl" >&5
+echo "${ECHO_T}$ac_cv_lib_mw__mwvalidcheckl" >&6; }
+if test $ac_cv_lib_mw__mwvalidcheckl = yes; then
LIBM="-lmw"
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
-if ${ac_cv_lib_m_cos+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for cos in -lm" >&5
+echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_cos+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -23043,31 +27788,56 @@ return cos ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_m_cos=yes
else
- ac_cv_lib_m_cos=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_m_cos=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
-$as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5
+echo "${ECHO_T}$ac_cv_lib_m_cos" >&6; }
+if test $ac_cv_lib_m_cos = yes; then
LIBM="$LIBM -lm"
fi
;;
*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for cos in -lm" >&5
-$as_echo_n "checking for cos in -lm... " >&6; }
-if ${ac_cv_lib_m_cos+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for cos in -lm" >&5
+echo $ECHO_N "checking for cos in -lm... $ECHO_C" >&6; }
+if test "${ac_cv_lib_m_cos+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lm $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -23085,18 +27855,39 @@ return cos ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_m_cos=yes
else
- ac_cv_lib_m_cos=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_m_cos=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_m_cos" >&5
-$as_echo "$ac_cv_lib_m_cos" >&6; }
-if test "x$ac_cv_lib_m_cos" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_m_cos" >&5
+echo "${ECHO_T}$ac_cv_lib_m_cos" >&6; }
+if test $ac_cv_lib_m_cos = yes; then
LIBM="-lm"
fi
@@ -23105,15 +27896,18 @@ esac
-
# The Ultrix 4.2 mips builtin alloca declared by alloca.h only works
# for constant arguments. Useless!
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for working alloca.h" >&5
-$as_echo_n "checking for working alloca.h... " >&6; }
-if ${gmp_cv_header_alloca+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for working alloca.h" >&5
+echo $ECHO_N "checking for working alloca.h... $ECHO_C" >&6; }
+if test "${gmp_cv_header_alloca+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <alloca.h>
int
@@ -23124,32 +27918,60 @@ char *p = (char *) alloca (2 * sizeof (int));
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
gmp_cv_header_alloca=yes
else
- gmp_cv_header_alloca=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gmp_cv_header_alloca=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_header_alloca" >&5
-$as_echo "$gmp_cv_header_alloca" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_header_alloca" >&5
+echo "${ECHO_T}$gmp_cv_header_alloca" >&6; }
if test $gmp_cv_header_alloca = yes; then
-$as_echo "#define HAVE_ALLOCA_H 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA_H 1
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for alloca (via gmp-impl.h)" >&5
-$as_echo_n "checking for alloca (via gmp-impl.h)... " >&6; }
-if ${gmp_cv_func_alloca+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for alloca (via gmp-impl.h)" >&5
+echo $ECHO_N "checking for alloca (via gmp-impl.h)... $ECHO_C" >&6; }
+if test "${gmp_cv_func_alloca+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
#define GMP_LIMB_BITS 123
$DEFN_LONG_LONG_LIMB
#include "$srcdir/gmp-h.in"
@@ -23164,27 +27986,50 @@ char *p = (char *) alloca (1);
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
gmp_cv_func_alloca=yes
else
- gmp_cv_func_alloca=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ gmp_cv_func_alloca=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_func_alloca" >&5
-$as_echo "$gmp_cv_func_alloca" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_func_alloca" >&5
+echo "${ECHO_T}$gmp_cv_func_alloca" >&6; }
if test $gmp_cv_func_alloca = yes; then
-$as_echo "#define HAVE_ALLOCA 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_ALLOCA 1
+_ACEOF
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to allocate temporary memory" >&5
-$as_echo_n "checking how to allocate temporary memory... " >&6; }
-if ${gmp_cv_option_alloca+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking how to allocate temporary memory" >&5
+echo $ECHO_N "checking how to allocate temporary memory... $ECHO_C" >&6; }
+if test "${gmp_cv_option_alloca+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $enable_alloca in
yes)
@@ -23205,48 +28050,66 @@ else
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_option_alloca" >&5
-$as_echo "$gmp_cv_option_alloca" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_option_alloca" >&5
+echo "${ECHO_T}$gmp_cv_option_alloca" >&6; }
+
case $gmp_cv_option_alloca in
alloca)
if test $gmp_cv_func_alloca = no; then
- as_fn_error $? "--enable-alloca=alloca specified, but alloca not available" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: --enable-alloca=alloca specified, but alloca not available" >&5
+echo "$as_me: error: --enable-alloca=alloca specified, but alloca not available" >&2;}
+ { (exit 1); exit 1; }; }
fi
- $as_echo "#define WANT_TMP_ALLOCA 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define WANT_TMP_ALLOCA 1
+_ACEOF
TAL_OBJECT=tal-reent$U.lo
;;
malloc-reentrant)
- $as_echo "#define WANT_TMP_REENTRANT 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define WANT_TMP_REENTRANT 1
+_ACEOF
TAL_OBJECT=tal-reent$U.lo
;;
malloc-notreentrant)
- $as_echo "#define WANT_TMP_NOTREENTRANT 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define WANT_TMP_NOTREENTRANT 1
+_ACEOF
TAL_OBJECT=tal-notreent$U.lo
;;
debug)
- $as_echo "#define WANT_TMP_DEBUG 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define WANT_TMP_DEBUG 1
+_ACEOF
TAL_OBJECT=tal-debug$U.lo
;;
*)
# checks at the start of configure.in should protect us
- as_fn_error $? "unrecognised --enable-alloca=$gmp_cv_option_alloca" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: unrecognised --enable-alloca=$gmp_cv_option_alloca" >&5
+echo "$as_me: error: unrecognised --enable-alloca=$gmp_cv_option_alloca" >&2;}
+ { (exit 1); exit 1; }; }
;;
esac
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <stdio.h>
#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
#define GMP_LIMB_BITS 123
$DEFN_LONG_LONG_LIMB
#include "$srcdir/gmp-h.in"
@@ -23263,275 +28126,304 @@ main ()
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ :
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: gmp.h doesnt recognise <stdio.h>, FILE prototypes will be unavailable" >&5
-$as_echo "$as_me: WARNING: gmp.h doesnt recognise <stdio.h>, FILE prototypes will be unavailable" >&2;}
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ { echo "$as_me:$LINENO: WARNING: gmp.h doesnt recognise <stdio.h>, FILE prototypes will be unavailable" >&5
+echo "$as_me: WARNING: gmp.h doesnt recognise <stdio.h>, FILE prototypes will be unavailable" >&2;}
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether byte ordering is bigendian" >&5
-$as_echo_n "checking whether byte ordering is bigendian... " >&6; }
-if ${ac_cv_c_bigendian+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether byte ordering is bigendian" >&5
+echo $ECHO_N "checking whether byte ordering is bigendian... $ECHO_C" >&6; }
+if test "${ac_cv_c_bigendian+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_c_bigendian=unknown
- # See if we're dealing with a universal compiler.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#ifndef __APPLE_CC__
- not a universal capable compiler
- #endif
- typedef int dummy;
-
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
-
- # Check for potential -arch flags. It is not universal unless
- # there are at least two -arch flags with different values.
- ac_arch=
- ac_prev=
- for ac_word in $CC $CFLAGS $CPPFLAGS $LDFLAGS; do
- if test -n "$ac_prev"; then
- case $ac_word in
- i?86 | x86_64 | ppc | ppc64)
- if test -z "$ac_arch" || test "$ac_arch" = "$ac_word"; then
- ac_arch=$ac_word
- else
- ac_cv_c_bigendian=universal
- break
- fi
- ;;
- esac
- ac_prev=
- elif test "x$ac_word" = "x-arch"; then
- ac_prev=arch
- fi
- done
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- if test $ac_cv_c_bigendian = unknown; then
- # See if sys/param.h defines the BYTE_ORDER macro.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ # See if sys/param.h defines the BYTE_ORDER macro.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
- #include <sys/param.h>
+#include <sys/param.h>
int
main ()
{
-#if ! (defined BYTE_ORDER && defined BIG_ENDIAN \
- && defined LITTLE_ENDIAN && BYTE_ORDER && BIG_ENDIAN \
- && LITTLE_ENDIAN)
- bogus endian macros
- #endif
+#if ! (defined BYTE_ORDER && defined BIG_ENDIAN && defined LITTLE_ENDIAN \
+ && BYTE_ORDER && BIG_ENDIAN && LITTLE_ENDIAN)
+ bogus endian macros
+#endif
;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
# It does; now see whether it defined to BIG_ENDIAN or not.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#include <sys/types.h>
- #include <sys/param.h>
+#include <sys/param.h>
int
main ()
{
#if BYTE_ORDER != BIG_ENDIAN
- not big endian
- #endif
+ not big endian
+#endif
;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
ac_cv_c_bigendian=yes
else
- ac_cv_c_bigendian=no
-fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_c_bigendian=no
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- if test $ac_cv_c_bigendian = unknown; then
- # See if <limits.h> defines _LITTLE_ENDIAN or _BIG_ENDIAN (e.g., Solaris).
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-#include <limits.h>
-int
-main ()
-{
-#if ! (defined _LITTLE_ENDIAN || defined _BIG_ENDIAN)
- bogus endian macros
- #endif
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
- ;
- return 0;
-}
+ # It does not; compile a test program.
+if test "$cross_compiling" = yes; then
+ # try to guess the endianness by grepping values into an object file
+ ac_cv_c_bigendian=unknown
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- # It does; now see whether it defined to _BIG_ENDIAN or not.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
-#include <limits.h>
-
+short int ascii_mm[] = { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
+short int ascii_ii[] = { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
+void _ascii () { char *s = (char *) ascii_mm; s = (char *) ascii_ii; }
+short int ebcdic_ii[] = { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
+short int ebcdic_mm[] = { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
+void _ebcdic () { char *s = (char *) ebcdic_mm; s = (char *) ebcdic_ii; }
int
main ()
{
-#ifndef _BIG_ENDIAN
- not big endian
- #endif
-
+ _ascii (); _ebcdic ();
;
return 0;
}
_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ if grep BIGenDianSyS conftest.$ac_objext >/dev/null ; then
ac_cv_c_bigendian=yes
-else
- ac_cv_c_bigendian=no
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
+ if test "$ac_cv_c_bigendian" = unknown; then
+ ac_cv_c_bigendian=no
+ else
+ # finding both strings is unlikely to happen, but who knows?
+ ac_cv_c_bigendian=unknown
+ fi
fi
-rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
- fi
- if test $ac_cv_c_bigendian = unknown; then
- # Compile a test program.
- if test "$cross_compiling" = yes; then :
- # Try to guess by grepping values from an object file.
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-short int ascii_mm[] =
- { 0x4249, 0x4765, 0x6E44, 0x6961, 0x6E53, 0x7953, 0 };
- short int ascii_ii[] =
- { 0x694C, 0x5454, 0x656C, 0x6E45, 0x6944, 0x6E61, 0 };
- int use_ascii (int i) {
- return ascii_mm[i] + ascii_ii[i];
- }
- short int ebcdic_ii[] =
- { 0x89D3, 0xE3E3, 0x8593, 0x95C5, 0x89C4, 0x9581, 0 };
- short int ebcdic_mm[] =
- { 0xC2C9, 0xC785, 0x95C4, 0x8981, 0x95E2, 0xA8E2, 0 };
- int use_ebcdic (int i) {
- return ebcdic_mm[i] + ebcdic_ii[i];
- }
- extern int foo;
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
-int
-main ()
-{
-return use_ascii (foo) == use_ebcdic (foo);
- ;
- return 0;
-}
-_ACEOF
-if ac_fn_c_try_compile "$LINENO"; then :
- if grep BIGenDianSyS conftest.$ac_objext >/dev/null; then
- ac_cv_c_bigendian=yes
- fi
- if grep LiTTleEnDian conftest.$ac_objext >/dev/null ; then
- if test "$ac_cv_c_bigendian" = unknown; then
- ac_cv_c_bigendian=no
- else
- # finding both strings is unlikely to happen, but who knows?
- ac_cv_c_bigendian=unknown
- fi
- fi
fi
+
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
$ac_includes_default
int
main ()
{
- /* Are we little or big endian? From Harbison&Steele. */
- union
- {
- long int l;
- char c[sizeof (long int)];
- } u;
- u.l = 1;
- return u.c[sizeof (long int) - 1] == 1;
+ /* Are we little or big endian? From Harbison&Steele. */
+ union
+ {
+ long int l;
+ char c[sizeof (long int)];
+ } u;
+ u.l = 1;
+ return u.c[sizeof (long int) - 1] == 1;
;
return 0;
}
_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
ac_cv_c_bigendian=no
else
- ac_cv_c_bigendian=yes
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+ac_cv_c_bigendian=yes
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
- fi
+
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_c_bigendian" >&5
-$as_echo "$ac_cv_c_bigendian" >&6; }
- case $ac_cv_c_bigendian in #(
- yes)
- $as_echo "#define HAVE_LIMB_BIG_ENDIAN 1" >>confdefs.h
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_c_bigendian" >&5
+echo "${ECHO_T}$ac_cv_c_bigendian" >&6; }
+case $ac_cv_c_bigendian in
+ yes)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIMB_BIG_ENDIAN 1
+_ACEOF
echo "define_not_for_expansion(\`HAVE_LIMB_BIG_ENDIAN')" >> $gmp_tmpconfigm4p
-;; #(
- no)
- $as_echo "#define HAVE_LIMB_LITTLE_ENDIAN 1" >>confdefs.h
+ ;;
+ no)
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_LIMB_LITTLE_ENDIAN 1
+_ACEOF
echo "define_not_for_expansion(\`HAVE_LIMB_LITTLE_ENDIAN')" >> $gmp_tmpconfigm4p
- ;; #(
- universal)
-
-$as_echo "#define AC_APPLE_UNIVERSAL_BUILD 1" >>confdefs.h
+ ;;
+ *)
+ : ;;
+esac
- ;; #(
- *)
- : ;;
- esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking format of \`double' floating point" >&5
-$as_echo_n "checking format of \`double' floating point... " >&6; }
-if ${gmp_cv_c_double_format+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking format of \`double' floating point" >&5
+echo $ECHO_N "checking format of \`double' floating point... $ECHO_C" >&6; }
+if test "${gmp_cv_c_double_format+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_c_double_format=unknown
cat >conftest.c <<\EOF
-struct foo {
+struct {
char before[8];
double x;
char after[8];
-};
-extern struct foo foo;
-struct foo foo = {
+} foo = {
{ '\001', '\043', '\105', '\147', '\211', '\253', '\315', '\357' },
-123456789.0,
{ '\376', '\334', '\272', '\230', '\166', '\124', '\062', '\020' },
};
EOF
gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&5 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat >conftest.awk <<\EOF
BEGIN {
@@ -23691,55 +28583,68 @@ EOF
;;
esac
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, cannot compile test program" >&5
-$as_echo "$as_me: WARNING: oops, cannot compile test program" >&2;}
+ { echo "$as_me:$LINENO: WARNING: oops, cannot compile test program" >&5
+echo "$as_me: WARNING: oops, cannot compile test program" >&2;}
fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_c_double_format" >&5
-$as_echo "$gmp_cv_c_double_format" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_c_double_format" >&5
+echo "${ECHO_T}$gmp_cv_c_double_format" >&6; }
+
case $gmp_cv_c_double_format in
"IEEE big endian")
- $as_echo "#define HAVE_DOUBLE_IEEE_BIG_ENDIAN 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOUBLE_IEEE_BIG_ENDIAN 1
+_ACEOF
echo "define_not_for_expansion(\`HAVE_DOUBLE_IEEE_BIG_ENDIAN')" >> $gmp_tmpconfigm4p
;;
"IEEE little endian")
- $as_echo "#define HAVE_DOUBLE_IEEE_LITTLE_ENDIAN 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOUBLE_IEEE_LITTLE_ENDIAN 1
+_ACEOF
echo "define_not_for_expansion(\`HAVE_DOUBLE_IEEE_LITTLE_ENDIAN')" >> $gmp_tmpconfigm4p
;;
"IEEE little endian, swapped halves")
- $as_echo "#define HAVE_DOUBLE_IEEE_LITTLE_SWAPPED 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOUBLE_IEEE_LITTLE_SWAPPED 1
+_ACEOF
;;
"VAX D")
- $as_echo "#define HAVE_DOUBLE_VAX_D 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOUBLE_VAX_D 1
+_ACEOF
;;
"VAX G")
- $as_echo "#define HAVE_DOUBLE_VAX_G 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOUBLE_VAX_G 1
+_ACEOF
;;
"Cray CFP")
- $as_echo "#define HAVE_DOUBLE_CRAY_CFP 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_DOUBLE_CRAY_CFP 1
+_ACEOF
;;
"bad ARM software floats")
;;
unknown*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Could not determine float format." >&5
-$as_echo "$as_me: WARNING: Could not determine float format." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Conversions to and from \"double\" may be slow." >&5
-$as_echo "$as_me: WARNING: Conversions to and from \"double\" may be slow." >&2;}
+ { echo "$as_me:$LINENO: WARNING: Could not determine float format." >&5
+echo "$as_me: WARNING: Could not determine float format." >&2;}
+ { echo "$as_me:$LINENO: WARNING: Conversions to and from \"double\" may be slow." >&5
+echo "$as_me: WARNING: Conversions to and from \"double\" may be slow." >&2;}
;;
*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, unrecognised float format: $gmp_cv_c_double_format" >&5
-$as_echo "$as_me: WARNING: oops, unrecognised float format: $gmp_cv_c_double_format" >&2;}
+ { echo "$as_me:$LINENO: WARNING: oops, unrecognised float format: $gmp_cv_c_double_format" >&5
+echo "$as_me: WARNING: oops, unrecognised float format: $gmp_cv_c_double_format" >&2;}
;;
esac
@@ -23768,39 +28673,79 @@ esac
# syssgi - IRIX specific
# times - not in mingw
#
+# clock_gettime is in librt on *-*-osf5.1. We could look for it
+# there, but that's not worth bothering with unless it has a decent
+# resolution (in a quick test clock_getres said only 1 millisecond).
+#
# AC_FUNC_STRNLEN is not used because we don't want the AC_LIBOBJ
# replacement setups it gives. It detects a faulty strnlen on AIX, but
# missing out on that test is ok since our only use of strnlen is in
# __gmp_replacement_vsnprintf which is not required on AIX since it has a
# vsnprintf.
#
-for ac_func in alarm attr_get clock cputime getpagesize getrusage gettimeofday getsysinfo localeconv memset mmap mprotect nl_langinfo obstack_vprintf popen processor_info pstat_getprocessor raise read_real_time sigaction sigaltstack sigstack syssgi strchr strerror strnlen strtol strtoul sysconf sysctl sysctlbyname times
-do :
- as_ac_var=`$as_echo "ac_cv_func_$ac_func" | $as_tr_sh`
-ac_fn_c_check_func "$LINENO" "$ac_func" "$as_ac_var"
-if eval test \"x\$"$as_ac_var"\" = x"yes"; then :
- cat >>confdefs.h <<_ACEOF
-#define `$as_echo "HAVE_$ac_func" | $as_tr_cpp` 1
-_ACEOF
-fi
-done
-# clock_gettime is in librt on *-*-osf5.1 and on glibc, so att -lrt to
-# TUNE_LIBS if needed. On linux (tested on x86_32, 2.6.26),
-# clock_getres reports ns accuracy, while in a quick test on osf
-# clock_getres said only 1 millisecond.
-old_LIBS="$LIBS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for library containing clock_gettime" >&5
-$as_echo_n "checking for library containing clock_gettime... " >&6; }
-if ${ac_cv_search_clock_gettime+:} false; then :
- $as_echo_n "(cached) " >&6
-else
- ac_func_search_save_LIBS=$LIBS
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+for ac_func in alarm attr_get clock clock_gettime cputime getpagesize getrusage gettimeofday getsysinfo localeconv memset mmap mprotect nl_langinfo obstack_vprintf popen processor_info pstat_getprocessor raise read_real_time sigaction sigaltstack sigstack syssgi strchr strerror strnlen strtol strtoul sysconf sysctl sysctlbyname times
+do
+as_ac_var=`echo "ac_cv_func_$ac_func" | $as_tr_sh`
+{ echo "$as_me:$LINENO: checking for $ac_func" >&5
+echo $ECHO_N "checking for $ac_func... $ECHO_C" >&6; }
+if { as_var=$as_ac_var; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
+/* Define $ac_func to an innocuous variant, in case <limits.h> declares $ac_func.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define $ac_func innocuous_$ac_func
+
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char $ac_func (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
+
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
+
+#undef $ac_func
/* Override any GCC internal prototype to avoid an error.
Use char because int might match the return type of a GCC
@@ -23808,57 +28753,146 @@ cat confdefs.h - <<_ACEOF >conftest.$ac_ext
#ifdef __cplusplus
extern "C"
#endif
-char clock_gettime ();
+char $ac_func ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_$ac_func || defined __stub___$ac_func
+choke me
+#endif
+
int
main ()
{
-return clock_gettime ();
+return $ac_func ();
;
return 0;
}
_ACEOF
-for ac_lib in '' rt; do
- if test -z "$ac_lib"; then
- ac_res="none required"
- else
- ac_res=-l$ac_lib
- LIBS="-l$ac_lib $ac_func_search_save_LIBS"
- fi
- if ac_fn_c_try_link "$LINENO"; then :
- ac_cv_search_clock_gettime=$ac_res
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ eval "$as_ac_var=yes"
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ eval "$as_ac_var=no"
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext
- if ${ac_cv_search_clock_gettime+:} false; then :
- break
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+ac_res=`eval echo '${'$as_ac_var'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+if test `eval echo '${'$as_ac_var'}'` = yes; then
+ cat >>confdefs.h <<_ACEOF
+#define `echo "HAVE_$ac_func" | $as_tr_cpp` 1
+_ACEOF
+
fi
done
-if ${ac_cv_search_clock_gettime+:} false; then :
+
+
+{ echo "$as_me:$LINENO: checking for vsnprintf" >&5
+echo $ECHO_N "checking for vsnprintf... $ECHO_C" >&6; }
+if test "${ac_cv_func_vsnprintf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- ac_cv_search_clock_gettime=no
-fi
-rm conftest.$ac_ext
-LIBS=$ac_func_search_save_LIBS
-fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_search_clock_gettime" >&5
-$as_echo "$ac_cv_search_clock_gettime" >&6; }
-ac_res=$ac_cv_search_clock_gettime
-if test "$ac_res" != no; then :
- test "$ac_res" = "none required" || LIBS="$ac_res $LIBS"
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+/* Define vsnprintf to an innocuous variant, in case <limits.h> declares vsnprintf.
+ For example, HP-UX 11i <limits.h> declares gettimeofday. */
+#define vsnprintf innocuous_vsnprintf
+/* System header to define __stub macros and hopefully few prototypes,
+ which can conflict with char vsnprintf (); below.
+ Prefer <limits.h> to <assert.h> if __STDC__ is defined, since
+ <limits.h> exists even on freestanding compilers. */
-$as_echo "#define HAVE_CLOCK_GETTIME 1" >>confdefs.h
+#ifdef __STDC__
+# include <limits.h>
+#else
+# include <assert.h>
+#endif
-fi
+#undef vsnprintf
-TUNE_LIBS="$LIBS"
-LIBS="$old_LIBS"
+/* Override any GCC internal prototype to avoid an error.
+ Use char because int might match the return type of a GCC
+ builtin and then its argument prototype would still apply. */
+#ifdef __cplusplus
+extern "C"
+#endif
+char vsnprintf ();
+/* The GNU C library defines this for functions which it implements
+ to always fail with ENOSYS. Some functions are actually named
+ something starting with __ and the normal name is an alias. */
+#if defined __stub_vsnprintf || defined __stub___vsnprintf
+choke me
+#endif
+int
+main ()
+{
+return vsnprintf ();
+ ;
+ return 0;
+}
+_ACEOF
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
+ ac_cv_func_vsnprintf=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_cv_func_vsnprintf=no
+fi
-ac_fn_c_check_func "$LINENO" "vsnprintf" "ac_cv_func_vsnprintf"
-if test "x$ac_cv_func_vsnprintf" = xyes; then :
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_func_vsnprintf" >&5
+echo "${ECHO_T}$ac_cv_func_vsnprintf" >&6; }
+if test $ac_cv_func_vsnprintf = yes; then
gmp_vsnprintf_exists=yes
else
gmp_vsnprintf_exists=no
@@ -23867,41 +28901,60 @@ fi
if test "$gmp_vsnprintf_exists" = no; then
gmp_cv_func_vsnprintf=no
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether vsnprintf works" >&5
-$as_echo_n "checking whether vsnprintf works... " >&6; }
-if ${gmp_cv_func_vsnprintf+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking whether vsnprintf works" >&5
+echo $ECHO_N "checking whether vsnprintf works... $ECHO_C" >&6; }
+if test "${gmp_cv_func_vsnprintf+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_func_vsnprintf=yes
- for i in 'return check ("hello world");' 'int n; return check ("%nhello world", &n);'; do
- if test "$cross_compiling" = yes; then :
+ for i in 'check ("hello world");' 'int n; check ("%nhello world", &n);'; do
+ if test "$cross_compiling" = yes; then
gmp_cv_func_vsnprintf=probably; break
else
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
#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);
if (strcmp (buf, "hel") != 0)
- return 1;
+ exit (1);
/* allowed return values */
if (ret != -1 && ret != 3 && ret != 11)
- return 2;
+ exit (2);
return 0;
}
@@ -23910,38 +28963,65 @@ int
main ()
{
$i
+ exit (0);
}
_ACEOF
-if ac_fn_c_try_run "$LINENO"; then :
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
:
else
- gmp_cv_func_vsnprintf=no; break
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+gmp_cv_func_vsnprintf=no; break
fi
-rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext \
- conftest.$ac_objext conftest.beam conftest.$ac_ext
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
+
done
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_func_vsnprintf" >&5
-$as_echo "$gmp_cv_func_vsnprintf" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_func_vsnprintf" >&5
+echo "${ECHO_T}$gmp_cv_func_vsnprintf" >&6; }
if test "$gmp_cv_func_vsnprintf" = probably; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok" >&5
-$as_echo "$as_me: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok" >&5
+echo "$as_me: WARNING: cannot check for properly working vsnprintf when cross compiling, will assume it's ok" >&2;}
fi
if test "$gmp_cv_func_vsnprintf" != no; then
-$as_echo "#define HAVE_VSNPRINTF 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_VSNPRINTF 1
+_ACEOF
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether sscanf needs writable input" >&5
-$as_echo_n "checking whether sscanf needs writable input... " >&6; }
-if ${gmp_cv_func_sscanf_writable_input+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether sscanf needs writable input" >&5
+echo $ECHO_N "checking whether sscanf needs writable input... $ECHO_C" >&6; }
+if test "${gmp_cv_func_sscanf_writable_input+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $host in
*-*-hpux9 | *-*-hpux9.*)
@@ -23950,25 +29030,124 @@ else
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_func_sscanf_writable_input" >&5
-$as_echo "$gmp_cv_func_sscanf_writable_input" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_func_sscanf_writable_input" >&5
+echo "${ECHO_T}$gmp_cv_func_sscanf_writable_input" >&6; }
case $gmp_cv_func_sscanf_writable_input in
yes)
-$as_echo "#define SSCANF_WRITABLE_INPUT 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define SSCANF_WRITABLE_INPUT 1
+_ACEOF
;;
no) ;;
- *) as_fn_error $? "unrecognised \$gmp_cv_func_sscanf_writable_input" "$LINENO" 5 ;;
+ *) { { echo "$as_me:$LINENO: error: unrecognised \$gmp_cv_func_sscanf_writable_input" >&5
+echo "$as_me: error: unrecognised \$gmp_cv_func_sscanf_writable_input" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
# Reasons for checking:
# pst_processor psp_iticksperclktick - not in hpux 9
#
-ac_fn_c_check_member "$LINENO" "struct pst_processor" "psp_iticksperclktick" "ac_cv_member_struct_pst_processor_psp_iticksperclktick" "#include <sys/pstat.h>
-"
-if test "x$ac_cv_member_struct_pst_processor_psp_iticksperclktick" = xyes; then :
+{ echo "$as_me:$LINENO: checking for struct pst_processor.psp_iticksperclktick" >&5
+echo $ECHO_N "checking for struct pst_processor.psp_iticksperclktick... $ECHO_C" >&6; }
+if test "${ac_cv_member_struct_pst_processor_psp_iticksperclktick+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/pstat.h>
-$as_echo "#define HAVE_PSP_ITICKSPERCLKTICK 1" >>confdefs.h
+int
+main ()
+{
+static struct pst_processor ac_aggr;
+if (ac_aggr.psp_iticksperclktick)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_pst_processor_psp_iticksperclktick=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <sys/pstat.h>
+
+int
+main ()
+{
+static struct pst_processor ac_aggr;
+if (sizeof ac_aggr.psp_iticksperclktick)
+return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_member_struct_pst_processor_psp_iticksperclktick=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_member_struct_pst_processor_psp_iticksperclktick=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_member_struct_pst_processor_psp_iticksperclktick" >&5
+echo "${ECHO_T}$ac_cv_member_struct_pst_processor_psp_iticksperclktick" >&6; }
+if test $ac_cv_member_struct_pst_processor_psp_iticksperclktick = yes; then
+
+cat >>confdefs.h <<\_ACEOF
+#define HAVE_PSP_ITICKSPERCLKTICK 1
+_ACEOF
fi
@@ -23988,21 +29167,206 @@ ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
# std::locale - not in g++ 2.95.4
#
+
for ac_header in sstream
-do :
- ac_fn_cxx_check_header_mongrel "$LINENO" "sstream" "ac_cv_header_sstream" "$ac_includes_default"
-if test "x$ac_cv_header_sstream" = xyes; then :
+do
+as_ac_Header=`echo "ac_cv_header_$ac_header" | $as_tr_sh`
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ { echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking $ac_header usability" >&5
+echo $ECHO_N "checking $ac_header usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <$ac_header>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking $ac_header presence" >&5
+echo $ECHO_N "checking $ac_header presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <$ac_header>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_cxx_preproc_warn_flag$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_cxx_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: $ac_header: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: $ac_header: present but cannot be compiled" >&5
+echo "$as_me: WARNING: $ac_header: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: $ac_header: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: $ac_header: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: $ac_header: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: $ac_header: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_header: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: $ac_header: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ---------------------------------- ##
+## Report this to gmp-bugs@gmplib.org ##
+## ---------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for $ac_header" >&5
+echo $ECHO_N "checking for $ac_header... $ECHO_C" >&6; }
+if { as_var=$as_ac_Header; eval "test \"\${$as_var+set}\" = set"; }; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ eval "$as_ac_Header=\$ac_header_preproc"
+fi
+ac_res=`eval echo '${'$as_ac_Header'}'`
+ { echo "$as_me:$LINENO: result: $ac_res" >&5
+echo "${ECHO_T}$ac_res" >&6; }
+
+fi
+if test `eval echo '${'$as_ac_Header'}'` = yes; then
cat >>confdefs.h <<_ACEOF
-#define HAVE_SSTREAM 1
+#define `echo "HAVE_$ac_header" | $as_tr_cpp` 1
_ACEOF
fi
done
- ac_fn_cxx_check_type "$LINENO" "std::locale" "ac_cv_type_std__locale" "#include <locale>
-"
-if test "x$ac_cv_type_std__locale" = xyes; then :
+ { echo "$as_me:$LINENO: checking for std::locale" >&5
+echo $ECHO_N "checking for std::locale... $ECHO_C" >&6; }
+if test "${ac_cv_type_std__locale+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <locale>
+
+typedef std::locale ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_cxx_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_std__locale=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_std__locale=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_std__locale" >&5
+echo "${ECHO_T}$ac_cv_type_std__locale" >&6; }
+if test $ac_cv_type_std__locale = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_STD__LOCALE 1
@@ -24029,67 +29393,43 @@ fi
# can provide some functions too. (mpn/Makefile.am passes
# -DOPERATION_<func> to get them to generate the right code.)
+# Note: The following lines defining $gmp_mpn_functions_optional
+# and $gmp_mpn_functions are parsed by the "macos/configure"
+# Perl script. So if you change the lines in a major way
+# make sure to run and examine the output from
+#
+# % (cd macos; perl configure)
+#
# Note: $gmp_mpn_functions must have mod_1 before pre_mod_1 so the former
# can optionally provide the latter as an extra entrypoint. Likewise
# divrem_1 and pre_divrem_1.
-gmp_mpn_functions_optional="umul udiv \
- invert_limb sqr_diagonal sqr_diag_addlsh1 \
- mul_2 mul_3 mul_4 mul_5 mul_6 \
+gmp_mpn_functions_optional="umul udiv copyi copyd com_n
+ and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \
+ invert_limb sqr_diagonal \
+ mul_2 mul_3 mul_4 \
addmul_2 addmul_3 addmul_4 addmul_5 addmul_6 addmul_7 addmul_8 \
- addlsh1_n sublsh1_n rsblsh1_n rsh1add_n rsh1sub_n \
- addlsh2_n sublsh2_n rsblsh2_n \
- addlsh_n sublsh_n rsblsh_n \
- add_n_sub_n addaddmul_1msb0"
+ addlsh1_n sublsh1_n rsh1add_n rsh1sub_n addsub_n addaddmul_1msb0 lshiftc"
gmp_mpn_functions="$extra_functions \
- 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 \
+ add add_1 add_n sub sub_1 sub_n neg_n mul_1 addmul_1 \
+ submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
- mod_1_1 mod_1_2 mod_1_3 mod_1_4 lshiftc \
- mul mul_fft mul_n sqr mul_basecase sqr_basecase nussbaumer_mul \
- mulmid_basecase toom42_mulmid mulmid_n mulmid \
- random random2 pow_1 \
- rootrem sqrtrem sizeinbase get_str set_str \
- scan0 scan1 popcount hamdist cmp \
- perfsqr perfpow \
- gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step \
- gcdext_lehmer \
- div_q tdiv_qr jacbase jacobi_2 jacobi get_d \
- matrix22_mul matrix22_mul1_inverse_vector \
- hgcd_matrix hgcd2 hgcd_step hgcd_reduce hgcd hgcd_appr \
- hgcd2_jacobi hgcd_jacobi \
- mullo_n mullo_basecase \
- toom22_mul toom32_mul toom42_mul toom52_mul toom62_mul \
- toom33_mul toom43_mul toom53_mul toom54_mul toom63_mul \
- toom44_mul \
- toom6h_mul toom6_sqr toom8h_mul toom8_sqr \
- toom_couple_handling \
+ mod_1_1 mod_1_2 mod_1_3 mod_1_4 \
+ mul mul_fft mul_n mul_basecase sqr_basecase random random2 pow_1 \
+ rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \
+ bdivmod gcd_1 gcd gcdext_1 gcdext gcd_lehmer gcd_subdiv_step \
+ gcdext_lehmer gcdext_subdiv_step \
+ tdiv_qr dc_divrem_n sb_divrem_mn jacbase get_d \
+ matrix22_mul hgcd2 hgcd mullow_n mullow_basecase \
+ toom22_mul toom33_mul toom44_mul \
+ toom32_mul toom42_mul toom62_mul toom53_mul \
toom2_sqr toom3_sqr toom4_sqr \
- toom_eval_dgr3_pm1 toom_eval_dgr3_pm2 \
- toom_eval_pm1 toom_eval_pm2 toom_eval_pm2exp toom_eval_pm2rexp \
- 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 \
+ toom_interpolate_5pts toom_interpolate_7pts invert binvert \
+ sb_div_qr sb_divappr_q sb_div_q dc_div_qr dc_divappr_q dc_div_q \
mu_div_qr mu_divappr_q mu_div_q \
- bdiv_q_1 \
- sbpi1_bdiv_q sbpi1_bdiv_qr \
- 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 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 sec_tabselect \
- comb_tables \
+ sb_bdiv_q sb_bdiv_qr dc_bdiv_q dc_bdiv_qr mu_bdiv_q mu_bdiv_qr \
+ divexact bdiv_dbm1c redc_1 redc_2 powm powlo powm_sec subcnd_n \
$gmp_mpn_functions_optional"
@@ -24131,10 +29471,10 @@ esac
# setup that structure, on a per-directory basis ready for
# mpn/<cpu>/fat/fat.c.
#
-# fat.h includes thresholds listed in $fat_thresholds, extracted from
+# fat.h includes thesholds listed in $fat_thresholds, extracted from
# gmp-mparam.h in each directory. An overall maximum for each threshold is
# established, for use in making fixed size arrays of temporary space.
-# (Eg. MUL_TOOM33_THRESHOLD_LIMIT used by mpn/generic/mul.c.)
+# (Eg. MUL_TOOM3_THRESHOLD_LIMIT used by mpn/generic/mul.c.)
#
# It'd be possible to do some of this manually, but when there's more than a
# few functions and a few directories it becomes very tedious, and very
@@ -24152,7 +29492,9 @@ if test -n "$fat_path"; then
echo " Generated by configure - DO NOT EDIT. */" >>fat.h
-$as_echo "#define WANT_FAT_BINARY 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define WANT_FAT_BINARY 1
+_ACEOF
echo 'define(<WANT_FAT_BINARY>, <yes>)' >>$gmp_tmpconfigm4
@@ -24187,14 +29529,6 @@ gmp_mpn_functions_optional=$remove_from_list_tmp
pre_divrem_1) tmp_fbase=preinv_divrem_1 ;;
mode1o) tmp_fbase=modexact_1c_odd ;;
pre_mod_1) tmp_fbase=preinv_mod_1 ;;
- mod_1_1) tmp_fbase=mod_1_1p ;;
- mod_1_1_cps) tmp_fbase=mod_1_1p_cps ;;
- mod_1_2) tmp_fbase=mod_1s_2p ;;
- mod_1_2_cps) tmp_fbase=mod_1s_2p_cps ;;
- mod_1_3) tmp_fbase=mod_1s_3p ;;
- mod_1_3_cps) tmp_fbase=mod_1s_3p_cps ;;
- mod_1_4) tmp_fbase=mod_1s_4p ;;
- mod_1_4_cps) tmp_fbase=mod_1s_4p_cps ;;
*) tmp_fbase=$tmp_fn ;;
esac
@@ -24206,7 +29540,7 @@ esac
DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
# encourage various macros to use fat functions
cat >>confdefs.h <<_ACEOF
-#define HAVE_NATIVE_mpn_$tmp_fbase 1
+#define HAVE_NATIVE_$tmp_fbase 1
_ACEOF
done
@@ -24215,13 +29549,13 @@ _ACEOF
echo "/* variable thresholds */" >>fat.h
for tmp_tn in $fat_thresholds; do
echo "#undef $tmp_tn" >>fat.h
- echo "#define $tmp_tn CPUVEC_THRESHOLD (`echo $tmp_tn | tr [A-Z] [a-z]`)" >>fat.h
+ echo "#define $tmp_tn CPUVEC_THRESHOLD (`echo $tmp_tn | tr A-Z a-z`)" >>fat.h
done
echo "
/* Copy all fields into __gmpn_cpuvec.
memcpy is not used because it might operate byte-wise (depending on its
- implementation), and we need the function pointer writes to be atomic.
+ implemenation), and we need the function pointer writes to be atomic.
"volatile" discourages the compiler from trying to optimize this. */
#define CPUVEC_INSTALL(vec) \\
do { \\
@@ -24233,21 +29567,13 @@ _ACEOF
pre_divrem_1) tmp_fbase=preinv_divrem_1 ;;
mode1o) tmp_fbase=modexact_1c_odd ;;
pre_mod_1) tmp_fbase=preinv_mod_1 ;;
- mod_1_1) tmp_fbase=mod_1_1p ;;
- mod_1_1_cps) tmp_fbase=mod_1_1p_cps ;;
- mod_1_2) tmp_fbase=mod_1s_2p ;;
- mod_1_2_cps) tmp_fbase=mod_1s_2p_cps ;;
- mod_1_3) tmp_fbase=mod_1s_3p ;;
- mod_1_3_cps) tmp_fbase=mod_1s_3p_cps ;;
- mod_1_4) tmp_fbase=mod_1s_4p ;;
- mod_1_4_cps) tmp_fbase=mod_1s_4p_cps ;;
*) tmp_fbase=$tmp_fn ;;
esac
echo " p->$tmp_fbase = vec.$tmp_fbase; \\" >>fat.h
done
for tmp_tn in $fat_thresholds; do
- tmp_field_name=`echo $tmp_tn | tr [A-Z] [a-z]`
+ tmp_field_name=`echo $tmp_tn | tr A-Z a-z`
echo " p->$tmp_field_name = vec.$tmp_field_name; \\" >>fat.h
done
echo " } while (0)" >>fat.h
@@ -24263,21 +29589,13 @@ esac
pre_divrem_1) tmp_fbase=preinv_divrem_1 ;;
mode1o) tmp_fbase=modexact_1c_odd ;;
pre_mod_1) tmp_fbase=preinv_mod_1 ;;
- mod_1_1) tmp_fbase=mod_1_1p ;;
- mod_1_1_cps) tmp_fbase=mod_1_1p_cps ;;
- mod_1_2) tmp_fbase=mod_1s_2p ;;
- mod_1_2_cps) tmp_fbase=mod_1s_2p_cps ;;
- mod_1_3) tmp_fbase=mod_1s_3p ;;
- mod_1_3_cps) tmp_fbase=mod_1s_3p_cps ;;
- mod_1_4) tmp_fbase=mod_1s_4p ;;
- mod_1_4_cps) tmp_fbase=mod_1s_4p_cps ;;
*) tmp_fbase=$tmp_fn ;;
esac
echo " ASSERT (vec.$tmp_fbase != NULL); \\" >>fat.h
done
for tmp_tn in $fat_thresholds; do
- tmp_field_name=`echo $tmp_tn | tr [A-Z] [a-z]`
+ tmp_field_name=`echo $tmp_tn | tr A-Z a-z`
echo " ASSERT (vec.$tmp_field_name != 0); \\" >>fat.h
done
echo " } while (0)" >>fat.h
@@ -24287,7 +29605,7 @@ esac
#define ITERATE_FAT_THRESHOLDS() \\
do { \\" >>fat.h
for tmp_tn in $fat_thresholds; do
- tmp_field_name=`echo $tmp_tn | tr [A-Z] [a-z]`
+ tmp_field_name=`echo $tmp_tn | tr A-Z a-z`
echo " ITERATE ($tmp_tn, $tmp_field_name); \\" >>fat.h
done
echo " } while (0)" >>fat.h
@@ -24315,7 +29633,7 @@ esac
esac
# Extract desired thresholds from gmp-mparam.h file in this directory,
- # if present.
+ # if prsent.
tmp_mparam=$srcdir/mpn/$tmp_dir/gmp-mparam.h
if test -f $tmp_mparam; then
for tmp_tn in $fat_thresholds; do
@@ -24323,7 +29641,7 @@ esac
if test -n "$tmp_thresh"; then
THRESH_ASM_SETUP="${THRESH_ASM_SETUP}define($tmp_tn,$tmp_thresh)
"
- CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.`echo $tmp_tn | tr [A-Z] [a-z]` = $tmp_thresh; \\
+ CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.`echo $tmp_tn | tr A-Z a-z` = $tmp_thresh; \\
"
eval tmp_limit=\$${tmp_tn}_LIMIT
if test -z "$tmp_limit"; then
@@ -24341,46 +29659,15 @@ esac
tmp_mulfunc=
case $tmp_fn in
add_n|sub_n) tmp_mulfunc="aors_n" ;;
- add_err1_n|sub_err1_n)
- tmp_mulfunc="aors_err1_n" ;;
- add_err2_n|sub_err2_n)
- tmp_mulfunc="aors_err2_n" ;;
- add_err3_n|sub_err3_n)
- tmp_mulfunc="aors_err3_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 aorsorrlsh1_n";;
- sublsh1_n)
- tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";;
- rsblsh1_n)
- tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";;
- addlsh2_n)
- tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";;
- sublsh2_n)
- tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";;
- rsblsh2_n)
- tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";;
- addlsh_n)
- tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";;
- sublsh_n)
- tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";;
- rsblsh_n)
- tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";;
+ addlsh1_n|sublsh1_n)
+ tmp_mulfunc="aorslsh1_n";;
rsh1add_n|rsh1sub_n)
tmp_mulfunc="rsh1aors_n";;
- sec_div_qr|sec_div_r)
- tmp_mulfunc="sec_div";;
- sec_pi1_div_qr|sec_pi1_div_r)
- tmp_mulfunc="sec_pi1_div";;
esac
@@ -24389,17 +29676,6 @@ esac
tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext
if test -f $tmp_file; then
- # If the host uses a non-standard ABI, check if tmp_file supports it
- #
- if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then
- abi=`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `
- if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then
- true
- else
- continue
- fi
- fi
-
mpn_objects="$mpn_objects ${tmp_prefix}_$tmp_fn.lo"
mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/${tmp_prefix}_$tmp_fn.lo"
@@ -24409,14 +29685,6 @@ esac
pre_divrem_1) tmp_fbase=preinv_divrem_1 ;;
mode1o) tmp_fbase=modexact_1c_odd ;;
pre_mod_1) tmp_fbase=preinv_mod_1 ;;
- mod_1_1) tmp_fbase=mod_1_1p ;;
- mod_1_1_cps) tmp_fbase=mod_1_1p_cps ;;
- mod_1_2) tmp_fbase=mod_1s_2p ;;
- mod_1_2_cps) tmp_fbase=mod_1s_2p_cps ;;
- mod_1_3) tmp_fbase=mod_1s_3p ;;
- mod_1_3_cps) tmp_fbase=mod_1s_3p_cps ;;
- mod_1_4) tmp_fbase=mod_1s_4p ;;
- mod_1_4_cps) tmp_fbase=mod_1s_4p_cps ;;
*) tmp_fbase=$tmp_fn ;;
esac
@@ -24447,7 +29715,6 @@ define(OPERATION_$tmp_fn)
define(__gmpn_$tmp_fbase, __gmpn_${tmp_fbase}_$tmp_suffix)
define(__gmpn_$tmp_fbasec,__gmpn_${tmp_fbasec}_${tmp_suffix})
define(__gmpn_preinv_${tmp_fbase},__gmpn_preinv_${tmp_fbase}_${tmp_suffix})
-define(__gmpn_${tmp_fbase}_cps,__gmpn_${tmp_fbase}_cps_${tmp_suffix})
$tmp_d_n_l For k6 and k7 gcd_1 calling their corresponding mpn_modexact_1_odd
ifdef(\`__gmpn_modexact_1_odd',,
@@ -24465,7 +29732,6 @@ include($mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.asm)
#define __gmpn_$tmp_fbase __gmpn_${tmp_fbase}_$tmp_suffix
#define __gmpn_$tmp_fbasec __gmpn_${tmp_fbasec}_${tmp_suffix}
#define __gmpn_preinv_${tmp_fbase} __gmpn_preinv_${tmp_fbase}_${tmp_suffix}
-#define __gmpn_${tmp_fbase}_cps __gmpn_${tmp_fbase}_cps_${tmp_suffix}
#include \"$mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.c\"
" >mpn/${tmp_prefix}_$tmp_fn.c
@@ -24482,13 +29748,6 @@ include($mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.asm)
CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.preinv_$tmp_fbase = __gmpn_preinv_${tmp_fbase}_${tmp_suffix}; \\
"
fi
-
- # Ditto for any mod_1...cps variant
- if grep "^PROLOGUE(mpn_${tmp_fbase}_cps)" $tmp_file >/dev/null; then
- echo "DECL_${tmp_fbase}_cps (__gmpn_${tmp_fbase}_cps_$tmp_suffix);" >>fat.h
- CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.${tmp_fbase}_cps = __gmpn_${tmp_fbase}_cps_${tmp_suffix}; \\
-"
- fi
fi
done
done
@@ -24535,46 +29794,15 @@ for tmp_fn in $gmp_mpn_functions; do
tmp_mulfunc=
case $tmp_fn in
add_n|sub_n) tmp_mulfunc="aors_n" ;;
- add_err1_n|sub_err1_n)
- tmp_mulfunc="aors_err1_n" ;;
- add_err2_n|sub_err2_n)
- tmp_mulfunc="aors_err2_n" ;;
- add_err3_n|sub_err3_n)
- tmp_mulfunc="aors_err3_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 aorsorrlsh1_n";;
- sublsh1_n)
- tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";;
- rsblsh1_n)
- tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";;
- addlsh2_n)
- tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";;
- sublsh2_n)
- tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";;
- rsblsh2_n)
- tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";;
- addlsh_n)
- tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";;
- sublsh_n)
- tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";;
- rsblsh_n)
- tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";;
+ addlsh1_n|sublsh1_n)
+ tmp_mulfunc="aorslsh1_n";;
rsh1add_n|rsh1sub_n)
tmp_mulfunc="rsh1aors_n";;
- sec_div_qr|sec_div_r)
- tmp_mulfunc="sec_div";;
- sec_pi1_div_qr|sec_pi1_div_r)
- tmp_mulfunc="sec_pi1_div";;
esac
@@ -24631,17 +29859,6 @@ esac
esac
fi
- # If the host uses a non-standard ABI, check if tmp_file supports it
- #
- if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then
- abi=`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `
- if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then
- true
- else
- continue
- fi
- fi
-
found=yes
eval found_$tmp_ext=yes
@@ -24691,7 +29908,9 @@ _ACEOF
fi
done
if test $found = no; then
- as_fn_error $? "no version of $tmp_fn found in path: $path" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: no version of $tmp_fn found in path: $path" >&5
+echo "$as_me: error: no version of $tmp_fn found in path: $path" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
done
@@ -24705,13 +29924,14 @@ fi
+
# Don't demand an m4 unless it's actually needed.
if test $found_asm = yes; then
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for suitable m4" >&5
-$as_echo_n "checking for suitable m4... " >&6; }
-if ${gmp_cv_prog_m4+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for suitable m4" >&5
+echo $ECHO_N "checking for suitable m4... $ECHO_C" >&6; }
+if test "${gmp_cv_prog_m4+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$M4"; then
gmp_cv_prog_m4="$M4"
@@ -24721,9 +29941,7 @@ 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(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
+')ifelse(t1`'t2,YY,`good
')
EOF
echo "trying m4" >&5
@@ -24746,22 +29964,24 @@ EOF
done
IFS="$ac_save_ifs"
if test -z "$gmp_cv_prog_m4"; then
- as_fn_error $? "No usable m4 in \$PATH or /usr/5bin (see config.log for reasons)." "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: No usable m4 in \$PATH or /usr/5bin (see config.log for reasons)." >&5
+echo "$as_me: error: No usable m4 in \$PATH or /usr/5bin (see config.log for reasons)." >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
rm -f conftest.m4
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_prog_m4" >&5
-$as_echo "$gmp_cv_prog_m4" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_prog_m4" >&5
+echo "${ECHO_T}$gmp_cv_prog_m4" >&6; }
M4="$gmp_cv_prog_m4"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if m4wrap produces spurious output" >&5
-$as_echo_n "checking if m4wrap produces spurious output... " >&6; }
-if ${gmp_cv_m4_m4wrap_spurious+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if m4wrap produces spurious output" >&5
+echo $ECHO_N "checking if m4wrap produces spurious output... $ECHO_C" >&6; }
+if test "${gmp_cv_m4_m4wrap_spurious+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# hide the d-n-l from autoconf's error checking
tmp_d_n_l=d""nl
@@ -24780,17 +30000,14 @@ else
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_m4_m4wrap_spurious" >&5
-$as_echo "$gmp_cv_m4_m4wrap_spurious" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_m4_m4wrap_spurious" >&5
+echo "${ECHO_T}$gmp_cv_m4_m4wrap_spurious" >&6; }
echo "define(<M4WRAP_SPURIOUS>,<$gmp_cv_m4_m4wrap_spurious>)" >> $gmp_tmpconfigm4
-# else
-# It's unclear why this m4-not-needed stuff was ever done.
-# if test -z "$M4" ; then
-# M4=m4-not-needed
-# fi
+else
+ M4=m4-not-needed
fi
# Only do the GMP_ASM checks if there's a .S or .asm wanting them.
@@ -24799,10 +30016,10 @@ if test $found_asm = no && test $found_S = no; then
fi
if test "$gmp_asm_syntax_testing" != no; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to switch to text section" >&5
-$as_echo_n "checking how to switch to text section... " >&6; }
-if ${gmp_cv_asm_text+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking how to switch to text section" >&5
+echo $ECHO_N "checking how to switch to text section... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_text+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
for i in ".text" ".code" ".csect .text[PR]"; do
echo "trying $i" >&5
@@ -24810,11 +30027,11 @@ else
$i
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_text=$i
rm -f conftest*
@@ -24829,18 +30046,20 @@ rm -f conftest*
done
if test -z "$gmp_cv_asm_text"; then
- as_fn_error $? "Cannot determine text section directive" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot determine text section directive" >&5
+echo "$as_me: error: Cannot determine text section directive" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_text" >&5
-$as_echo "$gmp_cv_asm_text" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_text" >&5
+echo "${ECHO_T}$gmp_cv_asm_text" >&6; }
echo "define(<TEXT>, <$gmp_cv_asm_text>)" >> $gmp_tmpconfigm4
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking how to switch to data section" >&5
-$as_echo_n "checking how to switch to data section... " >&6; }
-if ${gmp_cv_asm_data+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking how to switch to data section" >&5
+echo $ECHO_N "checking how to switch to data section... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_data+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $host in
*-*-aix*) gmp_cv_asm_data=".csect .data[RW]" ;;
@@ -24848,15 +30067,15 @@ else
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_data" >&5
-$as_echo "$gmp_cv_asm_data" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_data" >&5
+echo "${ECHO_T}$gmp_cv_asm_data" >&6; }
echo "define(<DATA>, <$gmp_cv_asm_data>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler label suffix" >&5
-$as_echo_n "checking for assembler label suffix... " >&6; }
-if ${gmp_cv_asm_label_suffix+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for assembler label suffix" >&5
+echo $ECHO_N "checking for assembler label suffix... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_label_suffix+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_asm_label_suffix=unknown
for i in "" ":"; do
@@ -24866,11 +30085,11 @@ for i in "" ":"; do
somelabel$i
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_label_suffix=$i
rm -f conftest*
@@ -24885,19 +30104,21 @@ rm -f conftest*
done
if test "$gmp_cv_asm_label_suffix" = "unknown"; then
- as_fn_error $? "Cannot determine label suffix" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot determine label suffix" >&5
+echo "$as_me: error: Cannot determine label suffix" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_label_suffix" >&5
-$as_echo "$gmp_cv_asm_label_suffix" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_label_suffix" >&5
+echo "${ECHO_T}$gmp_cv_asm_label_suffix" >&6; }
echo "define(<LABEL_SUFFIX>, <$gmp_cv_asm_label_suffix>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler global directive" >&5
-$as_echo_n "checking for assembler global directive... " >&6; }
-if ${gmp_cv_asm_globl+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for assembler global directive" >&5
+echo $ECHO_N "checking for assembler global directive... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_globl+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $host in
hppa*-*-*) gmp_cv_asm_globl=.export ;;
@@ -24906,15 +30127,15 @@ else
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_globl" >&5
-$as_echo "$gmp_cv_asm_globl" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_globl" >&5
+echo "${ECHO_T}$gmp_cv_asm_globl" >&6; }
echo "define(<GLOBL>, <$gmp_cv_asm_globl>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler global directive attribute" >&5
-$as_echo_n "checking for assembler global directive attribute... " >&6; }
-if ${gmp_cv_asm_globl_attr+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for assembler global directive attribute" >&5
+echo $ECHO_N "checking for assembler global directive attribute... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_globl_attr+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $gmp_cv_asm_globl in
.export) gmp_cv_asm_globl_attr=",entry" ;;
@@ -24922,26 +30143,26 @@ else
esac
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_globl_attr" >&5
-$as_echo "$gmp_cv_asm_globl_attr" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_globl_attr" >&5
+echo "${ECHO_T}$gmp_cv_asm_globl_attr" >&6; }
echo "define(<GLOBL_ATTR>, <$gmp_cv_asm_globl_attr>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if globals are prefixed by underscore" >&5
-$as_echo_n "checking if globals are prefixed by underscore... " >&6; }
-if ${gmp_cv_asm_underscore+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if globals are prefixed by underscore" >&5
+echo $ECHO_N "checking if globals are prefixed by underscore... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_underscore+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_asm_underscore="unknown"
cat >conftest.c <<EOF
int gurkmacka;
EOF
gmp_compile="$CC $CFLAGS $CPPFLAGS -c conftest.c >&5"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
$NM conftest.$OBJEXT >conftest.out
if grep _gurkmacka conftest.out >/dev/null; then
gmp_cv_asm_underscore=yes
@@ -24958,8 +30179,8 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_underscore" >&5
-$as_echo "$gmp_cv_asm_underscore" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_underscore" >&5
+echo "${ECHO_T}$gmp_cv_asm_underscore" >&6; }
case $gmp_cv_asm_underscore in
yes)
@@ -24970,24 +30191,24 @@ echo 'define(<GSYM_PREFIX>, <_>)' >>$gmp_tmpconfigm4
echo 'define(<GSYM_PREFIX>, <>)' >>$gmp_tmpconfigm4
;;
*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +----------------------------------------------------------" >&5
-$as_echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | Cannot determine global symbol prefix." >&5
-$as_echo "$as_me: WARNING: | Cannot determine global symbol prefix." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | $NM output doesn't contain a global data symbol." >&5
-$as_echo "$as_me: WARNING: | $NM output doesn't contain a global data symbol." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | Will proceed with no underscore." >&5
-$as_echo "$as_me: WARNING: | Will proceed with no underscore." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | If this is wrong then you'll get link errors referring" >&5
-$as_echo "$as_me: WARNING: | If this is wrong then you'll get link errors referring" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | to ___gmpn_add_n (note three underscores)." >&5
-$as_echo "$as_me: WARNING: | to ___gmpn_add_n (note three underscores)." >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | In this case do a fresh build with an override," >&5
-$as_echo "$as_me: WARNING: | In this case do a fresh build with an override," >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: | ./configure gmp_cv_asm_underscore=yes" >&5
-$as_echo "$as_me: WARNING: | ./configure gmp_cv_asm_underscore=yes" >&2;}
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: +----------------------------------------------------------" >&5
-$as_echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Cannot determine global symbol prefix." >&5
+echo "$as_me: WARNING: | Cannot determine global symbol prefix." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | $NM output doesn't contain a global data symbol." >&5
+echo "$as_me: WARNING: | $NM output doesn't contain a global data symbol." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | Will proceed with no underscore." >&5
+echo "$as_me: WARNING: | Will proceed with no underscore." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | If this is wrong then you'll get link errors referring" >&5
+echo "$as_me: WARNING: | If this is wrong then you'll get link errors referring" >&2;}
+ { echo "$as_me:$LINENO: WARNING: | to ___gmpn_add_n (note three underscores)." >&5
+echo "$as_me: WARNING: | to ___gmpn_add_n (note three underscores)." >&2;}
+ { echo "$as_me:$LINENO: WARNING: | In this case do a fresh build with an override," >&5
+echo "$as_me: WARNING: | In this case do a fresh build with an override," >&2;}
+ { echo "$as_me:$LINENO: WARNING: | ./configure gmp_cv_asm_underscore=yes" >&5
+echo "$as_me: WARNING: | ./configure gmp_cv_asm_underscore=yes" >&2;}
+ { echo "$as_me:$LINENO: WARNING: +----------------------------------------------------------" >&5
+echo "$as_me: WARNING: +----------------------------------------------------------" >&2;}
echo 'define(<GSYM_PREFIX>, <>)' >>$gmp_tmpconfigm4
@@ -24998,31 +30219,30 @@ esac
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to switch to read-only data section" >&5
-$as_echo_n "checking how to switch to read-only data section... " >&6; }
-if ${gmp_cv_asm_rodata+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking how to switch to read-only data section" >&5
+echo $ECHO_N "checking how to switch to read-only data section... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_rodata+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $host in
-i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | atom-*-* | x86_64-*-*)
+i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | x86_64-*-*)
gmp_cv_asm_rodata="$gmp_cv_asm_data" ;;
*)
gmp_cv_asm_rodata="$gmp_cv_asm_text" ;;
esac
cat >conftest.c <<EOF
-extern const int foo[]; /* Suppresses C++'s suppression of foo */
-const int foo[] = {1,2,3};
+const int foo = 123;
EOF
echo "Test program:" >&5
cat conftest.c >&5
gmp_compile="$CC $CFLAGS $CPPFLAGS -S conftest.c >&5"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
echo "Compiler output:" >&5
cat conftest.s >&5
if test $gmp_cv_asm_underscore = yes; then
@@ -25052,14 +30272,14 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_rodata" >&5
-$as_echo "$gmp_cv_asm_rodata" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_rodata" >&5
+echo "${ECHO_T}$gmp_cv_asm_rodata" >&6; }
echo "define(<RODATA>, <$gmp_cv_asm_rodata>)" >> $gmp_tmpconfigm4
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler .type directive" >&5
-$as_echo_n "checking for assembler .type directive... " >&6; }
-if ${gmp_cv_asm_type+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for assembler .type directive" >&5
+echo $ECHO_N "checking for assembler .type directive... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_asm_type=
for gmp_tmp_prefix in @ \# %; do
@@ -25067,11 +30287,11 @@ for gmp_tmp_prefix in @ \# %; do
.type sym,${gmp_tmp_prefix}function
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
if grep "\.type pseudo-op used outside of \.def/\.endef ignored" conftest.out >/dev/null; then : ;
else
@@ -25090,25 +30310,25 @@ done
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_type" >&5
-$as_echo "$gmp_cv_asm_type" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_type" >&5
+echo "${ECHO_T}$gmp_cv_asm_type" >&6; }
echo "define(<TYPE>, <$gmp_cv_asm_type>)" >> $gmp_tmpconfigm4
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler .size directive" >&5
-$as_echo_n "checking for assembler .size directive... " >&6; }
-if ${gmp_cv_asm_size+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for assembler .size directive" >&5
+echo $ECHO_N "checking for assembler .size directive... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_size+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_asm_size=
cat >conftest.s <<EOF
.size sym,1
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
if grep "\.size pseudo-op used outside of \.def/\.endef ignored" conftest.out >/dev/null; then : ;
else
@@ -25124,17 +30344,17 @@ rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_size" >&5
-$as_echo "$gmp_cv_asm_size" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_size" >&5
+echo "${ECHO_T}$gmp_cv_asm_size" >&6; }
echo "define(<SIZE>, <$gmp_cv_asm_size>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler local label prefix" >&5
-$as_echo_n "checking for assembler local label prefix... " >&6; }
-if ${gmp_cv_asm_lsym_prefix+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for assembler local label prefix" >&5
+echo $ECHO_N "checking for assembler local label prefix... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_lsym_prefix+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_tmp_pre_appears=yes
for gmp_tmp_pre in L .L $L $ L$; do
@@ -25145,16 +30365,16 @@ dummy${gmp_cv_asm_label_suffix}
${gmp_tmp_pre}gurkmacka${gmp_cv_asm_label_suffix}
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
if $NM conftest.$OBJEXT >conftest.nm 2>&5; then : ; else
cat conftest.nm >&5
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: \"$NM\" failure" >&5
-$as_echo "$as_me: WARNING: \"$NM\" failure" >&2;}
+ { echo "$as_me:$LINENO: WARNING: \"$NM\" failure" >&5
+echo "$as_me: WARNING: \"$NM\" failure" >&2;}
break
fi
cat conftest.nm >&5
@@ -25187,15 +30407,15 @@ done
rm -f conftest*
if test -z "$gmp_cv_asm_lsym_prefix"; then
gmp_cv_asm_lsym_prefix=L
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cannot determine local label, using default $gmp_cv_asm_lsym_prefix" >&5
-$as_echo "$as_me: WARNING: cannot determine local label, using default $gmp_cv_asm_lsym_prefix" >&2;}
+ { echo "$as_me:$LINENO: WARNING: cannot determine local label, using default $gmp_cv_asm_lsym_prefix" >&5
+echo "$as_me: WARNING: cannot determine local label, using default $gmp_cv_asm_lsym_prefix" >&2;}
fi
# for development purposes, note whether we got a purely temporary local label
echo "Local label appears in object files: $gmp_tmp_pre_appears" >&5
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_lsym_prefix" >&5
-$as_echo "$gmp_cv_asm_lsym_prefix" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_lsym_prefix" >&5
+echo "${ECHO_T}$gmp_cv_asm_lsym_prefix" >&6; }
echo "define(<LSYM_PREFIX>, <${gmp_cv_asm_lsym_prefix}>)" >> $gmp_tmpconfigm4
cat >>confdefs.h <<_ACEOF
@@ -25205,10 +30425,10 @@ _ACEOF
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler byte directive" >&5
-$as_echo_n "checking for assembler byte directive... " >&6; }
-if ${gmp_cv_asm_byte+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for assembler byte directive" >&5
+echo $ECHO_N "checking for assembler byte directive... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_byte+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
for i in .byte data1; do
echo "trying $i" >&5
@@ -25218,11 +30438,11 @@ else
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_byte=$i
rm -f conftest*
@@ -25237,22 +30457,24 @@ rm -f conftest*
done
if test -z "$gmp_cv_asm_byte"; then
- as_fn_error $? "Cannot determine how to emit a data byte" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot determine how to emit a data byte" >&5
+echo "$as_me: error: Cannot determine how to emit a data byte" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_byte" >&5
-$as_echo "$gmp_cv_asm_byte" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_byte" >&5
+echo "${ECHO_T}$gmp_cv_asm_byte" >&6; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to define a 32-bit word" >&5
-$as_echo_n "checking how to define a 32-bit word... " >&6; }
-if ${gmp_cv_asm_w32+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking how to define a 32-bit word" >&5
+echo $ECHO_N "checking how to define a 32-bit word... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_w32+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $host in
*-*-hpux*)
@@ -25274,11 +30496,11 @@ foo$gmp_cv_asm_label_suffix
$gmp_cv_asm_byte 0
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_tmp_val=`$NM conftest.$OBJEXT | grep foo | \
sed -e 's;[[][0-9][]]\(.*\);\1;' -e 's;[^1-9]*\([0-9]*\).*;\1;'`
@@ -25299,12 +30521,14 @@ rm -f conftest*
;;
esac
if test -z "$gmp_cv_asm_w32"; then
- as_fn_error $? "cannot determine how to define a 32-bit word" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot determine how to define a 32-bit word" >&5
+echo "$as_me: error: cannot determine how to define a 32-bit word" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_w32" >&5
-$as_echo "$gmp_cv_asm_w32" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_w32" >&5
+echo "${ECHO_T}$gmp_cv_asm_w32" >&6; }
echo "define(<W32>, <$gmp_cv_asm_w32>)" >> $gmp_tmpconfigm4
@@ -25312,10 +30536,10 @@ echo "define(<W32>, <$gmp_cv_asm_w32>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if .align assembly directive is logarithmic" >&5
-$as_echo_n "checking if .align assembly directive is logarithmic... " >&6; }
-if ${gmp_cv_asm_align_log+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if .align assembly directive is logarithmic" >&5
+echo $ECHO_N "checking if .align assembly directive is logarithmic... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_align_log+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
$gmp_cv_asm_data
@@ -25327,11 +30551,11 @@ foo$gmp_cv_asm_label_suffix
$gmp_cv_asm_byte 2
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_tmp_val=`$NM conftest.$OBJEXT | grep foo | \
sed -e 's;[[][0-9][]]\(.*\);\1;' -e 's;[^1-9]*\([0-9]*\).*;\1;'`
@@ -25344,13 +30568,15 @@ else
cat conftest.out >&5
echo "configure: failed program was:" >&5
cat conftest.s >&5
- as_fn_error $? "cannot assemble alignment test" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot assemble alignment test" >&5
+echo "$as_me: error: cannot assemble alignment test" >&2;}
+ { (exit 1); exit 1; }; }
fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_align_log" >&5
-$as_echo "$gmp_cv_asm_align_log" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_align_log" >&5
+echo "${ECHO_T}$gmp_cv_asm_align_log" >&6; }
echo "define(<ALIGN_LOGARITHMIC>,<$gmp_cv_asm_align_log>)" >> $gmp_tmpconfigm4
@@ -25365,10 +30591,10 @@ echo "include_mpn(\`pa32/pa-defs.m4')" >> $gmp_tmpconfigm4i
;;
ia64*-*-* | itanium-*-* | itanium2-*-*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking whether assembler .align padding is good" >&5
-$as_echo_n "checking whether assembler .align padding is good... " >&6; }
-if ${gmp_cv_asm_ia64_align_ok+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking whether assembler .align padding is good" >&5
+echo $ECHO_N "checking whether assembler .align padding is good... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_ia64_align_ok+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.awk <<\EOF
BEGIN {
@@ -25463,27 +30689,27 @@ cat >conftest.s <<EOF
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_ia64_align_ok=`od -b conftest.$OBJEXT | $AWK -f conftest.awk`
else
cat conftest.out >&5
echo "configure: failed program was:" >&5
cat conftest.s >&5
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: oops, cannot compile test program" >&5
-$as_echo "$as_me: WARNING: oops, cannot compile test program" >&2;}
+ { echo "$as_me:$LINENO: WARNING: oops, cannot compile test program" >&5
+echo "$as_me: WARNING: oops, cannot compile test program" >&2;}
gmp_cv_asm_ia64_align_ok=yes
fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_ia64_align_ok" >&5
-$as_echo "$gmp_cv_asm_ia64_align_ok" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_ia64_align_ok" >&5
+echo "${ECHO_T}$gmp_cv_asm_ia64_align_ok" >&6; }
echo "define(<IA64_ALIGN_OK>, <\`$gmp_cv_asm_ia64_align_ok'>)" >> $gmp_tmpconfigm4
@@ -25491,10 +30717,10 @@ echo "define(<IA64_ALIGN_OK>, <\`$gmp_cv_asm_ia64_align_ok'>)" >> $gmp_tmpconfig
;;
m68k-*-* | m68[0-9][0-9][0-9]-*-*)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler instruction and register style" >&5
-$as_echo_n "checking assembler instruction and register style... " >&6; }
-if ${gmp_cv_asm_m68k_instruction+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking assembler instruction and register style" >&5
+echo $ECHO_N "checking assembler instruction and register style... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_m68k_instruction+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
for i in "addl %d0,%d1" "add.l %d0,%d1" "addl d0,d1" "add.l d0,d1"; do
cat >conftest.s <<EOF
@@ -25502,11 +30728,11 @@ else
$i
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_m68k_instruction=$i
rm -f conftest*
@@ -25521,18 +30747,22 @@ rm -f conftest*
done
if test -z "$gmp_cv_asm_m68k_instruction"; then
- as_fn_error $? "cannot determine assembler instruction and register style" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot determine assembler instruction and register style" >&5
+echo "$as_me: error: cannot determine assembler instruction and register style" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_m68k_instruction" >&5
-$as_echo "$gmp_cv_asm_m68k_instruction" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_m68k_instruction" >&5
+echo "${ECHO_T}$gmp_cv_asm_m68k_instruction" >&6; }
case $gmp_cv_asm_m68k_instruction in
"addl d0,d1") want_dot_size=no; want_register_percent=no ;;
"addl %d0,%d1") want_dot_size=no; want_register_percent=yes ;;
"add.l d0,d1") want_dot_size=yes; want_register_percent=no ;;
"add.l %d0,%d1") want_dot_size=yes; want_register_percent=yes ;;
-*) as_fn_error $? "oops, unrecognised instruction and register style" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: oops, unrecognised instruction and register style" >&5
+echo "$as_me: error: oops, unrecognised instruction and register style" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
echo "define(<WANT_REGISTER_PERCENT>, <\`$want_register_percent'>)" >> $gmp_tmpconfigm4
@@ -25543,31 +30773,35 @@ echo "define(<WANT_DOT_SIZE>, <\`$want_dot_size'>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler addressing style" >&5
-$as_echo_n "checking assembler addressing style... " >&6; }
-if ${gmp_cv_asm_m68k_addressing+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking assembler addressing style" >&5
+echo $ECHO_N "checking assembler addressing style... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_m68k_addressing+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
case $gmp_cv_asm_m68k_instruction in
addl*) movel=movel ;;
add.l*) movel=move.l ;;
-*) as_fn_error $? "oops, unrecognised gmp_cv_asm_m68k_instruction" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&5
+echo "$as_me: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
case $gmp_cv_asm_m68k_instruction in
*"%d0,%d1") dreg=%d0; areg=%a0 ;;
*"d0,d1") dreg=d0; areg=a0 ;;
-*) as_fn_error $? "oops, unrecognised gmp_cv_asm_m68k_instruction" "$LINENO" 5 ;;
+*) { { echo "$as_me:$LINENO: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&5
+echo "$as_me: error: oops, unrecognised gmp_cv_asm_m68k_instruction" >&2;}
+ { (exit 1); exit 1; }; } ;;
esac
cat >conftest.s <<EOF
$gmp_cv_asm_text
$movel $dreg, $areg@-
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_m68k_addressing=mit
else
@@ -25579,18 +30813,20 @@ else
$movel $dreg, -($areg)
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_m68k_addressing=motorola
else
cat conftest.out >&5
echo "configure: failed program was:" >&5
cat conftest.s >&5
- as_fn_error $? "cannot determine assembler addressing style" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot determine assembler addressing style" >&5
+echo "$as_me: error: cannot determine assembler addressing style" >&2;}
+ { (exit 1); exit 1; }; }
fi
rm -f conftest*
@@ -25599,17 +30835,17 @@ rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_m68k_addressing" >&5
-$as_echo "$gmp_cv_asm_m68k_addressing" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_m68k_addressing" >&5
+echo "${ECHO_T}$gmp_cv_asm_m68k_addressing" >&6; }
echo "define(<WANT_ADDRESSING>, <\`$gmp_cv_asm_m68k_addressing'>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking assembler shortest branches" >&5
-$as_echo_n "checking assembler shortest branches... " >&6; }
-if ${gmp_cv_asm_m68k_branches+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking assembler shortest branches" >&5
+echo $ECHO_N "checking assembler shortest branches... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_m68k_branches+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
for i in jra jbra bra; do
cat >conftest.s <<EOF
@@ -25618,11 +30854,11 @@ foo$gmp_cv_asm_label_suffix
$i foo
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_m68k_branches=$i
rm -f conftest*
@@ -25637,12 +30873,14 @@ rm -f conftest*
done
if test -z "$gmp_cv_asm_m68k_branches"; then
- as_fn_error $? "cannot determine assembler branching style" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot determine assembler branching style" >&5
+echo "$as_me: error: cannot determine assembler branching style" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_m68k_branches" >&5
-$as_echo "$gmp_cv_asm_m68k_branches" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_m68k_branches" >&5
+echo "${ECHO_T}$gmp_cv_asm_m68k_branches" >&6; }
echo "define(<WANT_BRANCHES>, <\`$gmp_cv_asm_m68k_branches'>)" >> $gmp_tmpconfigm4
@@ -25650,10 +30888,10 @@ echo "define(<WANT_BRANCHES>, <\`$gmp_cv_asm_m68k_branches'>)" >> $gmp_tmpconfig
;;
powerpc*-*-* | power[3-9]-*-*)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether compiler output is PIC by default" >&5
-$as_echo_n "checking whether compiler output is PIC by default... " >&6; }
-if ${gmp_cv_asm_powerpc_pic+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether compiler output is PIC by default" >&5
+echo $ECHO_N "checking whether compiler output is PIC by default... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_powerpc_pic+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_asm_powerpc_pic=yes
cat >conftest.c <<EOF
@@ -25663,11 +30901,11 @@ EOF
echo "Test program:" >&5
cat conftest.c >&5
gmp_compile="$CC $CFLAGS $CPPFLAGS -S conftest.c >&5"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
echo "Compiler output:" >&5
cat conftest.s >&5
if grep 'foo@ha' conftest.s >/dev/null 2>&5; then
@@ -25680,28 +30918,28 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_powerpc_pic" >&5
-$as_echo "$gmp_cv_asm_powerpc_pic" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_powerpc_pic" >&5
+echo "${ECHO_T}$gmp_cv_asm_powerpc_pic" >&6; }
echo "define(<PIC_ALWAYS>,<$gmp_cv_asm_powerpc_pic>)" >> $gmp_tmpconfigm4
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler needs r on registers" >&5
-$as_echo_n "checking if the assembler needs r on registers... " >&6; }
-if ${gmp_cv_asm_powerpc_r_registers+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if the assembler needs r on registers" >&5
+echo $ECHO_N "checking if the assembler needs r on registers... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_powerpc_r_registers+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
$gmp_cv_asm_text
mtctr 6
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_powerpc_r_registers=no
else
@@ -25713,18 +30951,20 @@ else
mtctr r6
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_powerpc_r_registers=yes
else
cat conftest.out >&5
echo "configure: failed program was:" >&5
cat conftest.s >&5
- as_fn_error $? "neither \"mtctr 6\" nor \"mtctr r6\" works" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: neither \"mtctr 6\" nor \"mtctr r6\" works" >&5
+echo "$as_me: error: neither \"mtctr 6\" nor \"mtctr r6\" works" >&2;}
+ { (exit 1); exit 1; }; }
fi
rm -f conftest*
@@ -25732,8 +30972,8 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_powerpc_r_registers" >&5
-$as_echo "$gmp_cv_asm_powerpc_r_registers" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_powerpc_r_registers" >&5
+echo "${ECHO_T}$gmp_cv_asm_powerpc_r_registers" >&6; }
echo "define(<WANT_R_REGISTERS>,<$gmp_cv_asm_powerpc_r_registers>)" >> $gmp_tmpconfigm4
@@ -25742,27 +30982,10 @@ 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
- mode64)
+ 64 | aix64)
echo "include_mpn(\`powerpc64/aix.m4')" >> $gmp_tmpconfigm4i
;;
*)
@@ -25803,14 +31026,14 @@ echo "include_mpn(\`powerpc32/eabi.m4')" >> $gmp_tmpconfigm4i
echo "include_mpn(\`powerpc32/aix.m4')" >> $gmp_tmpconfigm4i
;;
- *sparc*-*-*)
+ sparcv9*-*-* | ultrasparc*-*-* | sparc64-*-*)
case $ABI in
64)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler accepts \".register\"" >&5
-$as_echo_n "checking if the assembler accepts \".register\"... " >&6; }
-if ${gmp_cv_asm_sparc_register+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if the assembler accepts \".register\"" >&5
+echo $ECHO_N "checking if the assembler accepts \".register\"... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_sparc_register+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
$gmp_cv_asm_text
@@ -25818,11 +31041,11 @@ else
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_sparc_register=yes
else
@@ -25834,8 +31057,8 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_sparc_register" >&5
-$as_echo "$gmp_cv_asm_sparc_register" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_sparc_register" >&5
+echo "${ECHO_T}$gmp_cv_asm_sparc_register" >&6; }
echo "define(<HAVE_REGISTER>,<$gmp_cv_asm_sparc_register>)" >> $gmp_tmpconfigm4
@@ -25843,91 +31066,13 @@ 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-*-* | jaguar-*-* | bulldozer-*-* | piledriver-*-* | steamroller-*-* | excavator-*-* | pentium4-*-* | atom-*-* | core2-*-* | corei*-*-* | x86_64-*-* | nano-*-*)
+ i?86*-*-* | k[5-8]*-*-* | pentium*-*-* | athlon-*-* | viac3*-*-* | geode*-*-* | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*)
-{ $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; }
-if ${gmp_cv_asm_align_fill_0x90+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if the .align directive accepts an 0x90 fill in .text" >&5
+echo $ECHO_N "checking if the .align directive accepts an 0x90 fill in .text... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_align_fill_0x90+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
$gmp_cv_asm_text
@@ -25936,14 +31081,14 @@ else
.align 4, 0x90
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
if grep "Warning: Fill parameter ignored for executable section" conftest.out >/dev/null; then
- echo "Suppressing this warning by omitting 0x90" 1>&5
+ echo "Supressing this warning by omitting 0x90" 1>&5
gmp_cv_asm_align_fill_0x90=no
else
gmp_cv_asm_align_fill_0x90=yes
@@ -25957,8 +31102,8 @@ fi
rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_align_fill_0x90" >&5
-$as_echo "$gmp_cv_asm_align_fill_0x90" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_align_fill_0x90" >&5
+echo "${ECHO_T}$gmp_cv_asm_align_fill_0x90" >&6; }
echo "define(<ALIGN_FILL_0x90>,<$gmp_cv_asm_align_fill_0x90>)" >> $gmp_tmpconfigm4
@@ -25969,17 +31114,19 @@ echo "define(<ALIGN_FILL_0x90>,<$gmp_cv_asm_align_fill_0x90>)" >> $gmp_tmpconfig
echo "include_mpn(\`x86/x86-defs.m4')" >> $gmp_tmpconfigm4i
- $as_echo "#define HAVE_HOST_CPU_FAMILY_x86 1" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define HAVE_HOST_CPU_FAMILY_x86 1
+_ACEOF
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for assembler COFF type directives" >&5
-$as_echo_n "checking for assembler COFF type directives... " >&6; }
-if ${gmp_cv_asm_x86_coff_type+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for assembler COFF type directives" >&5
+echo $ECHO_N "checking for assembler COFF type directives... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_x86_coff_type+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
$gmp_cv_asm_text
@@ -25992,11 +31139,11 @@ ${tmp_gsym_prefix}foo$gmp_cv_asm_label_suffix
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_x86_coff_type=yes
else
@@ -26009,8 +31156,8 @@ rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_x86_coff_type" >&5
-$as_echo "$gmp_cv_asm_x86_coff_type" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_coff_type" >&5
+echo "${ECHO_T}$gmp_cv_asm_x86_coff_type" >&6; }
echo "define(<HAVE_COFF_TYPE>, <$gmp_cv_asm_x86_coff_type>)" >> $gmp_tmpconfigm4
@@ -26019,11 +31166,10 @@ echo "define(<HAVE_COFF_TYPE>, <$gmp_cv_asm_x86_coff_type>)" >> $gmp_tmpconfigm4
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if _GLOBAL_OFFSET_TABLE_ is prefixed by underscore" >&5
-$as_echo_n "checking if _GLOBAL_OFFSET_TABLE_ is prefixed by underscore... " >&6; }
-if ${gmp_cv_asm_x86_got_underscore+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if _GLOBAL_OFFSET_TABLE_ is prefixed by underscore" >&5
+echo $ECHO_N "checking if _GLOBAL_OFFSET_TABLE_ is prefixed by underscore... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_x86_got_underscore+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
gmp_cv_asm_x86_got_underscore="not applicable"
if test $gmp_cv_asm_underscore = yes; then
@@ -26039,11 +31185,11 @@ ${tmp_gsym_prefix}main$gmp_cv_asm_label_suffix
addl $ ${tmp_underscore}_GLOBAL_OFFSET_TABLE_, %ebx
EOF
gmp_compile="$CCAS $CFLAGS $CPPFLAGS $lt_prog_compiler_pic conftest.s >&5 && $CC $CFLAGS $CPPFLAGS $lt_prog_compiler_pic conftest.$OBJEXT >&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_compile\"") >&5
(eval $gmp_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if test "$tmp_underscore" = "_"; then
gmp_cv_asm_x86_got_underscore=yes
else
@@ -26055,8 +31201,8 @@ done
rm -f conftest* a.out b.out a.exe a_out.exe
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_x86_got_underscore" >&5
-$as_echo "$gmp_cv_asm_x86_got_underscore" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_got_underscore" >&5
+echo "${ECHO_T}$gmp_cv_asm_x86_got_underscore" >&6; }
if test "$gmp_cv_asm_x86_got_underscore" = "yes"; then
echo 'define(<GOT_GSYM_PREFIX>, <_>)' >>$gmp_tmpconfigm4
@@ -26068,21 +31214,21 @@ echo 'define(<GOT_GSYM_PREFIX>, <>)' >>$gmp_tmpconfigm4
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if the assembler takes cl with shldl" >&5
-$as_echo_n "checking if the assembler takes cl with shldl... " >&6; }
-if ${gmp_cv_asm_x86_shldl_cl+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking if the assembler takes cl with shldl" >&5
+echo $ECHO_N "checking if the assembler takes cl with shldl... $ECHO_C" >&6; }
+if test "${gmp_cv_asm_x86_shldl_cl+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
cat >conftest.s <<EOF
$gmp_cv_asm_text
shldl %cl, %eax, %ebx
EOF
gmp_assemble="$CCAS $CFLAGS $CPPFLAGS conftest.s >conftest.out 2>&1"
-if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_assemble\""; } >&5
+if { (eval echo "$as_me:$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
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
cat conftest.out >&5
gmp_cv_asm_x86_shldl_cl=yes
else
@@ -26095,8 +31241,8 @@ rm -f conftest*
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $gmp_cv_asm_x86_shldl_cl" >&5
-$as_echo "$gmp_cv_asm_x86_shldl_cl" >&6; }
+{ echo "$as_me:$LINENO: result: $gmp_cv_asm_x86_shldl_cl" >&5
+echo "${ECHO_T}$gmp_cv_asm_x86_shldl_cl" >&6; }
if test "$gmp_cv_asm_x86_shldl_cl" = "yes"; then
echo 'define(<WANT_SHLDL_CL>, <1>)' >>$gmp_tmpconfigm4
@@ -26108,49 +31254,21 @@ echo 'define(<WANT_SHLDL_CL>, <0>)' >>$gmp_tmpconfigm4
fi
case $enable_profiling in
- prof | gprof) # Check whether --enable-shared was given.
-if test "${enable_shared+set}" = set; then :
- enableval=$enable_shared; p=${PACKAGE-default}
- case $enableval in
- yes) enable_shared=yes ;;
- no) enable_shared=no ;;
- *)
- enable_shared=no
- # Look at the argument we got. We use all the common list separators.
- lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR,"
- for pkg in $enableval; do
- IFS="$lt_save_ifs"
- if test "X$pkg" = "X$p"; then
- enable_shared=yes
- fi
- done
- IFS="$lt_save_ifs"
- ;;
- esac
-else
- enable_shared=yes
-fi
-
-
-
-
-
-
+ prof | gprof)
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking how to call x86 mcount" >&5
-$as_echo_n "checking how to call x86 mcount... " >&6; }
+{ echo "$as_me:$LINENO: checking how to call x86 mcount" >&5
+echo $ECHO_N "checking how to call x86 mcount... $ECHO_C" >&6; }
cat >conftest.c <<EOF
foo(){bar();}
EOF
if test "$enable_static" = yes; then
gmp_asmout_compile="$CC $CFLAGS $CPPFLAGS -S conftest.c 1>&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_asmout_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_asmout_compile\"") >&5
(eval $gmp_asmout_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if grep '\.data' conftest.s >/dev/null; then
mcount_nonpic_reg=`sed -n '/esp/!s/.*movl.*,\(%[a-z]*\).*$/\1/p' conftest.s`
else
@@ -26158,20 +31276,24 @@ if test "$enable_static" = yes; then
fi
mcount_nonpic_call=`grep 'call.*mcount' conftest.s`
if test -z "$mcount_nonpic_call"; then
- as_fn_error $? "Cannot find mcount call for non-PIC" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot find mcount call for non-PIC" >&5
+echo "$as_me: error: Cannot find mcount call for non-PIC" >&2;}
+ { (exit 1); exit 1; }; }
fi
else
- as_fn_error $? "Cannot compile test program for non-PIC" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot compile test program for non-PIC" >&5
+echo "$as_me: error: Cannot compile test program for non-PIC" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
if test "$enable_shared" = yes; then
gmp_asmout_compile="$CC $CFLAGS $CPPFLAGS $lt_prog_compiler_pic -S conftest.c 1>&5"
- if { { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$gmp_asmout_compile\""; } >&5
+ if { (eval echo "$as_me:$LINENO: \"$gmp_asmout_compile\"") >&5
(eval $gmp_asmout_compile) 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }; then
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; then
if grep '\.data' conftest.s >/dev/null; then
case $lt_prog_compiler_pic in
*-DDLL_EXPORT*)
@@ -26187,10 +31309,14 @@ if test "$enable_shared" = yes; then
fi
mcount_pic_call=`grep 'call.*mcount' conftest.s`
if test -z "$mcount_pic_call"; then
- as_fn_error $? "Cannot find mcount call for PIC" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot find mcount call for PIC" >&5
+echo "$as_me: error: Cannot find mcount call for PIC" >&2;}
+ { (exit 1); exit 1; }; }
fi
else
- as_fn_error $? "Cannot compile test program for PIC" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Cannot compile test program for PIC" >&5
+echo "$as_me: error: Cannot compile test program for PIC" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
@@ -26208,8 +31334,8 @@ echo "define(<MCOUNT_PIC_CALL>, <\`$mcount_pic_call'>)" >> $gmp_tmpconfigm4
rm -f conftest.*
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: determined" >&5
-$as_echo "determined" >&6; }
+{ echo "$as_me:$LINENO: result: determined" >&5
+echo "${ECHO_T}determined" >&6; }
;;
esac
case $host in
@@ -26219,25 +31345,15 @@ echo "include_mpn(\`x86/darwin.m4')" >> $gmp_tmpconfigm4i
;;
esac
;;
- 64|x32)
+ 64)
echo "include_mpn(\`x86_64/x86_64-defs.m4')" >> $gmp_tmpconfigm4i
- $as_echo "#define HAVE_HOST_CPU_FAMILY_x86_64 1" >>confdefs.h
-
case $host in
*-*-darwin*)
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
;;
esac
@@ -26265,7 +31381,9 @@ for gmp_mparam_dir in $path; do
fi
done
if test -z "$gmp_mparam_source"; then
- as_fn_error $? "no version of gmp-mparam.h found in path: $path" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: no version of gmp-mparam.h found in path: $path" >&5
+echo "$as_me: error: no version of gmp-mparam.h found in path: $path" >&2;}
+ { (exit 1); exit 1; }; }
fi
# For a helpful message from tune/tuneup.c
@@ -26283,87 +31401,424 @@ _ACEOF
-# Copy relevant parameters from gmp-mparam.h to config.m4.
-# We only do this for parameters that are used by some assembly files.
+# Copy any SQR_KARATSUBA_THRESHOLD from gmp-mparam.h to config.m4.
+# Some versions of sqr_basecase.asm use this.
# Fat binaries do this on a per-file basis, so skip in that case.
#
if test -z "$fat_path"; then
- for i in SQR_TOOM2_THRESHOLD BMOD_1_TO_MOD_1_THRESHOLD SHLD_SLOW SHRD_SLOW; do
- value=`sed -n 's/^#define '$i'[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
- if test -n "$value"; then
+ tmp_gmp_karatsuba_sqr_threshold=`sed -n 's/^#define SQR_KARATSUBA_THRESHOLD[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
+ if test -n "$tmp_gmp_karatsuba_sqr_threshold"; then
-echo "define(<$i>,<$value>)" >> $gmp_tmpconfigm4
+echo "define(<SQR_KARATSUBA_THRESHOLD>,<$tmp_gmp_karatsuba_sqr_threshold>)" >> $gmp_tmpconfigm4
- fi
- done
+ fi
fi
# Sizes of some types, needed at preprocessing time.
#
-# FIXME: The assumption that GMP_LIMB_BITS is 8*sizeof(mp_limb_t) might
-# be slightly rash, but it's true everywhere we know of and ought to be true
+# FIXME: The assumption that BITS_PER_MP_LIMB is 8*sizeof(mp_limb_t) might
+# be slightly rash, but it's true everwhere we know of and ought to be true
# of any sensible system. In a generic C build, grepping LONG_BIT out of
# <limits.h> might be an alternative, for maximum portability.
#
+{ echo "$as_me:$LINENO: checking for unsigned short" >&5
+echo $ECHO_N "checking for unsigned short... $ECHO_C" >&6; }
+if test "${ac_cv_type_unsigned_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef unsigned short ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_unsigned_short=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_unsigned_short=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_short" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned_short" >&6; }
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of void *" >&5
-$as_echo_n "checking size of void *... " >&6; }
-if ${ac_cv_sizeof_void_p+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking size of unsigned short" >&5
+echo $ECHO_N "checking size of unsigned short... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_unsigned_short+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (void *))" "ac_cv_sizeof_void_p" "$ac_includes_default"; then :
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
else
- if test "$ac_cv_type_void_p" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (void *)
-See \`config.log' for more details" "$LINENO" 5; }
- else
- ac_cv_sizeof_void_p=0
- fi
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
fi
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_void_p" >&5
-$as_echo "$ac_cv_sizeof_void_p" >&6; }
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_lo= ac_hi=
+fi
-cat >>confdefs.h <<_ACEOF
-#define SIZEOF_VOID_P $ac_cv_sizeof_void_p
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned short ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
-# The cast to long int works around a bug in the HP C Compiler
-# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
-# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
-# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned short" >&5
-$as_echo_n "checking size of unsigned short... " >&6; }
-if ${ac_cv_sizeof_unsigned_short+:} false; then :
- $as_echo_n "(cached) " >&6
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_unsigned_short=$ac_lo;;
+'') if test "$ac_cv_type_unsigned_short" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_unsigned_short=0
+ fi ;;
+esac
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned short))" "ac_cv_sizeof_unsigned_short" "$ac_includes_default"; then :
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned short ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%lu\n", i);
+ }
+ return ferror (f) || fclose (f) != 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_unsigned_short=`cat conftest.val`
else
- if test "$ac_cv_type_unsigned_short" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (unsigned short)
-See \`config.log' for more details" "$LINENO" 5; }
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_unsigned_short" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned short)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
else
ac_cv_sizeof_unsigned_short=0
fi
fi
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_short" >&5
-$as_echo "$ac_cv_sizeof_unsigned_short" >&6; }
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_short" >&5
+echo "${ECHO_T}$ac_cv_sizeof_unsigned_short" >&6; }
@@ -26372,31 +31827,403 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+{ echo "$as_me:$LINENO: checking for unsigned" >&5
+echo $ECHO_N "checking for unsigned... $ECHO_C" >&6; }
+if test "${ac_cv_type_unsigned+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef unsigned ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_unsigned=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_unsigned=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned" >&6; }
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned" >&5
-$as_echo_n "checking size of unsigned... " >&6; }
-if ${ac_cv_sizeof_unsigned+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking size of unsigned" >&5
+echo $ECHO_N "checking size of unsigned... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_unsigned+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned))" "ac_cv_sizeof_unsigned" "$ac_includes_default"; then :
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
else
- if test "$ac_cv_type_unsigned" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (unsigned)
-See \`config.log' for more details" "$LINENO" 5; }
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_unsigned=$ac_lo;;
+'') if test "$ac_cv_type_unsigned" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_unsigned=0
+ fi ;;
+esac
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%lu\n", i);
+ }
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_unsigned=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_unsigned" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
else
ac_cv_sizeof_unsigned=0
fi
fi
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned" >&5
-$as_echo "$ac_cv_sizeof_unsigned" >&6; }
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned" >&5
+echo "${ECHO_T}$ac_cv_sizeof_unsigned" >&6; }
@@ -26405,31 +32232,403 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+{ echo "$as_me:$LINENO: checking for unsigned long" >&5
+echo $ECHO_N "checking for unsigned long... $ECHO_C" >&6; }
+if test "${ac_cv_type_unsigned_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+typedef unsigned long ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_unsigned_long=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_unsigned_long=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_unsigned_long" >&5
+echo "${ECHO_T}$ac_cv_type_unsigned_long" >&6; }
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of unsigned long" >&5
-$as_echo_n "checking size of unsigned long... " >&6; }
-if ${ac_cv_sizeof_unsigned_long+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking size of unsigned long" >&5
+echo $ECHO_N "checking size of unsigned long... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_unsigned_long+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned long ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (unsigned long))" "ac_cv_sizeof_unsigned_long" "$ac_includes_default"; then :
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_unsigned_long=$ac_lo;;
+'') if test "$ac_cv_type_unsigned_long" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_unsigned_long=0
+ fi ;;
+esac
else
- if test "$ac_cv_type_unsigned_long" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (unsigned long)
-See \`config.log' for more details" "$LINENO" 5; }
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+ typedef unsigned long ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%lu\n", i);
+ }
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_unsigned_long=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_unsigned_long" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (unsigned long)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
else
ac_cv_sizeof_unsigned_long=0
fi
fi
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_unsigned_long" >&5
-$as_echo "$ac_cv_sizeof_unsigned_long" >&6; }
+rm -f conftest.val
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_unsigned_long" >&5
+echo "${ECHO_T}$ac_cv_sizeof_unsigned_long" >&6; }
@@ -26438,37 +32637,452 @@ cat >>confdefs.h <<_ACEOF
_ACEOF
+{ echo "$as_me:$LINENO: checking for mp_limb_t" >&5
+echo $ECHO_N "checking for mp_limb_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_mp_limb_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
+#define GMP_LIMB_BITS 123
+$DEFN_LONG_LONG_LIMB
+#include "$srcdir/gmp-h.in"
+
+
+typedef mp_limb_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_mp_limb_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_mp_limb_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_mp_limb_t" >&5
+echo "${ECHO_T}$ac_cv_type_mp_limb_t" >&6; }
+
# The cast to long int works around a bug in the HP C Compiler
# version HP92453-01 B.11.11.23709.GP, which incorrectly rejects
# declarations like `int a3[[(sizeof (unsigned char)) >= 0]];'.
# This bug is HP SR number 8606223364.
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking size of mp_limb_t" >&5
-$as_echo_n "checking size of mp_limb_t... " >&6; }
-if ${ac_cv_sizeof_mp_limb_t+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking size of mp_limb_t" >&5
+echo $ECHO_N "checking size of mp_limb_t... $ECHO_C" >&6; }
+if test "${ac_cv_sizeof_mp_limb_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
- if ac_fn_c_compute_int "$LINENO" "(long int) (sizeof (mp_limb_t))" "ac_cv_sizeof_mp_limb_t" "#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+ if test "$cross_compiling" = yes; then
+ # Depending upon the size, compute the lo and hi bounds.
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
#define GMP_LIMB_BITS 123
$DEFN_LONG_LONG_LIMB
-#include \"$srcdir/gmp-h.in\"
+#include "$srcdir/gmp-h.in"
-"; then :
+ typedef mp_limb_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=0 ac_mid=0
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
+#define GMP_LIMB_BITS 123
+$DEFN_LONG_LONG_LIMB
+#include "$srcdir/gmp-h.in"
+
+
+ typedef mp_limb_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid; break
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr $ac_mid + 1`
+ if test $ac_lo -le $ac_mid; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
+#define GMP_LIMB_BITS 123
+$DEFN_LONG_LONG_LIMB
+#include "$srcdir/gmp-h.in"
+
+
+ typedef mp_limb_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) < 0)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=-1 ac_mid=-1
+ while :; do
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
+#define GMP_LIMB_BITS 123
+$DEFN_LONG_LONG_LIMB
+#include "$srcdir/gmp-h.in"
+
+
+ typedef mp_limb_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) >= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_lo=$ac_mid; break
else
- if test "$ac_cv_type_mp_limb_t" = yes; then
- { { $as_echo "$as_me:${as_lineno-$LINENO}: error: in \`$ac_pwd':" >&5
-$as_echo "$as_me: error: in \`$ac_pwd':" >&2;}
-as_fn_error 77 "cannot compute sizeof (mp_limb_t)
-See \`config.log' for more details" "$LINENO" 5; }
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_hi=`expr '(' $ac_mid ')' - 1`
+ if test $ac_mid -le $ac_hi; then
+ ac_lo= ac_hi=
+ break
+ fi
+ ac_mid=`expr 2 '*' $ac_mid`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+ done
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo= ac_hi=
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+# Binary search between lo and hi bounds.
+while test "x$ac_lo" != "x$ac_hi"; do
+ ac_mid=`expr '(' $ac_hi - $ac_lo ')' / 2 + $ac_lo`
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
+#define GMP_LIMB_BITS 123
+$DEFN_LONG_LONG_LIMB
+#include "$srcdir/gmp-h.in"
+
+
+ typedef mp_limb_t ac__type_sizeof_;
+int
+main ()
+{
+static int test_array [1 - 2 * !(((long int) (sizeof (ac__type_sizeof_))) <= $ac_mid)];
+test_array [0] = 0
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_hi=$ac_mid
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_lo=`expr '(' $ac_mid ')' + 1`
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+done
+case $ac_lo in
+?*) ac_cv_sizeof_mp_limb_t=$ac_lo;;
+'') if test "$ac_cv_type_mp_limb_t" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (mp_limb_t)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (mp_limb_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
+ else
+ ac_cv_sizeof_mp_limb_t=0
+ fi ;;
+esac
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#define __GMP_WITHIN_CONFIGURE 1 /* ignore template stuff */
+#define GMP_NAIL_BITS $GMP_NAIL_BITS
+#define __GMP_BITS_PER_MP_LIMB 123 /* dummy for GMP_NUMB_BITS etc */
+#define GMP_LIMB_BITS 123
+$DEFN_LONG_LONG_LIMB
+#include "$srcdir/gmp-h.in"
+
+
+ typedef mp_limb_t ac__type_sizeof_;
+static long int longval () { return (long int) (sizeof (ac__type_sizeof_)); }
+static unsigned long int ulongval () { return (long int) (sizeof (ac__type_sizeof_)); }
+#include <stdio.h>
+#include <stdlib.h>
+int
+main ()
+{
+
+ FILE *f = fopen ("conftest.val", "w");
+ if (! f)
+ return 1;
+ if (((long int) (sizeof (ac__type_sizeof_))) < 0)
+ {
+ long int i = longval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%ld\n", i);
+ }
+ else
+ {
+ unsigned long int i = ulongval ();
+ if (i != ((long int) (sizeof (ac__type_sizeof_))))
+ return 1;
+ fprintf (f, "%lu\n", i);
+ }
+ return ferror (f) || fclose (f) != 0;
+
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest$ac_exeext
+if { (ac_try="$ac_link"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && { ac_try='./conftest$ac_exeext'
+ { (case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_try") 2>&5
+ ac_status=$?
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }; }; then
+ ac_cv_sizeof_mp_limb_t=`cat conftest.val`
+else
+ echo "$as_me: program exited with status $ac_status" >&5
+echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+( exit $ac_status )
+if test "$ac_cv_type_mp_limb_t" = yes; then
+ { { echo "$as_me:$LINENO: error: cannot compute sizeof (mp_limb_t)
+See \`config.log' for more details." >&5
+echo "$as_me: error: cannot compute sizeof (mp_limb_t)
+See \`config.log' for more details." >&2;}
+ { (exit 77); exit 77; }; }
else
ac_cv_sizeof_mp_limb_t=0
fi
fi
-
+rm -f core *.core core.conftest.* gmon.out bb.out conftest$ac_exeext conftest.$ac_objext conftest.$ac_ext
+fi
+rm -f conftest.val
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_sizeof_mp_limb_t" >&5
-$as_echo "$ac_cv_sizeof_mp_limb_t" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_sizeof_mp_limb_t" >&5
+echo "${ECHO_T}$ac_cv_sizeof_mp_limb_t" >&6; }
@@ -26478,9 +33092,11 @@ _ACEOF
if test "$ac_cv_sizeof_mp_limb_t" = 0; then
- as_fn_error $? "Oops, mp_limb_t doesn't seem to work" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Oops, mp_limb_t doesn't seem to work" >&5
+echo "$as_me: error: Oops, mp_limb_t doesn't seem to work" >&2;}
+ { (exit 1); exit 1; }; }
fi
-GMP_LIMB_BITS=`expr 8 \* $ac_cv_sizeof_mp_limb_t`
+BITS_PER_MP_LIMB=`expr 8 \* $ac_cv_sizeof_mp_limb_t`
echo "define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)" >> $gmp_tmpconfigm4
@@ -26493,21 +33109,29 @@ echo "define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)" >> $gmp_tmpconfigm4
# probably wouldn't want to be fatal, none of the libgmp assembler code
# depends on ulong.
#
-mparam_bits=`sed -n 's/^#define GMP_LIMB_BITS[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`
-if test -n "$mparam_bits" && test "$mparam_bits" -ne $GMP_LIMB_BITS; then
+mparam_bits=`sed -n 's/^#define BITS_PER_MP_LIMB[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`
+if test -n "$mparam_bits" && test "$mparam_bits" -ne $BITS_PER_MP_LIMB; then
if test "$test_CFLAGS" = set; then
- as_fn_error $? "Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code
+ { { echo "$as_me:$LINENO: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code
in this configuration expects $mparam_bits bits.
You appear to have set \$CFLAGS, perhaps you also need to tell GMP the
-intended ABI, see \"ABI and ISA\" in the manual." "$LINENO" 5
+intended ABI, see \"ABI and ISA\" in the manual." >&5
+echo "$as_me: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code
+in this configuration expects $mparam_bits bits.
+You appear to have set \$CFLAGS, perhaps you also need to tell GMP the
+intended ABI, see \"ABI and ISA\" in the manual." >&2;}
+ { (exit 1); exit 1; }; }
else
- as_fn_error $? "Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code
-in this configuration expects $mparam_bits bits." "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code
+in this configuration expects $mparam_bits bits." >&5
+echo "$as_me: error: Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code
+in this configuration expects $mparam_bits bits." >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-echo "define(<GMP_LIMB_BITS>,$GMP_LIMB_BITS)" >> $gmp_tmpconfigm4
+echo "define(<GMP_LIMB_BITS>,$BITS_PER_MP_LIMB)" >> $gmp_tmpconfigm4
echo "define(<GMP_NAIL_BITS>,$GMP_NAIL_BITS)" >> $gmp_tmpconfigm4
@@ -26517,6 +33141,20 @@ echo "define(<GMP_NUMB_BITS>,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))" >> $gmp_tmpconf
+# Exclude the mpn random functions from mpbsd since that would drag in the
+# top-level rand things, all of which are unnecessary for libmp. There's
+# other unnecessary objects too actually, if we could be bothered figuring
+# out exactly which they are.
+#
+mpn_objs_in_libmp=
+for i in $mpn_objs_in_libgmp; do
+ case $i in
+ *random*) ;;
+ *) mpn_objs_in_libmp="$mpn_objs_in_libmp $i" ;;
+ esac
+done
+
+
@@ -26527,12 +33165,12 @@ TUNE_SQR_OBJ=
test -d tune || mkdir tune
case $sqr_basecase_source in
*.asm)
- sqr_max=`sed -n 's/^def...(SQR_TOOM2_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`
+ sqr_max=`sed -n 's/^def...(SQR_KARATSUBA_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`
if test -n "$sqr_max"; then
TUNE_SQR_OBJ=sqr_asm.o
cat >>confdefs.h <<_ACEOF
-#define TUNE_SQR_TOOM2_MAX $sqr_max
+#define TUNE_SQR_KARATSUBA_MAX $sqr_max
_ACEOF
fi
@@ -26543,7 +33181,9 @@ EOF
;;
*.c)
TUNE_SQR_OBJ=
- $as_echo "#define TUNE_SQR_TOOM2_MAX SQR_TOOM2_MAX_GENERIC" >>confdefs.h
+ cat >>confdefs.h <<\_ACEOF
+#define TUNE_SQR_KARATSUBA_MAX SQR_KARATSUBA_MAX_GENERIC
+_ACEOF
cat >tune/sqr_basecase.c <<EOF
#define TUNE_PROGRAM_BUILD 1
@@ -26609,9 +33249,61 @@ no) HAVE_SYS_RESOURCE_H_01=0 ;;
esac
-ac_fn_c_check_type "$LINENO" "stack_t" "ac_cv_type_stack_t" "#include <signal.h>
-"
-if test "x$ac_cv_type_stack_t" = xyes; then :
+{ echo "$as_me:$LINENO: checking for stack_t" >&5
+echo $ECHO_N "checking for stack_t... $ECHO_C" >&6; }
+if test "${ac_cv_type_stack_t+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <signal.h>
+
+typedef stack_t ac__type_new_;
+int
+main ()
+{
+if ((ac__type_new_ *) 0)
+ return 0;
+if (sizeof (ac__type_new_))
+ return 0;
+ ;
+ return 0;
+}
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_cv_type_stack_t=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_type_stack_t=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_type_stack_t" >&5
+echo "${ECHO_T}$ac_cv_type_stack_t" >&6; }
+if test $ac_cv_type_stack_t = yes; then
cat >>confdefs.h <<_ACEOF
#define HAVE_STACK_T 1
@@ -26647,14 +33339,18 @@ ac_config_files="$ac_config_files demos/calc/calc-config.h:demos/calc/calc-confi
LIBCURSES=
if test $with_readline != no; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tputs in -lncurses" >&5
-$as_echo_n "checking for tputs in -lncurses... " >&6; }
-if ${ac_cv_lib_ncurses_tputs+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for tputs in -lncurses" >&5
+echo $ECHO_N "checking for tputs in -lncurses... $ECHO_C" >&6; }
+if test "${ac_cv_lib_ncurses_tputs+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lncurses $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -26672,28 +33368,53 @@ return tputs ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_ncurses_tputs=yes
else
- ac_cv_lib_ncurses_tputs=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_ncurses_tputs=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_ncurses_tputs" >&5
-$as_echo "$ac_cv_lib_ncurses_tputs" >&6; }
-if test "x$ac_cv_lib_ncurses_tputs" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_ncurses_tputs" >&5
+echo "${ECHO_T}$ac_cv_lib_ncurses_tputs" >&6; }
+if test $ac_cv_lib_ncurses_tputs = yes; then
LIBCURSES=-lncurses
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for tputs in -lcurses" >&5
-$as_echo_n "checking for tputs in -lcurses... " >&6; }
-if ${ac_cv_lib_curses_tputs+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for tputs in -lcurses" >&5
+echo $ECHO_N "checking for tputs in -lcurses... $ECHO_C" >&6; }
+if test "${ac_cv_lib_curses_tputs+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lcurses $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -26711,18 +33432,39 @@ return tputs ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_curses_tputs=yes
else
- ac_cv_lib_curses_tputs=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_curses_tputs=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_curses_tputs" >&5
-$as_echo "$ac_cv_lib_curses_tputs" >&6; }
-if test "x$ac_cv_lib_curses_tputs" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_curses_tputs" >&5
+echo "${ECHO_T}$ac_cv_lib_curses_tputs" >&6; }
+if test $ac_cv_lib_curses_tputs = yes; then
LIBCURSES=-lcurses
fi
@@ -26733,14 +33475,18 @@ fi
use_readline=$with_readline
if test $with_readline = detect; then
use_readline=no
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking for readline in -lreadline" >&5
-$as_echo_n "checking for readline in -lreadline... " >&6; }
-if ${ac_cv_lib_readline_readline+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking for readline in -lreadline" >&5
+echo $ECHO_N "checking for readline in -lreadline... $ECHO_C" >&6; }
+if test "${ac_cv_lib_readline_readline+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_check_lib_save_LIBS=$LIBS
LIBS="-lreadline $LIBCURSES $LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
/* end confdefs.h. */
/* Override any GCC internal prototype to avoid an error.
@@ -26758,22 +33504,301 @@ return readline ();
return 0;
}
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_readline_readline=yes
else
- ac_cv_lib_readline_readline=no
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_cv_lib_readline_readline=no
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_check_lib_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_readline_readline" >&5
-$as_echo "$ac_cv_lib_readline_readline" >&6; }
-if test "x$ac_cv_lib_readline_readline" = xyes; then :
- ac_fn_c_check_header_mongrel "$LINENO" "readline/readline.h" "ac_cv_header_readline_readline_h" "$ac_includes_default"
-if test "x$ac_cv_header_readline_readline_h" = xyes; then :
- ac_fn_c_check_header_mongrel "$LINENO" "readline/history.h" "ac_cv_header_readline_history_h" "$ac_includes_default"
-if test "x$ac_cv_header_readline_history_h" = xyes; then :
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_readline_readline" >&5
+echo "${ECHO_T}$ac_cv_lib_readline_readline" >&6; }
+if test $ac_cv_lib_readline_readline = yes; then
+ if test "${ac_cv_header_readline_readline_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for readline/readline.h" >&5
+echo $ECHO_N "checking for readline/readline.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_readline_readline_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_readline_h" >&5
+echo "${ECHO_T}$ac_cv_header_readline_readline_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking readline/readline.h usability" >&5
+echo $ECHO_N "checking readline/readline.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <readline/readline.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking readline/readline.h presence" >&5
+echo $ECHO_N "checking readline/readline.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <readline/readline.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: readline/readline.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: readline/readline.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: readline/readline.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: readline/readline.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: readline/readline.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: readline/readline.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: readline/readline.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/readline.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: readline/readline.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ---------------------------------- ##
+## Report this to gmp-bugs@gmplib.org ##
+## ---------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for readline/readline.h" >&5
+echo $ECHO_N "checking for readline/readline.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_readline_readline_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_readline_readline_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_readline_h" >&5
+echo "${ECHO_T}$ac_cv_header_readline_readline_h" >&6; }
+
+fi
+if test $ac_cv_header_readline_readline_h = yes; then
+ if test "${ac_cv_header_readline_history_h+set}" = set; then
+ { echo "$as_me:$LINENO: checking for readline/history.h" >&5
+echo $ECHO_N "checking for readline/history.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_readline_history_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_history_h" >&5
+echo "${ECHO_T}$ac_cv_header_readline_history_h" >&6; }
+else
+ # Is the header compilable?
+{ echo "$as_me:$LINENO: checking readline/history.h usability" >&5
+echo $ECHO_N "checking readline/history.h usability... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+$ac_includes_default
+#include <readline/history.h>
+_ACEOF
+rm -f conftest.$ac_objext
+if { (ac_try="$ac_compile"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_compile") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest.$ac_objext; then
+ ac_header_compiler=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_compiler=no
+fi
+
+rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_compiler" >&5
+echo "${ECHO_T}$ac_header_compiler" >&6; }
+
+# Is the header present?
+{ echo "$as_me:$LINENO: checking readline/history.h presence" >&5
+echo $ECHO_N "checking readline/history.h presence... $ECHO_C" >&6; }
+cat >conftest.$ac_ext <<_ACEOF
+/* confdefs.h. */
+_ACEOF
+cat confdefs.h >>conftest.$ac_ext
+cat >>conftest.$ac_ext <<_ACEOF
+/* end confdefs.h. */
+#include <readline/history.h>
+_ACEOF
+if { (ac_try="$ac_cpp conftest.$ac_ext"
+case "(($ac_try" in
+ *\"* | *\`* | *\\*) ac_try_echo=\$ac_try;;
+ *) ac_try_echo=$ac_try;;
+esac
+eval "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_cpp conftest.$ac_ext") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } >/dev/null && {
+ test -z "$ac_c_preproc_warn_flag$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ }; then
+ ac_header_preproc=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+ ac_header_preproc=no
+fi
+
+rm -f conftest.err conftest.$ac_ext
+{ echo "$as_me:$LINENO: result: $ac_header_preproc" >&5
+echo "${ECHO_T}$ac_header_preproc" >&6; }
+
+# So? What about this header?
+case $ac_header_compiler:$ac_header_preproc:$ac_c_preproc_warn_flag in
+ yes:no: )
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: accepted by the compiler, rejected by the preprocessor!" >&5
+echo "$as_me: WARNING: readline/history.h: accepted by the compiler, rejected by the preprocessor!" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: proceeding with the compiler's result" >&5
+echo "$as_me: WARNING: readline/history.h: proceeding with the compiler's result" >&2;}
+ ac_header_preproc=yes
+ ;;
+ no:yes:* )
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: present but cannot be compiled" >&5
+echo "$as_me: WARNING: readline/history.h: present but cannot be compiled" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: check for missing prerequisite headers?" >&5
+echo "$as_me: WARNING: readline/history.h: check for missing prerequisite headers?" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: see the Autoconf documentation" >&5
+echo "$as_me: WARNING: readline/history.h: see the Autoconf documentation" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: section \"Present But Cannot Be Compiled\"" >&5
+echo "$as_me: WARNING: readline/history.h: section \"Present But Cannot Be Compiled\"" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: proceeding with the preprocessor's result" >&5
+echo "$as_me: WARNING: readline/history.h: proceeding with the preprocessor's result" >&2;}
+ { echo "$as_me:$LINENO: WARNING: readline/history.h: in the future, the compiler will take precedence" >&5
+echo "$as_me: WARNING: readline/history.h: in the future, the compiler will take precedence" >&2;}
+ ( cat <<\_ASBOX
+## ---------------------------------- ##
+## Report this to gmp-bugs@gmplib.org ##
+## ---------------------------------- ##
+_ASBOX
+ ) | sed "s/^/$as_me: WARNING: /" >&2
+ ;;
+esac
+{ echo "$as_me:$LINENO: checking for readline/history.h" >&5
+echo $ECHO_N "checking for readline/history.h... $ECHO_C" >&6; }
+if test "${ac_cv_header_readline_history_h+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
+else
+ ac_cv_header_readline_history_h=$ac_header_preproc
+fi
+{ echo "$as_me:$LINENO: result: $ac_cv_header_readline_history_h" >&5
+echo "${ECHO_T}$ac_cv_header_readline_history_h" >&6; }
+
+fi
+if test $ac_cv_header_readline_history_h = yes; then
use_readline=yes
fi
@@ -26783,10 +33808,10 @@ fi
fi
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking readline detected" >&5
-$as_echo_n "checking readline detected... " >&6; }
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $use_readline" >&5
-$as_echo "$use_readline" >&6; }
+ { echo "$as_me:$LINENO: checking readline detected" >&5
+echo $ECHO_N "checking readline detected... $ECHO_C" >&6; }
+ { echo "$as_me:$LINENO: result: $use_readline" >&5
+echo "${ECHO_T}$use_readline" >&6; }
fi
if test $use_readline = yes; then
WITH_READLINE_01=1
@@ -26800,10 +33825,10 @@ for ac_prog in 'bison -y' byacc
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_YACC+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_YACC+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$YACC"; then
ac_cv_prog_YACC="$YACC" # Let the user override the test.
@@ -26813,25 +33838,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_YACC="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
YACC=$ac_cv_prog_YACC
if test -n "$YACC"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $YACC" >&5
-$as_echo "$YACC" >&6; }
+ { echo "$as_me:$LINENO: result: $YACC" >&5
+echo "${ECHO_T}$YACC" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -26843,10 +33868,10 @@ for ac_prog in flex lex
do
# Extract the first word of "$ac_prog", so it can be a program name with args.
set dummy $ac_prog; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_LEX+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_LEX+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$LEX"; then
ac_cv_prog_LEX="$LEX" # Let the user override the test.
@@ -26856,25 +33881,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_LEX="$ac_prog"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
LEX=$ac_cv_prog_LEX
if test -n "$LEX"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $LEX" >&5
-$as_echo "$LEX" >&6; }
+ { echo "$as_me:$LINENO: result: $LEX" >&5
+echo "${ECHO_T}$LEX" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -26889,8 +33914,7 @@ a { ECHO; }
b { REJECT; }
c { yymore (); }
d { yyless (1); }
-e { /* IRIX 6.5 flex 2.5.4 underquotes its yyless argument. */
- yyless ((input () != 0)); }
+e { yyless (input () != 0); }
f { unput (yytext[0]); }
. { BEGIN INITIAL; }
%%
@@ -26903,21 +33927,20 @@ main (void)
return ! yylex () + ! yywrap ();
}
_ACEOF
-{ { ac_try="$LEX conftest.l"
+{ (ac_try="$LEX conftest.l"
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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
(eval "$LEX conftest.l") 2>&5
ac_status=$?
- $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
- test $ac_status = 0; }
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking lex output file root" >&5
-$as_echo_n "checking lex output file root... " >&6; }
-if ${ac_cv_prog_lex_root+:} false; then :
- $as_echo_n "(cached) " >&6
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); }
+{ echo "$as_me:$LINENO: checking lex output file root" >&5
+echo $ECHO_N "checking lex output file root... $ECHO_C" >&6; }
+if test "${ac_cv_prog_lex_root+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -f lex.yy.c; then
@@ -26925,48 +33948,72 @@ if test -f lex.yy.c; then
elif test -f lexyy.c; then
ac_cv_prog_lex_root=lexyy
else
- as_fn_error $? "cannot find output from $LEX; giving up" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: cannot find output from $LEX; giving up" >&5
+echo "$as_me: error: cannot find output from $LEX; giving up" >&2;}
+ { (exit 1); exit 1; }; }
fi
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_root" >&5
-$as_echo "$ac_cv_prog_lex_root" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_root" >&5
+echo "${ECHO_T}$ac_cv_prog_lex_root" >&6; }
LEX_OUTPUT_ROOT=$ac_cv_prog_lex_root
if test -z "${LEXLIB+set}"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: checking lex library" >&5
-$as_echo_n "checking lex library... " >&6; }
-if ${ac_cv_lib_lex+:} false; then :
- $as_echo_n "(cached) " >&6
+ { echo "$as_me:$LINENO: checking lex library" >&5
+echo $ECHO_N "checking lex library... $ECHO_C" >&6; }
+if test "${ac_cv_lib_lex+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
ac_save_LIBS=$LIBS
ac_cv_lib_lex='none needed'
for ac_lib in '' -lfl -ll; do
LIBS="$ac_lib $ac_save_LIBS"
- cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
+ cat >conftest.$ac_ext <<_ACEOF
`cat $LEX_OUTPUT_ROOT.c`
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_lib_lex=$ac_lib
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
test "$ac_cv_lib_lex" != 'none needed' && break
done
LIBS=$ac_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_lib_lex" >&5
-$as_echo "$ac_cv_lib_lex" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_lib_lex" >&5
+echo "${ECHO_T}$ac_cv_lib_lex" >&6; }
test "$ac_cv_lib_lex" != 'none needed' && LEXLIB=$ac_cv_lib_lex
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking whether yytext is a pointer" >&5
-$as_echo_n "checking whether yytext is a pointer... " >&6; }
-if ${ac_cv_prog_lex_yytext_pointer+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking whether yytext is a pointer" >&5
+echo $ECHO_N "checking whether yytext is a pointer... $ECHO_C" >&6; }
+if test "${ac_cv_prog_lex_yytext_pointer+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
# POSIX says lex can declare yytext either as a pointer or an array; the
# default is implementation-dependent. Figure out which it is, since
@@ -26974,25 +34021,48 @@ else
ac_cv_prog_lex_yytext_pointer=no
ac_save_LIBS=$LIBS
LIBS="$LEXLIB $ac_save_LIBS"
-cat confdefs.h - <<_ACEOF >conftest.$ac_ext
-/* end confdefs.h. */
-
- #define YYTEXT_POINTER 1
+cat >conftest.$ac_ext <<_ACEOF
+#define YYTEXT_POINTER 1
`cat $LEX_OUTPUT_ROOT.c`
_ACEOF
-if ac_fn_c_try_link "$LINENO"; then :
+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 "echo \"\$as_me:$LINENO: $ac_try_echo\"") >&5
+ (eval "$ac_link") 2>conftest.er1
+ ac_status=$?
+ grep -v '^ *+' conftest.er1 >conftest.err
+ rm -f conftest.er1
+ cat conftest.err >&5
+ echo "$as_me:$LINENO: \$? = $ac_status" >&5
+ (exit $ac_status); } && {
+ test -z "$ac_c_werror_flag" ||
+ test ! -s conftest.err
+ } && test -s conftest$ac_exeext &&
+ $as_test_x conftest$ac_exeext; then
ac_cv_prog_lex_yytext_pointer=yes
+else
+ echo "$as_me: failed program was:" >&5
+sed 's/^/| /' conftest.$ac_ext >&5
+
+
fi
-rm -f core conftest.err conftest.$ac_objext \
- conftest$ac_exeext conftest.$ac_ext
+
+rm -f core conftest.err conftest.$ac_objext conftest_ipa8_conftest.oo \
+ conftest$ac_exeext conftest.$ac_ext
LIBS=$ac_save_LIBS
fi
-{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_cv_prog_lex_yytext_pointer" >&5
-$as_echo "$ac_cv_prog_lex_yytext_pointer" >&6; }
+{ echo "$as_me:$LINENO: result: $ac_cv_prog_lex_yytext_pointer" >&5
+echo "${ECHO_T}$ac_cv_prog_lex_yytext_pointer" >&6; }
if test $ac_cv_prog_lex_yytext_pointer = yes; then
-$as_echo "#define YYTEXT_POINTER 1" >>confdefs.h
+cat >>confdefs.h <<\_ACEOF
+#define YYTEXT_POINTER 1
+_ACEOF
fi
rm -f conftest.l $LEX_OUTPUT_ROOT.c
@@ -27012,10 +34082,10 @@ fi
if test -n "$ac_tool_prefix"; then
# Extract the first word of "${ac_tool_prefix}ranlib", so it can be a program name with args.
set dummy ${ac_tool_prefix}ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$RANLIB"; then
ac_cv_prog_RANLIB="$RANLIB" # Let the user override the test.
@@ -27025,25 +34095,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_RANLIB="${ac_tool_prefix}ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
RANLIB=$ac_cv_prog_RANLIB
if test -n "$RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $RANLIB" >&5
-$as_echo "$RANLIB" >&6; }
+ { echo "$as_me:$LINENO: result: $RANLIB" >&5
+echo "${ECHO_T}$RANLIB" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
@@ -27052,10 +34122,10 @@ if test -z "$ac_cv_prog_RANLIB"; then
ac_ct_RANLIB=$RANLIB
# Extract the first word of "ranlib", so it can be a program name with args.
set dummy ranlib; ac_word=$2
-{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for $ac_word" >&5
-$as_echo_n "checking for $ac_word... " >&6; }
-if ${ac_cv_prog_ac_ct_RANLIB+:} false; then :
- $as_echo_n "(cached) " >&6
+{ echo "$as_me:$LINENO: checking for $ac_word" >&5
+echo $ECHO_N "checking for $ac_word... $ECHO_C" >&6; }
+if test "${ac_cv_prog_ac_ct_RANLIB+set}" = set; then
+ echo $ECHO_N "(cached) $ECHO_C" >&6
else
if test -n "$ac_ct_RANLIB"; then
ac_cv_prog_ac_ct_RANLIB="$ac_ct_RANLIB" # Let the user override the test.
@@ -27065,25 +34135,25 @@ for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- for ac_exec_ext in '' $ac_executable_extensions; do
- if as_fn_executable_p "$as_dir/$ac_word$ac_exec_ext"; then
+ for ac_exec_ext in '' $ac_executable_extensions; do
+ if { test -f "$as_dir/$ac_word$ac_exec_ext" && $as_test_x "$as_dir/$ac_word$ac_exec_ext"; }; then
ac_cv_prog_ac_ct_RANLIB="ranlib"
- $as_echo "$as_me:${as_lineno-$LINENO}: found $as_dir/$ac_word$ac_exec_ext" >&5
+ echo "$as_me:$LINENO: found $as_dir/$ac_word$ac_exec_ext" >&5
break 2
fi
done
- done
+done
IFS=$as_save_IFS
fi
fi
ac_ct_RANLIB=$ac_cv_prog_ac_ct_RANLIB
if test -n "$ac_ct_RANLIB"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: $ac_ct_RANLIB" >&5
-$as_echo "$ac_ct_RANLIB" >&6; }
+ { echo "$as_me:$LINENO: result: $ac_ct_RANLIB" >&5
+echo "${ECHO_T}$ac_ct_RANLIB" >&6; }
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
-$as_echo "no" >&6; }
+ { echo "$as_me:$LINENO: result: no" >&5
+echo "${ECHO_T}no" >&6; }
fi
if test "x$ac_ct_RANLIB" = x; then
@@ -27091,8 +34161,12 @@ fi
else
case $cross_compiling:$ac_tool_warned in
yes:)
-{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: using cross tools not prefixed with host triplet" >&5
-$as_echo "$as_me: WARNING: using cross tools not prefixed with host triplet" >&2;}
+{ echo "$as_me:$LINENO: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&5
+echo "$as_me: WARNING: In the future, Autoconf will not detect cross-tools
+whose name does not start with the host triplet. If you think this
+configuration is useful to you, please write to autoconf@gnu.org." >&2;}
ac_tool_warned=yes ;;
esac
RANLIB=$ac_ct_RANLIB
@@ -27132,7 +34206,7 @@ echo "define(\`__CONFIG_M4_INCLUDED__')" >> $gmp_configm4
# FIXME: Upcoming version of autoconf/automake may not like broken lines.
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
-ac_config_files="$ac_config_files Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in"
+ac_config_files="$ac_config_files Makefile mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile tests/cxx/Makefile doc/Makefile tune/Makefile demos/Makefile demos/calc/Makefile demos/expr/Makefile gmp.h:gmp-h.in mp.h:mp-h.in"
cat >confcache <<\_ACEOF
# This file is a shell script that caches the results of configure
@@ -27161,13 +34235,12 @@ _ACEOF
case $ac_val in #(
*${as_nl}*)
case $ac_var in #(
- *_cv_*) { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: cache variable $ac_var contains a newline" >&5
-$as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
+ *_cv_*) { echo "$as_me:$LINENO: WARNING: Cache variable $ac_var contains a newline." >&5
+echo "$as_me: WARNING: Cache variable $ac_var contains a newline." >&2;} ;;
esac
case $ac_var in #(
_ | IFS | as_nl) ;; #(
- BASH_ARGV | BASH_SOURCE) eval $ac_var= ;; #(
- *) { eval $ac_var=; unset $ac_var;} ;;
+ *) $as_unset $ac_var ;;
esac ;;
esac
done
@@ -27175,8 +34248,8 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
(set) 2>&1 |
case $as_nl`(ac_space=' '; set) 2>&1` in #(
*${as_nl}ac_space=\ *)
- # `set' does not quote correctly, so add quotes: double-quote
- # substitution turns \\\\ into \\, and sed turns \\ into \.
+ # `set' does not quote correctly, so add quotes (double-quote
+ # substitution turns \\\\ into \\, and sed turns \\ into \).
sed -n \
"s/'/'\\\\''/g;
s/^\\([_$as_cr_alnum]*_cv_[_$as_cr_alnum]*\\)=\\(.*\\)/\\1='\\2'/p"
@@ -27198,24 +34271,13 @@ $as_echo "$as_me: WARNING: cache variable $ac_var contains a newline" >&2;} ;;
:end' >>confcache
if diff "$cache_file" confcache >/dev/null 2>&1; then :; else
if test -w "$cache_file"; then
- if test "x$cache_file" != "x/dev/null"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: updating cache $cache_file" >&5
-$as_echo "$as_me: updating cache $cache_file" >&6;}
- if test ! -f "$cache_file" || test -h "$cache_file"; then
- cat confcache >"$cache_file"
- else
- case $cache_file in #(
- */* | ?:*)
- mv -f confcache "$cache_file"$$ &&
- mv -f "$cache_file"$$ "$cache_file" ;; #(
- *)
- mv -f confcache "$cache_file" ;;
- esac
- fi
- fi
+ test "x$cache_file" != "x/dev/null" &&
+ { echo "$as_me:$LINENO: updating cache $cache_file" >&5
+echo "$as_me: updating cache $cache_file" >&6;}
+ cat confcache >$cache_file
else
- { $as_echo "$as_me:${as_lineno-$LINENO}: not updating unwritable cache $cache_file" >&5
-$as_echo "$as_me: not updating unwritable cache $cache_file" >&6;}
+ { echo "$as_me:$LINENO: not updating unwritable cache $cache_file" >&5
+echo "$as_me: not updating unwritable cache $cache_file" >&6;}
fi
fi
rm -f confcache
@@ -27228,51 +34290,55 @@ DEFS=-DHAVE_CONFIG_H
ac_libobjs=
ac_ltlibobjs=
-U=
for ac_i in : $LIBOBJS; do test "x$ac_i" = x: && continue
# 1. Remove the extension, and $U if already installed.
ac_script='s/\$U\././;s/\.o$//;s/\.obj$//'
- ac_i=`$as_echo "$ac_i" | sed "$ac_script"`
+ ac_i=`echo "$ac_i" | sed "$ac_script"`
# 2. Prepend LIBOBJDIR. When used with automake>=1.10 LIBOBJDIR
# will be set to the directory where LIBOBJS objects are built.
- as_fn_append ac_libobjs " \${LIBOBJDIR}$ac_i\$U.$ac_objext"
- as_fn_append ac_ltlibobjs " \${LIBOBJDIR}$ac_i"'$U.lo'
+ ac_libobjs="$ac_libobjs \${LIBOBJDIR}$ac_i\$U.$ac_objext"
+ ac_ltlibobjs="$ac_ltlibobjs \${LIBOBJDIR}$ac_i"'$U.lo'
done
LIBOBJS=$ac_libobjs
LTLIBOBJS=$ac_ltlibobjs
- if test -n "$EXEEXT"; then
- am__EXEEXT_TRUE=
- am__EXEEXT_FALSE='#'
-else
- am__EXEEXT_TRUE='#'
- am__EXEEXT_FALSE=
-fi
-
if test -z "${MAINTAINER_MODE_TRUE}" && test -z "${MAINTAINER_MODE_FALSE}"; then
- as_fn_error $? "conditional \"MAINTAINER_MODE\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"MAINTAINER_MODE\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
+fi
+if test -z "${WANT_MPBSD_TRUE}" && test -z "${WANT_MPBSD_FALSE}"; then
+ { { echo "$as_me:$LINENO: error: conditional \"WANT_MPBSD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WANT_MPBSD\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
fi
if test -z "${WANT_CXX_TRUE}" && test -z "${WANT_CXX_FALSE}"; then
- as_fn_error $? "conditional \"WANT_CXX\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: conditional \"WANT_CXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"WANT_CXX\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
fi
if test -z "${ENABLE_STATIC_TRUE}" && test -z "${ENABLE_STATIC_FALSE}"; then
- as_fn_error $? "conditional \"ENABLE_STATIC\" was never defined.
-Usually this means the macro was only invoked conditionally." "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: conditional \"ENABLE_STATIC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&5
+echo "$as_me: error: conditional \"ENABLE_STATIC\" was never defined.
+Usually this means the macro was only invoked conditionally." >&2;}
+ { (exit 1); exit 1; }; }
fi
-
-: "${CONFIG_STATUS=./config.status}"
-ac_write_fail=0
+: ${CONFIG_STATUS=./config.status}
ac_clean_files_save=$ac_clean_files
ac_clean_files="$ac_clean_files $CONFIG_STATUS"
-{ $as_echo "$as_me:${as_lineno-$LINENO}: creating $CONFIG_STATUS" >&5
-$as_echo "$as_me: creating $CONFIG_STATUS" >&6;}
-as_write_fail=0
-cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
+{ echo "$as_me:$LINENO: creating $CONFIG_STATUS" >&5
+echo "$as_me: creating $CONFIG_STATUS" >&6;}
+cat >$CONFIG_STATUS <<_ACEOF
#! $SHELL
# Generated by $as_me.
# Run this file to recreate the current configuration.
@@ -27282,79 +34348,59 @@ cat >$CONFIG_STATUS <<_ASEOF || as_write_fail=1
debug=false
ac_cs_recheck=false
ac_cs_silent=false
-
SHELL=\${CONFIG_SHELL-$SHELL}
-export SHELL
-_ASEOF
-cat >>$CONFIG_STATUS <<\_ASEOF || as_write_fail=1
-## -------------------- ##
-## M4sh Initialization. ##
-## -------------------- ##
+_ACEOF
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+## --------------------- ##
+## M4sh Initialization. ##
+## --------------------- ##
# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
-if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then :
+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
+ # Zsh 3.x and 4.x performs word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
setopt NO_GLOB_SUBST
else
- case `(set -o) 2>/dev/null` in #(
- *posix*) :
- set -o posix ;; #(
- *) :
- ;;
+ case `(set -o) 2>/dev/null` in
+ *posix*) set -o posix ;;
esac
+
fi
-as_nl='
-'
-export as_nl
-# Printing a long string crashes Solaris 7 /usr/bin/printf.
-as_echo='\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\'
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo
-as_echo=$as_echo$as_echo$as_echo$as_echo$as_echo$as_echo
-# Prefer a ksh shell builtin over an external printf program on Solaris,
-# but without wasting forks for bash or zsh.
-if test -z "$BASH_VERSION$ZSH_VERSION" \
- && (test "X`print -r -- $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='print -r --'
- as_echo_n='print -rn --'
-elif (test "X`printf %s $as_echo`" = "X$as_echo") 2>/dev/null; then
- as_echo='printf %s\n'
- as_echo_n='printf %s'
-else
- if test "X`(/usr/ucb/echo -n -n $as_echo) 2>/dev/null`" = "X-n $as_echo"; then
- as_echo_body='eval /usr/ucb/echo -n "$1$as_nl"'
- as_echo_n='/usr/ucb/echo -n'
- else
- as_echo_body='eval expr "X$1" : "X\\(.*\\)"'
- as_echo_n_body='eval
- arg=$1;
- case $arg in #(
- *"$as_nl"*)
- expr "X$arg" : "X\\(.*\\)$as_nl";
- arg=`expr "X$arg" : ".*$as_nl\\(.*\\)"`;;
- esac;
- expr "X$arg" : "X\\(.*\\)" | tr -d "$as_nl"
- '
- export as_echo_n_body
- as_echo_n='sh -c $as_echo_n_body as_echo'
- fi
- export as_echo_body
- as_echo='sh -c $as_echo_body as_echo'
-fi
+
+
+# PATH needs CR
+# Avoid depending upon Character Ranges.
+as_cr_letters='abcdefghijklmnopqrstuvwxyz'
+as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
+as_cr_Letters=$as_cr_letters$as_cr_LETTERS
+as_cr_digits='0123456789'
+as_cr_alnum=$as_cr_Letters$as_cr_digits
# The user is always right.
if test "${PATH_SEPARATOR+set}" != set; then
- PATH_SEPARATOR=:
- (PATH='/bin;/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 && {
- (PATH='/bin:/bin'; FPATH=$PATH; sh -c :) >/dev/null 2>&1 ||
- PATH_SEPARATOR=';'
- }
+ echo "#! /bin/sh" >conf$$.sh
+ echo "exit 0" >>conf$$.sh
+ chmod +x conf$$.sh
+ if (PATH="/nonexistent;."; conf$$.sh) >/dev/null 2>&1; then
+ PATH_SEPARATOR=';'
+ else
+ PATH_SEPARATOR=:
+ fi
+ rm -f conf$$.sh
+fi
+
+# Support unset when possible.
+if ( (MAIL=60; unset MAIL) || exit) >/dev/null 2>&1; then
+ as_unset=unset
+else
+ as_unset=false
fi
@@ -27363,19 +34409,20 @@ fi
# there to prevent editors from complaining about space-tab.
# (If _AS_PATH_WALK were called with IFS unset, it would disable word
# splitting by setting IFS to empty value.)
+as_nl='
+'
IFS=" "" $as_nl"
# Find who we are. Look in the path if we contain no directory separator.
-as_myself=
-case $0 in #((
+case $0 in
*[\\/]* ) as_myself=$0 ;;
*) as_save_IFS=$IFS; IFS=$PATH_SEPARATOR
for as_dir in $PATH
do
IFS=$as_save_IFS
test -z "$as_dir" && as_dir=.
- test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
- done
+ test -r "$as_dir/$0" && as_myself=$as_dir/$0 && break
+done
IFS=$as_save_IFS
;;
@@ -27386,111 +34433,32 @@ if test "x$as_myself" = x; then
as_myself=$0
fi
if test ! -f "$as_myself"; then
- $as_echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
- exit 1
+ echo "$as_myself: error: cannot find myself; rerun with an absolute file name" >&2
+ { (exit 1); exit 1; }
fi
-# Unset variables that we do not need and which cause bugs (e.g. in
-# pre-3.0 UWIN ksh). But do not cause bugs in bash 2.01; the "|| exit 1"
-# suppresses any "Segmentation fault" message there. '((' could
-# trigger a bug in pdksh 5.2.14.
-for as_var in BASH_ENV ENV MAIL MAILPATH
-do eval test x\${$as_var+set} = xset \
- && ( (unset $as_var) || exit 1) >/dev/null 2>&1 && unset $as_var || :
+# Work around bugs in pre-3.0 UWIN ksh.
+for as_var in ENV MAIL MAILPATH
+do ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
done
PS1='$ '
PS2='> '
PS4='+ '
# NLS nuisances.
-LC_ALL=C
-export LC_ALL
-LANGUAGE=C
-export LANGUAGE
-
-# CDPATH.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-
-# as_fn_error STATUS ERROR [LINENO LOG_FD]
-# ----------------------------------------
-# Output "`basename $0`: error: ERROR" to stderr. If LINENO and LOG_FD are
-# provided, also output the error to LOG_FD, referencing LINENO. Then exit the
-# script with STATUS, using 1 if that was 0.
-as_fn_error ()
-{
- as_status=$1; test $as_status -eq 0 && as_status=1
- if test "$4"; then
- as_lineno=${as_lineno-"$3"} as_lineno_stack=as_lineno_stack=$as_lineno_stack
- $as_echo "$as_me:${as_lineno-$LINENO}: error: $2" >&$4
+for as_var in \
+ LANG LANGUAGE LC_ADDRESS LC_ALL LC_COLLATE LC_CTYPE LC_IDENTIFICATION \
+ LC_MEASUREMENT LC_MESSAGES LC_MONETARY LC_NAME LC_NUMERIC LC_PAPER \
+ LC_TELEPHONE LC_TIME
+do
+ if (set +x; test -z "`(eval $as_var=C; export $as_var) 2>&1`"); then
+ eval $as_var=C; export $as_var
+ else
+ ($as_unset $as_var) >/dev/null 2>&1 && $as_unset $as_var
fi
- $as_echo "$as_me: error: $2" >&2
- as_fn_exit $as_status
-} # as_fn_error
-
-
-# as_fn_set_status STATUS
-# -----------------------
-# Set $? to STATUS, without forking.
-as_fn_set_status ()
-{
- return $1
-} # as_fn_set_status
-
-# as_fn_exit STATUS
-# -----------------
-# Exit the shell with STATUS, even in a "trap 0" or "set -e" context.
-as_fn_exit ()
-{
- set +e
- as_fn_set_status $1
- exit $1
-} # as_fn_exit
-
-# as_fn_unset VAR
-# ---------------
-# Portably unset VAR.
-as_fn_unset ()
-{
- { eval $1=; unset $1;}
-}
-as_unset=as_fn_unset
-# as_fn_append VAR VALUE
-# ----------------------
-# Append the text in VALUE to the end of the definition contained in VAR. Take
-# advantage of any shell optimizations that allow amortized linear growth over
-# repeated appends, instead of the typical quadratic growth present in naive
-# implementations.
-if (eval "as_var=1; as_var+=2; test x\$as_var = x12") 2>/dev/null; then :
- eval 'as_fn_append ()
- {
- eval $1+=\$2
- }'
-else
- as_fn_append ()
- {
- eval $1=\$$1\$2
- }
-fi # as_fn_append
-
-# as_fn_arith ARG...
-# ------------------
-# Perform arithmetic evaluation on the ARGs, and store the result in the
-# global $as_val. Take advantage of shells that can avoid forks. The arguments
-# must be portable across $(()) and expr.
-if (eval "test \$(( 1 + 1 )) = 2") 2>/dev/null; then :
- eval 'as_fn_arith ()
- {
- as_val=$(( $* ))
- }'
-else
- as_fn_arith ()
- {
- as_val=`expr "$@" || test $? -eq 1`
- }
-fi # as_fn_arith
-
+done
+# Required to use basename.
if expr a : '\(a\)' >/dev/null 2>&1 &&
test "X`expr 00001 : '.*\(...\)'`" = X001; then
as_expr=expr
@@ -27504,17 +34472,13 @@ else
as_basename=false
fi
-if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
- as_dirname=dirname
-else
- as_dirname=false
-fi
+# Name of the executable.
as_me=`$as_basename -- "$0" ||
$as_expr X/"$0" : '.*/\([^/][^/]*\)/*$' \| \
X"$0" : 'X\(//\)$' \| \
X"$0" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X/"$0" |
+echo X/"$0" |
sed '/^.*\/\([^/][^/]*\)\/*$/{
s//\1/
q
@@ -27529,118 +34493,131 @@ $as_echo X/"$0" |
}
s/.*/./; q'`
-# Avoid depending upon Character Ranges.
-as_cr_letters='abcdefghijklmnopqrstuvwxyz'
-as_cr_LETTERS='ABCDEFGHIJKLMNOPQRSTUVWXYZ'
-as_cr_Letters=$as_cr_letters$as_cr_LETTERS
-as_cr_digits='0123456789'
-as_cr_alnum=$as_cr_Letters$as_cr_digits
+# CDPATH.
+$as_unset CDPATH
+
+
+
+ as_lineno_1=$LINENO
+ as_lineno_2=$LINENO
+ test "x$as_lineno_1" != "x$as_lineno_2" &&
+ test "x`expr $as_lineno_1 + 1`" = "x$as_lineno_2" || {
+
+ # Create $as_me.lineno as a copy of $as_myself, but with $LINENO
+ # uniformly replaced by the line number. The first 'sed' inserts a
+ # line-number line after each line using $LINENO; the second 'sed'
+ # does the real work. The second script uses 'N' to pair each
+ # line-number line with the line containing $LINENO, and appends
+ # trailing '-' during substitution so that $LINENO is not a special
+ # case at line end.
+ # (Raja R Harinath suggested sed '=', and Paul Eggert wrote the
+ # scripts with optimization help from Paolo Bonzini. Blame Lee
+ # E. McMahon (1931-1989) for sed's syntax. :-)
+ sed -n '
+ p
+ /[$]LINENO/=
+ ' <$as_myself |
+ sed '
+ s/[$]LINENO.*/&-/
+ t lineno
+ b
+ :lineno
+ N
+ :loop
+ s/[$]LINENO\([^'$as_cr_alnum'_].*\n\)\(.*\)/\2\1\2/
+ t loop
+ s/-\n.*//
+ ' >$as_me.lineno &&
+ chmod +x "$as_me.lineno" ||
+ { echo "$as_me: error: cannot create $as_me.lineno; rerun with a POSIX shell" >&2
+ { (exit 1); exit 1; }; }
+
+ # Don't try to exec as it changes $[0], causing all sort of problems
+ # (the dirname of $[0] is not the place where we might find the
+ # original and so on. Autoconf is especially sensitive to this).
+ . "./$as_me.lineno"
+ # Exit status is that of the last command.
+ exit
+}
+
+
+if (as_dir=`dirname -- /` && test "X$as_dir" = X/) >/dev/null 2>&1; then
+ as_dirname=dirname
+else
+ as_dirname=false
+fi
ECHO_C= ECHO_N= ECHO_T=
-case `echo -n x` in #(((((
+case `echo -n x` in
-n*)
- case `echo 'xy\c'` in
+ case `echo 'x\c'` in
*c*) ECHO_T=' ';; # ECHO_T is single tab character.
- xy) ECHO_C='\c';;
- *) echo `echo ksh88 bug on AIX 6.1` > /dev/null
- ECHO_T=' ';;
+ *) ECHO_C='\c';;
esac;;
*)
ECHO_N='-n';;
esac
+if expr a : '\(a\)' >/dev/null 2>&1 &&
+ test "X`expr 00001 : '.*\(...\)'`" = X001; then
+ as_expr=expr
+else
+ as_expr=false
+fi
+
rm -f conf$$ conf$$.exe conf$$.file
if test -d conf$$.dir; then
rm -f conf$$.dir/conf$$.file
else
rm -f conf$$.dir
- mkdir conf$$.dir 2>/dev/null
-fi
-if (echo >conf$$.file) 2>/dev/null; then
- if ln -s conf$$.file conf$$ 2>/dev/null; then
- as_ln_s='ln -s'
- # ... but there are two gotchas:
- # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
- # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
- # In both cases, we have to default to `cp -pR'.
- ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
- as_ln_s='cp -pR'
- elif ln conf$$.file conf$$ 2>/dev/null; then
- as_ln_s=ln
- else
- as_ln_s='cp -pR'
- fi
-else
- as_ln_s='cp -pR'
+ mkdir conf$$.dir
+fi
+echo >conf$$.file
+if ln -s conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s='ln -s'
+ # ... but there are two gotchas:
+ # 1) On MSYS, both `ln -s file dir' and `ln file dir' fail.
+ # 2) DJGPP < 2.04 has no symlinks; `ln -s' creates a wrapper executable.
+ # In both cases, we have to default to `cp -p'.
+ ln -s conf$$.file conf$$.dir 2>/dev/null && test ! -f conf$$.exe ||
+ as_ln_s='cp -p'
+elif ln conf$$.file conf$$ 2>/dev/null; then
+ as_ln_s=ln
+else
+ as_ln_s='cp -p'
fi
rm -f conf$$ conf$$.exe conf$$.dir/conf$$.file conf$$.file
rmdir conf$$.dir 2>/dev/null
-
-# as_fn_mkdir_p
-# -------------
-# Create "$as_dir" as a directory, including parents if necessary.
-as_fn_mkdir_p ()
-{
-
- case $as_dir in #(
- -*) as_dir=./$as_dir;;
- esac
- test -d "$as_dir" || eval $as_mkdir_p || {
- as_dirs=
- while :; do
- case $as_dir in #(
- *\'*) as_qdir=`$as_echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #'(
- *) as_qdir=$as_dir;;
- esac
- as_dirs="'$as_qdir' $as_dirs"
- as_dir=`$as_dirname -- "$as_dir" ||
-$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$as_dir" : 'X\(//\)[^/]' \| \
- X"$as_dir" : 'X\(//\)$' \| \
- X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$as_dir" |
- sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
- s//\1/
- q
- }
- /^X\(\/\/\)[^/].*/{
- s//\1/
- q
- }
- /^X\(\/\/\)$/{
- s//\1/
- q
- }
- /^X\(\/\).*/{
- s//\1/
- q
- }
- s/.*/./; q'`
- test -d "$as_dir" && break
- done
- test -z "$as_dirs" || eval "mkdir $as_dirs"
- } || test -d "$as_dir" || as_fn_error $? "cannot create directory $as_dir"
-
-
-} # as_fn_mkdir_p
if mkdir -p . 2>/dev/null; then
- as_mkdir_p='mkdir -p "$as_dir"'
+ as_mkdir_p=:
else
test -d ./-p && rmdir ./-p
as_mkdir_p=false
fi
-
-# as_fn_executable_p FILE
-# -----------------------
-# Test if FILE is an executable regular file.
-as_fn_executable_p ()
-{
- test -f "$1" && test -x "$1"
-} # as_fn_executable_p
-as_test_x='test -x'
-as_executable_p=as_fn_executable_p
+if test -x / >/dev/null 2>&1; then
+ as_test_x='test -x'
+else
+ if ls -dL / >/dev/null 2>&1; then
+ as_ls_L_option=L
+ else
+ as_ls_L_option=
+ fi
+ as_test_x='
+ eval sh -c '\''
+ if test -d "$1"; then
+ test -d "$1/.";
+ else
+ case $1 in
+ -*)set "./$1";;
+ esac;
+ case `ls -ld'$as_ls_L_option' "$1" 2>/dev/null` in
+ ???[sx]*):;;*)false;;esac;fi
+ '\'' sh
+ '
+fi
+as_executable_p=$as_test_x
# Sed expression to map a string onto a valid CPP name.
as_tr_cpp="eval sed 'y%*$as_cr_letters%P$as_cr_LETTERS%;s%[^_$as_cr_alnum]%_%g'"
@@ -27650,19 +34627,13 @@ as_tr_sh="eval sed 'y%*+%pp%;s%[^_$as_cr_alnum]%_%g'"
exec 6>&1
-## ----------------------------------- ##
-## Main body of $CONFIG_STATUS script. ##
-## ----------------------------------- ##
-_ASEOF
-test $as_write_fail = 0 && chmod +x $CONFIG_STATUS || ac_write_fail=1
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# Save the log message, to keep $0 and so on meaningful, and to
+# Save the log message, to keep $[0] and so on meaningful, and to
# 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 6.0.0, which was
-generated by GNU Autoconf 2.69. Invocation command line was
+This file was extended by GNU MP $as_me 4.3.2, which was
+generated by GNU Autoconf 2.61. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
CONFIG_HEADERS = $CONFIG_HEADERS
@@ -27675,43 +34646,30 @@ on `(hostname || uname -n) 2>/dev/null | sed 1q`
_ACEOF
-case $ac_config_files in *"
-"*) set x $ac_config_files; shift; ac_config_files=$*;;
-esac
-
-case $ac_config_headers in *"
-"*) set x $ac_config_headers; shift; ac_config_headers=$*;;
-esac
-
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<_ACEOF
# Files that config.status was made for.
config_files="$ac_config_files"
config_headers="$ac_config_headers"
config_links="$ac_config_links"
-config_commands="$ac_config_commands"
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<\_ACEOF
ac_cs_usage="\
-\`$as_me' instantiates files and other configuration actions
-from templates according to the current configuration. Unless the files
-and actions are specified as TAGs, all are instantiated by default.
+\`$as_me' instantiates files from templates according to the
+current configuration.
-Usage: $0 [OPTION]... [TAG]...
+Usage: $0 [OPTIONS] [FILE]...
-h, --help print this help, then exit
-V, --version print version number and configuration settings, then exit
- --config print configuration, then exit
- -q, --quiet, --silent
- do not print progress messages
+ -q, --quiet do not print progress messages
-d, --debug don't remove temporary files
--recheck update $as_me by reconfiguring in the same conditions
- --file=FILE[:TEMPLATE]
- instantiate the configuration file FILE
- --header=FILE[:TEMPLATE]
- instantiate the configuration header FILE
+ --file=FILE[:TEMPLATE]
+ instantiate the configuration file FILE
+ --header=FILE[:TEMPLATE]
+ instantiate the configuration header FILE
Configuration files:
$config_files
@@ -27722,49 +34680,36 @@ $config_headers
Configuration links:
$config_links
-Configuration commands:
-$config_commands
-
-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/>."
+Report bugs to <bug-autoconf@gnu.org>."
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
+cat >>$CONFIG_STATUS <<_ACEOF
ac_cs_version="\\
-GNU MP config.status 6.0.0
-configured by $0, generated by GNU Autoconf 2.69,
- with options \\"\$ac_cs_config\\"
+GNU MP config.status 4.3.2
+configured by $0, generated by GNU Autoconf 2.61,
+ with options \\"`echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`\\"
-Copyright (C) 2012 Free Software Foundation, Inc.
+Copyright (C) 2006 Free Software Foundation, Inc.
This config.status script is free software; the Free Software Foundation
gives unlimited permission to copy, distribute and modify it."
ac_pwd='$ac_pwd'
srcdir='$srcdir'
INSTALL='$INSTALL'
-MKDIR_P='$MKDIR_P'
-AWK='$AWK'
-test -n "\$AWK" || AWK=awk
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-# The default lists apply if the user does not specify any file.
+cat >>$CONFIG_STATUS <<\_ACEOF
+# If no file are specified by the user, then we need to provide default
+# value. By we need to know if files were specified by the user.
ac_need_defaults=:
while test $# != 0
do
case $1 in
- --*=?*)
+ --*=*)
ac_option=`expr "X$1" : 'X\([^=]*\)='`
ac_optarg=`expr "X$1" : 'X[^=]*=\(.*\)'`
ac_shift=:
;;
- --*=)
- ac_option=`expr "X$1" : 'X\([^=]*\)='`
- ac_optarg=
- ac_shift=:
- ;;
*)
ac_option=$1
ac_optarg=$2
@@ -27777,41 +34722,34 @@ do
-recheck | --recheck | --rechec | --reche | --rech | --rec | --re | --r)
ac_cs_recheck=: ;;
--version | --versio | --versi | --vers | --ver | --ve | --v | -V )
- $as_echo "$ac_cs_version"; exit ;;
- --config | --confi | --conf | --con | --co | --c )
- $as_echo "$ac_cs_config"; exit ;;
+ echo "$ac_cs_version"; exit ;;
--debug | --debu | --deb | --de | --d | -d )
debug=: ;;
--file | --fil | --fi | --f )
$ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- '') as_fn_error $? "missing file argument" ;;
- esac
- as_fn_append CONFIG_FILES " '$ac_optarg'"
+ CONFIG_FILES="$CONFIG_FILES $ac_optarg"
ac_need_defaults=false;;
--header | --heade | --head | --hea )
$ac_shift
- case $ac_optarg in
- *\'*) ac_optarg=`$as_echo "$ac_optarg" | sed "s/'/'\\\\\\\\''/g"` ;;
- esac
- as_fn_append CONFIG_HEADERS " '$ac_optarg'"
+ CONFIG_HEADERS="$CONFIG_HEADERS $ac_optarg"
ac_need_defaults=false;;
--he | --h)
# Conflict between --help and --header
- as_fn_error $? "ambiguous option: \`$1'
-Try \`$0 --help' for more information.";;
+ { echo "$as_me: error: ambiguous option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; };;
--help | --hel | -h )
- $as_echo "$ac_cs_usage"; exit ;;
+ echo "$ac_cs_usage"; exit ;;
-q | -quiet | --quiet | --quie | --qui | --qu | --q \
| -silent | --silent | --silen | --sile | --sil | --si | --s)
ac_cs_silent=: ;;
# This is an error.
- -*) as_fn_error $? "unrecognized option: \`$1'
-Try \`$0 --help' for more information." ;;
+ -*) { echo "$as_me: error: unrecognized option: $1
+Try \`$0 --help' for more information." >&2
+ { (exit 1); exit 1; }; } ;;
- *) as_fn_append ac_config_targets " $1"
+ *) ac_config_targets="$ac_config_targets $1"
ac_need_defaults=false ;;
esac
@@ -27826,435 +34764,52 @@ if $ac_cs_silent; then
fi
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<_ACEOF
if \$ac_cs_recheck; then
- set X $SHELL '$0' $ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
- shift
- \$as_echo "running CONFIG_SHELL=$SHELL \$*" >&6
- CONFIG_SHELL='$SHELL'
+ echo "running CONFIG_SHELL=$SHELL $SHELL $0 "$ac_configure_args \$ac_configure_extra_args " --no-create --no-recursion" >&6
+ CONFIG_SHELL=$SHELL
export CONFIG_SHELL
- exec "\$@"
+ exec $SHELL "$0"$ac_configure_args \$ac_configure_extra_args --no-create --no-recursion
fi
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<\_ACEOF
exec 5>>config.log
{
echo
sed 'h;s/./-/g;s/^.../## /;s/...$/ ##/;p;x;p;x' <<_ASBOX
## Running $as_me. ##
_ASBOX
- $as_echo "$ac_log"
+ echo "$ac_log"
} >&5
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-#
-# INIT-COMMANDS
-#
-
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-sed_quote_subst='$sed_quote_subst'
-double_quote_subst='$double_quote_subst'
-delay_variable_subst='$delay_variable_subst'
-NM='`$ECHO "$NM" | $SED "$delay_single_quote_subst"`'
-AS='`$ECHO "$AS" | $SED "$delay_single_quote_subst"`'
-DLLTOOL='`$ECHO "$DLLTOOL" | $SED "$delay_single_quote_subst"`'
-OBJDUMP='`$ECHO "$OBJDUMP" | $SED "$delay_single_quote_subst"`'
-macro_version='`$ECHO "$macro_version" | $SED "$delay_single_quote_subst"`'
-macro_revision='`$ECHO "$macro_revision" | $SED "$delay_single_quote_subst"`'
-enable_shared='`$ECHO "$enable_shared" | $SED "$delay_single_quote_subst"`'
-enable_static='`$ECHO "$enable_static" | $SED "$delay_single_quote_subst"`'
-pic_mode='`$ECHO "$pic_mode" | $SED "$delay_single_quote_subst"`'
-enable_fast_install='`$ECHO "$enable_fast_install" | $SED "$delay_single_quote_subst"`'
-SHELL='`$ECHO "$SHELL" | $SED "$delay_single_quote_subst"`'
-ECHO='`$ECHO "$ECHO" | $SED "$delay_single_quote_subst"`'
-PATH_SEPARATOR='`$ECHO "$PATH_SEPARATOR" | $SED "$delay_single_quote_subst"`'
-host_alias='`$ECHO "$host_alias" | $SED "$delay_single_quote_subst"`'
-host='`$ECHO "$host" | $SED "$delay_single_quote_subst"`'
-host_os='`$ECHO "$host_os" | $SED "$delay_single_quote_subst"`'
-build_alias='`$ECHO "$build_alias" | $SED "$delay_single_quote_subst"`'
-build='`$ECHO "$build" | $SED "$delay_single_quote_subst"`'
-build_os='`$ECHO "$build_os" | $SED "$delay_single_quote_subst"`'
-SED='`$ECHO "$SED" | $SED "$delay_single_quote_subst"`'
-Xsed='`$ECHO "$Xsed" | $SED "$delay_single_quote_subst"`'
-GREP='`$ECHO "$GREP" | $SED "$delay_single_quote_subst"`'
-EGREP='`$ECHO "$EGREP" | $SED "$delay_single_quote_subst"`'
-FGREP='`$ECHO "$FGREP" | $SED "$delay_single_quote_subst"`'
-LD='`$ECHO "$LD" | $SED "$delay_single_quote_subst"`'
-LN_S='`$ECHO "$LN_S" | $SED "$delay_single_quote_subst"`'
-max_cmd_len='`$ECHO "$max_cmd_len" | $SED "$delay_single_quote_subst"`'
-ac_objext='`$ECHO "$ac_objext" | $SED "$delay_single_quote_subst"`'
-exeext='`$ECHO "$exeext" | $SED "$delay_single_quote_subst"`'
-lt_unset='`$ECHO "$lt_unset" | $SED "$delay_single_quote_subst"`'
-lt_SP2NL='`$ECHO "$lt_SP2NL" | $SED "$delay_single_quote_subst"`'
-lt_NL2SP='`$ECHO "$lt_NL2SP" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_host_file_cmd='`$ECHO "$lt_cv_to_host_file_cmd" | $SED "$delay_single_quote_subst"`'
-lt_cv_to_tool_file_cmd='`$ECHO "$lt_cv_to_tool_file_cmd" | $SED "$delay_single_quote_subst"`'
-reload_flag='`$ECHO "$reload_flag" | $SED "$delay_single_quote_subst"`'
-reload_cmds='`$ECHO "$reload_cmds" | $SED "$delay_single_quote_subst"`'
-deplibs_check_method='`$ECHO "$deplibs_check_method" | $SED "$delay_single_quote_subst"`'
-file_magic_cmd='`$ECHO "$file_magic_cmd" | $SED "$delay_single_quote_subst"`'
-file_magic_glob='`$ECHO "$file_magic_glob" | $SED "$delay_single_quote_subst"`'
-want_nocaseglob='`$ECHO "$want_nocaseglob" | $SED "$delay_single_quote_subst"`'
-sharedlib_from_linklib_cmd='`$ECHO "$sharedlib_from_linklib_cmd" | $SED "$delay_single_quote_subst"`'
-AR='`$ECHO "$AR" | $SED "$delay_single_quote_subst"`'
-AR_FLAGS='`$ECHO "$AR_FLAGS" | $SED "$delay_single_quote_subst"`'
-archiver_list_spec='`$ECHO "$archiver_list_spec" | $SED "$delay_single_quote_subst"`'
-STRIP='`$ECHO "$STRIP" | $SED "$delay_single_quote_subst"`'
-RANLIB='`$ECHO "$RANLIB" | $SED "$delay_single_quote_subst"`'
-old_postinstall_cmds='`$ECHO "$old_postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_postuninstall_cmds='`$ECHO "$old_postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds='`$ECHO "$old_archive_cmds" | $SED "$delay_single_quote_subst"`'
-lock_old_archive_extraction='`$ECHO "$lock_old_archive_extraction" | $SED "$delay_single_quote_subst"`'
-CC='`$ECHO "$CC" | $SED "$delay_single_quote_subst"`'
-CFLAGS='`$ECHO "$CFLAGS" | $SED "$delay_single_quote_subst"`'
-compiler='`$ECHO "$compiler" | $SED "$delay_single_quote_subst"`'
-GCC='`$ECHO "$GCC" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_pipe='`$ECHO "$lt_cv_sys_global_symbol_pipe" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_cdecl='`$ECHO "$lt_cv_sys_global_symbol_to_cdecl" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address" | $SED "$delay_single_quote_subst"`'
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix='`$ECHO "$lt_cv_sys_global_symbol_to_c_name_address_lib_prefix" | $SED "$delay_single_quote_subst"`'
-nm_file_list_spec='`$ECHO "$nm_file_list_spec" | $SED "$delay_single_quote_subst"`'
-lt_sysroot='`$ECHO "$lt_sysroot" | $SED "$delay_single_quote_subst"`'
-objdir='`$ECHO "$objdir" | $SED "$delay_single_quote_subst"`'
-MAGIC_CMD='`$ECHO "$MAGIC_CMD" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_no_builtin_flag='`$ECHO "$lt_prog_compiler_no_builtin_flag" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_pic='`$ECHO "$lt_prog_compiler_pic" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl='`$ECHO "$lt_prog_compiler_wl" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static='`$ECHO "$lt_prog_compiler_static" | $SED "$delay_single_quote_subst"`'
-lt_cv_prog_compiler_c_o='`$ECHO "$lt_cv_prog_compiler_c_o" | $SED "$delay_single_quote_subst"`'
-need_locks='`$ECHO "$need_locks" | $SED "$delay_single_quote_subst"`'
-MANIFEST_TOOL='`$ECHO "$MANIFEST_TOOL" | $SED "$delay_single_quote_subst"`'
-DSYMUTIL='`$ECHO "$DSYMUTIL" | $SED "$delay_single_quote_subst"`'
-NMEDIT='`$ECHO "$NMEDIT" | $SED "$delay_single_quote_subst"`'
-LIPO='`$ECHO "$LIPO" | $SED "$delay_single_quote_subst"`'
-OTOOL='`$ECHO "$OTOOL" | $SED "$delay_single_quote_subst"`'
-OTOOL64='`$ECHO "$OTOOL64" | $SED "$delay_single_quote_subst"`'
-libext='`$ECHO "$libext" | $SED "$delay_single_quote_subst"`'
-shrext_cmds='`$ECHO "$shrext_cmds" | $SED "$delay_single_quote_subst"`'
-extract_expsyms_cmds='`$ECHO "$extract_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds_need_lc='`$ECHO "$archive_cmds_need_lc" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes='`$ECHO "$enable_shared_with_static_runtimes" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec='`$ECHO "$export_dynamic_flag_spec" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec='`$ECHO "$whole_archive_flag_spec" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object='`$ECHO "$compiler_needs_object" | $SED "$delay_single_quote_subst"`'
-old_archive_from_new_cmds='`$ECHO "$old_archive_from_new_cmds" | $SED "$delay_single_quote_subst"`'
-old_archive_from_expsyms_cmds='`$ECHO "$old_archive_from_expsyms_cmds" | $SED "$delay_single_quote_subst"`'
-archive_cmds='`$ECHO "$archive_cmds" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds='`$ECHO "$archive_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-module_cmds='`$ECHO "$module_cmds" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds='`$ECHO "$module_expsym_cmds" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld='`$ECHO "$with_gnu_ld" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag='`$ECHO "$allow_undefined_flag" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag='`$ECHO "$no_undefined_flag" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec='`$ECHO "$hardcode_libdir_flag_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator='`$ECHO "$hardcode_libdir_separator" | $SED "$delay_single_quote_subst"`'
-hardcode_direct='`$ECHO "$hardcode_direct" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute='`$ECHO "$hardcode_direct_absolute" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L='`$ECHO "$hardcode_minus_L" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var='`$ECHO "$hardcode_shlibpath_var" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic='`$ECHO "$hardcode_automatic" | $SED "$delay_single_quote_subst"`'
-inherit_rpath='`$ECHO "$inherit_rpath" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs='`$ECHO "$link_all_deplibs" | $SED "$delay_single_quote_subst"`'
-always_export_symbols='`$ECHO "$always_export_symbols" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds='`$ECHO "$export_symbols_cmds" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms='`$ECHO "$exclude_expsyms" | $SED "$delay_single_quote_subst"`'
-include_expsyms='`$ECHO "$include_expsyms" | $SED "$delay_single_quote_subst"`'
-prelink_cmds='`$ECHO "$prelink_cmds" | $SED "$delay_single_quote_subst"`'
-postlink_cmds='`$ECHO "$postlink_cmds" | $SED "$delay_single_quote_subst"`'
-file_list_spec='`$ECHO "$file_list_spec" | $SED "$delay_single_quote_subst"`'
-variables_saved_for_relink='`$ECHO "$variables_saved_for_relink" | $SED "$delay_single_quote_subst"`'
-need_lib_prefix='`$ECHO "$need_lib_prefix" | $SED "$delay_single_quote_subst"`'
-need_version='`$ECHO "$need_version" | $SED "$delay_single_quote_subst"`'
-version_type='`$ECHO "$version_type" | $SED "$delay_single_quote_subst"`'
-runpath_var='`$ECHO "$runpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_var='`$ECHO "$shlibpath_var" | $SED "$delay_single_quote_subst"`'
-shlibpath_overrides_runpath='`$ECHO "$shlibpath_overrides_runpath" | $SED "$delay_single_quote_subst"`'
-libname_spec='`$ECHO "$libname_spec" | $SED "$delay_single_quote_subst"`'
-library_names_spec='`$ECHO "$library_names_spec" | $SED "$delay_single_quote_subst"`'
-soname_spec='`$ECHO "$soname_spec" | $SED "$delay_single_quote_subst"`'
-install_override_mode='`$ECHO "$install_override_mode" | $SED "$delay_single_quote_subst"`'
-postinstall_cmds='`$ECHO "$postinstall_cmds" | $SED "$delay_single_quote_subst"`'
-postuninstall_cmds='`$ECHO "$postuninstall_cmds" | $SED "$delay_single_quote_subst"`'
-finish_cmds='`$ECHO "$finish_cmds" | $SED "$delay_single_quote_subst"`'
-finish_eval='`$ECHO "$finish_eval" | $SED "$delay_single_quote_subst"`'
-hardcode_into_libs='`$ECHO "$hardcode_into_libs" | $SED "$delay_single_quote_subst"`'
-sys_lib_search_path_spec='`$ECHO "$sys_lib_search_path_spec" | $SED "$delay_single_quote_subst"`'
-sys_lib_dlsearch_path_spec='`$ECHO "$sys_lib_dlsearch_path_spec" | $SED "$delay_single_quote_subst"`'
-hardcode_action='`$ECHO "$hardcode_action" | $SED "$delay_single_quote_subst"`'
-enable_dlopen='`$ECHO "$enable_dlopen" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self='`$ECHO "$enable_dlopen_self" | $SED "$delay_single_quote_subst"`'
-enable_dlopen_self_static='`$ECHO "$enable_dlopen_self_static" | $SED "$delay_single_quote_subst"`'
-old_striplib='`$ECHO "$old_striplib" | $SED "$delay_single_quote_subst"`'
-striplib='`$ECHO "$striplib" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_dirs='`$ECHO "$compiler_lib_search_dirs" | $SED "$delay_single_quote_subst"`'
-predep_objects='`$ECHO "$predep_objects" | $SED "$delay_single_quote_subst"`'
-postdep_objects='`$ECHO "$postdep_objects" | $SED "$delay_single_quote_subst"`'
-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"`'
-reload_flag_CXX='`$ECHO "$reload_flag_CXX" | $SED "$delay_single_quote_subst"`'
-reload_cmds_CXX='`$ECHO "$reload_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-old_archive_cmds_CXX='`$ECHO "$old_archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_CXX='`$ECHO "$compiler_CXX" | $SED "$delay_single_quote_subst"`'
-GCC_CXX='`$ECHO "$GCC_CXX" | $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_pic_CXX='`$ECHO "$lt_prog_compiler_pic_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_wl_CXX='`$ECHO "$lt_prog_compiler_wl_CXX" | $SED "$delay_single_quote_subst"`'
-lt_prog_compiler_static_CXX='`$ECHO "$lt_prog_compiler_static_CXX" | $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"`'
-archive_cmds_need_lc_CXX='`$ECHO "$archive_cmds_need_lc_CXX" | $SED "$delay_single_quote_subst"`'
-enable_shared_with_static_runtimes_CXX='`$ECHO "$enable_shared_with_static_runtimes_CXX" | $SED "$delay_single_quote_subst"`'
-export_dynamic_flag_spec_CXX='`$ECHO "$export_dynamic_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-whole_archive_flag_spec_CXX='`$ECHO "$whole_archive_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_needs_object_CXX='`$ECHO "$compiler_needs_object_CXX" | $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_expsyms_cmds_CXX='`$ECHO "$old_archive_from_expsyms_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_cmds_CXX='`$ECHO "$archive_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-archive_expsym_cmds_CXX='`$ECHO "$archive_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_cmds_CXX='`$ECHO "$module_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-module_expsym_cmds_CXX='`$ECHO "$module_expsym_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-with_gnu_ld_CXX='`$ECHO "$with_gnu_ld_CXX" | $SED "$delay_single_quote_subst"`'
-allow_undefined_flag_CXX='`$ECHO "$allow_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-no_undefined_flag_CXX='`$ECHO "$no_undefined_flag_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_flag_spec_CXX='`$ECHO "$hardcode_libdir_flag_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_libdir_separator_CXX='`$ECHO "$hardcode_libdir_separator_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_CXX='`$ECHO "$hardcode_direct_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_direct_absolute_CXX='`$ECHO "$hardcode_direct_absolute_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_minus_L_CXX='`$ECHO "$hardcode_minus_L_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_shlibpath_var_CXX='`$ECHO "$hardcode_shlibpath_var_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_automatic_CXX='`$ECHO "$hardcode_automatic_CXX" | $SED "$delay_single_quote_subst"`'
-inherit_rpath_CXX='`$ECHO "$inherit_rpath_CXX" | $SED "$delay_single_quote_subst"`'
-link_all_deplibs_CXX='`$ECHO "$link_all_deplibs_CXX" | $SED "$delay_single_quote_subst"`'
-always_export_symbols_CXX='`$ECHO "$always_export_symbols_CXX" | $SED "$delay_single_quote_subst"`'
-export_symbols_cmds_CXX='`$ECHO "$export_symbols_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-exclude_expsyms_CXX='`$ECHO "$exclude_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-include_expsyms_CXX='`$ECHO "$include_expsyms_CXX" | $SED "$delay_single_quote_subst"`'
-prelink_cmds_CXX='`$ECHO "$prelink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-postlink_cmds_CXX='`$ECHO "$postlink_cmds_CXX" | $SED "$delay_single_quote_subst"`'
-file_list_spec_CXX='`$ECHO "$file_list_spec_CXX" | $SED "$delay_single_quote_subst"`'
-hardcode_action_CXX='`$ECHO "$hardcode_action_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_dirs_CXX='`$ECHO "$compiler_lib_search_dirs_CXX" | $SED "$delay_single_quote_subst"`'
-predep_objects_CXX='`$ECHO "$predep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-postdep_objects_CXX='`$ECHO "$postdep_objects_CXX" | $SED "$delay_single_quote_subst"`'
-predeps_CXX='`$ECHO "$predeps_CXX" | $SED "$delay_single_quote_subst"`'
-postdeps_CXX='`$ECHO "$postdeps_CXX" | $SED "$delay_single_quote_subst"`'
-compiler_lib_search_path_CXX='`$ECHO "$compiler_lib_search_path_CXX" | $SED "$delay_single_quote_subst"`'
-
-LTCC='$LTCC'
-LTCFLAGS='$LTCFLAGS'
-compiler='$compiler_DEFAULT'
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
- eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
-
-# Quote evaled strings.
-for var in NM \
-AS \
-DLLTOOL \
-OBJDUMP \
-SHELL \
-ECHO \
-PATH_SEPARATOR \
-SED \
-GREP \
-EGREP \
-FGREP \
-LD \
-LN_S \
-lt_SP2NL \
-lt_NL2SP \
-reload_flag \
-deplibs_check_method \
-file_magic_cmd \
-file_magic_glob \
-want_nocaseglob \
-sharedlib_from_linklib_cmd \
-AR \
-AR_FLAGS \
-archiver_list_spec \
-STRIP \
-RANLIB \
-CC \
-CFLAGS \
-compiler \
-lt_cv_sys_global_symbol_pipe \
-lt_cv_sys_global_symbol_to_cdecl \
-lt_cv_sys_global_symbol_to_c_name_address \
-lt_cv_sys_global_symbol_to_c_name_address_lib_prefix \
-nm_file_list_spec \
-lt_prog_compiler_no_builtin_flag \
-lt_prog_compiler_pic \
-lt_prog_compiler_wl \
-lt_prog_compiler_static \
-lt_cv_prog_compiler_c_o \
-need_locks \
-MANIFEST_TOOL \
-DSYMUTIL \
-NMEDIT \
-LIPO \
-OTOOL \
-OTOOL64 \
-shrext_cmds \
-export_dynamic_flag_spec \
-whole_archive_flag_spec \
-compiler_needs_object \
-with_gnu_ld \
-allow_undefined_flag \
-no_undefined_flag \
-hardcode_libdir_flag_spec \
-hardcode_libdir_separator \
-exclude_expsyms \
-include_expsyms \
-file_list_spec \
-variables_saved_for_relink \
-libname_spec \
-library_names_spec \
-soname_spec \
-install_override_mode \
-finish_eval \
-old_striplib \
-striplib \
-compiler_lib_search_dirs \
-predep_objects \
-postdep_objects \
-predeps \
-postdeps \
-compiler_lib_search_path \
-LD_CXX \
-reload_flag_CXX \
-compiler_CXX \
-lt_prog_compiler_no_builtin_flag_CXX \
-lt_prog_compiler_pic_CXX \
-lt_prog_compiler_wl_CXX \
-lt_prog_compiler_static_CXX \
-lt_cv_prog_compiler_c_o_CXX \
-export_dynamic_flag_spec_CXX \
-whole_archive_flag_spec_CXX \
-compiler_needs_object_CXX \
-with_gnu_ld_CXX \
-allow_undefined_flag_CXX \
-no_undefined_flag_CXX \
-hardcode_libdir_flag_spec_CXX \
-hardcode_libdir_separator_CXX \
-exclude_expsyms_CXX \
-include_expsyms_CXX \
-file_list_spec_CXX \
-compiler_lib_search_dirs_CXX \
-predep_objects_CXX \
-postdep_objects_CXX \
-predeps_CXX \
-postdeps_CXX \
-compiler_lib_search_path_CXX; do
- case \`eval \\\\\$ECHO \\\\""\\\\\$\$var"\\\\"\` in
- *[\\\\\\\`\\"\\\$]*)
- eval "lt_\$var=\\\\\\"\\\`\\\$ECHO \\"\\\$\$var\\" | \\\$SED \\"\\\$sed_quote_subst\\"\\\`\\\\\\""
- ;;
- *)
- eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
- ;;
- esac
-done
-
-# Double-quote double-evaled strings.
-for var in reload_cmds \
-old_postinstall_cmds \
-old_postuninstall_cmds \
-old_archive_cmds \
-extract_expsyms_cmds \
-old_archive_from_new_cmds \
-old_archive_from_expsyms_cmds \
-archive_cmds \
-archive_expsym_cmds \
-module_cmds \
-module_expsym_cmds \
-export_symbols_cmds \
-prelink_cmds \
-postlink_cmds \
-postinstall_cmds \
-postuninstall_cmds \
-finish_cmds \
-sys_lib_search_path_spec \
-sys_lib_dlsearch_path_spec \
-reload_cmds_CXX \
-old_archive_cmds_CXX \
-old_archive_from_new_cmds_CXX \
-old_archive_from_expsyms_cmds_CXX \
-archive_cmds_CXX \
-archive_expsym_cmds_CXX \
-module_cmds_CXX \
-module_expsym_cmds_CXX \
-export_symbols_cmds_CXX \
-prelink_cmds_CXX \
-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\\"\\\`\\\\\\""
- ;;
- *)
- eval "lt_\$var=\\\\\\"\\\$\$var\\\\\\""
- ;;
- esac
-done
-
-ac_aux_dir='$ac_aux_dir'
-xsi_shell='$xsi_shell'
-lt_shell_append='$lt_shell_append'
-
-# See if we are running on zsh, and set the options which allow our
-# commands through without removal of \ escapes INIT.
-if test -n "\${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
-fi
-
-
- PACKAGE='$PACKAGE'
- VERSION='$VERSION'
- TIMESTAMP='$TIMESTAMP'
- RM='$RM'
- ofile='$ofile'
-
-
-
-
-
-
+cat >>$CONFIG_STATUS <<_ACEOF
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<\_ACEOF
# Handling of arguments.
for ac_config_target in $ac_config_targets
do
case $ac_config_target in
"config.h") CONFIG_HEADERS="$CONFIG_HEADERS config.h:config.in" ;;
- "libtool") CONFIG_COMMANDS="$CONFIG_COMMANDS libtool" ;;
"mpn/$tmp_fn.$tmp_ext") CONFIG_LINKS="$CONFIG_LINKS mpn/$tmp_fn.$tmp_ext:mpn/$tmp_dir/$tmp_base.$tmp_ext" ;;
"gmp-mparam.h") CONFIG_LINKS="$CONFIG_LINKS gmp-mparam.h:mpn/$gmp_mparam_dir/gmp-mparam.h" ;;
"demos/pexpr-config.h") CONFIG_FILES="$CONFIG_FILES demos/pexpr-config.h:demos/pexpr-config-h.in" ;;
"demos/calc/calc-config.h") CONFIG_FILES="$CONFIG_FILES demos/calc/calc-config.h:demos/calc/calc-config-h.in" ;;
"Makefile") CONFIG_FILES="$CONFIG_FILES Makefile" ;;
+ "mpbsd/Makefile") CONFIG_FILES="$CONFIG_FILES mpbsd/Makefile" ;;
"mpf/Makefile") CONFIG_FILES="$CONFIG_FILES mpf/Makefile" ;;
"mpn/Makefile") CONFIG_FILES="$CONFIG_FILES mpn/Makefile" ;;
"mpq/Makefile") CONFIG_FILES="$CONFIG_FILES mpq/Makefile" ;;
"mpz/Makefile") CONFIG_FILES="$CONFIG_FILES mpz/Makefile" ;;
"printf/Makefile") CONFIG_FILES="$CONFIG_FILES printf/Makefile" ;;
"scanf/Makefile") CONFIG_FILES="$CONFIG_FILES scanf/Makefile" ;;
- "rand/Makefile") CONFIG_FILES="$CONFIG_FILES rand/Makefile" ;;
"cxx/Makefile") CONFIG_FILES="$CONFIG_FILES cxx/Makefile" ;;
"tests/Makefile") CONFIG_FILES="$CONFIG_FILES tests/Makefile" ;;
"tests/devel/Makefile") CONFIG_FILES="$CONFIG_FILES tests/devel/Makefile" ;;
+ "tests/mpbsd/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpbsd/Makefile" ;;
"tests/mpf/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpf/Makefile" ;;
"tests/mpn/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpn/Makefile" ;;
"tests/mpq/Makefile") CONFIG_FILES="$CONFIG_FILES tests/mpq/Makefile" ;;
@@ -28268,8 +34823,11 @@ do
"demos/calc/Makefile") CONFIG_FILES="$CONFIG_FILES demos/calc/Makefile" ;;
"demos/expr/Makefile") CONFIG_FILES="$CONFIG_FILES demos/expr/Makefile" ;;
"gmp.h") CONFIG_FILES="$CONFIG_FILES gmp.h:gmp-h.in" ;;
+ "mp.h") CONFIG_FILES="$CONFIG_FILES mp.h:mp-h.in" ;;
- *) as_fn_error $? "invalid argument: \`$ac_config_target'" "$LINENO" 5;;
+ *) { { echo "$as_me:$LINENO: error: invalid argument: $ac_config_target" >&5
+echo "$as_me: error: invalid argument: $ac_config_target" >&2;}
+ { (exit 1); exit 1; }; };;
esac
done
@@ -28282,7 +34840,6 @@ if $ac_need_defaults; then
test "${CONFIG_FILES+set}" = set || CONFIG_FILES=$config_files
test "${CONFIG_HEADERS+set}" = set || CONFIG_HEADERS=$config_headers
test "${CONFIG_LINKS+set}" = set || CONFIG_LINKS=$config_links
- test "${CONFIG_COMMANDS+set}" = set || CONFIG_COMMANDS=$config_commands
fi
# Have a temporary directory for convenience. Make it in the build tree
@@ -28293,302 +34850,296 @@ fi
# after its creation but before its name has been assigned to `$tmp'.
$debug ||
{
- tmp= ac_tmp=
+ tmp=
trap 'exit_status=$?
- : "${ac_tmp:=$tmp}"
- { test ! -d "$ac_tmp" || rm -fr "$ac_tmp"; } && exit $exit_status
+ { test -z "$tmp" || test ! -d "$tmp" || rm -fr "$tmp"; } && exit $exit_status
' 0
- trap 'as_fn_exit 1' 1 2 13 15
+ trap '{ (exit 1); exit 1; }' 1 2 13 15
}
# Create a (secure) tmp directory for tmp files.
{
tmp=`(umask 077 && mktemp -d "./confXXXXXX") 2>/dev/null` &&
- test -d "$tmp"
+ test -n "$tmp" && test -d "$tmp"
} ||
{
tmp=./conf$$-$RANDOM
(umask 077 && mkdir "$tmp")
-} || as_fn_error $? "cannot create a temporary directory in ." "$LINENO" 5
-ac_tmp=$tmp
-
-# Set up the scripts for CONFIG_FILES section.
-# No need to generate them if there are no CONFIG_FILES.
-# This happens for instance with `./config.status config.h'.
-if test -n "$CONFIG_FILES"; then
+} ||
+{
+ echo "$me: cannot create a temporary directory in ." >&2
+ { (exit 1); exit 1; }
+}
+#
+# Set up the sed scripts for CONFIG_FILES section.
+#
-ac_cr=`echo X | tr X '\015'`
-# On cygwin, bash can eat \r inside `` if the user requested igncr.
-# But we know of no other shell where ac_cr would be empty at this
-# point, so we can use a bashism as a fallback.
-if test "x$ac_cr" = x; then
- eval ac_cr=\$\'\\r\'
-fi
-ac_cs_awk_cr=`$AWK 'BEGIN { print "a\rb" }' </dev/null 2>/dev/null`
-if test "$ac_cs_awk_cr" = "a${ac_cr}b"; then
- ac_cs_awk_cr='\\r'
-else
- ac_cs_awk_cr=$ac_cr
-fi
+# No need to generate the scripts if there are no CONFIG_FILES.
+# This happens for instance when ./config.status config.h
+if test -n "$CONFIG_FILES"; then
-echo 'BEGIN {' >"$ac_tmp/subs1.awk" &&
_ACEOF
-{
- echo "cat >conf$$subs.awk <<_ACEOF" &&
- echo "$ac_subst_vars" | sed 's/.*/&!$&$ac_delim/' &&
- echo "_ACEOF"
-} >conf$$subs.sh ||
- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
-ac_delim_num=`echo "$ac_subst_vars" | grep -c '^'`
+
ac_delim='%!_!# '
for ac_last_try in false false false false false :; do
- . ./conf$$subs.sh ||
- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ cat >conf$$subs.sed <<_ACEOF
+SHELL!$SHELL$ac_delim
+PATH_SEPARATOR!$PATH_SEPARATOR$ac_delim
+PACKAGE_NAME!$PACKAGE_NAME$ac_delim
+PACKAGE_TARNAME!$PACKAGE_TARNAME$ac_delim
+PACKAGE_VERSION!$PACKAGE_VERSION$ac_delim
+PACKAGE_STRING!$PACKAGE_STRING$ac_delim
+PACKAGE_BUGREPORT!$PACKAGE_BUGREPORT$ac_delim
+exec_prefix!$exec_prefix$ac_delim
+prefix!$prefix$ac_delim
+program_transform_name!$program_transform_name$ac_delim
+bindir!$bindir$ac_delim
+sbindir!$sbindir$ac_delim
+libexecdir!$libexecdir$ac_delim
+datarootdir!$datarootdir$ac_delim
+datadir!$datadir$ac_delim
+sysconfdir!$sysconfdir$ac_delim
+sharedstatedir!$sharedstatedir$ac_delim
+localstatedir!$localstatedir$ac_delim
+includedir!$includedir$ac_delim
+oldincludedir!$oldincludedir$ac_delim
+docdir!$docdir$ac_delim
+infodir!$infodir$ac_delim
+htmldir!$htmldir$ac_delim
+dvidir!$dvidir$ac_delim
+pdfdir!$pdfdir$ac_delim
+psdir!$psdir$ac_delim
+libdir!$libdir$ac_delim
+localedir!$localedir$ac_delim
+mandir!$mandir$ac_delim
+DEFS!$DEFS$ac_delim
+ECHO_C!$ECHO_C$ac_delim
+ECHO_N!$ECHO_N$ac_delim
+ECHO_T!$ECHO_T$ac_delim
+LIBS!$LIBS$ac_delim
+build_alias!$build_alias$ac_delim
+host_alias!$host_alias$ac_delim
+target_alias!$target_alias$ac_delim
+build!$build$ac_delim
+build_cpu!$build_cpu$ac_delim
+build_vendor!$build_vendor$ac_delim
+build_os!$build_os$ac_delim
+host!$host$ac_delim
+host_cpu!$host_cpu$ac_delim
+host_vendor!$host_vendor$ac_delim
+host_os!$host_os$ac_delim
+INSTALL_PROGRAM!$INSTALL_PROGRAM$ac_delim
+INSTALL_SCRIPT!$INSTALL_SCRIPT$ac_delim
+INSTALL_DATA!$INSTALL_DATA$ac_delim
+CYGPATH_W!$CYGPATH_W$ac_delim
+PACKAGE!$PACKAGE$ac_delim
+VERSION!$VERSION$ac_delim
+ACLOCAL!$ACLOCAL$ac_delim
+AUTOCONF!$AUTOCONF$ac_delim
+AUTOMAKE!$AUTOMAKE$ac_delim
+AUTOHEADER!$AUTOHEADER$ac_delim
+MAKEINFO!$MAKEINFO$ac_delim
+AMTAR!$AMTAR$ac_delim
+install_sh!$install_sh$ac_delim
+STRIP!$STRIP$ac_delim
+INSTALL_STRIP_PROGRAM!$INSTALL_STRIP_PROGRAM$ac_delim
+mkdir_p!$mkdir_p$ac_delim
+AWK!$AWK$ac_delim
+SET_MAKE!$SET_MAKE$ac_delim
+am__leading_dot!$am__leading_dot$ac_delim
+MAINTAINER_MODE_TRUE!$MAINTAINER_MODE_TRUE$ac_delim
+MAINTAINER_MODE_FALSE!$MAINTAINER_MODE_FALSE$ac_delim
+MAINT!$MAINT$ac_delim
+WANT_MPBSD_TRUE!$WANT_MPBSD_TRUE$ac_delim
+WANT_MPBSD_FALSE!$WANT_MPBSD_FALSE$ac_delim
+GMP_NAIL_BITS!$GMP_NAIL_BITS$ac_delim
+ABI!$ABI$ac_delim
+HAVE_HOST_CPU_FAMILY_power!$HAVE_HOST_CPU_FAMILY_power$ac_delim
+HAVE_HOST_CPU_FAMILY_powerpc!$HAVE_HOST_CPU_FAMILY_powerpc$ac_delim
+GMP_LDFLAGS!$GMP_LDFLAGS$ac_delim
+LIBGMP_LDFLAGS!$LIBGMP_LDFLAGS$ac_delim
+LIBGMPXX_LDFLAGS!$LIBGMPXX_LDFLAGS$ac_delim
+SPEED_CYCLECOUNTER_OBJ!$SPEED_CYCLECOUNTER_OBJ$ac_delim
+CALLING_CONVENTIONS_OBJS!$CALLING_CONVENTIONS_OBJS$ac_delim
+DEFN_LONG_LONG_LIMB!$DEFN_LONG_LONG_LIMB$ac_delim
+CC!$CC$ac_delim
+CFLAGS!$CFLAGS$ac_delim
+LDFLAGS!$LDFLAGS$ac_delim
+CPPFLAGS!$CPPFLAGS$ac_delim
+ac_ct_CC!$ac_ct_CC$ac_delim
+EXEEXT!$EXEEXT$ac_delim
+OBJEXT!$OBJEXT$ac_delim
+CPP!$CPP$ac_delim
+CC_FOR_BUILD!$CC_FOR_BUILD$ac_delim
+CPP_FOR_BUILD!$CPP_FOR_BUILD$ac_delim
+EXEEXT_FOR_BUILD!$EXEEXT_FOR_BUILD$ac_delim
+U_FOR_BUILD!$U_FOR_BUILD$ac_delim
+LIBM_FOR_BUILD!$LIBM_FOR_BUILD$ac_delim
+CCAS!$CCAS$ac_delim
+CXX!$CXX$ac_delim
+CXXFLAGS!$CXXFLAGS$ac_delim
+ac_ct_CXX!$ac_ct_CXX$ac_delim
+WANT_CXX_TRUE!$WANT_CXX_TRUE$ac_delim
+_ACEOF
- ac_delim_n=`sed -n "s/.*$ac_delim\$/X/p" conf$$subs.awk | grep -c X`
- if test $ac_delim_n = $ac_delim_num; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 97; then
break
elif $ac_last_try; then
- as_fn_error $? "could not make $CONFIG_STATUS" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
-rm -f conf$$subs.sh
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-cat >>"\$ac_tmp/subs1.awk" <<\\_ACAWK &&
-_ACEOF
-sed -n '
-h
-s/^/S["/; s/!.*/"]=/
-p
-g
-s/^[^!]*!//
-:repl
-t repl
-s/'"$ac_delim"'$//
-t delim
-:nl
-h
-s/\(.\{148\}\)..*/\1/
-t more1
-s/["\\]/\\&/g; s/^/"/; s/$/\\n"\\/
-p
-n
-b repl
-:more1
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t nl
-:delim
-h
-s/\(.\{148\}\)..*/\1/
-t more2
-s/["\\]/\\&/g; s/^/"/; s/$/"/
-p
-b
-:more2
-s/["\\]/\\&/g; s/^/"/; s/$/"\\/
-p
-g
-s/.\{148\}//
-t delim
-' <conf$$subs.awk | sed '
-/^[^""]/{
- N
- s/\n//
-}
-' >>$CONFIG_STATUS || ac_write_fail=1
-rm -f conf$$subs.awk
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-_ACAWK
-cat >>"\$ac_tmp/subs1.awk" <<_ACAWK &&
- for (key in S) S_is_set[key] = 1
- FS = ""
-}
-{
- line = $ 0
- nfields = split(line, field, "@")
- substed = 0
- len = length(field[1])
- for (i = 2; i < nfields; i++) {
- key = field[i]
- keylen = length(key)
- if (S_is_set[key]) {
- value = S[key]
- line = substr(line, 1, len) "" value "" substr(line, len + keylen + 3)
- len += length(value) + length(field[++i])
- substed = 1
- } else
- len += 1 + keylen
- }
-
- print line
-}
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
-_ACAWK
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-1.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-if sed "s/$ac_cr//" < /dev/null > /dev/null 2>&1; then
- sed "s/$ac_cr\$//; s/$ac_cr/$ac_cs_awk_cr/g"
-else
- cat
-fi < "$ac_tmp/subs1.awk" > "$ac_tmp/subs.awk" \
- || as_fn_error $? "could not setup config files machinery" "$LINENO" 5
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+CEOF$ac_eof
_ACEOF
-# VPATH may cause trouble with some makes, so we remove sole $(srcdir),
-# ${srcdir} and @srcdir@ entries from VPATH if srcdir is ".", strip leading and
-# trailing colons and then remove the whole line if VPATH becomes empty
-# (actually we leave an empty line to preserve line numbers).
-if test "x$srcdir" = x.; then
- ac_vpsub='/^[ ]*VPATH[ ]*=[ ]*/{
-h
-s///
-s/^/:/
-s/[ ]*$/:/
-s/:\$(srcdir):/:/g
-s/:\${srcdir}:/:/g
-s/:@srcdir@:/:/g
-s/^:*//
-s/:*$//
-x
-s/\(=[ ]*\).*/\1/
-G
-s/\n//
-s/^[^=]*=[ ]*$//
-}'
-fi
-
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
-fi # test -n "$CONFIG_FILES"
-# Set up the scripts for CONFIG_HEADERS section.
-# No need to generate them if there are no CONFIG_HEADERS.
-# This happens for instance with `./config.status Makefile'.
-if test -n "$CONFIG_HEADERS"; then
-cat >"$ac_tmp/defines.awk" <<\_ACAWK ||
-BEGIN {
+ac_delim='%!_!# '
+for ac_last_try in false false false false false :; do
+ cat >conf$$subs.sed <<_ACEOF
+WANT_CXX_FALSE!$WANT_CXX_FALSE$ac_delim
+CXXCPP!$CXXCPP$ac_delim
+GREP!$GREP$ac_delim
+EGREP!$EGREP$ac_delim
+U!$U$ac_delim
+ANSI2KNR!$ANSI2KNR$ac_delim
+ASMFLAGS!$ASMFLAGS$ac_delim
+AR!$AR$ac_delim
+LIBGMP_DLL!$LIBGMP_DLL$ac_delim
+SED!$SED$ac_delim
+LN_S!$LN_S$ac_delim
+ECHO!$ECHO$ac_delim
+RANLIB!$RANLIB$ac_delim
+DLLTOOL!$DLLTOOL$ac_delim
+AS!$AS$ac_delim
+OBJDUMP!$OBJDUMP$ac_delim
+LIBTOOL!$LIBTOOL$ac_delim
+ENABLE_STATIC_TRUE!$ENABLE_STATIC_TRUE$ac_delim
+ENABLE_STATIC_FALSE!$ENABLE_STATIC_FALSE$ac_delim
+LIBM!$LIBM$ac_delim
+TAL_OBJECT!$TAL_OBJECT$ac_delim
+M4!$M4$ac_delim
+BITS_PER_MP_LIMB!$BITS_PER_MP_LIMB$ac_delim
+mpn_objs_in_libmp!$mpn_objs_in_libmp$ac_delim
+mpn_objects!$mpn_objects$ac_delim
+mpn_objs_in_libgmp!$mpn_objs_in_libgmp$ac_delim
+gmp_srclinks!$gmp_srclinks$ac_delim
+TUNE_SQR_OBJ!$TUNE_SQR_OBJ$ac_delim
+HAVE_CLOCK_01!$HAVE_CLOCK_01$ac_delim
+HAVE_CPUTIME_01!$HAVE_CPUTIME_01$ac_delim
+HAVE_GETRUSAGE_01!$HAVE_GETRUSAGE_01$ac_delim
+HAVE_GETTIMEOFDAY_01!$HAVE_GETTIMEOFDAY_01$ac_delim
+HAVE_SIGACTION_01!$HAVE_SIGACTION_01$ac_delim
+HAVE_SIGALTSTACK_01!$HAVE_SIGALTSTACK_01$ac_delim
+HAVE_SIGSTACK_01!$HAVE_SIGSTACK_01$ac_delim
+HAVE_SYS_RESOURCE_H_01!$HAVE_SYS_RESOURCE_H_01$ac_delim
+HAVE_STACK_T_01!$HAVE_STACK_T_01$ac_delim
+LIBCURSES!$LIBCURSES$ac_delim
+WITH_READLINE_01!$WITH_READLINE_01$ac_delim
+LIBREADLINE!$LIBREADLINE$ac_delim
+YACC!$YACC$ac_delim
+YFLAGS!$YFLAGS$ac_delim
+LEX!$LEX$ac_delim
+LEX_OUTPUT_ROOT!$LEX_OUTPUT_ROOT$ac_delim
+LEXLIB!$LEXLIB$ac_delim
+LIBOBJS!$LIBOBJS$ac_delim
+LTLIBOBJS!$LTLIBOBJS$ac_delim
_ACEOF
-# Transform confdefs.h into an awk script `defines.awk', embedded as
-# here-document in config.status, that substitutes the proper values into
-# config.h.in to produce config.h.
-
-# Create a delimiter string that does not exist in confdefs.h, to ease
-# handling of long lines.
-ac_delim='%!_!# '
-for ac_last_try in false false :; do
- ac_tt=`sed -n "/$ac_delim/p" confdefs.h`
- if test -z "$ac_tt"; then
+ if test `sed -n "s/.*$ac_delim\$/X/p" conf$$subs.sed | grep -c X` = 47; then
break
elif $ac_last_try; then
- as_fn_error $? "could not make $CONFIG_HEADERS" "$LINENO" 5
+ { { echo "$as_me:$LINENO: error: could not make $CONFIG_STATUS" >&5
+echo "$as_me: error: could not make $CONFIG_STATUS" >&2;}
+ { (exit 1); exit 1; }; }
else
ac_delim="$ac_delim!$ac_delim _$ac_delim!! "
fi
done
-# For the awk script, D is an array of macro values keyed by name,
-# likewise P contains macro parameters if any. Preserve backslash
-# newline sequences.
+ac_eof=`sed -n '/^CEOF[0-9]*$/s/CEOF/0/p' conf$$subs.sed`
+if test -n "$ac_eof"; then
+ ac_eof=`echo "$ac_eof" | sort -nru | sed 1q`
+ ac_eof=`expr $ac_eof + 1`
+fi
-ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
-sed -n '
-s/.\{148\}/&'"$ac_delim"'/g
-t rset
-:rset
-s/^[ ]*#[ ]*define[ ][ ]*/ /
-t def
-d
-:def
-s/\\$//
-t bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3"/p
-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2"/p
-d
-:bsnl
-s/["\\]/\\&/g
-s/^ \('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/P["\1"]="\2"\
-D["\1"]=" \3\\\\\\n"\\/p
-t cont
-s/^ \('"$ac_word_re"'\)[ ]*\(.*\)/D["\1"]=" \2\\\\\\n"\\/p
-t cont
-d
-:cont
-n
-s/.\{148\}/&'"$ac_delim"'/g
-t clear
-:clear
-s/\\$//
-t bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/"/p
-d
-:bsnlc
-s/["\\]/\\&/g; s/^/"/; s/$/\\\\\\n"\\/p
-b cont
-' <confdefs.h | sed '
-s/'"$ac_delim"'/"\\\
-"/g' >>$CONFIG_STATUS || ac_write_fail=1
-
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
- for (key in D) D_is_set[key] = 1
- FS = ""
-}
-/^[\t ]*#[\t ]*(define|undef)[\t ]+$ac_word_re([\t (]|\$)/ {
- line = \$ 0
- split(line, arg, " ")
- if (arg[1] == "#") {
- defundef = arg[2]
- mac1 = arg[3]
- } else {
- defundef = substr(arg[1], 2)
- mac1 = arg[2]
- }
- split(mac1, mac2, "(") #)
- macro = mac2[1]
- prefix = substr(line, 1, index(line, defundef) - 1)
- if (D_is_set[macro]) {
- # Preserve the white space surrounding the "#".
- print prefix "define", macro P[macro] D[macro]
- next
- } else {
- # Replace #undef with comments. This is necessary, for example,
- # in the case of _POSIX_SOURCE, which is predefined and required
- # on some systems where configure will not decide to define it.
- if (defundef == "undef") {
- print "/*", prefix defundef, macro, "*/"
- next
- }
- }
-}
-{ print }
-_ACAWK
+cat >>$CONFIG_STATUS <<_ACEOF
+cat >"\$tmp/subs-2.sed" <<\CEOF$ac_eof
+/@[a-zA-Z_][a-zA-Z_0-9]*@/!b end
+_ACEOF
+sed '
+s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g
+s/^/s,@/; s/!/@,|#_!!_#|/
+:n
+t n
+s/'"$ac_delim"'$/,g/; t
+s/$/\\/; p
+N; s/^.*\n//; s/[,\\&]/\\&/g; s/@/@|#_!!_#|/g; b n
+' >>$CONFIG_STATUS <conf$$subs.sed
+rm -f conf$$subs.sed
+cat >>$CONFIG_STATUS <<_ACEOF
+:end
+s/|#_!!_#|//g
+CEOF$ac_eof
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
- as_fn_error $? "could not setup config headers machinery" "$LINENO" 5
-fi # test -n "$CONFIG_HEADERS"
-eval set X " :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS :C $CONFIG_COMMANDS"
-shift
-for ac_tag
+# VPATH may cause trouble with some makes, so we remove $(srcdir),
+# ${srcdir} and @srcdir@ from VPATH if srcdir is ".", strip leading and
+# trailing colons and then remove the whole line if VPATH becomes empty
+# (actually we leave an empty line to preserve line numbers).
+if test "x$srcdir" = x.; then
+ ac_vpsub='/^[ ]*VPATH[ ]*=/{
+s/:*\$(srcdir):*/:/
+s/:*\${srcdir}:*/:/
+s/:*@srcdir@:*/:/
+s/^\([^=]*=[ ]*\):*/\1/
+s/:*$//
+s/^[^=]*=[ ]*$//
+}'
+fi
+
+cat >>$CONFIG_STATUS <<\_ACEOF
+fi # test -n "$CONFIG_FILES"
+
+
+for ac_tag in :F $CONFIG_FILES :H $CONFIG_HEADERS :L $CONFIG_LINKS
do
case $ac_tag in
:[FHLC]) ac_mode=$ac_tag; continue;;
esac
case $ac_mode$ac_tag in
:[FHL]*:*);;
- :L* | :C*:*) as_fn_error $? "invalid tag \`$ac_tag'" "$LINENO" 5;;
+ :L* | :C*:*) { { echo "$as_me:$LINENO: error: Invalid tag $ac_tag." >&5
+echo "$as_me: error: Invalid tag $ac_tag." >&2;}
+ { (exit 1); exit 1; }; };;
:[FH]-) ac_tag=-:-;;
:[FH]*) ac_tag=$ac_tag:$ac_tag.in;;
esac
@@ -28607,7 +35158,7 @@ do
for ac_f
do
case $ac_f in
- -) ac_f="$ac_tmp/stdin";;
+ -) ac_f="$tmp/stdin";;
*) # Look for the file first in the build tree, then in the source tree
# (if the path is not absolute). The absolute path cannot be DOS-style,
# because $ac_f cannot contain `:'.
@@ -28616,34 +35167,26 @@ do
[\\/$]*) false;;
*) test -f "$srcdir/$ac_f" && ac_f="$srcdir/$ac_f";;
esac ||
- as_fn_error 1 "cannot find input file: \`$ac_f'" "$LINENO" 5;;
+ { { echo "$as_me:$LINENO: error: cannot find input file: $ac_f" >&5
+echo "$as_me: error: cannot find input file: $ac_f" >&2;}
+ { (exit 1); exit 1; }; };;
esac
- case $ac_f in *\'*) ac_f=`$as_echo "$ac_f" | sed "s/'/'\\\\\\\\''/g"`;; esac
- as_fn_append ac_file_inputs " '$ac_f'"
+ ac_file_inputs="$ac_file_inputs $ac_f"
done
# Let's still pretend it is `configure' which instantiates (i.e., don't
# use $as_me), people would be surprised to read:
# /* config.h. Generated by config.status. */
- configure_input='Generated from '`
- $as_echo "$*" | sed 's|^[^:]*/||;s|:[^:]*/|, |g'
- `' by configure.'
+ configure_input="Generated from "`IFS=:
+ echo $* | sed 's|^[^:]*/||;s|:[^:]*/|, |g'`" by configure."
if test x"$ac_file" != x-; then
configure_input="$ac_file. $configure_input"
- { $as_echo "$as_me:${as_lineno-$LINENO}: creating $ac_file" >&5
-$as_echo "$as_me: creating $ac_file" >&6;}
+ { echo "$as_me:$LINENO: creating $ac_file" >&5
+echo "$as_me: creating $ac_file" >&6;}
fi
- # Neutralize special characters interpreted by sed in replacement strings.
- case $configure_input in #(
- *\&* | *\|* | *\\* )
- ac_sed_conf_input=`$as_echo "$configure_input" |
- sed 's/[\\\\&|]/\\\\&/g'`;; #(
- *) ac_sed_conf_input=$configure_input;;
- esac
case $ac_tag in
- *:-:* | *:-) cat >"$ac_tmp/stdin" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5 ;;
+ *:-:* | *:-) cat >"$tmp/stdin";;
esac
;;
esac
@@ -28653,7 +35196,7 @@ $as_expr X"$ac_file" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
X"$ac_file" : 'X\(//\)[^/]' \| \
X"$ac_file" : 'X\(//\)$' \| \
X"$ac_file" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$ac_file" |
+echo X"$ac_file" |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -28671,15 +35214,55 @@ $as_echo X"$ac_file" |
q
}
s/.*/./; q'`
- as_dir="$ac_dir"; as_fn_mkdir_p
+ { as_dir="$ac_dir"
+ case $as_dir in #(
+ -*) as_dir=./$as_dir;;
+ esac
+ test -d "$as_dir" || { $as_mkdir_p && mkdir -p "$as_dir"; } || {
+ as_dirs=
+ while :; do
+ case $as_dir in #(
+ *\'*) as_qdir=`echo "$as_dir" | sed "s/'/'\\\\\\\\''/g"`;; #(
+ *) as_qdir=$as_dir;;
+ esac
+ as_dirs="'$as_qdir' $as_dirs"
+ as_dir=`$as_dirname -- "$as_dir" ||
+$as_expr X"$as_dir" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X"$as_dir" : 'X\(//\)[^/]' \| \
+ X"$as_dir" : 'X\(//\)$' \| \
+ X"$as_dir" : 'X\(/\)' \| . 2>/dev/null ||
+echo X"$as_dir" |
+ sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)[^/].*/{
+ s//\1/
+ q
+ }
+ /^X\(\/\/\)$/{
+ s//\1/
+ q
+ }
+ /^X\(\/\).*/{
+ s//\1/
+ q
+ }
+ s/.*/./; q'`
+ test -d "$as_dir" && break
+ done
+ test -z "$as_dirs" || eval "mkdir $as_dirs"
+ } || test -d "$as_dir" || { { echo "$as_me:$LINENO: error: cannot create directory $as_dir" >&5
+echo "$as_me: error: cannot create directory $as_dir" >&2;}
+ { (exit 1); exit 1; }; }; }
ac_builddir=.
case "$ac_dir" in
.) ac_dir_suffix= ac_top_builddir_sub=. ac_top_build_prefix= ;;
*)
- ac_dir_suffix=/`$as_echo "$ac_dir" | sed 's|^\.[\\/]||'`
+ ac_dir_suffix=/`echo "$ac_dir" | sed 's,^\.[\\/],,'`
# A ".." for each directory in $ac_dir_suffix.
- ac_top_builddir_sub=`$as_echo "$ac_dir_suffix" | sed 's|/[^\\/]*|/..|g;s|/||'`
+ ac_top_builddir_sub=`echo "$ac_dir_suffix" | sed 's,/[^\\/]*,/..,g;s,/,,'`
case $ac_top_builddir_sub in
"") ac_top_builddir_sub=. ac_top_build_prefix= ;;
*) ac_top_build_prefix=$ac_top_builddir_sub/ ;;
@@ -28717,19 +35300,14 @@ ac_abs_srcdir=$ac_abs_top_srcdir$ac_dir_suffix
[\\/$]* | ?:[\\/]* ) ac_INSTALL=$INSTALL ;;
*) ac_INSTALL=$ac_top_build_prefix$INSTALL ;;
esac
- ac_MKDIR_P=$MKDIR_P
- case $MKDIR_P in
- [\\/$]* | ?:[\\/]* ) ;;
- */*) ac_MKDIR_P=$ac_top_build_prefix$MKDIR_P ;;
- esac
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<\_ACEOF
# If the template does not know about datarootdir, expand it.
# FIXME: This hack should be removed a few years after 2.60.
ac_datarootdir_hack=; ac_datarootdir_seen=
-ac_sed_dataroot='
-/datarootdir/ {
+
+case `sed -n '/datarootdir/ {
p
q
}
@@ -28737,37 +35315,36 @@ ac_sed_dataroot='
/@docdir@/p
/@infodir@/p
/@localedir@/p
-/@mandir@/p'
-case `eval "sed -n \"\$ac_sed_dataroot\" $ac_file_inputs"` in
+/@mandir@/p
+' $ac_file_inputs` in
*datarootdir*) ac_datarootdir_seen=yes;;
*@datadir@*|*@docdir@*|*@infodir@*|*@localedir@*|*@mandir@*)
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
-$as_echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
+ { echo "$as_me:$LINENO: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&5
+echo "$as_me: WARNING: $ac_file_inputs seems to ignore the --datarootdir setting" >&2;}
_ACEOF
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<_ACEOF
ac_datarootdir_hack='
s&@datadir@&$datadir&g
s&@docdir@&$docdir&g
s&@infodir@&$infodir&g
s&@localedir@&$localedir&g
s&@mandir@&$mandir&g
- s&\\\${datarootdir}&$datarootdir&g' ;;
+ s&\\\${datarootdir}&$datarootdir&g' ;;
esac
_ACEOF
# Neutralize VPATH when `$srcdir' = `.'.
# Shell code in configure.ac might set extrasub.
# FIXME: do we really want to maintain this feature?
-cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
-ac_sed_extra="$ac_vpsub
+cat >>$CONFIG_STATUS <<_ACEOF
+ sed "$ac_vpsub
$extrasub
_ACEOF
-cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1
+cat >>$CONFIG_STATUS <<\_ACEOF
:t
/@[a-zA-Z_][a-zA-Z_0-9]*@/!b
-s|@configure_input@|$ac_sed_conf_input|;t t
+s&@configure_input@&$configure_input&;t t
s&@top_builddir@&$ac_top_builddir_sub&;t t
-s&@top_build_prefix@&$ac_top_build_prefix&;t t
s&@srcdir@&$ac_srcdir&;t t
s&@abs_srcdir@&$ac_abs_srcdir&;t t
s&@top_srcdir@&$ac_top_srcdir&;t t
@@ -28776,68 +35353,136 @@ s&@builddir@&$ac_builddir&;t t
s&@abs_builddir@&$ac_abs_builddir&;t t
s&@abs_top_builddir@&$ac_abs_top_builddir&;t t
s&@INSTALL@&$ac_INSTALL&;t t
-s&@MKDIR_P@&$ac_MKDIR_P&;t t
$ac_datarootdir_hack
-"
-eval sed \"\$ac_sed_extra\" "$ac_file_inputs" | $AWK -f "$ac_tmp/subs.awk" \
- >$ac_tmp/out || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+" $ac_file_inputs | sed -f "$tmp/subs-1.sed" | sed -f "$tmp/subs-2.sed" >$tmp/out
test -z "$ac_datarootdir_hack$ac_datarootdir_seen" &&
- { ac_out=`sed -n '/\${datarootdir}/p' "$ac_tmp/out"`; test -n "$ac_out"; } &&
- { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' \
- "$ac_tmp/out"`; test -z "$ac_out"; } &&
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined" >&5
-$as_echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
-which seems to be undefined. Please make sure it is defined" >&2;}
-
- rm -f "$ac_tmp/stdin"
+ { ac_out=`sed -n '/\${datarootdir}/p' "$tmp/out"`; test -n "$ac_out"; } &&
+ { ac_out=`sed -n '/^[ ]*datarootdir[ ]*:*=/p' "$tmp/out"`; test -z "$ac_out"; } &&
+ { echo "$as_me:$LINENO: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&5
+echo "$as_me: WARNING: $ac_file contains a reference to the variable \`datarootdir'
+which seems to be undefined. Please make sure it is defined." >&2;}
+
+ rm -f "$tmp/stdin"
case $ac_file in
- -) cat "$ac_tmp/out" && rm -f "$ac_tmp/out";;
- *) rm -f "$ac_file" && mv "$ac_tmp/out" "$ac_file";;
- esac \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ -) cat "$tmp/out"; rm -f "$tmp/out";;
+ *) rm -f "$ac_file"; mv "$tmp/out" $ac_file;;
+ esac
;;
:H)
#
# CONFIG_HEADER
#
+_ACEOF
+
+# Transform confdefs.h into a sed script `conftest.defines', that
+# substitutes the proper values into config.h.in to produce config.h.
+rm -f conftest.defines conftest.tail
+# First, append a space to every undef/define line, to ease matching.
+echo 's/$/ /' >conftest.defines
+# Then, protect against being on the right side of a sed subst, or in
+# an unquoted here document, in config.status. If some macros were
+# called several times there might be several #defines for the same
+# symbol, which is useless. But do not sort them, since the last
+# AC_DEFINE must be honored.
+ac_word_re=[_$as_cr_Letters][_$as_cr_alnum]*
+# These sed commands are passed to sed as "A NAME B PARAMS C VALUE D", where
+# NAME is the cpp macro being defined, VALUE is the value it is being given.
+# PARAMS is the parameter list in the macro definition--in most cases, it's
+# just an empty string.
+ac_dA='s,^\\([ #]*\\)[^ ]*\\([ ]*'
+ac_dB='\\)[ (].*,\\1define\\2'
+ac_dC=' '
+ac_dD=' ,'
+
+uniq confdefs.h |
+ sed -n '
+ t rset
+ :rset
+ s/^[ ]*#[ ]*define[ ][ ]*//
+ t ok
+ d
+ :ok
+ s/[\\&,]/\\&/g
+ s/^\('"$ac_word_re"'\)\(([^()]*)\)[ ]*\(.*\)/ '"$ac_dA"'\1'"$ac_dB"'\2'"${ac_dC}"'\3'"$ac_dD"'/p
+ s/^\('"$ac_word_re"'\)[ ]*\(.*\)/'"$ac_dA"'\1'"$ac_dB$ac_dC"'\2'"$ac_dD"'/p
+ ' >>conftest.defines
+
+# Remove the space that was appended to ease matching.
+# Then replace #undef with comments. This is necessary, for
+# example, in the case of _POSIX_SOURCE, which is predefined and required
+# on some systems where configure will not decide to define it.
+# (The regexp can be short, since the line contains either #define or #undef.)
+echo 's/ $//
+s,^[ #]*u.*,/* & */,' >>conftest.defines
+
+# Break up conftest.defines:
+ac_max_sed_lines=50
+
+# First sed command is: sed -f defines.sed $ac_file_inputs >"$tmp/out1"
+# Second one is: sed -f defines.sed "$tmp/out1" >"$tmp/out2"
+# Third one will be: sed -f defines.sed "$tmp/out2" >"$tmp/out1"
+# et cetera.
+ac_in='$ac_file_inputs'
+ac_out='"$tmp/out1"'
+ac_nxt='"$tmp/out2"'
+
+while :
+do
+ # Write a here document:
+ cat >>$CONFIG_STATUS <<_ACEOF
+ # First, check the format of the line:
+ cat >"\$tmp/defines.sed" <<\\CEOF
+/^[ ]*#[ ]*undef[ ][ ]*$ac_word_re[ ]*\$/b def
+/^[ ]*#[ ]*define[ ][ ]*$ac_word_re[( ]/b def
+b
+:def
+_ACEOF
+ sed ${ac_max_sed_lines}q conftest.defines >>$CONFIG_STATUS
+ echo 'CEOF
+ sed -f "$tmp/defines.sed"' "$ac_in >$ac_out" >>$CONFIG_STATUS
+ ac_in=$ac_out; ac_out=$ac_nxt; ac_nxt=$ac_in
+ sed 1,${ac_max_sed_lines}d conftest.defines >conftest.tail
+ grep . conftest.tail >/dev/null || break
+ rm -f conftest.defines
+ mv conftest.tail conftest.defines
+done
+rm -f conftest.defines conftest.tail
+
+echo "ac_result=$ac_in" >>$CONFIG_STATUS
+cat >>$CONFIG_STATUS <<\_ACEOF
if test x"$ac_file" != x-; then
- {
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs"
- } >"$ac_tmp/config.h" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
- if diff "$ac_file" "$ac_tmp/config.h" >/dev/null 2>&1; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: $ac_file is unchanged" >&5
-$as_echo "$as_me: $ac_file is unchanged" >&6;}
+ echo "/* $configure_input */" >"$tmp/config.h"
+ cat "$ac_result" >>"$tmp/config.h"
+ if diff $ac_file "$tmp/config.h" >/dev/null 2>&1; then
+ { echo "$as_me:$LINENO: $ac_file is unchanged" >&5
+echo "$as_me: $ac_file is unchanged" >&6;}
else
- rm -f "$ac_file"
- mv "$ac_tmp/config.h" "$ac_file" \
- || as_fn_error $? "could not create $ac_file" "$LINENO" 5
+ rm -f $ac_file
+ mv "$tmp/config.h" $ac_file
fi
else
- $as_echo "/* $configure_input */" \
- && eval '$AWK -f "$ac_tmp/defines.awk"' "$ac_file_inputs" \
- || as_fn_error $? "could not create -" "$LINENO" 5
+ echo "/* $configure_input */"
+ cat "$ac_result"
fi
-# Compute "$ac_file"'s index in $config_headers.
-_am_arg="$ac_file"
+ rm -f "$tmp/out12"
+# Compute $ac_file's index in $config_headers.
_am_stamp_count=1
for _am_header in $config_headers :; do
case $_am_header in
- $_am_arg | $_am_arg:* )
+ $ac_file | $ac_file:* )
break ;;
* )
_am_stamp_count=`expr $_am_stamp_count + 1` ;;
esac
done
-echo "timestamp for $_am_arg" >`$as_dirname -- "$_am_arg" ||
-$as_expr X"$_am_arg" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
- X"$_am_arg" : 'X\(//\)[^/]' \| \
- X"$_am_arg" : 'X\(//\)$' \| \
- X"$_am_arg" : 'X\(/\)' \| . 2>/dev/null ||
-$as_echo X"$_am_arg" |
+echo "timestamp for $ac_file" >`$as_dirname -- $ac_file ||
+$as_expr X$ac_file : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
+ X$ac_file : 'X\(//\)[^/]' \| \
+ X$ac_file : 'X\(//\)$' \| \
+ X$ac_file : 'X\(/\)' \| . 2>/dev/null ||
+echo X$ac_file |
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
s//\1/
q
@@ -28861,852 +35506,39 @@ $as_echo X"$_am_arg" |
# CONFIG_LINK
#
- if test "$ac_source" = "$ac_file" && test "$srcdir" = '.'; then
- :
- else
- # Prefer the file from the source tree if names are identical.
- if test "$ac_source" = "$ac_file" || test ! -r "$ac_source"; then
- ac_source=$srcdir/$ac_source
- fi
-
- { $as_echo "$as_me:${as_lineno-$LINENO}: linking $ac_source to $ac_file" >&5
-$as_echo "$as_me: linking $ac_source to $ac_file" >&6;}
-
- if test ! -r "$ac_source"; then
- as_fn_error $? "$ac_source: file not found" "$LINENO" 5
- fi
- rm -f "$ac_file"
+ { echo "$as_me:$LINENO: linking $srcdir/$ac_source to $ac_file" >&5
+echo "$as_me: linking $srcdir/$ac_source to $ac_file" >&6;}
- # Try a relative symlink, then a hard link, then a copy.
- case $ac_source in
- [\\/$]* | ?:[\\/]* ) ac_rel_source=$ac_source ;;
- *) ac_rel_source=$ac_top_build_prefix$ac_source ;;
- esac
- ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
- ln "$ac_source" "$ac_file" 2>/dev/null ||
- cp -p "$ac_source" "$ac_file" ||
- as_fn_error $? "cannot link or copy $ac_source to $ac_file" "$LINENO" 5
+ if test ! -r "$srcdir/$ac_source"; then
+ { { echo "$as_me:$LINENO: error: $srcdir/$ac_source: file not found" >&5
+echo "$as_me: error: $srcdir/$ac_source: file not found" >&2;}
+ { (exit 1); exit 1; }; }
fi
- ;;
- :C) { $as_echo "$as_me:${as_lineno-$LINENO}: executing $ac_file commands" >&5
-$as_echo "$as_me: executing $ac_file commands" >&6;}
- ;;
- esac
-
-
- case $ac_file$ac_mode in
- "libtool":C)
-
- # See if we are running on zsh, and set the options which allow our
- # commands through without removal of \ escapes.
- if test -n "${ZSH_VERSION+set}" ; then
- setopt NO_GLOB_SUBST
- fi
-
- cfgfile="${ofile}T"
- trap "$RM \"$cfgfile\"; exit 1" 1 2 15
- $RM "$cfgfile"
-
- cat <<_LT_EOF >> "$cfgfile"
-#! $SHELL
-
-# `$ECHO "$ofile" | sed 's%^.*/%%'` - Provide generalized library-building support services.
-# Generated automatically by $as_me ($PACKAGE$TIMESTAMP) $VERSION
-# Libtool was configured on host `(hostname || uname -n) 2>/dev/null | sed 1q`:
-# NOTE: Changes made to this file will be lost: look at ltmain.sh.
-#
-# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005,
-# 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
-# Written by Gordon Matzigkeit, 1996
-#
-# This file is part of GNU Libtool.
-#
-# GNU Libtool 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.
-#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that 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 GNU Libtool; see the file COPYING. If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html, or
-# obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-
-# The names of the tagged configurations supported by this script.
-available_tags="CXX "
+ rm -f "$ac_file"
-# ### BEGIN LIBTOOL CONFIG
-
-# A BSD- or MS-compatible name lister.
-NM=$lt_NM
-
-# Assembler program.
-AS=$lt_AS
-
-# DLL creation program.
-DLLTOOL=$lt_DLLTOOL
-
-# Object dumper program.
-OBJDUMP=$lt_OBJDUMP
-
-# Which release of libtool.m4 was used?
-macro_version=$macro_version
-macro_revision=$macro_revision
-
-# Whether or not to build shared libraries.
-build_libtool_libs=$enable_shared
-
-# Whether or not to build static libraries.
-build_old_libs=$enable_static
-
-# What type of objects to build.
-pic_mode=$pic_mode
-
-# Whether or not to optimize for fast installation.
-fast_install=$enable_fast_install
-
-# Shell to use when invoking shell scripts.
-SHELL=$lt_SHELL
-
-# An echo program that protects backslashes.
-ECHO=$lt_ECHO
-
-# The PATH separator for the build system.
-PATH_SEPARATOR=$lt_PATH_SEPARATOR
-
-# The host system.
-host_alias=$host_alias
-host=$host
-host_os=$host_os
-
-# The build system.
-build_alias=$build_alias
-build=$build
-build_os=$build_os
-
-# A sed program that does not truncate output.
-SED=$lt_SED
-
-# Sed that helps us avoid accidentally triggering echo(1) options like -n.
-Xsed="\$SED -e 1s/^X//"
-
-# A grep program that handles long lines.
-GREP=$lt_GREP
-
-# An ERE matcher.
-EGREP=$lt_EGREP
-
-# A literal string matcher.
-FGREP=$lt_FGREP
-
-# Whether we need soft or hard links.
-LN_S=$lt_LN_S
-
-# What is the maximum length of a command?
-max_cmd_len=$max_cmd_len
-
-# Object file suffix (normally "o").
-objext=$ac_objext
-
-# Executable file suffix (normally "").
-exeext=$exeext
-
-# whether the shell understands "unset".
-lt_unset=$lt_unset
-
-# turn spaces into newlines.
-SP2NL=$lt_lt_SP2NL
-
-# turn newlines into spaces.
-NL2SP=$lt_lt_NL2SP
-
-# convert \$build file names to \$host format.
-to_host_file_cmd=$lt_cv_to_host_file_cmd
-
-# convert \$build files to toolchain format.
-to_tool_file_cmd=$lt_cv_to_tool_file_cmd
-
-# Method to check whether dependent libraries are shared objects.
-deplibs_check_method=$lt_deplibs_check_method
-
-# Command to use when deplibs_check_method = "file_magic".
-file_magic_cmd=$lt_file_magic_cmd
-
-# How to find potential files when deplibs_check_method = "file_magic".
-file_magic_glob=$lt_file_magic_glob
-
-# Find potential files using nocaseglob when deplibs_check_method = "file_magic".
-want_nocaseglob=$lt_want_nocaseglob
-
-# Command to associate shared and link libraries.
-sharedlib_from_linklib_cmd=$lt_sharedlib_from_linklib_cmd
-
-# The archiver.
-AR=$lt_AR
-
-# Flags to create an archive.
-AR_FLAGS=$lt_AR_FLAGS
-
-# How to feed a file listing to the archiver.
-archiver_list_spec=$lt_archiver_list_spec
-
-# A symbol stripping program.
-STRIP=$lt_STRIP
-
-# Commands used to install an old-style archive.
-RANLIB=$lt_RANLIB
-old_postinstall_cmds=$lt_old_postinstall_cmds
-old_postuninstall_cmds=$lt_old_postuninstall_cmds
-
-# Whether to use a lock for old archive extraction.
-lock_old_archive_extraction=$lock_old_archive_extraction
-
-# A C compiler.
-LTCC=$lt_CC
-
-# LTCC compiler flags.
-LTCFLAGS=$lt_CFLAGS
-
-# Take the output of nm and produce a listing of raw symbols and C names.
-global_symbol_pipe=$lt_lt_cv_sys_global_symbol_pipe
-
-# Transform the output of nm in a proper C declaration.
-global_symbol_to_cdecl=$lt_lt_cv_sys_global_symbol_to_cdecl
-
-# Transform the output of nm in a C name address pair.
-global_symbol_to_c_name_address=$lt_lt_cv_sys_global_symbol_to_c_name_address
-
-# Transform the output of nm in a C name address pair when lib prefix is needed.
-global_symbol_to_c_name_address_lib_prefix=$lt_lt_cv_sys_global_symbol_to_c_name_address_lib_prefix
-
-# Specify filename containing input files for \$NM.
-nm_file_list_spec=$lt_nm_file_list_spec
-
-# The root where to search for dependent libraries,and in which our libraries should be installed.
-lt_sysroot=$lt_sysroot
-
-# The name of the directory that contains temporary libtool files.
-objdir=$objdir
-
-# Used to examine libraries when file_magic_cmd begins with "file".
-MAGIC_CMD=$MAGIC_CMD
-
-# Must we lock files when doing compilation?
-need_locks=$lt_need_locks
-
-# Manifest tool.
-MANIFEST_TOOL=$lt_MANIFEST_TOOL
-
-# Tool to manipulate archived DWARF debug symbol files on Mac OS X.
-DSYMUTIL=$lt_DSYMUTIL
-
-# Tool to change global to local symbols on Mac OS X.
-NMEDIT=$lt_NMEDIT
-
-# Tool to manipulate fat objects and archives on Mac OS X.
-LIPO=$lt_LIPO
-
-# ldd/readelf like tool for Mach-O binaries on Mac OS X.
-OTOOL=$lt_OTOOL
-
-# ldd/readelf like tool for 64 bit Mach-O binaries on Mac OS X 10.4.
-OTOOL64=$lt_OTOOL64
-
-# Old archive suffix (normally "a").
-libext=$libext
-
-# Shared library suffix (normally ".so").
-shrext_cmds=$lt_shrext_cmds
-
-# The commands to extract the exported symbol list from a shared archive.
-extract_expsyms_cmds=$lt_extract_expsyms_cmds
-
-# Variables whose values should be saved in libtool wrapper scripts and
-# restored at link time.
-variables_saved_for_relink=$lt_variables_saved_for_relink
-
-# Do we need the "lib" prefix for modules?
-need_lib_prefix=$need_lib_prefix
-
-# Do we need a version for libraries?
-need_version=$need_version
-
-# Library versioning type.
-version_type=$version_type
-
-# Shared library runtime path variable.
-runpath_var=$runpath_var
-
-# Shared library path variable.
-shlibpath_var=$shlibpath_var
-
-# Is shlibpath searched before the hard-coded library search path?
-shlibpath_overrides_runpath=$shlibpath_overrides_runpath
-
-# Format of library name prefix.
-libname_spec=$lt_libname_spec
-
-# List of archive names. First name is the real one, the rest are links.
-# The last name is the one that the linker finds with -lNAME
-library_names_spec=$lt_library_names_spec
-
-# The coded name of the library, if different from the real name.
-soname_spec=$lt_soname_spec
-
-# Permission mode override for installation of shared libraries.
-install_override_mode=$lt_install_override_mode
-
-# Command to use after installation of a shared archive.
-postinstall_cmds=$lt_postinstall_cmds
-
-# Command to use after uninstallation of a shared archive.
-postuninstall_cmds=$lt_postuninstall_cmds
-
-# Commands used to finish a libtool library installation in a directory.
-finish_cmds=$lt_finish_cmds
-
-# As "finish_cmds", except a single script fragment to be evaled but
-# not shown.
-finish_eval=$lt_finish_eval
-
-# Whether we should hardcode library paths into libraries.
-hardcode_into_libs=$hardcode_into_libs
-
-# Compile-time system search path for libraries.
-sys_lib_search_path_spec=$lt_sys_lib_search_path_spec
-
-# Run-time system search path for libraries.
-sys_lib_dlsearch_path_spec=$lt_sys_lib_dlsearch_path_spec
-
-# Whether dlopen is supported.
-dlopen_support=$enable_dlopen
-
-# Whether dlopen of programs is supported.
-dlopen_self=$enable_dlopen_self
-
-# Whether dlopen of statically linked programs is supported.
-dlopen_self_static=$enable_dlopen_self_static
-
-# Commands to strip libraries.
-old_striplib=$lt_old_striplib
-striplib=$lt_striplib
-
-
-# The linker used to build libraries.
-LD=$lt_LD
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag
-reload_cmds=$lt_reload_cmds
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds
-
-# A language specific compiler.
-CC=$lt_compiler
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds
-
-# Commands used to build a shared archive.
-archive_cmds=$lt_archive_cmds
-archive_expsym_cmds=$lt_archive_expsym_cmds
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds
-module_expsym_cmds=$lt_module_expsym_cmds
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag
-
-# 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
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=$hardcode_direct
-
-# 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
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=$hardcode_minus_L
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var
-
-# 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
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=$always_export_symbols
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms
-
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds
-
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects
-postdep_objects=$lt_postdep_objects
-predeps=$lt_predeps
-postdeps=$lt_postdeps
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path
-
-# ### END LIBTOOL CONFIG
-
-_LT_EOF
-
- case $host_os in
- aix3*)
- cat <<\_LT_EOF >> "$cfgfile"
-# AIX sometimes has problems with the GCC collect2 program. For some
-# reason, if we set the COLLECT_NAMES environment variable, the problems
-# vanish in a puff of smoke.
-if test "X${COLLECT_NAMES+set}" != Xset; then
- COLLECT_NAMES=
- export COLLECT_NAMES
-fi
-_LT_EOF
- ;;
+ # Try a relative symlink, then a hard link, then a copy.
+ case $srcdir in
+ [\\/$]* | ?:[\\/]* ) ac_rel_source=$srcdir/$ac_source ;;
+ *) ac_rel_source=$ac_top_build_prefix$srcdir/$ac_source ;;
esac
-
-
-ltmain="$ac_aux_dir/ltmain.sh"
-
-
- # We use sed instead of cat because bash on DJGPP gets confused if
- # if finds mixed CR/LF and LF-only lines. Since sed operates in
- # text mode, it properly converts lines to CR/LF. This bash problem
- # is reportedly fixed, but why not run on old versions too?
- sed '$q' "$ltmain" >> "$cfgfile" \
- || (rm -f "$cfgfile"; exit 1)
-
- if test x"$xsi_shell" = xyes; then
- sed -e '/^func_dirname ()$/,/^} # func_dirname /c\
-func_dirname ()\
-{\
-\ case ${1} in\
-\ */*) func_dirname_result="${1%/*}${2}" ;;\
-\ * ) func_dirname_result="${3}" ;;\
-\ esac\
-} # Extended-shell func_dirname implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_basename ()$/,/^} # func_basename /c\
-func_basename ()\
-{\
-\ func_basename_result="${1##*/}"\
-} # Extended-shell func_basename implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_dirname_and_basename ()$/,/^} # func_dirname_and_basename /c\
-func_dirname_and_basename ()\
-{\
-\ case ${1} in\
-\ */*) func_dirname_result="${1%/*}${2}" ;;\
-\ * ) func_dirname_result="${3}" ;;\
-\ esac\
-\ func_basename_result="${1##*/}"\
-} # Extended-shell func_dirname_and_basename implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_stripname ()$/,/^} # func_stripname /c\
-func_stripname ()\
-{\
-\ # pdksh 5.2.14 does not do ${X%$Y} correctly if both X and Y are\
-\ # positional parameters, so assign one to ordinary parameter first.\
-\ func_stripname_result=${3}\
-\ func_stripname_result=${func_stripname_result#"${1}"}\
-\ func_stripname_result=${func_stripname_result%"${2}"}\
-} # Extended-shell func_stripname implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_split_long_opt ()$/,/^} # func_split_long_opt /c\
-func_split_long_opt ()\
-{\
-\ func_split_long_opt_name=${1%%=*}\
-\ func_split_long_opt_arg=${1#*=}\
-} # Extended-shell func_split_long_opt implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_split_short_opt ()$/,/^} # func_split_short_opt /c\
-func_split_short_opt ()\
-{\
-\ func_split_short_opt_arg=${1#??}\
-\ func_split_short_opt_name=${1%"$func_split_short_opt_arg"}\
-} # Extended-shell func_split_short_opt implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_lo2o ()$/,/^} # func_lo2o /c\
-func_lo2o ()\
-{\
-\ case ${1} in\
-\ *.lo) func_lo2o_result=${1%.lo}.${objext} ;;\
-\ *) func_lo2o_result=${1} ;;\
-\ esac\
-} # Extended-shell func_lo2o implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_xform ()$/,/^} # func_xform /c\
-func_xform ()\
-{\
- func_xform_result=${1%.*}.lo\
-} # Extended-shell func_xform implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_arith ()$/,/^} # func_arith /c\
-func_arith ()\
-{\
- func_arith_result=$(( $* ))\
-} # Extended-shell func_arith implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_len ()$/,/^} # func_len /c\
-func_len ()\
-{\
- func_len_result=${#1}\
-} # Extended-shell func_len implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-fi
-
-if test x"$lt_shell_append" = xyes; then
- sed -e '/^func_append ()$/,/^} # func_append /c\
-func_append ()\
-{\
- eval "${1}+=\\${2}"\
-} # Extended-shell func_append implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- sed -e '/^func_append_quoted ()$/,/^} # func_append_quoted /c\
-func_append_quoted ()\
-{\
-\ func_quote_for_eval "${2}"\
-\ eval "${1}+=\\\\ \\$func_quote_for_eval_result"\
-} # Extended-shell func_append_quoted implementation' "$cfgfile" > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
-test 0 -eq $? || _lt_function_replace_fail=:
-
-
- # Save a `func_append' function call where possible by direct use of '+='
- sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1+="%g' $cfgfile > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
- test 0 -eq $? || _lt_function_replace_fail=:
-else
- # Save a `func_append' function call even when '+=' is not available
- sed -e 's%func_append \([a-zA-Z_]\{1,\}\) "%\1="$\1%g' $cfgfile > $cfgfile.tmp \
- && mv -f "$cfgfile.tmp" "$cfgfile" \
- || (rm -f "$cfgfile" && cp "$cfgfile.tmp" "$cfgfile" && rm -f "$cfgfile.tmp")
- test 0 -eq $? || _lt_function_replace_fail=:
-fi
-
-if test x"$_lt_function_replace_fail" = x":"; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: Unable to substitute extended shell functions in $ofile" >&5
-$as_echo "$as_me: WARNING: Unable to substitute extended shell functions in $ofile" >&2;}
-fi
-
-
- mv -f "$cfgfile" "$ofile" ||
- (rm -f "$ofile" && cp "$cfgfile" "$ofile" && rm -f "$cfgfile")
- chmod +x "$ofile"
-
-
- cat <<_LT_EOF >> "$ofile"
-
-# ### BEGIN LIBTOOL TAG CONFIG: CXX
-
-# The linker used to build libraries.
-LD=$lt_LD_CXX
-
-# How to create reloadable object files.
-reload_flag=$lt_reload_flag_CXX
-reload_cmds=$lt_reload_cmds_CXX
-
-# Commands used to build an old-style archive.
-old_archive_cmds=$lt_old_archive_cmds_CXX
-
-# A language specific compiler.
-CC=$lt_compiler_CXX
-
-# Is the compiler the GNU compiler?
-with_gcc=$GCC_CXX
-
-# Compiler flag to turn off builtin functions.
-no_builtin_flag=$lt_lt_prog_compiler_no_builtin_flag_CXX
-
-# Additional compiler flags for building library objects.
-pic_flag=$lt_lt_prog_compiler_pic_CXX
-
-# How to pass a linker flag through the compiler.
-wl=$lt_lt_prog_compiler_wl_CXX
-
-# Compiler flag to prevent dynamic linking.
-link_static_flag=$lt_lt_prog_compiler_static_CXX
-
-# Does compiler simultaneously support -c and -o options?
-compiler_c_o=$lt_lt_cv_prog_compiler_c_o_CXX
-
-# Whether or not to add -lc for building shared libraries.
-build_libtool_need_lc=$archive_cmds_need_lc_CXX
-
-# Whether or not to disallow shared libs when runtime libs are static.
-allow_libtool_libs_with_static_runtimes=$enable_shared_with_static_runtimes_CXX
-
-# Compiler flag to allow reflexive dlopens.
-export_dynamic_flag_spec=$lt_export_dynamic_flag_spec_CXX
-
-# Compiler flag to generate shared objects directly from archives.
-whole_archive_flag_spec=$lt_whole_archive_flag_spec_CXX
-
-# Whether the compiler copes with passing no objects directly.
-compiler_needs_object=$lt_compiler_needs_object_CXX
-
-# Create an old-style archive from a shared archive.
-old_archive_from_new_cmds=$lt_old_archive_from_new_cmds_CXX
-
-# Create a temporary old-style archive to link instead of a shared archive.
-old_archive_from_expsyms_cmds=$lt_old_archive_from_expsyms_cmds_CXX
-
-# Commands used to build a shared archive.
-archive_cmds=$lt_archive_cmds_CXX
-archive_expsym_cmds=$lt_archive_expsym_cmds_CXX
-
-# Commands used to build a loadable module if different from building
-# a shared archive.
-module_cmds=$lt_module_cmds_CXX
-module_expsym_cmds=$lt_module_expsym_cmds_CXX
-
-# Whether we are building with GNU ld or not.
-with_gnu_ld=$lt_with_gnu_ld_CXX
-
-# Flag that allows shared libraries with undefined symbols to be built.
-allow_undefined_flag=$lt_allow_undefined_flag_CXX
-
-# Flag that enforces no undefined symbols.
-no_undefined_flag=$lt_no_undefined_flag_CXX
-
-# 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_CXX
-
-# Whether we need a single "-rpath" flag with a separated argument.
-hardcode_libdir_separator=$lt_hardcode_libdir_separator_CXX
-
-# Set to "yes" if using DIR/libNAME\${shared_ext} during linking hardcodes
-# DIR into the resulting binary.
-hardcode_direct=$hardcode_direct_CXX
-
-# 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_CXX
-
-# Set to "yes" if using the -LDIR flag during linking hardcodes DIR
-# into the resulting binary.
-hardcode_minus_L=$hardcode_minus_L_CXX
-
-# Set to "yes" if using SHLIBPATH_VAR=DIR during linking hardcodes DIR
-# into the resulting binary.
-hardcode_shlibpath_var=$hardcode_shlibpath_var_CXX
-
-# 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_CXX
-
-# Set to yes if linker adds runtime paths of dependent libraries
-# to runtime path list.
-inherit_rpath=$inherit_rpath_CXX
-
-# Whether libtool must link a program against all its dependency libraries.
-link_all_deplibs=$link_all_deplibs_CXX
-
-# Set to "yes" if exported symbols are required.
-always_export_symbols=$always_export_symbols_CXX
-
-# The commands to list exported symbols.
-export_symbols_cmds=$lt_export_symbols_cmds_CXX
-
-# Symbols that should not be listed in the preloaded symbols.
-exclude_expsyms=$lt_exclude_expsyms_CXX
-
-# Symbols that must always be exported.
-include_expsyms=$lt_include_expsyms_CXX
-
-# Commands necessary for linking programs (against libraries) with templates.
-prelink_cmds=$lt_prelink_cmds_CXX
-
-# Commands necessary for finishing linking programs.
-postlink_cmds=$lt_postlink_cmds_CXX
-
-# Specify filename containing input files.
-file_list_spec=$lt_file_list_spec_CXX
-
-# How to hardcode a shared library path into an executable.
-hardcode_action=$hardcode_action_CXX
-
-# The directories searched by this compiler when creating a shared library.
-compiler_lib_search_dirs=$lt_compiler_lib_search_dirs_CXX
-
-# Dependencies to place before and after the objects being linked to
-# create a shared library.
-predep_objects=$lt_predep_objects_CXX
-postdep_objects=$lt_postdep_objects_CXX
-predeps=$lt_predeps_CXX
-postdeps=$lt_postdeps_CXX
-
-# The library search path used internally by the compiler when linking
-# a shared library.
-compiler_lib_search_path=$lt_compiler_lib_search_path_CXX
-
-# ### END LIBTOOL TAG CONFIG: CXX
-_LT_EOF
-
+ ln -s "$ac_rel_source" "$ac_file" 2>/dev/null ||
+ ln "$srcdir/$ac_source" "$ac_file" 2>/dev/null ||
+ cp -p "$srcdir/$ac_source" "$ac_file" ||
+ { { echo "$as_me:$LINENO: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&5
+echo "$as_me: error: cannot link or copy $srcdir/$ac_source to $ac_file" >&2;}
+ { (exit 1); exit 1; }; }
;;
esac
+
done # for ac_tag
-as_fn_exit 0
+{ (exit 0); exit 0; }
_ACEOF
+chmod +x $CONFIG_STATUS
ac_clean_files=$ac_clean_files_save
-test $ac_write_fail = 0 ||
- as_fn_error $? "write failure creating $CONFIG_STATUS" "$LINENO" 5
-
# configure is writing to config.log, and then calls config.status.
# config.status does its own redirection, appending to config.log.
@@ -29726,45 +35558,6 @@ if test "$no_create" != yes; then
exec 5>>config.log
# Use ||, not &&, to avoid exiting from the if with $? = 1, which
# would make configure fail if this is the last instruction.
- $ac_cs_success || as_fn_exit 1
-fi
-if test -n "$ac_unrecognized_opts" && test "$enable_option_checking" != no; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: unrecognized options: $ac_unrecognized_opts" >&5
-$as_echo "$as_me: WARNING: unrecognized options: $ac_unrecognized_opts" >&2;}
-fi
-
-
-{ $as_echo "$as_me:${as_lineno-$LINENO}: summary of build options:
-
- Version: ${PACKAGE_STRING}
- Host type: ${host}
- ABI: ${ABI}
- Install prefix: ${prefix}
- Compiler: ${CC}
- Static libraries: ${enable_static}
- Shared libraries: ${enable_shared}
-" >&5
-$as_echo "$as_me: summary of build options:
-
- Version: ${PACKAGE_STRING}
- Host type: ${host}
- ABI: ${ABI}
- Install prefix: ${prefix}
- Compiler: ${CC}
- Static libraries: ${enable_static}
- Shared libraries: ${enable_shared}
-" >&6;}
-
-if test x$cross_compiling = xyes ; then
- case "$host" in
- *-*-mingw* | *-*-cygwin)
- if test x$ABI = x64 ; then
- { $as_echo "$as_me:${as_lineno-$LINENO}: If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64." >&5
-$as_echo "$as_me: If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64." >&6;}
- else
- { $as_echo "$as_me:${as_lineno-$LINENO}: If wine is installed, use make check TESTS_ENVIRONMENT=wine." >&5
-$as_echo "$as_me: If wine is installed, use make check TESTS_ENVIRONMENT=wine." >&6;}
- fi
- ;;
- esac
+ $ac_cs_success || { (exit 1); exit 1; }
fi
+
diff --git a/gmp/configure.ac b/gmp/configure.in
index 64b2c50957..d9c7ebb697 100644
--- a/gmp/configure.ac
+++ b/gmp/configure.in
@@ -3,33 +3,23 @@ dnl Process this file with autoconf to produce a configure script.
define(GMP_COPYRIGHT,[[
-Copyright 1996-2014 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
]])
AC_COPYRIGHT(GMP_COPYRIGHT)
@@ -37,7 +27,7 @@ AH_TOP(/*GMP_COPYRIGHT*/)
AC_REVISION($Revision$)
AC_PREREQ(2.59)
-AC_INIT(GNU MP, GMP_VERSION, [gmp-bugs@gmplib.org, see https://gmplib.org/manual/Reporting-Bugs.html], gmp)
+AC_INIT(GNU MP, GMP_VERSION, gmp-bugs@gmplib.org, gmp)
AC_CONFIG_SRCDIR(gmp-impl.h)
m4_pattern_forbid([^[ \t]*GMP_])
m4_pattern_allow(GMP_LDFLAGS)
@@ -45,8 +35,6 @@ m4_pattern_allow(GMP_LIMB_BITS)
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
@@ -77,8 +65,8 @@ dnl
dnl Note that there's a copy of these options in the top-level Makefile.am,
dnl so update there too if changing anything.
dnl
-AM_INIT_AUTOMAKE([1.8 gnu no-dependencies])
-AC_CONFIG_HEADERS(config.h:config.in)
+AM_INIT_AUTOMAKE([1.8 gnu no-dependencies $(top_builddir)/ansi2knr])
+AM_CONFIG_HEADER(config.h:config.in)
AM_MAINTAINER_MODE
@@ -134,20 +122,6 @@ esac],
[enable_cxx=no])
-AC_ARG_ENABLE(assembly,
-AC_HELP_STRING([--enable-assembly],[enable the use of assembly loops [[default=yes]]]),
-[case $enableval in
-yes|no) ;;
-*) AC_MSG_ERROR([bad value $enableval for --enable-assembly, need yes or no]) ;;
-esac],
-[enable_assembly=yes])
-
-if test "$enable_assembly" = "yes"; then
- AC_DEFINE(WANT_ASSEMBLY,1,
- [Defined to 1 as per --enable-assembly])
-fi
-
-
AC_ARG_ENABLE(fft,
AC_HELP_STRING([--enable-fft],[enable FFTs for multiplication [[default=yes]]]),
[case $enableval in
@@ -162,18 +136,15 @@ if test "$enable_fft" = "yes"; then
fi
-AC_ARG_ENABLE(old-fft-full,
-AC_HELP_STRING([--enable-old-fft-full],[enable old mpn_mul_fft_full for multiplication [[default=no]]]),
+AC_ARG_ENABLE(mpbsd,
+AC_HELP_STRING([--enable-mpbsd],
+ [build Berkeley MP compatibility library [[default=no]]]),
[case $enableval in
yes|no) ;;
-*) AC_MSG_ERROR([bad value $enableval for --enable-old-fft-full, need yes or no]) ;;
+*) AC_MSG_ERROR([bad value $enableval for --enable-mpbsd, need yes or no]) ;;
esac],
-[enable_old_fft_full=no])
-
-if test "$enable_old_fft_full" = "yes"; then
- AC_DEFINE(WANT_OLD_FFT_FULL,1,
- [Define to 1 to enable old mpn_mul_fft_full for multiplication, per --enable-old-fft-full])
-fi
+[enable_mpbsd=no])
+AM_CONDITIONAL(WANT_MPBSD, test "$enable_mpbsd" = "yes")
AC_ARG_ENABLE(nails,
@@ -259,28 +230,6 @@ 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)
@@ -301,7 +250,6 @@ AH_VERBATIM([HAVE_HOST_CPU_1],
#undef HAVE_HOST_CPU_FAMILY_power
#undef HAVE_HOST_CPU_FAMILY_powerpc
#undef HAVE_HOST_CPU_FAMILY_x86
-#undef HAVE_HOST_CPU_FAMILY_x86_64
/* Define one of the following to 1 for the host CPU, as per the output of
./config.guess. If your CPU is not listed here, leave all undefined. */
@@ -325,15 +273,7 @@ AH_VERBATIM([HAVE_HOST_CPU_1],
#undef HAVE_HOST_CPU_pentiummmx
#undef HAVE_HOST_CPU_pentiumpro
#undef HAVE_HOST_CPU_pentium2
-#undef HAVE_HOST_CPU_pentium3
-#undef HAVE_HOST_CPU_s390_z900
-#undef HAVE_HOST_CPU_s390_z990
-#undef HAVE_HOST_CPU_s390_z9
-#undef HAVE_HOST_CPU_s390_z10
-#undef HAVE_HOST_CPU_s390_z196
-
-/* Define to 1 iff we have a s390 with 64-bit registers. */
-#undef HAVE_HOST_CPU_s390_zarch])
+#undef HAVE_HOST_CPU_pentium3])
# Table of compilers, options, and mpn paths. This code has various related
@@ -458,23 +398,22 @@ 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
- alphaev5* | alphapca5*)
- path="alpha/ev5 alpha" ;;
+ alphaev5* | alphapca5*) path="alpha/ev5 alpha" ;;
alphaev67 | alphaev68 | alphaev7*)
- path="alpha/ev67 alpha/ev6 alpha" ;;
- alphaev6)
- path="alpha/ev6 alpha" ;;
- *)
- path="alpha" ;;
+ path="alpha/ev67 alpha/ev6 alpha/ev5 alpha" ;;
+ alphaev6* | alphaev7*) path="alpha/ev6 alpha/ev5 alpha" ;;
+ *) path="alpha" ;;
esac
- if test "$enable_assembly" = "yes" ; then
- extra_functions="cntlz"
- fi
+ extra_functions="cntlz"
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.
@@ -596,80 +535,16 @@ case $host in
;;
- arm64*-*-* | aarch64*-*-*)
- path="arm64"
- ;;
-
-
arm*-*-*)
+ path="arm"
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- 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 | arm9tdmi | armv4*)
- path="arm"
- gcc_cflags_arch="-march=armv4"
- ;;
- armxscale | arm9te | arm10 | armv5*)
- path="arm/v5 arm"
- gcc_cflags_arch="-march=armv5"
- ;;
- arm11mpcore | arm1136 | arm1176 | armv6*)
- path="arm/v6 arm/v5 arm"
- gcc_cflags_arch="-march=armv6"
- ;;
- arm1156)
- 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"
- ;;
- 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"
- ;;
- esac
+
+ clipper*-*-*)
+ path="clipper"
;;
@@ -693,6 +568,7 @@ case $host in
# checking sizeof(long), either 4 or 8 bytes respectively. Do this in
# ABI=1.0 too, in case someone tries to build that with a 2.0w gcc.
#
+ gcc_cflags="-O2"
gcc_cflags_optlist="arch"
gcc_testlist="sizeof-long-4"
SPEED_CYCLECOUNTER_OBJ=hppa.lo
@@ -745,7 +621,7 @@ case $host in
# -mpa-risc-2-0 is only an optional flag, in case an old gcc is
# used. Assembler support for 2.0 is essential though, for our asm
# files.
- gcc_20n_cflags="$gcc_cflags"
+ gcc_20n_cflags="-O2"
gcc_20n_cflags_optlist="arch"
gcc_20n_cflags_arch="-mpa-risc-2-0 -mpa-risc-1-1"
gcc_20n_testlist="sizeof-long-4 hppa-level-2.0"
@@ -763,12 +639,11 @@ case $host in
# systems (GNU/Linux for instance), but lets assume they're ok.
case $host in
[*-*-hpux[1-9] | *-*-hpux[1-9].* | *-*-hpux10 | *-*-hpux10.*]) ;;
- [*-*-linux*]) abilist="1.0" ;; # due to linux permanent kernel bug
*) abilist="2.0w $abilist" ;;
esac
cclist_20w="gcc cc"
- gcc_20w_cflags="$gcc_cflags -mpa-risc-2-0"
+ gcc_20w_cflags="-O2 -mpa-risc-2-0"
cc_20w_cflags="+DD64 +O2"
cc_20w_testlist="hpc-hppa-2-0"
path_20w="pa64"
@@ -782,11 +657,15 @@ case $host in
;;
+ i960*-*-*)
+ path="i960"
+ ;;
+
+
IA64_PATTERN)
abilist="64"
GMP_INCLUDE_MPN(ia64/ia64-defs.m4)
SPEED_CYCLECOUNTER_OBJ=ia64.lo
- any_32_testlist="sizeof-long-4"
case $host_cpu in
itanium) path="ia64/itanium ia64" ;;
@@ -820,14 +699,13 @@ case $host in
# let us use whatever seems to work.
#
abilist="32 64"
- any_64_testlist="sizeof-long-8"
cclist_32="gcc cc"
path_32="ia64"
cc_32_cflags=""
cc_32_cflags_optlist="opt"
cc_32_cflags_opt="+O3 +O2 +O1"
- gcc_32_cflags="$gcc_cflags -milp32"
+ gcc_32_cflags="-milp32 -O2"
limb_32=longlong
SPEED_CYCLECOUNTER_OBJ_32=ia64.lo
cyclecounter_size_32=2
@@ -842,7 +720,7 @@ case $host in
cc_64_cppflags="+DD64"
cc_64_cflags_optlist="opt"
cc_64_cflags_opt="+O3 +O2 +O1"
- gcc_64_cflags="$gcc_cflags -mlp64"
+ gcc_64_cflags="$gcc_64_cflags -mlp64"
;;
esac
;;
@@ -889,6 +767,12 @@ 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
@@ -917,13 +801,13 @@ case $host in
abilist="n32 64 o32"
cclist_n32="gcc cc"
- gcc_n32_cflags="$gcc_cflags -mabi=n32"
+ gcc_n32_cflags="-O2 -mabi=n32"
cc_n32_cflags="-O2 -n32" # no -g, it disables all optimizations
limb_n32=longlong
path_n32="mips64"
cclist_64="gcc cc"
- gcc_64_cflags="$gcc_cflags -mabi=64"
+ gcc_64_cflags="$gcc_64_cflags -mabi=64"
gcc_64_ldflags="-Wc,-mabi=64"
cc_64_cflags="-O2 -64" # no -g, it disables all optimizations
cc_64_ldflags="-Wc,-64"
@@ -961,13 +845,12 @@ case $host in
abilist="32"
cclist="gcc cc"
cc_cflags="-O2"
- gcc_32_cflags="$gcc_cflags -mpowerpc"
+ gcc_cflags="$gcc_cflags -mpowerpc"
gcc_cflags_optlist="precomp subtype asm cpu"
gcc_cflags_precomp="-no-cpp-precomp"
gcc_cflags_subtype="-force_cpusubtype_ALL" # for vmx on darwin
gcc_cflags_asm=""
gcc_cflags_cpu=""
- vmx_path=""
# grab this object, though it's not a true cycle counter routine
SPEED_CYCLECOUNTER_OBJ=powerpc.lo
@@ -984,28 +867,32 @@ case $host in
path="powerpc32" ;;
esac
+ # gcc 2.7.2 knows -mcpu=403, 601, 603, 604.
+ # gcc 2.95 adds 401, 505, 602, 603e, ec603e, 604e, 620, 740, 750,
+ # 801, 821, 823, 860.
+ # gcc 3.0 adds 630, rs64a.
+ # gcc 3.1 adds 405, 7400, 7450.
+ # gcc 3.2 adds nothing.
+ # gcc 3.3 adds power3, power4, 8540. power3 seems to be a synonym for 630.
+ # gcc pre-release 3.4 adds 405fp, 440, 440fp, 970.
+ #
+ # FIXME: The way 603e falls back to 603 for gcc 2.7.2 should be
+ # done for all the others too. But what would be the correct
+ # arrangements?
+ #
case $host_cpu in
powerpc401) gcc_cflags_cpu="-mcpu=401" ;;
- powerpc403) gcc_cflags_cpu="-mcpu=403"
- xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
+ powerpc403) gcc_cflags_cpu="-mcpu=403" ;;
powerpc405) gcc_cflags_cpu="-mcpu=405" ;;
powerpc505) gcc_cflags_cpu="-mcpu=505" ;;
- powerpc601) gcc_cflags_cpu="-mcpu=601"
- xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
- powerpc602) gcc_cflags_cpu="-mcpu=602"
- xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
- powerpc603) gcc_cflags_cpu="-mcpu=603"
- xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603"
- xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
- powerpc604) gcc_cflags_cpu="-mcpu=604"
- xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
- powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604"
- xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ powerpc601) gcc_cflags_cpu="-mcpu=601" ;;
+ powerpc602) gcc_cflags_cpu="-mcpu=602" ;;
+ powerpc603) gcc_cflags_cpu="-mcpu=603" ;;
+ powerpc603e) gcc_cflags_cpu="-mcpu=603e -mcpu=603" ;;
+ powerpc604) gcc_cflags_cpu="-mcpu=604" ;;
+ powerpc604e) gcc_cflags_cpu="-mcpu=604e -mcpu=604" ;;
powerpc620) gcc_cflags_cpu="-mcpu=620" ;;
- powerpc630) gcc_cflags_cpu="-mcpu=630"
- xlc_cflags_arch="-qarch=pwr3"
- cpu_path="p3 p3-p7" ;;
+ powerpc630) gcc_cflags_cpu="-mcpu=630" ;;
powerpc740) gcc_cflags_cpu="-mcpu=740" ;;
powerpc7400 | powerpc7410)
gcc_cflags_asm="-Wa,-maltivec"
@@ -1018,78 +905,71 @@ case $host in
powerpc821) gcc_cflags_cpu="-mcpu=821" ;;
powerpc823) gcc_cflags_cpu="-mcpu=823" ;;
powerpc860) gcc_cflags_cpu="-mcpu=860" ;;
- powerpc970) gcc_cflags_cpu="-mtune=970"
- xlc_cflags_arch="-qarch=970 -qarch=pwr3"
- vmx_path="powerpc64/vmx"
- cpu_path="p4 p3-p7" ;;
- power4) gcc_cflags_cpu="-mtune=power4"
- xlc_cflags_arch="-qarch=pwr4"
- cpu_path="p4 p3-p7" ;;
- power5) gcc_cflags_cpu="-mtune=power5 -mtune=power4"
- xlc_cflags_arch="-qarch=pwr5"
- cpu_path="p5 p4 p3-p7" ;;
- power6) gcc_cflags_cpu="-mtune=power6"
- xlc_cflags_arch="-qarch=pwr6"
- cpu_path="p6 p3-p7" ;;
- power7) gcc_cflags_cpu="-mtune=power7 -mtune=power5"
- xlc_cflags_arch="-qarch=pwr7 -qarch=pwr5"
- cpu_path="p7 p5 p4 p3-p7" ;;
+ powerpc970) gcc_cflags_cpu="-mcpu=970" ;;
esac
case $host in
*-*-aix*)
- cclist="gcc xlc cc"
- gcc_32_cflags_maybe="-maix32"
- xlc_cflags="-O2 -qmaxmem=20000"
- xlc_cflags_optlist="arch"
- xlc_32_cflags_maybe="-q32"
- ar_32_flags="-X32"
- nm_32_flags="-X32"
+ cclist="gcc xlc cc"
+ xlc_cflags="-O2 -qmaxmem=20000"
+ xlc_cflags_optlist="arch"
+
+ # xlc (what version?) knows -qarch=ppc, ppcgr, 601, 602, 603, 604,
+ # 403, rs64a
+ # -qarch=ppc is needed, so ensure everything falls back to that.
+ # FIXME: Perhaps newer versions know more flavours.
+ #
+ case $host_cpu in
+ powerpc403) xlc_cflags_arch="-qarch=403 -qarch=ppc" ;;
+ powerpc601) xlc_cflags_arch="-qarch=601 -qarch=ppc" ;;
+ powerpc602) xlc_cflags_arch="-qarch=602 -qarch=ppc" ;;
+ powerpc603) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
+ powerpc603e) xlc_cflags_arch="-qarch=603 -qarch=ppc" ;;
+ powerpc604) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ powerpc604e) xlc_cflags_arch="-qarch=604 -qarch=ppc" ;;
+ *) xlc_cflags_arch="-qarch=ppc" ;;
+ esac
+ ;;
esac
case $host in
POWERPC64_PATTERN)
- case $host in
- *-*-aix*)
- # On AIX a true 64-bit ABI is available.
- # Need -Wc to pass object type flags through to the linker.
- abilist="mode64 $abilist"
- cclist_mode64="gcc xlc"
- gcc_mode64_cflags="$gcc_cflags -maix64 -mpowerpc64"
- gcc_mode64_cflags_optlist="cpu"
- gcc_mode64_ldflags="-Wc,-maix64"
- xlc_mode64_cflags="-O2 -q64 -qmaxmem=20000"
- xlc_mode64_cflags_optlist="arch"
- xlc_mode64_ldflags="-Wc,-q64"
- # Must indicate object type to ar and nm
- ar_mode64_flags="-X64"
- nm_mode64_flags="-X64"
- path_mode64=""
- p=""
- for i in $cpu_path
- do path_mode64="${path_mode64}powerpc64/mode64/$i "
- path_mode64="${path_mode64}powerpc64/$i "
- p="${p} powerpc32/$i "
- done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- path="$p $path"
- # grab this object, though it's not a true cycle counter routine
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
- ;;
- *-*-darwin*)
- # On Darwin we can use 64-bit instructions with a longlong limb,
- # but the chip still in 32-bit mode.
- # In theory this can be used on any OS which knows how to save
- # 64-bit registers in a context switch.
- #
- # Note that we must use -mpowerpc64 with gcc, since the
- # longlong.h macros expect limb operands in a single 64-bit
- # register, not two 32-bit registers as would be given for a
- # long long without -mpowerpc64. In theory we could detect and
- # accommodate both styles, but the proper 64-bit registers will
- # be fastest and are what we really want to use.
- #
+ case $host_cpu in
+ powerpc970) vmx_path="powerpc64/vmx" ;;
+ *) vmx_path="" ;;
+ esac
+ case $host in
+ *-*-aix*)
+ # On AIX a true 64-bit ABI is available.
+ # Need -Wc to pass object type flags through to the linker.
+ abilist="aix64 $abilist"
+ cclist_aix64="gcc xlc"
+ gcc_aix64_cflags="-O2 -maix64 -mpowerpc64"
+ gcc_aix64_cflags_optlist="cpu"
+ gcc_aix64_ldflags="-Wc,-maix64"
+ xlc_aix64_cflags="-O2 -q64 -qtune=pwr3 -qmaxmem=20000"
+ xlc_aix64_ldflags="-Wc,-q64"
+ # Must indicate object type to ar and nm
+ ar_aix64_flags="-X64"
+ nm_aix64_flags="-X64"
+ path_aix64="powerpc64/mode64 $vmx_path powerpc64"
+ # grab this object, though it's not a true cycle counter routine
+ SPEED_CYCLECOUNTER_OBJ_aix64=powerpc64.lo
+ cyclecounter_size_aix64=0
+ ;;
+ *-*-darwin*)
+ # On Darwin we can use 64-bit instructions with a longlong limb,
+ # but the chip still in 32-bit mode.
+ # In theory this can be used on any OS which knows how to save
+ # 64-bit registers in a context switch.
+ #
+ # Note that we must use -mpowerpc64 with gcc, since the
+ # longlong.h macros expect limb operands in a single 64-bit
+ # register, not two 32-bit registers as would be given for a
+ # long long without -mpowerpc64. In theory we could detect and
+ # accomodate both styles, but the proper 64-bit registers will
+ # be fastest and are what we really want to use.
+ #
# One would think -mpowerpc64 would set the assembler in the right
# mode to handle 64-bit instructions. But for that, also
# -force_cpusubtype_ALL is needed.
@@ -1098,34 +978,21 @@ case $host in
# incompatible with a shared library.
#
abilist="mode64 mode32 $abilist"
- gcc_32_cflags_maybe="-m32"
gcc_cflags_opt="-O3 -O2 -O1" # will this become used?
cclist_mode32="gcc"
- gcc_mode32_cflags_maybe="-m32"
gcc_mode32_cflags="-mpowerpc64"
gcc_mode32_cflags_optlist="subtype cpu opt"
gcc_mode32_cflags_subtype="-force_cpusubtype_ALL"
gcc_mode32_cflags_opt="-O3 -O2 -O1"
+ path_mode32="powerpc64/mode32 $vmx_path powerpc64"
limb_mode32=longlong
cclist_mode64="gcc"
gcc_mode64_cflags="-m64"
gcc_mode64_cflags_optlist="cpu opt"
gcc_mode64_cflags_opt="-O3 -O2 -O1"
- path_mode64=""
- path_mode32=""
- p=""
- for i in $cpu_path
- do path_mode64="${path_mode64}powerpc64/mode64/$i "
- path_mode64="${path_mode64}powerpc64/$i "
- path_mode32="${path_mode32}powerpc64/mode32/$i "
- path_mode32="${path_mode32}powerpc64/$i "
- p="${p} powerpc32/$i "
- done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64"
- path="$p $path"
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
+ path_mode64="powerpc64/mode64 $vmx_path powerpc64"
+ SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
+ cyclecounter_size_mode64=0
any_mode64_testlist="sizeof-long-8"
;;
*-*-linux* | *-*-*bsd*)
@@ -1134,51 +1001,38 @@ case $host in
# others require -m64, hence the use of cflags_maybe. The
# sizeof-long-8 test checks the mode is right (for the no option
# case).
- #
- # -mpowerpc64 is not used, since it should be the default in
- # 64-bit mode. (We need its effect for the various longlong.h
- # asm macros to be right of course.)
- #
- # gcc64 was an early port of gcc to 64-bit mode, but should be
- # obsolete before too long. We prefer plain gcc when it knows
- # 64-bits.
+ #
+ # -mpowerpc64 is not used, since it should be the default in
+ # 64-bit mode. (We need its effect for the various longlong.h
+ # asm macros to be right of course.)
+ #
+ # gcc64 was an early port of gcc to 64-bit mode, but should be
+ # obsolete before too long. We prefer plain gcc when it knows
+ # 64-bits.
#
abilist="mode64 mode32 $abilist"
- gcc_32_cflags_maybe="-m32"
cclist_mode32="gcc"
- gcc_mode32_cflags_maybe="-m32"
gcc_mode32_cflags="-mpowerpc64"
gcc_mode32_cflags_optlist="cpu opt"
gcc_mode32_cflags_opt="-O3 -O2 -O1"
+ path_mode32="powerpc64/mode32 $vmx_path powerpc64"
limb_mode32=longlong
cclist_mode64="gcc gcc64"
gcc_mode64_cflags_maybe="-m64"
gcc_mode64_cflags_optlist="cpu opt"
gcc_mode64_cflags_opt="-O3 -O2 -O1"
- path_mode64=""
- path_mode32=""
- p=""
- for i in $cpu_path
- do path_mode64="${path_mode64}powerpc64/mode64/$i "
- path_mode64="${path_mode64}powerpc64/$i "
- path_mode32="${path_mode32}powerpc64/mode32/$i "
- path_mode32="${path_mode32}powerpc64/$i "
- p="${p} powerpc32/$i "
- done
- path_mode64="${path_mode64}powerpc64/mode64 $vmx_path powerpc64"
- path_mode32="${path_mode32}powerpc64/mode32 $vmx_path powerpc64"
- path="$p $path"
- SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
- cyclecounter_size_mode64=0
+ path_mode64="powerpc64/mode64 $vmx_path powerpc64"
+ SPEED_CYCLECOUNTER_OBJ_mode64=powerpc64.lo
+ cyclecounter_size_mode64=0
any_mode64_testlist="sizeof-long-8"
;;
- esac
- ;;
+ esac
+ ;;
esac
;;
- # POWER 32-bit
+ # POWER
[power-*-* | power[12]-*-* | power2sc-*-*])
AC_DEFINE(HAVE_HOST_CPU_FAMILY_power)
HAVE_HOST_CPU_FAMILY_power=1
@@ -1207,80 +1061,21 @@ case $host in
;;
- # IBM System/390 and z/Architecture
- S390_PATTERN | S390X_PATTERN)
- abilist="32"
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- gcc_cflags_optlist="arch"
- path="s390_32"
- extra_functions="udiv_w_sdiv"
- gcc_32_cflags_maybe="-m31"
+ pyramid-*-*)
+ path="pyr"
+ ;;
- case $host_cpu in
- s390)
- ;;
- z900 | z900esa)
- cpu="z900"
- gccarch="$cpu"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
- AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
- extra_functions=""
- ;;
- z990 | z990esa)
- cpu="z990"
- gccarch="$cpu"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
- AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
- extra_functions=""
- ;;
- z9 | z9esa)
- cpu="z9"
- gccarch="z9-109"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
- AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
- extra_functions=""
- ;;
- z10 | z10esa)
- cpu="z10"
- gccarch="z10"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
- AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
- extra_functions=""
- ;;
- z196 | z196esa)
- cpu="z196"
- gccarch="z196"
- path="s390_32/esame/$cpu s390_32/esame s390_32"
- gcc_cflags_arch="-march=$gccarch"
- AC_DEFINE_UNQUOTED(HAVE_HOST_CPU_s390_$cpu)
- AC_DEFINE(HAVE_HOST_CPU_s390_zarch)
- extra_functions=""
- ;;
- esac
- case $host in
- S390X_PATTERN)
- abilist="64 32"
- cclist_64="gcc"
- gcc_64_cflags_optlist="arch"
- gcc_64_cflags="$gcc_cflags -m64"
- path_64="s390_64/$host_cpu s390_64"
- extra_functions=""
- ;;
- esac
+ # IBM s/370 and similar
+ [s3[6-9]0*-*-*])
+ gcc_cflags="$gcc_cflags $fomit_frame_pointer"
+ path="s390"
+ extra_functions="udiv_w_sdiv"
;;
sh-*-*) path="sh" ;;
- [sh[2-4]-*-*]) path="sh/sh2 sh" ;;
+ sh2-*-*) path="sh/sh2 sh" ;;
*sparc*-*-*)
@@ -1302,10 +1097,8 @@ case $host in
path="sparc32/v8 sparc32" ;;
supersparc)
path="sparc32/v8/supersparc sparc32/v8 sparc32" ;;
- [sparc64 | sparcv9* | ultrasparc | ultrasparc[234]*])
+ sparc64 | sparcv9* | ultrasparc*)
path="sparc32/v9 sparc32/v8 sparc32" ;;
- [ultrasparct[12345]])
- path="sparc32/ultrasparct1 sparc32/v8 sparc32" ;;
*)
path="sparc32" ;;
esac
@@ -1324,49 +1117,32 @@ case $host in
# latter would be used in the 64-bit ABI on systems like "*bsd" where
# abilist="64" only.
#
+ case $host_cpu in
+ sparc64 | sparcv9* | ultrasparc*)
+ gcc_cflags="$gcc_cflags -Wa,-xarch=v8plus" ;;
+ *)
+ gcc_cflags="$gcc_cflags" ;;
+ esac
gcc_32_cflags_maybe="-m32"
- gcc_cflags_optlist="cpu asm"
+ gcc_cflags_optlist="cpu"
# 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"
- 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="";;
+ 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" ;;
esac
# SunPRO cc and acc, and SunOS bundled cc
@@ -1382,14 +1158,10 @@ 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 | 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" ;;
+ sparcv8 | microsparc | supersparc | turbosparc)
+ cc_cflags_arch="-xarch=v8" ;;
+ 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.
@@ -1397,21 +1169,17 @@ 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 -xchip=ultra" ;;
- ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i -xchip=ultra2 -xchip=ultra" ;;
+ ultrasparc2) cc_cflags_cpu="-xchip=ultra2" ;;
+ ultrasparc2i) cc_cflags_cpu="-xchip=ultra2i" ;;
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
@@ -1443,19 +1211,7 @@ case $host in
*) abilist="64 32" ;;
esac
- case $host_cpu in
- ultrasparc | ultrasparc2 | ultrasparc2i)
- path_64="sparc64/ultrasparc1234 sparc64" ;;
- [ultrasparc[34]])
- path_64="sparc64/ultrasparc34 sparc64/ultrasparc1234 sparc64" ;;
- [ultrasparct[12]])
- path_64="sparc64/ultrasparct1 sparc64" ;;
- [ultrasparct[345]])
- path_64="sparc64/ultrasparct3 sparc64" ;;
- *)
- path_64="sparc64"
- esac
-
+ path_64="sparc64"
cclist_64="gcc"
any_64_testlist="sizeof-long-8"
@@ -1470,9 +1226,9 @@ case $host in
# it until we're sure. (Might want -xarch=v9a or -xarch=v9b for the
# higher cpu types instead.)
#
- gcc_64_cflags="$gcc_cflags -m64 -mptr64"
+ gcc_64_cflags="$gcc_64_cflags -m64 -mptr64"
gcc_64_ldflags="-Wc,-m64"
- gcc_64_cflags_optlist="cpu asm"
+ gcc_64_cflags_optlist="cpu"
case $host in
*-*-solaris*)
@@ -1483,13 +1239,8 @@ 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
@@ -1504,16 +1255,10 @@ case $host in
# VAX
- vax*-*-*elf*)
- # Use elf conventions (i.e., '%' register prefix, no global prefix)
- #
- GMP_INCLUDE_MPN(vax/elf.m4)
- gcc_cflags="$gcc_cflags $fomit_frame_pointer"
- path="vax"
- extra_functions="udiv_w_sdiv"
- ;;
vax*-*-*)
- # Default to aout conventions (i.e., no register prefix, '_' global prefix)
+ # Currently gcc (version 3.0) on vax always uses a frame pointer
+ # (config/vax/vax.h FRAME_POINTER_REQUIRED=1), so -fomit-frame-pointer
+ # will be ignored.
#
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
path="vax"
@@ -1536,7 +1281,7 @@ case $host in
# 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.
#
- X86_PATTERN | X86_64_PATTERN)
+ X86_PATTERN | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*)
abilist="32"
cclist="gcc icc cc"
gcc_cflags="$gcc_cflags $fomit_frame_pointer"
@@ -1587,231 +1332,166 @@ case $host in
gcc_cflags_optlist="cpu arch"
case $host_cpu in
i386*)
- gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
- gcc_cflags_arch="-march=i386"
- path="x86"
- ;;
+ gcc_cflags_cpu="-mtune=i386 -mcpu=i386 -m386"
+ gcc_cflags_arch="-march=i386"
+ ;;
i486*)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- path="x86/i486 x86"
- ;;
+ gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=i486"
+ ;;
i586 | pentium)
- gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
- gcc_cflags_arch="-march=pentium"
- path="x86/pentium x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium -mcpu=pentium -m486"
+ gcc_cflags_arch="-march=pentium"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium-mmx -mcpu=pentium-mmx -mcpu=pentium -m486"
+ gcc_cflags_arch="-march=pentium-mmx -march=pentium"
+ ;;
i686 | pentiumpro)
- gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
- gcc_cflags_arch="-march=pentiumpro -march=pentium"
- path="x86/p6 x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentiumpro -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentiumpro -march=pentium"
+ ;;
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/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/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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=pentium2 -mcpu=pentium2 -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentium2 -march=pentiumpro -march=pentium"
+ ;;
+ pentium3 | pentiumm)
+ gcc_cflags_cpu="-mtune=pentium3 -mcpu=pentium3 -mcpu=pentiumpro -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=pentium3 -march=pentiumpro -march=pentium"
+ ;;
k6)
- gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=k6"
- path="x86/k6/mmx x86/k6 x86/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-2 -mcpu=k6-2 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-2 -march=k6"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-3 -march=k6"
+ ;;
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/mmx x86"
- ;;
+ gcc_cflags_cpu="-mtune=k6-3 -mcpu=k6-3 -mcpu=k6 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=k6-3 -march=k6"
+ ;;
athlon)
- # Athlon instruction costs are close to P6 (3 cycle load latency,
- # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
- # 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/mmx x86"
- ;;
+ # Athlon instruction costs are close to P6 (3 cycle load latency,
+ # 4-6 cycle mul, 40 cycle div, pairable adc, etc) so if gcc doesn't
+ # 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"
+ ;;
i786 | pentium4)
- # pentiumpro is the primary fallback when gcc doesn't know pentium4.
- # This gets us cmov to eliminate branches. Maybe "athlon" would be
- # a possibility on gcc 3.0.
- #
- 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/mmx x86"
- path_64="x86_64/pentium4 x86_64"
- ;;
+ # pentiumpro is the primary fallback when gcc doesn't know pentium4.
+ # This gets us cmov to eliminate branches. Maybe "athlon" would be
+ # a possibility on gcc 3.0.
+ #
+ 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"
+ ;;
viac32)
- # Not sure of the best fallbacks here for -mcpu.
- # 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/mmx x86"
- ;;
+ # Not sure of the best fallbacks here for -mcpu.
+ # 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"
+ ;;
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/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/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/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/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/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"
- ;;
+ # 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"
+ ;;
+ athlon64 | 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"
+ ;;
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/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/mmx x86"
- path_64="x86_64/coreinhm x86_64/core2 x86_64"
- ;;
- 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/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/mmx x86"
- path_64="x86_64/atom x86_64"
- ;;
- nano)
- gcc_cflags_cpu="-mtune=nano"
- gcc_cflags_arch="-march=nano"
- path="x86/nano x86/mmx x86"
- path_64="x86_64/nano x86_64"
- ;;
+ gcc_cflags_cpu="-mtune=core2 -mtune=k8"
+ gcc_cflags_arch="-march=core2 -march=core2~-mno-sse2 -march=k8 -march=k8~-mno-sse2"
+ ;;
*)
- gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
- gcc_cflags_arch="-march=i486"
- path="x86"
- path_64="x86_64"
- ;;
+ gcc_cflags_cpu="-mtune=i486 -mcpu=i486 -m486"
+ gcc_cflags_arch="-march=i486"
+ ;;
esac
- case $host in
- X86_64_PATTERN)
- 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 cc"
- gcc_x32_cflags="$gcc_cflags -mx32"
- gcc_x32_cflags_optlist="$gcc_64_cflags_optlist"
- CALLING_CONVENTIONS_OBJS_x32="$CALLING_CONVENTIONS_OBJS_64"
- SPEED_CYCLECOUNTER_OBJ_x32="$SPEED_CYCLECOUNTER_OBJ_64"
- cyclecounter_size_x32="$cyclecounter_size_64"
- path_x32="$path_64"
- limb_x32=longlong
- any_x32_testlist="sizeof-long-4"
-
- abilist="64 x32 32"
- if test "$enable_assembly" = "yes" ; then
- extra_functions_64="$extra_functions_64 invert_limb_table"
- extra_functions_x32=$extra_functions_64
- fi
+ case $host_cpu in
+ i386*) path="x86" ;;
+ i486*) path="x86/i486 x86" ;;
+ i586 | pentium) path="x86/pentium x86" ;;
+ pentiummmx) path="x86/pentium/mmx x86/pentium x86" ;;
+ i686 | pentiumpro) path="x86/p6 x86" ;;
+ pentium2) path="x86/p6/mmx x86/p6 x86" ;;
+ pentium3) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ pentiumm | core2) path="x86/p6/sse2 x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ [k6[23]]) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
+ k6) path="x86/k6/mmx x86/k6 x86" ;;
+ geode) path="x86/k6/k62mmx x86/k6/mmx x86/k6 x86" ;;
+ # we don't have any specific 32-bit code for athlon64/opteron, the
+ # athlon code should be reasonable
+ athlon | athlon64) path="x86/k7/mmx x86/k7 x86" ;;
+ i786 | pentium4) path="x86/pentium4/sse2 x86/pentium4/mmx x86/pentium4 x86" ;;
+ # VIA/Centaur processors, sold as CyrixIII and C3.
+ viac32) path="x86/p6/p3mmx x86/p6/mmx x86/p6 x86";;
+ viac3*) path="x86/pentium/mmx x86/pentium x86";;
+ *) path="x86" ;;
+ esac
- case $host in
- *-*-solaris*)
- # Sun cc.
- cc_64_cflags="-xO3 -m64"
+ # 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=""
+ extra_functions="$extra_functions fat fat_entry"
+ path="x86/fat x86"
+ fat_path="x86 x86/fat x86/i486
+ x86/k6 x86/k6/mmx x86/k6/k62mmx
+ x86/k7 x86/k7/mmx
+ x86/pentium x86/pentium/mmx
+ x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
+ x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2"
+ fat_functions="add_n addmul_1 copyd copyi
+ dive_1 diveby3 divrem_1 gcd_1 lshift
+ mod_1 mod_34lsub1 mode1o mul_1 mul_basecase
+ pre_divrem_1 pre_mod_1 rshift
+ sqr_basecase sub_n submul_1"
+ fat_thresholds="MUL_KARATSUBA_THRESHOLD MUL_TOOM3_THRESHOLD
+ SQR_KARATSUBA_THRESHOLD SQR_TOOM3_THRESHOLD"
+ fi
+
+ case $host_cpu in
+ athlon64 | atom | core2 | pentium4 | x86_64)
+ cclist_64="gcc"
+ gcc_64_cflags="$gcc_64_cflags -m64"
+ gcc_64_cflags_optlist="cpu"
+ CALLING_CONVENTIONS_OBJS_64='amd64call.lo amd64check$U.lo'
+ SPEED_CYCLECOUNTER_OBJ_64=x86_64.lo
+ cyclecounter_size_64=2
+
+ case $host in
+ *-*-solaris*)
+ # Sun cc.
+ cclist_64="$cclist_64 cc"
+ cc_64_cflags="-xO3 -m64"
+ ;;
+ esac
+
+ case $host_cpu in
+ athlon64 | x86_64)
+ abilist="64 32"
+ path_64="x86_64"
+ ;;
+ pentium4)
+ abilist="64 32"
+ path_64="x86_64/pentium4 x86_64"
+ ;;
+ core2)
+ abilist="64 32"
+ path_64="x86_64/core2 x86_64"
;;
- *-*-mingw* | *-*-cygwin)
- limb_64=longlong
- CALLING_CONVENTIONS_OBJS_64=""
- AC_DEFINE(HOST_DOS64,1,[Define to 1 for Windos/64])
- GMP_NONSTD_ABI_64=DOS64
+ atom)
+ # The AMD K8/K9/K10 code seems best for Intel Atom
+ abilist="64 32"
+ path_64="x86_64/atom x86_64"
;;
esac
;;
@@ -1819,10 +1499,33 @@ case $host in
;;
- # Special CPU "none" used to select generic C, now this is obsolete.
+ # 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" selects generic C. -DNO_ASM is used to disable gcc
+ # asm blocks in longlong.h (since they're driven by cpp pre-defined
+ # symbols like __alpha rather than the configured $host_cpu).
+ #
none-*-*)
- enable_assembly=no
- AC_MSG_WARN([the \"none\" host is obsolete, use --disable-assembly])
+ abilist="long longlong"
+ cclist_long=$cclist
+ gcc_long_cflags=$gcc_cflags
+ gcc_long_cppflags="-DNO_ASM"
+ cc_long_cflags=$cc_cflags
+ cclist_longlong=$cclist
+ gcc_longlong_cflags=$gcc_cflags
+ gcc_longlong_cppflags="-DNO_ASM"
+ cc_longlong_cflags=$cc_cflags
+ limb_longlong=longlong
;;
esac
@@ -1989,10 +1692,10 @@ for abi in $abilist; do
cflags="$cflags_maybe $cflags"
fi
- # Any user CFLAGS, even an empty string, takes precedence
+ # Any user CFLAGS, even an empty string, takes precendence
if test "$test_CFLAGS" = set; then cflags=$CFLAGS; fi
- # Any user CPPFLAGS, even an empty string, takes precedence
+ # Any user CPPFLAGS, even an empty string, takes precendence
eval cppflags=\"\$${ccbase}${abi1}_cppflags\"
test -n "$cppflags" || eval cppflags=\"\$${ccbase}${abi2}_cppflags\"
if test "$test_CPPFLAGS" = set; then cppflags=$CPPFLAGS; fi
@@ -2067,52 +1770,6 @@ if test $found_compiler = no && test -n "$path"; then
AC_MSG_ERROR([could not find a working compiler, see config.log for details])
fi
-case $host in
- X86_PATTERN | X86_64_PATTERN)
- # 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 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
- redc_2 rshift sqr_basecase sub_n submul_1"
-
- if test "$abi" = 32; then
- extra_functions="$extra_functions fat fat_entry"
- path="x86/fat x86"
- fat_path="x86 x86/fat x86/i486
- x86/k6 x86/k6/mmx x86/k6/k62mmx
- x86/k7 x86/k7/mmx
- x86/k8 x86/k10 x86/bobcat
- x86/pentium x86/pentium/mmx
- x86/p6 x86/p6/mmx x86/p6/p3mmx x86/p6/sse2
- x86/pentium4 x86/pentium4/mmx x86/pentium4/sse2
- x86/core2 x86/coreinhm x86/coreisbr
- x86/atom x86/atom/mmx x86/atom/sse2 x86/nano"
- fi
-
- if test "$abi" = 64; then
- gcc_64_cflags=""
- extra_functions_64="$extra_functions_64 fat fat_entry"
- path_64="x86_64/fat x86_64"
- fat_path="x86_64 x86_64/fat
- x86_64/k8 x86_64/k10 x86_64/bd1 x86_64/bobcat
- x86_64/pentium4 x86_64/core2 x86_64/coreinhm x86_64/coreisbr
- x86_64/coreihwl x86_64/atom x86_64/nano"
- fat_functions="$fat_functions addmul_2 addlsh1_n addlsh2_n sublsh1_n"
- fi
-
- fat_thresholds="MUL_TOOM22_THRESHOLD MUL_TOOM33_THRESHOLD
- SQR_TOOM2_THRESHOLD SQR_TOOM3_THRESHOLD
- BMOD_1_TO_MOD_1_THRESHOLD"
- fi
- ;;
-esac
-
if test $found_compiler = yes; then
@@ -2184,7 +1841,7 @@ if test $found_compiler = yes; then
CC="$cc"
CFLAGS="$cflags"
CPPFLAGS="$cppflags"
- eval GMP_NONSTD_ABI=\"\$GMP_NONSTD_ABI_$ABI\"
+
# Could easily have this in config.h too, if desired.
ABI_nodots=`echo $ABI | sed 's/\./_/'`
@@ -2227,11 +1884,7 @@ if test $found_compiler = yes; then
#
eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi1\"
test -n "$tmp" || eval tmp=\"\$CALLING_CONVENTIONS_OBJS$abi2\"
- if test "$enable_assembly" = "yes"; then
- CALLING_CONVENTIONS_OBJS="$tmp"
- else
- CALLING_CONVENTIONS_OBJS=""
- fi
+ CALLING_CONVENTIONS_OBJS="$tmp"
if test -n "$CALLING_CONVENTIONS_OBJS"; then
AC_DEFINE(HAVE_CALLING_CONVENTIONS,1,
@@ -2266,6 +1919,7 @@ AC_SUBST(DEFN_LONG_LONG_LIMB)
AC_PROG_CC
AC_PROG_CC_STDC
AC_PROG_CPP
+GMP_H_ANSI
# The C compiler on the build system, and associated tests.
@@ -2383,7 +2037,7 @@ done
# enough assembler.
#
case $host in
- X86_PATTERN | X86_64_PATTERN)
+ X86_PATTERN | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*)
if test "$ABI" = 32; then
case "$path $fat_path" in
*mmx*) GMP_ASM_X86_MMX( , [GMP_STRIP_PATH(*mmx*)]) ;;
@@ -2392,26 +2046,10 @@ 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
-if test "$enable_assembly" = "no"; then
- path="generic"
- CFLAGS="$CFLAGS -DNO_ASM"
-# for abi in $abilist; do
-# eval unset "path_\$abi"
-# eval gcc_${abi}_cflags=\"\$gcc_${abi}_cflags -DNO_ASM\"
-# done
-fi
-
-
cat >&AC_FD_CC <<EOF
Decided:
ABI=$ABI
@@ -2434,6 +2072,9 @@ fi
echo " MPN_PATH=\"$path\""
+# Automake ansi2knr support.
+AM_C_PROTOTYPES
+
CL_AS_NOEXECSTACK
GMP_PROG_AR
@@ -2546,7 +2187,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
@@ -2651,8 +2292,7 @@ AC_TYPE_SIGNAL
#
# the default includes are sufficient for all these types
#
-AC_CHECK_TYPES([intmax_t, long double, long long, ptrdiff_t, quad_t,
- uint_least32_t, intptr_t])
+AC_CHECK_TYPES([intmax_t, long double, long long, ptrdiff_t, quad_t, uint_least32_t])
AC_C_STRINGIZE
@@ -2663,7 +2303,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
@@ -2719,26 +2359,17 @@ GMP_C_DOUBLE_FORMAT
# syssgi - IRIX specific
# times - not in mingw
#
+# clock_gettime is in librt on *-*-osf5.1. We could look for it
+# there, but that's not worth bothering with unless it has a decent
+# resolution (in a quick test clock_getres said only 1 millisecond).
+#
# AC_FUNC_STRNLEN is not used because we don't want the AC_LIBOBJ
# replacement setups it gives. It detects a faulty strnlen on AIX, but
# missing out on that test is ok since our only use of strnlen is in
# __gmp_replacement_vsnprintf which is not required on AIX since it has a
# vsnprintf.
#
-AC_CHECK_FUNCS(alarm attr_get clock cputime getpagesize getrusage gettimeofday getsysinfo localeconv memset mmap mprotect nl_langinfo obstack_vprintf popen processor_info pstat_getprocessor raise read_real_time sigaction sigaltstack sigstack syssgi strchr strerror strnlen strtol strtoul sysconf sysctl sysctlbyname times)
-
-# clock_gettime is in librt on *-*-osf5.1 and on glibc, so att -lrt to
-# TUNE_LIBS if needed. On linux (tested on x86_32, 2.6.26),
-# clock_getres reports ns accuracy, while in a quick test on osf
-# clock_getres said only 1 millisecond.
-
-old_LIBS="$LIBS"
-AC_SEARCH_LIBS(clock_gettime, rt, [
- AC_DEFINE([HAVE_CLOCK_GETTIME],1,[Define to 1 if you have the `clock_gettime' function])])
-TUNE_LIBS="$LIBS"
-LIBS="$old_LIBS"
-
-AC_SUBST(TUNE_LIBS)
+AC_CHECK_FUNCS(alarm attr_get clock clock_gettime cputime getpagesize getrusage gettimeofday getsysinfo localeconv memset mmap mprotect nl_langinfo obstack_vprintf popen processor_info pstat_getprocessor raise read_real_time sigaction sigaltstack sigstack syssgi strchr strerror strnlen strtol strtoul sysconf sysctl sysctlbyname times)
GMP_FUNC_VSNPRINTF
GMP_FUNC_SSCANF_WRITABLE_INPUT
@@ -2776,67 +2407,43 @@ fi
# can provide some functions too. (mpn/Makefile.am passes
# -DOPERATION_<func> to get them to generate the right code.)
+# Note: The following lines defining $gmp_mpn_functions_optional
+# and $gmp_mpn_functions are parsed by the "macos/configure"
+# Perl script. So if you change the lines in a major way
+# make sure to run and examine the output from
+#
+# % (cd macos; perl configure)
+#
# Note: $gmp_mpn_functions must have mod_1 before pre_mod_1 so the former
# can optionally provide the latter as an extra entrypoint. Likewise
# divrem_1 and pre_divrem_1.
-gmp_mpn_functions_optional="umul udiv \
- invert_limb sqr_diagonal sqr_diag_addlsh1 \
- mul_2 mul_3 mul_4 mul_5 mul_6 \
+gmp_mpn_functions_optional="umul udiv copyi copyd com_n
+ and_n andn_n nand_n ior_n iorn_n nior_n xor_n xnor_n \
+ invert_limb sqr_diagonal \
+ mul_2 mul_3 mul_4 \
addmul_2 addmul_3 addmul_4 addmul_5 addmul_6 addmul_7 addmul_8 \
- addlsh1_n sublsh1_n rsblsh1_n rsh1add_n rsh1sub_n \
- addlsh2_n sublsh2_n rsblsh2_n \
- addlsh_n sublsh_n rsblsh_n \
- add_n_sub_n addaddmul_1msb0"
+ addlsh1_n sublsh1_n rsh1add_n rsh1sub_n addsub_n addaddmul_1msb0 lshiftc"
gmp_mpn_functions="$extra_functions \
- 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 \
+ add add_1 add_n sub sub_1 sub_n neg_n mul_1 addmul_1 \
+ submul_1 lshift rshift dive_1 diveby3 divis divrem divrem_1 divrem_2 \
fib2_ui mod_1 mod_34lsub1 mode1o pre_divrem_1 pre_mod_1 dump \
- mod_1_1 mod_1_2 mod_1_3 mod_1_4 lshiftc \
- mul mul_fft mul_n sqr mul_basecase sqr_basecase nussbaumer_mul \
- mulmid_basecase toom42_mulmid mulmid_n mulmid \
- random random2 pow_1 \
- rootrem sqrtrem sizeinbase get_str set_str \
- scan0 scan1 popcount hamdist cmp \
- perfsqr perfpow \
- gcd_1 gcd gcdext_1 gcdext gcd_subdiv_step \
- gcdext_lehmer \
- div_q tdiv_qr jacbase jacobi_2 jacobi get_d \
- matrix22_mul matrix22_mul1_inverse_vector \
- hgcd_matrix hgcd2 hgcd_step hgcd_reduce hgcd hgcd_appr \
- hgcd2_jacobi hgcd_jacobi \
- mullo_n mullo_basecase \
- toom22_mul toom32_mul toom42_mul toom52_mul toom62_mul \
- toom33_mul toom43_mul toom53_mul toom54_mul toom63_mul \
- toom44_mul \
- toom6h_mul toom6_sqr toom8h_mul toom8_sqr \
- toom_couple_handling \
+ mod_1_1 mod_1_2 mod_1_3 mod_1_4 \
+ mul mul_fft mul_n mul_basecase sqr_basecase random random2 pow_1 \
+ rootrem sqrtrem get_str set_str scan0 scan1 popcount hamdist cmp perfsqr \
+ bdivmod gcd_1 gcd gcdext_1 gcdext gcd_lehmer gcd_subdiv_step \
+ gcdext_lehmer gcdext_subdiv_step \
+ tdiv_qr dc_divrem_n sb_divrem_mn jacbase get_d \
+ matrix22_mul hgcd2 hgcd mullow_n mullow_basecase \
+ toom22_mul toom33_mul toom44_mul \
+ toom32_mul toom42_mul toom62_mul toom53_mul \
toom2_sqr toom3_sqr toom4_sqr \
- toom_eval_dgr3_pm1 toom_eval_dgr3_pm2 \
- toom_eval_pm1 toom_eval_pm2 toom_eval_pm2exp toom_eval_pm2rexp \
- 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 \
+ toom_interpolate_5pts toom_interpolate_7pts invert binvert \
+ sb_div_qr sb_divappr_q sb_div_q dc_div_qr dc_divappr_q dc_div_q \
mu_div_qr mu_divappr_q mu_div_q \
- bdiv_q_1 \
- sbpi1_bdiv_q sbpi1_bdiv_qr \
- 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 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 sec_tabselect \
- comb_tables \
+ sb_bdiv_q sb_bdiv_qr dc_bdiv_q dc_bdiv_qr mu_bdiv_q mu_bdiv_qr \
+ divexact bdiv_dbm1c redc_1 redc_2 powm powlo powm_sec subcnd_n \
$gmp_mpn_functions_optional"
define(GMP_MULFUNC_CHOICES,
@@ -2844,46 +2451,15 @@ define(GMP_MULFUNC_CHOICES,
tmp_mulfunc=
case $tmp_fn in
add_n|sub_n) tmp_mulfunc="aors_n" ;;
- add_err1_n|sub_err1_n)
- tmp_mulfunc="aors_err1_n" ;;
- add_err2_n|sub_err2_n)
- tmp_mulfunc="aors_err2_n" ;;
- add_err3_n|sub_err3_n)
- tmp_mulfunc="aors_err3_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 aorsorrlsh1_n";;
- sublsh1_n)
- tmp_mulfunc="aorslsh1_n sorrlsh1_n aorsorrlsh1_n";;
- rsblsh1_n)
- tmp_mulfunc="aorrlsh1_n sorrlsh1_n aorsorrlsh1_n";;
- addlsh2_n)
- tmp_mulfunc="aorslsh2_n aorrlsh2_n aorsorrlsh2_n";;
- sublsh2_n)
- tmp_mulfunc="aorslsh2_n sorrlsh2_n aorsorrlsh2_n";;
- rsblsh2_n)
- tmp_mulfunc="aorrlsh2_n sorrlsh2_n aorsorrlsh2_n";;
- addlsh_n)
- tmp_mulfunc="aorslsh_n aorrlsh_n aorsorrlsh_n";;
- sublsh_n)
- tmp_mulfunc="aorslsh_n sorrlsh_n aorsorrlsh_n";;
- rsblsh_n)
- tmp_mulfunc="aorrlsh_n sorrlsh_n aorsorrlsh_n";;
+ addlsh1_n|sublsh1_n)
+ tmp_mulfunc="aorslsh1_n";;
rsh1add_n|rsh1sub_n)
tmp_mulfunc="rsh1aors_n";;
- sec_div_qr|sec_div_r)
- tmp_mulfunc="sec_div";;
- sec_pi1_div_qr|sec_pi1_div_r)
- tmp_mulfunc="sec_pi1_div";;
esac
])
@@ -2921,14 +2497,6 @@ define(GMP_FILE_TO_FUNCTION,
pre_divrem_1) $1=preinv_divrem_1 ;;
mode1o) $1=modexact_1c_odd ;;
pre_mod_1) $1=preinv_mod_1 ;;
- mod_1_1) $1=mod_1_1p ;;
- mod_1_1_cps) $1=mod_1_1p_cps ;;
- mod_1_2) $1=mod_1s_2p ;;
- mod_1_2_cps) $1=mod_1s_2p_cps ;;
- mod_1_3) $1=mod_1s_3p ;;
- mod_1_3_cps) $1=mod_1s_3p_cps ;;
- mod_1_4) $1=mod_1s_4p ;;
- mod_1_4_cps) $1=mod_1s_4p_cps ;;
*) $1=$$2 ;;
esac
])
@@ -2946,10 +2514,10 @@ esac
# setup that structure, on a per-directory basis ready for
# mpn/<cpu>/fat/fat.c.
#
-# fat.h includes thresholds listed in $fat_thresholds, extracted from
+# fat.h includes thesholds listed in $fat_thresholds, extracted from
# gmp-mparam.h in each directory. An overall maximum for each threshold is
# established, for use in making fixed size arrays of temporary space.
-# (Eg. MUL_TOOM33_THRESHOLD_LIMIT used by mpn/generic/mul.c.)
+# (Eg. MUL_TOOM3_THRESHOLD_LIMIT used by mpn/generic/mul.c.)
#
# It'd be possible to do some of this manually, but when there's more than a
# few functions and a few directories it becomes very tedious, and very
@@ -2984,20 +2552,20 @@ if test -n "$fat_path"; then
#endif
DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
# encourage various macros to use fat functions
- AC_DEFINE_UNQUOTED(HAVE_NATIVE_mpn_$tmp_fbase)
+ AC_DEFINE_UNQUOTED(HAVE_NATIVE_$tmp_fbase)
done
echo "" >>fat.h
echo "/* variable thresholds */" >>fat.h
for tmp_tn in $fat_thresholds; do
echo "#undef $tmp_tn" >>fat.h
- echo "#define $tmp_tn CPUVEC_THRESHOLD (`echo $tmp_tn | tr [A-Z] [a-z]`)" >>fat.h
+ echo "#define $tmp_tn CPUVEC_THRESHOLD (`echo $tmp_tn | tr A-Z a-z`)" >>fat.h
done
echo "
/* Copy all fields into __gmpn_cpuvec.
memcpy is not used because it might operate byte-wise (depending on its
- implementation), and we need the function pointer writes to be atomic.
+ implemenation), and we need the function pointer writes to be atomic.
"volatile" discourages the compiler from trying to optimize this. */
#define CPUVEC_INSTALL(vec) \\
do { \\
@@ -3007,7 +2575,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
echo " p->$tmp_fbase = vec.$tmp_fbase; \\" >>fat.h
done
for tmp_tn in $fat_thresholds; do
- tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]`
+ tmp_field_name=`echo $tmp_tn | tr A-Z a-z`
echo " p->$tmp_field_name = vec.$tmp_field_name; \\" >>fat.h
done
echo " } while (0)" >>fat.h
@@ -3021,7 +2589,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
echo " ASSERT (vec.$tmp_fbase != NULL); \\" >>fat.h
done
for tmp_tn in $fat_thresholds; do
- tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]`
+ tmp_field_name=`echo $tmp_tn | tr A-Z a-z`
echo " ASSERT (vec.$tmp_field_name != 0); \\" >>fat.h
done
echo " } while (0)" >>fat.h
@@ -3031,7 +2599,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
#define ITERATE_FAT_THRESHOLDS() \\
do { \\" >>fat.h
for tmp_tn in $fat_thresholds; do
- tmp_field_name=`echo $tmp_tn | tr [[A-Z]] [[a-z]]`
+ tmp_field_name=`echo $tmp_tn | tr A-Z a-z`
echo " ITERATE ($tmp_tn, $tmp_field_name); \\" >>fat.h
done
echo " } while (0)" >>fat.h
@@ -3059,7 +2627,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
esac
# Extract desired thresholds from gmp-mparam.h file in this directory,
- # if present.
+ # if prsent.
tmp_mparam=$srcdir/mpn/$tmp_dir/gmp-mparam.h
if test -f $tmp_mparam; then
for tmp_tn in $fat_thresholds; do
@@ -3067,7 +2635,7 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
if test -n "$tmp_thresh"; then
THRESH_ASM_SETUP=["${THRESH_ASM_SETUP}define($tmp_tn,$tmp_thresh)
"]
- CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.`echo $tmp_tn | tr [[A-Z]] [[a-z]]` = $tmp_thresh; \\
+ CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.`echo $tmp_tn | tr A-Z a-z` = $tmp_thresh; \\
"
eval tmp_limit=\$${tmp_tn}_LIMIT
if test -z "$tmp_limit"; then
@@ -3088,17 +2656,6 @@ DECL_$tmp_fbase (__MPN(${tmp_fbase}_init));" >>fat.h
tmp_file=$srcdir/mpn/$tmp_dir/$tmp_base.$tmp_ext
if test -f $tmp_file; then
- # If the host uses a non-standard ABI, check if tmp_file supports it
- #
- if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then
- abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `]
- if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then
- true
- else
- continue
- fi
- fi
-
mpn_objects="$mpn_objects ${tmp_prefix}_$tmp_fn.lo"
mpn_objs_in_libgmp="$mpn_objs_in_libgmp mpn/${tmp_prefix}_$tmp_fn.lo"
@@ -3130,7 +2687,6 @@ define(OPERATION_$tmp_fn)
define(__gmpn_$tmp_fbase, __gmpn_${tmp_fbase}_$tmp_suffix)
define(__gmpn_$tmp_fbasec,__gmpn_${tmp_fbasec}_${tmp_suffix})
define(__gmpn_preinv_${tmp_fbase},__gmpn_preinv_${tmp_fbase}_${tmp_suffix})
-define(__gmpn_${tmp_fbase}_cps,__gmpn_${tmp_fbase}_cps_${tmp_suffix})
$tmp_d_n_l For k6 and k7 gcd_1 calling their corresponding mpn_modexact_1_odd
ifdef(\`__gmpn_modexact_1_odd',,
@@ -3148,7 +2704,6 @@ include][($mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.asm)
#define __gmpn_$tmp_fbase __gmpn_${tmp_fbase}_$tmp_suffix
#define __gmpn_$tmp_fbasec __gmpn_${tmp_fbasec}_${tmp_suffix}
#define __gmpn_preinv_${tmp_fbase} __gmpn_preinv_${tmp_fbase}_${tmp_suffix}
-#define __gmpn_${tmp_fbase}_cps __gmpn_${tmp_fbase}_cps_${tmp_suffix}
#include \"$mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.c\"
"] >mpn/${tmp_prefix}_$tmp_fn.c
@@ -3165,13 +2720,6 @@ include][($mpn_relative_top_srcdir/mpn/$tmp_dir/$tmp_base.asm)
CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.preinv_$tmp_fbase = __gmpn_preinv_${tmp_fbase}_${tmp_suffix}; \\
"
fi
-
- # Ditto for any mod_1...cps variant
- if grep "^PROLOGUE(mpn_${tmp_fbase}_cps)" $tmp_file >/dev/null; then
- echo "DECL_${tmp_fbase}_cps (__gmpn_${tmp_fbase}_cps_$tmp_suffix);" >>fat.h
- CPUVEC_SETUP="$CPUVEC_SETUP decided_cpuvec.${tmp_fbase}_cps = __gmpn_${tmp_fbase}_cps_${tmp_suffix}; \\
-"
- fi
fi
done
done
@@ -3269,17 +2817,6 @@ for tmp_fn in $gmp_mpn_functions; do
esac
fi
- # If the host uses a non-standard ABI, check if tmp_file supports it
- #
- if test -n "$GMP_NONSTD_ABI" && test $tmp_ext != "c"; then
- abi=[`sed -n 's/^[ ]*ABI_SUPPORT(\(.*\))/\1/p' $tmp_file `]
- if echo "$abi" | grep -q "\\b${GMP_NONSTD_ABI}\\b"; then
- true
- else
- continue
- fi
- fi
-
found=yes
eval found_$tmp_ext=yes
@@ -3343,27 +2880,8 @@ AH_VERBATIM([HAVE_NATIVE],
[/* Define to 1 each of the following for which a native (ie. CPU specific)
implementation of the corresponding routine exists. */
#undef HAVE_NATIVE_mpn_add_n
-#undef HAVE_NATIVE_mpn_add_n_sub_n
#undef HAVE_NATIVE_mpn_add_nc
-#undef HAVE_NATIVE_mpn_addaddmul_1msb0
#undef HAVE_NATIVE_mpn_addlsh1_n
-#undef HAVE_NATIVE_mpn_addlsh2_n
-#undef HAVE_NATIVE_mpn_addlsh_n
-#undef HAVE_NATIVE_mpn_addlsh1_nc
-#undef HAVE_NATIVE_mpn_addlsh2_nc
-#undef HAVE_NATIVE_mpn_addlsh_nc
-#undef HAVE_NATIVE_mpn_addlsh1_n_ip1
-#undef HAVE_NATIVE_mpn_addlsh2_n_ip1
-#undef HAVE_NATIVE_mpn_addlsh_n_ip1
-#undef HAVE_NATIVE_mpn_addlsh1_nc_ip1
-#undef HAVE_NATIVE_mpn_addlsh2_nc_ip1
-#undef HAVE_NATIVE_mpn_addlsh_nc_ip1
-#undef HAVE_NATIVE_mpn_addlsh1_n_ip2
-#undef HAVE_NATIVE_mpn_addlsh2_n_ip2
-#undef HAVE_NATIVE_mpn_addlsh_n_ip2
-#undef HAVE_NATIVE_mpn_addlsh1_nc_ip2
-#undef HAVE_NATIVE_mpn_addlsh2_nc_ip2
-#undef HAVE_NATIVE_mpn_addlsh_nc_ip2
#undef HAVE_NATIVE_mpn_addmul_1c
#undef HAVE_NATIVE_mpn_addmul_2
#undef HAVE_NATIVE_mpn_addmul_3
@@ -3372,89 +2890,50 @@ AH_VERBATIM([HAVE_NATIVE],
#undef HAVE_NATIVE_mpn_addmul_6
#undef HAVE_NATIVE_mpn_addmul_7
#undef HAVE_NATIVE_mpn_addmul_8
-#undef HAVE_NATIVE_mpn_addmul_2s
+#undef HAVE_NATIVE_mpn_addsub_n
+#undef HAVE_NATIVE_mpn_addaddmul_1msb0
#undef HAVE_NATIVE_mpn_and_n
#undef HAVE_NATIVE_mpn_andn_n
#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_com_n
#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
#undef HAVE_NATIVE_mpn_divrem_1
#undef HAVE_NATIVE_mpn_divrem_1c
#undef HAVE_NATIVE_mpn_divrem_2
#undef HAVE_NATIVE_mpn_gcd_1
-#undef HAVE_NATIVE_mpn_hamdist
#undef HAVE_NATIVE_mpn_invert_limb
#undef HAVE_NATIVE_mpn_ior_n
#undef HAVE_NATIVE_mpn_iorn_n
-#undef HAVE_NATIVE_mpn_lshift
#undef HAVE_NATIVE_mpn_lshiftc
-#undef HAVE_NATIVE_mpn_lshsub_n
#undef HAVE_NATIVE_mpn_mod_1
-#undef HAVE_NATIVE_mpn_mod_1_1p
#undef HAVE_NATIVE_mpn_mod_1c
-#undef HAVE_NATIVE_mpn_mod_1s_2p
-#undef HAVE_NATIVE_mpn_mod_1s_4p
-#undef HAVE_NATIVE_mpn_mod_34lsub1
#undef HAVE_NATIVE_mpn_modexact_1_odd
#undef HAVE_NATIVE_mpn_modexact_1c_odd
-#undef HAVE_NATIVE_mpn_mul_1
#undef HAVE_NATIVE_mpn_mul_1c
#undef HAVE_NATIVE_mpn_mul_2
#undef HAVE_NATIVE_mpn_mul_3
#undef HAVE_NATIVE_mpn_mul_4
-#undef HAVE_NATIVE_mpn_mul_5
-#undef HAVE_NATIVE_mpn_mul_6
-#undef HAVE_NATIVE_mpn_mul_basecase
#undef HAVE_NATIVE_mpn_nand_n
#undef HAVE_NATIVE_mpn_nior_n
-#undef HAVE_NATIVE_mpn_popcount
#undef HAVE_NATIVE_mpn_preinv_divrem_1
#undef HAVE_NATIVE_mpn_preinv_mod_1
#undef HAVE_NATIVE_mpn_redc_1
#undef HAVE_NATIVE_mpn_redc_2
-#undef HAVE_NATIVE_mpn_rsblsh1_n
-#undef HAVE_NATIVE_mpn_rsblsh2_n
-#undef HAVE_NATIVE_mpn_rsblsh_n
-#undef HAVE_NATIVE_mpn_rsblsh1_nc
-#undef HAVE_NATIVE_mpn_rsblsh2_nc
-#undef HAVE_NATIVE_mpn_rsblsh_nc
#undef HAVE_NATIVE_mpn_rsh1add_n
-#undef HAVE_NATIVE_mpn_rsh1add_nc
#undef HAVE_NATIVE_mpn_rsh1sub_n
-#undef HAVE_NATIVE_mpn_rsh1sub_nc
-#undef HAVE_NATIVE_mpn_rshift
#undef HAVE_NATIVE_mpn_sqr_basecase
#undef HAVE_NATIVE_mpn_sqr_diagonal
-#undef HAVE_NATIVE_mpn_sqr_diag_addlsh1
#undef HAVE_NATIVE_mpn_sub_n
#undef HAVE_NATIVE_mpn_sub_nc
#undef HAVE_NATIVE_mpn_sublsh1_n
-#undef HAVE_NATIVE_mpn_sublsh2_n
-#undef HAVE_NATIVE_mpn_sublsh_n
-#undef HAVE_NATIVE_mpn_sublsh1_nc
-#undef HAVE_NATIVE_mpn_sublsh2_nc
-#undef HAVE_NATIVE_mpn_sublsh_nc
-#undef HAVE_NATIVE_mpn_sublsh1_n_ip1
-#undef HAVE_NATIVE_mpn_sublsh2_n_ip1
-#undef HAVE_NATIVE_mpn_sublsh_n_ip1
-#undef HAVE_NATIVE_mpn_sublsh1_nc_ip1
-#undef HAVE_NATIVE_mpn_sublsh2_nc_ip1
-#undef HAVE_NATIVE_mpn_sublsh_nc_ip1
#undef HAVE_NATIVE_mpn_submul_1c
-#undef HAVE_NATIVE_mpn_tabselect
-#undef HAVE_NATIVE_mpn_udiv_qrnnd
-#undef HAVE_NATIVE_mpn_udiv_qrnnd_r
#undef HAVE_NATIVE_mpn_umul_ppmm
#undef HAVE_NATIVE_mpn_umul_ppmm_r
+#undef HAVE_NATIVE_mpn_udiv_qrnnd
+#undef HAVE_NATIVE_mpn_udiv_qrnnd_r
#undef HAVE_NATIVE_mpn_xor_n
#undef HAVE_NATIVE_mpn_xnor_n])
@@ -3463,11 +2942,8 @@ AH_VERBATIM([HAVE_NATIVE],
if test $found_asm = yes; then
GMP_PROG_M4
GMP_M4_M4WRAP_SPURIOUS
-# else
-# It's unclear why this m4-not-needed stuff was ever done.
-# if test -z "$M4" ; then
-# M4=m4-not-needed
-# fi
+else
+ M4=m4-not-needed
fi
# Only do the GMP_ASM checks if there's a .S or .asm wanting them.
@@ -3506,18 +2982,10 @@ 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
- mode64) GMP_INCLUDE_MPN(powerpc64/aix.m4) ;;
+ 64 | aix64) GMP_INCLUDE_MPN(powerpc64/aix.m4) ;;
*) GMP_INCLUDE_MPN(powerpc32/aix.m4) ;;
esac
;;
@@ -3542,16 +3010,14 @@ yes
power*-*-aix*)
GMP_INCLUDE_MPN(powerpc32/aix.m4)
;;
- *sparc*-*-*)
+ sparcv9*-*-* | ultrasparc*-*-* | sparc64-*-*)
case $ABI in
64)
GMP_ASM_SPARC_REGISTER
;;
esac
- GMP_ASM_SPARC_GOTDATA
- GMP_ASM_SPARC_SHARED_THUNKS
;;
- X86_PATTERN | X86_64_PATTERN)
+ X86_PATTERN | athlon64-*-* | atom-*-* | core2-*-* | x86_64-*-*)
GMP_ASM_ALIGN_FILL_0x90
case $ABI in
32)
@@ -3568,16 +3034,11 @@ yes
GMP_INCLUDE_MPN(x86/darwin.m4) ;;
esac
;;
- 64|x32)
+ 64)
GMP_INCLUDE_MPN(x86_64/x86_64-defs.m4)
- AC_DEFINE(HAVE_HOST_CPU_FAMILY_x86_64)
case $host in
*-*-darwin*)
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
@@ -3619,28 +3080,25 @@ AC_DEFINE_UNQUOTED(GMP_MPARAM_H_SUGGEST, "$gmp_mparam_source",
[The gmp-mparam.h file (a string) the tune program should suggest updating.])
-# Copy relevant parameters from gmp-mparam.h to config.m4.
-# We only do this for parameters that are used by some assembly files.
+# Copy any SQR_KARATSUBA_THRESHOLD from gmp-mparam.h to config.m4.
+# Some versions of sqr_basecase.asm use this.
# Fat binaries do this on a per-file basis, so skip in that case.
#
if test -z "$fat_path"; then
- for i in SQR_TOOM2_THRESHOLD BMOD_1_TO_MOD_1_THRESHOLD SHLD_SLOW SHRD_SLOW; do
- value=`sed -n 's/^#define '$i'[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
- if test -n "$value"; then
- GMP_DEFINE_RAW(["define(<$i>,<$value>)"])
- fi
- done
+ tmp_gmp_karatsuba_sqr_threshold=`sed -n 's/^#define SQR_KARATSUBA_THRESHOLD[ ]*\([0-9][0-9]*\).*$/\1/p' $gmp_mparam_source`
+ if test -n "$tmp_gmp_karatsuba_sqr_threshold"; then
+ GMP_DEFINE_RAW(["define(<SQR_KARATSUBA_THRESHOLD>,<$tmp_gmp_karatsuba_sqr_threshold>)"])
+ fi
fi
# Sizes of some types, needed at preprocessing time.
#
-# FIXME: The assumption that GMP_LIMB_BITS is 8*sizeof(mp_limb_t) might
-# be slightly rash, but it's true everywhere we know of and ought to be true
+# FIXME: The assumption that BITS_PER_MP_LIMB is 8*sizeof(mp_limb_t) might
+# be slightly rash, but it's true everwhere we know of and ought to be true
# of any sensible system. In a generic C build, grepping LONG_BIT out of
# <limits.h> might be an alternative, for maximum portability.
#
-AC_CHECK_SIZEOF(void *)
AC_CHECK_SIZEOF(unsigned short)
AC_CHECK_SIZEOF(unsigned)
AC_CHECK_SIZEOF(unsigned long)
@@ -3648,7 +3106,7 @@ AC_CHECK_SIZEOF(mp_limb_t, , GMP_INCLUDE_GMP_H)
if test "$ac_cv_sizeof_mp_limb_t" = 0; then
AC_MSG_ERROR([Oops, mp_limb_t doesn't seem to work])
fi
-AC_SUBST(GMP_LIMB_BITS, `expr 8 \* $ac_cv_sizeof_mp_limb_t`)
+AC_SUBST(BITS_PER_MP_LIMB, `expr 8 \* $ac_cv_sizeof_mp_limb_t`)
GMP_DEFINE_RAW(["define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)"])
# Check compiler limb size matches gmp-mparam.h
@@ -3658,24 +3116,38 @@ GMP_DEFINE_RAW(["define(<SIZEOF_UNSIGNED>,<$ac_cv_sizeof_unsigned>)"])
# probably wouldn't want to be fatal, none of the libgmp assembler code
# depends on ulong.
#
-mparam_bits=[`sed -n 's/^#define GMP_LIMB_BITS[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`]
-if test -n "$mparam_bits" && test "$mparam_bits" -ne $GMP_LIMB_BITS; then
+mparam_bits=[`sed -n 's/^#define BITS_PER_MP_LIMB[ ][ ]*\([0-9]*\).*$/\1/p' $gmp_mparam_source`]
+if test -n "$mparam_bits" && test "$mparam_bits" -ne $BITS_PER_MP_LIMB; then
if test "$test_CFLAGS" = set; then
- AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code
+ AC_MSG_ERROR([Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code
in this configuration expects $mparam_bits bits.
You appear to have set \$CFLAGS, perhaps you also need to tell GMP the
intended ABI, see "ABI and ISA" in the manual.])
else
- AC_MSG_ERROR([Oops, mp_limb_t is $GMP_LIMB_BITS bits, but the assembler code
+ AC_MSG_ERROR([Oops, mp_limb_t is $BITS_PER_MP_LIMB bits, but the assembler code
in this configuration expects $mparam_bits bits.])
fi
fi
-GMP_DEFINE_RAW(["define(<GMP_LIMB_BITS>,$GMP_LIMB_BITS)"])
+GMP_DEFINE_RAW(["define(<GMP_LIMB_BITS>,$BITS_PER_MP_LIMB)"])
GMP_DEFINE_RAW(["define(<GMP_NAIL_BITS>,$GMP_NAIL_BITS)"])
GMP_DEFINE_RAW(["define(<GMP_NUMB_BITS>,eval(GMP_LIMB_BITS-GMP_NAIL_BITS))"])
+# Exclude the mpn random functions from mpbsd since that would drag in the
+# top-level rand things, all of which are unnecessary for libmp. There's
+# other unnecessary objects too actually, if we could be bothered figuring
+# out exactly which they are.
+#
+mpn_objs_in_libmp=
+for i in $mpn_objs_in_libgmp; do
+ case $i in
+ *random*) ;;
+ *) mpn_objs_in_libmp="$mpn_objs_in_libmp $i" ;;
+ esac
+done
+AC_SUBST(mpn_objs_in_libmp)
+
AC_SUBST(mpn_objects)
AC_SUBST(mpn_objs_in_libgmp)
AC_SUBST(gmp_srclinks)
@@ -3686,11 +3158,11 @@ TUNE_SQR_OBJ=
test -d tune || mkdir tune
case $sqr_basecase_source in
*.asm)
- sqr_max=[`sed -n 's/^def...(SQR_TOOM2_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`]
+ sqr_max=[`sed -n 's/^def...(SQR_KARATSUBA_THRESHOLD_MAX, *\([0-9]*\))/\1/p' $sqr_basecase_source`]
if test -n "$sqr_max"; then
TUNE_SQR_OBJ=sqr_asm.o
- AC_DEFINE_UNQUOTED(TUNE_SQR_TOOM2_MAX,$sqr_max,
- [Maximum size the tune program can test for SQR_TOOM2_THRESHOLD])
+ AC_DEFINE_UNQUOTED(TUNE_SQR_KARATSUBA_MAX,$sqr_max,
+ [Maximum size the tune program can test for SQR_KARATSUBA_THRESHOLD])
fi
cat >tune/sqr_basecase.c <<EOF
/* not sure that an empty file can compile, so put in a dummy */
@@ -3699,7 +3171,7 @@ EOF
;;
*.c)
TUNE_SQR_OBJ=
- AC_DEFINE(TUNE_SQR_TOOM2_MAX,SQR_TOOM2_MAX_GENERIC)
+ AC_DEFINE(TUNE_SQR_KARATSUBA_MAX,SQR_KARATSUBA_MAX_GENERIC)
cat >tune/sqr_basecase.c <<EOF
#define TUNE_PROGRAM_BUILD 1
#define TUNE_PROGRAM_BUILD_SQR 1
@@ -3782,35 +3254,12 @@ GMP_FINISH
# Right now automake isn't accepting the new AC_CONFIG_FILES scheme.
AC_OUTPUT(Makefile \
- mpf/Makefile mpn/Makefile mpq/Makefile \
- mpz/Makefile printf/Makefile scanf/Makefile rand/Makefile cxx/Makefile \
- tests/Makefile tests/devel/Makefile \
+ mpbsd/Makefile mpf/Makefile mpn/Makefile mpq/Makefile \
+ mpz/Makefile printf/Makefile scanf/Makefile cxx/Makefile \
+ tests/Makefile tests/devel/Makefile tests/mpbsd/Makefile \
tests/mpf/Makefile tests/mpn/Makefile tests/mpq/Makefile \
tests/mpz/Makefile tests/rand/Makefile tests/misc/Makefile \
tests/cxx/Makefile \
doc/Makefile tune/Makefile \
demos/Makefile demos/calc/Makefile demos/expr/Makefile \
- gmp.h:gmp-h.in)
-
-AC_MSG_NOTICE([summary of build options:
-
- Version: ${PACKAGE_STRING}
- Host type: ${host}
- ABI: ${ABI}
- Install prefix: ${prefix}
- Compiler: ${CC}
- Static libraries: ${enable_static}
- Shared libraries: ${enable_shared}
-])
-
-if test x$cross_compiling = xyes ; then
- case "$host" in
- *-*-mingw* | *-*-cygwin)
- if test x$ABI = x64 ; then
- AC_MSG_NOTICE([If wine64 is installed, use make check TESTS_ENVIRONMENT=wine64.])
- else
- AC_MSG_NOTICE([If wine is installed, use make check TESTS_ENVIRONMENT=wine.])
- fi
- ;;
- esac
-fi
+ gmp.h:gmp-h.in mp.h:mp-h.in)
diff --git a/gmp/cxx/Makefile.am b/gmp/cxx/Makefile.am
index 6af8ea3038..c4a42dce4e 100644
--- a/gmp/cxx/Makefile.am
+++ b/gmp/cxx/Makefile.am
@@ -1,32 +1,21 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2001-2003, 2012 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -D__GMP_WITHIN_GMPXX -I$(top_srcdir)
@@ -36,5 +25,5 @@ noinst_LTLIBRARIES = libcxx.la
endif
libcxx_la_SOURCES = \
- isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc limits.cc \
+ isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc \
osdoprnti.cc osfuns.cc osmpf.cc osmpq.cc osmpz.cc
diff --git a/gmp/cxx/Makefile.in b/gmp/cxx/Makefile.in
index 6066a76a7d..6d621fb4ea 100644
--- a/gmp/cxx/Makefile.in
+++ b/gmp/cxx/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,57 +14,34 @@
@SET_MAKE@
-# Copyright 2001-2003, 2012 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+SOURCES = $(libcxx_la_SOURCES)
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -77,44 +53,36 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
subdir = cxx
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libcxx_la_LIBADD =
am_libcxx_la_OBJECTS = isfuns.lo ismpf.lo ismpq.lo ismpz.lo ismpznw.lo \
- limits.lo osdoprnti.lo osfuns.lo osmpf.lo osmpq.lo osmpz.lo
+ osdoprnti.lo osfuns.lo osmpf.lo osmpq.lo osmpz.lo
libcxx_la_OBJECTS = $(am_libcxx_la_OBJECTS)
-@WANT_CXX_TRUE@am_libcxx_la_rpath =
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libcxx_la_SOURCES)
DIST_SOURCES = $(libcxx_la_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -128,6 +96,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -143,17 +112,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -167,12 +135,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -187,26 +153,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -216,31 +176,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -264,6 +219,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -271,16 +227,12 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMPXX -I$(top_srcdir)
@WANT_CXX_TRUE@noinst_LTLIBRARIES = libcxx.la
libcxx_la_SOURCES = \
- isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc limits.cc \
+ isfuns.cc ismpf.cc ismpq.cc ismpz.cc ismpznw.cc \
osdoprnti.cc osfuns.cc osmpf.cc osmpq.cc osmpz.cc
all: all-am
@@ -291,14 +243,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps cxx/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps cxx/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps cxx/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps cxx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -316,24 +268,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libcxx.la: $(libcxx_la_OBJECTS) $(libcxx_la_DEPENDENCIES) $(EXTRA_libcxx_la_DEPENDENCIES)
- $(CXXLINK) $(am_libcxx_la_rpath) $(libcxx_la_OBJECTS) $(libcxx_la_LIBADD) $(LIBS)
+libcxx.la: $(libcxx_la_OBJECTS) $(libcxx_la_DEPENDENCIES)
+ $(CXXLINK) $(libcxx_la_LDFLAGS) $(libcxx_la_OBJECTS) $(libcxx_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.cc.o:
$(CXXCOMPILE) -c -o $@ $<
@@ -350,85 +306,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -446,22 +399,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -474,7 +421,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -482,38 +429,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -522,7 +449,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -533,23 +460,19 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/gmp/cxx/dummy.cc b/gmp/cxx/dummy.cc
index 8b728caa2d..00e470c91e 100644
--- a/gmp/cxx/dummy.cc
+++ b/gmp/cxx/dummy.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* some compilers reputedly dislike completely empty files */
diff --git a/gmp/cxx/isfuns.cc b/gmp/cxx/isfuns.cc
index 3d349bcfa5..e3ea5ae136 100644
--- a/gmp/cxx/isfuns.cc
+++ b/gmp/cxx/isfuns.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <cctype>
#include <iostream>
diff --git a/gmp/cxx/ismpf.cc b/gmp/cxx/ismpf.cc
index 71c2b44d5c..bfe4dc8b91 100644
--- a/gmp/cxx/ismpf.cc
+++ b/gmp/cxx/ismpf.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <cctype>
#include <iostream>
@@ -56,7 +45,7 @@ operator>> (istream &i, mpf_ptr f)
bool ok = false;
// C decimal point, as expected by mpf_set_str
- const char *lconv_point = GMP_DECIMAL_POINT;
+ const char *lconv_point = localeconv()->decimal_point;
// C++ decimal point
#if HAVE_STD__LOCALE
@@ -131,7 +120,7 @@ operator>> (istream &i, mpf_ptr f)
if (i.good()) // last character read was non-numeric
i.putback(c);
else if (i.eof() && ok) // stopped just before eof
- i.clear(ios::eofbit);
+ i.clear();
if (ok)
ASSERT_NOCARRY (mpf_set_str(f, s.c_str(), base)); // extract the number
diff --git a/gmp/cxx/ismpq.cc b/gmp/cxx/ismpq.cc
index bc12e4a228..23eec7657d 100644
--- a/gmp/cxx/ismpq.cc
+++ b/gmp/cxx/ismpq.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <cctype>
#include <iostream>
@@ -60,7 +49,7 @@ operator>> (istream &i, mpq_ptr q)
if (i.good())
i.putback(c);
else if (i.eof())
- i.clear(ios::eofbit);
+ i.clear();
}
return i;
diff --git a/gmp/cxx/ismpz.cc b/gmp/cxx/ismpz.cc
index e4775bc300..3afa8368e2 100644
--- a/gmp/cxx/ismpz.cc
+++ b/gmp/cxx/ismpz.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <cctype>
#include <iostream>
diff --git a/gmp/cxx/ismpznw.cc b/gmp/cxx/ismpznw.cc
index 549742c2ad..387d092acf 100644
--- a/gmp/cxx/ismpznw.cc
+++ b/gmp/cxx/ismpznw.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <cctype>
#include <iostream>
@@ -60,7 +49,7 @@ __gmpz_operator_in_nowhite (istream &i, mpz_ptr z, char c)
if (i.good()) // last character read was non-numeric
i.putback(c);
else if (i.eof() && (ok || zero)) // stopped just before eof
- i.clear(ios::eofbit);
+ i.clear();
if (ok)
ASSERT_NOCARRY (mpz_set_str (z, s.c_str(), base)); // extract the number
diff --git a/gmp/cxx/limits.cc b/gmp/cxx/limits.cc
deleted file mode 100644
index 3004e16cce..0000000000
--- a/gmp/cxx/limits.cc
+++ /dev/null
@@ -1,62 +0,0 @@
-/* instantiation of numeric_limits specializations.
-
-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 "gmpxx.h"
-
-namespace std {
-#define GMPXX_INSTANTIATE_LIMITS(T) \
- const bool numeric_limits<T>::is_specialized; \
- const int numeric_limits<T>::digits; \
- const int numeric_limits<T>::digits10; \
- const int numeric_limits<T>::max_digits10; \
- const bool numeric_limits<T>::is_signed; \
- const bool numeric_limits<T>::is_integer; \
- const bool numeric_limits<T>::is_exact; \
- const int numeric_limits<T>::radix; \
- const int numeric_limits<T>::min_exponent; \
- const int numeric_limits<T>::min_exponent10; \
- const int numeric_limits<T>::max_exponent; \
- const int numeric_limits<T>::max_exponent10; \
- const bool numeric_limits<T>::has_infinity; \
- const bool numeric_limits<T>::has_quiet_NaN; \
- const bool numeric_limits<T>::has_signaling_NaN; \
- const float_denorm_style numeric_limits<T>::has_denorm; \
- const bool numeric_limits<T>::has_denorm_loss; \
- const bool numeric_limits<T>::is_iec559; \
- const bool numeric_limits<T>::is_bounded; \
- const bool numeric_limits<T>::is_modulo; \
- const bool numeric_limits<T>::traps; \
- const bool numeric_limits<T>::tinyness_before; \
- const float_round_style numeric_limits<T>::round_style
-
- GMPXX_INSTANTIATE_LIMITS(mpz_class);
- GMPXX_INSTANTIATE_LIMITS(mpq_class);
- GMPXX_INSTANTIATE_LIMITS(mpf_class);
-}
diff --git a/gmp/cxx/osdoprnti.cc b/gmp/cxx/osdoprnti.cc
index 4903c87d7f..e5dea4e361 100644
--- a/gmp/cxx/osdoprnti.cc
+++ b/gmp/cxx/osdoprnti.cc
@@ -9,32 +9,21 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <iostream>
-#include <stdarg.h> /* for va_list and hence doprnt_funs_t */
-#include <string.h> /* for strlen */
+#include <cstdarg> /* for va_list and hence doprnt_funs_t */
+#include <cstring> /* for strlen */
#include "gmp.h"
#include "gmp-impl.h"
diff --git a/gmp/cxx/osfuns.cc b/gmp/cxx/osfuns.cc
index 8df833e15c..d4a2443281 100644
--- a/gmp/cxx/osfuns.cc
+++ b/gmp/cxx/osfuns.cc
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <iostream>
#include <stdarg.h> /* for va_list and hence doprnt_funs_t */
diff --git a/gmp/cxx/osmpf.cc b/gmp/cxx/osmpf.cc
index c6a71d2520..402a570224 100644
--- a/gmp/cxx/osmpf.cc
+++ b/gmp/cxx/osmpf.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <clocale>
#include <iostream>
@@ -58,7 +47,7 @@ operator<< (ostream &o, mpf_srcptr f)
point[0] = use_facet< numpunct<char> >(o.getloc()).decimal_point();
point[1] = '\0';
#else
- const char *point = GMP_DECIMAL_POINT;
+ const char *point = localeconv()->decimal_point;
#endif
GMP_ASPRINTF_T_INIT (d, &result);
diff --git a/gmp/cxx/osmpq.cc b/gmp/cxx/osmpq.cc
index f95f39a648..92679f852d 100644
--- a/gmp/cxx/osmpq.cc
+++ b/gmp/cxx/osmpq.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <iostream>
#include <stdarg.h> /* for va_list and hence doprnt_funs_t */
diff --git a/gmp/cxx/osmpz.cc b/gmp/cxx/osmpz.cc
index ac1aefff40..d7d0b5c969 100644
--- a/gmp/cxx/osmpz.cc
+++ b/gmp/cxx/osmpz.cc
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <iostream>
#include <stdarg.h> /* for va_list and hence doprnt_funs_t */
diff --git a/gmp/demos/Makefile.am b/gmp/demos/Makefile.am
index 0a7c2a4732..97cb3ef465 100644
--- a/gmp/demos/Makefile.am
+++ b/gmp/demos/Makefile.am
@@ -1,36 +1,25 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2000-2002, 2012 Free Software Foundation, Inc.
+# Copyright 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
SUBDIRS = calc expr
-EXTRA_DIST = perl primes.h
+EXTRA_DIST = perl
INCLUDES = -I$(top_srcdir)
LDADD = $(top_builddir)/libgmp.la
diff --git a/gmp/demos/Makefile.in b/gmp/demos/Makefile.in
index 129c786f1c..a4a88fdae7 100644
--- a/gmp/demos/Makefile.in
+++ b/gmp/demos/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,56 +14,33 @@
@SET_MAKE@
-# Copyright 2000-2002, 2012 Free Software Foundation, Inc.
+# Copyright 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = factorize.c isprime.c pexpr.c primes.c qcn.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -76,8 +52,8 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
EXTRA_PROGRAMS = factorize$(EXEEXT) isprime$(EXEEXT) pexpr$(EXEEXT) \
primes$(EXEEXT) qcn$(EXEEXT)
subdir = demos
@@ -85,92 +61,55 @@ DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/pexpr-config-h.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = pexpr-config.h
-CONFIG_CLEAN_VPATH_FILES =
factorize_SOURCES = factorize.c
-factorize_OBJECTS = factorize.$(OBJEXT)
+factorize_OBJECTS = factorize$U.$(OBJEXT)
factorize_LDADD = $(LDADD)
factorize_DEPENDENCIES = $(top_builddir)/libgmp.la
isprime_SOURCES = isprime.c
-isprime_OBJECTS = isprime.$(OBJEXT)
+isprime_OBJECTS = isprime$U.$(OBJEXT)
isprime_LDADD = $(LDADD)
isprime_DEPENDENCIES = $(top_builddir)/libgmp.la
pexpr_SOURCES = pexpr.c
-pexpr_OBJECTS = pexpr.$(OBJEXT)
+pexpr_OBJECTS = pexpr$U.$(OBJEXT)
pexpr_LDADD = $(LDADD)
pexpr_DEPENDENCIES = $(top_builddir)/libgmp.la
primes_SOURCES = primes.c
-primes_OBJECTS = primes.$(OBJEXT)
-am__DEPENDENCIES_1 =
-primes_DEPENDENCIES = $(LDADD) $(am__DEPENDENCIES_1)
+primes_OBJECTS = primes$U.$(OBJEXT)
+am__DEPENDENCIES_1 = $(top_builddir)/libgmp.la
+am__DEPENDENCIES_2 =
+primes_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
qcn_SOURCES = qcn.c
-qcn_OBJECTS = qcn.$(OBJEXT)
-qcn_DEPENDENCIES = $(LDADD) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+qcn_OBJECTS = qcn$U.$(OBJEXT)
+qcn_DEPENDENCIES = $(am__DEPENDENCIES_1) $(am__DEPENDENCIES_2)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = factorize.c isprime.c pexpr.c primes.c qcn.c
DIST_SOURCES = factorize.c isprime.c pexpr.c primes.c qcn.c
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
ETAGS = etags
CTAGS = ctags
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
ABI = @ABI@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -181,6 +120,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -196,17 +136,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -220,12 +159,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -240,26 +177,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -269,31 +200,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -317,6 +243,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -324,14 +251,10 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
SUBDIRS = calc expr
-EXTRA_DIST = perl primes.h
+EXTRA_DIST = perl
INCLUDES = -I$(top_srcdir)
LDADD = $(top_builddir)/libgmp.la
qcn_LDADD = $(LDADD) $(LIBM)
@@ -345,14 +268,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps demos/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps demos/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps demos/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps demos/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -370,30 +293,34 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
pexpr-config.h: $(top_builddir)/config.status $(srcdir)/pexpr-config-h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
-factorize$(EXEEXT): $(factorize_OBJECTS) $(factorize_DEPENDENCIES) $(EXTRA_factorize_DEPENDENCIES)
+factorize$(EXEEXT): $(factorize_OBJECTS) $(factorize_DEPENDENCIES)
@rm -f factorize$(EXEEXT)
- $(LINK) $(factorize_OBJECTS) $(factorize_LDADD) $(LIBS)
-isprime$(EXEEXT): $(isprime_OBJECTS) $(isprime_DEPENDENCIES) $(EXTRA_isprime_DEPENDENCIES)
+ $(LINK) $(factorize_LDFLAGS) $(factorize_OBJECTS) $(factorize_LDADD) $(LIBS)
+isprime$(EXEEXT): $(isprime_OBJECTS) $(isprime_DEPENDENCIES)
@rm -f isprime$(EXEEXT)
- $(LINK) $(isprime_OBJECTS) $(isprime_LDADD) $(LIBS)
-pexpr$(EXEEXT): $(pexpr_OBJECTS) $(pexpr_DEPENDENCIES) $(EXTRA_pexpr_DEPENDENCIES)
+ $(LINK) $(isprime_LDFLAGS) $(isprime_OBJECTS) $(isprime_LDADD) $(LIBS)
+pexpr$(EXEEXT): $(pexpr_OBJECTS) $(pexpr_DEPENDENCIES)
@rm -f pexpr$(EXEEXT)
- $(LINK) $(pexpr_OBJECTS) $(pexpr_LDADD) $(LIBS)
-primes$(EXEEXT): $(primes_OBJECTS) $(primes_DEPENDENCIES) $(EXTRA_primes_DEPENDENCIES)
+ $(LINK) $(pexpr_LDFLAGS) $(pexpr_OBJECTS) $(pexpr_LDADD) $(LIBS)
+primes$(EXEEXT): $(primes_OBJECTS) $(primes_DEPENDENCIES)
@rm -f primes$(EXEEXT)
- $(LINK) $(primes_OBJECTS) $(primes_LDADD) $(LIBS)
-qcn$(EXEEXT): $(qcn_OBJECTS) $(qcn_DEPENDENCIES) $(EXTRA_qcn_DEPENDENCIES)
+ $(LINK) $(primes_LDFLAGS) $(primes_OBJECTS) $(primes_LDADD) $(LIBS)
+qcn$(EXEEXT): $(qcn_OBJECTS) $(qcn_DEPENDENCIES)
@rm -f qcn$(EXEEXT)
- $(LINK) $(qcn_OBJECTS) $(qcn_LDADD) $(LIBS)
+ $(LINK) $(qcn_LDFLAGS) $(qcn_OBJECTS) $(qcn_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -403,6 +330,19 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+factorize_.c: factorize.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/factorize.c; then echo $(srcdir)/factorize.c; else echo factorize.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+isprime_.c: isprime.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/isprime.c; then echo $(srcdir)/isprime.c; else echo isprime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pexpr_.c: pexpr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pexpr.c; then echo $(srcdir)/pexpr.c; else echo pexpr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+primes_.c: primes.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/primes.c; then echo $(srcdir)/primes.c; else echo primes.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+qcn_.c: qcn.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/qcn.c; then echo $(srcdir)/qcn.c; else echo qcn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+factorize_.$(OBJEXT) factorize_.lo isprime_.$(OBJEXT) isprime_.lo \
+pexpr_.$(OBJEXT) pexpr_.lo primes_.$(OBJEXT) primes_.lo qcn_.$(OBJEXT) \
+qcn_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -410,6 +350,10 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
@@ -417,13 +361,7 @@ clean-libtool:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -434,21 +372,16 @@ $(RECURSIVE_TARGETS):
else \
local_target="$$target"; \
fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -468,16 +401,16 @@ $(RECURSIVE_CLEAN_TARGETS):
else \
local_target="$$target"; \
fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -485,14 +418,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
@@ -503,99 +436,80 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ test -f $$subdir/TAGS && \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- $(am__make_dryrun) \
- || test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
distdir) \
|| exit 1; \
fi; \
@@ -615,23 +529,17 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -643,7 +551,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-recursive
@@ -651,38 +559,18 @@ dvi-am:
html: html-recursive
-html-am:
-
info: info-recursive
info-am:
install-data-am:
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-recursive
-
-install-html-am:
-
install-info: install-info-recursive
-install-info-am:
-
install-man:
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-recursive
@@ -691,7 +579,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-recursive
@@ -702,30 +590,28 @@ ps: ps-recursive
ps-am:
-uninstall-am:
+uninstall-am: uninstall-info-am
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) ctags-recursive \
- install-am install-strip tags-recursive
+uninstall-info: uninstall-info-recursive
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-am clean clean-generic clean-libtool \
- ctags ctags-recursive distclean distclean-compile \
- distclean-generic distclean-libtool distclean-tags distdir dvi \
- dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-am \
+ clean clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs installdirs-am \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags tags-recursive uninstall uninstall-am
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
allprogs: $(EXTRA_PROGRAMS)
cd calc; $(MAKE) $(AM_MAKEFLAGS) allprogs
cd expr; $(MAKE) $(AM_MAKEFLAGS) allprogs
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/demos/calc/Makefile.am b/gmp/demos/calc/Makefile.am
index 3a461ebc59..da6490755c 100644
--- a/gmp/demos/calc/Makefile.am
+++ b/gmp/demos/calc/Makefile.am
@@ -1,32 +1,21 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2000-2004 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir)
diff --git a/gmp/demos/calc/Makefile.in b/gmp/demos/calc/Makefile.in
index 6606f87bc8..6637bac632 100644
--- a/gmp/demos/calc/Makefile.in
+++ b/gmp/demos/calc/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,56 +14,33 @@
@SET_MAKE@
-# Copyright 2000-2004 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(calc_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -76,55 +52,45 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
EXTRA_PROGRAMS = calc$(EXEEXT)
subdir = demos/calc
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in \
$(srcdir)/calc-config-h.in calc.c calc.h calclex.c
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES = calc-config.h
-CONFIG_CLEAN_VPATH_FILES =
-am_calc_OBJECTS = calc.$(OBJEXT) calclex.$(OBJEXT) calcread.$(OBJEXT)
+am_calc_OBJECTS = calc$U.$(OBJEXT) calclex$U.$(OBJEXT) \
+ calcread$U.$(OBJEXT)
calc_OBJECTS = $(am_calc_OBJECTS)
calc_LDADD = $(LDADD)
am__DEPENDENCIES_1 =
calc_DEPENDENCIES = $(top_builddir)/libgmp.la $(am__DEPENDENCIES_1) \
$(am__DEPENDENCIES_1) $(am__DEPENDENCIES_1)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-@MAINTAINER_MODE_FALSE@am__skiplex = test -f $@ ||
-LEXCOMPILE = $(LEX) $(AM_LFLAGS) $(LFLAGS)
-LTLEXCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(LEX) $(AM_LFLAGS) $(LFLAGS)
-YLWRAP = $(top_srcdir)/ylwrap
-@MAINTAINER_MODE_FALSE@am__skipyacc = test -f $@ ||
-YACCCOMPILE = $(YACC) $(AM_YFLAGS) $(YFLAGS)
-LTYACCCOMPILE = $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(YACC) $(AM_YFLAGS) $(YFLAGS)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+LEXCOMPILE = $(LEX) $(LFLAGS) $(AM_LFLAGS)
+LTLEXCOMPILE = $(LIBTOOL) --mode=compile $(LEX) $(LFLAGS) $(AM_LFLAGS)
+YACCCOMPILE = $(YACC) $(YFLAGS) $(AM_YFLAGS)
+LTYACCCOMPILE = $(LIBTOOL) --mode=compile $(YACC) $(YFLAGS) \
+ $(AM_YFLAGS)
SOURCES = $(calc_SOURCES)
DIST_SOURCES = $(calc_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -138,6 +104,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -153,17 +120,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -177,12 +143,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -197,26 +161,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -226,31 +184,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -274,6 +227,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -281,12 +235,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir)
# $(LEXLIB) is not actually needed for flex (which means the distributed
@@ -307,14 +257,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps demos/calc/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps demos/calc/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps demos/calc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps demos/calc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -332,21 +282,27 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
calc-config.h: $(top_builddir)/config.status $(srcdir)/calc-config-h.in
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@
calc.h: calc.c
- @if test ! -f $@; then rm -f calc.c; else :; fi
- @if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) calc.c; else :; fi
-calc$(EXEEXT): $(calc_OBJECTS) $(calc_DEPENDENCIES) $(EXTRA_calc_DEPENDENCIES)
+ @if test ! -f $@; then \
+ rm -f calc.c; \
+ $(MAKE) calc.c; \
+ else :; fi
+calc$(EXEEXT): $(calc_OBJECTS) $(calc_DEPENDENCIES)
@rm -f calc$(EXEEXT)
- $(LINK) $(calc_OBJECTS) $(calc_LDADD) $(LIBS)
+ $(LINK) $(calc_LDFLAGS) $(calc_OBJECTS) $(calc_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -356,12 +312,39 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+calc_.c: calc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/calc.c; then echo $(srcdir)/calc.c; else echo calc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+calclex_.c: calclex.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/calclex.c; then echo $(srcdir)/calclex.c; else echo calclex.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+calcread_.c: calcread.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/calcread.c; then echo $(srcdir)/calcread.c; else echo calcread.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+calc_.$(OBJEXT) calc_.lo calclex_.$(OBJEXT) calclex_.lo \
+calcread_.$(OBJEXT) calcread_.lo : $(ANSI2KNR)
.l.c:
- $(am__skiplex) $(SHELL) $(YLWRAP) $< $(LEX_OUTPUT_ROOT).c $@ -- $(LEXCOMPILE)
+ $(LEXCOMPILE) $<
+ sed '/^#/ s|$(LEX_OUTPUT_ROOT)\.c|$@|' $(LEX_OUTPUT_ROOT).c >$@
+ rm -f $(LEX_OUTPUT_ROOT).c
.y.c:
- $(am__skipyacc) $(SHELL) $(YLWRAP) $< y.tab.c $@ y.tab.h $*.h y.output $*.output -- $(YACCCOMPILE)
+ $(YACCCOMPILE) $<
+ if test -f y.tab.h; then \
+ to=`echo "$*_H" | sed \
+ -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/' \
+ -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`; \
+ sed "/^#/ s/Y_TAB_H/$$to/g" y.tab.h >$*.ht; \
+ rm -f y.tab.h; \
+ if cmp -s $*.ht $*.h; then \
+ rm -f $*.ht ;\
+ else \
+ mv $*.ht $*.h; \
+ fi; \
+ fi
+ if test -f y.output; then \
+ mv y.output $*.output; \
+ fi
+ sed '/^#/ s|y\.tab\.c|$@|' y.tab.c >$@t && mv $@t $@
+ rm -f y.tab.c
mostlyclean-libtool:
-rm -f *.lo
@@ -369,85 +352,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -467,31 +447,25 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
- -rm -f calc.c
-rm -f calc.h
- -rm -f calclex.c
+ -rm -f calc.c
-test -z "$(BUILT_SOURCES)" || rm -f $(BUILT_SOURCES)
+ -rm -f calclex.c
clean: clean-am
clean-am: clean-generic clean-libtool mostlyclean-am
@@ -499,7 +473,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -507,38 +481,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -547,7 +501,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -558,26 +512,21 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: all check install install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
allprogs: $(EXTRA_PROGRAMS)
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/demos/calc/README b/gmp/demos/calc/README
index 660394ecbc..f2f613049d 100644
--- a/gmp/demos/calc/README
+++ b/gmp/demos/calc/README
@@ -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 https://www.gnu.org/licenses/.
+this program. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/demos/calc/calc-common.h b/gmp/demos/calc/calc-common.h
index 7a9187826f..c9ca8a6743 100644
--- a/gmp/demos/calc/calc-common.h
+++ b/gmp/demos/calc/calc-common.h
@@ -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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
#include <stddef.h> /* for size_t */
#ifndef NO_CALC_H
diff --git a/gmp/demos/calc/calc-config-h.in b/gmp/demos/calc/calc-config-h.in
index 42cdd440c2..6ecf43e72e 100644
--- a/gmp/demos/calc/calc-config-h.in
+++ b/gmp/demos/calc/calc-config-h.in
@@ -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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
/* Define if GNU readline should be used. */
diff --git a/gmp/demos/calc/calc.c b/gmp/demos/calc/calc.c
index a306d1a563..afc7660d24 100644
--- a/gmp/demos/calc/calc.c
+++ b/gmp/demos/calc/calc.c
@@ -1,73 +1,42 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
-
-/* Bison implementation for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 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 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 <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-/* C LALR(1) parser skeleton written by Richard Stallman, by
- simplifying the original so-called "semantic" parser. */
+/* A Bison parser, made from calc.y
+ by GNU bison 1.34. */
+
+#define YYBISON 1 /* Identify Bison output. */
+
+# define EOS 257
+# define BAD 258
+# define HELP 259
+# define HEX 260
+# define DECIMAL 261
+# define QUIT 262
+# define ABS 263
+# define BIN 264
+# define FIB 265
+# define GCD 266
+# define KRON 267
+# define LCM 268
+# define LUCNUM 269
+# define NEXTPRIME 270
+# define POWM 271
+# define ROOT 272
+# define SQRT 273
+# define NUMBER 274
+# define VARIABLE 275
+# define LOR 276
+# define LAND 277
+# define EQ 278
+# define NE 279
+# define LE 280
+# define GE 281
+# define LSHIFT 282
+# define RSHIFT 283
+# define UMINUS 284
-/* All symbols defined below should begin with yy or YY, to avoid
- infringing on user name space. This should be done even for local
- variables, as they might otherwise be expanded by user macros.
- There are some unavoidable exceptions within include files to
- define necessary library symbols; they are noted "INFRINGES ON
- USER NAME SPACE" below. */
-
-/* Identify Bison output. */
-#define YYBISON 1
-
-/* Bison version. */
-#define YYBISON_VERSION "2.7.12-4996"
-
-/* Skeleton name. */
-#define YYSKELETON_NAME "yacc.c"
-
-/* Pure parsers. */
-#define YYPURE 0
-
-/* Push parsers. */
-#define YYPUSH 0
-
-/* Pull parsers. */
-#define YYPULL 1
-
-
-
-
-/* Copy the first part of user declarations. */
-/* Line 371 of yacc.c */
#line 1 "calc.y"
/* A simple integer desk calculator using yacc and gmp.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -81,7 +50,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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
/* This is a simple program, meant only to show one way to use GMP for this
@@ -171,10 +140,10 @@ mpz_t stack[100];
mpz_ptr sp = stack[0];
#define CHECK_OVERFLOW() \
- if (sp >= stack[numberof(stack)]) /* FIXME */ \
+ if (sp >= stack[numberof(stack)]) \
{ \
fprintf (stderr, \
- "Value stack overflow, too much nesting in expression\n"); \
+ "Value stack overflow, too much nesting in expression\n"); \
YYERROR; \
}
@@ -204,393 +173,29 @@ mpz_t variable[26];
}
-/* Line 371 of yacc.c */
-#line 209 "calc.c"
-
-# ifndef YY_NULL
-# if defined __cplusplus && 201103L <= __cplusplus
-# define YY_NULL nullptr
-# else
-# define YY_NULL 0
-# endif
-# endif
-
-/* Enabling verbose error messages. */
-#ifdef YYERROR_VERBOSE
-# undef YYERROR_VERBOSE
-# define YYERROR_VERBOSE 1
-#else
-# define YYERROR_VERBOSE 0
-#endif
-
-/* In a future release of Bison, this section will be replaced
- by #include "y.tab.h". */
-#ifndef YY_YY_Y_TAB_H_INCLUDED
-# define YY_YY_Y_TAB_H_INCLUDED
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int yydebug;
-#endif
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- EOS = 258,
- BAD = 259,
- HELP = 260,
- HEX = 261,
- DECIMAL = 262,
- QUIT = 263,
- ABS = 264,
- BIN = 265,
- FIB = 266,
- GCD = 267,
- KRON = 268,
- LCM = 269,
- LUCNUM = 270,
- NEXTPRIME = 271,
- POWM = 272,
- ROOT = 273,
- SQRT = 274,
- NUMBER = 275,
- VARIABLE = 276,
- LOR = 277,
- LAND = 278,
- GE = 279,
- LE = 280,
- NE = 281,
- EQ = 282,
- RSHIFT = 283,
- LSHIFT = 284,
- UMINUS = 285
- };
-#endif
-/* Tokens. */
-#define EOS 258
-#define BAD 259
-#define HELP 260
-#define HEX 261
-#define DECIMAL 262
-#define QUIT 263
-#define ABS 264
-#define BIN 265
-#define FIB 266
-#define GCD 267
-#define KRON 268
-#define LCM 269
-#define LUCNUM 270
-#define NEXTPRIME 271
-#define POWM 272
-#define ROOT 273
-#define SQRT 274
-#define NUMBER 275
-#define VARIABLE 276
-#define LOR 277
-#define LAND 278
-#define GE 279
-#define LE 280
-#define NE 281
-#define EQ 282
-#define RSHIFT 283
-#define LSHIFT 284
-#define UMINUS 285
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-/* Line 387 of yacc.c */
-#line 142 "calc.y"
-
+#line 143 "calc.y"
+#ifndef YYSTYPE
+typedef union {
char *str;
int var;
-
-
-/* Line 387 of yacc.c */
-#line 318 "calc.c"
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
-#endif
-
-extern YYSTYPE yylval;
-
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
-
-#endif /* !YY_YY_Y_TAB_H_INCLUDED */
-
-/* Copy the second part of user declarations. */
-
-/* Line 390 of yacc.c */
-#line 346 "calc.c"
-
-#ifdef short
-# undef short
-#endif
-
-#ifdef YYTYPE_UINT8
-typedef YYTYPE_UINT8 yytype_uint8;
-#else
-typedef unsigned char yytype_uint8;
-#endif
-
-#ifdef YYTYPE_INT8
-typedef YYTYPE_INT8 yytype_int8;
-#elif (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-typedef signed char yytype_int8;
-#else
-typedef short int yytype_int8;
-#endif
-
-#ifdef YYTYPE_UINT16
-typedef YYTYPE_UINT16 yytype_uint16;
-#else
-typedef unsigned short int yytype_uint16;
-#endif
-
-#ifdef YYTYPE_INT16
-typedef YYTYPE_INT16 yytype_int16;
-#else
-typedef short int yytype_int16;
-#endif
-
-#ifndef YYSIZE_T
-# ifdef __SIZE_TYPE__
-# define YYSIZE_T __SIZE_TYPE__
-# elif defined size_t
-# define YYSIZE_T size_t
-# elif ! defined YYSIZE_T && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
-# define YYSIZE_T size_t
-# else
-# define YYSIZE_T unsigned int
-# endif
-#endif
-
-#define YYSIZE_MAXIMUM ((YYSIZE_T) -1)
-
-#ifndef YY_
-# if defined YYENABLE_NLS && YYENABLE_NLS
-# if ENABLE_NLS
-# include <libintl.h> /* INFRINGES ON USER NAME SPACE */
-# define YY_(Msgid) dgettext ("bison-runtime", Msgid)
-# endif
-# endif
-# ifndef YY_
-# define YY_(Msgid) Msgid
-# endif
+} yystype;
+# define YYSTYPE yystype
#endif
-
-#ifndef __attribute__
-/* This feature is available in gcc versions 2.5 and later. */
-# if (! defined __GNUC__ || __GNUC__ < 2 \
- || (__GNUC__ == 2 && __GNUC_MINOR__ < 5))
-# define __attribute__(Spec) /* empty */
-# endif
+#ifndef YYDEBUG
+# define YYDEBUG 0
#endif
-/* Suppress unused-variable warnings by "using" E. */
-#if ! defined lint || defined __GNUC__
-# define YYUSE(E) ((void) (E))
-#else
-# define YYUSE(E) /* empty */
-#endif
-/* Identity function, used to suppress warnings about constant conditions. */
-#ifndef lint
-# define YYID(N) (N)
-#else
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static int
-YYID (int yyi)
-#else
-static int
-YYID (yyi)
- int yyi;
-#endif
-{
- return yyi;
-}
-#endif
+#define YYFINAL 118
+#define YYFLAG -32768
+#define YYNTBASE 44
-#if ! defined yyoverflow || YYERROR_VERBOSE
+/* YYTRANSLATE(YYLEX) -- Bison token number corresponding to YYLEX. */
+#define YYTRANSLATE(x) ((unsigned)(x) <= 284 ? yytranslate[x] : 50)
-/* The parser invokes alloca or malloc; define the necessary symbols. */
-
-# ifdef YYSTACK_USE_ALLOCA
-# if YYSTACK_USE_ALLOCA
-# ifdef __GNUC__
-# define YYSTACK_ALLOC __builtin_alloca
-# elif defined __BUILTIN_VA_ARG_INCR
-# include <alloca.h> /* INFRINGES ON USER NAME SPACE */
-# elif defined _AIX
-# define YYSTACK_ALLOC __alloca
-# elif defined _MSC_VER
-# include <malloc.h> /* INFRINGES ON USER NAME SPACE */
-# define alloca _alloca
-# else
-# define YYSTACK_ALLOC alloca
-# if ! defined _ALLOCA_H && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
- /* Use EXIT_SUCCESS as a witness for stdlib.h. */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# endif
-# endif
-# endif
-
-# ifdef YYSTACK_ALLOC
- /* Pacify GCC's `empty if-body' warning. */
-# define YYSTACK_FREE(Ptr) do { /* empty */; } while (YYID (0))
-# ifndef YYSTACK_ALLOC_MAXIMUM
- /* The OS might guarantee only one guard page at the bottom of the stack,
- and a page size can be as small as 4096 bytes. So we cannot safely
- invoke alloca (N) if N exceeds 4096. Use a slightly smaller number
- to allow for a few compiler-allocated temporary stack slots. */
-# define YYSTACK_ALLOC_MAXIMUM 4032 /* reasonable circa 2006 */
-# endif
-# else
-# define YYSTACK_ALLOC YYMALLOC
-# define YYSTACK_FREE YYFREE
-# ifndef YYSTACK_ALLOC_MAXIMUM
-# define YYSTACK_ALLOC_MAXIMUM YYSIZE_MAXIMUM
-# endif
-# if (defined __cplusplus && ! defined EXIT_SUCCESS \
- && ! ((defined YYMALLOC || defined malloc) \
- && (defined YYFREE || defined free)))
-# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
-# ifndef EXIT_SUCCESS
-# define EXIT_SUCCESS 0
-# endif
-# endif
-# ifndef YYMALLOC
-# define YYMALLOC malloc
-# if ! defined malloc && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void *malloc (YYSIZE_T); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# ifndef YYFREE
-# define YYFREE free
-# if ! defined free && ! defined EXIT_SUCCESS && (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-void free (void *); /* INFRINGES ON USER NAME SPACE */
-# endif
-# endif
-# endif
-#endif /* ! defined yyoverflow || YYERROR_VERBOSE */
-
-
-#if (! defined yyoverflow \
- && (! defined __cplusplus \
- || (defined YYSTYPE_IS_TRIVIAL && YYSTYPE_IS_TRIVIAL)))
-
-/* A type that is properly aligned for any stack member. */
-union yyalloc
-{
- yytype_int16 yyss_alloc;
- YYSTYPE yyvs_alloc;
-};
-
-/* The size of the maximum gap between one aligned stack and the next. */
-# define YYSTACK_GAP_MAXIMUM (sizeof (union yyalloc) - 1)
-
-/* The size of an array large to enough to hold all stacks, each with
- N elements. */
-# define YYSTACK_BYTES(N) \
- ((N) * (sizeof (yytype_int16) + sizeof (YYSTYPE)) \
- + YYSTACK_GAP_MAXIMUM)
-
-# define YYCOPY_NEEDED 1
-
-/* Relocate STACK from its old location to the new one. The
- local variables YYSIZE and YYSTACKSIZE give the old and new number of
- elements in the stack, and YYPTR gives the new location of the
- stack. Advance YYPTR to a properly aligned location for the next
- stack. */
-# define YYSTACK_RELOCATE(Stack_alloc, Stack) \
- do \
- { \
- YYSIZE_T yynewbytes; \
- YYCOPY (&yyptr->Stack_alloc, Stack, yysize); \
- Stack = &yyptr->Stack_alloc; \
- yynewbytes = yystacksize * sizeof (*Stack) + YYSTACK_GAP_MAXIMUM; \
- yyptr += yynewbytes / sizeof (*yyptr); \
- } \
- while (YYID (0))
-
-#endif
-
-#if defined YYCOPY_NEEDED && YYCOPY_NEEDED
-/* Copy COUNT objects from SRC to DST. The source and destination do
- not overlap. */
-# ifndef YYCOPY
-# if defined __GNUC__ && 1 < __GNUC__
-# define YYCOPY(Dst, Src, Count) \
- __builtin_memcpy (Dst, Src, (Count) * sizeof (*(Src)))
-# else
-# define YYCOPY(Dst, Src, Count) \
- do \
- { \
- YYSIZE_T yyi; \
- for (yyi = 0; yyi < (Count); yyi++) \
- (Dst)[yyi] = (Src)[yyi]; \
- } \
- while (YYID (0))
-# endif
-# endif
-#endif /* !YYCOPY_NEEDED */
-
-/* YYFINAL -- State number of the termination state. */
-#define YYFINAL 41
-/* YYLAST -- Last index in YYTABLE. */
-#define YYLAST 552
-
-/* YYNTOKENS -- Number of terminals. */
-#define YYNTOKENS 44
-/* YYNNTS -- Number of nonterminals. */
-#define YYNNTS 7
-/* YYNRULES -- Number of rules. */
-#define YYNRULES 49
-/* YYNRULES -- Number of states. */
-#define YYNSTATES 118
-
-/* YYTRANSLATE(YYLEX) -- Bison symbol number corresponding to YYLEX. */
-#define YYUNDEFTOK 2
-#define YYMAXUTOK 285
-
-#define YYTRANSLATE(YYX) \
- ((unsigned int) (YYX) <= YYMAXUTOK ? yytranslate[YYX] : YYUNDEFTOK)
-
-/* YYTRANSLATE[YYLEX] -- Bison symbol number corresponding to YYLEX. */
-static const yytype_uint8 yytranslate[] =
+/* YYTRANSLATE[YYLEX] -- Bison token number corresponding to YYLEX. */
+static const char yytranslate[] =
{
0, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
@@ -617,245 +222,223 @@ static const yytype_uint8 yytranslate[] =
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
- 2, 2, 2, 2, 2, 2, 1, 2, 3, 4,
- 5, 6, 7, 8, 9, 10, 11, 12, 13, 14,
- 15, 16, 17, 18, 19, 20, 21, 22, 23, 26,
- 27, 28, 29, 30, 31, 37
+ 2, 2, 2, 2, 2, 2, 1, 3, 4, 5,
+ 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
+ 16, 17, 18, 19, 20, 21, 22, 23, 26, 27,
+ 28, 29, 30, 31, 37
};
#if YYDEBUG
-/* YYPRHS[YYN] -- Index of the first RHS symbol of rule number YYN in
- YYRHS. */
-static const yytype_uint8 yyprhs[] =
+static const short yyprhs[] =
{
- 0, 0, 3, 5, 8, 11, 15, 18, 19, 21,
- 25, 27, 29, 31, 33, 37, 41, 45, 49, 53,
- 57, 61, 65, 69, 72, 75, 79, 83, 87, 91,
- 95, 99, 103, 107, 112, 119, 124, 129, 136, 141,
- 146, 151, 160, 167, 172, 174, 176, 178, 182, 184
+ 0, 0, 2, 5, 8, 12, 15, 16, 18, 22,
+ 24, 26, 28, 30, 34, 38, 42, 46, 50, 54,
+ 58, 62, 66, 69, 72, 76, 80, 84, 88, 92,
+ 96, 100, 104, 109, 116, 121, 126, 133, 138, 143,
+ 148, 157, 164, 169, 171, 173, 175, 179, 181
};
-
-/* YYRHS -- A `-1'-separated list of the rules' RHS. */
-static const yytype_int8 yyrhs[] =
+static const short yyrhs[] =
{
- 45, 0, -1, 47, -1, 46, 47, -1, 47, 3,
- -1, 46, 47, 3, -1, 1, 3, -1, -1, 48,
- -1, 21, 40, 48, -1, 5, -1, 6, -1, 7,
- -1, 8, -1, 41, 48, 42, -1, 48, 32, 48,
- -1, 48, 33, 48, -1, 48, 34, 48, -1, 48,
- 35, 48, -1, 48, 36, 48, -1, 48, 38, 48,
- -1, 48, 31, 48, -1, 48, 30, 48, -1, 48,
- 39, -1, 33, 48, -1, 48, 24, 48, -1, 48,
- 27, 48, -1, 48, 29, 48, -1, 48, 28, 48,
- -1, 48, 26, 48, -1, 48, 25, 48, -1, 48,
- 23, 48, -1, 48, 22, 48, -1, 9, 41, 48,
- 42, -1, 10, 41, 48, 43, 48, 42, -1, 11,
- 41, 48, 42, -1, 12, 41, 49, 42, -1, 13,
- 41, 48, 43, 48, 42, -1, 14, 41, 50, 42,
- -1, 15, 41, 48, 42, -1, 16, 41, 48, 42,
- -1, 17, 41, 48, 43, 48, 43, 48, 42, -1,
- 18, 41, 48, 43, 48, 42, -1, 19, 41, 48,
- 42, -1, 21, -1, 20, -1, 48, -1, 49, 43,
- 48, -1, 48, -1, 50, 43, 48, -1
+ 46, 0, 45, 46, 0, 46, 3, 0, 45, 46,
+ 3, 0, 1, 3, 0, 0, 47, 0, 21, 40,
+ 47, 0, 5, 0, 6, 0, 7, 0, 8, 0,
+ 41, 47, 42, 0, 47, 32, 47, 0, 47, 33,
+ 47, 0, 47, 34, 47, 0, 47, 35, 47, 0,
+ 47, 36, 47, 0, 47, 38, 47, 0, 47, 30,
+ 47, 0, 47, 31, 47, 0, 47, 39, 0, 33,
+ 47, 0, 47, 24, 47, 0, 47, 28, 47, 0,
+ 47, 26, 47, 0, 47, 27, 47, 0, 47, 29,
+ 47, 0, 47, 25, 47, 0, 47, 23, 47, 0,
+ 47, 22, 47, 0, 9, 41, 47, 42, 0, 10,
+ 41, 47, 43, 47, 42, 0, 11, 41, 47, 42,
+ 0, 12, 41, 48, 42, 0, 13, 41, 47, 43,
+ 47, 42, 0, 14, 41, 49, 42, 0, 15, 41,
+ 47, 42, 0, 16, 41, 47, 42, 0, 17, 41,
+ 47, 43, 47, 43, 47, 42, 0, 18, 41, 47,
+ 43, 47, 42, 0, 19, 41, 47, 42, 0, 21,
+ 0, 20, 0, 47, 0, 48, 43, 47, 0, 47,
+ 0, 49, 43, 47, 0
};
-/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
-static const yytype_uint16 yyrline[] =
+#endif
+
+#if YYDEBUG
+/* YYRLINE[YYN] -- source line where rule number YYN was defined. */
+static const short yyrline[] =
{
- 0, 167, 167, 168, 171, 172, 173, 175, 177, 182,
- 188, 189, 190, 191, 197, 198, 199, 200, 201, 202,
- 203, 205, 207, 209, 211, 213, 214, 215, 216, 217,
- 218, 220, 221, 223, 224, 226, 228, 229, 231, 232,
- 234, 235, 236, 238, 240, 246, 257, 258, 261, 262
+ 0, 167, 169, 171, 173, 174, 176, 178, 183, 189,
+ 190, 191, 192, 197, 199, 200, 201, 202, 203, 204,
+ 206, 208, 210, 212, 214, 215, 216, 217, 218, 219,
+ 221, 222, 224, 225, 227, 229, 230, 232, 233, 235,
+ 236, 237, 239, 241, 247, 257, 259, 261, 263
};
#endif
-#if YYDEBUG || YYERROR_VERBOSE || 0
-/* YYTNAME[SYMBOL-NUM] -- String name of the symbol SYMBOL-NUM.
- First, the terminals, then, starting at YYNTOKENS, nonterminals. */
+
+#if (YYDEBUG) || defined YYERROR_VERBOSE
+
+/* YYTNAME[TOKEN_NUM] -- String name of the token TOKEN_NUM. */
static const char *const yytname[] =
{
- "$end", "error", "$undefined", "EOS", "BAD", "HELP", "HEX", "DECIMAL",
- "QUIT", "ABS", "BIN", "FIB", "GCD", "KRON", "LCM", "LUCNUM", "NEXTPRIME",
- "POWM", "ROOT", "SQRT", "NUMBER", "VARIABLE", "LOR", "LAND", "'<'",
- "'>'", "GE", "LE", "NE", "EQ", "RSHIFT", "LSHIFT", "'+'", "'-'", "'*'",
- "'/'", "'%'", "UMINUS", "'^'", "'!'", "'='", "'('", "')'", "','",
- "$accept", "top", "statements", "statement", "e", "gcdlist", "lcmlist", YY_NULL
+ "$", "error", "$undefined.", "EOS", "BAD", "HELP", "HEX", "DECIMAL",
+ "QUIT", "ABS", "BIN", "FIB", "GCD", "KRON", "LCM", "LUCNUM",
+ "NEXTPRIME", "POWM", "ROOT", "SQRT", "NUMBER", "VARIABLE", "LOR",
+ "LAND", "'<'", "'>'", "EQ", "NE", "LE", "GE", "LSHIFT", "RSHIFT", "'+'",
+ "'-'", "'*'", "'/'", "'%'", "UMINUS", "'^'", "'!'", "'='", "'('", "')'",
+ "','", "top", "statements", "statement", "e", "gcdlist", "lcmlist", 0
};
#endif
-# ifdef YYPRINT
-/* YYTOKNUM[YYLEX-NUM] -- Internal token number corresponding to
- token YYLEX-NUM. */
-static const yytype_uint16 yytoknum[] =
+/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
+static const short yyr1[] =
{
- 0, 256, 257, 258, 259, 260, 261, 262, 263, 264,
- 265, 266, 267, 268, 269, 270, 271, 272, 273, 274,
- 275, 276, 277, 278, 60, 62, 279, 280, 281, 282,
- 283, 284, 43, 45, 42, 47, 37, 285, 94, 33,
- 61, 40, 41, 44
+ 0, 44, 44, 45, 45, 45, 46, 46, 46, 46,
+ 46, 46, 46, 47, 47, 47, 47, 47, 47, 47,
+ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+ 47, 47, 47, 47, 47, 47, 47, 47, 47, 47,
+ 47, 47, 47, 47, 47, 48, 48, 49, 49
};
-# endif
-/* YYR1[YYN] -- Symbol number of symbol that rule YYN derives. */
-static const yytype_uint8 yyr1[] =
+/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
+static const short yyr2[] =
{
- 0, 44, 45, 45, 46, 46, 46, 47, 47, 47,
- 47, 47, 47, 47, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 49, 49, 50, 50
+ 0, 1, 2, 2, 3, 2, 0, 1, 3, 1,
+ 1, 1, 1, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 2, 2, 3, 3, 3, 3, 3, 3,
+ 3, 3, 4, 6, 4, 4, 6, 4, 4, 4,
+ 8, 6, 4, 1, 1, 1, 3, 1, 3
};
-/* YYR2[YYN] -- Number of symbols composing right hand side of rule YYN. */
-static const yytype_uint8 yyr2[] =
+/* YYDEFACT[S] -- default rule to reduce with in state S when YYTABLE
+ doesn't specify something else to do. Zero means the default is an
+ error. */
+static const short yydefact[] =
{
- 0, 2, 1, 2, 2, 3, 2, 0, 1, 3,
- 1, 1, 1, 1, 3, 3, 3, 3, 3, 3,
- 3, 3, 3, 2, 2, 3, 3, 3, 3, 3,
- 3, 3, 3, 4, 6, 4, 4, 6, 4, 4,
- 4, 8, 6, 4, 1, 1, 1, 3, 1, 3
+ 0, 0, 9, 10, 11, 12, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 44, 43, 0,
+ 0, 6, 1, 7, 5, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 43, 23, 0,
+ 2, 3, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 0, 0, 0, 22, 0,
+ 0, 0, 45, 0, 0, 47, 0, 0, 0, 0,
+ 0, 0, 8, 13, 4, 31, 30, 24, 29, 26,
+ 27, 25, 28, 20, 21, 14, 15, 16, 17, 18,
+ 19, 32, 0, 34, 35, 0, 0, 37, 0, 38,
+ 39, 0, 0, 42, 0, 46, 0, 48, 0, 0,
+ 33, 36, 0, 41, 0, 40, 0, 0, 0
};
-/* YYDEFACT[STATE-NAME] -- Default reduction number in state STATE-NUM.
- Performed when YYTABLE doesn't specify something else to do. Zero
- means the default is an error. */
-static const yytype_uint8 yydefact[] =
+static const short yydefgoto[] =
{
- 0, 0, 10, 11, 12, 13, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 45, 44, 0,
- 0, 0, 7, 2, 8, 6, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 44, 24,
- 0, 1, 3, 4, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
- 23, 0, 0, 0, 46, 0, 0, 48, 0, 0,
- 0, 0, 0, 0, 9, 14, 5, 32, 31, 25,
- 30, 29, 26, 28, 27, 22, 21, 15, 16, 17,
- 18, 19, 20, 33, 0, 35, 36, 0, 0, 38,
- 0, 39, 40, 0, 0, 43, 0, 47, 0, 49,
- 0, 0, 34, 37, 0, 42, 0, 41
+ 116, 21, 22, 23, 63, 66
};
-/* YYDEFGOTO[NTERM-NUM]. */
-static const yytype_int8 yydefgoto[] =
+static const short yypact[] =
{
- -1, 21, 22, 23, 24, 65, 68
+ 39, 17,-32768,-32768,-32768,-32768, -20, 0, 2, 25,
+ 28, 30, 33, 34, 37, 40, 46,-32768, -18, 122,
+ 122, 89, 67, 462,-32768, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122,-32768, -36, 252,
+ 87,-32768, 122, 122, 122, 122, 122, 122, 122, 122,
+ 122, 122, 122, 122, 122, 122, 122, 122,-32768, 273,
+ 142, 294, 462, -38, 164, 462, -24, 315, 336, 186,
+ 208, 357, 462,-32768,-32768, 479, 495, 511, 511, 511,
+ 511, 511, 511, 29, 29, 50, 50, -36, -36, -36,
+ -36,-32768, 122,-32768,-32768, 122, 122,-32768, 122,-32768,
+ -32768, 122, 122,-32768, 378, 462, 399, 462, 230, 420,
+ -32768,-32768, 122,-32768, 441,-32768, 91, 92,-32768
};
-/* YYPACT[STATE-NUM] -- Index in YYTABLE of the portion describing
- STATE-NUM. */
-#define YYPACT_NINF -39
-static const yytype_int16 yypact[] =
+static const short yypgoto[] =
{
- 41, 3, -39, -39, -39, -39, 2, 4, 27, 32,
- 35, 36, 39, 42, 45, 46, 47, -39, -18, 124,
- 124, 89, 91, 87, 464, -39, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, -39, -36,
- 254, -39, 88, -39, 124, 124, 124, 124, 124, 124,
- 124, 124, 124, 124, 124, 124, 124, 124, 124, 124,
- -39, 275, 144, 296, 464, -38, 166, 464, 29, 317,
- 338, 188, 210, 359, 464, -39, -39, 481, 497, 513,
- 513, 513, 513, 513, 513, 31, 31, -15, -15, -36,
- -36, -36, -36, -39, 124, -39, -39, 124, 124, -39,
- 124, -39, -39, 124, 124, -39, 380, 464, 401, 464,
- 232, 422, -39, -39, 124, -39, 443, -39
+ -32768,-32768, 90, -19,-32768,-32768
};
-/* YYPGOTO[NTERM-NUM]. */
-static const yytype_int8 yypgoto[] =
-{
- -39, -39, -39, 70, -19, -39, -39
-};
-/* YYTABLE[YYPACT[STATE-NUM]]. What to do in state STATE-NUM. If
- positive, shift that token. If negative, reduce the rule which
- number is the opposite. If YYTABLE_NINF, syntax error. */
-#define YYTABLE_NINF -8
-static const yytype_int8 yytable[] =
+#define YYLAST 550
+
+
+static const short yytable[] =
{
- 39, 40, 59, 60, 96, 97, 25, 61, 62, 63,
- 64, 66, 67, 69, 70, 71, 72, 73, 74, 56,
- 57, 58, 37, 59, 60, 77, 78, 79, 80, 81,
- 82, 83, 84, 85, 86, 87, 88, 89, 90, 91,
- 92, -7, 1, 26, -7, 27, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 54, 55, 56, 57, 58, 28, 59,
- 60, 99, 100, 29, 19, 106, 30, 31, 107, 108,
- 32, 109, 20, 33, 110, 111, 34, 35, 36, 41,
- 43, 76, 42, 0, 0, 116, 2, 3, 4, 5,
- 6, 7, 8, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 0, 0, 0, 0, 0, 0, 0,
- 0, 0, 0, 0, 19, 0, 0, 0, 0, 0,
- 0, 0, 20, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 38, 0, 0, 0, 0,
- 0, 0, 0, 0, 0, 0, 0, 19, 0, 0,
- 0, 0, 0, 0, 0, 20, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 0, 59, 60, 0, 0, 0, 94, 44, 45,
+ 38, 39, 57, 58, 94, 95, 59, 60, 61, 62,
+ 64, 65, 67, 68, 69, 70, 71, 72, 97, 98,
+ 24, 25, 36, 75, 76, 77, 78, 79, 80, 81,
+ 82, 83, 84, 85, 86, 87, 88, 89, 90, -6,
+ 1, 26, -6, 27, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 52, 53, 54, 55, 56, 28, 57, 58, 29,
+ 41, 30, 19, 104, 31, 32, 105, 106, 33, 107,
+ 20, 34, 108, 109, 54, 55, 56, 35, 57, 58,
+ 74, 117, 118, 114, 2, 3, 4, 5, 6, 7,
+ 8, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 40, 0, 0, 0, 0, 0, 0, 0, 0,
+ 0, 0, 19, 0, 0, 0, 0, 0, 0, 0,
+ 20, 6, 7, 8, 9, 10, 11, 12, 13, 14,
+ 15, 16, 17, 37, 0, 0, 0, 0, 0, 0,
+ 0, 0, 0, 0, 0, 19, 0, 0, 0, 0,
+ 0, 0, 0, 20, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 0,
+ 57, 58, 0, 0, 0, 92, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 0, 59, 60, 0, 0, 0, 98,
+ 56, 0, 57, 58, 0, 0, 0, 96, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 56, 57, 58, 0, 59, 60, 0, 0,
- 0, 103, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 0, 59, 60,
- 0, 0, 0, 104, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 0,
- 59, 60, 0, 0, 0, 114, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 0, 59, 60, 0, 0, 75, 44, 45, 46,
+ 54, 55, 56, 0, 57, 58, 0, 0, 0, 101,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 0, 57, 58, 0, 0,
+ 0, 102, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 0, 57, 58,
+ 0, 0, 0, 112, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 0,
+ 57, 58, 0, 0, 73, 42, 43, 44, 45, 46,
47, 48, 49, 50, 51, 52, 53, 54, 55, 56,
- 57, 58, 0, 59, 60, 0, 0, 93, 44, 45,
+ 0, 57, 58, 0, 0, 91, 42, 43, 44, 45,
46, 47, 48, 49, 50, 51, 52, 53, 54, 55,
- 56, 57, 58, 0, 59, 60, 0, 0, 95, 44,
+ 56, 0, 57, 58, 0, 0, 93, 42, 43, 44,
45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 0, 59, 60, 0, 0, 101,
+ 55, 56, 0, 57, 58, 0, 0, 99, 42, 43,
44, 45, 46, 47, 48, 49, 50, 51, 52, 53,
- 54, 55, 56, 57, 58, 0, 59, 60, 0, 0,
- 102, 44, 45, 46, 47, 48, 49, 50, 51, 52,
- 53, 54, 55, 56, 57, 58, 0, 59, 60, 0,
- 0, 105, 44, 45, 46, 47, 48, 49, 50, 51,
- 52, 53, 54, 55, 56, 57, 58, 0, 59, 60,
- 0, 0, 112, 44, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 0, 59,
- 60, 0, 0, 113, 44, 45, 46, 47, 48, 49,
- 50, 51, 52, 53, 54, 55, 56, 57, 58, 0,
- 59, 60, 0, 0, 115, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 0, 59, 60, 0, 0, 117, 44, 45, 46, 47,
- 48, 49, 50, 51, 52, 53, 54, 55, 56, 57,
- 58, 0, 59, 60, 45, 46, 47, 48, 49, 50,
- 51, 52, 53, 54, 55, 56, 57, 58, 0, 59,
- 60, 46, 47, 48, 49, 50, 51, 52, 53, 54,
- 55, 56, 57, 58, 0, 59, 60, -8, -8, -8,
- -8, -8, -8, 52, 53, 54, 55, 56, 57, 58,
- 0, 59, 60
+ 54, 55, 56, 0, 57, 58, 0, 0, 100, 42,
+ 43, 44, 45, 46, 47, 48, 49, 50, 51, 52,
+ 53, 54, 55, 56, 0, 57, 58, 0, 0, 103,
+ 42, 43, 44, 45, 46, 47, 48, 49, 50, 51,
+ 52, 53, 54, 55, 56, 0, 57, 58, 0, 0,
+ 110, 42, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 0, 57, 58, 0,
+ 0, 111, 42, 43, 44, 45, 46, 47, 48, 49,
+ 50, 51, 52, 53, 54, 55, 56, 0, 57, 58,
+ 0, 0, 113, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 0, 57,
+ 58, 0, 0, 115, 42, 43, 44, 45, 46, 47,
+ 48, 49, 50, 51, 52, 53, 54, 55, 56, 0,
+ 57, 58, 43, 44, 45, 46, 47, 48, 49, 50,
+ 51, 52, 53, 54, 55, 56, 0, 57, 58, 44,
+ 45, 46, 47, 48, 49, 50, 51, 52, 53, 54,
+ 55, 56, 0, 57, 58,-32768,-32768,-32768,-32768,-32768,
+ -32768, 50, 51, 52, 53, 54, 55, 56, 0, 57,
+ 58
};
-#define yypact_value_is_default(Yystate) \
- (!!((Yystate) == (-39)))
-
-#define yytable_value_is_error(Yytable_value) \
- (!!((Yytable_value) == (-8)))
-
-static const yytype_int8 yycheck[] =
+static const short yycheck[] =
{
- 19, 20, 38, 39, 42, 43, 3, 26, 27, 28,
- 29, 30, 31, 32, 33, 34, 35, 36, 37, 34,
- 35, 36, 40, 38, 39, 44, 45, 46, 47, 48,
- 49, 50, 51, 52, 53, 54, 55, 56, 57, 58,
- 59, 0, 1, 41, 3, 41, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, 32, 33, 34, 35, 36, 41, 38,
- 39, 42, 43, 41, 33, 94, 41, 41, 97, 98,
- 41, 100, 41, 41, 103, 104, 41, 41, 41, 0,
- 3, 3, 22, -1, -1, 114, 5, 6, 7, 8,
- 9, 10, 11, 12, 13, 14, 15, 16, 17, 18,
- 19, 20, 21, -1, -1, -1, -1, -1, -1, -1,
- -1, -1, -1, -1, 33, -1, -1, -1, -1, -1,
- -1, -1, 41, 9, 10, 11, 12, 13, 14, 15,
- 16, 17, 18, 19, 20, 21, -1, -1, -1, -1,
- -1, -1, -1, -1, -1, -1, -1, 33, -1, -1,
- -1, -1, -1, -1, -1, 41, 22, 23, 24, 25,
+ 19, 20, 38, 39, 42, 43, 25, 26, 27, 28,
+ 29, 30, 31, 32, 33, 34, 35, 36, 42, 43,
+ 3, 41, 40, 42, 43, 44, 45, 46, 47, 48,
+ 49, 50, 51, 52, 53, 54, 55, 56, 57, 0,
+ 1, 41, 3, 41, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 32, 33, 34, 35, 36, 41, 38, 39, 41,
+ 3, 41, 33, 92, 41, 41, 95, 96, 41, 98,
+ 41, 41, 101, 102, 34, 35, 36, 41, 38, 39,
+ 3, 0, 0, 112, 5, 6, 7, 8, 9, 10,
+ 11, 12, 13, 14, 15, 16, 17, 18, 19, 20,
+ 21, 21, -1, -1, -1, -1, -1, -1, -1, -1,
+ -1, -1, 33, -1, -1, -1, -1, -1, -1, -1,
+ 41, 9, 10, 11, 12, 13, 14, 15, 16, 17,
+ 18, 19, 20, 21, -1, -1, -1, -1, -1, -1,
+ -1, -1, -1, -1, -1, 33, -1, -1, -1, -1,
+ -1, -1, -1, 41, 22, 23, 24, 25, 26, 27,
+ 28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
+ 38, 39, -1, -1, -1, 43, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, -1, 38, 39, -1, -1, -1, 43, 22, 23,
24, 25, 26, 27, 28, 29, 30, 31, 32, 33,
@@ -866,7 +449,9 @@ static const yytype_int8 yycheck[] =
30, 31, 32, 33, 34, 35, 36, -1, 38, 39,
-1, -1, -1, 43, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
- 38, 39, -1, -1, -1, 43, 22, 23, 24, 25,
+ 38, 39, -1, -1, 42, 22, 23, 24, 25, 26,
+ 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
+ -1, 38, 39, -1, -1, 42, 22, 23, 24, 25,
26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
36, -1, 38, 39, -1, -1, 42, 22, 23, 24,
25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
@@ -885,97 +470,209 @@ static const yytype_int8 yycheck[] =
29, 30, 31, 32, 33, 34, 35, 36, -1, 38,
39, -1, -1, 42, 22, 23, 24, 25, 26, 27,
28, 29, 30, 31, 32, 33, 34, 35, 36, -1,
- 38, 39, -1, -1, 42, 22, 23, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- -1, 38, 39, -1, -1, 42, 22, 23, 24, 25,
- 26, 27, 28, 29, 30, 31, 32, 33, 34, 35,
- 36, -1, 38, 39, 23, 24, 25, 26, 27, 28,
+ 38, 39, 23, 24, 25, 26, 27, 28, 29, 30,
+ 31, 32, 33, 34, 35, 36, -1, 38, 39, 24,
+ 25, 26, 27, 28, 29, 30, 31, 32, 33, 34,
+ 35, 36, -1, 38, 39, 24, 25, 26, 27, 28,
29, 30, 31, 32, 33, 34, 35, 36, -1, 38,
- 39, 24, 25, 26, 27, 28, 29, 30, 31, 32,
- 33, 34, 35, 36, -1, 38, 39, 24, 25, 26,
- 27, 28, 29, 30, 31, 32, 33, 34, 35, 36,
- -1, 38, 39
+ 39
};
+/* -*-C-*- Note some compilers choke on comments on `#line' lines. */
+#line 3 "/usr/share/bison/bison.simple"
+
+/* Skeleton output parser for bison,
+
+ Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002 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 Foundation; either version 3, 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 http://www.gnu.org/licenses/. */
+
+/* As a special exception, when this file is copied by Bison into a
+ Bison output file, you may use that output file without restriction.
+ This special exception was added by the Free Software Foundation
+ in version 1.24 of Bison. */
+
+/* This is the parser code that is written into each bison parser when
+ the %semantic_parser declaration is not specified in the grammar.
+ It was written by Richard Stallman by simplifying the hairy parser
+ used when %semantic_parser is specified. */
-/* YYSTOS[STATE-NUM] -- The (internal number of the) accessing
- symbol of state STATE-NUM. */
-static const yytype_uint8 yystos[] =
+/* All symbols defined below should begin with yy or YY, to avoid
+ infringing on user name space. This should be done even for local
+ variables, as they might otherwise be expanded by user macros.
+ There are some unavoidable exceptions within include files to
+ define necessary library symbols; they are noted "INFRINGES ON
+ USER NAME SPACE" below. */
+
+#if ! defined (yyoverflow) || defined (YYERROR_VERBOSE)
+
+/* The parser invokes alloca or malloc; define the necessary symbols. */
+
+# if YYSTACK_USE_ALLOCA
+# define YYSTACK_ALLOC alloca
+# else
+# ifndef YYSTACK_USE_ALLOCA
+# if defined (alloca) || defined (_ALLOCA_H)
+# define YYSTACK_ALLOC alloca
+# else
+# ifdef __GNUC__
+# define YYSTACK_ALLOC __builtin_alloca
+# endif
+# endif
+# endif
+# endif
+
+# ifdef YYSTACK_ALLOC
+ /* Pacify GCC's `empty if-body' warning. */
+# define YYSTACK_FREE(Ptr) do { /* empty */; } while (0)
+# else
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stdlib.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+# define YYSTACK_ALLOC malloc
+# define YYSTACK_FREE free
+# endif
+
+/* A type that is properly aligned for any stack member. */
+union yyalloc
{
- 0, 1, 5, 6, 7, 8, 9, 10, 11, 12,
- 13, 14, 15, 16, 17, 18, 19, 20, 21, 33,
- 41, 45, 46, 47, 48, 3, 41, 41, 41, 41,
- 41, 41, 41, 41, 41, 41, 41, 40, 21, 48,
- 48, 0, 47, 3, 22, 23, 24, 25, 26, 27,
- 28, 29, 30, 31, 32, 33, 34, 35, 36, 38,
- 39, 48, 48, 48, 48, 49, 48, 48, 50, 48,
- 48, 48, 48, 48, 48, 42, 3, 48, 48, 48,
- 48, 48, 48, 48, 48, 48, 48, 48, 48, 48,
- 48, 48, 48, 42, 43, 42, 42, 43, 43, 42,
- 43, 42, 42, 43, 43, 42, 48, 48, 48, 48,
- 48, 48, 42, 42, 43, 42, 48, 42
+ short yyss;
+ YYSTYPE yyvs;
+# if YYLSP_NEEDED
+ YYLTYPE yyls;
+# endif
};
+/* The size of the maximum gap between one aligned stack and the next. */
+# define YYSTACK_GAP_MAX (sizeof (union yyalloc) - 1)
+
+/* The size of an array large to enough to hold all stacks, each with
+ N elements. */
+# if YYLSP_NEEDED
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short) + sizeof (YYSTYPE) + sizeof (YYLTYPE)) \
+ + 2 * YYSTACK_GAP_MAX)
+# else
+# define YYSTACK_BYTES(N) \
+ ((N) * (sizeof (short) + sizeof (YYSTYPE)) \
+ + YYSTACK_GAP_MAX)
+# endif
+
+/* Relocate the TYPE STACK from its old location to the new one. The
+ local variables YYSIZE and YYSTACKSIZE give the old and new number of
+ elements in the stack, and YYPTR gives the new location of the
+ stack. Advance YYPTR to a properly aligned location for the next
+ stack. */
+# define YYSTACK_RELOCATE(Type, Stack) \
+ do \
+ { \
+ YYSIZE_T yynewbytes; \
+ yymemcpy ((char *) yyptr, (char *) (Stack), \
+ yysize * (YYSIZE_T) sizeof (Type)); \
+ Stack = &yyptr->Stack; \
+ yynewbytes = yystacksize * sizeof (Type) + YYSTACK_GAP_MAX; \
+ yyptr += yynewbytes / sizeof (*yyptr); \
+ } \
+ while (0)
+
+#endif /* ! defined (yyoverflow) || defined (YYERROR_VERBOSE) */
+
+
+#if ! defined (YYSIZE_T) && defined (__SIZE_TYPE__)
+# define YYSIZE_T __SIZE_TYPE__
+#endif
+#if ! defined (YYSIZE_T) && defined (size_t)
+# define YYSIZE_T size_t
+#endif
+#if ! defined (YYSIZE_T)
+# if defined (__STDC__) || defined (__cplusplus)
+# include <stddef.h> /* INFRINGES ON USER NAME SPACE */
+# define YYSIZE_T size_t
+# endif
+#endif
+#if ! defined (YYSIZE_T)
+# define YYSIZE_T unsigned int
+#endif
+
#define yyerrok (yyerrstatus = 0)
#define yyclearin (yychar = YYEMPTY)
-#define YYEMPTY (-2)
+#define YYEMPTY -2
#define YYEOF 0
-
#define YYACCEPT goto yyacceptlab
-#define YYABORT goto yyabortlab
-#define YYERROR goto yyerrorlab
-
-
+#define YYABORT goto yyabortlab
+#define YYERROR goto yyerrlab1
/* Like YYERROR except do call yyerror. This remains here temporarily
to ease the transition to the new meaning of YYERROR, for GCC.
- Once GCC version 2 has supplanted version 1, this can go. However,
- YYFAIL appears to be in use. Nevertheless, it is formally deprecated
- in Bison 2.4.2's NEWS entry, where a plan to phase it out is
- discussed. */
-
+ Once GCC version 2 has supplanted version 1, this can go. */
#define YYFAIL goto yyerrlab
-#if defined YYFAIL
- /* This is here to suppress warnings from the GCC cpp's
- -Wunused-macros. Normally we don't worry about that warning, but
- some users do, and we want to make it easy for users to remove
- YYFAIL uses, which will produce warnings from Bison 2.5. */
-#endif
-
#define YYRECOVERING() (!!yyerrstatus)
-
-#define YYBACKUP(Token, Value) \
-do \
- if (yychar == YYEMPTY) \
- { \
- yychar = (Token); \
- yylval = (Value); \
- YYPOPSTACK (yylen); \
- yystate = *yyssp; \
- goto yybackup; \
- } \
- else \
- { \
- yyerror (YY_("syntax error: cannot back up")); \
+#define YYBACKUP(Token, Value) \
+do \
+ if (yychar == YYEMPTY && yylen == 1) \
+ { \
+ yychar = (Token); \
+ yylval = (Value); \
+ yychar1 = YYTRANSLATE (yychar); \
+ YYPOPSTACK; \
+ goto yybackup; \
+ } \
+ else \
+ { \
+ yyerror ("syntax error: cannot back up"); \
YYERROR; \
} \
-while (YYID (0))
+while (0)
-/* Error token number */
#define YYTERROR 1
#define YYERRCODE 256
-/* This macro is provided for backward compatibility. */
-#ifndef YY_LOCATION_PRINT
-# define YY_LOCATION_PRINT(File, Loc) ((void) 0)
+/* YYLLOC_DEFAULT -- Compute the default location (before the actions
+ are run).
+
+ When YYLLOC_DEFAULT is run, CURRENT is set the location of the
+ first token. By default, to implement support for ranges, extend
+ its range to the last symbol. */
+
+#ifndef YYLLOC_DEFAULT
+# define YYLLOC_DEFAULT(Current, Rhs, N) \
+ Current.last_line = Rhs[N].last_line; \
+ Current.last_column = Rhs[N].last_column;
#endif
/* YYLEX -- calling `yylex' with the right arguments. */
-#ifdef YYLEX_PARAM
-# define YYLEX yylex (YYLEX_PARAM)
-#else
-# define YYLEX yylex ()
-#endif
+
+#if YYPURE
+# if YYLSP_NEEDED
+# ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, &yylloc, YYLEX_PARAM)
+# else
+# define YYLEX yylex (&yylval, &yylloc)
+# endif
+# else /* !YYLSP_NEEDED */
+# ifdef YYLEX_PARAM
+# define YYLEX yylex (&yylval, YYLEX_PARAM)
+# else
+# define YYLEX yylex (&yylval)
+# endif
+# endif /* !YYLSP_NEEDED */
+#else /* !YYPURE */
+# define YYLEX yylex ()
+#endif /* !YYPURE */
+
/* Enable debugging if requested. */
#if YYDEBUG
@@ -989,156 +686,14 @@ while (YYID (0))
do { \
if (yydebug) \
YYFPRINTF Args; \
-} while (YYID (0))
-
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location) \
-do { \
- if (yydebug) \
- { \
- YYFPRINTF (stderr, "%s ", Title); \
- yy_symbol_print (stderr, \
- Type, Value); \
- YYFPRINTF (stderr, "\n"); \
- } \
-} while (YYID (0))
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_value_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_value_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
-{
- FILE *yyo = yyoutput;
- YYUSE (yyo);
- if (!yyvaluep)
- return;
-# ifdef YYPRINT
- if (yytype < YYNTOKENS)
- YYPRINT (yyoutput, yytoknum[yytype], *yyvaluep);
-# else
- YYUSE (yyoutput);
-# endif
- YYUSE (yytype);
-}
-
-
-/*--------------------------------.
-| Print this symbol on YYOUTPUT. |
-`--------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_symbol_print (FILE *yyoutput, int yytype, YYSTYPE const * const yyvaluep)
-#else
-static void
-yy_symbol_print (yyoutput, yytype, yyvaluep)
- FILE *yyoutput;
- int yytype;
- YYSTYPE const * const yyvaluep;
-#endif
-{
- if (yytype < YYNTOKENS)
- YYFPRINTF (yyoutput, "token %s (", yytname[yytype]);
- else
- YYFPRINTF (yyoutput, "nterm %s (", yytname[yytype]);
-
- yy_symbol_value_print (yyoutput, yytype, yyvaluep);
- YYFPRINTF (yyoutput, ")");
-}
-
-/*------------------------------------------------------------------.
-| yy_stack_print -- Print the state stack from its BOTTOM up to its |
-| TOP (included). |
-`------------------------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_stack_print (yytype_int16 *yybottom, yytype_int16 *yytop)
-#else
-static void
-yy_stack_print (yybottom, yytop)
- yytype_int16 *yybottom;
- yytype_int16 *yytop;
-#endif
-{
- YYFPRINTF (stderr, "Stack now");
- for (; yybottom <= yytop; yybottom++)
- {
- int yybot = *yybottom;
- YYFPRINTF (stderr, " %d", yybot);
- }
- YYFPRINTF (stderr, "\n");
-}
-
-# define YY_STACK_PRINT(Bottom, Top) \
-do { \
- if (yydebug) \
- yy_stack_print ((Bottom), (Top)); \
-} while (YYID (0))
-
-
-/*------------------------------------------------.
-| Report that the YYRULE is going to be reduced. |
-`------------------------------------------------*/
-
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yy_reduce_print (YYSTYPE *yyvsp, int yyrule)
-#else
-static void
-yy_reduce_print (yyvsp, yyrule)
- YYSTYPE *yyvsp;
- int yyrule;
-#endif
-{
- int yynrhs = yyr2[yyrule];
- int yyi;
- unsigned long int yylno = yyrline[yyrule];
- YYFPRINTF (stderr, "Reducing stack by rule %d (line %lu):\n",
- yyrule - 1, yylno);
- /* The symbols being reduced. */
- for (yyi = 0; yyi < yynrhs; yyi++)
- {
- YYFPRINTF (stderr, " $%d = ", yyi + 1);
- yy_symbol_print (stderr, yyrhs[yyprhs[yyrule] + yyi],
- &(yyvsp[(yyi + 1) - (yynrhs)])
- );
- YYFPRINTF (stderr, "\n");
- }
-}
-
-# define YY_REDUCE_PRINT(Rule) \
-do { \
- if (yydebug) \
- yy_reduce_print (yyvsp, Rule); \
-} while (YYID (0))
-
+} while (0)
/* Nonzero means print parse trace. It is left uninitialized so that
multiple parsers can coexist. */
int yydebug;
#else /* !YYDEBUG */
# define YYDPRINTF(Args)
-# define YY_SYMBOL_PRINT(Title, Type, Value, Location)
-# define YY_STACK_PRINT(Bottom, Top)
-# define YY_REDUCE_PRINT(Rule)
#endif /* !YYDEBUG */
-
/* YYINITDEPTH -- initial size of the parser's stacks. */
#ifndef YYINITDEPTH
# define YYINITDEPTH 200
@@ -1148,58 +703,86 @@ int yydebug;
if the built-in stack extension method is used).
Do not make this value too large; the results are undefined if
- YYSTACK_ALLOC_MAXIMUM < YYSTACK_BYTES (YYMAXDEPTH)
+ SIZE_MAX < YYSTACK_BYTES (YYMAXDEPTH)
evaluated with infinite-precision integer arithmetic. */
+#if YYMAXDEPTH == 0
+# undef YYMAXDEPTH
+#endif
+
#ifndef YYMAXDEPTH
# define YYMAXDEPTH 10000
#endif
+
+#if ! defined (yyoverflow) && ! defined (yymemcpy)
+# if __GNUC__ > 1 /* GNU C and GNU C++ define this. */
+# define yymemcpy __builtin_memcpy
+# else /* not GNU C or C++ */
+
+/* This is the most reliable way to avoid incompatibilities
+ in available built-in functions on various systems. */
+static void
+# if defined (__STDC__) || defined (__cplusplus)
+yymemcpy (char *yyto, const char *yyfrom, YYSIZE_T yycount)
+# else
+yymemcpy (yyto, yyfrom, yycount)
+ char *yyto;
+ const char *yyfrom;
+ YYSIZE_T yycount;
+# endif
+{
+ register const char *yyf = yyfrom;
+ register char *yyt = yyto;
+ register YYSIZE_T yyi = yycount;
+ while (yyi-- != 0)
+ *yyt++ = *yyf++;
+}
+# endif
+#endif
-#if YYERROR_VERBOSE
+#ifdef YYERROR_VERBOSE
# ifndef yystrlen
-# if defined __GLIBC__ && defined _STRING_H
+# if defined (__GLIBC__) && defined (_STRING_H)
# define yystrlen strlen
# else
/* Return the length of YYSTR. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static YYSIZE_T
+# if defined (__STDC__) || defined (__cplusplus)
yystrlen (const char *yystr)
-#else
-static YYSIZE_T
+# else
yystrlen (yystr)
- const char *yystr;
-#endif
+ const char *yystr;
+# endif
{
- YYSIZE_T yylen;
- for (yylen = 0; yystr[yylen]; yylen++)
+ register const char *yys = yystr;
+
+ while (*yys++ != '\0')
continue;
- return yylen;
+
+ return yys - yystr - 1;
}
# endif
# endif
# ifndef yystpcpy
-# if defined __GLIBC__ && defined _STRING_H && defined _GNU_SOURCE
+# if defined (__GLIBC__) && defined (_STRING_H) && defined (_GNU_SOURCE)
# define yystpcpy stpcpy
# else
/* Copy YYSRC to YYDEST, returning the address of the terminating '\0' in
YYDEST. */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
static char *
+# if defined (__STDC__) || defined (__cplusplus)
yystpcpy (char *yydest, const char *yysrc)
-#else
-static char *
+# else
yystpcpy (yydest, yysrc)
- char *yydest;
- const char *yysrc;
-#endif
+ char *yydest;
+ const char *yysrc;
+# endif
{
- char *yyd = yydest;
- const char *yys = yysrc;
+ register char *yyd = yydest;
+ register const char *yys = yysrc;
while ((*yyd++ = *yys++) != '\0')
continue;
@@ -1208,323 +791,149 @@ yystpcpy (yydest, yysrc)
}
# endif
# endif
+#endif
+
+#line 319 "/usr/share/bison/bison.simple"
-# ifndef yytnamerr
-/* Copy to YYRES the contents of YYSTR after stripping away unnecessary
- quotes and backslashes, so that it's suitable for yyerror. The
- heuristic is that double-quoting is unnecessary unless the string
- contains an apostrophe, a comma, or backslash (other than
- backslash-backslash). YYSTR is taken from yytname. If YYRES is
- null, do not copy; instead, return the length of what the result
- would have been. */
-static YYSIZE_T
-yytnamerr (char *yyres, const char *yystr)
-{
- if (*yystr == '"')
- {
- YYSIZE_T yyn = 0;
- char const *yyp = yystr;
- for (;;)
- switch (*++yyp)
- {
- case '\'':
- case ',':
- goto do_not_strip_quotes;
-
- case '\\':
- if (*++yyp != '\\')
- goto do_not_strip_quotes;
- /* Fall through. */
- default:
- if (yyres)
- yyres[yyn] = *yyp;
- yyn++;
- break;
-
- case '"':
- if (yyres)
- yyres[yyn] = '\0';
- return yyn;
- }
- do_not_strip_quotes: ;
- }
-
- if (! yyres)
- return yystrlen (yystr);
+/* The user can define YYPARSE_PARAM as the name of an argument to be passed
+ into yyparse. The argument should have type void *.
+ It should actually point to an object.
+ Grammar actions can access the variable by casting it
+ to the proper pointer type. */
- return yystpcpy (yyres, yystr) - yyres;
-}
+#ifdef YYPARSE_PARAM
+# if defined (__STDC__) || defined (__cplusplus)
+# define YYPARSE_PARAM_ARG void *YYPARSE_PARAM
+# define YYPARSE_PARAM_DECL
+# else
+# define YYPARSE_PARAM_ARG YYPARSE_PARAM
+# define YYPARSE_PARAM_DECL void *YYPARSE_PARAM;
# endif
+#else /* !YYPARSE_PARAM */
+# define YYPARSE_PARAM_ARG
+# define YYPARSE_PARAM_DECL
+#endif /* !YYPARSE_PARAM */
+
+/* Prevent warning if -Wstrict-prototypes. */
+#ifdef __GNUC__
+# ifdef YYPARSE_PARAM
+int yyparse (void *);
+# else
+int yyparse (void);
+# endif
+#endif
-/* Copy into *YYMSG, which is of size *YYMSG_ALLOC, an error message
- about the unexpected token YYTOKEN for the state stack whose top is
- YYSSP.
-
- Return 0 if *YYMSG was successfully written. Return 1 if *YYMSG is
- not large enough to hold the message. In that case, also set
- *YYMSG_ALLOC to the required number of bytes. Return 2 if the
- required number of bytes is too large to store. */
-static int
-yysyntax_error (YYSIZE_T *yymsg_alloc, char **yymsg,
- yytype_int16 *yyssp, int yytoken)
-{
- YYSIZE_T yysize0 = yytnamerr (YY_NULL, yytname[yytoken]);
- YYSIZE_T yysize = yysize0;
- enum { YYERROR_VERBOSE_ARGS_MAXIMUM = 5 };
- /* Internationalized format string. */
- const char *yyformat = YY_NULL;
- /* Arguments of yyformat. */
- char const *yyarg[YYERROR_VERBOSE_ARGS_MAXIMUM];
- /* Number of reported tokens (one for the "unexpected", one per
- "expected"). */
- int yycount = 0;
-
- /* There are many possibilities here to consider:
- - Assume YYFAIL is not used. It's too flawed to consider. See
- <http://lists.gnu.org/archive/html/bison-patches/2009-12/msg00024.html>
- for details. YYERROR is fine as it does not invoke this
- function.
- - If this state is a consistent state with a default action, then
- the only way this function was invoked is if the default action
- is an error action. In that case, don't check for expected
- tokens because there are none.
- - The only way there can be no lookahead present (in yychar) is if
- this state is a consistent state with a default action. Thus,
- detecting the absence of a lookahead is sufficient to determine
- that there is no unexpected or expected token to report. In that
- case, just report a simple "syntax error".
- - Don't assume there isn't a lookahead just because this state is a
- consistent state with a default action. There might have been a
- previous inconsistent state, consistent state with a non-default
- action, or user semantic action that manipulated yychar.
- - Of course, the expected token list depends on states to have
- correct lookahead information, and it depends on the parser not
- to perform extra reductions after fetching a lookahead from the
- scanner and before detecting a syntax error. Thus, state merging
- (from LALR or IELR) and default reductions corrupt the expected
- token list. However, the list is correct for canonical LR with
- one exception: it will still contain any token that will not be
- accepted due to an error action in a later state.
- */
- if (yytoken != YYEMPTY)
- {
- int yyn = yypact[*yyssp];
- yyarg[yycount++] = yytname[yytoken];
- if (!yypact_value_is_default (yyn))
- {
- /* Start YYX at -YYN if negative to avoid negative indexes in
- YYCHECK. In other words, skip the first -YYN actions for
- this state because they are default actions. */
- int yyxbegin = yyn < 0 ? -yyn : 0;
- /* Stay within bounds of both yycheck and yytname. */
- int yychecklim = YYLAST - yyn + 1;
- int yyxend = yychecklim < YYNTOKENS ? yychecklim : YYNTOKENS;
- int yyx;
-
- for (yyx = yyxbegin; yyx < yyxend; ++yyx)
- if (yycheck[yyx + yyn] == yyx && yyx != YYTERROR
- && !yytable_value_is_error (yytable[yyx + yyn]))
- {
- if (yycount == YYERROR_VERBOSE_ARGS_MAXIMUM)
- {
- yycount = 1;
- yysize = yysize0;
- break;
- }
- yyarg[yycount++] = yytname[yyx];
- {
- YYSIZE_T yysize1 = yysize + yytnamerr (YY_NULL, yytname[yyx]);
- if (! (yysize <= yysize1
- && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
- }
- }
- }
-
- switch (yycount)
- {
-# define YYCASE_(N, S) \
- case N: \
- yyformat = S; \
- break
- YYCASE_(0, YY_("syntax error"));
- YYCASE_(1, YY_("syntax error, unexpected %s"));
- YYCASE_(2, YY_("syntax error, unexpected %s, expecting %s"));
- YYCASE_(3, YY_("syntax error, unexpected %s, expecting %s or %s"));
- YYCASE_(4, YY_("syntax error, unexpected %s, expecting %s or %s or %s"));
- YYCASE_(5, YY_("syntax error, unexpected %s, expecting %s or %s or %s or %s"));
-# undef YYCASE_
- }
-
- {
- YYSIZE_T yysize1 = yysize + yystrlen (yyformat);
- if (! (yysize <= yysize1 && yysize1 <= YYSTACK_ALLOC_MAXIMUM))
- return 2;
- yysize = yysize1;
- }
-
- if (*yymsg_alloc < yysize)
- {
- *yymsg_alloc = 2 * yysize;
- if (! (yysize <= *yymsg_alloc
- && *yymsg_alloc <= YYSTACK_ALLOC_MAXIMUM))
- *yymsg_alloc = YYSTACK_ALLOC_MAXIMUM;
- return 1;
- }
-
- /* Avoid sprintf, as that infringes on the user's name space.
- Don't have undefined behavior even if the translation
- produced a string with the wrong number of "%s"s. */
- {
- char *yyp = *yymsg;
- int yyi = 0;
- while ((*yyp = *yyformat) != '\0')
- if (*yyp == '%' && yyformat[1] == 's' && yyi < yycount)
- {
- yyp += yytnamerr (yyp, yyarg[yyi++]);
- yyformat += 2;
- }
- else
- {
- yyp++;
- yyformat++;
- }
- }
- return 0;
-}
-#endif /* YYERROR_VERBOSE */
-
-/*-----------------------------------------------.
-| Release the memory associated to this symbol. |
-`-----------------------------------------------*/
+/* YY_DECL_VARIABLES -- depending whether we use a pure parser,
+ variables are global, or local to YYPARSE. */
+
+#define YY_DECL_NON_LSP_VARIABLES \
+/* The lookahead symbol. */ \
+int yychar; \
+ \
+/* The semantic value of the lookahead symbol. */ \
+YYSTYPE yylval; \
+ \
+/* Number of parse errors so far. */ \
+int yynerrs;
-/*ARGSUSED*/
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-static void
-yydestruct (const char *yymsg, int yytype, YYSTYPE *yyvaluep)
+#if YYLSP_NEEDED
+# define YY_DECL_VARIABLES \
+YY_DECL_NON_LSP_VARIABLES \
+ \
+/* Location data for the lookahead symbol. */ \
+YYLTYPE yylloc;
#else
-static void
-yydestruct (yymsg, yytype, yyvaluep)
- const char *yymsg;
- int yytype;
- YYSTYPE *yyvaluep;
+# define YY_DECL_VARIABLES \
+YY_DECL_NON_LSP_VARIABLES
#endif
-{
- YYUSE (yyvaluep);
-
- if (!yymsg)
- yymsg = "Deleting";
- YY_SYMBOL_PRINT (yymsg, yytype, yyvaluep, yylocationp);
-
- YYUSE (yytype);
-}
+/* If nonreentrant, generate the variables here. */
+#if !YYPURE
+YY_DECL_VARIABLES
+#endif /* !YYPURE */
-/* The lookahead symbol. */
-int yychar;
-
+int
+yyparse (YYPARSE_PARAM_ARG)
+ YYPARSE_PARAM_DECL
+{
+ /* If reentrant, generate the variables here. */
+#if YYPURE
+ YY_DECL_VARIABLES
+#endif /* !YYPURE */
-#ifndef YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
-# define YY_IGNORE_MAYBE_UNINITIALIZED_END
-#endif
-#ifndef YY_INITIAL_VALUE
-# define YY_INITIAL_VALUE(Value) /* Nothing. */
+ register int yystate;
+ register int yyn;
+ int yyresult;
+ /* Number of tokens to shift before error messages enabled. */
+ int yyerrstatus;
+ /* Lookahead token as an internal (translated) token number. */
+ int yychar1 = 0;
+
+ /* Three stacks and their tools:
+ `yyss': related to states,
+ `yyvs': related to semantic values,
+ `yyls': related to locations.
+
+ Refer to the stacks thru separate pointers, to allow yyoverflow
+ to reallocate them elsewhere. */
+
+ /* The state stack. */
+ short yyssa[YYINITDEPTH];
+ short *yyss = yyssa;
+ register short *yyssp;
+
+ /* The semantic value stack. */
+ YYSTYPE yyvsa[YYINITDEPTH];
+ YYSTYPE *yyvs = yyvsa;
+ register YYSTYPE *yyvsp;
+
+#if YYLSP_NEEDED
+ /* The location stack. */
+ YYLTYPE yylsa[YYINITDEPTH];
+ YYLTYPE *yyls = yylsa;
+ YYLTYPE *yylsp;
#endif
-/* The semantic value of the lookahead symbol. */
-YYSTYPE yylval YY_INITIAL_VALUE(yyval_default);
-
-/* Number of syntax errors so far. */
-int yynerrs;
-
-
-/*----------.
-| yyparse. |
-`----------*/
-
-#ifdef YYPARSE_PARAM
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void *YYPARSE_PARAM)
+#if YYLSP_NEEDED
+# define YYPOPSTACK (yyvsp--, yyssp--, yylsp--)
#else
-int
-yyparse (YYPARSE_PARAM)
- void *YYPARSE_PARAM;
+# define YYPOPSTACK (yyvsp--, yyssp--)
#endif
-#else /* ! YYPARSE_PARAM */
-#if (defined __STDC__ || defined __C99__FUNC__ \
- || defined __cplusplus || defined _MSC_VER)
-int
-yyparse (void)
-#else
-int
-yyparse ()
-
-#endif
-#endif
-{
- int yystate;
- /* Number of tokens to shift before error messages enabled. */
- int yyerrstatus;
- /* The stacks and their tools:
- `yyss': related to states.
- `yyvs': related to semantic values.
+ YYSIZE_T yystacksize = YYINITDEPTH;
- Refer to the stacks through separate pointers, to allow yyoverflow
- to reallocate them elsewhere. */
- /* The state stack. */
- yytype_int16 yyssa[YYINITDEPTH];
- yytype_int16 *yyss;
- yytype_int16 *yyssp;
-
- /* The semantic value stack. */
- YYSTYPE yyvsa[YYINITDEPTH];
- YYSTYPE *yyvs;
- YYSTYPE *yyvsp;
-
- YYSIZE_T yystacksize;
-
- int yyn;
- int yyresult;
- /* Lookahead token as an internal (translated) token number. */
- int yytoken = 0;
/* The variables used to return semantic value and location from the
action routines. */
YYSTYPE yyval;
-
-#if YYERROR_VERBOSE
- /* Buffer for error messages, and its allocated size. */
- char yymsgbuf[128];
- char *yymsg = yymsgbuf;
- YYSIZE_T yymsg_alloc = sizeof yymsgbuf;
+#if YYLSP_NEEDED
+ YYLTYPE yyloc;
#endif
-#define YYPOPSTACK(N) (yyvsp -= (N), yyssp -= (N))
-
- /* The number of symbols on the RHS of the reduced rule.
- Keep to zero when no symbol should be popped. */
- int yylen = 0;
-
- yyssp = yyss = yyssa;
- yyvsp = yyvs = yyvsa;
- yystacksize = YYINITDEPTH;
+ /* When reducing, the number of symbols on the RHS of the reduced
+ rule. */
+ int yylen;
YYDPRINTF ((stderr, "Starting parse\n"));
yystate = 0;
yyerrstatus = 0;
yynerrs = 0;
- yychar = YYEMPTY; /* Cause a token to be read. */
+ yychar = YYEMPTY; /* Cause a token to be read. */
+
+ /* Initialize stack pointers.
+ Waste one element of value and location stack
+ so that they stay on the same level as the state stack.
+ The wasted elements are never initialized. */
+
+ yyssp = yyss;
+ yyvsp = yyvs;
+#if YYLSP_NEEDED
+ yylsp = yyls;
+#endif
goto yysetstate;
/*------------------------------------------------------------.
@@ -1532,143 +941,191 @@ yyparse ()
`------------------------------------------------------------*/
yynewstate:
/* In all cases, when you get here, the value and location stacks
- have just been pushed. So pushing a state here evens the stacks. */
+ have just been pushed. so pushing a state here evens the stacks.
+ */
yyssp++;
yysetstate:
*yyssp = yystate;
- if (yyss + yystacksize - 1 <= yyssp)
+ if (yyssp >= yyss + yystacksize - 1)
{
/* Get the current used size of the three stacks, in elements. */
YYSIZE_T yysize = yyssp - yyss + 1;
#ifdef yyoverflow
{
- /* Give user a chance to reallocate the stack. Use copies of
+ /* Give user a chance to reallocate the stack. Use copies of
these so that the &'s don't force the real ones into
memory. */
YYSTYPE *yyvs1 = yyvs;
- yytype_int16 *yyss1 = yyss;
+ short *yyss1 = yyss;
/* Each stack pointer address is followed by the size of the
- data in use in that stack, in bytes. This used to be a
- conditional around just the two extra args, but that might
- be undefined if yyoverflow is a macro. */
- yyoverflow (YY_("memory exhausted"),
+ data in use in that stack, in bytes. */
+# if YYLSP_NEEDED
+ YYLTYPE *yyls1 = yyls;
+ /* This used to be a conditional around just the two extra args,
+ but that might be undefined if yyoverflow is a macro. */
+ yyoverflow ("parser stack overflow",
&yyss1, yysize * sizeof (*yyssp),
&yyvs1, yysize * sizeof (*yyvsp),
+ &yyls1, yysize * sizeof (*yylsp),
&yystacksize);
-
+ yyls = yyls1;
+# else
+ yyoverflow ("parser stack overflow",
+ &yyss1, yysize * sizeof (*yyssp),
+ &yyvs1, yysize * sizeof (*yyvsp),
+ &yystacksize);
+# endif
yyss = yyss1;
yyvs = yyvs1;
}
#else /* no yyoverflow */
-# ifndef YYSTACK_RELOCATE
- goto yyexhaustedlab;
-# else
/* Extend the stack our own way. */
- if (YYMAXDEPTH <= yystacksize)
- goto yyexhaustedlab;
+ if (yystacksize >= YYMAXDEPTH)
+ goto yyoverflowlab;
yystacksize *= 2;
- if (YYMAXDEPTH < yystacksize)
+ if (yystacksize > YYMAXDEPTH)
yystacksize = YYMAXDEPTH;
{
- yytype_int16 *yyss1 = yyss;
+ short *yyss1 = yyss;
union yyalloc *yyptr =
(union yyalloc *) YYSTACK_ALLOC (YYSTACK_BYTES (yystacksize));
if (! yyptr)
- goto yyexhaustedlab;
- YYSTACK_RELOCATE (yyss_alloc, yyss);
- YYSTACK_RELOCATE (yyvs_alloc, yyvs);
-# undef YYSTACK_RELOCATE
+ goto yyoverflowlab;
+ YYSTACK_RELOCATE (short, yyss);
+ YYSTACK_RELOCATE (YYSTYPE, yyvs);
+# if YYLSP_NEEDED
+ YYSTACK_RELOCATE (YYLTYPE, yyls);
+# endif
+# undef YYSTACK_RELOCATE
if (yyss1 != yyssa)
YYSTACK_FREE (yyss1);
}
-# endif
#endif /* no yyoverflow */
yyssp = yyss + yysize - 1;
yyvsp = yyvs + yysize - 1;
+#if YYLSP_NEEDED
+ yylsp = yyls + yysize - 1;
+#endif
YYDPRINTF ((stderr, "Stack size increased to %lu\n",
(unsigned long int) yystacksize));
- if (yyss + yystacksize - 1 <= yyssp)
+ if (yyssp >= yyss + yystacksize - 1)
YYABORT;
}
YYDPRINTF ((stderr, "Entering state %d\n", yystate));
- if (yystate == YYFINAL)
- YYACCEPT;
-
goto yybackup;
+
/*-----------.
| yybackup. |
`-----------*/
yybackup:
- /* Do appropriate processing given the current state. Read a
- lookahead token if we need one and don't already have one. */
+/* Do appropriate processing given the current state. */
+/* Read a lookahead token if we need one and don't already have one. */
+/* yyresume: */
/* First try to decide what to do without reference to lookahead token. */
+
yyn = yypact[yystate];
- if (yypact_value_is_default (yyn))
+ if (yyn == YYFLAG)
goto yydefault;
/* Not known => get a lookahead token if don't already have one. */
- /* YYCHAR is either YYEMPTY or YYEOF or a valid lookahead symbol. */
+ /* yychar is either YYEMPTY or YYEOF
+ or a valid token in external form. */
+
if (yychar == YYEMPTY)
{
YYDPRINTF ((stderr, "Reading a token: "));
yychar = YYLEX;
}
- if (yychar <= YYEOF)
+ /* Convert token to internal form (in yychar1) for indexing tables with */
+
+ if (yychar <= 0) /* This means end of input. */
{
- yychar = yytoken = YYEOF;
+ yychar1 = 0;
+ yychar = YYEOF; /* Don't call YYLEX any more */
+
YYDPRINTF ((stderr, "Now at end of input.\n"));
}
else
{
- yytoken = YYTRANSLATE (yychar);
- YY_SYMBOL_PRINT ("Next token is", yytoken, &yylval, &yylloc);
+ yychar1 = YYTRANSLATE (yychar);
+
+#if YYDEBUG
+ /* We have to keep this `#if YYDEBUG', since we use variables
+ which are defined only if `YYDEBUG' is set. */
+ if (yydebug)
+ {
+ YYFPRINTF (stderr, "Next token is %d (%s",
+ yychar, yytname[yychar1]);
+ /* Give the individual parser a way to print the precise
+ meaning of a token, for further debugging info. */
+# ifdef YYPRINT
+ YYPRINT (stderr, yychar, yylval);
+# endif
+ YYFPRINTF (stderr, ")\n");
+ }
+#endif
}
- /* If the proper action on seeing token YYTOKEN is to reduce or to
- detect an error, take that action. */
- yyn += yytoken;
- if (yyn < 0 || YYLAST < yyn || yycheck[yyn] != yytoken)
+ yyn += yychar1;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != yychar1)
goto yydefault;
+
yyn = yytable[yyn];
- if (yyn <= 0)
+
+ /* yyn is what to do for this token type in this state.
+ Negative => reduce, -yyn is rule number.
+ Positive => shift, yyn is new state.
+ New state is final state => don't bother to shift,
+ just return success.
+ 0, or most negative number => error. */
+
+ if (yyn < 0)
{
- if (yytable_value_is_error (yyn))
- goto yyerrlab;
+ if (yyn == YYFLAG)
+ goto yyerrlab;
yyn = -yyn;
goto yyreduce;
}
+ else if (yyn == 0)
+ goto yyerrlab;
- /* Count tokens shifted since error; after three, turn off error
- status. */
- if (yyerrstatus)
- yyerrstatus--;
+ if (yyn == YYFINAL)
+ YYACCEPT;
/* Shift the lookahead token. */
- YY_SYMBOL_PRINT ("Shifting", yytoken, &yylval, &yylloc);
+ YYDPRINTF ((stderr, "Shifting token %d (%s), ",
+ yychar, yytname[yychar1]));
- /* Discard the shifted token. */
- yychar = YYEMPTY;
+ /* Discard the token being shifted unless it is eof. */
+ if (yychar != YYEOF)
+ yychar = YYEMPTY;
- yystate = yyn;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
*++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+#if YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
+
+ /* Count tokens shifted since error; after three, turn off error
+ status. */
+ if (yyerrstatus)
+ yyerrstatus--;
+ yystate = yyn;
goto yynewstate;
@@ -1692,299 +1149,248 @@ yyreduce:
/* If YYLEN is nonzero, implement the default value of the action:
`$$ = $1'.
- Otherwise, the following line sets YYVAL to garbage.
- This behavior is undocumented and Bison
+ Otherwise, the following line sets YYVAL to the semantic value of
+ the lookahead token. This behavior is undocumented and Bison
users should not rely upon it. Assigning to YYVAL
unconditionally makes the parser a bit smaller, and it avoids a
GCC warning that YYVAL may be used uninitialized. */
yyval = yyvsp[1-yylen];
+#if YYLSP_NEEDED
+ /* Similarly for the default location. Let the user run additional
+ commands if for instance locations are ranges. */
+ yyloc = yylsp[1-yylen];
+ YYLLOC_DEFAULT (yyloc, (yylsp - yylen), yylen);
+#endif
- YY_REDUCE_PRINT (yyn);
- switch (yyn)
+#if YYDEBUG
+ /* We have to keep this `#if YYDEBUG', since we use variables which
+ are defined only if `YYDEBUG' is set. */
+ if (yydebug)
{
- case 6:
-/* Line 1787 of yacc.c */
-#line 173 "calc.y"
- { sp = stack[0]; yyerrok; }
- break;
+ int yyi;
- case 8:
-/* Line 1787 of yacc.c */
-#line 177 "calc.y"
- {
+ YYFPRINTF (stderr, "Reducing via rule %d (line %d), ",
+ yyn, yyrline[yyn]);
+
+ /* Print the symbols being reduced, and their result. */
+ for (yyi = yyprhs[yyn]; yyrhs[yyi] > 0; yyi++)
+ YYFPRINTF (stderr, "%s ", yytname[yyrhs[yyi]]);
+ YYFPRINTF (stderr, " -> %s\n", yytname[yyr1[yyn]]);
+ }
+#endif
+
+ switch (yyn) {
+
+case 5:
+#line 174 "calc.y"
+{ sp = stack[0]; yyerrok; }
+ break;
+case 7:
+#line 178 "calc.y"
+{
mpz_out_str (stdout, obase, sp); putchar ('\n');
sp--;
CHECK_EMPTY ();
}
break;
-
- case 9:
-/* Line 1787 of yacc.c */
-#line 182 "calc.y"
- {
- CHECK_VARIABLE ((yyvsp[(1) - (3)].var));
- mpz_swap (variable[(yyvsp[(1) - (3)].var)], sp);
+case 8:
+#line 183 "calc.y"
+{
+ CHECK_VARIABLE (yyvsp[-2].var);
+ mpz_swap (variable[yyvsp[-2].var], sp);
sp--;
CHECK_EMPTY ();
}
break;
-
- case 10:
-/* Line 1787 of yacc.c */
-#line 188 "calc.y"
- { calc_help (); }
- break;
-
- case 11:
-/* Line 1787 of yacc.c */
+case 9:
#line 189 "calc.y"
- { ibase = 16; obase = -16; }
+{ calc_help (); }
break;
-
- case 12:
-/* Line 1787 of yacc.c */
+case 10:
#line 190 "calc.y"
- { ibase = 0; obase = 10; }
+{ ibase = 16; obase = -16; }
break;
-
- case 13:
-/* Line 1787 of yacc.c */
+case 11:
#line 191 "calc.y"
- { exit (0); }
+{ ibase = 0; obase = 10; }
break;
-
- case 15:
-/* Line 1787 of yacc.c */
-#line 198 "calc.y"
- { sp--; mpz_add (sp, sp, sp+1); }
+case 12:
+#line 192 "calc.y"
+{ exit (0); }
break;
-
- case 16:
-/* Line 1787 of yacc.c */
+case 14:
#line 199 "calc.y"
- { sp--; mpz_sub (sp, sp, sp+1); }
+{ sp--; mpz_add (sp, sp, sp+1); }
break;
-
- case 17:
-/* Line 1787 of yacc.c */
+case 15:
#line 200 "calc.y"
- { sp--; mpz_mul (sp, sp, sp+1); }
+{ sp--; mpz_sub (sp, sp, sp+1); }
break;
-
- case 18:
-/* Line 1787 of yacc.c */
+case 16:
#line 201 "calc.y"
- { sp--; mpz_fdiv_q (sp, sp, sp+1); }
+{ sp--; mpz_mul (sp, sp, sp+1); }
break;
-
- case 19:
-/* Line 1787 of yacc.c */
+case 17:
#line 202 "calc.y"
- { sp--; mpz_fdiv_r (sp, sp, sp+1); }
+{ sp--; mpz_fdiv_q (sp, sp, sp+1); }
break;
-
- case 20:
-/* Line 1787 of yacc.c */
+case 18:
#line 203 "calc.y"
- { CHECK_UI ("Exponent", sp);
- sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }
+{ sp--; mpz_fdiv_r (sp, sp, sp+1); }
break;
-
- case 21:
-/* Line 1787 of yacc.c */
-#line 205 "calc.y"
- { CHECK_UI ("Shift count", sp);
- sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }
+case 19:
+#line 204 "calc.y"
+{ CHECK_UI ("Exponent", sp);
+ sp--; mpz_pow_ui (sp, sp, mpz_get_ui (sp+1)); }
break;
-
- case 22:
-/* Line 1787 of yacc.c */
-#line 207 "calc.y"
- { CHECK_UI ("Shift count", sp);
- sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }
+case 20:
+#line 206 "calc.y"
+{ CHECK_UI ("Shift count", sp);
+ sp--; mpz_mul_2exp (sp, sp, mpz_get_ui (sp+1)); }
break;
-
- case 23:
-/* Line 1787 of yacc.c */
-#line 209 "calc.y"
- { CHECK_UI ("Factorial", sp);
- mpz_fac_ui (sp, mpz_get_ui (sp)); }
+case 21:
+#line 208 "calc.y"
+{ CHECK_UI ("Shift count", sp);
+ sp--; mpz_fdiv_q_2exp (sp, sp, mpz_get_ui (sp+1)); }
break;
-
- case 24:
-/* Line 1787 of yacc.c */
-#line 211 "calc.y"
- { mpz_neg (sp, sp); }
+case 22:
+#line 210 "calc.y"
+{ CHECK_UI ("Factorial", sp);
+ mpz_fac_ui (sp, mpz_get_ui (sp)); }
break;
-
- case 25:
-/* Line 1787 of yacc.c */
-#line 213 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) < 0); }
+case 23:
+#line 212 "calc.y"
+{ mpz_neg (sp, sp); }
break;
-
- case 26:
-/* Line 1787 of yacc.c */
+case 24:
#line 214 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }
+{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) < 0); }
break;
-
- case 27:
-/* Line 1787 of yacc.c */
+case 25:
#line 215 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }
+{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) <= 0); }
break;
-
- case 28:
-/* Line 1787 of yacc.c */
+case 26:
#line 216 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }
+{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) == 0); }
break;
-
- case 29:
-/* Line 1787 of yacc.c */
+case 27:
#line 217 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }
+{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) != 0); }
break;
-
- case 30:
-/* Line 1787 of yacc.c */
+case 28:
#line 218 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) > 0); }
+{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) >= 0); }
break;
-
- case 31:
-/* Line 1787 of yacc.c */
-#line 220 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }
+case 29:
+#line 219 "calc.y"
+{ sp--; mpz_set_ui (sp, mpz_cmp (sp, sp+1) > 0); }
break;
-
- case 32:
-/* Line 1787 of yacc.c */
+case 30:
#line 221 "calc.y"
- { sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }
+{ sp--; mpz_set_ui (sp, mpz_sgn (sp) && mpz_sgn (sp+1)); }
break;
-
- case 33:
-/* Line 1787 of yacc.c */
-#line 223 "calc.y"
- { mpz_abs (sp, sp); }
+case 31:
+#line 222 "calc.y"
+{ sp--; mpz_set_ui (sp, mpz_sgn (sp) || mpz_sgn (sp+1)); }
break;
-
- case 34:
-/* Line 1787 of yacc.c */
+case 32:
#line 224 "calc.y"
- { sp--; CHECK_UI ("Binomial base", sp+1);
- mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }
+{ mpz_abs (sp, sp); }
break;
-
- case 35:
-/* Line 1787 of yacc.c */
-#line 226 "calc.y"
- { CHECK_UI ("Fibonacci", sp);
- mpz_fib_ui (sp, mpz_get_ui (sp)); }
+case 33:
+#line 225 "calc.y"
+{ sp--; CHECK_UI ("Binomial base", sp+1);
+ mpz_bin_ui (sp, sp, mpz_get_ui (sp+1)); }
break;
-
- case 37:
-/* Line 1787 of yacc.c */
-#line 229 "calc.y"
- { sp--; mpz_set_si (sp,
- mpz_kronecker (sp, sp+1)); }
+case 34:
+#line 227 "calc.y"
+{ CHECK_UI ("Fibonacci", sp);
+ mpz_fib_ui (sp, mpz_get_ui (sp)); }
break;
-
- case 39:
-/* Line 1787 of yacc.c */
-#line 232 "calc.y"
- { CHECK_UI ("Lucas number", sp);
- mpz_lucnum_ui (sp, mpz_get_ui (sp)); }
+case 36:
+#line 230 "calc.y"
+{ sp--; mpz_set_si (sp,
+ mpz_kronecker (sp, sp+1)); }
break;
-
- case 40:
-/* Line 1787 of yacc.c */
-#line 234 "calc.y"
- { mpz_nextprime (sp, sp); }
+case 38:
+#line 233 "calc.y"
+{ CHECK_UI ("Lucas number", sp);
+ mpz_lucnum_ui (sp, mpz_get_ui (sp)); }
break;
-
- case 41:
-/* Line 1787 of yacc.c */
+case 39:
#line 235 "calc.y"
- { sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }
+{ mpz_nextprime (sp, sp); }
break;
-
- case 42:
-/* Line 1787 of yacc.c */
+case 40:
#line 236 "calc.y"
- { sp--; CHECK_UI ("Nth-root", sp+1);
- mpz_root (sp, sp, mpz_get_ui (sp+1)); }
+{ sp -= 2; mpz_powm (sp, sp, sp+1, sp+2); }
break;
-
- case 43:
-/* Line 1787 of yacc.c */
-#line 238 "calc.y"
- { mpz_sqrt (sp, sp); }
+case 41:
+#line 237 "calc.y"
+{ sp--; CHECK_UI ("Nth-root", sp+1);
+ mpz_root (sp, sp, mpz_get_ui (sp+1)); }
break;
-
- case 44:
-/* Line 1787 of yacc.c */
-#line 240 "calc.y"
- {
- sp++;
- CHECK_OVERFLOW ();
- CHECK_VARIABLE ((yyvsp[(1) - (1)].var));
- mpz_set (sp, variable[(yyvsp[(1) - (1)].var)]);
+case 42:
+#line 239 "calc.y"
+{ mpz_sqrt (sp, sp); }
+ break;
+case 43:
+#line 241 "calc.y"
+{
+ sp++;
+ CHECK_OVERFLOW ();
+ CHECK_VARIABLE (yyvsp[0].var);
+ mpz_set (sp, variable[yyvsp[0].var]);
}
break;
-
- case 45:
-/* Line 1787 of yacc.c */
-#line 246 "calc.y"
- {
- sp++;
- CHECK_OVERFLOW ();
- if (mpz_set_str (sp, (yyvsp[(1) - (1)].str), ibase) != 0)
- {
- fprintf (stderr, "Invalid number: %s\n", (yyvsp[(1) - (1)].str));
- YYERROR;
- }
+case 44:
+#line 247 "calc.y"
+{
+ sp++;
+ CHECK_OVERFLOW ();
+ if (mpz_set_str (sp, yyvsp[0].str, ibase) != 0)
+ {
+ fprintf (stderr, "Invalid number: %s\n", yyvsp[0].str);
+ YYERROR;
+ }
}
break;
-
- case 47:
-/* Line 1787 of yacc.c */
-#line 258 "calc.y"
- { sp--; mpz_gcd (sp, sp, sp+1); }
+case 46:
+#line 259 "calc.y"
+{ sp--; mpz_gcd (sp, sp, sp+1); }
break;
-
- case 49:
-/* Line 1787 of yacc.c */
-#line 262 "calc.y"
- { sp--; mpz_lcm (sp, sp, sp+1); }
+case 48:
+#line 263 "calc.y"
+{ sp--; mpz_lcm (sp, sp, sp+1); }
break;
+}
+#line 705 "/usr/share/bison/bison.simple"
-/* Line 1787 of yacc.c */
-#line 1968 "calc.c"
- default: break;
+
+ yyvsp -= yylen;
+ yyssp -= yylen;
+#if YYLSP_NEEDED
+ yylsp -= yylen;
+#endif
+
+#if YYDEBUG
+ if (yydebug)
+ {
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
}
- /* User semantic actions sometimes alter yychar, and that requires
- that yytoken be updated with the new translation. We take the
- approach of translating immediately before every use of yytoken.
- One alternative is translating here after every semantic action,
- but that translation would be missed if the semantic action invokes
- YYABORT, YYACCEPT, or YYERROR immediately after altering yychar or
- if it invokes YYBACKUP. In the case of YYABORT or YYACCEPT, an
- incorrect destructor might then be invoked immediately. In the
- case of YYERROR or YYBACKUP, subsequent parser actions might lead
- to an incorrect destructor call or verbose syntax error message
- before the lookahead is translated. */
- YY_SYMBOL_PRINT ("-> $$ =", yyr1[yyn], &yyval, &yyloc);
-
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
+#endif
*++yyvsp = yyval;
+#if YYLSP_NEEDED
+ *++yylsp = yyloc;
+#endif
/* Now `shift' the result of the reduction. Determine what state
that goes to, based on the state we popped back to and the rule
@@ -1992,11 +1398,11 @@ yyreduce:
yyn = yyr1[yyn];
- yystate = yypgoto[yyn - YYNTOKENS] + *yyssp;
- if (0 <= yystate && yystate <= YYLAST && yycheck[yystate] == *yyssp)
+ yystate = yypgoto[yyn - YYNTBASE] + *yyssp;
+ if (yystate >= 0 && yystate <= YYLAST && yycheck[yystate] == *yyssp)
yystate = yytable[yystate];
else
- yystate = yydefgoto[yyn - YYNTOKENS];
+ yystate = yydefgoto[yyn - YYNTBASE];
goto yynewstate;
@@ -2005,135 +1411,159 @@ yyreduce:
| yyerrlab -- here on detecting error |
`------------------------------------*/
yyerrlab:
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = yychar == YYEMPTY ? YYEMPTY : YYTRANSLATE (yychar);
-
/* If not already recovering from an error, report this error. */
if (!yyerrstatus)
{
++yynerrs;
-#if ! YYERROR_VERBOSE
- yyerror (YY_("syntax error"));
-#else
-# define YYSYNTAX_ERROR yysyntax_error (&yymsg_alloc, &yymsg, \
- yyssp, yytoken)
- {
- char const *yymsgp = YY_("syntax error");
- int yysyntax_error_status;
- yysyntax_error_status = YYSYNTAX_ERROR;
- if (yysyntax_error_status == 0)
- yymsgp = yymsg;
- else if (yysyntax_error_status == 1)
- {
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
- yymsg = (char *) YYSTACK_ALLOC (yymsg_alloc);
- if (!yymsg)
- {
- yymsg = yymsgbuf;
- yymsg_alloc = sizeof yymsgbuf;
- yysyntax_error_status = 2;
- }
- else
- {
- yysyntax_error_status = YYSYNTAX_ERROR;
- yymsgp = yymsg;
- }
- }
- yyerror (yymsgp);
- if (yysyntax_error_status == 2)
- goto yyexhaustedlab;
- }
-# undef YYSYNTAX_ERROR
-#endif
- }
+#ifdef YYERROR_VERBOSE
+ yyn = yypact[yystate];
+
+ if (yyn > YYFLAG && yyn < YYLAST)
+ {
+ YYSIZE_T yysize = 0;
+ char *yymsg;
+ int yyx, yycount;
+
+ yycount = 0;
+ /* Start YYX at -YYN if negative to avoid negative indexes in
+ YYCHECK. */
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *)); yyx++)
+ if (yycheck[yyx + yyn] == yyx)
+ yysize += yystrlen (yytname[yyx]) + 15, yycount++;
+ yysize += yystrlen ("parse error, unexpected ") + 1;
+ yysize += yystrlen (yytname[YYTRANSLATE (yychar)]);
+ yymsg = (char *) YYSTACK_ALLOC (yysize);
+ if (yymsg != 0)
+ {
+ char *yyp = yystpcpy (yymsg, "parse error, unexpected ");
+ yyp = yystpcpy (yyp, yytname[YYTRANSLATE (yychar)]);
+
+ if (yycount < 5)
+ {
+ yycount = 0;
+ for (yyx = yyn < 0 ? -yyn : 0;
+ yyx < (int) (sizeof (yytname) / sizeof (char *));
+ yyx++)
+ if (yycheck[yyx + yyn] == yyx)
+ {
+ const char *yyq = ! yycount ? ", expecting " : " or ";
+ yyp = yystpcpy (yyp, yyq);
+ yyp = yystpcpy (yyp, yytname[yyx]);
+ yycount++;
+ }
+ }
+ yyerror (yymsg);
+ YYSTACK_FREE (yymsg);
+ }
+ else
+ yyerror ("parse error; also virtual memory exhausted");
+ }
+ else
+#endif /* defined (YYERROR_VERBOSE) */
+ yyerror ("parse error");
+ }
+ goto yyerrlab1;
+/*--------------------------------------------------.
+| yyerrlab1 -- error raised explicitly by an action |
+`--------------------------------------------------*/
+yyerrlab1:
if (yyerrstatus == 3)
{
/* If just tried and failed to reuse lookahead token after an
error, discard it. */
- if (yychar <= YYEOF)
- {
- /* Return failure if at end of input. */
- if (yychar == YYEOF)
- YYABORT;
- }
- else
- {
- yydestruct ("Error: discarding",
- yytoken, &yylval);
- yychar = YYEMPTY;
- }
+ /* return failure if at end of input */
+ if (yychar == YYEOF)
+ YYABORT;
+ YYDPRINTF ((stderr, "Discarding token %d (%s).\n",
+ yychar, yytname[yychar1]));
+ yychar = YYEMPTY;
}
/* Else will try to reuse lookahead token after shifting the error
token. */
- goto yyerrlab1;
+ yyerrstatus = 3; /* Each real token shifted decrements this */
-/*---------------------------------------------------.
-| yyerrorlab -- error raised explicitly by YYERROR. |
-`---------------------------------------------------*/
-yyerrorlab:
+ goto yyerrhandle;
- /* Pacify compilers like GCC when the user code never invokes
- YYERROR and the label yyerrorlab therefore never appears in user
- code. */
- if (/*CONSTCOND*/ 0)
- goto yyerrorlab;
- /* Do not reclaim the symbols of the rule which action triggered
- this YYERROR. */
- YYPOPSTACK (yylen);
- yylen = 0;
- YY_STACK_PRINT (yyss, yyssp);
- yystate = *yyssp;
- goto yyerrlab1;
+/*-------------------------------------------------------------------.
+| yyerrdefault -- current state does not do anything special for the |
+| error token. |
+`-------------------------------------------------------------------*/
+yyerrdefault:
+#if 0
+ /* This is wrong; only states that explicitly want error tokens
+ should shift them. */
+
+ /* If its default is to accept any token, ok. Otherwise pop it. */
+ yyn = yydefact[yystate];
+ if (yyn)
+ goto yydefault;
+#endif
-/*-------------------------------------------------------------.
-| yyerrlab1 -- common code for both syntax error and YYERROR. |
-`-------------------------------------------------------------*/
-yyerrlab1:
- yyerrstatus = 3; /* Each real token shifted decrements this. */
+/*---------------------------------------------------------------.
+| yyerrpop -- pop the current state because it cannot handle the |
+| error token |
+`---------------------------------------------------------------*/
+yyerrpop:
+ if (yyssp == yyss)
+ YYABORT;
+ yyvsp--;
+ yystate = *--yyssp;
+#if YYLSP_NEEDED
+ yylsp--;
+#endif
- for (;;)
+#if YYDEBUG
+ if (yydebug)
{
- yyn = yypact[yystate];
- if (!yypact_value_is_default (yyn))
- {
- yyn += YYTERROR;
- if (0 <= yyn && yyn <= YYLAST && yycheck[yyn] == YYTERROR)
- {
- yyn = yytable[yyn];
- if (0 < yyn)
- break;
- }
- }
+ short *yyssp1 = yyss - 1;
+ YYFPRINTF (stderr, "Error: state stack now");
+ while (yyssp1 != yyssp)
+ YYFPRINTF (stderr, " %d", *++yyssp1);
+ YYFPRINTF (stderr, "\n");
+ }
+#endif
- /* Pop the current state because it cannot handle the error token. */
- if (yyssp == yyss)
- YYABORT;
+/*--------------.
+| yyerrhandle. |
+`--------------*/
+yyerrhandle:
+ yyn = yypact[yystate];
+ if (yyn == YYFLAG)
+ goto yyerrdefault;
+ yyn += YYTERROR;
+ if (yyn < 0 || yyn > YYLAST || yycheck[yyn] != YYTERROR)
+ goto yyerrdefault;
- yydestruct ("Error: popping",
- yystos[yystate], yyvsp);
- YYPOPSTACK (1);
- yystate = *yyssp;
- YY_STACK_PRINT (yyss, yyssp);
+ yyn = yytable[yyn];
+ if (yyn < 0)
+ {
+ if (yyn == YYFLAG)
+ goto yyerrpop;
+ yyn = -yyn;
+ goto yyreduce;
}
+ else if (yyn == 0)
+ goto yyerrpop;
- YY_IGNORE_MAYBE_UNINITIALIZED_BEGIN
- *++yyvsp = yylval;
- YY_IGNORE_MAYBE_UNINITIALIZED_END
+ if (yyn == YYFINAL)
+ YYACCEPT;
+ YYDPRINTF ((stderr, "Shifting error token, "));
- /* Shift the error token. */
- YY_SYMBOL_PRINT ("Shifting", yystos[yyn], yyvsp, yylsp);
+ *++yyvsp = yylval;
+#if YYLSP_NEEDED
+ *++yylsp = yylloc;
+#endif
yystate = yyn;
goto yynewstate;
@@ -2153,50 +1583,22 @@ yyabortlab:
yyresult = 1;
goto yyreturn;
-#if !defined yyoverflow || YYERROR_VERBOSE
-/*-------------------------------------------------.
-| yyexhaustedlab -- memory exhaustion comes here. |
-`-------------------------------------------------*/
-yyexhaustedlab:
- yyerror (YY_("memory exhausted"));
+/*---------------------------------------------.
+| yyoverflowab -- parser overflow comes here. |
+`---------------------------------------------*/
+yyoverflowlab:
+ yyerror ("parser stack overflow");
yyresult = 2;
/* Fall through. */
-#endif
yyreturn:
- if (yychar != YYEMPTY)
- {
- /* Make sure we have latest lookahead translation. See comments at
- user semantic actions for why this is necessary. */
- yytoken = YYTRANSLATE (yychar);
- yydestruct ("Cleanup: discarding lookahead",
- yytoken, &yylval);
- }
- /* Do not reclaim the symbols of the rule which action triggered
- this YYABORT or YYACCEPT. */
- YYPOPSTACK (yylen);
- YY_STACK_PRINT (yyss, yyssp);
- while (yyssp != yyss)
- {
- yydestruct ("Cleanup: popping",
- yystos[*yyssp], yyvsp);
- YYPOPSTACK (1);
- }
#ifndef yyoverflow
if (yyss != yyssa)
YYSTACK_FREE (yyss);
#endif
-#if YYERROR_VERBOSE
- if (yymsg != yymsgbuf)
- YYSTACK_FREE (yymsg);
-#endif
- /* Make sure YYID is used. */
- return YYID (yyresult);
+ return yyresult;
}
-
-
-/* Line 2050 of yacc.c */
-#line 264 "calc.y"
+#line 265 "calc.y"
yyerror (char *s)
@@ -2214,24 +1616,24 @@ main (int argc, char *argv[])
for (i = 1; i < argc; i++)
{
if (strcmp (argv[i], "--readline") == 0)
- calc_option_readline = 1;
+ calc_option_readline = 1;
else if (strcmp (argv[i], "--noreadline") == 0)
- calc_option_readline = 0;
+ calc_option_readline = 0;
else if (strcmp (argv[i], "--help") == 0)
- {
- printf ("Usage: calc [--option]...\n");
- printf (" --readline use readline\n");
- printf (" --noreadline don't use readline\n");
- printf (" --help this message\n");
- printf ("Readline is only available when compiled in,\n");
- printf ("and in that case it's the default on a tty.\n");
- exit (0);
- }
+ {
+ printf ("Usage: calc [--option]...\n");
+ printf (" --readline use readline\n");
+ printf (" --noreadline don't use readline\n");
+ printf (" --help this message\n");
+ printf ("Readline is only available when compiled in,\n");
+ printf ("and in that case it's the default on a tty.\n");
+ exit (0);
+ }
else
- {
- fprintf (stderr, "Unrecognised option: %s\n", argv[i]);
- exit (1);
- }
+ {
+ fprintf (stderr, "Unrecognised option: %s\n", argv[i]);
+ exit (1);
+ }
}
#if WITH_READLINE
diff --git a/gmp/demos/calc/calc.h b/gmp/demos/calc/calc.h
index 78e0195d24..448cc425c5 100644
--- a/gmp/demos/calc/calc.h
+++ b/gmp/demos/calc/calc.h
@@ -1,145 +1,43 @@
-/* A Bison parser, made by GNU Bison 2.7.12-4996. */
-
-/* Bison interface for Yacc-like parsers in C
-
- Copyright (C) 1984, 1989-1990, 2000-2013 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 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 <http://www.gnu.org/licenses/>. */
-
-/* As a special exception, you may create a larger work that contains
- part or all of the Bison parser skeleton and distribute that work
- under terms of your choice, so long as that work isn't itself a
- parser generator using the skeleton or a modified version thereof
- as a parser skeleton. Alternatively, if you modify or redistribute
- the parser skeleton itself, you may (at your option) remove this
- special exception, which will cause the skeleton and the resulting
- Bison output files to be licensed under the GNU General Public
- License without this special exception.
-
- This special exception was added by the Free Software Foundation in
- version 2.2 of Bison. */
-
-#ifndef YY_YY_CALC_H_INCLUDED
-# define YY_YY_CALC_H_INCLUDED
-/* Enabling traces. */
-#ifndef YYDEBUG
-# define YYDEBUG 0
-#endif
-#if YYDEBUG
-extern int yydebug;
-#endif
-
-/* Tokens. */
-#ifndef YYTOKENTYPE
-# define YYTOKENTYPE
- /* Put the tokens into the symbol table, so that GDB and other debuggers
- know about them. */
- enum yytokentype {
- EOS = 258,
- BAD = 259,
- HELP = 260,
- HEX = 261,
- DECIMAL = 262,
- QUIT = 263,
- ABS = 264,
- BIN = 265,
- FIB = 266,
- GCD = 267,
- KRON = 268,
- LCM = 269,
- LUCNUM = 270,
- NEXTPRIME = 271,
- POWM = 272,
- ROOT = 273,
- SQRT = 274,
- NUMBER = 275,
- VARIABLE = 276,
- LOR = 277,
- LAND = 278,
- GE = 279,
- LE = 280,
- NE = 281,
- EQ = 282,
- RSHIFT = 283,
- LSHIFT = 284,
- UMINUS = 285
- };
-#endif
-/* Tokens. */
-#define EOS 258
-#define BAD 259
-#define HELP 260
-#define HEX 261
-#define DECIMAL 262
-#define QUIT 263
-#define ABS 264
-#define BIN 265
-#define FIB 266
-#define GCD 267
-#define KRON 268
-#define LCM 269
-#define LUCNUM 270
-#define NEXTPRIME 271
-#define POWM 272
-#define ROOT 273
-#define SQRT 274
-#define NUMBER 275
-#define VARIABLE 276
-#define LOR 277
-#define LAND 278
-#define GE 279
-#define LE 280
-#define NE 281
-#define EQ 282
-#define RSHIFT 283
-#define LSHIFT 284
-#define UMINUS 285
-
-
-
-#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
-typedef union YYSTYPE
-{
-/* Line 2053 of yacc.c */
-#line 142 "calc.y"
+#ifndef BISON_CALC_H
+# define BISON_CALC_H
+#ifndef YYSTYPE
+typedef union {
char *str;
int var;
-
-
-/* Line 2053 of yacc.c */
-#line 123 "calc.h"
-} YYSTYPE;
-# define YYSTYPE_IS_TRIVIAL 1
-# define yystype YYSTYPE /* obsolescent; will be withdrawn */
-# define YYSTYPE_IS_DECLARED 1
+} yystype;
+# define YYSTYPE yystype
#endif
+# define EOS 257
+# define BAD 258
+# define HELP 259
+# define HEX 260
+# define DECIMAL 261
+# define QUIT 262
+# define ABS 263
+# define BIN 264
+# define FIB 265
+# define GCD 266
+# define KRON 267
+# define LCM 268
+# define LUCNUM 269
+# define NEXTPRIME 270
+# define POWM 271
+# define ROOT 272
+# define SQRT 273
+# define NUMBER 274
+# define VARIABLE 275
+# define LOR 276
+# define LAND 277
+# define EQ 278
+# define NE 279
+# define LE 280
+# define GE 281
+# define LSHIFT 282
+# define RSHIFT 283
+# define UMINUS 284
-extern YYSTYPE yylval;
-#ifdef YYPARSE_PARAM
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void *YYPARSE_PARAM);
-#else
-int yyparse ();
-#endif
-#else /* ! YYPARSE_PARAM */
-#if defined __STDC__ || defined __cplusplus
-int yyparse (void);
-#else
-int yyparse ();
-#endif
-#endif /* ! YYPARSE_PARAM */
+extern YYSTYPE yylval;
-#endif /* !YY_YY_CALC_H_INCLUDED */
+#endif /* not BISON_CALC_H */
diff --git a/gmp/demos/calc/calc.y b/gmp/demos/calc/calc.y
index 0fa1206f79..0f9b1baad6 100644
--- a/gmp/demos/calc/calc.y
+++ b/gmp/demos/calc/calc.y
@@ -1,7 +1,7 @@
%{
/* A simple integer desk calculator using yacc and gmp.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000, 2001, 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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
/* This is a simple program, meant only to show one way to use GMP for this
diff --git a/gmp/demos/calc/calclex.c b/gmp/demos/calc/calclex.c
index bf65cba425..ebd1f0a1a5 100644
--- a/gmp/demos/calc/calclex.c
+++ b/gmp/demos/calc/calclex.c
@@ -1,113 +1,70 @@
-
-#line 3 "calclex.c"
-
-#define YY_INT_ALIGNED short int
-
+#line 2 "calclex.c"
/* A lexical scanner generated by flex */
+/* Scanner skeleton version:
+ * $Header$
+ */
+
#define FLEX_SCANNER
#define YY_FLEX_MAJOR_VERSION 2
#define YY_FLEX_MINOR_VERSION 5
-#define YY_FLEX_SUBMINOR_VERSION 37
-#if YY_FLEX_SUBMINOR_VERSION > 0
-#define FLEX_BETA
-#endif
-
-/* First, we deal with platform-specific or compiler-specific issues. */
-/* begin standard C headers. */
#include <stdio.h>
-#include <string.h>
#include <errno.h>
-#include <stdlib.h>
-
-/* end standard C headers. */
-
-/* flex integer type definitions */
-
-#ifndef FLEXINT_H
-#define FLEXINT_H
-
-/* C99 systems have <inttypes.h>. Non-C99 systems may or may not. */
-
-#if defined (__STDC_VERSION__) && __STDC_VERSION__ >= 199901L
-/* C99 says to define __STDC_LIMIT_MACROS before including stdint.h,
- * if you want the limit (max/min) macros for int types.
- */
-#ifndef __STDC_LIMIT_MACROS
-#define __STDC_LIMIT_MACROS 1
-#endif
-
-#include <inttypes.h>
-typedef int8_t flex_int8_t;
-typedef uint8_t flex_uint8_t;
-typedef int16_t flex_int16_t;
-typedef uint16_t flex_uint16_t;
-typedef int32_t flex_int32_t;
-typedef uint32_t flex_uint32_t;
-#else
-typedef signed char flex_int8_t;
-typedef short int flex_int16_t;
-typedef int flex_int32_t;
-typedef unsigned char flex_uint8_t;
-typedef unsigned short int flex_uint16_t;
-typedef unsigned int flex_uint32_t;
-
-/* Limits of integral types. */
-#ifndef INT8_MIN
-#define INT8_MIN (-128)
-#endif
-#ifndef INT16_MIN
-#define INT16_MIN (-32767-1)
-#endif
-#ifndef INT32_MIN
-#define INT32_MIN (-2147483647-1)
+/* cfront 1.2 defines "c_plusplus" instead of "__cplusplus" */
+#ifdef c_plusplus
+#ifndef __cplusplus
+#define __cplusplus
#endif
-#ifndef INT8_MAX
-#define INT8_MAX (127)
#endif
-#ifndef INT16_MAX
-#define INT16_MAX (32767)
-#endif
-#ifndef INT32_MAX
-#define INT32_MAX (2147483647)
-#endif
-#ifndef UINT8_MAX
-#define UINT8_MAX (255U)
-#endif
-#ifndef UINT16_MAX
-#define UINT16_MAX (65535U)
-#endif
-#ifndef UINT32_MAX
-#define UINT32_MAX (4294967295U)
-#endif
-
-#endif /* ! C99 */
-#endif /* ! FLEXINT_H */
#ifdef __cplusplus
+#include <stdlib.h>
+#ifndef _WIN32
+#include <unistd.h>
+#endif
+
+/* Use prototypes in function declarations. */
+#define YY_USE_PROTOS
+
/* The "const" storage-class-modifier is valid. */
#define YY_USE_CONST
#else /* ! __cplusplus */
-/* C99 requires __STDC__ to be defined as 1. */
-#if defined (__STDC__)
+#if __STDC__
+#define YY_USE_PROTOS
#define YY_USE_CONST
-#endif /* defined (__STDC__) */
+#endif /* __STDC__ */
#endif /* ! __cplusplus */
+#ifdef __TURBOC__
+ #pragma warn -rch
+ #pragma warn -use
+#include <io.h>
+#include <stdlib.h>
+#define YY_USE_CONST
+#define YY_USE_PROTOS
+#endif
+
#ifdef YY_USE_CONST
#define yyconst const
#else
#define yyconst
#endif
+
+#ifdef YY_USE_PROTOS
+#define YY_PROTO(proto) proto
+#else
+#define YY_PROTO(proto) ()
+#endif
+
/* Returned upon end-of-file. */
#define YY_NULL 0
@@ -122,70 +79,71 @@ typedef unsigned int flex_uint32_t;
* but we do it the disgusting crufty way forced on us by the ()-less
* definition of BEGIN.
*/
-#define BEGIN (yy_start) = 1 + 2 *
+#define BEGIN yy_start = 1 + 2 *
/* Translate the current start state into a value that can be later handed
* to BEGIN to return to the state. The YYSTATE alias is for lex
* compatibility.
*/
-#define YY_START (((yy_start) - 1) / 2)
+#define YY_START ((yy_start - 1) / 2)
#define YYSTATE YY_START
/* Action number for EOF rule of a given start state. */
#define YY_STATE_EOF(state) (YY_END_OF_BUFFER + state + 1)
/* Special action meaning "start processing a new file". */
-#define YY_NEW_FILE yyrestart(yyin )
+#define YY_NEW_FILE yyrestart( yyin )
#define YY_END_OF_BUFFER_CHAR 0
/* Size of default input buffer. */
-#ifndef YY_BUF_SIZE
#define YY_BUF_SIZE 16384
-#endif
-/* The state buf must be large enough to hold one state per character in the main buffer.
- */
-#define YY_STATE_BUF_SIZE ((YY_BUF_SIZE + 2) * sizeof(yy_state_type))
-
-#ifndef YY_TYPEDEF_YY_BUFFER_STATE
-#define YY_TYPEDEF_YY_BUFFER_STATE
typedef struct yy_buffer_state *YY_BUFFER_STATE;
-#endif
-
-#ifndef YY_TYPEDEF_YY_SIZE_T
-#define YY_TYPEDEF_YY_SIZE_T
-typedef size_t yy_size_t;
-#endif
-
-extern yy_size_t yyleng;
+extern int yyleng;
extern FILE *yyin, *yyout;
#define EOB_ACT_CONTINUE_SCAN 0
#define EOB_ACT_END_OF_FILE 1
#define EOB_ACT_LAST_MATCH 2
- #define YY_LESS_LINENO(n)
-
-/* Return all but the first "n" matched characters back to the input stream. */
+/* The funky do-while in the following #define is used to turn the definition
+ * int a single C statement (which needs a semi-colon terminator). This
+ * avoids problems with code like:
+ *
+ * if ( condition_holds )
+ * yyless( 5 );
+ * else
+ * do_something_else();
+ *
+ * Prior to using the do-while the compiler would get upset at the
+ * "else" because it interpreted the "if" statement as being all
+ * done when it reached the ';' after the yyless() call.
+ */
+
+/* Return all but the first 'n' matched characters back to the input stream. */
+
#define yyless(n) \
do \
{ \
/* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- *yy_cp = (yy_hold_char); \
+ *yy_cp = yy_hold_char; \
YY_RESTORE_YY_MORE_OFFSET \
- (yy_c_buf_p) = yy_cp = yy_bp + yyless_macro_arg - YY_MORE_ADJ; \
+ yy_c_buf_p = yy_cp = yy_bp + n - YY_MORE_ADJ; \
YY_DO_BEFORE_ACTION; /* set up yytext again */ \
} \
while ( 0 )
-#define unput(c) yyunput( c, (yytext_ptr) )
+#define unput(c) yyunput( c, yytext_ptr )
+
+/* The following is because we cannot portably get our hands on size_t
+ * (without autoconf's help, which isn't available because we want
+ * flex-generated scanners to compile on their own).
+ */
+typedef unsigned int yy_size_t;
+
-#ifndef YY_STRUCT_YY_BUFFER_STATE
-#define YY_STRUCT_YY_BUFFER_STATE
struct yy_buffer_state
{
FILE *yy_input_file;
@@ -201,7 +159,7 @@ struct yy_buffer_state
/* Number of characters read into yy_ch_buf, not including EOB
* characters.
*/
- yy_size_t yy_n_chars;
+ int yy_n_chars;
/* Whether we "own" the buffer - i.e., we know we created it,
* and can realloc() it to grow it, and should free() it to
@@ -222,16 +180,12 @@ struct yy_buffer_state
*/
int yy_at_bol;
- int yy_bs_lineno; /**< The line count. */
- int yy_bs_column; /**< The column count. */
-
/* Whether to try to fill the input buffer when we reach the
* end of it.
*/
int yy_fill_buffer;
int yy_buffer_status;
-
#define YY_BUFFER_NEW 0
#define YY_BUFFER_NORMAL 1
/* When an EOF's been seen but there's still some text to process
@@ -245,38 +199,28 @@ struct yy_buffer_state
* just pointing yyin at a new input file.
*/
#define YY_BUFFER_EOF_PENDING 2
-
};
-#endif /* !YY_STRUCT_YY_BUFFER_STATE */
-/* Stack of input buffers. */
-static size_t yy_buffer_stack_top = 0; /**< index of top of stack. */
-static size_t yy_buffer_stack_max = 0; /**< capacity of stack. */
-static YY_BUFFER_STATE * yy_buffer_stack = 0; /**< Stack as an array. */
+static YY_BUFFER_STATE yy_current_buffer = 0;
/* We provide macros for accessing buffer states in case in the
* future we want to put the buffer states in a more general
* "scanner state".
- *
- * Returns the top of the stack, or NULL.
*/
-#define YY_CURRENT_BUFFER ( (yy_buffer_stack) \
- ? (yy_buffer_stack)[(yy_buffer_stack_top)] \
- : NULL)
+#define YY_CURRENT_BUFFER yy_current_buffer
-/* Same as previous macro, but useful when we know that the buffer stack is not
- * NULL or when we need an lvalue. For internal use only.
- */
-#define YY_CURRENT_BUFFER_LVALUE (yy_buffer_stack)[(yy_buffer_stack_top)]
/* yy_hold_char holds the character lost when yytext is formed. */
static char yy_hold_char;
-static yy_size_t yy_n_chars; /* number of characters read into yy_ch_buf */
-yy_size_t yyleng;
+
+static int yy_n_chars; /* number of characters read into yy_ch_buf */
+
+
+int yyleng;
/* Points to current character in buffer. */
static char *yy_c_buf_p = (char *) 0;
-static int yy_init = 0; /* whether we need to initialize */
+static int yy_init = 1; /* whether we need to initialize */
static int yy_start = 0; /* start state number */
/* Flag which is used to allow yywrap()'s to do buffer switches
@@ -284,92 +228,66 @@ static int yy_start = 0; /* start state number */
*/
static int yy_did_buffer_switch_on_eof;
-void yyrestart (FILE *input_file );
-void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer );
-YY_BUFFER_STATE yy_create_buffer (FILE *file,int size );
-void yy_delete_buffer (YY_BUFFER_STATE b );
-void yy_flush_buffer (YY_BUFFER_STATE b );
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer );
-void yypop_buffer_state (void );
-
-static void yyensure_buffer_stack (void );
-static void yy_load_buffer_state (void );
-static void yy_init_buffer (YY_BUFFER_STATE b,FILE *file );
+void yyrestart YY_PROTO(( FILE *input_file ));
-#define YY_FLUSH_BUFFER yy_flush_buffer(YY_CURRENT_BUFFER )
+void yy_switch_to_buffer YY_PROTO(( YY_BUFFER_STATE new_buffer ));
+void yy_load_buffer_state YY_PROTO(( void ));
+YY_BUFFER_STATE yy_create_buffer YY_PROTO(( FILE *file, int size ));
+void yy_delete_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+void yy_init_buffer YY_PROTO(( YY_BUFFER_STATE b, FILE *file ));
+void yy_flush_buffer YY_PROTO(( YY_BUFFER_STATE b ));
+#define YY_FLUSH_BUFFER yy_flush_buffer( yy_current_buffer )
-YY_BUFFER_STATE yy_scan_buffer (char *base,yy_size_t size );
-YY_BUFFER_STATE yy_scan_string (yyconst char *yy_str );
-YY_BUFFER_STATE yy_scan_bytes (yyconst char *bytes,yy_size_t len );
+YY_BUFFER_STATE yy_scan_buffer YY_PROTO(( char *base, yy_size_t size ));
+YY_BUFFER_STATE yy_scan_string YY_PROTO(( yyconst char *yy_str ));
+YY_BUFFER_STATE yy_scan_bytes YY_PROTO(( yyconst char *bytes, int len ));
-void *yyalloc (yy_size_t );
-void *yyrealloc (void *,yy_size_t );
-void yyfree (void * );
+static void *yy_flex_alloc YY_PROTO(( yy_size_t ));
+static void *yy_flex_realloc YY_PROTO(( void *, yy_size_t ));
+static void yy_flex_free YY_PROTO(( void * ));
#define yy_new_buffer yy_create_buffer
#define yy_set_interactive(is_interactive) \
{ \
- if ( ! YY_CURRENT_BUFFER ){ \
- yyensure_buffer_stack (); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer(yyin,YY_BUF_SIZE ); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_is_interactive = is_interactive; \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_is_interactive = is_interactive; \
}
#define yy_set_bol(at_bol) \
{ \
- if ( ! YY_CURRENT_BUFFER ){\
- yyensure_buffer_stack (); \
- YY_CURRENT_BUFFER_LVALUE = \
- yy_create_buffer(yyin,YY_BUF_SIZE ); \
- } \
- YY_CURRENT_BUFFER_LVALUE->yy_at_bol = at_bol; \
+ if ( ! yy_current_buffer ) \
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE ); \
+ yy_current_buffer->yy_at_bol = at_bol; \
}
-#define YY_AT_BOL() (YY_CURRENT_BUFFER_LVALUE->yy_at_bol)
-
-/* Begin user sect3 */
+#define YY_AT_BOL() (yy_current_buffer->yy_at_bol)
typedef unsigned char YY_CHAR;
-
FILE *yyin = (FILE *) 0, *yyout = (FILE *) 0;
-
typedef int yy_state_type;
-
-extern int yylineno;
-
-int yylineno = 1;
-
extern char *yytext;
#define yytext_ptr yytext
-static yy_state_type yy_get_previous_state (void );
-static yy_state_type yy_try_NUL_trans (yy_state_type current_state );
-static int yy_get_next_buffer (void );
-static void yy_fatal_error (yyconst char msg[] );
+static yy_state_type yy_get_previous_state YY_PROTO(( void ));
+static yy_state_type yy_try_NUL_trans YY_PROTO(( yy_state_type current_state ));
+static int yy_get_next_buffer YY_PROTO(( void ));
+static void yy_fatal_error YY_PROTO(( yyconst char msg[] ));
/* Done after the current pattern has been matched and before the
* corresponding action - sets up yytext.
*/
#define YY_DO_BEFORE_ACTION \
- (yytext_ptr) = yy_bp; \
- yyleng = (size_t) (yy_cp - yy_bp); \
- (yy_hold_char) = *yy_cp; \
+ yytext_ptr = yy_bp; \
+ yyleng = (int) (yy_cp - yy_bp); \
+ yy_hold_char = *yy_cp; \
*yy_cp = '\0'; \
- (yy_c_buf_p) = yy_cp;
+ yy_c_buf_p = yy_cp;
#define YY_NUM_RULES 19
#define YY_END_OF_BUFFER 20
-/* This struct is not used in this scanner,
- but its presence is necessary. */
-struct yy_trans_info
- {
- flex_int32_t yy_verify;
- flex_int32_t yy_nxt;
- };
-static yyconst flex_int16_t yy_accept[39] =
+static yyconst short int yy_accept[39] =
{ 0,
0, 0, 20, 18, 1, 2, 7, 6, 7, 18,
16, 16, 2, 7, 7, 7, 16, 17, 18, 18,
@@ -377,7 +295,7 @@ static yyconst flex_int16_t yy_accept[39] =
9, 13, 16, 17, 3, 15, 4, 0
} ;
-static yyconst flex_int32_t yy_ec[256] =
+static yyconst int yy_ec[256] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 2, 3,
1, 2, 1, 1, 1, 1, 1, 1, 1, 1,
@@ -409,13 +327,13 @@ static yyconst flex_int32_t yy_ec[256] =
1, 1, 1, 1, 1
} ;
-static yyconst flex_int32_t yy_meta[19] =
+static yyconst int yy_meta[19] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 2, 2, 1,
1, 1, 1, 2, 3, 2, 1, 1
} ;
-static yyconst flex_int16_t yy_base[43] =
+static yyconst short int yy_base[43] =
{ 0,
0, 0, 39, 49, 49, 49, 26, 16, 49, 30,
20, 19, 49, 9, 22, 10, 9, 0, 29, 13,
@@ -424,7 +342,7 @@ static yyconst flex_int16_t yy_base[43] =
43, 45
} ;
-static yyconst flex_int16_t yy_def[43] =
+static yyconst short int yy_def[43] =
{ 0,
38, 1, 38, 38, 38, 38, 38, 39, 38, 38,
40, 40, 38, 38, 38, 38, 41, 42, 38, 38,
@@ -433,7 +351,7 @@ static yyconst flex_int16_t yy_def[43] =
38, 38
} ;
-static yyconst flex_int16_t yy_nxt[68] =
+static yyconst short int yy_nxt[68] =
{ 0,
4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
14, 15, 16, 17, 18, 18, 19, 20, 23, 28,
@@ -444,7 +362,7 @@ static yyconst flex_int16_t yy_nxt[68] =
38, 38, 38, 38, 38, 38, 38
} ;
-static yyconst flex_int16_t yy_chk[68] =
+static yyconst short int yy_chk[68] =
{ 0,
1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
1, 1, 1, 1, 1, 1, 1, 1, 8, 14,
@@ -458,9 +376,6 @@ static yyconst flex_int16_t yy_chk[68] =
static yy_state_type yy_last_accepting_state;
static char *yy_last_accepting_cpos;
-extern int yy_flex_debug;
-int yy_flex_debug = 0;
-
/* The intent behind this definition is that it'll catch
* any uses of REJECT which flex missed.
*/
@@ -470,9 +385,10 @@ int yy_flex_debug = 0;
#define YY_RESTORE_YY_MORE_OFFSET
char *yytext;
#line 1 "calclex.l"
+#define INITIAL 0
/* Lexical analyzer for calc program.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
This file is part of the GNU MP Library.
@@ -486,8 +402,9 @@ 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/. */
-#line 20 "calclex.l"
+this program. If not, see http://www.gnu.org/licenses/. */
+
+#line 21 "calclex.l"
#include <string.h>
#include "calc-common.h"
@@ -523,52 +440,7 @@ const struct calc_keywords_t calc_keywords[] = {
{ "sqrt", SQRT },
{ NULL }
};
-#line 527 "calclex.c"
-
-#define INITIAL 0
-
-#ifndef YY_NO_UNISTD_H
-/* Special case for "unistd.h", since it is non-ANSI. We include it way
- * down here because we want the user's section 1 to have been scanned first.
- * The user has a chance to override it with an option.
- */
-#include <unistd.h>
-#endif
-
-#ifndef YY_EXTRA_TYPE
-#define YY_EXTRA_TYPE void *
-#endif
-
-static int yy_init_globals (void );
-
-/* Accessor methods to globals.
- These are made visible to non-reentrant scanners for convenience. */
-
-int yylex_destroy (void );
-
-int yyget_debug (void );
-
-void yyset_debug (int debug_flag );
-
-YY_EXTRA_TYPE yyget_extra (void );
-
-void yyset_extra (YY_EXTRA_TYPE user_defined );
-
-FILE *yyget_in (void );
-
-void yyset_in (FILE * in_str );
-
-FILE *yyget_out (void );
-
-void yyset_out (FILE * out_str );
-
-yy_size_t yyget_leng (void );
-
-char *yyget_text (void );
-
-int yyget_lineno (void );
-
-void yyset_lineno (int line_number );
+#line 444 "calclex.c"
/* Macros after this point can all be overridden by user definitions in
* section 1.
@@ -576,30 +448,65 @@ void yyset_lineno (int line_number );
#ifndef YY_SKIP_YYWRAP
#ifdef __cplusplus
-extern "C" int yywrap (void );
+extern "C" int yywrap YY_PROTO(( void ));
#else
-extern int yywrap (void );
+extern int yywrap YY_PROTO(( void ));
#endif
#endif
- static void yyunput (int c,char *buf_ptr );
-
+#ifndef YY_NO_UNPUT
+static void yyunput YY_PROTO(( int c, char *buf_ptr ));
+#endif
+
#ifndef yytext_ptr
-static void yy_flex_strncpy (char *,yyconst char *,int );
+static void yy_flex_strncpy YY_PROTO(( char *, yyconst char *, int ));
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * );
+static int yy_flex_strlen YY_PROTO(( yyconst char * ));
#endif
#ifndef YY_NO_INPUT
-
#ifdef __cplusplus
-static int yyinput (void );
+static int yyinput YY_PROTO(( void ));
#else
-static int input (void );
+static int input YY_PROTO(( void ));
+#endif
#endif
+#if YY_STACK_USED
+static int yy_start_stack_ptr = 0;
+static int yy_start_stack_depth = 0;
+static int *yy_start_stack = 0;
+#ifndef YY_NO_PUSH_STATE
+static void yy_push_state YY_PROTO(( int new_state ));
+#endif
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state YY_PROTO(( void ));
+#endif
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state YY_PROTO(( void ));
+#endif
+
+#else
+#define YY_NO_PUSH_STATE 1
+#define YY_NO_POP_STATE 1
+#define YY_NO_TOP_STATE 1
+#endif
+
+#ifdef YY_MALLOC_DECL
+YY_MALLOC_DECL
+#else
+#if __STDC__
+#ifndef __cplusplus
+#include <stdlib.h>
+#endif
+#else
+/* Just try to get by without declaring the routines. This will fail
+ * miserably on non-ANSI systems for which sizeof(size_t) != sizeof(int)
+ * or sizeof(void*) != sizeof(int).
+ */
+#endif
#endif
/* Amount of stuff to slurp up with each read. */
@@ -608,11 +515,12 @@ static int input (void );
#endif
/* Copy whatever the last rule matched to the standard output. */
+
#ifndef ECHO
/* This used to be an fputs(), but since the string might contain NUL's,
* we now use fwrite().
*/
-#define ECHO do { if (fwrite( yytext, yyleng, 1, yyout )) {} } while (0)
+#define ECHO (void) fwrite( yytext, yyleng, 1, yyout )
#endif
/* Gets input and stuffs it into "buf". number of characters read, or YY_NULL,
@@ -620,10 +528,9 @@ static int input (void );
*/
#ifndef YY_INPUT
#define YY_INPUT(buf,result,max_size) \
- if ( YY_CURRENT_BUFFER_LVALUE->yy_is_interactive ) \
+ if ( yy_current_buffer->yy_is_interactive ) \
{ \
- int c = '*'; \
- size_t n; \
+ int c = '*', n; \
for ( n = 0; n < max_size && \
(c = getc( yyin )) != EOF && c != '\n'; ++n ) \
buf[n] = (char) c; \
@@ -646,9 +553,7 @@ static int input (void );
errno=0; \
clearerr(yyin); \
} \
- }\
-\
-
+ }
#endif
/* No semi-colon after return; correct usage is to write "yyterminate();" -
@@ -669,18 +574,12 @@ static int input (void );
#define YY_FATAL_ERROR(msg) yy_fatal_error( msg )
#endif
-/* end tables serialization structures and prototypes */
-
/* Default declaration of generated scanner - a define so the user can
* easily add parameters.
*/
#ifndef YY_DECL
-#define YY_DECL_IS_OURS 1
-
-extern int yylex (void);
-
-#define YY_DECL int yylex (void)
-#endif /* !YY_DECL */
+#define YY_DECL int yylex YY_PROTO(( void ))
+#endif
/* Code executed at the beginning of each rule, after yytext and yyleng
* have been set up.
@@ -697,29 +596,27 @@ extern int yylex (void);
#define YY_RULE_SETUP \
YY_USER_ACTION
-/** The main scanner function which does all the work.
- */
YY_DECL
-{
+ {
register yy_state_type yy_current_state;
register char *yy_cp, *yy_bp;
register int yy_act;
-
-#line 57 "calclex.l"
+
+#line 58 "calclex.l"
-#line 712 "calclex.c"
+#line 609 "calclex.c"
- if ( !(yy_init) )
+ if ( yy_init )
{
- (yy_init) = 1;
+ yy_init = 0;
#ifdef YY_USER_INIT
YY_USER_INIT;
#endif
- if ( ! (yy_start) )
- (yy_start) = 1; /* first start state */
+ if ( ! yy_start )
+ yy_start = 1; /* first start state */
if ( ! yyin )
yyin = stdin;
@@ -727,36 +624,34 @@ YY_DECL
if ( ! yyout )
yyout = stdout;
- if ( ! YY_CURRENT_BUFFER ) {
- yyensure_buffer_stack ();
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer(yyin,YY_BUF_SIZE );
- }
+ if ( ! yy_current_buffer )
+ yy_current_buffer =
+ yy_create_buffer( yyin, YY_BUF_SIZE );
- yy_load_buffer_state( );
+ yy_load_buffer_state();
}
while ( 1 ) /* loops until end-of-file is reached */
{
- yy_cp = (yy_c_buf_p);
+ yy_cp = yy_c_buf_p;
/* Support of yytext. */
- *yy_cp = (yy_hold_char);
+ *yy_cp = yy_hold_char;
/* yy_bp points to the position in yy_ch_buf of the start of
* the current run.
*/
yy_bp = yy_cp;
- yy_current_state = (yy_start);
+ yy_current_state = yy_start;
yy_match:
do
{
register YY_CHAR yy_c = yy_ec[YY_SC_TO_UI(*yy_cp)];
if ( yy_accept[yy_current_state] )
{
- (yy_last_accepting_state) = yy_current_state;
- (yy_last_accepting_cpos) = yy_cp;
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
@@ -773,118 +668,116 @@ yy_find_action:
yy_act = yy_accept[yy_current_state];
if ( yy_act == 0 )
{ /* have to back up */
- yy_cp = (yy_last_accepting_cpos);
- yy_current_state = (yy_last_accepting_state);
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
yy_act = yy_accept[yy_current_state];
}
YY_DO_BEFORE_ACTION;
+
do_action: /* This label is used only to access EOF actions. */
+
switch ( yy_act )
{ /* beginning of action switch */
case 0: /* must back up */
/* undo the effects of YY_DO_BEFORE_ACTION */
- *yy_cp = (yy_hold_char);
- yy_cp = (yy_last_accepting_cpos);
- yy_current_state = (yy_last_accepting_state);
+ *yy_cp = yy_hold_char;
+ yy_cp = yy_last_accepting_cpos;
+ yy_current_state = yy_last_accepting_state;
goto yy_find_action;
case 1:
YY_RULE_SETUP
-#line 59 "calclex.l"
+#line 60 "calclex.l"
{ /* white space is skipped */ }
YY_BREAK
case 2:
-/* rule 2 can match eol */
YY_RULE_SETUP
-#line 61 "calclex.l"
+#line 62 "calclex.l"
{ /* semicolon or newline separates statements */
calc_more_input = 0;
return EOS; }
YY_BREAK
case 3:
-/* rule 3 can match eol */
YY_RULE_SETUP
-#line 64 "calclex.l"
+#line 65 "calclex.l"
{ /* escaped newlines are skipped */ }
YY_BREAK
case 4:
-/* rule 4 can match eol */
YY_RULE_SETUP
-#line 67 "calclex.l"
+#line 68 "calclex.l"
{
/* comment through to escaped newline is skipped */ }
YY_BREAK
case 5:
-/* rule 5 can match eol */
YY_RULE_SETUP
-#line 69 "calclex.l"
+#line 70 "calclex.l"
{ /* comment through to newline is a separator */
calc_more_input = 0;
return EOS; }
YY_BREAK
case 6:
YY_RULE_SETUP
-#line 72 "calclex.l"
+#line 73 "calclex.l"
{ /* comment through to EOF skipped */ }
YY_BREAK
case 7:
YY_RULE_SETUP
-#line 75 "calclex.l"
+#line 76 "calclex.l"
{ return yytext[0]; }
YY_BREAK
case 8:
YY_RULE_SETUP
-#line 76 "calclex.l"
+#line 77 "calclex.l"
{ return LE; }
YY_BREAK
case 9:
YY_RULE_SETUP
-#line 77 "calclex.l"
+#line 78 "calclex.l"
{ return GE; }
YY_BREAK
case 10:
YY_RULE_SETUP
-#line 78 "calclex.l"
+#line 79 "calclex.l"
{ return EQ; }
YY_BREAK
case 11:
YY_RULE_SETUP
-#line 79 "calclex.l"
+#line 80 "calclex.l"
{ return NE; }
YY_BREAK
case 12:
YY_RULE_SETUP
-#line 80 "calclex.l"
+#line 81 "calclex.l"
{ return LSHIFT; }
YY_BREAK
case 13:
YY_RULE_SETUP
-#line 81 "calclex.l"
+#line 82 "calclex.l"
{ return RSHIFT; }
YY_BREAK
case 14:
YY_RULE_SETUP
-#line 82 "calclex.l"
+#line 83 "calclex.l"
{ return LAND; }
YY_BREAK
case 15:
YY_RULE_SETUP
-#line 83 "calclex.l"
+#line 84 "calclex.l"
{ return LOR; }
YY_BREAK
case 16:
YY_RULE_SETUP
-#line 85 "calclex.l"
+#line 86 "calclex.l"
{
yylval.str = yytext;
return NUMBER; }
YY_BREAK
case 17:
YY_RULE_SETUP
-#line 89 "calclex.l"
+#line 90 "calclex.l"
{
int i;
@@ -903,41 +796,41 @@ YY_RULE_SETUP
YY_BREAK
case 18:
YY_RULE_SETUP
-#line 105 "calclex.l"
+#line 106 "calclex.l"
{ return BAD; }
YY_BREAK
case 19:
YY_RULE_SETUP
-#line 107 "calclex.l"
+#line 108 "calclex.l"
ECHO;
YY_BREAK
-#line 915 "calclex.c"
+#line 808 "calclex.c"
case YY_STATE_EOF(INITIAL):
yyterminate();
case YY_END_OF_BUFFER:
{
/* Amount of text matched not including the EOB char. */
- int yy_amount_of_matched_text = (int) (yy_cp - (yytext_ptr)) - 1;
+ int yy_amount_of_matched_text = (int) (yy_cp - yytext_ptr) - 1;
/* Undo the effects of YY_DO_BEFORE_ACTION. */
- *yy_cp = (yy_hold_char);
+ *yy_cp = yy_hold_char;
YY_RESTORE_YY_MORE_OFFSET
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_NEW )
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_NEW )
{
/* We're scanning a new file or input source. It's
* possible that this happened because the user
* just pointed yyin at a new source and called
* yylex(). If so, then we have to assure
- * consistency between YY_CURRENT_BUFFER and our
+ * consistency between yy_current_buffer and our
* globals. Here is the right place to do so, because
* this is the first action (other than possibly a
* back-up) that will match for the new input source.
*/
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- YY_CURRENT_BUFFER_LVALUE->yy_input_file = yyin;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status = YY_BUFFER_NORMAL;
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yy_current_buffer->yy_input_file = yyin;
+ yy_current_buffer->yy_buffer_status = YY_BUFFER_NORMAL;
}
/* Note that here we test for yy_c_buf_p "<=" to the position
@@ -947,13 +840,13 @@ case YY_STATE_EOF(INITIAL):
* end-of-buffer state). Contrast this with the test
* in input().
*/
- if ( (yy_c_buf_p) <= &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ if ( yy_c_buf_p <= &yy_current_buffer->yy_ch_buf[yy_n_chars] )
{ /* This was really a NUL. */
yy_state_type yy_next_state;
- (yy_c_buf_p) = (yytext_ptr) + yy_amount_of_matched_text;
+ yy_c_buf_p = yytext_ptr + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state( );
+ yy_current_state = yy_get_previous_state();
/* Okay, we're now positioned to make the NUL
* transition. We couldn't have
@@ -966,30 +859,30 @@ case YY_STATE_EOF(INITIAL):
yy_next_state = yy_try_NUL_trans( yy_current_state );
- yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
if ( yy_next_state )
{
/* Consume the NUL. */
- yy_cp = ++(yy_c_buf_p);
+ yy_cp = ++yy_c_buf_p;
yy_current_state = yy_next_state;
goto yy_match;
}
else
{
- yy_cp = (yy_c_buf_p);
+ yy_cp = yy_c_buf_p;
goto yy_find_action;
}
}
- else switch ( yy_get_next_buffer( ) )
+ else switch ( yy_get_next_buffer() )
{
case EOB_ACT_END_OF_FILE:
{
- (yy_did_buffer_switch_on_eof) = 0;
+ yy_did_buffer_switch_on_eof = 0;
- if ( yywrap( ) )
+ if ( yywrap() )
{
/* Note: because we've taken care in
* yy_get_next_buffer() to have set up
@@ -1000,7 +893,7 @@ case YY_STATE_EOF(INITIAL):
* YY_NULL, it'll still work - another
* YY_NULL will get returned.
*/
- (yy_c_buf_p) = (yytext_ptr) + YY_MORE_ADJ;
+ yy_c_buf_p = yytext_ptr + YY_MORE_ADJ;
yy_act = YY_STATE_EOF(YY_START);
goto do_action;
@@ -1008,30 +901,30 @@ case YY_STATE_EOF(INITIAL):
else
{
- if ( ! (yy_did_buffer_switch_on_eof) )
+ if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
}
break;
}
case EOB_ACT_CONTINUE_SCAN:
- (yy_c_buf_p) =
- (yytext_ptr) + yy_amount_of_matched_text;
+ yy_c_buf_p =
+ yytext_ptr + yy_amount_of_matched_text;
- yy_current_state = yy_get_previous_state( );
+ yy_current_state = yy_get_previous_state();
- yy_cp = (yy_c_buf_p);
- yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_match;
case EOB_ACT_LAST_MATCH:
- (yy_c_buf_p) =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)];
+ yy_c_buf_p =
+ &yy_current_buffer->yy_ch_buf[yy_n_chars];
- yy_current_state = yy_get_previous_state( );
+ yy_current_state = yy_get_previous_state();
- yy_cp = (yy_c_buf_p);
- yy_bp = (yytext_ptr) + YY_MORE_ADJ;
+ yy_cp = yy_c_buf_p;
+ yy_bp = yytext_ptr + YY_MORE_ADJ;
goto yy_find_action;
}
break;
@@ -1042,7 +935,8 @@ case YY_STATE_EOF(INITIAL):
"fatal flex scanner internal error--no action found" );
} /* end of action switch */
} /* end of scanning one token */
-} /* end of yylex */
+ } /* end of yylex */
+
/* yy_get_next_buffer - try to read in a new buffer
*
@@ -1051,20 +945,21 @@ case YY_STATE_EOF(INITIAL):
* EOB_ACT_CONTINUE_SCAN - continue scanning from current position
* EOB_ACT_END_OF_FILE - end of file
*/
-static int yy_get_next_buffer (void)
-{
- register char *dest = YY_CURRENT_BUFFER_LVALUE->yy_ch_buf;
- register char *source = (yytext_ptr);
+
+static int yy_get_next_buffer()
+ {
+ register char *dest = yy_current_buffer->yy_ch_buf;
+ register char *source = yytext_ptr;
register int number_to_move, i;
int ret_val;
- if ( (yy_c_buf_p) > &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] )
+ if ( yy_c_buf_p > &yy_current_buffer->yy_ch_buf[yy_n_chars + 1] )
YY_FATAL_ERROR(
"fatal flex scanner internal error--end of buffer missed" );
- if ( YY_CURRENT_BUFFER_LVALUE->yy_fill_buffer == 0 )
+ if ( yy_current_buffer->yy_fill_buffer == 0 )
{ /* Don't try to fill the buffer, so this is an EOF. */
- if ( (yy_c_buf_p) - (yytext_ptr) - YY_MORE_ADJ == 1 )
+ if ( yy_c_buf_p - yytext_ptr - YY_MORE_ADJ == 1 )
{
/* We matched a single character, the EOB, so
* treat this as a final EOF.
@@ -1084,34 +979,38 @@ static int yy_get_next_buffer (void)
/* Try to read more data. */
/* First move last chars to start of buffer. */
- number_to_move = (int) ((yy_c_buf_p) - (yytext_ptr)) - 1;
+ number_to_move = (int) (yy_c_buf_p - yytext_ptr) - 1;
for ( i = 0; i < number_to_move; ++i )
*(dest++) = *(source++);
- if ( YY_CURRENT_BUFFER_LVALUE->yy_buffer_status == YY_BUFFER_EOF_PENDING )
+ if ( yy_current_buffer->yy_buffer_status == YY_BUFFER_EOF_PENDING )
/* don't do the read, it's not guaranteed to return an EOF,
* just force an EOF
*/
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars) = 0;
+ yy_current_buffer->yy_n_chars = yy_n_chars = 0;
else
{
- yy_size_t num_to_read =
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size - number_to_move - 1;
+ int num_to_read =
+ yy_current_buffer->yy_buf_size - number_to_move - 1;
while ( num_to_read <= 0 )
{ /* Not enough room in the buffer - grow it. */
+#ifdef YY_USES_REJECT
+ YY_FATAL_ERROR(
+"input buffer overflow, can't enlarge buffer because scanner uses REJECT" );
+#else
/* just a shorter name for the current buffer */
- YY_BUFFER_STATE b = YY_CURRENT_BUFFER_LVALUE;
+ YY_BUFFER_STATE b = yy_current_buffer;
int yy_c_buf_p_offset =
- (int) ((yy_c_buf_p) - b->yy_ch_buf);
+ (int) (yy_c_buf_p - b->yy_ch_buf);
if ( b->yy_is_our_buffer )
{
- yy_size_t new_size = b->yy_buf_size * 2;
+ int new_size = b->yy_buf_size * 2;
if ( new_size <= 0 )
b->yy_buf_size += b->yy_buf_size / 8;
@@ -1120,7 +1019,8 @@ static int yy_get_next_buffer (void)
b->yy_ch_buf = (char *)
/* Include room in for 2 EOB chars. */
- yyrealloc((void *) b->yy_ch_buf,b->yy_buf_size + 2 );
+ yy_flex_realloc( (void *) b->yy_ch_buf,
+ b->yy_buf_size + 2 );
}
else
/* Can't grow it, we don't own it. */
@@ -1130,35 +1030,35 @@ static int yy_get_next_buffer (void)
YY_FATAL_ERROR(
"fatal error - scanner input buffer overflow" );
- (yy_c_buf_p) = &b->yy_ch_buf[yy_c_buf_p_offset];
+ yy_c_buf_p = &b->yy_ch_buf[yy_c_buf_p_offset];
- num_to_read = YY_CURRENT_BUFFER_LVALUE->yy_buf_size -
+ num_to_read = yy_current_buffer->yy_buf_size -
number_to_move - 1;
-
+#endif
}
if ( num_to_read > YY_READ_BUF_SIZE )
num_to_read = YY_READ_BUF_SIZE;
/* Read in more data. */
- YY_INPUT( (&YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move]),
- (yy_n_chars), num_to_read );
+ YY_INPUT( (&yy_current_buffer->yy_ch_buf[number_to_move]),
+ yy_n_chars, num_to_read );
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ yy_current_buffer->yy_n_chars = yy_n_chars;
}
- if ( (yy_n_chars) == 0 )
+ if ( yy_n_chars == 0 )
{
if ( number_to_move == YY_MORE_ADJ )
{
ret_val = EOB_ACT_END_OF_FILE;
- yyrestart(yyin );
+ yyrestart( yyin );
}
else
{
ret_val = EOB_ACT_LAST_MATCH;
- YY_CURRENT_BUFFER_LVALUE->yy_buffer_status =
+ yy_current_buffer->yy_buffer_status =
YY_BUFFER_EOF_PENDING;
}
}
@@ -1166,39 +1066,32 @@ static int yy_get_next_buffer (void)
else
ret_val = EOB_ACT_CONTINUE_SCAN;
- if ((yy_size_t) ((yy_n_chars) + number_to_move) > YY_CURRENT_BUFFER_LVALUE->yy_buf_size) {
- /* Extend the array by 50%, plus the number we really need. */
- yy_size_t new_size = (yy_n_chars) + number_to_move + ((yy_n_chars) >> 1);
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf = (char *) yyrealloc((void *) YY_CURRENT_BUFFER_LVALUE->yy_ch_buf,new_size );
- if ( ! YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
- YY_FATAL_ERROR( "out of dynamic memory in yy_get_next_buffer()" );
- }
-
- (yy_n_chars) += number_to_move;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] = YY_END_OF_BUFFER_CHAR;
- YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars) + 1] = YY_END_OF_BUFFER_CHAR;
+ yy_n_chars += number_to_move;
+ yy_current_buffer->yy_ch_buf[yy_n_chars] = YY_END_OF_BUFFER_CHAR;
+ yy_current_buffer->yy_ch_buf[yy_n_chars + 1] = YY_END_OF_BUFFER_CHAR;
- (yytext_ptr) = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[0];
+ yytext_ptr = &yy_current_buffer->yy_ch_buf[0];
return ret_val;
-}
+ }
+
/* yy_get_previous_state - get the state just before the EOB char was reached */
- static yy_state_type yy_get_previous_state (void)
-{
+static yy_state_type yy_get_previous_state()
+ {
register yy_state_type yy_current_state;
register char *yy_cp;
-
- yy_current_state = (yy_start);
- for ( yy_cp = (yytext_ptr) + YY_MORE_ADJ; yy_cp < (yy_c_buf_p); ++yy_cp )
+ yy_current_state = yy_start;
+
+ for ( yy_cp = yytext_ptr + YY_MORE_ADJ; yy_cp < yy_c_buf_p; ++yy_cp )
{
register YY_CHAR yy_c = (*yy_cp ? yy_ec[YY_SC_TO_UI(*yy_cp)] : 1);
if ( yy_accept[yy_current_state] )
{
- (yy_last_accepting_state) = yy_current_state;
- (yy_last_accepting_cpos) = yy_cp;
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
@@ -1210,23 +1103,30 @@ static int yy_get_next_buffer (void)
}
return yy_current_state;
-}
+ }
+
/* yy_try_NUL_trans - try to make a transition on the NUL character
*
* synopsis
* next_state = yy_try_NUL_trans( current_state );
*/
- static yy_state_type yy_try_NUL_trans (yy_state_type yy_current_state )
-{
+
+#ifdef YY_USE_PROTOS
+static yy_state_type yy_try_NUL_trans( yy_state_type yy_current_state )
+#else
+static yy_state_type yy_try_NUL_trans( yy_current_state )
+yy_state_type yy_current_state;
+#endif
+ {
register int yy_is_jam;
- register char *yy_cp = (yy_c_buf_p);
+ register char *yy_cp = yy_c_buf_p;
register YY_CHAR yy_c = 1;
if ( yy_accept[yy_current_state] )
{
- (yy_last_accepting_state) = yy_current_state;
- (yy_last_accepting_cpos) = yy_cp;
+ yy_last_accepting_state = yy_current_state;
+ yy_last_accepting_cpos = yy_cp;
}
while ( yy_chk[yy_base[yy_current_state] + yy_c] != yy_current_state )
{
@@ -1237,74 +1137,81 @@ static int yy_get_next_buffer (void)
yy_current_state = yy_nxt[yy_base[yy_current_state] + (unsigned int) yy_c];
yy_is_jam = (yy_current_state == 38);
- return yy_is_jam ? 0 : yy_current_state;
-}
+ return yy_is_jam ? 0 : yy_current_state;
+ }
- static void yyunput (int c, register char * yy_bp )
-{
- register char *yy_cp;
-
- yy_cp = (yy_c_buf_p);
+
+#ifndef YY_NO_UNPUT
+#ifdef YY_USE_PROTOS
+static void yyunput( int c, register char *yy_bp )
+#else
+static void yyunput( c, yy_bp )
+int c;
+register char *yy_bp;
+#endif
+ {
+ register char *yy_cp = yy_c_buf_p;
/* undo effects of setting up yytext */
- *yy_cp = (yy_hold_char);
+ *yy_cp = yy_hold_char;
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
{ /* need to shift things up to make room */
/* +2 for EOB chars. */
- register yy_size_t number_to_move = (yy_n_chars) + 2;
- register char *dest = &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[
- YY_CURRENT_BUFFER_LVALUE->yy_buf_size + 2];
+ register int number_to_move = yy_n_chars + 2;
+ register char *dest = &yy_current_buffer->yy_ch_buf[
+ yy_current_buffer->yy_buf_size + 2];
register char *source =
- &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[number_to_move];
+ &yy_current_buffer->yy_ch_buf[number_to_move];
- while ( source > YY_CURRENT_BUFFER_LVALUE->yy_ch_buf )
+ while ( source > yy_current_buffer->yy_ch_buf )
*--dest = *--source;
yy_cp += (int) (dest - source);
yy_bp += (int) (dest - source);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars =
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_buf_size;
+ yy_current_buffer->yy_n_chars =
+ yy_n_chars = yy_current_buffer->yy_buf_size;
- if ( yy_cp < YY_CURRENT_BUFFER_LVALUE->yy_ch_buf + 2 )
+ if ( yy_cp < yy_current_buffer->yy_ch_buf + 2 )
YY_FATAL_ERROR( "flex scanner push-back overflow" );
}
*--yy_cp = (char) c;
- (yytext_ptr) = yy_bp;
- (yy_hold_char) = *yy_cp;
- (yy_c_buf_p) = yy_cp;
-}
-#ifndef YY_NO_INPUT
+ yytext_ptr = yy_bp;
+ yy_hold_char = *yy_cp;
+ yy_c_buf_p = yy_cp;
+ }
+#endif /* ifndef YY_NO_UNPUT */
+
+
#ifdef __cplusplus
- static int yyinput (void)
+static int yyinput()
#else
- static int input (void)
+static int input()
#endif
-
-{
+ {
int c;
-
- *(yy_c_buf_p) = (yy_hold_char);
- if ( *(yy_c_buf_p) == YY_END_OF_BUFFER_CHAR )
+ *yy_c_buf_p = yy_hold_char;
+
+ if ( *yy_c_buf_p == YY_END_OF_BUFFER_CHAR )
{
/* yy_c_buf_p now points to the character we want to return.
* If this occurs *before* the EOB characters, then it's a
* valid NUL; if not, then we've hit the end of the buffer.
*/
- if ( (yy_c_buf_p) < &YY_CURRENT_BUFFER_LVALUE->yy_ch_buf[(yy_n_chars)] )
+ if ( yy_c_buf_p < &yy_current_buffer->yy_ch_buf[yy_n_chars] )
/* This was really a NUL. */
- *(yy_c_buf_p) = '\0';
+ *yy_c_buf_p = '\0';
else
{ /* need more input */
- yy_size_t offset = (yy_c_buf_p) - (yytext_ptr);
- ++(yy_c_buf_p);
+ int offset = yy_c_buf_p - yytext_ptr;
+ ++yy_c_buf_p;
- switch ( yy_get_next_buffer( ) )
+ switch ( yy_get_next_buffer() )
{
case EOB_ACT_LAST_MATCH:
/* This happens because yy_g_n_b()
@@ -1318,16 +1225,16 @@ static int yy_get_next_buffer (void)
*/
/* Reset buffer status. */
- yyrestart(yyin );
+ yyrestart( yyin );
- /*FALLTHROUGH*/
+ /* fall through */
case EOB_ACT_END_OF_FILE:
{
- if ( yywrap( ) )
+ if ( yywrap() )
return EOF;
- if ( ! (yy_did_buffer_switch_on_eof) )
+ if ( ! yy_did_buffer_switch_on_eof )
YY_NEW_FILE;
#ifdef __cplusplus
return yyinput();
@@ -1337,92 +1244,90 @@ static int yy_get_next_buffer (void)
}
case EOB_ACT_CONTINUE_SCAN:
- (yy_c_buf_p) = (yytext_ptr) + offset;
+ yy_c_buf_p = yytext_ptr + offset;
break;
}
}
}
- c = *(unsigned char *) (yy_c_buf_p); /* cast for 8-bit char's */
- *(yy_c_buf_p) = '\0'; /* preserve yytext */
- (yy_hold_char) = *++(yy_c_buf_p);
+ c = *(unsigned char *) yy_c_buf_p; /* cast for 8-bit char's */
+ *yy_c_buf_p = '\0'; /* preserve yytext */
+ yy_hold_char = *++yy_c_buf_p;
+
return c;
-}
-#endif /* ifndef YY_NO_INPUT */
+ }
-/** Immediately switch to a different input stream.
- * @param input_file A readable stream.
- *
- * @note This function does not reset the start condition to @c INITIAL .
- */
- void yyrestart (FILE * input_file )
-{
-
- if ( ! YY_CURRENT_BUFFER ){
- yyensure_buffer_stack ();
- YY_CURRENT_BUFFER_LVALUE =
- yy_create_buffer(yyin,YY_BUF_SIZE );
+
+#ifdef YY_USE_PROTOS
+void yyrestart( FILE *input_file )
+#else
+void yyrestart( input_file )
+FILE *input_file;
+#endif
+ {
+ if ( ! yy_current_buffer )
+ yy_current_buffer = yy_create_buffer( yyin, YY_BUF_SIZE );
+
+ yy_init_buffer( yy_current_buffer, input_file );
+ yy_load_buffer_state();
}
- yy_init_buffer(YY_CURRENT_BUFFER,input_file );
- yy_load_buffer_state( );
-}
-/** Switch to a different input buffer.
- * @param new_buffer The new input buffer.
- *
- */
- void yy_switch_to_buffer (YY_BUFFER_STATE new_buffer )
-{
-
- /* TODO. We should be able to replace this entire function body
- * with
- * yypop_buffer_state();
- * yypush_buffer_state(new_buffer);
- */
- yyensure_buffer_stack ();
- if ( YY_CURRENT_BUFFER == new_buffer )
+#ifdef YY_USE_PROTOS
+void yy_switch_to_buffer( YY_BUFFER_STATE new_buffer )
+#else
+void yy_switch_to_buffer( new_buffer )
+YY_BUFFER_STATE new_buffer;
+#endif
+ {
+ if ( yy_current_buffer == new_buffer )
return;
- if ( YY_CURRENT_BUFFER )
+ if ( yy_current_buffer )
{
/* Flush out information for old buffer. */
- *(yy_c_buf_p) = (yy_hold_char);
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
+ *yy_c_buf_p = yy_hold_char;
+ yy_current_buffer->yy_buf_pos = yy_c_buf_p;
+ yy_current_buffer->yy_n_chars = yy_n_chars;
}
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
- yy_load_buffer_state( );
+ yy_current_buffer = new_buffer;
+ yy_load_buffer_state();
/* We don't actually know whether we did this switch during
* EOF (yywrap()) processing, but the only time this flag
* is looked at is after yywrap() is called, so it's safe
* to go ahead and always set it.
*/
- (yy_did_buffer_switch_on_eof) = 1;
-}
+ yy_did_buffer_switch_on_eof = 1;
+ }
-static void yy_load_buffer_state (void)
-{
- (yy_n_chars) = YY_CURRENT_BUFFER_LVALUE->yy_n_chars;
- (yytext_ptr) = (yy_c_buf_p) = YY_CURRENT_BUFFER_LVALUE->yy_buf_pos;
- yyin = YY_CURRENT_BUFFER_LVALUE->yy_input_file;
- (yy_hold_char) = *(yy_c_buf_p);
-}
-/** Allocate and initialize an input buffer state.
- * @param file A readable stream.
- * @param size The character buffer size in bytes. When in doubt, use @c YY_BUF_SIZE.
- *
- * @return the allocated buffer state.
- */
- YY_BUFFER_STATE yy_create_buffer (FILE * file, int size )
-{
+#ifdef YY_USE_PROTOS
+void yy_load_buffer_state( void )
+#else
+void yy_load_buffer_state()
+#endif
+ {
+ yy_n_chars = yy_current_buffer->yy_n_chars;
+ yytext_ptr = yy_c_buf_p = yy_current_buffer->yy_buf_pos;
+ yyin = yy_current_buffer->yy_input_file;
+ yy_hold_char = *yy_c_buf_p;
+ }
+
+
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_create_buffer( FILE *file, int size )
+#else
+YY_BUFFER_STATE yy_create_buffer( file, size )
+FILE *file;
+int size;
+#endif
+ {
YY_BUFFER_STATE b;
-
- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
@@ -1431,71 +1336,84 @@ static void yy_load_buffer_state (void)
/* yy_ch_buf has to be 2 characters longer than the size given because
* we need to put in 2 end-of-buffer characters.
*/
- b->yy_ch_buf = (char *) yyalloc(b->yy_buf_size + 2 );
+ b->yy_ch_buf = (char *) yy_flex_alloc( b->yy_buf_size + 2 );
if ( ! b->yy_ch_buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_create_buffer()" );
b->yy_is_our_buffer = 1;
- yy_init_buffer(b,file );
+ yy_init_buffer( b, file );
return b;
-}
+ }
-/** Destroy the buffer.
- * @param b a buffer created with yy_create_buffer()
- *
- */
- void yy_delete_buffer (YY_BUFFER_STATE b )
-{
-
+
+#ifdef YY_USE_PROTOS
+void yy_delete_buffer( YY_BUFFER_STATE b )
+#else
+void yy_delete_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+ {
if ( ! b )
return;
- if ( b == YY_CURRENT_BUFFER ) /* Not sure if we should pop here. */
- YY_CURRENT_BUFFER_LVALUE = (YY_BUFFER_STATE) 0;
+ if ( b == yy_current_buffer )
+ yy_current_buffer = (YY_BUFFER_STATE) 0;
if ( b->yy_is_our_buffer )
- yyfree((void *) b->yy_ch_buf );
+ yy_flex_free( (void *) b->yy_ch_buf );
- yyfree((void *) b );
-}
+ yy_flex_free( (void *) b );
+ }
-/* Initializes or reinitializes a buffer.
- * This function is sometimes called more than once on the same buffer,
- * such as during a yyrestart() or at EOF.
- */
- static void yy_init_buffer (YY_BUFFER_STATE b, FILE * file )
-{
- int oerrno = errno;
-
- yy_flush_buffer(b );
+#ifndef _WIN32
+#include <unistd.h>
+#else
+#ifndef YY_ALWAYS_INTERACTIVE
+#ifndef YY_NEVER_INTERACTIVE
+extern int isatty YY_PROTO(( int ));
+#endif
+#endif
+#endif
+
+#ifdef YY_USE_PROTOS
+void yy_init_buffer( YY_BUFFER_STATE b, FILE *file )
+#else
+void yy_init_buffer( b, file )
+YY_BUFFER_STATE b;
+FILE *file;
+#endif
+
+
+ {
+ yy_flush_buffer( b );
b->yy_input_file = file;
b->yy_fill_buffer = 1;
- /* If b is the current buffer, then yy_init_buffer was _probably_
- * called from yyrestart() or through yy_get_next_buffer.
- * In that case, we don't want to reset the lineno or column.
- */
- if (b != YY_CURRENT_BUFFER){
- b->yy_bs_lineno = 1;
- b->yy_bs_column = 0;
- }
-
- b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
-
- errno = oerrno;
-}
+#if YY_ALWAYS_INTERACTIVE
+ b->yy_is_interactive = 1;
+#else
+#if YY_NEVER_INTERACTIVE
+ b->yy_is_interactive = 0;
+#else
+ b->yy_is_interactive = file ? (isatty( fileno(file) ) > 0) : 0;
+#endif
+#endif
+ }
-/** Discard all buffered characters. On the next scan, YY_INPUT will be called.
- * @param b the buffer state to be flushed, usually @c YY_CURRENT_BUFFER.
- *
- */
- void yy_flush_buffer (YY_BUFFER_STATE b )
-{
- if ( ! b )
+
+#ifdef YY_USE_PROTOS
+void yy_flush_buffer( YY_BUFFER_STATE b )
+#else
+void yy_flush_buffer( b )
+YY_BUFFER_STATE b;
+#endif
+
+ {
+ if ( ! b )
return;
b->yy_n_chars = 0;
@@ -1512,125 +1430,29 @@ static void yy_load_buffer_state (void)
b->yy_at_bol = 1;
b->yy_buffer_status = YY_BUFFER_NEW;
- if ( b == YY_CURRENT_BUFFER )
- yy_load_buffer_state( );
-}
-
-/** Pushes the new state onto the stack. The new state becomes
- * the current state. This function will allocate the stack
- * if necessary.
- * @param new_buffer The new state.
- *
- */
-void yypush_buffer_state (YY_BUFFER_STATE new_buffer )
-{
- if (new_buffer == NULL)
- return;
-
- yyensure_buffer_stack();
-
- /* This block is copied from yy_switch_to_buffer. */
- if ( YY_CURRENT_BUFFER )
- {
- /* Flush out information for old buffer. */
- *(yy_c_buf_p) = (yy_hold_char);
- YY_CURRENT_BUFFER_LVALUE->yy_buf_pos = (yy_c_buf_p);
- YY_CURRENT_BUFFER_LVALUE->yy_n_chars = (yy_n_chars);
- }
-
- /* Only push if top exists. Otherwise, replace top. */
- if (YY_CURRENT_BUFFER)
- (yy_buffer_stack_top)++;
- YY_CURRENT_BUFFER_LVALUE = new_buffer;
-
- /* copied from yy_switch_to_buffer. */
- yy_load_buffer_state( );
- (yy_did_buffer_switch_on_eof) = 1;
-}
-
-/** Removes and deletes the top of the stack, if present.
- * The next element becomes the new top.
- *
- */
-void yypop_buffer_state (void)
-{
- if (!YY_CURRENT_BUFFER)
- return;
-
- yy_delete_buffer(YY_CURRENT_BUFFER );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- if ((yy_buffer_stack_top) > 0)
- --(yy_buffer_stack_top);
-
- if (YY_CURRENT_BUFFER) {
- yy_load_buffer_state( );
- (yy_did_buffer_switch_on_eof) = 1;
- }
-}
-
-/* Allocates the stack if it does not exist.
- * Guarantees space for at least one push.
- */
-static void yyensure_buffer_stack (void)
-{
- yy_size_t num_to_alloc;
-
- if (!(yy_buffer_stack)) {
-
- /* First allocation is just for 2 elements, since we don't know if this
- * scanner will even need a stack. We use 2 instead of 1 to avoid an
- * immediate realloc on the next call.
- */
- num_to_alloc = 1;
- (yy_buffer_stack) = (struct yy_buffer_state**)yyalloc
- (num_to_alloc * sizeof(struct yy_buffer_state*)
- );
- if ( ! (yy_buffer_stack) )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
-
- memset((yy_buffer_stack), 0, num_to_alloc * sizeof(struct yy_buffer_state*));
-
- (yy_buffer_stack_max) = num_to_alloc;
- (yy_buffer_stack_top) = 0;
- return;
+ if ( b == yy_current_buffer )
+ yy_load_buffer_state();
}
- if ((yy_buffer_stack_top) >= ((yy_buffer_stack_max)) - 1){
-
- /* Increase the buffer to prepare for a possible push. */
- int grow_size = 8 /* arbitrary grow size */;
-
- num_to_alloc = (yy_buffer_stack_max) + grow_size;
- (yy_buffer_stack) = (struct yy_buffer_state**)yyrealloc
- ((yy_buffer_stack),
- num_to_alloc * sizeof(struct yy_buffer_state*)
- );
- if ( ! (yy_buffer_stack) )
- YY_FATAL_ERROR( "out of dynamic memory in yyensure_buffer_stack()" );
- /* zero only the new slots.*/
- memset((yy_buffer_stack) + (yy_buffer_stack_max), 0, grow_size * sizeof(struct yy_buffer_state*));
- (yy_buffer_stack_max) = num_to_alloc;
- }
-}
-
-/** Setup the input buffer state to scan directly from a user-specified character buffer.
- * @param base the character buffer
- * @param size the size in bytes of the character buffer
- *
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
-{
+#ifndef YY_NO_SCAN_BUFFER
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_buffer( char *base, yy_size_t size )
+#else
+YY_BUFFER_STATE yy_scan_buffer( base, size )
+char *base;
+yy_size_t size;
+#endif
+ {
YY_BUFFER_STATE b;
-
+
if ( size < 2 ||
base[size-2] != YY_END_OF_BUFFER_CHAR ||
base[size-1] != YY_END_OF_BUFFER_CHAR )
/* They forgot to leave room for the EOB's. */
return 0;
- b = (YY_BUFFER_STATE) yyalloc(sizeof( struct yy_buffer_state ) );
+ b = (YY_BUFFER_STATE) yy_flex_alloc( sizeof( struct yy_buffer_state ) );
if ( ! b )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_buffer()" );
@@ -1644,51 +1466,56 @@ YY_BUFFER_STATE yy_scan_buffer (char * base, yy_size_t size )
b->yy_fill_buffer = 0;
b->yy_buffer_status = YY_BUFFER_NEW;
- yy_switch_to_buffer(b );
+ yy_switch_to_buffer( b );
return b;
-}
+ }
+#endif
-/** Setup the input buffer state to scan a string. The next call to yylex() will
- * scan from a @e copy of @a str.
- * @param yystr a NUL-terminated string to scan
- *
- * @return the newly allocated buffer state object.
- * @note If you want to scan bytes that may contain NUL values, then use
- * yy_scan_bytes() instead.
- */
-YY_BUFFER_STATE yy_scan_string (yyconst char * yystr )
-{
-
- return yy_scan_bytes(yystr,strlen(yystr) );
-}
-/** Setup the input buffer state to scan the given bytes. The next call to yylex() will
- * scan from a @e copy of @a bytes.
- * @param yybytes the byte buffer to scan
- * @param _yybytes_len the number of bytes in the buffer pointed to by @a bytes.
- *
- * @return the newly allocated buffer state object.
- */
-YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len )
-{
+#ifndef YY_NO_SCAN_STRING
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_string( yyconst char *yy_str )
+#else
+YY_BUFFER_STATE yy_scan_string( yy_str )
+yyconst char *yy_str;
+#endif
+ {
+ int len;
+ for ( len = 0; yy_str[len]; ++len )
+ ;
+
+ return yy_scan_bytes( yy_str, len );
+ }
+#endif
+
+
+#ifndef YY_NO_SCAN_BYTES
+#ifdef YY_USE_PROTOS
+YY_BUFFER_STATE yy_scan_bytes( yyconst char *bytes, int len )
+#else
+YY_BUFFER_STATE yy_scan_bytes( bytes, len )
+yyconst char *bytes;
+int len;
+#endif
+ {
YY_BUFFER_STATE b;
char *buf;
yy_size_t n;
int i;
-
+
/* Get memory for full buffer, including space for trailing EOB's. */
- n = _yybytes_len + 2;
- buf = (char *) yyalloc(n );
+ n = len + 2;
+ buf = (char *) yy_flex_alloc( n );
if ( ! buf )
YY_FATAL_ERROR( "out of dynamic memory in yy_scan_bytes()" );
- for ( i = 0; i < _yybytes_len; ++i )
- buf[i] = yybytes[i];
+ for ( i = 0; i < len; ++i )
+ buf[i] = bytes[i];
- buf[_yybytes_len] = buf[_yybytes_len+1] = YY_END_OF_BUFFER_CHAR;
+ buf[len] = buf[len+1] = YY_END_OF_BUFFER_CHAR;
- b = yy_scan_buffer(buf,n );
+ b = yy_scan_buffer( buf, n );
if ( ! b )
YY_FATAL_ERROR( "bad buffer in yy_scan_bytes()" );
@@ -1698,196 +1525,148 @@ YY_BUFFER_STATE yy_scan_bytes (yyconst char * yybytes, yy_size_t _yybytes_len
b->yy_is_our_buffer = 1;
return b;
-}
-
-#ifndef YY_EXIT_FAILURE
-#define YY_EXIT_FAILURE 2
+ }
#endif
-static void yy_fatal_error (yyconst char* msg )
-{
- (void) fprintf( stderr, "%s\n", msg );
- exit( YY_EXIT_FAILURE );
-}
-/* Redefine yyless() so it works in section 3 code. */
+#ifndef YY_NO_PUSH_STATE
+#ifdef YY_USE_PROTOS
+static void yy_push_state( int new_state )
+#else
+static void yy_push_state( new_state )
+int new_state;
+#endif
+ {
+ if ( yy_start_stack_ptr >= yy_start_stack_depth )
+ {
+ yy_size_t new_size;
-#undef yyless
-#define yyless(n) \
- do \
- { \
- /* Undo effects of setting up yytext. */ \
- int yyless_macro_arg = (n); \
- YY_LESS_LINENO(yyless_macro_arg);\
- yytext[yyleng] = (yy_hold_char); \
- (yy_c_buf_p) = yytext + yyless_macro_arg; \
- (yy_hold_char) = *(yy_c_buf_p); \
- *(yy_c_buf_p) = '\0'; \
- yyleng = yyless_macro_arg; \
- } \
- while ( 0 )
+ yy_start_stack_depth += YY_START_STACK_INCR;
+ new_size = yy_start_stack_depth * sizeof( int );
-/* Accessor methods (get/set functions) to struct members. */
+ if ( ! yy_start_stack )
+ yy_start_stack = (int *) yy_flex_alloc( new_size );
-/** Get the current line number.
- *
- */
-int yyget_lineno (void)
-{
-
- return yylineno;
-}
-
-/** Get the input stream.
- *
- */
-FILE *yyget_in (void)
-{
- return yyin;
-}
+ else
+ yy_start_stack = (int *) yy_flex_realloc(
+ (void *) yy_start_stack, new_size );
-/** Get the output stream.
- *
- */
-FILE *yyget_out (void)
-{
- return yyout;
-}
+ if ( ! yy_start_stack )
+ YY_FATAL_ERROR(
+ "out of memory expanding start-condition stack" );
+ }
-/** Get the length of the current token.
- *
- */
-yy_size_t yyget_leng (void)
-{
- return yyleng;
-}
+ yy_start_stack[yy_start_stack_ptr++] = YY_START;
-/** Get the current token.
- *
- */
+ BEGIN(new_state);
+ }
+#endif
-char *yyget_text (void)
-{
- return yytext;
-}
-/** Set the current line number.
- * @param line_number
- *
- */
-void yyset_lineno (int line_number )
-{
-
- yylineno = line_number;
-}
+#ifndef YY_NO_POP_STATE
+static void yy_pop_state()
+ {
+ if ( --yy_start_stack_ptr < 0 )
+ YY_FATAL_ERROR( "start-condition stack underflow" );
-/** Set the input stream. This does not discard the current
- * input buffer.
- * @param in_str A readable stream.
- *
- * @see yy_switch_to_buffer
- */
-void yyset_in (FILE * in_str )
-{
- yyin = in_str ;
-}
+ BEGIN(yy_start_stack[yy_start_stack_ptr]);
+ }
+#endif
-void yyset_out (FILE * out_str )
-{
- yyout = out_str ;
-}
-int yyget_debug (void)
-{
- return yy_flex_debug;
-}
+#ifndef YY_NO_TOP_STATE
+static int yy_top_state()
+ {
+ return yy_start_stack[yy_start_stack_ptr - 1];
+ }
+#endif
-void yyset_debug (int bdebug )
-{
- yy_flex_debug = bdebug ;
-}
+#ifndef YY_EXIT_FAILURE
+#define YY_EXIT_FAILURE 2
+#endif
-static int yy_init_globals (void)
-{
- /* Initialization is the same as for the non-reentrant scanner.
- * This function is called from yylex_destroy(), so don't allocate here.
- */
-
- (yy_buffer_stack) = 0;
- (yy_buffer_stack_top) = 0;
- (yy_buffer_stack_max) = 0;
- (yy_c_buf_p) = (char *) 0;
- (yy_init) = 0;
- (yy_start) = 0;
-
-/* Defined in main.c */
-#ifdef YY_STDINIT
- yyin = stdin;
- yyout = stdout;
+#ifdef YY_USE_PROTOS
+static void yy_fatal_error( yyconst char msg[] )
#else
- yyin = (FILE *) 0;
- yyout = (FILE *) 0;
+static void yy_fatal_error( msg )
+char msg[];
#endif
+ {
+ (void) fprintf( stderr, "%s\n", msg );
+ exit( YY_EXIT_FAILURE );
+ }
- /* For future reference: Set errno on error, since we are called by
- * yylex_init()
- */
- return 0;
-}
-/* yylex_destroy is for both reentrant and non-reentrant scanners. */
-int yylex_destroy (void)
-{
-
- /* Pop the buffer stack, destroying each element. */
- while(YY_CURRENT_BUFFER){
- yy_delete_buffer(YY_CURRENT_BUFFER );
- YY_CURRENT_BUFFER_LVALUE = NULL;
- yypop_buffer_state();
- }
- /* Destroy the stack itself. */
- yyfree((yy_buffer_stack) );
- (yy_buffer_stack) = NULL;
+/* Redefine yyless() so it works in section 3 code. */
- /* Reset the globals. This is important in a non-reentrant scanner so the next time
- * yylex() is called, initialization will occur. */
- yy_init_globals( );
+#undef yyless
+#define yyless(n) \
+ do \
+ { \
+ /* Undo effects of setting up yytext. */ \
+ yytext[yyleng] = yy_hold_char; \
+ yy_c_buf_p = yytext + n; \
+ yy_hold_char = *yy_c_buf_p; \
+ *yy_c_buf_p = '\0'; \
+ yyleng = n; \
+ } \
+ while ( 0 )
- return 0;
-}
-/*
- * Internal utility routines.
- */
+/* Internal utility routines. */
#ifndef yytext_ptr
-static void yy_flex_strncpy (char* s1, yyconst char * s2, int n )
-{
+#ifdef YY_USE_PROTOS
+static void yy_flex_strncpy( char *s1, yyconst char *s2, int n )
+#else
+static void yy_flex_strncpy( s1, s2, n )
+char *s1;
+yyconst char *s2;
+int n;
+#endif
+ {
register int i;
for ( i = 0; i < n; ++i )
s1[i] = s2[i];
-}
+ }
#endif
#ifdef YY_NEED_STRLEN
-static int yy_flex_strlen (yyconst char * s )
-{
+#ifdef YY_USE_PROTOS
+static int yy_flex_strlen( yyconst char *s )
+#else
+static int yy_flex_strlen( s )
+yyconst char *s;
+#endif
+ {
register int n;
for ( n = 0; s[n]; ++n )
;
return n;
-}
+ }
#endif
-void *yyalloc (yy_size_t size )
-{
+
+#ifdef YY_USE_PROTOS
+static void *yy_flex_alloc( yy_size_t size )
+#else
+static void *yy_flex_alloc( size )
+yy_size_t size;
+#endif
+ {
return (void *) malloc( size );
-}
+ }
-void *yyrealloc (void * ptr, yy_size_t size )
-{
+#ifdef YY_USE_PROTOS
+static void *yy_flex_realloc( void *ptr, yy_size_t size )
+#else
+static void *yy_flex_realloc( ptr, size )
+void *ptr;
+yy_size_t size;
+#endif
+ {
/* The cast to (char *) in the following accommodates both
* implementations that use char* generic pointers, and those
* that use void* generic pointers. It works with the latter
@@ -1896,17 +1675,26 @@ void *yyrealloc (void * ptr, yy_size_t size )
* as though doing an assignment.
*/
return (void *) realloc( (char *) ptr, size );
-}
-
-void yyfree (void * ptr )
-{
- free( (char *) ptr ); /* see yyrealloc() for (char *) cast */
-}
-
-#define YYTABLES_NAME "yytables"
+ }
-#line 107 "calclex.l"
+#ifdef YY_USE_PROTOS
+static void yy_flex_free( void *ptr )
+#else
+static void yy_flex_free( ptr )
+void *ptr;
+#endif
+ {
+ free( ptr );
+ }
+#if YY_MAIN
+int main()
+ {
+ yylex();
+ return 0;
+ }
+#endif
+#line 108 "calclex.l"
int
@@ -1914,4 +1702,3 @@ yywrap ()
{
return 1;
}
-
diff --git a/gmp/demos/calc/calclex.l b/gmp/demos/calc/calclex.l
index 44df848fad..32d4fc23cb 100644
--- a/gmp/demos/calc/calclex.l
+++ b/gmp/demos/calc/calclex.l
@@ -1,6 +1,6 @@
/* Lexical analyzer for calc program.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000, 2001, 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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
%{
#include <string.h>
diff --git a/gmp/demos/calc/calcread.c b/gmp/demos/calc/calcread.c
index 40433686c1..53291ff732 100644
--- a/gmp/demos/calc/calcread.c
+++ b/gmp/demos/calc/calcread.c
@@ -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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
#include "calc-common.h"
diff --git a/gmp/demos/expr/Makefile.am b/gmp/demos/expr/Makefile.am
index 369e751743..333cacc496 100644
--- a/gmp/demos/expr/Makefile.am
+++ b/gmp/demos/expr/Makefile.am
@@ -1,32 +1,21 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2001-2004 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
diff --git a/gmp/demos/expr/Makefile.in b/gmp/demos/expr/Makefile.in
index adb9eba91a..5754abece6 100644
--- a/gmp/demos/expr/Makefile.in
+++ b/gmp/demos/expr/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,56 +14,33 @@
@SET_MAKE@
-# Copyright 2001-2004 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libexpr_a_SOURCES) run-expr.c t-expr.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -76,52 +52,47 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
EXTRA_PROGRAMS = run-expr$(EXEEXT) t-expr$(EXEEXT)
subdir = demos/expr
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
libexpr_a_AR = $(AR) $(ARFLAGS)
libexpr_a_LIBADD =
-am_libexpr_a_OBJECTS = expr.$(OBJEXT) exprv.$(OBJEXT) exprz.$(OBJEXT) \
- exprza.$(OBJEXT) exprq.$(OBJEXT) exprqa.$(OBJEXT) \
- exprf.$(OBJEXT) exprfa.$(OBJEXT)
+am_libexpr_a_OBJECTS = expr$U.$(OBJEXT) exprv$U.$(OBJEXT) \
+ exprz$U.$(OBJEXT) exprza$U.$(OBJEXT) exprq$U.$(OBJEXT) \
+ exprqa$U.$(OBJEXT) exprf$U.$(OBJEXT) exprfa$U.$(OBJEXT)
libexpr_a_OBJECTS = $(am_libexpr_a_OBJECTS)
run_expr_SOURCES = run-expr.c
-run_expr_OBJECTS = run-expr.$(OBJEXT)
+run_expr_OBJECTS = run-expr$U.$(OBJEXT)
run_expr_LDADD = $(LDADD)
run_expr_DEPENDENCIES = libexpr.a $(top_builddir)/libgmp.la
t_expr_SOURCES = t-expr.c
-t_expr_OBJECTS = t-expr.$(OBJEXT)
-t_expr_DEPENDENCIES = $(top_builddir)/tests/libtests.la $(LDADD)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+t_expr_OBJECTS = t-expr$U.$(OBJEXT)
+am__DEPENDENCIES_1 = libexpr.a $(top_builddir)/libgmp.la
+t_expr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(am__DEPENDENCIES_1)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libexpr_a_SOURCES) run-expr.c t-expr.c
DIST_SOURCES = $(libexpr_a_SOURCES) run-expr.c t-expr.c
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -135,6 +106,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -150,17 +122,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -174,12 +145,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -194,26 +163,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -223,31 +186,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -271,6 +229,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -278,12 +237,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
# FIXME: This is a workaround for a bug in automake 1.8.4. When the only
@@ -307,14 +262,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps demos/expr/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps demos/expr/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps demos/expr/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps demos/expr/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -332,23 +287,27 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-libexpr.a: $(libexpr_a_OBJECTS) $(libexpr_a_DEPENDENCIES) $(EXTRA_libexpr_a_DEPENDENCIES)
+libexpr.a: $(libexpr_a_OBJECTS) $(libexpr_a_DEPENDENCIES)
-rm -f libexpr.a
$(libexpr_a_AR) libexpr.a $(libexpr_a_OBJECTS) $(libexpr_a_LIBADD)
$(RANLIB) libexpr.a
-run-expr$(EXEEXT): $(run_expr_OBJECTS) $(run_expr_DEPENDENCIES) $(EXTRA_run_expr_DEPENDENCIES)
+run-expr$(EXEEXT): $(run_expr_OBJECTS) $(run_expr_DEPENDENCIES)
@rm -f run-expr$(EXEEXT)
- $(LINK) $(run_expr_OBJECTS) $(run_expr_LDADD) $(LIBS)
-t-expr$(EXEEXT): $(t_expr_OBJECTS) $(t_expr_DEPENDENCIES) $(EXTRA_t_expr_DEPENDENCIES)
+ $(LINK) $(run_expr_LDFLAGS) $(run_expr_OBJECTS) $(run_expr_LDADD) $(LIBS)
+t-expr$(EXEEXT): $(t_expr_OBJECTS) $(t_expr_DEPENDENCIES)
@rm -f t-expr$(EXEEXT)
- $(LINK) $(t_expr_OBJECTS) $(t_expr_LDADD) $(LIBS)
+ $(LINK) $(t_expr_LDFLAGS) $(t_expr_OBJECTS) $(t_expr_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -358,6 +317,31 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+expr_.c: expr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/expr.c; then echo $(srcdir)/expr.c; else echo expr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+exprf_.c: exprf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exprf.c; then echo $(srcdir)/exprf.c; else echo exprf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+exprfa_.c: exprfa.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exprfa.c; then echo $(srcdir)/exprfa.c; else echo exprfa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+exprq_.c: exprq.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exprq.c; then echo $(srcdir)/exprq.c; else echo exprq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+exprqa_.c: exprqa.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exprqa.c; then echo $(srcdir)/exprqa.c; else echo exprqa.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+exprv_.c: exprv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exprv.c; then echo $(srcdir)/exprv.c; else echo exprv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+exprz_.c: exprz.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exprz.c; then echo $(srcdir)/exprz.c; else echo exprz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+exprza_.c: exprza.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/exprza.c; then echo $(srcdir)/exprza.c; else echo exprza.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+run-expr_.c: run-expr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/run-expr.c; then echo $(srcdir)/run-expr.c; else echo run-expr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-expr_.c: t-expr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-expr.c; then echo $(srcdir)/t-expr.c; else echo t-expr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+expr_.$(OBJEXT) expr_.lo exprf_.$(OBJEXT) exprf_.lo exprfa_.$(OBJEXT) \
+exprfa_.lo exprq_.$(OBJEXT) exprq_.lo exprqa_.$(OBJEXT) exprqa_.lo \
+exprv_.$(OBJEXT) exprv_.lo exprz_.$(OBJEXT) exprz_.lo \
+exprza_.$(OBJEXT) exprza_.lo run-expr_.$(OBJEXT) run-expr_.lo \
+t-expr_.$(OBJEXT) t-expr_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -365,85 +349,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -461,23 +442,17 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -489,7 +464,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -497,38 +472,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -537,7 +492,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -548,29 +503,24 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
allprogs: $(EXTRA_PROGRAMS)
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/demos/expr/README b/gmp/demos/expr/README
index a54fe42c08..2283cd3ff3 100644
--- a/gmp/demos/expr/README
+++ b/gmp/demos/expr/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -101,7 +90,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 stdarg list
+Variables can be included in expressions by putting them in the varargs list
after the string. "a", "b", "c" etc in the expression string designate
those values. For example,
@@ -485,7 +474,7 @@ Assignment could be an operator attribute, making it expect an lvalue.
There would want to be a standard table without assignments available
though, so user input could be safely parsed.
-The closing parenthesis table entry could specify the type of open paren it
+The closing parethesis table entry could specify the type of open paren it
expects, so that "(" and ")" could match and "[" and "]" match but not a
mixture of the two. Currently "[" and "]" can be added, but there's no
error on writing a mixed expression like "2*(3+4]". Maybe also there could
diff --git a/gmp/demos/expr/expr-impl.h b/gmp/demos/expr/expr-impl.h
index 9b6458fbd0..e6050c5622 100644
--- a/gmp/demos/expr/expr-impl.h
+++ b/gmp/demos/expr/expr-impl.h
@@ -1,34 +1,37 @@
/* Implementation specifics for expression evaluation.
-Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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/. */
-
+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
#include <stdarg.h>
+#else
+#define HAVE_STDARG 0
+#include <varargs.h>
+#endif
#include "expr.h"
@@ -50,76 +53,83 @@ union mpX_t {
};
typedef union mpX_t *mpX_ptr;
-typedef const union mpX_t *mpX_srcptr;
-
-typedef void (*mpexpr_fun_one_t) (mpX_ptr);
-typedef unsigned long (*mpexpr_fun_ui_one_t) (mpX_ptr);
-
-typedef void (*mpexpr_fun_0ary_t) (mpX_ptr);
-typedef int (*mpexpr_fun_i_0ary_t) (void);
-
-typedef void (*mpexpr_fun_unary_t) (mpX_ptr, mpX_srcptr);
-typedef void (*mpexpr_fun_unary_ui_t) (mpX_ptr, unsigned long);
-typedef int (*mpexpr_fun_i_unary_t) (mpX_srcptr);
-typedef int (*mpexpr_fun_i_unary_ui_t) (unsigned long);
-
-typedef void (*mpexpr_fun_binary_t) (mpX_ptr, mpX_srcptr, mpX_srcptr);
-typedef void (*mpexpr_fun_binary_ui_t) (mpX_ptr, mpX_srcptr, unsigned long);
-typedef int (*mpexpr_fun_i_binary_t) (mpX_srcptr, mpX_srcptr);
-typedef int (*mpexpr_fun_i_binary_ui_t) (mpX_srcptr, unsigned long);
-
-typedef void (*mpexpr_fun_ternary_t) (mpX_ptr, mpX_srcptr, mpX_srcptr, mpX_srcptr);
-typedef void (*mpexpr_fun_ternary_ui_t) (mpX_ptr, mpX_srcptr, mpX_srcptr, unsigned long);
-typedef int (*mpexpr_fun_i_ternary_t) (mpX_srcptr, mpX_srcptr, mpX_srcptr);
-typedef int (*mpexpr_fun_i_ternary_ui_t) (mpX_srcptr, mpX_srcptr, unsigned long);
-
-typedef size_t (*mpexpr_fun_number_t) (mpX_ptr, const char *str, size_t len, int base);
-typedef void (*mpexpr_fun_swap_t) (mpX_ptr, mpX_ptr);
-typedef unsigned long (*mpexpr_fun_get_ui_t) (mpX_srcptr);
-typedef void (*mpexpr_fun_set_si_t) (mpX_srcptr, long);
+typedef __gmp_const union mpX_t *mpX_srcptr;
+
+typedef void (*mpexpr_fun_one_t) __GMP_PROTO ((mpX_ptr));
+typedef unsigned long (*mpexpr_fun_ui_one_t) __GMP_PROTO ((mpX_ptr));
+
+typedef void (*mpexpr_fun_0ary_t) __GMP_PROTO ((mpX_ptr));
+typedef int (*mpexpr_fun_i_0ary_t) __GMP_PROTO ((void));
+
+typedef void (*mpexpr_fun_unary_t) __GMP_PROTO ((mpX_ptr, mpX_srcptr));
+typedef void (*mpexpr_fun_unary_ui_t) __GMP_PROTO ((mpX_ptr, unsigned long));
+typedef int (*mpexpr_fun_i_unary_t) __GMP_PROTO ((mpX_srcptr));
+typedef int (*mpexpr_fun_i_unary_ui_t) __GMP_PROTO ((unsigned long));
+
+typedef void (*mpexpr_fun_binary_t) __GMP_PROTO ((mpX_ptr, mpX_srcptr, mpX_srcptr));
+typedef void (*mpexpr_fun_binary_ui_t) __GMP_PROTO ((mpX_ptr, mpX_srcptr, unsigned long));
+typedef int (*mpexpr_fun_i_binary_t) __GMP_PROTO ((mpX_srcptr, mpX_srcptr));
+typedef int (*mpexpr_fun_i_binary_ui_t) __GMP_PROTO ((mpX_srcptr, unsigned long));
+
+typedef void (*mpexpr_fun_ternary_t)
+ __GMP_PROTO ((mpX_ptr, mpX_srcptr, mpX_srcptr, mpX_srcptr));
+typedef void (*mpexpr_fun_ternary_ui_t)
+ __GMP_PROTO ((mpX_ptr, mpX_srcptr, mpX_srcptr, unsigned long));
+typedef int (*mpexpr_fun_i_ternary_t)
+ __GMP_PROTO ((mpX_srcptr, mpX_srcptr, mpX_srcptr));
+typedef int (*mpexpr_fun_i_ternary_ui_t)
+ __GMP_PROTO ((mpX_srcptr, mpX_srcptr, unsigned long));
+
+typedef size_t (*mpexpr_fun_number_t)
+ __GMP_PROTO ((mpX_ptr, __gmp_const char *str, size_t len, int base));
+typedef void (*mpexpr_fun_swap_t) __GMP_PROTO ((mpX_ptr, mpX_ptr));
+typedef unsigned long (*mpexpr_fun_get_ui_t) __GMP_PROTO ((mpX_srcptr));
+typedef void (*mpexpr_fun_set_si_t) __GMP_PROTO ((mpX_srcptr, long));
struct mpexpr_control_t {
- const struct mpexpr_operator_t *op;
- int argcount;
+ __gmp_const struct mpexpr_operator_t *op;
+ int argcount;
};
#define MPEXPR_VARIABLES 26
struct mpexpr_parse_t {
- const struct mpexpr_operator_t *table;
-
- mpX_ptr res;
- int base;
- unsigned long prec;
- const char *e;
- size_t elen;
- mpX_srcptr *var;
- int error_code;
-
- int token;
- const struct mpexpr_operator_t *token_op;
-
- union mpX_t *data_stack;
- int data_top;
- int data_alloc;
- int data_inited;
-
- struct mpexpr_control_t *control_stack;
- int control_top;
- int control_alloc;
-
- mpexpr_fun_0ary_t mpX_clear;
- mpexpr_fun_i_unary_t mpX_ulong_p;
- mpexpr_fun_get_ui_t mpX_get_ui;
- mpexpr_fun_unary_ui_t mpX_init;
- mpexpr_fun_number_t mpX_number;
- mpexpr_fun_unary_t mpX_set;
- mpexpr_fun_unary_t mpX_set_or_swap;
- mpexpr_fun_set_si_t mpX_set_si;
- mpexpr_fun_swap_t mpX_swap;
+ __gmp_const struct mpexpr_operator_t *table;
+
+ mpX_ptr res;
+ int base;
+ unsigned long prec;
+ __gmp_const char *e;
+ size_t elen;
+ mpX_srcptr *var;
+ int error_code;
+
+ int token;
+ __gmp_const struct mpexpr_operator_t *token_op;
+
+ union mpX_t *data_stack;
+ int data_top;
+ int data_alloc;
+ int data_inited;
+
+ struct mpexpr_control_t *control_stack;
+ int control_top;
+ int control_alloc;
+
+
+ mpexpr_fun_0ary_t mpX_clear;
+ mpexpr_fun_i_unary_t mpX_ulong_p;
+ mpexpr_fun_get_ui_t mpX_get_ui;
+ mpexpr_fun_unary_ui_t mpX_init;
+ mpexpr_fun_number_t mpX_number;
+ mpexpr_fun_unary_t mpX_set;
+ mpexpr_fun_unary_t mpX_set_or_swap;
+ mpexpr_fun_set_si_t mpX_set_si;
+ mpexpr_fun_swap_t mpX_swap;
};
-int mpexpr_evaluate (struct mpexpr_parse_t *p);
-int mpexpr_va_to_var (void *var[], va_list ap);
-size_t mpexpr_mpz_number (mpz_ptr res, const char *e, size_t elen, int base);
+int mpexpr_evaluate __GMP_PROTO ((struct mpexpr_parse_t *p));
+int mpexpr_va_to_var __GMP_PROTO ((void *var[], va_list ap));
+size_t mpexpr_mpz_number __GMP_PROTO ((mpz_ptr res,
+ __gmp_const char *e, size_t elen, int base));
diff --git a/gmp/demos/expr/expr.c b/gmp/demos/expr/expr.c
index 42dd7966be..f78c321738 100644
--- a/gmp/demos/expr/expr.c
+++ b/gmp/demos/expr/expr.c
@@ -1,32 +1,21 @@
/* mpexpr_evaluate -- shared code for simple expression evaluation
-Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <ctype.h>
#include <stdio.h>
@@ -147,7 +136,7 @@ see https://www.gnu.org/licenses/. */
static int
lookahead (struct mpexpr_parse_t *p, int prefix)
{
- const struct mpexpr_operator_t *op, *op_found;
+ __gmp_const struct mpexpr_operator_t *op, *op_found;
size_t oplen, oplen_found, wlen;
int i;
@@ -289,7 +278,7 @@ lookahead (struct mpexpr_parse_t *p, int prefix)
a reference through CP. */
#define CONTROL_PUSH(opptr,args) \
do { \
- const struct mpexpr_operator_t *op = opptr; \
+ __gmp_const struct mpexpr_operator_t *op = opptr; \
struct mpexpr_control_t *cp; \
CONTROL_SPACE (); \
p->control_top++; \
@@ -382,7 +371,7 @@ mpexpr_evaluate (struct mpexpr_parse_t *p)
/* "done" is a special sentinel at the bottom of the control stack,
precedence -1 is lower than any normal operator. */
{
- static const struct mpexpr_operator_t operator_done
+ static __gmp_const struct mpexpr_operator_t operator_done
= { "DONE", NULL, MPEXPR_TYPE_DONE, -1 };
p->control_alloc = 20;
diff --git a/gmp/demos/expr/expr.h b/gmp/demos/expr/expr.h
index d3b7c77cc3..c3525b61ee 100644
--- a/gmp/demos/expr/expr.h
+++ b/gmp/demos/expr/expr.h
@@ -1,32 +1,21 @@
/* Header for expression evaluation.
-Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#ifndef __EXPR_H__
@@ -109,34 +98,32 @@ see https://www.gnu.org/licenses/. */
#define MPEXPR_TYPE_OPERATOR 0x2000
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-typedef void (*mpexpr_fun_t) (void);
+typedef void (*mpexpr_fun_t) __GMP_PROTO ((void));
struct mpexpr_operator_t {
- const char *name;
- mpexpr_fun_t fun;
- int type;
- int precedence;
+ __gmp_const char *name;
+ mpexpr_fun_t fun;
+ int type;
+ int precedence;
};
-int mpf_expr_a (const struct mpexpr_operator_t *, mpf_ptr, int,
- unsigned long, const char *, size_t, mpf_srcptr [26]);
-int mpf_expr (mpf_ptr, int, const char *, ...);
+int mpf_expr_a __GMP_PROTO ((__gmp_const struct mpexpr_operator_t *table,
+ mpf_ptr res, int base, unsigned long prec,
+ __gmp_const char *e, size_t elen,
+ mpf_srcptr var[26]));
+int mpf_expr __GMP_PROTO ((mpf_ptr res, int base, __gmp_const char *e, ...));
-int mpq_expr_a (const struct mpexpr_operator_t *, mpq_ptr,
- int, const char *, size_t, mpq_srcptr [26]);
-int mpq_expr (mpq_ptr, int, const char *, ...);
+int mpq_expr_a __GMP_PROTO ((__gmp_const struct mpexpr_operator_t *table,
+ mpq_ptr res, int base,
+ __gmp_const char *e, size_t elen,
+ mpq_srcptr var[26]));
+int mpq_expr __GMP_PROTO ((mpq_ptr res, int base, __gmp_const char *e, ...));
-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
+int mpz_expr_a __GMP_PROTO ((__gmp_const struct mpexpr_operator_t *table,
+ mpz_ptr res, int base,
+ __gmp_const char *e, size_t elen,
+ mpz_srcptr var[26]));
+int mpz_expr __GMP_PROTO ((mpz_ptr res, int base, __gmp_const char *e, ...));
#endif
diff --git a/gmp/demos/expr/exprf.c b/gmp/demos/expr/exprf.c
index 1f7e21f893..c67ee51783 100644
--- a/gmp/demos/expr/exprf.c
+++ b/gmp/demos/expr/exprf.c
@@ -1,32 +1,21 @@
/* mpf expression evaluation
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <string.h>
@@ -45,7 +34,7 @@ e_mpf_sgn (mpf_srcptr x)
}
-static const struct mpexpr_operator_t _mpf_expr_standard_table[] = {
+static __gmp_const struct mpexpr_operator_t _mpf_expr_standard_table[] = {
{ "**", (mpexpr_fun_t) mpf_pow_ui,
MPEXPR_TYPE_BINARY_UI | MPEXPR_TYPE_RIGHTASSOC, 220 },
@@ -99,17 +88,32 @@ static const struct mpexpr_operator_t _mpf_expr_standard_table[] = {
{ NULL }
};
-const struct mpexpr_operator_t * const mpf_expr_standard_table
+__gmp_const struct mpexpr_operator_t * __gmp_const mpf_expr_standard_table
= _mpf_expr_standard_table;
int
-mpf_expr (mpf_ptr res, int base, const char *e, ...)
+#if HAVE_STDARG
+mpf_expr (mpf_ptr res, int base, __gmp_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;
+ __gmp_const char *e;
+ va_start (ap);
+ res = va_arg (ap, mpf_ptr);
+ base = va_arg (ap, int);
+ e = va_arg (ap, __gmp_const char *);
+#endif
TRACE (printf ("mpf_expr(): base %d, %s\n", base, e));
ret = mpexpr_va_to_var ((void **) var, ap);
diff --git a/gmp/demos/expr/exprfa.c b/gmp/demos/expr/exprfa.c
index 1918cb55cd..1cc00e0f04 100644
--- a/gmp/demos/expr/exprfa.c
+++ b/gmp/demos/expr/exprfa.c
@@ -1,32 +1,21 @@
/* mpf expression evaluation
-Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Future: Bitwise "&", "|" and "&" could be done, if desired. Not sure
@@ -46,7 +35,7 @@ see https://www.gnu.org/licenses/. */
static size_t
-e_mpf_number (mpf_ptr res, const char *e, size_t elen, int base)
+e_mpf_number (mpf_ptr res, __gmp_const char *e, size_t elen, int base)
{
char *edup;
size_t i, ret, extra=0;
@@ -162,9 +151,9 @@ e_mpf_set_or_swap (mpf_ptr w, mpf_ptr x)
int
-mpf_expr_a (const struct mpexpr_operator_t *table,
+mpf_expr_a (__gmp_const struct mpexpr_operator_t *table,
mpf_ptr res, int base, unsigned long prec,
- const char *e, size_t elen,
+ __gmp_const char *e, size_t elen,
mpf_srcptr var[26])
{
struct mpexpr_parse_t p;
diff --git a/gmp/demos/expr/exprq.c b/gmp/demos/expr/exprq.c
index 96432006ef..af91b00167 100644
--- a/gmp/demos/expr/exprq.c
+++ b/gmp/demos/expr/exprq.c
@@ -1,32 +1,21 @@
/* mpq expression evaluation
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <string.h>
@@ -83,7 +72,7 @@ e_mpq_den (mpq_ptr w, mpq_srcptr x)
}
-static const struct mpexpr_operator_t _mpq_expr_standard_table[] = {
+static __gmp_const struct mpexpr_operator_t _mpq_expr_standard_table[] = {
{ "**", (mpexpr_fun_t) e_mpq_pow_ui,
MPEXPR_TYPE_BINARY_UI | MPEXPR_TYPE_RIGHTASSOC, 220 },
@@ -132,17 +121,32 @@ static const struct mpexpr_operator_t _mpq_expr_standard_table[] = {
{ NULL }
};
-const struct mpexpr_operator_t * const mpq_expr_standard_table
+__gmp_const struct mpexpr_operator_t * __gmp_const mpq_expr_standard_table
= _mpq_expr_standard_table;
int
-mpq_expr (mpq_ptr res, int base, const char *e, ...)
+#if HAVE_STDARG
+mpq_expr (mpq_ptr res, int base, __gmp_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;
+ __gmp_const char *e;
+ va_start (ap);
+ res = va_arg (ap, mpq_ptr);
+ base = va_arg (ap, int);
+ e = va_arg (ap, __gmp_const char *);
+#endif
TRACE (printf ("mpq_expr(): base %d, %s\n", base, e));
ret = mpexpr_va_to_var ((void **) var, ap);
diff --git a/gmp/demos/expr/exprqa.c b/gmp/demos/expr/exprqa.c
index f3b6ecb495..c56f1ca691 100644
--- a/gmp/demos/expr/exprqa.c
+++ b/gmp/demos/expr/exprqa.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
@@ -57,7 +46,7 @@ e_mpq_set_si1 (mpq_ptr q, long num)
/* The same as mpz, but putting the result in the numerator. Negatives and
fractions aren't parsed here because '-' and '/' are operators. */
static size_t
-e_mpq_number (mpq_ptr res, const char *e, size_t elen, int base)
+e_mpq_number (mpq_ptr res, __gmp_const char *e, size_t elen, int base)
{
mpz_set_ui (mpq_denref (res), 1L);
return mpexpr_mpz_number (mpq_numref (res), e, elen, base);
@@ -72,9 +61,9 @@ e_mpq_init (mpq_ptr q, unsigned long prec)
}
int
-mpq_expr_a (const struct mpexpr_operator_t *table,
+mpq_expr_a (__gmp_const struct mpexpr_operator_t *table,
mpq_ptr res, int base,
- const char *e, size_t elen,
+ __gmp_const char *e, size_t elen,
mpq_srcptr var[26])
{
struct mpexpr_parse_t p;
diff --git a/gmp/demos/expr/exprv.c b/gmp/demos/expr/exprv.c
index c25741b023..b53682eec6 100644
--- a/gmp/demos/expr/exprv.c
+++ b/gmp/demos/expr/exprv.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
diff --git a/gmp/demos/expr/exprz.c b/gmp/demos/expr/exprz.c
index bac1a9992e..7c01b9dc5f 100644
--- a/gmp/demos/expr/exprz.c
+++ b/gmp/demos/expr/exprz.c
@@ -1,32 +1,21 @@
/* mpz expression evaluation, simple part
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <ctype.h>
#include <stdio.h>
@@ -97,7 +86,7 @@ e_mpz_clrbit (mpz_ptr w, mpz_srcptr x, unsigned long n)
mpz_clrbit (w, n);
}
-static const struct mpexpr_operator_t _mpz_expr_standard_table[] = {
+static __gmp_const struct mpexpr_operator_t _mpz_expr_standard_table[] = {
{ "**", (mpexpr_fun_t) mpz_pow_ui,
MPEXPR_TYPE_BINARY_UI | MPEXPR_TYPE_RIGHTASSOC, 220 },
@@ -183,17 +172,32 @@ static const struct mpexpr_operator_t _mpz_expr_standard_table[] = {
/* The table is available globally only through a pointer, so the table size
can change without breaking binary compatibility. */
-const struct mpexpr_operator_t * const mpz_expr_standard_table
+__gmp_const struct mpexpr_operator_t * __gmp_const mpz_expr_standard_table
= _mpz_expr_standard_table;
int
-mpz_expr (mpz_ptr res, int base, const char *e, ...)
+#if HAVE_STDARG
+mpz_expr (mpz_ptr res, int base, __gmp_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;
+ __gmp_const char *e;
+ va_start (ap);
+ res = va_arg (ap, mpz_ptr);
+ base = va_arg (ap, int);
+ e = va_arg (ap, __gmp_const char *);
+#endif
TRACE (printf ("mpz_expr(): base %d, %s\n", base, e));
ret = mpexpr_va_to_var ((void **) var, ap);
diff --git a/gmp/demos/expr/exprza.c b/gmp/demos/expr/exprza.c
index eda830d970..81e16ce286 100644
--- a/gmp/demos/expr/exprza.c
+++ b/gmp/demos/expr/exprza.c
@@ -1,32 +1,21 @@
/* mpz expression evaluation
-Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <ctype.h>
#include <stdio.h>
@@ -38,7 +27,7 @@ see https://www.gnu.org/licenses/. */
/* No need to parse '-' since that's handled as an operator.
This function also by mpq_expr_a, so it's not static. */
size_t
-mpexpr_mpz_number (mpz_ptr res, const char *e, size_t elen, int base)
+mpexpr_mpz_number (mpz_ptr res, __gmp_const char *e, size_t elen, int base)
{
char *edup;
size_t i, ret;
@@ -80,9 +69,9 @@ e_mpz_init (mpz_ptr z, unsigned long prec)
}
int
-mpz_expr_a (const struct mpexpr_operator_t *table,
+mpz_expr_a (__gmp_const struct mpexpr_operator_t *table,
mpz_ptr res, int base,
- const char *e, size_t elen,
+ __gmp_const char *e, size_t elen,
mpz_srcptr var[26])
{
struct mpexpr_parse_t p;
diff --git a/gmp/demos/expr/run-expr.c b/gmp/demos/expr/run-expr.c
index 706b910287..169f5a8814 100644
--- a/gmp/demos/expr/run-expr.c
+++ b/gmp/demos/expr/run-expr.c
@@ -1,32 +1,21 @@
/* Demo program to run expression evaluation.
-Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Usage: ./run-expr [-z] [-q] [-f] [-p prec] [-b base] expression...
diff --git a/gmp/demos/expr/t-expr.c b/gmp/demos/expr/t-expr.c
index 2f808dd8cd..195350e829 100644
--- a/gmp/demos/expr/t-expr.c
+++ b/gmp/demos/expr/t-expr.c
@@ -1,32 +1,21 @@
/* Test expression evaluation (print nothing and exit 0 if successful).
-Copyright 2000-2004 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/demos/factorize.c b/gmp/demos/factorize.c
index 0d5f26d909..0d6c11ee45 100644
--- a/gmp/demos/factorize.c
+++ b/gmp/demos/factorize.c
@@ -1,6 +1,7 @@
/* Factoring with Pollard's rho method.
-Copyright 1995, 1997-2003, 2005, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1995, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2005 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
@@ -12,375 +13,297 @@ 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/. */
+this program. If not, see http://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
-#include <inttypes.h>
#include "gmp.h"
-static unsigned char primes_diff[] = {
-#define P(a,b,c) a,
-#include "primes.h"
-#undef P
-};
-#define PRIMES_PTAB_ENTRIES (sizeof(primes_diff) / sizeof(primes_diff[0]))
-
int flag_verbose = 0;
-/* Prove primality or run probabilistic tests. */
-int flag_prove_primality = 1;
-
-/* Number of Miller-Rabin tests to run when not proving primality. */
-#define MR_REPS 25
-
-struct factors
-{
- mpz_t *p;
- unsigned long *e;
- long nfactors;
-};
-
-void factor (mpz_t, struct factors *);
+static unsigned add[] = {4, 2, 4, 2, 4, 6, 2, 6};
void
-factor_init (struct factors *factors)
+factor_using_division (mpz_t t, unsigned int limit)
{
- factors->p = malloc (1);
- factors->e = malloc (1);
- factors->nfactors = 0;
-}
+ mpz_t q, r;
+ unsigned long int f;
+ int ai;
+ unsigned *addv = add;
+ unsigned int failures;
-void
-factor_clear (struct factors *factors)
-{
- int i;
-
- for (i = 0; i < factors->nfactors; i++)
- mpz_clear (factors->p[i]);
-
- free (factors->p);
- free (factors->e);
-}
-
-void
-factor_insert (struct factors *factors, mpz_t prime)
-{
- long nfactors = factors->nfactors;
- mpz_t *p = factors->p;
- unsigned long *e = factors->e;
- long i, j;
-
- /* Locate position for insert new or increment e. */
- for (i = nfactors - 1; i >= 0; i--)
+ if (flag_verbose)
{
- if (mpz_cmp (p[i], prime) <= 0)
- break;
+ printf ("[trial division (%u)] ", limit);
+ fflush (stdout);
}
- if (i < 0 || mpz_cmp (p[i], prime) != 0)
- {
- p = realloc (p, (nfactors + 1) * sizeof p[0]);
- e = realloc (e, (nfactors + 1) * sizeof e[0]);
-
- mpz_init (p[nfactors]);
- for (j = nfactors - 1; j > i; j--)
- {
- mpz_set (p[j + 1], p[j]);
- e[j + 1] = e[j];
- }
- mpz_set (p[i + 1], prime);
- e[i + 1] = 1;
+ mpz_init (q);
+ mpz_init (r);
- factors->p = p;
- factors->e = e;
- factors->nfactors = nfactors + 1;
- }
- else
+ f = mpz_scan1 (t, 0);
+ mpz_div_2exp (t, t, f);
+ while (f)
{
- e[i] += 1;
+ printf ("2 ");
+ fflush (stdout);
+ --f;
}
-}
-
-void
-factor_insert_ui (struct factors *factors, unsigned long prime)
-{
- mpz_t pz;
-
- mpz_init_set_ui (pz, prime);
- factor_insert (factors, pz);
- mpz_clear (pz);
-}
-
-
-void
-factor_using_division (mpz_t t, struct factors *factors)
-{
- mpz_t q;
- unsigned long int p;
- int i;
- if (flag_verbose > 0)
+ for (;;)
{
- printf ("[trial division] ");
+ mpz_tdiv_qr_ui (q, r, t, 3);
+ if (mpz_cmp_ui (r, 0) != 0)
+ break;
+ mpz_set (t, q);
+ printf ("3 ");
+ fflush (stdout);
}
- mpz_init (q);
-
- p = mpz_scan1 (t, 0);
- mpz_div_2exp (t, t, p);
- while (p)
+ for (;;)
{
- factor_insert_ui (factors, 2);
- --p;
+ mpz_tdiv_qr_ui (q, r, t, 5);
+ if (mpz_cmp_ui (r, 0) != 0)
+ break;
+ mpz_set (t, q);
+ printf ("5 ");
+ fflush (stdout);
}
- p = 3;
- for (i = 1; i <= PRIMES_PTAB_ENTRIES;)
+ failures = 0;
+ f = 7;
+ ai = 0;
+ while (mpz_cmp_ui (t, 1) != 0)
{
- if (! mpz_divisible_ui_p (t, p))
+ mpz_tdiv_qr_ui (q, r, t, f);
+ if (mpz_cmp_ui (r, 0) != 0)
{
- p += primes_diff[i++];
- if (mpz_cmp_ui (t, p * p) < 0)
+ f += addv[ai];
+ if (mpz_cmp_ui (q, f) < 0)
+ break;
+ ai = (ai + 1) & 7;
+ failures++;
+ if (failures > limit)
break;
}
else
{
- mpz_tdiv_q_ui (t, t, p);
- factor_insert_ui (factors, p);
+ mpz_swap (t, q);
+ printf ("%lu ", f);
+ fflush (stdout);
+ failures = 0;
}
}
mpz_clear (q);
+ mpz_clear (r);
}
-static int
-mp_millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, mpz_ptr y,
- mpz_srcptr q, unsigned long int k)
-{
- unsigned long int i;
-
- mpz_powm (y, x, q, n);
-
- if (mpz_cmp_ui (y, 1) == 0 || mpz_cmp (y, nm1) == 0)
- return 1;
-
- for (i = 1; i < k; i++)
- {
- mpz_powm_ui (y, y, 2, n);
- if (mpz_cmp (y, nm1) == 0)
- return 1;
- if (mpz_cmp_ui (y, 1) == 0)
- return 0;
- }
- return 0;
-}
-
-int
-mp_prime_p (mpz_t n)
+void
+factor_using_division_2kp (mpz_t t, unsigned int limit, unsigned long p)
{
- int k, r, is_prime;
- mpz_t q, a, nm1, tmp;
- struct factors factors;
-
- if (mpz_cmp_ui (n, 1) <= 0)
- return 0;
+ mpz_t r;
+ mpz_t f;
+ unsigned int k;
- /* We have already casted out small primes. */
- if (mpz_cmp_ui (n, (long) FIRST_OMITTED_PRIME * FIRST_OMITTED_PRIME) < 0)
- return 1;
-
- mpz_inits (q, a, nm1, tmp, NULL);
-
- /* Precomputation for Miller-Rabin. */
- mpz_sub_ui (nm1, n, 1);
-
- /* Find q and k, where q is odd and n = 1 + 2**k * q. */
- k = mpz_scan1 (nm1, 0);
- mpz_tdiv_q_2exp (q, nm1, k);
-
- mpz_set_ui (a, 2);
-
- /* Perform a Miller-Rabin test, finds most composites quickly. */
- if (!mp_millerrabin (n, nm1, a, tmp, q, k))
+ if (flag_verbose)
{
- is_prime = 0;
- goto ret2;
+ printf ("[trial division (%u)] ", limit);
+ fflush (stdout);
}
- if (flag_prove_primality)
+ mpz_init (r);
+ mpz_init_set_ui (f, 2 * p);
+ mpz_add_ui (f, f, 1);
+ for (k = 1; k < limit; k++)
{
- /* Factor n-1 for Lucas. */
- mpz_set (tmp, nm1);
- factor (tmp, &factors);
- }
-
- /* Loop until Lucas proves our number prime, or Miller-Rabin proves our
- number composite. */
- for (r = 0; r < PRIMES_PTAB_ENTRIES; r++)
- {
- int i;
-
- if (flag_prove_primality)
+ mpz_tdiv_r (r, t, f);
+ while (mpz_cmp_ui (r, 0) == 0)
{
- is_prime = 1;
- for (i = 0; i < factors.nfactors && is_prime; i++)
- {
- mpz_divexact (tmp, nm1, factors.p[i]);
- mpz_powm (tmp, a, tmp, n);
- is_prime = mpz_cmp_ui (tmp, 1) != 0;
- }
- }
- else
- {
- /* After enough Miller-Rabin runs, be content. */
- is_prime = (r == MR_REPS - 1);
- }
-
- if (is_prime)
- goto ret1;
-
- mpz_add_ui (a, a, primes_diff[r]); /* Establish new base. */
-
- if (!mp_millerrabin (n, nm1, a, tmp, q, k))
- {
- is_prime = 0;
- goto ret1;
+ mpz_tdiv_q (t, t, f);
+ mpz_tdiv_r (r, t, f);
+ mpz_out_str (stdout, 10, f);
+ fflush (stdout);
+ fputc (' ', stdout);
}
+ mpz_add_ui (f, f, 2 * p);
}
- fprintf (stderr, "Lucas prime test failure. This should not happen\n");
- abort ();
-
- ret1:
- if (flag_prove_primality)
- factor_clear (&factors);
- ret2:
- mpz_clears (q, a, nm1, tmp, NULL);
-
- return is_prime;
+ mpz_clear (f);
+ mpz_clear (r);
}
void
-factor_using_pollard_rho (mpz_t n, unsigned long a, struct factors *factors)
+factor_using_pollard_rho (mpz_t n, int a_int, unsigned long p)
{
- mpz_t x, z, y, P;
- mpz_t t, t2;
- unsigned long long k, l, i;
+ mpz_t x, x1, y, P;
+ mpz_t a;
+ mpz_t g;
+ mpz_t t1, t2;
+ int k, l, c, i;
- if (flag_verbose > 0)
+ if (flag_verbose)
{
- printf ("[pollard-rho (%lu)] ", a);
+ printf ("[pollard-rho (%d)] ", a_int);
+ fflush (stdout);
}
- mpz_inits (t, t2, NULL);
+ mpz_init (g);
+ mpz_init (t1);
+ mpz_init (t2);
+
+ mpz_init_set_si (a, a_int);
mpz_init_set_si (y, 2);
mpz_init_set_si (x, 2);
- mpz_init_set_si (z, 2);
- mpz_init_set_ui (P, 1);
+ mpz_init_set_si (x1, 2);
k = 1;
l = 1;
+ mpz_init_set_ui (P, 1);
+ c = 0;
while (mpz_cmp_ui (n, 1) != 0)
{
- for (;;)
+S2:
+ if (p != 0)
{
- do
+ mpz_powm_ui (x, x, p, n); mpz_add (x, x, a);
+ }
+ else
+ {
+ mpz_mul (x, x, x); mpz_add (x, x, a); mpz_mod (x, x, n);
+ }
+ mpz_sub (t1, x1, x); mpz_mul (t2, P, t1); mpz_mod (P, t2, n);
+ c++;
+ if (c == 20)
+ {
+ c = 0;
+ mpz_gcd (g, P, n);
+ if (mpz_cmp_ui (g, 1) != 0)
+ goto S4;
+ mpz_set (y, x);
+ }
+S3:
+ k--;
+ if (k > 0)
+ goto S2;
+
+ mpz_gcd (g, P, n);
+ if (mpz_cmp_ui (g, 1) != 0)
+ goto S4;
+
+ mpz_set (x1, x);
+ k = l;
+ l = 2 * l;
+ for (i = 0; i < k; i++)
+ {
+ if (p != 0)
{
- mpz_mul (t, x, x);
- mpz_mod (x, t, n);
- mpz_add_ui (x, x, a);
-
- mpz_sub (t, z, x);
- mpz_mul (t2, P, t);
- mpz_mod (P, t2, n);
-
- if (k % 32 == 1)
- {
- mpz_gcd (t, P, n);
- if (mpz_cmp_ui (t, 1) != 0)
- goto factor_found;
- mpz_set (y, x);
- }
+ mpz_powm_ui (x, x, p, n); mpz_add (x, x, a);
}
- while (--k != 0);
-
- mpz_set (z, x);
- k = l;
- l = 2 * l;
- for (i = 0; i < k; i++)
+ else
{
- mpz_mul (t, x, x);
- mpz_mod (x, t, n);
- mpz_add_ui (x, x, a);
+ mpz_mul (x, x, x); mpz_add (x, x, a); mpz_mod (x, x, n);
}
- mpz_set (y, x);
}
-
- factor_found:
+ mpz_set (y, x);
+ c = 0;
+ goto S2;
+S4:
do
{
- mpz_mul (t, y, y);
- mpz_mod (y, t, n);
- mpz_add_ui (y, y, a);
-
- mpz_sub (t, z, y);
- mpz_gcd (t, t, n);
+ if (p != 0)
+ {
+ mpz_powm_ui (y, y, p, n); mpz_add (y, y, a);
+ }
+ else
+ {
+ mpz_mul (y, y, y); mpz_add (y, y, a); mpz_mod (y, y, n);
+ }
+ mpz_sub (t1, x1, y); mpz_gcd (g, t1, n);
}
- while (mpz_cmp_ui (t, 1) == 0);
+ while (mpz_cmp_ui (g, 1) == 0);
- mpz_divexact (n, n, t); /* divide by t, before t is overwritten */
+ mpz_div (n, n, g); /* divide by g, before g is overwritten */
- if (!mp_prime_p (t))
+ if (!mpz_probab_prime_p (g, 3))
{
- if (flag_verbose > 0)
+ do
+ {
+ mp_limb_t a_limb;
+ mpn_random (&a_limb, (mp_size_t) 1);
+ a_int = (int) a_limb;
+ }
+ while (a_int == -2 || a_int == 0);
+
+ if (flag_verbose)
{
printf ("[composite factor--restarting pollard-rho] ");
+ fflush (stdout);
}
- factor_using_pollard_rho (t, a + 1, factors);
+ factor_using_pollard_rho (g, a_int, p);
}
else
{
- factor_insert (factors, t);
+ mpz_out_str (stdout, 10, g);
+ fflush (stdout);
+ fputc (' ', stdout);
}
-
- if (mp_prime_p (n))
+ mpz_mod (x, x, n);
+ mpz_mod (x1, x1, n);
+ mpz_mod (y, y, n);
+ if (mpz_probab_prime_p (n, 3))
{
- factor_insert (factors, n);
+ mpz_out_str (stdout, 10, n);
+ fflush (stdout);
+ fputc (' ', stdout);
break;
}
-
- mpz_mod (x, x, n);
- mpz_mod (z, z, n);
- mpz_mod (y, y, n);
}
- mpz_clears (P, t2, t, z, x, y, NULL);
+ mpz_clear (g);
+ mpz_clear (P);
+ mpz_clear (t2);
+ mpz_clear (t1);
+ mpz_clear (a);
+ mpz_clear (x1);
+ mpz_clear (x);
+ mpz_clear (y);
}
void
-factor (mpz_t t, struct factors *factors)
+factor (mpz_t t, unsigned long p)
{
- factor_init (factors);
+ unsigned int division_limit;
- if (mpz_sgn (t) != 0)
- {
- factor_using_division (t, factors);
+ if (mpz_sgn (t) == 0)
+ return;
- if (mpz_cmp_ui (t, 1) != 0)
+ /* Set the trial division limit according the size of t. */
+ division_limit = mpz_sizeinbase (t, 2);
+ if (division_limit > 1000)
+ division_limit = 1000 * 1000;
+ else
+ division_limit = division_limit * division_limit;
+
+ if (p != 0)
+ factor_using_division_2kp (t, division_limit / 10, p);
+ else
+ factor_using_division (t, division_limit);
+
+ if (mpz_cmp_ui (t, 1) != 0)
+ {
+ if (flag_verbose)
{
- if (flag_verbose > 0)
- {
- printf ("[is number prime?] ");
- }
- if (mp_prime_p (t))
- factor_insert (factors, t);
- else
- factor_using_pollard_rho (t, 1, factors);
+ printf ("[is number prime?] ");
+ fflush (stdout);
}
+ if (mpz_probab_prime_p (t, 3))
+ mpz_out_str (stdout, 10, t);
+ else
+ factor_using_pollard_rho (t, 1, p);
}
}
@@ -388,18 +311,12 @@ int
main (int argc, char *argv[])
{
mpz_t t;
- int i, j, k;
- struct factors factors;
+ unsigned long p;
+ int i;
- while (argc > 1)
+ if (argc > 1 && !strcmp (argv[1], "-v"))
{
- if (!strcmp (argv[1], "-v"))
- flag_verbose = 1;
- else if (!strcmp (argv[1], "-w"))
- flag_prove_primality = 0;
- else
- break;
-
+ flag_verbose = 1;
argv++;
argc--;
}
@@ -407,19 +324,33 @@ main (int argc, char *argv[])
mpz_init (t);
if (argc > 1)
{
+ p = 0;
for (i = 1; i < argc; i++)
{
- mpz_set_str (t, argv[i], 0);
-
- gmp_printf ("%Zd:", t);
- factor (t, &factors);
-
- for (j = 0; j < factors.nfactors; j++)
- for (k = 0; k < factors.e[j]; k++)
- gmp_printf (" %Zd", factors.p[j]);
+ if (!strncmp (argv[i], "-Mp", 3))
+ {
+ p = atoi (argv[i] + 3);
+ mpz_set_ui (t, 1);
+ mpz_mul_2exp (t, t, p);
+ mpz_sub_ui (t, t, 1);
+ }
+ else if (!strncmp (argv[i], "-2kp", 4))
+ {
+ p = atoi (argv[i] + 4);
+ continue;
+ }
+ else
+ {
+ mpz_set_str (t, argv[i], 0);
+ }
- puts ("");
- factor_clear (&factors);
+ if (mpz_cmp_ui (t, 0) == 0)
+ puts ("-");
+ else
+ {
+ factor (t, p);
+ puts ("");
+ }
}
}
else
@@ -429,16 +360,9 @@ main (int argc, char *argv[])
mpz_inp_str (t, stdin, 0);
if (feof (stdin))
break;
-
- gmp_printf ("%Zd:", t);
- factor (t, &factors);
-
- for (j = 0; j < factors.nfactors; j++)
- for (k = 0; k < factors.e[j]; k++)
- gmp_printf (" %Zd", factors.p[j]);
-
+ mpz_out_str (stdout, 10, t); printf (" = ");
+ factor (t, 0);
puts ("");
- factor_clear (&factors);
}
}
diff --git a/gmp/demos/isprime.c b/gmp/demos/isprime.c
index 40ee70eb99..5b245dd088 100644
--- a/gmp/demos/isprime.c
+++ b/gmp/demos/isprime.c
@@ -1,7 +1,7 @@
/* Classify numbers as probable primes, primes or composites.
With -q return true if the following argument is a (probable) prime.
-Copyright 1999, 2000, 2002, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2002, 2005 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 +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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <string.h>
@@ -47,7 +47,7 @@ main (int argc, char **argv)
{
if (mpz_set_str (n, argv[2], 0) != 0)
print_usage_and_exit ();
- exit (mpz_probab_prime_p (n, 25) == 0);
+ exit (mpz_probab_prime_p (n, 5) == 0);
}
for (i = 1; i < argc; i++)
@@ -55,7 +55,7 @@ main (int argc, char **argv)
int class;
if (mpz_set_str (n, argv[i], 0) != 0)
print_usage_and_exit ();
- class = mpz_probab_prime_p (n, 25);
+ class = mpz_probab_prime_p (n, 5);
mpz_out_str (stdout, 10, n);
if (class == 0)
puts (" is composite");
diff --git a/gmp/demos/perl/GMP.pm b/gmp/demos/perl/GMP.pm
index 46bc707cfe..00b6761662 100644
--- a/gmp/demos/perl/GMP.pm
+++ b/gmp/demos/perl/GMP.pm
@@ -1,32 +1,21 @@
# GMP perl module
-# Copyright 2001-2004 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://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
@@ -220,7 +209,7 @@ and must be a multiple of $size bytes. C<mpz_export> conversely returns a
string of byte data, which will be a multiple of $size bytes.
C<invert> returns the inverse, or undef if it doesn't exist. C<remove>
-returns a remainder/multiplicity pair. C<root> returns the nth root, and
+returns a remainder/multiplicty pair. C<root> returns the nth root, and
C<roote> returns a root/bool pair, the bool indicating whether the root is
exact. C<sqrtrem> and C<rootrem> return a root/remainder pair.
@@ -488,7 +477,7 @@ corresponding GMP function. For example,
Arguments to operators and functions are converted as necessary to the
appropriate type. For instance C<**> requires an unsigned integer exponent,
and an mpq argument will be converted, so long as it's an integer in the
-appropriate range.
+apropriate range.
use GMP::Mpz (mpz);
use GMP::Mpq (mpq);
@@ -635,33 +624,22 @@ Some assertion checking is available as a compile-time option.
=head1 COPYRIGHT
-Copyright 2001-2004 Free Software Foundation, Inc.
+Copyright 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
=cut
diff --git a/gmp/demos/perl/GMP.xs b/gmp/demos/perl/GMP.xs
index 9738259c2a..2282c89282 100644
--- a/gmp/demos/perl/GMP.xs
+++ b/gmp/demos/perl/GMP.xs
@@ -1,32 +1,21 @@
/* GMP module external subroutines.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
/* Notes:
diff --git a/gmp/demos/perl/GMP/Mpf.pm b/gmp/demos/perl/GMP/Mpf.pm
index 4c0dec6cea..ea7b28b40e 100644
--- a/gmp/demos/perl/GMP/Mpf.pm
+++ b/gmp/demos/perl/GMP/Mpf.pm
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
package GMP::Mpf;
diff --git a/gmp/demos/perl/GMP/Mpq.pm b/gmp/demos/perl/GMP/Mpq.pm
index fe010849e0..cd60cbef17 100644
--- a/gmp/demos/perl/GMP/Mpq.pm
+++ b/gmp/demos/perl/GMP/Mpq.pm
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
package GMP::Mpq;
diff --git a/gmp/demos/perl/GMP/Mpz.pm b/gmp/demos/perl/GMP/Mpz.pm
index 27e6336775..a86d4aba4d 100644
--- a/gmp/demos/perl/GMP/Mpz.pm
+++ b/gmp/demos/perl/GMP/Mpz.pm
@@ -1,32 +1,21 @@
# GMP mpz module.
-# Copyright 2001-2003 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
package GMP::Mpz;
diff --git a/gmp/demos/perl/GMP/Rand.pm b/gmp/demos/perl/GMP/Rand.pm
index 9f7d763dd5..049c729353 100644
--- a/gmp/demos/perl/GMP/Rand.pm
+++ b/gmp/demos/perl/GMP/Rand.pm
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
package GMP::Rand;
diff --git a/gmp/demos/perl/INSTALL b/gmp/demos/perl/INSTALL
index f3d7c53b1c..e503c79dd8 100644
--- a/gmp/demos/perl/INSTALL
+++ b/gmp/demos/perl/INSTALL
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/demos/perl/Makefile.PL b/gmp/demos/perl/Makefile.PL
index a676710c1c..c30b503439 100644
--- a/gmp/demos/perl/Makefile.PL
+++ b/gmp/demos/perl/Makefile.PL
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Bugs:
diff --git a/gmp/demos/perl/sample.pl b/gmp/demos/perl/sample.pl
index 8a10ee1ebb..20ca5a7040 100644
--- a/gmp/demos/perl/sample.pl
+++ b/gmp/demos/perl/sample.pl
@@ -4,31 +4,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
use strict;
diff --git a/gmp/demos/perl/test.pl b/gmp/demos/perl/test.pl
index 2b54089165..40a903378d 100644
--- a/gmp/demos/perl/test.pl
+++ b/gmp/demos/perl/test.pl
@@ -2,33 +2,22 @@
# GMP perl module tests
-# Copyright 2001-2003 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# These tests aim to exercise the many possible combinations of operands
diff --git a/gmp/demos/perl/test2.pl b/gmp/demos/perl/test2.pl
index 31a1d6bdd9..645d3cfbb7 100644
--- a/gmp/demos/perl/test2.pl
+++ b/gmp/demos/perl/test2.pl
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have 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 following uses of :constants seem to provoke segvs in perl 5.005_03,
diff --git a/gmp/demos/perl/typemap b/gmp/demos/perl/typemap
index e863a9c516..7ad7976418 100644
--- a/gmp/demos/perl/typemap
+++ b/gmp/demos/perl/typemap
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
TYPEMAP
@@ -84,7 +73,7 @@ ULONG_COERCE
ORDER_NOSWAP
assert ($arg != &PL_sv_yes);
DUMMY
- /* dummy $var */
+ /* dummy $var */
CONST_STRING_ASSUME
/* No need to check for SvPOKp and use SvPV, this mapping is
only used for overload_constant, which always gets literal
diff --git a/gmp/demos/pexpr-config-h.in b/gmp/demos/pexpr-config-h.in
index b3e7f5d46f..77f767f7ac 100644
--- a/gmp/demos/pexpr-config-h.in
+++ b/gmp/demos/pexpr-config-h.in
@@ -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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
/* Define if you have the <sys/resource.h> header file. */
diff --git a/gmp/demos/pexpr.c b/gmp/demos/pexpr.c
index ce28187811..ec4eecbb2f 100644
--- a/gmp/demos/pexpr.c
+++ b/gmp/demos/pexpr.c
@@ -1,7 +1,7 @@
/* Program for computing integer expressions using the GNU Multiple Precision
Arithmetic Library.
-Copyright 1997, 1999-2002, 2005, 2008, 2012 Free Software Foundation, Inc.
+Copyright 1997, 1999, 2000, 2001, 2002, 2005 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 +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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
/* This expressions evaluator works by building an expression tree (using a
@@ -109,21 +109,21 @@ struct expr
typedef struct expr *expr_t;
-void cleanup_and_exit (int);
-
-char *skipspace (char *);
-void makeexp (expr_t *, enum op_t, expr_t, expr_t);
-void free_expr (expr_t);
-char *expr (char *, expr_t *);
-char *term (char *, expr_t *);
-char *power (char *, expr_t *);
-char *factor (char *, expr_t *);
-int match (char *, char *);
-int matchp (char *, char *);
-int cputime (void);
-
-void mpz_eval_expr (mpz_ptr, expr_t);
-void mpz_eval_mod_expr (mpz_ptr, expr_t, mpz_ptr);
+void cleanup_and_exit __GMP_PROTO ((int));
+
+char *skipspace __GMP_PROTO ((char *));
+void makeexp __GMP_PROTO ((expr_t *, enum op_t, expr_t, expr_t));
+void free_expr __GMP_PROTO ((expr_t));
+char *expr __GMP_PROTO ((char *, expr_t *));
+char *term __GMP_PROTO ((char *, expr_t *));
+char *power __GMP_PROTO ((char *, expr_t *));
+char *factor __GMP_PROTO ((char *, expr_t *));
+int match __GMP_PROTO ((char *, char *));
+int matchp __GMP_PROTO ((char *, char *));
+int cputime __GMP_PROTO ((void));
+
+void mpz_eval_expr __GMP_PROTO ((mpz_ptr, expr_t));
+void mpz_eval_mod_expr __GMP_PROTO ((mpz_ptr, expr_t, mpz_ptr));
char *error;
int flag_print = 1;
diff --git a/gmp/demos/primes.c b/gmp/demos/primes.c
index 3cb32e2e25..db763062ca 100644
--- a/gmp/demos/primes.c
+++ b/gmp/demos/primes.c
@@ -2,7 +2,7 @@
Written by tege while on holiday in Rodupp, August 2001.
Between 10 and 500 times faster than previous program.
-Copyright 2001, 2002, 2006, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2006 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 +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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
#include <stdlib.h>
#include <stdio.h>
@@ -61,9 +61,9 @@ struct primes
struct primes *primes;
unsigned long n_primes;
-void find_primes (unsigned char *, mpz_t, unsigned long, mpz_t);
-void sieve_region (unsigned char *, mpz_t, unsigned long);
-void make_primelist (unsigned long);
+void find_primes __GMP_PROTO ((unsigned char *, mpz_t, unsigned long, mpz_t));
+void sieve_region __GMP_PROTO ((unsigned char *, mpz_t, unsigned long));
+void make_primelist __GMP_PROTO ((unsigned long));
int flag_print = 1;
int flag_count = 0;
@@ -283,7 +283,7 @@ sieve_region (unsigned char *s, mpz_t fr, unsigned long rsize)
{
start = (prime - mpz_tdiv_ui (fr, prime)) % prime;
if (start % 2 != 0)
- start += prime; /* adjust if even divisible */
+ start += prime; /* adjust if even divisable */
}
start2 = start / 2;
}
diff --git a/gmp/demos/primes.h b/gmp/demos/primes.h
deleted file mode 100644
index b85c7e1ff2..0000000000
--- a/gmp/demos/primes.h
+++ /dev/null
@@ -1,552 +0,0 @@
-P( 1, 0xaaaaaaaaaaaaaaabUL, 0x5555555555555555UL) /* 3 */
-P( 2, 0xcccccccccccccccdUL, 0x3333333333333333UL) /* 5 */
-P( 2, 0x6db6db6db6db6db7UL, 0x2492492492492492UL) /* 7 */
-P( 4, 0x2e8ba2e8ba2e8ba3UL, 0x1745d1745d1745d1UL) /* 11 */
-P( 2, 0x4ec4ec4ec4ec4ec5UL, 0x13b13b13b13b13b1UL) /* 13 */
-P( 4, 0xf0f0f0f0f0f0f0f1UL, 0x0f0f0f0f0f0f0f0fUL) /* 17 */
-P( 2, 0x86bca1af286bca1bUL, 0x0d79435e50d79435UL) /* 19 */
-P( 4, 0xd37a6f4de9bd37a7UL, 0x0b21642c8590b216UL) /* 23 */
-P( 6, 0x34f72c234f72c235UL, 0x08d3dcb08d3dcb08UL) /* 29 */
-P( 2, 0xef7bdef7bdef7bdfUL, 0x0842108421084210UL) /* 31 */
-P( 6, 0x14c1bacf914c1badUL, 0x06eb3e45306eb3e4UL) /* 37 */
-P( 4, 0x8f9c18f9c18f9c19UL, 0x063e7063e7063e70UL) /* 41 */
-P( 2, 0x82fa0be82fa0be83UL, 0x05f417d05f417d05UL) /* 43 */
-P( 4, 0x51b3bea3677d46cfUL, 0x0572620ae4c415c9UL) /* 47 */
-P( 6, 0x21cfb2b78c13521dUL, 0x04d4873ecade304dUL) /* 53 */
-P( 6, 0xcbeea4e1a08ad8f3UL, 0x0456c797dd49c341UL) /* 59 */
-P( 2, 0x4fbcda3ac10c9715UL, 0x04325c53ef368eb0UL) /* 61 */
-P( 6, 0xf0b7672a07a44c6bUL, 0x03d226357e16ece5UL) /* 67 */
-P( 4, 0x193d4bb7e327a977UL, 0x039b0ad12073615aUL) /* 71 */
-P( 2, 0x7e3f1f8fc7e3f1f9UL, 0x0381c0e070381c0eUL) /* 73 */
-P( 6, 0x9b8b577e613716afUL, 0x033d91d2a2067b23UL) /* 79 */
-P( 4, 0xa3784a062b2e43dbUL, 0x03159721ed7e7534UL) /* 83 */
-P( 6, 0xf47e8fd1fa3f47e9UL, 0x02e05c0b81702e05UL) /* 89 */
-P( 8, 0xa3a0fd5c5f02a3a1UL, 0x02a3a0fd5c5f02a3UL) /* 97 */
-P( 4, 0x3a4c0a237c32b16dUL, 0x0288df0cac5b3f5dUL) /* 101 */
-P( 2, 0xdab7ec1dd3431b57UL, 0x027c45979c95204fUL) /* 103 */
-P( 4, 0x77a04c8f8d28ac43UL, 0x02647c69456217ecUL) /* 107 */
-P( 2, 0xa6c0964fda6c0965UL, 0x02593f69b02593f6UL) /* 109 */
-P( 4, 0x90fdbc090fdbc091UL, 0x0243f6f0243f6f02UL) /* 113 */
-P(14, 0x7efdfbf7efdfbf7fUL, 0x0204081020408102UL) /* 127 */
-P( 4, 0x03e88cb3c9484e2bUL, 0x01f44659e4a42715UL) /* 131 */
-P( 6, 0xe21a291c077975b9UL, 0x01de5d6e3f8868a4UL) /* 137 */
-P( 2, 0x3aef6ca970586723UL, 0x01d77b654b82c339UL) /* 139 */
-P(10, 0xdf5b0f768ce2cabdUL, 0x01b7d6c3dda338b2UL) /* 149 */
-P( 2, 0x6fe4dfc9bf937f27UL, 0x01b2036406c80d90UL) /* 151 */
-P( 6, 0x5b4fe5e92c0685b5UL, 0x01a16d3f97a4b01aUL) /* 157 */
-P( 6, 0x1f693a1c451ab30bUL, 0x01920fb49d0e228dUL) /* 163 */
-P( 4, 0x8d07aa27db35a717UL, 0x01886e5f0abb0499UL) /* 167 */
-P( 6, 0x882383b30d516325UL, 0x017ad2208e0ecc35UL) /* 173 */
-P( 6, 0xed6866f8d962ae7bUL, 0x016e1f76b4337c6cUL) /* 179 */
-P( 2, 0x3454dca410f8ed9dUL, 0x016a13cd15372904UL) /* 181 */
-P(10, 0x1d7ca632ee936f3fUL, 0x01571ed3c506b39aUL) /* 191 */
-P( 2, 0x70bf015390948f41UL, 0x015390948f40feacUL) /* 193 */
-P( 4, 0xc96bdb9d3d137e0dUL, 0x014cab88725af6e7UL) /* 197 */
-P( 2, 0x2697cc8aef46c0f7UL, 0x0149539e3b2d066eUL) /* 199 */
-P(12, 0xc0e8f2a76e68575bUL, 0x013698df3de07479UL) /* 211 */
-P(12, 0x687763dfdb43bb1fUL, 0x0125e22708092f11UL) /* 223 */
-P( 4, 0x1b10ea929ba144cbUL, 0x0120b470c67c0d88UL) /* 227 */
-P( 2, 0x1d10c4c0478bbcedUL, 0x011e2ef3b3fb8744UL) /* 229 */
-P( 4, 0x63fb9aeb1fdcd759UL, 0x0119453808ca29c0UL) /* 233 */
-P( 6, 0x64afaa4f437b2e0fUL, 0x0112358e75d30336UL) /* 239 */
-P( 2, 0xf010fef010fef011UL, 0x010fef010fef010fUL) /* 241 */
-P(10, 0x28cbfbeb9a020a33UL, 0x0105197f7d734041UL) /* 251 */
-P( 6, 0xff00ff00ff00ff01UL, 0x00ff00ff00ff00ffUL) /* 257 */
-P( 6, 0xd624fd1470e99cb7UL, 0x00f92fb2211855a8UL) /* 263 */
-P( 6, 0x8fb3ddbd6205b5c5UL, 0x00f3a0d52cba8723UL) /* 269 */
-P( 2, 0xd57da36ca27acdefUL, 0x00f1d48bcee0d399UL) /* 271 */
-P( 6, 0xee70c03b25e4463dUL, 0x00ec979118f3fc4dUL) /* 277 */
-P( 4, 0xc5b1a6b80749cb29UL, 0x00e939651fe2d8d3UL) /* 281 */
-P( 2, 0x47768073c9b97113UL, 0x00e79372e225fe30UL) /* 283 */
-P(10, 0x2591e94884ce32adUL, 0x00dfac1f74346c57UL) /* 293 */
-P(14, 0xf02806abc74be1fbUL, 0x00d578e97c3f5fe5UL) /* 307 */
-P( 4, 0x7ec3e8f3a7198487UL, 0x00d2ba083b445250UL) /* 311 */
-P( 2, 0x58550f8a39409d09UL, 0x00d161543e28e502UL) /* 313 */
-P( 4, 0xec9e48ae6f71de15UL, 0x00cebcf8bb5b4169UL) /* 317 */
-P(14, 0x2ff3a018bfce8063UL, 0x00c5fe740317f9d0UL) /* 331 */
-P( 6, 0x7f9ec3fcf61fe7b1UL, 0x00c2780613c0309eUL) /* 337 */
-P(10, 0x89f5abe570e046d3UL, 0x00bcdd535db1cc5bUL) /* 347 */
-P( 2, 0xda971b23f1545af5UL, 0x00bbc8408cd63069UL) /* 349 */
-P( 4, 0x79d5f00b9a7862a1UL, 0x00b9a7862a0ff465UL) /* 353 */
-P( 6, 0x4dba1df32a128a57UL, 0x00b68d31340e4307UL) /* 359 */
-P( 8, 0x87530217b7747d8fUL, 0x00b2927c29da5519UL) /* 367 */
-P( 6, 0x30baae53bb5e06ddUL, 0x00afb321a1496fdfUL) /* 373 */
-P( 6, 0xee70206c12e9b5b3UL, 0x00aceb0f891e6551UL) /* 379 */
-P( 4, 0xcdde9462ec9dbe7fUL, 0x00ab1cbdd3e2970fUL) /* 383 */
-P( 6, 0xafb64b05ec41cf4dUL, 0x00a87917088e262bUL) /* 389 */
-P( 8, 0x02944ff5aec02945UL, 0x00a513fd6bb00a51UL) /* 397 */
-P( 4, 0x2cb033128382df71UL, 0x00a36e71a2cb0331UL) /* 401 */
-P( 8, 0x1ccacc0c84b1c2a9UL, 0x00a03c1688732b30UL) /* 409 */
-P(10, 0x19a93db575eb3a0bUL, 0x009c69169b30446dUL) /* 419 */
-P( 2, 0xcebeef94fa86fe2dUL, 0x009baade8e4a2f6eUL) /* 421 */
-P(10, 0x6faa77fb3f8df54fUL, 0x00980e4156201301UL) /* 431 */
-P( 2, 0x68a58af00975a751UL, 0x00975a750ff68a58UL) /* 433 */
-P( 6, 0xd56e36d0c3efac07UL, 0x009548e4979e0829UL) /* 439 */
-P( 4, 0xd8b44c47a8299b73UL, 0x0093efd1c50e726bUL) /* 443 */
-P( 6, 0x02d9ccaf9ba70e41UL, 0x0091f5bcb8bb02d9UL) /* 449 */
-P( 8, 0x0985e1c023d9e879UL, 0x008f67a1e3fdc261UL) /* 457 */
-P( 4, 0x2a343316c494d305UL, 0x008e2917e0e702c6UL) /* 461 */
-P( 2, 0x70cb7916ab67652fUL, 0x008d8be33f95d715UL) /* 463 */
-P( 4, 0xd398f132fb10fe5bUL, 0x008c55841c815ed5UL) /* 467 */
-P(12, 0x6f2a38a6bf54fa1fUL, 0x0088d180cd3a4133UL) /* 479 */
-P( 8, 0x211df689b98f81d7UL, 0x00869222b1acf1ceUL) /* 487 */
-P( 4, 0x0e994983e90f1ec3UL, 0x0085797b917765abUL) /* 491 */
-P( 8, 0xad671e44bed87f3bUL, 0x008355ace3c897dbUL) /* 499 */
-P( 4, 0xf9623a0516e70fc7UL, 0x00824a4e60b3262bUL) /* 503 */
-P( 6, 0x4b7129be9dece355UL, 0x0080c121b28bd1baUL) /* 509 */
-P(12, 0x190f3b7473f62c39UL, 0x007dc9f3397d4c29UL) /* 521 */
-P( 2, 0x63dacc9aad46f9a3UL, 0x007d4ece8fe88139UL) /* 523 */
-P(18, 0xc1108fda24e8d035UL, 0x0079237d65bcce50UL) /* 541 */
-P( 6, 0xb77578472319bd8bUL, 0x0077cf53c5f7936cUL) /* 547 */
-P(10, 0x473d20a1c7ed9da5UL, 0x0075a8accfbdd11eUL) /* 557 */
-P( 6, 0xfbe85af0fea2c8fbUL, 0x007467ac557c228eUL) /* 563 */
-P( 6, 0x58a1f7e6ce0f4c09UL, 0x00732d70ed8db8e9UL) /* 569 */
-P( 2, 0x1a00e58c544986f3UL, 0x0072c62a24c3797fUL) /* 571 */
-P( 6, 0x7194a17f55a10dc1UL, 0x007194a17f55a10dUL) /* 577 */
-P(10, 0x7084944785e33763UL, 0x006fa549b41da7e7UL) /* 587 */
-P( 6, 0xba10679bd84886b1UL, 0x006e8419e6f61221UL) /* 593 */
-P( 6, 0xebe9c6bb31260967UL, 0x006d68b5356c207bUL) /* 599 */
-P( 2, 0x97a3fe4bd1ff25e9UL, 0x006d0b803685c01bUL) /* 601 */
-P( 6, 0x6c6388395b84d99fUL, 0x006bf790a8b2d207UL) /* 607 */
-P( 6, 0x8c51da6a1335df6dUL, 0x006ae907ef4b96c2UL) /* 613 */
-P( 4, 0x46f3234475d5add9UL, 0x006a37991a23aeadUL) /* 617 */
-P( 2, 0x905605ca3c619a43UL, 0x0069dfbdd4295b66UL) /* 619 */
-P(12, 0xcee8dff304767747UL, 0x0067dc4c45c8033eUL) /* 631 */
-P(10, 0xff99c27f00663d81UL, 0x00663d80ff99c27fUL) /* 641 */
-P( 2, 0xacca407f671ddc2bUL, 0x0065ec17e3559948UL) /* 643 */
-P( 4, 0xe71298bac1e12337UL, 0x00654ac835cfba5cUL) /* 647 */
-P( 6, 0xfa1e94309cd09045UL, 0x00645c854ae10772UL) /* 653 */
-P( 6, 0xbebccb8e91496b9bUL, 0x006372990e5f901fUL) /* 659 */
-P( 2, 0x312fa30cc7d7b8bdUL, 0x006325913c07beefUL) /* 661 */
-P(12, 0x6160ff9e9f006161UL, 0x006160ff9e9f0061UL) /* 673 */
-P( 4, 0x6b03673b5e28152dUL, 0x0060cdb520e5e88eUL) /* 677 */
-P( 6, 0xfe802ffa00bfe803UL, 0x005ff4017fd005ffUL) /* 683 */
-P( 8, 0xe66fe25c9e907c7bUL, 0x005ed79e31a4dccdUL) /* 691 */
-P(10, 0x3f8b236c76528895UL, 0x005d7d42d48ac5efUL) /* 701 */
-P( 8, 0xf6f923bf01ce2c0dUL, 0x005c6f35ccba5028UL) /* 709 */
-P(10, 0x6c3d3d98bed7c42fUL, 0x005b2618ec6ad0a5UL) /* 719 */
-P( 8, 0x30981efcd4b010e7UL, 0x005a2553748e42e7UL) /* 727 */
-P( 6, 0x6f691fc81ebbe575UL, 0x0059686cf744cd5bUL) /* 733 */
-P( 6, 0xb10480ddb47b52cbUL, 0x0058ae97bab79976UL) /* 739 */
-P( 4, 0x74cd59ed64f3f0d7UL, 0x0058345f1876865fUL) /* 743 */
-P( 8, 0x0105cb81316d6c0fUL, 0x005743d5bb24795aUL) /* 751 */
-P( 6, 0x9be64c6d91c1195dUL, 0x005692c4d1ab74abUL) /* 757 */
-P( 4, 0x71b3f945a27b1f49UL, 0x00561e46a4d5f337UL) /* 761 */
-P( 8, 0x77d80d50e508fd01UL, 0x005538ed06533997UL) /* 769 */
-P( 4, 0xa5eb778e133551cdUL, 0x0054c807f2c0bec2UL) /* 773 */
-P(14, 0x18657d3c2d8a3f1bUL, 0x005345efbc572d36UL) /* 787 */
-P(10, 0x2e40e220c34ad735UL, 0x00523a758f941345UL) /* 797 */
-P(12, 0xa76593c70a714919UL, 0x005102370f816c89UL) /* 809 */
-P( 2, 0x1eef452124eea383UL, 0x0050cf129fb94acfUL) /* 811 */
-P(10, 0x38206dc242ba771dUL, 0x004fd31941cafdd1UL) /* 821 */
-P( 2, 0x4cd4c35807772287UL, 0x004fa1704aa75945UL) /* 823 */
-P( 4, 0x83de917d5e69ddf3UL, 0x004f3ed6d45a63adUL) /* 827 */
-P( 2, 0x882ef0403b4a6c15UL, 0x004f0de57154ebedUL) /* 829 */
-P(10, 0xf8fb6c51c606b677UL, 0x004e1cae8815f811UL) /* 839 */
-P(14, 0xb4abaac446d3e1fdUL, 0x004cd47ba5f6ff19UL) /* 853 */
-P( 4, 0xa9f83bbe484a14e9UL, 0x004c78ae734df709UL) /* 857 */
-P( 2, 0x0bebbc0d1ce874d3UL, 0x004c4b19ed85cfb8UL) /* 859 */
-P( 4, 0xbd418eaf0473189fUL, 0x004bf093221d1218UL) /* 863 */
-P(14, 0x44e3af6f372b7e65UL, 0x004aba3c21dc633fUL) /* 877 */
-P( 4, 0xc87fdace4f9e5d91UL, 0x004a6360c344de00UL) /* 881 */
-P( 2, 0xec93479c446bd9bbUL, 0x004a383e9f74d68aUL) /* 883 */
-P( 4, 0xdac4d592e777c647UL, 0x0049e28fbabb9940UL) /* 887 */
-P(20, 0xa63ea8c8f61f0c23UL, 0x0048417b57c78cd7UL) /* 907 */
-P( 4, 0xe476062ea5cbbb6fUL, 0x0047f043713f3a2bUL) /* 911 */
-P( 8, 0xdf68761c69daac27UL, 0x00474ff2a10281cfUL) /* 919 */
-P(10, 0xb813d737637aa061UL, 0x00468b6f9a978f91UL) /* 929 */
-P( 8, 0xa3a77aac1fb15099UL, 0x0045f13f1caff2e2UL) /* 937 */
-P( 4, 0x17f0c3e0712c5825UL, 0x0045a5228cec23e9UL) /* 941 */
-P( 6, 0xfd912a70ff30637bUL, 0x0045342c556c66b9UL) /* 947 */
-P( 6, 0xfbb3b5dc01131289UL, 0x0044c4a23feeced7UL) /* 953 */
-P(14, 0x856d560a0f5acdf7UL, 0x0043c5c20d3c9fe6UL) /* 967 */
-P( 4, 0x96472f314d3f89e3UL, 0x00437e494b239798UL) /* 971 */
-P( 6, 0xa76f5c7ed2253531UL, 0x0043142d118e47cbUL) /* 977 */
-P( 6, 0x816eae7c7bf69fe7UL, 0x0042ab5c73a13458UL) /* 983 */
-P( 8, 0xb6a2bea4cfb1781fUL, 0x004221950db0f3dbUL) /* 991 */
-P( 6, 0xa3900c53318e81edUL, 0x0041bbb2f80a4553UL) /* 997 */
-P(12, 0x60aa7f5d9f148d11UL, 0x0040f391612c6680UL) /* 1009 */
-P( 4, 0x6be8c0102c7a505dUL, 0x0040b1e94173fefdUL) /* 1013 */
-P( 6, 0x8ff3f0ed28728f33UL, 0x004050647d9d0445UL) /* 1019 */
-P( 2, 0x680e0a87e5ec7155UL, 0x004030241b144f3bUL) /* 1021 */
-P(10, 0xbbf70fa49fe829b7UL, 0x003f90c2ab542cb1UL) /* 1031 */
-P( 2, 0xd69d1e7b6a50ca39UL, 0x003f71412d59f597UL) /* 1033 */
-P( 6, 0x1a1e0f46b6d26aefUL, 0x003f137701b98841UL) /* 1039 */
-P(10, 0x7429f9a7a8251829UL, 0x003e79886b60e278UL) /* 1049 */
-P( 2, 0xd9c2219d1b863613UL, 0x003e5b1916a7181dUL) /* 1051 */
-P(10, 0x91406c1820d077adUL, 0x003dc4a50968f524UL) /* 1061 */
-P( 2, 0x521f4ec02e3d2b97UL, 0x003da6e4c9550321UL) /* 1063 */
-P( 6, 0xbb8283b63dc8eba5UL, 0x003d4e4f06f1def3UL) /* 1069 */
-P(18, 0x431eda153229ebbfUL, 0x003c4a6bdd24f9a4UL) /* 1087 */
-P( 4, 0xaf0bf78d7e01686bUL, 0x003c11d54b525c73UL) /* 1091 */
-P( 2, 0xa9ced0742c086e8dUL, 0x003bf5b1c5721065UL) /* 1093 */
-P( 4, 0xc26458ad9f632df9UL, 0x003bbdb9862f23b4UL) /* 1097 */
-P( 6, 0xbbff1255dff892afUL, 0x003b6a8801db5440UL) /* 1103 */
-P( 6, 0xcbd49a333f04d8fdUL, 0x003b183cf0fed886UL) /* 1109 */
-P( 8, 0xec84ed6f9cfdeff5UL, 0x003aabe394bdc3f4UL) /* 1117 */
-P( 6, 0x97980cc40bda9d4bUL, 0x003a5ba3e76156daUL) /* 1123 */
-P( 6, 0x777f34d524f5cbd9UL, 0x003a0c3e953378dbUL) /* 1129 */
-P(22, 0x2797051d94cbbb7fUL, 0x0038f03561320b1eUL) /* 1151 */
-P( 2, 0xea769051b4f43b81UL, 0x0038d6ecaef5908aUL) /* 1153 */
-P(10, 0xce7910f3034d4323UL, 0x003859cf221e6069UL) /* 1163 */
-P( 8, 0x92791d1374f5b99bUL, 0x0037f7415dc9588aUL) /* 1171 */
-P(10, 0x89a5645cc68ea1b5UL, 0x00377df0d3902626UL) /* 1181 */
-P( 6, 0x5f8aacf796c0cf0bUL, 0x00373622136907faUL) /* 1187 */
-P( 6, 0xf2e90a15e33edf99UL, 0x0036ef0c3b39b92fUL) /* 1193 */
-P( 8, 0x8e99e5feb897c451UL, 0x0036915f47d55e6dUL) /* 1201 */
-P(12, 0xaca2eda38fb91695UL, 0x0036072cf3f866fdUL) /* 1213 */
-P( 4, 0x5d9b737be5ea8b41UL, 0x0035d9b737be5ea8UL) /* 1217 */
-P( 6, 0x4aefe1db93fd7cf7UL, 0x0035961559cc81c7UL) /* 1223 */
-P( 6, 0xa0994ef20b3f8805UL, 0x0035531c897a4592UL) /* 1229 */
-P( 2, 0x103890bda912822fUL, 0x00353ceebd3e98a4UL) /* 1231 */
-P( 6, 0xb441659d13a9147dUL, 0x0034fad381585e5eUL) /* 1237 */
-P(12, 0x1e2134440c4c3f21UL, 0x00347884d1103130UL) /* 1249 */
-P(10, 0x263a27727a6883c3UL, 0x00340dd3ac39bf56UL) /* 1259 */
-P(18, 0x78e221472ab33855UL, 0x003351fdfecc140cUL) /* 1277 */
-P( 2, 0x95eac88e82e6faffUL, 0x00333d72b089b524UL) /* 1279 */
-P( 4, 0xf66c258317be8dabUL, 0x0033148d44d6b261UL) /* 1283 */
-P( 6, 0x09ee202c7cb91939UL, 0x0032d7aef8412458UL) /* 1289 */
-P( 2, 0x8d2fca1042a09ea3UL, 0x0032c3850e79c0f1UL) /* 1291 */
-P( 6, 0x82779c856d8b8bf1UL, 0x00328766d59048a2UL) /* 1297 */
-P( 4, 0x3879361cba8a223dUL, 0x00325fa18cb11833UL) /* 1301 */
-P( 2, 0xf23f43639c3182a7UL, 0x00324bd659327e22UL) /* 1303 */
-P( 4, 0xa03868fc474bcd13UL, 0x0032246e784360f4UL) /* 1307 */
-P(12, 0x651e78b8c5311a97UL, 0x0031afa5f1a33a08UL) /* 1319 */
-P( 2, 0x8ffce639c00c6719UL, 0x00319c63ff398e70UL) /* 1321 */
-P( 6, 0xf7b460754b0b61cfUL, 0x003162f7519a86a7UL) /* 1327 */
-P(34, 0x7b03f3359b8e63b1UL, 0x0030271fc9d3fc3cUL) /* 1361 */
-P( 6, 0xa55c5326041eb667UL, 0x002ff104ae89750bUL) /* 1367 */
-P( 6, 0x647f88ab896a76f5UL, 0x002fbb62a236d133UL) /* 1373 */
-P( 8, 0x8fd971434a55a46dUL, 0x002f74997d2070b4UL) /* 1381 */
-P(18, 0x9fbf969958046447UL, 0x002ed84aa8b6fce3UL) /* 1399 */
-P(10, 0x9986feba69be3a81UL, 0x002e832df7a46dbdUL) /* 1409 */
-P(14, 0xa668b3e6d053796fUL, 0x002e0e0846857cabUL) /* 1423 */
-P( 4, 0x97694e6589f4e09bUL, 0x002decfbdfb55ee6UL) /* 1427 */
-P( 2, 0x37890c00b7721dbdUL, 0x002ddc876f3ff488UL) /* 1429 */
-P( 4, 0x5ac094a235f37ea9UL, 0x002dbbc1d4c482c4UL) /* 1433 */
-P( 6, 0x31cff775f2d5d65fUL, 0x002d8af0e0de0556UL) /* 1439 */
-P( 8, 0xddad8e6b36505217UL, 0x002d4a7b7d14b30aUL) /* 1447 */
-P( 4, 0x5a27df897062cd03UL, 0x002d2a85073bcf4eUL) /* 1451 */
-P( 2, 0xe2396fe0fdb5a625UL, 0x002d1a9ab13e8be4UL) /* 1453 */
-P( 6, 0xb352a4957e82317bUL, 0x002ceb1eb4b9fd8bUL) /* 1459 */
-P(12, 0xd8ab3f2c60c2ea3fUL, 0x002c8d503a79794cUL) /* 1471 */
-P(10, 0x6893f702f0452479UL, 0x002c404d708784edUL) /* 1481 */
-P( 2, 0x9686fdc182acf7e3UL, 0x002c31066315ec52UL) /* 1483 */
-P( 4, 0x6854037173dce12fUL, 0x002c1297d80f2664UL) /* 1487 */
-P( 2, 0x7f0ded1685c27331UL, 0x002c037044c55f6bUL) /* 1489 */
-P( 4, 0xeeda72e1fe490b7dUL, 0x002be5404cd13086UL) /* 1493 */
-P( 6, 0x9e7bfc959a8e6e53UL, 0x002bb845adaf0cceUL) /* 1499 */
-P(12, 0x49b314d6d4753dd7UL, 0x002b5f62c639f16dUL) /* 1511 */
-P(12, 0x2e8f8c5ac4aa1b3bUL, 0x002b07e6734f2b88UL) /* 1523 */
-P( 8, 0xb8ef723481163d33UL, 0x002ace569d8342b7UL) /* 1531 */
-P(12, 0x6a2ec96a594287b7UL, 0x002a791d5dbd4dcfUL) /* 1543 */
-P( 6, 0xdba41c6d13aab8c5UL, 0x002a4eff8113017cUL) /* 1549 */
-P( 4, 0xc2adbe648dc3aaf1UL, 0x002a3319e156df32UL) /* 1553 */
-P( 6, 0x87a2bade565f91a7UL, 0x002a0986286526eaUL) /* 1559 */
-P( 8, 0x4d6fe8798c01f5dfUL, 0x0029d29551d91e39UL) /* 1567 */
-P( 4, 0x3791310c8c23d98bUL, 0x0029b7529e109f0aUL) /* 1571 */
-P( 8, 0xf80e446b01228883UL, 0x00298137491ea465UL) /* 1579 */
-P( 4, 0x9aed1436fbf500cfUL, 0x0029665e1eb9f9daUL) /* 1583 */
-P(14, 0x7839b54cc8b24115UL, 0x002909752e019a5eUL) /* 1597 */
-P( 4, 0xc128c646ad0309c1UL, 0x0028ef35e2e5efb0UL) /* 1601 */
-P( 6, 0x14de631624a3c377UL, 0x0028c815aa4b8278UL) /* 1607 */
-P( 2, 0x3f7b9fe68b0ecbf9UL, 0x0028bb1b867199daUL) /* 1609 */
-P( 4, 0x284ffd75ec00a285UL, 0x0028a13ff5d7b002UL) /* 1613 */
-P( 6, 0x37803cb80dea2ddbUL, 0x00287ab3f173e755UL) /* 1619 */
-P( 2, 0x86b63f7c9ac4c6fdUL, 0x00286dead67713bdUL) /* 1621 */
-P( 6, 0x8b6851d1bd99b9d3UL, 0x002847bfcda6503eUL) /* 1627 */
-P(10, 0xb62fda77ca343b6dUL, 0x002808c1ea6b4777UL) /* 1637 */
-P(20, 0x1f0dc009e34383c9UL, 0x00278d0e0f23ff61UL) /* 1657 */
-P( 6, 0x496dc21ddd35b97fUL, 0x002768863c093c7fUL) /* 1663 */
-P( 4, 0xb0e96ce17090f82bUL, 0x0027505115a73ca8UL) /* 1667 */
-P( 2, 0xaadf05acdd7d024dUL, 0x00274441a61dc1b9UL) /* 1669 */
-P(24, 0xcb138196746eafb5UL, 0x0026b5c166113cf0UL) /* 1693 */
-P( 4, 0x347f523736755d61UL, 0x00269e65ad07b18eUL) /* 1697 */
-P( 2, 0xd14a48a051f7dd0bUL, 0x002692c25f877560UL) /* 1699 */
-P(10, 0x474d71b1ce914d25UL, 0x002658fa7523cd11UL) /* 1709 */
-P(12, 0x386063f5e28c1f89UL, 0x0026148710cf0f9eUL) /* 1721 */
-P( 2, 0x1db7325e32d04e73UL, 0x002609363b22524fUL) /* 1723 */
-P(10, 0xfef748d3893b880dUL, 0x0025d1065a1c1122UL) /* 1733 */
-P( 8, 0x2f3351506e935605UL, 0x0025a48a382b863fUL) /* 1741 */
-P( 6, 0x7a3637fa2376415bUL, 0x0025837190eccdbcUL) /* 1747 */
-P( 6, 0x4ac525d2baa21969UL, 0x00256292e95d510cUL) /* 1753 */
-P( 6, 0x3a11c16b42cd351fUL, 0x002541eda98d068cUL) /* 1759 */
-P(18, 0x6c7abde0049c2a11UL, 0x0024e15087fed8f5UL) /* 1777 */
-P( 6, 0x54dad0303e069ac7UL, 0x0024c18b20979e5dUL) /* 1783 */
-P( 4, 0xebf1ac9fdfe91433UL, 0x0024ac7b336de0c5UL) /* 1787 */
-P( 2, 0xfafdda8237cec655UL, 0x0024a1fc478c60bbUL) /* 1789 */
-P(12, 0xdce3ff6e71ffb739UL, 0x002463801231c009UL) /* 1801 */
-P(10, 0xbed5737d6286db1bUL, 0x0024300fd506ed33UL) /* 1811 */
-P(12, 0xe479e431fe08b4dfUL, 0x0023f314a494da81UL) /* 1823 */
-P( 8, 0x9dd9b0dd7742f897UL, 0x0023cadedd2fad3aUL) /* 1831 */
-P(16, 0x8f09d7402c5a5e87UL, 0x00237b7ed2664a03UL) /* 1847 */
-P(14, 0x9216d5c4d958738dUL, 0x0023372967dbaf1dUL) /* 1861 */
-P( 6, 0xb3139ba11d34ca63UL, 0x00231a308a371f20UL) /* 1867 */
-P( 4, 0x47d54f7ed644afafUL, 0x002306fa63e1e600UL) /* 1871 */
-P( 2, 0x92a81d85cf11a1b1UL, 0x0022fd6731575684UL) /* 1873 */
-P( 4, 0x754b26533253bdfdUL, 0x0022ea507805749cUL) /* 1877 */
-P( 2, 0xbbe0efc980bfd467UL, 0x0022e0cce8b3d720UL) /* 1879 */
-P(10, 0xc0d8d594f024dca1UL, 0x0022b1887857d161UL) /* 1889 */
-P(12, 0x8238d43bcaac1a65UL, 0x00227977fcc49cc0UL) /* 1901 */
-P( 6, 0x27779c1fae6175bbUL, 0x00225db37b5e5f4fUL) /* 1907 */
-P( 6, 0xa746ca9af708b2c9UL, 0x0022421b91322ed6UL) /* 1913 */
-P(18, 0x93f3cd9f389be823UL, 0x0021f05b35f52102UL) /* 1931 */
-P( 2, 0x5cb4a4c04c489345UL, 0x0021e75de5c70d60UL) /* 1933 */
-P(16, 0xbf6047743e85b6b5UL, 0x0021a01d6c19be96UL) /* 1949 */
-P( 2, 0x61c147831563545fUL, 0x0021974a6615c81aUL) /* 1951 */
-P(22, 0xedb47c0ae62dee9dUL, 0x00213767697cf36aUL) /* 1973 */
-P( 6, 0x0a3824386673a573UL, 0x00211d9f7fad35f1UL) /* 1979 */
-P( 8, 0xa4a77d19e575a0ebUL, 0x0020fb7d9dd36c18UL) /* 1987 */
-P( 6, 0xa2bee045e066c279UL, 0x0020e2123d661e0eUL) /* 1993 */
-P( 4, 0xc23618de8ab43d05UL, 0x0020d135b66ae990UL) /* 1997 */
-P( 2, 0x266b515216cb9f2fUL, 0x0020c8cded4d7a8eUL) /* 1999 */
-P( 4, 0xe279edd9e9c2e85bUL, 0x0020b80b3f43ddbfUL) /* 2003 */
-P( 8, 0xd0c591c221dc9c53UL, 0x002096b9180f46a6UL) /* 2011 */
-P( 6, 0x06da8ee9c9ee7c21UL, 0x00207de7e28de5daUL) /* 2017 */
-P(10, 0x9dfebcaf4c27e8c3UL, 0x002054dec8cf1fb3UL) /* 2027 */
-P( 2, 0x49aeff9f19dd6de5UL, 0x00204cb630b3aab5UL) /* 2029 */
-P(10, 0x86976a57a296e9c7UL, 0x00202428adc37bebUL) /* 2039 */
-P(14, 0xa3b9abf4872b84cdUL, 0x001fec0c7834def4UL) /* 2053 */
-P(10, 0x34fca6483895e6efUL, 0x001fc46fae98a1d0UL) /* 2063 */
-P( 6, 0x34b5a333988f873dUL, 0x001facda430ff619UL) /* 2069 */
-P(12, 0xd9dd4f19b5f17be1UL, 0x001f7e17dd8e15e5UL) /* 2081 */
-P( 2, 0xb935b507fd0ce78bUL, 0x001f765a3556a4eeUL) /* 2083 */
-P( 4, 0xb450f5540660e797UL, 0x001f66ea49d802f1UL) /* 2087 */
-P( 2, 0x63ff82831ffc1419UL, 0x001f5f3800faf9c0UL) /* 2089 */
-P(10, 0x8992f718c22a32fbUL, 0x001f38f4e6c0f1f9UL) /* 2099 */
-P(12, 0x5f3253ad0d37e7bfUL, 0x001f0b8546752578UL) /* 2111 */
-P( 2, 0x007c0ffe0fc007c1UL, 0x001f03ff83f001f0UL) /* 2113 */
-P(16, 0x4d8ebadc0c0640b1UL, 0x001ec853b0a3883cUL) /* 2129 */
-P( 2, 0xe2729af831037bdbUL, 0x001ec0ee573723ebUL) /* 2131 */
-P( 6, 0xb8f64bf30feebfe9UL, 0x001eaad38e6f6894UL) /* 2137 */
-P( 4, 0xda93124b544c0bf5UL, 0x001e9c28a765fe53UL) /* 2141 */
-P( 2, 0x9cf7ff0b593c539fUL, 0x001e94d8758c2003UL) /* 2143 */
-P(10, 0xd6bd8861fa0e07d9UL, 0x001e707ba8f65e68UL) /* 2153 */
-P( 8, 0x5cfe75c0bd8ab891UL, 0x001e53a2a68f574eUL) /* 2161 */
-P(18, 0x43e808757c2e862bUL, 0x001e1380a56b438dUL) /* 2179 */
-P(24, 0x90caa96d595c9d93UL, 0x001dbf9f513a3802UL) /* 2203 */
-P( 4, 0x8fd550625d07135fUL, 0x001db1d1d58bc600UL) /* 2207 */
-P( 6, 0x76b010a86e209f2dUL, 0x001d9d358f53de38UL) /* 2213 */
-P( 8, 0xecc0426447769b25UL, 0x001d81e6df6165c7UL) /* 2221 */
-P(16, 0xe381339caabe3295UL, 0x001d4bdf7fd40e30UL) /* 2237 */
-P( 2, 0xd1b190a2d0c7673fUL, 0x001d452c7a1c958dUL) /* 2239 */
-P( 4, 0xc3bce3cf26b0e7ebUL, 0x001d37cf9b902659UL) /* 2243 */
-P( 8, 0x5f87e76f56c61ce3UL, 0x001d1d3a5791e97bUL) /* 2251 */
-P(16, 0xc06c6857a124b353UL, 0x001ce89fe6b47416UL) /* 2267 */
-P( 2, 0x38c040fcba630f75UL, 0x001ce219f3235071UL) /* 2269 */
-P( 4, 0xd078bc4fbd533b21UL, 0x001cd516dcf92139UL) /* 2273 */
-P( 8, 0xde8e15c5dd354f59UL, 0x001cbb33bd1c2b8bUL) /* 2281 */
-P( 6, 0xca61d53d7414260fUL, 0x001ca7e7d2546688UL) /* 2287 */
-P( 6, 0xb56bf5ba8eae635dUL, 0x001c94b5c1b3dbd3UL) /* 2293 */
-P( 4, 0x44a72cb0fb6e3949UL, 0x001c87f7f9c241c1UL) /* 2297 */
-P(12, 0x879839a714f45bcdUL, 0x001c6202706c35a9UL) /* 2309 */
-P( 2, 0x02a8994fde5314b7UL, 0x001c5bb8a9437632UL) /* 2311 */
-P(22, 0xb971920cf2b90135UL, 0x001c174343b4111eUL) /* 2333 */
-P( 6, 0x8a8fd0b7df9a6e8bUL, 0x001c04d0d3e46b42UL) /* 2339 */
-P( 2, 0xb31f9a84c1c6eaadUL, 0x001bfeb00fbf4308UL) /* 2341 */
-P( 6, 0x92293b02823c6d83UL, 0x001bec5dce0b202dUL) /* 2347 */
-P( 4, 0xeee77ff20fe5ddcfUL, 0x001be03444620037UL) /* 2351 */
-P( 6, 0x0e1ea0f6c496c11dUL, 0x001bce09c66f6fc3UL) /* 2357 */
-P(14, 0xfdf2d3d6f88ccb6bUL, 0x001ba40228d02b30UL) /* 2371 */
-P( 6, 0xfa9d74a3457738f9UL, 0x001b9225b1cf8919UL) /* 2377 */
-P( 4, 0xefc3ca3db71a5785UL, 0x001b864a2ff3f53fUL) /* 2381 */
-P( 2, 0x8e2071718d0d6dafUL, 0x001b80604150e49bUL) /* 2383 */
-P( 6, 0xbc0fdbfeb6cfabfdUL, 0x001b6eb1aaeaacf3UL) /* 2389 */
-P( 4, 0x1eeab613e5e5aee9UL, 0x001b62f48da3c8ccUL) /* 2393 */
-P( 6, 0x2d2388e90e9e929fUL, 0x001b516babe96092UL) /* 2399 */
-P(12, 0x81dbafba588ddb43UL, 0x001b2e9cef1e0c87UL) /* 2411 */
-P( 6, 0x52eebc51c4799791UL, 0x001b1d56bedc849bUL) /* 2417 */
-P( 6, 0x1c6bc4693b45a047UL, 0x001b0c267546aec0UL) /* 2423 */
-P(14, 0x06eee0974498874dUL, 0x001ae45f62024fa0UL) /* 2437 */
-P( 4, 0xd85b7377a9953cb9UL, 0x001ad917631b5f54UL) /* 2441 */
-P( 6, 0x4b6df412d4caf56fUL, 0x001ac83d18cb608fUL) /* 2447 */
-P(12, 0x6b8afbbb4a053493UL, 0x001aa6c7ad8c063fUL) /* 2459 */
-P( 8, 0xcc5299c96ac7720bUL, 0x001a90a7b1228e2aUL) /* 2467 */
-P( 6, 0xadce84b5c710aa99UL, 0x001a8027c03ba059UL) /* 2473 */
-P( 4, 0x9d673f5aa3804225UL, 0x001a7533289deb89UL) /* 2477 */
-P(26, 0xe6541268efbce7f7UL, 0x001a2ed7ce16b49fUL) /* 2503 */
-P(18, 0xfcf41e76cf5be669UL, 0x0019fefc0a279a73UL) /* 2521 */
-P(10, 0x5c3eb5dc31c383cbUL, 0x0019e4b0cd873b5fUL) /* 2531 */
-P( 8, 0x301832d11d8ad6c3UL, 0x0019cfcdfd60e514UL) /* 2539 */
-P( 4, 0x2e9c0942f1ce450fUL, 0x0019c56932d66c85UL) /* 2543 */
-P( 6, 0x97f3f2be37a39a5dUL, 0x0019b5e1ab6fc7c2UL) /* 2549 */
-P( 2, 0xe8b7d8a9654187c7UL, 0x0019b0b8a62f2a73UL) /* 2551 */
-P( 6, 0xb5d024d7da5b1b55UL, 0x0019a149fc98942cUL) /* 2557 */
-P(22, 0xb8ba9d6e7ae3501bUL, 0x001969517ec25b85UL) /* 2579 */
-P(12, 0xf50865f71b90f1dfUL, 0x00194b3083360ba8UL) /* 2591 */
-P( 2, 0x739c1682847df9e1UL, 0x00194631f4bebdc1UL) /* 2593 */
-P(16, 0xc470a4d842b90ed1UL, 0x00191e84127268fdUL) /* 2609 */
-P( 8, 0x1fb1be11698cc409UL, 0x00190adbb543984fUL) /* 2617 */
-P( 4, 0xd8d5512a7cd35d15UL, 0x001901130bd18200UL) /* 2621 */
-P(12, 0xa5496821723e07f9UL, 0x0018e3e6b889ac94UL) /* 2633 */
-P(14, 0xbcc8c6d7abaa8167UL, 0x0018c233420e1ec1UL) /* 2647 */
-P(10, 0x52c396c95eb619a1UL, 0x0018aa5872d92bd6UL) /* 2657 */
-P( 2, 0x6eb7e380878ec74bUL, 0x0018a5989945ccf9UL) /* 2659 */
-P( 4, 0x3d5513b504537157UL, 0x00189c1e60b57f60UL) /* 2663 */
-P( 8, 0x314391f8862e948fUL, 0x0018893fbc8690b9UL) /* 2671 */
-P( 6, 0xdc0b17cfcd81f5ddUL, 0x00187b2bb3e1041cUL) /* 2677 */
-P( 6, 0x2f6bea3ec89044b3UL, 0x00186d27c9cdcfb8UL) /* 2683 */
-P( 4, 0xce13a05869f1b57fUL, 0x001863d8bf4f2c1cUL) /* 2687 */
-P( 2, 0x7593474e8ace3581UL, 0x00185f33e2ad7593UL) /* 2689 */
-P( 4, 0x07fc329295a05e4dUL, 0x001855ef75973e13UL) /* 2693 */
-P( 6, 0xb05377cba4908d23UL, 0x001848160153f134UL) /* 2699 */
-P( 8, 0xe7b2131a628aa39bUL, 0x001835b72e6f0656UL) /* 2707 */
-P( 4, 0x9031dbed7de01527UL, 0x00182c922d83eb39UL) /* 2711 */
-P( 2, 0x76844b1c670aa9a9UL, 0x0018280243c0365aUL) /* 2713 */
-P( 6, 0x6a03f4533b08915fUL, 0x00181a5cd5898e73UL) /* 2719 */
-P(10, 0x1dbca579db0a3999UL, 0x001803c0961773aaUL) /* 2729 */
-P( 2, 0x002ffe800bffa003UL, 0x0017ff4005ffd001UL) /* 2731 */
-P(10, 0x478ab1a3e936139dUL, 0x0017e8d670433edbUL) /* 2741 */
-P( 8, 0x66e722bc4c5cc095UL, 0x0017d7066cf4bb5dUL) /* 2749 */
-P( 4, 0x7a8f63c717278541UL, 0x0017ce285b806b1fUL) /* 2753 */
-P(14, 0xdf6eee24d292bc2fUL, 0x0017af52cdf27e02UL) /* 2767 */
-P(10, 0x9fc20d17237dd569UL, 0x0017997d47d01039UL) /* 2777 */
-P(12, 0xcdf9932356bda2edUL, 0x00177f7ec2c6d0baUL) /* 2789 */
-P( 2, 0x97b5e332e80f68d7UL, 0x00177b2f3cd00756UL) /* 2791 */
-P( 6, 0x46eee26fd875e2e5UL, 0x00176e4a22f692a0UL) /* 2797 */
-P( 4, 0x3548a8e65157a611UL, 0x001765b94271e11bUL) /* 2801 */
-P( 2, 0xc288d03be9b71e3bUL, 0x001761732b044ae4UL) /* 2803 */
-P(16, 0x8151186db38937abUL, 0x00173f7a5300a2bcUL) /* 2819 */
-P(14, 0x7800b910895a45f1UL, 0x001722112b48be1fUL) /* 2833 */
-P( 4, 0xaee0b024182eec3dUL, 0x001719b7a16eb843UL) /* 2837 */
-P( 6, 0x96323eda173b5713UL, 0x00170d3c99cc5052UL) /* 2843 */
-P( 8, 0x0ed0dbd03ae77c8bUL, 0x0016fcad7aed3bb6UL) /* 2851 */
-P( 6, 0xf73800b7828dc119UL, 0x0016f051b8231ffdUL) /* 2857 */
-P( 4, 0x1b61715ec22b7ca5UL, 0x0016e81beae20643UL) /* 2861 */
-P(18, 0xa8533a991ead64bfUL, 0x0016c3721584c1d8UL) /* 2879 */
-P( 8, 0x7f6c7290e46c2e77UL, 0x0016b34c2ba09663UL) /* 2887 */
-P(10, 0x6325e8d907b01db1UL, 0x00169f3ce292ddcdUL) /* 2897 */
-P( 6, 0x28909f70152a1067UL, 0x00169344b2220a0dUL) /* 2903 */
-P( 6, 0xea7077af0997a0f5UL, 0x001687592593c1b1UL) /* 2909 */
-P( 8, 0x7e605cad10c32e6dUL, 0x00167787f1418ec9UL) /* 2917 */
-P(10, 0x471b33570635b38fUL, 0x001663e190395ff2UL) /* 2927 */
-P(12, 0xab559fa997a61bb3UL, 0x00164c7a4b6eb5b3UL) /* 2939 */
-P(14, 0xad4bdae562bddab9UL, 0x0016316a061182fdUL) /* 2953 */
-P( 4, 0x055e1b2f2ed62f45UL, 0x001629ba914584e4UL) /* 2957 */
-P( 6, 0x03cd328b1a2dca9bUL, 0x00161e3d57de21b2UL) /* 2963 */
-P( 6, 0xd28f4e08733218a9UL, 0x001612cc01b977f0UL) /* 2969 */
-P( 2, 0xb6800b077f186293UL, 0x00160efe30c525ffUL) /* 2971 */
-P(28, 0x6fbd138c3fd9c207UL, 0x0015da45249ec5deUL) /* 2999 */
-P( 2, 0xb117ccd12ae88a89UL, 0x0015d68ab4acff92UL) /* 3001 */
-P(10, 0x2f1a1a044046bcebUL, 0x0015c3f989d1eb15UL) /* 3011 */
-P( 8, 0x548aba0b060541e3UL, 0x0015b535ad11b8f0UL) /* 3019 */
-P( 4, 0xcf4e808cea111b2fUL, 0x0015addb3f424ec1UL) /* 3023 */
-P(14, 0xdbec1b4fa855a475UL, 0x00159445cb91be6bUL) /* 3037 */
-P( 4, 0xe3f794eb600d7821UL, 0x00158d0199771e63UL) /* 3041 */
-P( 8, 0x34fae0d9a11f7c59UL, 0x00157e87d9b69e04UL) /* 3049 */
-P(12, 0xf006b0ccbbac085dUL, 0x001568f58bc01ac3UL) /* 3061 */
-P( 6, 0x3f45076dc3114733UL, 0x00155e3c993fda9bUL) /* 3067 */
-P(12, 0xeef49bfa58a1a1b7UL, 0x001548eacc5e1e6eUL) /* 3079 */
-P( 4, 0x12c4218bea691fa3UL, 0x001541d8f91ba6a7UL) /* 3083 */
-P( 6, 0xbc7504e3bd5e64f1UL, 0x00153747060cc340UL) /* 3089 */
-P(20, 0x4ee21c292bb92fadUL, 0x001514569f93f7c4UL) /* 3109 */
-P(10, 0x34338b7327a4bacfUL, 0x00150309705d3d79UL) /* 3119 */
-P( 2, 0x3fe5c0833d6fccd1UL, 0x0014ff97020cf5bfUL) /* 3121 */
-P(16, 0xb1e70743535203c1UL, 0x0014e42c114cf47eUL) /* 3137 */
-P(26, 0xefbb5dcdfb4e43d3UL, 0x0014b835bdcb6447UL) /* 3163 */
-P( 4, 0xca68467ca5394f9fUL, 0x0014b182b53a9ab7UL) /* 3167 */
-P( 2, 0x8c51c081408b97a1UL, 0x0014ae2ad094a3d3UL) /* 3169 */
-P(12, 0x3275a899dfa5dd65UL, 0x00149a320ea59f96UL) /* 3181 */
-P( 6, 0x9e674cb62e1b78bbUL, 0x001490441de1a2fbUL) /* 3187 */
-P( 4, 0xa37ff5bb2a998d47UL, 0x001489aacce57200UL) /* 3191 */
-P(12, 0x792a999db131a22bUL, 0x001475f82ad6ff99UL) /* 3203 */
-P( 6, 0x1b48841bc30d29b9UL, 0x00146c2cfe53204fUL) /* 3209 */
-P( 8, 0xf06721d2011d3471UL, 0x00145f2ca490d4a1UL) /* 3217 */
-P( 4, 0x93fd2386dff85ebdUL, 0x001458b2aae0ec87UL) /* 3221 */
-P( 8, 0x4ce72f54c07ed9b5UL, 0x00144bcb0a3a3150UL) /* 3229 */
-P(22, 0xd6d0fd3e71dd827bUL, 0x001428a1e65441d4UL) /* 3251 */
-P( 2, 0x856405fb1eed819dUL, 0x00142575a6c210d7UL) /* 3253 */
-P( 4, 0x8ea8aceb7c443989UL, 0x00141f2025ba5c46UL) /* 3257 */
-P( 2, 0x34a13026f62e5873UL, 0x00141bf6e35420fdUL) /* 3259 */
-P(12, 0x1eea0208ec0af4f7UL, 0x001409141d1d313aUL) /* 3271 */
-P(28, 0x63679853cea598cbUL, 0x0013dd8bc19c3513UL) /* 3299 */
-P( 2, 0xc30b3ebd61f2d0edUL, 0x0013da76f714dc8fUL) /* 3301 */
-P( 6, 0x7eb9037bc7f43bc3UL, 0x0013d13e50f8f49eUL) /* 3307 */
-P( 6, 0xa583e6f6ce016411UL, 0x0013c80e37ca3819UL) /* 3313 */
-P( 6, 0xf1938d895f1a74c7UL, 0x0013bee69fa99ccfUL) /* 3319 */
-P( 4, 0x80cf1491c1e81e33UL, 0x0013b8d0ede55835UL) /* 3323 */
-P( 6, 0x3c0f12886ba8f301UL, 0x0013afb7680bb054UL) /* 3329 */
-P( 2, 0x0e4b786e0dfcc5abUL, 0x0013acb0c3841c96UL) /* 3331 */
-P(12, 0x672684c93f2d41efUL, 0x00139a9c5f434fdeUL) /* 3343 */
-P( 4, 0xe00757badb35c51bUL, 0x0013949cf33a0d9dUL) /* 3347 */
-P(12, 0xd6d84afe66472edfUL, 0x001382b4a00c31b0UL) /* 3359 */
-P( 2, 0xfbbc0eedcbbfb6e1UL, 0x00137fbbc0eedcbbUL) /* 3361 */
-P(10, 0x250f43aa08a84983UL, 0x001370ecf047b069UL) /* 3371 */
-P( 2, 0x04400e927b1acaa5UL, 0x00136df9790e3155UL) /* 3373 */
-P(16, 0x56572be34b9d3215UL, 0x0013567dd8defd5bUL) /* 3389 */
-P( 2, 0x87964ef7781c62bfUL, 0x0013539261fdbc34UL) /* 3391 */
-P(16, 0x29ed84051c06e9afUL, 0x00133c564292d28aUL) /* 3407 */
-P( 6, 0xb00acd11ed3f87fdUL, 0x001333ae178d6388UL) /* 3413 */
-P(20, 0x06307881744152d9UL, 0x0013170ad00d1fd7UL) /* 3433 */
-P(16, 0x7a786459f5c1ccc9UL, 0x0013005f01db0947UL) /* 3449 */
-P( 8, 0x1308125d74563281UL, 0x0012f51d40342210UL) /* 3457 */
-P( 4, 0x395310a480b3e34dUL, 0x0012ef815e4ed950UL) /* 3461 */
-P( 2, 0x35985baa8b202837UL, 0x0012ecb4abccd827UL) /* 3463 */
-P( 4, 0x96304a6e052b3223UL, 0x0012e71dc1d3d820UL) /* 3467 */
-P( 2, 0xbd8265fc9af8fd45UL, 0x0012e45389a16495UL) /* 3469 */
-P(22, 0x1b6d0b383ec58e0bUL, 0x0012c5d9226476ccUL) /* 3491 */
-P( 8, 0xc21a7c3b68b28503UL, 0x0012badc391156fdUL) /* 3499 */
-P(12, 0x236fa180fbfd6007UL, 0x0012aa78e412f522UL) /* 3511 */
-P( 6, 0xc42accd440ed9595UL, 0x0012a251f5f47fd1UL) /* 3517 */
-P(10, 0x7acf7128236ba3f7UL, 0x001294cb85c53534UL) /* 3527 */
-P( 2, 0xf909367a987b9c79UL, 0x0012921963beb65eUL) /* 3529 */
-P( 4, 0xb64efb252bfba705UL, 0x00128cb777c69ca8UL) /* 3533 */
-P( 6, 0x980d4f5a7e4cd25bUL, 0x001284aa6cf07294UL) /* 3539 */
-P( 2, 0xe1ecc4ef27b0c37dUL, 0x001281fcf6ac7f87UL) /* 3541 */
-P( 6, 0x9111aebb81d72653UL, 0x001279f937367db9UL) /* 3547 */
-P(10, 0x8951f985cb2c67edUL, 0x00126cad0488be94UL) /* 3557 */
-P( 2, 0xc439d4fc54e0b5d7UL, 0x00126a06794646a2UL) /* 3559 */
-P(12, 0xe857bf31896d533bUL, 0x00125a2f2bcd3e95UL) /* 3571 */
-P(10, 0xb614bb4cb5023755UL, 0x00124d108389e6b1UL) /* 3581 */
-P( 2, 0x938a89e5473bf1ffUL, 0x00124a73083771acUL) /* 3583 */
-P(10, 0xeac481aca34de039UL, 0x00123d6acda0620aUL) /* 3593 */
-P(14, 0x14b961badf4809a7UL, 0x00122b4b2917eafdUL) /* 3607 */
-P( 6, 0x76784fecba352435UL, 0x00122391bfce1e2fUL) /* 3613 */
-P( 4, 0xefa689bb58aef5e1UL, 0x00121e6f1ea579f2UL) /* 3617 */
-P( 6, 0xb2b2c4db9c3a8197UL, 0x001216c09e471568UL) /* 3623 */
-P( 8, 0x2503bc992279f8cfUL, 0x00120c8cb9d93909UL) /* 3631 */
-P( 6, 0xd2ab9aec5ca1541dUL, 0x001204ed58e64ef9UL) /* 3637 */
-P( 6, 0x3e78ba1460f99af3UL, 0x0011fd546578f00cUL) /* 3643 */
-P(16, 0x0a01426572cfcb63UL, 0x0011e9310b8b4c9cUL) /* 3659 */
-P(12, 0xbea857968f3cbd67UL, 0x0011da3405db9911UL) /* 3671 */
-P( 2, 0x78db213eefe659e9UL, 0x0011d7b6f4eb055dUL) /* 3673 */
-P( 4, 0x963e8541a74d35f5UL, 0x0011d2bee748c145UL) /* 3677 */
-P(14, 0x9e22d152776f2e43UL, 0x0011c1706ddce7a7UL) /* 3691 */
-P( 6, 0x05d10d39d1e1f291UL, 0x0011ba0fed2a4f14UL) /* 3697 */
-P( 4, 0x374468dccaced1ddUL, 0x0011b528538ed64aUL) /* 3701 */
-P( 8, 0x8d145c7d110c5ad5UL, 0x0011ab61404242acUL) /* 3709 */
-P(10, 0x3251a39f5acb5737UL, 0x00119f378ce81d2fUL) /* 3719 */
-P( 8, 0xa66e50171443506fUL, 0x001195889ece79daUL) /* 3727 */
-P( 6, 0x124f69ad91dd4cbdUL, 0x00118e4c65387077UL) /* 3733 */
-P( 6, 0xec24f8f2a61a2793UL, 0x001187161d70e725UL) /* 3739 */
-P(22, 0xb472148e656b7a51UL, 0x00116cd6d1c85239UL) /* 3761 */
-P( 6, 0x0adf9570e1142f07UL, 0x001165bbe7ce86b1UL) /* 3767 */
-P( 2, 0x89bf33b065119789UL, 0x0011635ee344ce36UL) /* 3769 */
-P(10, 0x8f0149803cb291ebUL, 0x0011579767b6d679UL) /* 3779 */
-P(14, 0x8334b63afd190a31UL, 0x00114734711e2b54UL) /* 3793 */
-P( 4, 0x920908d50d6aba7dUL, 0x0011428b90147f05UL) /* 3797 */
-P( 6, 0x57d8b018c5a33d53UL, 0x00113b92f3021636UL) /* 3803 */
-P(18, 0xea1773092dc27ee5UL, 0x001126cabc886884UL) /* 3821 */
-P( 2, 0xcae5f38b7bf2e00fUL, 0x0011247eb1b85976UL) /* 3823 */
-P(10, 0x2bd02df34f695349UL, 0x0011190bb01efd65UL) /* 3833 */
-P(14, 0xddfecd5be62e2eb7UL, 0x0011091de0fd679cUL) /* 3847 */
-P( 4, 0xdbf849ebec96c4a3UL, 0x001104963c7e4e0bUL) /* 3851 */
-P( 2, 0xda31d4d0187357c5UL, 0x00110253516420b0UL) /* 3853 */
-P(10, 0xe34e21cc2d5418a7UL, 0x0010f70db7c41797UL) /* 3863 */
-P(14, 0x68ca5137a9e574adUL, 0x0010e75ee2bf9ecdUL) /* 3877 */
-P( 4, 0x3eaa0d0f804bfd19UL, 0x0010e2e91c6e0676UL) /* 3881 */
-P( 8, 0x554fb753cc20e9d1UL, 0x0010da049b9d428dUL) /* 3889 */
-P(18, 0x797afcca1300756bUL, 0x0010c6248fe3b1a2UL) /* 3907 */
-P( 4, 0x8b8d950b52eeea77UL, 0x0010c1c03ed690ebUL) /* 3911 */
-P( 6, 0xfb6cd166acabc185UL, 0x0010bb2e1379e3a2UL) /* 3917 */
-P( 2, 0x4eb6c5ed9437a7afUL, 0x0010b8fe7f61228eUL) /* 3919 */
-P( 4, 0xd1eddbd91b790cdbUL, 0x0010b4a10d60a4f7UL) /* 3923 */
-P( 6, 0x93d714ea4d8948e9UL, 0x0010ae192681ec0fUL) /* 3929 */
-P( 2, 0x3ca13ed8145188d3UL, 0x0010abecfbe5b0aeUL) /* 3931 */
-P(12, 0x829086016da89c57UL, 0x00109eefd568b96dUL) /* 3943 */
-P( 4, 0xd7da1f432124a543UL, 0x00109a9ff178b40cUL) /* 3947 */
-P(20, 0x7ead5581632fb07fUL, 0x00108531e22f9ff9UL) /* 3967 */
-P(22, 0x35443837f63ec3bdUL, 0x00106ddec1af4417UL) /* 3989 */
-
-#undef FIRST_OMITTED_PRIME
-#define FIRST_OMITTED_PRIME 4001
diff --git a/gmp/demos/qcn.c b/gmp/demos/qcn.c
index 9d76446804..b0c7e63473 100644
--- a/gmp/demos/qcn.c
+++ b/gmp/demos/qcn.c
@@ -2,7 +2,7 @@
class number h(d), for a given negative fundamental discriminant, using
Dirichlet's analytic formula.
-Copyright 1999-2002 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 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 https://www.gnu.org/licenses/. */
+this program. If not, see http://www.gnu.org/licenses/. */
/* Usage: qcn [-p limit] <discriminant>...
diff --git a/gmp/doc/Makefile.am b/gmp/doc/Makefile.am
index 083f25a630..2bc34ddbf9 100644
--- a/gmp/doc/Makefile.am
+++ b/gmp/doc/Makefile.am
@@ -3,31 +3,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
EXTRA_DIST = configuration isa_abi_headache projects.html tasks.html
diff --git a/gmp/doc/Makefile.in b/gmp/doc/Makefile.in
index 1acf6029ef..3d9dadbc31 100644
--- a/gmp/doc/Makefile.in
+++ b/gmp/doc/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -17,54 +16,29 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -76,7 +50,6 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
subdir = doc
DIST_COMMON = $(gmp_TEXINFOS) $(srcdir)/Makefile.am \
@@ -84,13 +57,12 @@ DIST_COMMON = $(gmp_TEXINFOS) $(srcdir)/Makefile.am \
$(srcdir)/version.texi mdate-sh texinfo.tex
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
depcomp =
am__depfiles_maybe =
SOURCES =
@@ -107,39 +79,7 @@ TEXI2PDF = $(TEXI2DVI) --pdf --batch
MAKEINFOHTML = $(MAKEINFO) --html
AM_MAKEINFOHTMLFLAGS = $(AM_MAKEINFOFLAGS)
DVIPS = dvips
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
am__installdirs = "$(DESTDIR)$(infodir)"
-am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
-am__vpath_adj = case $$p in \
- $(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
- *) f=$$p;; \
- esac;
-am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
-am__install_max = 40
-am__nobase_strip_setup = \
- srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
-am__nobase_strip = \
- for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
-am__nobase_list = $(am__nobase_strip_setup); \
- for p in $$list; do echo "$$p $$p"; done | \
- sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
- $(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
- if (++n[$$2] == $(am__install_max)) \
- { print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
- END { for (dir in files) print dir, files[dir] }'
-am__base_list = \
- sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
- sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
-am__uninstall_files_from_dir = { \
- test -z "$$files" \
- || { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
- || { echo " ( cd '$$dir' && rm -f" $$files ")"; \
- $(am__cd) "$$dir" && rm -f $$files; }; \
- }
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -151,6 +91,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -166,17 +107,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -190,12 +130,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -210,26 +148,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -239,31 +171,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -287,6 +214,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -294,12 +222,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
EXTRA_DIST = configuration isa_abi_headache projects.html tasks.html
info_TEXINFOS = gmp.texi
gmp_TEXINFOS = fdl-1.3.texi
@@ -311,14 +235,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps doc/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps doc/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps doc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps doc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -336,7 +260,6 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
mostlyclean-libtool:
-rm -f *.lo
@@ -344,27 +267,33 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+
.texi.info:
- restore=: && backupdir="$(am__leading_dot)am$$$$" && \
- am__cwd=`pwd` && $(am__cd) $(srcdir) && \
+ restore=: && \
+ backupdir="$(am__leading_dot)am$$$$" && \
+ am__cwd=`pwd` && cd $(srcdir) && \
rm -rf $$backupdir && mkdir $$backupdir && \
- if ($(MAKEINFO) --version) >/dev/null 2>&1; then \
- for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
- if test -f $$f; then mv $$f $$backupdir; restore=mv; else :; fi; \
- done; \
- else :; fi && \
+ for f in $@ $@-[0-9] $@-[0-9][0-9] $(@:.info=).i[0-9] $(@:.info=).i[0-9][0-9]; do \
+ if test -f $$f; then \
+ mv $$f $$backupdir; \
+ restore=mv; \
+ fi; \
+ done; \
cd "$$am__cwd"; \
if $(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
-o $@ $<; \
then \
rc=0; \
- $(am__cd) $(srcdir); \
+ cd $(srcdir); \
else \
rc=$$?; \
- $(am__cd) $(srcdir) && \
+ cd $(srcdir) && \
$$restore $$backupdir/* `echo "./$@" | sed 's|[^/]*$$||'`; \
fi; \
- rm -rf $$backupdir; exit $$rc
+ rm -rf $$backupdir; \
+ exit $$rc
.texi.dvi:
TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
@@ -377,18 +306,10 @@ clean-libtool:
$(TEXI2PDF) $<
.texi.html:
- rm -rf $(@:.html=.htp)
- if $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
- -o $(@:.html=.htp) $<; \
- then \
- rm -rf $@; \
- if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
- mv $(@:.html=) $@; else mv $(@:.html=.htp) $@; fi; \
- else \
- if test ! -d $(@:.html=.htp) && test -d $(@:.html=); then \
- rm -rf $(@:.html=); else rm -Rf $(@:.html=.htp) $@; fi; \
- exit 1; \
- fi
+ $(MAKEINFOHTML) $(AM_MAKEINFOHTMLFLAGS) $(MAKEINFOFLAGS) -I $(srcdir) \
+ -o $@ $<
+ if test ! -d $@ && test -d $(@:.html=); then \
+ mv $(@:.html=) $@; else :; fi
$(srcdir)/gmp.info: gmp.texi $(srcdir)/version.texi $(gmp_TEXINFOS)
gmp.dvi: gmp.texi $(srcdir)/version.texi $(gmp_TEXINFOS)
gmp.pdf: gmp.texi $(srcdir)/version.texi $(gmp_TEXINFOS)
@@ -413,36 +334,17 @@ mostlyclean-vti:
maintainer-clean-vti:
@MAINTAINER_MODE_TRUE@ -rm -f $(srcdir)/stamp-vti $(srcdir)/version.texi
.dvi.ps:
- TEXINPUTS="$(am__TEXINFO_TEX_DIR)$(PATH_SEPARATOR)$$TEXINPUTS" \
$(DVIPS) -o $@ $<
-uninstall-dvi-am:
- @$(NORMAL_UNINSTALL)
- @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(dvidir)/$$f'"; \
- rm -f "$(DESTDIR)$(dvidir)/$$f"; \
- done
-
-uninstall-html-am:
- @$(NORMAL_UNINSTALL)
- @list='$(HTMLS)'; test -n "$(htmldir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -rf '$(DESTDIR)$(htmldir)/$$f'"; \
- rm -rf "$(DESTDIR)$(htmldir)/$$f"; \
- done
-
uninstall-info-am:
- @$(PRE_UNINSTALL)
- @if test -d '$(DESTDIR)$(infodir)' && $(am__can_run_installinfo); then \
+ $(PRE_UNINSTALL)
+ @if (install-info --version && \
+ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
list='$(INFO_DEPS)'; \
for file in $$list; do \
relfile=`echo "$$file" | sed 's|^.*/||'`; \
echo " install-info --info-dir='$(DESTDIR)$(infodir)' --remove '$(DESTDIR)$(infodir)/$$relfile'"; \
- if install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
- then :; else test ! -f "$(DESTDIR)$(infodir)/$$relfile" || exit 1; fi; \
+ install-info --info-dir="$(DESTDIR)$(infodir)" --remove "$(DESTDIR)$(infodir)/$$relfile"; \
done; \
else :; fi
@$(NORMAL_UNINSTALL)
@@ -450,30 +352,12 @@ uninstall-info-am:
for file in $$list; do \
relfile=`echo "$$file" | sed 's|^.*/||'`; \
relfile_i=`echo "$$relfile" | sed 's|\.info$$||;s|$$|.i|'`; \
- (if test -d "$(DESTDIR)$(infodir)" && cd "$(DESTDIR)$(infodir)"; then \
- echo " cd '$(DESTDIR)$(infodir)' && rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]"; \
+ (if cd "$(DESTDIR)$(infodir)"; then \
+ echo " rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9])"; \
rm -f $$relfile $$relfile-[0-9] $$relfile-[0-9][0-9] $$relfile_i[0-9] $$relfile_i[0-9][0-9]; \
else :; fi); \
done
-uninstall-pdf-am:
- @$(NORMAL_UNINSTALL)
- @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(pdfdir)/$$f'"; \
- rm -f "$(DESTDIR)$(pdfdir)/$$f"; \
- done
-
-uninstall-ps-am:
- @$(NORMAL_UNINSTALL)
- @list='$(PSS)'; test -n "$(psdir)" || list=; \
- for p in $$list; do \
- $(am__strip_dir) \
- echo " rm -f '$(DESTDIR)$(psdir)/$$f'"; \
- rm -f "$(DESTDIR)$(psdir)/$$f"; \
- done
-
dist-info: $(INFO_DEPS)
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
list='$(INFO_DEPS)'; \
@@ -482,23 +366,17 @@ dist-info: $(INFO_DEPS)
$(srcdir)/*) base=`echo "$$base" | sed "s|^$$srcdirstrip/||"`;; \
esac; \
if test -f $$base; then d=.; else d=$(srcdir); fi; \
- base_i=`echo "$$base" | sed 's|\.info$$||;s|$$|.i|'`; \
- for file in $$d/$$base $$d/$$base-[0-9] $$d/$$base-[0-9][0-9] $$d/$$base_i[0-9] $$d/$$base_i[0-9][0-9]; do \
- if test -f $$file; then \
- relfile=`expr "$$file" : "$$d/\(.*\)"`; \
- test -f "$(distdir)/$$relfile" || \
- cp -p $$file "$(distdir)/$$relfile"; \
- else :; fi; \
+ for file in $$d/$$base*; do \
+ relfile=`expr "$$file" : "$$d/\(.*\)"`; \
+ test -f $(distdir)/$$relfile || \
+ cp -p $$file $(distdir)/$$relfile; \
done; \
done
mostlyclean-aminfo:
-rm -rf gmp.aux gmp.cp gmp.cps gmp.fn gmp.fns gmp.ky gmp.kys gmp.log gmp.pg \
- gmp.pgs gmp.tmp gmp.toc gmp.tp gmp.vr gmp.vrs
-
-clean-aminfo:
- -test -z "gmp.dvi gmp.pdf gmp.ps gmp.html" \
- || rm -rf gmp.dvi gmp.pdf gmp.ps gmp.html
+ gmp.pgs gmp.tmp gmp.toc gmp.tp gmp.vr gmp.vrs gmp.dvi \
+ gmp.pdf gmp.ps gmp.html
maintainer-clean-aminfo:
@list='$(INFO_DEPS)'; for i in $$list; do \
@@ -514,32 +392,29 @@ CTAGS:
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -551,7 +426,7 @@ check: check-am
all-am: Makefile $(INFO_DEPS)
installdirs:
for dir in "$(DESTDIR)$(infodir)"; do \
- test -z "$$dir" || $(MKDIR_P) "$$dir"; \
+ test -z "$$dir" || $(mkdir_p) "$$dir"; \
done
install: install-am
install-exec: install-exec-am
@@ -563,33 +438,27 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@echo "it deletes files that may require special tools to rebuild."
clean: clean-am
-clean-am: clean-aminfo clean-generic clean-libtool mostlyclean-am
+clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
-distclean-am: clean-am distclean-generic
+distclean-am: clean-am distclean-generic distclean-libtool
dvi: dvi-am
@@ -605,62 +474,15 @@ info-am: $(INFO_DEPS)
install-data-am: install-info-am
-install-dvi: install-dvi-am
-
-install-dvi-am: $(DVIS)
- @$(NORMAL_INSTALL)
- @list='$(DVIS)'; test -n "$(dvidir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(dvidir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(dvidir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(dvidir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(dvidir)" || exit $$?; \
- done
install-exec-am:
-install-html: install-html-am
-
-install-html-am: $(HTMLS)
- @$(NORMAL_INSTALL)
- @list='$(HTMLS)'; list2=; test -n "$(htmldir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(htmldir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p" || test -d "$$p"; then d=; else d="$(srcdir)/"; fi; \
- $(am__strip_dir) \
- d2=$$d$$p; \
- if test -d "$$d2"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(htmldir)/$$f'"; \
- $(MKDIR_P) "$(DESTDIR)$(htmldir)/$$f" || exit 1; \
- echo " $(INSTALL_DATA) '$$d2'/* '$(DESTDIR)$(htmldir)/$$f'"; \
- $(INSTALL_DATA) "$$d2"/* "$(DESTDIR)$(htmldir)/$$f" || exit $$?; \
- else \
- list2="$$list2 $$d2"; \
- fi; \
- done; \
- test -z "$$list2" || { echo "$$list2" | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(htmldir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(htmldir)" || exit $$?; \
- done; }
install-info: install-info-am
install-info-am: $(INFO_DEPS)
@$(NORMAL_INSTALL)
+ test -z "$(infodir)" || $(mkdir_p) "$(DESTDIR)$(infodir)"
@srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
- list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(infodir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(infodir)" || exit 1; \
- fi; \
+ list='$(INFO_DEPS)'; \
for file in $$list; do \
case $$file in \
$(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
@@ -668,18 +490,18 @@ install-info-am: $(INFO_DEPS)
if test -f $$file; then d=.; else d=$(srcdir); fi; \
file_i=`echo "$$file" | sed 's|\.info$$||;s|$$|.i|'`; \
for ifile in $$d/$$file $$d/$$file-[0-9] $$d/$$file-[0-9][0-9] \
- $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
+ $$d/$$file_i[0-9] $$d/$$file_i[0-9][0-9] ; do \
if test -f $$ifile; then \
- echo "$$ifile"; \
+ relfile=`echo "$$ifile" | sed 's|^.*/||'`; \
+ echo " $(INSTALL_DATA) '$$ifile' '$(DESTDIR)$(infodir)/$$relfile'"; \
+ $(INSTALL_DATA) "$$ifile" "$(DESTDIR)$(infodir)/$$relfile"; \
else : ; fi; \
done; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(infodir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(infodir)" || exit $$?; done
+ done
@$(POST_INSTALL)
- @if $(am__can_run_installinfo); then \
- list='$(INFO_DEPS)'; test -n "$(infodir)" || list=; \
+ @if (install-info --version && \
+ install-info --version 2>&1 | sed 1q | grep -i -v debian) >/dev/null 2>&1; then \
+ list='$(INFO_DEPS)'; \
for file in $$list; do \
relfile=`echo "$$file" | sed 's|^.*/||'`; \
echo " install-info --info-dir='$(DESTDIR)$(infodir)' '$(DESTDIR)$(infodir)/$$relfile'";\
@@ -688,38 +510,6 @@ install-info-am: $(INFO_DEPS)
else : ; fi
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am: $(PDFS)
- @$(NORMAL_INSTALL)
- @list='$(PDFS)'; test -n "$(pdfdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(pdfdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(pdfdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(pdfdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(pdfdir)" || exit $$?; done
-install-ps: install-ps-am
-
-install-ps-am: $(PSS)
- @$(NORMAL_INSTALL)
- @list='$(PSS)'; test -n "$(psdir)" || list=; \
- if test -n "$$list"; then \
- echo " $(MKDIR_P) '$(DESTDIR)$(psdir)'"; \
- $(MKDIR_P) "$(DESTDIR)$(psdir)" || exit 1; \
- fi; \
- for p in $$list; do \
- if test -f "$$p"; then d=; else d="$(srcdir)/"; fi; \
- echo "$$d$$p"; \
- done | $(am__base_list) | \
- while read files; do \
- echo " $(INSTALL_DATA) $$files '$(DESTDIR)$(psdir)'"; \
- $(INSTALL_DATA) $$files "$(DESTDIR)$(psdir)" || exit $$?; done
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -740,26 +530,19 @@ ps: ps-am
ps-am: $(PSS)
-uninstall-am: uninstall-dvi-am uninstall-html-am uninstall-info-am \
- uninstall-pdf-am uninstall-ps-am
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
-.PHONY: all all-am check check-am clean clean-aminfo clean-generic \
- clean-libtool dist-info distclean distclean-generic \
- distclean-libtool distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+.PHONY: all all-am check check-am clean clean-generic clean-libtool \
+ dist-info distclean distclean-generic distclean-libtool \
+ distdir dvi dvi-am html html-am info info-am install \
+ install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-aminfo \
maintainer-clean-generic maintainer-clean-vti mostlyclean \
mostlyclean-aminfo mostlyclean-generic mostlyclean-libtool \
mostlyclean-vti pdf pdf-am ps ps-am uninstall uninstall-am \
- uninstall-dvi-am uninstall-html-am uninstall-info-am \
- uninstall-pdf-am uninstall-ps-am
-
+ uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/gmp/doc/configuration b/gmp/doc/configuration
index b6903866b2..fbd3b960d2 100644
--- a/gmp/doc/configuration
+++ b/gmp/doc/configuration
@@ -1,32 +1,21 @@
/* doc/configuration (in Emacs -*-outline-*- format). */
-Copyright 2000-2004 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -57,7 +46,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 truly generic and included in every
+Currently only mpn/mp_bases.c is truely 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.
@@ -132,9 +121,14 @@ To add a completely new mpn function file, do the following,
iii) If HAVE_NATIVE_func is going to be used, then add a #undef to
the AH_VERBATIM([HAVE_NATIVE] block in configure.in.
- iv) If the function can be provided by a multi-function file, then
- add to the "case" statement in configure.in which lists each
- multi-function filename and what function files it can provide.
+ iv) Add file.c to nodist_libdummy_la_SOURCES in mpn/Makefile.am (in
+ order to get an ansi2knr rule). If the file is only in
+ assembler then this step is unnecessary, but do it anyway so as
+ not to forget if later a .c version is added.
+
+ v) If the function can be provided by a multi-function file, then
+ add to the "case" statement in configure.in which lists each
+ multi-function filename and what function files it can provide.
** Adding a test program
@@ -166,6 +160,18 @@ purposes and are not for use in "make check". These should be listed
in EXTRA_PROGRAMS to get Makefile rules created, but they're never
built or run unless an explicit "make someprog" is used.
+** Macos directory
+
+The macos/configure script will automatically pick up additions to
+gmp_mpn_functions, MPZ_OBJECTS, etc, but currently test programs need
+to be added to Makefile.in manually.
+
+When modifying the top-level configure.in ensure that it doesn't upset
+the macos/configure script heuristics.
+
+Unfortunately there's no way to test this stuff without getting an
+actual MacOS 9 system.
+
* Adding a new CPU
@@ -251,6 +257,10 @@ INSTALL.autoconf can be copied from INSTALL in autoconf.
ltmain.sh comes from libtool. Remove it and run "libtoolize --copy",
or just copy the file by hand.
+ansi2knr.c, ansi2knr.1, install-sh and doc/mdate-sh come from automake
+and can be updated by copying or by removing and running "automake
+--add-missing --copy".
+
texinfo.tex can be updated from ftp.gnu.org. Check it still works
with "make gmp.dvi", "make gmp.ps" and "make gmp.pdf".
@@ -334,6 +344,10 @@ errors rather than mysterious failures from a mismatch.
--disable-shared will make builds go much faster, though of course
shared or shared+static should be tested too.
+--enable-mpbsd grabs various bits of mpz, which might need to be
+adjusted if things in those routines are changed. Building mpbsd all
+the time doesn't cost much.
+
--prefix to a dummy directory followed by "make install" will show
what's installed.
@@ -365,6 +379,30 @@ they're the same size, which is unfortunate because casts should be
used in such cases, for the benefit of K&R compilers with int!=long
and where the difference matters in function calls.
+** K&R support
+
+Function definitions must be in the GNU stylized form to work. See
+the ansi2knr.1 man page (included in the GMP sources).
+
+__GMP_PROTO is used for function prototypes, other ANSI / K&R
+differences are conditionalized in various places.
+
+Proper testing of the K&R support requires a compiler which gives an
+error for ANSI-isms. Configuring with --host=none is a good idea, to
+test all the generic C code.
+
+When using an ANSI compiler, the ansi2knr setups can be partially
+tested with
+
+ ./configure am_cv_prog_cc_stdc=no ac_cv_prog_cc_stdc=no
+
+This will test the use of $U and the like in the makefiles, but not
+much else.
+
+Forcing the cache variables can be used with a compiler like HP C
+which is K&R by default but to which configure normally adds ANSI mode
+flags. This then should be a good full K&R test.
+
* Other Notes
** Compatibility
@@ -377,6 +415,12 @@ struct __mpz_struct etc - this must be retained for C++ compatibility.
will get this in the mangled name because C++ "sees though" the
typedef mpz_t to the underlying struct.
+ Incidentally, this probably means for C++ that our mp.h is not
+ compatible with an original BSD mp.h, since we use struct
+ __mpz_struct for MINT in ours. Maybe we could change to whatever
+ the original did, but it seems unlikely anyone would be using C++
+ with mp.h.
+
__gmpn - note that glibc defines some __mpn symbols, old versions of
some mpn routines, which it uses for floating point printfs.
diff --git a/gmp/doc/fdl-1.3.texi b/gmp/doc/fdl-1.3.texi
index 05804eecbb..8805f1a47d 100644
--- a/gmp/doc/fdl-1.3.texi
+++ b/gmp/doc/fdl-1.3.texi
@@ -5,7 +5,7 @@
@c hence no sectioning command or @node.
@display
-Copyright @copyright{} 2000-2002, 2007, 2008 Free Software Foundation, Inc.
+Copyright @copyright{} 2000, 2001, 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{https://www.gnu.org/copyleft/}.
+@uref{http://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
diff --git a/gmp/doc/gmp.info b/gmp/doc/gmp.info
new file mode 100644
index 0000000000..79a544546f
--- /dev/null
+++ b/gmp/doc/gmp.info
@@ -0,0 +1,177 @@
+This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.8 from
+../../gmp/doc/gmp.texi.
+
+ This manual describes how to install and use the GNU multiple
+precision arithmetic library, version 4.3.2.
+
+ Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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 version published by the Free Software Foundation;
+with no Invariant Sections, with the Front-Cover Texts being "A GNU
+Manual", and with the Back-Cover Texts being "You have freedom to copy
+and modify this GNU Manual, like GNU software". A copy of the license
+is included in *Note GNU Free Documentation License::.
+
+INFO-DIR-SECTION GNU libraries
+START-INFO-DIR-ENTRY
+* gmp: (gmp). GNU Multiple Precision Arithmetic Library.
+END-INFO-DIR-ENTRY
+
+
+Indirect:
+gmp.info-1: 975
+gmp.info-2: 299474
+
+Tag Table:
+(Indirect)
+Node: Top975
+Node: Copying3199
+Node: Introduction to GMP5050
+Node: Installing GMP7761
+Node: Build Options8493
+Node: ABI and ISA24561
+Node: Notes for Package Builds34239
+Node: Notes for Particular Systems37326
+Node: Known Build Problems44085
+Node: Performance optimization47619
+Node: GMP Basics48753
+Node: Headers and Libraries49401
+Node: Nomenclature and Types50825
+Node: Function Classes52533
+Node: Variable Conventions54226
+Node: Parameter Conventions55835
+Node: Memory Management57891
+Node: Reentrancy59019
+Node: Useful Macros and Constants60892
+Node: Compatibility with older versions61890
+Node: Demonstration Programs62851
+Node: Efficiency64716
+Node: Debugging72340
+Node: Profiling78898
+Node: Autoconf82889
+Node: Emacs84668
+Node: Reporting Bugs85274
+Node: Integer Functions87817
+Node: Initializing Integers88593
+Node: Assigning Integers90478
+Node: Simultaneous Integer Init & Assign92065
+Node: Converting Integers93690
+Node: Integer Arithmetic96612
+Node: Integer Division98214
+Node: Integer Exponentiation104642
+Node: Integer Roots105503
+Node: Number Theoretic Functions107177
+Node: Integer Comparisons113336
+Node: Integer Logic and Bit Fiddling114714
+Node: I/O of Integers117337
+Node: Integer Random Numbers120221
+Node: Integer Import and Export122844
+Node: Miscellaneous Integer Functions126854
+Node: Integer Special Functions128714
+Node: Rational Number Functions131801
+Node: Initializing Rationals132994
+Node: Rational Conversions135187
+Node: Rational Arithmetic136918
+Node: Comparing Rationals138254
+Node: Applying Integer Functions139621
+Node: I/O of Rationals141104
+Node: Floating-point Functions142964
+Node: Initializing Floats145849
+Node: Assigning Floats149546
+Node: Simultaneous Float Init & Assign152113
+Node: Converting Floats153641
+Node: Float Arithmetic156889
+Node: Float Comparison158934
+Node: I/O of Floats160521
+Node: Miscellaneous Float Functions163119
+Node: Low-level Functions165019
+Node: Random Number Functions187301
+Node: Random State Initialization188369
+Node: Random State Seeding191231
+Node: Random State Miscellaneous192620
+Node: Formatted Output193261
+Node: Formatted Output Strings193506
+Node: Formatted Output Functions198720
+Node: C++ Formatted Output202795
+Node: Formatted Input205477
+Node: Formatted Input Strings205713
+Node: Formatted Input Functions210365
+Node: C++ Formatted Input213334
+Node: C++ Class Interface215237
+Node: C++ Interface General216238
+Node: C++ Interface Integers219308
+Node: C++ Interface Rationals222739
+Node: C++ Interface Floats226416
+Node: C++ Interface Random Numbers231708
+Node: C++ Interface Limitations234114
+Node: BSD Compatible Functions236934
+Node: Custom Allocation241645
+Node: Language Bindings245963
+Node: Algorithms249916
+Node: Multiplication Algorithms250616
+Node: Basecase Multiplication251594
+Node: Karatsuba Multiplication253502
+Node: Toom 3-Way Multiplication257130
+Node: Toom 4-Way Multiplication263544
+Node: FFT Multiplication264916
+Node: Other Multiplication270252
+Node: Unbalanced Multiplication272726
+Node: Division Algorithms273517
+Node: Single Limb Division273864
+Node: Basecase Division276755
+Node: Divide and Conquer Division277958
+Node: Exact Division280195
+Node: Exact Remainder283362
+Node: Small Quotient Division285654
+Node: Greatest Common Divisor Algorithms287252
+Node: Binary GCD287549
+Node: Lehmer's Algorithm290398
+Node: Subquadratic GCD292618
+Node: Extended GCD295077
+Node: Jacobi Symbol296389
+Node: Powering Algorithms297305
+Node: Normal Powering Algorithm297568
+Node: Modular Powering Algorithm298096
+Node: Root Extraction Algorithms299159
+Node: Square Root Algorithm299474
+Node: Nth Root Algorithm301615
+Node: Perfect Square Algorithm302400
+Node: Perfect Power Algorithm304486
+Node: Radix Conversion Algorithms305107
+Node: Binary to Radix305483
+Node: Radix to Binary309412
+Node: Other Algorithms311500
+Node: Prime Testing Algorithm311852
+Node: Factorial Algorithm313036
+Node: Binomial Coefficients Algorithm314439
+Node: Fibonacci Numbers Algorithm315333
+Node: Lucas Numbers Algorithm317807
+Node: Random Number Algorithms318528
+Node: Assembly Coding320649
+Node: Assembly Code Organisation321609
+Node: Assembly Basics322576
+Node: Assembly Carry Propagation323726
+Node: Assembly Cache Handling325557
+Node: Assembly Functional Units327718
+Node: Assembly Floating Point329331
+Node: Assembly SIMD Instructions333109
+Node: Assembly Software Pipelining334091
+Node: Assembly Loop Unrolling335153
+Node: Assembly Writing Guide337368
+Node: Internals340133
+Node: Integer Internals340645
+Node: Rational Internals342901
+Node: Float Internals344139
+Node: Raw Output Internals351553
+Node: C++ Interface Internals352747
+Node: Contributors356045
+Node: References360597
+Node: GNU Free Documentation License366255
+Node: Concept Index391424
+Node: Function Index437886
+
+End Tag Table
diff --git a/gmp/doc/gmp.info-1 b/gmp/doc/gmp.info-1
index 171d224635..01d137bacf 100644
--- a/gmp/doc/gmp.info-1
+++ b/gmp/doc/gmp.info-1
@@ -1,10 +1,12 @@
-This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.13 from
+This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.8 from
../../gmp/doc/gmp.texi.
-This manual describes how to install and use the GNU multiple precision
-arithmetic library, version 6.0.0.
+ This manual describes how to install and use the GNU multiple
+precision arithmetic library, version 4.3.2.
- Copyright 1991, 1993-2014 Free Software Foundation, Inc.
+ Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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
@@ -12,7 +14,7 @@ document under the terms of the GNU Free Documentation License, Version
with no Invariant Sections, with the Front-Cover Texts being "A GNU
Manual", and with the Back-Cover Texts being "You have freedom to copy
and modify this GNU Manual, like GNU software". A copy of the license
-is included in *note GNU Free Documentation License::.
+is included in *Note GNU Free Documentation License::.
INFO-DIR-SECTION GNU libraries
START-INFO-DIR-ENTRY
@@ -26,9 +28,11 @@ GNU MP
******
This manual describes how to install and use the GNU multiple
-precision arithmetic library, version 6.0.0.
+precision arithmetic library, version 4.3.2.
- Copyright 1991, 1993-2014 Free Software Foundation, Inc.
+ Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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
@@ -36,7 +40,7 @@ document under the terms of the GNU Free Documentation License, Version
with no Invariant Sections, with the Front-Cover Texts being "A GNU
Manual", and with the Back-Cover Texts being "You have freedom to copy
and modify this GNU Manual, like GNU software". A copy of the license
-is included in *note GNU Free Documentation License::.
+is included in *Note GNU Free Documentation License::.
* Menu:
@@ -54,6 +58,7 @@ is included in *note GNU Free Documentation License::.
* Formatted Output:: `printf' style output.
* Formatted Input:: `scanf' style input.
* C++ Class Interface:: Class wrappers around GMP types.
+* BSD Compatible Functions:: All functions found in BSD MP.
* Custom Allocation:: How to customize the internal allocation.
* Language Bindings:: Using GMP from other languages.
* Algorithms:: What happens behind the scenes.
@@ -96,20 +101,11 @@ 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.
- 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.
+ 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'.

File: gmp.info, Node: Introduction to GMP, Next: Installing GMP, Prev: Copying, Up: Top
@@ -135,42 +131,43 @@ 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 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.
+ 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.
For up-to-date information on GMP, please see the GMP web pages at
- `https://gmplib.org/'
+ `http://gmplib.org/'
The latest version of the library is available at
- `https://ftp.gnu.org/gnu/gmp/'
+ `ftp://ftp.gnu.org/gnu/gmp/'
Many sites around the world mirror `ftp.gnu.org', please use a mirror
-near you, see `https://www.gnu.org/order/ftp.html' for a full list.
+near you, see `http://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
- `https://gmplib.org/mailman/listinfo/'.
+ `http://gmplib.org/mailman/listinfo/'.
The proper place for bug reports is <gmp-bugs@gmplib.org>. See
-*note Reporting Bugs:: for information about reporting bugs.
+*Note Reporting Bugs:: for information about reporting bugs.
1.1 How to use this Manual
==========================
-Everyone should read *note GMP Basics::. If you need to install the
-library yourself, then read *note Installing GMP::. If you have a
-system with multiple ABIs, then read *note ABI and ISA::, for the
+Everyone should read *Note GMP Basics::. If you need to install the
+library yourself, then read *Note Installing GMP::. If you have a
+system with multiple ABIs, then read *Note ABI and ISA::, for the
compiler options that must be used on applications.
The rest of the manual can be used for later reference, although it
@@ -197,7 +194,7 @@ And you can install (under `/usr/local' by default) with
make install
If you experience problems, please report them to
-<gmp-bugs@gmplib.org>. See *note Reporting Bugs::, for information on
+<gmp-bugs@gmplib.org>. See *Note Reporting Bugs::, for information on
what to include in useful bug reports.
* Menu:
@@ -220,7 +217,7 @@ All the usual autoconf configure options are available, run `./configure
installation information too.
Tools
- `configure' requires various Unix-like tools. See *note Notes for
+ `configure' requires various Unix-like tools. See *Note Notes for
Particular Systems::, for some options on non-Unix systems.
It might be possible to build without the help of `configure',
@@ -233,7 +230,7 @@ Build Directory
directory. For example
cd /my/build/dir
- /my/sources/gmp-6.0.0/configure
+ /my/sources/gmp-4.3.2/configure
Not all `make' programs have the necessary features (`VPATH') to
support this. In particular, SunOS and Slowaris `make' have bugs
@@ -324,7 +321,7 @@ CPU types
The best idea is always to build GMP for the exact machine type
you intend to run it on.
- The following CPUs have specific support. See `configure.ac' for
+ The following CPUs have specific support. See `configure.in' for
details of what code and compiler options they select.
* Alpha: alpha, alphaev5, alphaev56, alphapca56, alphapca57,
@@ -356,14 +353,17 @@ CPU types
pentium2, pentium3, pentium4, k6, k62, k63, athlon, amd64,
viac3, viac32
- * Other: arm, sh, sh2, vax,
+ * Other: a29k, arm, clipper, i960, ns32k, pyramid, sh, sh2, vax,
+ z8k
CPUs not listed will use generic C code.
Generic C Build
If some of the assembly code causes problems, or if otherwise
- desired, the generic C code can be selected with the configure
- `--disable-assembly'.
+ desired, the generic C code can be selected with CPU `none'. For
+ example,
+
+ ./configure --host=none-unknown-freebsd3.5
Note that this will run quite slowly, but it should be portable
and should at least make it possible to get something running if
@@ -384,7 +384,7 @@ Fat binary, `--enable-fat'
./configure --host=mips64-sgi-irix6 ABI=n32
- See *note ABI and ISA::, for the available choices on relevant
+ See *Note ABI and ISA::, for the available choices on relevant
CPUs, and what applications need to do.
`CC', `CFLAGS'
@@ -419,7 +419,8 @@ Fat binary, `--enable-fat'
Compiling is done with both `CPPFLAGS' and `CFLAGS', but
preprocessing uses just `CPPFLAGS'. This distinction is because
most preprocessors won't accept all the flags the compiler does.
- Preprocessing is done separately in some configure tests.
+ Preprocessing is done separately in some configure tests, and in
+ the `ansi2knr' support for K&R compilers.
`CC_FOR_BUILD'
Some build-time programs are compiled and run to generate
@@ -523,9 +524,13 @@ Temporary Memory, `--enable-alloca=<choice>'
FFT Multiplication, `--disable-fft'
By default multiplications are done using Karatsuba, 3-way Toom,
- higher degree Toom, and Fermat FFT. The FFT is only used on large
- to very large operands and can be disabled to save code size if
- desired.
+ and Fermat FFT. The FFT is only used on large to very large
+ operands and can be disabled to save code size if desired.
+
+Berkeley MP, `--enable-mpbsd'
+ The Berkeley MP compatibility library (`libmp') and header file
+ (`mp.h') are built and installed only if `--enable-mpbsd' is used.
+ *Note BSD Compatible Functions::.
Assertion Checking, `--enable-assert'
This option enables some consistency checking within the library.
@@ -549,14 +554,14 @@ Execution Profiling, `--enable-profiling=prof/gprof/instrument'
Documentation
The source for the document you're now reading is `doc/gmp.texi',
- in Texinfo format, see *note Texinfo: (texinfo)Top.
+ in Texinfo format, see *Note Texinfo: (texinfo)Top.
Info format `doc/gmp.info' is included in the distribution. The
usual automake targets are available to make PostScript, DVI, PDF
and HTML (these will require various TeX and Texinfo tools).
DocBook and XML can be generated by the Texinfo `makeinfo' program
- too, see *note Options for `makeinfo': (texinfo)makeinfo options.
+ too, see *Note Options for `makeinfo': (texinfo)makeinfo options.
Some supplementary notes can also be found in the `doc'
subdirectory.
@@ -628,15 +633,6 @@ 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')
@@ -739,7 +735,7 @@ MIPS under IRIX 6 (`mips*-*-irix[6789]')
PowerPC 64 (`powerpc64', `powerpc620', `powerpc630', `powerpc970', `power4', `power5')
- `ABI=mode64'
+ `ABI=aix64'
The AIX 64 ABI uses 64-bit limbs and pointers and is the
default on PowerPC 64 `*-*-aix*' systems. Applications must
be compiled with
@@ -747,26 +743,28 @@ PowerPC 64 (`powerpc64', `powerpc620', `powerpc630', `powerpc970', `power4', `po
gcc -maix64
xlc -q64
- On 64-bit GNU/Linux, BSD, and Mac OS X/Darwin systems, the
- applications must be compiled with
+ `ABI=mode64'
+ The `mode64' ABI uses 64-bit limbs and pointers, and is the
+ default on 64-bit GNU/Linux, BSD, and Mac OS X/Darwin
+ systems. Applications must be compiled with
gcc -m64
`ABI=mode32'
The `mode32' ABI uses a 64-bit `long long' limb but with the
chip still in 32-bit mode and using 32-bit calling
- conventions. This is the default for systems where the true
- 64-bit ABI is unavailable. No special compiler options are
- typically needed for applications. This ABI is not available
- under AIX.
+ conventions. This is the default on for systems where the
+ true 64-bit ABIs are unavailable. No special compiler
+ options are needed for applications.
`ABI=32'
This is the basic 32-bit PowerPC ABI, with a 32-bit limb. No
special compiler options are needed for applications.
- GMP's speed is greatest for the `mode64' ABI, the `mode32' ABI is
- 2nd best. In `ABI=32' only the 32-bit ISA is used and this
- doesn't make full use of a 64-bit chip.
+ GMP speed is greatest in `aix64' and `mode32'. In `ABI=32' only
+ the 32-bit ISA is used and this doesn't make full use of a 64-bit
+ chip. On a suitable system we could perhaps use more of the ISA,
+ but there are no plans to do so.
Sparc V9 (`sparc64', `sparcv9', `ultrasparc*')
@@ -866,7 +864,7 @@ as making it possible for a user to omit `--build' (and `--host') so
`--build' will be wanted for systems where `./config.guess' is inexact.
On systems with multiple ABIs, a packaged build will need to decide
-which among the choices is to be provided, see *note ABI and ISA::. A
+which among the choices is to be provided, see *Note ABI and ISA::. A
given run of `./configure' etc will only build one ABI. If a second
ABI is also required then a second run of `./configure' etc must be
made, starting from a clean directory tree (`make distclean').
@@ -926,19 +924,10 @@ 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 6.0 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.
+MacOS 9
+ The `macos' directory contains an unsupported port to MacOS 9 on
+ Power Macintosh, see `macos/README'. Note that MacOS X "Darwin"
+ should use the normal Unix-style `./configure'.
MS-DOS and MS Windows
On an MS-DOS system DJGPP can be used to build GMP, and on an MS
@@ -983,15 +972,6 @@ 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
@@ -1004,11 +984,10 @@ Power CPU Types
choose the right one for the CPU that will be used. Currently GMP
has no assembly code support for using just the common instruction
subset. To get executables that run on both, the current
- suggestion is to use the generic C code (`--disable-assembly'),
- possibly with appropriate compiler options (like `-mcpu=common' for
- `gcc'). CPU `rs6000' (which is not a CPU but a family of
- workstations) is accepted by `config.sub', but is currently
- equivalent to `--disable-assembly'.
+ suggestion is to use the generic C code (CPU `none'), possibly
+ with appropriate compiler options (like `-mcpu=common' for `gcc').
+ CPU `rs6000' (which is not a CPU but a family of workstations) is
+ accepted by `config.sub', but is currently equivalent to `none'.
Sparc CPU Types
`sparcv8' or `supersparc' on relevant systems will give a
@@ -1025,7 +1004,7 @@ Sparc App Regs
`-mcmodel=embmedany' (which uses `g4' as a data segment pointer),
and for applications wanting to use those registers for special
purposes. In these cases the only suggestion currently is to
- build GMP with `--disable-assembly' to avoid the assembly code.
+ build GMP with CPU `none' to avoid the assembly code.
SunOS 4
`/usr/bin/m4' lacks various features needed to process `.asm'
@@ -1061,7 +1040,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 `https://gmplib.org/'.
+You might find more up-to-date information at `http://gmplib.org/'.
Compiler link options
The version of libtool currently in use rather aggressively strips
@@ -1145,7 +1124,7 @@ File: gmp.info, Node: Performance optimization, Prev: Known Build Problems, U
============================
For optimal performance, build GMP for the exact CPU type of the target
-computer, see *note Build Options::.
+computer, see *Note Build Options::.
Unlike what is the case for most other programs, the compiler
typically doesn't matter much, since GMP uses assembly language for the
@@ -1161,7 +1140,7 @@ program in the `tune' subdirectory, can be important. For example,
will generate better contents for the `gmp-mparam.h' parameter file.
- To use the results, put the output in the file indicated in the
+ To use the results, put the output in the file file indicated in the
`Parameters for ...' header. Then recompile from scratch.
The `tuneup' program takes one useful parameter, `-f NNN', which
@@ -1214,10 +1193,10 @@ parameters are only provided if `<stdio.h>' is included too.
#include <stdio.h>
#include <gmp.h>
- 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.
+ 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.
All programs using GMP must link against the `libgmp' library. On a
typical Unix-like system this can be done with `-lgmp', for example
@@ -1274,22 +1253,17 @@ body is analogous to a digit, only larger, and containing several
digits.) Normally a limb is 32 or 64 bits. The C data type for a limb
is `mp_limb_t'.
- Counts of limbs of a multi-precision number represented in the C type
-`mp_size_t'. Currently this is normally a `long', but on some systems
-it's an `int' for efficiency, and on some systems it will be `long
-long' in the future.
-
- Counts of bits of a multi-precision number are represented in the C
-type `mp_bitcnt_t'. Currently this is always an `unsigned long', but on
-some systems it will be an `unsigned long long' in the future.
+ Counts of limbs are represented in the C type `mp_size_t'. Currently
+this is normally a `long', but on some systems it's an `int' for
+efficiency.
"Random state" means an algorithm selection and current state data.
The C data type for such objects is `gmp_randstate_t'. For example:
gmp_randstate_t rstate;
- Also, in general `mp_bitcnt_t' is used for bit counts and ranges, and
-`size_t' is used for byte or character counts.
+ Also, in general `unsigned long' is used for bit counts and ranges,
+and `size_t' is used for byte or character counts.

File: gmp.info, Node: Function Classes, Next: Variable Conventions, Prev: Nomenclature and Types, Up: GMP Basics
@@ -1304,23 +1278,27 @@ There are six classes of functions in the GMP library:
functions in this class. (*note Integer Functions::)
2. Functions for rational number arithmetic, with names beginning with
- `mpq_'. The associated type is `mpq_t'. There are about 35
+ `mpq_'. The associated type is `mpq_t'. There are about 40
functions in this class, but the integer functions can be used for
arithmetic on the numerator and denominator separately. (*note
Rational Number Functions::)
3. Functions for floating-point arithmetic, with names beginning with
- `mpf_'. The associated type is `mpf_t'. There are about 70
+ `mpf_'. The associated type is `mpf_t'. There are about 60
functions is this class. (*note Floating-point Functions::)
- 4. Fast low-level functions that operate on natural numbers. These
+ 4. Functions compatible with Berkeley MP, such as `itom', `madd', and
+ `mult'. The associated type is `MINT'. (*note BSD Compatible
+ Functions::)
+
+ 5. Fast low-level functions that operate on natural numbers. These
are used by the functions in the preceding groups, and you can
also call them directly from very time-critical user programs.
These functions' names begin with `mpn_'. The associated type is
- array of `mp_limb_t'. There are about 60 (hard-to-use) functions
+ array of `mp_limb_t'. There are about 30 (hard-to-use) functions
in this class. (*note Low-level Functions::)
- 5. Miscellaneous functions. Functions for setting up custom
+ 6. Miscellaneous functions. Functions for setting up custom
allocation and functions for generating random numbers. (*note
Custom Allocation::, and *note Random Number Functions::)
@@ -1447,9 +1425,9 @@ of space, determined by the chosen precision and allocated at
initialization, so their size doesn't change.
All memory is allocated using `malloc' and friends by default, but
-this can be changed, see *note Custom Allocation::. Temporary memory
+this can be changed, see *Note Custom Allocation::. Temporary memory
on the stack is also used (via `alloca'), but this can be changed at
-build-time if desired, see *note Build Options::.
+build-time if desired, see *Note Build Options::.

File: gmp.info, Node: Reentrancy, Next: Useful Macros and Constants, Prev: Memory Management, Up: GMP Basics
@@ -1488,11 +1466,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 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 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.

File: gmp.info, Node: Useful Macros and Constants, Next: Compatibility with older versions, Prev: Reentrancy, Up: GMP Basics
@@ -1513,8 +1491,8 @@ 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 "6.0.0". Note that the format "i.j" was
- used, before version 4.3.0, when k was zero.
+ "i.j.k". This release is "4.3.2". Note that the format "i.j" was
+ used when k was zero was used before version 4.3.0.
-- Macro: __GMP_CC
-- Macro: __GMP_CFLAGS
@@ -1527,9 +1505,9 @@ File: gmp.info, Node: Compatibility with older versions, Next: Demonstration P
3.9 Compatibility with older versions
=====================================
-This version of GMP is upwardly binary compatible with all 5.x, 4.x,
-and 3.x versions, and upwardly compatible at the source level with all
-2.x versions, with the following exceptions.
+This version of GMP is upwardly binary compatible with all 4.x and 3.x
+versions, and upwardly compatible at the source level with all 2.x
+versions, with the following exceptions.
* `mpn_gcd' had its source arguments swapped as of GMP 3.0, for
consistency with other `mpn' functions.
@@ -1537,12 +1515,12 @@ and 3.x versions, and upwardly compatible at the source level with all
* `mpf_get_prec' counted precision slightly differently in GMP 3.0
and 3.0.1, but in 3.1 reverted to the 2.x style.
- * `mpn_bdivmod', documented as preliminary in GMP 4, has been
- removed.
-
There are a number of compatibility issues between GMP 1 and GMP 2
that of course also apply when porting applications from GMP 1 to GMP
-5. Please see the GMP 2 manual for details.
+4. Please see the GMP 2 manual for details.
+
+ The Berkeley MP compatibility library (*note BSD Compatible
+Functions::) is source and binary compatible with the standard `libmp'.

File: gmp.info, Node: Demonstration Programs, Next: Efficiency, Prev: Compatibility with older versions, Up: GMP Basics
@@ -1765,7 +1743,7 @@ File: gmp.info, Node: Debugging, Next: Profiling, Prev: Efficiency, Up: GMP
Stack Overflow
Depending on the system, a segmentation violation or bus error
might be the only indication of stack overflow. See
- `--enable-alloca' choices in *note Build Options::, for how to
+ `--enable-alloca' choices in *Note Build Options::, for how to
address this.
In new enough versions of GCC, `-fstack-check' may be able to
@@ -1788,7 +1766,7 @@ Heap Problems
In all such cases a `malloc' debugger is recommended. On a GNU or
BSD system the standard C library `malloc' has some diagnostic
- facilities, see *note Allocation Debugging: (libc)Allocation
+ facilities, see *Note Allocation Debugging: (libc)Allocation
Debugging, or `man 3 malloc'. Other possibilities, in no
particular order, include
@@ -1829,14 +1807,14 @@ Source File Paths
path to the source directory.
cd /my/build/dir
- /my/source/dir/gmp-6.0.0/configure
+ /my/source/dir/gmp-4.3.2/configure
This works via `VPATH', and might require GNU `make'. Alternately
it might be possible to change the `.c.lo' rules appropriately.
Assertion Checking
The build option `--enable-assert' is available to add some
- consistency checks to the library (see *note Build Options::).
+ consistency checks to the library (see *Note Build Options::).
These are likely to be of limited value to most applications.
Assertion failures are just as likely to indicate memory
corruption as a library or compiler bug.
@@ -1845,8 +1823,8 @@ Assertion Checking
benefit from `--enable-assert' since it adds checks on the
parameters of most such functions, many of which have subtle
restrictions on their usage. Note however that only the generic C
- code has checks, not the assembly code, so `--disable-assembly'
- should be used for maximum checking.
+ code has checks, not the assembly code, so CPU `none' should be
+ used for maximum checking.
Temporary Memory Checking
The build option `--enable-alloca=debug' arranges that each block
@@ -1866,47 +1844,39 @@ Maximum Debuggability
would be
./configure --disable-shared --enable-assert \
- --enable-alloca=debug --disable-assembly CFLAGS=-g
+ --enable-alloca=debug --host=none CFLAGS=-g
For C++, add `--enable-cxx CXXFLAGS=-g'.
Checker
- The GCC checker (`https://savannah.nongnu.org/projects/checker/')
+ The GCC checker (`http://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.
A build of GMP with checking within GMP itself can be made. This
will run very very slowly. On GNU/Linux for example,
- ./configure --disable-assembly CC=checkergcc
+ ./configure --host=none-pc-linux-gnu CC=checkergcc
- `--disable-assembly' must be used, since the GMP assembly code
- doesn't support the checking scheme. The GMP C++ features cannot
- be used, since current versions of checker (0.9.9.1) don't yet
- support the standard C++ library.
+ `--host=none' must be used, since the GMP assembly code doesn't
+ support the checking scheme. The GMP C++ features cannot be used,
+ since current versions of checker (0.9.9.1) don't yet support the
+ standard C++ library.
Valgrind
- Valgrind (`http://valgrind.org/') is a memory checker for x86,
- ARM, MIPS, PowerPC, and S/390. It translates and emulates machine
- instructions to do strong checks for uninitialized data (at the
- level of individual bits), memory accesses through bad pointers,
- and memory leaks.
-
- Valgrind does not always support every possible instruction, in
- particular ones recently added to an ISA. Valgrind might
- therefore be incompatible with a recent GMP or even a less recent
- GMP which is compiled using a recent GCC.
-
- GMP's assembly code sometimes promotes a read of the limbs to some
- larger size, for efficiency. GMP will do this even at the start
- and end of a multilimb operand, using naturally aligned operations
- on the larger type. This may lead to benign reads outside of
- allocated areas, triggering complaints from Valgrind. Valgrind's
- option `--partial-loads-ok=yes' should help.
+ The valgrind program (`http://valgrind.org/') is a memory checker
+ for x86s. It translates and emulates machine instructions to do
+ strong checks for uninitialized data (at the level of individual
+ bits), memory accesses through bad pointers, and memory leaks.
+
+ Recent versions of Valgrind are getting support for MMX and
+ SSE/SSE2 instructions, for past versions GMP will need to be
+ configured not to use those, ie. for an x86 without them (for
+ instance plain `i486').
Other Problems
Any suspected bug in GMP itself should be isolated to make sure
- it's not an application problem, see *note Reporting Bugs::.
+ it's not an application problem, see *Note Reporting Bugs::.

File: gmp.info, Node: Profiling, Next: Autoconf, Prev: Debugging, Up: GMP Basics
@@ -2020,7 +1990,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 https://gmplib.org/])])
+ [AC_MSG_ERROR([GNU MP not found, see http://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'
@@ -2028,7 +1998,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 https://gmplib.org/])])
+ [GNU MP not found, or not 3.1 or up, see http://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
@@ -2076,10 +2046,10 @@ If you think you have found a bug in the GMP library, please
investigate it and report it. We have made this library available to
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 `https://gmplib.org/' for
-patches for this release.
+ 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.
Please include the following in any report,
@@ -2096,10 +2066,7 @@ patches for this release.
* Please do not send core dumps, executables or `strace's.
- * The `configure' options you used when building GMP, if any.
-
- * The output from `configure', as printed to stdout, with any
- options used.
+ * The configuration options you used when building GMP, if any.
* The name of the compiler and its version. For `gcc', get the
version with `gcc -v', otherwise perhaps `what `which cc`', or
@@ -2194,35 +2161,22 @@ object is initialized.
-- Function: void mpz_init (mpz_t X)
Initialize X, and set its value to 0.
- -- Function: void mpz_inits (mpz_t X, ...)
- Initialize a NULL-terminated list of `mpz_t' variables, and set
- their values to 0.
-
- -- Function: void mpz_init2 (mpz_t X, mp_bitcnt_t N)
+ -- Function: void mpz_init2 (mpz_t X, unsigned long N)
Initialize X, with space for N-bit numbers, and set its value to 0.
Calling this function instead of `mpz_init' or `mpz_inits' is never
necessary; reallocation is handled automatically by GMP when
needed.
- While N defines the initial space, X will grow automatically in the
+ N is only the initial space, X will grow automatically in the
normal way, if necessary, for subsequent values stored.
`mpz_init2' makes it possible to avoid such reallocations if a
maximum size is known in advance.
- In preparation for an operation, GMP often allocates one limb more
- than ultimately needed. To make sure GMP will not perform
- reallocation for X, you need to add the number of bits in
- `mp_limb_t' to N.
-
-- Function: void mpz_clear (mpz_t X)
Free the space occupied by X. Call this function for all `mpz_t'
variables when you are done with them.
- -- Function: void mpz_clears (mpz_t X, ...)
- Free the space occupied by a NULL-terminated list of `mpz_t'
- variables.
-
- -- Function: void mpz_realloc2 (mpz_t X, mp_bitcnt_t N)
+ -- Function: void mpz_realloc2 (mpz_t X, unsigned long N)
Change the space allocated for X to N bits. The value in X is
preserved if it fits, or is set to 0 if not.
@@ -2241,18 +2195,18 @@ File: gmp.info, Node: Assigning Integers, Next: Simultaneous Integer Init & As
These functions assign new values to already initialized integers
(*note Initializing Integers::).
- -- Function: void mpz_set (mpz_t ROP, const mpz_t OP)
+ -- Function: void mpz_set (mpz_t ROP, mpz_t OP)
-- Function: void mpz_set_ui (mpz_t ROP, unsigned long int OP)
-- Function: void mpz_set_si (mpz_t ROP, signed long int OP)
-- Function: void mpz_set_d (mpz_t ROP, double OP)
- -- Function: void mpz_set_q (mpz_t ROP, const mpq_t OP)
- -- Function: void mpz_set_f (mpz_t ROP, const mpf_t OP)
+ -- Function: void mpz_set_q (mpz_t ROP, mpq_t OP)
+ -- Function: void mpz_set_f (mpz_t ROP, mpf_t OP)
Set the value of ROP from OP.
`mpz_set_d', `mpz_set_q' and `mpz_set_f' truncate OP to make it an
integer.
- -- Function: int mpz_set_str (mpz_t ROP, const char *STR, int BASE)
+ -- Function: int mpz_set_str (mpz_t ROP, char *STR, int BASE)
Set the value of ROP from STR, a null-terminated C string in base
BASE. White space is allowed in the string, and is simply ignored.
@@ -2297,15 +2251,14 @@ functions, it can be used as the source or destination operand for the
ordinary integer functions. Don't use an initialize-and-set function
on a variable already initialized!
- -- Function: void mpz_init_set (mpz_t ROP, const mpz_t OP)
+ -- Function: void mpz_init_set (mpz_t ROP, mpz_t OP)
-- Function: void mpz_init_set_ui (mpz_t ROP, unsigned long int OP)
-- Function: void mpz_init_set_si (mpz_t ROP, signed long int OP)
-- Function: void mpz_init_set_d (mpz_t ROP, double OP)
Initialize ROP with limb space and set the initial numeric value
from OP.
- -- Function: int mpz_init_set_str (mpz_t ROP, const char *STR, int
- BASE)
+ -- Function: int mpz_init_set_str (mpz_t ROP, char *STR, int BASE)
Initialize ROP and set its value like `mpz_set_str' (see its
documentation above for details).
@@ -2321,16 +2274,16 @@ File: gmp.info, Node: Converting Integers, Next: Integer Arithmetic, Prev: Si
This section describes functions for converting GMP integers to
standard C types. Functions for converting _to_ GMP integers are
-described in *note Assigning Integers:: and *note I/O of Integers::.
+described in *Note Assigning Integers:: and *Note I/O of Integers::.
- -- Function: unsigned long int mpz_get_ui (const mpz_t OP)
+ -- Function: unsigned long int mpz_get_ui (mpz_t OP)
Return the value of OP as an `unsigned long'.
If OP is too big to fit an `unsigned long' then just the least
significant bits that do fit are returned. The sign of OP is
ignored, only the absolute value is used.
- -- Function: signed long int mpz_get_si (const mpz_t OP)
+ -- Function: signed long int mpz_get_si (mpz_t OP)
If OP fits into a `signed long int' return the value of OP.
Otherwise return the least significant part of OP, with the same
sign as OP.
@@ -2339,17 +2292,16 @@ described in *note Assigning Integers:: and *note I/O of Integers::.
result is probably not very useful. To find out if the value will
fit, use the function `mpz_fits_slong_p'.
- -- Function: double mpz_get_d (const mpz_t OP)
- Convert OP to a `double', truncating if necessary (i.e. rounding
+ -- Function: double mpz_get_d (mpz_t OP)
+ Convert OP to a `double', truncating if necessary (ie. rounding
towards zero).
If the exponent from the conversion is too big, the result is
system dependent. An infinity is returned where available. A
hardware overflow trap may or may not occur.
- -- Function: double mpz_get_d_2exp (signed long int *EXP, const mpz_t
- OP)
- Convert OP to a `double', truncating if necessary (i.e. rounding
+ -- Function: double mpz_get_d_2exp (signed long int *EXP, mpz_t OP)
+ Convert OP to a `double', truncating if necessary (ie. rounding
towards zero), and returning the exponent separately.
The return value is in the range 0.5<=abs(D)<1 and the exponent is
@@ -2359,7 +2311,7 @@ described in *note Assigning Integers:: and *note I/O of Integers::.
This is similar to the standard C `frexp' function (*note
Normalization Functions: (libc)Normalization Functions.).
- -- Function: char * mpz_get_str (char *STR, int BASE, const mpz_t OP)
+ -- Function: char * mpz_get_str (char *STR, int BASE, mpz_t OP)
Convert OP to a string of digits in base BASE. The base argument
may vary from 2 to 62 or from -2 to -36.
@@ -2387,45 +2339,43 @@ File: gmp.info, Node: Integer Arithmetic, Next: Integer Division, Prev: Conve
5.5 Arithmetic Functions
========================
- -- Function: void mpz_add (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
- -- Function: void mpz_add_ui (mpz_t ROP, const mpz_t OP1, unsigned
- long int OP2)
+ -- Function: void mpz_add (mpz_t ROP, mpz_t OP1, mpz_t OP2)
+ -- Function: void mpz_add_ui (mpz_t ROP, mpz_t OP1, unsigned long int
+ OP2)
Set ROP to OP1 + OP2.
- -- Function: void mpz_sub (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
- -- Function: void mpz_sub_ui (mpz_t ROP, const mpz_t OP1, unsigned
- long int OP2)
- -- Function: void mpz_ui_sub (mpz_t ROP, unsigned long int OP1, const
- mpz_t OP2)
+ -- Function: void mpz_sub (mpz_t ROP, mpz_t OP1, mpz_t OP2)
+ -- Function: void mpz_sub_ui (mpz_t ROP, mpz_t OP1, unsigned long int
+ OP2)
+ -- Function: void mpz_ui_sub (mpz_t ROP, unsigned long int OP1, mpz_t
+ OP2)
Set ROP to OP1 - OP2.
- -- Function: void mpz_mul (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
- -- Function: void mpz_mul_si (mpz_t ROP, const mpz_t OP1, long int OP2)
- -- Function: void mpz_mul_ui (mpz_t ROP, const mpz_t OP1, unsigned
- long int OP2)
+ -- Function: void mpz_mul (mpz_t ROP, mpz_t OP1, mpz_t OP2)
+ -- Function: void mpz_mul_si (mpz_t ROP, mpz_t OP1, long int OP2)
+ -- Function: void mpz_mul_ui (mpz_t ROP, mpz_t OP1, unsigned long int
+ OP2)
Set ROP to OP1 times OP2.
- -- Function: void mpz_addmul (mpz_t ROP, const mpz_t OP1, const mpz_t
- OP2)
- -- Function: void mpz_addmul_ui (mpz_t ROP, const mpz_t OP1, unsigned
- long int OP2)
+ -- Function: void mpz_addmul (mpz_t ROP, mpz_t OP1, mpz_t OP2)
+ -- Function: void mpz_addmul_ui (mpz_t ROP, mpz_t OP1, unsigned long
+ int OP2)
Set ROP to ROP + OP1 times OP2.
- -- Function: void mpz_submul (mpz_t ROP, const mpz_t OP1, const mpz_t
- OP2)
- -- Function: void mpz_submul_ui (mpz_t ROP, const mpz_t OP1, unsigned
- long int OP2)
+ -- Function: void mpz_submul (mpz_t ROP, mpz_t OP1, mpz_t OP2)
+ -- Function: void mpz_submul_ui (mpz_t ROP, mpz_t OP1, unsigned long
+ int OP2)
Set ROP to ROP - OP1 times OP2.
- -- Function: void mpz_mul_2exp (mpz_t ROP, const mpz_t OP1,
- mp_bitcnt_t OP2)
+ -- Function: void mpz_mul_2exp (mpz_t ROP, mpz_t OP1, unsigned long
+ int OP2)
Set ROP to OP1 times 2 raised to OP2. This operation can also be
defined as a left shift by OP2 bits.
- -- Function: void mpz_neg (mpz_t ROP, const mpz_t OP)
+ -- Function: void mpz_neg (mpz_t ROP, mpz_t OP)
Set ROP to -OP.
- -- Function: void mpz_abs (mpz_t ROP, const mpz_t OP)
+ -- Function: void mpz_abs (mpz_t ROP, mpz_t OP)
Set ROP to the absolute value of OP.

@@ -2440,56 +2390,53 @@ functions `mpz_powm' and `mpz_powm_ui'), will cause an intentional
division by zero. This lets a program handle arithmetic exceptions in
these functions the same way as for normal C `int' arithmetic.
- -- Function: void mpz_cdiv_q (mpz_t Q, const mpz_t N, const mpz_t D)
- -- Function: void mpz_cdiv_r (mpz_t R, const mpz_t N, const mpz_t D)
- -- Function: void mpz_cdiv_qr (mpz_t Q, mpz_t R, const mpz_t N, const
- mpz_t D)
- -- Function: unsigned long int mpz_cdiv_q_ui (mpz_t Q, const mpz_t N,
+ -- Function: void mpz_cdiv_q (mpz_t Q, mpz_t N, mpz_t D)
+ -- Function: void mpz_cdiv_r (mpz_t R, mpz_t N, mpz_t D)
+ -- Function: void mpz_cdiv_qr (mpz_t Q, mpz_t R, mpz_t N, mpz_t D)
+ -- Function: unsigned long int mpz_cdiv_q_ui (mpz_t Q, mpz_t N,
unsigned long int D)
- -- Function: unsigned long int mpz_cdiv_r_ui (mpz_t R, const mpz_t N,
+ -- Function: unsigned long int mpz_cdiv_r_ui (mpz_t R, mpz_t N,
unsigned long int D)
-- Function: unsigned long int mpz_cdiv_qr_ui (mpz_t Q, mpz_t R,
- const mpz_t N, unsigned long int D)
- -- Function: unsigned long int mpz_cdiv_ui (const mpz_t N,
+ mpz_t N, unsigned long int D)
+ -- Function: unsigned long int mpz_cdiv_ui (mpz_t N,
unsigned long int D)
- -- Function: void mpz_cdiv_q_2exp (mpz_t Q, const mpz_t N,
- mp_bitcnt_t B)
- -- Function: void mpz_cdiv_r_2exp (mpz_t R, const mpz_t N,
- mp_bitcnt_t B)
-
- -- Function: void mpz_fdiv_q (mpz_t Q, const mpz_t N, const mpz_t D)
- -- Function: void mpz_fdiv_r (mpz_t R, const mpz_t N, const mpz_t D)
- -- Function: void mpz_fdiv_qr (mpz_t Q, mpz_t R, const mpz_t N, const
- mpz_t D)
- -- Function: unsigned long int mpz_fdiv_q_ui (mpz_t Q, const mpz_t N,
+ -- Function: void mpz_cdiv_q_2exp (mpz_t Q, mpz_t N,
+ unsigned long int B)
+ -- Function: void mpz_cdiv_r_2exp (mpz_t R, mpz_t N,
+ unsigned long int B)
+
+ -- Function: void mpz_fdiv_q (mpz_t Q, mpz_t N, mpz_t D)
+ -- Function: void mpz_fdiv_r (mpz_t R, mpz_t N, mpz_t D)
+ -- Function: void mpz_fdiv_qr (mpz_t Q, mpz_t R, mpz_t N, mpz_t D)
+ -- Function: unsigned long int mpz_fdiv_q_ui (mpz_t Q, mpz_t N,
unsigned long int D)
- -- Function: unsigned long int mpz_fdiv_r_ui (mpz_t R, const mpz_t N,
+ -- Function: unsigned long int mpz_fdiv_r_ui (mpz_t R, mpz_t N,
unsigned long int D)
-- Function: unsigned long int mpz_fdiv_qr_ui (mpz_t Q, mpz_t R,
- const mpz_t N, unsigned long int D)
- -- Function: unsigned long int mpz_fdiv_ui (const mpz_t N,
+ mpz_t N, unsigned long int D)
+ -- Function: unsigned long int mpz_fdiv_ui (mpz_t N,
unsigned long int D)
- -- Function: void mpz_fdiv_q_2exp (mpz_t Q, const mpz_t N,
- mp_bitcnt_t B)
- -- Function: void mpz_fdiv_r_2exp (mpz_t R, const mpz_t N,
- mp_bitcnt_t B)
-
- -- Function: void mpz_tdiv_q (mpz_t Q, const mpz_t N, const mpz_t D)
- -- Function: void mpz_tdiv_r (mpz_t R, const mpz_t N, const mpz_t D)
- -- Function: void mpz_tdiv_qr (mpz_t Q, mpz_t R, const mpz_t N, const
- mpz_t D)
- -- Function: unsigned long int mpz_tdiv_q_ui (mpz_t Q, const mpz_t N,
+ -- Function: void mpz_fdiv_q_2exp (mpz_t Q, mpz_t N,
+ unsigned long int B)
+ -- Function: void mpz_fdiv_r_2exp (mpz_t R, mpz_t N,
+ unsigned long int B)
+
+ -- Function: void mpz_tdiv_q (mpz_t Q, mpz_t N, mpz_t D)
+ -- Function: void mpz_tdiv_r (mpz_t R, mpz_t N, mpz_t D)
+ -- Function: void mpz_tdiv_qr (mpz_t Q, mpz_t R, mpz_t N, mpz_t D)
+ -- Function: unsigned long int mpz_tdiv_q_ui (mpz_t Q, mpz_t N,
unsigned long int D)
- -- Function: unsigned long int mpz_tdiv_r_ui (mpz_t R, const mpz_t N,
+ -- Function: unsigned long int mpz_tdiv_r_ui (mpz_t R, mpz_t N,
unsigned long int D)
-- Function: unsigned long int mpz_tdiv_qr_ui (mpz_t Q, mpz_t R,
- const mpz_t N, unsigned long int D)
- -- Function: unsigned long int mpz_tdiv_ui (const mpz_t N,
+ mpz_t N, unsigned long int D)
+ -- Function: unsigned long int mpz_tdiv_ui (mpz_t N,
unsigned long int D)
- -- Function: void mpz_tdiv_q_2exp (mpz_t Q, const mpz_t N,
- mp_bitcnt_t B)
- -- Function: void mpz_tdiv_r_2exp (mpz_t R, const mpz_t N,
- mp_bitcnt_t B)
+ -- Function: void mpz_tdiv_q_2exp (mpz_t Q, mpz_t N,
+ unsigned long int B)
+ -- Function: void mpz_tdiv_r_2exp (mpz_t R, mpz_t N,
+ unsigned long int B)
Divide N by D, forming a quotient Q and/or remainder R. For the
`2exp' functions, D=2^B. The rounding is in three styles, each
@@ -2527,8 +2474,8 @@ these functions the same way as for normal C `int' arithmetic.
the same as the bitwise logical functions do, whereas
`mpz_tdiv_q_2exp' effectively treats N as sign and magnitude.
- -- Function: void mpz_mod (mpz_t R, const mpz_t N, const mpz_t D)
- -- Function: unsigned long int mpz_mod_ui (mpz_t R, const mpz_t N,
+ -- Function: void mpz_mod (mpz_t R, mpz_t N, mpz_t D)
+ -- Function: unsigned long int mpz_mod_ui (mpz_t R, mpz_t N,
unsigned long int D)
Set R to N `mod' D. The sign of the divisor is ignored; the
result is always non-negative.
@@ -2537,9 +2484,8 @@ these functions the same way as for normal C `int' arithmetic.
remainder as well as setting R. See `mpz_fdiv_ui' above if only
the return value is wanted.
- -- Function: void mpz_divexact (mpz_t Q, const mpz_t N, const mpz_t D)
- -- Function: void mpz_divexact_ui (mpz_t Q, const mpz_t N, unsigned
- long D)
+ -- Function: void mpz_divexact (mpz_t Q, mpz_t N, mpz_t D)
+ -- Function: void mpz_divexact_ui (mpz_t Q, mpz_t N, unsigned long D)
Set Q to N/D. These functions produce correct results only when
it is known in advance that D divides N.
@@ -2547,10 +2493,9 @@ these functions the same way as for normal C `int' arithmetic.
and are the best choice when exact division is known to occur, for
example reducing a rational to lowest terms.
- -- Function: int mpz_divisible_p (const mpz_t N, const mpz_t D)
- -- Function: int mpz_divisible_ui_p (const mpz_t N, unsigned long int
- D)
- -- Function: int mpz_divisible_2exp_p (const mpz_t N, mp_bitcnt_t B)
+ -- Function: int mpz_divisible_p (mpz_t N, mpz_t D)
+ -- Function: int mpz_divisible_ui_p (mpz_t N, unsigned long int D)
+ -- Function: int mpz_divisible_2exp_p (mpz_t N, unsigned long int B)
Return non-zero if N is exactly divisible by D, or in the case of
`mpz_divisible_2exp_p' by 2^B.
@@ -2559,12 +2504,11 @@ these functions the same way as for normal C `int' arithmetic.
following the rule it can be seen that only 0 is considered
divisible by 0.
- -- Function: int mpz_congruent_p (const mpz_t N, const mpz_t C, const
- mpz_t D)
- -- Function: int mpz_congruent_ui_p (const mpz_t N, unsigned long int
- C, unsigned long int D)
- -- Function: int mpz_congruent_2exp_p (const mpz_t N, const mpz_t C,
- mp_bitcnt_t B)
+ -- Function: int mpz_congruent_p (mpz_t N, mpz_t C, mpz_t D)
+ -- Function: int mpz_congruent_ui_p (mpz_t N, unsigned long int C,
+ unsigned long int D)
+ -- Function: int mpz_congruent_2exp_p (mpz_t N, mpz_t C, unsigned long
+ int B)
Return non-zero if N is congruent to C modulo D, or in the case of
`mpz_congruent_2exp_p' modulo 2^B.
@@ -2579,31 +2523,18 @@ File: gmp.info, Node: Integer Exponentiation, Next: Integer Roots, Prev: Inte
5.7 Exponentiation Functions
============================
- -- Function: void mpz_powm (mpz_t ROP, const mpz_t BASE, const mpz_t
- EXP, const mpz_t MOD)
- -- Function: void mpz_powm_ui (mpz_t ROP, const mpz_t BASE, unsigned
- long int EXP, const mpz_t MOD)
+ -- Function: void mpz_powm (mpz_t ROP, mpz_t BASE, mpz_t EXP, mpz_t
+ MOD)
+ -- Function: void mpz_powm_ui (mpz_t ROP, mpz_t BASE, unsigned long
+ int EXP, mpz_t MOD)
Set ROP to (BASE raised to EXP) modulo MOD.
Negative EXP is supported if an inverse BASE^-1 mod MOD exists
- (see `mpz_invert' in *note Number Theoretic Functions::). If an
+ (see `mpz_invert' in *Note Number Theoretic Functions::). If an
inverse doesn't exist then a divide by zero is raised.
- -- Function: void mpz_powm_sec (mpz_t ROP, const mpz_t BASE, const
- mpz_t EXP, const mpz_t MOD)
- Set ROP to (BASE raised to EXP) modulo MOD.
-
- It is required that EXP > 0 and that MOD is odd.
-
- This function is designed to take the same time 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. This function
- is intended for cryptographic purposes, where resilience to
- side-channel attacks is desired.
-
- -- Function: void mpz_pow_ui (mpz_t ROP, const mpz_t BASE, unsigned
- long int EXP)
+ -- Function: void mpz_pow_ui (mpz_t ROP, mpz_t BASE, unsigned long int
+ EXP)
-- Function: void mpz_ui_pow_ui (mpz_t ROP, unsigned long int BASE,
unsigned long int EXP)
Set ROP to BASE raised to EXP. The case 0^0 yields 1.
@@ -2614,28 +2545,27 @@ File: gmp.info, Node: Integer Roots, Next: Number Theoretic Functions, Prev:
5.8 Root Extraction Functions
=============================
- -- Function: int mpz_root (mpz_t ROP, const mpz_t OP, unsigned long
- int N)
+ -- Function: int mpz_root (mpz_t ROP, mpz_t OP, unsigned long int N)
Set ROP to the truncated integer part of the Nth root of OP.
Return non-zero if the computation was exact, i.e., if OP is ROP
to the Nth power.
- -- Function: void mpz_rootrem (mpz_t ROOT, mpz_t REM, const mpz_t U,
+ -- Function: void mpz_rootrem (mpz_t ROOT, mpz_t REM, mpz_t U,
unsigned long int N)
Set ROOT to the truncated integer part of the Nth root of U. Set
REM to the remainder, U-ROOT**N.
- -- Function: void mpz_sqrt (mpz_t ROP, const mpz_t OP)
+ -- Function: void mpz_sqrt (mpz_t ROP, mpz_t OP)
Set ROP to the truncated integer part of the square root of OP.
- -- Function: void mpz_sqrtrem (mpz_t ROP1, mpz_t ROP2, const mpz_t OP)
+ -- Function: void mpz_sqrtrem (mpz_t ROP1, mpz_t ROP2, mpz_t OP)
Set ROP1 to the truncated integer part of the square root of OP,
like `mpz_sqrt'. Set ROP2 to the remainder OP-ROP1*ROP1, which
will be zero if OP is a perfect square.
If ROP1 and ROP2 are the same variable, the results are undefined.
- -- Function: int mpz_perfect_power_p (const mpz_t OP)
+ -- Function: int mpz_perfect_power_p (mpz_t OP)
Return non-zero if OP is a perfect power, i.e., if there exist
integers A and B, with B>1, such that OP equals A raised to the
power B.
@@ -2644,7 +2574,7 @@ File: gmp.info, Node: Integer Roots, Next: Number Theoretic Functions, Prev:
powers. Negative values of OP are accepted, but of course can
only be odd perfect powers.
- -- Function: int mpz_perfect_square_p (const mpz_t OP)
+ -- Function: int mpz_perfect_square_p (mpz_t OP)
Return non-zero if OP is a perfect square, i.e., if the square
root of OP is an integer. Under this definition both 0 and 1 are
considered to be perfect squares.
@@ -2655,17 +2585,15 @@ File: gmp.info, Node: Number Theoretic Functions, Next: Integer Comparisons,
5.9 Number Theoretic Functions
==============================
- -- Function: int mpz_probab_prime_p (const mpz_t N, int REPS)
+ -- Function: int mpz_probab_prime_p (mpz_t N, int REPS)
Determine whether N is prime. Return 2 if N is definitely prime,
return 1 if N is probably prime (without being certain), or return
0 if N is definitely composite.
This function does some trial divisions, then some Miller-Rabin
- probabilistic primality tests. The argument REPS controls how
- many such tests are done; a higher value will reduce the chances
- of a composite being returned as "probably prime". 25 is a
- reasonable number; a composite number will then be identified as a
- prime with a probability of less than 2^(-50).
+ probabilistic primality tests. REPS controls how many such tests
+ are done, 5 to 10 is a reasonable number, more will reduce the
+ chances of a composite being returned as "probably prime".
Miller-Rabin and similar tests can be more properly called
compositeness tests. Numbers which fail are known to be composite
@@ -2673,20 +2601,18 @@ File: gmp.info, Node: Number Theoretic Functions, Next: Integer Comparisons,
few composites pass, hence those which pass are considered
probably prime.
- -- Function: void mpz_nextprime (mpz_t ROP, const mpz_t OP)
+ -- Function: void mpz_nextprime (mpz_t ROP, mpz_t OP)
Set ROP to the next prime greater than OP.
This function uses a probabilistic algorithm to identify primes.
For practical purposes it's adequate, the chance of a composite
passing will be extremely small.
- -- Function: void mpz_gcd (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
+ -- Function: void mpz_gcd (mpz_t ROP, mpz_t OP1, mpz_t OP2)
Set ROP to the greatest common divisor of OP1 and OP2. The result
is always positive even if one or both input operands are negative.
- Except if both inputs are zero; then this function defines
- gcd(0,0) = 0.
- -- Function: unsigned long int mpz_gcd_ui (mpz_t ROP, const mpz_t OP1,
+ -- Function: unsigned long int mpz_gcd_ui (mpz_t ROP, mpz_t OP1,
unsigned long int OP2)
Compute the greatest common divisor of OP1 and OP2. If ROP is not
`NULL', store the result there.
@@ -2696,54 +2622,41 @@ File: gmp.info, Node: Number Theoretic Functions, Next: Integer Comparisons,
result is equal to the argument OP1. Note that the result will
always fit if OP2 is non-zero.
- -- Function: void mpz_gcdext (mpz_t G, mpz_t S, mpz_t T, const mpz_t
- A, const mpz_t B)
+ -- Function: void mpz_gcdext (mpz_t G, mpz_t S, mpz_t T, mpz_t A,
+ mpz_t B)
Set G to the greatest common divisor of A and B, and in addition
set S and T to coefficients satisfying A*S + B*T = G. The value
in G is always positive, even if one or both of A and B are
- negative (or zero if both inputs are zero). The values in S and T
- are chosen such that normally, abs(S) < abs(B) / (2 G) and abs(T)
- < abs(A) / (2 G), and these relations define S and T uniquely.
- There are a few exceptional cases:
-
- If abs(A) = abs(B), then S = 0, T = sgn(B).
-
- Otherwise, S = sgn(A) if B = 0 or abs(B) = 2 G, and T = sgn(B) if
- A = 0 or abs(A) = 2 G.
-
- In all cases, S = 0 if and only if G = abs(B), i.e., if B divides
- A or A = B = 0.
+ negative. The values in S and T are chosen such that abs(S) <=
+ abs(B) and abs(T) <= abs(A).
If T is `NULL' then that value is not computed.
- -- Function: void mpz_lcm (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
- -- Function: void mpz_lcm_ui (mpz_t ROP, const mpz_t OP1, unsigned
- long OP2)
+ -- Function: void mpz_lcm (mpz_t ROP, mpz_t OP1, mpz_t OP2)
+ -- Function: void mpz_lcm_ui (mpz_t ROP, mpz_t OP1, unsigned long OP2)
Set ROP to the least common multiple of OP1 and OP2. ROP is
always positive, irrespective of the signs of OP1 and OP2. ROP
will be zero if either OP1 or OP2 is zero.
- -- Function: int mpz_invert (mpz_t ROP, const mpz_t OP1, const mpz_t
- OP2)
+ -- Function: int mpz_invert (mpz_t ROP, mpz_t OP1, mpz_t OP2)
Compute the inverse of OP1 modulo OP2 and put the result in ROP.
If the inverse exists, the return value is non-zero and ROP will
- satisfy 0 < ROP < abs(OP2). If an inverse doesn't exist the
- return value is zero and ROP is undefined. The behaviour of this
- function is undefined when OP2 is zero.
+ satisfy 0 <= ROP < OP2. If an inverse doesn't exist the return
+ value is zero and ROP is undefined.
- -- Function: int mpz_jacobi (const mpz_t A, const mpz_t B)
+ -- Function: int mpz_jacobi (mpz_t A, mpz_t B)
Calculate the Jacobi symbol (A/B). This is defined only for B odd.
- -- Function: int mpz_legendre (const mpz_t A, const mpz_t P)
+ -- Function: int mpz_legendre (mpz_t A, mpz_t P)
Calculate the Legendre symbol (A/P). This is defined only for P
an odd positive prime, and for such P it's identical to the Jacobi
symbol.
- -- Function: int mpz_kronecker (const mpz_t A, const mpz_t B)
- -- Function: int mpz_kronecker_si (const mpz_t A, long B)
- -- Function: int mpz_kronecker_ui (const mpz_t A, unsigned long B)
- -- Function: int mpz_si_kronecker (long A, const mpz_t B)
- -- Function: int mpz_ui_kronecker (unsigned long A, const mpz_t B)
+ -- Function: int mpz_kronecker (mpz_t A, mpz_t B)
+ -- Function: int mpz_kronecker_si (mpz_t A, long B)
+ -- Function: int mpz_kronecker_ui (mpz_t A, unsigned long B)
+ -- Function: int mpz_si_kronecker (long A, mpz_t B)
+ -- Function: int mpz_ui_kronecker (unsigned long A, mpz_t B)
Calculate the Jacobi symbol (A/B) with the Kronecker extension
(a/2)=(2/a) when a odd, or (a/2)=0 when a even.
@@ -2755,26 +2668,16 @@ File: gmp.info, Node: Number Theoretic Functions, Next: Integer Comparisons,
References::), or any number theory textbook. See also the
example program `demos/qcn.c' which uses `mpz_kronecker_ui'.
- -- Function: mp_bitcnt_t mpz_remove (mpz_t ROP, const mpz_t OP, const
- mpz_t F)
+ -- Function: unsigned long int mpz_remove (mpz_t ROP, mpz_t OP, mpz_t
+ F)
Remove all occurrences of the factor F from OP and store the
result in ROP. The return value is how many such occurrences were
removed.
- -- Function: void mpz_fac_ui (mpz_t ROP, unsigned long int N)
- -- Function: void mpz_2fac_ui (mpz_t ROP, unsigned long int N)
- -- Function: void mpz_mfac_uiui (mpz_t ROP, unsigned long int N,
- unsigned long int M)
- Set ROP to the factorial of N: `mpz_fac_ui' computes the plain
- factorial N!, `mpz_2fac_ui' computes the double-factorial N!!, and
- `mpz_mfac_uiui' the M-multi-factorial N!^(M).
-
- -- Function: void mpz_primorial_ui (mpz_t ROP, unsigned long int N)
- Set ROP to the primorial of N, i.e. the product of all positive
- prime numbers <=N.
+ -- Function: void mpz_fac_ui (mpz_t ROP, unsigned long int OP)
+ Set ROP to OP!, the factorial of OP.
- -- Function: void mpz_bin_ui (mpz_t ROP, const mpz_t N, unsigned long
- int K)
+ -- Function: void mpz_bin_ui (mpz_t ROP, mpz_t N, unsigned long int K)
-- Function: void mpz_bin_uiui (mpz_t ROP, unsigned long int N,
unsigned long int K)
Compute the binomial coefficient N over K and store the result in
@@ -2807,7 +2710,7 @@ File: gmp.info, Node: Number Theoretic Functions, Next: Integer Comparisons,
The Fibonacci numbers and Lucas numbers are related sequences, so
it's never necessary to call both `mpz_fib2_ui' and
`mpz_lucnum2_ui'. The formulas for going from Fibonacci to Lucas
- can be found in *note Lucas Numbers Algorithm::, the reverse is
+ can be found in *Note Lucas Numbers Algorithm::, the reverse is
straightforward too.

@@ -2816,10 +2719,10 @@ File: gmp.info, Node: Integer Comparisons, Next: Integer Logic and Bit Fiddlin
5.10 Comparison Functions
=========================
- -- Function: int mpz_cmp (const mpz_t OP1, const mpz_t OP2)
- -- Function: int mpz_cmp_d (const mpz_t OP1, double OP2)
- -- Macro: int mpz_cmp_si (const mpz_t OP1, signed long int OP2)
- -- Macro: int mpz_cmp_ui (const mpz_t OP1, unsigned long int OP2)
+ -- Function: int mpz_cmp (mpz_t OP1, mpz_t OP2)
+ -- Function: int mpz_cmp_d (mpz_t OP1, double OP2)
+ -- Macro: int mpz_cmp_si (mpz_t OP1, signed long int OP2)
+ -- Macro: int mpz_cmp_ui (mpz_t OP1, unsigned long int OP2)
Compare OP1 and OP2. Return a positive value if OP1 > OP2, zero
if OP1 = OP2, or a negative value if OP1 < OP2.
@@ -2827,9 +2730,9 @@ File: gmp.info, Node: Integer Comparisons, Next: Integer Logic and Bit Fiddlin
arguments more than once. `mpz_cmp_d' can be called with an
infinity, but results are undefined for a NaN.
- -- Function: int mpz_cmpabs (const mpz_t OP1, const mpz_t OP2)
- -- Function: int mpz_cmpabs_d (const mpz_t OP1, double OP2)
- -- Function: int mpz_cmpabs_ui (const mpz_t OP1, unsigned long int OP2)
+ -- Function: int mpz_cmpabs (mpz_t OP1, mpz_t OP2)
+ -- Function: int mpz_cmpabs_d (mpz_t OP1, double OP2)
+ -- Function: int mpz_cmpabs_ui (mpz_t OP1, unsigned long int OP2)
Compare the absolute values of OP1 and OP2. Return a positive
value if abs(OP1) > abs(OP2), zero if abs(OP1) = abs(OP2), or a
negative value if abs(OP1) < abs(OP2).
@@ -2837,7 +2740,7 @@ File: gmp.info, Node: Integer Comparisons, Next: Integer Logic and Bit Fiddlin
`mpz_cmpabs_d' can be called with an infinity, but results are
undefined for a NaN.
- -- Macro: int mpz_sgn (const mpz_t OP)
+ -- Macro: int mpz_sgn (mpz_t OP)
Return +1 if OP > 0, 0 if OP = 0, and -1 if OP < 0.
This function is actually implemented as a macro. It evaluates
@@ -2853,35 +2756,35 @@ These functions behave as if twos complement arithmetic were used
(although sign-magnitude is the actual implementation). The least
significant bit is number 0.
- -- Function: void mpz_and (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
+ -- Function: void mpz_and (mpz_t ROP, mpz_t OP1, mpz_t OP2)
Set ROP to OP1 bitwise-and OP2.
- -- Function: void mpz_ior (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
+ -- Function: void mpz_ior (mpz_t ROP, mpz_t OP1, mpz_t OP2)
Set ROP to OP1 bitwise inclusive-or OP2.
- -- Function: void mpz_xor (mpz_t ROP, const mpz_t OP1, const mpz_t OP2)
+ -- Function: void mpz_xor (mpz_t ROP, mpz_t OP1, mpz_t OP2)
Set ROP to OP1 bitwise exclusive-or OP2.
- -- Function: void mpz_com (mpz_t ROP, const mpz_t OP)
+ -- Function: void mpz_com (mpz_t ROP, mpz_t OP)
Set ROP to the one's complement of OP.
- -- Function: mp_bitcnt_t mpz_popcount (const mpz_t OP)
+ -- Function: unsigned long int mpz_popcount (mpz_t OP)
If OP>=0, return the population count of OP, which is the number
of 1 bits in the binary representation. If OP<0, the number of 1s
- is infinite, and the return value is the largest possible
- `mp_bitcnt_t'.
+ is infinite, and the return value is ULONG_MAX, the largest
+ possible `unsigned long'.
- -- Function: mp_bitcnt_t mpz_hamdist (const mpz_t OP1, const mpz_t OP2)
+ -- Function: unsigned long int mpz_hamdist (mpz_t OP1, mpz_t OP2)
If OP1 and OP2 are both >=0 or both <0, return the hamming
distance between the two operands, which is the number of bit
positions where OP1 and OP2 have different bit values. If one
operand is >=0 and the other <0 then the number of bits different
- is infinite, and the return value is the largest possible
- `mp_bitcnt_t'.
+ is infinite, and the return value is ULONG_MAX, the largest
+ possible `unsigned long'.
- -- Function: mp_bitcnt_t mpz_scan0 (const mpz_t OP, mp_bitcnt_t
+ -- Function: unsigned long int mpz_scan0 (mpz_t OP, unsigned long int
STARTING_BIT)
- -- Function: mp_bitcnt_t mpz_scan1 (const mpz_t OP, mp_bitcnt_t
+ -- Function: unsigned long int mpz_scan1 (mpz_t OP, unsigned long int
STARTING_BIT)
Scan OP, starting from bit STARTING_BIT, towards more significant
bits, until the first 0 or 1 bit (respectively) is found. Return
@@ -2890,21 +2793,20 @@ significant bit is number 0.
If the bit at STARTING_BIT is already what's sought, then
STARTING_BIT is returned.
- If there's no bit found, then the largest possible `mp_bitcnt_t' is
- returned. This will happen in `mpz_scan0' past the end of a
- negative number, or `mpz_scan1' past the end of a nonnegative
- number.
+ If there's no bit found, then ULONG_MAX is returned. This will
+ happen in `mpz_scan0' past the end of a negative number, or
+ `mpz_scan1' past the end of a nonnegative number.
- -- Function: void mpz_setbit (mpz_t ROP, mp_bitcnt_t BIT_INDEX)
+ -- Function: void mpz_setbit (mpz_t ROP, unsigned long int BIT_INDEX)
Set bit BIT_INDEX in ROP.
- -- Function: void mpz_clrbit (mpz_t ROP, mp_bitcnt_t BIT_INDEX)
+ -- Function: void mpz_clrbit (mpz_t ROP, unsigned long int BIT_INDEX)
Clear bit BIT_INDEX in ROP.
- -- Function: void mpz_combit (mpz_t ROP, mp_bitcnt_t BIT_INDEX)
+ -- Function: void mpz_combit (mpz_t ROP, unsigned long int BIT_INDEX)
Complement bit BIT_INDEX in ROP.
- -- Function: int mpz_tstbit (const mpz_t OP, mp_bitcnt_t BIT_INDEX)
+ -- Function: int mpz_tstbit (mpz_t OP, unsigned long int BIT_INDEX)
Test bit BIT_INDEX in OP and return 0 or 1 accordingly.

@@ -2914,18 +2816,15 @@ File: gmp.info, Node: I/O of Integers, Next: Integer Random Numbers, Prev: In
===============================
Functions that perform input from a stdio stream, and functions that
-output to a stdio stream, of `mpz' numbers. Passing a `NULL' pointer
-for a STREAM argument to any of these functions will make them read from
-`stdin' and write to `stdout', respectively.
+output to a stdio stream. Passing a `NULL' pointer for a STREAM
+argument to any of these functions will make them read from `stdin' and
+write to `stdout', respectively.
When using any of these functions, it is a good idea to include
`stdio.h' before `gmp.h', since that will allow `gmp.h' to define
prototypes for these functions.
- See also *note Formatted Output:: and *note Formatted Input::.
-
- -- Function: size_t mpz_out_str (FILE *STREAM, int BASE, const mpz_t
- OP)
+ -- Function: size_t mpz_out_str (FILE *STREAM, int BASE, mpz_t OP)
Output OP on stdio stream STREAM, as a string of digits in base
BASE. The base argument may vary from 2 to 62 or from -2 to -36.
@@ -2952,7 +2851,7 @@ prototypes for these functions.
Return the number of bytes read, or if an error occurred, return 0.
- -- Function: size_t mpz_out_raw (FILE *STREAM, const mpz_t OP)
+ -- Function: size_t mpz_out_raw (FILE *STREAM, mpz_t OP)
Output OP on stdio stream STREAM, in raw binary format. The
integer is written in a portable format, with 4 bytes of size
information, and that many bytes of limbs. Both the size and the
@@ -2985,29 +2884,29 @@ File: gmp.info, Node: Integer Random Numbers, Next: Integer Import and Export,
The random number functions of GMP come in two groups; older function
that rely on a global state, and newer functions that accept a state
-parameter that is read and modified. Please see the *note Random
+parameter that is read and modified. Please see the *Note Random
Number Functions:: for more information on how to use and not to use
random number functions.
-- Function: void mpz_urandomb (mpz_t ROP, gmp_randstate_t STATE,
- mp_bitcnt_t N)
+ unsigned long int N)
Generate a uniformly distributed random integer in the range 0 to
2^N-1, inclusive.
The variable STATE must be initialized by calling one of the
- `gmp_randinit' functions (*note Random State Initialization::)
+ `gmp_randinit' functions (*Note Random State Initialization::)
before invoking this function.
-- Function: void mpz_urandomm (mpz_t ROP, gmp_randstate_t STATE,
- const mpz_t N)
+ mpz_t N)
Generate a uniform random integer in the range 0 to N-1, inclusive.
The variable STATE must be initialized by calling one of the
- `gmp_randinit' functions (*note Random State Initialization::)
+ `gmp_randinit' functions (*Note Random State Initialization::)
before invoking this function.
-- Function: void mpz_rrandomb (mpz_t ROP, gmp_randstate_t STATE,
- mp_bitcnt_t N)
+ unsigned long int N)
Generate a random integer with long strings of zeros and ones in
the binary representation. Useful for testing functions and
algorithms, since this kind of random numbers have proven to be
@@ -3015,7 +2914,7 @@ random number functions.
be in the range 0 to 2^N-1, inclusive.
The variable STATE must be initialized by calling one of the
- `gmp_randinit' functions (*note Random State Initialization::)
+ `gmp_randinit' functions (*Note Random State Initialization::)
before invoking this function.
-- Function: void mpz_random (mpz_t ROP, mp_size_t MAX_SIZE)
@@ -3054,8 +2953,8 @@ data with the following functions.
word first or -1 for least significant first. Within each word
ENDIAN can be 1 for most significant byte first, -1 for least
significant first, or 0 for the native endianness of the host CPU.
- The most significant NAILS bits of each word are skipped, this can
- be 0 to use the full words.
+ The most significant NAILS bits of each word are skipped, this
+ can be 0 to use the full words.
There is no sign taken from the data, ROP will simply be a positive
integer. An application can handle any sign itself, and apply it
@@ -3080,7 +2979,7 @@ data with the following functions.
instance `8*sizeof(int)-INT_BIT'.
-- Function: void * mpz_export (void *ROP, size_t *COUNTP, int ORDER,
- size_t SIZE, int ENDIAN, size_t NAILS, const mpz_t OP)
+ size_t SIZE, int ENDIAN, size_t NAILS, mpz_t OP)
Fill ROP with word data from OP.
The parameters specify the format of the data produced. Each word
@@ -3127,23 +3026,23 @@ File: gmp.info, Node: Miscellaneous Integer Functions, Next: Integer Special F
5.15 Miscellaneous Functions
============================
- -- Function: int mpz_fits_ulong_p (const mpz_t OP)
- -- Function: int mpz_fits_slong_p (const mpz_t OP)
- -- Function: int mpz_fits_uint_p (const mpz_t OP)
- -- Function: int mpz_fits_sint_p (const mpz_t OP)
- -- Function: int mpz_fits_ushort_p (const mpz_t OP)
- -- Function: int mpz_fits_sshort_p (const mpz_t OP)
+ -- Function: int mpz_fits_ulong_p (mpz_t OP)
+ -- Function: int mpz_fits_slong_p (mpz_t OP)
+ -- Function: int mpz_fits_uint_p (mpz_t OP)
+ -- Function: int mpz_fits_sint_p (mpz_t OP)
+ -- Function: int mpz_fits_ushort_p (mpz_t OP)
+ -- Function: int mpz_fits_sshort_p (mpz_t OP)
Return non-zero iff the value of OP fits in an `unsigned long int',
`signed long int', `unsigned int', `signed int', `unsigned short
int', or `signed short int', respectively. Otherwise, return zero.
- -- Macro: int mpz_odd_p (const mpz_t OP)
- -- Macro: int mpz_even_p (const mpz_t OP)
+ -- Macro: int mpz_odd_p (mpz_t OP)
+ -- Macro: int mpz_even_p (mpz_t OP)
Determine whether OP is odd or even, respectively. Return
non-zero if yes, zero if no. These macros evaluate their argument
more than once.
- -- Function: size_t mpz_sizeinbase (const mpz_t OP, int BASE)
+ -- Function: size_t mpz_sizeinbase (mpz_t OP, int BASE)
Return the size of OP measured in number of digits in the given
BASE. BASE can vary from 2 to 62. The sign of OP is ignored,
just the absolute value is used. The result will be either exact
@@ -3171,7 +3070,44 @@ 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 an obsolete function. Do not use it.*
+ 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_ui' 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'.
-- Function: void * _mpz_realloc (mpz_t INTEGER, mp_size_t NEW_ALLOC)
Change the space for INTEGER to NEW_ALLOC limbs. The value in
@@ -3182,7 +3118,7 @@ applications will not need them.
changes like this. `mpz_realloc2' and `_mpz_realloc' are the same
except that `_mpz_realloc' takes its size in limbs.
- -- Function: mp_limb_t mpz_getlimbn (const mpz_t OP, mp_size_t N)
+ -- Function: mp_limb_t mpz_getlimbn (mpz_t OP, mp_size_t N)
Return limb number N from OP. The sign of OP is ignored, just the
absolute value is used. The least significant limb is number 0.
@@ -3190,75 +3126,10 @@ applications will not need them.
`mpz_getlimbn' returns zero if N is outside the range 0 to
`mpz_size(OP)-1'.
- -- Function: size_t mpz_size (const mpz_t OP)
+ -- Function: size_t mpz_size (mpz_t OP)
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);
- }
-

File: gmp.info, Node: Rational Number Functions, Next: Floating-point Functions, Prev: Integer Functions, Up: Top
@@ -3304,20 +3175,12 @@ File: gmp.info, Node: Initializing Rationals, Next: Rational Conversions, Pre
only be initialized once, or at least cleared out (using the
function `mpq_clear') between each initialization.
- -- Function: void mpq_inits (mpq_t X, ...)
- Initialize a NULL-terminated list of `mpq_t' variables, and set
- their values to 0/1.
-
-- Function: void mpq_clear (mpq_t X)
Free the space occupied by X. Make sure to call this function for
all `mpq_t' variables when you are done with them.
- -- Function: void mpq_clears (mpq_t X, ...)
- Free the space occupied by a NULL-terminated list of `mpq_t'
- variables.
-
- -- Function: void mpq_set (mpq_t ROP, const mpq_t OP)
- -- Function: void mpq_set_z (mpq_t ROP, const mpz_t OP)
+ -- Function: void mpq_set (mpq_t ROP, mpq_t OP)
+ -- Function: void mpq_set_z (mpq_t ROP, mpz_t OP)
Assign ROP from OP.
-- Function: void mpq_set_ui (mpq_t ROP, unsigned long int OP1,
@@ -3328,7 +3191,7 @@ File: gmp.info, Node: Initializing Rationals, Next: Rational Conversions, Pre
common factors, ROP has to be passed to `mpq_canonicalize' before
any operations are performed on ROP.
- -- Function: int mpq_set_str (mpq_t ROP, const char *STR, int BASE)
+ -- Function: int mpq_set_str (mpq_t ROP, char *STR, int BASE)
Set ROP from a null-terminated string STR in the given BASE.
The string can be an integer like "41" or a fraction like
@@ -3357,8 +3220,8 @@ File: gmp.info, Node: Rational Conversions, Next: Rational Arithmetic, Prev:
6.2 Conversion Functions
========================
- -- Function: double mpq_get_d (const mpq_t OP)
- Convert OP to a `double', truncating if necessary (i.e. rounding
+ -- Function: double mpq_get_d (mpq_t OP)
+ Convert OP to a `double', truncating if necessary (ie. rounding
towards zero).
If the exponent from the conversion is too big or too small to fit
@@ -3368,11 +3231,11 @@ File: gmp.info, Node: Rational Conversions, Next: Rational Arithmetic, Prev:
may or may not occur.
-- Function: void mpq_set_d (mpq_t ROP, double OP)
- -- Function: void mpq_set_f (mpq_t ROP, const mpf_t OP)
+ -- Function: void mpq_set_f (mpq_t ROP, mpf_t OP)
Set ROP to the value of OP. There is no rounding, this conversion
is exact.
- -- Function: char * mpq_get_str (char *STR, int BASE, const mpq_t OP)
+ -- Function: char * mpq_get_str (char *STR, int BASE, mpq_t OP)
Convert OP to a string of digits in base BASE. The base may vary
from 2 to 36. The string will be of the form `num/den', or if the
denominator is 1 then just `num'.
@@ -3400,37 +3263,36 @@ File: gmp.info, Node: Rational Arithmetic, Next: Comparing Rationals, Prev: R
6.3 Arithmetic Functions
========================
- -- Function: void mpq_add (mpq_t SUM, const mpq_t ADDEND1, const mpq_t
- ADDEND2)
+ -- Function: void mpq_add (mpq_t SUM, mpq_t ADDEND1, mpq_t ADDEND2)
Set SUM to ADDEND1 + ADDEND2.
- -- Function: void mpq_sub (mpq_t DIFFERENCE, const mpq_t MINUEND,
- const mpq_t SUBTRAHEND)
+ -- Function: void mpq_sub (mpq_t DIFFERENCE, mpq_t MINUEND, mpq_t
+ SUBTRAHEND)
Set DIFFERENCE to MINUEND - SUBTRAHEND.
- -- Function: void mpq_mul (mpq_t PRODUCT, const mpq_t MULTIPLIER,
- const mpq_t MULTIPLICAND)
+ -- Function: void mpq_mul (mpq_t PRODUCT, mpq_t MULTIPLIER, mpq_t
+ MULTIPLICAND)
Set PRODUCT to MULTIPLIER times MULTIPLICAND.
- -- Function: void mpq_mul_2exp (mpq_t ROP, const mpq_t OP1,
- mp_bitcnt_t OP2)
+ -- Function: void mpq_mul_2exp (mpq_t ROP, mpq_t OP1, unsigned long
+ int OP2)
Set ROP to OP1 times 2 raised to OP2.
- -- Function: void mpq_div (mpq_t QUOTIENT, const mpq_t DIVIDEND, const
- mpq_t DIVISOR)
+ -- Function: void mpq_div (mpq_t QUOTIENT, mpq_t DIVIDEND, mpq_t
+ DIVISOR)
Set QUOTIENT to DIVIDEND/DIVISOR.
- -- Function: void mpq_div_2exp (mpq_t ROP, const mpq_t OP1,
- mp_bitcnt_t OP2)
+ -- Function: void mpq_div_2exp (mpq_t ROP, mpq_t OP1, unsigned long
+ int OP2)
Set ROP to OP1 divided by 2 raised to OP2.
- -- Function: void mpq_neg (mpq_t NEGATED_OPERAND, const mpq_t OPERAND)
+ -- Function: void mpq_neg (mpq_t NEGATED_OPERAND, mpq_t OPERAND)
Set NEGATED_OPERAND to -OPERAND.
- -- Function: void mpq_abs (mpq_t ROP, const mpq_t OP)
+ -- Function: void mpq_abs (mpq_t ROP, mpq_t OP)
Set ROP to the absolute value of OP.
- -- Function: void mpq_inv (mpq_t INVERTED_NUMBER, const mpq_t NUMBER)
+ -- Function: void mpq_inv (mpq_t INVERTED_NUMBER, mpq_t NUMBER)
Set INVERTED_NUMBER to 1/NUMBER. If the new denominator is zero,
this routine will divide by zero.
@@ -3440,17 +3302,17 @@ File: gmp.info, Node: Comparing Rationals, Next: Applying Integer Functions,
6.4 Comparison Functions
========================
- -- Function: int mpq_cmp (const mpq_t OP1, const mpq_t OP2)
+ -- Function: int mpq_cmp (mpq_t OP1, mpq_t OP2)
Compare OP1 and OP2. Return a positive value if OP1 > OP2, zero
if OP1 = OP2, and a negative value if OP1 < OP2.
To determine if two rationals are equal, `mpq_equal' is faster than
`mpq_cmp'.
- -- Macro: int mpq_cmp_ui (const mpq_t OP1, unsigned long int NUM2,
- unsigned long int DEN2)
- -- Macro: int mpq_cmp_si (const mpq_t OP1, long int NUM2, unsigned
+ -- Macro: int mpq_cmp_ui (mpq_t OP1, unsigned long int NUM2, unsigned
long int DEN2)
+ -- Macro: int mpq_cmp_si (mpq_t OP1, long int NUM2, unsigned long int
+ DEN2)
Compare OP1 and NUM2/DEN2. Return a positive value if OP1 >
NUM2/DEN2, zero if OP1 = NUM2/DEN2, and a negative value if OP1 <
NUM2/DEN2.
@@ -3460,13 +3322,13 @@ File: gmp.info, Node: Comparing Rationals, Next: Applying Integer Functions,
These functions are implemented as a macros and evaluate their
arguments multiple times.
- -- Macro: int mpq_sgn (const mpq_t OP)
+ -- Macro: int mpq_sgn (mpq_t OP)
Return +1 if OP > 0, 0 if OP = 0, and -1 if OP < 0.
This function is actually implemented as a macro. It evaluates its
- argument multiple times.
+ arguments multiple times.
- -- Function: int mpq_equal (const mpq_t OP1, const mpq_t OP2)
+ -- Function: int mpq_equal (mpq_t OP1, mpq_t OP2)
Return non-zero if OP1 and OP2 are equal, zero if they are
non-equal. Although `mpq_cmp' can be used for the same purpose,
this function is much faster.
@@ -3487,16 +3349,16 @@ this chapter (*note Rational Number Functions::) then
`mpq_canonicalize' must be called before any other `mpq' functions are
applied to that `mpq_t'.
- -- Macro: mpz_t mpq_numref (const mpq_t OP)
- -- Macro: mpz_t mpq_denref (const mpq_t OP)
+ -- Macro: mpz_t mpq_numref (mpq_t OP)
+ -- Macro: mpz_t mpq_denref (mpq_t OP)
Return a reference to the numerator and denominator of OP,
respectively. The `mpz' functions can be used on the result of
these macros.
- -- Function: void mpq_get_num (mpz_t NUMERATOR, const mpq_t RATIONAL)
- -- Function: void mpq_get_den (mpz_t DENOMINATOR, const mpq_t RATIONAL)
- -- Function: void mpq_set_num (mpq_t RATIONAL, const mpz_t NUMERATOR)
- -- Function: void mpq_set_den (mpq_t RATIONAL, const mpz_t DENOMINATOR)
+ -- Function: void mpq_get_num (mpz_t NUMERATOR, mpq_t RATIONAL)
+ -- Function: void mpq_get_den (mpz_t DENOMINATOR, mpq_t RATIONAL)
+ -- Function: void mpq_set_num (mpq_t RATIONAL, mpz_t NUMERATOR)
+ -- Function: void mpq_set_den (mpq_t RATIONAL, mpz_t DENOMINATOR)
Get or set the numerator or denominator of a rational. These
functions are equivalent to calling `mpz_set' with an appropriate
`mpq_numref' or `mpq_denref'. Direct use of `mpq_numref' or
@@ -3508,19 +3370,15 @@ File: gmp.info, Node: I/O of Rationals, Prev: Applying Integer Functions, Up:
6.6 Input and Output Functions
==============================
-Functions that perform input from a stdio stream, and functions that
-output to a stdio stream, of `mpq' numbers. Passing a `NULL' pointer
-for a STREAM argument to any of these functions will make them read from
-`stdin' and write to `stdout', respectively.
+When using any of these functions, it's a good idea to include `stdio.h'
+before `gmp.h', since that will allow `gmp.h' to define prototypes for
+these functions.
- When using any of these functions, it is a good idea to include
-`stdio.h' before `gmp.h', since that will allow `gmp.h' to define
-prototypes for these functions.
+ Passing a `NULL' pointer for a STREAM argument to any of these
+functions will make them read from `stdin' and write to `stdout',
+respectively.
- See also *note Formatted Output:: and *note Formatted Input::.
-
- -- Function: size_t mpq_out_str (FILE *STREAM, int BASE, const mpq_t
- OP)
+ -- Function: size_t mpq_out_str (FILE *STREAM, int BASE, mpq_t OP)
Output OP on stdio stream STREAM, as a string of digits in base
BASE. The base may vary from 2 to 36. Output is in the form
`num/den' or if the denominator is 1 then just `num'.
@@ -3564,9 +3422,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 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'.
+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'.
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
@@ -3579,21 +3437,22 @@ 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 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 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 mantissa is stored in binary. One consequence of this is that
+ 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 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.)
- The `mpf' functions and variables have no special notion of infinity
-or not-a-number, and applications must take care not to overflow 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.
@@ -3602,10 +3461,6 @@ 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::
@@ -3623,12 +3478,12 @@ File: gmp.info, Node: Initializing Floats, Next: Assigning Floats, Prev: Floa
7.1 Initialization Functions
============================
- -- Function: void mpf_set_default_prec (mp_bitcnt_t PREC)
+ -- Function: void mpf_set_default_prec (unsigned long int PREC)
Set the default precision to be *at least* PREC bits. All
subsequent calls to `mpf_init' will use this precision, but
previously initialized variables are unaffected.
- -- Function: mp_bitcnt_t mpf_get_default_prec (void)
+ -- Function: unsigned long int mpf_get_default_prec (void)
Return the default precision actually used.
An `mpf_t' object must be initialized before storing the first value
@@ -3642,25 +3497,15 @@ purpose.
precision has already been established by a call to
`mpf_set_default_prec'.
- -- Function: void mpf_init2 (mpf_t X, mp_bitcnt_t PREC)
+ -- Function: void mpf_init2 (mpf_t X, unsigned long int PREC)
Initialize X to 0 and set its precision to be *at least* PREC
bits. Normally, a variable should be initialized once only or at
least be cleared, using `mpf_clear', between initializations.
- -- Function: void mpf_inits (mpf_t X, ...)
- Initialize a NULL-terminated list of `mpf_t' variables, and set
- their values to 0. The precision of the initialized variables is
- undefined unless a default precision has already been established
- by a call to `mpf_set_default_prec'.
-
-- Function: void mpf_clear (mpf_t X)
Free the space occupied by X. Make sure to call this function for
all `mpf_t' variables when you are done with them.
- -- Function: void mpf_clears (mpf_t X, ...)
- Free the space occupied by a NULL-terminated list of `mpf_t'
- variables.
-
Here is an example on how to initialize floating-point variables:
{
mpf_t x, y;
@@ -3678,17 +3523,17 @@ precision gradually in iterative algorithms like Newton-Raphson, making
the computation precision closely match the actual accurate part of the
numbers.
- -- Function: mp_bitcnt_t mpf_get_prec (const mpf_t OP)
+ -- Function: unsigned long int mpf_get_prec (mpf_t OP)
Return the current precision of OP, in bits.
- -- Function: void mpf_set_prec (mpf_t ROP, mp_bitcnt_t PREC)
+ -- Function: void mpf_set_prec (mpf_t ROP, unsigned long int PREC)
Set the precision of ROP to be *at least* PREC bits. The value in
ROP will be truncated to the new precision.
This function requires a call to `realloc', and so should not be
used in a tight loop.
- -- Function: void mpf_set_prec_raw (mpf_t ROP, mp_bitcnt_t PREC)
+ -- Function: void mpf_set_prec_raw (mpf_t ROP, unsigned long int PREC)
Set the precision of ROP to be *at least* PREC bits, without
changing the memory allocated.
@@ -3723,15 +3568,15 @@ File: gmp.info, Node: Assigning Floats, Next: Simultaneous Float Init & Assign
These functions assign new values to already initialized floats (*note
Initializing Floats::).
- -- Function: void mpf_set (mpf_t ROP, const mpf_t OP)
+ -- Function: void mpf_set (mpf_t ROP, mpf_t OP)
-- Function: void mpf_set_ui (mpf_t ROP, unsigned long int OP)
-- Function: void mpf_set_si (mpf_t ROP, signed long int OP)
-- Function: void mpf_set_d (mpf_t ROP, double OP)
- -- Function: void mpf_set_z (mpf_t ROP, const mpz_t OP)
- -- Function: void mpf_set_q (mpf_t ROP, const mpq_t OP)
+ -- Function: void mpf_set_z (mpf_t ROP, mpz_t OP)
+ -- Function: void mpf_set_q (mpf_t ROP, mpq_t OP)
Set the value of ROP from OP.
- -- Function: int mpf_set_str (mpf_t ROP, const char *STR, int BASE)
+ -- Function: int mpf_set_str (mpf_t ROP, char *STR, int BASE)
Set the value of ROP from the string in STR. The string is of the
form `M@N' or, if the base is 10 or less, alternatively `MeN'.
`M' is the mantissa and `N' is the exponent. The mantissa is
@@ -3784,7 +3629,7 @@ functions, it can be used as the source or destination operand for the
ordinary float functions. Don't use an initialize-and-set function on
a variable already initialized!
- -- Function: void mpf_init_set (mpf_t ROP, const mpf_t OP)
+ -- Function: void mpf_init_set (mpf_t ROP, mpf_t OP)
-- Function: void mpf_init_set_ui (mpf_t ROP, unsigned long int OP)
-- Function: void mpf_init_set_si (mpf_t ROP, signed long int OP)
-- Function: void mpf_init_set_d (mpf_t ROP, double OP)
@@ -3793,8 +3638,7 @@ a variable already initialized!
The precision of ROP will be taken from the active default
precision, as set by `mpf_set_default_prec'.
- -- Function: int mpf_init_set_str (mpf_t ROP, const char *STR, int
- BASE)
+ -- Function: int mpf_init_set_str (mpf_t ROP, char *STR, int BASE)
Initialize ROP and set its value from the string in STR. See
`mpf_set_str' above for details on the assignment operation.
@@ -3810,8 +3654,8 @@ File: gmp.info, Node: Converting Floats, Next: Float Arithmetic, Prev: Simult
7.4 Conversion Functions
========================
- -- Function: double mpf_get_d (const mpf_t OP)
- Convert OP to a `double', truncating if necessary (i.e. rounding
+ -- Function: double mpf_get_d (mpf_t OP)
+ Convert OP to a `double', truncating if necessary (ie. rounding
towards zero).
If the exponent in OP is too big or too small to fit a `double'
@@ -3819,9 +3663,8 @@ File: gmp.info, Node: Converting Floats, Next: Float Arithmetic, Prev: Simult
returned when available. For too small 0.0 is normally returned.
Hardware overflow, underflow and denorm traps may or may not occur.
- -- Function: double mpf_get_d_2exp (signed long int *EXP, const mpf_t
- OP)
- Convert OP to a `double', truncating if necessary (i.e. rounding
+ -- Function: double mpf_get_d_2exp (signed long int *EXP, mpf_t OP)
+ Convert OP to a `double', truncating if necessary (ie. rounding
towards zero), and with an exponent returned separately.
The return value is in the range 0.5<=abs(D)<1 and the exponent is
@@ -3831,8 +3674,8 @@ File: gmp.info, Node: Converting Floats, Next: Float Arithmetic, Prev: Simult
This is similar to the standard C `frexp' function (*note
Normalization Functions: (libc)Normalization Functions.).
- -- Function: long mpf_get_si (const mpf_t OP)
- -- Function: unsigned long mpf_get_ui (const mpf_t OP)
+ -- Function: long mpf_get_si (mpf_t OP)
+ -- Function: unsigned long mpf_get_ui (mpf_t OP)
Convert OP to a `long' or `unsigned long', truncating any fraction
part. If OP is too big for the return type, the result is
undefined.
@@ -3841,7 +3684,7 @@ File: gmp.info, Node: Converting Floats, Next: Float Arithmetic, Prev: Simult
Miscellaneous Float Functions::).
-- Function: char * mpf_get_str (char *STR, mp_exp_t *EXPPTR, int
- BASE, size_t N_DIGITS, const mpf_t OP)
+ BASE, size_t N_DIGITS, mpf_t OP)
Convert OP to a string of digits in base BASE. The base argument
may vary from 2 to 62 or from -2 to -36. Up to N_DIGITS digits
will be generated. Trailing zeros are not returned. No more
@@ -3882,21 +3725,21 @@ File: gmp.info, Node: Float Arithmetic, Next: Float Comparison, Prev: Convert
7.5 Arithmetic Functions
========================
- -- Function: void mpf_add (mpf_t ROP, const mpf_t OP1, const mpf_t OP2)
- -- Function: void mpf_add_ui (mpf_t ROP, const mpf_t OP1, unsigned
- long int OP2)
+ -- Function: void mpf_add (mpf_t ROP, mpf_t OP1, mpf_t OP2)
+ -- Function: void mpf_add_ui (mpf_t ROP, mpf_t OP1, unsigned long int
+ OP2)
Set ROP to OP1 + OP2.
- -- Function: void mpf_sub (mpf_t ROP, const mpf_t OP1, const mpf_t OP2)
- -- Function: void mpf_ui_sub (mpf_t ROP, unsigned long int OP1, const
- mpf_t OP2)
- -- Function: void mpf_sub_ui (mpf_t ROP, const mpf_t OP1, unsigned
- long int OP2)
+ -- Function: void mpf_sub (mpf_t ROP, mpf_t OP1, mpf_t OP2)
+ -- Function: void mpf_ui_sub (mpf_t ROP, unsigned long int OP1, mpf_t
+ OP2)
+ -- Function: void mpf_sub_ui (mpf_t ROP, mpf_t OP1, unsigned long int
+ OP2)
Set ROP to OP1 - OP2.
- -- Function: void mpf_mul (mpf_t ROP, const mpf_t OP1, const mpf_t OP2)
- -- Function: void mpf_mul_ui (mpf_t ROP, const mpf_t OP1, unsigned
- long int OP2)
+ -- Function: void mpf_mul (mpf_t ROP, mpf_t OP1, mpf_t OP2)
+ -- Function: void mpf_mul_ui (mpf_t ROP, mpf_t OP1, unsigned long int
+ OP2)
Set ROP to OP1 times OP2.
Division is undefined if the divisor is zero, and passing a zero
@@ -3904,33 +3747,33 @@ divisor to the divide functions will make these functions intentionally
divide by zero. This lets the user handle arithmetic exceptions in
these functions in the same manner as other arithmetic exceptions.
- -- Function: void mpf_div (mpf_t ROP, const mpf_t OP1, const mpf_t OP2)
- -- Function: void mpf_ui_div (mpf_t ROP, unsigned long int OP1, const
- mpf_t OP2)
- -- Function: void mpf_div_ui (mpf_t ROP, const mpf_t OP1, unsigned
- long int OP2)
+ -- Function: void mpf_div (mpf_t ROP, mpf_t OP1, mpf_t OP2)
+ -- Function: void mpf_ui_div (mpf_t ROP, unsigned long int OP1, mpf_t
+ OP2)
+ -- Function: void mpf_div_ui (mpf_t ROP, mpf_t OP1, unsigned long int
+ OP2)
Set ROP to OP1/OP2.
- -- Function: void mpf_sqrt (mpf_t ROP, const mpf_t OP)
+ -- Function: void mpf_sqrt (mpf_t ROP, mpf_t OP)
-- Function: void mpf_sqrt_ui (mpf_t ROP, unsigned long int OP)
Set ROP to the square root of OP.
- -- Function: void mpf_pow_ui (mpf_t ROP, const mpf_t OP1, unsigned
- long int OP2)
+ -- Function: void mpf_pow_ui (mpf_t ROP, mpf_t OP1, unsigned long int
+ OP2)
Set ROP to OP1 raised to the power OP2.
- -- Function: void mpf_neg (mpf_t ROP, const mpf_t OP)
+ -- Function: void mpf_neg (mpf_t ROP, mpf_t OP)
Set ROP to -OP.
- -- Function: void mpf_abs (mpf_t ROP, const mpf_t OP)
+ -- Function: void mpf_abs (mpf_t ROP, mpf_t OP)
Set ROP to the absolute value of OP.
- -- Function: void mpf_mul_2exp (mpf_t ROP, const mpf_t OP1,
- mp_bitcnt_t OP2)
+ -- Function: void mpf_mul_2exp (mpf_t ROP, mpf_t OP1, unsigned long
+ int OP2)
Set ROP to OP1 times 2 raised to OP2.
- -- Function: void mpf_div_2exp (mpf_t ROP, const mpf_t OP1,
- mp_bitcnt_t OP2)
+ -- Function: void mpf_div_2exp (mpf_t ROP, mpf_t OP1, unsigned long
+ int OP2)
Set ROP to OP1 divided by 2 raised to OP2.

@@ -3939,18 +3782,17 @@ File: gmp.info, Node: Float Comparison, Next: I/O of Floats, Prev: Float Arit
7.6 Comparison Functions
========================
- -- Function: int mpf_cmp (const mpf_t OP1, const mpf_t OP2)
- -- Function: int mpf_cmp_d (const mpf_t OP1, double OP2)
- -- Function: int mpf_cmp_ui (const mpf_t OP1, unsigned long int OP2)
- -- Function: int mpf_cmp_si (const mpf_t OP1, signed long int OP2)
+ -- Function: int mpf_cmp (mpf_t OP1, mpf_t OP2)
+ -- Function: int mpf_cmp_d (mpf_t OP1, double OP2)
+ -- Function: int mpf_cmp_ui (mpf_t OP1, unsigned long int OP2)
+ -- Function: int mpf_cmp_si (mpf_t OP1, signed long int OP2)
Compare OP1 and OP2. Return a positive value if OP1 > OP2, zero
if OP1 = OP2, and a negative value if OP1 < OP2.
`mpf_cmp_d' can be called with an infinity, but results are
undefined for a NaN.
- -- Function: int mpf_eq (const mpf_t OP1, const mpf_t OP2, mp_bitcnt_t
- op3)
+ -- Function: int mpf_eq (mpf_t OP1, mpf_t OP2, unsigned long int op3)
Return non-zero if the first OP3 bits of OP1 and OP2 are equal,
zero otherwise. I.e., test if OP1 and OP2 are approximately equal.
@@ -3962,16 +3804,15 @@ File: gmp.info, Node: Float Comparison, Next: I/O of Floats, Prev: Float Arit
bits. Such numbers are really just one ulp off, and should be
considered equal.
- -- Function: void mpf_reldiff (mpf_t ROP, const mpf_t OP1, const mpf_t
- OP2)
+ -- Function: void mpf_reldiff (mpf_t ROP, mpf_t OP1, mpf_t OP2)
Compute the relative difference between OP1 and OP2 and store the
result in ROP. This is abs(OP1-OP2)/OP1.
- -- Macro: int mpf_sgn (const mpf_t OP)
+ -- Macro: int mpf_sgn (mpf_t OP)
Return +1 if OP > 0, 0 if OP = 0, and -1 if OP < 0.
This function is actually implemented as a macro. It evaluates
- its argument multiple times.
+ its arguments multiple times.

File: gmp.info, Node: I/O of Floats, Next: Miscellaneous Float Functions, Prev: Float Comparison, Up: Floating-point Functions
@@ -3980,18 +3821,16 @@ File: gmp.info, Node: I/O of Floats, Next: Miscellaneous Float Functions, Pre
==============================
Functions that perform input from a stdio stream, and functions that
-output to a stdio stream, of `mpf' numbers. Passing a `NULL' pointer
-for a STREAM argument to any of these functions will make them read from
-`stdin' and write to `stdout', respectively.
+output to a stdio stream. Passing a `NULL' pointer for a STREAM
+argument to any of these functions will make them read from `stdin' and
+write to `stdout', respectively.
When using any of these functions, it is a good idea to include
`stdio.h' before `gmp.h', since that will allow `gmp.h' to define
prototypes for these functions.
- See also *note Formatted Output:: and *note Formatted Input::.
-
-- Function: size_t mpf_out_str (FILE *STREAM, int BASE, size_t
- N_DIGITS, const mpf_t OP)
+ N_DIGITS, mpf_t OP)
Print OP to STREAM, as a string of digits. Return the number of
bytes written, or if an error occurred, return 0.
@@ -4036,33 +3875,32 @@ File: gmp.info, Node: Miscellaneous Float Functions, Prev: I/O of Floats, Up:
7.8 Miscellaneous Functions
===========================
- -- Function: void mpf_ceil (mpf_t ROP, const mpf_t OP)
- -- Function: void mpf_floor (mpf_t ROP, const mpf_t OP)
- -- Function: void mpf_trunc (mpf_t ROP, const mpf_t OP)
+ -- Function: void mpf_ceil (mpf_t ROP, mpf_t OP)
+ -- Function: void mpf_floor (mpf_t ROP, mpf_t OP)
+ -- Function: void mpf_trunc (mpf_t ROP, mpf_t OP)
Set ROP to OP rounded to an integer. `mpf_ceil' rounds to the
next higher integer, `mpf_floor' to the next lower, and `mpf_trunc'
to the integer towards zero.
- -- Function: int mpf_integer_p (const mpf_t OP)
+ -- Function: int mpf_integer_p (mpf_t OP)
Return non-zero if OP is an integer.
- -- Function: int mpf_fits_ulong_p (const mpf_t OP)
- -- Function: int mpf_fits_slong_p (const mpf_t OP)
- -- Function: int mpf_fits_uint_p (const mpf_t OP)
- -- Function: int mpf_fits_sint_p (const mpf_t OP)
- -- Function: int mpf_fits_ushort_p (const mpf_t OP)
- -- Function: int mpf_fits_sshort_p (const mpf_t OP)
+ -- Function: int mpf_fits_ulong_p (mpf_t OP)
+ -- Function: int mpf_fits_slong_p (mpf_t OP)
+ -- Function: int mpf_fits_uint_p (mpf_t OP)
+ -- Function: int mpf_fits_sint_p (mpf_t OP)
+ -- Function: int mpf_fits_ushort_p (mpf_t OP)
+ -- Function: int mpf_fits_sshort_p (mpf_t OP)
Return non-zero if OP would fit in the respective C data type, when
truncated to an integer.
-- Function: void mpf_urandomb (mpf_t ROP, gmp_randstate_t STATE,
- mp_bitcnt_t NBITS)
+ unsigned long int NBITS)
Generate a uniformly distributed random float in ROP, such that 0
- <= ROP < 1, with NBITS significant bits in the mantissa or less if
- the precision of ROP is smaller.
+ <= ROP < 1, with NBITS significant bits in the mantissa.
The variable STATE must be initialized by calling one of the
- `gmp_randinit' functions (*note Random State Initialization::)
+ `gmp_randinit' functions (*Note Random State Initialization::)
before invoking this function.
-- Function: void mpf_random2 (mpf_t ROP, mp_size_t MAX_SIZE, mp_exp_t
@@ -4171,13 +4009,6 @@ For example, {S1P, S1N}.
This function requires that S1N is greater than or equal to S2N.
- -- 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}.
- 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)
Multiply {S1P, N} and {S2P, N}, and write the 2*N-limb result to
@@ -4187,7 +4018,7 @@ For example, {S1P, S1N}.
product's most significant limb is zero. No overlap is permitted
between the destination and either source.
- If the two input operands are the same, use `mpn_sqr'.
+ If the two input operands are the same, use `mpn_sqr_n'.
-- Function: mp_limb_t mpn_mul (mp_limb_t *RP, const mp_limb_t *S1P,
mp_size_t S1N, const mp_limb_t *S2P, mp_size_t S2N)
@@ -4200,11 +4031,11 @@ For example, {S1P, S1N}.
This function requires that S1N is greater than or equal to S2N.
- -- Function: void mpn_sqr (mp_limb_t *RP, const mp_limb_t *S1P,
+ -- Function: void mpn_sqr_n (mp_limb_t *RP, const mp_limb_t *S1P,
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 2N limbs, even if the
+ The destination has to have space for 2*N limbs, even if the
result's most significant limb is zero. No overlap is permitted
between the destination and the source.
@@ -4251,9 +4082,8 @@ For example, {S1P, S1N}.
Divide {NP, NN} by {DP, DN} and put the quotient at {QP, NN-DN+1}
and the remainder at {RP, DN}. The quotient is rounded towards 0.
- No overlap is permitted between arguments, except that NP might
- equal RP. The dividend size NN must be greater than or equal to
- divisor size DN. The most significant limb of the divisor must be
+ No overlap is permitted between arguments. NN must be greater
+ than or equal to DN. The most significant limb of DP must be
non-zero. The QXN operand must be zero.
-- Function: mp_limb_t mpn_divrem (mp_limb_t *R1P, mp_size_t QXN,
@@ -4326,15 +4156,33 @@ For example, {S1P, S1N}.
c satisfy c*b^n + a-i = 3*q, where b=2^GMP_NUMB_BITS. The return
c is always 0, 1 or 2, and the initial carry i must also be 0, 1
or 2 (these are both borrows really). When c=0 clearly q=(a-i)/3.
- When c!=0, the remainder (a-i) mod 3 is given by 3-c, because b ==
- 1 mod 3 (when `mp_bits_per_limb' is even, which is always so
+ When c!=0, the remainder (a-i) mod 3 is given by 3-c, because b
+ == 1 mod 3 (when `mp_bits_per_limb' is even, which is always so
currently).
- -- Function: mp_limb_t mpn_mod_1 (const mp_limb_t *S1P, mp_size_t S1N,
+ -- Function: mp_limb_t mpn_mod_1 (mp_limb_t *S1P, mp_size_t S1N,
mp_limb_t S2LIMB)
Divide {S1P, S1N} by S2LIMB, and return the remainder. S1N can be
zero.
+ -- Function: mp_limb_t mpn_bdivmod (mp_limb_t *RP, mp_limb_t *S1P,
+ mp_size_t S1N, const mp_limb_t *S2P, mp_size_t S2N, unsigned
+ long int D)
+ This function puts the low floor(D/mp_bits_per_limb) limbs of Q =
+ {S1P, S1N}/{S2P, S2N} mod 2^D at RP, and returns the high D mod
+ `mp_bits_per_limb' bits of Q.
+
+ {S1P, S1N} - Q * {S2P, S2N} mod 2^(S1N*mp_bits_per_limb) is placed
+ at S1P. Since the low floor(D/mp_bits_per_limb) limbs of this
+ difference are zero, it is possible to overwrite the low limbs at
+ S1P with this difference, provided RP <= S1P.
+
+ This function requires that S1N * mp_bits_per_limb >= D, and that
+ {S2P, S2N} is odd.
+
+ *This interface is preliminary. It might change incompatibly in
+ future revisions.*
+
-- Function: mp_limb_t mpn_lshift (mp_limb_t *RP, const mp_limb_t *SP,
mp_size_t N, unsigned int COUNT)
Shift {SP, N} left by COUNT bits, and write the result to {RP, N}.
@@ -4370,9 +4218,9 @@ For example, {S1P, S1N}.
{YP, YN}. The result can be up to YN limbs, the return value is
the actual number produced. Both source operands are destroyed.
- It is required that XN >= YN > 0, and the most significant limb of
- {YP, YN} must be non-zero. No overlap is permitted between {XP,
- XN} and {YP, YN}.
+ {XP, XN} must have at least as many bits as {YP, YN}. {YP, YN}
+ must be odd. Both operands must have non-zero most significant
+ limbs. No overlap is permitted between {XP, XN} and {YP, YN}.
-- Function: mp_limb_t mpn_gcd_1 (const mp_limb_t *XP, mp_size_t XN,
mp_limb_t YLIMB)
@@ -4380,34 +4228,28 @@ For example, {S1P, S1N}.
operands must be non-zero.
-- Function: mp_size_t mpn_gcdext (mp_limb_t *GP, mp_limb_t *SP,
- mp_size_t *SN, mp_limb_t *UP, mp_size_t UN, mp_limb_t *VP,
- mp_size_t VN)
- Let U be defined by {UP, UN} and let V be defined by {VP, VN}.
+ mp_size_t *SN, mp_limb_t *XP, mp_size_t XN, mp_limb_t *YP,
+ mp_size_t YN)
+ Let U be defined by {XP, XN} and let V be defined by {YP, YN}.
Compute the greatest common divisor G of U and V. Compute a
cofactor S such that G = US + VT. The second cofactor T is not
computed but can easily be obtained from (G - U*S) / V (the
- division will be exact). It is required that UN >= VN > 0, and
- the most significant limb of {VP, VN} must be non-zero.
+ division will be exact). It is required that U >= V > 0.
S satisfies S = 1 or abs(S) < V / (2 G). S = 0 if and only if V
divides U (i.e., G = V).
Store G at GP and let the return value define its limb count.
Store S at SP and let |*SN| define its limb count. S can be
- negative; when this happens *SN will be negative. The area at GP
- should have room for VN limbs and the area at SP should have room
- for VN+1 limbs.
+ negative; when this happens *SN will be negative. The areas at GP
+ and SP should each have room for XN+1 limbs.
- Both source operands are destroyed.
+ The areas {XP, XN+1} and {YP, YN+1} are destroyed (i.e. the input
+ operands plus an extra limb past the end of each).
- Compatibility notes: GMP 4.3.0 and 4.3.1 defined S less strictly.
+ Compatibility note: GMP 4.3.0 and 4.3.1 defined S less strictly.
Earlier as well as later GMP releases define S as described here.
- GMP releases before GMP 4.3.0 required additional space for both
- input and output areas. More precisely, the areas {UP, UN+1} and
- {VP, VN+1} were destroyed (i.e. the operands plus an extra limb
- past the end of each), and the areas pointed to by GP and SP
- should each have room for UN+1 limbs.
-- Function: mp_size_t mpn_sqrtrem (mp_limb_t *R1P, mp_limb_t *R2P,
const mp_limb_t *SP, mp_size_t N)
@@ -4425,14 +4267,7 @@ For example, {S1P, S1N}.
remainder would have been zero or non-zero.
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.
+ `mpz_perfect_square_p'.
-- Function: mp_size_t mpn_get_str (unsigned char *STR, int BASE,
mp_limb_t *S1P, mp_size_t S1N)
@@ -4453,32 +4288,31 @@ 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 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.
+ 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.
- 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.
+ 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 area at RP has to have space for the largest possible number
- with STRSIZE digits in the chosen base, plus one extra limb.
+ 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 input must have at least one byte, and no overlap is permitted
- between {STR,STRSIZE} and the result at RP.
+ STRSIZE must be at least 1, 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)
+ -- Function: unsigned long int mpn_scan0 (const mp_limb_t *S1P,
+ unsigned long int BIT)
Scan S1P from bit position BIT for the next clear bit.
It is required that there be a clear bit within the area at S1P at
or beyond bit position BIT, so that the function has something to
return.
- -- Function: mp_bitcnt_t mpn_scan1 (const mp_limb_t *S1P, mp_bitcnt_t
- BIT)
+ -- Function: unsigned long int mpn_scan1 (const mp_limb_t *S1P,
+ unsigned long int BIT)
Scan S1P from bit position BIT for the next set bit.
It is required that there be a set bit within the area at S1P at or
@@ -4495,248 +4329,22 @@ For example, {S1P, S1N}.
`mpn_random2' is intended for testing the correctness of the `mpn'
routines.
- -- Function: mp_bitcnt_t mpn_popcount (const mp_limb_t *S1P, mp_size_t
- N)
+ -- Function: unsigned long int mpn_popcount (const mp_limb_t *S1P,
+ mp_size_t N)
Count the number of set bits in {S1P, N}.
- -- Function: mp_bitcnt_t mpn_hamdist (const mp_limb_t *S1P, const
- mp_limb_t *S2P, mp_size_t N)
+ -- Function: unsigned long int mpn_hamdist (const mp_limb_t *S1P,
+ const mp_limb_t *S2P, mp_size_t N)
Compute the hamming distance between {S1P, N} and {S2P, N}, which
is the number of bit positions where the two operands have
different bit values.
-- Function: int mpn_perfect_square_p (const mp_limb_t *S1P, mp_size_t
N)
- Return non-zero iff {S1P, N} is a perfect square. The most
- significant limb of the input {S1P, N} must be non-zero.
-
- -- Function: void mpn_and_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical and of {S1P, N} and {S2P, N}, and
- write the result to {RP, N}.
-
- -- Function: void mpn_ior_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical inclusive or of {S1P, N} and {S2P, N},
- and write the result to {RP, N}.
-
- -- Function: void mpn_xor_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical exclusive or of {S1P, N} and {S2P, N},
- and write the result to {RP, N}.
-
- -- Function: void mpn_andn_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical and of {S1P, N} and the bitwise
- complement of {S2P, N}, and write the result to {RP, N}.
-
- -- Function: void mpn_iorn_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical inclusive or of {S1P, N} and the
- bitwise complement of {S2P, N}, and write the result to {RP, N}.
-
- -- Function: void mpn_nand_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical and of {S1P, N} and {S2P, N}, and
- write the bitwise complement of the result to {RP, N}.
-
- -- Function: void mpn_nior_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical inclusive or of {S1P, N} and {S2P, N},
- and write the bitwise complement of the result to {RP, N}.
-
- -- Function: void mpn_xnor_n (mp_limb_t *RP, const mp_limb_t *S1P,
- const mp_limb_t *S2P, mp_size_t N)
- Perform the bitwise logical exclusive or of {S1P, N} and {S2P, N},
- and write the bitwise complement of the result to {RP, N}.
-
- -- Function: void mpn_com (mp_limb_t *RP, const mp_limb_t *SP,
- mp_size_t N)
- Perform the bitwise complement of {SP, N}, and write the result to
- {RP, N}.
-
- -- Function: void mpn_copyi (mp_limb_t *RP, const mp_limb_t *S1P,
- mp_size_t N)
- Copy from {S1P, N} to {RP, N}, increasingly.
-
- -- Function: void mpn_copyd (mp_limb_t *RP, const mp_limb_t *S1P,
- mp_size_t N)
- Copy from {S1P, N} to {RP, N}, decreasingly.
-
- -- Function: void mpn_zero (mp_limb_t *RP, mp_size_t N)
- Zero {RP, N}.
-
-
-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.
+ Return non-zero iff {S1P, N} is a perfect square.
-8.2 Nails
+8.1 Nails
=========
*Everything in this section is highly experimental and may disappear or
@@ -4813,7 +4421,7 @@ one of the `gmp_randinit' functions, and can be seeded with one of the
`gmp_randseed' functions.
The functions actually generating random numbers are described in
-*note Integer Random Numbers::, and *note Miscellaneous Float
+*Note Integer Random Numbers::, and *Note Miscellaneous Float
Functions::.
The older style random number functions don't accept a
@@ -4845,8 +4453,8 @@ File: gmp.info, Node: Random State Initialization, Next: Random State Seeding,
Initialize STATE for a Mersenne Twister algorithm. This algorithm
is fast and has good randomness properties.
- -- Function: void gmp_randinit_lc_2exp (gmp_randstate_t STATE, const
- mpz_t A, unsigned long C, mp_bitcnt_t M2EXP)
+ -- Function: void gmp_randinit_lc_2exp (gmp_randstate_t STATE, mpz_t
+ A, unsigned long C, unsigned long M2EXP)
Initialize STATE with a linear congruential algorithm X = (A*X +
C) mod 2^M2EXP.
@@ -4860,10 +4468,10 @@ File: gmp.info, Node: Random State Initialization, Next: Random State Seeding,
concatenated.
-- Function: int gmp_randinit_lc_2exp_size (gmp_randstate_t STATE,
- mp_bitcnt_t SIZE)
+ unsigned long SIZE)
Initialize STATE for a linear congruential algorithm as per
`gmp_randinit_lc_2exp'. A, C and M2EXP are selected from a table,
- chosen so that SIZE bits (or more) of each X will be used, i.e.
+ chosen so that SIZE bits (or more) of each X will be used, ie.
M2EXP/2 >= SIZE.
If successful the return value is non-zero. If SIZE is bigger
@@ -4899,8 +4507,7 @@ File: gmp.info, Node: Random State Seeding, Next: Random State Miscellaneous,
9.2 Random State Seeding
========================
- -- Function: void gmp_randseed (gmp_randstate_t STATE, const mpz_t
- SEED)
+ -- Function: void gmp_randseed (gmp_randstate_t STATE, mpz_t SEED)
-- Function: void gmp_randseed_ui (gmp_randstate_t STATE,
unsigned long int SEED)
Set an initial seed value into STATE.
@@ -4930,7 +4537,7 @@ File: gmp.info, Node: Random State Miscellaneous, Prev: Random State Seeding,
-- Function: unsigned long gmp_urandomb_ui (gmp_randstate_t STATE,
unsigned long N)
- Return a uniformly distributed random number of N bits, i.e. in the
+ Return a uniformly distributed random number of N bits, ie. in the
range 0 to 2^N-1 inclusive. N must be less than or equal to the
number of bits in an `unsigned long'.
@@ -5066,7 +4673,7 @@ instance extensions registered with GLIBC `register_printf_function'.
Also currently there's no support for POSIX `$' style numbered arguments
(perhaps this will be added in the future).
- The precision field has its usual meaning for integer `Z' and float
+ The precision field has it's usual meaning for integer `Z' and float
`F' types, but is currently undefined for `Q' and should not be used
with that.
@@ -5077,9 +4684,7 @@ happens even for an `f' conversion of an `mpf_t' which is an integer,
for instance 2^1024 in an `mpf_t' of 128 bits precision will only
produce about 40 digits, then pad with zeros to the decimal point. An
empty precision field like `%.Fe' or `%.Ff' can be used to specifically
-request just the significant digits. Without any dot and thus no
-precision field, a precision value of 6 will be used. Note that these
-rules mean that `%Ff', `%.Ff', and `%.0Ff' will all be different.
+request just the significant digits.
The decimal point character (or string) is taken from the current
locale settings on systems which provide `localeconv' (*note Locales
@@ -5097,7 +4702,7 @@ File: gmp.info, Node: Formatted Output Functions, Next: C++ Formatted Output,
Each of the following functions is similar to the corresponding C
library function. The basic `printf' forms take a variable argument
-list. The `vprintf' forms take an argument pointer, see *note Variadic
+list. The `vprintf' forms take an argument pointer, see *Note Variadic
Functions: (libc)Variadic Functions, or `man 3 va_start'.
It should be emphasised that if a format string is invalid, or the
@@ -5178,7 +4783,7 @@ shouldn't normally occur.
These functions are available only when the C library provides the
obstack feature, which probably means only on GNU systems, see
- *note Obstacks: (libc)Obstacks.
+ *Note Obstacks: (libc)Obstacks.

File: gmp.info, Node: C++ Formatted Output, Prev: Formatted Output Functions, Up: Formatted Output
@@ -5190,7 +4795,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, const mpz_t OP)
+ -- Function: ostream& operator<< (ostream& STREAM, 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.
@@ -5199,7 +4804,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, const mpq_t OP)
+ -- Function: ostream& operator<< (ostream& STREAM, 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.
@@ -5212,7 +4817,7 @@ Options::). Prototypes are available from `<gmp.h>'.
on both the numerator and denominator (if the denominator is
required).
- -- Function: ostream& operator<< (ostream& STREAM, const mpf_t OP)
+ -- Function: ostream& operator<< (ostream& STREAM, 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.
@@ -5241,7 +4846,7 @@ way, for example,
But note that `ostream' output (and `istream' input, *note C++
Formatted Input::) is the only overloading available for the GMP types
and that for instance using `+' with an `mpz_t' will have unpredictable
-results. For classes with overloading, see *note C++ Class Interface::.
+results. For classes with overloading, see *Note C++ Class Interface::.

File: gmp.info, Node: Formatted Input, Next: C++ Class Interface, Prev: Formatted Output, Up: Top
@@ -5389,7 +4994,7 @@ File: gmp.info, Node: Formatted Input Functions, Next: C++ Formatted Input, P
Each of the following functions is similar to the corresponding C
library function. The plain `scanf' forms take a variable argument
-list. The `vscanf' forms take an argument pointer, see *note Variadic
+list. The `vscanf' forms take an argument pointer, see *Note Variadic
Functions: (libc)Variadic Functions, or `man 3 va_start'.
It should be emphasised that if a format string is invalid, or the
@@ -5489,10 +5094,10 @@ way, for example,
But note that `istream' input (and `ostream' output, *note C++
Formatted Output::) is the only overloading available for the GMP types
and that for instance using `+' with an `mpz_t' will have unpredictable
-results. For classes with overloading, see *note C++ Class Interface::.
+results. For classes with overloading, see *Note C++ Class Interface::.

-File: gmp.info, Node: C++ Class Interface, Next: Custom Allocation, Prev: Formatted Input, Up: Top
+File: gmp.info, Node: C++ Class Interface, Next: BSD Compatible Functions, Prev: Formatted Input, Up: Top
12 C++ Class Interface
**********************
@@ -5505,7 +5110,8 @@ 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.
+of templates and member templates. For GCC this means version 2.91 or
+later.
*Everything described in this chapter is to be considered preliminary
and might be subject to incompatible changes if some unforeseen
@@ -5617,33 +5223,28 @@ File: gmp.info, Node: C++ Interface Integers, Next: C++ Interface Rationals,
12.2 C++ Interface Integers
===========================
- -- Function: mpz_class::mpz_class (type N)
+ -- Function: void mpz_class::mpz_class (type N)
Construct an `mpz_class'. All the standard C++ types may be used,
except `long long' and `long double', and all the GMP C++ classes
- can be used, although conversions from `mpq_class' and `mpf_class'
- are `explicit'. Any necessary conversion follows the
- corresponding C function, for example `double' follows `mpz_set_d'
- (*note Assigning Integers::).
+ can be used. Any necessary conversion follows the corresponding C
+ function, for example `double' follows `mpz_set_d' (*note
+ Assigning Integers::).
- -- Function: explicit mpz_class::mpz_class (const mpz_t Z)
+ -- Function: void mpz_class::mpz_class (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.
- -- Function: explicit mpz_class::mpz_class (const char *S, int BASE =
- 0)
- -- Function: explicit mpz_class::mpz_class (const string& S, int BASE
- = 0)
+ -- Function: void mpz_class::mpz_class (const char *S)
+ -- Function: void mpz_class::mpz_class (const char *S, int BASE = 0)
+ -- Function: void mpz_class::mpz_class (const string& S)
+ -- Function: void mpz_class::mpz_class (const string& S, int BASE = 0)
Construct an `mpz_class' converted from a string using
`mpz_set_str' (*note Assigning Integers::).
If the string is not a valid integer, an `std::invalid_argument'
exception is thrown. The same applies to `operator='.
- -- Function: mpz_class operator"" _mpz (const char *STR)
- With C++11 compilers, integers can be constructed with the syntax
- `123_mpz' which is equivalent to `mpz_class("123")'.
-
-- Function: mpz_class operator/ (mpz_class A, mpz_class D)
-- Function: mpz_class operator% (mpz_class A, mpz_class D)
Divisions involving `mpz_class' round towards zero, as per the
@@ -5657,7 +5258,7 @@ File: gmp.info, Node: C++ Interface Integers, Next: C++ Interface Rationals,
...
mpz_fdiv_q (q.get_mpz_t(), a.get_mpz_t(), d.get_mpz_t());
- -- Function: mpz_class abs (mpz_class OP)
+ -- Function: mpz_class abs (mpz_class OP1)
-- Function: int cmp (mpz_class OP1, type OP2)
-- Function: int cmp (type OP1, mpz_class OP2)
-- Function: bool mpz_class::fits_sint_p (void)
@@ -5674,8 +5275,6 @@ File: gmp.info, Node: C++ Interface Integers, Next: C++ Interface Rationals,
-- Function: int mpz_class::set_str (const string& STR, int BASE)
-- Function: int sgn (mpz_class OP)
-- Function: mpz_class sqrt (mpz_class OP)
- -- Function: void mpz_class::swap (mpz_class& OP)
- -- Function: void swap (mpz_class& OP1, mpz_class& OP2)
These functions provide a C++ class interface to the corresponding
GMP C routines.
@@ -5704,40 +5303,34 @@ In all the following constructors, if a fraction is given then it
should be in canonical form, or if not then `mpq_class::canonicalize'
called.
- -- Function: mpq_class::mpq_class (type OP)
- -- Function: mpq_class::mpq_class (integer NUM, integer DEN)
+ -- Function: void mpq_class::mpq_class (type OP)
+ -- Function: void mpq_class::mpq_class (integer NUM, integer DEN)
Construct an `mpq_class'. The initial value can be a single value
- of any type (conversion from `mpf_class' is `explicit'), or a pair
- of integers (`mpz_class' or standard C++ integer types)
- representing a fraction, except that `long long' and `long double'
- are not supported. For example,
+ of any type, or a pair of integers (`mpz_class' or standard C++
+ integer types) representing a fraction, except that `long long'
+ and `long double' are not supported. For example,
mpq_class q (99);
mpq_class q (1.75);
mpq_class q (1, 3);
- -- Function: explicit mpq_class::mpq_class (const mpq_t Q)
+ -- Function: void mpq_class::mpq_class (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.
- -- Function: explicit mpq_class::mpq_class (const char *S, int BASE =
- 0)
- -- Function: explicit mpq_class::mpq_class (const string& S, int BASE
- = 0)
+ -- Function: void mpq_class::mpq_class (const char *S)
+ -- Function: void mpq_class::mpq_class (const char *S, int BASE = 0)
+ -- Function: void mpq_class::mpq_class (const string& S)
+ -- Function: void mpq_class::mpq_class (const string& S, int BASE = 0)
Construct an `mpq_class' converted from a string using
`mpq_set_str' (*note Initializing Rationals::).
If the string is not a valid rational, an `std::invalid_argument'
exception is thrown. The same applies to `operator='.
- -- Function: mpq_class operator"" _mpq (const char *STR)
- With C++11 compilers, integral rationals can be constructed with
- the syntax `123_mpq' which is equivalent to `mpq_class(123_mpz)'.
- Other rationals can be built as `-1_mpq/2' or `0xb_mpq/123456_mpz'.
-
-- Function: void mpq_class::canonicalize ()
- Put an `mpq_class' into canonical form, as per *note Rational
+ Put an `mpq_class' into canonical form, as per *Note Rational
Number Functions::. All arithmetic operators require their
operands in canonical form, and will return results in canonical
form.
@@ -5750,8 +5343,6 @@ called.
-- Function: int mpq_class::set_str (const char *STR, int BASE)
-- Function: int mpq_class::set_str (const string& STR, int BASE)
-- Function: int sgn (mpq_class OP)
- -- Function: void mpq_class::swap (mpq_class& OP)
- -- Function: void swap (mpq_class& OP1, mpq_class& OP2)
These functions provide a C++ class interface to the corresponding
GMP C routines.
@@ -5797,7 +5388,7 @@ same precision as the destination `f'. Explicit constructors can be
used if this doesn't suit.
-- Function: mpf_class::mpf_class (type OP)
- -- Function: mpf_class::mpf_class (type OP, mp_bitcnt_t PREC)
+ -- Function: mpf_class::mpf_class (type OP, unsigned long PREC)
Construct an `mpf_class'. Any standard C++ type can be used,
except `long long' and `long double', and any of the GMP C++
classes can be used.
@@ -5817,21 +5408,12 @@ 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 (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.
-
- If PREC is given, the initial precision is that value, in bits. If
- PREC is not given, then the initial precision is that of F.
-
- -- Function: explicit mpf_class::mpf_class (const char *S)
- -- Function: mpf_class::mpf_class (const char *S, mp_bitcnt_t PREC,
- int BASE = 0)
- -- Function: explicit mpf_class::mpf_class (const string& S)
- -- Function: mpf_class::mpf_class (const string& S, mp_bitcnt_t PREC,
- int BASE = 0)
+ -- Function: void mpf_class::mpf_class (const char *S)
+ -- Function: void mpf_class::mpf_class (const char *S, unsigned long
+ PREC, int BASE = 0)
+ -- Function: void mpf_class::mpf_class (const string& S)
+ -- Function: void mpf_class::mpf_class (const string& S, unsigned long
+ PREC, int BASE = 0)
Construct an `mpf_class' converted from a string using
`mpf_set_str' (*note Assigning Floats::). If PREC is given, the
initial precision is that value, in bits. If not, the default
@@ -5840,10 +5422,6 @@ used if this doesn't suit.
If the string is not a valid float, an `std::invalid_argument'
exception is thrown. The same applies to `operator='.
- -- Function: mpf_class operator"" _mpf (const char *STR)
- With C++11 compilers, floats can be constructed with the syntax
- `1.23e-1_mpf' which is equivalent to `mpf_class("1.23e-1")'.
-
-- Function: mpf_class& mpf_class::operator= (type OP)
Convert and store the given OP value to an `mpf_class' object. The
same types are accepted as for the constructors above.
@@ -5888,8 +5466,6 @@ used if this doesn't suit.
-- Function: int mpf_class::set_str (const string& STR, int BASE)
-- Function: int sgn (mpf_class OP)
-- Function: mpf_class sqrt (mpf_class OP)
- -- Function: void mpf_class::swap (mpf_class& OP)
- -- Function: void swap (mpf_class& OP1, mpf_class& OP2)
-- Function: mpf_class trunc (mpf_class OP)
These functions provide a C++ class interface to the corresponding
GMP C routines.
@@ -5899,9 +5475,9 @@ used if this doesn't suit.
The accuracy provided by `hypot' is not currently guaranteed.
- -- Function: mp_bitcnt_t mpf_class::get_prec ()
- -- Function: void mpf_class::set_prec (mp_bitcnt_t PREC)
- -- Function: void mpf_class::set_prec_raw (mp_bitcnt_t PREC)
+ -- Function: unsigned long int mpf_class::get_prec ()
+ -- Function: void mpf_class::set_prec (unsigned long PREC)
+ -- Function: void mpf_class::set_prec_raw (unsigned long PREC)
Get or set the current precision of an `mpf_class'.
The restrictions described for `mpf_set_prec_raw' (*note
@@ -5947,7 +5523,7 @@ File: gmp.info, Node: C++ Interface Random Numbers, Next: C++ Interface Limita
Seed a random number generator. See *note Random Number
Functions::, for how to choose a good seed.
- -- Function: mpz_class gmp_randclass::get_z_bits (mp_bitcnt_t BITS)
+ -- Function: mpz_class gmp_randclass::get_z_bits (unsigned long BITS)
-- Function: mpz_class gmp_randclass::get_z_bits (mpz_class BITS)
Generate a random integer with a specified number of bits.
@@ -5955,7 +5531,7 @@ File: gmp.info, Node: C++ Interface Random Numbers, Next: C++ Interface Limita
Generate a random integer in the range 0 to N-1 inclusive.
-- Function: mpf_class gmp_randclass::get_f ()
- -- Function: mpf_class gmp_randclass::get_f (mp_bitcnt_t PREC)
+ -- Function: mpf_class gmp_randclass::get_f (unsigned long PREC)
Generate a random float F in the range 0 <= F < 1. F will be to
PREC bits precision, or if PREC is not given then to the precision
of the destination. For example,
@@ -6042,31 +5618,118 @@ 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.
+
+File: gmp.info, Node: BSD Compatible Functions, Next: Custom Allocation, Prev: C++ Class Interface, Up: Top
+
+13 Berkeley MP Compatible Functions
+***********************************
+
+These functions are intended to be fully compatible with the Berkeley MP
+library which is available on many BSD derived U*ix systems. The
+`--enable-mpbsd' option must be used when building GNU MP to make these
+available (*note Installing GMP::).
+
+ The original Berkeley MP library has a usage restriction: you cannot
+use the same variable as both source and destination in a single
+function call. The compatible functions in GNU MP do not share this
+restriction--inputs and outputs may overlap.
+
+ It is not recommended that new programs are written using these
+functions. Apart from the incomplete set of functions, the interface
+for initializing `MINT' objects is more error prone, and the `pow'
+function collides with `pow' in `libm.a'.
+
+ Include the header `mp.h' to get the definition of the necessary
+types and functions. If you are on a BSD derived system, make sure to
+include GNU `mp.h' if you are going to link the GNU `libmp.a' to your
+program. This means that you probably need to give the `-I<dir>'
+option to the compiler, where `<dir>' is the directory where you have
+GNU `mp.h'.
+
+ -- Function: MINT * itom (signed short int INITIAL_VALUE)
+ Allocate an integer consisting of a `MINT' object and dynamic limb
+ space. Initialize the integer to INITIAL_VALUE. Return a pointer
+ to the `MINT' object.
+
+ -- Function: MINT * xtom (char *INITIAL_VALUE)
+ Allocate an integer consisting of a `MINT' object and dynamic limb
+ space. Initialize the integer from INITIAL_VALUE, a hexadecimal,
+ null-terminated C string. Return a pointer to the `MINT' object.
+
+ -- Function: void move (MINT *SRC, MINT *DEST)
+ Set DEST to SRC by copying. Both variables must be previously
+ initialized.
+
+ -- Function: void madd (MINT *SRC_1, MINT *SRC_2, MINT *DESTINATION)
+ Add SRC_1 and SRC_2 and put the sum in DESTINATION.
+
+ -- Function: void msub (MINT *SRC_1, MINT *SRC_2, MINT *DESTINATION)
+ Subtract SRC_2 from SRC_1 and put the difference in DESTINATION.
+
+ -- Function: void mult (MINT *SRC_1, MINT *SRC_2, MINT *DESTINATION)
+ Multiply SRC_1 and SRC_2 and put the product in DESTINATION.
+
+ -- Function: void mdiv (MINT *DIVIDEND, MINT *DIVISOR, MINT *QUOTIENT,
+ MINT *REMAINDER)
+ -- Function: void sdiv (MINT *DIVIDEND, signed short int DIVISOR, MINT
+ *QUOTIENT, signed short int *REMAINDER)
+ Set QUOTIENT to DIVIDEND/DIVISOR, and REMAINDER to DIVIDEND mod
+ DIVISOR. The quotient is rounded towards zero; the remainder has
+ the same sign as the dividend unless it is zero.
+
+ Some implementations of these functions work differently--or not
+ at all--for negative arguments.
+
+ -- Function: void msqrt (MINT *OP, MINT *ROOT, MINT *REMAINDER)
+ Set ROOT to the truncated integer part of the square root of OP,
+ like `mpz_sqrt'. Set REMAINDER to OP-ROOT*ROOT, i.e. zero if OP
+ is a perfect square.
+
+ If ROOT and REMAINDER are the same variable, the results are
+ undefined.
+
+ -- Function: void pow (MINT *BASE, MINT *EXP, MINT *MOD, MINT *DEST)
+ Set DEST to (BASE raised to EXP) modulo MOD.
+
+ Note that the name `pow' clashes with `pow' from the standard C
+ math library (*note Exponentiation and Logarithms: (libc)Exponents
+ and Logarithms.). An application will only be able to use one or
+ the other.
+
+ -- Function: void rpow (MINT *BASE, signed short int EXP, MINT *DEST)
+ Set DEST to BASE raised to EXP.
+
+ -- Function: void gcd (MINT *OP1, MINT *OP2, MINT *RES)
+ Set RES to the greatest common divisor of OP1 and OP2.
+
+ -- Function: int mcmp (MINT *OP1, MINT *OP2)
+ Compare OP1 and OP2. Return a positive value if OP1 > OP2, zero
+ if OP1 = OP2, and a negative value if OP1 < OP2.
- mpz_class z = 33;
- auto sum = z + z;
- mpz_class prod = sum * sum;
+ -- Function: void min (MINT *DEST)
+ Input a decimal string from `stdin', and put the read integer in
+ DEST. SPC and TAB are allowed in the number string, and are
+ ignored.
- 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.
+ -- Function: void mout (MINT *SRC)
+ Output SRC to `stdout', as a decimal string. Also output a
+ newline.
- mpz_class z = 33;
- auto sum = z + z + z;
- mpz_class prod = sum * 2;
+ -- Function: char * mtox (MINT *OP)
+ Convert OP to a hexadecimal string, and return a pointer to the
+ string. The returned string is allocated using the default memory
+ allocation function, `malloc' by default. It will be
+ `strlen(str)+1' bytes, that being exactly enough for the string
+ and null-terminator.
- It is thus strongly recommended to avoid `auto' anywhere a GMP C++
- expression may appear.
+ -- Function: void mfree (MINT *OP)
+ De-allocate, the space used by OP. *This function should only be
+ passed a value returned by `itom' or `xtom'.*

-File: gmp.info, Node: Custom Allocation, Next: Language Bindings, Prev: C++ Class Interface, Up: Top
+File: gmp.info, Node: Custom Allocation, Next: Language Bindings, Prev: BSD Compatible Functions, Up: Top
-13 Custom Allocation
+14 Custom Allocation
********************
By default GMP uses `malloc', `realloc' and `free' for memory
@@ -6077,6 +5740,9 @@ output and terminates the program.
different way or to have a different error action on running out of
memory.
+ This feature is available in the Berkeley compatibility library
+(*note BSD Compatible Functions::) as well as the main GMP library.
+
-- Function: void mp_set_memory_functions (
void *(*ALLOC_FUNC_PTR) (size_t),
void *(*REALLOC_FUNC_PTR) (void *, size_t, size_t),
@@ -6119,10 +5785,10 @@ memory.
A "byte" here means the unit used by the `sizeof' operator.
- The REALLOCATE_FUNCTION parameter OLD_SIZE and the FREE_FUNCTION
-parameter SIZE are passed for convenience, but of course they can be
-ignored if not needed by an implementation. The default functions
-using `malloc' and friends for instance don't use them.
+ The OLD_SIZE parameters to REALLOCATE_FUNCTION and FREE_FUNCTION are
+passed for convenience, but of course can be ignored if not needed.
+The default functions using `malloc' and friends for instance don't use
+them.
No error return is allowed from any of these functions, if they
return then they must have performed the specified operation. In
@@ -6166,7 +5832,7 @@ this is a problem.

File: gmp.info, Node: Language Bindings, Next: Algorithms, Prev: Custom Allocation, Up: Top
-14 Language Bindings
+15 Language Bindings
********************
The following packages and projects offer access to GMP from languages
@@ -6179,32 +5845,38 @@ C++
Straightforward interface, expression templates to eliminate
temporaries.
- * ALP `https://www-sop.inria.fr/saga/logiciels/ALP/'
+ * ALP `http://www-sop.inria.fr/saga/logiciels/ALP/'
Linear algebra and polynomials using templates.
- * Arithmos `http://cant.ua.ac.be/old/arithmos/'
+ * Arithmos `http://www.win.ua.ac.be/~cant/arithmos/'
Rationals with infinities and square roots.
* 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.
* NTL `http://www.shoup.net/ntl/'
A C++ number theory library.
-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 `https://www.haskell.org/ghc/'
+ * Glasgow Haskell Compiler `http://www.haskell.org/ghc/'
Java
- * Kaffe `https://github.com/kaffe/kaffe'
+ * Kaffe `http://www.kaffe.org/'
+
+ * Kissme `http://kissme.sourceforge.net/'
Lisp
- * GNU Common Lisp `https://www.gnu.org/software/gcl/gcl.html'
+ * GNU Common Lisp `http://www.gnu.org/software/gcl/gcl.html'
* Librep `http://librep.sourceforge.net/'
@@ -6219,13 +5891,13 @@ ML
* MLton compiler `http://mlton.org/'
Objective Caml
- * MLGMP `http://opam.ocamlpro.com/pkg/mlgmp.20120224.html'
+ * MLGMP `http://www.di.ens.fr/~monniaux/programmes.html.en'
* Numerix `http://pauillac.inria.fr/~quercia/'
Optionally using GMP.
Oz
- * Mozart `http://mozart.github.io/'
+ * Mozart `http://www.mozart-oz.org/'
Pascal
* GNU Pascal Compiler `http://www.gnu-pascal.de/'
@@ -6254,24 +5926,25 @@ Prolog
Arbitrary precision floats.
Python
- * GMPY `https://code.google.com/p/gmpy/'
+ * mpz module in the standard distribution,
+ `http://www.python.org/'
-Ruby
- * http://rubygems.org/gems/gmp
+ * GMPY `http://gmpy.sourceforge.net/'
Scheme
- * GNU Guile `https://www.gnu.org/software/guile/guile.html'
+ * GNU Guile (upcoming 1.8)
+ `http://www.gnu.org/software/guile/guile.html'
* RScheme `http://www.rscheme.org/'
- * STklos `http://www.stklos.net/'
+ * STklos `http://www.stklos.org/'
Smalltalk
* GNU Smalltalk
`http://www.smalltalk.org/versions/GNUSmalltalk.html'
Other
- * Axiom `https://savannah.nongnu.org/projects/axiom'
+ * Axiom `http://savannah.nongnu.org/projects/axiom'
Computer algebra using GCL.
* DrGenius `http://drgenius.seul.org/'
@@ -6280,23 +5953,26 @@ Other
* GiNaC `http://www.ginac.de/'
C++ computer algebra using CLN.
- * GOO `https://www.eecs.berkeley.edu/~jrb/goo/'
+ * GOO `http://www.googoogaga.org/'
Dynamic object oriented language.
- * Maxima `https://www.ma.utexas.edu/users/wfs/maxima.html'
+ * Maxima `http://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 `http://yacas.sourceforge.net'
+ * Yacas `http://www.xs4all.nl/~apinkus/yacas.html'
Yet another computer algebra system.

File: gmp.info, Node: Algorithms, Next: Internals, Prev: Language Bindings, Up: Top
-15 Algorithms
+16 Algorithms
*************
This chapter is an introduction to some of the algorithms used for
@@ -6321,25 +5997,23 @@ documented functions.

File: gmp.info, Node: Multiplication Algorithms, Next: Division Algorithms, Prev: Algorithms, Up: Algorithms
-15.1 Multiplication
+16.1 Multiplication
===================
-NxN limb multiplications and squares are done using one of seven
+NxN limb multiplications and squares are done using one of five
algorithms, as the size N increases.
Algorithm Threshold
Basecase (none)
- Karatsuba `MUL_TOOM22_THRESHOLD'
+ Karatsuba `MUL_KARATSUBA_THRESHOLD'
Toom-3 `MUL_TOOM33_THRESHOLD'
Toom-4 `MUL_TOOM44_THRESHOLD'
- Toom-6.5 `MUL_TOOM6H_THRESHOLD'
- Toom-8.5 `MUL_TOOM8H_THRESHOLD'
FFT `MUL_FFT_THRESHOLD'
Similarly for squaring, with the `SQR' thresholds.
NxM multiplications of operands with different sizes above
-`MUL_TOOM22_THRESHOLD' are currently done by special Toom-inspired
+`MUL_KARATSUBA_THRESHOLD' are currently done by special Toom-inspired
algorithms or directly with FFT, depending on operand size (*note
Unbalanced Multiplication::).
@@ -6349,7 +6023,6 @@ Unbalanced Multiplication::).
* Karatsuba Multiplication::
* Toom 3-Way Multiplication::
* Toom 4-Way Multiplication::
-* Higher degree Toom'n'half::
* FFT Multiplication::
* Other Multiplication::
* Unbalanced Multiplication::
@@ -6357,7 +6030,7 @@ Unbalanced Multiplication::).

File: gmp.info, Node: Basecase Multiplication, Next: Karatsuba Multiplication, Prev: Multiplication Algorithms, Up: Multiplication Algorithms
-15.1.1 Basecase Multiplication
+16.1.1 Basecase Multiplication
------------------------------
Basecase NxM multiplication is a straightforward rectangular set of
@@ -6402,7 +6075,7 @@ routine should be used always.

File: gmp.info, Node: Karatsuba Multiplication, Next: Toom 3-Way Multiplication, Prev: Basecase Multiplication, Up: Multiplication Algorithms
-15.1.2 Karatsuba Multiplication
+16.1.2 Karatsuba Multiplication
-------------------------------
The Karatsuba multiplication algorithm is described in Knuth section
@@ -6421,9 +6094,9 @@ length (or the most significant part one limb shorter if N is odd).
| y1 | y0 |
+----------+----------+
- Let b be the power of 2 where the split occurs, i.e. if x0 is k
-limbs (y0 the same) then b=2^(k*mp_bits_per_limb). With that x=x1*b+x0
-and y=y1*b+y0, and the following holds,
+ Let b be the power of 2 where the split occurs, ie. if x0 is k limbs
+(y0 the same) then b=2^(k*mp_bits_per_limb). With that x=x1*b+x0 and
+y=y1*b+y0, and the following holds,
x*y = (b^2+b)*x1*y1 - b*(x1-x0)*(y1-y0) + (b+1)*x0*y0
@@ -6470,7 +6143,7 @@ form above.
the exponent being log(3)/log(2), representing 3 multiplies each 1/2
the size of the inputs. This is a big improvement over the basecase
multiply at O(N^2) and the advantage soon overcomes the extra additions
-Karatsuba performs. `MUL_TOOM22_THRESHOLD' can be as little as 10
+Karatsuba performs. `MUL_KARATSUBA_THRESHOLD' can be as little as 10
limbs. The `SQR' threshold is usually about twice the `MUL'.
The basecase algorithm will take a time of the form M(N) = a*N^2 +
@@ -6487,7 +6160,7 @@ that sense the algorithm thresholds are merely of academic interest.

File: gmp.info, Node: Toom 3-Way Multiplication, Next: Toom 4-Way Multiplication, Prev: Karatsuba Multiplication, Up: Multiplication Algorithms
-15.1.3 Toom 3-Way Multiplication
+16.1.3 Toom 3-Way Multiplication
--------------------------------
The Karatsuba formula is the simplest case of a general approach to
@@ -6514,7 +6187,7 @@ These parts are treated as the coefficients of two polynomials
Y(t) = y2*t^2 + y1*t + y0
Let b equal the power of 2 which is the size of the x0, x1, y0 and
-y1 pieces, i.e. if they're k limbs each then b=2^(k*mp_bits_per_limb).
+y1 pieces, ie. if they're k limbs each then b=2^(k*mp_bits_per_limb).
With this x=X(b) and y=Y(b).
Let a polynomial W(t)=X(t)*Y(t) and suppose its coefficients are
@@ -6590,8 +6263,8 @@ steps for quickly isolating the w[i].
Squaring follows the same procedure as multiplication, but there's
only one X(t) and it's evaluated at the 5 points, and those values
squared to give values of W(t). The interpolation is then identical,
-and in fact the same `toom_interpolate_5pts' subroutine is used for
-both squaring and multiplying.
+and in fact the same `toom3_interpolate' subroutine is used for both
+squaring and multiplying.
Toom-3 is asymptotically O(N^1.465), the exponent being
log(5)/log(3), representing 5 recursive multiplies of 1/3 the original
@@ -6628,9 +6301,9 @@ but again doesn't have to be implemented that way and for example with
a bit of rearrangement just one division by 6 can be done.

-File: gmp.info, Node: Toom 4-Way Multiplication, Next: Higher degree Toom'n'half, Prev: Toom 3-Way Multiplication, Up: Multiplication Algorithms
+File: gmp.info, Node: Toom 4-Way Multiplication, Next: FFT Multiplication, Prev: Toom 3-Way Multiplication, Up: Multiplication Algorithms
-15.1.4 Toom 4-Way Multiplication
+16.1.4 Toom 4-Way Multiplication
--------------------------------
Karatsuba and Toom-3 split the operands into 2 and 3 coefficients,
@@ -6662,41 +6335,14 @@ log(7)/log(4), representing 7 recursive multiplies of 1/4 the original
size each.

-File: gmp.info, Node: Higher degree Toom'n'half, Next: FFT Multiplication, Prev: Toom 4-Way Multiplication, Up: Multiplication Algorithms
-
-15.1.5 Higher degree Toom'n'half
---------------------------------
+File: gmp.info, Node: FFT Multiplication, Next: Other Multiplication, Prev: Toom 4-Way Multiplication, Up: Multiplication Algorithms
-The Toom algorithms described above (*note Toom 3-Way Multiplication::,
-*note Toom 4-Way Multiplication::) generalizes to split into an
-arbitrary number of pieces. In general a split of two equally long
-operands into r pieces leads to evaluations and pointwise
-multiplications done at 2*r-1 points. To fully exploit symmetries it
-would be better to have 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 choosing an even r, Toom-r+1/2
-requires 2r points, a multiple of four.
-
- 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
-buffer equanl in size to the result of the product.
-
- Current GMP uses both Toom-6'n'half and Toom-8'n'half.
-
-
-File: gmp.info, Node: FFT Multiplication, Next: Other Multiplication, Prev: Higher degree Toom'n'half, Up: Multiplication Algorithms
-
-15.1.6 FFT Multiplication
+16.1.5 FFT Multiplication
-------------------------
At large to very large sizes a Fermat style FFT multiplication is used,
-following Schönhage and Strassen (*note References::). Descriptions of
-FFTs in various forms can be found in many textbooks, for instance
+following Scho"nhage and Strassen (*note References::). Descriptions
+of FFTs in various forms can be found in many textbooks, for instance
Knuth section 4.3.3 part C or Lipson chapter IX. A brief description
of the form used in GMP is given here.
@@ -6728,13 +6374,13 @@ choice of N' ensures these sums aren't truncated.
The points used for the evaluation are g^i for i=0 to 2^k-1 where
g=2^(2N'/2^k). g is a 2^k'th root of unity mod 2^N'+1, which produces
necessary cancellations at the interpolation stage, and it's also a
-power of 2 so the fast Fourier transforms used for the evaluation and
+power of 2 so the fast fourier transforms used for the evaluation and
interpolation do only shifts, adds and negations.
The pointwise multiplications are done modulo 2^N'+1 and either
recurse into a further FFT or use a plain multiplication (Toom-3,
Karatsuba or basecase), whichever is optimal at the size N'. The
-interpolation is an inverse fast Fourier transform. The resulting set
+interpolation is an inverse fast fourier transform. The resulting set
of sums of x[i]*y[j] are added at appropriate offsets to give the final
result.
@@ -6795,7 +6441,7 @@ will be needed.

File: gmp.info, Node: Other Multiplication, Next: Unbalanced Multiplication, Prev: FFT Multiplication, Up: Multiplication Algorithms
-15.1.7 Other Multiplication
+16.1.6 Other Multiplication
---------------------------
The Toom algorithms described above (*note Toom 3-Way Multiplication::,
@@ -6825,10 +6471,10 @@ multipliers at C8 become 2*t*j-j^2.
can be thought of as using -1 as a square root of unity. If a 4th root
of unity was available then a further split and speedup would be
possible, but no such root exists for plain integers. Going to complex
-integers with i=sqrt(-1) doesn't help, essentially because in Cartesian
+integers with i=sqrt(-1) doesn't help, essentially because in cartesian
form it takes three real multiplies to do a complex multiply. The
existence of 2^k'th roots of unity in a suitable ring or field lets the
-fast Fourier transform keep splitting and get to O(N*log(r)).
+fast fourier transform keep splitting and get to O(N*log(r)).
Floating point FFTs use complex numbers approximating Nth roots of
unity. Some processors have special support for such FFTs. But these
@@ -6840,11 +6486,11 @@ is of course of vital importance to GMP.

File: gmp.info, Node: Unbalanced Multiplication, Prev: Other Multiplication, Up: Multiplication Algorithms
-15.1.8 Unbalanced Multiplication
+16.1.7 Unbalanced Multiplication
--------------------------------
Multiplication of operands with different sizes, both below
-`MUL_TOOM22_THRESHOLD' are done with plain schoolbook multiplication
+`MUL_KARATSUBA_THRESHOLD' are done with plain schoolbook multiplication
(*note Basecase Multiplication::).
For really large operands, we invoke FFT directly.
@@ -6859,7 +6505,7 @@ coefficients, i.e., a polynomial of degree 1 to 3.

File: gmp.info, Node: Division Algorithms, Next: Greatest Common Divisor Algorithms, Prev: Multiplication Algorithms, Up: Algorithms
-15.2 Division Algorithms
+16.2 Division Algorithms
========================
* Menu:
@@ -6867,7 +6513,6 @@ File: gmp.info, Node: Division Algorithms, Next: Greatest Common Divisor Algor
* Single Limb Division::
* Basecase Division::
* Divide and Conquer Division::
-* Block-Wise Barrett Division::
* Exact Division::
* Exact Remainder::
* Small Quotient Division::
@@ -6875,7 +6520,7 @@ File: gmp.info, Node: Division Algorithms, Next: Greatest Common Divisor Algor

File: gmp.info, Node: Single Limb Division, Next: Basecase Division, Prev: Division Algorithms, Up: Division Algorithms
-15.2.1 Single Limb Division
+16.2.1 Single Limb Division
---------------------------
Nx1 division is implemented using repeated 2x1 divisions from high to
@@ -6883,7 +6528,7 @@ low, either with a hardware divide instruction or a multiplication by
inverse, whichever is best on a given CPU.
The multiply by inverse follows "Improved division by invariant
-integers" by Möller and Granlund (*note References::) and is
+integers" by Mo"ller and Granlund (*note References::) and is
implemented as `udiv_qrnnd_preinv' in `gmp-impl.h'. The idea is to
have a fixed-point approximation to 1/d (see `invert_limb') and then
multiply by the high limb (plus one bit) of the dividend to get a
@@ -6929,7 +6574,7 @@ pipelined.

File: gmp.info, Node: Basecase Division, Next: Divide and Conquer Division, Prev: Single Limb Division, Up: Division Algorithms
-15.2.2 Basecase Division
+16.2.2 Basecase Division
------------------------
Basecase NxM division is like long division done by hand, but in base
@@ -6942,7 +6587,7 @@ the top end of the dividend. With a normalized divisor (most
significant bit set), each quotient limb can be formed with a 2x1
division and a 1x1 multiplication plus some subtractions. The 2x1
division is by the high limb of the divisor and is done either with a
-hardware divide or a multiply by inverse (the same as in *note Single
+hardware divide or a multiply by inverse (the same as in *Note Single
Limb Division::) whichever is faster. Such a quotient is sometimes one
too big, requiring an addback of the divisor, but that happens rarely.
@@ -6952,12 +6597,12 @@ multiplication, differing in fact only in the extra multiply and divide
for each of the Q quotient limbs.

-File: gmp.info, Node: Divide and Conquer Division, Next: Block-Wise Barrett Division, Prev: Basecase Division, Up: Division Algorithms
+File: gmp.info, Node: Divide and Conquer Division, Next: Exact Division, Prev: Basecase Division, Up: Division Algorithms
-15.2.3 Divide and Conquer Division
+16.2.3 Divide and Conquer Division
----------------------------------
-For divisors larger than `DC_DIV_QR_THRESHOLD', division is done by
+For divisors larger than `DIV_DC_THRESHOLD', division is done by
dividing. Or to be precise by a recursive divide and conquer algorithm
based on work by Moenck and Borodin, Jebelean, and Burnikel and Ziegler
(*note References::).
@@ -6974,12 +6619,12 @@ formed by recursive Nx(N/2) divisions.
then the work is about the same as a basecase division, but with more
function call overheads and with some subtractions separated from the
multiplies. These overheads mean that it's only when N/2 is above
-`MUL_TOOM22_THRESHOLD' that divide and conquer is of use.
+`MUL_KARATSUBA_THRESHOLD' that divide and conquer is of use.
- `DC_DIV_QR_THRESHOLD' is based on the divisor size N, so it will be
-somewhere above twice `MUL_TOOM22_THRESHOLD', but how much above
+ `DIV_DC_THRESHOLD' is based on the divisor size N, so it will be
+somewhere above twice `MUL_KARATSUBA_THRESHOLD', but how much above
depends on the CPU. An optimized `mpn_mul_basecase' can lower
-`DC_DIV_QR_THRESHOLD' a little by offering a ready-made advantage over
+`DIV_DC_THRESHOLD' a little by offering a ready-made advantage over
repeated `mpn_submul_1' calls.
Divide and conquer is asymptotically O(M(N)*log(N)) where M(N) is
@@ -6991,26 +6636,14 @@ algorithms the M(N) term improves and the multiplier tends to log(N).
In practice, at moderate to large sizes, a 2NxN division is about 2 to
4 times slower than an NxN multiplication.
-
-File: gmp.info, Node: Block-Wise Barrett Division, Next: Exact Division, Prev: Divide and Conquer Division, Up: Division Algorithms
-
-15.2.4 Block-Wise Barrett Division
-----------------------------------
-
-For the largest divisions, a block-wise Barrett division algorithm is
-used. Here, the divisor is inverted to a precision determined by the
-relative size of the dividend and divisor. Blocks of quotient limbs
-are then generated by multiplying blocks from the dividend by the
-inverse.
-
- Our block-wise algorithm computes a smaller inverse than in the
-plain Barrett algorithm. For a 2n/n division, the inverse will be just
-ceil(n/2) limbs.
+ Newton's method used for division is asymptotically O(M(N)) and
+should therefore be superior to divide and conquer, but it's believed
+this would only be for large to very large N.

-File: gmp.info, Node: Exact Division, Next: Exact Remainder, Prev: Block-Wise Barrett Division, Up: Division Algorithms
+File: gmp.info, Node: Exact Division, Next: Exact Remainder, Prev: Divide and Conquer Division, Up: Division Algorithms
-15.2.5 Exact Division
+16.2.4 Exact Division
---------------------
A so-called exact division is when the dividend is known to be an exact
@@ -7043,10 +6676,11 @@ Q*M-M*(M+1)/2, or when Q<=M to Q*(Q-1)/2. Notice the savings are
complementary. If Q is big then many divisions are saved, or if Q is
small then the crossproducts reduce to a small number.
- The modular inverse used is calculated efficiently by `binvert_limb'
-in `gmp-impl.h'. This does four multiplies for a 32-bit limb, or six
-for a 64-bit limb. `tune/modlinv.c' has some alternate implementations
-that might suit processors better at bit twiddling than multiplying.
+ The modular inverse used is calculated efficiently by
+`modlimb_invert' in `gmp-impl.h'. This does four multiplies for a
+32-bit limb, or six for a 64-bit limb. `tune/modlinv.c' has some
+alternate implementations that might suit processors better at bit
+twiddling than multiplying.
The sub-quadratic exact division described by Jebelean in "Exact
Division with Karatsuba Complexity" is not currently implemented. It
@@ -7066,8 +6700,364 @@ 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.
+
+File: gmp.info, Node: Exact Remainder, Next: Small Quotient Division, Prev: Exact Division, Up: Division Algorithms
+
+16.2.5 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.
+
+ `mpn_bdivmod', `mpn_divexact_by3', `mpn_modexact_1_odd' and the
+`redc' function in `mpz_powm' 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_bdivmod' in `mpn_gcd', and 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.
+
+
+File: gmp.info, Node: Small Quotient Division, Prev: Exact Remainder, Up: Division Algorithms
+
+16.2.6 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.
+
+
+File: gmp.info, Node: Greatest Common Divisor Algorithms, Next: Powering Algorithms, Prev: Division Algorithms, Up: Algorithms
+
+16.3 Greatest Common Divisor
+============================
+
+* Menu:
+
+* Binary GCD::
+* Lehmer's Algorithm::
+* Subquadratic GCD::
+* Extended GCD::
+* Jacobi Symbol::
+
+
+File: gmp.info, Node: Binary GCD, Next: Lehmer's Algorithm, Prev: Greatest Common Divisor Algorithms, Up: Greatest Common Divisor Algorithms
+
+16.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.
+
+
+File: gmp.info, Node: Lehmer's Algorithm, Next: Subquadratic GCD, Prev: Binary GCD, Up: Greatest Common Divisor Algorithms
+
+16.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 computing 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.
+
+
+
+File: gmp.info, Node: Subquadratic GCD, Next: Extended GCD, Prev: Lehmer's Algorithm, Up: Greatest Common Divisor Algorithms
+
+16.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 Scho"nhage's algorithm and subquadratic
+integer GCD computation" by Mo"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.
+
+
+File: gmp.info, Node: Extended GCD, Next: Jacobi Symbol, Prev: Subquadratic GCD, Up: Greatest Common Divisor Algorithms
+
+16.3.4 Extended GCD
+-------------------
+
+The extended GCD function, or GCDEXT, calculates gcd(a,b) and also
+cofactors x and y satisfying a*x+b*y=gcd(a,b). All the algorithms used
+for plain GCD are extended to handle this case. The binary algorithm is
+used only for single-limb GCDEXT. Lehmer's algorithm is used for sizes
+up to `GCDEXT_DC_THRESHOLD'. Above this threshold, GCDEXT is
+implemented as a loop around HGCD, but with more book-keeping to keep
+track of the cofactors. This gives the same asymptotic running time as
+for GCD and HGCD, O(M(N)*log(N))
+
+ One difference to plain GCD is that while the inputs a and b are
+reduced as the algorithm proceeds, the cofactors x and y grow in size.
+This makes the tuning of the chopping-point more difficult. The current
+code chops off the most significant half of the inputs for the call to
+HGCD in the first iteration, and the most significant two thirds for
+the remaining calls. This strategy could surely be improved. Also the
+stop condition for the loop, where Lehmer's algorithm is invoked once
+the inputs are reduced below `GCDEXT_DC_THRESHOLD', could maybe be
+improved by taking into account the current size of the cofactors.

-Local Variables:
-coding: iso-8859-1
-End:
+File: gmp.info, Node: Jacobi Symbol, Prev: Extended GCD, Up: Greatest Common Divisor Algorithms
+
+16.3.5 Jacobi Symbol
+--------------------
+
+`mpz_jacobi' and `mpz_kronecker' are currently implemented with a
+simple binary algorithm similar to that described for the GCDs (*note
+Binary GCD::). They're not very fast when both inputs are large.
+Lehmer's multi-step improvement or a binary based multi-step algorithm
+is likely to be better.
+
+ When one operand fits a single limb, and that includes
+`mpz_kronecker_ui' and friends, an initial reduction is done with
+either `mpn_mod_1' or `mpn_modexact_1_odd', followed by the binary
+algorithm on a single limb. The binary algorithm is well suited to a
+single limb, and the whole calculation in this case is quite efficient.
+
+ In all the routines sign changes for the result are accumulated
+using some bit twiddling, avoiding table lookups or conditional jumps.
+
+
+File: gmp.info, Node: Powering Algorithms, Next: Root Extraction Algorithms, Prev: Greatest Common Divisor Algorithms, Up: Algorithms
+
+16.4 Powering Algorithms
+========================
+
+* Menu:
+
+* Normal Powering Algorithm::
+* Modular Powering Algorithm::
+
+
+File: gmp.info, Node: Normal Powering Algorithm, Next: Modular Powering Algorithm, Prev: Powering Algorithms, Up: Powering Algorithms
+
+16.4.1 Normal Powering
+----------------------
+
+Normal `mpz' or `mpf' powering uses a simple binary algorithm,
+successively squaring and then multiplying by the base when a 1 bit is
+seen in the exponent, as per Knuth section 4.6.3. The "left to right"
+variant described there is used rather than algorithm A, since it's
+just as easy and can be done with somewhat less temporary memory.
+
+
+File: gmp.info, Node: Modular Powering Algorithm, Prev: Normal Powering Algorithm, Up: Powering Algorithms
+
+16.4.2 Modular Powering
+-----------------------
+
+Modular powering is implemented using a 2^k-ary sliding window
+algorithm, as per "Handbook of Applied Cryptography" algorithm 14.85
+(*note References::). k is chosen according to the size of the
+exponent. Larger exponents use larger values of k, the choice being
+made to minimize the average number of multiplications that must
+supplement the squaring.
+
+ The modular multiplies and squares use either a simple division or
+the REDC method by Montgomery (*note References::). REDC is a little
+faster, essentially saving N single limb divisions in a fashion similar
+to an exact remainder (*note Exact Remainder::). The current REDC has
+some limitations. It's only O(N^2) so above `POWM_THRESHOLD' division
+becomes faster and is used. It doesn't attempt to detect small bases,
+but rather always uses a REDC form, which is usually a full size
+operand. And lastly it's only applied to odd moduli.
+
+
+File: gmp.info, Node: Root Extraction Algorithms, Next: Radix Conversion Algorithms, Prev: Powering Algorithms, Up: Algorithms
+
+16.5 Root Extraction Algorithms
+===============================
+
+* Menu:
+
+* Square Root Algorithm::
+* Nth Root Algorithm::
+* Perfect Square Algorithm::
+* Perfect Power Algorithm::
+
diff --git a/gmp/doc/gmp.info-2 b/gmp/doc/gmp.info-2
index 9dd7c34407..a92b89ff4c 100644
--- a/gmp/doc/gmp.info-2
+++ b/gmp/doc/gmp.info-2
@@ -1,10 +1,12 @@
-This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.13 from
+This is ../../gmp/doc/gmp.info, produced by makeinfo version 4.8 from
../../gmp/doc/gmp.texi.
-This manual describes how to install and use the GNU multiple precision
-arithmetic library, version 6.0.0.
+ This manual describes how to install and use the GNU multiple
+precision arithmetic library, version 4.3.2.
- Copyright 1991, 1993-2014 Free Software Foundation, Inc.
+ Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000,
+2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009 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
@@ -12,7 +14,7 @@ document under the terms of the GNU Free Documentation License, Version
with no Invariant Sections, with the Front-Cover Texts being "A GNU
Manual", and with the Back-Cover Texts being "You have freedom to copy
and modify this GNU Manual, like GNU software". A copy of the license
-is included in *note GNU Free Documentation License::.
+is included in *Note GNU Free Documentation License::.
INFO-DIR-SECTION GNU libraries
START-INFO-DIR-ENTRY
@@ -20,368 +22,9 @@ START-INFO-DIR-ENTRY
END-INFO-DIR-ENTRY

-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.
-
-
-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.
-
-
-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::
-
-
-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.
-
-
-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.
-
-
-
-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.
-
-
-File: gmp.info, Node: Extended GCD, Next: Jacobi Symbol, Prev: Subquadratic GCD, Up: Greatest Common Divisor Algorithms
-
-15.3.4 Extended GCD
--------------------
-
-The extended GCD function, or GCDEXT, calculates gcd(a,b) and also
-cofactors x and y satisfying a*x+b*y=gcd(a,b). All the algorithms used
-for plain GCD are extended to handle this case. The binary algorithm is
-used only for single-limb GCDEXT. Lehmer's algorithm is used for sizes
-up to `GCDEXT_DC_THRESHOLD'. Above this threshold, GCDEXT is
-implemented as a loop around HGCD, but with more book-keeping to keep
-track of the cofactors. This gives the same asymptotic running time as
-for GCD and HGCD, O(M(N)*log(N))
-
- One difference to plain GCD is that while the inputs a and b are
-reduced as the algorithm proceeds, the cofactors x and y grow in size.
-This makes the tuning of the chopping-point more difficult. The current
-code chops off the most significant half of the inputs for the call to
-HGCD in the first iteration, and the most significant two thirds for
-the remaining calls. This strategy could surely be improved. Also the
-stop condition for the loop, where Lehmer's algorithm is invoked once
-the inputs are reduced below `GCDEXT_DC_THRESHOLD', could maybe be
-improved by taking into account the current size of the cofactors.
-
-
-File: gmp.info, Node: Jacobi Symbol, Prev: Extended GCD, Up: Greatest Common Divisor Algorithms
-
-15.3.5 Jacobi Symbol
---------------------
-
-[This section is obsolete. The current Jacobi code actually uses a very
-efficient algorithm.]
-
- `mpz_jacobi' and `mpz_kronecker' are currently implemented with a
-simple binary algorithm similar to that described for the GCDs (*note
-Binary GCD::). They're not very fast when both inputs are large.
-Lehmer's multi-step improvement or a binary based multi-step algorithm
-is likely to be better.
-
- When one operand fits a single limb, and that includes
-`mpz_kronecker_ui' and friends, an initial reduction is done with
-either `mpn_mod_1' or `mpn_modexact_1_odd', followed by the binary
-algorithm on a single limb. The binary algorithm is well suited to a
-single limb, and the whole calculation in this case is quite efficient.
-
- In all the routines sign changes for the result are accumulated
-using some bit twiddling, avoiding table lookups or conditional jumps.
-
-
-File: gmp.info, Node: Powering Algorithms, Next: Root Extraction Algorithms, Prev: Greatest Common Divisor Algorithms, Up: Algorithms
-
-15.4 Powering Algorithms
-========================
-
-* Menu:
-
-* Normal Powering Algorithm::
-* Modular Powering Algorithm::
-
-
-File: gmp.info, Node: Normal Powering Algorithm, Next: Modular Powering Algorithm, Prev: Powering Algorithms, Up: Powering Algorithms
-
-15.4.1 Normal Powering
-----------------------
-
-Normal `mpz' or `mpf' powering uses a simple binary algorithm,
-successively squaring and then multiplying by the base when a 1 bit is
-seen in the exponent, as per Knuth section 4.6.3. The "left to right"
-variant described there is used rather than algorithm A, since it's
-just as easy and can be done with somewhat less temporary memory.
-
-
-File: gmp.info, Node: Modular Powering Algorithm, Prev: Normal Powering Algorithm, Up: Powering Algorithms
-
-15.4.2 Modular Powering
------------------------
-
-Modular powering is implemented using a 2^k-ary sliding window
-algorithm, as per "Handbook of Applied Cryptography" algorithm 14.85
-(*note References::). k is chosen according to the size of the
-exponent. Larger exponents use larger values of k, the choice being
-made to minimize the average number of multiplications that must
-supplement the squaring.
-
- The modular multiplies and squarings use either a simple division or
-the REDC method by Montgomery (*note References::). REDC is a little
-faster, essentially saving N single limb divisions in a fashion similar
-to an exact remainder (*note Exact Remainder::).
-
-
-File: gmp.info, Node: Root Extraction Algorithms, Next: Radix Conversion Algorithms, Prev: Powering Algorithms, Up: Algorithms
-
-15.5 Root Extraction Algorithms
-===============================
-
-* Menu:
-
-* Square Root Algorithm::
-* Nth Root Algorithm::
-* Perfect Square Algorithm::
-* Perfect Power Algorithm::
-
-
File: gmp.info, Node: Square Root Algorithm, Next: Nth Root Algorithm, Prev: Root Extraction Algorithms, Up: Root Extraction Algorithms
-15.5.1 Square Root
+16.5.1 Square Root
------------------
Square roots are taken using the "Karatsuba Square Root" algorithm by
@@ -435,7 +78,7 @@ precision given by `mpf_sqrt_ui' is obtained by padding with zero limbs.

File: gmp.info, Node: Nth Root Algorithm, Next: Perfect Square Algorithm, Prev: Square Root Algorithm, Up: Root Extraction Algorithms
-15.5.2 Nth Root
+16.5.2 Nth Root
---------------
Integer Nth roots are taken using Newton's method with the following
@@ -455,7 +98,7 @@ particularly well optimized.

File: gmp.info, Node: Perfect Square Algorithm, Next: Perfect Power Algorithm, Prev: Nth Root Algorithm, Up: Root Extraction Algorithms
-15.5.3 Perfect Square
+16.5.3 Perfect Square
---------------------
A significant fraction of non-squares can be quickly identified by
@@ -488,7 +131,7 @@ don't become too big. `gen-psqr.c' does all the pre-calculations.
A square root must still be taken for any value that passes these
tests, to verify it's really a square and not one of the small fraction
-of non-squares that get through (i.e. a pseudo-square to all the tested
+of non-squares that get through (ie. a pseudo-square to all the tested
bases).
Clearly more residue tests could be done, `mpz_perfect_square_p' only
@@ -500,7 +143,7 @@ would affect such considerations.

File: gmp.info, Node: Perfect Power Algorithm, Prev: Perfect Square Algorithm, Up: Root Extraction Algorithms
-15.5.4 Perfect Power
+16.5.4 Perfect Power
--------------------
Detecting perfect powers is required by some factorization algorithms.
@@ -516,7 +159,7 @@ checked.

File: gmp.info, Node: Radix Conversion Algorithms, Next: Other Algorithms, Prev: Root Extraction Algorithms, Up: Algorithms
-15.6 Radix Conversion
+16.6 Radix Conversion
=====================
Radix conversions are less important than other algorithms. A program
@@ -531,7 +174,7 @@ representation.

File: gmp.info, Node: Binary to Radix, Next: Radix to Binary, Prev: Radix Conversion Algorithms, Up: Radix Conversion Algorithms
-15.6.1 Binary to Radix
+16.6.1 Binary to Radix
----------------------
Conversions from binary to a power-of-2 radix use a simple and fast
@@ -598,7 +241,7 @@ radix power.
Another possible improvement for the sub-quadratic part would be to
arrange for radix powers that balanced the sizes of quotient and
-remainder produced, i.e. the highest power would be an b^(n*k)
+remainder produced, ie. the highest power would be an b^(n*k)
approximately equal to sqrt(t), not restricted to a 2^i factor. That
ought to smooth out a graph of times against sizes, but may or may not
be a net speedup.
@@ -606,7 +249,7 @@ be a net speedup.

File: gmp.info, Node: Radix to Binary, Prev: Binary to Radix, Up: Radix Conversion Algorithms
-15.6.2 Radix to Binary
+16.6.2 Radix to Binary
----------------------
*This section needs to be rewritten, it currently describes the
@@ -651,7 +294,7 @@ or more).

File: gmp.info, Node: Other Algorithms, Next: Assembly Coding, Prev: Radix Conversion Algorithms, Up: Algorithms
-15.7 Other Algorithms
+16.7 Other Algorithms
=====================
* Menu:
@@ -666,7 +309,7 @@ File: gmp.info, Node: Other Algorithms, Next: Assembly Coding, Prev: Radix Co

File: gmp.info, Node: Prime Testing Algorithm, Next: Factorial Algorithm, Prev: Other Algorithms, Up: Other Algorithms
-15.7.1 Prime Testing
+16.7.1 Prime Testing
--------------------
The primality testing in `mpz_probab_prime_p' (*note Number Theoretic
@@ -692,64 +335,43 @@ for an arbitrary n.

File: gmp.info, Node: Factorial Algorithm, Next: Binomial Coefficients Algorithm, Prev: Prime Testing Algorithm, Up: Other Algorithms
-15.7.2 Factorial
+16.7.2 Factorial
----------------
-Factorials are calculated by a combination of two algorithms. An idea is
-shared among them: to compute the odd part of the factorial; a final
-step takes account of the power of 2 term, by shifting.
-
- For small n, the odd factor of n! is computed with the simple
-observation that it is equal to the product of all positive odd numbers
-smaller than n times the odd factor of [n/2]!, where [x] is the integer
-part of x, and so on recursively. The procedure can be best illustrated
+Factorials are calculated by a combination of removal of twos,
+powering, and binary splitting. The procedure can be best illustrated
with an example,
- 23! = (23.21.19.17.15.13.11.9.7.5.3)(11.9.7.5.3)(5.3)2^19
-
- Current code collects all the factors in a single list, with a loop
-and no recursion, and compute the product, with no special care for
-repeated chunks.
-
- When n is larger, computation pass trough prime sieving. An helper
-function is used, as suggested by Peter Luschny:
+ 23! = 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23
- n
- -----
- n! | | L(p,n)
- msf(n) = -------------- = | | p
- [n/2]!^2.2^k p=3
+has factors of two removed,
- Where p ranges on odd prime numbers. The exponent k is chosen to
-obtain an odd integer number: k is the number of 1 bits in the binary
-representation of [n/2]. The function L(p,n) can be defined as zero
-when p is composite, and, for any prime p, it is computed with:
+ 23! = 2^19.1.1.3.1.5.3.7.1.9.5.11.3.13.7.15.1.17.9.19.5.21.11.23
- ---
- \ n
- L(p,n) = / [---] mod 2 <= log (n) .
- --- p^i p
- i>0
+and the resulting terms collected up according to their multiplicity,
- With this helper function, we are able to compute the odd part of n!
-using the recursion implied by n!=[n/2]!^2*msf(n)*2^k. The recursion
-stops using the small-n algorithm on some [n/2^i].
+ 23! = 2^19.(3.5)^3.(7.9.11)^2.(13.15.17.19.21.23)
- Both the above algorithms use binary splitting to compute the
-product of many small factors. At first as many products as possible
-are accumulated in a single register, generating a list of factors that
-fit in a machine word. This list is then split into halves, and the
-product is computed recursively.
+ Each sequence such as 13.15.17.19.21.23 is evaluated by splitting
+into every second term, as for instance (13.17.21).(15.19.23), and the
+same recursively on each half. This is implemented iteratively using
+some bit twiddling.
Such splitting is more efficient than repeated Nx1 multiplies since
it forms big multiplies, allowing Karatsuba and higher algorithms to be
used. And even below the Karatsuba threshold a big block of work can
be more efficient for the basecase algorithm.
+ Splitting into subsequences of every second term keeps the resulting
+products more nearly equal in size than would the simpler approach of
+say taking the first half and second half of the sequence. Nearly
+equal products are more efficient for the current multiply
+implementation.
+

File: gmp.info, Node: Binomial Coefficients Algorithm, Next: Fibonacci Numbers Algorithm, Prev: Factorial Algorithm, Up: Other Algorithms
-15.7.3 Binomial Coefficients
+16.7.3 Binomial Coefficients
----------------------------
Binomial coefficients C(n,k) are calculated by first arranging k <= n/2
@@ -771,7 +393,7 @@ and n-k+i in general won't fit in a limb at all.

File: gmp.info, Node: Fibonacci Numbers Algorithm, Next: Lucas Numbers Algorithm, Prev: Binomial Coefficients Algorithm, Up: Other Algorithms
-15.7.4 Fibonacci Numbers
+16.7.4 Fibonacci Numbers
------------------------
The Fibonacci functions `mpz_fib_ui' and `mpz_fib2_ui' are designed for
@@ -818,15 +440,15 @@ formulas is used, according as n is odd or even.
F[2k+1] = (2F[k]+F[k-1])*(2F[k]-F[k-1]) + 2*(-1)^k
F[2k+1] here is the same as above, just rearranged to be a multiply.
-For interest, the 2*(-1)^k term both here and above can be applied just
-to the low limb of the calculation, without a carry or borrow into
+For interest, the 2*(-1)^k term both here and above can be applied
+just to the low limb of the calculation, without a carry or borrow into
further limbs, which saves some code size. See comments with
`mpz_fib_ui' and the internal `mpn_fib2_ui' for how this is done.

File: gmp.info, Node: Lucas Numbers Algorithm, Next: Random Number Algorithms, Prev: Fibonacci Numbers Algorithm, Up: Other Algorithms
-15.7.5 Lucas Numbers
+16.7.5 Lucas Numbers
--------------------
`mpz_lucnum2_ui' derives a pair of Lucas numbers from a pair of
@@ -849,7 +471,7 @@ Fibonacci numbers, similar to what `mpz_fib_ui' does.

File: gmp.info, Node: Random Number Algorithms, Prev: Lucas Numbers Algorithm, Up: Other Algorithms
-15.7.6 Random Numbers
+16.7.6 Random Numbers
---------------------
For the `urandomb' functions, random numbers are generated simply by
@@ -873,7 +495,7 @@ GMP.
Linear congruential generators are described in many text books, for
instance Knuth volume 2 (*note References::). With a modulus M and
-parameters A and C, an integer state S is iterated by the formula S <-
+parameters A and C, a integer state S is iterated by the formula S <-
A*S+C mod M. At each step the new state is a linear function of the
previous, mod M, hence the name of the generator.
@@ -893,7 +515,7 @@ the like.

File: gmp.info, Node: Assembly Coding, Prev: Other Algorithms, Up: Algorithms
-15.8 Assembly Coding
+16.8 Assembly Coding
====================
The assembly subroutines in GMP are the most significant source of
@@ -922,7 +544,7 @@ offers a speedup over generic C by a factor of anything from 2 to 10.

File: gmp.info, Node: Assembly Code Organisation, Next: Assembly Basics, Prev: Assembly Coding, Up: Assembly Coding
-15.8.1 Code Organisation
+16.8.1 Code Organisation
------------------------
The various `mpn' subdirectories contain machine-dependent code, written
@@ -944,7 +566,7 @@ given CPU.

File: gmp.info, Node: Assembly Basics, Next: Assembly Carry Propagation, Prev: Assembly Code Organisation, Up: Assembly Coding
-15.8.2 Assembly Basics
+16.8.2 Assembly Basics
----------------------
`mpn_addmul_1' and `mpn_submul_1' are the most important routines for
@@ -968,7 +590,7 @@ vector processor, depending on the carry handling.

File: gmp.info, Node: Assembly Carry Propagation, Next: Assembly Cache Handling, Prev: Assembly Basics, Up: Assembly Coding
-15.8.3 Carry Propagation
+16.8.3 Carry Propagation
------------------------
The problem that presents most challenges in GMP is propagating carries
@@ -1005,7 +627,7 @@ results.

File: gmp.info, Node: Assembly Cache Handling, Next: Assembly Functional Units, Prev: Assembly Carry Propagation, Up: Assembly Coding
-15.8.4 Cache Handling
+16.8.4 Cache Handling
---------------------
GMP aims to perform well both on operands that fit entirely in L1 cache
@@ -1051,7 +673,7 @@ life easy.

File: gmp.info, Node: Assembly Functional Units, Next: Assembly Floating Point, Prev: Assembly Cache Handling, Up: Assembly Coding
-15.8.5 Functional Units
+16.8.5 Functional Units
-----------------------
When choosing an approach for an assembly loop, consideration is given
@@ -1087,7 +709,7 @@ using bit twiddling.

File: gmp.info, Node: Assembly Floating Point, Next: Assembly SIMD Instructions, Prev: Assembly Functional Units, Up: Assembly Coding
-15.8.6 Floating Point
+16.8.6 Floating Point
---------------------
Floating point arithmetic is used in GMP for multiplications on CPUs
@@ -1184,7 +806,7 @@ limb, generating a low 64-bit result limb and a high 33-bit carry limb

File: gmp.info, Node: Assembly SIMD Instructions, Next: Assembly Software Pipelining, Prev: Assembly Floating Point, Up: Assembly Coding
-15.8.7 SIMD Instructions
+16.8.7 SIMD Instructions
------------------------
The single-instruction multiple-data support in current microprocessors
@@ -1205,7 +827,7 @@ the P55 `mpn_mul_1'. SSE2 is used for Pentium 4 `mpn_mul_1',

File: gmp.info, Node: Assembly Software Pipelining, Next: Assembly Loop Unrolling, Prev: Assembly SIMD Instructions, Up: Assembly Coding
-15.8.8 Software Pipelining
+16.8.8 Software Pipelining
--------------------------
Software pipelining consists of scheduling instructions around the
@@ -1230,7 +852,7 @@ to use while another (or multiple others) are still in progress.

File: gmp.info, Node: Assembly Loop Unrolling, Next: Assembly Writing Guide, Prev: Assembly Software Pipelining, Up: Assembly Coding
-15.8.9 Loop Unrolling
+16.8.9 Loop Unrolling
---------------------
Loop unrolling consists of replicating code so that several limbs are
@@ -1277,7 +899,7 @@ ways, for example

File: gmp.info, Node: Assembly Writing Guide, Prev: Assembly Loop Unrolling, Up: Assembly Coding
-15.8.10 Writing Guide
+16.8.10 Writing Guide
---------------------
This is a guide to writing software pipelined loops for processing limb
@@ -1336,7 +958,7 @@ sizes.

File: gmp.info, Node: Internals, Next: Contributors, Prev: Algorithms, Up: Top
-16 Internals
+17 Internals
************
*This chapter is provided only for informational purposes and the
@@ -1355,7 +977,7 @@ only the documented interfaces described in previous chapters.*

File: gmp.info, Node: Integer Internals, Next: Rational Internals, Prev: Internals, Up: Internals
-16.1 Integer Internals
+17.1 Integer Internals
======================
`mpz_t' variables represent integers using sign and magnitude, in space
@@ -1405,7 +1027,7 @@ providing plenty of range.

File: gmp.info, Node: Rational Internals, Next: Float Internals, Prev: Integer Internals, Up: Internals
-16.2 Rational Internals
+17.2 Rational Internals
=======================
`mpq_t' variables represent rationals using an `mpz_t' numerator and
@@ -1424,7 +1046,7 @@ GCDs necessary, not four.
This general approach to common factors is badly sub-optimal in the
presence of simple factorizations or little prospect for cancellation,
-but GMP has no way to know when this will occur. As per *note
+but GMP has no way to know when this will occur. As per *Note
Efficiency::, that's left to applications. The `mpq_t' framework might
still suit, with `mpq_numref' and `mpq_denref' for direct access to the
numerator and denominator, or of course `mpz_t' variables can be used
@@ -1433,7 +1055,7 @@ directly.

File: gmp.info, Node: Float Internals, Next: Raw Output Internals, Prev: Rational Internals, Up: Internals
-16.3 Float Internals
+17.3 Float Internals
====================
Efficient calculation is the primary aim of GMP floats and the use of
@@ -1597,7 +1219,7 @@ Application Precisions

File: gmp.info, Node: Raw Output Internals, Next: C++ Interface Internals, Prev: Float Internals, Up: Internals
-16.4 Raw Output Internals
+17.4 Raw Output Internals
=========================
`mpz_out_raw' uses the following format.
@@ -1627,7 +1249,7 @@ can just read and write `_mp_d'.

File: gmp.info, Node: C++ Interface Internals, Prev: Raw Output Internals, Up: Internals
-16.5 C++ Interface Internals
+17.5 C++ Interface Internals
============================
A system of expression templates is used to ensure something like
@@ -1645,10 +1267,7 @@ object" evaluating it,
struct __gmp_binary_plus
{
- static void eval(mpf_t f, const mpf_t g, const mpf_t h)
- {
- mpf_add(f, g, h);
- }
+ static void eval(mpf_t f, mpf_t g, mpf_t h) { mpf_add(f, g, h); }
};
And an "additive expression" object,
@@ -1676,7 +1295,7 @@ type. In fact even `mpf_class' etc are `typedef' specializations of
template <class Op>
void __gmp_expr<__gmp_binary_expr<mpf_class, mpf_class, Op> >::eval
- (mpf_t f, mp_bitcnt_t precision)
+ (mpf_t f, unsigned long int precision)
{
Op::eval(f, expr.val1.get_mpf_t(), expr.val2.get_mpf_t());
}
@@ -1708,7 +1327,7 @@ subexpressions as their arguments, like this:
template <class T, class U, class Op>
void __gmp_expr
<__gmp_binary_expr<__gmp_expr<T>, __gmp_expr<U>, Op> >::eval
- (mpf_t f, mp_bitcnt_t precision)
+ (mpf_t f, unsigned long int precision)
{
// declare two temporaries
mpf_class temp1(expr.val1, precision), temp2(expr.val2, precision);
@@ -1724,12 +1343,12 @@ File: gmp.info, Node: Contributors, Next: References, Prev: Internals, Up: T
Appendix A Contributors
***********************
-Torbjörn Granlund wrote the original GMP library and is still the main
+Torbjo"rn Granlund wrote the original GMP library and is still the main
developer. Code not explicitly attributed to others, was contributed by
-Torbjörn. Several other individuals and organizations have contributed
+Torbjo"rn. Several other individuals and organizations have contributed
GMP. Here is a list in chronological order on first contribution:
- Gunnar Sjödin and Hans Riesel helped with mathematical problems in
+ Gunnar Sjo"din and Hans Riesel helped with mathematical problems in
early versions of the library.
Richard Stallman helped with the interface design and revised the
@@ -1742,17 +1361,16 @@ the library and made creative suggestions.
`mpz_probab_prime_p'.
Paul Zimmermann wrote the REDC-based mpz_powm code, the
-Schönhage-Strassen FFT multiply code, and the Karatsuba square root
+Scho"nhage-Strassen FFT multiply code, and the Karatsuba square root
code. He also improved the Toom3 code for GMP 4.2. Paul sparked the
development of GMP 2, with his comparisons between bignum packages.
The ECMNET project Paul is organizing was a driving force behind many
of the optimizations in GMP 3. Paul also wrote the new GMP 4.3 nth
-root code (with Torbjörn).
+root code (with Torbjo"rn).
Ken Weber (Kent State University, Universidade Federal do Rio Grande
-do Sul) contributed now defunct versions of `mpz_gcd', `mpz_divexact',
-`mpn_gcd', and `mpn_bdivmod', partially supported by CNPq (Brazil)
-grant 301314194-2.
+do Sul) contributed `mpz_gcd', `mpz_divexact', `mpn_gcd', and
+`mpn_bdivmod', partially supported by CNPq (Brazil) grant 301314194-2.
Per Bothner of Cygnus Support helped to set up GMP to use Cygnus'
configure. He has also made valuable suggestions and tested numerous
@@ -1800,48 +1418,20 @@ elsewhere.
Pedro Gimeno implemented the Mersenne Twister and made other random
number improvements.
- Niels Möller wrote the sub-quadratic GCD, extended GCD and jacobi
-code, the quadratic Hensel division code, and (with Torbjörn) the new
-divide and conquer division code for GMP 4.3. Niels also helped
-implement the new Toom multiply code for GMP 4.3 and implemented helper
-functions to simplify Toom evaluations for GMP 5.0. He wrote the
-original version of mpn_mulmod_bnm1, and he is the main author of the
-mini-gmp package used for gmp bootstrapping.
+ Niels Mo"ller wrote the sub-quadratic GCD and extended GCD code, the
+quadratic Hensel division code, and (with Torbjo"rn) the new divide and
+conquer division code for GMP 4.3. Niels also helped implement the new
+Toom multiply code for GMP 4.3.
Alberto Zanoni and Marco Bodrato suggested the unbalanced multiply
strategy, and found the optimal strategies for evaluation and
-interpolation in Toom multiplication.
-
- Marco Bodrato helped implement the new Toom multiply code for GMP
-4.3 and implemented most of the new Toom multiply and squaring code for
-5.0. He is the main author of the current mpn_mulmod_bnm1 and
-mpn_mullo_n. Marco also wrote the functions mpn_invert and
-mpn_invertappr. He is the author of the current combinatorial
-functions: binomial, factorial, multifactorial, primorial.
+interpolation in Toom multiplication. Marco also helped implement the
+new Toom multiply code for GMP 4.3.
David Harvey suggested the internal function `mpn_bdiv_dbm1',
implementing division relevant to Toom multiplication. He also worked
on fast assembly sequences, in particular on a fast AMD64
-`mpn_mul_basecase'. He wrote the internal middle product functions
-`mpn_mulmid_basecase', `mpn_toom42_mulmid', `mpn_mulmid_n' and related
-helper routines.
-
- Martin Boij wrote `mpn_perfect_power_p'.
-
- Marc Glisse improved `gmpxx.h': use fewer temporaries (faster),
-specializations of `numeric_limits' and `common_type', C++11 features
-(move constructors, explicit bool conversion, UDL), make the conversion
-from `mpq_class' to `mpz_class' explicit, optimize 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 `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.
+`mpn_mul_basecase'.
(This list is chronological, not ordered after significance. If you
have contributed to GMP but are not listed above, please tell
@@ -1851,11 +1441,8 @@ 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.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.
+ The development of GMP 2, 3, and 4 was supported in part by the IDA
+Center for Computing Sciences.
Thanks go to Hans Thorsen for donating an SGI system for the GMP
test system environment.
@@ -1875,7 +1462,7 @@ B.1 Books
* Richard Crandall and Carl Pomerance, "Prime Numbers: A
Computational Perspective", 2nd edition, Springer-Verlag, 2005.
- `http://www.math.dartmouth.edu/~carlp/'
+ `http://math.dartmouth.edu/~carlp/'
* Henri Cohen, "A Course in Computational Algebraic Number Theory",
Graduate Texts in Mathematics number 138, Springer-Verlag, 1993.
@@ -1894,8 +1481,8 @@ B.1 Books
* Richard M. Stallman and the GCC Developer Community, "Using the
GNU Compiler Collection", Free Software Foundation, 2008,
- available online `https://gcc.gnu.org/onlinedocs/', and in the GCC
- package `https://ftp.gnu.org/gnu/gcc/'
+ available online `http://gcc.gnu.org/onlinedocs/', and in the GCC
+ package `ftp://ftp.gnu.org/gnu/gcc/'
B.2 Papers
==========
@@ -1903,23 +1490,22 @@ B.2 Papers
* Yves Bertot, Nicolas Magaud and Paul Zimmermann, "A Proof of GMP
Square Root", Journal of Automated Reasoning, volume 29, 2002, pp.
225-252. Also available online as INRIA Research Report 4475,
- June 2002, `http://hal.inria.fr/docs/00/07/21/13/PDF/RR-4475.pdf'
+ June 2001, `http://www.inria.fr/rrrt/rr-4475.html'
* Christoph Burnikel and Joachim Ziegler, "Fast Recursive Division",
Max-Planck-Institut fuer Informatik Research Report MPI-I-98-1-022,
`http://data.mpi-sb.mpg.de/internet/reports.nsf/NumberView/1998-1-022'
- * Torbjörn Granlund and Peter L. Montgomery, "Division by Invariant
+ * Torbjo"rn Granlund and Peter L. Montgomery, "Division by Invariant
Integers using Multiplication", in Proceedings of the SIGPLAN
PLDI'94 Conference, June 1994. Also available
- `https://gmplib.org/~tege/divcnst-pldi94.pdf'.
+ `ftp://ftp.cwi.nl/pub/pmontgom/divcnst.psa4.gz' (and .psl.gz).
- * Niels Möller and Torbjörn Granlund, "Improved division by invariant
- integers", IEEE Transactions on Computers, 11 June 2010.
- `https://gmplib.org/~tege/division-paper.pdf'
+ * Niels M"oller and Torbjo"rn Granlund, "Improved division by
+ invariant integers", to appear.
- * Torbjörn Granlund and Niels Möller, "Division of integers large and
- small", to appear.
+ * Torbjo"rn Granlund and Niels M"oller, "Division of integers large
+ and small", to appear.
* Tudor Jebelean, "An algorithm for exact division", Journal of
Symbolic Computation, volume 15, 1993, pp. 169-180. Research
@@ -1962,7 +1548,7 @@ B.2 Papers
Modular Transforms", Journal of Computer and System Sciences,
volume 8, number 3, June 1974, pp. 366-386.
- * Niels Möller, "On Schönhage's algorithm and subquadratic integer
+ * Niels Mo"ller, "On Scho"nhage's algorithm and subquadratic integer
GCD computation", in Mathematics of Computation, volume 77,
January 2008, pp. 589-607.
@@ -1970,7 +1556,7 @@ B.2 Papers
Division", in Mathematics of Computation, volume 44, number 170,
April 1985.
- * Arnold Schönhage and Volker Strassen, "Schnelle Multiplikation
+ * Arnold Scho"nhage and Volker Strassen, "Schnelle Multiplikation
grosser Zahlen", Computing 7, 1971, pp. 281-292.
* Kenneth Weber, "The accelerated integer GCD algorithm", ACM
@@ -1978,8 +1564,7 @@ B.2 Papers
1995, pp. 111-122.
* Paul Zimmermann, "Karatsuba Square Root", INRIA Research Report
- 3805, November 1999,
- `http://hal.inria.fr/inria-00072854/PDF/RR-3805.pdf'
+ 3805, November 1999, `http://www.inria.fr/rrrt/rr-3805.html'
* Paul Zimmermann, "A Proof of GMP Fast Division and Square Root
Implementations",
@@ -1999,7 +1584,7 @@ Appendix C GNU Free Documentation License
Version 1.3, 3 November 2008
- Copyright (C) 2000-2002, 2007, 2008 Free Software Foundation, Inc.
+ Copyright (C) 2000, 2001, 2002, 2007, 2008 Free Software Foundation, Inc.
`http://fsf.org/'
Everyone is permitted to copy and distribute verbatim copies
@@ -2400,7 +1985,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
- `https://www.gnu.org/copyleft/'.
+ `http://www.gnu.org/copyleft/'.
Each version of the License is given a distinguishing version
number. If the Document specifies that a particular numbered
@@ -2489,40 +2074,42 @@ Concept Index
* #include: Headers and Libraries.
(line 6)
* --build: Build Options. (line 52)
-* --disable-fft: Build Options. (line 313)
+* --disable-fft: Build Options. (line 317)
* --disable-shared: Build Options. (line 45)
* --disable-static: Build Options. (line 45)
-* --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)
+* --enable-alloca: Build Options. (line 278)
+* --enable-assert: Build Options. (line 327)
+* --enable-cxx: Build Options. (line 230)
+* --enable-fat: Build Options. (line 164)
+* --enable-mpbsd: Build Options. (line 322)
+* --enable-profiling <1>: Profiling. (line 6)
+* --enable-profiling: Build Options. (line 331)
* --exec-prefix: Build Options. (line 32)
* --host: Build Options. (line 66)
* --prefix: Build Options. (line 32)
* -finstrument-functions: Profiling. (line 66)
* 2exp functions: Efficiency. (line 43)
* 68000: Notes for Particular Systems.
- (line 94)
+ (line 85)
* 80x86: Notes for Particular Systems.
- (line 150)
-* ABI <1>: Build Options. (line 168)
+ (line 131)
+* ABI <1>: Build Options. (line 171)
* ABI: ABI and ISA. (line 6)
-* About this manual: Introduction to GMP. (line 57)
+* About this manual: Introduction to GMP. (line 58)
* AC_CHECK_LIB: Autoconf. (line 11)
-* AIX <1>: Notes for Particular Systems.
+* AIX <1>: ABI and ISA. (line 184)
+* AIX <2>: Notes for Particular Systems.
(line 7)
-* AIX: ABI and ISA. (line 178)
+* AIX: ABI and ISA. (line 169)
* Algorithms: Algorithms. (line 6)
-* alloca: Build Options. (line 274)
+* alloca: Build Options. (line 278)
* Allocation of memory: Custom Allocation. (line 6)
* AMD64: ABI and ISA. (line 44)
-* Anonymous FTP of latest version: Introduction to GMP. (line 37)
+* Anonymous FTP of latest version: Introduction to GMP. (line 38)
* Application Binary Interface: ABI and ISA. (line 6)
-* Arithmetic functions <1>: Rational Arithmetic. (line 6)
-* Arithmetic functions <2>: Float Arithmetic. (line 6)
-* Arithmetic functions: Integer Arithmetic. (line 6)
+* Arithmetic functions <1>: Float Arithmetic. (line 6)
+* Arithmetic functions <2>: Integer Arithmetic. (line 6)
+* Arithmetic functions: Rational Arithmetic. (line 6)
* ARM: Notes for Particular Systems.
(line 20)
* Assembly cache handling: Assembly Cache Handling.
@@ -2543,31 +2130,37 @@ Concept Index
* Assembly writing guide: Assembly Writing Guide.
(line 6)
* Assertion checking <1>: Debugging. (line 79)
-* Assertion checking: Build Options. (line 319)
-* Assignment functions <1>: Assigning Integers. (line 6)
+* Assertion checking: Build Options. (line 327)
+* Assignment functions <1>: Assigning Floats. (line 6)
* Assignment functions <2>: Initializing Rationals.
(line 6)
-* Assignment functions <3>: Simultaneous Float Init & Assign.
+* Assignment functions <3>: Simultaneous Integer Init & Assign.
(line 6)
-* Assignment functions <4>: Simultaneous Integer Init & Assign.
+* Assignment functions <4>: Simultaneous Float Init & Assign.
(line 6)
-* Assignment functions: Assigning Floats. (line 6)
+* Assignment functions: Assigning Integers. (line 6)
* Autoconf: Autoconf. (line 6)
* Basics: GMP Basics. (line 6)
+* Berkeley MP compatible functions <1>: Build Options. (line 322)
+* Berkeley MP compatible functions: BSD Compatible Functions.
+ (line 6)
* Binomial coefficient algorithm: Binomial Coefficients Algorithm.
(line 6)
* Binomial coefficient functions: Number Theoretic Functions.
- (line 128)
+ (line 101)
* Binutils strip: Known Build Problems.
(line 28)
* Bit manipulation functions: Integer Logic and Bit Fiddling.
(line 6)
* Bit scanning functions: Integer Logic and Bit Fiddling.
(line 40)
-* Bit shift left: Integer Arithmetic. (line 38)
-* Bit shift right: Integer Division. (line 62)
+* Bit shift left: Integer Arithmetic. (line 36)
+* Bit shift right: Integer Division. (line 59)
* Bits per limb: Useful Macros and Constants.
(line 7)
+* BSD MP compatible functions <1>: Build Options. (line 322)
+* BSD MP compatible functions: BSD Compatible Functions.
+ (line 6)
* Bug reporting: Reporting Bugs. (line 6)
* Build directory: Build Options. (line 19)
* Build notes for binary packaging: Notes for Package Builds.
@@ -2580,18 +2173,18 @@ Concept Index
* Build system: Build Options. (line 52)
* Building GMP: Installing GMP. (line 6)
* Bus error: Debugging. (line 7)
-* C compiler: Build Options. (line 179)
-* C++ compiler: Build Options. (line 250)
+* C compiler: Build Options. (line 182)
+* C++ compiler: Build Options. (line 254)
* 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 226)
-* CC: Build Options. (line 179)
-* CC_FOR_BUILD: Build Options. (line 213)
-* CFLAGS: Build Options. (line 179)
+* C++ support: Build Options. (line 230)
+* CC: Build Options. (line 182)
+* CC_FOR_BUILD: Build Options. (line 217)
+* CFLAGS: Build Options. (line 182)
* Checker: Debugging. (line 115)
* checkergcc: Debugging. (line 122)
* Code organisation: Assembly Code Organisation.
@@ -2599,14 +2192,14 @@ Concept Index
* Compaq C++: Notes for Particular Systems.
(line 25)
* Comparison functions <1>: Integer Comparisons. (line 6)
-* Comparison functions <2>: Float Comparison. (line 6)
-* Comparison functions: Comparing Rationals. (line 6)
+* Comparison functions <2>: Comparing Rationals. (line 6)
+* Comparison functions: Float Comparison. (line 6)
* Compatibility with older versions: Compatibility with older versions.
(line 6)
* Conditions for copying GNU MP: Copying. (line 6)
* Configuring GMP: Installing GMP. (line 6)
* Congruence algorithm: Exact Remainder. (line 30)
-* Congruence functions: Integer Division. (line 137)
+* Congruence functions: Integer Division. (line 131)
* Constants: Useful Macros and Constants.
(line 6)
* Contributors: Contributors. (line 6)
@@ -2619,16 +2212,15 @@ Concept Index
* Conversion functions: Rational Conversions.
(line 6)
* Copying conditions: Copying. (line 6)
-* CPPFLAGS: Build Options. (line 205)
+* CPPFLAGS: Build Options. (line 208)
* 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 250)
-* CXXFLAGS: Build Options. (line 250)
+* CXX: Build Options. (line 254)
+* CXXFLAGS: Build Options. (line 254)
* Cygwin: Notes for Particular Systems.
- (line 57)
+ (line 48)
* Darwin: Known Build Problems.
(line 51)
* Debugging: Debugging. (line 6)
@@ -2637,56 +2229,56 @@ Concept Index
* Digits in an integer: Miscellaneous Integer Functions.
(line 23)
* Divisibility algorithm: Exact Remainder. (line 30)
-* Divisibility functions: Integer Division. (line 137)
+* Divisibility functions: Integer Division. (line 131)
* Divisibility testing: Efficiency. (line 91)
* Division algorithms: Division Algorithms. (line 6)
-* Division functions <1>: Rational Arithmetic. (line 24)
+* Division functions <1>: Rational Arithmetic. (line 23)
* Division functions <2>: Integer Division. (line 6)
* Division functions: Float Arithmetic. (line 33)
* DJGPP <1>: Notes for Particular Systems.
- (line 57)
+ (line 48)
* DJGPP: Known Build Problems.
(line 18)
* DLLs: Notes for Particular Systems.
- (line 70)
-* DocBook: Build Options. (line 346)
-* Documentation formats: Build Options. (line 339)
+ (line 61)
+* DocBook: Build Options. (line 354)
+* Documentation formats: Build Options. (line 347)
* Documentation license: GNU Free Documentation License.
(line 6)
-* DVI: Build Options. (line 342)
+* DVI: Build Options. (line 350)
* Efficiency: Efficiency. (line 6)
* Emacs: Emacs. (line 6)
-* Exact division functions: Integer Division. (line 112)
+* Exact division functions: Integer Division. (line 108)
* Exact remainder: Exact Remainder. (line 6)
* Example programs: Demonstration Programs.
(line 6)
* Exec prefix: Build Options. (line 32)
-* Execution profiling <1>: Build Options. (line 323)
-* Execution profiling: Profiling. (line 6)
+* Execution profiling <1>: Profiling. (line 6)
+* Execution profiling: Build Options. (line 331)
* 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 15)
+ (line 21)
* Extended GCD: Number Theoretic Functions.
- (line 49)
+ (line 45)
* Factor removal functions: Number Theoretic Functions.
- (line 108)
+ (line 91)
* Factorial algorithm: Factorial Algorithm. (line 6)
* Factorial functions: Number Theoretic Functions.
- (line 116)
+ (line 96)
* Factorization demo: Demonstration Programs.
(line 25)
* Fast Fourier Transform: FFT Multiplication. (line 6)
-* Fat binary: Build Options. (line 161)
+* Fat binary: Build Options. (line 164)
* FFT multiplication <1>: FFT Multiplication. (line 6)
-* FFT multiplication: Build Options. (line 313)
+* FFT multiplication: Build Options. (line 317)
* Fibonacci number algorithm: Fibonacci Numbers Algorithm.
(line 6)
* Fibonacci sequence functions: Number Theoretic Functions.
- (line 136)
+ (line 109)
* Float arithmetic functions: Float Arithmetic. (line 6)
* Float assignment functions <1>: Simultaneous Float Init & Assign.
(line 6)
@@ -2695,9 +2287,9 @@ Concept Index
* Float conversion functions: Converting Floats. (line 6)
* Float functions: Floating-point Functions.
(line 6)
-* Float initialization functions <1>: Simultaneous Float Init & Assign.
+* Float initialization functions <1>: Initializing Floats. (line 6)
+* Float initialization functions: Simultaneous Float Init & Assign.
(line 6)
-* Float initialization functions: Initializing Floats. (line 6)
* Float input and output functions: I/O of Floats. (line 6)
* Float internals: Float Internals. (line 6)
* Float miscellaneous functions: Miscellaneous Float Functions.
@@ -2706,7 +2298,7 @@ Concept Index
(line 27)
* Float rounding functions: Miscellaneous Float Functions.
(line 9)
-* Float sign tests: Float Comparison. (line 35)
+* Float sign tests: Float Comparison. (line 33)
* Floating point mode: Notes for Particular Systems.
(line 34)
* Floating-point functions: Floating-point Functions.
@@ -2718,22 +2310,20 @@ 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 37)
+* frexp <1>: Converting Integers. (line 42)
+* frexp: Converting Floats. (line 23)
+* FTP of latest version: Introduction to GMP. (line 38)
* Function classes: Function Classes. (line 6)
* FunctionCheck: Profiling. (line 77)
* GCC Checker: Debugging. (line 115)
* GCD algorithms: Greatest Common Divisor Algorithms.
(line 6)
* GCD extended: Number Theoretic Functions.
- (line 49)
+ (line 45)
* GCD functions: Number Theoretic Functions.
- (line 32)
+ (line 30)
* GDB: Debugging. (line 58)
-* Generic C: Build Options. (line 152)
+* Generic C: Build Options. (line 153)
* GMP Perl module: Demonstration Programs.
(line 35)
* GMP version number: Useful Macros and Constants.
@@ -2751,45 +2341,45 @@ Concept Index
* Greatest common divisor algorithms: Greatest Common Divisor Algorithms.
(line 6)
* Greatest common divisor functions: Number Theoretic Functions.
- (line 32)
+ (line 30)
* Hardware floating point mode: Notes for Particular Systems.
(line 34)
* Headers: Headers and Libraries.
(line 6)
* Heap problems: Debugging. (line 24)
-* Home page: Introduction to GMP. (line 33)
+* Home page: Introduction to GMP. (line 34)
* Host system: Build Options. (line 66)
-* HP-UX: ABI and ISA. (line 77)
-* HPPA: ABI and ISA. (line 77)
+* HP-UX: ABI and ISA. (line 68)
+* HPPA: ABI and ISA. (line 68)
* 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 150)
-* IA-64: ABI and ISA. (line 116)
+ (line 131)
+* IA-64: ABI and ISA. (line 107)
* 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>: Initializing Floats. (line 6)
-* Initialization functions <2>: Random State Initialization.
+* Initialization functions <1>: Random State Initialization.
(line 6)
-* Initialization functions <3>: Simultaneous Float Init & Assign.
+* Initialization functions <2>: Initializing Rationals.
(line 6)
-* Initialization functions <4>: Simultaneous Integer Init & Assign.
+* Initialization functions <3>: Initializing Integers.
(line 6)
-* Initialization functions <5>: Initializing Rationals.
+* Initialization functions <4>: Simultaneous Float Init & Assign.
(line 6)
-* Initialization functions: Initializing Integers.
+* Initialization functions <5>: Initializing Floats. (line 6)
+* Initialization functions: Simultaneous Integer Init & Assign.
(line 6)
* Initializing and clearing: Efficiency. (line 21)
-* Input functions <1>: Formatted Input Functions.
+* Input functions <1>: I/O of Rationals. (line 6)
+* Input functions <2>: I/O of Floats. (line 6)
+* Input functions <3>: I/O of Integers. (line 6)
+* Input functions: Formatted Input Functions.
(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)
@@ -2812,9 +2402,9 @@ Concept Index
* Integer functions: Integer Functions. (line 6)
* Integer import: Integer Import and Export.
(line 11)
-* Integer initialization functions <1>: Initializing Integers.
+* Integer initialization functions <1>: Simultaneous Integer Init & Assign.
(line 6)
-* Integer initialization functions: Simultaneous Integer Init & Assign.
+* Integer initialization functions: Initializing Integers.
(line 6)
* Integer input and output functions: I/O of Integers. (line 6)
* Integer internals: Integer Internals. (line 6)
@@ -2829,33 +2419,33 @@ Concept Index
* Integer special functions: Integer Special Functions.
(line 6)
* Interix: Notes for Particular Systems.
- (line 65)
+ (line 56)
* Internals: Internals. (line 6)
* Introduction: Introduction to GMP. (line 6)
* Inverse modulo functions: Number Theoretic Functions.
- (line 76)
-* IRIX <1>: ABI and ISA. (line 141)
+ (line 60)
+* IRIX <1>: ABI and ISA. (line 132)
* IRIX: Known Build Problems.
(line 38)
* ISA: ABI and ISA. (line 6)
* istream input: C++ Formatted Input. (line 6)
* Jacobi symbol algorithm: Jacobi Symbol. (line 6)
* Jacobi symbol functions: Number Theoretic Functions.
- (line 83)
+ (line 66)
* Karatsuba multiplication: Karatsuba Multiplication.
(line 6)
* Karatsuba square root algorithm: Square Root Algorithm.
(line 6)
* Kronecker symbol functions: Number Theoretic Functions.
- (line 95)
+ (line 78)
* Language bindings: Language Bindings. (line 6)
-* Latest version of GMP: Introduction to GMP. (line 37)
+* Latest version of GMP: Introduction to GMP. (line 38)
* LCM functions: Number Theoretic Functions.
- (line 70)
+ (line 55)
* Least common multiple functions: Number Theoretic Functions.
- (line 70)
+ (line 55)
* Legendre symbol functions: Number Theoretic Functions.
- (line 86)
+ (line 69)
* libgmp: Headers and Libraries.
(line 22)
* libgmpxx: Headers and Libraries.
@@ -2880,14 +2470,15 @@ 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)
+ (line 120)
+* MacOS 9: Notes for Particular Systems.
+ (line 43)
* MacOS X: Known Build Problems.
(line 51)
-* Mailing lists: Introduction to GMP. (line 44)
+* Mailing lists: Introduction to GMP. (line 45)
* Malloc debugger: Debugging. (line 30)
* Malloc problems: Debugging. (line 24)
* Memory allocation: Custom Allocation. (line 6)
@@ -2897,34 +2488,34 @@ Concept Index
* Mersenne twister random numbers: Random State Initialization.
(line 13)
* MINGW: Notes for Particular Systems.
- (line 57)
-* MIPS: ABI and ISA. (line 141)
+ (line 48)
+* MIPS: ABI and ISA. (line 132)
* Miscellaneous float functions: Miscellaneous Float Functions.
(line 6)
* Miscellaneous integer functions: Miscellaneous Integer Functions.
(line 6)
* MMX: Notes for Particular Systems.
- (line 156)
+ (line 137)
* Modular inverse functions: Number Theoretic Functions.
- (line 76)
+ (line 60)
* Most significant bit: Miscellaneous Integer Functions.
(line 34)
-* MPN_PATH: Build Options. (line 327)
+* mp.h: BSD Compatible Functions.
+ (line 21)
+* MPN_PATH: Build Options. (line 335)
* MS Windows: Notes for Particular Systems.
- (line 57)
+ (line 48)
* MS-DOS: Notes for Particular Systems.
- (line 57)
+ (line 48)
* Multi-threading: Reentrancy. (line 6)
* Multiplication algorithms: Multiplication Algorithms.
(line 6)
-* Nails: Low-level Functions. (line 664)
+* Nails: Low-level Functions. (line 434)
* 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.
- (line 25)
+ (line 23)
* Nomenclature: Nomenclature and Types.
(line 6)
* Non-Unix systems: Build Options. (line 11)
@@ -2937,17 +2528,17 @@ Concept Index
* obstack output: Formatted Output Functions.
(line 81)
* OpenBSD: Notes for Particular Systems.
- (line 109)
+ (line 91)
* Optimizing performance: Performance optimization.
(line 6)
* ostream output: C++ Formatted Output.
(line 6)
* Other languages: Language Bindings. (line 6)
-* Output functions <1>: Formatted Output Functions.
- (line 6)
-* Output functions <2>: I/O of Rationals. (line 6)
+* Output functions <1>: I/O of Rationals. (line 6)
+* Output functions <2>: I/O of Floats. (line 6)
* Output functions <3>: I/O of Integers. (line 6)
-* Output functions: I/O of Floats. (line 6)
+* Output functions: Formatted Output Functions.
+ (line 6)
* Packaged builds: Notes for Package Builds.
(line 6)
* Parameter conventions: Parameter Conventions.
@@ -2958,27 +2549,27 @@ Concept Index
(line 6)
* Past GMP versions: Compatibility with older versions.
(line 6)
-* PDF: Build Options. (line 342)
+* PDF: Build Options. (line 350)
* Perfect power algorithm: Perfect Power Algorithm.
(line 6)
-* Perfect power functions: Integer Roots. (line 28)
+* Perfect power functions: Integer Roots. (line 27)
* Perfect square algorithm: Perfect Square Algorithm.
(line 6)
-* Perfect square functions: Integer Roots. (line 37)
+* Perfect square functions: Integer Roots. (line 36)
* perl: Demonstration Programs.
(line 35)
* Perl module: Demonstration Programs.
(line 35)
-* Postscript: Build Options. (line 342)
-* Power/PowerPC <1>: Known Build Problems.
+* Postscript: Build Options. (line 350)
+* Power/PowerPC <1>: Notes for Particular Systems.
+ (line 97)
+* Power/PowerPC: Known Build Problems.
(line 63)
-* Power/PowerPC: Notes for Particular Systems.
- (line 115)
* Powering algorithms: Powering Algorithms. (line 6)
* Powering functions <1>: Float Arithmetic. (line 41)
* Powering functions: Integer Exponentiation.
(line 6)
-* PowerPC: ABI and ISA. (line 176)
+* PowerPC: ABI and ISA. (line 167)
* Precision of floats: Floating-point Functions.
(line 6)
* Precision of hardware floating point: Notes for Particular Systems.
@@ -2988,8 +2579,6 @@ Concept Index
(line 6)
* Prime testing functions: Number Theoretic Functions.
(line 7)
-* Primorial functions: Number Theoretic Functions.
- (line 121)
* printf formatted output: Formatted Output. (line 6)
* Probable prime testing functions: Number Theoretic Functions.
(line 7)
@@ -2999,18 +2588,18 @@ Concept Index
(line 6)
* Random number algorithms: Random Number Algorithms.
(line 6)
-* Random number functions <1>: Integer Random Numbers.
- (line 6)
+* Random number functions <1>: Miscellaneous Float Functions.
+ (line 27)
* Random number functions <2>: Random Number Functions.
(line 6)
-* Random number functions: Miscellaneous Float Functions.
- (line 27)
+* Random number functions: Integer Random Numbers.
+ (line 6)
* Random number seeding: Random State Seeding.
(line 6)
* Random number state: Random State Initialization.
(line 6)
* Random state: Nomenclature and Types.
- (line 46)
+ (line 41)
* Rational arithmetic: Efficiency. (line 113)
* Rational arithmetic functions: Rational Arithmetic. (line 6)
* Rational assignment functions: Initializing Rationals.
@@ -3035,14 +2624,14 @@ Concept Index
* Reentrancy: Reentrancy. (line 6)
* References: References. (line 6)
* Remove factor functions: Number Theoretic Functions.
- (line 108)
+ (line 91)
* Reporting bugs: Reporting Bugs. (line 6)
* Root extraction algorithm: Nth Root Algorithm. (line 6)
* Root extraction algorithms: Root Extraction Algorithms.
(line 6)
* Root extraction functions <1>: Float Arithmetic. (line 37)
* Root extraction functions: Integer Roots. (line 6)
-* Root testing functions: Integer Roots. (line 28)
+* Root testing functions: Integer Roots. (line 36)
* Rounding functions: Miscellaneous Float Functions.
(line 9)
* Sample programs: Demonstration Programs.
@@ -3058,30 +2647,32 @@ Concept Index
* Sequent Symmetry: Known Build Problems.
(line 68)
* Services for Unix: Notes for Particular Systems.
- (line 65)
+ (line 56)
* Shared library versioning: Notes for Package Builds.
(line 9)
-* Sign tests <1>: Comparing Rationals. (line 27)
-* Sign tests <2>: Float Comparison. (line 35)
-* Sign tests: Integer Comparisons. (line 28)
+* Sign tests <1>: Integer Comparisons. (line 28)
+* Sign tests <2>: Float Comparison. (line 33)
+* Sign tests: Comparing Rationals. (line 27)
* Size in digits: Miscellaneous Integer Functions.
(line 23)
* Small operands: Efficiency. (line 7)
-* Solaris <1>: ABI and ISA. (line 208)
+* Solaris <1>: Known Build Problems.
+ (line 78)
+* Solaris <2>: ABI and ISA. (line 201)
* Solaris: Known Build Problems.
(line 72)
* Sparc: Notes for Particular Systems.
- (line 127)
-* Sparc V9: ABI and ISA. (line 208)
+ (line 108)
+* Sparc V9: ABI and ISA. (line 201)
* Special integer functions: Integer Special Functions.
(line 6)
* Square root algorithm: Square Root Algorithm.
(line 6)
* SSE2: Notes for Particular Systems.
- (line 156)
+ (line 137)
* Stack backtrace: Debugging. (line 50)
* Stack overflow <1>: Debugging. (line 7)
-* Stack overflow: Build Options. (line 274)
+* Stack overflow: Build Options. (line 278)
* Static linking: Efficiency. (line 14)
* stdarg.h: Headers and Libraries.
(line 17)
@@ -3089,22 +2680,20 @@ Concept Index
(line 11)
* Stripped libraries: Known Build Problems.
(line 28)
-* Sun: ABI and ISA. (line 208)
+* Sun: ABI and ISA. (line 201)
* SunOS: Notes for Particular Systems.
- (line 144)
+ (line 125)
* Systems: Notes for Particular Systems.
(line 6)
-* Temporary memory: Build Options. (line 274)
-* Texinfo: Build Options. (line 339)
+* Temporary memory: Build Options. (line 278)
+* Texinfo: Build Options. (line 347)
* Text input/output: Efficiency. (line 153)
* Thread safety: Reentrancy. (line 6)
-* Toom multiplication <1>: Higher degree Toom'n'half.
- (line 6)
-* Toom multiplication <2>: Other Multiplication.
+* Toom multiplication <1>: Toom 4-Way Multiplication.
(line 6)
-* Toom multiplication <3>: Toom 4-Way Multiplication.
+* Toom multiplication <2>: Toom 3-Way Multiplication.
(line 6)
-* Toom multiplication: Toom 3-Way Multiplication.
+* Toom multiplication: Other Multiplication.
(line 6)
* Types: Nomenclature and Types.
(line 6)
@@ -3122,14 +2711,14 @@ Concept Index
(line 6)
* Version number: Useful Macros and Constants.
(line 12)
-* Web page: Introduction to GMP. (line 33)
+* Web page: Introduction to GMP. (line 34)
* Windows: Notes for Particular Systems.
- (line 70)
+ (line 61)
* x86: Notes for Particular Systems.
- (line 150)
+ (line 131)
* x87: Notes for Particular Systems.
(line 34)
-* XML: Build Options. (line 346)
+* XML: Build Options. (line 354)

File: gmp.info, Node: Function Index, Prev: Concept Index, Up: Top
@@ -3151,27 +2740,29 @@ Function and Type Index
* __GNU_MP_VERSION_PATCHLEVEL: Useful Macros and Constants.
(line 12)
* _mpz_realloc: Integer Special Functions.
- (line 14)
-* abs <1>: C++ Interface Rationals.
- (line 49)
-* abs <2>: C++ Interface Floats.
- (line 83)
-* abs: C++ Interface Integers.
- (line 47)
+ (line 51)
+* abs <1>: C++ Interface Floats.
+ (line 70)
+* abs <2>: C++ Interface Integers.
+ (line 42)
+* abs: C++ Interface Rationals.
+ (line 43)
* ceil: C++ Interface Floats.
- (line 84)
+ (line 71)
* cmp <1>: C++ Interface Floats.
- (line 86)
-* cmp <2>: C++ Interface Rationals.
- (line 51)
-* cmp <3>: C++ Interface Floats.
- (line 85)
-* cmp <4>: C++ Interface Rationals.
- (line 50)
-* cmp: C++ Interface Integers.
- (line 49)
+ (line 73)
+* cmp <2>: C++ Interface Integers.
+ (line 44)
+* cmp <3>: C++ Interface Rationals.
+ (line 45)
+* cmp <4>: C++ Interface Integers.
+ (line 43)
+* cmp: C++ Interface Floats.
+ (line 72)
* floor: C++ Interface Floats.
- (line 93)
+ (line 80)
+* gcd: BSD Compatible Functions.
+ (line 82)
* gmp_asprintf: Formatted Output Functions.
(line 65)
* gmp_errno: Random State Initialization.
@@ -3184,12 +2775,12 @@ Function and Type Index
(line 29)
* gmp_fscanf: Formatted Input Functions.
(line 25)
-* 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_LIMB_BITS: Low-level Functions. (line 464)
+* GMP_NAIL_BITS: Low-level Functions. (line 462)
+* GMP_NAIL_MASK: Low-level Functions. (line 472)
+* GMP_NUMB_BITS: Low-level Functions. (line 463)
+* GMP_NUMB_MASK: Low-level Functions. (line 473)
+* GMP_NUMB_MAX: Low-level Functions. (line 481)
* gmp_obstack_printf: Formatted Output Functions.
(line 79)
* gmp_obstack_vprintf: Formatted Output Functions.
@@ -3205,13 +2796,13 @@ Function and Type Index
* gmp_randclass::get_f: C++ Interface Random Numbers.
(line 45)
* gmp_randclass::get_z_bits: C++ Interface Random Numbers.
- (line 38)
+ (line 39)
* gmp_randclass::get_z_range: C++ Interface Random Numbers.
(line 42)
* gmp_randclass::gmp_randclass: C++ Interface Random Numbers.
(line 27)
* gmp_randclass::seed: C++ Interface Random Numbers.
- (line 33)
+ (line 34)
* gmp_randclear: Random State Initialization.
(line 62)
* gmp_randinit: Random State Initialization.
@@ -3227,11 +2818,11 @@ Function and Type Index
* gmp_randinit_set: Random State Initialization.
(line 43)
* gmp_randseed: Random State Seeding.
- (line 8)
+ (line 7)
* gmp_randseed_ui: Random State Seeding.
- (line 10)
+ (line 9)
* gmp_randstate_t: Nomenclature and Types.
- (line 46)
+ (line 41)
* gmp_scanf: Formatted Input Functions.
(line 21)
* gmp_snprintf: Formatted Output Functions.
@@ -3263,17 +2854,33 @@ Function and Type Index
* gmp_vsscanf: Formatted Input Functions.
(line 31)
* hypot: C++ Interface Floats.
+ (line 81)
+* itom: BSD Compatible Functions.
+ (line 29)
+* madd: BSD Compatible Functions.
+ (line 43)
+* mcmp: BSD Compatible Functions.
+ (line 85)
+* mdiv: BSD Compatible Functions.
+ (line 53)
+* mfree: BSD Compatible Functions.
+ (line 105)
+* min: BSD Compatible Functions.
+ (line 89)
+* MINT: BSD Compatible Functions.
+ (line 21)
+* mout: BSD Compatible Functions.
(line 94)
-* mp_bitcnt_t: Nomenclature and Types.
- (line 42)
+* move: BSD Compatible Functions.
+ (line 39)
* mp_bits_per_limb: Useful Macros and Constants.
(line 7)
* mp_exp_t: Nomenclature and Types.
(line 27)
-* mp_get_memory_functions: Custom Allocation. (line 90)
+* mp_get_memory_functions: Custom Allocation. (line 93)
* mp_limb_t: Nomenclature and Types.
(line 31)
-* mp_set_memory_functions: Custom Allocation. (line 18)
+* mp_set_memory_functions: Custom Allocation. (line 21)
* mp_size_t: Nomenclature and Types.
(line 37)
* mpf_abs: Float Arithmetic. (line 47)
@@ -3284,43 +2891,40 @@ Function and Type Index
* mpf_class: C++ Interface General.
(line 20)
* mpf_class::fits_sint_p: C++ Interface Floats.
- (line 87)
+ (line 74)
* mpf_class::fits_slong_p: C++ Interface Floats.
- (line 88)
+ (line 75)
* mpf_class::fits_sshort_p: C++ Interface Floats.
- (line 89)
+ (line 76)
* mpf_class::fits_uint_p: C++ Interface Floats.
- (line 90)
+ (line 77)
* mpf_class::fits_ulong_p: C++ Interface Floats.
- (line 91)
+ (line 78)
* mpf_class::fits_ushort_p: C++ Interface Floats.
- (line 92)
+ (line 79)
* mpf_class::get_d: C++ Interface Floats.
- (line 95)
+ (line 82)
* mpf_class::get_mpf_t: C++ Interface General.
(line 66)
* mpf_class::get_prec: C++ Interface Floats.
- (line 115)
+ (line 100)
* mpf_class::get_si: C++ Interface Floats.
- (line 96)
+ (line 83)
* mpf_class::get_str: C++ Interface Floats.
- (line 98)
+ (line 85)
* mpf_class::get_ui: C++ Interface Floats.
- (line 99)
+ (line 86)
* mpf_class::mpf_class: C++ Interface Floats.
- (line 12)
+ (line 33)
* mpf_class::operator=: C++ Interface Floats.
- (line 60)
+ (line 47)
* mpf_class::set_prec: C++ Interface Floats.
- (line 116)
+ (line 101)
* mpf_class::set_prec_raw: C++ Interface Floats.
- (line 117)
+ (line 102)
* mpf_class::set_str: C++ Interface Floats.
- (line 100)
-* mpf_class::swap: C++ Interface Floats.
- (line 104)
-* mpf_clear: Initializing Floats. (line 37)
-* mpf_clears: Initializing Floats. (line 41)
+ (line 87)
+* mpf_clear: Initializing Floats. (line 31)
* mpf_cmp: Float Comparison. (line 7)
* mpf_cmp_d: Float Comparison. (line 8)
* mpf_cmp_si: Float Comparison. (line 10)
@@ -3328,7 +2932,7 @@ Function and Type Index
* mpf_div: Float Arithmetic. (line 29)
* mpf_div_2exp: Float Arithmetic. (line 55)
* mpf_div_ui: Float Arithmetic. (line 33)
-* mpf_eq: Float Comparison. (line 18)
+* mpf_eq: Float Comparison. (line 17)
* mpf_fits_sint_p: Miscellaneous Float Functions.
(line 20)
* mpf_fits_slong_p: Miscellaneous Float Functions.
@@ -3344,12 +2948,12 @@ Function and Type Index
* mpf_floor: Miscellaneous Float Functions.
(line 8)
* mpf_get_d: Converting Floats. (line 7)
-* mpf_get_d_2exp: Converting Floats. (line 17)
+* mpf_get_d_2exp: Converting Floats. (line 16)
* mpf_get_default_prec: Initializing Floats. (line 12)
-* mpf_get_prec: Initializing Floats. (line 62)
-* mpf_get_si: Converting Floats. (line 28)
-* mpf_get_str: Converting Floats. (line 38)
-* mpf_get_ui: Converting Floats. (line 29)
+* mpf_get_prec: Initializing Floats. (line 52)
+* mpf_get_si: Converting Floats. (line 27)
+* mpf_get_str: Converting Floats. (line 37)
+* mpf_get_ui: Converting Floats. (line 28)
* mpf_init: Initializing Floats. (line 19)
* mpf_init2: Initializing Floats. (line 26)
* mpf_init_set: Simultaneous Float Init & Assign.
@@ -3359,33 +2963,32 @@ Function and Type Index
* mpf_init_set_si: Simultaneous Float Init & Assign.
(line 18)
* mpf_init_set_str: Simultaneous Float Init & Assign.
- (line 26)
+ (line 25)
* mpf_init_set_ui: Simultaneous Float Init & Assign.
(line 17)
-* mpf_inits: Initializing Floats. (line 31)
-* mpf_inp_str: I/O of Floats. (line 39)
+* mpf_inp_str: I/O of Floats. (line 37)
* mpf_integer_p: Miscellaneous Float Functions.
(line 14)
* mpf_mul: Float Arithmetic. (line 19)
* mpf_mul_2exp: Float Arithmetic. (line 51)
* mpf_mul_ui: Float Arithmetic. (line 21)
* mpf_neg: Float Arithmetic. (line 44)
-* mpf_out_str: I/O of Floats. (line 19)
+* mpf_out_str: I/O of Floats. (line 17)
* mpf_pow_ui: Float Arithmetic. (line 41)
* mpf_random2: Miscellaneous Float Functions.
- (line 37)
-* mpf_reldiff: Float Comparison. (line 31)
+ (line 36)
+* mpf_reldiff: Float Comparison. (line 29)
* mpf_set: Assigning Floats. (line 10)
* mpf_set_d: Assigning Floats. (line 13)
* mpf_set_default_prec: Initializing Floats. (line 7)
-* mpf_set_prec: Initializing Floats. (line 65)
-* mpf_set_prec_raw: Initializing Floats. (line 72)
+* mpf_set_prec: Initializing Floats. (line 55)
+* mpf_set_prec_raw: Initializing Floats. (line 62)
* mpf_set_q: Assigning Floats. (line 15)
* mpf_set_si: Assigning Floats. (line 12)
* mpf_set_str: Assigning Floats. (line 18)
* mpf_set_ui: Assigning Floats. (line 11)
* mpf_set_z: Assigning Floats. (line 14)
-* mpf_sgn: Float Comparison. (line 35)
+* mpf_sgn: Float Comparison. (line 33)
* mpf_sqrt: Float Arithmetic. (line 36)
* mpf_sqrt_ui: Float Arithmetic. (line 37)
* mpf_sub: Float Arithmetic. (line 12)
@@ -3402,109 +3005,75 @@ 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 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 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_addmul_1: Low-level Functions. (line 143)
+* mpn_bdivmod: Low-level Functions. (line 255)
+* mpn_cmp: Low-level Functions. (line 296)
+* mpn_divexact_by3: Low-level Functions. (line 223)
+* mpn_divexact_by3c: Low-level Functions. (line 225)
+* mpn_divmod: Low-level Functions. (line 218)
+* mpn_divmod_1: Low-level Functions. (line 202)
+* mpn_divrem: Low-level Functions. (line 176)
+* mpn_divrem_1: Low-level Functions. (line 200)
+* mpn_gcd: Low-level Functions. (line 301)
+* mpn_gcd_1: Low-level Functions. (line 311)
+* mpn_gcdext: Low-level Functions. (line 317)
+* mpn_get_str: Low-level Functions. (line 358)
+* mpn_hamdist: Low-level Functions. (line 422)
+* mpn_lshift: Low-level Functions. (line 272)
+* mpn_mod_1: Low-level Functions. (line 249)
+* mpn_mul: Low-level Functions. (line 109)
+* mpn_mul_1: Low-level Functions. (line 128)
+* mpn_mul_n: Low-level Functions. (line 98)
+* mpn_perfect_square_p: Low-level Functions. (line 428)
+* mpn_popcount: Low-level Functions. (line 418)
+* mpn_random: Low-level Functions. (line 407)
+* mpn_random2: Low-level Functions. (line 408)
+* mpn_rshift: Low-level Functions. (line 284)
+* mpn_scan0: Low-level Functions. (line 392)
+* mpn_scan1: Low-level Functions. (line 400)
+* mpn_set_str: Low-level Functions. (line 373)
+* mpn_sqr_n: Low-level Functions. (line 120)
+* mpn_sqrtrem: Low-level Functions. (line 340)
* 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 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)
+* mpn_submul_1: Low-level Functions. (line 154)
+* mpn_tdiv_qr: Low-level Functions. (line 166)
+* mpq_abs: Rational Arithmetic. (line 33)
+* mpq_add: Rational Arithmetic. (line 7)
* mpq_canonicalize: Rational Number Functions.
(line 22)
* mpq_class: C++ Interface General.
(line 19)
* mpq_class::canonicalize: C++ Interface Rationals.
- (line 43)
+ (line 37)
* mpq_class::get_d: C++ Interface Rationals.
- (line 52)
+ (line 46)
* mpq_class::get_den: C++ Interface Rationals.
- (line 66)
+ (line 58)
* mpq_class::get_den_mpz_t: C++ Interface Rationals.
- (line 76)
+ (line 68)
* mpq_class::get_mpq_t: C++ Interface General.
(line 65)
* mpq_class::get_num: C++ Interface Rationals.
- (line 65)
+ (line 57)
* mpq_class::get_num_mpz_t: C++ Interface Rationals.
- (line 75)
+ (line 67)
* mpq_class::get_str: C++ Interface Rationals.
- (line 53)
+ (line 47)
* mpq_class::mpq_class: C++ Interface Rationals.
(line 12)
* mpq_class::set_str: C++ Interface Rationals.
- (line 55)
-* mpq_class::swap: C++ Interface Rationals.
- (line 57)
+ (line 48)
* mpq_clear: Initializing Rationals.
- (line 16)
-* mpq_clears: Initializing Rationals.
- (line 20)
+ (line 12)
* mpq_cmp: Comparing Rationals. (line 7)
* mpq_cmp_si: Comparing Rationals. (line 17)
* mpq_cmp_ui: Comparing Rationals. (line 15)
* mpq_denref: Applying Integer Functions.
(line 18)
-* mpq_div: Rational Arithmetic. (line 24)
-* mpq_div_2exp: Rational Arithmetic. (line 28)
+* mpq_div: Rational Arithmetic. (line 23)
+* mpq_div_2exp: Rational Arithmetic. (line 27)
* mpq_equal: Comparing Rationals. (line 33)
* mpq_get_d: Rational Conversions.
(line 7)
@@ -3516,18 +3085,16 @@ Function and Type Index
(line 22)
* mpq_init: Initializing Rationals.
(line 7)
-* mpq_inits: Initializing Rationals.
- (line 12)
-* mpq_inp_str: I/O of Rationals. (line 27)
-* mpq_inv: Rational Arithmetic. (line 37)
-* mpq_mul: Rational Arithmetic. (line 16)
-* mpq_mul_2exp: Rational Arithmetic. (line 20)
-* mpq_neg: Rational Arithmetic. (line 31)
+* mpq_inp_str: I/O of Rationals. (line 23)
+* mpq_inv: Rational Arithmetic. (line 36)
+* mpq_mul: Rational Arithmetic. (line 15)
+* mpq_mul_2exp: Rational Arithmetic. (line 19)
+* mpq_neg: Rational Arithmetic. (line 30)
* mpq_numref: Applying Integer Functions.
(line 17)
-* mpq_out_str: I/O of Rationals. (line 19)
+* mpq_out_str: I/O of Rationals. (line 15)
* mpq_set: Initializing Rationals.
- (line 24)
+ (line 16)
* mpq_set_d: Rational Conversions.
(line 17)
* mpq_set_den: Applying Integer Functions.
@@ -3537,79 +3104,73 @@ Function and Type Index
* mpq_set_num: Applying Integer Functions.
(line 25)
* mpq_set_si: Initializing Rationals.
- (line 31)
+ (line 23)
* mpq_set_str: Initializing Rationals.
- (line 36)
+ (line 28)
* mpq_set_ui: Initializing Rationals.
- (line 29)
+ (line 21)
* mpq_set_z: Initializing Rationals.
- (line 25)
+ (line 17)
* mpq_sgn: Comparing Rationals. (line 27)
-* mpq_sub: Rational Arithmetic. (line 12)
+* mpq_sub: Rational Arithmetic. (line 11)
* mpq_swap: Initializing Rationals.
- (line 56)
+ (line 48)
* mpq_t: Nomenclature and Types.
(line 16)
-* mpz_2fac_ui: Number Theoretic Functions.
- (line 114)
-* mpz_abs: Integer Arithmetic. (line 45)
+* mpz_abs: Integer Arithmetic. (line 43)
* mpz_add: Integer Arithmetic. (line 7)
* mpz_add_ui: Integer Arithmetic. (line 9)
-* mpz_addmul: Integer Arithmetic. (line 26)
-* mpz_addmul_ui: Integer Arithmetic. (line 28)
+* mpz_addmul: Integer Arithmetic. (line 25)
+* mpz_addmul_ui: Integer Arithmetic. (line 27)
* mpz_and: Integer Logic and Bit Fiddling.
(line 11)
* mpz_array_init: Integer Special Functions.
(line 11)
* mpz_bin_ui: Number Theoretic Functions.
- (line 126)
+ (line 99)
* mpz_bin_uiui: Number Theoretic Functions.
- (line 128)
+ (line 101)
* mpz_cdiv_q: Integer Division. (line 13)
-* mpz_cdiv_q_2exp: Integer Division. (line 26)
-* mpz_cdiv_q_ui: Integer Division. (line 18)
-* mpz_cdiv_qr: Integer Division. (line 16)
-* mpz_cdiv_qr_ui: Integer Division. (line 22)
+* mpz_cdiv_q_2exp: Integer Division. (line 25)
+* mpz_cdiv_q_ui: Integer Division. (line 17)
+* mpz_cdiv_qr: Integer Division. (line 15)
+* mpz_cdiv_qr_ui: Integer Division. (line 21)
* mpz_cdiv_r: Integer Division. (line 14)
-* mpz_cdiv_r_2exp: Integer Division. (line 28)
-* mpz_cdiv_r_ui: Integer Division. (line 20)
-* mpz_cdiv_ui: Integer Division. (line 24)
+* mpz_cdiv_r_2exp: Integer Division. (line 27)
+* mpz_cdiv_r_ui: Integer Division. (line 19)
+* mpz_cdiv_ui: Integer Division. (line 23)
* mpz_class: C++ Interface General.
(line 18)
* mpz_class::fits_sint_p: C++ Interface Integers.
- (line 50)
+ (line 45)
* mpz_class::fits_slong_p: C++ Interface Integers.
- (line 51)
+ (line 46)
* mpz_class::fits_sshort_p: C++ Interface Integers.
- (line 52)
+ (line 47)
* mpz_class::fits_uint_p: C++ Interface Integers.
- (line 53)
+ (line 48)
* mpz_class::fits_ulong_p: C++ Interface Integers.
- (line 54)
+ (line 49)
* mpz_class::fits_ushort_p: C++ Interface Integers.
- (line 55)
+ (line 50)
* mpz_class::get_d: C++ Interface Integers.
- (line 56)
+ (line 51)
* mpz_class::get_mpz_t: C++ Interface General.
(line 64)
* mpz_class::get_si: C++ Interface Integers.
- (line 57)
+ (line 52)
* mpz_class::get_str: C++ Interface Integers.
- (line 58)
+ (line 53)
* mpz_class::get_ui: C++ Interface Integers.
- (line 59)
+ (line 54)
* mpz_class::mpz_class: C++ Interface Integers.
- (line 21)
+ (line 7)
* mpz_class::set_str: C++ Interface Integers.
- (line 60)
-* mpz_class::swap: C++ Interface Integers.
- (line 64)
+ (line 56)
* mpz_clear: Initializing Integers.
- (line 49)
-* mpz_clears: Initializing Integers.
- (line 53)
+ (line 40)
* mpz_clrbit: Integer Logic and Bit Fiddling.
- (line 56)
+ (line 55)
* mpz_cmp: Integer Comparisons. (line 7)
* mpz_cmp_d: Integer Comparisons. (line 8)
* mpz_cmp_si: Integer Comparisons. (line 9)
@@ -3620,34 +3181,34 @@ Function and Type Index
* mpz_com: Integer Logic and Bit Fiddling.
(line 20)
* mpz_combit: Integer Logic and Bit Fiddling.
- (line 59)
-* mpz_congruent_2exp_p: Integer Division. (line 137)
-* mpz_congruent_p: Integer Division. (line 133)
-* mpz_congruent_ui_p: Integer Division. (line 135)
-* mpz_divexact: Integer Division. (line 110)
-* mpz_divexact_ui: Integer Division. (line 112)
-* mpz_divisible_2exp_p: Integer Division. (line 123)
-* mpz_divisible_p: Integer Division. (line 120)
-* mpz_divisible_ui_p: Integer Division. (line 122)
+ (line 58)
+* mpz_congruent_2exp_p: Integer Division. (line 131)
+* mpz_congruent_p: Integer Division. (line 127)
+* mpz_congruent_ui_p: Integer Division. (line 129)
+* mpz_divexact: Integer Division. (line 107)
+* mpz_divexact_ui: Integer Division. (line 108)
+* mpz_divisible_2exp_p: Integer Division. (line 118)
+* mpz_divisible_p: Integer Division. (line 116)
+* mpz_divisible_ui_p: Integer Division. (line 117)
* mpz_even_p: Miscellaneous Integer Functions.
(line 18)
* mpz_export: Integer Import and Export.
(line 45)
* mpz_fac_ui: Number Theoretic Functions.
- (line 113)
-* mpz_fdiv_q: Integer Division. (line 30)
-* mpz_fdiv_q_2exp: Integer Division. (line 43)
-* mpz_fdiv_q_ui: Integer Division. (line 35)
-* mpz_fdiv_qr: Integer Division. (line 33)
-* mpz_fdiv_qr_ui: Integer Division. (line 39)
-* mpz_fdiv_r: Integer Division. (line 31)
-* mpz_fdiv_r_2exp: Integer Division. (line 45)
-* mpz_fdiv_r_ui: Integer Division. (line 37)
-* mpz_fdiv_ui: Integer Division. (line 41)
+ (line 96)
+* mpz_fdiv_q: Integer Division. (line 29)
+* mpz_fdiv_q_2exp: Integer Division. (line 41)
+* mpz_fdiv_q_ui: Integer Division. (line 33)
+* mpz_fdiv_qr: Integer Division. (line 31)
+* mpz_fdiv_qr_ui: Integer Division. (line 37)
+* mpz_fdiv_r: Integer Division. (line 30)
+* mpz_fdiv_r_2exp: Integer Division. (line 43)
+* mpz_fdiv_r_ui: Integer Division. (line 35)
+* mpz_fdiv_ui: Integer Division. (line 39)
* mpz_fib2_ui: Number Theoretic Functions.
- (line 136)
+ (line 109)
* mpz_fib_ui: Number Theoretic Functions.
- (line 134)
+ (line 107)
* mpz_fits_sint_p: Miscellaneous Integer Functions.
(line 10)
* mpz_fits_slong_p: Miscellaneous Integer Functions.
@@ -3661,18 +3222,18 @@ Function and Type Index
* mpz_fits_ushort_p: Miscellaneous Integer Functions.
(line 11)
* mpz_gcd: Number Theoretic Functions.
- (line 32)
+ (line 30)
* mpz_gcd_ui: Number Theoretic Functions.
- (line 39)
+ (line 35)
* mpz_gcdext: Number Theoretic Functions.
- (line 49)
+ (line 45)
* mpz_get_d: Converting Integers. (line 27)
-* mpz_get_d_2exp: Converting Integers. (line 36)
+* mpz_get_d_2exp: Converting Integers. (line 35)
* mpz_get_si: Converting Integers. (line 18)
-* mpz_get_str: Converting Integers. (line 47)
+* mpz_get_str: Converting Integers. (line 46)
* mpz_get_ui: Converting Integers. (line 11)
* mpz_getlimbn: Integer Special Functions.
- (line 23)
+ (line 60)
* mpz_hamdist: Integer Logic and Bit Fiddling.
(line 29)
* mpz_import: Integer Import and Export.
@@ -3680,7 +3241,7 @@ Function and Type Index
* mpz_init: Initializing Integers.
(line 26)
* mpz_init2: Initializing Integers.
- (line 33)
+ (line 29)
* mpz_init_set: Simultaneous Integer Init & Assign.
(line 27)
* mpz_init_set_d: Simultaneous Integer Init & Assign.
@@ -3688,72 +3249,56 @@ Function and Type Index
* mpz_init_set_si: Simultaneous Integer Init & Assign.
(line 29)
* mpz_init_set_str: Simultaneous Integer Init & Assign.
- (line 35)
+ (line 34)
* mpz_init_set_ui: Simultaneous Integer Init & Assign.
(line 28)
-* mpz_inits: Initializing Integers.
- (line 29)
-* mpz_inp_raw: I/O of Integers. (line 62)
-* mpz_inp_str: I/O of Integers. (line 31)
+* mpz_inp_raw: I/O of Integers. (line 59)
+* mpz_inp_str: I/O of Integers. (line 28)
* mpz_invert: Number Theoretic Functions.
- (line 76)
+ (line 60)
* mpz_ior: Integer Logic and Bit Fiddling.
(line 14)
* mpz_jacobi: Number Theoretic Functions.
- (line 83)
+ (line 66)
* mpz_kronecker: Number Theoretic Functions.
- (line 91)
+ (line 74)
* mpz_kronecker_si: Number Theoretic Functions.
- (line 92)
+ (line 75)
* mpz_kronecker_ui: Number Theoretic Functions.
- (line 93)
+ (line 76)
* mpz_lcm: Number Theoretic Functions.
- (line 68)
+ (line 54)
* mpz_lcm_ui: Number Theoretic Functions.
- (line 70)
+ (line 55)
* 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)
+ (line 69)
* mpz_lucnum2_ui: Number Theoretic Functions.
- (line 147)
+ (line 120)
* mpz_lucnum_ui: Number Theoretic Functions.
- (line 145)
-* mpz_mfac_uiui: Number Theoretic Functions.
- (line 116)
-* mpz_mod: Integer Division. (line 100)
-* mpz_mod_ui: Integer Division. (line 102)
+ (line 118)
+* mpz_mod: Integer Division. (line 97)
+* mpz_mod_ui: Integer Division. (line 99)
* mpz_mul: Integer Arithmetic. (line 19)
-* mpz_mul_2exp: Integer Arithmetic. (line 38)
+* mpz_mul_2exp: Integer Arithmetic. (line 36)
* mpz_mul_si: Integer Arithmetic. (line 20)
* mpz_mul_ui: Integer Arithmetic. (line 22)
-* mpz_neg: Integer Arithmetic. (line 42)
+* mpz_neg: Integer Arithmetic. (line 40)
* mpz_nextprime: Number Theoretic Functions.
- (line 25)
+ (line 23)
* mpz_odd_p: Miscellaneous Integer Functions.
(line 17)
-* mpz_out_raw: I/O of Integers. (line 46)
-* mpz_out_str: I/O of Integers. (line 19)
-* mpz_perfect_power_p: Integer Roots. (line 28)
-* mpz_perfect_square_p: Integer Roots. (line 37)
+* mpz_out_raw: I/O of Integers. (line 43)
+* mpz_out_str: I/O of Integers. (line 16)
+* mpz_perfect_power_p: Integer Roots. (line 27)
+* mpz_perfect_square_p: Integer Roots. (line 36)
* mpz_popcount: Integer Logic and Bit Fiddling.
(line 23)
* mpz_pow_ui: Integer Exponentiation.
- (line 31)
+ (line 18)
* mpz_powm: Integer Exponentiation.
(line 8)
-* mpz_powm_sec: Integer Exponentiation.
- (line 18)
* mpz_powm_ui: Integer Exponentiation.
(line 10)
-* mpz_primorial_ui: Number Theoretic Functions.
- (line 121)
* mpz_probab_prime_p: Number Theoretic Functions.
(line 7)
* mpz_random: Integer Random Numbers.
@@ -3761,15 +3306,11 @@ Function and Type Index
* mpz_random2: Integer Random Numbers.
(line 51)
* mpz_realloc2: Initializing Integers.
- (line 57)
+ (line 44)
* 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)
+ (line 91)
+* mpz_root: Integer Roots. (line 7)
+* mpz_rootrem: Integer Roots. (line 13)
* mpz_rrandomb: Integer Random Numbers.
(line 31)
* mpz_scan0: Integer Logic and Bit Fiddling.
@@ -3784,38 +3325,38 @@ Function and Type Index
* mpz_set_str: Assigning Integers. (line 21)
* mpz_set_ui: Assigning Integers. (line 11)
* mpz_setbit: Integer Logic and Bit Fiddling.
- (line 53)
+ (line 52)
* mpz_sgn: Integer Comparisons. (line 28)
* mpz_si_kronecker: Number Theoretic Functions.
- (line 94)
+ (line 77)
* mpz_size: Integer Special Functions.
- (line 31)
+ (line 68)
* mpz_sizeinbase: Miscellaneous Integer Functions.
(line 23)
-* mpz_sqrt: Integer Roots. (line 18)
-* mpz_sqrtrem: Integer Roots. (line 21)
+* mpz_sqrt: Integer Roots. (line 17)
+* mpz_sqrtrem: Integer Roots. (line 20)
* mpz_sub: Integer Arithmetic. (line 12)
* mpz_sub_ui: Integer Arithmetic. (line 14)
-* mpz_submul: Integer Arithmetic. (line 32)
-* mpz_submul_ui: Integer Arithmetic. (line 34)
+* mpz_submul: Integer Arithmetic. (line 30)
+* mpz_submul_ui: Integer Arithmetic. (line 32)
* mpz_swap: Assigning Integers. (line 37)
* mpz_t: Nomenclature and Types.
(line 6)
-* mpz_tdiv_q: Integer Division. (line 47)
-* mpz_tdiv_q_2exp: Integer Division. (line 60)
-* mpz_tdiv_q_ui: Integer Division. (line 52)
-* mpz_tdiv_qr: Integer Division. (line 50)
-* mpz_tdiv_qr_ui: Integer Division. (line 56)
-* mpz_tdiv_r: Integer Division. (line 48)
-* mpz_tdiv_r_2exp: Integer Division. (line 62)
-* mpz_tdiv_r_ui: Integer Division. (line 54)
-* mpz_tdiv_ui: Integer Division. (line 58)
+* mpz_tdiv_q: Integer Division. (line 45)
+* mpz_tdiv_q_2exp: Integer Division. (line 57)
+* mpz_tdiv_q_ui: Integer Division. (line 49)
+* mpz_tdiv_qr: Integer Division. (line 47)
+* mpz_tdiv_qr_ui: Integer Division. (line 53)
+* mpz_tdiv_r: Integer Division. (line 46)
+* mpz_tdiv_r_2exp: Integer Division. (line 59)
+* mpz_tdiv_r_ui: Integer Division. (line 51)
+* mpz_tdiv_ui: Integer Division. (line 55)
* mpz_tstbit: Integer Logic and Bit Fiddling.
- (line 62)
+ (line 61)
* mpz_ui_kronecker: Number Theoretic Functions.
- (line 95)
+ (line 78)
* mpz_ui_pow_ui: Integer Exponentiation.
- (line 33)
+ (line 20)
* mpz_ui_sub: Integer Arithmetic. (line 16)
* mpz_urandomb: Integer Random Numbers.
(line 14)
@@ -3823,43 +3364,43 @@ Function and Type Index
(line 23)
* mpz_xor: Integer Logic and Bit Fiddling.
(line 17)
-* operator"" <1>: C++ Interface Floats.
- (line 56)
-* operator"" <2>: C++ Interface Integers.
- (line 30)
-* operator"": C++ Interface Rationals.
- (line 38)
+* msqrt: BSD Compatible Functions.
+ (line 63)
+* msub: BSD Compatible Functions.
+ (line 46)
+* mtox: BSD Compatible Functions.
+ (line 98)
+* mult: BSD Compatible Functions.
+ (line 49)
* operator%: C++ Interface Integers.
- (line 35)
+ (line 30)
* operator/: C++ Interface Integers.
- (line 34)
+ (line 29)
* operator<<: C++ Formatted Output.
- (line 20)
+ (line 33)
* operator>> <1>: C++ Formatted Input. (line 14)
-* operator>>: C++ Interface Rationals.
- (line 85)
-* sgn <1>: C++ Interface Floats.
- (line 102)
-* sgn <2>: C++ Interface Integers.
- (line 62)
-* sgn: C++ Interface Rationals.
- (line 56)
-* sqrt <1>: C++ Interface Integers.
- (line 63)
-* sqrt: C++ Interface Floats.
- (line 103)
-* swap <1>: C++ Interface Floats.
- (line 105)
-* swap <2>: C++ Interface Integers.
- (line 65)
-* swap: C++ Interface Rationals.
+* operator>> <2>: C++ Interface Rationals.
+ (line 77)
+* operator>>: C++ Formatted Input. (line 25)
+* pow: BSD Compatible Functions.
+ (line 71)
+* rpow: BSD Compatible Functions.
+ (line 79)
+* sdiv: BSD Compatible Functions.
+ (line 55)
+* sgn <1>: C++ Interface Rationals.
+ (line 50)
+* sgn <2>: C++ Interface Floats.
+ (line 89)
+* sgn: C++ Interface Integers.
+ (line 57)
+* sqrt <1>: C++ Interface Floats.
+ (line 90)
+* sqrt: C++ Interface Integers.
(line 58)
* trunc: C++ Interface Floats.
- (line 106)
-
+ (line 91)
+* xtom: BSD Compatible Functions.
+ (line 34)
-
-Local Variables:
-coding: iso-8859-1
-End:
diff --git a/gmp/doc/gmp.texi b/gmp/doc/gmp.texi
index 86d033101a..704faed27f 100644
--- a/gmp/doc/gmp.texi
+++ b/gmp/doc/gmp.texi
@@ -14,7 +14,8 @@
This manual describes how to install and use the GNU multiple precision
arithmetic library, version @value{VERSION}.
-Copyright 1991, 1993-2014 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+2003, 2004, 2005, 2006, 2007, 2008, 2009 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
@@ -90,8 +91,8 @@ How to install and use the GNU multiple precision arithmetic library, version @v
@subtitle Edition @value{EDITION}
@subtitle @value{UPDATED}
-@author by Torbj@"orn Granlund and the GMP development team
-@c @email{tg@@gmplib.org}
+@author by the GMP developers
+@c @email{tege@@gmplib.org}
@c Include the Distribution inside the titlepage so
@c that headings are turned off.
@@ -135,6 +136,7 @@ How to install and use the GNU multiple precision arithmetic library, version @v
* Formatted Output:: @code{printf} style output.
* Formatted Input:: @code{scanf} style input.
* C++ Class Interface:: Class wrappers around GMP types.
+* BSD Compatible Functions:: All functions found in BSD MP.
* Custom Allocation:: How to customize the internal allocation.
* Language Bindings:: Using GMP from other languages.
* Algorithms:: What happens behind the scenes.
@@ -443,19 +445,10 @@ 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
-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.
+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}.
@node Introduction to GMP, Installing GMP, Copying, Top
@@ -480,17 +473,29 @@ emphasis on speed (as opposed to simplicity or elegance).
There is assembly code for these CPUs:
@cindex CPU types
-ARM Cortex-A9, Cortex-A15, and generic ARM,
+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.
-
+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.
@cindex Home page
@cindex Web page
@@ -498,7 +503,7 @@ There is also assembly code for many obsolete CPUs.
For up-to-date information on GMP, please see the GMP web pages at
@display
-@uref{https://gmplib.org/}
+@uref{http://gmplib.org/}
@end display
@cindex Latest version of GMP
@@ -508,11 +513,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{https://ftp.gnu.org/gnu/gmp/}
+@uref{ftp://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{https://www.gnu.org/order/ftp.html} for a full list.
+near you, see @uref{http://www.gnu.org/order/ftp.html} for a full list.
@cindex Mailing lists
There are three public mailing lists of interest. One for release
@@ -520,7 +525,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{https://gmplib.org/mailman/listinfo/}.
+@uref{http://gmplib.org/mailman/listinfo/}.
@end display
The proper place for bug reports is @email{gmp-bugs@@gmplib.org}. See
@@ -708,7 +713,7 @@ the binaries won't run on older members of the family, and might run slower on
other members, older or newer. The best idea is always to build GMP for the
exact machine type you intend to run it on.
-The following CPUs have specific support. See @file{configure.ac} for details
+The following CPUs have specific support. See @file{configure.in} for details
of what code and compiler options they select.
@itemize @bullet
@@ -837,10 +842,16 @@ 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.
@@ -848,14 +859,18 @@ CPUs not listed will use generic C code.
@item Generic C Build
@cindex Generic C
If some of the assembly code causes problems, or if otherwise desired, the
-generic C code can be selected with the configure @option{--disable-assembly}.
+generic C code can be selected with CPU @samp{none}. For example,
+
+@example
+./configure --host=none-unknown-freebsd3.5
+@end example
Note that this will run quite slowly, but it should be portable and should at
least make it possible to get something running if all else fails.
@item Fat binary, @option{--enable-fat}
@cindex Fat binary
-@cindex @code{--enable-fat}
+@cindex @option{--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.
@@ -908,7 +923,8 @@ preprocessor should be set in @samp{CPPFLAGS} rather than @samp{CFLAGS}.
Compiling is done with both @samp{CPPFLAGS} and @samp{CFLAGS}, but
preprocessing uses just @samp{CPPFLAGS}. This distinction is because most
preprocessors won't accept all the flags the compiler does. Preprocessing is
-done separately in some configure tests.
+done separately in some configure tests, and in the @samp{ansi2knr} support
+for K&R compilers.
@item @option{CC_FOR_BUILD}
@cindex @code{CC_FOR_BUILD}
@@ -1023,9 +1039,17 @@ debugging memory related problems (@pxref{Debugging}).
@item FFT Multiplication, @option{--disable-fft}
@cindex FFT multiplication
@cindex @code{--disable-fft}
-By default multiplications are done using Karatsuba, 3-way Toom, higher degree
-Toom, and Fermat FFT@. The FFT is only used on large to very large operands
-and can be disabled to save code size if desired.
+By default multiplications are done using Karatsuba, 3-way Toom, and
+Fermat FFT@. The FFT is only used on large to very large operands and can be
+disabled to save code size if desired.
+
+@item Berkeley MP, @option{--enable-mpbsd}
+@cindex Berkeley MP compatible functions
+@cindex BSD MP compatible functions
+@cindex @code{--enable-mpbsd}
+The Berkeley MP compatibility library (@file{libmp}) and header file
+(@file{mp.h}) are built and installed only if @option{--enable-mpbsd} is used.
+@xref{BSD Compatible Functions}.
@item Assertion Checking, @option{--enable-assert}
@cindex Assertion checking
@@ -1149,16 +1173,6 @@ 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
@@ -1284,7 +1298,7 @@ support for n32 or 64 and so only gets a 32-bit limb and the MIPS 2 code.
@item PowerPC 64 (@samp{powerpc64}, @samp{powerpc620}, @samp{powerpc630}, @samp{powerpc970}, @samp{power4}, @samp{power5})
@cindex PowerPC
@table @asis
-@item @samp{ABI=mode64}
+@item @samp{ABI=aix64}
@cindex AIX
The AIX 64 ABI uses 64-bit limbs and pointers and is the default on PowerPC 64
@samp{*-*-aix*} systems. Applications must be compiled with
@@ -1294,28 +1308,31 @@ gcc -maix64
xlc -q64
@end example
-On 64-bit GNU/Linux, BSD, and Mac OS X/Darwin systems, the applications must
-be compiled with
+@item @samp{ABI=mode64}
+The @samp{mode64} ABI uses 64-bit limbs and pointers, and is the default on
+64-bit GNU/Linux, BSD, and Mac OS X/Darwin systems. Applications must be
+compiled with
@example
gcc -m64
@end example
@item @samp{ABI=mode32}
+@cindex AIX
The @samp{mode32} ABI uses a 64-bit @code{long long} limb but with the chip
still in 32-bit mode and using 32-bit calling conventions. This is the default
-for systems where the true 64-bit ABI is unavailable. No special compiler
-options are typically needed for applications. This ABI is not available under
-AIX.
+on for systems where the true 64-bit ABIs are unavailable. No special compiler
+options are needed for applications.
@item @samp{ABI=32}
This is the basic 32-bit PowerPC ABI, with a 32-bit limb. No special compiler
options are needed for applications.
@end table
-GMP's speed is greatest for the @samp{mode64} ABI, the @samp{mode32} ABI is 2nd
-best. In @samp{ABI=32} only the 32-bit ISA is used and this doesn't make full
-use of a 64-bit chip.
+GMP speed is greatest in @samp{aix64} and @samp{mode32}. In @samp{ABI=32}
+only the 32-bit ISA is used and this doesn't make full use of a 64-bit chip.
+On a suitable system we could perhaps use more of the ISA, but there are no
+plans to do so.
@sp 1
@need 1000
@@ -1511,20 +1528,11 @@ 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 6.0 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 MacOS 9
+@cindex MacOS 9
+The @file{macos} directory contains an unsupported port to MacOS 9 on Power
+Macintosh, see @file{macos/README}. Note that MacOS X ``Darwin'' should use
+the normal Unix-style @samp{./configure}.
@item MS-DOS and MS Windows
@cindex MS-DOS
@@ -1586,15 +1594,6 @@ 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
@@ -1608,11 +1607,11 @@ In GMP, CPU types @samp{power*} and @samp{powerpc*} will each use instructions
not available on the other, so it's important to choose the right one for the
CPU that will be used. Currently GMP has no assembly code support for using
just the common instruction subset. To get executables that run on both, the
-current suggestion is to use the generic C code (@option{--disable-assembly}),
-possibly with appropriate compiler options (like @samp{-mcpu=common} for
+current suggestion is to use the generic C code (CPU @samp{none}), possibly
+with appropriate compiler options (like @samp{-mcpu=common} for
@command{gcc}). CPU @samp{rs6000} (which is not a CPU but a family of
workstations) is accepted by @file{config.sub}, but is currently equivalent to
-@option{--disable-assembly}.
+@samp{none}.
@item Sparc CPU Types
@cindex Sparc
@@ -1628,10 +1627,10 @@ that the GCC default @samp{-mapp-regs} does (@pxref{SPARC Options,, SPARC
Options, gcc, Using the GNU Compiler Collection (GCC)}).
This makes that code unsuitable for use with the special V9
-@samp{-mcmodel=embmedany} (which uses @code{g4} as a data segment pointer), and
-for applications wanting to use those registers for special purposes. In these
-cases the only suggestion currently is to build GMP with
-@option{--disable-assembly} to avoid the assembly code.
+@samp{-mcmodel=embmedany} (which uses @code{g4} as a data segment pointer),
+and for applications wanting to use those registers for special purposes. In
+these cases the only suggestion currently is to build GMP with CPU @samp{none}
+to avoid the assembly code.
@item SunOS 4
@cindex SunOS
@@ -1675,7 +1674,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{https://gmplib.org/}.
+You might find more up-to-date information at @uref{http://gmplib.org/}.
@table @asis
@item Compiler link options
@@ -1796,7 +1795,7 @@ make tuneup
will generate better contents for the @file{gmp-mparam.h} parameter file.
-To use the results, put the output in the file indicated in the
+To use the results, put the output in the file file indicated in the
@samp{Parameters for ...} header. Then recompile from scratch.
The @code{tuneup} program takes one useful parameter, @samp{-f NNN}, which
@@ -1856,10 +1855,10 @@ are only provided if @code{<stdio.h>} is included too.
@end example
@cindex @code{stdarg.h}
-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.
+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.
@cindex Libraries
@cindex Linking
@@ -1940,15 +1939,9 @@ analogous to a digit, only larger, and containing several digits.) Normally a
limb is 32 or 64 bits. The C data type for a limb is @code{mp_limb_t}.
@tindex @code{mp_size_t}
-Counts of limbs of a multi-precision number represented in the C type
-@code{mp_size_t}. Currently this is normally a @code{long}, but on some
-systems it's an @code{int} for efficiency, and on some systems it will be
-@code{long long} in the future.
-
-@tindex @code{mp_bitcnt_t}
-Counts of bits of a multi-precision number are represented in the C type
-@code{mp_bitcnt_t}. Currently this is always an @code{unsigned long}, but on
-some systems it will be an @code{unsigned long long} in the future.
+Counts of limbs are represented in the C type @code{mp_size_t}. Currently
+this is normally a @code{long}, but on some systems it's an @code{int} for
+efficiency.
@cindex Random state
@tindex @code{gmp_randstate_t}
@@ -1959,7 +1952,7 @@ data type for such objects is @code{gmp_randstate_t}. For example:
gmp_randstate_t rstate;
@end example
-Also, in general @code{mp_bitcnt_t} is used for bit counts and ranges, and
+Also, in general @code{unsigned long} is used for bit counts and ranges, and
@code{size_t} is used for byte or character counts.
@@ -1977,22 +1970,27 @@ functions in this class. (@pxref{Integer Functions})
@item
Functions for rational number arithmetic, with names beginning with
-@code{mpq_}. The associated type is @code{mpq_t}. There are about 35
+@code{mpq_}. The associated type is @code{mpq_t}. There are about 40
functions in this class, but the integer functions can be used for arithmetic
on the numerator and denominator separately. (@pxref{Rational Number
Functions})
@item
Functions for floating-point arithmetic, with names beginning with
-@code{mpf_}. The associated type is @code{mpf_t}. There are about 70
+@code{mpf_}. The associated type is @code{mpf_t}. There are about 60
functions is this class. (@pxref{Floating-point Functions})
@item
+Functions compatible with Berkeley MP, such as @code{itom}, @code{madd}, and
+@code{mult}. The associated type is @code{MINT}. (@pxref{BSD Compatible
+Functions})
+
+@item
Fast low-level functions that operate on natural numbers. These are used by
the functions in the preceding groups, and you can also call them directly
from very time-critical user programs. These functions' names begin with
@code{mpn_}. The associated type is array of @code{mp_limb_t}. There are
-about 60 (hard-to-use) functions in this class. (@pxref{Low-level Functions})
+about 30 (hard-to-use) functions in this class. (@pxref{Low-level Functions})
@item
Miscellaneous functions. Functions for setting up custom allocation and
@@ -2176,7 +2174,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 another might be writing, nor for
+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 @code{gmp_randstate_t} simultaneously,
since this involves an update of that variable.
@@ -2210,7 +2208,7 @@ For GMP i.j.k, these numbers will be i, j, and k, respectively.
@findex gmp_version
The GMP version number, as a null-terminated string, in the form ``i.j.k''.
This release is @nicode{"@value{VERSION}"}. Note that the format ``i.j'' was
-used, before version 4.3.0, when k was zero.
+used when k was zero was used before version 4.3.0.
@end deftypevr
@defmac __GMP_CC
@@ -2226,7 +2224,7 @@ strings.
@cindex Past GMP versions
@cindex Upward compatibility
-This version of GMP is upwardly binary compatible with all 5.x, 4.x, and 3.x
+This version of GMP is upwardly binary compatible with all 4.x and 3.x
versions, and upwardly compatible at the source level with all 2.x versions,
with the following exceptions.
@@ -2238,15 +2236,16 @@ with other @code{mpn} functions.
@item
@code{mpf_get_prec} counted precision slightly differently in GMP 3.0 and
3.0.1, but in 3.1 reverted to the 2.x style.
-
-@item
-@code{mpn_bdivmod}, documented as preliminary in GMP 4, has been removed.
@end itemize
There are a number of compatibility issues between GMP 1 and GMP 2 that of
-course also apply when porting applications from GMP 1 to GMP 5. Please
+course also apply when porting applications from GMP 1 to GMP 4. Please
see the GMP 2 manual for details.
+The Berkeley MP compatibility library (@pxref{BSD Compatible Functions}) is
+source and binary compatible with the standard @file{libmp}.
+
+@c @enumerate
@c @item Integer division functions round the result differently. The obsolete
@c functions (@code{mpz_div}, @code{mpz_divmod}, @code{mpz_mdiv},
@c @code{mpz_mdivmod}, etc) now all use floor rounding (i.e., they round the
@@ -2625,7 +2624,7 @@ Applications using the low-level @code{mpn} functions, however, will benefit
from @option{--enable-assert} since it adds checks on the parameters of most
such functions, many of which have subtle restrictions on their usage. Note
however that only the generic C code has checks, not the assembly code, so
-@option{--disable-assembly} should be used for maximum checking.
+CPU @samp{none} should be used for maximum checking.
@item Temporary Memory Checking
The build option @option{--enable-alloca=debug} arranges that each block of
@@ -2643,7 +2642,7 @@ To summarize the above, a GMP build for maximum debuggability would be
@example
./configure --disable-shared --enable-assert \
- --enable-alloca=debug --disable-assembly CFLAGS=-g
+ --enable-alloca=debug --host=none CFLAGS=-g
@end example
For C++, add @samp{--enable-cxx CXXFLAGS=-g}.
@@ -2651,7 +2650,7 @@ For C++, add @samp{--enable-cxx CXXFLAGS=-g}.
@item Checker
@cindex Checker
@cindex GCC Checker
-The GCC checker (@uref{https://savannah.nongnu.org/projects/checker/}) can be
+The GCC checker (@uref{http://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.
@@ -2660,30 +2659,23 @@ very very slowly. On GNU/Linux for example,
@cindex @command{checkergcc}
@example
-./configure --disable-assembly CC=checkergcc
+./configure --host=none-pc-linux-gnu CC=checkergcc
@end example
-@option{--disable-assembly} must be used, since the GMP assembly code doesn't
-support the checking scheme. The GMP C++ features cannot be used, since
-current versions of checker (0.9.9.1) don't yet support the standard C++
-library.
+@samp{--host=none} must be used, since the GMP assembly code doesn't support
+the checking scheme. The GMP C++ features cannot be used, since current
+versions of checker (0.9.9.1) don't yet support the standard C++ library.
@item Valgrind
@cindex Valgrind
-Valgrind (@uref{http://valgrind.org/}) is a memory checker for x86, ARM, MIPS,
-PowerPC, and S/390. It translates and emulates machine instructions to do
+The valgrind program (@uref{http://valgrind.org/}) is a memory
+checker for x86s. It translates and emulates machine instructions to do
strong checks for uninitialized data (at the level of individual bits), memory
accesses through bad pointers, and memory leaks.
-Valgrind does not always support every possible instruction, in particular
-ones recently added to an ISA. Valgrind might therefore be incompatible with
-a recent GMP or even a less recent GMP which is compiled using a recent GCC.
-
-GMP's assembly code sometimes promotes a read of the limbs to some larger size,
-for efficiency. GMP will do this even at the start and end of a multilimb
-operand, using naturally aligned operations on the larger type. This may lead
-to benign reads outside of allocated areas, triggering complaints from
-Valgrind. Valgrind's option @samp{--partial-loads-ok=yes} should help.
+Recent versions of Valgrind are getting support for MMX and SSE/SSE2
+instructions, for past versions GMP will need to be configured not to use
+those, ie.@: for an x86 without them (for instance plain @samp{i486}).
@item Other Problems
Any suspected bug in GMP itself should be isolated to make sure it's not an
@@ -2812,7 +2804,7 @@ found. For example,
@example
AC_CHECK_LIB(gmp, __gmpz_init, ,
- [AC_MSG_ERROR([GNU MP not found, see https://gmplib.org/])])
+ [AC_MSG_ERROR([GNU MP not found, see http://gmplib.org/])])
@end example
If functions added in some particular version of GMP are required, then one of
@@ -2822,7 +2814,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 https://gmplib.org/])])
+ [GNU MP not found, or not 3.1 or up, see http://gmplib.org/])])
@end example
An alternative would be to test the version number in @file{gmp.h} using say
@@ -2882,7 +2874,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{https://gmplib.org/} for patches for this release.
+to check @uref{http://gmplib.org/} for patches for this release.
Please include the following in any report,
@@ -2906,10 +2898,7 @@ informative (@samp{where} in @command{gdb}, or @samp{$C} in @command{adb}).
Please do not send core dumps, executables or @command{strace}s.
@item
-The @samp{configure} options you used when building GMP, if any.
-
-@item
-The output from @samp{configure}, as printed to stdout, with any options used.
+The configuration options you used when building GMP, if any.
@item
The name of the compiler and its version. For @command{gcc}, get the version
@@ -3009,23 +2998,15 @@ object is initialized.
Initialize @var{x}, and set its value to 0.
@end deftypefun
-@deftypefun void mpz_inits (mpz_t @var{x}, ...)
-Initialize a NULL-terminated list of @code{mpz_t} variables, and set their
-values to 0.
-@end deftypefun
-
-@deftypefun void mpz_init2 (mpz_t @var{x}, mp_bitcnt_t @var{n})
+@deftypefun void mpz_init2 (mpz_t @var{x}, unsigned long @var{n})
Initialize @var{x}, with space for @var{n}-bit numbers, and set its value to 0.
Calling this function instead of @code{mpz_init} or @code{mpz_inits} is never
necessary; reallocation is handled automatically by GMP when needed.
-While @var{n} defines the initial space, @var{x} will grow automatically in the
-normal way, if necessary, for subsequent values stored. @code{mpz_init2} makes
-it possible to avoid such reallocations if a maximum size is known in advance.
-
-In preparation for an operation, GMP often allocates one limb more than
-ultimately needed. To make sure GMP will not perform reallocation for
-@var{x}, you need to add the number of bits in @code{mp_limb_t} to @var{n}.
+@var{n} is only the initial space, @var{x} will grow automatically in
+the normal way, if necessary, for subsequent values stored. @code{mpz_init2}
+makes it possible to avoid such reallocations if a maximum size is known in
+advance.
@end deftypefun
@deftypefun void mpz_clear (mpz_t @var{x})
@@ -3033,11 +3014,7 @@ Free the space occupied by @var{x}. Call this function for all @code{mpz_t}
variables when you are done with them.
@end deftypefun
-@deftypefun void mpz_clears (mpz_t @var{x}, ...)
-Free the space occupied by a NULL-terminated list of @code{mpz_t} variables.
-@end deftypefun
-
-@deftypefun void mpz_realloc2 (mpz_t @var{x}, mp_bitcnt_t @var{n})
+@deftypefun void mpz_realloc2 (mpz_t @var{x}, unsigned long @var{n})
Change the space allocated for @var{x} to @var{n} bits. The value in @var{x}
is preserved if it fits, or is set to 0 if not.
@@ -3057,19 +3034,19 @@ to give memory back to the heap.
These functions assign new values to already initialized integers
(@pxref{Initializing Integers}).
-@deftypefun void mpz_set (mpz_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpz_set (mpz_t @var{rop}, mpz_t @var{op})
@deftypefunx void mpz_set_ui (mpz_t @var{rop}, unsigned long int @var{op})
@deftypefunx void mpz_set_si (mpz_t @var{rop}, signed long int @var{op})
@deftypefunx void mpz_set_d (mpz_t @var{rop}, double @var{op})
-@deftypefunx void mpz_set_q (mpz_t @var{rop}, const mpq_t @var{op})
-@deftypefunx void mpz_set_f (mpz_t @var{rop}, const mpf_t @var{op})
+@deftypefunx void mpz_set_q (mpz_t @var{rop}, mpq_t @var{op})
+@deftypefunx void mpz_set_f (mpz_t @var{rop}, mpf_t @var{op})
Set the value of @var{rop} from @var{op}.
@code{mpz_set_d}, @code{mpz_set_q} and @code{mpz_set_f} truncate @var{op} to
make it an integer.
@end deftypefun
-@deftypefun int mpz_set_str (mpz_t @var{rop}, const char *@var{str}, int @var{base})
+@deftypefun int mpz_set_str (mpz_t @var{rop}, char *@var{str}, int @var{base})
Set the value of @var{rop} from @var{str}, a null-terminated C string in base
@var{base}. White space is allowed in the string, and is simply ignored.
@@ -3128,7 +3105,7 @@ functions, it can be used as the source or destination operand for the ordinary
integer functions. Don't use an initialize-and-set function on a variable
already initialized!
-@deftypefun void mpz_init_set (mpz_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpz_init_set (mpz_t @var{rop}, mpz_t @var{op})
@deftypefunx void mpz_init_set_ui (mpz_t @var{rop}, unsigned long int @var{op})
@deftypefunx void mpz_init_set_si (mpz_t @var{rop}, signed long int @var{op})
@deftypefunx void mpz_init_set_d (mpz_t @var{rop}, double @var{op})
@@ -3136,7 +3113,7 @@ Initialize @var{rop} with limb space and set the initial numeric value from
@var{op}.
@end deftypefun
-@deftypefun int mpz_init_set_str (mpz_t @var{rop}, const char *@var{str}, int @var{base})
+@deftypefun int mpz_init_set_str (mpz_t @var{rop}, char *@var{str}, int @var{base})
Initialize @var{rop} and set its value like @code{mpz_set_str} (see its
documentation above for details).
@@ -3156,7 +3133,7 @@ This section describes functions for converting GMP integers to standard C
types. Functions for converting @emph{to} GMP integers are described in
@ref{Assigning Integers} and @ref{I/O of Integers}.
-@deftypefun {unsigned long int} mpz_get_ui (const mpz_t @var{op})
+@deftypefun {unsigned long int} mpz_get_ui (mpz_t @var{op})
Return the value of @var{op} as an @code{unsigned long}.
If @var{op} is too big to fit an @code{unsigned long} then just the least
@@ -3164,7 +3141,7 @@ significant bits that do fit are returned. The sign of @var{op} is ignored,
only the absolute value is used.
@end deftypefun
-@deftypefun {signed long int} mpz_get_si (const mpz_t @var{op})
+@deftypefun {signed long int} mpz_get_si (mpz_t @var{op})
If @var{op} fits into a @code{signed long int} return the value of @var{op}.
Otherwise return the least significant part of @var{op}, with the same sign
as @var{op}.
@@ -3174,8 +3151,8 @@ result is probably not very useful. To find out if the value will fit, use
the function @code{mpz_fits_slong_p}.
@end deftypefun
-@deftypefun double mpz_get_d (const mpz_t @var{op})
-Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
+@deftypefun double mpz_get_d (mpz_t @var{op})
+Convert @var{op} to a @code{double}, truncating if necessary (ie.@: rounding
towards zero).
If the exponent from the conversion is too big, the result is system
@@ -3183,8 +3160,8 @@ dependent. An infinity is returned where available. A hardware overflow trap
may or may not occur.
@end deftypefun
-@deftypefun double mpz_get_d_2exp (signed long int *@var{exp}, const mpz_t @var{op})
-Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
+@deftypefun double mpz_get_d_2exp (signed long int *@var{exp}, mpz_t @var{op})
+Convert @var{op} to a @code{double}, truncating if necessary (ie.@: rounding
towards zero), and returning the exponent separately.
The return value is in the range @math{0.5@le{}@GMPabs{@var{d}}<1} and the
@@ -3197,7 +3174,7 @@ This is similar to the standard C @code{frexp} function (@pxref{Normalization
Functions,,, libc, The GNU C Library Reference Manual}).
@end deftypefun
-@deftypefun {char *} mpz_get_str (char *@var{str}, int @var{base}, const mpz_t @var{op})
+@deftypefun {char *} mpz_get_str (char *@var{str}, int @var{base}, mpz_t @var{op})
Convert @var{op} to a string of digits in base @var{base}. The base argument
may vary from 2 to 62 or from @minus{}2 to @minus{}36.
@@ -3228,45 +3205,45 @@ or the given @var{str}.
@cindex Integer arithmetic functions
@cindex Arithmetic functions
-@deftypefun void mpz_add (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefunx void mpz_add_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpz_add (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefunx void mpz_add_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{op1} + @var{op2}}.
@end deftypefun
-@deftypefun void mpz_sub (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefunx void mpz_sub_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
-@deftypefunx void mpz_ui_sub (mpz_t @var{rop}, unsigned long int @var{op1}, const mpz_t @var{op2})
+@deftypefun void mpz_sub (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefunx void mpz_sub_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefunx void mpz_ui_sub (mpz_t @var{rop}, unsigned long int @var{op1}, mpz_t @var{op2})
Set @var{rop} to @var{op1} @minus{} @var{op2}.
@end deftypefun
-@deftypefun void mpz_mul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefunx void mpz_mul_si (mpz_t @var{rop}, const mpz_t @var{op1}, long int @var{op2})
-@deftypefunx void mpz_mul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpz_mul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefunx void mpz_mul_si (mpz_t @var{rop}, mpz_t @var{op1}, long int @var{op2})
+@deftypefunx void mpz_mul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}}.
@end deftypefun
-@deftypefun void mpz_addmul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefunx void mpz_addmul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpz_addmul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefunx void mpz_addmul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{rop} + @var{op1} @GMPtimes{} @var{op2}}.
@end deftypefun
-@deftypefun void mpz_submul (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefunx void mpz_submul_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpz_submul (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefunx void mpz_submul_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{rop} - @var{op1} @GMPtimes{} @var{op2}}.
@end deftypefun
-@deftypefun void mpz_mul_2exp (mpz_t @var{rop}, const mpz_t @var{op1}, mp_bitcnt_t @var{op2})
+@deftypefun void mpz_mul_2exp (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
@cindex Bit shift left
Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised to
@var{op2}}. This operation can also be defined as a left shift by @var{op2}
bits.
@end deftypefun
-@deftypefun void mpz_neg (mpz_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpz_neg (mpz_t @var{rop}, mpz_t @var{op})
Set @var{rop} to @minus{}@var{op}.
@end deftypefun
-@deftypefun void mpz_abs (mpz_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpz_abs (mpz_t @var{rop}, mpz_t @var{op})
Set @var{rop} to the absolute value of @var{op}.
@end deftypefun
@@ -3287,43 +3264,43 @@ same way as for normal C @code{int} arithmetic.
@c between each, and seem to let tex do a better job of page breaks than an
@c @sp 1 in the middle of one big set.
-@deftypefun void mpz_cdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx void mpz_cdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx void mpz_cdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
+@deftypefun void mpz_cdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx void mpz_cdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx void mpz_cdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
@maybepagebreak
-@deftypefunx {unsigned long int} mpz_cdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_cdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_cdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_cdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_cdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_cdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_cdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_cdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
@maybepagebreak
-@deftypefunx void mpz_cdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
-@deftypefunx void mpz_cdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+@deftypefunx void mpz_cdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{b}})
+@deftypefunx void mpz_cdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{b}})
@end deftypefun
-@deftypefun void mpz_fdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx void mpz_fdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx void mpz_fdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
+@deftypefun void mpz_fdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx void mpz_fdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx void mpz_fdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
@maybepagebreak
-@deftypefunx {unsigned long int} mpz_fdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_fdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_fdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_fdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_fdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_fdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_fdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_fdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
@maybepagebreak
-@deftypefunx void mpz_fdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
-@deftypefunx void mpz_fdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+@deftypefunx void mpz_fdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{b}})
+@deftypefunx void mpz_fdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{b}})
@end deftypefun
-@deftypefun void mpz_tdiv_q (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx void mpz_tdiv_r (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx void mpz_tdiv_qr (mpz_t @var{q}, mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
+@deftypefun void mpz_tdiv_q (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx void mpz_tdiv_r (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx void mpz_tdiv_qr (mpz_t @var{q}, mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
@maybepagebreak
-@deftypefunx {unsigned long int} mpz_tdiv_q_ui (mpz_t @var{q}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_tdiv_r_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_tdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{const mpz_t @var{n}}, @w{unsigned long int @var{d}})
-@deftypefunx {unsigned long int} mpz_tdiv_ui (const mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_tdiv_q_ui (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_tdiv_r_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_tdiv_qr_ui (mpz_t @var{q}, mpz_t @var{r}, @w{mpz_t @var{n}}, @w{unsigned long int @var{d}})
+@deftypefunx {unsigned long int} mpz_tdiv_ui (mpz_t @var{n}, @w{unsigned long int @var{d}})
@maybepagebreak
-@deftypefunx void mpz_tdiv_q_2exp (mpz_t @var{q}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
-@deftypefunx void mpz_tdiv_r_2exp (mpz_t @var{r}, const mpz_t @var{n}, @w{mp_bitcnt_t @var{b}})
+@deftypefunx void mpz_tdiv_q_2exp (mpz_t @var{q}, mpz_t @var{n}, @w{unsigned long int @var{b}})
+@deftypefunx void mpz_tdiv_r_2exp (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{b}})
@cindex Bit shift right
@sp 1
@@ -3371,8 +3348,8 @@ the same as the bitwise logical functions do, whereas @code{mpz_tdiv_q_2exp}
effectively treats @var{n} as sign and magnitude.
@end deftypefun
-@deftypefun void mpz_mod (mpz_t @var{r}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx {unsigned long int} mpz_mod_ui (mpz_t @var{r}, const mpz_t @var{n}, @w{unsigned long int @var{d}})
+@deftypefun void mpz_mod (mpz_t @var{r}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx {unsigned long int} mpz_mod_ui (mpz_t @var{r}, mpz_t @var{n}, @w{unsigned long int @var{d}})
Set @var{r} to @var{n} @code{mod} @var{d}. The sign of the divisor is
ignored; the result is always non-negative.
@@ -3381,8 +3358,8 @@ remainder as well as setting @var{r}. See @code{mpz_fdiv_ui} above if only
the return value is wanted.
@end deftypefun
-@deftypefun void mpz_divexact (mpz_t @var{q}, const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx void mpz_divexact_ui (mpz_t @var{q}, const mpz_t @var{n}, unsigned long @var{d})
+@deftypefun void mpz_divexact (mpz_t @var{q}, mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx void mpz_divexact_ui (mpz_t @var{q}, mpz_t @var{n}, unsigned long @var{d})
@cindex Exact division functions
Set @var{q} to @var{n}/@var{d}. These functions produce correct results only
when it is known in advance that @var{d} divides @var{n}.
@@ -3392,9 +3369,9 @@ best choice when exact division is known to occur, for example reducing a
rational to lowest terms.
@end deftypefun
-@deftypefun int mpz_divisible_p (const mpz_t @var{n}, const mpz_t @var{d})
-@deftypefunx int mpz_divisible_ui_p (const mpz_t @var{n}, unsigned long int @var{d})
-@deftypefunx int mpz_divisible_2exp_p (const mpz_t @var{n}, mp_bitcnt_t @var{b})
+@deftypefun int mpz_divisible_p (mpz_t @var{n}, mpz_t @var{d})
+@deftypefunx int mpz_divisible_ui_p (mpz_t @var{n}, unsigned long int @var{d})
+@deftypefunx int mpz_divisible_2exp_p (mpz_t @var{n}, unsigned long int @var{b})
@cindex Divisibility functions
Return non-zero if @var{n} is exactly divisible by @var{d}, or in the case of
@code{mpz_divisible_2exp_p} by @m{2^b,2^@var{b}}.
@@ -3405,9 +3382,9 @@ functions, @math{@var{d}=0} is accepted and following the rule it can be seen
that only 0 is considered divisible by 0.
@end deftypefun
-@deftypefun int mpz_congruent_p (const mpz_t @var{n}, const mpz_t @var{c}, const mpz_t @var{d})
-@deftypefunx int mpz_congruent_ui_p (const mpz_t @var{n}, unsigned long int @var{c}, unsigned long int @var{d})
-@deftypefunx int mpz_congruent_2exp_p (const mpz_t @var{n}, const mpz_t @var{c}, mp_bitcnt_t @var{b})
+@deftypefun int mpz_congruent_p (mpz_t @var{n}, mpz_t @var{c}, mpz_t @var{d})
+@deftypefunx int mpz_congruent_ui_p (mpz_t @var{n}, unsigned long int @var{c}, unsigned long int @var{d})
+@deftypefunx int mpz_congruent_2exp_p (mpz_t @var{n}, mpz_t @var{c}, unsigned long int @var{b})
@cindex Divisibility functions
@cindex Congruence functions
Return non-zero if @var{n} is congruent to @var{c} modulo @var{d}, or in the
@@ -3428,8 +3405,8 @@ only when exactly equal.
@cindex Exponentiation functions
@cindex Powering functions
-@deftypefun void mpz_powm (mpz_t @var{rop}, const mpz_t @var{base}, const mpz_t @var{exp}, const mpz_t @var{mod})
-@deftypefunx void mpz_powm_ui (mpz_t @var{rop}, const mpz_t @var{base}, unsigned long int @var{exp}, const mpz_t @var{mod})
+@deftypefun void mpz_powm (mpz_t @var{rop}, mpz_t @var{base}, mpz_t @var{exp}, mpz_t @var{mod})
+@deftypefunx void mpz_powm_ui (mpz_t @var{rop}, mpz_t @var{base}, unsigned long int @var{exp}, mpz_t @var{mod})
Set @var{rop} to @m{base^{exp} \bmod mod, (@var{base} raised to @var{exp})
modulo @var{mod}}.
@@ -3438,20 +3415,7 @@ Negative @var{exp} is supported if an inverse @math{@var{base}^@W{-1} @bmod
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 @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.
-
-This function is designed to take the same time 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. This function is intended for cryptographic purposes, where
-resilience to side-channel attacks is desired.
-@end deftypefun
-
-@deftypefun void mpz_pow_ui (mpz_t @var{rop}, const mpz_t @var{base}, unsigned long int @var{exp})
+@deftypefun void mpz_pow_ui (mpz_t @var{rop}, mpz_t @var{base}, unsigned long int @var{exp})
@deftypefunx void mpz_ui_pow_ui (mpz_t @var{rop}, unsigned long int @var{base}, unsigned long int @var{exp})
Set @var{rop} to @m{base^{exp}, @var{base} raised to @var{exp}}. The case
@math{0^0} yields 1.
@@ -3464,25 +3428,25 @@ Set @var{rop} to @m{base^{exp}, @var{base} raised to @var{exp}}. The case
@cindex Integer root functions
@cindex Root extraction functions
-@deftypefun int mpz_root (mpz_t @var{rop}, const mpz_t @var{op}, unsigned long int @var{n})
+@deftypefun int mpz_root (mpz_t @var{rop}, mpz_t @var{op}, unsigned long int @var{n})
Set @var{rop} to @m{\lfloor\root n \of {op}\rfloor@C{},} the truncated integer
part of the @var{n}th root of @var{op}. Return non-zero if the computation
was exact, i.e., if @var{op} is @var{rop} to the @var{n}th power.
@end deftypefun
-@deftypefun void mpz_rootrem (mpz_t @var{root}, mpz_t @var{rem}, const mpz_t @var{u}, unsigned long int @var{n})
+@deftypefun void mpz_rootrem (mpz_t @var{root}, mpz_t @var{rem}, mpz_t @var{u}, unsigned long int @var{n})
Set @var{root} to @m{\lfloor\root n \of {u}\rfloor@C{},} the truncated
integer part of the @var{n}th root of @var{u}. Set @var{rem} to the
remainder, @m{(@var{u} - @var{root}^n),
@var{u}@minus{}@var{root}**@var{n}}.
@end deftypefun
-@deftypefun void mpz_sqrt (mpz_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpz_sqrt (mpz_t @var{rop}, mpz_t @var{op})
Set @var{rop} to @m{\lfloor\sqrt{@var{op}}\rfloor@C{},} the truncated
integer part of the square root of @var{op}.
@end deftypefun
-@deftypefun void mpz_sqrtrem (mpz_t @var{rop1}, mpz_t @var{rop2}, const mpz_t @var{op})
+@deftypefun void mpz_sqrtrem (mpz_t @var{rop1}, mpz_t @var{rop2}, mpz_t @var{op})
Set @var{rop1} to @m{\lfloor\sqrt{@var{op}}\rfloor, the truncated integer part
of the square root of @var{op}}, like @code{mpz_sqrt}. Set @var{rop2} to the
remainder @m{(@var{op} - @var{rop1}^2),
@@ -3493,7 +3457,7 @@ If @var{rop1} and @var{rop2} are the same variable, the results are
undefined.
@end deftypefun
-@deftypefun int mpz_perfect_power_p (const mpz_t @var{op})
+@deftypefun int mpz_perfect_power_p (mpz_t @var{op})
@cindex Perfect power functions
@cindex Root testing functions
Return non-zero if @var{op} is a perfect power, i.e., if there exist integers
@@ -3505,7 +3469,7 @@ Negative values of @var{op} are accepted, but of course can only be odd
perfect powers.
@end deftypefun
-@deftypefun int mpz_perfect_square_p (const mpz_t @var{op})
+@deftypefun int mpz_perfect_square_p (mpz_t @var{op})
@cindex Perfect square functions
@cindex Root testing functions
Return non-zero if @var{op} is a perfect square, i.e., if the square root of
@@ -3519,7 +3483,7 @@ be perfect squares.
@section Number Theoretic Functions
@cindex Number theoretic functions
-@deftypefun int mpz_probab_prime_p (const mpz_t @var{n}, int @var{reps})
+@deftypefun int mpz_probab_prime_p (mpz_t @var{n}, int @var{reps})
@cindex Prime testing functions
@cindex Probable prime testing functions
Determine whether @var{n} is prime. Return 2 if @var{n} is definitely prime,
@@ -3527,10 +3491,9 @@ return 1 if @var{n} is probably prime (without being certain), or return 0 if
@var{n} is definitely composite.
This function does some trial divisions, then some Miller-Rabin probabilistic
-primality tests. The argument @var{reps} controls how many such tests are
-done; a higher value will reduce the chances of a composite being returned as
-``probably prime''. 25 is a reasonable number; a composite number will then be
-identified as a prime with a probability of less than @m{2^{-50},2^(-50)}.
+primality tests. @var{reps} controls how many such tests are done, 5 to 10 is
+a reasonable number, more will reduce the chances of a composite being
+returned as ``probably prime''.
Miller-Rabin and similar tests can be more properly called compositeness
tests. Numbers which fail are known to be composite but those which pass
@@ -3538,7 +3501,7 @@ might be prime or might be composite. Only a few composites pass, hence those
which pass are considered probably prime.
@end deftypefun
-@deftypefun void mpz_nextprime (mpz_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpz_nextprime (mpz_t @var{rop}, mpz_t @var{op})
@cindex Next prime function
Set @var{rop} to the next prime greater than @var{op}.
@@ -3549,7 +3512,7 @@ extremely small.
@c mpz_prime_p not implemented as of gmp 3.0.
-@c @deftypefun int mpz_prime_p (const mpz_t @var{n})
+@c @deftypefun int mpz_prime_p (mpz_t @var{n})
@c Return non-zero if @var{n} is prime and zero if @var{n} is a non-prime.
@c This function is far slower than @code{mpz_probab_prime_p}, but then it
@c never returns non-zero for composite numbers.
@@ -3560,15 +3523,15 @@ extremely small.
@c prime, if the @var{reps} argument is in the suggested range.)
@c @end deftypefun
-@deftypefun void mpz_gcd (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+@deftypefun void mpz_gcd (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
@cindex Greatest common divisor functions
@cindex GCD functions
-Set @var{rop} to the greatest common divisor of @var{op1} and @var{op2}. The
-result is always positive even if one or both input operands are negative.
-Except if both inputs are zero; then this function defines @math{gcd(0,0) = 0}.
+Set @var{rop} to the greatest common divisor of @var{op1} and @var{op2}.
+The result is always positive even if one or both input operands
+are negative.
@end deftypefun
-@deftypefun {unsigned long int} mpz_gcd_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefun {unsigned long int} mpz_gcd_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long int @var{op2})
Compute the greatest common divisor of @var{op1} and @var{op2}. If
@var{rop} is not @code{NULL}, store the result there.
@@ -3578,35 +3541,22 @@ to the argument @var{op1}. Note that the result will always fit if @var{op2}
is non-zero.
@end deftypefun
-@deftypefun void mpz_gcdext (mpz_t @var{g}, mpz_t @var{s}, mpz_t @var{t}, const mpz_t @var{a}, const mpz_t @var{b})
+@deftypefun void mpz_gcdext (mpz_t @var{g}, mpz_t @var{s}, mpz_t @var{t}, mpz_t @var{a}, mpz_t @var{b})
@cindex Extended GCD
@cindex GCD extended
Set @var{g} to the greatest common divisor of @var{a} and @var{b}, and in
addition set @var{s} and @var{t} to coefficients satisfying
@math{@var{a}@GMPmultiply{}@var{s} + @var{b}@GMPmultiply{}@var{t} = @var{g}}.
The value in @var{g} is always positive, even if one or both of @var{a} and
-@var{b} are negative (or zero if both inputs are zero). The values in @var{s}
-and @var{t} are chosen such that normally, @math{@GMPabs{@var{s}} <
-@GMPabs{@var{b}} / (2 @var{g})} and @math{@GMPabs{@var{t}} < @GMPabs{@var{a}}
-/ (2 @var{g})}, and these relations define @var{s} and @var{t} uniquely. There
-are a few exceptional cases:
-
-If @math{@GMPabs{@var{a}} = @GMPabs{@var{b}}}, then @math{@var{s} = 0},
-@math{@var{t} = sgn(@var{b})}.
-
-Otherwise, @math{@var{s} = sgn(@var{a})} if @math{@var{b} = 0} or
-@math{@GMPabs{@var{b}} = 2 @var{g}}, and @math{@var{t} = sgn(@var{b})} if
-@math{@var{a} = 0} or @math{@GMPabs{@var{a}} = 2 @var{g}}.
-
-In all cases, @math{@var{s} = 0} if and only if @math{@var{g} =
-@GMPabs{@var{b}}}, i.e., if @var{b} divides @var{a} or @math{@var{a} = @var{b}
-= 0}.
+@var{b} are negative. The values in @var{s} and @var{t} are chosen such that
+@math{@GMPabs{@var{s}} @le{} @GMPabs{@var{b}}} and @math{@GMPabs{@var{t}}
+@le{} @GMPabs{@var{a}}}.
If @var{t} is @code{NULL} then that value is not computed.
@end deftypefun
-@deftypefun void mpz_lcm (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefunx void mpz_lcm_ui (mpz_t @var{rop}, const mpz_t @var{op1}, unsigned long @var{op2})
+@deftypefun void mpz_lcm (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefunx void mpz_lcm_ui (mpz_t @var{rop}, mpz_t @var{op1}, unsigned long @var{op2})
@cindex Least common multiple functions
@cindex LCM functions
Set @var{rop} to the least common multiple of @var{op1} and @var{op2}.
@@ -3614,34 +3564,33 @@ Set @var{rop} to the least common multiple of @var{op1} and @var{op2}.
@var{op2}. @var{rop} will be zero if either @var{op1} or @var{op2} is zero.
@end deftypefun
-@deftypefun int mpz_invert (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+@deftypefun int mpz_invert (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
@cindex Modular inverse functions
@cindex Inverse modulo functions
Compute the inverse of @var{op1} modulo @var{op2} and put the result in
@var{rop}. If the inverse exists, the return value is non-zero and @var{rop}
-will satisfy @math{0 < @var{rop} < @GMPabs{@var{op2}}}. If an inverse doesn't
-exist the return value is zero and @var{rop} is undefined. The behaviour of
-this function is undefined when @var{op2} is zero.
+will satisfy @math{0 @le{} @var{rop} < @var{op2}}. If an inverse doesn't exist
+the return value is zero and @var{rop} is undefined.
@end deftypefun
-@deftypefun int mpz_jacobi (const mpz_t @var{a}, const mpz_t @var{b})
+@deftypefun int mpz_jacobi (mpz_t @var{a}, mpz_t @var{b})
@cindex Jacobi symbol functions
Calculate the Jacobi symbol @m{\left(a \over b\right),
(@var{a}/@var{b})}. This is defined only for @var{b} odd.
@end deftypefun
-@deftypefun int mpz_legendre (const mpz_t @var{a}, const mpz_t @var{p})
+@deftypefun int mpz_legendre (mpz_t @var{a}, mpz_t @var{p})
@cindex Legendre symbol functions
Calculate the Legendre symbol @m{\left(a \over p\right),
(@var{a}/@var{p})}. This is defined only for @var{p} an odd positive
prime, and for such @var{p} it's identical to the Jacobi symbol.
@end deftypefun
-@deftypefun int mpz_kronecker (const mpz_t @var{a}, const mpz_t @var{b})
-@deftypefunx int mpz_kronecker_si (const mpz_t @var{a}, long @var{b})
-@deftypefunx int mpz_kronecker_ui (const mpz_t @var{a}, unsigned long @var{b})
-@deftypefunx int mpz_si_kronecker (long @var{a}, const mpz_t @var{b})
-@deftypefunx int mpz_ui_kronecker (unsigned long @var{a}, const mpz_t @var{b})
+@deftypefun int mpz_kronecker (mpz_t @var{a}, mpz_t @var{b})
+@deftypefunx int mpz_kronecker_si (mpz_t @var{a}, long @var{b})
+@deftypefunx int mpz_kronecker_ui (mpz_t @var{a}, unsigned long @var{b})
+@deftypefunx int mpz_si_kronecker (long @var{a}, mpz_t @var{b})
+@deftypefunx int mpz_ui_kronecker (unsigned long @var{a}, mpz_t @var{b})
@cindex Kronecker symbol functions
Calculate the Jacobi symbol @m{\left(a \over b\right),
(@var{a}/@var{b})} with the Kronecker extension @m{\left(a \over
@@ -3657,7 +3606,7 @@ or any number theory textbook. See also the example program
@file{demos/qcn.c} which uses @code{mpz_kronecker_ui}.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpz_remove (mpz_t @var{rop}, const mpz_t @var{op}, const mpz_t @var{f})
+@deftypefun {unsigned long int} mpz_remove (mpz_t @var{rop}, mpz_t @var{op}, mpz_t @var{f})
@cindex Remove factor functions
@cindex Factor removal functions
Remove all occurrences of the factor @var{f} from @var{op} and store the
@@ -3665,22 +3614,12 @@ result in @var{rop}. The return value is how many such occurrences were
removed.
@end deftypefun
-@deftypefun void mpz_fac_ui (mpz_t @var{rop}, unsigned long int @var{n})
-@deftypefunx void mpz_2fac_ui (mpz_t @var{rop}, unsigned long int @var{n})
-@deftypefunx void mpz_mfac_uiui (mpz_t @var{rop}, unsigned long int @var{n}, unsigned long int @var{m})
+@deftypefun void mpz_fac_ui (mpz_t @var{rop}, unsigned long int @var{op})
@cindex Factorial functions
-Set @var{rop} to the factorial of @var{n}: @code{mpz_fac_ui} computes the plain factorial @var{n}!,
-@code{mpz_2fac_ui} computes the double-factorial @var{n}!!, and @code{mpz_mfac_uiui} the
-@var{m}-multi-factorial @m{n!^{(m)}, @var{n}!^(@var{m})}.
+Set @var{rop} to @var{op}!, the factorial of @var{op}.
@end deftypefun
-@deftypefun void mpz_primorial_ui (mpz_t @var{rop}, unsigned long int @var{n})
-@cindex Primorial functions
-Set @var{rop} to the primorial of @var{n}, i.e. the product of all positive
-prime numbers @math{@le{}@var{n}}.
-@end deftypefun
-
-@deftypefun void mpz_bin_ui (mpz_t @var{rop}, const mpz_t @var{n}, unsigned long int @var{k})
+@deftypefun void mpz_bin_ui (mpz_t @var{rop}, mpz_t @var{n}, unsigned long int @var{k})
@deftypefunx void mpz_bin_uiui (mpz_t @var{rop}, unsigned long int @var{n}, @w{unsigned long int @var{k}})
@cindex Binomial coefficient functions
Compute the binomial coefficient @m{\left({n}\atop{k}\right), @var{n} over
@@ -3729,10 +3668,10 @@ Algorithm}, the reverse is straightforward too.
@cindex Integer comparison functions
@cindex Comparison functions
-@deftypefn Function int mpz_cmp (const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefnx Function int mpz_cmp_d (const mpz_t @var{op1}, double @var{op2})
-@deftypefnx Macro int mpz_cmp_si (const mpz_t @var{op1}, signed long int @var{op2})
-@deftypefnx Macro int mpz_cmp_ui (const mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefn Function int mpz_cmp (mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefnx Function int mpz_cmp_d (mpz_t @var{op1}, double @var{op2})
+@deftypefnx Macro int mpz_cmp_si (mpz_t @var{op1}, signed long int @var{op2})
+@deftypefnx Macro int mpz_cmp_ui (mpz_t @var{op1}, unsigned long int @var{op2})
Compare @var{op1} and @var{op2}. Return a positive value if @math{@var{op1} >
@var{op2}}, zero if @math{@var{op1} = @var{op2}}, or a negative value if
@math{@var{op1} < @var{op2}}.
@@ -3742,9 +3681,9 @@ arguments more than once. @code{mpz_cmp_d} can be called with an infinity,
but results are undefined for a NaN.
@end deftypefn
-@deftypefn Function int mpz_cmpabs (const mpz_t @var{op1}, const mpz_t @var{op2})
-@deftypefnx Function int mpz_cmpabs_d (const mpz_t @var{op1}, double @var{op2})
-@deftypefnx Function int mpz_cmpabs_ui (const mpz_t @var{op1}, unsigned long int @var{op2})
+@deftypefn Function int mpz_cmpabs (mpz_t @var{op1}, mpz_t @var{op2})
+@deftypefnx Function int mpz_cmpabs_d (mpz_t @var{op1}, double @var{op2})
+@deftypefnx Function int mpz_cmpabs_ui (mpz_t @var{op1}, unsigned long int @var{op2})
Compare the absolute values of @var{op1} and @var{op2}. Return a positive
value if @math{@GMPabs{@var{op1}} > @GMPabs{@var{op2}}}, zero if
@math{@GMPabs{@var{op1}} = @GMPabs{@var{op2}}}, or a negative value if
@@ -3754,7 +3693,7 @@ value if @math{@GMPabs{@var{op1}} > @GMPabs{@var{op2}}}, zero if
for a NaN.
@end deftypefn
-@deftypefn Macro int mpz_sgn (const mpz_t @var{op})
+@deftypefn Macro int mpz_sgn (mpz_t @var{op})
@cindex Sign tests
@cindex Integer sign tests
Return @math{+1} if @math{@var{op} > 0}, 0 if @math{@var{op} = 0}, and
@@ -3777,39 +3716,40 @@ These functions behave as if twos complement arithmetic were used (although
sign-magnitude is the actual implementation). The least significant bit is
number 0.
-@deftypefun void mpz_and (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+@deftypefun void mpz_and (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
Set @var{rop} to @var{op1} bitwise-and @var{op2}.
@end deftypefun
-@deftypefun void mpz_ior (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+@deftypefun void mpz_ior (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
Set @var{rop} to @var{op1} bitwise inclusive-or @var{op2}.
@end deftypefun
-@deftypefun void mpz_xor (mpz_t @var{rop}, const mpz_t @var{op1}, const mpz_t @var{op2})
+@deftypefun void mpz_xor (mpz_t @var{rop}, mpz_t @var{op1}, mpz_t @var{op2})
Set @var{rop} to @var{op1} bitwise exclusive-or @var{op2}.
@end deftypefun
-@deftypefun void mpz_com (mpz_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpz_com (mpz_t @var{rop}, mpz_t @var{op})
Set @var{rop} to the one's complement of @var{op}.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpz_popcount (const mpz_t @var{op})
-If @math{@var{op}@ge{}0}, return the population count of @var{op}, which is the
-number of 1 bits in the binary representation. If @math{@var{op}<0}, the
-number of 1s is infinite, and the return value is the largest possible
-@code{mp_bitcnt_t}.
+@deftypefun {unsigned long int} mpz_popcount (mpz_t @var{op})
+If @math{@var{op}@ge{}0}, return the population count of @var{op}, which is
+the number of 1 bits in the binary representation. If @math{@var{op}<0}, the
+number of 1s is infinite, and the return value is @var{ULONG_MAX}, the largest
+possible @code{unsigned long}.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpz_hamdist (const mpz_t @var{op1}, const mpz_t @var{op2})
-If @var{op1} and @var{op2} are both @math{@ge{}0} or both @math{<0}, return the
-hamming distance between the two operands, which is the number of bit positions
-where @var{op1} and @var{op2} have different bit values. If one operand is
-@math{@ge{}0} and the other @math{<0} then the number of bits different is
-infinite, and the return value is the largest possible @code{mp_bitcnt_t}.
+@deftypefun {unsigned long int} mpz_hamdist (mpz_t @var{op1}, mpz_t @var{op2})
+If @var{op1} and @var{op2} are both @math{@ge{}0} or both @math{<0}, return
+the hamming distance between the two operands, which is the number of bit
+positions where @var{op1} and @var{op2} have different bit values. If one
+operand is @math{@ge{}0} and the other @math{<0} then the number of bits
+different is infinite, and the return value is @var{ULONG_MAX}, the largest
+possible @code{unsigned long}.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpz_scan0 (const mpz_t @var{op}, mp_bitcnt_t @var{starting_bit})
-@deftypefunx {mp_bitcnt_t} mpz_scan1 (const mpz_t @var{op}, mp_bitcnt_t @var{starting_bit})
+@deftypefun {unsigned long int} mpz_scan0 (mpz_t @var{op}, unsigned long int @var{starting_bit})
+@deftypefunx {unsigned long int} mpz_scan1 (mpz_t @var{op}, unsigned long int @var{starting_bit})
@cindex Bit scanning functions
@cindex Scan bit functions
Scan @var{op}, starting from bit @var{starting_bit}, towards more significant
@@ -3819,24 +3759,24 @@ the found bit.
If the bit at @var{starting_bit} is already what's sought, then
@var{starting_bit} is returned.
-If there's no bit found, then the largest possible @code{mp_bitcnt_t} is
-returned. This will happen in @code{mpz_scan0} past the end of a negative
-number, or @code{mpz_scan1} past the end of a nonnegative number.
+If there's no bit found, then @var{ULONG_MAX} is returned. This will happen
+in @code{mpz_scan0} past the end of a negative number, or @code{mpz_scan1}
+past the end of a nonnegative number.
@end deftypefun
-@deftypefun void mpz_setbit (mpz_t @var{rop}, mp_bitcnt_t @var{bit_index})
+@deftypefun void mpz_setbit (mpz_t @var{rop}, unsigned long int @var{bit_index})
Set bit @var{bit_index} in @var{rop}.
@end deftypefun
-@deftypefun void mpz_clrbit (mpz_t @var{rop}, mp_bitcnt_t @var{bit_index})
+@deftypefun void mpz_clrbit (mpz_t @var{rop}, unsigned long int @var{bit_index})
Clear bit @var{bit_index} in @var{rop}.
@end deftypefun
-@deftypefun void mpz_combit (mpz_t @var{rop}, mp_bitcnt_t @var{bit_index})
+@deftypefun void mpz_combit (mpz_t @var{rop}, unsigned long int @var{bit_index})
Complement bit @var{bit_index} in @var{rop}.
@end deftypefun
-@deftypefun int mpz_tstbit (const mpz_t @var{op}, mp_bitcnt_t @var{bit_index})
+@deftypefun int mpz_tstbit (mpz_t @var{op}, unsigned long int @var{bit_index})
Test bit @var{bit_index} in @var{op} and return 0 or 1 accordingly.
@end deftypefun
@@ -3849,17 +3789,15 @@ Test bit @var{bit_index} in @var{op} and return 0 or 1 accordingly.
@cindex I/O functions
Functions that perform input from a stdio stream, and functions that output to
-a stdio stream, of @code{mpz} numbers. Passing a @code{NULL} pointer for a
-@var{stream} argument to any of these functions will make them read from
-@code{stdin} and write to @code{stdout}, respectively.
+a stdio stream. Passing a @code{NULL} pointer for a @var{stream} argument to any of
+these functions will make them read from @code{stdin} and write to
+@code{stdout}, respectively.
When using any of these functions, it is a good idea to include @file{stdio.h}
before @file{gmp.h}, since that will allow @file{gmp.h} to define prototypes
for these functions.
-See also @ref{Formatted Output} and @ref{Formatted Input}.
-
-@deftypefun size_t mpz_out_str (FILE *@var{stream}, int @var{base}, const mpz_t @var{op})
+@deftypefun size_t mpz_out_str (FILE *@var{stream}, int @var{base}, mpz_t @var{op})
Output @var{op} on stdio stream @var{stream}, as a string of digits in base
@var{base}. The base argument may vary from 2 to 62 or from @minus{}2 to
@minus{}36.
@@ -3887,7 +3825,7 @@ the same value. For bases 37 to 62, upper-case letter represent the usual
Return the number of bytes read, or if an error occurred, return 0.
@end deftypefun
-@deftypefun size_t mpz_out_raw (FILE *@var{stream}, const mpz_t @var{op})
+@deftypefun size_t mpz_out_raw (FILE *@var{stream}, mpz_t @var{op})
Output @var{op} on stdio stream @var{stream}, in raw binary format. The
integer is written in a portable format, with 4 bytes of size information, and
that many bytes of limbs. Both the size and the limbs are written in
@@ -3925,7 +3863,7 @@ parameter that is read and modified. Please see the @ref{Random Number
Functions} for more information on how to use and not to use random
number functions.
-@deftypefun void mpz_urandomb (mpz_t @var{rop}, gmp_randstate_t @var{state}, mp_bitcnt_t @var{n})
+@deftypefun void mpz_urandomb (mpz_t @var{rop}, gmp_randstate_t @var{state}, unsigned long int @var{n})
Generate a uniformly distributed random integer in the range 0 to @m{2^n-1,
2^@var{n}@minus{}1}, inclusive.
@@ -3934,7 +3872,7 @@ The variable @var{state} must be initialized by calling one of the
invoking this function.
@end deftypefun
-@deftypefun void mpz_urandomm (mpz_t @var{rop}, gmp_randstate_t @var{state}, const mpz_t @var{n})
+@deftypefun void mpz_urandomm (mpz_t @var{rop}, gmp_randstate_t @var{state}, mpz_t @var{n})
Generate a uniform random integer in the range 0 to @math{@var{n}-1},
inclusive.
@@ -3943,7 +3881,7 @@ The variable @var{state} must be initialized by calling one of the
before invoking this function.
@end deftypefun
-@deftypefun void mpz_rrandomb (mpz_t @var{rop}, gmp_randstate_t @var{state}, mp_bitcnt_t @var{n})
+@deftypefun void mpz_rrandomb (mpz_t @var{rop}, gmp_randstate_t @var{state}, unsigned long int @var{n})
Generate a random integer with long strings of zeros and ones in the
binary representation. Useful for testing functions and algorithms,
since this kind of random numbers have proven to be more likely to
@@ -4017,7 +3955,7 @@ feature can account for this, by passing for instance
@code{8*sizeof(int)-INT_BIT}.
@end deftypefun
-@deftypefun {void *} mpz_export (void *@var{rop}, size_t *@var{countp}, int @var{order}, size_t @var{size}, int @var{endian}, size_t @var{nails}, const mpz_t @var{op})
+@deftypefun {void *} mpz_export (void *@var{rop}, size_t *@var{countp}, int @var{order}, size_t @var{size}, int @var{endian}, size_t @var{nails}, mpz_t @var{op})
@cindex Integer export
@cindex Export
Fill @var{rop} with word data from @var{op}.
@@ -4068,24 +4006,24 @@ p = malloc (count * size);
@cindex Miscellaneous integer functions
@cindex Integer miscellaneous functions
-@deftypefun int mpz_fits_ulong_p (const mpz_t @var{op})
-@deftypefunx int mpz_fits_slong_p (const mpz_t @var{op})
-@deftypefunx int mpz_fits_uint_p (const mpz_t @var{op})
-@deftypefunx int mpz_fits_sint_p (const mpz_t @var{op})
-@deftypefunx int mpz_fits_ushort_p (const mpz_t @var{op})
-@deftypefunx int mpz_fits_sshort_p (const mpz_t @var{op})
+@deftypefun int mpz_fits_ulong_p (mpz_t @var{op})
+@deftypefunx int mpz_fits_slong_p (mpz_t @var{op})
+@deftypefunx int mpz_fits_uint_p (mpz_t @var{op})
+@deftypefunx int mpz_fits_sint_p (mpz_t @var{op})
+@deftypefunx int mpz_fits_ushort_p (mpz_t @var{op})
+@deftypefunx int mpz_fits_sshort_p (mpz_t @var{op})
Return non-zero iff the value of @var{op} fits in an @code{unsigned long int},
@code{signed long int}, @code{unsigned int}, @code{signed int}, @code{unsigned
short int}, or @code{signed short int}, respectively. Otherwise, return zero.
@end deftypefun
-@deftypefn Macro int mpz_odd_p (const mpz_t @var{op})
-@deftypefnx Macro int mpz_even_p (const mpz_t @var{op})
+@deftypefn Macro int mpz_odd_p (mpz_t @var{op})
+@deftypefnx Macro int mpz_even_p (mpz_t @var{op})
Determine whether @var{op} is odd or even, respectively. Return non-zero if
yes, zero if no. These macros evaluate their argument more than once.
@end deftypefn
-@deftypefun size_t mpz_sizeinbase (const mpz_t @var{op}, int @var{base})
+@deftypefun size_t mpz_sizeinbase (mpz_t @var{op}, int @var{base})
@cindex Size in digits
@cindex Digits in an integer
Return the size of @var{op} measured in number of digits in the given
@@ -4116,7 +4054,57 @@ 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}})
-@strong{This is an obsolete function. Do not use it.}
+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_ui} 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}.
@end deftypefun
@deftypefun {void *} _mpz_realloc (mpz_t @var{integer}, mp_size_t @var{new_alloc})
@@ -4129,7 +4117,7 @@ this. @code{mpz_realloc2} and @code{_mpz_realloc} are the same except that
@code{_mpz_realloc} takes its size in limbs.
@end deftypefun
-@deftypefun mp_limb_t mpz_getlimbn (const mpz_t @var{op}, mp_size_t @var{n})
+@deftypefun mp_limb_t mpz_getlimbn (mpz_t @var{op}, mp_size_t @var{n})
Return limb number @var{n} from @var{op}. The sign of @var{op} is ignored,
just the absolute value is used. The least significant limb is number 0.
@@ -4138,88 +4126,12 @@ just the absolute value is used. The least significant limb is number 0.
@code{mpz_size(@var{op})-1}.
@end deftypefun
-@deftypefun size_t mpz_size (const mpz_t @var{op})
+@deftypefun size_t mpz_size (mpz_t @var{op})
Return the size of @var{op} measured in number of limbs. If @var{op} is zero,
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
@@ -4269,22 +4181,13 @@ initialized once, or at least cleared out (using the function @code{mpq_clear})
between each initialization.
@end deftypefun
-@deftypefun void mpq_inits (mpq_t @var{x}, ...)
-Initialize a NULL-terminated list of @code{mpq_t} variables, and set their
-values to 0/1.
-@end deftypefun
-
@deftypefun void mpq_clear (mpq_t @var{x})
Free the space occupied by @var{x}. Make sure to call this function for all
@code{mpq_t} variables when you are done with them.
@end deftypefun
-@deftypefun void mpq_clears (mpq_t @var{x}, ...)
-Free the space occupied by a NULL-terminated list of @code{mpq_t} variables.
-@end deftypefun
-
-@deftypefun void mpq_set (mpq_t @var{rop}, const mpq_t @var{op})
-@deftypefunx void mpq_set_z (mpq_t @var{rop}, const mpz_t @var{op})
+@deftypefun void mpq_set (mpq_t @var{rop}, mpq_t @var{op})
+@deftypefunx void mpq_set_z (mpq_t @var{rop}, mpz_t @var{op})
Assign @var{rop} from @var{op}.
@end deftypefun
@@ -4295,7 +4198,7 @@ Set the value of @var{rop} to @var{op1}/@var{op2}. Note that if @var{op1} and
@code{mpq_canonicalize} before any operations are performed on @var{rop}.
@end deftypefun
-@deftypefun int mpq_set_str (mpq_t @var{rop}, const char *@var{str}, int @var{base})
+@deftypefun int mpq_set_str (mpq_t @var{rop}, char *@var{str}, int @var{base})
Set @var{rop} from a null-terminated string @var{str} in the given @var{base}.
The string can be an integer like ``41'' or a fraction like ``41/152''. The
@@ -4327,8 +4230,8 @@ Swap the values @var{rop1} and @var{rop2} efficiently.
@cindex Rational conversion functions
@cindex Conversion functions
-@deftypefun double mpq_get_d (const mpq_t @var{op})
-Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
+@deftypefun double mpq_get_d (mpq_t @var{op})
+Convert @var{op} to a @code{double}, truncating if necessary (ie.@: rounding
towards zero).
If the exponent from the conversion is too big or too small to fit a
@@ -4338,12 +4241,12 @@ Hardware overflow, underflow and denorm traps may or may not occur.
@end deftypefun
@deftypefun void mpq_set_d (mpq_t @var{rop}, double @var{op})
-@deftypefunx void mpq_set_f (mpq_t @var{rop}, const mpf_t @var{op})
+@deftypefunx void mpq_set_f (mpq_t @var{rop}, mpf_t @var{op})
Set @var{rop} to the value of @var{op}. There is no rounding, this conversion
is exact.
@end deftypefun
-@deftypefun {char *} mpq_get_str (char *@var{str}, int @var{base}, const mpq_t @var{op})
+@deftypefun {char *} mpq_get_str (char *@var{str}, int @var{base}, mpq_t @var{op})
Convert @var{op} to a string of digits in base @var{base}. The base may vary
from 2 to 36. The string will be of the form @samp{num/den}, or if the
denominator is 1 then just @samp{num}.
@@ -4375,42 +4278,42 @@ or the given @var{str}.
@cindex Rational arithmetic functions
@cindex Arithmetic functions
-@deftypefun void mpq_add (mpq_t @var{sum}, const mpq_t @var{addend1}, const mpq_t @var{addend2})
+@deftypefun void mpq_add (mpq_t @var{sum}, mpq_t @var{addend1}, mpq_t @var{addend2})
Set @var{sum} to @var{addend1} + @var{addend2}.
@end deftypefun
-@deftypefun void mpq_sub (mpq_t @var{difference}, const mpq_t @var{minuend}, const mpq_t @var{subtrahend})
+@deftypefun void mpq_sub (mpq_t @var{difference}, mpq_t @var{minuend}, mpq_t @var{subtrahend})
Set @var{difference} to @var{minuend} @minus{} @var{subtrahend}.
@end deftypefun
-@deftypefun void mpq_mul (mpq_t @var{product}, const mpq_t @var{multiplier}, const mpq_t @var{multiplicand})
+@deftypefun void mpq_mul (mpq_t @var{product}, mpq_t @var{multiplier}, mpq_t @var{multiplicand})
Set @var{product} to @math{@var{multiplier} @GMPtimes{} @var{multiplicand}}.
@end deftypefun
-@deftypefun void mpq_mul_2exp (mpq_t @var{rop}, const mpq_t @var{op1}, mp_bitcnt_t @var{op2})
+@deftypefun void mpq_mul_2exp (mpq_t @var{rop}, mpq_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised to
@var{op2}}.
@end deftypefun
-@deftypefun void mpq_div (mpq_t @var{quotient}, const mpq_t @var{dividend}, const mpq_t @var{divisor})
+@deftypefun void mpq_div (mpq_t @var{quotient}, mpq_t @var{dividend}, mpq_t @var{divisor})
@cindex Division functions
Set @var{quotient} to @var{dividend}/@var{divisor}.
@end deftypefun
-@deftypefun void mpq_div_2exp (mpq_t @var{rop}, const mpq_t @var{op1}, mp_bitcnt_t @var{op2})
+@deftypefun void mpq_div_2exp (mpq_t @var{rop}, mpq_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @m{@var{op1}/2^{op2}, @var{op1} divided by 2 raised to
@var{op2}}.
@end deftypefun
-@deftypefun void mpq_neg (mpq_t @var{negated_operand}, const mpq_t @var{operand})
+@deftypefun void mpq_neg (mpq_t @var{negated_operand}, mpq_t @var{operand})
Set @var{negated_operand} to @minus{}@var{operand}.
@end deftypefun
-@deftypefun void mpq_abs (mpq_t @var{rop}, const mpq_t @var{op})
+@deftypefun void mpq_abs (mpq_t @var{rop}, mpq_t @var{op})
Set @var{rop} to the absolute value of @var{op}.
@end deftypefun
-@deftypefun void mpq_inv (mpq_t @var{inverted_number}, const mpq_t @var{number})
+@deftypefun void mpq_inv (mpq_t @var{inverted_number}, mpq_t @var{number})
Set @var{inverted_number} to 1/@var{number}. If the new denominator is
zero, this routine will divide by zero.
@end deftypefun
@@ -4421,7 +4324,7 @@ zero, this routine will divide by zero.
@cindex Rational comparison functions
@cindex Comparison functions
-@deftypefun int mpq_cmp (const mpq_t @var{op1}, const mpq_t @var{op2})
+@deftypefun int mpq_cmp (mpq_t @var{op1}, mpq_t @var{op2})
Compare @var{op1} and @var{op2}. Return a positive value if @math{@var{op1} >
@var{op2}}, zero if @math{@var{op1} = @var{op2}}, and a negative value if
@math{@var{op1} < @var{op2}}.
@@ -4430,8 +4333,8 @@ To determine if two rationals are equal, @code{mpq_equal} is faster than
@code{mpq_cmp}.
@end deftypefun
-@deftypefn Macro int mpq_cmp_ui (const mpq_t @var{op1}, unsigned long int @var{num2}, unsigned long int @var{den2})
-@deftypefnx Macro int mpq_cmp_si (const mpq_t @var{op1}, long int @var{num2}, unsigned long int @var{den2})
+@deftypefn Macro int mpq_cmp_ui (mpq_t @var{op1}, unsigned long int @var{num2}, unsigned long int @var{den2})
+@deftypefnx Macro int mpq_cmp_si (mpq_t @var{op1}, long int @var{num2}, unsigned long int @var{den2})
Compare @var{op1} and @var{num2}/@var{den2}. Return a positive value if
@math{@var{op1} > @var{num2}/@var{den2}}, zero if @math{@var{op1} =
@var{num2}/@var{den2}}, and a negative value if @math{@var{op1} <
@@ -4443,17 +4346,17 @@ These functions are implemented as a macros and evaluate their arguments
multiple times.
@end deftypefn
-@deftypefn Macro int mpq_sgn (const mpq_t @var{op})
+@deftypefn Macro int mpq_sgn (mpq_t @var{op})
@cindex Sign tests
@cindex Rational sign tests
Return @math{+1} if @math{@var{op} > 0}, 0 if @math{@var{op} = 0}, and
@math{-1} if @math{@var{op} < 0}.
This function is actually implemented as a macro. It evaluates its
-argument multiple times.
+arguments multiple times.
@end deftypefn
-@deftypefun int mpq_equal (const mpq_t @var{op1}, const mpq_t @var{op2})
+@deftypefun int mpq_equal (mpq_t @var{op1}, mpq_t @var{op2})
Return non-zero if @var{op1} and @var{op2} are equal, zero if they are
non-equal. Although @code{mpq_cmp} can be used for the same purpose, this
function is much faster.
@@ -4474,16 +4377,16 @@ Note that if an assignment to the numerator and/or denominator could take an
(@pxref{Rational Number Functions}) then @code{mpq_canonicalize} must be
called before any other @code{mpq} functions are applied to that @code{mpq_t}.
-@deftypefn Macro mpz_t mpq_numref (const mpq_t @var{op})
-@deftypefnx Macro mpz_t mpq_denref (const mpq_t @var{op})
+@deftypefn Macro mpz_t mpq_numref (mpq_t @var{op})
+@deftypefnx Macro mpz_t mpq_denref (mpq_t @var{op})
Return a reference to the numerator and denominator of @var{op}, respectively.
The @code{mpz} functions can be used on the result of these macros.
@end deftypefn
-@deftypefun void mpq_get_num (mpz_t @var{numerator}, const mpq_t @var{rational})
-@deftypefunx void mpq_get_den (mpz_t @var{denominator}, const mpq_t @var{rational})
-@deftypefunx void mpq_set_num (mpq_t @var{rational}, const mpz_t @var{numerator})
-@deftypefunx void mpq_set_den (mpq_t @var{rational}, const mpz_t @var{denominator})
+@deftypefun void mpq_get_num (mpz_t @var{numerator}, mpq_t @var{rational})
+@deftypefunx void mpq_get_den (mpz_t @var{denominator}, mpq_t @var{rational})
+@deftypefunx void mpq_set_num (mpq_t @var{rational}, mpz_t @var{numerator})
+@deftypefunx void mpq_set_den (mpq_t @var{rational}, mpz_t @var{denominator})
Get or set the numerator or denominator of a rational. These functions are
equivalent to calling @code{mpz_set} with an appropriate @code{mpq_numref} or
@code{mpq_denref}. Direct use of @code{mpq_numref} or @code{mpq_denref} is
@@ -4500,18 +4403,15 @@ recommended instead of these functions.
@cindex Output functions
@cindex I/O functions
-Functions that perform input from a stdio stream, and functions that output to
-a stdio stream, of @code{mpq} numbers. Passing a @code{NULL} pointer for a
-@var{stream} argument to any of these functions will make them read from
-@code{stdin} and write to @code{stdout}, respectively.
-
-When using any of these functions, it is a good idea to include @file{stdio.h}
+When using any of these functions, it's a good idea to include @file{stdio.h}
before @file{gmp.h}, since that will allow @file{gmp.h} to define prototypes
for these functions.
-See also @ref{Formatted Output} and @ref{Formatted Input}.
+Passing a @code{NULL} pointer for a @var{stream} argument to any of these
+functions will make them read from @code{stdin} and write to @code{stdout},
+respectively.
-@deftypefun size_t mpq_out_str (FILE *@var{stream}, int @var{base}, const mpq_t @var{op})
+@deftypefun size_t mpq_out_str (FILE *@var{stream}, int @var{base}, mpq_t @var{op})
Output @var{op} on stdio stream @var{stream}, as a string of digits in base
@var{base}. The base may vary from 2 to 36. Output is in the form
@samp{num/den} or if the denominator is 1 then just @samp{num}.
@@ -4559,7 +4459,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 that @code{mpf_get_str} can only return an
+this will be greater. Note however @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}.
@@ -4572,19 +4472,21 @@ 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 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 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 mantissa is stored in binary. One consequence of this is that decimal
+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
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.)
-The @code{mpf} functions and variables have no special notion of infinity or
+@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.
@@ -4593,10 +4495,6 @@ 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::
@@ -4614,13 +4512,13 @@ rounding, and thereby naturally extends IEEE P754.
@cindex Float initialization functions
@cindex Initialization functions
-@deftypefun void mpf_set_default_prec (mp_bitcnt_t @var{prec})
+@deftypefun void mpf_set_default_prec (unsigned long int @var{prec})
Set the default precision to be @strong{at least} @var{prec} bits. All
subsequent calls to @code{mpf_init} will use this precision, but previously
initialized variables are unaffected.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpf_get_default_prec (void)
+@deftypefun {unsigned long int} mpf_get_default_prec (void)
Return the default precision actually used.
@end deftypefun
@@ -4635,28 +4533,17 @@ precision of @var{x} is undefined unless a default precision has already been
established by a call to @code{mpf_set_default_prec}.
@end deftypefun
-@deftypefun void mpf_init2 (mpf_t @var{x}, mp_bitcnt_t @var{prec})
+@deftypefun void mpf_init2 (mpf_t @var{x}, unsigned long int @var{prec})
Initialize @var{x} to 0 and set its precision to be @strong{at least}
@var{prec} bits. Normally, a variable should be initialized once only or at
least be cleared, using @code{mpf_clear}, between initializations.
@end deftypefun
-@deftypefun void mpf_inits (mpf_t @var{x}, ...)
-Initialize a NULL-terminated list of @code{mpf_t} variables, and set their
-values to 0. The precision of the initialized variables is undefined unless a
-default precision has already been established by a call to
-@code{mpf_set_default_prec}.
-@end deftypefun
-
@deftypefun void mpf_clear (mpf_t @var{x})
Free the space occupied by @var{x}. Make sure to call this function for all
@code{mpf_t} variables when you are done with them.
@end deftypefun
-@deftypefun void mpf_clears (mpf_t @var{x}, ...)
-Free the space occupied by a NULL-terminated list of @code{mpf_t} variables.
-@end deftypefun
-
@need 2000
Here is an example on how to initialize floating-point variables:
@example
@@ -4676,11 +4563,11 @@ calculation. A typical use would be for adjusting the precision gradually in
iterative algorithms like Newton-Raphson, making the computation precision
closely match the actual accurate part of the numbers.
-@deftypefun {mp_bitcnt_t} mpf_get_prec (const mpf_t @var{op})
+@deftypefun {unsigned long int} mpf_get_prec (mpf_t @var{op})
Return the current precision of @var{op}, in bits.
@end deftypefun
-@deftypefun void mpf_set_prec (mpf_t @var{rop}, mp_bitcnt_t @var{prec})
+@deftypefun void mpf_set_prec (mpf_t @var{rop}, unsigned long int @var{prec})
Set the precision of @var{rop} to be @strong{at least} @var{prec} bits. The
value in @var{rop} will be truncated to the new precision.
@@ -4688,7 +4575,7 @@ This function requires a call to @code{realloc}, and so should not be used in
a tight loop.
@end deftypefun
-@deftypefun void mpf_set_prec_raw (mpf_t @var{rop}, mp_bitcnt_t @var{prec})
+@deftypefun void mpf_set_prec_raw (mpf_t @var{rop}, unsigned long int @var{prec})
Set the precision of @var{rop} to be @strong{at least} @var{prec} bits,
without changing the memory allocated.
@@ -4725,16 +4612,16 @@ different purposes during a calculation.
These functions assign new values to already initialized floats
(@pxref{Initializing Floats}).
-@deftypefun void mpf_set (mpf_t @var{rop}, const mpf_t @var{op})
+@deftypefun void mpf_set (mpf_t @var{rop}, mpf_t @var{op})
@deftypefunx void mpf_set_ui (mpf_t @var{rop}, unsigned long int @var{op})
@deftypefunx void mpf_set_si (mpf_t @var{rop}, signed long int @var{op})
@deftypefunx void mpf_set_d (mpf_t @var{rop}, double @var{op})
-@deftypefunx void mpf_set_z (mpf_t @var{rop}, const mpz_t @var{op})
-@deftypefunx void mpf_set_q (mpf_t @var{rop}, const mpq_t @var{op})
+@deftypefunx void mpf_set_z (mpf_t @var{rop}, mpz_t @var{op})
+@deftypefunx void mpf_set_q (mpf_t @var{rop}, mpq_t @var{op})
Set the value of @var{rop} from @var{op}.
@end deftypefun
-@deftypefun int mpf_set_str (mpf_t @var{rop}, const char *@var{str}, int @var{base})
+@deftypefun int mpf_set_str (mpf_t @var{rop}, char *@var{str}, int @var{base})
Set the value of @var{rop} from the string in @var{str}. The string is of the
form @samp{M@@N} or, if the base is 10 or less, alternatively @samp{MeN}.
@samp{M} is the mantissa and @samp{N} is the exponent. The mantissa is always
@@ -4789,7 +4676,7 @@ functions, it can be used as the source or destination operand for the ordinary
float functions. Don't use an initialize-and-set function on a variable
already initialized!
-@deftypefun void mpf_init_set (mpf_t @var{rop}, const mpf_t @var{op})
+@deftypefun void mpf_init_set (mpf_t @var{rop}, mpf_t @var{op})
@deftypefunx void mpf_init_set_ui (mpf_t @var{rop}, unsigned long int @var{op})
@deftypefunx void mpf_init_set_si (mpf_t @var{rop}, signed long int @var{op})
@deftypefunx void mpf_init_set_d (mpf_t @var{rop}, double @var{op})
@@ -4799,7 +4686,7 @@ The precision of @var{rop} will be taken from the active default precision, as
set by @code{mpf_set_default_prec}.
@end deftypefun
-@deftypefun int mpf_init_set_str (mpf_t @var{rop}, const char *@var{str}, int @var{base})
+@deftypefun int mpf_init_set_str (mpf_t @var{rop}, char *@var{str}, int @var{base})
Initialize @var{rop} and set its value from the string in @var{str}. See
@code{mpf_set_str} above for details on the assignment operation.
@@ -4817,8 +4704,8 @@ set by @code{mpf_set_default_prec}.
@cindex Float conversion functions
@cindex Conversion functions
-@deftypefun double mpf_get_d (const mpf_t @var{op})
-Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
+@deftypefun double mpf_get_d (mpf_t @var{op})
+Convert @var{op} to a @code{double}, truncating if necessary (ie.@: rounding
towards zero).
If the exponent in @var{op} is too big or too small to fit a @code{double}
@@ -4827,22 +4714,22 @@ available. For too small @math{0.0} is normally returned. Hardware overflow,
underflow and denorm traps may or may not occur.
@end deftypefun
-@deftypefun double mpf_get_d_2exp (signed long int *@var{exp}, const mpf_t @var{op})
-Convert @var{op} to a @code{double}, truncating if necessary (i.e.@: rounding
+@deftypefun double mpf_get_d_2exp (signed long int *@var{exp}, mpf_t @var{op})
+Convert @var{op} to a @code{double}, truncating if necessary (ie.@: 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} \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}}.
+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}}.
@cindex @code{frexp}
This is similar to the standard C @code{frexp} function (@pxref{Normalization
Functions,,, libc, The GNU C Library Reference Manual}).
@end deftypefun
-@deftypefun long mpf_get_si (const mpf_t @var{op})
-@deftypefunx {unsigned long} mpf_get_ui (const mpf_t @var{op})
+@deftypefun long mpf_get_si (mpf_t @var{op})
+@deftypefunx {unsigned long} mpf_get_ui (mpf_t @var{op})
Convert @var{op} to a @code{long} or @code{unsigned long}, truncating any
fraction part. If @var{op} is too big for the return type, the result is
undefined.
@@ -4851,7 +4738,7 @@ See also @code{mpf_fits_slong_p} and @code{mpf_fits_ulong_p}
(@pxref{Miscellaneous Float Functions}).
@end deftypefun
-@deftypefun {char *} mpf_get_str (char *@var{str}, mp_exp_t *@var{expptr}, int @var{base}, size_t @var{n_digits}, const mpf_t @var{op})
+@deftypefun {char *} mpf_get_str (char *@var{str}, mp_exp_t *@var{expptr}, int @var{base}, size_t @var{n_digits}, mpf_t @var{op})
Convert @var{op} to a string of digits in base @var{base}. The base argument
may vary from 2 to 62 or from @minus{}2 to @minus{}36. Up to @var{n_digits}
digits will be generated. Trailing zeros are not returned. No more digits
@@ -4893,19 +4780,19 @@ or the given @var{str}.
@cindex Float arithmetic functions
@cindex Arithmetic functions
-@deftypefun void mpf_add (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
-@deftypefunx void mpf_add_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpf_add (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
+@deftypefunx void mpf_add_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{op1} + @var{op2}}.
@end deftypefun
-@deftypefun void mpf_sub (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
-@deftypefunx void mpf_ui_sub (mpf_t @var{rop}, unsigned long int @var{op1}, const mpf_t @var{op2})
-@deftypefunx void mpf_sub_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpf_sub (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
+@deftypefunx void mpf_ui_sub (mpf_t @var{rop}, unsigned long int @var{op1}, mpf_t @var{op2})
+@deftypefunx void mpf_sub_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @var{op1} @minus{} @var{op2}.
@end deftypefun
-@deftypefun void mpf_mul (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
-@deftypefunx void mpf_mul_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpf_mul (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
+@deftypefunx void mpf_mul_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @math{@var{op1} @GMPtimes{} @var{op2}}.
@end deftypefun
@@ -4914,39 +4801,39 @@ divide functions will make these functions intentionally divide by zero. This
lets the user handle arithmetic exceptions in these functions in the same
manner as other arithmetic exceptions.
-@deftypefun void mpf_div (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
-@deftypefunx void mpf_ui_div (mpf_t @var{rop}, unsigned long int @var{op1}, const mpf_t @var{op2})
-@deftypefunx void mpf_div_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpf_div (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
+@deftypefunx void mpf_ui_div (mpf_t @var{rop}, unsigned long int @var{op1}, mpf_t @var{op2})
+@deftypefunx void mpf_div_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
@cindex Division functions
Set @var{rop} to @var{op1}/@var{op2}.
@end deftypefun
-@deftypefun void mpf_sqrt (mpf_t @var{rop}, const mpf_t @var{op})
+@deftypefun void mpf_sqrt (mpf_t @var{rop}, mpf_t @var{op})
@deftypefunx void mpf_sqrt_ui (mpf_t @var{rop}, unsigned long int @var{op})
@cindex Root extraction functions
Set @var{rop} to @m{\sqrt{@var{op}}, the square root of @var{op}}.
@end deftypefun
-@deftypefun void mpf_pow_ui (mpf_t @var{rop}, const mpf_t @var{op1}, unsigned long int @var{op2})
+@deftypefun void mpf_pow_ui (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
@cindex Exponentiation functions
@cindex Powering functions
Set @var{rop} to @m{@var{op1}^{op2}, @var{op1} raised to the power @var{op2}}.
@end deftypefun
-@deftypefun void mpf_neg (mpf_t @var{rop}, const mpf_t @var{op})
+@deftypefun void mpf_neg (mpf_t @var{rop}, mpf_t @var{op})
Set @var{rop} to @minus{}@var{op}.
@end deftypefun
-@deftypefun void mpf_abs (mpf_t @var{rop}, const mpf_t @var{op})
+@deftypefun void mpf_abs (mpf_t @var{rop}, mpf_t @var{op})
Set @var{rop} to the absolute value of @var{op}.
@end deftypefun
-@deftypefun void mpf_mul_2exp (mpf_t @var{rop}, const mpf_t @var{op1}, mp_bitcnt_t @var{op2})
+@deftypefun void mpf_mul_2exp (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @m{@var{op1} \times 2^{op2}, @var{op1} times 2 raised to
@var{op2}}.
@end deftypefun
-@deftypefun void mpf_div_2exp (mpf_t @var{rop}, const mpf_t @var{op1}, mp_bitcnt_t @var{op2})
+@deftypefun void mpf_div_2exp (mpf_t @var{rop}, mpf_t @var{op1}, unsigned long int @var{op2})
Set @var{rop} to @m{@var{op1}/2^{op2}, @var{op1} divided by 2 raised to
@var{op2}}.
@end deftypefun
@@ -4957,10 +4844,10 @@ Set @var{rop} to @m{@var{op1}/2^{op2}, @var{op1} divided by 2 raised to
@cindex Float comparison functions
@cindex Comparison functions
-@deftypefun int mpf_cmp (const mpf_t @var{op1}, const mpf_t @var{op2})
-@deftypefunx int mpf_cmp_d (const mpf_t @var{op1}, double @var{op2})
-@deftypefunx int mpf_cmp_ui (const mpf_t @var{op1}, unsigned long int @var{op2})
-@deftypefunx int mpf_cmp_si (const mpf_t @var{op1}, signed long int @var{op2})
+@deftypefun int mpf_cmp (mpf_t @var{op1}, mpf_t @var{op2})
+@deftypefunx int mpf_cmp_d (mpf_t @var{op1}, double @var{op2})
+@deftypefunx int mpf_cmp_ui (mpf_t @var{op1}, unsigned long int @var{op2})
+@deftypefunx int mpf_cmp_si (mpf_t @var{op1}, signed long int @var{op2})
Compare @var{op1} and @var{op2}. Return a positive value if @math{@var{op1} >
@var{op2}}, zero if @math{@var{op1} = @var{op2}}, and a negative value if
@math{@var{op1} < @var{op2}}.
@@ -4969,7 +4856,7 @@ Compare @var{op1} and @var{op2}. Return a positive value if @math{@var{op1} >
a NaN.
@end deftypefun
-@deftypefun int mpf_eq (const mpf_t @var{op1}, const mpf_t @var{op2}, mp_bitcnt_t op3)
+@deftypefun int mpf_eq (mpf_t @var{op1}, mpf_t @var{op2}, unsigned long int op3)
Return non-zero if the first @var{op3} bits of @var{op1} and @var{op2} are
equal, zero otherwise. I.e., test if @var{op1} and @var{op2} are approximately
equal.
@@ -4982,18 +4869,18 @@ even if ... is replaced by a semi-infinite number of bits. Such numbers are
really just one ulp off, and should be considered equal.
@end deftypefun
-@deftypefun void mpf_reldiff (mpf_t @var{rop}, const mpf_t @var{op1}, const mpf_t @var{op2})
+@deftypefun void mpf_reldiff (mpf_t @var{rop}, mpf_t @var{op1}, mpf_t @var{op2})
Compute the relative difference between @var{op1} and @var{op2} and store the
result in @var{rop}. This is @math{@GMPabs{@var{op1}-@var{op2}}/@var{op1}}.
@end deftypefun
-@deftypefn Macro int mpf_sgn (const mpf_t @var{op})
+@deftypefn Macro int mpf_sgn (mpf_t @var{op})
@cindex Sign tests
@cindex Float sign tests
Return @math{+1} if @math{@var{op} > 0}, 0 if @math{@var{op} = 0}, and
@math{-1} if @math{@var{op} < 0}.
-This function is actually implemented as a macro. It evaluates its argument
+This function is actually implemented as a macro. It evaluates its arguments
multiple times.
@end deftypefn
@@ -5006,17 +4893,15 @@ multiple times.
@cindex I/O functions
Functions that perform input from a stdio stream, and functions that output to
-a stdio stream, of @code{mpf} numbers. Passing a @code{NULL} pointer for a
-@var{stream} argument to any of these functions will make them read from
-@code{stdin} and write to @code{stdout}, respectively.
+a stdio stream. Passing a @code{NULL} pointer for a @var{stream} argument to
+any of these functions will make them read from @code{stdin} and write to
+@code{stdout}, respectively.
When using any of these functions, it is a good idea to include @file{stdio.h}
before @file{gmp.h}, since that will allow @file{gmp.h} to define prototypes
for these functions.
-See also @ref{Formatted Output} and @ref{Formatted Input}.
-
-@deftypefun size_t mpf_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n_digits}, const mpf_t @var{op})
+@deftypefun size_t mpf_out_str (FILE *@var{stream}, int @var{base}, size_t @var{n_digits}, mpf_t @var{op})
Print @var{op} to @var{stream}, as a string of digits. Return the number of
bytes written, or if an error occurred, return 0.
@@ -5056,7 +4941,7 @@ numbers like @samp{0.23} are not interpreted as octal.
Return the number of bytes read, or if an error occurred, return 0.
@end deftypefun
-@c @deftypefun void mpf_out_raw (FILE *@var{stream}, const mpf_t @var{float})
+@c @deftypefun void mpf_out_raw (FILE *@var{stream}, mpf_t @var{float})
@c Output @var{float} on stdio stream @var{stream}, in raw binary
@c format. The float is written in a portable format, with 4 bytes of
@c size information, and that many bytes of limbs. Both the size and the
@@ -5075,9 +4960,9 @@ Return the number of bytes read, or if an error occurred, return 0.
@cindex Miscellaneous float functions
@cindex Float miscellaneous functions
-@deftypefun void mpf_ceil (mpf_t @var{rop}, const mpf_t @var{op})
-@deftypefunx void mpf_floor (mpf_t @var{rop}, const mpf_t @var{op})
-@deftypefunx void mpf_trunc (mpf_t @var{rop}, const mpf_t @var{op})
+@deftypefun void mpf_ceil (mpf_t @var{rop}, mpf_t @var{op})
+@deftypefunx void mpf_floor (mpf_t @var{rop}, mpf_t @var{op})
+@deftypefunx void mpf_trunc (mpf_t @var{rop}, mpf_t @var{op})
@cindex Rounding functions
@cindex Float rounding functions
Set @var{rop} to @var{op} rounded to an integer. @code{mpf_ceil} rounds to the
@@ -5085,26 +4970,25 @@ next higher integer, @code{mpf_floor} to the next lower, and @code{mpf_trunc}
to the integer towards zero.
@end deftypefun
-@deftypefun int mpf_integer_p (const mpf_t @var{op})
+@deftypefun int mpf_integer_p (mpf_t @var{op})
Return non-zero if @var{op} is an integer.
@end deftypefun
-@deftypefun int mpf_fits_ulong_p (const mpf_t @var{op})
-@deftypefunx int mpf_fits_slong_p (const mpf_t @var{op})
-@deftypefunx int mpf_fits_uint_p (const mpf_t @var{op})
-@deftypefunx int mpf_fits_sint_p (const mpf_t @var{op})
-@deftypefunx int mpf_fits_ushort_p (const mpf_t @var{op})
-@deftypefunx int mpf_fits_sshort_p (const mpf_t @var{op})
+@deftypefun int mpf_fits_ulong_p (mpf_t @var{op})
+@deftypefunx int mpf_fits_slong_p (mpf_t @var{op})
+@deftypefunx int mpf_fits_uint_p (mpf_t @var{op})
+@deftypefunx int mpf_fits_sint_p (mpf_t @var{op})
+@deftypefunx int mpf_fits_ushort_p (mpf_t @var{op})
+@deftypefunx int mpf_fits_sshort_p (mpf_t @var{op})
Return non-zero if @var{op} would fit in the respective C data type, when
truncated to an integer.
@end deftypefun
-@deftypefun void mpf_urandomb (mpf_t @var{rop}, gmp_randstate_t @var{state}, mp_bitcnt_t @var{nbits})
+@deftypefun void mpf_urandomb (mpf_t @var{rop}, gmp_randstate_t @var{state}, unsigned long int @var{nbits})
@cindex Random number functions
@cindex Float random number functions
Generate a uniformly distributed random float in @var{rop}, such that @math{0
-@le{} @var{rop} < 1}, with @var{nbits} significant bits in the mantissa or
-less if the precision of @var{rop} is smaller.
+@le{} @var{rop} < 1}, with @var{nbits} significant bits in the mantissa.
The variable @var{state} must be initialized by calling one of the
@code{gmp_randinit} functions (@ref{Random State Initialization}) before
@@ -5120,7 +5004,7 @@ numbers have proven to be more likely to trigger corner-case bugs. Negative
random numbers are generated when @var{max_size} is negative.
@end deftypefun
-@c @deftypefun size_t mpf_size (const mpf_t @var{op})
+@c @deftypefun size_t mpf_size (mpf_t @var{op})
@c Return the size of @var{op} measured in number of limbs. If @var{op} is
@c zero, the returned value will be zero. (@xref{Nomenclature}, for an
@c explanation of the concept @dfn{limb}.)
@@ -5242,13 +5126,6 @@ This function requires that @var{s1n} is greater than or equal to
@var{s2n}.
@end deftypefun
-@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}@}. 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})
Multiply @{@var{s1p}, @var{n}@} and @{@var{s2p}, @var{n}@}, and write the
2*@var{n}-limb result to @var{rp}.
@@ -5257,7 +5134,7 @@ The destination has to have space for 2*@var{n} limbs, even if the product's
most significant limb is zero. No overlap is permitted between the
destination and either source.
-If the two input operands are the same, use @code{mpn_sqr}.
+If the two input operands are the same, use @code{mpn_sqr_n}.
@end deftypefun
@deftypefun mp_limb_t mpn_mul (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{s1n}, const mp_limb_t *@var{s2p}, mp_size_t @var{s2n})
@@ -5272,11 +5149,11 @@ destination and either source.
This function requires that @var{s1n} is greater than or equal to @var{s2n}.
@end deftypefun
-@deftypefun void mpn_sqr (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{n})
+@deftypefun void mpn_sqr_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{n})
Compute the square of @{@var{s1p}, @var{n}@} and write the 2*@var{n}-limb
result to @var{rp}.
-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
@@ -5322,10 +5199,10 @@ Divide @{@var{np}, @var{nn}@} by @{@var{dp}, @var{dn}@} and put the quotient
at @{@var{qp}, @var{nn}@minus{}@var{dn}+1@} and the remainder at @{@var{rp},
@var{dn}@}. The quotient is rounded towards 0.
-No overlap is permitted between arguments, except that @var{np} might equal
-@var{rp}. The dividend size @var{nn} must be greater than or equal to divisor
-size @var{dn}. The most significant limb of the divisor must be non-zero. The
-@var{qxn} operand must be zero.
+No overlap is permitted between arguments. @var{nn} must be greater than or
+equal to @var{dn}. The most significant limb of @var{dp} must be non-zero.
+The @var{qxn} operand must be zero.
+@comment FIXME: Relax overlap requirements!
@end deftypefun
@deftypefun mp_limb_t mpn_divrem (mp_limb_t *@var{r1p}, mp_size_t @var{qxn}, mp_limb_t *@var{rs2p}, mp_size_t @var{rs2n}, const mp_limb_t *@var{s3p}, mp_size_t @var{s3n})
@@ -5399,11 +5276,32 @@ be 0, 1 or 2 (these are both borrows really). When @math{c=0} clearly
@code{mp_bits_per_limb} is even, which is always so currently).
@end deftypefn
-@deftypefun mp_limb_t mpn_mod_1 (const mp_limb_t *@var{s1p}, mp_size_t @var{s1n}, mp_limb_t @var{s2limb})
+@deftypefun mp_limb_t mpn_mod_1 (mp_limb_t *@var{s1p}, mp_size_t @var{s1n}, mp_limb_t @var{s2limb})
Divide @{@var{s1p}, @var{s1n}@} by @var{s2limb}, and return the remainder.
@var{s1n} can be zero.
@end deftypefun
+@deftypefun mp_limb_t mpn_bdivmod (mp_limb_t *@var{rp}, mp_limb_t *@var{s1p}, mp_size_t @var{s1n}, const mp_limb_t *@var{s2p}, mp_size_t @var{s2n}, unsigned long int @var{d})
+This function puts the low
+@math{@GMPfloor{@var{d}/@nicode{mp\_bits\_per\_limb}}} limbs of @var{q} =
+@{@var{s1p}, @var{s1n}@}/@{@var{s2p}, @var{s2n}@} mod @m{2^d,2^@var{d}} at
+@var{rp}, and returns the high @var{d} mod @code{mp_bits_per_limb} bits of
+@var{q}.
+
+@{@var{s1p}, @var{s1n}@} - @var{q} * @{@var{s2p}, @var{s2n}@} mod @m{2
+\GMPraise{@var{s1n}*@code{mp\_bits\_per\_limb}},
+2^(@var{s1n}*@nicode{mp\_bits\_per\_limb})} is placed at @var{s1p}. Since the
+low @math{@GMPfloor{@var{d}/@nicode{mp\_bits\_per\_limb}}} limbs of this
+difference are zero, it is possible to overwrite the low limbs at @var{s1p}
+with this difference, provided @math{@var{rp} @le{} @var{s1p}}.
+
+This function requires that @math{@var{s1n} * @nicode{mp\_bits\_per\_limb}
+@ge{} @var{D}}, and that @{@var{s2p}, @var{s2n}@} is odd.
+
+@strong{This interface is preliminary. It might change incompatibly in future
+revisions.}
+@end deftypefun
+
@deftypefun mp_limb_t mpn_lshift (mp_limb_t *@var{rp}, const mp_limb_t *@var{sp}, mp_size_t @var{n}, unsigned int @var{count})
Shift @{@var{sp}, @var{n}@} left by @var{count} bits, and write the result to
@{@var{rp}, @var{n}@}. The bits shifted out at the left are returned in the
@@ -5442,9 +5340,10 @@ Set @{@var{rp}, @var{retval}@} to the greatest common divisor of @{@var{xp},
the return value is the actual number produced. Both source operands are
destroyed.
-It is required that @math{@var{xn} @ge @var{yn} > 0}, and the most significant
-limb of @{@var{yp}, @var{yn}@} must be non-zero. No overlap is permitted
-between @{@var{xp}, @var{xn}@} and @{@var{yp}, @var{yn}@}.
+@{@var{xp}, @var{xn}@} must have at least as many bits as @{@var{yp},
+@var{yn}@}. @{@var{yp}, @var{yn}@} must be odd. Both operands must have
+non-zero most significant limbs. No overlap is permitted between @{@var{xp},
+@var{xn}@} and @{@var{yp}, @var{yn}@}.
@end deftypefun
@deftypefun mp_limb_t mpn_gcd_1 (const mp_limb_t *@var{xp}, mp_size_t @var{xn}, mp_limb_t @var{ylimb})
@@ -5452,35 +5351,30 @@ Return the greatest common divisor of @{@var{xp}, @var{xn}@} and @var{ylimb}.
Both operands must be non-zero.
@end deftypefun
-@deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{up}, mp_size_t @var{un}, mp_limb_t *@var{vp}, mp_size_t @var{vn})
-Let @m{U,@var{U}} be defined by @{@var{up}, @var{un}@} and let @m{V,@var{V}} be
-defined by @{@var{vp}, @var{vn}@}.
+@deftypefun mp_size_t mpn_gcdext (mp_limb_t *@var{gp}, mp_limb_t *@var{sp}, mp_size_t *@var{sn}, mp_limb_t *@var{xp}, mp_size_t @var{xn}, mp_limb_t *@var{yp}, mp_size_t @var{yn})
+Let @m{U,@var{U}} be defined by @{@var{xp}, @var{xn}@} and let @m{V,@var{V}} be
+defined by @{@var{yp}, @var{yn}@}.
Compute the greatest common divisor @math{G} of @math{U} and @math{V}. Compute
a cofactor @math{S} such that @math{G = US + VT}. The second cofactor @var{T}
is not computed but can easily be obtained from @m{(G - US) / V, (@var{G} -
@var{U}*@var{S}) / @var{V}} (the division will be exact). It is required that
-@math{@var{un} @ge @var{vn} > 0}, and the most significant
-limb of @{@var{vp}, @var{vn}@} must be non-zero.
+@math{U @ge V > 0}.
@math{S} satisfies @math{S = 1} or @math{@GMPabs{S} < V / (2 G)}. @math{S =
0} if and only if @math{V} divides @math{U} (i.e., @math{G = V}).
Store @math{G} at @var{gp} and let the return value define its limb count.
Store @math{S} at @var{sp} and let |*@var{sn}| define its limb count. @math{S}
-can be negative; when this happens *@var{sn} will be negative. The area at
-@var{gp} should have room for @var{vn} limbs and the area at @var{sp} should
-have room for @math{@var{vn}+1} limbs.
+can be negative; when this happens *@var{sn} will be negative. The areas at
+@var{gp} and @var{sp} should each have room for @math{@var{xn}+1} limbs.
-Both source operands are destroyed.
+The areas @{@var{xp}, @math{@var{xn}+1}@} and @{@var{yp}, @math{@var{yn}+1}@}
+are destroyed (i.e.@: the input operands plus an extra limb past the end of
+each).
-Compatibility notes: GMP 4.3.0 and 4.3.1 defined @math{S} less strictly.
+Compatibility note: GMP 4.3.0 and 4.3.1 defined @math{S} less strictly.
Earlier as well as later GMP releases define @math{S} as described here.
-GMP releases before GMP 4.3.0 required additional space for both input and output
-areas. More precisely, the areas @{@var{up}, @math{@var{un}+1}@} and
-@{@var{vp}, @math{@var{vn}+1}@} were destroyed (i.e.@: the operands plus an
-extra limb past the end of each), and the areas pointed to by @var{gp} and
-@var{sp} should each have room for @math{@var{un}+1} limbs.
@end deftypefun
@deftypefun mp_size_t mpn_sqrtrem (mp_limb_t *@var{r1p}, mp_limb_t *@var{r2p}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
@@ -5499,14 +5393,7 @@ case the return value is zero or non-zero according to whether the remainder
would have been zero or non-zero.
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.
+@code{mpz_perfect_square_p}.
@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})
@@ -5528,31 +5415,30 @@ 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 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.
+@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.
-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.
+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 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.
+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 input must have at least one byte, and no overlap is permitted between
+@var{strsize} must be at least 1, and no overlap is permitted between
@{@var{str},@var{strsize}@} and the result at @var{rp}.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpn_scan0 (const mp_limb_t *@var{s1p}, mp_bitcnt_t @var{bit})
+@deftypefun {unsigned long int} mpn_scan0 (const mp_limb_t *@var{s1p}, unsigned long int @var{bit})
Scan @var{s1p} from bit position @var{bit} for the next clear bit.
It is required that there be a clear bit within the area at @var{s1p} at or
beyond bit position @var{bit}, so that the function has something to return.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpn_scan1 (const mp_limb_t *@var{s1p}, mp_bitcnt_t @var{bit})
+@deftypefun {unsigned long int} mpn_scan1 (const mp_limb_t *@var{s1p}, unsigned long int @var{bit})
Scan @var{s1p} from bit position @var{bit} for the next set bit.
It is required that there be a set bit within the area at @var{s1p} at or
@@ -5570,11 +5456,11 @@ zeros and ones in the binary representation.
routines.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpn_popcount (const mp_limb_t *@var{s1p}, mp_size_t @var{n})
+@deftypefun {unsigned long int} mpn_popcount (const mp_limb_t *@var{s1p}, mp_size_t @var{n})
Count the number of set bits in @{@var{s1p}, @var{n}@}.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpn_hamdist (const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
+@deftypefun {unsigned long int} mpn_hamdist (const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
Compute the hamming distance between @{@var{s1p}, @var{n}@} and @{@var{s2p},
@var{n}@}, which is the number of bit positions where the two operands have
different bit values.
@@ -5582,245 +5468,6 @@ different bit values.
@deftypefun int mpn_perfect_square_p (const mp_limb_t *@var{s1p}, mp_size_t @var{n})
Return non-zero iff @{@var{s1p}, @var{n}@} is a perfect square.
-The most significant limb of the input @{@var{s1p}, @var{n}@} must be
-non-zero.
-@end deftypefun
-
-@deftypefun void mpn_and_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical and of @{@var{s1p}, @var{n}@} and @{@var{s2p},
-@var{n}@}, and write the result to @{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_ior_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical inclusive or of @{@var{s1p}, @var{n}@} and
-@{@var{s2p}, @var{n}@}, and write the result to @{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_xor_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical exclusive or of @{@var{s1p}, @var{n}@} and
-@{@var{s2p}, @var{n}@}, and write the result to @{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_andn_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical and of @{@var{s1p}, @var{n}@} and the bitwise
-complement of @{@var{s2p}, @var{n}@}, and write the result to @{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_iorn_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical inclusive or of @{@var{s1p}, @var{n}@} and the bitwise
-complement of @{@var{s2p}, @var{n}@}, and write the result to @{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_nand_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical and of @{@var{s1p}, @var{n}@} and @{@var{s2p},
-@var{n}@}, and write the bitwise complement of the result to @{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_nior_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical inclusive or of @{@var{s1p}, @var{n}@} and
-@{@var{s2p}, @var{n}@}, and write the bitwise complement of the result to
-@{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_xnor_n (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, const mp_limb_t *@var{s2p}, mp_size_t @var{n})
-Perform the bitwise logical exclusive or of @{@var{s1p}, @var{n}@} and
-@{@var{s2p}, @var{n}@}, and write the bitwise complement of the result to
-@{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_com (mp_limb_t *@var{rp}, const mp_limb_t *@var{sp}, mp_size_t @var{n})
-Perform the bitwise complement of @{@var{sp}, @var{n}@}, and write the result
-to @{@var{rp}, @var{n}@}.
-@end deftypefun
-
-@deftypefun void mpn_copyi (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{n})
-Copy from @{@var{s1p}, @var{n}@} to @{@var{rp}, @var{n}@}, increasingly.
-@end deftypefun
-
-@deftypefun void mpn_copyd (mp_limb_t *@var{rp}, const mp_limb_t *@var{s1p}, mp_size_t @var{n})
-Copy from @{@var{s1p}, @var{n}@} to @{@var{rp}, @var{n}@}, decreasingly.
-@end deftypefun
-
-@deftypefun void mpn_zero (mp_limb_t *@var{rp}, mp_size_t @var{n})
-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
@@ -5934,7 +5581,7 @@ Initialize @var{state} for a Mersenne Twister algorithm. This algorithm is
fast and has good randomness properties.
@end deftypefun
-@deftypefun void gmp_randinit_lc_2exp (gmp_randstate_t @var{state}, const mpz_t @var{a}, @w{unsigned long @var{c}}, @w{mp_bitcnt_t @var{m2exp}})
+@deftypefun void gmp_randinit_lc_2exp (gmp_randstate_t @var{state}, mpz_t @var{a}, @w{unsigned long @var{c}}, @w{unsigned long @var{m2exp}})
@cindex Linear congruential random numbers
Initialize @var{state} with a linear congruential algorithm @m{X = (@var{a}X +
@var{c}) @bmod 2^{m2exp}, X = (@var{a}*X + @var{c}) mod 2^@var{m2exp}}.
@@ -5949,12 +5596,12 @@ generated, multiple iterations of the recurrence are used and the results
concatenated.
@end deftypefun
-@deftypefun int gmp_randinit_lc_2exp_size (gmp_randstate_t @var{state}, mp_bitcnt_t @var{size})
+@deftypefun int gmp_randinit_lc_2exp_size (gmp_randstate_t @var{state}, unsigned long @var{size})
@cindex Linear congruential random numbers
Initialize @var{state} for a linear congruential algorithm as per
@code{gmp_randinit_lc_2exp}. @var{a}, @var{c} and @var{m2exp} are selected
from a table, chosen so that @var{size} bits (or more) of each @math{X} will
-be used, i.e.@: @math{@var{m2exp}/2 @ge{} @var{size}}.
+be used, ie.@: @math{@var{m2exp}/2 @ge{} @var{size}}.
If successful the return value is non-zero. If @var{size} is bigger than the
table data provides then the return value is zero. The maximum @var{size}
@@ -6002,7 +5649,7 @@ Free all memory occupied by @var{state}.
@cindex Random number seeding
@cindex Seeding random numbers
-@deftypefun void gmp_randseed (gmp_randstate_t @var{state}, const mpz_t @var{seed})
+@deftypefun void gmp_randseed (gmp_randstate_t @var{state}, mpz_t @var{seed})
@deftypefunx void gmp_randseed_ui (gmp_randstate_t @var{state}, @w{unsigned long int @var{seed}})
Set an initial seed value into @var{state}.
@@ -6027,7 +5674,7 @@ random data better suited for use as a seed.
@section Random State Miscellaneous
@deftypefun {unsigned long} gmp_urandomb_ui (gmp_randstate_t @var{state}, unsigned long @var{n})
-Return a uniformly distributed random number of @var{n} bits, i.e.@: in the
+Return a uniformly distributed random number of @var{n} bits, ie.@: in the
range 0 to @m{2^n-1,2^@var{n}-1} inclusive. @var{n} must be less than or
equal to the number of bits in an @code{unsigned long}.
@end deftypefun
@@ -6182,7 +5829,7 @@ instance extensions registered with GLIBC @code{register_printf_function}.
Also currently there's no support for POSIX @samp{$} style numbered arguments
(perhaps this will be added in the future).
-The precision field has its usual meaning for integer @samp{Z} and float
+The precision field has it's usual meaning for integer @samp{Z} and float
@samp{F} types, but is currently undefined for @samp{Q} and should not be used
with that.
@@ -6193,10 +5840,7 @@ happens even for an @samp{f} conversion of an @code{mpf_t} which is an
integer, for instance @math{2^@W{1024}} in an @code{mpf_t} of 128 bits
precision will only produce about 40 digits, then pad with zeros to the
decimal point. An empty precision field like @samp{%.Fe} or @samp{%.Ff} can
-be used to specifically request just the significant digits. Without any dot
-and thus no precision field, a precision value of 6 will be used. Note that
-these rules mean that @samp{%Ff}, @samp{%.Ff}, and @samp{%.0Ff} will all be
-different.
+be used to specifically request just the significant digits.
The decimal point character (or string) is taken from the current locale
settings on systems which provide @code{localeconv} (@pxref{Locales,, Locales
@@ -6307,7 +5951,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}, const mpz_t @var{op})
+@deftypefun ostream& operator<< (ostream& @var{stream}, 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.
@@ -6317,7 +5961,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}, const mpq_t @var{op})
+@deftypefun ostream& operator<< (ostream& @var{stream}, 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.
@@ -6330,7 +5974,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}, const mpf_t @var{op})
+@deftypefun ostream& operator<< (ostream& @var{stream}, 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.
@@ -6639,7 +6283,7 @@ results. For classes with overloading, see @ref{C++ Class Interface}.
-@node C++ Class Interface, Custom Allocation, Formatted Input, Top
+@node C++ Class Interface, BSD Compatible Functions, Formatted Input, Top
@chapter C++ Class Interface
@cindex C++ interface
@@ -6651,7 +6295,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.
+and member templates. For GCC this means version 2.91 or later.
@strong{Everything described in this chapter is to be considered preliminary
and might be subject to incompatible changes if some unforeseen difficulty
@@ -6774,23 +6418,23 @@ anything.
@node C++ Interface Integers, C++ Interface Rationals, C++ Interface General, C++ Class Interface
@section C++ Interface Integers
-@deftypefun {} mpz_class::mpz_class (type @var{n})
+@deftypefun void mpz_class::mpz_class (type @var{n})
Construct an @code{mpz_class}. All the standard C++ types may be used, except
@code{long long} and @code{long double}, and all the GMP C++ classes can be
-used, although conversions from @code{mpq_class} and @code{mpf_class} are
-@code{explicit}. Any necessary conversion follows the corresponding C
-function, for example @code{double} follows @code{mpz_set_d}
-(@pxref{Assigning Integers}).
+used. Any necessary conversion follows the corresponding C function, for
+example @code{double} follows @code{mpz_set_d} (@pxref{Assigning Integers}).
@end deftypefun
-@deftypefun explicit mpz_class::mpz_class (const mpz_t @var{z})
+@deftypefun void mpz_class::mpz_class (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}.
@end deftypefun
-@deftypefun explicit mpz_class::mpz_class (const char *@var{s}, int @var{base} = 0)
-@deftypefunx explicit mpz_class::mpz_class (const string& @var{s}, int @var{base} = 0)
+@deftypefun void mpz_class::mpz_class (const char *@var{s})
+@deftypefunx void mpz_class::mpz_class (const char *@var{s}, int @var{base} = 0)
+@deftypefunx void mpz_class::mpz_class (const string& @var{s})
+@deftypefunx void mpz_class::mpz_class (const string& @var{s}, int @var{base} = 0)
Construct an @code{mpz_class} converted from a string using @code{mpz_set_str}
(@pxref{Assigning Integers}).
@@ -6798,11 +6442,6 @@ If the string is not a valid integer, an @code{std::invalid_argument}
exception is thrown. The same applies to @code{operator=}.
@end deftypefun
-@deftypefun mpz_class operator"" _mpz (const char *@var{str})
-With C++11 compilers, integers can be constructed with the syntax
-@code{123_mpz} which is equivalent to @code{mpz_class("123")}.
-@end deftypefun
-
@deftypefun mpz_class operator/ (mpz_class @var{a}, mpz_class @var{d})
@deftypefunx mpz_class operator% (mpz_class @var{a}, mpz_class @var{d})
Divisions involving @code{mpz_class} round towards zero, as per the
@@ -6819,7 +6458,7 @@ mpz_fdiv_q (q.get_mpz_t(), a.get_mpz_t(), d.get_mpz_t());
@end example
@end deftypefun
-@deftypefun mpz_class abs (mpz_class @var{op})
+@deftypefun mpz_class abs (mpz_class @var{op1})
@deftypefunx int cmp (mpz_class @var{op1}, type @var{op2})
@deftypefunx int cmp (type @var{op1}, mpz_class @var{op2})
@maybepagebreak
@@ -6840,9 +6479,6 @@ mpz_fdiv_q (q.get_mpz_t(), a.get_mpz_t(), d.get_mpz_t());
@deftypefunx int mpz_class::set_str (const string& @var{str}, int @var{base})
@deftypefunx int sgn (mpz_class @var{op})
@deftypefunx mpz_class sqrt (mpz_class @var{op})
-@maybepagebreak
-@deftypefunx void mpz_class::swap (mpz_class& @var{op})
-@deftypefunx void swap (mpz_class& @var{op1}, mpz_class& @var{op2})
These functions provide a C++ class interface to the corresponding GMP C
routines.
@@ -6868,13 +6504,12 @@ And comparisons are always made exactly, as per @code{mpz_cmp_d}.
In all the following constructors, if a fraction is given then it should be in
canonical form, or if not then @code{mpq_class::canonicalize} called.
-@deftypefun {} mpq_class::mpq_class (type @var{op})
-@deftypefunx {} mpq_class::mpq_class (integer @var{num}, integer @var{den})
+@deftypefun void mpq_class::mpq_class (type @var{op})
+@deftypefunx void mpq_class::mpq_class (integer @var{num}, integer @var{den})
Construct an @code{mpq_class}. The initial value can be a single value of any
-type (conversion from @code{mpf_class} is @code{explicit}), or a pair of
-integers (@code{mpz_class} or standard C++ integer types) representing a
-fraction, except that @code{long long} and @code{long double} are not
-supported. For example,
+type, or a pair of integers (@code{mpz_class} or standard C++ integer types)
+representing a fraction, except that @code{long long} and @code{long double}
+are not supported. For example,
@example
mpq_class q (99);
@@ -6883,14 +6518,16 @@ mpq_class q (1, 3);
@end example
@end deftypefun
-@deftypefun explicit mpq_class::mpq_class (const mpq_t @var{q})
+@deftypefun void mpq_class::mpq_class (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}.
@end deftypefun
-@deftypefun explicit mpq_class::mpq_class (const char *@var{s}, int @var{base} = 0)
-@deftypefunx explicit mpq_class::mpq_class (const string& @var{s}, int @var{base} = 0)
+@deftypefun void mpq_class::mpq_class (const char *@var{s})
+@deftypefunx void mpq_class::mpq_class (const char *@var{s}, int @var{base} = 0)
+@deftypefunx void mpq_class::mpq_class (const string& @var{s})
+@deftypefunx void mpq_class::mpq_class (const string& @var{s}, int @var{base} = 0)
Construct an @code{mpq_class} converted from a string using @code{mpq_set_str}
(@pxref{Initializing Rationals}).
@@ -6898,12 +6535,6 @@ If the string is not a valid rational, an @code{std::invalid_argument}
exception is thrown. The same applies to @code{operator=}.
@end deftypefun
-@deftypefun mpq_class operator"" _mpq (const char *@var{str})
-With C++11 compilers, integral rationals can be constructed with the syntax
-@code{123_mpq} which is equivalent to @code{mpq_class(123_mpz)}. Other
-rationals can be built as @code{-1_mpq/2} or @code{0xb_mpq/123456_mpz}.
-@end deftypefun
-
@deftypefun void mpq_class::canonicalize ()
Put an @code{mpq_class} into canonical form, as per @ref{Rational Number
Functions}. All arithmetic operators require their operands in canonical
@@ -6920,9 +6551,6 @@ form, and will return results in canonical form.
@deftypefunx int mpq_class::set_str (const char *@var{str}, int @var{base})
@deftypefunx int mpq_class::set_str (const string& @var{str}, int @var{base})
@deftypefunx int sgn (mpq_class @var{op})
-@maybepagebreak
-@deftypefunx void mpq_class::swap (mpq_class& @var{op})
-@deftypefunx void swap (mpq_class& @var{op1}, mpq_class& @var{op2})
These functions provide a C++ class interface to the corresponding GMP C
routines.
@@ -6969,7 +6597,7 @@ as the destination @code{f}. Explicit constructors can be used if this
doesn't suit.
@deftypefun {} mpf_class::mpf_class (type @var{op})
-@deftypefunx {} mpf_class::mpf_class (type @var{op}, mp_bitcnt_t @var{prec})
+@deftypefunx {} mpf_class::mpf_class (type @var{op}, unsigned long @var{prec})
Construct an @code{mpf_class}. Any standard C++ type can be used, except
@code{long long} and @code{long double}, and any of the GMP C++ classes can be
used.
@@ -6992,20 +6620,10 @@ mpf_class f(x+y); // greater of precisions of x and y
@end example
@end deftypefun
-@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}.
-
-If @var{prec} is given, the initial precision is that value, in bits. If
-@var{prec} is not given, then the initial precision is that of @var{f}.
-@end deftypefun
-
-@deftypefun explicit mpf_class::mpf_class (const char *@var{s})
-@deftypefunx {} mpf_class::mpf_class (const char *@var{s}, mp_bitcnt_t @var{prec}, int @var{base} = 0)
-@deftypefunx explicit mpf_class::mpf_class (const string& @var{s})
-@deftypefunx {} mpf_class::mpf_class (const string& @var{s}, mp_bitcnt_t @var{prec}, int @var{base} = 0)
+@deftypefun void mpf_class::mpf_class (const char *@var{s})
+@deftypefunx void mpf_class::mpf_class (const char *@var{s}, unsigned long @var{prec}, int @var{base} = 0)
+@deftypefunx void mpf_class::mpf_class (const string& @var{s})
+@deftypefunx void mpf_class::mpf_class (const string& @var{s}, unsigned long @var{prec}, int @var{base} = 0)
Construct an @code{mpf_class} converted from a string using @code{mpf_set_str}
(@pxref{Assigning Floats}). If @var{prec} is given, the initial precision is
that value, in bits. If not, the default @code{mpf} precision
@@ -7015,11 +6633,6 @@ If the string is not a valid float, an @code{std::invalid_argument} exception
is thrown. The same applies to @code{operator=}.
@end deftypefun
-@deftypefun mpf_class operator"" _mpf (const char *@var{str})
-With C++11 compilers, floats can be constructed with the syntax
-@code{1.23e-1_mpf} which is equivalent to @code{mpf_class("1.23e-1")}.
-@end deftypefun
-
@deftypefun {mpf_class&} mpf_class::operator= (type @var{op})
Convert and store the given @var{op} value to an @code{mpf_class} object. The
same types are accepted as for the constructors above.
@@ -7070,9 +6683,6 @@ with the builtin float types.
@deftypefunx int mpf_class::set_str (const string& @var{str}, int @var{base})
@deftypefunx int sgn (mpf_class @var{op})
@deftypefunx mpf_class sqrt (mpf_class @var{op})
-@maybepagebreak
-@deftypefunx void mpf_class::swap (mpf_class& @var{op})
-@deftypefunx void swap (mpf_class& @var{op1}, mpf_class& @var{op2})
@deftypefunx mpf_class trunc (mpf_class @var{op})
These functions provide a C++ class interface to the corresponding GMP C
routines.
@@ -7083,9 +6693,9 @@ except @code{long long} and @code{long double}.
The accuracy provided by @code{hypot} is not currently guaranteed.
@end deftypefun
-@deftypefun {mp_bitcnt_t} mpf_class::get_prec ()
-@deftypefunx void mpf_class::set_prec (mp_bitcnt_t @var{prec})
-@deftypefunx void mpf_class::set_prec_raw (mp_bitcnt_t @var{prec})
+@deftypefun {unsigned long int} mpf_class::get_prec ()
+@deftypefunx void mpf_class::set_prec (unsigned long @var{prec})
+@deftypefunx void mpf_class::set_prec_raw (unsigned long @var{prec})
Get or set the current precision of an @code{mpf_class}.
The restrictions described for @code{mpf_set_prec_raw} (@pxref{Initializing
@@ -7134,7 +6744,7 @@ Seed a random number generator. See @pxref{Random Number Functions}, for how
to choose a good seed.
@end deftypefun
-@deftypefun mpz_class gmp_randclass::get_z_bits (mp_bitcnt_t @var{bits})
+@deftypefun mpz_class gmp_randclass::get_z_bits (unsigned long @var{bits})
@deftypefunx mpz_class gmp_randclass::get_z_bits (mpz_class @var{bits})
Generate a random integer with a specified number of bits.
@end deftypefun
@@ -7144,7 +6754,7 @@ Generate a random integer in the range 0 to @math{@var{n}-1} inclusive.
@end deftypefun
@deftypefun mpf_class gmp_randclass::get_f ()
-@deftypefunx mpf_class gmp_randclass::get_f (mp_bitcnt_t @var{prec})
+@deftypefunx mpf_class gmp_randclass::get_f (unsigned long @var{prec})
Generate a random float @var{f} in the range @math{0 <= @var{f} < 1}. @var{f}
will be to @var{prec} bits precision, or if @var{prec} is not given then to
the precision of the destination. For example,
@@ -7241,35 +6851,134 @@ void fun (T f, T g)
fun2 (f, T(f+g)); // Good
@}
@end example
+@end table
-@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
+@node BSD Compatible Functions, Custom Allocation, C++ Class Interface, Top
+@comment node-name, next, previous, up
+@chapter Berkeley MP Compatible Functions
+@cindex Berkeley MP compatible functions
+@cindex BSD MP compatible functions
-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.
+These functions are intended to be fully compatible with the Berkeley MP
+library which is available on many BSD derived U*ix systems. The
+@samp{--enable-mpbsd} option must be used when building GNU MP to make these
+available (@pxref{Installing GMP}).
-@example
-mpz_class z = 33;
-auto sum = z + z + z;
-mpz_class prod = sum * 2;
-@end example
+The original Berkeley MP library has a usage restriction: you cannot use the
+same variable as both source and destination in a single function call. The
+compatible functions in GNU MP do not share this restriction---inputs and
+outputs may overlap.
-It is thus strongly recommended to avoid @code{auto} anywhere a GMP C++
-expression may appear.
-@end table
+It is not recommended that new programs are written using these functions.
+Apart from the incomplete set of functions, the interface for initializing
+@code{MINT} objects is more error prone, and the @code{pow} function collides
+with @code{pow} in @file{libm.a}.
+
+@cindex @code{mp.h}
+@tindex MINT
+Include the header @file{mp.h} to get the definition of the necessary types and
+functions. If you are on a BSD derived system, make sure to include GNU
+@file{mp.h} if you are going to link the GNU @file{libmp.a} to your program.
+This means that you probably need to give the @samp{-I<dir>} option to the
+compiler, where @samp{<dir>} is the directory where you have GNU @file{mp.h}.
+
+@deftypefun {MINT *} itom (signed short int @var{initial_value})
+Allocate an integer consisting of a @code{MINT} object and dynamic limb space.
+Initialize the integer to @var{initial_value}. Return a pointer to the
+@code{MINT} object.
+@end deftypefun
+
+@deftypefun {MINT *} xtom (char *@var{initial_value})
+Allocate an integer consisting of a @code{MINT} object and dynamic limb space.
+Initialize the integer from @var{initial_value}, a hexadecimal,
+null-terminated C string. Return a pointer to the @code{MINT} object.
+@end deftypefun
+
+@deftypefun void move (MINT *@var{src}, MINT *@var{dest})
+Set @var{dest} to @var{src} by copying. Both variables must be previously
+initialized.
+@end deftypefun
+
+@deftypefun void madd (MINT *@var{src_1}, MINT *@var{src_2}, MINT *@var{destination})
+Add @var{src_1} and @var{src_2} and put the sum in @var{destination}.
+@end deftypefun
+
+@deftypefun void msub (MINT *@var{src_1}, MINT *@var{src_2}, MINT *@var{destination})
+Subtract @var{src_2} from @var{src_1} and put the difference in
+@var{destination}.
+@end deftypefun
+
+@deftypefun void mult (MINT *@var{src_1}, MINT *@var{src_2}, MINT *@var{destination})
+Multiply @var{src_1} and @var{src_2} and put the product in @var{destination}.
+@end deftypefun
+
+@deftypefun void mdiv (MINT *@var{dividend}, MINT *@var{divisor}, MINT *@var{quotient}, MINT *@var{remainder})
+@deftypefunx void sdiv (MINT *@var{dividend}, signed short int @var{divisor}, MINT *@var{quotient}, signed short int *@var{remainder})
+Set @var{quotient} to @var{dividend}/@var{divisor}, and @var{remainder} to
+@var{dividend} mod @var{divisor}. The quotient is rounded towards zero; the
+remainder has the same sign as the dividend unless it is zero.
+
+Some implementations of these functions work differently---or not at all---for
+negative arguments.
+@end deftypefun
+
+@deftypefun void msqrt (MINT *@var{op}, MINT *@var{root}, MINT *@var{remainder})
+Set @var{root} to @m{\lfloor\sqrt{@var{op}}\rfloor, the truncated integer part
+of the square root of @var{op}}, like @code{mpz_sqrt}. Set @var{remainder} to
+@m{(@var{op} - @var{root}^2), @var{op}@minus{}@var{root}*@var{root}}, i.e.
+zero if @var{op} is a perfect square.
+
+If @var{root} and @var{remainder} are the same variable, the results are
+undefined.
+@end deftypefun
+
+@deftypefun void pow (MINT *@var{base}, MINT *@var{exp}, MINT *@var{mod}, MINT *@var{dest})
+Set @var{dest} to (@var{base} raised to @var{exp}) modulo @var{mod}.
+
+Note that the name @code{pow} clashes with @code{pow} from the standard C math
+library (@pxref{Exponents and Logarithms,, Exponentiation and Logarithms,
+libc, The GNU C Library Reference Manual}). An application will only be able
+to use one or the other.
+@end deftypefun
+
+@deftypefun void rpow (MINT *@var{base}, signed short int @var{exp}, MINT *@var{dest})
+Set @var{dest} to @var{base} raised to @var{exp}.
+@end deftypefun
+@deftypefun void gcd (MINT *@var{op1}, MINT *@var{op2}, MINT *@var{res})
+Set @var{res} to the greatest common divisor of @var{op1} and @var{op2}.
+@end deftypefun
-@node Custom Allocation, Language Bindings, C++ Class Interface, Top
+@deftypefun int mcmp (MINT *@var{op1}, MINT *@var{op2})
+Compare @var{op1} and @var{op2}. Return a positive value if @var{op1} >
+@var{op2}, zero if @var{op1} = @var{op2}, and a negative value if @var{op1} <
+@var{op2}.
+@end deftypefun
+
+@deftypefun void min (MINT *@var{dest})
+Input a decimal string from @code{stdin}, and put the read integer in
+@var{dest}. SPC and TAB are allowed in the number string, and are ignored.
+@end deftypefun
+
+@deftypefun void mout (MINT *@var{src})
+Output @var{src} to @code{stdout}, as a decimal string. Also output a newline.
+@end deftypefun
+
+@deftypefun {char *} mtox (MINT *@var{op})
+Convert @var{op} to a hexadecimal string, and return a pointer to the string.
+The returned string is allocated using the default memory allocation function,
+@code{malloc} by default. It will be @code{strlen(str)+1} bytes, that being
+exactly enough for the string and null-terminator.
+@end deftypefun
+
+@deftypefun void mfree (MINT *@var{op})
+De-allocate, the space used by @var{op}. @strong{This function should only be
+passed a value returned by @code{itom} or @code{xtom}.}
+@end deftypefun
+
+
+@node Custom Allocation, Language Bindings, BSD Compatible Functions, Top
@comment node-name, next, previous, up
@chapter Custom Allocation
@cindex Custom allocation
@@ -7283,6 +6992,9 @@ and terminates the program.
Alternate functions can be specified, to allocate memory in a different way or
to have a different error action on running out of memory.
+This feature is available in the Berkeley compatibility library (@pxref{BSD
+Compatible Functions}) as well as the main GMP library.
+
@deftypefun void mp_set_memory_functions (@* void *(*@var{alloc_func_ptr}) (size_t), @* void *(*@var{realloc_func_ptr}) (void *, size_t, size_t), @* void (*@var{free_func_ptr}) (void *, size_t))
Replace the current allocation functions from the arguments. If an argument
is @code{NULL}, the corresponding default function is used.
@@ -7325,10 +7037,10 @@ De-allocate the space pointed to by @var{ptr}.
A @dfn{byte} here means the unit used by the @code{sizeof} operator.
-The @var{reallocate_function} parameter @var{old_size} and the
-@var{free_function} parameter @var{size} are passed for convenience, but of
-course they can be ignored if not needed by an implementation. The default
-functions using @code{malloc} and friends for instance don't use them.
+The @var{old_size} parameters to @var{reallocate_function} and
+@var{free_function} are passed for convenience, but of course can be ignored
+if not needed. The default functions using @code{malloc} and friends for
+instance don't use them.
No error return is allowed from any of these functions, if they return then
they must have performed the specified operation. In particular note that
@@ -7398,14 +7110,17 @@ 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{https://www-sop.inria.fr/saga/logiciels/ALP/} @* Linear algebra and
+ALP @spaceuref{http://www-sop.inria.fr/saga/logiciels/ALP/} @* Linear algebra and
polynomials using templates.
@item
-Arithmos @spaceuref{http://cant.ua.ac.be/old/arithmos/} @* Rationals
+Arithmos @spaceuref{http://www.win.ua.ac.be/~cant/arithmos/} @* Rationals
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.
@@ -7417,35 +7132,31 @@ NTL @spaceuref{http://www.shoup.net/ntl/} @* A C++ number theory library.
@c gmp-d @spaceuref{http://home.comcast.net/~benhinkle/gmp-d/}
@c @end itemize
-@item Eiffel
+@item Fortran
@itemize @bullet
@item
-Eiffelroom @spaceuref{http://www.eiffelroom.org/node/442}
+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{https://www.haskell.org/ghc/}
+Glasgow Haskell Compiler @spaceuref{http://www.haskell.org/ghc/}
@end itemize
@item Java
@itemize @bullet
@item
-Kaffe @spaceuref{https://github.com/kaffe/kaffe}
+Kaffe @spaceuref{http://www.kaffe.org/}
+@item
+Kissme @spaceuref{http://kissme.sourceforge.net/}
@end itemize
@item Lisp
@itemize @bullet
@item
-GNU Common Lisp @spaceuref{https://www.gnu.org/software/gcl/gcl.html}
+GNU Common Lisp @spaceuref{http://www.gnu.org/software/gcl/gcl.html}
@item
Librep @spaceuref{http://librep.sourceforge.net/}
@item
@@ -7473,7 +7184,7 @@ MLton compiler @spaceuref{http://mlton.org/}
@item Objective Caml
@itemize @bullet
@item
-MLGMP @spaceuref{http://opam.ocamlpro.com/pkg/mlgmp.20120224.html}
+MLGMP @spaceuref{http://www.di.ens.fr/~monniaux/programmes.html.en}
@item
Numerix @spaceuref{http://pauillac.inria.fr/~quercia/} @* Optionally using
GMP.
@@ -7482,7 +7193,7 @@ GMP.
@item Oz
@itemize @bullet
@item
-Mozart @spaceuref{http://mozart.github.io/}
+Mozart @spaceuref{http://www.mozart-oz.org/}
@end itemize
@item Pascal
@@ -7525,23 +7236,19 @@ Arbitrary precision floats.
@item Python
@itemize @bullet
@item
-GMPY @uref{https://code.google.com/p/gmpy/}
-@end itemize
-
-@item Ruby
-@itemize @bullet
+mpz module in the standard distribution, @uref{http://www.python.org/}
@item
-http://rubygems.org/gems/gmp
+GMPY @uref{http://gmpy.sourceforge.net/}
@end itemize
@item Scheme
@itemize @bullet
@item
-GNU Guile @spaceuref{https://www.gnu.org/software/guile/guile.html}
+GNU Guile (upcoming 1.8) @spaceuref{http://www.gnu.org/software/guile/guile.html}
@item
RScheme @spaceuref{http://www.rscheme.org/}
@item
-STklos @spaceuref{http://www.stklos.net/}
+STklos @spaceuref{http://www.stklos.org/}
@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
@@ -7558,7 +7265,7 @@ GNU Smalltalk @spaceuref{http://www.smalltalk.org/versions/GNUSmalltalk.html}
@item Other
@itemize @bullet
@item
-Axiom @uref{https://savannah.nongnu.org/projects/axiom} @* Computer algebra
+Axiom @uref{http://savannah.nongnu.org/projects/axiom} @* Computer algebra
using GCL.
@item
DrGenius @spaceuref{http://drgenius.seul.org/} @* Geometry system and
@@ -7566,17 +7273,18 @@ mathematical programming language.
@item
GiNaC @spaceuref{http://www.ginac.de/} @* C++ computer algebra using CLN.
@item
-GOO @spaceuref{https://www.eecs.berkeley.edu/~jrb/goo/} @* Dynamic object oriented
+GOO @spaceuref{http://www.googoogaga.org/} @* Dynamic object oriented
language.
@item
-Maxima @uref{https://www.ma.utexas.edu/users/wfs/maxima.html} @* Macsyma
+Maxima @uref{http://www.ma.utexas.edu/users/wfs/maxima.html} @* Macsyma
computer algebra using GCL.
-@c @item
-@c Q @spaceuref{http://q-lang.sourceforge.net/} @* Equational programming system.
+@item
+Q @spaceuref{http://q-lang.sourceforge.net/} @* Equational programming system.
@item
Regina @spaceuref{http://regina.sourceforge.net/} @* Topological calculator.
@item
-Yacas @spaceuref{http://yacas.sourceforge.net} @* Yet another computer algebra system.
+Yacas @spaceuref{http://www.xs4all.nl/~apinkus/yacas.html} @* Yet another
+computer algebra system.
@end itemize
@end table
@@ -7610,18 +7318,16 @@ documented functions.
@section Multiplication
@cindex Multiplication algorithms
-N@cross{}N limb multiplications and squares are done using one of seven
+N@cross{}N limb multiplications and squares are done using one of five
algorithms, as the size N increases.
@quotation
@multitable {KaratsubaMMM} {MMMMMMMMMMMMMMMMMMMMMMMMMMMMMMM}
@item Algorithm @tab Threshold
@item Basecase @tab (none)
-@item Karatsuba @tab @code{MUL_TOOM22_THRESHOLD}
+@item Karatsuba @tab @code{MUL_KARATSUBA_THRESHOLD}
@item Toom-3 @tab @code{MUL_TOOM33_THRESHOLD}
@item Toom-4 @tab @code{MUL_TOOM44_THRESHOLD}
-@item Toom-6.5 @tab @code{MUL_TOOM6H_THRESHOLD}
-@item Toom-8.5 @tab @code{MUL_TOOM8H_THRESHOLD}
@item FFT @tab @code{MUL_FFT_THRESHOLD}
@end multitable
@end quotation
@@ -7629,7 +7335,7 @@ algorithms, as the size N increases.
Similarly for squaring, with the @code{SQR} thresholds.
N@cross{}M multiplications of operands with different sizes above
-@code{MUL_TOOM22_THRESHOLD} are currently done by special Toom-inspired
+@code{MUL_KARATSUBA_THRESHOLD} are currently done by special Toom-inspired
algorithms or directly with FFT, depending on operand size (@pxref{Unbalanced
Multiplication}).
@@ -7638,7 +7344,6 @@ Multiplication}).
* Karatsuba Multiplication::
* Toom 3-Way Multiplication::
* Toom 4-Way Multiplication::
-* Higher degree Toom'n'half::
* FFT Multiplication::
* Other Multiplication::
* Unbalanced Multiplication::
@@ -7781,7 +7486,7 @@ equal length (or the most significant part one limb shorter if N is odd).
@end example
@end ifnottex
-Let @math{b} be the power of 2 where the split occurs, i.e.@: if @ms{x,0} is
+Let @math{b} be the power of 2 where the split occurs, ie.@: if @ms{x,0} is
@math{k} limbs (@ms{y,0} the same) then
@m{b=2\GMPraise{$k*$@code{mp\_bits\_per\_limb}}, b=2^(k*mp_bits_per_limb)}.
With that @m{x=x_1b+x_0,x=x1*b+x0} and @m{y=y_1b+y_0,y=y1*b+y0}, and the
@@ -7879,7 +7584,7 @@ Karatsuba multiplication is asymptotically an @math{O(N^@W{1.585})} algorithm,
the exponent being @m{\log3/\log2,log(3)/log(2)}, representing 3 multiplies
each @math{1/2} the size of the inputs. This is a big improvement over the
basecase multiply at @math{O(N^2)} and the advantage soon overcomes the extra
-additions Karatsuba performs. @code{MUL_TOOM22_THRESHOLD} can be as little
+additions Karatsuba performs. @code{MUL_KARATSUBA_THRESHOLD} can be as little
as 10 limbs. The @code{SQR} threshold is usually about twice the @code{MUL}.
The basecase algorithm will take a time of the form @m{M(N) = aN^2 + bN + c,
@@ -7960,7 +7665,7 @@ These parts are treated as the coefficients of two polynomials
@end display
Let @math{b} equal the power of 2 which is the size of the @ms{x,0}, @ms{x,1},
-@ms{y,0} and @ms{y,1} pieces, i.e.@: if they're @math{k} limbs each then
+@ms{y,0} and @ms{y,1} pieces, ie.@: if they're @math{k} limbs each then
@m{b=2\GMPraise{$k*$@code{mp\_bits\_per\_limb}}, b=2^(k*mp_bits_per_limb)}.
With this @math{x=X(b)} and @math{y=Y(b)}.
@@ -8095,7 +7800,7 @@ the @m{w_i,w[i]}.
Squaring follows the same procedure as multiplication, but there's only one
@math{X(t)} and it's evaluated at the 5 points, and those values squared to
give values of @math{W(t)}. The interpolation is then identical, and in fact
-the same @code{toom_interpolate_5pts} subroutine is used for both squaring and
+the same @code{toom3_interpolate} subroutine is used for both squaring and
multiplying.
Toom-3 is asymptotically @math{O(N^@W{1.465})}, the exponent being
@@ -8133,7 +7838,7 @@ and for example with a bit of rearrangement just one division by 6 can be
done.
-@node Toom 4-Way Multiplication, Higher degree Toom'n'half, Toom 3-Way Multiplication, Multiplication Algorithms
+@node Toom 4-Way Multiplication, FFT Multiplication, Toom 3-Way Multiplication, Multiplication Algorithms
@subsection Toom 4-Way Multiplication
@cindex Toom multiplication
@@ -8176,32 +7881,7 @@ Toom-4 is asymptotically @math{O(N^@W{1.404})}, the exponent being
original size each.
-@node Higher degree Toom'n'half, FFT Multiplication, Toom 4-Way Multiplication, Multiplication Algorithms
-@subsection Higher degree Toom'n'half
-@cindex Toom multiplication
-
-The Toom algorithms described above (@pxref{Toom 3-Way Multiplication},
-@pxref{Toom 4-Way Multiplication}) generalizes to split into an arbitrary
-number of pieces. In general a split of two equally long operands into
-@math{r} pieces leads to evaluations and pointwise multiplications done at
-@m{2r-1,2*r-1} points. To fully exploit symmetries it would be better to have
-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 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 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
-to a memory buffer equanl in size to the result of the product.
-
-Current GMP uses both Toom-6'n'half and Toom-8'n'half.
-
-
-@node FFT Multiplication, Other Multiplication, Higher degree Toom'n'half, Multiplication Algorithms
+@node FFT Multiplication, Other Multiplication, Toom 4-Way Multiplication, Multiplication Algorithms
@subsection FFT Multiplication
@cindex FFT multiplication
@cindex Fast Fourier Transform
@@ -8250,13 +7930,13 @@ The points used for the evaluation are @math{g^i} for @math{i=0} to
@math{2^k-1} where @m{g=2^{2N'/2^k}, g=2^(2N'/2^k)}. @math{g} is a
@m{2^k,2^k'}th root of unity mod @m{2^{N'}+1,2^N'+1}, which produces necessary
cancellations at the interpolation stage, and it's also a power of 2 so the
-fast Fourier transforms used for the evaluation and interpolation do only
+fast fourier transforms used for the evaluation and interpolation do only
shifts, adds and negations.
The pointwise multiplications are done modulo @m{2^{N'}+1, 2^N'+1} and either
recurse into a further FFT or use a plain multiplication (Toom-3, Karatsuba or
basecase), whichever is optimal at the size @math{N'}. The interpolation is
-an inverse fast Fourier transform. The resulting set of sums of @m{x_iy_j,
+an inverse fast fourier transform. The resulting set of sums of @m{x_iy_j,
x[i]*y[j]} are added at appropriate offsets to give the final result.
Squaring is the same, but @math{x} is the only input so it's one transform at
@@ -8328,7 +8008,7 @@ currently used. The notes here are merely for interest.
In general a split into @math{r+1} pieces is made, and evaluations and
pointwise multiplications done at @m{2r+1,2*r+1} points. A 4-way split does 7
pointwise multiplies, 5-way does 9, etc. Asymptotically an @math{(r+1)}-way
-algorithm is @m{O(N^{log(2r+1)/log(r+1)}), O(N^(log(2*r+1)/log(r+1)))}. Only
+algorithm is @m{O(N^{log(2r+1)/log(r+1)}, O(N^(log(2*r+1)/log(r+1)))}. Only
the pointwise multiplications count towards big-@math{O} complexity, but the
time spent in the evaluate and interpolate stages grows with @math{r} and has
a significant practical impact, with the asymptotic advantage of each @math{r}
@@ -8348,10 +8028,10 @@ Splitting odd and even parts through positive and negative points can be
thought of as using @math{-1} as a square root of unity. If a 4th root of
unity was available then a further split and speedup would be possible, but no
such root exists for plain integers. Going to complex integers with
-@m{i=\sqrt{-1}, i=sqrt(-1)} doesn't help, essentially because in Cartesian
+@m{i=\sqrt{-1}, i=sqrt(-1)} doesn't help, essentially because in cartesian
form it takes three real multiplies to do a complex multiply. The existence
of @m{2^k,2^k'}th roots of unity in a suitable ring or field lets the fast
-Fourier transform keep splitting and get to @m{O(N \log r), O(N*log(r))}.
+fourier transform keep splitting and get to @m{O(N \log r), O(N*log(r))}.
Floating point FFTs use complex numbers approximating Nth roots of unity.
Some processors have special support for such FFTs. But these are not used in
@@ -8366,7 +8046,7 @@ GMP.
@cindex Unbalanced multiplication
Multiplication of operands with different sizes, both below
-@code{MUL_TOOM22_THRESHOLD} are done with plain schoolbook multiplication
+@code{MUL_KARATSUBA_THRESHOLD} are done with plain schoolbook multiplication
(@pxref{Basecase Multiplication}).
For really large operands, we invoke FFT directly.
@@ -8391,7 +8071,6 @@ can be split into 2, 3, or 4 coefficients, i.e., a polynomial of degree 1 to
* Single Limb Division::
* Basecase Division::
* Divide and Conquer Division::
-* Block-Wise Barrett Division::
* Exact Division::
* Exact Remainder::
* Small Quotient Division::
@@ -8472,10 +8151,10 @@ Q@cross{}M multiplication, differing in fact only in the extra multiply and
divide for each of the Q quotient limbs.
-@node Divide and Conquer Division, Block-Wise Barrett Division, Basecase Division, Division Algorithms
+@node Divide and Conquer Division, Exact Division, Basecase Division, Division Algorithms
@subsection Divide and Conquer Division
-For divisors larger than @code{DC_DIV_QR_THRESHOLD}, division is done by dividing.
+For divisors larger than @code{DIV_DC_THRESHOLD}, division is done by dividing.
Or to be precise by a recursive divide and conquer algorithm based on work by
Moenck and Borodin, Jebelean, and Burnikel and Ziegler (@pxref{References}).
@@ -8491,11 +8170,11 @@ If the (N/2)@cross{}(N/2) multiplies are done with a basecase multiplication
then the work is about the same as a basecase division, but with more function
call overheads and with some subtractions separated from the multiplies.
These overheads mean that it's only when N/2 is above
-@code{MUL_TOOM22_THRESHOLD} that divide and conquer is of use.
+@code{MUL_KARATSUBA_THRESHOLD} that divide and conquer is of use.
-@code{DC_DIV_QR_THRESHOLD} is based on the divisor size N, so it will be somewhere
-above twice @code{MUL_TOOM22_THRESHOLD}, but how much above depends on the
-CPU@. An optimized @code{mpn_mul_basecase} can lower @code{DC_DIV_QR_THRESHOLD} a
+@code{DIV_DC_THRESHOLD} is based on the divisor size N, so it will be somewhere
+above twice @code{MUL_KARATSUBA_THRESHOLD}, but how much above depends on the
+CPU@. An optimized @code{mpn_mul_basecase} can lower @code{DIV_DC_THRESHOLD} a
little by offering a ready-made advantage over repeated @code{mpn_submul_1}
calls.
@@ -8508,24 +8187,14 @@ algorithms the @math{M(N)} term improves and the multiplier tends to @m{\log
N, log(N)}. In practice, at moderate to large sizes, a 2N@cross{}N division
is about 2 to 4 times slower than an N@cross{}N multiplication.
+Newton's method used for division is asymptotically @math{O(M(N))} and should
+therefore be superior to divide and conquer, but it's believed this would only
+be for large to very large N.
-@node Block-Wise Barrett Division, Exact Division, Divide and Conquer Division, Division Algorithms
-@subsection Block-Wise Barrett Division
-
-For the largest divisions, a block-wise Barrett division algorithm is used.
-Here, the divisor is inverted to a precision determined by the relative size of
-the dividend and divisor. Blocks of quotient limbs are then generated by
-multiplying blocks from the dividend by the inverse.
-
-Our block-wise algorithm computes a smaller inverse than in the plain Barrett
-algorithm. For a @math{2n/n} division, the inverse will be just @m{\lceil n/2
-\rceil, ceil(n/2)} limbs.
-
-@node Exact Division, Exact Remainder, Block-Wise Barrett Division, Division Algorithms
+@node Exact Division, Exact Remainder, Divide and Conquer Division, Division Algorithms
@subsection Exact Division
-
A so-called exact division is when the dividend is known to be an exact
multiple of the divisor. Jebelean's exact division algorithm uses this
knowledge to make some significant optimizations (@pxref{References}).
@@ -8561,7 +8230,7 @@ Q*(Q-1)/2}. Notice the savings are complementary. If Q is big then many
divisions are saved, or if Q is small then the crossproducts reduce to a small
number.
-The modular inverse used is calculated efficiently by @code{binvert_limb} in
+The modular inverse used is calculated efficiently by @code{modlimb_invert} in
@file{gmp-impl.h}. This does four multiplies for a 32-bit limb, or six for a
64-bit limb. @file{tune/modlinv.c} has some alternate implementations that
might suit processors better at bit twiddling than multiplying.
@@ -8614,10 +8283,10 @@ products must be done as a normal division, but there's still some single limb
divisions saved. When @math{d} is a single limb some simplifications arise,
providing good speedups on a number of processors.
-The functions @code{mpn_divexact_by3}, @code{mpn_modexact_1_odd} and the
-internal @code{mpn_redc_X} functions differ subtly in how they return @math{r},
-leading to some negations in the above formula, but all are essentially the
-same.
+@code{mpn_bdivmod}, @code{mpn_divexact_by3}, @code{mpn_modexact_1_odd} and the
+@code{redc} function in @code{mpz_powm} differ subtly in how they return
+@math{r}, leading to some negations in the above formula, but all are
+essentially the same.
@cindex Divisibility algorithm
@cindex Congruence algorithm
@@ -8626,8 +8295,9 @@ leads to divisibility or congruence tests which are potentially more efficient
than a normal division.
The factor of @math{b^n} on @math{r} can be ignored in a GCD when @math{d} is
-odd, hence the use of @code{mpn_modexact_1_odd} by @code{mpn_gcd_1} and
-@code{mpz_kronecker_ui} etc (@pxref{Greatest Common Divisor Algorithms}).
+odd, hence the use of @code{mpn_bdivmod} in @code{mpn_gcd}, and the use of
+@code{mpn_modexact_1_odd} by @code{mpn_gcd_1} and @code{mpz_kronecker_ui} etc
+(@pxref{Greatest Common Divisor Algorithms}).
Montgomery's REDC method for modular multiplications uses operands of the form
of @m{xb^{-n}, x*b^-n} and @m{yb^{-n}, y*b^-n} and on calculating @m{(xb^{-n})
@@ -8764,7 +8434,7 @@ single-limb elements. This is done by the function @code{mpn_hgcd2}. The
resulting matrix is applied to the inputs using @code{mpn_mul_1} and
@code{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
+examining just the most significant two limbs, and the quotient is computing
using plain division.
The resulting algorithm is asymptotically @math{O(N^2)}, just as the Euclidean
@@ -8881,9 +8551,6 @@ current size of the cofactors.
@subsection Jacobi Symbol
@cindex Jacobi symbol algorithm
-[This section is obsolete. The current Jacobi code actually uses a very
-efficient algorithm.]
-
@code{mpz_jacobi} and @code{mpz_kronecker} are currently implemented with a
simple binary algorithm similar to that described for the GCDs (@pxref{Binary
GCD}). They're not very fast when both inputs are large. Lehmer's multi-step
@@ -8930,10 +8597,14 @@ exponent. Larger exponents use larger values of @math{k}, the choice being
made to minimize the average number of multiplications that must supplement
the squaring.
-The modular multiplies and squarings use either a simple division or the REDC
+The modular multiplies and squares use either a simple division or the REDC
method by Montgomery (@pxref{References}). REDC is a little faster,
essentially saving N single limb divisions in a fashion similar to an exact
-remainder (@pxref{Exact Remainder}).
+remainder (@pxref{Exact Remainder}). The current REDC has some limitations.
+It's only @math{O(N^2)} so above @code{POWM_THRESHOLD} division becomes faster
+and is used. It doesn't attempt to detect small bases, but rather always uses
+a REDC form, which is usually a full size operand. And lastly it's only
+applied to odd moduli.
@node Root Extraction Algorithms, Radix Conversion Algorithms, Powering Algorithms, Algorithms
@@ -9092,7 +8763,7 @@ to save operations, so long as the lookup tables don't become too big.
A square root must still be taken for any value that passes these tests, to
verify it's really a square and not one of the small fraction of non-squares
-that get through (i.e.@: a pseudo-square to all the tested bases).
+that get through (ie.@: a pseudo-square to all the tested bases).
Clearly more residue tests could be done, @code{mpz_perfect_square_p} only
uses a compact and efficient set. Big inputs would probably benefit from more
@@ -9194,7 +8865,7 @@ calculating a bigger radix power.
Another possible improvement for the sub-quadratic part would be to arrange
for radix powers that balanced the sizes of quotient and remainder produced,
-i.e.@: the highest power would be an @m{b^{nk},b^(n*k)} approximately equal to
+ie.@: the highest power would be an @m{b^{nk},b^(n*k)} approximately equal to
@m{\sqrt{t},sqrt(t)}, not restricted to a @math{2^i} factor. That ought to
smooth out a graph of times against sizes, but may or may not be a net
speedup.
@@ -9285,75 +8956,42 @@ for an arbitrary @math{n}.
@subsection Factorial
@cindex Factorial algorithm
-Factorials are calculated by a combination of two algorithms. An idea is
-shared among them: to compute the odd part of the factorial; a final step
-takes account of the power of @math{2} term, by shifting.
-
-For small @math{n}, the odd factor of @math{n!} is computed with the simple
-observation that it is equal to the product of all positive odd numbers
-smaller than @math{n} times the odd factor of @m{\lfloor n/2\rfloor!, [n/2]!},
-where @m{\lfloor x\rfloor, [x]} is the integer part of @math{x}, and so on
-recursively. The procedure can be best illustrated with an example,
+Factorials are calculated by a combination of removal of twos, powering, and
+binary splitting. The procedure can be best illustrated with an example,
@quotation
-@math{23! = (23.21.19.17.15.13.11.9.7.5.3)(11.9.7.5.3)(5.3)2^{19}}
+@math{23! = 1.2.3.4.5.6.7.8.9.10.11.12.13.14.15.16.17.18.19.20.21.22.23}
@end quotation
-Current code collects all the factors in a single list, with a loop and no
-recursion, and compute the product, with no special care for repeated chunks.
-
-When @math{n} is larger, computation pass trough prime sieving. An helper
-function is used, as suggested by Peter Luschny:
-@tex
-$$\mathop{\rm msf}(n) = {n!\over\lfloor n/2\rfloor!^2\cdot2^k} = \prod_{p=3}^{n}
-p^{\mathop{\rm L}(p,n)} $$
-@end tex
-@ifnottex
-
-@example
- n
- -----
- n! | | L(p,n)
-msf(n) = -------------- = | | p
- [n/2]!^2.2^k p=3
-@end example
-@end ifnottex
+@noindent
+has factors of two removed,
-Where @math{p} ranges on odd prime numbers. The exponent @math{k} is chosen to
-obtain an odd integer number: @math{k} is the number of 1 bits in the binary
-representation of @m{\lfloor n/2\rfloor, [n/2]}. The function L@math{(p,n)}
-can be defined as zero when @math{p} is composite, and, for any prime
-@math{p}, it is computed with:
-@tex
-$$\mathop{\rm L}(p,n) = \sum_{i>0}\left\lfloor{n\over p^i}\right\rfloor\bmod2
-\leq\log_p(n)$$
-@end tex
-@ifnottex
+@quotation
+@math{23! = 2^{19}.1.1.3.1.5.3.7.1.9.5.11.3.13.7.15.1.17.9.19.5.21.11.23}
+@end quotation
-@example
- ---
- \ n
-L(p,n) = / [---] mod 2 <= log (n) .
- --- p^i p
- i>0
-@end example
-@end ifnottex
+@noindent
+and the resulting terms collected up according to their multiplicity,
-With this helper function, we are able to compute the odd part of @math{n!}
-using the recursion implied by @m{n!=\lfloor n/2\rfloor!^2\cdot\mathop{\rm
-msf}(n)\cdot2^k , n!=[n/2]!^2*msf(n)*2^k}. The recursion stops using the
-small-@math{n} algorithm on some @m{\lfloor n/2^i\rfloor, [n/2^i]}.
+@quotation
+@math{23! = 2^{19}.(3.5)^3.(7.9.11)^2.(13.15.17.19.21.23)}
+@end quotation
-Both the above algorithms use binary splitting to compute the product of many
-small factors. At first as many products as possible are accumulated in a
-single register, generating a list of factors that fit in a machine word. This
-list is then split into halves, and the product is computed recursively.
+Each sequence such as @math{13.15.17.19.21.23} is evaluated by splitting into
+every second term, as for instance @math{(13.17.21).(15.19.23)}, and the same
+recursively on each half. This is implemented iteratively using some bit
+twiddling.
Such splitting is more efficient than repeated N@cross{}1 multiplies since it
forms big multiplies, allowing Karatsuba and higher algorithms to be used.
And even below the Karatsuba threshold a big block of work can be more
efficient for the basecase algorithm.
+Splitting into subsequences of every second term keeps the resulting products
+more nearly equal in size than would the simpler approach of say taking the
+first half and second half of the sequence. Nearly equal products are more
+efficient for the current multiply implementation.
+
@node Binomial Coefficients Algorithm, Fibonacci Numbers Algorithm, Factorial Algorithm, Other Algorithms
@subsection Binomial Coefficients
@@ -9533,7 +9171,7 @@ are also very good and this is the default algorithm used by GMP.
@cindex Linear congruential algorithm
Linear congruential generators are described in many text books, for instance
Knuth volume 2 (@pxref{References}). With a modulus @math{M} and parameters
-@math{A} and @math{C}, an integer state @math{S} is iterated by the formula
+@math{A} and @math{C}, a integer state @math{S} is iterated by the formula
@math{S @leftarrow{} A@GMPmultiply{}S+C @bmod{} M}. At each step the new
state is a linear function of the previous, mod @math{M}, hence the name of
the generator.
@@ -10480,10 +10118,7 @@ evaluating it,
@example
struct __gmp_binary_plus
@{
- static void eval(mpf_t f, const mpf_t g, const mpf_t h)
- @{
- mpf_add(f, g, h);
- @}
+ static void eval(mpf_t f, mpf_t g, mpf_t h) @{ mpf_add(f, g, h); @}
@};
@end example
@@ -10516,7 +10151,7 @@ mpf_class & mpf_class::operator=(const __gmp_expr<T> &expr)
template <class Op>
void __gmp_expr<__gmp_binary_expr<mpf_class, mpf_class, Op> >::eval
-(mpf_t f, mp_bitcnt_t precision)
+(mpf_t f, unsigned long int precision)
@{
Op::eval(f, expr.val1.get_mpf_t(), expr.val2.get_mpf_t());
@}
@@ -10552,7 +10187,7 @@ And the corresponding specializations of @code{__gmp_expr::eval}:
template <class T, class U, class Op>
void __gmp_expr
<__gmp_binary_expr<__gmp_expr<T>, __gmp_expr<U>, Op> >::eval
-(mpf_t f, mp_bitcnt_t precision)
+(mpf_t f, unsigned long int precision)
@{
// declare two temporaries
mpf_class temp1(expr.val1, precision), temp2(expr.val2, precision);
@@ -10594,9 +10229,8 @@ was a driving force behind many of the optimizations in GMP 3. Paul also
wrote the new GMP 4.3 nth root code (with Torbj@"orn).
Ken Weber (Kent State University, Universidade Federal do Rio Grande do Sul)
-contributed now defunct versions of @code{mpz_gcd}, @code{mpz_divexact},
-@code{mpn_gcd}, and @code{mpn_bdivmod}, partially supported by CNPq (Brazil)
-grant 301314194-2.
+contributed @code{mpz_gcd}, @code{mpz_divexact}, @code{mpn_gcd}, and
+@code{mpn_bdivmod}, partially supported by CNPq (Brazil) grant 301314194-2.
Per Bothner of Cygnus Support helped to set up GMP to use Cygnus' configure.
He has also made valuable suggestions and tested numerous intermediary
@@ -10642,46 +10276,19 @@ Jason Moxham rewrote @code{mpz_fac_ui}.
Pedro Gimeno implemented the Mersenne Twister and made other random number
improvements.
-Niels M@"oller wrote the sub-quadratic GCD, extended GCD and jacobi code, the
+Niels M@"oller wrote the sub-quadratic GCD and extended GCD code, the
quadratic Hensel division code, and (with Torbj@"orn) the new divide and
conquer division code for GMP 4.3. Niels also helped implement the new Toom
-multiply code for GMP 4.3 and implemented helper functions to simplify Toom
-evaluations for GMP 5.0. He wrote the original version of mpn_mulmod_bnm1, and
-he is the main author of the mini-gmp package used for gmp bootstrapping.
+multiply code for GMP 4.3.
Alberto Zanoni and Marco Bodrato suggested the unbalanced multiply strategy,
and found the optimal strategies for evaluation and interpolation in Toom
-multiplication.
-
-Marco Bodrato helped implement the new Toom multiply code for GMP 4.3 and
-implemented most of the new Toom multiply and squaring code for 5.0.
-He is the main author of the current mpn_mulmod_bnm1 and mpn_mullo_n. Marco
-also wrote the functions mpn_invert and mpn_invertappr. He is the author of
-the current combinatorial functions: binomial, factorial, multifactorial,
-primorial.
+multiplication. Marco also helped implement the new Toom multiply code for
+GMP 4.3.
David Harvey suggested the internal function @code{mpn_bdiv_dbm1}, implementing
division relevant to Toom multiplication. He also worked on fast assembly
-sequences, in particular on a fast AMD64 @code{mpn_mul_basecase}. He wrote
-the internal middle product functions @code{mpn_mulmid_basecase},
-@code{mpn_toom42_mulmid}, @code{mpn_mulmid_n} and related helper routines.
-
-Martin Boij wrote @code{mpn_perfect_power_p}.
-
-Marc Glisse improved @file{gmpxx.h}: use fewer temporaries (faster),
-specializations of @code{numeric_limits} and @code{common_type}, C++11
-features (move constructors, explicit bool conversion, UDL), make the
-conversion from @code{mpq_class} to @code{mpz_class} explicit, optimize
-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.
+sequences, in particular on a fast AMD64 @code{mpn_mul_basecase}.
(This list is chronological, not ordered after significance. If you have
contributed to GMP but are not listed above, please tell
@@ -10691,11 +10298,8 @@ 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.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.
+The development of GMP 2, 3, and 4 was supported in part by the IDA Center for
+Computing Sciences.
Thanks go to Hans Thorsen for donating an SGI system for the GMP test system
environment.
@@ -10722,7 +10326,7 @@ Analytic Number Theory and Computational Complexity'', Wiley, 1998.
@item
Richard Crandall and Carl Pomerance, ``Prime Numbers: A Computational
Perspective'', 2nd edition, Springer-Verlag, 2005.
-@texlinebreak{} @uref{http://www.math.dartmouth.edu/~carlp/}
+@texlinebreak{} @uref{http://math.dartmouth.edu/~carlp/}
@item
Henri Cohen, ``A Course in Computational Algebraic Number Theory'', Graduate
@@ -10745,8 +10349,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{https://gcc.gnu.org/onlinedocs/}, and in the GCC package
-@uref{https://ftp.gnu.org/gnu/gcc/}
+@uref{http://gcc.gnu.org/onlinedocs/}, and in the GCC package
+@uref{ftp://ftp.gnu.org/gnu/gcc/}
@end itemize
@section Papers
@@ -10755,8 +10359,8 @@ Collection'', Free Software Foundation, 2008, available online
@item
Yves Bertot, Nicolas Magaud and Paul Zimmermann, ``A Proof of GMP Square
Root'', Journal of Automated Reasoning, volume 29, 2002, pp.@: 225-252. Also
-available online as INRIA Research Report 4475, June 2002,
-@uref{http://hal.inria.fr/docs/00/07/21/13/PDF/RR-4475.pdf}
+available online as INRIA Research Report 4475, June 2001,
+@uref{http://www.inria.fr/rrrt/rr-4475.html}
@item
Christoph Burnikel and Joachim Ziegler, ``Fast Recursive Division'',
@@ -10766,15 +10370,15 @@ 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{https://gmplib.org/~tege/divcnst-pldi94.pdf}.
+1994. Also available @uref{ftp://ftp.cwi.nl/pub/pmontgom/divcnst.psa4.gz}
+(and .psl.gz).
@item
-Niels M@"oller and Torbj@"orn Granlund, ``Improved division by invariant
-integers'', IEEE Transactions on Computers, 11 June 2010.
-@uref{https://gmplib.org/~tege/division-paper.pdf}
+Niels M"oller and Torbj@"orn Granlund, ``Improved division by invariant
+integers'', to appear.
@item
-Torbj@"orn Granlund and Niels M@"oller, ``Division of integers large and
+Torbj@"orn Granlund and Niels M"oller, ``Division of integers large and
small'', to appear.
@item
@@ -10846,7 +10450,7 @@ volume 21, number 1, March 1995, pp.@: 111-122.
@item
Paul Zimmermann, ``Karatsuba Square Root'', INRIA Research Report 3805,
-November 1999, @uref{http://hal.inria.fr/inria-00072854/PDF/RR-3805.pdf}
+November 1999, @uref{http://www.inria.fr/rrrt/rr-3805.html}
@item
Paul Zimmermann, ``A Proof of GMP Fast Division and Square Root
diff --git a/gmp/doc/isa_abi_headache b/gmp/doc/isa_abi_headache
index 7e1430d3d3..753589d9b5 100644
--- a/gmp/doc/isa_abi_headache
+++ b/gmp/doc/isa_abi_headache
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/doc/mdate-sh b/gmp/doc/mdate-sh
index 60dc485a37..8941738a4a 100755
--- a/gmp/doc/mdate-sh
+++ b/gmp/doc/mdate-sh
@@ -1,10 +1,9 @@
#!/bin/sh
# Get modification time of a file or directory and pretty-print it.
-scriptversion=2010-08-21.06; # UTC
+scriptversion=2003-11-09.00
-# Copyright (C) 1995, 1996, 1997, 2003, 2004, 2005, 2007, 2009, 2010
-# Free Software Foundation, Inc.
+# Copyright (C) 1995, 1996, 1997, 2003 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
@@ -18,7 +17,8 @@ scriptversion=2010-08-21.06; # UTC
# 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/>.
+# along with this program; if not, write to the Free Software Foundation,
+# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -29,15 +29,6 @@ scriptversion=2010-08-21.06; # UTC
# 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
@@ -47,26 +38,18 @@ case $1 in
cat <<\EOF
Usage: mdate-sh [--help] [--version] FILE
-Pretty-print the modification day of FILE, in the format:
-1 January 1970
+Pretty-print the modification time of FILE.
Report bugs to <bug-automake@gnu.org>.
EOF
- exit $?
+ exit 0
;;
-v | --v*)
echo "mdate-sh $scriptversion"
- exit $?
+ exit 0
;;
esac
-error ()
-{
- echo "$0: $1" >&2
- exit 1
-}
-
-
# Prevent date giving response in another language.
LANG=C
export LANG
@@ -75,15 +58,13 @@ export LC_ALL
LC_TIME=C
export LC_TIME
-# 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
+# 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
-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
@@ -91,10 +72,6 @@ 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
@@ -109,14 +86,13 @@ 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;"
@@ -136,35 +112,14 @@ do
esac
done
-test -n "$month" || error "failed parsing \`$ls_command /' output"
-
# Get the extended ls output of the file or directory.
-set dummy x`eval "$ls_command \"\\\$save_arg1\""`
+set - x`eval "$ls_command \"\$save_arg1\""`
# Remove all preceding arguments
eval $command
-# 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
+# Get the month. Next argument is day, followed by the year or time.
+case $1 in
Jan) month=January; nummonth=1;;
Feb) month=February; nummonth=2;;
Mar) month=March; nummonth=3;;
@@ -179,10 +134,7 @@ case $2 in
Dec) month=December; nummonth=12;;
esac
-case $3 in
- ???*) day=$1;;
- *) day=$3; shift;;
-esac
+day=$2
# Here we have to deal with the problem that the ls output gives either
# the time of day or the year.
@@ -220,6 +172,5 @@ 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-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
+# time-stamp-end: "$"
# End:
diff --git a/gmp/doc/projects.html b/gmp/doc/projects.html
index 4a105142b0..39a82074d6 100644
--- a/gmp/doc/projects.html
+++ b/gmp/doc/projects.html
@@ -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=utf-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<center>
@@ -15,40 +15,30 @@
<font size=-1>
<pre>
-Copyright 2000-2006, 2008-2011 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
</pre>
</font>
<hr>
<!-- NB. timestamp updated automatically by emacs -->
- 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>.
+ This file current as of 1 May 2009. An up-to-date version is available at
+ <a href="http://gmplib.org/projects.html">http://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
@@ -63,9 +53,27 @@ see https://www.gnu.org/licenses/.
<ul>
<li> <strong>Faster multiplication</strong>
+ <p> The current multiplication code uses Karatsuba, 3-way and 4-way Toom, and
+ Fermat FFT. Several new developments are desirable:
+
<ol>
- <li> Work on the algorithm selection code for unbalanced multiplication.
+ <li> Write more toom multiply functions for unbalanced operands. We now have
+ toom22, toom32, toom42, toom62, toom33, toom53, and toom44. Most
+ desirable is toom43, which will require a new toom_interpolate_6pts
+ function. Writing toom52 will then be straightforward. See also
+ <a href="http://bodrato.it/software/toom.html">Marco Bodrato's
+ site</a>
+
+ <li> Perhaps consider N-way Toom, N > 4. See Knuth's Seminumerical
+ Algorithms for details on the method, as well as Bodrato's site. Code
+ implementing it exists. This is asymptotically inferior to FFTs, but
+ is finer grained.
+
+ <li> The mpn_mul call now (from GMP 4.3) uses toom22, toom32, and toom42
+ for unbalanced operations. We don't use any of the other new toom
+ functions currently. Write new clever code for choosing the best toom
+ function from an m-limb and an n-limb operand.
<li> Implement an FFT variant computing the coefficients mod m different
limb size primes of the form l*2^k+1. i.e., compute m separate FFTs.
@@ -82,10 +90,18 @@ see https://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.]
-
- <li> Work on short products. Our mullo and mulmid are probably K, but we
- lack mulhi.
+ Färnqvist and one by Niels Möller.]
+
+ <li> Add support for short products, either a given number of low limbs, a
+ given number of high limbs, or perhaps the middle limbs of the result.
+ High short product can be used by <code>mpf_mul</code>, by
+ left-to-right Newton approximations, and for quotient approximation.
+ Low half short product can be of use in sub-quadratic REDC and for
+ right-to-left Newton approximations. On small sizes a short product
+ will be faster simply through fewer cross-products, similar to the way
+ squaring is faster. But work by Thom Mulders shows that for Karatsuba
+ and higher order algorithms the advantage is progressively lost, so
+ for large sizes shows products turn out to be no faster.
</ol>
@@ -105,8 +121,8 @@ see https://www.gnu.org/licenses/.
<p> Please make sure your new routines are fast for these three situations:
<ol>
+ <li> Operands that fit into the cache.
<li> Small operands of less than, say, 10 limbs.
- <li> Medium size operands, that fit into the cache.
<li> Huge operands that does not fit into the cache.
</ol>
@@ -116,24 +132,32 @@ see https://www.gnu.org/licenses/.
<p> Standard techniques for these routines are unrolling, software
pipelining, and specialization for common operand values. For machines
- with poor integer multiplication, it is sometimes possible to remedy the
- situation using floating-point operations or SIMD operations such as MMX
- (x86) (x86), SSE (x86), VMX (PowerPC), VIS (Sparc).
+ with poor integer multiplication, it is often possible to improve the
+ performance using floating-point operations, or SIMD operations such as
+ MMX or Sun's VIS.
<p> Using floating-point operations is interesting but somewhat tricky.
Since IEEE double has 53 bit of mantissa, one has to split the operands
- in small pieces, so that no intermediates are greater than 2^53. For
- 32-bit computers, splitting one operand into 16-bit pieces works. For
- 64-bit machines, one operand can be split into 21-bit pieces and the
- other into 32-bit pieces. (A 64-bit operand can be split into just three
- 21-bit pieces if one allows the split operands to be negative!)
+ in small pieces, so that no result is greater than 2^53. For 32-bit
+ computers, splitting one operand into 16-bit pieces works. For 64-bit
+ machines, one operand can be split into 21-bit pieces and the other into
+ 32-bit pieces. (A 64-bit operand can be split into just three 21-bit
+ pieces if one allows the split operands to be negative!)
+
+
+<li> <strong>Math functions for the mpf layer</strong>
+
+ <p> Implement the functions of math.h for the GMP mpf layer! Check the book
+ "Pi and the AGM" by Borwein and Borwein for ideas how to do this. These
+ functions are desirable: acos, acosh, asin, asinh, atan, atanh, atan2,
+ cos, cosh, exp, log, log10, pow, sin, sinh, tan, tanh.
<li> <strong>Faster sqrt</strong>
<p> The current code uses divisions, which are reasonably fast, but it'd be
possible to use only multiplications by computing 1/sqrt(A) using this
- iteration:
+ formula:
<pre>
2
x = x (3 &minus; A x )/2
@@ -147,29 +171,14 @@ see https://www.gnu.org/licenses/.
overall.
<p> We should probably allow a special exponent-like parameter, to speed
- computations of a precise square root of a small number in mpf and mpfr.
+ computations of a precise square root of a small number in mpf.
<li> <strong>Nth root</strong>
- <p> Improve mpn_rootrem. The current code is not too bad, but its time
- complexity is a function of the input, while it is possible to make
- the <i>average</i> complexity a function of the output.
-
-
-<li> <strong>Fat binaries</strong>
-
- <p> Add more functions to the set of fat functions.
-
- <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
- become run-time selections for fat binaries.
-
- <p> If we make fat binaries work really well, we should move away frm tehe
- current configure scheme (at least by default) and instead include all code
- always.
+ <p> Improve mpn_rootrem. The current code is not to bad, but its average
+ time complexity is a function of the input, while it is possible to
+ make it a function of the output.
<li> <strong>Exceptions</strong>
@@ -330,6 +339,133 @@ see https://www.gnu.org/licenses/.
<code>gmp_restrict</code>.
+<li> <strong>Nx1 Division</strong>
+
+ <p> The limb-by-limb dependencies in the existing Nx1 division (and
+ remainder) code means that chips with multiple execution units or
+ pipelined multipliers are not fully utilized.
+
+ <p> One possibility is to follow the current preinv method but taking two
+ limbs at a time. That means a 2x2-&gt;4 and a 2x1-&gt;2 multiply for
+ each two limbs processed, and because the 2x2 and 2x1 can each be done in
+ parallel the latency will be not much more than 2 multiplies for two
+ limbs, whereas the single limb method has a 2 multiply latency for just
+ one limb. A version of <code>mpn_divrem_1</code> doing this has been
+ written in C, but not yet tested on likely chips. Clearly this scheme
+ would extend to 3x3-&gt;9 and 3x1-&gt;3 etc, though with diminishing
+ returns.
+
+ <p> For <code>mpn_mod_1</code>, Peter L. Montgomery proposes the following
+ scheme. For a limb R=2^<code>bits_per_mp_limb</code>, pre-calculate
+ values R mod N, R^2 mod N, R^3 mod N, R^4 mod N. Then take dividend
+ limbs and multiply them by those values, thereby reducing them (moving
+ them down) by the corresponding factor. The products can be added to
+ produce an intermediate remainder of 2 or 3 limbs to be similarly
+ included in the next step. The point is that such multiplies can be done
+ in parallel, meaning as little as 1 multiply worth of latency for 4
+ limbs. If the modulus N is less than R/4 (or is it R/5?) the summed
+ products will fit in 2 limbs, otherwise 3 will be required, but with the
+ high only being small. Clearly this extends to as many factors of R as a
+ chip can efficiently apply.
+
+ <p> The logical conclusion for powers R^i is a whole array "p[i] = R^i mod N"
+ for i up to k, the size of the dividend. This could then be applied at
+ multiplier throughput speed like an inner product. If the powers took
+ roughly k divide steps to calculate then there'd be an advantage any time
+ the same N was used three or more times. Suggested by Victor Shoup in
+ connection with chinese-remainder style decompositions, but perhaps with
+ other uses.
+
+ <p> <code>mpn_modexact_1_odd</code> calculates an x in the range 0&lt;=x&lt;d
+ satisfying a = q*d + x*b^n, where b=2^bits_per_limb. The factor b^n
+ needed to get the true remainder r could be calculated by a powering
+ algorithm, allowing <code>mpn_modexact_1_odd</code> to be pressed into
+ service for an <code>mpn_mod_1</code>. <code>modexact_1</code> is
+ simpler and on some chips can run noticeably faster than plain
+ <code>mod_1</code>, on Athlon for instance 11 cycles/limb instead of 17.
+ Such a difference could soon overcome the time to calculate b^n. The
+ requirement for an odd divisor in <code>modexact</code> can be handled by
+ some shifting on-the-fly, or perhaps by an extra partial-limb step at the
+ end.
+
+
+<li> <strong>Factorial</strong>
+
+ <p> The removal of twos in the current code could be extended to factors of 3
+ or 5. Taking this to its logical conclusion would be a complete
+ decomposition into powers of primes. The power for a prime p is of
+ course floor(n/p)+floor(n/p^2)+... Conrad Curry found this is quite fast
+ (using simultaneous powering as per Handbook of Applied Cryptography
+ algorithm 14.88).
+
+ <p> A difficulty with using all primes is that quite large n can be
+ calculated on a system with enough memory, larger than we'd probably want
+ for a table of primes, so some sort of sieving would be wanted. Perhaps
+ just taking out the factors of 3 and 5 would give most of the speedup
+ that a prime decomposition can offer.
+
+
+<li> <strong>Binomial Coefficients</strong>
+
+ <p> An obvious improvement to the current code would be to strip factors of 2
+ from each multiplier and divisor and count them separately, to be applied
+ with a bit shift at the end. Factors of 3 and perhaps 5 could even be
+ handled similarly.
+
+ <p> Conrad Curry reports a big speedup for binomial coefficients using a
+ prime powering scheme, at least for k near n/2. Of course this is only
+ practical for moderate size n since again it requires primes up to n.
+
+ <p> When k is small the current (n-k+1)...n/1...k will be fastest. Some sort
+ of rule would be needed for when to use this or when to use prime
+ powering. Such a rule will be a function of both n and k. Some
+ investigation is needed to see what sort of shape the crossover line will
+ have, the usual parameter tuning can of course find machine dependent
+ constants to fill in where necessary.
+
+ <p> An easier possibility also reported by Conrad Curry is that it may be
+ faster not to divide out the denominator (1...k) one-limb at a time, but
+ do one big division at the end. Is this because a big divisor in
+ <code>mpn_bdivmod</code> trades the latency of
+ <code>mpn_divexact_1</code> for the throughput of
+ <code>mpn_submul_1</code>? Overheads must hurt though.
+
+ <p> Another reason a big divisor might help is that
+ <code>mpn_divexact_1</code> won't be getting a full limb in
+ <code>mpz_bin_uiui</code>. It's called when the n accumulator is full
+ but the k may be far from full. Perhaps the two could be decoupled so k
+ is applied when full. It'd be necessary to delay consideration of k
+ terms until the corresponding n terms had been applied though, since
+ otherwise the division won't be exact.
+
+
+<li> <strong>Perfect Power Testing</strong>
+
+ <p> <code>mpz_perfect_power_p</code> could be improved in a number of ways,
+ for instance p-adic arithmetic to find possible roots.
+
+ <p> Non-powers can be quickly identified by checking for Nth power residues
+ modulo small primes, like <code>mpn_perfect_square_p</code> does for
+ squares. The residues to each power N for a given remainder could be
+ grouped into a bit mask, the masks for the remainders to each divisor
+ would then be "and"ed together to hopefully leave only a few candidate
+ powers. Need to think about how wide to make such masks, ie. how many
+ powers to examine in this way.
+
+ <p> Any zero remainders found in residue testing reveal factors which can be
+ divided out, with the multiplicity restricting the powers that need to be
+ considered, as per the current code. Further prime dividing should be
+ grouped into limbs like <code>PP</code>. Need to think about how much
+ dividing to do like that, probably more for bigger inputs, less for
+ smaller inputs.
+
+ <p> <code>mpn_gcd_1</code> would probably be better than the current private
+ GCD routine. The use it's put to isn't time-critical, and it might help
+ ensure correctness to just use the main GCD routine.
+
+ <p> [There is work-in-progress with a very fast function.]
+
+
<li> <strong>Prime Testing</strong>
<p> GMP is not really a number theory library and probably shouldn't have
@@ -449,16 +585,6 @@ see https://www.gnu.org/licenses/.
selecting public symbols (used now for libmp).
-<li> <strong>Math functions for the mpf layer</strong>
-
- <p> Implement the functions of math.h for the GMP mpf layer! Check the book
- "Pi and the AGM" by Borwein and Borwein for ideas how to do this. These
- functions are desirable: acos, acosh, asin, asinh, atan, atanh, atan2,
- cos, cosh, exp, log, log10, pow, sin, sinh, tan, tanh.
-
- <p> Note that the <a href="http://mpfr.org">mpfr</a> functions already
- provide these functions, and that we usually recommend new programs to use
- mpfr instead of mpf.
</ul>
<hr>
diff --git a/gmp/doc/stamp-vti b/gmp/doc/stamp-vti
index 08f09e7e86..227ebb6db5 100644
--- a/gmp/doc/stamp-vti
+++ b/gmp/doc/stamp-vti
@@ -1,4 +1,4 @@
-@set UPDATED 25 March 2014
-@set UPDATED-MONTH March 2014
-@set EDITION 6.0.0
-@set VERSION 6.0.0
+@set UPDATED 7 January 2010
+@set UPDATED-MONTH January 2010
+@set EDITION 4.3.2
+@set VERSION 4.3.2
diff --git a/gmp/doc/tasks.html b/gmp/doc/tasks.html
index 9a25bef1a3..1c3a12b29a 100644
--- a/gmp/doc/tasks.html
+++ b/gmp/doc/tasks.html
@@ -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=utf-8">
+ <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>
<center>
@@ -15,40 +15,30 @@
<font size=-1>
<pre>
-Copyright 2000-2004, 2006, 2008, 2009 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
</pre>
</font>
<hr>
<!-- NB. timestamp updated automatically by emacs -->
- 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>.
+ This file current as of 1 May 2009. An up-to-date version is available at
+ <a href="http://gmplib.org/tasks.html">http://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
@@ -72,6 +62,13 @@ either already been taken care of, or have become irrelevant.
<code>_mpz_realloc</code> with a small (1 limb) size.
<li> One reuse case is missing from mpX/tests/reuse.c:
<code>mpz_XXX(a,a,a)</code>.
+<li> When printing <code>mpf_t</code> numbers with exponents &gt;2^53 on
+ machines with 64-bit <code>mp_exp_t</code>, the precision of
+ <code>__mp_bases[base].chars_per_bit_exactly</code> is insufficient and
+ <code>mpf_get_str</code> aborts. Detect and compensate. Alternately,
+ think seriously about using some sort of fixed-point integer value.
+ Avoiding unnecessary floating point is probably a good thing in general,
+ and it might be faster on some CPUs.
<li> Make the string reading functions allow the `0x' prefix when the base is
explicitly 16. They currently only allow that prefix when the base is
unspecified (zero).
@@ -125,6 +122,9 @@ either already been taken care of, or have become irrelevant.
subsequent operations, especially if the value is otherwise only small.
If low bits of the low limb are zero, use <code>mpn_rshift</code> so as
to not increase the size.
+<li> <code>mpn_dc_sqrtrem</code>: Don't use <code>mpn_addmul_1</code> with
+ multiplier==2, instead either <code>mpn_addlsh1_n</code> when available,
+ or <code>mpn_lshift</code>+<code>mpn_add_n</code> if not.
<li> <code>mpn_dc_sqrtrem</code>, <code>mpn_sqrtrem2</code>: Don't use
<code>mpn_add_1</code> and <code>mpn_sub_1</code> for 1 limb operations,
instead <code>ADDC_LIMB</code> and <code>SUBC_LIMB</code>.
@@ -133,12 +133,20 @@ either already been taken care of, or have become irrelevant.
aliasing between <code>sp</code> and <code>rp</code>.
<li> <code>mpn_sqrtrem</code>: Some work can be saved in the last step when
the remainder is not required, as noted in Paul's paper.
+<li> <code>mpq_add</code>, <code>mpq_add</code>: The division "op1.den / gcd"
+ is done twice, where of course only once is necessary. Reported by Larry
+ Lambe.
<li> <code>mpq_add</code>, <code>mpq_sub</code>: The gcd fits a single limb
- with high probability and in this case <code>binvert_limb</code> could
+ with high probability and in this case <code>modlimb_invert</code> could
be used to calculate the inverse just once for the two exact divisions
"op1.den / gcd" and "op2.den / gcd", rather than letting
- <code>mpn_bdiv_q_1</code> do it each time. This would require calling
- <code>mpn_pi1_bdiv_q_1</code>.
+ <code>mpn_divexact_1</code> do it each time. This would require a new
+ <code>mpn_preinv_divexact_1</code> interface. Not sure if it'd be worth
+ the trouble.
+<li> <code>mpq_add</code>, <code>mpq_sub</code>: The use of
+ <code>mpz_mul(x,y,x)</code> causes temp allocation or copying in
+ <code>mpz_mul</code> which can probably be avoided. A rewrite using
+ <code>mpn</code> might be best.
<li> <code>mpn_gcdext</code>: Don't test <code>count_leading_zeros</code> for
zero, instead check the high bit of the operand and avoid invoking
<code>count_leading_zeros</code>. This is an optimization on all
@@ -146,7 +154,7 @@ either already been taken care of, or have become irrelevant.
<code>count_leading_zeros</code>, though it's possible an already
normalized operand might not be encountered very often.
<li> Rewrite <code>umul_ppmm</code> to use floating-point for generating the
- most significant limb (if <code>GMP_LIMB_BITS</code> &lt= 52 bits).
+ most significant limb (if <code>BITS_PER_MP_LIMB</code> &lt= 52 bits).
(Peter Montgomery has some ideas on this subject.)
<li> Improve the default <code>umul_ppmm</code> code in longlong.h: Add partial
products with fewer operations.
@@ -165,20 +173,26 @@ either already been taken care of, or have become irrelevant.
since there's no apparent way to get <code>SHRT_MAX</code> with an
expression (since <code>short</code> and <code>unsigned short</code> can
be different sizes).
-<li> <code>mpz_powm</code> and <code>mpz_powm_ui</code> aren't very fast on one
- or two limb moduli, due to a lot of function call overheads. These could
- perhaps be handled as special cases.
-<li> Make sure <code>mpz_powm_ui</code> is never slower than the corresponding
- computation using <code>mpz_powm</code>.
+<li> <code>mpz_powm</code> and <code>mpz_powm_ui</code> aren't very
+ fast on one or two limb moduli, due to a lot of function call
+ overheads. These could perhaps be handled as special cases.
+<li> <code>mpz_powm</code> and <code>mpz_powm_ui</code> want better
+ algorithm selection, and the latter should use REDC. Both could
+ change to use an <code>mpn_powm</code> and <code>mpn_redc</code>.
<li> <code>mpz_powm</code> REDC should do multiplications by <code>g[]</code>
using the division method when they're small, since the REDC form of a
small multiplier is normally a full size product. Probably would need a
new tuned parameter to say what size multiplier is "small", as a function
of the size of the modulus.
-<li> <code>mpn_gcd</code> might be able to be sped up on small to moderate
- sizes by improving <code>find_a</code>, possibly just by providing an
- alternate implementation for CPUs with slowish
+<li> <code>mpz_powm</code> REDC should handle even moduli if possible. Maybe
+ this would mean for m=n*2^k doing mod n using REDC and an auxiliary
+ calculation mod 2^k, then putting them together at the end.
+<li> <code>mpn_gcd</code> might be able to be sped up on small to
+ moderate sizes by improving <code>find_a</code>, possibly just by
+ providing an alternate implementation for CPUs with slowish
<code>count_leading_zeros</code>.
+<li> Toom3 could use a low to high cache localized evaluate and interpolate.
+ The necessary <code>mpn_divexact_by3c</code> exists.
<li> <code>mpf_set_str</code> produces low zero limbs when a string has a
fraction but is exactly representable, eg. 0.5 in decimal. These could be
stripped to save work in later operations.
@@ -203,7 +217,7 @@ either already been taken care of, or have become irrelevant.
an in-place there.
<li> <code>mpf_div_ui</code>: Whether the high quotient limb is zero can be
determined by testing the dividend for high&lt;divisor. When non-zero, the
- division can be done on prec dividend limbs instead of prec+1. The result
+ divison can be done on prec dividend limbs instead of prec+1. The result
size is also known before the division, so that can be a tail call (once
the <code>TMP_ALLOC</code> is eliminated).
<li> <code>mpn_divrem_2</code> could usefully accept unnormalized divisors and
@@ -309,7 +323,7 @@ either already been taken care of, or have become irrelevant.
<code>__builtin_clzl</code> and <code>__builtin_popcountl</code> using
the corresponding CIX <code>ct</code> instructions, and
<code>__builtin_alpha_cmpbge</code>. These should give GCC more
- information about scheduling etc than the <code>asm</code> blocks
+ information about sheduling etc than the <code>asm</code> blocks
currently used in longlong.h and gmp-impl.h.
<li> Alpha Unicos: Apparently there's no <code>alloca</code> on this system,
making <code>configure</code> choose the slower
@@ -357,7 +371,7 @@ either already been taken care of, or have become irrelevant.
<li> UltraSPARC/32: <code>mpn_divexact_by3c</code> can work 64-bits at a time
using <code>mulx</code>, in assembler. This would be the same as for
sparc64.
-<li> UltraSPARC: <code>binvert_limb</code> might save a few cycles from
+<li> UltraSPARC: <code>modlimb_invert</code> might save a few cycles from
masking down to just the useful bits at each point in the calculation,
since <code>mulx</code> speed depends on the highest bit set. Either
explicit masks or small types like <code>short</code> and
@@ -422,7 +436,7 @@ either already been taken care of, or have become irrelevant.
<code>mpn_rshift</code> already provided.
<li> Cray T3E: Experiment with optimization options. In particular,
-hpipeline3 seems promising. We should at least up -O to -O2 or -O3.
-<li> Cray: <code>mpn_com</code> and <code>mpn_and_n</code> etc very probably
+<li> Cray: <code>mpn_com_n</code> and <code>mpn_and_n</code> etc very probably
wants a pragma like <code>MPN_COPY_INCR</code>.
<li> Cray vector systems: <code>mpn_lshift</code>, <code>mpn_rshift</code>,
<code>mpn_popcount</code> and <code>mpn_hamdist</code> are nice and small
@@ -487,7 +501,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:
@@ -524,7 +538,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.
@@ -714,7 +728,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 unnecessary
+<li> <code>mpq_class operator+=</code>: Don't emit an unnecssary
<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,
diff --git a/gmp/doc/texinfo.tex b/gmp/doc/texinfo.tex
index 85f184cc4c..bac0726023 100644
--- a/gmp/doc/texinfo.tex
+++ b/gmp/doc/texinfo.tex
@@ -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{2013-02-01.11}
+\def\texinfoversion{2008-04-18.10}
%
-% Copyright 1985, 1986, 1988, 1990, 1991, 1992, 1993, 1994, 1995,
+% Copyright (C) 1985, 1986, 1988, 1990, 1991, 1992, 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.
+% 2007, 2008 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
@@ -24,14 +24,13 @@
%
% 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 Exception is an additional permission under section 7
-% of the GNU General Public License, version 3 ("GPLv3").
+% restriction. (This has been our intent since Texinfo was invented.)
%
% Please try the latest version of texinfo.tex before submitting bug
% reports; you can get the latest version from:
-% 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)
+% 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).
% The texinfo.tex in any given distribution could well be out
% of date, so if that's what you're using, please check.
%
@@ -66,6 +65,7 @@
\everyjob{\message{[Texinfo version \texinfoversion]}%
\catcode`+=\active \catcode`\_=\active}
+
\chardef\other=12
% We never want plain's \outer definition of \+ in Texinfo.
@@ -93,13 +93,11 @@
\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.
@@ -117,11 +115,10 @@
% 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
@@ -160,18 +157,15 @@
\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.
@@ -202,7 +196,36 @@
% that mark overfull boxes (in case you have decided
% that the text looks ok even though it passes the margin).
%
-\def\finalout{\overfullrule=0pt }
+\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
+ }%
+ }%
+}
% Sometimes it is convenient to have everything in the transcript file
% and nothing on the terminal. We don't just call \tracingall here,
@@ -220,7 +243,7 @@
\tracingmacros2
\tracingrestores1
\showboxbreadth\maxdimen \showboxdepth\maxdimen
- \ifx\eTeXversion\thisisundefined\else % etex gives us more logging
+ \ifx\eTeXversion\undefined\else % etex gives us more logging
\tracingscantokens1
\tracingifs1
\tracinggroups1
@@ -231,13 +254,6 @@
\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.
%
@@ -248,6 +264,7 @@
\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
@@ -338,7 +355,7 @@
% 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.
@@ -557,7 +574,7 @@
}
\def\inenvironment#1{%
\ifx#1\empty
- outside of any environment%
+ out of any environment%
\else
in environment \expandafter\string#1%
\fi
@@ -569,7 +586,7 @@
\parseargdef\end{%
\if 1\csname iscond.#1\endcsname
\else
- % The general wording of \badenverr may not be ideal.
+ % The general wording of \badenverr may not be ideal, but... --kasal, 06nov03
\expandafter\checkenv\csname#1\endcsname
\csname E#1\endcsname
\endgroup
@@ -579,6 +596,85 @@
\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
@@ -595,7 +691,7 @@
\def\:{\spacefactor=1000 }
% @* forces a line break.
-\def\*{\unskip\hfil\break\hbox{}\ignorespaces}
+\def\*{\hfil\break\hbox{}\ignorespaces}
% @/ allows a line break.
\let\/=\allowbreak
@@ -610,7 +706,7 @@
\def\?{?\spacefactor=\endofsentencespacefactor\space}
% @frenchspacing on|off says whether to put extra space after punctuation.
-%
+%
\def\onword{on}
\def\offword{off}
%
@@ -620,7 +716,7 @@
\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
}
@@ -702,6 +798,15 @@ 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.
@@ -765,7 +870,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'. Not documented, written for gawk manual.
+% class. WHICH is `l' or `r'.
%
\newskip\inmarginspacing \inmarginspacing=1cm
\def\strutdepth{\dp\strutbox}
@@ -812,36 +917,6 @@ 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}
@@ -851,8 +926,6 @@ 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
@@ -871,8 +944,6 @@ where each line of input produces a line of output.}
\catcode`>=\other
\catcode`+=\other
\catcode`-=\other
- \catcode`\`=\other
- \catcode`\'=\other
}
\def\pushthisfilestack{%
@@ -888,7 +959,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
@@ -896,46 +967,36 @@ where each line of input produces a line of output.}
%
\parseargdef\center{%
\ifhmode
- \let\centersub\centerH
+ \let\next\centerH
\else
- \let\centersub\centerV
+ \let\next\centerV
\fi
- \centersub{\hfil \ignorespaces#1\unskip \hfil}%
- \let\centersub\relax % don't let the definition persist, just in case
+ \next{\hfil \ignorespaces#1\unskip \hfil}%
}
-\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\centerH#1{%
+ {%
+ \hfil\break
+ \advance\hsize by -\leftskip
+ \advance\hsize by -\rightskip
+ \line{#1}%
+ \break
+ }%
}
+\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
@@ -1028,6 +1089,107 @@ 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
@@ -1092,8 +1254,9 @@ 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 being undefined.
-\ifx\pdfoutput\thisisundefined
+% can be set). So we test for \relax and 0 as well as \undefined,
+% borrowed from ifpdf.sty.
+\ifx\pdfoutput\undefined
\else
\ifx\pdfoutput\relax
\else
@@ -1108,24 +1271,50 @@ 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.
%
-% 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
+{\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}%
}
\newhelp\nopdfimagehelp{Texinfo supports .png, .jpg, .jpeg, and .pdf images
@@ -1135,17 +1324,11 @@ output) for that.)}
\ifpdf
%
- % 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}}
+ % Color manipulation macros based on pdfcolor.tex.
+ \def\cmykDarkRed{0.28 1 1 0.35}
+ \def\cmykBlack{0 0 0 1}
%
+ \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{%
@@ -1154,7 +1337,7 @@ output) for that.)}
\pdfsetcolor{#1}%
}
%
- \def\maincolor{\rgbBlack}
+ \def\maincolor{\cmykBlack}
\pdfsetcolor{\maincolor}
\edef\thiscolor{\maincolor}
\def\lastcolordefs{}
@@ -1184,34 +1367,32 @@ output) for that.)}
%
% #1 is image name, #2 width (might be empty/whitespace), #3 height (ditto).
\def\dopdfimage#1#2#3{%
- \def\pdfimagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
- \def\pdfimageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
+ \def\imagewidth{#2}\setbox0 = \hbox{\ignorespaces #2}%
+ \def\imageheight{#3}\setbox2 = \hbox{\ignorespaces #3}%
%
- % 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.
+ % pdftex (and the PDF format) support .png, .jpg, .pdf (among
+ % others). Let's try in that order.
\let\pdfimgext=\empty
\begingroup
- \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
+ \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
\errhelp = \nopdfimagehelp
\errmessage{Could not find image file #1 for pdf}%
- \else \gdef\pdfimgext{JPG}%
+ \else \gdef\pdfimgext{PDF}%
\fi
- \else \gdef\pdfimgext{jpeg}%
+ \else \gdef\pdfimgext{pdf}%
\fi
- \else \gdef\pdfimgext{jpg}%
+ \else \gdef\pdfimgext{JPG}%
\fi
- \else \gdef\pdfimgext{png}%
+ \else \gdef\pdfimgext{jpeg}%
\fi
- \else \gdef\pdfimgext{PDF}%
+ \else \gdef\pdfimgext{jpg}%
\fi
- \else \gdef\pdfimgext{pdf}%
+ \else \gdef\pdfimgext{png}%
\fi
\closein 1
\endgroup
@@ -1223,8 +1404,8 @@ output) for that.)}
\else
\immediate\pdfximage
\fi
- \ifdim \wd0 >0pt width \pdfimagewidth \fi
- \ifdim \wd2 >0pt height \pdfimageheight \fi
+ \ifdim \wd0 >0pt width \imagewidth \fi
+ \ifdim \wd2 >0pt height \imageheight \fi
\ifnum\pdftexversion<13
#1.\pdfimgext
\else
@@ -1239,9 +1420,10 @@ output) for that.)}
% such as \, aren't expanded when present in a section title.
\indexnofonts
\turnoffactive
+ \activebackslashdouble
\makevalueexpandable
\def\pdfdestname{#1}%
- \txiescapepdf\pdfdestname
+ \backslashparens\pdfdestname
\safewhatsit{\pdfdest name{\pdfdestname} xyz}%
}}
%
@@ -1250,8 +1432,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{\rgbDarkRed}
- \def\linkcolor{\rgbDarkRed}
+ \def\urlcolor{\cmykDarkRed}
+ \def\linkcolor{\cmykDarkRed}
\def\endlink{\setcolor{\maincolor}\pdfendlink}
%
% Adding outlines to PDF; macros for calculating structure of outlines
@@ -1273,24 +1455,29 @@ 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.
- \edef\pdfoutlinedest{#3}%
+ \def\pdfoutlinedest{#3}%
\ifx\pdfoutlinedest\empty
\def\pdfoutlinedest{#4}%
\else
- \txiescapepdf\pdfoutlinedest
+ % Doubled backslashes in the name.
+ {\activebackslashdouble \xdef\pdfoutlinedest{#3}%
+ \backslashparens\pdfoutlinedest}%
\fi
%
- % Also escape PDF chars in the display string.
- \edef\pdfoutlinetext{#1}%
- \txiescapepdf\pdfoutlinetext
+ % Also double the backslashes in the display string.
+ {\activebackslashdouble \xdef\pdfoutlinetext{#1}%
+ \backslashparens\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}%
@@ -1344,41 +1531,25 @@ output) for that.)}
% Latin 2 (0xea) gets translated to a | character. Info from
% Staszek Wawrykiewicz, 19 Jan 2004 04:09:24 +0100.
%
- % 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.
- %
+ % 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.
\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
- \addtokens{\filename}{\PP}%
- \advance\filenamelength by 1
+ \ifx\p\space\else\addtokens{\filename}{\PP}%
+ \advance\filenamelength by 1
+ \fi
\fi
\nextsp}
- \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
- }
+ \def\getfilename#1{\filenamelength=0\expandafter\skipspaces#1|\relax}
\ifnum\pdftexversion < 14
\let \startlink \pdfannotlink
\else
@@ -1391,15 +1562,11 @@ 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) >>}%
@@ -1430,7 +1597,6 @@ 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
@@ -1461,10 +1627,6 @@ 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
@@ -1475,6 +1637,9 @@ 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.
@@ -1486,7 +1651,6 @@ 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
@@ -1508,7 +1672,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\thisisundefined \else
+\ifpdf \ifx\pdffontattr\undefined \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
@@ -1759,34 +1923,28 @@ end
\fi\fi
-% Set the font macro #1 to the font named \fontprefix#2.
+% Set the font macro #1 to the font named #2, adding on the
+% specified font prefix (normally `cm').
% #3 is the font's design size, #4 is a scale factor, #5 is the CMap
-% encoding (only OT1, OT1IT and OT1TT are allowed, or empty to omit).
-% Example:
-% #1 = \textrm
-% #2 = \rmshape
-% #3 = 10
-% #4 = \mainmagstep
-% #5 = OT1
-%
+% encoding (currently only OT1, OT1IT and OT1TT are allowed, pass
+% empty to omit).
\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
-%
-% (end of cmaps)
+% emacs-page 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\thisisundefined
+\ifx\fontprefix\undefined
\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}
@@ -1801,8 +1959,9 @@ end
\def\scshape{csc}
\def\scbshape{csc}
-% Definitions for a main text size of 11pt. (The default in Texinfo.)
-%
+% Definitions for a main text size of 11pt. This is the default in
+% Texinfo.
+%
\def\definetextfontsizexi{%
% Text fonts (11.2pt, magstep1).
\def\textnominalsize{11pt}
@@ -1865,6 +2024,8 @@ 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).
@@ -1923,17 +2084,17 @@ end
\font\reducedsy=cmsy10
\def\reducedecsize{1000}
-\textleading = 13.2pt % line spacing for 11pt CM
-\textfonts % reset the current fonts
+% reset the current fonts
+\textfonts
\rm
-} % end of 11pt text font size definitions, \definetextfontsizexi
+} % end of 11pt text font size definitions
% 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}
@@ -1996,6 +2157,8 @@ 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).
@@ -2022,7 +2185,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}
@@ -2054,28 +2217,29 @@ end
\font\reducedsy=cmsy9
\def\reducedecsize{0900}
-\divide\parskip by 2 % reduce space between paragraphs
-\textleading = 12pt % line spacing for 10pt CM
-\textfonts % reset the current fonts
+% reduce space between paragraphs
+\divide\parskip by 2
+
+% reset the current fonts
+\textfonts
\rm
-} % end of 10pt text font size definitions, \definetextfontsizex
+} % end of 10pt text font size definitions
% We provide the user-level command
% @fonttextsize 10
% (or 11) to redefine the text font size. pt is assumed.
-%
-\def\xiword{11}
+%
\def\xword{10}
-\def\xwordpt{10pt}
+\def\xiword{11}
%
\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
@@ -2125,8 +2289,8 @@ end
\let\tenttsl=\titlettsl
\def\curfontsize{title}%
\def\lsize{chap}\def\lllsize{subsec}%
- \resetmathfonts \setleading{27pt}}
-\def\titlefont#1{{\titlefonts\rmisbold #1}}
+ \resetmathfonts \setleading{25pt}}
+\def\titlefont#1{{\titlefonts\rm #1}}
\def\chapfonts{%
\let\tenrm=\chaprm \let\tenit=\chapit \let\tensl=\chapsl
\let\tenbf=\chapbf \let\tentt=\chaptt \let\smallcaps=\chapsc
@@ -2177,16 +2341,6 @@ 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
@@ -2200,213 +2354,53 @@ 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
-
-\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}
+% Define these so they can be easily changed for other fonts.
+\def\angleleft{$\langle$}
+\def\angleright{$\rangle$}
% Count depth in font-changes, for error checks
\newcount\fontdepth \fontdepth=0
-% Font commands.
+% 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}
-% #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}
+%% Add scribe-like font environments, plus @l for inline lisp (usually sans
+%% serif) and @ii for TeX italic
-% 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
-}
+% \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}
-% Unconditional use \ttsl, and no ic. @var is set to this for defuns.
-\def\ttslanted#1{{\ttsl #1}}
+% like \smartslanted except unconditionally uses \ttsl.
+% @var is set to this for defun arguments.
+\def\ttslanted#1{{\ttsl #1}\futurelet\next\smartitalicx}
-% @cite is like \smartslanted except unconditionally use \sl. We never want
+% like \smartslanted except unconditionally use \sl. We never want
% ttsl for book titles, do we?
-\def\cite#1{{\sl #1}\futurelet\next\smartitaliccorrection}
-
-\def\aftersmartic{}
-\def\var#1{%
- \let\saveaftersmartic = \aftersmartic
- \def\aftersmartic{\null\let\aftersmartic=\saveaftersmartic}%
- \smartslanted{#1}%
-}
+\def\cite#1{{\sl #1}\futurelet\next\smartitalicx}
\let\i=\smartitalic
\let\slanted=\smartslanted
+\let\var=\smartslanted
\let\dfn=\smartslanted
\let\emph=\smartitalic
-% 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.
+% @b, explicit bold.
\def\b#1{{\bf #1}}
\let\strong=\b
@@ -2438,21 +2432,30 @@ 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}
-% @samp.
-\def\samp#1{{\setupmarkupstyle{samp}\lq\tclose{#1}\rq\null}}
-
-% @indicateurl is \samp, that is, with quotes.
-\let\indicateurl=\samp
+% @file, @option are the same as @samp.
+\let\file=\samp
+\let\option=\samp
-% @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.
+% @code is a modification of @t,
+% which makes spaces the same size as normal in the surrounding text.
\def\tclose#1{%
{%
% Change normal interword space to be same as for the current font.
@@ -2471,13 +2474,13 @@ end
\plainfrenchspacing
#1%
}%
- \null % reset spacefactor to 1000
+ \null
}
% 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)
@@ -2486,26 +2489,24 @@ end
{
\catcode`\-=\active \catcode`\_=\active
\catcode`\'=\active \catcode`\`=\active
- \global\let'=\rq \global\let`=\lq % default definitions
%
\global\def\code{\begingroup
- \setupmarkupstyle{code}%
- % The following should really be moved into \setupmarkupstyle handlers.
+ \catcode\rquoteChar=\active \catcode\lquoteChar=\active
+ \let'\codequoteright \let`\codequoteleft
+ %
\catcode\dashChar=\active \catcode\underChar=\active
\ifallowcodebreaks
\let-\codedash
\let_\codeunder
\else
- \let-\normaldash
+ \let-\realdash
\let_\realunder
\fi
\codex
}
}
-\def\codex #1{\tclose{#1}\endgroup}
-
-\def\normaldash{-}
+\def\realdash{-}
\def\codedash{-\discretionary{}{}{}}
\def\codeunder{%
% this is all so @math{@code{var_name}+1} can work. In math mode, _
@@ -2518,12 +2519,13 @@ 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 bad.
-% @allowcodebreaks provides a document-level way to turn breaking at -
-% and _ on and off.
-%
+% 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.
+%
\newif\ifallowcodebreaks \allowcodebreakstrue
\def\keywordtrue{true}
@@ -2537,25 +2539,62 @@ end
\allowcodebreaksfalse
\else
\errhelp = \EMsimple
- \errmessage{Unknown @allowcodebreaks option `\txiarg', must be true|false}%
+ \errmessage{Unknown @allowcodebreaks option `\txiarg'}%
\fi\fi
}
-% For @command, @env, @file, @option quotes seem unnecessary,
-% so use \code rather than \samp.
-\let\command=\code
+% @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
-\let\file=\code
-\let\option=\code
+\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}
% @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.
-% (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
+% 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
\unsepspaces
\pdfurl{#1}%
\setbox0 = \hbox{\ignorespaces #3}%
@@ -2576,103 +2615,6 @@ 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
@@ -2694,81 +2636,34 @@ end
\let\email=\uref
\fi
-% @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}
+% 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 }
% 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}%
@@ -2776,12 +2671,11 @@ 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}%
@@ -2789,258 +2683,8 @@ end
\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
-}
-
-% 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\$}}
@@ -3050,59 +2694,52 @@ 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
}
-% 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
-%
+% 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.
\def\guillemetleft{{\ecfont \char"13}}
\def\guillemotleft{\guillemetleft}
\def\guillemetright{{\ecfont \char"14}}
@@ -3112,52 +2749,19 @@ 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/sans and italic/slanted, but this
+ % We can't distinguish serif/sanserif 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}%
- \ifmonospace
- % typewriter:
- \font\thisecfont = ectt\ecsize \space at \nominalsize
+ \ifx\curfontstyle\bfstylename
+ % bold:
+ \font\thisecfont = ecb\ifusingit{i}{x}\ecsize \space at \nominalsize
\else
- \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
+ % regular:
+ \font\thisecfont = ec\ifusingit{ti}{rm}\ecsize \space at \nominalsize
\fi
\thisecfont
}
@@ -3179,8 +2783,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\thisisundefined
+%
+\ifx\Orb\undefined
\def\Orb{\mathhexbox20D}
\fi
@@ -3208,9 +2812,8 @@ 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.
@@ -3270,28 +2873,17 @@ end
\finishedtitlepagetrue
}
-% 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:
+%%% 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
- \vbox{\titlefonts \raggedtitlesettings #1\par}%
+ \leftline{\titlefonts\rm #1}
% print a rule at the page bottom also.
\finishedtitlepagefalse
\vskip4pt \hrule height 4pt width \hsize \vskip4pt
@@ -3312,12 +2904,12 @@ end
\else
\checkenv\titlepage
\ifseenauthor\else \vskip 0pt plus 1filll \seenauthortrue \fi
- {\secfonts\rmisbold \leftline{#1}}%
+ {\authorfont \leftline{#1}}%
\fi
}
-% Set up page headings and footings.
+%%% Set up page headings and footings.
\let\thispage=\folio
@@ -3411,14 +3003,10 @@ end
\def\headings #1 {\csname HEADINGS#1\endcsname}
-\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
-
+\def\HEADINGSoff{%
+\global\evenheadline={\hfil} \global\evenfootline={\hfil}
+\global\oddheadline={\hfil} \global\oddfootline={\hfil}}
+\HEADINGSoff
% 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
@@ -3469,7 +3057,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\thisisundefined
+\ifx\today\undefined
\def\today{%
\number\day\space
\ifcase\month
@@ -3530,7 +3118,7 @@ end
\begingroup
\advance\leftskip by-\tableindent
\advance\hsize by\tableindent
- \advance\rightskip by0pt plus1fil\relax
+ \advance\rightskip by0pt plus1fil
\leavevmode\unhbox0\par
\endgroup
%
@@ -3544,7 +3132,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
@@ -3638,18 +3226,9 @@ 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
}
@@ -3670,7 +3249,6 @@ 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
}
@@ -3892,19 +3470,12 @@ 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. \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
-}%
+% of an alignment entry. Note that \everycr resets \everytab.
+\def\headitem{\checkenv\multitable \crcr \global\everytab={\bf}\the\everytab}%
%
% 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 again encounter the problem the 1sp was intended to solve.
+% we encounter the problem it was intended to solve again.
% --karl, nathan@acm.org, 20apr99.
\def\tab{\checkenv\multitable &\the\everytab}%
@@ -4016,18 +3587,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}
@@ -4188,7 +3759,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-\normaldash \let_\normalunderscore
+ \let-\realdash \let_\normalunderscore
}
}
@@ -4228,7 +3799,7 @@ end
}
\def\ifsetfail{\doignore{ifset}}
-% @ifclear VAR ... @end executes the `...' iff VAR has never been
+% @ifclear VAR ... @end ifclear reads 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
@@ -4239,35 +3810,6 @@ 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
@@ -4332,11 +3874,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 \relax
+ \expandafter \ifx\csname donesynindex#2\endcsname \undefined
% 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
@@ -4371,14 +3913,11 @@ end
\def\@{@}% change to @@ when we switch to @ as escape char in index files.
\def\ {\realbackslash\space }%
%
- % 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}}%
+ % 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
%
% I don't entirely understand this, but when an index entry is
% generated from a macro call, the \endinput which \scanmacro inserts
@@ -4389,7 +3928,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}
@@ -4397,12 +3936,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
%
@@ -4431,7 +3970,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.
@@ -4450,28 +3989,23 @@ end
\commondummiesnofonts
%
\definedummyletter\_%
- \definedummyletter\-%
%
% Non-English letters.
\definedummyword\AA
\definedummyword\AE
- \definedummyword\DH
\definedummyword\L
- \definedummyword\O
\definedummyword\OE
- \definedummyword\TH
+ \definedummyword\O
\definedummyword\aa
\definedummyword\ae
- \definedummyword\dh
- \definedummyword\exclamdown
\definedummyword\l
- \definedummyword\o
\definedummyword\oe
+ \definedummyword\o
+ \definedummyword\ss
+ \definedummyword\exclamdown
+ \definedummyword\questiondown
\definedummyword\ordf
\definedummyword\ordm
- \definedummyword\questiondown
- \definedummyword\ss
- \definedummyword\th
%
% Although these internal commands shouldn't show up, sometimes they do.
\definedummyword\bf
@@ -4487,27 +4021,21 @@ 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\lbracechar
- \definedummyword\leq
+ \definedummyword\expansion
\definedummyword\minus
- \definedummyword\ogonek
\definedummyword\pounds
\definedummyword\point
\definedummyword\print
@@ -4517,7 +4045,6 @@ end
\definedummyword\quoteleft
\definedummyword\quoteright
\definedummyword\quotesinglbase
- \definedummyword\rbracechar
\definedummyword\result
\definedummyword\textdegree
%
@@ -4552,7 +4079,6 @@ end
\definedummyword\v
\definedummyword\H
\definedummyword\dotaccent
- \definedummyword\ogonek
\definedummyword\ringaccent
\definedummyword\tieaccent
\definedummyword\ubaraccent
@@ -4563,27 +4089,18 @@ 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
@@ -4611,7 +4128,7 @@ end
\def\definedummyaccent##1{\let##1\asis}%
% We can just ignore other control letters.
\def\definedummyletter##1{\let##1\empty}%
- % All control words become @asis by default; overrides below.
+ % Hopefully, all control words can become @asis.
\let\definedummyword\definedummyaccent
%
\commondummiesnofonts
@@ -4623,63 +4140,48 @@ 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\ordf{a}%
- \def\ordm{o}%
\def\o{o}%
- \def\questiondown{?}%
\def\ss{ss}%
- \def\th{zzz}%
+ \def\exclamdown{!}%
+ \def\questiondown{?}%
+ \def\ordf{a}%
+ \def\ordm{o}%
%
\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\leq{<=}%
+ \def\expansion{==>}%
\def\minus{-}%
- \def\point{.}%
\def\pounds{pounds}%
+ \def\point{.}%
\def\print{-|}%
\def\quotedblbase{"}%
\def\quotedblleft{"}%
@@ -4687,31 +4189,22 @@ end
\def\quoteleft{`}%
\def\quoteright{'}%
\def\quotesinglbase{,}%
- \def\registeredsymbol{R}%
\def\result{=>}%
- \def\textdegree{o}%
- %
- \expandafter\ifx\csname SETtxiindexlquoteignore\endcsname\relax
- \else \indexlquoteignore \fi
+ \def\textdegree{degrees}%
%
% 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)?
@@ -4809,9 +4302,10 @@ 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}%
@@ -4835,6 +4329,7 @@ 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.
@@ -4847,7 +4342,8 @@ 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}
@@ -4966,6 +4462,7 @@ 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{%
@@ -5002,17 +4499,10 @@ 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
@@ -5245,22 +4735,7 @@ end
\message{sectioning,}
% Chapters, sections, etc.
-% 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
+% \unnumberedno is an oxymoron, of course. 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
@@ -5339,8 +4814,8 @@ end
\chardef\maxseclevel = 3
%
% A numbered section within an unnumbered changes to unnumbered too.
-% To achieve this, remember the "biggest" unnum. sec. we are currently in:
-\chardef\unnlevel = \maxseclevel
+% To achive this, remember the "biggest" unnum. sec. we are currently in:
+\chardef\unmlevel = \maxseclevel
%
% Trace whether the current chapter is an appendix or not:
% \chapheadtype is "N" or "A", unnumbered chapters are ignored.
@@ -5365,8 +4840,8 @@ end
% The heading type:
\def\headtype{#1}%
\if \headtype U%
- \ifnum \absseclevel < \unnlevel
- \chardef\unnlevel = \absseclevel
+ \ifnum \absseclevel < \unmlevel
+ \chardef\unmlevel = \absseclevel
\fi
\else
% Check for appendix sections:
@@ -5378,10 +4853,10 @@ end
\fi\fi
\fi
% Check for numbered within unnumbered:
- \ifnum \absseclevel > \unnlevel
+ \ifnum \absseclevel > \unmlevel
\def\headtype{U}%
\else
- \chardef\unnlevel = 3
+ \chardef\unmlevel = 3
\fi
\fi
% Now print the heading:
@@ -5435,9 +4910,7 @@ end
\gdef\chaplevelprefix{\the\chapno.}%
\resetallfloatnos
%
- % \putwordChapter can contain complex things in translations.
- \toks0=\expandafter{\putwordChapter}%
- \message{\the\toks0 \space \the\chapno}%
+ \message{\putwordChapter\space \the\chapno}%
%
% Write the actual heading.
\chapmacro{#1}{Ynumbered}{\the\chapno}%
@@ -5448,17 +4921,15 @@ end
\global\let\subsubsection = \numberedsubsubsec
}
-\outer\parseargdef\appendix{\apphead0{#1}} % normally calls appendixzzz
-%
+\outer\parseargdef\appendix{\apphead0{#1}} % normally apphead0 calls appendixzzz
\def\appendixzzz#1{%
\global\secno=0 \global\subsecno=0 \global\subsubsecno=0
\global\advance\appendixno by 1
\gdef\chaplevelprefix{\appendixletter.}%
\resetallfloatnos
%
- % \putwordAppendix can contain complex things in translations.
- \toks0=\expandafter{\putwordAppendix}%
- \message{\the\toks0 \space \appendixletter}%
+ \def\appendixnum{\putwordAppendix\space \appendixletter}%
+ \message{\appendixnum}%
%
\chapmacro{#1}{Yappendix}{\appendixletter}%
%
@@ -5467,8 +4938,7 @@ end
\global\let\subsubsection = \appendixsubsubsec
}
-% normally unnmhead0 calls unnumberedzzz:
-\outer\parseargdef\unnumbered{\unnmhead0{#1}}
+\outer\parseargdef\unnumbered{\unnmhead0{#1}} % normally unnmhead0 calls unnumberedzzz
\def\unnumberedzzz#1{%
\global\secno=0 \global\subsecno=0 \global\subsubsecno=0
\global\advance\unnumberedno by 1
@@ -5512,47 +4982,40 @@ 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}%
}
-% normally calls appendixsectionzzz:
-\outer\parseargdef\appendixsection{\apphead1{#1}}
+\outer\parseargdef\appendixsection{\apphead1{#1}} % normally calls appendixsectionzzz
\def\appendixsectionzzz#1{%
\global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
\sectionheading{#1}{sec}{Yappendix}{\appendixletter.\the\secno}%
}
\let\appendixsec\appendixsection
-% normally calls unnumberedseczzz:
-\outer\parseargdef\unnumberedsec{\unnmhead1{#1}}
+\outer\parseargdef\unnumberedsec{\unnmhead1{#1}} % normally calls unnumberedseczzz
\def\unnumberedseczzz#1{%
\global\subsecno=0 \global\subsubsecno=0 \global\advance\secno by 1
\sectionheading{#1}{sec}{Ynothing}{\the\unnumberedno.\the\secno}%
}
% Subsections.
-%
-% normally calls numberedsubseczzz:
-\outer\parseargdef\numberedsubsec{\numhead2{#1}}
+\outer\parseargdef\numberedsubsec{\numhead2{#1}} % normally calls numberedsubseczzz
\def\numberedsubseczzz#1{%
\global\subsubsecno=0 \global\advance\subsecno by 1
\sectionheading{#1}{subsec}{Ynumbered}{\the\chapno.\the\secno.\the\subsecno}%
}
-% normally calls appendixsubseczzz:
-\outer\parseargdef\appendixsubsec{\apphead2{#1}}
+\outer\parseargdef\appendixsubsec{\apphead2{#1}} % normally calls appendixsubseczzz
\def\appendixsubseczzz#1{%
\global\subsubsecno=0 \global\advance\subsecno by 1
\sectionheading{#1}{subsec}{Yappendix}%
{\appendixletter.\the\secno.\the\subsecno}%
}
-% normally calls unnumberedsubseczzz:
-\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}}
+\outer\parseargdef\unnumberedsubsec{\unnmhead2{#1}} %normally calls unnumberedsubseczzz
\def\unnumberedsubseczzz#1{%
\global\subsubsecno=0 \global\advance\subsecno by 1
\sectionheading{#1}{subsec}{Ynothing}%
@@ -5560,25 +5023,21 @@ end
}
% Subsubsections.
-%
-% normally numberedsubsubseczzz:
-\outer\parseargdef\numberedsubsubsec{\numhead3{#1}}
+\outer\parseargdef\numberedsubsubsec{\numhead3{#1}} % normally numberedsubsubseczzz
\def\numberedsubsubseczzz#1{%
\global\advance\subsubsecno by 1
\sectionheading{#1}{subsubsec}{Ynumbered}%
{\the\chapno.\the\secno.\the\subsecno.\the\subsubsecno}%
}
-% normally appendixsubsubseczzz:
-\outer\parseargdef\appendixsubsubsec{\apphead3{#1}}
+\outer\parseargdef\appendixsubsubsec{\apphead3{#1}} % normally appendixsubsubseczzz
\def\appendixsubsubseczzz#1{%
\global\advance\subsubsecno by 1
\sectionheading{#1}{subsubsec}{Yappendix}%
{\appendixletter.\the\secno.\the\subsecno.\the\subsubsecno}%
}
-% normally unnumberedsubsubseczzz:
-\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}}
+\outer\parseargdef\unnumberedsubsubsec{\unnmhead3{#1}} %normally unnumberedsubsubseczzz
\def\unnumberedsubsubseczzz#1{%
\global\advance\subsubsecno by 1
\sectionheading{#1}{subsubsec}{Ynothing}%
@@ -5594,6 +5053,15 @@ 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
@@ -5601,8 +5069,10 @@ end
\def\chapheading{\chapbreak \parsearg\chapheadingzzz}
\def\chapheadingzzz#1{%
- \vbox{\chapfonts \raggedtitlesettings #1\par}%
- \nobreak\bigskip \nobreak
+ {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt\raggedright
+ \rm #1\hfill}}%
+ \bigskip \par\penalty 200\relax
\suppressfirstparagraphindent
}
@@ -5618,13 +5088,14 @@ 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
@@ -5634,8 +5105,9 @@ end
\chappager
\ifodd\pageno \else
\begingroup
- \headingsoff
- \null
+ \evenheadline={\hfil}\evenfootline={\hfil}%
+ \oddheadline={\hfil}\oddfootline={\hfil}%
+ \hbox to 0pt{}%
\chappager
\endgroup
\fi
@@ -5691,10 +5163,7 @@ end
\xdef\lastchapterdefs{%
\gdef\noexpand\thischaptername{\the\toks0}%
\gdef\noexpand\thischapternum{\appendixletter}%
- % \noexpand\putwordAppendix avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thischapter{\noexpand\putwordAppendix{}
- \noexpand\thischapternum:
+ \gdef\noexpand\thischapter{\putwordAppendix{} \noexpand\thischapternum:
\noexpand\thischaptername}%
}%
\else
@@ -5702,10 +5171,7 @@ end
\xdef\lastchapterdefs{%
\gdef\noexpand\thischaptername{\the\toks0}%
\gdef\noexpand\thischapternum{\the\chapno}%
- % \noexpand\putwordChapter avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thischapter{\noexpand\putwordChapter{}
- \noexpand\thischapternum:
+ \gdef\noexpand\thischapter{\putwordChapter{} \noexpand\thischapternum:
\noexpand\thischaptername}%
}%
\fi\fi\fi
@@ -5724,7 +5190,7 @@ end
\domark
%
{%
- \chapfonts \rmisbold
+ \chapfonts \rm
%
% Have to define \lastsection before calling \donoderef, because the
% xref code eventually uses it. On the other hand, it has to be called
@@ -5761,7 +5227,8 @@ end
%
% Typeset the actual heading.
\nobreak % Avoid page breaks at the interline glue.
- \vbox{\raggedtitlesettings \hangindent=\wd0 \centerparametersmaybe
+ \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
+ \hangindent=\wd0 \centerparametersmaybe
\unhbox0 #1\par}%
}%
\nobreak\bigskip % no page break after a chapter title
@@ -5783,18 +5250,18 @@ end
\def\setchapterstyle #1 {\csname CHAPF#1\endcsname}
%
\def\unnchfopen #1{%
- \chapoddpage
- \vbox{\chapfonts \raggedtitlesettings #1\par}%
- \nobreak\bigskip\nobreak
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt\raggedright
+ \rm #1\hfill}}\bigskip \par\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
- \vbox{\chapfonts \raggedtitlesettings \hfill #1\hfill}%
- \nobreak\bigskip \nobreak
+\chapoddpage {\chapfonts \vbox{\hyphenpenalty=10000\tolerance=5000
+ \parindent=0pt
+ \hfill {\rm #1}\hfill}}\bigskip \par\nobreak
}
\def\CHAPFopen{%
\global\let\chapmacro=\chfopen
@@ -5826,10 +5293,8 @@ end
%
\def\sectionheading#1#2#3#4{%
{%
- \checkenv{}% should not be in an environment.
- %
% Switch to the right set of fonts.
- \csname #2fonts\endcsname \rmisbold
+ \csname #2fonts\endcsname \rm
%
\def\sectionlevel{#2}%
\def\temptype{#3}%
@@ -5849,10 +5314,7 @@ end
\xdef\lastsectiondefs{%
\gdef\noexpand\thissectionname{\the\toks0}%
\gdef\noexpand\thissectionnum{#4}%
- % \noexpand\putwordSection avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thissection{\noexpand\putwordSection{}
- \noexpand\thissectionnum:
+ \gdef\noexpand\thissection{\putwordSection{} \noexpand\thissectionnum:
\noexpand\thissectionname}%
}%
\fi
@@ -5862,20 +5324,12 @@ end
\xdef\lastsectiondefs{%
\gdef\noexpand\thissectionname{\the\toks0}%
\gdef\noexpand\thissectionnum{#4}%
- % \noexpand\putwordSection avoids expanding indigestible
- % commands in some of the translations.
- \gdef\noexpand\thissection{\noexpand\putwordSection{}
- \noexpand\thissectionnum:
+ \gdef\noexpand\thissection{\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
@@ -5925,7 +5379,7 @@ end
\nobreak
%
% Output the actual section heading.
- \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \ptexraggedright
+ \vbox{\hyphenpenalty=10000 \tolerance=5000 \parindent=0pt \raggedright
\hangindent=\wd0 % zero if no section number
\unhbox0 #1}%
}%
@@ -5939,15 +5393,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.) 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.
+ % discardable item.)
\vskip-\parskip
- %
- % 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.
+ %
+ % 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
\penalty 10001
}
@@ -6003,7 +5457,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
@@ -6053,7 +5507,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.
@@ -6079,7 +5533,6 @@ end
\def\summarycontents{%
\startcontents{\putwordShortTOC}%
%
- \let\partentry = \shortpartentry
\let\numchapentry = \shortchapentry
\let\appentry = \shortchapentry
\let\unnchapentry = \shortunnchapentry
@@ -6135,19 +5588,6 @@ 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}}
%
@@ -6237,12 +5677,46 @@ end
\message{environments,}
% @foo ... @end foo.
-% @tex ... @end tex escapes into raw TeX temporarily.
+% @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.
% One exception: @ is still an escape character, so that @end tex works.
-% But \@ or @@ will get a plain @ character.
+% But \@ or @@ will get a plain tex @ 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
@@ -6252,14 +5726,8 @@ 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
@@ -6363,12 +5831,6 @@ 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
@@ -6382,7 +5844,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
@@ -6399,7 +5861,6 @@ 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
@@ -6407,12 +5868,7 @@ 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
@@ -6423,24 +5879,6 @@ 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:
@@ -6468,42 +5906,41 @@ end
}
% We often define two environments, @foo and @smallfoo.
-% 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}%
+% 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}
\expandafter\let\csname E#1\endcsname \afterenvbreak
\expandafter\let\csname Esmall#1\endcsname \afterenvbreak
}
-% Define two environment synonyms (#1 and #2) for an environment.
-\def\maketwodispenvdef#1#2#3{%
- \makedispenvdef{#1}{#3}%
- \makedispenvdef{#2}{#3}%
+% Define two synonyms:
+\def\maketwodispenvs #1#2#3{
+ \makedispenv{#1}{#3}
+ \makedispenv{#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.
%
-\maketwodispenvdef{lisp}{example}{%
+\maketwodispenvs {lisp}{example}{%
\nonfillstart
- \tt\setupmarkupstyle{example}%
+ \tt\quoteexpand
\let\kbdfont = \kbdexamplefont % Allow @kbd to do something special.
- \gobble % eat return
+ \gobble % eat return
}
% @display/@smalldisplay: same as @lisp except keep current font.
%
-\makedispenvdef{display}{%
+\makedispenv {display}{%
\nonfillstart
\gobble
}
% @format/@smallformat: same as @display except don't narrow margins.
%
-\makedispenvdef{format}{%
+\makedispenv{format}{%
\let\nonarrowing = t%
\nonfillstart
\gobble
@@ -6522,47 +5959,28 @@ end
\envdef\flushright{%
\let\nonarrowing = t%
\nonfillstart
- \advance\leftskip by 0pt plus 1fill\relax
+ \advance\leftskip by 0pt plus 1fill
\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.
%
-\makedispenvdef{quotation}{\quotationstart}
-%
-\def\quotationstart{%
- \indentedblockstart % same as \indentedblock, but increase right margin too.
+\envdef\quotation{%
+ {\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
\advance\rightskip by \lispnarrowing
+ \exdentamount = \lispnarrowing
+ \else
+ \let\nonarrowing = \relax
\fi
\parsearg\quotationlabel
}
@@ -6572,13 +5990,12 @@ end
%
\def\Equotation{%
\par
- \ifx\quotationauthor\thisisundefined\else
+ \ifx\quotationauthor\undefined\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{%
@@ -6588,32 +6005,6 @@ 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,
@@ -6629,16 +6020,18 @@ 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
@@ -6650,7 +6043,7 @@ end
\def\setupverb{%
\tt % easiest (and conventionally used) font for verbatim
\def\par{\leavevmode\endgraf}%
- \setupmarkupstyle{verb}%
+ \catcode`\`=\active
\tabeightspaces
% Respect line breaks,
% print special symbols as themselves, and
@@ -6661,46 +6054,73 @@ end
% Setup for the @verbatim environment
%
-% Real tab expansion.
+% Real tab expansion
\newdimen\tabw \setbox0=\hbox{\tt\space} \tabw=8\wd0 % tab amount
%
-% 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}
+\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
+}
%
\begingroup
\catcode`\^^I=\active
\gdef\tabexpand{%
\catcode`\^^I=\active
\def^^I{\leavevmode\egroup
- \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
+ \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
}%
}
+ \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
- \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}%
+ % Easiest (and conventionally used) font for verbatim
+ \tt
+ \def\par{\leavevmode\egroup\box0\endgraf}%
+ \catcode`\`=\active
\tabexpand
- \setupmarkupstyle{verbatim}%
+ \quoteexpand
% 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}%
}
@@ -6756,8 +6176,6 @@ end
{%
\makevalueexpandable
\setupverbatim
- \indexnofonts % Allow `@@' and other weird things in file names.
- \wlog{texinfo.tex: doing @verbatiminclude of #1^^J}%
\input #1
\afterenvbreak
}%
@@ -6807,7 +6225,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 further refinement, we avoid "club" headers by signalling
+ % As a minor 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.
@@ -6844,7 +6262,7 @@ end
#1#2 \endheader
% common ending:
\interlinepenalty = 10000
- \advance\rightskip by 0pt plus 1fil\relax
+ \advance\rightskip by 0pt plus 1fil
\endgraf
\nobreak\vskip -\parskip
\penalty\defunpenalty % signal to \startdefun and \dodefunx
@@ -6874,36 +6292,13 @@ 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%
}
-\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:
+%%% Untyped functions:
% @deffn category name args
\makedefun{deffn}{\deffngeneral{}}
@@ -6922,7 +6317,7 @@ end
\defname{#2}{}{#3}\magicamp\defunargs{#4\unskip}%
}
-% Typed functions:
+%%% Typed functions:
% @deftypefn category type name args
\makedefun{deftypefn}{\deftypefngeneral{}}
@@ -6937,11 +6332,10 @@ 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{}}
@@ -6959,7 +6353,7 @@ end
\defname{#2}{#3}{#4}\defunargs{#5\unskip}%
}
-% Untyped variables:
+%%% Untyped variables:
% @defvr category var args
\makedefun{defvr}#1 {\deftypevrheader{#1} {} }
@@ -6970,8 +6364,7 @@ end
% \defcvof {category of}class var args
\def\defcvof#1#2 {\deftypecvof{#1}#2 {} }
-% Types:
-
+%%% Type:
% @deftp category name args
\makedefun{deftp}#1 #2 #3\endheader{%
\doind{tp}{\code{#2}}%
@@ -6999,49 +6392,25 @@ 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
%
- % 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
+ % How we'll format the type 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. We'll always have at
- % least two.
- \tempnum = 2
- %
+ % Figure out line sizes for the paragraph shape.
% 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
%
- % The final paragraph shape:
- \parshape \tempnum 0in \dimen0 \maybeshapeline \defargsindent \dimen2
- %
- % Put the category name at the right margin.
+ % Put the type name to the right margin.
\noindent
\hbox to 0pt{%
\hfil\box0 \kern-\hsize
@@ -7063,16 +6432,8 @@ end
% . this still does not fix the ?` and !` ligatures, but so far no
% one has made identifiers using them :).
\df \tt
- \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
+ \def\temp{#2}% return value type
+ \ifx\temp\empty\else \tclose{\temp} \fi
#3% output function name
}%
{\rm\enskip}% hskip 0.5 em of \tenrm
@@ -7092,11 +6453,8 @@ 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. 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}}}%
+ % want a way to get ttsl. Let's try @var for that.
+ \let\var=\ttslanted
#1%
\sl\hyphenchar\font=45
}
@@ -7193,7 +6551,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\thisisundefined
+\ifx\eTeXversion\undefined
\newwrite\macscribble
\def\scantokens#1{%
\toks0={#1}%
@@ -7204,30 +6562,25 @@ 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 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\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\scanexp#1{%
\edef\temp{\noexpand\scanmacro{#1}}%
@@ -7255,7 +6608,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
@@ -7281,18 +6634,17 @@ 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 \
-% to recognize macro arguments; this is the job of \mbodybackslash.
-%
+% (as in normal texinfo). It is necessary to change the definition of \.
+
% 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{% used as subroutine
+
+\def\scanctxt{%
\catcode`\"=\other
\catcode`\+=\other
\catcode`\<=\other
@@ -7305,13 +6657,13 @@ end
\ifx\declaredencoding\ascii \else \setnonasciicharscatcodenonglobal\other \fi
}
-\def\scanargctxt{% used for copying and captions, not macros.
+\def\scanargctxt{%
\scanctxt
\catcode`\\=\other
\catcode`\^^M=\other
}
-\def\macrobodyctxt{% used for @macro definitions
+\def\macrobodyctxt{%
\scanctxt
\catcode`\{=\other
\catcode`\}=\other
@@ -7319,56 +6671,32 @@ end
\usembodybackslash
}
-\def\macroargctxt{% used when scanning invocations
+\def\macroargctxt{%
\scanctxt
- \catcode`\\=0
+ \catcode`\\=\other
}
-% 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\relax
+ \paramno=0%
\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}%
@@ -7415,269 +6743,46 @@ 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 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.
-%
+% 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.
% 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.
-%
-% 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\parsemargdef#1;{\paramno=0\def\paramlist{}%
+ \let\hash\relax\let\xeatspaces\relax\parsemargdefxxx#1,;,}
\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 a Texinfo @macro. There are eight cases: recursive and
-% nonrecursive macros of zero, one, up to nine, and many arguments.
+% This defines the macro itself. There are six cases: recursive and
+% nonrecursive macros of zero, one, 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
@@ -7692,25 +6797,17 @@ end
\expandafter\noexpand\csname\the\macname xxx\endcsname}%
\expandafter\xdef\csname\the\macname xxx\endcsname##1{%
\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
+ \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}}%
\fi
\else
\ifcase\paramno
@@ -7727,40 +6824,29 @@ end
\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
+ \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}%
\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
@@ -7770,8 +6856,7 @@ end
% @alias.
% We need some trickery to remove the optional spaces around the equal
-% sign. Make them active and then expand them all to nothing.
-%
+% sign. Just 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{%
@@ -7792,8 +6877,7 @@ 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
@@ -7854,32 +6938,11 @@ 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, at \shipout
+ \safewhatsit{\writexrdef{pg}{\folio}}% will be written later, during \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
-}
-
-%
% @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
@@ -7888,41 +6951,26 @@ 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
- %
- % Get args without leading/trailing spaces.
- \def\printedrefname{\ignorespaces #3}%
- \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
+ \def\printedrefname{\ignorespaces #3}%
+ \setbox1=\hbox{\printedmanual\unskip}%
+ \setbox0=\hbox{\printedrefname\unskip}%
+ \ifdim \wd0 = 0pt
% No printed node name was explicitly given.
- \expandafter\ifx\csname SETxref-automatic-section-title\endcsname \relax
- % Not auto section-title: use node name inside the square brackets.
+ \expandafter\ifx\csname SETxref-automatic-section-title\endcsname\relax
+ % Use the node name inside the square brackets.
\def\printedrefname{\ignorespaces #1}%
\else
- % 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.
+ % 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.
\def\printedrefname{\ignorespaces #1}%
\else
\ifhavexrefs
- % We (should) know the real title if we have the xref values.
+ % We know the real title if we have the xref values.
\def\printedrefname{\refx{#1-title}{}}%
\else
% Otherwise just copy the Info node name.
@@ -7936,20 +6984,13 @@ end
\ifpdf
{\indexnofonts
\turnoffactive
- \makevalueexpandable
% This expands tokens, so do it after making catcode changes, so _
- % etc. don't get their TeX definitions. This ignores all spaces in
- % #4, including (wrongly) those in the middle of the filename.
+ % etc. don't get their TeX definitions.
\getfilename{#4}%
%
- % 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
+ % See comments at \activebackslashdouble.
+ {\activebackslashdouble \xdef\pdfxrefdest{#1}%
+ \backslashparens\pdfxrefdest}%
%
\leavevmode
\startlink attr{/Border [0 0 0]}%
@@ -7976,42 +7017,29 @@ 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\wd\printedrefnamebox = 0pt
+ \ifdim\wd0 = 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 \wd\printedmanualbox > 0pt
+ \ifdim \wd1 > 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
@@ -8023,7 +7051,7 @@ end
\setbox2 = \hbox{\ignorespaces \refx{#1-snt}{}}%
\ifdim \wd2 > 0pt \refx{#1-snt}\space\fi
}%
- % output the `[mynode]' via the macro below so it can be overridden.
+ % output the `[mynode]' via a macro so it can be overridden.
\xrefprintnodename\printedrefname
%
% But we always want a comma and a space:
@@ -8031,37 +7059,11 @@ 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
@@ -8112,8 +7114,7 @@ end
\angleleft un\-de\-fined\angleright
\iflinks
\ifhavexrefs
- {\toks0 = {#1}% avoid expansion of possibly-complex value
- \message{\linenumber Undefined cross reference `\the\toks0'.}}%
+ \message{\linenumber Undefined cross reference `#1'.}%
\else
\ifwarnedxrefs\else
\global\warnedxrefstrue
@@ -8277,7 +7278,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
@@ -8340,8 +7341,6 @@ 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
@@ -8429,7 +7428,7 @@ end
it from ftp://tug.org/tex/epsf.tex.}
%
\def\image#1{%
- \ifx\epsfbox\thisisundefined
+ \ifx\epsfbox\undefined
\ifwarnednoepsf \else
\errhelp = \noepsfhelp
\errmessage{epsf.tex not found, images will be ignored}%
@@ -8445,7 +7444,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 stuff.
+% #6 is just the usual extra ignored arg for parsing this stuff.
\newif\ifimagevmode
\def\imagexxx#1,#2,#3,#4,#5,#6\finish{\begingroup
\catcode`\^^M = 5 % in case we're inside an example
@@ -8453,13 +7452,6 @@ 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
@@ -8469,13 +7461,9 @@ end
\fi
%
% Leave vertical mode so that indentation from an enclosing
- % 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
+ % 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
%
% Output the image.
\ifpdf
@@ -8487,10 +7475,7 @@ end
\epsfbox{#1.eps}%
\fi
%
- \ifimagevmode
- \medskip % space after a standalone image
- \fi
- \ifx\centersub\centerV \egroup \fi
+ \ifimagevmode \medskip \fi % space after the standalone image
\endgroup}
@@ -8762,9 +7747,10 @@ end
\message{localization,}
-% For single-language documents, @documentlanguage is usually given very
-% early, just after @documentencoding. Single argument is the language
-% (de) or locale (de_DE) abbreviation.
+% @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.
%
{
\catcode`\_ = \active
@@ -8777,60 +7763,31 @@ 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 % end raw TeX
+ \endgroup
\endgroup}
+}
%
% If they passed de_DE, and txi-de_DE.tex doesn't exist,
% try txi-de.tex.
-%
-\gdef\documentlanguagetrywithoutunderscore#1_#2\finish{%
+%
+\def\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? Putting it in the current
-directory should work if nowhere else does.}
+is empty. Maybe you need to install 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{%
@@ -8871,7 +7828,7 @@ directory should work if nowhere else does.}
\setnonasciicharscatcode\active
\lattwochardefs
%
- \else \ifx \declaredencoding \latone
+ \else \ifx \declaredencoding \latone
\setnonasciicharscatcode\active
\latonechardefs
%
@@ -8883,7 +7840,7 @@ directory should work if nowhere else does.}
\setnonasciicharscatcode\active
\utfeightchardefs
%
- \else
+ \else
\message{Unknown document encoding #1, ignoring.}%
%
\fi % utfeight
@@ -8895,7 +7852,7 @@ directory 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.
@@ -8908,21 +7865,21 @@ directory should work if nowhere else does.}
%
% Latin1 (ISO-8859-1) character definitions.
\def\latonechardefs{%
- \gdef^^a0{\tie}
+ \gdef^^a0{~}
\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{\guillemetleft}
+ \gdef^^ab{\missingcharmsg{LEFT-POINTING DOUBLE ANGLE QUOTATION MARK}}
\gdef^^ac{$\lnot$}
- \gdef^^ad{\-}
- \gdef^^ae{\registeredsymbol}
+ \gdef^^ad{\-}
+ \gdef^^ae{\registeredsymbol}
\gdef^^af{\={}}
%
\gdef^^b0{\textdegree}
@@ -8938,7 +7895,7 @@ directory should work if nowhere else does.}
\gdef^^b9{$^1$}
\gdef^^ba{\ordm}
%
- \gdef^^bb{\guillemetright}
+ \gdef^^bb{\missingcharmsg{RIGHT-POINTING DOUBLE ANGLE QUOTATION MARK}}
\gdef^^bc{$1\over4$}
\gdef^^bd{$1\over2$}
\gdef^^be{$3\over4$}
@@ -8949,7 +7906,7 @@ directory 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}
@@ -8961,7 +7918,7 @@ directory should work if nowhere else does.}
\gdef^^ce{\^I}
\gdef^^cf{\"I}
%
- \gdef^^d0{\DH}
+ \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER ETH}}
\gdef^^d1{\~N}
\gdef^^d2{\`O}
\gdef^^d3{\'O}
@@ -8975,7 +7932,7 @@ directory should work if nowhere else does.}
\gdef^^db{\^U}
\gdef^^dc{\"U}
\gdef^^dd{\'Y}
- \gdef^^de{\TH}
+ \gdef^^de{\missingcharmsg{LATIN CAPITAL LETTER THORN}}
\gdef^^df{\ss}
%
\gdef^^e0{\`a}
@@ -8995,7 +7952,7 @@ directory should work if nowhere else does.}
\gdef^^ee{\^{\dotless i}}
\gdef^^ef{\"{\dotless i}}
%
- \gdef^^f0{\dh}
+ \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER ETH}}
\gdef^^f1{\~n}
\gdef^^f2{\`o}
\gdef^^f3{\'o}
@@ -9009,7 +7966,7 @@ directory should work if nowhere else does.}
\gdef^^fb{\^u}
\gdef^^fc{\"u}
\gdef^^fd{\'y}
- \gdef^^fe{\th}
+ \gdef^^fe{\missingcharmsg{LATIN SMALL LETTER THORN}}
\gdef^^ff{\"y}
}
@@ -9030,8 +7987,8 @@ directory should work if nowhere else does.}
% Latin2 (ISO-8859-2) character definitions.
\def\lattwochardefs{%
- \gdef^^a0{\tie}
- \gdef^^a1{\ogonek{A}}
+ \gdef^^a0{~}
+ \gdef^^a1{\missingcharmsg{LATIN CAPITAL LETTER A WITH OGONEK}}
\gdef^^a2{\u{}}
\gdef^^a3{\L}
\gdef^^a4{\missingcharmsg{CURRENCY SIGN}}
@@ -9048,8 +8005,8 @@ directory should work if nowhere else does.}
\gdef^^af{\dotaccent Z}
%
\gdef^^b0{\textdegree}
- \gdef^^b1{\ogonek{a}}
- \gdef^^b2{\ogonek{ }}
+ \gdef^^b1{\missingcharmsg{LATIN SMALL LETTER A WITH OGONEK}}
+ \gdef^^b2{\missingcharmsg{OGONEK}}
\gdef^^b3{\l}
\gdef^^b4{\'{}}
\gdef^^b5{\v l}
@@ -9074,14 +8031,14 @@ directory should work if nowhere else does.}
\gdef^^c7{\cedilla C}
\gdef^^c8{\v C}
\gdef^^c9{\'E}
- \gdef^^ca{\ogonek{E}}
+ \gdef^^ca{\missingcharmsg{LATIN CAPITAL LETTER E WITH OGONEK}}
\gdef^^cb{\"E}
\gdef^^cc{\v E}
\gdef^^cd{\'I}
\gdef^^ce{\^I}
\gdef^^cf{\v D}
%
- \gdef^^d0{\DH}
+ \gdef^^d0{\missingcharmsg{LATIN CAPITAL LETTER D WITH STROKE}}
\gdef^^d1{\'N}
\gdef^^d2{\v N}
\gdef^^d3{\'O}
@@ -9090,7 +8047,7 @@ directory 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}
@@ -9108,14 +8065,14 @@ directory should work if nowhere else does.}
\gdef^^e7{\cedilla c}
\gdef^^e8{\v c}
\gdef^^e9{\'e}
- \gdef^^ea{\ogonek{e}}
+ \gdef^^ea{\missingcharmsg{LATIN SMALL LETTER E WITH OGONEK}}
\gdef^^eb{\"e}
\gdef^^ec{\v e}
- \gdef^^ed{\'{\dotless{i}}}
- \gdef^^ee{\^{\dotless{i}}}
+ \gdef^^ed{\'\i}
+ \gdef^^ee{\^\i}
\gdef^^ef{\v d}
%
- \gdef^^f0{\dh}
+ \gdef^^f0{\missingcharmsg{LATIN SMALL LETTER D WITH STROKE}}
\gdef^^f1{\'n}
\gdef^^f2{\v n}
\gdef^^f3{\'o}
@@ -9134,11 +8091,11 @@ directory 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
@@ -9203,7 +8160,7 @@ directory 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{%
@@ -9288,7 +8245,6 @@ directory should work if nowhere else does.}
\DeclareUnicodeCharacter{00CE}{\^I}
\DeclareUnicodeCharacter{00CF}{\"I}
- \DeclareUnicodeCharacter{00D0}{\DH}
\DeclareUnicodeCharacter{00D1}{\~N}
\DeclareUnicodeCharacter{00D2}{\`O}
\DeclareUnicodeCharacter{00D3}{\'O}
@@ -9301,7 +8257,6 @@ directory should work if nowhere else does.}
\DeclareUnicodeCharacter{00DB}{\^U}
\DeclareUnicodeCharacter{00DC}{\"U}
\DeclareUnicodeCharacter{00DD}{\'Y}
- \DeclareUnicodeCharacter{00DE}{\TH}
\DeclareUnicodeCharacter{00DF}{\ss}
\DeclareUnicodeCharacter{00E0}{\`a}
@@ -9321,7 +8276,6 @@ directory 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}
@@ -9334,21 +8288,16 @@ directory 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}}
@@ -9496,8 +8445,6 @@ directory 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}}
@@ -9671,8 +8618,8 @@ directory should work if nowhere else does.}
% Prevent underfull vbox error messages.
\vbadness = 10000
-% Don't be very finicky about underfull hboxes, either.
-\hbadness = 6666
+% Don't be so finicky about underfull hboxes, either.
+\hbadness = 2000
% Following George Bush, get rid of widows and orphans.
\widowpenalty=10000
@@ -9879,21 +8826,25 @@ directory 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 \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{~}
+\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
% 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,
@@ -9971,48 +8922,32 @@ directory should work if nowhere else does.}
% In texinfo, backslash is an active character; it prints the backslash
% in fixed width font.
-\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.
-
+\catcode`\\=\active
+@def@normalbackslash{{@tt@backslashcurfont}}
% 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. We switch back and forth between these.
+% catcode other.
@gdef@rawbackslash{@let\=@backslashcurfont}
@gdef@otherbackslash{@let\=@realbackslash}
% Same as @turnoffactive except outputs \ as {\tt\char`\\} instead of
-% 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
- }
+% 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
}
% Make _ and + \other characters, temporarily.
@@ -10041,28 +8976,11 @@ directory should work if nowhere else does.}
% Say @foo, not \foo, in error messages.
@escapechar = `@@
-% 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
+@catcode`@& = @other
+@catcode`@# = @other
+@catcode`@% = @other
+
@c Local variables:
@c eval: (add-hook 'write-file-hooks 'time-stamp)
diff --git a/gmp/doc/version.texi b/gmp/doc/version.texi
index 08f09e7e86..227ebb6db5 100644
--- a/gmp/doc/version.texi
+++ b/gmp/doc/version.texi
@@ -1,4 +1,4 @@
-@set UPDATED 25 March 2014
-@set UPDATED-MONTH March 2014
-@set EDITION 6.0.0
-@set VERSION 6.0.0
+@set UPDATED 7 January 2010
+@set UPDATED-MONTH January 2010
+@set EDITION 4.3.2
+@set VERSION 4.3.2
diff --git a/gmp/dumbmp.c b/gmp/dumbmp.c
new file mode 100644
index 0000000000..cd8c67d369
--- /dev/null
+++ b/gmp/dumbmp.c
@@ -0,0 +1,887 @@
+/* dumbmp mini GMP compatible library.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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/. */
+
+
+/* The code here implements a subset (a very limited subset) of the main GMP
+ functions. It's designed for use in a few build-time calculations and
+ will be slow, but highly portable.
+
+ None of the normal GMP configure things are used, nor any of the normal
+ gmp.h or gmp-impl.h. To use this file in a program just #include
+ "dumbmp.c".
+
+ ANSI function definitions can be used here, since ansi2knr is run if
+ necessary. But other ANSI-isms like "const" should be avoided.
+
+ mp_limb_t here is an unsigned long, since that's a sensible type
+ everywhere we know of, with 8*sizeof(unsigned long) giving the number of
+ bits in the type (that not being true for instance with int or short on
+ Cray vector systems.)
+
+ Only the low half of each mp_limb_t is used, so as to make carry handling
+ and limb multiplies easy. GMP_LIMB_BITS is the number of bits used. */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <string.h>
+
+
+typedef unsigned long mp_limb_t;
+
+typedef struct {
+ int _mp_alloc;
+ int _mp_size;
+ mp_limb_t *_mp_d;
+} mpz_t[1];
+
+#define GMP_LIMB_BITS (sizeof (mp_limb_t) * 8 / 2)
+
+#define ABS(x) ((x) >= 0 ? (x) : -(x))
+#define MIN(l,o) ((l) < (o) ? (l) : (o))
+#define MAX(h,i) ((h) > (i) ? (h) : (i))
+
+#define ALLOC(x) ((x)->_mp_alloc)
+#define PTR(x) ((x)->_mp_d)
+#define SIZ(x) ((x)->_mp_size)
+#define ABSIZ(x) ABS (SIZ (x))
+#define LOMASK ((1L << GMP_LIMB_BITS) - 1)
+#define LO(x) ((x) & LOMASK)
+#define HI(x) ((x) >> GMP_LIMB_BITS)
+
+#define ASSERT(cond) \
+ do { \
+ if (! (cond)) \
+ { \
+ fprintf (stderr, "Assertion failure\n"); \
+ abort (); \
+ } \
+ } while (0)
+
+
+char *
+xmalloc (int n)
+{
+ char *p;
+ p = malloc (n);
+ if (p == NULL)
+ {
+ fprintf (stderr, "Out of memory (alloc %d bytes)\n", n);
+ abort ();
+ }
+ return p;
+}
+
+mp_limb_t *
+xmalloc_limbs (int n)
+{
+ return (mp_limb_t *) xmalloc (n * sizeof (mp_limb_t));
+}
+
+void
+mem_copyi (char *dst, char *src, int size)
+{
+ int i;
+ for (i = 0; i < size; i++)
+ dst[i] = src[i];
+}
+
+int
+isprime (int n)
+{
+ int i;
+ if (n < 2)
+ return 0;
+ for (i = 2; i < n; i++)
+ if ((n % i) == 0)
+ return 0;
+ return 1;
+}
+
+int
+log2_ceil (int n)
+{
+ int e;
+ ASSERT (n >= 1);
+ for (e = 0; ; e++)
+ if ((1 << e) >= n)
+ break;
+ return e;
+}
+
+void
+mpz_realloc (mpz_t r, int n)
+{
+ if (n <= ALLOC(r))
+ return;
+
+ ALLOC(r) = n;
+ PTR(r) = (mp_limb_t *) realloc (PTR(r), n * sizeof (mp_limb_t));
+ if (PTR(r) == NULL)
+ {
+ fprintf (stderr, "Out of memory (realloc to %d)\n", n);
+ abort ();
+ }
+}
+
+void
+mpn_normalize (mp_limb_t *rp, int *rnp)
+{
+ int rn = *rnp;
+ while (rn > 0 && rp[rn-1] == 0)
+ rn--;
+ *rnp = rn;
+}
+
+void
+mpn_copyi (mp_limb_t *dst, mp_limb_t *src, int n)
+{
+ int i;
+ for (i = 0; i < n; i++)
+ dst[i] = src[i];
+}
+
+void
+mpn_zero (mp_limb_t *rp, int rn)
+{
+ int i;
+ for (i = 0; i < rn; i++)
+ rp[i] = 0;
+}
+
+void
+mpz_init (mpz_t r)
+{
+ ALLOC(r) = 1;
+ PTR(r) = xmalloc_limbs (ALLOC(r));
+ PTR(r)[0] = 0;
+ SIZ(r) = 0;
+}
+
+void
+mpz_clear (mpz_t r)
+{
+ free (PTR (r));
+ ALLOC(r) = -1;
+ SIZ (r) = 0xbadcafeL;
+ PTR (r) = (mp_limb_t *) 0xdeadbeefL;
+}
+
+int
+mpz_sgn (mpz_t a)
+{
+ return (SIZ(a) > 0 ? 1 : SIZ(a) == 0 ? 0 : -1);
+}
+
+int
+mpz_odd_p (mpz_t a)
+{
+ if (SIZ(a) == 0)
+ return 0;
+ else
+ return (PTR(a)[0] & 1) != 0;
+}
+
+int
+mpz_even_p (mpz_t a)
+{
+ if (SIZ(a) == 0)
+ return 1;
+ else
+ return (PTR(a)[0] & 1) == 0;
+}
+
+size_t
+mpz_sizeinbase (mpz_t a, int base)
+{
+ int an = ABSIZ (a);
+ mp_limb_t *ap = PTR (a);
+ int cnt;
+ mp_limb_t hi;
+
+ if (base != 2)
+ abort ();
+
+ if (an == 0)
+ return 1;
+
+ cnt = 0;
+ for (hi = ap[an - 1]; hi != 0; hi >>= 1)
+ cnt += 1;
+ return (an - 1) * GMP_LIMB_BITS + cnt;
+}
+
+void
+mpz_set (mpz_t r, mpz_t a)
+{
+ mpz_realloc (r, ABSIZ (a));
+ SIZ(r) = SIZ(a);
+ mpn_copyi (PTR(r), PTR(a), ABSIZ (a));
+}
+
+void
+mpz_init_set (mpz_t r, mpz_t a)
+{
+ mpz_init (r);
+ mpz_set (r, a);
+}
+
+void
+mpz_set_ui (mpz_t r, unsigned long ui)
+{
+ int rn;
+ mpz_realloc (r, 2);
+ PTR(r)[0] = LO(ui);
+ PTR(r)[1] = HI(ui);
+ rn = 2;
+ mpn_normalize (PTR(r), &rn);
+ SIZ(r) = rn;
+}
+
+void
+mpz_init_set_ui (mpz_t r, unsigned long ui)
+{
+ mpz_init (r);
+ mpz_set_ui (r, ui);
+}
+
+void
+mpz_setbit (mpz_t r, unsigned long bit)
+{
+ int limb, rn, extend;
+ mp_limb_t *rp;
+
+ rn = SIZ(r);
+ if (rn < 0)
+ abort (); /* only r>=0 */
+
+ limb = bit / GMP_LIMB_BITS;
+ bit %= GMP_LIMB_BITS;
+
+ mpz_realloc (r, limb+1);
+ rp = PTR(r);
+ extend = (limb+1) - rn;
+ if (extend > 0)
+ mpn_zero (rp + rn, extend);
+
+ rp[limb] |= (mp_limb_t) 1 << bit;
+ SIZ(r) = MAX (rn, limb+1);
+}
+
+int
+mpz_tstbit (mpz_t r, unsigned long bit)
+{
+ int limb;
+
+ if (SIZ(r) < 0)
+ abort (); /* only r>=0 */
+
+ limb = bit / GMP_LIMB_BITS;
+ if (SIZ(r) <= limb)
+ return 0;
+
+ bit %= GMP_LIMB_BITS;
+ return (PTR(r)[limb] >> bit) & 1;
+}
+
+int
+popc_limb (mp_limb_t a)
+{
+ int ret = 0;
+ while (a != 0)
+ {
+ ret += (a & 1);
+ a >>= 1;
+ }
+ return ret;
+}
+
+unsigned long
+mpz_popcount (mpz_t a)
+{
+ unsigned long ret;
+ int i;
+
+ if (SIZ(a) < 0)
+ abort ();
+
+ ret = 0;
+ for (i = 0; i < SIZ(a); i++)
+ ret += popc_limb (PTR(a)[i]);
+ return ret;
+}
+
+void
+mpz_add (mpz_t r, mpz_t a, mpz_t b)
+{
+ int an = ABSIZ (a), bn = ABSIZ (b), rn;
+ mp_limb_t *rp, *ap, *bp;
+ int i;
+ mp_limb_t t, cy;
+
+ if ((SIZ (a) ^ SIZ (b)) < 0)
+ abort (); /* really subtraction */
+ if (SIZ (a) < 0)
+ abort ();
+
+ mpz_realloc (r, MAX (an, bn) + 1);
+ ap = PTR (a); bp = PTR (b); rp = PTR (r);
+ if (an < bn)
+ {
+ mp_limb_t *tp; int tn;
+ tn = an; an = bn; bn = tn;
+ tp = ap; ap = bp; bp = tp;
+ }
+
+ cy = 0;
+ for (i = 0; i < bn; i++)
+ {
+ t = ap[i] + bp[i] + cy;
+ rp[i] = LO (t);
+ cy = HI (t);
+ }
+ for (i = bn; i < an; i++)
+ {
+ t = ap[i] + cy;
+ rp[i] = LO (t);
+ cy = HI (t);
+ }
+ rp[an] = cy;
+ rn = an + 1;
+
+ mpn_normalize (rp, &rn);
+ SIZ (r) = rn;
+}
+
+void
+mpz_add_ui (mpz_t r, mpz_t a, unsigned long int ui)
+{
+ mpz_t b;
+
+ mpz_init (b);
+ mpz_set_ui (b, ui);
+ mpz_add (r, a, b);
+ mpz_clear (b);
+}
+
+void
+mpz_sub (mpz_t r, mpz_t a, mpz_t b)
+{
+ int an = ABSIZ (a), bn = ABSIZ (b), rn;
+ mp_limb_t *rp, *ap, *bp;
+ int i;
+ mp_limb_t t, cy;
+
+ if ((SIZ (a) ^ SIZ (b)) < 0)
+ abort (); /* really addition */
+ if (SIZ (a) < 0)
+ abort ();
+
+ mpz_realloc (r, MAX (an, bn) + 1);
+ ap = PTR (a); bp = PTR (b); rp = PTR (r);
+ if (an < bn)
+ {
+ mp_limb_t *tp; int tn;
+ tn = an; an = bn; bn = tn;
+ tp = ap; ap = bp; bp = tp;
+ }
+
+ cy = 0;
+ for (i = 0; i < bn; i++)
+ {
+ t = ap[i] - bp[i] - cy;
+ rp[i] = LO (t);
+ cy = LO (-HI (t));
+ }
+ for (i = bn; i < an; i++)
+ {
+ t = ap[i] - cy;
+ rp[i] = LO (t);
+ cy = LO (-HI (t));
+ }
+ rp[an] = cy;
+ rn = an + 1;
+
+ if (cy != 0)
+ {
+ cy = 0;
+ for (i = 0; i < rn; i++)
+ {
+ t = -rp[i] - cy;
+ rp[i] = LO (t);
+ cy = LO (-HI (t));
+ }
+ SIZ (r) = -rn;
+ return;
+ }
+
+ mpn_normalize (rp, &rn);
+ SIZ (r) = rn;
+}
+
+void
+mpz_sub_ui (mpz_t r, mpz_t a, unsigned long int ui)
+{
+ mpz_t b;
+
+ mpz_init (b);
+ mpz_set_ui (b, ui);
+ mpz_sub (r, a, b);
+ mpz_clear (b);
+}
+
+void
+mpz_mul (mpz_t r, mpz_t a, mpz_t b)
+{
+ int an = ABSIZ (a), bn = ABSIZ (b), rn;
+ mp_limb_t *scratch, *tmp, *ap = PTR (a), *bp = PTR (b);
+ int ai, bi;
+ mp_limb_t t, cy;
+
+ scratch = xmalloc_limbs (an + bn);
+ tmp = scratch;
+
+ for (bi = 0; bi < bn; bi++)
+ tmp[bi] = 0;
+
+ for (ai = 0; ai < an; ai++)
+ {
+ tmp = scratch + ai;
+ cy = 0;
+ for (bi = 0; bi < bn; bi++)
+ {
+ t = ap[ai] * bp[bi] + tmp[bi] + cy;
+ tmp[bi] = LO (t);
+ cy = HI (t);
+ }
+ tmp[bn] = cy;
+ }
+
+ rn = an + bn;
+ mpn_normalize (scratch, &rn);
+ free (PTR (r));
+ PTR (r) = scratch;
+ SIZ (r) = (SIZ (a) ^ SIZ (b)) >= 0 ? rn : -rn;
+ ALLOC (r) = an + bn;
+}
+
+void
+mpz_mul_ui (mpz_t r, mpz_t a, unsigned long int ui)
+{
+ mpz_t b;
+
+ mpz_init (b);
+ mpz_set_ui (b, ui);
+ mpz_mul (r, a, b);
+ mpz_clear (b);
+}
+
+void
+mpz_mul_2exp (mpz_t r, mpz_t a, unsigned long int bcnt)
+{
+ mpz_set (r, a);
+ while (bcnt)
+ {
+ mpz_add (r, r, r);
+ bcnt -= 1;
+ }
+}
+
+void
+mpz_ui_pow_ui (mpz_t r, unsigned long b, unsigned long e)
+{
+ unsigned long i;
+ mpz_t bz;
+
+ mpz_init (bz);
+ mpz_set_ui (bz, b);
+
+ mpz_set_ui (r, 1L);
+ for (i = 0; i < e; i++)
+ mpz_mul (r, r, bz);
+
+ mpz_clear (bz);
+}
+
+void
+mpz_tdiv_q_2exp (mpz_t r, mpz_t a, unsigned long int bcnt)
+{
+ int as, rn;
+ int cnt, tnc;
+ int lcnt;
+ mp_limb_t high_limb, low_limb;
+ int i;
+
+ as = SIZ (a);
+ lcnt = bcnt / GMP_LIMB_BITS;
+ rn = ABS (as) - lcnt;
+ if (rn <= 0)
+ SIZ (r) = 0;
+ else
+ {
+ mp_limb_t *rp, *ap;
+
+ mpz_realloc (r, rn);
+
+ rp = PTR (r);
+ ap = PTR (a);
+
+ cnt = bcnt % GMP_LIMB_BITS;
+ if (cnt != 0)
+ {
+ ap += lcnt;
+ tnc = GMP_LIMB_BITS - cnt;
+ high_limb = *ap++;
+ low_limb = high_limb >> cnt;
+
+ for (i = rn - 1; i != 0; i--)
+ {
+ high_limb = *ap++;
+ *rp++ = low_limb | LO (high_limb << tnc);
+ low_limb = high_limb >> cnt;
+ }
+ *rp = low_limb;
+ rn -= low_limb == 0;
+ }
+ else
+ {
+ ap += lcnt;
+ mpn_copyi (rp, ap, rn);
+ }
+
+ SIZ (r) = as >= 0 ? rn : -rn;
+ }
+}
+
+void
+mpz_tdiv_r_2exp (mpz_t r, mpz_t a, unsigned long int bcnt)
+{
+ int rn, bwhole;
+
+ mpz_set (r, a);
+ rn = ABSIZ(r);
+
+ bwhole = bcnt / GMP_LIMB_BITS;
+ bcnt %= GMP_LIMB_BITS;
+ if (rn > bwhole)
+ {
+ rn = bwhole+1;
+ PTR(r)[rn-1] &= ((mp_limb_t) 1 << bcnt) - 1;
+ mpn_normalize (PTR(r), &rn);
+ SIZ(r) = (SIZ(r) >= 0 ? rn : -rn);
+ }
+}
+
+int
+mpz_cmp (mpz_t a, mpz_t b)
+{
+ mp_limb_t *ap, *bp, al, bl;
+ int as = SIZ (a), bs = SIZ (b);
+ int i;
+ int sign;
+
+ if (as != bs)
+ return as > bs ? 1 : -1;
+
+ sign = as > 0 ? 1 : -1;
+
+ ap = PTR (a);
+ bp = PTR (b);
+ for (i = ABS (as) - 1; i >= 0; i--)
+ {
+ al = ap[i];
+ bl = bp[i];
+ if (al != bl)
+ return al > bl ? sign : -sign;
+ }
+ return 0;
+}
+
+int
+mpz_cmp_ui (mpz_t a, unsigned long b)
+{
+ mpz_t bz;
+ int ret;
+ mpz_init_set_ui (bz, b);
+ ret = mpz_cmp (a, bz);
+ mpz_clear (bz);
+ return ret;
+}
+
+void
+mpz_tdiv_qr (mpz_t q, mpz_t r, mpz_t a, mpz_t b)
+{
+ mpz_t tmpr, tmpb;
+ unsigned long cnt;
+
+ ASSERT (mpz_sgn(a) >= 0);
+ ASSERT (mpz_sgn(b) > 0);
+
+ mpz_init_set (tmpr, a);
+ mpz_init_set (tmpb, b);
+ mpz_set_ui (q, 0L);
+
+ if (mpz_cmp (tmpr, tmpb) > 0)
+ {
+ cnt = mpz_sizeinbase (tmpr, 2) - mpz_sizeinbase (tmpb, 2) + 1;
+ mpz_mul_2exp (tmpb, tmpb, cnt);
+
+ for ( ; cnt > 0; cnt--)
+ {
+ mpz_mul_2exp (q, q, 1);
+ mpz_tdiv_q_2exp (tmpb, tmpb, 1L);
+ if (mpz_cmp (tmpr, tmpb) >= 0)
+ {
+ mpz_sub (tmpr, tmpr, tmpb);
+ mpz_add_ui (q, q, 1L);
+ ASSERT (mpz_cmp (tmpr, tmpb) < 0);
+ }
+ }
+ }
+
+ mpz_set (r, tmpr);
+ mpz_clear (tmpr);
+ mpz_clear (tmpb);
+}
+
+void
+mpz_tdiv_qr_ui (mpz_t q, mpz_t r, mpz_t a, unsigned long b)
+{
+ mpz_t bz;
+ mpz_init_set_ui (bz, b);
+ mpz_tdiv_qr (q, r, a, bz);
+ mpz_clear (bz);
+}
+
+void
+mpz_tdiv_q (mpz_t q, mpz_t a, mpz_t b)
+{
+ mpz_t r;
+
+ mpz_init (r);
+ mpz_tdiv_qr (q, r, a, b);
+ mpz_clear (r);
+}
+
+void
+mpz_tdiv_q_ui (mpz_t q, mpz_t n, unsigned long d)
+{
+ mpz_t dz;
+ mpz_init_set_ui (dz, d);
+ mpz_tdiv_q (q, n, dz);
+ mpz_clear (dz);
+}
+
+/* Set inv to the inverse of d, in the style of invert_limb, ie. for
+ udiv_qrnnd_preinv. */
+void
+mpz_preinv_invert (mpz_t inv, mpz_t d, int numb_bits)
+{
+ mpz_t t;
+ int norm;
+ ASSERT (SIZ(d) > 0);
+
+ norm = numb_bits - mpz_sizeinbase (d, 2);
+ ASSERT (norm >= 0);
+ mpz_init_set_ui (t, 1L);
+ mpz_mul_2exp (t, t, 2*numb_bits - norm);
+ mpz_tdiv_q (inv, t, d);
+ mpz_set_ui (t, 1L);
+ mpz_mul_2exp (t, t, numb_bits);
+ mpz_sub (inv, inv, t);
+
+ mpz_clear (t);
+}
+
+/* Remove leading '0' characters from the start of a string, by copying the
+ remainder down. */
+void
+strstrip_leading_zeros (char *s)
+{
+ char c, *p;
+
+ p = s;
+ while (*s == '0')
+ s++;
+
+ do
+ {
+ c = *s++;
+ *p++ = c;
+ }
+ while (c != '\0');
+}
+
+char *
+mpz_get_str (char *buf, int base, mpz_t a)
+{
+ static char tohex[] = "0123456789abcdef";
+
+ mp_limb_t alimb, *ap;
+ int an, bn, i, j;
+ char *bp;
+
+ if (base != 16)
+ abort ();
+ if (SIZ (a) < 0)
+ abort ();
+
+ if (buf == 0)
+ buf = xmalloc (ABSIZ (a) * (GMP_LIMB_BITS / 4) + 3);
+
+ an = ABSIZ (a);
+ if (an == 0)
+ {
+ buf[0] = '0';
+ buf[1] = '\0';
+ return buf;
+ }
+
+ ap = PTR (a);
+ bn = an * (GMP_LIMB_BITS / 4);
+ bp = buf + bn;
+
+ for (i = 0; i < an; i++)
+ {
+ alimb = ap[i];
+ for (j = 0; j < GMP_LIMB_BITS / 4; j++)
+ {
+ bp--;
+ *bp = tohex [alimb & 0xF];
+ alimb >>= 4;
+ }
+ ASSERT (alimb == 0);
+ }
+ ASSERT (bp == buf);
+
+ buf[bn] = '\0';
+
+ strstrip_leading_zeros (buf);
+ return buf;
+}
+
+void
+mpz_out_str (FILE *file, int base, mpz_t a)
+{
+ char *str;
+
+ if (file == 0)
+ file = stdout;
+
+ str = mpz_get_str (0, 16, a);
+ fputs (str, file);
+ free (str);
+}
+
+/* Calculate r satisfying r*d == 1 mod 2^n. */
+void
+mpz_invert_2exp (mpz_t r, mpz_t a, unsigned long n)
+{
+ unsigned long i;
+ mpz_t inv, prod;
+
+ ASSERT (mpz_odd_p (a));
+
+ mpz_init_set_ui (inv, 1L);
+ mpz_init (prod);
+
+ for (i = 1; i < n; i++)
+ {
+ mpz_mul (prod, inv, a);
+ if (mpz_tstbit (prod, i) != 0)
+ mpz_setbit (inv, i);
+ }
+
+ mpz_mul (prod, inv, a);
+ mpz_tdiv_r_2exp (prod, prod, n);
+ ASSERT (mpz_cmp_ui (prod, 1L) == 0);
+
+ mpz_set (r, inv);
+
+ mpz_clear (inv);
+ mpz_clear (prod);
+}
+
+/* Calculate inv satisfying r*a == 1 mod 2^n. */
+void
+mpz_invert_ui_2exp (mpz_t r, unsigned long a, unsigned long n)
+{
+ mpz_t az;
+ mpz_init_set_ui (az, a);
+ mpz_invert_2exp (r, az, n);
+ mpz_clear (az);
+}
+
+/* x=y^z */
+void
+mpz_pow_ui (mpz_t x, mpz_t y, unsigned long z)
+{
+ mpz_t t;
+
+ mpz_init_set_ui (t, 1);
+ for (; z != 0; z--)
+ mpz_mul (t, t, y);
+ mpz_set (x, t);
+ mpz_clear (t);
+}
+
+/* x=x+y*z */
+void
+mpz_addmul_ui (mpz_t x, mpz_t y, unsigned long z)
+{
+ mpz_t t;
+
+ mpz_init (t);
+ mpz_mul_ui (t, y, z);
+ mpz_add (x, x, t);
+ mpz_clear (t);
+}
+
+/* x=floor(y^(1/z)) */
+void
+mpz_root (mpz_t x, mpz_t y, unsigned long z)
+{
+ mpz_t t, u;
+
+ if (mpz_sgn (y) < 0)
+ {
+ fprintf (stderr, "mpz_root does not accept negative values\n");
+ abort ();
+ }
+ if (mpz_cmp_ui (y, 1) <= 0)
+ {
+ mpz_set (x, y);
+ return;
+ }
+ mpz_init (t);
+ mpz_init_set (u, y);
+ do
+ {
+ mpz_pow_ui (t, u, z - 1);
+ mpz_tdiv_q (t, y, t);
+ mpz_addmul_ui (t, u, z - 1);
+ mpz_tdiv_q_ui (t, t, z);
+ if (mpz_cmp (t, u) >= 0)
+ break;
+ mpz_set (u, t);
+ }
+ while (1);
+ mpz_set (x, u);
+ mpz_clear (t);
+ mpz_clear (u);
+}
diff --git a/gmp/errno.c b/gmp/errno.c
index d3c02ef4b8..e5e160dbe2 100644
--- a/gmp/errno.c
+++ b/gmp/errno.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdlib.h>
#include "gmp.h"
diff --git a/gmp/extract-dbl.c b/gmp/extract-dbl.c
index a6e7bf9468..9c2ae9b7c0 100644
--- a/gmp/extract-dbl.c
+++ b/gmp/extract-dbl.c
@@ -1,32 +1,21 @@
/* __gmp_extract_double -- convert from double to array of mp_limb_t.
-Copyright 1996, 1999-2002, 2006, 2012 Free Software Foundation, Inc.
+Copyright 1996, 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -39,6 +28,8 @@ see https://www.gnu.org/licenses/. */
#define _GMP_IEEE_FLOATS 0
#endif
+#define BITS_IN_MANTISSA 53
+
/* Extract a non-negative double in d. */
int
diff --git a/gmp/gen-bases.c b/gmp/gen-bases.c
index 4d4b0db8ac..31895e8b24 100644
--- a/gmp/gen-bases.c
+++ b/gmp/gen-bases.c
@@ -1,38 +1,30 @@
/* Generate mp_bases data.
-Copyright 1991, 1993, 1994, 1996, 2000, 2002, 2004, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2002, 2004 Free Software Foundation,
+Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "bootstrap.c"
+#include <math.h>
+
+#include "dumbmp.c"
int chars_per_limb;
+double chars_per_bit_exactly;
mpz_t big_base;
int normalization_steps;
mpz_t big_base_inverted;
@@ -67,6 +59,8 @@ generate (int limb_bits, int nail_bits, int base)
chars_per_limb++;
}
+ chars_per_bit_exactly = 0.69314718055994530942 / log ((double) base);
+
mpz_ui_pow_ui (big_base, (long) base, (long) chars_per_limb);
normalization_steps = limb_bits - mpz_sizeinbase (big_base, 2);
@@ -103,61 +97,11 @@ header (int limb_bits, int nail_bits)
printf ("#define MP_BASES_NORMALIZATION_STEPS_10 %d\n", normalization_steps);
}
-
-#define EXTRA 16
-
-/* Compute log(2)/log(b) as a fixnum. */
-void
-mp_2logb (mpz_t r, int bi, int prec)
-{
- mpz_t t, t2, two, b;
- int i;
-
- mpz_init_set_ui (t, 1);
- mpz_mul_2exp (t, t, prec+EXTRA);
-
- mpz_init (t2);
-
- mpz_init_set_ui (two, 2);
- mpz_mul_2exp (two, two, prec+EXTRA);
-
- mpz_set_ui (r, 0);
-
- mpz_init_set_ui (b, bi);
- mpz_mul_2exp (b, b, prec+EXTRA);
-
- for (i = prec-1; i >= 0; i--)
- {
- mpz_mul_2exp (b, b, prec+EXTRA);
- mpz_sqrt (b, b);
-
- mpz_mul (t2, t, b);
- mpz_tdiv_q_2exp (t2, t2, prec+EXTRA);
-
- if (mpz_cmp (t2, two) < 0) /* not too large? */
- {
- mpz_setbit (r, i); /* set next less significant bit */
- mpz_set (t, t2); /* new value acceptable */
- }
- }
-
- mpz_clear (t);
- mpz_clear (t2);
- mpz_clear (two);
- mpz_clear (b);
-}
-
void
table (int limb_bits, int nail_bits)
{
int numb_bits = limb_bits - nail_bits;
int base;
- mpz_t r, t, logb2, log2b;
-
- mpz_init (r);
- mpz_init (t);
- mpz_init (logb2);
- mpz_init (log2b);
printf ("/* This file generated by gen-bases.c - DO NOT EDIT. */\n");
printf ("\n");
@@ -169,45 +113,30 @@ table (int limb_bits, int nail_bits)
printf ("#endif\n");
printf ("\n");
puts ("const struct bases mp_bases[257] =\n{");
- puts (" /* 0 */ { 0, 0, 0, 0, 0 },");
- puts (" /* 1 */ { 0, 0, 0, 0, 0 },");
+ puts (" /* 0 */ { 0, 0.0, 0 },");
+ puts (" /* 1 */ { 0, 1e37, 0 },");
for (base = 2; base <= 256; base++)
{
generate (limb_bits, nail_bits, base);
- mp_2logb (r, base, limb_bits + 8);
- mpz_tdiv_q_2exp (logb2, r, 8);
- mpz_set_ui (t, 1);
- mpz_mul_2exp (t, t, 2*limb_bits + 5);
- mpz_sub_ui (t, t, 1);
- mpz_add_ui (r, r, 1);
- mpz_tdiv_q (log2b, t, r);
printf (" /* %3u */ { ", base);
if (POW2_P (base))
{
- mpz_set_ui (big_base, ulog2 (base) - 1);
- mpz_set_ui (big_base_inverted, 0);
+ printf ("%u, %.16f, 0x%x },\n",
+ chars_per_limb, chars_per_bit_exactly, ulog2 (base) - 1);
+ }
+ else
+ {
+ printf ("%u, %.16f, CNST_LIMB(0x",
+ chars_per_limb, chars_per_bit_exactly);
+ mpz_out_str (stdout, 16, big_base);
+ printf ("), CNST_LIMB(0x");
+ mpz_out_str (stdout, 16, big_base_inverted);
+ printf (") },\n");
}
-
- printf ("%u,", chars_per_limb);
- printf (" CNST_LIMB(0x");
- mpz_out_str (stdout, 16, logb2);
- printf ("), CNST_LIMB(0x");
- mpz_out_str (stdout, 16, log2b);
- printf ("), CNST_LIMB(0x");
- mpz_out_str (stdout, 16, big_base);
- printf ("), CNST_LIMB(0x");
- mpz_out_str (stdout, 16, big_base_inverted);
- printf (") },\n");
}
puts ("};");
-
- mpz_clear (r);
- mpz_clear (t);
- mpz_clear (logb2);
- mpz_clear (log2b);
-
}
int
diff --git a/gmp/gen-fac.c b/gmp/gen-fac.c
deleted file mode 100644
index b1756a6117..0000000000
--- a/gmp/gen-fac.c
+++ /dev/null
@@ -1,285 +0,0 @@
-/* Generate data for combinatorics: fac_ui, bin_uiui, ...
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
-
-#include <stdio.h>
-#include <stdlib.h>
-
-#include "bootstrap.c"
-
-int
-mpz_remove_twos (mpz_t x)
-{
- mp_bitcnt_t r = mpz_scan1(x, 0);
- mpz_tdiv_q_2exp (x, x, r);
- return r;
-}
-
-/* returns 0 on success */
-int
-gen_consts (int numb, int nail, int limb)
-{
- mpz_t x, mask, y, last;
- unsigned long a, b;
- unsigned long ofl, ofe;
-
- printf ("/* This file is automatically generated by gen-fac.c */\n\n");
- printf ("#if GMP_NUMB_BITS != %d\n", numb);
- printf ("Error , error this data is for %d GMP_NUMB_BITS only\n", numb);
- printf ("#endif\n");
-#if 0
- printf ("#if GMP_LIMB_BITS != %d\n", limb);
- printf ("Error , error this data is for %d GMP_LIMB_BITS only\n", limb);
- printf ("#endif\n");
-#endif
-
- printf
- ("/* This table is 0!,1!,2!,3!,...,n! where n! has <= GMP_NUMB_BITS bits */\n");
- printf
- ("#define ONE_LIMB_FACTORIAL_TABLE CNST_LIMB(0x1),CNST_LIMB(0x1");
- mpz_init_set_ui (x, 1);
- mpz_init (last);
- for (b = 2;; b++)
- {
- mpz_mul_ui (x, x, b); /* so b!=a */
- if (mpz_sizeinbase (x, 2) > numb)
- break;
- printf ("),CNST_LIMB(0x");
- mpz_out_str (stdout, 16, x);
- }
- printf (")\n");
-
- printf
- ("\n/* This table is 0!,1!,2!/2,3!/2,...,n!/2^sn where n!/2^sn is an */\n");
- printf
- ("/* odd integer for each n, and n!/2^sn has <= GMP_NUMB_BITS bits */\n");
- printf
- ("#define ONE_LIMB_ODD_FACTORIAL_TABLE CNST_LIMB(0x1),CNST_LIMB(0x1),CNST_LIMB(0x1");
- mpz_set_ui (x, 1);
- for (b = 3;; b++)
- {
- for (a = b; (a & 1) == 0; a >>= 1);
- mpz_swap (last, x);
- mpz_mul_ui (x, last, a);
- if (mpz_sizeinbase (x, 2) > numb)
- break;
- printf ("),CNST_LIMB(0x");
- mpz_out_str (stdout, 16, x);
- }
- printf (")\n");
- printf
- ("#define ODD_FACTORIAL_TABLE_MAX CNST_LIMB(0x");
- mpz_out_str (stdout, 16, last);
- printf (")\n");
-
- ofl = b - 1;
- printf
- ("#define ODD_FACTORIAL_TABLE_LIMIT (%lu)\n", ofl);
- mpz_init2 (mask, numb);
- mpz_setbit (mask, numb);
- mpz_sub_ui (mask, mask, 1);
- printf
- ("\n/* Previous table, continued, values modulo 2^GMP_NUMB_BITS */\n");
- printf
- ("#define ONE_LIMB_ODD_FACTORIAL_EXTTABLE CNST_LIMB(0x");
- mpz_and (x, x, mask);
- mpz_out_str (stdout, 16, x);
- mpz_init (y);
- mpz_bin_uiui (y, b, b/2);
- b++;
- for (;; b++)
- {
- for (a = b; (a & 1) == 0; a >>= 1);
- if (a == b) {
- mpz_divexact_ui (y, y, a/2+1);
- mpz_mul_ui (y, y, a);
- } else
- mpz_mul_2exp (y, y, 1);
- if (mpz_sizeinbase (y, 2) > numb)
- break;
- mpz_mul_ui (x, x, a);
- mpz_and (x, x, mask);
- printf ("),CNST_LIMB(0x");
- mpz_out_str (stdout, 16, x);
- }
- printf (")\n");
- ofe = b - 1;
- printf
- ("#define ODD_FACTORIAL_EXTTABLE_LIMIT (%lu)\n", ofe);
-
- printf
- ("\n/* This table is 1!!,3!!,...,(2n+1)!! where (2n+1)!! has <= GMP_NUMB_BITS bits */\n");
- printf
- ("#define ONE_LIMB_ODD_DOUBLEFACTORIAL_TABLE CNST_LIMB(0x1");
- mpz_set_ui (x, 1);
- for (b = 3;; b+=2)
- {
- mpz_swap (last, x);
- mpz_mul_ui (x, last, b);
- if (mpz_sizeinbase (x, 2) > numb)
- break;
- printf ("),CNST_LIMB(0x");
- mpz_out_str (stdout, 16, x);
- }
- printf (")\n");
- printf
- ("#define ODD_DOUBLEFACTORIAL_TABLE_MAX CNST_LIMB(0x");
- mpz_out_str (stdout, 16, last);
- printf (")\n");
-
- printf
- ("#define ODD_DOUBLEFACTORIAL_TABLE_LIMIT (%lu)\n", b - 2);
-
- printf
- ("\n/* This table x_1, x_2,... contains values s.t. x_n^n has <= GMP_NUMB_BITS bits */\n");
- printf
- ("#define NTH_ROOT_NUMB_MASK_TABLE (GMP_NUMB_MASK");
- for (b = 2;b <= 8; b++)
- {
- mpz_root (x, mask, b);
- printf ("),CNST_LIMB(0x");
- mpz_out_str (stdout, 16, x);
- }
- printf (")\n");
-
- mpz_add_ui (mask, mask, 1);
- printf
- ("\n/* This table contains inverses of odd factorials, modulo 2^GMP_NUMB_BITS */\n");
- printf
- ("\n/* It begins with (2!/2)^-1=1 */\n");
- printf
- ("#define ONE_LIMB_ODD_FACTORIAL_INVERSES_TABLE CNST_LIMB(0x1");
- mpz_set_ui (x, 1);
- for (b = 3;b <= ofe - 2; b++)
- {
- for (a = b; (a & 1) == 0; a >>= 1);
- mpz_mul_ui (x, x, a);
- mpz_invert (y, x, mask);
- printf ("),CNST_LIMB(0x");
- mpz_out_str (stdout, 16, y);
- }
- printf (")\n");
-
- ofe = (ofe / 16 + 1) * 16;
-
- printf
- ("\n/* This table contains 2n-popc(2n) for small n */\n");
- printf
- ("\n/* It begins with 2-1=1 (n=1) */\n");
- printf
- ("#define TABLE_2N_MINUS_POPC_2N 1");
- for (b = 4; b <= ofe; b += 2)
- {
- mpz_set_ui (x, b);
- printf (",%lu",b - mpz_popcount (x));
- }
- printf ("\n");
- printf
- ("#define TABLE_LIMIT_2N_MINUS_POPC_2N %lu\n", ofe + 1);
-
-
- ofl = (ofl + 1) / 2;
- printf
- ("#define ODD_CENTRAL_BINOMIAL_OFFSET (%lu)\n", ofl);
- printf
- ("\n/* This table contains binomial(2k,k)/2^t */\n");
- printf
- ("\n/* It begins with ODD_CENTRAL_BINOMIAL_TABLE_MIN */\n");
- printf
- ("#define ONE_LIMB_ODD_CENTRAL_BINOMIAL_TABLE ");
- for (b = ofl;; b++)
- {
- mpz_bin_uiui (x, 2 * b, b);
- mpz_remove_twos (x);
- if (mpz_sizeinbase (x, 2) > numb)
- break;
- if (b != ofl)
- printf ("),");
- printf("CNST_LIMB(0x");
- mpz_out_str (stdout, 16, x);
- }
- printf (")\n");
-
- ofe = b - 1;
- printf
- ("#define ODD_CENTRAL_BINOMIAL_TABLE_LIMIT (%lu)\n", ofe);
-
- printf
- ("\n/* This table contains the inverses of elements in the previous table. */\n");
- printf
- ("#define ONE_LIMB_ODD_CENTRAL_BINOMIAL_INVERSE_TABLE CNST_LIMB(0x");
- for (b = ofl; b <= ofe; b++)
- {
- mpz_bin_uiui (x, 2 * b, b);
- mpz_remove_twos (x);
- mpz_invert (x, x, mask);
- mpz_out_str (stdout, 16, x);
- if (b != ofe)
- printf ("),CNST_LIMB(0x");
- }
- printf (")\n");
-
- printf
- ("\n/* This table contains the values t in the formula binomial(2k,k)/2^t */\n");
- printf
- ("#define CENTRAL_BINOMIAL_2FAC_TABLE ");
- for (b = ofl; b <= ofe; b++)
- {
- mpz_bin_uiui (x, 2 * b, b);
- printf ("%d", mpz_remove_twos (x));
- if (b != ofe)
- printf (",");
- }
- printf ("\n");
-
- return 0;
-}
-
-int
-main (int argc, char *argv[])
-{
- int nail_bits, limb_bits, numb_bits;
-
- if (argc != 3)
- {
- fprintf (stderr, "Usage: gen-fac_ui limbbits nailbits\n");
- exit (1);
- }
- limb_bits = atoi (argv[1]);
- nail_bits = atoi (argv[2]);
- numb_bits = limb_bits - nail_bits;
- if (limb_bits < 2 || nail_bits < 0 || numb_bits < 1)
- {
- fprintf (stderr, "Invalid limb/nail bits %d,%d\n", limb_bits,
- nail_bits);
- exit (1);
- }
- gen_consts (numb_bits, nail_bits, limb_bits);
- return 0;
-}
diff --git a/gmp/gen-fac_ui.c b/gmp/gen-fac_ui.c
new file mode 100644
index 0000000000..a9521baf28
--- /dev/null
+++ b/gmp/gen-fac_ui.c
@@ -0,0 +1,159 @@
+/* Generate mpz_fac_ui data.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 <stdio.h>
+#include <stdlib.h>
+
+#include "dumbmp.c"
+
+
+/* sets x=y*(y+2)*(y+4)*....*(y+2*(z-1)) */
+void
+odd_products (mpz_t x, mpz_t y, int z)
+{
+ mpz_t t;
+
+ mpz_init_set (t, y);
+ mpz_set_ui (x, 1);
+ for (; z != 0; z--)
+ {
+ mpz_mul (x, x, t);
+ mpz_add_ui (t, t, 2);
+ }
+ mpz_clear (t);
+ return;
+}
+
+/* returns 0 on success */
+int
+gen_consts (int numb, int nail, int limb)
+{
+ mpz_t x, y, z, t;
+ unsigned long a, b, first = 1;
+
+ printf ("/* This file is automatically generated by gen-fac_ui.c */\n\n");
+ printf ("#if GMP_NUMB_BITS != %d\n", numb);
+ printf ("Error , error this data is for %d GMP_NUMB_BITS only\n", numb);
+ printf ("#endif\n");
+ printf ("#if GMP_LIMB_BITS != %d\n", limb);
+ printf ("Error , error this data is for %d GMP_LIMB_BITS only\n", limb);
+ printf ("#endif\n");
+
+ printf
+ ("/* This table is 0!,1!,2!,3!,...,n! where n! has <= GMP_NUMB_BITS bits */\n");
+ printf
+ ("#define ONE_LIMB_FACTORIAL_TABLE CNST_LIMB(0x1),CNST_LIMB(0x1),CNST_LIMB(0x2),");
+ mpz_init_set_ui (x, 2);
+ for (b = 3;; b++)
+ {
+ mpz_mul_ui (x, x, b); /* so b!=a */
+ if (mpz_sizeinbase (x, 2) > numb)
+ break;
+ if (first)
+ {
+ first = 0;
+ }
+ else
+ {
+ printf ("),");
+ }
+ printf ("CNST_LIMB(0x");
+ mpz_out_str (stdout, 16, x);
+ }
+ printf (")\n");
+
+
+ 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");
+ }
+
+ return 0;
+}
+
+int
+main (int argc, char *argv[])
+{
+ int nail_bits, limb_bits, numb_bits;
+
+ if (argc != 3)
+ {
+ fprintf (stderr, "Usage: gen-fac_ui limbbits nailbits\n");
+ exit (1);
+ }
+ limb_bits = atoi (argv[1]);
+ nail_bits = atoi (argv[2]);
+ numb_bits = limb_bits - nail_bits;
+ if (limb_bits < 0 || nail_bits < 0 || numb_bits < 0)
+ {
+ fprintf (stderr, "Invalid limb/nail bits %d,%d\n", limb_bits,
+ nail_bits);
+ exit (1);
+ }
+ gen_consts (numb_bits, nail_bits, limb_bits);
+ return 0;
+}
diff --git a/gmp/gen-fib.c b/gmp/gen-fib.c
index d5f2601915..fd7bb96a77 100644
--- a/gmp/gen-fib.c
+++ b/gmp/gen-fib.c
@@ -1,35 +1,24 @@
/* Generate Fibonacci table data.
-Copyright 2001, 2002, 2004, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
-#include "bootstrap.c"
+#include "dumbmp.c"
mpz_t *f;
int fnum, fib_limit, luc_limit;
@@ -45,7 +34,7 @@ generate (int numb_bits)
/* fib(2n) > 2^n, so use 2n as a limit for the table size */
falloc = 2 * numb_bits;
- f = xmalloc (falloc * sizeof (*f));
+ f = (mpz_t *) xmalloc (falloc * sizeof (*f));
mpz_init_set_ui (f[0], 1L); /* F[-1] */
mpz_init_set_ui (f[1], 0L); /* F[0] */
@@ -54,7 +43,7 @@ generate (int numb_bits)
for (i = 2; ; i++)
{
- assert (i < falloc);
+ ASSERT (i < falloc);
/* F[i] = F[i-1] + F[i-2] */
mpz_init (f[i]);
diff --git a/gmp/gen-jacobitab.c b/gmp/gen-jacobitab.c
deleted file mode 100644
index 537994b3b2..0000000000
--- a/gmp/gen-jacobitab.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* gen-jacobi.c
-
- 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/* Generate the lookup table needed for fast left-to-right computation
- of the Jacobi symbol. */
-
-#include <assert.h>
-#include <stdio.h>
-#include <stdlib.h>
-
-static const struct
-{
- unsigned char a;
- unsigned char b;
-} decode_table[13] = {
- /* 0 */ { 0, 1 },
- /* 1 */ { 0, 3 },
- /* 2 */ { 1, 1 },
- /* 3 */ { 1, 3 },
- /* 4 */ { 2, 1 },
- /* 5 */ { 2, 3 },
- /* 6 */ { 3, 1 },
- /* 7 */ { 3, 3 }, /* d = 1 */
- /* 8 */ { 1, 0 },
- /* 9 */ { 1, 2 },
- /* 10 */ { 3, 0 },
- /* 11 */ { 3, 2 },
- /* 12 */ { 3, 3 }, /* d = 0 */
-
-};
-#define JACOBI_A(bits) (decode_table[(bits)>>1].a)
-#define JACOBI_B(bits) (decode_table[(bits)>>1].b)
-
-#define JACOBI_E(bits) ((bits) & 1)
-#define JACOBI_D(bits) (((bits)>>1) == 7) /* Gives 0 for don't care states. */
-
-static unsigned
-encode (unsigned a, unsigned b, unsigned d)
-{
- unsigned i;
-
- assert (d < 2);
- assert (a < 4);
- assert (b < 4);
- assert ( (a | b ) & 1);
-
- if (a == 3 && b == 3)
- return d ? 7 : 12;
-
- for (i = 0; i < 12; i++)
- if (decode_table[i].a == a
- && decode_table[i].b == b)
- return i;
-
- abort ();
-}
-
-int
-main (int argc, char **argv)
-{
- unsigned bits;
-
- for (bits = 0; bits < 208; bits++)
- {
- unsigned e, a, b, d_old, d, q;
-
- if (bits && !(bits & 0xf))
- printf("\n");
-
- q = bits & 3;
- d = (bits >> 2) & 1;
-
- e = JACOBI_E (bits >> 3);
- a = JACOBI_A (bits >> 3);
- b = JACOBI_B (bits >> 3);
- d_old = JACOBI_D (bits >> 3);
-
- if (d != d_old && a == 3 && b == 3)
- e ^= 1;
-
- if (d == 1)
- {
- if (b == 2)
- e ^= (q & (a >> 1)) ^ (q >> 1);
- a = (a - q * b) & 3;
- }
- else
- {
- if (a == 2)
- e ^= (q & (b >> 1)) ^ (q >> 1);
- b = (b - q * a) & 3;
- }
-
- printf("%2d,", (encode (a, b, d) << 1) | e);
- }
- printf("\n");
-
- return 0;
-}
diff --git a/gmp/gen-psqr.c b/gmp/gen-psqr.c
index 31977cda1c..9c33d7a681 100644
--- a/gmp/gen-psqr.c
+++ b/gmp/gen-psqr.c
@@ -1,37 +1,26 @@
/* Generate perfect square testing data.
-Copyright 2002-2004, 2012 Free Software Foundation, Inc.
+Copyright 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <stdlib.h>
-#include "bootstrap.c"
+#include "dumbmp.c"
/* The aim of this program is to choose either mpn_mod_34lsub1 or mpn_mod_1
@@ -163,9 +152,9 @@ f_cmp_fraction (const void *parg, const void *qarg)
accordingly. */
#define COLLAPSE_ELEMENT(array, idx, narray) \
do { \
- memmove (&(array)[idx], \
- &(array)[idx+1], \
- ((narray)-((idx)+1)) * sizeof (array[0])); \
+ mem_copyi ((char *) &(array)[idx], \
+ (char *) &(array)[idx+1], \
+ ((narray)-((idx)+1)) * sizeof (array[0])); \
(narray)--; \
} while (0)
@@ -184,7 +173,7 @@ mul_2exp_mod (int n, int p, int m)
int
neg_mod (int n, int m)
{
- assert (n >= 0 && n < m);
+ ASSERT (n >= 0 && n < m);
return (n == 0 ? 0 : m-n);
}
@@ -213,7 +202,7 @@ generate_sq_res_0x100 (int limb_bits)
int i, res;
nsq_res_0x100 = (0x100 + limb_bits - 1) / limb_bits;
- sq_res_0x100 = xmalloc (nsq_res_0x100 * sizeof (*sq_res_0x100));
+ sq_res_0x100 = (mpz_t *) xmalloc (nsq_res_0x100 * sizeof (*sq_res_0x100));
for (i = 0; i < nsq_res_0x100; i++)
mpz_init_set_ui (sq_res_0x100[i], 0L);
@@ -244,8 +233,9 @@ generate_mod (int limb_bits, int nail_bits)
/* no more than limb_bits many factors in a one limb modulus (and of
course in reality nothing like that many) */
factor_alloc = limb_bits;
- factor = xmalloc (factor_alloc * sizeof (*factor));
- rawfactor = xmalloc (factor_alloc * sizeof (*rawfactor));
+ factor = (struct factor_t *) xmalloc (factor_alloc * sizeof (*factor));
+ rawfactor = (struct rawfactor_t *)
+ xmalloc (factor_alloc * sizeof (*rawfactor));
if (numb_bits % 4 != 0)
{
@@ -311,7 +301,7 @@ generate_mod (int limb_bits, int nail_bits)
}
while (mpz_sgn (r) == 0);
- assert (nrawfactor < factor_alloc);
+ ASSERT (nrawfactor < factor_alloc);
rawfactor[nrawfactor].divisor = i;
rawfactor[nrawfactor].multiplicity = multiplicity;
nrawfactor++;
@@ -351,7 +341,7 @@ generate_mod (int limb_bits, int nail_bits)
break;
mpz_set (pp, new_pp);
- assert (nrawfactor < factor_alloc);
+ ASSERT (nrawfactor < factor_alloc);
rawfactor[nrawfactor].divisor = i;
rawfactor[nrawfactor].multiplicity = 1;
nrawfactor++;
@@ -387,7 +377,7 @@ generate_mod (int limb_bits, int nail_bits)
for (i = 0; i < nrawfactor; i++)
{
int j;
- assert (nfactor < factor_alloc);
+ ASSERT (nfactor < factor_alloc);
factor[nfactor].divisor = 1;
for (j = 0; j < rawfactor[i].multiplicity; j++)
factor[nfactor].divisor *= rawfactor[i].divisor;
diff --git a/gmp/gen-trialdivtab.c b/gmp/gen-trialdivtab.c
deleted file mode 100644
index 7587666003..0000000000
--- a/gmp/gen-trialdivtab.c
+++ /dev/null
@@ -1,300 +0,0 @@
-/* gen-trialdivtab.c
-
- Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/*
- Generate tables for fast, division-free trial division for GMP.
-
- There is one main table, ptab. It contains primes, multiplied together, and
- several types of pre-computed inverses. It refers to tables of the type
- dtab, via the last two indices. That table contains the individual primes in
- the range, except that the primes are not actually included in the table (see
- the P macro; it sneakingly excludes the primes themselves). Instead, the
- dtab tables contains tuples for each prime (modular-inverse, limit) used for
- divisibility checks.
-
- This interface is not intended for division of very many primes, since then
- other algorithms apply.
-*/
-
-#include <stdlib.h>
-#include <stdio.h>
-#include "bootstrap.c"
-
-int sumspills (mpz_t, mpz_t *, int);
-void mpn_mod_1s_4p_cps (mpz_t [7], mpz_t);
-
-int limb_bits;
-
-mpz_t B;
-
-int
-main (int argc, char *argv[])
-{
- unsigned long t, p;
- mpz_t ppp, acc, inv, gmp_numb_max, tmp, Bhalf;
- mpz_t pre[7];
- int i;
- int start_p, end_p, interval_start, interval_end, omitted_p;
- char *endtok;
- int stop;
- int np, start_idx;
-
- if (argc < 2)
- {
- fprintf (stderr, "usage: %s bits endprime\n", argv[0]);
- exit (1);
- }
-
- limb_bits = atoi (argv[1]);
-
- end_p = 1290; /* default end prime */
- if (argc == 3)
- end_p = atoi (argv[2]);
-
- printf ("#if GMP_LIMB_BITS != %d\n", limb_bits);
- printf ("#error This table is for GMP_LIMB_BITS = %d\n", limb_bits);
- printf ("#endif\n\n");
-
- printf ("#if GMP_NAIL_BITS != 0\n");
- printf ("#error This table does not support nails\n");
- printf ("#endif\n\n");
-
- for (i = 0; i < 7; i++)
- mpz_init (pre[i]);
-
- mpz_init_set_ui (gmp_numb_max, 1);
- mpz_mul_2exp (gmp_numb_max, gmp_numb_max, limb_bits);
- mpz_sub_ui (gmp_numb_max, gmp_numb_max, 1);
-
- mpz_init (tmp);
- mpz_init (inv);
-
- mpz_init_set_ui (B, 1); mpz_mul_2exp (B, B, limb_bits);
- mpz_init_set_ui (Bhalf, 1); mpz_mul_2exp (Bhalf, Bhalf, limb_bits - 1);
-
- start_p = 3;
-
- mpz_init_set_ui (ppp, 1);
- mpz_init (acc);
- interval_start = start_p;
- omitted_p = 3;
- interval_end = 0;
-
-/* printf ("static struct gmp_primes_dtab gmp_primes_dtab[] = {\n"); */
-
- printf ("#ifdef WANT_dtab\n");
-
- for (t = start_p; t <= end_p; t += 2)
- {
- if (! isprime (t))
- continue;
-
- mpz_mul_ui (acc, ppp, t);
- stop = mpz_cmp (acc, Bhalf) >= 0;
- if (!stop)
- {
- mpn_mod_1s_4p_cps (pre, acc);
- stop = sumspills (acc, pre + 2, 5);
- }
-
- if (stop)
- {
- for (p = interval_start; p <= interval_end; p += 2)
- {
- if (! isprime (p))
- continue;
-
- printf (" P(%d,", (int) p);
- mpz_invert_ui_2exp (inv, p, limb_bits);
- printf ("CNST_LIMB(0x"); mpz_out_str (stdout, 16, inv); printf ("),");
-
- mpz_tdiv_q_ui (tmp, gmp_numb_max, p);
- printf ("CNST_LIMB(0x"); mpz_out_str (stdout, 16, tmp);
- printf (")),\n");
- }
- mpz_set_ui (ppp, t);
- interval_start = t;
- omitted_p = t;
- }
- else
- {
- mpz_set (ppp, acc);
- }
- interval_end = t;
- }
- 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"); */
-
- endtok = "";
-
- mpz_set_ui (ppp, 1);
- interval_start = start_p;
- interval_end = 0;
- np = 0;
- start_idx = 0;
- for (t = start_p; t <= end_p; t += 2)
- {
- if (! isprime (t))
- continue;
-
- mpz_mul_ui (acc, ppp, t);
-
- stop = mpz_cmp (acc, Bhalf) >= 0;
- if (!stop)
- {
- mpn_mod_1s_4p_cps (pre, acc);
- stop = sumspills (acc, pre + 2, 5);
- }
-
- if (stop)
- {
- mpn_mod_1s_4p_cps (pre, ppp);
- printf ("%s", endtok);
- printf (" {CNST_LIMB(0x"); mpz_out_str (stdout, 16, ppp);
- printf ("),{CNST_LIMB(0x"); mpz_out_str (stdout, 16, pre[0]);
- printf ("),%d", (int) PTR(pre[1])[0]);
- for (i = 0; i < 5; i++)
- {
- printf (",");
- printf ("CNST_LIMB(0x"); mpz_out_str (stdout, 16, pre[2 + i]);
- printf (")");
- }
- printf ("},");
- printf ("%d,", start_idx);
- printf ("%d}", np - start_idx);
-
- endtok = ",\n";
- mpz_set_ui (ppp, t);
- interval_start = t;
- start_idx = np;
- }
- else
- {
- mpz_set (ppp, acc);
- }
- interval_end = t;
- np++;
- }
-
- printf ("\n");
- printf ("#endif\n");
-
- return 0;
-}
-
-unsigned long
-mpz_log2 (mpz_t x)
-{
- return mpz_sgn (x) ? mpz_sizeinbase (x, 2) : 0;
-}
-
-void
-mpn_mod_1s_4p_cps (mpz_t cps[7], mpz_t bparm)
-{
- mpz_t b, bi;
- mpz_t B1modb, B2modb, B3modb, B4modb, B5modb;
- mpz_t t;
- int cnt;
-
- mpz_init_set (b, bparm);
-
- cnt = limb_bits - mpz_log2 (b);
-
- mpz_init (bi);
- mpz_init (t);
- mpz_init (B1modb);
- mpz_init (B2modb);
- mpz_init (B3modb);
- mpz_init (B4modb);
- mpz_init (B5modb);
-
- mpz_set_ui (t, 1);
- mpz_mul_2exp (t, t, limb_bits - cnt);
- mpz_sub (t, t, b);
- mpz_mul_2exp (t, t, limb_bits);
- mpz_tdiv_q (bi, t, b); /* bi = B^2/b, except msb */
-
- mpz_set_ui (t, 1);
- mpz_mul_2exp (t, t, limb_bits); /* t = B */
- mpz_tdiv_r (B1modb, t, b);
-
- mpz_mul_2exp (t, B1modb, limb_bits);
- mpz_tdiv_r (B2modb, t, b);
-
- mpz_mul_2exp (t, B2modb, limb_bits);
- mpz_tdiv_r (B3modb, t, b);
-
- mpz_mul_2exp (t, B3modb, limb_bits);
- mpz_tdiv_r (B4modb, t, b);
-
- mpz_mul_2exp (t, B4modb, limb_bits);
- mpz_tdiv_r (B5modb, t, b);
-
- mpz_set (cps[0], bi);
- mpz_set_ui (cps[1], cnt);
- mpz_tdiv_q_2exp (cps[2], B1modb, 0);
- mpz_tdiv_q_2exp (cps[3], B2modb, 0);
- mpz_tdiv_q_2exp (cps[4], B3modb, 0);
- mpz_tdiv_q_2exp (cps[5], B4modb, 0);
- mpz_tdiv_q_2exp (cps[6], B5modb, 0);
-
- mpz_clear (b);
- mpz_clear (bi);
- mpz_clear (t);
- mpz_clear (B1modb);
- mpz_clear (B2modb);
- mpz_clear (B3modb);
- mpz_clear (B4modb);
- mpz_clear (B5modb);
-}
-
-int
-sumspills (mpz_t ppp, mpz_t *a, int n)
-{
- mpz_t s;
- int i, ret;
-
- mpz_init_set (s, a[0]);
-
- for (i = 1; i < n; i++)
- {
- mpz_add (s, s, a[i]);
- }
- ret = mpz_cmp (s, B) >= 0;
- mpz_clear (s);
-
- return ret;
-}
diff --git a/gmp/gmp-h.in b/gmp/gmp-h.in
index 32f63d9a08..d7fbc347cb 100644
--- a/gmp/gmp-h.in
+++ b/gmp/gmp-h.in
@@ -1,32 +1,22 @@
/* Definitions for GNU multiple precision functions. -*- mode: c -*-
-Copyright 1991, 1993-1997, 1999-2014 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
+2004, 2005, 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#ifndef __GMP_H__
@@ -38,9 +28,10 @@ see https://www.gnu.org/licenses/. */
/* Instantiated by configure. */
#if ! defined (__GMP_WITHIN_CONFIGURE)
+#define __GMP_BITS_PER_MP_LIMB @BITS_PER_MP_LIMB@
#define __GMP_HAVE_HOST_CPU_FAMILY_power @HAVE_HOST_CPU_FAMILY_power@
#define __GMP_HAVE_HOST_CPU_FAMILY_powerpc @HAVE_HOST_CPU_FAMILY_powerpc@
-#define GMP_LIMB_BITS @GMP_LIMB_BITS@
+#define GMP_LIMB_BITS @BITS_PER_MP_LIMB@
#define GMP_NAIL_BITS @GMP_NAIL_BITS@
#endif
#define GMP_NUMB_BITS (GMP_LIMB_BITS - GMP_NAIL_BITS)
@@ -53,9 +44,15 @@ see https://www.gnu.org/licenses/. */
gmp.h and mp.h to allow both to be included in an application or during
the library build. */
#ifndef __GNU_MP__
-#define __GNU_MP__ 5
+#define __GNU_MP__ 4
+#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)
@@ -64,6 +61,57 @@ see https://www.gnu.org/licenses/. */
#endif
+/* __STDC__ - some ANSI compilers define this only to 0, hence the use of
+ "defined" and not "__STDC__-0". In particular Sun workshop C 5.0
+ sets __STDC__ to 0, but requires "##" for token pasting.
+
+ _AIX - gnu ansidecl.h asserts that all known AIX compilers are ANSI but
+ don't always define __STDC__.
+
+ __DECC - current versions of DEC C (5.9 for instance) for alpha are ANSI,
+ but don't define __STDC__ in their default mode. Don't know if old
+ versions might have been K&R, but let's not worry about that unless
+ someone is still using one.
+
+ _mips - gnu ansidecl.h says the RISC/OS MIPS compiler is ANSI in SVR4
+ mode, but doesn't define __STDC__.
+
+ _MSC_VER - Microsoft C is ANSI, but __STDC__ is undefined unless the /Za
+ option is given (in which case it's 1).
+
+ _WIN32 - tested for by gnu ansidecl.h, no doubt on the assumption that
+ all w32 compilers are ansi.
+
+ Note: This same set of tests is used by gen-psqr.c and
+ demos/expr/expr-impl.h, so if anything needs adding, then be sure to
+ update those too. */
+
+#if defined (__STDC__) \
+ || defined (__cplusplus) \
+ || defined (_AIX) \
+ || defined (__DECC) \
+ || (defined (__mips) && defined (_SYSTYPE_SVR4)) \
+ || defined (_MSC_VER) \
+ || defined (_WIN32)
+#define __GMP_HAVE_CONST 1
+#define __GMP_HAVE_PROTOTYPES 1
+#define __GMP_HAVE_TOKEN_PASTE 1
+#else
+#define __GMP_HAVE_CONST 0
+#define __GMP_HAVE_PROTOTYPES 0
+#define __GMP_HAVE_TOKEN_PASTE 0
+#endif
+
+
+#if __GMP_HAVE_CONST
+#define __gmp_const const
+#define __gmp_signed signed
+#else
+#define __gmp_const
+#define __gmp_signed
+#endif
+
+
/* __GMP_DECLSPEC supports Windows DLL versions of libgmp, and is empty in
all other circumstances.
@@ -76,6 +124,9 @@ see https://www.gnu.org/licenses/. */
indicates when building libgmpxx, and in that case libgmpxx functions are
exports, but libgmp functions which might get called are imports.
+ libmp.la uses __GMP_DECLSPEC, just as if it were libgmp.la. libgmp and
+ libmp don't call each other, so there's no conflict or confusion.
+
Libtool DLL_EXPORT define is not used.
There's no attempt to support GMP built both static and DLL. Doing so
@@ -119,7 +170,7 @@ see https://www.gnu.org/licenses/. */
#endif
#if __GMP_LIBGMP_DLL
-#ifdef __GMP_WITHIN_GMP
+#if __GMP_WITHIN_GMP
/* compiling to go into a DLL libgmp */
#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
#else
@@ -144,7 +195,6 @@ typedef unsigned long int mp_limb_t;
typedef long int mp_limb_signed_t;
#endif
#endif
-typedef unsigned long int mp_bitcnt_t;
/* For reference, note that the name __mpz_struct gets into C++ mangled
function names, which means although the "__" suggests an internal, we
@@ -166,7 +216,7 @@ typedef __mpz_struct MP_INT; /* gmp 1 source compatibility */
typedef __mpz_struct mpz_t[1];
typedef mp_limb_t * mp_ptr;
-typedef const mp_limb_t * mp_srcptr;
+typedef __gmp_const mp_limb_t * mp_srcptr;
#if defined (_CRAY) && ! defined (_CRAYMPP)
/* plain `int' is much faster (48 bits) */
#define __GMP_MP_SIZE_T_INT 1
@@ -223,18 +273,18 @@ typedef __gmp_randstate_struct gmp_randstate_t[1];
/* Types for function declarations in gmp files. */
/* ??? Should not pollute user name space with these ??? */
-typedef const __mpz_struct *mpz_srcptr;
+typedef __gmp_const __mpz_struct *mpz_srcptr;
typedef __mpz_struct *mpz_ptr;
-typedef const __mpf_struct *mpf_srcptr;
+typedef __gmp_const __mpf_struct *mpf_srcptr;
typedef __mpf_struct *mpf_ptr;
-typedef const __mpq_struct *mpq_srcptr;
+typedef __gmp_const __mpq_struct *mpq_srcptr;
typedef __mpq_struct *mpq_ptr;
/* This is not wanted in mp.h, so put it outside the __GNU_MP__ common
section. */
#if __GMP_LIBGMP_DLL
-#ifdef __GMP_WITHIN_GMPXX
+#if __GMP_WITHIN_GMPXX
/* compiling to go into a DLL libgmpxx */
#define __GMP_DECLSPEC_XX __GMP_DECLSPEC_EXPORT
#else
@@ -247,8 +297,18 @@ typedef __mpq_struct *mpq_ptr;
#endif
+#if __GMP_HAVE_PROTOTYPES
+#define __GMP_PROTO(x) x
+#else
+#define __GMP_PROTO(x) ()
+#endif
+
#ifndef __MPN
+#if __GMP_HAVE_TOKEN_PASTE
#define __MPN(x) __gmpn_##x
+#else
+#define __MPN(x) __gmpn_/**/x
+#endif
#endif
/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
@@ -266,8 +326,7 @@ typedef __mpq_struct *mpq_ptr;
|| defined (__STDIO__) /* Apple MPW MrC */ \
|| defined (_MSL_STDIO_H) /* Metrowerks */ \
|| defined (_STDIO_H_INCLUDED) /* QNX4 */ \
- || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
- || defined (__STDIO_LOADED) /* VMS */
+ || defined (_ISO_STDIO_ISO_H) /* Sun C++ */
#define _GMP_H_HAVE_FILE 1
#endif
@@ -279,14 +338,16 @@ 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 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.
+/* 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.
<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> anyway. */
+ whole <stdarg.h> or <varargs.h> anyway. */
#ifdef va_start
#define _GMP_H_HAVE_VA_LIST 1
@@ -360,8 +421,7 @@ typedef __mpq_struct *mpq_ptr;
GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
inline semantics, unless -fgnu89-inline is used. */
#ifdef __GNUC__
-#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2) \
- || (defined __GNUC_GNU_INLINE__ && defined __cplusplus)
+#if (defined __GNUC_STDC_INLINE__) || (__GNUC__ == 4 && __GNUC_MINOR__ == 2)
#define __GMP_EXTERN_INLINE extern __inline__ __attribute__ ((__gnu_inline__))
#else
#define __GMP_EXTERN_INLINE extern __inline__
@@ -400,13 +460,13 @@ typedef __mpq_struct *mpq_ptr;
#define __GMP_EXTERN_INLINE __inline
#endif
-/* Recent enough Sun C compilers want "inline" */
+/* Recent enough Sun C compilers accept "extern inline" */
#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x560 \
&& ! defined (__GMP_EXTERN_INLINE)
-#define __GMP_EXTERN_INLINE inline
+#define __GMP_EXTERN_INLINE extern inline
#endif
-/* Somewhat older Sun C compilers want "static inline" */
+/* Somewhat older Sun C compilers accept "static inline" */
#if defined (__SUNPRO_C) && __SUNPRO_C >= 0x540 \
&& ! defined (__GMP_EXTERN_INLINE)
#define __GMP_EXTERN_INLINE static inline
@@ -446,10 +506,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 "~". It still needs to have the promoted type. */
+ to int by "~". */
#define __GMP_UINT_MAX (~ (unsigned) 0)
#define __GMP_ULONG_MAX (~ (unsigned long) 0)
-#define __GMP_USHRT_MAX (0 + (unsigned short) ~0)
+#define __GMP_USHRT_MAX ((unsigned short) ~0)
/* __builtin_expect is in gcc 3.0, and not in 2.95. */
@@ -479,114 +539,116 @@ using std::FILE;
#endif
#define mp_set_memory_functions __gmp_set_memory_functions
-__GMP_DECLSPEC void mp_set_memory_functions (void *(*) (size_t),
+__GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t),
void *(*) (void *, size_t, size_t),
- void (*) (void *, size_t)) __GMP_NOTHROW;
+ void (*) (void *, size_t))) __GMP_NOTHROW;
#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;
+__GMP_DECLSPEC void mp_get_memory_functions __GMP_PROTO ((void *(**) (size_t),
+ 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;
+__GMP_DECLSPEC extern __gmp_const int mp_bits_per_limb;
#define gmp_errno __gmp_errno
__GMP_DECLSPEC extern int gmp_errno;
#define gmp_version __gmp_version
-__GMP_DECLSPEC extern const char * const gmp_version;
+__GMP_DECLSPEC extern __gmp_const char * __gmp_const gmp_version;
/**************** Random number routines. ****************/
/* obsolete */
#define gmp_randinit __gmp_randinit
-__GMP_DECLSPEC void gmp_randinit (gmp_randstate_t, gmp_randalg_t, ...);
+__GMP_DECLSPEC void gmp_randinit __GMP_PROTO ((gmp_randstate_t, gmp_randalg_t, ...));
#define gmp_randinit_default __gmp_randinit_default
-__GMP_DECLSPEC void gmp_randinit_default (gmp_randstate_t);
+__GMP_DECLSPEC void gmp_randinit_default __GMP_PROTO ((gmp_randstate_t));
#define gmp_randinit_lc_2exp __gmp_randinit_lc_2exp
-__GMP_DECLSPEC void gmp_randinit_lc_2exp (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t);
+__GMP_DECLSPEC void gmp_randinit_lc_2exp __GMP_PROTO ((gmp_randstate_t,
+ mpz_srcptr, unsigned long int,
+ unsigned long int));
#define gmp_randinit_lc_2exp_size __gmp_randinit_lc_2exp_size
-__GMP_DECLSPEC int gmp_randinit_lc_2exp_size (gmp_randstate_t, mp_bitcnt_t);
+__GMP_DECLSPEC int gmp_randinit_lc_2exp_size __GMP_PROTO ((gmp_randstate_t, unsigned long));
#define gmp_randinit_mt __gmp_randinit_mt
-__GMP_DECLSPEC void gmp_randinit_mt (gmp_randstate_t);
+__GMP_DECLSPEC void gmp_randinit_mt __GMP_PROTO ((gmp_randstate_t));
#define gmp_randinit_set __gmp_randinit_set
-__GMP_DECLSPEC void gmp_randinit_set (gmp_randstate_t, const __gmp_randstate_struct *);
+__GMP_DECLSPEC void gmp_randinit_set __GMP_PROTO ((gmp_randstate_t, __gmp_const __gmp_randstate_struct *));
#define gmp_randseed __gmp_randseed
-__GMP_DECLSPEC void gmp_randseed (gmp_randstate_t, mpz_srcptr);
+__GMP_DECLSPEC void gmp_randseed __GMP_PROTO ((gmp_randstate_t, mpz_srcptr));
#define gmp_randseed_ui __gmp_randseed_ui
-__GMP_DECLSPEC void gmp_randseed_ui (gmp_randstate_t, unsigned long int);
+__GMP_DECLSPEC void gmp_randseed_ui __GMP_PROTO ((gmp_randstate_t, unsigned long int));
#define gmp_randclear __gmp_randclear
-__GMP_DECLSPEC void gmp_randclear (gmp_randstate_t);
+__GMP_DECLSPEC void gmp_randclear __GMP_PROTO ((gmp_randstate_t));
#define gmp_urandomb_ui __gmp_urandomb_ui
-__GMP_DECLSPEC unsigned long gmp_urandomb_ui (gmp_randstate_t, unsigned long);
+__GMP_DECLSPEC unsigned long gmp_urandomb_ui __GMP_PROTO ((gmp_randstate_t, unsigned long));
#define gmp_urandomm_ui __gmp_urandomm_ui
-__GMP_DECLSPEC unsigned long gmp_urandomm_ui (gmp_randstate_t, unsigned long);
+__GMP_DECLSPEC unsigned long gmp_urandomm_ui __GMP_PROTO ((gmp_randstate_t, unsigned long));
/**************** Formatted output routines. ****************/
#define gmp_asprintf __gmp_asprintf
-__GMP_DECLSPEC int gmp_asprintf (char **, const char *, ...);
+__GMP_DECLSPEC int gmp_asprintf __GMP_PROTO ((char **, __gmp_const char *, ...));
#define gmp_fprintf __gmp_fprintf
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC int gmp_fprintf (FILE *, const char *, ...);
+__GMP_DECLSPEC int gmp_fprintf __GMP_PROTO ((FILE *, __gmp_const char *, ...));
#endif
#define gmp_obstack_printf __gmp_obstack_printf
#if defined (_GMP_H_HAVE_OBSTACK)
-__GMP_DECLSPEC int gmp_obstack_printf (struct obstack *, const char *, ...);
+__GMP_DECLSPEC int gmp_obstack_printf __GMP_PROTO ((struct obstack *, __gmp_const char *, ...));
#endif
#define gmp_obstack_vprintf __gmp_obstack_vprintf
#if defined (_GMP_H_HAVE_OBSTACK) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_obstack_vprintf (struct obstack *, const char *, va_list);
+__GMP_DECLSPEC int gmp_obstack_vprintf __GMP_PROTO ((struct obstack *, __gmp_const char *, va_list));
#endif
#define gmp_printf __gmp_printf
-__GMP_DECLSPEC int gmp_printf (const char *, ...);
+__GMP_DECLSPEC int gmp_printf __GMP_PROTO ((__gmp_const char *, ...));
#define gmp_snprintf __gmp_snprintf
-__GMP_DECLSPEC int gmp_snprintf (char *, size_t, const char *, ...);
+__GMP_DECLSPEC int gmp_snprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, ...));
#define gmp_sprintf __gmp_sprintf
-__GMP_DECLSPEC int gmp_sprintf (char *, const char *, ...);
+__GMP_DECLSPEC int gmp_sprintf __GMP_PROTO ((char *, __gmp_const char *, ...));
#define gmp_vasprintf __gmp_vasprintf
#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vasprintf (char **, const char *, va_list);
+__GMP_DECLSPEC int gmp_vasprintf __GMP_PROTO ((char **, __gmp_const char *, va_list));
#endif
#define gmp_vfprintf __gmp_vfprintf
#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vfprintf (FILE *, const char *, va_list);
+__GMP_DECLSPEC int gmp_vfprintf __GMP_PROTO ((FILE *, __gmp_const char *, va_list));
#endif
#define gmp_vprintf __gmp_vprintf
#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vprintf (const char *, va_list);
+__GMP_DECLSPEC int gmp_vprintf __GMP_PROTO ((__gmp_const char *, va_list));
#endif
#define gmp_vsnprintf __gmp_vsnprintf
#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsnprintf (char *, size_t, const char *, va_list);
+__GMP_DECLSPEC int gmp_vsnprintf __GMP_PROTO ((char *, size_t, __gmp_const char *, va_list));
#endif
#define gmp_vsprintf __gmp_vsprintf
#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list);
+__GMP_DECLSPEC int gmp_vsprintf __GMP_PROTO ((char *, __gmp_const char *, va_list));
#endif
@@ -594,28 +656,28 @@ __GMP_DECLSPEC int gmp_vsprintf (char *, const char *, va_list);
#define gmp_fscanf __gmp_fscanf
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC int gmp_fscanf (FILE *, const char *, ...);
+__GMP_DECLSPEC int gmp_fscanf __GMP_PROTO ((FILE *, __gmp_const char *, ...));
#endif
#define gmp_scanf __gmp_scanf
-__GMP_DECLSPEC int gmp_scanf (const char *, ...);
+__GMP_DECLSPEC int gmp_scanf __GMP_PROTO ((__gmp_const char *, ...));
#define gmp_sscanf __gmp_sscanf
-__GMP_DECLSPEC int gmp_sscanf (const char *, const char *, ...);
+__GMP_DECLSPEC int gmp_sscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, ...));
#define gmp_vfscanf __gmp_vfscanf
#if defined (_GMP_H_HAVE_FILE) && defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vfscanf (FILE *, const char *, va_list);
+__GMP_DECLSPEC int gmp_vfscanf __GMP_PROTO ((FILE *, __gmp_const char *, va_list));
#endif
#define gmp_vscanf __gmp_vscanf
#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vscanf (const char *, va_list);
+__GMP_DECLSPEC int gmp_vscanf __GMP_PROTO ((__gmp_const char *, va_list));
#endif
#define gmp_vsscanf __gmp_vsscanf
#if defined (_GMP_H_HAVE_VA_LIST)
-__GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list);
+__GMP_DECLSPEC int gmp_vsscanf __GMP_PROTO ((__gmp_const char *, __gmp_const char *, va_list));
#endif
@@ -623,836 +685,790 @@ __GMP_DECLSPEC int gmp_vsscanf (const char *, const char *, va_list);
#define _mpz_realloc __gmpz_realloc
#define mpz_realloc __gmpz_realloc
-__GMP_DECLSPEC void *_mpz_realloc (mpz_ptr, mp_size_t);
+__GMP_DECLSPEC void *_mpz_realloc __GMP_PROTO ((mpz_ptr, mp_size_t));
#define mpz_abs __gmpz_abs
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_abs)
-__GMP_DECLSPEC void mpz_abs (mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_abs __GMP_PROTO ((mpz_ptr, mpz_srcptr));
#endif
#define mpz_add __gmpz_add
-__GMP_DECLSPEC void mpz_add (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_add __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_add_ui __gmpz_add_ui
-__GMP_DECLSPEC void mpz_add_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_add_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_addmul __gmpz_addmul
-__GMP_DECLSPEC void mpz_addmul (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_addmul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_addmul_ui __gmpz_addmul_ui
-__GMP_DECLSPEC void mpz_addmul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_addmul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_and __gmpz_and
-__GMP_DECLSPEC void mpz_and (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_and __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_array_init __gmpz_array_init
-__GMP_DECLSPEC void mpz_array_init (mpz_ptr, mp_size_t, mp_size_t);
+__GMP_DECLSPEC void mpz_array_init __GMP_PROTO ((mpz_ptr, mp_size_t, mp_size_t));
#define mpz_bin_ui __gmpz_bin_ui
-__GMP_DECLSPEC void mpz_bin_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_bin_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_bin_uiui __gmpz_bin_uiui
-__GMP_DECLSPEC void mpz_bin_uiui (mpz_ptr, unsigned long int, unsigned long int);
+__GMP_DECLSPEC void mpz_bin_uiui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));
#define mpz_cdiv_q __gmpz_cdiv_q
-__GMP_DECLSPEC void mpz_cdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_cdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_cdiv_q_2exp __gmpz_cdiv_q_2exp
-__GMP_DECLSPEC void mpz_cdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_cdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
#define mpz_cdiv_q_ui __gmpz_cdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_cdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_cdiv_qr __gmpz_cdiv_qr
-__GMP_DECLSPEC void mpz_cdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_cdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_cdiv_qr_ui __gmpz_cdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_cdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_cdiv_r __gmpz_cdiv_r
-__GMP_DECLSPEC void mpz_cdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_cdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_cdiv_r_2exp __gmpz_cdiv_r_2exp
-__GMP_DECLSPEC void mpz_cdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_cdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
#define mpz_cdiv_r_ui __gmpz_cdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_cdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_cdiv_ui __gmpz_cdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_cdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_cdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
#define mpz_clear __gmpz_clear
-__GMP_DECLSPEC void mpz_clear (mpz_ptr);
-
-#define mpz_clears __gmpz_clears
-__GMP_DECLSPEC void mpz_clears (mpz_ptr, ...);
+__GMP_DECLSPEC void mpz_clear __GMP_PROTO ((mpz_ptr));
#define mpz_clrbit __gmpz_clrbit
-__GMP_DECLSPEC void mpz_clrbit (mpz_ptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_clrbit __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_cmp __gmpz_cmp
-__GMP_DECLSPEC int mpz_cmp (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_cmp __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_cmp_d __gmpz_cmp_d
-__GMP_DECLSPEC int mpz_cmp_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_cmp_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
#define _mpz_cmp_si __gmpz_cmp_si
-__GMP_DECLSPEC int _mpz_cmp_si (mpz_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int _mpz_cmp_si __GMP_PROTO ((mpz_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define _mpz_cmp_ui __gmpz_cmp_ui
-__GMP_DECLSPEC int _mpz_cmp_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int _mpz_cmp_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_cmpabs __gmpz_cmpabs
-__GMP_DECLSPEC int mpz_cmpabs (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_cmpabs __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_cmpabs_d __gmpz_cmpabs_d
-__GMP_DECLSPEC int mpz_cmpabs_d (mpz_srcptr, double) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_cmpabs_d __GMP_PROTO ((mpz_srcptr, double)) __GMP_ATTRIBUTE_PURE;
#define mpz_cmpabs_ui __gmpz_cmpabs_ui
-__GMP_DECLSPEC int mpz_cmpabs_ui (mpz_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_cmpabs_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_com __gmpz_com
-__GMP_DECLSPEC void mpz_com (mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_com __GMP_PROTO ((mpz_ptr, mpz_srcptr));
#define mpz_combit __gmpz_combit
-__GMP_DECLSPEC void mpz_combit (mpz_ptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_combit __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_congruent_p __gmpz_congruent_p
-__GMP_DECLSPEC int mpz_congruent_p (mpz_srcptr, mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_congruent_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpz_congruent_2exp_p __gmpz_congruent_2exp_p
-__GMP_DECLSPEC int mpz_congruent_2exp_p (mpz_srcptr, mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_congruent_2exp_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_congruent_ui_p __gmpz_congruent_ui_p
-__GMP_DECLSPEC int mpz_congruent_ui_p (mpz_srcptr, unsigned long, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_congruent_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long, unsigned long)) __GMP_ATTRIBUTE_PURE;
#define mpz_divexact __gmpz_divexact
-__GMP_DECLSPEC void mpz_divexact (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_divexact __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_divexact_ui __gmpz_divexact_ui
-__GMP_DECLSPEC void mpz_divexact_ui (mpz_ptr, mpz_srcptr, unsigned long);
+__GMP_DECLSPEC void mpz_divexact_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
#define mpz_divisible_p __gmpz_divisible_p
-__GMP_DECLSPEC int mpz_divisible_p (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_divisible_p __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpz_divisible_ui_p __gmpz_divisible_ui_p
-__GMP_DECLSPEC int mpz_divisible_ui_p (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_divisible_ui_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
#define mpz_divisible_2exp_p __gmpz_divisible_2exp_p
-__GMP_DECLSPEC int mpz_divisible_2exp_p (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_divisible_2exp_p __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_dump __gmpz_dump
-__GMP_DECLSPEC void mpz_dump (mpz_srcptr);
+__GMP_DECLSPEC void mpz_dump __GMP_PROTO ((mpz_srcptr));
#define mpz_export __gmpz_export
-__GMP_DECLSPEC void *mpz_export (void *, size_t *, int, size_t, int, size_t, mpz_srcptr);
+__GMP_DECLSPEC void *mpz_export __GMP_PROTO ((void *, size_t *, int, size_t, int, size_t, mpz_srcptr));
#define mpz_fac_ui __gmpz_fac_ui
-__GMP_DECLSPEC void mpz_fac_ui (mpz_ptr, unsigned long int);
-
-#define mpz_2fac_ui __gmpz_2fac_ui
-__GMP_DECLSPEC void mpz_2fac_ui (mpz_ptr, unsigned long int);
-
-#define mpz_mfac_uiui __gmpz_mfac_uiui
-__GMP_DECLSPEC void mpz_mfac_uiui (mpz_ptr, unsigned long int, unsigned long int);
-
-#define mpz_primorial_ui __gmpz_primorial_ui
-__GMP_DECLSPEC void mpz_primorial_ui (mpz_ptr, unsigned long int);
+__GMP_DECLSPEC void mpz_fac_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_fdiv_q __gmpz_fdiv_q
-__GMP_DECLSPEC void mpz_fdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_fdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_fdiv_q_2exp __gmpz_fdiv_q_2exp
-__GMP_DECLSPEC void mpz_fdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_fdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_fdiv_q_ui __gmpz_fdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_fdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_fdiv_qr __gmpz_fdiv_qr
-__GMP_DECLSPEC void mpz_fdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_fdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_fdiv_qr_ui __gmpz_fdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_fdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_fdiv_r __gmpz_fdiv_r
-__GMP_DECLSPEC void mpz_fdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_fdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_fdiv_r_2exp __gmpz_fdiv_r_2exp
-__GMP_DECLSPEC void mpz_fdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_fdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_fdiv_r_ui __gmpz_fdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_fdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_fdiv_ui __gmpz_fdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_fdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_fdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
#define mpz_fib_ui __gmpz_fib_ui
-__GMP_DECLSPEC void mpz_fib_ui (mpz_ptr, unsigned long int);
+__GMP_DECLSPEC void mpz_fib_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_fib2_ui __gmpz_fib2_ui
-__GMP_DECLSPEC void mpz_fib2_ui (mpz_ptr, mpz_ptr, unsigned long int);
+__GMP_DECLSPEC void mpz_fib2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
#define mpz_fits_sint_p __gmpz_fits_sint_p
-__GMP_DECLSPEC int mpz_fits_sint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_fits_sint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_fits_slong_p __gmpz_fits_slong_p
-__GMP_DECLSPEC int mpz_fits_slong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_fits_slong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_fits_sshort_p __gmpz_fits_sshort_p
-__GMP_DECLSPEC int mpz_fits_sshort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_fits_sshort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_fits_uint_p __gmpz_fits_uint_p
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_uint_p)
-__GMP_DECLSPEC int mpz_fits_uint_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_fits_uint_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_fits_ulong_p __gmpz_fits_ulong_p
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ulong_p)
-__GMP_DECLSPEC int mpz_fits_ulong_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_fits_ulong_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_fits_ushort_p __gmpz_fits_ushort_p
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_fits_ushort_p)
-__GMP_DECLSPEC int mpz_fits_ushort_p (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_fits_ushort_p __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_gcd __gmpz_gcd
-__GMP_DECLSPEC void mpz_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_gcd __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_gcd_ui __gmpz_gcd_ui
-__GMP_DECLSPEC unsigned long int mpz_gcd_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_gcd_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_gcdext __gmpz_gcdext
-__GMP_DECLSPEC void mpz_gcdext (mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_gcdext __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_get_d __gmpz_get_d
-__GMP_DECLSPEC double mpz_get_d (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC double mpz_get_d __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpz_get_d_2exp __gmpz_get_d_2exp
-__GMP_DECLSPEC double mpz_get_d_2exp (signed long int *, mpz_srcptr);
+__GMP_DECLSPEC double mpz_get_d_2exp __GMP_PROTO ((signed long int *, mpz_srcptr));
#define mpz_get_si __gmpz_get_si
-__GMP_DECLSPEC /* signed */ long int mpz_get_si (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC /* signed */ long int mpz_get_si __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_get_str __gmpz_get_str
-__GMP_DECLSPEC char *mpz_get_str (char *, int, mpz_srcptr);
+__GMP_DECLSPEC char *mpz_get_str __GMP_PROTO ((char *, int, mpz_srcptr));
#define mpz_get_ui __gmpz_get_ui
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_get_ui)
-__GMP_DECLSPEC unsigned long int mpz_get_ui (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_get_ui __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_getlimbn __gmpz_getlimbn
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_getlimbn)
-__GMP_DECLSPEC mp_limb_t mpz_getlimbn (mpz_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpz_getlimbn __GMP_PROTO ((mpz_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_hamdist __gmpz_hamdist
-__GMP_DECLSPEC mp_bitcnt_t mpz_hamdist (mpz_srcptr, mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_hamdist __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_import __gmpz_import
-__GMP_DECLSPEC void mpz_import (mpz_ptr, size_t, int, size_t, int, size_t, const void *);
+__GMP_DECLSPEC void mpz_import __GMP_PROTO ((mpz_ptr, size_t, int, size_t, int, size_t, __gmp_const void *));
#define mpz_init __gmpz_init
-__GMP_DECLSPEC void mpz_init (mpz_ptr);
+__GMP_DECLSPEC void mpz_init __GMP_PROTO ((mpz_ptr));
#define mpz_init2 __gmpz_init2
-__GMP_DECLSPEC void mpz_init2 (mpz_ptr, mp_bitcnt_t);
-
-#define mpz_inits __gmpz_inits
-__GMP_DECLSPEC void mpz_inits (mpz_ptr, ...);
+__GMP_DECLSPEC void mpz_init2 __GMP_PROTO ((mpz_ptr, unsigned long));
#define mpz_init_set __gmpz_init_set
-__GMP_DECLSPEC void mpz_init_set (mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_init_set __GMP_PROTO ((mpz_ptr, mpz_srcptr));
#define mpz_init_set_d __gmpz_init_set_d
-__GMP_DECLSPEC void mpz_init_set_d (mpz_ptr, double);
+__GMP_DECLSPEC void mpz_init_set_d __GMP_PROTO ((mpz_ptr, double));
#define mpz_init_set_si __gmpz_init_set_si
-__GMP_DECLSPEC void mpz_init_set_si (mpz_ptr, signed long int);
+__GMP_DECLSPEC void mpz_init_set_si __GMP_PROTO ((mpz_ptr, signed long int));
#define mpz_init_set_str __gmpz_init_set_str
-__GMP_DECLSPEC int mpz_init_set_str (mpz_ptr, const char *, int);
+__GMP_DECLSPEC int mpz_init_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int));
#define mpz_init_set_ui __gmpz_init_set_ui
-__GMP_DECLSPEC void mpz_init_set_ui (mpz_ptr, unsigned long int);
+__GMP_DECLSPEC void mpz_init_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_inp_raw __gmpz_inp_raw
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_inp_raw (mpz_ptr, FILE *);
+__GMP_DECLSPEC size_t mpz_inp_raw __GMP_PROTO ((mpz_ptr, FILE *));
#endif
#define mpz_inp_str __gmpz_inp_str
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_inp_str (mpz_ptr, FILE *, int);
+__GMP_DECLSPEC size_t mpz_inp_str __GMP_PROTO ((mpz_ptr, FILE *, int));
#endif
#define mpz_invert __gmpz_invert
-__GMP_DECLSPEC int mpz_invert (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC int mpz_invert __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_ior __gmpz_ior
-__GMP_DECLSPEC void mpz_ior (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_ior __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_jacobi __gmpz_jacobi
-__GMP_DECLSPEC int mpz_jacobi (mpz_srcptr, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_jacobi __GMP_PROTO ((mpz_srcptr, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpz_kronecker mpz_jacobi /* alias */
#define mpz_kronecker_si __gmpz_kronecker_si
-__GMP_DECLSPEC int mpz_kronecker_si (mpz_srcptr, long) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_kronecker_si __GMP_PROTO ((mpz_srcptr, long)) __GMP_ATTRIBUTE_PURE;
#define mpz_kronecker_ui __gmpz_kronecker_ui
-__GMP_DECLSPEC int mpz_kronecker_ui (mpz_srcptr, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_kronecker_ui __GMP_PROTO ((mpz_srcptr, unsigned long)) __GMP_ATTRIBUTE_PURE;
#define mpz_si_kronecker __gmpz_si_kronecker
-__GMP_DECLSPEC int mpz_si_kronecker (long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_si_kronecker __GMP_PROTO ((long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpz_ui_kronecker __gmpz_ui_kronecker
-__GMP_DECLSPEC int mpz_ui_kronecker (unsigned long, mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_ui_kronecker __GMP_PROTO ((unsigned long, mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpz_lcm __gmpz_lcm
-__GMP_DECLSPEC void mpz_lcm (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_lcm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_lcm_ui __gmpz_lcm_ui
-__GMP_DECLSPEC void mpz_lcm_ui (mpz_ptr, mpz_srcptr, unsigned long);
+__GMP_DECLSPEC void mpz_lcm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long));
#define mpz_legendre mpz_jacobi /* alias */
#define mpz_lucnum_ui __gmpz_lucnum_ui
-__GMP_DECLSPEC void mpz_lucnum_ui (mpz_ptr, unsigned long int);
+__GMP_DECLSPEC void mpz_lucnum_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_lucnum2_ui __gmpz_lucnum2_ui
-__GMP_DECLSPEC void mpz_lucnum2_ui (mpz_ptr, mpz_ptr, unsigned long int);
+__GMP_DECLSPEC void mpz_lucnum2_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, unsigned long int));
#define mpz_millerrabin __gmpz_millerrabin
-__GMP_DECLSPEC int mpz_millerrabin (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_millerrabin __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
#define mpz_mod __gmpz_mod
-__GMP_DECLSPEC void mpz_mod (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_mod __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_mod_ui mpz_fdiv_r_ui /* same as fdiv_r because divisor unsigned */
#define mpz_mul __gmpz_mul
-__GMP_DECLSPEC void mpz_mul (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_mul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_mul_2exp __gmpz_mul_2exp
-__GMP_DECLSPEC void mpz_mul_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_mul_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_mul_si __gmpz_mul_si
-__GMP_DECLSPEC void mpz_mul_si (mpz_ptr, mpz_srcptr, long int);
+__GMP_DECLSPEC void mpz_mul_si __GMP_PROTO ((mpz_ptr, mpz_srcptr, long int));
#define mpz_mul_ui __gmpz_mul_ui
-__GMP_DECLSPEC void mpz_mul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_mul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_neg __gmpz_neg
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_neg)
-__GMP_DECLSPEC void mpz_neg (mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_neg __GMP_PROTO ((mpz_ptr, mpz_srcptr));
#endif
#define mpz_nextprime __gmpz_nextprime
-__GMP_DECLSPEC void mpz_nextprime (mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_nextprime __GMP_PROTO ((mpz_ptr, mpz_srcptr));
#define mpz_out_raw __gmpz_out_raw
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_out_raw (FILE *, mpz_srcptr);
+__GMP_DECLSPEC size_t mpz_out_raw __GMP_PROTO ((FILE *, mpz_srcptr));
#endif
#define mpz_out_str __gmpz_out_str
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_out_str (FILE *, int, mpz_srcptr);
+__GMP_DECLSPEC size_t mpz_out_str __GMP_PROTO ((FILE *, int, mpz_srcptr));
#endif
#define mpz_perfect_power_p __gmpz_perfect_power_p
-__GMP_DECLSPEC int mpz_perfect_power_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_perfect_power_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpz_perfect_square_p __gmpz_perfect_square_p
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_perfect_square_p)
-__GMP_DECLSPEC int mpz_perfect_square_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_perfect_square_p __GMP_PROTO ((mpz_srcptr)) __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_popcount __gmpz_popcount
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_popcount)
-__GMP_DECLSPEC mp_bitcnt_t mpz_popcount (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_popcount __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_pow_ui __gmpz_pow_ui
-__GMP_DECLSPEC void mpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_pow_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_powm __gmpz_powm
-__GMP_DECLSPEC void mpz_powm (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_powm_sec __gmpz_powm_sec
-__GMP_DECLSPEC void mpz_powm_sec (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_powm __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
#define mpz_powm_ui __gmpz_powm_ui
-__GMP_DECLSPEC void mpz_powm_ui (mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr);
+__GMP_DECLSPEC void mpz_powm_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int, mpz_srcptr));
#define mpz_probab_prime_p __gmpz_probab_prime_p
-__GMP_DECLSPEC int mpz_probab_prime_p (mpz_srcptr, int) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_probab_prime_p __GMP_PROTO ((mpz_srcptr, int)) __GMP_ATTRIBUTE_PURE;
#define mpz_random __gmpz_random
-__GMP_DECLSPEC void mpz_random (mpz_ptr, mp_size_t);
+__GMP_DECLSPEC void mpz_random __GMP_PROTO ((mpz_ptr, mp_size_t));
#define mpz_random2 __gmpz_random2
-__GMP_DECLSPEC void mpz_random2 (mpz_ptr, mp_size_t);
+__GMP_DECLSPEC void mpz_random2 __GMP_PROTO ((mpz_ptr, mp_size_t));
#define mpz_realloc2 __gmpz_realloc2
-__GMP_DECLSPEC void mpz_realloc2 (mpz_ptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_realloc2 __GMP_PROTO ((mpz_ptr, unsigned long));
#define mpz_remove __gmpz_remove
-__GMP_DECLSPEC mp_bitcnt_t mpz_remove (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC unsigned long int mpz_remove __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_root __gmpz_root
-__GMP_DECLSPEC int mpz_root (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC int mpz_root __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_rootrem __gmpz_rootrem
-__GMP_DECLSPEC void mpz_rootrem (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_rootrem __GMP_PROTO ((mpz_ptr,mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_rrandomb __gmpz_rrandomb
-__GMP_DECLSPEC void mpz_rrandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_rrandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
#define mpz_scan0 __gmpz_scan0
-__GMP_DECLSPEC mp_bitcnt_t mpz_scan0 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_scan0 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_scan1 __gmpz_scan1
-__GMP_DECLSPEC mp_bitcnt_t mpz_scan1 (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_scan1 __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_set __gmpz_set
-__GMP_DECLSPEC void mpz_set (mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_set __GMP_PROTO ((mpz_ptr, mpz_srcptr));
#define mpz_set_d __gmpz_set_d
-__GMP_DECLSPEC void mpz_set_d (mpz_ptr, double);
+__GMP_DECLSPEC void mpz_set_d __GMP_PROTO ((mpz_ptr, double));
#define mpz_set_f __gmpz_set_f
-__GMP_DECLSPEC void mpz_set_f (mpz_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpz_set_f __GMP_PROTO ((mpz_ptr, mpf_srcptr));
#define mpz_set_q __gmpz_set_q
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_set_q)
-__GMP_DECLSPEC void mpz_set_q (mpz_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpz_set_q __GMP_PROTO ((mpz_ptr, mpq_srcptr));
#endif
#define mpz_set_si __gmpz_set_si
-__GMP_DECLSPEC void mpz_set_si (mpz_ptr, signed long int);
+__GMP_DECLSPEC void mpz_set_si __GMP_PROTO ((mpz_ptr, signed long int));
#define mpz_set_str __gmpz_set_str
-__GMP_DECLSPEC int mpz_set_str (mpz_ptr, const char *, int);
+__GMP_DECLSPEC int mpz_set_str __GMP_PROTO ((mpz_ptr, __gmp_const char *, int));
#define mpz_set_ui __gmpz_set_ui
-__GMP_DECLSPEC void mpz_set_ui (mpz_ptr, unsigned long int);
+__GMP_DECLSPEC void mpz_set_ui __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_setbit __gmpz_setbit
-__GMP_DECLSPEC void mpz_setbit (mpz_ptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_setbit __GMP_PROTO ((mpz_ptr, unsigned long int));
#define mpz_size __gmpz_size
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpz_size)
-__GMP_DECLSPEC size_t mpz_size (mpz_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC size_t mpz_size __GMP_PROTO ((mpz_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpz_sizeinbase __gmpz_sizeinbase
-__GMP_DECLSPEC size_t mpz_sizeinbase (mpz_srcptr, int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC size_t mpz_sizeinbase __GMP_PROTO ((mpz_srcptr, int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_sqrt __gmpz_sqrt
-__GMP_DECLSPEC void mpz_sqrt (mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_sqrt __GMP_PROTO ((mpz_ptr, mpz_srcptr));
#define mpz_sqrtrem __gmpz_sqrtrem
-__GMP_DECLSPEC void mpz_sqrtrem (mpz_ptr, mpz_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_sqrtrem __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr));
#define mpz_sub __gmpz_sub
-__GMP_DECLSPEC void mpz_sub (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_sub __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_sub_ui __gmpz_sub_ui
-__GMP_DECLSPEC void mpz_sub_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_sub_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_ui_sub __gmpz_ui_sub
-__GMP_DECLSPEC void mpz_ui_sub (mpz_ptr, unsigned long int, mpz_srcptr);
+__GMP_DECLSPEC void mpz_ui_sub __GMP_PROTO ((mpz_ptr, unsigned long int, mpz_srcptr));
#define mpz_submul __gmpz_submul
-__GMP_DECLSPEC void mpz_submul (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_submul __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_submul_ui __gmpz_submul_ui
-__GMP_DECLSPEC void mpz_submul_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpz_submul_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_swap __gmpz_swap
-__GMP_DECLSPEC void mpz_swap (mpz_ptr, mpz_ptr) __GMP_NOTHROW;
+__GMP_DECLSPEC void mpz_swap __GMP_PROTO ((mpz_ptr, mpz_ptr)) __GMP_NOTHROW;
#define mpz_tdiv_ui __gmpz_tdiv_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_ui (mpz_srcptr, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpz_tdiv_ui __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
#define mpz_tdiv_q __gmpz_tdiv_q
-__GMP_DECLSPEC void mpz_tdiv_q (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_tdiv_q __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_tdiv_q_2exp __gmpz_tdiv_q_2exp
-__GMP_DECLSPEC void mpz_tdiv_q_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_tdiv_q_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_tdiv_q_ui __gmpz_tdiv_q_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_tdiv_q_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_tdiv_qr __gmpz_tdiv_qr
-__GMP_DECLSPEC void mpz_tdiv_qr (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_tdiv_qr __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_tdiv_qr_ui __gmpz_tdiv_qr_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_tdiv_qr_ui __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_tdiv_r __gmpz_tdiv_r
-__GMP_DECLSPEC void mpz_tdiv_r (mpz_ptr, mpz_srcptr, mpz_srcptr);
+__GMP_DECLSPEC void mpz_tdiv_r __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_tdiv_r_2exp __gmpz_tdiv_r_2exp
-__GMP_DECLSPEC void mpz_tdiv_r_2exp (mpz_ptr, mpz_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_tdiv_r_2exp __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_tdiv_r_ui __gmpz_tdiv_r_ui
-__GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui (mpz_ptr, mpz_srcptr, unsigned long int);
+__GMP_DECLSPEC unsigned long int mpz_tdiv_r_ui __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
#define mpz_tstbit __gmpz_tstbit
-__GMP_DECLSPEC int mpz_tstbit (mpz_srcptr, mp_bitcnt_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpz_tstbit __GMP_PROTO ((mpz_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpz_ui_pow_ui __gmpz_ui_pow_ui
-__GMP_DECLSPEC void mpz_ui_pow_ui (mpz_ptr, unsigned long int, unsigned long int);
+__GMP_DECLSPEC void mpz_ui_pow_ui __GMP_PROTO ((mpz_ptr, unsigned long int, unsigned long int));
#define mpz_urandomb __gmpz_urandomb
-__GMP_DECLSPEC void mpz_urandomb (mpz_ptr, gmp_randstate_t, mp_bitcnt_t);
+__GMP_DECLSPEC void mpz_urandomb __GMP_PROTO ((mpz_ptr, gmp_randstate_t, unsigned long int));
#define mpz_urandomm __gmpz_urandomm
-__GMP_DECLSPEC void mpz_urandomm (mpz_ptr, gmp_randstate_t, mpz_srcptr);
+__GMP_DECLSPEC void mpz_urandomm __GMP_PROTO ((mpz_ptr, gmp_randstate_t, mpz_srcptr));
#define mpz_xor __gmpz_xor
#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);
+__GMP_DECLSPEC void mpz_xor __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
-#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. ****************/
#define mpq_abs __gmpq_abs
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_abs)
-__GMP_DECLSPEC void mpq_abs (mpq_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_abs __GMP_PROTO ((mpq_ptr, mpq_srcptr));
#endif
#define mpq_add __gmpq_add
-__GMP_DECLSPEC void mpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_add __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
#define mpq_canonicalize __gmpq_canonicalize
-__GMP_DECLSPEC void mpq_canonicalize (mpq_ptr);
+__GMP_DECLSPEC void mpq_canonicalize __GMP_PROTO ((mpq_ptr));
#define mpq_clear __gmpq_clear
-__GMP_DECLSPEC void mpq_clear (mpq_ptr);
-
-#define mpq_clears __gmpq_clears
-__GMP_DECLSPEC void mpq_clears (mpq_ptr, ...);
+__GMP_DECLSPEC void mpq_clear __GMP_PROTO ((mpq_ptr));
#define mpq_cmp __gmpq_cmp
-__GMP_DECLSPEC int mpq_cmp (mpq_srcptr, mpq_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpq_cmp __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
#define _mpq_cmp_si __gmpq_cmp_si
-__GMP_DECLSPEC int _mpq_cmp_si (mpq_srcptr, long, unsigned long) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int _mpq_cmp_si __GMP_PROTO ((mpq_srcptr, long, unsigned long)) __GMP_ATTRIBUTE_PURE;
#define _mpq_cmp_ui __gmpq_cmp_ui
-__GMP_DECLSPEC int _mpq_cmp_ui (mpq_srcptr, unsigned long int, unsigned long int) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int _mpq_cmp_ui __GMP_PROTO ((mpq_srcptr, unsigned long int, unsigned long int)) __GMP_ATTRIBUTE_PURE;
#define mpq_div __gmpq_div
-__GMP_DECLSPEC void mpq_div (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_div __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
#define mpq_div_2exp __gmpq_div_2exp
-__GMP_DECLSPEC void mpq_div_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpq_div_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
#define mpq_equal __gmpq_equal
-__GMP_DECLSPEC int mpq_equal (mpq_srcptr, mpq_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpq_equal __GMP_PROTO ((mpq_srcptr, mpq_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpq_get_num __gmpq_get_num
-__GMP_DECLSPEC void mpq_get_num (mpz_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_get_num __GMP_PROTO ((mpz_ptr, mpq_srcptr));
#define mpq_get_den __gmpq_get_den
-__GMP_DECLSPEC void mpq_get_den (mpz_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_get_den __GMP_PROTO ((mpz_ptr, mpq_srcptr));
#define mpq_get_d __gmpq_get_d
-__GMP_DECLSPEC double mpq_get_d (mpq_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC double mpq_get_d __GMP_PROTO ((mpq_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpq_get_str __gmpq_get_str
-__GMP_DECLSPEC char *mpq_get_str (char *, int, mpq_srcptr);
+__GMP_DECLSPEC char *mpq_get_str __GMP_PROTO ((char *, int, mpq_srcptr));
#define mpq_init __gmpq_init
-__GMP_DECLSPEC void mpq_init (mpq_ptr);
-
-#define mpq_inits __gmpq_inits
-__GMP_DECLSPEC void mpq_inits (mpq_ptr, ...);
+__GMP_DECLSPEC void mpq_init __GMP_PROTO ((mpq_ptr));
#define mpq_inp_str __gmpq_inp_str
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpq_inp_str (mpq_ptr, FILE *, int);
+__GMP_DECLSPEC size_t mpq_inp_str __GMP_PROTO ((mpq_ptr, FILE *, int));
#endif
#define mpq_inv __gmpq_inv
-__GMP_DECLSPEC void mpq_inv (mpq_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_inv __GMP_PROTO ((mpq_ptr, mpq_srcptr));
#define mpq_mul __gmpq_mul
-__GMP_DECLSPEC void mpq_mul (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_mul __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
#define mpq_mul_2exp __gmpq_mul_2exp
-__GMP_DECLSPEC void mpq_mul_2exp (mpq_ptr, mpq_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpq_mul_2exp __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
#define mpq_neg __gmpq_neg
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpq_neg)
-__GMP_DECLSPEC void mpq_neg (mpq_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_neg __GMP_PROTO ((mpq_ptr, mpq_srcptr));
#endif
#define mpq_out_str __gmpq_out_str
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpq_out_str (FILE *, int, mpq_srcptr);
+__GMP_DECLSPEC size_t mpq_out_str __GMP_PROTO ((FILE *, int, mpq_srcptr));
#endif
#define mpq_set __gmpq_set
-__GMP_DECLSPEC void mpq_set (mpq_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_set __GMP_PROTO ((mpq_ptr, mpq_srcptr));
#define mpq_set_d __gmpq_set_d
-__GMP_DECLSPEC void mpq_set_d (mpq_ptr, double);
+__GMP_DECLSPEC void mpq_set_d __GMP_PROTO ((mpq_ptr, double));
#define mpq_set_den __gmpq_set_den
-__GMP_DECLSPEC void mpq_set_den (mpq_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpq_set_den __GMP_PROTO ((mpq_ptr, mpz_srcptr));
#define mpq_set_f __gmpq_set_f
-__GMP_DECLSPEC void mpq_set_f (mpq_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpq_set_f __GMP_PROTO ((mpq_ptr, mpf_srcptr));
#define mpq_set_num __gmpq_set_num
-__GMP_DECLSPEC void mpq_set_num (mpq_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpq_set_num __GMP_PROTO ((mpq_ptr, mpz_srcptr));
#define mpq_set_si __gmpq_set_si
-__GMP_DECLSPEC void mpq_set_si (mpq_ptr, signed long int, unsigned long int);
+__GMP_DECLSPEC void mpq_set_si __GMP_PROTO ((mpq_ptr, signed long int, unsigned long int));
#define mpq_set_str __gmpq_set_str
-__GMP_DECLSPEC int mpq_set_str (mpq_ptr, const char *, int);
+__GMP_DECLSPEC int mpq_set_str __GMP_PROTO ((mpq_ptr, __gmp_const char *, int));
#define mpq_set_ui __gmpq_set_ui
-__GMP_DECLSPEC void mpq_set_ui (mpq_ptr, unsigned long int, unsigned long int);
+__GMP_DECLSPEC void mpq_set_ui __GMP_PROTO ((mpq_ptr, unsigned long int, unsigned long int));
#define mpq_set_z __gmpq_set_z
-__GMP_DECLSPEC void mpq_set_z (mpq_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpq_set_z __GMP_PROTO ((mpq_ptr, mpz_srcptr));
#define mpq_sub __gmpq_sub
-__GMP_DECLSPEC void mpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr);
+__GMP_DECLSPEC void mpq_sub __GMP_PROTO ((mpq_ptr, mpq_srcptr, mpq_srcptr));
#define mpq_swap __gmpq_swap
-__GMP_DECLSPEC void mpq_swap (mpq_ptr, mpq_ptr) __GMP_NOTHROW;
+__GMP_DECLSPEC void mpq_swap __GMP_PROTO ((mpq_ptr, mpq_ptr)) __GMP_NOTHROW;
/**************** Float (i.e. F) routines. ****************/
#define mpf_abs __gmpf_abs
-__GMP_DECLSPEC void mpf_abs (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_abs __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_add __gmpf_add
-__GMP_DECLSPEC void mpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_add __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
#define mpf_add_ui __gmpf_add_ui
-__GMP_DECLSPEC void mpf_add_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpf_add_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
#define mpf_ceil __gmpf_ceil
-__GMP_DECLSPEC void mpf_ceil (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_ceil __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_clear __gmpf_clear
-__GMP_DECLSPEC void mpf_clear (mpf_ptr);
-
-#define mpf_clears __gmpf_clears
-__GMP_DECLSPEC void mpf_clears (mpf_ptr, ...);
+__GMP_DECLSPEC void mpf_clear __GMP_PROTO ((mpf_ptr));
#define mpf_cmp __gmpf_cmp
-__GMP_DECLSPEC int mpf_cmp (mpf_srcptr, mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_cmp __GMP_PROTO ((mpf_srcptr, mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_cmp_d __gmpf_cmp_d
-__GMP_DECLSPEC int mpf_cmp_d (mpf_srcptr, double) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_cmp_d __GMP_PROTO ((mpf_srcptr, double)) __GMP_ATTRIBUTE_PURE;
#define mpf_cmp_si __gmpf_cmp_si
-__GMP_DECLSPEC int mpf_cmp_si (mpf_srcptr, signed long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_cmp_si __GMP_PROTO ((mpf_srcptr, signed long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_cmp_ui __gmpf_cmp_ui
-__GMP_DECLSPEC int mpf_cmp_ui (mpf_srcptr, unsigned long int) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_cmp_ui __GMP_PROTO ((mpf_srcptr, unsigned long int)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_div __gmpf_div
-__GMP_DECLSPEC void mpf_div (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_div __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
#define mpf_div_2exp __gmpf_div_2exp
-__GMP_DECLSPEC void mpf_div_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpf_div_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
#define mpf_div_ui __gmpf_div_ui
-__GMP_DECLSPEC void mpf_div_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpf_div_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
#define mpf_dump __gmpf_dump
-__GMP_DECLSPEC void mpf_dump (mpf_srcptr);
+__GMP_DECLSPEC void mpf_dump __GMP_PROTO ((mpf_srcptr));
#define mpf_eq __gmpf_eq
-__GMP_DECLSPEC int mpf_eq (mpf_srcptr, mpf_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_eq __GMP_PROTO ((mpf_srcptr, mpf_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
#define mpf_fits_sint_p __gmpf_fits_sint_p
-__GMP_DECLSPEC int mpf_fits_sint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_fits_sint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_fits_slong_p __gmpf_fits_slong_p
-__GMP_DECLSPEC int mpf_fits_slong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_fits_slong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_fits_sshort_p __gmpf_fits_sshort_p
-__GMP_DECLSPEC int mpf_fits_sshort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_fits_sshort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_fits_uint_p __gmpf_fits_uint_p
-__GMP_DECLSPEC int mpf_fits_uint_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_fits_uint_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_fits_ulong_p __gmpf_fits_ulong_p
-__GMP_DECLSPEC int mpf_fits_ulong_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_fits_ulong_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_fits_ushort_p __gmpf_fits_ushort_p
-__GMP_DECLSPEC int mpf_fits_ushort_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_fits_ushort_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_floor __gmpf_floor
-__GMP_DECLSPEC void mpf_floor (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_floor __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_get_d __gmpf_get_d
-__GMP_DECLSPEC double mpf_get_d (mpf_srcptr) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC double mpf_get_d __GMP_PROTO ((mpf_srcptr)) __GMP_ATTRIBUTE_PURE;
#define mpf_get_d_2exp __gmpf_get_d_2exp
-__GMP_DECLSPEC double mpf_get_d_2exp (signed long int *, mpf_srcptr);
+__GMP_DECLSPEC double mpf_get_d_2exp __GMP_PROTO ((signed long int *, mpf_srcptr));
#define mpf_get_default_prec __gmpf_get_default_prec
-__GMP_DECLSPEC mp_bitcnt_t mpf_get_default_prec (void) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpf_get_default_prec __GMP_PROTO ((void)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_get_prec __gmpf_get_prec
-__GMP_DECLSPEC mp_bitcnt_t mpf_get_prec (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpf_get_prec __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_get_si __gmpf_get_si
-__GMP_DECLSPEC long mpf_get_si (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC long mpf_get_si __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_get_str __gmpf_get_str
-__GMP_DECLSPEC char *mpf_get_str (char *, mp_exp_t *, int, size_t, mpf_srcptr);
+__GMP_DECLSPEC char *mpf_get_str __GMP_PROTO ((char *, mp_exp_t *, int, size_t, mpf_srcptr));
#define mpf_get_ui __gmpf_get_ui
-__GMP_DECLSPEC unsigned long mpf_get_ui (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long mpf_get_ui __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_init __gmpf_init
-__GMP_DECLSPEC void mpf_init (mpf_ptr);
+__GMP_DECLSPEC void mpf_init __GMP_PROTO ((mpf_ptr));
#define mpf_init2 __gmpf_init2
-__GMP_DECLSPEC void mpf_init2 (mpf_ptr, mp_bitcnt_t);
-
-#define mpf_inits __gmpf_inits
-__GMP_DECLSPEC void mpf_inits (mpf_ptr, ...);
+__GMP_DECLSPEC void mpf_init2 __GMP_PROTO ((mpf_ptr, unsigned long int));
#define mpf_init_set __gmpf_init_set
-__GMP_DECLSPEC void mpf_init_set (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_init_set __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_init_set_d __gmpf_init_set_d
-__GMP_DECLSPEC void mpf_init_set_d (mpf_ptr, double);
+__GMP_DECLSPEC void mpf_init_set_d __GMP_PROTO ((mpf_ptr, double));
#define mpf_init_set_si __gmpf_init_set_si
-__GMP_DECLSPEC void mpf_init_set_si (mpf_ptr, signed long int);
+__GMP_DECLSPEC void mpf_init_set_si __GMP_PROTO ((mpf_ptr, signed long int));
#define mpf_init_set_str __gmpf_init_set_str
-__GMP_DECLSPEC int mpf_init_set_str (mpf_ptr, const char *, int);
+__GMP_DECLSPEC int mpf_init_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int));
#define mpf_init_set_ui __gmpf_init_set_ui
-__GMP_DECLSPEC void mpf_init_set_ui (mpf_ptr, unsigned long int);
+__GMP_DECLSPEC void mpf_init_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
#define mpf_inp_str __gmpf_inp_str
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpf_inp_str (mpf_ptr, FILE *, int);
+__GMP_DECLSPEC size_t mpf_inp_str __GMP_PROTO ((mpf_ptr, FILE *, int));
#endif
#define mpf_integer_p __gmpf_integer_p
-__GMP_DECLSPEC int mpf_integer_p (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpf_integer_p __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_mul __gmpf_mul
-__GMP_DECLSPEC void mpf_mul (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_mul __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
#define mpf_mul_2exp __gmpf_mul_2exp
-__GMP_DECLSPEC void mpf_mul_2exp (mpf_ptr, mpf_srcptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpf_mul_2exp __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
#define mpf_mul_ui __gmpf_mul_ui
-__GMP_DECLSPEC void mpf_mul_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpf_mul_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
#define mpf_neg __gmpf_neg
-__GMP_DECLSPEC void mpf_neg (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_neg __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_out_str __gmpf_out_str
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpf_out_str (FILE *, int, size_t, mpf_srcptr);
+__GMP_DECLSPEC size_t mpf_out_str __GMP_PROTO ((FILE *, int, size_t, mpf_srcptr));
#endif
#define mpf_pow_ui __gmpf_pow_ui
-__GMP_DECLSPEC void mpf_pow_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpf_pow_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
#define mpf_random2 __gmpf_random2
-__GMP_DECLSPEC void mpf_random2 (mpf_ptr, mp_size_t, mp_exp_t);
+__GMP_DECLSPEC void mpf_random2 __GMP_PROTO ((mpf_ptr, mp_size_t, mp_exp_t));
#define mpf_reldiff __gmpf_reldiff
-__GMP_DECLSPEC void mpf_reldiff (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_reldiff __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
#define mpf_set __gmpf_set
-__GMP_DECLSPEC void mpf_set (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_set __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_set_d __gmpf_set_d
-__GMP_DECLSPEC void mpf_set_d (mpf_ptr, double);
+__GMP_DECLSPEC void mpf_set_d __GMP_PROTO ((mpf_ptr, double));
#define mpf_set_default_prec __gmpf_set_default_prec
-__GMP_DECLSPEC void mpf_set_default_prec (mp_bitcnt_t) __GMP_NOTHROW;
+__GMP_DECLSPEC void mpf_set_default_prec __GMP_PROTO ((unsigned long int)) __GMP_NOTHROW;
#define mpf_set_prec __gmpf_set_prec
-__GMP_DECLSPEC void mpf_set_prec (mpf_ptr, mp_bitcnt_t);
+__GMP_DECLSPEC void mpf_set_prec __GMP_PROTO ((mpf_ptr, unsigned long int));
#define mpf_set_prec_raw __gmpf_set_prec_raw
-__GMP_DECLSPEC void mpf_set_prec_raw (mpf_ptr, mp_bitcnt_t) __GMP_NOTHROW;
+__GMP_DECLSPEC void mpf_set_prec_raw __GMP_PROTO ((mpf_ptr, unsigned long int)) __GMP_NOTHROW;
#define mpf_set_q __gmpf_set_q
-__GMP_DECLSPEC void mpf_set_q (mpf_ptr, mpq_srcptr);
+__GMP_DECLSPEC void mpf_set_q __GMP_PROTO ((mpf_ptr, mpq_srcptr));
#define mpf_set_si __gmpf_set_si
-__GMP_DECLSPEC void mpf_set_si (mpf_ptr, signed long int);
+__GMP_DECLSPEC void mpf_set_si __GMP_PROTO ((mpf_ptr, signed long int));
#define mpf_set_str __gmpf_set_str
-__GMP_DECLSPEC int mpf_set_str (mpf_ptr, const char *, int);
+__GMP_DECLSPEC int mpf_set_str __GMP_PROTO ((mpf_ptr, __gmp_const char *, int));
#define mpf_set_ui __gmpf_set_ui
-__GMP_DECLSPEC void mpf_set_ui (mpf_ptr, unsigned long int);
+__GMP_DECLSPEC void mpf_set_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
#define mpf_set_z __gmpf_set_z
-__GMP_DECLSPEC void mpf_set_z (mpf_ptr, mpz_srcptr);
+__GMP_DECLSPEC void mpf_set_z __GMP_PROTO ((mpf_ptr, mpz_srcptr));
#define mpf_size __gmpf_size
-__GMP_DECLSPEC size_t mpf_size (mpf_srcptr) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC size_t mpf_size __GMP_PROTO ((mpf_srcptr)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpf_sqrt __gmpf_sqrt
-__GMP_DECLSPEC void mpf_sqrt (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_sqrt __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_sqrt_ui __gmpf_sqrt_ui
-__GMP_DECLSPEC void mpf_sqrt_ui (mpf_ptr, unsigned long int);
+__GMP_DECLSPEC void mpf_sqrt_ui __GMP_PROTO ((mpf_ptr, unsigned long int));
#define mpf_sub __gmpf_sub
-__GMP_DECLSPEC void mpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_sub __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
#define mpf_sub_ui __gmpf_sub_ui
-__GMP_DECLSPEC void mpf_sub_ui (mpf_ptr, mpf_srcptr, unsigned long int);
+__GMP_DECLSPEC void mpf_sub_ui __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
#define mpf_swap __gmpf_swap
-__GMP_DECLSPEC void mpf_swap (mpf_ptr, mpf_ptr) __GMP_NOTHROW;
+__GMP_DECLSPEC void mpf_swap __GMP_PROTO ((mpf_ptr, mpf_ptr)) __GMP_NOTHROW;
#define mpf_trunc __gmpf_trunc
-__GMP_DECLSPEC void mpf_trunc (mpf_ptr, mpf_srcptr);
+__GMP_DECLSPEC void mpf_trunc __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#define mpf_ui_div __gmpf_ui_div
-__GMP_DECLSPEC void mpf_ui_div (mpf_ptr, unsigned long int, mpf_srcptr);
+__GMP_DECLSPEC void mpf_ui_div __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
#define mpf_ui_sub __gmpf_ui_sub
-__GMP_DECLSPEC void mpf_ui_sub (mpf_ptr, unsigned long int, mpf_srcptr);
+__GMP_DECLSPEC void mpf_ui_sub __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
#define mpf_urandomb __gmpf_urandomb
-__GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t);
+__GMP_DECLSPEC void mpf_urandomb __GMP_PROTO ((mpf_t, gmp_randstate_t, unsigned long int));
/************ Low level positive-integer (i.e. N) routines. ************/
@@ -1461,224 +1477,139 @@ __GMP_DECLSPEC void mpf_urandomb (mpf_t, gmp_randstate_t, mp_bitcnt_t);
#define mpn_add __MPN(add)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add)
-__GMP_DECLSPEC mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC mp_limb_t mpn_add __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
#endif
#define mpn_add_1 __MPN(add_1)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_add_1)
-__GMP_DECLSPEC mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
+__GMP_DECLSPEC mp_limb_t mpn_add_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW;
#endif
#define mpn_add_n __MPN(add_n)
-__GMP_DECLSPEC mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC mp_limb_t mpn_add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
#define mpn_addmul_1 __MPN(addmul_1)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
+
+#define mpn_bdivmod __MPN(bdivmod)
+__GMP_DECLSPEC mp_limb_t mpn_bdivmod __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, unsigned long int));
#define mpn_cmp __MPN(cmp)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_cmp)
-__GMP_DECLSPEC int mpn_cmp (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpn_cmp __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#endif
#define mpn_divexact_by3(dst,src,size) \
mpn_divexact_by3c (dst, src, size, __GMP_CAST (mp_limb_t, 0))
#define mpn_divexact_by3c __MPN(divexact_by3c)
-__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_divexact_by3c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
#define mpn_divmod_1(qp,np,nsize,dlimb) \
mpn_divrem_1 (qp, __GMP_CAST (mp_size_t, 0), np, nsize, dlimb)
#define mpn_divrem __MPN(divrem)
-__GMP_DECLSPEC mp_limb_t mpn_divrem (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC mp_limb_t mpn_divrem __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
#define mpn_divrem_1 __MPN(divrem_1)
-__GMP_DECLSPEC mp_limb_t mpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_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);
+__GMP_DECLSPEC mp_limb_t mpn_divrem_2 __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
#define mpn_gcd __MPN(gcd)
-__GMP_DECLSPEC mp_size_t mpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_gcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
#define mpn_gcd_1 __MPN(gcd_1)
-__GMP_DECLSPEC mp_limb_t mpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_gcd_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
#define mpn_gcdext_1 __MPN(gcdext_1)
-__GMP_DECLSPEC mp_limb_t mpn_gcdext_1 (mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_gcdext_1 __GMP_PROTO ((mp_limb_signed_t *, mp_limb_signed_t *, mp_limb_t, mp_limb_t));
#define mpn_gcdext __MPN(gcdext)
-__GMP_DECLSPEC mp_size_t mpn_gcdext (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_gcdext __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
#define mpn_get_str __MPN(get_str)
-__GMP_DECLSPEC size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
+__GMP_DECLSPEC size_t mpn_get_str __GMP_PROTO ((unsigned char *, int, mp_ptr, mp_size_t));
#define mpn_hamdist __MPN(hamdist)
-__GMP_DECLSPEC mp_bitcnt_t mpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpn_hamdist __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpn_lshift __MPN(lshift)
-__GMP_DECLSPEC mp_limb_t mpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+__GMP_DECLSPEC mp_limb_t mpn_lshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
#define mpn_mod_1 __MPN(mod_1)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
#define mpn_mul __MPN(mul)
-__GMP_DECLSPEC mp_limb_t mpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC mp_limb_t mpn_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
#define mpn_mul_1 __MPN(mul_1)
-__GMP_DECLSPEC mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_mul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
#define mpn_mul_n __MPN(mul_n)
-__GMP_DECLSPEC void mpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC void mpn_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
#define mpn_sqr __MPN(sqr)
-__GMP_DECLSPEC void mpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
-
-#define mpn_neg __MPN(neg)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg)
-__GMP_DECLSPEC mp_limb_t mpn_neg (mp_ptr, mp_srcptr, mp_size_t);
-#endif
+__GMP_DECLSPEC void mpn_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
-#define mpn_com __MPN(com)
-#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_com)
-__GMP_DECLSPEC void mpn_com (mp_ptr, mp_srcptr, mp_size_t);
+#define mpn_neg_n __MPN(neg_n)
+#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_neg_n)
+__GMP_DECLSPEC mp_limb_t mpn_neg_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
#endif
#define mpn_perfect_square_p __MPN(perfect_square_p)
-__GMP_DECLSPEC int mpn_perfect_square_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-#define mpn_perfect_power_p __MPN(perfect_power_p)
-__GMP_DECLSPEC int mpn_perfect_power_p (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC int mpn_perfect_square_p __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
#define mpn_popcount __MPN(popcount)
-__GMP_DECLSPEC mp_bitcnt_t mpn_popcount (mp_srcptr, mp_size_t) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpn_popcount __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_NOTHROW __GMP_ATTRIBUTE_PURE;
#define mpn_pow_1 __MPN(pow_1)
-__GMP_DECLSPEC mp_size_t mpn_pow_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
+__GMP_DECLSPEC mp_size_t mpn_pow_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr));
/* undocumented now, but retained here for upward compatibility */
#define mpn_preinv_mod_1 __MPN(preinv_mod_1)
-__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_preinv_mod_1 __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
#define mpn_random __MPN(random)
-__GMP_DECLSPEC void mpn_random (mp_ptr, mp_size_t);
+__GMP_DECLSPEC void mpn_random __GMP_PROTO ((mp_ptr, mp_size_t));
#define mpn_random2 __MPN(random2)
-__GMP_DECLSPEC void mpn_random2 (mp_ptr, mp_size_t);
+__GMP_DECLSPEC void mpn_random2 __GMP_PROTO ((mp_ptr, mp_size_t));
#define mpn_rshift __MPN(rshift)
-__GMP_DECLSPEC mp_limb_t mpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
+__GMP_DECLSPEC mp_limb_t mpn_rshift __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
#define mpn_scan0 __MPN(scan0)
-__GMP_DECLSPEC mp_bitcnt_t mpn_scan0 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpn_scan0 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
#define mpn_scan1 __MPN(scan1)
-__GMP_DECLSPEC mp_bitcnt_t mpn_scan1 (mp_srcptr, mp_bitcnt_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC unsigned long int mpn_scan1 __GMP_PROTO ((mp_srcptr, unsigned long int)) __GMP_ATTRIBUTE_PURE;
#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);
+__GMP_DECLSPEC mp_size_t mpn_set_str __GMP_PROTO ((mp_ptr, __gmp_const unsigned char *, size_t, int));
#define mpn_sqrtrem __MPN(sqrtrem)
-__GMP_DECLSPEC mp_size_t mpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC mp_size_t mpn_sqrtrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
#define mpn_sub __MPN(sub)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub)
-__GMP_DECLSPEC mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC mp_limb_t mpn_sub __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr,mp_size_t));
#endif
#define mpn_sub_1 __MPN(sub_1)
#if __GMP_INLINE_PROTOTYPES || defined (__GMP_FORCE_mpn_sub_1)
-__GMP_DECLSPEC mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t) __GMP_NOTHROW;
+__GMP_DECLSPEC mp_limb_t mpn_sub_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)) __GMP_NOTHROW;
#endif
#define mpn_sub_n __MPN(sub_n)
-__GMP_DECLSPEC mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC mp_limb_t mpn_sub_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
#define mpn_submul_1 __MPN(submul_1)
-__GMP_DECLSPEC mp_limb_t mpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_submul_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
#define mpn_tdiv_qr __MPN(tdiv_qr)
-__GMP_DECLSPEC void mpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-#define mpn_and_n __MPN(and_n)
-__GMP_DECLSPEC void mpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_andn_n __MPN(andn_n)
-__GMP_DECLSPEC void mpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_nand_n __MPN(nand_n)
-__GMP_DECLSPEC void mpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_ior_n __MPN(ior_n)
-__GMP_DECLSPEC void mpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_iorn_n __MPN(iorn_n)
-__GMP_DECLSPEC void mpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_nior_n __MPN(nior_n)
-__GMP_DECLSPEC void mpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_xor_n __MPN(xor_n)
-__GMP_DECLSPEC void mpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_xnor_n __MPN(xnor_n)
-__GMP_DECLSPEC void mpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_copyi __MPN(copyi)
-__GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
-#define mpn_copyd __MPN(copyd)
-__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;
+__GMP_DECLSPEC void mpn_tdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
/**************** mpz inlines ****************/
@@ -1827,11 +1758,11 @@ mpz_perfect_square_p (mpz_srcptr __gmp_a)
#if ! defined (__GMP_FORCE_mpz_popcount)
__GMP_EXTERN_INLINE
#endif
-mp_bitcnt_t
+unsigned long
mpz_popcount (mpz_srcptr __gmp_u) __GMP_NOTHROW
{
mp_size_t __gmp_usize;
- mp_bitcnt_t __gmp_result;
+ unsigned long __gmp_result;
__gmp_usize = __gmp_u->_mp_size;
__gmp_result = (__gmp_usize < 0 ? __GMP_ULONG_MAX : 0);
@@ -2183,12 +2114,12 @@ mpn_sub_1 (mp_ptr __gmp_dst, mp_srcptr __gmp_src, mp_size_t __gmp_size, mp_limb_
}
#endif
-#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg)
-#if ! defined (__GMP_FORCE_mpn_neg)
+#if defined (__GMP_EXTERN_INLINE) || defined (__GMP_FORCE_mpn_neg_n)
+#if ! defined (__GMP_FORCE_mpn_neg_n)
__GMP_EXTERN_INLINE
#endif
mp_limb_t
-mpn_neg (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
+mpn_neg_n (mp_ptr __gmp_rp, mp_srcptr __gmp_up, mp_size_t __gmp_n)
{
mp_limb_t __gmp_ul, __gmp_cy;
__gmp_cy = 0;
@@ -2216,18 +2147,17 @@ 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) >= 0) && (SI) >= 0 \
- ? mpz_cmp_ui (Z, __GMP_CAST (unsigned long, SI)) \
+#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)) \
: _mpz_cmp_si (Z,SI))
-#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) \
+#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) \
: _mpq_cmp_si (q, n, d))
#else
#define mpz_cmp_ui(Z,UI) _mpz_cmp_ui (Z,UI)
@@ -2292,10 +2222,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 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 __GNU_MP_VERSION 4
+#define __GNU_MP_VERSION_MINOR 3
+#define __GNU_MP_VERSION_PATCHLEVEL 2
#define __GMP_H__
#endif /* __GMP_H__ */
diff --git a/gmp/gmp-impl.h b/gmp/gmp-impl.h
index dc4e084a72..215fccf3c9 100644
--- a/gmp/gmp-impl.h
+++ b/gmp/gmp-impl.h
@@ -3,33 +3,23 @@
THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND ARE ALMOST CERTAIN TO
BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE GNU MP RELEASES.
-Copyright 1991, 1993-1997, 1999-2014 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
+2004, 2005, 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* __GMP_DECLSPEC must be given on any global data that will be accessed
@@ -47,9 +37,9 @@ see https://www.gnu.org/licenses/. */
#include <intrinsics.h> /* for _popcnt */
#endif
-/* 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.
+/* 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).
On Cray vector systems, however, we need the system limits.h since sizes
of signed and unsigned types can differ there, depending on compiler
@@ -57,94 +47,59 @@ see https://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
- declared this way are only used to set function pointers in __gmpn_cpuvec,
+ declared this way are only used to set function pointers in __gmp_cpuvec,
they're not called directly. */
#define DECL_add_n(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
-#define DECL_addlsh1_n(name) \
- DECL_add_n (name)
-#define DECL_addlsh2_n(name) \
- DECL_add_n (name)
+ mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t))
#define DECL_addmul_1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)
-#define DECL_addmul_2(name) \
- __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)
+ mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t))
#define DECL_copyd(name) \
- __GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t)
+ void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t))
#define DECL_copyi(name) \
DECL_copyd (name)
#define DECL_divexact_1(name) \
- __GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)
+ mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t))
#define DECL_divexact_by3c(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)
+ mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t))
#define DECL_divrem_1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t)
+ mp_limb_t name __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t))
#define DECL_gcd_1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t)
+ mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t))
#define DECL_lshift(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_srcptr, mp_size_t, unsigned)
-#define DECL_lshiftc(name) \
- DECL_lshift (name)
+ mp_limb_t name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned))
#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, 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) \
- DECL_mod_1_1p (name)
-#define DECL_mod_1s_2p_cps(name) \
- DECL_mod_1_1p_cps (name)
-#define DECL_mod_1s_4p(name) \
- DECL_mod_1_1p (name)
-#define DECL_mod_1s_4p_cps(name) \
- DECL_mod_1_1p_cps (name)
+ mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t))
#define DECL_mod_34lsub1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t)
+ mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t))
#define DECL_modexact_1c_odd(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)
+ mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t))
#define DECL_mul_1(name) \
DECL_addmul_1 (name)
#define DECL_mul_basecase(name) \
- __GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)
-#define DECL_mullo_basecase(name) \
- __GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t)
+ void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t))
#define DECL_preinv_divrem_1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int)
+ mp_limb_t name __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int))
#define DECL_preinv_mod_1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)
-#define DECL_redc_1(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t)
-#define DECL_redc_2(name) \
- __GMP_DECLSPEC mp_limb_t name (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr)
+ mp_limb_t name __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t))
#define DECL_rshift(name) \
DECL_lshift (name)
#define DECL_sqr_basecase(name) \
- __GMP_DECLSPEC void name (mp_ptr, mp_srcptr, mp_size_t)
+ void name __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t))
#define DECL_sub_n(name) \
DECL_add_n (name)
-#define DECL_sublsh1_n(name) \
- DECL_add_n (name)
#define DECL_submul_1(name) \
DECL_addmul_1 (name)
-#if ! defined (__GMP_WITHIN_CONFIGURE)
+#if ! __GMP_WITHIN_CONFIGURE
#include "config.h"
#include "gmp-mparam.h"
#include "fib_table.h"
-#include "fac_table.h"
#include "mp_bases.h"
#if WANT_FAT_BINARY
#include "fat.h"
@@ -217,11 +172,11 @@ see https://www.gnu.org/licenses/. */
/* if not provided by gmp-mparam.h */
-#ifndef GMP_LIMB_BYTES
-#define GMP_LIMB_BYTES SIZEOF_MP_LIMB_T
+#ifndef BYTES_PER_MP_LIMB
+#define BYTES_PER_MP_LIMB SIZEOF_MP_LIMB_T
#endif
-#ifndef GMP_LIMB_BITS
-#define GMP_LIMB_BITS (8 * SIZEOF_MP_LIMB_T)
+#ifndef BITS_PER_MP_LIMB
+#define BITS_PER_MP_LIMB (8 * SIZEOF_MP_LIMB_T)
#endif
#define BITS_PER_ULONG (8 * SIZEOF_UNSIGNED_LONG)
@@ -243,19 +198,13 @@ typedef unsigned long gmp_uint_least32_t;
#endif
-/* gmp_intptr_t, for pointer to integer casts */
-#if HAVE_INTPTR_T
-typedef intptr_t gmp_intptr_t;
-#else /* fallback */
-typedef size_t gmp_intptr_t;
+/* const and signed must match __gmp_const and __gmp_signed, so follow the
+ decision made for those in gmp.h. */
+#if ! __GMP_HAVE_CONST
+#define const /* empty */
+#define signed /* empty */
#endif
-
-/* pre-inverse types for truncating division and modulo */
-typedef struct {mp_limb_t inv32;} gmp_pi1_t;
-typedef struct {mp_limb_t inv21, inv32, inv53;} gmp_pi2_t;
-
-
/* "const" basically means a function does nothing but examine its arguments
and give a return value, it doesn't read or write any memory (neither
global nor pointed to by arguments), and has no other side-effects. This
@@ -288,13 +237,13 @@ typedef struct {mp_limb_t inv21, inv32, inv53;} gmp_pi2_t;
#endif
#if ! HAVE_MEMSET
-#define memset(p, c, n) \
- do { \
- ASSERT ((n) >= 0); \
- char *__memset__p = (p); \
- int __i; \
- for (__i = 0; __i < (n); __i++) \
- __memset__p[__i] = (c); \
+#define memset(p, c, n) \
+ do { \
+ ASSERT ((n) >= 0); \
+ char *__memset__p = (p); \
+ int __i; \
+ for (__i = 0; __i < (n); __i++) \
+ __memset__p[__i] = (c); \
} while (0)
#endif
@@ -324,9 +273,9 @@ extern "C" {
/* Usage: TMP_DECL;
- TMP_MARK;
- ptr = TMP_ALLOC (bytes);
- TMP_FREE;
+ TMP_MARK;
+ ptr = TMP_ALLOC (bytes);
+ TMP_FREE;
Small allocations should use TMP_SALLOC, big allocations should use
TMP_BALLOC. Allocations that might be small or big should use TMP_ALLOC.
@@ -363,8 +312,8 @@ struct tmp_reentrant_t {
struct tmp_reentrant_t *next;
size_t size; /* bytes, including header */
};
-__GMP_DECLSPEC void *__gmp_tmp_reentrant_alloc (struct tmp_reentrant_t **, size_t) ATTRIBUTE_MALLOC;
-__GMP_DECLSPEC void __gmp_tmp_reentrant_free (struct tmp_reentrant_t *);
+void *__gmp_tmp_reentrant_alloc __GMP_PROTO ((struct tmp_reentrant_t **, size_t)) ATTRIBUTE_MALLOC;
+void __gmp_tmp_reentrant_free __GMP_PROTO ((struct tmp_reentrant_t *));
#endif
#if WANT_TMP_ALLOCA
@@ -377,10 +326,9 @@ __GMP_DECLSPEC void __gmp_tmp_reentrant_free (struct tmp_reentrant_t *);
#define TMP_ALLOC(n) \
(LIKELY ((n) < 65536) ? TMP_SALLOC(n) : TMP_BALLOC(n))
#define TMP_SFREE
-#define TMP_FREE \
- do { \
- if (UNLIKELY (__tmp_marker != 0)) \
- __gmp_tmp_reentrant_free (__tmp_marker); \
+#define TMP_FREE \
+ do { \
+ if (UNLIKELY (__tmp_marker != 0)) __gmp_tmp_reentrant_free (__tmp_marker); \
} while (0)
#endif
@@ -402,9 +350,9 @@ struct tmp_marker
struct tmp_stack *which_chunk;
void *alloc_point;
};
-__GMP_DECLSPEC void *__gmp_tmp_alloc (unsigned long) ATTRIBUTE_MALLOC;
-__GMP_DECLSPEC void __gmp_tmp_mark (struct tmp_marker *);
-__GMP_DECLSPEC void __gmp_tmp_free (struct tmp_marker *);
+void *__gmp_tmp_alloc __GMP_PROTO ((unsigned long)) ATTRIBUTE_MALLOC;
+void __gmp_tmp_mark __GMP_PROTO ((struct tmp_marker *));
+void __gmp_tmp_free __GMP_PROTO ((struct tmp_marker *));
#define TMP_SDECL TMP_DECL
#define TMP_DECL struct tmp_marker __tmp_marker
#define TMP_SMARK TMP_MARK
@@ -429,15 +377,15 @@ struct tmp_debug_entry_t {
char *block;
size_t size;
};
-__GMP_DECLSPEC void __gmp_tmp_debug_mark (const char *, int, struct tmp_debug_t **,
- struct tmp_debug_t *,
- const char *, const char *);
-__GMP_DECLSPEC void *__gmp_tmp_debug_alloc (const char *, int, int,
- struct tmp_debug_t **, const char *,
- size_t) ATTRIBUTE_MALLOC;
-__GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
- struct tmp_debug_t **,
- const char *, const char *);
+void __gmp_tmp_debug_mark __GMP_PROTO ((const char *, int, struct tmp_debug_t **,
+ struct tmp_debug_t *,
+ const char *, const char *));
+void *__gmp_tmp_debug_alloc __GMP_PROTO ((const char *, int, int,
+ struct tmp_debug_t **, const char *,
+ size_t)) ATTRIBUTE_MALLOC;
+void __gmp_tmp_debug_free __GMP_PROTO ((const char *, int, int,
+ struct tmp_debug_t **,
+ const char *, const char *));
#define TMP_SDECL TMP_DECL_NAME(__tmp_xmarker, "__tmp_marker")
#define TMP_DECL TMP_DECL_NAME(__tmp_xmarker, "__tmp_marker")
#define TMP_SMARK TMP_MARK_NAME(__tmp_xmarker, "__tmp_marker")
@@ -448,32 +396,32 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
warning from the compiler if TMP_FREE is used without a TMP_MARK.
__tmp_marker_inscope does the same for TMP_ALLOC. Runtime tests pick
these things up too. */
-#define TMP_DECL_NAME(marker, marker_name) \
- int marker; \
- int __tmp_marker_inscope; \
- const char *__tmp_marker_name = marker_name; \
- struct tmp_debug_t __tmp_marker_struct; \
- /* don't demand NULL, just cast a zero */ \
+#define TMP_DECL_NAME(marker, marker_name) \
+ int marker; \
+ int __tmp_marker_inscope; \
+ const char *__tmp_marker_name = marker_name; \
+ struct tmp_debug_t __tmp_marker_struct; \
+ /* don't demand NULL, just cast a zero */ \
struct tmp_debug_t *__tmp_marker = (struct tmp_debug_t *) 0
-#define TMP_MARK_NAME(marker, marker_name) \
- do { \
- marker = 1; \
- __tmp_marker_inscope = 1; \
- __gmp_tmp_debug_mark (ASSERT_FILE, ASSERT_LINE, \
- &__tmp_marker, &__tmp_marker_struct, \
- __tmp_marker_name, marker_name); \
+#define TMP_MARK_NAME(marker, marker_name) \
+ do { \
+ marker = 1; \
+ __tmp_marker_inscope = 1; \
+ __gmp_tmp_debug_mark (ASSERT_FILE, ASSERT_LINE, \
+ &__tmp_marker, &__tmp_marker_struct, \
+ __tmp_marker_name, marker_name); \
} while (0)
#define TMP_SALLOC(n) TMP_ALLOC(n)
#define TMP_BALLOC(n) TMP_ALLOC(n)
-#define TMP_ALLOC(size) \
- __gmp_tmp_debug_alloc (ASSERT_FILE, ASSERT_LINE, \
- __tmp_marker_inscope, \
- &__tmp_marker, __tmp_marker_name, size)
-#define TMP_FREE_NAME(marker, marker_name) \
- do { \
- __gmp_tmp_debug_free (ASSERT_FILE, ASSERT_LINE, \
- marker, &__tmp_marker, \
- __tmp_marker_name, marker_name); \
+#define TMP_ALLOC(size) \
+ __gmp_tmp_debug_alloc (ASSERT_FILE, ASSERT_LINE, \
+ __tmp_marker_inscope, \
+ &__tmp_marker, __tmp_marker_name, size)
+#define TMP_FREE_NAME(marker, marker_name) \
+ do { \
+ __gmp_tmp_debug_free (ASSERT_FILE, ASSERT_LINE, \
+ marker, &__tmp_marker, \
+ __tmp_marker_name, marker_name); \
} while (0)
#endif /* WANT_TMP_DEBUG */
@@ -494,18 +442,18 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
involves copying a chunk of stack (various RISCs), or a call to a stack
bounds check (mingw). In any case, when debugging keep separate blocks
so a redzoning malloc debugger can protect each individually. */
-#define TMP_ALLOC_LIMBS_2(xp,xsize, yp,ysize) \
- do { \
- if (WANT_TMP_DEBUG) \
- { \
- (xp) = TMP_ALLOC_LIMBS (xsize); \
- (yp) = TMP_ALLOC_LIMBS (ysize); \
- } \
- else \
- { \
- (xp) = TMP_ALLOC_LIMBS ((xsize) + (ysize)); \
- (yp) = (xp) + (xsize); \
- } \
+#define TMP_ALLOC_LIMBS_2(xp,xsize, yp,ysize) \
+ do { \
+ if (WANT_TMP_DEBUG) \
+ { \
+ (xp) = TMP_ALLOC_LIMBS (xsize); \
+ (yp) = TMP_ALLOC_LIMBS (ysize); \
+ } \
+ else \
+ { \
+ (xp) = TMP_ALLOC_LIMBS ((xsize) + (ysize)); \
+ (yp) = (xp) + (xsize); \
+ } \
} while (0)
@@ -516,8 +464,6 @@ __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 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
@@ -528,33 +474,23 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
#define SIZ(x) ((x)->_mp_size)
#define ABSIZ(x) ABS (SIZ (x))
#define PTR(x) ((x)->_mp_d)
+#define LIMBS(x) ((x)->_mp_d)
#define EXP(x) ((x)->_mp_exp)
#define PREC(x) ((x)->_mp_prec)
#define ALLOC(x) ((x)->_mp_alloc)
-#define NUM(x) mpq_numref(x)
-#define DEN(x) mpq_denref(x)
/* n-1 inverts any low zeros and the lowest one bit. If n&(n-1) leaves zero
then that lowest one bit must have been the only bit set. n==0 will
return true though, so avoid that. */
#define POW2_P(n) (((n) & ((n) - 1)) == 0)
-/* This is intended for constant THRESHOLDs only, where the compiler
- can completely fold the result. */
-#define LOG2C(n) \
- (((n) >= 0x1) + ((n) >= 0x2) + ((n) >= 0x4) + ((n) >= 0x8) + \
- ((n) >= 0x10) + ((n) >= 0x20) + ((n) >= 0x40) + ((n) >= 0x80) + \
- ((n) >= 0x100) + ((n) >= 0x200) + ((n) >= 0x400) + ((n) >= 0x800) + \
- ((n) >= 0x1000) + ((n) >= 0x2000) + ((n) >= 0x4000) + ((n) >= 0x8000))
/* The "short" defines are a bit different because shorts are promoted to
ints by ~ or >> etc.
#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.
-
- Now that we include <limits.h> we should be able to remove all this. */
+ there seems no need to worry about that. */
#ifndef ULONG_MAX
#define ULONG_MAX __GMP_ULONG_MAX
@@ -572,7 +508,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 (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1))
+#define USHRT_HIGHBIT ((unsigned short) (USHRT_MAX ^ ((unsigned short) USHRT_MAX >> 1)))
#define GMP_LIMB_HIGHBIT (MP_LIMB_T_MAX ^ (MP_LIMB_T_MAX >> 1))
#ifndef LONG_MIN
@@ -590,10 +526,10 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
#endif
#ifndef SHRT_MIN
-#define SHRT_MIN ((int) (short) USHRT_HIGHBIT)
+#define SHRT_MIN ((short) USHRT_HIGHBIT)
#endif
#ifndef SHRT_MAX
-#define SHRT_MAX (-(SHRT_MIN+1))
+#define SHRT_MAX ((short) (-(SHRT_MIN+1)))
#endif
#if __GMP_MP_SIZE_T_INT
@@ -625,21 +561,31 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
/* Set various *_THRESHOLD values to be used for nails. Thus we avoid using
code that has not yet been qualified. */
-#undef DC_DIV_QR_THRESHOLD
-#define DC_DIV_QR_THRESHOLD 50
+#undef DIV_SB_PREINV_THRESHOLD
+#undef DIV_DC_THRESHOLD
+#undef POWM_THRESHOLD
+#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX
+#define DIV_DC_THRESHOLD 50
+#define POWM_THRESHOLD 0
+
+#undef GCD_ACCEL_THRESHOLD
+#define GCD_ACCEL_THRESHOLD 3
#undef DIVREM_1_NORM_THRESHOLD
#undef DIVREM_1_UNNORM_THRESHOLD
#undef MOD_1_NORM_THRESHOLD
#undef MOD_1_UNNORM_THRESHOLD
#undef USE_PREINV_DIVREM_1
+#undef USE_PREINV_MOD_1
#undef DIVREM_2_THRESHOLD
#undef DIVEXACT_1_THRESHOLD
+#undef MODEXACT_1_ODD_THRESHOLD
#define DIVREM_1_NORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */
#define DIVREM_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */
#define MOD_1_NORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */
#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* no preinv */
#define USE_PREINV_DIVREM_1 0 /* no preinv */
+#define USE_PREINV_MOD_1 0 /* no preinv */
#define DIVREM_2_THRESHOLD MP_SIZE_T_MAX /* no preinv */
/* mpn/generic/mul_fft.c is not nails-capable. */
@@ -651,91 +597,91 @@ __GMP_DECLSPEC void __gmp_tmp_debug_free (const char *, int, int,
/* Swap macros. */
-#define MP_LIMB_T_SWAP(x, y) \
- do { \
- mp_limb_t __mp_limb_t_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_limb_t_swap__tmp; \
+#define MP_LIMB_T_SWAP(x, y) \
+ do { \
+ mp_limb_t __mp_limb_t_swap__tmp = (x); \
+ (x) = (y); \
+ (y) = __mp_limb_t_swap__tmp; \
} while (0)
-#define MP_SIZE_T_SWAP(x, y) \
- do { \
- mp_size_t __mp_size_t_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_size_t_swap__tmp; \
+#define MP_SIZE_T_SWAP(x, y) \
+ do { \
+ mp_size_t __mp_size_t_swap__tmp = (x); \
+ (x) = (y); \
+ (y) = __mp_size_t_swap__tmp; \
} while (0)
-#define MP_PTR_SWAP(x, y) \
- do { \
- mp_ptr __mp_ptr_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_ptr_swap__tmp; \
+#define MP_PTR_SWAP(x, y) \
+ do { \
+ mp_ptr __mp_ptr_swap__tmp = (x); \
+ (x) = (y); \
+ (y) = __mp_ptr_swap__tmp; \
} while (0)
-#define MP_SRCPTR_SWAP(x, y) \
- do { \
- mp_srcptr __mp_srcptr_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_srcptr_swap__tmp; \
+#define MP_SRCPTR_SWAP(x, y) \
+ do { \
+ mp_srcptr __mp_srcptr_swap__tmp = (x); \
+ (x) = (y); \
+ (y) = __mp_srcptr_swap__tmp; \
} while (0)
-#define MPN_PTR_SWAP(xp,xs, yp,ys) \
- do { \
- MP_PTR_SWAP (xp, yp); \
- MP_SIZE_T_SWAP (xs, ys); \
+#define MPN_PTR_SWAP(xp,xs, yp,ys) \
+ do { \
+ MP_PTR_SWAP (xp, yp); \
+ MP_SIZE_T_SWAP (xs, ys); \
} while(0)
-#define MPN_SRCPTR_SWAP(xp,xs, yp,ys) \
- do { \
- MP_SRCPTR_SWAP (xp, yp); \
- MP_SIZE_T_SWAP (xs, ys); \
+#define MPN_SRCPTR_SWAP(xp,xs, yp,ys) \
+ do { \
+ MP_SRCPTR_SWAP (xp, yp); \
+ MP_SIZE_T_SWAP (xs, ys); \
} while(0)
-#define MPZ_PTR_SWAP(x, y) \
- do { \
- mpz_ptr __mpz_ptr_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mpz_ptr_swap__tmp; \
+#define MPZ_PTR_SWAP(x, y) \
+ do { \
+ mpz_ptr __mpz_ptr_swap__tmp = (x); \
+ (x) = (y); \
+ (y) = __mpz_ptr_swap__tmp; \
} while (0)
-#define MPZ_SRCPTR_SWAP(x, y) \
- do { \
- mpz_srcptr __mpz_srcptr_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mpz_srcptr_swap__tmp; \
+#define MPZ_SRCPTR_SWAP(x, y) \
+ do { \
+ mpz_srcptr __mpz_srcptr_swap__tmp = (x); \
+ (x) = (y); \
+ (y) = __mpz_srcptr_swap__tmp; \
} while (0)
/* Enhancement: __gmp_allocate_func could have "__attribute__ ((malloc))",
but current gcc (3.0) doesn't seem to support that. */
-__GMP_DECLSPEC extern void * (*__gmp_allocate_func) (size_t);
-__GMP_DECLSPEC extern void * (*__gmp_reallocate_func) (void *, size_t, size_t);
-__GMP_DECLSPEC extern void (*__gmp_free_func) (void *, size_t);
+__GMP_DECLSPEC extern void * (*__gmp_allocate_func) __GMP_PROTO ((size_t));
+__GMP_DECLSPEC extern void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t));
+__GMP_DECLSPEC extern void (*__gmp_free_func) __GMP_PROTO ((void *, size_t));
-__GMP_DECLSPEC void *__gmp_default_allocate (size_t);
-__GMP_DECLSPEC void *__gmp_default_reallocate (void *, size_t, size_t);
-__GMP_DECLSPEC void __gmp_default_free (void *, size_t);
+void *__gmp_default_allocate __GMP_PROTO ((size_t));
+void *__gmp_default_reallocate __GMP_PROTO ((void *, size_t, size_t));
+void __gmp_default_free __GMP_PROTO ((void *, size_t));
#define __GMP_ALLOCATE_FUNC_TYPE(n,type) \
((type *) (*__gmp_allocate_func) ((n) * sizeof (type)))
#define __GMP_ALLOCATE_FUNC_LIMBS(n) __GMP_ALLOCATE_FUNC_TYPE (n, mp_limb_t)
-#define __GMP_REALLOCATE_FUNC_TYPE(p, old_size, new_size, type) \
- ((type *) (*__gmp_reallocate_func) \
+#define __GMP_REALLOCATE_FUNC_TYPE(p, old_size, new_size, type) \
+ ((type *) (*__gmp_reallocate_func) \
(p, (old_size) * sizeof (type), (new_size) * sizeof (type)))
-#define __GMP_REALLOCATE_FUNC_LIMBS(p, old_size, new_size) \
+#define __GMP_REALLOCATE_FUNC_LIMBS(p, old_size, new_size) \
__GMP_REALLOCATE_FUNC_TYPE(p, old_size, new_size, mp_limb_t)
#define __GMP_FREE_FUNC_TYPE(p,n,type) (*__gmp_free_func) (p, (n) * sizeof (type))
#define __GMP_FREE_FUNC_LIMBS(p,n) __GMP_FREE_FUNC_TYPE (p, n, mp_limb_t)
-#define __GMP_REALLOCATE_FUNC_MAYBE(ptr, oldsize, newsize) \
- do { \
- if ((oldsize) != (newsize)) \
- (ptr) = (*__gmp_reallocate_func) (ptr, oldsize, newsize); \
+#define __GMP_REALLOCATE_FUNC_MAYBE(ptr, oldsize, newsize) \
+ do { \
+ if ((oldsize) != (newsize)) \
+ (ptr) = (*__gmp_reallocate_func) (ptr, oldsize, newsize); \
} while (0)
-#define __GMP_REALLOCATE_FUNC_MAYBE_TYPE(ptr, oldsize, newsize, type) \
- do { \
- if ((oldsize) != (newsize)) \
- (ptr) = (type *) (*__gmp_reallocate_func) \
- (ptr, (oldsize) * sizeof (type), (newsize) * sizeof (type)); \
+#define __GMP_REALLOCATE_FUNC_MAYBE_TYPE(ptr, oldsize, newsize, type) \
+ do { \
+ if ((oldsize) != (newsize)) \
+ (ptr) = (type *) (*__gmp_reallocate_func) \
+ (ptr, (oldsize) * sizeof (type), (newsize) * sizeof (type)); \
} while (0)
@@ -811,402 +757,163 @@ __GMP_DECLSPEC void __gmp_default_free (void *, size_t);
#endif
-__GMP_DECLSPEC void __gmpz_aorsmul_1 (REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_limb_t, mp_size_t)) REGPARM_ATTR(1);
+void __gmpz_aorsmul_1 __GMP_PROTO ((REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_limb_t, mp_size_t))) REGPARM_ATTR(1);
#define mpz_aorsmul_1(w,u,v,sub) __gmpz_aorsmul_1 (REGPARM_3_1 (w, u, v, sub))
#define mpz_n_pow_ui __gmpz_n_pow_ui
-__GMP_DECLSPEC void mpz_n_pow_ui (mpz_ptr, mp_srcptr, mp_size_t, unsigned long);
+void mpz_n_pow_ui __GMP_PROTO ((mpz_ptr, mp_srcptr, mp_size_t, unsigned long));
#define mpn_addmul_1c __MPN(addmul_1c)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
-#ifndef mpn_addmul_2 /* if not done with cpuvec in a fat binary */
#define mpn_addmul_2 __MPN(addmul_2)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_2 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-#endif
+__GMP_DECLSPEC mp_limb_t mpn_addmul_2 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_addmul_3 __MPN(addmul_3)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_3 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_3 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_addmul_4 __MPN(addmul_4)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_4 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_4 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_addmul_5 __MPN(addmul_5)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_5 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_5 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_addmul_6 __MPN(addmul_6)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_6 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_6 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_addmul_7 __MPN(addmul_7)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_7 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_7 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_addmul_8 __MPN(addmul_8)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_8 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-
-/* Alternative entry point in mpn_addmul_2 for the benefit of mpn_sqr_basecase. */
-#define mpn_addmul_2s __MPN(addmul_2s)
-__GMP_DECLSPEC mp_limb_t mpn_addmul_2s (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_addmul_8 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
/* mpn_addlsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+2*{b,n}, and
- returns the carry out (0, 1 or 2). Use _ip1 when a=c. */
-#ifndef mpn_addlsh1_n /* if not done with cpuvec in a fat binary */
+ returns the carry out (0, 1 or 2). */
#define mpn_addlsh1_n __MPN(addlsh1_n)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#endif
-#define mpn_addlsh1_nc __MPN(addlsh1_nc)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_addlsh1_n && ! HAVE_NATIVE_mpn_addlsh1_n_ip1
-#define mpn_addlsh1_n_ip1(dst,src,n) mpn_addlsh1_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_addlsh1_n_ip1 1
-#else
-#define mpn_addlsh1_n_ip1 __MPN(addlsh1_n_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-#endif
-#if HAVE_NATIVE_mpn_addlsh1_nc && ! HAVE_NATIVE_mpn_addlsh1_nc_ip1
-#define mpn_addlsh1_nc_ip1(dst,src,n,c) mpn_addlsh1_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_addlsh1_nc_ip1 1
-#else
-#define mpn_addlsh1_nc_ip1 __MPN(addlsh1_nc_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh1_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-#endif
-
-#ifndef mpn_addlsh2_n /* if not done with cpuvec in a fat binary */
-/* mpn_addlsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}+4*{b,n}, and
- returns the carry out (0, ..., 4). Use _ip1 when a=c. */
-#define mpn_addlsh2_n __MPN(addlsh2_n)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#endif
-#define mpn_addlsh2_nc __MPN(addlsh2_nc)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_addlsh2_n && ! HAVE_NATIVE_mpn_addlsh2_n_ip1
-#define mpn_addlsh2_n_ip1(dst,src,n) mpn_addlsh2_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_addlsh2_n_ip1 1
-#else
-#define mpn_addlsh2_n_ip1 __MPN(addlsh2_n_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_nc && ! HAVE_NATIVE_mpn_addlsh2_nc_ip1
-#define mpn_addlsh2_nc_ip1(dst,src,n,c) mpn_addlsh2_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_addlsh2_nc_ip1 1
-#else
-#define mpn_addlsh2_nc_ip1 __MPN(addlsh2_nc_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh2_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-#endif
-
-/* mpn_addlsh_n(c,a,b,n,k), when it exists, sets {c,n} to {a,n}+2^k*{b,n}, and
- returns the carry out (0, ..., 2^k). Use _ip1 when a=c. */
-#define mpn_addlsh_n __MPN(addlsh_n)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
-#define mpn_addlsh_nc __MPN(addlsh_nc)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
-#if HAVE_NATIVE_mpn_addlsh_n && ! HAVE_NATIVE_mpn_addlsh_n_ip1
-#define mpn_addlsh_n_ip1(dst,src,n,s) mpn_addlsh_n(dst,dst,src,n,s)
-#define HAVE_NATIVE_mpn_addlsh_n_ip1 1
-#else
-#define mpn_addlsh_n_ip1 __MPN(addlsh_n_ip1)
- __GMP_DECLSPEC mp_limb_t mpn_addlsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
-#endif
-#if HAVE_NATIVE_mpn_addlsh_nc && ! HAVE_NATIVE_mpn_addlsh_nc_ip1
-#define mpn_addlsh_nc_ip1(dst,src,n,s,c) mpn_addlsh_nc(dst,dst,src,n,s,c)
-#define HAVE_NATIVE_mpn_addlsh_nc_ip1 1
-#else
-#define mpn_addlsh_nc_ip1 __MPN(addlsh_nc_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_addlsh_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
-#endif
+__GMP_DECLSPEC mp_limb_t mpn_addlsh1_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-#ifndef mpn_sublsh1_n /* if not done with cpuvec in a fat binary */
/* mpn_sublsh1_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-2*{b,n}, and
- returns the borrow out (0, 1 or 2). Use _ip1 when a=c. */
+ returns the borrow out (0, 1 or 2). */
#define mpn_sublsh1_n __MPN(sublsh1_n)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#endif
-#define mpn_sublsh1_nc __MPN(sublsh1_nc)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_sublsh1_n && ! HAVE_NATIVE_mpn_sublsh1_n_ip1
-#define mpn_sublsh1_n_ip1(dst,src,n) mpn_sublsh1_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_sublsh1_n_ip1 1
-#else
-#define mpn_sublsh1_n_ip1 __MPN(sublsh1_n_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-#endif
-#if HAVE_NATIVE_mpn_sublsh1_nc && ! HAVE_NATIVE_mpn_sublsh1_nc_ip1
-#define mpn_sublsh1_nc_ip1(dst,src,n,c) mpn_sublsh1_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_sublsh1_nc_ip1 1
-#else
-#define mpn_sublsh1_nc_ip1 __MPN(sublsh1_nc_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh1_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-#endif
-
-/* mpn_rsblsh1_n(c,a,b,n), when it exists, sets {c,n} to 2*{b,n}-{a,n}, and
- returns the carry out (-1, 0, 1). */
-#define mpn_rsblsh1_n __MPN(rsblsh1_n)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_rsblsh1_nc __MPN(rsblsh1_nc)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-/* mpn_sublsh2_n(c,a,b,n), when it exists, sets {c,n} to {a,n}-4*{b,n}, and
- returns the borrow out (0, ..., 4). Use _ip1 when a=c. */
-#define mpn_sublsh2_n __MPN(sublsh2_n)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_sublsh2_nc __MPN(sublsh2_nc)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-#if HAVE_NATIVE_mpn_sublsh2_n && ! HAVE_NATIVE_mpn_sublsh2_n_ip1
-#define mpn_sublsh2_n_ip1(dst,src,n) mpn_sublsh2_n(dst,dst,src,n)
-#define HAVE_NATIVE_mpn_sublsh2_n_ip1 1
-#else
-#define mpn_sublsh2_n_ip1 __MPN(sublsh2_n_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-#endif
-#if HAVE_NATIVE_mpn_sublsh2_nc && ! HAVE_NATIVE_mpn_sublsh2_nc_ip1
-#define mpn_sublsh2_nc_ip1(dst,src,n,c) mpn_sublsh2_nc(dst,dst,src,n,c)
-#define HAVE_NATIVE_mpn_sublsh2_nc_ip1 1
-#else
-#define mpn_sublsh2_nc_ip1 __MPN(sublsh2_nc_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh2_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-#endif
-
-/* mpn_sublsh_n(c,a,b,n,k), when it exists, sets {c,n} to {a,n}-2^k*{b,n}, and
- returns the carry out (0, ..., 2^k). Use _ip1 when a=c. */
-#define mpn_sublsh_n __MPN(sublsh_n)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
-#if HAVE_NATIVE_mpn_sublsh_n && ! HAVE_NATIVE_mpn_sublsh_n_ip1
-#define mpn_sublsh_n_ip1(dst,src,n,s) mpn_sublsh_n(dst,dst,src,n,s)
-#define HAVE_NATIVE_mpn_sublsh_n_ip1 1
-#else
-#define mpn_sublsh_n_ip1 __MPN(sublsh_n_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
-#endif
-#if HAVE_NATIVE_mpn_sublsh_nc && ! HAVE_NATIVE_mpn_sublsh_nc_ip1
-#define mpn_sublsh_nc_ip1(dst,src,n,s,c) mpn_sublsh_nc(dst,dst,src,n,s,c)
-#define HAVE_NATIVE_mpn_sublsh_nc_ip1 1
-#else
-#define mpn_sublsh_nc_ip1 __MPN(sublsh_nc_ip1)
-__GMP_DECLSPEC mp_limb_t mpn_sublsh_nc_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
-#endif
-
-/* mpn_rsblsh2_n(c,a,b,n), when it exists, sets {c,n} to 4*{b,n}-{a,n}, and
- returns the carry out (-1, ..., 3). */
-#define mpn_rsblsh2_n __MPN(rsblsh2_n)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_rsblsh2_nc __MPN(rsblsh2_nc)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-/* mpn_rsblsh_n(c,a,b,n,k), when it exists, sets {c,n} to 2^k*{b,n}-{a,n}, and
- returns the carry out (-1, 0, ..., 2^k-1). */
-#define mpn_rsblsh_n __MPN(rsblsh_n)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
-#define mpn_rsblsh_nc __MPN(rsblsh_nc)
-__GMP_DECLSPEC mp_limb_signed_t mpn_rsblsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_sublsh1_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
/* mpn_rsh1add_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} + {b,n}) >> 1,
and returns the bit rshifted out (0 or 1). */
#define mpn_rsh1add_n __MPN(rsh1add_n)
-__GMP_DECLSPEC mp_limb_t mpn_rsh1add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_rsh1add_nc __MPN(rsh1add_nc)
-__GMP_DECLSPEC mp_limb_t mpn_rsh1add_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_rsh1add_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
/* mpn_rsh1sub_n(c,a,b,n), when it exists, sets {c,n} to ({a,n} - {b,n}) >> 1,
and returns the bit rshifted out (0 or 1). If there's a borrow from the
subtract, it's stored as a 1 in the high bit of c[n-1], like a twos
complement negative. */
#define mpn_rsh1sub_n __MPN(rsh1sub_n)
-__GMP_DECLSPEC mp_limb_t mpn_rsh1sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#define mpn_rsh1sub_nc __MPN(rsh1sub_nc)
-__GMP_DECLSPEC mp_limb_t mpn_rsh1sub_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_rsh1sub_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-#ifndef mpn_lshiftc /* if not done with cpuvec in a fat binary */
#define mpn_lshiftc __MPN(lshiftc)
-__GMP_DECLSPEC mp_limb_t mpn_lshiftc (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
-#endif
-
-#define mpn_add_err1_n __MPN(add_err1_n)
-__GMP_DECLSPEC mp_limb_t mpn_add_err1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_lshiftc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, unsigned int));
-#define mpn_add_err2_n __MPN(add_err2_n)
-__GMP_DECLSPEC mp_limb_t mpn_add_err2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+#define mpn_addsub_n __MPN(addsub_n)
+__GMP_DECLSPEC mp_limb_t mpn_addsub_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-#define mpn_add_err3_n __MPN(add_err3_n)
-__GMP_DECLSPEC mp_limb_t mpn_add_err3_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_sub_err1_n __MPN(sub_err1_n)
-__GMP_DECLSPEC mp_limb_t mpn_sub_err1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_sub_err2_n __MPN(sub_err2_n)
-__GMP_DECLSPEC mp_limb_t mpn_sub_err2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_sub_err3_n __MPN(sub_err3_n)
-__GMP_DECLSPEC mp_limb_t mpn_sub_err3_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_add_n_sub_n __MPN(add_n_sub_n)
-__GMP_DECLSPEC mp_limb_t mpn_add_n_sub_n (mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_add_n_sub_nc __MPN(add_n_sub_nc)
-__GMP_DECLSPEC mp_limb_t mpn_add_n_sub_nc (mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+#define mpn_addsub_nc __MPN(addsub_nc)
+__GMP_DECLSPEC mp_limb_t mpn_addsub_nc __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
#define mpn_addaddmul_1msb0 __MPN(addaddmul_1msb0)
-__GMP_DECLSPEC mp_limb_t mpn_addaddmul_1msb0 (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_addaddmul_1msb0 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
#define mpn_divrem_1c __MPN(divrem_1c)
-__GMP_DECLSPEC mp_limb_t mpn_divrem_1c (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_divrem_1c __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
#define mpn_dump __MPN(dump)
-__GMP_DECLSPEC void mpn_dump (mp_srcptr, mp_size_t);
+__GMP_DECLSPEC void mpn_dump __GMP_PROTO ((mp_srcptr, mp_size_t));
#define mpn_fib2_ui __MPN(fib2_ui)
-__GMP_DECLSPEC mp_size_t mpn_fib2_ui (mp_ptr, mp_ptr, unsigned long);
+mp_size_t mpn_fib2_ui __GMP_PROTO ((mp_ptr, mp_ptr, unsigned long));
/* Remap names of internal mpn functions. */
#define __clz_tab __MPN(clz_tab)
#define mpn_udiv_w_sdiv __MPN(udiv_w_sdiv)
#define mpn_jacobi_base __MPN(jacobi_base)
-__GMP_DECLSPEC int mpn_jacobi_base (mp_limb_t, mp_limb_t, int) ATTRIBUTE_CONST;
-
-#define mpn_jacobi_2 __MPN(jacobi_2)
-__GMP_DECLSPEC int mpn_jacobi_2 (mp_srcptr, mp_srcptr, unsigned);
-
-#define mpn_jacobi_n __MPN(jacobi_n)
-__GMP_DECLSPEC int mpn_jacobi_n (mp_ptr, mp_ptr, mp_size_t, unsigned);
+int mpn_jacobi_base __GMP_PROTO ((mp_limb_t, mp_limb_t, int)) ATTRIBUTE_CONST;
#define mpn_mod_1c __MPN(mod_1c)
-__GMP_DECLSPEC mp_limb_t mpn_mod_1c (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+__GMP_DECLSPEC mp_limb_t mpn_mod_1c __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
#define mpn_mul_1c __MPN(mul_1c)
-__GMP_DECLSPEC mp_limb_t mpn_mul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_mul_1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
#define mpn_mul_2 __MPN(mul_2)
-__GMP_DECLSPEC mp_limb_t mpn_mul_2 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+mp_limb_t mpn_mul_2 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_mul_3 __MPN(mul_3)
-__GMP_DECLSPEC mp_limb_t mpn_mul_3 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_mul_3 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#define mpn_mul_4 __MPN(mul_4)
-__GMP_DECLSPEC mp_limb_t mpn_mul_4 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-
-#define mpn_mul_5 __MPN(mul_5)
-__GMP_DECLSPEC mp_limb_t mpn_mul_5 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-
-#define mpn_mul_6 __MPN(mul_6)
-__GMP_DECLSPEC mp_limb_t mpn_mul_6 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+__GMP_DECLSPEC mp_limb_t mpn_mul_4 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
#ifndef mpn_mul_basecase /* if not done with cpuvec in a fat binary */
#define mpn_mul_basecase __MPN(mul_basecase)
-__GMP_DECLSPEC void mpn_mul_basecase (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC void mpn_mul_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
#endif
-#define mpn_mullo_n __MPN(mullo_n)
-__GMP_DECLSPEC void mpn_mullo_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+#define mpn_mullow_n __MPN(mullow_n)
+__GMP_DECLSPEC void mpn_mullow_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
-#ifndef mpn_mullo_basecase /* if not done with cpuvec in a fat binary */
-#define mpn_mullo_basecase __MPN(mullo_basecase)
-__GMP_DECLSPEC void mpn_mullo_basecase (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-#endif
+#define mpn_mullow_basecase __MPN(mullow_basecase)
+__GMP_DECLSPEC void mpn_mullow_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+
+#define mpn_sqr_n __MPN(sqr) /* compatibility */
#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);
+__GMP_DECLSPEC void mpn_sqr_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
#endif
-#define mpn_mulmid_basecase __MPN(mulmid_basecase)
-__GMP_DECLSPEC void mpn_mulmid_basecase (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-#define mpn_mulmid_n __MPN(mulmid_n)
-__GMP_DECLSPEC void mpn_mulmid_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-#define mpn_mulmid __MPN(mulmid)
-__GMP_DECLSPEC void mpn_mulmid (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
#define mpn_submul_1c __MPN(submul_1c)
-__GMP_DECLSPEC mp_limb_t mpn_submul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_submul_1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
+
+#define mpn_invert_2exp __MPN(invert_2exp)
+__GMP_DECLSPEC void mpn_invert_2exp __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
-#ifndef mpn_redc_1 /* if not done with cpuvec in a fat binary */
#define mpn_redc_1 __MPN(redc_1)
-__GMP_DECLSPEC mp_limb_t mpn_redc_1 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-#endif
+__GMP_DECLSPEC void mpn_redc_1 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);)
-#ifndef mpn_redc_2 /* if not done with cpuvec in a fat binary */
#define mpn_redc_2 __MPN(redc_2)
-__GMP_DECLSPEC mp_limb_t mpn_redc_2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-#endif
+__GMP_DECLSPEC void mpn_redc_2 __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr));
-#define mpn_redc_n __MPN(redc_n)
-__GMP_DECLSPEC void mpn_redc_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
+#define mpn_mod_1s_1p_cps __MPN(mod_1s_1p_cps)
+__GMP_DECLSPEC void mpn_mod_1s_1p_cps __GMP_PROTO ((mp_limb_t [4], mp_limb_t));
+#define mpn_mod_1s_1p __MPN(mod_1s_1p)
+__GMP_DECLSPEC mp_limb_t mpn_mod_1s_1p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [4]));
-#ifndef mpn_mod_1_1p_cps /* if not done with cpuvec in a fat binary */
-#define mpn_mod_1_1p_cps __MPN(mod_1_1p_cps)
-__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, const mp_limb_t [4]) __GMP_ATTRIBUTE_PURE;
-#endif
-
-#ifndef mpn_mod_1s_2p_cps /* if not done with cpuvec in a fat binary */
#define mpn_mod_1s_2p_cps __MPN(mod_1s_2p_cps)
-__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 */
+__GMP_DECLSPEC void mpn_mod_1s_2p_cps __GMP_PROTO ((mp_limb_t [5], mp_limb_t));
#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, const mp_limb_t [5]) __GMP_ATTRIBUTE_PURE;
-#endif
+__GMP_DECLSPEC mp_limb_t mpn_mod_1s_2p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [5]));
-#ifndef mpn_mod_1s_3p_cps /* if not done with cpuvec in a fat binary */
#define mpn_mod_1s_3p_cps __MPN(mod_1s_3p_cps)
-__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 */
+__GMP_DECLSPEC void mpn_mod_1s_3p_cps __GMP_PROTO ((mp_limb_t [6], mp_limb_t));
#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, const mp_limb_t [6]) __GMP_ATTRIBUTE_PURE;
-#endif
+__GMP_DECLSPEC mp_limb_t mpn_mod_1s_3p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [6]));
-#ifndef mpn_mod_1s_4p_cps /* if not done with cpuvec in a fat binary */
#define mpn_mod_1s_4p_cps __MPN(mod_1s_4p_cps)
-__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 */
+__GMP_DECLSPEC void mpn_mod_1s_4p_cps __GMP_PROTO ((mp_limb_t [7], mp_limb_t));
#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, const mp_limb_t [7]) __GMP_ATTRIBUTE_PURE;
-#endif
-
-#define mpn_bc_mulmod_bnm1 __MPN(bc_mulmod_bnm1)
-__GMP_DECLSPEC void mpn_bc_mulmod_bnm1 (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_mulmod_bnm1 __MPN(mulmod_bnm1)
-__GMP_DECLSPEC void mpn_mulmod_bnm1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_mulmod_bnm1_next_size __MPN(mulmod_bnm1_next_size)
-__GMP_DECLSPEC mp_size_t mpn_mulmod_bnm1_next_size (mp_size_t) ATTRIBUTE_CONST;
-static inline mp_size_t
-mpn_mulmod_bnm1_itch (mp_size_t rn, mp_size_t an, mp_size_t bn) {
- mp_size_t n, itch;
- n = rn >> 1;
- itch = rn + 4 +
- (an > n ? (bn > n ? rn : n) : 0);
- return itch;
-}
+__GMP_DECLSPEC mp_limb_t mpn_mod_1s_4p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t [7]));
-#define mpn_sqrmod_bnm1 __MPN(sqrmod_bnm1)
-__GMP_DECLSPEC void mpn_sqrmod_bnm1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_sqrmod_bnm1_next_size __MPN(sqrmod_bnm1_next_size)
-__GMP_DECLSPEC mp_size_t mpn_sqrmod_bnm1_next_size (mp_size_t) ATTRIBUTE_CONST;
-static inline mp_size_t
-mpn_sqrmod_bnm1_itch (mp_size_t rn, mp_size_t an) {
- mp_size_t n, itch;
- n = rn >> 1;
- itch = rn + 3 +
- (an > n ? an : 0);
- return itch;
-}
typedef __gmp_randstate_struct *gmp_randstate_ptr;
typedef const __gmp_randstate_struct *gmp_randstate_srcptr;
/* Pseudo-random number generator function pointers structure. */
typedef struct {
- void (*randseed_fn) (gmp_randstate_t, mpz_srcptr);
- void (*randget_fn) (gmp_randstate_t, mp_ptr, unsigned long int);
- void (*randclear_fn) (gmp_randstate_t);
- void (*randiset_fn) (gmp_randstate_ptr, gmp_randstate_srcptr);
+ void (*randseed_fn) __GMP_PROTO ((gmp_randstate_t, mpz_srcptr));
+ void (*randget_fn) __GMP_PROTO ((gmp_randstate_t, mp_ptr, unsigned long int));
+ void (*randclear_fn) __GMP_PROTO ((gmp_randstate_t));
+ void (*randiset_fn) __GMP_PROTO ((gmp_randstate_ptr, gmp_randstate_srcptr));
} gmp_randfnptr_t;
/* Macro to obtain a void pointer to the function pointers structure. */
@@ -1217,14 +924,14 @@ typedef struct {
#define RNG_STATE(rstate) ((rstate)->_mp_seed->_mp_d)
/* Write a given number of random bits to rp. */
-#define _gmp_rand(rp, state, bits) \
- do { \
- gmp_randstate_ptr __rstate = (state); \
- (*((gmp_randfnptr_t *) RNG_FNPTR (__rstate))->randget_fn) \
- (__rstate, rp, bits); \
+#define _gmp_rand(rp, state, bits) \
+ do { \
+ gmp_randstate_ptr __rstate = (state); \
+ (*((gmp_randfnptr_t *) RNG_FNPTR (__rstate))->randget_fn) \
+ (__rstate, rp, bits); \
} while (0)
-__GMP_DECLSPEC void __gmp_randinit_mt_noseed (gmp_randstate_t);
+__GMP_DECLSPEC void __gmp_randinit_mt_noseed __GMP_PROTO ((gmp_randstate_t));
/* __gmp_rands is the global state for the old-style random functions, and
@@ -1242,373 +949,306 @@ __GMP_DECLSPEC void __gmp_randinit_mt_noseed (gmp_randstate_t);
__GMP_DECLSPEC extern char __gmp_rands_initialized;
__GMP_DECLSPEC extern gmp_randstate_t __gmp_rands;
-#define RANDS \
- ((__gmp_rands_initialized ? 0 \
- : (__gmp_rands_initialized = 1, \
- __gmp_randinit_mt_noseed (__gmp_rands), 0)), \
+#define RANDS \
+ ((__gmp_rands_initialized ? 0 \
+ : (__gmp_rands_initialized = 1, \
+ __gmp_randinit_mt_noseed (__gmp_rands), 0)), \
__gmp_rands)
/* this is used by the test programs, to free memory */
-#define RANDS_CLEAR() \
- do { \
- if (__gmp_rands_initialized) \
- { \
- __gmp_rands_initialized = 0; \
- gmp_randclear (__gmp_rands); \
- } \
+#define RANDS_CLEAR() \
+ do { \
+ if (__gmp_rands_initialized) \
+ { \
+ __gmp_rands_initialized = 0; \
+ gmp_randclear (__gmp_rands); \
+ } \
} while (0)
-/* For a threshold between algorithms A and B, size>=thresh is where B
- should be used. Special value MP_SIZE_T_MAX means only ever use A, or
- value 0 means only ever use B. The tests for these special values will
- be compile-time constants, so the compiler should be able to eliminate
- the code for the unwanted algorithm. */
-
-#if ! defined (__GNUC__) || __GNUC__ < 2
-#define ABOVE_THRESHOLD(size,thresh) \
- ((thresh) == 0 \
- || ((thresh) != MP_SIZE_T_MAX \
- && (size) >= (thresh)))
-#else
-#define ABOVE_THRESHOLD(size,thresh) \
- ((__builtin_constant_p (thresh) && (thresh) == 0) \
- || (!(__builtin_constant_p (thresh) && (thresh) == MP_SIZE_T_MAX) \
- && (size) >= (thresh)))
-#endif
-#define BELOW_THRESHOLD(size,thresh) (! ABOVE_THRESHOLD (size, thresh))
-
-#define MPN_TOOM22_MUL_MINSIZE 4
-#define MPN_TOOM2_SQR_MINSIZE 4
-
-#define MPN_TOOM33_MUL_MINSIZE 17
-#define MPN_TOOM3_SQR_MINSIZE 17
+/* FIXME: Make these itch functions less conservative. Also consider making
+ them dependent on just 'an', and compute the allocation directly from 'an'
+ instead of via n. */
+static inline mp_size_t
+mpn_toom22_mul_itch (mp_size_t an, mp_size_t bn)
+{
+ mp_size_t n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1);
+ return 4 * n + 2;
+}
-#define MPN_TOOM44_MUL_MINSIZE 30
-#define MPN_TOOM4_SQR_MINSIZE 30
+static inline mp_size_t
+mpn_toom33_mul_itch (mp_size_t an, mp_size_t bn)
+{
+ /* We could trim this to 4n+3 if HAVE_NATIVE_mpn_sublsh1_n, since
+ mpn_toom_interpolate_5pts only needs scratch otherwise. */
+ mp_size_t n = (an + 2) / (size_t) 3;
+ return 6 * n + GMP_NUMB_BITS;
+}
-#define MPN_TOOM6H_MUL_MINSIZE 46
-#define MPN_TOOM6_SQR_MINSIZE 46
+static inline mp_size_t
+mpn_toom44_mul_itch (mp_size_t an, mp_size_t bn)
+{
+ mp_size_t n = (an + 3) >> 2;
+ return 12 * n + GMP_NUMB_BITS;
+}
-#define MPN_TOOM8H_MUL_MINSIZE 86
-#define MPN_TOOM8_SQR_MINSIZE 86
+static inline mp_size_t
+mpn_toom32_mul_itch (mp_size_t an, mp_size_t bn)
+{
+ mp_size_t n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1);
+ return 4 * n + 2;
+}
-#define MPN_TOOM32_MUL_MINSIZE 10
-#define MPN_TOOM42_MUL_MINSIZE 10
-#define MPN_TOOM43_MUL_MINSIZE 25
-#define MPN_TOOM53_MUL_MINSIZE 17
-#define MPN_TOOM54_MUL_MINSIZE 31
-#define MPN_TOOM63_MUL_MINSIZE 49
+static inline mp_size_t
+mpn_toom42_mul_itch (mp_size_t an, mp_size_t bn)
+{
+ /* We could trim this to 4n+3 if HAVE_NATIVE_mpn_sublsh1_n, since
+ mpn_toom_interpolate_5pts only needs scratch otherwise. */
+ mp_size_t n = an >= 2 * bn ? (an + 3) >> 2 : (bn + 1) >> 1;
+ return 6 * n + 3;
+}
-#define MPN_TOOM42_MULMID_MINSIZE 4
+static inline mp_size_t
+mpn_toom53_mul_itch (mp_size_t an, mp_size_t bn)
+{
+ mp_size_t n = 1 + (3 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) / (size_t) 3);
+ return 10 * n + 10;
+}
-#define mpn_sqr_diagonal __MPN(sqr_diagonal)
-__GMP_DECLSPEC void mpn_sqr_diagonal (mp_ptr, mp_srcptr, mp_size_t);
+static inline mp_size_t
+mpn_toom2_sqr_itch (mp_size_t an)
+{
+ mp_size_t n = 1 + ((an - 1) >> 1);
+ return 4 * n + 2;
+}
-#define mpn_sqr_diag_addlsh1 __MPN(sqr_diag_addlsh1)
-__GMP_DECLSPEC void mpn_sqr_diag_addlsh1 (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
+static inline mp_size_t
+mpn_toom3_sqr_itch (mp_size_t an)
+{
+ /* We could trim this to 4n+3 if HAVE_NATIVE_mpn_sublsh1_n, since
+ mpn_toom_interpolate_5pts only needs scratch otherwise. */
+ mp_size_t n = (an + 2) / (size_t) 3;
+ return 6 * n + GMP_NUMB_BITS;
+}
-#define mpn_toom_interpolate_5pts __MPN(toom_interpolate_5pts)
-__GMP_DECLSPEC void mpn_toom_interpolate_5pts (mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_limb_t);
+static inline mp_size_t
+mpn_toom4_sqr_itch (mp_size_t an)
+{
+ mp_size_t n = (an + 3) >> 2;
+ return 12 * n + GMP_NUMB_BITS;
+}
-enum toom6_flags {toom6_all_pos = 0, toom6_vm1_neg = 1, toom6_vm2_neg = 2};
-#define mpn_toom_interpolate_6pts __MPN(toom_interpolate_6pts)
-__GMP_DECLSPEC void mpn_toom_interpolate_6pts (mp_ptr, mp_size_t, enum toom6_flags, mp_ptr, mp_ptr, mp_ptr, mp_size_t);
-enum toom7_flags { toom7_w1_neg = 1, toom7_w3_neg = 2 };
-#define mpn_toom_interpolate_7pts __MPN(toom_interpolate_7pts)
-__GMP_DECLSPEC void mpn_toom_interpolate_7pts (mp_ptr, mp_size_t, enum toom7_flags, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr);
+/* kara uses n+1 limbs of temporary space and then recurses with the balance,
+ so need (n+1) + (ceil(n/2)+1) + (ceil(n/4)+1) + ... This can be solved to
+ 2n + o(n). Since n is very limited, o(n) in practice could be around 15.
+ For now, assume n is arbitrarily large. */
+#define MPN_KARA_MUL_N_TSIZE(n) (2*(n) + 2*GMP_LIMB_BITS)
+#define MPN_KARA_SQR_N_TSIZE(n) (2*(n) + 2*GMP_LIMB_BITS)
+
+/* toom3 uses 2n + 2n/3 + o(n) limbs of temporary space if mpn_sublsh1_n is
+ unavailable, but just 2n + o(n) if mpn_sublsh1_n is available. It is hard
+ to pin down the value of o(n), since it is a complex function of
+ MUL_TOOM3_THRESHOLD and n. Normally toom3 is used between kara and fft; in
+ that case o(n) will be really limited. If toom3 is used for arbitrarily
+ large operands, o(n) will be larger. These definitions handle operands of
+ up to 8956264246117233 limbs. A single multiplication using toom3 on the
+ fastest hardware currently (2008) would need 10 million years, which
+ suggests that these limits are acceptable. */
+#if WANT_FFT
+#if HAVE_NATIVE_mpn_sublsh1_n
+#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 63)
+#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 63)
+#else
+#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 2*(n/3) + 63)
+#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 2*(n/3) + 63)
+#endif
+#else /* WANT_FFT */
+#if HAVE_NATIVE_mpn_sublsh1_n
+#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 255)
+#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 255)
+#else
+#define MPN_TOOM3_MUL_N_TSIZE(n) (2*(n) + 2*(n/3) + 255)
+#define MPN_TOOM3_SQR_N_TSIZE(n) (2*(n) + 2*(n/3) + 255)
+#endif
+#define MPN_TOOM44_MAX_N 285405
+#endif /* WANT_FFT */
-#define mpn_toom_interpolate_8pts __MPN(toom_interpolate_8pts)
-__GMP_DECLSPEC void mpn_toom_interpolate_8pts (mp_ptr, mp_size_t, mp_ptr, mp_ptr, mp_size_t, mp_ptr);
+/* need 2 so that n2>=1 */
+#define MPN_KARA_MUL_N_MINSIZE 2
+#define MPN_KARA_SQR_N_MINSIZE 2
-#define mpn_toom_interpolate_12pts __MPN(toom_interpolate_12pts)
-__GMP_DECLSPEC void mpn_toom_interpolate_12pts (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_ptr);
+/* Need l>=1, ls>=1, and 2*ls > l (the latter for the tD MPN_INCR_U) */
+#define MPN_TOOM3_MUL_N_MINSIZE 17
+#define MPN_TOOM3_SQR_N_MINSIZE 17
-#define mpn_toom_interpolate_16pts __MPN(toom_interpolate_16pts)
-__GMP_DECLSPEC void mpn_toom_interpolate_16pts (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_ptr);
+#define MPN_TOOM44_MUL_N_MINSIZE 30 /* ??? */
+#define MPN_TOOM4_SQR_N_MINSIZE 30 /* ??? */
-#define mpn_toom_couple_handling __MPN(toom_couple_handling)
-__GMP_DECLSPEC void mpn_toom_couple_handling (mp_ptr, mp_size_t, mp_ptr, int, mp_size_t, int, int);
+#define mpn_sqr_diagonal __MPN(sqr_diagonal)
+void mpn_sqr_diagonal __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
-#define mpn_toom_eval_dgr3_pm1 __MPN(toom_eval_dgr3_pm1)
-__GMP_DECLSPEC int mpn_toom_eval_dgr3_pm1 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr);
+#define mpn_kara_mul_n __MPN(kara_mul_n)
+void mpn_kara_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr));
-#define mpn_toom_eval_dgr3_pm2 __MPN(toom_eval_dgr3_pm2)
-__GMP_DECLSPEC int mpn_toom_eval_dgr3_pm2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr);
+#define mpn_kara_sqr_n __MPN(kara_sqr_n)
+void mpn_kara_sqr_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
-#define mpn_toom_eval_pm1 __MPN(toom_eval_pm1)
-__GMP_DECLSPEC int mpn_toom_eval_pm1 (mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, mp_ptr);
+#define mpn_toom_interpolate_5pts __MPN(toom_interpolate_5pts)
+void mpn_toom_interpolate_5pts __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_size_t, int, mp_limb_t, mp_ptr));
-#define mpn_toom_eval_pm2 __MPN(toom_eval_pm2)
-__GMP_DECLSPEC int mpn_toom_eval_pm2 (mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, mp_ptr);
+enum toom4_flags { toom4_w1_neg = 1, toom4_w3_neg = 2 }; /* FIXME */
+#define mpn_toom_interpolate_7pts __MPN(toom_interpolate_7pts)
+void mpn_toom_interpolate_7pts __GMP_PROTO ((mp_ptr, mp_size_t, enum toom4_flags, mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr));
-#define mpn_toom_eval_pm2exp __MPN(toom_eval_pm2exp)
-__GMP_DECLSPEC int mpn_toom_eval_pm2exp (mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, unsigned, mp_ptr);
+#define mpn_toom3_mul_n __MPN(toom3_mul_n)
+void mpn_toom3_mul_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t,mp_ptr));
-#define mpn_toom_eval_pm2rexp __MPN(toom_eval_pm2rexp)
-__GMP_DECLSPEC int mpn_toom_eval_pm2rexp (mp_ptr, mp_ptr, unsigned, mp_srcptr, mp_size_t, mp_size_t, unsigned, mp_ptr);
+#define mpn_toom3_sqr_n __MPN(toom3_sqr_n)
+void mpn_toom3_sqr_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_toom22_mul __MPN(toom22_mul)
-__GMP_DECLSPEC void mpn_toom22_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom32_mul __MPN(toom32_mul)
-__GMP_DECLSPEC void mpn_toom32_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom42_mul __MPN(toom42_mul)
-__GMP_DECLSPEC void mpn_toom42_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom52_mul __MPN(toom52_mul)
-__GMP_DECLSPEC void mpn_toom52_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom62_mul __MPN(toom62_mul)
-__GMP_DECLSPEC void mpn_toom62_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_toom22_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_toom2_sqr __MPN(toom2_sqr)
-__GMP_DECLSPEC void mpn_toom2_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_toom2_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_toom33_mul __MPN(toom33_mul)
-__GMP_DECLSPEC void mpn_toom33_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom43_mul __MPN(toom43_mul)
-__GMP_DECLSPEC void mpn_toom43_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom53_mul __MPN(toom53_mul)
-__GMP_DECLSPEC void mpn_toom53_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom54_mul __MPN(toom54_mul)
-__GMP_DECLSPEC void mpn_toom54_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom63_mul __MPN(toom63_mul)
-__GMP_DECLSPEC void mpn_toom63_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_toom33_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_toom3_sqr __MPN(toom3_sqr)
-__GMP_DECLSPEC void mpn_toom3_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_toom3_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_toom44_mul __MPN(toom44_mul)
-__GMP_DECLSPEC void mpn_toom44_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_toom44_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
-#define mpn_toom4_sqr __MPN(toom4_sqr)
-__GMP_DECLSPEC void mpn_toom4_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
-
-#define mpn_toom6h_mul __MPN(toom6h_mul)
-__GMP_DECLSPEC void mpn_toom6h_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_toom32_mul __MPN(toom32_mul)
+void mpn_toom32_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
-#define mpn_toom6_sqr __MPN(toom6_sqr)
-__GMP_DECLSPEC void mpn_toom6_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_toom42_mul __MPN(toom42_mul)
+void mpn_toom42_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
-#define mpn_toom8h_mul __MPN(toom8h_mul)
-__GMP_DECLSPEC void mpn_toom8h_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_toom53_mul __MPN(toom53_mul)
+void mpn_toom53_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
-#define mpn_toom8_sqr __MPN(toom8_sqr)
-__GMP_DECLSPEC void mpn_toom8_sqr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_toom62_mul __MPN(toom62_mul)
+void mpn_toom62_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
-#define mpn_toom42_mulmid __MPN(toom42_mulmid)
-__GMP_DECLSPEC void mpn_toom42_mulmid (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
+#define mpn_toom4_sqr __MPN(toom4_sqr)
+void mpn_toom4_sqr __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_fft_best_k __MPN(fft_best_k)
-__GMP_DECLSPEC int mpn_fft_best_k (mp_size_t, int) ATTRIBUTE_CONST;
+int mpn_fft_best_k __GMP_PROTO ((mp_size_t, int)) ATTRIBUTE_CONST;
#define mpn_mul_fft __MPN(mul_fft)
-__GMP_DECLSPEC mp_limb_t mpn_mul_fft (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, int);
+mp_limb_t mpn_mul_fft __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, int));
#define mpn_mul_fft_full __MPN(mul_fft_full)
-__GMP_DECLSPEC void mpn_mul_fft_full (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-#define mpn_nussbaumer_mul __MPN(nussbaumer_mul)
-__GMP_DECLSPEC void mpn_nussbaumer_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void mpn_mul_fft_full __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
#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);
-
-#define mpn_div_qr_2u_pi1 __MPN(div_qr_2u_pi1)
- __GMP_DECLSPEC mp_limb_t mpn_div_qr_2u_pi1 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int, mp_limb_t);
-
-#define mpn_sbpi1_div_qr __MPN(sbpi1_div_qr)
-__GMP_DECLSPEC mp_limb_t mpn_sbpi1_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_sbpi1_div_q __MPN(sbpi1_div_q)
-__GMP_DECLSPEC mp_limb_t mpn_sbpi1_div_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_sbpi1_divappr_q __MPN(sbpi1_divappr_q)
-__GMP_DECLSPEC mp_limb_t mpn_sbpi1_divappr_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_dcpi1_div_qr __MPN(dcpi1_div_qr)
-__GMP_DECLSPEC mp_limb_t mpn_dcpi1_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, gmp_pi1_t *);
-#define mpn_dcpi1_div_qr_n __MPN(dcpi1_div_qr_n)
-__GMP_DECLSPEC mp_limb_t mpn_dcpi1_div_qr_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, gmp_pi1_t *, mp_ptr);
-
-#define mpn_dcpi1_div_q __MPN(dcpi1_div_q)
-__GMP_DECLSPEC mp_limb_t mpn_dcpi1_div_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, gmp_pi1_t *);
-
-#define mpn_dcpi1_divappr_q __MPN(dcpi1_divappr_q)
-__GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, gmp_pi1_t *);
-#define mpn_dcpi1_divappr_q_n __MPN(dcpi1_divappr_q_n)
-__GMP_DECLSPEC mp_limb_t mpn_dcpi1_divappr_q_n (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, gmp_pi1_t *, mp_ptr);
-
+mp_size_t mpn_fft_next_size __GMP_PROTO ((mp_size_t, int)) ATTRIBUTE_CONST;
+
+#define mpn_sb_divrem_mn __MPN(sb_divrem_mn)
+mp_limb_t mpn_sb_divrem_mn __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
+
+#define mpn_dc_divrem_n __MPN(dc_divrem_n)
+mp_limb_t mpn_dc_divrem_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
+
+#define mpn_sb_div_qr __MPN(sb_div_qr)
+mp_limb_t mpn_sb_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr));
+#define mpn_sb_div_q __MPN(sb_div_q)
+mp_limb_t mpn_sb_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr));
+#define mpn_sb_divappr_q __MPN(sb_divappr_q)
+mp_limb_t mpn_sb_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr));
+#define mpn_dc_div_qr __MPN(dc_div_qr)
+mp_limb_t mpn_dc_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
+#define mpn_dc_div_qr_n __MPN(dc_div_qr_n)
+mp_limb_t mpn_dc_div_qr_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_ptr));
+#define mpn_dc_div_q __MPN(dc_div_q)
+mp_limb_t mpn_dc_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
+#define mpn_preinv_dc_div_qr __MPN(preinv_dc_div_qr)
+mp_limb_t mpn_preinv_dc_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr));
+#define mpn_dc_divappr_q __MPN(dc_divappr_q)
+mp_limb_t mpn_dc_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
+#define mpn_dc_divappr_q_n __MPN(dc_divappr_q_n)
+mp_limb_t mpn_dc_divappr_q_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_ptr));
+#define mpn_preinv_dc_divappr_q __MPN(preinv_dc_divappr_q)
+mp_limb_t mpn_preinv_dc_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr));
#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);
+mp_limb_t mpn_mu_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_mu_div_qr_itch __MPN(mu_div_qr_itch)
-__GMP_DECLSPEC mp_size_t mpn_mu_div_qr_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
+mp_size_t mpn_mu_div_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t, int));
#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);
-
+mp_size_t mpn_mu_div_qr_choose_in __GMP_PROTO ((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) ATTRIBUTE_CONST;
-
+void mpn_preinv_mu_div_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#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);
+mp_limb_t mpn_mu_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_mu_divappr_q_itch __MPN(mu_divappr_q_itch)
-__GMP_DECLSPEC mp_size_t mpn_mu_divappr_q_itch (mp_size_t, mp_size_t, int) ATTRIBUTE_CONST;
+mp_size_t mpn_mu_divappr_q_itch __GMP_PROTO ((mp_size_t, mp_size_t, int));
#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);
-
+mp_size_t mpn_mu_divappr_q_choose_in __GMP_PROTO ((mp_size_t, mp_size_t, int));
#define mpn_preinv_mu_divappr_q __MPN(preinv_mu_divappr_q)
-__GMP_DECLSPEC mp_limb_t mpn_preinv_mu_divappr_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
+void mpn_preinv_mu_divappr_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_mu_div_q __MPN(mu_div_q)
-__GMP_DECLSPEC mp_limb_t mpn_mu_div_q (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-#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) 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);
-
+mp_limb_t mpn_mu_div_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_invert __MPN(invert)
-__GMP_DECLSPEC void mpn_invert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_invert_itch(n) mpn_invertappr_itch(n)
-
-#define mpn_ni_invertappr __MPN(ni_invertappr)
-__GMP_DECLSPEC mp_limb_t mpn_ni_invertappr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_invertappr __MPN(invertappr)
-__GMP_DECLSPEC mp_limb_t mpn_invertappr (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
-#define mpn_invertappr_itch(n) (3 * (n) + 2)
+void mpn_invert __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
+#define mpn_invert_itch __MPN(invert_itch)
+mp_size_t mpn_invert_itch __GMP_PROTO ((mp_size_t));
#define mpn_binvert __MPN(binvert)
-__GMP_DECLSPEC void mpn_binvert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_binvert __GMP_PROTO ((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) 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);
-
-#define mpn_pi1_bdiv_q_1 __MPN(pi1_bdiv_q_1)
-__GMP_DECLSPEC mp_limb_t mpn_pi1_bdiv_q_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int);
-
-#define mpn_sbpi1_bdiv_qr __MPN(sbpi1_bdiv_qr)
-__GMP_DECLSPEC mp_limb_t mpn_sbpi1_bdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_sbpi1_bdiv_q __MPN(sbpi1_bdiv_q)
-__GMP_DECLSPEC void mpn_sbpi1_bdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_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) 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 __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;
-
+mp_size_t mpn_binvert_itch __GMP_PROTO ((mp_size_t));
+#define mpn_sb_bdiv_qr __MPN(sb_bdiv_qr)
+mp_limb_t mpn_sb_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
+#define mpn_sb_bdiv_q __MPN(sb_bdiv_q)
+void mpn_sb_bdiv_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
+#define mpn_dc_bdiv_qr __MPN(dc_bdiv_qr)
+mp_limb_t mpn_dc_bdiv_qr __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
+#define mpn_dc_bdiv_qr_n_itch __MPN(dc_bdiv_qr_n_itch)
+mp_size_t mpn_dc_bdiv_qr_n_itch __GMP_PROTO ((mp_size_t));
+#define mpn_dc_bdiv_qr_n __MPN(dc_bdiv_qr_n)
+mp_limb_t mpn_dc_bdiv_qr_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr));
+#define mpn_dc_bdiv_q __MPN(dc_bdiv_q)
+void mpn_dc_bdiv_q __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
+#define mpn_dc_bdiv_q_n_itch __MPN(dc_bdiv_q_n_itch)
+mp_size_t mpn_dc_bdiv_q_n_itch __GMP_PROTO ((mp_size_t));
+#define mpn_dc_bdiv_q_n __MPN(dc_bdiv_q_n)
+void mpn_dc_bdiv_q_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr));
#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);
+void mpn_mu_bdiv_qr __GMP_PROTO ((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) ATTRIBUTE_CONST;
-
+mp_size_t mpn_mu_bdiv_qr_itch __GMP_PROTO ((mp_size_t, mp_size_t));
#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);
+void mpn_mu_bdiv_q __GMP_PROTO ((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) 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) 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) ATTRIBUTE_CONST;
+mp_size_t mpn_mu_bdiv_q_itch __GMP_PROTO ((mp_size_t, mp_size_t));
#define mpn_divexact __MPN(divexact)
-__GMP_DECLSPEC void mpn_divexact (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
+void mpn_divexact __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_divexact_itch __MPN(divexact_itch)
-__GMP_DECLSPEC mp_size_t mpn_divexact_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
+mp_size_t mpn_divexact_itch __GMP_PROTO ((mp_size_t, mp_size_t));
-#ifndef mpn_bdiv_dbm1c /* if not done with cpuvec in a fat binary */
-#define mpn_bdiv_dbm1c __MPN(bdiv_dbm1c)
-__GMP_DECLSPEC mp_limb_t mpn_bdiv_dbm1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-#endif
+#define mpn_bdiv_dbm1c __MPN(bdiv_dbm1c)
+mp_limb_t mpn_bdiv_dbm1c __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t));
#define mpn_bdiv_dbm1(dst, src, size, divisor) \
mpn_bdiv_dbm1c (dst, src, size, divisor, __GMP_CAST (mp_limb_t, 0))
#define mpn_powm __MPN(powm)
-__GMP_DECLSPEC void mpn_powm (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_powm __GMP_PROTO ((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_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
+void mpn_powlo __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_size_t, mp_ptr));
+#define mpn_powm_sec __MPN(powm_sec)
+void mpn_powm_sec __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr));
+#define mpn_subcnd_n __MPN(subcnd_n)
+mp_limb_t mpn_subcnd_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
+#define mpn_tabselect __MPN(tabselect)
+void mpn_tabselect __GMP_PROTO ((volatile mp_limb_t *, volatile mp_limb_t *, mp_size_t, mp_size_t, mp_size_t));
#ifndef DIVEXACT_BY3_METHOD
#if GMP_NUMB_BITS % 2 == 0 && ! defined (HAVE_NATIVE_mpn_divexact_by3c)
@@ -1635,7 +1275,7 @@ __GMP_DECLSPEC void mpn_sec_pi1_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t,
(7 & 3 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 5)))
#endif
-#if GMP_NUMB_BITS % 3 == 0
+#if GMP_NUMB_BITS % 6 == 0
#define mpn_divexact_by7(dst,src,size) \
(7 & 1 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 7)))
#endif
@@ -1661,39 +1301,19 @@ __GMP_DECLSPEC void mpn_sec_pi1_div_r (mp_ptr, mp_size_t, mp_srcptr, mp_size_t,
#endif
#define mpz_divexact_gcd __gmpz_divexact_gcd
-__GMP_DECLSPEC void mpz_divexact_gcd (mpz_ptr, mpz_srcptr, mpz_srcptr);
-
-#define mpz_prodlimbs __gmpz_prodlimbs
-__GMP_DECLSPEC mp_size_t mpz_prodlimbs (mpz_ptr, mp_ptr, mp_size_t);
-
-#define mpz_oddfac_1 __gmpz_oddfac_1
-__GMP_DECLSPEC void mpz_oddfac_1 (mpz_ptr, mp_limb_t, unsigned);
+void mpz_divexact_gcd __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
#define mpz_inp_str_nowhite __gmpz_inp_str_nowhite
#ifdef _GMP_H_HAVE_FILE
-__GMP_DECLSPEC size_t mpz_inp_str_nowhite (mpz_ptr, FILE *, int, int, size_t);
+size_t mpz_inp_str_nowhite __GMP_PROTO ((mpz_ptr, FILE *, int, int, size_t));
#endif
#define mpn_divisible_p __MPN(divisible_p)
-__GMP_DECLSPEC int mpn_divisible_p (mp_srcptr, mp_size_t, mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
+int mpn_divisible_p __GMP_PROTO ((mp_srcptr, mp_size_t, mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
#define mpn_rootrem __MPN(rootrem)
-__GMP_DECLSPEC mp_size_t mpn_rootrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
+mp_size_t mpn_rootrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
-#define mpn_broot __MPN(broot)
-__GMP_DECLSPEC void mpn_broot (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_broot_invm1 __MPN(broot_invm1)
-__GMP_DECLSPEC void mpn_broot_invm1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-#define mpn_brootinv __MPN(brootinv)
-__GMP_DECLSPEC void mpn_brootinv (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_ptr);
-
-#define mpn_bsqrt __MPN(bsqrt)
-__GMP_DECLSPEC void mpn_bsqrt (mp_ptr, mp_srcptr, mp_bitcnt_t, mp_ptr);
-
-#define mpn_bsqrtinv __MPN(bsqrtinv)
-__GMP_DECLSPEC int mpn_bsqrtinv (mp_ptr, mp_srcptr, mp_bitcnt_t, mp_ptr);
#if defined (_CRAY)
#define MPN_COPY_INCR(dst, src, n) \
@@ -1708,42 +1328,42 @@ __GMP_DECLSPEC int mpn_bsqrtinv (mp_ptr, mp_srcptr, mp_bitcnt_t, mp_ptr);
/* used by test programs, hence __GMP_DECLSPEC */
#ifndef mpn_copyi /* if not done with cpuvec in a fat binary */
#define mpn_copyi __MPN(copyi)
-__GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC void mpn_copyi __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
#endif
#if ! defined (MPN_COPY_INCR) && HAVE_NATIVE_mpn_copyi
-#define MPN_COPY_INCR(dst, src, size) \
- do { \
- ASSERT ((size) >= 0); \
- ASSERT (MPN_SAME_OR_INCR_P (dst, src, size)); \
- mpn_copyi (dst, src, size); \
+#define MPN_COPY_INCR(dst, src, size) \
+ do { \
+ ASSERT ((size) >= 0); \
+ ASSERT (MPN_SAME_OR_INCR_P (dst, src, size)); \
+ mpn_copyi (dst, src, size); \
} while (0)
#endif
/* Copy N limbs from SRC to DST incrementing, N==0 allowed. */
#if ! defined (MPN_COPY_INCR)
-#define MPN_COPY_INCR(dst, src, n) \
- do { \
- ASSERT ((n) >= 0); \
- ASSERT (MPN_SAME_OR_INCR_P (dst, src, n)); \
- if ((n) != 0) \
- { \
- mp_size_t __n = (n) - 1; \
- mp_ptr __dst = (dst); \
- mp_srcptr __src = (src); \
- mp_limb_t __x; \
- __x = *__src++; \
- if (__n != 0) \
- { \
- do \
- { \
- *__dst++ = __x; \
- __x = *__src++; \
- } \
- while (--__n); \
- } \
- *__dst++ = __x; \
- } \
+#define MPN_COPY_INCR(dst, src, n) \
+ do { \
+ ASSERT ((n) >= 0); \
+ ASSERT (MPN_SAME_OR_INCR_P (dst, src, n)); \
+ if ((n) != 0) \
+ { \
+ mp_size_t __n = (n) - 1; \
+ mp_ptr __dst = (dst); \
+ mp_srcptr __src = (src); \
+ mp_limb_t __x; \
+ __x = *__src++; \
+ if (__n != 0) \
+ { \
+ do \
+ { \
+ *__dst++ = __x; \
+ __x = *__src++; \
+ } \
+ while (--__n); \
+ } \
+ *__dst++ = __x; \
+ } \
} while (0)
#endif
@@ -1761,71 +1381,71 @@ __GMP_DECLSPEC void mpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
/* used by test programs, hence __GMP_DECLSPEC */
#ifndef mpn_copyd /* if not done with cpuvec in a fat binary */
#define mpn_copyd __MPN(copyd)
-__GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
+__GMP_DECLSPEC void mpn_copyd __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
#endif
#if ! defined (MPN_COPY_DECR) && HAVE_NATIVE_mpn_copyd
-#define MPN_COPY_DECR(dst, src, size) \
- do { \
- ASSERT ((size) >= 0); \
- ASSERT (MPN_SAME_OR_DECR_P (dst, src, size)); \
- mpn_copyd (dst, src, size); \
+#define MPN_COPY_DECR(dst, src, size) \
+ do { \
+ ASSERT ((size) >= 0); \
+ ASSERT (MPN_SAME_OR_DECR_P (dst, src, size)); \
+ mpn_copyd (dst, src, size); \
} while (0)
#endif
/* Copy N limbs from SRC to DST decrementing, N==0 allowed. */
#if ! defined (MPN_COPY_DECR)
-#define MPN_COPY_DECR(dst, src, n) \
- do { \
- ASSERT ((n) >= 0); \
- ASSERT (MPN_SAME_OR_DECR_P (dst, src, n)); \
- if ((n) != 0) \
- { \
- mp_size_t __n = (n) - 1; \
- mp_ptr __dst = (dst) + __n; \
- mp_srcptr __src = (src) + __n; \
- mp_limb_t __x; \
- __x = *__src--; \
- if (__n != 0) \
- { \
- do \
- { \
- *__dst-- = __x; \
- __x = *__src--; \
- } \
- while (--__n); \
- } \
- *__dst-- = __x; \
- } \
+#define MPN_COPY_DECR(dst, src, n) \
+ do { \
+ ASSERT ((n) >= 0); \
+ ASSERT (MPN_SAME_OR_DECR_P (dst, src, n)); \
+ if ((n) != 0) \
+ { \
+ mp_size_t __n = (n) - 1; \
+ mp_ptr __dst = (dst) + __n; \
+ mp_srcptr __src = (src) + __n; \
+ mp_limb_t __x; \
+ __x = *__src--; \
+ if (__n != 0) \
+ { \
+ do \
+ { \
+ *__dst-- = __x; \
+ __x = *__src--; \
+ } \
+ while (--__n); \
+ } \
+ *__dst-- = __x; \
+ } \
} while (0)
#endif
#ifndef MPN_COPY
-#define MPN_COPY(d,s,n) \
- do { \
- ASSERT (MPN_SAME_OR_SEPARATE_P (d, s, n)); \
- MPN_COPY_INCR (d, s, n); \
+#define MPN_COPY(d,s,n) \
+ do { \
+ ASSERT (MPN_SAME_OR_SEPARATE_P (d, s, n)); \
+ MPN_COPY_INCR (d, s, n); \
} while (0)
#endif
/* Set {dst,size} to the limbs of {src,size} in reverse order. */
-#define MPN_REVERSE(dst, src, size) \
- do { \
- mp_ptr __dst = (dst); \
- mp_size_t __size = (size); \
- mp_srcptr __src = (src) + __size - 1; \
- mp_size_t __i; \
- ASSERT ((size) >= 0); \
- ASSERT (! MPN_OVERLAP_P (dst, size, src, size)); \
- CRAY_Pragma ("_CRI ivdep"); \
- for (__i = 0; __i < __size; __i++) \
- { \
- *__dst = *__src; \
- __dst++; \
- __src--; \
- } \
+#define MPN_REVERSE(dst, src, size) \
+ do { \
+ mp_ptr __dst = (dst); \
+ mp_size_t __size = (size); \
+ mp_srcptr __src = (src) + __size - 1; \
+ mp_size_t __i; \
+ ASSERT ((size) >= 0); \
+ ASSERT (! MPN_OVERLAP_P (dst, size, src, size)); \
+ CRAY_Pragma ("_CRI ivdep"); \
+ for (__i = 0; __i < __size; __i++) \
+ { \
+ *__dst = *__src; \
+ __dst++; \
+ __src--; \
+ } \
} while (0)
@@ -1849,32 +1469,32 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
would be good when on a GNU system. */
#if HAVE_HOST_CPU_FAMILY_power || HAVE_HOST_CPU_FAMILY_powerpc
-#define MPN_ZERO(dst, n) \
- do { \
- ASSERT ((n) >= 0); \
- if ((n) != 0) \
- { \
- mp_ptr __dst = (dst) - 1; \
- mp_size_t __n = (n); \
- do \
- *++__dst = 0; \
- while (--__n); \
- } \
+#define MPN_ZERO(dst, n) \
+ do { \
+ ASSERT ((n) >= 0); \
+ if ((n) != 0) \
+ { \
+ mp_ptr __dst = (dst) - 1; \
+ mp_size_t __n = (n); \
+ do \
+ *++__dst = 0; \
+ while (--__n); \
+ } \
} while (0)
#endif
#ifndef MPN_ZERO
-#define MPN_ZERO(dst, n) \
- do { \
- ASSERT ((n) >= 0); \
- if ((n) != 0) \
- { \
- mp_ptr __dst = (dst); \
- mp_size_t __n = (n); \
- do \
- *__dst++ = 0; \
- while (--__n); \
- } \
+#define MPN_ZERO(dst, n) \
+ do { \
+ ASSERT ((n) >= 0); \
+ if ((n) != 0) \
+ { \
+ mp_ptr __dst = (dst); \
+ mp_size_t __n = (n); \
+ do \
+ *__dst++ = 0; \
+ while (--__n); \
+ } \
} while (0)
#endif
@@ -1885,16 +1505,16 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
std/repe/scasl/cld and cld/repe/scasl (the latter would be for stripping
low zeros).
- std cld
- P5 18 16
- P6 46 38
- K6 36 13
- K7 21 20
+ std cld
+ P5 18 16
+ P6 46 38
+ K6 36 13
+ K7 21 20
*/
#ifndef MPN_NORMALIZE
#define MPN_NORMALIZE(DST, NLIMBS) \
do { \
- while ((NLIMBS) > 0) \
+ while ((NLIMBS) > 0) \
{ \
if ((DST)[(NLIMBS) - 1] != 0) \
break; \
@@ -1903,15 +1523,15 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
} while (0)
#endif
#ifndef MPN_NORMALIZE_NOT_ZERO
-#define MPN_NORMALIZE_NOT_ZERO(DST, NLIMBS) \
- do { \
- while (1) \
- { \
- ASSERT ((NLIMBS) >= 1); \
- if ((DST)[(NLIMBS) - 1] != 0) \
- break; \
- (NLIMBS)--; \
- } \
+#define MPN_NORMALIZE_NOT_ZERO(DST, NLIMBS) \
+ do { \
+ ASSERT ((NLIMBS) >= 1); \
+ while (1) \
+ { \
+ if ((DST)[(NLIMBS) - 1] != 0) \
+ break; \
+ (NLIMBS)--; \
+ } \
} while (0)
#endif
@@ -1919,51 +1539,36 @@ __GMP_DECLSPEC void mpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
and decrementing size. low should be ptr[0], and will be the new ptr[0]
on returning. The number in {ptr,size} must be non-zero, ie. size!=0 and
somewhere a non-zero limb. */
-#define MPN_STRIP_LOW_ZEROS_NOT_ZERO(ptr, size, low) \
- do { \
- ASSERT ((size) >= 1); \
- ASSERT ((low) == (ptr)[0]); \
- \
- while ((low) == 0) \
- { \
- (size)--; \
- ASSERT ((size) >= 1); \
- (ptr)++; \
- (low) = *(ptr); \
- } \
+#define MPN_STRIP_LOW_ZEROS_NOT_ZERO(ptr, size, low) \
+ do { \
+ ASSERT ((size) >= 1); \
+ ASSERT ((low) == (ptr)[0]); \
+ \
+ while ((low) == 0) \
+ { \
+ (size)--; \
+ ASSERT ((size) >= 1); \
+ (ptr)++; \
+ (low) = *(ptr); \
+ } \
} while (0)
/* Initialize X of type mpz_t with space for NLIMBS limbs. X should be a
temporary variable; it will be automatically cleared out at function
return. We use __x here to make it possible to accept both mpz_ptr and
mpz_t arguments. */
-#define MPZ_TMP_INIT(X, NLIMBS) \
- do { \
- mpz_ptr __x = (X); \
- ASSERT ((NLIMBS) >= 1); \
- __x->_mp_alloc = (NLIMBS); \
- __x->_mp_d = TMP_ALLOC_LIMBS (NLIMBS); \
+#define MPZ_TMP_INIT(X, NLIMBS) \
+ do { \
+ mpz_ptr __x = (X); \
+ ASSERT ((NLIMBS) >= 1); \
+ __x->_mp_alloc = (NLIMBS); \
+ __x->_mp_d = (mp_ptr) TMP_ALLOC ((NLIMBS) * BYTES_PER_MP_LIMB); \
} while (0)
-#if WANT_ASSERT
-static inline void *
-_mpz_newalloc (mpz_ptr z, mp_size_t n)
-{
- void * res = _mpz_realloc(z,n);
- /* If we are checking the code, force a random change to limbs. */
- ((mp_ptr) res)[0] = ~ ((mp_ptr) res)[ALLOC (z) - 1];
- return res;
-}
-#else
-#define _mpz_newalloc _mpz_realloc
-#endif
/* Realloc for an mpz_t WHAT if it has less than NEEDED limbs. */
-#define MPZ_REALLOC(z,n) (UNLIKELY ((n) > ALLOC(z)) \
- ? (mp_ptr) _mpz_realloc(z,n) \
- : PTR(z))
-#define MPZ_NEWALLOC(z,n) (UNLIKELY ((n) > ALLOC(z)) \
- ? (mp_ptr) _mpz_newalloc(z,n) \
- : PTR(z))
+#define MPZ_REALLOC(z,n) (UNLIKELY ((n) > ALLOC(z)) \
+ ? (mp_ptr) _mpz_realloc(z,n) \
+ : PTR(z))
#define MPZ_EQUAL_1_P(z) (SIZ(z)==1 && PTR(z)[0] == 1)
@@ -2001,222 +1606,149 @@ _mpz_newalloc (mpz_ptr z, mp_size_t n)
__GMP_DECLSPEC extern const mp_limb_t __gmp_fib_table[];
#define FIB_TABLE(n) (__gmp_fib_table[(n)+1])
-extern const mp_limb_t __gmp_oddfac_table[];
-extern const mp_limb_t __gmp_odd2fac_table[];
-extern const unsigned char __gmp_fac2cnt_table[];
-extern const mp_limb_t __gmp_limbroots_table[];
-/* n^log <= GMP_NUMB_MAX, a limb can store log factors less than n */
-static inline unsigned
-log_n_max (mp_limb_t n)
-{
- unsigned log;
- for (log = 8; n > __gmp_limbroots_table[log - 1]; log--);
- return log;
-}
+/* For a threshold between algorithms A and B, size>=thresh is where B
+ should be used. Special value MP_SIZE_T_MAX means only ever use A, or
+ value 0 means only ever use B. The tests for these special values will
+ be compile-time constants, so the compiler should be able to eliminate
+ the code for the unwanted algorithm. */
-#define SIEVESIZE 512 /* FIXME: Allow gmp_init_primesieve to choose */
-typedef struct
-{
- unsigned long d; /* current index in s[] */
- unsigned long s0; /* number corresponding to s[0] */
- unsigned long sqrt_s0; /* misnomer for sqrt(s[SIEVESIZE-1]) */
- unsigned char s[SIEVESIZE + 1]; /* sieve table */
-} gmp_primesieve_t;
+#define ABOVE_THRESHOLD(size,thresh) \
+ ((thresh) == 0 \
+ || ((thresh) != MP_SIZE_T_MAX \
+ && (size) >= (thresh)))
+#define BELOW_THRESHOLD(size,thresh) (! ABOVE_THRESHOLD (size, thresh))
-#define gmp_init_primesieve __gmp_init_primesieve
-__GMP_DECLSPEC void gmp_init_primesieve (gmp_primesieve_t *);
+/* Usage: int use_foo = BELOW_THRESHOLD (size, FOO_THRESHOLD);
+ ...
+ if (CACHED_BELOW_THRESHOLD (use_foo, size, FOO_THRESHOLD))
-#define gmp_nextprime __gmp_nextprime
-__GMP_DECLSPEC unsigned long int gmp_nextprime (gmp_primesieve_t *);
+ When "use_foo" is a constant (thresh is 0 or MP_SIZE_T), gcc prior to
+ version 3.3 doesn't optimize away a test "if (use_foo)" when within a
+ loop. CACHED_BELOW_THRESHOLD helps it do so. */
-#define gmp_primesieve __gmp_primesieve
-__GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
+#define CACHED_ABOVE_THRESHOLD(cache, thresh) \
+ ((thresh) == 0 || (thresh) == MP_SIZE_T_MAX \
+ ? ABOVE_THRESHOLD (0, thresh) \
+ : (cache))
+#define CACHED_BELOW_THRESHOLD(cache, thresh) \
+ ((thresh) == 0 || (thresh) == MP_SIZE_T_MAX \
+ ? BELOW_THRESHOLD (0, thresh) \
+ : (cache))
-#ifndef MUL_TOOM22_THRESHOLD
-#define MUL_TOOM22_THRESHOLD 30
+/* If MUL_KARATSUBA_THRESHOLD is not already defined, define it to a
+ value which is good on most machines. */
+#ifndef MUL_KARATSUBA_THRESHOLD
+#define MUL_KARATSUBA_THRESHOLD 32
#endif
-#ifndef MUL_TOOM33_THRESHOLD
-#define MUL_TOOM33_THRESHOLD 100
+/* If MUL_TOOM3_THRESHOLD is not already defined, define it to a
+ value which is good on most machines. */
+#ifndef MUL_TOOM3_THRESHOLD
+#define MUL_TOOM3_THRESHOLD 128
#endif
#ifndef MUL_TOOM44_THRESHOLD
-#define MUL_TOOM44_THRESHOLD 300
+#define MUL_TOOM44_THRESHOLD 500
#endif
-#ifndef MUL_TOOM6H_THRESHOLD
-#define MUL_TOOM6H_THRESHOLD 350
-#endif
+/* Source compatibility while source is in flux. */
+#define MUL_TOOM22_THRESHOLD MUL_KARATSUBA_THRESHOLD
+#define MUL_TOOM33_THRESHOLD MUL_TOOM3_THRESHOLD
+#define SQR_TOOM2_THRESHOLD SQR_KARATSUBA_THRESHOLD
-#ifndef SQR_TOOM6_THRESHOLD
-#define SQR_TOOM6_THRESHOLD MUL_TOOM6H_THRESHOLD
+/* MUL_KARATSUBA_THRESHOLD_LIMIT is the maximum for MUL_KARATSUBA_THRESHOLD.
+ In a normal build MUL_KARATSUBA_THRESHOLD is a constant and we use that.
+ In a fat binary or tune program build MUL_KARATSUBA_THRESHOLD is a
+ variable and a separate hard limit will have been defined. Similarly for
+ TOOM3. */
+#ifndef MUL_KARATSUBA_THRESHOLD_LIMIT
+#define MUL_KARATSUBA_THRESHOLD_LIMIT MUL_KARATSUBA_THRESHOLD
#endif
-
-#ifndef MUL_TOOM8H_THRESHOLD
-#define MUL_TOOM8H_THRESHOLD 450
-#endif
-
-#ifndef SQR_TOOM8_THRESHOLD
-#define SQR_TOOM8_THRESHOLD MUL_TOOM8H_THRESHOLD
-#endif
-
-#ifndef MUL_TOOM32_TO_TOOM43_THRESHOLD
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 100
-#endif
-
-#ifndef MUL_TOOM32_TO_TOOM53_THRESHOLD
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 110
-#endif
-
-#ifndef MUL_TOOM42_TO_TOOM53_THRESHOLD
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 100
-#endif
-
-#ifndef MUL_TOOM42_TO_TOOM63_THRESHOLD
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 110
+#ifndef MUL_TOOM3_THRESHOLD_LIMIT
+#define MUL_TOOM3_THRESHOLD_LIMIT MUL_TOOM3_THRESHOLD
#endif
-
-#ifndef MUL_TOOM43_TO_TOOM54_THRESHOLD
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 150
-#endif
-
-/* MUL_TOOM22_THRESHOLD_LIMIT is the maximum for MUL_TOOM22_THRESHOLD. In a
- normal build MUL_TOOM22_THRESHOLD is a constant and we use that. In a fat
- binary or tune program build MUL_TOOM22_THRESHOLD is a variable and a
- separate hard limit will have been defined. Similarly for TOOM3. */
-#ifndef MUL_TOOM22_THRESHOLD_LIMIT
-#define MUL_TOOM22_THRESHOLD_LIMIT MUL_TOOM22_THRESHOLD
-#endif
-#ifndef MUL_TOOM33_THRESHOLD_LIMIT
-#define MUL_TOOM33_THRESHOLD_LIMIT MUL_TOOM33_THRESHOLD
-#endif
-#ifndef MULLO_BASECASE_THRESHOLD_LIMIT
-#define MULLO_BASECASE_THRESHOLD_LIMIT MULLO_BASECASE_THRESHOLD
+#ifndef MULLOW_BASECASE_THRESHOLD_LIMIT
+#define MULLOW_BASECASE_THRESHOLD_LIMIT MULLOW_BASECASE_THRESHOLD
#endif
/* SQR_BASECASE_THRESHOLD is where mpn_sqr_basecase should take over from
- mpn_mul_basecase. Default is to use mpn_sqr_basecase from 0. (Note that we
- certainly always want it if there's a native assembler mpn_sqr_basecase.)
+ mpn_mul_basecase in mpn_sqr_n. Default is to use mpn_sqr_basecase
+ always. (Note that we certainly always want it if there's a native
+ assembler mpn_sqr_basecase.)
- If it turns out that mpn_toom2_sqr becomes faster than mpn_mul_basecase
- before mpn_sqr_basecase does, then SQR_BASECASE_THRESHOLD is the toom2
- threshold and SQR_TOOM2_THRESHOLD is 0. This oddity arises more or less
- because SQR_TOOM2_THRESHOLD represents the size up to which mpn_sqr_basecase
- should be used, and that may be never. */
+ If it turns out that mpn_kara_sqr_n becomes faster than mpn_mul_basecase
+ before mpn_sqr_basecase does, then SQR_BASECASE_THRESHOLD is the
+ karatsuba threshold and SQR_KARATSUBA_THRESHOLD is 0. This oddity arises
+ more or less because SQR_KARATSUBA_THRESHOLD represents the size up to
+ which mpn_sqr_basecase should be used, and that may be never. */
#ifndef SQR_BASECASE_THRESHOLD
-#define SQR_BASECASE_THRESHOLD 0
+#define SQR_BASECASE_THRESHOLD 0
#endif
-#ifndef SQR_TOOM2_THRESHOLD
-#define SQR_TOOM2_THRESHOLD 50
+#ifndef SQR_KARATSUBA_THRESHOLD
+#define SQR_KARATSUBA_THRESHOLD (2*MUL_KARATSUBA_THRESHOLD)
#endif
#ifndef SQR_TOOM3_THRESHOLD
-#define SQR_TOOM3_THRESHOLD 120
+#define SQR_TOOM3_THRESHOLD 128
#endif
#ifndef SQR_TOOM4_THRESHOLD
-#define SQR_TOOM4_THRESHOLD 400
+#define SQR_TOOM4_THRESHOLD 500
#endif
-/* See comments above about MUL_TOOM33_THRESHOLD_LIMIT. */
+/* See comments above about MUL_TOOM3_THRESHOLD_LIMIT. */
#ifndef SQR_TOOM3_THRESHOLD_LIMIT
#define SQR_TOOM3_THRESHOLD_LIMIT SQR_TOOM3_THRESHOLD
#endif
-#ifndef MULMID_TOOM42_THRESHOLD
-#define MULMID_TOOM42_THRESHOLD MUL_TOOM22_THRESHOLD
-#endif
-
#ifndef DC_DIV_QR_THRESHOLD
-#define DC_DIV_QR_THRESHOLD 50
+#define DC_DIV_QR_THRESHOLD 43
#endif
#ifndef DC_DIVAPPR_Q_THRESHOLD
-#define DC_DIVAPPR_Q_THRESHOLD 200
+#define DC_DIVAPPR_Q_THRESHOLD 208
+#endif
+
+#ifndef DC_DIV_Q_THRESHOLD
+#define DC_DIV_Q_THRESHOLD 228
#endif
#ifndef DC_BDIV_QR_THRESHOLD
-#define DC_BDIV_QR_THRESHOLD 50
+#define DC_BDIV_QR_THRESHOLD 52
#endif
#ifndef DC_BDIV_Q_THRESHOLD
-#define DC_BDIV_Q_THRESHOLD 180
+#define DC_BDIV_Q_THRESHOLD 224
#endif
#ifndef DIVEXACT_JEB_THRESHOLD
-#define DIVEXACT_JEB_THRESHOLD 25
-#endif
-
-#ifndef INV_MULMOD_BNM1_THRESHOLD
-#define INV_MULMOD_BNM1_THRESHOLD (5*MULMOD_BNM1_THRESHOLD)
-#endif
-
-#ifndef INV_APPR_THRESHOLD
-#define INV_APPR_THRESHOLD INV_NEWTON_THRESHOLD
+#define DIVEXACT_JEB_THRESHOLD 25
#endif
#ifndef INV_NEWTON_THRESHOLD
-#define INV_NEWTON_THRESHOLD 200
+#define INV_NEWTON_THRESHOLD 654
#endif
#ifndef BINV_NEWTON_THRESHOLD
-#define BINV_NEWTON_THRESHOLD 300
+#define BINV_NEWTON_THRESHOLD 807
#endif
#ifndef MU_DIVAPPR_Q_THRESHOLD
-#define MU_DIVAPPR_Q_THRESHOLD 2000
-#endif
-
-#ifndef MU_DIV_QR_THRESHOLD
-#define MU_DIV_QR_THRESHOLD 2000
+#define MU_DIVAPPR_Q_THRESHOLD 4000
#endif
-#ifndef MUPI_DIV_QR_THRESHOLD
-#define MUPI_DIV_QR_THRESHOLD 200
+#ifndef MU_DIV_Q_THRESHOLD
+#define MU_DIV_Q_THRESHOLD 4000
#endif
#ifndef MU_BDIV_Q_THRESHOLD
-#define MU_BDIV_Q_THRESHOLD 2000
-#endif
-
-#ifndef MU_BDIV_QR_THRESHOLD
-#define MU_BDIV_QR_THRESHOLD 2000
-#endif
-
-#ifndef MULMOD_BNM1_THRESHOLD
-#define MULMOD_BNM1_THRESHOLD 16
-#endif
-
-#ifndef SQRMOD_BNM1_THRESHOLD
-#define SQRMOD_BNM1_THRESHOLD 16
-#endif
-
-#ifndef MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD
-#define MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD (INV_MULMOD_BNM1_THRESHOLD/2)
-#endif
-
-#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
-
-#ifndef REDC_1_TO_REDC_2_THRESHOLD
-#define REDC_1_TO_REDC_2_THRESHOLD 15
-#endif
-#ifndef REDC_2_TO_REDC_N_THRESHOLD
-#define REDC_2_TO_REDC_N_THRESHOLD 100
+#define MU_BDIV_Q_THRESHOLD 2000
#endif
-#else
-
-#ifndef REDC_1_TO_REDC_N_THRESHOLD
-#define REDC_1_TO_REDC_N_THRESHOLD 100
-#endif
-
-#endif /* HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2 */
-
-
/* First k to use for an FFT modF multiply. A modF FFT is an order
log(2^k)/log(2^(k-1)) algorithm, so k=3 is merely 1.5 like karatsuba,
whereas k=4 is 1.33 which is faster than toom3 at 1.485. */
@@ -2224,7 +1756,7 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
/* Threshold at which FFT should be used to do a modF NxN -> N multiply. */
#ifndef MUL_FFT_MODF_THRESHOLD
-#define MUL_FFT_MODF_THRESHOLD (MUL_TOOM33_THRESHOLD * 3)
+#define MUL_FFT_MODF_THRESHOLD (MUL_TOOM3_THRESHOLD * 3)
#endif
#ifndef SQR_FFT_MODF_THRESHOLD
#define SQR_FFT_MODF_THRESHOLD (SQR_TOOM3_THRESHOLD * 3)
@@ -2246,32 +1778,26 @@ __GMP_DECLSPEC mp_limb_t gmp_primesieve (mp_ptr, mp_limb_t);
where FFT_FIRST_K+1 should be used, the second FFT_FIRST_K+2,
etc. See mpn_fft_best_k(). */
#ifndef MUL_FFT_TABLE
-#define MUL_FFT_TABLE \
- { MUL_TOOM33_THRESHOLD * 4, /* k=5 */ \
- MUL_TOOM33_THRESHOLD * 8, /* k=6 */ \
- MUL_TOOM33_THRESHOLD * 16, /* k=7 */ \
- MUL_TOOM33_THRESHOLD * 32, /* k=8 */ \
- MUL_TOOM33_THRESHOLD * 96, /* k=9 */ \
- MUL_TOOM33_THRESHOLD * 288, /* k=10 */ \
+#define MUL_FFT_TABLE \
+ { MUL_TOOM3_THRESHOLD * 4, /* k=5 */ \
+ MUL_TOOM3_THRESHOLD * 8, /* k=6 */ \
+ MUL_TOOM3_THRESHOLD * 16, /* k=7 */ \
+ MUL_TOOM3_THRESHOLD * 32, /* k=8 */ \
+ MUL_TOOM3_THRESHOLD * 96, /* k=9 */ \
+ MUL_TOOM3_THRESHOLD * 288, /* k=10 */ \
0 }
#endif
#ifndef SQR_FFT_TABLE
-#define SQR_FFT_TABLE \
- { SQR_TOOM3_THRESHOLD * 4, /* k=5 */ \
- SQR_TOOM3_THRESHOLD * 8, /* k=6 */ \
- SQR_TOOM3_THRESHOLD * 16, /* k=7 */ \
- SQR_TOOM3_THRESHOLD * 32, /* k=8 */ \
- SQR_TOOM3_THRESHOLD * 96, /* k=9 */ \
- SQR_TOOM3_THRESHOLD * 288, /* k=10 */ \
+#define SQR_FFT_TABLE \
+ { SQR_TOOM3_THRESHOLD * 4, /* k=5 */ \
+ SQR_TOOM3_THRESHOLD * 8, /* k=6 */ \
+ SQR_TOOM3_THRESHOLD * 16, /* k=7 */ \
+ SQR_TOOM3_THRESHOLD * 32, /* k=8 */ \
+ SQR_TOOM3_THRESHOLD * 96, /* k=9 */ \
+ SQR_TOOM3_THRESHOLD * 288, /* k=10 */ \
0 }
#endif
-struct fft_table_nk
-{
- unsigned int n:27;
- unsigned int k:5;
-};
-
#ifndef FFT_TABLE_ATTRS
#define FFT_TABLE_ATTRS static const
#endif
@@ -2279,8 +1805,15 @@ struct fft_table_nk
#define MPN_FFT_TABLE_SIZE 16
-#ifndef DC_DIV_QR_THRESHOLD
-#define DC_DIV_QR_THRESHOLD (3 * MUL_TOOM22_THRESHOLD)
+/* mpn_dc_divrem_n(n) calls 2*mul(n/2)+2*div(n/2), thus to be faster than
+ div(n) = 4*div(n/2), we need mul(n/2) to be faster than the classic way,
+ i.e. n/2 >= MUL_KARATSUBA_THRESHOLD
+
+ Measured values are between 2 and 4 times MUL_KARATSUBA_THRESHOLD, so go
+ for 3 as an average. */
+
+#ifndef DIV_DC_THRESHOLD
+#define DIV_DC_THRESHOLD (3 * MUL_KARATSUBA_THRESHOLD)
#endif
#ifndef GET_STR_DC_THRESHOLD
@@ -2299,40 +1832,32 @@ struct fft_table_nk
#define SET_STR_PRECOMPUTE_THRESHOLD 2000
#endif
-#ifndef FAC_ODD_THRESHOLD
-#define FAC_ODD_THRESHOLD 35
-#endif
-
-#ifndef FAC_DSC_THRESHOLD
-#define FAC_DSC_THRESHOLD 400
-#endif
-
/* Return non-zero if xp,xsize and yp,ysize overlap.
If xp+xsize<=yp there's no overlap, or if yp+ysize<=xp there's no
overlap. If both these are false, there's an overlap. */
-#define MPN_OVERLAP_P(xp, xsize, yp, ysize) \
+#define MPN_OVERLAP_P(xp, xsize, yp, ysize) \
((xp) + (xsize) > (yp) && (yp) + (ysize) > (xp))
-#define MEM_OVERLAP_P(xp, xsize, yp, ysize) \
- ( (char *) (xp) + (xsize) > (char *) (yp) \
+#define MEM_OVERLAP_P(xp, xsize, yp, ysize) \
+ ( (char *) (xp) + (xsize) > (char *) (yp) \
&& (char *) (yp) + (ysize) > (char *) (xp))
/* Return non-zero if xp,xsize and yp,ysize are either identical or not
overlapping. Return zero if they're partially overlapping. */
-#define MPN_SAME_OR_SEPARATE_P(xp, yp, size) \
+#define MPN_SAME_OR_SEPARATE_P(xp, yp, size) \
MPN_SAME_OR_SEPARATE2_P(xp, size, yp, size)
-#define MPN_SAME_OR_SEPARATE2_P(xp, xsize, yp, ysize) \
+#define MPN_SAME_OR_SEPARATE2_P(xp, xsize, yp, ysize) \
((xp) == (yp) || ! MPN_OVERLAP_P (xp, xsize, yp, ysize))
/* Return non-zero if dst,dsize and src,ssize are either identical or
overlapping in a way suitable for an incrementing/decrementing algorithm.
Return zero if they're partially overlapping in an unsuitable fashion. */
-#define MPN_SAME_OR_INCR2_P(dst, dsize, src, ssize) \
+#define MPN_SAME_OR_INCR2_P(dst, dsize, src, ssize) \
((dst) <= (src) || ! MPN_OVERLAP_P (dst, dsize, src, ssize))
-#define MPN_SAME_OR_INCR_P(dst, src, size) \
+#define MPN_SAME_OR_INCR_P(dst, src, size) \
MPN_SAME_OR_INCR2_P(dst, size, src, size)
-#define MPN_SAME_OR_DECR2_P(dst, dsize, src, ssize) \
+#define MPN_SAME_OR_DECR2_P(dst, dsize, src, ssize) \
((dst) >= (src) || ! MPN_OVERLAP_P (dst, dsize, src, ssize))
-#define MPN_SAME_OR_DECR_P(dst, src, size) \
+#define MPN_SAME_OR_DECR_P(dst, src, size) \
MPN_SAME_OR_DECR2_P(dst, size, src, size)
@@ -2357,8 +1882,8 @@ struct fft_table_nk
#define ASSERT_FILE ""
#endif
-__GMP_DECLSPEC void __gmp_assert_header (const char *, int);
-__GMP_DECLSPEC void __gmp_assert_fail (const char *, int, const char *) ATTRIBUTE_NORETURN;
+void __gmp_assert_header __GMP_PROTO ((const char *, int));
+__GMP_DECLSPEC void __gmp_assert_fail __GMP_PROTO ((const char *, int, const char *)) ATTRIBUTE_NORETURN;
#if HAVE_STRINGIZE
#define ASSERT_FAIL(expr) __gmp_assert_fail (ASSERT_FILE, ASSERT_LINE, #expr)
@@ -2366,10 +1891,10 @@ __GMP_DECLSPEC void __gmp_assert_fail (const char *, int, const char *) ATTRIBUT
#define ASSERT_FAIL(expr) __gmp_assert_fail (ASSERT_FILE, ASSERT_LINE, "expr")
#endif
-#define ASSERT_ALWAYS(expr) \
- do { \
- if (UNLIKELY (!(expr))) \
- ASSERT_FAIL (expr); \
+#define ASSERT_ALWAYS(expr) \
+ do { \
+ if (!(expr)) \
+ ASSERT_FAIL (expr); \
} while (0)
#if WANT_ASSERT
@@ -2407,43 +1932,43 @@ __GMP_DECLSPEC void __gmp_assert_fail (const char *, int, const char *) ATTRIBUT
protection on routines like mpq_equal which give wrong results on
non-canonical inputs. */
#if WANT_ASSERT
-#define ASSERT_MPQ_CANONICAL(q) \
- do { \
- ASSERT (q->_mp_den._mp_size > 0); \
- if (q->_mp_num._mp_size == 0) \
- { \
- /* zero should be 0/1 */ \
- ASSERT (mpz_cmp_ui (mpq_denref(q), 1L) == 0); \
- } \
- else \
- { \
- /* no common factors */ \
- mpz_t __g; \
- mpz_init (__g); \
- mpz_gcd (__g, mpq_numref(q), mpq_denref(q)); \
- ASSERT (mpz_cmp_ui (__g, 1) == 0); \
- mpz_clear (__g); \
- } \
+#define ASSERT_MPQ_CANONICAL(q) \
+ do { \
+ ASSERT (q->_mp_den._mp_size > 0); \
+ if (q->_mp_num._mp_size == 0) \
+ { \
+ /* zero should be 0/1 */ \
+ ASSERT (mpz_cmp_ui (mpq_denref(q), 1L) == 0); \
+ } \
+ else \
+ { \
+ /* no common factors */ \
+ mpz_t __g; \
+ mpz_init (__g); \
+ mpz_gcd (__g, mpq_numref(q), mpq_denref(q)); \
+ ASSERT (mpz_cmp_ui (__g, 1) == 0); \
+ mpz_clear (__g); \
+ } \
} while (0)
#else
-#define ASSERT_MPQ_CANONICAL(q) do {} while (0)
+#define ASSERT_MPQ_CANONICAL(q) do {} while (0)
#endif
/* Check that the nail parts are zero. */
-#define ASSERT_ALWAYS_LIMB(limb) \
- do { \
- mp_limb_t __nail = (limb) & GMP_NAIL_MASK; \
- ASSERT_ALWAYS (__nail == 0); \
+#define ASSERT_ALWAYS_LIMB(limb) \
+ do { \
+ mp_limb_t __nail = (limb) & GMP_NAIL_MASK; \
+ ASSERT_ALWAYS (__nail == 0); \
} while (0)
-#define ASSERT_ALWAYS_MPN(ptr, size) \
- do { \
- /* let whole loop go dead when no nails */ \
- if (GMP_NAIL_BITS != 0) \
- { \
- mp_size_t __i; \
- for (__i = 0; __i < (size); __i++) \
- ASSERT_ALWAYS_LIMB ((ptr)[__i]); \
- } \
+#define ASSERT_ALWAYS_MPN(ptr, size) \
+ do { \
+ /* let whole loop go dead when no nails */ \
+ if (GMP_NAIL_BITS != 0) \
+ { \
+ mp_size_t __i; \
+ for (__i = 0; __i < (size); __i++) \
+ ASSERT_ALWAYS_LIMB ((ptr)[__i]); \
+ } \
} while (0)
#if WANT_ASSERT
#define ASSERT_LIMB(limb) ASSERT_ALWAYS_LIMB (limb)
@@ -2457,25 +1982,25 @@ __GMP_DECLSPEC void __gmp_assert_fail (const char *, int, const char *) ATTRIBUT
/* Assert that an mpn region {ptr,size} is zero, or non-zero.
size==0 is allowed, and in that case {ptr,size} considered to be zero. */
#if WANT_ASSERT
-#define ASSERT_MPN_ZERO_P(ptr,size) \
- do { \
- mp_size_t __i; \
- ASSERT ((size) >= 0); \
- for (__i = 0; __i < (size); __i++) \
- ASSERT ((ptr)[__i] == 0); \
+#define ASSERT_MPN_ZERO_P(ptr,size) \
+ do { \
+ mp_size_t __i; \
+ ASSERT ((size) >= 0); \
+ for (__i = 0; __i < (size); __i++) \
+ ASSERT ((ptr)[__i] == 0); \
} while (0)
-#define ASSERT_MPN_NONZERO_P(ptr,size) \
- do { \
- mp_size_t __i; \
- int __nonzero = 0; \
- ASSERT ((size) >= 0); \
- for (__i = 0; __i < (size); __i++) \
- if ((ptr)[__i] != 0) \
- { \
- __nonzero = 1; \
- break; \
- } \
- ASSERT (__nonzero); \
+#define ASSERT_MPN_NONZERO_P(ptr,size) \
+ do { \
+ mp_size_t __i; \
+ int __nonzero = 0; \
+ ASSERT ((size) >= 0); \
+ for (__i = 0; __i < (size); __i++) \
+ if ((ptr)[__i] != 0) \
+ { \
+ __nonzero = 1; \
+ break; \
+ } \
+ ASSERT (__nonzero); \
} while (0)
#else
#define ASSERT_MPN_ZERO_P(ptr,size) do {} while (0)
@@ -2483,137 +2008,141 @@ __GMP_DECLSPEC void __gmp_assert_fail (const char *, int, const char *) ATTRIBUT
#endif
-#if ! HAVE_NATIVE_mpn_com
-#undef mpn_com
-#define mpn_com(d,s,n) \
- do { \
- mp_ptr __d = (d); \
- mp_srcptr __s = (s); \
- mp_size_t __n = (n); \
- ASSERT (__n >= 1); \
- ASSERT (MPN_SAME_OR_SEPARATE_P (__d, __s, __n)); \
- do \
- *__d++ = (~ *__s++) & GMP_NUMB_MASK; \
- while (--__n); \
+#if HAVE_NATIVE_mpn_com_n
+#define mpn_com_n __MPN(com_n)
+void mpn_com_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_com_n(d,s,n) \
+ do { \
+ mp_ptr __d = (d); \
+ mp_srcptr __s = (s); \
+ mp_size_t __n = (n); \
+ ASSERT (__n >= 1); \
+ ASSERT (MPN_SAME_OR_SEPARATE_P (__d, __s, __n)); \
+ do \
+ *__d++ = (~ *__s++) & GMP_NUMB_MASK; \
+ while (--__n); \
} while (0)
#endif
-#define MPN_LOGOPS_N_INLINE(rp, up, vp, n, operation) \
- do { \
- mp_srcptr __up = (up); \
- mp_srcptr __vp = (vp); \
- mp_ptr __rp = (rp); \
- mp_size_t __n = (n); \
- mp_limb_t __a, __b; \
- ASSERT (__n > 0); \
- ASSERT (MPN_SAME_OR_SEPARATE_P (__rp, __up, __n)); \
- ASSERT (MPN_SAME_OR_SEPARATE_P (__rp, __vp, __n)); \
- __up += __n; \
- __vp += __n; \
- __rp += __n; \
- __n = -__n; \
- do { \
- __a = __up[__n]; \
- __b = __vp[__n]; \
- __rp[__n] = operation; \
- } while (++__n); \
+#define MPN_LOGOPS_N_INLINE(d, s1, s2, n, operation) \
+ do { \
+ mp_ptr __d = (d); \
+ mp_srcptr __s1 = (s1); \
+ mp_srcptr __s2 = (s2); \
+ mp_size_t __n = (n); \
+ ASSERT (__n >= 1); \
+ ASSERT (MPN_SAME_OR_SEPARATE_P (__d, __s1, __n)); \
+ ASSERT (MPN_SAME_OR_SEPARATE_P (__d, __s2, __n)); \
+ do \
+ operation; \
+ while (--__n); \
} while (0)
-
-#if ! HAVE_NATIVE_mpn_and_n
-#undef mpn_and_n
-#define mpn_and_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a & __b)
+#if HAVE_NATIVE_mpn_and_n
+#define mpn_and_n __MPN(and_n)
+void mpn_and_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_and_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ & *__s2++)
#endif
-#if ! HAVE_NATIVE_mpn_andn_n
-#undef mpn_andn_n
-#define mpn_andn_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a & ~__b)
+#if HAVE_NATIVE_mpn_andn_n
+#define mpn_andn_n __MPN(andn_n)
+void mpn_andn_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_andn_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ & ~*__s2++)
#endif
-#if ! HAVE_NATIVE_mpn_nand_n
-#undef mpn_nand_n
-#define mpn_nand_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, ~(__a & __b) & GMP_NUMB_MASK)
+#if HAVE_NATIVE_mpn_nand_n
+#define mpn_nand_n __MPN(nand_n)
+void mpn_nand_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_nand_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = ~(*__s1++ & *__s2++) & GMP_NUMB_MASK)
#endif
-#if ! HAVE_NATIVE_mpn_ior_n
-#undef mpn_ior_n
-#define mpn_ior_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a | __b)
+#if HAVE_NATIVE_mpn_ior_n
+#define mpn_ior_n __MPN(ior_n)
+void mpn_ior_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_ior_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ | *__s2++)
#endif
-#if ! HAVE_NATIVE_mpn_iorn_n
-#undef mpn_iorn_n
-#define mpn_iorn_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, (__a | ~__b) & GMP_NUMB_MASK)
+#if HAVE_NATIVE_mpn_iorn_n
+#define mpn_iorn_n __MPN(iorn_n)
+void mpn_iorn_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_iorn_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = (*__s1++ | ~*__s2++) & GMP_NUMB_MASK)
#endif
-#if ! HAVE_NATIVE_mpn_nior_n
-#undef mpn_nior_n
-#define mpn_nior_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, ~(__a | __b) & GMP_NUMB_MASK)
+#if HAVE_NATIVE_mpn_nior_n
+#define mpn_nior_n __MPN(nior_n)
+void mpn_nior_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_nior_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = ~(*__s1++ | *__s2++) & GMP_NUMB_MASK)
#endif
-#if ! HAVE_NATIVE_mpn_xor_n
-#undef mpn_xor_n
-#define mpn_xor_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, __a ^ __b)
+#if HAVE_NATIVE_mpn_xor_n
+#define mpn_xor_n __MPN(xor_n)
+void mpn_xor_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_xor_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = *__s1++ ^ *__s2++)
#endif
-#if ! HAVE_NATIVE_mpn_xnor_n
-#undef mpn_xnor_n
-#define mpn_xnor_n(rp, up, vp, n) \
- MPN_LOGOPS_N_INLINE (rp, up, vp, n, ~(__a ^ __b) & GMP_NUMB_MASK)
+#if HAVE_NATIVE_mpn_xnor_n
+#define mpn_xnor_n __MPN(xnor_n)
+void mpn_xnor_n __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+#else
+#define mpn_xnor_n(d, s1, s2, n) \
+ MPN_LOGOPS_N_INLINE (d, s1, s2, n, *__d++ = ~(*__s1++ ^ *__s2++) & GMP_NUMB_MASK)
#endif
-#define mpn_trialdiv __MPN(trialdiv)
-__GMP_DECLSPEC mp_limb_t mpn_trialdiv (mp_srcptr, mp_size_t, mp_size_t, int *);
-
-#define mpn_remove __MPN(remove)
-__GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_bitcnt_t);
-
/* ADDC_LIMB sets w=x+y and cout to 0 or 1 for a carry from that addition. */
#if GMP_NAIL_BITS == 0
-#define ADDC_LIMB(cout, w, x, y) \
- do { \
- mp_limb_t __x = (x); \
- mp_limb_t __y = (y); \
- mp_limb_t __w = __x + __y; \
- (w) = __w; \
- (cout) = __w < __x; \
+#define ADDC_LIMB(cout, w, x, y) \
+ do { \
+ mp_limb_t __x = (x); \
+ mp_limb_t __y = (y); \
+ mp_limb_t __w = __x + __y; \
+ (w) = __w; \
+ (cout) = __w < __x; \
} while (0)
#else
-#define ADDC_LIMB(cout, w, x, y) \
- do { \
- mp_limb_t __w; \
- ASSERT_LIMB (x); \
- ASSERT_LIMB (y); \
- __w = (x) + (y); \
- (w) = __w & GMP_NUMB_MASK; \
- (cout) = __w >> GMP_NUMB_BITS; \
+#define ADDC_LIMB(cout, w, x, y) \
+ do { \
+ mp_limb_t __w; \
+ ASSERT_LIMB (x); \
+ ASSERT_LIMB (y); \
+ __w = (x) + (y); \
+ (w) = __w & GMP_NUMB_MASK; \
+ (cout) = __w >> GMP_NUMB_BITS; \
} while (0)
#endif
/* SUBC_LIMB sets w=x-y and cout to 0 or 1 for a borrow from that
subtract. */
#if GMP_NAIL_BITS == 0
-#define SUBC_LIMB(cout, w, x, y) \
- do { \
- mp_limb_t __x = (x); \
- mp_limb_t __y = (y); \
- mp_limb_t __w = __x - __y; \
- (w) = __w; \
- (cout) = __w > __x; \
+#define SUBC_LIMB(cout, w, x, y) \
+ do { \
+ mp_limb_t __x = (x); \
+ mp_limb_t __y = (y); \
+ mp_limb_t __w = __x - __y; \
+ (w) = __w; \
+ (cout) = __w > __x; \
} while (0)
#else
-#define SUBC_LIMB(cout, w, x, y) \
- do { \
- mp_limb_t __w = (x) - (y); \
- (w) = __w & GMP_NUMB_MASK; \
- (cout) = __w >> (GMP_LIMB_BITS-1); \
+#define SUBC_LIMB(cout, w, x, y) \
+ do { \
+ mp_limb_t __w = (x) - (y); \
+ (w) = __w & GMP_NUMB_MASK; \
+ (cout) = __w >> (GMP_LIMB_BITS-1); \
} while (0)
#endif
@@ -2633,170 +2162,160 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_ptr, mp_size_t, m
declaring their operand sizes, then remove the former. This is purely
for the benefit of assertion checking. */
-#if defined (__GNUC__) && GMP_NAIL_BITS == 0 && ! defined (NO_ASM) \
- && (defined(HAVE_HOST_CPU_FAMILY_x86) || defined(HAVE_HOST_CPU_FAMILY_x86_64)) \
- && ! WANT_ASSERT
+#if defined (__GNUC__) && HAVE_HOST_CPU_FAMILY_x86 && GMP_NAIL_BITS == 0 \
+ && BITS_PER_MP_LIMB == 32 && ! defined (NO_ASM) && ! WANT_ASSERT
/* Better flags handling than the generic C gives on i386, saving a few
bytes of code and maybe a cycle or two. */
#define MPN_IORD_U(ptr, incr, aors) \
do { \
mp_ptr __ptr_dummy; \
- if (__builtin_constant_p (incr) && (incr) == 0) \
- { \
- } \
- else if (__builtin_constant_p (incr) && (incr) == 1) \
+ if (__builtin_constant_p (incr) && (incr) == 1) \
{ \
- __asm__ __volatile__ \
- ("\n" ASM_L(top) ":\n" \
- "\t" aors "\t$1, (%0)\n" \
- "\tlea\t%c2(%0), %0\n" \
- "\tjc\t" ASM_L(top) \
- : "=r" (__ptr_dummy) \
- : "0" (ptr), "n" (sizeof(mp_limb_t)) \
- : "memory"); \
+ __asm__ __volatile__ \
+ ("\n" ASM_L(top) ":\n" \
+ "\t" aors " $1, (%0)\n" \
+ "\tleal 4(%0),%0\n" \
+ "\tjc " ASM_L(top) \
+ : "=r" (__ptr_dummy) \
+ : "0" (ptr) \
+ : "memory"); \
} \
else \
{ \
- __asm__ __volatile__ \
- ( aors "\t%2, (%0)\n" \
- "\tjnc\t" ASM_L(done) "\n" \
- ASM_L(top) ":\n" \
- "\t" aors "\t$1, %c3(%0)\n" \
- "\tlea\t%c3(%0), %0\n" \
- "\tjc\t" ASM_L(top) "\n" \
- ASM_L(done) ":\n" \
- : "=r" (__ptr_dummy) \
- : "0" (ptr), \
- "ri" ((mp_limb_t) (incr)), "n" (sizeof(mp_limb_t)) \
- : "memory"); \
+ __asm__ __volatile__ \
+ ( aors " %2,(%0)\n" \
+ "\tjnc " ASM_L(done) "\n" \
+ ASM_L(top) ":\n" \
+ "\t" aors " $1,4(%0)\n" \
+ "\tleal 4(%0),%0\n" \
+ "\tjc " ASM_L(top) "\n" \
+ ASM_L(done) ":\n" \
+ : "=r" (__ptr_dummy) \
+ : "0" (ptr), \
+ "ri" (incr) \
+ : "memory"); \
} \
} while (0)
-#if GMP_LIMB_BITS == 32
#define MPN_INCR_U(ptr, size, incr) MPN_IORD_U (ptr, incr, "addl")
#define MPN_DECR_U(ptr, size, incr) MPN_IORD_U (ptr, incr, "subl")
-#endif
-#if GMP_LIMB_BITS == 64
-#define MPN_INCR_U(ptr, size, incr) MPN_IORD_U (ptr, incr, "addq")
-#define MPN_DECR_U(ptr, size, incr) MPN_IORD_U (ptr, incr, "subq")
-#endif
#define mpn_incr_u(ptr, incr) MPN_INCR_U (ptr, 0, incr)
#define mpn_decr_u(ptr, incr) MPN_DECR_U (ptr, 0, incr)
#endif
#if GMP_NAIL_BITS == 0
#ifndef mpn_incr_u
-#define mpn_incr_u(p,incr) \
- do { \
- mp_limb_t __x; \
- mp_ptr __p = (p); \
- if (__builtin_constant_p (incr) && (incr) == 1) \
- { \
- while (++(*(__p++)) == 0) \
- ; \
- } \
- else \
- { \
- __x = *__p + (incr); \
- *__p = __x; \
- if (__x < (incr)) \
- while (++(*(++__p)) == 0) \
- ; \
- } \
+#define mpn_incr_u(p,incr) \
+ do { \
+ mp_limb_t __x; \
+ mp_ptr __p = (p); \
+ if (__builtin_constant_p (incr) && (incr) == 1) \
+ { \
+ while (++(*(__p++)) == 0) \
+ ; \
+ } \
+ else \
+ { \
+ __x = *__p + (incr); \
+ *__p = __x; \
+ if (__x < (incr)) \
+ while (++(*(++__p)) == 0) \
+ ; \
+ } \
} while (0)
#endif
#ifndef mpn_decr_u
-#define mpn_decr_u(p,incr) \
- do { \
- mp_limb_t __x; \
- mp_ptr __p = (p); \
- if (__builtin_constant_p (incr) && (incr) == 1) \
- { \
- while ((*(__p++))-- == 0) \
- ; \
- } \
- else \
- { \
- __x = *__p; \
- *__p = __x - (incr); \
- if (__x < (incr)) \
- while ((*(++__p))-- == 0) \
- ; \
- } \
+#define mpn_decr_u(p,incr) \
+ do { \
+ mp_limb_t __x; \
+ mp_ptr __p = (p); \
+ if (__builtin_constant_p (incr) && (incr) == 1) \
+ { \
+ while ((*(__p++))-- == 0) \
+ ; \
+ } \
+ else \
+ { \
+ __x = *__p; \
+ *__p = __x - (incr); \
+ if (__x < (incr)) \
+ while ((*(++__p))-- == 0) \
+ ; \
+ } \
} while (0)
#endif
#endif
#if GMP_NAIL_BITS >= 1
#ifndef mpn_incr_u
-#define mpn_incr_u(p,incr) \
- do { \
- mp_limb_t __x; \
- mp_ptr __p = (p); \
- if (__builtin_constant_p (incr) && (incr) == 1) \
- { \
- do \
- { \
- __x = (*__p + 1) & GMP_NUMB_MASK; \
- *__p++ = __x; \
- } \
- while (__x == 0); \
- } \
- else \
- { \
- __x = (*__p + (incr)); \
- *__p++ = __x & GMP_NUMB_MASK; \
- if (__x >> GMP_NUMB_BITS != 0) \
- { \
- do \
- { \
- __x = (*__p + 1) & GMP_NUMB_MASK; \
- *__p++ = __x; \
- } \
- while (__x == 0); \
- } \
- } \
+#define mpn_incr_u(p,incr) \
+ do { \
+ mp_limb_t __x; \
+ mp_ptr __p = (p); \
+ if (__builtin_constant_p (incr) && (incr) == 1) \
+ { \
+ do \
+ { \
+ __x = (*__p + 1) & GMP_NUMB_MASK; \
+ *__p++ = __x; \
+ } \
+ while (__x == 0); \
+ } \
+ else \
+ { \
+ __x = (*__p + (incr)); \
+ *__p++ = __x & GMP_NUMB_MASK; \
+ if (__x >> GMP_NUMB_BITS != 0) \
+ { \
+ do \
+ { \
+ __x = (*__p + 1) & GMP_NUMB_MASK; \
+ *__p++ = __x; \
+ } \
+ while (__x == 0); \
+ } \
+ } \
} while (0)
#endif
#ifndef mpn_decr_u
-#define mpn_decr_u(p,incr) \
- do { \
- mp_limb_t __x; \
- mp_ptr __p = (p); \
- if (__builtin_constant_p (incr) && (incr) == 1) \
- { \
- do \
- { \
- __x = *__p; \
- *__p++ = (__x - 1) & GMP_NUMB_MASK; \
- } \
- while (__x == 0); \
- } \
- else \
- { \
- __x = *__p - (incr); \
- *__p++ = __x & GMP_NUMB_MASK; \
- if (__x >> GMP_NUMB_BITS != 0) \
- { \
- do \
- { \
- __x = *__p; \
- *__p++ = (__x - 1) & GMP_NUMB_MASK; \
- } \
- while (__x == 0); \
- } \
- } \
+#define mpn_decr_u(p,incr) \
+ do { \
+ mp_limb_t __x; \
+ mp_ptr __p = (p); \
+ if (__builtin_constant_p (incr) && (incr) == 1) \
+ { \
+ do \
+ { \
+ __x = *__p; \
+ *__p++ = (__x - 1) & GMP_NUMB_MASK; \
+ } \
+ while (__x == 0); \
+ } \
+ else \
+ { \
+ __x = *__p - (incr); \
+ *__p++ = __x & GMP_NUMB_MASK; \
+ if (__x >> GMP_NUMB_BITS != 0) \
+ { \
+ do \
+ { \
+ __x = *__p; \
+ *__p++ = (__x - 1) & GMP_NUMB_MASK; \
+ } \
+ while (__x == 0); \
+ } \
+ } \
} while (0)
#endif
#endif
#ifndef MPN_INCR_U
#if WANT_ASSERT
-#define MPN_INCR_U(ptr, size, n) \
- do { \
- ASSERT ((size) >= 1); \
- ASSERT_NOCARRY (mpn_add_1 (ptr, ptr, size, n)); \
+#define MPN_INCR_U(ptr, size, n) \
+ do { \
+ ASSERT ((size) >= 1); \
+ ASSERT_NOCARRY (mpn_add_1 (ptr, ptr, size, n)); \
} while (0)
#else
#define MPN_INCR_U(ptr, size, n) mpn_incr_u (ptr, n)
@@ -2805,10 +2324,10 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_ptr, mp_size_t, m
#ifndef MPN_DECR_U
#if WANT_ASSERT
-#define MPN_DECR_U(ptr, size, n) \
- do { \
- ASSERT ((size) >= 1); \
- ASSERT_NOCARRY (mpn_sub_1 (ptr, ptr, size, n)); \
+#define MPN_DECR_U(ptr, size, n) \
+ do { \
+ ASSERT ((size) >= 1); \
+ ASSERT_NOCARRY (mpn_sub_1 (ptr, ptr, size, n)); \
} while (0)
#else
#define MPN_DECR_U(ptr, size, n) mpn_decr_u (ptr, n)
@@ -2816,7 +2335,8 @@ __GMP_DECLSPEC mp_bitcnt_t mpn_remove (mp_ptr, mp_size_t *, mp_ptr, mp_size_t, m
#endif
-/* Structure for conversion between internal binary format and strings. */
+/* Structure for conversion between internal binary format and
+ strings in base 2..36. */
struct bases
{
/* Number of digits in the conversion base that always fits in an mp_limb_t.
@@ -2825,45 +2345,24 @@ struct bases
int chars_per_limb;
/* log(2)/log(conversion_base) */
- mp_limb_t logb2;
-
- /* log(conversion_base)/log(2) */
- mp_limb_t log2b;
+ double chars_per_bit_exactly;
/* base**chars_per_limb, i.e. the biggest number that fits a word, built by
factors of base. Exception: For 2, 4, 8, etc, big_base is log2(base),
i.e. the number of bits used to represent each digit in the base. */
mp_limb_t big_base;
- /* A GMP_LIMB_BITS bit approximation to 1/big_base, represented as a
+ /* A BITS_PER_MP_LIMB bit approximation to 1/big_base, represented as a
fixed-point number. Instead of dividing by big_base an application can
choose to multiply by big_base_inverted. */
mp_limb_t big_base_inverted;
};
#define mp_bases __MPN(bases)
+#define __mp_bases __MPN(bases)
__GMP_DECLSPEC extern const struct bases mp_bases[257];
-/* Compute the number of digits in base for nbits bits, making sure the result
- is never too small. The two variants of the macro implement the same
- function; the GT2 variant below works just for bases > 2. */
-#define DIGITS_IN_BASE_FROM_BITS(res, nbits, b) \
- do { \
- mp_limb_t _ph, _dummy; \
- size_t _nbits = (nbits); \
- umul_ppmm (_ph, _dummy, mp_bases[b].logb2, _nbits); \
- _ph += (_dummy + _nbits < _dummy); \
- res = _ph + 1; \
- } while (0)
-#define DIGITS_IN_BASEGT2_FROM_BITS(res, nbits, b) \
- do { \
- mp_limb_t _ph, _dummy; \
- size_t _nbits = (nbits); \
- umul_ppmm (_ph, _dummy, mp_bases[b].logb2 + 1, _nbits); \
- res = _ph + 1; \
- } while (0)
-
/* For power of 2 bases this is exact. For other bases the result is either
exact or one too big.
@@ -2873,48 +2372,55 @@ __GMP_DECLSPEC extern const struct bases mp_bases[257];
limbs to increase the probability of being exact, but that doesn't seem
worth bothering with. */
-#define MPN_SIZEINBASE(result, ptr, size, base) \
- do { \
- int __lb_base, __cnt; \
- size_t __totbits; \
- \
- ASSERT ((size) >= 0); \
- ASSERT ((base) >= 2); \
- ASSERT ((base) < numberof (mp_bases)); \
- \
- /* Special case for X == 0. */ \
- if ((size) == 0) \
- (result) = 1; \
- else \
- { \
- /* Calculate the total number of significant bits of X. */ \
- count_leading_zeros (__cnt, (ptr)[(size)-1]); \
- __totbits = (size_t) (size) * GMP_NUMB_BITS - (__cnt - GMP_NAIL_BITS);\
- \
- if (POW2_P (base)) \
- { \
- __lb_base = mp_bases[base].big_base; \
- (result) = (__totbits + __lb_base - 1) / __lb_base; \
- } \
- else \
- { \
- DIGITS_IN_BASEGT2_FROM_BITS (result, __totbits, base); \
- } \
- } \
+#define MPN_SIZEINBASE(result, ptr, size, base) \
+ do { \
+ int __lb_base, __cnt; \
+ size_t __totbits; \
+ \
+ ASSERT ((size) >= 0); \
+ ASSERT ((base) >= 2); \
+ ASSERT ((base) < numberof (mp_bases)); \
+ \
+ /* Special case for X == 0. */ \
+ if ((size) == 0) \
+ (result) = 1; \
+ else \
+ { \
+ /* Calculate the total number of significant bits of X. */ \
+ count_leading_zeros (__cnt, (ptr)[(size)-1]); \
+ __totbits = (size_t) (size) * GMP_NUMB_BITS - (__cnt - GMP_NAIL_BITS);\
+ \
+ if (POW2_P (base)) \
+ { \
+ __lb_base = mp_bases[base].big_base; \
+ (result) = (__totbits + __lb_base - 1) / __lb_base; \
+ } \
+ else \
+ (result) = (size_t) \
+ (__totbits * mp_bases[base].chars_per_bit_exactly) + 1; \
+ } \
} while (0)
-#define MPN_SIZEINBASE_2EXP(result, ptr, size, base2exp) \
- do { \
- int __cnt; \
- mp_bitcnt_t __totbits; \
- ASSERT ((size) > 0); \
- ASSERT ((ptr)[(size)-1] != 0); \
- count_leading_zeros (__cnt, (ptr)[(size)-1]); \
- __totbits = (mp_bitcnt_t) (size) * GMP_NUMB_BITS - (__cnt - GMP_NAIL_BITS); \
- (result) = (__totbits + (base2exp)-1) / (base2exp); \
+/* eliminate mp_bases lookups for base==16 */
+#define MPN_SIZEINBASE_16(result, ptr, size) \
+ do { \
+ int __cnt; \
+ mp_size_t __totbits; \
+ \
+ ASSERT ((size) >= 0); \
+ \
+ /* Special case for X == 0. */ \
+ if ((size) == 0) \
+ (result) = 1; \
+ else \
+ { \
+ /* Calculate the total number of significant bits of X. */ \
+ count_leading_zeros (__cnt, (ptr)[(size)-1]); \
+ __totbits = (size_t) (size) * GMP_NUMB_BITS - (__cnt - GMP_NAIL_BITS);\
+ (result) = (__totbits + 4 - 1) / 4; \
+ } \
} while (0)
-
/* bit count to limb count, rounding up */
#define BITS_TO_LIMBS(n) (((n) + (GMP_NUMB_BITS - 1)) / GMP_NUMB_BITS)
@@ -2924,27 +2430,27 @@ __GMP_DECLSPEC extern const struct bases mp_bases[257];
#if BITS_PER_ULONG <= GMP_NUMB_BITS /* need one limb per ulong */
#define LIMBS_PER_ULONG 1
-#define MPN_SET_UI(zp, zn, u) \
- (zp)[0] = (u); \
+#define MPN_SET_UI(zp, zn, u) \
+ (zp)[0] = (u); \
(zn) = ((zp)[0] != 0);
-#define MPZ_FAKE_UI(z, zp, u) \
- (zp)[0] = (u); \
- PTR (z) = (zp); \
- SIZ (z) = ((zp)[0] != 0); \
+#define MPZ_FAKE_UI(z, zp, u) \
+ (zp)[0] = (u); \
+ PTR (z) = (zp); \
+ SIZ (z) = ((zp)[0] != 0); \
ASSERT_CODE (ALLOC (z) = 1);
#else /* need two limbs per ulong */
#define LIMBS_PER_ULONG 2
-#define MPN_SET_UI(zp, zn, u) \
- (zp)[0] = (u) & GMP_NUMB_MASK; \
- (zp)[1] = (u) >> GMP_NUMB_BITS; \
+#define MPN_SET_UI(zp, zn, u) \
+ (zp)[0] = (u) & GMP_NUMB_MASK; \
+ (zp)[1] = (u) >> GMP_NUMB_BITS; \
(zn) = ((zp)[1] != 0 ? 2 : (zp)[0] != 0 ? 1 : 0);
-#define MPZ_FAKE_UI(z, zp, u) \
- (zp)[0] = (u) & GMP_NUMB_MASK; \
- (zp)[1] = (u) >> GMP_NUMB_BITS; \
- SIZ (z) = ((zp)[1] != 0 ? 2 : (zp)[0] != 0 ? 1 : 0); \
- PTR (z) = (zp); \
+#define MPZ_FAKE_UI(z, zp, u) \
+ (zp)[0] = (u) & GMP_NUMB_MASK; \
+ (zp)[1] = (u) >> GMP_NUMB_BITS; \
+ SIZ (z) = ((zp)[1] != 0 ? 2 : (zp)[0] != 0 ? 1 : 0); \
+ PTR (z) = (zp); \
ASSERT_CODE (ALLOC (z) = 2);
#endif
@@ -2970,182 +2476,183 @@ __GMP_DECLSPEC extern const struct bases mp_bases[257];
shift on past versions too (in particular since an important use of
LIMB_HIGHBIT_TO_MASK is in udiv_qrnnd_preinv). */
-#define LIMB_HIGHBIT_TO_MASK(n) \
- (((mp_limb_signed_t) -1 >> 1) < 0 \
- ? (mp_limb_signed_t) (n) >> (GMP_LIMB_BITS - 1) \
+#define LIMB_HIGHBIT_TO_MASK(n) \
+ (((mp_limb_signed_t) -1 >> 1) < 0 \
+ ? (mp_limb_signed_t) (n) >> (GMP_LIMB_BITS - 1) \
: (n) & GMP_LIMB_HIGHBIT ? MP_LIMB_T_MAX : CNST_LIMB(0))
/* Use a library function for invert_limb, if available. */
-#define mpn_invert_limb __MPN(invert_limb)
-__GMP_DECLSPEC mp_limb_t mpn_invert_limb (mp_limb_t) ATTRIBUTE_CONST;
+#define mpn_invert_limb __MPN(invert_limb)
+mp_limb_t mpn_invert_limb __GMP_PROTO ((mp_limb_t)) ATTRIBUTE_CONST;
#if ! defined (invert_limb) && HAVE_NATIVE_mpn_invert_limb
-#define invert_limb(invxl,xl) \
- do { \
- (invxl) = mpn_invert_limb (xl); \
+#define invert_limb(invxl,xl) \
+ do { \
+ (invxl) = mpn_invert_limb (xl); \
} while (0)
#endif
#ifndef invert_limb
-#define invert_limb(invxl,xl) \
- do { \
- mp_limb_t _dummy; \
- ASSERT ((xl) != 0); \
- udiv_qrnnd (invxl, _dummy, ~(xl), ~CNST_LIMB(0), xl); \
+#define invert_limb(invxl,xl) \
+ do { \
+ mp_limb_t dummy; \
+ ASSERT ((xl) != 0); \
+ udiv_qrnnd (invxl, dummy, ~(xl), ~CNST_LIMB(0), xl); \
} while (0)
#endif
-#define invert_pi1(dinv, d1, d0) \
+#ifndef udiv_qrnnd_preinv
+#define udiv_qrnnd_preinv udiv_qrnnd_preinv3
+#endif
+
+/* Divide the two-limb number in (NH,,NL) by D, with DI being the largest
+ limb not larger than (2**(2*BITS_PER_MP_LIMB))/D - (2**BITS_PER_MP_LIMB).
+ If this would yield overflow, DI should be the largest possible number
+ (i.e., only ones). For correct operation, the most significant bit of D
+ has to be set. Put the quotient in Q and the remainder in R. */
+#define udiv_qrnnd_preinv1(q, r, nh, nl, d, di) \
do { \
- mp_limb_t _v, _p, _t1, _t0, _mask; \
- invert_limb (_v, d1); \
- _p = (d1) * _v; \
- _p += (d0); \
- if (_p < (d0)) \
- { \
- _v--; \
- _mask = -(mp_limb_t) (_p >= (d1)); \
- _p -= (d1); \
- _v += _mask; \
- _p -= _mask & (d1); \
- } \
- umul_ppmm (_t1, _t0, d0, _v); \
- _p += _t1; \
- if (_p < _t1) \
+ mp_limb_t _q, _ql, _r; \
+ mp_limb_t _xh, _xl; \
+ ASSERT ((d) != 0); \
+ umul_ppmm (_q, _ql, (nh), (di)); \
+ _q += (nh); /* Compensate, di is 2**GMP_LIMB_BITS too small */ \
+ umul_ppmm (_xh, _xl, _q, (d)); \
+ sub_ddmmss (_xh, _r, (nh), (nl), _xh, _xl); \
+ if (_xh != 0) \
{ \
- _v--; \
- if (UNLIKELY (_p >= (d1))) \
+ sub_ddmmss (_xh, _r, _xh, _r, 0, (d)); \
+ _q += 1; \
+ if (_xh != 0) \
{ \
- if (_p > (d1) || _t0 >= (d0)) \
- _v--; \
+ _r -= (d); \
+ _q += 1; \
} \
} \
- (dinv).inv32 = _v; \
+ if (_r >= (d)) \
+ { \
+ _r -= (d); \
+ _q += 1; \
+ } \
+ (r) = _r; \
+ (q) = _q; \
+ } while (0)
+
+/* Like udiv_qrnnd_preinv, but branch-free. */
+#define udiv_qrnnd_preinv2(q, r, nh, nl, d, di) \
+ do { \
+ mp_limb_t _n2, _n10, _nmask, _nadj, _q1; \
+ mp_limb_t _xh, _xl; \
+ _n2 = (nh); \
+ _n10 = (nl); \
+ _nmask = LIMB_HIGHBIT_TO_MASK (_n10); \
+ _nadj = _n10 + (_nmask & (d)); \
+ umul_ppmm (_xh, _xl, di, _n2 - _nmask); \
+ add_ssaaaa (_xh, _xl, _xh, _xl, _n2, _nadj); \
+ _q1 = ~_xh; \
+ umul_ppmm (_xh, _xl, _q1, d); \
+ add_ssaaaa (_xh, _xl, _xh, _xl, nh, nl); \
+ _xh -= (d); /* xh = 0 or -1 */ \
+ (r) = _xl + ((d) & _xh); \
+ (q) = _xh - _q1; \
+ } while (0)
+
+/* Like udiv_qrnnd_preinv2, but for for any value D. DNORM is D shifted left
+ so that its most significant bit is set. LGUP is ceil(log2(D)). */
+#define udiv_qrnnd_preinv2gen(q, r, nh, nl, d, di, dnorm, lgup) \
+ do { \
+ mp_limb_t _n2, _n10, _nmask, _nadj, _q1; \
+ mp_limb_t _xh, _xl; \
+ _n2 = ((nh) << (BITS_PER_MP_LIMB - (lgup))) + ((nl) >> 1 >> (l - 1));\
+ _n10 = (nl) << (BITS_PER_MP_LIMB - (lgup)); \
+ _nmask = LIMB_HIGHBIT_TO_MASK (_n10); \
+ _nadj = _n10 + (_nmask & (dnorm)); \
+ umul_ppmm (_xh, _xl, di, _n2 - _nmask); \
+ add_ssaaaa (_xh, _xl, _xh, _xl, _n2, _nadj); \
+ _q1 = ~_xh; \
+ umul_ppmm (_xh, _xl, _q1, d); \
+ add_ssaaaa (_xh, _xl, _xh, _xl, nh, nl); \
+ _xh -= (d); \
+ (r) = _xl + ((d) & _xh); \
+ (q) = _xh - _q1; \
} while (0)
+/* udiv_qrnnd_preinv3 -- 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);
- _t = _r + (d);
- if (_r >= _ql)
- {
- _qh--;
- _r = _t;
- }
+
+ _r = (nl) - _qh * (d);
+ _t = _r + (d);
+ if (_r >= _ql)
+ {
+ _qh--;
+ _r = _t;
+ }
+
For one operation shorter critical path, one may want to use this form:
- _p = _qh * (d)
- _s = (nl) + (d);
- _r = (nl) - _p;
- _t = _s - _p;
- if (_r >= _ql)
- {
- _qh--;
- _r = _t;
- }
+
+ _p = _qh * (d)
+ _s = (nl) + (d);
+ _r = (nl) - _p;
+ _t = _s - _p;
+ if (_r >= _ql)
+ {
+ _qh--;
+ _r = _t;
+ }
*/
-#define udiv_qrnnd_preinv(q, r, nh, nl, d, di) \
+#define udiv_qrnnd_preinv3(q, r, nh, nl, d, di) \
do { \
- mp_limb_t _qh, _ql, _r, _mask; \
+ mp_limb_t _qh, _ql, _r; \
umul_ppmm (_qh, _ql, (nh), (di)); \
if (__builtin_constant_p (nl) && (nl) == 0) \
+ _qh += (nh) + 1; \
+ else \
+ add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
+ _r = (nl) - _qh * (d); \
+ if (_r > _ql) /* both > and >= should be OK */ \
{ \
- _qh += (nh) + 1; \
- _r = - _qh * (d); \
- _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \
- _qh += _mask; \
- _r += _mask & (d); \
+ _r += (d); \
+ _qh--; \
} \
- else \
+ if (UNLIKELY (_r >= (d))) \
{ \
- add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
- _r = (nl) - _qh * (d); \
- _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \
- _qh += _mask; \
- _r += _mask & (d); \
- if (UNLIKELY (_r >= (d))) \
- { \
- _r -= (d); \
- _qh++; \
- } \
+ _r -= (d); \
+ _qh++; \
} \
(r) = _r; \
(q) = _qh; \
} while (0)
-/* Dividing (NH, NL) by D, returning the remainder only. Unlike
- udiv_qrnnd_preinv, works also for the case NH == D, where the
- quotient doesn't quite fit in a single limb. */
-#define udiv_rnnd_preinv(r, nh, nl, d, di) \
+/* Compute r = nh*B mod d, where di is the inverse of d. */
+#define udiv_rnd_preinv(r, nh, d, di) \
do { \
- mp_limb_t _qh, _ql, _r, _mask; \
+ mp_limb_t _qh, _ql, _r; \
umul_ppmm (_qh, _ql, (nh), (di)); \
- if (__builtin_constant_p (nl) && (nl) == 0) \
- { \
- _r = ~(_qh + (nh)) * (d); \
- _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \
- _r += _mask & (d); \
- } \
- else \
- { \
- add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
- _r = (nl) - _qh * (d); \
- _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \
- _r += _mask & (d); \
- if (UNLIKELY (_r >= (d))) \
- _r -= (d); \
- } \
+ _qh += (nh) + 1; \
+ _r = - _qh * (d); \
+ if (_r > _ql) \
+ _r += (d); \
(r) = _r; \
} while (0)
-/* Compute quotient the quotient and remainder for n / d. Requires d
- >= B^2 / 2 and n < d B. di is the inverse
-
- floor ((B^3 - 1) / (d0 + d1 B)) - B.
-
- NOTE: Output variables are updated multiple times. Only some inputs
- and outputs may overlap.
-*/
-#define udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \
- do { \
- mp_limb_t _q0, _t1, _t0, _mask; \
- umul_ppmm ((q), _q0, (n2), (dinv)); \
- add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1)); \
- \
- /* Compute the two most significant limbs of n - q'd */ \
- (r1) = (n1) - (d1) * (q); \
- sub_ddmmss ((r1), (r0), (r1), (n0), (d1), (d0)); \
- umul_ppmm (_t1, _t0, (d0), (q)); \
- sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0); \
- (q)++; \
- \
- /* Conditionally adjust q and the remainders */ \
- _mask = - (mp_limb_t) ((r1) >= _q0); \
- (q) += _mask; \
- add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \
- if (UNLIKELY ((r1) >= (d1))) \
- { \
- if ((r1) > (d1) || (r0) >= (d0)) \
- { \
- (q)++; \
- sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \
- } \
- } \
- } while (0)
-
#ifndef mpn_preinv_divrem_1 /* if not done with cpuvec in a fat binary */
#define mpn_preinv_divrem_1 __MPN(preinv_divrem_1)
-__GMP_DECLSPEC mp_limb_t mpn_preinv_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int);
+mp_limb_t mpn_preinv_divrem_1 __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, int));
#endif
-/* USE_PREINV_DIVREM_1 is whether to use mpn_preinv_divrem_1, as opposed to the
- plain mpn_divrem_1. The default is yes, since the few CISC chips where
- preinv is not good have defines saying so. */
+/* USE_PREINV_DIVREM_1 is whether to use mpn_preinv_divrem_1, as opposed to
+ the plain mpn_divrem_1. Likewise USE_PREINV_MOD_1 chooses between
+ mpn_preinv_mod_1 and plain mpn_mod_1. The default for both is yes, since
+ the few CISC chips where preinv is not good have defines saying so. */
#ifndef USE_PREINV_DIVREM_1
#define USE_PREINV_DIVREM_1 1
#endif
+#ifndef USE_PREINV_MOD_1
+#define USE_PREINV_MOD_1 1
+#endif
#if USE_PREINV_DIVREM_1
#define MPN_DIVREM_OR_PREINV_DIVREM_1(qp,xsize,ap,size,d,dinv,shift) \
@@ -3155,70 +2662,68 @@ __GMP_DECLSPEC mp_limb_t mpn_preinv_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_s
mpn_divrem_1 (qp, xsize, ap, size, d)
#endif
-#ifndef PREINV_MOD_1_TO_MOD_1_THRESHOLD
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 10
+#if USE_PREINV_MOD_1
+#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \
+ mpn_preinv_mod_1 (src, size, divisor, inverse)
+#else
+#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \
+ mpn_mod_1 (src, size, divisor)
#endif
-/* This selection may seem backwards. The reason mpn_mod_1 typically takes
- over for larger sizes is that it uses the mod_1_1 function. */
-#define MPN_MOD_OR_PREINV_MOD_1(src,size,divisor,inverse) \
- (BELOW_THRESHOLD (size, PREINV_MOD_1_TO_MOD_1_THRESHOLD) \
- ? mpn_preinv_mod_1 (src, size, divisor, inverse) \
- : mpn_mod_1 (src, size, divisor))
-
#ifndef mpn_mod_34lsub1 /* if not done with cpuvec in a fat binary */
-#define mpn_mod_34lsub1 __MPN(mod_34lsub1)
-__GMP_DECLSPEC mp_limb_t mpn_mod_34lsub1 (mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
+#define mpn_mod_34lsub1 __MPN(mod_34lsub1)
+mp_limb_t mpn_mod_34lsub1 __GMP_PROTO ((mp_srcptr, mp_size_t)) __GMP_ATTRIBUTE_PURE;
#endif
/* DIVEXACT_1_THRESHOLD is at what size to use mpn_divexact_1, as opposed to
- plain mpn_divrem_1. Likewise BMOD_1_TO_MOD_1_THRESHOLD for
+ plain mpn_divrem_1. Likewise MODEXACT_1_ODD_THRESHOLD for
mpn_modexact_1_odd against plain mpn_mod_1. On most CPUs divexact and
modexact are faster at all sizes, so the defaults are 0. Those CPUs
where this is not right have a tuned threshold. */
#ifndef DIVEXACT_1_THRESHOLD
#define DIVEXACT_1_THRESHOLD 0
#endif
-#ifndef BMOD_1_TO_MOD_1_THRESHOLD
-#define BMOD_1_TO_MOD_1_THRESHOLD 10
+#ifndef MODEXACT_1_ODD_THRESHOLD
+#define MODEXACT_1_ODD_THRESHOLD 0
#endif
#ifndef mpn_divexact_1 /* if not done with cpuvec in a fat binary */
#define mpn_divexact_1 __MPN(divexact_1)
-__GMP_DECLSPEC void mpn_divexact_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-#endif
-
-#define MPN_DIVREM_OR_DIVEXACT_1(rp, up, n, d) \
- do { \
- if (BELOW_THRESHOLD (n, DIVEXACT_1_THRESHOLD)) \
- ASSERT_NOCARRY (mpn_divrem_1 (rp, (mp_size_t) 0, up, n, d)); \
- else \
- { \
- ASSERT (mpn_mod_1 (up, n, d) == 0); \
- mpn_divexact_1 (rp, up, n, d); \
- } \
+void mpn_divexact_1 __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
+#endif
+
+#define MPN_DIVREM_OR_DIVEXACT_1(dst, src, size, divisor) \
+ do { \
+ if (BELOW_THRESHOLD (size, DIVEXACT_1_THRESHOLD)) \
+ ASSERT_NOCARRY (mpn_divrem_1 (dst, (mp_size_t) 0, src, size, divisor)); \
+ else \
+ { \
+ ASSERT (mpn_mod_1 (src, size, divisor) == 0); \
+ mpn_divexact_1 (dst, src, size, divisor); \
+ } \
} while (0)
#ifndef mpn_modexact_1c_odd /* if not done with cpuvec in a fat binary */
-#define mpn_modexact_1c_odd __MPN(modexact_1c_odd)
-__GMP_DECLSPEC mp_limb_t mpn_modexact_1c_odd (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+#define mpn_modexact_1c_odd __MPN(modexact_1c_odd)
+mp_limb_t mpn_modexact_1c_odd __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
#endif
#if HAVE_NATIVE_mpn_modexact_1_odd
#define mpn_modexact_1_odd __MPN(modexact_1_odd)
-__GMP_DECLSPEC mp_limb_t mpn_modexact_1_odd (mp_srcptr, mp_size_t, mp_limb_t) __GMP_ATTRIBUTE_PURE;
+mp_limb_t mpn_modexact_1_odd __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t)) __GMP_ATTRIBUTE_PURE;
#else
#define mpn_modexact_1_odd(src,size,divisor) \
mpn_modexact_1c_odd (src, size, divisor, CNST_LIMB(0))
#endif
#define MPN_MOD_OR_MODEXACT_1_ODD(src,size,divisor) \
- (BELOW_THRESHOLD (size, BMOD_1_TO_MOD_1_THRESHOLD) \
+ (ABOVE_THRESHOLD (size, MODEXACT_1_ODD_THRESHOLD) \
? mpn_modexact_1_odd (src, size, divisor) \
: mpn_mod_1 (src, size, divisor))
+
/* binvert_limb() sets inv to the multiplicative inverse of n modulo
2^GMP_NUMB_BITS, ie. satisfying inv*n == 1 mod 2^GMP_NUMB_BITS.
n must be odd (otherwise such an inverse doesn't exist).
@@ -3293,17 +2798,17 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
\
if ((a) <= (d)) \
{ \
- /* small a is reasonably likely */ \
- (r) = (d) - (a); \
+ /* small a is reasonably likely */ \
+ (r) = (d) - (a); \
} \
else \
{ \
- unsigned __twos; \
- mp_limb_t __dnorm; \
- count_leading_zeros (__twos, d); \
- __twos -= GMP_NAIL_BITS; \
- __dnorm = (d) << __twos; \
- (r) = ((a) <= __dnorm ? __dnorm : 2*__dnorm) - (a); \
+ unsigned __twos; \
+ mp_limb_t __dnorm; \
+ count_leading_zeros (__twos, d); \
+ __twos -= GMP_NAIL_BITS; \
+ __dnorm = (d) << __twos; \
+ (r) = ((a) <= __dnorm ? __dnorm : 2*__dnorm) - (a); \
} \
\
ASSERT_LIMB (r); \
@@ -3376,8 +2881,8 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
int __p = 0; \
do \
{ \
- __p ^= 0x96696996L >> (__n & 0x1F); \
- __n >>= 5; \
+ __p ^= 0x96696996L >> (__n & 0x1F); \
+ __n >>= 5; \
} \
while (__n != 0); \
\
@@ -3390,7 +2895,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
version 3.1 at least) doesn't seem to know how to generate rlwimi for
anything other than bit-fields, so use "asm". */
#if defined (__GNUC__) && ! defined (NO_ASM) \
- && HAVE_HOST_CPU_FAMILY_powerpc && GMP_LIMB_BITS == 32
+ && HAVE_HOST_CPU_FAMILY_powerpc && BITS_PER_MP_LIMB == 32
#define BSWAP_LIMB(dst, src) \
do { \
mp_limb_t __bswapl_src = (src); \
@@ -3411,7 +2916,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
partial register stalls on P6 chips. */
#if defined (__GNUC__) && ! defined (NO_ASM) \
&& HAVE_HOST_CPU_FAMILY_x86 && ! HAVE_HOST_CPU_i386 \
- && GMP_LIMB_BITS == 32
+ && BITS_PER_MP_LIMB == 32
#define BSWAP_LIMB(dst, src) \
do { \
__asm__ ("bswap %0" : "=r" (dst) : "0" (src)); \
@@ -3419,7 +2924,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
#endif
#if defined (__GNUC__) && ! defined (NO_ASM) \
- && defined (__amd64__) && GMP_LIMB_BITS == 64
+ && defined (__amd64__) && BITS_PER_MP_LIMB == 64
#define BSWAP_LIMB(dst, src) \
do { \
__asm__ ("bswap %q0" : "=r" (dst) : "0" (src)); \
@@ -3436,7 +2941,7 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
/* As per glibc. */
#if defined (__GNUC__) && ! defined (NO_ASM) \
- && HAVE_HOST_CPU_FAMILY_m68k && GMP_LIMB_BITS == 32
+ && HAVE_HOST_CPU_FAMILY_m68k && BITS_PER_MP_LIMB == 32
#define BSWAP_LIMB(dst, src) \
do { \
mp_limb_t __bswapl_src = (src); \
@@ -3449,65 +2954,65 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
#endif
#if ! defined (BSWAP_LIMB)
-#if GMP_LIMB_BITS == 8
-#define BSWAP_LIMB(dst, src) \
+#if BITS_PER_MP_LIMB == 8
+#define BSWAP_LIMB(dst, src) \
do { (dst) = (src); } while (0)
#endif
-#if GMP_LIMB_BITS == 16
-#define BSWAP_LIMB(dst, src) \
- do { \
- (dst) = ((src) << 8) + ((src) >> 8); \
+#if BITS_PER_MP_LIMB == 16
+#define BSWAP_LIMB(dst, src) \
+ do { \
+ (dst) = ((src) << 8) + ((src) >> 8); \
} while (0)
#endif
-#if GMP_LIMB_BITS == 32
-#define BSWAP_LIMB(dst, src) \
- do { \
- (dst) = \
- ((src) << 24) \
- + (((src) & 0xFF00) << 8) \
- + (((src) >> 8) & 0xFF00) \
- + ((src) >> 24); \
+#if BITS_PER_MP_LIMB == 32
+#define BSWAP_LIMB(dst, src) \
+ do { \
+ (dst) = \
+ ((src) << 24) \
+ + (((src) & 0xFF00) << 8) \
+ + (((src) >> 8) & 0xFF00) \
+ + ((src) >> 24); \
} while (0)
#endif
-#if GMP_LIMB_BITS == 64
-#define BSWAP_LIMB(dst, src) \
- do { \
- (dst) = \
- ((src) << 56) \
- + (((src) & 0xFF00) << 40) \
- + (((src) & 0xFF0000) << 24) \
- + (((src) & 0xFF000000) << 8) \
- + (((src) >> 8) & 0xFF000000) \
- + (((src) >> 24) & 0xFF0000) \
- + (((src) >> 40) & 0xFF00) \
- + ((src) >> 56); \
+#if BITS_PER_MP_LIMB == 64
+#define BSWAP_LIMB(dst, src) \
+ do { \
+ (dst) = \
+ ((src) << 56) \
+ + (((src) & 0xFF00) << 40) \
+ + (((src) & 0xFF0000) << 24) \
+ + (((src) & 0xFF000000) << 8) \
+ + (((src) >> 8) & 0xFF000000) \
+ + (((src) >> 24) & 0xFF0000) \
+ + (((src) >> 40) & 0xFF00) \
+ + ((src) >> 56); \
} while (0)
#endif
#endif
#if ! defined (BSWAP_LIMB)
-#define BSWAP_LIMB(dst, src) \
- do { \
- mp_limb_t __bswapl_src = (src); \
- mp_limb_t __dstl = 0; \
- int __i; \
- for (__i = 0; __i < GMP_LIMB_BYTES; __i++) \
- { \
- __dstl = (__dstl << 8) | (__bswapl_src & 0xFF); \
- __bswapl_src >>= 8; \
- } \
- (dst) = __dstl; \
+#define BSWAP_LIMB(dst, src) \
+ do { \
+ mp_limb_t __bswapl_src = (src); \
+ mp_limb_t __dst = 0; \
+ int __i; \
+ for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++) \
+ { \
+ __dst = (__dst << 8) | (__bswapl_src & 0xFF); \
+ __bswapl_src >>= 8; \
+ } \
+ (dst) = __dst; \
} while (0)
#endif
/* Apparently lwbrx might be slow on some PowerPC chips, so restrict it to
those we know are fast. */
-#if defined (__GNUC__) && ! defined (NO_ASM) \
- && GMP_LIMB_BITS == 32 && HAVE_LIMB_BIG_ENDIAN \
- && (HAVE_HOST_CPU_powerpc604 \
- || HAVE_HOST_CPU_powerpc604e \
- || HAVE_HOST_CPU_powerpc750 \
+#if defined (__GNUC__) && ! defined (NO_ASM) \
+ && BITS_PER_MP_LIMB == 32 && HAVE_LIMB_BIG_ENDIAN \
+ && (HAVE_HOST_CPU_powerpc604 \
+ || HAVE_HOST_CPU_powerpc604e \
+ || HAVE_HOST_CPU_powerpc750 \
|| HAVE_HOST_CPU_powerpc7400)
#define BSWAP_LIMB_FETCH(limb, src) \
do { \
@@ -3528,11 +3033,11 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
/* On the same basis that lwbrx might be slow, restrict stwbrx to those we
know are fast. FIXME: Is this necessary? */
-#if defined (__GNUC__) && ! defined (NO_ASM) \
- && GMP_LIMB_BITS == 32 && HAVE_LIMB_BIG_ENDIAN \
- && (HAVE_HOST_CPU_powerpc604 \
- || HAVE_HOST_CPU_powerpc604e \
- || HAVE_HOST_CPU_powerpc750 \
+#if defined (__GNUC__) && ! defined (NO_ASM) \
+ && BITS_PER_MP_LIMB == 32 && HAVE_LIMB_BIG_ENDIAN \
+ && (HAVE_HOST_CPU_powerpc604 \
+ || HAVE_HOST_CPU_powerpc604e \
+ || HAVE_HOST_CPU_powerpc750 \
|| HAVE_HOST_CPU_powerpc7400)
#define BSWAP_LIMB_STORE(dst, limb) \
do { \
@@ -3551,46 +3056,46 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
/* Byte swap limbs from {src,size} and store at {dst,size}. */
-#define MPN_BSWAP(dst, src, size) \
- do { \
- mp_ptr __dst = (dst); \
- mp_srcptr __src = (src); \
- mp_size_t __size = (size); \
- mp_size_t __i; \
- ASSERT ((size) >= 0); \
- ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); \
- CRAY_Pragma ("_CRI ivdep"); \
- for (__i = 0; __i < __size; __i++) \
- { \
- BSWAP_LIMB_FETCH (*__dst, __src); \
- __dst++; \
- __src++; \
- } \
+#define MPN_BSWAP(dst, src, size) \
+ do { \
+ mp_ptr __dst = (dst); \
+ mp_srcptr __src = (src); \
+ mp_size_t __size = (size); \
+ mp_size_t __i; \
+ ASSERT ((size) >= 0); \
+ ASSERT (MPN_SAME_OR_SEPARATE_P (dst, src, size)); \
+ CRAY_Pragma ("_CRI ivdep"); \
+ for (__i = 0; __i < __size; __i++) \
+ { \
+ BSWAP_LIMB_FETCH (*__dst, __src); \
+ __dst++; \
+ __src++; \
+ } \
} while (0)
/* Byte swap limbs from {dst,size} and store in reverse order at {src,size}. */
-#define MPN_BSWAP_REVERSE(dst, src, size) \
- do { \
- mp_ptr __dst = (dst); \
- mp_size_t __size = (size); \
- mp_srcptr __src = (src) + __size - 1; \
- mp_size_t __i; \
- ASSERT ((size) >= 0); \
- ASSERT (! MPN_OVERLAP_P (dst, size, src, size)); \
- CRAY_Pragma ("_CRI ivdep"); \
- for (__i = 0; __i < __size; __i++) \
- { \
- BSWAP_LIMB_FETCH (*__dst, __src); \
- __dst++; \
- __src--; \
- } \
+#define MPN_BSWAP_REVERSE(dst, src, size) \
+ do { \
+ mp_ptr __dst = (dst); \
+ mp_size_t __size = (size); \
+ mp_srcptr __src = (src) + __size - 1; \
+ mp_size_t __i; \
+ ASSERT ((size) >= 0); \
+ ASSERT (! MPN_OVERLAP_P (dst, size, src, size)); \
+ CRAY_Pragma ("_CRI ivdep"); \
+ for (__i = 0; __i < __size; __i++) \
+ { \
+ BSWAP_LIMB_FETCH (*__dst, __src); \
+ __dst++; \
+ __src--; \
+ } \
} while (0)
/* No processor claiming to be SPARC v9 compliant seems to
implement the POPC instruction. Disable pattern for now. */
#if 0
-#if defined __GNUC__ && defined __sparc_v9__ && GMP_LIMB_BITS == 64
+#if defined __GNUC__ && defined __sparc_v9__ && BITS_PER_MP_LIMB == 64
#define popc_limb(result, input) \
do { \
DItype __res; \
@@ -3608,9 +3113,9 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
/* Cray intrinsic. */
#ifdef _CRAY
-#define popc_limb(result, input) \
- do { \
- (result) = _popcnt (input); \
+#define popc_limb(result, input) \
+ do { \
+ (result) = _popcnt (input); \
} while (0)
#endif
@@ -3637,8 +3142,8 @@ __GMP_DECLSPEC extern const unsigned char binvert_limb_table[128];
mp_limb_t __x = (input); \
__x -= (__x >> 1) & MP_LIMB_T_MAX/3; \
__x = ((__x >> 2) & MP_LIMB_T_MAX/5) + (__x & MP_LIMB_T_MAX/5); \
- __x = ((__x >> 4) + __x); \
- (result) = __x & 0x0f; \
+ __x = ((__x >> 4) + __x) & MP_LIMB_T_MAX/17; \
+ (result) = __x & 0xff; \
} while (0)
#endif
@@ -3704,7 +3209,7 @@ typedef unsigned long int UDItype;
typedef mp_limb_t UWtype;
typedef unsigned int UHWtype;
-#define W_TYPE_SIZE GMP_LIMB_BITS
+#define W_TYPE_SIZE BITS_PER_MP_LIMB
/* Define ieee_double_extract and _GMP_IEEE_FLOATS.
@@ -3763,21 +3268,6 @@ union ieee_double_extract
};
#endif
-#if HAVE_DOUBLE_VAX_D
-union double_extract
-{
- struct
- {
- gmp_uint_least32_t man3:7; /* highest 7 bits */
- gmp_uint_least32_t exp:8; /* excess-128 exponent */
- gmp_uint_least32_t sig:1;
- gmp_uint_least32_t man2:16;
- gmp_uint_least32_t man1:16;
- gmp_uint_least32_t man0:16; /* lowest 16 bits */
- } s;
- double d;
-};
-#endif
/* Use (4.0 * ...) instead of (2.0 * ...) to work around buggy compilers
that don't convert ulong->double correctly (eg. SunOS 4 native cc). */
@@ -3786,10 +3276,10 @@ union double_extract
We assume doubles have 53 mantissa bits. */
#define LIMBS_PER_DOUBLE ((53 + GMP_NUMB_BITS - 2) / GMP_NUMB_BITS + 1)
-__GMP_DECLSPEC int __gmp_extract_double (mp_ptr, double);
+int __gmp_extract_double __GMP_PROTO ((mp_ptr, double));
#define mpn_get_d __gmpn_get_d
-__GMP_DECLSPEC double mpn_get_d (mp_srcptr, mp_size_t, mp_size_t, long) __GMP_ATTRIBUTE_PURE;
+double mpn_get_d __GMP_PROTO ((mp_srcptr, mp_size_t, mp_size_t, long)) __GMP_ATTRIBUTE_PURE;
/* DOUBLE_NAN_INF_ACTION executes code a_nan if x is a NaN, or executes
@@ -3797,17 +3287,17 @@ __GMP_DECLSPEC double mpn_get_d (mp_srcptr, mp_size_t, mp_size_t, long) __GMP_AT
branch prediction. */
#if _GMP_IEEE_FLOATS
-#define DOUBLE_NAN_INF_ACTION(x, a_nan, a_inf) \
- do { \
- union ieee_double_extract u; \
- u.d = (x); \
- if (UNLIKELY (u.s.exp == 0x7FF)) \
- { \
- if (u.s.manl == 0 && u.s.manh == 0) \
- { a_inf; } \
- else \
- { a_nan; } \
- } \
+#define DOUBLE_NAN_INF_ACTION(x, a_nan, a_inf) \
+ do { \
+ union ieee_double_extract u; \
+ u.d = (x); \
+ if (UNLIKELY (u.s.exp == 0x7FF)) \
+ { \
+ if (u.s.manl == 0 && u.s.manh == 0) \
+ { a_inf; } \
+ else \
+ { a_nan; } \
+ } \
} while (0)
#endif
@@ -3821,14 +3311,14 @@ __GMP_DECLSPEC double mpn_get_d (mp_srcptr, mp_size_t, mp_size_t, long) __GMP_AT
/* Unknown format, try something generic.
NaN should be "unordered", so x!=x.
Inf should be bigger than DBL_MAX. */
-#define DOUBLE_NAN_INF_ACTION(x, a_nan, a_inf) \
- do { \
- { \
- if (UNLIKELY ((x) != (x))) \
- { a_nan; } \
- else if (UNLIKELY ((x) > DBL_MAX || (x) < -DBL_MAX)) \
- { a_inf; } \
- } \
+#define DOUBLE_NAN_INF_ACTION(x, a_nan, a_inf) \
+ do { \
+ { \
+ if (UNLIKELY ((x) != (x))) \
+ { a_nan; } \
+ else if (UNLIKELY ((x) > DBL_MAX || (x) < -DBL_MAX)) \
+ { a_inf; } \
+ } \
} while (0)
#endif
@@ -3858,22 +3348,28 @@ __GMP_DECLSPEC double mpn_get_d (mp_srcptr, mp_size_t, mp_size_t, long) __GMP_AT
#endif
-__GMP_DECLSPEC extern const unsigned char __gmp_digit_value_tab[];
-
-__GMP_DECLSPEC extern int __gmp_junk;
-__GMP_DECLSPEC extern const int __gmp_0;
-__GMP_DECLSPEC void __gmp_exception (int) ATTRIBUTE_NORETURN;
-__GMP_DECLSPEC void __gmp_divide_by_zero (void) ATTRIBUTE_NORETURN;
-__GMP_DECLSPEC void __gmp_sqrt_of_negative (void) ATTRIBUTE_NORETURN;
-__GMP_DECLSPEC void __gmp_invalid_operation (void) ATTRIBUTE_NORETURN;
+extern int __gmp_junk;
+extern const int __gmp_0;
+void __gmp_exception __GMP_PROTO ((int)) ATTRIBUTE_NORETURN;
+void __gmp_divide_by_zero __GMP_PROTO ((void)) ATTRIBUTE_NORETURN;
+void __gmp_sqrt_of_negative __GMP_PROTO ((void)) ATTRIBUTE_NORETURN;
+void __gmp_invalid_operation __GMP_PROTO ((void)) ATTRIBUTE_NORETURN;
#define GMP_ERROR(code) __gmp_exception (code)
#define DIVIDE_BY_ZERO __gmp_divide_by_zero ()
#define SQRT_OF_NEGATIVE __gmp_sqrt_of_negative ()
#if defined _LONG_LONG_LIMB
+#if __GMP_HAVE_TOKEN_PASTE
#define CNST_LIMB(C) ((mp_limb_t) C##LL)
+#else
+#define CNST_LIMB(C) ((mp_limb_t) C/**/LL)
+#endif
#else /* not _LONG_LONG_LIMB */
+#if __GMP_HAVE_TOKEN_PASTE
#define CNST_LIMB(C) ((mp_limb_t) C##L)
+#else
+#define CNST_LIMB(C) ((mp_limb_t) C/**/L)
+#endif
#endif /* _LONG_LONG_LIMB */
/* Stuff used by mpn/generic/perfsqr.c and mpz/prime_p.c */
@@ -3907,6 +3403,8 @@ __GMP_DECLSPEC void __gmp_invalid_operation (void) ATTRIBUTE_NORETURN;
#define PP_FIRST_OMITTED 3
#endif
+
+
/* BIT1 means a result value in bit 1 (second least significant bit), with a
zero bit representing +1 and a one bit representing -1. Bits other than
bit 1 are garbage. These are meant to be kept in "int"s, and casts are
@@ -3924,9 +3422,6 @@ __GMP_DECLSPEC void __gmp_invalid_operation (void) ATTRIBUTE_NORETURN;
/* (a/0), with a unsigned; is 1 if a=+/-1, 0 otherwise */
#define JACOBI_U0(a) ((a) == 1)
-/* FIXME: JACOBI_LS0 and JACOBI_0LS are the same, so delete one and
- come up with a better name. */
-
/* (a/0), with a given by low and size;
is 1 if a=+/-1, 0 otherwise */
#define JACOBI_LS0(alow,asize) \
@@ -4001,22 +3496,22 @@ __GMP_DECLSPEC void __gmp_invalid_operation (void) ATTRIBUTE_NORETURN;
decrementing b_size. b_low should be b_ptr[0] on entry, and will be
updated for the new b_ptr. result_bit1 is updated according to the
factors of 2 stripped, as per (a/2). */
-#define JACOBI_STRIP_LOW_ZEROS(result_bit1, a, b_ptr, b_size, b_low) \
- do { \
- ASSERT ((b_size) >= 1); \
- ASSERT ((b_low) == (b_ptr)[0]); \
- \
- while (UNLIKELY ((b_low) == 0)) \
- { \
- (b_size)--; \
- ASSERT ((b_size) >= 1); \
- (b_ptr)++; \
- (b_low) = *(b_ptr); \
- \
- ASSERT (((a) & 1) != 0); \
- if ((GMP_NUMB_BITS % 2) == 1) \
- (result_bit1) ^= JACOBI_TWO_U_BIT1(a); \
- } \
+#define JACOBI_STRIP_LOW_ZEROS(result_bit1, a, b_ptr, b_size, b_low) \
+ do { \
+ ASSERT ((b_size) >= 1); \
+ ASSERT ((b_low) == (b_ptr)[0]); \
+ \
+ while (UNLIKELY ((b_low) == 0)) \
+ { \
+ (b_size)--; \
+ ASSERT ((b_size) >= 1); \
+ (b_ptr)++; \
+ (b_low) = *(b_ptr); \
+ \
+ ASSERT (((a) & 1) != 0); \
+ if ((GMP_NUMB_BITS % 2) == 1) \
+ (result_bit1) ^= JACOBI_TWO_U_BIT1(a); \
+ } \
} while (0)
/* Set a_rem to {a_ptr,a_size} reduced modulo b, either using mod_1 or
@@ -4034,97 +3529,33 @@ __GMP_DECLSPEC void __gmp_invalid_operation (void) ATTRIBUTE_NORETURN;
or not skip a divide step, or something. */
#define JACOBI_MOD_OR_MODEXACT_1_ODD(result_bit1, a_rem, a_ptr, a_size, b) \
- do { \
- mp_srcptr __a_ptr = (a_ptr); \
- mp_size_t __a_size = (a_size); \
- mp_limb_t __b = (b); \
- \
- ASSERT (__a_size >= 1); \
- ASSERT (__b & 1); \
- \
- if ((GMP_NUMB_BITS % 2) != 0 \
- || ABOVE_THRESHOLD (__a_size, BMOD_1_TO_MOD_1_THRESHOLD)) \
- { \
- (a_rem) = mpn_mod_1 (__a_ptr, __a_size, __b); \
- } \
- else \
- { \
- (result_bit1) ^= JACOBI_N1B_BIT1 (__b); \
- (a_rem) = mpn_modexact_1_odd (__a_ptr, __a_size, __b); \
- } \
+ do { \
+ mp_srcptr __a_ptr = (a_ptr); \
+ mp_size_t __a_size = (a_size); \
+ mp_limb_t __b = (b); \
+ \
+ ASSERT (__a_size >= 1); \
+ ASSERT (__b & 1); \
+ \
+ if ((GMP_NUMB_BITS % 2) != 0 \
+ || BELOW_THRESHOLD (__a_size, MODEXACT_1_ODD_THRESHOLD)) \
+ { \
+ (a_rem) = mpn_mod_1 (__a_ptr, __a_size, __b); \
+ } \
+ else \
+ { \
+ (result_bit1) ^= JACOBI_N1B_BIT1 (__b); \
+ (a_rem) = mpn_modexact_1_odd (__a_ptr, __a_size, __b); \
+ } \
} while (0)
-/* State for the Jacobi computation using Lehmer. */
-#define jacobi_table __gmp_jacobi_table
-__GMP_DECLSPEC extern const unsigned char jacobi_table[208];
-
-/* Bit layout for the initial state. b must be odd.
-
- 3 2 1 0
- +--+--+--+--+
- |a1|a0|b1| s|
- +--+--+--+--+
-
- */
-static inline unsigned
-mpn_jacobi_init (unsigned a, unsigned b, unsigned s)
-{
- ASSERT (b & 1);
- ASSERT (s <= 1);
- return ((a & 3) << 2) + (b & 2) + s;
-}
-
-static inline int
-mpn_jacobi_finish (unsigned bits)
-{
- /* (a, b) = (1,0) or (0,1) */
- ASSERT ( (bits & 14) == 0);
-
- return 1-2*(bits & 1);
-}
-
-static inline unsigned
-mpn_jacobi_update (unsigned bits, unsigned denominator, unsigned q)
-{
- /* FIXME: Could halve table size by not including the e bit in the
- * index, and instead xor when updating. Then the lookup would be
- * like
- *
- * bits ^= table[((bits & 30) << 2) + (denominator << 2) + q];
- */
-
- ASSERT (bits < 26);
- ASSERT (denominator < 2);
- ASSERT (q < 4);
-
- /* For almost all calls, denominator is constant and quite often q
- is constant too. So use addition rather than or, so the compiler
- can put the constant part can into the offset of an indexed
- addressing instruction.
-
- With constant denominator, the below table lookup is compiled to
-
- C Constant q = 1, constant denominator = 1
- movzbl table+5(%eax,8), %eax
-
- or
-
- C q in %edx, constant denominator = 1
- movzbl table+4(%edx,%eax,8), %eax
-
- One could maintain the state preshifted 3 bits, to save a shift
- here, but at least on x86, that's no real saving.
- */
- return bits = jacobi_table[(bits << 3) + (denominator << 2) + q];
-}
-
/* Matrix multiplication */
#define mpn_matrix22_mul __MPN(matrix22_mul)
-__GMP_DECLSPEC void mpn_matrix22_mul (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_matrix22_mul __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_matrix22_mul_strassen __MPN(matrix22_mul_strassen)
-__GMP_DECLSPEC void mpn_matrix22_mul_strassen (mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
+void mpn_matrix22_mul_strassen __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr));
#define mpn_matrix22_mul_itch __MPN(matrix22_mul_itch)
-__GMP_DECLSPEC mp_size_t mpn_matrix22_mul_itch (mp_size_t, mp_size_t) ATTRIBUTE_CONST;
+mp_size_t mpn_matrix22_mul_itch __GMP_PROTO ((mp_size_t, mp_size_t));
#ifndef MATRIX22_STRASSEN_THRESHOLD
#define MATRIX22_STRASSEN_THRESHOLD 30
@@ -4162,16 +3593,13 @@ struct hgcd_matrix1
};
#define mpn_hgcd2 __MPN (hgcd2)
-__GMP_DECLSPEC int mpn_hgcd2 (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1 *);
+int mpn_hgcd2 __GMP_PROTO ((mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1 *));
#define mpn_hgcd_mul_matrix1_vector __MPN (hgcd_mul_matrix1_vector)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_mul_matrix1_vector (const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t);
-
-#define mpn_matrix22_mul1_inverse_vector __MPN (matrix22_mul1_inverse_vector)
-__GMP_DECLSPEC mp_size_t mpn_matrix22_mul1_inverse_vector (const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t);
+mp_size_t mpn_hgcd_mul_matrix1_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t));
-#define mpn_hgcd2_jacobi __MPN (hgcd2_jacobi)
-__GMP_DECLSPEC int mpn_hgcd2_jacobi (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t, struct hgcd_matrix1 *, unsigned *);
+#define mpn_hgcd_mul_matrix1_inverse_vector __MPN (hgcd_mul_matrix1_inverse_vector)
+mp_size_t mpn_hgcd_mul_matrix1_inverse_vector __GMP_PROTO ((const struct hgcd_matrix1 *, mp_ptr, mp_srcptr, mp_ptr, mp_size_t));
struct hgcd_matrix
{
@@ -4183,72 +3611,43 @@ struct hgcd_matrix
#define MPN_HGCD_MATRIX_INIT_ITCH(n) (4 * ((n+1)/2 + 1))
#define mpn_hgcd_matrix_init __MPN (hgcd_matrix_init)
-__GMP_DECLSPEC void mpn_hgcd_matrix_init (struct hgcd_matrix *, mp_size_t, mp_ptr);
-
-#define mpn_hgcd_matrix_update_q __MPN (hgcd_matrix_update_q)
-__GMP_DECLSPEC void mpn_hgcd_matrix_update_q (struct hgcd_matrix *, mp_srcptr, mp_size_t, unsigned, mp_ptr);
-
-#define mpn_hgcd_matrix_mul_1 __MPN (hgcd_matrix_mul_1)
-__GMP_DECLSPEC void mpn_hgcd_matrix_mul_1 (struct hgcd_matrix *, const struct hgcd_matrix1 *, mp_ptr);
+void mpn_hgcd_matrix_init __GMP_PROTO ((struct hgcd_matrix *, mp_size_t, mp_ptr));
#define mpn_hgcd_matrix_mul __MPN (hgcd_matrix_mul)
-__GMP_DECLSPEC void mpn_hgcd_matrix_mul (struct hgcd_matrix *, const struct hgcd_matrix *, mp_ptr);
+void mpn_hgcd_matrix_mul __GMP_PROTO ((struct hgcd_matrix *, const struct hgcd_matrix *, mp_ptr));
#define mpn_hgcd_matrix_adjust __MPN (hgcd_matrix_adjust)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_matrix_adjust (const struct hgcd_matrix *, mp_size_t, mp_ptr, mp_ptr, mp_size_t, mp_ptr);
-
-#define mpn_hgcd_step __MPN(hgcd_step)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_step (mp_size_t, mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr);
-
-#define mpn_hgcd_reduce __MPN(hgcd_reduce)
-__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) ATTRIBUTE_CONST;
+mp_size_t mpn_hgcd_matrix_adjust __GMP_PROTO ((struct hgcd_matrix *, mp_size_t, mp_ptr, mp_ptr, mp_size_t, mp_ptr));
#define mpn_hgcd_itch __MPN (hgcd_itch)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_itch (mp_size_t) ATTRIBUTE_CONST;
+mp_size_t mpn_hgcd_itch __GMP_PROTO ((mp_size_t));
#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) ATTRIBUTE_CONST;
+mp_size_t mpn_hgcd __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr));
-#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);
+#define MPN_HGCD_LEHMER_ITCH(n) (n)
-#define mpn_hgcd_jacobi __MPN (hgcd_jacobi)
-__GMP_DECLSPEC mp_size_t mpn_hgcd_jacobi (mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, unsigned *, mp_ptr);
-
-typedef void gcd_subdiv_step_hook(void *, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, int);
+#define mpn_hgcd_lehmer __MPN (hgcd_lehmer)
+mp_size_t mpn_hgcd_lehmer __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr));
/* Needs storage for the quotient */
#define MPN_GCD_SUBDIV_STEP_ITCH(n) (n)
#define mpn_gcd_subdiv_step __MPN(gcd_subdiv_step)
-__GMP_DECLSPEC mp_size_t mpn_gcd_subdiv_step (mp_ptr, mp_ptr, mp_size_t, mp_size_t, gcd_subdiv_step_hook *, void *, mp_ptr);
+mp_size_t mpn_gcd_subdiv_step __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr));
-struct gcdext_ctx
-{
- /* Result parameters. */
- mp_ptr gp;
- mp_size_t gn;
- mp_ptr up;
- mp_size_t *usize;
-
- /* Cofactors updated in each step. */
- mp_size_t un;
- mp_ptr u0, u1, tp;
-};
+#define MPN_GCD_LEHMER_N_ITCH(n) (n)
-#define mpn_gcdext_hook __MPN (gcdext_hook)
-gcd_subdiv_step_hook mpn_gcdext_hook;
+#define mpn_gcd_lehmer_n __MPN(gcd_lehmer_n)
+mp_size_t mpn_gcd_lehmer_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_ptr, mp_size_t, mp_ptr));
+
+#define mpn_gcdext_subdiv_step __MPN(gcdext_subdiv_step)
+mp_size_t mpn_gcdext_subdiv_step __GMP_PROTO ((mp_ptr, mp_size_t *, mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_ptr));
#define MPN_GCDEXT_LEHMER_N_ITCH(n) (4*(n) + 3)
#define mpn_gcdext_lehmer_n __MPN(gcdext_lehmer_n)
-__GMP_DECLSPEC mp_size_t mpn_gcdext_lehmer_n (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr);
+mp_size_t mpn_gcdext_lehmer_n __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_ptr, mp_size_t, mp_ptr));
/* 4*(an + 1) + 4*(bn + 1) + an */
#define MPN_GCDEXT_LEHMER_ITCH(an, bn) (5*(an) + 4*(bn) + 8)
@@ -4257,14 +3656,6 @@ __GMP_DECLSPEC mp_size_t mpn_gcdext_lehmer_n (mp_ptr, mp_ptr, mp_size_t *, mp_pt
#define HGCD_THRESHOLD 400
#endif
-#ifndef HGCD_APPR_THRESHOLD
-#define HGCD_APPR_THRESHOLD 400
-#endif
-
-#ifndef HGCD_REDUCE_THRESHOLD
-#define HGCD_REDUCE_THRESHOLD 1000
-#endif
-
#ifndef GCD_DC_THRESHOLD
#define GCD_DC_THRESHOLD 1000
#endif
@@ -4289,11 +3680,11 @@ typedef struct powers powers_t;
#define mpn_dc_get_str_itch(n) ((n) + GMP_LIMB_BITS)
#define mpn_dc_set_str __MPN(dc_set_str)
-__GMP_DECLSPEC mp_size_t mpn_dc_set_str (mp_ptr, const unsigned char *, size_t, const powers_t *, mp_ptr);
+mp_size_t mpn_dc_set_str __GMP_PROTO ((mp_ptr, const unsigned char *, size_t, const powers_t *, mp_ptr));
#define mpn_bc_set_str __MPN(bc_set_str)
-__GMP_DECLSPEC mp_size_t mpn_bc_set_str (mp_ptr, const unsigned char *, size_t, int);
+mp_size_t mpn_bc_set_str __GMP_PROTO ((mp_ptr, const unsigned char *, size_t, int));
#define mpn_set_str_compute_powtab __MPN(set_str_compute_powtab)
-__GMP_DECLSPEC void mpn_set_str_compute_powtab (powers_t *, mp_ptr, mp_size_t, int);
+void mpn_set_str_compute_powtab __GMP_PROTO ((powers_t *, mp_ptr, mp_size_t, int));
/* __GMPF_BITS_TO_PREC applies a minimum 53 bits, rounds upwards to a whole
@@ -4303,28 +3694,9 @@ __GMP_DECLSPEC void mpn_set_str_compute_powtab (powers_t *, mp_ptr, mp_size
#define __GMPF_BITS_TO_PREC(n) \
((mp_size_t) ((__GMP_MAX (53, n) + 2 * GMP_NUMB_BITS - 1) / GMP_NUMB_BITS))
#define __GMPF_PREC_TO_BITS(n) \
- ((mp_bitcnt_t) (n) * GMP_NUMB_BITS - GMP_NUMB_BITS)
+ ((unsigned long) (n) * GMP_NUMB_BITS - GMP_NUMB_BITS)
-__GMP_DECLSPEC extern mp_size_t __gmp_default_fp_limb_precision;
-
-/* Compute the number of base-b digits corresponding to nlimbs limbs, rounding
- down. */
-#define DIGITS_IN_BASE_PER_LIMB(res, nlimbs, b) \
- do { \
- mp_limb_t _ph, _pl; \
- umul_ppmm (_ph, _pl, \
- mp_bases[b].logb2, GMP_NUMB_BITS * (mp_limb_t) (nlimbs));\
- res = _ph; \
- } while (0)
-
-/* Compute the number of limbs corresponding to ndigits base-b digits, rounding
- up. */
-#define LIMBS_PER_DIGIT_IN_BASE(res, ndigits, b) \
- do { \
- mp_limb_t _ph, _dummy; \
- umul_ppmm (_ph, _dummy, mp_bases[b].log2b, (mp_limb_t) (ndigits)); \
- res = 8 * _ph / GMP_NUMB_BITS + 2; \
- } while (0)
+extern mp_size_t __gmp_default_fp_limb_precision;
/* Set n to the number of significant digits an mpf of the given _mp_prec
@@ -4336,15 +3708,14 @@ __GMP_DECLSPEC extern mp_size_t __gmp_default_fp_limb_precision;
further +1 is because the limbs usually won't fall on digit boundaries.
FIXME: If base is a power of 2 and the bits per digit divides
- GMP_LIMB_BITS then the +2 is unnecessary. This happens always for
+ BITS_PER_MP_LIMB then the +2 is unnecessary. This happens always for
base==2, and in base==16 with the current 32 or 64 bit limb sizes. */
-#define MPF_SIGNIFICANT_DIGITS(n, base, prec) \
- do { \
- size_t rawn; \
- ASSERT (base >= 2 && base < numberof (mp_bases)); \
- DIGITS_IN_BASE_PER_LIMB (rawn, (prec) - 1, base); \
- n = rawn + 2; \
+#define MPF_SIGNIFICANT_DIGITS(n, base, prec) \
+ do { \
+ ASSERT (base >= 2 && base < numberof (mp_bases)); \
+ (n) = 2 + (size_t) ((((size_t) (prec) - 1) * GMP_NUMB_BITS) \
+ * mp_bases[(base)].chars_per_bit_exactly); \
} while (0)
@@ -4403,10 +3774,10 @@ struct doprnt_params_t {
#if _GMP_H_HAVE_VA_LIST
-typedef int (*doprnt_format_t) (void *, const char *, va_list);
-typedef int (*doprnt_memory_t) (void *, const char *, size_t);
-typedef int (*doprnt_reps_t) (void *, int, int);
-typedef int (*doprnt_final_t) (void *);
+typedef int (*doprnt_format_t) __GMP_PROTO ((void *, const char *, va_list));
+typedef int (*doprnt_memory_t) __GMP_PROTO ((void *, const char *, size_t));
+typedef int (*doprnt_reps_t) __GMP_PROTO ((void *, int, int));
+typedef int (*doprnt_final_t) __GMP_PROTO ((void *));
struct doprnt_funs_t {
doprnt_format_t format;
@@ -4432,35 +3803,35 @@ struct gmp_asprintf_t {
size_t alloc;
};
-#define GMP_ASPRINTF_T_INIT(d, output) \
- do { \
- (d).result = (output); \
- (d).alloc = 256; \
- (d).buf = (char *) (*__gmp_allocate_func) ((d).alloc); \
- (d).size = 0; \
+#define GMP_ASPRINTF_T_INIT(d, output) \
+ do { \
+ (d).result = (output); \
+ (d).alloc = 256; \
+ (d).buf = (char *) (*__gmp_allocate_func) ((d).alloc); \
+ (d).size = 0; \
} while (0)
/* If a realloc is necessary, use twice the size actually required, so as to
avoid repeated small reallocs. */
-#define GMP_ASPRINTF_T_NEED(d, n) \
- do { \
- size_t alloc, newsize, newalloc; \
- ASSERT ((d)->alloc >= (d)->size + 1); \
- \
- alloc = (d)->alloc; \
- newsize = (d)->size + (n); \
- if (alloc <= newsize) \
- { \
- newalloc = 2*newsize; \
- (d)->alloc = newalloc; \
- (d)->buf = __GMP_REALLOCATE_FUNC_TYPE ((d)->buf, \
- alloc, newalloc, char); \
- } \
+#define GMP_ASPRINTF_T_NEED(d, n) \
+ do { \
+ size_t alloc, newsize, newalloc; \
+ ASSERT ((d)->alloc >= (d)->size + 1); \
+ \
+ alloc = (d)->alloc; \
+ newsize = (d)->size + (n); \
+ if (alloc <= newsize) \
+ { \
+ newalloc = 2*newsize; \
+ (d)->alloc = newalloc; \
+ (d)->buf = __GMP_REALLOCATE_FUNC_TYPE ((d)->buf, \
+ alloc, newalloc, char); \
+ } \
} while (0)
-__GMP_DECLSPEC int __gmp_asprintf_memory (struct gmp_asprintf_t *, const char *, size_t);
-__GMP_DECLSPEC int __gmp_asprintf_reps (struct gmp_asprintf_t *, int, int);
-__GMP_DECLSPEC int __gmp_asprintf_final (struct gmp_asprintf_t *);
+__GMP_DECLSPEC int __gmp_asprintf_memory __GMP_PROTO ((struct gmp_asprintf_t *, const char *, size_t));
+__GMP_DECLSPEC int __gmp_asprintf_reps __GMP_PROTO ((struct gmp_asprintf_t *, int, int));
+__GMP_DECLSPEC int __gmp_asprintf_final __GMP_PROTO ((struct gmp_asprintf_t *));
/* buf is where to write the next output, and size is how much space is left
there. If the application passed size==0 then that's what we'll have
@@ -4472,54 +3843,54 @@ struct gmp_snprintf_t {
/* Add the bytes printed by the call to the total retval, or bail out on an
error. */
-#define DOPRNT_ACCUMULATE(call) \
- do { \
- int __ret; \
- __ret = call; \
- if (__ret == -1) \
- goto error; \
- retval += __ret; \
+#define DOPRNT_ACCUMULATE(call) \
+ do { \
+ int __ret; \
+ __ret = call; \
+ if (__ret == -1) \
+ goto error; \
+ retval += __ret; \
} while (0)
-#define DOPRNT_ACCUMULATE_FUN(fun, params) \
- do { \
- ASSERT ((fun) != NULL); \
- DOPRNT_ACCUMULATE ((*(fun)) params); \
+#define DOPRNT_ACCUMULATE_FUN(fun, params) \
+ do { \
+ ASSERT ((fun) != NULL); \
+ DOPRNT_ACCUMULATE ((*(fun)) params); \
} while (0)
-#define DOPRNT_FORMAT(fmt, ap) \
+#define DOPRNT_FORMAT(fmt, ap) \
DOPRNT_ACCUMULATE_FUN (funs->format, (data, fmt, ap))
-#define DOPRNT_MEMORY(ptr, len) \
+#define DOPRNT_MEMORY(ptr, len) \
DOPRNT_ACCUMULATE_FUN (funs->memory, (data, ptr, len))
-#define DOPRNT_REPS(c, n) \
+#define DOPRNT_REPS(c, n) \
DOPRNT_ACCUMULATE_FUN (funs->reps, (data, c, n))
#define DOPRNT_STRING(str) DOPRNT_MEMORY (str, strlen (str))
-#define DOPRNT_REPS_MAYBE(c, n) \
- do { \
- if ((n) != 0) \
- DOPRNT_REPS (c, n); \
+#define DOPRNT_REPS_MAYBE(c, n) \
+ do { \
+ if ((n) != 0) \
+ DOPRNT_REPS (c, n); \
} while (0)
-#define DOPRNT_MEMORY_MAYBE(ptr, len) \
- do { \
- if ((len) != 0) \
- DOPRNT_MEMORY (ptr, len); \
+#define DOPRNT_MEMORY_MAYBE(ptr, len) \
+ do { \
+ if ((len) != 0) \
+ DOPRNT_MEMORY (ptr, len); \
} while (0)
-__GMP_DECLSPEC int __gmp_doprnt (const struct doprnt_funs_t *, void *, const char *, va_list);
-__GMP_DECLSPEC int __gmp_doprnt_integer (const struct doprnt_funs_t *, void *, const struct doprnt_params_t *, const char *);
+__GMP_DECLSPEC int __gmp_doprnt __GMP_PROTO ((const struct doprnt_funs_t *, void *, const char *, va_list));
+__GMP_DECLSPEC int __gmp_doprnt_integer __GMP_PROTO ((const struct doprnt_funs_t *, void *, const struct doprnt_params_t *, const char *));
#define __gmp_doprnt_mpf __gmp_doprnt_mpf2
-__GMP_DECLSPEC int __gmp_doprnt_mpf (const struct doprnt_funs_t *, void *, const struct doprnt_params_t *, const char *, mpf_srcptr);
+__GMP_DECLSPEC int __gmp_doprnt_mpf __GMP_PROTO ((const struct doprnt_funs_t *, void *, const struct doprnt_params_t *, const char *, mpf_srcptr));
-__GMP_DECLSPEC int __gmp_replacement_vsnprintf (char *, size_t, const char *, va_list);
+int __gmp_replacement_vsnprintf __GMP_PROTO ((char *, size_t, const char *, va_list));
#endif /* _GMP_H_HAVE_VA_LIST */
-typedef int (*gmp_doscan_scan_t) (void *, const char *, ...);
-typedef void *(*gmp_doscan_step_t) (void *, int);
-typedef int (*gmp_doscan_get_t) (void *);
-typedef int (*gmp_doscan_unget_t) (int, void *);
+typedef int (*gmp_doscan_scan_t) __GMP_PROTO ((void *, const char *, ...));
+typedef void *(*gmp_doscan_step_t) __GMP_PROTO ((void *, int));
+typedef int (*gmp_doscan_get_t) __GMP_PROTO ((void *));
+typedef int (*gmp_doscan_unget_t) __GMP_PROTO ((int, void *));
struct gmp_doscan_funs_t {
gmp_doscan_scan_t scan;
@@ -4531,122 +3902,108 @@ extern const struct gmp_doscan_funs_t __gmp_fscanf_funs;
extern const struct gmp_doscan_funs_t __gmp_sscanf_funs;
#if _GMP_H_HAVE_VA_LIST
-__GMP_DECLSPEC int __gmp_doscan (const struct gmp_doscan_funs_t *, void *, const char *, va_list);
+int __gmp_doscan __GMP_PROTO ((const struct gmp_doscan_funs_t *, void *,
+ const char *, va_list));
#endif
/* For testing and debugging. */
-#define MPZ_CHECK_FORMAT(z) \
- do { \
- ASSERT_ALWAYS (SIZ(z) == 0 || PTR(z)[ABSIZ(z) - 1] != 0); \
- ASSERT_ALWAYS (ALLOC(z) >= ABSIZ(z)); \
- ASSERT_ALWAYS_MPN (PTR(z), ABSIZ(z)); \
+#define MPZ_CHECK_FORMAT(z) \
+ do { \
+ ASSERT_ALWAYS (SIZ(z) == 0 || PTR(z)[ABSIZ(z) - 1] != 0); \
+ ASSERT_ALWAYS (ALLOC(z) >= ABSIZ(z)); \
+ ASSERT_ALWAYS_MPN (PTR(z), ABSIZ(z)); \
} while (0)
-#define MPQ_CHECK_FORMAT(q) \
- do { \
- MPZ_CHECK_FORMAT (mpq_numref (q)); \
- MPZ_CHECK_FORMAT (mpq_denref (q)); \
- ASSERT_ALWAYS (SIZ(mpq_denref(q)) >= 1); \
- \
- if (SIZ(mpq_numref(q)) == 0) \
- { \
- /* should have zero as 0/1 */ \
- ASSERT_ALWAYS (SIZ(mpq_denref(q)) == 1 \
- && PTR(mpq_denref(q))[0] == 1); \
- } \
- else \
- { \
- /* should have no common factors */ \
- mpz_t g; \
- mpz_init (g); \
- mpz_gcd (g, mpq_numref(q), mpq_denref(q)); \
- ASSERT_ALWAYS (mpz_cmp_ui (g, 1) == 0); \
- mpz_clear (g); \
- } \
+#define MPQ_CHECK_FORMAT(q) \
+ do { \
+ MPZ_CHECK_FORMAT (mpq_numref (q)); \
+ MPZ_CHECK_FORMAT (mpq_denref (q)); \
+ ASSERT_ALWAYS (SIZ(mpq_denref(q)) >= 1); \
+ \
+ if (SIZ(mpq_numref(q)) == 0) \
+ { \
+ /* should have zero as 0/1 */ \
+ ASSERT_ALWAYS (SIZ(mpq_denref(q)) == 1 \
+ && PTR(mpq_denref(q))[0] == 1); \
+ } \
+ else \
+ { \
+ /* should have no common factors */ \
+ mpz_t g; \
+ mpz_init (g); \
+ mpz_gcd (g, mpq_numref(q), mpq_denref(q)); \
+ ASSERT_ALWAYS (mpz_cmp_ui (g, 1) == 0); \
+ mpz_clear (g); \
+ } \
} while (0)
-#define MPF_CHECK_FORMAT(f) \
- do { \
- ASSERT_ALWAYS (PREC(f) >= __GMPF_BITS_TO_PREC(53)); \
- ASSERT_ALWAYS (ABSIZ(f) <= PREC(f)+1); \
- if (SIZ(f) == 0) \
- ASSERT_ALWAYS (EXP(f) == 0); \
- if (SIZ(f) != 0) \
- ASSERT_ALWAYS (PTR(f)[ABSIZ(f) - 1] != 0); \
+#define MPF_CHECK_FORMAT(f) \
+ do { \
+ ASSERT_ALWAYS (PREC(f) >= __GMPF_BITS_TO_PREC(53)); \
+ ASSERT_ALWAYS (ABSIZ(f) <= PREC(f)+1); \
+ if (SIZ(f) == 0) \
+ ASSERT_ALWAYS (EXP(f) == 0); \
+ if (SIZ(f) != 0) \
+ ASSERT_ALWAYS (PTR(f)[ABSIZ(f) - 1] != 0); \
} 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
difference to the gmp code, since hopefully we arrange calls so there's
no great need for the compiler to move things around. */
-#if WANT_FAT_BINARY && (HAVE_HOST_CPU_FAMILY_x86 || HAVE_HOST_CPU_FAMILY_x86_64)
+#if WANT_FAT_BINARY && HAVE_HOST_CPU_FAMILY_x86
/* NOTE: The function pointers in this struct are also in CPUVEC_FUNCS_LIST
- in mpn/x86/x86-defs.m4 and mpn/x86_64/x86_64-defs.m4. Be sure to update
- those when changing here. */
+ in mpn/x86/x86-defs.m4. Be sure to update that when changing here. */
struct cpuvec_t {
DECL_add_n ((*add_n));
- DECL_addlsh1_n ((*addlsh1_n));
- DECL_addlsh2_n ((*addlsh2_n));
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));
DECL_divexact_1 ((*divexact_1));
+ DECL_divexact_by3c ((*divexact_by3c));
DECL_divrem_1 ((*divrem_1));
DECL_gcd_1 ((*gcd_1));
DECL_lshift ((*lshift));
- DECL_lshiftc ((*lshiftc));
DECL_mod_1 ((*mod_1));
- DECL_mod_1_1p ((*mod_1_1p));
- DECL_mod_1_1p_cps ((*mod_1_1p_cps));
- DECL_mod_1s_2p ((*mod_1s_2p));
- DECL_mod_1s_2p_cps ((*mod_1s_2p_cps));
- DECL_mod_1s_4p ((*mod_1s_4p));
- DECL_mod_1s_4p_cps ((*mod_1s_4p_cps));
DECL_mod_34lsub1 ((*mod_34lsub1));
DECL_modexact_1c_odd ((*modexact_1c_odd));
DECL_mul_1 ((*mul_1));
DECL_mul_basecase ((*mul_basecase));
- DECL_mullo_basecase ((*mullo_basecase));
DECL_preinv_divrem_1 ((*preinv_divrem_1));
DECL_preinv_mod_1 ((*preinv_mod_1));
- DECL_redc_1 ((*redc_1));
- DECL_redc_2 ((*redc_2));
DECL_rshift ((*rshift));
DECL_sqr_basecase ((*sqr_basecase));
DECL_sub_n ((*sub_n));
- DECL_sublsh1_n ((*sublsh1_n));
DECL_submul_1 ((*submul_1));
- mp_size_t mul_toom22_threshold;
- mp_size_t mul_toom33_threshold;
- mp_size_t sqr_toom2_threshold;
+ int initialized;
+ mp_size_t mul_karatsuba_threshold;
+ mp_size_t mul_toom3_threshold;
+ mp_size_t sqr_karatsuba_threshold;
mp_size_t sqr_toom3_threshold;
- mp_size_t bmod_1_to_mod_1_threshold;
};
__GMP_DECLSPEC extern struct cpuvec_t __gmpn_cpuvec;
-__GMP_DECLSPEC extern int __gmpn_cpuvec_initialized;
#endif /* x86 fat binary */
-__GMP_DECLSPEC void __gmpn_cpuvec_init (void);
+void __gmpn_cpuvec_init __GMP_PROTO ((void));
/* Get a threshold "field" from __gmpn_cpuvec, running __gmpn_cpuvec_init()
if that hasn't yet been done (to establish the right values). */
-#define CPUVEC_THRESHOLD(field) \
- ((LIKELY (__gmpn_cpuvec_initialized) ? 0 : (__gmpn_cpuvec_init (), 0)), \
+#define CPUVEC_THRESHOLD(field) \
+ ((LIKELY (__gmpn_cpuvec.initialized) ? 0 : (__gmpn_cpuvec_init (), 0)), \
__gmpn_cpuvec.field)
#if HAVE_NATIVE_mpn_add_nc
#define mpn_add_nc __MPN(add_nc)
-__GMP_DECLSPEC mp_limb_t mpn_add_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_add_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
#else
static inline
mp_limb_t
@@ -4661,7 +4018,7 @@ mpn_add_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t ci)
#if HAVE_NATIVE_mpn_sub_nc
#define mpn_sub_nc __MPN(sub_nc)
-__GMP_DECLSPEC mp_limb_t mpn_sub_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
+__GMP_DECLSPEC mp_limb_t mpn_sub_nc __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t));
#else
static inline mp_limb_t
mpn_sub_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t ci)
@@ -4676,9 +4033,10 @@ 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)
{
- while (--n >= 0)
+ mp_size_t i;
+ for (i = n - 1; i >= 0; i--)
{
- if (ap[n] != 0)
+ if (ap[i] != 0)
return 0;
}
return 1;
@@ -4693,329 +4051,194 @@ mpn_zero_p (mp_srcptr ap, mp_size_t n)
on #ifdef in the .c files. For some this is not so (the defaults are
instead established above), but all are done this way for consistency. */
-#undef MUL_TOOM22_THRESHOLD
-#define MUL_TOOM22_THRESHOLD mul_toom22_threshold
-extern mp_size_t mul_toom22_threshold;
-
-#undef MUL_TOOM33_THRESHOLD
-#define MUL_TOOM33_THRESHOLD mul_toom33_threshold
-extern mp_size_t mul_toom33_threshold;
-
-#undef MUL_TOOM44_THRESHOLD
-#define MUL_TOOM44_THRESHOLD mul_toom44_threshold
-extern mp_size_t mul_toom44_threshold;
-
-#undef MUL_TOOM6H_THRESHOLD
-#define MUL_TOOM6H_THRESHOLD mul_toom6h_threshold
-extern mp_size_t mul_toom6h_threshold;
-
-#undef MUL_TOOM8H_THRESHOLD
-#define MUL_TOOM8H_THRESHOLD mul_toom8h_threshold
-extern mp_size_t mul_toom8h_threshold;
+#undef MUL_KARATSUBA_THRESHOLD
+#define MUL_KARATSUBA_THRESHOLD mul_karatsuba_threshold
+extern mp_size_t mul_karatsuba_threshold;
-#undef MUL_TOOM32_TO_TOOM43_THRESHOLD
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD mul_toom32_to_toom43_threshold
-extern mp_size_t mul_toom32_to_toom43_threshold;
+#undef MUL_TOOM3_THRESHOLD
+#define MUL_TOOM3_THRESHOLD mul_toom3_threshold
+extern mp_size_t mul_toom3_threshold;
-#undef MUL_TOOM32_TO_TOOM53_THRESHOLD
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD mul_toom32_to_toom53_threshold
-extern mp_size_t mul_toom32_to_toom53_threshold;
+#undef MUL_TOOM44_THRESHOLD
+#define MUL_TOOM44_THRESHOLD mul_toom44_threshold
+extern mp_size_t mul_toom44_threshold;
-#undef MUL_TOOM42_TO_TOOM53_THRESHOLD
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD mul_toom42_to_toom53_threshold
-extern mp_size_t mul_toom42_to_toom53_threshold;
-
-#undef MUL_TOOM42_TO_TOOM63_THRESHOLD
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD mul_toom42_to_toom63_threshold
-extern mp_size_t mul_toom42_to_toom63_threshold;
-
-#undef MUL_TOOM43_TO_TOOM54_THRESHOLD
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD mul_toom43_to_toom54_threshold;
-extern mp_size_t mul_toom43_to_toom54_threshold;
-
-#undef MUL_FFT_THRESHOLD
-#define MUL_FFT_THRESHOLD mul_fft_threshold
-extern mp_size_t mul_fft_threshold;
-
-#undef MUL_FFT_MODF_THRESHOLD
-#define MUL_FFT_MODF_THRESHOLD mul_fft_modf_threshold
-extern mp_size_t mul_fft_modf_threshold;
+#undef MUL_FFT_THRESHOLD
+#define MUL_FFT_THRESHOLD mul_fft_threshold
+extern mp_size_t mul_fft_threshold;
-#undef MUL_FFT_TABLE
-#define MUL_FFT_TABLE { 0 }
+#undef MUL_FFT_MODF_THRESHOLD
+#define MUL_FFT_MODF_THRESHOLD mul_fft_modf_threshold
+extern mp_size_t mul_fft_modf_threshold;
-#undef MUL_FFT_TABLE3
-#define MUL_FFT_TABLE3 { {0,0} }
+#undef MUL_FFT_TABLE
+#define MUL_FFT_TABLE { 0 }
/* A native mpn_sqr_basecase is not tuned and SQR_BASECASE_THRESHOLD should
remain as zero (always use it). */
#if ! HAVE_NATIVE_mpn_sqr_basecase
-#undef SQR_BASECASE_THRESHOLD
-#define SQR_BASECASE_THRESHOLD sqr_basecase_threshold
-extern mp_size_t sqr_basecase_threshold;
+#undef SQR_BASECASE_THRESHOLD
+#define SQR_BASECASE_THRESHOLD sqr_basecase_threshold
+extern mp_size_t sqr_basecase_threshold;
#endif
#if TUNE_PROGRAM_BUILD_SQR
-#undef SQR_TOOM2_THRESHOLD
-#define SQR_TOOM2_THRESHOLD SQR_TOOM2_MAX_GENERIC
+#undef SQR_KARATSUBA_THRESHOLD
+#define SQR_KARATSUBA_THRESHOLD SQR_KARATSUBA_MAX_GENERIC
#else
-#undef SQR_TOOM2_THRESHOLD
-#define SQR_TOOM2_THRESHOLD sqr_toom2_threshold
-extern mp_size_t sqr_toom2_threshold;
+#undef SQR_KARATSUBA_THRESHOLD
+#define SQR_KARATSUBA_THRESHOLD sqr_karatsuba_threshold
+extern mp_size_t sqr_karatsuba_threshold;
#endif
-#undef SQR_TOOM3_THRESHOLD
-#define SQR_TOOM3_THRESHOLD sqr_toom3_threshold
-extern mp_size_t sqr_toom3_threshold;
-
-#undef SQR_TOOM4_THRESHOLD
-#define SQR_TOOM4_THRESHOLD sqr_toom4_threshold
-extern mp_size_t sqr_toom4_threshold;
-
-#undef SQR_TOOM6_THRESHOLD
-#define SQR_TOOM6_THRESHOLD sqr_toom6_threshold
-extern mp_size_t sqr_toom6_threshold;
-
-#undef SQR_TOOM8_THRESHOLD
-#define SQR_TOOM8_THRESHOLD sqr_toom8_threshold
-extern mp_size_t sqr_toom8_threshold;
-
-#undef SQR_FFT_THRESHOLD
-#define SQR_FFT_THRESHOLD sqr_fft_threshold
-extern mp_size_t sqr_fft_threshold;
-
-#undef SQR_FFT_MODF_THRESHOLD
-#define SQR_FFT_MODF_THRESHOLD sqr_fft_modf_threshold
-extern mp_size_t sqr_fft_modf_threshold;
+#undef SQR_TOOM3_THRESHOLD
+#define SQR_TOOM3_THRESHOLD sqr_toom3_threshold
+extern mp_size_t sqr_toom3_threshold;
-#undef SQR_FFT_TABLE
-#define SQR_FFT_TABLE { 0 }
+#undef SQR_TOOM4_THRESHOLD
+#define SQR_TOOM4_THRESHOLD sqr_toom4_threshold
+extern mp_size_t sqr_toom4_threshold;
-#undef SQR_FFT_TABLE3
-#define SQR_FFT_TABLE3 { {0,0} }
+#undef SQR_FFT_THRESHOLD
+#define SQR_FFT_THRESHOLD sqr_fft_threshold
+extern mp_size_t sqr_fft_threshold;
-#undef MULLO_BASECASE_THRESHOLD
-#define MULLO_BASECASE_THRESHOLD mullo_basecase_threshold
-extern mp_size_t mullo_basecase_threshold;
+#undef SQR_FFT_MODF_THRESHOLD
+#define SQR_FFT_MODF_THRESHOLD sqr_fft_modf_threshold
+extern mp_size_t sqr_fft_modf_threshold;
-#undef MULLO_DC_THRESHOLD
-#define MULLO_DC_THRESHOLD mullo_dc_threshold
-extern mp_size_t mullo_dc_threshold;
+#undef SQR_FFT_TABLE
+#define SQR_FFT_TABLE { 0 }
-#undef MULLO_MUL_N_THRESHOLD
-#define MULLO_MUL_N_THRESHOLD mullo_mul_n_threshold
-extern mp_size_t mullo_mul_n_threshold;
+#undef MULLOW_BASECASE_THRESHOLD
+#define MULLOW_BASECASE_THRESHOLD mullow_basecase_threshold
+extern mp_size_t mullow_basecase_threshold;
-#undef MULMID_TOOM42_THRESHOLD
-#define MULMID_TOOM42_THRESHOLD mulmid_toom42_threshold
-extern mp_size_t mulmid_toom42_threshold;
+#undef MULLOW_DC_THRESHOLD
+#define MULLOW_DC_THRESHOLD mullow_dc_threshold
+extern mp_size_t mullow_dc_threshold;
-#undef DIV_QR_2_PI2_THRESHOLD
-#define DIV_QR_2_PI2_THRESHOLD div_qr_2_pi2_threshold
-extern mp_size_t div_qr_2_pi2_threshold;
+#undef MULLOW_MUL_N_THRESHOLD
+#define MULLOW_MUL_N_THRESHOLD mullow_mul_n_threshold
+extern mp_size_t mullow_mul_n_threshold;
-#undef DC_DIV_QR_THRESHOLD
-#define DC_DIV_QR_THRESHOLD dc_div_qr_threshold
-extern mp_size_t dc_div_qr_threshold;
-#undef DC_DIVAPPR_Q_THRESHOLD
-#define DC_DIVAPPR_Q_THRESHOLD dc_divappr_q_threshold
-extern mp_size_t dc_divappr_q_threshold;
-
-#undef DC_BDIV_Q_THRESHOLD
-#define DC_BDIV_Q_THRESHOLD dc_bdiv_q_threshold
-extern mp_size_t dc_bdiv_q_threshold;
-
-#undef DC_BDIV_QR_THRESHOLD
-#define DC_BDIV_QR_THRESHOLD dc_bdiv_qr_threshold
-extern mp_size_t dc_bdiv_qr_threshold;
-
-#undef MU_DIV_QR_THRESHOLD
-#define MU_DIV_QR_THRESHOLD mu_div_qr_threshold
-extern mp_size_t mu_div_qr_threshold;
-
-#undef MU_DIVAPPR_Q_THRESHOLD
-#define MU_DIVAPPR_Q_THRESHOLD mu_divappr_q_threshold
-extern mp_size_t mu_divappr_q_threshold;
-
-#undef MUPI_DIV_QR_THRESHOLD
-#define MUPI_DIV_QR_THRESHOLD mupi_div_qr_threshold
-extern mp_size_t mupi_div_qr_threshold;
-
-#undef MU_BDIV_QR_THRESHOLD
-#define MU_BDIV_QR_THRESHOLD mu_bdiv_qr_threshold
-extern mp_size_t mu_bdiv_qr_threshold;
-
-#undef MU_BDIV_Q_THRESHOLD
-#define MU_BDIV_Q_THRESHOLD mu_bdiv_q_threshold
-extern mp_size_t mu_bdiv_q_threshold;
-
-#undef INV_MULMOD_BNM1_THRESHOLD
-#define INV_MULMOD_BNM1_THRESHOLD inv_mulmod_bnm1_threshold
-extern mp_size_t inv_mulmod_bnm1_threshold;
-
-#undef INV_NEWTON_THRESHOLD
-#define INV_NEWTON_THRESHOLD inv_newton_threshold
-extern mp_size_t inv_newton_threshold;
-
-#undef INV_APPR_THRESHOLD
-#define INV_APPR_THRESHOLD inv_appr_threshold
-extern mp_size_t inv_appr_threshold;
-
-#undef BINV_NEWTON_THRESHOLD
-#define BINV_NEWTON_THRESHOLD binv_newton_threshold
-extern mp_size_t binv_newton_threshold;
-
-#undef REDC_1_TO_REDC_2_THRESHOLD
-#define REDC_1_TO_REDC_2_THRESHOLD redc_1_to_redc_2_threshold
-extern mp_size_t redc_1_to_redc_2_threshold;
-
-#undef REDC_2_TO_REDC_N_THRESHOLD
-#define REDC_2_TO_REDC_N_THRESHOLD redc_2_to_redc_n_threshold
-extern mp_size_t redc_2_to_redc_n_threshold;
-
-#undef REDC_1_TO_REDC_N_THRESHOLD
-#define REDC_1_TO_REDC_N_THRESHOLD redc_1_to_redc_n_threshold
-extern mp_size_t redc_1_to_redc_n_threshold;
-
-#undef MATRIX22_STRASSEN_THRESHOLD
-#define MATRIX22_STRASSEN_THRESHOLD matrix22_strassen_threshold
-extern mp_size_t matrix22_strassen_threshold;
-
-#undef HGCD_THRESHOLD
-#define HGCD_THRESHOLD hgcd_threshold
-extern mp_size_t hgcd_threshold;
-
-#undef HGCD_APPR_THRESHOLD
-#define HGCD_APPR_THRESHOLD hgcd_appr_threshold
-extern mp_size_t hgcd_appr_threshold;
-
-#undef HGCD_REDUCE_THRESHOLD
-#define HGCD_REDUCE_THRESHOLD hgcd_reduce_threshold
-extern mp_size_t hgcd_reduce_threshold;
+#if ! UDIV_PREINV_ALWAYS
+#undef DIV_SB_PREINV_THRESHOLD
+#define DIV_SB_PREINV_THRESHOLD div_sb_preinv_threshold
+extern mp_size_t div_sb_preinv_threshold;
+#endif
-#undef GCD_DC_THRESHOLD
-#define GCD_DC_THRESHOLD gcd_dc_threshold
-extern mp_size_t gcd_dc_threshold;
+#undef DIV_DC_THRESHOLD
+#define DIV_DC_THRESHOLD div_dc_threshold
+extern mp_size_t div_dc_threshold;
-#undef GCDEXT_DC_THRESHOLD
-#define GCDEXT_DC_THRESHOLD gcdext_dc_threshold
-extern mp_size_t gcdext_dc_threshold;
+#undef POWM_THRESHOLD
+#define POWM_THRESHOLD powm_threshold
+extern mp_size_t powm_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 MATRIX22_STRASSEN_THRESHOLD
+#define MATRIX22_STRASSEN_THRESHOLD matrix22_strassen_threshold
+extern mp_size_t matrix22_strassen_threshold;
-#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 HGCD_THRESHOLD
+#define HGCD_THRESHOLD hgcd_threshold
+extern mp_size_t hgcd_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 GCD_ACCEL_THRESHOLD
+#define GCD_ACCEL_THRESHOLD gcd_accel_threshold
+extern mp_size_t gcd_accel_threshold;
-#undef DIVREM_1_NORM_THRESHOLD
-#define DIVREM_1_NORM_THRESHOLD divrem_1_norm_threshold
-extern mp_size_t divrem_1_norm_threshold;
+#undef GCD_DC_THRESHOLD
+#define GCD_DC_THRESHOLD gcd_dc_threshold
+extern mp_size_t gcd_dc_threshold;
-#undef DIVREM_1_UNNORM_THRESHOLD
-#define DIVREM_1_UNNORM_THRESHOLD divrem_1_unnorm_threshold
-extern mp_size_t divrem_1_unnorm_threshold;
+#undef GCDEXT_DC_THRESHOLD
+#define GCDEXT_DC_THRESHOLD gcdext_dc_threshold
+extern mp_size_t gcdext_dc_threshold;
-#undef MOD_1_NORM_THRESHOLD
-#define MOD_1_NORM_THRESHOLD mod_1_norm_threshold
-extern mp_size_t mod_1_norm_threshold;
+#undef DIVREM_1_NORM_THRESHOLD
+#define DIVREM_1_NORM_THRESHOLD divrem_1_norm_threshold
+extern mp_size_t divrem_1_norm_threshold;
-#undef MOD_1_UNNORM_THRESHOLD
-#define MOD_1_UNNORM_THRESHOLD mod_1_unnorm_threshold
-extern mp_size_t mod_1_unnorm_threshold;
+#undef DIVREM_1_UNNORM_THRESHOLD
+#define DIVREM_1_UNNORM_THRESHOLD divrem_1_unnorm_threshold
+extern mp_size_t divrem_1_unnorm_threshold;
-#undef MOD_1_1P_METHOD
-#define MOD_1_1P_METHOD mod_1_1p_method
-extern int mod_1_1p_method;
+#undef MOD_1_NORM_THRESHOLD
+#define MOD_1_NORM_THRESHOLD mod_1_norm_threshold
+extern mp_size_t mod_1_norm_threshold;
-#undef MOD_1N_TO_MOD_1_1_THRESHOLD
-#define MOD_1N_TO_MOD_1_1_THRESHOLD mod_1n_to_mod_1_1_threshold
-extern mp_size_t mod_1n_to_mod_1_1_threshold;
+#undef MOD_1_UNNORM_THRESHOLD
+#define MOD_1_UNNORM_THRESHOLD mod_1_unnorm_threshold
+extern mp_size_t mod_1_unnorm_threshold;
-#undef MOD_1U_TO_MOD_1_1_THRESHOLD
-#define MOD_1U_TO_MOD_1_1_THRESHOLD mod_1u_to_mod_1_1_threshold
-extern mp_size_t mod_1u_to_mod_1_1_threshold;
+#undef MOD_1_1_THRESHOLD
+#define MOD_1_1_THRESHOLD mod_1_1_threshold
+extern mp_size_t mod_1_1_threshold;
-#undef MOD_1_1_TO_MOD_1_2_THRESHOLD
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD mod_1_1_to_mod_1_2_threshold
-extern mp_size_t mod_1_1_to_mod_1_2_threshold;
+#undef MOD_1_2_THRESHOLD
+#define MOD_1_2_THRESHOLD mod_1_2_threshold
+extern mp_size_t mod_1_2_threshold;
-#undef MOD_1_2_TO_MOD_1_4_THRESHOLD
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD mod_1_2_to_mod_1_4_threshold
-extern mp_size_t mod_1_2_to_mod_1_4_threshold;
+#undef MOD_1_3_THRESHOLD
+#define MOD_1_3_THRESHOLD mod_1_3_threshold
+extern mp_size_t mod_1_3_threshold;
-#undef PREINV_MOD_1_TO_MOD_1_THRESHOLD
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD preinv_mod_1_to_mod_1_threshold
-extern mp_size_t preinv_mod_1_to_mod_1_threshold;
+#undef MOD_1_4_THRESHOLD
+#define MOD_1_4_THRESHOLD mod_1_4_threshold
+extern mp_size_t mod_1_4_threshold;
#if ! UDIV_PREINV_ALWAYS
-#undef DIVREM_2_THRESHOLD
-#define DIVREM_2_THRESHOLD divrem_2_threshold
-extern mp_size_t divrem_2_threshold;
+#undef DIVREM_2_THRESHOLD
+#define DIVREM_2_THRESHOLD divrem_2_threshold
+extern mp_size_t divrem_2_threshold;
#endif
-#undef MULMOD_BNM1_THRESHOLD
-#define MULMOD_BNM1_THRESHOLD mulmod_bnm1_threshold
-extern mp_size_t mulmod_bnm1_threshold;
-
-#undef SQRMOD_BNM1_THRESHOLD
-#define SQRMOD_BNM1_THRESHOLD sqrmod_bnm1_threshold
-extern mp_size_t sqrmod_bnm1_threshold;
-
-#undef GET_STR_DC_THRESHOLD
-#define GET_STR_DC_THRESHOLD get_str_dc_threshold
-extern mp_size_t get_str_dc_threshold;
+#undef GET_STR_DC_THRESHOLD
+#define GET_STR_DC_THRESHOLD get_str_dc_threshold
+extern mp_size_t get_str_dc_threshold;
-#undef GET_STR_PRECOMPUTE_THRESHOLD
-#define GET_STR_PRECOMPUTE_THRESHOLD get_str_precompute_threshold
-extern mp_size_t get_str_precompute_threshold;
+#undef GET_STR_PRECOMPUTE_THRESHOLD
+#define GET_STR_PRECOMPUTE_THRESHOLD get_str_precompute_threshold
+extern mp_size_t get_str_precompute_threshold;
-#undef SET_STR_DC_THRESHOLD
-#define SET_STR_DC_THRESHOLD set_str_dc_threshold
-extern mp_size_t set_str_dc_threshold;
+#undef SET_STR_DC_THRESHOLD
+#define SET_STR_DC_THRESHOLD set_str_dc_threshold
+extern mp_size_t set_str_dc_threshold;
-#undef SET_STR_PRECOMPUTE_THRESHOLD
-#define SET_STR_PRECOMPUTE_THRESHOLD set_str_precompute_threshold
-extern mp_size_t set_str_precompute_threshold;
+#undef SET_STR_PRECOMPUTE_THRESHOLD
+#define SET_STR_PRECOMPUTE_THRESHOLD set_str_precompute_threshold
+extern mp_size_t set_str_precompute_threshold;
-#undef FAC_ODD_THRESHOLD
-#define FAC_ODD_THRESHOLD fac_odd_threshold
-extern mp_size_t fac_odd_threshold;
-
-#undef FAC_DSC_THRESHOLD
-#define FAC_DSC_THRESHOLD fac_dsc_threshold
-extern mp_size_t fac_dsc_threshold;
+#undef SET_STR_THRESHOLD
+#define SET_STR_THRESHOLD set_str_threshold
+extern mp_size_t SET_STR_THRESHOLD;
#undef FFT_TABLE_ATTRS
#define FFT_TABLE_ATTRS
extern mp_size_t mpn_fft_table[2][MPN_FFT_TABLE_SIZE];
-#define FFT_TABLE3_SIZE 2000 /* generous space for tuning */
-extern struct fft_table_nk mpn_fft_table3[2][FFT_TABLE3_SIZE];
/* Sizes the tune program tests up to, used in a couple of recompilations. */
-#undef MUL_TOOM22_THRESHOLD_LIMIT
-#undef MUL_TOOM33_THRESHOLD_LIMIT
-#undef MULLO_BASECASE_THRESHOLD_LIMIT
+#undef MUL_KARATSUBA_THRESHOLD_LIMIT
+#undef MUL_TOOM3_THRESHOLD_LIMIT
+#undef MULLOW_BASECASE_THRESHOLD_LIMIT
#undef SQR_TOOM3_THRESHOLD_LIMIT
-#define SQR_TOOM2_MAX_GENERIC 200
-#define MUL_TOOM22_THRESHOLD_LIMIT 700
-#define MUL_TOOM33_THRESHOLD_LIMIT 700
+#define SQR_KARATSUBA_MAX_GENERIC 200
+#define MUL_KARATSUBA_THRESHOLD_LIMIT 700
+#define MUL_TOOM3_THRESHOLD_LIMIT 700
#define SQR_TOOM3_THRESHOLD_LIMIT 400
#define MUL_TOOM44_THRESHOLD_LIMIT 1000
#define SQR_TOOM4_THRESHOLD_LIMIT 1000
-#define MUL_TOOM6H_THRESHOLD_LIMIT 1100
-#define SQR_TOOM6_THRESHOLD_LIMIT 1100
-#define MUL_TOOM8H_THRESHOLD_LIMIT 1200
-#define SQR_TOOM8_THRESHOLD_LIMIT 1200
-#define MULLO_BASECASE_THRESHOLD_LIMIT 200
+#define MULLOW_BASECASE_THRESHOLD_LIMIT 200
#define GET_STR_THRESHOLD_LIMIT 150
-#define FAC_DSC_THRESHOLD_LIMIT 2048
+
+/* "thresh" will normally be a variable when tuning, so use the cached
+ result. This helps mpn_sb_divrem_mn for instance. */
+#undef CACHED_ABOVE_THRESHOLD
+#define CACHED_ABOVE_THRESHOLD(cache, thresh) (cache)
+#undef CACHED_BELOW_THRESHOLD
+#define CACHED_BELOW_THRESHOLD(cache, thresh) (cache)
#endif /* TUNE_PROGRAM_BUILD */
@@ -5023,147 +4246,6 @@ extern struct fft_table_nk mpn_fft_table3[2][FFT_TABLE3_SIZE];
}
#endif
-/* FIXME: Make these itch functions less conservative. Also consider making
- them dependent on just 'an', and compute the allocation directly from 'an'
- instead of via n. */
-
-/* toom22/toom2: Scratch need is 2*(an + k), k is the recursion depth.
- k is ths smallest k such that
- ceil(an/2^k) < MUL_TOOM22_THRESHOLD.
- which implies that
- k = bitsize of floor ((an-1)/(MUL_TOOM22_THRESHOLD-1))
- = 1 + floor (log_2 (floor ((an-1)/(MUL_TOOM22_THRESHOLD-1))))
-*/
-#define mpn_toom22_mul_itch(an, bn) \
- (2 * ((an) + GMP_NUMB_BITS))
-#define mpn_toom2_sqr_itch(an) \
- (2 * ((an) + GMP_NUMB_BITS))
-
-/* toom33/toom3: Scratch need is 5an/2 + 10k, k is the recursion depth.
- We use 3an + C, so that we can use a smaller constant.
- */
-#define mpn_toom33_mul_itch(an, bn) \
- (3 * (an) + GMP_NUMB_BITS)
-#define mpn_toom3_sqr_itch(an) \
- (3 * (an) + GMP_NUMB_BITS)
-
-/* toom33/toom3: Scratch need is 8an/3 + 13k, k is the recursion depth.
- We use 3an + C, so that we can use a smaller constant.
- */
-#define mpn_toom44_mul_itch(an, bn) \
- (3 * (an) + GMP_NUMB_BITS)
-#define mpn_toom4_sqr_itch(an) \
- (3 * (an) + GMP_NUMB_BITS)
-
-#define mpn_toom6_sqr_itch(n) \
- (((n) - SQR_TOOM6_THRESHOLD)*2 + \
- MAX(SQR_TOOM6_THRESHOLD*2 + GMP_NUMB_BITS*6, \
- mpn_toom4_sqr_itch(SQR_TOOM6_THRESHOLD)))
-
-#define MUL_TOOM6H_MIN \
- ((MUL_TOOM6H_THRESHOLD > MUL_TOOM44_THRESHOLD) ? \
- MUL_TOOM6H_THRESHOLD : MUL_TOOM44_THRESHOLD)
-#define mpn_toom6_mul_n_itch(n) \
- (((n) - MUL_TOOM6H_MIN)*2 + \
- MAX(MUL_TOOM6H_MIN*2 + GMP_NUMB_BITS*6, \
- mpn_toom44_mul_itch(MUL_TOOM6H_MIN,MUL_TOOM6H_MIN)))
-
-static inline mp_size_t
-mpn_toom6h_mul_itch (mp_size_t an, mp_size_t bn) {
- mp_size_t estimatedN;
- estimatedN = (an + bn) / (size_t) 10 + 1;
- return mpn_toom6_mul_n_itch (estimatedN * 6);
-}
-
-#define mpn_toom8_sqr_itch(n) \
- ((((n)*15)>>3) - ((SQR_TOOM8_THRESHOLD*15)>>3) + \
- MAX(((SQR_TOOM8_THRESHOLD*15)>>3) + GMP_NUMB_BITS*6, \
- mpn_toom6_sqr_itch(SQR_TOOM8_THRESHOLD)))
-
-#define MUL_TOOM8H_MIN \
- ((MUL_TOOM8H_THRESHOLD > MUL_TOOM6H_MIN) ? \
- MUL_TOOM8H_THRESHOLD : MUL_TOOM6H_MIN)
-#define mpn_toom8_mul_n_itch(n) \
- ((((n)*15)>>3) - ((MUL_TOOM8H_MIN*15)>>3) + \
- MAX(((MUL_TOOM8H_MIN*15)>>3) + GMP_NUMB_BITS*6, \
- mpn_toom6_mul_n_itch(MUL_TOOM8H_MIN)))
-
-static inline mp_size_t
-mpn_toom8h_mul_itch (mp_size_t an, mp_size_t bn) {
- mp_size_t estimatedN;
- estimatedN = (an + bn) / (size_t) 14 + 1;
- return mpn_toom8_mul_n_itch (estimatedN * 8);
-}
-
-static inline mp_size_t
-mpn_toom32_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1);
- mp_size_t itch = 2 * n + 1;
-
- return itch;
-}
-
-static inline mp_size_t
-mpn_toom42_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = an >= 2 * bn ? (an + 3) >> 2 : (bn + 1) >> 1;
- return 6 * n + 3;
-}
-
-static inline mp_size_t
-mpn_toom43_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = 1 + (3 * an >= 4 * bn ? (an - 1) >> 2 : (bn - 1) / (size_t) 3);
-
- return 6*n + 4;
-}
-
-static inline mp_size_t
-mpn_toom52_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = 1 + (2 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) >> 1);
- return 6*n + 4;
-}
-
-static inline mp_size_t
-mpn_toom53_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = 1 + (3 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) / (size_t) 3);
- return 10 * n + 10;
-}
-
-static inline mp_size_t
-mpn_toom62_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = 1 + (an >= 3 * bn ? (an - 1) / (size_t) 6 : (bn - 1) >> 1);
- return 10 * n + 10;
-}
-
-static inline mp_size_t
-mpn_toom63_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = 1 + (an >= 2 * bn ? (an - 1) / (size_t) 6 : (bn - 1) / (size_t) 3);
- return 9 * n + 3;
-}
-
-static inline mp_size_t
-mpn_toom54_mul_itch (mp_size_t an, mp_size_t bn)
-{
- mp_size_t n = 1 + (4 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) / (size_t) 4);
- return 9 * n + 3;
-}
-
-/* let S(n) = space required for input size n,
- then S(n) = 3 floor(n/2) + 1 + S(floor(n/2)). */
-#define mpn_toom42_mulmid_itch(n) \
- (3 * (n) + GMP_NUMB_BITS)
-
-#if 0
-#define mpn_fft_mul mpn_mul_fft_full
-#else
-#define mpn_fft_mul mpn_nussbaumer_mul
-#endif
#ifdef __cplusplus
@@ -5194,8 +4276,8 @@ class gmp_allocated_string {
std::istream &__gmpz_operator_in_nowhite (std::istream &, mpz_ptr, char);
int __gmp_istream_set_base (std::istream &, char &, bool &, bool &);
void __gmp_istream_set_digits (std::string &, std::istream &, char &, bool &, int);
-void __gmp_doprnt_params_from_ios (struct doprnt_params_t *, std::ios &);
-std::ostream& __gmp_doprnt_integer_ostream (std::ostream &, struct doprnt_params_t *, char *);
+void __gmp_doprnt_params_from_ios (struct doprnt_params_t *p, std::ios &o);
+std::ostream& __gmp_doprnt_integer_ostream (std::ostream &o, struct doprnt_params_t *p, char *s);
extern const struct doprnt_funs_t __gmp_asprintf_funs_noformat;
#endif /* __cplusplus */
diff --git a/gmp/gmpxx.h b/gmp/gmpxx.h
index 6dd9129c5a..566236678f 100644
--- a/gmp/gmpxx.h
+++ b/gmp/gmpxx.h
@@ -1,32 +1,33 @@
/* gmpxx.h -- C++ class wrapper for GMP types. -*- C++ -*-
-Copyright 2001-2003, 2006, 2008, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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/. */
+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/. */
+
+/* the C++ compiler must implement the following features:
+ - member templates
+ - partial specialization of templates
+ - namespace support
+ for g++, this means version 2.91 or higher
+ for other compilers, I don't know */
+#ifdef __GNUC__
+#if __GNUC__ < 2 || (__GNUC__ == 2 && __GNUC_MINOR__ < 91)
+#error gmpxx.h requires g++ version 2.91 (egcs 1.1.2) or higher
+#endif
+#endif
#ifndef __GMP_PLUSPLUS__
#define __GMP_PLUSPLUS__
@@ -34,125 +35,11 @@ see https://www.gnu.org/licenses/. */
#include <iosfwd>
#include <cstring> /* for strlen */
-#include <limits> /* numeric_limits */
-#include <utility>
-#include <algorithm> /* swap */
#include <string>
#include <stdexcept>
#include <cfloat>
#include <gmp.h>
-// wrapper for gcc's __builtin_constant_p
-// __builtin_constant_p has been in gcc since forever,
-// but g++-3.4 miscompiles it.
-#if __GMP_GNUC_PREREQ(4, 2)
-#define __GMPXX_CONSTANT(X) __builtin_constant_p(X)
-#else
-#define __GMPXX_CONSTANT(X) false
-#endif
-#define __GMPXX_CONSTANT_TRUE(X) (__GMPXX_CONSTANT(X) && (X))
-
-// Use C++11 features
-#ifndef __GMPXX_USE_CXX11
-#if __cplusplus >= 201103L
-#define __GMPXX_USE_CXX11 1
-#else
-#define __GMPXX_USE_CXX11 0
-#endif
-#endif
-
-#if __GMPXX_USE_CXX11
-#define __GMPXX_NOEXCEPT noexcept
-#include <type_traits> // for common_type
-#else
-#define __GMPXX_NOEXCEPT
-#endif
-
-// 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);
- p->_mp_d[0] = l & GMP_NUMB_MASK;
-#if __GMPZ_ULI_LIMBS > 1
- l >>= GMP_NUMB_BITS;
- p->_mp_d[1] = l;
- p->_mp_size += (l != 0);
-#endif
-}
-
-inline void __mpz_set_si_safe(mpz_ptr p, long l)
-{
- if(l < 0)
- {
- __mpz_set_ui_safe(p, -static_cast<unsigned long>(l));
- mpz_neg(p, p);
- }
- else
- __mpz_set_ui_safe(p, l);
- // Note: we know the high bit of l is 0 so we could do slightly better
-}
-
-// Fake temporary variables
-#define __GMPXX_TMPZ_UI \
- mpz_t temp; \
- mp_limb_t limbs[__GMPZ_ULI_LIMBS]; \
- temp->_mp_d = limbs; \
- __mpz_set_ui_safe (temp, l)
-#define __GMPXX_TMPZ_SI \
- mpz_t temp; \
- mp_limb_t limbs[__GMPZ_ULI_LIMBS]; \
- temp->_mp_d = limbs; \
- __mpz_set_si_safe (temp, l)
-#define __GMPXX_TMPZ_D \
- mpz_t temp; \
- mp_limb_t limbs[__GMPZ_DBL_LIMBS]; \
- temp->_mp_d = limbs; \
- temp->_mp_alloc = __GMPZ_DBL_LIMBS; \
- mpz_set_d (temp, d)
-
-#define __GMPXX_TMPQ_UI \
- mpq_t temp; \
- mp_limb_t limbs[__GMPZ_ULI_LIMBS+1]; \
- mpq_numref(temp)->_mp_d = limbs; \
- __mpz_set_ui_safe (mpq_numref(temp), 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_SI \
- mpq_t temp; \
- mp_limb_t limbs[__GMPZ_ULI_LIMBS+1]; \
- mpq_numref(temp)->_mp_d = limbs; \
- __mpz_set_si_safe (mpq_numref(temp), 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)
-{
- return l >= 0 ? static_cast<unsigned long>(l)
- : -static_cast<unsigned long>(l);
-}
/**************** Function objects ****************/
/* Any evaluation of a __gmp_expr ends up calling one of these functions
@@ -185,77 +72,82 @@ struct __gmp_binary_plus
{ mpz_add(z, w, v); }
static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- {
- // Ideally, those checks should happen earlier so that the tree
- // generated for a+0+b would just be sum(a,b).
- if (__GMPXX_CONSTANT(l) && l == 0)
- {
- if (z != w) mpz_set(z, w);
- }
- else
- mpz_add_ui(z, w, l);
- }
+ { mpz_add_ui(z, w, l); }
static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { mpz_add_ui(z, w, l); }
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
{
if (l >= 0)
- eval(z, w, static_cast<unsigned long>(l));
+ mpz_add_ui(z, w, l);
else
- mpz_sub_ui(z, w, -static_cast<unsigned long>(l));
+ mpz_sub_ui(z, w, -l);
}
static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ {
+ if (l >= 0)
+ mpz_add_ui(z, w, l);
+ else
+ mpz_sub_ui(z, w, -l);
+ }
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_add (z, w, temp); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_add(z, w, temp);
+ mpz_clear(temp);
+ }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { eval(z, w, d); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_add(z, temp, w);
+ mpz_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
{ mpq_add(q, r, s); }
static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
+ { mpq_set(q, r); mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l); }
+ static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
+ { mpq_set(q, r); mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l); }
+ static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
- if (__GMPXX_CONSTANT(l) && l == 0)
- {
- if (q != r) mpq_set(q, r);
- }
+ mpq_set(q, r);
+ if (l >= 0)
+ mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l);
else
- {
- if (q == r)
- mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l);
- else
- {
- mpz_mul_ui(mpq_numref(q), mpq_denref(r), l);
- mpz_add(mpq_numref(q), mpq_numref(q), mpq_numref(r));
- mpz_set(mpq_denref(q), mpq_denref(r));
- }
- }
+ mpz_submul_ui(mpq_numref(q), mpq_denref(q), -l);
}
- static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { eval(q, r, l); }
- static inline void eval(mpq_ptr q, mpq_srcptr r, signed long int l);
- // defined after __gmp_binary_minus
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- { eval(q, r, l); }
+ {
+ mpq_set(q, r);
+ if (l >= 0)
+ mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l);
+ else
+ mpz_submul_ui(mpq_numref(q), mpq_denref(q), -l);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, double d)
- { __GMPXX_TMPQ_D; mpq_add (q, r, temp); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_add(q, r, temp);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, double d, mpq_srcptr r)
- { eval(q, r, d); }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpz_srcptr z)
{
- if (q == r)
- mpz_addmul(mpq_numref(q), mpq_denref(q), z);
- else
- {
- mpz_mul(mpq_numref(q), mpq_denref(r), z);
- mpz_add(mpq_numref(q), mpq_numref(q), mpq_numref(r));
- mpz_set(mpq_denref(q), mpq_denref(r));
- }
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_add(q, temp, r);
+ mpq_clear(temp);
}
+
+ static void eval(mpq_ptr q, mpq_srcptr r, mpz_srcptr z)
+ { mpq_set(q, r); mpz_addmul(mpq_numref(q), mpq_denref(q), z); }
static void eval(mpq_ptr q, mpz_srcptr z, mpq_srcptr r)
- { eval(q, r, z); }
+ { mpq_set(q, r); mpz_addmul(mpq_numref(q), mpq_denref(q), z); }
static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
{ mpf_add(f, g, h); }
@@ -269,10 +161,15 @@ struct __gmp_binary_plus
if (l >= 0)
mpf_add_ui(f, g, l);
else
- mpf_sub_ui(f, g, -static_cast<unsigned long>(l));
+ mpf_sub_ui(f, g, -l);
}
static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- { eval(f, g, l); }
+ {
+ if (l >= 0)
+ mpf_add_ui(f, g, l);
+ else
+ mpf_sub_ui(f, g, -l);
+ }
static void eval(mpf_ptr f, mpf_srcptr g, double d)
{
mpf_t temp;
@@ -282,7 +179,13 @@ struct __gmp_binary_plus
mpf_clear(temp);
}
static void eval(mpf_ptr f, double d, mpf_srcptr g)
- { eval(f, g, d); }
+ {
+ mpf_t temp;
+ mpf_init2(temp, 8*sizeof(double));
+ mpf_set_d(temp, d);
+ mpf_add(f, temp, g);
+ mpf_clear(temp);
+ }
};
struct __gmp_binary_minus
@@ -291,95 +194,85 @@ struct __gmp_binary_minus
{ mpz_sub(z, w, v); }
static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- {
- if (__GMPXX_CONSTANT(l) && l == 0)
- {
- if (z != w) mpz_set(z, w);
- }
- else
- mpz_sub_ui(z, w, l);
- }
+ { mpz_sub_ui(z, w, l); }
static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- {
- if (__GMPXX_CONSTANT(l) && l == 0)
- {
- mpz_neg(z, w);
- }
- else
- mpz_ui_sub(z, l, w);
- }
+ { mpz_ui_sub(z, l, w); }
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
{
if (l >= 0)
- eval(z, w, static_cast<unsigned long>(l));
+ mpz_sub_ui(z, w, l);
else
- mpz_add_ui(z, w, -static_cast<unsigned long>(l));
+ mpz_add_ui(z, w, -l);
}
static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
{
if (l >= 0)
- eval(z, static_cast<unsigned long>(l), w);
+ mpz_ui_sub(z, l, w);
else
{
- mpz_add_ui(z, w, -static_cast<unsigned long>(l));
+ mpz_add_ui(z, w, -l);
mpz_neg(z, z);
}
}
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_sub (z, w, temp); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_sub(z, w, temp);
+ mpz_clear(temp);
+ }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { __GMPXX_TMPZ_D; mpz_sub (z, temp, w); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_sub(z, temp, w);
+ mpz_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
{ mpq_sub(q, r, s); }
static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
- {
- if (__GMPXX_CONSTANT(l) && l == 0)
- {
- if (q != r) mpq_set(q, r);
- }
- else
- {
- if (q == r)
- mpz_submul_ui(mpq_numref(q), mpq_denref(q), l);
- else
- {
- mpz_mul_ui(mpq_numref(q), mpq_denref(r), l);
- mpz_sub(mpq_numref(q), mpq_numref(r), mpq_numref(q));
- mpz_set(mpq_denref(q), mpq_denref(r));
- }
- }
- }
+ { mpq_set(q, r); mpz_submul_ui(mpq_numref(q), mpq_denref(q), l); }
static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { eval(q, r, l); mpq_neg(q, q); }
+ { mpq_neg(q, r); mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l); }
static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
+ mpq_set(q, r);
if (l >= 0)
- eval(q, r, static_cast<unsigned long>(l));
+ mpz_submul_ui(mpq_numref(q), mpq_denref(q), l);
else
- __gmp_binary_plus::eval(q, r, -static_cast<unsigned long>(l));
+ mpz_addmul_ui(mpq_numref(q), mpq_denref(q), -l);
}
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- { eval(q, r, l); mpq_neg(q, q); }
+ {
+ mpq_neg(q, r);
+ if (l >= 0)
+ mpz_addmul_ui(mpq_numref(q), mpq_denref(q), l);
+ else
+ mpz_submul_ui(mpq_numref(q), mpq_denref(q), -l);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, double d)
- { __GMPXX_TMPQ_D; mpq_sub (q, r, temp); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_sub(q, r, temp);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, double d, mpq_srcptr r)
- { __GMPXX_TMPQ_D; mpq_sub (q, temp, r); }
-
- static void eval(mpq_ptr q, mpq_srcptr r, mpz_srcptr z)
{
- if (q == r)
- mpz_submul(mpq_numref(q), mpq_denref(q), z);
- else
- {
- mpz_mul(mpq_numref(q), mpq_denref(r), z);
- mpz_sub(mpq_numref(q), mpq_numref(r), mpq_numref(q));
- mpz_set(mpq_denref(q), mpq_denref(r));
- }
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_sub(q, temp, r);
+ mpq_clear(temp);
}
+
+ static void eval(mpq_ptr q, mpq_srcptr r, mpz_srcptr z)
+ { mpq_set(q, r); mpz_submul(mpq_numref(q), mpq_denref(q), z); }
static void eval(mpq_ptr q, mpz_srcptr z, mpq_srcptr r)
- { eval(q, r, z); mpq_neg(q, q); }
+ { mpq_neg(q, r); mpz_addmul(mpq_numref(q), mpq_denref(q), z); }
static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
{ mpf_sub(f, g, h); }
@@ -393,14 +286,14 @@ struct __gmp_binary_minus
if (l >= 0)
mpf_sub_ui(f, g, l);
else
- mpf_add_ui(f, g, -static_cast<unsigned long>(l));
+ mpf_add_ui(f, g, -l);
}
static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
{
if (l >= 0)
mpf_sub_ui(f, g, l);
else
- mpf_add_ui(f, g, -static_cast<unsigned long>(l));
+ mpf_add_ui(f, g, -l);
mpf_neg(f, f);
}
static void eval(mpf_ptr f, mpf_srcptr g, double d)
@@ -421,156 +314,85 @@ struct __gmp_binary_minus
}
};
-// defined here so it can reference __gmp_binary_minus
-inline void
-__gmp_binary_plus::eval(mpq_ptr q, mpq_srcptr r, signed long int l)
-{
- if (l >= 0)
- eval(q, r, static_cast<unsigned long>(l));
- else
- __gmp_binary_minus::eval(q, r, -static_cast<unsigned long>(l));
-}
-
-struct __gmp_binary_lshift
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mp_bitcnt_t l)
- {
- if (__GMPXX_CONSTANT(l) && (l == 0))
- {
- if (z != w) mpz_set(z, w);
- }
- else
- mpz_mul_2exp(z, w, l);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, mp_bitcnt_t l)
- {
- if (__GMPXX_CONSTANT(l) && (l == 0))
- {
- if (q != r) mpq_set(q, r);
- }
- else
- mpq_mul_2exp(q, r, l);
- }
- static void eval(mpf_ptr f, mpf_srcptr g, mp_bitcnt_t l)
- { mpf_mul_2exp(f, g, l); }
-};
-
-struct __gmp_binary_rshift
-{
- static void eval(mpz_ptr z, mpz_srcptr w, mp_bitcnt_t l)
- {
- if (__GMPXX_CONSTANT(l) && (l == 0))
- {
- if (z != w) mpz_set(z, w);
- }
- else
- mpz_fdiv_q_2exp(z, w, l);
- }
- static void eval(mpq_ptr q, mpq_srcptr r, mp_bitcnt_t l)
- {
- if (__GMPXX_CONSTANT(l) && (l == 0))
- {
- if (q != r) mpq_set(q, r);
- }
- else
- mpq_div_2exp(q, r, l);
- }
- static void eval(mpf_ptr f, mpf_srcptr g, mp_bitcnt_t l)
- { mpf_div_2exp(f, g, l); }
-};
-
struct __gmp_binary_multiplies
{
static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
{ mpz_mul(z, w, v); }
static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- {
-// gcc-3.3 doesn't have __builtin_ctzl. Don't bother optimizing for old gcc.
-#if __GMP_GNUC_PREREQ(3, 4)
- if (__GMPXX_CONSTANT(l) && (l & (l-1)) == 0)
- {
- if (l == 0)
- {
- z->_mp_size = 0;
- }
- else
- {
- __gmp_binary_lshift::eval(z, w, __builtin_ctzl(l));
- }
- }
- else
-#endif
- mpz_mul_ui(z, w, l);
- }
+ { mpz_mul_ui(z, w, l); }
static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { mpz_mul_ui(z, w, l); }
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- {
- 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);
- }
+ { mpz_mul_si (z, w, l); }
static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { mpz_mul_si (z, w, l); }
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_mul (z, w, temp); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_mul(z, w, temp);
+ mpz_clear(temp);
+ }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { eval(z, w, d); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_mul(z, temp, w);
+ mpz_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
{ mpq_mul(q, r, s); }
static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
{
-#if __GMP_GNUC_PREREQ(3, 4)
- if (__GMPXX_CONSTANT(l) && (l & (l-1)) == 0)
- {
- if (l == 0)
- {
- mpq_set_ui(q, 0, 1);
- }
- else
- {
- __gmp_binary_lshift::eval(q, r, __builtin_ctzl(l));
- }
- }
- else
-#endif
- {
- __GMPXX_TMPQ_UI;
- mpq_mul (q, r, temp);
- }
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_ui(temp, l, 1);
+ mpq_mul(q, r, temp);
+ mpq_clear(temp);
}
static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { eval(q, r, l); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_ui(temp, l, 1);
+ mpq_mul(q, temp, r);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
- 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);
- }
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_si(temp, l, 1);
+ mpq_mul(q, r, temp);
+ mpq_clear(temp);
}
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- { eval(q, r, l); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_si(temp, l, 1);
+ mpq_mul(q, temp, r);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, double d)
- { __GMPXX_TMPQ_D; mpq_mul (q, r, temp); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_mul(q, r, temp);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, double d, mpq_srcptr r)
- { eval(q, r, d); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_mul(q, temp, r);
+ mpq_clear(temp);
+ }
static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
{ mpf_mul(f, g, h); }
@@ -585,12 +407,20 @@ struct __gmp_binary_multiplies
mpf_mul_ui(f, g, l);
else
{
- mpf_mul_ui(f, g, -static_cast<unsigned long>(l));
+ mpf_mul_ui(f, g, -l);
mpf_neg(f, f);
}
}
static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- { eval(f, g, l); }
+ {
+ if (l >= 0)
+ mpf_mul_ui(f, g, l);
+ else
+ {
+ mpf_mul_ui(f, g, -l);
+ mpf_neg(f, f);
+ }
+ }
static void eval(mpf_ptr f, mpf_srcptr g, double d)
{
mpf_t temp;
@@ -600,7 +430,13 @@ struct __gmp_binary_multiplies
mpf_clear(temp);
}
static void eval(mpf_ptr f, double d, mpf_srcptr g)
- { eval(f, g, d); }
+ {
+ mpf_t temp;
+ mpf_init2(temp, 8*sizeof(double));
+ mpf_set_d(temp, d);
+ mpf_mul(f, temp, g);
+ mpf_clear(temp);
+ }
};
struct __gmp_binary_divides
@@ -609,23 +445,7 @@ struct __gmp_binary_divides
{ mpz_tdiv_q(z, w, v); }
static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- {
-#if __GMP_GNUC_PREREQ(3, 4)
- // Don't optimize division by 0...
- if (__GMPXX_CONSTANT(l) && (l & (l-1)) == 0 && l != 0)
- {
- if (l == 1)
- {
- if (z != w) mpz_set(z, w);
- }
- else
- mpz_tdiv_q_2exp(z, w, __builtin_ctzl(l));
- // warning: do not use rshift (fdiv)
- }
- else
-#endif
- mpz_tdiv_q_ui(z, w, l);
- }
+ { mpz_tdiv_q_ui(z, w, l); }
static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
{
if (mpz_sgn(w) >= 0)
@@ -650,10 +470,10 @@ struct __gmp_binary_divides
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
{
if (l >= 0)
- eval(z, w, static_cast<unsigned long>(l));
+ mpz_tdiv_q_ui(z, w, l);
else
{
- eval(z, w, -static_cast<unsigned long>(l));
+ mpz_tdiv_q_ui(z, w, -l);
mpz_neg(z, z);
}
}
@@ -665,52 +485,75 @@ struct __gmp_binary_divides
{
/* if w is bigger than a long then the quotient must be zero, unless
l==LONG_MIN and w==-LONG_MIN in which case the quotient is -1 */
- mpz_set_si (z, (mpz_cmpabs_ui (w, __gmpxx_abs_ui(l)) == 0 ? -1 : 0));
+ mpz_set_si (z, (mpz_cmpabs_ui (w, (l >= 0 ? l : -l)) == 0 ? -1 : 0));
}
}
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_tdiv_q (z, w, temp); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_tdiv_q(z, w, temp);
+ mpz_clear(temp);
+ }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { __GMPXX_TMPZ_D; mpz_tdiv_q (z, temp, w); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_tdiv_q(z, temp, w);
+ mpz_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, mpq_srcptr s)
{ mpq_div(q, r, s); }
static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
{
-#if __GMP_GNUC_PREREQ(3, 4)
- if (__GMPXX_CONSTANT(l) && (l & (l-1)) == 0 && l != 0)
- __gmp_binary_rshift::eval(q, r, __builtin_ctzl(l));
- else
-#endif
- {
- __GMPXX_TMPQ_UI;
- mpq_div (q, r, temp);
- }
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_ui(temp, l, 1);
+ mpq_div(q, r, temp);
+ mpq_clear(temp);
}
static void eval(mpq_ptr q, unsigned long int l, mpq_srcptr r)
- { __GMPXX_TMPQ_UI; mpq_div (q, temp, r); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_ui(temp, l, 1);
+ mpq_div(q, temp, r);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, signed long int l)
{
- 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);
- }
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_si(temp, l, 1);
+ mpq_div(q, r, temp);
+ mpq_clear(temp);
}
static void eval(mpq_ptr q, signed long int l, mpq_srcptr r)
- { __GMPXX_TMPQ_SI; mpq_div (q, temp, r); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_si(temp, l, 1);
+ mpq_div(q, temp, r);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, mpq_srcptr r, double d)
- { __GMPXX_TMPQ_D; mpq_div (q, r, temp); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_div(q, r, temp);
+ mpq_clear(temp);
+ }
static void eval(mpq_ptr q, double d, mpq_srcptr r)
- { __GMPXX_TMPQ_D; mpq_div (q, temp, r); }
+ {
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ mpq_div(q, temp, r);
+ mpq_clear(temp);
+ }
static void eval(mpf_ptr f, mpf_srcptr g, mpf_srcptr h)
{ mpf_div(f, g, h); }
@@ -725,7 +568,7 @@ struct __gmp_binary_divides
mpf_div_ui(f, g, l);
else
{
- mpf_div_ui(f, g, -static_cast<unsigned long>(l));
+ mpf_div_ui(f, g, -l);
mpf_neg(f, f);
}
}
@@ -735,7 +578,7 @@ struct __gmp_binary_divides
mpf_ui_div(f, l, g);
else
{
- mpf_ui_div(f, -static_cast<unsigned long>(l), g);
+ mpf_ui_div(f, -l, g);
mpf_neg(f, f);
}
}
@@ -784,7 +627,7 @@ struct __gmp_binary_modulus
}
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
{
- mpz_tdiv_r_ui (z, w, __gmpxx_abs_ui(l));
+ mpz_tdiv_r_ui (z, w, (l >= 0 ? l : -l));
}
static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
{
@@ -794,32 +637,65 @@ struct __gmp_binary_modulus
{
/* if w is bigger than a long then the remainder is l unchanged,
unless l==LONG_MIN and w==-LONG_MIN in which case it's 0 */
- mpz_set_si (z, mpz_cmpabs_ui (w, __gmpxx_abs_ui(l)) == 0 ? 0 : l);
+ mpz_set_si (z, mpz_cmpabs_ui (w, (l >= 0 ? l : -l)) == 0 ? 0 : l);
}
}
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_tdiv_r (z, w, temp); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_tdiv_r(z, w, temp);
+ mpz_clear(temp);
+ }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { __GMPXX_TMPZ_D; mpz_tdiv_r (z, temp, w); }
+ {
+ mpz_t temp;
+ mpz_init_set_d(temp, d);
+ mpz_tdiv_r(z, temp, w);
+ mpz_clear(temp);
+ }
};
+// Max allocations for plain types when converted to mpz_t
+#define __GMP_DBL_LIMBS (2 + DBL_MAX_EXP / GMP_NUMB_BITS)
+#define __GMP_ULI_LIMBS (1 + (8 * sizeof (long) - 1) / GMP_NUMB_BITS)
+
+#define __GMPXX_TMP_UI \
+ mpz_t temp; \
+ mp_limb_t limbs[__GMP_ULI_LIMBS]; \
+ temp->_mp_d = limbs; \
+ temp->_mp_alloc = __GMP_ULI_LIMBS; \
+ mpz_set_ui (temp, l)
+#define __GMPXX_TMP_SI \
+ mpz_t temp; \
+ mp_limb_t limbs[__GMP_ULI_LIMBS]; \
+ temp->_mp_d = limbs; \
+ temp->_mp_alloc = __GMP_ULI_LIMBS; \
+ mpz_set_si (temp, l)
+#define __GMPXX_TMP_D \
+ mpz_t temp; \
+ mp_limb_t limbs[__GMP_DBL_LIMBS]; \
+ temp->_mp_d = limbs; \
+ temp->_mp_alloc = __GMP_DBL_LIMBS; \
+ mpz_set_d (temp, d)
+
struct __gmp_binary_and
{
static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
{ mpz_and(z, w, v); }
static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { __GMPXX_TMPZ_UI; mpz_and (z, w, temp); }
+ { __GMPXX_TMP_UI; mpz_and (z, w, temp); }
static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { __GMPXX_TMP_UI; mpz_and (z, w, temp); }
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- { __GMPXX_TMPZ_SI; mpz_and (z, w, temp); }
+ { __GMPXX_TMP_SI; mpz_and (z, w, temp); }
static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { __GMPXX_TMP_SI; mpz_and (z, w, temp); }
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_and (z, w, temp); }
+ { __GMPXX_TMP_D; mpz_and (z, w, temp); }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { eval(z, w, d); }
+ { __GMPXX_TMP_D; mpz_and (z, w, temp); }
};
struct __gmp_binary_ior
@@ -827,17 +703,17 @@ struct __gmp_binary_ior
static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
{ mpz_ior(z, w, v); }
static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { __GMPXX_TMPZ_UI; mpz_ior (z, w, temp); }
+ { __GMPXX_TMP_UI; mpz_ior (z, w, temp); }
static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { __GMPXX_TMP_UI; mpz_ior (z, w, temp); }
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- { __GMPXX_TMPZ_SI; mpz_ior (z, w, temp); }
+ { __GMPXX_TMP_SI; mpz_ior (z, w, temp); }
static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { __GMPXX_TMP_SI; mpz_ior (z, w, temp); }
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_ior (z, w, temp); }
+ { __GMPXX_TMP_D; mpz_ior (z, w, temp); }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { eval(z, w, d); }
+ { __GMPXX_TMP_D; mpz_ior (z, w, temp); }
};
struct __gmp_binary_xor
@@ -845,17 +721,37 @@ struct __gmp_binary_xor
static void eval(mpz_ptr z, mpz_srcptr w, mpz_srcptr v)
{ mpz_xor(z, w, v); }
static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
- { __GMPXX_TMPZ_UI; mpz_xor (z, w, temp); }
+ { __GMPXX_TMP_UI; mpz_xor (z, w, temp); }
static void eval(mpz_ptr z, unsigned long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { __GMPXX_TMP_UI; mpz_xor (z, w, temp); }
static void eval(mpz_ptr z, mpz_srcptr w, signed long int l)
- { __GMPXX_TMPZ_SI; mpz_xor (z, w, temp); }
+ { __GMPXX_TMP_SI; mpz_xor (z, w, temp); }
static void eval(mpz_ptr z, signed long int l, mpz_srcptr w)
- { eval(z, w, l); }
+ { __GMPXX_TMP_SI; mpz_xor (z, w, temp); }
static void eval(mpz_ptr z, mpz_srcptr w, double d)
- { __GMPXX_TMPZ_D; mpz_xor (z, w, temp); }
+ { __GMPXX_TMP_D; mpz_xor (z, w, temp); }
static void eval(mpz_ptr z, double d, mpz_srcptr w)
- { eval(z, w, d); }
+ { __GMPXX_TMP_D; mpz_xor (z, w, temp); }
+};
+
+struct __gmp_binary_lshift
+{
+ static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
+ { mpz_mul_2exp(z, w, l); }
+ static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
+ { mpq_mul_2exp(q, r, l); }
+ static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
+ { mpf_mul_2exp(f, g, l); }
+};
+
+struct __gmp_binary_rshift
+{
+ static void eval(mpz_ptr z, mpz_srcptr w, unsigned long int l)
+ { mpz_fdiv_q_2exp(z, w, l); }
+ static void eval(mpq_ptr q, mpq_srcptr r, unsigned long int l)
+ { mpq_div_2exp(q, r, l); }
+ static void eval(mpf_ptr f, mpf_srcptr g, unsigned long int l)
+ { mpf_div_2exp(f, g, l); }
};
struct __gmp_binary_equal
@@ -865,15 +761,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 eval(z, l); }
+ { 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 eval(z, l); }
+ { 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 eval(z, d); }
+ { return mpz_cmp_d(z, d) == 0; }
static bool eval(mpq_srcptr q, mpq_srcptr r)
{ return mpq_equal(q, r) != 0; }
@@ -881,30 +777,111 @@ 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 eval(q, l); }
+ { 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 eval(q, l); }
+ { return mpq_cmp_si(q, l, 1) == 0; }
static bool eval(mpq_srcptr q, double d)
- { __GMPXX_TMPQ_D; return mpq_equal (q, temp) != 0; }
+ {
+ bool b;
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ b = (mpq_equal(q, temp) != 0);
+ mpq_clear(temp);
+ return b;
+ }
static bool eval(double d, mpq_srcptr q)
- { return eval(q, d); }
+ {
+ bool b;
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ b = (mpq_equal(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 eval(f, l); }
+ { 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 eval(f, l); }
+ { 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 eval(f, d); }
+ { return mpf_cmp_d(f, d) == 0; }
+};
+
+struct __gmp_binary_not_equal
+{
+ 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_equal(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_equal(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_equal(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; }
};
struct __gmp_binary_less
@@ -935,9 +912,25 @@ 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)
- { __GMPXX_TMPQ_D; return mpq_cmp (q, temp) < 0; }
+ {
+ 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)
- { __GMPXX_TMPQ_D; return mpq_cmp (temp, q) < 0; }
+ {
+ 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; }
@@ -955,10 +948,196 @@ struct __gmp_binary_less
{ return mpf_cmp_d(f, d) > 0; }
};
+struct __gmp_binary_less_equal
+{
+ 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; }
+};
+
struct __gmp_binary_greater
{
- template <class T, class U>
- static inline bool eval(T t, U u) { return __gmp_binary_less::eval(u, t); }
+ 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; }
+};
+
+struct __gmp_binary_greater_equal
+{
+ 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; }
};
struct __gmp_unary_increment
@@ -1024,17 +1203,44 @@ struct __gmp_hypot_function
mpf_init2(temp, mpf_get_prec(f));
mpf_mul(temp, g, g);
mpf_set_ui(f, l);
- mpf_mul_ui(f, f, l);
+ mpf_mul(f, f, f);
mpf_add(f, f, temp);
- mpf_clear(temp);
mpf_sqrt(f, f);
+ mpf_clear(temp);
}
static void eval(mpf_ptr f, unsigned long int l, mpf_srcptr g)
- { eval(f, g, l); }
+ {
+ mpf_t temp;
+ mpf_init2(temp, mpf_get_prec(f));
+ mpf_mul(temp, g, g);
+ mpf_set_ui(f, l);
+ mpf_mul(f, f, f);
+ mpf_add(f, f, temp);
+ mpf_sqrt(f, f);
+ mpf_clear(temp);
+ }
static void eval(mpf_ptr f, mpf_srcptr g, signed long int l)
- { eval(f, g, __gmpxx_abs_ui(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);
+ }
static void eval(mpf_ptr f, signed long int l, mpf_srcptr g)
- { eval(f, g, 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);
+ }
static void eval(mpf_ptr f, mpf_srcptr g, double d)
{
mpf_t temp;
@@ -1047,7 +1253,16 @@ struct __gmp_hypot_function
mpf_clear(temp);
}
static void eval(mpf_ptr f, double d, mpf_srcptr g)
- { eval(f, g, d); }
+ {
+ mpf_t temp;
+ mpf_init2(temp, mpf_get_prec(f));
+ mpf_mul(temp, g, g);
+ mpf_set_d(f, d);
+ mpf_mul(f, f, f);
+ mpf_add(f, f, temp);
+ mpf_sqrt(f, f);
+ mpf_clear(temp);
+ }
};
struct __gmp_sgn_function
@@ -1085,9 +1300,25 @@ 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)
- { __GMPXX_TMPQ_D; return mpq_cmp (q, temp); }
+ {
+ int i;
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ i = mpq_cmp(q, temp);
+ mpq_clear(temp);
+ return i;
+ }
static int eval(double d, mpq_srcptr q)
- { __GMPXX_TMPQ_D; return mpq_cmp (temp, q); }
+ {
+ int i;
+ mpq_t temp;
+ mpq_init(temp);
+ mpq_set_d(temp, d);
+ i = mpq_cmp(temp, q);
+ mpq_clear(temp);
+ return i;
+ }
static int eval(mpf_srcptr f, mpf_srcptr g) { return mpf_cmp(f, g); }
@@ -1107,11 +1338,11 @@ struct __gmp_cmp_function
struct __gmp_rand_function
{
- static void eval(mpz_ptr z, gmp_randstate_t s, mp_bitcnt_t l)
+ static void eval(mpz_ptr z, gmp_randstate_t s, unsigned long int l)
{ mpz_urandomb(z, s, l); }
static void eval(mpz_ptr z, gmp_randstate_t s, mpz_srcptr w)
{ mpz_urandomm(z, s, w); }
- static void eval(mpf_ptr f, gmp_randstate_t s, mp_bitcnt_t prec)
+ static void eval(mpf_ptr f, gmp_randstate_t s, unsigned long int prec)
{ mpf_urandomb(f, s, prec); }
};
@@ -1165,7 +1396,6 @@ struct __gmp_resolve_expr<mpz_t>
{
typedef mpz_t value_type;
typedef mpz_ptr ptr_type;
- typedef mpz_srcptr srcptr_type;
};
template <>
@@ -1173,7 +1403,6 @@ struct __gmp_resolve_expr<mpq_t>
{
typedef mpq_t value_type;
typedef mpq_ptr ptr_type;
- typedef mpq_srcptr srcptr_type;
};
template <>
@@ -1181,7 +1410,6 @@ struct __gmp_resolve_expr<mpf_t>
{
typedef mpf_t value_type;
typedef mpf_ptr ptr_type;
- typedef mpf_srcptr srcptr_type;
};
template <>
@@ -1220,49 +1448,20 @@ struct __gmp_resolve_expr<mpf_t, mpq_t>
typedef mpf_t value_type;
};
-#if __GMPXX_USE_CXX11
-namespace std {
- template <class T, class U, class V, class W>
- struct common_type <__gmp_expr<T, U>, __gmp_expr<V, W> >
- {
- private:
- typedef typename __gmp_resolve_expr<T, V>::value_type X;
- public:
- typedef __gmp_expr<X, X> type;
- };
- template <class T, class U>
- struct common_type <__gmp_expr<T, U>, __gmp_expr<T, U> >
- {
- typedef __gmp_expr<T, U> type;
- };
-
-#define __GMPXX_DECLARE_COMMON_TYPE(typ) \
- template <class T, class U> \
- struct common_type <__gmp_expr<T, U>, typ > \
- { \
- typedef __gmp_expr<T, T> type; \
- }; \
- \
- template <class T, class U> \
- struct common_type <typ, __gmp_expr<T, U> > \
- { \
- typedef __gmp_expr<T, T> type; \
- }
-
- __GMPXX_DECLARE_COMMON_TYPE(signed char);
- __GMPXX_DECLARE_COMMON_TYPE(unsigned char);
- __GMPXX_DECLARE_COMMON_TYPE(signed int);
- __GMPXX_DECLARE_COMMON_TYPE(unsigned int);
- __GMPXX_DECLARE_COMMON_TYPE(signed short int);
- __GMPXX_DECLARE_COMMON_TYPE(unsigned short int);
- __GMPXX_DECLARE_COMMON_TYPE(signed long int);
- __GMPXX_DECLARE_COMMON_TYPE(unsigned long int);
- __GMPXX_DECLARE_COMMON_TYPE(float);
- __GMPXX_DECLARE_COMMON_TYPE(double);
-#undef __GMPXX_DECLARE_COMMON_TYPE
-}
-#endif
+
+template <class T, class U, class V>
+struct __gmp_resolve_temp
+{
+ typedef __gmp_expr<T, T> temp_type;
+};
+
+template <class T>
+struct __gmp_resolve_temp<T, T, T>
+{
+ typedef const __gmp_expr<T, T> & temp_type;
+};
+
// classes for evaluating unary and binary expressions
template <class T, class Op>
@@ -1287,6 +1486,14 @@ private:
};
+// functions for evaluating expressions
+template <class T, class U>
+void __gmp_set_expr(mpz_ptr, const __gmp_expr<T, U> &);
+template <class T, class U>
+void __gmp_set_expr(mpq_ptr, const __gmp_expr<T, U> &);
+template <class T, class U>
+void __gmp_set_expr(mpf_ptr, const __gmp_expr<T, U> &);
+
/**************** Macros for in-class declarations ****************/
/* This is just repetitive code that is easier to maintain if it's written
@@ -1307,42 +1514,19 @@ private:
__gmp_expr & fun(unsigned long int); \
__gmp_expr & fun(float); \
__gmp_expr & fun(double); \
- /* __gmp_expr & fun(long double); */
+ __gmp_expr & fun(long double);
#define __GMP_DECLARE_COMPOUND_OPERATOR(fun) \
__GMPP_DECLARE_COMPOUND_OPERATOR(fun) \
__GMPN_DECLARE_COMPOUND_OPERATOR(fun)
#define __GMP_DECLARE_COMPOUND_OPERATOR_UI(fun) \
- __gmp_expr & fun(mp_bitcnt_t);
+ __gmp_expr & fun(unsigned long int);
#define __GMP_DECLARE_INCREMENT_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 ****************/
@@ -1352,77 +1536,42 @@ 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(); }
+ unsigned long int get_prec() const { return mpf_get_default_prec(); }
// constructors and destructor
__gmp_expr() { mpz_init(mp); }
__gmp_expr(const __gmp_expr &z) { mpz_init_set(mp, z.mp); }
-#if __GMPXX_USE_CXX11
- __gmp_expr(__gmp_expr &&z)
- { *mp = *z.mp; mpz_init(z.mp); }
-#endif
- template <class T>
- __gmp_expr(const __gmp_expr<mpz_t, T> &expr)
- { mpz_init(mp); __gmp_set_expr(mp, expr); }
template <class T, class U>
- explicit __gmp_expr(const __gmp_expr<T, U> &expr)
+ __gmp_expr(const __gmp_expr<T, U> &expr)
{ mpz_init(mp); __gmp_set_expr(mp, expr); }
- __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS
+ __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); }
- explicit __gmp_expr(const char *s, int base = 0)
+ __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); }
+
+ explicit __gmp_expr(const char *s)
+ {
+ if (mpz_init_set_str (mp, s, 0) != 0)
+ {
+ mpz_clear (mp);
+ throw std::invalid_argument ("mpz_set_str");
+ }
+ }
+ __gmp_expr(const char *s, int base)
{
if (mpz_init_set_str (mp, s, base) != 0)
{
@@ -1430,7 +1579,15 @@ public:
throw std::invalid_argument ("mpz_set_str");
}
}
- explicit __gmp_expr(const std::string &s, int base = 0)
+ explicit __gmp_expr(const std::string &s)
+ {
+ if (mpz_init_set_str (mp, s.c_str(), 0) != 0)
+ {
+ mpz_clear (mp);
+ throw std::invalid_argument ("mpz_set_str");
+ }
+ }
+ __gmp_expr(const std::string &s, int base)
{
if (mpz_init_set_str(mp, s.c_str(), base) != 0)
{
@@ -1443,20 +1600,33 @@ public:
~__gmp_expr() { mpz_clear(mp); }
- void swap(__gmp_expr& z) __GMPXX_NOEXCEPT { std::swap(*mp, *z.mp); }
-
// assignment operators
__gmp_expr & operator=(const __gmp_expr &z)
{ mpz_set(mp, z.mp); return *this; }
-#if __GMPXX_USE_CXX11
- __gmp_expr & operator=(__gmp_expr &&z) noexcept
- { swap(z); return *this; }
-#endif
template <class T, class U>
__gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
{ __gmp_set_expr(mp, expr); return *this; }
- __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS
+ __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; }
__gmp_expr & operator=(const char *s)
{
@@ -1504,10 +1674,6 @@ public:
// bool fits_double_p() const { return mpz_fits_double_p(mp); }
// bool fits_ldouble_p() const { return mpz_fits_ldouble_p(mp); }
-#if __GMPXX_USE_CXX11
- explicit operator bool() const { return mp->_mp_size != 0; }
-#endif
-
// member operators
__GMP_DECLARE_COMPOUND_OPERATOR(operator+=)
__GMP_DECLARE_COMPOUND_OPERATOR(operator-=)
@@ -1537,105 +1703,111 @@ 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(); }
+ unsigned long int get_prec() const { return mpf_get_default_prec(); }
void canonicalize() { mpq_canonicalize(mp); }
// constructors and destructor
__gmp_expr() { mpq_init(mp); }
- __gmp_expr(const __gmp_expr &q)
- {
- mpz_init_set(mpq_numref(mp), mpq_numref(q.mp));
- mpz_init_set(mpq_denref(mp), mpq_denref(q.mp));
- }
-#if __GMPXX_USE_CXX11
- __gmp_expr(__gmp_expr &&q)
- { *mp = *q.mp; mpq_init(q.mp); }
-#endif
- template <class T>
- __gmp_expr(const __gmp_expr<mpz_t, T> &expr)
- { mpq_init(mp); __gmp_set_expr(mp, expr); }
- template <class T>
- __gmp_expr(const __gmp_expr<mpq_t, T> &expr)
- { mpq_init(mp); __gmp_set_expr(mp, expr); }
+ __gmp_expr(const __gmp_expr &q) { mpq_init(mp); mpq_set(mp, q.mp); }
template <class T, class U>
- explicit __gmp_expr(const __gmp_expr<T, U> &expr)
+ __gmp_expr(const __gmp_expr<T, U> &expr)
{ mpq_init(mp); __gmp_set_expr(mp, expr); }
- __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS
+ __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); }
- explicit __gmp_expr(const char *s, int base = 0)
+ explicit __gmp_expr(const char *s)
{
mpq_init (mp);
- // If s is the literal 0, we meant to call another constructor.
- // If s just happens to evaluate to 0, we would crash, so whatever.
- if (s == 0)
+ if (mpq_set_str (mp, s, 0) != 0)
{
- // Don't turn mpq_class(0,0) into 0
- mpz_set_si(mpq_denref(mp), base);
+ mpq_clear (mp);
+ throw std::invalid_argument ("mpq_set_str");
}
- else if (mpq_set_str(mp, s, base) != 0)
+ }
+ __gmp_expr(const char *s, int base)
+ {
+ mpq_init (mp);
+ if (mpq_set_str(mp, s, base) != 0)
{
mpq_clear (mp);
throw std::invalid_argument ("mpq_set_str");
}
}
- explicit __gmp_expr(const std::string &s, int base = 0)
+ explicit __gmp_expr(const std::string &s)
{
- mpq_init(mp);
- if (mpq_set_str (mp, s.c_str(), base) != 0)
+ mpq_init (mp);
+ if (mpq_set_str (mp, s.c_str(), 0) != 0)
{
mpq_clear (mp);
throw std::invalid_argument ("mpq_set_str");
}
}
- explicit __gmp_expr(mpq_srcptr q)
+ __gmp_expr(const std::string &s, int base)
{
- mpz_init_set(mpq_numref(mp), mpq_numref(q));
- mpz_init_set(mpq_denref(mp), mpq_denref(q));
+ mpq_init(mp);
+ if (mpq_set_str (mp, s.c_str(), base) != 0)
+ {
+ mpq_clear (mp);
+ throw std::invalid_argument ("mpq_set_str");
+ }
}
+ explicit __gmp_expr(mpq_srcptr q) { mpq_init(mp); mpq_set(mp, q); }
__gmp_expr(const mpz_class &num, const mpz_class &den)
{
- mpz_init_set(mpq_numref(mp), num.get_mpz_t());
- mpz_init_set(mpq_denref(mp), den.get_mpz_t());
+ mpq_init(mp);
+ mpz_set(mpq_numref(mp), num.get_mpz_t());
+ mpz_set(mpq_denref(mp), den.get_mpz_t());
}
~__gmp_expr() { mpq_clear(mp); }
- void swap(__gmp_expr& q) __GMPXX_NOEXCEPT { std::swap(*mp, *q.mp); }
-
// assignment operators
__gmp_expr & operator=(const __gmp_expr &q)
{ mpq_set(mp, q.mp); return *this; }
-#if __GMPXX_USE_CXX11
- __gmp_expr & operator=(__gmp_expr &&q) noexcept
- { swap(q); return *this; }
- __gmp_expr & operator=(mpz_class &&z) noexcept
- { get_num() = std::move(z); get_den() = 1u; return *this; }
-#endif
template <class T, class U>
__gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
{ __gmp_set_expr(mp, expr); return *this; }
- __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS
+ __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; }
__gmp_expr & operator=(const char *s)
{
@@ -1687,10 +1859,6 @@ public:
double get_d() const { return mpq_get_d(mp); }
-#if __GMPXX_USE_CXX11
- explicit operator bool() const { return mpq_numref(mp)->_mp_size != 0; }
-#endif
-
// compound assignments
__GMP_DECLARE_COMPOUND_OPERATOR(operator+=)
__GMP_DECLARE_COMPOUND_OPERATOR(operator-=)
@@ -1715,86 +1883,62 @@ 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); }
+ unsigned long int get_prec() const { return mpf_get_prec(mp); }
- void set_prec(mp_bitcnt_t prec) { mpf_set_prec(mp, prec); }
- void set_prec_raw(mp_bitcnt_t prec) { mpf_set_prec_raw(mp, prec); }
+ void set_prec(unsigned long int prec) { mpf_set_prec(mp, prec); }
+ void set_prec_raw(unsigned long int prec) { mpf_set_prec_raw(mp, prec); }
// constructors and destructor
__gmp_expr() { mpf_init(mp); }
__gmp_expr(const __gmp_expr &f)
{ mpf_init2(mp, f.get_prec()); mpf_set(mp, f.mp); }
-#if __GMPXX_USE_CXX11
- __gmp_expr(__gmp_expr &&f)
- { *mp = *f.mp; mpf_init2(f.mp, get_prec()); }
-#endif
- __gmp_expr(const __gmp_expr &f, mp_bitcnt_t prec)
+ __gmp_expr(const __gmp_expr &f, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set(mp, f.mp); }
template <class T, class U>
__gmp_expr(const __gmp_expr<T, U> &expr)
{ mpf_init2(mp, expr.get_prec()); __gmp_set_expr(mp, expr); }
template <class T, class U>
- __gmp_expr(const __gmp_expr<T, U> &expr, mp_bitcnt_t prec)
+ __gmp_expr(const __gmp_expr<T, U> &expr, unsigned long int prec)
{ mpf_init2(mp, prec); __gmp_set_expr(mp, expr); }
- __GMPXX_DEFINE_ARITHMETIC_CONSTRUCTORS
-
- __gmp_expr(signed char c, mp_bitcnt_t prec)
+ __gmp_expr(signed char c) { mpf_init_set_si(mp, c); }
+ __gmp_expr(signed char c, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_si(mp, c); }
- __gmp_expr(unsigned char c, mp_bitcnt_t prec)
+ __gmp_expr(unsigned char c) { mpf_init_set_ui(mp, c); }
+ __gmp_expr(unsigned char c, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_ui(mp, c); }
- __gmp_expr(signed int i, mp_bitcnt_t prec)
+ __gmp_expr(signed int i) { mpf_init_set_si(mp, i); }
+ __gmp_expr(signed int i, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_si(mp, i); }
- __gmp_expr(unsigned int i, mp_bitcnt_t prec)
+ __gmp_expr(unsigned int i) { mpf_init_set_ui(mp, i); }
+ __gmp_expr(unsigned int i, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_ui(mp, i); }
- __gmp_expr(signed short int s, mp_bitcnt_t prec)
+ __gmp_expr(signed short int s) { mpf_init_set_si(mp, s); }
+ __gmp_expr(signed short int s, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_si(mp, s); }
- __gmp_expr(unsigned short int s, mp_bitcnt_t prec)
+ __gmp_expr(unsigned short int s) { mpf_init_set_ui(mp, s); }
+ __gmp_expr(unsigned short int s, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_ui(mp, s); }
- __gmp_expr(signed long int l, mp_bitcnt_t prec)
+ __gmp_expr(signed long int l) { mpf_init_set_si(mp, l); }
+ __gmp_expr(signed long int l, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_si(mp, l); }
- __gmp_expr(unsigned long int l, mp_bitcnt_t prec)
+ __gmp_expr(unsigned long int l) { mpf_init_set_ui(mp, l); }
+ __gmp_expr(unsigned long int l, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_ui(mp, l); }
- __gmp_expr(float f, mp_bitcnt_t prec)
+ __gmp_expr(float f) { mpf_init_set_d(mp, f); }
+ __gmp_expr(float f, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_d(mp, f); }
- __gmp_expr(double d, mp_bitcnt_t prec)
+ __gmp_expr(double d) { mpf_init_set_d(mp, d); }
+ __gmp_expr(double d, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set_d(mp, d); }
// __gmp_expr(long double ld) { mpf_init_set_d(mp, ld); }
- // __gmp_expr(long double ld, mp_bitcnt_t prec)
+ // __gmp_expr(long double ld, unsigned long int prec)
// { mpf_init2(mp, prec); mpf_set_d(mp, ld); }
explicit __gmp_expr(const char *s)
@@ -1805,7 +1949,7 @@ public:
throw std::invalid_argument ("mpf_set_str");
}
}
- __gmp_expr(const char *s, mp_bitcnt_t prec, int base = 0)
+ __gmp_expr(const char *s, unsigned long int prec, int base = 0)
{
mpf_init2(mp, prec);
if (mpf_set_str(mp, s, base) != 0)
@@ -1822,7 +1966,7 @@ public:
throw std::invalid_argument ("mpf_set_str");
}
}
- __gmp_expr(const std::string &s, mp_bitcnt_t prec, int base = 0)
+ __gmp_expr(const std::string &s, unsigned long int prec, int base = 0)
{
mpf_init2(mp, prec);
if (mpf_set_str(mp, s.c_str(), base) != 0)
@@ -1834,25 +1978,38 @@ public:
explicit __gmp_expr(mpf_srcptr f)
{ mpf_init2(mp, mpf_get_prec(f)); mpf_set(mp, f); }
- __gmp_expr(mpf_srcptr f, mp_bitcnt_t prec)
+ __gmp_expr(mpf_srcptr f, unsigned long int prec)
{ mpf_init2(mp, prec); mpf_set(mp, f); }
~__gmp_expr() { mpf_clear(mp); }
- void swap(__gmp_expr& f) __GMPXX_NOEXCEPT { std::swap(*mp, *f.mp); }
-
// assignment operators
__gmp_expr & operator=(const __gmp_expr &f)
{ mpf_set(mp, f.mp); return *this; }
-#if __GMPXX_USE_CXX11
- __gmp_expr & operator=(__gmp_expr &&f) noexcept
- { swap(f); return *this; }
-#endif
template <class T, class U>
__gmp_expr<value_type, value_type> & operator=(const __gmp_expr<T, U> &expr)
{ __gmp_set_expr(mp, expr); return *this; }
- __GMPXX_DEFINE_ARITHMETIC_ASSIGNMENTS
+ __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; }
__gmp_expr & operator=(const char *s)
{
@@ -1900,10 +2057,6 @@ public:
// bool fits_double_p() const { return mpf_fits_double_p(mp); }
// bool fits_ldouble_p() const { return mpf_fits_ldouble_p(mp); }
-#if __GMPXX_USE_CXX11
- explicit operator bool() const { return mp->_mp_size != 0; }
-#endif
-
// compound assignments
__GMP_DECLARE_COMPOUND_OPERATOR(operator+=)
__GMP_DECLARE_COMPOUND_OPERATOR(operator-=)
@@ -1921,58 +2074,43 @@ typedef __gmp_expr<mpf_t, mpf_t> mpf_class;
-/**************** User-defined literals ****************/
-
-#if __GMPXX_USE_CXX11
-inline mpz_class operator"" _mpz(const char* s)
-{
- return mpz_class(s);
-}
+/**************** I/O operators ****************/
-inline mpq_class operator"" _mpq(const char* s)
-{
- mpq_class q;
- q.get_num() = s;
- return q;
-}
+// these should (and will) be provided separately
-inline mpf_class operator"" _mpf(const char* s)
+template <class T>
+inline std::ostream & operator<<
+(std::ostream &o, const __gmp_expr<T, T> &expr)
{
- return mpf_class(s);
+ return o << expr.__get_mp();
}
-#endif
-
-/**************** I/O operators ****************/
-
-// these should (and will) be provided separately
template <class T, class U>
inline std::ostream & operator<<
(std::ostream &o, const __gmp_expr<T, U> &expr)
{
- __gmp_expr<T, T> const& temp(expr);
+ __gmp_expr<T, T> temp(expr);
return o << temp.__get_mp();
}
+
template <class T>
inline std::istream & operator>>(std::istream &i, __gmp_expr<T, T> &expr)
{
return i >> expr.__get_mp();
}
-/*
-// you might want to uncomment this
inline std::istream & operator>>(std::istream &i, mpq_class &q)
{
i >> q.get_mpq_t();
- q.canonicalize();
+ // q.canonicalize(); // you might want to uncomment this
return i;
}
-*/
/**************** Functions for type conversion ****************/
+template <>
inline void __gmp_set_expr(mpz_ptr z, const mpz_class &w)
{
mpz_set(z, w.get_mpz_t());
@@ -1984,20 +2122,33 @@ inline void __gmp_set_expr(mpz_ptr z, const __gmp_expr<mpz_t, T> &expr)
expr.eval(z);
}
+template <>
+inline void __gmp_set_expr(mpz_ptr z, const mpq_class &q)
+{
+ mpz_set_q(z, q.get_mpq_t());
+}
+
template <class T>
inline void __gmp_set_expr(mpz_ptr z, const __gmp_expr<mpq_t, T> &expr)
{
- mpq_class const& temp(expr);
+ mpq_class temp(expr);
mpz_set_q(z, temp.get_mpq_t());
}
template <class T>
+inline void __gmp_set_expr(mpz_ptr z, const mpf_class &f)
+{
+ mpz_set_f(z, f.get_mpf_t());
+}
+
+template <class T>
inline void __gmp_set_expr(mpz_ptr z, const __gmp_expr<mpf_t, T> &expr)
{
- mpf_class const& temp(expr);
+ mpf_class temp(expr);
mpz_set_f(z, temp.get_mpf_t());
}
+template <>
inline void __gmp_set_expr(mpq_ptr q, const mpz_class &z)
{
mpq_set_z(q, z.get_mpz_t());
@@ -2006,10 +2157,11 @@ inline void __gmp_set_expr(mpq_ptr q, const mpz_class &z)
template <class T>
inline void __gmp_set_expr(mpq_ptr q, const __gmp_expr<mpz_t, T> &expr)
{
- __gmp_set_expr(mpq_numref(q), expr);
- mpz_set_ui(mpq_denref(q), 1);
+ mpz_class temp(expr);
+ mpq_set_z(q, temp.get_mpz_t());
}
+template <>
inline void __gmp_set_expr(mpq_ptr q, const mpq_class &r)
{
mpq_set(q, r.get_mpq_t());
@@ -2022,26 +2174,45 @@ inline void __gmp_set_expr(mpq_ptr q, const __gmp_expr<mpq_t, T> &expr)
}
template <class T>
+inline void __gmp_set_expr(mpq_ptr q, const mpf_class &f)
+{
+ mpq_set_f(q, f.get_mpf_t());
+}
+
+template <class T>
inline void __gmp_set_expr(mpq_ptr q, const __gmp_expr<mpf_t, T> &expr)
{
- mpf_class const& temp(expr);
+ mpf_class temp(expr);
mpq_set_f(q, temp.get_mpf_t());
}
template <class T>
+inline void __gmp_set_expr(mpf_ptr f, const mpz_class &z)
+{
+ mpf_set_z(f, z.get_mpz_t());
+}
+
+template <class T>
inline void __gmp_set_expr(mpf_ptr f, const __gmp_expr<mpz_t, T> &expr)
{
- mpz_class const& temp(expr);
+ mpz_class temp(expr);
mpf_set_z(f, temp.get_mpz_t());
}
template <class T>
+inline void __gmp_set_expr(mpf_ptr f, const mpq_class &q)
+{
+ mpf_set_q(f, q.get_mpq_t());
+}
+
+template <class T>
inline void __gmp_set_expr(mpf_ptr f, const __gmp_expr<mpq_t, T> &expr)
{
- mpq_class const& temp(expr);
+ mpq_class temp(expr);
mpf_set_q(f, temp.get_mpq_t());
}
+template <>
inline void __gmp_set_expr(mpf_ptr f, const mpf_class &g)
{
mpf_set(f, g.get_mpf_t());
@@ -2050,33 +2221,10 @@ inline void __gmp_set_expr(mpf_ptr f, const mpf_class &g)
template <class T>
inline void __gmp_set_expr(mpf_ptr f, const __gmp_expr<mpf_t, T> &expr)
{
- expr.eval(f);
+ expr.eval(f, mpf_get_prec(f));
}
-/* Temporary objects */
-
-template <class T>
-class __gmp_temp
-{
- __gmp_expr<T, T> val;
- public:
- template<class U, class V>
- __gmp_temp(U const& u, V) : val (u) {}
- typename __gmp_resolve_expr<T>::srcptr_type
- __get_mp() const { return val.__get_mp(); }
-};
-
-template <>
-class __gmp_temp <mpf_t>
-{
- mpf_class val;
- public:
- template<class U>
- __gmp_temp(U const& u, mpf_ptr res) : val (u, mpf_get_prec(res)) {}
- mpf_srcptr __get_mp() const { return val.__get_mp(); }
-};
-
/**************** Specializations of __gmp_expr ****************/
/* The eval() method of __gmp_expr<T, U> evaluates the corresponding
expression and assigns the result to its argument, which is either an
@@ -2104,11 +2252,12 @@ private:
__gmp_unary_expr<val_type, Op> expr;
public:
- explicit __gmp_expr(const val_type &val) : expr(val) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
+ __gmp_expr(const val_type &val) : expr(val) { }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int = 0) const
{ Op::eval(p, expr.val.__get_mp()); }
const val_type & get_val() const { return expr.val; }
- mp_bitcnt_t get_prec() const { return expr.val.get_prec(); }
+ unsigned long int get_prec() const { return expr.val.get_prec(); }
};
@@ -2122,11 +2271,14 @@ private:
__gmp_unary_expr<val_type, Op> expr;
public:
- explicit __gmp_expr(const val_type &val) : expr(val) { }
+ __gmp_expr(const val_type &val) : expr(val) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
- { expr.val.eval(p); Op::eval(p, p); }
+ { __gmp_expr<T, T> temp(expr.val); Op::eval(p, temp.__get_mp()); }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ { __gmp_expr<T, T> temp(expr.val, prec); Op::eval(p, temp.__get_mp()); }
const val_type & get_val() const { return expr.val; }
- mp_bitcnt_t get_prec() const { return expr.val.get_prec(); }
+ unsigned long int get_prec() const { return expr.val.get_prec(); }
};
@@ -2154,13 +2306,14 @@ private:
public:
__gmp_expr(const val1_type &val1, const val2_type &val2)
: expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int = 0) const
{ Op::eval(p, expr.val1.__get_mp(), expr.val2.__get_mp()); }
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2180,11 +2333,12 @@ private:
public:
__gmp_expr(const val1_type &val1, const val2_type &val2)
: expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int = 0) const
{ Op::eval(p, expr.val1.__get_mp(), expr.val2); }
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const { return expr.val1.get_prec(); }
+ unsigned long int get_prec() const { return expr.val1.get_prec(); }
};
template <class T, class U, class Op>
@@ -2198,11 +2352,12 @@ private:
public:
__gmp_expr(const val1_type &val1, const val2_type &val2)
: expr(val1, val2) { }
- void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int = 0) const
{ Op::eval(p, expr.val1, expr.val2.__get_mp()); }
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const { return expr.val2.get_prec(); }
+ unsigned long int get_prec() const { return expr.val2.get_prec(); }
};
@@ -2222,22 +2377,20 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- if(p != expr.val1.__get_mp())
- {
- __gmp_set_expr(p, expr.val2);
- Op::eval(p, expr.val1.__get_mp(), p);
- }
- else
- {
- __gmp_temp<T> temp(expr.val2, p);
- Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
- }
+ __gmp_expr<T, T> temp(expr.val2);
+ Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp(expr.val2, prec);
+ Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2257,22 +2410,20 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- if(p != expr.val2.__get_mp())
- {
- __gmp_set_expr(p, expr.val1);
- Op::eval(p, p, expr.val2.__get_mp());
- }
- else
- {
- __gmp_temp<T> temp(expr.val1, p);
- Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
- }
+ __gmp_expr<T, T> temp(expr.val1);
+ Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp(expr.val1, prec);
+ Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2292,22 +2443,20 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- if(p != expr.val1.__get_mp())
- {
- __gmp_set_expr(p, expr.val2);
- Op::eval(p, expr.val1.__get_mp(), p);
- }
- else
- {
- __gmp_temp<T> temp(expr.val2, p);
- Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
- }
+ __gmp_expr<T, T> temp(expr.val2);
+ Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp(expr.val2, prec);
+ Op::eval(p, expr.val1.__get_mp(), temp.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2327,22 +2476,20 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- if(p != expr.val2.__get_mp())
- {
- __gmp_set_expr(p, expr.val1);
- Op::eval(p, p, expr.val2.__get_mp());
- }
- else
- {
- __gmp_temp<T> temp(expr.val1, p);
- Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
- }
+ __gmp_expr<T, T> temp(expr.val1);
+ Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp(expr.val1, prec);
+ Op::eval(p, temp.__get_mp(), expr.val2.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2364,12 +2511,18 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- expr.val1.eval(p);
- Op::eval(p, p, expr.val2);
+ __gmp_expr<T, T> temp(expr.val1);
+ Op::eval(p, temp.__get_mp(), expr.val2);
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp(expr.val1, prec);
+ Op::eval(p, temp.__get_mp(), expr.val2);
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const { return expr.val1.get_prec(); }
+ unsigned long int get_prec() const { return expr.val1.get_prec(); }
};
template <class T, class U, class V, class Op>
@@ -2385,12 +2538,18 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- expr.val2.eval(p);
- Op::eval(p, expr.val1, p);
+ __gmp_expr<T, T> temp(expr.val2);
+ Op::eval(p, expr.val1, temp.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp(expr.val2, prec);
+ Op::eval(p, expr.val1, temp.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const { return expr.val2.get_prec(); }
+ unsigned long int get_prec() const { return expr.val2.get_prec(); }
};
@@ -2410,15 +2569,20 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- __gmp_temp<T> temp2(expr.val2, p);
- expr.val1.eval(p);
- Op::eval(p, p, temp2.__get_mp());
+ __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
+ Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp1(expr.val1, prec), temp2(expr.val2, prec);
+ Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2438,15 +2602,20 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- __gmp_temp<T> temp1(expr.val1, p);
- expr.val2.eval(p);
- Op::eval(p, temp1.__get_mp(), p);
+ __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
+ Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp1(expr.val1, prec), temp2(expr.val2, prec);
+ Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2466,15 +2635,20 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- __gmp_temp<T> temp2(expr.val2, p);
- expr.val1.eval(p);
- Op::eval(p, p, temp2.__get_mp());
+ __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
+ Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
+ }
+ void eval(typename __gmp_resolve_expr<T>::ptr_type p,
+ unsigned long int prec) const
+ {
+ __gmp_expr<T, T> temp1(expr.val1, prec), temp2(expr.val2, prec);
+ Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
}
const val1_type & get_val1() const { return expr.val1; }
const val2_type & get_val2() const { return expr.val2; }
- mp_bitcnt_t get_prec() const
+ unsigned long int get_prec() const
{
- mp_bitcnt_t prec1 = expr.val1.get_prec(),
+ unsigned long int prec1 = expr.val1.get_prec(),
prec2 = expr.val2.get_prec();
return (prec1 > prec2) ? prec1 : prec2;
}
@@ -2505,7 +2679,7 @@ public: \
{ eval_fun::eval(q, expr.val1.get_mpz_t(), expr.val2.get_mpq_t()); } \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
}; \
\
template <> \
@@ -2523,7 +2697,7 @@ public: \
{ eval_fun::eval(q, expr.val1.get_mpq_t(), expr.val2.get_mpz_t()); } \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
}; \
\
template <class T> \
@@ -2545,7 +2719,7 @@ public: \
} \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
}; \
\
template <class T> \
@@ -2567,7 +2741,7 @@ public: \
} \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
}; \
\
template <class T> \
@@ -2589,7 +2763,7 @@ public: \
} \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
}; \
\
template <class T> \
@@ -2611,7 +2785,7 @@ public: \
} \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
}; \
\
template <class T, class U> \
@@ -2629,12 +2803,12 @@ public: \
void eval(mpq_ptr q) const \
{ \
mpz_class temp1(expr.val1); \
- expr.val2.eval(q); \
- eval_fun::eval(q, temp1.get_mpz_t(), q); \
+ mpq_class temp2(expr.val2); \
+ eval_fun::eval(q, temp1.get_mpz_t(), temp2.get_mpq_t()); \
} \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
}; \
\
template <class T, class U> \
@@ -2651,13 +2825,13 @@ public: \
: expr(val1, val2) { } \
void eval(mpq_ptr q) const \
{ \
+ mpq_class temp1(expr.val1); \
mpz_class temp2(expr.val2); \
- expr.val1.eval(q); \
- eval_fun::eval(q, q, temp2.get_mpz_t()); \
+ eval_fun::eval(q, temp1.get_mpq_t(), temp2.get_mpz_t()); \
} \
const val1_type & get_val1() const { return expr.val1; } \
const val2_type & get_val2() const { return expr.val2; } \
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); } \
+ unsigned long int get_prec() const { return mpf_get_default_prec(); } \
};
@@ -2699,7 +2873,7 @@ fun(const __gmp_expr<T, U> &expr) \
template <class T, class U> \
inline type fun(const __gmp_expr<T, U> &expr) \
{ \
- __gmp_expr<T, T> const& temp(expr); \
+ typename __gmp_resolve_temp<T, T, U>::temp_type temp(expr); \
return eval_fun::eval(temp.__get_mp()); \
}
@@ -2761,7 +2935,7 @@ __GMPNS_DEFINE_BINARY_FUNCTION(fun, eval_fun, signed long int) \
__GMPNU_DEFINE_BINARY_FUNCTION(fun, eval_fun, unsigned long int) \
__GMPND_DEFINE_BINARY_FUNCTION(fun, eval_fun, float) \
__GMPND_DEFINE_BINARY_FUNCTION(fun, eval_fun, double) \
-/* __GMPNLD_DEFINE_BINARY_FUNCTION(fun, eval_fun, long double) */
+__GMPNLD_DEFINE_BINARY_FUNCTION(fun, eval_fun, long double)
#define __GMP_DEFINE_BINARY_FUNCTION(fun, eval_fun) \
__GMPP_DEFINE_BINARY_FUNCTION(fun, eval_fun) \
@@ -2772,11 +2946,11 @@ __GMPN_DEFINE_BINARY_FUNCTION(fun, eval_fun)
\
template <class T, class U> \
inline __gmp_expr \
-<T, __gmp_binary_expr<__gmp_expr<T, U>, mp_bitcnt_t, eval_fun> > \
-fun(const __gmp_expr<T, U> &expr, mp_bitcnt_t l) \
+<T, __gmp_binary_expr<__gmp_expr<T, U>, unsigned long int, eval_fun> > \
+fun(const __gmp_expr<T, U> &expr, unsigned long int l) \
{ \
return __gmp_expr<T, __gmp_binary_expr \
- <__gmp_expr<T, U>, mp_bitcnt_t, eval_fun> >(expr, l); \
+ <__gmp_expr<T, U>, unsigned long int, eval_fun> >(expr, l); \
}
@@ -2787,8 +2961,8 @@ inline type fun(const __gmp_expr<T, U> &expr1, \
const __gmp_expr<V, W> &expr2) \
{ \
typedef typename __gmp_resolve_expr<T, V>::value_type eval_type; \
- __gmp_expr<eval_type, eval_type> const& temp1(expr1); \
- __gmp_expr<eval_type, eval_type> const& temp2(expr2); \
+ typename __gmp_resolve_temp<eval_type, T, U>::temp_type temp1(expr1); \
+ typename __gmp_resolve_temp<eval_type, V, W>::temp_type temp2(expr2); \
return eval_fun::eval(temp1.__get_mp(), temp2.__get_mp()); \
}
@@ -2798,14 +2972,14 @@ inline type fun(const __gmp_expr<T, U> &expr1, \
template <class T, class U> \
inline type fun(const __gmp_expr<T, U> &expr, type2 t) \
{ \
- __gmp_expr<T, T> const& temp(expr); \
+ typename __gmp_resolve_temp<T, T, U>::temp_type temp(expr); \
return eval_fun::eval(temp.__get_mp(), static_cast<bigtype>(t)); \
} \
\
template <class T, class U> \
inline type fun(type2 t, const __gmp_expr<T, U> &expr) \
{ \
- __gmp_expr<T, T> const& temp(expr); \
+ typename __gmp_resolve_temp<T, T, U>::temp_type temp(expr); \
return eval_fun::eval(static_cast<bigtype>(t), temp.__get_mp()); \
}
@@ -2834,7 +3008,7 @@ __GMPNS_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, signed long int) \
__GMPNU_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, unsigned long int) \
__GMPND_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, float) \
__GMPND_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, double) \
-/* __GMPNLD_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, long double) */
+__GMPNLD_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun, long double)
#define __GMP_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun) \
__GMPP_DEFINE_BINARY_TYPE_FUNCTION(type, fun, eval_fun) \
@@ -2907,10 +3081,10 @@ __GMP_DEFINE_COMPOUND_OPERATOR(mpf, fun, eval_fun)
#define __GMP_DEFINE_COMPOUND_OPERATOR_UI(type, fun, eval_fun) \
\
-inline type##_class & type##_class::fun(mp_bitcnt_t l) \
+inline type##_class & type##_class::fun(unsigned long int l) \
{ \
__gmp_set_expr(mp, __gmp_expr<type##_t, __gmp_binary_expr \
- <type##_class, mp_bitcnt_t, eval_fun> >(*this, l)); \
+ <type##_class, unsigned long int, eval_fun> >(*this, l)); \
return *this; \
}
@@ -2972,11 +3146,12 @@ __GMP_DEFINE_BINARY_FUNCTION_UI(operator<<, __gmp_binary_lshift)
__GMP_DEFINE_BINARY_FUNCTION_UI(operator>>, __gmp_binary_rshift)
__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator==, __gmp_binary_equal)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator!=, ! __gmp_binary_equal)
+__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator!=, __gmp_binary_not_equal)
__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator<, __gmp_binary_less)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator<=, ! __gmp_binary_greater)
+__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator<=, __gmp_binary_less_equal)
__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator>, __gmp_binary_greater)
-__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator>=, ! __gmp_binary_less)
+__GMP_DEFINE_BINARY_TYPE_FUNCTION(bool, operator>=, \
+ __gmp_binary_greater_equal)
__GMP_DEFINE_UNARY_FUNCTION(abs, __gmp_abs_function)
__GMP_DEFINE_UNARY_FUNCTION(trunc, __gmp_trunc_function)
@@ -2988,10 +3163,6 @@ __GMP_DEFINE_BINARY_FUNCTION(hypot, __gmp_hypot_function)
__GMP_DEFINE_UNARY_TYPE_FUNCTION(int, sgn, __gmp_sgn_function)
__GMP_DEFINE_BINARY_TYPE_FUNCTION(int, cmp, __gmp_cmp_function)
-template <class T>
-void swap(__gmp_expr<T, T>& x, __gmp_expr<T, T>& y) __GMPXX_NOEXCEPT
-{ x.swap(y); }
-
// member operators for mpz_class
__GMPZ_DEFINE_COMPOUND_OPERATOR(operator+=, __gmp_binary_plus)
@@ -3048,11 +3219,11 @@ class __gmp_expr<mpz_t, __gmp_urandomb_value>
{
private:
__gmp_randstate_struct *state;
- mp_bitcnt_t bits;
+ unsigned long int bits;
public:
- __gmp_expr(gmp_randstate_t s, mp_bitcnt_t l) : state(s), bits(l) { }
+ __gmp_expr(gmp_randstate_t s, unsigned long int l) : state(s), bits(l) { }
void eval(mpz_ptr z) const { __gmp_rand_function::eval(z, state, bits); }
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); }
+ unsigned long int get_prec() const { return mpf_get_default_prec(); }
};
template <>
@@ -3065,7 +3236,7 @@ public:
__gmp_expr(gmp_randstate_t s, const mpz_class &z) : state(s), range(z) { }
void eval(mpz_ptr z) const
{ __gmp_rand_function::eval(z, state, range.get_mpz_t()); }
- mp_bitcnt_t get_prec() const { return mpf_get_default_prec(); }
+ unsigned long int get_prec() const { return mpf_get_default_prec(); }
};
template <>
@@ -3073,15 +3244,12 @@ class __gmp_expr<mpf_t, __gmp_urandomb_value>
{
private:
__gmp_randstate_struct *state;
- mp_bitcnt_t bits;
+ unsigned long int bits;
public:
- __gmp_expr(gmp_randstate_t s, mp_bitcnt_t l) : state(s), bits(l) { }
- void eval(mpf_ptr f) const
- {
- __gmp_rand_function::eval(f, state,
- (bits>0) ? bits : mpf_get_prec(f));
- }
- mp_bitcnt_t get_prec() const
+ __gmp_expr(gmp_randstate_t s, unsigned long int l) : state(s), bits(l) { }
+ void eval(mpf_ptr f, unsigned long int prec) const
+ { __gmp_rand_function::eval(f, state, (bits>0) ? get_prec() : prec); }
+ unsigned long int get_prec() const
{
if (bits == 0)
return mpf_get_default_prec();
@@ -3092,8 +3260,8 @@ public:
extern "C" {
typedef void __gmp_randinit_default_t (gmp_randstate_t);
- typedef void __gmp_randinit_lc_2exp_t (gmp_randstate_t, mpz_srcptr, unsigned long int, mp_bitcnt_t);
- typedef int __gmp_randinit_lc_2exp_size_t (gmp_randstate_t, mp_bitcnt_t);
+ typedef void __gmp_randinit_lc_2exp_t (gmp_randstate_t, mpz_srcptr, unsigned long int, unsigned long int);
+ typedef int __gmp_randinit_lc_2exp_size_t (gmp_randstate_t, unsigned long int);
}
class gmp_randclass
@@ -3122,12 +3290,12 @@ public:
// gmp_randinit_lc_2exp
gmp_randclass(__gmp_randinit_lc_2exp_t* f,
- mpz_class z, unsigned long int l1, mp_bitcnt_t l2)
+ mpz_class z, unsigned long int l1, unsigned long int l2)
{ f(state, z.get_mpz_t(), l1, l2); }
// gmp_randinit_lc_2exp_size
gmp_randclass(__gmp_randinit_lc_2exp_size_t* f,
- mp_bitcnt_t size)
+ unsigned long int size)
{
if (f (state, size) == 0)
throw std::length_error ("gmp_randinit_lc_2exp_size");
@@ -3141,136 +3309,19 @@ public:
void seed(const mpz_class &z) { gmp_randseed(state, z.get_mpz_t()); }
// get random number
- __gmp_expr<mpz_t, __gmp_urandomb_value> get_z_bits(mp_bitcnt_t l)
+ __gmp_expr<mpz_t, __gmp_urandomb_value> get_z_bits(unsigned long int l)
{ return __gmp_expr<mpz_t, __gmp_urandomb_value>(state, l); }
__gmp_expr<mpz_t, __gmp_urandomb_value> get_z_bits(const mpz_class &z)
{ return get_z_bits(z.get_ui()); }
- // FIXME: z.get_bitcnt_t() ?
__gmp_expr<mpz_t, __gmp_urandomm_value> get_z_range(const mpz_class &z)
{ return __gmp_expr<mpz_t, __gmp_urandomm_value>(state, z); }
- __gmp_expr<mpf_t, __gmp_urandomb_value> get_f(mp_bitcnt_t prec = 0)
+ __gmp_expr<mpf_t, __gmp_urandomb_value> get_f(unsigned long int prec = 0)
{ return __gmp_expr<mpf_t, __gmp_urandomb_value>(state, prec); }
};
-/**************** Specialize std::numeric_limits ****************/
-
-namespace std {
- template <> class numeric_limits<mpz_class>
- {
- public:
- static const bool is_specialized = true;
- static mpz_class min() { return mpz_class(); }
- static mpz_class max() { return mpz_class(); }
- static mpz_class lowest() { return mpz_class(); }
- static const int digits = 0;
- static const int digits10 = 0;
- static const int max_digits10 = 0;
- static const bool is_signed = true;
- static const bool is_integer = true;
- static const bool is_exact = true;
- static const int radix = 2;
- static mpz_class epsilon() { return mpz_class(); }
- static mpz_class round_error() { return mpz_class(); }
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
- static mpz_class infinity() { return mpz_class(); }
- static mpz_class quiet_NaN() { return mpz_class(); }
- static mpz_class signaling_NaN() { return mpz_class(); }
- static mpz_class denorm_min() { return mpz_class(); }
- static const bool is_iec559 = false;
- static const bool is_bounded = false;
- static const bool is_modulo = false;
- static const bool traps = false;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
- };
-
- template <> class numeric_limits<mpq_class>
- {
- public:
- static const bool is_specialized = true;
- static mpq_class min() { return mpq_class(); }
- static mpq_class max() { return mpq_class(); }
- static mpq_class lowest() { return mpq_class(); }
- static const int digits = 0;
- static const int digits10 = 0;
- static const int max_digits10 = 0;
- static const bool is_signed = true;
- static const bool is_integer = false;
- static const bool is_exact = true;
- static const int radix = 2;
- static mpq_class epsilon() { return mpq_class(); }
- static mpq_class round_error() { return mpq_class(); }
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
- static mpq_class infinity() { return mpq_class(); }
- static mpq_class quiet_NaN() { return mpq_class(); }
- static mpq_class signaling_NaN() { return mpq_class(); }
- static mpq_class denorm_min() { return mpq_class(); }
- static const bool is_iec559 = false;
- static const bool is_bounded = false;
- static const bool is_modulo = false;
- static const bool traps = false;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_toward_zero;
- };
-
- template <> class numeric_limits<mpf_class>
- {
- public:
- static const bool is_specialized = true;
- static mpf_class min() { return mpf_class(); }
- static mpf_class max() { return mpf_class(); }
- static mpf_class lowest() { return mpf_class(); }
- static const int digits = 0;
- static const int digits10 = 0;
- static const int max_digits10 = 0;
- static const bool is_signed = true;
- static const bool is_integer = false;
- static const bool is_exact = false;
- static const int radix = 2;
- static mpf_class epsilon() { return mpf_class(); }
- static mpf_class round_error() { return mpf_class(); }
- static const int min_exponent = 0;
- static const int min_exponent10 = 0;
- static const int max_exponent = 0;
- static const int max_exponent10 = 0;
- static const bool has_infinity = false;
- static const bool has_quiet_NaN = false;
- static const bool has_signaling_NaN = false;
- static const float_denorm_style has_denorm = denorm_absent;
- static const bool has_denorm_loss = false;
- static mpf_class infinity() { return mpf_class(); }
- static mpf_class quiet_NaN() { return mpf_class(); }
- static mpf_class signaling_NaN() { return mpf_class(); }
- static mpf_class denorm_min() { return mpf_class(); }
- static const bool is_iec559 = false;
- static const bool is_bounded = false;
- static const bool is_modulo = false;
- static const bool traps = false;
- static const bool tinyness_before = false;
- static const float_round_style round_style = round_indeterminate;
- };
-}
-
-
/**************** #undef all private macros ****************/
#undef __GMPP_DECLARE_COMPOUND_OPERATOR
@@ -3278,8 +3329,6 @@ 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
@@ -3307,6 +3356,12 @@ namespace std {
#undef __GMP_DEFINE_BINARY_TYPE_FUNCTION
#undef __GMPZ_DEFINE_COMPOUND_OPERATOR
+#undef __GMPZN_DEFINE_COMPOUND_OPERATOR
+#undef __GMPZNN_DEFINE_COMPOUND_OPERATOR
+#undef __GMPZNS_DEFINE_COMPOUND_OPERATOR
+#undef __GMPZNU_DEFINE_COMPOUND_OPERATOR
+#undef __GMPZND_DEFINE_COMPOUND_OPERATOR
+#undef __GMPZNLD_DEFINE_COMPOUND_OPERATOR
#undef __GMPP_DEFINE_COMPOUND_OPERATOR
#undef __GMPNN_DEFINE_COMPOUND_OPERATOR
@@ -3330,7 +3385,4 @@ namespace std {
#undef __GMPQ_DEFINE_INCREMENT_OPERATOR
#undef __GMPF_DEFINE_INCREMENT_OPERATOR
-#undef __GMPXX_CONSTANT_TRUE
-#undef __GMPXX_CONSTANT
-
#endif /* __GMP_PLUSPLUS__ */
diff --git a/gmp/install-sh b/gmp/install-sh
index a9244eb078..e4160c991d 100755
--- a/gmp/install-sh
+++ b/gmp/install-sh
@@ -1,7 +1,7 @@
#!/bin/sh
# install - install a program, script, or datafile
-scriptversion=2011-01-19.21; # UTC
+scriptversion=2004-04-01.17
# This originates from X11R5 (mit/util/scripts/install.sh), which was
# later released in X11R6 (xc/config/util/install.sh) with the
@@ -39,165 +39,120 @@ scriptversion=2011-01-19.21; # UTC
# when there is no Makefile.
#
# This script is compatible with the BSD install script, but was written
-# from scratch.
-
-nl='
-'
-IFS=" "" $nl"
+# from scratch. It can only install one file at a time, a restriction
+# shared with many OS's install programs.
# set DOITPROG to echo to test this script
# Don't use :- since 4.3BSD and earlier shells don't like it.
-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=
-chmodcmd=$chmodprog
+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=
-mvcmd=$mvprog
-rmcmd="$rmprog -f"
+chgrpcmd=
stripcmd=
-
+rmcmd="$rmprog -f"
+mvcmd="$mvprog"
src=
dst=
dir_arg=
-dst_arg=
-copy_on_change=false
-no_target_directory=
-
-usage="\
-Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
+usage="Usage: $0 [OPTION]... SRCFILE DSTFILE
or: $0 [OPTION]... SRCFILES... DIRECTORY
- or: $0 [OPTION]... -t DIRECTORY SRCFILES...
- or: $0 [OPTION]... -d DIRECTORIES...
+ or: $0 -d DIRECTORIES...
-In the 1st form, copy SRCFILE to DSTFILE.
-In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
-In the 4th, create DIRECTORIES.
+In the first form, install SRCFILE to DSTFILE, removing SRCFILE by default.
+In the second, create the directory path DIR.
Options:
- --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.
+-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.
Environment variables override the default commands:
- CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
- RMPROG STRIPPROG
+ CHGRPPROG CHMODPROG CHOWNPROG CPPROG MKDIRPROG MVPROG RMPROG STRIPPROG
"
-while test $# -ne 0; do
+while test -n "$1"; do
case $1 in
- -c) ;;
+ -b=*) transformbasename=`echo $1 | sed 's/-b=//'`
+ shift
+ continue;;
- -C) copy_on_change=true;;
+ -c) instcmd=$cpprog
+ shift
+ continue;;
- -d) dir_arg=true;;
+ -d) dir_arg=true
+ shift
+ continue;;
-g) chgrpcmd="$chgrpprog $2"
- shift;;
+ shift
+ shift
+ continue;;
- --help) echo "$usage"; exit $?;;
+ --help) echo "$usage"; exit 0;;
- -m) mode=$2
- case $mode in
- *' '* | *' '* | *'
-'* | *'*'* | *'?'* | *'['*)
- echo "$0: invalid mode: $mode" >&2
- exit 1;;
- esac
- shift;;
+ -m) chmodcmd="$chmodprog $2"
+ shift
+ shift
+ continue;;
-o) chowncmd="$chownprog $2"
- 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
+ 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
break;;
-
- -*) echo "$0: invalid option: $1" >&2
- exit 1;;
-
- *) break;;
esac
- shift
done
-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 "$1"; then
if test -z "$dir_arg"; then
echo "$0: no input file specified." >&2
exit 1
@@ -207,52 +162,25 @@ if test $# -eq 0; 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 problematic for `test' and other utilities.
+ # Protect names starting with `-'.
case $src in
- -* | [=\(\)!]) src=./$src;;
+ -*) src=./$src ;;
esac
if test -n "$dir_arg"; then
dst=$src
- dstdir=$dst
- test -d "$dstdir"
- dstdir_status=$?
- else
+ src=
- # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
+ if test -d "$dst"; then
+ instcmd=:
+ chmodcmd=
+ else
+ instcmd=$mkdirprog
+ fi
+ else
+ # Waiting for this to be detected by the "$instcmd $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
@@ -260,268 +188,138 @@ do
exit 1
fi
- if test -z "$dst_arg"; then
+ if test -z "$dstarg"; then
echo "$0: no destination specified." >&2
exit 1
fi
- dst=$dst_arg
+
+ dst=$dstarg
+ # Protect names starting with `-'.
+ case $dst in
+ -*) dst=./$dst ;;
+ esac
# If destination is a directory, append the input filename; won't work
# if double slashes aren't ignored.
if test -d "$dst"; then
- 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=$?
+ dst=$dst/`basename "$src"`
fi
fi
- 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
+ # This sed command emulates the dirname command.
+ dstdir=`echo "$dst" | sed -e 's,[^/]*$,,;s,/$,,;s,^$,.,'`
- if
- $posix_mkdir && (
- umask $mkdir_umask &&
- $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
- )
- then :
- else
+ # Make sure that the destination directory exists.
- # 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.
+ # Skip lots of stat calls in the usual case.
+ if test ! -d "$dstdir"; then
+ defaultIFS='
+ '
+ IFS="${IFS-$defaultIFS}"
- case $dstdir in
- /*) prefix='/';;
- [-=\(\)!]*) prefix='./';;
- *) prefix='';;
- esac
+ oIFS=$IFS
+ # Some sh's can't handle IFS=/ for some reason.
+ IFS='%'
+ set - `echo "$dstdir" | sed -e 's@/@%@g' -e 's@^%@/@'`
+ IFS=$oIFS
- eval "$initialize_posix_glob"
+ pathcomp=
- oIFS=$IFS
- IFS=/
- $posix_glob set -f
- set fnord $dstdir
+ while test $# -ne 0 ; do
+ pathcomp=$pathcomp$1
shift
- $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
+ 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; }
fi
- fi
+ pathcomp=$pathcomp/
+ done
fi
if test -n "$dir_arg"; then
- { 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
+ $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"; }
+
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 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
+ trap 'status=$?; rm -f "$dsttmp" "$rmtmp" && exit $status' 0
+ trap '(exit $?); exit' 1 2 13 15
- # Copy the file name to the temp name.
- (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
+ # Move or copy the file name to the temp name
+ $doit $instcmd "$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 $cpprog $src $dsttmp" command.
+ # errors from the above "$doit $instcmd $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 $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
+ { 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; }
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-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
+# time-stamp-end: "$"
# End:
diff --git a/gmp/invalid.c b/gmp/invalid.c
index 81d6720c0d..24c6f131c1 100644
--- a/gmp/invalid.c
+++ b/gmp/invalid.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
diff --git a/gmp/libmp.sym b/gmp/libmp.sym
new file mode 100644
index 0000000000..f36d5c0acd
--- /dev/null
+++ b/gmp/libmp.sym
@@ -0,0 +1,18 @@
+itom
+xtom
+move
+madd
+msub
+mult
+mdiv
+sdiv
+msqrt
+pow
+rpow
+gcd
+mcmp
+min
+mout
+mtox
+mfree
+__gmp_set_memory_functions
diff --git a/gmp/longlong.h b/gmp/longlong.h
index f144dee9e7..1354d7df11 100644
--- a/gmp/longlong.h
+++ b/gmp/longlong.h
@@ -1,56 +1,36 @@
/* longlong.h -- definitions for mixed size 32/64 bit arithmetic.
-Copyright 1991-1994, 1996, 1997, 1999-2005, 2007-2009, 2011-2013 Free Software
-Foundation, Inc.
+Copyright 1991, 1992, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003,
+2004, 2005, 2007, 2008, 2009 Free Software Foundation, Inc.
-This file is part of the GNU MP Library.
+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.
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of either:
+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 Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+along with this file. If not, see http://www.gnu.org/licenses/. */
/* You have to define the following before including this file:
UWtype -- An unsigned type, default type for operations (typically a "word")
- UHWtype -- An unsigned type, at least half the size of UWtype
+ UHWtype -- An unsigned type, at least half the size of UWtype.
UDWtype -- An unsigned type, at least twice as large a UWtype
W_TYPE_SIZE -- size in bits of UWtype
- SItype, USItype -- Signed and unsigned 32 bit types
- DItype, UDItype -- Signed and unsigned 64 bit types
+ SItype, USItype -- Signed and unsigned 32 bit types.
+ DItype, UDItype -- Signed and unsigned 64 bit types.
On a 32 bit machine UWtype should typically be USItype;
on a 64 bit machine, UWtype should typically be UDItype.
- Optionally, define:
-
- LONGLONG_STANDALONE -- Avoid code that needs machine-dependent support files
- NO_ASM -- Disable inline asm
-
-
- CAUTION! Using this version of longlong.h outside of GMP is not safe. You
- need to include gmp.h and gmp-impl.h, or certain things might not work as
- expected.
+ CAUTION! Using this file outside of GMP is not safe. You need to include
+ gmp.h and gmp-impl.h, or certain things might not work as expected.
*/
#define __BITS4 (W_TYPE_SIZE / 4)
@@ -64,6 +44,14 @@ see https://www.gnu.org/licenses/. */
#define __MPN(x) __##x
#endif
+#ifndef _PROTO
+#if (__STDC__-0) || defined (__cplusplus)
+#define _PROTO(x) x
+#else
+#define _PROTO(x) ()
+#endif
+#endif
+
/* Define auxiliary asm macros.
1) umul_ppmm(high_prod, low_prod, multiplier, multiplicand) multiplies two
@@ -152,30 +140,30 @@ see https://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
@@ -236,57 +224,48 @@ see https://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 */
#if ! defined (count_leading_zeros) && ! defined (LONGLONG_STANDALONE)
#if HAVE_ATTRIBUTE_CONST
-long __MPN(count_leading_zeros) (UDItype) __attribute__ ((const));
+long __MPN(count_leading_zeros) _PROTO ((UDItype)) __attribute__ ((const));
#else
-long __MPN(count_leading_zeros) (UDItype);
+long __MPN(count_leading_zeros) _PROTO ((UDItype));
#endif
#define count_leading_zeros(count, x) \
((count) = __MPN(count_leading_zeros) (x))
#endif /* clz using mpn */
#endif /* __alpha */
-#if defined (__AVR) && W_TYPE_SIZE == 8
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- unsigned short __p = (unsigned short) (m0) * (m1); \
- (ph) = __p >> 8; \
- (pl) = __p; \
- } while (0)
-#endif /* AVR */
-
#if defined (_CRAY) && W_TYPE_SIZE == 64
#include <intrinsics.h>
#define UDIV_PREINV_ALWAYS 1
#define UDIV_NEEDS_NORMALIZATION 1
#define UDIV_TIME 220
-long __MPN(count_leading_zeros) (UDItype);
+long __MPN(count_leading_zeros) _PROTO ((UDItype));
#define count_leading_zeros(count, x) \
((count) = _leadz ((UWtype) (x)))
#if defined (_CRAYIEEE) /* I.e., Cray T90/ieee, T3D, and T3E */
@@ -312,14 +291,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
@@ -437,7 +416,7 @@ long __MPN(count_leading_zeros) (UDItype);
"rIJ" ((USItype) (bl)))
#endif
-#if defined (__arm__) && !defined (__thumb__) && W_TYPE_SIZE == 32
+#if defined (__arm__) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("adds\t%1, %4, %5\n\tadc\t%0, %2, %3" \
: "=r" (sh), "=&r" (sl) \
@@ -523,49 +502,12 @@ long __MPN(count_leading_zeros) (UDItype);
(q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
(r) = __r; \
} while (0)
-extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
+extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
#define UDIV_TIME 200
#endif /* LONGLONG_STANDALONE */
#endif
-/* 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__) || \
- defined (__ARM_ARCH_6K__) || defined (__ARM_ARCH_6Z__) || \
- defined (__ARM_ARCH_6ZK__)|| defined (__ARM_ARCH_6T2__)|| \
- defined (__ARM_ARCH_6M__) || defined (__ARM_ARCH_7__) || \
- defined (__ARM_ARCH_7A__) || defined (__ARM_ARCH_7R__) || \
- defined (__ARM_ARCH_7M__) || defined (__ARM_ARCH_7EM__)
-#define count_leading_zeros(count, x) \
- __asm__ ("clz\t%0, %1" : "=r" (count) : "r" (x))
-#define COUNT_LEADING_ZEROS_0 32
-#endif
#endif /* __arm__ */
-#if defined (__aarch64__) && W_TYPE_SIZE == 64
-/* FIXME: Extend the immediate range for the low word by using both
- ADDS and SUBS, since they set carry in the same way. */
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- __asm__ ("adds\t%1, %x4, %5\n\tadc\t%0, %x2, %x3" \
- : "=r" (sh), "=&r" (sl) \
- : "rZ" (ah), "rZ" (bh), "%r" (al), "rI" (bl) __CLOBBER_CC)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- __asm__ ("subs\t%1, %x4, %5\n\tsbc\t%0, %x2, %x3" \
- : "=r,r" (sh), "=&r,&r" (sl) \
- : "rZ,rZ" (ah), "rZ,rZ" (bh), "r,Z" (al), "rI,r" (bl) __CLOBBER_CC)
-#define umul_ppmm(ph, pl, m0, m1) \
- do { \
- UDItype __m0 = (m0), __m1 = (m1); \
- __asm__ ("umulh\t%0, %1, %2" : "=r" (ph) : "r" (m0), "r" (m1)); \
- (pl) = __m0 * __m1; \
- } while (0)
-#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__ */
-
#if defined (__clipper__) && W_TYPE_SIZE == 32
#define umul_ppmm(w1, w0, u, v) \
({union {UDItype __ll; \
@@ -699,172 +641,27 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif /* hppa */
#if (defined (__i370__) || defined (__s390__) || defined (__mvs__)) && W_TYPE_SIZE == 32
-#if defined (__zarch__) || defined (HAVE_HOST_CPU_s390_zarch)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
-/* if (__builtin_constant_p (bl)) \
- __asm__ ("alfi\t%1,%o5\n\talcr\t%0,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "0" (ah), "r" (bh), "%1" (al), "n" (bl) __CLOBBER_CC);\
- else \
-*/ __asm__ ("alr\t%1,%5\n\talcr\t%0,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "0" (ah), "r" (bh), "%1" (al), "r" (bl)__CLOBBER_CC); \
- } while (0)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
-/* if (__builtin_constant_p (bl)) \
- __asm__ ("slfi\t%1,%o5\n\tslbr\t%0,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "0" (ah), "r" (bh), "1" (al), "n" (bl) __CLOBBER_CC); \
- else \
-*/ __asm__ ("slr\t%1,%5\n\tslbr\t%0,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "0" (ah), "r" (bh), "1" (al), "r" (bl) __CLOBBER_CC); \
- } while (0)
-#if __GMP_GNUC_PREREQ (4,5)
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __x; \
- __x.__ll = (UDItype) (m0) * (UDItype) (m1); \
- (xh) = __x.__i.__h; (xl) = __x.__i.__l; \
- } while (0)
-#else
-#if 0
-/* FIXME: this fails if gcc knows about the 64-bit registers. Use only
- with a new enough processor pretending we have 32-bit registers. */
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __x; \
- __asm__ ("mlr\t%0,%2" \
- : "=r" (__x.__ll) \
- : "%0" (m0), "r" (m1)); \
- (xh) = __x.__i.__h; (xl) = __x.__i.__l; \
- } while (0)
-#else
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- /* When we have 64-bit regs and gcc is aware of that, we cannot simply use
- DImode for the product, since that would be allocated to a single 64-bit
- register, whereas mlr uses the low 32-bits of an even-odd register pair.
- */ \
- register USItype __r0 __asm__ ("0"); \
- register USItype __r1 __asm__ ("1") = (m0); \
- __asm__ ("mlr\t%0,%3" \
- : "=r" (__r0), "=r" (__r1) \
- : "r" (__r1), "r" (m1)); \
- (xh) = __r0; (xl) = __r1; \
- } while (0)
-#endif /* if 0 */
-#endif
-#if 0
-/* FIXME: this fails if gcc knows about the 64-bit registers. Use only
- with a new enough processor pretending we have 32-bit registers. */
-#define udiv_qrnnd(q, r, n1, n0, d) \
- do { \
- union {UDItype __ll; \
- struct {USItype __h, __l;} __i; \
- } __x; \
- __x.__i.__h = n1; __x.__i.__l = n0; \
- __asm__ ("dlr\t%0,%2" \
- : "=r" (__x.__ll) \
- : "0" (__x.__ll), "r" (d)); \
- (q) = __x.__i.__l; (r) = __x.__i.__h; \
- } while (0)
-#else
-#define udiv_qrnnd(q, r, n1, n0, d) \
- do { \
- register USItype __r0 __asm__ ("0") = (n1); \
- register USItype __r1 __asm__ ("1") = (n0); \
- __asm__ ("dlr\t%0,%4" \
- : "=r" (__r0), "=r" (__r1) \
- : "r" (__r0), "r" (__r1), "r" (d)); \
- (q) = __r1; (r) = __r0; \
- } while (0)
-#endif /* if 0 */
-#else /* if __zarch__ */
-/* FIXME: this fails if gcc knows about the 64-bit registers. */
-#define smul_ppmm(xh, xl, m0, m1) \
+#define smul_ppmm(xh, xl, m0, m1) \
do { \
union {DItype __ll; \
struct {USItype __h, __l;} __i; \
} __x; \
- __asm__ ("mr\t%0,%2" \
- : "=r" (__x.__ll) \
- : "%0" (m0), "r" (m1)); \
+ __asm__ ("lr %N0,%1\n\tmr %0,%2" \
+ : "=&r" (__x.__ll) \
+ : "r" (m0), "r" (m1)); \
(xh) = __x.__i.__h; (xl) = __x.__i.__l; \
} while (0)
-/* FIXME: this fails if gcc knows about the 64-bit registers. */
-#define sdiv_qrnnd(q, r, n1, n0, d) \
+#define sdiv_qrnnd(q, r, n1, n0, d) \
do { \
union {DItype __ll; \
struct {USItype __h, __l;} __i; \
} __x; \
__x.__i.__h = n1; __x.__i.__l = n0; \
- __asm__ ("dr\t%0,%2" \
+ __asm__ ("dr %0,%2" \
: "=r" (__x.__ll) \
: "0" (__x.__ll), "r" (d)); \
(q) = __x.__i.__l; (r) = __x.__i.__h; \
} while (0)
-#endif /* if __zarch__ */
-#endif
-
-#if defined (__s390x__) && W_TYPE_SIZE == 64
-/* We need to cast operands with register constraints, otherwise their types
- will be assumed to be SImode by gcc. For these machines, such operations
- will insert a value into the low 32 bits, and leave the high 32 bits with
- garbage. */
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- __asm__ ("algr\t%1,%5\n\talcgr\t%0,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "0" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
- "%1" ((UDItype)(al)), "r" ((UDItype)(bl)) __CLOBBER_CC); \
- } while (0)
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- __asm__ ("slgr\t%1,%5\n\tslbgr\t%0,%3" \
- : "=r" (sh), "=&r" (sl) \
- : "0" ((UDItype)(ah)), "r" ((UDItype)(bh)), \
- "1" ((UDItype)(al)), "r" ((UDItype)(bl)) __CLOBBER_CC); \
- } while (0)
-#define umul_ppmm(xh, xl, m0, m1) \
- do { \
- union {unsigned int __attribute__ ((mode(TI))) __ll; \
- struct {UDItype __h, __l;} __i; \
- } __x; \
- __asm__ ("mlgr\t%0,%2" \
- : "=r" (__x.__ll) \
- : "%0" ((UDItype)(m0)), "r" ((UDItype)(m1))); \
- (xh) = __x.__i.__h; (xl) = __x.__i.__l; \
- } while (0)
-#define udiv_qrnnd(q, r, n1, n0, d) \
- do { \
- union {unsigned int __attribute__ ((mode(TI))) __ll; \
- struct {UDItype __h, __l;} __i; \
- } __x; \
- __x.__i.__h = n1; __x.__i.__l = n0; \
- __asm__ ("dlgr\t%0,%2" \
- : "=r" (__x.__ll) \
- : "0" (__x.__ll), "r" ((UDItype)(d))); \
- (q) = __x.__i.__l; (r) = __x.__i.__h; \
- } while (0)
-#if 0 /* FIXME: Enable for z10 (?) */
-#define count_leading_zeros(cnt, x) \
- do { \
- union {unsigned int __attribute__ ((mode(TI))) __ll; \
- struct {UDItype __h, __l;} __i; \
- } __clr_cnt; \
- __asm__ ("flogr\t%0,%1" \
- : "=r" (__clr_cnt.__ll) \
- : "r" (x) __CLOBBER_CC); \
- (cnt) = __clr_cnt.__i.__h; \
- } while (0)
-#endif
#endif
#if (defined (__i386__) || defined (__i486__)) && W_TYPE_SIZE == 32
@@ -961,7 +758,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 \
@@ -1042,7 +839,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 /* __amd64__ */
+#endif /* x86_64 */
#if defined (__i860__) && W_TYPE_SIZE == 32
#define rshift_rhlc(r,h,l,c) \
@@ -1171,7 +968,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" \
@@ -1324,42 +1121,42 @@ 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__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %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__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %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__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %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__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %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__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %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__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %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__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %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__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %0,%3,%2" \
: "=r" (sh), "=&r" (sl) \
: "r" (ah), "r" (bh), "rI" (al), "r" (bl)); \
} while (0)
#define count_leading_zeros(count, x) \
- __asm__ ("cntlzw %0,%1" : "=r" (count) : "r" (x))
+ __asm__ ("{cntlz|cntlzw} %0,%1" : "=r" (count) : "r" (x))
#define COUNT_LEADING_ZEROS_0 32
#if HAVE_HOST_CPU_FAMILY_powerpc
#if __GMP_GNUC_PREREQ (4,4)
@@ -1407,61 +1204,61 @@ 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__ ("{a%I4|add%I4c} %1,%3,%4\n\t{aze|addze} %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__ ("{a%I4|add%I4c} %1,%3,%4\n\t{ame|addme} %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__ ("{a%I5|add%I5c} %1,%4,%5\n\t{ae|adde} %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__ ("{ai|addic} %1,%3,%4\n\t{sfze|subfze} %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__ ("{ai|addic} %1,%3,%4\n\t{sfme|subfme} %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__ ("{ai|addic} %1,%3,%4\n\t{ame|addme} %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__ ("{ai|addic} %1,%3,%4\n\t{aze|addze} %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__ ("{ai|addic} %1,%4,%5\n\t{sfe|subfe} %0,%3,%2" \
+ : "=r" (sh), "=&r" (sl) \
+ : "r" (ah), "r" (bh), "rI" (al), "*rI" (-bl)); \
+ } else { \
+ if (__builtin_constant_p (ah) && (ah) == 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfze|subfze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \
+ else if (__builtin_constant_p (ah) && (ah) == ~(UDItype) 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{sfme|subfme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (bh), "rI" (al), "r" (bl)); \
+ else if (__builtin_constant_p (bh) && (bh) == 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{ame|addme} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \
+ else if (__builtin_constant_p (bh) && (bh) == ~(UDItype) 0) \
+ __asm__ ("{sf%I3|subf%I3c} %1,%4,%3\n\t{aze|addze} %0,%2" \
+ : "=r" (sh), "=&r" (sl) : "r" (ah), "rI" (al), "r" (bl)); \
+ else \
+ __asm__ ("{sf%I4|subf%I4c} %1,%5,%4\n\t{sfe|subfe} %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) \
__asm__ ("cntlzd %0,%1" : "=r" (count) : "r" (x))
#define COUNT_LEADING_ZEROS_0 64
-#if 0 && __GMP_GNUC_PREREQ (4,4) /* Disable, this results in libcalls! */
+#if __GMP_GNUC_PREREQ (4,4)
#define umul_ppmm(w1, w0, u, v) \
do { \
typedef unsigned int __ll_UTItype __attribute__((mode(TI))); \
@@ -1563,7 +1360,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
} while (0)
#endif /* RT/ROMP */
-#if (defined (__SH2__) || defined (__SH3__) || defined (__SH4__)) && W_TYPE_SIZE == 32
+#if defined (__sh2__) && W_TYPE_SIZE == 32
#define umul_ppmm(w1, w0, u, v) \
__asm__ ("dmulu.l %2,%3\n\tsts macl,%1\n\tsts mach,%0" \
: "=r" (w1), "=r" (w0) : "r" (u), "r" (v) : "macl", "mach")
@@ -1745,7 +1542,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
(q) = __MPN(udiv_qrnnd) (&__r, (n1), (n0), (d)); \
(r) = __r; \
} while (0)
-extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
+extern UWtype __MPN(udiv_qrnnd) _PROTO ((UWtype *, UWtype, UWtype, UWtype));
#ifndef UDIV_TIME
#define UDIV_TIME 140
#endif
@@ -1769,31 +1566,12 @@ 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
+#if defined (__vax__) && W_TYPE_SIZE == 32
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
__asm__ ("addl2 %5,%1\n\tadwc %3,%0" \
: "=g" (sh), "=&g" (sl) \
@@ -1833,7 +1611,7 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
: "g" ((USItype) (x))); \
} while (0)
#endif
-#endif /* vax */
+#endif /* __vax__ */
#if defined (__z8000__) && W_TYPE_SIZE == 16
#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
@@ -1866,7 +1644,6 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
#endif /* NO_ASM */
-/* FIXME: "sidi" here is highly doubtful, should sometimes be "diti". */
#if !defined (umul_ppmm) && defined (__umulsidi3)
#define umul_ppmm(ph, pl, m0, m1) \
{ \
@@ -1890,56 +1667,56 @@ extern UWtype __MPN(udiv_qrnnd) (UWtype *, UWtype, UWtype, UWtype);
hppa. */
#define mpn_umul_ppmm __MPN(umul_ppmm)
-extern UWtype mpn_umul_ppmm (UWtype *, UWtype, UWtype);
+extern UWtype mpn_umul_ppmm _PROTO ((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
#define mpn_umul_ppmm_r __MPN(umul_ppmm_r)
-extern UWtype mpn_umul_ppmm_r (UWtype, UWtype, UWtype *);
+extern UWtype mpn_umul_ppmm_r _PROTO ((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_p0; \
- (wh) = mpn_umul_ppmm_r ((UWtype) (u), (UWtype) (v), &__umul_p0); \
- (wl) = __umul_p0; \
+#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; \
} while (0)
#endif
#define mpn_udiv_qrnnd __MPN(udiv_qrnnd)
-extern UWtype mpn_udiv_qrnnd (UWtype *, UWtype, UWtype, UWtype);
+extern UWtype mpn_udiv_qrnnd _PROTO ((UWtype *, UWtype, UWtype, UWtype));
#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd \
&& ! 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
#define mpn_udiv_qrnnd_r __MPN(udiv_qrnnd_r)
-extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
+extern UWtype mpn_udiv_qrnnd_r _PROTO ((UWtype, UWtype, UWtype, UWtype *));
#if ! defined (udiv_qrnnd) && HAVE_NATIVE_mpn_udiv_qrnnd_r \
&& ! 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
@@ -1961,7 +1738,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
@@ -2079,7 +1856,6 @@ extern UWtype mpn_udiv_qrnnd_r (UWtype, UWtype, UWtype, UWtype *);
(q) = __MPN(udiv_w_sdiv) (&__r, nh, nl, d); \
(r) = __r; \
} while (0)
-__GMP_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype);
#endif
/* If udiv_qrnnd was not defined for this processor, use __udiv_qrnnd_c. */
@@ -2114,7 +1890,6 @@ __GMP_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype);
/* This version gives a well-defined value for zero. */
#define COUNT_LEADING_ZEROS_0 (W_TYPE_SIZE - 1)
#define COUNT_LEADING_ZEROS_NEED_CLZ_TAB
-#define COUNT_LEADING_ZEROS_SLOW
#endif
/* clz_tab needed by mpn/x86/pentium/mod_1.asm in a fat binary */
@@ -2123,13 +1898,13 @@ __GMP_DECLSPEC UWtype __MPN(udiv_w_sdiv) (UWtype *, UWtype, UWtype, UWtype);
#endif
#ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
-extern const unsigned char __GMP_DECLSPEC __clz_tab[129];
+extern const unsigned char __GMP_DECLSPEC __clz_tab[128];
#endif
#if !defined (count_trailing_zeros)
-#if !defined (COUNT_LEADING_ZEROS_SLOW)
-/* Define count_trailing_zeros using an asm count_leading_zeros. */
-#define count_trailing_zeros(count, x) \
+/* Define count_trailing_zeros using count_leading_zeros. The latter might be
+ defined in asm, but if it is not, the C version above is good enough. */
+#define count_trailing_zeros(count, x) \
do { \
UWtype __ctz_x = (x); \
UWtype __ctz_c; \
@@ -2137,30 +1912,6 @@ extern const unsigned char __GMP_DECLSPEC __clz_tab[129];
count_leading_zeros (__ctz_c, __ctz_x & -__ctz_x); \
(count) = W_TYPE_SIZE - 1 - __ctz_c; \
} while (0)
-#else
-/* Define count_trailing_zeros in plain C, assuming small counts are common.
- We use clz_tab without ado, since the C count_leading_zeros above will have
- pulled it in. */
-#define count_trailing_zeros(count, x) \
- do { \
- UWtype __ctz_x = (x); \
- int __ctz_c; \
- \
- if (LIKELY ((__ctz_x & 0xff) != 0)) \
- (count) = __clz_tab[__ctz_x & -__ctz_x] - 2; \
- else \
- { \
- for (__ctz_c = 8 - 2; __ctz_c < W_TYPE_SIZE - 2; __ctz_c += 8) \
- { \
- __ctz_x >>= 8; \
- if (LIKELY ((__ctz_x & 0xff) != 0)) \
- break; \
- } \
- \
- (count) = __ctz_c + __clz_tab[__ctz_x & -__ctz_x]; \
- } \
- } while (0)
-#endif
#endif
#ifndef UDIV_NEEDS_NORMALIZATION
diff --git a/gmp/ltmain.sh b/gmp/ltmain.sh
index 63ae69dc6f..4598ec61cc 100644
--- a/gmp/ltmain.sh
+++ b/gmp/ltmain.sh
@@ -1,90 +1,52 @@
-
-# libtool (GNU libtool) 2.4.2
-# Written by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
-
+# ltmain.sh - Provide generalized library-building support services.
+# NOTE: Changing this file will not affect anything until you rerun configure.
+#
# Copyright (C) 1996, 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006,
-# 2007, 2008, 2009, 2010, 2011 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.
-
-# GNU Libtool is free software; you can redistribute it and/or modify
+# 2007 Free Software Foundation, Inc.
+# Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
+#
+# 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.
#
-# As a special exception to the GNU General Public License,
-# if you distribute this file as part of a program or library that
-# is built using GNU Libtool, you may include this file under the
-# same distribution terms that you use for the rest of that program.
-#
-# GNU Libtool is distributed in the hope that it will be useful, but
+# 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 GNU Libtool; see the file COPYING. If not, a copy
-# can be downloaded from http://www.gnu.org/licenses/gpl.html,
-# or obtained by writing to the Free Software Foundation, Inc.,
-# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
-
-# Usage: $progname [OPTION]... [MODE-ARG]...
-#
-# Provide generalized library-building support services.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
#
-# --config show all configuration variables
-# --debug enable verbose shell tracing
-# -n, --dry-run display commands without modifying any files
-# --features display basic configuration information and exit
-# --mode=MODE use operation mode MODE
-# --preserve-dup-deps don't remove duplicate dependency libraries
-# --quiet, --silent don't print informational messages
-# --no-quiet, --no-silent
-# print informational messages (default)
-# --no-warn don't display warning messages
-# --tag=TAG use configuration variables from tag TAG
-# -v, --verbose print more informational messages than default
-# --no-verbose don't print the extra informational messages
-# --version print version information
-# -h, --help, --help-all print short, long, or detailed help message
-#
-# MODE must be one of the following:
-#
-# clean remove files from the build directory
-# compile compile a source file into a libtool object
-# execute automatically set library path, then run a program
-# finish complete the installation of libtool libraries
-# install install libraries or executables
-# link create a library or an executable
-# uninstall remove libraries from an installed directory
-#
-# MODE-ARGS vary depending on the MODE. When passed as first option,
-# `--mode=MODE' may be abbreviated as `MODE' or a unique abbreviation of that.
-# Try `$progname --help --mode=MODE' for a more detailed description of MODE.
-#
-# When reporting a bug, please describe a test case to reproduce it and
-# include the following information:
-#
-# host-triplet: $host
-# shell: $SHELL
-# compiler: $LTCC
-# compiler flags: $LTCFLAGS
-# linker: $LD (gnu? $with_gnu_ld)
-# $progname: (GNU libtool) 2.4.2
-# automake: $automake_version
-# autoconf: $autoconf_version
-#
-# Report bugs to <bug-libtool@gnu.org>.
-# GNU libtool home page: <http://www.gnu.org/software/libtool/>.
-# General help using GNU software: <http://www.gnu.org/gethelp/>.
+# 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.
+
+basename="s,^.*/,,g"
-PROGRAM=libtool
+# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
+# is ksh but when the shell is invoked as "sh" and the current value of
+# the _XPG environment variable is not equal to 1 (one), the special
+# positional parameter $0, within a function call, is the name of the
+# function.
+progpath="$0"
+
+# The name of this program:
+progname=`echo "$progpath" | $SED $basename`
+modename="$progname"
+
+# Global variables:
+EXIT_SUCCESS=0
+EXIT_FAILURE=1
+
+PROGRAM=ltmain.sh
PACKAGE=libtool
-VERSION=2.4.2
-TIMESTAMP=""
-package_revision=1.3337
+VERSION=1.5.24
+TIMESTAMP=" (1.1220.2.455 2007/06/24 02:13:29)"
-# Be Bourne compatible
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
NULLCMD=:
@@ -98,457 +60,98 @@ fi
BIN_SH=xpg4; export BIN_SH # for Tru64
DUALCASE=1; export DUALCASE # for MKS sh
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
- eval 'cat <<_LTECHO_EOF
-$1
-_LTECHO_EOF'
-}
+# Check that we have a working $echo.
+if test "X$1" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+elif test "X$1" = X--fallback-echo; then
+ # Avoid inline document here, it may be left over
+ :
+elif test "X`($echo '\t') 2>/dev/null`" = 'X\t'; then
+ # Yippee, $echo works!
+ :
+else
+ # Restart under the correct shell, and then maybe $echo will work.
+ exec $SHELL "$progpath" --no-reexec ${1+"$@"}
+fi
+
+if test "X$1" = X--fallback-echo; then
+ # used as fallback echo
+ shift
+ cat <<EOF
+$*
+EOF
+ exit $EXIT_SUCCESS
+fi
+
+default_mode=
+help="Try \`$progname --help' for more information."
+magic="%%%MAGIC variable%%%"
+mkdir="mkdir"
+mv="mv -f"
+rm="rm -f"
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed="${SED}"' -e 1s/^X//'
+sed_quote_subst='s/\([\\`\\"$\\\\]\)/\\\1/g'
+# test EBCDIC or ASCII
+case `echo X|tr X '\101'` in
+ A) # ASCII based system
+ # \n is not interpreted correctly by Solaris 8 /usr/ucb/tr
+ SP2NL='tr \040 \012'
+ NL2SP='tr \015\012 \040\040'
+ ;;
+ *) # EBCDIC based system
+ SP2NL='tr \100 \n'
+ NL2SP='tr \r\n \100\100'
+ ;;
+esac
-# NLS nuisances: We save the old values to restore during execute mode.
-lt_user_locale=
-lt_safe_locale=
-for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+# NLS nuisances.
+# Only set LANG and LC_ALL to C if already set.
+# These must not be set unconditionally because not all systems understand
+# e.g. LANG=C (notably SCO).
+# We save the old values to restore during execute mode.
+for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
do
eval "if test \"\${$lt_var+set}\" = set; then
- save_$lt_var=\$$lt_var
- $lt_var=C
+ save_$lt_var=\$$lt_var
+ $lt_var=C
export $lt_var
- lt_user_locale=\"$lt_var=\\\$save_\$lt_var; \$lt_user_locale\"
- lt_safe_locale=\"$lt_var=C; \$lt_safe_locale\"
fi"
done
-LC_ALL=C
-LANGUAGE=C
-export LANGUAGE LC_ALL
-
-$lt_unset CDPATH
-
-
-# Work around backward compatibility issue on IRIX 6.5. On IRIX 6.4+, sh
-# is ksh but when the shell is invoked as "sh" and the current value of
-# the _XPG environment variable is not equal to 1 (one), the special
-# positional parameter $0, within a function call, is the name of the
-# function.
-progpath="$0"
-
-
-
-: ${CP="cp -f"}
-test "${ECHO+set}" = set || ECHO=${as_echo-'printf %s\n'}
-: ${MAKE="make"}
-: ${MKDIR="mkdir"}
-: ${MV="mv -f"}
-: ${RM="rm -f"}
-: ${SHELL="${CONFIG_SHELL-/bin/sh}"}
-: ${Xsed="$SED -e 1s/^X//"}
-
-# Global variables:
-EXIT_SUCCESS=0
-EXIT_FAILURE=1
-EXIT_MISMATCH=63 # $? = 63 is used to indicate version mismatch to missing.
-EXIT_SKIP=77 # $? = 77 is used to indicate a skipped test to automake.
-
-exit_status=$EXIT_SUCCESS
# Make sure IFS has a sensible default
lt_nl='
'
IFS=" $lt_nl"
-dirname="s,/[^/]*$,,"
-basename="s,^.*/,,"
-
-# func_dirname file append nondir_replacement
-# Compute the dirname of FILE. If nonempty, add APPEND to the result,
-# otherwise set result to NONDIR_REPLACEMENT.
-func_dirname ()
-{
- func_dirname_result=`$ECHO "${1}" | $SED "$dirname"`
- if test "X$func_dirname_result" = "X${1}"; then
- func_dirname_result="${3}"
- else
- func_dirname_result="$func_dirname_result${2}"
- fi
-} # func_dirname may be replaced by extended shell implementation
-
-
-# func_basename file
-func_basename ()
-{
- func_basename_result=`$ECHO "${1}" | $SED "$basename"`
-} # func_basename may be replaced by extended shell implementation
-
-
-# func_dirname_and_basename file append nondir_replacement
-# perform func_basename and func_dirname in a single function
-# call:
-# dirname: Compute the dirname of FILE. If nonempty,
-# add APPEND to the result, otherwise set result
-# to NONDIR_REPLACEMENT.
-# value returned in "$func_dirname_result"
-# basename: Compute filename of FILE.
-# value retuned in "$func_basename_result"
-# Implementation must be kept synchronized with func_dirname
-# and func_basename. For efficiency, we do not delegate to
-# those functions but instead duplicate the functionality here.
-func_dirname_and_basename ()
-{
- # Extract subdirectory from the argument.
- func_dirname_result=`$ECHO "${1}" | $SED -e "$dirname"`
- if test "X$func_dirname_result" = "X${1}"; then
- func_dirname_result="${3}"
- else
- func_dirname_result="$func_dirname_result${2}"
- fi
- func_basename_result=`$ECHO "${1}" | $SED -e "$basename"`
-} # func_dirname_and_basename may be replaced by extended shell implementation
-
-
-# func_stripname prefix suffix name
-# strip PREFIX and SUFFIX off of NAME.
-# PREFIX and SUFFIX must not contain globbing or regex special
-# characters, hashes, percent signs, but SUFFIX may contain a leading
-# dot (in which case that matches only a dot).
-# func_strip_suffix prefix name
-func_stripname ()
-{
- case ${2} in
- .*) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%\\\\${2}\$%%"`;;
- *) func_stripname_result=`$ECHO "${3}" | $SED "s%^${1}%%; s%${2}\$%%"`;;
- esac
-} # func_stripname may be replaced by extended shell implementation
-
-
-# These SED scripts presuppose an absolute path with a trailing slash.
-pathcar='s,^/\([^/]*\).*$,\1,'
-pathcdr='s,^/[^/]*,,'
-removedotparts=':dotsl
- s@/\./@/@g
- t dotsl
- s,/\.$,/,'
-collapseslashes='s@/\{1,\}@/@g'
-finalslash='s,/*$,/,'
-
-# func_normal_abspath PATH
-# Remove doubled-up and trailing slashes, "." path components,
-# and cancel out any ".." path components in PATH after making
-# it an absolute path.
-# value returned in "$func_normal_abspath_result"
-func_normal_abspath ()
-{
- # Start from root dir and reassemble the path.
- func_normal_abspath_result=
- func_normal_abspath_tpath=$1
- func_normal_abspath_altnamespace=
- case $func_normal_abspath_tpath in
- "")
- # Empty path, that just means $cwd.
- func_stripname '' '/' "`pwd`"
- func_normal_abspath_result=$func_stripname_result
- return
- ;;
- # The next three entries are used to spot a run of precisely
- # two leading slashes without using negated character classes;
- # we take advantage of case's first-match behaviour.
- ///*)
- # Unusual form of absolute path, do nothing.
- ;;
- //*)
- # Not necessarily an ordinary path; POSIX reserves leading '//'
- # and for example Cygwin uses it to access remote file shares
- # over CIFS/SMB, so we conserve a leading double slash if found.
- func_normal_abspath_altnamespace=/
- ;;
- /*)
- # Absolute path, do nothing.
- ;;
- *)
- # Relative path, prepend $cwd.
- func_normal_abspath_tpath=`pwd`/$func_normal_abspath_tpath
- ;;
- esac
- # Cancel out all the simple stuff to save iterations. We also want
- # the path to end with a slash for ease of parsing, so make sure
- # there is one (and only one) here.
- func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
- -e "$removedotparts" -e "$collapseslashes" -e "$finalslash"`
- while :; do
- # Processed it all yet?
- if test "$func_normal_abspath_tpath" = / ; then
- # If we ascended to the root using ".." the result may be empty now.
- if test -z "$func_normal_abspath_result" ; then
- func_normal_abspath_result=/
- fi
- break
- fi
- func_normal_abspath_tcomponent=`$ECHO "$func_normal_abspath_tpath" | $SED \
- -e "$pathcar"`
- func_normal_abspath_tpath=`$ECHO "$func_normal_abspath_tpath" | $SED \
- -e "$pathcdr"`
- # Figure out what to do with it
- case $func_normal_abspath_tcomponent in
- "")
- # Trailing empty path component, ignore it.
- ;;
- ..)
- # Parent dir; strip last assembled component from result.
- func_dirname "$func_normal_abspath_result"
- func_normal_abspath_result=$func_dirname_result
- ;;
- *)
- # Actual path component, append it.
- func_normal_abspath_result=$func_normal_abspath_result/$func_normal_abspath_tcomponent
- ;;
- esac
- done
- # Restore leading double-slash if one was found on entry.
- func_normal_abspath_result=$func_normal_abspath_altnamespace$func_normal_abspath_result
-}
-
-# func_relative_path SRCDIR DSTDIR
-# generates a relative path from SRCDIR to DSTDIR, with a trailing
-# slash if non-empty, suitable for immediately appending a filename
-# without needing to append a separator.
-# value returned in "$func_relative_path_result"
-func_relative_path ()
-{
- func_relative_path_result=
- func_normal_abspath "$1"
- func_relative_path_tlibdir=$func_normal_abspath_result
- func_normal_abspath "$2"
- func_relative_path_tbindir=$func_normal_abspath_result
-
- # Ascend the tree starting from libdir
- while :; do
- # check if we have found a prefix of bindir
- case $func_relative_path_tbindir in
- $func_relative_path_tlibdir)
- # found an exact match
- func_relative_path_tcancelled=
- break
- ;;
- $func_relative_path_tlibdir*)
- # found a matching prefix
- func_stripname "$func_relative_path_tlibdir" '' "$func_relative_path_tbindir"
- func_relative_path_tcancelled=$func_stripname_result
- if test -z "$func_relative_path_result"; then
- func_relative_path_result=.
- fi
- break
- ;;
- *)
- func_dirname $func_relative_path_tlibdir
- func_relative_path_tlibdir=${func_dirname_result}
- if test "x$func_relative_path_tlibdir" = x ; then
- # Have to descend all the way to the root!
- func_relative_path_result=../$func_relative_path_result
- func_relative_path_tcancelled=$func_relative_path_tbindir
- break
- fi
- func_relative_path_result=../$func_relative_path_result
- ;;
- esac
- done
-
- # Now calculate path; take care to avoid doubling-up slashes.
- func_stripname '' '/' "$func_relative_path_result"
- func_relative_path_result=$func_stripname_result
- func_stripname '/' '/' "$func_relative_path_tcancelled"
- if test "x$func_stripname_result" != x ; then
- func_relative_path_result=${func_relative_path_result}/${func_stripname_result}
- fi
-
- # Normalisation. If bindir is libdir, return empty string,
- # else relative path ending with a slash; either way, target
- # file name can be directly appended.
- if test ! -z "$func_relative_path_result"; then
- func_stripname './' '' "$func_relative_path_result/"
- func_relative_path_result=$func_stripname_result
- fi
-}
-
-# The name of this program:
-func_dirname_and_basename "$progpath"
-progname=$func_basename_result
-
-# Make sure we have an absolute path for reexecution:
-case $progpath in
- [\\/]*|[A-Za-z]:\\*) ;;
- *[\\/]*)
- progdir=$func_dirname_result
- progdir=`cd "$progdir" && pwd`
- progpath="$progdir/$progname"
- ;;
- *)
- save_IFS="$IFS"
- IFS=${PATH_SEPARATOR-:}
- for progdir in $PATH; do
- IFS="$save_IFS"
- test -x "$progdir/$progname" && break
- done
- IFS="$save_IFS"
- test -n "$progdir" || progdir=`pwd`
- progpath="$progdir/$progname"
- ;;
-esac
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-Xsed="${SED}"' -e 1s/^X//'
-sed_quote_subst='s/\([`"$\\]\)/\\\1/g'
-
-# Same as above, but do not quote variable references.
-double_quote_subst='s/\(["`\\]\)/\\\1/g'
-
-# Sed substitution that turns a string into a regex matching for the
-# string literally.
-sed_make_literal_regex='s,[].[^$\\*\/],\\&,g'
-
-# Sed substitution that converts a w32 file name or path
-# which contains forward slashes, into one that contains
-# (escaped) backslashes. A very naive implementation.
-lt_sed_naive_backslashify='s|\\\\*|\\|g;s|/|\\|g;s|\\|\\\\|g'
-
-# Re-`\' parameter expansions in output of double_quote_subst that were
-# `\'-ed in input to the same. If an odd number of `\' preceded a '$'
-# in input to double_quote_subst, that '$' was protected from expansion.
-# Since each input `\' is now two `\'s, look for any number of runs of
-# four `\'s followed by two `\'s and then a '$'. `\' that '$'.
-bs='\\'
-bs2='\\\\'
-bs4='\\\\\\\\'
-dollar='\$'
-sed_double_backslash="\
- s/$bs4/&\\
-/g
- s/^$bs2$dollar/$bs&/
- s/\\([^$bs]\\)$bs2$dollar/\\1$bs2$bs$dollar/g
- s/\n//g"
-
-# Standard options:
-opt_dry_run=false
-opt_help=false
-opt_quiet=false
-opt_verbose=false
-opt_warning=:
-
-# func_echo arg...
-# Echo program name prefixed message, along with the current mode
-# name if it has been set yet.
-func_echo ()
-{
- $ECHO "$progname: ${opt_mode+$opt_mode: }$*"
-}
-
-# func_verbose arg...
-# Echo program name prefixed message in verbose mode only.
-func_verbose ()
-{
- $opt_verbose && func_echo ${1+"$@"}
-
- # A bug in bash halts the script if the last line of a function
- # fails when set -e is in force, so we need another command to
- # work around that:
- :
-}
-
-# func_echo_all arg...
-# Invoke $ECHO with all args, space-separated.
-func_echo_all ()
-{
- $ECHO "$*"
-}
-
-# func_error arg...
-# Echo program name prefixed message to standard error.
-func_error ()
-{
- $ECHO "$progname: ${opt_mode+$opt_mode: }"${1+"$@"} 1>&2
-}
-
-# func_warning arg...
-# Echo program name prefixed warning message to standard error.
-func_warning ()
-{
- $opt_warning && $ECHO "$progname: ${opt_mode+$opt_mode: }warning: "${1+"$@"} 1>&2
-
- # bash bug again:
- :
-}
-
-# func_fatal_error arg...
-# Echo program name prefixed message to standard error, and exit.
-func_fatal_error ()
-{
- func_error ${1+"$@"}
- exit $EXIT_FAILURE
-}
-
-# func_fatal_help arg...
-# Echo program name prefixed message to standard error, followed by
-# a help hint, and exit.
-func_fatal_help ()
-{
- func_error ${1+"$@"}
- func_fatal_error "$help"
-}
-help="Try \`$progname --help' for more information." ## default
-
-
-# func_grep expression filename
-# Check whether EXPRESSION matches any line of FILENAME, without output.
-func_grep ()
-{
- $GREP "$1" "$2" >/dev/null 2>&1
-}
-
-
-# func_mkdir_p directory-path
-# Make sure the entire path to DIRECTORY-PATH is available.
-func_mkdir_p ()
-{
- my_directory_path="$1"
- my_dir_list=
-
- if test -n "$my_directory_path" && test "$opt_dry_run" != ":"; then
-
- # Protect directory names starting with `-'
- case $my_directory_path in
- -*) my_directory_path="./$my_directory_path" ;;
- esac
-
- # While some portion of DIR does not yet exist...
- while test ! -d "$my_directory_path"; do
- # ...make a list in topmost first order. Use a colon delimited
- # list incase some portion of path contains whitespace.
- my_dir_list="$my_directory_path:$my_dir_list"
-
- # If the last portion added has no slash in it, the list is done
- case $my_directory_path in */*) ;; *) break ;; esac
-
- # ...otherwise throw away the child directory and loop
- my_directory_path=`$ECHO "$my_directory_path" | $SED -e "$dirname"`
- done
- my_dir_list=`$ECHO "$my_dir_list" | $SED 's,:*$,,'`
-
- save_mkdir_p_IFS="$IFS"; IFS=':'
- for my_dir in $my_dir_list; do
- IFS="$save_mkdir_p_IFS"
- # mkdir can fail with a `File exist' error if two processes
- # try to create one of the directories concurrently. Don't
- # stop in that case!
- $MKDIR "$my_dir" 2>/dev/null || :
- done
- IFS="$save_mkdir_p_IFS"
+if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
+ $echo "$modename: not configured to build any kind of library" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
+fi
- # Bail out if we (or some other process) failed to create a directory.
- test -d "$my_directory_path" || \
- func_fatal_error "Failed to create \`$1'"
- fi
-}
+# Global variables.
+mode=$default_mode
+nonopt=
+prev=
+prevopt=
+run=
+show="$echo"
+show_help=
+execute_dlfiles=
+duplicate_deps=no
+preserve_args=
+lo2o="s/\\.lo\$/.${objext}/"
+o2lo="s/\\.${objext}\$/.lo/"
+extracted_archives=
+extracted_serial=0
+#####################################
+# Shell function definitions:
+# This seems to be the best place for them
# func_mktempdir [string]
# Make a temporary directory that won't clash with other running
@@ -558,7 +161,7 @@ func_mktempdir ()
{
my_template="${TMPDIR-/tmp}/${1-$progname}"
- if test "$opt_dry_run" = ":"; then
+ if test "$run" = ":"; then
# Return a directory name, but don't create it in dry-run mode
my_tmpdir="${my_template}-$$"
else
@@ -567,804 +170,71 @@ func_mktempdir ()
my_tmpdir=`mktemp -d "${my_template}-XXXXXXXX" 2>/dev/null`
if test ! -d "$my_tmpdir"; then
- # Failing that, at least try and use $RANDOM to avoid a race
- my_tmpdir="${my_template}-${RANDOM-0}$$"
+ # Failing that, at least try and use $RANDOM to avoid a race
+ my_tmpdir="${my_template}-${RANDOM-0}$$"
- save_mktempdir_umask=`umask`
- umask 0077
- $MKDIR "$my_tmpdir"
- umask $save_mktempdir_umask
+ save_mktempdir_umask=`umask`
+ umask 0077
+ $mkdir "$my_tmpdir"
+ umask $save_mktempdir_umask
fi
# If we're not in dry-run mode, bomb out on failure
- test -d "$my_tmpdir" || \
- func_fatal_error "cannot create temporary directory \`$my_tmpdir'"
+ test -d "$my_tmpdir" || {
+ $echo "cannot create temporary directory \`$my_tmpdir'" 1>&2
+ exit $EXIT_FAILURE
+ }
fi
- $ECHO "$my_tmpdir"
-}
-
-
-# func_quote_for_eval arg
-# Aesthetically quote ARG to be evaled later.
-# This function returns two values: FUNC_QUOTE_FOR_EVAL_RESULT
-# is double-quoted, suitable for a subsequent eval, whereas
-# FUNC_QUOTE_FOR_EVAL_UNQUOTED_RESULT has merely all characters
-# which are still active within double quotes backslashified.
-func_quote_for_eval ()
-{
- case $1 in
- *[\\\`\"\$]*)
- func_quote_for_eval_unquoted_result=`$ECHO "$1" | $SED "$sed_quote_subst"` ;;
- *)
- func_quote_for_eval_unquoted_result="$1" ;;
- esac
-
- case $func_quote_for_eval_unquoted_result in
- # Double-quote args containing shell metacharacters to delay
- # word splitting, command substitution and and variable
- # expansion for a subsequent eval.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- func_quote_for_eval_result="\"$func_quote_for_eval_unquoted_result\""
- ;;
- *)
- func_quote_for_eval_result="$func_quote_for_eval_unquoted_result"
- esac
-}
-
-
-# func_quote_for_expand arg
-# Aesthetically quote ARG to be evaled later; same as above,
-# but do not quote variable references.
-func_quote_for_expand ()
-{
- case $1 in
- *[\\\`\"]*)
- my_arg=`$ECHO "$1" | $SED \
- -e "$double_quote_subst" -e "$sed_double_backslash"` ;;
- *)
- my_arg="$1" ;;
- esac
-
- case $my_arg in
- # Double-quote args containing shell metacharacters to delay
- # word splitting and command substitution for a subsequent eval.
- # Many Bourne shells cannot handle close brackets correctly
- # in scan sets, so we specify it separately.
- *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
- my_arg="\"$my_arg\""
- ;;
- esac
-
- func_quote_for_expand_result="$my_arg"
+ $echo "X$my_tmpdir" | $Xsed
}
-# func_show_eval cmd [fail_exp]
-# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
-# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it.
-func_show_eval ()
-{
- my_cmd="$1"
- my_fail_exp="${2-:}"
-
- ${opt_silent-false} || {
- func_quote_for_expand "$my_cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
-
- if ${opt_dry_run-false}; then :; else
- eval "$my_cmd"
- my_status=$?
- if test "$my_status" -eq 0; then :; else
- eval "(exit $my_status); $my_fail_exp"
- fi
- fi
-}
-
-
-# func_show_eval_locale cmd [fail_exp]
-# Unless opt_silent is true, then output CMD. Then, if opt_dryrun is
-# not true, evaluate CMD. If the evaluation of CMD fails, and FAIL_EXP
-# is given, then evaluate it. Use the saved locale for evaluation.
-func_show_eval_locale ()
+# func_win32_libid arg
+# return the library type of file 'arg'
+#
+# Need a lot of goo to handle *both* DLLs and import libs
+# Has to be a shell function in order to 'eat' the argument
+# that is supplied when $file_magic_command is called.
+func_win32_libid ()
{
- my_cmd="$1"
- my_fail_exp="${2-:}"
-
- ${opt_silent-false} || {
- func_quote_for_expand "$my_cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
-
- if ${opt_dry_run-false}; then :; else
- eval "$lt_user_locale
- $my_cmd"
- my_status=$?
- eval "$lt_safe_locale"
- if test "$my_status" -eq 0; then :; else
- eval "(exit $my_status); $my_fail_exp"
- fi
+ win32_libid_type="unknown"
+ win32_fileres=`file -L $1 2>/dev/null`
+ case $win32_fileres in
+ *ar\ archive\ import\ library*) # definitely import
+ win32_libid_type="x86 archive import"
+ ;;
+ *ar\ archive*) # could be an import, or static
+ if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null | \
+ $EGREP -e 'file format pe-i386(.*architecture: i386)?' >/dev/null ; then
+ win32_nmres=`eval $NM -f posix -A $1 | \
+ $SED -n -e '1,100{
+ / I /{
+ s,.*,import,
+ p
+ q
+ }
+ }'`
+ case $win32_nmres in
+ import*) win32_libid_type="x86 archive import";;
+ *) win32_libid_type="x86 archive static";;
+ esac
fi
-}
-
-# func_tr_sh
-# Turn $1 into a string suitable for a shell variable name.
-# Result is stored in $func_tr_sh_result. All characters
-# not in the set a-zA-Z0-9_ are replaced with '_'. Further,
-# if $1 begins with a digit, a '_' is prepended as well.
-func_tr_sh ()
-{
- case $1 in
- [0-9]* | *[!a-zA-Z0-9_]*)
- func_tr_sh_result=`$ECHO "$1" | $SED 's/^\([0-9]\)/_\1/; s/[^a-zA-Z0-9_]/_/g'`
;;
- * )
- func_tr_sh_result=$1
+ *DLL*)
+ win32_libid_type="x86 DLL"
;;
- esac
-}
-
-
-# func_version
-# Echo version message to standard output and exit.
-func_version ()
-{
- $opt_debug
-
- $SED -n '/(C)/!b go
- :more
- /\./!{
- N
- s/\n# / /
- b more
- }
- :go
- /^# '$PROGRAM' (GNU /,/# warranty; / {
- s/^# //
- s/^# *$//
- s/\((C)\)[ 0-9,-]*\( [1-9][0-9]*\)/\1\2/
- p
- }' < "$progpath"
- exit $?
-}
-
-# func_usage
-# Echo short help message to standard output and exit.
-func_usage ()
-{
- $opt_debug
-
- $SED -n '/^# Usage:/,/^# *.*--help/ {
- s/^# //
- s/^# *$//
- s/\$progname/'$progname'/
- p
- }' < "$progpath"
- echo
- $ECHO "run \`$progname --help | more' for full usage"
- exit $?
-}
-
-# func_help [NOEXIT]
-# Echo long help message to standard output and exit,
-# unless 'noexit' is passed as argument.
-func_help ()
-{
- $opt_debug
-
- $SED -n '/^# Usage:/,/# Report bugs to/ {
- :print
- s/^# //
- s/^# *$//
- s*\$progname*'$progname'*
- s*\$host*'"$host"'*
- s*\$SHELL*'"$SHELL"'*
- s*\$LTCC*'"$LTCC"'*
- s*\$LTCFLAGS*'"$LTCFLAGS"'*
- s*\$LD*'"$LD"'*
- s/\$with_gnu_ld/'"$with_gnu_ld"'/
- s/\$automake_version/'"`(${AUTOMAKE-automake} --version) 2>/dev/null |$SED 1q`"'/
- s/\$autoconf_version/'"`(${AUTOCONF-autoconf} --version) 2>/dev/null |$SED 1q`"'/
- p
- d
- }
- /^# .* home page:/b print
- /^# General help using/b print
- ' < "$progpath"
- ret=$?
- if test -z "$1"; then
- exit $ret
- fi
-}
-
-# func_missing_arg argname
-# Echo program name prefixed message to standard error and set global
-# exit_cmd.
-func_missing_arg ()
-{
- $opt_debug
-
- func_error "missing argument for $1."
- exit_cmd=exit
-}
-
-
-# func_split_short_opt shortopt
-# Set func_split_short_opt_name and func_split_short_opt_arg shell
-# variables after splitting SHORTOPT after the 2nd character.
-func_split_short_opt ()
-{
- my_sed_short_opt='1s/^\(..\).*$/\1/;q'
- my_sed_short_rest='1s/^..\(.*\)$/\1/;q'
-
- func_split_short_opt_name=`$ECHO "$1" | $SED "$my_sed_short_opt"`
- func_split_short_opt_arg=`$ECHO "$1" | $SED "$my_sed_short_rest"`
-} # func_split_short_opt may be replaced by extended shell implementation
-
-
-# func_split_long_opt longopt
-# Set func_split_long_opt_name and func_split_long_opt_arg shell
-# variables after splitting LONGOPT at the `=' sign.
-func_split_long_opt ()
-{
- my_sed_long_opt='1s/^\(--[^=]*\)=.*/\1/;q'
- my_sed_long_arg='1s/^--[^=]*=//'
-
- func_split_long_opt_name=`$ECHO "$1" | $SED "$my_sed_long_opt"`
- func_split_long_opt_arg=`$ECHO "$1" | $SED "$my_sed_long_arg"`
-} # func_split_long_opt may be replaced by extended shell implementation
-
-exit_cmd=:
-
-
-
-
-
-magic="%%%MAGIC variable%%%"
-magic_exe="%%%MAGIC EXE variable%%%"
-
-# Global variables.
-nonopt=
-preserve_args=
-lo2o="s/\\.lo\$/.${objext}/"
-o2lo="s/\\.${objext}\$/.lo/"
-extracted_archives=
-extracted_serial=0
-
-# If this variable is set in any of the actions, the command in it
-# will be execed at the end. This prevents here-documents from being
-# left over by shells.
-exec_cmd=
-
-# func_append var value
-# Append VALUE to the end of shell variable VAR.
-func_append ()
-{
- eval "${1}=\$${1}\${2}"
-} # func_append may be replaced by extended shell implementation
-
-# func_append_quoted var value
-# Quote VALUE and append to the end of shell variable VAR, separated
-# by a space.
-func_append_quoted ()
-{
- func_quote_for_eval "${2}"
- eval "${1}=\$${1}\\ \$func_quote_for_eval_result"
-} # func_append_quoted may be replaced by extended shell implementation
-
-
-# func_arith arithmetic-term...
-func_arith ()
-{
- func_arith_result=`expr "${@}"`
-} # func_arith may be replaced by extended shell implementation
-
-
-# func_len string
-# STRING may not start with a hyphen.
-func_len ()
-{
- func_len_result=`expr "${1}" : ".*" 2>/dev/null || echo $max_cmd_len`
-} # func_len may be replaced by extended shell implementation
-
-
-# func_lo2o object
-func_lo2o ()
-{
- func_lo2o_result=`$ECHO "${1}" | $SED "$lo2o"`
-} # func_lo2o may be replaced by extended shell implementation
-
-
-# func_xform libobj-or-source
-func_xform ()
-{
- func_xform_result=`$ECHO "${1}" | $SED 's/\.[^.]*$/.lo/'`
-} # func_xform may be replaced by extended shell implementation
-
-
-# func_fatal_configuration arg...
-# Echo program name prefixed message to standard error, followed by
-# a configuration failure hint, and exit.
-func_fatal_configuration ()
-{
- func_error ${1+"$@"}
- func_error "See the $PACKAGE documentation for more information."
- func_fatal_error "Fatal configuration error."
-}
-
-
-# func_config
-# Display the configuration for all the tags in this script.
-func_config ()
-{
- re_begincf='^# ### BEGIN LIBTOOL'
- re_endcf='^# ### END LIBTOOL'
-
- # Default configuration.
- $SED "1,/$re_begincf CONFIG/d;/$re_endcf CONFIG/,\$d" < "$progpath"
-
- # Now print the configurations for the tags.
- for tagname in $taglist; do
- $SED -n "/$re_begincf TAG CONFIG: $tagname\$/,/$re_endcf TAG CONFIG: $tagname\$/p" < "$progpath"
- done
-
- exit $?
-}
-
-# func_features
-# Display the features supported by this script.
-func_features ()
-{
- echo "host: $host"
- if test "$build_libtool_libs" = yes; then
- echo "enable shared libraries"
- else
- echo "disable shared libraries"
- fi
- if test "$build_old_libs" = yes; then
- echo "enable static libraries"
- else
- echo "disable static libraries"
- fi
-
- exit $?
-}
-
-# func_enable_tag tagname
-# Verify that TAGNAME is valid, and either flag an error and exit, or
-# enable the TAGNAME tag. We also add TAGNAME to the global $taglist
-# variable here.
-func_enable_tag ()
-{
- # Global variable:
- tagname="$1"
-
- re_begincf="^# ### BEGIN LIBTOOL TAG CONFIG: $tagname\$"
- re_endcf="^# ### END LIBTOOL TAG CONFIG: $tagname\$"
- sed_extractcf="/$re_begincf/,/$re_endcf/p"
-
- # Validate tagname.
- case $tagname in
- *[!-_A-Za-z0-9,/]*)
- func_fatal_error "invalid tag name: $tagname"
- ;;
- esac
-
- # Don't test for the "default" C tag, as we know it's
- # there but not specially marked.
- case $tagname in
- CC) ;;
- *)
- if $GREP "$re_begincf" "$progpath" >/dev/null 2>&1; then
- taglist="$taglist $tagname"
-
- # Evaluate the configuration. Be careful to quote the path
- # and the sed script, to avoid splitting on whitespace, but
- # also don't use non-portable quotes within backquotes within
- # quotes we have to do it in 2 steps:
- extractedcf=`$SED -n -e "$sed_extractcf" < "$progpath"`
- eval "$extractedcf"
- else
- func_error "ignoring unknown tag $tagname"
- fi
- ;;
- esac
-}
-
-# func_check_version_match
-# Ensure that we are using m4 macros, and libtool script from the same
-# release of libtool.
-func_check_version_match ()
-{
- if test "$package_revision" != "$macro_revision"; then
- if test "$VERSION" != "$macro_version"; then
- if test -z "$macro_version"; then
- cat >&2 <<_LT_EOF
-$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from an older release.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
- else
- cat >&2 <<_LT_EOF
-$progname: Version mismatch error. This is $PACKAGE $VERSION, but the
-$progname: definition of this LT_INIT comes from $PACKAGE $macro_version.
-$progname: You should recreate aclocal.m4 with macros from $PACKAGE $VERSION
-$progname: and run autoconf again.
-_LT_EOF
- fi
- else
- cat >&2 <<_LT_EOF
-$progname: Version mismatch error. This is $PACKAGE $VERSION, revision $package_revision,
-$progname: but the definition of this LT_INIT comes from revision $macro_revision.
-$progname: You should recreate aclocal.m4 with macros from revision $package_revision
-$progname: of $PACKAGE $VERSION and run autoconf again.
-_LT_EOF
- fi
-
- exit $EXIT_MISMATCH
- fi
-}
-
-
-# Shorthand for --mode=foo, only valid as the first argument
-case $1 in
-clean|clea|cle|cl)
- shift; set dummy --mode clean ${1+"$@"}; shift
- ;;
-compile|compil|compi|comp|com|co|c)
- shift; set dummy --mode compile ${1+"$@"}; shift
- ;;
-execute|execut|execu|exec|exe|ex|e)
- shift; set dummy --mode execute ${1+"$@"}; shift
- ;;
-finish|finis|fini|fin|fi|f)
- shift; set dummy --mode finish ${1+"$@"}; shift
- ;;
-install|instal|insta|inst|ins|in|i)
- shift; set dummy --mode install ${1+"$@"}; shift
- ;;
-link|lin|li|l)
- shift; set dummy --mode link ${1+"$@"}; shift
- ;;
-uninstall|uninstal|uninsta|uninst|unins|unin|uni|un|u)
- shift; set dummy --mode uninstall ${1+"$@"}; shift
- ;;
-esac
-
-
-
-# Option defaults:
-opt_debug=:
-opt_dry_run=false
-opt_config=false
-opt_preserve_dup_deps=false
-opt_features=false
-opt_finish=false
-opt_help=false
-opt_help_all=false
-opt_silent=:
-opt_warning=:
-opt_verbose=:
-opt_silent=false
-opt_verbose=false
-
-
-# Parse options once, thoroughly. This comes as soon as possible in the
-# script to make things like `--version' happen as quickly as we can.
-{
- # this just eases exit handling
- while test $# -gt 0; do
- opt="$1"
- shift
- case $opt in
- --debug|-x) opt_debug='set -x'
- func_echo "enabling shell trace mode"
- $opt_debug
- ;;
- --dry-run|--dryrun|-n)
- opt_dry_run=:
- ;;
- --config)
- opt_config=:
-func_config
- ;;
- --dlopen|-dlopen)
- optarg="$1"
- opt_dlopen="${opt_dlopen+$opt_dlopen
-}$optarg"
- shift
- ;;
- --preserve-dup-deps)
- opt_preserve_dup_deps=:
- ;;
- --features)
- opt_features=:
-func_features
- ;;
- --finish)
- opt_finish=:
-set dummy --mode finish ${1+"$@"}; shift
- ;;
- --help)
- opt_help=:
- ;;
- --help-all)
- opt_help_all=:
-opt_help=': help-all'
- ;;
- --mode)
- test $# = 0 && func_missing_arg $opt && break
- optarg="$1"
- opt_mode="$optarg"
-case $optarg in
- # Valid mode arguments:
- clean|compile|execute|finish|install|link|relink|uninstall) ;;
-
- # Catch anything else as an error
- *) func_error "invalid argument for $opt"
- exit_cmd=exit
- break
- ;;
-esac
- shift
- ;;
- --no-silent|--no-quiet)
- opt_silent=false
-func_append preserve_args " $opt"
- ;;
- --no-warning|--no-warn)
- opt_warning=false
-func_append preserve_args " $opt"
- ;;
- --no-verbose)
- opt_verbose=false
-func_append preserve_args " $opt"
- ;;
- --silent|--quiet)
- opt_silent=:
-func_append preserve_args " $opt"
- opt_verbose=false
- ;;
- --verbose|-v)
- opt_verbose=:
-func_append preserve_args " $opt"
-opt_silent=false
- ;;
- --tag)
- test $# = 0 && func_missing_arg $opt && break
- optarg="$1"
- opt_tag="$optarg"
-func_append preserve_args " $opt $optarg"
-func_enable_tag "$optarg"
- shift
- ;;
-
- -\?|-h) func_usage ;;
- --help) func_help ;;
- --version) func_version ;;
-
- # Separate optargs to long options:
- --*=*)
- func_split_long_opt "$opt"
- set dummy "$func_split_long_opt_name" "$func_split_long_opt_arg" ${1+"$@"}
- shift
- ;;
-
- # Separate non-argument short options:
- -\?*|-h*|-n*|-v*)
- func_split_short_opt "$opt"
- set dummy "$func_split_short_opt_name" "-$func_split_short_opt_arg" ${1+"$@"}
- shift
- ;;
-
- --) break ;;
- -*) func_fatal_help "unrecognized option \`$opt'" ;;
- *) set dummy "$opt" ${1+"$@"}; shift; break ;;
- esac
- done
-
- # Validate options:
-
- # save first non-option argument
- if test "$#" -gt 0; then
- nonopt="$opt"
- shift
- fi
-
- # preserve --debug
- test "$opt_debug" = : || func_append preserve_args " --debug"
-
- case $host in
- *cygwin* | *mingw* | *pw32* | *cegcc*)
- # don't eliminate duplications in $postdeps and $predeps
- opt_duplicate_compiler_generated_deps=:
- ;;
- *)
- opt_duplicate_compiler_generated_deps=$opt_preserve_dup_deps
+ *executable*) # but shell scripts are "executable" too...
+ case $win32_fileres in
+ *MS\ Windows\ PE\ Intel*)
+ win32_libid_type="x86 DLL"
;;
- esac
-
- $opt_help || {
- # Sanity checks first:
- func_check_version_match
-
- if test "$build_libtool_libs" != yes && test "$build_old_libs" != yes; then
- func_fatal_configuration "not configured to build any kind of library"
- fi
-
- # Darwin sucks
- eval std_shrext=\"$shrext_cmds\"
-
- # Only execute mode is allowed to have -dlopen flags.
- if test -n "$opt_dlopen" && test "$opt_mode" != execute; then
- func_error "unrecognized option \`-dlopen'"
- $ECHO "$help" 1>&2
- exit $EXIT_FAILURE
- fi
-
- # Change the help message to a mode-specific one.
- generic_help="$help"
- help="Try \`$progname --help --mode=$opt_mode' for more information."
- }
-
-
- # Bail if the options were screwed
- $exit_cmd $EXIT_FAILURE
-}
-
-
-
-
-## ----------- ##
-## Main. ##
-## ----------- ##
-
-# func_lalib_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_lalib_p ()
-{
- test -f "$1" &&
- $SED -e 4q "$1" 2>/dev/null \
- | $GREP "^# Generated by .*$PACKAGE" > /dev/null 2>&1
-}
-
-# func_lalib_unsafe_p file
-# True iff FILE is a libtool `.la' library or `.lo' object file.
-# This function implements the same check as func_lalib_p without
-# resorting to external programs. To this end, it redirects stdin and
-# closes it afterwards, without saving the original file descriptor.
-# As a safety measure, use it only where a negative result would be
-# fatal anyway. Works if `file' does not exist.
-func_lalib_unsafe_p ()
-{
- lalib_p=no
- if test -f "$1" && test -r "$1" && exec 5<&0 <"$1"; then
- for lalib_p_l in 1 2 3 4
- do
- read lalib_p_line
- case "$lalib_p_line" in
- \#\ Generated\ by\ *$PACKAGE* ) lalib_p=yes; break;;
- esac
- done
- exec 0<&5 5<&-
- fi
- test "$lalib_p" = yes
-}
-
-# func_ltwrapper_script_p file
-# True iff FILE is a libtool wrapper script
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_script_p ()
-{
- func_lalib_p "$1"
-}
-
-# func_ltwrapper_executable_p file
-# True iff FILE is a libtool wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_executable_p ()
-{
- func_ltwrapper_exec_suffix=
- case $1 in
- *.exe) ;;
- *) func_ltwrapper_exec_suffix=.exe ;;
- esac
- $GREP "$magic_exe" "$1$func_ltwrapper_exec_suffix" >/dev/null 2>&1
-}
-
-# func_ltwrapper_scriptname file
-# Assumes file is an ltwrapper_executable
-# uses $file to determine the appropriate filename for a
-# temporary ltwrapper_script.
-func_ltwrapper_scriptname ()
-{
- func_dirname_and_basename "$1" "" "."
- func_stripname '' '.exe' "$func_basename_result"
- func_ltwrapper_scriptname_result="$func_dirname_result/$objdir/${func_stripname_result}_ltshwrapper"
-}
-
-# func_ltwrapper_p file
-# True iff FILE is a libtool wrapper script or wrapper executable
-# This function is only a basic sanity check; it will hardly flush out
-# determined imposters.
-func_ltwrapper_p ()
-{
- func_ltwrapper_script_p "$1" || func_ltwrapper_executable_p "$1"
-}
-
-
-# func_execute_cmds commands fail_cmd
-# Execute tilde-delimited COMMANDS.
-# If FAIL_CMD is given, eval that upon failure.
-# FAIL_CMD may read-access the current command in variable CMD!
-func_execute_cmds ()
-{
- $opt_debug
- save_ifs=$IFS; IFS='~'
- for cmd in $1; do
- IFS=$save_ifs
- eval cmd=\"$cmd\"
- func_show_eval "$cmd" "${2-:}"
- done
- IFS=$save_ifs
-}
-
-
-# func_source file
-# Source FILE, adding directory component if necessary.
-# Note that it is not necessary on cygwin/mingw to append a dot to
-# FILE even if both FILE and FILE.exe exist: automatic-append-.exe
-# behavior happens only for exec(3), not for open(2)! Also, sourcing
-# `FILE.' does not work on cygwin managed mounts.
-func_source ()
-{
- $opt_debug
- case $1 in
- */* | *\\*) . "$1" ;;
- *) . "./$1" ;;
esac
-}
-
-
-# func_resolve_sysroot PATH
-# Replace a leading = in PATH with a sysroot. Store the result into
-# func_resolve_sysroot_result
-func_resolve_sysroot ()
-{
- func_resolve_sysroot_result=$1
- case $func_resolve_sysroot_result in
- =*)
- func_stripname '=' '' "$func_resolve_sysroot_result"
- func_resolve_sysroot_result=$lt_sysroot$func_stripname_result
;;
esac
+ $echo $win32_libid_type
}
-# func_replace_sysroot PATH
-# If PATH begins with the sysroot, replace it with = and
-# store the result into func_replace_sysroot_result.
-func_replace_sysroot ()
-{
- case "$lt_sysroot:$1" in
- ?*:"$lt_sysroot"*)
- func_stripname "$lt_sysroot" '' "$1"
- func_replace_sysroot_result="=$func_stripname_result"
- ;;
- *)
- # Including no sysroot.
- func_replace_sysroot_result=$1
- ;;
- esac
-}
# func_infer_tag arg
# Infer tagged configuration to use if any are available and
@@ -1374,36 +244,39 @@ func_replace_sysroot ()
# arg is usually of the form 'gcc ...'
func_infer_tag ()
{
- $opt_debug
if test -n "$available_tags" && test -z "$tagname"; then
CC_quoted=
for arg in $CC; do
- func_append_quoted CC_quoted "$arg"
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
done
- CC_expanded=`func_echo_all $CC`
- CC_quoted_expanded=`func_echo_all $CC_quoted`
case $@ in
# Blanks in the command may have been stripped by the calling shell,
# but not from the CC environment variable when configure was run.
- " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
- " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*) ;;
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*) ;;
# Blanks at the start of $base_compile will cause this to fail
# if we don't check for them as well.
*)
for z in $available_tags; do
- if $GREP "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $z$" < "$progpath" > /dev/null; then
# Evaluate the configuration.
eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$z'$/,/^# ### END LIBTOOL TAG CONFIG: '$z'$/p' < $progpath`"
CC_quoted=
for arg in $CC; do
- # Double-quote args containing other shell metacharacters.
- func_append_quoted CC_quoted "$arg"
- done
- CC_expanded=`func_echo_all $CC`
- CC_quoted_expanded=`func_echo_all $CC_quoted`
+ # Double-quote args containing other shell metacharacters.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ CC_quoted="$CC_quoted $arg"
+ done
case "$@ " in
- " $CC "* | "$CC "* | " $CC_expanded "* | "$CC_expanded "* | \
- " $CC_quoted"* | "$CC_quoted "* | " $CC_quoted_expanded "* | "$CC_quoted_expanded "*)
+ " $CC "* | "$CC "* | " `$echo $CC` "* | "`$echo $CC` "* | " $CC_quoted"* | "$CC_quoted "* | " `$echo $CC_quoted` "* | "`$echo $CC_quoted` "*)
# The compiler in the base compile command matches
# the one in the tagged configuration.
# Assume this is the tagged configuration we want.
@@ -1417,10 +290,11 @@ func_infer_tag ()
# was found and let the user know that the "--tag" command
# line option must be used.
if test -z "$tagname"; then
- func_echo "unable to infer tagged configuration"
- func_fatal_error "specify a tag with \`--tag'"
-# else
-# func_verbose "using $tagname tagged configuration"
+ $echo "$modename: unable to infer tagged configuration"
+ $echo "$modename: specify a tag with \`--tag'" 1>&2
+ exit $EXIT_FAILURE
+# else
+# $echo "$modename: using $tagname tagged configuration"
fi
;;
esac
@@ -1428,528 +302,354 @@ func_infer_tag ()
}
-
-# func_write_libtool_object output_name pic_name nonpic_name
-# Create a libtool object file (analogous to a ".la" file),
-# but don't create it if we're doing a dry run.
-func_write_libtool_object ()
+# func_extract_an_archive dir oldlib
+func_extract_an_archive ()
{
- write_libobj=${1}
- if test "$build_libtool_libs" = yes; then
- write_lobj=\'${2}\'
- else
- write_lobj=none
- fi
+ f_ex_an_ar_dir="$1"; shift
+ f_ex_an_ar_oldlib="$1"
- if test "$build_old_libs" = yes; then
- write_oldobj=\'${3}\'
+ $show "(cd $f_ex_an_ar_dir && $AR x $f_ex_an_ar_oldlib)"
+ $run eval "(cd \$f_ex_an_ar_dir && $AR x \$f_ex_an_ar_oldlib)" || exit $?
+ if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
+ :
else
- write_oldobj=none
+ $echo "$modename: ERROR: object name conflicts: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib" 1>&2
+ exit $EXIT_FAILURE
fi
-
- $opt_dry_run || {
- cat >${write_libobj}T <<EOF
-# $write_libobj - a libtool object file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# Please DO NOT delete this file!
-# It is necessary for linking the library.
-
-# Name of the PIC object.
-pic_object=$write_lobj
-
-# Name of the non-PIC object
-non_pic_object=$write_oldobj
-
-EOF
- $MV "${write_libobj}T" "${write_libobj}"
- }
}
-
-##################################################
-# FILE NAME AND PATH CONVERSION HELPER FUNCTIONS #
-##################################################
-
-# func_convert_core_file_wine_to_w32 ARG
-# Helper function used by file name conversion functions when $build is *nix,
-# and $host is mingw, cygwin, or some other w32 environment. Relies on a
-# correctly configured wine environment available, with the winepath program
-# in $build's $PATH.
-#
-# ARG is the $build file name to be converted to w32 format.
-# Result is available in $func_convert_core_file_wine_to_w32_result, and will
-# be empty on error (or when ARG is empty)
-func_convert_core_file_wine_to_w32 ()
+# func_extract_archives gentop oldlib ...
+func_extract_archives ()
{
- $opt_debug
- func_convert_core_file_wine_to_w32_result="$1"
- if test -n "$1"; then
- # Unfortunately, winepath does not exit with a non-zero error code, so we
- # are forced to check the contents of stdout. On the other hand, if the
- # command is not found, the shell will set an exit code of 127 and print
- # *an error message* to stdout. So we must check for both error code of
- # zero AND non-empty stdout, which explains the odd construction:
- func_convert_core_file_wine_to_w32_tmp=`winepath -w "$1" 2>/dev/null`
- if test "$?" -eq 0 && test -n "${func_convert_core_file_wine_to_w32_tmp}"; then
- func_convert_core_file_wine_to_w32_result=`$ECHO "$func_convert_core_file_wine_to_w32_tmp" |
- $SED -e "$lt_sed_naive_backslashify"`
- else
- func_convert_core_file_wine_to_w32_result=
+ my_gentop="$1"; shift
+ my_oldlibs=${1+"$@"}
+ my_oldobjs=""
+ my_xlib=""
+ my_xabs=""
+ my_xdir=""
+ my_status=""
+
+ $show "${rm}r $my_gentop"
+ $run ${rm}r "$my_gentop"
+ $show "$mkdir $my_gentop"
+ $run $mkdir "$my_gentop"
+ my_status=$?
+ if test "$my_status" -ne 0 && test ! -d "$my_gentop"; then
+ exit $my_status
fi
- fi
-}
-# end: func_convert_core_file_wine_to_w32
+ for my_xlib in $my_oldlibs; do
+ # Extract the objects.
+ case $my_xlib in
+ [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
+ *) my_xabs=`pwd`"/$my_xlib" ;;
+ esac
+ my_xlib=`$echo "X$my_xlib" | $Xsed -e 's%^.*/%%'`
+ my_xlib_u=$my_xlib
+ while :; do
+ case " $extracted_archives " in
+ *" $my_xlib_u "*)
+ extracted_serial=`expr $extracted_serial + 1`
+ my_xlib_u=lt$extracted_serial-$my_xlib ;;
+ *) break ;;
+ esac
+ done
+ extracted_archives="$extracted_archives $my_xlib_u"
+ my_xdir="$my_gentop/$my_xlib_u"
-# func_convert_core_path_wine_to_w32 ARG
-# Helper function used by path conversion functions when $build is *nix, and
-# $host is mingw, cygwin, or some other w32 environment. Relies on a correctly
-# configured wine environment available, with the winepath program in $build's
-# $PATH. Assumes ARG has no leading or trailing path separator characters.
-#
-# ARG is path to be converted from $build format to win32.
-# Result is available in $func_convert_core_path_wine_to_w32_result.
-# Unconvertible file (directory) names in ARG are skipped; if no directory names
-# are convertible, then the result may be empty.
-func_convert_core_path_wine_to_w32 ()
-{
- $opt_debug
- # unfortunately, winepath doesn't convert paths, only file names
- func_convert_core_path_wine_to_w32_result=""
- if test -n "$1"; then
- oldIFS=$IFS
- IFS=:
- for func_convert_core_path_wine_to_w32_f in $1; do
- IFS=$oldIFS
- func_convert_core_file_wine_to_w32 "$func_convert_core_path_wine_to_w32_f"
- if test -n "$func_convert_core_file_wine_to_w32_result" ; then
- if test -z "$func_convert_core_path_wine_to_w32_result"; then
- func_convert_core_path_wine_to_w32_result="$func_convert_core_file_wine_to_w32_result"
- else
- func_append func_convert_core_path_wine_to_w32_result ";$func_convert_core_file_wine_to_w32_result"
- fi
+ $show "${rm}r $my_xdir"
+ $run ${rm}r "$my_xdir"
+ $show "$mkdir $my_xdir"
+ $run $mkdir "$my_xdir"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$my_xdir"; then
+ exit $exit_status
fi
+ case $host in
+ *-darwin*)
+ $show "Extracting $my_xabs"
+ # Do not bother doing anything if just a dry run
+ if test -z "$run"; then
+ darwin_orig_dir=`pwd`
+ cd $my_xdir || exit $?
+ darwin_archive=$my_xabs
+ darwin_curdir=`pwd`
+ darwin_base_archive=`$echo "X$darwin_archive" | $Xsed -e 's%^.*/%%'`
+ darwin_arches=`lipo -info "$darwin_archive" 2>/dev/null | $EGREP Architectures 2>/dev/null`
+ if test -n "$darwin_arches"; then
+ darwin_arches=`echo "$darwin_arches" | $SED -e 's/.*are://'`
+ darwin_arch=
+ $show "$darwin_base_archive has multiple architectures $darwin_arches"
+ for darwin_arch in $darwin_arches ; do
+ mkdir -p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ lipo -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
+ cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
+ func_extract_an_archive "`pwd`" "${darwin_base_archive}"
+ cd "$darwin_curdir"
+ $rm "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
+ done # $darwin_arches
+ ## Okay now we have a bunch of thin objects, gotta fatten them up :)
+ darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print| xargs basename | sort -u | $NL2SP`
+ darwin_file=
+ darwin_files=
+ for darwin_file in $darwin_filelist; do
+ darwin_files=`find unfat-$$ -name $darwin_file -print | $NL2SP`
+ lipo -create -output "$darwin_file" $darwin_files
+ done # $darwin_filelist
+ ${rm}r unfat-$$
+ cd "$darwin_orig_dir"
+ else
+ cd "$darwin_orig_dir"
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ fi # $darwin_arches
+ fi # $run
+ ;;
+ *)
+ func_extract_an_archive "$my_xdir" "$my_xabs"
+ ;;
+ esac
+ my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | $NL2SP`
done
- IFS=$oldIFS
- fi
-}
-# end: func_convert_core_path_wine_to_w32
-
-
-# func_cygpath ARGS...
-# Wrapper around calling the cygpath program via LT_CYGPATH. This is used when
-# when (1) $build is *nix and Cygwin is hosted via a wine environment; or (2)
-# $build is MSYS and $host is Cygwin, or (3) $build is Cygwin. In case (1) or
-# (2), returns the Cygwin file name or path in func_cygpath_result (input
-# file name or path is assumed to be in w32 format, as previously converted
-# from $build's *nix or MSYS format). In case (3), returns the w32 file name
-# or path in func_cygpath_result (input file name or path is assumed to be in
-# Cygwin format). Returns an empty string on error.
-#
-# ARGS are passed to cygpath, with the last one being the file name or path to
-# be converted.
-#
-# Specify the absolute *nix (or w32) name to cygpath in the LT_CYGPATH
-# environment variable; do not put it in $PATH.
-func_cygpath ()
-{
- $opt_debug
- if test -n "$LT_CYGPATH" && test -f "$LT_CYGPATH"; then
- func_cygpath_result=`$LT_CYGPATH "$@" 2>/dev/null`
- if test "$?" -ne 0; then
- # on failure, ensure result is empty
- func_cygpath_result=
- fi
- else
- func_cygpath_result=
- func_error "LT_CYGPATH is empty or specifies non-existent file: \`$LT_CYGPATH'"
- fi
-}
-#end: func_cygpath
-
-
-# func_convert_core_msys_to_w32 ARG
-# Convert file name or path ARG from MSYS format to w32 format. Return
-# result in func_convert_core_msys_to_w32_result.
-func_convert_core_msys_to_w32 ()
-{
- $opt_debug
- # awkward: cmd appends spaces to result
- func_convert_core_msys_to_w32_result=`( cmd //c echo "$1" ) 2>/dev/null |
- $SED -e 's/[ ]*$//' -e "$lt_sed_naive_backslashify"`
+ func_extract_archives_result="$my_oldobjs"
}
-#end: func_convert_core_msys_to_w32
+# End of Shell function definitions
+#####################################
+# Darwin sucks
+eval std_shrext=\"$shrext_cmds\"
-# func_convert_file_check ARG1 ARG2
-# Verify that ARG1 (a file name in $build format) was converted to $host
-# format in ARG2. Otherwise, emit an error message, but continue (resetting
-# func_to_host_file_result to ARG1).
-func_convert_file_check ()
-{
- $opt_debug
- if test -z "$2" && test -n "$1" ; then
- func_error "Could not determine host file name corresponding to"
- func_error " \`$1'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback:
- func_to_host_file_result="$1"
- fi
-}
-# end func_convert_file_check
-
-
-# func_convert_path_check FROM_PATHSEP TO_PATHSEP FROM_PATH TO_PATH
-# Verify that FROM_PATH (a path in $build format) was converted to $host
-# format in TO_PATH. Otherwise, emit an error message, but continue, resetting
-# func_to_host_file_result to a simplistic fallback value (see below).
-func_convert_path_check ()
-{
- $opt_debug
- if test -z "$4" && test -n "$3"; then
- func_error "Could not determine the host path corresponding to"
- func_error " \`$3'"
- func_error "Continuing, but uninstalled executables may not work."
- # Fallback. This is a deliberately simplistic "conversion" and
- # should not be "improved". See libtool.info.
- if test "x$1" != "x$2"; then
- lt_replace_pathsep_chars="s|$1|$2|g"
- func_to_host_path_result=`echo "$3" |
- $SED -e "$lt_replace_pathsep_chars"`
- else
- func_to_host_path_result="$3"
- fi
- fi
-}
-# end func_convert_path_check
+disable_libs=no
+# Parse our command line options once, thoroughly.
+while test "$#" -gt 0
+do
+ arg="$1"
+ shift
-# func_convert_path_front_back_pathsep FRONTPAT BACKPAT REPL ORIG
-# Modifies func_to_host_path_result by prepending REPL if ORIG matches FRONTPAT
-# and appending REPL if ORIG matches BACKPAT.
-func_convert_path_front_back_pathsep ()
-{
- $opt_debug
- case $4 in
- $1 ) func_to_host_path_result="$3$func_to_host_path_result"
- ;;
+ case $arg in
+ -*=*) optarg=`$echo "X$arg" | $Xsed -e 's/[-_a-zA-Z0-9]*=//'` ;;
+ *) optarg= ;;
esac
- case $4 in
- $2 ) func_append func_to_host_path_result "$3"
- ;;
- esac
-}
-# end func_convert_path_front_back_pathsep
-
-
-##################################################
-# $build to $host FILE NAME CONVERSION FUNCTIONS #
-##################################################
-# invoked via `$to_host_file_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# Result will be available in $func_to_host_file_result.
-
-
-# func_to_host_file ARG
-# Converts the file name ARG from $build format to $host format. Return result
-# in func_to_host_file_result.
-func_to_host_file ()
-{
- $opt_debug
- $to_host_file_cmd "$1"
-}
-# end func_to_host_file
+ # If the previous option needs an argument, assign it.
+ if test -n "$prev"; then
+ case $prev in
+ execute_dlfiles)
+ execute_dlfiles="$execute_dlfiles $arg"
+ ;;
+ tag)
+ tagname="$arg"
+ preserve_args="${preserve_args}=$arg"
+
+ # Check whether tagname contains only valid characters
+ case $tagname in
+ *[!-_A-Za-z0-9,/]*)
+ $echo "$progname: invalid tag name: $tagname" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
-# func_to_tool_file ARG LAZY
-# converts the file name ARG from $build format to toolchain format. Return
-# result in func_to_tool_file_result. If the conversion in use is listed
-# in (the comma separated) LAZY, no conversion takes place.
-func_to_tool_file ()
-{
- $opt_debug
- case ,$2, in
- *,"$to_tool_file_cmd",*)
- func_to_tool_file_result=$1
+ case $tagname in
+ CC)
+ # Don't test for the "default" C tag, as we know, it's there, but
+ # not specially marked.
+ ;;
+ *)
+ if grep "^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$" < "$progpath" > /dev/null; then
+ taglist="$taglist $tagname"
+ # Evaluate the configuration.
+ eval "`${SED} -n -e '/^# ### BEGIN LIBTOOL TAG CONFIG: '$tagname'$/,/^# ### END LIBTOOL TAG CONFIG: '$tagname'$/p' < $progpath`"
+ else
+ $echo "$progname: ignoring unknown tag $tagname" 1>&2
+ fi
+ ;;
+ esac
;;
*)
- $to_tool_file_cmd "$1"
- func_to_tool_file_result=$func_to_host_file_result
+ eval "$prev=\$arg"
;;
- esac
-}
-# end func_to_tool_file
-
-
-# func_convert_file_noop ARG
-# Copy ARG to func_to_host_file_result.
-func_convert_file_noop ()
-{
- func_to_host_file_result="$1"
-}
-# end func_convert_file_noop
-
+ esac
-# func_convert_file_msys_to_w32 ARG
-# Convert file name ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper. Returns result in
-# func_to_host_file_result.
-func_convert_file_msys_to_w32 ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- func_convert_core_msys_to_w32 "$1"
- func_to_host_file_result="$func_convert_core_msys_to_w32_result"
+ prev=
+ prevopt=
+ continue
fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_w32
-
-# func_convert_file_cygwin_to_w32 ARG
-# Convert file name ARG from Cygwin to w32 format. Returns result in
-# func_to_host_file_result.
-func_convert_file_cygwin_to_w32 ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- # because $build is cygwin, we call "the" cygpath in $PATH; no need to use
- # LT_CYGPATH in this case.
- func_to_host_file_result=`cygpath -m "$1"`
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_cygwin_to_w32
+ # Have we seen a non-optional argument yet?
+ case $arg in
+ --help)
+ show_help=yes
+ ;;
+ --version)
+ echo "\
+$PROGRAM (GNU $PACKAGE) $VERSION$TIMESTAMP
-# func_convert_file_nix_to_w32 ARG
-# Convert file name ARG from *nix to w32 format. Requires a wine environment
-# and a working winepath. Returns result in func_to_host_file_result.
-func_convert_file_nix_to_w32 ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- func_convert_core_file_wine_to_w32 "$1"
- func_to_host_file_result="$func_convert_core_file_wine_to_w32_result"
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_w32
+Copyright (C) 2007 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."
+ exit $?
+ ;;
+ --config)
+ ${SED} -e '1,/^# ### BEGIN LIBTOOL CONFIG/d' -e '/^# ### END LIBTOOL CONFIG/,$d' $progpath
+ # Now print the configurations for the tags.
+ for tagname in $taglist; do
+ ${SED} -n -e "/^# ### BEGIN LIBTOOL TAG CONFIG: $tagname$/,/^# ### END LIBTOOL TAG CONFIG: $tagname$/p" < "$progpath"
+ done
+ exit $?
+ ;;
-# func_convert_file_msys_to_cygwin ARG
-# Convert file name ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_file_msys_to_cygwin ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- func_convert_core_msys_to_w32 "$1"
- func_cygpath -u "$func_convert_core_msys_to_w32_result"
- func_to_host_file_result="$func_cygpath_result"
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_msys_to_cygwin
+ --debug)
+ $echo "$progname: enabling shell trace mode"
+ set -x
+ preserve_args="$preserve_args $arg"
+ ;;
+ --dry-run | -n)
+ run=:
+ ;;
-# func_convert_file_nix_to_cygwin ARG
-# Convert file name ARG from *nix to Cygwin format. Requires Cygwin installed
-# in a wine environment, working winepath, and LT_CYGPATH set. Returns result
-# in func_to_host_file_result.
-func_convert_file_nix_to_cygwin ()
-{
- $opt_debug
- func_to_host_file_result="$1"
- if test -n "$1"; then
- # convert from *nix to w32, then use cygpath to convert from w32 to cygwin.
- func_convert_core_file_wine_to_w32 "$1"
- func_cygpath -u "$func_convert_core_file_wine_to_w32_result"
- func_to_host_file_result="$func_cygpath_result"
- fi
- func_convert_file_check "$1" "$func_to_host_file_result"
-}
-# end func_convert_file_nix_to_cygwin
+ --features)
+ $echo "host: $host"
+ if test "$build_libtool_libs" = yes; then
+ $echo "enable shared libraries"
+ else
+ $echo "disable shared libraries"
+ fi
+ if test "$build_old_libs" = yes; then
+ $echo "enable static libraries"
+ else
+ $echo "disable static libraries"
+ fi
+ exit $?
+ ;;
+ --finish) mode="finish" ;;
-#############################################
-# $build to $host PATH CONVERSION FUNCTIONS #
-#############################################
-# invoked via `$to_host_path_cmd ARG'
-#
-# In each case, ARG is the path to be converted from $build to $host format.
-# The result will be available in $func_to_host_path_result.
-#
-# Path separators are also converted from $build format to $host format. If
-# ARG begins or ends with a path separator character, it is preserved (but
-# converted to $host format) on output.
-#
-# All path conversion functions are named using the following convention:
-# file name conversion function : func_convert_file_X_to_Y ()
-# path conversion function : func_convert_path_X_to_Y ()
-# where, for any given $build/$host combination the 'X_to_Y' value is the
-# same. If conversion functions are added for new $build/$host combinations,
-# the two new functions must follow this pattern, or func_init_to_host_path_cmd
-# will break.
-
-
-# func_init_to_host_path_cmd
-# Ensures that function "pointer" variable $to_host_path_cmd is set to the
-# appropriate value, based on the value of $to_host_file_cmd.
-to_host_path_cmd=
-func_init_to_host_path_cmd ()
-{
- $opt_debug
- if test -z "$to_host_path_cmd"; then
- func_stripname 'func_convert_file_' '' "$to_host_file_cmd"
- to_host_path_cmd="func_convert_path_${func_stripname_result}"
- fi
-}
+ --mode) prevopt="--mode" prev=mode ;;
+ --mode=*) mode="$optarg" ;;
+ --preserve-dup-deps) duplicate_deps="yes" ;;
-# func_to_host_path ARG
-# Converts the path ARG from $build format to $host format. Return result
-# in func_to_host_path_result.
-func_to_host_path ()
-{
- $opt_debug
- func_init_to_host_path_cmd
- $to_host_path_cmd "$1"
-}
-# end func_to_host_path
+ --quiet | --silent)
+ show=:
+ preserve_args="$preserve_args $arg"
+ ;;
+ --tag)
+ prevopt="--tag"
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
+ --tag=*)
+ set tag "$optarg" ${1+"$@"}
+ shift
+ prev=tag
+ preserve_args="$preserve_args --tag"
+ ;;
-# func_convert_path_noop ARG
-# Copy ARG to func_to_host_path_result.
-func_convert_path_noop ()
-{
- func_to_host_path_result="$1"
-}
-# end func_convert_path_noop
+ -dlopen)
+ prevopt="-dlopen"
+ prev=execute_dlfiles
+ ;;
+ -*)
+ $echo "$modename: unrecognized option \`$arg'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
-# func_convert_path_msys_to_w32 ARG
-# Convert path ARG from (mingw) MSYS to (mingw) w32 format; automatic
-# conversion to w32 is not available inside the cwrapper. Returns result in
-# func_to_host_path_result.
-func_convert_path_msys_to_w32 ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # Remove leading and trailing path separator characters from ARG. MSYS
- # behavior is inconsistent here; cygpath turns them into '.;' and ';.';
- # and winepath ignores them completely.
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
- func_to_host_path_result="$func_convert_core_msys_to_w32_result"
- func_convert_path_check : ";" \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
- fi
-}
-# end func_convert_path_msys_to_w32
+ *)
+ nonopt="$arg"
+ break
+ ;;
+ esac
+done
+if test -n "$prevopt"; then
+ $echo "$modename: option \`$prevopt' requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+fi
-# func_convert_path_cygwin_to_w32 ARG
-# Convert path ARG from Cygwin to w32 format. Returns result in
-# func_to_host_file_result.
-func_convert_path_cygwin_to_w32 ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # See func_convert_path_msys_to_w32:
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_to_host_path_result=`cygpath -m -p "$func_to_host_path_tmp1"`
- func_convert_path_check : ";" \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
- fi
-}
-# end func_convert_path_cygwin_to_w32
+case $disable_libs in
+no)
+ ;;
+shared)
+ build_libtool_libs=no
+ build_old_libs=yes
+ ;;
+static)
+ build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+ ;;
+esac
+# If this variable is set in any of the actions, the command in it
+# will be execed at the end. This prevents here-documents from being
+# left over by shells.
+exec_cmd=
-# func_convert_path_nix_to_w32 ARG
-# Convert path ARG from *nix to w32 format. Requires a wine environment and
-# a working winepath. Returns result in func_to_host_file_result.
-func_convert_path_nix_to_w32 ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # See func_convert_path_msys_to_w32:
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
- func_to_host_path_result="$func_convert_core_path_wine_to_w32_result"
- func_convert_path_check : ";" \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" ";" "$1"
- fi
-}
-# end func_convert_path_nix_to_w32
+if test -z "$show_help"; then
+ # Infer the operation mode.
+ if test -z "$mode"; then
+ $echo "*** Warning: inferring the mode of operation is deprecated." 1>&2
+ $echo "*** Future versions of Libtool will require --mode=MODE be specified." 1>&2
+ case $nonopt in
+ *cc | cc* | *++ | gcc* | *-gcc* | g++* | xlc*)
+ mode=link
+ for arg
+ do
+ case $arg in
+ -c)
+ mode=compile
+ break
+ ;;
+ esac
+ done
+ ;;
+ *db | *dbx | *strace | *truss)
+ mode=execute
+ ;;
+ *install*|cp|mv)
+ mode=install
+ ;;
+ *rm)
+ mode=uninstall
+ ;;
+ *)
+ # If we have no mode, but dlfiles were specified, then do execute mode.
+ test -n "$execute_dlfiles" && mode=execute
-# func_convert_path_msys_to_cygwin ARG
-# Convert path ARG from MSYS to Cygwin format. Requires LT_CYGPATH set.
-# Returns result in func_to_host_file_result.
-func_convert_path_msys_to_cygwin ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # See func_convert_path_msys_to_w32:
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_msys_to_w32 "$func_to_host_path_tmp1"
- func_cygpath -u -p "$func_convert_core_msys_to_w32_result"
- func_to_host_path_result="$func_cygpath_result"
- func_convert_path_check : : \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ # Just use the default operation mode.
+ if test -z "$mode"; then
+ if test -n "$nonopt"; then
+ $echo "$modename: warning: cannot infer operation mode from \`$nonopt'" 1>&2
+ else
+ $echo "$modename: warning: cannot infer operation mode without MODE-ARGS" 1>&2
+ fi
+ fi
+ ;;
+ esac
fi
-}
-# end func_convert_path_msys_to_cygwin
-
-# func_convert_path_nix_to_cygwin ARG
-# Convert path ARG from *nix to Cygwin format. Requires Cygwin installed in a
-# a wine environment, working winepath, and LT_CYGPATH set. Returns result in
-# func_to_host_file_result.
-func_convert_path_nix_to_cygwin ()
-{
- $opt_debug
- func_to_host_path_result="$1"
- if test -n "$1"; then
- # Remove leading and trailing path separator characters from
- # ARG. msys behavior is inconsistent here, cygpath turns them
- # into '.;' and ';.', and winepath ignores them completely.
- func_stripname : : "$1"
- func_to_host_path_tmp1=$func_stripname_result
- func_convert_core_path_wine_to_w32 "$func_to_host_path_tmp1"
- func_cygpath -u -p "$func_convert_core_path_wine_to_w32_result"
- func_to_host_path_result="$func_cygpath_result"
- func_convert_path_check : : \
- "$func_to_host_path_tmp1" "$func_to_host_path_result"
- func_convert_path_front_back_pathsep ":*" "*:" : "$1"
+ # Only execute mode is allowed to have -dlopen flags.
+ if test -n "$execute_dlfiles" && test "$mode" != execute; then
+ $echo "$modename: unrecognized option \`-dlopen'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
fi
-}
-# end func_convert_path_nix_to_cygwin
+ # Change the help message to a mode-specific one.
+ generic_help="$help"
+ help="Try \`$modename --help --mode=$mode' for more information."
-# func_mode_compile arg...
-func_mode_compile ()
-{
- $opt_debug
+ # These modes are in order of execution frequency so that they run quickly.
+ case $mode in
+ # libtool compile mode
+ compile)
+ modename="$modename: compile"
# Get the compilation command and the source file.
base_compile=
srcfile="$nonopt" # always keep a non-empty value in "srcfile"
@@ -1958,7 +658,6 @@ func_mode_compile ()
arg_mode=normal
libobj=
later=
- pie_flag=
for arg
do
@@ -1979,19 +678,16 @@ func_mode_compile ()
# Accept any command-line options.
case $arg in
-o)
- test -n "$libobj" && \
- func_fatal_error "you cannot specify \`-o' more than once"
+ if test -n "$libobj" ; then
+ $echo "$modename: you cannot specify \`-o' more than once" 1>&2
+ exit $EXIT_FAILURE
+ fi
arg_mode=target
continue
;;
- -pie | -fpie | -fPIE)
- func_append pie_flag " $arg"
- continue
- ;;
-
- -shared | -static | -prefer-pic | -prefer-non-pic)
- func_append later " $arg"
+ -static | -prefer-pic | -prefer-non-pic)
+ later="$later $arg"
continue
;;
@@ -2006,24 +702,31 @@ func_mode_compile ()
;; # replaced later. I would guess that would be a bug.
-Wc,*)
- func_stripname '-Wc,' '' "$arg"
- args=$func_stripname_result
+ args=`$echo "X$arg" | $Xsed -e "s/^-Wc,//"`
lastarg=
save_ifs="$IFS"; IFS=','
- for arg in $args; do
+ for arg in $args; do
IFS="$save_ifs"
- func_append_quoted lastarg "$arg"
+
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, so we specify it separately.
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ lastarg="$lastarg $arg"
done
IFS="$save_ifs"
- func_stripname ' ' '' "$lastarg"
- lastarg=$func_stripname_result
+ lastarg=`$echo "X$lastarg" | $Xsed -e "s/^ //"`
# Add the arguments to base_compile.
- func_append base_compile " $lastarg"
+ base_compile="$base_compile $lastarg"
continue
;;
- *)
+ * )
# Accept the current argument as the source file.
# The previous "srcfile" becomes the current argument.
#
@@ -2035,41 +738,65 @@ func_mode_compile ()
esac # case $arg_mode
# Aesthetically quote the previous argument.
- func_append_quoted base_compile "$lastarg"
+ lastarg=`$echo "X$lastarg" | $Xsed -e "$sed_quote_subst"`
+
+ case $lastarg in
+ # Double-quote args containing other shell metacharacters.
+ # Many Bourne shells cannot handle close brackets correctly
+ # in scan sets, and some SunOS ksh mistreat backslash-escaping
+ # in scan sets (worked around with variable expansion),
+ # and furthermore cannot handle '|' '&' '(' ')' in scan sets
+ # at all, so we specify them separately.
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ lastarg="\"$lastarg\""
+ ;;
+ esac
+
+ base_compile="$base_compile $lastarg"
done # for arg
case $arg_mode in
arg)
- func_fatal_error "you must specify an argument for -Xcompile"
+ $echo "$modename: you must specify an argument for -Xcompile"
+ exit $EXIT_FAILURE
;;
target)
- func_fatal_error "you must specify a target with \`-o'"
+ $echo "$modename: you must specify a target with \`-o'" 1>&2
+ exit $EXIT_FAILURE
;;
*)
# Get the name of the library object.
- test -z "$libobj" && {
- func_basename "$srcfile"
- libobj="$func_basename_result"
- }
+ [ -z "$libobj" ] && libobj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%'`
;;
esac
# Recognize several different file suffixes.
# If the user specifies -o file.o, it is replaced with file.lo
+ xform='[cCFSifmso]'
case $libobj in
- *.[cCFSifmso] | \
- *.ada | *.adb | *.ads | *.asm | \
- *.c++ | *.cc | *.ii | *.class | *.cpp | *.cxx | \
- *.[fF][09]? | *.for | *.java | *.go | *.obj | *.sx | *.cu | *.cup)
- func_xform "$libobj"
- libobj=$func_xform_result
- ;;
+ *.ada) xform=ada ;;
+ *.adb) xform=adb ;;
+ *.ads) xform=ads ;;
+ *.asm) xform=asm ;;
+ *.c++) xform=c++ ;;
+ *.cc) xform=cc ;;
+ *.ii) xform=ii ;;
+ *.class) xform=class ;;
+ *.cpp) xform=cpp ;;
+ *.cxx) xform=cxx ;;
+ *.[fF][09]?) xform=[fF][09]. ;;
+ *.for) xform=for ;;
+ *.java) xform=java ;;
+ *.obj) xform=obj ;;
esac
+ libobj=`$echo "X$libobj" | $Xsed -e "s/\.$xform$/.lo/"`
+
case $libobj in
- *.lo) func_lo2o "$libobj"; obj=$func_lo2o_result ;;
+ *.lo) obj=`$echo "X$libobj" | $Xsed -e "$lo2o"` ;;
*)
- func_fatal_error "cannot determine name of library object from \`$libobj'"
+ $echo "$modename: cannot determine name of library object from \`$libobj'" 1>&2
+ exit $EXIT_FAILURE
;;
esac
@@ -2077,15 +804,7 @@ func_mode_compile ()
for arg in $later; do
case $arg in
- -shared)
- test "$build_libtool_libs" != yes && \
- func_fatal_configuration "can not build a shared library"
- build_old_libs=no
- continue
- ;;
-
-static)
- build_libtool_libs=no
build_old_libs=yes
continue
;;
@@ -2102,17 +821,28 @@ func_mode_compile ()
esac
done
- func_quote_for_eval "$libobj"
- test "X$libobj" != "X$func_quote_for_eval_result" \
- && $ECHO "X$libobj" | $GREP '[]~#^*{};<>?"'"'"' &()|`$[]' \
- && func_warning "libobj name \`$libobj' may not contain shell special characters."
- func_dirname_and_basename "$obj" "/" ""
- objname="$func_basename_result"
- xdir="$func_dirname_result"
+ qlibobj=`$echo "X$libobj" | $Xsed -e "$sed_quote_subst"`
+ case $qlibobj in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qlibobj="\"$qlibobj\"" ;;
+ esac
+ test "X$libobj" != "X$qlibobj" \
+ && $echo "X$libobj" | grep '[]~#^*{};<>?"'"'"' &()|`$[]' \
+ && $echo "$modename: libobj name \`$libobj' may not contain shell special characters."
+ objname=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
+ xdir=`$echo "X$obj" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$obj"; then
+ xdir=
+ else
+ xdir=$xdir/
+ fi
lobj=${xdir}$objdir/$objname
- test -z "$base_compile" && \
- func_fatal_help "you must specify a compilation command"
+ if test -z "$base_compile"; then
+ $echo "$modename: you must specify a compilation command" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
# Delete any leftover library objects.
if test "$build_old_libs" = yes; then
@@ -2121,9 +851,12 @@ func_mode_compile ()
removelist="$lobj $libobj ${libobj}T"
fi
+ $run $rm $removelist
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
+
# On Cygwin there's no "real" PIC flag so we must build both object types
case $host_os in
- cygwin* | mingw* | pw32* | os2* | cegcc*)
+ cygwin* | mingw* | pw32* | os2*)
pic_mode=default
;;
esac
@@ -2135,8 +868,10 @@ func_mode_compile ()
# Calculate the filename of the output object if compiler does
# not support -o with -c
if test "$compiler_c_o" = no; then
- output_obj=`$ECHO "$srcfile" | $SED 's%^.*/%%; s%\.[^.]*$%%'`.${objext}
+ output_obj=`$echo "X$srcfile" | $Xsed -e 's%^.*/%%' -e 's%\.[^.]*$%%'`.${objext}
lockfile="$output_obj.lock"
+ removelist="$removelist $output_obj $lockfile"
+ trap "$run $rm $removelist; exit $EXIT_FAILURE" 1 2 15
else
output_obj=
need_locks=no
@@ -2146,13 +881,13 @@ func_mode_compile ()
# Lock this critical section if it is needed
# We use this script file to make the link, it avoids creating a new file
if test "$need_locks" = yes; then
- until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
- func_echo "Waiting for $lockfile to be removed"
+ until $run ln "$progpath" "$lockfile" 2>/dev/null; do
+ $show "Waiting for $lockfile to be removed"
sleep 2
done
elif test "$need_locks" = warn; then
if test -f "$lockfile"; then
- $ECHO "\
+ $echo "\
*** ERROR, $lockfile exists and contains:
`cat $lockfile 2>/dev/null`
@@ -2163,21 +898,34 @@ repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
- $opt_dry_run || $RM $removelist
+ $run $rm $removelist
exit $EXIT_FAILURE
fi
- func_append removelist " $output_obj"
- $ECHO "$srcfile" > "$lockfile"
+ $echo "$srcfile" > "$lockfile"
fi
- $opt_dry_run || $RM $removelist
- func_append removelist " $lockfile"
- trap '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE' 1 2 15
+ if test -n "$fix_srcfile_path"; then
+ eval srcfile=\"$fix_srcfile_path\"
+ fi
+ qsrcfile=`$echo "X$srcfile" | $Xsed -e "$sed_quote_subst"`
+ case $qsrcfile in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qsrcfile="\"$qsrcfile\"" ;;
+ esac
- func_to_tool_file "$srcfile" func_convert_file_msys_to_w32
- srcfile=$func_to_tool_file_result
- func_quote_for_eval "$srcfile"
- qsrcfile=$func_quote_for_eval_result
+ $run $rm "$libobj" "${libobj}T"
+
+ # Create a libtool object file (analogous to a ".la" file),
+ # but don't create it if we're doing a dry run.
+ test -z "$run" && cat > ${libobj}T <<EOF
+# $libobj - a libtool object file
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# Please DO NOT delete this file!
+# It is necessary for linking the library.
+
+# Name of the PIC object.
+EOF
# Only build a PIC object if we are building libtool libraries.
if test "$build_libtool_libs" = yes; then
@@ -2191,19 +939,32 @@ compiler."
command="$base_compile $qsrcfile"
fi
- func_mkdir_p "$xdir$objdir"
+ if test ! -d "${xdir}$objdir"; then
+ $show "$mkdir ${xdir}$objdir"
+ $run $mkdir ${xdir}$objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "${xdir}$objdir"; then
+ exit $exit_status
+ fi
+ fi
if test -z "$output_obj"; then
# Place PIC objects in $objdir
- func_append command " -o $lobj"
+ command="$command -o $lobj"
fi
- func_show_eval_locale "$command" \
- 'test -n "$output_obj" && $RM $removelist; exit $EXIT_FAILURE'
+ $run $rm "$lobj" "$output_obj"
+
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ test -n "$output_obj" && $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $ECHO "\
+ $echo "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
@@ -2217,42 +978,65 @@ repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
- $opt_dry_run || $RM $removelist
+ $run $rm $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed, then go on to compile the next one
if test -n "$output_obj" && test "X$output_obj" != "X$lobj"; then
- func_show_eval '$MV "$output_obj" "$lobj"' \
- 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
+ $show "$mv $output_obj $lobj"
+ if $run $mv $output_obj $lobj; then :
+ else
+ error=$?
+ $run $rm $removelist
+ exit $error
+ fi
fi
+ # Append the name of the PIC object to the libtool object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object='$objdir/$objname'
+
+EOF
+
# Allow error messages only from the first compilation.
if test "$suppress_opt" = yes; then
- suppress_output=' >/dev/null 2>&1'
+ suppress_output=' >/dev/null 2>&1'
fi
+ else
+ # No PIC object so indicate it doesn't exist in the libtool
+ # object file.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+pic_object=none
+
+EOF
fi
# Only build a position-dependent object if we build old libraries.
if test "$build_old_libs" = yes; then
if test "$pic_mode" != yes; then
# Don't build PIC code
- command="$base_compile $qsrcfile$pie_flag"
+ command="$base_compile $qsrcfile"
else
command="$base_compile $qsrcfile $pic_flag"
fi
if test "$compiler_c_o" = yes; then
- func_append command " -o $obj"
+ command="$command -o $obj"
fi
# Suppress compiler output if we already did a PIC compilation.
- func_append command "$suppress_output"
- func_show_eval_locale "$command" \
- '$opt_dry_run || $RM $removelist; exit $EXIT_FAILURE'
+ command="$command$suppress_output"
+ $run $rm "$obj" "$output_obj"
+ $show "$command"
+ if $run eval "$command"; then :
+ else
+ $run $rm $removelist
+ exit $EXIT_FAILURE
+ fi
if test "$need_locks" = warn &&
test "X`cat $lockfile 2>/dev/null`" != "X$srcfile"; then
- $ECHO "\
+ $echo "\
*** ERROR, $lockfile contains:
`cat $lockfile 2>/dev/null`
@@ -2266,2835 +1050,53 @@ repeat this compilation, it may succeed, by chance, but you had better
avoid parallel builds (make -j) in this platform, or get a better
compiler."
- $opt_dry_run || $RM $removelist
+ $run $rm $removelist
exit $EXIT_FAILURE
fi
# Just move the object if needed
if test -n "$output_obj" && test "X$output_obj" != "X$obj"; then
- func_show_eval '$MV "$output_obj" "$obj"' \
- 'error=$?; $opt_dry_run || $RM $removelist; exit $error'
- fi
- fi
-
- $opt_dry_run || {
- func_write_libtool_object "$libobj" "$objdir/$objname" "$objname"
-
- # Unlock the critical section if it was locked
- if test "$need_locks" != no; then
- removelist=$lockfile
- $RM "$lockfile"
- fi
- }
-
- exit $EXIT_SUCCESS
-}
-
-$opt_help || {
- test "$opt_mode" = compile && func_mode_compile ${1+"$@"}
-}
-
-func_mode_help ()
-{
- # We need to display help for each of the modes.
- case $opt_mode in
- "")
- # Generic help is extracted from the usage comments
- # at the start of this file.
- func_help
- ;;
-
- clean)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
-
-Remove files from the build directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, object or program, all the files associated
-with it are deleted. Otherwise, only FILE itself is deleted using RM."
- ;;
-
- compile)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
-
-Compile a source file into a libtool library object.
-
-This mode accepts the following additional options:
-
- -o OUTPUT-FILE set the output file name to OUTPUT-FILE
- -no-suppress do not suppress compiler output for multiple passes
- -prefer-pic try to build PIC objects only
- -prefer-non-pic try to build non-PIC objects only
- -shared do not build a \`.o' file suitable for static linking
- -static only build a \`.o' file suitable for static linking
- -Wc,FLAG pass FLAG directly to the compiler
-
-COMPILE-COMMAND is a command to be used in creating a \`standard' object file
-from the given SOURCEFILE.
-
-The output file name is determined by removing the directory component from
-SOURCEFILE, then substituting the C source code suffix \`.c' with the
-library object suffix, \`.lo'."
- ;;
-
- execute)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=execute COMMAND [ARGS]...
-
-Automatically set library path, then run a program.
-
-This mode accepts the following additional options:
-
- -dlopen FILE add the directory containing FILE to the library path
-
-This mode sets the library path environment variable according to \`-dlopen'
-flags.
-
-If any of the ARGS are libtool executable wrappers, then they are translated
-into their corresponding uninstalled binary, and any of their required library
-directories are added to the library path.
-
-Then, COMMAND is executed, with ARGS as arguments."
- ;;
-
- finish)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=finish [LIBDIR]...
-
-Complete the installation of libtool libraries.
-
-Each LIBDIR is a directory that contains libtool libraries.
-
-The commands that this mode executes may require superuser privileges. Use
-the \`--dry-run' option if you just want to see what would be executed."
- ;;
-
- install)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=install INSTALL-COMMAND...
-
-Install executables or libraries.
-
-INSTALL-COMMAND is the installation command. The first component should be
-either the \`install' or \`cp' program.
-
-The following components of INSTALL-COMMAND are treated specially:
-
- -inst-prefix-dir PREFIX-DIR Use PREFIX-DIR as a staging area for installation
-
-The rest of the components are interpreted as arguments to that command (only
-BSD-compatible install options are recognized)."
- ;;
-
- link)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=link LINK-COMMAND...
-
-Link object files or libraries together to form another library, or to
-create an executable program.
-
-LINK-COMMAND is a command using the C compiler that you would use to create
-a program from several object files.
-
-The following components of LINK-COMMAND are treated specially:
-
- -all-static do not do any dynamic linking at all
- -avoid-version do not add a version suffix if possible
- -bindir BINDIR specify path to binaries directory (for systems where
- libraries must be found in the PATH setting at runtime)
- -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
- -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
- -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
- -export-symbols SYMFILE
- try to export only the symbols listed in SYMFILE
- -export-symbols-regex REGEX
- try to export only the symbols matching REGEX
- -LLIBDIR search LIBDIR for required installed libraries
- -lNAME OUTPUT-FILE requires the installed library libNAME
- -module build a library that can dlopened
- -no-fast-install disable the fast-install mode
- -no-install link a not-installable executable
- -no-undefined declare that a library does not refer to external symbols
- -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
- -objectlist FILE Use a list of object files found in FILE to specify objects
- -precious-files-regex REGEX
- don't remove output files matching REGEX
- -release RELEASE specify package release information
- -rpath LIBDIR the created library will eventually be installed in LIBDIR
- -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
- -shared only do dynamic linking of libtool libraries
- -shrext SUFFIX override the standard shared library file extension
- -static do not do any dynamic linking of uninstalled libtool libraries
- -static-libtool-libs
- do not do any dynamic linking of libtool libraries
- -version-info CURRENT[:REVISION[:AGE]]
- specify library version info [each variable defaults to 0]
- -weak LIBNAME declare that the target provides the LIBNAME interface
- -Wc,FLAG
- -Xcompiler FLAG pass linker-specific FLAG directly to the compiler
- -Wl,FLAG
- -Xlinker FLAG pass linker-specific FLAG directly to the linker
- -XCClinker FLAG pass link-specific FLAG to the compiler driver (CC)
-
-All other options (arguments beginning with \`-') are ignored.
-
-Every other argument is treated as a filename. Files ending in \`.la' are
-treated as uninstalled libtool libraries, other files are standard or library
-object files.
-
-If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
-only library objects (\`.lo' files) may be specified, and \`-rpath' is
-required, except when creating a convenience library.
-
-If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
-using \`ar' and \`ranlib', or on Windows using \`lib'.
-
-If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
-is created, otherwise an executable program is created."
- ;;
-
- uninstall)
- $ECHO \
-"Usage: $progname [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
-
-Remove libraries from an installation directory.
-
-RM is the name of the program to use to delete files associated with each FILE
-(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
-to RM.
-
-If FILE is a libtool library, all the files associated with it are deleted.
-Otherwise, only FILE itself is deleted using RM."
- ;;
-
- *)
- func_fatal_help "invalid operation mode \`$opt_mode'"
- ;;
- esac
-
- echo
- $ECHO "Try \`$progname --help' for more information about other modes."
-}
-
-# Now that we've collected a possible --mode arg, show help if necessary
-if $opt_help; then
- if test "$opt_help" = :; then
- func_mode_help
- else
- {
- func_help noexit
- for opt_mode in compile link execute install finish uninstall clean; do
- func_mode_help
- done
- } | sed -n '1p; 2,$s/^Usage:/ or: /p'
- {
- func_help noexit
- for opt_mode in compile link execute install finish uninstall clean; do
- echo
- func_mode_help
- done
- } |
- sed '1d
- /^When reporting/,/^Report/{
- H
- d
- }
- $x
- /information about other modes/d
- /more detailed .*MODE/d
- s/^Usage:.*--mode=\([^ ]*\) .*/Description of \1 mode:/'
- fi
- exit $?
-fi
-
-
-# func_mode_execute arg...
-func_mode_execute ()
-{
- $opt_debug
- # The first argument is the command name.
- cmd="$nonopt"
- test -z "$cmd" && \
- func_fatal_help "you must specify a COMMAND"
-
- # Handle -dlopen flags immediately.
- for file in $opt_dlopen; do
- test -f "$file" \
- || func_fatal_help "\`$file' is not a file"
-
- dir=
- case $file in
- *.la)
- func_resolve_sysroot "$file"
- file=$func_resolve_sysroot_result
-
- # Check to see that this really is a libtool archive.
- func_lalib_unsafe_p "$file" \
- || func_fatal_help "\`$lib' is not a valid libtool archive"
-
- # Read the libtool library.
- dlname=
- library_names=
- func_source "$file"
-
- # Skip this library if it cannot be dlopened.
- if test -z "$dlname"; then
- # Warn if it was a shared library.
- test -n "$library_names" && \
- func_warning "\`$file' was not linked with \`-export-dynamic'"
- continue
- fi
-
- func_dirname "$file" "" "."
- dir="$func_dirname_result"
-
- if test -f "$dir/$objdir/$dlname"; then
- func_append dir "/$objdir"
+ $show "$mv $output_obj $obj"
+ if $run $mv $output_obj $obj; then :
else
- if test ! -f "$dir/$dlname"; then
- func_fatal_error "cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'"
- fi
+ error=$?
+ $run $rm $removelist
+ exit $error
fi
- ;;
-
- *.lo)
- # Just add the directory containing the .lo file.
- func_dirname "$file" "" "."
- dir="$func_dirname_result"
- ;;
-
- *)
- func_warning "\`-dlopen' is ignored for non-libtool libraries and objects"
- continue
- ;;
- esac
-
- # Get the absolute pathname.
- absdir=`cd "$dir" && pwd`
- test -n "$absdir" && dir="$absdir"
-
- # Now add the directory to shlibpath_var.
- if eval "test -z \"\$$shlibpath_var\""; then
- eval "$shlibpath_var=\"\$dir\""
- else
- eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
- fi
- done
-
- # This variable tells wrapper scripts just to set shlibpath_var
- # rather than running their programs.
- libtool_execute_magic="$magic"
-
- # Check if any of the arguments is a wrapper script.
- args=
- for file
- do
- case $file in
- -* | *.la | *.lo ) ;;
- *)
- # Do a test to see if this is really a libtool program.
- if func_ltwrapper_script_p "$file"; then
- func_source "$file"
- # Transform arg to wrapped name.
- file="$progdir/$program"
- elif func_ltwrapper_executable_p "$file"; then
- func_ltwrapper_scriptname "$file"
- func_source "$func_ltwrapper_scriptname_result"
- # Transform arg to wrapped name.
- file="$progdir/$program"
- fi
- ;;
- esac
- # Quote arguments (to preserve shell metacharacters).
- func_append_quoted args "$file"
- done
-
- if test "X$opt_dry_run" = Xfalse; then
- if test -n "$shlibpath_var"; then
- # Export the shlibpath_var.
- eval "export $shlibpath_var"
- fi
-
- # Restore saved environment variables
- for lt_var in LANG LANGUAGE LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
- do
- eval "if test \"\${save_$lt_var+set}\" = set; then
- $lt_var=\$save_$lt_var; export $lt_var
- else
- $lt_unset $lt_var
- fi"
- done
-
- # Now prepare to actually exec the command.
- exec_cmd="\$cmd$args"
- else
- # Display what would be done.
- if test -n "$shlibpath_var"; then
- eval "\$ECHO \"\$shlibpath_var=\$$shlibpath_var\""
- echo "export $shlibpath_var"
- fi
- $ECHO "$cmd$args"
- exit $EXIT_SUCCESS
- fi
-}
-
-test "$opt_mode" = execute && func_mode_execute ${1+"$@"}
-
-
-# func_mode_finish arg...
-func_mode_finish ()
-{
- $opt_debug
- libs=
- libdirs=
- admincmds=
-
- for opt in "$nonopt" ${1+"$@"}
- do
- if test -d "$opt"; then
- func_append libdirs " $opt"
-
- elif test -f "$opt"; then
- if func_lalib_unsafe_p "$opt"; then
- func_append libs " $opt"
- else
- func_warning "\`$opt' is not a valid libtool archive"
- fi
-
- else
- func_fatal_error "invalid argument \`$opt'"
- fi
- done
-
- if test -n "$libs"; then
- if test -n "$lt_sysroot"; then
- sysroot_regex=`$ECHO "$lt_sysroot" | $SED "$sed_make_literal_regex"`
- sysroot_cmd="s/\([ ']\)$sysroot_regex/\1/g;"
- else
- sysroot_cmd=
- fi
-
- # Remove sysroot references
- if $opt_dry_run; then
- for lib in $libs; do
- echo "removing references to $lt_sysroot and \`=' prefixes from $lib"
- done
- else
- tmpdir=`func_mktempdir`
- for lib in $libs; do
- sed -e "${sysroot_cmd} s/\([ ']-[LR]\)=/\1/g; s/\([ ']\)=/\1/g" $lib \
- > $tmpdir/tmp-la
- mv -f $tmpdir/tmp-la $lib
- done
- ${RM}r "$tmpdir"
- fi
- fi
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- for libdir in $libdirs; do
- if test -n "$finish_cmds"; then
- # Do each command in the finish commands.
- func_execute_cmds "$finish_cmds" 'admincmds="$admincmds
-'"$cmd"'"'
- fi
- if test -n "$finish_eval"; then
- # Do the single finish_eval.
- eval cmds=\"$finish_eval\"
- $opt_dry_run || eval "$cmds" || func_append admincmds "
- $cmds"
- fi
- done
- fi
-
- # Exit here if they wanted silent mode.
- $opt_silent && exit $EXIT_SUCCESS
-
- if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
- echo "----------------------------------------------------------------------"
- echo "Libraries have been installed in:"
- for libdir in $libdirs; do
- $ECHO " $libdir"
- done
- echo
- echo "If you ever happen to want to link against installed libraries"
- echo "in a given directory, LIBDIR, you must either use libtool, and"
- echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
- echo "flag during linking and do at least one of the following:"
- if test -n "$shlibpath_var"; then
- echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
- echo " during execution"
- fi
- if test -n "$runpath_var"; then
- echo " - add LIBDIR to the \`$runpath_var' environment variable"
- echo " during linking"
- fi
- if test -n "$hardcode_libdir_flag_spec"; then
- libdir=LIBDIR
- eval flag=\"$hardcode_libdir_flag_spec\"
-
- $ECHO " - use the \`$flag' linker flag"
- fi
- if test -n "$admincmds"; then
- $ECHO " - have your system administrator run these commands:$admincmds"
- fi
- if test -f /etc/ld.so.conf; then
- echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
- fi
- echo
-
- echo "See any operating system documentation about shared libraries for"
- case $host in
- solaris2.[6789]|solaris2.1[0-9])
- echo "more information, such as the ld(1), crle(1) and ld.so(8) manual"
- echo "pages."
- ;;
- *)
- echo "more information, such as the ld(1) and ld.so(8) manual pages."
- ;;
- esac
- echo "----------------------------------------------------------------------"
- fi
- exit $EXIT_SUCCESS
-}
-
-test "$opt_mode" = finish && func_mode_finish ${1+"$@"}
-
-
-# func_mode_install arg...
-func_mode_install ()
-{
- $opt_debug
- # There may be an optional sh(1) argument at the beginning of
- # install_prog (especially on Windows NT).
- if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
- # Allow the use of GNU shtool's install command.
- case $nonopt in *shtool*) :;; *) false;; esac; then
- # Aesthetically quote it.
- func_quote_for_eval "$nonopt"
- install_prog="$func_quote_for_eval_result "
- arg=$1
- shift
- else
- install_prog=
- arg=$nonopt
- fi
-
- # The real first argument should be the name of the installation program.
- # Aesthetically quote it.
- func_quote_for_eval "$arg"
- func_append install_prog "$func_quote_for_eval_result"
- install_shared_prog=$install_prog
- case " $install_prog " in
- *[\\\ /]cp\ *) install_cp=: ;;
- *) install_cp=false ;;
- esac
-
- # We need to accept at least all the BSD install flags.
- dest=
- files=
- opts=
- prev=
- install_type=
- isdir=no
- stripme=
- no_mode=:
- for arg
- do
- arg2=
- if test -n "$dest"; then
- func_append files " $dest"
- dest=$arg
- continue
- fi
-
- case $arg in
- -d) isdir=yes ;;
- -f)
- if $install_cp; then :; else
- prev=$arg
- fi
- ;;
- -g | -m | -o)
- prev=$arg
- ;;
- -s)
- stripme=" -s"
- continue
- ;;
- -*)
- ;;
- *)
- # If the previous option needed an argument, then skip it.
- if test -n "$prev"; then
- if test "x$prev" = x-m && test -n "$install_override_mode"; then
- arg2=$install_override_mode
- no_mode=false
- fi
- prev=
- else
- dest=$arg
- continue
- fi
- ;;
- esac
-
- # Aesthetically quote the argument.
- func_quote_for_eval "$arg"
- func_append install_prog " $func_quote_for_eval_result"
- if test -n "$arg2"; then
- func_quote_for_eval "$arg2"
- fi
- func_append install_shared_prog " $func_quote_for_eval_result"
- done
-
- test -z "$install_prog" && \
- func_fatal_help "you must specify an install program"
-
- test -n "$prev" && \
- func_fatal_help "the \`$prev' option requires an argument"
-
- if test -n "$install_override_mode" && $no_mode; then
- if $install_cp; then :; else
- func_quote_for_eval "$install_override_mode"
- func_append install_shared_prog " -m $func_quote_for_eval_result"
- fi
- fi
-
- if test -z "$files"; then
- if test -z "$dest"; then
- func_fatal_help "no file or destination specified"
- else
- func_fatal_help "you must specify a destination"
- fi
- fi
-
- # Strip any trailing slash from the destination.
- func_stripname '' '/' "$dest"
- dest=$func_stripname_result
-
- # Check to see that the destination is a directory.
- test -d "$dest" && isdir=yes
- if test "$isdir" = yes; then
- destdir="$dest"
- destname=
- else
- func_dirname_and_basename "$dest" "" "."
- destdir="$func_dirname_result"
- destname="$func_basename_result"
-
- # Not a directory, so check to see that there is only one file specified.
- set dummy $files; shift
- test "$#" -gt 1 && \
- func_fatal_help "\`$dest' is not a directory"
- fi
- case $destdir in
- [\\/]* | [A-Za-z]:[\\/]*) ;;
- *)
- for file in $files; do
- case $file in
- *.lo) ;;
- *)
- func_fatal_help "\`$destdir' must be an absolute directory name"
- ;;
- esac
- done
- ;;
- esac
-
- # This variable tells wrapper scripts just to set variables rather
- # than running their programs.
- libtool_install_magic="$magic"
-
- staticlibs=
- future_libdirs=
- current_libdirs=
- for file in $files; do
-
- # Do each installation.
- case $file in
- *.$libext)
- # Do the static libraries later.
- func_append staticlibs " $file"
- ;;
-
- *.la)
- func_resolve_sysroot "$file"
- file=$func_resolve_sysroot_result
-
- # Check to see that this really is a libtool archive.
- func_lalib_unsafe_p "$file" \
- || func_fatal_help "\`$file' is not a valid libtool archive"
-
- library_names=
- old_library=
- relink_command=
- func_source "$file"
-
- # Add the libdir to current_libdirs if it is the destination.
- if test "X$destdir" = "X$libdir"; then
- case "$current_libdirs " in
- *" $libdir "*) ;;
- *) func_append current_libdirs " $libdir" ;;
- esac
- else
- # Note the libdir as a future libdir.
- case "$future_libdirs " in
- *" $libdir "*) ;;
- *) func_append future_libdirs " $libdir" ;;
- esac
- fi
-
- func_dirname "$file" "/" ""
- dir="$func_dirname_result"
- func_append dir "$objdir"
-
- if test -n "$relink_command"; then
- # Determine the prefix the user has applied to our future dir.
- inst_prefix_dir=`$ECHO "$destdir" | $SED -e "s%$libdir\$%%"`
-
- # Don't allow the user to place us outside of our expected
- # location b/c this prevents finding dependent libraries that
- # are installed to the same prefix.
- # At present, this check doesn't affect windows .dll's that
- # are installed into $libdir/../bin (currently, that works fine)
- # but it's something to keep an eye on.
- test "$inst_prefix_dir" = "$destdir" && \
- func_fatal_error "error: cannot install \`$file' to a directory not ending in $libdir"
-
- if test -n "$inst_prefix_dir"; then
- # Stick the inst_prefix_dir data into the link command.
- relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%"`
- else
- relink_command=`$ECHO "$relink_command" | $SED "s%@inst_prefix_dir@%%"`
- fi
-
- func_warning "relinking \`$file'"
- func_show_eval "$relink_command" \
- 'func_fatal_error "error: relink \`$file'\'' with the above command before installing it"'
- fi
-
- # See the names of the shared library.
- set dummy $library_names; shift
- if test -n "$1"; then
- realname="$1"
- shift
-
- srcname="$realname"
- test -n "$relink_command" && srcname="$realname"T
-
- # Install the shared library and build the symlinks.
- func_show_eval "$install_shared_prog $dir/$srcname $destdir/$realname" \
- 'exit $?'
- tstripme="$stripme"
- case $host_os in
- cygwin* | mingw* | pw32* | cegcc*)
- case $realname in
- *.dll.a)
- tstripme=""
- ;;
- esac
- ;;
- esac
- if test -n "$tstripme" && test -n "$striplib"; then
- func_show_eval "$striplib $destdir/$realname" 'exit $?'
- fi
-
- if test "$#" -gt 0; then
- # Delete the old symlinks, and create new ones.
- # Try `ln -sf' first, because the `ln' binary might depend on
- # the symlink we replace! Solaris /bin/ln does not understand -f,
- # so we also need to try rm && ln -s.
- for linkname
- do
- test "$linkname" != "$realname" \
- && func_show_eval "(cd $destdir && { $LN_S -f $realname $linkname || { $RM $linkname && $LN_S $realname $linkname; }; })"
- done
- fi
-
- # Do each command in the postinstall commands.
- lib="$destdir/$realname"
- func_execute_cmds "$postinstall_cmds" 'exit $?'
- fi
-
- # Install the pseudo-library for information purposes.
- func_basename "$file"
- name="$func_basename_result"
- instname="$dir/$name"i
- func_show_eval "$install_prog $instname $destdir/$name" 'exit $?'
-
- # Maybe install the static library, too.
- test -n "$old_library" && func_append staticlibs " $dir/$old_library"
- ;;
-
- *.lo)
- # Install (i.e. copy) a libtool object.
-
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- func_basename "$file"
- destfile="$func_basename_result"
- destfile="$destdir/$destfile"
- fi
-
- # Deduce the name of the destination old-style object file.
- case $destfile in
- *.lo)
- func_lo2o "$destfile"
- staticdest=$func_lo2o_result
- ;;
- *.$objext)
- staticdest="$destfile"
- destfile=
- ;;
- *)
- func_fatal_help "cannot copy a libtool object to \`$destfile'"
- ;;
- esac
-
- # Install the libtool object if requested.
- test -n "$destfile" && \
- func_show_eval "$install_prog $file $destfile" 'exit $?'
-
- # Install the old object if enabled.
- if test "$build_old_libs" = yes; then
- # Deduce the name of the old-style object file.
- func_lo2o "$file"
- staticobj=$func_lo2o_result
- func_show_eval "$install_prog \$staticobj \$staticdest" 'exit $?'
- fi
- exit $EXIT_SUCCESS
- ;;
-
- *)
- # Figure out destination file name, if it wasn't already specified.
- if test -n "$destname"; then
- destfile="$destdir/$destname"
- else
- func_basename "$file"
- destfile="$func_basename_result"
- destfile="$destdir/$destfile"
- fi
-
- # If the file is missing, and there is a .exe on the end, strip it
- # because it is most likely a libtool script we actually want to
- # install
- stripped_ext=""
- case $file in
- *.exe)
- if test ! -f "$file"; then
- func_stripname '' '.exe' "$file"
- file=$func_stripname_result
- stripped_ext=".exe"
- fi
- ;;
- esac
-
- # Do a test to see if this is really a libtool program.
- case $host in
- *cygwin* | *mingw*)
- if func_ltwrapper_executable_p "$file"; then
- func_ltwrapper_scriptname "$file"
- wrapper=$func_ltwrapper_scriptname_result
- else
- func_stripname '' '.exe' "$file"
- wrapper=$func_stripname_result
- fi
- ;;
- *)
- wrapper=$file
- ;;
- esac
- if func_ltwrapper_script_p "$wrapper"; then
- notinst_deplibs=
- relink_command=
-
- func_source "$wrapper"
-
- # Check the variables that should have been set.
- test -z "$generated_by_libtool_version" && \
- func_fatal_error "invalid libtool wrapper script \`$wrapper'"
-
- finalize=yes
- for lib in $notinst_deplibs; do
- # Check to see that each library is installed.
- libdir=
- if test -f "$lib"; then
- func_source "$lib"
- fi
- libfile="$libdir/"`$ECHO "$lib" | $SED 's%^.*/%%g'` ### testsuite: skip nested quoting test
- if test -n "$libdir" && test ! -f "$libfile"; then
- func_warning "\`$lib' has not been installed in \`$libdir'"
- finalize=no
- fi
- done
-
- relink_command=
- func_source "$wrapper"
-
- outputname=
- if test "$fast_install" = no && test -n "$relink_command"; then
- $opt_dry_run || {
- if test "$finalize" = yes; then
- tmpdir=`func_mktempdir`
- func_basename "$file$stripped_ext"
- file="$func_basename_result"
- outputname="$tmpdir/$file"
- # Replace the output file specification.
- relink_command=`$ECHO "$relink_command" | $SED 's%@OUTPUT@%'"$outputname"'%g'`
-
- $opt_silent || {
- func_quote_for_expand "$relink_command"
- eval "func_echo $func_quote_for_expand_result"
- }
- if eval "$relink_command"; then :
- else
- func_error "error: relink \`$file' with the above command before installing it"
- $opt_dry_run || ${RM}r "$tmpdir"
- continue
- fi
- file="$outputname"
- else
- func_warning "cannot relink \`$file'"
- fi
- }
- else
- # Install the binary that we compiled earlier.
- file=`$ECHO "$file$stripped_ext" | $SED "s%\([^/]*\)$%$objdir/\1%"`
- fi
- fi
-
- # remove .exe since cygwin /usr/bin/install will append another
- # one anyway
- case $install_prog,$host in
- */usr/bin/install*,*cygwin*)
- case $file:$destfile in
- *.exe:*.exe)
- # this is ok
- ;;
- *.exe:*)
- destfile=$destfile.exe
- ;;
- *:*.exe)
- func_stripname '' '.exe' "$destfile"
- destfile=$func_stripname_result
- ;;
- esac
- ;;
- esac
- func_show_eval "$install_prog\$stripme \$file \$destfile" 'exit $?'
- $opt_dry_run || if test -n "$outputname"; then
- ${RM}r "$tmpdir"
- fi
- ;;
- esac
- done
-
- for file in $staticlibs; do
- func_basename "$file"
- name="$func_basename_result"
-
- # Set up the ranlib parameters.
- oldlib="$destdir/$name"
- func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
- tool_oldlib=$func_to_tool_file_result
-
- func_show_eval "$install_prog \$file \$oldlib" 'exit $?'
-
- if test -n "$stripme" && test -n "$old_striplib"; then
- func_show_eval "$old_striplib $tool_oldlib" 'exit $?'
- fi
-
- # Do each command in the postinstall commands.
- func_execute_cmds "$old_postinstall_cmds" 'exit $?'
- done
-
- test -n "$future_libdirs" && \
- func_warning "remember to run \`$progname --finish$future_libdirs'"
-
- if test -n "$current_libdirs"; then
- # Maybe just do a dry run.
- $opt_dry_run && current_libdirs=" -n$current_libdirs"
- exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
- else
- exit $EXIT_SUCCESS
- fi
-}
-
-test "$opt_mode" = install && func_mode_install ${1+"$@"}
-
-
-# func_generate_dlsyms outputname originator pic_p
-# Extract symbols from dlprefiles and create ${outputname}S.o with
-# a dlpreopen symbol table.
-func_generate_dlsyms ()
-{
- $opt_debug
- my_outputname="$1"
- my_originator="$2"
- my_pic_p="${3-no}"
- my_prefix=`$ECHO "$my_originator" | sed 's%[^a-zA-Z0-9]%_%g'`
- my_dlsyms=
-
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- if test -n "$NM" && test -n "$global_symbol_pipe"; then
- my_dlsyms="${my_outputname}S.c"
- else
- func_error "not configured to extract global symbols from dlpreopened files"
fi
- fi
-
- if test -n "$my_dlsyms"; then
- case $my_dlsyms in
- "") ;;
- *.c)
- # Discover the nlist of each of the dlfiles.
- nlist="$output_objdir/${my_outputname}.nm"
-
- func_show_eval "$RM $nlist ${nlist}S ${nlist}T"
-
- # Parse the name list into a source file.
- func_verbose "creating $output_objdir/$my_dlsyms"
-
- $opt_dry_run || $ECHO > "$output_objdir/$my_dlsyms" "\
-/* $my_dlsyms - symbol resolution table for \`$my_outputname' dlsym emulation. */
-/* Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION */
-
-#ifdef __cplusplus
-extern \"C\" {
-#endif
-
-#if defined(__GNUC__) && (((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4)) || (__GNUC__ > 4))
-#pragma GCC diagnostic ignored \"-Wstrict-prototypes\"
-#endif
-
-/* Keep this code in sync between libtool.m4, ltmain, lt_system.h, and tests. */
-#if defined(_WIN32) || defined(__CYGWIN__) || defined(_WIN32_WCE)
-/* DATA imports from DLLs on WIN32 con't be const, because runtime
- relocations are performed -- see ld's documentation on pseudo-relocs. */
-# define LT_DLSYM_CONST
-#elif defined(__osf__)
-/* This system does not cope well with relocations in const data. */
-# define LT_DLSYM_CONST
-#else
-# define LT_DLSYM_CONST const
-#endif
-
-/* External symbol declarations for the compiler. */\
-"
-
- if test "$dlself" = yes; then
- func_verbose "generating symbol list for \`$output'"
-
- $opt_dry_run || echo ': @PROGRAM@ ' > "$nlist"
-
- # Add our own program objects to the symbol list.
- progfiles=`$ECHO "$objs$old_deplibs" | $SP2NL | $SED "$lo2o" | $NL2SP`
- for progfile in $progfiles; do
- func_to_tool_file "$progfile" func_convert_file_msys_to_w32
- func_verbose "extracting global C symbols from \`$func_to_tool_file_result'"
- $opt_dry_run || eval "$NM $func_to_tool_file_result | $global_symbol_pipe >> '$nlist'"
- done
-
- if test -n "$exclude_expsyms"; then
- $opt_dry_run || {
- eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
- eval '$MV "$nlist"T "$nlist"'
- }
- fi
-
- if test -n "$export_symbols_regex"; then
- $opt_dry_run || {
- eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
- eval '$MV "$nlist"T "$nlist"'
- }
- fi
-
- # Prepare the list of exported symbols
- if test -z "$export_symbols"; then
- export_symbols="$output_objdir/$outputname.exp"
- $opt_dry_run || {
- $RM $export_symbols
- eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- }
- else
- $opt_dry_run || {
- eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
- eval '$GREP -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
- eval '$MV "$nlist"T "$nlist"'
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
- eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
- ;;
- esac
- }
- fi
- fi
-
- for dlprefile in $dlprefiles; do
- func_verbose "extracting global C symbols from \`$dlprefile'"
- func_basename "$dlprefile"
- name="$func_basename_result"
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- # if an import library, we need to obtain dlname
- if func_win32_import_lib_p "$dlprefile"; then
- func_tr_sh "$dlprefile"
- eval "curr_lafile=\$libfile_$func_tr_sh_result"
- dlprefile_dlbasename=""
- if test -n "$curr_lafile" && func_lalib_p "$curr_lafile"; then
- # Use subshell, to avoid clobbering current variable values
- dlprefile_dlname=`source "$curr_lafile" && echo "$dlname"`
- if test -n "$dlprefile_dlname" ; then
- func_basename "$dlprefile_dlname"
- dlprefile_dlbasename="$func_basename_result"
- else
- # no lafile. user explicitly requested -dlpreopen <import library>.
- $sharedlib_from_linklib_cmd "$dlprefile"
- dlprefile_dlbasename=$sharedlib_from_linklib_result
- fi
- fi
- $opt_dry_run || {
- if test -n "$dlprefile_dlbasename" ; then
- eval '$ECHO ": $dlprefile_dlbasename" >> "$nlist"'
- else
- func_warning "Could not compute DLL name from $name"
- eval '$ECHO ": $name " >> "$nlist"'
- fi
- func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
- eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe |
- $SED -e '/I __imp/d' -e 's/I __nm_/D /;s/_nm__//' >> '$nlist'"
- }
- else # not an import lib
- $opt_dry_run || {
- eval '$ECHO ": $name " >> "$nlist"'
- func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
- eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
- }
- fi
- ;;
- *)
- $opt_dry_run || {
- eval '$ECHO ": $name " >> "$nlist"'
- func_to_tool_file "$dlprefile" func_convert_file_msys_to_w32
- eval "$NM \"$func_to_tool_file_result\" 2>/dev/null | $global_symbol_pipe >> '$nlist'"
- }
- ;;
- esac
- done
-
- $opt_dry_run || {
- # Make sure we have at least an empty file.
- test -f "$nlist" || : > "$nlist"
-
- if test -n "$exclude_expsyms"; then
- $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
- $MV "$nlist"T "$nlist"
- fi
-
- # Try sorting and uniquifying the output.
- if $GREP -v "^: " < "$nlist" |
- if sort -k 3 </dev/null >/dev/null 2>&1; then
- sort -k 3
- else
- sort +2
- fi |
- uniq > "$nlist"S; then
- :
- else
- $GREP -v "^: " < "$nlist" > "$nlist"S
- fi
-
- if test -f "$nlist"S; then
- eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$my_dlsyms"'
- else
- echo '/* NONE */' >> "$output_objdir/$my_dlsyms"
- fi
-
- echo >> "$output_objdir/$my_dlsyms" "\
-
-/* The mapping between symbol names and symbols. */
-typedef struct {
- const char *name;
- void *address;
-} lt_dlsymlist;
-extern LT_DLSYM_CONST lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[];
-LT_DLSYM_CONST lt_dlsymlist
-lt_${my_prefix}_LTX_preloaded_symbols[] =
-{\
- { \"$my_originator\", (void *) 0 },"
-
- case $need_lib_prefix in
- no)
- eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$my_dlsyms"
- ;;
- *)
- eval "$global_symbol_to_c_name_address_lib_prefix" < "$nlist" >> "$output_objdir/$my_dlsyms"
- ;;
- esac
- echo >> "$output_objdir/$my_dlsyms" "\
- {0, (void *) 0}
-};
-
-/* This works around a problem in FreeBSD linker */
-#ifdef FREEBSD_WORKAROUND
-static const void *lt_preloaded_setup() {
- return lt_${my_prefix}_LTX_preloaded_symbols;
-}
-#endif
-
-#ifdef __cplusplus
-}
-#endif\
-"
- } # !$opt_dry_run
-
- pic_flag_for_symtable=
- case "$compile_command " in
- *" -static "*) ;;
- *)
- case $host in
- # compiling the symbol table file with pic_flag works around
- # a FreeBSD bug that causes programs to crash when -lm is
- # linked before any other PIC object. But we must not use
- # pic_flag when linking with -static. The problem exists in
- # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
- *-*-freebsd2.*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
- pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND" ;;
- *-*-hpux*)
- pic_flag_for_symtable=" $pic_flag" ;;
- *)
- if test "X$my_pic_p" != Xno; then
- pic_flag_for_symtable=" $pic_flag"
- fi
- ;;
- esac
- ;;
- esac
- symtab_cflags=
- for arg in $LTCFLAGS; do
- case $arg in
- -pie | -fpie | -fPIE) ;;
- *) func_append symtab_cflags " $arg" ;;
- esac
- done
-
- # Now compile the dynamic symbol file.
- func_show_eval '(cd $output_objdir && $LTCC$symtab_cflags -c$no_builtin_flag$pic_flag_for_symtable "$my_dlsyms")' 'exit $?'
- # Clean up the generated files.
- func_show_eval '$RM "$output_objdir/$my_dlsyms" "$nlist" "${nlist}S" "${nlist}T"'
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object='$objname'
- # Transform the symbol file into the correct name.
- symfileobj="$output_objdir/${my_outputname}S.$objext"
- case $host in
- *cygwin* | *mingw* | *cegcc* )
- if test -f "$output_objdir/$my_outputname.def"; then
- compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$output_objdir/$my_outputname.def $symfileobj%"`
- else
- compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
- fi
- ;;
- *)
- compile_command=`$ECHO "$compile_command" | $SED "s%@SYMFILE@%$symfileobj%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s%@SYMFILE@%$symfileobj%"`
- ;;
- esac
- ;;
- *)
- func_fatal_error "unknown suffix for \`$my_dlsyms'"
- ;;
- esac
+EOF
else
- # We keep going just in case the user didn't refer to
- # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
- # really was required.
-
- # Nullify the symbol file.
- compile_command=`$ECHO "$compile_command" | $SED "s% @SYMFILE@%%"`
- finalize_command=`$ECHO "$finalize_command" | $SED "s% @SYMFILE@%%"`
- fi
-}
+ # Append the name of the non-PIC object the libtool object file.
+ # Only append if the libtool object file exists.
+ test -z "$run" && cat >> ${libobj}T <<EOF
+# Name of the non-PIC object.
+non_pic_object=none
-# func_win32_libid arg
-# return the library type of file 'arg'
-#
-# Need a lot of goo to handle *both* DLLs and import libs
-# Has to be a shell function in order to 'eat' the argument
-# that is supplied when $file_magic_command is called.
-# Despite the name, also deal with 64 bit binaries.
-func_win32_libid ()
-{
- $opt_debug
- win32_libid_type="unknown"
- win32_fileres=`file -L $1 2>/dev/null`
- case $win32_fileres in
- *ar\ archive\ import\ library*) # definitely import
- win32_libid_type="x86 archive import"
- ;;
- *ar\ archive*) # could be an import, or static
- # Keep the egrep pattern in sync with the one in _LT_CHECK_MAGIC_METHOD.
- if eval $OBJDUMP -f $1 | $SED -e '10q' 2>/dev/null |
- $EGREP 'file format (pei*-i386(.*architecture: i386)?|pe-arm-wince|pe-x86-64)' >/dev/null; then
- func_to_tool_file "$1" func_convert_file_msys_to_w32
- win32_nmres=`eval $NM -f posix -A \"$func_to_tool_file_result\" |
- $SED -n -e '
- 1,100{
- / I /{
- s,.*,import,
- p
- q
- }
- }'`
- case $win32_nmres in
- import*) win32_libid_type="x86 archive import";;
- *) win32_libid_type="x86 archive static";;
- esac
+EOF
fi
- ;;
- *DLL*)
- win32_libid_type="x86 DLL"
- ;;
- *executable*) # but shell scripts are "executable" too...
- case $win32_fileres in
- *MS\ Windows\ PE\ Intel*)
- win32_libid_type="x86 DLL"
- ;;
- esac
- ;;
- esac
- $ECHO "$win32_libid_type"
-}
-
-# func_cygming_dll_for_implib ARG
-#
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-# Invoked by eval'ing the libtool variable
-# $sharedlib_from_linklib_cmd
-# Result is available in the variable
-# $sharedlib_from_linklib_result
-func_cygming_dll_for_implib ()
-{
- $opt_debug
- sharedlib_from_linklib_result=`$DLLTOOL --identify-strict --identify "$1"`
-}
-
-# func_cygming_dll_for_implib_fallback_core SECTION_NAME LIBNAMEs
-#
-# The is the core of a fallback implementation of a
-# platform-specific function to extract the name of the
-# DLL associated with the specified import library LIBNAME.
-#
-# SECTION_NAME is either .idata$6 or .idata$7, depending
-# on the platform and compiler that created the implib.
-#
-# Echos the name of the DLL associated with the
-# specified import library.
-func_cygming_dll_for_implib_fallback_core ()
-{
- $opt_debug
- match_literal=`$ECHO "$1" | $SED "$sed_make_literal_regex"`
- $OBJDUMP -s --section "$1" "$2" 2>/dev/null |
- $SED '/^Contents of section '"$match_literal"':/{
- # Place marker at beginning of archive member dllname section
- s/.*/====MARK====/
- p
- d
- }
- # These lines can sometimes be longer than 43 characters, but
- # are always uninteresting
- /:[ ]*file format pe[i]\{,1\}-/d
- /^In archive [^:]*:/d
- # Ensure marker is printed
- /^====MARK====/p
- # Remove all lines with less than 43 characters
- /^.\{43\}/!d
- # From remaining lines, remove first 43 characters
- s/^.\{43\}//' |
- $SED -n '
- # Join marker and all lines until next marker into a single line
- /^====MARK====/ b para
- H
- $ b para
- b
- :para
- x
- s/\n//g
- # Remove the marker
- s/^====MARK====//
- # Remove trailing dots and whitespace
- s/[\. \t]*$//
- # Print
- /./p' |
- # we now have a list, one entry per line, of the stringified
- # contents of the appropriate section of all members of the
- # archive which possess that section. Heuristic: eliminate
- # all those which have a first or second character that is
- # a '.' (that is, objdump's representation of an unprintable
- # character.) This should work for all archives with less than
- # 0x302f exports -- but will fail for DLLs whose name actually
- # begins with a literal '.' or a single character followed by
- # a '.'.
- #
- # Of those that remain, print the first one.
- $SED -e '/^\./d;/^.\./d;q'
-}
-
-# func_cygming_gnu_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is a GNU/binutils-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_gnu_implib_p ()
-{
- $opt_debug
- func_to_tool_file "$1" func_convert_file_msys_to_w32
- func_cygming_gnu_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $EGREP ' (_head_[A-Za-z0-9_]+_[ad]l*|[A-Za-z0-9_]+_[ad]l*_iname)$'`
- test -n "$func_cygming_gnu_implib_tmp"
-}
-
-# func_cygming_ms_implib_p ARG
-# This predicate returns with zero status (TRUE) if
-# ARG is an MS-style import library. Returns
-# with nonzero status (FALSE) otherwise.
-func_cygming_ms_implib_p ()
-{
- $opt_debug
- func_to_tool_file "$1" func_convert_file_msys_to_w32
- func_cygming_ms_implib_tmp=`$NM "$func_to_tool_file_result" | eval "$global_symbol_pipe" | $GREP '_NULL_IMPORT_DESCRIPTOR'`
- test -n "$func_cygming_ms_implib_tmp"
-}
-
-# func_cygming_dll_for_implib_fallback ARG
-# Platform-specific function to extract the
-# name of the DLL associated with the specified
-# import library ARG.
-#
-# This fallback implementation is for use when $DLLTOOL
-# does not support the --identify-strict option.
-# Invoked by eval'ing the libtool variable
-# $sharedlib_from_linklib_cmd
-# Result is available in the variable
-# $sharedlib_from_linklib_result
-func_cygming_dll_for_implib_fallback ()
-{
- $opt_debug
- if func_cygming_gnu_implib_p "$1" ; then
- # binutils import library
- sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$7' "$1"`
- elif func_cygming_ms_implib_p "$1" ; then
- # ms-generated import library
- sharedlib_from_linklib_result=`func_cygming_dll_for_implib_fallback_core '.idata$6' "$1"`
- else
- # unknown
- sharedlib_from_linklib_result=""
- fi
-}
+ $run $mv "${libobj}T" "${libobj}"
-# func_extract_an_archive dir oldlib
-func_extract_an_archive ()
-{
- $opt_debug
- f_ex_an_ar_dir="$1"; shift
- f_ex_an_ar_oldlib="$1"
- if test "$lock_old_archive_extraction" = yes; then
- lockfile=$f_ex_an_ar_oldlib.lock
- until $opt_dry_run || ln "$progpath" "$lockfile" 2>/dev/null; do
- func_echo "Waiting for $lockfile to be removed"
- sleep 2
- done
- fi
- func_show_eval "(cd \$f_ex_an_ar_dir && $AR x \"\$f_ex_an_ar_oldlib\")" \
- 'stat=$?; rm -f "$lockfile"; exit $stat'
- if test "$lock_old_archive_extraction" = yes; then
- $opt_dry_run || rm -f "$lockfile"
+ # Unlock the critical section if it was locked
+ if test "$need_locks" != no; then
+ $run $rm "$lockfile"
fi
- if ($AR t "$f_ex_an_ar_oldlib" | sort | sort -uc >/dev/null 2>&1); then
- :
- else
- func_fatal_error "object name conflicts in archive: $f_ex_an_ar_dir/$f_ex_an_ar_oldlib"
- fi
-}
-
-
-# func_extract_archives gentop oldlib ...
-func_extract_archives ()
-{
- $opt_debug
- my_gentop="$1"; shift
- my_oldlibs=${1+"$@"}
- my_oldobjs=""
- my_xlib=""
- my_xabs=""
- my_xdir=""
-
- for my_xlib in $my_oldlibs; do
- # Extract the objects.
- case $my_xlib in
- [\\/]* | [A-Za-z]:[\\/]*) my_xabs="$my_xlib" ;;
- *) my_xabs=`pwd`"/$my_xlib" ;;
- esac
- func_basename "$my_xlib"
- my_xlib="$func_basename_result"
- my_xlib_u=$my_xlib
- while :; do
- case " $extracted_archives " in
- *" $my_xlib_u "*)
- func_arith $extracted_serial + 1
- extracted_serial=$func_arith_result
- my_xlib_u=lt$extracted_serial-$my_xlib ;;
- *) break ;;
- esac
- done
- extracted_archives="$extracted_archives $my_xlib_u"
- my_xdir="$my_gentop/$my_xlib_u"
-
- func_mkdir_p "$my_xdir"
-
- case $host in
- *-darwin*)
- func_verbose "Extracting $my_xabs"
- # Do not bother doing anything if just a dry run
- $opt_dry_run || {
- darwin_orig_dir=`pwd`
- cd $my_xdir || exit $?
- darwin_archive=$my_xabs
- darwin_curdir=`pwd`
- darwin_base_archive=`basename "$darwin_archive"`
- darwin_arches=`$LIPO -info "$darwin_archive" 2>/dev/null | $GREP Architectures 2>/dev/null || true`
- if test -n "$darwin_arches"; then
- darwin_arches=`$ECHO "$darwin_arches" | $SED -e 's/.*are://'`
- darwin_arch=
- func_verbose "$darwin_base_archive has multiple architectures $darwin_arches"
- for darwin_arch in $darwin_arches ; do
- func_mkdir_p "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- $LIPO -thin $darwin_arch -output "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}" "${darwin_archive}"
- cd "unfat-$$/${darwin_base_archive}-${darwin_arch}"
- func_extract_an_archive "`pwd`" "${darwin_base_archive}"
- cd "$darwin_curdir"
- $RM "unfat-$$/${darwin_base_archive}-${darwin_arch}/${darwin_base_archive}"
- done # $darwin_arches
- ## Okay now we've a bunch of thin objects, gotta fatten them up :)
- darwin_filelist=`find unfat-$$ -type f -name \*.o -print -o -name \*.lo -print | $SED -e "$basename" | sort -u`
- darwin_file=
- darwin_files=
- for darwin_file in $darwin_filelist; do
- darwin_files=`find unfat-$$ -name $darwin_file -print | sort | $NL2SP`
- $LIPO -create -output "$darwin_file" $darwin_files
- done # $darwin_filelist
- $RM -rf unfat-$$
- cd "$darwin_orig_dir"
- else
- cd $darwin_orig_dir
- func_extract_an_archive "$my_xdir" "$my_xabs"
- fi # $darwin_arches
- } # !$opt_dry_run
- ;;
- *)
- func_extract_an_archive "$my_xdir" "$my_xabs"
- ;;
- esac
- my_oldobjs="$my_oldobjs "`find $my_xdir -name \*.$objext -print -o -name \*.lo -print | sort | $NL2SP`
- done
-
- func_extract_archives_result="$my_oldobjs"
-}
-
-
-# func_emit_wrapper [arg=no]
-#
-# Emit a libtool wrapper script on stdout.
-# Don't directly open a file because we may want to
-# incorporate the script contents within a cygwin/mingw
-# wrapper executable. Must ONLY be called from within
-# func_mode_link because it depends on a number of variables
-# set therein.
-#
-# ARG is the value that the WRAPPER_SCRIPT_BELONGS_IN_OBJDIR
-# variable will take. If 'yes', then the emitted script
-# will assume that the directory in which it is stored is
-# the $objdir directory. This is a cygwin/mingw-specific
-# behavior.
-func_emit_wrapper ()
-{
- func_emit_wrapper_arg1=${1-no}
-
- $ECHO "\
-#! $SHELL
-
-# $output - temporary wrapper script for $objdir/$outputname
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-#
-# The $output program cannot be directly executed until all the libtool
-# libraries that it depends on are installed.
-#
-# This wrapper script should never be moved out of the build directory.
-# If it is, it will not operate correctly.
-
-# Sed substitution that helps us do robust quoting. It backslashifies
-# metacharacters that are still active within double-quoted strings.
-sed_quote_subst='$sed_quote_subst'
-
-# Be Bourne compatible
-if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
- emulate sh
- NULLCMD=:
- # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
- # is contrary to our usage. Disable this feature.
- alias -g '\${1+\"\$@\"}'='\"\$@\"'
- setopt NO_GLOB_SUBST
-else
- case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
-fi
-BIN_SH=xpg4; export BIN_SH # for Tru64
-DUALCASE=1; export DUALCASE # for MKS sh
-
-# The HP-UX ksh and POSIX shell print the target directory to stdout
-# if CDPATH is set.
-(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
-
-relink_command=\"$relink_command\"
-
-# This environment variable determines our operation mode.
-if test \"\$libtool_install_magic\" = \"$magic\"; then
- # install mode needs the following variables:
- generated_by_libtool_version='$macro_version'
- notinst_deplibs='$notinst_deplibs'
-else
- # When we are sourced in execute mode, \$file and \$ECHO are already set.
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- file=\"\$0\""
-
- qECHO=`$ECHO "$ECHO" | $SED "$sed_quote_subst"`
- $ECHO "\
-
-# A function that is used when there is no print builtin or printf.
-func_fallback_echo ()
-{
- eval 'cat <<_LTECHO_EOF
-\$1
-_LTECHO_EOF'
-}
- ECHO=\"$qECHO\"
- fi
-
-# Very basic option parsing. These options are (a) specific to
-# the libtool wrapper, (b) are identical between the wrapper
-# /script/ and the wrapper /executable/ which is used only on
-# windows platforms, and (c) all begin with the string "--lt-"
-# (application programs are unlikely to have options which match
-# this pattern).
-#
-# There are only two supported options: --lt-debug and
-# --lt-dump-script. There is, deliberately, no --lt-help.
-#
-# The first argument to this parsing function should be the
-# script's $0 value, followed by "$@".
-lt_option_debug=
-func_parse_lt_options ()
-{
- lt_script_arg0=\$0
- shift
- for lt_opt
- do
- case \"\$lt_opt\" in
- --lt-debug) lt_option_debug=1 ;;
- --lt-dump-script)
- lt_dump_D=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%/[^/]*$%%'\`
- test \"X\$lt_dump_D\" = \"X\$lt_script_arg0\" && lt_dump_D=.
- lt_dump_F=\`\$ECHO \"X\$lt_script_arg0\" | $SED -e 's/^X//' -e 's%^.*/%%'\`
- cat \"\$lt_dump_D/\$lt_dump_F\"
- exit 0
- ;;
- --lt-*)
- \$ECHO \"Unrecognized --lt- option: '\$lt_opt'\" 1>&2
- exit 1
- ;;
- esac
- done
-
- # Print the debug banner immediately:
- if test -n \"\$lt_option_debug\"; then
- echo \"${outputname}:${output}:\${LINENO}: libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\" 1>&2
- fi
-}
-# Used when --lt-debug. Prints its arguments to stdout
-# (redirection is the responsibility of the caller)
-func_lt_dump_args ()
-{
- lt_dump_args_N=1;
- for lt_arg
- do
- \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[\$lt_dump_args_N]: \$lt_arg\"
- lt_dump_args_N=\`expr \$lt_dump_args_N + 1\`
- done
-}
-
-# Core function for launching the target application
-func_exec_program_core ()
-{
-"
- case $host in
- # Backslashes separate directories on plain windows
- *-*-mingw | *-*-os2* | *-cegcc*)
- $ECHO "\
- if test -n \"\$lt_option_debug\"; then
- \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir\\\\\$program\" 1>&2
- func_lt_dump_args \${1+\"\$@\"} 1>&2
- fi
- exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
-"
- ;;
-
- *)
- $ECHO "\
- if test -n \"\$lt_option_debug\"; then
- \$ECHO \"${outputname}:${output}:\${LINENO}: newargv[0]: \$progdir/\$program\" 1>&2
- func_lt_dump_args \${1+\"\$@\"} 1>&2
- fi
- exec \"\$progdir/\$program\" \${1+\"\$@\"}
-"
+ exit $EXIT_SUCCESS
;;
- esac
- $ECHO "\
- \$ECHO \"\$0: cannot exec \$program \$*\" 1>&2
- exit 1
-}
-
-# A function to encapsulate launching the target application
-# Strips options in the --lt-* namespace from \$@ and
-# launches target application with the remaining arguments.
-func_exec_program ()
-{
- case \" \$* \" in
- *\\ --lt-*)
- for lt_wr_arg
- do
- case \$lt_wr_arg in
- --lt-*) ;;
- *) set x \"\$@\" \"\$lt_wr_arg\"; shift;;
- esac
- shift
- done ;;
- esac
- func_exec_program_core \${1+\"\$@\"}
-}
-
- # Parse options
- func_parse_lt_options \"\$0\" \${1+\"\$@\"}
-
- # Find the directory that this script lives in.
- thisdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*$%%'\`
- test \"x\$thisdir\" = \"x\$file\" && thisdir=.
-
- # Follow symbolic links until we get to the real thisdir.
- file=\`ls -ld \"\$file\" | $SED -n 's/.*-> //p'\`
- while test -n \"\$file\"; do
- destdir=\`\$ECHO \"\$file\" | $SED 's%/[^/]*\$%%'\`
-
- # If there was a directory component, then change thisdir.
- if test \"x\$destdir\" != \"x\$file\"; then
- case \"\$destdir\" in
- [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
- *) thisdir=\"\$thisdir/\$destdir\" ;;
- esac
- fi
-
- file=\`\$ECHO \"\$file\" | $SED 's%^.*/%%'\`
- file=\`ls -ld \"\$thisdir/\$file\" | $SED -n 's/.*-> //p'\`
- done
-
- # Usually 'no', except on cygwin/mingw when embedded into
- # the cwrapper.
- WRAPPER_SCRIPT_BELONGS_IN_OBJDIR=$func_emit_wrapper_arg1
- if test \"\$WRAPPER_SCRIPT_BELONGS_IN_OBJDIR\" = \"yes\"; then
- # special case for '.'
- if test \"\$thisdir\" = \".\"; then
- thisdir=\`pwd\`
- fi
- # remove .libs from thisdir
- case \"\$thisdir\" in
- *[\\\\/]$objdir ) thisdir=\`\$ECHO \"\$thisdir\" | $SED 's%[\\\\/][^\\\\/]*$%%'\` ;;
- $objdir ) thisdir=. ;;
- esac
- fi
-
- # Try to get the absolute directory name.
- absdir=\`cd \"\$thisdir\" && pwd\`
- test -n \"\$absdir\" && thisdir=\"\$absdir\"
-"
-
- if test "$fast_install" = yes; then
- $ECHO "\
- program=lt-'$outputname'$exeext
- progdir=\"\$thisdir/$objdir\"
-
- if test ! -f \"\$progdir/\$program\" ||
- { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
- test \"X\$file\" != \"X\$progdir/\$program\"; }; then
-
- file=\"\$\$-\$program\"
-
- if test ! -d \"\$progdir\"; then
- $MKDIR \"\$progdir\"
- else
- $RM \"\$progdir/\$file\"
- fi"
-
- $ECHO "\
-
- # relink executable if necessary
- if test -n \"\$relink_command\"; then
- if relink_command_output=\`eval \$relink_command 2>&1\`; then :
- else
- $ECHO \"\$relink_command_output\" >&2
- $RM \"\$progdir/\$file\"
- exit 1
- fi
- fi
-
- $MV \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
- { $RM \"\$progdir/\$program\";
- $MV \"\$progdir/\$file\" \"\$progdir/\$program\"; }
- $RM \"\$progdir/\$file\"
- fi"
- else
- $ECHO "\
- program='$outputname'
- progdir=\"\$thisdir/$objdir\"
-"
- fi
-
- $ECHO "\
-
- if test -f \"\$progdir/\$program\"; then"
-
- # fixup the dll searchpath if we need to.
- #
- # Fix the DLL searchpath if we need to. Do this before prepending
- # to shlibpath, because on Windows, both are PATH and uninstalled
- # libraries must come first.
- if test -n "$dllsearchpath"; then
- $ECHO "\
- # Add the dll search path components to the executable PATH
- PATH=$dllsearchpath:\$PATH
-"
- fi
-
- # Export our shlibpath_var if we have one.
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- $ECHO "\
- # Add our own library path to $shlibpath_var
- $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
-
- # Some systems cannot cope with colon-terminated $shlibpath_var
- # The second colon is a workaround for a bug in BeOS R4 sed
- $shlibpath_var=\`\$ECHO \"\$$shlibpath_var\" | $SED 's/::*\$//'\`
-
- export $shlibpath_var
-"
- fi
-
- $ECHO "\
- if test \"\$libtool_execute_magic\" != \"$magic\"; then
- # Run the actual program with our arguments.
- func_exec_program \${1+\"\$@\"}
- fi
- else
- # The program doesn't exist.
- \$ECHO \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
- \$ECHO \"This script is just a wrapper for \$program.\" 1>&2
- \$ECHO \"See the $PACKAGE documentation for more information.\" 1>&2
- exit 1
- fi
-fi\
-"
-}
-
-
-# func_emit_cwrapperexe_src
-# emit the source code for a wrapper executable on stdout
-# Must ONLY be called from within func_mode_link because
-# it depends on a number of variable set therein.
-func_emit_cwrapperexe_src ()
-{
- cat <<EOF
-
-/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
- Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
-
- The $output program cannot be directly executed until all the libtool
- libraries that it depends on are installed.
-
- This wrapper executable should never be moved out of the build directory.
- If it is, it will not operate correctly.
-*/
-EOF
- cat <<"EOF"
-#ifdef _MSC_VER
-# define _CRT_SECURE_NO_DEPRECATE 1
-#endif
-#include <stdio.h>
-#include <stdlib.h>
-#ifdef _MSC_VER
-# include <direct.h>
-# include <process.h>
-# include <io.h>
-#else
-# include <unistd.h>
-# include <stdint.h>
-# ifdef __CYGWIN__
-# include <io.h>
-# endif
-#endif
-#include <malloc.h>
-#include <stdarg.h>
-#include <assert.h>
-#include <string.h>
-#include <ctype.h>
-#include <errno.h>
-#include <fcntl.h>
-#include <sys/stat.h>
-
-/* declarations of non-ANSI functions */
-#if defined(__MINGW32__)
-# ifdef __STRICT_ANSI__
-int _putenv (const char *);
-# endif
-#elif defined(__CYGWIN__)
-# ifdef __STRICT_ANSI__
-char *realpath (const char *, char *);
-int putenv (char *);
-int setenv (const char *, const char *, int);
-# endif
-/* #elif defined (other platforms) ... */
-#endif
-
-/* portability defines, excluding path handling macros */
-#if defined(_MSC_VER)
-# define setmode _setmode
-# define stat _stat
-# define chmod _chmod
-# define getcwd _getcwd
-# define putenv _putenv
-# define S_IXUSR _S_IEXEC
-# ifndef _INTPTR_T_DEFINED
-# define _INTPTR_T_DEFINED
-# define intptr_t int
-# endif
-#elif defined(__MINGW32__)
-# define setmode _setmode
-# define stat _stat
-# define chmod _chmod
-# define getcwd _getcwd
-# define putenv _putenv
-#elif defined(__CYGWIN__)
-# define HAVE_SETENV
-# define FOPEN_WB "wb"
-/* #elif defined (other platforms) ... */
-#endif
-
-#if defined(PATH_MAX)
-# define LT_PATHMAX PATH_MAX
-#elif defined(MAXPATHLEN)
-# define LT_PATHMAX MAXPATHLEN
-#else
-# define LT_PATHMAX 1024
-#endif
-
-#ifndef S_IXOTH
-# define S_IXOTH 0
-#endif
-#ifndef S_IXGRP
-# define S_IXGRP 0
-#endif
-
-/* path handling portability macros */
-#ifndef DIR_SEPARATOR
-# define DIR_SEPARATOR '/'
-# define PATH_SEPARATOR ':'
-#endif
-
-#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
- defined (__OS2__)
-# define HAVE_DOS_BASED_FILE_SYSTEM
-# define FOPEN_WB "wb"
-# ifndef DIR_SEPARATOR_2
-# define DIR_SEPARATOR_2 '\\'
-# endif
-# ifndef PATH_SEPARATOR_2
-# define PATH_SEPARATOR_2 ';'
-# endif
-#endif
-#ifndef DIR_SEPARATOR_2
-# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
-#else /* DIR_SEPARATOR_2 */
-# define IS_DIR_SEPARATOR(ch) \
- (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
-#endif /* DIR_SEPARATOR_2 */
-
-#ifndef PATH_SEPARATOR_2
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
-#else /* PATH_SEPARATOR_2 */
-# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
-#endif /* PATH_SEPARATOR_2 */
-
-#ifndef FOPEN_WB
-# define FOPEN_WB "w"
-#endif
-#ifndef _O_BINARY
-# define _O_BINARY 0
-#endif
-
-#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
-#define XFREE(stale) do { \
- if (stale) { free ((void *) stale); stale = 0; } \
-} while (0)
-
-#if defined(LT_DEBUGWRAPPER)
-static int lt_debug = 1;
-#else
-static int lt_debug = 0;
-#endif
-
-const char *program_name = "libtool-wrapper"; /* in case xstrdup fails */
-
-void *xmalloc (size_t num);
-char *xstrdup (const char *string);
-const char *base_name (const char *name);
-char *find_executable (const char *wrapper);
-char *chase_symlinks (const char *pathspec);
-int make_executable (const char *path);
-int check_executable (const char *path);
-char *strendzap (char *str, const char *pat);
-void lt_debugprintf (const char *file, int line, const char *fmt, ...);
-void lt_fatal (const char *file, int line, const char *message, ...);
-static const char *nonnull (const char *s);
-static const char *nonempty (const char *s);
-void lt_setenv (const char *name, const char *value);
-char *lt_extend_str (const char *orig_value, const char *add, int to_end);
-void lt_update_exe_path (const char *name, const char *value);
-void lt_update_lib_path (const char *name, const char *value);
-char **prepare_spawn (char **argv);
-void lt_dump_script (FILE *f);
-EOF
-
- cat <<EOF
-volatile const char * MAGIC_EXE = "$magic_exe";
-const char * LIB_PATH_VARNAME = "$shlibpath_var";
-EOF
-
- if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
- func_to_host_path "$temp_rpath"
- cat <<EOF
-const char * LIB_PATH_VALUE = "$func_to_host_path_result";
-EOF
- else
- cat <<"EOF"
-const char * LIB_PATH_VALUE = "";
-EOF
- fi
-
- if test -n "$dllsearchpath"; then
- func_to_host_path "$dllsearchpath:"
- cat <<EOF
-const char * EXE_PATH_VARNAME = "PATH";
-const char * EXE_PATH_VALUE = "$func_to_host_path_result";
-EOF
- else
- cat <<"EOF"
-const char * EXE_PATH_VARNAME = "";
-const char * EXE_PATH_VALUE = "";
-EOF
- fi
-
- if test "$fast_install" = yes; then
- cat <<EOF
-const char * TARGET_PROGRAM_NAME = "lt-$outputname"; /* hopefully, no .exe */
-EOF
- else
- cat <<EOF
-const char * TARGET_PROGRAM_NAME = "$outputname"; /* hopefully, no .exe */
-EOF
- fi
-
-
- cat <<"EOF"
-
-#define LTWRAPPER_OPTION_PREFIX "--lt-"
-
-static const char *ltwrapper_option_prefix = LTWRAPPER_OPTION_PREFIX;
-static const char *dumpscript_opt = LTWRAPPER_OPTION_PREFIX "dump-script";
-static const char *debug_opt = LTWRAPPER_OPTION_PREFIX "debug";
-
-int
-main (int argc, char *argv[])
-{
- char **newargz;
- int newargc;
- char *tmp_pathspec;
- char *actual_cwrapper_path;
- char *actual_cwrapper_name;
- char *target_name;
- char *lt_argv_zero;
- intptr_t rval = 127;
-
- int i;
-
- program_name = (char *) xstrdup (base_name (argv[0]));
- newargz = XMALLOC (char *, argc + 1);
-
- /* very simple arg parsing; don't want to rely on getopt
- * also, copy all non cwrapper options to newargz, except
- * argz[0], which is handled differently
- */
- newargc=0;
- for (i = 1; i < argc; i++)
- {
- if (strcmp (argv[i], dumpscript_opt) == 0)
- {
-EOF
- case "$host" in
- *mingw* | *cygwin* )
- # make stdout use "unix" line endings
- echo " setmode(1,_O_BINARY);"
- ;;
- esac
-
- cat <<"EOF"
- lt_dump_script (stdout);
- return 0;
- }
- if (strcmp (argv[i], debug_opt) == 0)
- {
- lt_debug = 1;
- continue;
- }
- if (strcmp (argv[i], ltwrapper_option_prefix) == 0)
- {
- /* however, if there is an option in the LTWRAPPER_OPTION_PREFIX
- namespace, but it is not one of the ones we know about and
- have already dealt with, above (inluding dump-script), then
- report an error. Otherwise, targets might begin to believe
- they are allowed to use options in the LTWRAPPER_OPTION_PREFIX
- namespace. The first time any user complains about this, we'll
- need to make LTWRAPPER_OPTION_PREFIX a configure-time option
- or a configure.ac-settable value.
- */
- lt_fatal (__FILE__, __LINE__,
- "unrecognized %s option: '%s'",
- ltwrapper_option_prefix, argv[i]);
- }
- /* otherwise ... */
- newargz[++newargc] = xstrdup (argv[i]);
- }
- newargz[++newargc] = NULL;
-
-EOF
- cat <<EOF
- /* The GNU banner must be the first non-error debug message */
- lt_debugprintf (__FILE__, __LINE__, "libtool wrapper (GNU $PACKAGE$TIMESTAMP) $VERSION\n");
-EOF
- cat <<"EOF"
- lt_debugprintf (__FILE__, __LINE__, "(main) argv[0]: %s\n", argv[0]);
- lt_debugprintf (__FILE__, __LINE__, "(main) program_name: %s\n", program_name);
-
- tmp_pathspec = find_executable (argv[0]);
- if (tmp_pathspec == NULL)
- lt_fatal (__FILE__, __LINE__, "couldn't find %s", argv[0]);
- lt_debugprintf (__FILE__, __LINE__,
- "(main) found exe (before symlink chase) at: %s\n",
- tmp_pathspec);
-
- actual_cwrapper_path = chase_symlinks (tmp_pathspec);
- lt_debugprintf (__FILE__, __LINE__,
- "(main) found exe (after symlink chase) at: %s\n",
- actual_cwrapper_path);
- XFREE (tmp_pathspec);
-
- actual_cwrapper_name = xstrdup (base_name (actual_cwrapper_path));
- strendzap (actual_cwrapper_path, actual_cwrapper_name);
-
- /* wrapper name transforms */
- strendzap (actual_cwrapper_name, ".exe");
- tmp_pathspec = lt_extend_str (actual_cwrapper_name, ".exe", 1);
- XFREE (actual_cwrapper_name);
- actual_cwrapper_name = tmp_pathspec;
- tmp_pathspec = 0;
-
- /* target_name transforms -- use actual target program name; might have lt- prefix */
- target_name = xstrdup (base_name (TARGET_PROGRAM_NAME));
- strendzap (target_name, ".exe");
- tmp_pathspec = lt_extend_str (target_name, ".exe", 1);
- XFREE (target_name);
- target_name = tmp_pathspec;
- tmp_pathspec = 0;
-
- lt_debugprintf (__FILE__, __LINE__,
- "(main) libtool target name: %s\n",
- target_name);
-EOF
-
- cat <<EOF
- newargz[0] =
- XMALLOC (char, (strlen (actual_cwrapper_path) +
- strlen ("$objdir") + 1 + strlen (actual_cwrapper_name) + 1));
- strcpy (newargz[0], actual_cwrapper_path);
- strcat (newargz[0], "$objdir");
- strcat (newargz[0], "/");
-EOF
-
- cat <<"EOF"
- /* stop here, and copy so we don't have to do this twice */
- tmp_pathspec = xstrdup (newargz[0]);
-
- /* do NOT want the lt- prefix here, so use actual_cwrapper_name */
- strcat (newargz[0], actual_cwrapper_name);
-
- /* DO want the lt- prefix here if it exists, so use target_name */
- lt_argv_zero = lt_extend_str (tmp_pathspec, target_name, 1);
- XFREE (tmp_pathspec);
- tmp_pathspec = NULL;
-EOF
-
- case $host_os in
- mingw*)
- cat <<"EOF"
- {
- char* p;
- while ((p = strchr (newargz[0], '\\')) != NULL)
- {
- *p = '/';
- }
- while ((p = strchr (lt_argv_zero, '\\')) != NULL)
- {
- *p = '/';
- }
- }
-EOF
- ;;
- esac
-
- cat <<"EOF"
- XFREE (target_name);
- XFREE (actual_cwrapper_path);
- XFREE (actual_cwrapper_name);
-
- lt_setenv ("BIN_SH", "xpg4"); /* for Tru64 */
- lt_setenv ("DUALCASE", "1"); /* for MSK sh */
- /* Update the DLL searchpath. EXE_PATH_VALUE ($dllsearchpath) must
- be prepended before (that is, appear after) LIB_PATH_VALUE ($temp_rpath)
- because on Windows, both *_VARNAMEs are PATH but uninstalled
- libraries must come first. */
- lt_update_exe_path (EXE_PATH_VARNAME, EXE_PATH_VALUE);
- lt_update_lib_path (LIB_PATH_VARNAME, LIB_PATH_VALUE);
-
- lt_debugprintf (__FILE__, __LINE__, "(main) lt_argv_zero: %s\n",
- nonnull (lt_argv_zero));
- for (i = 0; i < newargc; i++)
- {
- lt_debugprintf (__FILE__, __LINE__, "(main) newargz[%d]: %s\n",
- i, nonnull (newargz[i]));
- }
-
-EOF
-
- case $host_os in
- mingw*)
- cat <<"EOF"
- /* execv doesn't actually work on mingw as expected on unix */
- newargz = prepare_spawn (newargz);
- rval = _spawnv (_P_WAIT, lt_argv_zero, (const char * const *) newargz);
- if (rval == -1)
- {
- /* failed to start process */
- lt_debugprintf (__FILE__, __LINE__,
- "(main) failed to launch target \"%s\": %s\n",
- lt_argv_zero, nonnull (strerror (errno)));
- return 127;
- }
- return rval;
-EOF
- ;;
- *)
- cat <<"EOF"
- execv (lt_argv_zero, newargz);
- return rval; /* =127, but avoids unused variable warning */
-EOF
- ;;
- esac
-
- cat <<"EOF"
-}
-
-void *
-xmalloc (size_t num)
-{
- void *p = (void *) malloc (num);
- if (!p)
- lt_fatal (__FILE__, __LINE__, "memory exhausted");
-
- return p;
-}
-
-char *
-xstrdup (const char *string)
-{
- return string ? strcpy ((char *) xmalloc (strlen (string) + 1),
- string) : NULL;
-}
-
-const char *
-base_name (const char *name)
-{
- const char *base;
-
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- /* Skip over the disk name in MSDOS pathnames. */
- if (isalpha ((unsigned char) name[0]) && name[1] == ':')
- name += 2;
-#endif
-
- for (base = name; *name; name++)
- if (IS_DIR_SEPARATOR (*name))
- base = name + 1;
- return base;
-}
-
-int
-check_executable (const char *path)
-{
- struct stat st;
-
- lt_debugprintf (__FILE__, __LINE__, "(check_executable): %s\n",
- nonempty (path));
- if ((!path) || (!*path))
- return 0;
-
- if ((stat (path, &st) >= 0)
- && (st.st_mode & (S_IXUSR | S_IXGRP | S_IXOTH)))
- return 1;
- else
- return 0;
-}
-
-int
-make_executable (const char *path)
-{
- int rval = 0;
- struct stat st;
-
- lt_debugprintf (__FILE__, __LINE__, "(make_executable): %s\n",
- nonempty (path));
- if ((!path) || (!*path))
- return 0;
-
- if (stat (path, &st) >= 0)
- {
- rval = chmod (path, st.st_mode | S_IXOTH | S_IXGRP | S_IXUSR);
- }
- return rval;
-}
-
-/* Searches for the full path of the wrapper. Returns
- newly allocated full path name if found, NULL otherwise
- Does not chase symlinks, even on platforms that support them.
-*/
-char *
-find_executable (const char *wrapper)
-{
- int has_slash = 0;
- const char *p;
- const char *p_next;
- /* static buffer for getcwd */
- char tmp[LT_PATHMAX + 1];
- int tmp_len;
- char *concat_name;
-
- lt_debugprintf (__FILE__, __LINE__, "(find_executable): %s\n",
- nonempty (wrapper));
-
- if ((wrapper == NULL) || (*wrapper == '\0'))
- return NULL;
-
- /* Absolute path? */
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- if (isalpha ((unsigned char) wrapper[0]) && wrapper[1] == ':')
- {
- concat_name = xstrdup (wrapper);
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- }
- else
- {
-#endif
- if (IS_DIR_SEPARATOR (wrapper[0]))
- {
- concat_name = xstrdup (wrapper);
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- }
-#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
- }
-#endif
-
- for (p = wrapper; *p; p++)
- if (*p == '/')
- {
- has_slash = 1;
- break;
- }
- if (!has_slash)
- {
- /* no slashes; search PATH */
- const char *path = getenv ("PATH");
- if (path != NULL)
- {
- for (p = path; *p; p = p_next)
- {
- const char *q;
- size_t p_len;
- for (q = p; *q; q++)
- if (IS_PATH_SEPARATOR (*q))
- break;
- p_len = q - p;
- p_next = (*q == '\0' ? q : q + 1);
- if (p_len == 0)
- {
- /* empty path: current directory */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
- nonnull (strerror (errno)));
- tmp_len = strlen (tmp);
- concat_name =
- XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
- }
- else
- {
- concat_name =
- XMALLOC (char, p_len + 1 + strlen (wrapper) + 1);
- memcpy (concat_name, p, p_len);
- concat_name[p_len] = '/';
- strcpy (concat_name + p_len + 1, wrapper);
- }
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- }
- }
- /* not found in PATH; assume curdir */
- }
- /* Relative path | not found in path: prepend cwd */
- if (getcwd (tmp, LT_PATHMAX) == NULL)
- lt_fatal (__FILE__, __LINE__, "getcwd failed: %s",
- nonnull (strerror (errno)));
- tmp_len = strlen (tmp);
- concat_name = XMALLOC (char, tmp_len + 1 + strlen (wrapper) + 1);
- memcpy (concat_name, tmp, tmp_len);
- concat_name[tmp_len] = '/';
- strcpy (concat_name + tmp_len + 1, wrapper);
-
- if (check_executable (concat_name))
- return concat_name;
- XFREE (concat_name);
- return NULL;
-}
-
-char *
-chase_symlinks (const char *pathspec)
-{
-#ifndef S_ISLNK
- return xstrdup (pathspec);
-#else
- char buf[LT_PATHMAX];
- struct stat s;
- char *tmp_pathspec = xstrdup (pathspec);
- char *p;
- int has_symlinks = 0;
- while (strlen (tmp_pathspec) && !has_symlinks)
- {
- lt_debugprintf (__FILE__, __LINE__,
- "checking path component for symlinks: %s\n",
- tmp_pathspec);
- if (lstat (tmp_pathspec, &s) == 0)
- {
- if (S_ISLNK (s.st_mode) != 0)
- {
- has_symlinks = 1;
- break;
- }
-
- /* search backwards for last DIR_SEPARATOR */
- p = tmp_pathspec + strlen (tmp_pathspec) - 1;
- while ((p > tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
- p--;
- if ((p == tmp_pathspec) && (!IS_DIR_SEPARATOR (*p)))
- {
- /* no more DIR_SEPARATORS left */
- break;
- }
- *p = '\0';
- }
- else
- {
- lt_fatal (__FILE__, __LINE__,
- "error accessing file \"%s\": %s",
- tmp_pathspec, nonnull (strerror (errno)));
- }
- }
- XFREE (tmp_pathspec);
-
- if (!has_symlinks)
- {
- return xstrdup (pathspec);
- }
-
- tmp_pathspec = realpath (pathspec, buf);
- if (tmp_pathspec == 0)
- {
- lt_fatal (__FILE__, __LINE__,
- "could not follow symlinks for %s", pathspec);
- }
- return xstrdup (tmp_pathspec);
-#endif
-}
-
-char *
-strendzap (char *str, const char *pat)
-{
- size_t len, patlen;
-
- assert (str != NULL);
- assert (pat != NULL);
-
- len = strlen (str);
- patlen = strlen (pat);
-
- if (patlen <= len)
- {
- str += len - patlen;
- if (strcmp (str, pat) == 0)
- *str = '\0';
- }
- return str;
-}
-
-void
-lt_debugprintf (const char *file, int line, const char *fmt, ...)
-{
- va_list args;
- if (lt_debug)
- {
- (void) fprintf (stderr, "%s:%s:%d: ", program_name, file, line);
- va_start (args, fmt);
- (void) vfprintf (stderr, fmt, args);
- va_end (args);
- }
-}
-
-static void
-lt_error_core (int exit_status, const char *file,
- int line, const char *mode,
- const char *message, va_list ap)
-{
- fprintf (stderr, "%s:%s:%d: %s: ", program_name, file, line, mode);
- vfprintf (stderr, message, ap);
- fprintf (stderr, ".\n");
-
- if (exit_status >= 0)
- exit (exit_status);
-}
-
-void
-lt_fatal (const char *file, int line, const char *message, ...)
-{
- va_list ap;
- va_start (ap, message);
- lt_error_core (EXIT_FAILURE, file, line, "FATAL", message, ap);
- va_end (ap);
-}
-
-static const char *
-nonnull (const char *s)
-{
- return s ? s : "(null)";
-}
-
-static const char *
-nonempty (const char *s)
-{
- return (s && !*s) ? "(empty)" : nonnull (s);
-}
-
-void
-lt_setenv (const char *name, const char *value)
-{
- lt_debugprintf (__FILE__, __LINE__,
- "(lt_setenv) setting '%s' to '%s'\n",
- nonnull (name), nonnull (value));
- {
-#ifdef HAVE_SETENV
- /* always make a copy, for consistency with !HAVE_SETENV */
- char *str = xstrdup (value);
- setenv (name, str, 1);
-#else
- int len = strlen (name) + 1 + strlen (value) + 1;
- char *str = XMALLOC (char, len);
- sprintf (str, "%s=%s", name, value);
- if (putenv (str) != EXIT_SUCCESS)
- {
- XFREE (str);
- }
-#endif
- }
-}
-
-char *
-lt_extend_str (const char *orig_value, const char *add, int to_end)
-{
- char *new_value;
- if (orig_value && *orig_value)
- {
- int orig_value_len = strlen (orig_value);
- int add_len = strlen (add);
- new_value = XMALLOC (char, add_len + orig_value_len + 1);
- if (to_end)
- {
- strcpy (new_value, orig_value);
- strcpy (new_value + orig_value_len, add);
- }
- else
- {
- strcpy (new_value, add);
- strcpy (new_value + add_len, orig_value);
- }
- }
- else
- {
- new_value = xstrdup (add);
- }
- return new_value;
-}
-
-void
-lt_update_exe_path (const char *name, const char *value)
-{
- lt_debugprintf (__FILE__, __LINE__,
- "(lt_update_exe_path) modifying '%s' by prepending '%s'\n",
- nonnull (name), nonnull (value));
-
- if (name && *name && value && *value)
- {
- char *new_value = lt_extend_str (getenv (name), value, 0);
- /* some systems can't cope with a ':'-terminated path #' */
- int len = strlen (new_value);
- while (((len = strlen (new_value)) > 0) && IS_PATH_SEPARATOR (new_value[len-1]))
- {
- new_value[len-1] = '\0';
- }
- lt_setenv (name, new_value);
- XFREE (new_value);
- }
-}
-
-void
-lt_update_lib_path (const char *name, const char *value)
-{
- lt_debugprintf (__FILE__, __LINE__,
- "(lt_update_lib_path) modifying '%s' by prepending '%s'\n",
- nonnull (name), nonnull (value));
-
- if (name && *name && value && *value)
- {
- char *new_value = lt_extend_str (getenv (name), value, 0);
- lt_setenv (name, new_value);
- XFREE (new_value);
- }
-}
-
-EOF
- case $host_os in
- mingw*)
- cat <<"EOF"
-
-/* Prepares an argument vector before calling spawn().
- Note that spawn() does not by itself call the command interpreter
- (getenv ("COMSPEC") != NULL ? getenv ("COMSPEC") :
- ({ OSVERSIONINFO v; v.dwOSVersionInfoSize = sizeof(OSVERSIONINFO);
- GetVersionEx(&v);
- v.dwPlatformId == VER_PLATFORM_WIN32_NT;
- }) ? "cmd.exe" : "command.com").
- Instead it simply concatenates the arguments, separated by ' ', and calls
- CreateProcess(). We must quote the arguments since Win32 CreateProcess()
- interprets characters like ' ', '\t', '\\', '"' (but not '<' and '>') in a
- special way:
- - Space and tab are interpreted as delimiters. They are not treated as
- delimiters if they are surrounded by double quotes: "...".
- - Unescaped double quotes are removed from the input. Their only effect is
- that within double quotes, space and tab are treated like normal
- characters.
- - Backslashes not followed by double quotes are not special.
- - But 2*n+1 backslashes followed by a double quote become
- n backslashes followed by a double quote (n >= 0):
- \" -> "
- \\\" -> \"
- \\\\\" -> \\"
- */
-#define SHELL_SPECIAL_CHARS "\"\\ \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-#define SHELL_SPACE_CHARS " \001\002\003\004\005\006\007\010\011\012\013\014\015\016\017\020\021\022\023\024\025\026\027\030\031\032\033\034\035\036\037"
-char **
-prepare_spawn (char **argv)
-{
- size_t argc;
- char **new_argv;
- size_t i;
-
- /* Count number of arguments. */
- for (argc = 0; argv[argc] != NULL; argc++)
- ;
-
- /* Allocate new argument vector. */
- new_argv = XMALLOC (char *, argc + 1);
-
- /* Put quoted arguments into the new argument vector. */
- for (i = 0; i < argc; i++)
- {
- const char *string = argv[i];
-
- if (string[0] == '\0')
- new_argv[i] = xstrdup ("\"\"");
- else if (strpbrk (string, SHELL_SPECIAL_CHARS) != NULL)
- {
- int quote_around = (strpbrk (string, SHELL_SPACE_CHARS) != NULL);
- size_t length;
- unsigned int backslashes;
- const char *s;
- char *quoted_string;
- char *p;
-
- length = 0;
- backslashes = 0;
- if (quote_around)
- length++;
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- length += backslashes + 1;
- length++;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- length += backslashes + 1;
-
- quoted_string = XMALLOC (char, length + 1);
-
- p = quoted_string;
- backslashes = 0;
- if (quote_around)
- *p++ = '"';
- for (s = string; *s != '\0'; s++)
- {
- char c = *s;
- if (c == '"')
- {
- unsigned int j;
- for (j = backslashes + 1; j > 0; j--)
- *p++ = '\\';
- }
- *p++ = c;
- if (c == '\\')
- backslashes++;
- else
- backslashes = 0;
- }
- if (quote_around)
- {
- unsigned int j;
- for (j = backslashes; j > 0; j--)
- *p++ = '\\';
- *p++ = '"';
- }
- *p = '\0';
-
- new_argv[i] = quoted_string;
- }
- else
- new_argv[i] = (char *) string;
- }
- new_argv[argc] = NULL;
-
- return new_argv;
-}
-EOF
- ;;
- esac
-
- cat <<"EOF"
-void lt_dump_script (FILE* f)
-{
-EOF
- func_emit_wrapper yes |
- $SED -n -e '
-s/^\(.\{79\}\)\(..*\)/\1\
-\2/
-h
-s/\([\\"]\)/\\\1/g
-s/$/\\n/
-s/\([^\n]*\).*/ fputs ("\1", f);/p
-g
-D'
- cat <<"EOF"
-}
-EOF
-}
-# end: func_emit_cwrapperexe_src
-
-# func_win32_import_lib_p ARG
-# True if ARG is an import lib, as indicated by $file_magic_cmd
-func_win32_import_lib_p ()
-{
- $opt_debug
- case `eval $file_magic_cmd \"\$1\" 2>/dev/null | $SED -e 10q` in
- *import*) : ;;
- *) false ;;
- esac
-}
-
-# func_mode_link arg...
-func_mode_link ()
-{
- $opt_debug
+ # libtool link mode
+ link | relink)
+ modename="$modename: link"
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
# It is impossible to link a dll without this setting, and
# we shouldn't force the makefile maintainer to figure out
# which system we are compiling for in order to pass an extra
@@ -5112,10 +1114,10 @@ func_mode_link ()
allow_undefined=yes
;;
esac
- libtool_args=$nonopt
+ libtool_args="$nonopt"
base_compile="$nonopt $@"
- compile_command=$nonopt
- finalize_command=$nonopt
+ compile_command="$nonopt"
+ finalize_command="$nonopt"
compile_rpath=
finalize_rpath=
@@ -5130,10 +1132,8 @@ func_mode_link ()
dllsearchpath=
lib_search_path=`pwd`
inst_prefix_dir=
- new_inherited_linker_flags=
avoid_version=no
- bindir=
dlfiles=
dlprefiles=
dlself=no
@@ -5147,6 +1147,7 @@ func_mode_link ()
no_install=no
objs=
non_pic_objects=
+ notinst_path= # paths that contain not-installed libtool libraries
precious_files_regex=
prefer_static_libs=no
preload=no
@@ -5160,25 +1161,18 @@ func_mode_link ()
thread_safe=no
vinfo=
vinfo_number=no
- weak_libs=
- single_module="${wl}-single_module"
+
func_infer_tag $base_compile
# We need to know -static, to get the right output filenames.
for arg
do
case $arg in
- -shared)
- test "$build_libtool_libs" != yes && \
- func_fatal_configuration "can not build a shared library"
- build_old_libs=no
- break
- ;;
-all-static | -static | -static-libtool-libs)
case $arg in
-all-static)
if test "$build_libtool_libs" = yes && test -z "$link_static_flag"; then
- func_warning "complete static linking is impossible in this configuration"
+ $echo "$modename: warning: complete static linking is impossible in this configuration" 1>&2
fi
if test -n "$link_static_flag"; then
dlopen_self=$dlopen_self_static
@@ -5212,30 +1206,29 @@ func_mode_link ()
while test "$#" -gt 0; do
arg="$1"
shift
- func_quote_for_eval "$arg"
- qarg=$func_quote_for_eval_unquoted_result
- func_append libtool_args " $func_quote_for_eval_result"
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ qarg=\"`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`\" ### testsuite: skip nested quoting test
+ ;;
+ *) qarg=$arg ;;
+ esac
+ libtool_args="$libtool_args $qarg"
# If the previous option needs an argument, assign it.
if test -n "$prev"; then
case $prev in
output)
- func_append compile_command " @OUTPUT@"
- func_append finalize_command " @OUTPUT@"
+ compile_command="$compile_command @OUTPUT@"
+ finalize_command="$finalize_command @OUTPUT@"
;;
esac
case $prev in
- bindir)
- bindir="$arg"
- prev=
- continue
- ;;
dlfiles|dlprefiles)
if test "$preload" = no; then
# Add the symbol object into the linking commands.
- func_append compile_command " @SYMFILE@"
- func_append finalize_command " @SYMFILE@"
+ compile_command="$compile_command @SYMFILE@"
+ finalize_command="$finalize_command @SYMFILE@"
preload=yes
fi
case $arg in
@@ -5262,9 +1255,9 @@ func_mode_link ()
;;
*)
if test "$prev" = dlfiles; then
- func_append dlfiles " $arg"
+ dlfiles="$dlfiles $arg"
else
- func_append dlprefiles " $arg"
+ dlprefiles="$dlprefiles $arg"
fi
prev=
continue
@@ -5273,8 +1266,10 @@ func_mode_link ()
;;
expsyms)
export_symbols="$arg"
- test -f "$arg" \
- || func_fatal_error "symbol file \`$arg' does not exist"
+ if test ! -f "$arg"; then
+ $echo "$modename: symbol file \`$arg' does not exist"
+ exit $EXIT_FAILURE
+ fi
prev=
continue
;;
@@ -5283,21 +1278,18 @@ func_mode_link ()
prev=
continue
;;
- framework)
- case $host in
- *-*-darwin*)
- case "$deplibs " in
- *" $qarg.ltframework "*) ;;
- *) func_append deplibs " $qarg.ltframework" # this is fixed later
- ;;
- esac
- ;;
- esac
+ inst_prefix)
+ inst_prefix_dir="$arg"
prev=
continue
;;
- inst_prefix)
- inst_prefix_dir="$arg"
+ precious_regex)
+ precious_files_regex="$arg"
+ prev=
+ continue
+ ;;
+ release)
+ release="-$arg"
prev=
continue
;;
@@ -5305,30 +1297,39 @@ func_mode_link ()
if test -f "$arg"; then
save_arg=$arg
moreargs=
- for fil in `cat "$save_arg"`
+ for fil in `cat $save_arg`
do
-# func_append moreargs " $fil"
+# moreargs="$moreargs $fil"
arg=$fil
# A libtool-controlled object.
# Check to see that this really is a libtool object.
- if func_lalib_unsafe_p "$arg"; then
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
pic_object=
non_pic_object=
# Read the .lo file
- func_source "$arg"
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
- if test -z "$pic_object" ||
+ if test -z "$pic_object" || \
test -z "$non_pic_object" ||
- test "$pic_object" = none &&
+ test "$pic_object" = none && \
test "$non_pic_object" = none; then
- func_fatal_error "cannot find name of object for \`$arg'"
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
fi
# Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
@@ -5336,7 +1337,7 @@ func_mode_link ()
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- func_append dlfiles " $pic_object"
+ dlfiles="$dlfiles $pic_object"
prev=
continue
else
@@ -5348,12 +1349,12 @@ func_mode_link ()
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
- func_append dlprefiles " $pic_object"
+ dlprefiles="$dlprefiles $pic_object"
prev=
fi
# A PIC object.
- func_append libobjs " $pic_object"
+ libobjs="$libobjs $pic_object"
arg="$pic_object"
fi
@@ -5363,7 +1364,7 @@ func_mode_link ()
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
- func_append non_pic_objects " $non_pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
@@ -5371,95 +1372,95 @@ func_mode_link ()
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
- func_append non_pic_objects " $non_pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
- if $opt_dry_run; then
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
+ else
+ # Dry-run case.
+
# Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
-
- func_lo2o "$arg"
- pic_object=$xdir$objdir/$func_lo2o_result
- non_pic_object=$xdir$func_lo2o_result
- func_append libobjs " $pic_object"
- func_append non_pic_objects " $non_pic_object"
- else
- func_fatal_error "\`$arg' is not a valid libtool object"
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
fi
fi
done
else
- func_fatal_error "link input file \`$arg' does not exist"
+ $echo "$modename: link input file \`$save_arg' does not exist"
+ exit $EXIT_FAILURE
fi
arg=$save_arg
prev=
continue
;;
- precious_regex)
- precious_files_regex="$arg"
- prev=
- continue
- ;;
- release)
- release="-$arg"
- prev=
- continue
- ;;
rpath | xrpath)
# We need an absolute path.
case $arg in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
- func_fatal_error "only absolute run-paths are allowed"
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
;;
esac
if test "$prev" = rpath; then
case "$rpath " in
*" $arg "*) ;;
- *) func_append rpath " $arg" ;;
+ *) rpath="$rpath $arg" ;;
esac
else
case "$xrpath " in
*" $arg "*) ;;
- *) func_append xrpath " $arg" ;;
+ *) xrpath="$xrpath $arg" ;;
esac
fi
prev=
continue
;;
- shrext)
- shrext_cmds="$arg"
+ xcompiler)
+ compiler_flags="$compiler_flags $qarg"
prev=
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
continue
;;
- weak)
- func_append weak_libs " $arg"
+ xlinker)
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $wl$qarg"
prev=
+ compile_command="$compile_command $wl$qarg"
+ finalize_command="$finalize_command $wl$qarg"
continue
;;
xcclinker)
- func_append linker_flags " $qarg"
- func_append compiler_flags " $qarg"
+ linker_flags="$linker_flags $qarg"
+ compiler_flags="$compiler_flags $qarg"
prev=
- func_append compile_command " $qarg"
- func_append finalize_command " $qarg"
+ compile_command="$compile_command $qarg"
+ finalize_command="$finalize_command $qarg"
continue
;;
- xcompiler)
- func_append compiler_flags " $qarg"
+ shrext)
+ shrext_cmds="$arg"
prev=
- func_append compile_command " $qarg"
- func_append finalize_command " $qarg"
continue
;;
- xlinker)
- func_append linker_flags " $qarg"
- func_append compiler_flags " $wl$qarg"
+ darwin_framework|darwin_framework_skip)
+ test "$prev" = "darwin_framework" && compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
prev=
- func_append compile_command " $wl$qarg"
- func_append finalize_command " $wl$qarg"
continue
;;
*)
@@ -5475,16 +1476,16 @@ func_mode_link ()
case $arg in
-all-static)
if test -n "$link_static_flag"; then
- # See comment for -static flag below, for more details.
- func_append compile_command " $link_static_flag"
- func_append finalize_command " $link_static_flag"
+ compile_command="$compile_command $link_static_flag"
+ finalize_command="$finalize_command $link_static_flag"
fi
continue
;;
-allow-undefined)
# FIXME: remove this flag sometime in the future.
- func_fatal_error "\`-allow-undefined' must not be used because it is the default"
+ $echo "$modename: \`-allow-undefined' is deprecated because it is the default" 1>&2
+ continue
;;
-avoid-version)
@@ -5492,11 +1493,6 @@ func_mode_link ()
continue
;;
- -bindir)
- prev=bindir
- continue
- ;;
-
-dlopen)
prev=dlfiles
continue
@@ -5514,7 +1510,8 @@ func_mode_link ()
-export-symbols | -export-symbols-regex)
if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
- func_fatal_error "more than one -exported-symbols argument is not allowed"
+ $echo "$modename: more than one -exported-symbols argument is not allowed"
+ exit $EXIT_FAILURE
fi
if test "X$arg" = "X-export-symbols"; then
prev=expsyms
@@ -5524,8 +1521,15 @@ func_mode_link ()
continue
;;
- -framework)
- prev=framework
+ -framework|-arch|-isysroot)
+ case " $CC " in
+ *" ${arg} ${1} "* | *" ${arg} ${1} "*)
+ prev=darwin_framework_skip ;;
+ *) compiler_flags="$compiler_flags $arg"
+ prev=darwin_framework ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
continue
;;
@@ -5539,59 +1543,45 @@ func_mode_link ()
-L[A-Z][A-Z]*:*)
case $with_gcc/$host in
no/*-*-irix* | /*-*-irix*)
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
;;
esac
continue
;;
-L*)
- func_stripname "-L" '' "$arg"
- if test -z "$func_stripname_result"; then
- if test "$#" -gt 0; then
- func_fatal_error "require no space between \`-L' and \`$1'"
- else
- func_fatal_error "need path for \`-L' option"
- fi
- fi
- func_resolve_sysroot "$func_stripname_result"
- dir=$func_resolve_sysroot_result
+ dir=`$echo "X$arg" | $Xsed -e 's/^-L//'`
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
*)
absdir=`cd "$dir" && pwd`
- test -z "$absdir" && \
- func_fatal_error "cannot determine absolute directory name of \`$dir'"
+ if test -z "$absdir"; then
+ $echo "$modename: cannot determine absolute directory name of \`$dir'" 1>&2
+ absdir="$dir"
+ notinst_path="$notinst_path $dir"
+ fi
dir="$absdir"
;;
esac
case "$deplibs " in
- *" -L$dir "* | *" $arg "*)
- # Will only happen for absolute or sysroot arguments
- ;;
+ *" -L$dir "*) ;;
*)
- # Preserve sysroot, but never include relative directories
- case $dir in
- [\\/]* | [A-Za-z]:[\\/]* | =*) func_append deplibs " $arg" ;;
- *) func_append deplibs " -L$dir" ;;
- esac
- func_append lib_search_path " $dir"
+ deplibs="$deplibs -L$dir"
+ lib_search_path="$lib_search_path $dir"
;;
esac
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
- testbindir=`$ECHO "$dir" | $SED 's*/lib$*/bin*'`
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$dir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$dir:"*) ;;
- ::) dllsearchpath=$dir;;
- *) func_append dllsearchpath ":$dir";;
+ *) dllsearchpath="$dllsearchpath:$dir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
- ::) dllsearchpath=$testbindir;;
- *) func_append dllsearchpath ":$testbindir";;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
esac
@@ -5601,7 +1591,7 @@ func_mode_link ()
-l*)
if test "X$arg" = "X-lc" || test "X$arg" = "X-lm"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-beos*)
# These systems don't actually have a C or math library (as such)
continue
;;
@@ -5615,7 +1605,7 @@ func_mode_link ()
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C and math libraries are in the System framework
- func_append deplibs " System.ltframework"
+ deplibs="$deplibs -framework System"
continue
;;
*-*-sco3.2v5* | *-*-sco5v6*)
@@ -5635,40 +1625,62 @@ func_mode_link ()
;;
esac
fi
- func_append deplibs " $arg"
- continue
- ;;
-
- -module)
- module=yes
+ deplibs="$deplibs $arg"
continue
;;
# Tru64 UNIX uses -model [arg] to determine the layout of C++
# classes, name mangling, and exception handling.
- # Darwin uses the -arch flag to determine output architecture.
- -model|-arch|-isysroot|--sysroot)
- func_append compiler_flags " $arg"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
+ -model)
+ compile_command="$compile_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ finalize_command="$finalize_command $arg"
prev=xcompiler
continue
;;
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
- |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
- func_append compiler_flags " $arg"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- case "$new_inherited_linker_flags " in
- *" $arg "*) ;;
- * ) func_append new_inherited_linker_flags " $arg" ;;
- esac
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
+ compiler_flags="$compiler_flags $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
continue
;;
- -multi_module)
- single_module="${wl}-multi_module"
+ -module)
+ module=yes
+ continue
+ ;;
+
+ # -64, -mips[0-9] enable 64-bit mode on the SGI compiler
+ # -r[0-9][0-9]* specifies the processor on the SGI compiler
+ # -xarch=*, -xtarget=* enable 64-bit mode on the Sun compiler
+ # +DA*, +DD* enable 64-bit mode on the HP compiler
+ # -q* pass through compiler args for the IBM compiler
+ # -m* pass through architecture-specific compiler args for GCC
+ # -m*, -t[45]*, -txscale* pass through architecture-specific
+ # compiler args for GCC
+ # -p, -pg, --coverage, -fprofile-* pass through profiling flag for GCC
+ # -F/path gives path to uninstalled frameworks, gcc on darwin
+ # @file GCC response files
+ -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
+ -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*)
+
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
+ compiler_flags="$compiler_flags $arg"
+ continue
+ ;;
+
+ -shrext)
+ prev=shrext
continue
;;
@@ -5679,11 +1691,11 @@ func_mode_link ()
-no-install)
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin* | *-cegcc*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-darwin*)
# The PATH hackery in wrapper scripts is required on Windows
# and Darwin in order for the loader to find any dlls it needs.
- func_warning "\`-no-install' is ignored for $host"
- func_warning "assuming \`-no-fast-install' instead"
+ $echo "$modename: warning: \`-no-install' is ignored for $host" 1>&2
+ $echo "$modename: warning: assuming \`-no-fast-install' instead" 1>&2
fast_install=no
;;
*) no_install=yes ;;
@@ -5724,36 +1736,22 @@ func_mode_link ()
;;
-R*)
- func_stripname '-R' '' "$arg"
- dir=$func_stripname_result
+ dir=`$echo "X$arg" | $Xsed -e 's/^-R//'`
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) ;;
- =*)
- func_stripname '=' '' "$dir"
- dir=$lt_sysroot$func_stripname_result
- ;;
*)
- func_fatal_error "only absolute run-paths are allowed"
+ $echo "$modename: only absolute run-paths are allowed" 1>&2
+ exit $EXIT_FAILURE
;;
esac
case "$xrpath " in
*" $dir "*) ;;
- *) func_append xrpath " $dir" ;;
+ *) xrpath="$xrpath $dir" ;;
esac
continue
;;
- -shared)
- # The effects of -shared are defined in a previous loop.
- continue
- ;;
-
- -shrext)
- prev=shrext
- continue
- ;;
-
-static | -static-libtool-libs)
# The effects of -static are defined in a previous loop.
# We used to do the same as -all-static on platforms that
@@ -5772,49 +1770,47 @@ func_mode_link ()
prev=vinfo
continue
;;
-
-version-number)
prev=vinfo
vinfo_number=yes
continue
;;
- -weak)
- prev=weak
- continue
- ;;
-
-Wc,*)
- func_stripname '-Wc,' '' "$arg"
- args=$func_stripname_result
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wc,//'`
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
- func_quote_for_eval "$flag"
- func_append arg " $func_quote_for_eval_result"
- func_append compiler_flags " $func_quote_for_eval_result"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $flag"
done
IFS="$save_ifs"
- func_stripname ' ' '' "$arg"
- arg=$func_stripname_result
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
;;
-Wl,*)
- func_stripname '-Wl,' '' "$arg"
- args=$func_stripname_result
+ args=`$echo "X$arg" | $Xsed -e "$sed_quote_subst" -e 's/^-Wl,//'`
arg=
save_ifs="$IFS"; IFS=','
for flag in $args; do
IFS="$save_ifs"
- func_quote_for_eval "$flag"
- func_append arg " $wl$func_quote_for_eval_result"
- func_append compiler_flags " $wl$func_quote_for_eval_result"
- func_append linker_flags " $func_quote_for_eval_result"
+ case $flag in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ flag="\"$flag\""
+ ;;
+ esac
+ arg="$arg $wl$flag"
+ compiler_flags="$compiler_flags $wl$flag"
+ linker_flags="$linker_flags $flag"
done
IFS="$save_ifs"
- func_stripname ' ' '' "$arg"
- arg=$func_stripname_result
+ arg=`$echo "X$arg" | $Xsed -e "s/^ //"`
;;
-Xcompiler)
@@ -5832,68 +1828,53 @@ func_mode_link ()
continue
;;
- # -msg_* for osf cc
- -msg_*)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- ;;
-
- # Flags to be passed through unchanged, with rationale:
- # -64, -mips[0-9] enable 64-bit mode for the SGI compiler
- # -r[0-9][0-9]* specify processor for the SGI compiler
- # -xarch=*, -xtarget=* enable 64-bit mode for the Sun compiler
- # +DA*, +DD* enable 64-bit mode for the HP compiler
- # -q* compiler args for the IBM compiler
- # -m*, -t[45]*, -txscale* architecture-specific flags for GCC
- # -F/path path to uninstalled frameworks, gcc on darwin
- # -p, -pg, --coverage, -fprofile-* profiling flags for GCC
- # @file GCC response files
- # -tp=* Portland pgcc target processor selection
- # --sysroot=* for sysroot support
- # -O*, -flto*, -fwhopr*, -fuse-linker-plugin GCC link-time optimization
- -64|-mips[0-9]|-r[0-9][0-9]*|-xarch=*|-xtarget=*|+DA*|+DD*|-q*|-m*| \
- -t[45]*|-txscale*|-p|-pg|--coverage|-fprofile-*|-F*|@*|-tp=*|--sysroot=*| \
- -O*|-flto*|-fwhopr*|-fuse-linker-plugin)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
- func_append compiler_flags " $arg"
- continue
- ;;
-
# Some other compiler flag.
-* | +*)
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
+ # Unknown arguments in both finalize_command and compile_command need
+ # to be aesthetically quoted because they are evaled later.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
;;
*.$objext)
# A standard object.
- func_append objs " $arg"
+ objs="$objs $arg"
;;
*.lo)
# A libtool-controlled object.
# Check to see that this really is a libtool object.
- if func_lalib_unsafe_p "$arg"; then
+ if (${SED} -e '2q' $arg | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
pic_object=
non_pic_object=
# Read the .lo file
- func_source "$arg"
+ # If there is no directory component, then add one.
+ case $arg in
+ */* | *\\*) . $arg ;;
+ *) . ./$arg ;;
+ esac
- if test -z "$pic_object" ||
+ if test -z "$pic_object" || \
test -z "$non_pic_object" ||
- test "$pic_object" = none &&
+ test "$pic_object" = none && \
test "$non_pic_object" = none; then
- func_fatal_error "cannot find name of object for \`$arg'"
+ $echo "$modename: cannot find name of object for \`$arg'" 1>&2
+ exit $EXIT_FAILURE
fi
# Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
if test "$pic_object" != none; then
# Prepend the subdirectory the object is found in.
@@ -5901,7 +1882,7 @@ func_mode_link ()
if test "$prev" = dlfiles; then
if test "$build_libtool_libs" = yes && test "$dlopen_support" = yes; then
- func_append dlfiles " $pic_object"
+ dlfiles="$dlfiles $pic_object"
prev=
continue
else
@@ -5913,12 +1894,12 @@ func_mode_link ()
# CHECK ME: I think I busted this. -Ossama
if test "$prev" = dlprefiles; then
# Preload the old-style object.
- func_append dlprefiles " $pic_object"
+ dlprefiles="$dlprefiles $pic_object"
prev=
fi
# A PIC object.
- func_append libobjs " $pic_object"
+ libobjs="$libobjs $pic_object"
arg="$pic_object"
fi
@@ -5928,7 +1909,7 @@ func_mode_link ()
non_pic_object="$xdir$non_pic_object"
# A standard non-PIC object
- func_append non_pic_objects " $non_pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
if test -z "$pic_object" || test "$pic_object" = none ; then
arg="$non_pic_object"
fi
@@ -5936,47 +1917,52 @@ func_mode_link ()
# If the PIC object exists, use it instead.
# $xdir was prepended to $pic_object above.
non_pic_object="$pic_object"
- func_append non_pic_objects " $non_pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
fi
else
# Only an error if not doing a dry-run.
- if $opt_dry_run; then
- # Extract subdirectory from the argument.
- func_dirname "$arg" "/" ""
- xdir="$func_dirname_result"
-
- func_lo2o "$arg"
- pic_object=$xdir$objdir/$func_lo2o_result
- non_pic_object=$xdir$func_lo2o_result
- func_append libobjs " $pic_object"
- func_append non_pic_objects " $non_pic_object"
+ if test -z "$run"; then
+ $echo "$modename: \`$arg' is not a valid libtool object" 1>&2
+ exit $EXIT_FAILURE
else
- func_fatal_error "\`$arg' is not a valid libtool object"
+ # Dry-run case.
+
+ # Extract subdirectory from the argument.
+ xdir=`$echo "X$arg" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$xdir" = "X$arg"; then
+ xdir=
+ else
+ xdir="$xdir/"
+ fi
+
+ pic_object=`$echo "X${xdir}${objdir}/${arg}" | $Xsed -e "$lo2o"`
+ non_pic_object=`$echo "X${xdir}${arg}" | $Xsed -e "$lo2o"`
+ libobjs="$libobjs $pic_object"
+ non_pic_objects="$non_pic_objects $non_pic_object"
fi
fi
;;
*.$libext)
# An archive.
- func_append deplibs " $arg"
- func_append old_deplibs " $arg"
+ deplibs="$deplibs $arg"
+ old_deplibs="$old_deplibs $arg"
continue
;;
*.la)
# A libtool-controlled library.
- func_resolve_sysroot "$arg"
if test "$prev" = dlfiles; then
# This library was specified with -dlopen.
- func_append dlfiles " $func_resolve_sysroot_result"
+ dlfiles="$dlfiles $arg"
prev=
elif test "$prev" = dlprefiles; then
# The library was specified with -dlpreopen.
- func_append dlprefiles " $func_resolve_sysroot_result"
+ dlprefiles="$dlprefiles $arg"
prev=
else
- func_append deplibs " $func_resolve_sysroot_result"
+ deplibs="$deplibs $arg"
fi
continue
;;
@@ -5985,53 +1971,70 @@ func_mode_link ()
*)
# Unknown arguments in both finalize_command and compile_command need
# to be aesthetically quoted because they are evaled later.
- func_quote_for_eval "$arg"
- arg="$func_quote_for_eval_result"
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
;;
esac # arg
# Now actually substitute the argument into the commands.
if test -n "$arg"; then
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
fi
done # argument parsing loop
- test -n "$prev" && \
- func_fatal_help "the \`$prevarg' option requires an argument"
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prevarg' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then
eval arg=\"$export_dynamic_flag_spec\"
- func_append compile_command " $arg"
- func_append finalize_command " $arg"
+ compile_command="$compile_command $arg"
+ finalize_command="$finalize_command $arg"
fi
oldlibs=
# calculate the name of the file, without its directory
- func_basename "$output"
- outputname="$func_basename_result"
+ outputname=`$echo "X$output" | $Xsed -e 's%^.*/%%'`
libobjs_save="$libobjs"
if test -n "$shlibpath_var"; then
# get the directories listed in $shlibpath_var
- eval shlib_search_path=\`\$ECHO \"\${$shlibpath_var}\" \| \$SED \'s/:/ /g\'\`
+ eval shlib_search_path=\`\$echo \"X\${$shlibpath_var}\" \| \$Xsed -e \'s/:/ /g\'\`
else
shlib_search_path=
fi
eval sys_lib_search_path=\"$sys_lib_search_path_spec\"
eval sys_lib_dlsearch_path=\"$sys_lib_dlsearch_path_spec\"
- func_dirname "$output" "/" ""
- output_objdir="$func_dirname_result$objdir"
- func_to_tool_file "$output_objdir/"
- tool_output_objdir=$func_to_tool_file_result
+ output_objdir=`$echo "X$output" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$output_objdir" = "X$output"; then
+ output_objdir="$objdir"
+ else
+ output_objdir="$output_objdir/$objdir"
+ fi
# Create the object directory.
- func_mkdir_p "$output_objdir"
+ if test ! -d "$output_objdir"; then
+ $show "$mkdir $output_objdir"
+ $run $mkdir $output_objdir
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$output_objdir"; then
+ exit $exit_status
+ fi
+ fi
# Determine the type of output
case $output in
"")
- func_fatal_help "you must specify an output file"
+ $echo "$modename: you must specify an output file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
;;
*.$libext) linkmode=oldlib ;;
*.lo | *.$objext) linkmode=obj ;;
@@ -6039,18 +2042,27 @@ func_mode_link ()
*) linkmode=prog ;; # Anything else should be a program.
esac
+ case $host in
+ *cygwin* | *mingw* | *pw32*)
+ # don't eliminate duplications in $postdeps and $predeps
+ duplicate_compiler_generated_deps=yes
+ ;;
+ *)
+ duplicate_compiler_generated_deps=$duplicate_deps
+ ;;
+ esac
specialdeplibs=
libs=
# Find all interdependent deplibs by searching for libraries
# that are linked more than once (e.g. -la -lb -la)
for deplib in $deplibs; do
- if $opt_preserve_dup_deps ; then
+ if test "X$duplicate_deps" = "Xyes" ; then
case "$libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
fi
- func_append libs " $deplib"
+ libs="$libs $deplib"
done
if test "$linkmode" = lib; then
@@ -6060,12 +2072,12 @@ func_mode_link ()
# $postdeps and mark them as special (i.e., whose duplicates are
# not to be eliminated).
pre_post_deps=
- if $opt_duplicate_compiler_generated_deps; then
+ if test "X$duplicate_compiler_generated_deps" = "Xyes" ; then
for pre_post_dep in $predeps $postdeps; do
case "$pre_post_deps " in
- *" $pre_post_dep "*) func_append specialdeplibs " $pre_post_deps" ;;
+ *" $pre_post_dep "*) specialdeplibs="$specialdeplibs $pre_post_deps" ;;
esac
- func_append pre_post_deps " $pre_post_dep"
+ pre_post_deps="$pre_post_deps $pre_post_dep"
done
fi
pre_post_deps=
@@ -6076,16 +2088,15 @@ func_mode_link ()
newlib_search_path=
need_relink=no # whether we're linking any uninstalled libtool libraries
notinst_deplibs= # not-installed libtool libraries
- notinst_path= # paths that contain not-installed libtool libraries
-
case $linkmode in
lib)
- passes="conv dlpreopen link"
+ passes="conv link"
for file in $dlfiles $dlprefiles; do
case $file in
*.la) ;;
*)
- func_fatal_help "libraries can \`-dlopen' only libtool libraries: $file"
+ $echo "$modename: libraries can \`-dlopen' only libtool libraries: $file" 1>&2
+ exit $EXIT_FAILURE
;;
esac
done
@@ -6101,20 +2112,7 @@ func_mode_link ()
*) passes="conv"
;;
esac
-
for pass in $passes; do
- # The preopen pass in lib mode reverses $deplibs; put it back here
- # so that -L comes before libs that need it for instance...
- if test "$linkmode,$pass" = "lib,link"; then
- ## FIXME: Find the place where the list is rebuilt in the wrong
- ## order, and fix it there properly
- tmp_deplibs=
- for deplib in $deplibs; do
- tmp_deplibs="$deplib $tmp_deplibs"
- done
- deplibs="$tmp_deplibs"
- fi
-
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan"; then
libs="$deplibs"
@@ -6127,68 +2125,31 @@ func_mode_link ()
link) libs="$deplibs %DEPLIBS% $dependency_libs" ;;
esac
fi
- if test "$linkmode,$pass" = "lib,dlpreopen"; then
- # Collect and forward deplibs of preopened libtool libs
- for lib in $dlprefiles; do
- # Ignore non-libtool-libs
- dependency_libs=
- func_resolve_sysroot "$lib"
- case $lib in
- *.la) func_source "$func_resolve_sysroot_result" ;;
- esac
-
- # Collect preopened libtool deplibs, except any this library
- # has declared as weak libs
- for deplib in $dependency_libs; do
- func_basename "$deplib"
- deplib_base=$func_basename_result
- case " $weak_libs " in
- *" $deplib_base "*) ;;
- *) func_append deplibs " $deplib" ;;
- esac
- done
- done
- libs="$dlprefiles"
- fi
if test "$pass" = dlopen; then
# Collect dlpreopened libraries
save_deplibs="$deplibs"
deplibs=
fi
-
for deplib in $libs; do
lib=
found=no
case $deplib in
- -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
- |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
+ -mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe|-threads)
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- func_append compiler_flags " $deplib"
- if test "$linkmode" = lib ; then
- case "$new_inherited_linker_flags " in
- *" $deplib "*) ;;
- * ) func_append new_inherited_linker_flags " $deplib" ;;
- esac
- fi
+ compiler_flags="$compiler_flags $deplib"
fi
continue
;;
-l*)
if test "$linkmode" != lib && test "$linkmode" != prog; then
- func_warning "\`-l' is ignored for archives/objects"
+ $echo "$modename: warning: \`-l' is ignored for archives/objects" 1>&2
continue
fi
- func_stripname '-l' '' "$deplib"
- name=$func_stripname_result
- if test "$linkmode" = lib; then
- searchdirs="$newlib_search_path $lib_search_path $compiler_lib_search_dirs $sys_lib_search_path $shlib_search_path"
- else
- searchdirs="$newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path"
- fi
- for searchdir in $searchdirs; do
+ name=`$echo "X$deplib" | $Xsed -e 's/^-l//'`
+ for searchdir in $newlib_search_path $lib_search_path $sys_lib_search_path $shlib_search_path; do
for search_ext in .la $std_shrext .so .a; do
# Search the libtool library
lib="$searchdir/lib${name}${search_ext}"
@@ -6218,17 +2179,21 @@ func_mode_link ()
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $deplib "*)
- if func_lalib_p "$lib"; then
+ if (${SED} -e '2q' $lib |
+ grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
library_names=
old_library=
- func_source "$lib"
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
for l in $old_library $library_names; do
ll="$l"
done
if test "X$ll" = "X$old_library" ; then # only static version available
found=no
- func_dirname "$lib" "" "."
- ladir="$func_dirname_result"
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
lib=$ladir/$old_library
if test "$linkmode,$pass" = "prog,link"; then
compile_deplibs="$deplib $compile_deplibs"
@@ -6240,36 +2205,19 @@ func_mode_link ()
continue
fi
fi
- ;;
+ ;;
*) ;;
esac
fi
fi
;; # -l
- *.ltframework)
- if test "$linkmode,$pass" = "prog,link"; then
- compile_deplibs="$deplib $compile_deplibs"
- finalize_deplibs="$deplib $finalize_deplibs"
- else
- deplibs="$deplib $deplibs"
- if test "$linkmode" = lib ; then
- case "$new_inherited_linker_flags " in
- *" $deplib "*) ;;
- * ) func_append new_inherited_linker_flags " $deplib" ;;
- esac
- fi
- fi
- continue
- ;;
-L*)
case $linkmode in
lib)
deplibs="$deplib $deplibs"
test "$pass" = conv && continue
newdependency_libs="$deplib $newdependency_libs"
- func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- func_append newlib_search_path " $func_resolve_sysroot_result"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
;;
prog)
if test "$pass" = conv; then
@@ -6282,34 +2230,27 @@ func_mode_link ()
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
fi
- func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- func_append newlib_search_path " $func_resolve_sysroot_result"
+ newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`
;;
*)
- func_warning "\`-L' is ignored for archives/objects"
+ $echo "$modename: warning: \`-L' is ignored for archives/objects" 1>&2
;;
esac # linkmode
continue
;; # -L
-R*)
if test "$pass" = link; then
- func_stripname '-R' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- dir=$func_resolve_sysroot_result
+ dir=`$echo "X$deplib" | $Xsed -e 's/^-R//'`
# Make sure the xrpath contains only unique directories.
case "$xrpath " in
*" $dir "*) ;;
- *) func_append xrpath " $dir" ;;
+ *) xrpath="$xrpath $dir" ;;
esac
fi
deplibs="$deplib $deplibs"
continue
;;
- *.la)
- func_resolve_sysroot "$deplib"
- lib=$func_resolve_sysroot_result
- ;;
+ *.la) lib="$deplib" ;;
*.$libext)
if test "$pass" = conv; then
deplibs="$deplib $deplibs"
@@ -6317,41 +2258,35 @@ func_mode_link ()
fi
case $linkmode in
lib)
- # Linking convenience modules into shared libraries is allowed,
- # but linking other static libraries is non-portable.
- case " $dlpreconveniencelibs " in
- *" $deplib "*) ;;
- *)
- valid_a_lib=no
- case $deplibs_check_method in
- match_pattern*)
- set dummy $deplibs_check_method; shift
- match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
- if eval "\$ECHO \"$deplib\"" 2>/dev/null | $SED 10q \
+ valid_a_lib=no
+ case $deplibs_check_method in
+ match_pattern*)
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
+ if eval $echo \"$deplib\" 2>/dev/null \
+ | $SED 10q \
| $EGREP "$match_pattern_regex" > /dev/null; then
- valid_a_lib=yes
- fi
- ;;
- pass_all)
valid_a_lib=yes
+ fi
;;
- esac
- if test "$valid_a_lib" != yes; then
- echo
- $ECHO "*** Warning: Trying to link with static lib archive $deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because the file extensions .$libext of this argument makes me believe"
- echo "*** that it is just a static archive that I should not use here."
- else
- echo
- $ECHO "*** Warning: Linking the shared library $output against the"
- $ECHO "*** static library $deplib is not portable!"
- deplibs="$deplib $deplibs"
- fi
- ;;
- esac
+ pass_all)
+ valid_a_lib=yes
+ ;;
+ esac
+ if test "$valid_a_lib" != yes; then
+ $echo
+ $echo "*** Warning: Trying to link with static lib archive $deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because the file extensions .$libext of this argument makes me believe"
+ $echo "*** that it is just a static archive that I should not used here."
+ else
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the"
+ $echo "*** static library $deplib is not portable!"
+ deplibs="$deplib $deplibs"
+ fi
continue
;;
prog)
@@ -6372,11 +2307,11 @@ func_mode_link ()
if test "$pass" = dlpreopen || test "$dlopen_support" != yes || test "$build_libtool_libs" = no; then
# If there is no dlopen support or we're linking statically,
# we need to preload.
- func_append newdlprefiles " $deplib"
+ newdlprefiles="$newdlprefiles $deplib"
compile_deplibs="$deplib $compile_deplibs"
finalize_deplibs="$deplib $finalize_deplibs"
else
- func_append newdlfiles " $deplib"
+ newdlfiles="$newdlfiles $deplib"
fi
fi
continue
@@ -6386,18 +2321,21 @@ func_mode_link ()
continue
;;
esac # case $deplib
-
if test "$found" = yes || test -f "$lib"; then :
else
- func_fatal_error "cannot find the library \`$lib' or unhandled argument \`$deplib'"
+ $echo "$modename: cannot find the library \`$lib' or unhandled argument \`$deplib'" 1>&2
+ exit $EXIT_FAILURE
fi
# Check to see that this really is a libtool archive.
- func_lalib_unsafe_p "$lib" \
- || func_fatal_error "\`$lib' is not a valid libtool archive"
+ if (${SED} -e '2q' $lib | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
- func_dirname "$lib" "" "."
- ladir="$func_dirname_result"
+ ladir=`$echo "X$lib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$ladir" = "X$lib" && ladir="."
dlname=
dlopen=
@@ -6405,7 +2343,6 @@ func_mode_link ()
libdir=
library_names=
old_library=
- inherited_linker_flags=
# If the library was installed with an old release of libtool,
# it will not redefine variables installed, or shouldnotlink
installed=yes
@@ -6414,24 +2351,16 @@ func_mode_link ()
# Read the .la file
- func_source "$lib"
-
- # Convert "-framework foo" to "foo.ltframework"
- if test -n "$inherited_linker_flags"; then
- tmp_inherited_linker_flags=`$ECHO "$inherited_linker_flags" | $SED 's/-framework \([^ $]*\)/\1.ltframework/g'`
- for tmp_inherited_linker_flag in $tmp_inherited_linker_flags; do
- case " $new_inherited_linker_flags " in
- *" $tmp_inherited_linker_flag "*) ;;
- *) func_append new_inherited_linker_flags " $tmp_inherited_linker_flag";;
- esac
- done
- fi
- dependency_libs=`$ECHO " $dependency_libs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+
if test "$linkmode,$pass" = "lib,link" ||
test "$linkmode,$pass" = "prog,scan" ||
{ test "$linkmode" != prog && test "$linkmode" != lib; }; then
- test -n "$dlopen" && func_append dlfiles " $dlopen"
- test -n "$dlpreopen" && func_append dlprefiles " $dlpreopen"
+ test -n "$dlopen" && dlfiles="$dlfiles $dlopen"
+ test -n "$dlpreopen" && dlprefiles="$dlprefiles $dlpreopen"
fi
if test "$pass" = conv; then
@@ -6439,47 +2368,45 @@ func_mode_link ()
deplibs="$lib $deplibs"
if test -z "$libdir"; then
if test -z "$old_library"; then
- func_fatal_error "cannot find name of link library for \`$lib'"
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
fi
# It is a libtool convenience library, so add in its objects.
- func_append convenience " $ladir/$objdir/$old_library"
- func_append old_convenience " $ladir/$objdir/$old_library"
+ convenience="$convenience $ladir/$objdir/$old_library"
+ old_convenience="$old_convenience $ladir/$objdir/$old_library"
+ tmp_libs=
+ for deplib in $dependency_libs; do
+ deplibs="$deplib $deplibs"
+ if test "X$duplicate_deps" = "Xyes" ; then
+ case "$tmp_libs " in
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
+ esac
+ fi
+ tmp_libs="$tmp_libs $deplib"
+ done
elif test "$linkmode" != prog && test "$linkmode" != lib; then
- func_fatal_error "\`$lib' is not a convenience library"
+ $echo "$modename: \`$lib' is not a convenience library" 1>&2
+ exit $EXIT_FAILURE
fi
- tmp_libs=
- for deplib in $dependency_libs; do
- deplibs="$deplib $deplibs"
- if $opt_preserve_dup_deps ; then
- case "$tmp_libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
- esac
- fi
- func_append tmp_libs " $deplib"
- done
continue
fi # $pass = conv
# Get the name of the library we link against.
linklib=
- if test -n "$old_library" &&
- { test "$prefer_static_libs" = yes ||
- test "$prefer_static_libs,$installed" = "built,no"; }; then
- linklib=$old_library
- else
- for l in $old_library $library_names; do
- linklib="$l"
- done
- fi
+ for l in $old_library $library_names; do
+ linklib="$l"
+ done
if test -z "$linklib"; then
- func_fatal_error "cannot find name of link library for \`$lib'"
+ $echo "$modename: cannot find name of link library for \`$lib'" 1>&2
+ exit $EXIT_FAILURE
fi
# This library was specified with -dlopen.
if test "$pass" = dlopen; then
if test -z "$libdir"; then
- func_fatal_error "cannot -dlopen a convenience library: \`$lib'"
+ $echo "$modename: cannot -dlopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
fi
if test -z "$dlname" ||
test "$dlopen_support" != yes ||
@@ -6488,9 +2415,9 @@ func_mode_link ()
# statically, we need to preload. We also need to preload any
# dependent libraries so libltdl's deplib preloader doesn't
# bomb out in the load deplibs phase.
- func_append dlprefiles " $lib $dependency_libs"
+ dlprefiles="$dlprefiles $lib $dependency_libs"
else
- func_append newdlfiles " $lib"
+ newdlfiles="$newdlfiles $lib"
fi
continue
fi # $pass = dlopen
@@ -6501,25 +2428,24 @@ func_mode_link ()
*)
abs_ladir=`cd "$ladir" && pwd`
if test -z "$abs_ladir"; then
- func_warning "cannot determine absolute directory name of \`$ladir'"
- func_warning "passing it literally to the linker, although it might fail"
+ $echo "$modename: warning: cannot determine absolute directory name of \`$ladir'" 1>&2
+ $echo "$modename: passing it literally to the linker, although it might fail" 1>&2
abs_ladir="$ladir"
fi
;;
esac
- func_basename "$lib"
- laname="$func_basename_result"
+ laname=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
# Find the relevant object directory and library name.
if test "X$installed" = Xyes; then
- if test ! -f "$lt_sysroot$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
- func_warning "library \`$lib' was moved."
+ if test ! -f "$libdir/$linklib" && test -f "$abs_ladir/$linklib"; then
+ $echo "$modename: warning: library \`$lib' was moved." 1>&2
dir="$ladir"
absdir="$abs_ladir"
libdir="$abs_ladir"
else
- dir="$lt_sysroot$libdir"
- absdir="$lt_sysroot$libdir"
+ dir="$libdir"
+ absdir="$libdir"
fi
test "X$hardcode_automatic" = Xyes && avoidtemprpath=yes
else
@@ -6527,62 +2453,32 @@ func_mode_link ()
dir="$ladir"
absdir="$abs_ladir"
# Remove this search path later
- func_append notinst_path " $abs_ladir"
+ notinst_path="$notinst_path $abs_ladir"
else
dir="$ladir/$objdir"
absdir="$abs_ladir/$objdir"
# Remove this search path later
- func_append notinst_path " $abs_ladir"
+ notinst_path="$notinst_path $abs_ladir"
fi
fi # $installed = yes
- func_stripname 'lib' '.la' "$laname"
- name=$func_stripname_result
+ name=`$echo "X$laname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
# This library was specified with -dlpreopen.
if test "$pass" = dlpreopen; then
- if test -z "$libdir" && test "$linkmode" = prog; then
- func_fatal_error "only libraries may -dlpreopen a convenience library: \`$lib'"
+ if test -z "$libdir"; then
+ $echo "$modename: cannot -dlpreopen a convenience library: \`$lib'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ # Prefer using a static library (so that no silly _DYNAMIC symbols
+ # are required to link).
+ if test -n "$old_library"; then
+ newdlprefiles="$newdlprefiles $dir/$old_library"
+ # Otherwise, use the dlname, so that lt_dlopen finds it.
+ elif test -n "$dlname"; then
+ newdlprefiles="$newdlprefiles $dir/$dlname"
+ else
+ newdlprefiles="$newdlprefiles $dir/$linklib"
fi
- case "$host" in
- # special handling for platforms with PE-DLLs.
- *cygwin* | *mingw* | *cegcc* )
- # Linker will automatically link against shared library if both
- # static and shared are present. Therefore, ensure we extract
- # symbols from the import library if a shared library is present
- # (otherwise, the dlopen module name will be incorrect). We do
- # this by putting the import library name into $newdlprefiles.
- # We recover the dlopen module name by 'saving' the la file
- # name in a special purpose variable, and (later) extracting the
- # dlname from the la file.
- if test -n "$dlname"; then
- func_tr_sh "$dir/$linklib"
- eval "libfile_$func_tr_sh_result=\$abs_ladir/\$laname"
- func_append newdlprefiles " $dir/$linklib"
- else
- func_append newdlprefiles " $dir/$old_library"
- # Keep a list of preopened convenience libraries to check
- # that they are being used correctly in the link pass.
- test -z "$libdir" && \
- func_append dlpreconveniencelibs " $dir/$old_library"
- fi
- ;;
- * )
- # Prefer using a static library (so that no silly _DYNAMIC symbols
- # are required to link).
- if test -n "$old_library"; then
- func_append newdlprefiles " $dir/$old_library"
- # Keep a list of preopened convenience libraries to check
- # that they are being used correctly in the link pass.
- test -z "$libdir" && \
- func_append dlpreconveniencelibs " $dir/$old_library"
- # Otherwise, use the dlname, so that lt_dlopen finds it.
- elif test -n "$dlname"; then
- func_append newdlprefiles " $dir/$dlname"
- else
- func_append newdlprefiles " $dir/$linklib"
- fi
- ;;
- esac
fi # $pass = dlpreopen
if test -z "$libdir"; then
@@ -6600,7 +2496,7 @@ func_mode_link ()
if test "$linkmode" = prog && test "$pass" != link; then
- func_append newlib_search_path " $ladir"
+ newlib_search_path="$newlib_search_path $ladir"
deplibs="$lib $deplibs"
linkalldeplibs=no
@@ -6612,10 +2508,7 @@ func_mode_link ()
tmp_libs=
for deplib in $dependency_libs; do
case $deplib in
- -L*) func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result"
- func_append newlib_search_path " $func_resolve_sysroot_result"
- ;;
+ -L*) newlib_search_path="$newlib_search_path "`$echo "X$deplib" | $Xsed -e 's/^-L//'`;; ### testsuite: skip nested quoting test
esac
# Need to link against all dependency_libs?
if test "$linkalldeplibs" = yes; then
@@ -6625,12 +2518,12 @@ func_mode_link ()
# or/and link against static libraries
newdependency_libs="$deplib $newdependency_libs"
fi
- if $opt_preserve_dup_deps ; then
+ if test "X$duplicate_deps" = "Xyes" ; then
case "$tmp_libs " in
- *" $deplib "*) func_append specialdeplibs " $deplib" ;;
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
fi
- func_append tmp_libs " $deplib"
+ tmp_libs="$tmp_libs $deplib"
done # for deplib
continue
fi # $linkmode = prog...
@@ -6638,14 +2531,15 @@ func_mode_link ()
if test "$linkmode,$pass" = "prog,link"; then
if test -n "$library_names" &&
{ { test "$prefer_static_libs" = no ||
- test "$prefer_static_libs,$installed" = "built,yes"; } ||
+ test "$prefer_static_libs,$installed" = "built,yes"; } ||
test -z "$old_library"; }; then
# We need to hardcode the library path
if test -n "$shlibpath_var" && test -z "$avoidtemprpath" ; then
# Make sure the rpath contains only unique directories.
- case "$temp_rpath:" in
- *"$absdir:"*) ;;
- *) func_append temp_rpath "$absdir:" ;;
+ case "$temp_rpath " in
+ *" $dir "*) ;;
+ *" $absdir "*) ;;
+ *) temp_rpath="$temp_rpath $absdir" ;;
esac
fi
@@ -6657,7 +2551,7 @@ func_mode_link ()
*)
case "$compile_rpath " in
*" $absdir "*) ;;
- *) func_append compile_rpath " $absdir" ;;
+ *) compile_rpath="$compile_rpath $absdir"
esac
;;
esac
@@ -6666,7 +2560,7 @@ func_mode_link ()
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
esac
;;
esac
@@ -6683,43 +2577,27 @@ func_mode_link ()
link_static=no # Whether the deplib will be linked statically
use_static_libs=$prefer_static_libs
- if test "$use_static_libs" = built && test "$installed" = yes; then
+ if test "$use_static_libs" = built && test "$installed" = yes ; then
use_static_libs=no
fi
if test -n "$library_names" &&
{ test "$use_static_libs" = no || test -z "$old_library"; }; then
- case $host in
- *cygwin* | *mingw* | *cegcc*)
- # No point in relinking DLLs because paths are not encoded
- func_append notinst_deplibs " $lib"
- need_relink=no
- ;;
- *)
- if test "$installed" = no; then
- func_append notinst_deplibs " $lib"
- need_relink=yes
- fi
- ;;
- esac
+ if test "$installed" = no; then
+ notinst_deplibs="$notinst_deplibs $lib"
+ need_relink=yes
+ fi
# This is a shared library
- # Warn about portability, can't link against -module's on some
- # systems (darwin). Don't bleat about dlopened modules though!
- dlopenmodule=""
- for dlpremoduletest in $dlprefiles; do
- if test "X$dlpremoduletest" = "X$lib"; then
- dlopenmodule="$dlpremoduletest"
- break
- fi
- done
- if test -z "$dlopenmodule" && test "$shouldnotlink" = yes && test "$pass" = link; then
- echo
+ # Warn about portability, can't link against -module's on
+ # some systems (darwin)
+ if test "$shouldnotlink" = yes && test "$pass" = link ; then
+ $echo
if test "$linkmode" = prog; then
- $ECHO "*** Warning: Linking the executable $output against the loadable module"
+ $echo "*** Warning: Linking the executable $output against the loadable module"
else
- $ECHO "*** Warning: Linking the shared library $output against the loadable module"
+ $echo "*** Warning: Linking the shared library $output against the loadable module"
fi
- $ECHO "*** $linklib is not portable!"
+ $echo "*** $linklib is not portable!"
fi
if test "$linkmode" = lib &&
test "$hardcode_into_libs" = yes; then
@@ -6731,7 +2609,7 @@ func_mode_link ()
*)
case "$compile_rpath " in
*" $absdir "*) ;;
- *) func_append compile_rpath " $absdir" ;;
+ *) compile_rpath="$compile_rpath $absdir"
esac
;;
esac
@@ -6740,7 +2618,7 @@ func_mode_link ()
*)
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir"
esac
;;
esac
@@ -6749,19 +2627,17 @@ func_mode_link ()
if test -n "$old_archive_from_expsyms_cmds"; then
# figure out the soname
set dummy $library_names
- shift
- realname="$1"
- shift
- libname=`eval "\\$ECHO \"$libname_spec\""`
+ realname="$2"
+ shift; shift
+ libname=`eval \\$echo \"$libname_spec\"`
# use dlname if we got it. it's perfectly good, no?
if test -n "$dlname"; then
soname="$dlname"
elif test -n "$soname_spec"; then
# bleh windows
case $host in
- *cygwin* | mingw* | *cegcc*)
- func_arith $current - $age
- major=$func_arith_result
+ *cygwin* | mingw*)
+ major=`expr $current - $age`
versuffix="-$major"
;;
esac
@@ -6772,29 +2648,43 @@ func_mode_link ()
# Make a new name for the extract_expsyms_cmds to use
soroot="$soname"
- func_basename "$soroot"
- soname="$func_basename_result"
- func_stripname 'lib' '.dll' "$soname"
- newlib=libimp-$func_stripname_result.a
+ soname=`$echo $soroot | ${SED} -e 's/^.*\///'`
+ newlib="libimp-`$echo $soname | ${SED} 's/^lib//;s/\.dll$//'`.a"
# If the library has no export list, then create one now
if test -f "$output_objdir/$soname-def"; then :
else
- func_verbose "extracting exported symbol list from \`$soname'"
- func_execute_cmds "$extract_expsyms_cmds" 'exit $?'
+ $show "extracting exported symbol list from \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$extract_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
fi
# Create $newlib
if test -f "$output_objdir/$newlib"; then :; else
- func_verbose "generating import library for \`$soname'"
- func_execute_cmds "$old_archive_from_expsyms_cmds" 'exit $?'
+ $show "generating import library for \`$soname'"
+ save_ifs="$IFS"; IFS='~'
+ cmds=$old_archive_from_expsyms_cmds
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
fi
# make sure the library variables are pointing to the new library
dir=$output_objdir
linklib=$newlib
fi # test -n "$old_archive_from_expsyms_cmds"
- if test "$linkmode" = prog || test "$opt_mode" != relink; then
+ if test "$linkmode" = prog || test "$mode" != relink; then
add_shlibpath=
add_dir=
add=
@@ -6809,21 +2699,17 @@ func_mode_link ()
*-*-sysv5OpenUNIX* | *-*-sysv5UnixWare7.[01].[10]* | \
*-*-unixware7*) add_dir="-L$dir" ;;
*-*-darwin* )
- # if the lib is a (non-dlopened) module then we can not
- # link against it, someone is ignoring the earlier warnings
+ # if the lib is a module then we can not link against
+ # it, someone is ignoring the new warnings I added
if /usr/bin/file -L $add 2> /dev/null |
- $GREP ": [^:]* bundle" >/dev/null ; then
- if test "X$dlopenmodule" != "X$lib"; then
- $ECHO "*** Warning: lib $linklib is a module, not a shared library"
- if test -z "$old_library" ; then
- echo
- echo "*** And there doesn't seem to be a static archive available"
- echo "*** The link will probably fail, sorry"
- else
- add="$dir/$old_library"
- fi
- elif test -n "$old_library"; then
- add="$dir/$old_library"
+ $EGREP ": [^:]* bundle" >/dev/null ; then
+ $echo "** Warning, lib $linklib is a module, not a shared library"
+ if test -z "$old_library" ; then
+ $echo
+ $echo "** And there doesn't seem to be a static archive available"
+ $echo "** The link will probably fail, sorry"
+ else
+ add="$dir/$old_library"
fi
fi
esac
@@ -6841,16 +2727,15 @@ func_mode_link ()
fi
;;
relink)
- if test "$hardcode_direct" = yes &&
- test "$hardcode_direct_absolute" = no; then
+ if test "$hardcode_direct" = yes; then
add="$dir/$linklib"
elif test "$hardcode_minus_L" = yes; then
- add_dir="-L$absdir"
+ add_dir="-L$dir"
# Try looking first in the location we're being installed to.
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
- func_append add_dir " -L$inst_prefix_dir$libdir"
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
esac
fi
@@ -6866,13 +2751,14 @@ func_mode_link ()
esac
if test "$lib_linked" != yes; then
- func_fatal_configuration "unsupported hardcode properties"
+ $echo "$modename: configuration error: unsupported hardcode properties"
+ exit $EXIT_FAILURE
fi
if test -n "$add_shlibpath"; then
case :$compile_shlibpath: in
*":$add_shlibpath:"*) ;;
- *) func_append compile_shlibpath "$add_shlibpath:" ;;
+ *) compile_shlibpath="$compile_shlibpath$add_shlibpath:" ;;
esac
fi
if test "$linkmode" = prog; then
@@ -6881,24 +2767,23 @@ func_mode_link ()
else
test -n "$add_dir" && deplibs="$add_dir $deplibs"
test -n "$add" && deplibs="$add $deplibs"
- if test "$hardcode_direct" != yes &&
- test "$hardcode_minus_L" != yes &&
+ if test "$hardcode_direct" != yes && \
+ test "$hardcode_minus_L" != yes && \
test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
- *) func_append finalize_shlibpath "$libdir:" ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
esac
fi
fi
fi
- if test "$linkmode" = prog || test "$opt_mode" = relink; then
+ if test "$linkmode" = prog || test "$mode" = relink; then
add_shlibpath=
add_dir=
add=
# Finalize command for both is simple: just hardcode it.
- if test "$hardcode_direct" = yes &&
- test "$hardcode_direct_absolute" = no; then
+ if test "$hardcode_direct" = yes; then
add="$libdir/$linklib"
elif test "$hardcode_minus_L" = yes; then
add_dir="-L$libdir"
@@ -6906,15 +2791,15 @@ func_mode_link ()
elif test "$hardcode_shlibpath_var" = yes; then
case :$finalize_shlibpath: in
*":$libdir:"*) ;;
- *) func_append finalize_shlibpath "$libdir:" ;;
+ *) finalize_shlibpath="$finalize_shlibpath$libdir:" ;;
esac
add="-l$name"
elif test "$hardcode_automatic" = yes; then
if test -n "$inst_prefix_dir" &&
test -f "$inst_prefix_dir$libdir/$linklib" ; then
- add="$inst_prefix_dir$libdir/$linklib"
+ add="$inst_prefix_dir$libdir/$linklib"
else
- add="$libdir/$linklib"
+ add="$libdir/$linklib"
fi
else
# We cannot seem to hardcode it, guess we'll fake it.
@@ -6923,7 +2808,7 @@ func_mode_link ()
if test -n "$inst_prefix_dir"; then
case $libdir in
[\\/]*)
- func_append add_dir " -L$inst_prefix_dir$libdir"
+ add_dir="$add_dir -L$inst_prefix_dir$libdir"
;;
esac
fi
@@ -6958,21 +2843,21 @@ func_mode_link ()
# Just print a warning and add the library to dependency_libs so
# that the program can be linked against the static library.
- echo
- $ECHO "*** Warning: This system can not link to static lib archive $lib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have."
+ $echo
+ $echo "*** Warning: This system can not link to static lib archive $lib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have."
if test "$module" = yes; then
- echo "*** But as you try to build a module library, libtool will still create "
- echo "*** a static module, that should work as long as the dlopening application"
- echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
+ $echo "*** But as you try to build a module library, libtool will still create "
+ $echo "*** a static module, that should work as long as the dlopening application"
+ $echo "*** is linked with the -dlopen flag to resolve symbols at runtime."
if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
build_libtool_libs=module
@@ -6996,113 +2881,120 @@ func_mode_link ()
temp_deplibs=
for libdir in $dependency_libs; do
case $libdir in
- -R*) func_stripname '-R' '' "$libdir"
- temp_xrpath=$func_stripname_result
+ -R*) temp_xrpath=`$echo "X$libdir" | $Xsed -e 's/^-R//'`
case " $xrpath " in
*" $temp_xrpath "*) ;;
- *) func_append xrpath " $temp_xrpath";;
+ *) xrpath="$xrpath $temp_xrpath";;
esac;;
- *) func_append temp_deplibs " $libdir";;
+ *) temp_deplibs="$temp_deplibs $libdir";;
esac
done
dependency_libs="$temp_deplibs"
fi
- func_append newlib_search_path " $absdir"
+ newlib_search_path="$newlib_search_path $absdir"
# Link against this library
test "$link_static" = no && newdependency_libs="$abs_ladir/$laname $newdependency_libs"
# ... and its dependency_libs
tmp_libs=
for deplib in $dependency_libs; do
newdependency_libs="$deplib $newdependency_libs"
- case $deplib in
- -L*) func_stripname '-L' '' "$deplib"
- func_resolve_sysroot "$func_stripname_result";;
- *) func_resolve_sysroot "$deplib" ;;
- esac
- if $opt_preserve_dup_deps ; then
+ if test "X$duplicate_deps" = "Xyes" ; then
case "$tmp_libs " in
- *" $func_resolve_sysroot_result "*)
- func_append specialdeplibs " $func_resolve_sysroot_result" ;;
+ *" $deplib "*) specialdeplibs="$specialdeplibs $deplib" ;;
esac
fi
- func_append tmp_libs " $func_resolve_sysroot_result"
+ tmp_libs="$tmp_libs $deplib"
done
if test "$link_all_deplibs" != no; then
# Add the search paths of all dependency libraries
for deplib in $dependency_libs; do
- path=
case $deplib in
-L*) path="$deplib" ;;
*.la)
- func_resolve_sysroot "$deplib"
- deplib=$func_resolve_sysroot_result
- func_dirname "$deplib" "" "."
- dir=$func_dirname_result
+ dir=`$echo "X$deplib" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$deplib" && dir="."
# We need an absolute path.
case $dir in
[\\/]* | [A-Za-z]:[\\/]*) absdir="$dir" ;;
*)
absdir=`cd "$dir" && pwd`
if test -z "$absdir"; then
- func_warning "cannot determine absolute directory name of \`$dir'"
+ $echo "$modename: warning: cannot determine absolute directory name of \`$dir'" 1>&2
absdir="$dir"
fi
;;
esac
- if $GREP "^installed=no" $deplib > /dev/null; then
+ if grep "^installed=no" $deplib > /dev/null; then
+ path="$absdir/$objdir"
+ else
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ if test "$absdir" != "$libdir"; then
+ $echo "$modename: warning: \`$deplib' seems to be moved" 1>&2
+ fi
+ path="$absdir"
+ fi
+ depdepl=
case $host in
*-*-darwin*)
- depdepl=
+ # we do not want to link against static libs,
+ # but need to link against shared
eval deplibrary_names=`${SED} -n -e 's/^library_names=\(.*\)$/\1/p' $deplib`
if test -n "$deplibrary_names" ; then
for tmp in $deplibrary_names ; do
depdepl=$tmp
done
- if test -f "$absdir/$objdir/$depdepl" ; then
- depdepl="$absdir/$objdir/$depdepl"
- darwin_install_name=`${OTOOL} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
- if test -z "$darwin_install_name"; then
- darwin_install_name=`${OTOOL64} -L $depdepl | awk '{if (NR == 2) {print $1;exit}}'`
- fi
- func_append compiler_flags " ${wl}-dylib_file ${wl}${darwin_install_name}:${depdepl}"
- func_append linker_flags " -dylib_file ${darwin_install_name}:${depdepl}"
- path=
+ if test -f "$path/$depdepl" ; then
+ depdepl="$path/$depdepl"
fi
+ # do not add paths which are already there
+ case " $newlib_search_path " in
+ *" $path "*) ;;
+ *) newlib_search_path="$newlib_search_path $path";;
+ esac
fi
+ path=""
;;
*)
- path="-L$absdir/$objdir"
+ path="-L$path"
;;
esac
- else
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
- test -z "$libdir" && \
- func_fatal_error "\`$deplib' is not a valid libtool archive"
- test "$absdir" != "$libdir" && \
- func_warning "\`$deplib' seems to be moved"
-
- path="-L$absdir"
- fi
;;
+ -l*)
+ case $host in
+ *-*-darwin*)
+ # Again, we only want to link against shared libraries
+ eval tmp_libs=`$echo "X$deplib" | $Xsed -e "s,^\-l,,"`
+ for tmp in $newlib_search_path ; do
+ if test -f "$tmp/lib$tmp_libs.dylib" ; then
+ eval depdepl="$tmp/lib$tmp_libs.dylib"
+ break
+ fi
+ done
+ path=""
+ ;;
+ *) continue ;;
+ esac
+ ;;
+ *) continue ;;
esac
case " $deplibs " in
*" $path "*) ;;
*) deplibs="$path $deplibs" ;;
esac
+ case " $deplibs " in
+ *" $depdepl "*) ;;
+ *) deplibs="$depdepl $deplibs" ;;
+ esac
done
fi # link_all_deplibs != no
fi # linkmode = lib
done # for deplib in $libs
- if test "$pass" = link; then
- if test "$linkmode" = "prog"; then
- compile_deplibs="$new_inherited_linker_flags $compile_deplibs"
- finalize_deplibs="$new_inherited_linker_flags $finalize_deplibs"
- else
- compiler_flags="$compiler_flags "`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- fi
- fi
dependency_libs="$newdependency_libs"
if test "$pass" = dlpreopen; then
# Link the dlpreopened libraries before other libraries
@@ -7117,7 +3009,7 @@ func_mode_link ()
for dir in $newlib_search_path; do
case "$lib_search_path " in
*" $dir "*) ;;
- *) func_append lib_search_path " $dir" ;;
+ *) lib_search_path="$lib_search_path $dir" ;;
esac
done
newlib_search_path=
@@ -7175,10 +3067,10 @@ func_mode_link ()
-L*)
case " $tmp_libs " in
*" $deplib "*) ;;
- *) func_append tmp_libs " $deplib" ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
esac
;;
- *) func_append tmp_libs " $deplib" ;;
+ *) tmp_libs="$tmp_libs $deplib" ;;
esac
done
eval $var=\"$tmp_libs\"
@@ -7194,96 +3086,98 @@ func_mode_link ()
;;
esac
if test -n "$i" ; then
- func_append tmp_libs " $i"
+ tmp_libs="$tmp_libs $i"
fi
done
dependency_libs=$tmp_libs
done # for pass
if test "$linkmode" = prog; then
dlfiles="$newdlfiles"
- fi
- if test "$linkmode" = prog || test "$linkmode" = lib; then
dlprefiles="$newdlprefiles"
fi
case $linkmode in
oldlib)
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- func_warning "\`-dlopen' is ignored for archives"
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for archives" 1>&2
fi
- case " $deplibs" in
- *\ -l* | *\ -L*)
- func_warning "\`-l' and \`-L' are ignored for archives" ;;
- esac
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for archives" 1>&2
+ fi
- test -n "$rpath" && \
- func_warning "\`-rpath' is ignored for archives"
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for archives" 1>&2
+ fi
- test -n "$xrpath" && \
- func_warning "\`-R' is ignored for archives"
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for archives" 1>&2
+ fi
- test -n "$vinfo" && \
- func_warning "\`-version-info/-version-number' is ignored for archives"
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for archives" 1>&2
+ fi
- test -n "$release" && \
- func_warning "\`-release' is ignored for archives"
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for archives" 1>&2
+ fi
- test -n "$export_symbols$export_symbols_regex" && \
- func_warning "\`-export-symbols' is ignored for archives"
+ if test -n "$export_symbols" || test -n "$export_symbols_regex"; then
+ $echo "$modename: warning: \`-export-symbols' is ignored for archives" 1>&2
+ fi
# Now set the variables for building old libraries.
build_libtool_libs=no
oldlibs="$output"
- func_append objs "$old_deplibs"
+ objs="$objs$old_deplibs"
;;
lib)
# Make sure we only generate libraries of the form `libNAME.la'.
case $outputname in
lib*)
- func_stripname 'lib' '.la' "$outputname"
- name=$func_stripname_result
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//' -e 's/^lib//'`
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
;;
*)
- test "$module" = no && \
- func_fatal_help "libtool library \`$output' must begin with \`lib'"
-
+ if test "$module" = no; then
+ $echo "$modename: libtool library \`$output' must begin with \`lib'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
if test "$need_lib_prefix" != no; then
# Add the "lib" prefix for modules if required
- func_stripname '' '.la' "$outputname"
- name=$func_stripname_result
+ name=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
eval shared_ext=\"$shrext_cmds\"
eval libname=\"$libname_spec\"
else
- func_stripname '' '.la' "$outputname"
- libname=$func_stripname_result
+ libname=`$echo "X$outputname" | $Xsed -e 's/\.la$//'`
fi
;;
esac
if test -n "$objs"; then
if test "$deplibs_check_method" != pass_all; then
- func_fatal_error "cannot build libtool library \`$output' from non-libtool objects on this host:$objs"
+ $echo "$modename: cannot build libtool library \`$output' from non-libtool objects on this host:$objs" 2>&1
+ exit $EXIT_FAILURE
else
- echo
- $ECHO "*** Warning: Linking the shared library $output against the non-libtool"
- $ECHO "*** objects $objs is not portable!"
- func_append libobjs " $objs"
+ $echo
+ $echo "*** Warning: Linking the shared library $output against the non-libtool"
+ $echo "*** objects $objs is not portable!"
+ libobjs="$libobjs $objs"
fi
fi
- test "$dlself" != no && \
- func_warning "\`-dlopen self' is ignored for libtool libraries"
+ if test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen self' is ignored for libtool libraries" 1>&2
+ fi
set dummy $rpath
- shift
- test "$#" -gt 1 && \
- func_warning "ignoring multiple \`-rpath's for a libtool library"
-
- install_libdir="$1"
+ if test "$#" -gt 2; then
+ $echo "$modename: warning: ignoring multiple \`-rpath's for a libtool library" 1>&2
+ fi
+ install_libdir="$2"
oldlibs=
if test -z "$rpath"; then
@@ -7297,21 +3191,25 @@ func_mode_link ()
build_old_libs=yes
fi
- test -n "$vinfo" && \
- func_warning "\`-version-info/-version-number' is ignored for convenience libraries"
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info/-version-number' is ignored for convenience libraries" 1>&2
+ fi
- test -n "$release" && \
- func_warning "\`-release' is ignored for convenience libraries"
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for convenience libraries" 1>&2
+ fi
else
# Parse the version information argument.
save_ifs="$IFS"; IFS=':'
set dummy $vinfo 0 0 0
- shift
IFS="$save_ifs"
- test -n "$7" && \
- func_fatal_help "too many parameters to \`-version-info'"
+ if test -n "$8"; then
+ $echo "$modename: too many parameters to \`-version-info'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
# convert absolute version numbers to libtool ages
# this retains compatibility with .la files and attempts
@@ -7319,9 +3217,9 @@ func_mode_link ()
case $vinfo_number in
yes)
- number_major="$1"
- number_minor="$2"
- number_revision="$3"
+ number_major="$2"
+ number_minor="$3"
+ number_revision="$4"
#
# There are really only two kinds -- those that
# use the current revision as the major version
@@ -7330,21 +3228,18 @@ func_mode_link ()
# which has an extra 1 added just for fun
#
case $version_type in
- # correct linux to gnu/linux during the next big refactor
darwin|linux|osf|windows|none)
- func_arith $number_major + $number_minor
- current=$func_arith_result
+ current=`expr $number_major + $number_minor`
age="$number_minor"
revision="$number_revision"
;;
- freebsd-aout|freebsd-elf|qnx|sunos)
+ freebsd-aout|freebsd-elf|sunos)
current="$number_major"
revision="$number_minor"
age="0"
;;
irix|nonstopux)
- func_arith $number_major + $number_minor
- current=$func_arith_result
+ current=`expr $number_major + $number_minor`
age="$number_minor"
revision="$number_minor"
lt_irix_increment=no
@@ -7352,9 +3247,9 @@ func_mode_link ()
esac
;;
no)
- current="$1"
- revision="$2"
- age="$3"
+ current="$2"
+ revision="$3"
+ age="$4"
;;
esac
@@ -7362,30 +3257,34 @@ func_mode_link ()
case $current in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- func_error "CURRENT \`$current' must be a nonnegative integer"
- func_fatal_error "\`$vinfo' is not valid version information"
+ $echo "$modename: CURRENT \`$current' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
;;
esac
case $revision in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- func_error "REVISION \`$revision' must be a nonnegative integer"
- func_fatal_error "\`$vinfo' is not valid version information"
+ $echo "$modename: REVISION \`$revision' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
;;
esac
case $age in
0|[1-9]|[1-9][0-9]|[1-9][0-9][0-9]|[1-9][0-9][0-9][0-9]|[1-9][0-9][0-9][0-9][0-9]) ;;
*)
- func_error "AGE \`$age' must be a nonnegative integer"
- func_fatal_error "\`$vinfo' is not valid version information"
+ $echo "$modename: AGE \`$age' must be a nonnegative integer" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
;;
esac
if test "$age" -gt "$current"; then
- func_error "AGE \`$age' is greater than the current interface number \`$current'"
- func_fatal_error "\`$vinfo' is not valid version information"
+ $echo "$modename: AGE \`$age' is greater than the current interface number \`$current'" 1>&2
+ $echo "$modename: \`$vinfo' is not valid version information" 1>&2
+ exit $EXIT_FAILURE
fi
# Calculate the version variables.
@@ -7398,12 +3297,10 @@ func_mode_link ()
darwin)
# Like Linux, but with the current version available in
# verstring for coding it into the library header
- func_arith $current - $age
- major=.$func_arith_result
+ major=.`expr $current - $age`
versuffix="$major.$age.$revision"
# Darwin ld doesn't like 0 for these options...
- func_arith $current + 1
- minor_current=$func_arith_result
+ minor_current=`expr $current + 1`
xlcverstring="${wl}-compatibility_version ${wl}$minor_current ${wl}-current_version ${wl}$minor_current.$revision"
verstring="-compatibility_version $minor_current -current_version $minor_current.$revision"
;;
@@ -7415,17 +3312,15 @@ func_mode_link ()
freebsd-elf)
major=".$current"
- versuffix=".$current"
+ versuffix=".$current";
;;
irix | nonstopux)
if test "X$lt_irix_increment" = "Xno"; then
- func_arith $current - $age
+ major=`expr $current - $age`
else
- func_arith $current - $age + 1
+ major=`expr $current - $age + 1`
fi
- major=$func_arith_result
-
case $version_type in
nonstopux) verstring_prefix=nonstopux ;;
*) verstring_prefix=sgi ;;
@@ -7435,10 +3330,8 @@ func_mode_link ()
# Add in all the interfaces that we are compatible with.
loop=$revision
while test "$loop" -ne 0; do
- func_arith $revision - $loop
- iface=$func_arith_result
- func_arith $loop - 1
- loop=$func_arith_result
+ iface=`expr $revision - $loop`
+ loop=`expr $loop - 1`
verstring="$verstring_prefix$major.$iface:$verstring"
done
@@ -7447,35 +3340,26 @@ func_mode_link ()
versuffix="$major.$revision"
;;
- linux) # correct to gnu/linux during the next big refactor
- func_arith $current - $age
- major=.$func_arith_result
+ linux)
+ major=.`expr $current - $age`
versuffix="$major.$age.$revision"
;;
osf)
- func_arith $current - $age
- major=.$func_arith_result
+ major=.`expr $current - $age`
versuffix=".$current.$age.$revision"
verstring="$current.$age.$revision"
# Add in all the interfaces that we are compatible with.
loop=$age
while test "$loop" -ne 0; do
- func_arith $current - $loop
- iface=$func_arith_result
- func_arith $loop - 1
- loop=$func_arith_result
+ iface=`expr $current - $loop`
+ loop=`expr $loop - 1`
verstring="$verstring:${iface}.0"
done
# Make executables depend on our current version.
- func_append verstring ":${current}.0"
- ;;
-
- qnx)
- major=".$current"
- versuffix=".$current"
+ verstring="$verstring:${current}.0"
;;
sunos)
@@ -7486,13 +3370,14 @@ func_mode_link ()
windows)
# Use '-' rather than '.', since we only want one
# extension on DOS 8.3 filesystems.
- func_arith $current - $age
- major=$func_arith_result
+ major=`expr $current - $age`
versuffix="-$major"
;;
*)
- func_fatal_configuration "unknown library version type \`$version_type'"
+ $echo "$modename: unknown library version type \`$version_type'" 1>&2
+ $echo "Fatal configuration error. See the $PACKAGE docs for more information." 1>&2
+ exit $EXIT_FAILURE
;;
esac
@@ -7526,7 +3411,7 @@ func_mode_link ()
# Check to see if the archive will have undefined symbols.
if test "$allow_undefined" = yes; then
if test "$allow_undefined_flag" = unsupported; then
- func_warning "undefined symbols not allowed in $host shared libraries"
+ $echo "$modename: warning: undefined symbols not allowed in $host shared libraries" 1>&2
build_libtool_libs=no
build_old_libs=yes
fi
@@ -7534,62 +3419,58 @@ func_mode_link ()
# Don't allow undefined symbols.
allow_undefined_flag="$no_undefined_flag"
fi
-
fi
- func_generate_dlsyms "$libname" "$libname" "yes"
- func_append libobjs " $symfileobj"
- test "X$libobjs" = "X " && libobjs=
-
- if test "$opt_mode" != relink; then
+ if test "$mode" != relink; then
# Remove our outputs, but don't remove object files since they
# may have been created when compiling PIC objects.
removelist=
- tempremovelist=`$ECHO "$output_objdir/*"`
+ tempremovelist=`$echo "$output_objdir/*"`
for p in $tempremovelist; do
case $p in
- *.$objext | *.gcno)
+ *.$objext)
;;
$output_objdir/$outputname | $output_objdir/$libname.* | $output_objdir/${libname}${release}.*)
if test "X$precious_files_regex" != "X"; then
- if $ECHO "$p" | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
- then
+ if echo $p | $EGREP -e "$precious_files_regex" >/dev/null 2>&1
+ then
continue
fi
fi
- func_append removelist " $p"
+ removelist="$removelist $p"
;;
*) ;;
esac
done
- test -n "$removelist" && \
- func_show_eval "${RM}r \$removelist"
+ if test -n "$removelist"; then
+ $show "${rm}r $removelist"
+ $run ${rm}r $removelist
+ fi
fi
# Now set the variables for building old libraries.
if test "$build_old_libs" = yes && test "$build_libtool_libs" != convenience ; then
- func_append oldlibs " $output_objdir/$libname.$libext"
+ oldlibs="$oldlibs $output_objdir/$libname.$libext"
# Transform .lo files to .o files.
- oldobjs="$objs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; $lo2o" | $NL2SP`
+ oldobjs="$objs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}'$/d' -e "$lo2o" | $NL2SP`
fi
# Eliminate all temporary directories.
#for path in $notinst_path; do
- # lib_search_path=`$ECHO "$lib_search_path " | $SED "s% $path % %g"`
- # deplibs=`$ECHO "$deplibs " | $SED "s% -L$path % %g"`
- # dependency_libs=`$ECHO "$dependency_libs " | $SED "s% -L$path % %g"`
+ # lib_search_path=`$echo "$lib_search_path " | ${SED} -e "s% $path % %g"`
+ # deplibs=`$echo "$deplibs " | ${SED} -e "s% -L$path % %g"`
+ # dependency_libs=`$echo "$dependency_libs " | ${SED} -e "s% -L$path % %g"`
#done
if test -n "$xrpath"; then
# If the user specified any rpath flags, then add them.
temp_xrpath=
for libdir in $xrpath; do
- func_replace_sysroot "$libdir"
- func_append temp_xrpath " -R$func_replace_sysroot_result"
+ temp_xrpath="$temp_xrpath -R$libdir"
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
esac
done
if test "$hardcode_into_libs" != yes || test "$build_old_libs" = yes; then
@@ -7603,7 +3484,7 @@ func_mode_link ()
for lib in $old_dlfiles; do
case " $dlprefiles $dlfiles " in
*" $lib "*) ;;
- *) func_append dlfiles " $lib" ;;
+ *) dlfiles="$dlfiles $lib" ;;
esac
done
@@ -7613,19 +3494,19 @@ func_mode_link ()
for lib in $old_dlprefiles; do
case "$dlprefiles " in
*" $lib "*) ;;
- *) func_append dlprefiles " $lib" ;;
+ *) dlprefiles="$dlprefiles $lib" ;;
esac
done
if test "$build_libtool_libs" = yes; then
if test -n "$rpath"; then
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos* | *-cegcc* | *-*-haiku*)
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-*-beos*)
# these systems don't actually have a c library (as such)!
;;
*-*-rhapsody* | *-*-darwin1.[012])
# Rhapsody C library is in the System framework
- func_append deplibs " System.ltframework"
+ deplibs="$deplibs -framework System"
;;
*-*-netbsd*)
# Don't link with libc until the a.out ld.so is fixed.
@@ -7639,10 +3520,10 @@ func_mode_link ()
*-*-sysv4.2uw2* | *-*-sysv5* | *-*-unixware* | *-*-OpenUNIX*)
# Compiler inserts libc in the correct place for threads to work
;;
- *)
+ *)
# Add libc to deplibs on all other systems if necessary.
if test "$build_libtool_need_lc" = "yes"; then
- func_append deplibs " -lc"
+ deplibs="$deplibs -lc"
fi
;;
esac
@@ -7676,139 +3557,120 @@ func_mode_link ()
# limits. Maybe even breaks it. We compile a program, linking it
# against the deplibs as a proxy for the library. Then we can check
# whether they linked in statically or dynamically with ldd.
- $opt_dry_run || $RM conftest.c
+ $rm conftest.c
cat > conftest.c <<EOF
int main() { return 0; }
EOF
- $opt_dry_run || $RM conftest
+ $rm conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $deplibs; then
ldd_output=`ldd conftest`
for i in $deplibs; do
- case $i in
- -l*)
- func_stripname -l '' "$i"
- name=$func_stripname_result
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
i=""
;;
esac
- fi
+ fi
if test -n "$i" ; then
- libname=`eval "\\$ECHO \"$libname_spec\""`
- deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
- set dummy $deplib_matches; shift
- deplib_match=$1
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
else
droppeddeps=yes
- echo
- $ECHO "*** Warning: dynamic linker does not accept needed library $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which I believe you do not have"
- echo "*** because a test_compile did reveal that the linker did not use it for"
- echo "*** its dynamic dependency list that programs get resolved with at runtime."
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which I believe you do not have"
+ $echo "*** because a test_compile did reveal that the linker did not use it for"
+ $echo "*** its dynamic dependency list that programs get resolved with at runtime."
fi
fi
- ;;
- *)
- func_append newdeplibs " $i"
- ;;
- esac
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
done
else
# Error occurred in the first compile. Let's try to salvage
# the situation: Compile a separate program for each library.
for i in $deplibs; do
- case $i in
- -l*)
- func_stripname -l '' "$i"
- name=$func_stripname_result
- $opt_dry_run || $RM conftest
+ name=`expr $i : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
+ $rm conftest
if $LTCC $LTCFLAGS -o conftest conftest.c $i; then
ldd_output=`ldd conftest`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $i "*)
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
i=""
;;
esac
fi
if test -n "$i" ; then
- libname=`eval "\\$ECHO \"$libname_spec\""`
- deplib_matches=`eval "\\$ECHO \"$library_names_spec\""`
- set dummy $deplib_matches; shift
- deplib_match=$1
+ libname=`eval \\$echo \"$libname_spec\"`
+ deplib_matches=`eval \\$echo \"$library_names_spec\"`
+ set dummy $deplib_matches
+ deplib_match=$2
if test `expr "$ldd_output" : ".*$deplib_match"` -ne 0 ; then
- func_append newdeplibs " $i"
+ newdeplibs="$newdeplibs $i"
else
droppeddeps=yes
- echo
- $ECHO "*** Warning: dynamic linker does not accept needed library $i."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because a test_compile did reveal that the linker did not use this one"
- echo "*** as a dynamic dependency that programs can get resolved with at runtime."
+ $echo
+ $echo "*** Warning: dynamic linker does not accept needed library $i."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because a test_compile did reveal that the linker did not use this one"
+ $echo "*** as a dynamic dependency that programs can get resolved with at runtime."
fi
fi
else
droppeddeps=yes
- echo
- $ECHO "*** Warning! Library $i is needed by this library but I was not able to"
- echo "*** make it link in! You will probably need to install it or some"
- echo "*** library that it depends on before this library will be fully"
- echo "*** functional. Installing it before continuing would be even better."
+ $echo
+ $echo "*** Warning! Library $i is needed by this library but I was not able to"
+ $echo "*** make it link in! You will probably need to install it or some"
+ $echo "*** library that it depends on before this library will be fully"
+ $echo "*** functional. Installing it before continuing would be even better."
fi
- ;;
- *)
- func_append newdeplibs " $i"
- ;;
- esac
+ else
+ newdeplibs="$newdeplibs $i"
+ fi
done
fi
;;
file_magic*)
- set dummy $deplibs_check_method; shift
- file_magic_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ set dummy $deplibs_check_method
+ file_magic_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- case $a_deplib in
- -l*)
- func_stripname -l '' "$a_deplib"
- name=$func_stripname_result
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test "$name" != "" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
- libname=`eval "\\$ECHO \"$libname_spec\""`
- if test -n "$file_magic_glob"; then
- libnameglob=`func_echo_all "$libname" | $SED -e $file_magic_glob`
- else
- libnameglob=$libname
- fi
- test "$want_nocaseglob" = yes && nocaseglob=`shopt -p nocaseglob`
+ libname=`eval \\$echo \"$libname_spec\"`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
- if test "$want_nocaseglob" = yes; then
- shopt -s nocaseglob
- potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
- $nocaseglob
- else
- potential_libs=`ls $i/$libnameglob[.-]* 2>/dev/null`
- fi
+ potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
for potent_lib in $potential_libs; do
# Follow soft links.
- if ls -lLd "$potent_lib" 2>/dev/null |
- $GREP " -> " >/dev/null; then
+ if ls -lLd "$potent_lib" 2>/dev/null \
+ | grep " -> " >/dev/null; then
continue
fi
# The statement above tries to avoid entering an
@@ -7821,13 +3683,13 @@ EOF
potliblink=`ls -ld $potlib | ${SED} 's/.* -> //'`
case $potliblink in
[\\/]* | [A-Za-z]:[\\/]*) potlib="$potliblink";;
- *) potlib=`$ECHO "$potlib" | $SED 's,[^/]*$,,'`"$potliblink";;
+ *) potlib=`$echo "X$potlib" | $Xsed -e 's,[^/]*$,,'`"$potliblink";;
esac
done
- if eval $file_magic_cmd \"\$potlib\" 2>/dev/null |
- $SED -e 10q |
- $EGREP "$file_magic_regex" > /dev/null; then
- func_append newdeplibs " $a_deplib"
+ if eval $file_magic_cmd \"\$potlib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$file_magic_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
fi
@@ -7836,52 +3698,50 @@ EOF
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
- echo
- $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because I did check the linker path looking for a file starting"
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
- $ECHO "*** with $libname but no candidates were found. (...for file magic test)"
+ $echo "*** with $libname but no candidates were found. (...for file magic test)"
else
- $ECHO "*** with $libname and none of the candidates passed a file format test"
- $ECHO "*** using a file magic. Last file checked: $potlib"
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a file magic. Last file checked: $potlib"
fi
fi
- ;;
- *)
+ else
# Add a -L argument.
- func_append newdeplibs " $a_deplib"
- ;;
- esac
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
done # Gone through all deplibs.
;;
match_pattern*)
- set dummy $deplibs_check_method; shift
- match_pattern_regex=`expr "$deplibs_check_method" : "$1 \(.*\)"`
+ set dummy $deplibs_check_method
+ match_pattern_regex=`expr "$deplibs_check_method" : "$2 \(.*\)"`
for a_deplib in $deplibs; do
- case $a_deplib in
- -l*)
- func_stripname -l '' "$a_deplib"
- name=$func_stripname_result
+ name=`expr $a_deplib : '-l\(.*\)'`
+ # If $name is empty we are operating on a -L argument.
+ if test -n "$name" && test "$name" != "0"; then
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
case " $predeps $postdeps " in
*" $a_deplib "*)
- func_append newdeplibs " $a_deplib"
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
;;
esac
fi
if test -n "$a_deplib" ; then
- libname=`eval "\\$ECHO \"$libname_spec\""`
+ libname=`eval \\$echo \"$libname_spec\"`
for i in $lib_search_path $sys_lib_search_path $shlib_search_path; do
potential_libs=`ls $i/$libname[.-]* 2>/dev/null`
for potent_lib in $potential_libs; do
potlib="$potent_lib" # see symlink-check above in file_magic test
- if eval "\$ECHO \"$potent_lib\"" 2>/dev/null | $SED 10q | \
- $EGREP "$match_pattern_regex" > /dev/null; then
- func_append newdeplibs " $a_deplib"
+ if eval $echo \"$potent_lib\" 2>/dev/null \
+ | ${SED} 10q \
+ | $EGREP "$match_pattern_regex" > /dev/null; then
+ newdeplibs="$newdeplibs $a_deplib"
a_deplib=""
break 2
fi
@@ -7890,48 +3750,46 @@ EOF
fi
if test -n "$a_deplib" ; then
droppeddeps=yes
- echo
- $ECHO "*** Warning: linker path does not have real file for library $a_deplib."
- echo "*** I have the capability to make that library automatically link in when"
- echo "*** you link to this library. But I can only do this if you have a"
- echo "*** shared version of the library, which you do not appear to have"
- echo "*** because I did check the linker path looking for a file starting"
+ $echo
+ $echo "*** Warning: linker path does not have real file for library $a_deplib."
+ $echo "*** I have the capability to make that library automatically link in when"
+ $echo "*** you link to this library. But I can only do this if you have a"
+ $echo "*** shared version of the library, which you do not appear to have"
+ $echo "*** because I did check the linker path looking for a file starting"
if test -z "$potlib" ; then
- $ECHO "*** with $libname but no candidates were found. (...for regex pattern test)"
+ $echo "*** with $libname but no candidates were found. (...for regex pattern test)"
else
- $ECHO "*** with $libname and none of the candidates passed a file format test"
- $ECHO "*** using a regex pattern. Last file checked: $potlib"
+ $echo "*** with $libname and none of the candidates passed a file format test"
+ $echo "*** using a regex pattern. Last file checked: $potlib"
fi
fi
- ;;
- *)
+ else
# Add a -L argument.
- func_append newdeplibs " $a_deplib"
- ;;
- esac
+ newdeplibs="$newdeplibs $a_deplib"
+ fi
done # Gone through all deplibs.
;;
none | unknown | *)
newdeplibs=""
- tmp_deplibs=`$ECHO " $deplibs" | $SED 's/ -lc$//; s/ -[LR][^ ]*//g'`
+ tmp_deplibs=`$echo "X $deplibs" | $Xsed -e 's/ -lc$//' \
+ -e 's/ -[LR][^ ]*//g'`
if test "X$allow_libtool_libs_with_static_runtimes" = "Xyes" ; then
for i in $predeps $postdeps ; do
# can't use Xsed below, because $i might contain '/'
- tmp_deplibs=`$ECHO " $tmp_deplibs" | $SED "s,$i,,"`
+ tmp_deplibs=`$echo "X $tmp_deplibs" | ${SED} -e "1s,^X,," -e "s,$i,,"`
done
fi
- case $tmp_deplibs in
- *[!\ \ ]*)
- echo
+ if $echo "X $tmp_deplibs" | $Xsed -e 's/[ ]//g' \
+ | grep . >/dev/null; then
+ $echo
if test "X$deplibs_check_method" = "Xnone"; then
- echo "*** Warning: inter-library dependencies are not supported in this platform."
+ $echo "*** Warning: inter-library dependencies are not supported in this platform."
else
- echo "*** Warning: inter-library dependencies are not known to be supported."
+ $echo "*** Warning: inter-library dependencies are not known to be supported."
fi
- echo "*** All declared inter-library dependencies are being dropped."
+ $echo "*** All declared inter-library dependencies are being dropped."
droppeddeps=yes
- ;;
- esac
+ fi
;;
esac
versuffix=$versuffix_save
@@ -7942,24 +3800,24 @@ EOF
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
- # On Rhapsody replace the C library with the System framework
- newdeplibs=`$ECHO " $newdeplibs" | $SED 's/ -lc / System.ltframework /'`
+ # On Rhapsody replace the C library is the System framework
+ newdeplibs=`$echo "X $newdeplibs" | $Xsed -e 's/ -lc / -framework System /'`
;;
esac
if test "$droppeddeps" = yes; then
if test "$module" = yes; then
- echo
- echo "*** Warning: libtool could not satisfy all declared inter-library"
- $ECHO "*** dependencies of module $libname. Therefore, libtool will create"
- echo "*** a static module, that should work as long as the dlopening"
- echo "*** application is linked with the -dlopen flag."
+ $echo
+ $echo "*** Warning: libtool could not satisfy all declared inter-library"
+ $echo "*** dependencies of module $libname. Therefore, libtool will create"
+ $echo "*** a static module, that should work as long as the dlopening"
+ $echo "*** application is linked with the -dlopen flag."
if test -z "$global_symbol_pipe"; then
- echo
- echo "*** However, this would only work if libtool was able to extract symbol"
- echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
- echo "*** not find such a program. So, this module is probably useless."
- echo "*** \`nm' from GNU binutils and a full rebuild may help."
+ $echo
+ $echo "*** However, this would only work if libtool was able to extract symbol"
+ $echo "*** lists from a program, using \`nm' or equivalent, but libtool could"
+ $echo "*** not find such a program. So, this module is probably useless."
+ $echo "*** \`nm' from GNU binutils and a full rebuild may help."
fi
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
@@ -7969,16 +3827,16 @@ EOF
build_libtool_libs=no
fi
else
- echo "*** The inter-library dependencies that have been dropped here will be"
- echo "*** automatically added whenever a program is linked with this library"
- echo "*** or is declared to -dlopen it."
+ $echo "*** The inter-library dependencies that have been dropped here will be"
+ $echo "*** automatically added whenever a program is linked with this library"
+ $echo "*** or is declared to -dlopen it."
if test "$allow_undefined" = no; then
- echo
- echo "*** Since this library must not contain undefined symbols,"
- echo "*** because either the platform does not support them or"
- echo "*** it was explicitly requested with -no-undefined,"
- echo "*** libtool will only create a static version of it."
+ $echo
+ $echo "*** Since this library must not contain undefined symbols,"
+ $echo "*** because either the platform does not support them or"
+ $echo "*** it was explicitly requested with -no-undefined,"
+ $echo "*** libtool will only create a static version of it."
if test "$build_old_libs" = no; then
oldlibs="$output_objdir/$libname.$libext"
build_libtool_libs=module
@@ -7992,14 +3850,7 @@ EOF
# Done checking deplibs!
deplibs=$newdeplibs
fi
- # Time to change all our "foo.ltframework" stuff back to "-framework foo"
- case $host in
- *-*-darwin*)
- newdeplibs=`$ECHO " $newdeplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- new_inherited_linker_flags=`$ECHO " $new_inherited_linker_flags" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- deplibs=`$ECHO " $deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- ;;
- esac
+
# move library search paths that coincide with paths to not yet
# installed libraries to the beginning of the library search list
@@ -8010,7 +3861,7 @@ EOF
*)
case " $deplibs " in
*" -L$path/$objdir "*)
- func_append new_libs " -L$path/$objdir" ;;
+ new_libs="$new_libs -L$path/$objdir" ;;
esac
;;
esac
@@ -8020,14 +3871,15 @@ EOF
-L*)
case " $new_libs " in
*" $deplib "*) ;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
done
deplibs="$new_libs"
+
# All the library-specific variables (install_libdir is set above).
library_names=
old_library=
@@ -8035,22 +3887,15 @@ EOF
# Test again, we may have decided not to build it any more
if test "$build_libtool_libs" = yes; then
- # Remove ${wl} instances when linking with ld.
- # FIXME: should test the right _cmds variable.
- case $archive_cmds in
- *\$LD\ *) wl= ;;
- esac
if test "$hardcode_into_libs" = yes; then
# Hardcode the library paths
hardcode_libdirs=
dep_rpath=
rpath="$finalize_rpath"
- test "$opt_mode" != relink && rpath="$compile_rpath$rpath"
+ test "$mode" != relink && rpath="$compile_rpath$rpath"
for libdir in $rpath; do
if test -n "$hardcode_libdir_flag_spec"; then
if test -n "$hardcode_libdir_separator"; then
- func_replace_sysroot "$libdir"
- libdir=$func_replace_sysroot_result
if test -z "$hardcode_libdirs"; then
hardcode_libdirs="$libdir"
else
@@ -8059,18 +3904,18 @@ EOF
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
- func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
- func_append dep_rpath " $flag"
+ dep_rpath="$dep_rpath $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
- *) func_append perm_rpath " $libdir" ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
esac
fi
done
@@ -8078,13 +3923,20 @@ EOF
if test -n "$hardcode_libdir_separator" &&
test -n "$hardcode_libdirs"; then
libdir="$hardcode_libdirs"
- eval "dep_rpath=\"$hardcode_libdir_flag_spec\""
+ if test -n "$hardcode_libdir_flag_spec_ld"; then
+ case $archive_cmds in
+ *\$LD*) eval dep_rpath=\"$hardcode_libdir_flag_spec_ld\" ;;
+ *) eval dep_rpath=\"$hardcode_libdir_flag_spec\" ;;
+ esac
+ else
+ eval dep_rpath=\"$hardcode_libdir_flag_spec\"
+ fi
fi
if test -n "$runpath_var" && test -n "$perm_rpath"; then
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
- func_append rpath "$dir:"
+ rpath="$rpath$dir:"
done
eval "$runpath_var='$rpath\$$runpath_var'; export $runpath_var"
fi
@@ -8092,7 +3944,7 @@ EOF
fi
shlibpath="$finalize_shlibpath"
- test "$opt_mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
+ test "$mode" != relink && shlibpath="$compile_shlibpath$shlibpath"
if test -n "$shlibpath"; then
eval "$shlibpath_var='$shlibpath\$$shlibpath_var'; export $shlibpath_var"
fi
@@ -8101,9 +3953,8 @@ EOF
eval shared_ext=\"$shrext_cmds\"
eval library_names=\"$library_names_spec\"
set dummy $library_names
- shift
- realname="$1"
- shift
+ realname="$2"
+ shift; shift
if test -n "$soname_spec"; then
eval soname=\"$soname_spec\"
@@ -8118,166 +3969,83 @@ EOF
linknames=
for link
do
- func_append linknames " $link"
+ linknames="$linknames $link"
done
# Use standard objects if they are pic
- test -z "$pic_flag" && libobjs=`$ECHO "$libobjs" | $SP2NL | $SED "$lo2o" | $NL2SP`
- test "X$libobjs" = "X " && libobjs=
-
- delfiles=
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- $opt_dry_run || cp "$export_symbols" "$output_objdir/$libname.uexp"
- export_symbols="$output_objdir/$libname.uexp"
- func_append delfiles " $export_symbols"
- fi
-
- orig_export_symbols=
- case $host_os in
- cygwin* | mingw* | cegcc*)
- if test -n "$export_symbols" && test -z "$export_symbols_regex"; then
- # exporting using user supplied symfile
- if test "x`$SED 1q $export_symbols`" != xEXPORTS; then
- # and it's NOT already a .def file. Must figure out
- # which of the given symbols are data symbols and tag
- # them as such. So, trigger use of export_symbols_cmds.
- # export_symbols gets reassigned inside the "prepare
- # the list of exported symbols" if statement, so the
- # include_expsyms logic still works.
- orig_export_symbols="$export_symbols"
- export_symbols=
- always_export_symbols=yes
- fi
- fi
- ;;
- esac
+ test -z "$pic_flag" && libobjs=`$echo "X$libobjs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
# Prepare the list of exported symbols
if test -z "$export_symbols"; then
if test "$always_export_symbols" = yes || test -n "$export_symbols_regex"; then
- func_verbose "generating symbol list for \`$libname.la'"
+ $show "generating symbol list for \`$libname.la'"
export_symbols="$output_objdir/$libname.exp"
- $opt_dry_run || $RM $export_symbols
+ $run $rm $export_symbols
cmds=$export_symbols_cmds
save_ifs="$IFS"; IFS='~'
- for cmd1 in $cmds; do
+ for cmd in $cmds; do
IFS="$save_ifs"
- # Take the normal branch if the nm_file_list_spec branch
- # doesn't work or if tool conversion is not needed.
- case $nm_file_list_spec~$to_tool_file_cmd in
- *~func_convert_file_noop | *~func_convert_file_msys_to_w32 | ~*)
- try_normal_branch=yes
- eval cmd=\"$cmd1\"
- func_len " $cmd"
- len=$func_len_result
- ;;
- *)
- try_normal_branch=no
- ;;
- esac
- if test "$try_normal_branch" = yes \
- && { test "$len" -lt "$max_cmd_len" \
- || test "$max_cmd_len" -le -1; }
- then
- func_show_eval "$cmd" 'exit $?'
- skipped_export=false
- elif test -n "$nm_file_list_spec"; then
- func_basename "$output"
- output_la=$func_basename_result
- save_libobjs=$libobjs
- save_output=$output
- output=${output_objdir}/${output_la}.nm
- func_to_tool_file "$output"
- libobjs=$nm_file_list_spec$func_to_tool_file_result
- func_append delfiles " $output"
- func_verbose "creating $NM input file list: $output"
- for obj in $save_libobjs; do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result"
- done > "$output"
- eval cmd=\"$cmd1\"
- func_show_eval "$cmd" 'exit $?'
- output=$save_output
- libobjs=$save_libobjs
- skipped_export=false
+ eval cmd=\"$cmd\"
+ if len=`expr "X$cmd" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ skipped_export=false
else
- # The command line is too long to execute in one step.
- func_verbose "using reloadable object file for export list..."
- skipped_export=:
+ # The command line is too long to execute in one step.
+ $show "using reloadable object file for export list..."
+ skipped_export=:
# Break out early, otherwise skipped_export may be
# set to false by a later but shorter cmd.
break
fi
done
IFS="$save_ifs"
- if test -n "$export_symbols_regex" && test "X$skipped_export" != "X:"; then
- func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
+ if test -n "$export_symbols_regex"; then
+ $show "$EGREP -e \"$export_symbols_regex\" \"$export_symbols\" > \"${export_symbols}T\""
+ $run eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
+ $show "$mv \"${export_symbols}T\" \"$export_symbols\""
+ $run eval '$mv "${export_symbols}T" "$export_symbols"'
fi
fi
fi
if test -n "$export_symbols" && test -n "$include_expsyms"; then
- tmp_export_symbols="$export_symbols"
- test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
- $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
- fi
-
- if test "X$skipped_export" != "X:" && test -n "$orig_export_symbols"; then
- # The given exports_symbols file has to be filtered, so filter it.
- func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
- # FIXME: $output_objdir/$libname.filter potentially contains lots of
- # 's' commands which not all seds can handle. GNU sed should be fine
- # though. Also, the filter scales superlinearly with the number of
- # global variables. join(1) would be nice here, but unfortunately
- # isn't a blessed tool.
- $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
- func_append delfiles " $export_symbols $output_objdir/$libname.filter"
- export_symbols=$output_objdir/$libname.def
- $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
+ $run eval '$echo "X$include_expsyms" | $SP2NL >> "$export_symbols"'
fi
tmp_deplibs=
for test_deplib in $deplibs; do
- case " $convenience " in
- *" $test_deplib "*) ;;
- *)
- func_append tmp_deplibs " $test_deplib"
- ;;
- esac
+ case " $convenience " in
+ *" $test_deplib "*) ;;
+ *)
+ tmp_deplibs="$tmp_deplibs $test_deplib"
+ ;;
+ esac
done
deplibs="$tmp_deplibs"
if test -n "$convenience"; then
- if test -n "$whole_archive_flag_spec" &&
- test "$compiler_needs_object" = yes &&
- test -z "$libobjs"; then
- # extract the archives, so we have objects to list.
- # TODO: could optimize this to just extract one archive.
- whole_archive_flag_spec=
- fi
if test -n "$whole_archive_flag_spec"; then
save_libobjs=$libobjs
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- test "X$libobjs" = "X " && libobjs=
else
gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $convenience
- func_append libobjs " $func_extract_archives_result"
- test "X$libobjs" = "X " && libobjs=
+ libobjs="$libobjs $func_extract_archives_result"
fi
fi
-
+
if test "$thread_safe" = yes && test -n "$thread_safe_flag_spec"; then
eval flag=\"$thread_safe_flag_spec\"
- func_append linker_flags " $flag"
+ linker_flags="$linker_flags $flag"
fi
# Make a backup of the uninstalled library when relinking
- if test "$opt_mode" = relink; then
- $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}U && $MV $realname ${realname}U)' || exit $?
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}U && $mv $realname ${realname}U)' || exit $?
fi
# Do each of the archive commands.
@@ -8290,24 +4058,22 @@ EOF
cmds=$module_cmds
fi
else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- eval test_cmds=\"$archive_expsym_cmds\"
- cmds=$archive_expsym_cmds
- else
- eval test_cmds=\"$archive_cmds\"
- cmds=$archive_cmds
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ eval test_cmds=\"$archive_expsym_cmds\"
+ cmds=$archive_expsym_cmds
+ else
+ eval test_cmds=\"$archive_cmds\"
+ cmds=$archive_cmds
fi
fi
if test "X$skipped_export" != "X:" &&
- func_len " $test_cmds" &&
- len=$func_len_result &&
- test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
+ len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
:
else
- # The command line is too long to link in one step, link piecewise
- # or, if using GNU ld and skipped_export is not :, use a linker
- # script.
+ # The command line is too long to link in one step, link piecewise.
+ $echo "creating reloadable object files..."
# Save the value of $output and $libobjs because we want to
# use them later. If we have whole_archive_flag_spec, we
@@ -8321,171 +4087,77 @@ EOF
save_libobjs=$libobjs
fi
save_output=$output
- func_basename "$output"
- output_la=$func_basename_result
+ output_la=`$echo "X$output" | $Xsed -e "$basename"`
# Clear the reloadable object creation command queue and
# initialize k to one.
test_cmds=
concat_cmds=
objlist=
+ delfiles=
last_robj=
k=1
-
- if test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "$with_gnu_ld" = yes; then
- output=${output_objdir}/${output_la}.lnkscript
- func_verbose "creating GNU ld script: $output"
- echo 'INPUT (' > $output
- for obj in $save_libobjs
- do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result" >> $output
- done
- echo ')' >> $output
- func_append delfiles " $output"
- func_to_tool_file "$output"
- output=$func_to_tool_file_result
- elif test -n "$save_libobjs" && test "X$skipped_export" != "X:" && test "X$file_list_spec" != X; then
- output=${output_objdir}/${output_la}.lnk
- func_verbose "creating linker input file list: $output"
- : > $output
- set x $save_libobjs
- shift
- firstobj=
- if test "$compiler_needs_object" = yes; then
- firstobj="$1 "
- shift
- fi
- for obj
- do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result" >> $output
- done
- func_append delfiles " $output"
- func_to_tool_file "$output"
- output=$firstobj\"$file_list_spec$func_to_tool_file_result\"
- else
- if test -n "$save_libobjs"; then
- func_verbose "creating reloadable object files..."
- output=$output_objdir/$output_la-${k}.$objext
- eval test_cmds=\"$reload_cmds\"
- func_len " $test_cmds"
- len0=$func_len_result
- len=$len0
-
- # Loop over the list of objects to be linked.
- for obj in $save_libobjs
- do
- func_len " $obj"
- func_arith $len + $func_len_result
- len=$func_arith_result
- if test "X$objlist" = X ||
- test "$len" -lt "$max_cmd_len"; then
- func_append objlist " $obj"
- else
- # The command $test_cmds is almost too long, add a
- # command to the queue.
- if test "$k" -eq 1 ; then
- # The first file doesn't have a previous command to add.
- reload_objs=$objlist
- eval concat_cmds=\"$reload_cmds\"
- else
- # All subsequent reloadable object files will link in
- # the last one created.
- reload_objs="$objlist $last_robj"
- eval concat_cmds=\"\$concat_cmds~$reload_cmds~\$RM $last_robj\"
- fi
- last_robj=$output_objdir/$output_la-${k}.$objext
- func_arith $k + 1
- k=$func_arith_result
- output=$output_objdir/$output_la-${k}.$objext
- objlist=" $obj"
- func_len " $last_robj"
- func_arith $len0 + $func_len_result
- len=$func_arith_result
- fi
- done
- # Handle the remaining objects by creating one last
- # reloadable object file. All subsequent reloadable object
- # files will link in the last one created.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- reload_objs="$objlist $last_robj"
- eval concat_cmds=\"\${concat_cmds}$reload_cmds\"
- if test -n "$last_robj"; then
- eval concat_cmds=\"\${concat_cmds}~\$RM $last_robj\"
- fi
- func_append delfiles " $output"
-
+ output=$output_objdir/$output_la-${k}.$objext
+ # Loop over the list of objects to be linked.
+ for obj in $save_libobjs
+ do
+ eval test_cmds=\"$reload_cmds $objlist $last_robj\"
+ if test "X$objlist" = X ||
+ { len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; }; then
+ objlist="$objlist $obj"
else
- output=
- fi
-
- if ${skipped_export-false}; then
- func_verbose "generating symbol list for \`$libname.la'"
- export_symbols="$output_objdir/$libname.exp"
- $opt_dry_run || $RM $export_symbols
- libobjs=$output
- # Append the command to create the export file.
- test -z "$concat_cmds" || concat_cmds=$concat_cmds~
- eval concat_cmds=\"\$concat_cmds$export_symbols_cmds\"
- if test -n "$last_robj"; then
- eval concat_cmds=\"\$concat_cmds~\$RM $last_robj\"
+ # The command $test_cmds is almost too long, add a
+ # command to the queue.
+ if test "$k" -eq 1 ; then
+ # The first file doesn't have a previous command to add.
+ eval concat_cmds=\"$reload_cmds $objlist $last_robj\"
+ else
+ # All subsequent reloadable object files will link in
+ # the last one created.
+ eval concat_cmds=\"\$concat_cmds~$reload_cmds $objlist $last_robj\"
fi
+ last_robj=$output_objdir/$output_la-${k}.$objext
+ k=`expr $k + 1`
+ output=$output_objdir/$output_la-${k}.$objext
+ objlist=$obj
+ len=1
fi
+ done
+ # Handle the remaining objects by creating one last
+ # reloadable object file. All subsequent reloadable object
+ # files will link in the last one created.
+ test -z "$concat_cmds" || concat_cmds=$concat_cmds~
+ eval concat_cmds=\"\${concat_cmds}$reload_cmds $objlist $last_robj\"
+
+ if ${skipped_export-false}; then
+ $show "generating symbol list for \`$libname.la'"
+ export_symbols="$output_objdir/$libname.exp"
+ $run $rm $export_symbols
+ libobjs=$output
+ # Append the command to create the export file.
+ eval concat_cmds=\"\$concat_cmds~$export_symbols_cmds\"
+ fi
+
+ # Set up a command to remove the reloadable object files
+ # after they are used.
+ i=0
+ while test "$i" -lt "$k"
+ do
+ i=`expr $i + 1`
+ delfiles="$delfiles $output_objdir/$output_la-${i}.$objext"
+ done
- test -n "$save_libobjs" &&
- func_verbose "creating a temporary reloadable object file: $output"
-
- # Loop through the commands generated above and execute them.
- save_ifs="$IFS"; IFS='~'
- for cmd in $concat_cmds; do
- IFS="$save_ifs"
- $opt_silent || {
- func_quote_for_expand "$cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
- $opt_dry_run || eval "$cmd" || {
- lt_exit=$?
-
- # Restore the uninstalled library and exit
- if test "$opt_mode" = relink; then
- ( cd "$output_objdir" && \
- $RM "${realname}T" && \
- $MV "${realname}U" "$realname" )
- fi
+ $echo "creating a temporary reloadable object file: $output"
- exit $lt_exit
- }
- done
+ # Loop through the commands generated above and execute them.
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $concat_cmds; do
IFS="$save_ifs"
-
- if test -n "$export_symbols_regex" && ${skipped_export-false}; then
- func_show_eval '$EGREP -e "$export_symbols_regex" "$export_symbols" > "${export_symbols}T"'
- func_show_eval '$MV "${export_symbols}T" "$export_symbols"'
- fi
- fi
-
- if ${skipped_export-false}; then
- if test -n "$export_symbols" && test -n "$include_expsyms"; then
- tmp_export_symbols="$export_symbols"
- test -n "$orig_export_symbols" && tmp_export_symbols="$orig_export_symbols"
- $opt_dry_run || eval '$ECHO "$include_expsyms" | $SP2NL >> "$tmp_export_symbols"'
- fi
-
- if test -n "$orig_export_symbols"; then
- # The given exports_symbols file has to be filtered, so filter it.
- func_verbose "filter symbol list for \`$libname.la' to tag DATA exports"
- # FIXME: $output_objdir/$libname.filter potentially contains lots of
- # 's' commands which not all seds can handle. GNU sed should be fine
- # though. Also, the filter scales superlinearly with the number of
- # global variables. join(1) would be nice here, but unfortunately
- # isn't a blessed tool.
- $opt_dry_run || $SED -e '/[ ,]DATA/!d;s,\(.*\)\([ \,].*\),s|^\1$|\1\2|,' < $export_symbols > $output_objdir/$libname.filter
- func_append delfiles " $export_symbols $output_objdir/$libname.filter"
- export_symbols=$output_objdir/$libname.def
- $opt_dry_run || $SED -f $output_objdir/$libname.filter < $orig_export_symbols > $export_symbols
- fi
- fi
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
libobjs=$output
# Restore the value of output.
@@ -8493,7 +4165,6 @@ EOF
if test -n "$convenience" && test -n "$whole_archive_flag_spec"; then
eval libobjs=\"\$libobjs $whole_archive_flag_spec\"
- test "X$libobjs" = "X " && libobjs=
fi
# Expand the library linking commands again to reset the
# value of $libobjs for piecewise linking.
@@ -8506,45 +4177,28 @@ EOF
cmds=$module_cmds
fi
else
- if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
- cmds=$archive_expsym_cmds
- else
- cmds=$archive_cmds
+ if test -n "$export_symbols" && test -n "$archive_expsym_cmds"; then
+ cmds=$archive_expsym_cmds
+ else
+ cmds=$archive_cmds
fi
fi
- fi
-
- if test -n "$delfiles"; then
- # Append the command to remove temporary files to $cmds.
- eval cmds=\"\$cmds~\$RM $delfiles\"
- fi
-
- # Add any objects from preloaded convenience libraries
- if test -n "$dlprefiles"; then
- gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
- func_extract_archives $gentop $dlprefiles
- func_append libobjs " $func_extract_archives_result"
- test "X$libobjs" = "X " && libobjs=
+ # Append the command to remove the reloadable object files
+ # to the just-reset $cmds.
+ eval cmds=\"\$cmds~\$rm $delfiles\"
fi
-
save_ifs="$IFS"; IFS='~'
for cmd in $cmds; do
IFS="$save_ifs"
eval cmd=\"$cmd\"
- $opt_silent || {
- func_quote_for_expand "$cmd"
- eval "func_echo $func_quote_for_expand_result"
- }
- $opt_dry_run || eval "$cmd" || {
+ $show "$cmd"
+ $run eval "$cmd" || {
lt_exit=$?
# Restore the uninstalled library and exit
- if test "$opt_mode" = relink; then
- ( cd "$output_objdir" && \
- $RM "${realname}T" && \
- $MV "${realname}U" "$realname" )
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
fi
exit $lt_exit
@@ -8553,12 +4207,13 @@ EOF
IFS="$save_ifs"
# Restore the uninstalled library and exit
- if test "$opt_mode" = relink; then
- $opt_dry_run || eval '(cd $output_objdir && $RM ${realname}T && $MV $realname ${realname}T && $MV ${realname}U $realname)' || exit $?
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv $realname ${realname}T && $mv "$realname"U $realname)' || exit $?
if test -n "$convenience"; then
if test -z "$whole_archive_flag_spec"; then
- func_show_eval '${RM}r "$gentop"'
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
fi
fi
@@ -8568,7 +4223,8 @@ EOF
# Create links to the real library.
for linkname in $linknames; do
if test "$realname" != "$linkname"; then
- func_show_eval '(cd "$output_objdir" && $RM "$linkname" && $LN_S "$realname" "$linkname")' 'exit $?'
+ $show "(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)"
+ $run eval '(cd $output_objdir && $rm $linkname && $LN_S $realname $linkname)' || exit $?
fi
done
@@ -8581,35 +4237,38 @@ EOF
;;
obj)
- if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
- func_warning "\`-dlopen' is ignored for objects"
+ if test -n "$deplibs"; then
+ $echo "$modename: warning: \`-l' and \`-L' are ignored for objects" 1>&2
fi
- case " $deplibs" in
- *\ -l* | *\ -L*)
- func_warning "\`-l' and \`-L' are ignored for objects" ;;
- esac
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ $echo "$modename: warning: \`-dlopen' is ignored for objects" 1>&2
+ fi
- test -n "$rpath" && \
- func_warning "\`-rpath' is ignored for objects"
+ if test -n "$rpath"; then
+ $echo "$modename: warning: \`-rpath' is ignored for objects" 1>&2
+ fi
- test -n "$xrpath" && \
- func_warning "\`-R' is ignored for objects"
+ if test -n "$xrpath"; then
+ $echo "$modename: warning: \`-R' is ignored for objects" 1>&2
+ fi
- test -n "$vinfo" && \
- func_warning "\`-version-info' is ignored for objects"
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for objects" 1>&2
+ fi
- test -n "$release" && \
- func_warning "\`-release' is ignored for objects"
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for objects" 1>&2
+ fi
case $output in
*.lo)
- test -n "$objs$old_deplibs" && \
- func_fatal_error "cannot build library object \`$output' from non-libtool objects"
-
- libobj=$output
- func_lo2o "$libobj"
- obj=$func_lo2o_result
+ if test -n "$objs$old_deplibs"; then
+ $echo "$modename: cannot build library object \`$output' from non-libtool objects" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ libobj="$output"
+ obj=`$echo "X$output" | $Xsed -e "$lo2o"`
;;
*)
libobj=
@@ -8618,7 +4277,7 @@ EOF
esac
# Delete the old objects.
- $opt_dry_run || $RM $obj $libobj
+ $run $rm $obj $libobj
# Objects from convenience libraries. This assumes
# single-version convenience libraries. Whenever we create
@@ -8634,29 +4293,35 @@ EOF
if test -n "$convenience"; then
if test -n "$whole_archive_flag_spec"; then
eval tmp_whole_archive_flags=\"$whole_archive_flag_spec\"
- reload_conv_objs=$reload_objs\ `$ECHO "$tmp_whole_archive_flags" | $SED 's|,| |g'`
+ reload_conv_objs=$reload_objs\ `$echo "X$tmp_whole_archive_flags" | $Xsed -e 's|,| |g'`
else
gentop="$output_objdir/${obj}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $convenience
reload_conv_objs="$reload_objs $func_extract_archives_result"
fi
fi
- # If we're not building shared, we need to use non_pic_objs
- test "$build_libtool_libs" != yes && libobjs="$non_pic_objects"
-
# Create the old-style object.
- reload_objs="$objs$old_deplibs "`$ECHO "$libobjs" | $SP2NL | $SED "/\.${libext}$/d; /\.lib$/d; $lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
+ reload_objs="$objs$old_deplibs "`$echo "X$libobjs" | $SP2NL | $Xsed -e '/\.'${libext}$'/d' -e '/\.lib$/d' -e "$lo2o" | $NL2SP`" $reload_conv_objs" ### testsuite: skip nested quoting test
output="$obj"
- func_execute_cmds "$reload_cmds" 'exit $?'
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
# Exit if we aren't doing a library object file.
if test -z "$libobj"; then
if test -n "$gentop"; then
- func_show_eval '${RM}r "$gentop"'
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
fi
exit $EXIT_SUCCESS
@@ -8664,13 +4329,14 @@ EOF
if test "$build_libtool_libs" != yes; then
if test -n "$gentop"; then
- func_show_eval '${RM}r "$gentop"'
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
fi
# Create an invalid libtool object if no PIC, so that we don't
# accidentally link it into a program.
# $show "echo timestamp > $libobj"
- # $opt_dry_run || eval "echo timestamp > $libobj" || exit $?
+ # $run eval "echo timestamp > $libobj" || exit $?
exit $EXIT_SUCCESS
fi
@@ -8678,11 +4344,20 @@ EOF
# Only do commands if we really have different PIC objects.
reload_objs="$libobjs $reload_conv_objs"
output="$libobj"
- func_execute_cmds "$reload_cmds" 'exit $?'
+ cmds=$reload_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
fi
if test -n "$gentop"; then
- func_show_eval '${RM}r "$gentop"'
+ $show "${rm}r $gentop"
+ $run ${rm}r $gentop
fi
exit $EXIT_SUCCESS
@@ -8690,45 +4365,39 @@ EOF
prog)
case $host in
- *cygwin*) func_stripname '' '.exe' "$output"
- output=$func_stripname_result.exe;;
+ *cygwin*) output=`$echo $output | ${SED} -e 's,.exe$,,;s,$,.exe,'` ;;
esac
- test -n "$vinfo" && \
- func_warning "\`-version-info' is ignored for programs"
+ if test -n "$vinfo"; then
+ $echo "$modename: warning: \`-version-info' is ignored for programs" 1>&2
+ fi
- test -n "$release" && \
- func_warning "\`-release' is ignored for programs"
+ if test -n "$release"; then
+ $echo "$modename: warning: \`-release' is ignored for programs" 1>&2
+ fi
- test "$preload" = yes \
- && test "$dlopen_support" = unknown \
- && test "$dlopen_self" = unknown \
- && test "$dlopen_self_static" = unknown && \
- func_warning "\`LT_INIT([dlopen])' not used. Assuming no dlopen support."
+ if test "$preload" = yes; then
+ if test "$dlopen_support" = unknown && test "$dlopen_self" = unknown &&
+ test "$dlopen_self_static" = unknown; then
+ $echo "$modename: warning: \`AC_LIBTOOL_DLOPEN' not used. Assuming no dlopen support."
+ fi
+ fi
case $host in
*-*-rhapsody* | *-*-darwin1.[012])
# On Rhapsody replace the C library is the System framework
- compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's/ -lc / System.ltframework /'`
- finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's/ -lc / System.ltframework /'`
+ compile_deplibs=`$echo "X $compile_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
+ finalize_deplibs=`$echo "X $finalize_deplibs" | $Xsed -e 's/ -lc / -framework System /'`
;;
esac
case $host in
- *-*-darwin*)
- # Don't allow lazy linking, it breaks C++ global constructors
- # But is supposedly fixed on 10.4 or later (yay!).
- if test "$tagname" = CXX ; then
- case ${MACOSX_DEPLOYMENT_TARGET-10.0} in
- 10.[0123])
- func_append compile_command " ${wl}-bind_at_load"
- func_append finalize_command " ${wl}-bind_at_load"
- ;;
- esac
- fi
- # Time to change all our "foo.ltframework" stuff back to "-framework foo"
- compile_deplibs=`$ECHO " $compile_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- finalize_deplibs=`$ECHO " $finalize_deplibs" | $SED 's% \([^ $]*\).ltframework% -framework \1%g'`
- ;;
+ *darwin*)
+ # Don't allow lazy linking, it breaks C++ global constructors
+ if test "$tagname" = CXX ; then
+ compile_command="$compile_command ${wl}-bind_at_load"
+ finalize_command="$finalize_command ${wl}-bind_at_load"
+ fi
+ ;;
esac
@@ -8741,7 +4410,7 @@ EOF
*)
case " $compile_deplibs " in
*" -L$path/$objdir "*)
- func_append new_libs " -L$path/$objdir" ;;
+ new_libs="$new_libs -L$path/$objdir" ;;
esac
;;
esac
@@ -8751,17 +4420,17 @@ EOF
-L*)
case " $new_libs " in
*" $deplib "*) ;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
;;
- *) func_append new_libs " $deplib" ;;
+ *) new_libs="$new_libs $deplib" ;;
esac
done
compile_deplibs="$new_libs"
- func_append compile_command " $compile_deplibs"
- func_append finalize_command " $finalize_deplibs"
+ compile_command="$compile_command $compile_deplibs"
+ finalize_command="$finalize_command $finalize_deplibs"
if test -n "$rpath$xrpath"; then
# If the user specified any rpath flags, then add them.
@@ -8769,7 +4438,7 @@ EOF
# This is the magic to use -rpath.
case "$finalize_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_rpath " $libdir" ;;
+ *) finalize_rpath="$finalize_rpath $libdir" ;;
esac
done
fi
@@ -8788,32 +4457,30 @@ EOF
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
- func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ rpath="$rpath $flag"
fi
elif test -n "$runpath_var"; then
case "$perm_rpath " in
*" $libdir "*) ;;
- *) func_append perm_rpath " $libdir" ;;
+ *) perm_rpath="$perm_rpath $libdir" ;;
esac
fi
case $host in
- *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2* | *-cegcc*)
- testbindir=`${ECHO} "$libdir" | ${SED} -e 's*/lib$*/bin*'`
+ *-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-os2*)
+ testbindir=`$echo "X$libdir" | $Xsed -e 's*/lib$*/bin*'`
case :$dllsearchpath: in
*":$libdir:"*) ;;
- ::) dllsearchpath=$libdir;;
- *) func_append dllsearchpath ":$libdir";;
+ *) dllsearchpath="$dllsearchpath:$libdir";;
esac
case :$dllsearchpath: in
*":$testbindir:"*) ;;
- ::) dllsearchpath=$testbindir;;
- *) func_append dllsearchpath ":$testbindir";;
+ *) dllsearchpath="$dllsearchpath:$testbindir";;
esac
;;
esac
@@ -8839,18 +4506,18 @@ EOF
*"$hardcode_libdir_separator$libdir$hardcode_libdir_separator"*)
;;
*)
- func_append hardcode_libdirs "$hardcode_libdir_separator$libdir"
+ hardcode_libdirs="$hardcode_libdirs$hardcode_libdir_separator$libdir"
;;
esac
fi
else
eval flag=\"$hardcode_libdir_flag_spec\"
- func_append rpath " $flag"
+ rpath="$rpath $flag"
fi
elif test -n "$runpath_var"; then
case "$finalize_perm_rpath " in
*" $libdir "*) ;;
- *) func_append finalize_perm_rpath " $libdir" ;;
+ *) finalize_perm_rpath="$finalize_perm_rpath $libdir" ;;
esac
fi
done
@@ -8864,57 +4531,281 @@ EOF
if test -n "$libobjs" && test "$build_old_libs" = yes; then
# Transform all the library objects into standard objects.
- compile_command=`$ECHO "$compile_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
- finalize_command=`$ECHO "$finalize_command" | $SP2NL | $SED "$lo2o" | $NL2SP`
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
fi
- func_generate_dlsyms "$outputname" "@PROGRAM@" "no"
+ dlsyms=
+ if test -n "$dlfiles$dlprefiles" || test "$dlself" != no; then
+ if test -n "$NM" && test -n "$global_symbol_pipe"; then
+ dlsyms="${outputname}S.c"
+ else
+ $echo "$modename: not configured to extract global symbols from dlpreopened files" 1>&2
+ fi
+ fi
+
+ if test -n "$dlsyms"; then
+ case $dlsyms in
+ "") ;;
+ *.c)
+ # Discover the nlist of each of the dlfiles.
+ nlist="$output_objdir/${outputname}.nm"
+
+ $show "$rm $nlist ${nlist}S ${nlist}T"
+ $run $rm "$nlist" "${nlist}S" "${nlist}T"
+
+ # Parse the name list into a source file.
+ $show "creating $output_objdir/$dlsyms"
+
+ test -z "$run" && $echo > "$output_objdir/$dlsyms" "\
+/* $dlsyms - symbol resolution table for \`$outputname' dlsym emulation. */
+/* Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP */
+
+#ifdef __cplusplus
+extern \"C\" {
+#endif
+
+/* Prevent the only kind of declaration conflicts we can make. */
+#define lt_preloaded_symbols some_other_symbol
+
+/* External symbol declarations for the compiler. */\
+"
+
+ if test "$dlself" = yes; then
+ $show "generating symbol list for \`$output'"
+
+ test -z "$run" && $echo ': @PROGRAM@ ' > "$nlist"
+
+ # Add our own program objects to the symbol list.
+ progfiles=`$echo "X$objs$old_deplibs" | $SP2NL | $Xsed -e "$lo2o" | $NL2SP`
+ for arg in $progfiles; do
+ $show "extracting global C symbols from \`$arg'"
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -n "$exclude_expsyms"; then
+ $run eval '$EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ if test -n "$export_symbols_regex"; then
+ $run eval '$EGREP -e "$export_symbols_regex" "$nlist" > "$nlist"T'
+ $run eval '$mv "$nlist"T "$nlist"'
+ fi
+
+ # Prepare the list of exported symbols
+ if test -z "$export_symbols"; then
+ export_symbols="$output_objdir/$outputname.exp"
+ $run $rm $export_symbols
+ $run eval "${SED} -n -e '/^: @PROGRAM@ $/d' -e 's/^.* \(.*\)$/\1/p' "'< "$nlist" > "$export_symbols"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$export_symbols" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ else
+ $run eval "${SED} -e 's/\([].[*^$]\)/\\\\\1/g' -e 's/^/ /' -e 's/$/$/'"' < "$export_symbols" > "$output_objdir/$outputname.exp"'
+ $run eval 'grep -f "$output_objdir/$outputname.exp" < "$nlist" > "$nlist"T'
+ $run eval 'mv "$nlist"T "$nlist"'
+ case $host in
+ *cygwin* | *mingw* )
+ $run eval "echo EXPORTS "'> "$output_objdir/$outputname.def"'
+ $run eval 'cat "$nlist" >> "$output_objdir/$outputname.def"'
+ ;;
+ esac
+ fi
+ fi
+
+ for arg in $dlprefiles; do
+ $show "extracting global C symbols from \`$arg'"
+ name=`$echo "$arg" | ${SED} -e 's%^.*/%%'`
+ $run eval '$echo ": $name " >> "$nlist"'
+ $run eval "$NM $arg | $global_symbol_pipe >> '$nlist'"
+ done
+
+ if test -z "$run"; then
+ # Make sure we have at least an empty file.
+ test -f "$nlist" || : > "$nlist"
+
+ if test -n "$exclude_expsyms"; then
+ $EGREP -v " ($exclude_expsyms)$" "$nlist" > "$nlist"T
+ $mv "$nlist"T "$nlist"
+ fi
+
+ # Try sorting and uniquifying the output.
+ if grep -v "^: " < "$nlist" |
+ if sort -k 3 </dev/null >/dev/null 2>&1; then
+ sort -k 3
+ else
+ sort +2
+ fi |
+ uniq > "$nlist"S; then
+ :
+ else
+ grep -v "^: " < "$nlist" > "$nlist"S
+ fi
+
+ if test -f "$nlist"S; then
+ eval "$global_symbol_to_cdecl"' < "$nlist"S >> "$output_objdir/$dlsyms"'
+ else
+ $echo '/* NONE */' >> "$output_objdir/$dlsyms"
+ fi
+
+ $echo >> "$output_objdir/$dlsyms" "\
+
+#undef lt_preloaded_symbols
+
+#if defined (__STDC__) && __STDC__
+# define lt_ptr void *
+#else
+# define lt_ptr char *
+# define const
+#endif
+
+/* The mapping between symbol names and symbols. */
+"
+
+ case $host in
+ *cygwin* | *mingw* )
+ $echo >> "$output_objdir/$dlsyms" "\
+/* DATA imports from DLLs on WIN32 can't be const, because
+ runtime relocations are performed -- see ld's documentation
+ on pseudo-relocs */
+struct {
+"
+ ;;
+ * )
+ $echo >> "$output_objdir/$dlsyms" "\
+const struct {
+"
+ ;;
+ esac
+
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ const char *name;
+ lt_ptr address;
+}
+lt_preloaded_symbols[] =
+{\
+"
+
+ eval "$global_symbol_to_c_name_address" < "$nlist" >> "$output_objdir/$dlsyms"
+
+ $echo >> "$output_objdir/$dlsyms" "\
+ {0, (lt_ptr) 0}
+};
+
+/* This works around a problem in FreeBSD linker */
+#ifdef FREEBSD_WORKAROUND
+static const void *lt_preloaded_setup() {
+ return lt_preloaded_symbols;
+}
+#endif
+
+#ifdef __cplusplus
+}
+#endif\
+"
+ fi
+
+ pic_flag_for_symtable=
+ case $host in
+ # compiling the symbol table file with pic_flag works around
+ # a FreeBSD bug that causes programs to crash when -lm is
+ # linked before any other PIC object. But we must not use
+ # pic_flag when linking with -static. The problem exists in
+ # FreeBSD 2.2.6 and is fixed in FreeBSD 3.1.
+ *-*-freebsd2*|*-*-freebsd3.0*|*-*-freebsdelf3.0*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag -DFREEBSD_WORKAROUND";;
+ esac;;
+ *-*-hpux*)
+ case "$compile_command " in
+ *" -static "*) ;;
+ *) pic_flag_for_symtable=" $pic_flag";;
+ esac
+ esac
+
+ # Now compile the dynamic symbol file.
+ $show "(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable \"$dlsyms\")"
+ $run eval '(cd $output_objdir && $LTCC $LTCFLAGS -c$no_builtin_flag$pic_flag_for_symtable "$dlsyms")' || exit $?
+
+ # Clean up the generated files.
+ $show "$rm $output_objdir/$dlsyms $nlist ${nlist}S ${nlist}T"
+ $run $rm "$output_objdir/$dlsyms" "$nlist" "${nlist}S" "${nlist}T"
+
+ # Transform the symbol file into the correct name.
+ case $host in
+ *cygwin* | *mingw* )
+ if test -f "$output_objdir/${outputname}.def" ; then
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}.def $output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ else
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ fi
+ ;;
+ * )
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s%@SYMFILE@%$output_objdir/${outputname}S.${objext}%" | $NL2SP`
+ ;;
+ esac
+ ;;
+ *)
+ $echo "$modename: unknown suffix for \`$dlsyms'" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ else
+ # We keep going just in case the user didn't refer to
+ # lt_preloaded_symbols. The linker will fail if global_symbol_pipe
+ # really was required.
- # template prelinking step
- if test -n "$prelink_cmds"; then
- func_execute_cmds "$prelink_cmds" 'exit $?'
+ # Nullify the symbol file.
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
+ finalize_command=`$echo "X$finalize_command" | $SP2NL | $Xsed -e "s% @SYMFILE@%%" | $NL2SP`
fi
- wrappers_required=yes
- case $host in
- *cegcc* | *mingw32ce*)
- # Disable wrappers for cegcc and mingw32ce hosts, we are cross compiling anyway.
- wrappers_required=no
- ;;
- *cygwin* | *mingw* )
- if test "$build_libtool_libs" != yes; then
- wrappers_required=no
- fi
- ;;
- *)
- if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
- wrappers_required=no
- fi
- ;;
- esac
- if test "$wrappers_required" = no; then
+ if test "$need_relink" = no || test "$build_libtool_libs" != yes; then
# Replace the output file specification.
- compile_command=`$ECHO "$compile_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ compile_command=`$echo "X$compile_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$output"'%g' | $NL2SP`
link_command="$compile_command$compile_rpath"
# We have no uninstalled library dependencies, so finalize right now.
- exit_status=0
- func_show_eval "$link_command" 'exit_status=$?'
-
- if test -n "$postlink_cmds"; then
- func_to_tool_file "$output"
- postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
- func_execute_cmds "$postlink_cmds" 'exit $?'
- fi
+ $show "$link_command"
+ $run eval "$link_command"
+ exit_status=$?
# Delete the generated files.
- if test -f "$output_objdir/${outputname}S.${objext}"; then
- func_show_eval '$RM "$output_objdir/${outputname}S.${objext}"'
+ if test -n "$dlsyms"; then
+ $show "$rm $output_objdir/${outputname}S.${objext}"
+ $run $rm "$output_objdir/${outputname}S.${objext}"
fi
exit $exit_status
fi
+ if test -n "$shlibpath_var"; then
+ # We should set the shlibpath_var
+ rpath=
+ for dir in $temp_rpath; do
+ case $dir in
+ [\\/]* | [A-Za-z]:[\\/]*)
+ # Absolute path.
+ rpath="$rpath$dir:"
+ ;;
+ *)
+ # Relative path: add a thisdir entry.
+ rpath="$rpath\$thisdir/$dir:"
+ ;;
+ esac
+ done
+ temp_rpath="$rpath"
+ fi
+
if test -n "$compile_shlibpath$finalize_shlibpath"; then
compile_command="$shlibpath_var=\"$compile_shlibpath$finalize_shlibpath\$$shlibpath_var\" $compile_command"
fi
@@ -8929,7 +4820,7 @@ EOF
# We should set the runpath_var.
rpath=
for dir in $perm_rpath; do
- func_append rpath "$dir:"
+ rpath="$rpath$dir:"
done
compile_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
@@ -8937,7 +4828,7 @@ EOF
# We should set the runpath_var.
rpath=
for dir in $finalize_perm_rpath; do
- func_append rpath "$dir:"
+ rpath="$rpath$dir:"
done
finalize_var="$runpath_var=\"$rpath\$$runpath_var\" "
fi
@@ -8947,18 +4838,12 @@ EOF
# We don't need to create a wrapper script.
link_command="$compile_var$compile_command$compile_rpath"
# Replace the output file specification.
- link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output"'%g'`
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output"'%g'`
# Delete the old output file.
- $opt_dry_run || $RM $output
+ $run $rm $output
# Link the executable and exit
- func_show_eval "$link_command" 'exit $?'
-
- if test -n "$postlink_cmds"; then
- func_to_tool_file "$output"
- postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
- func_execute_cmds "$postlink_cmds" 'exit $?'
- fi
-
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
exit $EXIT_SUCCESS
fi
@@ -8967,13 +4852,13 @@ EOF
link_command="$compile_var$compile_command$compile_rpath"
relink_command="$finalize_var$finalize_command$finalize_rpath"
- func_warning "this platform does not like uninstalled shared libraries"
- func_warning "\`$output' will be relinked during installation"
+ $echo "$modename: warning: this platform does not like uninstalled shared libraries" 1>&2
+ $echo "$modename: \`$output' will be relinked during installation" 1>&2
else
if test "$fast_install" != no; then
link_command="$finalize_var$compile_command$finalize_rpath"
if test "$fast_install" = yes; then
- relink_command=`$ECHO "$compile_var$compile_command$compile_rpath" | $SED 's%@OUTPUT@%\$progdir/\$file%g'`
+ relink_command=`$echo "X$compile_var$compile_command$compile_rpath" | $SP2NL | $Xsed -e 's%@OUTPUT@%\$progdir/\$file%g' | $NL2SP`
else
# fast_install is set to needless
relink_command=
@@ -8985,98 +4870,608 @@ EOF
fi
# Replace the output file specification.
- link_command=`$ECHO "$link_command" | $SED 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
+ link_command=`$echo "X$link_command" | $Xsed -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g'`
# Delete the old output files.
- $opt_dry_run || $RM $output $output_objdir/$outputname $output_objdir/lt-$outputname
+ $run $rm $output $output_objdir/$outputname $output_objdir/lt-$outputname
- func_show_eval "$link_command" 'exit $?'
-
- if test -n "$postlink_cmds"; then
- func_to_tool_file "$output_objdir/$outputname"
- postlink_cmds=`func_echo_all "$postlink_cmds" | $SED -e 's%@OUTPUT@%'"$output_objdir/$outputname"'%g' -e 's%@TOOL_OUTPUT@%'"$func_to_tool_file_result"'%g'`
- func_execute_cmds "$postlink_cmds" 'exit $?'
- fi
+ $show "$link_command"
+ $run eval "$link_command" || exit $?
# Now create the wrapper script.
- func_verbose "creating $output"
+ $show "creating $output"
# Quote the relink command for shipping.
if test -n "$relink_command"; then
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
- func_quote_for_eval "$var_value"
- relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
fi
done
relink_command="(cd `pwd`; $relink_command)"
- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
+ fi
+
+ # Quote $echo for shipping.
+ if test "X$echo" = "X$SHELL $progpath --fallback-echo"; then
+ case $progpath in
+ [\\/]* | [A-Za-z]:[\\/]*) qecho="$SHELL $progpath --fallback-echo";;
+ *) qecho="$SHELL `pwd`/$progpath --fallback-echo";;
+ esac
+ qecho=`$echo "X$qecho" | $Xsed -e "$sed_quote_subst"`
+ else
+ qecho=`$echo "X$echo" | $Xsed -e "$sed_quote_subst"`
fi
- # Only actually do things if not in dry run mode.
- $opt_dry_run || {
+ # Only actually do things if our run command is non-null.
+ if test -z "$run"; then
# win32 will think the script is a binary if it has
# a .exe suffix, so we strip it off here.
case $output in
- *.exe) func_stripname '' '.exe' "$output"
- output=$func_stripname_result ;;
+ *.exe) output=`$echo $output|${SED} 's,.exe$,,'` ;;
esac
# test for cygwin because mv fails w/o .exe extensions
case $host in
*cygwin*)
exeext=.exe
- func_stripname '' '.exe' "$outputname"
- outputname=$func_stripname_result ;;
+ outputname=`$echo $outputname|${SED} 's,.exe$,,'` ;;
*) exeext= ;;
esac
case $host in
*cygwin* | *mingw* )
- func_dirname_and_basename "$output" "" "."
- output_name=$func_basename_result
- output_path=$func_dirname_result
- cwrappersource="$output_path/$objdir/lt-$output_name.c"
- cwrapper="$output_path/$output_name.exe"
- $RM $cwrappersource $cwrapper
- trap "$RM $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
-
- func_emit_cwrapperexe_src > $cwrappersource
-
- # The wrapper executable is built using the $host compiler,
- # because it contains $host paths and files. If cross-
- # compiling, it, like the target executable, must be
- # executed on the $host or under an emulation environment.
- $opt_dry_run || {
- $LTCC $LTCFLAGS -o $cwrapper $cwrappersource
- $STRIP $cwrapper
- }
+ output_name=`basename $output`
+ output_path=`dirname $output`
+ cwrappersource="$output_path/$objdir/lt-$output_name.c"
+ cwrapper="$output_path/$output_name.exe"
+ $rm $cwrappersource $cwrapper
+ trap "$rm $cwrappersource $cwrapper; exit $EXIT_FAILURE" 1 2 15
- # Now, create the wrapper script for func_source use:
- func_ltwrapper_scriptname $cwrapper
- $RM $func_ltwrapper_scriptname_result
- trap "$RM $func_ltwrapper_scriptname_result; exit $EXIT_FAILURE" 1 2 15
- $opt_dry_run || {
- # note: this script will not be executed, so do not chmod.
- if test "x$build" = "x$host" ; then
- $cwrapper --lt-dump-script > $func_ltwrapper_scriptname_result
- else
- func_emit_wrapper no > $func_ltwrapper_scriptname_result
- fi
- }
+ cat > $cwrappersource <<EOF
+
+/* $cwrappersource - temporary wrapper executable for $objdir/$outputname
+ Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+
+ The $output program cannot be directly executed until all the libtool
+ libraries that it depends on are installed.
+
+ This wrapper executable should never be moved out of the build directory.
+ If it is, it will not operate correctly.
+
+ Currently, it simply execs the wrapper *script* "/bin/sh $output",
+ but could eventually absorb all of the scripts functionality and
+ exec $objdir/$outputname directly.
+*/
+EOF
+ cat >> $cwrappersource<<"EOF"
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+#include <malloc.h>
+#include <stdarg.h>
+#include <assert.h>
+#include <string.h>
+#include <ctype.h>
+#include <sys/stat.h>
+
+#if defined(PATH_MAX)
+# define LT_PATHMAX PATH_MAX
+#elif defined(MAXPATHLEN)
+# define LT_PATHMAX MAXPATHLEN
+#else
+# define LT_PATHMAX 1024
+#endif
+
+#ifndef DIR_SEPARATOR
+# define DIR_SEPARATOR '/'
+# define PATH_SEPARATOR ':'
+#endif
+
+#if defined (_WIN32) || defined (__MSDOS__) || defined (__DJGPP__) || \
+ defined (__OS2__)
+# define HAVE_DOS_BASED_FILE_SYSTEM
+# ifndef DIR_SEPARATOR_2
+# define DIR_SEPARATOR_2 '\\'
+# endif
+# ifndef PATH_SEPARATOR_2
+# define PATH_SEPARATOR_2 ';'
+# endif
+#endif
+
+#ifndef DIR_SEPARATOR_2
+# define IS_DIR_SEPARATOR(ch) ((ch) == DIR_SEPARATOR)
+#else /* DIR_SEPARATOR_2 */
+# define IS_DIR_SEPARATOR(ch) \
+ (((ch) == DIR_SEPARATOR) || ((ch) == DIR_SEPARATOR_2))
+#endif /* DIR_SEPARATOR_2 */
+
+#ifndef PATH_SEPARATOR_2
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR)
+#else /* PATH_SEPARATOR_2 */
+# define IS_PATH_SEPARATOR(ch) ((ch) == PATH_SEPARATOR_2)
+#endif /* PATH_SEPARATOR_2 */
+
+#define XMALLOC(type, num) ((type *) xmalloc ((num) * sizeof(type)))
+#define XFREE(stale) do { \
+ if (stale) { free ((void *) stale); stale = 0; } \
+} while (0)
+
+/* -DDEBUG is fairly common in CFLAGS. */
+#undef DEBUG
+#if defined DEBUGWRAPPER
+# define DEBUG(format, ...) fprintf(stderr, format, __VA_ARGS__)
+#else
+# define DEBUG(format, ...)
+#endif
+
+const char *program_name = NULL;
+
+void * xmalloc (size_t num);
+char * xstrdup (const char *string);
+const char * base_name (const char *name);
+char * find_executable(const char *wrapper);
+int check_executable(const char *path);
+char * strendzap(char *str, const char *pat);
+void lt_fatal (const char *message, ...);
+
+int
+main (int argc, char *argv[])
+{
+ char **newargz;
+ int i;
+
+ program_name = (char *) xstrdup (base_name (argv[0]));
+ DEBUG("(main) argv[0] : %s\n",argv[0]);
+ DEBUG("(main) program_name : %s\n",program_name);
+ newargz = XMALLOC(char *, argc+2);
+EOF
+
+ cat >> $cwrappersource <<EOF
+ newargz[0] = (char *) xstrdup("$SHELL");
+EOF
+
+ cat >> $cwrappersource <<"EOF"
+ newargz[1] = find_executable(argv[0]);
+ if (newargz[1] == NULL)
+ lt_fatal("Couldn't find %s", argv[0]);
+ DEBUG("(main) found exe at : %s\n",newargz[1]);
+ /* we know the script has the same name, without the .exe */
+ /* so make sure newargz[1] doesn't end in .exe */
+ strendzap(newargz[1],".exe");
+ for (i = 1; i < argc; i++)
+ newargz[i+1] = xstrdup(argv[i]);
+ newargz[argc+1] = NULL;
+
+ for (i=0; i<argc+1; i++)
+ {
+ DEBUG("(main) newargz[%d] : %s\n",i,newargz[i]);
+ ;
+ }
+
+EOF
+
+ case $host_os in
+ mingw*)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",(char const **)newargz);
+EOF
+ ;;
+ *)
+ cat >> $cwrappersource <<EOF
+ execv("$SHELL",newargz);
+EOF
+ ;;
+ esac
+
+ cat >> $cwrappersource <<"EOF"
+ return 127;
+}
+
+void *
+xmalloc (size_t num)
+{
+ void * p = (void *) malloc (num);
+ if (!p)
+ lt_fatal ("Memory exhausted");
+
+ return p;
+}
+
+char *
+xstrdup (const char *string)
+{
+ return string ? strcpy ((char *) xmalloc (strlen (string) + 1), string) : NULL
+;
+}
+
+const char *
+base_name (const char *name)
+{
+ const char *base;
+
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ /* Skip over the disk name in MSDOS pathnames. */
+ if (isalpha ((unsigned char)name[0]) && name[1] == ':')
+ name += 2;
+#endif
+
+ for (base = name; *name; name++)
+ if (IS_DIR_SEPARATOR (*name))
+ base = name + 1;
+ return base;
+}
+
+int
+check_executable(const char * path)
+{
+ struct stat st;
+
+ DEBUG("(check_executable) : %s\n", path ? (*path ? path : "EMPTY!") : "NULL!");
+ if ((!path) || (!*path))
+ return 0;
+
+ if ((stat (path, &st) >= 0) &&
+ (
+ /* MinGW & native WIN32 do not support S_IXOTH or S_IXGRP */
+#if defined (S_IXOTH)
+ ((st.st_mode & S_IXOTH) == S_IXOTH) ||
+#endif
+#if defined (S_IXGRP)
+ ((st.st_mode & S_IXGRP) == S_IXGRP) ||
+#endif
+ ((st.st_mode & S_IXUSR) == S_IXUSR))
+ )
+ return 1;
+ else
+ return 0;
+}
+
+/* Searches for the full path of the wrapper. Returns
+ newly allocated full path name if found, NULL otherwise */
+char *
+find_executable (const char* wrapper)
+{
+ int has_slash = 0;
+ const char* p;
+ const char* p_next;
+ /* static buffer for getcwd */
+ char tmp[LT_PATHMAX + 1];
+ int tmp_len;
+ char* concat_name;
+
+ DEBUG("(find_executable) : %s\n", wrapper ? (*wrapper ? wrapper : "EMPTY!") : "NULL!");
+
+ if ((wrapper == NULL) || (*wrapper == '\0'))
+ return NULL;
+
+ /* Absolute path? */
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ if (isalpha ((unsigned char)wrapper[0]) && wrapper[1] == ':')
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ else
+ {
+#endif
+ if (IS_DIR_SEPARATOR (wrapper[0]))
+ {
+ concat_name = xstrdup (wrapper);
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+#if defined (HAVE_DOS_BASED_FILE_SYSTEM)
+ }
+#endif
+
+ for (p = wrapper; *p; p++)
+ if (*p == '/')
+ {
+ has_slash = 1;
+ break;
+ }
+ if (!has_slash)
+ {
+ /* no slashes; search PATH */
+ const char* path = getenv ("PATH");
+ if (path != NULL)
+ {
+ for (p = path; *p; p = p_next)
+ {
+ const char* q;
+ size_t p_len;
+ for (q = p; *q; q++)
+ if (IS_PATH_SEPARATOR(*q))
+ break;
+ p_len = q - p;
+ p_next = (*q == '\0' ? q : q + 1);
+ if (p_len == 0)
+ {
+ /* empty path: current directory */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+ }
+ else
+ {
+ concat_name = XMALLOC(char, p_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, p, p_len);
+ concat_name[p_len] = '/';
+ strcpy (concat_name + p_len + 1, wrapper);
+ }
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ }
+ }
+ /* not found in PATH; assume curdir */
+ }
+ /* Relative path | not found in path: prepend cwd */
+ if (getcwd (tmp, LT_PATHMAX) == NULL)
+ lt_fatal ("getcwd failed");
+ tmp_len = strlen(tmp);
+ concat_name = XMALLOC(char, tmp_len + 1 + strlen(wrapper) + 1);
+ memcpy (concat_name, tmp, tmp_len);
+ concat_name[tmp_len] = '/';
+ strcpy (concat_name + tmp_len + 1, wrapper);
+
+ if (check_executable(concat_name))
+ return concat_name;
+ XFREE(concat_name);
+ return NULL;
+}
+
+char *
+strendzap(char *str, const char *pat)
+{
+ size_t len, patlen;
+
+ assert(str != NULL);
+ assert(pat != NULL);
+
+ len = strlen(str);
+ patlen = strlen(pat);
+
+ if (patlen <= len)
+ {
+ str += len - patlen;
+ if (strcmp(str, pat) == 0)
+ *str = '\0';
+ }
+ return str;
+}
+
+static void
+lt_error_core (int exit_status, const char * mode,
+ const char * message, va_list ap)
+{
+ fprintf (stderr, "%s: %s: ", program_name, mode);
+ vfprintf (stderr, message, ap);
+ fprintf (stderr, ".\n");
+
+ if (exit_status >= 0)
+ exit (exit_status);
+}
+
+void
+lt_fatal (const char *message, ...)
+{
+ va_list ap;
+ va_start (ap, message);
+ lt_error_core (EXIT_FAILURE, "FATAL", message, ap);
+ va_end (ap);
+}
+EOF
+ # we should really use a build-platform specific compiler
+ # here, but OTOH, the wrappers (shell script and this C one)
+ # are only useful if you want to execute the "real" binary.
+ # Since the "real" binary is built for $host, then this
+ # wrapper might as well be built for $host, too.
+ $run $LTCC $LTCFLAGS -s -o $cwrapper $cwrappersource
+ ;;
+ esac
+ $rm $output
+ trap "$rm $output; exit $EXIT_FAILURE" 1 2 15
+
+ $echo > $output "\
+#! $SHELL
+
+# $output - temporary wrapper script for $objdir/$outputname
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
+#
+# The $output program cannot be directly executed until all the libtool
+# libraries that it depends on are installed.
+#
+# This wrapper script should never be moved out of the build directory.
+# If it is, it will not operate correctly.
+
+# Sed substitution that helps us do robust quoting. It backslashifies
+# metacharacters that are still active within double-quoted strings.
+Xsed='${SED} -e 1s/^X//'
+sed_quote_subst='$sed_quote_subst'
+
+# Be Bourne compatible (taken from Autoconf:_AS_BOURNE_COMPATIBLE).
+if test -n \"\${ZSH_VERSION+set}\" && (emulate sh) >/dev/null 2>&1; then
+ emulate sh
+ NULLCMD=:
+ # Zsh 3.x and 4.x performs word splitting on \${1+\"\$@\"}, which
+ # is contrary to our usage. Disable this feature.
+ alias -g '\${1+\"\$@\"}'='\"\$@\"'
+ setopt NO_GLOB_SUBST
+else
+ case \`(set -o) 2>/dev/null\` in *posix*) set -o posix;; esac
+fi
+BIN_SH=xpg4; export BIN_SH # for Tru64
+DUALCASE=1; export DUALCASE # for MKS sh
+
+# The HP-UX ksh and POSIX shell print the target directory to stdout
+# if CDPATH is set.
+(unset CDPATH) >/dev/null 2>&1 && unset CDPATH
+
+relink_command=\"$relink_command\"
+
+# This environment variable determines our operation mode.
+if test \"\$libtool_install_magic\" = \"$magic\"; then
+ # install mode needs the following variable:
+ notinst_deplibs='$notinst_deplibs'
+else
+ # When we are sourced in execute mode, \$file and \$echo are already set.
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ echo=\"$qecho\"
+ file=\"\$0\"
+ # Make sure echo works.
+ if test \"X\$1\" = X--no-reexec; then
+ # Discard the --no-reexec flag, and continue.
+ shift
+ elif test \"X\`(\$echo '\t') 2>/dev/null\`\" = 'X\t'; then
+ # Yippee, \$echo works!
+ :
+ else
+ # Restart under the correct shell, and then maybe \$echo will work.
+ exec $SHELL \"\$0\" --no-reexec \${1+\"\$@\"}
+ fi
+ fi\
+"
+ $echo >> $output "\
+
+ # Find the directory that this script lives in.
+ thisdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*$%%'\`
+ test \"x\$thisdir\" = \"x\$file\" && thisdir=.
+
+ # Follow symbolic links until we get to the real thisdir.
+ file=\`ls -ld \"\$file\" | ${SED} -n 's/.*-> //p'\`
+ while test -n \"\$file\"; do
+ destdir=\`\$echo \"X\$file\" | \$Xsed -e 's%/[^/]*\$%%'\`
+
+ # If there was a directory component, then change thisdir.
+ if test \"x\$destdir\" != \"x\$file\"; then
+ case \"\$destdir\" in
+ [\\\\/]* | [A-Za-z]:[\\\\/]*) thisdir=\"\$destdir\" ;;
+ *) thisdir=\"\$thisdir/\$destdir\" ;;
+ esac
+ fi
+
+ file=\`\$echo \"X\$file\" | \$Xsed -e 's%^.*/%%'\`
+ file=\`ls -ld \"\$thisdir/\$file\" | ${SED} -n 's/.*-> //p'\`
+ done
+
+ # Try to get the absolute directory name.
+ absdir=\`cd \"\$thisdir\" && pwd\`
+ test -n \"\$absdir\" && thisdir=\"\$absdir\"
+"
+
+ if test "$fast_install" = yes; then
+ $echo >> $output "\
+ program=lt-'$outputname'$exeext
+ progdir=\"\$thisdir/$objdir\"
+
+ if test ! -f \"\$progdir/\$program\" || \\
+ { file=\`ls -1dt \"\$progdir/\$program\" \"\$progdir/../\$program\" 2>/dev/null | ${SED} 1q\`; \\
+ test \"X\$file\" != \"X\$progdir/\$program\"; }; then
+
+ file=\"\$\$-\$program\"
+
+ if test ! -d \"\$progdir\"; then
+ $mkdir \"\$progdir\"
+ else
+ $rm \"\$progdir/\$file\"
+ fi"
+
+ $echo >> $output "\
+
+ # relink executable if necessary
+ if test -n \"\$relink_command\"; then
+ if relink_command_output=\`eval \$relink_command 2>&1\`; then :
+ else
+ $echo \"\$relink_command_output\" >&2
+ $rm \"\$progdir/\$file\"
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\" 2>/dev/null ||
+ { $rm \"\$progdir/\$program\";
+ $mv \"\$progdir/\$file\" \"\$progdir/\$program\"; }
+ $rm \"\$progdir/\$file\"
+ fi"
+ else
+ $echo >> $output "\
+ program='$outputname'
+ progdir=\"\$thisdir/$objdir\"
+"
+ fi
+
+ $echo >> $output "\
+
+ if test -f \"\$progdir/\$program\"; then"
+
+ # Export our shlibpath_var if we have one.
+ if test "$shlibpath_overrides_runpath" = yes && test -n "$shlibpath_var" && test -n "$temp_rpath"; then
+ $echo >> $output "\
+ # Add our own library path to $shlibpath_var
+ $shlibpath_var=\"$temp_rpath\$$shlibpath_var\"
+
+ # Some systems cannot cope with colon-terminated $shlibpath_var
+ # The second colon is a workaround for a bug in BeOS R4 sed
+ $shlibpath_var=\`\$echo \"X\$$shlibpath_var\" | \$Xsed -e 's/::*\$//'\`
+
+ export $shlibpath_var
+"
+ fi
+
+ # fixup the dll searchpath if we need to.
+ if test -n "$dllsearchpath"; then
+ $echo >> $output "\
+ # Add the dll search path components to the executable PATH
+ PATH=$dllsearchpath:\$PATH
+"
+ fi
+
+ $echo >> $output "\
+ if test \"\$libtool_execute_magic\" != \"$magic\"; then
+ # Run the actual program with our arguments.
+"
+ case $host in
+ # Backslashes separate directories on plain windows
+ *-*-mingw | *-*-os2*)
+ $echo >> $output "\
+ exec \"\$progdir\\\\\$program\" \${1+\"\$@\"}
+"
;;
- * )
- $RM $output
- trap "$RM $output; exit $EXIT_FAILURE" 1 2 15
- func_emit_wrapper no > $output
- chmod +x $output
+ *)
+ $echo >> $output "\
+ exec \"\$progdir/\$program\" \${1+\"\$@\"}
+"
;;
esac
- }
+ $echo >> $output "\
+ \$echo \"\$0: cannot exec \$program \$*\"
+ exit $EXIT_FAILURE
+ fi
+ else
+ # The program doesn't exist.
+ \$echo \"\$0: error: \\\`\$progdir/\$program' does not exist\" 1>&2
+ \$echo \"This script is just a wrapper for \$program.\" 1>&2
+ $echo \"See the $PACKAGE documentation for more information.\" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi\
+"
+ chmod +x $output
+ fi
exit $EXIT_SUCCESS
;;
esac
@@ -9085,7 +5480,7 @@ EOF
for oldlib in $oldlibs; do
if test "$build_libtool_libs" = convenience; then
- oldobjs="$libobjs_save $symfileobj"
+ oldobjs="$libobjs_save"
addlibs="$convenience"
build_libtool_libs=no
else
@@ -9094,35 +5489,22 @@ EOF
build_libtool_libs=no
else
oldobjs="$old_deplibs $non_pic_objects"
- if test "$preload" = yes && test -f "$symfileobj"; then
- func_append oldobjs " $symfileobj"
- fi
fi
addlibs="$old_convenience"
fi
if test -n "$addlibs"; then
gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
+ generated="$generated $gentop"
func_extract_archives $gentop $addlibs
- func_append oldobjs " $func_extract_archives_result"
+ oldobjs="$oldobjs $func_extract_archives_result"
fi
# Do each command in the archive commands.
if test -n "$old_archive_from_new_cmds" && test "$build_libtool_libs" = yes; then
- cmds=$old_archive_from_new_cmds
+ cmds=$old_archive_from_new_cmds
else
-
- # Add any objects from preloaded convenience libraries
- if test -n "$dlprefiles"; then
- gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
-
- func_extract_archives $gentop $dlprefiles
- func_append oldobjs " $func_extract_archives_result"
- fi
-
# POSIX demands no paths to be encoded in archives. We have
# to avoid creating archives with duplicate basenames if we
# might have to extract them afterwards, e.g., when creating a
@@ -9131,22 +5513,32 @@ EOF
# not supported by libtool).
if (for obj in $oldobjs
do
- func_basename "$obj"
- $ECHO "$func_basename_result"
+ $echo "X$obj" | $Xsed -e 's%^.*/%%'
done | sort | sort -uc >/dev/null 2>&1); then
:
else
- echo "copying selected object files to avoid basename conflicts..."
- gentop="$output_objdir/${outputname}x"
- func_append generated " $gentop"
- func_mkdir_p "$gentop"
+ $echo "copying selected object files to avoid basename conflicts..."
+
+ if test -z "$gentop"; then
+ gentop="$output_objdir/${outputname}x"
+ generated="$generated $gentop"
+
+ $show "${rm}r $gentop"
+ $run ${rm}r "$gentop"
+ $show "$mkdir $gentop"
+ $run $mkdir "$gentop"
+ exit_status=$?
+ if test "$exit_status" -ne 0 && test ! -d "$gentop"; then
+ exit $exit_status
+ fi
+ fi
+
save_oldobjs=$oldobjs
oldobjs=
counter=1
for obj in $save_oldobjs
do
- func_basename "$obj"
- objbase="$func_basename_result"
+ objbase=`$echo "X$obj" | $Xsed -e 's%^.*/%%'`
case " $oldobjs " in
" ") oldobjs=$obj ;;
*[\ /]"$objbase "*)
@@ -9154,74 +5546,58 @@ EOF
# Make sure we don't pick an alternate name that also
# overlaps.
newobj=lt$counter-$objbase
- func_arith $counter + 1
- counter=$func_arith_result
+ counter=`expr $counter + 1`
case " $oldobjs " in
*[\ /]"$newobj "*) ;;
*) if test ! -f "$gentop/$newobj"; then break; fi ;;
esac
done
- func_show_eval "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
- func_append oldobjs " $gentop/$newobj"
+ $show "ln $obj $gentop/$newobj || cp $obj $gentop/$newobj"
+ $run ln "$obj" "$gentop/$newobj" ||
+ $run cp "$obj" "$gentop/$newobj"
+ oldobjs="$oldobjs $gentop/$newobj"
;;
- *) func_append oldobjs " $obj" ;;
+ *) oldobjs="$oldobjs $obj" ;;
esac
done
fi
- func_to_tool_file "$oldlib" func_convert_file_msys_to_w32
- tool_oldlib=$func_to_tool_file_result
+
eval cmds=\"$old_archive_cmds\"
- func_len " $cmds"
- len=$func_len_result
- if test "$len" -lt "$max_cmd_len" || test "$max_cmd_len" -le -1; then
- cmds=$old_archive_cmds
- elif test -n "$archiver_list_spec"; then
- func_verbose "using command file archive linking..."
- for obj in $oldobjs
- do
- func_to_tool_file "$obj"
- $ECHO "$func_to_tool_file_result"
- done > $output_objdir/$libname.libcmd
- func_to_tool_file "$output_objdir/$libname.libcmd"
- oldobjs=" $archiver_list_spec$func_to_tool_file_result"
+ if len=`expr "X$cmds" : ".*"` &&
+ test "$len" -le "$max_cmd_len" || test "$max_cmd_len" -le -1; then
cmds=$old_archive_cmds
else
# the command line is too long to link in one step, link in parts
- func_verbose "using piecewise archive linking..."
+ $echo "using piecewise archive linking..."
save_RANLIB=$RANLIB
RANLIB=:
objlist=
concat_cmds=
save_oldobjs=$oldobjs
- oldobjs=
+
# Is there a better way of finding the last object in the list?
for obj in $save_oldobjs
do
last_oldobj=$obj
done
- eval test_cmds=\"$old_archive_cmds\"
- func_len " $test_cmds"
- len0=$func_len_result
- len=$len0
for obj in $save_oldobjs
do
- func_len " $obj"
- func_arith $len + $func_len_result
- len=$func_arith_result
- func_append objlist " $obj"
- if test "$len" -lt "$max_cmd_len"; then
+ oldobjs="$objlist $obj"
+ objlist="$objlist $obj"
+ eval test_cmds=\"$old_archive_cmds\"
+ if len=`expr "X$test_cmds" : ".*" 2>/dev/null` &&
+ test "$len" -le "$max_cmd_len"; then
:
else
# the above command should be used before it gets too long
oldobjs=$objlist
if test "$obj" = "$last_oldobj" ; then
- RANLIB=$save_RANLIB
+ RANLIB=$save_RANLIB
fi
test -z "$concat_cmds" || concat_cmds=$concat_cmds~
eval concat_cmds=\"\${concat_cmds}$old_archive_cmds\"
objlist=
- len=$len0
fi
done
RANLIB=$save_RANLIB
@@ -9233,39 +5609,49 @@ EOF
fi
fi
fi
- func_execute_cmds "$cmds" 'exit $?'
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ eval cmd=\"$cmd\"
+ IFS="$save_ifs"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
done
- test -n "$generated" && \
- func_show_eval "${RM}r$generated"
+ if test -n "$generated"; then
+ $show "${rm}r$generated"
+ $run ${rm}r$generated
+ fi
# Now create the libtool archive.
case $output in
*.la)
old_library=
test "$build_old_libs" = yes && old_library="$libname.$libext"
- func_verbose "creating $output"
+ $show "creating $output"
# Preserve any variables that may affect compiler behavior
for var in $variables_saved_for_relink; do
if eval test -z \"\${$var+set}\"; then
- relink_command="{ test -z \"\${$var+set}\" || $lt_unset $var || { $var=; export $var; }; }; $relink_command"
+ relink_command="{ test -z \"\${$var+set}\" || unset $var || { $var=; export $var; }; }; $relink_command"
elif eval var_value=\$$var; test -z "$var_value"; then
relink_command="$var=; export $var; $relink_command"
else
- func_quote_for_eval "$var_value"
- relink_command="$var=$func_quote_for_eval_result; export $var; $relink_command"
+ var_value=`$echo "X$var_value" | $Xsed -e "$sed_quote_subst"`
+ relink_command="$var=\"$var_value\"; export $var; $relink_command"
fi
done
# Quote the link command for shipping.
relink_command="(cd `pwd`; $SHELL $progpath $preserve_args --mode=relink $libtool_args @inst_prefix_dir@)"
- relink_command=`$ECHO "$relink_command" | $SED "$sed_quote_subst"`
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e "$sed_quote_subst" | $NL2SP`
if test "$hardcode_automatic" = yes ; then
relink_command=
fi
+
# Only create the output if not a dry run.
- $opt_dry_run || {
+ if test -z "$run"; then
for installed in no yes; do
if test "$installed" = yes; then
if test -z "$install_libdir"; then
@@ -9277,60 +5663,38 @@ EOF
for deplib in $dependency_libs; do
case $deplib in
*.la)
- func_basename "$deplib"
- name="$func_basename_result"
- func_resolve_sysroot "$deplib"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $func_resolve_sysroot_result`
- test -z "$libdir" && \
- func_fatal_error "\`$deplib' is not a valid libtool archive"
- func_append newdependency_libs " ${lt_sysroot:+=}$libdir/$name"
- ;;
- -L*)
- func_stripname -L '' "$deplib"
- func_replace_sysroot "$func_stripname_result"
- func_append newdependency_libs " -L$func_replace_sysroot_result"
- ;;
- -R*)
- func_stripname -R '' "$deplib"
- func_replace_sysroot "$func_stripname_result"
- func_append newdependency_libs " -R$func_replace_sysroot_result"
+ name=`$echo "X$deplib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $deplib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$deplib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdependency_libs="$newdependency_libs $libdir/$name"
;;
- *) func_append newdependency_libs " $deplib" ;;
+ *) newdependency_libs="$newdependency_libs $deplib" ;;
esac
done
dependency_libs="$newdependency_libs"
newdlfiles=
-
for lib in $dlfiles; do
- case $lib in
- *.la)
- func_basename "$lib"
- name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- test -z "$libdir" && \
- func_fatal_error "\`$lib' is not a valid libtool archive"
- func_append newdlfiles " ${lt_sysroot:+=}$libdir/$name"
- ;;
- *) func_append newdlfiles " $lib" ;;
- esac
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlfiles="$newdlfiles $libdir/$name"
done
dlfiles="$newdlfiles"
newdlprefiles=
for lib in $dlprefiles; do
- case $lib in
- *.la)
- # Only pass preopened files to the pseudo-archive (for
- # eventual linking with the app. that links it) if we
- # didn't already link the preopened objects directly into
- # the library:
- func_basename "$lib"
- name="$func_basename_result"
- eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
- test -z "$libdir" && \
- func_fatal_error "\`$lib' is not a valid libtool archive"
- func_append newdlprefiles " ${lt_sysroot:+=}$libdir/$name"
- ;;
- esac
+ name=`$echo "X$lib" | $Xsed -e 's%^.*/%%'`
+ eval libdir=`${SED} -n -e 's/^libdir=\(.*\)$/\1/p' $lib`
+ if test -z "$libdir"; then
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ newdlprefiles="$newdlprefiles $libdir/$name"
done
dlprefiles="$newdlprefiles"
else
@@ -9340,7 +5704,7 @@ EOF
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
- func_append newdlfiles " $abs"
+ newdlfiles="$newdlfiles $abs"
done
dlfiles="$newdlfiles"
newdlprefiles=
@@ -9349,37 +5713,19 @@ EOF
[\\/]* | [A-Za-z]:[\\/]*) abs="$lib" ;;
*) abs=`pwd`"/$lib" ;;
esac
- func_append newdlprefiles " $abs"
+ newdlprefiles="$newdlprefiles $abs"
done
dlprefiles="$newdlprefiles"
fi
- $RM $output
+ $rm $output
# place dlname in correct position for cygwin
- # In fact, it would be nice if we could use this code for all target
- # systems that can't hard-code library paths into their executables
- # and that have no shared library path variable independent of PATH,
- # but it turns out we can't easily determine that from inspecting
- # libtool variables, so we have to hard-code the OSs to which it
- # applies here; at the moment, that means platforms that use the PE
- # object format with DLL files. See the long comment at the top of
- # tests/bindir.at for full details.
tdlname=$dlname
case $host,$output,$installed,$module,$dlname in
- *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll | *cegcc*,*lai,yes,no,*.dll)
- # If a -bindir argument was supplied, place the dll there.
- if test "x$bindir" != x ;
- then
- func_relative_path "$install_libdir" "$bindir"
- tdlname=$func_relative_path_result$dlname
- else
- # Otherwise fall back on heuristic.
- tdlname=../bin/$dlname
- fi
- ;;
+ *cygwin*,*lai,yes,no,*.dll | *mingw*,*lai,yes,no,*.dll) tdlname=../bin/$dlname ;;
esac
- $ECHO > $output "\
+ $echo > $output "\
# $outputname - a libtool library file
-# Generated by $PROGRAM (GNU $PACKAGE$TIMESTAMP) $VERSION
+# Generated by $PROGRAM - GNU $PACKAGE $VERSION$TIMESTAMP
#
# Please DO NOT delete this file!
# It is necessary for linking the library.
@@ -9393,15 +5739,9 @@ library_names='$library_names'
# The name of the static archive.
old_library='$old_library'
-# Linker flags that can not go in dependency_libs.
-inherited_linker_flags='$new_inherited_linker_flags'
-
# Libraries that this one depends upon.
dependency_libs='$dependency_libs'
-# Names of additional weak libraries provided by this library
-weak_library_names='$weak_libs'
-
# Version information for $libname.
current=$current
age=$age
@@ -9420,29 +5760,748 @@ dlpreopen='$dlprefiles'
# Directory that this library needs to be installed in:
libdir='$install_libdir'"
if test "$installed" = no && test "$need_relink" = yes; then
- $ECHO >> $output "\
+ $echo >> $output "\
relink_command=\"$relink_command\""
fi
done
- }
+ fi
# Do a symbolic link so that the libtool archive can be found in
# LD_LIBRARY_PATH before the program is installed.
- func_show_eval '( cd "$output_objdir" && $RM "$outputname" && $LN_S "../$outputname" "$outputname" )' 'exit $?'
+ $show "(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)"
+ $run eval '(cd $output_objdir && $rm $outputname && $LN_S ../$outputname $outputname)' || exit $?
;;
esac
exit $EXIT_SUCCESS
-}
+ ;;
-{ test "$opt_mode" = link || test "$opt_mode" = relink; } &&
- func_mode_link ${1+"$@"}
+ # libtool install mode
+ install)
+ modename="$modename: install"
+ # There may be an optional sh(1) argument at the beginning of
+ # install_prog (especially on Windows NT).
+ if test "$nonopt" = "$SHELL" || test "$nonopt" = /bin/sh ||
+ # Allow the use of GNU shtool's install command.
+ $echo "X$nonopt" | grep shtool > /dev/null; then
+ # Aesthetically quote it.
+ arg=`$echo "X$nonopt" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$arg "
+ arg="$1"
+ shift
+ else
+ install_prog=
+ arg=$nonopt
+ fi
-# func_mode_uninstall arg...
-func_mode_uninstall ()
-{
- $opt_debug
- RM="$nonopt"
+ # The real first argument should be the name of the installation program.
+ # Aesthetically quote it.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog$arg"
+
+ # We need to accept at least all the BSD install flags.
+ dest=
+ files=
+ opts=
+ prev=
+ install_type=
+ isdir=no
+ stripme=
+ for arg
+ do
+ if test -n "$dest"; then
+ files="$files $dest"
+ dest=$arg
+ continue
+ fi
+
+ case $arg in
+ -d) isdir=yes ;;
+ -f)
+ case " $install_prog " in
+ *[\\\ /]cp\ *) ;;
+ *) prev=$arg ;;
+ esac
+ ;;
+ -g | -m | -o) prev=$arg ;;
+ -s)
+ stripme=" -s"
+ continue
+ ;;
+ -*)
+ ;;
+ *)
+ # If the previous option needed an argument, then skip it.
+ if test -n "$prev"; then
+ prev=
+ else
+ dest=$arg
+ continue
+ fi
+ ;;
+ esac
+
+ # Aesthetically quote the argument.
+ arg=`$echo "X$arg" | $Xsed -e "$sed_quote_subst"`
+ case $arg in
+ *[\[\~\#\^\&\*\(\)\{\}\|\;\<\>\?\'\ \ ]*|*]*|"")
+ arg="\"$arg\""
+ ;;
+ esac
+ install_prog="$install_prog $arg"
+ done
+
+ if test -z "$install_prog"; then
+ $echo "$modename: you must specify an install program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$prev"; then
+ $echo "$modename: the \`$prev' option requires an argument" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -z "$files"; then
+ if test -z "$dest"; then
+ $echo "$modename: no file or destination specified" 1>&2
+ else
+ $echo "$modename: you must specify a destination" 1>&2
+ fi
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Strip any trailing slash from the destination.
+ dest=`$echo "X$dest" | $Xsed -e 's%/$%%'`
+
+ # Check to see that the destination is a directory.
+ test -d "$dest" && isdir=yes
+ if test "$isdir" = yes; then
+ destdir="$dest"
+ destname=
+ else
+ destdir=`$echo "X$dest" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$destdir" = "X$dest" && destdir=.
+ destname=`$echo "X$dest" | $Xsed -e 's%^.*/%%'`
+
+ # Not a directory, so check to see that there is only one file specified.
+ set dummy $files
+ if test "$#" -gt 2; then
+ $echo "$modename: \`$dest' is not a directory" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+ case $destdir in
+ [\\/]* | [A-Za-z]:[\\/]*) ;;
+ *)
+ for file in $files; do
+ case $file in
+ *.lo) ;;
+ *)
+ $echo "$modename: \`$destdir' must be an absolute directory name" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+ done
+ ;;
+ esac
+
+ # This variable tells wrapper scripts just to set variables rather
+ # than running their programs.
+ libtool_install_magic="$magic"
+
+ staticlibs=
+ future_libdirs=
+ current_libdirs=
+ for file in $files; do
+
+ # Do each installation.
+ case $file in
+ *.$libext)
+ # Do the static libraries later.
+ staticlibs="$staticlibs $file"
+ ;;
+
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$file' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ library_names=
+ old_library=
+ relink_command=
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Add the libdir to current_libdirs if it is the destination.
+ if test "X$destdir" = "X$libdir"; then
+ case "$current_libdirs " in
+ *" $libdir "*) ;;
+ *) current_libdirs="$current_libdirs $libdir" ;;
+ esac
+ else
+ # Note the libdir as a future libdir.
+ case "$future_libdirs " in
+ *" $libdir "*) ;;
+ *) future_libdirs="$future_libdirs $libdir" ;;
+ esac
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`/
+ test "X$dir" = "X$file/" && dir=
+ dir="$dir$objdir"
+
+ if test -n "$relink_command"; then
+ # Determine the prefix the user has applied to our future dir.
+ inst_prefix_dir=`$echo "$destdir" | $SED "s%$libdir\$%%"`
+
+ # Don't allow the user to place us outside of our expected
+ # location b/c this prevents finding dependent libraries that
+ # are installed to the same prefix.
+ # At present, this check doesn't affect windows .dll's that
+ # are installed into $libdir/../bin (currently, that works fine)
+ # but it's something to keep an eye on.
+ if test "$inst_prefix_dir" = "$destdir"; then
+ $echo "$modename: error: cannot install \`$file' to a directory not ending in $libdir" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ if test -n "$inst_prefix_dir"; then
+ # Stick the inst_prefix_dir data into the link command.
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%-inst-prefix-dir $inst_prefix_dir%" | $NL2SP`
+ else
+ relink_command=`$echo "$relink_command" | $SP2NL | $SED "s%@inst_prefix_dir@%%" | $NL2SP`
+ fi
+
+ $echo "$modename: warning: relinking \`$file'" 1>&2
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+
+ # See the names of the shared library.
+ set dummy $library_names
+ if test -n "$2"; then
+ realname="$2"
+ shift
+ shift
+
+ srcname="$realname"
+ test -n "$relink_command" && srcname="$realname"T
+
+ # Install the shared library and build the symlinks.
+ $show "$install_prog $dir/$srcname $destdir/$realname"
+ $run eval "$install_prog $dir/$srcname $destdir/$realname" || exit $?
+ if test -n "$stripme" && test -n "$striplib"; then
+ $show "$striplib $destdir/$realname"
+ $run eval "$striplib $destdir/$realname" || exit $?
+ fi
+
+ if test "$#" -gt 0; then
+ # Delete the old symlinks, and create new ones.
+ # Try `ln -sf' first, because the `ln' binary might depend on
+ # the symlink we replace! Solaris /bin/ln does not understand -f,
+ # so we also need to try rm && ln -s.
+ for linkname
+ do
+ if test "$linkname" != "$realname"; then
+ $show "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ $run eval "(cd $destdir && { $LN_S -f $realname $linkname || { $rm $linkname && $LN_S $realname $linkname; }; })"
+ fi
+ done
+ fi
+
+ # Do each command in the postinstall commands.
+ lib="$destdir/$realname"
+ cmds=$postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || {
+ lt_exit=$?
+
+ # Restore the uninstalled library and exit
+ if test "$mode" = relink; then
+ $run eval '(cd $output_objdir && $rm ${realname}T && $mv ${realname}U $realname)'
+ fi
+
+ exit $lt_exit
+ }
+ done
+ IFS="$save_ifs"
+ fi
+
+ # Install the pseudo-library for information purposes.
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ instname="$dir/$name"i
+ $show "$install_prog $instname $destdir/$name"
+ $run eval "$install_prog $instname $destdir/$name" || exit $?
+
+ # Maybe install the static library, too.
+ test -n "$old_library" && staticlibs="$staticlibs $dir/$old_library"
+ ;;
+
+ *.lo)
+ # Install (i.e. copy) a libtool object.
+
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # Deduce the name of the destination old-style object file.
+ case $destfile in
+ *.lo)
+ staticdest=`$echo "X$destfile" | $Xsed -e "$lo2o"`
+ ;;
+ *.$objext)
+ staticdest="$destfile"
+ destfile=
+ ;;
+ *)
+ $echo "$modename: cannot copy a libtool object to \`$destfile'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
+
+ # Install the libtool object if requested.
+ if test -n "$destfile"; then
+ $show "$install_prog $file $destfile"
+ $run eval "$install_prog $file $destfile" || exit $?
+ fi
+
+ # Install the old object if enabled.
+ if test "$build_old_libs" = yes; then
+ # Deduce the name of the old-style object file.
+ staticobj=`$echo "X$file" | $Xsed -e "$lo2o"`
+
+ $show "$install_prog $staticobj $staticdest"
+ $run eval "$install_prog \$staticobj \$staticdest" || exit $?
+ fi
+ exit $EXIT_SUCCESS
+ ;;
+
+ *)
+ # Figure out destination file name, if it wasn't already specified.
+ if test -n "$destname"; then
+ destfile="$destdir/$destname"
+ else
+ destfile=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ destfile="$destdir/$destfile"
+ fi
+
+ # If the file is missing, and there is a .exe on the end, strip it
+ # because it is most likely a libtool script we actually want to
+ # install
+ stripped_ext=""
+ case $file in
+ *.exe)
+ if test ! -f "$file"; then
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ stripped_ext=".exe"
+ fi
+ ;;
+ esac
+
+ # Do a test to see if this is really a libtool program.
+ case $host in
+ *cygwin*|*mingw*)
+ wrapper=`$echo $file | ${SED} -e 's,.exe$,,'`
+ ;;
+ *)
+ wrapper=$file
+ ;;
+ esac
+ if (${SED} -e '4q' $wrapper | grep "^# Generated by .*$PACKAGE")>/dev/null 2>&1; then
+ notinst_deplibs=
+ relink_command=
+
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ # Check the variables that should have been set.
+ if test -z "$notinst_deplibs"; then
+ $echo "$modename: invalid libtool wrapper script \`$wrapper'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ finalize=yes
+ for lib in $notinst_deplibs; do
+ # Check to see that each library is installed.
+ libdir=
+ if test -f "$lib"; then
+ # If there is no directory component, then add one.
+ case $lib in
+ */* | *\\*) . $lib ;;
+ *) . ./$lib ;;
+ esac
+ fi
+ libfile="$libdir/"`$echo "X$lib" | $Xsed -e 's%^.*/%%g'` ### testsuite: skip nested quoting test
+ if test -n "$libdir" && test ! -f "$libfile"; then
+ $echo "$modename: warning: \`$lib' has not been installed in \`$libdir'" 1>&2
+ finalize=no
+ fi
+ done
+
+ relink_command=
+ # Note that it is not necessary on cygwin/mingw to append a dot to
+ # foo even if both foo and FILE.exe exist: automatic-append-.exe
+ # behavior happens only for exec(3), not for open(2)! Also, sourcing
+ # `FILE.' does not work on cygwin managed mounts.
+ #
+ # If there is no directory component, then add one.
+ case $wrapper in
+ */* | *\\*) . ${wrapper} ;;
+ *) . ./${wrapper} ;;
+ esac
+
+ outputname=
+ if test "$fast_install" = no && test -n "$relink_command"; then
+ if test "$finalize" = yes && test -z "$run"; then
+ tmpdir=`func_mktempdir`
+ file=`$echo "X$file$stripped_ext" | $Xsed -e 's%^.*/%%'`
+ outputname="$tmpdir/$file"
+ # Replace the output file specification.
+ relink_command=`$echo "X$relink_command" | $SP2NL | $Xsed -e 's%@OUTPUT@%'"$outputname"'%g' | $NL2SP`
+
+ $show "$relink_command"
+ if $run eval "$relink_command"; then :
+ else
+ $echo "$modename: error: relink \`$file' with the above command before installing it" 1>&2
+ ${rm}r "$tmpdir"
+ continue
+ fi
+ file="$outputname"
+ else
+ $echo "$modename: warning: cannot relink \`$file'" 1>&2
+ fi
+ else
+ # Install the binary that we compiled earlier.
+ file=`$echo "X$file$stripped_ext" | $Xsed -e "s%\([^/]*\)$%$objdir/\1%"`
+ fi
+ fi
+
+ # remove .exe since cygwin /usr/bin/install will append another
+ # one anyway
+ case $install_prog,$host in
+ */usr/bin/install*,*cygwin*)
+ case $file:$destfile in
+ *.exe:*.exe)
+ # this is ok
+ ;;
+ *.exe:*)
+ destfile=$destfile.exe
+ ;;
+ *:*.exe)
+ destfile=`$echo $destfile | ${SED} -e 's,.exe$,,'`
+ ;;
+ esac
+ ;;
+ esac
+ $show "$install_prog$stripme $file $destfile"
+ $run eval "$install_prog\$stripme \$file \$destfile" || exit $?
+ test -n "$outputname" && ${rm}r "$tmpdir"
+ ;;
+ esac
+ done
+
+ for file in $staticlibs; do
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+
+ # Set up the ranlib parameters.
+ oldlib="$destdir/$name"
+
+ $show "$install_prog $file $oldlib"
+ $run eval "$install_prog \$file \$oldlib" || exit $?
+
+ if test -n "$stripme" && test -n "$old_striplib"; then
+ $show "$old_striplib $oldlib"
+ $run eval "$old_striplib $oldlib" || exit $?
+ fi
+
+ # Do each command in the postinstall commands.
+ cmds=$old_postinstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || exit $?
+ done
+ IFS="$save_ifs"
+ done
+
+ if test -n "$future_libdirs"; then
+ $echo "$modename: warning: remember to run \`$progname --finish$future_libdirs'" 1>&2
+ fi
+
+ if test -n "$current_libdirs"; then
+ # Maybe just do a dry run.
+ test -n "$run" && current_libdirs=" -n$current_libdirs"
+ exec_cmd='$SHELL $progpath $preserve_args --finish$current_libdirs'
+ else
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool finish mode
+ finish)
+ modename="$modename: finish"
+ libdirs="$nonopt"
+ admincmds=
+
+ if test -n "$finish_cmds$finish_eval" && test -n "$libdirs"; then
+ for dir
+ do
+ libdirs="$libdirs $dir"
+ done
+
+ for libdir in $libdirs; do
+ if test -n "$finish_cmds"; then
+ # Do each command in the finish commands.
+ cmds=$finish_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd" || admincmds="$admincmds
+ $cmd"
+ done
+ IFS="$save_ifs"
+ fi
+ if test -n "$finish_eval"; then
+ # Do the single finish_eval.
+ eval cmds=\"$finish_eval\"
+ $run eval "$cmds" || admincmds="$admincmds
+ $cmds"
+ fi
+ done
+ fi
+
+ # Exit here if they wanted silent mode.
+ test "$show" = : && exit $EXIT_SUCCESS
+
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ $echo "Libraries have been installed in:"
+ for libdir in $libdirs; do
+ $echo " $libdir"
+ done
+ $echo
+ $echo "If you ever happen to want to link against installed libraries"
+ $echo "in a given directory, LIBDIR, you must either use libtool, and"
+ $echo "specify the full pathname of the library, or use the \`-LLIBDIR'"
+ $echo "flag during linking and do at least one of the following:"
+ if test -n "$shlibpath_var"; then
+ $echo " - add LIBDIR to the \`$shlibpath_var' environment variable"
+ $echo " during execution"
+ fi
+ if test -n "$runpath_var"; then
+ $echo " - add LIBDIR to the \`$runpath_var' environment variable"
+ $echo " during linking"
+ fi
+ if test -n "$hardcode_libdir_flag_spec"; then
+ libdir=LIBDIR
+ eval flag=\"$hardcode_libdir_flag_spec\"
+
+ $echo " - use the \`$flag' linker flag"
+ fi
+ if test -n "$admincmds"; then
+ $echo " - have your system administrator run these commands:$admincmds"
+ fi
+ if test -f /etc/ld.so.conf; then
+ $echo " - have your system administrator add LIBDIR to \`/etc/ld.so.conf'"
+ fi
+ $echo
+ $echo "See any operating system documentation about shared libraries for"
+ $echo "more information, such as the ld(1) and ld.so(8) manual pages."
+ $echo "X----------------------------------------------------------------------" | $Xsed
+ exit $EXIT_SUCCESS
+ ;;
+
+ # libtool execute mode
+ execute)
+ modename="$modename: execute"
+
+ # The first argument is the command name.
+ cmd="$nonopt"
+ if test -z "$cmd"; then
+ $echo "$modename: you must specify a COMMAND" 1>&2
+ $echo "$help"
+ exit $EXIT_FAILURE
+ fi
+
+ # Handle -dlopen flags immediately.
+ for file in $execute_dlfiles; do
+ if test ! -f "$file"; then
+ $echo "$modename: \`$file' is not a file" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ dir=
+ case $file in
+ *.la)
+ # Check to see that this really is a libtool archive.
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then :
+ else
+ $echo "$modename: \`$lib' is not a valid libtool archive" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+
+ # Read the libtool library.
+ dlname=
+ library_names=
+
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Skip this library if it cannot be dlopened.
+ if test -z "$dlname"; then
+ # Warn if it was a shared library.
+ test -n "$library_names" && $echo "$modename: warning: \`$file' was not linked with \`-export-dynamic'"
+ continue
+ fi
+
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+
+ if test -f "$dir/$objdir/$dlname"; then
+ dir="$dir/$objdir"
+ else
+ if test ! -f "$dir/$dlname"; then
+ $echo "$modename: cannot find \`$dlname' in \`$dir' or \`$dir/$objdir'" 1>&2
+ exit $EXIT_FAILURE
+ fi
+ fi
+ ;;
+
+ *.lo)
+ # Just add the directory containing the .lo file.
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ test "X$dir" = "X$file" && dir=.
+ ;;
+
+ *)
+ $echo "$modename: warning \`-dlopen' is ignored for non-libtool libraries and objects" 1>&2
+ continue
+ ;;
+ esac
+
+ # Get the absolute pathname.
+ absdir=`cd "$dir" && pwd`
+ test -n "$absdir" && dir="$absdir"
+
+ # Now add the directory to shlibpath_var.
+ if eval "test -z \"\$$shlibpath_var\""; then
+ eval "$shlibpath_var=\"\$dir\""
+ else
+ eval "$shlibpath_var=\"\$dir:\$$shlibpath_var\""
+ fi
+ done
+
+ # This variable tells wrapper scripts just to set shlibpath_var
+ # rather than running their programs.
+ libtool_execute_magic="$magic"
+
+ # Check if any of the arguments is a wrapper script.
+ args=
+ for file
+ do
+ case $file in
+ -*) ;;
+ *)
+ # Do a test to see if this is really a libtool program.
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ # If there is no directory component, then add one.
+ case $file in
+ */* | *\\*) . $file ;;
+ *) . ./$file ;;
+ esac
+
+ # Transform arg to wrapped name.
+ file="$progdir/$program"
+ fi
+ ;;
+ esac
+ # Quote arguments (to preserve shell metacharacters).
+ file=`$echo "X$file" | $Xsed -e "$sed_quote_subst"`
+ args="$args \"$file\""
+ done
+
+ if test -z "$run"; then
+ if test -n "$shlibpath_var"; then
+ # Export the shlibpath_var.
+ eval "export $shlibpath_var"
+ fi
+
+ # Restore saved environment variables
+ for lt_var in LANG LC_ALL LC_CTYPE LC_COLLATE LC_MESSAGES
+ do
+ eval "if test \"\${save_$lt_var+set}\" = set; then
+ $lt_var=\$save_$lt_var; export $lt_var
+ fi"
+ done
+
+ # Now prepare to actually exec the command.
+ exec_cmd="\$cmd$args"
+ else
+ # Display what would be done.
+ if test -n "$shlibpath_var"; then
+ eval "\$echo \"\$shlibpath_var=\$$shlibpath_var\""
+ $echo "export $shlibpath_var"
+ fi
+ $echo "$cmd$args"
+ exit $EXIT_SUCCESS
+ fi
+ ;;
+
+ # libtool clean and uninstall mode
+ clean | uninstall)
+ modename="$modename: $mode"
+ rm="$nonopt"
files=
rmforce=
exit_status=0
@@ -9454,41 +6513,44 @@ func_mode_uninstall ()
for arg
do
case $arg in
- -f) func_append RM " $arg"; rmforce=yes ;;
- -*) func_append RM " $arg" ;;
- *) func_append files " $arg" ;;
+ -f) rm="$rm $arg"; rmforce=yes ;;
+ -*) rm="$rm $arg" ;;
+ *) files="$files $arg" ;;
esac
done
- test -z "$RM" && \
- func_fatal_help "you must specify an RM program"
+ if test -z "$rm"; then
+ $echo "$modename: you must specify an RM program" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ fi
rmdirs=
+ origobjdir="$objdir"
for file in $files; do
- func_dirname "$file" "" "."
- dir="$func_dirname_result"
- if test "X$dir" = X.; then
- odir="$objdir"
+ dir=`$echo "X$file" | $Xsed -e 's%/[^/]*$%%'`
+ if test "X$dir" = "X$file"; then
+ dir=.
+ objdir="$origobjdir"
else
- odir="$dir/$objdir"
+ objdir="$dir/$origobjdir"
fi
- func_basename "$file"
- name="$func_basename_result"
- test "$opt_mode" = uninstall && odir="$dir"
+ name=`$echo "X$file" | $Xsed -e 's%^.*/%%'`
+ test "$mode" = uninstall && objdir="$dir"
- # Remember odir for removal later, being careful to avoid duplicates
- if test "$opt_mode" = clean; then
+ # Remember objdir for removal later, being careful to avoid duplicates
+ if test "$mode" = clean; then
case " $rmdirs " in
- *" $odir "*) ;;
- *) func_append rmdirs " $odir" ;;
+ *" $objdir "*) ;;
+ *) rmdirs="$rmdirs $objdir" ;;
esac
fi
# Don't error if the file doesn't exist and rm -f was used.
- if { test -L "$file"; } >/dev/null 2>&1 ||
- { test -h "$file"; } >/dev/null 2>&1 ||
- test -f "$file"; then
+ if (test -L "$file") >/dev/null 2>&1 \
+ || (test -h "$file") >/dev/null 2>&1 \
+ || test -f "$file"; then
:
elif test -d "$file"; then
exit_status=1
@@ -9502,32 +6564,55 @@ func_mode_uninstall ()
case $name in
*.la)
# Possibly a libtool archive, so verify it.
- if func_lalib_p "$file"; then
- func_source $dir/$name
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ . $dir/$name
# Delete the libtool libraries and symlinks.
for n in $library_names; do
- func_append rmfiles " $odir/$n"
+ rmfiles="$rmfiles $objdir/$n"
done
- test -n "$old_library" && func_append rmfiles " $odir/$old_library"
+ test -n "$old_library" && rmfiles="$rmfiles $objdir/$old_library"
- case "$opt_mode" in
+ case "$mode" in
clean)
- case " $library_names " in
+ case " $library_names " in
+ # " " in the beginning catches empty $dlname
*" $dlname "*) ;;
- *) test -n "$dlname" && func_append rmfiles " $odir/$dlname" ;;
+ *) rmfiles="$rmfiles $objdir/$dlname" ;;
esac
- test -n "$libdir" && func_append rmfiles " $odir/$name $odir/${name}i"
+ test -n "$libdir" && rmfiles="$rmfiles $objdir/$name $objdir/${name}i"
;;
uninstall)
if test -n "$library_names"; then
# Do each command in the postuninstall commands.
- func_execute_cmds "$postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ cmds=$postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
fi
if test -n "$old_library"; then
# Do each command in the old_postuninstall commands.
- func_execute_cmds "$old_postuninstall_cmds" 'test "$rmforce" = yes || exit_status=1'
+ cmds=$old_postuninstall_cmds
+ save_ifs="$IFS"; IFS='~'
+ for cmd in $cmds; do
+ IFS="$save_ifs"
+ eval cmd=\"$cmd\"
+ $show "$cmd"
+ $run eval "$cmd"
+ if test "$?" -ne 0 && test "$rmforce" != yes; then
+ exit_status=1
+ fi
+ done
+ IFS="$save_ifs"
fi
# FIXME: should reinstall the best remaining shared library.
;;
@@ -9537,95 +6622,288 @@ func_mode_uninstall ()
*.lo)
# Possibly a libtool object, so verify it.
- if func_lalib_p "$file"; then
+ if (${SED} -e '2q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
# Read the .lo file
- func_source $dir/$name
+ . $dir/$name
# Add PIC object to the list of files to remove.
- if test -n "$pic_object" &&
- test "$pic_object" != none; then
- func_append rmfiles " $dir/$pic_object"
+ if test -n "$pic_object" \
+ && test "$pic_object" != none; then
+ rmfiles="$rmfiles $dir/$pic_object"
fi
# Add non-PIC object to the list of files to remove.
- if test -n "$non_pic_object" &&
- test "$non_pic_object" != none; then
- func_append rmfiles " $dir/$non_pic_object"
+ if test -n "$non_pic_object" \
+ && test "$non_pic_object" != none; then
+ rmfiles="$rmfiles $dir/$non_pic_object"
fi
fi
;;
*)
- if test "$opt_mode" = clean ; then
+ if test "$mode" = clean ; then
noexename=$name
case $file in
*.exe)
- func_stripname '' '.exe' "$file"
- file=$func_stripname_result
- func_stripname '' '.exe' "$name"
- noexename=$func_stripname_result
+ file=`$echo $file|${SED} 's,.exe$,,'`
+ noexename=`$echo $name|${SED} 's,.exe$,,'`
# $file with .exe has already been added to rmfiles,
# add $file without .exe
- func_append rmfiles " $file"
+ rmfiles="$rmfiles $file"
;;
esac
# Do a test to see if this is a libtool program.
- if func_ltwrapper_p "$file"; then
- if func_ltwrapper_executable_p "$file"; then
- func_ltwrapper_scriptname "$file"
- relink_command=
- func_source $func_ltwrapper_scriptname_result
- func_append rmfiles " $func_ltwrapper_scriptname_result"
- else
- relink_command=
- func_source $dir/$noexename
- fi
+ if (${SED} -e '4q' $file | grep "^# Generated by .*$PACKAGE") >/dev/null 2>&1; then
+ relink_command=
+ . $dir/$noexename
# note $name still contains .exe if it was in $file originally
# as does the version of $file that was added into $rmfiles
- func_append rmfiles " $odir/$name $odir/${name}S.${objext}"
+ rmfiles="$rmfiles $objdir/$name $objdir/${name}S.${objext}"
if test "$fast_install" = yes && test -n "$relink_command"; then
- func_append rmfiles " $odir/lt-$name"
+ rmfiles="$rmfiles $objdir/lt-$name"
fi
if test "X$noexename" != "X$name" ; then
- func_append rmfiles " $odir/lt-${noexename}.c"
+ rmfiles="$rmfiles $objdir/lt-${noexename}.c"
fi
fi
fi
;;
esac
- func_show_eval "$RM $rmfiles" 'exit_status=1'
+ $show "$rm $rmfiles"
+ $run $rm $rmfiles || exit_status=1
done
+ objdir="$origobjdir"
# Try to remove the ${objdir}s in the directories where we deleted files
for dir in $rmdirs; do
if test -d "$dir"; then
- func_show_eval "rmdir $dir >/dev/null 2>&1"
+ $show "rmdir $dir"
+ $run rmdir $dir >/dev/null 2>&1
fi
done
exit $exit_status
-}
-
-{ test "$opt_mode" = uninstall || test "$opt_mode" = clean; } &&
- func_mode_uninstall ${1+"$@"}
+ ;;
-test -z "$opt_mode" && {
- help="$generic_help"
- func_fatal_help "you must specify a MODE"
-}
+ "")
+ $echo "$modename: you must specify a MODE" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+ esac
-test -z "$exec_cmd" && \
- func_fatal_help "invalid operation mode \`$opt_mode'"
+ if test -z "$exec_cmd"; then
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$generic_help" 1>&2
+ exit $EXIT_FAILURE
+ fi
+fi # test -z "$show_help"
if test -n "$exec_cmd"; then
- eval exec "$exec_cmd"
+ eval exec $exec_cmd
exit $EXIT_FAILURE
fi
-exit $exit_status
+# We need to display help for each of the modes.
+case $mode in
+"") $echo \
+"Usage: $modename [OPTION]... [MODE-ARG]...
+
+Provide generalized library-building support services.
+
+ --config show all configuration variables
+ --debug enable verbose shell tracing
+-n, --dry-run display commands without modifying any files
+ --features display basic configuration information and exit
+ --finish same as \`--mode=finish'
+ --help display this help message and exit
+ --mode=MODE use operation mode MODE [default=inferred from MODE-ARGS]
+ --quiet same as \`--silent'
+ --silent don't print informational messages
+ --tag=TAG use configuration variables from tag TAG
+ --version print version information
+
+MODE must be one of the following:
+
+ clean remove files from the build directory
+ compile compile a source file into a libtool object
+ execute automatically set library path, then run a program
+ finish complete the installation of libtool libraries
+ install install libraries or executables
+ link create a library or an executable
+ uninstall remove libraries from an installed directory
+
+MODE-ARGS vary depending on the MODE. Try \`$modename --help --mode=MODE' for
+a more detailed description of MODE.
+
+Report bugs to <bug-libtool@gnu.org>."
+ exit $EXIT_SUCCESS
+ ;;
+
+clean)
+ $echo \
+"Usage: $modename [OPTION]... --mode=clean RM [RM-OPTION]... FILE...
+
+Remove files from the build directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, object or program, all the files associated
+with it are deleted. Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+compile)
+ $echo \
+"Usage: $modename [OPTION]... --mode=compile COMPILE-COMMAND... SOURCEFILE
+
+Compile a source file into a libtool library object.
+
+This mode accepts the following additional options:
+
+ -o OUTPUT-FILE set the output file name to OUTPUT-FILE
+ -prefer-pic try to building PIC objects only
+ -prefer-non-pic try to building non-PIC objects only
+ -static always build a \`.o' file suitable for static linking
+
+COMPILE-COMMAND is a command to be used in creating a \`standard' object file
+from the given SOURCEFILE.
+
+The output file name is determined by removing the directory component from
+SOURCEFILE, then substituting the C source code suffix \`.c' with the
+library object suffix, \`.lo'."
+ ;;
+
+execute)
+ $echo \
+"Usage: $modename [OPTION]... --mode=execute COMMAND [ARGS]...
+
+Automatically set library path, then run a program.
+
+This mode accepts the following additional options:
+
+ -dlopen FILE add the directory containing FILE to the library path
+
+This mode sets the library path environment variable according to \`-dlopen'
+flags.
+
+If any of the ARGS are libtool executable wrappers, then they are translated
+into their corresponding uninstalled binary, and any of their required library
+directories are added to the library path.
+
+Then, COMMAND is executed, with ARGS as arguments."
+ ;;
+
+finish)
+ $echo \
+"Usage: $modename [OPTION]... --mode=finish [LIBDIR]...
+
+Complete the installation of libtool libraries.
+
+Each LIBDIR is a directory that contains libtool libraries.
+
+The commands that this mode executes may require superuser privileges. Use
+the \`--dry-run' option if you just want to see what would be executed."
+ ;;
+
+install)
+ $echo \
+"Usage: $modename [OPTION]... --mode=install INSTALL-COMMAND...
+
+Install executables or libraries.
+
+INSTALL-COMMAND is the installation command. The first component should be
+either the \`install' or \`cp' program.
+
+The rest of the components are interpreted as arguments to that command (only
+BSD-compatible install options are recognized)."
+ ;;
+
+link)
+ $echo \
+"Usage: $modename [OPTION]... --mode=link LINK-COMMAND...
+
+Link object files or libraries together to form another library, or to
+create an executable program.
+
+LINK-COMMAND is a command using the C compiler that you would use to create
+a program from several object files.
+
+The following components of LINK-COMMAND are treated specially:
+
+ -all-static do not do any dynamic linking at all
+ -avoid-version do not add a version suffix if possible
+ -dlopen FILE \`-dlpreopen' FILE if it cannot be dlopened at runtime
+ -dlpreopen FILE link in FILE and add its symbols to lt_preloaded_symbols
+ -export-dynamic allow symbols from OUTPUT-FILE to be resolved with dlsym(3)
+ -export-symbols SYMFILE
+ try to export only the symbols listed in SYMFILE
+ -export-symbols-regex REGEX
+ try to export only the symbols matching REGEX
+ -LLIBDIR search LIBDIR for required installed libraries
+ -lNAME OUTPUT-FILE requires the installed library libNAME
+ -module build a library that can dlopened
+ -no-fast-install disable the fast-install mode
+ -no-install link a not-installable executable
+ -no-undefined declare that a library does not refer to external symbols
+ -o OUTPUT-FILE create OUTPUT-FILE from the specified objects
+ -objectlist FILE Use a list of object files found in FILE to specify objects
+ -precious-files-regex REGEX
+ don't remove output files matching REGEX
+ -release RELEASE specify package release information
+ -rpath LIBDIR the created library will eventually be installed in LIBDIR
+ -R[ ]LIBDIR add LIBDIR to the runtime path of programs and libraries
+ -static do not do any dynamic linking of uninstalled libtool libraries
+ -static-libtool-libs
+ do not do any dynamic linking of libtool libraries
+ -version-info CURRENT[:REVISION[:AGE]]
+ specify library version info [each variable defaults to 0]
+
+All other options (arguments beginning with \`-') are ignored.
+Every other argument is treated as a filename. Files ending in \`.la' are
+treated as uninstalled libtool libraries, other files are standard or library
+object files.
+
+If the OUTPUT-FILE ends in \`.la', then a libtool library is created,
+only library objects (\`.lo' files) may be specified, and \`-rpath' is
+required, except when creating a convenience library.
+
+If OUTPUT-FILE ends in \`.a' or \`.lib', then a standard library is created
+using \`ar' and \`ranlib', or on Windows using \`lib'.
+
+If OUTPUT-FILE ends in \`.lo' or \`.${objext}', then a reloadable object file
+is created, otherwise an executable program is created."
+ ;;
+
+uninstall)
+ $echo \
+"Usage: $modename [OPTION]... --mode=uninstall RM [RM-OPTION]... FILE...
+
+Remove libraries from an installation directory.
+
+RM is the name of the program to use to delete files associated with each FILE
+(typically \`/bin/rm'). RM-OPTIONS are options (such as \`-f') to be passed
+to RM.
+
+If FILE is a libtool library, all the files associated with it are deleted.
+Otherwise, only FILE itself is deleted using RM."
+ ;;
+
+*)
+ $echo "$modename: invalid operation mode \`$mode'" 1>&2
+ $echo "$help" 1>&2
+ exit $EXIT_FAILURE
+ ;;
+esac
+
+$echo
+$echo "Try \`$modename --help' for more information about other modes."
+
+exit $?
# The TAGs below are defined such that we never get into a situation
# in which we disable both kinds of libraries. Given conflicting
@@ -9639,17 +6917,14 @@ exit $exit_status
# configuration. But we'll never go from static-only to shared-only.
# ### BEGIN LIBTOOL TAG CONFIG: disable-shared
-build_libtool_libs=no
-build_old_libs=yes
+disable_libs=shared
# ### END LIBTOOL TAG CONFIG: disable-shared
# ### BEGIN LIBTOOL TAG CONFIG: disable-static
-build_old_libs=`case $build_libtool_libs in yes) echo no;; *) echo yes;; esac`
+disable_libs=static
# ### END LIBTOOL TAG CONFIG: disable-static
# Local Variables:
# mode:shell-script
# sh-indentation:2
# End:
-# vi:sw=2
-
diff --git a/gmp/macos/README b/gmp/macos/README
new file mode 100644
index 0000000000..4b6775cbc7
--- /dev/null
+++ b/gmp/macos/README
@@ -0,0 +1,241 @@
+===========================================================================
+
+ GMP port to Power Macintosh and MacOS
+
+ Kent Boortz
+
+===========================================================================
+
+Copyright 2000, 2001, 2002, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 is an unsupported port of GMP to Power Macintosh and MacOS. This
+port is *not* for OS X which is a Unix derivative, that system can use
+the normal configure and make described in the GMP manual.
+
+This port will use the optimized 'mpn' assembler routines written for
+32 bit PowerPC to gain speed. The BSD MP compatible library is not
+built. The MacOS configuration uses the 'malloc-notreentrant' option
+to optimize for speed.
+
+The output is a library
+
+ $GMP_SOURCE_DIR/macos/libgmp.$GMP_VERSION
+
+Not all tests pass
+
+ We never run the 'io' test the source don't compile
+
+ If using Apple's compilers we never run the mpz t-mul, mpf t-add
+ and mpf t-sub because they don't compile with MrC 4.1
+
+
+
+REQUIREMENTS
+============
+
+To compile into the library you need
+
+ Apple MPW (free)
+ MacPerl 5 for MPW
+
+GMP build was tested with MPW Shell 3.5.
+
+MacPerl is free, download and install the MPW tool version from
+any CPAN mirror. There is a list of mirrors at
+
+ http://www.cpan.org/SITES.html
+ http://mirror.cpan.org/
+
+There is also a special site dedicated to MacPerl
+
+ http://www.macperl.com
+
+You need the "Appl" and "Tool" archive, for example
+
+ http://www.perl.com/CPAN-local/ports/mac/Mac_Perl_520r4_appl.bin
+ http://www.perl.com/CPAN-local/ports/mac/Mac_Perl_520r4_tool.bin
+
+
+
+APPLE MPW INSTALLATION
+======================
+
+The MPW development system can be downloaded from
+
+ http://developer.apple.com/tools/mpw-tools/
+
+You need "StuffIt Expander" to unpack the source. You can download
+"StuffIt Expander" for free from
+
+ http://www.aladdinsys.com/expander/expander_mac_login.html
+
+This result is a PDF file that can be read with the free Acrobat Reader
+
+ http://www.adobe.com/products/acrobat/readstep.html
+
+From the MPW development environment you need at least
+
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./About_MPW_etc.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/MPW_Shell.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Scripts.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/GetFileName.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/Make.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/MrC.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/PPCAsm.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/MPW/Tools/PPCLink.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/Interfaces&Libraries/Libraries.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/Interfaces&Libraries/RuntimeLibraries.sit.hqx
+ ftp://ftp.apple.com/developer/Tool_Chest/Core_Mac_OS_Tools/MPW_etc./MPW-GM/Interfaces&Libraries/Interfaces/CIncludes.sit.hqx
+
+Put these into a folder and drag the whole folder to the "StuffIt
+Expander" icon to unpack them.
+
+Move "Scripts" folder down into the "MPW_Shell Folder".
+
+Create a folder "Tools" inside the "MPW_Shell Folder" and move "Make",
+"PPCAsm", "MrC", "PPCLink" and "GetFileName" down into the "Tools"
+folder.
+
+Create a folder "Interfaces&Libraries" at the same level as the
+"MPW_Shell Folder". Put Put "RuntimeLibraries", "Libraries" into the
+"Interfaces&Libraries" folder. Inside the "Interfaces&Libraries"
+folder create a new folder "Interfaces" and put "CInlcudes" into it.
+
+In summary, the manually moved files/folders should be located at
+
+ :MPW_Shell Folder:Tools:Make
+ :MPW_Shell Folder:Tools:PPCAsm
+ :MPW_Shell Folder:Tools:MrC
+ :MPW_Shell Folder:Tools:PPCLink
+ :MPW_Shell Folder:Tools:GetFileName
+ :Interfaces&Libraries:RuntimeLibraries:
+ :Interfaces&Libraries:Libraries:
+ :Interfaces&Libraries:Interfaces:CInlcudes:
+
+Follow the rest of the installation instructions in "About MPW etc.".
+
+
+
+MACPERL MPW INSTALLATION
+========================
+
+Drag these archives to the "StuffIt Expander" icon to unpack them.
+The result is two installation programs. Run the "Mac_Perl_520r4_appl"
+installer and let it install Perl into the default location, then run
+the "Mac_Perl_520r4_tool" insaller.
+
+To enable MPW to use MacPerl follow the instructions in the first
+comment in the file "Install.MPW_Perl". For MacPerl 520r4 this is
+
+ - Double click on the "MPW Shell" icon to start MPW and change the
+ directory to the "MacPerl f" folder using the directory command or
+ the "Set Directory..." menu item.
+
+ - Execute the "Install.MPW_Perl" command, i.e. write the name of the
+ command at the end of the "Worksheet" window, select the command
+ text and hit the "Enter" key". This will create a configuration
+ file and open it.
+
+ - Execute the "Install.MPW_Perl" command again.
+
+ - Execute the text the script wrote to the "Worksheet" window, i.e.
+ drag select all the lines and hit the "Enter" key.
+
+ - You need to restart MPW to make Perl work.
+
+
+
+BUILD PROCESS
+=============
+
+The "macos" folder/directory should be inside the top directory in the
+GMP source tree and should contain four files
+
+ README This file.
+ configure Create files and directories needed.
+ unix2mac Used to convert "configure" end-of-line chars.
+ Makefile.in Source for the final "Makefile".
+
+Double click on the "MPW Shell" icon and set the directory using the
+"Directory" menu to the "$GMP_SOURCE_DIR:macos:" folder/directory.
+
+You run "configure" in a two step process
+
+ % perl unix2mac configure > configure.mac
+ % perl configure.mac
+
+Then run "Make"
+
+ % make
+
+This will not execute the commands. It is like "make -n" on Unix, it
+will display the commands to execute. You select the commands and
+hit "enter" to actually execute the commands.
+
+To test the code you execute the output from
+
+ % make check
+
+If there is an error the test program will complain. Note that the
+test programs can contain errors so a test failure doesn't always
+mean that the library is broken.
+
+To cleanup to the state before configure you execute the output from
+
+ % make clean
+
+To remove the resulting library as well you do
+
+ % make distclean
+
+
+
+PROBLEMS
+========
+
+Bug reports can be sent to bug-gmp@gnu.org. Unfortunately the
+developers don't use this port and can offer only very general help.
+Reports including any fixes or updates necessary would be welcomed.
+
+There may be problems if the program you use for unpacking the source
+use automatic conversion of end-of-line characters.
+
+This port may be out of sync with minor GMP releases or patches.
+The MacOS build is very different from the Unix build process and
+for some changes in the Unix build the build process for MacOS has
+to be changed manually.
+
+The library uses stream I/O operations for some of the GMP functions
+and maybe for some error messages. This means that to link this
+library to form a normal Mac application you may get link problems,
+i.e. a Mac normally has no console/shell to write to.
+
+If you are unfamiliar with MPW note that the "return" key and the
+"enter" key mean different things to MPW. The first just add a line
+break, the second send the line your pointer is at or the selection
+you have to the MPW command interpreter.
+
+If you mount the GMP source from a Unix netatalk server don't move or
+remove files from the Unix side while MPW is running. MPW cache
+information about what the file system looks like and gets very
+confused or crash.
+
+Kent Boortz
diff --git a/gmp/macos/configure b/gmp/macos/configure
new file mode 100755
index 0000000000..783d1e0be1
--- /dev/null
+++ b/gmp/macos/configure
@@ -0,0 +1,519 @@
+#!/usr/bin/perl
+
+# This is a simple configure script for MacOS and MPW.
+# Note that this script can't be run directly from MPW perl
+# because it has the wrong end-of-line characters. See README.
+
+# Copyright 2000, 2001, 2002, 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/.
+
+# ***************************** NOTE **************************************
+# This script tries to figure out things about this release but has a hard
+# time doing it. It reads some lines in "configure", "Makefile.am" and
+# "mp*/Makefile.am" and try to guess things. With every new release
+# this script has to be tested.
+# ***************************** NOTE **************************************
+
+use strict;
+
+###########################################################################
+#
+# Platform dependent
+#
+###########################################################################
+
+$/ = "\012" # Input files use Unix end-of-line chars
+ if $^O eq 'MacOS';
+
+###########################################################################
+#
+# Constants
+#
+###########################################################################
+
+# Directories to create
+
+my @dirs =
+ (
+ 'MpfObj',
+ 'MpnObj',
+ 'MpqObj',
+ 'MpzObj',
+ 'PrintfObj',
+ 'ScanfObj',
+ 'CmnObj',
+ 'AsmObj',
+ 'Asm',
+ 'MpfBin',
+ 'MpqBin',
+ 'MpzBin',
+ );
+
+my $cfg; # Will point to %cfg_apple or %cfg_cw
+
+my %cfg_apple =
+ (
+ 'cc' => 'MrC',
+ 'coptions' => ['-ansi on -i : -i :: -i ::mpn:powerpc32 -i ::mpz',
+ '-opt speed -inline on'],
+ 'link' => 'PPCLink',
+ 'linkoptions' => '-sym on -xm library',
+ 'tooloptions' => "-t 'MPST' -c 'MPS'",
+ 'asm' => 'PPCAsm',
+ 'aoptions' => '-sym on',
+ 'syslibs' => [
+ '"{SharedLibraries}"StdCLib',
+ '"{SharedLibraries}"InterfaceLib',
+ '"{SharedLibraries}"MathLib',
+ '"{PPCLibraries}"StdCRuntime.o',
+ '"{PPCLibraries}"PPCCRuntime.o',
+ ],
+ );
+
+my %cfg_cw =
+ (
+ 'cc' => 'MWCPPC',
+ 'coptions' => [
+ '-opt all -w nounusedvar,noextended',
+ '-i :: -i ::mpn:powerpc32 -i ::mpz',
+ '-sym full',
+ ],
+ 'link' => 'MWLinkPPC',
+ 'linkoptions' => '-sym fullpath -library',
+ 'tooloptions' => '-mpwtool',
+ 'asm' => 'PPCAsm',
+ 'aoptions' => '-sym on',
+ 'syslibs' => [
+ '"{SharedLibraries}"InterfaceLib',
+ '"{MWPPCLibraries}MSL MPWCRuntime.Lib"',
+ '"{MWPPCLibraries}MSL C.PPC MPW(NL).Lib"',
+ '"{SharedLibraries}"MathLib',
+ ],
+ );
+
+# We only set the variables that have a value
+my %vars =
+ (
+ 'BITS_PER_MP_LIMB' => 32,
+ 'HAVE_HOST_CPU_FAMILY_power' => 0,
+ 'HAVE_HOST_CPU_FAMILY_powerpc' => 1,
+ 'GMP_NAIL_BITS' => 0,
+ 'DEFN_LONG_LONG_LIMB' => '',
+ 'LIBGMP_DLL' => 0,
+ );
+
+my $make_in = 'Makefile.in';
+my $make = 'Makefile';
+my $configure = mf("../configure");
+my $configure_in = mf("../configure.in");
+my $config_in = mf("../config.in");
+my $gmp_h = mf('../gmp.h');
+my $gmp_h_in = mf('../gmp-h.in');
+my $mpn_asm_dir = "../mpn/powerpc32";
+my $mpn_gen_dir = "../mpn/generic";
+my $config_h = 'config.h';
+
+my $asm_start = "\ttoc"; # No dot, like ".dot"?
+
+###########################################################################
+#
+# Read command line
+#
+###########################################################################
+
+$cfg = \%cfg_apple; # Default
+
+if (@ARGV and $ARGV[0] =~ /^cw|co/) {
+ $cfg = \%cfg_cw;
+ $make .= '.cw';
+}
+
+###########################################################################
+#
+# Parse top configure file for mpn files
+#
+###########################################################################
+
+my ($files,$optional,$package,$version) = parse_top_configure($configure);
+my %mpn_objects = map {$_ => 1} (@$files,@$optional);
+my %mpn_optional = map {$_ => 1} @$optional;
+
+###########################################################################
+#
+# Create config.h from ../config.in
+#
+###########################################################################
+
+my @asm_files;
+
+open(CONFIG_IN, $config_in)
+ or die "Can't open \"$config_in\"\n";
+open(CONFIG_H, ">$config_h")
+ or die "Can't create \"$config_h\"\n";
+
+while (<CONFIG_IN>) {
+ chomp;
+
+ if (/^\s*#\s*undef\s+HAVE_NATIVE_mpn_(\w+)/ and
+ -r mf("$mpn_asm_dir/$1.asm")) {
+
+ if (defined delete $mpn_objects{$1}) {
+ push(@asm_files, $1);
+ print CONFIG_H "\#define HAVE_NATIVE_mpn_$1 1\n";
+ } else {
+ print STDERR "Warning: Found asm file \"$1\" but no corresponding C file - ignoring\n";
+ }
+
+ } elsif (/^\s*#\s*undef\s+inline\b/) {
+ print CONFIG_H "\#define inline\n";
+ } elsif (/^\s*#\s*undef\s+HAVE_STDARG\b/) {
+ print CONFIG_H "\#define HAVE_STDARG 1\n";
+ } elsif (/^\s*#\s*undef\s+HAVE_STRCHR\b/) {
+ print CONFIG_H "\#define HAVE_STRCHR 1\n";
+ } elsif (/^\s*#\s*undef\s+HAVE_HOST_CPU_FAMILY_powerpc\b/) {
+ print CONFIG_H "\#define HAVE_HOST_CPU_FAMILY_powerpc 1\n";
+ } elsif (/^\s*#\s*undef\s+WANT_TMP_NOTREENTRANT\b/) {
+ print CONFIG_H "\#define WANT_TMP_NOTREENTRANT 1\n";
+ } elsif (/^\s*#\s*undef\s+PACKAGE\b/) {
+ print CONFIG_H "\#define PACKAGE \"$package\"\n";
+ } elsif (/^\s*#\s*undef\s+VERSION\b/) {
+ print CONFIG_H "\#define VERSION \"$version\"\n";
+ } elsif (/^\s*#\s*undef\s+STDC_HEADERS\b/) {
+ print CONFIG_H "\#define STDC_HEADERS 1\n";
+ } else { # Blank line, leave it
+ print CONFIG_H "$_\n";
+ }
+}
+
+close CONFIG_H;
+close CONFIG_IN;
+
+###########################################################################
+#
+# Create gmp.h from ../gmp-h.in
+#
+###########################################################################
+
+open(GMP_H_IN, $gmp_h_in)
+ or die "Can't open \"$gmp_h_in\"\n";
+open(GMP_H, ">$gmp_h")
+ or die "Can't create \"$gmp_h\"\n";
+
+while (<GMP_H_IN>) {
+ chomp; # Remove whatever ending it was
+
+ # Do the variable substitution
+
+ s/\@([^\@]+)\@/exists $vars{$1} ? $vars{$1} : ''/ge;
+
+ print GMP_H "$_\n";
+}
+
+close GMP_H;
+close GMP_H_IN;
+
+###########################################################################
+#
+# Create directories
+#
+###########################################################################
+
+foreach (@dirs) {
+ -d $_ or mkdir $_, 0775
+ or die "Can't create directory \"$_\"\n";
+}
+
+###########################################################################
+#
+# Parse the *.asm files found and convert them to MPW format
+#
+###########################################################################
+
+my $file;
+
+foreach $file (@asm_files) {
+ my $ifile = mf("$mpn_asm_dir/$file.asm");
+ my $ofile = mf("Asm/$file.s");
+ my $func;
+ my %defs = ();
+
+ open(ASM, $ifile)
+ or die "Can't read file \"$ifile\"\n";
+ open(NEW, ">$ofile")
+ or die "Can't create file \"$ofile\"\n";
+
+ while (<ASM>) {
+ chomp; # Remove whatever ending it was
+
+ s/\bdnl\b/;/ or s/\bC\b/;/; # Use ; comments
+
+ s/include\s*\(.*?\)//; # Don't use include macro
+
+ s/ASM_START\s*\(.*?\)/$asm_start/;
+
+ if (s/PROLOGUE\s*\(\s*(.*?)\s*\)/asm_prologue($1)/e) {
+ $func = $1;
+ }
+
+ s/EPILOGUE\s*\(\s*(.*?)\s*\)/asm_epilogue($func)/e;
+
+ s/L\(([^)]*)\)/L$1/g; # L() style labels
+
+ # register name defines
+ if (/\bdefine\(`?([a-zA-Z0-9]+)'?,`?([^')]*)\'?\)/) {
+ $defs{$1} = $2;
+ $_ = "\n";
+ }
+ foreach my $i (keys %defs) {
+ s/\b\Q$i\E\b/$defs{$i}/g;
+ }
+
+ s/\n/\x0D/g;
+ print NEW "$_\x0D"; # Use MacOS end-of-line character
+ }
+
+ close ASM;
+ close NEW;
+}
+
+
+###########################################################################
+#
+# Parse the Makefile.in and produce the Makefile
+#
+###########################################################################
+
+# Check if we have optional left in C directory
+
+foreach (keys %mpn_objects) {
+ delete $mpn_objects{$_}
+ if $mpn_optional{$_} and !-r mf("$mpn_gen_dir/$_.c");
+}
+
+my $mpn_objects = join(' ', map {"{MpnObjDir}$_.o"} sort keys %mpn_objects);
+$mpn_objects =~ s/(.{1,66})\s/$1 \xB6\x0D\t/g;
+
+my @asm_objects = @asm_files;
+my @asm_sources = @asm_files;
+
+# Adjust configuration
+
+foreach (keys %{$cfg}) {
+ $$cfg{$_} = join(" \xB6\x0D\t\t", @{$$cfg{$_}})
+ if ref $$cfg{$_};
+}
+
+my %config =
+ (
+ 'version' => $version,
+ 'package' => $package,
+ 'c' => "\xB6",
+ 'dep' => "\xC4",
+ 'wildcard'=> "\xC5",
+ 'asm_objects' =>
+ join(" \xB6\x0D\t",map {$_ = "{AsmObjDir}$_.o"} sort @asm_objects),
+ 'asm_sources' =>
+ join(" \xB6\x0D\t",map {$_ = "{AsmSrcDir}$_.s"} sort @asm_sources),
+ 'mpn_objects' => $mpn_objects,
+ 'mpz_objects' => what_objects("mpz","../mpz","{MpzObjDir}"),
+ 'mpf_objects' => what_objects("mpf","../mpf","{MpfObjDir}"),
+ 'mpq_objects' => what_objects("mpq","../mpq","{MpqObjDir}"),
+ 'printf_objects' => what_objects("printf","../printf","{PrintfObjDir}"),
+ 'scanf_objects' => what_objects("scanf","../scanf","{ScanfObjDir}"),
+ 'gmp_objects' => what_objects("gmp","..", "{CmnObjDir}"),
+ %{$cfg},
+ );
+
+
+open(IN, $make_in)
+ or die "Can't read file \"$make_in\"\n";
+open(OUT, ">$make")
+ or die "Can't create file \"$make\"\n";
+
+while (<IN>) {
+ chomp; # Remove whatever ending it was
+
+ # Do the variable substitution
+
+ s/\@([^\@]+)\@/exists $config{$1} ? $config{$1} : ''/ge;
+
+ print OUT "$_\x0D"; # Use MacOS end-of-line character
+}
+
+close IN;
+close OUT;
+
+###########################################################################
+#
+# Parse the configure.in file to find the mpn files to compile and link
+# Find package name and version
+#
+###########################################################################
+
+sub parse_top_configure {
+ my $cfg = shift;
+
+ open(CONFIGURE, $cfg)
+ or die "Can't open \"$cfg\"\n";
+ my $old_eol = $/;
+ undef $/;
+ my $text = <CONFIGURE>;
+ $/ = $old_eol;
+ close CONFIGURE;
+
+ my ($package) = $text =~ /(?:\n|\r)PACKAGE_NAME\s*=\s*(\S+)/;
+ my ($version) = $text =~ /(?:\n|\r)PACKAGE_VERSION\s*=\s*(\S+)/;
+
+ my $files = join(' ',$text =~ /(?:\n|\r)gmp_mpn_functions\s*=\s*\"([^\"]+)/);
+ $files =~ s/\\/ /g;
+ $files =~ s/\$\{?\w*\}?//g;
+ my @files = sort split(' ',$files);
+
+ $files = join(' ',$text =~ /(?:\n|\r)gmp_mpn_functions_optional\s*=\s*\"([^\"]+)/);
+ $files =~ s/\\/ /g;
+ $files =~ s/\$\{?\w*\}?//g;
+ my @optional = sort split(' ',$files);
+
+ @files > 30 or die "Can't find mpn files in \"$cfg\"\n";
+ defined $package or die "Can't find package name in \"$cfg\"\n";
+ defined $version or die "Can't find version name in \"$cfg\"\n";
+ return (\@files,\@optional,$package,$version);
+}
+
+###########################################################################
+#
+# Find the C files for mpz, mpf .....
+#
+###########################################################################
+
+sub what_objects {
+ my $part = shift;
+ my $srcdir = shift;
+ my $dstdir = shift;
+
+ my $makefile_am = mf("$srcdir/Makefile.am");
+
+ # We look in the Makefile.am file
+ open(MAKEFILE_AM, $makefile_am)
+ or die "Can't open file \"$makefile_am\"\n";
+
+ # I had as short version of this using more advanced
+ # regular expressions on the whole file content but
+ # MacPerl freezes my Mac every time..... :-(
+
+ my $line;
+ my $text = '';
+
+ while (defined($line = <MAKEFILE_AM>) ) {
+ chomp $line;
+
+ if ($line =~ s/^lib${part}_la_SOURCES\s*=//) {
+ do {
+ chomp $line;
+ if ($line =~ s/\\\s*$//) {
+ $text .= " $line";
+ } else {
+ $text .= " $line";
+ next;
+ }
+ } while (defined($line = <MAKEFILE_AM>));
+ }
+
+ if ($line =~ s/^nodist_lib${part}_la_SOURCES\s*=//) {
+ do {
+ chomp $line;
+ if ($line =~ s/\\\s*$//) {
+ $text .= " $line";
+ } else {
+ $text .= " $line";
+ last;
+ }
+ } while (defined($line = <MAKEFILE_AM>));
+ }
+ }
+ close MAKEFILE_AM;
+
+ my @ofiles = split(' ',$text);
+ @ofiles > 8 or die "Can't find $part files in \"$makefile_am\"\n";
+ my $ofiles = join(' ', map {/^(.+)\.c$/ and $_ = "$dstdir$1.o"} @ofiles);
+ $ofiles =~ s/(.{1,66})\s/$1 \xB6\x0D\t/g;
+
+ return $ofiles;
+}
+
+###########################################################################
+#
+# Assembler
+#
+###########################################################################
+
+sub asm_epilogue {
+ my $func = shift;
+ return "\tcsect .__g$func\[pr]";
+}
+
+sub asm_prologue {
+ my $func = shift;
+
+ my $asm = <<HERE;
+ EXPORT __g$func\[DS]
+ EXPORT .__g$func\[PR]
+
+ TC __g$func\[TC], __g$func\[DS]
+
+ CSECT __g$func\[DS]
+ DC.L .__g$func\[PR]
+ DC.L TOC[tc0]
+
+ CSECT .__g$func\[PR]
+ FUNCTION .__g$func\[PR]
+HERE
+ return $asm;
+}
+
+
+###########################################################################
+#
+# Platform dependent filename conversion
+#
+###########################################################################
+
+sub mf {
+ my $path = shift;
+
+ return $path unless $^O eq 'MacOS';
+
+ $path =~ /:/ and die "File name already converted to mac format: $path\n";
+
+ if ($path =~ s&^/&&) {
+ # Absolute path
+ unless ($path =~ s&/&:&g) {
+ # This is a drive name
+ $path .= ':';
+ }
+ } else {
+ # Relative path
+ if ($path =~ s&/&:&g) {
+ # Contains slash
+ $path = ":$path";
+ $path =~ s&\.\.:&:&g;
+ } else {
+ # Plain file name, no directory part
+ }
+ }
+ return $path;
+}
diff --git a/gmp/macos/unix2mac b/gmp/macos/unix2mac
new file mode 100644
index 0000000000..49e755d6c3
--- /dev/null
+++ b/gmp/macos/unix2mac
@@ -0,0 +1 @@
+$/="\r"; while(<>) {chomp; print "$_\n";};
diff --git a/gmp/memory.c b/gmp/memory.c
index 4475f37de3..42a9834dae 100644
--- a/gmp/memory.c
+++ b/gmp/memory.c
@@ -1,32 +1,21 @@
/* Memory allocation routines.
-Copyright 1991, 1993, 1994, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <stdlib.h> /* for malloc, realloc, free */
@@ -35,9 +24,10 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
-void * (*__gmp_allocate_func) (size_t) = __gmp_default_allocate;
-void * (*__gmp_reallocate_func) (void *, size_t, size_t) = __gmp_default_reallocate;
-void (*__gmp_free_func) (void *, size_t) = __gmp_default_free;
+void * (*__gmp_allocate_func) __GMP_PROTO ((size_t)) = __gmp_default_allocate;
+void * (*__gmp_reallocate_func) __GMP_PROTO ((void *, size_t, size_t))
+ = __gmp_default_reallocate;
+void (*__gmp_free_func) __GMP_PROTO ((void *, size_t)) = __gmp_default_free;
/* Default allocation functions. In case of failure to allocate/reallocate
@@ -49,7 +39,7 @@ __gmp_default_allocate (size_t size)
void *ret;
#ifdef DEBUG
size_t req_size = size;
- size += 2 * GMP_LIMB_BYTES;
+ size += 2 * BYTES_PER_MP_LIMB;
#endif
ret = malloc (size);
if (ret == 0)
@@ -63,8 +53,8 @@ __gmp_default_allocate (size_t size)
mp_ptr p = ret;
p++;
p[-1] = (0xdeadbeef << 31) + 0xdeafdeed;
- if (req_size % GMP_LIMB_BYTES == 0)
- p[req_size / GMP_LIMB_BYTES] = ~((0xdeadbeef << 31) + 0xdeafdeed);
+ if (req_size % BYTES_PER_MP_LIMB == 0)
+ p[req_size / BYTES_PER_MP_LIMB] = ~((0xdeadbeef << 31) + 0xdeafdeed);
ret = p;
}
#endif
@@ -87,8 +77,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 % GMP_LIMB_BYTES == 0)
- if (p[old_size / GMP_LIMB_BYTES] != ~((0xdeadbeef << 31) + 0xdeafdeed))
+ if (old_size % BYTES_PER_MP_LIMB == 0)
+ if (p[old_size / BYTES_PER_MP_LIMB] != ~((0xdeadbeef << 31) + 0xdeafdeed))
{
fprintf (stderr, "gmp: (realloc) data clobbered after allocation block\n");
abort ();
@@ -96,7 +86,7 @@ __gmp_default_reallocate (void *oldptr, size_t old_size, size_t new_size)
oldptr = p - 1;
}
- new_size += 2 * GMP_LIMB_BYTES;
+ new_size += 2 * BYTES_PER_MP_LIMB;
#endif
ret = realloc (oldptr, new_size);
@@ -111,8 +101,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 % GMP_LIMB_BYTES == 0)
- p[req_size / GMP_LIMB_BYTES] = ~((0xdeadbeef << 31) + 0xdeafdeed);
+ if (req_size % BYTES_PER_MP_LIMB == 0)
+ p[req_size / BYTES_PER_MP_LIMB] = ~((0xdeadbeef << 31) + 0xdeafdeed);
ret = p;
}
#endif
@@ -132,8 +122,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 % GMP_LIMB_BYTES == 0)
- if (p[blk_size / GMP_LIMB_BYTES] != ~((0xdeadbeef << 31) + 0xdeafdeed))
+ if (blk_size % BYTES_PER_MP_LIMB == 0)
+ if (p[blk_size / BYTES_PER_MP_LIMB] != ~((0xdeadbeef << 31) + 0xdeafdeed))
{
fprintf (stderr, "gmp: (free) data clobbered after allocation block\n");
abort ();
diff --git a/gmp/mini-gmp/README b/gmp/mini-gmp/README
deleted file mode 100644
index f291489ea3..0000000000
--- a/gmp/mini-gmp/README
+++ /dev/null
@@ -1,77 +0,0 @@
-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/.
-
-
-This is "mini-gmp", a small implementation of a subset of GMP's mpn
-and mpz interfaces.
-
-It is intended for applications which need arithmetic on numbers
-larger than a machine word, but which don't need to handle very large
-numbers very efficiently. Those applications can include a copy of
-mini-gmp to get a GMP-compatible interface with small footprint. One
-can also arrange for optional linking with the real GMP library, using
-mini-gmp as a fallback when for some reason GMP is not available, or
-not desired as a dependency.
-
-The supported GMP subset is declared in mini-gmp.h. The implemented
-functions are fully compatible with the corresponding GMP functions,
-as specified in the GMP manual, with a few exceptions:
-
- mpz_set_str, mpz_init_set_str, mpz_get_str, mpz_out_str and
- mpz_sizeinbase support only |base| <= 36;
- mpz_export and mpz_import support only NAILS = 0.
-
- The REALLOC_FUNC and FREE_FUNC registered with
- mp_set_memory_functions does not get the correct size of the
- allocated block in the corresponding argument. mini-gmp always
- passes zero for these rarely used arguments.
-
-The implementation is a single file, mini-gmp.c.
-
-The performance target for mini-gmp is to be at most 10 times slower
-than the real GMP library, for numbers of size up to a few hundred
-bits. No asymptotically fast algorithms are included in mini-gmp, so
-it will be many orders of magnitude slower than GMP for very large
-numbers.
-
-You should never "install" mini-gmp. Applications can either just
-#include mini-gmp.c (but then, beware that it defines several macros
-and functions outside of the advertised interface). Or compile
-mini-gmp.c as a separate compilation unit, and use the declarations in
-mini-gmp.h.
-
-The tests subdirectory contains a testsuite. To use it, you need GMP
-and GNU make. Just run make check in the tests directory. If the
-hard-coded compiler settings are not right, you have to either edit the
-Makefile or pass overriding values on the make command line (e.g.,
-make CC=cc check). Testing is not (yet) as thorough as for the real
-GMP.
-
-The current version was put together by Niels Möller
-<nisse@lysator.liu.se>, with a fair amount of copy-and-paste from the
-GMP sources.
diff --git a/gmp/mini-gmp/mini-gmp.c b/gmp/mini-gmp/mini-gmp.c
deleted file mode 100644
index b9186951cb..0000000000
--- a/gmp/mini-gmp/mini-gmp.c
+++ /dev/null
@@ -1,4386 +0,0 @@
-/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
-
- Contributed to the GNU project by Niels Möller
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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: All functions in this file which are not declared in
- mini-gmp.h are internal, and are not intended to be compatible
- neither with GMP nor with future versions of mini-gmp. */
-
-/* Much of the material copied from GMP files, including: gmp-impl.h,
- longlong.h, mpn/generic/add_n.c, mpn/generic/addmul_1.c,
- mpn/generic/lshift.c, mpn/generic/mul_1.c,
- mpn/generic/mul_basecase.c, mpn/generic/rshift.c,
- mpn/generic/sbpi1_div_qr.c, mpn/generic/sub_n.c,
- mpn/generic/submul_1.c. */
-
-#include <assert.h>
-#include <ctype.h>
-#include <limits.h>
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-
-#include "mini-gmp.h"
-
-
-/* Macros */
-#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
-
-#define GMP_LIMB_MAX (~ (mp_limb_t) 0)
-#define GMP_LIMB_HIGHBIT ((mp_limb_t) 1 << (GMP_LIMB_BITS - 1))
-
-#define GMP_HLIMB_BIT ((mp_limb_t) 1 << (GMP_LIMB_BITS / 2))
-#define GMP_LLIMB_MASK (GMP_HLIMB_BIT - 1)
-
-#define GMP_ULONG_BITS (sizeof(unsigned long) * CHAR_BIT)
-#define GMP_ULONG_HIGHBIT ((unsigned long) 1 << (GMP_ULONG_BITS - 1))
-
-#define GMP_ABS(x) ((x) >= 0 ? (x) : -(x))
-#define GMP_NEG_CAST(T,x) (-((T)((x) + 1) - 1))
-
-#define GMP_MIN(a, b) ((a) < (b) ? (a) : (b))
-#define GMP_MAX(a, b) ((a) > (b) ? (a) : (b))
-
-#define gmp_assert_nocarry(x) do { \
- mp_limb_t __cy = x; \
- assert (__cy == 0); \
- } while (0)
-
-#define gmp_clz(count, x) do { \
- mp_limb_t __clz_x = (x); \
- unsigned __clz_c; \
- for (__clz_c = 0; \
- (__clz_x & ((mp_limb_t) 0xff << (GMP_LIMB_BITS - 8))) == 0; \
- __clz_c += 8) \
- __clz_x <<= 8; \
- for (; (__clz_x & GMP_LIMB_HIGHBIT) == 0; __clz_c++) \
- __clz_x <<= 1; \
- (count) = __clz_c; \
- } while (0)
-
-#define gmp_ctz(count, x) do { \
- mp_limb_t __ctz_x = (x); \
- unsigned __ctz_c = 0; \
- gmp_clz (__ctz_c, __ctz_x & - __ctz_x); \
- (count) = GMP_LIMB_BITS - 1 - __ctz_c; \
- } while (0)
-
-#define gmp_add_ssaaaa(sh, sl, ah, al, bh, bl) \
- do { \
- mp_limb_t __x; \
- __x = (al) + (bl); \
- (sh) = (ah) + (bh) + (__x < (al)); \
- (sl) = __x; \
- } while (0)
-
-#define gmp_sub_ddmmss(sh, sl, ah, al, bh, bl) \
- do { \
- mp_limb_t __x; \
- __x = (al) - (bl); \
- (sh) = (ah) - (bh) - ((al) < (bl)); \
- (sl) = __x; \
- } while (0)
-
-#define gmp_umul_ppmm(w1, w0, u, v) \
- do { \
- mp_limb_t __x0, __x1, __x2, __x3; \
- unsigned __ul, __vl, __uh, __vh; \
- mp_limb_t __u = (u), __v = (v); \
- \
- __ul = __u & GMP_LLIMB_MASK; \
- __uh = __u >> (GMP_LIMB_BITS / 2); \
- __vl = __v & GMP_LLIMB_MASK; \
- __vh = __v >> (GMP_LIMB_BITS / 2); \
- \
- __x0 = (mp_limb_t) __ul * __vl; \
- __x1 = (mp_limb_t) __ul * __vh; \
- __x2 = (mp_limb_t) __uh * __vl; \
- __x3 = (mp_limb_t) __uh * __vh; \
- \
- __x1 += __x0 >> (GMP_LIMB_BITS / 2);/* this can't give carry */ \
- __x1 += __x2; /* but this indeed can */ \
- if (__x1 < __x2) /* did we get it? */ \
- __x3 += GMP_HLIMB_BIT; /* yes, add it in the proper pos. */ \
- \
- (w1) = __x3 + (__x1 >> (GMP_LIMB_BITS / 2)); \
- (w0) = (__x1 << (GMP_LIMB_BITS / 2)) + (__x0 & GMP_LLIMB_MASK); \
- } while (0)
-
-#define gmp_udiv_qrnnd_preinv(q, r, nh, nl, d, di) \
- do { \
- mp_limb_t _qh, _ql, _r, _mask; \
- gmp_umul_ppmm (_qh, _ql, (nh), (di)); \
- gmp_add_ssaaaa (_qh, _ql, _qh, _ql, (nh) + 1, (nl)); \
- _r = (nl) - _qh * (d); \
- _mask = -(mp_limb_t) (_r > _ql); /* both > and >= are OK */ \
- _qh += _mask; \
- _r += _mask & (d); \
- if (_r >= (d)) \
- { \
- _r -= (d); \
- _qh++; \
- } \
- \
- (r) = _r; \
- (q) = _qh; \
- } while (0)
-
-#define gmp_udiv_qr_3by2(q, r1, r0, n2, n1, n0, d1, d0, dinv) \
- do { \
- mp_limb_t _q0, _t1, _t0, _mask; \
- gmp_umul_ppmm ((q), _q0, (n2), (dinv)); \
- gmp_add_ssaaaa ((q), _q0, (q), _q0, (n2), (n1)); \
- \
- /* Compute the two most significant limbs of n - q'd */ \
- (r1) = (n1) - (d1) * (q); \
- gmp_sub_ddmmss ((r1), (r0), (r1), (n0), (d1), (d0)); \
- gmp_umul_ppmm (_t1, _t0, (d0), (q)); \
- gmp_sub_ddmmss ((r1), (r0), (r1), (r0), _t1, _t0); \
- (q)++; \
- \
- /* Conditionally adjust q and the remainders */ \
- _mask = - (mp_limb_t) ((r1) >= _q0); \
- (q) += _mask; \
- gmp_add_ssaaaa ((r1), (r0), (r1), (r0), _mask & (d1), _mask & (d0)); \
- if ((r1) >= (d1)) \
- { \
- if ((r1) > (d1) || (r0) >= (d0)) \
- { \
- (q)++; \
- gmp_sub_ddmmss ((r1), (r0), (r1), (r0), (d1), (d0)); \
- } \
- } \
- } while (0)
-
-/* Swap macros. */
-#define MP_LIMB_T_SWAP(x, y) \
- do { \
- mp_limb_t __mp_limb_t_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_limb_t_swap__tmp; \
- } while (0)
-#define MP_SIZE_T_SWAP(x, y) \
- do { \
- mp_size_t __mp_size_t_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_size_t_swap__tmp; \
- } while (0)
-#define MP_BITCNT_T_SWAP(x,y) \
- do { \
- mp_bitcnt_t __mp_bitcnt_t_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_bitcnt_t_swap__tmp; \
- } while (0)
-#define MP_PTR_SWAP(x, y) \
- do { \
- mp_ptr __mp_ptr_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_ptr_swap__tmp; \
- } while (0)
-#define MP_SRCPTR_SWAP(x, y) \
- do { \
- mp_srcptr __mp_srcptr_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mp_srcptr_swap__tmp; \
- } while (0)
-
-#define MPN_PTR_SWAP(xp,xs, yp,ys) \
- do { \
- MP_PTR_SWAP (xp, yp); \
- MP_SIZE_T_SWAP (xs, ys); \
- } while(0)
-#define MPN_SRCPTR_SWAP(xp,xs, yp,ys) \
- do { \
- MP_SRCPTR_SWAP (xp, yp); \
- MP_SIZE_T_SWAP (xs, ys); \
- } while(0)
-
-#define MPZ_PTR_SWAP(x, y) \
- do { \
- mpz_ptr __mpz_ptr_swap__tmp = (x); \
- (x) = (y); \
- (y) = __mpz_ptr_swap__tmp; \
- } while (0)
-#define MPZ_SRCPTR_SWAP(x, y) \
- do { \
- 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;
-
-
-/* Memory allocation and other helper functions. */
-static void
-gmp_die (const char *msg)
-{
- fprintf (stderr, "%s\n", msg);
- abort();
-}
-
-static void *
-gmp_default_alloc (size_t size)
-{
- void *p;
-
- assert (size > 0);
-
- p = malloc (size);
- if (!p)
- gmp_die("gmp_default_alloc: Virtual memory exhausted.");
-
- return p;
-}
-
-static void *
-gmp_default_realloc (void *old, size_t old_size, size_t new_size)
-{
- mp_ptr p;
-
- p = realloc (old, new_size);
-
- if (!p)
- gmp_die("gmp_default_realoc: Virtual memory exhausted.");
-
- return p;
-}
-
-static void
-gmp_default_free (void *p, size_t size)
-{
- free (p);
-}
-
-static void * (*gmp_allocate_func) (size_t) = gmp_default_alloc;
-static void * (*gmp_reallocate_func) (void *, size_t, size_t) = gmp_default_realloc;
-static void (*gmp_free_func) (void *, size_t) = gmp_default_free;
-
-void
-mp_get_memory_functions (void *(**alloc_func) (size_t),
- void *(**realloc_func) (void *, size_t, size_t),
- void (**free_func) (void *, size_t))
-{
- if (alloc_func)
- *alloc_func = gmp_allocate_func;
-
- if (realloc_func)
- *realloc_func = gmp_reallocate_func;
-
- if (free_func)
- *free_func = gmp_free_func;
-}
-
-void
-mp_set_memory_functions (void *(*alloc_func) (size_t),
- void *(*realloc_func) (void *, size_t, size_t),
- void (*free_func) (void *, size_t))
-{
- if (!alloc_func)
- alloc_func = gmp_default_alloc;
- if (!realloc_func)
- realloc_func = gmp_default_realloc;
- if (!free_func)
- free_func = gmp_default_free;
-
- gmp_allocate_func = alloc_func;
- gmp_reallocate_func = realloc_func;
- gmp_free_func = free_func;
-}
-
-#define gmp_xalloc(size) ((*gmp_allocate_func)((size)))
-#define gmp_free(p) ((*gmp_free_func) ((p), 0))
-
-static mp_ptr
-gmp_xalloc_limbs (mp_size_t size)
-{
- return gmp_xalloc (size * sizeof (mp_limb_t));
-}
-
-static mp_ptr
-gmp_xrealloc_limbs (mp_ptr old, mp_size_t size)
-{
- assert (size > 0);
- return (*gmp_reallocate_func) (old, 0, size * sizeof (mp_limb_t));
-}
-
-
-/* MPN interface */
-
-void
-mpn_copyi (mp_ptr d, mp_srcptr s, mp_size_t n)
-{
- mp_size_t i;
- for (i = 0; i < n; i++)
- d[i] = s[i];
-}
-
-void
-mpn_copyd (mp_ptr d, mp_srcptr s, mp_size_t n)
-{
- while (n-- > 0)
- d[n] = s[n];
-}
-
-int
-mpn_cmp (mp_srcptr ap, mp_srcptr bp, mp_size_t n)
-{
- while (--n >= 0)
- {
- if (ap[n] != bp[n])
- return ap[n] > bp[n] ? 1 : -1;
- }
- return 0;
-}
-
-static int
-mpn_cmp4 (mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
-{
- if (an != bn)
- return an < bn ? -1 : 1;
- else
- return mpn_cmp (ap, bp, an);
-}
-
-static mp_size_t
-mpn_normalized_size (mp_srcptr xp, mp_size_t n)
-{
- for (; n > 0 && xp[n-1] == 0; n--)
- ;
- return 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);
- i = 0;
- do
- {
- mp_limb_t r = ap[i] + b;
- /* Carry out */
- b = (r < b);
- rp[i] = r;
- }
- while (++i < n);
-
- return b;
-}
-
-mp_limb_t
-mpn_add_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
-{
- mp_size_t i;
- mp_limb_t cy;
-
- for (i = 0, cy = 0; i < n; i++)
- {
- mp_limb_t a, b, r;
- a = ap[i]; b = bp[i];
- r = a + cy;
- cy = (r < cy);
- r += b;
- cy += (r < b);
- rp[i] = r;
- }
- return cy;
-}
-
-mp_limb_t
-mpn_add (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
-{
- mp_limb_t cy;
-
- assert (an >= bn);
-
- cy = mpn_add_n (rp, ap, bp, bn);
- if (an > bn)
- cy = mpn_add_1 (rp + bn, ap + bn, an - bn, cy);
- return cy;
-}
-
-mp_limb_t
-mpn_sub_1 (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t b)
-{
- mp_size_t i;
-
- assert (n > 0);
-
- i = 0;
- do
- {
- mp_limb_t a = ap[i];
- /* Carry out */
- mp_limb_t cy = a < b;;
- rp[i] = a - b;
- b = cy;
- }
- while (++i < n);
-
- return b;
-}
-
-mp_limb_t
-mpn_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
-{
- mp_size_t i;
- mp_limb_t cy;
-
- for (i = 0, cy = 0; i < n; i++)
- {
- mp_limb_t a, b;
- a = ap[i]; b = bp[i];
- b += cy;
- cy = (b < cy);
- cy += (a < b);
- rp[i] = a - b;
- }
- return cy;
-}
-
-mp_limb_t
-mpn_sub (mp_ptr rp, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
-{
- mp_limb_t cy;
-
- assert (an >= bn);
-
- cy = mpn_sub_n (rp, ap, bp, bn);
- if (an > bn)
- cy = mpn_sub_1 (rp + bn, ap + bn, an - bn, cy);
- return cy;
-}
-
-mp_limb_t
-mpn_mul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
-{
- mp_limb_t ul, cl, hpl, lpl;
-
- assert (n >= 1);
-
- cl = 0;
- do
- {
- ul = *up++;
- gmp_umul_ppmm (hpl, lpl, ul, vl);
-
- lpl += cl;
- cl = (lpl < cl) + hpl;
-
- *rp++ = lpl;
- }
- while (--n != 0);
-
- return cl;
-}
-
-mp_limb_t
-mpn_addmul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
-{
- mp_limb_t ul, cl, hpl, lpl, rl;
-
- assert (n >= 1);
-
- cl = 0;
- do
- {
- ul = *up++;
- gmp_umul_ppmm (hpl, lpl, ul, vl);
-
- lpl += cl;
- cl = (lpl < cl) + hpl;
-
- rl = *rp;
- lpl = rl + lpl;
- cl += lpl < rl;
- *rp++ = lpl;
- }
- while (--n != 0);
-
- return cl;
-}
-
-mp_limb_t
-mpn_submul_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t vl)
-{
- mp_limb_t ul, cl, hpl, lpl, rl;
-
- assert (n >= 1);
-
- cl = 0;
- do
- {
- ul = *up++;
- gmp_umul_ppmm (hpl, lpl, ul, vl);
-
- lpl += cl;
- cl = (lpl < cl) + hpl;
-
- rl = *rp;
- lpl = rl - lpl;
- cl += lpl > rl;
- *rp++ = lpl;
- }
- while (--n != 0);
-
- return cl;
-}
-
-mp_limb_t
-mpn_mul (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
-{
- assert (un >= vn);
- assert (vn >= 1);
-
- /* We first multiply by the low order limb. This result can be
- stored, not added, to rp. We also avoid a loop for zeroing this
- way. */
-
- rp[un] = mpn_mul_1 (rp, up, un, vp[0]);
- rp += 1, vp += 1, vn -= 1;
-
- /* Now accumulate the product of up[] and the next higher limb from
- vp[]. */
-
- while (vn >= 1)
- {
- rp[un] = mpn_addmul_1 (rp, up, un, vp[0]);
- rp += 1, vp += 1, vn -= 1;
- }
- return rp[un - 1];
-}
-
-void
-mpn_mul_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
-{
- mpn_mul (rp, ap, n, bp, n);
-}
-
-void
-mpn_sqr (mp_ptr rp, mp_srcptr ap, mp_size_t n)
-{
- mpn_mul (rp, ap, n, ap, n);
-}
-
-mp_limb_t
-mpn_lshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
-{
- mp_limb_t high_limb, low_limb;
- unsigned int tnc;
- mp_size_t i;
- mp_limb_t retval;
-
- assert (n >= 1);
- assert (cnt >= 1);
- assert (cnt < GMP_LIMB_BITS);
-
- up += n;
- rp += n;
-
- tnc = GMP_LIMB_BITS - cnt;
- low_limb = *--up;
- retval = low_limb >> tnc;
- high_limb = (low_limb << cnt);
-
- for (i = n; --i != 0;)
- {
- low_limb = *--up;
- *--rp = high_limb | (low_limb >> tnc);
- high_limb = (low_limb << cnt);
- }
- *--rp = high_limb;
-
- return retval;
-}
-
-mp_limb_t
-mpn_rshift (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
-{
- mp_limb_t high_limb, low_limb;
- unsigned int tnc;
- mp_size_t i;
- mp_limb_t retval;
-
- assert (n >= 1);
- assert (cnt >= 1);
- assert (cnt < GMP_LIMB_BITS);
-
- tnc = GMP_LIMB_BITS - cnt;
- high_limb = *up++;
- retval = (high_limb << tnc);
- low_limb = high_limb >> cnt;
-
- for (i = n; --i != 0;)
- {
- high_limb = *up++;
- *rp++ = low_limb | (high_limb << tnc);
- low_limb = high_limb >> cnt;
- }
- *rp = low_limb;
-
- 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);
-}
-
-
-/* MPN division interface. */
-mp_limb_t
-mpn_invert_3by2 (mp_limb_t u1, mp_limb_t u0)
-{
- mp_limb_t r, p, m;
- unsigned ul, uh;
- unsigned ql, qh;
-
- /* First, do a 2/1 inverse. */
- /* The inverse m is defined as floor( (B^2 - 1 - u1)/u1 ), so that 0 <
- * B^2 - (B + m) u1 <= u1 */
- assert (u1 >= GMP_LIMB_HIGHBIT);
-
- ul = u1 & GMP_LLIMB_MASK;
- uh = u1 >> (GMP_LIMB_BITS / 2);
-
- qh = ~u1 / uh;
- r = ((~u1 - (mp_limb_t) qh * uh) << (GMP_LIMB_BITS / 2)) | GMP_LLIMB_MASK;
-
- p = (mp_limb_t) qh * ul;
- /* Adjustment steps taken from udiv_qrnnd_c */
- if (r < p)
- {
- qh--;
- r += u1;
- if (r >= u1) /* i.e. we didn't get carry when adding to r */
- if (r < p)
- {
- qh--;
- r += u1;
- }
- }
- r -= p;
-
- /* Do a 3/2 division (with half limb size) */
- p = (r >> (GMP_LIMB_BITS / 2)) * qh + r;
- ql = (p >> (GMP_LIMB_BITS / 2)) + 1;
-
- /* By the 3/2 method, we don't need the high half limb. */
- r = (r << (GMP_LIMB_BITS / 2)) + GMP_LLIMB_MASK - ql * u1;
-
- if (r >= (p << (GMP_LIMB_BITS / 2)))
- {
- ql--;
- r += u1;
- }
- m = ((mp_limb_t) qh << (GMP_LIMB_BITS / 2)) + ql;
- if (r >= u1)
- {
- m++;
- r -= u1;
- }
-
- if (u0 > 0)
- {
- mp_limb_t th, tl;
- r = ~r;
- r += u0;
- if (r < u0)
- {
- m--;
- if (r >= u1)
- {
- m--;
- r -= u1;
- }
- r -= u1;
- }
- gmp_umul_ppmm (th, tl, u0, m);
- r += th;
- if (r < th)
- {
- m--;
- m -= ((r > u1) | ((r == u1) & (tl > u0)));
- }
- }
-
- return m;
-}
-
-struct gmp_div_inverse
-{
- /* Normalization shift count. */
- unsigned shift;
- /* Normalized divisor (d0 unused for mpn_div_qr_1) */
- mp_limb_t d1, d0;
- /* Inverse, for 2/1 or 3/2. */
- mp_limb_t di;
-};
-
-static void
-mpn_div_qr_1_invert (struct gmp_div_inverse *inv, mp_limb_t d)
-{
- unsigned shift;
-
- assert (d > 0);
- gmp_clz (shift, d);
- inv->shift = shift;
- inv->d1 = d << shift;
- inv->di = mpn_invert_limb (inv->d1);
-}
-
-static void
-mpn_div_qr_2_invert (struct gmp_div_inverse *inv,
- mp_limb_t d1, mp_limb_t d0)
-{
- unsigned shift;
-
- assert (d1 > 0);
- gmp_clz (shift, d1);
- inv->shift = shift;
- if (shift > 0)
- {
- d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
- d0 <<= shift;
- }
- inv->d1 = d1;
- inv->d0 = d0;
- inv->di = mpn_invert_3by2 (d1, d0);
-}
-
-static void
-mpn_div_qr_invert (struct gmp_div_inverse *inv,
- mp_srcptr dp, mp_size_t dn)
-{
- assert (dn > 0);
-
- if (dn == 1)
- mpn_div_qr_1_invert (inv, dp[0]);
- else if (dn == 2)
- mpn_div_qr_2_invert (inv, dp[1], dp[0]);
- else
- {
- unsigned shift;
- mp_limb_t d1, d0;
-
- d1 = dp[dn-1];
- d0 = dp[dn-2];
- assert (d1 > 0);
- gmp_clz (shift, d1);
- inv->shift = shift;
- if (shift > 0)
- {
- d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
- d0 = (d0 << shift) | (dp[dn-3] >> (GMP_LIMB_BITS - shift));
- }
- inv->d1 = d1;
- inv->d0 = d0;
- inv->di = mpn_invert_3by2 (d1, d0);
- }
-}
-
-/* Not matching current public gmp interface, rather corresponding to
- the sbpi1_div_* functions. */
-static mp_limb_t
-mpn_div_qr_1_preinv (mp_ptr qp, mp_srcptr np, mp_size_t nn,
- const struct gmp_div_inverse *inv)
-{
- mp_limb_t d, di;
- mp_limb_t r;
- mp_ptr tp = NULL;
-
- if (inv->shift > 0)
- {
- tp = gmp_xalloc_limbs (nn);
- r = mpn_lshift (tp, np, nn, inv->shift);
- np = tp;
- }
- else
- r = 0;
-
- d = inv->d1;
- di = inv->di;
- while (nn-- > 0)
- {
- mp_limb_t q;
-
- gmp_udiv_qrnnd_preinv (q, r, r, np[nn], d, di);
- if (qp)
- qp[nn] = q;
- }
- if (inv->shift > 0)
- gmp_free (tp);
-
- return r >> inv->shift;
-}
-
-static mp_limb_t
-mpn_div_qr_1 (mp_ptr qp, mp_srcptr np, mp_size_t nn, mp_limb_t d)
-{
- assert (d > 0);
-
- /* Special case for powers of two. */
- if ((d & (d-1)) == 0)
- {
- mp_limb_t r = np[0] & (d-1);
- if (qp)
- {
- if (d <= 1)
- mpn_copyi (qp, np, nn);
- else
- {
- unsigned shift;
- gmp_ctz (shift, d);
- mpn_rshift (qp, np, nn, shift);
- }
- }
- return r;
- }
- else
- {
- struct gmp_div_inverse inv;
- mpn_div_qr_1_invert (&inv, d);
- return mpn_div_qr_1_preinv (qp, np, nn, &inv);
- }
-}
-
-static void
-mpn_div_qr_2_preinv (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
- const struct gmp_div_inverse *inv)
-{
- unsigned shift;
- mp_size_t i;
- mp_limb_t d1, d0, di, r1, r0;
- mp_ptr tp;
-
- assert (nn >= 2);
- shift = inv->shift;
- d1 = inv->d1;
- d0 = inv->d0;
- di = inv->di;
-
- if (shift > 0)
- {
- tp = gmp_xalloc_limbs (nn);
- r1 = mpn_lshift (tp, np, nn, shift);
- np = tp;
- }
- else
- r1 = 0;
-
- r0 = np[nn - 1];
-
- i = nn - 2;
- do
- {
- mp_limb_t n0, q;
- n0 = np[i];
- gmp_udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di);
-
- if (qp)
- qp[i] = q;
- }
- while (--i >= 0);
-
- if (shift > 0)
- {
- assert ((r0 << (GMP_LIMB_BITS - shift)) == 0);
- r0 = (r0 >> shift) | (r1 << (GMP_LIMB_BITS - shift));
- r1 >>= shift;
-
- gmp_free (tp);
- }
-
- rp[1] = r1;
- rp[0] = r0;
-}
-
-#if 0
-static void
-mpn_div_qr_2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0)
-{
- struct gmp_div_inverse inv;
- assert (nn >= 2);
-
- mpn_div_qr_2_invert (&inv, d1, d0);
- mpn_div_qr_2_preinv (qp, rp, np, nn, &inv);
-}
-#endif
-
-static void
-mpn_div_qr_pi1 (mp_ptr qp,
- mp_ptr np, mp_size_t nn, mp_limb_t n1,
- mp_srcptr dp, mp_size_t dn,
- mp_limb_t dinv)
-{
- mp_size_t i;
-
- mp_limb_t d1, d0;
- mp_limb_t cy, cy1;
- mp_limb_t q;
-
- assert (dn > 2);
- assert (nn >= dn);
-
- d1 = dp[dn - 1];
- d0 = dp[dn - 2];
-
- assert ((d1 & GMP_LIMB_HIGHBIT) != 0);
- /* Iteration variable is the index of the q limb.
- *
- * We divide <n1, np[dn-1+i], np[dn-2+i], np[dn-3+i],..., np[i]>
- * by <d1, d0, dp[dn-3], ..., dp[0] >
- */
-
- i = nn - dn;
- do
- {
- mp_limb_t n0 = np[dn-1+i];
-
- if (n1 == d1 && n0 == d0)
- {
- q = GMP_LIMB_MAX;
- mpn_submul_1 (np+i, dp, dn, q);
- n1 = np[dn-1+i]; /* update n1, last loop's value will now be invalid */
- }
- else
- {
- gmp_udiv_qr_3by2 (q, n1, n0, n1, n0, np[dn-2+i], d1, d0, dinv);
-
- cy = mpn_submul_1 (np + i, dp, dn-2, q);
-
- cy1 = n0 < cy;
- n0 = n0 - cy;
- cy = n1 < cy1;
- n1 = n1 - cy1;
- np[dn-2+i] = n0;
-
- if (cy != 0)
- {
- n1 += d1 + mpn_add_n (np + i, np + i, dp, dn - 1);
- q--;
- }
- }
-
- if (qp)
- qp[i] = q;
- }
- while (--i >= 0);
-
- np[dn - 1] = n1;
-}
-
-static void
-mpn_div_qr_preinv (mp_ptr qp, mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- const struct gmp_div_inverse *inv)
-{
- assert (dn > 0);
- assert (nn >= dn);
-
- if (dn == 1)
- np[0] = mpn_div_qr_1_preinv (qp, np, nn, inv);
- else if (dn == 2)
- mpn_div_qr_2_preinv (qp, np, np, nn, inv);
- else
- {
- mp_limb_t nh;
- unsigned shift;
-
- assert (inv->d1 == dp[dn-1]);
- assert (inv->d0 == dp[dn-2]);
- assert ((inv->d1 & GMP_LIMB_HIGHBIT) != 0);
-
- shift = inv->shift;
- if (shift > 0)
- nh = mpn_lshift (np, np, nn, shift);
- else
- nh = 0;
-
- mpn_div_qr_pi1 (qp, np, nn, nh, dp, dn, inv->di);
-
- if (shift > 0)
- gmp_assert_nocarry (mpn_rshift (np, np, dn, shift));
- }
-}
-
-static void
-mpn_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
-{
- struct gmp_div_inverse inv;
- mp_ptr tp = NULL;
-
- assert (dn > 0);
- assert (nn >= dn);
-
- mpn_div_qr_invert (&inv, dp, dn);
- if (dn > 2 && inv.shift > 0)
- {
- tp = gmp_xalloc_limbs (dn);
- gmp_assert_nocarry (mpn_lshift (tp, dp, dn, inv.shift));
- dp = tp;
- }
- mpn_div_qr_preinv (qp, np, nn, dp, dn, &inv);
- if (tp)
- gmp_free (tp);
-}
-
-
-/* MPN base conversion. */
-static unsigned
-mpn_base_power_of_two_p (unsigned b)
-{
- switch (b)
- {
- case 2: return 1;
- case 4: return 2;
- case 8: return 3;
- case 16: return 4;
- case 32: return 5;
- case 64: return 6;
- case 128: return 7;
- case 256: return 8;
- default: return 0;
- }
-}
-
-struct mpn_base_info
-{
- /* bb is the largest power of the base which fits in one limb, and
- exp is the corresponding exponent. */
- unsigned exp;
- mp_limb_t bb;
-};
-
-static void
-mpn_get_base_info (struct mpn_base_info *info, mp_limb_t b)
-{
- mp_limb_t m;
- mp_limb_t p;
- unsigned exp;
-
- m = GMP_LIMB_MAX / b;
- for (exp = 1, p = b; p <= m; exp++)
- p *= b;
-
- info->exp = exp;
- info->bb = p;
-}
-
-static mp_bitcnt_t
-mpn_limb_size_in_base_2 (mp_limb_t u)
-{
- unsigned shift;
-
- assert (u > 0);
- gmp_clz (shift, u);
- return GMP_LIMB_BITS - shift;
-}
-
-static size_t
-mpn_get_str_bits (unsigned char *sp, unsigned bits, mp_srcptr up, mp_size_t un)
-{
- unsigned char mask;
- size_t sn, j;
- mp_size_t i;
- int shift;
-
- sn = ((un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1])
- + bits - 1) / bits;
-
- mask = (1U << bits) - 1;
-
- for (i = 0, j = sn, shift = 0; j-- > 0;)
- {
- unsigned char digit = up[i] >> shift;
-
- shift += bits;
-
- if (shift >= GMP_LIMB_BITS && ++i < un)
- {
- shift -= GMP_LIMB_BITS;
- digit |= up[i] << (bits - shift);
- }
- sp[j] = digit & mask;
- }
- return sn;
-}
-
-/* We generate digits from the least significant end, and reverse at
- the end. */
-static size_t
-mpn_limb_get_str (unsigned char *sp, mp_limb_t w,
- const struct gmp_div_inverse *binv)
-{
- mp_size_t i;
- for (i = 0; w > 0; i++)
- {
- mp_limb_t h, l, r;
-
- h = w >> (GMP_LIMB_BITS - binv->shift);
- l = w << binv->shift;
-
- gmp_udiv_qrnnd_preinv (w, r, h, l, binv->d1, binv->di);
- assert ( (r << (GMP_LIMB_BITS - binv->shift)) == 0);
- r >>= binv->shift;
-
- sp[i] = r;
- }
- return i;
-}
-
-static size_t
-mpn_get_str_other (unsigned char *sp,
- int base, const struct mpn_base_info *info,
- mp_ptr up, mp_size_t un)
-{
- struct gmp_div_inverse binv;
- size_t sn;
- size_t i;
-
- mpn_div_qr_1_invert (&binv, base);
-
- sn = 0;
-
- if (un > 1)
- {
- struct gmp_div_inverse bbinv;
- mpn_div_qr_1_invert (&bbinv, info->bb);
-
- do
- {
- mp_limb_t w;
- size_t done;
- w = mpn_div_qr_1_preinv (up, up, un, &bbinv);
- un -= (up[un-1] == 0);
- done = mpn_limb_get_str (sp + sn, w, &binv);
-
- for (sn += done; done < info->exp; done++)
- sp[sn++] = 0;
- }
- while (un > 1);
- }
- sn += mpn_limb_get_str (sp + sn, up[0], &binv);
-
- /* Reverse order */
- for (i = 0; 2*i + 1 < sn; i++)
- {
- unsigned char t = sp[i];
- sp[i] = sp[sn - i - 1];
- sp[sn - i - 1] = t;
- }
-
- return sn;
-}
-
-size_t
-mpn_get_str (unsigned char *sp, int base, mp_ptr up, mp_size_t un)
-{
- unsigned bits;
-
- assert (un > 0);
- assert (up[un-1] > 0);
-
- bits = mpn_base_power_of_two_p (base);
- if (bits)
- return mpn_get_str_bits (sp, bits, up, un);
- else
- {
- struct mpn_base_info info;
-
- mpn_get_base_info (&info, base);
- return mpn_get_str_other (sp, base, &info, up, un);
- }
-}
-
-static mp_size_t
-mpn_set_str_bits (mp_ptr rp, const unsigned char *sp, size_t sn,
- unsigned bits)
-{
- mp_size_t rn;
- size_t j;
- unsigned shift;
-
- for (j = sn, rn = 0, shift = 0; j-- > 0; )
- {
- if (shift == 0)
- {
- rp[rn++] = sp[j];
- shift += bits;
- }
- else
- {
- rp[rn-1] |= (mp_limb_t) sp[j] << shift;
- shift += bits;
- if (shift >= GMP_LIMB_BITS)
- {
- shift -= GMP_LIMB_BITS;
- if (shift > 0)
- rp[rn++] = (mp_limb_t) sp[j] >> (bits - shift);
- }
- }
- }
- rn = mpn_normalized_size (rp, rn);
- return rn;
-}
-
-static mp_size_t
-mpn_set_str_other (mp_ptr rp, const unsigned char *sp, size_t sn,
- mp_limb_t b, const struct mpn_base_info *info)
-{
- mp_size_t rn;
- mp_limb_t w;
- unsigned k;
- size_t j;
-
- k = 1 + (sn - 1) % info->exp;
-
- j = 0;
- w = sp[j++];
- for (; --k > 0; )
- w = w * b + sp[j++];
-
- rp[0] = w;
-
- for (rn = (w > 0); j < sn;)
- {
- mp_limb_t cy;
-
- w = sp[j++];
- for (k = 1; k < info->exp; k++)
- w = w * b + sp[j++];
-
- cy = mpn_mul_1 (rp, rp, rn, info->bb);
- cy += mpn_add_1 (rp, rp, rn, w);
- if (cy > 0)
- rp[rn++] = cy;
- }
- assert (j == sn);
-
- return rn;
-}
-
-mp_size_t
-mpn_set_str (mp_ptr rp, const unsigned char *sp, size_t sn, int base)
-{
- unsigned bits;
-
- if (sn == 0)
- return 0;
-
- bits = mpn_base_power_of_two_p (base);
- if (bits)
- return mpn_set_str_bits (rp, sp, sn, bits);
- else
- {
- struct mpn_base_info info;
-
- mpn_get_base_info (&info, base);
- return mpn_set_str_other (rp, sp, sn, base, &info);
- }
-}
-
-
-/* MPZ interface */
-void
-mpz_init (mpz_t r)
-{
- r->_mp_alloc = 1;
- r->_mp_size = 0;
- r->_mp_d = gmp_xalloc_limbs (1);
-}
-
-/* The utility of this function is a bit limited, since many functions
- assigns the result variable using mpz_swap. */
-void
-mpz_init2 (mpz_t r, mp_bitcnt_t bits)
-{
- mp_size_t rn;
-
- bits -= (bits != 0); /* Round down, except if 0 */
- rn = 1 + bits / GMP_LIMB_BITS;
-
- r->_mp_alloc = rn;
- r->_mp_size = 0;
- r->_mp_d = gmp_xalloc_limbs (rn);
-}
-
-void
-mpz_clear (mpz_t r)
-{
- gmp_free (r->_mp_d);
-}
-
-static void *
-mpz_realloc (mpz_t r, mp_size_t size)
-{
- size = GMP_MAX (size, 1);
-
- r->_mp_d = gmp_xrealloc_limbs (r->_mp_d, size);
- r->_mp_alloc = size;
-
- if (GMP_ABS (r->_mp_size) > size)
- r->_mp_size = 0;
-
- return r->_mp_d;
-}
-
-/* Realloc for an mpz_t WHAT if it has less than NEEDED limbs. */
-#define MPZ_REALLOC(z,n) ((n) > (z)->_mp_alloc \
- ? mpz_realloc(z,n) \
- : (z)->_mp_d)
-
-/* MPZ assignment and basic conversions. */
-void
-mpz_set_si (mpz_t r, signed long int x)
-{
- if (x >= 0)
- mpz_set_ui (r, x);
- else /* (x < 0) */
- {
- r->_mp_size = -1;
- r->_mp_d[0] = GMP_NEG_CAST (unsigned long int, x);
- }
-}
-
-void
-mpz_set_ui (mpz_t r, unsigned long int x)
-{
- if (x > 0)
- {
- r->_mp_size = 1;
- r->_mp_d[0] = x;
- }
- else
- r->_mp_size = 0;
-}
-
-void
-mpz_set (mpz_t r, const mpz_t x)
-{
- /* Allow the NOP r == x */
- if (r != x)
- {
- mp_size_t n;
- mp_ptr rp;
-
- n = GMP_ABS (x->_mp_size);
- rp = MPZ_REALLOC (r, n);
-
- mpn_copyi (rp, x->_mp_d, n);
- r->_mp_size = x->_mp_size;
- }
-}
-
-void
-mpz_init_set_si (mpz_t r, signed long int x)
-{
- mpz_init (r);
- mpz_set_si (r, x);
-}
-
-void
-mpz_init_set_ui (mpz_t r, unsigned long int x)
-{
- mpz_init (r);
- mpz_set_ui (r, x);
-}
-
-void
-mpz_init_set (mpz_t r, const mpz_t x)
-{
- mpz_init (r);
- mpz_set (r, x);
-}
-
-int
-mpz_fits_slong_p (const mpz_t u)
-{
- mp_size_t us = u->_mp_size;
-
- if (us == 0)
- return 1;
- else if (us == 1)
- return u->_mp_d[0] < GMP_LIMB_HIGHBIT;
- else if (us == -1)
- return u->_mp_d[0] <= GMP_LIMB_HIGHBIT;
- else
- return 0;
-}
-
-int
-mpz_fits_ulong_p (const mpz_t u)
-{
- mp_size_t us = u->_mp_size;
-
- return (us == (us > 0));
-}
-
-long int
-mpz_get_si (const mpz_t u)
-{
- mp_size_t us = u->_mp_size;
-
- if (us > 0)
- return (long) (u->_mp_d[0] & ~GMP_LIMB_HIGHBIT);
- else if (us < 0)
- return (long) (- u->_mp_d[0] | GMP_LIMB_HIGHBIT);
- else
- return 0;
-}
-
-unsigned long int
-mpz_get_ui (const mpz_t u)
-{
- return u->_mp_size == 0 ? 0 : u->_mp_d[0];
-}
-
-size_t
-mpz_size (const mpz_t u)
-{
- return GMP_ABS (u->_mp_size);
-}
-
-mp_limb_t
-mpz_getlimbn (const mpz_t u, mp_size_t n)
-{
- if (n >= 0 && n < GMP_ABS (u->_mp_size))
- return u->_mp_d[n];
- else
- 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;
-}
-
-
-/* Conversions and comparison to double. */
-void
-mpz_set_d (mpz_t r, double x)
-{
- int sign;
- mp_ptr rp;
- mp_size_t rn, i;
- double B;
- double Bi;
- mp_limb_t f;
-
- /* x != x is true when x is a NaN, and x == x * 0.5 is true when x is
- zero or infinity. */
- if (x != x || x == x * 0.5)
- {
- r->_mp_size = 0;
- return;
- }
-
- sign = x < 0.0 ;
- if (sign)
- x = - x;
-
- if (x < 1.0)
- {
- r->_mp_size = 0;
- return;
- }
- B = 2.0 * (double) GMP_LIMB_HIGHBIT;
- Bi = 1.0 / B;
- for (rn = 1; x >= B; rn++)
- x *= Bi;
-
- rp = MPZ_REALLOC (r, rn);
-
- f = (mp_limb_t) x;
- x -= f;
- assert (x < 1.0);
- i = rn-1;
- rp[i] = f;
- while (--i >= 0)
- {
- x = B * x;
- f = (mp_limb_t) x;
- x -= f;
- assert (x < 1.0);
- rp[i] = f;
- }
-
- r->_mp_size = sign ? - rn : rn;
-}
-
-void
-mpz_init_set_d (mpz_t r, double x)
-{
- mpz_init (r);
- mpz_set_d (r, x);
-}
-
-double
-mpz_get_d (const mpz_t u)
-{
- mp_size_t un;
- double x;
- double B = 2.0 * (double) GMP_LIMB_HIGHBIT;
-
- un = GMP_ABS (u->_mp_size);
-
- if (un == 0)
- return 0.0;
-
- x = u->_mp_d[--un];
- while (un > 0)
- x = B*x + u->_mp_d[--un];
-
- if (u->_mp_size < 0)
- x = -x;
-
- return x;
-}
-
-int
-mpz_cmpabs_d (const mpz_t x, double d)
-{
- mp_size_t xn;
- double B, Bi;
- mp_size_t i;
-
- xn = x->_mp_size;
- d = GMP_ABS (d);
-
- if (xn != 0)
- {
- xn = GMP_ABS (xn);
-
- B = 2.0 * (double) GMP_LIMB_HIGHBIT;
- Bi = 1.0 / B;
-
- /* Scale d so it can be compared with the top limb. */
- for (i = 1; i < xn; i++)
- d *= Bi;
-
- if (d >= B)
- return -1;
-
- /* Compare floor(d) to top limb, subtract and cancel when equal. */
- for (i = xn; i-- > 0;)
- {
- mp_limb_t f, xl;
-
- f = (mp_limb_t) d;
- xl = x->_mp_d[i];
- if (xl > f)
- return 1;
- else if (xl < f)
- return -1;
- d = B * (d - f);
- }
- }
- return - (d > 0.0);
-}
-
-int
-mpz_cmp_d (const mpz_t x, double d)
-{
- if (x->_mp_size < 0)
- {
- if (d >= 0.0)
- return -1;
- else
- return -mpz_cmpabs_d (x, d);
- }
- else
- {
- if (d < 0.0)
- return 1;
- else
- return mpz_cmpabs_d (x, d);
- }
-}
-
-
-/* MPZ comparisons and the like. */
-int
-mpz_sgn (const mpz_t u)
-{
- mp_size_t usize = u->_mp_size;
-
- return (usize > 0) - (usize < 0);
-}
-
-int
-mpz_cmp_si (const mpz_t u, long v)
-{
- mp_size_t usize = u->_mp_size;
-
- if (usize < -1)
- return -1;
- else if (v >= 0)
- return mpz_cmp_ui (u, v);
- else if (usize >= 0)
- return 1;
- else /* usize == -1 */
- {
- mp_limb_t ul = u->_mp_d[0];
- 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;
- }
-}
-
-int
-mpz_cmp_ui (const mpz_t u, unsigned long v)
-{
- mp_size_t usize = u->_mp_size;
-
- if (usize > 1)
- return 1;
- else if (usize < 0)
- return -1;
- else
- {
- mp_limb_t ul = (usize > 0) ? u->_mp_d[0] : 0;
- return (ul > v) - (ul < v);
- }
-}
-
-int
-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 (asize < bsize) ? -1 : 1;
- else if (asize >= 0)
- return mpn_cmp (a->_mp_d, b->_mp_d, asize);
- else
- return mpn_cmp (b->_mp_d, a->_mp_d, -asize);
-}
-
-int
-mpz_cmpabs_ui (const mpz_t u, unsigned long v)
-{
- mp_size_t un = GMP_ABS (u->_mp_size);
- mp_limb_t ul;
-
- if (un > 1)
- return 1;
-
- ul = (un == 1) ? u->_mp_d[0] : 0;
-
- return (ul > v) - (ul < v);
-}
-
-int
-mpz_cmpabs (const mpz_t u, const mpz_t v)
-{
- return mpn_cmp4 (u->_mp_d, GMP_ABS (u->_mp_size),
- v->_mp_d, GMP_ABS (v->_mp_size));
-}
-
-void
-mpz_abs (mpz_t r, const mpz_t u)
-{
- if (r != u)
- mpz_set (r, u);
-
- r->_mp_size = GMP_ABS (r->_mp_size);
-}
-
-void
-mpz_neg (mpz_t r, const mpz_t u)
-{
- if (r != u)
- mpz_set (r, u);
-
- r->_mp_size = -r->_mp_size;
-}
-
-void
-mpz_swap (mpz_t u, mpz_t v)
-{
- MP_SIZE_T_SWAP (u->_mp_size, v->_mp_size);
- MP_SIZE_T_SWAP (u->_mp_alloc, v->_mp_alloc);
- MP_PTR_SWAP (u->_mp_d, v->_mp_d);
-}
-
-
-/* MPZ addition and subtraction */
-
-/* Adds to the absolute value. Returns new size, but doesn't store it. */
-static mp_size_t
-mpz_abs_add_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
- mp_size_t an;
- mp_ptr rp;
- mp_limb_t cy;
-
- an = GMP_ABS (a->_mp_size);
- if (an == 0)
- {
- r->_mp_d[0] = b;
- return b > 0;
- }
-
- rp = MPZ_REALLOC (r, an + 1);
-
- cy = mpn_add_1 (rp, a->_mp_d, an, b);
- rp[an] = cy;
- an += cy;
-
- return an;
-}
-
-/* Subtract from the absolute value. Returns new size, (or -1 on underflow),
- but doesn't store it. */
-static mp_size_t
-mpz_abs_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
- mp_size_t an = GMP_ABS (a->_mp_size);
- mp_ptr rp = MPZ_REALLOC (r, an);
-
- if (an == 0)
- {
- rp[0] = b;
- return -(b > 0);
- }
- else if (an == 1 && a->_mp_d[0] < b)
- {
- rp[0] = b - a->_mp_d[0];
- return -1;
- }
- else
- {
- gmp_assert_nocarry (mpn_sub_1 (rp, a->_mp_d, an, b));
- return mpn_normalized_size (rp, an);
- }
-}
-
-void
-mpz_add_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
- if (a->_mp_size >= 0)
- r->_mp_size = mpz_abs_add_ui (r, a, b);
- else
- r->_mp_size = -mpz_abs_sub_ui (r, a, b);
-}
-
-void
-mpz_sub_ui (mpz_t r, const mpz_t a, unsigned long b)
-{
- if (a->_mp_size < 0)
- r->_mp_size = -mpz_abs_add_ui (r, a, b);
- else
- r->_mp_size = mpz_abs_sub_ui (r, a, b);
-}
-
-void
-mpz_ui_sub (mpz_t r, unsigned long a, const mpz_t b)
-{
- if (b->_mp_size < 0)
- r->_mp_size = mpz_abs_add_ui (r, b, a);
- else
- r->_mp_size = -mpz_abs_sub_ui (r, b, a);
-}
-
-static mp_size_t
-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_ptr rp;
- mp_limb_t cy;
-
- 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[an] = cy;
-
- return an + cy;
-}
-
-static mp_size_t
-mpz_abs_sub (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);
- int cmp;
- mp_ptr rp;
-
- cmp = mpn_cmp4 (a->_mp_d, an, b->_mp_d, bn);
- if (cmp > 0)
- {
- rp = MPZ_REALLOC (r, an);
- gmp_assert_nocarry (mpn_sub (rp, a->_mp_d, an, b->_mp_d, bn));
- return mpn_normalized_size (rp, an);
- }
- else if (cmp < 0)
- {
- rp = MPZ_REALLOC (r, bn);
- gmp_assert_nocarry (mpn_sub (rp, b->_mp_d, bn, a->_mp_d, an));
- return -mpn_normalized_size (rp, bn);
- }
- else
- return 0;
-}
-
-void
-mpz_add (mpz_t r, const mpz_t a, const mpz_t b)
-{
- mp_size_t rn;
-
- if ( (a->_mp_size ^ b->_mp_size) >= 0)
- rn = mpz_abs_add (r, a, b);
- else
- rn = mpz_abs_sub (r, a, b);
-
- r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
-}
-
-void
-mpz_sub (mpz_t r, const mpz_t a, const mpz_t b)
-{
- mp_size_t rn;
-
- if ( (a->_mp_size ^ b->_mp_size) >= 0)
- rn = mpz_abs_sub (r, a, b);
- else
- rn = mpz_abs_add (r, a, b);
-
- r->_mp_size = a->_mp_size >= 0 ? rn : - rn;
-}
-
-
-/* MPZ multiplication */
-void
-mpz_mul_si (mpz_t r, const mpz_t u, long int v)
-{
- if (v < 0)
- {
- mpz_mul_ui (r, u, GMP_NEG_CAST (unsigned long int, v));
- mpz_neg (r, r);
- }
- else
- mpz_mul_ui (r, u, (unsigned long int) v);
-}
-
-void
-mpz_mul_ui (mpz_t r, const mpz_t u, unsigned long int v)
-{
- mp_size_t un, us;
- mp_ptr tp;
- mp_limb_t cy;
-
- us = u->_mp_size;
-
- if (us == 0 || v == 0)
- {
- r->_mp_size = 0;
- return;
- }
-
- un = GMP_ABS (us);
-
- tp = MPZ_REALLOC (r, un + 1);
- cy = mpn_mul_1 (tp, u->_mp_d, un, v);
- tp[un] = cy;
-
- un += (cy > 0);
- r->_mp_size = (us < 0) ? - un : un;
-}
-
-void
-mpz_mul (mpz_t r, const mpz_t u, const mpz_t v)
-{
- int sign;
- mp_size_t un, vn, rn;
- mpz_t t;
- mp_ptr tp;
-
- un = u->_mp_size;
- vn = v->_mp_size;
-
- if (un == 0 || vn == 0)
- {
- r->_mp_size = 0;
- return;
- }
-
- sign = (un ^ vn) < 0;
-
- un = GMP_ABS (un);
- vn = GMP_ABS (vn);
-
- mpz_init2 (t, (un + vn) * GMP_LIMB_BITS);
-
- tp = t->_mp_d;
- if (un >= vn)
- mpn_mul (tp, u->_mp_d, un, v->_mp_d, vn);
- else
- mpn_mul (tp, v->_mp_d, vn, u->_mp_d, un);
-
- rn = un + vn;
- rn -= tp[rn-1] == 0;
-
- t->_mp_size = sign ? - rn : rn;
- mpz_swap (r, t);
- mpz_clear (t);
-}
-
-void
-mpz_mul_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bits)
-{
- mp_size_t un, rn;
- mp_size_t limbs;
- unsigned shift;
- mp_ptr rp;
-
- un = GMP_ABS (u->_mp_size);
- if (un == 0)
- {
- r->_mp_size = 0;
- return;
- }
-
- limbs = bits / GMP_LIMB_BITS;
- shift = bits % GMP_LIMB_BITS;
-
- rn = un + limbs + (shift > 0);
- rp = MPZ_REALLOC (r, rn);
- if (shift > 0)
- {
- mp_limb_t cy = mpn_lshift (rp + limbs, u->_mp_d, un, shift);
- rp[rn-1] = cy;
- rn -= (cy == 0);
- }
- else
- mpn_copyd (rp + limbs, u->_mp_d, un);
-
- while (limbs > 0)
- rp[--limbs] = 0;
-
- 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);
-}
-
-
-/* MPZ division */
-enum mpz_div_round_mode { GMP_DIV_FLOOR, GMP_DIV_CEIL, GMP_DIV_TRUNC };
-
-/* Allows q or r to be zero. Returns 1 iff remainder is non-zero. */
-static int
-mpz_div_qr (mpz_t q, mpz_t r,
- const mpz_t n, const mpz_t d, enum mpz_div_round_mode mode)
-{
- mp_size_t ns, ds, nn, dn, qs;
- ns = n->_mp_size;
- ds = d->_mp_size;
-
- if (ds == 0)
- gmp_die("mpz_div_qr: Divide by zero.");
-
- if (ns == 0)
- {
- if (q)
- q->_mp_size = 0;
- if (r)
- r->_mp_size = 0;
- return 0;
- }
-
- nn = GMP_ABS (ns);
- dn = GMP_ABS (ds);
-
- qs = ds ^ ns;
-
- if (nn < dn)
- {
- if (mode == GMP_DIV_CEIL && qs >= 0)
- {
- /* q = 1, r = n - d */
- if (r)
- mpz_sub (r, n, d);
- if (q)
- mpz_set_ui (q, 1);
- }
- else if (mode == GMP_DIV_FLOOR && qs < 0)
- {
- /* q = -1, r = n + d */
- if (r)
- mpz_add (r, n, d);
- if (q)
- mpz_set_si (q, -1);
- }
- else
- {
- /* q = 0, r = d */
- if (r)
- mpz_set (r, n);
- if (q)
- q->_mp_size = 0;
- }
- return 1;
- }
- else
- {
- mp_ptr np, qp;
- mp_size_t qn, rn;
- mpz_t tq, tr;
-
- mpz_init_set (tr, n);
- np = tr->_mp_d;
-
- qn = nn - dn + 1;
-
- if (q)
- {
- mpz_init2 (tq, qn * GMP_LIMB_BITS);
- qp = tq->_mp_d;
- }
- else
- qp = NULL;
-
- mpn_div_qr (qp, np, nn, d->_mp_d, dn);
-
- if (qp)
- {
- qn -= (qp[qn-1] == 0);
-
- tq->_mp_size = qs < 0 ? -qn : qn;
- }
- rn = mpn_normalized_size (np, dn);
- tr->_mp_size = ns < 0 ? - rn : rn;
-
- if (mode == GMP_DIV_FLOOR && qs < 0 && rn != 0)
- {
- if (q)
- mpz_sub_ui (tq, tq, 1);
- if (r)
- mpz_add (tr, tr, d);
- }
- else if (mode == GMP_DIV_CEIL && qs >= 0 && rn != 0)
- {
- if (q)
- mpz_add_ui (tq, tq, 1);
- if (r)
- mpz_sub (tr, tr, d);
- }
-
- if (q)
- {
- mpz_swap (tq, q);
- mpz_clear (tq);
- }
- if (r)
- mpz_swap (tr, r);
-
- mpz_clear (tr);
-
- return rn != 0;
- }
-}
-
-void
-mpz_cdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (q, r, n, d, GMP_DIV_CEIL);
-}
-
-void
-mpz_fdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (q, r, n, d, GMP_DIV_FLOOR);
-}
-
-void
-mpz_tdiv_qr (mpz_t q, mpz_t r, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (q, r, n, d, GMP_DIV_TRUNC);
-}
-
-void
-mpz_cdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (q, NULL, n, d, GMP_DIV_CEIL);
-}
-
-void
-mpz_fdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (q, NULL, n, d, GMP_DIV_FLOOR);
-}
-
-void
-mpz_tdiv_q (mpz_t q, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC);
-}
-
-void
-mpz_cdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (NULL, r, n, d, GMP_DIV_CEIL);
-}
-
-void
-mpz_fdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (NULL, r, n, d, GMP_DIV_FLOOR);
-}
-
-void
-mpz_tdiv_r (mpz_t r, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (NULL, r, n, d, GMP_DIV_TRUNC);
-}
-
-void
-mpz_mod (mpz_t r, const mpz_t n, const mpz_t d)
-{
- mpz_div_qr (NULL, r, n, d, d->_mp_size >= 0 ? GMP_DIV_FLOOR : GMP_DIV_CEIL);
-}
-
-static void
-mpz_div_q_2exp (mpz_t q, const mpz_t u, mp_bitcnt_t bit_index,
- enum mpz_div_round_mode mode)
-{
- mp_size_t un, qn;
- mp_size_t limb_cnt;
- mp_ptr qp;
- int adjust;
-
- un = u->_mp_size;
- if (un == 0)
- {
- q->_mp_size = 0;
- return;
- }
- limb_cnt = bit_index / GMP_LIMB_BITS;
- qn = GMP_ABS (un) - limb_cnt;
- bit_index %= GMP_LIMB_BITS;
-
- if (mode == ((un > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* un != 0 here. */
- /* Note: Below, the final indexing at limb_cnt is valid because at
- that point we have qn > 0. */
- adjust = (qn <= 0
- || !mpn_zero_p (u->_mp_d, limb_cnt)
- || (u->_mp_d[limb_cnt]
- & (((mp_limb_t) 1 << bit_index) - 1)));
- else
- adjust = 0;
-
- if (qn <= 0)
- qn = 0;
-
- else
- {
- qp = MPZ_REALLOC (q, qn);
-
- if (bit_index != 0)
- {
- mpn_rshift (qp, u->_mp_d + limb_cnt, qn, bit_index);
- qn -= qp[qn - 1] == 0;
- }
- else
- {
- mpn_copyi (qp, u->_mp_d + limb_cnt, qn);
- }
- }
-
- q->_mp_size = qn;
-
- if (adjust)
- mpz_add_ui (q, q, 1);
- if (un < 0)
- mpz_neg (q, q);
-}
-
-static void
-mpz_div_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t bit_index,
- enum mpz_div_round_mode mode)
-{
- mp_size_t us, un, rn;
- mp_ptr rp;
- mp_limb_t mask;
-
- us = u->_mp_size;
- if (us == 0 || bit_index == 0)
- {
- r->_mp_size = 0;
- return;
- }
- rn = (bit_index + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
- assert (rn > 0);
-
- rp = MPZ_REALLOC (r, rn);
- un = GMP_ABS (us);
-
- mask = GMP_LIMB_MAX >> (rn * GMP_LIMB_BITS - bit_index);
-
- if (rn > un)
- {
- /* Quotient (with truncation) is zero, and remainder is
- non-zero */
- if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
- {
- /* Have to negate and sign extend. */
- mp_size_t i;
- mp_limb_t cy;
-
- for (cy = 1, i = 0; i < un; i++)
- {
- mp_limb_t s = ~u->_mp_d[i] + cy;
- cy = s < cy;
- rp[i] = s;
- }
- assert (cy == 0);
- for (; i < rn - 1; i++)
- rp[i] = GMP_LIMB_MAX;
-
- rp[rn-1] = mask;
- us = -us;
- }
- else
- {
- /* Just copy */
- if (r != u)
- mpn_copyi (rp, u->_mp_d, un);
-
- rn = un;
- }
- }
- else
- {
- if (r != u)
- mpn_copyi (rp, u->_mp_d, rn - 1);
-
- rp[rn-1] = u->_mp_d[rn-1] & mask;
-
- if (mode == ((us > 0) ? GMP_DIV_CEIL : GMP_DIV_FLOOR)) /* us != 0 here. */
- {
- /* If r != 0, compute 2^{bit_count} - r. */
- mp_size_t i;
-
- for (i = 0; i < rn && rp[i] == 0; i++)
- ;
- if (i < rn)
- {
- /* r > 0, need to flip sign. */
- rp[i] = ~rp[i] + 1;
- while (++i < rn)
- rp[i] = ~rp[i];
-
- rp[rn-1] &= mask;
-
- /* us is not used for anything else, so we can modify it
- here to indicate flipped sign. */
- us = -us;
- }
- }
- }
- rn = mpn_normalized_size (rp, rn);
- r->_mp_size = us < 0 ? -rn : rn;
-}
-
-void
-mpz_cdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
-{
- mpz_div_q_2exp (r, u, cnt, GMP_DIV_CEIL);
-}
-
-void
-mpz_fdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
-{
- mpz_div_q_2exp (r, u, cnt, GMP_DIV_FLOOR);
-}
-
-void
-mpz_tdiv_q_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
-{
- mpz_div_q_2exp (r, u, cnt, GMP_DIV_TRUNC);
-}
-
-void
-mpz_cdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
-{
- mpz_div_r_2exp (r, u, cnt, GMP_DIV_CEIL);
-}
-
-void
-mpz_fdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
-{
- mpz_div_r_2exp (r, u, cnt, GMP_DIV_FLOOR);
-}
-
-void
-mpz_tdiv_r_2exp (mpz_t r, const mpz_t u, mp_bitcnt_t cnt)
-{
- mpz_div_r_2exp (r, u, cnt, GMP_DIV_TRUNC);
-}
-
-void
-mpz_divexact (mpz_t q, const mpz_t n, const mpz_t d)
-{
- gmp_assert_nocarry (mpz_div_qr (q, NULL, n, d, GMP_DIV_TRUNC));
-}
-
-int
-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)
-{
- mp_size_t ns, qn;
- mp_ptr qp;
- mp_limb_t rl;
- mp_size_t rs;
-
- ns = n->_mp_size;
- if (ns == 0)
- {
- if (q)
- q->_mp_size = 0;
- if (r)
- r->_mp_size = 0;
- return 0;
- }
-
- qn = GMP_ABS (ns);
- if (q)
- qp = MPZ_REALLOC (q, qn);
- else
- qp = NULL;
-
- rl = mpn_div_qr_1 (qp, n->_mp_d, qn, d);
- assert (rl < d);
-
- rs = rl > 0;
- rs = (ns < 0) ? -rs : rs;
-
- if (rl > 0 && ( (mode == GMP_DIV_FLOOR && ns < 0)
- || (mode == GMP_DIV_CEIL && ns >= 0)))
- {
- if (q)
- gmp_assert_nocarry (mpn_add_1 (qp, qp, qn, 1));
- rl = d - rl;
- rs = -rs;
- }
-
- if (r)
- {
- r->_mp_d[0] = rl;
- r->_mp_size = rs;
- }
- if (q)
- {
- qn -= (qp[qn-1] == 0);
- assert (qn == 0 || qp[qn-1] > 0);
-
- q->_mp_size = (ns < 0) ? - qn : qn;
- }
-
- return rl;
-}
-
-unsigned long
-mpz_cdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (q, r, n, d, GMP_DIV_CEIL);
-}
-
-unsigned long
-mpz_fdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (q, r, n, d, GMP_DIV_FLOOR);
-}
-
-unsigned long
-mpz_tdiv_qr_ui (mpz_t q, mpz_t r, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (q, r, n, d, GMP_DIV_TRUNC);
-}
-
-unsigned long
-mpz_cdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_CEIL);
-}
-
-unsigned long
-mpz_fdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_FLOOR);
-}
-
-unsigned long
-mpz_tdiv_q_ui (mpz_t q, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC);
-}
-
-unsigned long
-mpz_cdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_CEIL);
-}
-unsigned long
-mpz_fdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
-}
-unsigned long
-mpz_tdiv_r_ui (mpz_t r, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_TRUNC);
-}
-
-unsigned long
-mpz_cdiv_ui (const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_CEIL);
-}
-
-unsigned long
-mpz_fdiv_ui (const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_FLOOR);
-}
-
-unsigned long
-mpz_tdiv_ui (const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC);
-}
-
-unsigned long
-mpz_mod_ui (mpz_t r, const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, r, n, d, GMP_DIV_FLOOR);
-}
-
-void
-mpz_divexact_ui (mpz_t q, const mpz_t n, unsigned long d)
-{
- gmp_assert_nocarry (mpz_div_qr_ui (q, NULL, n, d, GMP_DIV_TRUNC));
-}
-
-int
-mpz_divisible_ui_p (const mpz_t n, unsigned long d)
-{
- return mpz_div_qr_ui (NULL, NULL, n, d, GMP_DIV_TRUNC) == 0;
-}
-
-
-/* GCD */
-static mp_limb_t
-mpn_gcd_11 (mp_limb_t u, mp_limb_t v)
-{
- unsigned shift;
-
- assert ( (u | v) > 0);
-
- if (u == 0)
- return v;
- else if (v == 0)
- return u;
-
- gmp_ctz (shift, u | v);
-
- u >>= shift;
- v >>= shift;
-
- if ( (u & 1) == 0)
- MP_LIMB_T_SWAP (u, v);
-
- while ( (v & 1) == 0)
- v >>= 1;
-
- while (u != v)
- {
- if (u > v)
- {
- u -= v;
- do
- u >>= 1;
- while ( (u & 1) == 0);
- }
- else
- {
- v -= u;
- do
- v >>= 1;
- while ( (v & 1) == 0);
- }
- }
- return u << shift;
-}
-
-unsigned long
-mpz_gcd_ui (mpz_t g, const mpz_t u, unsigned long v)
-{
- mp_size_t un;
-
- if (v == 0)
- {
- if (g)
- mpz_abs (g, u);
- }
- else
- {
- un = GMP_ABS (u->_mp_size);
- if (un != 0)
- v = mpn_gcd_11 (mpn_div_qr_1 (NULL, u->_mp_d, un, v), v);
-
- if (g)
- mpz_set_ui (g, v);
- }
-
- return v;
-}
-
-static mp_bitcnt_t
-mpz_make_odd (mpz_t r)
-{
- mp_bitcnt_t shift;
-
- 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);
-
- return shift;
-}
-
-void
-mpz_gcd (mpz_t g, const mpz_t u, const mpz_t v)
-{
- mpz_t tu, tv;
- mp_bitcnt_t uz, vz, gz;
-
- if (u->_mp_size == 0)
- {
- mpz_abs (g, v);
- return;
- }
- if (v->_mp_size == 0)
- {
- mpz_abs (g, u);
- return;
- }
-
- mpz_init (tu);
- mpz_init (tv);
-
- 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)
- mpz_swap (tu, tv);
-
- mpz_tdiv_r (tu, tu, tv);
- if (tu->_mp_size == 0)
- {
- mpz_swap (g, tv);
- }
- else
- for (;;)
- {
- int c;
-
- mpz_make_odd (tu);
- c = mpz_cmp (tu, tv);
- if (c == 0)
- {
- mpz_swap (g, tu);
- break;
- }
- if (c < 0)
- mpz_swap (tu, tv);
-
- if (tv->_mp_size == 1)
- {
- mp_limb_t vl = tv->_mp_d[0];
- mp_limb_t ul = mpz_tdiv_ui (tu, vl);
- mpz_set_ui (g, mpn_gcd_11 (ul, vl));
- break;
- }
- mpz_sub (tu, tu, tv);
- }
- mpz_clear (tu);
- mpz_clear (tv);
- mpz_mul_2exp (g, g, gz);
-}
-
-void
-mpz_gcdext (mpz_t g, mpz_t s, mpz_t t, const mpz_t u, const mpz_t v)
-{
- mpz_t tu, tv, s0, s1, t0, t1;
- mp_bitcnt_t uz, vz, gz;
- mp_bitcnt_t power;
-
- if (u->_mp_size == 0)
- {
- /* g = 0 u + sgn(v) v */
- signed long sign = mpz_sgn (v);
- mpz_abs (g, v);
- if (s)
- mpz_set_ui (s, 0);
- if (t)
- mpz_set_si (t, sign);
- return;
- }
-
- if (v->_mp_size == 0)
- {
- /* g = sgn(u) u + 0 v */
- signed long sign = mpz_sgn (u);
- mpz_abs (g, u);
- if (s)
- mpz_set_si (s, sign);
- if (t)
- mpz_set_ui (t, 0);
- return;
- }
-
- mpz_init (tu);
- mpz_init (tv);
- mpz_init (s0);
- mpz_init (s1);
- mpz_init (t0);
- mpz_init (t1);
-
- 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;
- vz -= gz;
-
- /* Cofactors corresponding to odd gcd. gz handled later. */
- if (tu->_mp_size < tv->_mp_size)
- {
- mpz_swap (tu, tv);
- MPZ_SRCPTR_SWAP (u, v);
- MPZ_PTR_SWAP (s, t);
- MP_BITCNT_T_SWAP (uz, vz);
- }
-
- /* Maintain
- *
- * u = t0 tu + t1 tv
- * v = s0 tu + s1 tv
- *
- * where u and v denote the inputs with common factors of two
- * eliminated, and det (s0, t0; s1, t1) = 2^p. Then
- *
- * 2^p tu = s1 u - t1 v
- * 2^p tv = -s0 u + t0 v
- */
-
- /* After initial division, tu = q tv + tu', we have
- *
- * u = 2^uz (tu' + q tv)
- * v = 2^vz tv
- *
- * or
- *
- * t0 = 2^uz, t1 = 2^uz q
- * s0 = 0, s1 = 2^vz
- */
-
- mpz_setbit (t0, uz);
- mpz_tdiv_qr (t1, tu, tu, tv);
- mpz_mul_2exp (t1, t1, uz);
-
- mpz_setbit (s1, vz);
- power = uz + vz;
-
- if (tu->_mp_size > 0)
- {
- mp_bitcnt_t shift;
- shift = mpz_make_odd (tu);
- mpz_mul_2exp (t0, t0, shift);
- mpz_mul_2exp (s0, s0, shift);
- power += shift;
-
- for (;;)
- {
- int c;
- c = mpz_cmp (tu, tv);
- if (c == 0)
- break;
-
- if (c < 0)
- {
- /* tv = tv' + tu
- *
- * u = t0 tu + t1 (tv' + tu) = (t0 + t1) tu + t1 tv'
- * v = s0 tu + s1 (tv' + tu) = (s0 + s1) tu + s1 tv' */
-
- mpz_sub (tv, tv, tu);
- mpz_add (t0, t0, t1);
- mpz_add (s0, s0, s1);
-
- shift = mpz_make_odd (tv);
- mpz_mul_2exp (t1, t1, shift);
- mpz_mul_2exp (s1, s1, shift);
- }
- else
- {
- mpz_sub (tu, tu, tv);
- mpz_add (t1, t0, t1);
- mpz_add (s1, s0, s1);
-
- shift = mpz_make_odd (tu);
- mpz_mul_2exp (t0, t0, shift);
- mpz_mul_2exp (s0, s0, shift);
- }
- power += shift;
- }
- }
-
- /* Now tv = odd part of gcd, and -s0 and t0 are corresponding
- cofactors. */
-
- mpz_mul_2exp (tv, tv, gz);
- mpz_neg (s0, s0);
-
- /* 2^p g = s0 u + t0 v. Eliminate one factor of two at a time. To
- adjust cofactors, we need u / g and v / g */
-
- mpz_divexact (s1, v, tv);
- mpz_abs (s1, s1);
- mpz_divexact (t1, u, tv);
- mpz_abs (t1, t1);
-
- while (power-- > 0)
- {
- /* s0 u + t0 v = (s0 - v/g) u - (t0 + u/g) v */
- if (mpz_odd_p (s0) || mpz_odd_p (t0))
- {
- mpz_sub (s0, s0, s1);
- mpz_add (t0, t0, t1);
- }
- mpz_divexact_ui (s0, s0, 2);
- mpz_divexact_ui (t0, t0, 2);
- }
-
- /* Arrange so that |s| < |u| / 2g */
- mpz_add (s1, s0, s1);
- if (mpz_cmpabs (s0, s1) > 0)
- {
- mpz_swap (s0, s1);
- mpz_sub (t0, t0, t1);
- }
- if (u->_mp_size < 0)
- mpz_neg (s0, s0);
- if (v->_mp_size < 0)
- mpz_neg (t0, t0);
-
- mpz_swap (g, tv);
- if (s)
- mpz_swap (s, s0);
- if (t)
- mpz_swap (t, t0);
-
- mpz_clear (tu);
- mpz_clear (tv);
- mpz_clear (s0);
- mpz_clear (s1);
- mpz_clear (t0);
- mpz_clear (t1);
-}
-
-void
-mpz_lcm (mpz_t r, const mpz_t u, const mpz_t v)
-{
- mpz_t g;
-
- if (u->_mp_size == 0 || v->_mp_size == 0)
- {
- r->_mp_size = 0;
- return;
- }
-
- mpz_init (g);
-
- mpz_gcd (g, u, v);
- mpz_divexact (g, u, g);
- mpz_mul (r, g, v);
-
- mpz_clear (g);
- mpz_abs (r, r);
-}
-
-void
-mpz_lcm_ui (mpz_t r, const mpz_t u, unsigned long v)
-{
- if (v == 0 || u->_mp_size == 0)
- {
- r->_mp_size = 0;
- return;
- }
-
- v /= mpz_gcd_ui (NULL, u, v);
- mpz_mul_ui (r, u, v);
-
- mpz_abs (r, r);
-}
-
-int
-mpz_invert (mpz_t r, const mpz_t u, const mpz_t m)
-{
- mpz_t g, tr;
- int invertible;
-
- if (u->_mp_size == 0 || mpz_cmpabs_ui (m, 1) <= 0)
- return 0;
-
- mpz_init (g);
- mpz_init (tr);
-
- mpz_gcdext (g, tr, NULL, u, m);
- invertible = (mpz_cmp_ui (g, 1) == 0);
-
- if (invertible)
- {
- if (tr->_mp_size < 0)
- {
- if (m->_mp_size >= 0)
- mpz_add (tr, tr, m);
- else
- mpz_sub (tr, tr, m);
- }
- mpz_swap (r, tr);
- }
-
- mpz_clear (g);
- mpz_clear (tr);
- return invertible;
-}
-
-
-/* Higher level operations (sqrt, pow and root) */
-
-void
-mpz_pow_ui (mpz_t r, const mpz_t b, unsigned long e)
-{
- unsigned long bit;
- mpz_t tr;
- mpz_init_set_ui (tr, 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);
-}
-
-void
-mpz_ui_pow_ui (mpz_t r, unsigned long blimb, unsigned long e)
-{
- mpz_t b;
- mpz_init_set_ui (b, blimb);
- mpz_pow_ui (r, b, e);
- mpz_clear (b);
-}
-
-void
-mpz_powm (mpz_t r, const mpz_t b, const mpz_t e, const mpz_t m)
-{
- mpz_t tr;
- mpz_t base;
- mp_size_t en, mn;
- mp_srcptr mp;
- struct gmp_div_inverse minv;
- unsigned shift;
- mp_ptr tp = NULL;
-
- en = GMP_ABS (e->_mp_size);
- mn = GMP_ABS (m->_mp_size);
- if (mn == 0)
- gmp_die ("mpz_powm: Zero modulo.");
-
- if (en == 0)
- {
- mpz_set_ui (r, 1);
- return;
- }
-
- mp = m->_mp_d;
- mpn_div_qr_invert (&minv, mp, mn);
- shift = minv.shift;
-
- if (shift > 0)
- {
- /* To avoid shifts, we do all our reductions, except the final
- one, using a *normalized* m. */
- minv.shift = 0;
-
- tp = gmp_xalloc_limbs (mn);
- gmp_assert_nocarry (mpn_lshift (tp, mp, mn, shift));
- mp = tp;
- }
-
- mpz_init (base);
-
- if (e->_mp_size < 0)
- {
- if (!mpz_invert (base, b, m))
- gmp_die ("mpz_powm: Negative exponent and non-invertible base.");
- }
- else
- {
- mp_size_t bn;
- mpz_abs (base, b);
-
- bn = base->_mp_size;
- if (bn >= mn)
- {
- mpn_div_qr_preinv (NULL, base->_mp_d, base->_mp_size, mp, mn, &minv);
- bn = mn;
- }
-
- /* We have reduced the absolute value. Now take care of the
- sign. Note that we get zero represented non-canonically as
- m. */
- if (b->_mp_size < 0)
- {
- mp_ptr bp = MPZ_REALLOC (base, mn);
- gmp_assert_nocarry (mpn_sub (bp, mp, mn, bp, bn));
- bn = mn;
- }
- base->_mp_size = mpn_normalized_size (base->_mp_d, bn);
- }
- mpz_init_set_ui (tr, 1);
-
- while (en-- > 0)
- {
- mp_limb_t w = e->_mp_d[en];
- mp_limb_t bit;
-
- bit = GMP_LIMB_HIGHBIT;
- do
- {
- mpz_mul (tr, tr, tr);
- if (w & bit)
- mpz_mul (tr, tr, base);
- if (tr->_mp_size > mn)
- {
- 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 */
- if (tr->_mp_size >= mn)
- {
- minv.shift = shift;
- mpn_div_qr_preinv (NULL, tr->_mp_d, tr->_mp_size, mp, mn, &minv);
- tr->_mp_size = mpn_normalized_size (tr->_mp_d, mn);
- }
- if (tp)
- gmp_free (tp);
-
- mpz_swap (r, tr);
- mpz_clear (tr);
- mpz_clear (base);
-}
-
-void
-mpz_powm_ui (mpz_t r, const mpz_t b, unsigned long elimb, const mpz_t m)
-{
- mpz_t e;
- mpz_init_set_ui (e, elimb);
- mpz_powm (r, b, e, m);
- mpz_clear (e);
-}
-
-/* x=trunc(y^(1/z)), r=y-x^z */
-void
-mpz_rootrem (mpz_t x, mpz_t r, const mpz_t y, unsigned long z)
-{
- int sgn;
- mpz_t t, u;
-
- sgn = y->_mp_size < 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) {
- if (x)
- mpz_set (x, y);
- if (r)
- r->_mp_size = 0;
- return;
- }
-
- mpz_init (u);
- {
- 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 {
- mpz_swap (u, t); /* u = x */
- mpz_tdiv_q (t, y, u); /* t = y/x */
- mpz_add (t, t, u); /* t = y/x + x */
- mpz_tdiv_q_2exp (t, t, 1); /* x'= (y/x + x)/2 */
- } while (mpz_cmpabs (t, u) < 0); /* |x'| < |x| */
- else /* z != 2 */ {
- mpz_t v;
-
- mpz_init (v);
- if (sgn)
- mpz_neg (t, t);
-
- do {
- mpz_swap (u, t); /* u = x */
- mpz_pow_ui (t, u, z - 1); /* t = x^(z-1) */
- mpz_tdiv_q (t, y, t); /* t = y/x^(z-1) */
- mpz_mul_ui (v, u, z - 1); /* v = x*(z-1) */
- mpz_add (t, t, v); /* t = y/x^(z-1) + x*(z-1) */
- mpz_tdiv_q_ui (t, t, z); /* x'=(y/x^(z-1) + x*(z-1))/z */
- } while (mpz_cmpabs (t, u) < 0); /* |x'| < |x| */
-
- mpz_clear (v);
- }
-
- if (r) {
- mpz_pow_ui (t, u, z);
- mpz_sub (r, y, t);
- }
- if (x)
- mpz_swap (x, u);
- mpz_clear (u);
- mpz_clear (t);
-}
-
-int
-mpz_root (mpz_t x, const mpz_t y, unsigned long z)
-{
- int res;
- mpz_t r;
-
- mpz_init (r);
- mpz_rootrem (x, r, y, z);
- res = r->_mp_size == 0;
- mpz_clear (r);
-
- return res;
-}
-
-/* Compute s = floor(sqrt(u)) and r = u - s^2. Allows r == NULL */
-void
-mpz_sqrtrem (mpz_t s, mpz_t r, const mpz_t u)
-{
- mpz_rootrem (s, r, u, 2);
-}
-
-void
-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;
-}
-
-/* Combinatorics */
-
-void
-mpz_fac_ui (mpz_t x, unsigned long n)
-{
- mpz_set_ui (x, n + (n == 0));
- for (;n > 2;)
- mpz_mul_ui (x, x, --n);
-}
-
-void
-mpz_bin_uiui (mpz_t r, unsigned long n, unsigned long k)
-{
- mpz_t t;
-
- mpz_set_ui (r, k <= n);
-
- if (k > (n >> 1))
- k = (k <= n) ? n - k : 0;
-
- mpz_init (t);
- mpz_fac_ui (t, k);
-
- for (; k > 0; k--)
- mpz_mul_ui (r, r, n--);
-
- mpz_divexact (r, r, t);
- mpz_clear (t);
-}
-
-
-/* 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;
-}
-
-
-/* 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 complement.
- Negation transforms
-
- xxxx10...0
-
- into
-
- yyyy10...0
-
- where yyyy is the bitwise complement of xxxx. So least significant
- bits, up to and including the first one bit, are unchanged, and
- the more significant bits are all complemented.
-
- To change a bit from zero to one in a negative number, subtract the
- corresponding power of two from the absolute value. This can never
- underflow. To change a bit from one to zero, add the corresponding
- power of two, and this might overflow. E.g., if x = -001111, the
- two's complement is 110001. Clearing the least significant bit, we
- get two's complement 110000, and -010000. */
-
-int
-mpz_tstbit (const mpz_t d, mp_bitcnt_t bit_index)
-{
- mp_size_t limb_index;
- unsigned shift;
- mp_size_t ds;
- mp_size_t dn;
- mp_limb_t w;
- int bit;
-
- ds = d->_mp_size;
- dn = GMP_ABS (ds);
- limb_index = bit_index / GMP_LIMB_BITS;
- if (limb_index >= dn)
- return ds < 0;
-
- shift = bit_index % GMP_LIMB_BITS;
- w = d->_mp_d[limb_index];
- bit = (w >> shift) & 1;
-
- if (ds < 0)
- {
- /* d < 0. Check if any of the bits below is set: If so, our bit
- must be complemented. */
- if (shift > 0 && (w << (GMP_LIMB_BITS - shift)) > 0)
- return bit ^ 1;
- while (limb_index-- > 0)
- if (d->_mp_d[limb_index] > 0)
- return bit ^ 1;
- }
- return bit;
-}
-
-static void
-mpz_abs_add_bit (mpz_t d, mp_bitcnt_t bit_index)
-{
- mp_size_t dn, limb_index;
- mp_limb_t bit;
- mp_ptr dp;
-
- dn = GMP_ABS (d->_mp_size);
-
- limb_index = bit_index / GMP_LIMB_BITS;
- bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
-
- if (limb_index >= dn)
- {
- mp_size_t i;
- /* The bit should be set outside of the end of the number.
- We have to increase the size of the number. */
- dp = MPZ_REALLOC (d, limb_index + 1);
-
- dp[limb_index] = bit;
- for (i = dn; i < limb_index; i++)
- dp[i] = 0;
- dn = limb_index + 1;
- }
- else
- {
- mp_limb_t cy;
-
- dp = d->_mp_d;
-
- cy = mpn_add_1 (dp + limb_index, dp + limb_index, dn - limb_index, bit);
- if (cy > 0)
- {
- dp = MPZ_REALLOC (d, dn + 1);
- dp[dn++] = cy;
- }
- }
-
- d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
-}
-
-static void
-mpz_abs_sub_bit (mpz_t d, mp_bitcnt_t bit_index)
-{
- mp_size_t dn, limb_index;
- mp_ptr dp;
- mp_limb_t bit;
-
- dn = GMP_ABS (d->_mp_size);
- dp = d->_mp_d;
-
- limb_index = bit_index / GMP_LIMB_BITS;
- bit = (mp_limb_t) 1 << (bit_index % GMP_LIMB_BITS);
-
- assert (limb_index < dn);
-
- gmp_assert_nocarry (mpn_sub_1 (dp + limb_index, dp + limb_index,
- dn - limb_index, bit));
- dn -= (dp[dn-1] == 0);
- d->_mp_size = (d->_mp_size < 0) ? - dn : dn;
-}
-
-void
-mpz_setbit (mpz_t d, mp_bitcnt_t bit_index)
-{
- if (!mpz_tstbit (d, bit_index))
- {
- if (d->_mp_size >= 0)
- mpz_abs_add_bit (d, bit_index);
- else
- mpz_abs_sub_bit (d, bit_index);
- }
-}
-
-void
-mpz_clrbit (mpz_t d, mp_bitcnt_t bit_index)
-{
- if (mpz_tstbit (d, bit_index))
- {
- if (d->_mp_size >= 0)
- mpz_abs_sub_bit (d, bit_index);
- else
- mpz_abs_add_bit (d, bit_index);
- }
-}
-
-void
-mpz_combit (mpz_t d, mp_bitcnt_t bit_index)
-{
- if (mpz_tstbit (d, bit_index) ^ (d->_mp_size < 0))
- mpz_abs_sub_bit (d, bit_index);
- else
- mpz_abs_add_bit (d, bit_index);
-}
-
-void
-mpz_com (mpz_t r, const mpz_t u)
-{
- mpz_neg (r, u);
- mpz_sub_ui (r, r, 1);
-}
-
-void
-mpz_and (mpz_t r, const mpz_t u, const mpz_t v)
-{
- mp_size_t un, vn, rn, i;
- mp_ptr up, vp, rp;
-
- mp_limb_t ux, vx, rx;
- mp_limb_t uc, vc, rc;
- mp_limb_t ul, vl, rl;
-
- un = GMP_ABS (u->_mp_size);
- vn = GMP_ABS (v->_mp_size);
- if (un < vn)
- {
- MPZ_SRCPTR_SWAP (u, v);
- MP_SIZE_T_SWAP (un, vn);
- }
- if (vn == 0)
- {
- r->_mp_size = 0;
- return;
- }
-
- uc = u->_mp_size < 0;
- vc = v->_mp_size < 0;
- rc = uc & vc;
-
- ux = -uc;
- vx = -vc;
- rx = -rc;
-
- /* If the smaller input is positive, higher limbs don't matter. */
- rn = vx ? un : vn;
-
- rp = MPZ_REALLOC (r, rn + rc);
-
- up = u->_mp_d;
- vp = v->_mp_d;
-
- i = 0;
- do
- {
- ul = (up[i] ^ ux) + uc;
- uc = ul < uc;
-
- vl = (vp[i] ^ vx) + vc;
- vc = vl < vc;
-
- rl = ( (ul & vl) ^ rx) + rc;
- rc = rl < rc;
- rp[i] = rl;
- }
- while (++i < vn);
- assert (vc == 0);
-
- for (; i < rn; i++)
- {
- ul = (up[i] ^ ux) + uc;
- uc = ul < uc;
-
- rl = ( (ul & vx) ^ rx) + rc;
- rc = rl < rc;
- rp[i] = rl;
- }
- if (rc)
- rp[rn++] = rc;
- else
- rn = mpn_normalized_size (rp, rn);
-
- r->_mp_size = rx ? -rn : rn;
-}
-
-void
-mpz_ior (mpz_t r, const mpz_t u, const mpz_t v)
-{
- mp_size_t un, vn, rn, i;
- mp_ptr up, vp, rp;
-
- mp_limb_t ux, vx, rx;
- mp_limb_t uc, vc, rc;
- mp_limb_t ul, vl, rl;
-
- un = GMP_ABS (u->_mp_size);
- vn = GMP_ABS (v->_mp_size);
- if (un < vn)
- {
- MPZ_SRCPTR_SWAP (u, v);
- MP_SIZE_T_SWAP (un, vn);
- }
- if (vn == 0)
- {
- mpz_set (r, u);
- return;
- }
-
- uc = u->_mp_size < 0;
- vc = v->_mp_size < 0;
- rc = uc | vc;
-
- ux = -uc;
- vx = -vc;
- rx = -rc;
-
- /* If the smaller input is negative, by sign extension higher limbs
- don't matter. */
- rn = vx ? vn : un;
-
- rp = MPZ_REALLOC (r, rn + rc);
-
- up = u->_mp_d;
- vp = v->_mp_d;
-
- i = 0;
- do
- {
- ul = (up[i] ^ ux) + uc;
- uc = ul < uc;
-
- vl = (vp[i] ^ vx) + vc;
- vc = vl < vc;
-
- rl = ( (ul | vl) ^ rx) + rc;
- rc = rl < rc;
- rp[i] = rl;
- }
- while (++i < vn);
- assert (vc == 0);
-
- for (; i < rn; i++)
- {
- ul = (up[i] ^ ux) + uc;
- uc = ul < uc;
-
- rl = ( (ul | vx) ^ rx) + rc;
- rc = rl < rc;
- rp[i] = rl;
- }
- if (rc)
- rp[rn++] = rc;
- else
- rn = mpn_normalized_size (rp, rn);
-
- r->_mp_size = rx ? -rn : rn;
-}
-
-void
-mpz_xor (mpz_t r, const mpz_t u, const mpz_t v)
-{
- mp_size_t un, vn, i;
- mp_ptr up, vp, rp;
-
- mp_limb_t ux, vx, rx;
- mp_limb_t uc, vc, rc;
- mp_limb_t ul, vl, rl;
-
- un = GMP_ABS (u->_mp_size);
- vn = GMP_ABS (v->_mp_size);
- if (un < vn)
- {
- MPZ_SRCPTR_SWAP (u, v);
- MP_SIZE_T_SWAP (un, vn);
- }
- if (vn == 0)
- {
- mpz_set (r, u);
- return;
- }
-
- uc = u->_mp_size < 0;
- vc = v->_mp_size < 0;
- rc = uc ^ vc;
-
- ux = -uc;
- vx = -vc;
- rx = -rc;
-
- rp = MPZ_REALLOC (r, un + rc);
-
- up = u->_mp_d;
- vp = v->_mp_d;
-
- i = 0;
- do
- {
- ul = (up[i] ^ ux) + uc;
- uc = ul < uc;
-
- vl = (vp[i] ^ vx) + vc;
- vc = vl < vc;
-
- rl = (ul ^ vl ^ rx) + rc;
- rc = rl < rc;
- rp[i] = rl;
- }
- while (++i < vn);
- assert (vc == 0);
-
- for (; i < un; i++)
- {
- ul = (up[i] ^ ux) + uc;
- uc = ul < uc;
-
- rl = (ul ^ ux) + rc;
- rc = rl < rc;
- rp[i] = rl;
- }
- if (rc)
- rp[un++] = rc;
- else
- un = mpn_normalized_size (rp, un);
-
- r->_mp_size = rx ? -un : un;
-}
-
-static unsigned
-gmp_popcount_limb (mp_limb_t x)
-{
- unsigned c;
-
- /* Do 16 bits at a time, to avoid limb-sized constants. */
- for (c = 0; x > 0; x >>= 16)
- {
- unsigned w = ((x >> 1) & 0x5555) + (x & 0x5555);
- w = ((w >> 2) & 0x3333) + (w & 0x3333);
- w = ((w >> 4) & 0x0f0f) + (w & 0x0f0f);
- w = (w >> 8) + (w & 0x00ff);
- c += w;
- }
- return c;
-}
-
-mp_bitcnt_t
-mpn_popcount (mp_srcptr p, mp_size_t n)
-{
- 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;
-
- return mpn_popcount (u->_mp_d, un);
-}
-
-mp_bitcnt_t
-mpz_hamdist (const mpz_t u, const mpz_t v)
-{
- mp_size_t un, vn, i;
- mp_limb_t uc, vc, ul, vl, comp;
- mp_srcptr up, vp;
- mp_bitcnt_t c;
-
- un = u->_mp_size;
- vn = v->_mp_size;
-
- if ( (un ^ vn) < 0)
- return ~(mp_bitcnt_t) 0;
-
- comp = - (uc = vc = (un < 0));
- if (uc)
- {
- assert (vn < 0);
- un = -un;
- vn = -vn;
- }
-
- up = u->_mp_d;
- vp = v->_mp_d;
-
- if (un < vn)
- MPN_SRCPTR_SWAP (up, un, vp, vn);
-
- for (i = 0, c = 0; i < vn; i++)
- {
- ul = (up[i] ^ comp) + uc;
- uc = ul < uc;
-
- vl = (vp[i] ^ comp) + vc;
- vc = vl < vc;
-
- c += gmp_popcount_limb (ul ^ vl);
- }
- assert (vc == 0);
-
- for (; i < un; i++)
- {
- ul = (up[i] ^ comp) + uc;
- uc = ul < uc;
-
- c += gmp_popcount_limb (ul ^ comp);
- }
-
- return c;
-}
-
-mp_bitcnt_t
-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;
-
- us = u->_mp_size;
- un = GMP_ABS (us);
- i = starting_bit / GMP_LIMB_BITS;
-
- /* Past the end there's no 1 bits for u>=0, or an immediate 1 bit
- for u<0. Notice this test picks up any u==0 too. */
- if (i >= un)
- return (us >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit);
-
- up = u->_mp_d;
- ux = 0;
- limb = up[i];
-
- if (starting_bit != 0)
- {
- if (us < 0)
- {
- ux = mpn_zero_p (up, i);
- limb = ~ limb + ux;
- ux = - (mp_limb_t) (limb >= ux);
- }
-
- /* Mask to 0 all bits before starting_bit, thus ignoring them. */
- limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
- }
-
- return mpn_common_scan (limb, i, up, un, ux);
-}
-
-mp_bitcnt_t
-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;
-
- 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 (ux ? starting_bit : ~(mp_bitcnt_t) 0);
-
- up = u->_mp_d;
- limb = up[i] ^ ux;
-
- if (ux == 0)
- limb -= mpn_zero_p (up, i); /* limb = ~(~limb + zero_p) */
-
- /* Mask all bits before starting_bit, thus ignoring them. */
- limb &= (GMP_LIMB_MAX << (starting_bit % GMP_LIMB_BITS));
-
- return mpn_common_scan (limb, i, up, un, ux);
-}
-
-
-/* MPZ base conversion. */
-
-size_t
-mpz_sizeinbase (const mpz_t u, int base)
-{
- mp_size_t un;
- mp_srcptr up;
- mp_ptr tp;
- mp_bitcnt_t bits;
- struct gmp_div_inverse bi;
- size_t ndigits;
-
- assert (base >= 2);
- assert (base <= 36);
-
- un = GMP_ABS (u->_mp_size);
- if (un == 0)
- return 1;
-
- up = u->_mp_d;
-
- bits = (un - 1) * GMP_LIMB_BITS + mpn_limb_size_in_base_2 (up[un-1]);
- switch (base)
- {
- case 2:
- return bits;
- case 4:
- return (bits + 1) / 2;
- case 8:
- return (bits + 2) / 3;
- case 16:
- return (bits + 3) / 4;
- case 32:
- return (bits + 4) / 5;
- /* FIXME: Do something more clever for the common case of base
- 10. */
- }
-
- tp = gmp_xalloc_limbs (un);
- mpn_copyi (tp, up, un);
- mpn_div_qr_1_invert (&bi, base);
-
- 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;
-}
-
-char *
-mpz_get_str (char *sp, int base, const mpz_t u)
-{
- unsigned bits;
- const char *digits;
- mp_size_t un;
- size_t i, sn;
-
- if (base >= 0)
- {
- digits = "0123456789abcdefghijklmnopqrstuvwxyz";
- }
- else
- {
- base = -base;
- digits = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
- }
- if (base <= 1)
- base = 10;
- if (base > 36)
- return NULL;
-
- sn = 1 + mpz_sizeinbase (u, base);
- if (!sp)
- sp = gmp_xalloc (1 + sn);
-
- un = GMP_ABS (u->_mp_size);
-
- if (un == 0)
- {
- sp[0] = '0';
- sp[1] = '\0';
- return sp;
- }
-
- i = 0;
-
- if (u->_mp_size < 0)
- sp[i++] = '-';
-
- bits = mpn_base_power_of_two_p (base);
-
- if (bits)
- /* Not modified in this case. */
- sn = i + mpn_get_str_bits ((unsigned char *) sp + i, bits, u->_mp_d, un);
- else
- {
- struct mpn_base_info info;
- mp_ptr tp;
-
- mpn_get_base_info (&info, base);
- tp = gmp_xalloc_limbs (un);
- mpn_copyi (tp, u->_mp_d, un);
-
- sn = i + mpn_get_str_other ((unsigned char *) sp + i, base, &info, tp, un);
- gmp_free (tp);
- }
-
- for (; i < sn; i++)
- sp[i] = digits[(unsigned char) sp[i]];
-
- sp[sn] = '\0';
- return sp;
-}
-
-int
-mpz_set_str (mpz_t r, const char *sp, int base)
-{
- unsigned bits;
- mp_size_t rn, alloc;
- mp_ptr rp;
- size_t sn;
- int sign;
- unsigned char *dp;
-
- assert (base == 0 || (base >= 2 && base <= 36));
-
- while (isspace( (unsigned char) *sp))
- sp++;
-
- sign = (*sp == '-');
- sp += sign;
-
- if (base == 0)
- {
- if (*sp == '0')
- {
- sp++;
- if (*sp == 'x' || *sp == 'X')
- {
- base = 16;
- sp++;
- }
- else if (*sp == 'b' || *sp == 'B')
- {
- base = 2;
- sp++;
- }
- else
- base = 8;
- }
- else
- base = 10;
- }
-
- sn = strlen (sp);
- dp = gmp_xalloc (sn + (sn == 0));
-
- for (sn = 0; *sp; sp++)
- {
- unsigned digit;
-
- if (isspace ((unsigned char) *sp))
- continue;
- if (*sp >= '0' && *sp <= '9')
- digit = *sp - '0';
- else if (*sp >= 'a' && *sp <= 'z')
- digit = *sp - 'a' + 10;
- else if (*sp >= 'A' && *sp <= 'Z')
- digit = *sp - 'A' + 10;
- else
- digit = base; /* fail */
-
- if (digit >= base)
- {
- gmp_free (dp);
- r->_mp_size = 0;
- return -1;
- }
-
- dp[sn++] = digit;
- }
-
- bits = mpn_base_power_of_two_p (base);
-
- if (bits > 0)
- {
- alloc = (sn * bits + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS;
- rp = MPZ_REALLOC (r, alloc);
- rn = mpn_set_str_bits (rp, dp, sn, bits);
- }
- else
- {
- struct mpn_base_info info;
- 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, sn, base, &info);
- }
- assert (rn <= alloc);
- gmp_free (dp);
-
- r->_mp_size = sign ? - rn : rn;
-
- return 0;
-}
-
-int
-mpz_init_set_str (mpz_t r, const char *sp, int base)
-{
- mpz_init (r);
- return mpz_set_str (r, sp, base);
-}
-
-size_t
-mpz_out_str (FILE *stream, int base, const mpz_t x)
-{
- char *str;
- size_t len;
-
- str = mpz_get_str (NULL, base, x);
- len = strlen (str);
- len = fwrite (str, 1, len, stream);
- gmp_free (str);
- return len;
-}
-
-
-static int
-gmp_detect_endian (void)
-{
- static const int i = 2;
- const unsigned char *p = (const unsigned char *) &i;
- return 1 - *p;
-}
-
-/* Import and export. Does not support nails. */
-void
-mpz_import (mpz_t r, size_t count, int order, size_t size, int endian,
- size_t nails, const void *src)
-{
- const unsigned char *p;
- ptrdiff_t word_step;
- mp_ptr rp;
- mp_size_t rn;
-
- /* The current (partial) limb. */
- mp_limb_t limb;
- /* The number of bytes already copied to this limb (starting from
- the low end). */
- size_t bytes;
- /* The index where the limb should be stored, when completed. */
- mp_size_t i;
-
- if (nails != 0)
- gmp_die ("mpz_import: Nails not supported.");
-
- assert (order == 1 || order == -1);
- assert (endian >= -1 && endian <= 1);
-
- if (endian == 0)
- endian = gmp_detect_endian ();
-
- p = (unsigned char *) src;
-
- word_step = (order != endian) ? 2 * size : 0;
-
- /* 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;
- }
-
- /* And at least significant byte of that word. */
- if (endian == 1)
- p += (size - 1);
-
- rn = (size * count + sizeof(mp_limb_t) - 1) / sizeof(mp_limb_t);
- rp = MPZ_REALLOC (r, rn);
-
- for (limb = 0, bytes = 0, i = 0; count > 0; count--, p += word_step)
- {
- size_t j;
- for (j = 0; j < size; j++, p -= (ptrdiff_t) endian)
- {
- limb |= (mp_limb_t) *p << (bytes++ * CHAR_BIT);
- if (bytes == sizeof(mp_limb_t))
- {
- rp[i++] = limb;
- bytes = 0;
- limb = 0;
- }
- }
- }
- assert (i + (bytes > 0) == rn);
- if (limb != 0)
- rp[i++] = limb;
- else
- i = 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)
-{
- size_t count;
- mp_size_t un;
-
- if (nails != 0)
- gmp_die ("mpz_import: Nails not supported.");
-
- assert (order == 1 || order == -1);
- assert (endian >= -1 && endian <= 1);
- assert (size > 0 || u->_mp_size == 0);
-
- 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;
-
- un = GMP_ABS (un);
-
- /* Count bytes in top limb. */
- limb = u->_mp_d[un-1];
- assert (limb != 0);
-
- k = 0;
- do {
- k++; limb >>= CHAR_BIT;
- } while (limb != 0);
-
- count = (k + (un-1) * sizeof (mp_limb_t) + size - 1) / size;
-
- if (!r)
- r = gmp_xalloc (count * size);
-
- if (endian == 0)
- endian = gmp_detect_endian ();
-
- p = (unsigned char *) r;
-
- word_step = (order != endian) ? 2 * size : 0;
-
- /* 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;
- }
-
- /* 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;
-
- return r;
-}
diff --git a/gmp/mini-gmp/mini-gmp.h b/gmp/mini-gmp/mini-gmp.h
deleted file mode 100644
index c043ca7e66..0000000000
--- a/gmp/mini-gmp/mini-gmp.h
+++ /dev/null
@@ -1,294 +0,0 @@
-/* mini-gmp, a minimalistic implementation of a GNU GMP subset.
-
-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/. */
-
-/* About mini-gmp: This is a minimal implementation of a subset of the
- GMP interface. It is intended for inclusion into applications which
- have modest bignums needs, as a fallback when the real GMP library
- is not installed.
-
- This file defines the public interface. */
-
-#ifndef __MINI_GMP_H__
-#define __MINI_GMP_H__
-
-/* For size_t */
-#include <stddef.h>
-
-#if defined (__cplusplus)
-extern "C" {
-#endif
-
-void mp_set_memory_functions (void *(*) (size_t),
- void *(*) (void *, size_t, size_t),
- void (*) (void *, size_t));
-
-void mp_get_memory_functions (void *(**) (size_t),
- void *(**) (void *, size_t, size_t),
- void (**) (void *, size_t));
-
-typedef unsigned long mp_limb_t;
-typedef long mp_size_t;
-typedef unsigned long mp_bitcnt_t;
-
-typedef mp_limb_t *mp_ptr;
-typedef const mp_limb_t *mp_srcptr;
-
-typedef struct
-{
- int _mp_alloc; /* Number of *limbs* allocated and pointed
- to by the _mp_d field. */
- int _mp_size; /* abs(_mp_size) is the number of limbs the
- last field points to. If _mp_size is
- negative this is a negative number. */
- mp_limb_t *_mp_d; /* Pointer to the limbs. */
-} __mpz_struct;
-
-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);
-
-mp_limb_t mpn_add_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t mpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t mpn_add (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-mp_limb_t mpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t mpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t mpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-mp_limb_t mpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t mpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-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)
-
-size_t mpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
-mp_size_t mpn_set_str (mp_ptr, const unsigned char *, size_t, int);
-
-void mpz_init (mpz_t);
-void mpz_init2 (mpz_t, mp_bitcnt_t);
-void mpz_clear (mpz_t);
-
-#define mpz_odd_p(z) (((z)->_mp_size != 0) & (int) (z)->_mp_d[0])
-#define mpz_even_p(z) (! mpz_odd_p (z))
-
-int mpz_sgn (const mpz_t);
-int mpz_cmp_si (const mpz_t, long);
-int mpz_cmp_ui (const mpz_t, unsigned long);
-int mpz_cmp (const mpz_t, const mpz_t);
-int mpz_cmpabs_ui (const mpz_t, unsigned long);
-int mpz_cmpabs (const mpz_t, const mpz_t);
-int mpz_cmp_d (const mpz_t, double);
-int mpz_cmpabs_d (const mpz_t, double);
-
-void mpz_abs (mpz_t, const mpz_t);
-void mpz_neg (mpz_t, const mpz_t);
-void mpz_swap (mpz_t, mpz_t);
-
-void mpz_add_ui (mpz_t, const mpz_t, unsigned long);
-void mpz_add (mpz_t, const mpz_t, const mpz_t);
-void mpz_sub_ui (mpz_t, const mpz_t, unsigned long);
-void mpz_ui_sub (mpz_t, unsigned long, const mpz_t);
-void mpz_sub (mpz_t, const mpz_t, const mpz_t);
-
-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);
-void mpz_tdiv_qr (mpz_t, mpz_t, const mpz_t, const mpz_t);
-void mpz_cdiv_q (mpz_t, const mpz_t, const mpz_t);
-void mpz_fdiv_q (mpz_t, const mpz_t, const mpz_t);
-void mpz_tdiv_q (mpz_t, const mpz_t, const mpz_t);
-void mpz_cdiv_r (mpz_t, const mpz_t, const mpz_t);
-void mpz_fdiv_r (mpz_t, const mpz_t, const mpz_t);
-void mpz_tdiv_r (mpz_t, const mpz_t, const mpz_t);
-
-void mpz_cdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
-void mpz_fdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
-void mpz_tdiv_q_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
-void mpz_cdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
-void mpz_fdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
-void mpz_tdiv_r_2exp (mpz_t, const mpz_t, mp_bitcnt_t);
-
-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);
-unsigned long mpz_tdiv_qr_ui (mpz_t, mpz_t, const mpz_t, unsigned long);
-unsigned long mpz_cdiv_q_ui (mpz_t, const mpz_t, unsigned long);
-unsigned long mpz_fdiv_q_ui (mpz_t, const mpz_t, unsigned long);
-unsigned long mpz_tdiv_q_ui (mpz_t, const mpz_t, unsigned long);
-unsigned long mpz_cdiv_r_ui (mpz_t, const mpz_t, unsigned long);
-unsigned long mpz_fdiv_r_ui (mpz_t, const mpz_t, unsigned long);
-unsigned long mpz_tdiv_r_ui (mpz_t, const mpz_t, unsigned long);
-unsigned long mpz_cdiv_ui (const mpz_t, unsigned long);
-unsigned long mpz_fdiv_ui (const mpz_t, unsigned long);
-unsigned long mpz_tdiv_ui (const mpz_t, unsigned long);
-
-unsigned long mpz_mod_ui (mpz_t, const mpz_t, unsigned long);
-
-void mpz_divexact_ui (mpz_t, const mpz_t, unsigned long);
-
-int mpz_divisible_ui_p (const mpz_t, unsigned long);
-
-unsigned long mpz_gcd_ui (mpz_t, const mpz_t, unsigned long);
-void mpz_gcd (mpz_t, const mpz_t, const mpz_t);
-void mpz_gcdext (mpz_t, mpz_t, mpz_t, const mpz_t, const mpz_t);
-void mpz_lcm_ui (mpz_t, const mpz_t, unsigned long);
-void mpz_lcm (mpz_t, const mpz_t, const mpz_t);
-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);
-void mpz_powm (mpz_t, const mpz_t, const mpz_t, const mpz_t);
-void mpz_powm_ui (mpz_t, const mpz_t, unsigned long, const mpz_t);
-
-void mpz_rootrem (mpz_t, mpz_t, const mpz_t, unsigned long);
-int mpz_root (mpz_t, const mpz_t, unsigned long);
-
-void mpz_fac_ui (mpz_t, unsigned long);
-void mpz_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);
-void mpz_combit (mpz_t, mp_bitcnt_t);
-
-void mpz_com (mpz_t, const mpz_t);
-void mpz_and (mpz_t, const mpz_t, const mpz_t);
-void mpz_ior (mpz_t, const mpz_t, const mpz_t);
-void mpz_xor (mpz_t, const mpz_t, const mpz_t);
-
-mp_bitcnt_t mpz_popcount (const mpz_t);
-mp_bitcnt_t mpz_hamdist (const mpz_t, const mpz_t);
-mp_bitcnt_t mpz_scan0 (const mpz_t, mp_bitcnt_t);
-mp_bitcnt_t mpz_scan1 (const mpz_t, mp_bitcnt_t);
-
-int mpz_fits_slong_p (const mpz_t);
-int mpz_fits_ulong_p (const mpz_t);
-long int mpz_get_si (const mpz_t);
-unsigned long int mpz_get_ui (const mpz_t);
-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);
-void mpz_set_d (mpz_t, double);
-
-void mpz_init_set_si (mpz_t, signed long int);
-void mpz_init_set_ui (mpz_t, unsigned long int);
-void mpz_init_set (mpz_t, const mpz_t);
-void mpz_init_set_d (mpz_t, double);
-
-size_t mpz_sizeinbase (const mpz_t, int);
-char *mpz_get_str (char *, int, const mpz_t);
-int mpz_set_str (mpz_t, const char *, int);
-int mpz_init_set_str (mpz_t, const char *, int);
-
-/* This long list taken from gmp.h. */
-/* For reference, "defined(EOF)" cannot be used here. In g++ 2.95.4,
- <iostream> defines EOF but not FILE. */
-#if defined (FILE) \
- || defined (H_STDIO) \
- || defined (_H_STDIO) /* AIX */ \
- || defined (_STDIO_H) /* glibc, Sun, SCO */ \
- || defined (_STDIO_H_) /* BSD, OSF */ \
- || defined (__STDIO_H) /* Borland */ \
- || defined (__STDIO_H__) /* IRIX */ \
- || defined (_STDIO_INCLUDED) /* HPUX */ \
- || defined (__dj_include_stdio_h_) /* DJGPP */ \
- || defined (_FILE_DEFINED) /* Microsoft */ \
- || defined (__STDIO__) /* Apple MPW MrC */ \
- || defined (_MSL_STDIO_H) /* Metrowerks */ \
- || defined (_STDIO_H_INCLUDED) /* QNX4 */ \
- || defined (_ISO_STDIO_ISO_H) /* Sun C++ */ \
- || defined (__STDIO_LOADED) /* VMS */
-size_t mpz_out_str (FILE *, int, const mpz_t);
-#endif
-
-void mpz_import (mpz_t, size_t, int, size_t, int, size_t, const void *);
-void *mpz_export (void *, size_t *, int, size_t, int, size_t, const mpz_t);
-
-#if defined (__cplusplus)
-}
-#endif
-#endif /* __MINI_GMP_H__ */
diff --git a/gmp/mini-gmp/tests/Makefile b/gmp/mini-gmp/tests/Makefile
deleted file mode 100644
index fe052a02f7..0000000000
--- a/gmp/mini-gmp/tests/Makefile
+++ /dev/null
@@ -1,60 +0,0 @@
-# Note: Requires GNU make
-
-# Copyright 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/.
-
-srcdir=.
-MINI_GMP_DIR=..
-
-CC = gcc
-EXTRA_CFLAGS = -O -Wall -g
-CFLAGS = $(EXTRA_CFLAGS) -I$(MINI_GMP_DIR)
-LDFLAGS =
-
-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-aorsmul t-limbs t-cong t-pprime_p
-
-MISC_OBJS = hex-random.o mini-random.o testutils.o
-
-all:
-
-clean:
- rm -f *.o $(CHECK_PROGRAMS)
-
-%: %.c
-.c:
-
-# Keep object files
-.PRECIOUS: %.o
-
-%.o: %.c $(MINI_GMP_DIR)/mini-gmp.h hex-random.h mini-random.h
- $(CC) $(CFLAGS) -c $< -o $@
-
-testutils.o: $(MINI_GMP_DIR)/mini-gmp.c
-
-%: %.o $(MISC_OBJS)
- $(CC) $(LDFLAGS) $^ $(LIBS) -o $@
-
-# Missing tests include:
-# mpz_cmp_d, mpz_popcount, mpz_hamdist, mpz_ui_pow_ui
-
-check: $(CHECK_PROGRAMS)
- $(srcdir)/run-tests $(CHECK_PROGRAMS)
diff --git a/gmp/mini-gmp/tests/hex-random.c b/gmp/mini-gmp/tests/hex-random.c
deleted file mode 100644
index eb8d3f84ec..0000000000
--- a/gmp/mini-gmp/tests/hex-random.c
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
-
-Copyright 2011, 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>
-
-#include <time.h>
-#include <unistd.h>
-
-#include "gmp.h"
-
-#include "hex-random.h"
-
-static gmp_randstate_t state;
-
-void
-hex_random_init (void)
-{
- unsigned long seed;
- char *env_seed;
-
- env_seed = getenv("GMP_CHECK_RANDOMIZE");
- if (env_seed && env_seed[0])
- {
- seed = strtoul (env_seed, NULL, 0);
- if (seed)
- printf ("Re-seeding with GMP_CHECK_RANDOMIZE=%lu\n", seed);
- else
- {
- seed = time(NULL) + getpid();
- printf ("Seed GMP_CHECK_RANDOMIZE=%lu (include this in bug reports)\n", seed);
- }
- }
- else
- seed = 4711;
-
- gmp_randinit_default (state);
- gmp_randseed_ui (state, seed);
-}
-
-char *
-hex_urandomb (unsigned long bits)
-{
- char *res;
- mpz_t x;
-
- mpz_init (x);
- mpz_urandomb (x, state, bits);
- gmp_asprintf (&res, "%Zx", x);
- mpz_clear (x);
- return res;
-}
-
-char *
-hex_rrandomb (unsigned long bits)
-{
- char *res;
- mpz_t x;
-
- mpz_init (x);
- mpz_rrandomb (x, state, bits);
- gmp_asprintf (&res, "%Zx", x);
- mpz_clear (x);
- return res;
-}
-
-char *
-hex_rrandomb_export (void *dst, size_t *countp,
- int order, size_t size, int endian, unsigned long bits)
-{
- char *res;
- mpz_t x;
- mpz_init (x);
- mpz_rrandomb (x, state, bits);
- gmp_asprintf (&res, "%Zx", x);
- mpz_export (dst, countp, order, size, endian, 0, x);
- mpz_clear (x);
- return res;
-}
-
-void hex_random_op2 (enum hex_random_op op, unsigned long maxbits,
- char **ap, char **rp)
-{
- mpz_t a, r;
- unsigned long abits;
- unsigned signs;
-
- mpz_init (a);
- mpz_init (r);
-
- abits = gmp_urandomb_ui (state, 32) % maxbits;
-
- mpz_rrandomb (a, state, abits);
-
- signs = gmp_urandomb_ui (state, 1);
- if (signs & 1)
- mpz_neg (a, a);
-
- switch (op)
- {
- default:
- abort ();
- case OP_SQR:
- mpz_mul (r, a, a);
- break;
- }
-
- gmp_asprintf (ap, "%Zx", a);
- gmp_asprintf (rp, "%Zx", r);
-
- mpz_clear (a);
- mpz_clear (r);
-}
-
-void
-hex_random_op3 (enum hex_random_op op, unsigned long maxbits,
- char **ap, char **bp, char **rp)
-{
- mpz_t a, b, r;
- unsigned long abits, bbits;
- unsigned signs;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (r);
-
- abits = gmp_urandomb_ui (state, 32) % maxbits;
- bbits = gmp_urandomb_ui (state, 32) % maxbits;
-
- mpz_rrandomb (a, state, abits);
- mpz_rrandomb (b, state, bbits);
-
- signs = gmp_urandomb_ui (state, 3);
- if (signs & 1)
- mpz_neg (a, a);
- if (signs & 2)
- mpz_neg (b, b);
-
- switch (op)
- {
- default:
- abort ();
- case OP_ADD:
- mpz_add (r, a, b);
- break;
- case OP_SUB:
- mpz_sub (r, a, b);
- break;
- case OP_MUL:
- mpz_mul (r, a, b);
- break;
- case OP_GCD:
- if (signs & 4)
- {
- /* Produce a large gcd */
- unsigned long gbits = gmp_urandomb_ui (state, 32) % maxbits;
- mpz_rrandomb (r, state, gbits);
- mpz_mul (a, a, r);
- mpz_mul (b, b, r);
- }
- mpz_gcd (r, a, b);
- break;
- case OP_LCM:
- if (signs & 4)
- {
- /* Produce a large gcd */
- unsigned long gbits = gmp_urandomb_ui (state, 32) % maxbits;
- mpz_rrandomb (r, state, gbits);
- mpz_mul (a, a, r);
- mpz_mul (b, b, r);
- }
- mpz_lcm (r, a, b);
- break;
- case OP_AND:
- mpz_and (r, a, b);
- break;
- case OP_IOR:
- mpz_ior (r, a, b);
- break;
- case OP_XOR:
- mpz_xor (r, a, b);
- break;
- }
-
- gmp_asprintf (ap, "%Zx", a);
- gmp_asprintf (bp, "%Zx", b);
- gmp_asprintf (rp, "%Zx", r);
-
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (r);
-}
-
-void
-hex_random_op4 (enum hex_random_op op, unsigned long maxbits,
- char **ap, char **bp, char **cp, char **dp)
-{
- mpz_t a, b, c, d;
- unsigned long abits, bbits;
- unsigned signs;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (c);
- mpz_init (d);
-
- if (op == OP_POWM)
- {
- unsigned long cbits;
- abits = gmp_urandomb_ui (state, 32) % maxbits;
- bbits = 1 + gmp_urandomb_ui (state, 32) % maxbits;
- cbits = 2 + gmp_urandomb_ui (state, 32) % maxbits;
-
- mpz_rrandomb (a, state, abits);
- mpz_rrandomb (b, state, bbits);
- mpz_rrandomb (c, state, cbits);
-
- signs = gmp_urandomb_ui (state, 3);
- if (signs & 1)
- mpz_neg (a, a);
- if (signs & 2)
- {
- mpz_t g;
-
- /* If we negate the exponent, must make sure that gcd(a, c) = 1 */
- if (mpz_sgn (a) == 0)
- mpz_set_ui (a, 1);
- else
- {
- mpz_init (g);
-
- for (;;)
- {
- mpz_gcd (g, a, c);
- if (mpz_cmp_ui (g, 1) == 0)
- break;
- mpz_divexact (a, a, g);
- }
- mpz_clear (g);
- }
- mpz_neg (b, b);
- }
- if (signs & 4)
- mpz_neg (c, c);
-
- mpz_powm (d, a, b, c);
- }
- else
- {
- unsigned long qbits;
- bbits = 1 + gmp_urandomb_ui (state, 32) % maxbits;
- qbits = gmp_urandomb_ui (state, 32) % maxbits;
- abits = bbits + qbits;
- if (abits > 30)
- abits -= 30;
- else
- abits = 0;
-
- mpz_rrandomb (a, state, abits);
- mpz_rrandomb (b, state, bbits);
-
- signs = gmp_urandomb_ui (state, 2);
- if (signs & 1)
- mpz_neg (a, a);
- if (signs & 2)
- mpz_neg (b, b);
-
- switch (op)
- {
- default:
- abort ();
- case OP_CDIV:
- mpz_cdiv_qr (c, d, a, b);
- break;
- case OP_FDIV:
- mpz_fdiv_qr (c, d, a, b);
- break;
- case OP_TDIV:
- mpz_tdiv_qr (c, d, a, b);
- break;
- }
- }
- gmp_asprintf (ap, "%Zx", a);
- gmp_asprintf (bp, "%Zx", b);
- gmp_asprintf (cp, "%Zx", c);
- gmp_asprintf (dp, "%Zx", d);
-
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (c);
- mpz_clear (d);
-}
-
-void
-hex_random_bit_op (enum hex_random_op op, unsigned long maxbits,
- char **ap, unsigned long *b, char **rp)
-{
- mpz_t a, r;
- unsigned long abits, bbits;
- unsigned signs;
-
- mpz_init (a);
- mpz_init (r);
-
- abits = gmp_urandomb_ui (state, 32) % maxbits;
- bbits = gmp_urandomb_ui (state, 32) % (maxbits + 100);
-
- mpz_rrandomb (a, state, abits);
-
- signs = gmp_urandomb_ui (state, 1);
- if (signs & 1)
- mpz_neg (a, a);
-
- switch (op)
- {
- default:
- abort ();
-
- case OP_SETBIT:
- mpz_set (r, a);
- mpz_setbit (r, bbits);
- break;
- case OP_CLRBIT:
- mpz_set (r, a);
- mpz_clrbit (r, bbits);
- break;
- case OP_COMBIT:
- mpz_set (r, a);
- mpz_combit (r, bbits);
- break;
- case OP_CDIV_Q_2:
- mpz_cdiv_q_2exp (r, a, bbits);
- break;
- case OP_CDIV_R_2:
- mpz_cdiv_r_2exp (r, a, bbits);
- break;
- case OP_FDIV_Q_2:
- mpz_fdiv_q_2exp (r, a, bbits);
- break;
- case OP_FDIV_R_2:
- mpz_fdiv_r_2exp (r, a, bbits);
- break;
- case OP_TDIV_Q_2:
- mpz_tdiv_q_2exp (r, a, bbits);
- break;
- case OP_TDIV_R_2:
- mpz_tdiv_r_2exp (r, a, bbits);
- break;
- }
-
- gmp_asprintf (ap, "%Zx", a);
- *b = bbits;
- gmp_asprintf (rp, "%Zx", r);
-
- mpz_clear (a);
- mpz_clear (r);
-}
-
-void
-hex_random_scan_op (enum hex_random_op op, unsigned long maxbits,
- char **ap, unsigned long *b, unsigned long *r)
-{
- mpz_t a;
- unsigned long abits, bbits;
- unsigned signs;
-
- mpz_init (a);
-
- abits = gmp_urandomb_ui (state, 32) % maxbits;
- bbits = gmp_urandomb_ui (state, 32) % (maxbits + 100);
-
- mpz_rrandomb (a, state, abits);
-
- signs = gmp_urandomb_ui (state, 1);
- if (signs & 1)
- mpz_neg (a, a);
-
- switch (op)
- {
- default:
- abort ();
-
- case OP_SCAN0:
- *r = mpz_scan0 (a, bbits);
- break;
- case OP_SCAN1:
- *r = mpz_scan1 (a, bbits);
- break;
- }
- gmp_asprintf (ap, "%Zx", a);
- *b = bbits;
-
- mpz_clear (a);
-}
-
-void
-hex_random_str_op (unsigned long maxbits,
- int base, char **ap, char **rp)
-{
- mpz_t a;
- unsigned long abits;
- unsigned signs;
-
- mpz_init (a);
-
- abits = gmp_urandomb_ui (state, 32) % maxbits;
-
- mpz_rrandomb (a, state, abits);
-
- signs = gmp_urandomb_ui (state, 2);
- if (signs & 1)
- mpz_neg (a, a);
-
- *ap = mpz_get_str (NULL, 16, a);
- *rp = mpz_get_str (NULL, base, a);
-
- mpz_clear (a);
-}
diff --git a/gmp/mini-gmp/tests/hex-random.h b/gmp/mini-gmp/tests/hex-random.h
deleted file mode 100644
index 7a3913a0bc..0000000000
--- a/gmp/mini-gmp/tests/hex-random.h
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-
-Copyright 2011, 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/. */
-
-enum hex_random_op
- {
- OP_ADD, OP_SUB, OP_MUL, OP_SQR,
- OP_CDIV, OP_FDIV, OP_TDIV,
- OP_CDIV_Q_2, OP_CDIV_R_2,
- OP_FDIV_Q_2, OP_FDIV_R_2,
- OP_TDIV_Q_2, OP_TDIV_R_2,
- OP_GCD, OP_LCM, OP_POWM, OP_AND, OP_IOR, OP_XOR,
- OP_SETBIT, OP_CLRBIT, OP_COMBIT,
- OP_SCAN0, OP_SCAN1,
- };
-
-void hex_random_init (void);
-char *hex_urandomb (unsigned long bits);
-char *hex_rrandomb (unsigned long bits);
-char *hex_rrandomb_export (void *dst, size_t *countp,
- int order, size_t size, int endian,
- unsigned long bits);
-
-void hex_random_op2 (enum hex_random_op op, unsigned long maxbits,
- char **ap, char **rp);
-void hex_random_op3 (enum hex_random_op op, unsigned long maxbits,
- char **ap, char **bp, char **rp);
-void hex_random_op4 (enum hex_random_op op, unsigned long maxbits,
- char **ap, char **bp, char **rp, char **qp);
-void hex_random_bit_op (enum hex_random_op op, unsigned long maxbits,
- char **ap, unsigned long *b, char **rp);
-void hex_random_scan_op (enum hex_random_op op, unsigned long maxbits,
- char **ap, unsigned long *b, unsigned long *r);
-void hex_random_str_op (unsigned long maxbits,
- int base, char **ap, char **rp);
diff --git a/gmp/mini-gmp/tests/mini-random.c b/gmp/mini-gmp/tests/mini-random.c
deleted file mode 100644
index 300d386b2c..0000000000
--- a/gmp/mini-gmp/tests/mini-random.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/*
-
-Copyright 2011, 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 <stdio.h>
-#include <stdlib.h>
-
-#include "mini-random.h"
-
-static void
-set_str (mpz_t r, const char *s)
-{
- if (mpz_set_str (r, s, 16) != 0)
- {
- fprintf (stderr, "mpz_set_str failed on input %s\n", s);
- abort ();
- }
-}
-
-void
-mini_urandomb (mpz_t r, unsigned long bits)
-{
- char *s;
- s = hex_urandomb (bits);
- set_str (r, s);
- free (s);
-}
-
-void
-mini_rrandomb (mpz_t r, unsigned long bits)
-{
- char *s;
- s = hex_rrandomb (bits);
- set_str (r, s);
- free (s);
-}
-
-void
-mini_rrandomb_export (mpz_t r, void *dst, size_t *countp,
- int order, size_t size, int endian, unsigned long bits)
-{
- char *s;
- s = hex_rrandomb_export (dst, countp, order, size, endian, bits);
- set_str (r, s);
- free (s);
-}
-
-void
-mini_random_op2 (enum hex_random_op op, unsigned long maxbits,
- mpz_t a, mpz_t r)
-{
- char *ap;
- char *rp;
-
- hex_random_op2 (op, maxbits, &ap, &rp);
- set_str (a, ap);
- set_str (r, rp);
-
- free (ap);
- free (rp);
-}
-
-void
-mini_random_op3 (enum hex_random_op op, unsigned long maxbits,
- mpz_t a, mpz_t b, mpz_t r)
-{
- char *ap;
- char *bp;
- char *rp;
-
- hex_random_op3 (op, maxbits, &ap, &bp, &rp);
- set_str (a, ap);
- set_str (b, bp);
- set_str (r, rp);
-
- free (ap);
- free (bp);
- free (rp);
-}
-
-void
-mini_random_op4 (enum hex_random_op op, unsigned long maxbits,
- mpz_t a, mpz_t b, mpz_t c, mpz_t d)
-{
- char *ap;
- char *bp;
- char *cp;
- char *dp;
-
- hex_random_op4 (op, maxbits, &ap, &bp, &cp, &dp);
- set_str (a, ap);
- set_str (b, bp);
- set_str (c, cp);
- set_str (d, dp);
-
- free (ap);
- free (bp);
- free (cp);
- free (dp);
-}
-
-void
-mini_random_bit_op (enum hex_random_op op, unsigned long maxbits,
- mpz_t a, mp_bitcnt_t *b, mpz_t r)
-{
- char *ap;
- char *rp;
-
- hex_random_bit_op (op, maxbits, &ap, b, &rp);
- set_str (a, ap);
- set_str (r, rp);
-
- free (ap);
- free (rp);
-}
-
-void
-mini_random_scan_op (enum hex_random_op op, unsigned long maxbits,
- mpz_t a, mp_bitcnt_t *b, mp_bitcnt_t *r)
-{
- char *ap;
-
- hex_random_scan_op (op, maxbits, &ap, b, r);
- set_str (a, ap);
-
- free (ap);
-}
diff --git a/gmp/mini-gmp/tests/mini-random.h b/gmp/mini-gmp/tests/mini-random.h
deleted file mode 100644
index f36c56fc82..0000000000
--- a/gmp/mini-gmp/tests/mini-random.h
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
-
-Copyright 2011, 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 "mini-gmp.h"
-#include "hex-random.h"
-
-void mini_urandomb (mpz_t, unsigned long);
-void mini_rrandomb (mpz_t, unsigned long);
-void mini_rrandomb_export (mpz_t r, void *dst, size_t *countp,
- int order, size_t size, int endian,
- unsigned long bits);
-
-void mini_random_op2 (enum hex_random_op, unsigned long, mpz_t, mpz_t);
-void mini_random_op3 (enum hex_random_op, unsigned long, mpz_t, mpz_t, mpz_t);
-void mini_random_op4 (enum hex_random_op, unsigned long, mpz_t, mpz_t, mpz_t, mpz_t);
-void mini_random_scan_op (enum hex_random_op, unsigned long, mpz_t, mp_bitcnt_t *, mp_bitcnt_t *);
-void mini_random_bit_op (enum hex_random_op, unsigned long, mpz_t, mp_bitcnt_t *, mpz_t);
diff --git a/gmp/mini-gmp/tests/run-tests b/gmp/mini-gmp/tests/run-tests
deleted file mode 100755
index 5fc2952d76..0000000000
--- a/gmp/mini-gmp/tests/run-tests
+++ /dev/null
@@ -1,123 +0,0 @@
-#! /bin/sh
-
-# 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
-# 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.
-
-failed=0
-all=0
-
-debug='no'
-testflags=''
-
-if [ -z "$srcdir" ] ; then
- srcdir=`pwd`
-fi
-
-export srcdir
-
-# When used in make rules, we sometimes get the filenames VPATH
-# expanded, but usually not.
-find_program () {
- case "$1" in
- */*)
- echo "$1"
- ;;
- *)
- if [ -x "$1" ] ; then
- echo "./$1"
- else
- echo "$srcdir/$1"
- fi
- ;;
- esac
-}
-
-env_program () {
- if [ -x "$1" ] ; then
- if "$1"; then : ; else
- echo FAIL: $1
- exit 1
- fi
- fi
-}
-
-test_program () {
- testname=`basename "$1" .exe`
- testname=`basename "$testname" -test`
- if [ -z "$EMULATOR" ] || head -1 "$1" | grep '^#!' > /dev/null; then
- "$1" $testflags
- else
- $EMULATOR "$1" $testflags
- fi
- case "$?" in
- 0)
- echo PASS: $testname
- all=`expr $all + 1`
- ;;
- 77)
- echo SKIP: $testname
- ;;
- *)
- echo FAIL: $testname
- failed=`expr $failed + 1`
- all=`expr $all + 1`
- ;;
- esac
-}
-
-env_program `find_program setup-env`
-
-while test $# != 0
-do
- case "$1" in
- --debug)
- debug=yes
- ;;
- -v)
- testflags='-v'
- ;;
- -*)
- echo >&2 'Unknown option `'"$1'"
- exit 1
- ;;
- *)
- break
- ;;
- esac
- shift
-done
-
-if [ $# -eq 0 ] ; then
- for f in *-test; do test_program "./$f"; done
-else
- for f in "$@" ; do test_program `find_program "$f"`; done
-fi
-
-if [ $failed -eq 0 ] ; then
- banner="All $all tests passed"
-else
- banner="$failed of $all tests failed"
-fi
-dashes=`echo "$banner" | sed s/./=/g`
-echo "$dashes"
-echo "$banner"
-echo "$dashes"
-
-if [ "x$debug" = xno ] ; then
- env_program `find_program teardown-env`
-fi
-
-[ "$failed" -eq 0 ]
diff --git a/gmp/mini-gmp/tests/t-add.c b/gmp/mini-gmp/tests/t-add.c
deleted file mode 100644
index 0a093efd90..0000000000
--- a/gmp/mini-gmp/tests/t-add.c
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a, b, res, ref;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (res);
- mpz_init (ref);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_op3 (OP_ADD, MAXBITS, a, b, ref);
- mpz_add (res, a, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_add 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);
-}
diff --git a/gmp/mini-gmp/tests/t-aorsmul.c b/gmp/mini-gmp/tests/t-aorsmul.c
deleted file mode 100644
index eb275a8088..0000000000
--- a/gmp/mini-gmp/tests/t-aorsmul.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/*
-
-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);
-}
diff --git a/gmp/mini-gmp/tests/t-bitops.c b/gmp/mini-gmp/tests/t-bitops.c
deleted file mode 100644
index 7e1688e662..0000000000
--- a/gmp/mini-gmp/tests/t-bitops.c
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a, res, ref;
- mp_bitcnt_t b;
-
- mpz_init (a);
- mpz_init (res);
- mpz_init (ref);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_bit_op (OP_SETBIT, MAXBITS, a, &b, ref);
- mpz_set (res, a);
- mpz_setbit (res, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_setbit failed:\n");
- dump ("a", a);
- fprintf (stderr, "b: %lu\n", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
- if (!mpz_tstbit (res, b))
- {
- fprintf (stderr, "mpz_tstbit failed (after mpz_setbit):\n");
- dump ("res", a);
- fprintf (stderr, "b: %lu\n", b);
- abort ();
- }
- mini_random_bit_op (OP_CLRBIT, MAXBITS, a, &b, ref);
- mpz_set (res, a);
- mpz_clrbit (res, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_clrbit failed:\n");
- dump ("a", a);
- fprintf (stderr, "b: %lu\n", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
- if (mpz_tstbit (res, b))
- {
- fprintf (stderr, "mpz_tstbit failed (after mpz_clrbit):\n");
- dump ("res", a);
- fprintf (stderr, "b: %lu\n", b);
- abort ();
- }
- mini_random_bit_op (OP_COMBIT, MAXBITS, a, &b, ref);
- mpz_set (res, a);
- mpz_combit (res, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_combit failed:\n");
- dump ("a", a);
- fprintf (stderr, "b: %lu\n", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
- if (mpz_tstbit (res, b) == mpz_tstbit (a, b))
- {
- fprintf (stderr, "mpz_tstbit failed (after mpz_combit):\n");
- dump ("res", a);
- fprintf (stderr, "b: %lu\n", b);
- abort ();
- }
- }
- mpz_clear (a);
- mpz_clear (res);
- mpz_clear (ref);
-}
diff --git a/gmp/mini-gmp/tests/t-cmp_d.c b/gmp/mini-gmp/tests/t-cmp_d.c
deleted file mode 100644
index 4eab278527..0000000000
--- a/gmp/mini-gmp/tests/t-cmp_d.c
+++ /dev/null
@@ -1,283 +0,0 @@
-/* Test mpz_cmp_d and mpz_cmpabs_d.
-
-Copyright 2001-2003, 2005, 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 <math.h>
-
-#include "testutils.h"
-
-/* FIXME: Not sure if the tests here are exhaustive. Ought to try to get
- each possible exit from mpz_cmp_d (and mpz_cmpabs_d) exercised. */
-
-
-#define SGN(n) ((n) > 0 ? 1 : (n) < 0 ? -1 : 0)
-
-
-void
-check_one (const char *name, mpz_srcptr x, double y, int cmp, int cmpabs)
-{
- int got;
-
- got = mpz_cmp_d (x, y);
- if (SGN(got) != cmp)
- {
- int i;
- printf ("mpz_cmp_d wrong (from %s)\n", name);
- printf (" got %d\n", got);
- printf (" want %d\n", cmp);
- fail:
- printf (" x=");
- mpz_out_str (stdout, 10, x);
- printf ("\n y %g\n", y);
- printf (" x=0x");
- mpz_out_str (stdout, -16, x);
- printf ("\n y %g\n", y);
- printf (" y");
- for (i = 0; i < sizeof(y); i++)
- printf (" %02X", (unsigned) ((unsigned char *) &y)[i]);
- printf ("\n");
- abort ();
- }
-
- got = mpz_cmpabs_d (x, y);
- if (SGN(got) != cmpabs)
- {
- printf ("mpz_cmpabs_d wrong\n");
- printf (" got %d\n", got);
- printf (" want %d\n", cmpabs);
- goto fail;
- }
-}
-
-void
-check_data (void)
-{
- static const struct {
- const char *x;
- double y;
- int cmp, cmpabs;
-
- } data[] = {
-
- { "0", 0.0, 0, 0 },
-
- { "1", 0.0, 1, 1 },
- { "-1", 0.0, -1, 1 },
-
- { "1", 0.5, 1, 1 },
- { "-1", -0.5, -1, 1 },
-
- { "0", 1.0, -1, -1 },
- { "0", -1.0, 1, -1 },
-
- { "0x1000000000000000000000000000000000000000000000000", 1.0, 1, 1 },
- { "-0x1000000000000000000000000000000000000000000000000", 1.0, -1, 1 },
-
- { "0", 1e100, -1, -1 },
- { "0", -1e100, 1, -1 },
-
- { "2", 1.5, 1, 1 },
- { "2", -1.5, 1, 1 },
- { "-2", 1.5, -1, 1 },
- { "-2", -1.5, -1, 1 },
- };
-
- mpz_t x;
- int i;
-
- mpz_init (x);
-
- for (i = 0; i < numberof (data); i++)
- {
- mpz_set_str_or_abort (x, data[i].x, 0);
- check_one ("check_data", x, data[i].y, data[i].cmp, data[i].cmpabs);
- }
-
- mpz_clear (x);
-}
-
-
-/* Equality of integers with up to 53 bits */
-void
-check_onebits (void)
-{
- mpz_t x, x2;
- double y;
- int i;
-
- mpz_init_set_ui (x, 0L);
- mpz_init (x2);
-
- for (i = 0; i < 512; i++)
- {
- mpz_mul_2exp (x, x, 1);
- mpz_add_ui (x, x, 1L);
-
- y = mpz_get_d (x);
- mpz_set_d (x2, y);
-
- /* stop if any truncation is occurring */
- if (mpz_cmp (x, x2) != 0)
- break;
-
- check_one ("check_onebits", x, y, 0, 0);
- check_one ("check_onebits", x, -y, 1, 0);
- mpz_neg (x, x);
- check_one ("check_onebits", x, y, -1, 0);
- check_one ("check_onebits", x, -y, 0, 0);
- mpz_neg (x, x);
- }
-
- mpz_clear (x);
- mpz_clear (x2);
-}
-
-
-/* With the mpz differing by 1, in a limb position possibly below the double */
-void
-check_low_z_one (void)
-{
- mpz_t x;
- double y;
- unsigned long i;
-
- mpz_init (x);
-
- /* FIXME: It'd be better to base this on the float format. */
-#if defined (__vax) || defined (__vax__)
-#define LIM 127 /* vax fp numbers have limited range */
-#else
-#define LIM 512
-#endif
-
- for (i = 1; i < LIM; i++)
- {
- mpz_set_ui (x, 1L);
- mpz_mul_2exp (x, x, i);
- y = mpz_get_d (x);
-
- check_one ("check_low_z_one", x, y, 0, 0);
- check_one ("check_low_z_one", x, -y, 1, 0);
- mpz_neg (x, x);
- check_one ("check_low_z_one", x, y, -1, 0);
- check_one ("check_low_z_one", x, -y, 0, 0);
- mpz_neg (x, x);
-
- mpz_sub_ui (x, x, 1);
-
- check_one ("check_low_z_one", x, y, -1, -1);
- check_one ("check_low_z_one", x, -y, 1, -1);
- mpz_neg (x, x);
- check_one ("check_low_z_one", x, y, -1, -1);
- check_one ("check_low_z_one", x, -y, 1, -1);
- mpz_neg (x, x);
-
- mpz_add_ui (x, x, 2);
-
- check_one ("check_low_z_one", x, y, 1, 1);
- check_one ("check_low_z_one", x, -y, 1, 1);
- mpz_neg (x, x);
- check_one ("check_low_z_one", x, y, -1, 1);
- check_one ("check_low_z_one", x, -y, -1, 1);
- mpz_neg (x, x);
- }
-
- mpz_clear (x);
-}
-
-/* Comparing 1 and 1+2^-n. "y" is volatile to make gcc store and fetch it,
- which forces it to a 64-bit double, whereas on x86 it would otherwise
- remain on the float stack as an 80-bit long double. */
-void
-check_one_2exp (void)
-{
- double e;
- mpz_t x;
- volatile double y;
- int i;
-
- mpz_init (x);
-
- e = 1.0;
- for (i = 0; i < 128; i++)
- {
- e /= 2.0;
- y = 1.0 + e;
- if (y == 1.0)
- break;
-
- mpz_set_ui (x, 1L);
- check_one ("check_one_2exp", x, y, -1, -1);
- check_one ("check_one_2exp", x, -y, 1, -1);
-
- mpz_set_si (x, -1L);
- check_one ("check_one_2exp", x, y, -1, -1);
- check_one ("check_one_2exp", x, -y, 1, -1);
- }
-
- mpz_clear (x);
-}
-
-void
-check_infinity (void)
-{
- mpz_t x;
- double y = HUGE_VAL;
- if (y != 2*y)
- return;
-
- mpz_init (x);
-
- /* 0 cmp inf */
- mpz_set_ui (x, 0L);
- check_one ("check_infinity", x, y, -1, -1);
- check_one ("check_infinity", x, -y, 1, -1);
-
- /* 123 cmp inf */
- mpz_set_ui (x, 123L);
- check_one ("check_infinity", x, y, -1, -1);
- check_one ("check_infinity", x, -y, 1, -1);
-
- /* -123 cmp inf */
- mpz_set_si (x, -123L);
- check_one ("check_infinity", x, y, -1, -1);
- check_one ("check_infinity", x, -y, 1, -1);
-
- /* 2^5000 cmp inf */
- mpz_set_ui (x, 1L);
- mpz_mul_2exp (x, x, 5000L);
- check_one ("check_infinity", x, y, -1, -1);
- check_one ("check_infinity", x, -y, 1, -1);
-
- /* -2^5000 cmp inf */
- mpz_neg (x, x);
- check_one ("check_infinity", x, y, -1, -1);
- check_one ("check_infinity", x, -y, 1, -1);
-
- mpz_clear (x);
-}
-
-void
-testmain (int argc, char *argv[])
-{
- check_data ();
- check_onebits ();
- check_low_z_one ();
- check_one_2exp ();
- check_infinity ();
-}
diff --git a/gmp/mini-gmp/tests/t-comb.c b/gmp/mini-gmp/tests/t-comb.c
deleted file mode 100644
index 31ee5a6ad6..0000000000
--- a/gmp/mini-gmp/tests/t-comb.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* Exercise mpz_fac_ui and mpz_bin_uiui.
-
-Copyright 2000-2002, 2012, 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 <stdio.h>
-#include <stdlib.h>
-
-#include "testutils.h"
-
-/* Usage: t-fac_ui [x|num]
-
- With no arguments testing goes up to the initial value of "limit" below.
- With a number argument tests are carried that far, or with a literal "x"
- tests are continued without limit (this being meant only for development
- purposes). */
-
-void
-try_mpz_bin_uiui (mpz_srcptr want, unsigned long n, unsigned long k)
-{
- mpz_t got;
-
- mpz_init (got);
- mpz_bin_uiui (got, n, k);
- if (mpz_cmp (got, want) != 0)
- {
- printf ("mpz_bin_uiui wrong\n");
- printf (" n=%lu\n", n);
- printf (" k=%lu\n", k);
- printf (" got="); mpz_out_str (stdout, 10, got); printf ("\n");
- printf (" want="); mpz_out_str (stdout, 10, want); printf ("\n");
- abort();
- }
- mpz_clear (got);
-}
-
-/* Test all bin(n,k) cases, with 0 <= k <= n + 1 <= count. */
-void
-bin_smallexaustive (unsigned int count)
-{
- mpz_t want;
- unsigned long n, k;
-
- mpz_init (want);
-
- for (n = 0; n < count; n++)
- {
- mpz_set_ui (want, 1);
- for (k = 0; k <= n; k++)
- {
- try_mpz_bin_uiui (want, n, k);
- mpz_mul_ui (want, want, n - k);
- mpz_fdiv_q_ui (want, want, k + 1);
- }
- try_mpz_bin_uiui (want, n, k);
- }
-
- mpz_clear (want);
-}
-
-/* Test all fac(n) cases, with 0 <= n <= limit. */
-void
-fac_smallexaustive (unsigned int limit)
-{
- mpz_t f, r;
- unsigned long n;
- mpz_init_set_si (f, 1); /* 0! = 1 */
- mpz_init (r);
-
- for (n = 0; n < limit; n++)
- {
- mpz_fac_ui (r, n);
-
- if (mpz_cmp (f, r) != 0)
- {
- printf ("mpz_fac_ui(%lu) wrong\n", n);
- printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, f); printf("\n");
- abort ();
- }
-
- mpz_mul_ui (f, f, n+1); /* (n+1)! = n! * (n+1) */
- }
-
- mpz_clear (f);
- mpz_clear (r);
-}
-
-void checkWilson (mpz_t f, unsigned long n)
-{
- unsigned long m;
-
- mpz_fac_ui (f, n - 1);
- m = mpz_fdiv_ui (f, n);
- if ( m != n - 1)
- {
- printf ("mpz_fac_ui(%lu) wrong\n", n - 1);
- printf (" Wilson's theorem not verified: got %lu, expected %lu.\n",m ,n - 1);
- abort ();
- }
-}
-
-void
-checkprimes (unsigned long p1, unsigned long p2, unsigned long p3)
-{
- mpz_t b, f;
-
- if (p1 - 1 != p2 - 1 + p3 - 1)
- {
- printf ("checkprimes(%lu, %lu, %lu) wrong\n", p1, p2, p3);
- printf (" %lu - 1 != %lu - 1 + %lu - 1 \n", p1, p2, p3);
- abort ();
- }
-
- mpz_init (b);
- mpz_init (f);
-
- checkWilson (b, p1); /* b = (p1-1)! */
- checkWilson (f, p2); /* f = (p2-1)! */
- mpz_divexact (b, b, f);
- checkWilson (f, p3); /* f = (p3-1)! */
- mpz_divexact (b, b, f); /* b = (p1-1)!/((p2-1)!(p3-1)!) */
- mpz_bin_uiui (f, p1 - 1, p2 - 1);
- if (mpz_cmp (f, b) != 0)
- {
- printf ("checkprimes(%lu, %lu, %lu) wrong\n", p1, p2, p3);
- printf (" got "); mpz_out_str (stdout, 10, b); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, f); printf("\n");
- abort ();
- }
-
- mpz_clear (b);
- mpz_clear (f);
-
-}
-
-void
-testmain (int argc, char *argv[])
-{
- unsigned long limit = 128;
-
- if (argc > 1 && argv[1][0] == 'x')
- limit = ~ limit;
- else if (argc > 1)
- limit = atoi (argv[1]);
-
- checkprimes(1009, 733, 277);
- fac_smallexaustive (limit);
- bin_smallexaustive (limit);
-}
diff --git a/gmp/mini-gmp/tests/t-cong.c b/gmp/mini-gmp/tests/t-cong.c
deleted file mode 100644
index 8ddfe9bf46..0000000000
--- a/gmp/mini-gmp/tests/t-cong.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* 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);
-}
diff --git a/gmp/mini-gmp/tests/t-div.c b/gmp/mini-gmp/tests/t-div.c
deleted file mode 100644
index a114a0f180..0000000000
--- a/gmp/mini-gmp/tests/t-div.c
+++ /dev/null
@@ -1,254 +0,0 @@
-/*
-
-Copyright 2012, 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 <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-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);
-typedef unsigned long div_x_ui_func (mpz_t, const mpz_t, unsigned long);
-typedef unsigned long div_ui_func (const mpz_t, unsigned long);
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a, b, q, r, rq, rr;
- int div_p;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (r);
- mpz_init (q);
- mpz_init (rr);
- mpz_init (rq);
-
- for (i = 0; i < COUNT; i++)
- {
- unsigned j;
- for (j = 0; j < 3; j++)
- {
- static const enum hex_random_op ops[3] = { OP_CDIV, OP_FDIV, OP_TDIV };
- static const char name[3] = { 'c', 'f', 't'};
- static div_qr_func * const div_qr [3] =
- {
- mpz_cdiv_qr, mpz_fdiv_qr, mpz_tdiv_qr
- };
- static div_qr_ui_func *div_qr_ui[3] =
- {
- mpz_cdiv_qr_ui, mpz_fdiv_qr_ui, mpz_tdiv_qr_ui
- };
- static div_func * const div_q [3] =
- {
- mpz_cdiv_q, mpz_fdiv_q, mpz_tdiv_q
- };
- static div_x_ui_func *div_q_ui[3] =
- {
- mpz_cdiv_q_ui, mpz_fdiv_q_ui, mpz_tdiv_q_ui
- };
- static div_func * const div_r [3] =
- {
- mpz_cdiv_r, mpz_fdiv_r, mpz_tdiv_r
- };
- static div_x_ui_func *div_r_ui[3] =
- {
- mpz_cdiv_r_ui, mpz_fdiv_r_ui, mpz_tdiv_r_ui
- };
- static div_ui_func *div_ui[3] =
- {
- mpz_cdiv_ui, mpz_fdiv_ui, mpz_tdiv_ui
- };
-
- mini_random_op4 (ops[j], MAXBITS, a, b, rq, rr);
- div_qr[j] (q, r, a, b);
- if (mpz_cmp (r, rr) || mpz_cmp (q, rq))
- {
- fprintf (stderr, "mpz_%cdiv_qr failed:\n", name[j]);
- dump ("a", a);
- dump ("b", b);
- dump ("r ", r);
- dump ("rref", rr);
- dump ("q ", q);
- dump ("qref", rq);
- abort ();
- }
- mpz_set_si (q, -5);
- div_q[j] (q, a, b);
- if (mpz_cmp (q, rq))
- {
- fprintf (stderr, "mpz_%cdiv_q failed:\n", name[j]);
- dump ("a", a);
- dump ("b", b);
- dump ("q ", q);
- dump ("qref", rq);
- abort ();
- }
- mpz_set_ui (r, ~5);
- div_r[j] (r, a, b);
- if (mpz_cmp (r, rr))
- {
- fprintf (stderr, "mpz_%cdiv_r failed:\n", name[j]);
- dump ("a", a);
- dump ("b", b);
- dump ("r ", r);
- dump ("rref", rr);
- abort ();
- }
-
- if (j == 0) /* do this once, not for all roundings */
- {
- div_p = mpz_divisible_p (a, b);
- if ((mpz_sgn (r) == 0) ^ (div_p != 0))
- {
- fprintf (stderr, "mpz_divisible_p failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r ", r);
- abort ();
- }
- }
-
- if (j == 0 && mpz_sgn (b) < 0) /* ceil, negative divisor */
- {
- mpz_mod (r, a, b);
- if (mpz_cmp (r, rr))
- {
- fprintf (stderr, "mpz_mod failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r ", r);
- dump ("rref", rr);
- abort ();
- }
- }
-
- if (j == 1 && mpz_sgn (b) > 0) /* floor, positive divisor */
- {
- mpz_mod (r, a, b);
- if (mpz_cmp (r, rr))
- {
- fprintf (stderr, "mpz_mod failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r ", r);
- dump ("rref", rr);
- abort ();
- }
- }
-
- if (mpz_fits_ulong_p (b))
- {
- mp_limb_t rl;
-
- rl = div_qr_ui[j] (q, r, a, mpz_get_ui (b));
- if (rl != mpz_get_ui (rr)
- || mpz_cmp (r, rr) || mpz_cmp (q, rq))
- {
- fprintf (stderr, "mpz_%cdiv_qr_ui failed:\n", name[j]);
- dump ("a", a);
- dump ("b", b);
- fprintf(stderr, "rl = %lx\n", rl);
- dump ("r ", r);
- dump ("rref", rr);
- dump ("q ", q);
- dump ("qref", rq);
- abort ();
- }
-
- mpz_set_si (q, 3);
- rl = div_q_ui[j] (q, a, mpz_get_ui (b));
- if (rl != mpz_get_ui (rr) || mpz_cmp (q, rq))
- {
- fprintf (stderr, "mpz_%cdiv_q_ui failed:\n", name[j]);
- dump ("a", a);
- dump ("b", b);
- fprintf(stderr, "rl = %lx\n", rl);
- dump ("rref", rr);
- dump ("q ", q);
- dump ("qref", rq);
- abort ();
- }
-
- mpz_set_ui (r, 7);
- rl = div_r_ui[j] (r, a, mpz_get_ui (b));
- if (rl != mpz_get_ui (rr) || mpz_cmp (r, rr))
- {
- fprintf (stderr, "mpz_%cdiv_qr_ui failed:\n", name[j]);
- dump ("a", a);
- dump ("b", b);
- fprintf(stderr, "rl = %lx\n", rl);
- dump ("r ", r);
- dump ("rref", rr);
- abort ();
- }
-
- rl = div_ui[j] (a, mpz_get_ui (b));
- if (rl != mpz_get_ui (rr))
- {
- fprintf (stderr, "mpz_%cdiv_qr_ui failed:\n", name[j]);
- dump ("a", a);
- dump ("b", b);
- fprintf(stderr, "rl = %lx\n", rl);
- dump ("rref", rr);
- abort ();
- }
-
- if (j == 0) /* do this once, not for all roundings */
- {
- div_p = mpz_divisible_ui_p (a, mpz_get_ui (b));
- if ((mpz_sgn (r) == 0) ^ (div_p != 0))
- {
- fprintf (stderr, "mpz_divisible_ui_p failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r ", r);
- abort ();
- }
- }
-
- if (j == 1) /* floor */
- {
- mpz_mod_ui (r, a, mpz_get_ui (b));
- if (mpz_cmp (r, rr))
- {
- fprintf (stderr, "mpz_mod failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r ", r);
- dump ("rref", rr);
- abort ();
- }
- }
- }
- }
- }
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (r);
- mpz_clear (q);
- mpz_clear (rr);
- mpz_clear (rq);
-}
diff --git a/gmp/mini-gmp/tests/t-div_2exp.c b/gmp/mini-gmp/tests/t-div_2exp.c
deleted file mode 100644
index 53d3f2b84d..0000000000
--- a/gmp/mini-gmp/tests/t-div_2exp.c
+++ /dev/null
@@ -1,82 +0,0 @@
-/*
-
-Copyright 2012, 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 <assert.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-typedef void div_func (mpz_t, const mpz_t, mp_bitcnt_t);
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a, res, ref;
- mp_bitcnt_t b;
-
- mpz_init (a);
- mpz_init (res);
- mpz_init (ref);
-
- for (i = 0; i < COUNT; i++)
- {
- unsigned j;
- for (j = 0; j < 6; j++)
- {
- static const enum hex_random_op ops[6] =
- {
- OP_CDIV_Q_2, OP_CDIV_R_2,
- OP_FDIV_Q_2, OP_FDIV_R_2,
- OP_TDIV_Q_2, OP_TDIV_R_2
- };
- static const char *name[6] =
- {
- "cdiv_q", "cdiv_r",
- "fdiv_q", "fdiv_r",
- "tdiv_q", "tdiv_r"
- };
- static div_func * const div [6] =
- {
- mpz_cdiv_q_2exp, mpz_cdiv_r_2exp,
- mpz_fdiv_q_2exp, mpz_fdiv_r_2exp,
- mpz_tdiv_q_2exp, mpz_tdiv_r_2exp
- };
-
- mini_random_bit_op (ops[j], MAXBITS, a, &b, ref);
- div[j] (res, a, b);
- if (mpz_cmp (ref, res))
- {
- fprintf (stderr, "mpz_%s_2exp failed:\n", name[j]);
- dump ("a", a);
- fprintf (stderr, "b: %lu\n", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
- }
- }
- mpz_clear (a);
- mpz_clear (res);
- mpz_clear (ref);
-}
diff --git a/gmp/mini-gmp/tests/t-double.c b/gmp/mini-gmp/tests/t-double.c
deleted file mode 100644
index 9e8101ecfd..0000000000
--- a/gmp/mini-gmp/tests/t-double.c
+++ /dev/null
@@ -1,138 +0,0 @@
-/*
-
-Copyright 2012, 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 <limits.h>
-#include <math.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "testutils.h"
-
-#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
-
-#define COUNT 10000
-
-static const struct
-{
- double d;
- const char *s;
-} values[] = {
- { 0.0, "0" },
- { 0.3, "0" },
- { -0.3, "0" },
- { M_PI, "3" },
- { M_PI*1e15, "b29430a256d21" },
- { -M_PI*1e15, "-b29430a256d21" },
- /* 17 * 2^{200} =
- 27317946752402834684213355569799764242877450894307478200123392 */
- {0.2731794675240283468421335556979976424288e62,
- "1100000000000000000000000000000000000000000000000000" },
- { 0.0, NULL }
-};
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t x;
-
- for (i = 0; values[i].s; i++)
- {
- char *s;
- mpz_init_set_d (x, values[i].d);
- s = mpz_get_str (NULL, 16, x);
- if (strcmp (s, values[i].s) != 0)
- {
- fprintf (stderr, "mpz_set_d failed:\n"
- "d = %.20g\n"
- "s = %s\n"
- "r = %s\n",
- values[i].d, s, values[i].s);
- abort ();
- }
- testfree (s);
- mpz_clear (x);
- }
-
- mpz_init (x);
-
- for (i = 0; i < COUNT; i++)
- {
- /* Use volatile, to avoid extended precision in floating point
- registers, e.g., on m68k and 80387. */
- volatile double d, f;
- unsigned long m;
- int e;
-
- mini_rrandomb (x, GMP_LIMB_BITS);
- m = mpz_get_ui (x);
- mini_urandomb (x, 8);
- e = mpz_get_ui (x) - 100;
-
- d = ldexp ((double) m, e);
- mpz_set_d (x, d);
- f = mpz_get_d (x);
- if (f != floor (d))
- {
- fprintf (stderr, "mpz_set_d/mpz_get_d failed:\n");
- goto dumperror;
- }
- if ((f == d) ? (mpz_cmp_d (x, d) != 0) : (mpz_cmp_d (x, d) >= 0))
- {
- fprintf (stderr, "mpz_cmp_d (x, d) failed:\n");
- goto dumperror;
- }
- f = d + 1.0;
- if (f > d && ! (mpz_cmp_d (x, f) < 0))
- {
- fprintf (stderr, "mpz_cmp_d (x, f) failed:\n");
- goto dumperror;
- }
-
- d = - d;
-
- mpz_set_d (x, d);
- f = mpz_get_d (x);
- if (f != ceil (d))
- {
- fprintf (stderr, "mpz_set_d/mpz_get_d failed:\n");
- dumperror:
- dump ("x", x);
- fprintf (stderr, "m = %lx, e = %i\n", m, e);
- fprintf (stderr, "d = %.15g\n", d);
- fprintf (stderr, "f = %.15g\n", f);
- fprintf (stderr, "f - d = %.5g\n", f - d);
- abort ();
- }
- if ((f == d) ? (mpz_cmp_d (x, d) != 0) : (mpz_cmp_d (x, d) <= 0))
- {
- fprintf (stderr, "mpz_cmp_d (x, d) failed:\n");
- goto dumperror;
- }
- f = d - 1.0;
- if (f < d && ! (mpz_cmp_d (x, f) > 0))
- {
- fprintf (stderr, "mpz_cmp_d (x, f) failed:\n");
- goto dumperror;
- }
- }
-
- mpz_clear (x);
-}
diff --git a/gmp/mini-gmp/tests/t-gcd.c b/gmp/mini-gmp/tests/t-gcd.c
deleted file mode 100644
index 1278000296..0000000000
--- a/gmp/mini-gmp/tests/t-gcd.c
+++ /dev/null
@@ -1,176 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-/* 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,
- const mpz_t g, const mpz_t s, const mpz_t t)
-{
- mpz_t ta, tb, r;
-
- /* It's not clear that gcd(0,0) is well defined, but we allow it and
- require that gcd(0,0) = 0. */
- if (mpz_sgn (g) < 0)
- return 0;
-
- if (mpz_sgn (a) == 0)
- {
- /* Must have g == abs (b). Any value for s is in some sense "correct",
- but it makes sense to require that s == 0. */
- return mpz_cmpabs (g, b) == 0 && mpz_sgn (s) == 0;
- }
- else if (mpz_sgn (b) == 0)
- {
- /* Must have g == abs (a), s == sign (a) */
- return mpz_cmpabs (g, a) == 0 && mpz_cmp_si (s, mpz_sgn (a)) == 0;
- }
-
- if (mpz_sgn (g) <= 0)
- return 0;
-
- mpz_init (ta);
- mpz_init (tb);
- mpz_init (r);
-
- mpz_mul (ta, s, a);
- mpz_mul (tb, t, b);
- mpz_add (ta, ta, tb);
-
- if (mpz_cmp (ta, g) != 0)
- {
- fail:
- mpz_clear (ta);
- mpz_clear (tb);
- mpz_clear (r);
- return 0;
- }
- mpz_tdiv_qr (ta, r, a, g);
- if (mpz_sgn (r) != 0)
- goto fail;
-
- mpz_tdiv_qr (tb, r, b, g);
- if (mpz_sgn (r) != 0)
- goto fail;
-
- /* Require that 2 |s| < |b/g|, or |s| == 1. */
- if (mpz_cmpabs_ui (s, 1) > 0)
- {
- mpz_mul_2exp (r, s, 1);
- if (mpz_cmpabs (r, tb) > 0)
- goto fail;
- }
-
- /* Require that 2 |t| < |a/g| or |t| == 1*/
- if (mpz_cmpabs_ui (t, 1) > 0)
- {
- mpz_mul_2exp (r, t, 1);
- if (mpz_cmpabs (r, ta) > 0)
- return 0;
- }
-
- mpz_clear (ta);
- mpz_clear (tb);
- mpz_clear (r);
-
- return 1;
-}
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a, b, g, s, t;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (g);
- mpz_init (s);
- mpz_init (t);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_op3 (OP_GCD, MAXBITS, a, b, s);
- mpz_gcd (g, a, b);
- if (mpz_cmp (g, s))
- {
- fprintf (stderr, "mpz_gcd failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", g);
- dump ("ref", s);
- abort ();
- }
- }
-
- for (i = 0; i < COUNT; i++)
- {
- unsigned flags;
- mini_urandomb (a, 32);
- flags = mpz_get_ui (a);
- mini_rrandomb (a, MAXBITS);
- mini_rrandomb (b, MAXBITS);
-
- if (flags % 37 == 0)
- mpz_mul (a, a, b);
- if (flags % 37 == 1)
- mpz_mul (b, a, b);
-
- if (flags & 1)
- mpz_neg (a, a);
- if (flags & 2)
- mpz_neg (b, b);
-
- mpz_gcdext (g, s, t, a, b);
- if (!gcdext_valid_p (a, b, g, s, t))
- {
- fprintf (stderr, "mpz_gcdext failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("g", g);
- dump ("s", s);
- dump ("t", t);
- abort ();
- }
-
- mpz_gcd (s, a, b);
- if (mpz_cmp (g, s))
- {
- fprintf (stderr, "mpz_gcd failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", g);
- dump ("ref", s);
- abort ();
- }
- }
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (g);
- mpz_clear (s);
- mpz_clear (t);
-}
diff --git a/gmp/mini-gmp/tests/t-import.c b/gmp/mini-gmp/tests/t-import.c
deleted file mode 100644
index 66c9d5e8d5..0000000000
--- a/gmp/mini-gmp/tests/t-import.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
-
-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 <string.h>
-
-#include "testutils.h"
-
-#define MAX_WORDS 20
-#define MAX_WORD_SIZE 10
-
-static void
-dump_bytes (const char *label, const unsigned char *s, size_t n)
-{
- size_t i;
- fprintf (stderr, "%s:", label);
- for (i = 0; i < n; i++)
- {
- if (i && (i % 16) == 0)
- fprintf (stderr, "\n");
- fprintf (stderr, " %02x", s[i]);
- }
- fprintf (stderr, "\n");
-}
-
-/* Tests both mpz_import and mpz_export. */
-void
-testmain (int argc, char **argv)
-{
- unsigned char input[MAX_WORDS * MAX_WORD_SIZE];
- unsigned char output[MAX_WORDS * MAX_WORD_SIZE + 2];
- size_t count, in_count, out_count, size;
- int endian, order;
-
- mpz_t a, res;
-
- mpz_init (a);
- mpz_init (res);
-
- for (size = 0; size <= MAX_WORD_SIZE; size++)
- for (count = 0; count <= MAX_WORDS; count++)
- for (endian = -1; endian <= 1; endian++)
- for (order = -1; order <= 1; order += 2)
- {
- mini_rrandomb_export (a, input, &in_count,
- order, size, endian, size*count * 8);
- mpz_import (res, in_count, order, size, endian, 0, input);
- if (mpz_cmp (a, res))
- {
- fprintf (stderr, "mpz_import failed:\n"
- "in_count %lu, out_count %lu, endian = %d, order = %d\n",
- (unsigned long) in_count, (unsigned long) out_count, endian, order);
- dump ("a", a);
- dump ("res", res);
- abort ();
- }
- output[0] = 17;
- output[1+in_count*size] = 17;
-
- mpz_export (output+1, &out_count, order, size, endian, 0, a);
- if (out_count != in_count
- || memcmp (output+1, input, in_count * size)
- || output[0] != 17
- || output[1+in_count*size] != 17)
- {
- fprintf (stderr, "mpz_export failed:\n"
- "in_count %lu, out_count %lu, endian = %d, order = %d\n",
- (unsigned long) in_count, (unsigned long) out_count, endian, order);
- dump_bytes ("input", input, in_count * size);
- dump_bytes ("output", output+1, out_count * size);
- if (output[0] != 17)
- fprintf (stderr, "Overwrite at -1, value %02x\n", output[0]);
- if (output[1+in_count*size] != 17)
- fprintf (stderr, "Overwrite at %lu, value %02x\n",
- (unsigned long) (in_count*size), output[1+in_count*size]);
-
- abort ();
- }
- }
- mpz_clear (a);
- mpz_clear (res);
-}
diff --git a/gmp/mini-gmp/tests/t-invert.c b/gmp/mini-gmp/tests/t-invert.c
deleted file mode 100644
index 496e8d4f53..0000000000
--- a/gmp/mini-gmp/tests/t-invert.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
-
-#define COUNT 10000
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t u, m, p, t;
-
- mpz_init (u);
- mpz_init (m);
- mpz_init (p);
- mpz_init (t);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_urandomb (u, GMP_LIMB_BITS);
- mpz_setbit (u, GMP_LIMB_BITS -1);
-
- mpz_set_ui (m, mpn_invert_limb (u->_mp_d[0]));
- mpz_setbit (m, GMP_LIMB_BITS);
-
- mpz_mul (p, m, u);
-
- mpz_set_ui (t, 0);
- mpz_setbit (t, 2* GMP_LIMB_BITS);
- mpz_sub (t, t, p);
-
- /* Should have 0 < B^2 - m u <= u */
- if (mpz_sgn (t) <= 0 || mpz_cmp (t, u) > 0)
- {
- fprintf (stderr, "mpn_invert_limb failed:\n");
- dump ("u", u);
- dump ("m", m);
- dump ("p", p);
- dump ("t", t);
- abort ();
- }
- }
-
- for (i = 0; i < COUNT; i++)
- {
- mini_urandomb (u, 2*GMP_LIMB_BITS);
- mpz_setbit (u, 2*GMP_LIMB_BITS -1);
-
- mpz_set_ui (m, mpn_invert_3by2 (u->_mp_d[1], u[0]._mp_d[0]));
-
- mpz_setbit (m, GMP_LIMB_BITS);
-
- mpz_mul (p, m, u);
-
- mpz_set_ui (t, 0);
- mpz_setbit (t, 3 * GMP_LIMB_BITS);
- mpz_sub (t, t, p);
-
- /* Should have 0 < B^3 - m u <= u */
- if (mpz_sgn (t) <= 0 || mpz_cmp (t, u) > 0)
- {
- fprintf (stderr, "mpn_invert_3by2 failed:\n");
- dump ("u", u);
- dump ("m", m);
- dump ("p", p);
- dump ("t", t);
- abort ();
- }
- }
-
- mpz_clear (u);
- mpz_clear (m);
- mpz_clear (p);
- mpz_clear (t);
-}
diff --git a/gmp/mini-gmp/tests/t-lcm.c b/gmp/mini-gmp/tests/t-lcm.c
deleted file mode 100644
index f21a39a66a..0000000000
--- a/gmp/mini-gmp/tests/t-lcm.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a, b, g, s;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (g);
- mpz_init (s);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_op3 (OP_LCM, MAXBITS, a, b, s);
- mpz_lcm (g, a, b);
- if (mpz_cmp (g, s))
- {
- fprintf (stderr, "mpz_lcm failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", g);
- dump ("ref", s);
- abort ();
- }
- if (mpz_fits_ulong_p (b))
- {
- mpz_set_si (g, 0);
- mpz_lcm_ui (g, a, mpz_get_ui (b));
- if (mpz_cmp (g, s))
- {
- fprintf (stderr, "mpz_lcm_ui failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", g);
- dump ("ref", s);
- abort ();
- }
- }
- }
-
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (g);
- mpz_clear (s);
-}
diff --git a/gmp/mini-gmp/tests/t-limbs.c b/gmp/mini-gmp/tests/t-limbs.c
deleted file mode 100644
index fa65782db2..0000000000
--- a/gmp/mini-gmp/tests/t-limbs.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
-
-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);
-}
diff --git a/gmp/mini-gmp/tests/t-logops.c b/gmp/mini-gmp/tests/t-logops.c
deleted file mode 100644
index 7e2d68187a..0000000000
--- a/gmp/mini-gmp/tests/t-logops.c
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-
-Copyright 2012, 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 <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-void
-testlogops (int count)
-{
- unsigned i;
- mpz_t a, b, res, ref;
- mp_bitcnt_t c;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (res);
- mpz_init (ref);
-
- for (i = 0; i < count; i++)
- {
- mini_random_op3 (OP_AND, MAXBITS, a, b, ref);
- mpz_and (res, a, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_and failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
-
- mini_random_op3 (OP_IOR, MAXBITS, a, b, ref);
- mpz_ior (res, a, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_ior failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
-
- mini_random_op3 (OP_XOR, MAXBITS, a, b, ref);
- mpz_xor (res, a, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_xor failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
-
- if (i % 8) {
- c = 0;
- mpz_mul_2exp (res, res, i % 8);
- } else if (mpz_sgn (res) >= 0) {
- c = mpz_odd_p (res) != 0;
- mpz_tdiv_q_2exp (res, res, 1);
- } else {
- c = (~ (mp_bitcnt_t) 0) - 3;
- mpz_set_ui (res, 11 << ((i >> 3)%4)); /* set 3 bits */
- }
-
- if (mpz_popcount (res) + c != mpz_hamdist (a, b))
- {
- fprintf (stderr, "mpz_popcount(r) + %lu and mpz_hamdist(a,b) differ:\n", c);
- dump ("a", a);
- dump ("b", b);
- dump ("r", res);
- fprintf (stderr, "mpz_popcount(r) = %lu:\n", mpz_popcount (res));
- fprintf (stderr, "mpz_hamdist(a,b) = %lu:\n", mpz_hamdist (a, b));
- abort ();
- }
- }
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (res);
- mpz_clear (ref);
-}
-
-void
-testmain (int argc, char **argv)
-{
- testhalves (COUNT*2/3, testlogops);
- testlogops (COUNT/3);
-}
diff --git a/gmp/mini-gmp/tests/t-mul.c b/gmp/mini-gmp/tests/t-mul.c
deleted file mode 100644
index 57ec4ed36c..0000000000
--- a/gmp/mini-gmp/tests/t-mul.c
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
-
-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, res_ui, ref, tz;
- mp_limb_t t[2*MAXLIMBS];
- mp_size_t an;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (res);
- mpz_init (res_ui);
- mpz_init (ref);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_op3 (OP_MUL, MAXBITS, a, b, ref);
- mpz_mul (res, a, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_mul failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
- if (mpz_size (a) == mpz_size (b))
- {
- memset (t, 0x55, sizeof(t));
- an = mpz_size (a);
- if (an > 0)
- {
- mpn_mul_n (t, a->_mp_d, b->_mp_d, an);
-
- mpz_roinit_n (tz, t, 2*an);
- if (mpz_cmpabs (tz, ref))
- {
- fprintf (stderr, "mpn_mul_n failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("ref", ref);
- abort ();
- }
- }
- }
- if (mpz_fits_slong_p (b)) {
- mpz_mul_si (res_ui, a, mpz_get_si (b));
- if (mpz_cmp (res_ui, ref))
- {
- fprintf (stderr, "mpz_mul_si failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", res_ui);
- dump ("ref", ref);
- abort ();
- }
- }
- mini_random_op2 (OP_SQR, MAXBITS, a, ref);
- an = mpz_size (a);
- if (an > 0)
- {
- memset (t, 0x33, sizeof(t));
- mpn_sqr (t, mpz_limbs_read (a), an);
-
- mpz_roinit_n (tz, t, 2*an);
- if (mpz_cmp (tz, ref))
- {
- fprintf (stderr, "mpn (squaring) failed:\n");
- dump ("a", a);
- dump ("ref", ref);
- abort ();
- }
- }
- }
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (res);
- mpz_clear (res_ui);
- mpz_clear (ref);
-}
diff --git a/gmp/mini-gmp/tests/t-powm.c b/gmp/mini-gmp/tests/t-powm.c
deleted file mode 100644
index d6c108d47a..0000000000
--- a/gmp/mini-gmp/tests/t-powm.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 1000
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t b, e, m, res, ref;
-
- mpz_init (b);
- mpz_init (e);
- mpz_init (m);
- mpz_init (res);
- mpz_init (ref);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_op4 (OP_POWM, MAXBITS, b, e, m, ref);
- mpz_powm (res, b, e, m);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_powm failed:\n");
- dump ("b", b);
- dump ("e", e);
- dump ("m", m);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
- }
- mpz_clear (b);
- mpz_clear (e);
- mpz_clear (m);
- mpz_clear (res);
- mpz_clear (ref);
-}
diff --git a/gmp/mini-gmp/tests/t-pprime_p.c b/gmp/mini-gmp/tests/t-pprime_p.c
deleted file mode 100644
index a7ffcdb758..0000000000
--- a/gmp/mini-gmp/tests/t-pprime_p.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* 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 ();
-}
diff --git a/gmp/mini-gmp/tests/t-reuse.c b/gmp/mini-gmp/tests/t-reuse.c
deleted file mode 100644
index 018f8fd632..0000000000
--- a/gmp/mini-gmp/tests/t-reuse.c
+++ /dev/null
@@ -1,663 +0,0 @@
-/* Test that routines allow reusing a source variable as destination.
-
-Copyright 1996, 1999-2002, 2009, 2012 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 <string.h>
-
-#include "testutils.h"
-
-#define COUNT 100
-
-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);
-typedef void (*dsi_func) (mpz_t, const mpz_t, unsigned long int);
-typedef unsigned long int (*dsi_div_func) (mpz_t, const mpz_t, unsigned long int);
-typedef unsigned long int (*ddsi_div_func) (mpz_t, mpz_t, const mpz_t, unsigned long int);
-typedef void (*ddss_div_func) (mpz_t, mpz_t, const mpz_t, const mpz_t);
-typedef void (*ds_func) (mpz_t, const mpz_t);
-
-
-void
-mpz_xinvert (mpz_t r, const mpz_t a, const mpz_t b)
-{
- int res;
- res = mpz_invert (r, a, b);
- if (res == 0)
- mpz_set_ui (r, 0);
-}
-
-dss_func dss_funcs[] =
-{
- mpz_add, mpz_sub, mpz_mul,
- mpz_cdiv_q, mpz_cdiv_r, mpz_fdiv_q, mpz_fdiv_r, mpz_tdiv_q, mpz_tdiv_r,
- mpz_xinvert,
- mpz_gcd, mpz_lcm, mpz_and, mpz_ior, mpz_xor
-};
-const char *dss_func_names[] =
-{
- "mpz_add", "mpz_sub", "mpz_mul",
- "mpz_cdiv_q", "mpz_cdiv_r", "mpz_fdiv_q", "mpz_fdiv_r", "mpz_tdiv_q", "mpz_tdiv_r",
- "mpz_xinvert",
- "mpz_gcd", "mpz_lcm", "mpz_and", "mpz_ior", "mpz_xor"
-};
-char dss_func_division[] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0};
-
-dsi_func dsi_funcs[] =
-{
- /* Don't change order here without changing the code in main(). */
- mpz_add_ui, mpz_mul_ui, mpz_sub_ui,
- mpz_fdiv_q_2exp, mpz_fdiv_r_2exp,
- mpz_cdiv_q_2exp, mpz_cdiv_r_2exp,
- mpz_tdiv_q_2exp, mpz_tdiv_r_2exp,
- mpz_mul_2exp,
- mpz_pow_ui
-};
-const char *dsi_func_names[] =
-{
- "mpz_add_ui", "mpz_mul_ui", "mpz_sub_ui",
- "mpz_fdiv_q_2exp", "mpz_fdiv_r_2exp",
- "mpz_cdiv_q_2exp", "mpz_cdiv_r_2exp",
- "mpz_tdiv_q_2exp", "mpz_tdiv_r_2exp",
- "mpz_mul_2exp",
- "mpz_pow_ui"
-};
-
-dsi_div_func dsi_div_funcs[] =
-{
- mpz_cdiv_q_ui, mpz_cdiv_r_ui,
- mpz_fdiv_q_ui, mpz_fdiv_r_ui,
- mpz_tdiv_q_ui, mpz_tdiv_r_ui
-};
-const char *dsi_div_func_names[] =
-{
- "mpz_cdiv_q_ui", "mpz_cdiv_r_ui",
- "mpz_fdiv_q_ui", "mpz_fdiv_r_ui",
- "mpz_tdiv_q_ui", "mpz_tdiv_r_ui"
-};
-
-ddsi_div_func ddsi_div_funcs[] =
-{
- mpz_cdiv_qr_ui,
- mpz_fdiv_qr_ui,
- mpz_tdiv_qr_ui
-};
-const char *ddsi_div_func_names[] =
-{
- "mpz_cdiv_qr_ui",
- "mpz_fdiv_qr_ui",
- "mpz_tdiv_qr_ui"
-};
-
-ddss_div_func ddss_div_funcs[] =
-{
- mpz_cdiv_qr,
- mpz_fdiv_qr,
- mpz_tdiv_qr
-};
-const char *ddss_div_func_names[] =
-{
- "mpz_cdiv_qr",
- "mpz_fdiv_qr",
- "mpz_tdiv_qr"
-};
-
-ds_func ds_funcs[] =
-{
- mpz_abs, mpz_com, mpz_neg, mpz_sqrt
-};
-const char *ds_func_names[] =
-{
- "mpz_abs", "mpz_com", "mpz_neg", "mpz_sqrt"
-};
-
-
-#define FAIL(class,indx,op1,op2,op3) \
- do { \
- class##_funcs[indx] = 0; \
- dump3 (class##_func_names[indx], op1, op2, op3); \
- failures++; \
- } while (0)
-#define FAIL2(fname,op1,op2,op3) \
- do { \
- dump3 (#fname, op1, op2, op3); \
- failures++; \
- } while (0)
-
-void
-testmain (int argc, char **argv)
-{
- int i;
- int pass, reps = COUNT;
- mpz_t in1, in2, in3;
- unsigned long int in2i;
- mp_size_t size;
- mpz_t res1, res2, res3;
- mpz_t ref1, ref2, ref3;
- mpz_t t;
- unsigned long int r1, r2;
- long failures = 0;
- mpz_t bs;
- unsigned long bsi, size_range;
-
- mpz_init (bs);
-
- mpz_init (in1);
- mpz_init (in2);
- mpz_init (in3);
- mpz_init (ref1);
- mpz_init (ref2);
- mpz_init (ref3);
- mpz_init (res1);
- mpz_init (res2);
- mpz_init (res3);
- mpz_init (t);
-
- for (pass = 1; pass <= reps; pass++)
- {
- mini_urandomb (bs, 32);
- size_range = mpz_get_ui (bs) % 12 + 2;
-
- mini_urandomb (bs, size_range);
- size = mpz_get_ui (bs);
- mini_rrandomb (in1, size);
-
- mini_urandomb (bs, size_range);
- size = mpz_get_ui (bs);
- mini_rrandomb (in2, size);
-
- mini_urandomb (bs, size_range);
- size = mpz_get_ui (bs);
- mini_rrandomb (in3, size);
-
- mini_urandomb (bs, 3);
- bsi = mpz_get_ui (bs);
- if ((bsi & 1) != 0)
- mpz_neg (in1, in1);
- if ((bsi & 2) != 0)
- mpz_neg (in2, in2);
- if ((bsi & 4) != 0)
- mpz_neg (in3, in3);
-
- for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++)
- {
- if (dss_funcs[i] == 0)
- continue;
- if (dss_func_division[i] && mpz_sgn (in2) == 0)
- continue;
-
- (dss_funcs[i]) (ref1, in1, in2);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- (dss_funcs[i]) (res1, res1, in2);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL (dss, i, in1, in2, NULL);
-
- mpz_set (res1, in2);
- (dss_funcs[i]) (res1, in1, res1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL (dss, i, in1, in2, NULL);
- }
-
- for (i = 0; i < sizeof (ddss_div_funcs) / sizeof (ddss_div_func); i++)
- {
- if (ddss_div_funcs[i] == 0)
- continue;
- if (mpz_sgn (in2) == 0)
- continue;
-
- (ddss_div_funcs[i]) (ref1, ref2, in1, in2);
- mpz_check_format (ref1);
- mpz_check_format (ref2);
-
- mpz_set (res1, in1);
- (ddss_div_funcs[i]) (res1, res2, res1, in2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL (ddss_div, i, in1, in2, NULL);
-
- mpz_set (res2, in1);
- (ddss_div_funcs[i]) (res1, res2, res2, in2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL (ddss_div, i, in1, in2, NULL);
-
- mpz_set (res1, in2);
- (ddss_div_funcs[i]) (res1, res2, in1, res1);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL (ddss_div, i, in1, in2, NULL);
-
- mpz_set (res2, in2);
- (ddss_div_funcs[i]) (res1, res2, in1, res2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL (ddss_div, i, in1, in2, NULL);
- }
-
- for (i = 0; i < sizeof (ds_funcs) / sizeof (ds_func); i++)
- {
- if (ds_funcs[i] == 0)
- continue;
- if (strcmp (ds_func_names[i], "mpz_sqrt") == 0
- && mpz_sgn (in1) < 0)
- continue;
-
- (ds_funcs[i]) (ref1, in1);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- (ds_funcs[i]) (res1, res1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL (ds, i, in1, in2, NULL);
- }
-
- in2i = mpz_get_ui (in2);
-
- for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++)
- {
- if (dsi_funcs[i] == 0)
- continue;
- if (strcmp (dsi_func_names[i], "mpz_fdiv_q_2exp") == 0)
- /* Limit exponent to something reasonable for the division
- functions. Without this, we'd normally shift things off
- the end and just generate the trivial values 1, 0, -1. */
- in2i %= 0x1000;
- if (strcmp (dsi_func_names[i], "mpz_mul_2exp") == 0)
- /* Limit exponent more for mpz_mul_2exp to save time. */
- in2i %= 0x100;
- if (strcmp (dsi_func_names[i], "mpz_pow_ui") == 0)
- /* Limit exponent yet more for mpz_pow_ui to save time. */
- in2i %= 0x10;
-
- (dsi_funcs[i]) (ref1, in1, in2i);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- (dsi_funcs[i]) (res1, res1, in2i);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL (dsi, i, in1, in2, NULL);
- }
-
- if (in2i != 0) /* Don't divide by 0. */
- {
- for (i = 0; i < sizeof (dsi_div_funcs) / sizeof (dsi_div_funcs); i++)
- {
- r1 = (dsi_div_funcs[i]) (ref1, in1, in2i);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- r2 = (dsi_div_funcs[i]) (res1, res1, in2i);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0 || r1 != r2)
- FAIL (dsi_div, i, in1, in2, NULL);
- }
-
- for (i = 0; i < sizeof (ddsi_div_funcs) / sizeof (ddsi_div_funcs); i++)
- {
- r1 = (ddsi_div_funcs[i]) (ref1, ref2, in1, in2i);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- r2 = (ddsi_div_funcs[i]) (res1, res2, res1, in2i);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2)
- FAIL (ddsi_div, i, in1, in2, NULL);
-
- mpz_set (res2, in1);
- (ddsi_div_funcs[i]) (res1, res2, res2, in2i);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2)
- FAIL (ddsi_div, i, in1, in2, NULL);
- }
- }
-
- if (mpz_sgn (in1) >= 0)
- {
- mpz_sqrtrem (ref1, ref2, in1);
- mpz_check_format (ref1);
- mpz_check_format (ref2);
-
- mpz_set (res1, in1);
- mpz_sqrtrem (res1, res2, res1);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL2 (mpz_sqrtrem, in1, NULL, NULL);
-
- mpz_set (res2, in1);
- mpz_sqrtrem (res1, res2, res2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL2 (mpz_sqrtrem, in1, NULL, NULL);
- }
-
- if (mpz_sgn (in1) >= 0)
- {
- mpz_root (ref1, in1, in2i % 0x1000 + 1);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- mpz_root (res1, res1, in2i % 0x1000 + 1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_root, in1, in2, NULL);
- }
-
- if (mpz_sgn (in1) >= 0)
- {
- mpz_rootrem (ref1, ref2, in1, in2i % 0x1000 + 1);
- mpz_check_format (ref1);
- mpz_check_format (ref2);
-
- mpz_set (res1, in1);
- mpz_rootrem (res1, res2, res1, in2i % 0x1000 + 1);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL2 (mpz_rootrem, in1, in2, NULL);
-
- mpz_set (res2, in1);
- mpz_rootrem (res1, res2, res2, in2i % 0x1000 + 1);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
- FAIL2 (mpz_rootrem, in1, in2, NULL);
- }
-
- if (pass < reps / 2) /* run fewer tests since gcdext lots of time */
- {
- mpz_gcdext (ref1, ref2, ref3, in1, in2);
- mpz_check_format (ref1);
- mpz_check_format (ref2);
- mpz_check_format (ref3);
-
- mpz_set (res1, in1);
- mpz_gcdext (res1, res2, res3, res1, in2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- mpz_check_format (res3);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res2, in1);
- mpz_gcdext (res1, res2, res3, res2, in2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- mpz_check_format (res3);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res3, in1);
- mpz_gcdext (res1, res2, res3, res3, in2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- mpz_check_format (res3);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res1, in2);
- mpz_gcdext (res1, res2, res3, in1, res1);
- mpz_check_format (res1);
- mpz_check_format (res2);
- mpz_check_format (res3);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res2, in2);
- mpz_gcdext (res1, res2, res3, in1, res2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- mpz_check_format (res3);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res3, in2);
- mpz_gcdext (res1, res2, res3, in1, res3);
- mpz_check_format (res1);
- mpz_check_format (res2);
- mpz_check_format (res3);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res1, in1);
- mpz_gcdext (res1, res2, NULL, res1, in2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res2, in1);
- mpz_gcdext (res1, res2, NULL, res2, in2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res1, in2);
- mpz_gcdext (res1, res2, NULL, in1, res1);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
-
- mpz_set (res2, in2);
- mpz_gcdext (res1, res2, NULL, in1, res2);
- mpz_check_format (res1);
- mpz_check_format (res2);
- if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0
- || mpz_cmp (ref3, res3) != 0)
- FAIL2 (mpz_gcdext, in1, in2, NULL);
- }
-
- /* Don't run mpz_powm for huge exponents or when undefined. */
- if (mpz_sizeinbase (in2, 2) < 250 && mpz_sgn (in3) != 0
- && (mpz_sgn (in2) >= 0 || mpz_invert (t, in1, in3)))
- {
- mpz_powm (ref1, in1, in2, in3);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- mpz_powm (res1, res1, in2, in3);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_powm, in1, in2, in3);
-
- mpz_set (res1, in2);
- mpz_powm (res1, in1, res1, in3);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_powm, in1, in2, in3);
-
- mpz_set (res1, in3);
- mpz_powm (res1, in1, in2, res1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_powm, in1, in2, in3);
- }
-
- /* Don't run mpz_powm_ui when undefined. */
- if (mpz_sgn (in3) != 0)
- {
- mpz_powm_ui (ref1, in1, in2i, in3);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- mpz_powm_ui (res1, res1, in2i, in3);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_powm_ui, in1, in2, in3);
-
- mpz_set (res1, in3);
- mpz_powm_ui (res1, in1, in2i, res1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_powm_ui, in1, in2, in3);
- }
-
- {
- r1 = mpz_gcd_ui (ref1, in1, in2i);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- r2 = mpz_gcd_ui (res1, res1, in2i);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_gcd_ui, in1, in2, NULL);
- }
-#if 0
- if (mpz_cmp_ui (in2, 1L) > 0 && mpz_sgn (in1) != 0)
- {
- /* Test mpz_remove */
- mpz_remove (ref1, in1, in2);
- mpz_check_format (ref1);
-
- mpz_set (res1, in1);
- mpz_remove (res1, res1, in2);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_remove, in1, in2, NULL);
-
- mpz_set (res1, in2);
- mpz_remove (res1, in1, res1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_remove, in1, in2, NULL);
- }
-#endif
- if (mpz_sgn (in2) != 0)
- {
- /* Test mpz_divexact */
- mpz_mul (t, in1, in2);
- mpz_divexact (ref1, t, in2);
- mpz_check_format (ref1);
-
- mpz_set (res1, t);
- mpz_divexact (res1, res1, in2);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_divexact, t, in2, NULL);
-
- mpz_set (res1, in2);
- mpz_divexact (res1, t, res1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_divexact, t, in2, NULL);
- }
-
-#if 0
- if (mpz_sgn (in2) > 0)
- {
- /* Test mpz_divexact_gcd, same as mpz_divexact */
- mpz_mul (t, in1, in2);
- mpz_divexact_gcd (ref1, t, in2);
- mpz_check_format (ref1);
-
- mpz_set (res1, t);
- mpz_divexact_gcd (res1, res1, in2);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_divexact_gcd, t, in2, NULL);
-
- mpz_set (res1, in2);
- mpz_divexact_gcd (res1, t, res1);
- mpz_check_format (res1);
- if (mpz_cmp (ref1, res1) != 0)
- FAIL2 (mpz_divexact_gcd, t, in2, NULL);
- }
-#endif
- }
-
- if (failures != 0)
- {
- fprintf (stderr, "mpz/reuse: %ld error%s\n", failures, "s" + (failures == 1));
- exit (1);
- }
-
- mpz_clear (bs);
- mpz_clear (in1);
- mpz_clear (in2);
- mpz_clear (in3);
- mpz_clear (ref1);
- mpz_clear (ref2);
- mpz_clear (ref3);
- mpz_clear (res1);
- mpz_clear (res2);
- mpz_clear (res3);
- mpz_clear (t);
-}
-
-void
-dump3 (const char *name, mpz_t in1, mpz_t in2, mpz_t in3)
-{
- printf ("failure in %s (", name);
- mpz_out_str (stdout, -16, in1);
- if (in2 != NULL)
- {
- printf (" ");
- mpz_out_str (stdout, -16, in2);
- }
- if (in3 != NULL)
- {
- printf (" ");
- mpz_out_str (stdout, -16, in3);
- }
- printf (")\n");
-}
-
-void
-mpz_check_format (const mpz_t x)
-{
- mp_size_t n = x ->_mp_size;
- if (n < 0)
- n = - n;
-
- if (n > x->_mp_alloc)
- {
- fprintf (stderr, "mpz_t size exceeds allocation!\n");
- abort ();
- }
-
- if (n > 0 && x->_mp_d[n-1] == 0)
- {
- fprintf (stderr, "Unnormalized mpz_t!\n");
- abort ();
- }
-}
diff --git a/gmp/mini-gmp/tests/t-root.c b/gmp/mini-gmp/tests/t-root.c
deleted file mode 100644
index 1f46c435c0..0000000000
--- a/gmp/mini-gmp/tests/t-root.c
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
-
-Copyright 2012, 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 <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-
-#include "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-/* 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)
-{
- mpz_t t;
-
- mpz_init (t);
- if (mpz_fits_ulong_p (s))
- mpz_ui_pow_ui (t, mpz_get_ui (s), z);
- else
- mpz_pow_ui (t, s, z);
- mpz_sub (t, u, t);
- if ((mpz_sgn (t) != mpz_sgn(u) && mpz_sgn (t) != 0) || mpz_cmp (t, r) != 0)
- {
- mpz_clear (t);
- return 0;
- }
- if (mpz_sgn (s) > 0)
- mpz_add_ui (t, s, 1);
- else
- mpz_sub_ui (t, s, 1);
- mpz_pow_ui (t, t, z);
- if (mpz_cmpabs (t, u) <= 0)
- {
- mpz_clear (t);
- return 0;
- }
-
- mpz_clear (t);
- return 1;
-}
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- unsigned long e;
- mpz_t u, s, r, bs;
-
- mpz_init (u);
- mpz_init (s);
- mpz_init (r);
- mpz_init (bs);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_rrandomb (u, MAXBITS);
- mini_rrandomb (bs, 12);
- 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);
-
- if (!rootrem_valid_p (u, s, r, e))
- {
- fprintf (stderr, "mpz_rootrem(%lu-th) failed:\n", e);
- dump ("u", u);
- dump ("root", s);
- dump ("rem", r);
- abort ();
- }
- }
- mpz_clear (bs);
- mpz_clear (u);
- mpz_clear (s);
- mpz_clear (r);
-}
diff --git a/gmp/mini-gmp/tests/t-scan.c b/gmp/mini-gmp/tests/t-scan.c
deleted file mode 100644
index 39b1f35cf4..0000000000
--- a/gmp/mini-gmp/tests/t-scan.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a;
- mp_bitcnt_t b, res, ref;
-
- mpz_init (a);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_scan_op (OP_SCAN0, MAXBITS, a, &b, &ref);
- res = mpz_scan0 (a, b);
- if (res != ref)
- {
- fprintf (stderr, "mpz_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 ();
- }
- 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)
- {
- fprintf (stderr, "mpz_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 ();
- }
- 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);
-}
diff --git a/gmp/mini-gmp/tests/t-signed.c b/gmp/mini-gmp/tests/t-signed.c
deleted file mode 100644
index e2502d6e9f..0000000000
--- a/gmp/mini-gmp/tests/t-signed.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Exercise some mpz_..._si 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 <stdio.h>
-#include <stdlib.h>
-
-#include "testutils.h"
-
-int
-check_si (mpz_t sz, mpz_t oz, long si, long oi, int c)
-{
- mpz_t t;
- int fail;
-
- if (mpz_cmp_si (sz, oi) != c)
- {
- printf ("mpz_cmp_si (sz, %ld) != %i.\n", oi, c);
- printf (" sz="); mpz_out_str (stdout, 10, sz); printf ("\n");
- abort ();
- }
-
- if ((si < oi ? -1 : si > oi) != c)
- return 1;
-
- mpz_init_set_si (t, si);
-
- if ((fail = mpz_cmp_si (sz, si)) != 0)
- printf ("mpz_cmp_si (sz, %ld) != 0.\n", si);
- if (mpz_cmp_si (oz, si) != -c)
- printf ("mpz_cmp_si (oz, %ld) != %i.\n", si, -c), fail = 1;
- if (! mpz_fits_slong_p (sz))
- printf ("mpz_fits_slong_p (sz) != 1.\n"), fail = 1;
- if (mpz_get_si (sz) != si)
- printf ("mpz_get_si (sz) != %ld.\n", si), fail = 1;
- if (mpz_cmp (t, sz) != 0)
- {
- printf ("mpz_init_set_si (%ld) failed.\n", si);
- printf (" got="); mpz_out_str (stdout, 10, t); printf ("\n");
- fail = 1;
- }
-
- mpz_clear (t);
-
- if (fail)
- {
- printf (" sz="); mpz_out_str (stdout, 10, sz); printf ("\n");
- printf (" oz="); mpz_out_str (stdout, 10, oz); printf ("\n");
- printf (" si=%ld\n", si);
- abort ();
- }
-
- return 0;
-}
-
-void
-try_op_si (int c)
-{
- long si, oi;
- mpz_t sz, oz;
-
- si = c;
- mpz_init_set_si (sz, si);
-
- oi = si;
- mpz_init_set (oz, sz);
-
- do {
- si *= 2; /* c * 2^k */
- mpz_mul_2exp (sz, sz, 1);
-
- if (check_si (sz, oz, si, oi, c))
- {
- mpz_set (oz, sz);
- break;
- }
-
- oi = si + c; /* c * (2^k + 1) */
- if (c == -1)
- mpz_sub_ui (oz, sz, 1);
- else
- mpz_add_ui (oz, sz, 1);
-
- if (check_si (oz, sz, oi, si, c))
- break;
-
- oi = (si - c) * 2 + c; /* c * (2^K - 1) */
- mpz_mul_si (oz, sz, 2*c);
- if (c == -1)
- mpz_ui_sub (oz, 1, oz); /* oz = sz * 2 + 1 */
- else
- mpz_sub_ui (oz, oz, 1); /* oz = sz * 2 - 1 */
- } while (check_si (oz, sz, oi, si, c) == 0);
-
- mpz_clear (sz);
-
- if (mpz_fits_slong_p (oz))
- {
- printf ("Should not fit a signed long any more.\n");
- printf (" oz="); mpz_out_str (stdout, 10, oz); printf ("\n");
- abort ();
- }
-
- if (mpz_cmp_si (oz, -c) != c)
- {
- printf ("mpz_cmp_si (oz, %i) != %i.\n", c, c);
- printf (" oz="); mpz_out_str (stdout, 10, oz); printf ("\n");
- abort ();
- }
-
- mpz_mul_2exp (oz, oz, 1);
- if (mpz_cmp_si (oz, -c) != c)
- {
- printf ("mpz_cmp_si (oz, %i) != %i.\n", c, c);
- printf (" oz="); mpz_out_str (stdout, 10, oz); printf ("\n");
- abort ();
- }
-
- mpz_clear (oz);
-}
-
-void
-testmain (int argc, char *argv[])
-{
- try_op_si (-1);
- try_op_si (1);
-}
diff --git a/gmp/mini-gmp/tests/t-sqrt.c b/gmp/mini-gmp/tests/t-sqrt.c
deleted file mode 100644
index f4ce7cbb4d..0000000000
--- a/gmp/mini-gmp/tests/t-sqrt.c
+++ /dev/null
@@ -1,181 +0,0 @@
-/*
-
-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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 9000
-
-/* Called when s is supposed to be floor(sqrt(u)), and r = u - s^2 */
-static int
-sqrtrem_valid_p (const mpz_t u, const mpz_t s, const mpz_t r)
-{
- mpz_t t;
-
- mpz_init (t);
- mpz_mul (t, s, s);
- mpz_sub (t, u, t);
- if (mpz_sgn (t) < 0 || mpz_cmp (t, r) != 0)
- {
- mpz_clear (t);
- return 0;
- }
- mpz_add_ui (t, s, 1);
- mpz_mul (t, t, t);
- if (mpz_cmp (t, u) <= 0)
- {
- mpz_clear (t);
- return 0;
- }
-
- mpz_clear (t);
- 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 (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 - (i & 0xFF));
- mpz_sqrtrem (s, r, u);
-
- if (!sqrtrem_valid_p (u, s, r))
- {
- fprintf (stderr, "mpz_sqrtrem failed:\n");
- dump ("u", u);
- dump ("sqrt", s);
- 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);
- mpz_clear (r);
-}
diff --git a/gmp/mini-gmp/tests/t-str.c b/gmp/mini-gmp/tests/t-str.c
deleted file mode 100644
index 2c384bd1d2..0000000000
--- a/gmp/mini-gmp/tests/t-str.c
+++ /dev/null
@@ -1,307 +0,0 @@
-/*
-
-Copyright 2012, 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 <assert.h>
-#include <limits.h>
-#include <stdlib.h>
-#include <stdio.h>
-#include <string.h>
-
-#include "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 2000
-
-#define GMP_LIMB_BITS (sizeof(mp_limb_t) * CHAR_BIT)
-#define MAXLIMBS ((MAXBITS + GMP_LIMB_BITS - 1) / GMP_LIMB_BITS)
-
-static void
-test_small (void)
-{
- struct {
- const char *input;
- const char *decimal;
- } data[] = {
- { "183407", "183407" },
- { " 763959", "763959" },
- { "9 81999", "981999" },
- { "10\t7398", "107398" },
- { "-9585 44", "-00958544" },
- { "-0", "0000" },
- { " -000 ", "0" },
- { "0704436", "231710" },
- { " 02503517", "689999" },
- { "0 1312143", "365667" },
- { "-03 274062", "-882738" },
- { "012\t242", "005282" },
- { "0b11010111110010001111", "883855" },
- { " 0b11001010010100001", "103585" },
- { "-0b101010110011101111", "-175343" },
- { "0b 1111111011011100110", "521958" },
- { "0b1 1111110111001000011", "1044035" },
- { " 0x53dfc", "343548" },
- { "0xfA019", "1024025" },
- { "0x 642d1", "410321" },
- { "0x5 8067", "360551" },
- { "-0xd6Be6", "-879590" },
- { "\t0B1110000100000000011", "460803" },
- { "0B\t1111110010010100101", "517285" },
- { "0B1\t010111101101110100", "359284" },
- { "-0B101\t1001101111111001", "-367609" },
- { "0B10001001010111110000", "562672" },
- { "0Xe4B7e", "936830" },
- { "0X1E4bf", "124095" },
- { "-0Xfdb90", "-1039248" },
- { "0X7fc47", "523335" },
- { "0X8167c", "530044" },
- /* Some invalid inputs */
- { "0ab", NULL },
- { "10x0", NULL },
- { "0xxab", NULL },
- { "ab", NULL },
- { "0%#", NULL },
- { "$foo", NULL },
- { NULL, NULL }
- };
- unsigned i;
- mpz_t a, b;
- mpz_init (b);
-
- for (i = 0; data[i].input; i++)
- {
- int res = mpz_init_set_str (a, data[i].input, 0);
- if (data[i].decimal)
- {
- if (res != 0)
- {
- fprintf (stderr, "mpz_set_str returned -1, input: %s\n",
- data[i].input);
- abort ();
- }
- if (mpz_set_str (b, data[i].decimal, 10) != 0)
- {
- fprintf (stderr, "mpz_set_str returned -1, decimal input: %s\n",
- data[i].input);
- abort ();
- }
- if (mpz_cmp (a, b) != 0)
- {
- fprintf (stderr, "mpz_set_str failed for input: %s\n",
- data[i].input);
-
- dump ("got", a);
- dump ("ref", b);
- abort ();
- }
- }
- else if (res != -1)
- {
- fprintf (stderr, "mpz_set_str returned %d, invalid input: %s\n",
- res, data[i].input);
- abort ();
- }
- mpz_clear (a);
- }
-
- mpz_clear (b);
-}
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- char *ap;
- char *bp;
- char *rp;
- size_t bn, rn, arn;
-
- mpz_t a, b;
-
- FILE *tmp;
-
- test_small ();
-
- mpz_init (a);
- mpz_init (b);
-
- tmp = tmpfile ();
- if (!tmp)
- fprintf (stderr,
- "Failed to create temporary file. Skipping mpz_out_str tests.\n");
-
- for (i = 0; i < COUNT; i++)
- {
- int base;
- for (base = 0; base <= 36; base += 1 + (base == 0))
- {
- hex_random_str_op (MAXBITS, i&1 ? base: -base, &ap, &rp);
- if (mpz_set_str (a, ap, 16) != 0)
- {
- fprintf (stderr, "mpz_set_str failed on input %s\n", ap);
- abort ();
- }
-
- rn = strlen (rp);
- arn = rn - (rp[0] == '-');
-
- bn = mpz_sizeinbase (a, base ? base : 10);
- if (bn < arn || bn > (arn + 1))
- {
- fprintf (stderr, "mpz_sizeinbase failed:\n");
- dump ("a", a);
- fprintf (stderr, "r = %s\n", rp);
- fprintf (stderr, " base %d, correct size %u, got %u\n",
- base, (unsigned) arn, (unsigned)bn);
- abort ();
- }
- bp = mpz_get_str (NULL, i&1 ? base: -base, a);
- if (strcmp (bp, rp))
- {
- fprintf (stderr, "mpz_get_str failed:\n");
- dump ("a", a);
- fprintf (stderr, "b = %s\n", bp);
- fprintf (stderr, " base = %d\n", base);
- fprintf (stderr, "r = %s\n", rp);
- abort ();
- }
-
- /* Just a few tests with file i/o. */
- if (tmp && i < 20)
- {
- size_t tn;
- rewind (tmp);
- tn = mpz_out_str (tmp, i&1 ? base: -base, a);
- if (tn != rn)
- {
- fprintf (stderr, "mpz_out_str, bad return value:\n");
- dump ("a", a);
- fprintf (stderr, "r = %s\n", rp);
- fprintf (stderr, " base %d, correct size %u, got %u\n",
- base, (unsigned) rn, (unsigned)tn);
- abort ();
- }
- rewind (tmp);
- memset (bp, 0, rn);
- tn = fread (bp, 1, rn, tmp);
- if (tn != rn)
- {
- fprintf (stderr,
- "fread failed, expected %lu bytes, got only %lu.\n",
- (unsigned long) rn, (unsigned long) tn);
- abort ();
- }
-
- if (memcmp (bp, rp, rn) != 0)
- {
- fprintf (stderr, "mpz_out_str failed:\n");
- dump ("a", a);
- fprintf (stderr, "b = %s\n", bp);
- fprintf (stderr, " base = %d\n", base);
- fprintf (stderr, "r = %s\n", rp);
- abort ();
- }
- }
-
- mpz_set_str (b, rp, base);
-
- if (mpz_cmp (a, b))
- {
- fprintf (stderr, "mpz_set_str failed:\n");
- fprintf (stderr, "r = %s\n", rp);
- fprintf (stderr, " base = %d\n", base);
- fprintf (stderr, "r = %s\n", ap);
- fprintf (stderr, " base = 16\n");
- dump ("b", b);
- dump ("r", a);
- abort ();
- }
-
- /* Test mpn interface */
- if (base && mpz_sgn (a))
- {
- size_t i;
- const char *absr;
- mp_limb_t t[MAXLIMBS];
- mp_size_t tn = mpz_size (a);
-
- assert (tn <= MAXLIMBS);
- mpn_copyi (t, a->_mp_d, tn);
-
- bn = mpn_get_str (bp, base, t, tn);
- if (bn != arn)
- {
- fprintf (stderr, "mpn_get_str failed:\n");
- fprintf (stderr, "returned length: %lu (bad)\n", (unsigned long) bn);
- fprintf (stderr, "expected: %lu\n", (unsigned long) arn);
- fprintf (stderr, " base = %d\n", base);
- fprintf (stderr, "r = %s\n", ap);
- fprintf (stderr, " base = 16\n");
- dump ("b", b);
- dump ("r", a);
- abort ();
- }
- absr = rp + (rp[0] == '-');
-
- for (i = 0; i < bn; i++)
- {
- unsigned char digit = absr[i];
- unsigned value;
- if (digit >= '0' && digit <= '9')
- value = digit - '0';
- else if (digit >= 'a' && digit <= 'z')
- value = digit - 'a' + 10;
- else if (digit >= 'A' && digit <= 'Z')
- value = digit - 'A' + 10;
- else
- {
- fprintf (stderr, "Internal error in test.\n");
- abort();
- }
- if (bp[i] != value)
- {
- fprintf (stderr, "mpn_get_str failed:\n");
- fprintf (stderr, "digit %lu: %d (bad)\n", (unsigned long) i, bp[i]);
- fprintf (stderr, "expected: %d\n", value);
- fprintf (stderr, " base = %d\n", base);
- fprintf (stderr, "r = %s\n", ap);
- fprintf (stderr, " base = 16\n");
- dump ("b", b);
- dump ("r", a);
- abort ();
- }
- }
- tn = mpn_set_str (t, bp, bn, base);
- if (tn != mpz_size (a) || mpn_cmp (t, a->_mp_d, tn))
- {
- fprintf (stderr, "mpn_set_str failed:\n");
- fprintf (stderr, "r = %s\n", rp);
- fprintf (stderr, " base = %d\n", base);
- fprintf (stderr, "r = %s\n", ap);
- fprintf (stderr, " base = 16\n");
- dump ("r", a);
- abort ();
- }
- }
- free (ap);
- testfree (bp);
- }
- }
- mpz_clear (a);
- mpz_clear (b);
-}
diff --git a/gmp/mini-gmp/tests/t-sub.c b/gmp/mini-gmp/tests/t-sub.c
deleted file mode 100644
index e230fda1fb..0000000000
--- a/gmp/mini-gmp/tests/t-sub.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
-
-Copyright 2012, 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 "testutils.h"
-
-#define MAXBITS 400
-#define COUNT 10000
-
-void
-testmain (int argc, char **argv)
-{
- unsigned i;
- mpz_t a, b, res, res_ui, ref;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (res);
- mpz_init (res_ui);
- mpz_init (ref);
-
- for (i = 0; i < COUNT; i++)
- {
- mini_random_op3 (OP_SUB, MAXBITS, a, b, ref);
- mpz_sub (res, a, b);
- if (mpz_cmp (res, ref))
- {
- fprintf (stderr, "mpz_sub failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", res);
- dump ("ref", ref);
- abort ();
- }
- if (mpz_fits_ulong_p (a)) {
- mpz_ui_sub (res_ui, mpz_get_ui (a), b);
- if (mpz_cmp (res_ui, ref))
- {
- fprintf (stderr, "mpz_ui_sub failed:\n");
- dump ("a", a);
- dump ("b", b);
- dump ("r", res_ui);
- dump ("ref", ref);
- abort ();
- }
- }
- }
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (res);
- mpz_clear (res_ui);
- mpz_clear (ref);
-}
diff --git a/gmp/mini-gmp/tests/testutils.c b/gmp/mini-gmp/tests/testutils.c
deleted file mode 100644
index c3840b36bc..0000000000
--- a/gmp/mini-gmp/tests/testutils.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
-
-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 "testutils.h"
-
-/* Include it here, so we we could tweak, e.g., how MPZ_REALLOC
- works. */
-#include "../mini-gmp.c"
-
-static size_t total_alloc = 0;
-
-/* Custom memory allocation to track memory usage, and add a small red
- zone.
-
- About alignment: In general, getting a block from malloc, and
- incrementing it by sizeof(size_t), like we do here, might give a
- pointer which is not properly aligned for all types. But the
- largest type we allocate space for is unsigned long (mp_limb_t),
- which shouldn't have stricter alignment requirements than
- size_t. */
-
-static char block_end[8] =
- { 0x7c, 0x37, 0xd6, 0x12, 0xa8, 0x6c, 0x01, 0xd1 };
-
-static void *
-block_init (size_t *block, size_t size)
-{
- char *p;
- *block++ = size;
-
- p = (char *) block;
- memcpy (p + size, block_end, sizeof(block_end));
-
- total_alloc += size;
- return p;
-}
-
-/* Check small redzone, return pointer to malloced block. */
-static size_t *
-block_check (char *p)
-{
- size_t *block = (size_t *) p - 1;
- size_t size = block[0];
-
- if (memcmp (p + size, block_end, sizeof(block_end)) != 0)
- {
- fprintf (stderr, "red zone overwritten.\n");
- abort ();
- }
- total_alloc -= size;
- return block;
-}
-
-static void *
-tu_alloc (size_t size)
-{
- size_t *block = malloc (sizeof(size_t) + size + sizeof(block_end));
- if (!block)
- {
- fprintf (stderr, "Virtual memory exhausted.\n");
- abort ();
- }
-
- return block_init (block, size);
-}
-
-static void *
-tu_realloc (void *p, size_t old_size, size_t new_size)
-{
- size_t *block = block_check (p);
- block = realloc (block, sizeof(size_t) + new_size + sizeof(block_end));
- if (!block)
- {
- fprintf (stderr, "Virtual memory exhausted.\n");
- abort ();
- }
-
- return block_init (block, new_size);
-}
-
-static void
-tu_free (void *p, size_t old_size)
-{
- free (block_check (p));
-}
-
-/* Free memory allocated via mini-gmp allocation function. */
-void
-testfree (void *p)
-{
- void (*freefunc) (void *, size_t);
- mp_get_memory_functions (NULL, NULL, &freefunc);
-
- freefunc (p, 0);
-}
-
-int
-main (int argc, char **argv)
-{
- hex_random_init ();
-
- mp_set_memory_functions (tu_alloc, tu_realloc, tu_free);
-
- /* Currently, t-comb seems to be the only program accepting any
- arguments. It might make sense to parse common arguments here. */
- testmain (argc, argv);
-
- if (total_alloc != 0)
- {
- fprintf (stderr, "Memory leaked: %lu bytes.\n",
- (unsigned long) total_alloc);
- abort ();
- }
- return 0;
-}
-
-void
-testhalves (int count, void (*tested_fun) (int))
-{
- void (*freefunc) (void *, size_t);
- void *(*reallocfunc) (void *, size_t, size_t);
- void *(*allocfunc) (size_t);
- size_t initial_alloc;
-
- mp_get_memory_functions (&allocfunc, &reallocfunc, &freefunc);
- initial_alloc = total_alloc;
- (*tested_fun) (count / 2);
- if (initial_alloc != total_alloc)
- {
- fprintf (stderr, "First half, memory leaked: %lu bytes.\n",
- (unsigned long) total_alloc - initial_alloc);
- abort ();
- }
- mp_set_memory_functions (NULL, NULL, NULL);
- (*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();
- }
-}
diff --git a/gmp/mini-gmp/tests/testutils.h b/gmp/mini-gmp/tests/testutils.h
deleted file mode 100644
index bc56c06a75..0000000000
--- a/gmp/mini-gmp/tests/testutils.h
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
-
-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>
-
-#include "mini-random.h"
-
-#define numberof(x) (sizeof (x) / sizeof ((x)[0]))
-
-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/gmp/missing b/gmp/missing
index 86a8fc31e3..4c6e3b38bb 100755
--- a/gmp/missing
+++ b/gmp/missing
@@ -1,10 +1,10 @@
#! /bin/sh
# Common stub for a few missing GNU programs while installing.
-scriptversion=2012-01-06.13; # UTC
+scriptversion=2003-09-02.23
-# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003, 2004, 2005, 2006,
-# 2008, 2009, 2010, 2011, 2012 Free Software Foundation, Inc.
+# Copyright (C) 1996, 1997, 1999, 2000, 2002, 2003
+# 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,7 +18,9 @@ scriptversion=2012-01-06.13; # UTC
# 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/>.
+# along with this program; if not, write to the Free Software
+# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
+# 02110-1301, USA.
# As a special exception to the GNU General Public License, if you
# distribute this file as part of a program that contains a
@@ -31,8 +33,6 @@ 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,6 +60,11 @@ 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 "\
@@ -77,25 +82,20 @@ 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,40 +104,12 @@ Send bug reports to <bug-automake@gnu.org>."
exit 1
;;
-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.
- ;;
-
- *)
+ aclocal*)
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
@@ -146,7 +118,12 @@ WARNING: \`$1' is $msg. You should only need it if
touch aclocal.m4
;;
- autoconf*)
+ autoconf)
+ 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 \`${configure_ac}'. You might want to install the
@@ -155,7 +132,12 @@ WARNING: \`$1' is $msg. You should only need it if
touch configure
;;
- autoheader*)
+ autoheader)
+ 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 \`acconfig.h' or \`${configure_ac}'. You might want
@@ -165,7 +147,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";;
@@ -175,6 +157,11 @@ 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}'.
@@ -185,7 +172,12 @@ WARNING: \`$1' is $msg. You should only need it if
while read f; do touch "$f"; done
;;
- autom4te*)
+ autom4te)
+ 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 needed, but is $msg.
You might have modified some files without having the
@@ -193,8 +185,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 "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ file=`echo "$*" | sed -n 's/.*--output[ =]*\([^ ]*\).*/\1/p'`
+ test -z "$file" && file=`echo "$*" | sed -n 's/.*-o[ ]*\([^ ]*\).*/\1/p'`
if test -f "$file"; then
touch $file
else
@@ -208,78 +200,90 @@ 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 test $# -ne 1; then
- eval LASTARG=\${$#}
- case $LASTARG in
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
*.y)
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'`
- if test -f "$SRCFILE"; then
+ if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.c
fi
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'`
- if test -f "$SRCFILE"; then
+ if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" y.tab.h
fi
;;
esac
fi
- if test ! -f y.tab.h; then
+ if [ ! -f y.tab.h ]; then
echo >y.tab.h
fi
- if test ! -f y.tab.c; then
+ if [ ! -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 test $# -ne 1; then
- eval LASTARG=\${$#}
- case $LASTARG in
+ if [ $# -ne 1 ]; then
+ eval LASTARG="\${$#}"
+ case "$LASTARG" in
*.l)
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'`
- if test -f "$SRCFILE"; then
+ if [ -f "$SRCFILE" ]; then
cp "$SRCFILE" lex.yy.c
fi
;;
esac
fi
- if test ! -f lex.yy.c; then
+ if [ ! -f lex.yy.c ]; then
echo 'main() { return 0; }' >lex.yy.c
fi
;;
- help2man*)
+ help2man)
+ 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 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 "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
- if test -f "$file"; then
+ 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
touch $file
else
test -z "$file" || exec >$file
echo ".ab help2man is required to generate this page"
- exit $?
+ exit 1
fi
;;
- makeinfo*)
+ makeinfo)
+ if test -z "$run" && (makeinfo --version) > /dev/null 2>&1; then
+ # We have makeinfo, but it failed.
+ exit 1
+ fi
+
echo 1>&2 "\
WARNING: \`$1' is $msg. You should only need it if
you modified a \`.texi' or \`.texinfo' file, or any other file
@@ -287,27 +291,53 @@ 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."
- # The file to touch is that specified with -o ...
- file=`echo "$*" | sed -n "$sed_output"`
- test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"`
+ file=`echo "$*" | sed -n 's/.*-o \([^ ]*\).*/\1/p'`
if test -z "$file"; then
- # ... 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
+ file=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'`
+ file=`sed -n '/^@setfilename/ { s/.* \([^ ]*\) *$/\1/; p; q; }' $file`
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.
@@ -326,6 +356,5 @@ exit 0
# eval: (add-hook 'write-file-hooks 'time-stamp)
# time-stamp-start: "scriptversion="
# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
+# time-stamp-end: "$"
# End:
diff --git a/gmp/mp-h.in b/gmp/mp-h.in
new file mode 100644
index 0000000000..92a6ec4bd9
--- /dev/null
+++ b/gmp/mp-h.in
@@ -0,0 +1,163 @@
+/* mp-h.in -- Definitions for the GNU multiple precision library -*-mode:c-*-
+ BSD mp compatible functions.
+
+Copyright 1991, 1993, 1994, 1995, 1996, 2000, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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/. */
+
+#ifndef __MP_H__
+
+
+/* The following (everything under ifndef __GNU_MP__) must be identical in
+ gmp.h and mp.h to allow both to be included in an application or during
+ the library build. Use the t-gmp-mp-h.pl script to check. */
+#ifndef __GNU_MP__
+#define __GNU_MP__ 4
+
+#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
+
+/* The following instantiated by configure, for internal use only */
+#if ! defined (__GMP_WITHIN_CONFIGURE)
+@DEFN_LONG_LONG_LIMB@
+#define __GMP_LIBGMP_DLL @LIBGMP_DLL@
+#endif
+
+#if defined (__STDC__) \
+ || defined (__cplusplus) \
+ || defined (_AIX) \
+ || defined (__DECC) \
+ || (defined (__mips) && defined (_SYSTYPE_SVR4)) \
+ || defined (_MSC_VER) \
+ || defined (_WIN32)
+#define __GMP_HAVE_CONST 1
+#define __GMP_HAVE_PROTOTYPES 1
+#define __GMP_HAVE_TOKEN_PASTE 1
+#else
+#define __GMP_HAVE_CONST 0
+#define __GMP_HAVE_PROTOTYPES 0
+#define __GMP_HAVE_TOKEN_PASTE 0
+#endif
+
+
+#if __GMP_HAVE_CONST
+#define __gmp_const const
+#define __gmp_signed signed
+#else
+#define __gmp_const
+#define __gmp_signed
+#endif
+
+#if defined (__GNUC__)
+#define __GMP_DECLSPEC_EXPORT __declspec(__dllexport__)
+#define __GMP_DECLSPEC_IMPORT __declspec(__dllimport__)
+#endif
+#if defined (_MSC_VER) || defined (__BORLANDC__)
+#define __GMP_DECLSPEC_EXPORT __declspec(dllexport)
+#define __GMP_DECLSPEC_IMPORT __declspec(dllimport)
+#endif
+#ifdef __WATCOMC__
+#define __GMP_DECLSPEC_EXPORT __export
+#define __GMP_DECLSPEC_IMPORT __import
+#endif
+#ifdef __IBMC__
+#define __GMP_DECLSPEC_EXPORT _Export
+#define __GMP_DECLSPEC_IMPORT _Import
+#endif
+
+#if __GMP_LIBGMP_DLL
+#if __GMP_WITHIN_GMP
+#define __GMP_DECLSPEC __GMP_DECLSPEC_EXPORT
+#else
+#define __GMP_DECLSPEC __GMP_DECLSPEC_IMPORT
+#endif
+#else
+#define __GMP_DECLSPEC
+#endif
+
+#ifdef __GMP_SHORT_LIMB
+typedef unsigned int mp_limb_t;
+typedef int mp_limb_signed_t;
+#else
+#ifdef _LONG_LONG_LIMB
+typedef unsigned long long int mp_limb_t;
+typedef long long int mp_limb_signed_t;
+#else
+typedef unsigned long int mp_limb_t;
+typedef long int mp_limb_signed_t;
+#endif
+#endif
+
+typedef struct
+{
+ int _mp_alloc; /* Number of *limbs* allocated and pointed
+ to by the _mp_d field. */
+ int _mp_size; /* abs(_mp_size) is the number of limbs the
+ last field points to. If _mp_size is
+ negative this is a negative number. */
+ mp_limb_t *_mp_d; /* Pointer to the limbs. */
+} __mpz_struct;
+
+#endif /* __GNU_MP__ */
+
+/* User-visible types. */
+typedef __mpz_struct MINT;
+
+
+#if __GMP_HAVE_PROTOTYPES
+#define __GMP_PROTO(x) x
+#else
+#define __GMP_PROTO(x) ()
+#endif
+
+#if defined (__cplusplus)
+extern "C" {
+#endif
+
+#define mp_set_memory_functions __gmp_set_memory_functions
+__GMP_DECLSPEC void mp_set_memory_functions __GMP_PROTO ((void *(*) (size_t),
+ void *(*) (void *, size_t, size_t),
+ void (*) (void *, size_t)));
+__GMP_DECLSPEC MINT *itom __GMP_PROTO ((signed short int));
+__GMP_DECLSPEC MINT *xtom __GMP_PROTO ((const char *));
+__GMP_DECLSPEC void move __GMP_PROTO ((const MINT *, MINT *));
+__GMP_DECLSPEC void madd __GMP_PROTO ((const MINT *, const MINT *, MINT *));
+__GMP_DECLSPEC void msub __GMP_PROTO ((const MINT *, const MINT *, MINT *));
+__GMP_DECLSPEC void mult __GMP_PROTO ((const MINT *, const MINT *, MINT *));
+__GMP_DECLSPEC void mdiv __GMP_PROTO ((const MINT *, const MINT *, MINT *, MINT *));
+__GMP_DECLSPEC void sdiv __GMP_PROTO ((const MINT *, signed short int, MINT *, signed short int *));
+__GMP_DECLSPEC void msqrt __GMP_PROTO ((const MINT *, MINT *, MINT *));
+__GMP_DECLSPEC void pow __GMP_PROTO ((const MINT *, const MINT *, const MINT *, MINT *));
+__GMP_DECLSPEC void rpow __GMP_PROTO ((const MINT *, signed short int, MINT *));
+__GMP_DECLSPEC void gcd __GMP_PROTO ((const MINT *, const MINT *, MINT *));
+__GMP_DECLSPEC int mcmp __GMP_PROTO ((const MINT *, const MINT *));
+__GMP_DECLSPEC void min __GMP_PROTO ((MINT *));
+__GMP_DECLSPEC void mout __GMP_PROTO ((const MINT *));
+__GMP_DECLSPEC char *mtox __GMP_PROTO ((const MINT *));
+__GMP_DECLSPEC void mfree __GMP_PROTO ((MINT *));
+
+#if defined (__cplusplus)
+}
+#endif
+
+#define __MP_H__
+#endif /* __MP_H__ */
diff --git a/gmp/mp_bpl.c b/gmp/mp_bpl.c
index 6328057965..1e05f34661 100644
--- a/gmp/mp_bpl.c
+++ b/gmp/mp_bpl.c
@@ -4,32 +4,21 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-const int mp_bits_per_limb = GMP_LIMB_BITS;
+const int mp_bits_per_limb = BITS_PER_MP_LIMB;
const int __gmp_0 = 0;
int __gmp_junk;
diff --git a/gmp/mp_clz_tab.c b/gmp/mp_clz_tab.c
index 7c9227e8b3..1e0cee46bf 100644
--- a/gmp/mp_clz_tab.c
+++ b/gmp/mp_clz_tab.c
@@ -9,28 +9,17 @@ Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,12 +27,11 @@ see https://www.gnu.org/licenses/. */
#ifdef COUNT_LEADING_ZEROS_NEED_CLZ_TAB
const
-unsigned char __clz_tab[129] =
+unsigned char __clz_tab[128] =
{
1,2,3,3,4,4,4,4,5,5,5,5,5,5,5,5,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
- 9
+ 8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8
};
#endif
diff --git a/gmp/mp_dv_tab.c b/gmp/mp_dv_tab.c
index c6d74eb3f2..c7e4c13b47 100644
--- a/gmp/mp_dv_tab.c
+++ b/gmp/mp_dv_tab.c
@@ -3,33 +3,22 @@
THE CONTENTS OF THIS FILE ARE FOR INTERNAL USE AND MAY CHANGE
INCOMPATIBLY OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2003, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ see https://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 208, values for bases 37..62 start. Here, 'A' has the value 10
+ At offset 224, values for bases 37..62 start. Here, 'A' has the value 10
(in decimal) and 'a' has the value 36. */
#define X 0xff
@@ -62,6 +51,7 @@ 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,
diff --git a/gmp/mp_get_fns.c b/gmp/mp_get_fns.c
index c77980fbeb..c8c9f9997c 100644
--- a/gmp/mp_get_fns.c
+++ b/gmp/mp_get_fns.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -35,7 +24,7 @@ see https://www.gnu.org/licenses/. */
void
mp_get_memory_functions (void *(**alloc_func) (size_t),
void *(**realloc_func) (void *, size_t, size_t),
- void (**free_func) (void *, size_t)) __GMP_NOTHROW
+ void (**free_func) (void *, size_t))
{
if (alloc_func != NULL)
*alloc_func = __gmp_allocate_func;
diff --git a/gmp/mp_minv_tab.c b/gmp/mp_minv_tab.c
index 522bd0184b..a7f342b7c8 100644
--- a/gmp/mp_minv_tab.c
+++ b/gmp/mp_minv_tab.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mp_set_fns.c b/gmp/mp_set_fns.c
index 7be60066b9..f5402c6fd4 100644
--- a/gmp/mp_set_fns.c
+++ b/gmp/mp_set_fns.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,7 +24,7 @@ see https://www.gnu.org/licenses/. */
void
mp_set_memory_functions (void *(*alloc_func) (size_t),
void *(*realloc_func) (void *, size_t, size_t),
- void (*free_func) (void *, size_t)) __GMP_NOTHROW
+ void (*free_func) (void *, size_t))
{
if (alloc_func == 0)
alloc_func = __gmp_default_allocate;
diff --git a/gmp/mpbsd/Makefile.am b/gmp/mpbsd/Makefile.am
new file mode 100644
index 0000000000..4272bbf970
--- /dev/null
+++ b/gmp/mpbsd/Makefile.am
@@ -0,0 +1,37 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 1996, 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/.
+
+
+# -I$(top_srcdir)/mpz is for #includes done by mpz .c files. Perhaps most
+# compilers are smart enough to look in the same directory as the .c file
+# already, but lets make absolutely sure.
+#
+INCLUDES = -DBERKELEY_MP -D__GMP_WITHIN_GMP -D__gmpz_realloc=_mp_realloc \
+ -I$(top_srcdir) -I$(top_srcdir)/mpz
+
+# The mpz sources here all know to look for -DBERKELEY_MP to compile to in
+# mpbsd form.
+#
+libmpbsd_la_SOURCES = itom.c mfree.c min.c mout.c mtox.c rpow.c sdiv.c xtom.c \
+ ../mpz/add.c ../mpz/cmp.c ../mpz/gcd.c ../mpz/mul.c ../mpz/powm.c \
+ ../mpz/realloc.c ../mpz/set.c ../mpz/sqrtrem.c ../mpz/sub.c ../mpz/tdiv_qr.c
+
+if WANT_MPBSD
+noinst_LTLIBRARIES = libmpbsd.la
+endif
diff --git a/gmp/mpbsd/Makefile.in b/gmp/mpbsd/Makefile.in
new file mode 100644
index 0000000000..e247dc82dd
--- /dev/null
+++ b/gmp/mpbsd/Makefile.in
@@ -0,0 +1,716 @@
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 1996, 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/.
+
+SOURCES = $(libmpbsd_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
+subdir = mpbsd
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+LTLIBRARIES = $(noinst_LTLIBRARIES)
+libmpbsd_la_LIBADD =
+am_libmpbsd_la_OBJECTS = itom$U.lo mfree$U.lo min$U.lo mout$U.lo \
+ mtox$U.lo rpow$U.lo sdiv$U.lo xtom$U.lo add$U.lo cmp$U.lo \
+ gcd$U.lo mul$U.lo powm$U.lo realloc$U.lo set$U.lo sqrtrem$U.lo \
+ sub$U.lo tdiv_qr$U.lo
+libmpbsd_la_OBJECTS = $(am_libmpbsd_la_OBJECTS)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(libmpbsd_la_SOURCES)
+DIST_SOURCES = $(libmpbsd_la_SOURCES)
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4 = @M4@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__leading_dot = @am__leading_dot@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+
+# -I$(top_srcdir)/mpz is for #includes done by mpz .c files. Perhaps most
+# compilers are smart enough to look in the same directory as the .c file
+# already, but lets make absolutely sure.
+#
+INCLUDES = -DBERKELEY_MP -D__GMP_WITHIN_GMP -D__gmpz_realloc=_mp_realloc \
+ -I$(top_srcdir) -I$(top_srcdir)/mpz
+
+
+# The mpz sources here all know to look for -DBERKELEY_MP to compile to in
+# mpbsd form.
+#
+libmpbsd_la_SOURCES = itom.c mfree.c min.c mout.c mtox.c rpow.c sdiv.c xtom.c \
+ ../mpz/add.c ../mpz/cmp.c ../mpz/gcd.c ../mpz/mul.c ../mpz/powm.c \
+ ../mpz/realloc.c ../mpz/set.c ../mpz/sqrtrem.c ../mpz/sub.c ../mpz/tdiv_qr.c
+
+@WANT_MPBSD_TRUE@noinst_LTLIBRARIES = libmpbsd.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpbsd/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps mpbsd/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-noinstLTLIBRARIES:
+ -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
+ @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
+ dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
+ test "$$dir" = "$$p" && dir=.; \
+ echo "rm -f \"$${dir}/so_locations\""; \
+ rm -f "$${dir}/so_locations"; \
+ done
+libmpbsd.la: $(libmpbsd_la_OBJECTS) $(libmpbsd_la_DEPENDENCIES)
+ $(LINK) $(libmpbsd_la_LDFLAGS) $(libmpbsd_la_OBJECTS) $(libmpbsd_la_LIBADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
+
+.c.o:
+ $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
+
+add_.o: add_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add_.o `test -f 'add_.c' || echo '$(srcdir)/'`add_.c
+
+add_.obj: add_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add_.obj `if test -f 'add_.c'; then $(CYGPATH_W) 'add_.c'; else $(CYGPATH_W) '$(srcdir)/add_.c'; fi`
+
+add_.lo: add_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add_.lo `test -f 'add_.c' || echo '$(srcdir)/'`add_.c
+
+add.o: ../mpz/add.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add.o `test -f '../mpz/add.c' || echo '$(srcdir)/'`../mpz/add.c
+
+add.obj: ../mpz/add.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add.obj `if test -f '../mpz/add.c'; then $(CYGPATH_W) '../mpz/add.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/add.c'; fi`
+
+add.lo: ../mpz/add.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o add.lo `test -f '../mpz/add.c' || echo '$(srcdir)/'`../mpz/add.c
+
+cmp_.o: cmp_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmp_.o `test -f 'cmp_.c' || echo '$(srcdir)/'`cmp_.c
+
+cmp_.obj: cmp_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmp_.obj `if test -f 'cmp_.c'; then $(CYGPATH_W) 'cmp_.c'; else $(CYGPATH_W) '$(srcdir)/cmp_.c'; fi`
+
+cmp_.lo: cmp_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmp_.lo `test -f 'cmp_.c' || echo '$(srcdir)/'`cmp_.c
+
+cmp.o: ../mpz/cmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmp.o `test -f '../mpz/cmp.c' || echo '$(srcdir)/'`../mpz/cmp.c
+
+cmp.obj: ../mpz/cmp.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmp.obj `if test -f '../mpz/cmp.c'; then $(CYGPATH_W) '../mpz/cmp.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/cmp.c'; fi`
+
+cmp.lo: ../mpz/cmp.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o cmp.lo `test -f '../mpz/cmp.c' || echo '$(srcdir)/'`../mpz/cmp.c
+
+gcd_.o: gcd_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gcd_.o `test -f 'gcd_.c' || echo '$(srcdir)/'`gcd_.c
+
+gcd_.obj: gcd_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gcd_.obj `if test -f 'gcd_.c'; then $(CYGPATH_W) 'gcd_.c'; else $(CYGPATH_W) '$(srcdir)/gcd_.c'; fi`
+
+gcd_.lo: gcd_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gcd_.lo `test -f 'gcd_.c' || echo '$(srcdir)/'`gcd_.c
+
+gcd.o: ../mpz/gcd.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gcd.o `test -f '../mpz/gcd.c' || echo '$(srcdir)/'`../mpz/gcd.c
+
+gcd.obj: ../mpz/gcd.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gcd.obj `if test -f '../mpz/gcd.c'; then $(CYGPATH_W) '../mpz/gcd.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/gcd.c'; fi`
+
+gcd.lo: ../mpz/gcd.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o gcd.lo `test -f '../mpz/gcd.c' || echo '$(srcdir)/'`../mpz/gcd.c
+
+mul_.o: mul_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mul_.o `test -f 'mul_.c' || echo '$(srcdir)/'`mul_.c
+
+mul_.obj: mul_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mul_.obj `if test -f 'mul_.c'; then $(CYGPATH_W) 'mul_.c'; else $(CYGPATH_W) '$(srcdir)/mul_.c'; fi`
+
+mul_.lo: mul_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mul_.lo `test -f 'mul_.c' || echo '$(srcdir)/'`mul_.c
+
+mul.o: ../mpz/mul.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mul.o `test -f '../mpz/mul.c' || echo '$(srcdir)/'`../mpz/mul.c
+
+mul.obj: ../mpz/mul.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mul.obj `if test -f '../mpz/mul.c'; then $(CYGPATH_W) '../mpz/mul.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/mul.c'; fi`
+
+mul.lo: ../mpz/mul.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o mul.lo `test -f '../mpz/mul.c' || echo '$(srcdir)/'`../mpz/mul.c
+
+powm_.o: powm_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o powm_.o `test -f 'powm_.c' || echo '$(srcdir)/'`powm_.c
+
+powm_.obj: powm_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o powm_.obj `if test -f 'powm_.c'; then $(CYGPATH_W) 'powm_.c'; else $(CYGPATH_W) '$(srcdir)/powm_.c'; fi`
+
+powm_.lo: powm_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o powm_.lo `test -f 'powm_.c' || echo '$(srcdir)/'`powm_.c
+
+powm.o: ../mpz/powm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o powm.o `test -f '../mpz/powm.c' || echo '$(srcdir)/'`../mpz/powm.c
+
+powm.obj: ../mpz/powm.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o powm.obj `if test -f '../mpz/powm.c'; then $(CYGPATH_W) '../mpz/powm.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/powm.c'; fi`
+
+powm.lo: ../mpz/powm.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o powm.lo `test -f '../mpz/powm.c' || echo '$(srcdir)/'`../mpz/powm.c
+
+realloc_.o: realloc_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc_.o `test -f 'realloc_.c' || echo '$(srcdir)/'`realloc_.c
+
+realloc_.obj: realloc_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc_.obj `if test -f 'realloc_.c'; then $(CYGPATH_W) 'realloc_.c'; else $(CYGPATH_W) '$(srcdir)/realloc_.c'; fi`
+
+realloc_.lo: realloc_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc_.lo `test -f 'realloc_.c' || echo '$(srcdir)/'`realloc_.c
+
+realloc.o: ../mpz/realloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc.o `test -f '../mpz/realloc.c' || echo '$(srcdir)/'`../mpz/realloc.c
+
+realloc.obj: ../mpz/realloc.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc.obj `if test -f '../mpz/realloc.c'; then $(CYGPATH_W) '../mpz/realloc.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/realloc.c'; fi`
+
+realloc.lo: ../mpz/realloc.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o realloc.lo `test -f '../mpz/realloc.c' || echo '$(srcdir)/'`../mpz/realloc.c
+
+set_.o: set_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_.o `test -f 'set_.c' || echo '$(srcdir)/'`set_.c
+
+set_.obj: set_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_.obj `if test -f 'set_.c'; then $(CYGPATH_W) 'set_.c'; else $(CYGPATH_W) '$(srcdir)/set_.c'; fi`
+
+set_.lo: set_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set_.lo `test -f 'set_.c' || echo '$(srcdir)/'`set_.c
+
+set.o: ../mpz/set.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set.o `test -f '../mpz/set.c' || echo '$(srcdir)/'`../mpz/set.c
+
+set.obj: ../mpz/set.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set.obj `if test -f '../mpz/set.c'; then $(CYGPATH_W) '../mpz/set.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/set.c'; fi`
+
+set.lo: ../mpz/set.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o set.lo `test -f '../mpz/set.c' || echo '$(srcdir)/'`../mpz/set.c
+
+sqrtrem_.o: sqrtrem_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sqrtrem_.o `test -f 'sqrtrem_.c' || echo '$(srcdir)/'`sqrtrem_.c
+
+sqrtrem_.obj: sqrtrem_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sqrtrem_.obj `if test -f 'sqrtrem_.c'; then $(CYGPATH_W) 'sqrtrem_.c'; else $(CYGPATH_W) '$(srcdir)/sqrtrem_.c'; fi`
+
+sqrtrem_.lo: sqrtrem_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sqrtrem_.lo `test -f 'sqrtrem_.c' || echo '$(srcdir)/'`sqrtrem_.c
+
+sqrtrem.o: ../mpz/sqrtrem.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sqrtrem.o `test -f '../mpz/sqrtrem.c' || echo '$(srcdir)/'`../mpz/sqrtrem.c
+
+sqrtrem.obj: ../mpz/sqrtrem.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sqrtrem.obj `if test -f '../mpz/sqrtrem.c'; then $(CYGPATH_W) '../mpz/sqrtrem.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/sqrtrem.c'; fi`
+
+sqrtrem.lo: ../mpz/sqrtrem.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sqrtrem.lo `test -f '../mpz/sqrtrem.c' || echo '$(srcdir)/'`../mpz/sqrtrem.c
+
+sub_.o: sub_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sub_.o `test -f 'sub_.c' || echo '$(srcdir)/'`sub_.c
+
+sub_.obj: sub_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sub_.obj `if test -f 'sub_.c'; then $(CYGPATH_W) 'sub_.c'; else $(CYGPATH_W) '$(srcdir)/sub_.c'; fi`
+
+sub_.lo: sub_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sub_.lo `test -f 'sub_.c' || echo '$(srcdir)/'`sub_.c
+
+sub.o: ../mpz/sub.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sub.o `test -f '../mpz/sub.c' || echo '$(srcdir)/'`../mpz/sub.c
+
+sub.obj: ../mpz/sub.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sub.obj `if test -f '../mpz/sub.c'; then $(CYGPATH_W) '../mpz/sub.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/sub.c'; fi`
+
+sub.lo: ../mpz/sub.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o sub.lo `test -f '../mpz/sub.c' || echo '$(srcdir)/'`../mpz/sub.c
+
+tdiv_qr_.o: tdiv_qr_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tdiv_qr_.o `test -f 'tdiv_qr_.c' || echo '$(srcdir)/'`tdiv_qr_.c
+
+tdiv_qr_.obj: tdiv_qr_.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tdiv_qr_.obj `if test -f 'tdiv_qr_.c'; then $(CYGPATH_W) 'tdiv_qr_.c'; else $(CYGPATH_W) '$(srcdir)/tdiv_qr_.c'; fi`
+
+tdiv_qr_.lo: tdiv_qr_.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tdiv_qr_.lo `test -f 'tdiv_qr_.c' || echo '$(srcdir)/'`tdiv_qr_.c
+
+tdiv_qr.o: ../mpz/tdiv_qr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tdiv_qr.o `test -f '../mpz/tdiv_qr.c' || echo '$(srcdir)/'`../mpz/tdiv_qr.c
+
+tdiv_qr.obj: ../mpz/tdiv_qr.c
+ $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tdiv_qr.obj `if test -f '../mpz/tdiv_qr.c'; then $(CYGPATH_W) '../mpz/tdiv_qr.c'; else $(CYGPATH_W) '$(srcdir)/../mpz/tdiv_qr.c'; fi`
+
+tdiv_qr.lo: ../mpz/tdiv_qr.c
+ $(LIBTOOL) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o tdiv_qr.lo `test -f '../mpz/tdiv_qr.c' || echo '$(srcdir)/'`../mpz/tdiv_qr.c
+add_.c: ../mpz/add.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/add.c; then echo $(srcdir)/../mpz/add.c; else echo ../mpz/add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_.c: ../mpz/cmp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/cmp.c; then echo $(srcdir)/../mpz/cmp.c; else echo ../mpz/cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcd_.c: ../mpz/gcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/gcd.c; then echo $(srcdir)/../mpz/gcd.c; else echo ../mpz/gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+itom_.c: itom.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/itom.c; then echo $(srcdir)/itom.c; else echo itom.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mfree_.c: mfree.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mfree.c; then echo $(srcdir)/mfree.c; else echo mfree.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+min_.c: min.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/min.c; then echo $(srcdir)/min.c; else echo min.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mout_.c: mout.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mout.c; then echo $(srcdir)/mout.c; else echo mout.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mtox_.c: mtox.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mtox.c; then echo $(srcdir)/mtox.c; else echo mtox.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_.c: ../mpz/mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/mul.c; then echo $(srcdir)/../mpz/mul.c; else echo ../mpz/mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+powm_.c: ../mpz/powm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/powm.c; then echo $(srcdir)/../mpz/powm.c; else echo ../mpz/powm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+realloc_.c: ../mpz/realloc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/realloc.c; then echo $(srcdir)/../mpz/realloc.c; else echo ../mpz/realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rpow_.c: rpow.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rpow.c; then echo $(srcdir)/rpow.c; else echo rpow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sdiv_.c: sdiv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sdiv.c; then echo $(srcdir)/sdiv.c; else echo sdiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_.c: ../mpz/set.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/set.c; then echo $(srcdir)/../mpz/set.c; else echo ../mpz/set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqrtrem_.c: ../mpz/sqrtrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/sqrtrem.c; then echo $(srcdir)/../mpz/sqrtrem.c; else echo ../mpz/sqrtrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_.c: ../mpz/sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/sub.c; then echo $(srcdir)/../mpz/sub.c; else echo ../mpz/sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_qr_.c: ../mpz/tdiv_qr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/../mpz/tdiv_qr.c; then echo $(srcdir)/../mpz/tdiv_qr.c; else echo ../mpz/tdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+xtom_.c: xtom.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xtom.c; then echo $(srcdir)/xtom.c; else echo xtom.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_.$(OBJEXT) add_.lo cmp_.$(OBJEXT) cmp_.lo gcd_.$(OBJEXT) gcd_.lo \
+itom_.$(OBJEXT) itom_.lo mfree_.$(OBJEXT) mfree_.lo min_.$(OBJEXT) \
+min_.lo mout_.$(OBJEXT) mout_.lo mtox_.$(OBJEXT) mtox_.lo \
+mul_.$(OBJEXT) mul_.lo powm_.$(OBJEXT) powm_.lo realloc_.$(OBJEXT) \
+realloc_.lo rpow_.$(OBJEXT) rpow_.lo sdiv_.$(OBJEXT) sdiv_.lo \
+set_.$(OBJEXT) set_.lo sqrtrem_.$(OBJEXT) sqrtrem_.lo sub_.$(OBJEXT) \
+sub_.lo tdiv_qr_.$(OBJEXT) tdiv_qr_.lo xtom_.$(OBJEXT) xtom_.lo : \
+$(ANSI2KNR)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+check: check-am
+all-am: Makefile $(LTLIBRARIES)
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
+ clean-libtool clean-noinstLTLIBRARIES ctags distclean \
+ distclean-compile distclean-generic distclean-libtool \
+ distclean-tags distdir dvi dvi-am html html-am info info-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
+ install-strip installcheck installcheck-am installdirs \
+ maintainer-clean maintainer-clean-generic mostlyclean \
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
+
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gmp/mpbsd/itom.c b/gmp/mpbsd/itom.c
new file mode 100644
index 0000000000..6f0e31c01b
--- /dev/null
+++ b/gmp/mpbsd/itom.c
@@ -0,0 +1,47 @@
+/* itom -- BSD compatible allocate and initiate a MINT.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+
+MINT *
+itom (signed short int n)
+{
+ MINT *x;
+ mp_ptr xp;
+
+ x = (MINT *) (*__gmp_allocate_func) (sizeof (MINT));
+ x->_mp_alloc = 1;
+ x->_mp_d = xp = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+ if (n > 0)
+ {
+ x->_mp_size = 1;
+ xp[0] = n;
+ }
+ else if (n < 0)
+ {
+ x->_mp_size = -1;
+ xp[0] = (unsigned short) -n;
+ }
+ else
+ x->_mp_size = 0;
+
+ return x;
+}
diff --git a/gmp/mpbsd/mfree.c b/gmp/mpbsd/mfree.c
new file mode 100644
index 0000000000..84e93f8cbe
--- /dev/null
+++ b/gmp/mpbsd/mfree.c
@@ -0,0 +1,29 @@
+/* mfree -- BSD compatible mfree.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+
+void
+mfree (MINT *m)
+{
+ (*__gmp_free_func) (m->_mp_d, m->_mp_alloc * BYTES_PER_MP_LIMB);
+ (*__gmp_free_func) (m, sizeof (MINT));
+}
diff --git a/gmp/mpbsd/min.c b/gmp/mpbsd/min.c
new file mode 100644
index 0000000000..e5c1d74351
--- /dev/null
+++ b/gmp/mpbsd/min.c
@@ -0,0 +1,89 @@
+/* min(MINT) -- Do decimal input from standard input and store result in
+ MINT.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 <stdio.h>
+#include <ctype.h>
+#include "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+
+extern const unsigned char __gmp_digit_value_tab[];
+#define digit_value_tab __gmp_digit_value_tab
+
+void
+min (MINT *dest)
+{
+ char *str;
+ size_t alloc_size, str_size;
+ int c;
+ int negative;
+ mp_size_t dest_size;
+ const unsigned char *digit_value;
+
+ digit_value = digit_value_tab;
+
+ alloc_size = 100;
+ str = (char *) (*__gmp_allocate_func) (alloc_size);
+ str_size = 0;
+
+ /* Skip whitespace. */
+ do
+ c = getc (stdin);
+ while (isspace (c));
+
+ negative = 0;
+ if (c == '-')
+ {
+ negative = 1;
+ c = getc (stdin);
+ }
+
+ if (c == EOF || digit_value[c] >= 10)
+ return; /* error if no digits */
+
+ do
+ {
+ int dig;
+ dig = digit_value[c];
+ if (dig >= 10)
+ break;
+ if (str_size >= alloc_size)
+ {
+ size_t old_alloc_size = alloc_size;
+ alloc_size = alloc_size * 3 / 2;
+ str = (char *) (*__gmp_reallocate_func) (str, old_alloc_size, alloc_size);
+ }
+ str[str_size++] = dig;
+ c = getc (stdin);
+ }
+ while (c != EOF);
+
+ ungetc (c, stdin);
+
+ dest_size = str_size / __mp_bases[10].chars_per_limb + 1;
+ if (dest->_mp_alloc < dest_size)
+ _mp_realloc (dest, dest_size);
+
+ dest_size = mpn_set_str (dest->_mp_d, (unsigned char *) str, str_size, 10);
+ dest->_mp_size = negative ? -dest_size : dest_size;
+
+ (*__gmp_free_func) (str, alloc_size);
+ return;
+}
diff --git a/gmp/mpbsd/mout.c b/gmp/mpbsd/mout.c
new file mode 100644
index 0000000000..545539cce2
--- /dev/null
+++ b/gmp/mpbsd/mout.c
@@ -0,0 +1,92 @@
+/* mout(MINT) -- Do decimal output of MINT to standard output.
+
+Copyright 1991, 1994, 1996, 2000, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 <stdio.h>
+#include <string.h>
+#include "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+void
+mout (const MINT *x)
+{
+ mp_ptr xp;
+ mp_srcptr x_ptr;
+ mp_size_t x_size;
+ unsigned char *str;
+ size_t str_size;
+ int i;
+ TMP_DECL;
+
+ x_size = x->_mp_size;
+ if (x_size == 0)
+ {
+ fputc ('0', stdout);
+ fputc ('\n', stdout);
+ return;
+ }
+ if (x_size < 0)
+ {
+ fputc ('-', stdout);
+ x_size = -x_size;
+ }
+
+ TMP_MARK;
+ x_ptr = x->_mp_d;
+ MPN_SIZEINBASE (str_size, x_ptr, x_size, 10);
+ str_size += 2;
+ str = (unsigned char *) TMP_ALLOC (str_size);
+
+ /* mpn_get_str clobbers its argument */
+ xp = TMP_ALLOC_LIMBS (x_size);
+ MPN_COPY (xp, x_ptr, x_size);
+
+ str_size = mpn_get_str (str, 10, xp, x_size);
+
+ /* mpn_get_str might make a leading zero, skip it. */
+ str_size -= (*str == 0);
+ str += (*str == 0);
+ ASSERT (*str != 0);
+
+ /* Translate to printable chars. */
+ for (i = 0; i < str_size; i++)
+ str[i] = "0123456789"[str[i]];
+ str[str_size] = 0;
+
+ str_size = strlen ((char *) str);
+ if (str_size % 10 != 0)
+ {
+ fwrite (str, 1, str_size % 10, stdout);
+ str += str_size % 10;
+ str_size -= str_size % 10;
+ if (str_size != 0)
+ fputc (' ', stdout);
+ }
+ for (i = 0; i < str_size; i += 10)
+ {
+ fwrite (str, 1, 10, stdout);
+ str += 10;
+ if (i + 10 < str_size)
+ fputc (' ', stdout);
+ }
+ fputc ('\n', stdout);
+ TMP_FREE;
+}
diff --git a/gmp/mpbsd/mtox.c b/gmp/mpbsd/mtox.c
new file mode 100644
index 0000000000..7babfdd07f
--- /dev/null
+++ b/gmp/mpbsd/mtox.c
@@ -0,0 +1,61 @@
+/* mtox -- Convert OPERAND to hexadecimal and return a malloc'ed string
+ with the result of the conversion.
+
+Copyright 1991, 1994, 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/. */
+
+#include <string.h>
+#include "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+char *
+mtox (const MINT *x)
+{
+ mp_size_t xsize = x->_mp_size;
+ mp_ptr xp;
+ mp_size_t xsign;
+ unsigned char *str, *s;
+ size_t str_size, alloc_size, i;
+
+ xsign = xsize;
+ if (xsize < 0)
+ xsize = -xsize;
+
+ /* digits, plus '\0', plus possible '-', for an exact size */
+ xp = x->_mp_d;
+ MPN_SIZEINBASE_16 (alloc_size, xp, xsize);
+ alloc_size += 1 + (xsign < 0);
+
+ str = (unsigned char *) (*__gmp_allocate_func) (alloc_size);
+ s = str;
+
+ if (xsign < 0)
+ *s++ = '-';
+
+ str_size = mpn_get_str (s, 16, xp, xsize);
+ ASSERT (str_size <= alloc_size - (xsign < 0));
+ ASSERT (str_size == 1 || *s != 0);
+
+ for (i = 0; i < str_size; i++)
+ s[i] = "0123456789abcdef"[s[i]];
+ s[str_size] = 0;
+
+ ASSERT (strlen (str) + 1 == alloc_size);
+ return (char *) str;
+}
diff --git a/gmp/mpbsd/rpow.c b/gmp/mpbsd/rpow.c
new file mode 100644
index 0000000000..827aacb6b3
--- /dev/null
+++ b/gmp/mpbsd/rpow.c
@@ -0,0 +1,32 @@
+/* rpow -- MINT raised to short. */
+
+/*
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+
+void
+rpow (const MINT *b, short e, MINT *r)
+{
+ if (e >= 0)
+ mpz_n_pow_ui (r, PTR(b), (mp_size_t) SIZ(b), (unsigned long) e);
+ else
+ SIZ(r) = 0;
+}
diff --git a/gmp/mpbsd/sdiv.c b/gmp/mpbsd/sdiv.c
new file mode 100644
index 0000000000..802fe52a9a
--- /dev/null
+++ b/gmp/mpbsd/sdiv.c
@@ -0,0 +1,67 @@
+/* sdiv -- Divide a MINT by a short integer. Produce a MINT quotient
+ and a short remainder.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+void
+sdiv (const MINT *dividend, signed short int divisor_short, MINT *quot, short *rem_ptr)
+{
+ mp_size_t sign_dividend;
+ signed long int sign_divisor;
+ mp_size_t dividend_size, quot_size;
+ mp_ptr dividend_ptr, quot_ptr;
+ mp_limb_t divisor_limb;
+ mp_limb_t remainder_limb;
+
+ sign_dividend = dividend->_mp_size;
+ dividend_size = ABS (dividend->_mp_size);
+
+ if (dividend_size == 0)
+ {
+ quot->_mp_size = 0;
+ *rem_ptr = 0;
+ return;
+ }
+
+ sign_divisor = divisor_short;
+ divisor_limb = (unsigned short) ABS (divisor_short);
+
+ /* No need for temporary allocation and copying even if QUOT == DIVIDEND
+ as the divisor is just one limb, and thus no intermediate remainders
+ need to be stored. */
+
+ if (quot->_mp_alloc < dividend_size)
+ _mp_realloc (quot, dividend_size);
+
+ quot_ptr = quot->_mp_d;
+ dividend_ptr = dividend->_mp_d;
+
+ remainder_limb = mpn_divmod_1 (quot_ptr,
+ dividend_ptr, dividend_size, divisor_limb);
+
+ *rem_ptr = sign_dividend >= 0 ? remainder_limb : -remainder_limb;
+ /* The quotient is DIVIDEND_SIZE limbs, but the most significant
+ might be zero. Set QUOT_SIZE properly. */
+ quot_size = dividend_size - (quot_ptr[dividend_size - 1] == 0);
+ quot->_mp_size = (sign_divisor ^ sign_dividend) >= 0 ? quot_size : -quot_size;
+}
diff --git a/gmp/mpbsd/xtom.c b/gmp/mpbsd/xtom.c
new file mode 100644
index 0000000000..fe41865d0f
--- /dev/null
+++ b/gmp/mpbsd/xtom.c
@@ -0,0 +1,88 @@
+/* xtom -- convert a hexadecimal string to a MINT, and return a pointer to
+ the MINT.
+
+Copyright 1991, 1994, 1995, 1996, 2000, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 <string.h>
+#include <ctype.h>
+#include "mp.h"
+#include "gmp.h"
+#include "gmp-impl.h"
+
+extern const unsigned char __gmp_digit_value_tab[];
+#define digit_value __gmp_digit_value_tab
+
+MINT *
+xtom (const char *str)
+{
+ size_t str_size;
+ char *s, *begs;
+ size_t i;
+ mp_size_t xsize;
+ int c;
+ int negative;
+ MINT *x = (MINT *) (*__gmp_allocate_func) (sizeof (MINT));
+ TMP_DECL;
+
+ /* Skip whitespace. */
+ do
+ c = (unsigned char) *str++;
+ while (isspace (c));
+
+ negative = 0;
+ if (c == '-')
+ {
+ negative = 1;
+ c = (unsigned char) *str++;
+ }
+
+ if (digit_value[c] >= 16)
+ return 0; /* error if no digits */
+
+ TMP_MARK;
+ str_size = strlen (str - 1);
+ s = begs = (char *) TMP_ALLOC (str_size + 1);
+
+ for (i = 0; i < str_size; i++)
+ {
+ if (!isspace (c))
+ {
+ int dig = digit_value[c];
+ if (dig >= 16)
+ {
+ TMP_FREE;
+ return 0;
+ }
+ *s++ = dig;
+ }
+ c = (unsigned char) *str++;
+ }
+
+ str_size = s - begs;
+
+ xsize = str_size / __mp_bases[16].chars_per_limb + 1;
+ x->_mp_alloc = xsize;
+ x->_mp_d = (mp_ptr) (*__gmp_allocate_func) (xsize * BYTES_PER_MP_LIMB);
+
+ xsize = mpn_set_str (x->_mp_d, (unsigned char *) begs, str_size, 16);
+ x->_mp_size = negative ? -xsize : xsize;
+
+ TMP_FREE;
+ return x;
+}
diff --git a/gmp/mpf/Makefile.am b/gmp/mpf/Makefile.am
index 30b0ea8f5f..fcaca07292 100644
--- a/gmp/mpf/Makefile.am
+++ b/gmp/mpf/Makefile.am
@@ -1,41 +1,31 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 1999, 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libmpf.la
libmpf_la_SOURCES = \
- init.c init2.c inits.c set.c set_ui.c set_si.c set_str.c set_d.c set_z.c \
- set_q.c iset.c iset_ui.c iset_si.c iset_str.c iset_d.c clear.c clears.c \
- get_str.c dump.c size.c eq.c reldiff.c sqrt.c random2.c inp_str.c out_str.c \
+ init.c init2.c set.c set_ui.c set_si.c set_str.c set_d.c set_z.c \
+ set_q.c iset.c iset_ui.c iset_si.c iset_str.c iset_d.c clear.c get_str.c \
+ dump.c size.c eq.c reldiff.c sqrt.c random2.c inp_str.c out_str.c \
add.c add_ui.c sub.c sub_ui.c ui_sub.c mul.c mul_ui.c div.c div_ui.c \
cmp.c cmp_d.c cmp_si.c cmp_ui.c mul_2exp.c div_2exp.c abs.c neg.c get_d.c \
get_d_2exp.c set_dfl_prec.c set_prc.c set_prc_raw.c get_dfl_prec.c get_prc.c \
diff --git a/gmp/mpf/Makefile.in b/gmp/mpf/Makefile.in
index 2f5238be58..d277445ae2 100644
--- a/gmp/mpf/Makefile.in
+++ b/gmp/mpf/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,57 +14,35 @@
@SET_MAKE@
-# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 1999, 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libmpf_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -77,53 +54,48 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
subdir = mpf
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libmpf_la_LIBADD =
-am_libmpf_la_OBJECTS = init.lo init2.lo inits.lo set.lo set_ui.lo \
- set_si.lo set_str.lo set_d.lo set_z.lo set_q.lo iset.lo \
- iset_ui.lo iset_si.lo iset_str.lo iset_d.lo clear.lo clears.lo \
- get_str.lo dump.lo size.lo eq.lo reldiff.lo sqrt.lo random2.lo \
- inp_str.lo out_str.lo add.lo add_ui.lo sub.lo sub_ui.lo \
- ui_sub.lo mul.lo mul_ui.lo div.lo div_ui.lo cmp.lo cmp_d.lo \
- cmp_si.lo cmp_ui.lo mul_2exp.lo div_2exp.lo abs.lo neg.lo \
- get_d.lo get_d_2exp.lo set_dfl_prec.lo set_prc.lo \
- set_prc_raw.lo get_dfl_prec.lo get_prc.lo ui_div.lo sqrt_ui.lo \
- pow_ui.lo urandomb.lo swap.lo get_si.lo get_ui.lo int_p.lo \
- ceilfloor.lo trunc.lo fits_sint.lo fits_slong.lo \
- fits_sshort.lo fits_uint.lo fits_ulong.lo fits_ushort.lo
+am_libmpf_la_OBJECTS = init$U.lo init2$U.lo set$U.lo set_ui$U.lo \
+ set_si$U.lo set_str$U.lo set_d$U.lo set_z$U.lo set_q$U.lo \
+ iset$U.lo iset_ui$U.lo iset_si$U.lo iset_str$U.lo iset_d$U.lo \
+ clear$U.lo get_str$U.lo dump$U.lo size$U.lo eq$U.lo \
+ reldiff$U.lo sqrt$U.lo random2$U.lo inp_str$U.lo out_str$U.lo \
+ add$U.lo add_ui$U.lo sub$U.lo sub_ui$U.lo ui_sub$U.lo mul$U.lo \
+ mul_ui$U.lo div$U.lo div_ui$U.lo cmp$U.lo cmp_d$U.lo \
+ cmp_si$U.lo cmp_ui$U.lo mul_2exp$U.lo div_2exp$U.lo abs$U.lo \
+ neg$U.lo get_d$U.lo get_d_2exp$U.lo set_dfl_prec$U.lo \
+ set_prc$U.lo set_prc_raw$U.lo get_dfl_prec$U.lo get_prc$U.lo \
+ ui_div$U.lo sqrt_ui$U.lo pow_ui$U.lo urandomb$U.lo swap$U.lo \
+ get_si$U.lo get_ui$U.lo int_p$U.lo ceilfloor$U.lo trunc$U.lo \
+ fits_sint$U.lo fits_slong$U.lo fits_sshort$U.lo fits_uint$U.lo \
+ fits_ulong$U.lo fits_ushort$U.lo
libmpf_la_OBJECTS = $(am_libmpf_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libmpf_la_SOURCES)
DIST_SOURCES = $(libmpf_la_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -137,6 +109,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -152,17 +125,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -176,12 +148,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -196,26 +166,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -225,31 +189,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -273,6 +232,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -280,18 +240,14 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libmpf.la
libmpf_la_SOURCES = \
- init.c init2.c inits.c set.c set_ui.c set_si.c set_str.c set_d.c set_z.c \
- set_q.c iset.c iset_ui.c iset_si.c iset_str.c iset_d.c clear.c clears.c \
- get_str.c dump.c size.c eq.c reldiff.c sqrt.c random2.c inp_str.c out_str.c \
+ init.c init2.c set.c set_ui.c set_si.c set_str.c set_d.c set_z.c \
+ set_q.c iset.c iset_ui.c iset_si.c iset_str.c iset_d.c clear.c get_str.c \
+ dump.c size.c eq.c reldiff.c sqrt.c random2.c inp_str.c out_str.c \
add.c add_ui.c sub.c sub_ui.c ui_sub.c mul.c mul_ui.c div.c div_ui.c \
cmp.c cmp_d.c cmp_si.c cmp_ui.c mul_2exp.c div_2exp.c abs.c neg.c get_d.c \
get_d_2exp.c set_dfl_prec.c set_prc.c set_prc_raw.c get_dfl_prec.c get_prc.c \
@@ -310,14 +266,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpf/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps mpf/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps mpf/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -335,24 +291,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libmpf.la: $(libmpf_la_OBJECTS) $(libmpf_la_DEPENDENCIES) $(EXTRA_libmpf_la_DEPENDENCIES)
- $(LINK) $(libmpf_la_OBJECTS) $(libmpf_la_LIBADD) $(LIBS)
+libmpf.la: $(libmpf_la_OBJECTS) $(libmpf_la_DEPENDENCIES)
+ $(LINK) $(libmpf_la_LDFLAGS) $(libmpf_la_OBJECTS) $(libmpf_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -362,6 +322,164 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+abs_.c: abs.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/abs.c; then echo $(srcdir)/abs.c; else echo abs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_.c: add.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add.c; then echo $(srcdir)/add.c; else echo add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_ui_.c: add_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_ui.c; then echo $(srcdir)/add_ui.c; else echo add_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ceilfloor_.c: ceilfloor.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ceilfloor.c; then echo $(srcdir)/ceilfloor.c; else echo ceilfloor.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+clear_.c: clear.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clear.c; then echo $(srcdir)/clear.c; else echo clear.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_.c: cmp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_d_.c: cmp_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_d.c; then echo $(srcdir)/cmp_d.c; else echo cmp_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_si_.c: cmp_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_si.c; then echo $(srcdir)/cmp_si.c; else echo cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_ui_.c: cmp_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_ui.c; then echo $(srcdir)/cmp_ui.c; else echo cmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+div_.c: div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div.c; then echo $(srcdir)/div.c; else echo div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+div_2exp_.c: div_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div_2exp.c; then echo $(srcdir)/div_2exp.c; else echo div_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+div_ui_.c: div_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div_ui.c; then echo $(srcdir)/div_ui.c; else echo div_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dump_.c: dump.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dump.c; then echo $(srcdir)/dump.c; else echo dump.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+eq_.c: eq.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/eq.c; then echo $(srcdir)/eq.c; else echo eq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_sint_.c: fits_sint.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sint.c; then echo $(srcdir)/fits_sint.c; else echo fits_sint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_slong_.c: fits_slong.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_slong.c; then echo $(srcdir)/fits_slong.c; else echo fits_slong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_sshort_.c: fits_sshort.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sshort.c; then echo $(srcdir)/fits_sshort.c; else echo fits_sshort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_uint_.c: fits_uint.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_uint.c; then echo $(srcdir)/fits_uint.c; else echo fits_uint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_ulong_.c: fits_ulong.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ulong.c; then echo $(srcdir)/fits_ulong.c; else echo fits_ulong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_ushort_.c: fits_ushort.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ushort.c; then echo $(srcdir)/fits_ushort.c; else echo fits_ushort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_d_.c: get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_d_2exp_.c: get_d_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d_2exp.c; then echo $(srcdir)/get_d_2exp.c; else echo get_d_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_dfl_prec_.c: get_dfl_prec.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_dfl_prec.c; then echo $(srcdir)/get_dfl_prec.c; else echo get_dfl_prec.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_prc_.c: get_prc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_prc.c; then echo $(srcdir)/get_prc.c; else echo get_prc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_si_.c: get_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_si.c; then echo $(srcdir)/get_si.c; else echo get_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_str_.c: get_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_ui_.c: get_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_ui.c; then echo $(srcdir)/get_ui.c; else echo get_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+init_.c: init.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init.c; then echo $(srcdir)/init.c; else echo init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+init2_.c: init2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init2.c; then echo $(srcdir)/init2.c; else echo init2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+inp_str_.c: inp_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_str.c; then echo $(srcdir)/inp_str.c; else echo inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+int_p_.c: int_p.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/int_p.c; then echo $(srcdir)/int_p.c; else echo int_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_.c: iset.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset.c; then echo $(srcdir)/iset.c; else echo iset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_d_.c: iset_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_d.c; then echo $(srcdir)/iset_d.c; else echo iset_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_si_.c: iset_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_si.c; then echo $(srcdir)/iset_si.c; else echo iset_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_str_.c: iset_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_str.c; then echo $(srcdir)/iset_str.c; else echo iset_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_ui_.c: iset_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_ui.c; then echo $(srcdir)/iset_ui.c; else echo iset_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_.c: mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_2exp_.c: mul_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_2exp.c; then echo $(srcdir)/mul_2exp.c; else echo mul_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_ui_.c: mul_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_ui.c; then echo $(srcdir)/mul_ui.c; else echo mul_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+neg_.c: neg.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg.c; then echo $(srcdir)/neg.c; else echo neg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+out_str_.c: out_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_str.c; then echo $(srcdir)/out_str.c; else echo out_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pow_ui_.c: pow_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pow_ui.c; then echo $(srcdir)/pow_ui.c; else echo pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+random2_.c: random2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random2.c; then echo $(srcdir)/random2.c; else echo random2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+reldiff_.c: reldiff.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reldiff.c; then echo $(srcdir)/reldiff.c; else echo reldiff.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_.c: set.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set.c; then echo $(srcdir)/set.c; else echo set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_d_.c: set_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_d.c; then echo $(srcdir)/set_d.c; else echo set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_dfl_prec_.c: set_dfl_prec.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_dfl_prec.c; then echo $(srcdir)/set_dfl_prec.c; else echo set_dfl_prec.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_prc_.c: set_prc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_prc.c; then echo $(srcdir)/set_prc.c; else echo set_prc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_prc_raw_.c: set_prc_raw.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_prc_raw.c; then echo $(srcdir)/set_prc_raw.c; else echo set_prc_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_q_.c: set_q.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_q.c; then echo $(srcdir)/set_q.c; else echo set_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_si_.c: set_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_si.c; then echo $(srcdir)/set_si.c; else echo set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_str_.c: set_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_ui_.c: set_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_ui.c; then echo $(srcdir)/set_ui.c; else echo set_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_z_.c: set_z.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_z.c; then echo $(srcdir)/set_z.c; else echo set_z.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+size_.c: size.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/size.c; then echo $(srcdir)/size.c; else echo size.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqrt_.c: sqrt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrt.c; then echo $(srcdir)/sqrt.c; else echo sqrt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqrt_ui_.c: sqrt_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrt_ui.c; then echo $(srcdir)/sqrt_ui.c; else echo sqrt_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_.c: sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub.c; then echo $(srcdir)/sub.c; else echo sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_ui_.c: sub_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_ui.c; then echo $(srcdir)/sub_ui.c; else echo sub_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+swap_.c: swap.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/swap.c; then echo $(srcdir)/swap.c; else echo swap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+trunc_.c: trunc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/trunc.c; then echo $(srcdir)/trunc.c; else echo trunc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ui_div_.c: ui_div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_div.c; then echo $(srcdir)/ui_div.c; else echo ui_div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ui_sub_.c: ui_sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_sub.c; then echo $(srcdir)/ui_sub.c; else echo ui_sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+urandomb_.c: urandomb.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/urandomb.c; then echo $(srcdir)/urandomb.c; else echo urandomb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+abs_.$(OBJEXT) abs_.lo add_.$(OBJEXT) add_.lo add_ui_.$(OBJEXT) \
+add_ui_.lo ceilfloor_.$(OBJEXT) ceilfloor_.lo clear_.$(OBJEXT) \
+clear_.lo cmp_.$(OBJEXT) cmp_.lo cmp_d_.$(OBJEXT) cmp_d_.lo \
+cmp_si_.$(OBJEXT) cmp_si_.lo cmp_ui_.$(OBJEXT) cmp_ui_.lo \
+div_.$(OBJEXT) div_.lo div_2exp_.$(OBJEXT) div_2exp_.lo \
+div_ui_.$(OBJEXT) div_ui_.lo dump_.$(OBJEXT) dump_.lo eq_.$(OBJEXT) \
+eq_.lo fits_sint_.$(OBJEXT) fits_sint_.lo fits_slong_.$(OBJEXT) \
+fits_slong_.lo fits_sshort_.$(OBJEXT) fits_sshort_.lo \
+fits_uint_.$(OBJEXT) fits_uint_.lo fits_ulong_.$(OBJEXT) \
+fits_ulong_.lo fits_ushort_.$(OBJEXT) fits_ushort_.lo get_d_.$(OBJEXT) \
+get_d_.lo get_d_2exp_.$(OBJEXT) get_d_2exp_.lo get_dfl_prec_.$(OBJEXT) \
+get_dfl_prec_.lo get_prc_.$(OBJEXT) get_prc_.lo get_si_.$(OBJEXT) \
+get_si_.lo get_str_.$(OBJEXT) get_str_.lo get_ui_.$(OBJEXT) get_ui_.lo \
+init_.$(OBJEXT) init_.lo init2_.$(OBJEXT) init2_.lo inp_str_.$(OBJEXT) \
+inp_str_.lo int_p_.$(OBJEXT) int_p_.lo iset_.$(OBJEXT) iset_.lo \
+iset_d_.$(OBJEXT) iset_d_.lo iset_si_.$(OBJEXT) iset_si_.lo \
+iset_str_.$(OBJEXT) iset_str_.lo iset_ui_.$(OBJEXT) iset_ui_.lo \
+mul_.$(OBJEXT) mul_.lo mul_2exp_.$(OBJEXT) mul_2exp_.lo \
+mul_ui_.$(OBJEXT) mul_ui_.lo neg_.$(OBJEXT) neg_.lo out_str_.$(OBJEXT) \
+out_str_.lo pow_ui_.$(OBJEXT) pow_ui_.lo random2_.$(OBJEXT) \
+random2_.lo reldiff_.$(OBJEXT) reldiff_.lo set_.$(OBJEXT) set_.lo \
+set_d_.$(OBJEXT) set_d_.lo set_dfl_prec_.$(OBJEXT) set_dfl_prec_.lo \
+set_prc_.$(OBJEXT) set_prc_.lo set_prc_raw_.$(OBJEXT) set_prc_raw_.lo \
+set_q_.$(OBJEXT) set_q_.lo set_si_.$(OBJEXT) set_si_.lo \
+set_str_.$(OBJEXT) set_str_.lo set_ui_.$(OBJEXT) set_ui_.lo \
+set_z_.$(OBJEXT) set_z_.lo size_.$(OBJEXT) size_.lo sqrt_.$(OBJEXT) \
+sqrt_.lo sqrt_ui_.$(OBJEXT) sqrt_ui_.lo sub_.$(OBJEXT) sub_.lo \
+sub_ui_.$(OBJEXT) sub_ui_.lo swap_.$(OBJEXT) swap_.lo trunc_.$(OBJEXT) \
+trunc_.lo ui_div_.$(OBJEXT) ui_div_.lo ui_sub_.$(OBJEXT) ui_sub_.lo \
+urandomb_.$(OBJEXT) urandomb_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -369,85 +487,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -465,22 +580,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -493,7 +602,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -501,38 +610,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -541,7 +630,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -552,23 +641,19 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/gmp/mpf/abs.c b/gmp/mpf/abs.c
index a2bde2a4f8..4f8a76e488 100644
--- a/gmp/mpf/abs.c
+++ b/gmp/mpf/abs.c
@@ -1,32 +1,21 @@
/* mpf_abs -- Compute the absolute value of a float.
-Copyright 1993-1995, 2001 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/add.c b/gmp/mpf/add.c
index d2a5c097c5..341b36b49c 100644
--- a/gmp/mpf/add.c
+++ b/gmp/mpf/add.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -121,7 +110,7 @@ mpf_add (mpf_ptr r, mpf_srcptr u, mpf_srcptr v)
/* Allocate temp space for the result. Allocate
just vsize + ediff later??? */
- tp = TMP_ALLOC_LIMBS (prec);
+ tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB);
if (ediff >= prec)
{
diff --git a/gmp/mpf/add_ui.c b/gmp/mpf/add_ui.c
index b1e57d04c1..549ca99e1e 100644
--- a/gmp/mpf/add_ui.c
+++ b/gmp/mpf/add_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/ceilfloor.c b/gmp/mpf/ceilfloor.c
index 302e2b8ae5..a0c5d77dea 100644
--- a/gmp/mpf/ceilfloor.c
+++ b/gmp/mpf/ceilfloor.c
@@ -1,32 +1,21 @@
/* mpf_ceil, mpf_floor -- round an mpf to an integer.
-Copyright 2001, 2004, 2012 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,7 +26,7 @@ see https://www.gnu.org/licenses/. */
Notice the use of prec+1 ensures mpf_ceil and mpf_floor are equivalent to
mpf_set if u is already an integer. */
-static void __gmpf_ceil_or_floor (REGPARM_2_1 (mpf_ptr, mpf_srcptr, int)) REGPARM_ATTR (1);
+static void __gmpf_ceil_or_floor __GMP_PROTO ((REGPARM_2_1 (mpf_ptr, mpf_srcptr, int))) REGPARM_ATTR (1);
#define mpf_ceil_or_floor(r,u,dir) __gmpf_ceil_or_floor (REGPARM_2_1 (r, u, dir))
REGPARM_ATTR (1) static void
diff --git a/gmp/mpf/clear.c b/gmp/mpf/clear.c
index 2df0de579b..78fc1386de 100644
--- a/gmp/mpf/clear.c
+++ b/gmp/mpf/clear.c
@@ -1,33 +1,22 @@
/* mpf_clear -- de-allocate the space occupied by the dynamic digit space of
an integer.
-Copyright 1993-1995, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1993, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,5 +24,5 @@ see https://www.gnu.org/licenses/. */
void
mpf_clear (mpf_ptr m)
{
- (*__gmp_free_func) (m->_mp_d, (size_t) (m->_mp_prec + 1) * GMP_LIMB_BYTES);
+ (*__gmp_free_func) (m->_mp_d, (m->_mp_prec + 1) * BYTES_PER_MP_LIMB);
}
diff --git a/gmp/mpf/clears.c b/gmp/mpf/clears.c
deleted file mode 100644
index addbe8faf3..0000000000
--- a/gmp/mpf/clears.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* mpf_clears() -- Clear multiple mpf_t variables.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 <stdarg.h>
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-mpf_clears (mpf_ptr x, ...)
-{
- va_list ap;
-
- va_start (ap, x);
-
- while (x != NULL)
- {
- (*__gmp_free_func) (x->_mp_d, (size_t) (x->_mp_prec + 1) * GMP_LIMB_BYTES);
- x = va_arg (ap, mpf_ptr);
- }
- va_end (ap);
-}
diff --git a/gmp/mpf/cmp.c b/gmp/mpf/cmp.c
index ab22c3f89c..fc29309bcd 100644
--- a/gmp/mpf/cmp.c
+++ b/gmp/mpf/cmp.c
@@ -5,34 +5,23 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpf_cmp (mpf_srcptr u, mpf_srcptr v) __GMP_NOTHROW
+mpf_cmp (mpf_srcptr u, mpf_srcptr v)
{
mp_srcptr up, vp;
mp_size_t usize, vsize;
diff --git a/gmp/mpf/cmp_d.c b/gmp/mpf/cmp_d.c
index 52893a781e..09f1b65207 100644
--- a/gmp/mpf/cmp_d.c
+++ b/gmp/mpf/cmp_d.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
diff --git a/gmp/mpf/cmp_si.c b/gmp/mpf/cmp_si.c
index eaa8b87da9..541ac36e31 100644
--- a/gmp/mpf/cmp_si.c
+++ b/gmp/mpf/cmp_si.c
@@ -1,45 +1,34 @@
/* mpf_cmp_si -- Compare a float with a signed integer.
-Copyright 1993-1995, 1999-2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpf_cmp_si (mpf_srcptr u, long int vval) __GMP_NOTHROW
+mpf_cmp_si (mpf_srcptr u, long int vval)
{
mp_srcptr up;
mp_size_t usize;
mp_exp_t uexp;
mp_limb_t ulimb;
int usign;
- unsigned long abs_vval;
uexp = u->_mp_exp;
usize = u->_mp_size;
@@ -66,13 +55,13 @@ mpf_cmp_si (mpf_srcptr u, long int vval) __GMP_NOTHROW
usign = usize >= 0 ? 1 : -1;
usize = ABS (usize);
- abs_vval = ABS_CAST (unsigned long, vval);
+ vval = ABS (vval);
/* 2. Are the exponents different (V's exponent == 1)? */
#if GMP_NAIL_BITS != 0
- if (uexp > 1 + (abs_vval > GMP_NUMB_MAX))
+ if (uexp > 1 + ((unsigned long) vval > GMP_NUMB_MAX))
return usign;
- if (uexp < 1 + (abs_vval > GMP_NUMB_MAX))
+ if (uexp < 1 + ((unsigned long) vval > GMP_NUMB_MAX))
return -usign;
#else
if (uexp > 1)
@@ -96,9 +85,9 @@ mpf_cmp_si (mpf_srcptr u, long int vval) __GMP_NOTHROW
usize--;
/* 3. Compare the most significant mantissa limb with V. */
- if (ulimb > abs_vval)
+ if (ulimb > (unsigned long) vval)
return usign;
- else if (ulimb < abs_vval)
+ else if (ulimb < (unsigned long) vval)
return -usign;
/* Ignore zeroes at the low end of U. */
diff --git a/gmp/mpf/cmp_ui.c b/gmp/mpf/cmp_ui.c
index ccb76c6ce0..33f418c731 100644
--- a/gmp/mpf/cmp_ui.c
+++ b/gmp/mpf/cmp_ui.c
@@ -1,38 +1,27 @@
/* mpf_cmp_ui -- Compare a float with an unsigned integer.
-Copyright 1993-1995, 1999, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpf_cmp_ui (mpf_srcptr u, unsigned long int vval) __GMP_NOTHROW
+mpf_cmp_ui (mpf_srcptr u, unsigned long int vval)
{
mp_srcptr up;
mp_size_t usize;
diff --git a/gmp/mpf/div.c b/gmp/mpf/div.c
index af38cb8698..ef3675eb34 100644
--- a/gmp/mpf/div.c
+++ b/gmp/mpf/div.c
@@ -1,36 +1,27 @@
/* mpf_div -- Divide two floats.
-Copyright 1993, 1994, 1996, 2000-2002, 2004, 2005, 2010, 2012 Free Software
+Copyright 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
#include "gmp-impl.h"
+#include "longlong.h"
/* Not done:
@@ -48,91 +39,108 @@ see https://www.gnu.org/licenses/. */
to save one limb in the division.
If r==u but the size is enough bigger than prec that there won't be an
- overlap between quotient and dividend in mpn_div_q, then we can avoid
+ overlap between quotient and dividend in mpn_tdiv_qr, then we can avoid
copying up,usize. This would only arise from a prec reduced with
mpf_set_prec_raw and will be pretty unusual, but might be worthwhile if
- it could be worked into the copy_u decision cleanly. */
+ it could be worked into the copy_u decision cleanly.
+
+ Future:
+
+ If/when mpn_tdiv_qr supports its qxn parameter we can use that instead of
+ padding u with zeros in temporary space.
+
+ If/when a quotient-only division exists it can be used here immediately.
+ remp is only to satisfy mpn_tdiv_qr, the remainder is not used. */
void
mpf_div (mpf_ptr r, mpf_srcptr u, mpf_srcptr v)
{
mp_srcptr up, vp;
- mp_ptr rp, tp, new_vp;
- mp_size_t usize, vsize, rsize, prospective_rsize, tsize, zeros;
+ mp_ptr rp, remp, tp, new_vp;
+ mp_size_t usize, vsize, rsize, prospective_rsize, tsize, zeros, copy_v_size;
mp_size_t sign_quotient, prec, high_zero, chop;
mp_exp_t rexp;
int copy_u;
TMP_DECL;
- usize = SIZ(u);
- vsize = SIZ(v);
+ usize = u->_mp_size;
+ vsize = v->_mp_size;
+ sign_quotient = usize ^ vsize;
+ usize = ABS (usize);
+ vsize = ABS (vsize);
+ prec = r->_mp_prec;
- if (UNLIKELY (vsize == 0))
+ if (vsize == 0)
DIVIDE_BY_ZERO;
if (usize == 0)
{
- SIZ(r) = 0;
- EXP(r) = 0;
+ r->_mp_size = 0;
+ r->_mp_exp = 0;
return;
}
- sign_quotient = usize ^ vsize;
- usize = ABS (usize);
- vsize = ABS (vsize);
- prec = PREC(r);
-
TMP_MARK;
- rexp = EXP(u) - EXP(v) + 1;
+ rexp = u->_mp_exp - v->_mp_exp + 1;
- rp = PTR(r);
- up = PTR(u);
- vp = PTR(v);
+ rp = r->_mp_d;
+ up = u->_mp_d;
+ vp = v->_mp_d;
prospective_rsize = usize - vsize + 1; /* quot from using given u,v sizes */
- rsize = prec + 1; /* desired quot */
+ rsize = prec + 1; /* desired quot */
- zeros = rsize - prospective_rsize; /* padding u to give rsize */
- copy_u = (zeros > 0 || rp == up); /* copy u if overlap or padding */
+ zeros = rsize - prospective_rsize; /* padding u to give rsize */
+ copy_u = (zeros > 0 || rp == up); /* copy u if overlap or padding */
- chop = MAX (-zeros, 0); /* negative zeros means shorten u */
+ chop = MAX (-zeros, 0); /* negative zeros means shorten u */
up += chop;
usize -= chop;
- zeros += chop; /* now zeros >= 0 */
+ zeros += chop; /* now zeros >= 0 */
- tsize = usize + zeros; /* size for possible copy of u */
+ tsize = usize + zeros; /* size for possible copy of u */
+
+ if (WANT_TMP_DEBUG)
+ {
+ /* separate blocks, for malloc debugging */
+ remp = TMP_ALLOC_LIMBS (vsize);
+ tp = (copy_u ? TMP_ALLOC_LIMBS (tsize) : NULL);
+ new_vp = (rp == vp ? TMP_ALLOC_LIMBS (vsize) : NULL);
+ }
+ else
+ {
+ /* one block with conditionalized size, for efficiency */
+ copy_v_size = (rp == vp ? vsize : 0);
+ remp = TMP_ALLOC_LIMBS (vsize + copy_v_size + (copy_u ? tsize : 0));
+ new_vp = remp + vsize;
+ tp = new_vp + copy_v_size;
+ }
/* copy and possibly extend u if necessary */
if (copy_u)
{
- tp = TMP_ALLOC_LIMBS (tsize + 1); /* +1 for mpn_div_q's scratch needs */
MPN_ZERO (tp, zeros);
MPN_COPY (tp+zeros, up, usize);
up = tp;
usize = tsize;
}
- else
- {
- tp = TMP_ALLOC_LIMBS (usize + 1);
- }
/* ensure divisor doesn't overlap quotient */
if (rp == vp)
{
- new_vp = TMP_ALLOC_LIMBS (vsize);
MPN_COPY (new_vp, vp, vsize);
vp = new_vp;
}
ASSERT (usize-vsize+1 == rsize);
- mpn_div_q (rp, up, usize, vp, vsize, tp);
+ mpn_tdiv_qr (rp, remp, (mp_size_t) 0, up, usize, vp, vsize);
/* strip possible zero high limb */
high_zero = (rp[rsize-1] == 0);
rsize -= high_zero;
rexp -= high_zero;
- SIZ(r) = sign_quotient >= 0 ? rsize : -rsize;
- EXP(r) = rexp;
+ r->_mp_size = sign_quotient >= 0 ? rsize : -rsize;
+ r->_mp_exp = rexp;
TMP_FREE;
}
diff --git a/gmp/mpf/div_2exp.c b/gmp/mpf/div_2exp.c
index fef8152050..eea5de3bc8 100644
--- a/gmp/mpf/div_2exp.c
+++ b/gmp/mpf/div_2exp.c
@@ -1,32 +1,22 @@
/* mpf_div_2exp -- Divide a float by 2^n.
-Copyright 1993, 1994, 1996, 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -75,7 +65,7 @@ see https://www.gnu.org/licenses/. */
then use that mpn_rshift. */
void
-mpf_div_2exp (mpf_ptr r, mpf_srcptr u, mp_bitcnt_t exp)
+mpf_div_2exp (mpf_ptr r, mpf_srcptr u, unsigned long int exp)
{
mp_srcptr up;
mp_ptr rp = r->_mp_d;
diff --git a/gmp/mpf/div_ui.c b/gmp/mpf/div_ui.c
index 9be7e680be..bcf2b699cc 100644
--- a/gmp/mpf/div_ui.c
+++ b/gmp/mpf/div_ui.c
@@ -1,33 +1,22 @@
/* mpf_div_ui -- Divide a float with an unsigned integer.
-Copyright 1993, 1994, 1996, 2000-2002, 2004, 2005, 2012 Free Software
+Copyright 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -61,10 +50,13 @@ mpf_div_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v)
}
#endif
- if (UNLIKELY (v == 0))
- DIVIDE_BY_ZERO;
-
usize = u->_mp_size;
+ sign_quotient = usize;
+ usize = ABS (usize);
+ prec = r->_mp_prec;
+
+ if (v == 0)
+ DIVIDE_BY_ZERO;
if (usize == 0)
{
@@ -73,17 +65,13 @@ mpf_div_ui (mpf_ptr r, mpf_srcptr u, unsigned long int v)
return;
}
- sign_quotient = usize;
- usize = ABS (usize);
- prec = r->_mp_prec;
-
TMP_MARK;
rp = r->_mp_d;
up = u->_mp_d;
tsize = 1 + prec;
- tp = TMP_ALLOC_LIMBS (tsize + 1);
+ tp = (mp_ptr) TMP_ALLOC ((tsize + 1) * BYTES_PER_MP_LIMB);
if (usize > tsize)
{
diff --git a/gmp/mpf/dump.c b/gmp/mpf/dump.c
index af67105923..ded3606cc3 100644
--- a/gmp/mpf/dump.c
+++ b/gmp/mpf/dump.c
@@ -5,33 +5,22 @@
FUNCTION WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1993-1995, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1993, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <string.h> /* for strlen */
diff --git a/gmp/mpf/eq.c b/gmp/mpf/eq.c
index 30c6befd06..3832c0b330 100644
--- a/gmp/mpf/eq.c
+++ b/gmp/mpf/eq.c
@@ -1,43 +1,32 @@
/* mpf_eq -- Compare two floats up to a specified bit #.
-Copyright 1993, 1995, 1996, 2001, 2002, 2008, 2009, 2012 Free Software
-Foundation, Inc.
+Copyright 1993, 1995, 1996, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpf_eq (mpf_srcptr u, mpf_srcptr v, mp_bitcnt_t n_bits)
+mpf_eq (mpf_srcptr u, mpf_srcptr v, unsigned long int n_bits)
{
mp_srcptr up, vp, p;
- mp_size_t usize, vsize, minsize, maxsize, n_limbs, i, size;
+ mp_size_t usize, vsize, minsize, maxsize, n_limbs, i;
mp_exp_t uexp, vexp;
mp_limb_t diff;
int cnt;
@@ -111,38 +100,33 @@ mpf_eq (mpf_srcptr u, mpf_srcptr v, mp_bitcnt_t n_bits)
return 0;
}
- n_bits -= (maxsize - 1) * GMP_NUMB_BITS;
-
- size = maxsize - minsize;
- if (size != 0)
+ if (minsize != maxsize)
{
if (up[0] != vp[0])
return 0;
+ }
- /* Now either U or V has its limbs consumed, i.e, continues with an
- infinite number of implicit zero limbs. Check that the other operand
- has just zeros in the corresponding, relevant part. */
-
- if (usize > vsize)
- p = up - size;
- else
- p = vp - size;
-
- for (i = size - 1; i > 0; i--)
- {
- if (p[i] != 0)
- return 0;
- }
+ /* Now either U or V has its limbs consumed. Check the the other operand
+ has just zeros in the corresponding, relevant part. */
- diff = p[0];
- }
+ if (usize > vsize)
+ p = up + minsize - maxsize;
else
- {
- /* Both U or V has its limbs consumed. */
+ p = vp + minsize - maxsize;
- diff = up[0] ^ vp[0];
+ for (i = maxsize - minsize - 1; i > 0; i--)
+ {
+ if (p[i] != 0)
+ return 0;
}
+ n_bits -= (maxsize - 1) * GMP_NUMB_BITS;
+
+ if (minsize != maxsize)
+ diff = p[0];
+ else
+ diff = up[0] ^ vp[0];
+
if (n_bits < GMP_NUMB_BITS)
diff >>= GMP_NUMB_BITS - n_bits;
diff --git a/gmp/mpf/fits_s.h b/gmp/mpf/fits_s.h
index ec2635f656..6306930a0c 100644
--- a/gmp/mpf/fits_s.h
+++ b/gmp/mpf/fits_s.h
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,7 +24,7 @@ see https://www.gnu.org/licenses/. */
/* Notice this is equivalent to mpz_set_f + mpz_fits_s*_p. */
int
-FUNCTION (mpf_srcptr f) __GMP_NOTHROW
+FUNCTION (mpf_srcptr f)
{
mp_size_t fs, fn;
mp_srcptr fp;
diff --git a/gmp/mpf/fits_sint.c b/gmp/mpf/fits_sint.c
index 26ace07c38..c8b245a55d 100644
--- a/gmp/mpf/fits_sint.c
+++ b/gmp/mpf/fits_sint.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpf_fits_sint_p
diff --git a/gmp/mpf/fits_slong.c b/gmp/mpf/fits_slong.c
index 25db68c47d..42f5416935 100644
--- a/gmp/mpf/fits_slong.c
+++ b/gmp/mpf/fits_slong.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpf_fits_slong_p
diff --git a/gmp/mpf/fits_sshort.c b/gmp/mpf/fits_sshort.c
index 3bfc5a4a34..bd2492bab7 100644
--- a/gmp/mpf/fits_sshort.c
+++ b/gmp/mpf/fits_sshort.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpf_fits_sshort_p
diff --git a/gmp/mpf/fits_u.h b/gmp/mpf/fits_u.h
index 65ac60e09a..724f06c352 100644
--- a/gmp/mpf/fits_u.h
+++ b/gmp/mpf/fits_u.h
@@ -1,32 +1,21 @@
/* mpf_fits_u*_p -- test whether an mpf fits a C unsigned type.
-Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,21 +24,21 @@ see https://www.gnu.org/licenses/. */
/* Notice this is equivalent to mpz_set_f + mpz_fits_u*_p. */
int
-FUNCTION (mpf_srcptr f) __GMP_NOTHROW
+FUNCTION (mpf_srcptr f)
{
mp_size_t fn;
mp_srcptr fp;
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)
diff --git a/gmp/mpf/fits_uint.c b/gmp/mpf/fits_uint.c
index 4b107b04d8..c2ae6fc557 100644
--- a/gmp/mpf/fits_uint.c
+++ b/gmp/mpf/fits_uint.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpf_fits_uint_p
diff --git a/gmp/mpf/fits_ulong.c b/gmp/mpf/fits_ulong.c
index 1db688ce4c..6fd4b8d0cf 100644
--- a/gmp/mpf/fits_ulong.c
+++ b/gmp/mpf/fits_ulong.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpf_fits_ulong_p
diff --git a/gmp/mpf/fits_ushort.c b/gmp/mpf/fits_ushort.c
index 76a3fd9d52..8228c793c1 100644
--- a/gmp/mpf/fits_ushort.c
+++ b/gmp/mpf/fits_ushort.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpf_fits_ushort_p
diff --git a/gmp/mpf/get_d.c b/gmp/mpf/get_d.c
index 8f6f9bbea1..7be1c6be04 100644
--- a/gmp/mpf/get_d.c
+++ b/gmp/mpf/get_d.c
@@ -1,32 +1,21 @@
/* double mpf_get_d (mpf_t src) -- return SRC truncated to a double.
-Copyright 1996, 2001-2004 Free Software Foundation, Inc.
+Copyright 1996, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/get_d_2exp.c b/gmp/mpf/get_d_2exp.c
index 17ce229f25..a097ab6804 100644
--- a/gmp/mpf/get_d_2exp.c
+++ b/gmp/mpf/get_d_2exp.c
@@ -1,32 +1,21 @@
/* double mpf_get_d_2exp (signed long int *exp, mpf_t src).
-Copyright 2001-2004 Free Software Foundation, Inc.
+Copyright 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/get_dfl_prec.c b/gmp/mpf/get_dfl_prec.c
index 9a773d83ac..a44adbbe54 100644
--- a/gmp/mpf/get_dfl_prec.c
+++ b/gmp/mpf/get_dfl_prec.c
@@ -5,35 +5,24 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_bitcnt_t
-mpf_get_default_prec (void) __GMP_NOTHROW
+unsigned long
+mpf_get_default_prec (void)
{
return __GMPF_PREC_TO_BITS (__gmp_default_fp_limb_precision);
}
diff --git a/gmp/mpf/get_prc.c b/gmp/mpf/get_prc.c
index 3b3283a48c..6061063ac4 100644
--- a/gmp/mpf/get_prc.c
+++ b/gmp/mpf/get_prc.c
@@ -5,34 +5,23 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_bitcnt_t
-mpf_get_prec (mpf_srcptr x) __GMP_NOTHROW
+unsigned long int
+mpf_get_prec (mpf_srcptr x)
{
return __GMPF_PREC_TO_BITS (x->_mp_prec);
}
diff --git a/gmp/mpf/get_si.c b/gmp/mpf/get_si.c
index 5b63dbd425..a0beb2c037 100644
--- a/gmp/mpf/get_si.c
+++ b/gmp/mpf/get_si.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -51,7 +40,7 @@ see https://www.gnu.org/licenses/. */
-0x80000000 instead of the desired 0. */
long
-mpf_get_si (mpf_srcptr f) __GMP_NOTHROW
+mpf_get_si (mpf_srcptr f)
{
mp_exp_t exp;
mp_size_t size, abs_size;
@@ -83,5 +72,5 @@ mpf_get_si (mpf_srcptr f) __GMP_NOTHROW
return fl & LONG_MAX;
else
/* this form necessary to correctly handle -0x80..00 */
- return -1 - (long) ((fl - 1) & LONG_MAX);
+ return ~ ((fl - 1) & LONG_MAX);
}
diff --git a/gmp/mpf/get_str.c b/gmp/mpf/get_str.c
index 98af03272e..30b12e7c29 100644
--- a/gmp/mpf/get_str.c
+++ b/gmp/mpf/get_str.c
@@ -4,33 +4,23 @@
example, the number 3.1416 would be returned as "31416" in DIGIT_PTR and
1 in EXP.
-Copyright 1993-1997, 2000-2003, 2005, 2006, 2011 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdlib.h> /* for NULL */
#include "gmp.h"
@@ -77,7 +67,7 @@ mpn_pow_1_highpart (mp_ptr rp, mp_size_t *ignp,
count_leading_zeros (cnt, exp);
for (i = GMP_LIMB_BITS - cnt - 2; i >= 0; i--)
{
- mpn_sqr (tp, rp + off, rn);
+ mpn_sqr_n (tp, rp + off, rn);
rn = 2 * rn;
rn -= tp[rn - 1] == 0;
ign <<= 1;
@@ -141,7 +131,7 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
if (base >= 0)
{
num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
+ if (base == 0)
base = 10;
else if (base > 36)
{
@@ -153,10 +143,6 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
- return NULL;
num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
@@ -188,7 +174,8 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
conversion.) */
tstr = (unsigned char *) TMP_ALLOC (n_digits + 2 * GMP_LIMB_BITS + 3);
- LIMBS_PER_DIGIT_IN_BASE (n_limbs_needed, n_digits, base);
+ n_limbs_needed = 2 + (mp_size_t)
+ (n_digits / (GMP_NUMB_BITS * mp_bases[base].chars_per_bit_exactly));
if (ue <= n_limbs_needed)
{
@@ -197,7 +184,7 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
unsigned long e;
n_more_limbs_needed = n_limbs_needed - ue;
- DIGITS_IN_BASE_PER_LIMB (e, n_more_limbs_needed, base);
+ e = (unsigned long) n_more_limbs_needed * (GMP_NUMB_BITS * mp_bases[base].chars_per_bit_exactly);
if (un > n_limbs_needed)
{
@@ -234,7 +221,7 @@ mpf_get_str (char *dbuf, mp_exp_t *exp, int base, size_t n_digits, mpf_srcptr u)
mp_ptr dummyp, xp;
n_less_limbs_needed = ue - n_limbs_needed;
- DIGITS_IN_BASE_PER_LIMB (e, n_less_limbs_needed, base);
+ e = (unsigned long) n_less_limbs_needed * (GMP_NUMB_BITS * mp_bases[base].chars_per_bit_exactly);
if (un > n_limbs_needed)
{
diff --git a/gmp/mpf/get_ui.c b/gmp/mpf/get_ui.c
index eb9b30e69c..0acaf94a87 100644
--- a/gmp/mpf/get_ui.c
+++ b/gmp/mpf/get_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -72,7 +61,7 @@ see https://www.gnu.org/licenses/. */
tested first we ensure MP_EXP_T_MIN doesn't reach exp>1. */
unsigned long
-mpf_get_ui (mpf_srcptr f) __GMP_NOTHROW
+mpf_get_ui (mpf_srcptr f)
{
mp_size_t size;
mp_exp_t exp;
diff --git a/gmp/mpf/init.c b/gmp/mpf/init.c
index d8590f27a7..fae6f199bd 100644
--- a/gmp/mpf/init.c
+++ b/gmp/mpf/init.c
@@ -1,32 +1,21 @@
/* mpf_init() -- Make a new multiple precision number with value 0.
-Copyright 1993-1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,5 +27,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) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
}
diff --git a/gmp/mpf/init2.c b/gmp/mpf/init2.c
index a7891e33dd..8fc4b938ad 100644
--- a/gmp/mpf/init2.c
+++ b/gmp/mpf/init2.c
@@ -1,38 +1,27 @@
/* mpf_init2() -- Make a new multiple precision number with value 0.
-Copyright 1993-1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpf_init2 (mpf_ptr r, mp_bitcnt_t prec_in_bits)
+mpf_init2 (mpf_ptr r, unsigned long int prec_in_bits)
{
mp_size_t prec;
@@ -40,5 +29,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) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
}
diff --git a/gmp/mpf/inits.c b/gmp/mpf/inits.c
deleted file mode 100644
index fb14c6b0fd..0000000000
--- a/gmp/mpf/inits.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* mpf_inits() -- Initialize multiple mpf_t variables and set them to 0.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 <stdarg.h>
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-mpf_inits (mpf_ptr x, ...)
-{
- va_list ap;
-
- va_start (ap, x);
-
- while (x != NULL)
- {
- mpf_init (x);
- x = va_arg (ap, mpf_ptr);
- }
- va_end (ap);
-}
diff --git a/gmp/mpf/inp_str.c b/gmp/mpf/inp_str.c
index 45cc34cebb..042a20d8ec 100644
--- a/gmp/mpf/inp_str.c
+++ b/gmp/mpf/inp_str.c
@@ -1,33 +1,22 @@
/* 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-2002, 2005 Free Software Foundation, Inc.
+Copyright 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <ctype.h>
diff --git a/gmp/mpf/int_p.c b/gmp/mpf/int_p.c
index 91e62266be..d43dcf8136 100644
--- a/gmp/mpf/int_p.c
+++ b/gmp/mpf/int_p.c
@@ -6,35 +6,24 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpf_integer_p (mpf_srcptr f) __GMP_NOTHROW
+mpf_integer_p (mpf_srcptr f)
{
mp_srcptr ptr;
mp_exp_t exp;
diff --git a/gmp/mpf/iset.c b/gmp/mpf/iset.c
index c8c35e50e9..60ccebc6c1 100644
--- a/gmp/mpf/iset.c
+++ b/gmp/mpf/iset.c
@@ -1,32 +1,21 @@
/* mpf_init_set -- Initialize a float and assign it from another float.
-Copyright 1993-1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -39,7 +28,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) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
r->_mp_prec = prec;
prec++; /* lie not to lose precision in assignment */
diff --git a/gmp/mpf/iset_d.c b/gmp/mpf/iset_d.c
index d128db9b4d..e0ac14196a 100644
--- a/gmp/mpf/iset_d.c
+++ b/gmp/mpf/iset_d.c
@@ -1,32 +1,21 @@
/* mpf_init_set_d -- Initialize a float and assign it from a double.
-Copyright 1993-1995, 2000, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -36,7 +25,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) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
mpf_set_d (r, val);
}
diff --git a/gmp/mpf/iset_si.c b/gmp/mpf/iset_si.c
index f7e9005086..be5490807d 100644
--- a/gmp/mpf/iset_si.c
+++ b/gmp/mpf/iset_si.c
@@ -1,33 +1,22 @@
/* mpf_init_set_si() -- Initialize a float and assign it from a signed int.
-Copyright 1993-1995, 2000, 2001, 2003, 2004, 2012 Free Software Foundation,
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,9 +29,9 @@ 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) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
- vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
+ vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
r->_mp_d[0] = vl & GMP_NUMB_MASK;
size = vl != 0;
diff --git a/gmp/mpf/iset_str.c b/gmp/mpf/iset_str.c
index a181f80c93..82a6f2e4f8 100644
--- a/gmp/mpf/iset_str.c
+++ b/gmp/mpf/iset_str.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,7 +27,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) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
return mpf_set_str (r, s, base);
}
diff --git a/gmp/mpf/iset_ui.c b/gmp/mpf/iset_ui.c
index f047982116..4ac1771e98 100644
--- a/gmp/mpf/iset_ui.c
+++ b/gmp/mpf/iset_ui.c
@@ -1,32 +1,22 @@
/* mpf_init_set_ui() -- Initialize a float and assign it from an unsigned int.
-Copyright 1993-1995, 2000, 2001, 2003, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,7 +28,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) ((size_t) (prec + 1) * GMP_LIMB_BYTES);
+ r->_mp_d = (mp_ptr) (*__gmp_allocate_func) ((prec + 1) * BYTES_PER_MP_LIMB);
r->_mp_d[0] = val & GMP_NUMB_MASK;
size = (val != 0);
diff --git a/gmp/mpf/mul.c b/gmp/mpf/mul.c
index 41d1db7c14..d4d9143746 100644
--- a/gmp/mpf/mul.c
+++ b/gmp/mpf/mul.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -74,7 +63,7 @@ mpf_mul (mpf_ptr r, mpf_srcptr u, mpf_srcptr v)
mp_size_t adj;
rsize = usize + vsize;
- tp = TMP_ALLOC_LIMBS (rsize);
+ tp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB);
cy_limb = (usize >= vsize
? mpn_mul (tp, up, usize, vp, vsize)
: mpn_mul (tp, vp, vsize, up, usize));
diff --git a/gmp/mpf/mul_2exp.c b/gmp/mpf/mul_2exp.c
index 83df2176d3..bd7df9c46f 100644
--- a/gmp/mpf/mul_2exp.c
+++ b/gmp/mpf/mul_2exp.c
@@ -1,32 +1,22 @@
/* mpf_mul_2exp -- Multiply a float by 2^n.
-Copyright 1993, 1994, 1996, 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -69,7 +59,7 @@ see https://www.gnu.org/licenses/. */
then use that mpn_rshift. */
void
-mpf_mul_2exp (mpf_ptr r, mpf_srcptr u, mp_bitcnt_t exp)
+mpf_mul_2exp (mpf_ptr r, mpf_srcptr u, unsigned long int exp)
{
mp_srcptr up;
mp_ptr rp = r->_mp_d;
diff --git a/gmp/mpf/mul_ui.c b/gmp/mpf/mul_ui.c
index 031b2fe06f..96e8012a46 100644
--- a/gmp/mpf/mul_ui.c
+++ b/gmp/mpf/mul_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/neg.c b/gmp/mpf/neg.c
index 553018f306..c7d7d47d0a 100644
--- a/gmp/mpf/neg.c
+++ b/gmp/mpf/neg.c
@@ -1,32 +1,21 @@
/* mpf_neg -- Negate a float.
-Copyright 1993-1995, 2001 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/out_str.c b/gmp/mpf/out_str.c
index 200da74806..afccdbb031 100644
--- a/gmp/mpf/out_str.c
+++ b/gmp/mpf/out_str.c
@@ -2,33 +2,22 @@
the float OP to STREAM in base BASE. Return the number of characters
written, or 0 if an error occurred.
-Copyright 1996, 1997, 2001, 2002, 2005, 2011 Free Software Foundation, Inc.
+Copyright 1996, 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 _GNU_SOURCE /* for DECIMAL_POINT in langinfo.h */
@@ -47,7 +36,6 @@ see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
size_t
diff --git a/gmp/mpf/pow_ui.c b/gmp/mpf/pow_ui.c
index a5af431059..5d029147eb 100644
--- a/gmp/mpf/pow_ui.c
+++ b/gmp/mpf/pow_ui.c
@@ -1,32 +1,21 @@
/* mpf_pow_ui -- Compute b^e.
-Copyright 1998, 1999, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,18 +24,18 @@ void
mpf_pow_ui (mpf_ptr r, mpf_srcptr b, unsigned long int e)
{
mpf_t b2;
+ unsigned long int e2;
mpf_init2 (b2, mpf_get_prec (r));
mpf_set (b2, b);
+ mpf_set_ui (r, 1);
if ((e & 1) != 0)
- mpf_set (r, b);
- else
- mpf_set_ui (r, 1);
- while (e >>= 1)
+ mpf_set (r, b2);
+ for (e2 = e >> 1; e2 != 0; e2 >>= 1)
{
mpf_mul (b2, b2, b2);
- if ((e & 1) != 0)
+ if ((e2 & 1) != 0)
mpf_mul (r, r, b2);
}
diff --git a/gmp/mpf/random2.c b/gmp/mpf/random2.c
index 4d7f37e976..d1bef10724 100644
--- a/gmp/mpf/random2.c
+++ b/gmp/mpf/random2.c
@@ -2,33 +2,22 @@
long runs of consecutive ones and zeros in the binary representation.
Intended for testing of other MP routines.
-Copyright 1995, 1996, 2001-2003 Free Software Foundation, Inc.
+Copyright 1995, 1996, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/reldiff.c b/gmp/mpf/reldiff.c
index f49da08166..f9e40b66e8 100644
--- a/gmp/mpf/reldiff.c
+++ b/gmp/mpf/reldiff.c
@@ -5,36 +5,25 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
/* The precision we use for d = x-y is based on what mpf_div will want from
- the dividend. It calls mpn_div_q to produce a quotient of rprec+1 limbs.
- So rprec+1 == dsize - xsize + 1, hence dprec = rprec+xsize. */
+ the dividend. It calls mpn_tdiv_qr to produce a quotient of rprec+1
+ limbs. So rprec+1 == dsize - xsize + 1, hence dprec = rprec+xsize. */
void
mpf_reldiff (mpf_t rdiff, mpf_srcptr x, mpf_srcptr y)
diff --git a/gmp/mpf/set.c b/gmp/mpf/set.c
index ec8161d779..115ab710e4 100644
--- a/gmp/mpf/set.c
+++ b/gmp/mpf/set.c
@@ -1,32 +1,21 @@
/* mpf_set -- Assign a float from another float.
-Copyright 1993-1995, 2001, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/set_d.c b/gmp/mpf/set_d.c
index 100194d116..d72865ddcc 100644
--- a/gmp/mpf/set_d.c
+++ b/gmp/mpf/set_d.c
@@ -1,32 +1,22 @@
/* mpf_set_d -- Assign a float from a double.
-Copyright 1993-1996, 2001, 2003, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
diff --git a/gmp/mpf/set_dfl_prec.c b/gmp/mpf/set_dfl_prec.c
index 04c9a55135..5266745be8 100644
--- a/gmp/mpf/set_dfl_prec.c
+++ b/gmp/mpf/set_dfl_prec.c
@@ -1,32 +1,21 @@
/* mpf_set_default_prec --
-Copyright 1993-1995, 2001 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -34,7 +23,7 @@ see https://www.gnu.org/licenses/. */
mp_size_t __gmp_default_fp_limb_precision = __GMPF_BITS_TO_PREC (53);
void
-mpf_set_default_prec (mp_bitcnt_t prec_in_bits) __GMP_NOTHROW
+mpf_set_default_prec (unsigned long int prec_in_bits)
{
__gmp_default_fp_limb_precision = __GMPF_BITS_TO_PREC (prec_in_bits);
}
diff --git a/gmp/mpf/set_prc.c b/gmp/mpf/set_prc.c
index 30ba06c6e6..52f44aa457 100644
--- a/gmp/mpf/set_prc.c
+++ b/gmp/mpf/set_prc.c
@@ -1,32 +1,21 @@
/* mpf_set_prec(x) -- Change the precision of x.
-Copyright 1993-1995, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1993, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -39,7 +28,7 @@ see https://www.gnu.org/licenses/. */
inconsistent. */
void
-mpf_set_prec (mpf_ptr x, mp_bitcnt_t new_prec_in_bits)
+mpf_set_prec (mpf_ptr x, unsigned long int new_prec_in_bits)
{
mp_size_t old_prec, new_prec, new_prec_plus1;
mp_size_t size, sign;
diff --git a/gmp/mpf/set_prc_raw.c b/gmp/mpf/set_prc_raw.c
index 7799442299..f6c6ac3453 100644
--- a/gmp/mpf/set_prc_raw.c
+++ b/gmp/mpf/set_prc_raw.c
@@ -7,34 +7,23 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpf_set_prec_raw (mpf_ptr x, mp_bitcnt_t prec_in_bits) __GMP_NOTHROW
+mpf_set_prec_raw (mpf_ptr x, unsigned long int prec_in_bits)
{
x->_mp_prec = __GMPF_BITS_TO_PREC (prec_in_bits);
}
diff --git a/gmp/mpf/set_q.c b/gmp/mpf/set_q.c
index c5739b2abe..a54aa3b165 100644
--- a/gmp/mpf/set_q.c
+++ b/gmp/mpf/set_q.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
diff --git a/gmp/mpf/set_si.c b/gmp/mpf/set_si.c
index 9c47c7511f..9c5605b5e2 100644
--- a/gmp/mpf/set_si.c
+++ b/gmp/mpf/set_si.c
@@ -1,32 +1,22 @@
/* mpf_set_si() -- Assign a float from a signed int.
-Copyright 1993-1995, 2000-2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,7 +27,7 @@ mpf_set_si (mpf_ptr dest, long val)
mp_size_t size;
mp_limb_t vl;
- vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
+ vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
dest->_mp_d[0] = vl & GMP_NUMB_MASK;
size = vl != 0;
diff --git a/gmp/mpf/set_str.c b/gmp/mpf/set_str.c
index 9053accade..ce8a6bac37 100644
--- a/gmp/mpf/set_str.c
+++ b/gmp/mpf/set_str.c
@@ -2,40 +2,29 @@
in base BASE to a float in dest. If BASE is zero, the leading characters
of STRING is used to figure out the base.
-Copyright 1993-1997, 2000-2003, 2005, 2007, 2008, 2011, 2013 Free Software
-Foundation, Inc.
+Copyright 1993, 1994, 1995, 1996, 1997, 2000, 2001, 2002, 2003, 2005, 2007,
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 still needs work, as suggested by some FIXME comments.
1. Don't depend on superfluous mantissa digits.
2. Allocate temp space more cleverly.
- 3. Use mpn_div_q instead of mpn_lshift+mpn_divrem.
+ 3. Use mpn_tdiv_qr instead of mpn_lshift+mpn_divrem.
*/
#define _GNU_SOURCE /* for DECIMAL_POINT in langinfo.h */
@@ -58,7 +47,7 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "longlong.h"
-
+extern const unsigned char __gmp_digit_value_tab[];
#define digit_value_tab __gmp_digit_value_tab
/* Compute base^exp and return the most significant prec limbs in rp[].
@@ -83,7 +72,7 @@ mpn_pow_1_highpart (mp_ptr rp, mp_size_t *ignp,
count_leading_zeros (cnt, exp);
for (i = GMP_LIMB_BITS - cnt - 2; i >= 0; i--)
{
- mpn_sqr (tp, rp + off, rn);
+ mpn_sqr_n (tp, rp + off, rn);
rn = 2 * rn;
rn -= tp[rn - 1] == 0;
ign <<= 1;
@@ -165,19 +154,19 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
{
/* For bases > 36, use the collating sequence
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. */
- digit_value += 208;
+ digit_value += 224;
if (base > 62)
return -1; /* too large base */
}
/* Require at least one digit, possibly after an initial decimal point. */
- if (digit_value[c] >= base)
+ if (digit_value[c] >= (base == 0 ? 10 : 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)
+ if (str[i] != point[i])
+ return -1;
+ if (digit_value[(unsigned char) str[pointlen]] >= (base == 0 ? 10 : base))
return -1;
}
@@ -207,10 +196,10 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
{
int dig;
- for (j = 0; j < pointlen; j++)
- if (str[j] != point[j])
- goto not_point;
- if (1)
+ for (j = 0; j < pointlen; j++)
+ if (str[j] != point[j])
+ goto not_point;
+ if (1)
{
if (dotpos != 0)
{
@@ -224,7 +213,7 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
}
else
{
- not_point:
+ not_point:
dig = digit_value[c];
if (dig >= base)
{
@@ -255,12 +244,14 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
/* This breaks things like 0.000...0001. To safely ignore superfluous
digits, we need to skip over leading zeros. */
/* Just consider the relevant leading digits of the mantissa. */
- LIMBS_PER_DIGIT_IN_BASE (n_chars_needed, prec, base);
+ n_chars_needed = 2 + (size_t)
+ (((size_t) prec * GMP_NUMB_BITS) * mp_bases[base].chars_per_bit_exactly);
if (str_size > n_chars_needed)
str_size = n_chars_needed;
#endif
- LIMBS_PER_DIGIT_IN_BASE (ma, str_size, base);
+ ma = 2 + (mp_size_t)
+ (str_size / (GMP_NUMB_BITS * mp_bases[base].chars_per_bit_exactly));
mp = TMP_ALLOC_LIMBS (ma);
mn = mpn_set_str (mp, (unsigned char *) begs, str_size, base);
@@ -332,10 +323,8 @@ mpf_set_str (mpf_ptr x, const char *str, int base)
if (divflag)
{
#if 0
- /* FIXME: Should use mpn_div_q here. */
- ...
- mpn_div_q (tp, mp, mn, rp, rn, scratch);
- ...
+ /* FIXME: Should use mpn_tdiv here. */
+ mpn_tdiv_qr (qp, mp, 0L, mp, mn, rp, rn);
#else
mp_ptr qp;
mp_limb_t qlimb;
diff --git a/gmp/mpf/set_ui.c b/gmp/mpf/set_ui.c
index 617bce13c1..3a793c8929 100644
--- a/gmp/mpf/set_ui.c
+++ b/gmp/mpf/set_ui.c
@@ -1,32 +1,21 @@
/* mpf_set_ui() -- Assign a float from an unsigned int.
-Copyright 1993-1995, 2001, 2002, 2004 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/set_z.c b/gmp/mpf/set_z.c
index fe91904563..4b0f01beae 100644
--- a/gmp/mpf/set_z.c
+++ b/gmp/mpf/set_z.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/size.c b/gmp/mpf/size.c
index c6b22b64cc..514873e9b4 100644
--- a/gmp/mpf/size.c
+++ b/gmp/mpf/size.c
@@ -1,39 +1,28 @@
/* mpf_size(x) -- return the number of limbs currently used by the
value of the float X.
-Copyright 1993-1995, 2001 Free Software Foundation, Inc.
+Copyright 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
size_t
-mpf_size (mpf_srcptr f) __GMP_NOTHROW
+mpf_size (mpf_srcptr f)
{
return __GMP_ABS (f->_mp_size);
}
diff --git a/gmp/mpf/sqrt.c b/gmp/mpf/sqrt.c
index 44502244e2..19a7ca08b0 100644
--- a/gmp/mpf/sqrt.c
+++ b/gmp/mpf/sqrt.c
@@ -1,33 +1,22 @@
/* mpf_sqrt -- Compute the square root of a float.
-Copyright 1993, 1994, 1996, 2000, 2001, 2004, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1993, 1994, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -70,7 +59,7 @@ mpf_sqrt (mpf_ptr r, mpf_srcptr u)
TMP_DECL;
usize = u->_mp_size;
- if (UNLIKELY (usize <= 0))
+ if (usize <= 0)
{
if (usize < 0)
SQRT_OF_NEGATIVE;
@@ -93,7 +82,7 @@ mpf_sqrt (mpf_ptr r, mpf_srcptr u)
/* root size is ceil(tsize/2), this will be our desired "prec" limbs */
ASSERT ((tsize + 1) / 2 == prec);
- tp = TMP_ALLOC_LIMBS (tsize);
+ tp = (mp_ptr) TMP_ALLOC (tsize * BYTES_PER_MP_LIMB);
if (usize > tsize)
{
diff --git a/gmp/mpf/sqrt_ui.c b/gmp/mpf/sqrt_ui.c
index 82dec7bcb3..17a39910fe 100644
--- a/gmp/mpf/sqrt_ui.c
+++ b/gmp/mpf/sqrt_ui.c
@@ -6,28 +6,17 @@ Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -88,7 +77,7 @@ mpf_sqrt_ui (mpf_ptr r, unsigned long int u)
zeros = 2 * prec - 2;
rsize = zeros + 1 + U2;
- tp = TMP_ALLOC_LIMBS (rsize);
+ tp = (mp_ptr) TMP_ALLOC (rsize * BYTES_PER_MP_LIMB);
MPN_ZERO (tp, zeros);
tp[zeros] = u & GMP_NUMB_MASK;
diff --git a/gmp/mpf/sub.c b/gmp/mpf/sub.c
index 3aaf192790..23f82273b7 100644
--- a/gmp/mpf/sub.c
+++ b/gmp/mpf/sub.c
@@ -1,32 +1,22 @@
/* mpf_sub -- Subtract two floats.
-Copyright 1993-1996, 1999-2002, 2004, 2005, 2011 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 1996, 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -204,7 +194,7 @@ mpf_sub (mpf_ptr r, mpf_srcptr u, mpf_srcptr v)
vsize = prec - 1;
}
- tp = TMP_ALLOC_LIMBS (prec);
+ tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB);
{
mp_limb_t cy_limb;
if (vsize == 0)
@@ -283,19 +273,19 @@ general_case:
vsize = prec - ediff;
}
+ /* Allocate temp space for the result. Allocate
+ just vsize + ediff later??? */
+ tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB);
+
if (ediff >= prec)
{
/* V completely cancelled. */
- if (rp != up)
+ if (tp != up)
MPN_COPY (rp, up, usize);
rsize = usize;
}
else
{
- /* Allocate temp space for the result. Allocate
- just vsize + ediff later??? */
- tp = TMP_ALLOC_LIMBS (prec);
-
/* Locate the least significant non-zero limb in (the needed
parts of) U and V, to simplify the code below. */
for (;;)
diff --git a/gmp/mpf/sub_ui.c b/gmp/mpf/sub_ui.c
index cf9b88eb00..4ce7595ed2 100644
--- a/gmp/mpf/sub_ui.c
+++ b/gmp/mpf/sub_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/swap.c b/gmp/mpf/swap.c
index a370652876..61c99f5cf1 100644
--- a/gmp/mpf/swap.c
+++ b/gmp/mpf/swap.c
@@ -1,57 +1,50 @@
/* mpf_swap (U, V) -- Swap U and V.
-Copyright 1997, 1998, 2000, 2001, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpf_swap (mpf_ptr u, mpf_ptr v) __GMP_NOTHROW
+mpf_swap (mpf_ptr u, mpf_ptr v)
{
- 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;
+ 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;
}
diff --git a/gmp/mpf/trunc.c b/gmp/mpf/trunc.c
index 5f94f7aec8..d329bc1bc5 100644
--- a/gmp/mpf/trunc.c
+++ b/gmp/mpf/trunc.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpf/ui_div.c b/gmp/mpf/ui_div.c
index ceb881ebcc..39a0bd9198 100644
--- a/gmp/mpf/ui_div.c
+++ b/gmp/mpf/ui_div.c
@@ -1,32 +1,22 @@
/* mpf_ui_div -- Divide an unsigned integer with a float.
-Copyright 1993-1996, 2000-2002, 2004, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -48,6 +38,8 @@ mpf_ui_div (mpf_ptr r, unsigned long int u, mpf_srcptr v)
vsize = v->_mp_size;
sign_quotient = vsize;
+ vsize = ABS (vsize);
+ prec = r->_mp_prec;
if (UNLIKELY (vsize == 0))
DIVIDE_BY_ZERO;
@@ -59,9 +51,6 @@ mpf_ui_div (mpf_ptr r, unsigned long int u, mpf_srcptr v)
return;
}
- vsize = ABS (vsize);
- prec = r->_mp_prec;
-
TMP_MARK;
rexp = 1 - v->_mp_exp + 1;
diff --git a/gmp/mpf/ui_sub.c b/gmp/mpf/ui_sub.c
index b7a536eb8b..a665cc058b 100644
--- a/gmp/mpf/ui_sub.c
+++ b/gmp/mpf/ui_sub.c
@@ -1,32 +1,22 @@
/* mpf_ui_sub -- Subtract a float from an unsigned long int.
-Copyright 1993-1996, 2001, 2002, 2005 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -150,7 +140,7 @@ mpf_ui_sub (mpf_ptr r, unsigned long int u, mpf_srcptr v)
/* Allocate temp space for the result. Allocate
just vsize + ediff later??? */
- tp = TMP_ALLOC_LIMBS (prec);
+ tp = (mp_ptr) TMP_ALLOC (prec * BYTES_PER_MP_LIMB);
if (ediff >= prec)
{
diff --git a/gmp/mpf/urandomb.c b/gmp/mpf/urandomb.c
index 72271e8762..41a4bc3c3d 100644
--- a/gmp/mpf/urandomb.c
+++ b/gmp/mpf/urandomb.c
@@ -3,39 +3,28 @@
using STATE as the random state previously initialized by a call to
gmp_randinit().
-Copyright 1999-2002 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpf_urandomb (mpf_t rop, gmp_randstate_t rstate, mp_bitcnt_t nbits)
+mpf_urandomb (mpf_t rop, gmp_randstate_t rstate, unsigned long int nbits)
{
mp_ptr rp;
mp_size_t nlimbs;
diff --git a/gmp/mpn/Makeasm.am b/gmp/mpn/Makeasm.am
index 5d7306c221..bb66700384 100644
--- a/gmp/mpn/Makeasm.am
+++ b/gmp/mpn/Makeasm.am
@@ -1,32 +1,22 @@
## Automake asm file rules.
-# Copyright 1996, 1998-2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 1999, 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# COMPILE minus CC.
diff --git a/gmp/mpn/Makefile.am b/gmp/mpn/Makefile.am
index 20b8a4a116..073b89e988 100644
--- a/gmp/mpn/Makefile.am
+++ b/gmp/mpn/Makefile.am
@@ -1,32 +1,22 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1996, 1998-2002, 2005, 2011, 2013 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) \
@@ -34,14 +24,42 @@ INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) \
OFILES = @mpn_objects@
+
+# All possible mpn normal and optional function files are listed here, to
+# get automake to generate ansi2knr rules for each. Such rules will be
+# ignored for any that are instead implemented with a .asm (or whatever) for
+# a particular target.
+#
+nodist_EXTRA_libmpn_la_SOURCES = \
+ add.c add_1.c add_n.c \
+ addmul_1.c addmul_2.c addmul_3.c addmul_4.c addmul_5.c addmul_6.c \
+ addmul_7.c addmul_8.c \
+ and_n.c andn_n.c bdivmod.c \
+ cmp.c com_n.c copyd.c copyi.c \
+ dc_divrem_n.c dive_1.c diveby3.c divis.c divrem.c divrem_1.c divrem_2.c \
+ dump.c fib2_ui.c gcd.c \
+ gcd_1.c gcdext.c get_d.c get_str.c \
+ hamdist.c hgcd2.c hgcd.c invert_limb.c \
+ ior_n.c iorn_n.c jacbase.c lshift.c \
+ matrix22_mul.c mod_1.c mod_34lsub1.c mode1o.c \
+ mod_1_1.c mod_1_2.c mod_1_3.c mod_1_4.c \
+ mul.c mul_1.c mul_2.c mul_3.c mul_4.c mul_fft.c mul_n.c mul_basecase.c \
+ mul_toom22.c mul_toom32.c mul_toom42.c \
+ mullow_n.c mullow_basecase.c nand_n.c neg_n.c nior_n.c perfsqr.c \
+ popcount.c pre_divrem_1.c pre_mod_1.c pow_1.c random.c random2.c rshift.c \
+ rootrem.c sb_divrem_mn.c scan0.c scan1.c set_str.c \
+ sqr_basecase.c sqr_diagonal.c \
+ sqrtrem.c sub.c sub_1.c sub_n.c submul_1.c \
+ tdiv_qr.c udiv_qrnnd.c udiv_w_sdiv.c xor_n.c xnor_n.c
+
noinst_LTLIBRARIES = libmpn.la
nodist_libmpn_la_SOURCES = fib_table.c mp_bases.c
libmpn_la_LIBADD = $(OFILES)
libmpn_la_DEPENDENCIES = $(OFILES)
-TARG_DIST = alpha arm arm64 cray generic ia64 lisp m68k m88k \
- minithres mips32 mips64 pa32 pa64 power powerpc32 powerpc64 \
- s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64
+TARG_DIST = a29k alpha arm clipper cray generic i960 ia64 lisp m68k m88k \
+ minithres mips32 mips64 ns32k pa32 pa64 power powerpc32 powerpc64 pyr s390 \
+ sh sparc32 sparc64 thumb vax x86 x86_64 z8000 z8000x
EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST)
@@ -56,4 +74,7 @@ mp_bases.c:
perfsqr.h:
cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/perfsqr.h
+tune-gcd-p: gcd.c
+ $(COMPILE) -g -O1 -I $(top_srcdir)/tune -DTUNE_GCD_P=1 gcd.c -o tune-gcd-p -L ../.libs -L../tune/.libs -lspeed -lgmp -lm
+
include Makeasm.am
diff --git a/gmp/mpn/Makefile.in b/gmp/mpn/Makefile.in
index 099abf26ab..e9817864fc 100644
--- a/gmp/mpn/Makefile.in
+++ b/gmp/mpn/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,85 +14,53 @@
@SET_MAKE@
-# Copyright 1996, 1998-2002, 2005, 2011, 2013 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2005 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have 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 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:
+# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+# Inc.
#
-# * the GNU 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.
#
-# or
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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 distributed in the hope that it will be useful, but
+# WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
+# or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+# License for more details.
#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+SOURCES = $(nodist_libmpn_la_SOURCES) $(nodist_EXTRA_libmpn_la_SOURCES)
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -105,43 +72,37 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
DIST_COMMON = README $(srcdir)/Makeasm.am $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
subdir = mpn
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
am__DEPENDENCIES_1 =
-nodist_libmpn_la_OBJECTS = fib_table.lo mp_bases.lo
+nodist_libmpn_la_OBJECTS = fib_table$U.lo mp_bases$U.lo
libmpn_la_OBJECTS = $(nodist_libmpn_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(nodist_libmpn_la_SOURCES)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = $(nodist_libmpn_la_SOURCES) \
+ $(nodist_EXTRA_libmpn_la_SOURCES)
DIST_SOURCES =
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -155,6 +116,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -170,17 +132,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -194,12 +155,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -214,26 +173,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -243,31 +196,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -291,6 +239,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -298,23 +247,47 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir) \
-DOPERATION_`echo $* | sed 's/_$$//'`
OFILES = @mpn_objects@
+
+# All possible mpn normal and optional function files are listed here, to
+# get automake to generate ansi2knr rules for each. Such rules will be
+# ignored for any that are instead implemented with a .asm (or whatever) for
+# a particular target.
+#
+nodist_EXTRA_libmpn_la_SOURCES = \
+ add.c add_1.c add_n.c \
+ addmul_1.c addmul_2.c addmul_3.c addmul_4.c addmul_5.c addmul_6.c \
+ addmul_7.c addmul_8.c \
+ and_n.c andn_n.c bdivmod.c \
+ cmp.c com_n.c copyd.c copyi.c \
+ dc_divrem_n.c dive_1.c diveby3.c divis.c divrem.c divrem_1.c divrem_2.c \
+ dump.c fib2_ui.c gcd.c \
+ gcd_1.c gcdext.c get_d.c get_str.c \
+ hamdist.c hgcd2.c hgcd.c invert_limb.c \
+ ior_n.c iorn_n.c jacbase.c lshift.c \
+ matrix22_mul.c mod_1.c mod_34lsub1.c mode1o.c \
+ mod_1_1.c mod_1_2.c mod_1_3.c mod_1_4.c \
+ mul.c mul_1.c mul_2.c mul_3.c mul_4.c mul_fft.c mul_n.c mul_basecase.c \
+ mul_toom22.c mul_toom32.c mul_toom42.c \
+ mullow_n.c mullow_basecase.c nand_n.c neg_n.c nior_n.c perfsqr.c \
+ popcount.c pre_divrem_1.c pre_mod_1.c pow_1.c random.c random2.c rshift.c \
+ rootrem.c sb_divrem_mn.c scan0.c scan1.c set_str.c \
+ sqr_basecase.c sqr_diagonal.c \
+ sqrtrem.c sub.c sub_1.c sub_n.c submul_1.c \
+ tdiv_qr.c udiv_qrnnd.c udiv_w_sdiv.c xor_n.c xnor_n.c
+
noinst_LTLIBRARIES = libmpn.la
nodist_libmpn_la_SOURCES = fib_table.c mp_bases.c
libmpn_la_LIBADD = $(OFILES)
libmpn_la_DEPENDENCIES = $(OFILES)
-TARG_DIST = alpha arm arm64 cray generic ia64 lisp m68k m88k \
- minithres mips32 mips64 pa32 pa64 power powerpc32 powerpc64 \
- s390_32 s390_64 sh sparc32 sparc64 thumb vax x86 x86_64
+TARG_DIST = a29k alpha arm clipper cray generic i960 ia64 lisp m68k m88k \
+ minithres mips32 mips64 ns32k pa32 pa64 power powerpc32 powerpc64 pyr s390 \
+ sh sparc32 sparc64 thumb vax x86 x86_64 z8000 z8000x
EXTRA_DIST = asm-defs.m4 cpp-ccas m4-ccas $(TARG_DIST)
@@ -354,14 +327,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/Ma
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpn/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps mpn/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpn/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps mpn/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -371,7 +344,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
-$(srcdir)/Makeasm.am:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -380,24 +352,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libmpn.la: $(libmpn_la_OBJECTS) $(libmpn_la_DEPENDENCIES) $(EXTRA_libmpn_la_DEPENDENCIES)
- $(LINK) $(libmpn_la_OBJECTS) $(libmpn_la_LIBADD) $(LIBS)
+libmpn.la: $(libmpn_la_OBJECTS) $(libmpn_la_DEPENDENCIES)
+ $(LINK) $(libmpn_la_LDFLAGS) $(libmpn_la_OBJECTS) $(libmpn_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -407,6 +383,233 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+add_.c: add.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add.c; then echo $(srcdir)/add.c; else echo add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_1_.c: add_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_1.c; then echo $(srcdir)/add_1.c; else echo add_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_n_.c: add_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_n.c; then echo $(srcdir)/add_n.c; else echo add_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_1_.c: addmul_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_1.c; then echo $(srcdir)/addmul_1.c; else echo addmul_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_2_.c: addmul_2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_2.c; then echo $(srcdir)/addmul_2.c; else echo addmul_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_3_.c: addmul_3.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_3.c; then echo $(srcdir)/addmul_3.c; else echo addmul_3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_4_.c: addmul_4.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_4.c; then echo $(srcdir)/addmul_4.c; else echo addmul_4.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_5_.c: addmul_5.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_5.c; then echo $(srcdir)/addmul_5.c; else echo addmul_5.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_6_.c: addmul_6.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_6.c; then echo $(srcdir)/addmul_6.c; else echo addmul_6.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_7_.c: addmul_7.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_7.c; then echo $(srcdir)/addmul_7.c; else echo addmul_7.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+addmul_8_.c: addmul_8.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/addmul_8.c; then echo $(srcdir)/addmul_8.c; else echo addmul_8.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+and_n_.c: and_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/and_n.c; then echo $(srcdir)/and_n.c; else echo and_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+andn_n_.c: andn_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/andn_n.c; then echo $(srcdir)/andn_n.c; else echo andn_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+bdivmod_.c: bdivmod.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bdivmod.c; then echo $(srcdir)/bdivmod.c; else echo bdivmod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_.c: cmp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+com_n_.c: com_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/com_n.c; then echo $(srcdir)/com_n.c; else echo com_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+copyd_.c: copyd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/copyd.c; then echo $(srcdir)/copyd.c; else echo copyd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+copyi_.c: copyi.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/copyi.c; then echo $(srcdir)/copyi.c; else echo copyi.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dc_divrem_n_.c: dc_divrem_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dc_divrem_n.c; then echo $(srcdir)/dc_divrem_n.c; else echo dc_divrem_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dive_1_.c: dive_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive_1.c; then echo $(srcdir)/dive_1.c; else echo dive_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+diveby3_.c: diveby3.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/diveby3.c; then echo $(srcdir)/diveby3.c; else echo diveby3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divis_.c: divis.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis.c; then echo $(srcdir)/divis.c; else echo divis.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem_.c: divrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem.c; then echo $(srcdir)/divrem.c; else echo divrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem_1_.c: divrem_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem_1.c; then echo $(srcdir)/divrem_1.c; else echo divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem_2_.c: divrem_2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem_2.c; then echo $(srcdir)/divrem_2.c; else echo divrem_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dump_.c: dump.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dump.c; then echo $(srcdir)/dump.c; else echo dump.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fib2_ui_.c: fib2_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib2_ui.c; then echo $(srcdir)/fib2_ui.c; else echo fib2_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fib_table_.c: fib_table.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib_table.c; then echo $(srcdir)/fib_table.c; else echo fib_table.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcd_.c: gcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd.c; then echo $(srcdir)/gcd.c; else echo gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcd_1_.c: gcd_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd_1.c; then echo $(srcdir)/gcd_1.c; else echo gcd_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcdext_.c: gcdext.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdext.c; then echo $(srcdir)/gcdext.c; else echo gcdext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_d_.c: get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_str_.c: get_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+hamdist_.c: hamdist.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hamdist.c; then echo $(srcdir)/hamdist.c; else echo hamdist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+hgcd_.c: hgcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hgcd.c; then echo $(srcdir)/hgcd.c; else echo hgcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+hgcd2_.c: hgcd2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hgcd2.c; then echo $(srcdir)/hgcd2.c; else echo hgcd2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+invert_limb_.c: invert_limb.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/invert_limb.c; then echo $(srcdir)/invert_limb.c; else echo invert_limb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ior_n_.c: ior_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ior_n.c; then echo $(srcdir)/ior_n.c; else echo ior_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iorn_n_.c: iorn_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iorn_n.c; then echo $(srcdir)/iorn_n.c; else echo iorn_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+jacbase_.c: jacbase.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jacbase.c; then echo $(srcdir)/jacbase.c; else echo jacbase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+lshift_.c: lshift.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lshift.c; then echo $(srcdir)/lshift.c; else echo lshift.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+matrix22_mul_.c: matrix22_mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/matrix22_mul.c; then echo $(srcdir)/matrix22_mul.c; else echo matrix22_mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_.c: mod_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1.c; then echo $(srcdir)/mod_1.c; else echo mod_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_1_.c: mod_1_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_1.c; then echo $(srcdir)/mod_1_1.c; else echo mod_1_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_2_.c: mod_1_2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_2.c; then echo $(srcdir)/mod_1_2.c; else echo mod_1_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_3_.c: mod_1_3.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_3.c; then echo $(srcdir)/mod_1_3.c; else echo mod_1_3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_4_.c: mod_1_4.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_4.c; then echo $(srcdir)/mod_1_4.c; else echo mod_1_4.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_34lsub1_.c: mod_34lsub1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_34lsub1.c; then echo $(srcdir)/mod_34lsub1.c; else echo mod_34lsub1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mode1o_.c: mode1o.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mode1o.c; then echo $(srcdir)/mode1o.c; else echo mode1o.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mp_bases_.c: mp_bases.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mp_bases.c; then echo $(srcdir)/mp_bases.c; else echo mp_bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_.c: mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_1_.c: mul_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_1.c; then echo $(srcdir)/mul_1.c; else echo mul_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_2_.c: mul_2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_2.c; then echo $(srcdir)/mul_2.c; else echo mul_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_3_.c: mul_3.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_3.c; then echo $(srcdir)/mul_3.c; else echo mul_3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_4_.c: mul_4.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_4.c; then echo $(srcdir)/mul_4.c; else echo mul_4.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_basecase_.c: mul_basecase.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_basecase.c; then echo $(srcdir)/mul_basecase.c; else echo mul_basecase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_fft_.c: mul_fft.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_fft.c; then echo $(srcdir)/mul_fft.c; else echo mul_fft.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_n_.c: mul_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_n.c; then echo $(srcdir)/mul_n.c; else echo mul_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_toom22_.c: mul_toom22.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_toom22.c; then echo $(srcdir)/mul_toom22.c; else echo mul_toom22.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_toom32_.c: mul_toom32.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_toom32.c; then echo $(srcdir)/mul_toom32.c; else echo mul_toom32.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_toom42_.c: mul_toom42.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_toom42.c; then echo $(srcdir)/mul_toom42.c; else echo mul_toom42.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mullow_basecase_.c: mullow_basecase.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mullow_basecase.c; then echo $(srcdir)/mullow_basecase.c; else echo mullow_basecase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mullow_n_.c: mullow_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mullow_n.c; then echo $(srcdir)/mullow_n.c; else echo mullow_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+nand_n_.c: nand_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nand_n.c; then echo $(srcdir)/nand_n.c; else echo nand_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+neg_n_.c: neg_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg_n.c; then echo $(srcdir)/neg_n.c; else echo neg_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+nior_n_.c: nior_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nior_n.c; then echo $(srcdir)/nior_n.c; else echo nior_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+perfsqr_.c: perfsqr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/perfsqr.c; then echo $(srcdir)/perfsqr.c; else echo perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+popcount_.c: popcount.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/popcount.c; then echo $(srcdir)/popcount.c; else echo popcount.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pow_1_.c: pow_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pow_1.c; then echo $(srcdir)/pow_1.c; else echo pow_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pre_divrem_1_.c: pre_divrem_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pre_divrem_1.c; then echo $(srcdir)/pre_divrem_1.c; else echo pre_divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pre_mod_1_.c: pre_mod_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pre_mod_1.c; then echo $(srcdir)/pre_mod_1.c; else echo pre_mod_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+random_.c: random.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+random2_.c: random2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random2.c; then echo $(srcdir)/random2.c; else echo random2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rootrem_.c: rootrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rootrem.c; then echo $(srcdir)/rootrem.c; else echo rootrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rshift_.c: rshift.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rshift.c; then echo $(srcdir)/rshift.c; else echo rshift.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sb_divrem_mn_.c: sb_divrem_mn.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sb_divrem_mn.c; then echo $(srcdir)/sb_divrem_mn.c; else echo sb_divrem_mn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+scan0_.c: scan0.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan0.c; then echo $(srcdir)/scan0.c; else echo scan0.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+scan1_.c: scan1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan1.c; then echo $(srcdir)/scan1.c; else echo scan1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_str_.c: set_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqr_basecase_.c: sqr_basecase.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqr_basecase.c; then echo $(srcdir)/sqr_basecase.c; else echo sqr_basecase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqr_diagonal_.c: sqr_diagonal.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqr_diagonal.c; then echo $(srcdir)/sqr_diagonal.c; else echo sqr_diagonal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqrtrem_.c: sqrtrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrtrem.c; then echo $(srcdir)/sqrtrem.c; else echo sqrtrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_.c: sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub.c; then echo $(srcdir)/sub.c; else echo sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_1_.c: sub_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_1.c; then echo $(srcdir)/sub_1.c; else echo sub_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_n_.c: sub_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_n.c; then echo $(srcdir)/sub_n.c; else echo sub_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+submul_1_.c: submul_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/submul_1.c; then echo $(srcdir)/submul_1.c; else echo submul_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_qr_.c: tdiv_qr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_qr.c; then echo $(srcdir)/tdiv_qr.c; else echo tdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+udiv_qrnnd_.c: udiv_qrnnd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/udiv_qrnnd.c; then echo $(srcdir)/udiv_qrnnd.c; else echo udiv_qrnnd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+udiv_w_sdiv_.c: udiv_w_sdiv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/udiv_w_sdiv.c; then echo $(srcdir)/udiv_w_sdiv.c; else echo udiv_w_sdiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+xnor_n_.c: xnor_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xnor_n.c; then echo $(srcdir)/xnor_n.c; else echo xnor_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+xor_n_.c: xor_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xor_n.c; then echo $(srcdir)/xor_n.c; else echo xor_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_.$(OBJEXT) add_.lo add_1_.$(OBJEXT) add_1_.lo add_n_.$(OBJEXT) \
+add_n_.lo addmul_1_.$(OBJEXT) addmul_1_.lo addmul_2_.$(OBJEXT) \
+addmul_2_.lo addmul_3_.$(OBJEXT) addmul_3_.lo addmul_4_.$(OBJEXT) \
+addmul_4_.lo addmul_5_.$(OBJEXT) addmul_5_.lo addmul_6_.$(OBJEXT) \
+addmul_6_.lo addmul_7_.$(OBJEXT) addmul_7_.lo addmul_8_.$(OBJEXT) \
+addmul_8_.lo and_n_.$(OBJEXT) and_n_.lo andn_n_.$(OBJEXT) andn_n_.lo \
+bdivmod_.$(OBJEXT) bdivmod_.lo cmp_.$(OBJEXT) cmp_.lo com_n_.$(OBJEXT) \
+com_n_.lo copyd_.$(OBJEXT) copyd_.lo copyi_.$(OBJEXT) copyi_.lo \
+dc_divrem_n_.$(OBJEXT) dc_divrem_n_.lo dive_1_.$(OBJEXT) dive_1_.lo \
+diveby3_.$(OBJEXT) diveby3_.lo divis_.$(OBJEXT) divis_.lo \
+divrem_.$(OBJEXT) divrem_.lo divrem_1_.$(OBJEXT) divrem_1_.lo \
+divrem_2_.$(OBJEXT) divrem_2_.lo dump_.$(OBJEXT) dump_.lo \
+fib2_ui_.$(OBJEXT) fib2_ui_.lo fib_table_.$(OBJEXT) fib_table_.lo \
+gcd_.$(OBJEXT) gcd_.lo gcd_1_.$(OBJEXT) gcd_1_.lo gcdext_.$(OBJEXT) \
+gcdext_.lo get_d_.$(OBJEXT) get_d_.lo get_str_.$(OBJEXT) get_str_.lo \
+hamdist_.$(OBJEXT) hamdist_.lo hgcd_.$(OBJEXT) hgcd_.lo \
+hgcd2_.$(OBJEXT) hgcd2_.lo invert_limb_.$(OBJEXT) invert_limb_.lo \
+ior_n_.$(OBJEXT) ior_n_.lo iorn_n_.$(OBJEXT) iorn_n_.lo \
+jacbase_.$(OBJEXT) jacbase_.lo lshift_.$(OBJEXT) lshift_.lo \
+matrix22_mul_.$(OBJEXT) matrix22_mul_.lo mod_1_.$(OBJEXT) mod_1_.lo \
+mod_1_1_.$(OBJEXT) mod_1_1_.lo mod_1_2_.$(OBJEXT) mod_1_2_.lo \
+mod_1_3_.$(OBJEXT) mod_1_3_.lo mod_1_4_.$(OBJEXT) mod_1_4_.lo \
+mod_34lsub1_.$(OBJEXT) mod_34lsub1_.lo mode1o_.$(OBJEXT) mode1o_.lo \
+mp_bases_.$(OBJEXT) mp_bases_.lo mul_.$(OBJEXT) mul_.lo \
+mul_1_.$(OBJEXT) mul_1_.lo mul_2_.$(OBJEXT) mul_2_.lo mul_3_.$(OBJEXT) \
+mul_3_.lo mul_4_.$(OBJEXT) mul_4_.lo mul_basecase_.$(OBJEXT) \
+mul_basecase_.lo mul_fft_.$(OBJEXT) mul_fft_.lo mul_n_.$(OBJEXT) \
+mul_n_.lo mul_toom22_.$(OBJEXT) mul_toom22_.lo mul_toom32_.$(OBJEXT) \
+mul_toom32_.lo mul_toom42_.$(OBJEXT) mul_toom42_.lo \
+mullow_basecase_.$(OBJEXT) mullow_basecase_.lo mullow_n_.$(OBJEXT) \
+mullow_n_.lo nand_n_.$(OBJEXT) nand_n_.lo neg_n_.$(OBJEXT) neg_n_.lo \
+nior_n_.$(OBJEXT) nior_n_.lo perfsqr_.$(OBJEXT) perfsqr_.lo \
+popcount_.$(OBJEXT) popcount_.lo pow_1_.$(OBJEXT) pow_1_.lo \
+pre_divrem_1_.$(OBJEXT) pre_divrem_1_.lo pre_mod_1_.$(OBJEXT) \
+pre_mod_1_.lo random_.$(OBJEXT) random_.lo random2_.$(OBJEXT) \
+random2_.lo rootrem_.$(OBJEXT) rootrem_.lo rshift_.$(OBJEXT) \
+rshift_.lo sb_divrem_mn_.$(OBJEXT) sb_divrem_mn_.lo scan0_.$(OBJEXT) \
+scan0_.lo scan1_.$(OBJEXT) scan1_.lo set_str_.$(OBJEXT) set_str_.lo \
+sqr_basecase_.$(OBJEXT) sqr_basecase_.lo sqr_diagonal_.$(OBJEXT) \
+sqr_diagonal_.lo sqrtrem_.$(OBJEXT) sqrtrem_.lo sub_.$(OBJEXT) sub_.lo \
+sub_1_.$(OBJEXT) sub_1_.lo sub_n_.$(OBJEXT) sub_n_.lo \
+submul_1_.$(OBJEXT) submul_1_.lo tdiv_qr_.$(OBJEXT) tdiv_qr_.lo \
+udiv_qrnnd_.$(OBJEXT) udiv_qrnnd_.lo udiv_w_sdiv_.$(OBJEXT) \
+udiv_w_sdiv_.lo xnor_n_.$(OBJEXT) xnor_n_.lo xor_n_.$(OBJEXT) \
+xor_n_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -414,85 +617,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -510,22 +710,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -538,7 +732,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -546,38 +740,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -586,7 +760,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -597,22 +771,19 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
# These are BUILT_SOURCES at the top-level, so normally they're built before
@@ -625,6 +796,9 @@ mp_bases.c:
perfsqr.h:
cd ..; $(MAKE) $(AM_MAKEFLAGS) mpn/perfsqr.h
+tune-gcd-p: gcd.c
+ $(COMPILE) -g -O1 -I $(top_srcdir)/tune -DTUNE_GCD_P=1 gcd.c -o tune-gcd-p -L ../.libs -L../tune/.libs -lspeed -lgmp -lm
+
# .s assembler, no preprocessing.
#
.s.o:
@@ -680,7 +854,6 @@ perfsqr.h:
$(RM_TMP) tmp-$*.s
.asm.lo:
$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/mpn/README b/gmp/mpn/README
index bc046be732..32fc007e40 100644
--- a/gmp/mpn/README
+++ b/gmp/mpn/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/a29k/add_n.s b/gmp/mpn/a29k/add_n.s
new file mode 100644
index 0000000000..2d926047fd
--- /dev/null
+++ b/gmp/mpn/a29k/add_n.s
@@ -0,0 +1,118 @@
+; 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/gmp/mpn/a29k/addmul_1.s b/gmp/mpn/a29k/addmul_1.s
new file mode 100644
index 0000000000..fcf7fc2f39
--- /dev/null
+++ b/gmp/mpn/a29k/addmul_1.s
@@ -0,0 +1,111 @@
+; 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/gmp/mpn/a29k/lshift.s b/gmp/mpn/a29k/lshift.s
new file mode 100644
index 0000000000..3df6dabfe4
--- /dev/null
+++ b/gmp/mpn/a29k/lshift.s
@@ -0,0 +1,91 @@
+; 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/gmp/mpn/a29k/mul_1.s b/gmp/mpn/a29k/mul_1.s
new file mode 100644
index 0000000000..a55fe3e367
--- /dev/null
+++ b/gmp/mpn/a29k/mul_1.s
@@ -0,0 +1,95 @@
+; 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/gmp/mpn/a29k/rshift.s b/gmp/mpn/a29k/rshift.s
new file mode 100644
index 0000000000..8a3086755a
--- /dev/null
+++ b/gmp/mpn/a29k/rshift.s
@@ -0,0 +1,87 @@
+; 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/gmp/mpn/a29k/sub_n.s b/gmp/mpn/a29k/sub_n.s
new file mode 100644
index 0000000000..42072a494d
--- /dev/null
+++ b/gmp/mpn/a29k/sub_n.s
@@ -0,0 +1,118 @@
+; 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/gmp/mpn/a29k/submul_1.s b/gmp/mpn/a29k/submul_1.s
new file mode 100644
index 0000000000..7955b89537
--- /dev/null
+++ b/gmp/mpn/a29k/submul_1.s
@@ -0,0 +1,114 @@
+; 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 previus 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 previus sub
+ store 0,0,gr119,lr2
+ jmpfdec lr4,Loop2
+ addc gr120,gr118,0
+
+Lend: jmpi lr0
+ or gr96,gr120,0 ; copy
diff --git a/gmp/mpn/a29k/udiv.s b/gmp/mpn/a29k/udiv.s
new file mode 100644
index 0000000000..82c3925a42
--- /dev/null
+++ b/gmp/mpn/a29k/udiv.s
@@ -0,0 +1,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.
+
+; The GNU MP Library is distributed in the hope that it will be useful, but
+; WITHOUT ANY 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/gmp/mpn/a29k/umul.s b/gmp/mpn/a29k/umul.s
new file mode 100644
index 0000000000..02c34e9151
--- /dev/null
+++ b/gmp/mpn/a29k/umul.s
@@ -0,0 +1,27 @@
+; 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
diff --git a/gmp/mpn/alpha/README b/gmp/mpn/alpha/README
index 09c2f04047..3578c53b85 100644
--- a/gmp/mpn/alpha/README
+++ b/gmp/mpn/alpha/README
@@ -1,30 +1,20 @@
-Copyright 1996, 1997, 1999-2005 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have received a copy of the GNU Lesser General Public License along
+with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -46,7 +36,7 @@ Cray T3 code is very very different...
them to "$6" or "$f6" where necessary.
"0x" introduces a hex constant in gas and DEC as, but on Unicos "^X" is
-required. The X() macro accommodates this difference.
+required. The X() macro accomodates this difference.
"cvttqc" is required by DEC as, "cvttq/c" is required by Unicos, and gas will
accept either. We use cvttqc and have an m4 define expand to cvttq/c where
@@ -70,7 +60,7 @@ RELEVANT OPTIMIZATION ISSUES
EV4
1. This chip has very limited store bandwidth. The on-chip L1 cache is write-
- through, and a cache line is transferred from the store buffer to the off-
+ through, and a cache line is transfered from the store buffer to the off-
chip L2 in as much 15 cycles on most systems. This delay hurts mpn_add_n,
mpn_sub_n, mpn_lshift, and mpn_rshift.
diff --git a/gmp/mpn/alpha/add_n.asm b/gmp/mpn/alpha/add_n.asm
index bc572a57a9..77d4cad2ef 100644
--- a/gmp/mpn/alpha/add_n.asm
+++ b/gmp/mpn/alpha/add_n.asm
@@ -1,164 +1,117 @@
dnl Alpha mpn_add_n -- Add two limb vectors of the same length > 0 and
dnl store sum in a third limb vector.
-dnl Copyright 1995, 1999, 2000, 2005, 2011 Free Software Foundation, Inc.
+dnl Copyright 1995, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 4.75
-C EV6: 3
+C EV4: 7.75
+C EV5: 5.75
+C EV6: 4
-dnl INPUT PARAMETERS
-dnl res_ptr r16
-dnl s1_ptr r17
-dnl s2_ptr r18
-dnl size r19
+C INPUT PARAMETERS
+C rp r16
+C up r17
+C vp r18
+C n r19
ASM_START()
-PROLOGUE(mpn_add_nc)
- bis r20,r31,r25
- br L(com)
-EPILOGUE()
PROLOGUE(mpn_add_n)
- bis r31,r31,r25 C clear cy
-L(com): subq r19,4,r19 C decr loop cnt
- blt r19,$Lend2 C if less than 4 limbs, goto 2nd loop
-C Start software pipeline for 1st loop
- ldq r0,0(r18)
- ldq r4,0(r17)
- ldq r1,8(r18)
- ldq r5,8(r17)
- addq r17,32,r17 C update s1_ptr
- addq r0,r4,r28 C 1st main add
- ldq r2,16(r18)
- addq r25,r28,r20 C 1st carry add
- ldq r3,24(r18)
- cmpult r28,r4,r8 C compute cy from last add
- ldq r6,-16(r17)
- cmpult r20,r28,r25 C compute cy from last add
- ldq r7,-8(r17)
- bis r8,r25,r25 C combine cy from the two adds
- subq r19,4,r19 C decr loop cnt
- addq r1,r5,r28 C 2nd main add
- addq r18,32,r18 C update s2_ptr
- addq r28,r25,r21 C 2nd carry add
- cmpult r28,r5,r8 C compute cy from last add
- blt r19,$Lend1 C if less than 4 limbs remain, jump
-C 1st loop handles groups of 4 limbs in a software pipeline
- ALIGN(16)
-$Loop: cmpult r21,r28,r25 C compute cy from last add
- ldq r0,0(r18)
- bis r8,r25,r25 C combine cy from the two adds
- ldq r1,8(r18)
- addq r2,r6,r28 C 3rd main add
- ldq r4,0(r17)
- addq r28,r25,r22 C 3rd carry add
- ldq r5,8(r17)
- cmpult r28,r6,r8 C compute cy from last add
- cmpult r22,r28,r25 C compute cy from last add
- stq r20,0(r16)
- bis r8,r25,r25 C combine cy from the two adds
- stq r21,8(r16)
- addq r3,r7,r28 C 4th main add
- addq r28,r25,r23 C 4th carry add
- cmpult r28,r7,r8 C compute cy from last add
- cmpult r23,r28,r25 C compute cy from last add
- addq r17,32,r17 C update s1_ptr
- bis r8,r25,r25 C combine cy from the two adds
- addq r16,32,r16 C update res_ptr
- addq r0,r4,r28 C 1st main add
- ldq r2,16(r18)
- addq r25,r28,r20 C 1st carry add
- ldq r3,24(r18)
- cmpult r28,r4,r8 C compute cy from last add
- ldq r6,-16(r17)
- cmpult r20,r28,r25 C compute cy from last add
- ldq r7,-8(r17)
- bis r8,r25,r25 C combine cy from the two adds
- subq r19,4,r19 C decr loop cnt
- stq r22,-16(r16)
- addq r1,r5,r28 C 2nd main add
- stq r23,-8(r16)
- addq r25,r28,r21 C 2nd carry add
- addq r18,32,r18 C update s2_ptr
- cmpult r28,r5,r8 C compute cy from last add
- bge r19,$Loop
-C Finish software pipeline for 1st loop
-$Lend1: cmpult r21,r28,r25 C compute cy from last add
- bis r8,r25,r25 C combine cy from the two adds
- addq r2,r6,r28 C 3rd main add
- addq r28,r25,r22 C 3rd carry add
- cmpult r28,r6,r8 C compute cy from last add
- cmpult r22,r28,r25 C compute cy from last add
- stq r20,0(r16)
- bis r8,r25,r25 C combine cy from the two adds
- stq r21,8(r16)
- addq r3,r7,r28 C 4th main add
- addq r28,r25,r23 C 4th carry add
- cmpult r28,r7,r8 C compute cy from last add
- cmpult r23,r28,r25 C compute cy from last add
- bis r8,r25,r25 C combine cy from the two adds
- addq r16,32,r16 C update res_ptr
- stq r22,-16(r16)
- stq r23,-8(r16)
-$Lend2: addq r19,4,r19 C restore loop cnt
- beq r19,$Lret
-C Start software pipeline for 2nd loop
- ldq r0,0(r18)
- ldq r4,0(r17)
+ ldq r3,0(r17)
+ ldq r4,0(r18)
+
subq r19,1,r19
- beq r19,$Lend0
-C 2nd loop handles remaining 1-3 limbs
- ALIGN(16)
-$Loop0: addq r0,r4,r28 C main add
- ldq r0,8(r18)
- cmpult r28,r4,r8 C compute cy from last add
- ldq r4,8(r17)
- addq r28,r25,r20 C carry add
- addq r18,8,r18
+ and r19,4-1,r2 C number of limbs in first loop
+ bis r31,r31,r0
+ beq r2,$L0 C if multiple of 4 limbs, skip first loop
+
+ subq r19,r2,r19
+
+$Loop0: subq r2,1,r2
+ ldq r5,8(r17)
+ addq r4,r0,r4
+ ldq r6,8(r18)
+ cmpult r4,r0,r1
+ addq r3,r4,r4
+ cmpult r4,r3,r0
+ stq r4,0(r16)
+ bis r0,r1,r0
+
addq r17,8,r17
- stq r20,0(r16)
- cmpult r20,r28,r25 C compute cy from last add
- subq r19,1,r19 C decr loop cnt
- bis r8,r25,r25 C combine cy from the two adds
+ addq r18,8,r18
+ bis r5,r5,r3
+ bis r6,r6,r4
addq r16,8,r16
- bne r19,$Loop0
-$Lend0: addq r0,r4,r28 C main add
- addq r28,r25,r20 C carry add
- cmpult r28,r4,r8 C compute cy from last add
- cmpult r20,r28,r25 C compute cy from last add
- stq r20,0(r16)
- bis r8,r25,r25 C combine cy from the two adds
-
-$Lret: bis r25,r31,r0 C return cy
+ bne r2,$Loop0
+
+$L0: beq r19,$Lend
+
+ ALIGN(8)
+$Loop: subq r19,4,r19
+
+ ldq r5,8(r17)
+ addq r4,r0,r4
+ ldq r6,8(r18)
+ cmpult r4,r0,r1
+ addq r3,r4,r4
+ cmpult r4,r3,r0
+ stq r4,0(r16)
+ bis r0,r1,r0
+
+ ldq r3,16(r17)
+ addq r6,r0,r6
+ ldq r4,16(r18)
+ cmpult r6,r0,r1
+ addq r5,r6,r6
+ cmpult r6,r5,r0
+ stq r6,8(r16)
+ bis r0,r1,r0
+
+ ldq r5,24(r17)
+ addq r4,r0,r4
+ ldq r6,24(r18)
+ cmpult r4,r0,r1
+ addq r3,r4,r4
+ cmpult r4,r3,r0
+ stq r4,16(r16)
+ bis r0,r1,r0
+
+ ldq r3,32(r17)
+ addq r6,r0,r6
+ ldq r4,32(r18)
+ cmpult r6,r0,r1
+ addq r5,r6,r6
+ cmpult r6,r5,r0
+ stq r6,24(r16)
+ bis r0,r1,r0
+
+ addq r17,32,r17
+ addq r18,32,r18
+ addq r16,32,r16
+ bne r19,$Loop
+
+$Lend: addq r4,r0,r4
+ cmpult r4,r0,r1
+ addq r3,r4,r4
+ cmpult r4,r3,r0
+ stq r4,0(r16)
+ bis r0,r1,r0
ret r31,(r26),1
-EPILOGUE()
+EPILOGUE(mpn_add_n)
ASM_END()
diff --git a/gmp/mpn/alpha/addmul_1.asm b/gmp/mpn/alpha/addmul_1.asm
index c4e6834b61..22c41a5c74 100644
--- a/gmp/mpn/alpha/addmul_1.asm
+++ b/gmp/mpn/alpha/addmul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/alpha-defs.m4 b/gmp/mpn/alpha/alpha-defs.m4
index af34c9294c..b2f9a242a8 100644
--- a/gmp/mpn/alpha/alpha-defs.m4
+++ b/gmp/mpn/alpha/alpha-defs.m4
@@ -3,32 +3,21 @@ divert(-1)
dnl m4 macros for Alpha assembler.
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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Usage: ASSERT([reg] [,code])
diff --git a/gmp/mpn/alpha/aorslsh1_n.asm b/gmp/mpn/alpha/aorslsh1_n.asm
index 9525e669db..3694f78761 100644
--- a/gmp/mpn/alpha/aorslsh1_n.asm
+++ b/gmp/mpn/alpha/aorslsh1_n.asm
@@ -1,40 +1,36 @@
dnl Alpha mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
-dnl Copyright 2003, 2013 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 EV4: 12.5
C EV5: 6.25
-C EV6: 4.5
+C EV6: 4.375 (i.e., worse than separate mpn_lshift and mpn_add_n at 3.875)
+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')
@@ -42,8 +38,12 @@ 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,98 +67,168 @@ 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)
+ 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)
ldq u1, 0(up)
- nop
- bne cy0, L(b10)
-
-L(b00): lda vp, 48(vp)
- lda up, -16(up)
+ ldq v2, 8(vp)
+ ldq u2, 8(up)
lda rp, -8(rp)
- br r31, L(lo0)
-
-L(b10): lda vp, 32(vp)
+ 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)
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)
- 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)
-
+ br r31, $LL00x
ALIGN(16)
-L(top): addq v0, v0, sl C left shift vlimb
- ldq v1, -16(vp)
+C 0
+$Loop: sll v0, 1, sl C left shift vlimb
+ ldq v3, 0(vp)
+C 1
ADDSUB u0, sl, ps C ulimb + (vlimb << 1)
- cmplt v0, r31, cy0 C carry out #1
- ldq u1, 16(up)
+ ldq u3, 0(up)
+C 2
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
-L(lo0): addq v1, v1, sl
- ldq v0, -40(vp)
+C 6
+$LL10: sll v1, 1, sl
+ ldq v0, -24(vp)
+C 7
ADDSUB u1, sl, ps
- cmplt v1, r31, cy1
- ldq u0, 24(up)
+ ldq u0, 8(up)
+C 8
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
-L(lo3): addq v0, v0, sl
- ldq v1, -32(vp)
- ADDSUB u0, sl, ps
- cmplt v0, r31, cy0
- ldq u1, 32(up)
+C 12
+$LL01: sll v2, 1, sl
+ ldq v1, -16(vp)
+C 13
+ ADDSUB u2, sl, ps
+ ldq u1, 16(up)
+C 14
ADDSUB ps, cy1, rr
- CARRY( ps, u0, cy)
+ srl v2, 63, cy0
+C 15
+ CARRY( ps, u2, cy)
stq rr, -16(rp)
+C 16
addq cy, cy0, cy0
CARRY( rr, ps, cy)
+C 17
addq cy, cy0, cy0
- 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)
+$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
ADDSUB ps, cy0, rr
- CARRY( ps, u1, cy)
+ srl v3, 63, cy1
+C 21
+ CARRY( ps, u3, 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
- bgt n, L(top)
+C 24
+ bge n, $Loop
-L(end): addq v0, v0, sl
+$Lcj3: sll v0, 1, sl
ADDSUB u0, sl, ps
ADDSUB ps, cy1, rr
- cmplt v0, r31, cy0
+ srl v0, 63, cy0
CARRY( ps, u0, cy)
stq rr, 0(rp)
addq cy, cy0, cy0
CARRY( rr, ps, cy)
- addq cy, cy0, r0
+ 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
+
ret r31,(r26),1
EPILOGUE()
ASM_END()
diff --git a/gmp/mpn/alpha/aorslsh2_n.asm b/gmp/mpn/alpha/aorslsh2_n.asm
deleted file mode 100644
index bdee1d6d02..0000000000
--- a/gmp/mpn/alpha/aorslsh2_n.asm
+++ /dev/null
@@ -1,167 +0,0 @@
-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()
diff --git a/gmp/mpn/alpha/bdiv_dbm1c.asm b/gmp/mpn/alpha/bdiv_dbm1c.asm
index 472966ca98..e5f11dbf48 100644
--- a/gmp/mpn/alpha/bdiv_dbm1c.asm
+++ b/gmp/mpn/alpha/bdiv_dbm1c.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/cntlz.asm b/gmp/mpn/alpha/cntlz.asm
index 25af19b131..2bfd923e5e 100644
--- a/gmp/mpn/alpha/cntlz.asm
+++ b/gmp/mpn/alpha/cntlz.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/copyd.asm b/gmp/mpn/alpha/copyd.asm
index b41b5366cc..ba8fa1c633 100644
--- a/gmp/mpn/alpha/copyd.asm
+++ b/gmp/mpn/alpha/copyd.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/copyi.asm b/gmp/mpn/alpha/copyi.asm
index f7e2ad6f6a..425804127e 100644
--- a/gmp/mpn/alpha/copyi.asm
+++ b/gmp/mpn/alpha/copyi.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/default.m4 b/gmp/mpn/alpha/default.m4
index 8fe7c4e122..e7aae2eeea 100644
--- a/gmp/mpn/alpha/default.m4
+++ b/gmp/mpn/alpha/default.m4
@@ -3,33 +3,22 @@ divert(-1)
dnl m4 macros for alpha assembler (everywhere except unicos).
-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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Usage: ASM_START()
@@ -64,9 +53,8 @@ ifelse(`$2',noalign,,` ALIGN(16)')
.globl $1
.ent $1
$1:
- .frame r30,0,r26,0
-ifelse(`$2',gp,` ldgp r29, 0(r27)
-`$'$1..ng:')
+ifelse(`$2',gp,` ldgp r29,0(r27)')
+ .frame r30,0,r26
.prologue ifelse(`$2',gp,1,0)')
define(`EPILOGUE_cpu',
@@ -102,13 +90,12 @@ forloop(i,0,31,`defreg(`r'i,$i)')
forloop(i,0,31,`deflit(`f'i,``$f''i)')
-dnl Usage: DATASTART(name,align) or DATASTART(name)
+dnl Usage: DATASTART(name)
dnl DATAEND()
define(`DATASTART',
-m4_assert_numargs_range(1,2)
-` RODATA
- ALIGN(ifelse($#,1,2,$2))
+m4_assert_numargs(1)
+` DATA
$1:')
define(`DATAEND',
m4_assert_numargs(0)
@@ -117,7 +104,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',
diff --git a/gmp/mpn/alpha/dive_1.c b/gmp/mpn/alpha/dive_1.c
index 88b82db2f7..a915c58a9e 100644
--- a/gmp/mpn/alpha/dive_1.c
+++ b/gmp/mpn/alpha/dive_1.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2003 Free Software Foundation, Inc.
+Copyright 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/alpha/ev5/diveby3.asm b/gmp/mpn/alpha/diveby3.asm
index 3758188e02..e2d1c6beee 100644
--- a/gmp/mpn/alpha/ev5/diveby3.asm
+++ b/gmp/mpn/alpha/diveby3.asm
@@ -1,42 +1,32 @@
dnl Alpha mpn_divexact_by3c -- mpn division by 3, expecting no remainder.
-dnl Copyright 2004, 2005, 2009 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 22
C EV5: 11.5
-C EV6: 6.3 Note that mpn_bdiv_dbm1c is faster
+C EV6: 6.3
C TODO
-C * Remove the unops, they benefit just ev6, which no longer uses this file.
+C * Trim this to 6.0 c/l for ev6.
+C * Write special ev5 version, should reach 9 c/l, and could be smaller.
C * Try prefetch for destination, using lds.
C * Improve feed-in code, by moving initial mulq earlier; make initial load
C to u0/u0 to save some copying.
@@ -50,7 +40,7 @@ define(`cy', `r19')
ASM_START()
-DATASTART(L(LC),8)
+DATASTART(L(LC))
.quad 0xAAAAAAAAAAAAAAAB
.quad 0x5555555555555555
.quad 0xAAAAAAAAAAAAAAAA
diff --git a/gmp/mpn/alpha/divrem_2.asm b/gmp/mpn/alpha/divrem_2.asm
index 046b246a95..b68468bca0 100644
--- a/gmp/mpn/alpha/divrem_2.asm
+++ b/gmp/mpn/alpha/divrem_2.asm
@@ -1,32 +1,21 @@
dnl Alpha mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
-dnl Copyright 2007, 2008, 2013 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -52,7 +41,8 @@ define(`un_param', `r19')
define(`dp', `r20')
ASM_START()
-PROLOGUE(mpn_divrem_2,gp)
+PROLOGUE(mpn_divrem_2)
+ ldgp r29, 0(r27)
lda r30, -80(r30)
stq r26, 0(r30)
stq r9, 8(r30)
@@ -90,7 +80,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
diff --git a/gmp/mpn/alpha/ev5/add_n.asm b/gmp/mpn/alpha/ev5/add_n.asm
new file mode 100644
index 0000000000..626e713ccb
--- /dev/null
+++ b/gmp/mpn/alpha/ev5/add_n.asm
@@ -0,0 +1,146 @@
+dnl Alpha EV5 mpn_add_n -- Add two limb vectors of the same length > 0 and
+dnl store sum in a third limb vector.
+
+dnl Copyright 1995, 1999, 2000, 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 EV4: ?
+C EV5: 4.75
+C EV6: 3
+
+dnl INPUT PARAMETERS
+dnl res_ptr r16
+dnl s1_ptr r17
+dnl s2_ptr r18
+dnl size r19
+
+ASM_START()
+PROLOGUE(mpn_add_n)
+ bis r31,r31,r25 C clear cy
+ subq r19,4,r19 C decr loop cnt
+ blt r19,$Lend2 C if less than 4 limbs, goto 2nd loop
+C Start software pipeline for 1st loop
+ ldq r0,0(r18)
+ ldq r4,0(r17)
+ ldq r1,8(r18)
+ ldq r5,8(r17)
+ addq r17,32,r17 C update s1_ptr
+ ldq r2,16(r18)
+ addq r0,r4,r20 C 1st main add
+ ldq r3,24(r18)
+ subq r19,4,r19 C decr loop cnt
+ ldq r6,-16(r17)
+ cmpult r20,r0,r25 C compute cy from last add
+ ldq r7,-8(r17)
+ addq r1,r5,r28 C 2nd main add
+ addq r18,32,r18 C update s2_ptr
+ addq r28,r25,r21 C 2nd carry add
+ cmpult r28,r5,r8 C compute cy from last add
+ blt r19,$Lend1 C if less than 4 limbs remain, jump
+C 1st loop handles groups of 4 limbs in a software pipeline
+ ALIGN(16)
+$Loop: cmpult r21,r28,r25 C compute cy from last add
+ ldq r0,0(r18)
+ bis r8,r25,r25 C combine cy from the two adds
+ ldq r1,8(r18)
+ addq r2,r6,r28 C 3rd main add
+ ldq r4,0(r17)
+ addq r28,r25,r22 C 3rd carry add
+ ldq r5,8(r17)
+ cmpult r28,r6,r8 C compute cy from last add
+ cmpult r22,r28,r25 C compute cy from last add
+ stq r20,0(r16)
+ bis r8,r25,r25 C combine cy from the two adds
+ stq r21,8(r16)
+ addq r3,r7,r28 C 4th main add
+ addq r28,r25,r23 C 4th carry add
+ cmpult r28,r7,r8 C compute cy from last add
+ cmpult r23,r28,r25 C compute cy from last add
+ addq r17,32,r17 C update s1_ptr
+ bis r8,r25,r25 C combine cy from the two adds
+ addq r16,32,r16 C update res_ptr
+ addq r0,r4,r28 C 1st main add
+ ldq r2,16(r18)
+ addq r25,r28,r20 C 1st carry add
+ ldq r3,24(r18)
+ cmpult r28,r4,r8 C compute cy from last add
+ ldq r6,-16(r17)
+ cmpult r20,r28,r25 C compute cy from last add
+ ldq r7,-8(r17)
+ bis r8,r25,r25 C combine cy from the two adds
+ subq r19,4,r19 C decr loop cnt
+ stq r22,-16(r16)
+ addq r1,r5,r28 C 2nd main add
+ stq r23,-8(r16)
+ addq r25,r28,r21 C 2nd carry add
+ addq r18,32,r18 C update s2_ptr
+ cmpult r28,r5,r8 C compute cy from last add
+ bge r19,$Loop
+C Finish software pipeline for 1st loop
+$Lend1: cmpult r21,r28,r25 C compute cy from last add
+ bis r8,r25,r25 C combine cy from the two adds
+ addq r2,r6,r28 C 3rd main add
+ addq r28,r25,r22 C 3rd carry add
+ cmpult r28,r6,r8 C compute cy from last add
+ cmpult r22,r28,r25 C compute cy from last add
+ stq r20,0(r16)
+ bis r8,r25,r25 C combine cy from the two adds
+ stq r21,8(r16)
+ addq r3,r7,r28 C 4th main add
+ addq r28,r25,r23 C 4th carry add
+ cmpult r28,r7,r8 C compute cy from last add
+ cmpult r23,r28,r25 C compute cy from last add
+ bis r8,r25,r25 C combine cy from the two adds
+ addq r16,32,r16 C update res_ptr
+ stq r22,-16(r16)
+ stq r23,-8(r16)
+$Lend2: addq r19,4,r19 C restore loop cnt
+ beq r19,$Lret
+C Start software pipeline for 2nd loop
+ ldq r0,0(r18)
+ ldq r4,0(r17)
+ subq r19,1,r19
+ beq r19,$Lend0
+C 2nd loop handles remaining 1-3 limbs
+ ALIGN(16)
+$Loop0: addq r0,r4,r28 C main add
+ ldq r0,8(r18)
+ cmpult r28,r4,r8 C compute cy from last add
+ ldq r4,8(r17)
+ addq r28,r25,r20 C carry add
+ addq r18,8,r18
+ addq r17,8,r17
+ stq r20,0(r16)
+ cmpult r20,r28,r25 C compute cy from last add
+ subq r19,1,r19 C decr loop cnt
+ bis r8,r25,r25 C combine cy from the two adds
+ addq r16,8,r16
+ bne r19,$Loop0
+$Lend0: addq r0,r4,r28 C main add
+ addq r28,r25,r20 C carry add
+ cmpult r28,r4,r8 C compute cy from last add
+ cmpult r20,r28,r25 C compute cy from last add
+ stq r20,0(r16)
+ bis r8,r25,r25 C combine cy from the two adds
+
+$Lret: bis r25,r31,r0 C return cy
+ ret r31,(r26),1
+EPILOGUE(mpn_add_n)
+ASM_END()
diff --git a/gmp/mpn/alpha/com.asm b/gmp/mpn/alpha/ev5/com_n.asm
index f084ab5e96..979e711eb8 100644
--- a/gmp/mpn/alpha/com.asm
+++ b/gmp/mpn/alpha/ev5/com_n.asm
@@ -1,32 +1,21 @@
-dnl Alpha mpn_com -- mpn one's complement.
+dnl Alpha EV5 mpn_com_n -- mpn one's complement.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -37,7 +26,7 @@ C EV5: 2.0
C EV6: 1.5
-C mp_limb_t mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
+C mp_limb_t mpn_com_n (mp_ptr dst, mp_srcptr src, mp_size_t size);
C
C For ev5 the main loop is 7 cycles plus 1 taken branch bubble, for a total
C 2.0 c/l. In general, a pattern like this unrolled to N limbs per loop
@@ -71,7 +60,7 @@ FLOAT64(L(dat), 2.0)
ALIGN(16)
-PROLOGUE(mpn_com,gp)
+PROLOGUE(mpn_com_n,gp)
C r16 dst
C r17 src
diff --git a/gmp/mpn/alpha/ev5/gmp-mparam.h b/gmp/mpn/alpha/ev5/gmp-mparam.h
index b560c20afe..cbedd4f173 100644
--- a/gmp/mpn/alpha/ev5/gmp-mparam.h
+++ b/gmp/mpn/alpha/ev5/gmp-mparam.h
@@ -1,187 +1,81 @@
/* Alpha EV5 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004, 2005, 2008-2010, 2014 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU 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 BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
-#define GMP_LIMB_BITS 64
-#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 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_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 76
-
-#define MUL_TOOM22_THRESHOLD 14
-#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 77
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 56
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 70
-
-#define SQR_BASECASE_THRESHOLD 0 /* always */
-#define SQR_TOOM2_THRESHOLD 22
-#define SQR_TOOM3_THRESHOLD 73
-#define SQR_TOOM4_THRESHOLD 178
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 260
-
-#define MULMID_TOOM42_THRESHOLD 18
-
-#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 12
-
-#define MUL_FFT_MODF_THRESHOLD 284 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 284, 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}, { 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, 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 121
-#define MUL_FFT_THRESHOLD 4224
-
-#define SQR_FFT_MODF_THRESHOLD 240 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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 1558
-#define MU_DIVAPPR_Q_THRESHOLD 1558
-#define MUPI_DIV_QR_THRESHOLD 90
-#define MU_BDIV_QR_THRESHOLD 855
-#define MU_BDIV_Q_THRESHOLD 1078
-
-#define POWM_SEC_TABLE 1,16,90,452,1221
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 99
-#define HGCD_APPR_THRESHOLD 103
-#define HGCD_REDUCE_THRESHOLD 2899
-#define GCD_DC_THRESHOLD 283
-#define GCDEXT_DC_THRESHOLD 201
-#define JACOBI_BASE_METHOD 3
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 426
-#define SET_STR_PRECOMPUTE_THRESHOLD 1505
-
-#define FAC_DSC_THRESHOLD 1404
-#define FAC_ODD_THRESHOLD 0 /* always */
+
+/* Generated by tuneup.c, 2009-01-15, gcc 3.4 */
+
+#define MUL_KARATSUBA_THRESHOLD 14
+#define MUL_TOOM3_THRESHOLD 74
+#define MUL_TOOM44_THRESHOLD 118
+
+#define SQR_BASECASE_THRESHOLD 4
+#define SQR_KARATSUBA_THRESHOLD 28
+#define SQR_TOOM3_THRESHOLD 77
+#define SQR_TOOM4_THRESHOLD 136
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 44
+#define MULLOW_MUL_N_THRESHOLD 246
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* preinv always */
+#define DIV_DC_THRESHOLD 53
+#define POWM_THRESHOLD 85
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD_THRESHOLD 104
+#define GCD_DC_THRESHOLD 321
+#define GCDEXT_DC_THRESHOLD 298
+#define JACOBI_BASE_METHOD 3
+
+#define DIVREM_1_NORM_THRESHOLD 0 /* preinv always */
+#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 13
+#define MOD_1_2_THRESHOLD 14
+#define MOD_1_4_THRESHOLD 16
+#define USE_PREINV_DIVREM_1 1 /* preinv always */
+#define USE_PREINV_MOD_1 1 /* preinv always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 20
+#define GET_STR_PRECOMPUTE_THRESHOLD 32
+#define SET_STR_DC_THRESHOLD 532
+#define SET_STR_PRECOMPUTE_THRESHOLD 1501
+
+#define MUL_FFT_TABLE { 240, 480, 1344, 1792, 5120, 20480, 81920, 196608, 0 }
+#define MUL_FFT_MODF_THRESHOLD 240
+#define MUL_FFT_THRESHOLD 1920
+
+#define SQR_FFT_TABLE { 240, 480, 1216, 1792, 5120, 12288, 81920, 196608, 0 }
+#define SQR_FFT_MODF_THRESHOLD 208
+#define SQR_FFT_THRESHOLD 1408
+
+/* These tables need to be updated. */
+
+#define MUL_FFT_TABLE2 {{1, 4}, {177, 5}, {193, 4}, {209, 5}, {353, 6}, {385, 5}, {417, 6}, {833, 7}, {897, 6}, {961, 7}, {1025, 6}, {1089, 7}, {1665, 8}, {1793, 7}, {2177, 8}, {2305, 7}, {2433, 8}, {2817, 7}, {2945, 8}, {3329, 9}, {3457, 8}, {4865, 9}, {5633, 8}, {6401, 10}, {7169, 9}, {11777, 10}, {12801, 9}, {13825, 10}, {15361, 9}, {19969, 10}, {23553, 9}, {24065, 11}, {30721, 10}, {48129, 11}, {63489, 10}, {72705, 11}, {96257, 12}, {126977, 11}, {194561, 12}, {258049, 11}, {325633, 12}, {389121, 13}, {516097, 12}, {MP_SIZE_T_MAX,0}}
+
+#define SQR_FFT_TABLE2 {{1, 4}, {177, 5}, {193, 4}, {209, 5}, {353, 6}, {385, 5}, {417, 6}, {961, 7}, {1025, 6}, {1089, 7}, {1153, 6}, {1217, 7}, {1665, 8}, {1793, 7}, {2177, 8}, {2305, 7}, {2561, 8}, {2817, 7}, {2945, 8}, {3329, 9}, {3585, 8}, {5377, 9}, {5633, 8}, {6401, 9}, {6657, 10}, {6913, 9}, {11777, 10}, {13313, 9}, {13825, 10}, {15361, 9}, {18945, 10}, {19457, 9}, {19969, 10}, {23553, 9}, {24065, 11}, {30721, 10}, {48129, 11}, {53249, 10}, {56321, 11}, {63489, 10}, {72705, 11}, {73729, 10}, {79873, 11}, {96257, 12}, {126977, 11}, {194561, 12}, {258049, 11}, {325633, 12}, {389121, 13}, {516097, 12}, {1699841, 13}, {1708033, 12}, {1732609, 13}, {1748993, 12}, {1757185, 13}, {1773569, 12}, {1777665, 13}, {1781761, 12}, {1789953, 13}, {1806337, 12}, {1818625, 13}, {1822721, 12}, {1826817, 13}, {1830913, 12}, {1961985, 13}, {MP_SIZE_T_MAX,0}}
diff --git a/gmp/mpn/alpha/ev5/lshift.asm b/gmp/mpn/alpha/ev5/lshift.asm
new file mode 100644
index 0000000000..04385d3484
--- /dev/null
+++ b/gmp/mpn/alpha/ev5/lshift.asm
@@ -0,0 +1,171 @@
+dnl Alpha EV5 mpn_lshift -- Shift a number left.
+
+dnl Copyright 1994, 1995, 2000, 2003 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: 3.25
+C EV6: 1.75
+
+C INPUT PARAMETERS
+C rp r16
+C up r17
+C n r18
+C cnt r19
+
+
+ASM_START()
+PROLOGUE(mpn_lshift)
+ s8addq r18,r17,r17 C make r17 point at end of s1
+ ldq r4,-8(r17) C load first limb
+ subq r31,r19,r20
+ s8addq r18,r16,r16 C make r16 point at end of RES
+ subq r18,1,r18
+ and r18,4-1,r28 C number of limbs in first loop
+ srl r4,r20,r0 C compute function result
+
+ beq r28,$L0
+ subq r18,r28,r18
+
+ ALIGN(8)
+$Loop0: ldq r3,-16(r17)
+ subq r16,8,r16
+ sll r4,r19,r5
+ subq r17,8,r17
+ subq r28,1,r28
+ srl r3,r20,r6
+ bis r3,r3,r4
+ bis r5,r6,r8
+ stq r8,0(r16)
+ bne r28,$Loop0
+
+$L0: sll r4,r19,r24
+ beq r18,$Lend
+C warm up phase 1
+ ldq r1,-16(r17)
+ subq r18,4,r18
+ ldq r2,-24(r17)
+ ldq r3,-32(r17)
+ ldq r4,-40(r17)
+ beq r18,$Lend1
+C warm up phase 2
+ srl r1,r20,r7
+ sll r1,r19,r21
+ srl r2,r20,r8
+ ldq r1,-48(r17)
+ sll r2,r19,r22
+ ldq r2,-56(r17)
+ srl r3,r20,r5
+ bis r7,r24,r7
+ sll r3,r19,r23
+ bis r8,r21,r8
+ srl r4,r20,r6
+ ldq r3,-64(r17)
+ sll r4,r19,r24
+ ldq r4,-72(r17)
+ subq r18,4,r18
+ beq r18,$Lend2
+ ALIGN(16)
+C main loop
+$Loop: stq r7,-8(r16)
+ bis r5,r22,r5
+ stq r8,-16(r16)
+ bis r6,r23,r6
+
+ srl r1,r20,r7
+ subq r18,4,r18
+ sll r1,r19,r21
+ unop C ldq r31,-96(r17)
+
+ srl r2,r20,r8
+ ldq r1,-80(r17)
+ sll r2,r19,r22
+ ldq r2,-88(r17)
+
+ stq r5,-24(r16)
+ bis r7,r24,r7
+ stq r6,-32(r16)
+ bis r8,r21,r8
+
+ srl r3,r20,r5
+ unop C ldq r31,-96(r17)
+ sll r3,r19,r23
+ subq r16,32,r16
+
+ srl r4,r20,r6
+ ldq r3,-96(r17)
+ sll r4,r19,r24
+ ldq r4,-104(r17)
+
+ subq r17,32,r17
+ bne r18,$Loop
+C cool down phase 2/1
+$Lend2: stq r7,-8(r16)
+ bis r5,r22,r5
+ stq r8,-16(r16)
+ bis r6,r23,r6
+ srl r1,r20,r7
+ sll r1,r19,r21
+ srl r2,r20,r8
+ sll r2,r19,r22
+ stq r5,-24(r16)
+ bis r7,r24,r7
+ stq r6,-32(r16)
+ bis r8,r21,r8
+ srl r3,r20,r5
+ sll r3,r19,r23
+ srl r4,r20,r6
+ sll r4,r19,r24
+C cool down phase 2/2
+ stq r7,-40(r16)
+ bis r5,r22,r5
+ stq r8,-48(r16)
+ bis r6,r23,r6
+ stq r5,-56(r16)
+ stq r6,-64(r16)
+C cool down phase 2/3
+ stq r24,-72(r16)
+ ret r31,(r26),1
+
+C cool down phase 1/1
+$Lend1: srl r1,r20,r7
+ sll r1,r19,r21
+ srl r2,r20,r8
+ sll r2,r19,r22
+ srl r3,r20,r5
+ bis r7,r24,r7
+ sll r3,r19,r23
+ bis r8,r21,r8
+ srl r4,r20,r6
+ sll r4,r19,r24
+C cool down phase 1/2
+ stq r7,-8(r16)
+ bis r5,r22,r5
+ stq r8,-16(r16)
+ bis r6,r23,r6
+ stq r5,-24(r16)
+ stq r6,-32(r16)
+ stq r24,-40(r16)
+ ret r31,(r26),1
+
+$Lend: stq r24,-8(r16)
+ ret r31,(r26),1
+EPILOGUE(mpn_lshift)
+ASM_END()
diff --git a/gmp/mpn/alpha/ev5/rshift.asm b/gmp/mpn/alpha/ev5/rshift.asm
new file mode 100644
index 0000000000..0244da35a5
--- /dev/null
+++ b/gmp/mpn/alpha/ev5/rshift.asm
@@ -0,0 +1,169 @@
+dnl Alpha EV5 mpn_rshift -- Shift a number right.
+
+dnl Copyright 1994, 1995, 2000 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: 3.25
+C EV6: 1.75
+
+C INPUT PARAMETERS
+C rp r16
+C up r17
+C n r18
+C cnt r19
+
+
+ASM_START()
+PROLOGUE(mpn_rshift)
+ ldq r4,0(r17) C load first limb
+ subq r31,r19,r20
+ subq r18,1,r18
+ and r18,4-1,r28 C number of limbs in first loop
+ sll r4,r20,r0 C compute function result
+
+ beq r28,$L0
+ subq r18,r28,r18
+
+ ALIGN(8)
+$Loop0: ldq r3,8(r17)
+ addq r16,8,r16
+ srl r4,r19,r5
+ addq r17,8,r17
+ subq r28,1,r28
+ sll r3,r20,r6
+ bis r3,r3,r4
+ bis r5,r6,r8
+ stq r8,-8(r16)
+ bne r28,$Loop0
+
+$L0: srl r4,r19,r24
+ beq r18,$Lend
+C warm up phase 1
+ ldq r1,8(r17)
+ subq r18,4,r18
+ ldq r2,16(r17)
+ ldq r3,24(r17)
+ ldq r4,32(r17)
+ beq r18,$Lend1
+C warm up phase 2
+ sll r1,r20,r7
+ srl r1,r19,r21
+ sll r2,r20,r8
+ ldq r1,40(r17)
+ srl r2,r19,r22
+ ldq r2,48(r17)
+ sll r3,r20,r5
+ bis r7,r24,r7
+ srl r3,r19,r23
+ bis r8,r21,r8
+ sll r4,r20,r6
+ ldq r3,56(r17)
+ srl r4,r19,r24
+ ldq r4,64(r17)
+ subq r18,4,r18
+ beq r18,$Lend2
+ ALIGN(16)
+C main loop
+$Loop: stq r7,0(r16)
+ bis r5,r22,r5
+ stq r8,8(r16)
+ bis r6,r23,r6
+
+ sll r1,r20,r7
+ subq r18,4,r18
+ srl r1,r19,r21
+ unop C ldq r31,-96(r17)
+
+ sll r2,r20,r8
+ ldq r1,72(r17)
+ srl r2,r19,r22
+ ldq r2,80(r17)
+
+ stq r5,16(r16)
+ bis r7,r24,r7
+ stq r6,24(r16)
+ bis r8,r21,r8
+
+ sll r3,r20,r5
+ unop C ldq r31,-96(r17)
+ srl r3,r19,r23
+ addq r16,32,r16
+
+ sll r4,r20,r6
+ ldq r3,88(r17)
+ srl r4,r19,r24
+ ldq r4,96(r17)
+
+ addq r17,32,r17
+ bne r18,$Loop
+C cool down phase 2/1
+$Lend2: stq r7,0(r16)
+ bis r5,r22,r5
+ stq r8,8(r16)
+ bis r6,r23,r6
+ sll r1,r20,r7
+ srl r1,r19,r21
+ sll r2,r20,r8
+ srl r2,r19,r22
+ stq r5,16(r16)
+ bis r7,r24,r7
+ stq r6,24(r16)
+ bis r8,r21,r8
+ sll r3,r20,r5
+ srl r3,r19,r23
+ sll r4,r20,r6
+ srl r4,r19,r24
+C cool down phase 2/2
+ stq r7,32(r16)
+ bis r5,r22,r5
+ stq r8,40(r16)
+ bis r6,r23,r6
+ stq r5,48(r16)
+ stq r6,56(r16)
+C cool down phase 2/3
+ stq r24,64(r16)
+ ret r31,(r26),1
+
+C cool down phase 1/1
+$Lend1: sll r1,r20,r7
+ srl r1,r19,r21
+ sll r2,r20,r8
+ srl r2,r19,r22
+ sll r3,r20,r5
+ bis r7,r24,r7
+ srl r3,r19,r23
+ bis r8,r21,r8
+ sll r4,r20,r6
+ srl r4,r19,r24
+C cool down phase 1/2
+ stq r7,0(r16)
+ bis r5,r22,r5
+ stq r8,8(r16)
+ bis r6,r23,r6
+ stq r5,16(r16)
+ stq r6,24(r16)
+ stq r24,32(r16)
+ ret r31,(r26),1
+
+$Lend: stq r24,0(r16)
+ ret r31,(r26),1
+EPILOGUE(mpn_rshift)
+ASM_END()
diff --git a/gmp/mpn/alpha/ev5/sub_n.asm b/gmp/mpn/alpha/ev5/sub_n.asm
new file mode 100644
index 0000000000..2c25fad400
--- /dev/null
+++ b/gmp/mpn/alpha/ev5/sub_n.asm
@@ -0,0 +1,146 @@
+dnl Alpha EV5 mpn_sub_n -- Subtract two limb vectors of the same length > 0
+dnl and store difference in a third limb vector.
+
+dnl Copyright 1995, 1999, 2000, 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 EV4: ?
+C EV5: 4.75
+C EV6: 3
+
+dnl INPUT PARAMETERS
+dnl res_ptr r16
+dnl s1_ptr r17
+dnl s2_ptr r18
+dnl size r19
+
+ASM_START()
+PROLOGUE(mpn_sub_n)
+ bis r31,r31,r25 C clear cy
+ subq r19,4,r19 C decr loop cnt
+ blt r19,$Lend2 C if less than 4 limbs, goto 2nd loop
+C Start software pipeline for 1st loop
+ ldq r0,0(r18)
+ ldq r4,0(r17)
+ ldq r1,8(r18)
+ ldq r5,8(r17)
+ addq r17,32,r17 C update s1_ptr
+ ldq r2,16(r18)
+ subq r4,r0,r20 C 1st main subtract
+ ldq r3,24(r18)
+ subq r19,4,r19 C decr loop cnt
+ ldq r6,-16(r17)
+ cmpult r4,r0,r25 C compute cy from last subtract
+ ldq r7,-8(r17)
+ subq r5,r1,r28 C 2nd main subtract
+ addq r18,32,r18 C update s2_ptr
+ subq r28,r25,r21 C 2nd carry subtract
+ cmpult r5,r1,r8 C compute cy from last subtract
+ blt r19,$Lend1 C if less than 4 limbs remain, jump
+C 1st loop handles groups of 4 limbs in a software pipeline
+ ALIGN(16)
+$Loop: cmpult r28,r25,r25 C compute cy from last subtract
+ ldq r0,0(r18)
+ bis r8,r25,r25 C combine cy from the two subtracts
+ ldq r1,8(r18)
+ subq r6,r2,r28 C 3rd main subtract
+ ldq r4,0(r17)
+ subq r28,r25,r22 C 3rd carry subtract
+ ldq r5,8(r17)
+ cmpult r6,r2,r8 C compute cy from last subtract
+ cmpult r28,r25,r25 C compute cy from last subtract
+ stq r20,0(r16)
+ bis r8,r25,r25 C combine cy from the two subtracts
+ stq r21,8(r16)
+ subq r7,r3,r28 C 4th main subtract
+ subq r28,r25,r23 C 4th carry subtract
+ cmpult r7,r3,r8 C compute cy from last subtract
+ cmpult r28,r25,r25 C compute cy from last subtract
+ addq r17,32,r17 C update s1_ptr
+ bis r8,r25,r25 C combine cy from the two subtracts
+ addq r16,32,r16 C update res_ptr
+ subq r4,r0,r28 C 1st main subtract
+ ldq r2,16(r18)
+ subq r28,r25,r20 C 1st carry subtract
+ ldq r3,24(r18)
+ cmpult r4,r0,r8 C compute cy from last subtract
+ ldq r6,-16(r17)
+ cmpult r28,r25,r25 C compute cy from last subtract
+ ldq r7,-8(r17)
+ bis r8,r25,r25 C combine cy from the two subtracts
+ subq r19,4,r19 C decr loop cnt
+ stq r22,-16(r16)
+ subq r5,r1,r28 C 2nd main subtract
+ stq r23,-8(r16)
+ subq r28,r25,r21 C 2nd carry subtract
+ addq r18,32,r18 C update s2_ptr
+ cmpult r5,r1,r8 C compute cy from last subtract
+ bge r19,$Loop
+C Finish software pipeline for 1st loop
+$Lend1: cmpult r28,r25,r25 C compute cy from last subtract
+ bis r8,r25,r25 C combine cy from the two subtracts
+ subq r6,r2,r28 C cy add
+ subq r28,r25,r22 C 3rd main subtract
+ cmpult r6,r2,r8 C compute cy from last subtract
+ cmpult r28,r25,r25 C compute cy from last subtract
+ stq r20,0(r16)
+ bis r8,r25,r25 C combine cy from the two subtracts
+ stq r21,8(r16)
+ subq r7,r3,r28 C cy add
+ subq r28,r25,r23 C 4th main subtract
+ cmpult r7,r3,r8 C compute cy from last subtract
+ cmpult r28,r25,r25 C compute cy from last subtract
+ bis r8,r25,r25 C combine cy from the two subtracts
+ addq r16,32,r16 C update res_ptr
+ stq r22,-16(r16)
+ stq r23,-8(r16)
+$Lend2: addq r19,4,r19 C restore loop cnt
+ beq r19,$Lret
+C Start software pipeline for 2nd loop
+ ldq r0,0(r18)
+ ldq r4,0(r17)
+ subq r19,1,r19
+ beq r19,$Lend0
+C 2nd loop handles remaining 1-3 limbs
+ ALIGN(16)
+$Loop0: subq r4,r0,r28 C main subtract
+ cmpult r4,r0,r8 C compute cy from last subtract
+ ldq r0,8(r18)
+ ldq r4,8(r17)
+ subq r28,r25,r20 C carry subtract
+ addq r18,8,r18
+ addq r17,8,r17
+ stq r20,0(r16)
+ cmpult r28,r25,r25 C compute cy from last subtract
+ subq r19,1,r19 C decr loop cnt
+ bis r8,r25,r25 C combine cy from the two subtracts
+ addq r16,8,r16
+ bne r19,$Loop0
+$Lend0: subq r4,r0,r28 C main subtract
+ subq r28,r25,r20 C carry subtract
+ cmpult r4,r0,r8 C compute cy from last subtract
+ cmpult r28,r25,r25 C compute cy from last subtract
+ stq r20,0(r16)
+ bis r8,r25,r25 C combine cy from the two subtracts
+
+$Lret: bis r25,r31,r0 C return cy
+ ret r31,(r26),1
+EPILOGUE(mpn_sub_n)
+ASM_END()
diff --git a/gmp/mpn/alpha/ev6/add_n.asm b/gmp/mpn/alpha/ev6/add_n.asm
index 9261f31b8a..114af73aa0 100644
--- a/gmp/mpn/alpha/ev6/add_n.asm
+++ b/gmp/mpn/alpha/ev6/add_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/ev6/aorslsh1_n.asm b/gmp/mpn/alpha/ev6/aorslsh1_n.asm
deleted file mode 100644
index cb966ce021..0000000000
--- a/gmp/mpn/alpha/ev6/aorslsh1_n.asm
+++ /dev/null
@@ -1,172 +0,0 @@
-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()
diff --git a/gmp/mpn/alpha/ev6/aorsmul_1.asm b/gmp/mpn/alpha/ev6/aorsmul_1.asm
index 0e68e6e7ad..eda092b2d5 100644
--- a/gmp/mpn/alpha/ev6/aorsmul_1.asm
+++ b/gmp/mpn/alpha/ev6/aorsmul_1.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 mpn_addmul_1 and mpn_submul_1.
-dnl Copyright 2000, 2003-2005, 2008 Free Software Foundation, Inc.
+dnl Copyright 2000, 2003, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/ev6/gmp-mparam.h b/gmp/mpn/alpha/ev6/gmp-mparam.h
index e51d6b0d15..a01e977433 100644
--- a/gmp/mpn/alpha/ev6/gmp-mparam.h
+++ b/gmp/mpn/alpha/ev6/gmp-mparam.h
@@ -1,209 +1,76 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004, 2005, 2008-2010, 2014 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
#define DIVEXACT_BY3_METHOD 0 /* override ../diveby3.asm */
-/* 500 MHz 21164 (agnesi.math.su.se) */
-/* 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 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 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 20
-
-#define MUL_TOOM22_THRESHOLD 32
-#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 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 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 19
-#define SQRMOD_BNM1_THRESHOLD 5
-
-#define MUL_FFT_MODF_THRESHOLD 468 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, { 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}, { 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
-#define MUL_FFT_THRESHOLD 5760
-
-#define SQR_FFT_MODF_THRESHOLD 412 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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}, { 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,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,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}, { 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 100
-#define MULLO_MUL_N_THRESHOLD 11355
-
-#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 384
-#define INV_APPR_THRESHOLD 402
-
-#define BINV_NEWTON_THRESHOLD 381
-#define REDC_1_TO_REDC_N_THRESHOLD 110
-
-#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 1,13,66,82,579
-
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#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 14
-#define GET_STR_PRECOMPUTE_THRESHOLD 25
-#define SET_STR_DC_THRESHOLD 3754
-#define SET_STR_PRECOMPUTE_THRESHOLD 8097
-
-#define FAC_DSC_THRESHOLD 951
-#define FAC_ODD_THRESHOLD 24
+/* 500 MHz 21164 */
+
+/* Generated by tuneup.c, 2009-01-12, gcc 3.3 */
+
+#define MUL_KARATSUBA_THRESHOLD 31
+#define MUL_TOOM3_THRESHOLD 101
+#define MUL_TOOM44_THRESHOLD 168
+
+#define SQR_BASECASE_THRESHOLD 6
+#define SQR_KARATSUBA_THRESHOLD 60
+#define SQR_TOOM3_THRESHOLD 102
+#define SQR_TOOM4_THRESHOLD 172
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 102
+#define MULLOW_MUL_N_THRESHOLD 399
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* preinv always */
+#define DIV_DC_THRESHOLD 134
+#define POWM_THRESHOLD 257
+
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD_THRESHOLD 303
+#define GCD_DC_THRESHOLD 1258
+#define GCDEXT_DC_THRESHOLD 807
+#define JACOBI_BASE_METHOD 3
+
+#define DIVREM_1_NORM_THRESHOLD 0 /* preinv always */
+#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 13
+#define MOD_1_2_THRESHOLD 14
+#define MOD_1_4_THRESHOLD 40
+#define USE_PREINV_DIVREM_1 1 /* preinv always */
+#define USE_PREINV_MOD_1 1 /* preinv always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 16
+#define GET_STR_PRECOMPUTE_THRESHOLD 23
+#define SET_STR_DC_THRESHOLD 4615
+#define SET_STR_PRECOMPUTE_THRESHOLD 8178
+
+#define MUL_FFT_TABLE { 432, 864, 1856, 3840, 11264, 28672, 81920, 327680, 0 }
+#define MUL_FFT_MODF_THRESHOLD 448
+#define MUL_FFT_THRESHOLD 4992
+
+#define SQR_FFT_TABLE { 432, 864, 1728, 3840, 9216, 20480, 81920, 327680, 786432, 0 }
+#define SQR_FFT_MODF_THRESHOLD 344
+#define SQR_FFT_THRESHOLD 3712
diff --git a/gmp/mpn/alpha/ev6/mod_1_4.asm b/gmp/mpn/alpha/ev6/mod_1_4.asm
deleted file mode 100644
index 836de07c0f..0000000000
--- a/gmp/mpn/alpha/ev6/mod_1_4.asm
+++ /dev/null
@@ -1,337 +0,0 @@
-dnl Alpha mpn_mod_1s_4p
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C TODO:
-C * Optimise. 2.75 c/l should be possible.
-C * Write a proper mpn_mod_1s_4p_cps. The code below was compiler generated.
-C * Optimise feed-in code, starting the sw pipeline in switch code.
-C * Shorten software pipeline. The mul instructions are scheduled too far
-C from their users. Fixing this will allow us to use fewer registers.
-C * If we cannot reduce register usage, write perhaps small-n basecase.
-C * Does this work for PIC?
-
-C cycles/limb
-C EV4: ?
-C EV5: 23
-C EV6: 3
-
-define(`ap', `r16')
-define(`n', `r17')
-define(`pl', `r24')
-define(`ph', `r25')
-define(`rl', `r6')
-define(`rh', `r7')
-define(`B1modb', `r1')
-define(`B2modb', `r2')
-define(`B3modb', `r3')
-define(`B4modb', `r4')
-define(`B5modb', `r5')
-
-ASM_START()
-PROLOGUE(mpn_mod_1s_4p)
- lda r30, -64(r30)
- stq r9, 8(r30)
- ldq B1modb, 16(r19)
- stq r10, 16(r30)
- ldq B2modb, 24(r19)
- stq r11, 24(r30)
- ldq B3modb, 32(r19)
- stq r12, 32(r30)
- ldq B4modb, 40(r19)
- stq r13, 40(r30)
- ldq B5modb, 48(r19)
- s8addq n, ap, ap C point ap at vector end
-
- and n, 3, r0
- lda n, -4(n)
- beq r0, L(b0)
- lda r6, -2(r0)
- blt r6, L(b1)
- beq r6, L(b2)
-
-L(b3): ldq r21, -16(ap)
- ldq r22, -8(ap)
- ldq r20, -24(ap)
- mulq r21, B1modb, r8
- umulh r21, B1modb, r12
- mulq r22, B2modb, r9
- umulh r22, B2modb, r13
- addq r8, r20, pl
- cmpult pl, r8, r0
- addq r0, r12, ph
- addq r9, pl, rl
- cmpult rl, r9, r0
- addq r13, ph, ph
- addq r0, ph, rh
- lda ap, -56(ap)
- br L(com)
-
-L(b0): ldq r21, -24(ap)
- ldq r22, -16(ap)
- ldq r23, -8(ap)
- ldq r20, -32(ap)
- mulq r21, B1modb, r8
- umulh r21, B1modb, r12
- mulq r22, B2modb, r9
- umulh r22, B2modb, r13
- mulq r23, B3modb, r10
- umulh r23, B3modb, r27
- addq r8, r20, pl
- cmpult pl, r8, r0
- addq r0, r12, ph
- addq r9, pl, pl
- cmpult pl, r9, r0
- addq r13, ph, ph
- addq r0, ph, ph
- addq r10, pl, rl
- cmpult rl, r10, r0
- addq r27, ph, ph
- addq r0, ph, rh
- lda ap, -64(ap)
- br L(com)
-
-L(b1): bis r31, r31, rh
- ldq rl, -8(ap)
- lda ap, -40(ap)
- br L(com)
-
-L(b2): ldq rh, -8(ap)
- ldq rl, -16(ap)
- lda ap, -48(ap)
-
-L(com): ble n, L(ed3)
- ldq r21, 8(ap)
- ldq r22, 16(ap)
- ldq r23, 24(ap)
- ldq r20, 0(ap)
- lda n, -4(n)
- lda ap, -32(ap)
- mulq r21, B1modb, r8
- umulh r21, B1modb, r12
- mulq r22, B2modb, r9
- umulh r22, B2modb, r13
- mulq r23, B3modb, r10
- umulh r23, B3modb, r27
- mulq rl, B4modb, r11
- umulh rl, B4modb, r28
- ble n, L(ed2)
-
- ALIGN(16)
-L(top): ldq r21, 8(ap)
- mulq rh, B5modb, rl
- addq r8, r20, pl
- ldq r22, 16(ap)
- cmpult pl, r8, r0
- umulh rh, B5modb, rh
- ldq r23, 24(ap)
- addq r0, r12, ph
- addq r9, pl, pl
- mulq r21, B1modb, r8
- cmpult pl, r9, r0
- addq r13, ph, ph
- umulh r21, B1modb, r12
- lda ap, -32(ap)
- addq r0, ph, ph
- addq r10, pl, pl
- mulq r22, B2modb, r9
- cmpult pl, r10, r0
- addq r27, ph, ph
- addq r11, pl, pl
- umulh r22, B2modb, r13
- addq r0, ph, ph
- cmpult pl, r11, r0
- addq r28, ph, ph
- mulq r23, B3modb, r10
- ldq r20, 32(ap)
- addq pl, rl, rl
- umulh r23, B3modb, r27
- addq r0, ph, ph
- cmpult rl, pl, r0
- mulq rl, B4modb, r11
- addq ph, rh, rh
- umulh rl, B4modb, r28
- addq r0, rh, rh
- lda n, -4(n)
- bgt n, L(top)
-
-L(ed2): mulq rh, B5modb, rl
- addq r8, r20, pl
- umulh rh, B5modb, rh
- cmpult pl, r8, r0
- addq r0, r12, ph
- addq r9, pl, pl
- cmpult pl, r9, r0
- addq r13, ph, ph
- addq r0, ph, ph
- addq r10, pl, pl
- cmpult pl, r10, r0
- addq r27, ph, ph
- addq r11, pl, pl
- addq r0, ph, ph
- cmpult pl, r11, r0
- addq r28, ph, ph
- addq pl, rl, rl
- addq r0, ph, ph
- cmpult rl, pl, r0
- addq ph, rh, rh
- addq r0, rh, rh
-
-L(ed3): mulq rh, B1modb, r8
- umulh rh, B1modb, rh
- addq r8, rl, rl
- cmpult rl, r8, r0
- addq r0, rh, rh
-
- ldq r24, 8(r19) C cnt
- sll rh, r24, rh
- subq r31, r24, r25
- srl rl, r25, r2
- sll rl, r24, rl
- or r2, rh, rh
-
- ldq r23, 0(r19) C bi
- mulq rh, r23, r8
- umulh rh, r23, r9
- addq rh, 1, r7
- addq r8, rl, r8 C ql
- cmpult r8, rl, r0
- addq r9, r7, r9
- addq r0, r9, r9 C qh
- mulq r9, r18, r21 C qh * b
- subq rl, r21, rl
- cmpult r8, rl, r0 C rl > ql
- negq r0, r0
- and r0, r18, r0
- addq rl, r0, rl
- cmpule r18, rl, r0 C rl >= b
- negq r0, r0
- and r0, r18, r0
- subq rl, r0, rl
-
- srl rl, r24, r0
-
- ldq r9, 8(r30)
- ldq r10, 16(r30)
- ldq r11, 24(r30)
- ldq r12, 32(r30)
- ldq r13, 40(r30)
- lda r30, 64(r30)
- ret r31, (r26), 1
-EPILOGUE()
-
-PROLOGUE(mpn_mod_1s_4p_cps,gp)
- lda r30, -32(r30)
- stq r26, 0(r30)
- stq r9, 8(r30)
- stq r10, 16(r30)
- stq r11, 24(r30)
- mov r16, r11
- LEA( r4, __clz_tab)
- lda r10, 65(r31)
- cmpbge r31, r17, r1
- srl r1, 1, r1
- xor r1, 127, r1
- addq r1, r4, r1
- ldq_u r2, 0(r1)
- extbl r2, r1, r2
- s8subq r2, 7, r2
- srl r17, r2, r3
- subq r10, r2, r10
- addq r3, r4, r3
- ldq_u r1, 0(r3)
- extbl r1, r3, r1
- subq r10, r1, r10
- sll r17, r10, r9
- mov r9, r16
- jsr r26, mpn_invert_limb
- ldah r29, 0(r26)
- subq r31, r10, r2
- lda r1, 1(r31)
- sll r1, r10, r1
- subq r31, r9, r3
- srl r0, r2, r2
- ldq r26, 0(r30)
- bis r2, r1, r2
- lda r29, 0(r29)
- stq r0, 0(r11)
- stq r10, 8(r11)
- mulq r2, r3, r2
- srl r2, r10, r3
- umulh r2, r0, r1
- stq r3, 16(r11)
- mulq r2, r0, r3
- ornot r31, r1, r1
- subq r1, r2, r1
- mulq r1, r9, r1
- addq r1, r9, r2
- cmpule r1, r3, r3
- cmoveq r3, r2, r1
- srl r1, r10, r3
- umulh r1, r0, r2
- stq r3, 24(r11)
- mulq r1, r0, r3
- ornot r31, r2, r2
- subq r2, r1, r2
- mulq r2, r9, r2
- addq r2, r9, r1
- cmpule r2, r3, r3
- cmoveq r3, r1, r2
- srl r2, r10, r1
- umulh r2, r0, r3
- stq r1, 32(r11)
- mulq r2, r0, r1
- ornot r31, r3, r3
- subq r3, r2, r3
- mulq r3, r9, r3
- addq r3, r9, r2
- cmpule r3, r1, r1
- cmoveq r1, r2, r3
- srl r3, r10, r2
- umulh r3, r0, r1
- stq r2, 40(r11)
- mulq r3, r0, r0
- ornot r31, r1, r1
- subq r1, r3, r1
- mulq r1, r9, r1
- addq r1, r9, r9
- cmpule r1, r0, r0
- cmoveq r0, r9, r1
- ldq r9, 8(r30)
- srl r1, r10, r1
- ldq r10, 16(r30)
- stq r1, 48(r11)
- ldq r11, 24(r30)
- lda r30, 32(r30)
- ret r31, (r26), 1
-EPILOGUE()
diff --git a/gmp/mpn/alpha/ev6/mul_1.asm b/gmp/mpn/alpha/ev6/mul_1.asm
index 8ee19cd429..841f5083cb 100644
--- a/gmp/mpn/alpha/ev6/mul_1.asm
+++ b/gmp/mpn/alpha/ev6/mul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -60,7 +49,7 @@ C r20,r29,r13-r15 scramble
C
C We're doing 7 of the 8 carry propagations with a br fixup code and 1 with a
C put-the-carry-into-hi. The idea is that these branches are very rarely
-C taken, and since a non-taken branch consumes no resources, that is better
+C taken, and since a non-taken branch consumes no resurces, that is better
C than an addq.
C
C Software pipeline: a load in cycle #09, feeds a mul in cycle #16, feeds an
@@ -137,7 +126,7 @@ $L_9_or_more:
mulq r2,r19,r3 C r3 = prod_low
umulh r2,r19,r21 C r21 = prod_high
beq r20,$Le1b C jump if size was == 1
- bis r31, r31, r0 C FIXME: shouldn't need this
+ bis r31, r31, r0 C FIXME: shouldtn't need this
ldq r2,0(r17) C r2 = s1_limb
lda r17,8(r17) C s1_ptr++
lda r20,-1(r20) C size--
diff --git a/gmp/mpn/alpha/ev6/nails/README b/gmp/mpn/alpha/ev6/nails/README
index b214ac50ad..8b3b357a77 100644
--- a/gmp/mpn/alpha/ev6/nails/README
+++ b/gmp/mpn/alpha/ev6/nails/README
@@ -2,29 +2,18 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have received a copy of the GNU Lesser General Public License along
+with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/alpha/ev6/nails/addmul_1.asm b/gmp/mpn/alpha/ev6/nails/addmul_1.asm
index 711d4e66e5..149195c6f4 100644
--- a/gmp/mpn/alpha/ev6/nails/addmul_1.asm
+++ b/gmp/mpn/alpha/ev6/nails/addmul_1.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 nails mpn_addmul_1.
dnl Copyright 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -36,7 +25,7 @@ C EV5: 18
C EV6: 4
C TODO
-C * Reroll loop for 3.75 c/l with current 4-way unrolling.
+C * Reroll loop for 3.75 c/l with current 4-way unrulling.
C * The loop is overscheduled wrt loads and wrt multiplies, in particular
C umulh.
C * Use FP loop count and multiple exit points, that would simplify feed-in lp0
diff --git a/gmp/mpn/alpha/ev6/nails/addmul_2.asm b/gmp/mpn/alpha/ev6/nails/addmul_2.asm
index 6ff6b3ad6b..9edaed8b3a 100644
--- a/gmp/mpn/alpha/ev6/nails/addmul_2.asm
+++ b/gmp/mpn/alpha/ev6/nails/addmul_2.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 nails mpn_addmul_2.
dnl Copyright 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/alpha/ev6/nails/addmul_3.asm b/gmp/mpn/alpha/ev6/nails/addmul_3.asm
index a1ffb680ec..1d89769e13 100644
--- a/gmp/mpn/alpha/ev6/nails/addmul_3.asm
+++ b/gmp/mpn/alpha/ev6/nails/addmul_3.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 nails mpn_addmul_3.
dnl Copyright 2002, 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/alpha/ev6/nails/addmul_4.asm b/gmp/mpn/alpha/ev6/nails/addmul_4.asm
index 77e02a4316..f19b0232df 100644
--- a/gmp/mpn/alpha/ev6/nails/addmul_4.asm
+++ b/gmp/mpn/alpha/ev6/nails/addmul_4.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 nails mpn_addmul_4.
dnl Copyright 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/alpha/ev6/nails/aors_n.asm b/gmp/mpn/alpha/ev6/nails/aors_n.asm
index f6586773f5..4958e81ed9 100644
--- a/gmp/mpn/alpha/ev6/nails/aors_n.asm
+++ b/gmp/mpn/alpha/ev6/nails/aors_n.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 nails mpn_add_n and mpn_sub_n.
dnl Copyright 2002, 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Runs at 2.5 cycles/limb. It would be possible to reach 2.0 cycles/limb
diff --git a/gmp/mpn/alpha/ev6/nails/gmp-mparam.h b/gmp/mpn/alpha/ev6/nails/gmp-mparam.h
index 7949fe8df8..1bc93b52c6 100644
--- a/gmp/mpn/alpha/ev6/nails/gmp-mparam.h
+++ b/gmp/mpn/alpha/ev6/nails/gmp-mparam.h
@@ -1,43 +1,33 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2004 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
/* Generated by tuneup.c, 2004-02-07, gcc 3.3 */
-#define MUL_TOOM22_THRESHOLD 40
-#define MUL_TOOM33_THRESHOLD 236
+#define MUL_KARATSUBA_THRESHOLD 40
+#define MUL_TOOM3_THRESHOLD 236
#define SQR_BASECASE_THRESHOLD 7 /* karatsuba */
-#define SQR_TOOM2_THRESHOLD 0 /* never sqr_basecase */
+#define SQR_KARATSUBA_THRESHOLD 0 /* never sqr_basecase */
#define SQR_TOOM3_THRESHOLD 120
#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX /* no preinv with nails */
diff --git a/gmp/mpn/alpha/ev6/nails/mul_1.asm b/gmp/mpn/alpha/ev6/nails/mul_1.asm
index da2ee3d099..cac3776ba0 100644
--- a/gmp/mpn/alpha/ev6/nails/mul_1.asm
+++ b/gmp/mpn/alpha/ev6/nails/mul_1.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 nails mpn_mul_1.
dnl Copyright 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -36,10 +25,10 @@ C EV5: 18
C EV6: 3.25
C TODO
-C * Reroll loop for 3.0 c/l with current 4-way unrolling.
+C * Reroll loop for 3.0 c/l with current 4-way unrulling.
C * The loop is overscheduled wrt loads and wrt multiplies, in particular
C umulh.
-C * Use FP loop count and multiple exit points, that would simplify feed-in lp0
+C * Use FP loop count and multiple exit points, that would simpily feed-in lp0
C and would work since the loop structure is really regular.
C INPUT PARAMETERS
diff --git a/gmp/mpn/alpha/ev6/nails/submul_1.asm b/gmp/mpn/alpha/ev6/nails/submul_1.asm
index f473a59ba8..4242517a4a 100644
--- a/gmp/mpn/alpha/ev6/nails/submul_1.asm
+++ b/gmp/mpn/alpha/ev6/nails/submul_1.asm
@@ -1,32 +1,21 @@
dnl Alpha ev6 nails mpn_submul_1.
dnl Copyright 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -36,10 +25,10 @@ C EV5: 18
C EV6: 4
C TODO
-C * Reroll loop for 3.75 c/l with current 4-way unrolling.
+C * Reroll loop for 3.75 c/l with current 4-way unrulling.
C * The loop is overscheduled wrt loads and wrt multiplies, in particular
C umulh.
-C * Use FP loop count and multiple exit points, that would simplify feed-in lp0
+C * Use FP loop count and multiple exit points, that would simpily feed-in lp0
C and would work since the loop structure is really regular.
C INPUT PARAMETERS
diff --git a/gmp/mpn/alpha/ev6/slot.pl b/gmp/mpn/alpha/ev6/slot.pl
index a4c8a36882..17967e79a2 100755..100644
--- a/gmp/mpn/alpha/ev6/slot.pl
+++ b/gmp/mpn/alpha/ev6/slot.pl
@@ -1,32 +1,21 @@
#!/usr/bin/perl -w
-# Copyright 2000, 2001, 2003-2005, 2011 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2003, 2004, 2005 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: slot.pl [filename.o]...
@@ -51,12 +40,9 @@ my %optable =
(
'addq' => 'E',
'and' => 'E',
- 'andnot' => 'E',
'beq' => 'U',
'bge' => 'U',
'bgt' => 'U',
- 'bic' => 'E',
- 'bis' => 'E',
'blt' => 'U',
'bne' => 'U',
'br' => 'L',
@@ -85,7 +71,6 @@ my %optable =
'ldt' => 'L',
'ret' => 'L',
'mov' => 'E',
- 'mull' => 'U',
'mulq' => 'U',
'negq' => 'E',
'nop' => 'E',
diff --git a/gmp/mpn/alpha/ev6/sqr_diagonal.asm b/gmp/mpn/alpha/ev6/sqr_diagonal.asm
new file mode 100644
index 0000000000..58d086e624
--- /dev/null
+++ b/gmp/mpn/alpha/ev6/sqr_diagonal.asm
@@ -0,0 +1,115 @@
+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()
diff --git a/gmp/mpn/alpha/ev6/sub_n.asm b/gmp/mpn/alpha/ev6/sub_n.asm
index a35ba40d34..f23ad44a15 100644
--- a/gmp/mpn/alpha/ev6/sub_n.asm
+++ b/gmp/mpn/alpha/ev6/sub_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/ev67/gcd_1.asm b/gmp/mpn/alpha/ev67/gcd_1.asm
index 55fa7d3673..2e6f0a5e22 100644
--- a/gmp/mpn/alpha/ev67/gcd_1.asm
+++ b/gmp/mpn/alpha/ev67/gcd_1.asm
@@ -4,29 +4,18 @@ 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 modify
-dnl it under the terms of either:
+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 Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl 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
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/alpha/ev67/hamdist.asm b/gmp/mpn/alpha/ev67/hamdist.asm
index 4b13e9f14f..a72d95e90b 100644
--- a/gmp/mpn/alpha/ev67/hamdist.asm
+++ b/gmp/mpn/alpha/ev67/hamdist.asm
@@ -4,29 +4,18 @@ 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 either:
+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 Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl 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
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/alpha/ev67/popcount.asm b/gmp/mpn/alpha/ev67/popcount.asm
index 049c1cd239..6ed79cf158 100644
--- a/gmp/mpn/alpha/ev67/popcount.asm
+++ b/gmp/mpn/alpha/ev67/popcount.asm
@@ -4,29 +4,18 @@ 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 either:
+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 Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl 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
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/alpha/gmp-mparam.h b/gmp/mpn/alpha/gmp-mparam.h
index b850bd24b5..6b6d7bd9c8 100644
--- a/gmp/mpn/alpha/gmp-mparam.h
+++ b/gmp/mpn/alpha/gmp-mparam.h
@@ -1,54 +1,43 @@
/* Alpha EV4 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004, 2005, 2009 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
/* 175MHz 21064 */
/* Generated by tuneup.c, 2009-01-15, gcc 3.2 */
-#define MUL_TOOM22_THRESHOLD 12
-#define MUL_TOOM33_THRESHOLD 69
+#define MUL_KARATSUBA_THRESHOLD 12
+#define MUL_TOOM3_THRESHOLD 69
#define MUL_TOOM44_THRESHOLD 88
#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 20
+#define SQR_KARATSUBA_THRESHOLD 20
#define SQR_TOOM3_THRESHOLD 62
#define SQR_TOOM4_THRESHOLD 155
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 40
-#define MULLO_MUL_N_THRESHOLD 202
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 40
+#define MULLOW_MUL_N_THRESHOLD 202
#define DIV_SB_PREINV_THRESHOLD 0 /* preinv always */
#define DIV_DC_THRESHOLD 38
diff --git a/gmp/mpn/alpha/invert_limb.asm b/gmp/mpn/alpha/invert_limb.asm
index afc010f58c..99f51a30d5 100644
--- a/gmp/mpn/alpha/invert_limb.asm
+++ b/gmp/mpn/alpha/invert_limb.asm
@@ -1,95 +1,342 @@
dnl Alpha mpn_invert_limb -- Invert a normalized limb.
-dnl Copyright 1996, 2000-2003, 2007, 2011, 2013 Free Software Foundation, Inc.
-
+dnl Copyright 1996, 2000, 2001, 2002, 2003, 2007 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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: 137/140 (with BWX/without BWX)
-C EV6: 71/72 (with BWX/without BWX)
+C EV4: ~175
+C EV5: ~111-126
+C EV6: ~52-76
-C This was compiler generated, with minimal manual edits. Surely several
-C cycles could be cut with some thought.
+C This is based on ideas of Peter L. Montgomery.
ASM_START()
+
+FLOAT64($C36,9223372036854775808.0) C 2^63
+
PROLOGUE(mpn_invert_limb,gp)
- LEA( r2, approx_tab)
- srl r16, 54, r1
- srl r16, 24, r4
- and r16, 1, r5
- bic r1, 1, r7
- lda r4, 1(r4)
- srl r16, 1, r3
- addq r7, r2, r1
-ifelse(bwx_available_p,1,`
- ldwu r0, -512(r1)
-',`
- ldq_u r0, -512(r1)
- extwl r0, r7, r0
-')
- addq r3, r5, r3
- mull r0, r0, r1
- sll r0, 11, r0
- mulq r1, r4, r1
- srl r1, 40, r1
- subq r0, r1, r0
- lda r0, -1(r0)
- mulq r0, r0, r2
- sll r0, 60, r1
- sll r0, 13, r0
- mulq r2, r4, r2
- subq r1, r2, r1
- srl r1, 47, r1
- addq r0, r1, r0
- mulq r0, r3, r3
- srl r0, 1, r1
- cmoveq r5, 0, r1
- subq r1, r3, r1
- umulh r1, r0, r3
- sll r0, 31, r0
- srl r3, 1, r1
- addq r0, r1, r0
- mulq r0, r16, r2
- umulh r0, r16, r3
- addq r2, r16, r1
- addq r3, r16, r16
- cmpult r1, r2, r1
- addq r16, r1, r3
- subq r0, r3, r0
- ret r31, (r26), 1
-EPILOGUE()
-DATASTART(approx_tab,8)
-forloop(i,256,512-1,dnl
-` .word eval(0x7fd00/i)
-')dnl
- SIZE(approx_tab, 512)
- TYPE(approx_tab, object)
+ lda r30,-16(r30)
+ addq r16,r16,r1
+ bne r1,$73
+ lda r0,-1
+ br r31,$Lend
+$73:
+ srl r16,1,r1
+ stq r1,0(r30)
+ ldt f11,0(r30)
+ cvtqt f11,f1
+ LEA(r1,$C36)
+ ldt f10,0(r1) C f10 = 2^63
+ divt f10,f1,f10 C f10 = 2^63 / (u / 2)
+ LEA(r2,$invtab-4096)
+ srl r16,52,r1 C extract high 12 bits
+ addq r1,r1,r1 C align ...0000bbbbbbbb0
+ addq r1,r2,r1 C compute array offset
+ ldq_u r2,0(r1) C load quadword containing our 16 bits
+bigend(`addq r1,1,r1')
+ extwl r2,r1,r2 C extract desired 16 bits
+ sll r2,48,r0
+ umulh r16,r0,r1
+ addq r16,r1,r3
+ stq r3,0(r30)
+ ldt f11,0(r30)
+ cvtqt f11,f1
+ mult f1,f10,f1
+ cvttqc f1,f1
+ stt f1,0(r30)
+ ldq r4,0(r30)
+ subq r0,r4,r0
+ umulh r16,r0,r1
+ mulq r16,r0,r2
+ addq r16,r1,r3
+ bge r3,$Loop2
+$Loop1: addq r2,r16,r2
+ cmpult r2,r16,r1
+ addq r3,r1,r3
+ addq r0,1,r0
+ blt r3,$Loop1
+$Loop2: cmpult r2,r16,r1
+ subq r0,1,r0
+ subq r3,r1,r3
+ subq r2,r16,r2
+ bge r3,$Loop2
+$Lend:
+ lda r30,16(r30)
+ ret r31,(r26),1
+EPILOGUE(mpn_invert_limb)
+DATASTART($invtab)
+ .word 0xffff,0xffc0,0xff80,0xff40,0xff00,0xfec0,0xfe81,0xfe41
+ .word 0xfe01,0xfdc2,0xfd83,0xfd43,0xfd04,0xfcc5,0xfc86,0xfc46
+ .word 0xfc07,0xfbc8,0xfb8a,0xfb4b,0xfb0c,0xfacd,0xfa8e,0xfa50
+ .word 0xfa11,0xf9d3,0xf994,0xf956,0xf918,0xf8d9,0xf89b,0xf85d
+ .word 0xf81f,0xf7e1,0xf7a3,0xf765,0xf727,0xf6ea,0xf6ac,0xf66e
+ .word 0xf631,0xf5f3,0xf5b6,0xf578,0xf53b,0xf4fd,0xf4c0,0xf483
+ .word 0xf446,0xf409,0xf3cc,0xf38f,0xf352,0xf315,0xf2d8,0xf29c
+ .word 0xf25f,0xf222,0xf1e6,0xf1a9,0xf16d,0xf130,0xf0f4,0xf0b8
+ .word 0xf07c,0xf03f,0xf003,0xefc7,0xef8b,0xef4f,0xef14,0xeed8
+ .word 0xee9c,0xee60,0xee25,0xede9,0xedae,0xed72,0xed37,0xecfb
+ .word 0xecc0,0xec85,0xec4a,0xec0e,0xebd3,0xeb98,0xeb5d,0xeb22
+ .word 0xeae8,0xeaad,0xea72,0xea37,0xe9fd,0xe9c2,0xe988,0xe94d
+ .word 0xe913,0xe8d8,0xe89e,0xe864,0xe829,0xe7ef,0xe7b5,0xe77b
+ .word 0xe741,0xe707,0xe6cd,0xe694,0xe65a,0xe620,0xe5e6,0xe5ad
+ .word 0xe573,0xe53a,0xe500,0xe4c7,0xe48d,0xe454,0xe41b,0xe3e2
+ .word 0xe3a9,0xe370,0xe336,0xe2fd,0xe2c5,0xe28c,0xe253,0xe21a
+ .word 0xe1e1,0xe1a9,0xe170,0xe138,0xe0ff,0xe0c7,0xe08e,0xe056
+ .word 0xe01e,0xdfe5,0xdfad,0xdf75,0xdf3d,0xdf05,0xdecd,0xde95
+ .word 0xde5d,0xde25,0xdded,0xddb6,0xdd7e,0xdd46,0xdd0f,0xdcd7
+ .word 0xdca0,0xdc68,0xdc31,0xdbf9,0xdbc2,0xdb8b,0xdb54,0xdb1d
+ .word 0xdae6,0xdaae,0xda78,0xda41,0xda0a,0xd9d3,0xd99c,0xd965
+ .word 0xd92f,0xd8f8,0xd8c1,0xd88b,0xd854,0xd81e,0xd7e8,0xd7b1
+ .word 0xd77b,0xd745,0xd70e,0xd6d8,0xd6a2,0xd66c,0xd636,0xd600
+ .word 0xd5ca,0xd594,0xd55f,0xd529,0xd4f3,0xd4bd,0xd488,0xd452
+ .word 0xd41d,0xd3e7,0xd3b2,0xd37c,0xd347,0xd312,0xd2dd,0xd2a7
+ .word 0xd272,0xd23d,0xd208,0xd1d3,0xd19e,0xd169,0xd134,0xd100
+ .word 0xd0cb,0xd096,0xd061,0xd02d,0xcff8,0xcfc4,0xcf8f,0xcf5b
+ .word 0xcf26,0xcef2,0xcebe,0xce89,0xce55,0xce21,0xcded,0xcdb9
+ .word 0xcd85,0xcd51,0xcd1d,0xcce9,0xccb5,0xcc81,0xcc4e,0xcc1a
+ .word 0xcbe6,0xcbb3,0xcb7f,0xcb4c,0xcb18,0xcae5,0xcab1,0xca7e
+ .word 0xca4b,0xca17,0xc9e4,0xc9b1,0xc97e,0xc94b,0xc918,0xc8e5
+ .word 0xc8b2,0xc87f,0xc84c,0xc819,0xc7e7,0xc7b4,0xc781,0xc74f
+ .word 0xc71c,0xc6e9,0xc6b7,0xc684,0xc652,0xc620,0xc5ed,0xc5bb
+ .word 0xc589,0xc557,0xc524,0xc4f2,0xc4c0,0xc48e,0xc45c,0xc42a
+ .word 0xc3f8,0xc3c7,0xc395,0xc363,0xc331,0xc300,0xc2ce,0xc29c
+ .word 0xc26b,0xc239,0xc208,0xc1d6,0xc1a5,0xc174,0xc142,0xc111
+ .word 0xc0e0,0xc0af,0xc07e,0xc04d,0xc01c,0xbfeb,0xbfba,0xbf89
+ .word 0xbf58,0xbf27,0xbef6,0xbec5,0xbe95,0xbe64,0xbe33,0xbe03
+ .word 0xbdd2,0xbda2,0xbd71,0xbd41,0xbd10,0xbce0,0xbcb0,0xbc80
+ .word 0xbc4f,0xbc1f,0xbbef,0xbbbf,0xbb8f,0xbb5f,0xbb2f,0xbaff
+ .word 0xbacf,0xba9f,0xba6f,0xba40,0xba10,0xb9e0,0xb9b1,0xb981
+ .word 0xb951,0xb922,0xb8f2,0xb8c3,0xb894,0xb864,0xb835,0xb806
+ .word 0xb7d6,0xb7a7,0xb778,0xb749,0xb71a,0xb6eb,0xb6bc,0xb68d
+ .word 0xb65e,0xb62f,0xb600,0xb5d1,0xb5a2,0xb574,0xb545,0xb516
+ .word 0xb4e8,0xb4b9,0xb48a,0xb45c,0xb42e,0xb3ff,0xb3d1,0xb3a2
+ .word 0xb374,0xb346,0xb318,0xb2e9,0xb2bb,0xb28d,0xb25f,0xb231
+ .word 0xb203,0xb1d5,0xb1a7,0xb179,0xb14b,0xb11d,0xb0f0,0xb0c2
+ .word 0xb094,0xb067,0xb039,0xb00b,0xafde,0xafb0,0xaf83,0xaf55
+ .word 0xaf28,0xaefb,0xaecd,0xaea0,0xae73,0xae45,0xae18,0xadeb
+ .word 0xadbe,0xad91,0xad64,0xad37,0xad0a,0xacdd,0xacb0,0xac83
+ .word 0xac57,0xac2a,0xabfd,0xabd0,0xaba4,0xab77,0xab4a,0xab1e
+ .word 0xaaf1,0xaac5,0xaa98,0xaa6c,0xaa40,0xaa13,0xa9e7,0xa9bb
+ .word 0xa98e,0xa962,0xa936,0xa90a,0xa8de,0xa8b2,0xa886,0xa85a
+ .word 0xa82e,0xa802,0xa7d6,0xa7aa,0xa77e,0xa753,0xa727,0xa6fb
+ .word 0xa6d0,0xa6a4,0xa678,0xa64d,0xa621,0xa5f6,0xa5ca,0xa59f
+ .word 0xa574,0xa548,0xa51d,0xa4f2,0xa4c6,0xa49b,0xa470,0xa445
+ .word 0xa41a,0xa3ef,0xa3c4,0xa399,0xa36e,0xa343,0xa318,0xa2ed
+ .word 0xa2c2,0xa297,0xa26d,0xa242,0xa217,0xa1ed,0xa1c2,0xa197
+ .word 0xa16d,0xa142,0xa118,0xa0ed,0xa0c3,0xa098,0xa06e,0xa044
+ .word 0xa01a,0x9fef,0x9fc5,0x9f9b,0x9f71,0x9f47,0x9f1c,0x9ef2
+ .word 0x9ec8,0x9e9e,0x9e74,0x9e4b,0x9e21,0x9df7,0x9dcd,0x9da3
+ .word 0x9d79,0x9d50,0x9d26,0x9cfc,0x9cd3,0x9ca9,0x9c80,0x9c56
+ .word 0x9c2d,0x9c03,0x9bda,0x9bb0,0x9b87,0x9b5e,0x9b34,0x9b0b
+ .word 0x9ae2,0x9ab9,0x9a8f,0x9a66,0x9a3d,0x9a14,0x99eb,0x99c2
+ .word 0x9999,0x9970,0x9947,0x991e,0x98f6,0x98cd,0x98a4,0x987b
+ .word 0x9852,0x982a,0x9801,0x97d8,0x97b0,0x9787,0x975f,0x9736
+ .word 0x970e,0x96e5,0x96bd,0x9695,0x966c,0x9644,0x961c,0x95f3
+ .word 0x95cb,0x95a3,0x957b,0x9553,0x952b,0x9503,0x94db,0x94b3
+ .word 0x948b,0x9463,0x943b,0x9413,0x93eb,0x93c3,0x939b,0x9374
+ .word 0x934c,0x9324,0x92fd,0x92d5,0x92ad,0x9286,0x925e,0x9237
+ .word 0x920f,0x91e8,0x91c0,0x9199,0x9172,0x914a,0x9123,0x90fc
+ .word 0x90d4,0x90ad,0x9086,0x905f,0x9038,0x9011,0x8fea,0x8fc3
+ .word 0x8f9c,0x8f75,0x8f4e,0x8f27,0x8f00,0x8ed9,0x8eb2,0x8e8b
+ .word 0x8e65,0x8e3e,0x8e17,0x8df1,0x8dca,0x8da3,0x8d7d,0x8d56
+ .word 0x8d30,0x8d09,0x8ce3,0x8cbc,0x8c96,0x8c6f,0x8c49,0x8c23
+ .word 0x8bfc,0x8bd6,0x8bb0,0x8b8a,0x8b64,0x8b3d,0x8b17,0x8af1
+ .word 0x8acb,0x8aa5,0x8a7f,0x8a59,0x8a33,0x8a0d,0x89e7,0x89c1
+ .word 0x899c,0x8976,0x8950,0x892a,0x8904,0x88df,0x88b9,0x8893
+ .word 0x886e,0x8848,0x8823,0x87fd,0x87d8,0x87b2,0x878d,0x8767
+ .word 0x8742,0x871d,0x86f7,0x86d2,0x86ad,0x8687,0x8662,0x863d
+ .word 0x8618,0x85f3,0x85ce,0x85a9,0x8583,0x855e,0x8539,0x8514
+ .word 0x84f0,0x84cb,0x84a6,0x8481,0x845c,0x8437,0x8412,0x83ee
+ .word 0x83c9,0x83a4,0x8380,0x835b,0x8336,0x8312,0x82ed,0x82c9
+ .word 0x82a4,0x8280,0x825b,0x8237,0x8212,0x81ee,0x81ca,0x81a5
+ .word 0x8181,0x815d,0x8138,0x8114,0x80f0,0x80cc,0x80a8,0x8084
+ .word 0x8060,0x803c,0x8018,0x7ff4,0x7fd0,0x7fac,0x7f88,0x7f64
+ .word 0x7f40,0x7f1c,0x7ef8,0x7ed4,0x7eb1,0x7e8d,0x7e69,0x7e45
+ .word 0x7e22,0x7dfe,0x7ddb,0x7db7,0x7d93,0x7d70,0x7d4c,0x7d29
+ .word 0x7d05,0x7ce2,0x7cbf,0x7c9b,0x7c78,0x7c55,0x7c31,0x7c0e
+ .word 0x7beb,0x7bc7,0x7ba4,0x7b81,0x7b5e,0x7b3b,0x7b18,0x7af5
+ .word 0x7ad2,0x7aaf,0x7a8c,0x7a69,0x7a46,0x7a23,0x7a00,0x79dd
+ .word 0x79ba,0x7997,0x7975,0x7952,0x792f,0x790c,0x78ea,0x78c7
+ .word 0x78a4,0x7882,0x785f,0x783c,0x781a,0x77f7,0x77d5,0x77b2
+ .word 0x7790,0x776e,0x774b,0x7729,0x7706,0x76e4,0x76c2,0x76a0
+ .word 0x767d,0x765b,0x7639,0x7617,0x75f5,0x75d2,0x75b0,0x758e
+ .word 0x756c,0x754a,0x7528,0x7506,0x74e4,0x74c2,0x74a0,0x747e
+ .word 0x745d,0x743b,0x7419,0x73f7,0x73d5,0x73b4,0x7392,0x7370
+ .word 0x734f,0x732d,0x730b,0x72ea,0x72c8,0x72a7,0x7285,0x7264
+ .word 0x7242,0x7221,0x71ff,0x71de,0x71bc,0x719b,0x717a,0x7158
+ .word 0x7137,0x7116,0x70f5,0x70d3,0x70b2,0x7091,0x7070,0x704f
+ .word 0x702e,0x700c,0x6feb,0x6fca,0x6fa9,0x6f88,0x6f67,0x6f46
+ .word 0x6f26,0x6f05,0x6ee4,0x6ec3,0x6ea2,0x6e81,0x6e60,0x6e40
+ .word 0x6e1f,0x6dfe,0x6dde,0x6dbd,0x6d9c,0x6d7c,0x6d5b,0x6d3a
+ .word 0x6d1a,0x6cf9,0x6cd9,0x6cb8,0x6c98,0x6c77,0x6c57,0x6c37
+ .word 0x6c16,0x6bf6,0x6bd6,0x6bb5,0x6b95,0x6b75,0x6b54,0x6b34
+ .word 0x6b14,0x6af4,0x6ad4,0x6ab4,0x6a94,0x6a73,0x6a53,0x6a33
+ .word 0x6a13,0x69f3,0x69d3,0x69b3,0x6993,0x6974,0x6954,0x6934
+ .word 0x6914,0x68f4,0x68d4,0x68b5,0x6895,0x6875,0x6855,0x6836
+ .word 0x6816,0x67f6,0x67d7,0x67b7,0x6798,0x6778,0x6758,0x6739
+ .word 0x6719,0x66fa,0x66db,0x66bb,0x669c,0x667c,0x665d,0x663e
+ .word 0x661e,0x65ff,0x65e0,0x65c0,0x65a1,0x6582,0x6563,0x6544
+ .word 0x6524,0x6505,0x64e6,0x64c7,0x64a8,0x6489,0x646a,0x644b
+ .word 0x642c,0x640d,0x63ee,0x63cf,0x63b0,0x6391,0x6373,0x6354
+ .word 0x6335,0x6316,0x62f7,0x62d9,0x62ba,0x629b,0x627c,0x625e
+ .word 0x623f,0x6221,0x6202,0x61e3,0x61c5,0x61a6,0x6188,0x6169
+ .word 0x614b,0x612c,0x610e,0x60ef,0x60d1,0x60b3,0x6094,0x6076
+ .word 0x6058,0x6039,0x601b,0x5ffd,0x5fdf,0x5fc0,0x5fa2,0x5f84
+ .word 0x5f66,0x5f48,0x5f2a,0x5f0b,0x5eed,0x5ecf,0x5eb1,0x5e93
+ .word 0x5e75,0x5e57,0x5e39,0x5e1b,0x5dfd,0x5de0,0x5dc2,0x5da4
+ .word 0x5d86,0x5d68,0x5d4a,0x5d2d,0x5d0f,0x5cf1,0x5cd3,0x5cb6
+ .word 0x5c98,0x5c7a,0x5c5d,0x5c3f,0x5c21,0x5c04,0x5be6,0x5bc9
+ .word 0x5bab,0x5b8e,0x5b70,0x5b53,0x5b35,0x5b18,0x5afb,0x5add
+ .word 0x5ac0,0x5aa2,0x5a85,0x5a68,0x5a4b,0x5a2d,0x5a10,0x59f3
+ .word 0x59d6,0x59b8,0x599b,0x597e,0x5961,0x5944,0x5927,0x590a
+ .word 0x58ed,0x58d0,0x58b3,0x5896,0x5879,0x585c,0x583f,0x5822
+ .word 0x5805,0x57e8,0x57cb,0x57ae,0x5791,0x5775,0x5758,0x573b
+ .word 0x571e,0x5702,0x56e5,0x56c8,0x56ac,0x568f,0x5672,0x5656
+ .word 0x5639,0x561c,0x5600,0x55e3,0x55c7,0x55aa,0x558e,0x5571
+ .word 0x5555,0x5538,0x551c,0x5500,0x54e3,0x54c7,0x54aa,0x548e
+ .word 0x5472,0x5456,0x5439,0x541d,0x5401,0x53e5,0x53c8,0x53ac
+ .word 0x5390,0x5374,0x5358,0x533c,0x5320,0x5304,0x52e8,0x52cb
+ .word 0x52af,0x5293,0x5277,0x525c,0x5240,0x5224,0x5208,0x51ec
+ .word 0x51d0,0x51b4,0x5198,0x517c,0x5161,0x5145,0x5129,0x510d
+ .word 0x50f2,0x50d6,0x50ba,0x509f,0x5083,0x5067,0x504c,0x5030
+ .word 0x5015,0x4ff9,0x4fdd,0x4fc2,0x4fa6,0x4f8b,0x4f6f,0x4f54
+ .word 0x4f38,0x4f1d,0x4f02,0x4ee6,0x4ecb,0x4eb0,0x4e94,0x4e79
+ .word 0x4e5e,0x4e42,0x4e27,0x4e0c,0x4df0,0x4dd5,0x4dba,0x4d9f
+ .word 0x4d84,0x4d69,0x4d4d,0x4d32,0x4d17,0x4cfc,0x4ce1,0x4cc6
+ .word 0x4cab,0x4c90,0x4c75,0x4c5a,0x4c3f,0x4c24,0x4c09,0x4bee
+ .word 0x4bd3,0x4bb9,0x4b9e,0x4b83,0x4b68,0x4b4d,0x4b32,0x4b18
+ .word 0x4afd,0x4ae2,0x4ac7,0x4aad,0x4a92,0x4a77,0x4a5d,0x4a42
+ .word 0x4a27,0x4a0d,0x49f2,0x49d8,0x49bd,0x49a3,0x4988,0x496e
+ .word 0x4953,0x4939,0x491e,0x4904,0x48e9,0x48cf,0x48b5,0x489a
+ .word 0x4880,0x4865,0x484b,0x4831,0x4817,0x47fc,0x47e2,0x47c8
+ .word 0x47ae,0x4793,0x4779,0x475f,0x4745,0x472b,0x4711,0x46f6
+ .word 0x46dc,0x46c2,0x46a8,0x468e,0x4674,0x465a,0x4640,0x4626
+ .word 0x460c,0x45f2,0x45d8,0x45be,0x45a5,0x458b,0x4571,0x4557
+ .word 0x453d,0x4523,0x4509,0x44f0,0x44d6,0x44bc,0x44a2,0x4489
+ .word 0x446f,0x4455,0x443c,0x4422,0x4408,0x43ef,0x43d5,0x43bc
+ .word 0x43a2,0x4388,0x436f,0x4355,0x433c,0x4322,0x4309,0x42ef
+ .word 0x42d6,0x42bc,0x42a3,0x428a,0x4270,0x4257,0x423d,0x4224
+ .word 0x420b,0x41f2,0x41d8,0x41bf,0x41a6,0x418c,0x4173,0x415a
+ .word 0x4141,0x4128,0x410e,0x40f5,0x40dc,0x40c3,0x40aa,0x4091
+ .word 0x4078,0x405f,0x4046,0x402d,0x4014,0x3ffb,0x3fe2,0x3fc9
+ .word 0x3fb0,0x3f97,0x3f7e,0x3f65,0x3f4c,0x3f33,0x3f1a,0x3f01
+ .word 0x3ee8,0x3ed0,0x3eb7,0x3e9e,0x3e85,0x3e6c,0x3e54,0x3e3b
+ .word 0x3e22,0x3e0a,0x3df1,0x3dd8,0x3dc0,0x3da7,0x3d8e,0x3d76
+ .word 0x3d5d,0x3d45,0x3d2c,0x3d13,0x3cfb,0x3ce2,0x3cca,0x3cb1
+ .word 0x3c99,0x3c80,0x3c68,0x3c50,0x3c37,0x3c1f,0x3c06,0x3bee
+ .word 0x3bd6,0x3bbd,0x3ba5,0x3b8d,0x3b74,0x3b5c,0x3b44,0x3b2b
+ .word 0x3b13,0x3afb,0x3ae3,0x3acb,0x3ab2,0x3a9a,0x3a82,0x3a6a
+ .word 0x3a52,0x3a3a,0x3a22,0x3a09,0x39f1,0x39d9,0x39c1,0x39a9
+ .word 0x3991,0x3979,0x3961,0x3949,0x3931,0x3919,0x3901,0x38ea
+ .word 0x38d2,0x38ba,0x38a2,0x388a,0x3872,0x385a,0x3843,0x382b
+ .word 0x3813,0x37fb,0x37e3,0x37cc,0x37b4,0x379c,0x3785,0x376d
+ .word 0x3755,0x373e,0x3726,0x370e,0x36f7,0x36df,0x36c8,0x36b0
+ .word 0x3698,0x3681,0x3669,0x3652,0x363a,0x3623,0x360b,0x35f4
+ .word 0x35dc,0x35c5,0x35ae,0x3596,0x357f,0x3567,0x3550,0x3539
+ .word 0x3521,0x350a,0x34f3,0x34db,0x34c4,0x34ad,0x3496,0x347e
+ .word 0x3467,0x3450,0x3439,0x3422,0x340a,0x33f3,0x33dc,0x33c5
+ .word 0x33ae,0x3397,0x3380,0x3368,0x3351,0x333a,0x3323,0x330c
+ .word 0x32f5,0x32de,0x32c7,0x32b0,0x3299,0x3282,0x326c,0x3255
+ .word 0x323e,0x3227,0x3210,0x31f9,0x31e2,0x31cb,0x31b5,0x319e
+ .word 0x3187,0x3170,0x3159,0x3143,0x312c,0x3115,0x30fe,0x30e8
+ .word 0x30d1,0x30ba,0x30a4,0x308d,0x3076,0x3060,0x3049,0x3033
+ .word 0x301c,0x3005,0x2fef,0x2fd8,0x2fc2,0x2fab,0x2f95,0x2f7e
+ .word 0x2f68,0x2f51,0x2f3b,0x2f24,0x2f0e,0x2ef8,0x2ee1,0x2ecb
+ .word 0x2eb4,0x2e9e,0x2e88,0x2e71,0x2e5b,0x2e45,0x2e2e,0x2e18
+ .word 0x2e02,0x2dec,0x2dd5,0x2dbf,0x2da9,0x2d93,0x2d7c,0x2d66
+ .word 0x2d50,0x2d3a,0x2d24,0x2d0e,0x2cf8,0x2ce1,0x2ccb,0x2cb5
+ .word 0x2c9f,0x2c89,0x2c73,0x2c5d,0x2c47,0x2c31,0x2c1b,0x2c05
+ .word 0x2bef,0x2bd9,0x2bc3,0x2bad,0x2b97,0x2b81,0x2b6c,0x2b56
+ .word 0x2b40,0x2b2a,0x2b14,0x2afe,0x2ae8,0x2ad3,0x2abd,0x2aa7
+ .word 0x2a91,0x2a7c,0x2a66,0x2a50,0x2a3a,0x2a25,0x2a0f,0x29f9
+ .word 0x29e4,0x29ce,0x29b8,0x29a3,0x298d,0x2977,0x2962,0x294c
+ .word 0x2937,0x2921,0x290c,0x28f6,0x28e0,0x28cb,0x28b5,0x28a0
+ .word 0x288b,0x2875,0x2860,0x284a,0x2835,0x281f,0x280a,0x27f5
+ .word 0x27df,0x27ca,0x27b4,0x279f,0x278a,0x2774,0x275f,0x274a
+ .word 0x2735,0x271f,0x270a,0x26f5,0x26e0,0x26ca,0x26b5,0x26a0
+ .word 0x268b,0x2676,0x2660,0x264b,0x2636,0x2621,0x260c,0x25f7
+ .word 0x25e2,0x25cd,0x25b8,0x25a2,0x258d,0x2578,0x2563,0x254e
+ .word 0x2539,0x2524,0x250f,0x24fa,0x24e5,0x24d1,0x24bc,0x24a7
+ .word 0x2492,0x247d,0x2468,0x2453,0x243e,0x2429,0x2415,0x2400
+ .word 0x23eb,0x23d6,0x23c1,0x23ad,0x2398,0x2383,0x236e,0x235a
+ .word 0x2345,0x2330,0x231c,0x2307,0x22f2,0x22dd,0x22c9,0x22b4
+ .word 0x22a0,0x228b,0x2276,0x2262,0x224d,0x2239,0x2224,0x2210
+ .word 0x21fb,0x21e6,0x21d2,0x21bd,0x21a9,0x2194,0x2180,0x216c
+ .word 0x2157,0x2143,0x212e,0x211a,0x2105,0x20f1,0x20dd,0x20c8
+ .word 0x20b4,0x20a0,0x208b,0x2077,0x2063,0x204e,0x203a,0x2026
+ .word 0x2012,0x1ffd,0x1fe9,0x1fd5,0x1fc1,0x1fac,0x1f98,0x1f84
+ .word 0x1f70,0x1f5c,0x1f47,0x1f33,0x1f1f,0x1f0b,0x1ef7,0x1ee3
+ .word 0x1ecf,0x1ebb,0x1ea7,0x1e93,0x1e7f,0x1e6a,0x1e56,0x1e42
+ .word 0x1e2e,0x1e1a,0x1e06,0x1df3,0x1ddf,0x1dcb,0x1db7,0x1da3
+ .word 0x1d8f,0x1d7b,0x1d67,0x1d53,0x1d3f,0x1d2b,0x1d18,0x1d04
+ .word 0x1cf0,0x1cdc,0x1cc8,0x1cb5,0x1ca1,0x1c8d,0x1c79,0x1c65
+ .word 0x1c52,0x1c3e,0x1c2a,0x1c17,0x1c03,0x1bef,0x1bdb,0x1bc8
+ .word 0x1bb4,0x1ba0,0x1b8d,0x1b79,0x1b66,0x1b52,0x1b3e,0x1b2b
+ .word 0x1b17,0x1b04,0x1af0,0x1add,0x1ac9,0x1ab6,0x1aa2,0x1a8f
+ .word 0x1a7b,0x1a68,0x1a54,0x1a41,0x1a2d,0x1a1a,0x1a06,0x19f3
+ .word 0x19e0,0x19cc,0x19b9,0x19a5,0x1992,0x197f,0x196b,0x1958
+ .word 0x1945,0x1931,0x191e,0x190b,0x18f8,0x18e4,0x18d1,0x18be
+ .word 0x18ab,0x1897,0x1884,0x1871,0x185e,0x184b,0x1837,0x1824
+ .word 0x1811,0x17fe,0x17eb,0x17d8,0x17c4,0x17b1,0x179e,0x178b
+ .word 0x1778,0x1765,0x1752,0x173f,0x172c,0x1719,0x1706,0x16f3
+ .word 0x16e0,0x16cd,0x16ba,0x16a7,0x1694,0x1681,0x166e,0x165b
+ .word 0x1648,0x1635,0x1623,0x1610,0x15fd,0x15ea,0x15d7,0x15c4
+ .word 0x15b1,0x159f,0x158c,0x1579,0x1566,0x1553,0x1541,0x152e
+ .word 0x151b,0x1508,0x14f6,0x14e3,0x14d0,0x14bd,0x14ab,0x1498
+ .word 0x1485,0x1473,0x1460,0x144d,0x143b,0x1428,0x1416,0x1403
+ .word 0x13f0,0x13de,0x13cb,0x13b9,0x13a6,0x1394,0x1381,0x136f
+ .word 0x135c,0x1349,0x1337,0x1325,0x1312,0x1300,0x12ed,0x12db
+ .word 0x12c8,0x12b6,0x12a3,0x1291,0x127f,0x126c,0x125a,0x1247
+ .word 0x1235,0x1223,0x1210,0x11fe,0x11ec,0x11d9,0x11c7,0x11b5
+ .word 0x11a3,0x1190,0x117e,0x116c,0x1159,0x1147,0x1135,0x1123
+ .word 0x1111,0x10fe,0x10ec,0x10da,0x10c8,0x10b6,0x10a4,0x1091
+ .word 0x107f,0x106d,0x105b,0x1049,0x1037,0x1025,0x1013,0x1001
+ .word 0x0fef,0x0fdc,0x0fca,0x0fb8,0x0fa6,0x0f94,0x0f82,0x0f70
+ .word 0x0f5e,0x0f4c,0x0f3a,0x0f28,0x0f17,0x0f05,0x0ef3,0x0ee1
+ .word 0x0ecf,0x0ebd,0x0eab,0x0e99,0x0e87,0x0e75,0x0e64,0x0e52
+ .word 0x0e40,0x0e2e,0x0e1c,0x0e0a,0x0df9,0x0de7,0x0dd5,0x0dc3
+ .word 0x0db2,0x0da0,0x0d8e,0x0d7c,0x0d6b,0x0d59,0x0d47,0x0d35
+ .word 0x0d24,0x0d12,0x0d00,0x0cef,0x0cdd,0x0ccb,0x0cba,0x0ca8
+ .word 0x0c97,0x0c85,0x0c73,0x0c62,0x0c50,0x0c3f,0x0c2d,0x0c1c
+ .word 0x0c0a,0x0bf8,0x0be7,0x0bd5,0x0bc4,0x0bb2,0x0ba1,0x0b8f
+ .word 0x0b7e,0x0b6c,0x0b5b,0x0b4a,0x0b38,0x0b27,0x0b15,0x0b04
+ .word 0x0af2,0x0ae1,0x0ad0,0x0abe,0x0aad,0x0a9c,0x0a8a,0x0a79
+ .word 0x0a68,0x0a56,0x0a45,0x0a34,0x0a22,0x0a11,0x0a00,0x09ee
+ .word 0x09dd,0x09cc,0x09bb,0x09a9,0x0998,0x0987,0x0976,0x0965
+ .word 0x0953,0x0942,0x0931,0x0920,0x090f,0x08fe,0x08ec,0x08db
+ .word 0x08ca,0x08b9,0x08a8,0x0897,0x0886,0x0875,0x0864,0x0853
+ .word 0x0842,0x0831,0x081f,0x080e,0x07fd,0x07ec,0x07db,0x07ca
+ .word 0x07b9,0x07a8,0x0798,0x0787,0x0776,0x0765,0x0754,0x0743
+ .word 0x0732,0x0721,0x0710,0x06ff,0x06ee,0x06dd,0x06cd,0x06bc
+ .word 0x06ab,0x069a,0x0689,0x0678,0x0668,0x0657,0x0646,0x0635
+ .word 0x0624,0x0614,0x0603,0x05f2,0x05e1,0x05d1,0x05c0,0x05af
+ .word 0x059e,0x058e,0x057d,0x056c,0x055c,0x054b,0x053a,0x052a
+ .word 0x0519,0x0508,0x04f8,0x04e7,0x04d6,0x04c6,0x04b5,0x04a5
+ .word 0x0494,0x0484,0x0473,0x0462,0x0452,0x0441,0x0431,0x0420
+ .word 0x0410,0x03ff,0x03ef,0x03de,0x03ce,0x03bd,0x03ad,0x039c
+ .word 0x038c,0x037b,0x036b,0x035b,0x034a,0x033a,0x0329,0x0319
+ .word 0x0309,0x02f8,0x02e8,0x02d7,0x02c7,0x02b7,0x02a6,0x0296
+ .word 0x0286,0x0275,0x0265,0x0255,0x0245,0x0234,0x0224,0x0214
+ .word 0x0204,0x01f3,0x01e3,0x01d3,0x01c3,0x01b2,0x01a2,0x0192
+ .word 0x0182,0x0172,0x0161,0x0151,0x0141,0x0131,0x0121,0x0111
+ .word 0x0101,0x00f0,0x00e0,0x00d0,0x00c0,0x00b0,0x00a0,0x0090
+ .word 0x0080,0x0070,0x0060,0x0050,0x0040,0x0030,0x0020,0x0010
DATAEND()
ASM_END()
diff --git a/gmp/mpn/alpha/lshift.asm b/gmp/mpn/alpha/lshift.asm
index c62a856aea..eb5b2a0b68 100644
--- a/gmp/mpn/alpha/lshift.asm
+++ b/gmp/mpn/alpha/lshift.asm
@@ -1,39 +1,28 @@
dnl Alpha mpn_lshift -- Shift a number left.
-dnl Copyright 1994, 1995, 2000, 2003, 2009 Free Software Foundation, Inc.
+dnl Copyright 1994, 1995, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 3.25
-C EV6: 1.75
+C EV4: 4.75
+C EV5: 4
+C EV6: 2
C INPUT PARAMETERS
C rp r16
@@ -46,137 +35,63 @@ ASM_START()
PROLOGUE(mpn_lshift)
s8addq r18,r17,r17 C make r17 point at end of s1
ldq r4,-8(r17) C load first limb
- subq r31,r19,r20
+ subq r17,8,r17
+ subq r31,r19,r7
s8addq r18,r16,r16 C make r16 point at end of RES
subq r18,1,r18
- and r18,4-1,r28 C number of limbs in first loop
- srl r4,r20,r0 C compute function result
+ and r18,4-1,r20 C number of limbs in first loop
+ srl r4,r7,r0 C compute function result
- beq r28,L(L0)
- subq r18,r28,r18
+ beq r20,$L0
+ subq r18,r20,r18
ALIGN(8)
-L(top0):
- ldq r3,-16(r17)
+$Loop0: ldq r3,-8(r17)
subq r16,8,r16
- sll r4,r19,r5
subq r17,8,r17
- subq r28,1,r28
- srl r3,r20,r6
+ subq r20,1,r20
+ sll r4,r19,r5
+ srl r3,r7,r6
bis r3,r3,r4
bis r5,r6,r8
stq r8,0(r16)
- bne r28,L(top0)
+ bne r20,$Loop0
-L(L0): sll r4,r19,r24
- beq r18,L(end)
-C warm up phase 1
- ldq r1,-16(r17)
- subq r18,4,r18
- ldq r2,-24(r17)
- ldq r3,-32(r17)
- ldq r4,-40(r17)
-C warm up phase 2
- srl r1,r20,r7
- sll r1,r19,r21
- srl r2,r20,r8
- beq r18,L(end1)
- ldq r1,-48(r17)
- sll r2,r19,r22
- ldq r2,-56(r17)
- srl r3,r20,r5
- bis r7,r24,r7
- sll r3,r19,r23
- bis r8,r21,r8
- srl r4,r20,r6
- ldq r3,-64(r17)
- sll r4,r19,r24
- ldq r4,-72(r17)
- subq r18,4,r18
- beq r18,L(end2)
- ALIGN(16)
-C main loop
-L(top): stq r7,-8(r16)
- bis r5,r22,r5
- stq r8,-16(r16)
- bis r6,r23,r6
-
- srl r1,r20,r7
- subq r18,4,r18
- sll r1,r19,r21
- unop C ldq r31,-96(r17)
-
- srl r2,r20,r8
- ldq r1,-80(r17)
- sll r2,r19,r22
- ldq r2,-88(r17)
-
- stq r5,-24(r16)
- bis r7,r24,r7
- stq r6,-32(r16)
- bis r8,r21,r8
-
- srl r3,r20,r5
- unop C ldq r31,-96(r17)
- sll r3,r19,r23
+$L0: beq r18,$Lend
+
+ ALIGN(8)
+$Loop: ldq r3,-8(r17)
subq r16,32,r16
+ subq r18,4,r18
+ sll r4,r19,r5
+ srl r3,r7,r6
+
+ ldq r4,-16(r17)
+ sll r3,r19,r1
+ bis r5,r6,r8
+ stq r8,24(r16)
+ srl r4,r7,r2
+
+ ldq r3,-24(r17)
+ sll r4,r19,r5
+ bis r1,r2,r8
+ stq r8,16(r16)
+ srl r3,r7,r6
- srl r4,r20,r6
- ldq r3,-96(r17)
- sll r4,r19,r24
- ldq r4,-104(r17)
+ ldq r4,-32(r17)
+ sll r3,r19,r1
+ bis r5,r6,r8
+ stq r8,8(r16)
+ srl r4,r7,r2
subq r17,32,r17
- bne r18,L(top)
-C cool down phase 2/1
-L(end2):
- stq r7,-8(r16)
- bis r5,r22,r5
- stq r8,-16(r16)
- bis r6,r23,r6
- srl r1,r20,r7
- sll r1,r19,r21
- srl r2,r20,r8
- sll r2,r19,r22
- stq r5,-24(r16)
- bis r7,r24,r7
- stq r6,-32(r16)
- bis r8,r21,r8
- srl r3,r20,r5
- sll r3,r19,r23
- srl r4,r20,r6
- sll r4,r19,r24
-C cool down phase 2/2
- stq r7,-40(r16)
- bis r5,r22,r5
- stq r8,-48(r16)
- bis r6,r23,r6
- stq r5,-56(r16)
- stq r6,-64(r16)
-C cool down phase 2/3
- stq r24,-72(r16)
- ret r31,(r26),1
+ bis r1,r2,r8
+ stq r8,0(r16)
-C cool down phase 1/1
-L(end1):
- sll r2,r19,r22
- srl r3,r20,r5
- bis r7,r24,r7
- sll r3,r19,r23
- bis r8,r21,r8
- srl r4,r20,r6
- sll r4,r19,r24
-C cool down phase 1/2
- stq r7,-8(r16)
- bis r5,r22,r5
- stq r8,-16(r16)
- bis r6,r23,r6
- stq r5,-24(r16)
- stq r6,-32(r16)
- stq r24,-40(r16)
- ret r31,(r26),1
+ bgt r18,$Loop
-L(end): stq r24,-8(r16)
+$Lend: sll r4,r19,r8
+ stq r8,-8(r16)
ret r31,(r26),1
EPILOGUE(mpn_lshift)
ASM_END()
diff --git a/gmp/mpn/alpha/mod_34lsub1.asm b/gmp/mpn/alpha/mod_34lsub1.asm
index 1b03b637d8..e5c1d221f9 100644
--- a/gmp/mpn/alpha/mod_34lsub1.asm
+++ b/gmp/mpn/alpha/mod_34lsub1.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/mode1o.asm b/gmp/mpn/alpha/mode1o.asm
index 96dccc73ee..0611cd8acb 100644
--- a/gmp/mpn/alpha/mode1o.asm
+++ b/gmp/mpn/alpha/mode1o.asm
@@ -1,32 +1,21 @@
dnl Alpha mpn_modexact_1c_odd -- mpn exact remainder
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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/alpha/mul_1.asm b/gmp/mpn/alpha/mul_1.asm
index a7cdbcf8eb..30b17021ba 100644
--- a/gmp/mpn/alpha/mul_1.asm
+++ b/gmp/mpn/alpha/mul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/rshift.asm b/gmp/mpn/alpha/rshift.asm
index 6e1e214558..ccedff8071 100644
--- a/gmp/mpn/alpha/rshift.asm
+++ b/gmp/mpn/alpha/rshift.asm
@@ -1,39 +1,28 @@
dnl Alpha mpn_rshift -- Shift a number right.
-dnl Copyright 1994, 1995, 2000, 2009 Free Software Foundation, Inc.
+dnl Copyright 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 3.25
-C EV6: 1.75
+C EV4: 4.75
+C EV5: 3.75
+C EV6: 2
C INPUT PARAMETERS
C rp r16
@@ -45,136 +34,62 @@ C cnt r19
ASM_START()
PROLOGUE(mpn_rshift)
ldq r4,0(r17) C load first limb
- subq r31,r19,r20
+ addq r17,8,r17
+ subq r31,r19,r7
subq r18,1,r18
- and r18,4-1,r28 C number of limbs in first loop
- sll r4,r20,r0 C compute function result
+ and r18,4-1,r20 C number of limbs in first loop
+ sll r4,r7,r0 C compute function result
- beq r28,L(L0)
- subq r18,r28,r18
+ beq r20,$L0
+ subq r18,r20,r18
ALIGN(8)
-L(top0):
- ldq r3,8(r17)
+$Loop0: ldq r3,0(r17)
addq r16,8,r16
- srl r4,r19,r5
addq r17,8,r17
- subq r28,1,r28
- sll r3,r20,r6
+ subq r20,1,r20
+ srl r4,r19,r5
+ sll r3,r7,r6
bis r3,r3,r4
bis r5,r6,r8
stq r8,-8(r16)
- bne r28,L(top0)
+ bne r20,$Loop0
-L(L0): srl r4,r19,r24
- beq r18,L(end)
-C warm up phase 1
- ldq r1,8(r17)
- subq r18,4,r18
- ldq r2,16(r17)
- ldq r3,24(r17)
- ldq r4,32(r17)
-C warm up phase 2
- sll r1,r20,r7
- srl r1,r19,r21
- sll r2,r20,r8
- beq r18,L(end1)
- ldq r1,40(r17)
- srl r2,r19,r22
- ldq r2,48(r17)
- sll r3,r20,r5
- bis r7,r24,r7
- srl r3,r19,r23
- bis r8,r21,r8
- sll r4,r20,r6
- ldq r3,56(r17)
- srl r4,r19,r24
- ldq r4,64(r17)
- subq r18,4,r18
- beq r18,L(end2)
- ALIGN(16)
-C main loop
-L(top): stq r7,0(r16)
- bis r5,r22,r5
- stq r8,8(r16)
- bis r6,r23,r6
-
- sll r1,r20,r7
- subq r18,4,r18
- srl r1,r19,r21
- unop C ldq r31,-96(r17)
-
- sll r2,r20,r8
- ldq r1,72(r17)
- srl r2,r19,r22
- ldq r2,80(r17)
-
- stq r5,16(r16)
- bis r7,r24,r7
- stq r6,24(r16)
- bis r8,r21,r8
-
- sll r3,r20,r5
- unop C ldq r31,-96(r17)
- srl r3,r19,r23
+$L0: beq r18,$Lend
+
+ ALIGN(8)
+$Loop: ldq r3,0(r17)
addq r16,32,r16
+ subq r18,4,r18
+ srl r4,r19,r5
+ sll r3,r7,r6
+
+ ldq r4,8(r17)
+ srl r3,r19,r1
+ bis r5,r6,r8
+ stq r8,-32(r16)
+ sll r4,r7,r2
+
+ ldq r3,16(r17)
+ srl r4,r19,r5
+ bis r1,r2,r8
+ stq r8,-24(r16)
+ sll r3,r7,r6
- sll r4,r20,r6
- ldq r3,88(r17)
- srl r4,r19,r24
- ldq r4,96(r17)
+ ldq r4,24(r17)
+ srl r3,r19,r1
+ bis r5,r6,r8
+ stq r8,-16(r16)
+ sll r4,r7,r2
addq r17,32,r17
- bne r18,L(top)
-C cool down phase 2/1
-L(end2):
- stq r7,0(r16)
- bis r5,r22,r5
- stq r8,8(r16)
- bis r6,r23,r6
- sll r1,r20,r7
- srl r1,r19,r21
- sll r2,r20,r8
- srl r2,r19,r22
- stq r5,16(r16)
- bis r7,r24,r7
- stq r6,24(r16)
- bis r8,r21,r8
- sll r3,r20,r5
- srl r3,r19,r23
- sll r4,r20,r6
- srl r4,r19,r24
-C cool down phase 2/2
- stq r7,32(r16)
- bis r5,r22,r5
- stq r8,40(r16)
- bis r6,r23,r6
- stq r5,48(r16)
- stq r6,56(r16)
-C cool down phase 2/3
- stq r24,64(r16)
- ret r31,(r26),1
+ bis r1,r2,r8
+ stq r8,-8(r16)
-C cool down phase 1/1
-L(end1):
- srl r2,r19,r22
- sll r3,r20,r5
- bis r7,r24,r7
- srl r3,r19,r23
- bis r8,r21,r8
- sll r4,r20,r6
- srl r4,r19,r24
-C cool down phase 1/2
- stq r7,0(r16)
- bis r5,r22,r5
- stq r8,8(r16)
- bis r6,r23,r6
- stq r5,16(r16)
- stq r6,24(r16)
- stq r24,32(r16)
- ret r31,(r26),1
+ bgt r18,$Loop
-L(end): stq r24,0(r16)
+$Lend: srl r4,r19,r8
+ stq r8,0(r16)
ret r31,(r26),1
EPILOGUE(mpn_rshift)
ASM_END()
diff --git a/gmp/mpn/alpha/sec_tabselect.asm b/gmp/mpn/alpha/sec_tabselect.asm
deleted file mode 100644
index 679b16926e..0000000000
--- a/gmp/mpn/alpha/sec_tabselect.asm
+++ /dev/null
@@ -1,137 +0,0 @@
-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/gmp/mpn/alpha/sqr_diag_addlsh1.asm b/gmp/mpn/alpha/sqr_diag_addlsh1.asm
deleted file mode 100644
index ee219ef7e8..0000000000
--- a/gmp/mpn/alpha/sqr_diag_addlsh1.asm
+++ /dev/null
@@ -1,93 +0,0 @@
-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/gmp/mpn/alpha/sqr_diagonal.asm b/gmp/mpn/alpha/sqr_diagonal.asm
new file mode 100644
index 0000000000..2aa7f2e597
--- /dev/null
+++ b/gmp/mpn/alpha/sqr_diagonal.asm
@@ -0,0 +1,65 @@
+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()
diff --git a/gmp/mpn/alpha/sub_n.asm b/gmp/mpn/alpha/sub_n.asm
index 1bb72263f8..842a4f0b54 100644
--- a/gmp/mpn/alpha/sub_n.asm
+++ b/gmp/mpn/alpha/sub_n.asm
@@ -1,164 +1,117 @@
-dnl Alpha mpn_sub_n -- Subtract two limb vectors of the same length > 0
-dnl and store difference in a third limb vector.
+dnl Alpha mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
+dnl store difference in a third limb vector.
-dnl Copyright 1995, 1999, 2000, 2005, 2011 Free Software Foundation, Inc.
+dnl Copyright 1995, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 4.75
-C EV6: 3
+C EV4: 7.75
+C EV5: 5.75
+C EV6: 4
-dnl INPUT PARAMETERS
-dnl res_ptr r16
-dnl s1_ptr r17
-dnl s2_ptr r18
-dnl size r19
+C INPUT PARAMETERS
+C rp r16
+C up r17
+C vp r18
+C n r19
ASM_START()
-PROLOGUE(mpn_sub_nc)
- bis r31,r20,r25
- br L(com)
-EPILOGUE()
PROLOGUE(mpn_sub_n)
- bis r31,r31,r25 C clear cy
-L(com): subq r19,4,r19 C decr loop cnt
- blt r19,$Lend2 C if less than 4 limbs, goto 2nd loop
-C Start software pipeline for 1st loop
- ldq r0,0(r18)
- ldq r4,0(r17)
- ldq r1,8(r18)
- ldq r5,8(r17)
- addq r17,32,r17 C update s1_ptr
- subq r4,r0,r28 C 1st main subtract
- ldq r2,16(r18)
- subq r28,r25,r20 C 1st carry subtract
- ldq r3,24(r18)
- cmpult r4,r0,r8 C compute cy from last subtract
- ldq r6,-16(r17)
- cmpult r28,r25,r25 C compute cy from last subtract
- ldq r7,-8(r17)
- bis r8,r25,r25 C combine cy from the two subtracts
- subq r19,4,r19 C decr loop cnt
- subq r5,r1,r28 C 2nd main subtract
- addq r18,32,r18 C update s2_ptr
- subq r28,r25,r21 C 2nd carry subtract
- cmpult r5,r1,r8 C compute cy from last subtract
- blt r19,$Lend1 C if less than 4 limbs remain, jump
-C 1st loop handles groups of 4 limbs in a software pipeline
- ALIGN(16)
-$Loop: cmpult r28,r25,r25 C compute cy from last subtract
- ldq r0,0(r18)
- bis r8,r25,r25 C combine cy from the two subtracts
- ldq r1,8(r18)
- subq r6,r2,r28 C 3rd main subtract
- ldq r4,0(r17)
- subq r28,r25,r22 C 3rd carry subtract
- ldq r5,8(r17)
- cmpult r6,r2,r8 C compute cy from last subtract
- cmpult r28,r25,r25 C compute cy from last subtract
- stq r20,0(r16)
- bis r8,r25,r25 C combine cy from the two subtracts
- stq r21,8(r16)
- subq r7,r3,r28 C 4th main subtract
- subq r28,r25,r23 C 4th carry subtract
- cmpult r7,r3,r8 C compute cy from last subtract
- cmpult r28,r25,r25 C compute cy from last subtract
- addq r17,32,r17 C update s1_ptr
- bis r8,r25,r25 C combine cy from the two subtracts
- addq r16,32,r16 C update res_ptr
- subq r4,r0,r28 C 1st main subtract
- ldq r2,16(r18)
- subq r28,r25,r20 C 1st carry subtract
- ldq r3,24(r18)
- cmpult r4,r0,r8 C compute cy from last subtract
- ldq r6,-16(r17)
- cmpult r28,r25,r25 C compute cy from last subtract
- ldq r7,-8(r17)
- bis r8,r25,r25 C combine cy from the two subtracts
- subq r19,4,r19 C decr loop cnt
- stq r22,-16(r16)
- subq r5,r1,r28 C 2nd main subtract
- stq r23,-8(r16)
- subq r28,r25,r21 C 2nd carry subtract
- addq r18,32,r18 C update s2_ptr
- cmpult r5,r1,r8 C compute cy from last subtract
- bge r19,$Loop
-C Finish software pipeline for 1st loop
-$Lend1: cmpult r28,r25,r25 C compute cy from last subtract
- bis r8,r25,r25 C combine cy from the two subtracts
- subq r6,r2,r28 C cy add
- subq r28,r25,r22 C 3rd main subtract
- cmpult r6,r2,r8 C compute cy from last subtract
- cmpult r28,r25,r25 C compute cy from last subtract
- stq r20,0(r16)
- bis r8,r25,r25 C combine cy from the two subtracts
- stq r21,8(r16)
- subq r7,r3,r28 C cy add
- subq r28,r25,r23 C 4th main subtract
- cmpult r7,r3,r8 C compute cy from last subtract
- cmpult r28,r25,r25 C compute cy from last subtract
- bis r8,r25,r25 C combine cy from the two subtracts
- addq r16,32,r16 C update res_ptr
- stq r22,-16(r16)
- stq r23,-8(r16)
-$Lend2: addq r19,4,r19 C restore loop cnt
- beq r19,$Lret
-C Start software pipeline for 2nd loop
- ldq r0,0(r18)
- ldq r4,0(r17)
+ ldq r3,0(r17)
+ ldq r4,0(r18)
+
subq r19,1,r19
- beq r19,$Lend0
-C 2nd loop handles remaining 1-3 limbs
- ALIGN(16)
-$Loop0: subq r4,r0,r28 C main subtract
- cmpult r4,r0,r8 C compute cy from last subtract
- ldq r0,8(r18)
- ldq r4,8(r17)
- subq r28,r25,r20 C carry subtract
- addq r18,8,r18
+ and r19,4-1,r2 C number of limbs in first loop
+ bis r31,r31,r0
+ beq r2,$L0 C if multiple of 4 limbs, skip first loop
+
+ subq r19,r2,r19
+
+$Loop0: subq r2,1,r2
+ ldq r5,8(r17)
+ addq r4,r0,r4
+ ldq r6,8(r18)
+ cmpult r4,r0,r1
+ subq r3,r4,r4
+ cmpult r3,r4,r0
+ stq r4,0(r16)
+ bis r0,r1,r0
+
addq r17,8,r17
- stq r20,0(r16)
- cmpult r28,r25,r25 C compute cy from last subtract
- subq r19,1,r19 C decr loop cnt
- bis r8,r25,r25 C combine cy from the two subtracts
+ addq r18,8,r18
+ bis r5,r5,r3
+ bis r6,r6,r4
addq r16,8,r16
- bne r19,$Loop0
-$Lend0: subq r4,r0,r28 C main subtract
- subq r28,r25,r20 C carry subtract
- cmpult r4,r0,r8 C compute cy from last subtract
- cmpult r28,r25,r25 C compute cy from last subtract
- stq r20,0(r16)
- bis r8,r25,r25 C combine cy from the two subtracts
-
-$Lret: bis r25,r31,r0 C return cy
+ bne r2,$Loop0
+
+$L0: beq r19,$Lend
+
+ ALIGN(8)
+$Loop: subq r19,4,r19
+
+ ldq r5,8(r17)
+ addq r4,r0,r4
+ ldq r6,8(r18)
+ cmpult r4,r0,r1
+ subq r3,r4,r4
+ cmpult r3,r4,r0
+ stq r4,0(r16)
+ bis r0,r1,r0
+
+ ldq r3,16(r17)
+ addq r6,r0,r6
+ ldq r4,16(r18)
+ cmpult r6,r0,r1
+ subq r5,r6,r6
+ cmpult r5,r6,r0
+ stq r6,8(r16)
+ bis r0,r1,r0
+
+ ldq r5,24(r17)
+ addq r4,r0,r4
+ ldq r6,24(r18)
+ cmpult r4,r0,r1
+ subq r3,r4,r4
+ cmpult r3,r4,r0
+ stq r4,16(r16)
+ bis r0,r1,r0
+
+ ldq r3,32(r17)
+ addq r6,r0,r6
+ ldq r4,32(r18)
+ cmpult r6,r0,r1
+ subq r5,r6,r6
+ cmpult r5,r6,r0
+ stq r6,24(r16)
+ bis r0,r1,r0
+
+ addq r17,32,r17
+ addq r18,32,r18
+ addq r16,32,r16
+ bne r19,$Loop
+
+$Lend: addq r4,r0,r4
+ cmpult r4,r0,r1
+ subq r3,r4,r4
+ cmpult r3,r4,r0
+ stq r4,0(r16)
+ bis r0,r1,r0
ret r31,(r26),1
-EPILOGUE()
+EPILOGUE(mpn_sub_n)
ASM_END()
diff --git a/gmp/mpn/alpha/submul_1.asm b/gmp/mpn/alpha/submul_1.asm
index 2b63b52fa4..554ccf51b6 100644
--- a/gmp/mpn/alpha/submul_1.asm
+++ b/gmp/mpn/alpha/submul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/umul.asm b/gmp/mpn/alpha/umul.asm
index 039081ed48..7fa3f008f1 100644
--- a/gmp/mpn/alpha/umul.asm
+++ b/gmp/mpn/alpha/umul.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/alpha/unicos.m4 b/gmp/mpn/alpha/unicos.m4
index e05cf5cca6..f1f41c18e4 100644
--- a/gmp/mpn/alpha/unicos.m4
+++ b/gmp/mpn/alpha/unicos.m4
@@ -3,33 +3,22 @@ divert(-1)
dnl m4 macros for alpha assembler on unicos.
-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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 2000, 2002, 2003, 2004 Free Software Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Note that none of the standard GMP_ASM_ autoconf tests are done for
@@ -86,9 +75,8 @@ m4_assert_numargs(1)
` .extern $1')
define(`DATASTART',
-m4_assert_numargs_range(1,2)
+m4_assert_numargs(1)
` .psect $1@crud,data
- ALIGN(ifelse($#,1,2,$2))
$1:')
define(`DATAEND',
diff --git a/gmp/mpn/arm/README b/gmp/mpn/arm/README
deleted file mode 100644
index 598baa3f2e..0000000000
--- a/gmp/mpn/arm/README
+++ /dev/null
@@ -1,35 +0,0 @@
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/.
-
-
-
-
-
-This directory contains mpn functions for ARM processors. It has been
-optimised for Cortex-A9, but the code in the top-level directory should run
-on all ARM processors at architecture level v4 or later.
diff --git a/gmp/mpn/arm/add_n.asm b/gmp/mpn/arm/add_n.asm
new file mode 100644
index 0000000000..0f0791759d
--- /dev/null
+++ b/gmp/mpn/arm/add_n.asm
@@ -0,0 +1,69 @@
+dnl ARM mpn_add_n -- Add two limb vectors of the same length > 0 and store sum
+dnl in a third limb vector.
+dnl Contributed by Robert Harley.
+
+dnl Copyright 1997, 2000, 2001 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 This code runs at 5 cycles/limb.
+
+define(`rp',`r0')
+define(`up',`r1')
+define(`vp',`r2')
+define(`n',`r3')
+
+
+ASM_START()
+PROLOGUE(mpn_add_n)
+ stmfd sp!, { r8, r9, lr }
+ movs n, n, lsr #1
+ bcc L(skip1)
+ ldr r12, [up], #4
+ ldr lr, [vp], #4
+ adds r12, r12, lr
+ str r12, [rp], #4
+L(skip1):
+ tst n, #1
+ beq L(skip2)
+ ldmia up!, { r8, r9 }
+ ldmia vp!, { r12, lr }
+ adcs r8, r8, r12
+ adcs r9, r9, lr
+ stmia rp!, { r8, r9 }
+L(skip2):
+ bics n, n, #1
+ beq L(return)
+ stmfd sp!, { r4, r5, r6, r7 }
+L(add_n_loop):
+ ldmia up!, { r4, r5, r6, r7 }
+ ldmia vp!, { r8, r9, r12, lr }
+ adcs r4, r4, r8
+ ldr r8, [rp, #12] C cache allocate
+ adcs r5, r5, r9
+ adcs r6, r6, r12
+ adcs r7, r7, lr
+ stmia rp!, { r4, r5, r6, r7 }
+ sub n, n, #2
+ teq n, #0
+ bne L(add_n_loop)
+ ldmfd sp!, { r4, r5, r6, r7 }
+L(return):
+ adc r0, n, #0
+ ldmfd sp!, { r8, r9, pc }
+EPILOGUE(mpn_add_n)
diff --git a/gmp/mpn/arm/addmul_1.asm b/gmp/mpn/arm/addmul_1.asm
new file mode 100644
index 0000000000..de33f2f34b
--- /dev/null
+++ b/gmp/mpn/arm/addmul_1.asm
@@ -0,0 +1,107 @@
+dnl ARM mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
+dnl 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 The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public 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: 7.75-9.75 (dependent on vl value)
+C XScale: 8-9 (dependent on vl value, estimated)
+
+define(`rp',`r0')
+define(`up',`r1')
+define(`n',`r2')
+define(`vl',`r3')
+define(`rl',`r12')
+define(`ul',`r6')
+define(`r',`lr')
+
+
+ASM_START()
+PROLOGUE(mpn_addmul_1)
+ stmfd sp!, { r4-r6, lr }
+ mov r4, #0 C clear r4
+ adds r0, r0, #0 C clear cy
+ tst n, #1
+ beq L(skip1)
+ ldr ul, [up], #4
+ ldr rl, [rp, #0]
+ umull r5, r4, ul, vl
+ adds r, rl, r5
+ str r, [rp], #4
+L(skip1):
+ tst n, #2
+ beq L(skip2)
+ ldr ul, [up], #4
+ ldr rl, [rp, #0]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ ldr ul, [up], #4
+ adcs r, rl, r4
+ ldr rl, [rp, #4]
+ mov r4, #0
+ umlal r5, r4, ul, vl
+ str r, [rp], #4
+ adcs r, rl, r5
+ str r, [rp], #4
+L(skip2):
+ bics r, n, #3
+ beq L(return)
+
+ ldr ul, [up], #4
+ ldr rl, [rp, #0]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ b L(in)
+
+L(loop):
+ ldr ul, [up], #4
+ adcs r, rl, r5
+ ldr rl, [rp, #4]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ str r, [rp], #4
+L(in): ldr ul, [up], #4
+ adcs r, rl, r4
+ ldr rl, [rp, #4]
+ mov r4, #0
+ umlal r5, r4, ul, vl
+ str r, [rp], #4
+ ldr ul, [up], #4
+ adcs r, rl, r5
+ ldr rl, [rp, #4]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ str r, [rp], #4
+ ldr ul, [up], #4
+ adcs r, rl, r4
+ ldr rl, [rp, #4]
+ mov r4, #0
+ umlal r5, r4, ul, vl
+ str r, [rp], #4
+ sub n, n, #4
+ bics r, n, #3
+ bne L(loop)
+
+ adcs r, rl, r5
+ str r, [rp], #4
+L(return):
+ adc r0, r4, #0
+ ldmfd sp!, { r4-r6, pc }
+EPILOGUE(mpn_addmul_1)
diff --git a/gmp/mpn/arm/aors_n.asm b/gmp/mpn/arm/aors_n.asm
deleted file mode 100644
index fdad9f7ba6..0000000000
--- a/gmp/mpn/arm/aors_n.asm
+++ /dev/null
@@ -1,112 +0,0 @@
-dnl ARM mpn_add_n and mpn_sub_n
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`vp', `r2')
-define(`n', `r3')
-
-ifdef(`OPERATION_add_n', `
- define(`ADDSUB', adds)
- define(`ADDSUBC', adcs)
- define(`CLRCY', `cmn r0, #0')
- define(`SETCY', `cmp $1, #1')
- define(`RETVAL', `adc r0, n, #0')
- define(`func', mpn_add_n)
- define(`func_nc', mpn_add_nc)')
-ifdef(`OPERATION_sub_n', `
- define(`ADDSUB', subs)
- define(`ADDSUBC', sbcs)
- define(`CLRCY', `cmp r0, r0')
- define(`SETCY', `rsbs $1, $1, #0')
- define(`RETVAL', `sbc r0, r0, r0
- and r0, r0, #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)
- ldr r12, [sp, #0]
- stmfd sp!, { r8, r9, lr }
- SETCY( r12)
- b L(ent)
-EPILOGUE()
-PROLOGUE(func)
- stmfd sp!, { r8, r9, lr }
- CLRCY( r12)
-L(ent): tst n, #1
- beq L(skip1)
- ldr r12, [up], #4
- ldr lr, [vp], #4
- ADDSUBC r12, r12, lr
- str r12, [rp], #4
-L(skip1):
- tst n, #2
- beq L(skip2)
- ldmia up!, { r8, r9 }
- ldmia vp!, { r12, lr }
- ADDSUBC r8, r8, r12
- ADDSUBC r9, r9, lr
- stmia rp!, { r8, r9 }
-L(skip2):
- bics n, n, #3
- beq L(rtn)
- stmfd sp!, { r4, r5, r6, r7 }
-
-L(top): ldmia up!, { r4, r5, r6, r7 }
- ldmia vp!, { r8, r9, r12, lr }
- ADDSUBC r4, r4, r8
- sub n, n, #4
- ADDSUBC r5, r5, r9
- ADDSUBC r6, r6, r12
- ADDSUBC r7, r7, lr
- stmia rp!, { r4, r5, r6, r7 }
- teq n, #0
- bne L(top)
-
- ldmfd sp!, { r4, r5, r6, r7 }
-
-L(rtn): RETVAL
- ldmfd sp!, { r8, r9, pc }
-EPILOGUE()
diff --git a/gmp/mpn/arm/aorslsh1_n.asm b/gmp/mpn/arm/aorslsh1_n.asm
deleted file mode 100644
index 1cbd4ba1af..0000000000
--- a/gmp/mpn/arm/aorslsh1_n.asm
+++ /dev/null
@@ -1,167 +0,0 @@
-dnl ARM mpn_addlsh1_n and mpn_sublsh1_n
-
-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 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 ? ?
-
-C TODO
-C * The addlsh1_n code runs well, but is only barely faster than mpn_addmul_1.
-C The sublsh1_n code could surely be tweaked, its REVCY slows down things
-C very much. If two insns are really needed, it might help to separate them
-C for better micro-parallelism.
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`vp', `r2')
-define(`n', `r3')
-
-ifdef(`OPERATION_addlsh1_n', `
- define(`ADDSUB', adds)
- define(`ADDSUBC', adcs)
- define(`SETCY', `cmp $1, #1')
- define(`RETVAL', `adc r0, $1, #2')
- define(`SAVECY', `sbc $1, $2, #0')
- define(`RESTCY', `cmn $1, #1')
- define(`REVCY', `')
- define(`INICYR', `mov $1, #0')
- define(`r10r11', `r11')
- define(`func', mpn_addlsh1_n)
- define(`func_nc', mpn_addlsh1_nc)')
-ifdef(`OPERATION_sublsh1_n', `
- define(`ADDSUB', subs)
- define(`ADDSUBC', sbcs)
- define(`SETCY', `rsbs $1, $1, #0')
- define(`RETVAL', `adc r0, $1, #1')
- define(`SAVECY', `sbc $1, $1, $1')
- define(`RESTCY', `cmn $1, #1')
- define(`REVCY', `sbc $1, $1, $1
- cmn $1, #1')
- define(`INICYR', `mvn $1, #0')
- define(`r10r11', `r10')
- define(`func', mpn_sublsh1_n)
- define(`func_nc', mpn_sublsh1_nc)')
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
-
-ASM_START()
-PROLOGUE(func)
- push {r4-r10r11, r14}
-
-ifdef(`OPERATION_addlsh1_n', `
- mvn r11, #0
-')
- INICYR( r14)
- subs n, n, #3
- blt L(le2) C carry clear on branch path
-
- cmn r0, #0 C clear carry
- ldmia vp!, {r8, r9, r10}
- b L(mid)
-
-L(top): RESTCY( r14)
- ADDSUBC r4, r4, r8
- ADDSUBC r5, r5, r9
- ADDSUBC r6, r6, r10
- ldmia vp!, {r8, r9, r10}
- stmia rp!, {r4, r5, r6}
- REVCY(r14)
- adcs r8, r8, r8
- adcs r9, r9, r9
- adcs r10, r10, r10
- ldmia up!, {r4, r5, r6}
- SAVECY( r14, r11)
- subs n, n, #3
- blt L(exi)
- RESTCY( r12)
- ADDSUBC r4, r4, r8
- ADDSUBC r5, r5, r9
- ADDSUBC r6, r6, r10
- ldmia vp!, {r8, r9, r10}
- stmia rp!, {r4, r5, r6}
- REVCY(r12)
-L(mid): adcs r8, r8, r8
- adcs r9, r9, r9
- adcs r10, r10, r10
- ldmia up!, {r4, r5, r6}
- SAVECY( r12, r11)
- subs n, n, #3
- bge L(top)
-
- mov r7, r12 C swap alternating...
- mov r12, r14 C ...carry-save...
- mov r14, r7 C ...registers
-
-L(exi): RESTCY( r12)
- ADDSUBC r4, r4, r8
- ADDSUBC r5, r5, r9
- ADDSUBC r6, r6, r10
- stmia rp!, {r4, r5, r6}
-
- REVCY(r12)
-L(le2): tst n, #1 C n = {-1,-2,-3} map to [2], [1], [0]
- beq L(e1)
-
-L(e02): tst n, #2
- beq L(rt0)
- ldm vp, {r8, r9}
- adcs r8, r8, r8
- adcs r9, r9, r9
- ldm up, {r4, r5}
- SAVECY( r12, r11)
- RESTCY( r14)
- ADDSUBC r4, r4, r8
- ADDSUBC r5, r5, r9
- stm rp, {r4, r5}
- b L(rt1)
-
-L(e1): ldr r8, [vp]
- adcs r8, r8, r8
- ldr r4, [up]
- SAVECY( r12, r11)
- RESTCY( r14)
- ADDSUBC r4, r4, r8
- str r4, [rp]
-
-L(rt1): mov r14, r12
- REVCY(r12)
-L(rt0): RETVAL( r14)
- pop {r4-r10r11, r14}
- bx r14
-EPILOGUE()
diff --git a/gmp/mpn/arm/aorsmul_1.asm b/gmp/mpn/arm/aorsmul_1.asm
deleted file mode 100644
index b02fbb3b2a..0000000000
--- a/gmp/mpn/arm/aorsmul_1.asm
+++ /dev/null
@@ -1,135 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`n', `r2')
-define(`vl', `r3')
-define(`rl', `r12')
-define(`ul', `r6')
-define(`r', `lr')
-
-ifdef(`OPERATION_addmul_1', `
- define(`ADDSUB', adds)
- define(`ADDSUBC', adcs)
- define(`CLRRCY', `mov $1, #0
- adds r0, r0, #0')
- define(`RETVAL', `adc r0, r4, #0')
- define(`func', mpn_addmul_1)')
-ifdef(`OPERATION_submul_1', `
- define(`ADDSUB', subs)
- define(`ADDSUBC', sbcs)
- define(`CLRRCY', `subs $1, r0, r0')
- define(`RETVAL', `sbc r0, r0, r0
- sub r0, $1, r0')
- define(`func', mpn_submul_1)')
-
-MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
-
-ASM_START()
-PROLOGUE(func)
- stmfd sp!, { r4-r6, lr }
- CLRRCY( r4)
- tst n, #1
- beq L(skip1)
- ldr ul, [up], #4
- ldr rl, [rp, #0]
- umull r5, r4, ul, vl
- ADDSUB r, rl, r5
- str r, [rp], #4
-L(skip1):
- tst n, #2
- beq L(skip2)
- ldr ul, [up], #4
- ldr rl, [rp, #0]
- mov r5, #0
- umlal r4, r5, ul, vl
- ldr ul, [up], #4
- ADDSUBC r, rl, r4
- ldr rl, [rp, #4]
- mov r4, #0
- umlal r5, r4, ul, vl
- str r, [rp], #4
- ADDSUBC r, rl, r5
- str r, [rp], #4
-L(skip2):
- bics n, n, #3
- beq L(rtn)
-
- ldr ul, [up], #4
- ldr rl, [rp, #0]
- mov r5, #0
- umlal r4, r5, ul, vl
- b L(in)
-
-L(top): ldr ul, [up], #4
- ADDSUBC r, rl, r5
- ldr rl, [rp, #4]
- mov r5, #0
- umlal r4, r5, ul, vl
- str r, [rp], #4
-L(in): ldr ul, [up], #4
- ADDSUBC r, rl, r4
- ldr rl, [rp, #4]
- mov r4, #0
- umlal r5, r4, ul, vl
- str r, [rp], #4
- ldr ul, [up], #4
- ADDSUBC r, rl, r5
- ldr rl, [rp, #4]
- mov r5, #0
- umlal r4, r5, ul, vl
- str r, [rp], #4
- ldr ul, [up], #4
- ADDSUBC r, rl, r4
- ldr rl, [rp, #4]
- mov r4, #0
- umlal r5, r4, ul, vl
- sub n, n, #4
- tst n, n
- str r, [rp], #4
- bne L(top)
-
- ADDSUBC r, rl, r5
- str r, [rp]
-
-L(rtn): RETVAL( r4)
- ldmfd sp!, { r4-r6, pc }
-EPILOGUE()
diff --git a/gmp/mpn/arm/arm-defs.m4 b/gmp/mpn/arm/arm-defs.m4
index 6ca964a245..9d169e822d 100644
--- a/gmp/mpn/arm/arm-defs.m4
+++ b/gmp/mpn/arm/arm-defs.m4
@@ -2,39 +2,28 @@ divert(-1)
dnl m4 macros for ARM assembler.
-dnl Copyright 2001, 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 Copyright 2001 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Standard commenting is with @, the default m4 # is for constants and we
dnl don't want to disable macro expansions in or after them.
-changecom(@&*$)
+changecom(@)
dnl APCS register names.
@@ -58,34 +47,4 @@ deflit(sp,r13)
deflit(lr,r14)
deflit(pc,r15)
-
-define(`lea_list', `')
-define(`lea_num',0)
-
-dnl LEA(reg,gmp_symbol)
-dnl
-dnl Load the address of gmp_symbol into a register. The gmp_symbol must be
-dnl either local or protected/hidden, since we assume it has a fixed distance
-dnl from the point of use.
-
-define(`LEA',`dnl
-ldr $1, L(ptr`'lea_num)
-ifdef(`PIC',dnl
-`dnl
-L(bas`'lea_num):dnl
- add $1, $1, pc`'dnl
- m4append(`lea_list',`
-L(ptr'lea_num`): .word GSYM_PREFIX`'$2-L(bas'lea_num`)-8')
- define(`lea_num', eval(lea_num+1))dnl
-',`dnl
- m4append(`lea_list',`
-L(ptr'lea_num`): .word GSYM_PREFIX`'$2')
- define(`lea_num', eval(lea_num+1))dnl
-')dnl
-')
-
-define(`EPILOGUE_cpu',
-`lea_list
- SIZE(`$1',.-`$1')')
-
divert
diff --git a/gmp/mpn/arm/bdiv_dbm1c.asm b/gmp/mpn/arm/bdiv_dbm1c.asm
deleted file mode 100644
index ec3de50e8e..0000000000
--- a/gmp/mpn/arm/bdiv_dbm1c.asm
+++ /dev/null
@@ -1,113 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-
-C TODO
-C * Try using umlal or umaal.
-C * Try using ldm/stm.
-
-define(`qp', `r0')
-define(`up', `r1')
-define(`n', `r2')
-define(`bd', `r3')
-define(`cy', `sp,#0')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_bdiv_dbm1c)
- push {r4, r5, r6, r7, r8}
- ldr r4, [up], #4
- ldr r5, [sp, #20]
- ands r12, n, #3
- beq L(fi0)
- cmp r12, #2
- bcc L(fi1)
- beq L(fi2)
-
-L(fi3): umull r8, r12, r4, bd
- ldr r4, [up], #4
- b L(lo3)
-
-L(fi0): umull r6, r7, r4, bd
- ldr r4, [up], #4
- b L(lo0)
-
-L(fi1): subs n, n, #1
- umull r8, r12, r4, bd
- bls L(wd1)
- ldr r4, [up], #4
- b L(lo1)
-
-L(fi2): umull r6, r7, r4, bd
- ldr r4, [up], #4
- b L(lo2)
-
-L(top): ldr r4, [up], #4
- subs r5, r5, r6
- str r5, [qp], #4
- sbc r5, r5, r7
-L(lo1): umull r6, r7, r4, bd
- ldr r4, [up], #4
- subs r5, r5, r8
- str r5, [qp], #4
- sbc r5, r5, r12
-L(lo0): umull r8, r12, r4, bd
- ldr r4, [up], #4
- subs r5, r5, r6
- str r5, [qp], #4
- sbc r5, r5, r7
-L(lo3): umull r6, r7, r4, bd
- ldr r4, [up], #4
- subs r5, r5, r8
- str r5, [qp], #4
- sbc r5, r5, r12
-L(lo2): subs n, n, #4
- umull r8, r12, r4, bd
- bhi L(top)
-
-L(wd2): subs r5, r5, r6
- str r5, [qp], #4
- sbc r5, r5, r7
-L(wd1): subs r5, r5, r8
- str r5, [qp]
- sbc r0, r5, r12
- pop {r4, r5, r6, r7, r8}
- bx lr
-EPILOGUE()
diff --git a/gmp/mpn/arm/cnd_aors_n.asm b/gmp/mpn/arm/cnd_aors_n.asm
deleted file mode 100644
index e8eb60983a..0000000000
--- a/gmp/mpn/arm/cnd_aors_n.asm
+++ /dev/null
@@ -1,134 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/com.asm b/gmp/mpn/arm/com.asm
deleted file mode 100644
index 42f8e3cbbe..0000000000
--- a/gmp/mpn/arm/com.asm
+++ /dev/null
@@ -1,75 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 1.75
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`n', `r2')
-
-ASM_START()
-PROLOGUE(mpn_com)
- tst n, #1
- beq L(skip1)
- ldr r3, [up], #4
- mvn r3, r3
- str r3, [rp], #4
-L(skip1):
- tst n, #2
- beq L(skip2)
- ldmia up!, { r3, r12 } C load 2 limbs
- mvn r3, r3
- mvn r12, r12
- stmia rp!, { r3, r12 } C store 2 limbs
-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
- subs n, n, #4
- mvn r3, r3
- mvn r8, r8
- mvn r9, r9
- mvn r12, r12
- stmia rp!, { r3, r8, r9, r12 } C store 4 limbs
- bne L(top)
-
- ldmfd sp!, { r7, r8, r9 } C restore regs from stack
-L(rtn): bx lr
-EPILOGUE()
diff --git a/gmp/mpn/arm/copyd.asm b/gmp/mpn/arm/copyd.asm
index 3ea2035099..718b762b91 100644
--- a/gmp/mpn/arm/copyd.asm
+++ b/gmp/mpn/arm/copyd.asm
@@ -1,59 +1,37 @@
dnl ARM mpn_copyd.
-dnl Contributed to the GNU project by Robert Harley and Torbjörn Granlund.
-
-dnl Copyright 2003, 2012, 2013 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 1.25-1.5
-C Cortex-A15 1.25
+C This runs at 3 cycles/limb in the StrongARM.
-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')
+define(`n',`r2')
-define(`rp', `r0')
-define(`up', `r1')
-define(`n', `r2')
ASM_START()
PROLOGUE(mpn_copyd)
mov r12, n, lsl #2
sub r12, r12, #4
- add rp, rp, r12
- add up, up, r12
+ add rp, rp, r12 C make rp point at last limb
+ add up, up, r12 C make up point at last limb
tst n, #1
beq L(skip1)
@@ -62,23 +40,19 @@ PROLOGUE(mpn_copyd)
L(skip1):
tst n, #2
beq L(skip2)
- ldmda up!, { r3,r12 }
- stmda rp!, { r3,r12 }
+ ldmda up!, { r3, r12 } C load 2 limbs
+ stmda rp!, { r3, r12 } C store 2 limbs
L(skip2):
bics n, n, #3
- beq L(rtn)
-
- push { r4-r5 }
+ beq L(return)
+ stmfd sp!, { r7, r8, r9 } C save regs on stack
+L(loop):
+ ldmda up!, { r3, r8, r9, r12 } C load 4 limbs
+ ldr r7, [rp, #-12] C cache allocate
subs n, n, #4
- 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)
-
-L(end): stmda rp, { r3,r4,r5,r12 }
- pop { r4-r5 }
-L(rtn): bx lr
-EPILOGUE()
+ stmda rp!, { r3, r8, r9, r12 } C store 4 limbs
+ bne L(loop)
+ ldmfd sp!, { r7, r8, r9 } C restore regs from stack
+L(return):
+ mov pc, lr
+EPILOGUE(mpn_copyd)
diff --git a/gmp/mpn/arm/copyi.asm b/gmp/mpn/arm/copyi.asm
index fa454702c1..5ee93acd4c 100644
--- a/gmp/mpn/arm/copyi.asm
+++ b/gmp/mpn/arm/copyi.asm
@@ -1,52 +1,30 @@
dnl ARM mpn_copyi.
-dnl Contributed to the GNU project by Robert Harley and Torbjörn Granlund.
-
-dnl Copyright 2003, 2012, 2013 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 1.25-1.5
-C Cortex-A15 1.25
+C This runs at 3 cycles/limb in the StrongARM.
-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')
+define(`n',`r2')
-define(`rp', `r0')
-define(`up', `r1')
-define(`n', `r2')
ASM_START()
PROLOGUE(mpn_copyi)
@@ -57,23 +35,19 @@ PROLOGUE(mpn_copyi)
L(skip1):
tst n, #2
beq L(skip2)
- ldmia up!, { r3,r12 }
- stmia rp!, { r3,r12 }
+ ldmia up!, { r3, r12 } C load 2 limbs
+ stmia rp!, { r3, r12 } C store 2 limbs
L(skip2):
bics n, n, #3
- beq L(rtn)
-
- push { r4-r5 }
+ beq L(return)
+ stmfd sp!, { r7, r8, r9 } C save regs on stack
+L(loop):
+ ldmia up!, { r3, r8, r9, r12 } C load 4 limbs
+ ldr r7, [rp, #12] C cache allocate
subs n, n, #4
- 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)
-
-L(end): stm rp, { r3,r4,r5,r12 }
- pop { r4-r5 }
-L(rtn): bx lr
-EPILOGUE()
+ stmia rp!, { r3, r8, r9, r12 } C store 4 limbs
+ bne L(loop)
+ ldmfd sp!, { r7, r8, r9 } C restore regs from stack
+L(return):
+ mov pc, lr
+EPILOGUE(mpn_copyi)
diff --git a/gmp/mpn/arm/dive_1.asm b/gmp/mpn/arm/dive_1.asm
deleted file mode 100644
index a695e47c77..0000000000
--- a/gmp/mpn/arm/dive_1.asm
+++ /dev/null
@@ -1,151 +0,0 @@
-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
diff --git a/gmp/mpn/arm/gmp-mparam.h b/gmp/mpn/arm/gmp-mparam.h
index 87eec3a149..7afb06ac89 100644
--- a/gmp/mpn/arm/gmp-mparam.h
+++ b/gmp/mpn/arm/gmp-mparam.h
@@ -1,127 +1,75 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2009, 2010 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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
-
-/* 1193MHz ARM (gcc55.fsffrance.org) */
-
-#define DIVREM_1_NORM_THRESHOLD 0 /* preinv always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 56
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 11
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 71
-#define USE_PREINV_DIVREM_1 1 /* preinv always */
-#define DIVREM_2_THRESHOLD 0 /* preinv always */
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 41
-
-#define MUL_TOOM22_THRESHOLD 36
-#define MUL_TOOM33_THRESHOLD 125
-#define MUL_TOOM44_THRESHOLD 193
-#define MUL_TOOM6H_THRESHOLD 303
-#define MUL_TOOM8H_THRESHOLD 418
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 125
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 176
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 114
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 129
-
-#define SQR_BASECASE_THRESHOLD 12
-#define SQR_TOOM2_THRESHOLD 78
-#define SQR_TOOM3_THRESHOLD 137
-#define SQR_TOOM4_THRESHOLD 212
-#define SQR_TOOM6_THRESHOLD 306
-#define SQR_TOOM8_THRESHOLD 422
-
-#define MULMOD_BNM1_THRESHOLD 20
-#define SQRMOD_BNM1_THRESHOLD 26
-
-#define MUL_FFT_MODF_THRESHOLD 436 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 436, 5}, { 27, 6}, { 28, 7}, { 15, 6}, \
- { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 256, 9}, { 512,10}, { 1024,11}, { 2048,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 28
-#define MUL_FFT_THRESHOLD 5760
-
-#define SQR_FFT_MODF_THRESHOLD 404 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 404, 5}, { 13, 4}, { 27, 5}, { 27, 6}, \
- { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
- { 35, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
- { 27, 9}, { 15, 8}, { 39, 9}, { 512,10}, \
- { 1024,11}, { 2048,12}, { 4096,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 26
-#define SQR_FFT_THRESHOLD 3776
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 137
-#define MULLO_MUL_N_THRESHOLD 11479
-
-#define DC_DIV_QR_THRESHOLD 150
-#define DC_DIVAPPR_Q_THRESHOLD 494
-#define DC_BDIV_QR_THRESHOLD 148
-#define DC_BDIV_Q_THRESHOLD 345
-
-#define INV_MULMOD_BNM1_THRESHOLD 70
-#define INV_NEWTON_THRESHOLD 474
-#define INV_APPR_THRESHOLD 478
-
-#define BINV_NEWTON_THRESHOLD 542
-#define REDC_1_TO_REDC_N_THRESHOLD 117
-
-#define MU_DIV_QR_THRESHOLD 2089
-#define MU_DIVAPPR_Q_THRESHOLD 2172
-#define MUPI_DIV_QR_THRESHOLD 225
-#define MU_BDIV_QR_THRESHOLD 1528
-#define MU_BDIV_Q_THRESHOLD 2089
-
-#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 197
-#define GCD_DC_THRESHOLD 902
-#define GCDEXT_DC_THRESHOLD 650
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 20
-#define GET_STR_PRECOMPUTE_THRESHOLD 39
-#define SET_STR_DC_THRESHOLD 1045
-#define SET_STR_PRECOMPUTE_THRESHOLD 2147
+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 BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
+
+/* 593MHz ARM (gcc50.fsffrance.org) */
+
+/* Generated by tuneup.c, 2009-03-05, gcc 4.3 */
+
+#define MUL_KARATSUBA_THRESHOLD 34
+#define MUL_TOOM3_THRESHOLD 125
+#define MUL_TOOM44_THRESHOLD 184
+
+#define SQR_BASECASE_THRESHOLD 15
+#define SQR_KARATSUBA_THRESHOLD 82
+#define SQR_TOOM3_THRESHOLD 147
+#define SQR_TOOM4_THRESHOLD 212
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 128
+#define MULLOW_MUL_N_THRESHOLD 1095
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* preinv always */
+#define DIV_DC_THRESHOLD 130
+#define POWM_THRESHOLD 200
+
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD_THRESHOLD 110
+#define GCD_DC_THRESHOLD 734
+#define GCDEXT_DC_THRESHOLD 748
+#define JACOBI_BASE_METHOD 2
+
+#define DIVREM_1_NORM_THRESHOLD 0 /* preinv always */
+#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 10
+#define MOD_1_2_THRESHOLD 996
+#define MOD_1_4_THRESHOLD 997
+#define USE_PREINV_DIVREM_1 1 /* preinv always */
+#define USE_PREINV_MOD_1 1 /* preinv always */
+#define DIVREM_2_THRESHOLD 0 /* preinv always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 18
+#define GET_STR_PRECOMPUTE_THRESHOLD 35
+#define SET_STR_DC_THRESHOLD 321
+#define SET_STR_PRECOMPUTE_THRESHOLD 1057
+
+#define MUL_FFT_TABLE { 400, 928, 1920, 4608, 14336, 40960, 0 }
+#define MUL_FFT_MODF_THRESHOLD 416
+#define MUL_FFT_THRESHOLD 5888
+
+#define SQR_FFT_TABLE { 432, 928, 1664, 4608, 10240, 40960, 0 }
+#define SQR_FFT_MODF_THRESHOLD 376
+#define SQR_FFT_THRESHOLD 4352
diff --git a/gmp/mpn/arm/invert_limb.asm b/gmp/mpn/arm/invert_limb.asm
index d4c3afe2da..39d3bb2e14 100644
--- a/gmp/mpn/arm/invert_limb.asm
+++ b/gmp/mpn/arm/invert_limb.asm
@@ -1,93 +1,95 @@
dnl ARM mpn_invert_limb -- Invert a normalized limb.
-dnl Copyright 2001, 2009, 2011, 2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
-ASM_START()
+C INPUT PARAMETERS
+define(`d',`r0') C number to be inverted
+
+
PROLOGUE(mpn_invert_limb)
- LEA( r2, approx_tab-512)
- mov r3, r0, lsr #23
- mov r3, r3, asl #1
- ldrh r3, [r3, r2]
- mov r1, r3, asl #17
- mul r12, r3, r3
- umull r3, r2, r12, r0
- sub r1, r1, r2, asl #1
- umull r3, r2, r1, r1
- umull r12, r3, r0, r3
- umull r2, r12, r0, r2
- adds r2, r2, r3
- adc r12, r12, #0
- rsb r1, r12, r1
- mvn r2, r2, lsr #30
- add r2, r2, r1, asl #2
- umull r12, r3, r0, r2
- adds r1, r12, r0
- adc r3, r3, r0
- rsb r0, r3, r2
- bx lr
-EPILOGUE()
+ stmfd sp!, {r4, lr}
+ mov r3, d, lsr #23
+ sub r3, r3, #256
+ add r2, pc, #invtab-.-8
+ mov r3, r3, lsl #1
+ ldrh r1, [r2, r3] C get initial approximation from table
+ mov r2, r1, lsl #6 C start iteration 1
+ mul ip, r2, r2
+ umull lr, r4, ip, d
+ mov r2, r4, lsl #1
+ rsb r2, r2, r1, lsl #23 C iteration 1 complete
+ umull ip, r3, r2, r2 C start iteration 2
+ umull lr, r4, r3, d
+ umull r3, r1, ip, d
+ adds lr, lr, r1
+ addcs r4, r4, #1
+ mov r3, lr, lsr #30
+ orr r4, r3, r4, lsl #2
+ mov lr, lr, lsl #2
+ cmn lr, #1
+ rsc r2, r4, r2, lsl #2 C iteration 2 complete
+ umull ip, r1, d, r2 C start adjustment step
+ add r1, r1, d
+ cmn r1, #1
+ beq L(1)
+ adds ip, ip, d
+ adc r1, r1, #0
+ add r2, r2, #1
+L(1):
+ adds r3, ip, d
+ adcs r1, r1, #0
+ moveq r0, r2
+ addne r0, r2, #1
+ ldmfd sp!, {r4, pc}
- .section .rodata
- ALIGN(2)
-approx_tab:
- .short 0xffc0,0xfec0,0xfdc0,0xfcc0,0xfbc0,0xfac0,0xfa00,0xf900
- .short 0xf800,0xf700,0xf640,0xf540,0xf440,0xf380,0xf280,0xf180
- .short 0xf0c0,0xefc0,0xef00,0xee00,0xed40,0xec40,0xeb80,0xeac0
- .short 0xe9c0,0xe900,0xe840,0xe740,0xe680,0xe5c0,0xe500,0xe400
- .short 0xe340,0xe280,0xe1c0,0xe100,0xe040,0xdf80,0xdec0,0xde00
- .short 0xdd40,0xdc80,0xdbc0,0xdb00,0xda40,0xd980,0xd8c0,0xd800
- .short 0xd740,0xd680,0xd600,0xd540,0xd480,0xd3c0,0xd340,0xd280
- .short 0xd1c0,0xd140,0xd080,0xcfc0,0xcf40,0xce80,0xcdc0,0xcd40
- .short 0xcc80,0xcc00,0xcb40,0xcac0,0xca00,0xc980,0xc8c0,0xc840
- .short 0xc780,0xc700,0xc640,0xc5c0,0xc540,0xc480,0xc400,0xc380
- .short 0xc2c0,0xc240,0xc1c0,0xc100,0xc080,0xc000,0xbf80,0xbec0
- .short 0xbe40,0xbdc0,0xbd40,0xbc80,0xbc00,0xbb80,0xbb00,0xba80
- .short 0xba00,0xb980,0xb900,0xb840,0xb7c0,0xb740,0xb6c0,0xb640
- .short 0xb5c0,0xb540,0xb4c0,0xb440,0xb3c0,0xb340,0xb2c0,0xb240
- .short 0xb1c0,0xb140,0xb0c0,0xb080,0xb000,0xaf80,0xaf00,0xae80
- .short 0xae00,0xad80,0xad40,0xacc0,0xac40,0xabc0,0xab40,0xaac0
- .short 0xaa80,0xaa00,0xa980,0xa900,0xa8c0,0xa840,0xa7c0,0xa740
- .short 0xa700,0xa680,0xa600,0xa5c0,0xa540,0xa4c0,0xa480,0xa400
- .short 0xa380,0xa340,0xa2c0,0xa240,0xa200,0xa180,0xa140,0xa0c0
- .short 0xa080,0xa000,0x9f80,0x9f40,0x9ec0,0x9e80,0x9e00,0x9dc0
- .short 0x9d40,0x9d00,0x9c80,0x9c40,0x9bc0,0x9b80,0x9b00,0x9ac0
- .short 0x9a40,0x9a00,0x9980,0x9940,0x98c0,0x9880,0x9840,0x97c0
- .short 0x9780,0x9700,0x96c0,0x9680,0x9600,0x95c0,0x9580,0x9500
- .short 0x94c0,0x9440,0x9400,0x93c0,0x9340,0x9300,0x92c0,0x9240
- .short 0x9200,0x91c0,0x9180,0x9100,0x90c0,0x9080,0x9000,0x8fc0
- .short 0x8f80,0x8f40,0x8ec0,0x8e80,0x8e40,0x8e00,0x8d80,0x8d40
- .short 0x8d00,0x8cc0,0x8c80,0x8c00,0x8bc0,0x8b80,0x8b40,0x8b00
- .short 0x8a80,0x8a40,0x8a00,0x89c0,0x8980,0x8940,0x88c0,0x8880
- .short 0x8840,0x8800,0x87c0,0x8780,0x8740,0x8700,0x8680,0x8640
- .short 0x8600,0x85c0,0x8580,0x8540,0x8500,0x84c0,0x8480,0x8440
- .short 0x8400,0x8380,0x8340,0x8300,0x82c0,0x8280,0x8240,0x8200
- .short 0x81c0,0x8180,0x8140,0x8100,0x80c0,0x8080,0x8040,0x8000
-ASM_END()
+invtab:
+ .short 1023,1020,1016,1012,1008,1004,1000,996
+ .short 992,989,985,981,978,974,970,967
+ .short 963,960,956,953,949,946,942,939
+ .short 936,932,929,926,923,919,916,913
+ .short 910,907,903,900,897,894,891,888
+ .short 885,882,879,876,873,870,868,865
+ .short 862,859,856,853,851,848,845,842
+ .short 840,837,834,832,829,826,824,821
+ .short 819,816,814,811,809,806,804,801
+ .short 799,796,794,791,789,787,784,782
+ .short 780,777,775,773,771,768,766,764
+ .short 762,759,757,755,753,751,748,746
+ .short 744,742,740,738,736,734,732,730
+ .short 728,726,724,722,720,718,716,714
+ .short 712,710,708,706,704,702,700,699
+ .short 697,695,693,691,689,688,686,684
+ .short 682,680,679,677,675,673,672,670
+ .short 668,667,665,663,661,660,658,657
+ .short 655,653,652,650,648,647,645,644
+ .short 642,640,639,637,636,634,633,631
+ .short 630,628,627,625,624,622,621,619
+ .short 618,616,615,613,612,611,609,608
+ .short 606,605,604,602,601,599,598,597
+ .short 595,594,593,591,590,589,587,586
+ .short 585,583,582,581,579,578,577,576
+ .short 574,573,572,571,569,568,567,566
+ .short 564,563,562,561,560,558,557,556
+ .short 555,554,553,551,550,549,548,547
+ .short 546,544,543,542,541,540,539,538
+ .short 537,536,534,533,532,531,530,529
+ .short 528,527,526,525,524,523,522,521
+ .short 520,519,518,517,516,515,514,513
+EPILOGUE(mpn_invert_limb)
diff --git a/gmp/mpn/arm/logops_n.asm b/gmp/mpn/arm/logops_n.asm
deleted file mode 100644
index 5a61683fc2..0000000000
--- a/gmp/mpn/arm/logops_n.asm
+++ /dev/null
@@ -1,139 +0,0 @@
-dnl ARM mpn_and_n, mpn_andn_n. mpn_nand_n, etc.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 2.5-2.72 2.75-3
-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.
-C * Debug popping issue, see comment below.
-
-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 { r8, r9, r10 }
- tst n, #1
- beq L(skip1)
- ldr r10, [vp], #4
- ldr r12, [up], #4
- LOGOP( r12, r12, r10)
- POSTOP( r12)
- str r12, [rp], #4
-L(skip1):
- tst n, #2
- beq L(skip2)
- ldmia vp!, { r10, r12 }
- ldmia up!, { r8, r9 }
- LOGOP( r8, r8, r10)
- LOGOP( r9, r9, r12)
- POSTOP( r8)
- POSTOP( r9)
- stmia rp!, { r8, r9 }
-L(skip2):
- bics n, n, #3
- beq L(rtn)
- push { r4, r5, r6, r7 }
-
- ldmia vp!, { r8, r9, r10, r12 }
- b L(mid)
-
-L(top): ldmia vp!, { r8, r9, r10, r12 }
- POSTOP( r4)
- POSTOP( r5)
- POSTOP( r6)
- POSTOP( r7)
- stmia rp!, { r4, r5, r6, r7 }
-L(mid): sub n, n, #4
- ldmia up!, { r4, r5, r6, r7 }
- teq n, #0
- LOGOP( r4, r4, r8)
- LOGOP( r5, r5, r9)
- LOGOP( r6, r6, r10)
- LOGOP( r7, r7, r12)
- bne L(top)
-
- POSTOP( r4)
- POSTOP( r5)
- POSTOP( r6)
- POSTOP( r7)
- stmia rp!, { r4, r5, r6, r7 }
-
- pop { r4, r5, r6, r7 } C popping r8-r10 here strangely fails
-
-L(rtn): pop { r8, r9, r10 }
- bx r14
-EPILOGUE()
diff --git a/gmp/mpn/arm/lshift.asm b/gmp/mpn/arm/lshift.asm
deleted file mode 100644
index 9f777eb4dd..0000000000
--- a/gmp/mpn/arm/lshift.asm
+++ /dev/null
@@ -1,88 +0,0 @@
-dnl ARM mpn_lshift.
-
-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 3.5
-C Cortex-A15 ?
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`n', `r2')
-define(`cnt', `r3')
-define(`tnc', `r12')
-
-ASM_START()
-PROLOGUE(mpn_lshift)
- add up, up, n, lsl #2
- push {r4, r6, r7, r8}
- ldr r4, [up, #-4]!
- add rp, rp, n, lsl #2
- rsb tnc, cnt, #32
-
- mov r7, r4, lsl cnt
- tst n, #1
- beq L(evn) C n even
-
-L(odd): subs n, n, #2
- bcc L(1) C n = 1
- ldr r8, [up, #-4]!
- b L(mid)
-
-L(evn): ldr r6, [up, #-4]!
- subs n, n, #2
- beq L(end)
-
-L(top): ldr r8, [up, #-4]!
- orr r7, r7, r6, lsr tnc
- str r7, [rp, #-4]!
- mov r7, r6, lsl cnt
-L(mid): ldr r6, [up, #-4]!
- orr r7, r7, r8, lsr tnc
- str r7, [rp, #-4]!
- mov r7, r8, lsl cnt
- subs n, n, #2
- bgt L(top)
-
-L(end): orr r7, r7, r6, lsr tnc
- str r7, [rp, #-4]!
- mov r7, r6, lsl cnt
-L(1): str r7, [rp, #-4]
- mov r0, r4, lsr tnc
- pop {r4, r6, r7, r8}
- bx r14
-EPILOGUE()
diff --git a/gmp/mpn/arm/lshiftc.asm b/gmp/mpn/arm/lshiftc.asm
deleted file mode 100644
index 5f3d6e3f5b..0000000000
--- a/gmp/mpn/arm/lshiftc.asm
+++ /dev/null
@@ -1,95 +0,0 @@
-dnl ARM mpn_lshiftc.
-
-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 4.0
-C Cortex-A15 ?
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`n', `r2')
-define(`cnt', `r3')
-define(`tnc', `r12')
-
-ASM_START()
-PROLOGUE(mpn_lshiftc)
- add up, up, n, lsl #2
- push {r4, r6, r7, r8}
- ldr r4, [up, #-4]!
- add rp, rp, n, lsl #2
- rsb tnc, cnt, #32
- mvn r6, r4
-
- mov r7, r6, lsl cnt
- tst n, #1
- beq L(evn) C n even
-
-L(odd): subs n, n, #2
- bcc L(1) C n = 1
- ldr r8, [up, #-4]!
- mvn r8, r8
- b L(mid)
-
-L(evn): ldr r6, [up, #-4]!
- mvn r6, r6
- subs n, n, #2
- beq L(end)
-
-L(top): ldr r8, [up, #-4]!
- orr r7, r7, r6, lsr tnc
- str r7, [rp, #-4]!
- mvn r8, r8
- mov r7, r6, lsl cnt
-L(mid): ldr r6, [up, #-4]!
- orr r7, r7, r8, lsr tnc
- str r7, [rp, #-4]!
- mvn r6, r6
- mov r7, r8, lsl cnt
- subs n, n, #2
- bgt L(top)
-
-L(end): orr r7, r7, r6, lsr tnc
- str r7, [rp, #-4]!
- mov r7, r6, lsl cnt
-L(1): 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/gmp/mpn/arm/mod_34lsub1.asm b/gmp/mpn/arm/mod_34lsub1.asm
deleted file mode 100644
index ba3c06d8db..0000000000
--- a/gmp/mpn/arm/mod_34lsub1.asm
+++ /dev/null
@@ -1,121 +0,0 @@
-dnl ARM mpn_mod_34lsub1 -- remainder modulo 2^24-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 1.33
-C Cortex-A15 1.33
-
-define(`ap', r0)
-define(`n', r1)
-
-C mp_limb_t mpn_mod_34lsub1 (mp_srcptr up, mp_size_t n)
-
-C TODO
-C * Write cleverer summation code.
-C * Consider loading 6 64-bit aligned registers at a time, to approach 1 c/l.
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_mod_34lsub1)
- push { r4, r5, r6, r7 }
-
- subs n, n, #3
- mov r7, #0
- blt L(le2) C n <= 2
-
- ldmia ap!, { r2, r3, r12 }
- subs n, n, #3
- blt L(sum) C n <= 5
- cmn r0, #0 C clear carry
- sub n, n, #3
- b L(mid)
-
-L(top): adcs r2, r2, r4
- adcs r3, r3, r5
- adcs r12, r12, r6
-L(mid): ldmia ap!, { r4, r5, r6 }
- tst n, n
- sub n, n, #3
- bpl L(top)
-
- add n, n, #3
-
- adcs r2, r2, r4
- adcs r3, r3, r5
- adcs r12, r12, r6
- movcs r7, #1 C r7 <= 1
-
-L(sum): cmn n, #2
- movlo r4, #0
- ldrhs r4, [ap], #4
- movls r5, #0
- ldrhi r5, [ap], #4
-
- adds r2, r2, r4
- adcs r3, r3, r5
- adcs r12, r12, #0
- adc r7, r7, #0 C r7 <= 2
-
-L(sum2):
- bic r0, r2, #0xff000000
- add r0, r0, r2, lsr #24
- add r0, r0, r7
-
- mov r7, r3, lsl #8
- bic r1, r7, #0xff000000
- add r0, r0, r1
- add r0, r0, r3, lsr #16
-
- mov r7, r12, lsl #16
- bic r1, r7, #0xff000000
- add r0, r0, r1
- add r0, r0, r12, lsr #8
-
- pop { r4, r5, r6, r7 }
- bx lr
-
-L(le2): cmn n, #1
- bne L(1)
- ldmia ap!, { r2, r3 }
- mov r12, #0
- b L(sum2)
-L(1): ldr r2, [ap]
- bic r0, r2, #0xff000000
- add r0, r0, r2, lsr #24
- pop { r4, r5, r6, r7 }
- bx lr
-EPILOGUE()
diff --git a/gmp/mpn/arm/mode1o.asm b/gmp/mpn/arm/mode1o.asm
deleted file mode 100644
index 5e0f78fc8f..0000000000
--- a/gmp/mpn/arm/mode1o.asm
+++ /dev/null
@@ -1,92 +0,0 @@
-dnl ARM 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 10
-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')
-define(`d', `r2')
-define(`cy', `r3')
-
- .protected binvert_limb_table
-ASM_START()
-PROLOGUE(mpn_modexact_1c_odd)
- stmfd sp!, {r4, r5}
-
- LEA( r4, binvert_limb_table)
-
- ldr r5, [up], #4 C up[0]
-
- and r12, d, #254
- ldrb r4, [r4, r12, lsr #1]
- mul 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 C set carry as side-effect
- beq L(end)
-
-L(top): sbcs cy, r5, cy
- ldr r5, [up], #4
- sub n, n, #1
- mul r12, r4, cy
- tst n, n
- umull r12, cy, d, r12
- bne L(top)
-
-L(end): sbcs cy, r5, cy
- mul r12, r4, cy
- umull r12, r0, d, r12
- addcc r0, r0, #1
-
- ldmfd sp!, {r4, r5}
- bx r14
-EPILOGUE()
diff --git a/gmp/mpn/arm/mul_1.asm b/gmp/mpn/arm/mul_1.asm
index f7bc1bc386..e867351881 100644
--- a/gmp/mpn/arm/mul_1.asm
+++ b/gmp/mpn/arm/mul_1.asm
@@ -2,43 +2,28 @@ dnl ARM mpn_mul_1 -- Multiply a limb vector with a limb and store the result
dnl in a second limb vector.
dnl Contributed by Robert Harley.
-dnl Copyright 1998, 2000, 2001, 2003, 2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 6-8
-C XScale ?
-C Cortex-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 4.75
-C Cortex-A15 ?
+C cycles/limb
+C StrongARM: 6-8 (dependent on vl value)
+C XScale: ?-?
C We should rewrite this along the lines of addmul_1.asm. That should save a
C cycle on StrongARM, and several cycles on XScale.
@@ -69,10 +54,10 @@ L(skip1):
stmia rp!, { r8, r9 }
L(skip2):
bics n, n, #3
- beq L(rtn)
+ beq L(return)
stmfd sp!, { r6, r7 }
-
-L(top): mov r6, r12
+L(loop):
+ mov r6, r12
ldmia up!, { r8, r9, r12, lr }
ldr r7, [rp, #12] C cache allocate
mov r7, #0
@@ -85,10 +70,9 @@ L(top): mov r6, r12
umlal r9, r12, lr, vl
subs n, n, #4
stmia rp!, { r6, r7, r8, r9 }
- bne L(top)
-
+ bne L(loop)
ldmfd sp!, { r6, r7 }
-
-L(rtn): mov r0, r12
+L(return):
+ mov r0, r12
ldmfd sp!, { r8, r9, pc }
-EPILOGUE()
+EPILOGUE(mpn_mul_1)
diff --git a/gmp/mpn/arm/neon/README b/gmp/mpn/arm/neon/README
deleted file mode 100644
index 79e3b48ee6..0000000000
--- a/gmp/mpn/arm/neon/README
+++ /dev/null
@@ -1,2 +0,0 @@
-This directory contains Neon code which runs and is efficient on all
-ARM CPUs which support Neon.
diff --git a/gmp/mpn/arm/neon/hamdist.asm b/gmp/mpn/arm/neon/hamdist.asm
deleted file mode 100644
index 232089647d..0000000000
--- a/gmp/mpn/arm/neon/hamdist.asm
+++ /dev/null
@@ -1,194 +0,0 @@
-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/gmp/mpn/arm/neon/lorrshift.asm b/gmp/mpn/arm/neon/lorrshift.asm
deleted file mode 100644
index 3d6253fd49..0000000000
--- a/gmp/mpn/arm/neon/lorrshift.asm
+++ /dev/null
@@ -1,279 +0,0 @@
-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/gmp/mpn/arm/neon/lshiftc.asm b/gmp/mpn/arm/neon/lshiftc.asm
deleted file mode 100644
index 9e4096256d..0000000000
--- a/gmp/mpn/arm/neon/lshiftc.asm
+++ /dev/null
@@ -1,257 +0,0 @@
-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/gmp/mpn/arm/neon/popcount.asm b/gmp/mpn/arm/neon/popcount.asm
deleted file mode 100644
index 2f8f9afc8d..0000000000
--- a/gmp/mpn/arm/neon/popcount.asm
+++ /dev/null
@@ -1,166 +0,0 @@
-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/gmp/mpn/arm/neon/sec_tabselect.asm b/gmp/mpn/arm/neon/sec_tabselect.asm
deleted file mode 100644
index 69fceb0063..0000000000
--- a/gmp/mpn/arm/neon/sec_tabselect.asm
+++ /dev/null
@@ -1,140 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/rsh1aors_n.asm b/gmp/mpn/arm/rsh1aors_n.asm
deleted file mode 100644
index 95c1f79ad9..0000000000
--- a/gmp/mpn/arm/rsh1aors_n.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-dnl ARM mpn_rsh1add_n and mpn_rsh1sub_n.
-
-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 3.64-3.7
-C Cortex-A15 2.5
-
-C TODO
-C * Not optimised.
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`vp', `r2')
-define(`n', `r3')
-
-ifdef(`OPERATION_rsh1add_n', `
- define(`ADDSUB', adds)
- define(`ADDSUBC', adcs)
- define(`RSTCY', `cmn $1, $1')
- define(`func', mpn_rsh1add_n)
- define(`func_nc', mpn_rsh1add_nc)')
-ifdef(`OPERATION_rsh1sub_n', `
- define(`ADDSUB', subs)
- define(`ADDSUBC', sbcs)
- define(`RSTCY',
- `mvn $2, #0x80000000
- cmp $2, $1')
- define(`func', mpn_rsh1sub_n)
- define(`func_nc', mpn_rsh1sub_nc)')
-
-MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1sub_n)
-
-ASM_START()
-PROLOGUE(func)
- push {r4-r11}
- ldr r4, [up], #4
- ldr r8, [vp], #4
- ADDSUB r4, r4, r8
- movs r12, r7, rrx
- and r11, r4, #1 C return value
- subs n, n, #4
- blo L(end)
-
-L(top): ldmia up!, {r5,r6,r7}
- ldmia vp!, {r8,r9,r10}
- cmn r12, r12
- ADDSUBC r5, r5, r8
- ADDSUBC r6, r6, r9
- ADDSUBC r7, r7, r10
- 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
- bhs L(top)
-
-L(end): cmn n, #2
- bls L(e2)
- ldm up, {r5,r6}
- ldm vp, {r8,r9}
- cmn r12, r12
- ADDSUBC r5, r5, r8
- ADDSUBC r6, r6, r9
- movs r12, r6, rrx
- movs r5, r5, rrx
- movs r4, r4, rrx
- stmia rp!, {r4,r5}
- mov r4, r6
- b L(e1)
-
-L(e2): bne L(e1)
- ldr r5, [up, #0]
- ldr r8, [vp, #0]
- cmn r12, r12
- ADDSUBC r5, r5, r8
- movs r12, r5, rrx
- movs r4, r4, rrx
- str r4, [rp], #4
- mov r4, r5
-
-L(e1): RSTCY( r12, r1)
- mov r4, r4, rrx
- str r4, [rp, #0]
- mov r0, r11
- pop {r4-r11}
- bx r14
-EPILOGUE()
diff --git a/gmp/mpn/arm/rshift.asm b/gmp/mpn/arm/rshift.asm
deleted file mode 100644
index 84728d038a..0000000000
--- a/gmp/mpn/arm/rshift.asm
+++ /dev/null
@@ -1,86 +0,0 @@
-dnl ARM mpn_rshift.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 ?
-
-define(`rp', `r0')
-define(`up', `r1')
-define(`n', `r2')
-define(`cnt', `r3')
-define(`tnc', `r12')
-
-ASM_START()
-PROLOGUE(mpn_rshift)
- push {r4, r6, r7, r8}
- ldr r4, [up]
- rsb tnc, cnt, #32
-
- mov r7, r4, lsr cnt
- tst n, #1
- beq L(evn) C n even
-
-L(odd): subs n, n, #2
- bcc L(1) C n = 1
- ldr r8, [up, #4]!
- b L(mid)
-
-L(evn): ldr r6, [up, #4]!
- subs n, n, #2
- beq L(end)
-
-L(top): ldr r8, [up, #4]!
- orr r7, r7, r6, lsl tnc
- str r7, [rp], #4
- mov r7, r6, lsr cnt
-L(mid): ldr r6, [up, #4]!
- orr r7, r7, r8, lsl tnc
- str r7, [rp], #4
- mov r7, r8, lsr cnt
- subs n, n, #2
- bgt L(top)
-
-L(end): orr r7, r7, r6, lsl tnc
- str r7, [rp], #4
- 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/gmp/mpn/arm/sec_tabselect.asm b/gmp/mpn/arm/sec_tabselect.asm
deleted file mode 100644
index 8cf937a091..0000000000
--- a/gmp/mpn/arm/sec_tabselect.asm
+++ /dev/null
@@ -1,131 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/sub_n.asm b/gmp/mpn/arm/sub_n.asm
new file mode 100644
index 0000000000..7063be4f13
--- /dev/null
+++ b/gmp/mpn/arm/sub_n.asm
@@ -0,0 +1,71 @@
+dnl ARM mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
+dnl store difference in a third limb vector.
+dnl Contributed by Robert Harley.
+
+dnl Copyright 1997, 2000, 2001 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 This code runs at 5 cycles/limb.
+
+define(`rp',`r0')
+define(`up',`r1')
+define(`vp',`r2')
+define(`n',`r3')
+
+
+ASM_START()
+PROLOGUE(mpn_sub_n)
+ stmfd sp!, { r8, r9, lr }
+ subs r12, r12, r12
+ tst n, #1
+ beq L(skip1)
+ ldr r12, [up], #4
+ ldr lr, [vp], #4
+ subs r12, r12, lr
+ str r12, [rp], #4
+L(skip1):
+ tst n, #2
+ beq L(skip2)
+ ldmia up!, { r8, r9 }
+ ldmia vp!, { r12, lr }
+ sbcs r8, r8, r12
+ sbcs r9, r9, lr
+ stmia rp!, { r8, r9 }
+L(skip2):
+ bics n, n, #3
+ beq L(return)
+ stmfd sp!, { r4, r5, r6, r7 }
+L(sub_n_loop):
+ ldmia up!, { r4, r5, r6, r7 }
+ ldmia vp!, { r8, r9, r12, lr }
+ sbcs r4, r4, r8
+ ldr r8, [rp, #12] C cache allocate
+ sbcs r5, r5, r9
+ sbcs r6, r6, r12
+ sbcs r7, r7, lr
+ stmia rp!, { r4, r5, r6, r7 }
+ sub n, n, #4
+ teq n, #0
+ bne L(sub_n_loop)
+ ldmfd sp!, { r4, r5, r6, r7 }
+L(return):
+ sbc r0, r0, r0
+ and r0, r0, #1
+ ldmfd sp!, { r8, r9, pc }
+EPILOGUE(mpn_sub_n)
diff --git a/gmp/mpn/arm/submul_1.asm b/gmp/mpn/arm/submul_1.asm
new file mode 100644
index 0000000000..c3654377d7
--- /dev/null
+++ b/gmp/mpn/arm/submul_1.asm
@@ -0,0 +1,107 @@
+dnl ARM mpn_submul_1 -- Multiply a limb vector with a limb and subtract the
+dnl 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 The GNU MP Library is free software; you can redistribute it and/or modify
+dnl it under the terms of the GNU Lesser General Public 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: 7.75-9.75 (dependent on vl value)
+C XScale: 8-9 (dependent on vl value, estimated)
+
+define(`rp',`r0')
+define(`up',`r1')
+define(`n',`r2')
+define(`vl',`r3')
+define(`rl',`r12')
+define(`ul',`r6')
+define(`r',`lr')
+
+
+ASM_START()
+PROLOGUE(mpn_submul_1)
+ stmfd sp!, { r4-r6, lr }
+ subs r4, r0, r0 C clear r4, set cy
+ tst n, #1
+ beq L(skip1)
+ ldr ul, [up], #4
+ ldr rl, [rp, #0]
+ umull r5, r4, ul, vl
+ subs r, rl, r5
+ str r, [rp], #4
+L(skip1):
+ tst n, #2
+ beq L(skip2)
+ ldr ul, [up], #4
+ ldr rl, [rp, #0]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ ldr ul, [up], #4
+ sbcs r, rl, r4
+ ldr rl, [rp, #4]
+ mov r4, #0
+ umlal r5, r4, ul, vl
+ str r, [rp], #4
+ sbcs r, rl, r5
+ str r, [rp], #4
+L(skip2):
+ bics r, n, #3
+ beq L(return)
+
+ ldr ul, [up], #4
+ ldr rl, [rp, #0]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ b L(in)
+
+L(loop):
+ ldr ul, [up], #4
+ sbcs r, rl, r5
+ ldr rl, [rp, #4]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ str r, [rp], #4
+L(in): ldr ul, [up], #4
+ sbcs r, rl, r4
+ ldr rl, [rp, #4]
+ mov r4, #0
+ umlal r5, r4, ul, vl
+ str r, [rp], #4
+ ldr ul, [up], #4
+ sbcs r, rl, r5
+ ldr rl, [rp, #4]
+ mov r5, #0
+ umlal r4, r5, ul, vl
+ str r, [rp], #4
+ ldr ul, [up], #4
+ sbcs r, rl, r4
+ ldr rl, [rp, #4]
+ mov r4, #0
+ umlal r5, r4, ul, vl
+ str r, [rp], #4
+ sub n, n, #4
+ bics r, n, #3
+ bne L(loop)
+
+ sbcs r, rl, r5
+ str r, [rp], #4
+L(return):
+ sbc r0, r0, r0
+ sub r0, r4, r0
+ ldmfd sp!, { r4-r6, pc }
+EPILOGUE(mpn_submul_1)
diff --git a/gmp/mpn/arm/udiv.asm b/gmp/mpn/arm/udiv.asm
index 8d441c74ed..9434a4f2b6 100644
--- a/gmp/mpn/arm/udiv.asm
+++ b/gmp/mpn/arm/udiv.asm
@@ -1,33 +1,22 @@
dnl ARM mpn_udiv_qrnnd -- divide a two limb dividend and a one limb divisor.
dnl Return quotient and store remainder through a supplied pointer.
-dnl Copyright 2001, 2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -59,9 +48,9 @@ L(oop): divstep(n1,n0,d)
teq r12, #0
bne L(oop)
- str n1, [rem_ptr] C store remainder
+ str n1, [ rem_ptr ] C store remainder
adc r0, n0, n0 C quotient: add last carry from divstep
- bx lr
+ mov pc, lr
L(_large_divisor):
stmfd sp!, { r8, lr }
@@ -98,7 +87,7 @@ L(oop2):
addcs n0, n0, #1 C adjust quotient
L(_even_divisor):
- str n1, [rem_ptr] C store remainder
+ str n1, [ rem_ptr ] C store remainder
mov r0, n0 C quotient
ldmfd sp!, { r8, pc }
EPILOGUE(mpn_udiv_qrnnd)
diff --git a/gmp/mpn/arm/v5/gcd_1.asm b/gmp/mpn/arm/v5/gcd_1.asm
deleted file mode 100644
index 169d154bf0..0000000000
--- a/gmp/mpn/arm/v5/gcd_1.asm
+++ /dev/null
@@ -1,120 +0,0 @@
-dnl ARM v5 mpn_gcd_1.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjörn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C cycles/bit (approx)
-C StrongARM -
-C XScale ?
-C Cortex-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 5.9
-C Cortex-A15 ?
-C Numbers measured with: speed -CD -s8-32 -t24 mpn_gcd_1
-
-C TODO
-C * Optimise inner-loop better.
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 6)
-
-C INPUT PARAMETERS
-define(`up', `r0')
-define(`n', `r1')
-define(`v0', `r2')
-
-ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',,
- `define(`BMOD_1_TO_MOD_1_THRESHOLD',0xffffffff)')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- push {r4, r7, lr}
- ldr r3, [up] C U low limb
-
- orr r3, r3, v0
- rsb r4, r3, #0
- and r4, r4, r3
- clz r4, r4 C min(ctz(u0),ctz(v0))
- rsb r4, r4, #31
-
- rsb r12, v0, #0
- and r12, r12, v0
- clz r12, r12
- rsb r12, r12, #31
- mov v0, v0, lsr r12
-
- mov r7, v0
-
- cmp n, #1
- bne L(nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- ldr r3, [up]
- cmp v0, r3, lsr #BMOD_THRES_LOG2
- bhi L(red1)
-
-L(bmod):mov r3, #0 C carry argument
- bl mpn_modexact_1c_odd
- b L(red0)
-
-L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD
- blo L(bmod)
-
- bl mpn_mod_1
-
-L(red0):mov r3, r0
-L(red1):rsbs r12, r3, #0
- and r12, r12, r3
- clz r12, r12
- rsb r12, r12, #31
- bne L(mid)
- b L(end)
-
- ALIGN(8)
-L(top): rsb r12, r12, #31
- movcc r3, r1 C if x-y < 0
- movcc r7, r0 C use x,y-x
-L(mid): mov r3, r3, lsr r12 C
- mov r0, r3 C
- sub r1, r7, r3 C
- rsbs r3, r7, r3 C
- and r12, r1, r3 C
- clz r12, r12 C
- bne L(top) C
-
-L(end): mov r0, r7, lsl r4
- pop {r4, r7, pc}
-EPILOGUE()
diff --git a/gmp/mpn/arm/v5/mod_1_1.asm b/gmp/mpn/arm/v5/mod_1_1.asm
deleted file mode 100644
index 3cf0cd7763..0000000000
--- a/gmp/mpn/arm/v5/mod_1_1.asm
+++ /dev/null
@@ -1,129 +0,0 @@
-dnl ARM mpn_mod_1_1p
-
-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 7
-C Cortex-A15 6
-
-define(`ap', `r0')
-define(`n', `r1')
-define(`d', `r2')
-define(`cps',`r3')
-
-ASM_START()
-PROLOGUE(mpn_mod_1_1p)
- push {r4-r10}
- add r0, r0, r1, asl #2
- ldr r5, [r0, #-4]!
- ldr r12, [r0, #-4]!
- subs r1, r1, #2
- ble L(4)
- ldr r8, [r3, #12]
- mov r4, r12
- mov r10, r5
- umull r7, r5, r10, r8
- sub r1, r1, #1
- b L(mid)
-
-L(top): adds r12, r6, r7
- adcs r10, r4, r5
- sub r1, r1, #1
- mov r6, #0
- movcs r6, r8
- umull r7, r5, r10, r8
- adds r4, r12, r6
- subcs r4, r4, r2
-L(mid): ldr r6, [r0, #-4]!
- teq r1, #0
- bne L(top)
-
- adds r12, r6, r7
- adcs r5, r4, r5
- subcs r5, r5, r2
-L(4): ldr r1, [r3, #4]
- cmp r1, #0
- beq L(7)
- ldr r4, [r3, #8]
- umull r0, r6, r5, r4
- adds r12, r0, r12
- addcs r6, r6, #1
- rsb r0, r1, #32
- mov r0, r12, lsr r0
- orr r5, r0, r6, asl r1
- mov r12, r12, asl r1
- b L(8)
-L(7): cmp r5, r2
- subcs r5, r5, r2
-L(8): ldr r0, [r3, #0]
- umull r4, r3, r5, r0
- add r5, r5, #1
- adds r0, r4, r12
- adc r5, r3, r5
- mul r5, r2, r5
- sub r12, r12, r5
- cmp r12, r0
- addhi r12, r12, r2
- cmp r2, r12
- subls r12, r12, r2
- mov r0, r12, lsr r1
- pop {r4-r10}
- bx r14
-EPILOGUE()
-
-PROLOGUE(mpn_mod_1_1p_cps)
- stmfd sp!, {r4, r5, r6, r14}
- mov r5, r0
- clz r4, r1
- mov r0, r1, asl r4
- rsb r6, r0, #0
- bl mpn_invert_limb
- str r0, [r5, #0]
- str r4, [r5, #4]
- cmp r4, #0
- beq L(2)
- rsb r1, r4, #32
- mov r3, #1
- mov r3, r3, asl r4
- orr r3, r3, r0, lsr r1
- mul r3, r6, r3
- mov r4, r3, lsr r4
- str r4, [r5, #8]
-L(2): mul r0, r6, r0
- str r0, [r5, #12]
- ldmfd sp!, {r4, r5, r6, pc}
-EPILOGUE()
diff --git a/gmp/mpn/arm/v5/mod_1_2.asm b/gmp/mpn/arm/v5/mod_1_2.asm
deleted file mode 100644
index aa26ecb21c..0000000000
--- a/gmp/mpn/arm/v5/mod_1_2.asm
+++ /dev/null
@@ -1,156 +0,0 @@
-dnl ARM mpn_mod_1s_2p
-
-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 4.25
-C Cortex-A15 3
-
-define(`ap', `r0')
-define(`n', `r1')
-define(`d', `r2')
-define(`cps',`r3')
-
-ASM_START()
-PROLOGUE(mpn_mod_1s_2p)
- push {r4-r10}
- tst n, #1
- add r7, r3, #8
- ldmia r7, {r7, r8, r12} C load B1, B2, B3
- add ap, ap, n, lsl #2 C put ap at operand end
- beq L(evn)
-
-L(odd): subs n, n, #1
- beq L(1)
- ldmdb ap!, {r4,r6,r9}
- mov r10, #0
- umlal r4, r10, r6, r7
- umlal r4, r10, r9, r8
- b L(com)
-
-L(evn): ldmdb ap!, {r4,r10}
-L(com): subs n, n, #2
- ble L(end)
- ldmdb ap!, {r5,r6}
- b L(mid)
-
-L(top): mov r9, #0
- umlal r5, r9, r6, r7 C B1
- umlal r5, r9, r4, r8 C B2
- ldmdb ap!, {r4,r6}
- umlal r5, r9, r10, r12 C B3
- ble L(xit)
- mov r10, #0
- umlal r4, r10, r6, r7 C B1
- umlal r4, r10, r5, r8 C B2
- ldmdb ap!, {r5,r6}
- umlal r4, r10, r9, r12 C B3
-L(mid): subs n, n, #4
- bge L(top)
-
- mov r9, #0
- umlal r5, r9, r6, r7 C B1
- umlal r5, r9, r4, r8 C B2
- umlal r5, r9, r10, r12 C B3
- mov r4, r5
-
-L(end): movge r9, r10 C executed iff coming via xit
- ldr r6, [r3, #4] C cps[1] = cnt
- mov r5, #0
- umlal r4, r5, r9, r7
- mov r7, r5, lsl r6
-L(x): rsb r1, r6, #32
- orr r8, r7, r4, lsr r1
- mov r9, r4, lsl r6
- ldr r5, [r3, #0]
- add r0, r8, #1
- umull r12, r1, r8, r5
- adds r4, r12, r9
- adc r1, r1, r0
- mul r5, r2, r1
- sub r9, r9, r5
- cmp r9, r4
- addhi r9, r9, r2
- cmp r2, r9
- subls r9, r9, r2
- mov r0, r9, lsr r6
- pop {r4-r10}
- bx r14
-
-L(xit): mov r10, #0
- umlal r4, r10, r6, r7 C B1
- umlal r4, r10, r5, r8 C B2
- umlal r4, r10, r9, r12 C B3
- b L(end)
-
-L(1): ldr r6, [r3, #4] C cps[1] = cnt
- ldr r4, [ap, #-4] C ap[0]
- mov r7, #0
- b L(x)
-EPILOGUE()
-
-PROLOGUE(mpn_mod_1s_2p_cps)
- push {r4-r8, r14}
- clz r4, r1
- mov r5, r1, lsl r4 C b <<= cnt
- mov r6, r0 C r6 = cps
- mov r0, r5
- bl mpn_invert_limb
- rsb r3, r4, #32
- mov r3, r0, lsr r3
- mov r2, #1
- orr r3, r3, r2, lsl r4
- rsb r1, r5, #0
- mul r2, r1, r3
- umull r3, r12, r2, r0
- add r12, r2, r12
- mvn r12, r12
- mul r1, r5, r12
- cmp r1, r3
- addhi r1, r1, r5
- umull r12, r7, r1, r0
- add r7, r1, r7
- mvn r7, r7
- mul r3, r5, r7
- cmp r3, r12
- addhi r3, r3, r5
- mov r5, r2, lsr r4
- mov r7, r1, lsr r4
- mov r8, r3, lsr r4
- stmia r6, {r0,r4,r5,r7,r8} C fill cps
- pop {r4-r8, pc}
-EPILOGUE()
diff --git a/gmp/mpn/arm/v6/addmul_1.asm b/gmp/mpn/arm/v6/addmul_1.asm
deleted file mode 100644
index 57019e4b2b..0000000000
--- a/gmp/mpn/arm/v6/addmul_1.asm
+++ /dev/null
@@ -1,111 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-
-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_addmul_1)
- stmfd sp!, { r4, r5, r6, r7 }
-
- ands r6, n, #3
- mov r12, #0
- beq L(fi0)
- cmp r6, #2
- bcc L(fi1)
- beq L(fi2)
-
-L(fi3): ldr r4, [up], #4
- ldr r6, [rp, #0]
- ldr r5, [up], #4
- b L(lo3)
-
-L(fi0): ldr r5, [up], #4
- ldr r7, [rp], #4
- ldr r4, [up], #4
- b L(lo0)
-
-L(fi1): ldr r4, [up], #4
- ldr r6, [rp], #8
- subs n, n, #1
- beq L(1)
- ldr r5, [up], #4
- b L(lo1)
-
-L(fi2): ldr r5, [up], #4
- ldr r7, [rp], #12
- ldr r4, [up], #4
- b L(lo2)
-
- ALIGN(16)
-L(top): ldr r6, [rp, #-8]
- ldr r5, [up], #4
- str r7, [rp, #-12]
-L(lo1): umaal r6, r12, r4, v0
- ldr r7, [rp, #-4]
- ldr r4, [up], #4
- str r6, [rp, #-8]
-L(lo0): umaal r7, r12, r5, v0
- ldr r6, [rp, #0]
- ldr r5, [up], #4
- str r7, [rp, #-4]
-L(lo3): umaal r6, r12, r4, v0
- ldr r7, [rp, #4]
- ldr r4, [up], #4
- str r6, [rp], #16
-L(lo2): umaal r7, r12, r5, v0
- 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]
- mov r0, r12
- ldmfd sp!, { r4, r5, r6, r7 }
- bx lr
-EPILOGUE()
diff --git a/gmp/mpn/arm/v6/addmul_2.asm b/gmp/mpn/arm/v6/addmul_2.asm
deleted file mode 100644
index 69817ce340..0000000000
--- a/gmp/mpn/arm/v6/addmul_2.asm
+++ /dev/null
@@ -1,138 +0,0 @@
-dnl ARM mpn_addmul_2.
-
-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 StrongARM: -
-C XScale -
-C Cortex-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 2.25
-C Cortex-A15 2.5
-
-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')
-define(`n', `r2')
-define(`vp',`r3')
-
-define(`v0',`r6')
-define(`v1',`r7')
-define(`u0',`r3')
-define(`u1',`r9')
-
-define(`cya',`r8')
-define(`cyb',`r12')
-
-
-ASM_START()
-PROLOGUE(mpn_addmul_2)
- push { r4, r5, r6, r7, r8, r9 }
-
- ldm vp, { v0, v1 }
- mov cya, #0
- mov cyb, #0
-
- 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, #12
- b L(lo3)
-L(fi1): sub n, n, #1
- sub up, up, #4
- 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, #8
- b L(lo0)
-L(fi2): subs n, n, #2
- bls L(end)
-
- ALIGN(16)
-L(top): ldr u0, [up, #4]
- umaal r4, cya, u1, v0
- 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, #4]
- ldr r5, [rp, #12]
- umaal r4, cyb, u0, v1
-L(lo0): ldr u0, [up, #12]
- umaal r4, cya, u1, v0
- str r4, [rp, #8]
- ldr r4, [rp, #16]
- umaal r5, cyb, u1, v1
-L(lo3): ldr u1, [up, #16]
- umaal r5, cya, u0, v0
- 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, #0]
- umaal r5, cya, u0, v0
- umaal cya, cyb, u0, v1
- str r5, [rp, #4]
- str cya, [rp, #8]
- mov r0, cyb
-
- pop { r4, r5, r6, r7, r8, r9 }
- bx r14
-EPILOGUE()
diff --git a/gmp/mpn/arm/v6/addmul_3.asm b/gmp/mpn/arm/v6/addmul_3.asm
deleted file mode 100644
index 046543020f..0000000000
--- a/gmp/mpn/arm/v6/addmul_3.asm
+++ /dev/null
@@ -1,187 +0,0 @@
-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/gmp/mpn/arm/v6/dive_1.asm b/gmp/mpn/arm/v6/dive_1.asm
deleted file mode 100644
index 92de81473f..0000000000
--- a/gmp/mpn/arm/v6/dive_1.asm
+++ /dev/null
@@ -1,149 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/v6/gmp-mparam.h b/gmp/mpn/arm/v6/gmp-mparam.h
deleted file mode 100644
index c9c6851769..0000000000
--- a/gmp/mpn/arm/v6/gmp-mparam.h
+++ /dev/null
@@ -1,157 +0,0 @@
-/* gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 700MHz ARM11 (raspberry pi) */
-
-#define DIVREM_1_NORM_THRESHOLD 0 /* preinv always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_1P_METHOD 2
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD MP_SIZE_T_MAX
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 29
-#define USE_PREINV_DIVREM_1 1 /* preinv always */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 33
-
-#define MUL_TOOM22_THRESHOLD 36
-#define MUL_TOOM33_THRESHOLD 117
-#define MUL_TOOM44_THRESHOLD 462
-#define MUL_TOOM6H_THRESHOLD 0 /* always */
-#define MUL_TOOM8H_THRESHOLD 620
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 130
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 573
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 209
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 209
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 305
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 50
-#define SQR_TOOM3_THRESHOLD 181
-#define SQR_TOOM4_THRESHOLD 686
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 915
-
-#define MULMID_TOOM42_THRESHOLD 72
-
-#define MULMOD_BNM1_THRESHOLD 25
-#define SQRMOD_BNM1_THRESHOLD 30
-
-#define MUL_FFT_MODF_THRESHOLD 476 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 476, 5}, { 21, 6}, { 11, 5}, { 25, 6}, \
- { 13, 5}, { 27, 6}, { 25, 7}, { 13, 6}, \
- { 28, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 51, 8}, \
- { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
- { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
- { 71, 9}, { 39, 8}, { 83, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
- { 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 127, 9}, \
- { 255,10}, { 143, 9}, { 287,10}, { 159,11}, \
- { 95,10}, { 191, 9}, { 383,12}, { 4096,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 63
-#define MUL_FFT_THRESHOLD 4736
-
-#define SQR_FFT_MODF_THRESHOLD 464 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 464, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 36, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 49, 8}, \
- { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
- { 35, 7}, { 71, 8}, { 43, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 71, 9}, { 39, 8}, \
- { 83, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,10}, { 111,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
- { 287,10}, { 159,11}, { 95,10}, { 191, 9}, \
- { 383,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 61
-#define SQR_FFT_THRESHOLD 3776
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 67
-#define MULLO_MUL_N_THRESHOLD 8907
-
-#define DC_DIV_QR_THRESHOLD 40
-#define DC_DIVAPPR_Q_THRESHOLD 156
-#define DC_BDIV_QR_THRESHOLD 71
-#define DC_BDIV_Q_THRESHOLD 208
-
-#define INV_MULMOD_BNM1_THRESHOLD 70
-#define INV_NEWTON_THRESHOLD 151
-#define INV_APPR_THRESHOLD 150
-
-#define BINV_NEWTON_THRESHOLD 375
-#define REDC_1_TO_REDC_2_THRESHOLD 5
-#define REDC_2_TO_REDC_N_THRESHOLD 134
-
-#define MU_DIV_QR_THRESHOLD 2130
-#define MU_DIVAPPR_Q_THRESHOLD 2130
-#define MUPI_DIV_QR_THRESHOLD 80
-#define MU_BDIV_QR_THRESHOLD 1787
-#define MU_BDIV_Q_THRESHOLD 2130
-
-#define POWM_SEC_TABLE 7,32,460,1705
-
-#define MATRIX22_STRASSEN_THRESHOLD 19
-#define HGCD_THRESHOLD 85
-#define HGCD_APPR_THRESHOLD 119
-#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 333
-#define GCDEXT_DC_THRESHOLD 309
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 21
-#define GET_STR_PRECOMPUTE_THRESHOLD 41
-#define SET_STR_DC_THRESHOLD 527
-#define SET_STR_PRECOMPUTE_THRESHOLD 1323
-
-#define FAC_DSC_THRESHOLD 414
-#define FAC_ODD_THRESHOLD 154
diff --git a/gmp/mpn/arm/v6/mode1o.asm b/gmp/mpn/arm/v6/mode1o.asm
deleted file mode 100644
index a2f77a6bf5..0000000000
--- a/gmp/mpn/arm/v6/mode1o.asm
+++ /dev/null
@@ -1,95 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/v6/mul_1.asm b/gmp/mpn/arm/v6/mul_1.asm
deleted file mode 100644
index 0fcc0e46d9..0000000000
--- a/gmp/mpn/arm/v6/mul_1.asm
+++ /dev/null
@@ -1,114 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-
-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_mul_1)
- stmfd sp!, { r4, r5, r6, r7 }
-
- ands r6, n, #3
- mov r12, #0
- beq L(fi0)
- cmp r6, #2
- bcc L(fi1)
- beq L(fi2)
-
-L(fi3): ldr r4, [up], #4
- mov r6, #0
- ldr r5, [up], #4
- b L(lo3)
-
-L(fi0): ldr r5, [up], #4
- add rp, rp, #4
- mov r7, #0
- ldr r4, [up], #4
- b L(lo0)
-
-L(fi1): ldr r4, [up], #4
- mov r6, #0
- add rp, rp, #8
- subs n, n, #1
- beq L(1)
- ldr r5, [up], #4
- b L(lo1)
-
-L(fi2): ldr r5, [up], #4
- add rp, rp, #12
- mov r7, #0
- ldr r4, [up], #4
- b L(lo2)
-
- ALIGN(16)
-L(top): mov r6, #0
- ldr r5, [up], #4
- str r7, [rp, #-12]
-L(lo1): umaal r6, r12, r4, v0
- mov r7, #0
- ldr r4, [up], #4
- str r6, [rp, #-8]
-L(lo0): umaal r7, r12, r5, v0
- mov r6, #0
- ldr r5, [up], #4
- str r7, [rp, #-4]
-L(lo3): umaal r6, r12, r4, v0
- mov r7, #0
- ldr r4, [up], #4
- str r6, [rp], #16
-L(lo2): umaal r7, r12, r5, v0
- subs n, n, #4
- bhi L(top)
-
- mov r6, #0
- str r7, [rp, #-12]
-L(1): umaal r6, r12, r4, v0
- str r6, [rp, #-8]
- mov r0, r12
- ldmfd sp!, { r4, r5, r6, r7 }
- bx lr
-EPILOGUE()
diff --git a/gmp/mpn/arm/v6/mul_2.asm b/gmp/mpn/arm/v6/mul_2.asm
deleted file mode 100644
index 1679542a3c..0000000000
--- a/gmp/mpn/arm/v6/mul_2.asm
+++ /dev/null
@@ -1,131 +0,0 @@
-dnl ARM mpn_mul_2.
-
-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 2.25
-C Cortex-A15 2.5
-
-C TODO
-C * This is a trivial edit of the addmul_2 code. Check for simplifications,
-C and possible speedups to 2.0 c/l.
-
-define(`rp',`r0')
-define(`up',`r1')
-define(`n', `r2')
-define(`vp',`r3')
-
-define(`v0',`r6')
-define(`v1',`r7')
-define(`u0',`r3')
-define(`u1',`r9')
-
-define(`cya',`r8')
-define(`cyb',`r12')
-
-
-ASM_START()
-PROLOGUE(mpn_mul_2)
- push { r4, r5, r6, r7, r8, r9 }
-
- ldm vp, { v0, v1 }
- mov cya, #0
- mov cyb, #0
-
- tst n, #1
- beq L(evn)
-L(odd): mov r5, #0
- ldr u0, [up, #0]
- mov r4, #0
- tst n, #2
- beq L(fi1)
-L(fi3): sub up, up, #12
- sub rp, rp, #16
- b L(lo3)
-L(fi1): sub n, n, #1
- sub up, up, #4
- sub rp, rp, #8
- b L(lo1)
-L(evn): mov r4, #0
- ldr u1, [up, #0]
- mov r5, #0
- tst n, #2
- bne L(fi2)
-L(fi0): sub up, up, #8
- sub rp, rp, #12
- 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]
- mov r4, #0
- umaal r5, cyb, u1, v1
-L(lo1): ldr u1, [up, #8]
- umaal r5, cya, u0, v0
- str r5, [rp, #8]
- mov r5, #0
- umaal r4, cyb, u0, v1
-L(lo0): ldr u0, [up, #12]
- umaal r4, cya, u1, v0
- str r4, [rp, #12]
- mov r4, #0
- umaal r5, cyb, u1, v1
-L(lo3): ldr u1, [up, #16]!
- umaal r5, cya, u0, v0
- str r5, [rp, #16]!
- mov r5, #0
- umaal r4, cyb, u0, v1
- 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]
- umaal r5, cya, u0, v0
- umaal cya, cyb, u0, v1
- str r5, [rp, #8]
- str cya, [rp, #12]
- mov r0, cyb
-
- pop { r4, r5, r6, r7, r8, r9 }
- bx r14
-EPILOGUE()
diff --git a/gmp/mpn/arm/v6/popham.asm b/gmp/mpn/arm/v6/popham.asm
deleted file mode 100644
index 44c8f2361c..0000000000
--- a/gmp/mpn/arm/v6/popham.asm
+++ /dev/null
@@ -1,138 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/v6/sqr_basecase.asm b/gmp/mpn/arm/v6/sqr_basecase.asm
deleted file mode 100644
index d52970aaa7..0000000000
--- a/gmp/mpn/arm/v6/sqr_basecase.asm
+++ /dev/null
@@ -1,518 +0,0 @@
-dnl ARM v6 mpn_sqr_basecase.
-
-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 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 * Further tweak counter and updates in outer loops. (This could save
-C perhaps 5n cycles).
-C * Try to use fewer register. Perhaps coalesce r9 branch target and n_saved.
-C (This could save 2-3 cycles for n > 4.)
-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 table really faster than discrete branches?
-
-define(`rp', r0)
-define(`up', r1)
-define(`n', r2)
-
-define(`v0', r3)
-define(`v1', r6)
-define(`i', r8)
-define(`n_saved', r14)
-define(`cya', r11)
-define(`cyb', r12)
-define(`u0', r7)
-define(`u1', r9)
-
-ASM_START()
-PROLOGUE(mpn_sqr_basecase)
- and r12, n, #3
- cmp n, #4
- addgt r12, r12, #4
- add pc, pc, r12, lsl #2
- nop
- b L(4)
- b L(1)
- b L(2)
- b L(3)
- b L(0m4)
- b L(1m4)
- b L(2m4)
- b L(3m4)
-
-
-L(1m4): push {r4-r10,r11,r14}
- mov n_saved, n
- sub i, n, #4
- sub n, n, #2
- add r10, pc, #L(am2_2m4)-.-8
- ldm up, {v0,v1,u0}
- sub up, up, #4
- mov cyb, #0
- mov r5, #0
- umull r4, cya, v1, v0
- str r4, [rp], #-12
- mov r4, #0
- b L(ko0)
-
-L(3m4): push {r4-r10,r11,r14}
- mov n_saved, n
- sub i, n, #4
- sub n, n, #2
- add r10, pc, #L(am2_0m4)-.-8
- ldm up, {v0,v1,u0}
- add up, up, #4
- mov cyb, #0
- mov r5, #0
- umull r4, cya, v1, v0
- str r4, [rp], #-4
- mov r4, #0
- b L(ko2)
-
-L(2m4): push {r4-r10,r11,r14}
- mov n_saved, n
- sub i, n, #4
- sub n, n, #2
- add r10, pc, #L(am2_3m4)-.-8
- ldm up, {v0,v1,u1}
- mov cyb, #0
- mov r4, #0
- umull r5, cya, v1, v0
- str r5, [rp], #-8
- mov r5, #0
- b L(ko1)
-
-L(0m4): push {r4-r10,r11,r14}
- mov n_saved, n
- sub i, n, #4
- sub n, n, #2
- add r10, pc, #L(am2_1m4)-.-8
- ldm up, {v0,v1,u1}
- mov cyb, #0
- mov r4, #0
- add up, up, #8
- umull r5, cya, v1, v0
- str r5, [rp, #0]
- mov r5, #0
-
-L(top): ldr u0, [up, #4]
- umaal r4, cya, u1, v0
- str r4, [rp, #4]
- mov r4, #0
- umaal r5, cyb, u1, v1
-L(ko2): ldr u1, [up, #8]
- umaal r5, cya, u0, v0
- str r5, [rp, #8]
- mov r5, #0
- umaal r4, cyb, u0, v1
-L(ko1): ldr u0, [up, #12]
- umaal r4, cya, u1, v0
- str r4, [rp, #12]
- mov r4, #0
- umaal r5, cyb, u1, v1
-L(ko0): ldr u1, [up, #16]!
- umaal r5, cya, u0, v0
- str r5, [rp, #16]!
- mov r5, #0
- umaal r4, cyb, u0, v1
- subs i, i, #4
- bhi L(top)
- bx r10
-
-L(evnloop):
- subs i, n, #4
- sub n, n, #2
- blt L(tix)
- ldm up, {v0,v1,u0}
- add up, up, #4
- mov cya, #0
- mov cyb, #0
- ldm rp, {r4,r5}
- sub rp, rp, #4
- umaal r4, cya, v1, v0
- str r4, [rp, #4]
- ldr r4, [rp, #12]
- b L(lo2)
-L(ua2): ldr u0, [up, #4]
- umaal r4, cya, u1, v0
- str r4, [rp, #4]
- ldr r4, [rp, #12]
- umaal r5, cyb, u1, v1
-L(lo2): ldr u1, [up, #8]
- umaal r5, cya, u0, v0
- str r5, [rp, #8]
- ldr r5, [rp, #16]
- umaal r4, cyb, u0, v1
- ldr u0, [up, #12]
- umaal r4, cya, u1, v0
- str r4, [rp, #12]
- ldr r4, [rp, #20]
- umaal r5, cyb, u1, v1
- ldr u1, [up, #16]!
- umaal r5, cya, u0, v0
- str r5, [rp, #16]!
- ldr r5, [rp, #8]
- umaal r4, cyb, u0, v1
- subs i, i, #4
- bhi L(ua2)
-L(am2_0m4):
- umaal r4, cya, u1, v0
- ldr u0, [up, #4]
- umaal r5, cyb, u1, v1
- str r4, [rp, #4]
- umaal r5, cya, u0, v0
- umaal cya, cyb, u0, v1
- str r5, [rp, #8]
- str cya, [rp, #12]
- str cyb, [rp, #16]
- sub up, up, n, lsl #2
- sub rp, rp, n, lsl #2
- add up, up, #8
- sub i, n, #4
- sub n, n, #2
- ldm up, {v0,v1,u0}
- sub up, up, #4
- mov cya, #0
- mov cyb, #0
- ldr r4, [rp, #24]
- ldr r5, [rp, #28]
- add rp, rp, #12
- umaal r4, cya, v1, v0
- str r4, [rp, #12]
- ldr r4, [rp, #20]
- b L(lo0)
-L(ua0): ldr u0, [up, #4]
- umaal r4, cya, u1, v0
- str r4, [rp, #4]
- ldr r4, [rp, #12]
- umaal r5, cyb, u1, v1
- ldr u1, [up, #8]
- umaal r5, cya, u0, v0
- str r5, [rp, #8]
- ldr r5, [rp, #16]
- umaal r4, cyb, u0, v1
- ldr u0, [up, #12]
- umaal r4, cya, u1, v0
- str r4, [rp, #12]
- ldr r4, [rp, #20]
- umaal r5, cyb, u1, v1
-L(lo0): ldr u1, [up, #16]!
- umaal r5, cya, u0, v0
- str r5, [rp, #16]!
- ldr r5, [rp, #8]
- umaal r4, cyb, u0, v1
- subs i, i, #4
- bhi L(ua0)
-L(am2_2m4):
- umaal r4, cya, u1, v0
- ldr u0, [up, #4]
- umaal r5, cyb, u1, v1
- str r4, [rp, #4]
- umaal r5, cya, u0, v0
- umaal cya, cyb, u0, v1
- str r5, [rp, #8]
- str cya, [rp, #12]
- str cyb, [rp, #16]
- sub up, up, n, lsl #2
- sub rp, rp, n, lsl #2
- add up, up, #8
- add rp, rp, #24
- b L(evnloop)
-
-
-L(oddloop):
- subs i, n, #4
- sub n, n, #2
- blt L(xit)
- ldm up, {v0,v1,u1}
- mov cya, #0
- mov cyb, #0
- sub rp, rp, #8
- ldr r5, [rp, #8]
- ldr r4, [rp, #12]
- umaal r5, cya, v1, v0
- str r5, [rp, #8]
- ldr r5, [rp, #16]
- b L(lo1)
-L(ua1): ldr u0, [up, #4]
- umaal r4, cya, u1, v0
- str r4, [rp, #4]
- ldr r4, [rp, #12]
- umaal r5, cyb, u1, v1
- ldr u1, [up, #8]
- umaal r5, cya, u0, v0
- str r5, [rp, #8]
- ldr r5, [rp, #16]
- umaal r4, cyb, u0, v1
-L(lo1): ldr u0, [up, #12]
- umaal r4, cya, u1, v0
- str r4, [rp, #12]
- ldr r4, [rp, #20]
- umaal r5, cyb, u1, v1
- ldr u1, [up, #16]!
- umaal r5, cya, u0, v0
- str r5, [rp, #16]!
- ldr r5, [rp, #8]
- umaal r4, cyb, u0, v1
- subs i, i, #4
- bhi L(ua1)
-L(am2_3m4):
- umaal r4, cya, u1, v0
- ldr u0, [up, #4]
- umaal r5, cyb, u1, v1
- str r4, [rp, #4]
- umaal r5, cya, u0, v0
- umaal cya, cyb, u0, v1
- str r5, [rp, #8]
- str cya, [rp, #12]
- str cyb, [rp, #16]
- sub up, up, n, lsl #2
- sub rp, rp, n, lsl #2
- add up, up, #8
- add rp, rp, #24
- subs i, n, #4
- sub n, n, #2
- ldm up, {v0,v1,u1}
- mov cya, #0
- mov cyb, #0
- ldr r5, [rp, #0]
- ldr r4, [rp, #4]
- add up, up, #8
- umaal r5, cya, v1, v0
- str r5, [rp, #0]
- ldr r5, [rp, #8]
- bls L(e3)
-L(ua3): ldr u0, [up, #4]
- umaal r4, cya, u1, v0
- str r4, [rp, #4]
- ldr r4, [rp, #12]
- umaal r5, cyb, u1, v1
- ldr u1, [up, #8]
- umaal r5, cya, u0, v0
- str r5, [rp, #8]
- ldr r5, [rp, #16]
- umaal r4, cyb, u0, v1
- ldr u0, [up, #12]
- umaal r4, cya, u1, v0
- str r4, [rp, #12]
- ldr r4, [rp, #20]
- umaal r5, cyb, u1, v1
- ldr u1, [up, #16]!
- umaal r5, cya, u0, v0
- str r5, [rp, #16]!
- ldr r5, [rp, #8]
- umaal r4, cyb, u0, v1
- subs i, i, #4
- bhi L(ua3)
-L(e3):
-L(am2_1m4):
- umaal r4, cya, u1, v0
- ldr u0, [up, #4]
- umaal r5, cyb, u1, v1
- str r4, [rp, #4]
- umaal r5, cya, u0, v0
- umaal cya, cyb, u0, v1
- str r5, [rp, #8]
- str cya, [rp, #12]
- str cyb, [rp, #16]
- sub up, up, n, lsl #2
- sub rp, rp, n, lsl #2
- add up, up, #8
- add rp, rp, #24
- b L(oddloop)
-
-L(xit): ldm up!, {v0,u0}
- ldr cya, [rp], #12
- mov cyb, #0
- umaal cya, cyb, u0, v0
- b L(sqr_diag_addlsh1)
-
-L(tix): ldm up!, {v0,v1,u0}
- ldm rp, {r4,r5}
- mov cya, #0
- mov cyb, #0
- umaal r4, cya, v1, v0
- umaal r5, cya, u0, v0
- stm rp, {r4,r5}
- umaal cya, cyb, u0, v1
- add rp, rp, #20
-C b L(sqr_diag_addlsh1)
-
-
-define(`w0', r6)
-define(`w1', r7)
-define(`w2', r8)
-define(`rbx', r9)
-
-L(sqr_diag_addlsh1):
- str cya, [rp, #-12]
- str cyb, [rp, #-8]
- sub n, n_saved, #1
- sub up, up, n_saved, lsl #2
- sub rp, rp, n_saved, lsl #3
- 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)
-
-L(tsd): adds w0, w0, rbx
- adcs w1, w1, r4
- str w0, [rp, #0]
-L(lm): ldr w0, [rp, #4]
- str w1, [rp, #4]
- ldr w1, [rp, #8]!
- add rbx, r5, w2
- adcs w0, w0, w0
- ldr r3, [up], #4
- adcs w1, w1, w1
- adc w2, r10, r10
- umull r4, r5, r3, r3
- subs n, n, #1
- bne L(tsd)
-
- adds w0, w0, rbx
- adcs w1, w1, r4
- adc w2, r5, w2
- stm rp, {w0,w1,w2}
-
- pop {r4-r10,r11,pc}
-
-
-C Straight line code for n <= 4
-
-L(1): ldr r3, [up, #0]
- umull r1, r2, r3, r3
- stm rp, {r1,r2}
- bx r14
-
-L(2): push {r4-r5}
- ldm up, {r5,r12}
- umull r1, r2, r5, r5
- umull r3, r4, r12, r12
- umull r5, r12, r5, r12
- adds r5, r5, r5
- adcs r12, r12, r12
- adc r4, r4, #0
- adds r2, r2, r5
- adcs r3, r3, r12
- adc r4, r4, #0
- stm rp, {r1,r2,r3,r4}
- pop {r4-r5}
- bx r14
-
-L(3): push {r4-r11}
- ldm up, {r7,r8,r9}
- umull r1, r2, r7, r7
- umull r3, r4, r8, r8
- umull r5, r6, r9, r9
- umull r10, r11, r7, r8
- mov r12, #0
- umlal r11, r12, r7, r9
- mov r7, #0
- umlal r12, r7, r8, r9
- adds r10, r10, r10
- adcs r11, r11, r11
- adcs r12, r12, r12
- adcs r7, r7, r7
- adc r6, r6, #0
- adds r2, r2, r10
- adcs r3, r3, r11
- adcs r4, r4, r12
- adcs r5, r5, r7
- adc r6, r6, #0
- stm rp, {r1,r2,r3,r4,r5,r6}
- pop {r4-r11}
- bx r14
-
-L(4): push {r4-r11, r14}
- ldm up, {r9,r10,r11,r12}
- umull r1, r2, r9, r9
- umull r3, r4, r10, r10
- umull r5, r6, r11, r11
- umull r7, r8, r12, r12
- stm rp, {r1,r2,r3,r4,r5,r6,r7}
- umull r1, r2, r9, r10
- mov r3, #0
- umlal r2, r3, r9, r11
- mov r4, #0
- umlal r3, r4, r9, r12
- mov r5, #0
- umlal r3, r5, r10, r11
- umaal r4, r5, r10, r12
- mov r6, #0
- umlal r5, r6, r11, r12
- adds r1, r1, r1
- adcs r2, r2, r2
- adcs r3, r3, r3
- adcs r4, r4, r4
- adcs r5, r5, r5
- adcs r6, r6, r6
- adc r7, r8, #0
- add rp, rp, #4
- ldm rp, {r8,r9,r10,r11,r12,r14}
- adds r1, r1, r8
- adcs r2, r2, r9
- adcs r3, r3, r10
- adcs r4, r4, r11
- adcs r5, r5, r12
- adcs r6, r6, r14
- adc r7, r7, #0
- stm rp, {r1,r2,r3,r4,r5,r6,r7}
- pop {r4-r11, pc}
-EPILOGUE()
diff --git a/gmp/mpn/arm/v6/submul_1.asm b/gmp/mpn/arm/v6/submul_1.asm
deleted file mode 100644
index 8a21733a0a..0000000000
--- a/gmp/mpn/arm/v6/submul_1.asm
+++ /dev/null
@@ -1,125 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/v6t2/divrem_1.asm b/gmp/mpn/arm/v6t2/divrem_1.asm
deleted file mode 100644
index be24615acb..0000000000
--- a/gmp/mpn/arm/v6t2/divrem_1.asm
+++ /dev/null
@@ -1,212 +0,0 @@
-dnl ARM v6t2 mpn_divrem_1 and mpn_preinv_divrem_1.
-
-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 norm unorm frac
-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.
-C * Decrease register usage, streamline non-loop code.
-
-define(`qp_arg', `r0')
-define(`fn', `r1')
-define(`up_arg', `r2')
-define(`n_arg', `r3')
-define(`d_arg', `0')
-define(`dinv_arg',`4')
-define(`cnt_arg', `8')
-
-define(`n', `r9')
-define(`qp', `r5')
-define(`up', `r6')
-define(`cnt', `r7')
-define(`tnc', `r10')
-define(`dinv', `r0')
-define(`d', `r4')
-
-ASM_START()
-PROLOGUE(mpn_preinv_divrem_1)
- stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
- ldr d, [sp, #9*4+d_arg]
- ldr cnt, [sp, #9*4+cnt_arg]
- str r1, [sp, #9*4+d_arg] C reuse d stack slot for fn
- sub n, r3, #1
- add r3, r1, n
- cmp d, #0
- add qp, qp_arg, r3, lsl #2 C put qp at Q[] end
- add up, up_arg, n, lsl #2 C put up at U[] end
- ldr dinv, [sp, #9*4+dinv_arg]
- blt L(nent)
- b L(uent)
-EPILOGUE()
-
-PROLOGUE(mpn_divrem_1)
- stmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, lr}
- sub n, r3, #1
- ldr d, [sp, #9*4+d_arg] C d
- str r1, [sp, #9*4+d_arg] C reuse d stack slot for fn
- add r3, r1, n
- cmp d, #0
- add qp, qp_arg, r3, lsl #2 C put qp at Q[] end
- add up, up_arg, n, lsl #2 C put up at U[] end
- blt L(normalised)
-
-L(unnorm):
- clz cnt, d
- mov r0, d, lsl cnt C pass d << cnt
- bl mpn_invert_limb
-L(uent):
- mov d, d, lsl cnt C d <<= cnt
- cmp n, #0
- mov r1, #0 C r
- blt L(frac)
-
- ldr r11, [up, #0]
-
- rsb tnc, cnt, #32
- mov r1, r11, lsr tnc
- mov r11, r11, lsl cnt
- beq L(uend)
-
- ldr r3, [up, #-4]!
- orr r2, r11, r3, lsr tnc
- b L(mid)
-
-L(utop):
- mls r1, d, r8, r11
- mov r11, r3, lsl cnt
- ldr r3, [up, #-4]!
- cmp r1, r2
- addhi r1, r1, d
- subhi r8, r8, #1
- orr r2, r11, r3, lsr tnc
- cmp r1, d
- bcs L(ufx)
-L(uok): str r8, [qp], #-4
-L(mid): add r8, r1, #1
- mov r11, r2
- umlal r2, r8, r1, dinv
- subs n, n, #1
- bne L(utop)
-
- mls r1, d, r8, r11
- mov r11, r3, lsl cnt
- cmp r1, r2
- addhi r1, r1, d
- subhi r8, r8, #1
- cmp r1, d
- rsbcs r1, d, r1
- addcs r8, r8, #1
- str r8, [qp], #-4
-
-L(uend):add r8, r1, #1
- mov r2, r11
- umlal r2, r8, r1, dinv
- mls r1, d, r8, r11
- cmp r1, r2
- addhi r1, r1, d
- subhi r8, r8, #1
- cmp r1, d
- rsbcs r1, d, r1
- addcs r8, r8, #1
- str r8, [qp], #-4
-L(frac):
- ldr r2, [sp, #9*4+d_arg] C fn
- cmp r2, #0
- beq L(fend)
-
-L(ftop):mov r6, #0
- add r3, r1, #1
- umlal r6, r3, r1, dinv
- mov r8, #0
- mls r1, d, r3, r8
- cmp r1, r6
- addhi r1, r1, d
- subhi r3, r3, #1
- subs r2, r2, #1
- str r3, [qp], #-4
- bne L(ftop)
-
-L(fend):mov r11, r1, lsr cnt
-L(rtn): mov r0, r11
- ldmfd sp!, {r4, r5, r6, r7, r8, r9, r10, r11, pc}
-
-L(normalised):
- mov r0, d
- bl mpn_invert_limb
-L(nent):
- cmp n, #0
- mov r11, #0 C r
- blt L(nend)
-
- ldr r11, [up, #0]
- cmp r11, d
- movlo r2, #0 C hi q limb
- movhs r2, #1 C hi q limb
- subhs r11, r11, d
-
- str r2, [qp], #-4
- cmp n, #0
- beq L(nend)
-
-L(ntop):ldr r1, [up, #-4]!
- add r12, r11, #1
- umlal r1, r12, r11, dinv
- ldr r3, [up, #0]
- mls r11, d, r12, r3
- cmp r11, r1
- addhi r11, r11, d
- subhi r12, r12, #1
- cmp d, r11
- bls L(nfx)
-L(nok): str r12, [qp], #-4
- subs n, n, #1
- bne L(ntop)
-
-L(nend):mov r1, r11 C r
- mov cnt, #0 C shift cnt
- b L(frac)
-
-L(nfx): add r12, r12, #1
- rsb r11, d, r11
- b L(nok)
-L(ufx): rsb r1, d, r1
- add r8, r8, #1
- b L(uok)
-EPILOGUE()
diff --git a/gmp/mpn/arm/v6t2/gcd_1.asm b/gmp/mpn/arm/v6t2/gcd_1.asm
deleted file mode 100644
index 2063647963..0000000000
--- a/gmp/mpn/arm/v6t2/gcd_1.asm
+++ /dev/null
@@ -1,115 +0,0 @@
-dnl ARM v6t2 mpn_gcd_1.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjörn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C cycles/bit (approx)
-C StrongARM -
-C XScale -
-C Cortex-A7 ?
-C Cortex-A8 ?
-C Cortex-A9 5.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).
-define(`BMOD_THRES_LOG2', 7)
-
-C INPUT PARAMETERS
-define(`up', `r0')
-define(`n', `r1')
-define(`v0', `r2')
-
-ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',,
- `define(`BMOD_1_TO_MOD_1_THRESHOLD',0xffffffff)')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- push {r4, r7, lr}
- ldr r3, [up] C U low limb
-
- orr r3, r3, v0
- rbit r4, r3
- clz r4, r4 C min(ctz(u0),ctz(v0))
-
- rbit r12, v0
- clz r12, r12
- mov v0, v0, lsr r12
-
- mov r7, v0
-
- cmp n, #1
- bne L(nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- ldr r3, [up]
- cmp v0, r3, lsr #BMOD_THRES_LOG2
- bhi L(red1)
-
-L(bmod):mov r3, #0 C carry argument
- bl mpn_modexact_1c_odd
- b L(red0)
-
-L(nby1):cmp n, #BMOD_1_TO_MOD_1_THRESHOLD
- blo L(bmod)
-
- bl mpn_mod_1
-
-L(red0):mov r3, r0
-L(red1):cmp r3, #0
- rbit r12, r3
- clz r12, r12
- bne L(mid)
- b L(end)
-
- ALIGN(8)
-L(top): movcs r3, r1 C if x-y < 0
- movcs r7, r0 C use x,y-x
-L(mid): mov r3, r3, lsr r12 C
- mov r0, r3 C
- subs r1, r7, r3 C
- rsb r3, r7, r3 C
- rbit r12, r1
- clz r12, r12 C
- bne L(top) C
-
-L(end): mov r0, r7, lsl r4
- pop {r4, r7, pc}
-EPILOGUE()
diff --git a/gmp/mpn/arm/v7a/cora15/addmul_1.asm b/gmp/mpn/arm/v7a/cora15/addmul_1.asm
deleted file mode 100644
index c2277b32b2..0000000000
--- a/gmp/mpn/arm/v7a/cora15/addmul_1.asm
+++ /dev/null
@@ -1,145 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/aors_n.asm b/gmp/mpn/arm/v7a/cora15/aors_n.asm
deleted file mode 100644
index dc3f83992e..0000000000
--- a/gmp/mpn/arm/v7a/cora15/aors_n.asm
+++ /dev/null
@@ -1,162 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/cnd_aors_n.asm b/gmp/mpn/arm/v7a/cora15/cnd_aors_n.asm
deleted file mode 100644
index b9e5cd3f79..0000000000
--- a/gmp/mpn/arm/v7a/cora15/cnd_aors_n.asm
+++ /dev/null
@@ -1,158 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/com.asm b/gmp/mpn/arm/v7a/cora15/com.asm
deleted file mode 100644
index a258afe934..0000000000
--- a/gmp/mpn/arm/v7a/cora15/com.asm
+++ /dev/null
@@ -1,180 +0,0 @@
-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()
diff --git a/gmp/mpn/arm/v7a/cora15/gmp-mparam.h b/gmp/mpn/arm/v7a/cora15/gmp-mparam.h
deleted file mode 100644
index 2a06532b3e..0000000000
--- a/gmp/mpn/arm/v7a/cora15/gmp-mparam.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* 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
-
-/* 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 */
-#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 9
-#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 (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 15
-
-#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 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 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 52
-
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 23
-
-#define MUL_FFT_MODF_THRESHOLD 550 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, \
- { 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 525 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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 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 32
-#define SET_STR_DC_THRESHOLD 119
-#define SET_STR_PRECOMPUTE_THRESHOLD 1063
-
-#define FAC_DSC_THRESHOLD 262
-#define FAC_ODD_THRESHOLD 26
diff --git a/gmp/mpn/arm/v7a/cora15/logops_n.asm b/gmp/mpn/arm/v7a/cora15/logops_n.asm
deleted file mode 100644
index 06026143e1..0000000000
--- a/gmp/mpn/arm/v7a/cora15/logops_n.asm
+++ /dev/null
@@ -1,253 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/mul_1.asm b/gmp/mpn/arm/v7a/cora15/mul_1.asm
deleted file mode 100644
index 766ba5c57f..0000000000
--- a/gmp/mpn/arm/v7a/cora15/mul_1.asm
+++ /dev/null
@@ -1,104 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm b/gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm
deleted file mode 100644
index d8cfe3f78f..0000000000
--- a/gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh1_n.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm b/gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm
deleted file mode 100644
index b48204d926..0000000000
--- a/gmp/mpn/arm/v7a/cora15/neon/aorsorrlsh2_n.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm b/gmp/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm
deleted file mode 100644
index 16c34a2699..0000000000
--- a/gmp/mpn/arm/v7a/cora15/neon/aorsorrlshC_n.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/neon/com.asm b/gmp/mpn/arm/v7a/cora15/neon/com.asm
deleted file mode 100644
index 9e7a629287..0000000000
--- a/gmp/mpn/arm/v7a/cora15/neon/com.asm
+++ /dev/null
@@ -1,97 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/neon/copyd.asm b/gmp/mpn/arm/v7a/cora15/neon/copyd.asm
deleted file mode 100644
index 98fe535def..0000000000
--- a/gmp/mpn/arm/v7a/cora15/neon/copyd.asm
+++ /dev/null
@@ -1,110 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/neon/copyi.asm b/gmp/mpn/arm/v7a/cora15/neon/copyi.asm
deleted file mode 100644
index 2e05afe5e8..0000000000
--- a/gmp/mpn/arm/v7a/cora15/neon/copyi.asm
+++ /dev/null
@@ -1,90 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/neon/rsh1aors_n.asm b/gmp/mpn/arm/v7a/cora15/neon/rsh1aors_n.asm
deleted file mode 100644
index 2c11d6debd..0000000000
--- a/gmp/mpn/arm/v7a/cora15/neon/rsh1aors_n.asm
+++ /dev/null
@@ -1,177 +0,0 @@
-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/gmp/mpn/arm/v7a/cora15/submul_1.asm b/gmp/mpn/arm/v7a/cora15/submul_1.asm
deleted file mode 100644
index ed7bfe820b..0000000000
--- a/gmp/mpn/arm/v7a/cora15/submul_1.asm
+++ /dev/null
@@ -1,159 +0,0 @@
-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/gmp/mpn/arm/v7a/cora9/gmp-mparam.h b/gmp/mpn/arm/v7a/cora9/gmp-mparam.h
deleted file mode 100644
index 9660257820..0000000000
--- a/gmp/mpn/arm/v7a/cora9/gmp-mparam.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* 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/gmp/mpn/arm64/aors_n.asm b/gmp/mpn/arm64/aors_n.asm
deleted file mode 100644
index a880cd35cf..0000000000
--- a/gmp/mpn/arm64/aors_n.asm
+++ /dev/null
@@ -1,98 +0,0 @@
-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/gmp/mpn/arm64/aorsmul_1.asm b/gmp/mpn/arm64/aorsmul_1.asm
deleted file mode 100644
index bf765a7f77..0000000000
--- a/gmp/mpn/arm64/aorsmul_1.asm
+++ /dev/null
@@ -1,122 +0,0 @@
-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/gmp/mpn/arm64/cnd_aors_n.asm b/gmp/mpn/arm64/cnd_aors_n.asm
deleted file mode 100644
index e7836500d5..0000000000
--- a/gmp/mpn/arm64/cnd_aors_n.asm
+++ /dev/null
@@ -1,99 +0,0 @@
-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/gmp/mpn/arm64/copyd.asm b/gmp/mpn/arm64/copyd.asm
deleted file mode 100644
index bb477716e5..0000000000
--- a/gmp/mpn/arm64/copyd.asm
+++ /dev/null
@@ -1,93 +0,0 @@
-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/gmp/mpn/arm64/copyi.asm b/gmp/mpn/arm64/copyi.asm
deleted file mode 100644
index 8f7dbd4f52..0000000000
--- a/gmp/mpn/arm64/copyi.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-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/gmp/mpn/arm64/gcd_1.asm b/gmp/mpn/arm64/gcd_1.asm
deleted file mode 100644
index d231dbcbb9..0000000000
--- a/gmp/mpn/arm64/gcd_1.asm
+++ /dev/null
@@ -1,125 +0,0 @@
-dnl ARM v6t2 mpn_gcd_1.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for ARM by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011-2013 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-changecom(@&*$)
-
-C cycles/bit (approx)
-C Cortex-A53 ?
-C Cortex-A57 ?
-
-C TODO
-C * Optimise inner-loop better.
-C * Push saving/restoring of callee-user regs into call code
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 7)
-
-C INPUT PARAMETERS
-define(`up', `x0')
-define(`n', `x1')
-define(`v0', `x2')
-
-ifdef(`BMOD_1_TO_MOD_1_THRESHOLD',,
- `define(`BMOD_1_TO_MOD_1_THRESHOLD',30)')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- stp x29, x30, [sp,#-32]!
- ldr x3, [up] C U low limb
- stp x19, x20, [sp,#16]
-
- orr x3, x3, v0
- rbit x4, x3
- clz x20, x4 C min(ctz(u0),ctz(v0))
-
- rbit x12, v0
- clz x12, x12
- lsr v0, v0, x12
-
- mov x19, v0
-
- cmp n, #1
- 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/gmp/mpn/arm64/invert_limb.asm b/gmp/mpn/arm64/invert_limb.asm
deleted file mode 100644
index 2302d047e5..0000000000
--- a/gmp/mpn/arm64/invert_limb.asm
+++ /dev/null
@@ -1,83 +0,0 @@
-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/gmp/mpn/arm64/logops_n.asm b/gmp/mpn/arm64/logops_n.asm
deleted file mode 100644
index 0f75700cfd..0000000000
--- a/gmp/mpn/arm64/logops_n.asm
+++ /dev/null
@@ -1,106 +0,0 @@
-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/gmp/mpn/arm64/mul_1.asm b/gmp/mpn/arm64/mul_1.asm
deleted file mode 100644
index c0c2570f0d..0000000000
--- a/gmp/mpn/arm64/mul_1.asm
+++ /dev/null
@@ -1,98 +0,0 @@
-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()
diff --git a/gmp/mpn/asm-defs.m4 b/gmp/mpn/asm-defs.m4
index e573cc4ca8..ee9626dd57 100644
--- a/gmp/mpn/asm-defs.m4
+++ b/gmp/mpn/asm-defs.m4
@@ -2,33 +2,23 @@ divert(-1)
dnl
dnl m4 macros for gmp assembly code, shared by all CPUs.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl These macros are designed for use with any m4 and have been used on
@@ -59,7 +49,7 @@ dnl
dnl But note that when a quoted string is being read, a # isn't special, so
dnl apostrophes in comments in quoted strings must be avoided or they'll be
dnl interpreted as a closing quote mark. But when the quoted text is
-dnl re-read # will still act like a normal comment, suppressing macro
+dnl re-read # will still act like a normal comment, supressing macro
dnl expansion.
dnl
dnl For example,
@@ -229,7 +219,7 @@ undefine(`m4_dollarhash_1_if_noparen_test')
dnl Usage: m4wrap_prepend(string)
dnl
-dnl Prepend the given string to what will be expanded under m4wrap at the
+dnl Prepend the given string to what will be exapanded under m4wrap at the
dnl end of input.
dnl
dnl This macro exists to work around variations in m4wrap() behaviour in
@@ -877,7 +867,7 @@ ifelse(eval($'`#>1 || m4_length('m4_doublequote($`'1)`)!=0),1,($'`@))')')
dnl Called: deflit_emptyargcheck(macroname,$#,`$1')
define(deflit_emptyargcheck,
`ifelse(eval($2==1 && !m4_dollarhash_1_if_noparen_p && m4_length(`$3')==0),1,
-`m4_error(`dont use a deflit as $1() because it loses the brackets (see deflit in asm-defs.m4 for more information)
+`m4_error(`dont use a deflit as $1() because it loses the brackets (see deflit in asm-incl.m4 for more information)
')')')
@@ -1064,18 +1054,6 @@ dnl aors_n
m4_not_for_expansion(`OPERATION_add_n')
m4_not_for_expansion(`OPERATION_sub_n')
-dnl aors_err1_n
-m4_not_for_expansion(`OPERATION_add_err1_n')
-m4_not_for_expansion(`OPERATION_sub_err1_n')
-
-dnl aors_err2_n
-m4_not_for_expansion(`OPERATION_add_err2_n')
-m4_not_for_expansion(`OPERATION_sub_err2_n')
-
-dnl aors_err3_n
-m4_not_for_expansion(`OPERATION_add_err3_n')
-m4_not_for_expansion(`OPERATION_sub_err3_n')
-
dnl aorsmul_1
m4_not_for_expansion(`OPERATION_addmul_1')
m4_not_for_expansion(`OPERATION_submul_1')
@@ -1101,12 +1079,6 @@ m4_not_for_expansion(`OPERATION_rshift')
dnl aorslsh1_n
m4_not_for_expansion(`OPERATION_addlsh1_n')
m4_not_for_expansion(`OPERATION_sublsh1_n')
-m4_not_for_expansion(`OPERATION_rsblsh1_n')
-
-dnl aorslsh2_n
-m4_not_for_expansion(`OPERATION_addlsh2_n')
-m4_not_for_expansion(`OPERATION_sublsh2_n')
-m4_not_for_expansion(`OPERATION_rsblsh2_n')
dnl rsh1aors_n
m4_not_for_expansion(`OPERATION_rsh1add_n')
@@ -1119,7 +1091,7 @@ dnl Check that `symbol' is defined. If it isn't, issue an error and
dnl terminate immediately. The error message explains that the symbol
dnl should be in config.m4, copied from gmp-mparam.h.
dnl
-dnl Termination is immediate since missing say SQR_TOOM2_THRESHOLD can
+dnl Termination is immediate since missing say SQR_KARATSUBA_THRESHOLD can
dnl lead to infinite loops and endless error messages.
define(m4_config_gmp_mparam,
@@ -1243,10 +1215,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 GMP_LIMB_BYTES*COUNT, the number of bytes
+dnl a bit mask. BYTES is BYTES_PER_MP_LIMB*COUNT, the number of bytes
dnl processed in each unrolled loop.
dnl
-dnl GMP_LIMB_BYTES is defined in a CPU specific m4 include file. It
+dnl BYTES_PER_MP_LIMB 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
@@ -1283,8 +1255,8 @@ m4_assert_defined(`UNROLL_COUNT')
deflit(UNROLL_BYTES,
m4_assert_defined(`UNROLL_COUNT')
-m4_assert_defined(`GMP_LIMB_BYTES')
-`eval(UNROLL_COUNT * GMP_LIMB_BYTES)')
+m4_assert_defined(`BYTES_PER_MP_LIMB')
+`eval(UNROLL_COUNT * BYTES_PER_MP_LIMB)')
deflit(CHUNK_LOG2,
m4_assert_defined(`CHUNK_COUNT')
@@ -1296,8 +1268,8 @@ m4_assert_defined(`CHUNK_COUNT')
deflit(CHUNK_BYTES,
m4_assert_defined(`CHUNK_COUNT')
-m4_assert_defined(`GMP_LIMB_BYTES')
-`eval(CHUNK_COUNT * GMP_LIMB_BYTES)')
+m4_assert_defined(`BYTES_PER_MP_LIMB')
+`eval(CHUNK_COUNT * BYTES_PER_MP_LIMB)')
dnl Usage: MPN(name)
@@ -1324,65 +1296,31 @@ dnl function that might be implemented in assembler is here.
define(define_mpn,
m4_assert_numargs(1)
-`deflit(`mpn_$1',`MPN(`$1')')')
+`define(`mpn_$1',`MPN(`$1')')')
define_mpn(add)
define_mpn(add_1)
-define_mpn(add_err1_n)
-define_mpn(add_err2_n)
-define_mpn(add_err3_n)
define_mpn(add_n)
define_mpn(add_nc)
define_mpn(addlsh1_n)
-define_mpn(addlsh1_nc)
-define_mpn(addlsh2_n)
-define_mpn(addlsh2_nc)
-define_mpn(addlsh_n)
-define_mpn(addlsh_nc)
-define_mpn(addlsh1_n_ip1)
-define_mpn(addlsh1_nc_ip1)
-define_mpn(addlsh2_n_ip1)
-define_mpn(addlsh2_nc_ip1)
-define_mpn(addlsh_n_ip1)
-define_mpn(addlsh_nc_ip1)
-define_mpn(addlsh1_n_ip2)
-define_mpn(addlsh1_nc_ip2)
-define_mpn(addlsh2_n_ip2)
-define_mpn(addlsh2_nc_ip2)
-define_mpn(addlsh_n_ip2)
-define_mpn(addlsh_nc_ip2)
define_mpn(addmul_1)
define_mpn(addmul_1c)
define_mpn(addmul_2)
define_mpn(addmul_3)
define_mpn(addmul_4)
-define_mpn(addmul_5)
-define_mpn(addmul_6)
-define_mpn(addmul_7)
-define_mpn(addmul_8)
-define_mpn(addmul_2s)
-define_mpn(add_n_sub_n)
-define_mpn(add_n_sub_nc)
+define_mpn(addsub_n)
+define_mpn(addsub_nc)
define_mpn(addaddmul_1msb0)
define_mpn(and_n)
define_mpn(andn_n)
-define_mpn(bdiv_q_1)
-define_mpn(pi1_bdiv_q_1)
define_mpn(bdiv_dbm1c)
+define_mpn(bdivmod)
define_mpn(cmp)
-define_mpn(cnd_add_n)
-define_mpn(cnd_sub_n)
-define_mpn(com)
+define_mpn(com_n)
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)
-define_mpn(div_qr_2n_pi2)
-define_mpn(div_qr_2u_pi2)
define_mpn(divexact_1)
define_mpn(divexact_by3c)
define_mpn(divrem)
@@ -1398,19 +1336,16 @@ define_mpn(gcdext)
define_mpn(get_str)
define_mpn(hamdist)
define_mpn(invert_limb)
-define_mpn(invert_limb_table)
define_mpn(ior_n)
define_mpn(iorn_n)
+define_mpn(kara_mul_n)
+define_mpn(kara_sqr_n)
define_mpn(lshift)
define_mpn(lshiftc)
-define_mpn(mod_1_1p)
-define_mpn(mod_1_1p_cps)
-define_mpn(mod_1s_2p)
-define_mpn(mod_1s_2p_cps)
-define_mpn(mod_1s_3p)
-define_mpn(mod_1s_3p_cps)
-define_mpn(mod_1s_4p)
-define_mpn(mod_1s_4p_cps)
+define_mpn(mod_1_1)
+define_mpn(mod_1_2)
+define_mpn(mod_1_3)
+define_mpn(mod_1_4)
define_mpn(mod_1)
define_mpn(mod_1c)
define_mpn(mod_34lsub1)
@@ -1422,18 +1357,14 @@ define_mpn(mul_1c)
define_mpn(mul_2)
define_mpn(mul_3)
define_mpn(mul_4)
-define_mpn(mul_5)
-define_mpn(mul_6)
define_mpn(mul_basecase)
define_mpn(mul_n)
-define_mpn(mullo_basecase)
-define_mpn(mulmid_basecase)
define_mpn(perfect_square_p)
define_mpn(popcount)
define_mpn(preinv_divrem_1)
define_mpn(preinv_mod_1)
define_mpn(nand_n)
-define_mpn(neg)
+define_mpn(neg_n)
define_mpn(nior_n)
define_mpn(powm)
define_mpn(powlo)
@@ -1441,16 +1372,8 @@ define_mpn(random)
define_mpn(random2)
define_mpn(redc_1)
define_mpn(redc_2)
-define_mpn(rsblsh1_n)
-define_mpn(rsblsh1_nc)
-define_mpn(rsblsh2_n)
-define_mpn(rsblsh2_nc)
-define_mpn(rsblsh_n)
-define_mpn(rsblsh_nc)
define_mpn(rsh1add_n)
-define_mpn(rsh1add_nc)
define_mpn(rsh1sub_n)
-define_mpn(rsh1sub_nc)
define_mpn(rshift)
define_mpn(rshiftc)
define_mpn(scan0)
@@ -1458,31 +1381,17 @@ define_mpn(scan1)
define_mpn(set_str)
define_mpn(sqr_basecase)
define_mpn(sqr_diagonal)
-define_mpn(sqr_diag_addlsh1)
define_mpn(sub_n)
define_mpn(sublsh1_n)
-define_mpn(sublsh1_nc)
-define_mpn(sublsh1_n_ip1)
-define_mpn(sublsh1_nc_ip1)
-define_mpn(sublsh2_n)
-define_mpn(sublsh2_nc)
-define_mpn(sublsh2_n_ip1)
-define_mpn(sublsh2_nc_ip1)
-define_mpn(sublsh_n)
-define_mpn(sublsh_nc)
-define_mpn(sublsh_n_ip1)
-define_mpn(sublsh_nc_ip1)
define_mpn(sqrtrem)
define_mpn(sub)
define_mpn(sub_1)
-define_mpn(sub_err1_n)
-define_mpn(sub_err2_n)
-define_mpn(sub_err3_n)
define_mpn(sub_n)
define_mpn(sub_nc)
define_mpn(submul_1)
define_mpn(submul_1c)
-define_mpn(sec_tabselect)
+define_mpn(toom3_mul_n)
+define_mpn(toom3_sqr_n)
define_mpn(umul_ppmm)
define_mpn(umul_ppmm_r)
define_mpn(udiv_qrnnd)
@@ -1724,22 +1633,6 @@ m4_assert_numargs(1)
)
-dnl Usage: ABI_SUPPORT(abi)
-dnl
-dnl A dummy macro which is grepped for by ./configure to know what ABIs
-dnl are supported in an asm file.
-dnl
-dnl If multiple non-standard ABIs are supported, several ABI_SUPPORT
-dnl declarations should be used:
-dnl
-dnl ABI_SUPPORT(FOOABI)
-dnl ABI_SUPPORT(BARABI)
-
-define(ABI_SUPPORT,
-m4_assert_numargs(1)
-)
-
-
dnl Usage: GMP_NUMB_MASK
dnl
dnl A bit mask for the number part of a limb. Eg. with 6 bit nails in a
@@ -1751,11 +1644,4 @@ m4_assert_defined(`GMP_NUMB_BITS')
`m4_hex_lowmask(GMP_NUMB_BITS)')
-dnl Usage: m4append(`variable',`value-to-append')
-
-define(`m4append',
-`define(`$1', defn(`$1')`$2')
-'
-)
-
divert`'dnl
diff --git a/gmp/mpn/clipper/add_n.s b/gmp/mpn/clipper/add_n.s
new file mode 100644
index 0000000000..225b95042c
--- /dev/null
+++ b/gmp/mpn/clipper/add_n.s
@@ -0,0 +1,46 @@
+; 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/gmp/mpn/clipper/mul_1.s b/gmp/mpn/clipper/mul_1.s
new file mode 100644
index 0000000000..058a317617
--- /dev/null
+++ b/gmp/mpn/clipper/mul_1.s
@@ -0,0 +1,45 @@
+; 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/gmp/mpn/clipper/sub_n.s b/gmp/mpn/clipper/sub_n.s
new file mode 100644
index 0000000000..58c2cb3342
--- /dev/null
+++ b/gmp/mpn/clipper/sub_n.s
@@ -0,0 +1,46 @@
+; 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
diff --git a/gmp/mpn/cpp-ccas b/gmp/mpn/cpp-ccas
index 25f7cdcbeb..fd62f902d1 100755
--- a/gmp/mpn/cpp-ccas
+++ b/gmp/mpn/cpp-ccas
@@ -4,31 +4,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: cpp-cc --cpp=CPP CC ... file.S ...
diff --git a/gmp/mpn/cray/README b/gmp/mpn/cray/README
index 3a347d2805..ab3b032706 100644
--- a/gmp/mpn/cray/README
+++ b/gmp/mpn/cray/README
@@ -1,30 +1,19 @@
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -45,7 +34,7 @@ systems with cfp floating point, the main obstacle is the forming of
128-bit products. For IEEE systems, adding, and in particular
computing carry is the main issue. There are no vectorizing
unsigned-less-than instructions, and the sequence that implement that
-operation is very long.
+opetration is very long.
Shifting is the only operation that is simple to make fast. All Cray
systems have a bitblt instructions (Vi Vj,Vj<Ak and Vi Vj,Vj>Ak) that
@@ -118,4 +107,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
-rounding operand sizes up to the next power of 2.)
+rouding operand sizes up to the next power of 2.)
diff --git a/gmp/mpn/cray/add_n.c b/gmp/mpn/cray/add_n.c
index 65b53bf87a..e4f8a0da9b 100644
--- a/gmp/mpn/cray/add_n.c
+++ b/gmp/mpn/cray/add_n.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 code runs at 4 cycles/limb. It may be possible to bring it down
to 3 cycles/limb. */
diff --git a/gmp/mpn/cray/cfp/addmul_1.c b/gmp/mpn/cray/cfp/addmul_1.c
index e1d52e4a5f..c981b3d3a8 100644
--- a/gmp/mpn/cray/cfp/addmul_1.c
+++ b/gmp/mpn/cray/cfp/addmul_1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/cray/cfp/mul_1.c b/gmp/mpn/cray/cfp/mul_1.c
index 611a9d2532..5038e93fef 100644
--- a/gmp/mpn/cray/cfp/mul_1.c
+++ b/gmp/mpn/cray/cfp/mul_1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/cray/cfp/mulwwc90.s b/gmp/mpn/cray/cfp/mulwwc90.s
index 71d2285fd7..3234913c10 100644
--- a/gmp/mpn/cray/cfp/mulwwc90.s
+++ b/gmp/mpn/cray/cfp/mulwwc90.s
@@ -1,33 +1,22 @@
-* 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 either:
-*
-* * the GNU Lesser General Public License as published by the Free
-* Software Foundation; either version 3 of the License, or (at your
-* option) any later version.
-*
-* or
-*
-* * the GNU General Public License as published by the Free Software
-* Foundation; either version 2 of the License, or (at your option) any
-* later version.
-*
-* or both in parallel, as here.
-*
-* The GNU MP Library is distributed in the hope that 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/.
+* This file is part of the GNU MP Library.
+
+* The GNU MP Library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU 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/.
IDENT GMPN_MULWW
**********************************************
diff --git a/gmp/mpn/cray/cfp/mulwwj90.s b/gmp/mpn/cray/cfp/mulwwj90.s
index 1c2c7cddbe..94d391c2f9 100644
--- a/gmp/mpn/cray/cfp/mulwwj90.s
+++ b/gmp/mpn/cray/cfp/mulwwj90.s
@@ -1,33 +1,22 @@
-* 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 either:
-*
-* * the GNU Lesser General Public License as published by the Free
-* Software Foundation; either version 3 of the License, or (at your
-* option) any later version.
-*
-* or
-*
-* * the GNU General Public License as published by the Free Software
-* Foundation; either version 2 of the License, or (at your option) any
-* later version.
-*
-* or both in parallel, as here.
-*
-* The GNU MP Library is distributed in the hope that 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/.
+* This file is part of the GNU MP Library.
+
+* The GNU MP Library is free software; you can redistribute it and/or
+* modify it under the terms of the GNU 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/.
IDENT GMPN_MULWW
**********************************************
diff --git a/gmp/mpn/cray/cfp/submul_1.c b/gmp/mpn/cray/cfp/submul_1.c
index b44c97df45..0507d0ef2e 100644
--- a/gmp/mpn/cray/cfp/submul_1.c
+++ b/gmp/mpn/cray/cfp/submul_1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/cray/gmp-mparam.h b/gmp/mpn/cray/gmp-mparam.h
index ea8c25b32e..72dcb627da 100644
--- a/gmp/mpn/cray/gmp-mparam.h
+++ b/gmp/mpn/cray/gmp-mparam.h
@@ -1,35 +1,25 @@
/* Cray T90 CFP gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1996, 2000-2004 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
#if 0
#define UMUL_TIME 519
@@ -40,11 +30,11 @@ see https://www.gnu.org/licenses/. */
/* Generated by tuneup.c, 2004-02-07, system compiler */
-#define MUL_TOOM22_THRESHOLD 71
-#define MUL_TOOM33_THRESHOLD 131
+#define MUL_KARATSUBA_THRESHOLD 71
+#define MUL_TOOM3_THRESHOLD 131
#define SQR_BASECASE_THRESHOLD 32
-#define SQR_TOOM2_THRESHOLD 199
+#define SQR_KARATSUBA_THRESHOLD 199
#define SQR_TOOM3_THRESHOLD 363
#define DIV_SB_PREINV_THRESHOLD 0 /* (preinv always) */
diff --git a/gmp/mpn/cray/hamdist.c b/gmp/mpn/cray/hamdist.c
index 8eb9ba018c..d80b4d6324 100644
--- a/gmp/mpn/cray/hamdist.c
+++ b/gmp/mpn/cray/hamdist.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <intrinsics.h>
#include "gmp.h"
diff --git a/gmp/mpn/cray/ieee/addmul_1.c b/gmp/mpn/cray/ieee/addmul_1.c
index 6318b7c9c2..158a79cba8 100644
--- a/gmp/mpn/cray/ieee/addmul_1.c
+++ b/gmp/mpn/cray/ieee/addmul_1.c
@@ -1,33 +1,22 @@
/* Cray PVP/IEEE mpn_addmul_1 -- multiply a limb vector with a limb and add the
result to a second limb vector.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 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
diff --git a/gmp/mpn/cray/ieee/gmp-mparam.h b/gmp/mpn/cray/ieee/gmp-mparam.h
index 1fdc286574..03d655c814 100644
--- a/gmp/mpn/cray/ieee/gmp-mparam.h
+++ b/gmp/mpn/cray/ieee/gmp-mparam.h
@@ -1,44 +1,33 @@
/* Cray T90 IEEE gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1996, 2000-2002, 2004 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
/* Generated by tuneup.c, 2004-02-07, system compiler */
-#define MUL_TOOM22_THRESHOLD 130
-#define MUL_TOOM33_THRESHOLD 260
+#define MUL_KARATSUBA_THRESHOLD 130
+#define MUL_TOOM3_THRESHOLD 260
#define SQR_BASECASE_THRESHOLD 9 /* karatsuba */
-#define SQR_TOOM2_THRESHOLD 0 /* never sqr_basecase */
+#define SQR_KARATSUBA_THRESHOLD 0 /* never sqr_basecase */
#define SQR_TOOM3_THRESHOLD 34
#define DIV_SB_PREINV_THRESHOLD 0 /* preinv always */
diff --git a/gmp/mpn/cray/ieee/invert_limb.c b/gmp/mpn/cray/ieee/invert_limb.c
index f951a6e138..e3484a9153 100644
--- a/gmp/mpn/cray/ieee/invert_limb.c
+++ b/gmp/mpn/cray/ieee/invert_limb.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -84,14 +73,14 @@ mpn_invert_limb (mp_limb_t d)
mp_limb_t xh, xl;
mp_limb_t zh, zl;
-#if GMP_LIMB_BITS == 32
+#if BITS_PER_MP_LIMB == 32
z = approx_tab[(d >> 23) - 0x100] << 6; /* z < 2^16 */
z2l = z * z; /* z2l < 2^32 */
umul_ppmm (th, tl, z2l, d);
z = (z << 17) - (th << 1);
#endif
-#if GMP_LIMB_BITS == 64
+#if BITS_PER_MP_LIMB == 64
z = approx_tab[(d >> 55) - 0x100] << 6; /* z < 2^16 */
z2l = z * z; /* z2l < 2^32 */
@@ -108,7 +97,7 @@ mpn_invert_limb (mp_limb_t d)
umul_ppmm (xh, xl, z2l, d);
tl += xh;
th += tl < xh;
- th = (th << 2) | (tl >> GMP_LIMB_BITS - 2);
+ th = (th << 2) | (tl >> BITS_PER_MP_LIMB - 2);
tl = tl << 2;
sub_ddmmss (zh, zl, z << 2, 0, th, tl);
diff --git a/gmp/mpn/cray/ieee/mul_1.c b/gmp/mpn/cray/ieee/mul_1.c
index dad09fa8cf..4dc2fd9dec 100644
--- a/gmp/mpn/cray/ieee/mul_1.c
+++ b/gmp/mpn/cray/ieee/mul_1.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 code runs at 5 cycles/limb on a T90. That would probably
be hard to improve upon, even with assembly code. */
diff --git a/gmp/mpn/cray/ieee/mul_basecase.c b/gmp/mpn/cray/ieee/mul_basecase.c
index 6dc845dd99..ea32db312e 100644
--- a/gmp/mpn/cray/ieee/mul_basecase.c
+++ b/gmp/mpn/cray/ieee/mul_basecase.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 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. */
diff --git a/gmp/mpn/cray/ieee/sqr_basecase.c b/gmp/mpn/cray/ieee/sqr_basecase.c
index 840d3dd260..92a9a0e14f 100644
--- a/gmp/mpn/cray/ieee/sqr_basecase.c
+++ b/gmp/mpn/cray/ieee/sqr_basecase.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 is just mpn_mul_basecase with trivial modifications. */
diff --git a/gmp/mpn/cray/ieee/submul_1.c b/gmp/mpn/cray/ieee/submul_1.c
index 27a1939019..4d7a6b47cd 100644
--- a/gmp/mpn/cray/ieee/submul_1.c
+++ b/gmp/mpn/cray/ieee/submul_1.c
@@ -1,33 +1,22 @@
/* Cray PVP/IEEE mpn_submul_1 -- multiply a limb vector with a limb and
subtract the result from a second limb vector.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 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
diff --git a/gmp/mpn/cray/lshift.c b/gmp/mpn/cray/lshift.c
index 074f38041a..64302e9d39 100644
--- a/gmp/mpn/cray/lshift.c
+++ b/gmp/mpn/cray/lshift.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <intrinsics.h>
#include "gmp.h"
@@ -40,7 +29,7 @@ mpn_lshift (mp_ptr wp, mp_srcptr up, mp_size_t n, unsigned int cnt)
mp_limb_t retval;
sh_1 = cnt;
- sh_2 = GMP_LIMB_BITS - sh_1;
+ sh_2 = BITS_PER_MP_LIMB - sh_1;
retval = up[n - 1] >> sh_2;
#pragma _CRI ivdep
diff --git a/gmp/mpn/cray/mulww.f b/gmp/mpn/cray/mulww.f
index 9bddf05bc9..e0bf96e441 100644
--- a/gmp/mpn/cray/mulww.f
+++ b/gmp/mpn/cray/mulww.f
@@ -1,36 +1,25 @@
-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
+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
subroutine gmpn_mulww(p1,p0,a,n,s)
integer*8 p1(0:*),p0(0:*),a(0:*),s
diff --git a/gmp/mpn/cray/popcount.c b/gmp/mpn/cray/popcount.c
index 48ddab875e..3abdce85cc 100644
--- a/gmp/mpn/cray/popcount.c
+++ b/gmp/mpn/cray/popcount.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <intrinsics.h>
#include "gmp.h"
diff --git a/gmp/mpn/cray/rshift.c b/gmp/mpn/cray/rshift.c
index 424bede9db..6280d2ca7e 100644
--- a/gmp/mpn/cray/rshift.c
+++ b/gmp/mpn/cray/rshift.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <intrinsics.h>
#include "gmp.h"
@@ -40,7 +29,7 @@ mpn_rshift (mp_ptr wp, mp_srcptr up, mp_size_t n, unsigned int cnt)
mp_limb_t retval;
sh_1 = cnt;
- sh_2 = GMP_LIMB_BITS - sh_1;
+ sh_2 = BITS_PER_MP_LIMB - sh_1;
retval = up[0] << sh_2;
#pragma _CRI ivdep
diff --git a/gmp/mpn/cray/sub_n.c b/gmp/mpn/cray/sub_n.c
index 0cc9ad1e04..90a5f1b1e8 100644
--- a/gmp/mpn/cray/sub_n.c
+++ b/gmp/mpn/cray/sub_n.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 code runs at 4 cycles/limb. It may be possible to bring it down
to 3 cycles/limb. */
diff --git a/gmp/mpn/generic/add.c b/gmp/mpn/generic/add.c
index 559f26133c..8065ccf3c2 100644
--- a/gmp/mpn/generic/add.c
+++ b/gmp/mpn/generic/add.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpn_add 1
diff --git a/gmp/mpn/generic/add_1.c b/gmp/mpn/generic/add_1.c
index ca2d866852..2d3fa76c2e 100644
--- a/gmp/mpn/generic/add_1.c
+++ b/gmp/mpn/generic/add_1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpn_add_1 1
diff --git a/gmp/mpn/generic/add_err1_n.c b/gmp/mpn/generic/add_err1_n.c
deleted file mode 100644
index b8cb75f6e8..0000000000
--- a/gmp/mpn/generic/add_err1_n.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* mpn_add_err1_n -- add_n with one error term
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- Computes:
-
- (1) {rp,n} := {up,n} + {vp,n} (just like mpn_add_n) with incoming carry cy,
- return value is carry out.
-
- (2) Let c[i+1] = carry from i-th limb addition (c[0] = cy).
- Computes c[1]*yp[n-1] + ... + c[n]*yp[0], stores two-limb result at ep.
-
- Requires n >= 1.
-
- None of the outputs may overlap each other or any of the inputs, except
- that {rp,n} may be equal to {up,n} or {vp,n}.
-*/
-mp_limb_t
-mpn_add_err1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_ptr ep, mp_srcptr yp,
- mp_size_t n, mp_limb_t cy)
-{
- mp_limb_t el, eh, ul, vl, yl, zl, rl, sl, cy1, cy2;
-
- ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, up, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, vp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, yp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, rp, n));
-
- yp += n - 1;
- el = eh = 0;
-
- do
- {
- yl = *yp--;
- ul = *up++;
- vl = *vp++;
-
- /* ordinary add_n */
- ADDC_LIMB (cy1, sl, ul, vl);
- ADDC_LIMB (cy2, rl, sl, cy);
- cy = cy1 | cy2;
- *rp++ = rl;
-
- /* update (eh:el) */
- zl = (-cy) & yl;
- el += zl;
- eh += el < zl;
- }
- while (--n);
-
-#if GMP_NAIL_BITS != 0
- eh = (eh << GMP_NAIL_BITS) + (el >> GMP_NUMB_BITS);
- el &= GMP_NUMB_MASK;
-#endif
-
- ep[0] = el;
- ep[1] = eh;
-
- return cy;
-}
diff --git a/gmp/mpn/generic/add_err2_n.c b/gmp/mpn/generic/add_err2_n.c
deleted file mode 100644
index 4b0242a32d..0000000000
--- a/gmp/mpn/generic/add_err2_n.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* mpn_add_err2_n -- add_n with two error terms
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- Computes:
-
- (1) {rp,n} := {up,n} + {vp,n} (just like mpn_add_n) with incoming carry cy,
- return value is carry out.
-
- (2) Let c[i+1] = carry from i-th limb addition (c[0] = cy).
- Computes c[1]*yp1[n-1] + ... + c[n]*yp1[0],
- c[1]*yp2[n-1] + ... + c[n]*yp2[0],
- stores two-limb results at {ep,2} and {ep+2,2} respectively.
-
- Requires n >= 1.
-
- None of the outputs may overlap each other or any of the inputs, except
- that {rp,n} may be equal to {up,n} or {vp,n}.
-*/
-mp_limb_t
-mpn_add_err2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_ptr ep, mp_srcptr yp1, mp_srcptr yp2,
- mp_size_t n, mp_limb_t cy)
-{
- mp_limb_t el1, eh1, el2, eh2, ul, vl, yl1, yl2, zl1, zl2, rl, sl, cy1, cy2;
-
- ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp1, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp2, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, up, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, vp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, yp1, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, yp2, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, rp, n));
-
- yp1 += n - 1;
- yp2 += n - 1;
- el1 = eh1 = 0;
- el2 = eh2 = 0;
-
- do
- {
- yl1 = *yp1--;
- yl2 = *yp2--;
- ul = *up++;
- vl = *vp++;
-
- /* ordinary add_n */
- ADDC_LIMB (cy1, sl, ul, vl);
- ADDC_LIMB (cy2, rl, sl, cy);
- cy = cy1 | cy2;
- *rp++ = rl;
-
- /* update (eh1:el1) */
- zl1 = (-cy) & yl1;
- el1 += zl1;
- eh1 += el1 < zl1;
-
- /* update (eh2:el2) */
- zl2 = (-cy) & yl2;
- el2 += zl2;
- eh2 += el2 < zl2;
- }
- while (--n);
-
-#if GMP_NAIL_BITS != 0
- eh1 = (eh1 << GMP_NAIL_BITS) + (el1 >> GMP_NUMB_BITS);
- el1 &= GMP_NUMB_MASK;
- eh2 = (eh2 << GMP_NAIL_BITS) + (el2 >> GMP_NUMB_BITS);
- el2 &= GMP_NUMB_MASK;
-#endif
-
- ep[0] = el1;
- ep[1] = eh1;
- ep[2] = el2;
- ep[3] = eh2;
-
- return cy;
-}
diff --git a/gmp/mpn/generic/add_err3_n.c b/gmp/mpn/generic/add_err3_n.c
deleted file mode 100644
index 28cd7facf9..0000000000
--- a/gmp/mpn/generic/add_err3_n.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* mpn_add_err3_n -- add_n with three error terms
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- Computes:
-
- (1) {rp,n} := {up,n} + {vp,n} (just like mpn_add_n) with incoming carry cy,
- return value is carry out.
-
- (2) Let c[i+1] = carry from i-th limb addition (c[0] = cy).
- Computes c[1]*yp1[n-1] + ... + c[n]*yp1[0],
- c[1]*yp2[n-1] + ... + c[n]*yp2[0],
- c[1]*yp3[n-1] + ... + c[n]*yp3[0],
- stores two-limb results at {ep,2}, {ep+2,2} and {ep+4,2} respectively.
-
- Requires n >= 1.
-
- None of the outputs may overlap each other or any of the inputs, except
- that {rp,n} may be equal to {up,n} or {vp,n}.
-*/
-mp_limb_t
-mpn_add_err3_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_ptr ep, mp_srcptr yp1, mp_srcptr yp2, mp_srcptr yp3,
- mp_size_t n, mp_limb_t cy)
-{
- mp_limb_t el1, eh1, el2, eh2, el3, eh3, ul, vl, yl1, yl2, yl3, zl1, zl2, zl3, rl, sl, cy1, cy2;
-
- ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp1, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp2, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp3, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, up, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, vp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, yp1, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, yp2, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, yp3, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, rp, n));
-
- yp1 += n - 1;
- yp2 += n - 1;
- yp3 += n - 1;
- el1 = eh1 = 0;
- el2 = eh2 = 0;
- el3 = eh3 = 0;
-
- do
- {
- yl1 = *yp1--;
- yl2 = *yp2--;
- yl3 = *yp3--;
- ul = *up++;
- vl = *vp++;
-
- /* ordinary add_n */
- ADDC_LIMB (cy1, sl, ul, vl);
- ADDC_LIMB (cy2, rl, sl, cy);
- cy = cy1 | cy2;
- *rp++ = rl;
-
- /* update (eh1:el1) */
- zl1 = (-cy) & yl1;
- el1 += zl1;
- eh1 += el1 < zl1;
-
- /* update (eh2:el2) */
- zl2 = (-cy) & yl2;
- el2 += zl2;
- eh2 += el2 < zl2;
-
- /* update (eh3:el3) */
- zl3 = (-cy) & yl3;
- el3 += zl3;
- eh3 += el3 < zl3;
- }
- while (--n);
-
-#if GMP_NAIL_BITS != 0
- eh1 = (eh1 << GMP_NAIL_BITS) + (el1 >> GMP_NUMB_BITS);
- el1 &= GMP_NUMB_MASK;
- eh2 = (eh2 << GMP_NAIL_BITS) + (el2 >> GMP_NUMB_BITS);
- el2 &= GMP_NUMB_MASK;
- eh3 = (eh3 << GMP_NAIL_BITS) + (el3 >> GMP_NUMB_BITS);
- el3 &= GMP_NUMB_MASK;
-#endif
-
- ep[0] = el1;
- ep[1] = eh1;
- ep[2] = el2;
- ep[3] = eh2;
- ep[4] = el3;
- ep[5] = eh3;
-
- return cy;
-}
diff --git a/gmp/mpn/generic/add_n.c b/gmp/mpn/generic/add_n.c
index 1a07670900..5006e27780 100644
--- a/gmp/mpn/generic/add_n.c
+++ b/gmp/mpn/generic/add_n.c
@@ -1,32 +1,21 @@
/* mpn_add_n -- Add equal length limb vectors.
-Copyright 1992-1994, 1996, 2000, 2002, 2009 Free Software Foundation, Inc.
+Copyright 1992, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,8 +29,8 @@ mpn_add_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
mp_limb_t ul, vl, sl, rl, cy, cy1, cy2;
ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_INCR_P (rp, up, n));
- ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
cy = 0;
do
@@ -70,8 +59,8 @@ mpn_add_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
mp_limb_t ul, vl, rl, cy;
ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_INCR_P (rp, up, n));
- ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
cy = 0;
do
diff --git a/gmp/mpn/generic/addmul_1.c b/gmp/mpn/generic/addmul_1.c
index d76b4ad135..861e1bc830 100644
--- a/gmp/mpn/generic/addmul_1.c
+++ b/gmp/mpn/generic/addmul_1.c
@@ -3,33 +3,23 @@
pointed to by RP. Return the most significant limb of the product,
adjusted for carry-out from the addition.
-Copyright 1992-1994, 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
+Copyright 1992, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/add_n_sub_n.c b/gmp/mpn/generic/addsub_n.c
index 012eb3e33a..452cf7b211 100644
--- a/gmp/mpn/generic/add_n_sub_n.c
+++ b/gmp/mpn/generic/addsub_n.c
@@ -1,36 +1,25 @@
-/* mpn_add_n_sub_n -- Add and Subtract two limb vectors of equal, non-zero length.
+/* mpn_addsub_n -- Add and Subtract two limb vectors of equal, non-zero length.
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
GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1999-2001, 2006 Free Software Foundation, Inc.
+Copyright 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -39,16 +28,16 @@ see https://www.gnu.org/licenses/. */
#define L1_CACHE_SIZE 8192 /* only 68040 has less than this */
#endif
-#define PART_SIZE (L1_CACHE_SIZE / GMP_LIMB_BYTES / 6)
+#define PART_SIZE (L1_CACHE_SIZE / BYTES_PER_MP_LIMB / 6)
-/* mpn_add_n_sub_n.
+/* mpn_addsub_n.
r1[] = s1[] + s2[]
r2[] = s1[] - s2[]
All operands have n limbs.
In-place operations allowed. */
mp_limb_t
-mpn_add_n_sub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t n)
+mpn_addsub_n (mp_ptr r1p, mp_ptr r2p, mp_srcptr s1p, mp_srcptr s2p, mp_size_t n)
{
mp_limb_t acyn, acyo; /* carry for add */
mp_limb_t scyn, scyo; /* carry for subtract */
@@ -153,19 +142,19 @@ main (int argc, char **argv)
n = strtol (argv[1], 0, 0);
- r1p = malloc (n * GMP_LIMB_BYTES);
- r2p = malloc (n * GMP_LIMB_BYTES);
- s1p = malloc (n * GMP_LIMB_BYTES);
- s2p = malloc (n * GMP_LIMB_BYTES);
+ 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);
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));
+ TIME (t,mpn_addsub_n(r1p,r2p,s1p,s2p,n));
printf ("combined addsub separate variables: %.3f\n", t);
- TIME (t,mpn_add_n_sub_n(r1p,r2p,r1p,s2p,n));
+ TIME (t,mpn_addsub_n(r1p,r2p,r1p,s2p,n));
printf (" combined addsub r1 overlap: %.3f\n", t);
- TIME (t,mpn_add_n_sub_n(r1p,r2p,r1p,s2p,n));
+ TIME (t,mpn_addsub_n(r1p,r2p,r1p,s2p,n));
printf (" combined addsub r2 overlap: %.3f\n", t);
- TIME (t,mpn_add_n_sub_n(r1p,r2p,r1p,r2p,n));
+ TIME (t,mpn_addsub_n(r1p,r2p,r1p,r2p,n));
printf (" combined addsub in-place: %.3f\n", t);
return 0;
diff --git a/gmp/mpn/generic/bdiv_dbm1c.c b/gmp/mpn/generic/bdiv_dbm1c.c
index 22c3cfd2c8..23cb6f1c9e 100644
--- a/gmp/mpn/generic/bdiv_dbm1c.c
+++ b/gmp/mpn/generic/bdiv_dbm1c.c
@@ -10,28 +10,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/bdiv_q.c b/gmp/mpn/generic/bdiv_q.c
deleted file mode 100644
index 1fc1bb7c09..0000000000
--- a/gmp/mpn/generic/bdiv_q.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* mpn_bdiv_q -- Hensel division with precomputed inverse, returning quotient.
-
- 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 GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-/* Computes Q = N / D mod B^n. */
-
-void
-mpn_bdiv_q (mp_ptr qp,
- mp_srcptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_ptr tp)
-{
- mp_limb_t di;
-
- if (BELOW_THRESHOLD (dn, DC_BDIV_Q_THRESHOLD))
- {
- MPN_COPY (tp, np, nn);
- binvert_limb (di, dp[0]); di = -di;
- mpn_sbpi1_bdiv_q (qp, tp, nn, dp, dn, di);
- }
- else if (BELOW_THRESHOLD (dn, MU_BDIV_Q_THRESHOLD))
- {
- MPN_COPY (tp, np, nn);
- binvert_limb (di, dp[0]); di = -di;
- mpn_dcpi1_bdiv_q (qp, tp, nn, dp, dn, di);
- }
- else
- {
- mpn_mu_bdiv_q (qp, np, nn, dp, dn, tp);
- }
- return;
-}
-
-mp_size_t
-mpn_bdiv_q_itch (mp_size_t nn, mp_size_t dn)
-{
- if (BELOW_THRESHOLD (dn, MU_BDIV_Q_THRESHOLD))
- return nn;
- else
- return mpn_mu_bdiv_q_itch (nn, dn);
-}
diff --git a/gmp/mpn/generic/bdiv_q_1.c b/gmp/mpn/generic/bdiv_q_1.c
deleted file mode 100644
index 74b247d5a9..0000000000
--- a/gmp/mpn/generic/bdiv_q_1.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* mpn_bdiv_q_1, mpn_pi1_bdiv_q_1 -- schoolbook Hensel division by 1-limb
- divisor, returning quotient only.
-
- THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE ONLY. THEY'RE ALMOST
- CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
- FUTURE GNU MP RELEASES.
-
-Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-mp_limb_t
-mpn_pi1_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d,
- mp_limb_t di, int shift)
-{
- mp_size_t i;
- mp_limb_t c, h, l, u, u_next, dummy;
-
- ASSERT (n >= 1);
- ASSERT (d != 0);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT_MPN (up, n);
- ASSERT_LIMB (d);
-
- d <<= GMP_NAIL_BITS;
-
- if (shift != 0)
- {
- c = 0;
-
- u = up[0];
- rp--;
- for (i = 1; i < n; i++)
- {
- u_next = up[i];
- u = ((u >> shift) | (u_next << (GMP_NUMB_BITS-shift))) & GMP_NUMB_MASK;
-
- SUBC_LIMB (c, l, u, c);
-
- l = (l * di) & GMP_NUMB_MASK;
- rp[i] = l;
-
- umul_ppmm (h, dummy, l, d);
- c += h;
- u = u_next;
- }
-
- u = u >> shift;
- l = u - c;
- l = (l * di) & GMP_NUMB_MASK;
- rp[i] = l;
- }
- else
- {
- u = up[0];
- l = (u * di) & GMP_NUMB_MASK;
- rp[0] = l;
- c = 0;
-
- for (i = 1; i < n; i++)
- {
- umul_ppmm (h, dummy, l, d);
- c += h;
-
- u = up[i];
- SUBC_LIMB (c, l, u, c);
-
- l = (l * di) & GMP_NUMB_MASK;
- rp[i] = l;
- }
- }
-
- return c;
-}
-
-mp_limb_t
-mpn_bdiv_q_1 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_limb_t d)
-{
- mp_limb_t di;
- int shift;
-
- ASSERT (n >= 1);
- ASSERT (d != 0);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT_MPN (up, n);
- ASSERT_LIMB (d);
-
- if ((d & 1) == 0)
- {
- count_trailing_zeros (shift, d);
- d >>= shift;
- }
- else
- shift = 0;
-
- binvert_limb (di, d);
- return mpn_pi1_bdiv_q_1 (rp, up, n, d, di, shift);
-}
diff --git a/gmp/mpn/generic/bdiv_qr.c b/gmp/mpn/generic/bdiv_qr.c
deleted file mode 100644
index 6a5eedbbc2..0000000000
--- a/gmp/mpn/generic/bdiv_qr.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* mpn_bdiv_qr -- Hensel division with precomputed inverse, returning quotient
- and remainder.
-
- 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 GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-/* Computes Q = N / D mod B^n,
- R = N - QD. */
-
-mp_limb_t
-mpn_bdiv_qr (mp_ptr qp, mp_ptr rp,
- mp_srcptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_ptr tp)
-{
- mp_limb_t di;
- mp_limb_t rh;
-
- ASSERT (nn > dn);
- if (BELOW_THRESHOLD (dn, DC_BDIV_QR_THRESHOLD) ||
- BELOW_THRESHOLD (nn - dn, DC_BDIV_QR_THRESHOLD))
- {
- MPN_COPY (tp, np, nn);
- binvert_limb (di, dp[0]); di = -di;
- rh = mpn_sbpi1_bdiv_qr (qp, tp, nn, dp, dn, di);
- MPN_COPY (rp, tp + nn - dn, dn);
- }
- else if (BELOW_THRESHOLD (dn, MU_BDIV_QR_THRESHOLD))
- {
- MPN_COPY (tp, np, nn);
- binvert_limb (di, dp[0]); di = -di;
- rh = mpn_dcpi1_bdiv_qr (qp, tp, nn, dp, dn, di);
- MPN_COPY (rp, tp + nn - dn, dn);
- }
- else
- {
- rh = mpn_mu_bdiv_qr (qp, rp, np, nn, dp, dn, tp);
- }
-
- return rh;
-}
-
-mp_size_t
-mpn_bdiv_qr_itch (mp_size_t nn, mp_size_t dn)
-{
- if (BELOW_THRESHOLD (dn, MU_BDIV_QR_THRESHOLD))
- return nn;
- else
- return mpn_mu_bdiv_qr_itch (nn, dn);
-}
diff --git a/gmp/mpn/generic/bdivmod.c b/gmp/mpn/generic/bdivmod.c
new file mode 100644
index 0000000000..783b594082
--- /dev/null
+++ b/gmp/mpn/generic/bdivmod.c
@@ -0,0 +1,124 @@
+/* mpn/bdivmod.c: mpn_bdivmod for computing U/V mod 2^d.
+
+Copyright 1991, 1993, 1994, 1995, 1996, 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/. */
+
+/* q_high = mpn_bdivmod (qp, up, usize, vp, vsize, d).
+
+ Puts the low d/BITS_PER_MP_LIMB limbs of Q = U / V mod 2^d at qp, and
+ returns the high d%BITS_PER_MP_LIMB bits of Q as the result.
+
+ Also, U - Q * V mod 2^(usize*BITS_PER_MP_LIMB) is placed at up. Since the
+ low d/BITS_PER_MP_LIMB limbs of this difference are zero, the code allows
+ the limb vectors at qp to overwrite the low limbs at up, provided qp <= up.
+
+ Preconditions:
+ 1. V is odd.
+ 2. usize * BITS_PER_MP_LIMB >= d.
+ 3. If Q and U overlap, qp <= up.
+
+ Ken Weber (kweber@mat.ufrgs.br, kweber@mcs.kent.edu)
+
+ Funding for this work has been partially provided by Conselho Nacional
+ de Desenvolvimento Cienti'fico e Tecnolo'gico (CNPq) do Brazil, Grant
+ 301314194-2, and was done while I was a visiting reseacher in the Instituto
+ de Matema'tica at Universidade Federal do Rio Grande do Sul (UFRGS).
+
+ References:
+ T. Jebelean, An algorithm for exact division, Journal of Symbolic
+ Computation, v. 15, 1993, pp. 169-180.
+
+ K. Weber, The accelerated integer GCD algorithm, ACM Transactions on
+ Mathematical Software, v. 21 (March), 1995, pp. 111-122. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+
+mp_limb_t
+mpn_bdivmod (mp_ptr qp, mp_ptr up, mp_size_t usize,
+ mp_srcptr vp, mp_size_t vsize, unsigned long int d)
+{
+ mp_limb_t v_inv;
+
+ ASSERT (usize >= 1);
+ ASSERT (vsize >= 1);
+ ASSERT (usize * GMP_NUMB_BITS >= d);
+ ASSERT (! MPN_OVERLAP_P (up, usize, vp, vsize));
+ ASSERT (! MPN_OVERLAP_P (qp, d/GMP_NUMB_BITS, vp, vsize));
+ ASSERT (MPN_SAME_OR_INCR2_P (qp, d/GMP_NUMB_BITS, up, usize));
+ ASSERT_MPN (up, usize);
+ ASSERT_MPN (vp, vsize);
+
+ /* 1/V mod 2^GMP_NUMB_BITS. */
+ binvert_limb (v_inv, vp[0]);
+
+ /* Fast code for two cases previously used by the accel part of mpn_gcd.
+ (Could probably remove this now it's inlined there.) */
+ if (usize == 2 && vsize == 2 &&
+ (d == GMP_NUMB_BITS || d == 2*GMP_NUMB_BITS))
+ {
+ mp_limb_t hi, lo;
+ mp_limb_t q = (up[0] * v_inv) & GMP_NUMB_MASK;
+ umul_ppmm (hi, lo, q, vp[0] << GMP_NAIL_BITS);
+ up[0] = 0;
+ up[1] -= hi + q*vp[1];
+ qp[0] = q;
+ if (d == 2*GMP_NUMB_BITS)
+ {
+ q = (up[1] * v_inv) & GMP_NUMB_MASK;
+ up[1] = 0;
+ qp[1] = q;
+ }
+ return 0;
+ }
+
+ /* Main loop. */
+ while (d >= GMP_NUMB_BITS)
+ {
+ mp_limb_t q = (up[0] * v_inv) & GMP_NUMB_MASK;
+ mp_limb_t b = mpn_submul_1 (up, vp, MIN (usize, vsize), q);
+ if (usize > vsize)
+ mpn_sub_1 (up + vsize, up + vsize, usize - vsize, b);
+ d -= GMP_NUMB_BITS;
+ up += 1, usize -= 1;
+ *qp++ = q;
+ }
+
+ if (d)
+ {
+ mp_limb_t b;
+ mp_limb_t q = (up[0] * v_inv) & (((mp_limb_t)1<<d) - 1);
+ if (q <= 1)
+ {
+ if (q == 0)
+ return 0;
+ else
+ b = mpn_sub_n (up, up, vp, MIN (usize, vsize));
+ }
+ else
+ b = mpn_submul_1 (up, vp, MIN (usize, vsize), q);
+
+ if (usize > vsize)
+ mpn_sub_1 (up + vsize, up + vsize, usize - vsize, b);
+ return q;
+ }
+
+ return 0;
+}
diff --git a/gmp/mpn/generic/binvert.c b/gmp/mpn/generic/binvert.c
index be27ea552e..24d4dcdb6f 100644
--- a/gmp/mpn/generic/binvert.c
+++ b/gmp/mpn/generic/binvert.c
@@ -1,38 +1,28 @@
-/* Compute {up,n}^(-1) mod B^n.
+/* Compute {up,n}^(-1) mod 2(n*GMP_NUMB_BITS).
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 GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
-Copyright (C) 2004-2007, 2009, 2012 Free Software Foundation, Inc.
+Copyright (C) 2004, 2005, 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -43,6 +33,14 @@ see https://www.gnu.org/licenses/. */
r[k+1] = r[k] + r[k] - r[k]*(u*r[k])
*/
+/* This is intended for constant THRESHOLDs only, where the compiler can
+ completely fold the result. */
+#define LOG2C(n) \
+ (((n) >= 0x1) + ((n) >= 0x2) + ((n) >= 0x4) + ((n) >= 0x8) + \
+ ((n) >= 0x10) + ((n) >= 0x20) + ((n) >= 0x40) + ((n) >= 0x80) + \
+ ((n) >= 0x100) + ((n) >= 0x200) + ((n) >= 0x400) + ((n) >= 0x800) + \
+ ((n) >= 0x1000) + ((n) >= 0x2000) + ((n) >= 0x4000) + ((n) >= 0x8000))
+
#if TUNE_PROGRAM_BUILD
#define NPOWS \
((sizeof(mp_size_t) > 6 ? 48 : 8*sizeof(mp_size_t)))
@@ -54,9 +52,12 @@ see https://www.gnu.org/licenses/. */
mp_size_t
mpn_binvert_itch (mp_size_t n)
{
- mp_size_t itch_local = mpn_mulmod_bnm1_next_size (n);
- mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, n, (n + 1) >> 1);
- return itch_local + itch_out;
+#if WANT_FFT
+ if (ABOVE_THRESHOLD (n, 2 * MUL_FFT_MODF_THRESHOLD))
+ return mpn_fft_next_size (n, mpn_fft_best_k (n, 0));
+ else
+#endif
+ return 3 * (n - (n >> 1));
}
void
@@ -75,28 +76,42 @@ mpn_binvert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
xp = scratch;
- /* Compute a base value of rn limbs. */
+ /* Compute a base value using a low-overhead O(n^2) algorithm. FIXME: We
+ should call some divide-and-conquer lsb division function here for an
+ operand subrange. */
MPN_ZERO (xp, rn);
xp[0] = 1;
binvert_limb (di, up[0]);
if (BELOW_THRESHOLD (rn, DC_BDIV_Q_THRESHOLD))
- mpn_sbpi1_bdiv_q (rp, xp, rn, up, rn, -di);
+ mpn_sb_bdiv_q (rp, xp, rn, up, rn, -di);
else
- mpn_dcpi1_bdiv_q (rp, xp, rn, up, rn, -di);
+ mpn_dc_bdiv_q (rp, xp, rn, up, rn, -di);
/* Use Newton iterations to get the desired precision. */
for (; rn < n; rn = newrn)
{
- mp_size_t m;
newrn = *--sizp;
- /* X <- UR. */
- m = mpn_mulmod_bnm1_next_size (newrn);
- mpn_mulmod_bnm1 (xp, m, up, newrn, rp, rn, xp + m);
- mpn_sub_1 (xp + m, xp, rn - (m - newrn), 1);
-
- /* R = R(X/B^rn) */
- mpn_mullo_n (rp + rn, rp, xp + rn, newrn - rn);
- mpn_neg (rp + rn, rp + rn, newrn - rn);
+#if WANT_FFT
+ if (ABOVE_THRESHOLD (newrn, 2 * MUL_FFT_MODF_THRESHOLD))
+ {
+ int k;
+ mp_size_t m, i;
+
+ k = mpn_fft_best_k (newrn, 0);
+ m = mpn_fft_next_size (newrn, k);
+ mpn_mul_fft (xp, m, up, newrn, rp, rn, k);
+ for (i = rn - 1; i >= 0; i--)
+ if (xp[i] > (i == 0))
+ {
+ mpn_add_1 (xp + rn, xp + rn, newrn - rn, 1);
+ break;
+ }
+ }
+ else
+#endif
+ mpn_mul (xp, up, newrn, rp, rn);
+ mpn_mullow_n (rp + rn, rp, xp + rn, newrn - rn);
+ mpn_neg_n (rp + rn, rp + rn, newrn - rn);
}
}
diff --git a/gmp/mpn/generic/broot.c b/gmp/mpn/generic/broot.c
deleted file mode 100644
index 6974ac8b9e..0000000000
--- a/gmp/mpn/generic/broot.c
+++ /dev/null
@@ -1,196 +0,0 @@
-/* mpn_broot -- Compute hensel sqrt
-
- 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
- GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 "gmp.h"
-#include "gmp-impl.h"
-
-/* Computes a^e (mod B). Uses right-to-left binary algorithm, since
- typical use will have e small. */
-static mp_limb_t
-powlimb (mp_limb_t a, mp_limb_t e)
-{
- mp_limb_t r = 1;
- mp_limb_t s = a;
-
- for (r = 1, s = a; e > 0; e >>= 1, s *= s)
- if (e & 1)
- r *= s;
-
- return r;
-}
-
-/* Computes a^{1/k - 1} (mod B^n). Both a and k must be odd.
-
- Iterates
-
- r' <-- r - r * (a^{k-1} r^k - 1) / n
-
- If
-
- a^{k-1} r^k = 1 (mod 2^m),
-
- then
-
- a^{k-1} r'^k = 1 (mod 2^{2m}),
-
- Compute the update term as
-
- r' = r - (a^{k-1} r^{k+1} - r) / k
-
- 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;
- mp_limb_t a0, r0, km1, kp1h, kinv;
- mp_size_t rn;
- unsigned i;
-
- TMP_DECL;
-
- ASSERT (n > 0);
- ASSERT (ap[0] & 1);
- ASSERT (k & 1);
- ASSERT (k >= 3);
-
- TMP_MARK;
-
- akm1 = TMP_ALLOC_LIMBS (4*n);
- tp = akm1 + n;
-
- km1 = k-1;
- /* FIXME: Could arrange the iteration so we don't need to compute
- this up front, computing a^{k-1} * r^k as (a r)^{k-1} * r. Note
- that we can use wraparound also for a*r, since the low half is
- unchanged from the previous iteration. Or possibly mulmid. Also,
- a r = a^{1/k}, so we get that value too, for free? */
- mpn_powlo (akm1, ap, &km1, 1, n, tp); /* 3 n scratch space */
-
- a0 = ap[0];
- binvert_limb (kinv, k);
-
- /* 4 bits: a^{1/k - 1} (mod 16):
-
- a % 8
- 1 3 5 7
- k%4 +-------
- 1 |1 1 1 1
- 3 |1 9 9 1
- */
- r0 = 1 + (((k << 2) & ((a0 << 1) ^ (a0 << 2))) & 8);
- r0 = kinv * r0 * (k+1 - akm1[0] * powlimb (r0, k & 0x7f)); /* 8 bits */
- r0 = kinv * r0 * (k+1 - akm1[0] * powlimb (r0, k & 0x7fff)); /* 16 bits */
- r0 = kinv * r0 * (k+1 - akm1[0] * powlimb (r0, k)); /* 32 bits */
-#if GMP_NUMB_BITS > 32
- {
- unsigned prec = 32;
- do
- {
- r0 = kinv * r0 * (k+1 - akm1[0] * powlimb (r0, k));
- prec *= 2;
- }
- while (prec < GMP_NUMB_BITS);
- }
-#endif
-
- rp[0] = r0;
- if (n == 1)
- {
- TMP_FREE;
- return;
- }
-
- /* For odd k, (k+1)/2 = k/2+1, and the latter avoids overflow. */
- kp1h = k/2 + 1;
-
- /* FIXME: Special case for two limb iteration. */
- rnp = TMP_ALLOC_LIMBS (2*n + 1);
- ep = rnp + n;
-
- /* FIXME: Possible to this on the fly with some bit fiddling. */
- for (i = 0; n > 1; n = (n + 1)/2)
- sizes[i++] = n;
-
- rn = 1;
-
- while (i-- > 0)
- {
- /* Compute x^{k+1}. */
- mpn_sqr (ep, rp, rn); /* For odd n, writes n+1 limbs in the
- final iteration. */
- mpn_powlo (rnp, ep, &kp1h, 1, sizes[i], tp);
-
- /* 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);
-
- ASSERT (sizes[i] <= 2*rn);
- mpn_pi1_bdiv_q_1 (rp + rn, ep + rn, sizes[i] - rn, k, kinv, 0);
- mpn_neg (rp + rn, rp + rn, sizes[i] - rn);
- rn = sizes[i];
- }
- TMP_FREE;
-}
-
-/* Computes a^{1/k} (mod B^n). Both a and k must be odd. */
-void
-mpn_broot (mp_ptr rp, mp_srcptr ap, mp_size_t n, mp_limb_t k)
-{
- mp_ptr tp;
- TMP_DECL;
-
- ASSERT (n > 0);
- ASSERT (ap[0] & 1);
- ASSERT (k & 1);
-
- if (k == 1)
- {
- MPN_COPY (rp, ap, n);
- return;
- }
-
- TMP_MARK;
- tp = TMP_ALLOC_LIMBS (n);
-
- mpn_broot_invm1 (tp, ap, n, k);
- mpn_mullo_n (rp, tp, ap, n);
-
- TMP_FREE;
-}
diff --git a/gmp/mpn/generic/brootinv.c b/gmp/mpn/generic/brootinv.c
deleted file mode 100644
index b96c97f1d3..0000000000
--- a/gmp/mpn/generic/brootinv.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* mpn_brootinv, compute r such that r^k * y = 1 (mod 2^b).
-
- Contributed to the GNU project by Martin Boij (as part of perfpow.c).
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Computes a^e (mod B). Uses right-to-left binary algorithm, since
- typical use will have e small. */
-static mp_limb_t
-powlimb (mp_limb_t a, mp_limb_t e)
-{
- mp_limb_t r;
-
- for (r = 1; e > 0; e >>= 1, a *= a)
- if (e & 1)
- r *= a;
-
- return r;
-}
-
-/* Compute r such that r^k * y = 1 (mod B^n).
-
- Iterates
- r' <-- k^{-1} ((k+1) r - r^{k+1} y) (mod 2^b)
- using Hensel lifting, each time doubling the number of known bits in r.
-
- Works just for odd k. Else the Hensel lifting degenerates.
-
- FIXME:
-
- (1) Make it work for k == GMP_LIMB_MAX (k+1 below overflows).
-
- (2) Rewrite iteration as
- r' <-- r - k^{-1} r (r^k y - 1)
- and take advantage of the zero low part of r^k y - 1.
-
- (3) Use wrap-around trick.
-
- (4) Use a small table to get starting value.
-
- Scratch need: 5*bn, where bn = ceil (bnb / GMP_NUMB_BITS).
-*/
-
-void
-mpn_brootinv (mp_ptr rp, mp_srcptr yp, mp_size_t bn, mp_limb_t k, mp_ptr tp)
-{
- mp_ptr tp2, tp3;
- mp_limb_t kinv, k2, r0, y0;
- mp_size_t order[GMP_LIMB_BITS + 1];
- int i, d;
-
- ASSERT (bn > 0);
- ASSERT ((k & 1) != 0);
-
- tp2 = tp + bn;
- tp3 = tp + 2 * bn;
- k2 = k + 1;
-
- binvert_limb (kinv, k);
-
- /* 4-bit initial approximation:
-
- y%16 | 1 3 5 7 9 11 13 15,
- k%4 +-------------------------+k2%4
- 1 | 1 11 13 7 9 3 5 15 | 2
- 3 | 1 3 5 7 9 11 13 15 | 0
-
- */
- y0 = yp[0];
-
- r0 = y0 ^ (((y0 << 1) ^ (y0 << 2)) & (k2 << 2) & 8); /* 4 bits */
- r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2 & 0x7f)); /* 8 bits */
- r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2 & 0x7fff)); /* 16 bits */
-#if GMP_NUMB_BITS > 16
- {
- unsigned prec = 16;
- do
- {
- r0 = kinv * (k2 * r0 - y0 * powlimb(r0, k2));
- prec *= 2;
- }
- while (prec < GMP_NUMB_BITS);
- }
-#endif
-
- rp[0] = r0;
- if (bn == 1)
- return;
-
- /* This initialization doesn't matter for the result (any garbage is
- cancelled in the iteration), but proper initialization makes
- valgrind happier. */
- MPN_ZERO (rp+1, bn-1);
-
- d = 0;
- for (; bn > 1; bn = (bn + 1) >> 1)
- order[d++] = bn;
-
- for (i = d - 1; i >= 0; i--)
- {
- bn = order[i];
-
- mpn_mul_1 (tp, rp, bn, k2);
-
- mpn_powlo (tp2, rp, &k2, 1, bn, tp3);
- mpn_mullo_n (rp, yp, tp2, bn);
-
- mpn_sub_n (tp2, tp, rp, bn);
- mpn_pi1_bdiv_q_1 (rp, tp2, bn, k, kinv, 0);
- }
-}
diff --git a/gmp/mpn/generic/bsqrt.c b/gmp/mpn/generic/bsqrt.c
deleted file mode 100644
index 18ba26f440..0000000000
--- a/gmp/mpn/generic/bsqrt.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* mpn_bsqrt, a^{1/2} (mod 2^n).
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_bsqrt (mp_ptr rp, mp_srcptr ap, mp_bitcnt_t nb, mp_ptr tp)
-{
- mp_ptr sp;
- mp_size_t n;
-
- ASSERT (nb > 0);
-
- n = nb / GMP_NUMB_BITS;
- sp = tp + n;
-
- mpn_bsqrtinv (sp, ap, nb, tp);
- mpn_mullo_n (rp, sp, ap, n);
-}
diff --git a/gmp/mpn/generic/bsqrtinv.c b/gmp/mpn/generic/bsqrtinv.c
deleted file mode 100644
index 33df6a3c15..0000000000
--- a/gmp/mpn/generic/bsqrtinv.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* mpn_bsqrtinv, compute r such that r^2 * y = 1 (mod 2^{b+1}).
-
- Contributed to the GNU project by Martin Boij (as part of perfpow.c).
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Compute r such that r^2 * y = 1 (mod 2^{b+1}).
- Return non-zero if such an integer r exists.
-
- Iterates
- r' <-- (3r - r^3 y) / 2
- using Hensel lifting. Since we divide by two, the Hensel lifting is
- somewhat degenerates. Therefore, we lift from 2^b to 2^{b+1}-1.
-
- FIXME:
- (1) Simplify to do precision book-keeping in limbs rather than bits.
-
- (2) Rewrite iteration as
- r' <-- r - r (r^2 y - 1) / 2
- and take advantage of zero low part of r^2 y - 1.
-
- (3) Use wrap-around trick.
-
- (4) Use a small table to get starting value.
-*/
-int
-mpn_bsqrtinv (mp_ptr rp, mp_srcptr yp, mp_bitcnt_t bnb, mp_ptr tp)
-{
- mp_ptr tp2, tp3;
- mp_limb_t k;
- mp_size_t bn, order[GMP_LIMB_BITS + 1];
- int i, d;
-
- ASSERT (bnb > 0);
-
- bn = 1 + bnb / GMP_LIMB_BITS;
-
- tp2 = tp + bn;
- tp3 = tp + 2 * bn;
- k = 3;
-
- rp[0] = 1;
- if (bnb == 1)
- {
- if ((yp[0] & 3) != 1)
- return 0;
- }
- else
- {
- if ((yp[0] & 7) != 1)
- return 0;
-
- d = 0;
- for (; bnb != 2; bnb = (bnb + 2) >> 1)
- order[d++] = bnb;
-
- for (i = d - 1; i >= 0; i--)
- {
- bnb = order[i];
- bn = 1 + bnb / GMP_LIMB_BITS;
-
- mpn_mul_1 (tp, rp, bn, k);
-
- mpn_powlo (tp2, rp, &k, 1, bn, tp3);
- mpn_mullo_n (rp, yp, tp2, bn);
-
-#if HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (rp, tp, rp, bn);
-#else
- mpn_sub_n (tp2, tp, rp, bn);
- mpn_rshift (rp, tp2, bn, 1);
-#endif
- }
- }
- return 1;
-}
diff --git a/gmp/mpn/generic/cmp.c b/gmp/mpn/generic/cmp.c
index 18c7b42844..d352076599 100644
--- a/gmp/mpn/generic/cmp.c
+++ b/gmp/mpn/generic/cmp.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpn_cmp 1
diff --git a/gmp/mpn/generic/cnd_add_n.c b/gmp/mpn/generic/cnd_add_n.c
deleted file mode 100644
index 443f9858da..0000000000
--- a/gmp/mpn/generic/cnd_add_n.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* 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/gmp/mpn/generic/cnd_sub_n.c b/gmp/mpn/generic/cnd_sub_n.c
deleted file mode 100644
index bd8e029a36..0000000000
--- a/gmp/mpn/generic/cnd_sub_n.c
+++ /dev/null
@@ -1,70 +0,0 @@
-/* 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;
-}
diff --git a/gmp/mpn/generic/com.c b/gmp/mpn/generic/com.c
deleted file mode 100644
index cd8551df5b..0000000000
--- a/gmp/mpn/generic/com.c
+++ /dev/null
@@ -1,45 +0,0 @@
-/* mpn_com - complement an mpn.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 mpn_com
-#define mpn_com __MPN(com)
-
-void
-mpn_com (mp_ptr rp, mp_srcptr up, mp_size_t n)
-{
- mp_limb_t ul;
- do {
- ul = *up++;
- *rp++ = ~ul & GMP_NUMB_MASK;
- } while (--n != 0);
-}
diff --git a/gmp/mpn/generic/comb_tables.c b/gmp/mpn/generic/comb_tables.c
deleted file mode 100644
index 41bcb5f879..0000000000
--- a/gmp/mpn/generic/comb_tables.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* Const tables shared among combinatoric functions.
-
- 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 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 "gmp.h"
-#include "gmp-impl.h"
-
-/* Entry i contains (i!/2^t) where t is chosen such that the parenthesis
- is an odd integer. */
-const mp_limb_t __gmp_oddfac_table[] = { ONE_LIMB_ODD_FACTORIAL_TABLE, ONE_LIMB_ODD_FACTORIAL_EXTTABLE };
-
-/* Entry i contains ((2i+1)!!/2^t) where t is chosen such that the parenthesis
- is an odd integer. */
-const mp_limb_t __gmp_odd2fac_table[] = { ONE_LIMB_ODD_DOUBLEFACTORIAL_TABLE };
-
-/* Entry i contains 2i-popc(2i). */
-const unsigned char __gmp_fac2cnt_table[] = { TABLE_2N_MINUS_POPC_2N };
-
-const mp_limb_t __gmp_limbroots_table[] = { NTH_ROOT_NUMB_MASK_TABLE };
diff --git a/gmp/mpn/generic/copyd.c b/gmp/mpn/generic/copyd.c
deleted file mode 100644
index ba3380a82b..0000000000
--- a/gmp/mpn/generic/copyd.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* mpn_copyd
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_copyd (mp_ptr rp, mp_srcptr up, mp_size_t n)
-{
- mp_size_t i;
-
- for (i = n - 1; i >= 0; i--)
- rp[i] = up[i];
-}
diff --git a/gmp/mpn/generic/copyi.c b/gmp/mpn/generic/copyi.c
deleted file mode 100644
index 0c39b4534b..0000000000
--- a/gmp/mpn/generic/copyi.c
+++ /dev/null
@@ -1,43 +0,0 @@
-/* mpn_copyi
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_copyi (mp_ptr rp, mp_srcptr up, mp_size_t n)
-{
- mp_size_t i;
-
- up += n;
- rp += n;
- for (i = -n; i != 0; i++)
- rp[i] = up[i];
-}
diff --git a/gmp/mpn/generic/dc_bdiv_q.c b/gmp/mpn/generic/dc_bdiv_q.c
new file mode 100644
index 0000000000..9a43d18b56
--- /dev/null
+++ b/gmp/mpn/generic/dc_bdiv_q.c
@@ -0,0 +1,137 @@
+/* mpn_dc_bdiv_q -- divide-and-conquer Hensel division with precomputed
+ inverse, returning quotient.
+
+ Contributed to the GNU project by Niels Möller and Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
+
+Copyright 2006, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+
+/* Computes Q = N / D mod B^n, destroys N. */
+
+mp_size_t
+mpn_dc_bdiv_q_n_itch (mp_size_t n)
+{
+ /* NOTE: Depends om mullow_n interface */
+ return n;
+}
+
+void
+mpn_dc_bdiv_q_n (mp_ptr qp,
+ mp_ptr np, mp_srcptr dp, mp_size_t n,
+ mp_limb_t dinv, mp_ptr tp)
+{
+ while (ABOVE_THRESHOLD (n, DC_BDIV_Q_THRESHOLD))
+ {
+ mp_limb_t l, h;
+ mp_limb_t cy;
+
+ l = n >> 1;
+ h = n - l;
+
+ cy = mpn_dc_bdiv_qr_n (qp, np, dp, l, dinv, tp);
+
+ mpn_mullow_n (tp, qp, dp + h, l);
+ mpn_sub_n (np + h, np + h, tp, l);
+
+ if (l < h)
+ {
+ cy += mpn_submul_1 (np + l, qp, l, dp[l]);
+ np[n - 1] -= cy;
+ }
+ qp += l;
+ np += l;
+ n -= l;
+ }
+ mpn_sb_bdiv_q (qp, np, n, dp, n, dinv);
+}
+
+void
+mpn_dc_bdiv_q (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_limb_t dinv)
+{
+ mp_size_t qn;
+ mp_limb_t cy;
+ mp_ptr tp;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ tp = TMP_SALLOC_LIMBS (dn);
+
+ qn = nn;
+
+ if (qn > dn)
+ {
+ /* Reduce qn mod dn in a super-efficient manner. */
+ do
+ qn -= dn;
+ while (qn > dn);
+
+ /* Perform the typically smaller block first. */
+ if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD))
+ cy = mpn_sb_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv);
+ else
+ cy = mpn_dc_bdiv_qr_n (qp, np, dp, qn, dinv, tp);
+
+ if (qn != dn)
+ {
+ if (qn > dn - qn)
+ mpn_mul (tp, qp, qn, dp + qn, dn - qn);
+ else
+ mpn_mul (tp, dp + qn, dn - qn, qp, qn);
+ mpn_incr_u (tp + qn, cy);
+
+ mpn_sub (np + qn, np + qn, nn - qn, tp, dn);
+ cy = 0;
+ }
+
+ np += qn;
+ qp += qn;
+
+ qn = nn - qn;
+ while (qn > dn)
+ {
+ mpn_sub_1 (np + dn, np + dn, qn, cy);
+ cy = mpn_dc_bdiv_qr_n (qp, np, dp, dn, dinv, tp);
+ qp += dn;
+ np += dn;
+ qn -= dn;
+ }
+ mpn_sub_1 (np + dn, np + dn, qn, cy);
+ mpn_dc_bdiv_q_n (qp, np, dp, dn, dinv, tp);
+ TMP_FREE;
+ return;
+ }
+
+ if (BELOW_THRESHOLD (qn, DC_BDIV_Q_THRESHOLD))
+ mpn_sb_bdiv_q (qp, np, 2 * qn, dp, qn, dinv);
+ else
+ mpn_dc_bdiv_q_n (qp, np, dp, qn, dinv, tp);
+
+ TMP_FREE;
+}
diff --git a/gmp/mpn/generic/dcpi1_bdiv_qr.c b/gmp/mpn/generic/dc_bdiv_qr.c
index 8a251f8d9d..8b59bbd860 100644
--- a/gmp/mpn/generic/dcpi1_bdiv_qr.c
+++ b/gmp/mpn/generic/dc_bdiv_qr.c
@@ -1,39 +1,29 @@
-/* mpn_dcpi1_bdiv_qr -- divide-and-conquer Hensel division with precomputed
+/* mpn_dc_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 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 GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
-Copyright 2006, 2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -53,14 +43,14 @@ see https://www.gnu.org/licenses/. */
d must be odd. dinv is (-d)^-1 mod 2^GMP_NUMB_BITS. */
mp_size_t
-mpn_dcpi1_bdiv_qr_n_itch (mp_size_t n)
+mpn_dc_bdiv_qr_n_itch (mp_size_t n)
{
return n;
}
mp_limb_t
-mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
- mp_limb_t dinv, mp_ptr tp)
+mpn_dc_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
+ mp_limb_t dinv, mp_ptr tp)
{
mp_size_t lo, hi;
mp_limb_t cy;
@@ -70,9 +60,9 @@ mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
hi = n - lo; /* ceil(n/2) */
if (BELOW_THRESHOLD (lo, DC_BDIV_QR_THRESHOLD))
- cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * lo, dp, lo, dinv);
+ cy = mpn_sb_bdiv_qr (qp, np, 2 * lo, dp, lo, dinv);
else
- cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, lo, dinv, tp);
+ cy = mpn_dc_bdiv_qr_n (qp, np, dp, lo, dinv, tp);
mpn_mul (tp, dp + lo, hi, qp, lo);
@@ -80,9 +70,9 @@ mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
rh = mpn_sub (np + lo, np + lo, n + hi, tp, n);
if (BELOW_THRESHOLD (hi, DC_BDIV_QR_THRESHOLD))
- cy = mpn_sbpi1_bdiv_qr (qp + lo, np + lo, 2 * hi, dp, hi, dinv);
+ cy = mpn_sb_bdiv_qr (qp + lo, np + lo, 2 * hi, dp, hi, dinv);
else
- cy = mpn_dcpi1_bdiv_qr_n (qp + lo, np + lo, dp, hi, dinv, tp);
+ cy = mpn_dc_bdiv_qr_n (qp + lo, np + lo, dp, hi, dinv, tp);
mpn_mul (tp, qp + lo, hi, dp + hi, lo);
@@ -93,8 +83,8 @@ mpn_dcpi1_bdiv_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
}
mp_limb_t
-mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn, mp_limb_t dinv)
+mpn_dc_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn,
+ mp_limb_t dinv)
{
mp_size_t qn;
mp_limb_t rr, cy;
@@ -103,10 +93,6 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
TMP_MARK;
- ASSERT (dn >= 2); /* to adhere to mpn_sbpi1_div_qr's limits */
- ASSERT (nn - dn >= 1); /* to adhere to mpn_sbpi1_div_qr's limits */
- ASSERT (dp[0] & 1);
-
tp = TMP_SALLOC_LIMBS (dn);
qn = nn - dn;
@@ -120,9 +106,9 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
/* Perform the typically smaller block first. */
if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD))
- cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv);
+ cy = mpn_sb_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv);
else
- cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, qn, dinv, tp);
+ cy = mpn_dc_bdiv_qr_n (qp, np, dp, qn, dinv, tp);
rr = 0;
if (qn != dn)
@@ -144,7 +130,7 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
do
{
rr += mpn_sub_1 (np + dn, np + dn, qn, cy);
- cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, dn, dinv, tp);
+ cy = mpn_dc_bdiv_qr_n (qp, np, dp, dn, dinv, tp);
qp += dn;
np += dn;
qn -= dn;
@@ -155,9 +141,9 @@ mpn_dcpi1_bdiv_qr (mp_ptr qp, mp_ptr np, mp_size_t nn,
}
if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD))
- cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv);
+ cy = mpn_sb_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv);
else
- cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, qn, dinv, tp);
+ cy = mpn_dc_bdiv_qr_n (qp, np, dp, qn, dinv, tp);
rr = 0;
if (qn != dn)
diff --git a/gmp/mpn/generic/dc_div_q.c b/gmp/mpn/generic/dc_div_q.c
new file mode 100644
index 0000000000..276ae4fba6
--- /dev/null
+++ b/gmp/mpn/generic/dc_div_q.c
@@ -0,0 +1,57 @@
+/* mpn_dc_div_q -- divide-and-conquer division, returning exact quotient only.
+
+ Contributed to the GNU project by Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
+
+Copyright 2006, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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_dc_div_q (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
+{
+ mp_ptr tp, wp;
+ mp_limb_t qh;
+ mp_size_t qn;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ tp = TMP_SALLOC_LIMBS (nn + 1);
+ MPN_COPY (tp + 1, np, nn);
+ tp[0] = 0;
+
+ qn = nn - dn;
+ wp = TMP_SALLOC_LIMBS (qn + 1);
+
+ qh = mpn_dc_divappr_q (wp, tp, nn + 1, dp, dn);
+
+ if (wp[0] == 0)
+ /* FIXME: Should multiply and subtract here, not recompute from scratch. */
+ qh = mpn_dc_div_qr (qp, np, nn, dp, dn);
+ else
+ MPN_COPY (qp, wp + 1, qn);
+
+ return qh;
+}
diff --git a/gmp/mpn/generic/dc_div_qr.c b/gmp/mpn/generic/dc_div_qr.c
new file mode 100644
index 0000000000..41a46f1516
--- /dev/null
+++ b/gmp/mpn/generic/dc_div_qr.c
@@ -0,0 +1,203 @@
+/* mpn_dc_div_qr -- recursive divide-and-conquer division for arbitrary size
+ operands.
+
+ Contributed to the GNU project by Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
+
+Copyright 2006, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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_dc_div_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
+ mp_srcptr dip, mp_ptr tp)
+{
+ mp_size_t lo, hi;
+ mp_limb_t cy, qh, ql;
+
+ lo = n >> 1; /* floor(n/2) */
+ hi = n - lo; /* ceil(n/2) */
+
+ if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD))
+ qh = mpn_sb_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dip);
+ else
+ qh = mpn_dc_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dip, tp);
+
+ mpn_mul (tp, qp + lo, hi, dp, lo);
+
+ cy = mpn_sub_n (np + lo, np + lo, tp, n);
+ if (qh != 0)
+ cy += mpn_sub_n (np + n, np + n, dp, lo);
+
+ while (cy != 0)
+ {
+ qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1);
+ cy -= mpn_add_n (np + lo, np + lo, dp, n);
+ }
+
+ if (BELOW_THRESHOLD (lo, DC_DIV_QR_THRESHOLD))
+ ql = mpn_sb_div_qr (qp, np + hi, 2 * lo, dp + hi, lo, dip);
+ else
+ ql = mpn_dc_div_qr_n (qp, np + hi, dp + hi, lo, dip, tp);
+
+ mpn_mul (tp, dp, hi, qp, lo);
+
+ cy = mpn_sub_n (np, np, tp, n);
+ if (ql != 0)
+ cy += mpn_sub_n (np + lo, np + lo, dp, hi);
+
+ while (cy != 0)
+ {
+ mpn_sub_1 (qp, qp, lo, 1);
+ cy -= mpn_add_n (np, np, dp, n);
+ }
+
+ return qh;
+}
+
+mp_limb_t
+mpn_preinv_dc_div_qr (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_srcptr dip)
+{
+ mp_size_t qn;
+ mp_limb_t qh, cy;
+ mp_ptr tp;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ tp = TMP_SALLOC_LIMBS (dn);
+
+ qn = nn - dn;
+ qp += qn;
+ np += nn;
+ dp += dn;
+
+ if (qn > dn)
+ {
+ /* Reduce qn mod dn without division, optimizing small operations. */
+ do
+ qn -= dn;
+ while (qn > dn);
+
+ qp -= qn; /* point at low limb of next quotient block */
+ np -= qn; /* point in the middle of partial remainder */
+
+ /* Perform the typically smaller block first. */
+ if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD))
+ qh = mpn_sb_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dip);
+ else
+ qh = mpn_dc_div_qr_n (qp, np - qn, dp - qn, qn, dip, tp);
+
+ if (qn != dn)
+ {
+ if (qn > dn - qn)
+ mpn_mul (tp, qp, qn, dp - dn, dn - qn);
+ else
+ mpn_mul (tp, dp - dn, dn - qn, qp, qn);
+
+ cy = mpn_sub_n (np - dn, np - dn, tp, dn);
+ if (qh != 0)
+ cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn);
+
+ while (cy != 0)
+ {
+ qh -= mpn_sub_1 (qp, qp, qn, 1);
+ cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn);
+ }
+ }
+
+ qn = nn - dn - qn;
+ do
+ {
+ qp -= dn;
+ np -= dn;
+ mpn_dc_div_qr_n (qp, np - dn, dp - dn, dn, dip, tp);
+ qn -= dn;
+ }
+ while (qn > 0);
+ }
+ else
+ {
+ if (qn == 0)
+ {
+ qh = mpn_cmp (np - dn, dp - dn, dn) >= 0;
+ if (qh)
+ mpn_sub_n (np - dn, np - dn, dp - dn, dn);
+ TMP_FREE;
+ return qh;
+ }
+
+ qp -= qn; /* point at low limb of next quotient block */
+ np -= qn; /* point in the middle of partial remainder */
+
+ if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD))
+ qh = mpn_sb_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dip);
+ else
+ qh = mpn_dc_div_qr_n (qp, np - qn, dp - qn, qn, dip, tp);
+
+ if (qn != dn)
+ {
+ if (qn > dn - qn)
+ mpn_mul (tp, qp, qn, dp - dn, dn - qn);
+ else
+ mpn_mul (tp, dp - dn, dn - qn, qp, qn);
+
+ cy = mpn_sub_n (np - dn, np - dn, tp, dn);
+ if (qh != 0)
+ cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn);
+
+ while (cy != 0)
+ {
+ qh -= mpn_sub_1 (qp, qp, qn, 1);
+ cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn);
+ }
+ }
+ }
+
+ TMP_FREE;
+ return qh;
+}
+
+mp_limb_t
+mpn_dc_div_qr (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
+{
+ mp_limb_t cy;
+ mp_limb_t xp[2], dip[2];
+
+ ASSERT (dn >= 2);
+
+ cy = mpn_add_1 (xp, dp + dn - 2, 2, 1);
+ if (cy != 0)
+ dip[0] = dip[1] = 0;
+ else
+ {
+ mp_limb_t scratch[10]; /* FIXME */
+ mpn_invert (dip, xp, 2, scratch);
+ }
+
+ return mpn_preinv_dc_div_qr (qp, np, nn, dp, dn, dip);
+}
diff --git a/gmp/mpn/generic/dc_divappr_q.c b/gmp/mpn/generic/dc_divappr_q.c
new file mode 100644
index 0000000000..4474872388
--- /dev/null
+++ b/gmp/mpn/generic/dc_divappr_q.c
@@ -0,0 +1,196 @@
+/* mpn_dc_divappr_q -- divide-and-conquer division, returning only approximate
+ quotient. The quotient retuened is either correct, or unity too large.
+
+ Contributed to the GNU project by Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
+
+Copyright 2006, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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_dc_divappr_q_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
+ mp_srcptr dip, mp_ptr tp)
+{
+ mp_size_t lo, hi;
+ mp_limb_t cy, qh, ql;
+
+ lo = n >> 1; /* floor(n/2) */
+ hi = n - lo; /* ceil(n/2) */
+
+ if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD))
+ qh = mpn_sb_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dip);
+ else
+ qh = mpn_dc_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dip, tp);
+
+ mpn_mul (tp, qp + lo, hi, dp, lo);
+
+ cy = mpn_sub_n (np + lo, np + lo, tp, n);
+ if (qh != 0)
+ cy += mpn_sub_n (np + n, np + n, dp, lo);
+
+ while (cy != 0)
+ {
+ qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1);
+ cy -= mpn_add_n (np + lo, np + lo, dp, n);
+ }
+
+ if (BELOW_THRESHOLD (lo, DC_DIVAPPR_Q_THRESHOLD))
+ ql = mpn_sb_divappr_q (qp, np + hi, 2 * lo, dp + hi, lo, dip);
+ else
+ ql = mpn_dc_divappr_q_n (qp, np + hi, dp + hi, lo, dip, tp);
+
+ if (UNLIKELY (ql != 0))
+ {
+ mp_size_t i;
+ for (i = 0; i < lo; i++)
+ qp[i] = GMP_NUMB_MASK;
+ }
+
+ return qh;
+}
+
+mp_limb_t
+mpn_preinv_dc_divappr_q (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_srcptr dip)
+{
+ mp_size_t qn;
+ mp_limb_t qh, cy, qsave;
+ mp_ptr tp;
+ TMP_DECL;
+
+ TMP_MARK;
+
+ tp = TMP_SALLOC_LIMBS (dn+1);
+
+ qn = nn - dn;
+ qp += qn;
+ np += nn;
+ dp += dn;
+
+ if (qn > dn)
+ {
+ qn++; /* pretend we'll need an extra limb */
+ /* Reduce qn mod dn without division, optimizing small operations. */
+ do
+ qn -= dn;
+ while (qn > dn);
+
+ qp -= qn; /* point at low limb of next quotient block */
+ np -= qn; /* point in the middle of partial remainder */
+
+ /* Perform the typically smaller block first. */
+ if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD))
+ qh = mpn_sb_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dip);
+ else
+ qh = mpn_dc_div_qr_n (qp, np - qn, dp - qn, qn, dip, tp);
+
+ if (qn != dn)
+ {
+ if (qn > dn - qn)
+ mpn_mul (tp, qp, qn, dp - dn, dn - qn);
+ else
+ mpn_mul (tp, dp - dn, dn - qn, qp, qn);
+
+ cy = mpn_sub_n (np - dn, np - dn, tp, dn);
+ if (qh != 0)
+ cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn);
+
+ while (cy != 0)
+ {
+ qh -= mpn_sub_1 (qp, qp, qn, 1);
+ cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn);
+ }
+ }
+
+ qn = nn - dn - qn + 1;
+ while (qn > dn)
+ {
+ qp -= dn;
+ np -= dn;
+ mpn_dc_div_qr_n (qp, np - dn, dp - dn, dn, dip, tp);
+ qn -= dn;
+ }
+
+ /* Since we pretended we'd need an extra quotient limb before, we now
+ have made sure the code above left just dn-1=qn quotient limbs to
+ develop. Develop that plus a guard limb. */
+ qn--;
+ qp -= qn;
+ np -= dn;
+ qsave = qp[qn];
+ mpn_dc_divappr_q_n (qp, np - dn, dp - dn, dn, dip, tp);
+ MPN_COPY_INCR (qp, qp + 1, qn);
+ qp[qn] = qsave;
+ }
+ else
+ {
+ if (qn == 0)
+ {
+ qh = mpn_cmp (np - dn, dp - dn, dn) >= 0;
+ if (qh)
+ mpn_sub_n (np - dn, np - dn, dp - dn, dn);
+ TMP_FREE;
+ return qh;
+ }
+
+ qp -= qn; /* point at low limb of next quotient block */
+ np -= qn; /* point in the middle of partial remainder */
+
+ if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD))
+ /* Full precision. Optimal? */
+ qh = mpn_sb_divappr_q (qp, np - dn, nn, dp - dn, dn, dip);
+ else
+ {
+ /* Put quotient in tp, use qp as temporary, since qp lacks a limb. */
+ qh = mpn_dc_divappr_q_n (tp, np - qn - 2, dp - (qn + 1), qn + 1, dip, qp);
+ MPN_COPY (qp, tp + 1, qn);
+ }
+ }
+
+ TMP_FREE;
+ return qh;
+}
+
+mp_limb_t
+mpn_dc_divappr_q (mp_ptr qp, mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
+{
+ mp_limb_t cy;
+ mp_limb_t xp[2], dip[2];
+
+ ASSERT (dn >= 2);
+
+ cy = mpn_add_1 (xp, dp + dn - 2, 2, 1);
+ if (cy != 0)
+ dip[0] = dip[1] = 0;
+ else
+ {
+ mp_limb_t scratch[10]; /* FIXME */
+ mpn_invert (dip, xp, 2, scratch);
+ }
+
+ return mpn_preinv_dc_divappr_q (qp, np, nn, dp, dn, dip);
+}
diff --git a/gmp/mpn/generic/dc_divrem_n.c b/gmp/mpn/generic/dc_divrem_n.c
new file mode 100644
index 0000000000..61ddde72c3
--- /dev/null
+++ b/gmp/mpn/generic/dc_divrem_n.c
@@ -0,0 +1,121 @@
+/* mpn_dc_divrem_n and auxilliary routines.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE
+ INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.
+ IN FACT, IT IS ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A
+ FUTURE GNU MP RELEASE.
+
+
+Copyright 2000, 2001, 2002, 2004, 2005 Free Software Foundation, Inc.
+Contributed by Paul Zimmermann.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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"
+
+/*
+[1] Fast Recursive Division, by Christoph Burnikel and Joachim Ziegler,
+ Technical report MPI-I-98-1-022, october 1998.
+ http://www.mpi-sb.mpg.de/~ziegler/TechRep.ps.gz
+*/
+
+static mp_limb_t mpn_dc_div_3_by_2
+ __GMP_PROTO ((mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch));
+static mp_limb_t mpn_dc_div_2_by_1
+ __GMP_PROTO ((mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch));
+
+/* mpn_dc_divrem_n - Implements algorithm of page 8 in [1]: divides (np,2n)
+ by (dp,n) and puts the quotient in (qp,n), the remainder in (np,n).
+ Returns most significant limb of the quotient, which is 0 or 1.
+ Requires that the most significant bit of the divisor is set. */
+
+mp_limb_t
+mpn_dc_divrem_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n)
+{
+ mp_limb_t ret;
+ mp_ptr scratch;
+ TMP_DECL;
+ TMP_MARK;
+
+ scratch = TMP_ALLOC_LIMBS (n);
+ ret = mpn_dc_div_2_by_1 (qp, np, dp, n, scratch);
+
+ TMP_FREE;
+ return ret;
+}
+
+static mp_limb_t
+mpn_dc_div_2_by_1 (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
+{
+ mp_limb_t qhl, cc;
+ mp_size_t n2 = n/2;
+
+ if (n % 2 != 0)
+ {
+ mp_ptr qp1 = qp + 1;
+ qhl = mpn_dc_div_3_by_2 (qp1 + n2, np + 2 + n2, dp + 1, n2, scratch);
+ qhl += mpn_add_1 (qp1 + n2, qp1 + n2, n2,
+ mpn_dc_div_3_by_2 (qp1, np + 2, dp + 1, n2, scratch));
+
+ cc = mpn_submul_1 (np + 1, qp1, n - 1, dp[0]);
+ cc = mpn_sub_1 (np + n, np + n, 1, cc);
+ if (qhl != 0)
+ cc += mpn_sub_1 (np + n, np + n, 1, dp[0]);
+ while (cc != 0)
+ {
+ qhl -= mpn_sub_1 (qp1, qp1, n - 1, (mp_limb_t) 1);
+ cc -= mpn_add_n (np + 1, np + 1, dp, n);
+ }
+ qhl += mpn_add_1 (qp1, qp1, n - 1,
+ mpn_sb_divrem_mn (qp, np, n + 1, dp, n));
+ }
+ else
+ {
+ qhl = mpn_dc_div_3_by_2 (qp + n2, np + n2, dp, n2, scratch);
+ qhl += mpn_add_1 (qp + n2, qp + n2, n2,
+ mpn_dc_div_3_by_2 (qp, np, dp, n2, scratch));
+ }
+ return qhl;
+}
+
+
+/* divides (np, 3n) by (dp, 2n) and puts the quotient in (qp, n),
+ the remainder in (np, 2n) */
+
+static mp_limb_t
+mpn_dc_div_3_by_2 (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
+{
+ mp_size_t twon = n + n;
+ mp_limb_t qhl, cc;
+
+ if (n < DIV_DC_THRESHOLD)
+ qhl = mpn_sb_divrem_mn (qp, np + n, twon, dp + n, n);
+ else
+ qhl = mpn_dc_div_2_by_1 (qp, np + n, dp + n, n, scratch);
+
+ mpn_mul_n (scratch, qp, dp, n);
+ cc = mpn_sub_n (np, np, scratch, twon);
+
+ if (qhl != 0)
+ cc += mpn_sub_n (np + n, np + n, dp, n);
+ while (cc != 0)
+ {
+ qhl -= mpn_sub_1 (qp, qp, n, (mp_limb_t) 1);
+ cc -= mpn_add_n (np, np, dp, twon);
+ }
+ return qhl;
+}
diff --git a/gmp/mpn/generic/dcpi1_bdiv_q.c b/gmp/mpn/generic/dcpi1_bdiv_q.c
deleted file mode 100644
index a7b86c96d4..0000000000
--- a/gmp/mpn/generic/dcpi1_bdiv_q.c
+++ /dev/null
@@ -1,160 +0,0 @@
-/* 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.
-
- 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-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_size_t
-mpn_dcpi1_bdiv_q_n_itch (mp_size_t n)
-{
- /* NOTE: Depends on mullo_n interface */
- return n;
-}
-
-/* Computes Q = N / D mod B^n, destroys N.
-
- N = {np,n}
- D = {dp,n}
-*/
-
-void
-mpn_dcpi1_bdiv_q_n (mp_ptr qp,
- mp_ptr np, mp_srcptr dp, mp_size_t n,
- mp_limb_t dinv, mp_ptr tp)
-{
- while (ABOVE_THRESHOLD (n, DC_BDIV_Q_THRESHOLD))
- {
- mp_size_t lo, hi;
- mp_limb_t cy;
-
- lo = n >> 1; /* floor(n/2) */
- hi = n - lo; /* ceil(n/2) */
-
- cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, lo, dinv, tp);
-
- mpn_mullo_n (tp, qp, dp + hi, lo);
- mpn_sub_n (np + hi, np + hi, tp, lo);
-
- if (lo < hi)
- {
- cy += mpn_submul_1 (np + lo, qp, lo, dp[lo]);
- np[n - 1] -= cy;
- }
- qp += lo;
- np += lo;
- n -= lo;
- }
- mpn_sbpi1_bdiv_q (qp, np, n, dp, n, dinv);
-}
-
-/* Computes Q = N / D mod B^nn, destroys N.
-
- N = {np,nn}
- D = {dp,dn}
-*/
-
-void
-mpn_dcpi1_bdiv_q (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_limb_t dinv)
-{
- mp_size_t qn;
- mp_limb_t cy;
- mp_ptr tp;
- TMP_DECL;
-
- TMP_MARK;
-
- ASSERT (dn >= 2);
- ASSERT (nn - dn >= 0);
- ASSERT (dp[0] & 1);
-
- tp = TMP_SALLOC_LIMBS (dn);
-
- qn = nn;
-
- if (qn > dn)
- {
- /* Reduce qn mod dn in a super-efficient manner. */
- do
- qn -= dn;
- while (qn > dn);
-
- /* Perform the typically smaller block first. */
- if (BELOW_THRESHOLD (qn, DC_BDIV_QR_THRESHOLD))
- cy = mpn_sbpi1_bdiv_qr (qp, np, 2 * qn, dp, qn, dinv);
- else
- cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, qn, dinv, tp);
-
- if (qn != dn)
- {
- if (qn > dn - qn)
- mpn_mul (tp, qp, qn, dp + qn, dn - qn);
- else
- mpn_mul (tp, dp + qn, dn - qn, qp, qn);
- mpn_incr_u (tp + qn, cy);
-
- mpn_sub (np + qn, np + qn, nn - qn, tp, dn);
- cy = 0;
- }
-
- np += qn;
- qp += qn;
-
- qn = nn - qn;
- while (qn > dn)
- {
- mpn_sub_1 (np + dn, np + dn, qn - dn, cy);
- cy = mpn_dcpi1_bdiv_qr_n (qp, np, dp, dn, dinv, tp);
- qp += dn;
- np += dn;
- qn -= dn;
- }
- mpn_dcpi1_bdiv_q_n (qp, np, dp, dn, dinv, tp);
- }
- else
- {
- if (BELOW_THRESHOLD (qn, DC_BDIV_Q_THRESHOLD))
- mpn_sbpi1_bdiv_q (qp, np, qn, dp, qn, dinv);
- else
- mpn_dcpi1_bdiv_q_n (qp, np, dp, qn, dinv, tp);
- }
-
- TMP_FREE;
-}
diff --git a/gmp/mpn/generic/dcpi1_div_q.c b/gmp/mpn/generic/dcpi1_div_q.c
deleted file mode 100644
index 32d74c31a9..0000000000
--- a/gmp/mpn/generic/dcpi1_div_q.c
+++ /dev/null
@@ -1,87 +0,0 @@
-/* mpn_dc_div_q -- divide-and-conquer division, returning exact quotient
- only.
-
- Contributed to the GNU project by Torbjorn Granlund 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_dcpi1_div_q (mp_ptr qp, mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv)
-{
- mp_ptr tp, wp;
- mp_limb_t qh;
- mp_size_t qn;
- TMP_DECL;
-
- TMP_MARK;
-
- ASSERT (dn >= 6);
- ASSERT (nn - dn >= 3);
- ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT);
-
- tp = TMP_SALLOC_LIMBS (nn + 1);
- MPN_COPY (tp + 1, np, nn);
- tp[0] = 0;
-
- qn = nn - dn;
- wp = TMP_SALLOC_LIMBS (qn + 1);
-
- qh = mpn_dcpi1_divappr_q (wp, tp, nn + 1, dp, dn, dinv);
-
- if (wp[0] == 0)
- {
- mp_limb_t cy;
-
- if (qn > dn)
- mpn_mul (tp, wp + 1, qn, dp, dn);
- else
- mpn_mul (tp, dp, dn, wp + 1, qn);
-
- cy = (qh != 0) ? mpn_add_n (tp + qn, tp + qn, dp, dn) : 0;
-
- if (cy || mpn_cmp (tp, np, nn) > 0) /* At most is wrong by one, no cycle. */
- qh -= mpn_sub_1 (qp, wp + 1, qn, 1);
- else /* Same as below */
- MPN_COPY (qp, wp + 1, qn);
- }
- else
- MPN_COPY (qp, wp + 1, qn);
-
- TMP_FREE;
- return qh;
-}
diff --git a/gmp/mpn/generic/dcpi1_div_qr.c b/gmp/mpn/generic/dcpi1_div_qr.c
deleted file mode 100644
index 4d80c7b769..0000000000
--- a/gmp/mpn/generic/dcpi1_div_qr.c
+++ /dev/null
@@ -1,249 +0,0 @@
-/* mpn_dcpi1_div_qr_n -- recursive divide-and-conquer division for arbitrary
- size operands.
-
- 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 GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-mp_limb_t
-mpn_dcpi1_div_qr_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
- gmp_pi1_t *dinv, mp_ptr tp)
-{
- mp_size_t lo, hi;
- mp_limb_t cy, qh, ql;
-
- lo = n >> 1; /* floor(n/2) */
- hi = n - lo; /* ceil(n/2) */
-
- if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD))
- qh = mpn_sbpi1_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dinv->inv32);
- else
- qh = mpn_dcpi1_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dinv, tp);
-
- mpn_mul (tp, qp + lo, hi, dp, lo);
-
- cy = mpn_sub_n (np + lo, np + lo, tp, n);
- if (qh != 0)
- cy += mpn_sub_n (np + n, np + n, dp, lo);
-
- while (cy != 0)
- {
- qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1);
- cy -= mpn_add_n (np + lo, np + lo, dp, n);
- }
-
- if (BELOW_THRESHOLD (lo, DC_DIV_QR_THRESHOLD))
- ql = mpn_sbpi1_div_qr (qp, np + hi, 2 * lo, dp + hi, lo, dinv->inv32);
- else
- ql = mpn_dcpi1_div_qr_n (qp, np + hi, dp + hi, lo, dinv, tp);
-
- mpn_mul (tp, dp, hi, qp, lo);
-
- cy = mpn_sub_n (np, np, tp, n);
- if (ql != 0)
- cy += mpn_sub_n (np + lo, np + lo, dp, hi);
-
- while (cy != 0)
- {
- mpn_sub_1 (qp, qp, lo, 1);
- cy -= mpn_add_n (np, np, dp, n);
- }
-
- return qh;
-}
-
-mp_limb_t
-mpn_dcpi1_div_qr (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- gmp_pi1_t *dinv)
-{
- mp_size_t qn;
- mp_limb_t qh, cy;
- mp_ptr tp;
- TMP_DECL;
-
- TMP_MARK;
-
- ASSERT (dn >= 6); /* to adhere to mpn_sbpi1_div_qr's limits */
- ASSERT (nn - dn >= 3); /* to adhere to mpn_sbpi1_div_qr's limits */
- ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT);
-
- tp = TMP_SALLOC_LIMBS (dn);
-
- qn = nn - dn;
- qp += qn;
- np += nn;
- dp += dn;
-
- if (qn > dn)
- {
- /* Reduce qn mod dn without division, optimizing small operations. */
- do
- qn -= dn;
- while (qn > dn);
-
- qp -= qn; /* point at low limb of next quotient block */
- np -= qn; /* point in the middle of partial remainder */
-
- /* Perform the typically smaller block first. */
- if (qn == 1)
- {
- mp_limb_t q, n2, n1, n0, d1, d0;
-
- /* Handle qh up front, for simplicity. */
- qh = mpn_cmp (np - dn + 1, dp - dn, dn) >= 0;
- if (qh)
- ASSERT_NOCARRY (mpn_sub_n (np - dn + 1, np - dn + 1, dp - dn, dn));
-
- /* A single iteration of schoolbook: One 3/2 division,
- followed by the bignum update and adjustment. */
- n2 = np[0];
- n1 = np[-1];
- n0 = np[-2];
- d1 = dp[-1];
- d0 = dp[-2];
-
- ASSERT (n2 < d1 || (n2 == d1 && n1 <= d0));
-
- if (UNLIKELY (n2 == d1) && n1 == d0)
- {
- q = GMP_NUMB_MASK;
- cy = mpn_submul_1 (np - dn, dp - dn, dn, q);
- ASSERT (cy == n2);
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n2, n1, n0, d1, d0, dinv->inv32);
-
- if (dn > 2)
- {
- mp_limb_t cy, cy1;
- cy = mpn_submul_1 (np - dn, dp - dn, dn - 2, q);
-
- cy1 = n0 < cy;
- n0 = (n0 - cy) & GMP_NUMB_MASK;
- cy = n1 < cy1;
- n1 = (n1 - cy1) & GMP_NUMB_MASK;
- np[-2] = n0;
-
- if (UNLIKELY (cy != 0))
- {
- n1 += d1 + mpn_add_n (np - dn, np - dn, dp - dn, dn - 1);
- qh -= (q == 0);
- q = (q - 1) & GMP_NUMB_MASK;
- }
- }
- else
- np[-2] = n0;
-
- np[-1] = n1;
- }
- qp[0] = q;
- }
- else
- {
- /* Do a 2qn / qn division */
- if (qn == 2)
- qh = mpn_divrem_2 (qp, 0L, np - 2, 4, dp - 2); /* FIXME: obsolete function. Use 5/3 division? */
- else if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD))
- qh = mpn_sbpi1_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dinv->inv32);
- else
- qh = mpn_dcpi1_div_qr_n (qp, np - qn, dp - qn, qn, dinv, tp);
-
- if (qn != dn)
- {
- if (qn > dn - qn)
- mpn_mul (tp, qp, qn, dp - dn, dn - qn);
- else
- mpn_mul (tp, dp - dn, dn - qn, qp, qn);
-
- cy = mpn_sub_n (np - dn, np - dn, tp, dn);
- if (qh != 0)
- cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn);
-
- while (cy != 0)
- {
- qh -= mpn_sub_1 (qp, qp, qn, 1);
- cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn);
- }
- }
- }
-
- qn = nn - dn - qn;
- do
- {
- qp -= dn;
- np -= dn;
- mpn_dcpi1_div_qr_n (qp, np - dn, dp - dn, dn, dinv, tp);
- qn -= dn;
- }
- while (qn > 0);
- }
- else
- {
- qp -= qn; /* point at low limb of next quotient block */
- np -= qn; /* point in the middle of partial remainder */
-
- if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD))
- qh = mpn_sbpi1_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dinv->inv32);
- else
- qh = mpn_dcpi1_div_qr_n (qp, np - qn, dp - qn, qn, dinv, tp);
-
- if (qn != dn)
- {
- if (qn > dn - qn)
- mpn_mul (tp, qp, qn, dp - dn, dn - qn);
- else
- mpn_mul (tp, dp - dn, dn - qn, qp, qn);
-
- cy = mpn_sub_n (np - dn, np - dn, tp, dn);
- if (qh != 0)
- cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn);
-
- while (cy != 0)
- {
- qh -= mpn_sub_1 (qp, qp, qn, 1);
- cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn);
- }
- }
- }
-
- TMP_FREE;
- return qh;
-}
diff --git a/gmp/mpn/generic/dcpi1_divappr_q.c b/gmp/mpn/generic/dcpi1_divappr_q.c
deleted file mode 100644
index c7b03c7f49..0000000000
--- a/gmp/mpn/generic/dcpi1_divappr_q.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* mpn_dcpi1_divappr_q -- divide-and-conquer division, returning approximate
- quotient. The quotient returned is either correct, or one too large.
-
- 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 GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-mp_limb_t
-mpn_dcpi1_divappr_q_n (mp_ptr qp, mp_ptr np, mp_srcptr dp, mp_size_t n,
- gmp_pi1_t *dinv, mp_ptr tp)
-{
- mp_size_t lo, hi;
- mp_limb_t cy, qh, ql;
-
- lo = n >> 1; /* floor(n/2) */
- hi = n - lo; /* ceil(n/2) */
-
- if (BELOW_THRESHOLD (hi, DC_DIV_QR_THRESHOLD))
- qh = mpn_sbpi1_div_qr (qp + lo, np + 2 * lo, 2 * hi, dp + lo, hi, dinv->inv32);
- else
- qh = mpn_dcpi1_div_qr_n (qp + lo, np + 2 * lo, dp + lo, hi, dinv, tp);
-
- mpn_mul (tp, qp + lo, hi, dp, lo);
-
- cy = mpn_sub_n (np + lo, np + lo, tp, n);
- if (qh != 0)
- cy += mpn_sub_n (np + n, np + n, dp, lo);
-
- while (cy != 0)
- {
- qh -= mpn_sub_1 (qp + lo, qp + lo, hi, 1);
- cy -= mpn_add_n (np + lo, np + lo, dp, n);
- }
-
- if (BELOW_THRESHOLD (lo, DC_DIVAPPR_Q_THRESHOLD))
- ql = mpn_sbpi1_divappr_q (qp, np + hi, 2 * lo, dp + hi, lo, dinv->inv32);
- else
- ql = mpn_dcpi1_divappr_q_n (qp, np + hi, dp + hi, lo, dinv, tp);
-
- if (UNLIKELY (ql != 0))
- {
- mp_size_t i;
- for (i = 0; i < lo; i++)
- qp[i] = GMP_NUMB_MASK;
- }
-
- return qh;
-}
-
-mp_limb_t
-mpn_dcpi1_divappr_q (mp_ptr qp, mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv)
-{
- mp_size_t qn;
- mp_limb_t qh, cy, qsave;
- mp_ptr tp;
- TMP_DECL;
-
- TMP_MARK;
-
- ASSERT (dn >= 6);
- ASSERT (nn > dn);
- ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT);
-
- qn = nn - dn;
- qp += qn;
- np += nn;
- dp += dn;
-
- if (qn >= dn)
- {
- qn++; /* pretend we'll need an extra limb */
- /* Reduce qn mod dn without division, optimizing small operations. */
- do
- qn -= dn;
- while (qn > dn);
-
- qp -= qn; /* point at low limb of next quotient block */
- np -= qn; /* point in the middle of partial remainder */
-
- tp = TMP_SALLOC_LIMBS (dn);
-
- /* Perform the typically smaller block first. */
- if (qn == 1)
- {
- mp_limb_t q, n2, n1, n0, d1, d0;
-
- /* Handle qh up front, for simplicity. */
- qh = mpn_cmp (np - dn + 1, dp - dn, dn) >= 0;
- if (qh)
- ASSERT_NOCARRY (mpn_sub_n (np - dn + 1, np - dn + 1, dp - dn, dn));
-
- /* A single iteration of schoolbook: One 3/2 division,
- followed by the bignum update and adjustment. */
- n2 = np[0];
- n1 = np[-1];
- n0 = np[-2];
- d1 = dp[-1];
- d0 = dp[-2];
-
- ASSERT (n2 < d1 || (n2 == d1 && n1 <= d0));
-
- if (UNLIKELY (n2 == d1) && n1 == d0)
- {
- q = GMP_NUMB_MASK;
- cy = mpn_submul_1 (np - dn, dp - dn, dn, q);
- ASSERT (cy == n2);
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n2, n1, n0, d1, d0, dinv->inv32);
-
- if (dn > 2)
- {
- mp_limb_t cy, cy1;
- cy = mpn_submul_1 (np - dn, dp - dn, dn - 2, q);
-
- cy1 = n0 < cy;
- n0 = (n0 - cy) & GMP_NUMB_MASK;
- cy = n1 < cy1;
- n1 = (n1 - cy1) & GMP_NUMB_MASK;
- np[-2] = n0;
-
- if (UNLIKELY (cy != 0))
- {
- n1 += d1 + mpn_add_n (np - dn, np - dn, dp - dn, dn - 1);
- qh -= (q == 0);
- q = (q - 1) & GMP_NUMB_MASK;
- }
- }
- else
- np[-2] = n0;
-
- np[-1] = n1;
- }
- qp[0] = q;
- }
- else
- {
- if (qn == 2)
- qh = mpn_divrem_2 (qp, 0L, np - 2, 4, dp - 2);
- else if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD))
- qh = mpn_sbpi1_div_qr (qp, np - qn, 2 * qn, dp - qn, qn, dinv->inv32);
- else
- qh = mpn_dcpi1_div_qr_n (qp, np - qn, dp - qn, qn, dinv, tp);
-
- if (qn != dn)
- {
- if (qn > dn - qn)
- mpn_mul (tp, qp, qn, dp - dn, dn - qn);
- else
- mpn_mul (tp, dp - dn, dn - qn, qp, qn);
-
- cy = mpn_sub_n (np - dn, np - dn, tp, dn);
- if (qh != 0)
- cy += mpn_sub_n (np - dn + qn, np - dn + qn, dp - dn, dn - qn);
-
- while (cy != 0)
- {
- qh -= mpn_sub_1 (qp, qp, qn, 1);
- cy -= mpn_add_n (np - dn, np - dn, dp - dn, dn);
- }
- }
- }
- qn = nn - dn - qn + 1;
- while (qn > dn)
- {
- qp -= dn;
- np -= dn;
- mpn_dcpi1_div_qr_n (qp, np - dn, dp - dn, dn, dinv, tp);
- qn -= dn;
- }
-
- /* Since we pretended we'd need an extra quotient limb before, we now
- have made sure the code above left just dn-1=qn quotient limbs to
- develop. Develop that plus a guard limb. */
- qn--;
- qp -= qn;
- np -= dn;
- qsave = qp[qn];
- mpn_dcpi1_divappr_q_n (qp, np - dn, dp - dn, dn, dinv, tp);
- MPN_COPY_INCR (qp, qp + 1, qn);
- qp[qn] = qsave;
- }
- else /* (qn < dn) */
- {
- mp_ptr q2p;
-#if 0 /* not possible since we demand nn > dn */
- if (qn == 0)
- {
- qh = mpn_cmp (np - dn, dp - dn, dn) >= 0;
- if (qh)
- mpn_sub_n (np - dn, np - dn, dp - dn, dn);
- TMP_FREE;
- return qh;
- }
-#endif
-
- qp -= qn; /* point at low limb of next quotient block */
- np -= qn; /* point in the middle of partial remainder */
-
- q2p = TMP_SALLOC_LIMBS (qn + 1);
- /* Should we at all check DC_DIVAPPR_Q_THRESHOLD here, or reply on
- callers not to be silly? */
- if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD))
- {
- qh = mpn_sbpi1_divappr_q (q2p, np - qn - 2, 2 * (qn + 1),
- dp - (qn + 1), qn + 1, dinv->inv32);
- }
- else
- {
- /* It is tempting to use qp for recursive scratch and put quotient in
- tp, but the recursive scratch needs one limb too many. */
- tp = TMP_SALLOC_LIMBS (qn + 1);
- qh = mpn_dcpi1_divappr_q_n (q2p, np - qn - 2, dp - (qn + 1), qn + 1, dinv, tp);
- }
- MPN_COPY (qp, q2p + 1, qn);
- }
-
- TMP_FREE;
- return qh;
-}
diff --git a/gmp/mpn/generic/div_q.c b/gmp/mpn/generic/div_q.c
deleted file mode 100644
index aabcef0825..0000000000
--- a/gmp/mpn/generic/div_q.c
+++ /dev/null
@@ -1,323 +0,0 @@
-/* mpn_div_q -- division for arbitrary size operands.
-
- Contributed to the GNU project by Torbjorn Granlund.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-/* Compute Q = N/D with truncation.
- N = {np,nn}
- D = {dp,dn}
- Q = {qp,nn-dn+1}
- T = {scratch,nn+1} is scratch space
- N and D are both untouched by the computation.
- N and T may overlap; pass the same space if N is irrelevant after the call,
- but note that tp needs an extra limb.
-
- Operand requirements:
- N >= D > 0
- dp[dn-1] != 0
- No overlap between the N, D, and Q areas.
-
- This division function does not clobber its input operands, since it is
- intended to support average-O(qn) division, and for that to be effective, it
- cannot put requirements on callers to copy a O(nn) operand.
-
- If a caller does not care about the value of {np,nn+1} after calling this
- function, it should pass np also for the scratch argument. This function
- will then save some time and space by avoiding allocation and copying.
- (FIXME: Is this a good design? We only really save any copying for
- already-normalised divisors, which should be rare. It also prevents us from
- reasonably asking for all scratch space we need.)
-
- We write nn-dn+1 limbs for the quotient, but return void. Why not return
- the most significant quotient limb? Look at the 4 main code blocks below
- (consisting of an outer if-else where each arm contains an if-else). It is
- tricky for the first code block, since the mpn_*_div_q calls will typically
- generate all nn-dn+1 and return 0 or 1. I don't see how to fix that unless
- we generate the most significant quotient limb here, before calling
- mpn_*_div_q, or put the quotient in a temporary area. Since this is a
- critical division case (the SB sub-case in particular) copying is not a good
- idea.
-
- It might make sense to split the if-else parts of the (qn + FUDGE
- >= dn) blocks into separate functions, since we could promise quite
- different things to callers in these two cases. The 'then' case
- benefits from np=scratch, and it could perhaps even tolerate qp=np,
- saving some headache for many callers.
-
- FIXME: Scratch allocation leaves a lot to be desired. E.g., for the MU size
- operands, we do not reuse the huge scratch for adjustments. This can be a
- serious waste of memory for the largest operands.
-*/
-
-/* FUDGE determines when to try getting an approximate quotient from the upper
- parts of the dividend and divisor, then adjust. N.B. FUDGE must be >= 2
- for the code to be correct. */
-#define FUDGE 5 /* FIXME: tune this */
-
-#define DC_DIV_Q_THRESHOLD DC_DIVAPPR_Q_THRESHOLD
-#define MU_DIV_Q_THRESHOLD MU_DIVAPPR_Q_THRESHOLD
-#define MUPI_DIV_Q_THRESHOLD MUPI_DIVAPPR_Q_THRESHOLD
-#ifndef MUPI_DIVAPPR_Q_THRESHOLD
-#define MUPI_DIVAPPR_Q_THRESHOLD MUPI_DIV_QR_THRESHOLD
-#endif
-
-void
-mpn_div_q (mp_ptr qp,
- mp_srcptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn, mp_ptr scratch)
-{
- mp_ptr new_dp, new_np, tp, rp;
- mp_limb_t cy, dh, qh;
- mp_size_t new_nn, qn;
- gmp_pi1_t dinv;
- int cnt;
- TMP_DECL;
- TMP_MARK;
-
- ASSERT (nn >= dn);
- ASSERT (dn > 0);
- ASSERT (dp[dn - 1] != 0);
- ASSERT (! MPN_OVERLAP_P (qp, nn - dn + 1, np, nn));
- ASSERT (! MPN_OVERLAP_P (qp, nn - dn + 1, dp, dn));
- ASSERT (MPN_SAME_OR_SEPARATE_P (np, scratch, nn));
-
- ASSERT_ALWAYS (FUDGE >= 2);
-
- if (dn == 1)
- {
- mpn_divrem_1 (qp, 0L, np, nn, dp[dn - 1]);
- return;
- }
-
- qn = nn - dn + 1; /* Quotient size, high limb might be zero */
-
- if (qn + FUDGE >= dn)
- {
- /* |________________________|
- |_______| */
- new_np = scratch;
-
- dh = dp[dn - 1];
- if (LIKELY ((dh & GMP_NUMB_HIGHBIT) == 0))
- {
- count_leading_zeros (cnt, dh);
-
- cy = mpn_lshift (new_np, np, nn, cnt);
- new_np[nn] = cy;
- new_nn = nn + (cy != 0);
-
- new_dp = TMP_ALLOC_LIMBS (dn);
- mpn_lshift (new_dp, dp, dn, cnt);
-
- if (dn == 2)
- {
- qh = mpn_divrem_2 (qp, 0L, new_np, new_nn, new_dp);
- }
- else if (BELOW_THRESHOLD (dn, DC_DIV_Q_THRESHOLD) ||
- BELOW_THRESHOLD (new_nn - dn, DC_DIV_Q_THRESHOLD))
- {
- invert_pi1 (dinv, new_dp[dn - 1], new_dp[dn - 2]);
- qh = mpn_sbpi1_div_q (qp, new_np, new_nn, new_dp, dn, dinv.inv32);
- }
- else if (BELOW_THRESHOLD (dn, MUPI_DIV_Q_THRESHOLD) || /* fast condition */
- BELOW_THRESHOLD (nn, 2 * MU_DIV_Q_THRESHOLD) || /* fast condition */
- (double) (2 * (MU_DIV_Q_THRESHOLD - MUPI_DIV_Q_THRESHOLD)) * dn /* slow... */
- + (double) MUPI_DIV_Q_THRESHOLD * nn > (double) dn * nn) /* ...condition */
- {
- invert_pi1 (dinv, new_dp[dn - 1], new_dp[dn - 2]);
- qh = mpn_dcpi1_div_q (qp, new_np, new_nn, new_dp, dn, &dinv);
- }
- else
- {
- mp_size_t itch = mpn_mu_div_q_itch (new_nn, dn, 0);
- mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
- qh = mpn_mu_div_q (qp, new_np, new_nn, new_dp, dn, scratch);
- }
- if (cy == 0)
- qp[qn - 1] = qh;
- else if (UNLIKELY (qh != 0))
- {
- /* This happens only when the quotient is close to B^n and
- mpn_*_divappr_q returned B^n. */
- mp_size_t i, n;
- n = new_nn - dn;
- for (i = 0; i < n; i++)
- qp[i] = GMP_NUMB_MAX;
- qh = 0; /* currently ignored */
- }
- }
- else /* divisor is already normalised */
- {
- if (new_np != np)
- MPN_COPY (new_np, np, nn);
-
- if (dn == 2)
- {
- qh = mpn_divrem_2 (qp, 0L, new_np, nn, dp);
- }
- else if (BELOW_THRESHOLD (dn, DC_DIV_Q_THRESHOLD) ||
- BELOW_THRESHOLD (nn - dn, DC_DIV_Q_THRESHOLD))
- {
- invert_pi1 (dinv, dh, dp[dn - 2]);
- qh = mpn_sbpi1_div_q (qp, new_np, nn, dp, dn, dinv.inv32);
- }
- else if (BELOW_THRESHOLD (dn, MUPI_DIV_Q_THRESHOLD) || /* fast condition */
- BELOW_THRESHOLD (nn, 2 * MU_DIV_Q_THRESHOLD) || /* fast condition */
- (double) (2 * (MU_DIV_Q_THRESHOLD - MUPI_DIV_Q_THRESHOLD)) * dn /* slow... */
- + (double) MUPI_DIV_Q_THRESHOLD * nn > (double) dn * nn) /* ...condition */
- {
- invert_pi1 (dinv, dh, dp[dn - 2]);
- qh = mpn_dcpi1_div_q (qp, new_np, nn, dp, dn, &dinv);
- }
- else
- {
- mp_size_t itch = mpn_mu_div_q_itch (nn, dn, 0);
- mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
- qh = mpn_mu_div_q (qp, np, nn, dp, dn, scratch);
- }
- qp[nn - dn] = qh;
- }
- }
- else
- {
- /* |________________________|
- |_________________| */
- tp = TMP_ALLOC_LIMBS (qn + 1);
-
- new_np = scratch;
- new_nn = 2 * qn + 1;
- if (new_np == np)
- /* We need {np,nn} to remain untouched until the final adjustment, so
- we need to allocate separate space for new_np. */
- new_np = TMP_ALLOC_LIMBS (new_nn + 1);
-
-
- dh = dp[dn - 1];
- if (LIKELY ((dh & GMP_NUMB_HIGHBIT) == 0))
- {
- count_leading_zeros (cnt, dh);
-
- cy = mpn_lshift (new_np, np + nn - new_nn, new_nn, cnt);
- new_np[new_nn] = cy;
-
- new_nn += (cy != 0);
-
- new_dp = TMP_ALLOC_LIMBS (qn + 1);
- mpn_lshift (new_dp, dp + dn - (qn + 1), qn + 1, cnt);
- new_dp[0] |= dp[dn - (qn + 1) - 1] >> (GMP_NUMB_BITS - cnt);
-
- if (qn + 1 == 2)
- {
- qh = mpn_divrem_2 (tp, 0L, new_np, new_nn, new_dp);
- }
- else if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD - 1))
- {
- invert_pi1 (dinv, new_dp[qn], new_dp[qn - 1]);
- qh = mpn_sbpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, dinv.inv32);
- }
- else if (BELOW_THRESHOLD (qn, MU_DIVAPPR_Q_THRESHOLD - 1))
- {
- invert_pi1 (dinv, new_dp[qn], new_dp[qn - 1]);
- qh = mpn_dcpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, &dinv);
- }
- else
- {
- mp_size_t itch = mpn_mu_divappr_q_itch (new_nn, qn + 1, 0);
- mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
- qh = mpn_mu_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, scratch);
- }
- if (cy == 0)
- tp[qn] = qh;
- else if (UNLIKELY (qh != 0))
- {
- /* This happens only when the quotient is close to B^n and
- mpn_*_divappr_q returned B^n. */
- mp_size_t i, n;
- n = new_nn - (qn + 1);
- for (i = 0; i < n; i++)
- tp[i] = GMP_NUMB_MAX;
- qh = 0; /* currently ignored */
- }
- }
- else /* divisor is already normalised */
- {
- MPN_COPY (new_np, np + nn - new_nn, new_nn); /* pointless of MU will be used */
-
- new_dp = (mp_ptr) dp + dn - (qn + 1);
-
- if (qn == 2 - 1)
- {
- qh = mpn_divrem_2 (tp, 0L, new_np, new_nn, new_dp);
- }
- else if (BELOW_THRESHOLD (qn, DC_DIVAPPR_Q_THRESHOLD - 1))
- {
- invert_pi1 (dinv, dh, new_dp[qn - 1]);
- qh = mpn_sbpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, dinv.inv32);
- }
- else if (BELOW_THRESHOLD (qn, MU_DIVAPPR_Q_THRESHOLD - 1))
- {
- invert_pi1 (dinv, dh, new_dp[qn - 1]);
- qh = mpn_dcpi1_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, &dinv);
- }
- else
- {
- mp_size_t itch = mpn_mu_divappr_q_itch (new_nn, qn + 1, 0);
- mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
- qh = mpn_mu_divappr_q (tp, new_np, new_nn, new_dp, qn + 1, scratch);
- }
- tp[qn] = qh;
- }
-
- MPN_COPY (qp, tp + 1, qn);
- if (tp[0] <= 4)
- {
- mp_size_t rn;
-
- rp = TMP_ALLOC_LIMBS (dn + qn);
- mpn_mul (rp, dp, dn, tp + 1, qn);
- rn = dn + qn;
- rn -= rp[rn - 1] == 0;
-
- if (rn > nn || mpn_cmp (np, rp, nn) < 0)
- mpn_decr_u (qp, 1);
- }
- }
-
- TMP_FREE;
-}
diff --git a/gmp/mpn/generic/div_qr_1.c b/gmp/mpn/generic/div_qr_1.c
deleted file mode 100644
index 09401ac535..0000000000
--- a/gmp/mpn/generic/div_qr_1.c
+++ /dev/null
@@ -1,126 +0,0 @@
-/* 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/gmp/mpn/generic/div_qr_1n_pi1.c b/gmp/mpn/generic/div_qr_1n_pi1.c
deleted file mode 100644
index 229ee091a4..0000000000
--- a/gmp/mpn/generic/div_qr_1n_pi1.c
+++ /dev/null
@@ -1,277 +0,0 @@
-/* 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/gmp/mpn/generic/div_qr_1n_pi2.c b/gmp/mpn/generic/div_qr_1n_pi2.c
deleted file mode 100644
index 7ea3410cb6..0000000000
--- a/gmp/mpn/generic/div_qr_1n_pi2.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* 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/gmp/mpn/generic/div_qr_1u_pi2.c b/gmp/mpn/generic/div_qr_1u_pi2.c
deleted file mode 100644
index 83d66ef29e..0000000000
--- a/gmp/mpn/generic/div_qr_1u_pi2.c
+++ /dev/null
@@ -1,228 +0,0 @@
-/* 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
-}
diff --git a/gmp/mpn/generic/div_qr_2.c b/gmp/mpn/generic/div_qr_2.c
deleted file mode 100644
index cb07e0e3b4..0000000000
--- a/gmp/mpn/generic/div_qr_2.c
+++ /dev/null
@@ -1,332 +0,0 @@
-/* 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
-
- 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-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_2_PI2_THRESHOLD
-/* Disabled unless explicitly tuned. */
-#define DIV_QR_2_PI2_THRESHOLD MP_LIMB_T_MAX
-#endif
-
-#ifndef SANITY_CHECK
-#define SANITY_CHECK 0
-#endif
-
-/* Define some longlong.h-style macros, but for wider operations.
- * add_sssaaaa is like longlong.h's add_ssaaaa but the propagating
- carry-out into an additional sum operand.
- * add_csaac accepts two addends and a carry in, and generates a sum
- and a carry out. A little like a "full adder".
-*/
-#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)))
-#define add_csaac(co, s, a, b, ci) \
- __asm__ ("bt\t$0, %2\n\tadc\t%5, %k1\n\tadc\t%k0, %k0" \
- : "=r" (co), "=r" (s) \
- : "rm" ((USItype)(ci)), "0" (CNST_LIMB(0)), \
- "%1" ((USItype)(a)), "g" ((USItype)(b)))
-#endif
-
-#if defined (__amd64__) && W_TYPE_SIZE == 64
-#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)))
-#define add_csaac(co, s, a, b, ci) \
- __asm__ ("bt\t$0, %2\n\tadc\t%5, %q1\n\tadc\t%q0, %q0" \
- : "=r" (co), "=r" (s) \
- : "rm" ((UDItype)(ci)), "0" (CNST_LIMB(0)), \
- "%1" ((UDItype)(a)), "g" ((UDItype)(b)))
-#endif
-
-#if 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
-
-#ifndef add_csaac
-#define add_csaac(co, s, a, b, ci) \
- do { \
- UWtype __s, __c; \
- __s = (a) + (b); \
- __c = __s < (a); \
- __s = __s + (ci); \
- (s) = __s; \
- (co) = __c + (__s < (ci)); \
- } while (0)
-#endif
-
-/* Typically used with r1, r0 same as n3, n2. Other types of overlap
- between inputs and outputs are not supported. */
-#define udiv_qr_4by2(q1,q0, r1,r0, n3,n2,n1,n0, d1,d0, di1,di0) \
- do { \
- mp_limb_t _q3, _q2a, _q2, _q1, _q2c, _q1c, _q1d, _q0; \
- mp_limb_t _t1, _t0; \
- mp_limb_t _c, _mask; \
- \
- umul_ppmm (_q3,_q2a, n3, di1); \
- umul_ppmm (_q2,_q1, n2, di1); \
- umul_ppmm (_q2c,_q1c, n3, di0); \
- add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2c,_q1c); \
- umul_ppmm (_q1d,_q0, n2, di0); \
- add_sssaaaa (_q3,_q2,_q1, _q2,_q1, _q2a,_q1d); \
- \
- add_ssaaaa (r1, r0, n3, n2, CNST_LIMB(0), CNST_LIMB(1)); \
- \
- /* [q3,q2,q1,q0] += [n3,n3,n1,n0] */ \
- add_csaac (_c, _q0, _q0, n0, CNST_LIMB(0)); \
- add_csaac (_c, _q1, _q1, n1, _c); \
- add_csaac (_c, _q2, _q2, r0, _c); \
- _q3 = _q3 + r1 + _c; \
- \
- umul_ppmm (_t1,_t0, _q2, d0); \
- _t1 += _q2 * d1 + _q3 * d0; \
- \
- sub_ddmmss (r1, r0, n1, n0, _t1, _t0); \
- \
- _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, 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, CNST_LIMB(0), CNST_LIMB(1));\
- } \
- } \
- (q1) = _q3; \
- (q0) = _q2; \
- } while (0)
-
-static void
-invert_4by2 (mp_ptr di, mp_limb_t d1, mp_limb_t d0)
-{
- mp_limb_t v1, v0, p1, t1, t0, p0, mask;
- invert_limb (v1, d1);
- p1 = d1 * v1;
- /* <1, v1> * d1 = <B-1, p1> */
- p1 += d0;
- if (p1 < d0)
- {
- v1--;
- mask = -(mp_limb_t) (p1 >= d1);
- p1 -= d1;
- v1 += mask;
- p1 -= mask & d1;
- }
- /* <1, v1> * d1 + d0 = <B-1, p1> */
- umul_ppmm (t1, p0, d0, v1);
- p1 += t1;
- if (p1 < t1)
- {
- if (UNLIKELY (p1 >= d1))
- {
- if (p1 > d1 || p0 >= d0)
- {
- sub_ddmmss (p1, p0, p1, p0, d1, d0);
- v1--;
- }
- }
- sub_ddmmss (p1, p0, p1, p0, d1, d0);
- v1--;
- }
- /* Now v1 is the 3/2 inverse, <1, v1> * <d1, d0> = <B-1, p1, p0>,
- * with <p1, p0> + <d1, d0> >= B^2.
- *
- * The 4/2 inverse is (B^4 - 1) / <d1, d0> = <1, v1, v0>. The
- * partial remainder after <1, v1> is
- *
- * B^4 - 1 - B <1, v1> <d1, d0> = <B-1, B-1, B-1, B-1> - <B-1, p1, p0, 0>
- * = <~p1, ~p0, B-1>
- */
- udiv_qr_3by2 (v0, t1, t0, ~p1, ~p0, MP_LIMB_T_MAX, d1, d0, v1);
- di[0] = v0;
- di[1] = v1;
-
-#if SANITY_CHECK
- {
- mp_limb_t tp[4];
- mp_limb_t dp[2];
- dp[0] = d0;
- dp[1] = d1;
- mpn_mul_n (tp, dp, di, 2);
- ASSERT_ALWAYS (mpn_add_n (tp+2, tp+2, dp, 2) == 0);
- ASSERT_ALWAYS (tp[2] == MP_LIMB_T_MAX);
- ASSERT_ALWAYS (tp[3] == MP_LIMB_T_MAX);
- ASSERT_ALWAYS (mpn_add_n (tp, tp, dp, 2) == 1);
- }
-#endif
-}
-
-static mp_limb_t
-mpn_div_qr_2n_pi2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0, mp_limb_t di1, mp_limb_t di0)
-{
- mp_limb_t qh;
- mp_size_t i;
- mp_limb_t r1, r0;
-
- ASSERT (nn >= 2);
- ASSERT (d1 & GMP_NUMB_HIGHBIT);
-
- r1 = np[nn-1];
- r0 = np[nn-2];
-
- qh = 0;
- if (r1 >= d1 && (r1 > d1 || r0 >= d0))
- {
-#if GMP_NAIL_BITS == 0
- sub_ddmmss (r1, r0, r1, r0, d1, d0);
-#else
- r0 = r0 - d0;
- r1 = r1 - d1 - (r0 >> GMP_LIMB_BITS - 1);
- r0 &= GMP_NUMB_MASK;
-#endif
- qh = 1;
- }
-
- for (i = nn - 2; i >= 2; i -= 2)
- {
- mp_limb_t n1, n0, q1, q0;
- n1 = np[i-1];
- n0 = np[i-2];
- udiv_qr_4by2 (q1, q0, r1, r0, r1, r0, n1, n0, d1, d0, di1, di0);
- qp[i-1] = q1;
- qp[i-2] = q0;
- }
-
- if (i > 0)
- {
- mp_limb_t q;
- udiv_qr_3by2 (q, r1, r0, r1, r0, np[0], d1, d0, di1);
- qp[0] = q;
- }
- rp[1] = r1;
- rp[0] = r0;
-
- return qh;
-}
-
-
-/* Divide num {np,nn} by den {dp,2} and write the nn-2 least
- significant quotient limbs at qp and the 2 long remainder at np.
- Return the most significant limb of the quotient.
-
- Preconditions:
- 1. qp must either not overlap with the input operands at all, or
- qp >= np + 2 must hold true. (This means that it's possible to put
- the quotient in the high part of {np,nn}, right above the remainder.
- 2. nn >= 2. */
-
-mp_limb_t
-mpn_div_qr_2 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
- mp_srcptr dp)
-{
- mp_limb_t d1;
- mp_limb_t d0;
- gmp_pi1_t dinv;
-
- ASSERT (nn >= 2);
- ASSERT (! MPN_OVERLAP_P (qp, nn-2, np, nn) || qp >= np + 2);
- ASSERT_MPN (np, nn);
- ASSERT_MPN (dp, 2);
-
- d1 = dp[1]; d0 = dp[0];
-
- ASSERT (d1 > 0);
-
- if (UNLIKELY (d1 & GMP_NUMB_HIGHBIT))
- {
- if (BELOW_THRESHOLD (nn, DIV_QR_2_PI2_THRESHOLD))
- {
- gmp_pi1_t dinv;
- invert_pi1 (dinv, d1, d0);
- return mpn_div_qr_2n_pi1 (qp, rp, np, nn, d1, d0, dinv.inv32);
- }
- else
- {
- mp_limb_t di[2];
- invert_4by2 (di, d1, d0);
- return mpn_div_qr_2n_pi2 (qp, rp, np, nn, d1, d0, di[1], di[0]);
- }
- }
- else
- {
- int shift;
- count_leading_zeros (shift, d1);
- d1 = (d1 << shift) | (d0 >> (GMP_LIMB_BITS - shift));
- d0 <<= shift;
- invert_pi1 (dinv, d1, d0);
- return mpn_div_qr_2u_pi1 (qp, rp, np, nn, d1, d0, shift, dinv.inv32);
- }
-}
diff --git a/gmp/mpn/generic/div_qr_2n_pi1.c b/gmp/mpn/generic/div_qr_2n_pi1.c
deleted file mode 100644
index da500e2170..0000000000
--- a/gmp/mpn/generic/div_qr_2n_pi1.c
+++ /dev/null
@@ -1,85 +0,0 @@
-/* mpn_div_qr_2n_pi1
-
- 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.
-
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-/* 3/2 loop, for normalized divisor */
-mp_limb_t
-mpn_div_qr_2n_pi1 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0, mp_limb_t di)
-{
- mp_limb_t qh;
- mp_size_t i;
- mp_limb_t r1, r0;
-
- ASSERT (nn >= 2);
- ASSERT (d1 & GMP_NUMB_HIGHBIT);
-
- np += nn - 2;
- r1 = np[1];
- r0 = np[0];
-
- qh = 0;
- if (r1 >= d1 && (r1 > d1 || r0 >= d0))
- {
-#if GMP_NAIL_BITS == 0
- sub_ddmmss (r1, r0, r1, r0, d1, d0);
-#else
- r0 = r0 - d0;
- r1 = r1 - d1 - (r0 >> GMP_LIMB_BITS - 1);
- r0 &= GMP_NUMB_MASK;
-#endif
- qh = 1;
- }
-
- for (i = nn - 2 - 1; i >= 0; i--)
- {
- mp_limb_t n0, q;
- n0 = np[-1];
- udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di);
- np--;
- qp[i] = q;
- }
-
- rp[1] = r1;
- rp[0] = r0;
-
- return qh;
-}
diff --git a/gmp/mpn/generic/div_qr_2u_pi1.c b/gmp/mpn/generic/div_qr_2u_pi1.c
deleted file mode 100644
index 0b9ddf5753..0000000000
--- a/gmp/mpn/generic/div_qr_2u_pi1.c
+++ /dev/null
@@ -1,77 +0,0 @@
-/* mpn_div_qr_2u_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 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-/* 3/2 loop, for unnormalized divisor. Caller must pass shifted d1 and
- d0, while {np,nn} is shifted on the fly. */
-mp_limb_t
-mpn_div_qr_2u_pi1 (mp_ptr qp, mp_ptr rp, mp_srcptr np, mp_size_t nn,
- mp_limb_t d1, mp_limb_t d0, int shift, mp_limb_t di)
-{
- mp_limb_t qh;
- mp_limb_t r2, r1, r0;
- mp_size_t i;
-
- ASSERT (nn >= 2);
- ASSERT (d1 & GMP_NUMB_HIGHBIT);
- ASSERT (shift > 0);
-
- r2 = np[nn-1] >> (GMP_LIMB_BITS - shift);
- r1 = (np[nn-1] << shift) | (np[nn-2] >> (GMP_LIMB_BITS - shift));
- r0 = np[nn-2] << shift;
-
- udiv_qr_3by2 (qh, r2, r1, r2, r1, r0, d1, d0, di);
-
- for (i = nn - 2 - 1; i >= 0; i--)
- {
- mp_limb_t q;
- r0 = np[i];
- r1 |= r0 >> (GMP_LIMB_BITS - shift);
- r0 <<= shift;
- udiv_qr_3by2 (q, r2, r1, r2, r1, r0, d1, d0, di);
- qp[i] = q;
- }
-
- rp[0] = (r1 >> shift) | (r2 << (GMP_LIMB_BITS - shift));
- rp[1] = r2 >> shift;
-
- return qh;
-}
diff --git a/gmp/mpn/generic/dive_1.c b/gmp/mpn/generic/dive_1.c
index 1c0a4e894d..27df57b80e 100644
--- a/gmp/mpn/generic/dive_1.c
+++ b/gmp/mpn/generic/dive_1.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2003, 2005, 2013 Free Software Foundation, Inc.
+Copyright 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -41,7 +30,7 @@ see https://www.gnu.org/licenses/. */
/* Divide a={src,size} by d=divisor and store the quotient in q={dst,size}.
q will only be correct if d divides a exactly.
- A separate loop is used for shift==0 because n<<GMP_LIMB_BITS doesn't
+ A separate loop is used for shift==0 because n<<BITS_PER_MP_LIMB doesn't
give zero on all CPUs (for instance it doesn't on the x86s). This
separate loop might run faster too, helping odd divisors.
@@ -61,7 +50,7 @@ see https://www.gnu.org/licenses/. */
faster on some CPUs and would mean just the shift==0 style loop would be
needed.
- If n<<GMP_LIMB_BITS gives zero on a particular CPU then the separate
+ If n<<BITS_PER_MP_LIMB gives zero on a particular CPU then the separate
shift==0 loop is unnecessary, and could be eliminated if there's no great
speed difference.
@@ -87,6 +76,14 @@ 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);
@@ -101,39 +98,40 @@ 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--;
- s = src[0];
-
- for (i = 1; i < size; i++)
+ do
{
- s_next = src[i];
+ s_next = src[i+1];
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 - 1] = l;
+ dst[i] = 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[size - 1] = l;
+ dst[i] = l;
}
else
{
- s = src[0];
-
l = (s * inverse) & GMP_NUMB_MASK;
dst[0] = l;
+ i = 1;
c = 0;
- for (i = 1; i < size; i++)
+ do
{
umul_ppmm (h, dummy, l, divisor);
c += h;
@@ -143,6 +141,8 @@ 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);
}
}
diff --git a/gmp/mpn/generic/diveby3.c b/gmp/mpn/generic/diveby3.c
index 2ffd9fe777..6293f65a89 100644
--- a/gmp/mpn/generic/diveby3.c
+++ b/gmp/mpn/generic/diveby3.c
@@ -1,32 +1,21 @@
/* mpn_divexact_by3c -- mpn exact division by 3.
-Copyright 2000-2003, 2008 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/divexact.c b/gmp/mpn/generic/divexact.c
index 47a47e3d80..a0e439cbee 100644
--- a/gmp/mpn/generic/divexact.c
+++ b/gmp/mpn/generic/divexact.c
@@ -4,104 +4,28 @@
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 GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
-Copyright 2006, 2007, 2009 Free Software Foundation, Inc.
+Copyright 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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 1
-void
-mpn_divexact (mp_ptr qp,
- mp_srcptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn)
-{
- unsigned shift;
- mp_size_t qn;
- mp_ptr tp;
- TMP_DECL;
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
- ASSERT (dn > 0);
- ASSERT (nn >= dn);
- ASSERT (dp[dn-1] > 0);
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
- while (dp[0] == 0)
- {
- ASSERT (np[0] == 0);
- dp++;
- np++;
- dn--;
- nn--;
- }
-
- if (dn == 1)
- {
- MPN_DIVREM_OR_DIVEXACT_1 (qp, np, nn, dp[0]);
- return;
- }
-
- TMP_MARK;
-
- qn = nn + 1 - dn;
- count_trailing_zeros (shift, dp[0]);
-
- if (shift > 0)
- {
- mp_ptr wp;
- mp_size_t ss;
- ss = (dn > qn) ? qn + 1 : dn;
-
- tp = TMP_ALLOC_LIMBS (ss);
- mpn_rshift (tp, dp, ss, shift);
- dp = tp;
-
- /* Since we have excluded dn == 1, we have nn > qn, and we need
- to shift one limb beyond qn. */
- wp = TMP_ALLOC_LIMBS (qn + 1);
- mpn_rshift (wp, np, qn + 1, shift);
- np = wp;
- }
-
- if (dn > qn)
- dn = qn;
-
- tp = TMP_ALLOC_LIMBS (mpn_bdiv_q_itch (qn, dn));
- mpn_bdiv_q (qp, np, qn, dp, dn, tp);
- TMP_FREE;
-}
-
-#else
/* We use the Jebelean's bidirectional exact division algorithm. This is
somewhat naively implemented, with equal quotient parts done by 2-adic
@@ -120,8 +44,17 @@ mpn_divexact (mp_ptr qp,
* It makes the msb part 1 or 2 limbs larger than the lsb part, in spite of
that the latter is faster. We should at least reverse this, but perhaps
we should make the lsb part considerably larger. (How do we tune this?)
+
+ Perhaps we could somehow use 2-adic division for both parts, not as now
+ truncating division for the upper part and 2-adic for the lower part.
*/
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+
mp_size_t
mpn_divexact_itch (mp_size_t nn, mp_size_t dn)
{
@@ -143,8 +76,7 @@ mpn_divexact (mp_ptr qp,
int cnt;
mp_ptr xdp;
mp_limb_t di;
- mp_limb_t cy;
- gmp_pi1_t dinv;
+ mp_limb_t dip[2], xp[2], cy;
TMP_DECL;
TMP_MARK;
@@ -158,7 +90,7 @@ mpn_divexact (mp_ptr qp,
MPN_COPY (tp, np, qn);
binvert_limb (di, dp[0]); di = -di;
dn = MIN (dn, qn);
- mpn_sbpi1_bdiv_q (qp, tp, qn, dp, dn, di);
+ mpn_sb_bdiv_q (qp, tp, qn, dp, dn, di);
TMP_FREE;
return;
}
@@ -175,14 +107,14 @@ mpn_divexact (mp_ptr qp,
MPN_COPY (tp, np, qn);
binvert_limb (di, dp[0]); di = -di;
dn = MIN (dn, qn);
- mpn_sbpi1_bdiv_q (qp, tp, qn, dp, dn, di);
+ mpn_sb_bdiv_q (qp, tp, qn, dp, dn, di);
}
else if (BELOW_THRESHOLD (dn, MU_BDIV_Q_THRESHOLD))
{
tp = scratch;
MPN_COPY (tp, np, qn);
binvert_limb (di, dp[0]); di = -di;
- mpn_dcpi1_bdiv_q (qp, tp, qn, dp, dn, di);
+ mpn_dc_bdiv_q (qp, tp, qn, dp, dn, di);
}
else
{
@@ -248,14 +180,23 @@ mpn_divexact (mp_ptr qp,
MPN_COPY (tp, np + nn - nn1, nn1);
}
- invert_pi1 (dinv, xdp[qn1 - 1], xdp[qn1 - 2]);
if (BELOW_THRESHOLD (qn1, DC_DIVAPPR_Q_THRESHOLD))
{
- qp[qn0 - 1 + nn1 - qn1] = mpn_sbpi1_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1, dinv.inv32);
+ /* Compute divisor inverse. */
+ cy = mpn_add_1 (xp, xdp + qn1 - 2, 2, 1);
+ if (cy != 0)
+ dip[0] = dip[1] = 0;
+ else
+ {
+ mp_limb_t scratch[10]; /* FIXME */
+ mpn_invert (dip, xp, 2, scratch);
+ }
+
+ qp[qn0 - 1 + nn1 - qn1] = mpn_sb_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1, dip);
}
else if (BELOW_THRESHOLD (qn1, MU_DIVAPPR_Q_THRESHOLD))
{
- qp[qn0 - 1 + nn1 - qn1] = mpn_dcpi1_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1, &dinv);
+ qp[qn0 - 1 + nn1 - qn1] = mpn_dc_divappr_q (qp + qn0 - 1, tp, nn1, xdp, qn1);
}
else
{
@@ -274,12 +215,12 @@ mpn_divexact (mp_ptr qp,
if (BELOW_THRESHOLD (qn0, DC_BDIV_Q_THRESHOLD))
{
MPN_COPY (tp, np, qn0);
- mpn_sbpi1_bdiv_q (qp, tp, qn0, dp, qn0, di);
+ mpn_sb_bdiv_q (qp, tp, qn0, dp, qn0, di);
}
else if (BELOW_THRESHOLD (qn0, MU_BDIV_Q_THRESHOLD))
{
MPN_COPY (tp, np, qn0);
- mpn_dcpi1_bdiv_q (qp, tp, qn0, dp, qn0, di);
+ mpn_dc_bdiv_q (qp, tp, qn0, dp, qn0, di);
}
else
{
@@ -291,4 +232,3 @@ mpn_divexact (mp_ptr qp,
TMP_FREE;
}
-#endif
diff --git a/gmp/mpn/generic/divis.c b/gmp/mpn/generic/divis.c
index 9e162e60d2..b05ecd8a78 100644
--- a/gmp/mpn/generic/divis.c
+++ b/gmp/mpn/generic/divis.c
@@ -4,80 +4,86 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-/* Determine whether A={ap,an} is divisible by D={dp,dn}. Must have both
- operands normalized, meaning high limbs non-zero, except that an==0 is
+/* Determine whether {ap,asize} is divisible by {dp,dsize}. Must have both
+ operands normalized, meaning high limbs non-zero, except that asize==0 is
allowed.
- There usually won't be many low zero bits on D, but the checks for this
+ There usually won't be many low zero bits on d, but the checks for this
are fast and might pick up a few operand combinations, in particular they
- might reduce D to fit the single-limb mod_1/modexact_1 code.
+ might reduce d to fit the single-limb mod_1/modexact_1 code.
Future:
+ This is currently not much faster than the user doing an mpz_tdiv_r
+ and testing for a zero remainder, but hopefully it can be improved.
+
+ mpn_bdivmod is one possibility, but it only trades udiv_qrnnd's for
+ multiplies, it won't save crossproducts the way it can in mpz_divexact.
+ Definitely worthwhile on small operands for most processors, but a
+ sub-quadratic version will be wanted before it can be used on all sizes.
+
Getting the remainder limb by limb would make an early exit possible on
finding a non-zero. This would probably have to be bdivmod style so
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
- 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. */
+ When d must be normalized (shifted to high bit set), it's possible to
+ just append a low zero limb to "a" rather than bit-shifting as
+ mpn_tdiv_qr does internally, so long as it's already been checked that a
+ has at least as many trailing zeros bits as d. Or equivalently, pass
+ qxn==1 to mpn_tdiv_qr, if/when it accepts that.
+
+ When called from mpz_congruent_p, {ap,asize} is a temporary which can be
+ destroyed. Maybe it'd be possible to get into mpn_tdiv_qr at a lower
+ level to save copying it, or maybe that function could accept rp==ap.
+
+ Could use __attribute__ ((regparm (2))) on i386, so the parameters
+ wouldn't need extra stack when called from mpz_divisible_p, but a
+ pre-release gcc 3 didn't generate particularly good register juggling in
+ that case, so this isn't done for now. */
int
-mpn_divisible_p (mp_srcptr ap, mp_size_t an,
- mp_srcptr dp, mp_size_t dn)
+mpn_divisible_p (mp_srcptr ap, mp_size_t asize,
+ mp_srcptr dp, mp_size_t dsize)
{
mp_limb_t alow, dlow, dmask;
- mp_ptr qp, rp, tp;
+ mp_ptr qp, rp;
mp_size_t i;
- mp_limb_t di;
- unsigned twos;
TMP_DECL;
- ASSERT (an >= 0);
- ASSERT (an == 0 || ap[an-1] != 0);
- ASSERT (dn >= 1);
- ASSERT (dp[dn-1] != 0);
- ASSERT_MPN (ap, an);
- ASSERT_MPN (dp, dn);
+ ASSERT (asize >= 0);
+ ASSERT (asize == 0 || ap[asize-1] != 0);
+ ASSERT (dsize >= 1);
+ ASSERT (dp[dsize-1] != 0);
+ ASSERT_MPN (ap, asize);
+ ASSERT_MPN (dp, dsize);
/* When a<d only a==0 is divisible.
- Notice this test covers all cases of an==0. */
- if (an < dn)
- return (an == 0);
+ Notice this test covers all cases of asize==0. */
+ if (asize < dsize)
+ return (asize == 0);
/* Strip low zero limbs from d, requiring a==0 on those. */
for (;;)
@@ -91,9 +97,9 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t an,
if (alow != 0)
return 0; /* a has fewer low zero limbs than d, so not divisible */
- /* a!=0 and d!=0 so won't get to n==0 */
- an--; ASSERT (an >= 1);
- dn--; ASSERT (dn >= 1);
+ /* a!=0 and d!=0 so won't get to size==0 */
+ asize--; ASSERT (asize >= 1);
+ dsize--; ASSERT (dsize >= 1);
ap++;
dp++;
}
@@ -103,88 +109,41 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t an,
if ((alow & dmask) != 0)
return 0;
- if (dn == 1)
+ if (dsize == 1)
{
- if (ABOVE_THRESHOLD (an, BMOD_1_TO_MOD_1_THRESHOLD))
- return mpn_mod_1 (ap, an, dlow) == 0;
+ if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD))
+ return mpn_mod_1 (ap, asize, dlow) == 0;
- count_trailing_zeros (twos, dlow);
- dlow >>= twos;
- return mpn_modexact_1_odd (ap, an, dlow) == 0;
+ if ((dlow & 1) == 0)
+ {
+ unsigned twos;
+ count_trailing_zeros (twos, dlow);
+ dlow >>= twos;
+ }
+ return mpn_modexact_1_odd (ap, asize, dlow) == 0;
}
- if (dn == 2)
+ if (dsize == 2)
{
mp_limb_t dsecond = dp[1];
if (dsecond <= dmask)
{
+ unsigned twos;
count_trailing_zeros (twos, dlow);
dlow = (dlow >> twos) | (dsecond << (GMP_NUMB_BITS-twos));
ASSERT_LIMB (dlow);
- return MPN_MOD_OR_MODEXACT_1_ODD (ap, an, dlow) == 0;
+ return MPN_MOD_OR_MODEXACT_1_ODD (ap, asize, dlow) == 0;
}
}
- /* Should we compute Q = A * D^(-1) mod B^k,
- R = A - Q * D mod B^k
- here, for some small values of k? Then check if R = 0 (mod B^k). */
-
- /* We could also compute A' = A mod T and D' = D mod P, for some
- P = 3 * 5 * 7 * 11 ..., and then check if any prime factor from P
- dividing D' also divides A'. */
-
TMP_MARK;
- rp = TMP_ALLOC_LIMBS (an + 1);
- qp = TMP_ALLOC_LIMBS (an - dn + 1); /* FIXME: Could we avoid this? */
-
- count_trailing_zeros (twos, dp[0]);
-
- if (twos != 0)
- {
- tp = TMP_ALLOC_LIMBS (dn);
- ASSERT_NOCARRY (mpn_rshift (tp, dp, dn, twos));
- dp = tp;
+ rp = TMP_ALLOC_LIMBS (asize+1);
+ qp = rp + dsize;
- ASSERT_NOCARRY (mpn_rshift (rp, ap, an, twos));
- }
- else
- {
- MPN_COPY (rp, ap, an);
- }
- if (rp[an - 1] >= dp[dn - 1])
- {
- rp[an] = 0;
- an++;
- }
- else if (an == dn)
- {
- TMP_FREE;
- return 0;
- }
-
- ASSERT (an > dn); /* requirement of functions below */
-
- if (BELOW_THRESHOLD (dn, DC_BDIV_QR_THRESHOLD) ||
- BELOW_THRESHOLD (an - dn, DC_BDIV_QR_THRESHOLD))
- {
- binvert_limb (di, dp[0]);
- mpn_sbpi1_bdiv_qr (qp, rp, an, dp, dn, -di);
- rp += an - dn;
- }
- else if (BELOW_THRESHOLD (dn, MU_BDIV_QR_THRESHOLD))
- {
- binvert_limb (di, dp[0]);
- mpn_dcpi1_bdiv_qr (qp, rp, an, dp, dn, -di);
- rp += an - dn;
- }
- else
- {
- tp = TMP_ALLOC_LIMBS (mpn_mu_bdiv_qr_itch (an, dn));
- mpn_mu_bdiv_qr (qp, rp, rp, an, dp, dn, tp);
- }
+ mpn_tdiv_qr (qp, rp, (mp_size_t) 0, ap, asize, dp, dsize);
- /* test for {rp,dn} zero or non-zero */
+ /* test for {rp,dsize} zero or non-zero */
i = 0;
do
{
@@ -194,7 +153,7 @@ mpn_divisible_p (mp_srcptr ap, mp_size_t an,
return 0;
}
}
- while (++i < dn);
+ while (++i < dsize);
TMP_FREE;
return 1;
diff --git a/gmp/mpn/generic/divrem.c b/gmp/mpn/generic/divrem.c
index f420992746..999ffdd347 100644
--- a/gmp/mpn/generic/divrem.c
+++ b/gmp/mpn/generic/divrem.c
@@ -1,33 +1,24 @@
/* mpn_divrem -- Divide natural numbers, producing both remainder and
- quotient. This is now just a middle layer calling mpn_tdiv_qr.
+ quotient. This is now just a middle layer for calling the new
+ internal mpn_tdiv_qr.
-Copyright 1993-1997, 1999-2002, 2005 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 1996, 1997, 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -56,7 +47,7 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn,
TMP_DECL;
TMP_MARK;
- q2p = TMP_ALLOC_LIMBS (nn + qxn);
+ q2p = (mp_ptr) TMP_ALLOC ((nn + qxn) * BYTES_PER_MP_LIMB);
np[0] = mpn_divrem_1 (q2p, qxn, np, nn, dp[0]);
qn = nn + qxn - 1;
@@ -81,11 +72,11 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn,
if (UNLIKELY (qxn != 0))
{
mp_ptr n2p;
- n2p = TMP_ALLOC_LIMBS (nn + qxn);
+ n2p = (mp_ptr) TMP_ALLOC ((nn + qxn) * BYTES_PER_MP_LIMB);
MPN_ZERO (n2p, qxn);
MPN_COPY (n2p + qxn, np, nn);
- q2p = TMP_ALLOC_LIMBS (nn - dn + qxn + 1);
- rp = TMP_ALLOC_LIMBS (dn);
+ q2p = (mp_ptr) TMP_ALLOC ((nn - dn + qxn + 1) * BYTES_PER_MP_LIMB);
+ rp = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB);
mpn_tdiv_qr (q2p, rp, 0L, n2p, nn + qxn, dp, dn);
MPN_COPY (np, rp, dn);
qn = nn - dn + qxn;
@@ -94,8 +85,8 @@ mpn_divrem (mp_ptr qp, mp_size_t qxn,
}
else
{
- q2p = TMP_ALLOC_LIMBS (nn - dn + 1);
- rp = TMP_ALLOC_LIMBS (dn);
+ q2p = (mp_ptr) TMP_ALLOC ((nn - dn + 1) * BYTES_PER_MP_LIMB);
+ rp = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB);
mpn_tdiv_qr (q2p, rp, 0L, np, nn, dp, dn);
MPN_COPY (np, rp, dn); /* overwrite np area with remainder */
qn = nn - dn;
diff --git a/gmp/mpn/generic/divrem_1.c b/gmp/mpn/generic/divrem_1.c
index 9157b5735e..c416946294 100644
--- a/gmp/mpn/generic/divrem_1.c
+++ b/gmp/mpn/generic/divrem_1.c
@@ -1,33 +1,22 @@
/* mpn_divrem_1 -- mpn by limb division.
-Copyright 1991, 1993, 1994, 1996, 1998-2000, 2002, 2003 Free Software
+Copyright 1991, 1993, 1994, 1996, 1998, 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -167,7 +156,7 @@ mpn_divrem_1 (mp_ptr qp, mp_size_t qxn,
else
{
/* Most significant bit of divisor == 0. */
- int cnt;
+ int norm;
/* Skip a division if high < divisor (high quotient 0). Testing here
before normalizing will still skip as often as possible. */
@@ -189,28 +178,28 @@ mpn_divrem_1 (mp_ptr qp, mp_size_t qxn,
&& BELOW_THRESHOLD (n, DIVREM_1_UNNORM_THRESHOLD))
goto plain;
- count_leading_zeros (cnt, d);
- d <<= cnt;
- r <<= cnt;
+ count_leading_zeros (norm, d);
+ d <<= norm;
+ r <<= norm;
if (UDIV_NEEDS_NORMALIZATION
&& BELOW_THRESHOLD (n, DIVREM_1_UNNORM_THRESHOLD))
{
- mp_limb_t nshift;
if (un != 0)
{
n1 = up[un - 1] << GMP_NAIL_BITS;
- r |= (n1 >> (GMP_LIMB_BITS - cnt));
+ r |= (n1 >> (GMP_LIMB_BITS - norm));
for (i = un - 2; i >= 0; i--)
{
n0 = up[i] << GMP_NAIL_BITS;
- nshift = (n1 << cnt) | (n0 >> (GMP_NUMB_BITS - cnt));
- udiv_qrnnd (*qp, r, r, nshift, d);
+ udiv_qrnnd (*qp, r, r,
+ (n1 << norm) | (n0 >> (GMP_NUMB_BITS - norm)),
+ d);
r >>= GMP_NAIL_BITS;
qp--;
n1 = n0;
}
- udiv_qrnnd (*qp, r, r, n1 << cnt, d);
+ udiv_qrnnd (*qp, r, r, n1 << norm, d);
r >>= GMP_NAIL_BITS;
qp--;
}
@@ -220,26 +209,27 @@ mpn_divrem_1 (mp_ptr qp, mp_size_t qxn,
r >>= GMP_NAIL_BITS;
qp--;
}
- return r >> cnt;
+ return r >> norm;
}
else
{
- mp_limb_t dinv, nshift;
+ mp_limb_t dinv;
invert_limb (dinv, d);
if (un != 0)
{
n1 = up[un - 1] << GMP_NAIL_BITS;
- r |= (n1 >> (GMP_LIMB_BITS - cnt));
+ r |= (n1 >> (GMP_LIMB_BITS - norm));
for (i = un - 2; i >= 0; i--)
{
n0 = up[i] << GMP_NAIL_BITS;
- nshift = (n1 << cnt) | (n0 >> (GMP_NUMB_BITS - cnt));
- udiv_qrnnd_preinv (*qp, r, r, nshift, d, dinv);
+ udiv_qrnnd_preinv (*qp, r, r,
+ ((n1 << norm) | (n0 >> (GMP_NUMB_BITS - norm))),
+ d, dinv);
r >>= GMP_NAIL_BITS;
qp--;
n1 = n0;
}
- udiv_qrnnd_preinv (*qp, r, r, n1 << cnt, d, dinv);
+ udiv_qrnnd_preinv (*qp, r, r, n1 << norm, d, dinv);
r >>= GMP_NAIL_BITS;
qp--;
}
@@ -249,7 +239,7 @@ mpn_divrem_1 (mp_ptr qp, mp_size_t qxn,
r >>= GMP_NAIL_BITS;
qp--;
}
- return r >> cnt;
+ return r >> norm;
}
}
}
diff --git a/gmp/mpn/generic/divrem_2.c b/gmp/mpn/generic/divrem_2.c
index 30d24bb102..ba761dc36c 100644
--- a/gmp/mpn/generic/divrem_2.c
+++ b/gmp/mpn/generic/divrem_2.c
@@ -1,119 +1,179 @@
/* 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-1996, 1999-2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-/* Divide num {np,nn} by den {dp,2} and write the nn-2 least significant
- quotient limbs at qp and the 2 long remainder at np. If qxn is non-zero,
- generate that many fraction bits and append them after the other quotient
- limbs. Return the most significant limb of the quotient, this is always 0
- or 1.
+/* The size where udiv_qrnnd_preinv should be used rather than udiv_qrnnd,
+ meaning the quotient size where that should happen, the quotient size
+ being how many udiv divisions will be done.
+
+ The default is to use preinv always, CPUs where this doesn't suit have
+ tuned thresholds. Note in particular that preinv should certainly be
+ used if that's the only division available (USE_PREINV_ALWAYS). */
+
+#ifndef DIVREM_2_THRESHOLD
+#define DIVREM_2_THRESHOLD 0
+#endif
+
+
+/* Divide num (NP/NSIZE) by den (DP/2) and write
+ the NSIZE-2 least significant quotient limbs at QP
+ and the 2 long remainder at NP. If QEXTRA_LIMBS is
+ non-zero, generate that many fraction bits and append them after the
+ other quotient limbs.
+ Return the most significant limb of the quotient, this is always 0 or 1.
Preconditions:
+ 0. NSIZE >= 2.
1. The most significant bit of the divisor must be set.
- 2. qp must either not overlap with the input operands at all, or
- qp >= np + 2 must hold true. (This means that it's possible to put
- the quotient in the high part of {np,nn}, right above the remainder.
- 3. nn >= 2, even if qxn is non-zero. */
+ 2. QP must either not overlap with the input operands at all, or
+ QP + 2 >= NP must hold true. (This means that it's
+ possible to put the quotient in the high part of NUM, right after the
+ remainder in NUM.
+ 3. NSIZE >= 2, even if QEXTRA_LIMBS is non-zero. */
mp_limb_t
mpn_divrem_2 (mp_ptr qp, mp_size_t qxn,
mp_ptr np, mp_size_t nn,
mp_srcptr dp)
{
- mp_limb_t most_significant_q_limb;
+ mp_limb_t most_significant_q_limb = 0;
mp_size_t i;
- mp_limb_t r1, r0, d1, d0;
- gmp_pi1_t di;
+ mp_limb_t n1, n0, n2;
+ mp_limb_t d1, d0;
+ mp_limb_t d1inv;
+ int use_preinv;
ASSERT (nn >= 2);
ASSERT (qxn >= 0);
ASSERT (dp[1] & GMP_NUMB_HIGHBIT);
- ASSERT (! MPN_OVERLAP_P (qp, nn-2+qxn, np, nn) || qp >= np+2);
+ ASSERT (! MPN_OVERLAP_P (qp, nn-2+qxn, np, nn) || qp+2 >= np);
ASSERT_MPN (np, nn);
ASSERT_MPN (dp, 2);
np += nn - 2;
d1 = dp[1];
d0 = dp[0];
- r1 = np[1];
- r0 = np[0];
+ n1 = np[1];
+ n0 = np[0];
- most_significant_q_limb = 0;
- if (r1 >= d1 && (r1 > d1 || r0 >= d0))
+ if (n1 >= d1 && (n1 > d1 || n0 >= d0))
{
#if GMP_NAIL_BITS == 0
- sub_ddmmss (r1, r0, r1, r0, d1, d0);
+ sub_ddmmss (n1, n0, n1, n0, d1, d0);
#else
- r0 = r0 - d0;
- r1 = r1 - d1 - (r0 >> GMP_LIMB_BITS - 1);
- r0 &= GMP_NUMB_MASK;
+ n0 = n0 - d0;
+ n1 = n1 - d1 - (n0 >> GMP_LIMB_BITS - 1);
+ n0 &= GMP_NUMB_MASK;
#endif
most_significant_q_limb = 1;
}
- invert_pi1 (di, d1, d0);
+ use_preinv = ABOVE_THRESHOLD (qxn + nn - 2, DIVREM_2_THRESHOLD);
+ if (use_preinv)
+ invert_limb (d1inv, d1);
- qp += qxn;
-
- for (i = nn - 2 - 1; i >= 0; i--)
+ for (i = qxn + nn - 2 - 1; i >= 0; i--)
{
- mp_limb_t n0, q;
- n0 = np[-1];
- udiv_qr_3by2 (q, r1, r0, r1, r0, n0, d1, d0, di.inv32);
- np--;
- qp[i] = q;
- }
+ mp_limb_t q;
+ mp_limb_t r;
- if (UNLIKELY (qxn != 0))
- {
- qp -= qxn;
- for (i = qxn - 1; i >= 0; i--)
+ if (i >= qxn)
+ np--;
+ else
+ np[0] = 0;
+
+ if (n1 == d1)
+ {
+ /* Q should be either 111..111 or 111..110. Need special handling
+ of this rare case as normal division would give overflow. */
+ q = GMP_NUMB_MASK;
+
+ r = (n0 + d1) & GMP_NUMB_MASK;
+ if (r < d1) /* Carry in the addition? */
+ {
+#if GMP_NAIL_BITS == 0
+ add_ssaaaa (n1, n0, r - d0, np[0], 0, d0);
+#else
+ n0 = np[0] + d0;
+ n1 = (r - d0 + (n0 >> GMP_NUMB_BITS)) & GMP_NUMB_MASK;
+ n0 &= GMP_NUMB_MASK;
+#endif
+ qp[i] = q;
+ continue;
+ }
+ n1 = d0 - (d0 != 0);
+ n0 = -d0 & GMP_NUMB_MASK;
+ }
+ else
{
- mp_limb_t q;
- udiv_qr_3by2 (q, r1, r0, r1, r0, CNST_LIMB(0), d1, d0, di.inv32);
- qp[i] = q;
+ if (use_preinv)
+ udiv_qrnnd_preinv (q, r, n1, n0, d1, d1inv);
+ else
+ udiv_qrnnd (q, r, n1, n0 << GMP_NAIL_BITS, d1 << GMP_NAIL_BITS);
+ r >>= GMP_NAIL_BITS;
+ umul_ppmm (n1, n0, d0, q << GMP_NAIL_BITS);
+ n0 >>= GMP_NAIL_BITS;
}
- }
- np[1] = r1;
- np[0] = r0;
+ n2 = np[0];
+
+ q_test:
+ if (n1 > r || (n1 == r && n0 > n2))
+ {
+ /* The estimated Q was too large. */
+ q--;
+
+#if GMP_NAIL_BITS == 0
+ sub_ddmmss (n1, n0, n1, n0, 0, d0);
+#else
+ n0 = n0 - d0;
+ n1 = n1 - (n0 >> GMP_LIMB_BITS - 1);
+ n0 &= GMP_NUMB_MASK;
+#endif
+ r += d1;
+ if (r >= d1) /* If not carry, test Q again. */
+ goto q_test;
+ }
+
+ qp[i] = q;
+#if GMP_NAIL_BITS == 0
+ sub_ddmmss (n1, n0, r, n2, n1, n0);
+#else
+ n0 = n2 - n0;
+ n1 = r - n1 - (n0 >> GMP_LIMB_BITS - 1);
+ n0 &= GMP_NUMB_MASK;
+#endif
+ }
+ np[1] = n1;
+ np[0] = n0;
return most_significant_q_limb;
}
diff --git a/gmp/mpn/generic/dump.c b/gmp/mpn/generic/dump.c
index 3a73fe49e3..38309996cc 100644
--- a/gmp/mpn/generic/dump.c
+++ b/gmp/mpn/generic/dump.c
@@ -3,33 +3,22 @@
FUNCTION WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1996, 2000-2002, 2005 Free Software Foundation, Inc.
+Copyright 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
diff --git a/gmp/mpn/generic/fib2_ui.c b/gmp/mpn/generic/fib2_ui.c
index eb6e56e736..a39d538262 100644
--- a/gmp/mpn/generic/fib2_ui.c
+++ b/gmp/mpn/generic/fib2_ui.c
@@ -4,37 +4,28 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002, 2005, 2009 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
#include "gmp-impl.h"
+#include "longlong.h"
+
/* change this to "#define TRACE(x) x" for diagnostics */
#define TRACE(x)
@@ -61,13 +52,20 @@ see https://www.gnu.org/licenses/. */
This property of F[4m+3] can be verified by induction on F[4m+3] =
7*F[4m-1] - F[4m-5], that formula being a standard lucas sequence
identity U[i+j] = U[i]*V[j] - U[i-j]*Q^j.
-*/
+
+ Enhancements:
+
+ If there was an mpn_addlshift, it'd be possible to eliminate the yp
+ temporary, using xp=F[k]^2, fp=F[k-1]^2, f1p=xp+fp, fp+=4*fp, fp-=f1p,
+ fp+=2*(-1)^n, etc. */
mp_size_t
mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n)
{
+ mp_ptr xp, yp;
mp_size_t size;
unsigned long nfirst, mask;
+ TMP_DECL;
TRACE (printf ("mpn_fib2_ui n=%lu\n", n));
@@ -87,15 +85,15 @@ mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n)
if (mask != 1)
{
mp_size_t alloc;
- mp_ptr xp;
- TMP_DECL;
TMP_MARK;
alloc = MPN_FIB2_SIZE (n);
- xp = TMP_ALLOC_LIMBS (alloc);
+ TMP_ALLOC_LIMBS_2 (xp,alloc, yp,alloc);
do
{
+ mp_limb_t c;
+
/* Here fp==F[k] and f1p==F[k-1], with k being the bits of n from
n&mask upwards.
@@ -116,65 +114,45 @@ mpn_fib2_ui (mp_ptr fp, mp_ptr f1p, unsigned long int n)
/* f1p[size-1] might be zero, but this occurs rarely, so it's not
worth bothering checking for it */
ASSERT (alloc >= 2*size);
- mpn_sqr (xp, fp, size);
- mpn_sqr (fp, f1p, size);
+ mpn_sqr_n (xp, fp, size);
+ mpn_sqr_n (yp, f1p, size);
size *= 2;
/* Shrink if possible. Since fp was normalized there'll be at
most one high zero on xp (and if there is then there's one on
yp too). */
- ASSERT (xp[size-1] != 0 || fp[size-1] == 0);
+ ASSERT (xp[size-1] != 0 || yp[size-1] == 0);
size -= (xp[size-1] == 0);
ASSERT (xp[size-1] != 0); /* only one xp high zero */
- /* Calculate F[2k-1] = F[k]^2 + F[k-1]^2. */
- f1p[size] = mpn_add_n (f1p, xp, fp, size);
-
/* Calculate F[2k+1] = 4*F[k]^2 - F[k-1]^2 + 2*(-1)^k.
n&mask is the low bit of our implied k. */
-#if HAVE_NATIVE_mpn_rsblsh2_n || HAVE_NATIVE_mpn_rsblsh_n
-#if HAVE_NATIVE_mpn_rsblsh2_n
- fp[size] = mpn_rsblsh2_n (fp, fp, xp, size);
-#else /* HAVE_NATIVE_mpn_rsblsh_n */
- fp[size] = mpn_rsblsh_n (fp, fp, xp, size, 2);
-#endif
- if ((n & mask) == 0)
- MPN_INCR_U(fp, size + 1, 2); /* possible +2 */
- else
- {
- ASSERT (fp[0] >= 2);
- fp[0] -= 2; /* possible -2 */
- }
-#else
- {
- mp_limb_t c;
-
- c = mpn_lshift (xp, xp, size, 2);
- xp[0] |= (n & mask ? 0 : 2); /* possible +2 */
- c -= mpn_sub_n (fp, xp, fp, size);
- ASSERT (n & mask ? fp[0] != 0 && fp[0] != 1 : 1);
- fp[0] -= (n & mask ? 2 : 0); /* possible -2 */
- fp[size] = c;
- }
-#endif
+ c = mpn_lshift (fp, xp, size, 2);
+ fp[0] |= (n & mask ? 0 : 2); /* possible +2 */
+ c -= mpn_sub_n (fp, fp, yp, size);
+ ASSERT (n & (mask << 1) ? fp[0] != 0 && fp[0] != 1 : 1);
+ fp[0] -= (n & mask ? 2 : 0); /* possible -2 */
ASSERT (alloc >= size+1);
- size += (fp[size] != 0);
+ xp[size] = 0;
+ yp[size] = 0;
+ fp[size] = c;
+ size += (c != 0);
+
+ /* Calculate F[2k-1] = F[k]^2 + F[k-1]^2.
+ F[2k-1]<F[2k+1] so no carry out of "size" limbs. */
+ ASSERT_NOCARRY (mpn_add_n (f1p, xp, yp, size));
/* now n&mask is the new bit of n being considered */
mask >>= 1;
/* Calculate F[2k] = F[2k+1] - F[2k-1], replacing the unwanted one of
F[2k+1] and F[2k-1]. */
- if (n & mask)
- ASSERT_NOCARRY (mpn_sub_n (f1p, fp, f1p, size));
- else {
- ASSERT_NOCARRY (mpn_sub_n ( fp, fp, f1p, size));
-
- /* Can have a high zero after replacing F[2k+1] with F[2k].
- f1p will have a high zero if fp does. */
- ASSERT (fp[size-1] != 0 || f1p[size-1] == 0);
- size -= (fp[size-1] == 0);
- }
+ ASSERT_NOCARRY (mpn_sub_n ((n & mask ? f1p : fp), fp, f1p, size));
+
+ /* Can have a high zero after replacing F[2k+1] with F[2k].
+ f1p will have a high zero if fp does. */
+ ASSERT (fp[size-1] != 0 || f1p[size-1] == 0);
+ size -= (fp[size-1] == 0);
}
while (mask != 1);
diff --git a/gmp/mpn/generic/gcd.c b/gmp/mpn/generic/gcd.c
index b14e1ad888..542e0fe7b8 100644
--- a/gmp/mpn/generic/gcd.c
+++ b/gmp/mpn/generic/gcd.c
@@ -1,33 +1,22 @@
/* mpn/gcd.c: mpn_gcd for gcd of two odd integers.
-Copyright 1991, 1993-1998, 2000-2005, 2008, 2010, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2003,
+2004, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,7 +24,7 @@ see https://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
@@ -62,76 +51,6 @@ mp_size_t p_table[P_TABLE_SIZE];
#define CHOOSE_P(n) (2*(n) / 3)
#endif
-struct gcd_ctx
-{
- mp_ptr gp;
- mp_size_t gn;
-};
-
-static void
-gcd_hook (void *p, mp_srcptr gp, mp_size_t gn,
- mp_srcptr qp, mp_size_t qn, int d)
-{
- struct gcd_ctx *ctx = (struct gcd_ctx *) p;
- MPN_COPY (ctx->gp, gp, gn);
- ctx->gn = gn;
-}
-
-#if GMP_NAIL_BITS > 0
-/* Nail supports should be easy, replacing the sub_ddmmss with nails
- * logic. */
-#error Nails not supported.
-#endif
-
-/* Use binary algorithm to compute G <-- GCD (U, V) for usize, vsize == 2.
- Both U and V must be odd. */
-static inline mp_size_t
-gcd_2 (mp_ptr gp, mp_srcptr up, mp_srcptr vp)
-{
- mp_limb_t u0, u1, v0, v1;
- mp_size_t gn;
-
- u0 = up[0];
- u1 = up[1];
- v0 = vp[0];
- v1 = vp[1];
-
- ASSERT (u0 & 1);
- ASSERT (v0 & 1);
-
- /* Check for u0 != v0 needed to ensure that argument to
- * count_trailing_zeros is non-zero. */
- while (u1 != v1 && u0 != v0)
- {
- unsigned long int r;
- if (u1 > v1)
- {
- sub_ddmmss (u1, u0, u1, u0, v1, v0);
- count_trailing_zeros (r, u0);
- u0 = ((u1 << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (u0 >> r);
- u1 >>= r;
- }
- else /* u1 < v1. */
- {
- sub_ddmmss (v1, v0, v1, v0, u1, u0);
- count_trailing_zeros (r, v0);
- v0 = ((v1 << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (v0 >> r);
- v1 >>= r;
- }
- }
-
- gp[0] = u0, gp[1] = u1, gn = 1 + (u1 != 0);
-
- /* If U == V == GCD, done. Otherwise, compute GCD (V, |U - V|). */
- if (u1 == v1 && u0 == v0)
- return gn;
-
- v0 = (u0 == v0) ? ((u1 > v1) ? u1-v1 : v1-u1) : ((u0 > v0) ? u0-v0 : v0-u0);
- gp[0] = mpn_gcd_1 (gp, gn, v0);
-
- return 1;
-}
-
mp_size_t
mpn_gcd (mp_ptr gp, mp_ptr up, mp_size_t usize, mp_ptr vp, mp_size_t n)
{
@@ -139,17 +58,13 @@ mpn_gcd (mp_ptr gp, mp_ptr up, mp_size_t usize, mp_ptr vp, mp_size_t n)
mp_size_t scratch;
mp_size_t matrix_scratch;
- struct gcd_ctx ctx;
+ mp_size_t gn;
mp_ptr tp;
TMP_DECL;
- ASSERT (usize >= n);
- ASSERT (n > 0);
- ASSERT (vp[n-1] > 0);
-
/* FIXME: Check for small sizes first, before setting up temporary
storage etc. */
- talloc = MPN_GCD_SUBDIV_STEP_ITCH(n);
+ talloc = MPN_GCD_LEHMER_N_ITCH(n);
/* For initial division */
scratch = usize - n + 1;
@@ -192,13 +107,11 @@ mpn_gcd (mp_ptr gp, mp_ptr up, mp_size_t usize, mp_ptr vp, mp_size_t n)
if (mpn_zero_p (up, n))
{
MPN_COPY (gp, vp, n);
- ctx.gn = n;
- goto done;
+ TMP_FREE;
+ return n;
}
}
- ctx.gp = gp;
-
#if TUNE_GCD_P
while (CHOOSE_P (n) > 0)
#else
@@ -221,90 +134,153 @@ mpn_gcd (mp_ptr gp, mp_ptr up, mp_size_t usize, mp_ptr vp, mp_size_t n)
else
{
/* Temporary storage n */
- n = mpn_gcd_subdiv_step (up, vp, n, 0, gcd_hook, &ctx, tp);
+ n = mpn_gcd_subdiv_step (gp, &gn, up, vp, n, tp);
if (n == 0)
- goto done;
+ {
+ TMP_FREE;
+ return gn;
+ }
}
}
- while (n > 2)
- {
- struct hgcd_matrix1 M;
- mp_limb_t uh, ul, vh, vl;
- mp_limb_t mask;
+ gn = mpn_gcd_lehmer_n (gp, up, vp, n, tp);
+ TMP_FREE;
+ return gn;
+}
- mask = up[n-1] | vp[n-1];
- ASSERT (mask > 0);
+#ifdef TUNE_GCD_P
+#include <stdio.h>
+#include <string.h>
+#include <time.h>
+#include "speed.h"
- if (mask & GMP_NUMB_HIGHBIT)
- {
- uh = up[n-1]; ul = up[n-2];
- vh = vp[n-1]; vl = vp[n-2];
- }
- else
- {
- int shift;
+static int
+compare_double(const void *ap, const void *bp)
+{
+ double a = * (const double *) ap;
+ double b = * (const double *) bp;
+
+ if (a < b)
+ return -1;
+ else if (a > b)
+ return 1;
+ else
+ return 0;
+}
- count_leading_zeros (shift, mask);
- uh = MPN_EXTRACT_NUMB (shift, up[n-1], up[n-2]);
- ul = MPN_EXTRACT_NUMB (shift, up[n-2], up[n-3]);
- vh = MPN_EXTRACT_NUMB (shift, vp[n-1], vp[n-2]);
- vl = MPN_EXTRACT_NUMB (shift, vp[n-2], vp[n-3]);
- }
+static double
+median (double *v, size_t n)
+{
+ qsort(v, n, sizeof(*v), compare_double);
- /* Try an mpn_hgcd2 step */
- if (mpn_hgcd2 (uh, ul, vh, vl, &M))
- {
- n = mpn_matrix22_mul1_inverse_vector (&M, tp, up, vp, n);
- MP_PTR_SWAP (up, tp);
- }
- else
- {
- /* mpn_hgcd2 has failed. Then either one of a or b is very
- small, or the difference is very small. Perform one
- subtraction followed by one division. */
+ return v[n/2];
+}
- /* Temporary storage n */
- n = mpn_gcd_subdiv_step (up, vp, n, 0, &gcd_hook, &ctx, tp);
- if (n == 0)
- goto done;
- }
- }
+#define TIME(res, code) do { \
+ double time_measurement[5]; \
+ unsigned time_i; \
+ \
+ for (time_i = 0; time_i < 5; time_i++) \
+ { \
+ speed_starttime(); \
+ code; \
+ time_measurement[time_i] = speed_endtime(); \
+ } \
+ res = median(time_measurement, 5); \
+} while (0)
+
+int
+main(int argc, char *argv)
+{
+ gmp_randstate_t rands;
+ mp_size_t n;
+ mp_ptr ap;
+ mp_ptr bp;
+ mp_ptr up;
+ mp_ptr vp;
+ mp_ptr gp;
+ mp_ptr tp;
+ TMP_DECL;
- ASSERT(up[n-1] | vp[n-1]);
+ /* Unbuffered so if output is redirected to a file it isn't lost if the
+ program is killed part way through. */
+ setbuf (stdout, NULL);
+ setbuf (stderr, NULL);
- if (n == 1)
- {
- *gp = mpn_gcd_1(up, 1, vp[0]);
- ctx.gn = 1;
- goto done;
- }
+ gmp_randinit_default (rands);
- /* Due to the calling convention for mpn_gcd, at most one can be
- even. */
+ TMP_MARK;
- if (! (up[0] & 1))
- MP_PTR_SWAP (up, vp);
+ ap = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
+ bp = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
+ up = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
+ vp = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
+ gp = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
+ tp = TMP_ALLOC_LIMBS (MPN_GCD_LEHMER_N_ITCH (P_TABLE_SIZE));
- ASSERT (up[0] & 1);
+ mpn_random (ap, P_TABLE_SIZE);
+ mpn_random (bp, P_TABLE_SIZE);
- if (vp[0] == 0)
- {
- *gp = mpn_gcd_1 (up, 2, vp[1]);
- ctx.gn = 1;
- goto done;
- }
- else if (! (vp[0] & 1))
+ memset (p_table, 0, sizeof(p_table));
+
+ for (n = 100; n++; n < P_TABLE_SIZE)
{
- int r;
- count_trailing_zeros (r, vp[0]);
- vp[0] = ((vp[1] << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (vp[0] >> r);
- vp[1] >>= r;
- }
+ mp_size_t p;
+ mp_size_t best_p;
+ double best_time;
+ double lehmer_time;
+
+ if (ap[n-1] == 0)
+ ap[n-1] = 1;
+
+ if (bp[n-1] == 0)
+ bp[n-1] = 1;
+
+ p_table[n] = 0;
+ TIME(lehmer_time, {
+ MPN_COPY (up, ap, n);
+ MPN_COPY (vp, bp, n);
+ mpn_gcd_lehmer_n (gp, up, vp, n, tp);
+ });
- ctx.gn = gcd_2(gp, up, vp);
+ best_time = lehmer_time;
+ best_p = 0;
-done:
+ for (p = n * 0.48; p < n * 0.77; p++)
+ {
+ double t;
+
+ p_table[n] = p;
+
+ TIME(t, {
+ MPN_COPY (up, ap, n);
+ MPN_COPY (vp, bp, n);
+ mpn_gcd (gp, up, n, vp, n);
+ });
+
+ if (t < best_time)
+ {
+ best_time = t;
+ best_p = p;
+ }
+ }
+ printf("%6d %6d %5.3g", n, best_p, (double) best_p / n);
+ if (best_p > 0)
+ {
+ double speedup = 100 * (lehmer_time - best_time) / lehmer_time;
+ printf(" %5.3g%%", speedup);
+ if (speedup < 1.0)
+ {
+ printf(" (ignored)");
+ best_p = 0;
+ }
+ }
+ printf("\n");
+
+ p_table[n] = best_p;
+ }
TMP_FREE;
- return ctx.gn;
+ gmp_randclear(rands);
+ return 0;
}
+#endif /* TUNE_GCD_P */
diff --git a/gmp/mpn/generic/gcd_1.c b/gmp/mpn/generic/gcd_1.c
index f6dcb4a2eb..73be15134c 100644
--- a/gmp/mpn/generic/gcd_1.c
+++ b/gmp/mpn/generic/gcd_1.c
@@ -1,54 +1,26 @@
/* mpn_gcd_1 -- mpn and limb greatest common divisor.
-Copyright 1994, 1996, 2000, 2001, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1994, 1996, 2000, 2001 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-#ifndef GCD_1_METHOD
-#define GCD_1_METHOD 2
-#endif
-
-#define USE_ZEROTAB 0
-
-#if USE_ZEROTAB
-#define MAXSHIFT 4
-#define MASK ((1 << MAXSHIFT) - 1)
-static const unsigned char zerotab[1 << MAXSHIFT] =
-{
-#if MAXSHIFT > 4
- 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
-#endif
- 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
-};
-#endif
/* Does not work for U == 0 or V == 0. It would be tough to make it work for
V == 0 since gcd(x,0) = x, and U does not generally fit in an mp_limb_t.
@@ -109,10 +81,6 @@ mpn_gcd_1 (mp_srcptr up, mp_size_t size, mp_limb_t vlimb)
goto strip_u_maybe;
}
- ASSERT (ulimb & 1);
- ASSERT (vlimb & 1);
-
-#if GCD_1_METHOD == 1
while (ulimb != vlimb)
{
ASSERT (ulimb & 1);
@@ -141,58 +109,6 @@ mpn_gcd_1 (mp_srcptr up, mp_size_t size, mp_limb_t vlimb)
while ((vlimb & 1) == 0);
}
}
-#else
-# if GCD_1_METHOD == 2
-
- ulimb >>= 1;
- vlimb >>= 1;
-
- while (ulimb != vlimb)
- {
- int c;
- mp_limb_t t;
- mp_limb_t vgtu;
-
- t = ulimb - vlimb;
- vgtu = LIMB_HIGHBIT_TO_MASK (t);
-
- /* v <-- min (u, v) */
- vlimb += (vgtu & t);
-
- /* u <-- |u - v| */
- ulimb = (t ^ vgtu) - vgtu;
-
-#if USE_ZEROTAB
- /* Number of trailing zeros is the same no matter if we look at
- * t or ulimb, but using t gives more parallelism. */
- c = zerotab[t & MASK];
-
- while (UNLIKELY (c == MAXSHIFT))
- {
- ulimb >>= MAXSHIFT;
- if (0)
- strip_u_maybe:
- vlimb >>= 1;
-
- c = zerotab[ulimb & MASK];
- }
-#else
- if (0)
- {
- strip_u_maybe:
- vlimb >>= 1;
- t = ulimb;
- }
- count_trailing_zeros (c, t);
-#endif
- ulimb >>= (c + 1);
- }
-
- vlimb = (vlimb << 1) | 1;
-# else
-# error Unknown GCD_1_METHOD
-# endif
-#endif
done:
return vlimb << zero_bits;
diff --git a/gmp/mpn/generic/gcd_lehmer.c b/gmp/mpn/generic/gcd_lehmer.c
new file mode 100644
index 0000000000..37fd3c590d
--- /dev/null
+++ b/gmp/mpn/generic/gcd_lehmer.c
@@ -0,0 +1,160 @@
+/* gcd_lehmer.c.
+
+ 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 Free Software Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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"
+
+/* Use binary algorithm to compute G <-- GCD (U, V) for usize, vsize == 2.
+ Both U and V must be odd. */
+static inline mp_size_t
+gcd_2 (mp_ptr gp, mp_srcptr up, mp_srcptr vp)
+{
+ mp_limb_t u0, u1, v0, v1;
+ mp_size_t gn;
+
+ u0 = up[0];
+ u1 = up[1];
+ v0 = vp[0];
+ v1 = vp[1];
+
+ ASSERT (u0 & 1);
+ ASSERT (v0 & 1);
+
+ /* Check for u0 != v0 needed to ensure that argument to
+ * count_trailing_zeros is non-zero. */
+ while (u1 != v1 && u0 != v0)
+ {
+ unsigned long int r;
+ if (u1 > v1)
+ {
+ u1 -= v1 + (u0 < v0);
+ u0 = (u0 - v0) & GMP_NUMB_MASK;
+ count_trailing_zeros (r, u0);
+ u0 = ((u1 << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (u0 >> r);
+ u1 >>= r;
+ }
+ else /* u1 < v1. */
+ {
+ v1 -= u1 + (v0 < u0);
+ v0 = (v0 - u0) & GMP_NUMB_MASK;
+ count_trailing_zeros (r, v0);
+ v0 = ((v1 << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (v0 >> r);
+ v1 >>= r;
+ }
+ }
+
+ gp[0] = u0, gp[1] = u1, gn = 1 + (u1 != 0);
+
+ /* If U == V == GCD, done. Otherwise, compute GCD (V, |U - V|). */
+ if (u1 == v1 && u0 == v0)
+ return gn;
+
+ v0 = (u0 == v0) ? ((u1 > v1) ? u1-v1 : v1-u1) : ((u0 > v0) ? u0-v0 : v0-u0);
+ gp[0] = mpn_gcd_1 (gp, gn, v0);
+
+ return 1;
+}
+
+/* Temporary storage: n */
+mp_size_t
+mpn_gcd_lehmer_n (mp_ptr gp, mp_ptr ap, mp_ptr bp, mp_size_t n, mp_ptr tp)
+{
+ /* Relax this requirement, and normalize at the start? Must disallow
+ A = B = 0, though. */
+ ASSERT(ap[n-1] > 0 || bp[n-1] > 0);
+
+ while (n > 2)
+ {
+ struct hgcd_matrix1 M;
+ mp_limb_t ah, al, bh, bl;
+ mp_limb_t mask;
+
+ mask = ap[n-1] | bp[n-1];
+ ASSERT (mask > 0);
+
+ if (mask & GMP_NUMB_HIGHBIT)
+ {
+ ah = ap[n-1]; al = ap[n-2];
+ bh = bp[n-1]; bl = bp[n-2];
+ }
+ else
+ {
+ int shift;
+
+ count_leading_zeros (shift, mask);
+ ah = MPN_EXTRACT_NUMB (shift, ap[n-1], ap[n-2]);
+ al = MPN_EXTRACT_NUMB (shift, ap[n-2], ap[n-3]);
+ bh = MPN_EXTRACT_NUMB (shift, bp[n-1], bp[n-2]);
+ bl = MPN_EXTRACT_NUMB (shift, bp[n-2], bp[n-3]);
+ }
+
+ /* Try an mpn_nhgcd2 step */
+ if (mpn_hgcd2 (ah, al, bh, bl, &M))
+ {
+ n = mpn_hgcd_mul_matrix1_inverse_vector (&M, tp, ap, bp, n);
+ MP_PTR_SWAP (ap, tp);
+ }
+ else
+ {
+ /* mpn_hgcd2 has failed. Then either one of a or b is very
+ small, or the difference is very small. Perform one
+ subtraction followed by one division. */
+ mp_size_t gn;
+
+ /* Temporary storage n */
+ n = mpn_gcd_subdiv_step (gp, &gn, ap, bp, n, tp);
+ if (n == 0)
+ return gn;
+ }
+ }
+
+ if (n == 1)
+ {
+ *gp = mpn_gcd_1(ap, 1, bp[0]);
+ return 1;
+ }
+
+ /* Due to the calling convention for mpn_gcd, at most one can be
+ even. */
+
+ if (! (ap[0] & 1))
+ MP_PTR_SWAP (ap, bp);
+
+ ASSERT (ap[0] & 1);
+
+ if (bp[0] == 0)
+ {
+ *gp = mpn_gcd_1 (ap, 2, bp[1]);
+ return 1;
+ }
+ else if (! (bp[0] & 1))
+ {
+ int r;
+ count_trailing_zeros (r, bp[0]);
+ bp[0] = ((bp[1] << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK) | (bp[0] >> r);
+ bp[1] >>= r;
+ }
+
+ return gcd_2(gp, ap, bp);
+}
diff --git a/gmp/mpn/generic/gcd_subdiv_step.c b/gmp/mpn/generic/gcd_subdiv_step.c
index 18634bec9f..47c0c26c86 100644
--- a/gmp/mpn/generic/gcd_subdiv_step.c
+++ b/gmp/mpn/generic/gcd_subdiv_step.c
@@ -4,35 +4,22 @@
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-2005, 2008, 2010, 2011 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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/. */
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
-#include <stdlib.h> /* for NULL */
+You should have 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"
@@ -40,47 +27,17 @@ see https://www.gnu.org/licenses/. */
/* Used when mpn_hgcd or mpn_hgcd2 has failed. Then either one of a or
b is small, or the difference is small. Perform one subtraction
- followed by one division. The normal case is to compute the reduced
- a and b, and return the new size.
-
- If s == 0 (used for gcd and gcdext), returns zero if the gcd is
- found.
-
- If s > 0, don't reduce to size <= s, and return zero if no
- reduction is possible (if either a, b or |a-b| is of size <= s). */
-
-/* The hook function is called as
-
- hook(ctx, gp, gn, qp, qn, d)
-
- in the following cases:
-
- + If A = B at the start, G is the gcd, Q is NULL, d = -1.
-
- + If one input is zero at the start, G is the gcd, Q is NULL,
- d = 0 if A = G and d = 1 if B = G.
-
- Otherwise, if d = 0 we have just subtracted a multiple of A from B,
- and if d = 1 we have subtracted a multiple of B from A.
-
- + If A = B after subtraction, G is the gcd, Q is NULL.
-
- + If we get a zero remainder after division, G is the gcd, Q is the
- quotient.
-
- + Otherwise, G is NULL, Q is the quotient (often 1).
-
- */
+ followed by one division. If the gcd is found, stores it in gp and
+ *gn, and returns zero. Otherwise, compute the reduced a and b, and
+ return the new size. */
+/* FIXME: Check when the smaller number is a single limb, and invoke
+ * mpn_gcd_1. */
mp_size_t
-mpn_gcd_subdiv_step (mp_ptr ap, mp_ptr bp, mp_size_t n, mp_size_t s,
- gcd_subdiv_step_hook *hook, void *ctx,
- mp_ptr tp)
+mpn_gcd_subdiv_step (mp_ptr gp, mp_size_t *gn,
+ mp_ptr ap, mp_ptr bp, mp_size_t n, mp_ptr tp)
{
- static const mp_limb_t one = CNST_LIMB(1);
- mp_size_t an, bn, qn;
-
- int swapped;
+ mp_size_t an, bn;
ASSERT (n > 0);
ASSERT (ap[n-1] > 0 || bp[n-1] > 0);
@@ -89,117 +46,59 @@ mpn_gcd_subdiv_step (mp_ptr ap, mp_ptr bp, mp_size_t n, mp_size_t s,
MPN_NORMALIZE (ap, an);
MPN_NORMALIZE (bp, bn);
- swapped = 0;
-
- /* Arrange so that a < b, subtract b -= a, and maintain
- normalization. */
- if (an == bn)
+ if (UNLIKELY (an == 0))
{
- int c;
- MPN_CMP (c, ap, bp, an);
- if (UNLIKELY (c == 0))
- {
- /* For gcdext, return the smallest of the two cofactors, so
- pass d = -1. */
- if (s == 0)
- hook (ctx, ap, an, NULL, 0, -1);
- return 0;
- }
- else if (c > 0)
- {
- MP_PTR_SWAP (ap, bp);
- swapped ^= 1;
- }
- }
- else
- {
- if (an > bn)
- {
- MPN_PTR_SWAP (ap, an, bp, bn);
- swapped ^= 1;
- }
- }
- if (an <= s)
- {
- if (s == 0)
- hook (ctx, bp, bn, NULL, 0, swapped ^ 1);
+ return_b:
+ MPN_COPY (gp, bp, bn);
+ *gn = bn;
return 0;
}
-
- ASSERT_NOCARRY (mpn_sub (bp, bp, bn, ap, an));
- MPN_NORMALIZE (bp, bn);
- ASSERT (bn > 0);
-
- if (bn <= s)
+ else if (UNLIKELY (bn == 0))
{
- /* Undo subtraction. */
- mp_limb_t cy = mpn_add (bp, ap, an, bp, bn);
- if (cy > 0)
- bp[an] = cy;
+ return_a:
+ MPN_COPY (gp, ap, an);
+ *gn = an;
return 0;
}
- /* Arrange so that a < b */
- if (an == bn)
+ /* Arrange so that a > b, subtract an -= bn, and maintain
+ normalization. */
+ if (an < bn)
+ MPN_PTR_SWAP (ap, an, bp, bn);
+ else if (an == bn)
{
int c;
MPN_CMP (c, ap, bp, an);
if (UNLIKELY (c == 0))
- {
- if (s > 0)
- /* Just record subtraction and return */
- hook (ctx, NULL, 0, &one, 1, swapped);
- else
- /* Found gcd. */
- hook (ctx, bp, bn, NULL, 0, swapped);
- return 0;
- }
-
- hook (ctx, NULL, 0, &one, 1, swapped);
-
- if (c > 0)
- {
- MP_PTR_SWAP (ap, bp);
- swapped ^= 1;
- }
+ goto return_a;
+ else if (c < 0)
+ MP_PTR_SWAP (ap, bp);
}
- else
- {
- hook (ctx, NULL, 0, &one, 1, swapped);
- if (an > bn)
- {
- MPN_PTR_SWAP (ap, an, bp, bn);
- swapped ^= 1;
- }
+ ASSERT_NOCARRY (mpn_sub (ap, ap, an, bp, bn));
+ MPN_NORMALIZE (ap, an);
+ ASSERT (an > 0);
+
+ /* Arrange so that a > b, and divide a = q b + r */
+ /* FIXME: an < bn happens when we have cancellation. If that is the
+ common case, then we could reverse the roles of a and b to avoid
+ the swap. */
+ if (an < bn)
+ MPN_PTR_SWAP (ap, an, bp, bn);
+ else if (an == bn)
+ {
+ int c;
+ MPN_CMP (c, ap, bp, an);
+ if (UNLIKELY (c == 0))
+ goto return_a;
+ else if (c < 0)
+ MP_PTR_SWAP (ap, bp);
}
- mpn_tdiv_qr (tp, bp, 0, bp, bn, ap, an);
- qn = bn - an + 1;
- bn = an;
- MPN_NORMALIZE (bp, bn);
+ mpn_tdiv_qr (tp, ap, 0, ap, an, bp, bn);
- if (UNLIKELY (bn <= s))
- {
- if (s == 0)
- {
- hook (ctx, ap, an, tp, qn, swapped);
- return 0;
- }
-
- /* Quotient is one too large, so decrement it and add back A. */
- if (bn > 0)
- {
- mp_limb_t cy = mpn_add (bp, ap, an, bp, bn);
- if (cy)
- bp[an++] = cy;
- }
- else
- MPN_COPY (bp, ap, an);
-
- MPN_DECR_U (tp, qn, 1);
- }
+ if (mpn_zero_p (ap, bn))
+ goto return_b;
- hook (ctx, NULL, 0, tp, qn, swapped);
- return an;
+ return bn;
}
diff --git a/gmp/mpn/generic/gcdext.c b/gmp/mpn/generic/gcdext.c
index 1c4ff75aab..38487ae66d 100644
--- a/gmp/mpn/generic/gcdext.c
+++ b/gmp/mpn/generic/gcdext.c
@@ -1,33 +1,22 @@
/* mpn_gcdext -- Extended Greatest Common Divisor.
-Copyright 1996, 1998, 2000-2005, 2008, 2009, 2012 Free Software Foundation,
-Inc.
+Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -96,10 +85,10 @@ hgcd_mul_matrix_vector (struct hgcd_matrix *M,
return n;
}
-#define COMPUTE_V_ITCH(n) (2*(n))
+#define COMPUTE_V_ITCH(n) (2*(n) + 1)
/* Computes |v| = |(g - u a)| / b, where u may be positive or
- negative, and v is of the opposite sign. max(a, b) is of size n, u and
+ negative, and v is of the opposite sign. a, b are of size n, u and
v at most size n, and v must have space for n+1 limbs. */
static mp_size_t
compute_v (mp_ptr vp,
@@ -119,11 +108,9 @@ compute_v (mp_ptr vp,
size = ABS (usize);
ASSERT (size <= n);
- ASSERT (up[size-1] > 0);
an = n;
MPN_NORMALIZE (ap, an);
- ASSERT (gn <= an);
if (an >= size)
mpn_mul (tp, ap, an, up, size);
@@ -132,6 +119,8 @@ compute_v (mp_ptr vp,
size += an;
+ ASSERT (gn <= size);
+
if (usize > 0)
{
/* |v| = -v = (u a - g) / b */
@@ -142,11 +131,11 @@ compute_v (mp_ptr vp,
return 0;
}
else
- { /* |v| = v = (g - u a) / b = (g + |u| a) / b. Since g <= a,
- (g + |u| a) always fits in (|usize| + an) limbs. */
-
- ASSERT_NOCARRY (mpn_add (tp, tp, size, gp, gn));
- size -= (tp[size - 1] == 0);
+ { /* usize < 0 */
+ /* |v| = v = (c - u a) / b = (c + |u| a) / b */
+ mp_limb_t cy = mpn_add (tp, tp, size, gp, gn);
+ if (cy)
+ tp[size++] = cy;
}
/* Now divide t / b. There must be no remainder */
@@ -157,9 +146,21 @@ compute_v (mp_ptr vp,
vn = size + 1 - bn;
ASSERT (vn <= n + 1);
- mpn_divexact (vp, tp, size, bp, bn);
+ /* FIXME: Use divexact. Or do the entire calculation mod 2^{n *
+ GMP_NUMB_BITS}. */
+ mpn_tdiv_qr (vp, tp, 0, tp, size, bp, bn);
vn -= (vp[vn-1] == 0);
+ /* Remainder must be zero */
+#if WANT_ASSERT
+ {
+ mp_size_t i;
+ for (i = 0; i < bn; i++)
+ {
+ ASSERT (tp[i] == 0);
+ }
+ }
+#endif
return vn;
}
@@ -180,8 +181,7 @@ compute_v (mp_ptr vp,
For the lehmer call after the loop, Let T denote
GCDEXT_DC_THRESHOLD. For the gcdext_lehmer call, we need T each for
u, a and b, and 4T+3 scratch space. Next, for compute_v, we need T
- for u, T+1 for v and 2T scratch space. In all, 7T + 3 is
- sufficient for both operations.
+ + 1 for v and 2T + 1 scratch space. In all, 7T + 3 is sufficient.
*/
@@ -204,7 +204,6 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
mp_size_t matrix_scratch;
mp_size_t ualloc = n + 1;
- struct gcdext_ctx ctx;
mp_size_t un;
mp_ptr u0;
mp_ptr u1;
@@ -215,7 +214,6 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
ASSERT (an >= n);
ASSERT (n > 0);
- ASSERT (bp[n-1] > 0);
TMP_MARK;
@@ -284,10 +282,6 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
u0 = tp; tp += ualloc;
u1 = tp; tp += ualloc;
- ctx.gp = gp;
- ctx.up = up;
- ctx.usize = usizep;
-
{
/* For the first hgcd call, there are no u updates, and it makes
some sense to use a different choice for p. */
@@ -321,22 +315,21 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
/* mpn_hgcd has failed. Then either one of a or b is very
small, or the difference is very small. Perform one
subtraction followed by one division. */
- u1[0] = 1;
+ mp_size_t gn;
+ mp_size_t updated_un = 1;
- ctx.u0 = u0;
- ctx.u1 = u1;
- ctx.tp = tp + n; /* ualloc */
- ctx.un = 1;
+ u1[0] = 1;
- /* Temporary storage n */
- n = mpn_gcd_subdiv_step (ap, bp, n, 0, mpn_gcdext_hook, &ctx, tp);
+ /* Temporary storage 2n + 1 */
+ n = mpn_gcdext_subdiv_step (gp, &gn, up, usizep, ap, bp, n,
+ u0, u1, &updated_un, tp, tp + n);
if (n == 0)
{
TMP_FREE;
- return ctx.gn;
+ return gn;
}
- un = ctx.un;
+ un = updated_un;
ASSERT (un < ualloc);
}
}
@@ -378,45 +371,22 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
/* mpn_hgcd has failed. Then either one of a or b is very
small, or the difference is very small. Perform one
subtraction followed by one division. */
- ctx.u0 = u0;
- ctx.u1 = u1;
- ctx.tp = tp + n; /* ualloc */
- ctx.un = un;
+ mp_size_t gn;
+ mp_size_t updated_un = un;
- /* Temporary storage n */
- n = mpn_gcd_subdiv_step (ap, bp, n, 0, mpn_gcdext_hook, &ctx, tp);
+ /* Temporary storage 2n + 1 */
+ n = mpn_gcdext_subdiv_step (gp, &gn, up, usizep, ap, bp, n,
+ u0, u1, &updated_un, tp, tp + n);
if (n == 0)
{
TMP_FREE;
- return ctx.gn;
+ return gn;
}
- un = ctx.un;
+ un = updated_un;
ASSERT (un < ualloc);
}
}
- /* We have A = ... a + ... b
- B = u0 a + u1 b
-
- a = u1 A + ... B
- b = -u0 A + ... B
-
- with bounds
-
- |u0|, |u1| <= B / min(a, b)
-
- We always have u1 > 0, and u0 == 0 is possible only if u1 == 1,
- in which case the only reduction done so far is a = A - k B for
- some k.
-
- Compute g = u a + v b = (u u1 - v u0) A + (...) B
- Here, u, v are bounded by
-
- |u| <= b,
- |v| <= a
- */
-
- ASSERT ( (ap[n-1] | bp[n-1]) > 0);
if (UNLIKELY (mpn_cmp (ap, bp, n) == 0))
{
@@ -426,10 +396,7 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
MPN_COPY (gp, ap, n);
MPN_CMP (c, u0, u1, un);
- /* c == 0 can happen only when A = (2k+1) G, B = 2 G. And in
- this case we choose the cofactor + 1, corresponding to G = A
- - k B, rather than -1, corresponding to G = - A + (k+1) B. */
- ASSERT (c != 0 || (un == 1 && u0[0] == 1 && u1[0] == 1));
+ ASSERT (c != 0);
if (c < 0)
{
MPN_NORMALIZE (u0, un);
@@ -446,9 +413,10 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
TMP_FREE;
return n;
}
- else if (UNLIKELY (u0[0] == 0) && un == 1)
+ else if (mpn_zero_p (u0, un))
{
mp_size_t gn;
+ ASSERT (un == 1);
ASSERT (u1[0] == 1);
/* g = u a + v b = (u u1 - v u0) A + (...) B = u A + (...) B */
@@ -459,6 +427,23 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
}
else
{
+ /* We have A = ... a + ... b
+ B = u0 a + u1 b
+
+ a = u1 A + ... B
+ b = -u0 A + ... B
+
+ with bounds
+
+ |u0|, |u1| <= B / min(a, b)
+
+ Compute g = u a + v b = (u u1 - v u0) A + (...) B
+ Here, u, v are bounded by
+
+ |u| <= b,
+ |v| <= a
+ */
+
mp_size_t u0n;
mp_size_t u1n;
mp_size_t lehmer_un;
@@ -478,8 +463,6 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
u0n = un;
MPN_NORMALIZE (u0, u0n);
- ASSERT (u0n > 0);
-
if (lehmer_un == 0)
{
/* u == 0 ==> v = g / b == 1 ==> g = - u0 A + (...) B */
@@ -505,12 +488,25 @@ mpn_gcdext (mp_ptr gp, mp_ptr up, mp_size_t *usizep,
u1n = un;
MPN_NORMALIZE (u1, u1n);
- ASSERT (u1n > 0);
+
+ /* It's possible that u0 = 1, u1 = 0 */
+ if (u1n == 0)
+ {
+ ASSERT (un == 1);
+ ASSERT (u0[0] == 1);
+
+ /* u1 == 0 ==> u u1 + v u0 = v */
+ MPN_COPY (up, lehmer_vp, lehmer_vn);
+ *usizep = negate ? lehmer_vn : - lehmer_vn;
+
+ TMP_FREE;
+ return gn;
+ }
ASSERT (lehmer_un + u1n <= ualloc);
ASSERT (lehmer_vn + u0n <= ualloc);
- /* We may still have v == 0 */
+ /* Now u0, u1, u are non-zero. We may still have v == 0 */
/* Compute u u0 */
if (lehmer_un <= u1n)
diff --git a/gmp/mpn/generic/gcdext_1.c b/gmp/mpn/generic/gcdext_1.c
index ea46cceb72..f1dd9ee963 100644
--- a/gmp/mpn/generic/gcdext_1.c
+++ b/gmp/mpn/generic/gcdext_1.c
@@ -1,273 +1,27 @@
/* mpn_gcdext -- Extended Greatest Common Divisor.
-Copyright 1996, 1998, 2000-2005, 2008, 2009 Free Software Foundation, Inc.
+Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-#ifndef GCDEXT_1_USE_BINARY
-#define GCDEXT_1_USE_BINARY 0
-#endif
-
-#ifndef GCDEXT_1_BINARY_METHOD
-#define GCDEXT_1_BINARY_METHOD 2
-#endif
-
-#ifndef USE_ZEROTAB
-#define USE_ZEROTAB 1
-#endif
-
-#if GCDEXT_1_USE_BINARY
-
-#if USE_ZEROTAB
-static unsigned char zerotab[0x40] = {
- 6, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
- 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
- 5, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0,
- 4, 0, 1, 0, 2, 0, 1, 0, 3, 0, 1, 0, 2, 0, 1, 0
-};
-#endif
-
-mp_limb_t
-mpn_gcdext_1 (mp_limb_signed_t *sp, mp_limb_signed_t *tp,
- mp_limb_t u, mp_limb_t v)
-{
- /* Maintain
-
- U = t1 u + t0 v
- V = s1 u + s0 v
-
- where U, V are the inputs (without any shared power of two),
- and the matrix has determinant ± 2^{shift}.
- */
- mp_limb_t s0 = 1;
- mp_limb_t t0 = 0;
- mp_limb_t s1 = 0;
- mp_limb_t t1 = 1;
- mp_limb_t ug;
- mp_limb_t vg;
- mp_limb_t ugh;
- mp_limb_t vgh;
- unsigned zero_bits;
- unsigned shift;
- unsigned i;
-#if GCDEXT_1_BINARY_METHOD == 2
- mp_limb_t det_sign;
-#endif
-
- ASSERT (u > 0);
- ASSERT (v > 0);
-
- count_trailing_zeros (zero_bits, u | v);
- u >>= zero_bits;
- v >>= zero_bits;
-
- if ((u & 1) == 0)
- {
- count_trailing_zeros (shift, u);
- u >>= shift;
- t1 <<= shift;
- }
- else if ((v & 1) == 0)
- {
- count_trailing_zeros (shift, v);
- v >>= shift;
- s0 <<= shift;
- }
- else
- shift = 0;
-
-#if GCDEXT_1_BINARY_METHOD == 1
- while (u != v)
- {
- unsigned count;
- if (u > v)
- {
- u -= v;
-#if USE_ZEROTAB
- count = zerotab [u & 0x3f];
- u >>= count;
- if (UNLIKELY (count == 6))
- {
- unsigned c;
- do
- {
- c = zerotab[u & 0x3f];
- u >>= c;
- count += c;
- }
- while (c == 6);
- }
-#else
- count_trailing_zeros (count, u);
- u >>= count;
-#endif
- t0 += t1; t1 <<= count;
- s0 += s1; s1 <<= count;
- }
- else
- {
- v -= u;
-#if USE_ZEROTAB
- count = zerotab [v & 0x3f];
- v >>= count;
- if (UNLIKELY (count == 6))
- {
- unsigned c;
- do
- {
- c = zerotab[v & 0x3f];
- v >>= c;
- count += c;
- }
- while (c == 6);
- }
-#else
- count_trailing_zeros (count, v);
- v >>= count;
-#endif
- t1 += t0; t0 <<= count;
- s1 += s0; s0 <<= count;
- }
- shift += count;
- }
-#else
-# if GCDEXT_1_BINARY_METHOD == 2
- u >>= 1;
- v >>= 1;
-
- det_sign = 0;
-
- while (u != v)
- {
- unsigned count;
- mp_limb_t d = u - v;
- mp_limb_t vgtu = LIMB_HIGHBIT_TO_MASK (d);
- mp_limb_t sx;
- mp_limb_t tx;
-
- /* When v <= u (vgtu == 0), the updates are:
-
- (u; v) <-- ( (u - v) >> count; v) (det = +(1<<count) for corr. M factor)
- (t1, t0) <-- (t1 << count, t0 + t1)
-
- and when v > 0, the updates are
-
- (u; v) <-- ( (v - u) >> count; u) (det = -(1<<count))
- (t1, t0) <-- (t0 << count, t0 + t1)
-
- and similarly for s1, s0
- */
-
- /* v <-- min (u, v) */
- v += (vgtu & d);
-
- /* u <-- |u - v| */
- u = (d ^ vgtu) - vgtu;
-
- /* Number of trailing zeros is the same no matter if we look at
- * d or u, but using d gives more parallelism. */
-#if USE_ZEROTAB
- count = zerotab[d & 0x3f];
- if (UNLIKELY (count == 6))
- {
- unsigned c = 6;
- do
- {
- d >>= c;
- c = zerotab[d & 0x3f];
- count += c;
- }
- while (c == 6);
- }
-#else
- count_trailing_zeros (count, d);
-#endif
- det_sign ^= vgtu;
-
- tx = vgtu & (t0 - t1);
- sx = vgtu & (s0 - s1);
- t0 += t1;
- s0 += s1;
- t1 += tx;
- s1 += sx;
-
- count++;
- u >>= count;
- t1 <<= count;
- s1 <<= count;
- shift += count;
- }
- u = (u << 1) + 1;
-# else /* GCDEXT_1_BINARY_METHOD == 2 */
-# error Unknown GCDEXT_1_BINARY_METHOD
-# endif
-#endif
-
- /* Now u = v = g = gcd (u,v). Compute U/g and V/g */
- ug = t0 + t1;
- vg = s0 + s1;
-
- ugh = ug/2 + (ug & 1);
- vgh = vg/2 + (vg & 1);
-
- /* Now ±2^{shift} g = s0 U - t0 V. Get rid of the power of two, using
- s0 U - t0 V = (s0 + V/g) U - (t0 + U/g) V. */
- for (i = 0; i < shift; i++)
- {
- mp_limb_t mask = - ( (s0 | t0) & 1);
-
- s0 /= 2;
- t0 /= 2;
- s0 += mask & vgh;
- t0 += mask & ugh;
- }
- /* FIXME: Try simplifying this condition. */
- if ( (s0 > 1 && 2*s0 >= vg) || (t0 > 1 && 2*t0 >= ug) )
- {
- s0 -= vg;
- t0 -= ug;
- }
-#if GCDEXT_1_BINARY_METHOD == 2
- /* Conditional negation. */
- s0 = (s0 ^ det_sign) - det_sign;
- t0 = (t0 ^ det_sign) - det_sign;
-#endif
- *sp = s0;
- *tp = -t0;
-
- return u << zero_bits;
-}
-
-#else /* !GCDEXT_1_USE_BINARY */
-
/* FIXME: Takes two single-word limbs. It could be extended to a
* function that accepts a bignum for the first input, and only
@@ -325,4 +79,3 @@ mpn_gcdext_1 (mp_limb_signed_t *up, mp_limb_signed_t *vp,
v1 -= q * v0;
}
}
-#endif /* !GCDEXT_1_USE_BINARY */
diff --git a/gmp/mpn/generic/gcdext_lehmer.c b/gmp/mpn/generic/gcdext_lehmer.c
index 547f69a409..8599a4f554 100644
--- a/gmp/mpn/generic/gcdext_lehmer.c
+++ b/gmp/mpn/generic/gcdext_lehmer.c
@@ -1,146 +1,31 @@
/* mpn_gcdext -- Extended Greatest Common Divisor.
-Copyright 1996, 1998, 2000-2005, 2008, 2009, 2012 Free Software Foundation,
-Inc.
+Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-/* Here, d is the index of the cofactor to update. FIXME: Could use qn
- = 0 for the common case q = 1. */
-void
-mpn_gcdext_hook (void *p, mp_srcptr gp, mp_size_t gn,
- mp_srcptr qp, mp_size_t qn, int d)
-{
- struct gcdext_ctx *ctx = (struct gcdext_ctx *) p;
- mp_size_t un = ctx->un;
-
- if (gp)
- {
- mp_srcptr up;
-
- ASSERT (gn > 0);
- ASSERT (gp[gn-1] > 0);
-
- MPN_COPY (ctx->gp, gp, gn);
- ctx->gn = gn;
-
- if (d < 0)
- {
- int c;
-
- /* Must return the smallest cofactor, +u1 or -u0 */
- MPN_CMP (c, ctx->u0, ctx->u1, un);
- ASSERT (c != 0 || (un == 1 && ctx->u0[0] == 1 && ctx->u1[0] == 1));
-
- d = c < 0;
- }
-
- up = d ? ctx->u0 : ctx->u1;
-
- MPN_NORMALIZE (up, un);
- MPN_COPY (ctx->up, up, un);
-
- *ctx->usize = d ? -un : un;
- }
- else
- {
- mp_limb_t cy;
- mp_ptr u0 = ctx->u0;
- mp_ptr u1 = ctx->u1;
-
- ASSERT (d >= 0);
-
- if (d)
- MP_PTR_SWAP (u0, u1);
-
- qn -= (qp[qn-1] == 0);
-
- /* Update u0 += q * u1 */
- if (qn == 1)
- {
- mp_limb_t q = qp[0];
-
- if (q == 1)
- /* A common case. */
- cy = mpn_add_n (u0, u0, u1, un);
- else
- cy = mpn_addmul_1 (u0, u1, un, q);
- }
- else
- {
- mp_size_t u1n;
- mp_ptr tp;
-
- u1n = un;
- MPN_NORMALIZE (u1, u1n);
-
- if (u1n == 0)
- return;
-
- /* Should always have u1n == un here, and u1 >= u0. The
- reason is that we alternate adding u0 to u1 and u1 to u0
- (corresponding to subtractions a - b and b - a), and we
- can get a large quotient only just after a switch, which
- means that we'll add (a multiple of) the larger u to the
- smaller. */
-
- tp = ctx->tp;
-
- if (qn > u1n)
- mpn_mul (tp, qp, qn, u1, u1n);
- else
- mpn_mul (tp, u1, u1n, qp, qn);
-
- u1n += qn;
- u1n -= tp[u1n-1] == 0;
-
- if (u1n >= un)
- {
- cy = mpn_add (u0, tp, u1n, u0, un);
- un = u1n;
- }
- else
- /* Note: Unlikely case, maybe never happens? */
- cy = mpn_add (u0, u0, un, tp, u1n);
-
- }
- u0[un] = cy;
- ctx->un = un + (cy > 0);
- }
-}
-
-/* Temporary storage: 3*(n+1) for u. If hgcd2 succeeds, we need n for
- the matrix-vector multiplication adjusting a, b. If hgcd fails, we
- need at most n for the quotient and n+1 for the u update (reusing
- the extra u). In all, 4n + 3. */
+/* Temporary storage: 3*(n+1) for u. n+1 for the matrix-vector
+ multiplications (if hgcd2 succeeds). If hgcd fails, n+1 limbs are
+ needed for the division, with most n for the quotient, and n+1 for
+ the product q u0. In all, 4n + 3. */
mp_size_t
mpn_gcdext_lehmer_n (mp_ptr gp, mp_ptr up, mp_size_t *usize,
@@ -156,16 +41,8 @@ mpn_gcdext_lehmer_n (mp_ptr gp, mp_ptr up, mp_size_t *usize,
* which correspond to the first column of the inverse
*
* M^{-1} = (u1, -v1; -u0, v0)
- *
- * This implies that
- *
- * a = u1 A (mod B)
- * b = -u0 A (mod B)
- *
- * where A, B denotes the input values.
*/
- struct gcdext_ctx ctx;
mp_size_t un;
mp_ptr u0;
mp_ptr u1;
@@ -178,10 +55,6 @@ mpn_gcdext_lehmer_n (mp_ptr gp, mp_ptr up, mp_size_t *usize,
u1[0] = 1; un = 1;
- ctx.gp = gp;
- ctx.up = up;
- ctx.usize = usize;
-
/* FIXME: Handle n == 2 differently, after the loop? */
while (n >= 2)
{
@@ -223,7 +96,7 @@ mpn_gcdext_lehmer_n (mp_ptr gp, mp_ptr up, mp_size_t *usize,
/* Try an mpn_nhgcd2 step */
if (mpn_hgcd2 (ah, al, bh, bl, &M))
{
- n = mpn_matrix22_mul1_inverse_vector (&M, tp, ap, bp, n);
+ n = mpn_hgcd_mul_matrix1_inverse_vector (&M, tp, ap, bp, n);
MP_PTR_SWAP (ap, tp);
un = mpn_hgcd_mul_matrix1_vector(&M, u2, u0, u1, un);
MP_PTR_SWAP (u0, u2);
@@ -233,18 +106,17 @@ mpn_gcdext_lehmer_n (mp_ptr gp, mp_ptr up, mp_size_t *usize,
/* mpn_hgcd2 has failed. Then either one of a or b is very
small, or the difference is very small. Perform one
subtraction followed by one division. */
- ctx.u0 = u0;
- ctx.u1 = u1;
- ctx.tp = u2;
- ctx.un = un;
+ mp_size_t gn;
+ mp_size_t updated_un = un;
/* Temporary storage n for the quotient and ualloc for the
new cofactor. */
- n = mpn_gcd_subdiv_step (ap, bp, n, 0, mpn_gcdext_hook, &ctx, tp);
+ n = mpn_gcdext_subdiv_step (gp, &gn, up, usize, ap, bp, n,
+ u0, u1, &updated_un, tp, u2);
if (n == 0)
- return ctx.gn;
+ return gn;
- un = ctx.un;
+ un = updated_un;
}
}
ASSERT_ALWAYS (ap[0] > 0);
diff --git a/gmp/mpn/generic/gcdext_subdiv_step.c b/gmp/mpn/generic/gcdext_subdiv_step.c
new file mode 100644
index 0000000000..d54b3bdee1
--- /dev/null
+++ b/gmp/mpn/generic/gcdext_subdiv_step.c
@@ -0,0 +1,197 @@
+/* gcdext_subdiv_step.c.
+
+ 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.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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"
+
+/* Used when mpn_hgcd or mpn_hgcd2 has failed. Then either one of a or
+ b is small, or the difference is small. Perform one subtraction
+ followed by one division. If the gcd is found, stores it in gp and
+ *gn, and returns zero. Otherwise, compute the reduced a and b,
+ return the new size, and cofactors. */
+
+/* Temporary storage: Needs n limbs for the quotient, at qp. tp must
+ point to an area large enough for the resulting cofactor, plus one
+ limb extra. All in all, 2N + 1 if N is a bound for both inputs and
+ outputs. */
+mp_size_t
+mpn_gcdext_subdiv_step (mp_ptr gp, mp_size_t *gn, mp_ptr up, mp_size_t *usizep,
+ mp_ptr ap, mp_ptr bp, mp_size_t n,
+ mp_ptr u0, mp_ptr u1, mp_size_t *unp,
+ mp_ptr qp, mp_ptr tp)
+{
+ mp_size_t an, bn, un;
+ mp_size_t qn;
+ mp_size_t u0n;
+
+ int swapped;
+
+ an = bn = n;
+
+ ASSERT (an > 0);
+ ASSERT (ap[an-1] > 0 || bp[an-1] > 0);
+
+ MPN_NORMALIZE (ap, an);
+ MPN_NORMALIZE (bp, bn);
+
+ un = *unp;
+
+ swapped = 0;
+
+ if (UNLIKELY (an == 0))
+ {
+ return_b:
+ MPN_COPY (gp, bp, bn);
+ *gn = bn;
+
+ MPN_NORMALIZE (u0, un);
+ MPN_COPY (up, u0, un);
+
+ *usizep = swapped ? un : -un;
+
+ return 0;
+ }
+ else if (UNLIKELY (bn == 0))
+ {
+ MPN_COPY (gp, ap, an);
+ *gn = an;
+
+ MPN_NORMALIZE (u1, un);
+ MPN_COPY (up, u1, un);
+
+ *usizep = swapped ? -un : un;
+
+ return 0;
+ }
+
+ /* Arrange so that a > b, subtract an -= bn, and maintain
+ normalization. */
+ if (an < bn)
+ {
+ MPN_PTR_SWAP (ap, an, bp, bn);
+ MP_PTR_SWAP (u0, u1);
+ swapped ^= 1;
+ }
+ else if (an == bn)
+ {
+ int c;
+ MPN_CMP (c, ap, bp, an);
+ if (UNLIKELY (c == 0))
+ {
+ MPN_COPY (gp, ap, an);
+ *gn = an;
+
+ /* Must return the smallest cofactor, +u1 or -u0 */
+ MPN_CMP (c, u0, u1, un);
+ ASSERT (c != 0 || (un == 1 && u0[0] == 1 && u1[0] == 1));
+
+ if (c < 0)
+ {
+ MPN_NORMALIZE (u0, un);
+ MPN_COPY (up, u0, un);
+ swapped ^= 1;
+ }
+ else
+ {
+ MPN_NORMALIZE_NOT_ZERO (u1, un);
+ MPN_COPY (up, u1, un);
+ }
+
+ *usizep = swapped ? -un : un;
+ return 0;
+ }
+ else if (c < 0)
+ {
+ MP_PTR_SWAP (ap, bp);
+ MP_PTR_SWAP (u0, u1);
+ swapped ^= 1;
+ }
+ }
+ /* Reduce a -= b, u1 += u0 */
+ ASSERT_NOCARRY (mpn_sub (ap, ap, an, bp, bn));
+ MPN_NORMALIZE (ap, an);
+ ASSERT (an > 0);
+
+ u1[un] = mpn_add_n (u1, u1, u0, un);
+ un += (u1[un] > 0);
+
+ /* Arrange so that a > b, and divide a = q b + r */
+ if (an < bn)
+ {
+ MPN_PTR_SWAP (ap, an, bp, bn);
+ MP_PTR_SWAP (u0, u1);
+ swapped ^= 1;
+ }
+ else if (an == bn)
+ {
+ int c;
+ MPN_CMP (c, ap, bp, an);
+ if (UNLIKELY (c == 0))
+ goto return_b;
+ else if (c < 0)
+ {
+ MP_PTR_SWAP (ap, bp);
+ MP_PTR_SWAP (u0, u1);
+ swapped ^= 1;
+ }
+ }
+
+ /* Reduce a -= q b, u1 += q u0 */
+ qn = an - bn + 1;
+ mpn_tdiv_qr (qp, ap, 0, ap, an, bp, bn);
+
+ if (mpn_zero_p (ap, bn))
+ goto return_b;
+
+ n = bn;
+
+ /* Update u1 += q u0 */
+ u0n = un;
+ MPN_NORMALIZE (u0, u0n);
+
+ if (u0n > 0)
+ {
+ qn -= (qp[qn - 1] == 0);
+
+ if (qn > u0n)
+ mpn_mul (tp, qp, qn, u0, u0n);
+ else
+ mpn_mul (tp, u0, u0n, qp, qn);
+
+ if (qn + u0n > un)
+ {
+ ASSERT_NOCARRY (mpn_add (u1, tp, qn + u0n, u1, un));
+ un = qn + u0n;
+ un -= (u1[un-1] == 0);
+ }
+ else
+ {
+ u1[un] = mpn_add (u1, u1, un, tp, qn + u0n);
+ un += (u1[un] > 0);
+ }
+ }
+
+ *unp = un;
+ return n;
+}
diff --git a/gmp/mpn/generic/get_d.c b/gmp/mpn/generic/get_d.c
index d73d314856..cf4ae86efc 100644
--- a/gmp/mpn/generic/get_d.c
+++ b/gmp/mpn/generic/get_d.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2003, 2004, 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2003, 2004 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,20 +29,33 @@ see https://www.gnu.org/licenses/. */
#define _GMP_IEEE_FLOATS 0
#endif
+#if ! _GMP_IEEE_FLOATS
+/* dummy definition, just to let dead code compile */
+union ieee_double_extract {
+ struct {
+ int manh, manl, sig, exp;
+ } s;
+ double d;
+};
+#endif
+
/* To force use of the generic C code for testing, put
"#define _GMP_IEEE_FLOATS 0" at this point. */
+
/* In alpha gcc prior to 3.4, signed DI comparisons involving constants are
rearranged from "x < n" to "x+(-n) < 0", which is of course hopelessly
wrong if that addition overflows.
- The workaround here avoids this bug by ensuring n is not a literal constant.
- Note that this is alpha specific. The offending transformation is/was in
- alpha.c alpha_emit_conditional_branch() under "We want to use cmpcc/bcc".
+ The workaround here avoids this bug by ensuring n is not a literal
+ constant. Note that this is alpha specific. The offending transformation
+ is/was in alpha.c alpha_emit_conditional_branch() under "We want to use
+ cmpcc/bcc".
- Bizarrely, this happens also with Cray cc on alphaev5-cray-unicosmk2.0.6.X,
- and has the same solution. Don't know why or how. */
+ Bizarrely, it turns out this happens also with Cray cc on
+ alphaev5-cray-unicosmk2.0.6.X, and has the same solution. Don't know why
+ or how. */
#if HAVE_HOST_CPU_FAMILY_alpha \
&& ((defined (__GNUC__) && ! __GMP_GNUC_PREREQ(3,4)) \
@@ -68,73 +70,69 @@ static volatile const long CONST_NEG_1022_SUB_53 = -1022 - 53;
#endif
-/* Return the value {ptr,size}*2^exp, and negative if sign<0. Must have
- size>=1, and a non-zero high limb ptr[size-1].
- When we know the fp format, the result is truncated towards zero. This is
- consistent with other gmp conversions, like mpz_set_f or mpz_set_q, and is
- easy to implement and test.
+/* Return the value {ptr,size}*2^exp, and negative if sign<0.
+ Must have size>=1, and a non-zero high limb ptr[size-1].
- When we do not know the format, such truncation seems much harder. One
- would need to defeat any rounding mode, including round-up.
+ {ptr,size} is truncated towards zero. This is consistent with other gmp
+ conversions, like mpz_set_f or mpz_set_q, and is easy to implement and
+ test.
+
+ In the past conversions had attempted (imperfectly) to let the hardware
+ float rounding mode take effect, but that gets tricky since multiple
+ roundings need to be avoided, or taken into account, and denorms mean the
+ effective precision of the mantissa is not constant. (For reference,
+ mpz_get_d on IEEE systems was ok, except it operated on the absolute
+ value. mpf_get_d and mpq_get_d suffered from multiple roundings and from
+ not always using enough bits to get the rounding right.)
It's felt that GMP is not primarily concerned with hardware floats, and
really isn't enhanced by getting involved with hardware rounding modes
- (which could even be some weird unknown style), so something unambiguous and
- straightforward is best.
+ (which could even be some weird unknown style), so something unambiguous
+ and straightforward is best.
The IEEE code below is the usual case, it knows either a 32-bit or 64-bit
limb and is done with shifts and masks. The 64-bit case in particular
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 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
- x's exponent is scaled with explicit code (not ldexp to avoid libm
- dependency). It is a tap-dance to avoid underflow or overflow, beware!
+ The generic code works one bit at a time, which will be quite slow, but
+ should support any binary-based "double" and be safe against any rounding
+ mode. Note in particular it works on IEEE systems too.
Traps:
- Hardware traps for overflow to infinity, underflow to zero, or unsupported
- denorms may or may not be taken. The IEEE code works bitwise and so
- probably won't trigger them, the generic code works by float operations and
- so probably will. This difference might be thought less than ideal, but
- again its felt straightforward code is better than trying to get intimate
- with hardware exceptions (of perhaps unknown nature).
+ Hardware traps for overflow to infinity, underflow to zero, or
+ unsupported denorms may or may not be taken. The IEEE code works bitwise
+ and so probably won't trigger them, the generic code works by float
+ operations and so probably will. This difference might be thought less
+ than ideal, but again its felt straightforward code is better than trying
+ to get intimate with hardware exceptions (of perhaps unknown nature).
Not done:
- mpz_get_d in the past handled size==1 with a cast limb->double. This might
- still be worthwhile there (for up to the mantissa many bits), but for
- mpn_get_d here, the cost of applying "exp" to the resulting exponent would
- probably use up any benefit a cast may have over bit twiddling. Also, if
- the exponent is pushed into denorm range then bit twiddling is the only
- option, to ensure the desired truncation is obtained.
+ mpz_get_d in the past handled size==1 with a cast limb->double. This
+ might still be worthwhile there (for up to the mantissa many bits), but
+ for mpn_get_d here, the cost of applying "exp" to the resulting exponent
+ would probably use up any benefit a cast may have over bit twiddling.
+ Also, if the exponent is pushed into denorm range then bit twiddling is
+ the only option, to ensure the desired truncation is obtained.
Other:
For reference, note that HPPA 8000, 8200, 8500 and 8600 trap FCNV,UDW,DBL
- to the kernel for values >= 2^63. This makes it slow, and worse the kernel
- Linux (what versions?) apparently uses untested code in its trap handling
- routines, and gets the sign wrong. We don't use such a limb-to-double
- cast, neither in the IEEE or generic code. */
-
+ to the kernel for values >= 2^63. This makes it slow, and worse the
+ Linux kernel (what versions?) apparently uses untested code in its trap
+ handling routines, and gets the sign wrong. We don't use such a limb to
+ double cast, neither in the IEEE or generic code. */
-#undef FORMAT_RECOGNIZED
-
double
mpn_get_d (mp_srcptr up, mp_size_t size, mp_size_t sign, long exp)
{
- int lshift, nbits;
- mp_limb_t x, mhi, mlo;
-
ASSERT (size >= 0);
ASSERT_MPN (up, size);
ASSERT (size == 0 || up[size-1] != 0);
@@ -146,11 +144,10 @@ mpn_get_d (mp_srcptr up, mp_size_t size, mp_size_t sign, long exp)
overflow. After this exp can of course be reduced to anywhere within
the {up,size} region without underflow. */
if (UNLIKELY ((unsigned long) (GMP_NUMB_BITS * size)
- > ((unsigned long) LONG_MAX - exp)))
+ > (unsigned long) (LONG_MAX - exp)))
{
-#if _GMP_IEEE_FLOATS
- goto ieee_infinity;
-#endif
+ if (_GMP_IEEE_FLOATS)
+ goto ieee_infinity;
/* generic */
exp = LONG_MAX;
@@ -160,253 +157,334 @@ mpn_get_d (mp_srcptr up, mp_size_t size, mp_size_t sign, long exp)
exp += GMP_NUMB_BITS * size;
}
-#if _GMP_IEEE_FLOATS
- {
- union ieee_double_extract u;
-
- up += size;
+#if 1
+{
+ int lshift, nbits;
+ union ieee_double_extract u;
+ mp_limb_t x, mhi, mlo;
#if GMP_LIMB_BITS == 64
- mlo = up[-1];
- count_leading_zeros (lshift, mlo);
+ mp_limb_t m;
+ up += size;
+ m = *--up;
+ count_leading_zeros (lshift, m);
- exp -= (lshift - GMP_NAIL_BITS) + 1;
- mlo <<= lshift;
+ exp -= (lshift - GMP_NAIL_BITS) + 1;
+ m <<= lshift;
- nbits = GMP_LIMB_BITS - lshift;
+ nbits = GMP_LIMB_BITS - lshift;
- if (nbits < 53 && size > 1)
+ if (nbits < 53 && size > 1)
+ {
+ x = *--up;
+ x <<= GMP_NAIL_BITS;
+ x >>= nbits;
+ m |= x;
+ nbits += GMP_NUMB_BITS;
+
+ if (LIMBS_PER_DOUBLE >= 3 && nbits < 53 && size > 2)
{
- x = up[-2];
+ x = *--up;
x <<= GMP_NAIL_BITS;
x >>= nbits;
- mlo |= x;
+ m |= x;
nbits += GMP_NUMB_BITS;
-
- if (LIMBS_PER_DOUBLE >= 3 && nbits < 53 && size > 2)
- {
- x = up[-3];
- x <<= GMP_NAIL_BITS;
- x >>= nbits;
- mlo |= x;
- nbits += GMP_NUMB_BITS;
- }
}
- mhi = mlo >> (32 + 11);
- mlo = mlo >> 11; /* later implicitly truncated to 32 bits */
+ }
+ mhi = m >> (32 + 11);
+ mlo = m >> 11;
#endif
#if GMP_LIMB_BITS == 32
- x = *--up;
- count_leading_zeros (lshift, x);
+ up += size;
+ x = *--up, size--;
+ count_leading_zeros (lshift, x);
- exp -= (lshift - GMP_NAIL_BITS) + 1;
- x <<= lshift;
- mhi = x >> 11;
+ exp -= (lshift - GMP_NAIL_BITS) + 1;
+ x <<= lshift;
+ mhi = x >> 11;
- if (lshift < 11) /* FIXME: never true if NUMB < 20 bits */
+ if (lshift < 11) /* FIXME: never true if NUMB < 20 bits */
+ {
+ /* All 20 bits in mhi */
+ mlo = x << 21;
+ /* >= 1 bit in mlo */
+ nbits = GMP_LIMB_BITS - lshift - 21;
+ }
+ else
+ {
+ if (size != 0)
{
- /* All 20 bits in mhi */
- mlo = x << 21;
- /* >= 1 bit in mlo */
- nbits = GMP_LIMB_BITS - lshift - 21;
+ nbits = GMP_LIMB_BITS - lshift;
+
+ x = *--up, size--;
+ x <<= GMP_NAIL_BITS;
+ mhi |= x >> nbits >> 11;
+
+ mlo = x << GMP_LIMB_BITS - nbits - 11;
+ nbits = nbits + 11 - GMP_NAIL_BITS;
}
else
{
- if (size > 1)
- {
- nbits = GMP_LIMB_BITS - lshift;
-
- x = *--up, size--;
- x <<= GMP_NAIL_BITS;
- mhi |= x >> nbits >> 11;
-
- mlo = x << GMP_LIMB_BITS - nbits - 11;
- nbits = nbits + 11 - GMP_NAIL_BITS;
- }
- else
- {
- mlo = 0;
- goto done;
- }
+ mlo = 0;
+ goto done;
}
+ }
- /* Now all needed bits in mhi have been accumulated. Add bits to mlo. */
+ if (LIMBS_PER_DOUBLE >= 2 && nbits < 32 && size != 0)
+ {
+ x = *--up, size--;
+ x <<= GMP_NAIL_BITS;
+ x >>= nbits;
+ mlo |= x;
+ nbits += GMP_NUMB_BITS;
- if (LIMBS_PER_DOUBLE >= 2 && nbits < 32 && size > 1)
+ if (LIMBS_PER_DOUBLE >= 3 && nbits < 32 && size != 0)
{
- x = up[-1];
+ x = *--up, size--;
x <<= GMP_NAIL_BITS;
x >>= nbits;
mlo |= x;
nbits += GMP_NUMB_BITS;
- if (LIMBS_PER_DOUBLE >= 3 && nbits < 32 && size > 2)
+ if (LIMBS_PER_DOUBLE >= 4 && nbits < 32 && size != 0)
{
- x = up[-2];
+ x = *--up;
x <<= GMP_NAIL_BITS;
x >>= nbits;
mlo |= x;
nbits += GMP_NUMB_BITS;
-
- if (LIMBS_PER_DOUBLE >= 4 && nbits < 32 && size > 3)
- {
- x = up[-3];
- x <<= GMP_NAIL_BITS;
- x >>= nbits;
- mlo |= x;
- nbits += GMP_NUMB_BITS;
- }
}
}
+ }
- done:;
+ done:;
#endif
+ {
+ if (UNLIKELY (exp >= CONST_1024))
+ {
+ /* overflow, return infinity */
+ ieee_infinity:
+ mhi = 0;
+ mlo = 0;
+ exp = 1024;
+ }
+ else if (UNLIKELY (exp <= CONST_NEG_1023))
+ {
+ int rshift;
+
+ if (LIKELY (exp <= CONST_NEG_1022_SUB_53))
+ return 0.0; /* denorm underflows to zero */
+
+ rshift = -1022 - exp;
+ ASSERT (rshift > 0 && rshift < 53);
+#if GMP_LIMB_BITS > 53
+ mlo >>= rshift;
+ mhi = mlo >> 32;
+#else
+ if (rshift >= 32)
+ {
+ mlo = mhi;
+ mhi = 0;
+ rshift -= 32;
+ }
+ lshift = GMP_LIMB_BITS - rshift;
+ mlo = (mlo >> rshift) | (rshift == 0 ? 0 : mhi << lshift);
+ mhi >>= rshift;
+#endif
+ exp = -1023;
+ }
+ }
+ u.s.manh = mhi;
+ u.s.manl = mlo;
+ u.s.exp = exp + 1023;
+ u.s.sig = (sign < 0);
+ return u.d;
+}
+#else
+
+
+#define ONE_LIMB (GMP_LIMB_BITS == 64 && 2*GMP_NUMB_BITS >= 53)
+#define TWO_LIMBS (GMP_LIMB_BITS == 32 && 3*GMP_NUMB_BITS >= 53)
+
+ if (_GMP_IEEE_FLOATS && (ONE_LIMB || TWO_LIMBS))
+ {
+ union ieee_double_extract u;
+ mp_limb_t m0, m1, m2, rmask;
+ int lshift, rshift;
+
+ m0 = up[size-1]; /* high limb */
+ m1 = (size >= 2 ? up[size-2] : 0); /* second highest limb */
+ count_leading_zeros (lshift, m0);
+
+ /* relative to just under high non-zero bit */
+ exp -= (lshift - GMP_NAIL_BITS) + 1;
+
+ if (ONE_LIMB)
+ {
+ /* lshift to have high of m0 non-zero, and collapse nails */
+ rshift = GMP_LIMB_BITS - lshift;
+ m1 <<= GMP_NAIL_BITS;
+ rmask = GMP_NAIL_BITS == 0 && lshift == 0 ? 0 : MP_LIMB_T_MAX;
+ m0 = (m0 << lshift) | ((m1 >> rshift) & rmask);
+
+ /* rshift back to have bit 53 of m0 the high non-zero */
+ m0 >>= 11;
+ }
+ else /* TWO_LIMBS */
+ {
+ m2 = (size >= 3 ? up[size-3] : 0); /* third highest limb */
+
+ /* collapse nails from m1 and m2 */
+#if GMP_NAIL_BITS != 0
+ m1 = (m1 << GMP_NAIL_BITS) | (m2 >> (GMP_NUMB_BITS-GMP_NAIL_BITS));
+ m2 <<= 2*GMP_NAIL_BITS;
+#endif
+
+ /* lshift to have high of m0:m1 non-zero, collapse nails from m0 */
+ rshift = GMP_LIMB_BITS - lshift;
+ rmask = (GMP_NAIL_BITS == 0 && lshift == 0 ? 0 : MP_LIMB_T_MAX);
+ m0 = (m0 << lshift) | ((m1 >> rshift) & rmask);
+ m1 = (m1 << lshift) | ((m2 >> rshift) & rmask);
+
+ /* rshift back to have bit 53 of m0:m1 the high non-zero */
+ m1 = (m1 >> 11) | (m0 << (GMP_LIMB_BITS-11));
+ m0 >>= 11;
+ }
+
if (UNLIKELY (exp >= CONST_1024))
{
/* overflow, return infinity */
ieee_infinity:
- mhi = 0;
- mlo = 0;
+ m0 = 0;
+ m1 = 0;
exp = 1024;
}
else if (UNLIKELY (exp <= CONST_NEG_1023))
{
- int rshift;
-
if (LIKELY (exp <= CONST_NEG_1022_SUB_53))
return 0.0; /* denorm underflows to zero */
rshift = -1022 - exp;
ASSERT (rshift > 0 && rshift < 53);
-#if GMP_LIMB_BITS > 53
- mlo >>= rshift;
- mhi = mlo >> 32;
-#else
- if (rshift >= 32)
+ if (ONE_LIMB)
{
- mlo = mhi;
- mhi = 0;
- rshift -= 32;
+ m0 >>= rshift;
}
- lshift = GMP_LIMB_BITS - rshift;
- mlo = (mlo >> rshift) | (rshift == 0 ? 0 : mhi << lshift);
- mhi >>= rshift;
-#endif
- exp = -1023;
- }
- u.s.manh = mhi;
- u.s.manl = mlo;
- u.s.exp = exp + 1023;
- u.s.sig = (sign < 0);
- return u.d;
- }
-#define FORMAT_RECOGNIZED 1
-#endif
-
-#if HAVE_DOUBLE_VAX_D
- {
- union double_extract u;
-
- up += size;
-
- mhi = up[-1];
-
- count_leading_zeros (lshift, mhi);
- exp -= lshift;
- mhi <<= lshift;
-
- mlo = 0;
- if (size > 1)
- {
- mlo = up[-2];
- if (lshift != 0)
- mhi += mlo >> (GMP_LIMB_BITS - lshift);
- mlo <<= lshift;
-
- if (size > 2 && lshift > 8)
+ else /* TWO_LIMBS */
{
- x = up[-3];
- mlo += x >> (GMP_LIMB_BITS - lshift);
+ if (rshift >= 32)
+ {
+ m1 = m0;
+ m0 = 0;
+ rshift -= 32;
+ }
+ lshift = GMP_LIMB_BITS - rshift;
+ m1 = (m1 >> rshift) | (rshift == 0 ? 0 : m0 << lshift);
+ m0 >>= rshift;
}
+ exp = -1023;
}
- if (UNLIKELY (exp >= 128))
+ if (ONE_LIMB)
{
- /* overflow, return maximum number */
- mhi = 0xffffffff;
- mlo = 0xffffffff;
- exp = 127;
+#if GMP_LIMB_BITS > 32 /* avoid compiler warning about big shift */
+ u.s.manh = m0 >> 32;
+#endif
+ u.s.manl = m0;
}
- else if (UNLIKELY (exp < -128))
+ else /* TWO_LIMBS */
{
- return 0.0; /* underflows to zero */
+ u.s.manh = m0;
+ u.s.manl = m1;
}
- u.s.man3 = mhi >> 24; /* drop msb, since implicit */
- u.s.man2 = mhi >> 8;
- u.s.man1 = (mhi << 8) + (mlo >> 24);
- u.s.man0 = mlo >> 8;
- u.s.exp = exp + 128;
- u.s.sig = sign < 0;
+ u.s.exp = exp + 1023;
+ u.s.sig = (sign < 0);
return u.d;
}
-#define FORMAT_RECOGNIZED 1
-#endif
-
-#if ! FORMAT_RECOGNIZED
- { /* Non-IEEE or strange limb size, do something generic. */
- mp_size_t i;
- double d, weight;
- unsigned long uexp;
-
- /* First generate an fp number disregarding exp, instead keeping things
- within the numb base factor from 1, which should prevent overflow and
- underflow even for the most exponent limited fp formats. The
- termination criteria should be refined, since we now include too many
- limbs. */
- weight = 1/MP_BASE_AS_DOUBLE;
- d = up[size - 1];
- for (i = size - 2; i >= 0; i--)
+ else
+ {
+ /* Non-IEEE or strange limb size, do something generic. */
+
+ mp_size_t i;
+ mp_limb_t limb, bit;
+ int shift;
+ double base, factor, prev_factor, d, new_d, diff;
+
+ /* "limb" is "up[i]" the limb being examined, "bit" is a mask for the
+ bit being examined, initially the highest non-zero bit. */
+ i = size-1;
+ limb = up[i];
+ count_leading_zeros (shift, limb);
+ bit = GMP_LIMB_HIGHBIT >> shift;
+
+ /* relative to just under high non-zero bit */
+ exp -= (shift - GMP_NAIL_BITS) + 1;
+
+ /* Power up "factor" to 2^exp, being the value of the "bit" in "limb"
+ being examined. */
+ base = (exp >= 0 ? 2.0 : 0.5);
+ exp = ABS (exp);
+ factor = 1.0;
+ for (;;)
{
- d += up[i] * weight;
- weight /= MP_BASE_AS_DOUBLE;
- if (weight == 0)
+ if (exp & 1)
+ {
+ prev_factor = factor;
+ factor *= base;
+ FORCE_DOUBLE (factor);
+ if (factor == 0.0)
+ return 0.0; /* underflow */
+ if (factor == prev_factor)
+ {
+ d = factor; /* overflow, apparent infinity */
+ goto generic_done;
+ }
+ }
+ exp >>= 1;
+ if (exp == 0)
break;
+ base *= base;
}
- /* Now apply exp. */
- exp -= GMP_NUMB_BITS;
- if (exp > 0)
- {
- weight = 2.0;
- uexp = exp;
- }
- else
- {
- weight = 0.5;
- uexp = 1 - (unsigned long) (exp + 1);
- }
-#if 1
- /* Square-and-multiply exponentiation. */
- if (uexp & 1)
- d *= weight;
- while (uexp >>= 1)
- {
- weight *= weight;
- if (uexp & 1)
- d *= weight;
- }
-#else
- /* Plain exponentiation. */
- while (uexp > 0)
+ /* Add a "factor" for each non-zero bit, working from high to low.
+ Stop if any rounding occurs, hence implementing a truncation.
+
+ Note no attention is paid to DBL_MANT_DIG, since the effective
+ number of bits in the mantissa isn't constant when in denorm range.
+ We also encountered an ARM system with apparently somewhat doubtful
+ software floats where DBL_MANT_DIG claimed 53 bits but only 32
+ actually worked. */
+
+ d = factor; /* high bit */
+ for (;;)
{
- d *= weight;
- uexp--;
+ factor *= 0.5; /* next bit */
+ bit >>= 1;
+ if (bit == 0)
+ {
+ /* next limb, if any */
+ i--;
+ if (i < 0)
+ break;
+ limb = up[i];
+ bit = GMP_NUMB_HIGHBIT;
+ }
+
+ if (bit & limb)
+ {
+ new_d = d + factor;
+ FORCE_DOUBLE (new_d);
+ diff = new_d - d;
+ if (diff != factor)
+ break; /* rounding occured, stop now */
+ d = new_d;
+ }
}
-#endif
- return sign >= 0 ? d : -d;
+ generic_done:
+ return (sign >= 0 ? d : -d);
}
#endif
}
diff --git a/gmp/mpn/generic/get_str.c b/gmp/mpn/generic/get_str.c
index 42e93c9cee..df007578cc 100644
--- a/gmp/mpn/generic/get_str.c
+++ b/gmp/mpn/generic/get_str.c
@@ -7,34 +7,23 @@
FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE
GNU MP RELEASE.
-Copyright 1991-1994, 1996, 2000-2002, 2004, 2006-2008, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2006, 2007,
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -361,8 +350,7 @@ mpn_dc_get_str (unsigned char *str, size_t len,
/* There are no leading zeros on the digits generated at str, but that's not
- currently a documented feature. The current mpz_out_str and mpz_get_str
- rely on it. */
+ currently a documented feature. */
size_t
mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
@@ -394,7 +382,7 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
int bit_pos;
mp_size_t i;
unsigned char *s = str;
- mp_bitcnt_t bits;
+ unsigned long bits;
n1 = up[un - 1];
count_leading_zeros (cnt, n1);
@@ -403,11 +391,11 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
R + bits_per_digit * n when input ends in nth least significant
nibble. */
- bits = (mp_bitcnt_t) GMP_NUMB_BITS * un - cnt + GMP_NAIL_BITS;
+ bits = GMP_NUMB_BITS * un - cnt + GMP_NAIL_BITS;
cnt = bits % bits_per_digit;
if (cnt != 0)
bits += bits_per_digit - cnt;
- bit_pos = bits - (mp_bitcnt_t) (un - 1) * GMP_NUMB_BITS;
+ bit_pos = bits - (un - 1) * GMP_NUMB_BITS;
/* Fast loop for bit output. */
i = un - 1;
@@ -451,12 +439,9 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
mp_size_t n_pows, xn, pn, exptab[GMP_LIMB_BITS], bexp;
mp_limb_t cy;
mp_size_t shift;
- size_t ndig;
-
- DIGITS_IN_BASE_PER_LIMB (ndig, un, base);
- xn = 1 + ndig / mp_bases[base].chars_per_limb; /* FIXME: scalar integer division */
n_pows = 0;
+ xn = 1 + un*(mp_bases[base].chars_per_bit_exactly*GMP_NUMB_BITS)/mp_bases[base].chars_per_limb;
for (pn = xn; pn != 1; pn = (pn + 1) >> 1)
{
exptab[n_pows] = pn;
@@ -488,7 +473,7 @@ mpn_get_str (unsigned char *str, int base, mp_ptr up, mp_size_t un)
ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_get_str_powtab_alloc (un));
- mpn_sqr (t, p, n);
+ mpn_sqr_n (t, p, n);
digits_in_base *= 2;
n *= 2; n -= t[n - 1] == 0;
@@ -546,7 +531,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 + (pi - 1), tmp) - str;
+ out_len = mpn_dc_get_str (str, 0, up, un, powtab - 1 + pi, tmp) - str;
TMP_FREE;
return out_len;
diff --git a/gmp/mpn/generic/gmp-mparam.h b/gmp/mpn/generic/gmp-mparam.h
index 7dc057aa0c..b22b96ef67 100644
--- a/gmp/mpn/generic/gmp-mparam.h
+++ b/gmp/mpn/generic/gmp-mparam.h
@@ -5,29 +5,18 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
-/* Values for GMP_LIMB_BITS etc will be determined by ./configure and put
+/* Values for BITS_PER_MP_LIMB etc will be determined by ./configure and put
in config.h. */
diff --git a/gmp/mpn/generic/hgcd.c b/gmp/mpn/generic/hgcd.c
index e27a9bdd82..5fc650bbd9 100644
--- a/gmp/mpn/generic/hgcd.c
+++ b/gmp/mpn/generic/hgcd.c
@@ -4,38 +4,497 @@
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-2005, 2008, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+/* For input of size n, matrix elements are of size at most ceil(n/2)
+ - 1, but we need two limbs extra. */
+void
+mpn_hgcd_matrix_init (struct hgcd_matrix *M, mp_size_t n, mp_ptr p)
+{
+ mp_size_t s = (n+1)/2 + 1;
+ M->alloc = s;
+ M->n = 1;
+ MPN_ZERO (p, 4 * s);
+ M->p[0][0] = p;
+ M->p[0][1] = p + s;
+ M->p[1][0] = p + 2 * s;
+ M->p[1][1] = p + 3 * s;
+
+ M->p[0][0][0] = M->p[1][1][0] = 1;
+}
+
+/* Updated column COL, adding in column (1-COL). */
+static void
+hgcd_matrix_update_1 (struct hgcd_matrix *M, unsigned col)
+{
+ mp_limb_t c0, c1;
+ ASSERT (col < 2);
+
+ c0 = mpn_add_n (M->p[0][col], M->p[0][0], M->p[0][1], M->n);
+ c1 = mpn_add_n (M->p[1][col], M->p[1][0], M->p[1][1], M->n);
+
+ M->p[0][col][M->n] = c0;
+ M->p[1][col][M->n] = c1;
+
+ M->n += (c0 | c1) != 0;
+ ASSERT (M->n < M->alloc);
+}
+
+/* Updated column COL, adding in column Q * (1-COL). Temporary
+ * storage: qn + n <= M->alloc, where n is the size of the largest
+ * element in column 1 - COL. */
+static void
+hgcd_matrix_update_q (struct hgcd_matrix *M, mp_srcptr qp, mp_size_t qn,
+ unsigned col, mp_ptr tp)
+{
+ ASSERT (col < 2);
+
+ if (qn == 1)
+ {
+ mp_limb_t q = qp[0];
+ mp_limb_t c0, c1;
+
+ c0 = mpn_addmul_1 (M->p[0][col], M->p[0][1-col], M->n, q);
+ c1 = mpn_addmul_1 (M->p[1][col], M->p[1][1-col], M->n, q);
+
+ M->p[0][col][M->n] = c0;
+ M->p[1][col][M->n] = c1;
+
+ M->n += (c0 | c1) != 0;
+ }
+ else
+ {
+ unsigned row;
+
+ /* Carries for the unlikely case that we get both high words
+ from the multiplication and carries from the addition. */
+ mp_limb_t c[2];
+ mp_size_t n;
+
+ /* The matrix will not necessarily grow in size by qn, so we
+ need normalization in order not to overflow M. */
+
+ for (n = M->n; n + qn > M->n; n--)
+ {
+ ASSERT (n > 0);
+ if (M->p[0][1-col][n-1] > 0 || M->p[1][1-col][n-1] > 0)
+ break;
+ }
+
+ ASSERT (qn + n <= M->alloc);
+
+ for (row = 0; row < 2; row++)
+ {
+ if (qn <= n)
+ mpn_mul (tp, M->p[row][1-col], n, qp, qn);
+ else
+ mpn_mul (tp, qp, qn, M->p[row][1-col], n);
+
+ ASSERT (n + qn >= M->n);
+ c[row] = mpn_add (M->p[row][col], tp, n + qn, M->p[row][col], M->n);
+ }
+ if (c[0] | c[1])
+ {
+ M->n = n + qn + 1;
+ M->p[0][col][n-1] = c[0];
+ M->p[1][col][n-1] = c[1];
+ }
+ else
+ {
+ n += qn;
+ n -= (M->p[0][col][n-1] | M->p[1][col][n-1]) == 0;
+ if (n > M->n)
+ M->n = n;
+ }
+ }
+
+ ASSERT (M->n < M->alloc);
+}
+
+/* Multiply M by M1 from the right. Since the M1 elements fit in
+ GMP_NUMB_BITS - 1 bits, M grows by at most one limb. Needs
+ temporary space M->n */
+static void
+hgcd_matrix_mul_1 (struct hgcd_matrix *M, const struct hgcd_matrix1 *M1,
+ mp_ptr tp)
+{
+ mp_size_t n0, n1;
+
+ /* Could avoid copy by some swapping of pointers. */
+ MPN_COPY (tp, M->p[0][0], M->n);
+ n0 = mpn_hgcd_mul_matrix1_vector (M1, M->p[0][0], tp, M->p[0][1], M->n);
+ MPN_COPY (tp, M->p[1][0], M->n);
+ n1 = mpn_hgcd_mul_matrix1_vector (M1, M->p[1][0], tp, M->p[1][1], M->n);
+
+ /* Depends on zero initialization */
+ M->n = MAX(n0, n1);
+ ASSERT (M->n < M->alloc);
+}
+
+/* Perform a few steps, using some of mpn_hgcd2, subtraction and
+ division. Reduces the size by almost one limb or more, but never
+ 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
+ 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) <=
+ resulting size of $.
+
+ If N is the input size to the calling hgcd, then s = floor(N/2) +
+ 1, M->n < N, qn + matrix size <= n - s + 1 + n - s = 2 (n - s) + 1
+ < N, so N is sufficient.
+*/
+
+static mp_size_t
+hgcd_step (mp_size_t n, mp_ptr ap, mp_ptr bp, mp_size_t s,
+ struct hgcd_matrix *M, mp_ptr tp)
+{
+ struct hgcd_matrix1 M1;
+ mp_limb_t mask;
+ mp_limb_t ah, al, bh, bl;
+ mp_size_t an, bn, qn;
+ int col;
+
+ ASSERT (n > s);
+
+ mask = ap[n-1] | bp[n-1];
+ ASSERT (mask > 0);
+
+ if (n == s + 1)
+ {
+ if (mask < 4)
+ goto subtract;
+
+ ah = ap[n-1]; al = ap[n-2];
+ bh = bp[n-1]; bl = bp[n-2];
+ }
+ else if (mask & GMP_NUMB_HIGHBIT)
+ {
+ ah = ap[n-1]; al = ap[n-2];
+ bh = bp[n-1]; bl = bp[n-2];
+ }
+ else
+ {
+ int shift;
+
+ count_leading_zeros (shift, mask);
+ ah = MPN_EXTRACT_NUMB (shift, ap[n-1], ap[n-2]);
+ al = MPN_EXTRACT_NUMB (shift, ap[n-2], ap[n-3]);
+ bh = MPN_EXTRACT_NUMB (shift, bp[n-1], bp[n-2]);
+ bl = MPN_EXTRACT_NUMB (shift, bp[n-2], bp[n-3]);
+ }
+
+ /* Try an mpn_hgcd2 step */
+ if (mpn_hgcd2 (ah, al, bh, bl, &M1))
+ {
+ /* Multiply M <- M * M1 */
+ hgcd_matrix_mul_1 (M, &M1, tp);
+
+ /* Can't swap inputs, so we need to copy. */
+ MPN_COPY (tp, ap, n);
+ /* Multiply M1^{-1} (a;b) */
+ return mpn_hgcd_mul_matrix1_inverse_vector (&M1, ap, tp, bp, n);
+ }
+
+ subtract:
+ /* There are two ways in which mpn_hgcd2 can fail. Either one of ah and
+ bh was too small, or ah, bh were (almost) equal. Perform one
+ subtraction step (for possible cancellation of high limbs),
+ followed by one division. */
+
+ /* Since we must ensure that #(a-b) > s, we handle cancellation of
+ high limbs explicitly up front. (FIXME: Or is it better to just
+ subtract, normalize, and use an addition to undo if it turns out
+ the the difference is too small?) */
+ for (an = n; an > s; an--)
+ if (ap[an-1] != bp[an-1])
+ break;
+
+ if (an == s)
+ return 0;
+
+ /* Maintain a > b. When needed, swap a and b, and let col keep track
+ of how to update M. */
+ if (ap[an-1] > bp[an-1])
+ {
+ /* a is largest. In the subtraction step, we need to update
+ column 1 of M */
+ col = 1;
+ }
+ else
+ {
+ MP_PTR_SWAP (ap, bp);
+ col = 0;
+ }
+
+ bn = n;
+ MPN_NORMALIZE (bp, bn);
+ if (bn <= s)
+ return 0;
+
+ /* We have #a, #b > s. When is it possible that #(a-b) < s? For
+ cancellation to happen, the numbers must be of the form
+
+ a = x + 1, 0, ..., 0, al
+ b = x , GMP_NUMB_MAX, ..., GMP_NUMB_MAX, bl
+
+ where al, bl denotes the least significant k limbs. If al < bl,
+ then #(a-b) < k, and if also high(al) != 0, high(bl) != GMP_NUMB_MAX,
+ then #(a-b) = k. If al >= bl, then #(a-b) = k + 1. */
+
+ if (ap[an-1] == bp[an-1] + 1)
+ {
+ mp_size_t k;
+ int c;
+ for (k = an-1; k > s; k--)
+ if (ap[k-1] != 0 || bp[k-1] != GMP_NUMB_MAX)
+ break;
+
+ MPN_CMP (c, ap, bp, k);
+ if (c < 0)
+ {
+ mp_limb_t cy;
+
+ /* The limbs from k and up are cancelled. */
+ if (k == s)
+ return 0;
+ cy = mpn_sub_n (ap, ap, bp, k);
+ ASSERT (cy == 1);
+ an = k;
+ }
+ else
+ {
+ ASSERT_NOCARRY (mpn_sub_n (ap, ap, bp, k));
+ ap[k] = 1;
+ an = k + 1;
+ }
+ }
+ else
+ ASSERT_NOCARRY (mpn_sub_n (ap, ap, bp, an));
+
+ ASSERT (an > s);
+ ASSERT (ap[an-1] > 0);
+ ASSERT (bn > s);
+ ASSERT (bp[bn-1] > 0);
+
+ hgcd_matrix_update_1 (M, col);
+
+ if (an < bn)
+ {
+ MPN_PTR_SWAP (ap, an, bp, bn);
+ col ^= 1;
+ }
+ else if (an == bn)
+ {
+ int c;
+ MPN_CMP (c, ap, bp, an);
+ if (c < 0)
+ {
+ MP_PTR_SWAP (ap, bp);
+ col ^= 1;
+ }
+ }
+
+ /* Divide a / b. */
+ qn = an + 1 - bn;
+
+ /* FIXME: We could use an approximate division, that may return a
+ too small quotient, and only guarantee that the size of r is
+ almost the size of b. FIXME: Let ap and remainder overlap. */
+ mpn_tdiv_qr (tp, ap, 0, ap, an, bp, bn);
+ qn -= (tp[qn -1] == 0);
+
+ /* Normalize remainder */
+ an = bn;
+ for ( ; an > s; an--)
+ if (ap[an-1] > 0)
+ break;
+
+ if (an <= s)
+ {
+ /* Quotient is too large */
+ mp_limb_t cy;
+
+ cy = mpn_add (ap, bp, bn, ap, an);
+
+ if (cy > 0)
+ {
+ ASSERT (bn < n);
+ ap[bn] = cy;
+ bp[bn] = 0;
+ bn++;
+ }
+
+ MPN_DECR_U (tp, qn, 1);
+ qn -= (tp[qn-1] == 0);
+ }
+
+ if (qn > 0)
+ hgcd_matrix_update_q (M, tp, qn, col, tp + qn);
+
+ return bn;
+}
+
+/* Reduces a,b until |a-b| fits in n/2 + 1 limbs. Constructs matrix M
+ with elements of size at most (n+1)/2 - 1. Returns new size of a,
+ b, or zero if no reduction is possible. */
+mp_size_t
+mpn_hgcd_lehmer (mp_ptr ap, mp_ptr bp, mp_size_t n,
+ struct hgcd_matrix *M, mp_ptr tp)
+{
+ mp_size_t s = n/2 + 1;
+ mp_size_t nn;
+
+ ASSERT (n > s);
+ ASSERT (ap[n-1] > 0 || bp[n-1] > 0);
+
+ nn = hgcd_step (n, ap, bp, s, M, tp);
+ if (!nn)
+ return 0;
+
+ for (;;)
+ {
+ n = nn;
+ ASSERT (n > s);
+ nn = hgcd_step (n, ap, bp, s, M, tp);
+ if (!nn )
+ return n;
+ }
+}
+
+/* Multiply M by M1 from the right. Needs 4*(M->n + M1->n) + 5 limbs
+ of temporary storage (see mpn_matrix22_mul_itch). */
+void
+mpn_hgcd_matrix_mul (struct hgcd_matrix *M, const struct hgcd_matrix *M1,
+ mp_ptr tp)
+{
+ mp_size_t n;
+
+ /* About the new size of M:s elements. Since M1's diagonal elements
+ are > 0, no element can decrease. The new elements are of size
+ M->n + M1->n, one limb more or less. The computation of the
+ matrix product produces elements of size M->n + M1->n + 1. But
+ the true size, after normalization, may be three limbs smaller. */
+
+ /* FIXME: Strassen multiplication gives only a small speedup. In FFT
+ multiplication range, this function could be sped up quite a lot
+ using invariance. */
+ ASSERT (M->n + M1->n < M->alloc);
+
+ ASSERT ((M->p[0][0][M->n-1] | M->p[0][1][M->n-1]
+ | M->p[1][0][M->n-1] | M->p[1][1][M->n-1]) > 0);
+
+ ASSERT ((M1->p[0][0][M1->n-1] | M1->p[0][1][M1->n-1]
+ | M1->p[1][0][M1->n-1] | M1->p[1][1][M1->n-1]) > 0);
+
+ mpn_matrix22_mul (M->p[0][0], M->p[0][1],
+ M->p[1][0], M->p[1][1], M->n,
+ M1->p[0][0], M1->p[0][1],
+ M1->p[1][0], M1->p[1][1], M1->n, tp);
+
+ /* Index of last potentially non-zero limb, size is one greater. */
+ n = M->n + M1->n;
+
+ n -= ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) == 0);
+ n -= ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) == 0);
+ n -= ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) == 0);
+
+ ASSERT ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) > 0);
+
+ M->n = n + 1;
+}
+
+/* Multiplies the least significant p limbs of (a;b) by M^-1.
+ Temporary space needed: 2 * (p + M->n)*/
+mp_size_t
+mpn_hgcd_matrix_adjust (struct hgcd_matrix *M,
+ mp_size_t n, mp_ptr ap, mp_ptr bp,
+ mp_size_t p, mp_ptr tp)
+{
+ /* M^-1 (a;b) = (r11, -r01; -r10, r00) (a ; b)
+ = (r11 a - r01 b; - r10 a + r00 b */
+
+ mp_ptr t0 = tp;
+ mp_ptr t1 = tp + p + M->n;
+ mp_limb_t ah, bh;
+ mp_limb_t cy;
+
+ ASSERT (p + M->n < n);
+
+ /* First compute the two values depending on a, before overwriting a */
+
+ if (M->n >= p)
+ {
+ mpn_mul (t0, M->p[1][1], M->n, ap, p);
+ mpn_mul (t1, M->p[1][0], M->n, ap, p);
+ }
+ else
+ {
+ mpn_mul (t0, ap, p, M->p[1][1], M->n);
+ mpn_mul (t1, ap, p, M->p[1][0], M->n);
+ }
+
+ /* Update a */
+ MPN_COPY (ap, t0, p);
+ ah = mpn_add (ap + p, ap + p, n - p, t0 + p, M->n);
+
+ if (M->n >= p)
+ mpn_mul (t0, M->p[0][1], M->n, bp, p);
+ else
+ mpn_mul (t0, bp, p, M->p[0][1], M->n);
+
+ cy = mpn_sub (ap, ap, n, t0, p + M->n);
+ ASSERT (cy <= ah);
+ ah -= cy;
+
+ /* Update b */
+ if (M->n >= p)
+ mpn_mul (t0, M->p[0][0], M->n, bp, p);
+ else
+ mpn_mul (t0, bp, p, M->p[0][0], M->n);
+
+ MPN_COPY (bp, t0, p);
+ bh = mpn_add (bp + p, bp + p, n - p, t0 + p, M->n);
+ cy = mpn_sub (bp, bp, n, t1, p + M->n);
+ ASSERT (cy <= bh);
+ bh -= cy;
+
+ if (ah > 0 || bh > 0)
+ {
+ ap[n] = ah;
+ bp[n] = bh;
+ n++;
+ }
+ else
+ {
+ /* The subtraction can reduce the size by at most one limb. */
+ if (ap[n-1] == 0 && bp[n-1] == 0)
+ n--;
+ }
+ ASSERT (ap[n-1] > 0 || bp[n-1] > 0);
+ return n;
+}
/* Size analysis for hgcd:
@@ -46,15 +505,16 @@ see https://www.gnu.org/licenses/. */
Let S(r) denote the required storage. For M1 we need 4 * (ceil(n1/2) + 1)
= 4 * (ceil(n/4) + 1), for the hgcd_matrix_adjust call, we need n + 2,
- and for the hgcd_matrix_mul, we may need 3 ceil(n/2) + 8. In total,
- 4 * ceil(n/4) + 3 ceil(n/2) + 12 <= 10 ceil(n/4) + 12.
+ and for the hgcd_matrix_mul, we may need 4 ceil(n/2) + 1. In total,
+ 4 * ceil(n/4) + 4 ceil(n/2) + 5 <= 12 ceil(n/4) + 5.
For the recursive call, we need S(n1) = S(ceil(n/2)).
- S(n) <= 10*ceil(n/4) + 12 + S(ceil(n/2))
- <= 10*(ceil(n/4) + ... + ceil(n/2^(1+k))) + 12k + S(ceil(n/2^k))
- <= 10*(2 ceil(n/4) + k) + 12k + S(ceil(n/2^k))
- <= 20 ceil(n/4) + 22k + S(ceil(n/2^k))
+ S(n) <= 12*ceil(n/4) + 5 + S(ceil(n/2))
+ <= 12*(ceil(n/4) + ... + ceil(n/2^(1+k))) + 5k + S(ceil(n/2^k))
+ <= 12*(2 ceil(n/4) + k) + 5k + S(n/2^k)
+ <= 24 ceil(n/4) + 17k + S(n/2^k)
+
*/
mp_size_t
@@ -65,14 +525,15 @@ mpn_hgcd_itch (mp_size_t n)
mp_size_t nscaled;
if (BELOW_THRESHOLD (n, HGCD_THRESHOLD))
- return n;
+ return MPN_HGCD_LEHMER_ITCH (n);
/* Get the recursion depth. */
nscaled = (n - 1) / (HGCD_THRESHOLD - 1);
count_leading_zeros (count, nscaled);
k = GMP_LIMB_BITS - count;
- return 20 * ((n+3) / 4) + 22 * k + HGCD_THRESHOLD;
+ return 24 * ((n+3) / 4) + 17 * k
+ + MPN_HGCD_LEHMER_ITCH (HGCD_THRESHOLD);
}
/* Reduces a,b until |a-b| fits in n/2 + 1 limbs. Constructs matrix M
@@ -84,8 +545,9 @@ mpn_hgcd (mp_ptr ap, mp_ptr bp, mp_size_t n,
struct hgcd_matrix *M, mp_ptr tp)
{
mp_size_t s = n/2 + 1;
+ mp_size_t n2 = (3*n)/4 + 1;
- mp_size_t nn;
+ mp_size_t p, nn;
int success = 0;
if (n <= s)
@@ -97,83 +559,65 @@ mpn_hgcd (mp_ptr ap, mp_ptr bp, mp_size_t n,
ASSERT ((n+1)/2 - 1 < M->alloc);
- if (ABOVE_THRESHOLD (n, HGCD_THRESHOLD))
- {
- mp_size_t n2 = (3*n)/4 + 1;
- mp_size_t p = n/2;
+ if (BELOW_THRESHOLD (n, HGCD_THRESHOLD))
+ return mpn_hgcd_lehmer (ap, bp, n, M, tp);
- nn = mpn_hgcd_reduce (M, ap, bp, n, p, tp);
- if (nn)
- {
- n = nn;
- success = 1;
- }
+ p = n/2;
+ nn = mpn_hgcd (ap + p, bp + p, n - p, M, tp);
+ if (nn > 0)
+ {
+ /* Needs 2*(p + M->n) <= 2*(floor(n/2) + ceil(n/2) - 1)
+ = 2 (n - 1) */
+ n = mpn_hgcd_matrix_adjust (M, p + nn, ap, bp, p, tp);
+ success = 1;
+ }
+ while (n > n2)
+ {
+ /* Needs n + 1 storage */
+ nn = hgcd_step (n, ap, bp, s, M, tp);
+ if (!nn)
+ return success ? n : 0;
+ n = nn;
+ success = 1;
+ }
- /* NOTE: It appears this loop never runs more than once (at
- least when not recursing to hgcd_appr). */
- while (n > n2)
- {
- /* Needs n + 1 storage */
- nn = mpn_hgcd_step (n, ap, bp, s, M, tp);
- if (!nn)
- return success ? n : 0;
+ if (n > s + 2)
+ {
+ struct hgcd_matrix M1;
+ mp_size_t scratch;
- n = nn;
- success = 1;
- }
+ p = 2*s - n + 1;
+ scratch = MPN_HGCD_MATRIX_INIT_ITCH (n-p);
- if (n > s + 2)
+ mpn_hgcd_matrix_init(&M1, n - p, tp);
+ nn = mpn_hgcd (ap + p, bp + p, n - p, &M1, tp + scratch);
+ if (nn > 0)
{
- struct hgcd_matrix M1;
- mp_size_t scratch;
-
- p = 2*s - n + 1;
- scratch = MPN_HGCD_MATRIX_INIT_ITCH (n-p);
-
- mpn_hgcd_matrix_init(&M1, n - p, tp);
-
- /* FIXME: Should use hgcd_reduce, but that may require more
- scratch space, which requires review. */
-
- nn = mpn_hgcd (ap + p, bp + p, n - p, &M1, tp + scratch);
- if (nn > 0)
- {
- /* We always have max(M) > 2^{-(GMP_NUMB_BITS + 1)} max(M1) */
- ASSERT (M->n + 2 >= M1.n);
-
- /* Furthermore, assume M ends with a quotient (1, q; 0, 1),
- then either q or q + 1 is a correct quotient, and M1 will
- start with either (1, 0; 1, 1) or (2, 1; 1, 1). This
- rules out the case that the size of M * M1 is much
- smaller than the expected M->n + M1->n. */
-
- ASSERT (M->n + M1.n < M->alloc);
-
- /* Needs 2 (p + M->n) <= 2 (2*s - n2 + 1 + n2 - s - 1)
- = 2*s <= 2*(floor(n/2) + 1) <= n + 2. */
- n = mpn_hgcd_matrix_adjust (&M1, p + nn, ap, bp, p, tp + scratch);
-
- /* We need a bound for of M->n + M1.n. Let n be the original
- input size. Then
-
- ceil(n/2) - 1 >= size of product >= M.n + M1.n - 2
-
- and it follows that
-
- M.n + M1.n <= ceil(n/2) + 1
-
- Then 3*(M.n + M1.n) + 5 <= 3 * ceil(n/2) + 8 is the
- amount of needed scratch space. */
- mpn_hgcd_matrix_mul (M, &M1, tp + scratch);
- success = 1;
- }
+ /* We always have max(M) > 2^{-(GMP_NUMB_BITS + 1)} max(M1) */
+ ASSERT (M->n + 2 >= M1.n);
+
+ /* Furthermore, assume M ends with a quotient (1, q; 0, 1),
+ then either q or q + 1 is a correct quotient, and M1 will
+ start with either (1, 0; 1, 1) or (2, 1; 1, 1). This
+ rules out the case that the size of M * M1 is much
+ smaller than the expected M->n + M1->n. */
+
+ ASSERT (M->n + M1.n < M->alloc);
+
+ /* Needs 2 (p + M->n) <= 2 (2*s - n2 + 1 + n2 - s - 1)
+ = 2*s <= 2*(floor(n/2) + 1) <= n + 2. */
+ n = mpn_hgcd_matrix_adjust (&M1, p + nn, ap, bp, p, tp + scratch);
+ /* Needs 4 ceil(n/2) + 1 */
+ mpn_hgcd_matrix_mul (M, &M1, tp + scratch);
+ success = 1;
}
}
+ /* This really is the base case */
for (;;)
{
/* Needs s+3 < n */
- nn = mpn_hgcd_step (n, ap, bp, s, M, tp);
+ nn = hgcd_step (n, ap, bp, s, M, tp);
if (!nn)
return success ? n : 0;
diff --git a/gmp/mpn/generic/hgcd2.c b/gmp/mpn/generic/hgcd2.c
index 129637063f..ffc8c44f67 100644
--- a/gmp/mpn/generic/hgcd2.c
+++ b/gmp/mpn/generic/hgcd2.c
@@ -4,33 +4,23 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1996, 1998, 2000-2004, 2008, 2012 Free Software Foundation, Inc.
+Copyright 1996, 1998, 2000, 2001, 2002, 2003, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -209,7 +199,7 @@ div2 (mp_ptr rp,
/* Reduces a,b until |a-b| (almost) fits in one limb + 1 bit. Constructs
matrix M. Returns 1 if we make progress, i.e. can perform at least
- one subtraction. Otherwise returns zero. */
+ one subtraction. Otherwise returns zero.. */
/* FIXME: Possible optimizations:
@@ -348,6 +338,8 @@ mpn_hgcd2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
for (;;)
{
ASSERT (ah >= bh);
+ if (ah == bh)
+ break;
ah -= bh;
if (ah < (CNST_LIMB (1) << (GMP_LIMB_BITS / 2 + 1)))
@@ -377,6 +369,8 @@ mpn_hgcd2 (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
}
subtract_a1:
ASSERT (bh >= ah);
+ if (ah == bh)
+ break;
bh -= ah;
if (bh < (CNST_LIMB (1) << (GMP_LIMB_BITS / 2 + 1)))
@@ -445,3 +439,31 @@ mpn_hgcd_mul_matrix1_vector (const struct hgcd_matrix1 *M,
n += (ah | bh) > 0;
return n;
}
+
+/* Sets (r;b) = M^{-1}(a;b), with M^{-1} = (u11, -u01; -u10, u00) from
+ the left. Uses three buffers, to avoid a copy. */
+mp_size_t
+mpn_hgcd_mul_matrix1_inverse_vector (const struct hgcd_matrix1 *M,
+ mp_ptr rp, mp_srcptr ap, mp_ptr bp, mp_size_t n)
+{
+ mp_limb_t h0, h1;
+
+ /* Compute (r;b) <-- (u11 a - u01 b; -u10 a + u00 b) as
+
+ r = u11 * a
+ r -= u01 * b
+ b *= u00
+ b -= u10 * a
+ */
+
+ h0 = mpn_mul_1 (rp, ap, n, M->u[1][1]);
+ h1 = mpn_submul_1 (rp, bp, n, M->u[0][1]);
+ ASSERT (h0 == h1);
+
+ h0 = mpn_mul_1 (bp, bp, n, M->u[0][0]);
+ h1 = mpn_submul_1 (bp, ap, n, M->u[1][0]);
+ ASSERT (h0 == h1);
+
+ n -= (rp[n-1] | bp[n-1]) == 0;
+ return n;
+}
diff --git a/gmp/mpn/generic/hgcd2_jacobi.c b/gmp/mpn/generic/hgcd2_jacobi.c
deleted file mode 100644
index e59c32a341..0000000000
--- a/gmp/mpn/generic/hgcd2_jacobi.c
+++ /dev/null
@@ -1,366 +0,0 @@
-/* hgcd2_jacobi.c
-
- 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 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 Nails not supported.
-#endif
-
-/* FIXME: Duplicated in hgcd2.c. Should move to gmp-impl.h, and
- possibly be renamed. */
-static inline mp_limb_t
-div1 (mp_ptr rp,
- mp_limb_t n0,
- mp_limb_t d0)
-{
- mp_limb_t q = 0;
-
- if ((mp_limb_signed_t) n0 < 0)
- {
- int cnt;
- for (cnt = 1; (mp_limb_signed_t) d0 >= 0; cnt++)
- {
- d0 = d0 << 1;
- }
-
- q = 0;
- while (cnt)
- {
- q <<= 1;
- if (n0 >= d0)
- {
- n0 = n0 - d0;
- q |= 1;
- }
- d0 = d0 >> 1;
- cnt--;
- }
- }
- else
- {
- int cnt;
- for (cnt = 0; n0 >= d0; cnt++)
- {
- d0 = d0 << 1;
- }
-
- q = 0;
- while (cnt)
- {
- d0 = d0 >> 1;
- q <<= 1;
- if (n0 >= d0)
- {
- n0 = n0 - d0;
- q |= 1;
- }
- cnt--;
- }
- }
- *rp = n0;
- return q;
-}
-
-/* Two-limb division optimized for small quotients. */
-static inline mp_limb_t
-div2 (mp_ptr rp,
- mp_limb_t nh, mp_limb_t nl,
- mp_limb_t dh, mp_limb_t dl)
-{
- mp_limb_t q = 0;
-
- if ((mp_limb_signed_t) nh < 0)
- {
- int cnt;
- for (cnt = 1; (mp_limb_signed_t) dh >= 0; cnt++)
- {
- dh = (dh << 1) | (dl >> (GMP_LIMB_BITS - 1));
- dl = dl << 1;
- }
-
- while (cnt)
- {
- q <<= 1;
- if (nh > dh || (nh == dh && nl >= dl))
- {
- sub_ddmmss (nh, nl, nh, nl, dh, dl);
- q |= 1;
- }
- dl = (dh << (GMP_LIMB_BITS - 1)) | (dl >> 1);
- dh = dh >> 1;
- cnt--;
- }
- }
- else
- {
- int cnt;
- for (cnt = 0; nh > dh || (nh == dh && nl >= dl); cnt++)
- {
- dh = (dh << 1) | (dl >> (GMP_LIMB_BITS - 1));
- dl = dl << 1;
- }
-
- while (cnt)
- {
- dl = (dh << (GMP_LIMB_BITS - 1)) | (dl >> 1);
- dh = dh >> 1;
- q <<= 1;
- if (nh > dh || (nh == dh && nl >= dl))
- {
- sub_ddmmss (nh, nl, nh, nl, dh, dl);
- q |= 1;
- }
- cnt--;
- }
- }
-
- rp[0] = nl;
- rp[1] = nh;
-
- return q;
-}
-
-int
-mpn_hgcd2_jacobi (mp_limb_t ah, mp_limb_t al, mp_limb_t bh, mp_limb_t bl,
- struct hgcd_matrix1 *M, unsigned *bitsp)
-{
- mp_limb_t u00, u01, u10, u11;
- unsigned bits = *bitsp;
-
- if (ah < 2 || bh < 2)
- return 0;
-
- if (ah > bh || (ah == bh && al > bl))
- {
- sub_ddmmss (ah, al, ah, al, bh, bl);
- if (ah < 2)
- return 0;
-
- u00 = u01 = u11 = 1;
- u10 = 0;
- bits = mpn_jacobi_update (bits, 1, 1);
- }
- else
- {
- sub_ddmmss (bh, bl, bh, bl, ah, al);
- if (bh < 2)
- return 0;
-
- u00 = u10 = u11 = 1;
- u01 = 0;
- bits = mpn_jacobi_update (bits, 0, 1);
- }
-
- if (ah < bh)
- goto subtract_a;
-
- for (;;)
- {
- ASSERT (ah >= bh);
- if (ah == bh)
- goto done;
-
- if (ah < (CNST_LIMB(1) << (GMP_LIMB_BITS / 2)))
- {
- ah = (ah << (GMP_LIMB_BITS / 2) ) + (al >> (GMP_LIMB_BITS / 2));
- bh = (bh << (GMP_LIMB_BITS / 2) ) + (bl >> (GMP_LIMB_BITS / 2));
-
- break;
- }
-
- /* Subtract a -= q b, and multiply M from the right by (1 q ; 0
- 1), affecting the second column of M. */
- ASSERT (ah > bh);
- sub_ddmmss (ah, al, ah, al, bh, bl);
-
- if (ah < 2)
- goto done;
-
- if (ah <= bh)
- {
- /* Use q = 1 */
- u01 += u00;
- u11 += u10;
- bits = mpn_jacobi_update (bits, 1, 1);
- }
- else
- {
- mp_limb_t r[2];
- mp_limb_t q = div2 (r, ah, al, bh, bl);
- al = r[0]; ah = r[1];
- if (ah < 2)
- {
- /* A is too small, but q is correct. */
- u01 += q * u00;
- u11 += q * u10;
- bits = mpn_jacobi_update (bits, 1, q & 3);
- goto done;
- }
- q++;
- u01 += q * u00;
- u11 += q * u10;
- bits = mpn_jacobi_update (bits, 1, q & 3);
- }
- subtract_a:
- ASSERT (bh >= ah);
- if (ah == bh)
- goto done;
-
- if (bh < (CNST_LIMB(1) << (GMP_LIMB_BITS / 2)))
- {
- ah = (ah << (GMP_LIMB_BITS / 2) ) + (al >> (GMP_LIMB_BITS / 2));
- bh = (bh << (GMP_LIMB_BITS / 2) ) + (bl >> (GMP_LIMB_BITS / 2));
-
- goto subtract_a1;
- }
-
- /* Subtract b -= q a, and multiply M from the right by (1 0 ; q
- 1), affecting the first column of M. */
- sub_ddmmss (bh, bl, bh, bl, ah, al);
-
- if (bh < 2)
- goto done;
-
- if (bh <= ah)
- {
- /* Use q = 1 */
- u00 += u01;
- u10 += u11;
- bits = mpn_jacobi_update (bits, 0, 1);
- }
- else
- {
- mp_limb_t r[2];
- mp_limb_t q = div2 (r, bh, bl, ah, al);
- bl = r[0]; bh = r[1];
- if (bh < 2)
- {
- /* B is too small, but q is correct. */
- u00 += q * u01;
- u10 += q * u11;
- bits = mpn_jacobi_update (bits, 0, q & 3);
- goto done;
- }
- q++;
- u00 += q * u01;
- u10 += q * u11;
- bits = mpn_jacobi_update (bits, 0, q & 3);
- }
- }
-
- /* NOTE: Since we discard the least significant half limb, we don't
- get a truly maximal M (corresponding to |a - b| <
- 2^{GMP_LIMB_BITS +1}). */
- /* Single precision loop */
- for (;;)
- {
- ASSERT (ah >= bh);
- if (ah == bh)
- break;
-
- ah -= bh;
- if (ah < (CNST_LIMB (1) << (GMP_LIMB_BITS / 2 + 1)))
- break;
-
- if (ah <= bh)
- {
- /* Use q = 1 */
- u01 += u00;
- u11 += u10;
- bits = mpn_jacobi_update (bits, 1, 1);
- }
- else
- {
- mp_limb_t r;
- mp_limb_t q = div1 (&r, ah, bh);
- ah = r;
- if (ah < (CNST_LIMB(1) << (GMP_LIMB_BITS / 2 + 1)))
- {
- /* A is too small, but q is correct. */
- u01 += q * u00;
- u11 += q * u10;
- bits = mpn_jacobi_update (bits, 1, q & 3);
- break;
- }
- q++;
- u01 += q * u00;
- u11 += q * u10;
- bits = mpn_jacobi_update (bits, 1, q & 3);
- }
- subtract_a1:
- ASSERT (bh >= ah);
- if (ah == bh)
- break;
-
- bh -= ah;
- if (bh < (CNST_LIMB (1) << (GMP_LIMB_BITS / 2 + 1)))
- break;
-
- if (bh <= ah)
- {
- /* Use q = 1 */
- u00 += u01;
- u10 += u11;
- bits = mpn_jacobi_update (bits, 0, 1);
- }
- else
- {
- mp_limb_t r;
- mp_limb_t q = div1 (&r, bh, ah);
- bh = r;
- if (bh < (CNST_LIMB(1) << (GMP_LIMB_BITS / 2 + 1)))
- {
- /* B is too small, but q is correct. */
- u00 += q * u01;
- u10 += q * u11;
- bits = mpn_jacobi_update (bits, 0, q & 3);
- break;
- }
- q++;
- u00 += q * u01;
- u10 += q * u11;
- bits = mpn_jacobi_update (bits, 0, q & 3);
- }
- }
-
- done:
- M->u[0][0] = u00; M->u[0][1] = u01;
- M->u[1][0] = u10; M->u[1][1] = u11;
- *bitsp = bits;
-
- return 1;
-}
diff --git a/gmp/mpn/generic/hgcd_appr.c b/gmp/mpn/generic/hgcd_appr.c
deleted file mode 100644
index 660219372f..0000000000
--- a/gmp/mpn/generic/hgcd_appr.c
+++ /dev/null
@@ -1,268 +0,0 @@
-/* hgcd_appr.c.
-
- 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 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Identical to mpn_hgcd_itch. FIXME: Do we really need to add
- HGCD_THRESHOLD at the end? */
-mp_size_t
-mpn_hgcd_appr_itch (mp_size_t n)
-{
- if (BELOW_THRESHOLD (n, HGCD_APPR_THRESHOLD))
- return n;
- else
- {
- unsigned k;
- int count;
- mp_size_t nscaled;
-
- /* Get the recursion depth. */
- nscaled = (n - 1) / (HGCD_APPR_THRESHOLD - 1);
- count_leading_zeros (count, nscaled);
- k = GMP_LIMB_BITS - count;
-
- return 20 * ((n+3) / 4) + 22 * k + HGCD_THRESHOLD;
- }
-}
-
-/* Destroys inputs. */
-int
-mpn_hgcd_appr (mp_ptr ap, mp_ptr bp, mp_size_t n,
- struct hgcd_matrix *M, mp_ptr tp)
-{
- mp_size_t s;
- int success = 0;
-
- ASSERT (n > 0);
-
- ASSERT ((ap[n-1] | bp[n-1]) != 0);
-
- if (n <= 2)
- /* Implies s = n. A fairly uninteresting case but exercised by the
- random inputs of the testsuite. */
- return 0;
-
- ASSERT ((n+1)/2 - 1 < M->alloc);
-
- /* We aim for reduction of to GMP_NUMB_BITS * s bits. But each time
- we discard some of the least significant limbs, we must keep one
- additional bit to account for the truncation error. We maintain
- the GMP_NUMB_BITS * s - extra_bits as the current target size. */
-
- s = n/2 + 1;
- if (BELOW_THRESHOLD (n, HGCD_APPR_THRESHOLD))
- {
- unsigned extra_bits = 0;
-
- while (n > 2)
- {
- mp_size_t nn;
-
- ASSERT (n > s);
- ASSERT (n <= 2*s);
-
- nn = mpn_hgcd_step (n, ap, bp, s, M, tp);
- if (!nn)
- break;
-
- n = nn;
- success = 1;
-
- /* We can truncate and discard the lower p bits whenever nbits <=
- 2*sbits - p. To account for the truncation error, we must
- adjust
-
- sbits <-- sbits + 1 - p,
-
- rather than just sbits <-- sbits - p. This adjustment makes
- the produced matrix slightly smaller than it could be. */
-
- if (GMP_NUMB_BITS * (n + 1) + 2 * extra_bits <= 2*GMP_NUMB_BITS * s)
- {
- mp_size_t p = (GMP_NUMB_BITS * (2*s - n) - 2*extra_bits) / GMP_NUMB_BITS;
-
- if (extra_bits == 0)
- {
- /* We cross a limb boundary and bump s. We can't do that
- if the result is that it makes makes min(U, V)
- smaller than 2^{GMP_NUMB_BITS} s. */
- if (s + 1 == n
- || mpn_zero_p (ap + s + 1, n - s - 1)
- || mpn_zero_p (bp + s + 1, n - s - 1))
- continue;
-
- extra_bits = GMP_NUMB_BITS - 1;
- s++;
- }
- else
- {
- extra_bits--;
- }
-
- /* Drop the p least significant limbs */
- ap += p; bp += p; n -= p; s -= p;
- }
- }
-
- ASSERT (s > 0);
-
- 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_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);
- n += (ap[n] | bp[n]) > 0;
-
- ASSERT (success);
-
- while (n > 2)
- {
- mp_size_t nn;
-
- ASSERT (n > s);
- ASSERT (n <= 2*s);
-
- nn = mpn_hgcd_step (n, ap, bp, s, M, tp);
-
- if (!nn)
- return 1;
-
- n = nn;
- }
- }
-
- if (n == 2)
- {
- struct hgcd_matrix1 M1;
- ASSERT (s == 1);
-
- if (mpn_hgcd2 (ap[1], ap[0], bp[1], bp[0], &M1))
- {
- /* Multiply M <- M * M1 */
- mpn_hgcd_matrix_mul_1 (M, &M1, tp);
- success = 1;
- }
- }
- return success;
- }
- else
- {
- mp_size_t n2 = (3*n)/4 + 1;
- mp_size_t p = n/2;
- mp_size_t nn;
-
- nn = mpn_hgcd_reduce (M, ap, bp, n, p, tp);
- if (nn)
- {
- n = nn;
- /* FIXME: Discard some of the low limbs immediately? */
- success = 1;
- }
-
- while (n > n2)
- {
- mp_size_t nn;
-
- /* Needs n + 1 storage */
- nn = mpn_hgcd_step (n, ap, bp, s, M, tp);
- if (!nn)
- return success;
-
- n = nn;
- success = 1;
- }
- if (n > s + 2)
- {
- struct hgcd_matrix M1;
- mp_size_t scratch;
-
- p = 2*s - n + 1;
- scratch = MPN_HGCD_MATRIX_INIT_ITCH (n-p);
-
- mpn_hgcd_matrix_init(&M1, n - p, tp);
- if (mpn_hgcd_appr (ap + p, bp + p, n - p, &M1, tp + scratch))
- {
- /* We always have max(M) > 2^{-(GMP_NUMB_BITS + 1)} max(M1) */
- ASSERT (M->n + 2 >= M1.n);
-
- /* Furthermore, assume M ends with a quotient (1, q; 0, 1),
- then either q or q + 1 is a correct quotient, and M1 will
- start with either (1, 0; 1, 1) or (2, 1; 1, 1). This
- rules out the case that the size of M * M1 is much
- smaller than the expected M->n + M1->n. */
-
- ASSERT (M->n + M1.n < M->alloc);
-
- /* We need a bound for of M->n + M1.n. Let n be the original
- input size. Then
-
- ceil(n/2) - 1 >= size of product >= M.n + M1.n - 2
-
- and it follows that
-
- M.n + M1.n <= ceil(n/2) + 1
-
- Then 3*(M.n + M1.n) + 5 <= 3 * ceil(n/2) + 8 is the
- amount of needed scratch space. */
- mpn_hgcd_matrix_mul (M, &M1, tp + scratch);
- return 1;
- }
- }
-
- for(;;)
- {
- mp_size_t nn;
-
- ASSERT (n > s);
- ASSERT (n <= 2*s);
-
- nn = mpn_hgcd_step (n, ap, bp, s, M, tp);
-
- if (!nn)
- return success;
-
- n = nn;
- success = 1;
- }
- }
-}
diff --git a/gmp/mpn/generic/hgcd_jacobi.c b/gmp/mpn/generic/hgcd_jacobi.c
deleted file mode 100644
index 0a49e5b3a7..0000000000
--- a/gmp/mpn/generic/hgcd_jacobi.c
+++ /dev/null
@@ -1,244 +0,0 @@
-/* hgcd_jacobi.c.
-
- 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-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 file is almost a copy of hgcd.c, with some added calls to
- mpn_jacobi_update */
-
-struct hgcd_jacobi_ctx
-{
- struct hgcd_matrix *M;
- unsigned *bitsp;
-};
-
-static void
-hgcd_jacobi_hook (void *p, mp_srcptr gp, mp_size_t gn,
- mp_srcptr qp, mp_size_t qn, int d)
-{
- ASSERT (!gp);
- ASSERT (d >= 0);
-
- MPN_NORMALIZE (qp, qn);
- if (qn > 0)
- {
- struct hgcd_jacobi_ctx *ctx = (struct hgcd_jacobi_ctx *) p;
- /* NOTES: This is a bit ugly. A tp area is passed to
- gcd_subdiv_step, which stores q at the start of that area. We
- now use the rest. */
- mp_ptr tp = (mp_ptr) qp + qn;
-
- mpn_hgcd_matrix_update_q (ctx->M, qp, qn, d, tp);
- *ctx->bitsp = mpn_jacobi_update (*ctx->bitsp, d, qp[0] & 3);
- }
-}
-
-/* Perform a few steps, using some of mpn_hgcd2, subtraction and
- division. Reduces the size by almost one limb or more, but never
- below the given size s. Return new size for a and b, or 0 if no
- more steps are possible.
-
- 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) <=
- resulting size of M.
-
- If N is the input size to the calling hgcd, then s = floor(N/2) +
- 1, M->n < N, qn + matrix size <= n - s + 1 + n - s = 2 (n - s) + 1
- < N, so N is sufficient.
-*/
-
-static mp_size_t
-hgcd_jacobi_step (mp_size_t n, mp_ptr ap, mp_ptr bp, mp_size_t s,
- struct hgcd_matrix *M, unsigned *bitsp, mp_ptr tp)
-{
- struct hgcd_matrix1 M1;
- mp_limb_t mask;
- mp_limb_t ah, al, bh, bl;
-
- ASSERT (n > s);
-
- mask = ap[n-1] | bp[n-1];
- ASSERT (mask > 0);
-
- if (n == s + 1)
- {
- if (mask < 4)
- goto subtract;
-
- ah = ap[n-1]; al = ap[n-2];
- bh = bp[n-1]; bl = bp[n-2];
- }
- else if (mask & GMP_NUMB_HIGHBIT)
- {
- ah = ap[n-1]; al = ap[n-2];
- bh = bp[n-1]; bl = bp[n-2];
- }
- else
- {
- int shift;
-
- count_leading_zeros (shift, mask);
- ah = MPN_EXTRACT_NUMB (shift, ap[n-1], ap[n-2]);
- al = MPN_EXTRACT_NUMB (shift, ap[n-2], ap[n-3]);
- bh = MPN_EXTRACT_NUMB (shift, bp[n-1], bp[n-2]);
- bl = MPN_EXTRACT_NUMB (shift, bp[n-2], bp[n-3]);
- }
-
- /* Try an mpn_hgcd2 step */
- if (mpn_hgcd2_jacobi (ah, al, bh, bl, &M1, bitsp))
- {
- /* Multiply M <- M * M1 */
- mpn_hgcd_matrix_mul_1 (M, &M1, tp);
-
- /* Can't swap inputs, so we need to copy. */
- MPN_COPY (tp, ap, n);
- /* Multiply M1^{-1} (a;b) */
- return mpn_matrix22_mul1_inverse_vector (&M1, ap, tp, bp, n);
- }
-
- subtract:
- {
- struct hgcd_jacobi_ctx ctx;
- ctx.M = M;
- ctx.bitsp = bitsp;
-
- return mpn_gcd_subdiv_step (ap, bp, n, s, hgcd_jacobi_hook, &ctx, tp);
- }
-}
-
-/* Reduces a,b until |a-b| fits in n/2 + 1 limbs. Constructs matrix M
- with elements of size at most (n+1)/2 - 1. Returns new size of a,
- b, or zero if no reduction is possible. */
-
-/* Same scratch requirements as for mpn_hgcd. */
-mp_size_t
-mpn_hgcd_jacobi (mp_ptr ap, mp_ptr bp, mp_size_t n,
- struct hgcd_matrix *M, unsigned *bitsp, mp_ptr tp)
-{
- mp_size_t s = n/2 + 1;
-
- mp_size_t nn;
- int success = 0;
-
- if (n <= s)
- /* Happens when n <= 2, a fairly uninteresting case but exercised
- by the random inputs of the testsuite. */
- return 0;
-
- ASSERT ((ap[n-1] | bp[n-1]) > 0);
-
- ASSERT ((n+1)/2 - 1 < M->alloc);
-
- if (ABOVE_THRESHOLD (n, HGCD_THRESHOLD))
- {
- mp_size_t n2 = (3*n)/4 + 1;
- mp_size_t p = n/2;
-
- nn = mpn_hgcd_jacobi (ap + p, bp + p, n - p, M, bitsp, tp);
- if (nn > 0)
- {
- /* Needs 2*(p + M->n) <= 2*(floor(n/2) + ceil(n/2) - 1)
- = 2 (n - 1) */
- n = mpn_hgcd_matrix_adjust (M, p + nn, ap, bp, p, tp);
- success = 1;
- }
- while (n > n2)
- {
- /* Needs n + 1 storage */
- nn = hgcd_jacobi_step (n, ap, bp, s, M, bitsp, tp);
- if (!nn)
- return success ? n : 0;
- n = nn;
- success = 1;
- }
-
- if (n > s + 2)
- {
- struct hgcd_matrix M1;
- mp_size_t scratch;
-
- p = 2*s - n + 1;
- scratch = MPN_HGCD_MATRIX_INIT_ITCH (n-p);
-
- mpn_hgcd_matrix_init(&M1, n - p, tp);
- nn = mpn_hgcd_jacobi (ap + p, bp + p, n - p, &M1, bitsp, tp + scratch);
- if (nn > 0)
- {
- /* We always have max(M) > 2^{-(GMP_NUMB_BITS + 1)} max(M1) */
- ASSERT (M->n + 2 >= M1.n);
-
- /* Furthermore, assume M ends with a quotient (1, q; 0, 1),
- then either q or q + 1 is a correct quotient, and M1 will
- start with either (1, 0; 1, 1) or (2, 1; 1, 1). This
- rules out the case that the size of M * M1 is much
- smaller than the expected M->n + M1->n. */
-
- ASSERT (M->n + M1.n < M->alloc);
-
- /* Needs 2 (p + M->n) <= 2 (2*s - n2 + 1 + n2 - s - 1)
- = 2*s <= 2*(floor(n/2) + 1) <= n + 2. */
- n = mpn_hgcd_matrix_adjust (&M1, p + nn, ap, bp, p, tp + scratch);
-
- /* We need a bound for of M->n + M1.n. Let n be the original
- input size. Then
-
- ceil(n/2) - 1 >= size of product >= M.n + M1.n - 2
-
- and it follows that
-
- M.n + M1.n <= ceil(n/2) + 1
-
- Then 3*(M.n + M1.n) + 5 <= 3 * ceil(n/2) + 8 is the
- amount of needed scratch space. */
- mpn_hgcd_matrix_mul (M, &M1, tp + scratch);
- success = 1;
- }
- }
- }
-
- for (;;)
- {
- /* Needs s+3 < n */
- nn = hgcd_jacobi_step (n, ap, bp, s, M, bitsp, tp);
- if (!nn)
- return success ? n : 0;
-
- n = nn;
- success = 1;
- }
-}
diff --git a/gmp/mpn/generic/hgcd_matrix.c b/gmp/mpn/generic/hgcd_matrix.c
deleted file mode 100644
index d9db331603..0000000000
--- a/gmp/mpn/generic/hgcd_matrix.c
+++ /dev/null
@@ -1,266 +0,0 @@
-/* hgcd_matrix.c.
-
- 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-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* For input of size n, matrix elements are of size at most ceil(n/2)
- - 1, but we need two limbs extra. */
-void
-mpn_hgcd_matrix_init (struct hgcd_matrix *M, mp_size_t n, mp_ptr p)
-{
- mp_size_t s = (n+1)/2 + 1;
- M->alloc = s;
- M->n = 1;
- MPN_ZERO (p, 4 * s);
- M->p[0][0] = p;
- M->p[0][1] = p + s;
- M->p[1][0] = p + 2 * s;
- M->p[1][1] = p + 3 * s;
-
- M->p[0][0][0] = M->p[1][1][0] = 1;
-}
-
-/* Update column COL, adding in Q * column (1-COL). Temporary storage:
- * qn + n <= M->alloc, where n is the size of the largest element in
- * column 1 - COL. */
-void
-mpn_hgcd_matrix_update_q (struct hgcd_matrix *M, mp_srcptr qp, mp_size_t qn,
- unsigned col, mp_ptr tp)
-{
- ASSERT (col < 2);
-
- if (qn == 1)
- {
- mp_limb_t q = qp[0];
- mp_limb_t c0, c1;
-
- c0 = mpn_addmul_1 (M->p[0][col], M->p[0][1-col], M->n, q);
- c1 = mpn_addmul_1 (M->p[1][col], M->p[1][1-col], M->n, q);
-
- M->p[0][col][M->n] = c0;
- M->p[1][col][M->n] = c1;
-
- M->n += (c0 | c1) != 0;
- }
- else
- {
- unsigned row;
-
- /* Carries for the unlikely case that we get both high words
- from the multiplication and carries from the addition. */
- mp_limb_t c[2];
- mp_size_t n;
-
- /* The matrix will not necessarily grow in size by qn, so we
- need normalization in order not to overflow M. */
-
- for (n = M->n; n + qn > M->n; n--)
- {
- ASSERT (n > 0);
- if (M->p[0][1-col][n-1] > 0 || M->p[1][1-col][n-1] > 0)
- break;
- }
-
- ASSERT (qn + n <= M->alloc);
-
- for (row = 0; row < 2; row++)
- {
- if (qn <= n)
- mpn_mul (tp, M->p[row][1-col], n, qp, qn);
- else
- mpn_mul (tp, qp, qn, M->p[row][1-col], n);
-
- ASSERT (n + qn >= M->n);
- c[row] = mpn_add (M->p[row][col], tp, n + qn, M->p[row][col], M->n);
- }
-
- n += qn;
-
- if (c[0] | c[1])
- {
- M->p[0][col][n] = c[0];
- M->p[1][col][n] = c[1];
- n++;
- }
- else
- {
- n -= (M->p[0][col][n-1] | M->p[1][col][n-1]) == 0;
- ASSERT (n >= M->n);
- }
- M->n = n;
- }
-
- ASSERT (M->n < M->alloc);
-}
-
-/* Multiply M by M1 from the right. Since the M1 elements fit in
- GMP_NUMB_BITS - 1 bits, M grows by at most one limb. Needs
- temporary space M->n */
-void
-mpn_hgcd_matrix_mul_1 (struct hgcd_matrix *M, const struct hgcd_matrix1 *M1,
- mp_ptr tp)
-{
- mp_size_t n0, n1;
-
- /* Could avoid copy by some swapping of pointers. */
- MPN_COPY (tp, M->p[0][0], M->n);
- n0 = mpn_hgcd_mul_matrix1_vector (M1, M->p[0][0], tp, M->p[0][1], M->n);
- MPN_COPY (tp, M->p[1][0], M->n);
- n1 = mpn_hgcd_mul_matrix1_vector (M1, M->p[1][0], tp, M->p[1][1], M->n);
-
- /* Depends on zero initialization */
- M->n = MAX(n0, n1);
- ASSERT (M->n < M->alloc);
-}
-
-/* Multiply M by M1 from the right. Needs 3*(M->n + M1->n) + 5 limbs
- of temporary storage (see mpn_matrix22_mul_itch). */
-void
-mpn_hgcd_matrix_mul (struct hgcd_matrix *M, const struct hgcd_matrix *M1,
- mp_ptr tp)
-{
- mp_size_t n;
-
- /* About the new size of M:s elements. Since M1's diagonal elements
- are > 0, no element can decrease. The new elements are of size
- M->n + M1->n, one limb more or less. The computation of the
- matrix product produces elements of size M->n + M1->n + 1. But
- the true size, after normalization, may be three limbs smaller.
-
- The reason that the product has normalized size >= M->n + M1->n -
- 2 is subtle. It depends on the fact that M and M1 can be factored
- as products of (1,1; 0,1) and (1,0; 1,1), and that we can't have
- M ending with a large power and M1 starting with a large power of
- the same matrix. */
-
- /* FIXME: Strassen multiplication gives only a small speedup. In FFT
- multiplication range, this function could be sped up quite a lot
- using invariance. */
- ASSERT (M->n + M1->n < M->alloc);
-
- ASSERT ((M->p[0][0][M->n-1] | M->p[0][1][M->n-1]
- | M->p[1][0][M->n-1] | M->p[1][1][M->n-1]) > 0);
-
- ASSERT ((M1->p[0][0][M1->n-1] | M1->p[0][1][M1->n-1]
- | M1->p[1][0][M1->n-1] | M1->p[1][1][M1->n-1]) > 0);
-
- mpn_matrix22_mul (M->p[0][0], M->p[0][1],
- M->p[1][0], M->p[1][1], M->n,
- M1->p[0][0], M1->p[0][1],
- M1->p[1][0], M1->p[1][1], M1->n, tp);
-
- /* Index of last potentially non-zero limb, size is one greater. */
- n = M->n + M1->n;
-
- n -= ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) == 0);
- n -= ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) == 0);
- n -= ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) == 0);
-
- ASSERT ((M->p[0][0][n] | M->p[0][1][n] | M->p[1][0][n] | M->p[1][1][n]) > 0);
-
- M->n = n + 1;
-}
-
-/* Multiplies the least significant p limbs of (a;b) by M^-1.
- Temporary space needed: 2 * (p + M->n)*/
-mp_size_t
-mpn_hgcd_matrix_adjust (const struct hgcd_matrix *M,
- mp_size_t n, mp_ptr ap, mp_ptr bp,
- mp_size_t p, mp_ptr tp)
-{
- /* M^-1 (a;b) = (r11, -r01; -r10, r00) (a ; b)
- = (r11 a - r01 b; - r10 a + r00 b */
-
- mp_ptr t0 = tp;
- mp_ptr t1 = tp + p + M->n;
- mp_limb_t ah, bh;
- mp_limb_t cy;
-
- ASSERT (p + M->n < n);
-
- /* First compute the two values depending on a, before overwriting a */
-
- if (M->n >= p)
- {
- mpn_mul (t0, M->p[1][1], M->n, ap, p);
- mpn_mul (t1, M->p[1][0], M->n, ap, p);
- }
- else
- {
- mpn_mul (t0, ap, p, M->p[1][1], M->n);
- mpn_mul (t1, ap, p, M->p[1][0], M->n);
- }
-
- /* Update a */
- MPN_COPY (ap, t0, p);
- ah = mpn_add (ap + p, ap + p, n - p, t0 + p, M->n);
-
- if (M->n >= p)
- mpn_mul (t0, M->p[0][1], M->n, bp, p);
- else
- mpn_mul (t0, bp, p, M->p[0][1], M->n);
-
- cy = mpn_sub (ap, ap, n, t0, p + M->n);
- ASSERT (cy <= ah);
- ah -= cy;
-
- /* Update b */
- if (M->n >= p)
- mpn_mul (t0, M->p[0][0], M->n, bp, p);
- else
- mpn_mul (t0, bp, p, M->p[0][0], M->n);
-
- MPN_COPY (bp, t0, p);
- bh = mpn_add (bp + p, bp + p, n - p, t0 + p, M->n);
- cy = mpn_sub (bp, bp, n, t1, p + M->n);
- ASSERT (cy <= bh);
- bh -= cy;
-
- if (ah > 0 || bh > 0)
- {
- ap[n] = ah;
- bp[n] = bh;
- n++;
- }
- else
- {
- /* The subtraction can reduce the size by at most one limb. */
- if (ap[n-1] == 0 && bp[n-1] == 0)
- n--;
- }
- ASSERT (ap[n-1] > 0 || bp[n-1] > 0);
- return n;
-}
diff --git a/gmp/mpn/generic/hgcd_reduce.c b/gmp/mpn/generic/hgcd_reduce.c
deleted file mode 100644
index 6f3d61ecea..0000000000
--- a/gmp/mpn/generic/hgcd_reduce.c
+++ /dev/null
@@ -1,247 +0,0 @@
-/* hgcd_reduce.c.
-
- 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 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Computes R -= A * B. Result must be non-negative. Normalized down
- to size an, and resulting size is returned. */
-static mp_size_t
-submul (mp_ptr rp, mp_size_t rn,
- mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
-{
- mp_ptr tp;
- TMP_DECL;
-
- ASSERT (bn > 0);
- ASSERT (an >= bn);
- ASSERT (rn >= an);
- ASSERT (an + bn <= rn + 1);
-
- TMP_MARK;
- tp = TMP_ALLOC_LIMBS (an + bn);
-
- mpn_mul (tp, ap, an, bp, bn);
- if (an + bn > rn)
- {
- ASSERT (tp[rn] == 0);
- bn--;
- }
- ASSERT_NOCARRY (mpn_sub (rp, rp, rn, tp, an + bn));
- TMP_FREE;
-
- while (rn > an && (rp[rn-1] == 0))
- rn--;
-
- return rn;
-}
-
-/* Computes (a, b) <-- M^{-1} (a; b) */
-/* FIXME:
- x Take scratch parameter, and figure out scratch need.
-
- x Use some fallback for small M->n?
-*/
-static mp_size_t
-hgcd_matrix_apply (const struct hgcd_matrix *M,
- mp_ptr ap, mp_ptr bp,
- mp_size_t n)
-{
- mp_size_t an, bn, un, vn, nn;
- mp_size_t mn[2][2];
- mp_size_t modn;
- mp_ptr tp, sp, scratch;
- mp_limb_t cy;
- unsigned i, j;
-
- TMP_DECL;
-
- ASSERT ( (ap[n-1] | bp[n-1]) > 0);
-
- an = n;
- MPN_NORMALIZE (ap, an);
- bn = n;
- MPN_NORMALIZE (bp, bn);
-
- for (i = 0; i < 2; i++)
- for (j = 0; j < 2; j++)
- {
- mp_size_t k;
- k = M->n;
- MPN_NORMALIZE (M->p[i][j], k);
- mn[i][j] = k;
- }
-
- ASSERT (mn[0][0] > 0);
- ASSERT (mn[1][1] > 0);
- ASSERT ( (mn[0][1] | mn[1][0]) > 0);
-
- TMP_MARK;
-
- if (mn[0][1] == 0)
- {
- /* A unchanged, M = (1, 0; q, 1) */
- ASSERT (mn[0][0] == 1);
- ASSERT (M->p[0][0][0] == 1);
- ASSERT (mn[1][1] == 1);
- ASSERT (M->p[1][1][0] == 1);
-
- /* Put B <-- B - q A */
- nn = submul (bp, bn, ap, an, M->p[1][0], mn[1][0]);
- }
- else if (mn[1][0] == 0)
- {
- /* B unchanged, M = (1, q; 0, 1) */
- ASSERT (mn[0][0] == 1);
- ASSERT (M->p[0][0][0] == 1);
- ASSERT (mn[1][1] == 1);
- ASSERT (M->p[1][1][0] == 1);
-
- /* Put A <-- A - q * B */
- nn = submul (ap, an, bp, bn, M->p[0][1], mn[0][1]);
- }
- else
- {
- /* A = m00 a + m01 b ==> a <= A / m00, b <= A / m01.
- B = m10 a + m11 b ==> a <= B / m10, b <= B / m11. */
- un = MIN (an - mn[0][0], bn - mn[1][0]) + 1;
- vn = MIN (an - mn[0][1], bn - mn[1][1]) + 1;
-
- nn = MAX (un, vn);
- /* In the range of interest, mulmod_bnm1 should always beat mullo. */
- modn = mpn_mulmod_bnm1_next_size (nn + 1);
-
- scratch = TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (modn, modn, M->n));
- tp = TMP_ALLOC_LIMBS (modn);
- sp = TMP_ALLOC_LIMBS (modn);
-
- ASSERT (n <= 2*modn);
-
- if (n > modn)
- {
- cy = mpn_add (ap, ap, modn, ap + modn, n - modn);
- MPN_INCR_U (ap, modn, cy);
-
- cy = mpn_add (bp, bp, modn, bp + modn, n - modn);
- MPN_INCR_U (bp, modn, cy);
-
- n = modn;
- }
-
- mpn_mulmod_bnm1 (tp, modn, ap, n, M->p[1][1], mn[1][1], scratch);
- mpn_mulmod_bnm1 (sp, modn, bp, n, M->p[0][1], mn[0][1], scratch);
-
- /* FIXME: Handle the small n case in some better way. */
- if (n + mn[1][1] < modn)
- MPN_ZERO (tp + n + mn[1][1], modn - n - mn[1][1]);
- if (n + mn[0][1] < modn)
- MPN_ZERO (sp + n + mn[0][1], modn - n - mn[0][1]);
-
- cy = mpn_sub_n (tp, tp, sp, modn);
- MPN_DECR_U (tp, modn, cy);
-
- ASSERT (mpn_zero_p (tp + nn, modn - nn));
-
- mpn_mulmod_bnm1 (sp, modn, ap, n, M->p[1][0], mn[1][0], scratch);
- MPN_COPY (ap, tp, nn);
- mpn_mulmod_bnm1 (tp, modn, bp, n, M->p[0][0], mn[0][0], scratch);
-
- if (n + mn[1][0] < modn)
- MPN_ZERO (sp + n + mn[1][0], modn - n - mn[1][0]);
- if (n + mn[0][0] < modn)
- MPN_ZERO (tp + n + mn[0][0], modn - n - mn[0][0]);
-
- cy = mpn_sub_n (tp, tp, sp, modn);
- MPN_DECR_U (tp, modn, cy);
-
- ASSERT (mpn_zero_p (tp + nn, modn - nn));
- MPN_COPY (bp, tp, nn);
-
- while ( (ap[nn-1] | bp[nn-1]) == 0)
- {
- nn--;
- ASSERT (nn > 0);
- }
- }
- TMP_FREE;
-
- return nn;
-}
-
-mp_size_t
-mpn_hgcd_reduce_itch (mp_size_t n, mp_size_t p)
-{
- mp_size_t itch;
- if (BELOW_THRESHOLD (n, HGCD_REDUCE_THRESHOLD))
- {
- itch = mpn_hgcd_itch (n-p);
-
- /* For arbitrary p, the storage for _adjust is 2*(p + M->n) = 2 *
- (p + ceil((n-p)/2) - 1 <= n + p - 1 */
- if (itch < n + p - 1)
- itch = n + p - 1;
- }
- else
- {
- itch = 2*(n-p) + mpn_hgcd_itch (n-p);
- /* Currently, hgcd_matrix_apply allocates its own storage. */
- }
- return itch;
-}
-
-/* FIXME: Document storage need. */
-mp_size_t
-mpn_hgcd_reduce (struct hgcd_matrix *M,
- mp_ptr ap, mp_ptr bp, mp_size_t n, mp_size_t p,
- mp_ptr tp)
-{
- mp_size_t nn;
- if (BELOW_THRESHOLD (n, HGCD_REDUCE_THRESHOLD))
- {
- nn = mpn_hgcd (ap + p, bp + p, n - p, M, tp);
- if (nn > 0)
- /* Needs 2*(p + M->n) <= 2*(floor(n/2) + ceil(n/2) - 1)
- = 2 (n - 1) */
- return mpn_hgcd_matrix_adjust (M, p + nn, ap, bp, p, tp);
- }
- else
- {
- MPN_COPY (tp, ap + p, n - p);
- MPN_COPY (tp + n - p, bp + p, n - p);
- if (mpn_hgcd_appr (tp, tp + n - p, n - p, M, tp + 2*(n-p)))
- return hgcd_matrix_apply (M, ap, bp, n);
- }
- return 0;
-}
diff --git a/gmp/mpn/generic/hgcd_step.c b/gmp/mpn/generic/hgcd_step.c
deleted file mode 100644
index e58894ff3b..0000000000
--- a/gmp/mpn/generic/hgcd_step.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* hgcd_step.c.
-
- 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-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-static void
-hgcd_hook (void *p, mp_srcptr gp, mp_size_t gn,
- mp_srcptr qp, mp_size_t qn, int d)
-{
- ASSERT (!gp);
- ASSERT (d >= 0);
- ASSERT (d <= 1);
-
- MPN_NORMALIZE (qp, qn);
- if (qn > 0)
- {
- struct hgcd_matrix *M = (struct hgcd_matrix *) p;
- /* NOTES: This is a bit ugly. A tp area is passed to
- gcd_subdiv_step, which stores q at the start of that area. We
- now use the rest. */
- mp_ptr tp = (mp_ptr) qp + qn;
- mpn_hgcd_matrix_update_q (M, qp, qn, d, tp);
- }
-}
-
-/* Perform a few steps, using some of mpn_hgcd2, subtraction and
- division. Reduces the size by almost one limb or more, but never
- below the given size s. Return new size for a and b, or 0 if no
- more steps are possible.
-
- 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) <=
- (resulting size of M) + 1.
-
- If N is the input size to the calling hgcd, then s = floor(N/2) +
- 1, M->n < N, qn + product size <= n - s + n - s + 1 = 2 (n - s) + 1
- <= N.
-*/
-
-mp_size_t
-mpn_hgcd_step (mp_size_t n, mp_ptr ap, mp_ptr bp, mp_size_t s,
- struct hgcd_matrix *M, mp_ptr tp)
-{
- struct hgcd_matrix1 M1;
- mp_limb_t mask;
- mp_limb_t ah, al, bh, bl;
-
- ASSERT (n > s);
-
- mask = ap[n-1] | bp[n-1];
- ASSERT (mask > 0);
-
- if (n == s + 1)
- {
- if (mask < 4)
- goto subtract;
-
- ah = ap[n-1]; al = ap[n-2];
- bh = bp[n-1]; bl = bp[n-2];
- }
- else if (mask & GMP_NUMB_HIGHBIT)
- {
- ah = ap[n-1]; al = ap[n-2];
- bh = bp[n-1]; bl = bp[n-2];
- }
- else
- {
- int shift;
-
- count_leading_zeros (shift, mask);
- ah = MPN_EXTRACT_NUMB (shift, ap[n-1], ap[n-2]);
- al = MPN_EXTRACT_NUMB (shift, ap[n-2], ap[n-3]);
- bh = MPN_EXTRACT_NUMB (shift, bp[n-1], bp[n-2]);
- bl = MPN_EXTRACT_NUMB (shift, bp[n-2], bp[n-3]);
- }
-
- /* Try an mpn_hgcd2 step */
- if (mpn_hgcd2 (ah, al, bh, bl, &M1))
- {
- /* Multiply M <- M * M1 */
- mpn_hgcd_matrix_mul_1 (M, &M1, tp);
-
- /* Can't swap inputs, so we need to copy. */
- MPN_COPY (tp, ap, n);
- /* Multiply M1^{-1} (a;b) */
- return mpn_matrix22_mul1_inverse_vector (&M1, ap, tp, bp, n);
- }
-
- subtract:
-
- return mpn_gcd_subdiv_step (ap, bp, n, s, hgcd_hook, M, tp);
-}
diff --git a/gmp/mpn/generic/invert.c b/gmp/mpn/generic/invert.c
index 4bc459d728..e40d3611e6 100644
--- a/gmp/mpn/generic/invert.c
+++ b/gmp/mpn/generic/invert.c
@@ -1,91 +1,60 @@
-/* invert.c -- Compute floor((B^{2n}-1)/U) - B^n.
+/* Compute {up,n}^(-1).
- Contributed to the GNU project by 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 GMP RELEASE.
-
-Copyright (C) 2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright (C) 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdlib.h>
#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
+
+/* Formulas:
+ z = 2z-(zz)d
+ z = 2z-(zd)z
+ z = z(2-zd)
+ z = z-z*(zd-1)
+ z = z+z*(1-zd)
+*/
+
+mp_size_t
+mpn_invert_itch (mp_size_t n)
+{
+ return 3 * n + 2;
+}
void
mpn_invert (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
{
- ASSERT (n > 0);
- ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT);
- ASSERT (! MPN_OVERLAP_P (ip, n, dp, n));
- ASSERT (! MPN_OVERLAP_P (ip, n, scratch, mpn_invertappr_itch(n)));
- ASSERT (! MPN_OVERLAP_P (dp, n, scratch, mpn_invertappr_itch(n)));
-
- if (n == 1)
- invert_limb (*ip, *dp);
- else {
- TMP_DECL;
-
- TMP_MARK;
- if (BELOW_THRESHOLD (n, INV_APPR_THRESHOLD))
- {
- /* Maximum scratch needed by this branch: 2*n */
- mp_size_t i;
- mp_ptr xp;
-
- xp = scratch; /* 2 * n limbs */
- for (i = n - 1; i >= 0; i--)
- xp[i] = GMP_NUMB_MAX;
- mpn_com (xp + n, dp, n);
- if (n == 2) {
- mpn_divrem_2 (ip, 0, xp, 4, dp);
- } else {
- gmp_pi1_t inv;
- invert_pi1 (inv, dp[n-1], dp[n-2]);
- /* FIXME: should we use dcpi1_div_q, for big sizes? */
- mpn_sbpi1_div_q (ip, xp, 2 * n, dp, n, inv.inv32);
- }
- }
- else { /* Use approximated inverse; correct the result if needed. */
- mp_limb_t e; /* The possible error in the approximate inverse */
+ mp_ptr np, rp;
+ mp_size_t i;
+ TMP_DECL;
+
+ TMP_MARK;
+ if (scratch == NULL)
+ {
+ scratch = TMP_ALLOC_LIMBS (mpn_invert_itch (n));
+ }
- ASSERT ( mpn_invert_itch (n) >= mpn_invertappr_itch (n) );
- e = mpn_ni_invertappr (ip, dp, n, scratch);
+ np = scratch; /* 2 * n limbs */
+ rp = scratch + 2 * n; /* n + 2 limbs */
+ for (i = n - 1; i >= 0; i--)
+ np[i] = ~CNST_LIMB(0);
+ mpn_com_n (np + n, dp, n);
+ mpn_tdiv_qr (rp, ip, 0L, np, 2 * n, dp, n);
+ MPN_COPY (ip, rp, n);
- if (UNLIKELY (e)) { /* Assume the error can only be "0" (no error) or "1". */
- /* Code to detect and correct the "off by one" approximation. */
- mpn_mul_n (scratch, ip, dp, n);
- ASSERT_NOCARRY (mpn_add_n (scratch + n, scratch + n, dp, n));
- if (! mpn_add (scratch, scratch, 2*n, dp, n))
- MPN_INCR_U (ip, n, 1); /* The value was wrong, correct it. */
- }
- }
- TMP_FREE;
- }
+ TMP_FREE;
}
diff --git a/gmp/mpn/generic/invertappr.c b/gmp/mpn/generic/invertappr.c
deleted file mode 100644
index 12326b8b75..0000000000
--- a/gmp/mpn/generic/invertappr.c
+++ /dev/null
@@ -1,314 +0,0 @@
-/* mpn_invertappr and helper functions. Compute I such that
- floor((B^{2n}-1)/U - 1 <= I + B^n <= floor((B^{2n}-1)/U.
-
- Contributed to the GNU project by Marco Bodrato.
-
- The algorithm used here was inspired by ApproximateReciprocal from "Modern
- Computer Arithmetic", by Richard P. Brent and Paul Zimmermann. Special
- thanks to Paul Zimmermann for his very valuable suggestions on all the
- theoretical aspects during the work on this code.
-
- 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 (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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/* FIXME: Remove NULL and TMP_*, as soon as all the callers properly
- allocate and pass the scratch to the function. */
-#include <stdlib.h> /* for NULL */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-
-/* 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. */
-
-#if TUNE_PROGRAM_BUILD
-#define NPOWS \
- ((sizeof(mp_size_t) > 6 ? 48 : 8*sizeof(mp_size_t)))
-#define MAYBE_dcpi1_divappr 1
-#else
-#define NPOWS \
- ((sizeof(mp_size_t) > 6 ? 48 : 8*sizeof(mp_size_t)) - LOG2C (INV_NEWTON_THRESHOLD))
-#define MAYBE_dcpi1_divappr \
- (INV_NEWTON_THRESHOLD < DC_DIVAPPR_Q_THRESHOLD)
-#if (INV_NEWTON_THRESHOLD > INV_MULMOD_BNM1_THRESHOLD) && \
- (INV_APPR_THRESHOLD > INV_MULMOD_BNM1_THRESHOLD)
-#undef INV_MULMOD_BNM1_THRESHOLD
-#define INV_MULMOD_BNM1_THRESHOLD 0 /* always when Newton */
-#endif
-#endif
-
-/* All the three functions mpn{,_bc,_ni}_invertappr (ip, dp, n, scratch), take
- the strictly normalised value {dp,n} (i.e., most significant bit must be set)
- as an input, and compute {ip,n}: the approximate reciprocal of {dp,n}.
-
- Let e = mpn*_invertappr (ip, dp, n, scratch) be the returned value; the
- following conditions are satisfied by the output:
- 0 <= e <= 1;
- {dp,n}*(B^n+{ip,n}) < B^{2n} <= {dp,n}*(B^n+{ip,n}+1+e) .
- I.e. e=0 means that the result {ip,n} equals the one given by mpn_invert.
- e=1 means that the result _may_ be one less than expected.
-
- The _bc version returns e=1 most of the time.
- The _ni version should return e=0 most of the time; only about 1% of
- possible random input should give e=1.
-
- When the strict result is needed, i.e., e=0 in the relation above:
- {dp,n}*(B^n+{ip,n}) < B^{2n} <= {dp,n}*(B^n+{ip,n}+1) ;
- the function mpn_invert (ip, dp, n, scratch) should be used instead. */
-
-/* Maximum scratch needed by this branch (at tp): 3*n + 2 */
-static mp_limb_t
-mpn_bc_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr tp)
-{
- mp_ptr xp;
-
- ASSERT (n > 0);
- ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT);
- ASSERT (! MPN_OVERLAP_P (ip, n, dp, n));
- ASSERT (! MPN_OVERLAP_P (ip, n, tp, mpn_invertappr_itch(n)));
- ASSERT (! MPN_OVERLAP_P (dp, n, tp, mpn_invertappr_itch(n)));
-
- /* Compute a base value of r limbs. */
- if (n == 1)
- invert_limb (*ip, *dp);
- else {
- mp_size_t i;
- xp = tp + n + 2; /* 2 * n limbs */
-
- for (i = n - 1; i >= 0; i--)
- xp[i] = GMP_NUMB_MAX;
- mpn_com (xp + n, dp, n);
-
- /* Now xp contains B^2n - {dp,n}*B^n - 1 */
-
- /* FIXME: if mpn_*pi1_divappr_q handles n==2, use it! */
- if (n == 2) {
- mpn_divrem_2 (ip, 0, xp, 4, dp);
- } else {
- gmp_pi1_t inv;
- invert_pi1 (inv, dp[n-1], dp[n-2]);
- if (! MAYBE_dcpi1_divappr
- || BELOW_THRESHOLD (n, DC_DIVAPPR_Q_THRESHOLD))
- mpn_sbpi1_divappr_q (ip, xp, 2 * n, dp, n, inv.inv32);
- else
- mpn_dcpi1_divappr_q (ip, xp, 2 * n, dp, n, &inv);
- MPN_DECR_U(ip, n, 1);
- return 1;
- }
- }
- return 0;
-}
-
-/* mpn_ni_invertappr: computes the approximate reciprocal using Newton's
- iterations (at least one).
-
- Inspired by Algorithm "ApproximateReciprocal", published in "Modern Computer
- Arithmetic" by Richard P. Brent and Paul Zimmermann, algorithm 3.5, page 121
- in version 0.4 of the book.
-
- Some adaptations were introduced, to allow product mod B^m-1 and return the
- value e.
-
- USE_MUL_N = 1 (default) introduces a correction in such a way that "the
- value of B^{n+h}-T computed at step 8 cannot exceed B^n-1" (the book reads
- "2B^n-1"). This correction should not require to modify the proof.
-
- We use a wrapped product modulo B^m-1. NOTE: is there any normalisation
- problem for the [0] class? It shouldn't: we compute 2*|A*X_h - B^{n+h}| <
- B^m-1. We may get [0] if and only if we get AX_h = B^{n+h}. This can
- happen only if A=B^{n}/2, but this implies X_h = B^{h}*2-1 i.e., AX_h =
- B^{n+h} - A, then we get into the "negative" branch, where X_h is not
- incremented (because A < B^n).
-
- FIXME: the scratch for mulmod_bnm1 does not currently fit in the scratch, it
- is allocated apart. */
-
-#define USE_MUL_N 1
-
-mp_limb_t
-mpn_ni_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
-{
- mp_limb_t cy;
- mp_ptr xp;
- mp_size_t rn, mn;
- mp_size_t sizes[NPOWS], *sizp;
- mp_ptr tp;
- TMP_DECL;
-#define rp scratch
-
- ASSERT (n > 2);
- ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT);
- ASSERT (! MPN_OVERLAP_P (ip, n, dp, n));
- ASSERT (! MPN_OVERLAP_P (ip, n, scratch, mpn_invertappr_itch(n)));
- ASSERT (! MPN_OVERLAP_P (dp, n, scratch, mpn_invertappr_itch(n)));
-
- /* Compute the computation precisions from highest to lowest, leaving the
- base case size in 'rn'. */
- sizp = sizes;
- rn = n;
- do {
- *sizp = rn;
- rn = ((rn) >> 1) + 1;
- sizp ++;
- } while (ABOVE_THRESHOLD (rn, INV_NEWTON_THRESHOLD));
-
- /* We search the inverse of 0.{dp,n}, we compute it as 1.{ip,n} */
- dp += n;
- ip += n;
-
- /* Compute a base value of rn limbs. */
- mpn_bc_invertappr (ip - rn, dp - rn, rn, scratch);
-
- TMP_MARK;
-
- if (ABOVE_THRESHOLD (n, INV_MULMOD_BNM1_THRESHOLD))
- {
- mn = mpn_mulmod_bnm1_next_size (n + 1);
- tp = TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (mn, n, (n >> 1) + 1));
- }
- /* Use Newton's iterations to get the desired precision.*/
-
- /* define rp scratch; 2rn + 1 limbs <= 2(n>>1 + 1) + 1 <= n + 3 limbs */
- /* Maximum scratch needed by this branch <= 3*n + 2 */
- xp = scratch + n + 3; /* n + rn limbs */
- while (1) {
- mp_limb_t method;
-
- n = *--sizp;
- /*
- v n v
- +----+--+
- ^ rn ^
- */
-
- /* Compute i_jd . */
- if (BELOW_THRESHOLD (n, INV_MULMOD_BNM1_THRESHOLD)
- || ((mn = mpn_mulmod_bnm1_next_size (n + 1)) > (n + rn))) {
- /* FIXME: We do only need {xp,n+1}*/
- mpn_mul (xp, dp - n, n, ip - rn, rn);
- mpn_add_n (xp + rn, xp + rn, dp - n, n - rn + 1);
- method = 1; /* Remember we used (truncated) product */
- /* We computed cy.{xp,rn+n} <- 1.{ip,rn} * 0.{dp,n} */
- } else { /* Use B^n-1 wraparound */
- mpn_mulmod_bnm1 (xp, mn, dp - n, n, ip - rn, rn, tp);
- /* We computed {xp,mn} <- {ip,rn} * {dp,n} mod (B^mn-1) */
- /* We know that 2*|ip*dp + dp*B^rn - B^{rn+n}| < B^mn-1 */
- /* Add dp*B^rn mod (B^mn-1) */
- ASSERT (n >= mn - rn);
- xp[mn] = 1 + mpn_add_n (xp + rn, xp + rn, dp - n, mn - rn);
- cy = mpn_add_n (xp, xp, dp - (n - (mn - rn)), n - (mn - rn));
- MPN_INCR_U (xp + n - (mn - rn), mn + 1 - n + (mn - rn), cy);
- ASSERT (n + rn >= mn);
- /* Subtract B^{rn+n} */
- MPN_DECR_U (xp + rn + n - mn, 2*mn + 1 - rn - n, 1);
- if (xp[mn])
- MPN_INCR_U (xp, mn, xp[mn] - 1);
- else
- MPN_DECR_U (xp, mn, 1);
- method = 0; /* Remember we are working Mod B^m-1 */
- }
-
- if (xp[n] < 2) { /* "positive" residue class */
- cy = 1;
- while (xp[n] || mpn_cmp (xp, dp - n, n)>0) {
- xp[n] -= mpn_sub_n (xp, xp, dp - n, n);
- cy ++;
- }
- MPN_DECR_U(ip - rn, rn, cy);
- ASSERT (cy <= 4); /* at most 3 cycles for the while above */
- ASSERT_NOCARRY (mpn_sub_n (xp, dp - n, xp, n));
- ASSERT (xp[n] == 0);
- } else { /* "negative" residue class */
- mpn_com (xp, xp, n + 1);
- MPN_INCR_U(xp, n + 1, method);
- ASSERT (xp[n] <= 1);
-#if USE_MUL_N
- if (xp[n]) {
- MPN_INCR_U(ip - rn, rn, 1);
- ASSERT_CARRY (mpn_sub_n (xp, xp, dp - n, n));
- }
-#endif
- }
-
- /* Compute x_ju_j. FIXME:We need {rp+rn,rn}, mulhi? */
-#if USE_MUL_N
- mpn_mul_n (rp, xp + n - rn, ip - rn, rn);
-#else
- rp[2*rn] = 0;
- mpn_mul (rp, xp + n - rn, rn + xp[n], ip - rn, rn);
-#endif
- /* We need _only_ the carry from the next addition */
- /* Anyway 2rn-n <= 2... we don't need to optimise. */
- cy = mpn_add_n (rp + rn, rp + rn, xp + n - rn, 2*rn - n);
- cy = mpn_add_nc (ip - n, rp + 3*rn - n, xp + rn, n - rn, cy);
- MPN_INCR_U (ip - rn, rn, cy + (1-USE_MUL_N)*(rp[2*rn] + xp[n]));
- if (sizp == sizes) { /* Get out of the cycle */
- /* Check for possible carry propagation from below. */
- cy = rp[3*rn - n - 1] > GMP_NUMB_MAX - 7; /* Be conservative. */
-/* cy = mpn_add_1 (rp + rn, rp + rn, 2*rn - n, 4); */
- break;
- }
- rn = n;
- }
- TMP_FREE;
-
- return cy;
-#undef rp
-}
-
-mp_limb_t
-mpn_invertappr (mp_ptr ip, mp_srcptr dp, mp_size_t n, mp_ptr scratch)
-{
- mp_limb_t res;
- TMP_DECL;
-
- TMP_MARK;
-
- if (scratch == NULL)
- scratch = TMP_ALLOC_LIMBS (mpn_invertappr_itch (n));
-
- ASSERT (n > 0);
- ASSERT (dp[n-1] & GMP_NUMB_HIGHBIT);
- ASSERT (! MPN_OVERLAP_P (ip, n, dp, n));
- ASSERT (! MPN_OVERLAP_P (ip, n, scratch, mpn_invertappr_itch(n)));
- ASSERT (! MPN_OVERLAP_P (dp, n, scratch, mpn_invertappr_itch(n)));
-
- if (BELOW_THRESHOLD (n, INV_NEWTON_THRESHOLD))
- res = mpn_bc_invertappr (ip, dp, n, scratch);
- else
- res = mpn_ni_invertappr (ip, dp, n, scratch);
-
- TMP_FREE;
- return res;
-}
diff --git a/gmp/mpn/generic/jacbase.c b/gmp/mpn/generic/jacbase.c
index cd52bc9513..6972a130d9 100644
--- a/gmp/mpn/generic/jacbase.c
+++ b/gmp/mpn/generic/jacbase.c
@@ -3,33 +3,22 @@
THIS INTERFACE IS PRELIMINARY AND MIGHT DISAPPEAR OR BE SUBJECT TO
INCOMPATIBLE CHANGES IN A FUTURE RELEASE OF GMP.
-Copyright 1999-2002, 2010 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -83,15 +72,15 @@ see https://www.gnu.org/licenses/. */
#define PROCESS_TWOS_EVEN \
{ \
int two, mask, shift; \
- \
+ \
two = JACOBI_TWO_U_BIT1 (b); \
mask = (~a & 2); \
a >>= 1; \
- \
+ \
shift = (~a & 1); \
a >>= shift; \
result_bit1 ^= two ^ (two & mask); \
- \
+ \
while ((a & 1) == 0) \
{ \
a >>= 1; \
@@ -102,14 +91,14 @@ see https://www.gnu.org/licenses/. */
#define PROCESS_TWOS_ANY \
{ \
int two, mask, shift; \
- \
+ \
two = JACOBI_TWO_U_BIT1 (b); \
shift = (~a & 1); \
a >>= shift; \
- \
+ \
mask = shift << 1; \
result_bit1 ^= (two & mask); \
- \
+ \
while ((a & 1) == 0) \
{ \
a >>= 1; \
@@ -119,9 +108,9 @@ see https://www.gnu.org/licenses/. */
}
#endif
-#if JACOBI_BASE_METHOD < 4
+
/* Calculate the value of the Jacobi symbol (a/b) of two mp_limb_t's, but
- with a restricted range of inputs accepted, namely b>1, b odd.
+ with a restricted range of inputs accepted, namely b>1, b odd, and a<=b.
The initial result_bit1 is taken as a parameter for the convenience of
mpz_kronecker_ui() et al. The sign changes both here and in those
@@ -133,13 +122,17 @@ see https://www.gnu.org/licenses/. */
Duplicating the loop body to avoid the MP_LIMB_T_SWAP(a,b) would be
possible, but a couple of tests suggest it's not a significant speedup,
- and may even be a slowdown, so what's here is good enough for now. */
+ and may even be a slowdown, so what's here is good enough for now.
+
+ Future: The code doesn't demand a<=b actually, so maybe this could be
+ relaxed. All the places this is used currently call with a<=b though. */
int
mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int result_bit1)
{
ASSERT (b & 1); /* b odd */
ASSERT (b != 1);
+ ASSERT (a <= b);
if (a == 0)
return 0;
@@ -148,15 +141,11 @@ mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int result_bit1)
if (a == 1)
goto done;
- if (a >= b)
- goto a_gt_b;
-
for (;;)
{
result_bit1 ^= JACOBI_RECIP_UU_BIT1 (a, b);
MP_LIMB_T_SWAP (a, b);
- a_gt_b:
do
{
/* working on (a/b), a,b odd, a>=b */
@@ -177,67 +166,3 @@ mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int result_bit1)
done:
return JACOBI_BIT1_TO_PN (result_bit1);
}
-#endif
-
-#if JACOBI_BASE_METHOD == 4
-/* Computes (a/b) for odd b > 1 and any a. The initial bit is taken as a
- * parameter. We have no need for the convention that the sign is in
- * bit 1, internally we use bit 0. */
-
-/* FIXME: Could try table-based count_trailing_zeros. */
-int
-mpn_jacobi_base (mp_limb_t a, mp_limb_t b, int bit)
-{
- int c;
-
- ASSERT (b & 1);
- ASSERT (b > 1);
-
- if (a == 0)
- /* This is the only line which depends on b > 1 */
- return 0;
-
- bit >>= 1;
-
- /* Below, we represent a and b shifted right so that the least
- significant one bit is implicit. */
-
- b >>= 1;
-
- count_trailing_zeros (c, a);
- bit ^= c & (b ^ (b >> 1));
-
- /* We may have c==GMP_LIMB_BITS-1, so we can't use a>>c+1. */
- a >>= c;
- a >>= 1;
-
- do
- {
- mp_limb_t t = a - b;
- mp_limb_t bgta = LIMB_HIGHBIT_TO_MASK (t);
-
- if (t == 0)
- return 0;
-
- /* If b > a, invoke reciprocity */
- bit ^= (bgta & a & b);
-
- /* b <-- min (a, b) */
- b += (bgta & t);
-
- /* a <-- |a - b| */
- a = (t ^ bgta) - bgta;
-
- /* Number of trailing zeros is the same no matter if we look at
- * t or a, but using t gives more parallelism. */
- count_trailing_zeros (c, t);
- c ++;
- /* (2/b) = -1 if b = 3 or 5 mod 8 */
- bit ^= c & (b ^ (b >> 1));
- a >>= c;
- }
- while (b > 0);
-
- return 1-2*(bit & 1);
-}
-#endif /* JACOBI_BASE_METHOD == 4 */
diff --git a/gmp/mpn/generic/jacobi.c b/gmp/mpn/generic/jacobi.c
deleted file mode 100644
index bdc3ec67da..0000000000
--- a/gmp/mpn/generic/jacobi.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* jacobi.c
-
- 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 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 JACOBI_DC_THRESHOLD
-#define JACOBI_DC_THRESHOLD GCD_DC_THRESHOLD
-#endif
-
-/* Schönhage's rules:
- *
- * Assume r0 = r1 q1 + r2, with r0 odd, and r1 = q2 r2 + r3
- *
- * If r1 is odd, then
- *
- * (r1 | r0) = s(r1, r0) (r0 | r1) = s(r1, r0) (r2, r1)
- *
- * where s(x,y) = (-1)^{(x-1)(y-1)/4} = (-1)^[x = y = 3 (mod 4)].
- *
- * If r1 is even, r2 must be odd. We have
- *
- * (r1 | r0) = (r1 - r0 | r0) = (-1)^(r0-1)/2 (r0 - r1 | r0)
- * = (-1)^(r0-1)/2 s(r0, r0 - r1) (r0 | r0 - r1)
- * = (-1)^(r0-1)/2 s(r0, r0 - r1) (r1 | r0 - r1)
- *
- * Now, if r1 = 0 (mod 4), then the sign factor is +1, and repeating
- * q1 times gives
- *
- * (r1 | r0) = (r1 | r2) = (r3 | r2)
- *
- * On the other hand, if r1 = 2 (mod 4), the sign factor is
- * (-1)^{(r0-1)/2}, and repeating q1 times gives the exponent
- *
- * (r0-1)/2 + (r0-r1-1)/2 + ... + (r0 - (q1-1) r1)/2
- * = q1 (r0-1)/2 + q1 (q1-1)/2
- *
- * and we can summarize the even case as
- *
- * (r1 | r0) = t(r1, r0, q1) (r3 | r2)
- *
- * where t(x,y,q) = (-1)^{[x = 2 (mod 4)] (q(y-1)/2 + y(q-1)/2)}
- *
- * What about termination? The remainder sequence ends with (0|1) = 1
- * (or (0 | r) = 0 if r != 1). What are the possible cases? If r1 is
- * odd, r2 may be zero. If r1 is even, then r2 = r0 - q1 r1 is odd and
- * hence non-zero. We may have r3 = r1 - q2 r2 = 0.
- *
- * Examples: (11|15) = - (15|11) = - (4|11)
- * (4|11) = (4| 3) = (1| 3)
- * (1| 3) = (3|1) = (0|1) = 1
- *
- * (2|7) = (2|1) = (0|1) = 1
- *
- * Detail: (2|7) = (2-7|7) = (-1|7)(5|7) = -(7|5) = -(2|5)
- * (2|5) = (2-5|5) = (-1|5)(3|5) = (5|3) = (2|3)
- * (2|3) = (2-3|3) = (-1|3)(1|3) = -(3|1) = -(2|1)
- *
- */
-
-/* In principle, the state consists of four variables: e (one bit), a,
- b (two bits each), d (one bit). Collected factors are (-1)^e. a and
- b are the least significant bits of the current remainders. d
- (denominator) is 0 if we're currently subtracting multiplies of a
- from b, and 1 if we're subtracting b from a.
-
- e is stored in the least significant bit, while a, b and d are
- coded as only 13 distinct values in bits 1-4, according to the
- following table. For rows not mentioning d, the value is either
- implied, or it doesn't matter. */
-
-#if WANT_ASSERT
-static const struct
-{
- unsigned char a;
- unsigned char b;
-} decode_table[13] = {
- /* 0 */ { 0, 1 },
- /* 1 */ { 0, 3 },
- /* 2 */ { 1, 1 },
- /* 3 */ { 1, 3 },
- /* 4 */ { 2, 1 },
- /* 5 */ { 2, 3 },
- /* 6 */ { 3, 1 },
- /* 7 */ { 3, 3 }, /* d = 1 */
- /* 8 */ { 1, 0 },
- /* 9 */ { 1, 2 },
- /* 10 */ { 3, 0 },
- /* 11 */ { 3, 2 },
- /* 12 */ { 3, 3 }, /* d = 0 */
-};
-#define JACOBI_A(bits) (decode_table[(bits)>>1].a)
-#define JACOBI_B(bits) (decode_table[(bits)>>1].b)
-#endif /* WANT_ASSERT */
-
-const unsigned char jacobi_table[208] = {
-#include "jacobitab.h"
-};
-
-#define BITS_FAIL 31
-
-static void
-jacobi_hook (void *p, mp_srcptr gp, mp_size_t gn,
- mp_srcptr qp, mp_size_t qn, int d)
-{
- unsigned *bitsp = (unsigned *) p;
-
- if (gp)
- {
- ASSERT (gn > 0);
- if (gn != 1 || gp[0] != 1)
- {
- *bitsp = BITS_FAIL;
- return;
- }
- }
-
- if (qp)
- {
- ASSERT (qn > 0);
- ASSERT (d >= 0);
- *bitsp = mpn_jacobi_update (*bitsp, d, qp[0] & 3);
- }
-}
-
-#define CHOOSE_P(n) (2*(n) / 3)
-
-int
-mpn_jacobi_n (mp_ptr ap, mp_ptr bp, mp_size_t n, unsigned bits)
-{
- mp_size_t scratch;
- mp_size_t matrix_scratch;
- mp_ptr tp;
-
- TMP_DECL;
-
- ASSERT (n > 0);
- ASSERT ( (ap[n-1] | bp[n-1]) > 0);
- ASSERT ( (bp[0] | ap[0]) & 1);
-
- /* FIXME: Check for small sizes first, before setting up temporary
- storage etc. */
- scratch = MPN_GCD_SUBDIV_STEP_ITCH(n);
-
- if (ABOVE_THRESHOLD (n, GCD_DC_THRESHOLD))
- {
- mp_size_t hgcd_scratch;
- mp_size_t update_scratch;
- mp_size_t p = CHOOSE_P (n);
- mp_size_t dc_scratch;
-
- matrix_scratch = MPN_HGCD_MATRIX_INIT_ITCH (n - p);
- hgcd_scratch = mpn_hgcd_itch (n - p);
- update_scratch = p + n - 1;
-
- dc_scratch = matrix_scratch + MAX(hgcd_scratch, update_scratch);
- if (dc_scratch > scratch)
- scratch = dc_scratch;
- }
-
- TMP_MARK;
- tp = TMP_ALLOC_LIMBS(scratch);
-
- while (ABOVE_THRESHOLD (n, JACOBI_DC_THRESHOLD))
- {
- struct hgcd_matrix M;
- mp_size_t p = 2*n/3;
- mp_size_t matrix_scratch = MPN_HGCD_MATRIX_INIT_ITCH (n - p);
- mp_size_t nn;
- mpn_hgcd_matrix_init (&M, n - p, tp);
-
- nn = mpn_hgcd_jacobi (ap + p, bp + p, n - p, &M, &bits,
- tp + matrix_scratch);
- if (nn > 0)
- {
- ASSERT (M.n <= (n - p - 1)/2);
- ASSERT (M.n + p <= (p + n - 1) / 2);
- /* Temporary storage 2 (p + M->n) <= p + n - 1. */
- n = mpn_hgcd_matrix_adjust (&M, p + nn, ap, bp, p, tp + matrix_scratch);
- }
- else
- {
- /* Temporary storage n */
- n = mpn_gcd_subdiv_step (ap, bp, n, 0, jacobi_hook, &bits, tp);
- if (!n)
- {
- TMP_FREE;
- return bits == BITS_FAIL ? 0 : mpn_jacobi_finish (bits);
- }
- }
- }
-
- while (n > 2)
- {
- struct hgcd_matrix1 M;
- mp_limb_t ah, al, bh, bl;
- mp_limb_t mask;
-
- mask = ap[n-1] | bp[n-1];
- ASSERT (mask > 0);
-
- if (mask & GMP_NUMB_HIGHBIT)
- {
- ah = ap[n-1]; al = ap[n-2];
- bh = bp[n-1]; bl = bp[n-2];
- }
- else
- {
- int shift;
-
- count_leading_zeros (shift, mask);
- ah = MPN_EXTRACT_NUMB (shift, ap[n-1], ap[n-2]);
- al = MPN_EXTRACT_NUMB (shift, ap[n-2], ap[n-3]);
- bh = MPN_EXTRACT_NUMB (shift, bp[n-1], bp[n-2]);
- bl = MPN_EXTRACT_NUMB (shift, bp[n-2], bp[n-3]);
- }
-
- /* Try an mpn_nhgcd2 step */
- if (mpn_hgcd2_jacobi (ah, al, bh, bl, &M, &bits))
- {
- n = mpn_matrix22_mul1_inverse_vector (&M, tp, ap, bp, n);
- MP_PTR_SWAP (ap, tp);
- }
- else
- {
- /* mpn_hgcd2 has failed. Then either one of a or b is very
- small, or the difference is very small. Perform one
- subtraction followed by one division. */
- n = mpn_gcd_subdiv_step (ap, bp, n, 0, &jacobi_hook, &bits, tp);
- if (!n)
- {
- TMP_FREE;
- return bits == BITS_FAIL ? 0 : mpn_jacobi_finish (bits);
- }
- }
- }
-
- if (bits >= 16)
- MP_PTR_SWAP (ap, bp);
-
- ASSERT (bp[0] & 1);
-
- if (n == 1)
- {
- mp_limb_t al, bl;
- al = ap[0];
- bl = bp[0];
-
- TMP_FREE;
- if (bl == 1)
- return 1 - 2*(bits & 1);
- else
- return mpn_jacobi_base (al, bl, bits << 1);
- }
-
- else
- {
- int res = mpn_jacobi_2 (ap, bp, bits & 1);
- TMP_FREE;
- return res;
- }
-}
diff --git a/gmp/mpn/generic/jacobi_2.c b/gmp/mpn/generic/jacobi_2.c
deleted file mode 100644
index 9f480f7834..0000000000
--- a/gmp/mpn/generic/jacobi_2.c
+++ /dev/null
@@ -1,352 +0,0 @@
-/* jacobi_2.c
-
- 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 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 JACOBI_2_METHOD
-#define JACOBI_2_METHOD 2
-#endif
-
-/* Computes (a / b) where b is odd, and a and b are otherwise arbitrary
- two-limb numbers. */
-#if JACOBI_2_METHOD == 1
-int
-mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit)
-{
- mp_limb_t ah, al, bh, bl;
- int c;
-
- al = ap[0];
- ah = ap[1];
- bl = bp[0];
- bh = bp[1];
-
- ASSERT (bl & 1);
-
- bl = ((bh << (GMP_NUMB_BITS - 1)) & GMP_NUMB_MASK) | (bl >> 1);
- bh >>= 1;
-
- if ( (bh | bl) == 0)
- return 1 - 2*(bit & 1);
-
- if ( (ah | al) == 0)
- return 0;
-
- if (al == 0)
- {
- al = ah;
- ah = 0;
- bit ^= GMP_NUMB_BITS & (bl ^ (bl >> 1));
- }
- count_trailing_zeros (c, al);
- bit ^= c & (bl ^ (bl >> 1));
-
- c++;
- if (UNLIKELY (c == GMP_NUMB_BITS))
- {
- al = ah;
- ah = 0;
- }
- else
- {
- al = ((ah << (GMP_NUMB_BITS - c)) & GMP_NUMB_MASK) | (al >> c);
- ah >>= c;
- }
- while ( (ah | bh) > 0)
- {
- mp_limb_t th, tl;
- mp_limb_t bgta;
-
- sub_ddmmss (th, tl, ah, al, bh, bl);
- if ( (tl | th) == 0)
- return 0;
-
- bgta = LIMB_HIGHBIT_TO_MASK (th);
-
- /* If b > a, invoke reciprocity */
- bit ^= (bgta & al & bl);
-
- /* b <-- min (a, b) */
- add_ssaaaa (bh, bl, bh, bl, th & bgta, tl & bgta);
-
- if ( (bh | bl) == 0)
- return 1 - 2*(bit & 1);
-
- /* a <-- |a - b| */
- al = (bgta ^ tl) - bgta;
- ah = (bgta ^ th);
-
- if (UNLIKELY (al == 0))
- {
- /* If b > a, al == 0 implies that we have a carry to
- propagate. */
- al = ah - bgta;
- ah = 0;
- bit ^= GMP_NUMB_BITS & (bl ^ (bl >> 1));
- }
- count_trailing_zeros (c, al);
- c++;
- bit ^= c & (bl ^ (bl >> 1));
-
- if (UNLIKELY (c == GMP_NUMB_BITS))
- {
- al = ah;
- ah = 0;
- }
- else
- {
- al = ((ah << (GMP_NUMB_BITS - c)) & GMP_NUMB_MASK) | (al >> c);
- ah >>= c;
- }
- }
-
- ASSERT (bl > 0);
-
- while ( (al | bl) & GMP_LIMB_HIGHBIT)
- {
- /* Need an extra comparison to get the mask. */
- mp_limb_t t = al - bl;
- mp_limb_t bgta = - (bl > al);
-
- if (t == 0)
- return 0;
-
- /* If b > a, invoke reciprocity */
- bit ^= (bgta & al & bl);
-
- /* b <-- min (a, b) */
- bl += (bgta & t);
-
- /* a <-- |a - b| */
- al = (t ^ bgta) - bgta;
-
- /* Number of trailing zeros is the same no matter if we look at
- * t or a, but using t gives more parallelism. */
- count_trailing_zeros (c, t);
- c ++;
- /* (2/b) = -1 if b = 3 or 5 mod 8 */
- bit ^= c & (bl ^ (bl >> 1));
-
- if (UNLIKELY (c == GMP_NUMB_BITS))
- return 1 - 2*(bit & 1);
-
- al >>= c;
- }
-
- /* Here we have a little impedance mismatch. Better to inline it? */
- return mpn_jacobi_base (2*al+1, 2*bl+1, bit << 1);
-}
-#elif JACOBI_2_METHOD == 2
-int
-mpn_jacobi_2 (mp_srcptr ap, mp_srcptr bp, unsigned bit)
-{
- mp_limb_t ah, al, bh, bl;
- int c;
-
- al = ap[0];
- ah = ap[1];
- bl = bp[0];
- bh = bp[1];
-
- ASSERT (bl & 1);
-
- /* Use bit 1. */
- bit <<= 1;
-
- if (bh == 0 && bl == 1)
- /* (a|1) = 1 */
- return 1 - (bit & 2);
-
- if (al == 0)
- {
- if (ah == 0)
- /* (0|b) = 0, b > 1 */
- return 0;
-
- count_trailing_zeros (c, ah);
- bit ^= ((GMP_NUMB_BITS + c) << 1) & (bl ^ (bl >> 1));
-
- al = bl;
- bl = ah >> c;
-
- if (bl == 1)
- /* (1|b) = 1 */
- return 1 - (bit & 2);
-
- ah = bh;
-
- bit ^= al & bl;
-
- goto b_reduced;
- }
- if ( (al & 1) == 0)
- {
- count_trailing_zeros (c, al);
-
- al = ((ah << (GMP_NUMB_BITS - c)) & GMP_NUMB_MASK) | (al >> c);
- ah >>= c;
- bit ^= (c << 1) & (bl ^ (bl >> 1));
- }
- if (ah == 0)
- {
- if (bh > 0)
- {
- bit ^= al & bl;
- MP_LIMB_T_SWAP (al, bl);
- ah = bh;
- goto b_reduced;
- }
- goto ab_reduced;
- }
-
- while (bh > 0)
- {
- /* Compute (a|b) */
- while (ah > bh)
- {
- sub_ddmmss (ah, al, ah, al, bh, bl);
- if (al == 0)
- {
- count_trailing_zeros (c, ah);
- bit ^= ((GMP_NUMB_BITS + c) << 1) & (bl ^ (bl >> 1));
-
- al = bl;
- bl = ah >> c;
- ah = bh;
-
- bit ^= al & bl;
- goto b_reduced;
- }
- count_trailing_zeros (c, al);
- bit ^= (c << 1) & (bl ^ (bl >> 1));
- al = ((ah << (GMP_NUMB_BITS - c)) & GMP_NUMB_MASK) | (al >> c);
- ah >>= c;
- }
- if (ah == bh)
- goto cancel_hi;
-
- if (ah == 0)
- {
- bit ^= al & bl;
- MP_LIMB_T_SWAP (al, bl);
- ah = bh;
- break;
- }
-
- bit ^= al & bl;
-
- /* Compute (b|a) */
- while (bh > ah)
- {
- sub_ddmmss (bh, bl, bh, bl, ah, al);
- if (bl == 0)
- {
- count_trailing_zeros (c, bh);
- bit ^= ((GMP_NUMB_BITS + c) << 1) & (al ^ (al >> 1));
-
- bl = bh >> c;
- bit ^= al & bl;
- goto b_reduced;
- }
- count_trailing_zeros (c, bl);
- bit ^= (c << 1) & (al ^ (al >> 1));
- bl = ((bh << (GMP_NUMB_BITS - c)) & GMP_NUMB_MASK) | (bl >> c);
- bh >>= c;
- }
- bit ^= al & bl;
-
- /* Compute (a|b) */
- if (ah == bh)
- {
- cancel_hi:
- if (al < bl)
- {
- MP_LIMB_T_SWAP (al, bl);
- bit ^= al & bl;
- }
- al -= bl;
- if (al == 0)
- return 0;
-
- count_trailing_zeros (c, al);
- bit ^= (c << 1) & (bl ^ (bl >> 1));
- al >>= c;
-
- if (al == 1)
- return 1 - (bit & 2);
-
- MP_LIMB_T_SWAP (al, bl);
- bit ^= al & bl;
- break;
- }
- }
-
- b_reduced:
- /* Compute (a|b), with b a single limb. */
- ASSERT (bl & 1);
-
- if (bl == 1)
- /* (a|1) = 1 */
- return 1 - (bit & 2);
-
- while (ah > 0)
- {
- ah -= (al < bl);
- al -= bl;
- if (al == 0)
- {
- if (ah == 0)
- return 0;
- count_trailing_zeros (c, ah);
- bit ^= ((GMP_NUMB_BITS + c) << 1) & (bl ^ (bl >> 1));
- al = ah >> c;
- goto ab_reduced;
- }
- count_trailing_zeros (c, al);
-
- al = ((ah << (GMP_NUMB_BITS - c)) & GMP_NUMB_MASK) | (al >> c);
- ah >>= c;
- bit ^= (c << 1) & (bl ^ (bl >> 1));
- }
- ab_reduced:
- ASSERT (bl & 1);
- ASSERT (bl > 1);
-
- return mpn_jacobi_base (al, bl, bit);
-}
-#else
-#error Unsupported value for JACOBI_2_METHOD
-#endif
diff --git a/gmp/mpn/generic/logops_n.c b/gmp/mpn/generic/logops_n.c
deleted file mode 100644
index 1b534ff4ba..0000000000
--- a/gmp/mpn/generic/logops_n.c
+++ /dev/null
@@ -1,78 +0,0 @@
-/* mpn_and_n, mpn_ior_n, etc -- mpn logical operations.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-#ifdef OPERATION_and_n
-#define func __MPN(and_n)
-#define call mpn_and_n
-#endif
-
-#ifdef OPERATION_andn_n
-#define func __MPN(andn_n)
-#define call mpn_andn_n
-#endif
-
-#ifdef OPERATION_nand_n
-#define func __MPN(nand_n)
-#define call mpn_nand_n
-#endif
-
-#ifdef OPERATION_ior_n
-#define func __MPN(ior_n)
-#define call mpn_ior_n
-#endif
-
-#ifdef OPERATION_iorn_n
-#define func __MPN(iorn_n)
-#define call mpn_iorn_n
-#endif
-
-#ifdef OPERATION_nior_n
-#define func __MPN(nior_n)
-#define call mpn_nior_n
-#endif
-
-#ifdef OPERATION_xor_n
-#define func __MPN(xor_n)
-#define call mpn_xor_n
-#endif
-
-#ifdef OPERATION_xnor_n
-#define func __MPN(xnor_n)
-#define call mpn_xnor_n
-#endif
-
-void
-func (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
-{
- call (rp, up, vp, n);
-}
diff --git a/gmp/mpn/generic/lshift.c b/gmp/mpn/generic/lshift.c
index 5182632976..fdc7e4423e 100644
--- a/gmp/mpn/generic/lshift.c
+++ b/gmp/mpn/generic/lshift.c
@@ -1,32 +1,22 @@
/* mpn_lshift -- Shift left low level.
-Copyright 1991, 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/lshiftc.c b/gmp/mpn/generic/lshiftc.c
deleted file mode 100644
index e8051b7b93..0000000000
--- a/gmp/mpn/generic/lshiftc.c
+++ /dev/null
@@ -1,74 +0,0 @@
-/* mpn_lshiftc -- Shift left low level with complement.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Shift U (pointed to by up and n limbs long) cnt bits to the left
- and store the n least significant limbs of the result at rp.
- Return the bits shifted out from the most significant limb.
-
- Argument constraints:
- 1. 0 < cnt < GMP_NUMB_BITS.
- 2. If the result is to be written over the input, rp must be >= up.
-*/
-
-mp_limb_t
-mpn_lshiftc (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
-{
- mp_limb_t high_limb, low_limb;
- unsigned int tnc;
- mp_size_t i;
- mp_limb_t retval;
-
- ASSERT (n >= 1);
- ASSERT (cnt >= 1);
- ASSERT (cnt < GMP_NUMB_BITS);
- ASSERT (MPN_SAME_OR_DECR_P (rp, up, n));
-
- up += n;
- rp += n;
-
- tnc = GMP_NUMB_BITS - cnt;
- low_limb = *--up;
- retval = low_limb >> tnc;
- high_limb = (low_limb << cnt);
-
- for (i = n - 1; i != 0; i--)
- {
- low_limb = *--up;
- *--rp = (~(high_limb | (low_limb >> tnc))) & GMP_NUMB_MASK;
- high_limb = low_limb << cnt;
- }
- *--rp = (~high_limb) & GMP_NUMB_MASK;
-
- return retval;
-}
diff --git a/gmp/mpn/generic/matrix22_mul.c b/gmp/mpn/generic/matrix22_mul.c
index 59531eb1b2..f979385d9d 100644
--- a/gmp/mpn/generic/matrix22_mul.c
+++ b/gmp/mpn/generic/matrix22_mul.c
@@ -1,38 +1,25 @@
/* matrix22_mul.c.
- 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-2005, 2008, 2009 Free Software Foundation, Inc.
+Copyright 2003, 2004, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -83,198 +70,143 @@ mpn_matrix22_mul_itch (mp_size_t rn, mp_size_t mn)
|| BELOW_THRESHOLD (mn, MATRIX22_STRASSEN_THRESHOLD))
return 3*rn + 2*mn;
else
- return 3*(rn + mn) + 5;
+ return 4*(rn + mn) + 5;
}
/* Algorithm:
/ s0 \ / 1 0 0 0 \ / r0 \
- | s1 | | 0 1 0 1 | | r1 |
- | s2 | | 0 0 -1 1 | | r2 |
- | s3 | = | 0 1 -1 1 | \ r3 /
- | s4 | | -1 1 -1 1 |
- | s5 | | 0 1 0 0 |
- \ s6 / \ 0 0 1 0 /
+ | s1 | | 0 1 0 0 | | r1 |
+ | s2 | | 0 0 1 1 | | r2 |
+ | s3 | = | -1 0 1 1 | \ r3 /
+ | s4 | | 1 0 -1 0 |
+ | s5 | | 1 1 -1 -1 |
+ \ s6 / \ 0 0 0 1 /
/ t0 \ / 1 0 0 0 \ / m0 \
- | t1 | | 0 1 0 1 | | m1 |
- | t2 | | 0 0 -1 1 | | m2 |
- | t3 | = | 0 1 -1 1 | \ m3 /
- | t4 | | -1 1 -1 1 |
- | t5 | | 0 1 0 0 |
- \ t6 / \ 0 0 1 0 /
-
- Note: the two matrices above are the same, but s_i and t_i are used
- in the same product, only for i<4, see "A Strassen-like Matrix
- Multiplication suited for squaring and higher power computation" by
- M. Bodrato, in Proceedings of ISSAC 2010.
-
- / r0 \ / 1 0 0 0 0 1 0 \ / s0*t0 \
- | r1 | = | 0 0 -1 1 -1 1 0 | | s1*t1 |
- | r2 | | 0 1 0 -1 0 -1 -1 | | s2*t2 |
- \ r3 / \ 0 1 1 -1 0 -1 0 / | s3*t3 |
- | s4*t5 |
- | s5*t6 |
- \ s6*t4 /
-
- The scheduling uses two temporaries U0 and U1 to store products, and
- two, S0 and T0, to store combinations of entries of the two
- operands.
+ | t1 | | 0 0 1 0 | | m1 |
+ | t2 | | -1 1 0 0 | | m2 |
+ | t3 | = | 1 -1 0 1 | \ m3 /
+ | t4 | | 0 -1 0 1 |
+ | t5 | | 0 0 0 1 |
+ \ t6 / \ -1 1 1 -1 /
+
+ / r0 \ / 1 1 0 0 0 0 0 \ / s0 * t0 \
+ | r1 | = | 1 0 1 1 0 1 0 | | s1 * t1 |
+ | r2 | | 1 0 0 1 1 0 1 | | s2 * t2 |
+ \ r3 / \ 1 0 1 1 1 0 0 / | s3 * t3 |
+ | s4 * t4 |
+ | s5 * t5 |
+ \ s6 * t6 /
*/
/* Computes R = R * M. Elements are numbers R = (r0, r1; r2, r3).
*
* Resulting elements are of size up to rn + mn + 1.
*
- * Temporary storage: 3 rn + 3 mn + 5. */
+ * Temporary storage: 4 rn + 4 mn + 5. */
void
mpn_matrix22_mul_strassen (mp_ptr r0, mp_ptr r1, mp_ptr r2, mp_ptr r3, mp_size_t rn,
mp_srcptr m0, mp_srcptr m1, mp_srcptr m2, mp_srcptr m3, mp_size_t mn,
mp_ptr tp)
{
- mp_ptr s0, t0, u0, u1;
- int r1s, r3s, s0s, t0s, u1s;
- s0 = tp; tp += rn + 1;
- t0 = tp; tp += mn + 1;
+ mp_ptr s2, s3, t2, t3, u0, u1;
+ int r2s, r3s, s3s, t2s, t3s, u0s, u1s;
+ s2 = tp; tp += rn;
+ s3 = tp; tp += rn + 1;
+ t2 = tp; tp += mn;
+ t3 = tp; tp += mn + 1;
u0 = tp; tp += rn + mn + 1;
u1 = tp; /* rn + mn + 2 */
- MUL (u0, r1, rn, m2, mn); /* u5 = s5 * t6 */
- r3s = abs_sub_n (r3, r3, r2, rn); /* r3 - r2 */
- if (r3s)
- {
- r1s = abs_sub_n (r1, r1, r3, rn);
- r1[rn] = 0;
- }
- else
- {
- r1[rn] = mpn_add_n (r1, r1, r3, rn);
- r1s = 0; /* r1 - r2 + r3 */
- }
- if (r1s)
- {
- s0[rn] = mpn_add_n (s0, r1, r0, rn);
- s0s = 0;
- }
- else if (r1[rn] != 0)
- {
- s0[rn] = r1[rn] - mpn_sub_n (s0, r1, r0, rn);
- s0s = 1; /* s4 = -r0 + r1 - r2 + r3 */
- /* Reverse sign! */
- }
- else
- {
- s0s = abs_sub_n (s0, r0, r1, rn);
- s0[rn] = 0;
- }
- MUL (u1, r0, rn, m0, mn); /* u0 = s0 * t0 */
- r0[rn+mn] = mpn_add_n (r0, u0, u1, rn + mn);
- ASSERT (r0[rn+mn] < 2); /* u0 + u5 */
+ MUL (u0, r0, rn, m0, mn); /* 0 */
+ MUL (u1, r1, rn, m2, mn); /* 1 */
- t0s = abs_sub_n (t0, m3, m2, mn);
- u1s = r3s^t0s^1; /* Reverse sign! */
- MUL (u1, r3, rn, t0, mn); /* u2 = s2 * t2 */
- u1[rn+mn] = 0;
- if (t0s)
- {
- t0s = abs_sub_n (t0, m1, t0, mn);
- t0[mn] = 0;
- }
- else
- {
- t0[mn] = mpn_add_n (t0, t0, m1, mn);
- }
+ MPN_COPY (s2, r3, rn);
- /* FIXME: Could be simplified if we had space for rn + mn + 2 limbs
- at r3. I'd expect that for matrices of random size, the high
- words t0[mn] and r1[rn] are non-zero with a pretty small
- probability. If that can be confirmed this should be done as an
- unconditional rn x (mn+1) followed by an if (UNLIKELY (r1[rn]))
- add_n. */
- if (t0[mn] != 0)
+ r3[rn] = mpn_add_n (r3, r3, r2, rn);
+ r0[rn] = 0;
+ s3s = abs_sub_n (s3, r3, r0, rn + 1);
+ t2s = abs_sub_n (t2, m1, m0, mn);
+ if (t2s)
{
- MUL (r3, r1, rn, t0, mn + 1); /* u3 = s3 * t3 */
- ASSERT (r1[rn] < 2);
- if (r1[rn] != 0)
- mpn_add_n (r3 + rn, r3 + rn, t0, mn + 1);
+ t3[mn] = mpn_add_n (t3, m3, t2, mn);
+ t3s = 0;
}
else
{
- MUL (r3, r1, rn + 1, t0, mn);
+ t3s = abs_sub_n (t3, m3, t2, mn);
+ t3[mn] = 0;
}
- ASSERT (r3[rn+mn] < 4);
+ r2s = abs_sub_n (r2, r0, r2, rn);
+ r0[rn+mn] = mpn_add_n (r0, u0, u1, rn + mn);
- u0[rn+mn] = 0;
- if (r1s^t0s)
+ MUL(u1, s3, rn+1, t3, mn+1); /* 3 */
+ u1s = s3s ^ t3s;
+ ASSERT (u1[rn+mn+1] == 0);
+ ASSERT (u1[rn+mn] < 4);
+
+ if (u1s)
{
- r3s = abs_sub_n (r3, u0, r3, rn + mn + 1);
+ u0[rn+mn] = 0;
+ u0s = abs_sub_n (u0, u0, u1, rn + mn + 1);
}
else
{
- ASSERT_NOCARRY (mpn_add_n (r3, r3, u0, rn + mn + 1));
- r3s = 0; /* u3 + u5 */
+ u0[rn+mn] = u1[rn+mn] + mpn_add_n (u0, u0, u1, rn + mn);
+ u0s = 0;
}
+ MUL(u1, r3, rn + 1, t2, mn); /* 2 */
+ u1s = t2s;
+ ASSERT (u1[rn+mn] < 2);
- if (t0s)
- {
- t0[mn] = mpn_add_n (t0, t0, m0, mn);
- }
- else if (t0[mn] != 0)
- {
- t0[mn] -= mpn_sub_n (t0, t0, m0, mn);
- }
- else
+ u1s = add_signed_n (u1, u0, u0s, u1, u1s, rn + mn + 1);
+
+ t2s = abs_sub_n (t2, m3, m1, mn);
+ if (s3s)
{
- t0s = abs_sub_n (t0, t0, m0, mn);
+ s3[rn] += mpn_add_n (s3, s3, r1, rn);
+ s3s = 0;
}
- MUL (u0, r2, rn, t0, mn + 1); /* u6 = s6 * t4 */
- ASSERT (u0[rn+mn] < 2);
- if (r1s)
+ else if (s3[rn] > 0)
{
- ASSERT_NOCARRY (mpn_sub_n (r1, r2, r1, rn));
+ s3[rn] -= mpn_sub_n (s3, s3, r1, rn);
+ s3s = 1;
}
else
{
- r1[rn] += mpn_add_n (r1, r1, r2, rn);
- }
- rn++;
- t0s = add_signed_n (r2, r3, r3s, u0, t0s, rn + mn);
- /* u3 + u5 + u6 */
- ASSERT (r2[rn+mn-1] < 4);
- r3s = add_signed_n (r3, r3, r3s, u1, u1s, rn + mn);
- /* -u2 + u3 + u5 */
- ASSERT (r3[rn+mn-1] < 3);
- MUL (u0, s0, rn, m1, mn); /* u4 = s4 * t5 */
- ASSERT (u0[rn+mn-1] < 2);
- t0[mn] = mpn_add_n (t0, m3, m1, mn);
- MUL (u1, r1, rn, t0, mn + 1); /* u1 = s1 * t1 */
- mn += rn;
- ASSERT (u1[mn-1] < 4);
- ASSERT (u1[mn] == 0);
- ASSERT_NOCARRY (add_signed_n (r1, r3, r3s, u0, s0s, mn));
- /* -u2 + u3 - u4 + u5 */
- ASSERT (r1[mn-1] < 2);
- if (r3s)
- {
- ASSERT_NOCARRY (mpn_add_n (r3, u1, r3, mn));
+ s3s = abs_sub_n (s3, r1, s3, rn);
}
- else
+ MUL (r1, s3, rn+1, m3, mn); /* 5 */
+ ASSERT_NOCARRY(add_signed_n (r1, r1, s3s, u1, u1s, rn + mn + 1));
+ ASSERT (r1[rn + mn] < 2);
+
+ MUL (r3, r2, rn, t2, mn); /* 4 */
+ r3s = r2s ^ t2s;
+ r3[rn + mn] = 0;
+ u0s = add_signed_n (u0, u0, u0s, r3, r3s, rn + mn + 1);
+ ASSERT_NOCARRY (add_signed_n (r3, r3, r3s, u1, u1s, rn + mn + 1));
+ ASSERT (r3[rn + mn] < 2);
+
+ if (t3s)
{
- ASSERT_NOCARRY (mpn_sub_n (r3, u1, r3, mn));
- /* u1 + u2 - u3 - u5 */
+ t3[mn] += mpn_add_n (t3, m2, t3, mn);
+ t3s = 0;
}
- ASSERT (r3[mn-1] < 2);
- if (t0s)
+ else if (t3[mn] > 0)
{
- ASSERT_NOCARRY (mpn_add_n (r2, u1, r2, mn));
+ t3[mn] -= mpn_sub_n (t3, t3, m2, mn);
+ t3s = 1;
}
else
{
- ASSERT_NOCARRY (mpn_sub_n (r2, u1, r2, mn));
- /* u1 - u3 - u5 - u6 */
+ t3s = abs_sub_n (t3, m2, t3, mn);
}
- ASSERT (r2[mn-1] < 2);
+ MUL (r2, s2, rn, t3, mn + 1); /* 6 */
+
+ ASSERT_NOCARRY (add_signed_n (r2, r2, t3s, u0, u0s, rn + mn + 1));
+ ASSERT (r2[rn + mn] < 2);
}
void
diff --git a/gmp/mpn/generic/matrix22_mul1_inverse_vector.c b/gmp/mpn/generic/matrix22_mul1_inverse_vector.c
deleted file mode 100644
index 83b2fb5134..0000000000
--- a/gmp/mpn/generic/matrix22_mul1_inverse_vector.c
+++ /dev/null
@@ -1,65 +0,0 @@
-/* matrix22_mul1_inverse_vector.c
-
- 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 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Sets (r;b) = M^{-1}(a;b), with M^{-1} = (u11, -u01; -u10, u00) from
- the left. Uses three buffers, to avoid a copy. */
-mp_size_t
-mpn_matrix22_mul1_inverse_vector (const struct hgcd_matrix1 *M,
- mp_ptr rp, mp_srcptr ap, mp_ptr bp, mp_size_t n)
-{
- mp_limb_t h0, h1;
-
- /* Compute (r;b) <-- (u11 a - u01 b; -u10 a + u00 b) as
-
- r = u11 * a
- r -= u01 * b
- b *= u00
- b -= u10 * a
- */
-
- h0 = mpn_mul_1 (rp, ap, n, M->u[1][1]);
- h1 = mpn_submul_1 (rp, bp, n, M->u[0][1]);
- ASSERT (h0 == h1);
-
- h0 = mpn_mul_1 (bp, bp, n, M->u[0][0]);
- h1 = mpn_submul_1 (bp, ap, n, M->u[1][0]);
- ASSERT (h0 == h1);
-
- n -= (rp[n-1] | bp[n-1]) == 0;
- return n;
-}
diff --git a/gmp/mpn/generic/mod_1.c b/gmp/mpn/generic/mod_1.c
index 0212020201..7c892814e1 100644
--- a/gmp/mpn/generic/mod_1.c
+++ b/gmp/mpn/generic/mod_1.c
@@ -3,34 +3,23 @@
Return the single-limb remainder.
There are no constraints on the value of the divisor.
-Copyright 1991, 1993, 1994, 1999, 2000, 2002, 2007-2009, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2002, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -53,43 +42,18 @@ see https://www.gnu.org/licenses/. */
#define MOD_1_UNNORM_THRESHOLD 0
#endif
-#ifndef MOD_1U_TO_MOD_1_1_THRESHOLD
-#define MOD_1U_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* default is not to use mpn_mod_1s */
+#ifndef MOD_1_1_THRESHOLD
+#define MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* default is not to use mpn_mod_1s */
#endif
-#ifndef MOD_1N_TO_MOD_1_1_THRESHOLD
-#define MOD_1N_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* default is not to use mpn_mod_1s */
+#ifndef MOD_1_2_THRESHOLD
+#define MOD_1_2_THRESHOLD 10
#endif
-#ifndef MOD_1_1_TO_MOD_1_2_THRESHOLD
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 10
+#ifndef MOD_1_4_THRESHOLD
+#define MOD_1_4_THRESHOLD 120
#endif
-#ifndef MOD_1_2_TO_MOD_1_4_THRESHOLD
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 20
-#endif
-
-#if TUNE_PROGRAM_BUILD && !HAVE_NATIVE_mpn_mod_1_1p
-/* 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]);
-
-void mpn_mod_1_1p_cps_1 (mp_limb_t [4], mp_limb_t);
-void mpn_mod_1_1p_cps_2 (mp_limb_t [4], mp_limb_t);
-
-#undef mpn_mod_1_1p
-#define mpn_mod_1_1p(ap, n, b, pre) \
- (mod_1_1p_method == 1 ? mpn_mod_1_1p_1 (ap, n, b, pre) \
- : (mod_1_1p_method == 2 ? mpn_mod_1_1p_2 (ap, n, b, pre) \
- : __gmpn_mod_1_1p (ap, n, b, pre)))
-
-#undef mpn_mod_1_1p_cps
-#define mpn_mod_1_1p_cps(pre, b) \
- (mod_1_1p_method == 1 ? mpn_mod_1_1p_cps_1 (pre, b) \
- : (mod_1_1p_method == 2 ? mpn_mod_1_1p_cps_2 (pre, b) \
- : __gmpn_mod_1_1p_cps (pre, b)))
-#endif /* TUNE_PROGRAM_BUILD && !HAVE_NATIVE_mpn_mod_1_1p */
-
/* The comments in mpn/generic/divrem_1.c apply here too.
@@ -150,12 +114,12 @@ mpn_mod_1_unnorm (mp_srcptr up, mp_size_t un, mp_limb_t d)
if (UDIV_NEEDS_NORMALIZATION
&& BELOW_THRESHOLD (un, MOD_1_UNNORM_THRESHOLD))
{
- mp_limb_t nshift;
for (i = un - 2; i >= 0; i--)
{
n0 = up[i] << GMP_NAIL_BITS;
- nshift = (n1 << cnt) | (n0 >> (GMP_NUMB_BITS - cnt));
- udiv_qrnnd (dummy, r, r, nshift, d);
+ udiv_qrnnd (dummy, r, r,
+ (n1 << cnt) | (n0 >> (GMP_NUMB_BITS - cnt)),
+ d);
r >>= GMP_NAIL_BITS;
n1 = n0;
}
@@ -165,18 +129,19 @@ mpn_mod_1_unnorm (mp_srcptr up, mp_size_t un, mp_limb_t d)
}
else
{
- mp_limb_t inv, nshift;
+ mp_limb_t inv;
invert_limb (inv, d);
for (i = un - 2; i >= 0; i--)
{
n0 = up[i] << GMP_NAIL_BITS;
- nshift = (n1 << cnt) | (n0 >> (GMP_NUMB_BITS - cnt));
- udiv_rnnd_preinv (r, r, nshift, d, inv);
+ udiv_qrnnd_preinv (dummy, r, r,
+ (n1 << cnt) | (n0 >> (GMP_NUMB_BITS - cnt)),
+ d, inv);
r >>= GMP_NAIL_BITS;
n1 = n0;
}
- udiv_rnnd_preinv (r, r, n1 << cnt, d, inv);
+ udiv_qrnnd_preinv (dummy, r, r, n1 << cnt, d, inv);
r >>= GMP_NAIL_BITS;
return r >> cnt;
}
@@ -222,7 +187,7 @@ mpn_mod_1_norm (mp_srcptr up, mp_size_t un, mp_limb_t d)
for (i = un - 1; i >= 0; i--)
{
n0 = up[i] << GMP_NAIL_BITS;
- udiv_rnnd_preinv (r, r, n0, d, inv);
+ udiv_qrnnd_preinv (dummy, r, r, n0, d, inv);
r >>= GMP_NAIL_BITS;
}
return r;
@@ -242,40 +207,29 @@ mpn_mod_1 (mp_srcptr ap, mp_size_t n, mp_limb_t b)
if (UNLIKELY ((b & GMP_NUMB_HIGHBIT) != 0))
{
- if (BELOW_THRESHOLD (n, MOD_1N_TO_MOD_1_1_THRESHOLD))
- {
- return mpn_mod_1_norm (ap, n, b);
- }
- else
- {
- mp_limb_t pre[4];
- mpn_mod_1_1p_cps (pre, b);
- return mpn_mod_1_1p (ap, n, b, pre);
- }
+ /* The functions below do not handle this large divisor. */
+ return mpn_mod_1_norm (ap, n, b);
+ }
+ else if (BELOW_THRESHOLD (n, MOD_1_1_THRESHOLD))
+ {
+ return mpn_mod_1_unnorm (ap, n, b);
+ }
+ else if (BELOW_THRESHOLD (n, MOD_1_2_THRESHOLD))
+ {
+ mp_limb_t pre[4];
+ mpn_mod_1s_1p_cps (pre, b);
+ return mpn_mod_1s_1p (ap, n, b << pre[1], pre);
+ }
+ else if (BELOW_THRESHOLD (n, MOD_1_4_THRESHOLD) || UNLIKELY (b > GMP_NUMB_MASK / 4))
+ {
+ mp_limb_t pre[5];
+ mpn_mod_1s_2p_cps (pre, b);
+ return mpn_mod_1s_2p (ap, n, b << pre[1], pre);
}
else
{
- if (BELOW_THRESHOLD (n, MOD_1U_TO_MOD_1_1_THRESHOLD))
- {
- return mpn_mod_1_unnorm (ap, n, b);
- }
- else if (BELOW_THRESHOLD (n, MOD_1_1_TO_MOD_1_2_THRESHOLD))
- {
- mp_limb_t pre[4];
- mpn_mod_1_1p_cps (pre, b);
- return mpn_mod_1_1p (ap, n, b << pre[1], pre);
- }
- else if (BELOW_THRESHOLD (n, MOD_1_2_TO_MOD_1_4_THRESHOLD) || UNLIKELY (b > GMP_NUMB_MASK / 4))
- {
- mp_limb_t pre[5];
- mpn_mod_1s_2p_cps (pre, b);
- return mpn_mod_1s_2p (ap, n, b << pre[1], pre);
- }
- else
- {
- mp_limb_t pre[7];
- mpn_mod_1s_4p_cps (pre, b);
- return mpn_mod_1s_4p (ap, n, b << pre[1], pre);
- }
+ mp_limb_t pre[7];
+ mpn_mod_1s_4p_cps (pre, b);
+ return mpn_mod_1s_4p (ap, n, b << pre[1], pre);
}
}
diff --git a/gmp/mpn/generic/mod_1_1.c b/gmp/mpn/generic/mod_1_1.c
index 2e111399ed..27c7f8f1b6 100644
--- a/gmp/mpn/generic/mod_1_1.c
+++ b/gmp/mpn/generic/mod_1_1.c
@@ -1,208 +1,74 @@
-/* mpn_mod_1_1p (ap, n, b, cps)
+/* mpn_mod_1s_1p (ap, n, b, cps)
Divide (ap,,n) by b. Return the single-limb remainder.
+ Requires that b < B / 2.
- Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
- Based on a suggestion by Peter L. Montgomery.
+ 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 2008-2011, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-#ifndef MOD_1_1P_METHOD
-# define MOD_1_1P_METHOD 1 /* need to make sure this is 2 for asm testing */
-#endif
-
-/* Define some longlong.h-style macros, but for wider operations.
- * add_mssaaaa is like longlong.h's add_ssaaaa, but also generates
- * carry out, in the form of a mask. */
-
-#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 MOD_1_1P_METHOD == 1
void
-mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b)
+mpn_mod_1s_1p_cps (mp_limb_t cps[4], mp_limb_t b)
{
mp_limb_t bi;
mp_limb_t B1modb, B2modb;
int cnt;
+ ASSERT (b <= GMP_NUMB_MAX / 2);
+
count_leading_zeros (cnt, b);
b <<= cnt;
invert_limb (bi, b);
- cps[0] = bi;
- cps[1] = cnt;
-
- B1modb = -b;
- if (LIKELY (cnt != 0))
- B1modb *= ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(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_rnd_preinv (B2modb, B1modb, b, bi);
+
+ B1modb >>= cnt;
+ B2modb >>= cnt;
- /* In the normalized case, this can be simplified to
- *
- * B2modb = - b * bi;
- * ASSERT (B2modb <= b); // NB: equality iff b = B/2
- */
- udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
- cps[3] = B2modb >> cnt;
+ cps[0] = bi;
+ cps[1] = cnt;
+ cps[2] = B1modb;
+ cps[3] = B2modb;
}
mp_limb_t
-mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t bmodb[4])
+mpn_mod_1s_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
{
- mp_limb_t rh, rl, bi, ph, pl, r;
+ mp_limb_t rh, rl, bi, q, ph, pl, r;
mp_limb_t B1modb, B2modb;
mp_size_t i;
int cnt;
- mp_limb_t mask;
-
- ASSERT (n >= 2); /* fix tuneup.c if this is changed */
B1modb = bmodb[2];
B2modb = bmodb[3];
- rl = ap[n - 1];
- umul_ppmm (ph, pl, rl, B1modb);
- add_ssaaaa (rh, rl, ph, pl, CNST_LIMB(0), ap[n - 2]);
+ umul_ppmm (ph, pl, ap[n - 1], B1modb);
+ add_ssaaaa (rh, rl, ph, pl, 0, ap[n - 2]);
for (i = n - 3; i >= 0; i -= 1)
{
@@ -211,122 +77,28 @@ mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const 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, CNST_LIMB(0), ap[i]);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[i]);
umul_ppmm (rh, rl, rh, B2modb);
add_ssaaaa (rh, rl, rh, rl, ph, pl);
}
- cnt = bmodb[1];
bi = bmodb[0];
-
- if (LIKELY (cnt != 0))
- rh = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt));
-
- mask = -(mp_limb_t) (rh >= b);
- rh -= mask & b;
-
- udiv_rnnd_preinv (r, rh, rl << cnt, b, bi);
-
- return r >> cnt;
-}
-#endif /* MOD_1_1P_METHOD == 1 */
-
-#if MOD_1_1P_METHOD == 2
-void
-mpn_mod_1_1p_cps (mp_limb_t cps[4], mp_limb_t b)
-{
- mp_limb_t bi;
- mp_limb_t B2modb;
- int cnt;
-
- count_leading_zeros (cnt, b);
-
- b <<= cnt;
- invert_limb (bi, b);
-
- cps[0] = bi;
- cps[1] = cnt;
-
- if (LIKELY (cnt != 0))
- {
- mp_limb_t B1modb = -b;
- B1modb *= ((bi >> (GMP_LIMB_BITS-cnt)) | (CNST_LIMB(1) << cnt));
- ASSERT (B1modb <= b); /* NB: not fully reduced mod b */
- cps[2] = B1modb >> cnt;
- }
- B2modb = - b * bi;
- ASSERT (B2modb <= b); // NB: equality iff b = B/2
- cps[3] = B2modb;
-}
-
-mp_limb_t
-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;
- mp_limb_t r0, r1;
- mp_limb_t r;
-
- ASSERT (n >= 2); /* fix tuneup.c if this is changed */
-
- r0 = ap[n-2];
- r1 = ap[n-1];
-
- if (n > 2)
- {
- mp_limb_t B2modb, B2mb;
- mp_limb_t p0, p1;
- mp_limb_t r2;
- mp_size_t j;
-
- B2modb = bmodb[3];
- B2mb = B2modb - b;
-
- umul_ppmm (p1, p0, r1, B2modb);
- add_mssaaaa (r2, r1, r0, r0, ap[n-3], p1, p0);
-
- for (j = n-4; j >= 0; j--)
- {
- mp_limb_t cy;
- /* mp_limb_t t = r0 + B2mb; */
- umul_ppmm (p1, p0, r1, B2modb);
-
- ADDC_LIMB (cy, r0, r0, r2 & B2modb);
- /* Alternative, for cmov: if (cy) r0 = t; */
- r0 -= (-cy) & b;
- add_mssaaaa (r2, r1, r0, r0, ap[j], p1, p0);
- }
-
- r1 -= (r2 & b);
- }
-
cnt = bmodb[1];
+#if 1
+ {
+ mp_limb_t mask;
+ r = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt));
+ mask = -(mp_limb_t) (r >= b);
+ r -= mask & b;
+ }
+#else
+ udiv_qrnnd_preinv (q, r, rh >> (GMP_LIMB_BITS - cnt),
+ (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt)), b, bi);
+ ASSERT (q <= 1); /* optimize for small quotient? */
+#endif
- if (LIKELY (cnt != 0))
- {
- mp_limb_t t;
- mp_limb_t B1modb = bmodb[2];
-
- umul_ppmm (r1, t, r1, B1modb);
- r0 += t;
- r1 += (r0 < t);
-
- /* Normalize */
- r1 = (r1 << cnt) | (r0 >> (GMP_LIMB_BITS - cnt));
- r0 <<= cnt;
-
- /* NOTE: Might get r1 == b here, but udiv_rnnd_preinv allows that. */
- }
- else
- {
- mp_limb_t mask = -(mp_limb_t) (r1 >= b);
- r1 -= mask & b;
- }
-
- bi = bmodb[0];
+ udiv_qrnnd_preinv (q, r, r, rl << cnt, b, bi);
- udiv_rnnd_preinv (r, r1, r0, b, bi);
return r >> cnt;
}
-#endif /* MOD_1_1P_METHOD == 2 */
diff --git a/gmp/mpn/generic/mod_1_2.c b/gmp/mpn/generic/mod_1_2.c
index 7acf3dbdd1..ffadd536de 100644
--- a/gmp/mpn/generic/mod_1_2.c
+++ b/gmp/mpn/generic/mod_1_2.c
@@ -3,39 +3,27 @@
Requires that b < B / 2.
Contributed to the GNU project by Torbjorn Granlund.
- 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-2010 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -48,75 +36,49 @@ mpn_mod_1s_2p_cps (mp_limb_t cps[5], mp_limb_t b)
mp_limb_t B1modb, B2modb, B3modb;
int cnt;
- ASSERT (b <= (~(mp_limb_t) 0) / 2);
+ ASSERT (b <= GMP_NUMB_MAX / 2);
count_leading_zeros (cnt, b);
b <<= cnt;
invert_limb (bi, b);
- 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_rnd_preinv (B2modb, B1modb, b, bi);
+ udiv_rnd_preinv (B3modb, B2modb, b, bi);
- udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
+ cps[0] = bi;
+ cps[1] = cnt;
+ cps[2] = B1modb >> cnt;
cps[3] = B2modb >> cnt;
-
- udiv_rnnd_preinv (B3modb, B2modb, CNST_LIMB(0), b, bi);
cps[4] = B3modb >> cnt;
-
-#if WANT_ASSERT
- {
- int i;
- b = cps[2];
- for (i = 3; i <= 4; i++)
- {
- b += cps[i];
- ASSERT (b >= cps[i]);
- }
- }
-#endif
}
mp_limb_t
-mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[5])
+mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[5])
{
- mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
+ mp_limb_t rh, rl, bi, q, ph, pl, ch, cl, r;
mp_limb_t B1modb, B2modb, B3modb;
mp_size_t i;
int cnt;
- ASSERT (n >= 1);
-
B1modb = cps[2];
B2modb = cps[3];
B3modb = cps[4];
if ((n & 1) != 0)
{
- if (n == 1)
- {
- rl = ap[n - 1];
- bi = cps[0];
- cnt = cps[1];
- udiv_rnnd_preinv (r, rl >> (GMP_LIMB_BITS - cnt),
- rl << cnt, b, bi);
- return r >> cnt;
- }
-
- umul_ppmm (ph, pl, ap[n - 2], B1modb);
- add_ssaaaa (ph, pl, ph, pl, CNST_LIMB(0), ap[n - 3]);
umul_ppmm (rh, rl, ap[n - 1], B2modb);
+ umul_ppmm (ph, pl, ap[n - 2], B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
add_ssaaaa (rh, rl, rh, rl, ph, pl);
n--;
}
else
{
- rh = ap[n - 1];
- rl = ap[n - 2];
+ umul_ppmm (rh, rl, ap[n - 1], B1modb);
+ add_ssaaaa (rh, rl, rh, rl, 0, ap[n - 2]);
}
for (i = n - 4; i >= 0; i -= 2)
@@ -127,7 +89,7 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const 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, CNST_LIMB(0), ap[i + 0]);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
umul_ppmm (ch, cl, rl, B2modb);
add_ssaaaa (ph, pl, ph, pl, ch, cl);
@@ -136,14 +98,20 @@ mpn_mod_1s_2p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[5])
add_ssaaaa (rh, rl, rh, rl, ph, pl);
}
- umul_ppmm (rh, cl, rh, B1modb);
- add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
-
- cnt = cps[1];
bi = cps[0];
+ cnt = cps[1];
+#if 1
+ umul_ppmm (rh, cl, rh, B1modb);
+ add_ssaaaa (rh, rl, rh, rl, 0, cl);
r = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt));
- udiv_rnnd_preinv (r, r, rl << cnt, b, bi);
+#else
+ udiv_qrnnd_preinv (q, r, rh >> (GMP_LIMB_BITS - cnt),
+ (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt)), b, bi);
+ ASSERT (q <= 2); /* optimize for small quotient? */
+#endif
+
+ udiv_qrnnd_preinv (q, r, r, rl << cnt, b, bi);
return r >> cnt;
}
diff --git a/gmp/mpn/generic/mod_1_3.c b/gmp/mpn/generic/mod_1_3.c
index f4137f4315..77989fc0ae 100644
--- a/gmp/mpn/generic/mod_1_3.c
+++ b/gmp/mpn/generic/mod_1_3.c
@@ -3,39 +3,27 @@
Requires that d < B / 3.
Contributed to the GNU project by Torbjorn Granlund.
- 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-2010, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -48,82 +36,46 @@ mpn_mod_1s_3p_cps (mp_limb_t cps[6], mp_limb_t b)
mp_limb_t B1modb, B2modb, B3modb, B4modb;
int cnt;
- ASSERT (b <= (~(mp_limb_t) 0) / 3);
+ ASSERT (b <= GMP_NUMB_MAX / 3);
count_leading_zeros (cnt, b);
b <<= cnt;
invert_limb (bi, b);
- 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_rnd_preinv (B2modb, B1modb, b, bi);
+ udiv_rnd_preinv (B3modb, B2modb, b, bi);
+ udiv_rnd_preinv (B4modb, B3modb, b, bi);
- udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
+ cps[0] = bi;
+ cps[1] = cnt;
+ cps[2] = B1modb >> cnt;
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;
-
-#if WANT_ASSERT
- {
- int i;
- b = cps[2];
- for (i = 3; i <= 5; i++)
- {
- b += cps[i];
- ASSERT (b >= cps[i]);
- }
- }
-#endif
}
mp_limb_t
-mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[6])
+mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[6])
{
- mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
+ mp_limb_t rh, rl, bi, q, ph, pl, ch, cl, r;
mp_limb_t B1modb, B2modb, B3modb, B4modb;
mp_size_t i;
int cnt;
- ASSERT (n >= 1);
-
B1modb = cps[2];
B2modb = cps[3];
B3modb = cps[4];
B4modb = cps[5];
- /* We compute n mod 3 in a tricky way, which works except for when n is so
- close to the maximum size that we don't need to support it. The final
- cast to int is a workaround for HP cc. */
- switch ((int) ((mp_limb_t) n * MODLIMB_INVERSE_3 >> (GMP_NUMB_BITS - 2)))
- {
- case 0:
- umul_ppmm (ph, pl, ap[n - 2], B1modb);
- 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;
- break;
- case 2: /* n mod 3 = 1 */
- rh = 0;
- rl = ap[n - 1];
- n -= 1;
- break;
- case 1: /* n mod 3 = 2 */
- rh = ap[n - 1];
- rl = ap[n - 2];
- n -= 2;
- break;
- }
+ umul_ppmm (ph, pl, ap[n - 2], B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
+ umul_ppmm (ch, cl, ap[n - 1], B2modb);
+ add_ssaaaa (rh, rl, ph, pl, ch, cl);
- for (i = n - 3; i >= 0; i -= 3)
+ for (i = n - 6; i >= 0; i -= 3)
{
/* rr = ap[i] < B
+ ap[i+1] * (B mod b) <= (B-1)(b-1)
@@ -132,7 +84,7 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const 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, CNST_LIMB(0), ap[i + 0]);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
umul_ppmm (ch, cl, ap[i + 2], B2modb);
add_ssaaaa (ph, pl, ph, pl, ch, cl);
@@ -144,14 +96,35 @@ mpn_mod_1s_3p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[6])
add_ssaaaa (rh, rl, rh, rl, ph, pl);
}
- umul_ppmm (rh, cl, rh, B1modb);
- add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
+ if (i >= -2)
+ {
+ umul_ppmm (ph, pl, rl, B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 2]);
+ umul_ppmm (rh, rl, rh, B2modb);
+ add_ssaaaa (rh, rl, rh, rl, ph, pl);
+ if (i >= -1)
+ {
+ umul_ppmm (ph, pl, rl, B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[0]);
+ umul_ppmm (rh, rl, rh, B2modb);
+ add_ssaaaa (rh, rl, rh, rl, ph, pl);
+ }
+ }
- cnt = cps[1];
bi = cps[0];
+ cnt = cps[1];
+#if 1
+ umul_ppmm (rh, cl, rh, B1modb);
+ add_ssaaaa (rh, rl, rh, rl, 0, cl);
r = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt));
- udiv_rnnd_preinv (r, r, rl << cnt, b, bi);
+#else
+ udiv_qrnnd_preinv (q, r, rh >> (GMP_LIMB_BITS - cnt),
+ (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt)), b, bi);
+ ASSERT (q <= 3); /* optimize for small quotient? */
+#endif
+
+ udiv_qrnnd_preinv (q, r, r, rl << cnt, b, bi);
return r >> cnt;
}
diff --git a/gmp/mpn/generic/mod_1_4.c b/gmp/mpn/generic/mod_1_4.c
index 716a0c66de..74893386a9 100644
--- a/gmp/mpn/generic/mod_1_4.c
+++ b/gmp/mpn/generic/mod_1_4.c
@@ -1,41 +1,29 @@
-/* mpn_mod_1s_4p (ap, n, b, cps)
+/* mpn_mod_1s_3p (ap, n, b, cps)
Divide (ap,,n) by b. Return the single-limb remainder.
Requires that d < B / 4.
Contributed to the GNU project by Torbjorn Granlund.
- 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-2010 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -48,92 +36,53 @@ mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb;
int cnt;
- ASSERT (b <= (~(mp_limb_t) 0) / 4);
+ ASSERT (b <= GMP_NUMB_MAX / 4);
count_leading_zeros (cnt, b);
b <<= cnt;
invert_limb (bi, b);
- 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_rnd_preinv (B2modb, B1modb, b, bi);
+ udiv_rnd_preinv (B3modb, B2modb, b, bi);
+ udiv_rnd_preinv (B4modb, B3modb, b, bi);
+ udiv_rnd_preinv (B5modb, B4modb, b, bi);
- udiv_rnnd_preinv (B2modb, B1modb, CNST_LIMB(0), b, bi);
+ cps[0] = bi;
+ cps[1] = cnt;
+ cps[2] = B1modb >> cnt;
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
- {
- int i;
- b = cps[2];
- for (i = 3; i <= 6; i++)
- {
- b += cps[i];
- ASSERT (b >= cps[i]);
- }
- }
-#endif
}
mp_limb_t
-mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[7])
+mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t cps[7])
{
- mp_limb_t rh, rl, bi, ph, pl, ch, cl, r;
+ mp_limb_t rh, rl, bi, q, ph, pl, ch, cl, r;
mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb;
mp_size_t i;
int cnt;
- ASSERT (n >= 1);
-
B1modb = cps[2];
B2modb = cps[3];
B3modb = cps[4];
B4modb = cps[5];
B5modb = cps[6];
- switch (n & 3)
- {
- case 0:
- umul_ppmm (ph, pl, ap[n - 3], B1modb);
- 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);
- add_ssaaaa (rh, rl, rh, rl, ph, pl);
- n -= 4;
- break;
- case 1:
- rh = 0;
- rl = ap[n - 1];
- n -= 1;
- break;
- case 2:
- rh = ap[n - 1];
- rl = ap[n - 2];
- n -= 2;
- break;
- case 3:
- umul_ppmm (ph, pl, ap[n - 2], B1modb);
- 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;
- break;
- }
+ umul_ppmm (ph, pl, ap[n - 3], B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 4]);
+
+ umul_ppmm (ch, cl, ap[n - 2], B2modb);
+ add_ssaaaa (ph, pl, ph, pl, ch, cl);
- for (i = n - 4; i >= 0; i -= 4)
+ umul_ppmm (ch, cl, ap[n - 1], B3modb);
+ add_ssaaaa (rh, rl, ph, pl, ch, cl);
+
+ for (i = n - 8; i >= 0; i -= 4)
{
/* rr = ap[i] < B
+ ap[i+1] * (B mod b) <= (B-1)(b-1)
@@ -143,7 +92,7 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const 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, CNST_LIMB(0), ap[i + 0]);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 0]);
umul_ppmm (ch, cl, ap[i + 2], B2modb);
add_ssaaaa (ph, pl, ph, pl, ch, cl);
@@ -158,14 +107,42 @@ mpn_mod_1s_4p (mp_srcptr ap, mp_size_t n, mp_limb_t b, const mp_limb_t cps[7])
add_ssaaaa (rh, rl, rh, rl, ph, pl);
}
- umul_ppmm (rh, cl, rh, B1modb);
- add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
+ if (i >= -3)
+ {
+ umul_ppmm (ph, pl, rl, B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 3]);
+ umul_ppmm (rh, rl, rh, B2modb);
+ add_ssaaaa (rh, rl, rh, rl, ph, pl);
+ if (i >= -2)
+ {
+ umul_ppmm (ph, pl, rl, B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[i + 2]);
+ umul_ppmm (rh, rl, rh, B2modb);
+ add_ssaaaa (rh, rl, rh, rl, ph, pl);
+ if (i >= -1)
+ {
+ umul_ppmm (ph, pl, rl, B1modb);
+ add_ssaaaa (ph, pl, ph, pl, 0, ap[0]);
+ umul_ppmm (rh, rl, rh, B2modb);
+ add_ssaaaa (rh, rl, rh, rl, ph, pl);
+ }
+ }
+ }
- cnt = cps[1];
bi = cps[0];
+ cnt = cps[1];
+#if 1
+ umul_ppmm (rh, cl, rh, B1modb);
+ add_ssaaaa (rh, rl, rh, rl, 0, cl);
r = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt));
- udiv_rnnd_preinv (r, r, rl << cnt, b, bi);
+#else
+ udiv_qrnnd_preinv (q, r, rh >> (GMP_LIMB_BITS - cnt),
+ (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt)), b, bi);
+ ASSERT (q <= 4); /* optimize for small quotient? */
+#endif
+
+ udiv_qrnnd_preinv (q, r, r, rl << cnt, b, bi);
return r >> cnt;
}
diff --git a/gmp/mpn/generic/mod_34lsub1.c b/gmp/mpn/generic/mod_34lsub1.c
index 7c07af7acc..6bd149892d 100644
--- a/gmp/mpn/generic/mod_34lsub1.c
+++ b/gmp/mpn/generic/mod_34lsub1.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/mode1o.c b/gmp/mpn/generic/mode1o.c
index ec91da223d..064becdadf 100644
--- a/gmp/mpn/generic/mode1o.c
+++ b/gmp/mpn/generic/mode1o.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2004 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -41,7 +30,7 @@ see https://www.gnu.org/licenses/. */
r*B^k + a - c == q*d
- where B=2^GMP_LIMB_BITS, a is {src,size}, k is either size or size-1
+ where B=2^BITS_PER_MP_LIMB, a is {src,size}, k is either size or size-1
(the caller won't know which), and q is the quotient (discarded). d must
be odd, c can be any limb value.
diff --git a/gmp/mpn/generic/mu_bdiv_q.c b/gmp/mpn/generic/mu_bdiv_q.c
index 0a8010ec15..3b5f56d088 100644
--- a/gmp/mpn/generic/mu_bdiv_q.c
+++ b/gmp/mpn/generic/mu_bdiv_q.c
@@ -4,44 +4,40 @@
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 GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
-Copyright 2005-2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005, 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 idea of the algorithm used herein is to compute a smaller inverted value
- than used in the standard Barrett algorithm, and thus save time in the
- Newton iterations, and pay just a small price when using the inverted value
- for developing quotient bits. This algorithm was presented at ICMS 2006.
+/* We use the "misunderstanding algorithm" (MU), discovered by Paul Zimmermann
+ and Torbjorn Granlund when Torbjorn misunderstood Paul's explanation of
+ Jebelean's bidirectional exact division algorithm.
+
+ The idea of this algorithm is to compute a smaller inverted value than used
+ in the standard Barrett algorithm, and thus save time in the Newton
+ iterations, and pay just a small price when using the inverted value for
+ developing quotient bits.
+
+ Written by Torbjorn Granlund. Paul Zimmermann suggested the use of the
+ "wrap around" trick.
*/
#include "gmp.h"
@@ -53,10 +49,11 @@ see https://www.gnu.org/licenses/. */
Requirements: N >= D
D >= 1
+ N mod D = 0
D odd
dn >= 2
nn >= 2
- scratch space as determined by mpn_mu_bdiv_q_itch(nn,dn).
+ scratch space as determined by mpn_divexact_itch(nn,dn).
Write quotient to Q = {qp,nn}.
@@ -72,10 +69,10 @@ mpn_mu_bdiv_q (mp_ptr qp,
mp_srcptr dp, mp_size_t dn,
mp_ptr scratch)
{
+ mp_ptr ip;
+ mp_ptr rp;
mp_size_t qn;
mp_size_t in;
- int cy, c0;
- mp_size_t tn, wn;
qn = nn;
@@ -85,52 +82,74 @@ mpn_mu_bdiv_q (mp_ptr qp,
if (qn > dn)
{
mp_size_t b;
+ mp_ptr tp;
+ mp_limb_t cy;
+ int k;
+ mp_size_t m, wn;
+ mp_size_t i;
/* |_______________________| dividend
|________| divisor */
-#define ip scratch /* in */
-#define rp (scratch + in) /* dn or rest >= binvert_itch(in) */
-#define tp (scratch + in + dn) /* dn+in or next_size(dn) */
-#define scratch_out (scratch + in + dn + tn) /* mulmod_bnm1_itch(next_size(dn)) */
-
/* Compute an inverse size that is a nice partition of the quotient. */
b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
/* Some notes on allocation:
- When in = dn, R dies when mpn_mullo returns, if in < dn the low in
+ When in = dn, R dies when mpn_mullow returns, if in < dn the low in
limbs of R dies at that point. We could save memory by letting T live
just under R, and let the upper part of T expand into R. These changes
should reduce itch to perhaps 3dn.
*/
- mpn_binvert (ip, dp, in, rp);
+ ip = scratch; /* in limbs */
+ rp = scratch + in; /* dn limbs */
+ tp = scratch + in + dn; /* dn + in limbs FIXME: mpn_fft_next_size */
+ scratch += in; /* Roughly 2in+1 limbs */
+
+ mpn_binvert (ip, dp, in, scratch);
cy = 0;
MPN_COPY (rp, np, dn);
np += dn;
- mpn_mullo_n (qp, rp, ip, in);
+ mpn_mullow_n (qp, rp, ip, in);
qn -= in;
+ if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD))
+ {
+ k = mpn_fft_best_k (dn, 0);
+ m = mpn_fft_next_size (dn, k);
+ wn = dn + in - m; /* number of wrapped limbs */
+ ASSERT_ALWAYS (wn >= 0); /* could handle this below */
+ }
+
while (qn > in)
{
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[dn+in-1...in] */
- else
+#if WANT_FFT
+ if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD))
{
- tn = mpn_mulmod_bnm1_next_size (dn);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out);
- wn = dn + in - tn; /* number of wrapped limbs */
- if (wn > 0)
- {
- c0 = mpn_sub_n (tp + tn, tp, rp, wn);
- mpn_decr_u (tp + wn, c0);
- }
+ /* The two multiplicands are dn and 'in' limbs, with dn >= in.
+ The relevant part of the result will typically partially wrap,
+ and that part will come out as subtracted to the right. The
+ unwrapped part, m-in limbs at the high end of tp, is the lower
+ part of the sought product. The wrapped part, at the low end
+ of tp, will be subtracted from the low part of the partial
+ remainder; we undo that operation with another subtraction. */
+ int c0;
+
+ mpn_mul_fft (tp, m, dp, dn, qp, in, k);
+
+ c0 = mpn_sub_n (tp + m, rp, tp, wn);
+
+ for (i = wn; c0 != 0 && i < in; i++)
+ c0 = tp[i] == GMP_NUMB_MASK;
+ mpn_incr_u (tp + in, c0);
}
-
+ else
+#endif
+ mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[dn+in-1...in] */
qp += in;
if (dn != in)
{
@@ -145,28 +164,29 @@ mpn_mu_bdiv_q (mp_ptr qp,
/* Subtract tp[dn+in-1...dn] from dividend. */
cy = mpn_sub_nc (rp + dn - in, np, tp + dn, in, cy);
np += in;
- mpn_mullo_n (qp, rp, ip, in);
+ mpn_mullow_n (qp, rp, ip, in);
qn -= in;
}
/* Generate last qn limbs.
FIXME: It should be possible to limit precision here, since qn is
typically somewhat smaller than dn. No big gains expected. */
-
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[qn+in-1...in] */
- else
+#if WANT_FFT
+ if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD))
{
- tn = mpn_mulmod_bnm1_next_size (dn);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out);
- wn = dn + in - tn; /* number of wrapped limbs */
- if (wn > 0)
- {
- c0 = mpn_sub_n (tp + tn, tp, rp, wn);
- mpn_decr_u (tp + wn, c0);
- }
- }
+ int c0;
+
+ mpn_mul_fft (tp, m, dp, dn, qp, in, k);
+
+ c0 = mpn_sub_n (tp + m, rp, tp, wn);
+ for (i = wn; c0 != 0 && i < in; i++)
+ c0 = tp[i] == GMP_NUMB_MASK;
+ mpn_incr_u (tp + in, c0);
+ }
+ else
+#endif
+ mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[qn+in-1...in] */
qp += in;
if (dn != in)
{
@@ -179,93 +199,57 @@ mpn_mu_bdiv_q (mp_ptr qp,
}
mpn_sub_nc (rp + dn - in, np, tp + dn, qn - (dn - in), cy);
- mpn_mullo_n (qp, rp, ip, qn);
-
-#undef ip
-#undef rp
-#undef tp
-#undef scratch_out
- }
+ mpn_mullow_n (qp, rp, ip, qn);
+ }
else
{
/* |_______________________| dividend
|________________| divisor */
-#define ip scratch /* in */
-#define tp (scratch + in) /* qn+in or next_size(qn) or rest >= binvert_itch(in) */
-#define scratch_out (scratch + in + tn)/* mulmod_bnm1_itch(next_size(qn)) */
-
/* Compute half-sized inverse. */
in = qn - (qn >> 1);
- mpn_binvert (ip, dp, in, tp);
+ ip = scratch; /* ceil(qn/2) limbs */
+ rp = scratch + in; /* ceil(qn/2)+qn limbs */
+ scratch += in; /* 2*ceil(qn/2)+2 */
- mpn_mullo_n (qp, np, ip, in); /* low `in' quotient limbs */
+ mpn_binvert (ip, dp, in, scratch);
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, qn, qp, in); /* mulhigh */
- else
+ mpn_mullow_n (qp, np, ip, in); /* low `in' quotient limbs */
+#if WANT_FFT
+ if (ABOVE_THRESHOLD (qn, MUL_FFT_MODF_THRESHOLD))
{
- tn = mpn_mulmod_bnm1_next_size (qn);
- mpn_mulmod_bnm1 (tp, tn, dp, qn, qp, in, scratch_out);
- wn = qn + in - tn; /* number of wrapped limbs */
- if (wn > 0)
- {
- c0 = mpn_cmp (tp, np, wn) < 0;
- mpn_decr_u (tp + wn, c0);
- }
+ int k;
+ mp_size_t m;
+
+ k = mpn_fft_best_k (qn, 0);
+ m = mpn_fft_next_size (qn, k);
+ mpn_mul_fft (rp, m, dp, qn, qp, in, k);
+ if (mpn_cmp (np, rp, in) < 0)
+ mpn_incr_u (rp + in, 1);
}
+ else
+#endif
+ mpn_mul (rp, dp, qn, qp, in); /* mulhigh */
- mpn_sub_n (tp, np + in, tp + in, qn - in);
- mpn_mullo_n (qp + in, tp, ip, qn - in); /* high qn-in quotient limbs */
-
-#undef ip
-#undef tp
-#undef scratch_out
+ mpn_sub_n (rp, np + in, rp + in, qn - in);
+ mpn_mullow_n (qp + in, rp, ip, qn - in); /* high qn-in quotient limbs */
}
}
mp_size_t
mpn_mu_bdiv_q_itch (mp_size_t nn, mp_size_t dn)
{
- mp_size_t qn, in, tn, itch_binvert, itch_out, itches;
- mp_size_t b;
+ mp_size_t qn;
qn = nn;
if (qn > dn)
{
- b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
- in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- {
- tn = dn + in;
- itch_out = 0;
- }
- else
- {
- tn = mpn_mulmod_bnm1_next_size (dn);
- itch_out = mpn_mulmod_bnm1_itch (tn, dn, in);
- }
- itch_binvert = mpn_binvert_itch (in);
- itches = dn + tn + itch_out;
- return in + MAX (itches, itch_binvert);
+ return 4 * dn; /* FIXME FIXME FIXME need mpn_fft_next_size */
}
else
{
- in = qn - (qn >> 1);
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- {
- tn = qn + in;
- itch_out = 0;
- }
- else
- {
- tn = mpn_mulmod_bnm1_next_size (qn);
- itch_out = mpn_mulmod_bnm1_itch (tn, qn, in);
- }
- itch_binvert = mpn_binvert_itch (in);
- itches = tn + itch_out;
- return in + MAX (itches, itch_binvert);
+ return 2 * qn + 1 + 2; /* FIXME FIXME FIXME need mpn_fft_next_size */
}
}
diff --git a/gmp/mpn/generic/mu_bdiv_qr.c b/gmp/mpn/generic/mu_bdiv_qr.c
index d265440f2b..e66b4a117e 100644
--- a/gmp/mpn/generic/mu_bdiv_qr.c
+++ b/gmp/mpn/generic/mu_bdiv_qr.c
@@ -1,289 +1,51 @@
-/* mpn_mu_bdiv_qr(qp,rp,np,nn,dp,dn,tp) -- Compute {np,nn} / {dp,dn} mod B^qn,
- where qn = nn-dn, storing the result in {qp,qn}. Overlap allowed between Q
- and N; all other overlap disallowed.
+/* mpn_mu_bdiv_qr -- divide-and-conquer Hensel division using a variant of
+ Barrett's algorithm, returning quotient and remainder.
- Contributed to the GNU project by Torbjorn Granlund.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
- THE FUNCTIONS IN THIS FILE 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 2005-2007, 2009, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2005, 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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/. */
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+License for more details.
-
-/*
- The idea of the algorithm used herein is to compute a smaller inverted value
- than used in the standard Barrett algorithm, and thus save time in the
- Newton iterations, and pay just a small price when using the inverted value
- for developing quotient bits. This algorithm was presented at ICMS 2006.
-*/
+You should have 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"
-/* N = {np,nn}
- D = {dp,dn}
+/* Computes Hensel binary division of {np, 2*n} by {dp, n}.
+
+ Output:
+
+ q = n * d^{-1} mod 2^{qn * GMP_NUMB_BITS},
- Requirements: N >= D
- D >= 1
- D odd
- dn >= 2
- nn >= 2
- scratch space as determined by mpn_mu_bdiv_qr_itch(nn,dn).
+ r = (n - q * d) * 2^{-qn * GMP_NUMB_BITS}
- Write quotient to Q = {qp,nn-dn}.
+ Stores q at qp. Stores the n least significant limbs of r at the high half
+ of np, and returns the borrow from the subtraction n - q*d.
- FIXME: When iterating, perhaps do the small step before loop, not after.
- FIXME: Try to avoid the scalar divisions when computing inverse size.
- FIXME: Trim allocation for (qn > dn) case, 3*dn might be possible. In
- particular, when dn==in, tp and rp could use the same space.
-*/
-mp_limb_t
+ d must be odd. dinv is (-d)^-1 mod 2^GMP_NUMB_BITS. */
+
+void
mpn_mu_bdiv_qr (mp_ptr qp,
mp_ptr rp,
mp_srcptr np, mp_size_t nn,
mp_srcptr dp, mp_size_t dn,
mp_ptr scratch)
{
- mp_size_t qn;
- mp_size_t in;
- mp_limb_t cy, c0;
- mp_size_t tn, wn;
-
- qn = nn - dn;
-
- ASSERT (dn >= 2);
- ASSERT (qn >= 2);
-
- if (qn > dn)
- {
- mp_size_t b;
-
- /* |_______________________| dividend
- |________| divisor */
-
-#define ip scratch /* in */
-#define tp (scratch + in) /* dn+in or next_size(dn) or rest >= binvert_itch(in) */
-#define scratch_out (scratch + in + tn)/* mulmod_bnm1_itch(next_size(dn)) */
-
- /* Compute an inverse size that is a nice partition of the quotient. */
- b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
- in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
-
- /* Some notes on allocation:
-
- When in = dn, R dies when mpn_mullo returns, if in < dn the low in
- limbs of R dies at that point. We could save memory by letting T live
- just under R, and let the upper part of T expand into R. These changes
- should reduce itch to perhaps 3dn.
- */
-
- mpn_binvert (ip, dp, in, tp);
-
- MPN_COPY (rp, np, dn);
- np += dn;
- cy = 0;
-
- while (qn > in)
- {
- mpn_mullo_n (qp, rp, ip, in);
-
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, in); /* mulhi, need tp[dn+in-1...in] */
- else
- {
- tn = mpn_mulmod_bnm1_next_size (dn);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out);
- wn = dn + in - tn; /* number of wrapped limbs */
- if (wn > 0)
- {
- c0 = mpn_sub_n (tp + tn, tp, rp, wn);
- mpn_decr_u (tp + wn, c0);
- }
- }
-
- qp += in;
- qn -= in;
-
- if (dn != in)
- {
- /* Subtract tp[dn-1...in] from partial remainder. */
- cy += mpn_sub_n (rp, rp + in, tp + in, dn - in);
- if (cy == 2)
- {
- mpn_incr_u (tp + dn, 1);
- cy = 1;
- }
- }
- /* Subtract tp[dn+in-1...dn] from dividend. */
- cy = mpn_sub_nc (rp + dn - in, np, tp + dn, in, cy);
- np += in;
- }
-
- /* Generate last qn limbs. */
- mpn_mullo_n (qp, rp, ip, qn);
-
- if (BELOW_THRESHOLD (qn, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, qn); /* mulhi, need tp[qn+in-1...in] */
- else
- {
- tn = mpn_mulmod_bnm1_next_size (dn);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, qn, scratch_out);
- wn = dn + qn - tn; /* number of wrapped limbs */
- if (wn > 0)
- {
- c0 = mpn_sub_n (tp + tn, tp, rp, wn);
- mpn_decr_u (tp + wn, c0);
- }
- }
-
- if (dn != qn)
- {
- cy += mpn_sub_n (rp, rp + qn, tp + qn, dn - qn);
- if (cy == 2)
- {
- mpn_incr_u (tp + dn, 1);
- cy = 1;
- }
- }
- return mpn_sub_nc (rp + dn - qn, np, tp + dn, qn, cy);
-
-#undef ip
-#undef tp
-#undef scratch_out
- }
- else
- {
- /* |_______________________| dividend
- |________________| divisor */
-
-#define ip scratch /* in */
-#define tp (scratch + in) /* dn+in or next_size(dn) or rest >= binvert_itch(in) */
-#define scratch_out (scratch + in + tn)/* mulmod_bnm1_itch(next_size(dn)) */
-
- /* Compute half-sized inverse. */
- in = qn - (qn >> 1);
-
- mpn_binvert (ip, dp, in, tp);
-
- mpn_mullo_n (qp, np, ip, in); /* low `in' quotient limbs */
-
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, in); /* mulhigh */
- else
- {
- tn = mpn_mulmod_bnm1_next_size (dn);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out);
- wn = dn + in - tn; /* number of wrapped limbs */
- if (wn > 0)
- {
- c0 = mpn_sub_n (tp + tn, tp, np, wn);
- mpn_decr_u (tp + wn, c0);
- }
- }
-
- qp += in;
- qn -= in;
-
- cy = mpn_sub_n (rp, np + in, tp + in, dn);
- mpn_mullo_n (qp, rp, ip, qn); /* high qn quotient limbs */
-
- if (BELOW_THRESHOLD (qn, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, qn); /* mulhigh */
- else
- {
- tn = mpn_mulmod_bnm1_next_size (dn);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, qn, scratch_out);
- wn = dn + qn - tn; /* number of wrapped limbs */
- if (wn > 0)
- {
- c0 = mpn_sub_n (tp + tn, tp, rp, wn);
- mpn_decr_u (tp + wn, c0);
- }
- }
-
- cy += mpn_sub_n (rp, rp + qn, tp + qn, dn - qn);
- if (cy == 2)
- {
- mpn_incr_u (tp + dn, 1);
- cy = 1;
- }
- return mpn_sub_nc (rp + dn - qn, np + dn + in, tp + dn, qn, cy);
-
-#undef ip
-#undef tp
-#undef scratch_out
- }
-}
-
-mp_size_t
-mpn_mu_bdiv_qr_itch (mp_size_t nn, mp_size_t dn)
-{
- mp_size_t qn, in, tn, itch_binvert, itch_out, itches;
- mp_size_t b;
-
- qn = nn - dn;
-
- if (qn > dn)
- {
- b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
- in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- {
- tn = dn + in;
- itch_out = 0;
- }
- else
- {
- tn = mpn_mulmod_bnm1_next_size (dn);
- itch_out = mpn_mulmod_bnm1_itch (tn, dn, in);
- }
- itch_binvert = mpn_binvert_itch (in);
- itches = tn + itch_out;
- return in + MAX (itches, itch_binvert);
- }
- else
- {
- in = qn - (qn >> 1);
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- {
- tn = dn + in;
- itch_out = 0;
- }
- else
- {
- tn = mpn_mulmod_bnm1_next_size (dn);
- itch_out = mpn_mulmod_bnm1_itch (tn, dn, in);
- }
- }
- itch_binvert = mpn_binvert_itch (in);
- itches = tn + itch_out;
- return in + MAX (itches, itch_binvert);
+ ASSERT_ALWAYS (0);
}
diff --git a/gmp/mpn/generic/mu_div_q.c b/gmp/mpn/generic/mu_div_q.c
index 8768ba6c60..150e8b77cd 100644
--- a/gmp/mpn/generic/mu_div_q.c
+++ b/gmp/mpn/generic/mu_div_q.c
@@ -1,46 +1,29 @@
-/* mpn_mu_div_q.
+/* mpn_mu_div_q, mpn_preinv_mu_div_q.
- Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
+ 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 GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
-Copyright 2005-2007, 2009, 2010, 2013 Free Software Foundation, Inc.
+Copyright 2005, 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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/. */
+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/. */
-/*
- The idea of the algorithm used herein is to compute a smaller inverted value
- than used in the standard Barrett algorithm, and thus save time in the
- Newton iterations, and pay just a small price when using the inverted value
- for developing quotient bits. This algorithm was presented at ICMS 2006.
-*/
/*
Things to work on:
@@ -48,14 +31,18 @@ see https://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.
- 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.
+ 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. Instead of falling back to mpn_mu_div_qr when we detect a possible
+ mpn_mu_divappr_q rounding problem, we could multiply and compare.
Unfortunately, since mpn_mu_divappr_q does not return the partial
- remainder, this also doesn't become optimal. A mpn_mu_divappr_qr could
- solve that.
+ remainder, this also doesn't become optimal. A mpn_mu_divappr_qr
+ could solve that.
- 3. The allocations done here should be made from the scratch area, which
- then would need to be amended.
+ 3. The allocations done here should be made from the scratch area.
*/
#include <stdlib.h> /* for NULL */
@@ -65,13 +52,13 @@ see https://www.gnu.org/licenses/. */
mp_limb_t
mpn_mu_div_q (mp_ptr qp,
- mp_srcptr np, mp_size_t nn,
+ mp_ptr np, mp_size_t nn,
mp_srcptr dp, mp_size_t dn,
mp_ptr scratch)
{
- mp_ptr tp, rp;
- mp_size_t qn;
- mp_limb_t cy, qh;
+ mp_ptr tp, rp, ip, this_ip;
+ mp_size_t qn, in, this_in;
+ mp_limb_t cy;
TMP_DECL;
TMP_MARK;
@@ -82,28 +69,59 @@ mpn_mu_div_q (mp_ptr qp,
if (qn >= dn) /* nn >= 2*dn + 1 */
{
- /* |_______________________| dividend
- |________| divisor */
+ /* Find max inverse size needed by the two preinv calls. */
+ if (dn != qn)
+ {
+ mp_size_t in1, in2;
- rp = TMP_BALLOC_LIMBS (nn + 1);
- MPN_COPY (rp + 1, np, nn);
- rp[0] = 0;
+ 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);
+ }
- 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);
+ ip = TMP_BALLOC_LIMBS (in + 1);
- cy = mpn_mu_divappr_q (tp, rp, nn + 1, dp, dn, scratch);
+ if (dn == in)
+ {
+ MPN_COPY (scratch + 1, dp, in);
+ scratch[0] = 1;
+ mpn_invert (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_invert (ip, scratch, in + 1, NULL);
+ MPN_COPY_INCR (ip, ip + 1, in);
+ }
+ }
- if (UNLIKELY (cy != 0))
+ /* |_______________________| dividend
+ |________| divisor */
+ rp = TMP_BALLOC_LIMBS (2 * dn + 1);
+ if (dn != qn) /* FIXME: perhaps mpn_mu_div_qr should DTRT */
{
- /* Since the partial remainder fed to mpn_preinv_mu_divappr_q was
- canonically reduced, replace the returned value of B^(qn-dn)+eps
- by the largest possible value. */
- mp_size_t i;
- for (i = 0; i < qn + 1; i++)
- tp[i] = GMP_NUMB_MAX;
+ this_in = mpn_mu_div_qr_choose_in (qn - dn, dn, 0);
+ this_ip = ip + in - this_in;
+ mpn_preinv_mu_div_qr (tp + dn + 1, rp + dn + 1, np + dn, qn, dp, dn,
+ this_ip, this_in, scratch);
}
+ else
+ MPN_COPY (rp + dn + 1, np + dn, dn);
+
+ MPN_COPY (rp + 1, np, dn);
+ rp[0] = 0;
+ this_in = mpn_mu_divappr_q_choose_in (dn + 1, dn, 0);
+ this_ip = ip + in - this_in;
+ mpn_preinv_mu_divappr_q (tp, rp, 2*dn + 1, dp, dn, this_ip, this_in, scratch);
/* The max error of mpn_mu_divappr_q is +4. If the low quotient limb is
greater than the max error, we cannot trust the quotient. */
@@ -113,73 +131,27 @@ mpn_mu_div_q (mp_ptr qp,
}
else
{
- mp_limb_t cy;
- mp_ptr pp;
-
- pp = rp;
- mpn_mul (pp, tp + 1, qn, dp, dn);
-
- cy = (qh != 0) ? mpn_add_n (pp + qn, pp + qn, dp, dn) : 0;
-
- if (cy || mpn_cmp (pp, np, nn) > 0) /* At most is wrong by one, no cycle. */
- qh -= mpn_sub_1 (qp, tp + 1, qn, 1);
- else /* Same as above */
- MPN_COPY (qp, tp + 1, qn);
+ /* Fall back to plain mpn_mu_div_qr. */
+ mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch);
}
}
else
{
/* |_______________________| dividend
|________________| divisor */
+ mpn_mu_divappr_q (tp, np + nn - (2*qn + 2), 2*qn + 2, dp + dn - (qn + 1), qn + 1, scratch);
- /* FIXME: When nn = 2dn-1, qn becomes dn-1, and the numerator size passed
- here becomes 2dn, i.e., more than nn. This shouldn't hurt, since only
- the most significant dn-1 limbs will actually be read, but it is not
- pretty. */
-
- qh = mpn_mu_divappr_q (tp, np + nn - (2 * qn + 2), 2 * qn + 2,
- dp + dn - (qn + 1), qn + 1, scratch);
-
- /* The max error of mpn_mu_divappr_q is +4, but we get an additional
- error from the divisor truncation. */
- if (tp[0] > 6)
+ if (tp[0] > 4)
{
MPN_COPY (qp, tp + 1, qn);
}
else
{
- mp_limb_t cy;
-
- /* FIXME: a shorter product should be enough; we may use already
- allocated space... */
- rp = TMP_BALLOC_LIMBS (nn);
- mpn_mul (rp, dp, dn, tp + 1, qn);
-
- cy = (qh != 0) ? mpn_add_n (rp + qn, rp + qn, dp, dn) : 0;
-
- if (cy || mpn_cmp (rp, np, nn) > 0) /* At most is wrong by one, no cycle. */
- qh -= mpn_sub_1 (qp, tp + 1, qn, 1);
- else /* Same as above */
- MPN_COPY (qp, tp + 1, qn);
+ rp = TMP_BALLOC_LIMBS (dn);
+ mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch);
}
}
TMP_FREE;
- return qh;
-}
-
-mp_size_t
-mpn_mu_div_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
-{
- mp_size_t qn;
-
- qn = nn - dn;
- if (qn >= dn)
- {
- return mpn_mu_divappr_q_itch (nn + 1, dn, mua_k);
- }
- else
- {
- return mpn_mu_divappr_q_itch (2 * qn + 2, qn + 1, mua_k);
- }
+ return 0;
}
diff --git a/gmp/mpn/generic/mu_div_qr.c b/gmp/mpn/generic/mu_div_qr.c
index f4700a1ea6..9049e5907a 100644
--- a/gmp/mpn/generic/mu_div_qr.c
+++ b/gmp/mpn/generic/mu_div_qr.c
@@ -7,67 +7,87 @@
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 GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
-Copyright 2005-2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005, 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
+
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+/* We use the "misunderstanding algorithm" (MUA), discovered by Paul Zimmermann
+ and Torbjorn Granlund when Torbjorn misunderstood Paul's explanation of
+ Jebelean's bidirectional exact division algorithm.
+ The idea of this algorithm is to compute a smaller inverted value than used
+ in the standard Barrett algorithm, and thus save time in the Newton
+ iterations, and pay just a small price when using the inverted value for
+ developing quotient bits.
-/*
- The idea of the algorithm used herein is to compute a smaller inverted value
- than used in the standard Barrett algorithm, and thus save time in the
- Newton iterations, and pay just a small price when using the inverted value
- for developing quotient bits. This algorithm was presented at ICMS 2006.
+ Written by Torbjorn Granlund. Paul Zimmermann suggested the use of the
+ "wrap around" trick. Based on the GMP divexact code and inspired by code
+ contributed to GMP by Karl Hasselstroem.
*/
-/* CAUTION: This code and the code in mu_divappr_q.c should be edited in sync.
+
+/* CAUTION: This code and the code in mu_divappr_q.c should be edited in lockstep.
Things to work on:
+ * Passing k isn't a great interface. Either 'in' should be passed, or
+ determined by the code.
+
+ * The current mpn_mu_div_qr_itch isn't exactly scientifically written.
+ Scratch space buffer overruns are not unlikely before some analysis is
+ applied. Since scratch requirements are expected to change, such an
+ analysis will have to wait til things settle.
+
+ * This isn't optimal when the remainder isn't needed, since the final
+ multiplication could be made special and take O(1) time on average, in that
+ case. This is particularly bad when qn << dn. At some level, code as in
+ GMP 4 mpn_tdiv_qr should be used, effectively dividing the leading 2qn
+ dividend limbs by the qn divisor limbs.
+
* This isn't optimal when the quotient isn't needed, as it might take a lot
- of space. The computation is always needed, though, so there is no time to
- save with special code.
+ of space. The computation is always needed, though, so there is not time
+ to save with special code.
* The itch/scratch scheme isn't perhaps such a good idea as it once seemed,
- demonstrated by the fact that the mpn_invertappr function's scratch needs
- mean that we need to keep a large allocation long after it is needed.
- Things are worse as mpn_mul_fft does not accept any scratch parameter,
- which means we'll have a large memory hole while in mpn_mul_fft. In
- general, a peak scratch need in the beginning of a function isn't
- well-handled by the itch/scratch scheme.
+ demonstrated by the fact that the mpn_inv function's scratch needs means
+ that we need to keep a large allocation long after it is needed. Things
+ are worse as mpn_mul_fft does not accept any scratch parameter, which means
+ we'll have a large memory hole while in mpn_mul_fft. In general, a peak
+ scratch need in the beginning of a function isn't well-handled by the
+ itch/scratch scheme.
+
+ * Some ideas from comments in divexact.c apply to this code too.
*/
+/* the NOSTAT stuff handles properly the case where files are concatenated */
+#ifdef NOSTAT
+#undef STAT
+#endif
+
#ifdef STAT
#undef STAT
#define STAT(x) x
#else
+#define NOSTAT
#define STAT(x)
#endif
@@ -76,98 +96,65 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
-/* FIXME: The MU_DIV_QR_SKEW_THRESHOLD was not analysed properly. It gives a
- speedup according to old measurements, but does the decision mechanism
- really make sense? It seem like the quotient between dn and qn might be
- what we really should be checking. */
-#ifndef MU_DIV_QR_SKEW_THRESHOLD
-#define MU_DIV_QR_SKEW_THRESHOLD 100
-#endif
-
-#ifdef CHECK /* FIXME: Enable in minithres */
-#undef MU_DIV_QR_SKEW_THRESHOLD
-#define MU_DIV_QR_SKEW_THRESHOLD 1
-#endif
-
-
-static mp_limb_t mpn_mu_div_qr2 (mp_ptr, mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t, mp_ptr);
-
-
-mp_limb_t
-mpn_mu_div_qr (mp_ptr qp,
- mp_ptr rp,
- mp_srcptr np,
- mp_size_t nn,
- mp_srcptr dp,
- mp_size_t dn,
- mp_ptr scratch)
+/* In case k=0 (automatic choice), we distinguish 3 cases:
+ (a) dn < qn: in = ceil(qn / ceil(qn/dn))
+ (b) dn/3 < qn <= dn: in = ceil(qn / 2)
+ (c) qn < dn/3: in = qn
+ In all cases we have in <= dn.
+ */
+mp_size_t
+mpn_mu_div_qr_choose_in (mp_size_t qn, mp_size_t dn, int k)
{
- mp_size_t qn;
- mp_limb_t cy, qh;
+ mp_size_t in;
- qn = nn - dn;
- if (qn + MU_DIV_QR_SKEW_THRESHOLD < dn)
+ if (k == 0)
{
- /* |______________|_ign_first__| dividend nn
- |_______|_ign_first__| divisor dn
-
- |______| quotient (prel) qn
-
- |___________________| quotient * ignored-divisor-part dn-1
- */
-
- /* Compute a preliminary quotient and a partial remainder by dividing the
- most significant limbs of each operand. */
- qh = mpn_mu_div_qr2 (qp, rp + nn - (2 * qn + 1),
- np + nn - (2 * qn + 1), 2 * qn + 1,
- dp + dn - (qn + 1), qn + 1,
- scratch);
-
- /* Multiply the quotient by the divisor limbs ignored above. */
- if (dn - (qn + 1) > qn)
- mpn_mul (scratch, dp, dn - (qn + 1), qp, qn); /* prod is dn-1 limbs */
- else
- mpn_mul (scratch, qp, qn, dp, dn - (qn + 1)); /* prod is dn-1 limbs */
-
- if (qh)
- cy = mpn_add_n (scratch + qn, scratch + qn, dp, dn - (qn + 1));
+ mp_size_t b;
+ if (qn > dn)
+ {
+ /* Compute an inverse size that is a nice partition of the quotient. */
+ b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
+ in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
+ }
+ else if (3 * qn > dn)
+ {
+ in = (qn - 1) / 2 + 1; /* b = 2 */
+ }
else
- cy = 0;
- scratch[dn - 1] = cy;
-
- cy = mpn_sub_n (rp, np, scratch, nn - (2 * qn + 1));
- cy = mpn_sub_nc (rp + nn - (2 * qn + 1),
- rp + nn - (2 * qn + 1),
- scratch + nn - (2 * qn + 1),
- qn + 1, cy);
- if (cy)
{
- qh -= mpn_sub_1 (qp, qp, qn, 1);
- mpn_add_n (rp, rp, dp, dn);
+ in = (qn - 1) / 1 + 1; /* b = 1 */
}
}
else
{
- qh = mpn_mu_div_qr2 (qp, rp, np, nn, dp, dn, scratch);
+ mp_size_t xn;
+ xn = MIN (dn, qn);
+ in = (xn - 1) / k + 1;
}
- return qh;
+ return in;
}
static mp_limb_t
mpn_mu_div_qr2 (mp_ptr qp,
mp_ptr rp,
- mp_srcptr np,
+ mp_ptr np,
mp_size_t nn,
mp_srcptr dp,
mp_size_t dn,
mp_ptr scratch)
{
mp_size_t qn, in;
- mp_limb_t cy, qh;
+ mp_limb_t cy;
mp_ptr ip, tp;
- ASSERT (dn > 1);
+ /* FIXME: We should probably not handle tiny operands, but do it for now. */
+ if (dn == 1)
+ {
+ rp[0] = mpn_divrem_1 (scratch, 0L, np, nn, dp[0]);
+ MPN_COPY (qp, scratch, nn - 1);
+ return scratch[nn - 1];
+ }
qn = nn - dn;
@@ -178,7 +165,7 @@ mpn_mu_div_qr2 (mp_ptr qp,
#if 1
/* This alternative inverse computation method gets slightly more accurate
results. FIXMEs: (1) Temp allocation needs not analysed (2) itch function
- not adapted (3) mpn_invertappr scratch needs not met. */
+ not adapted (3) mpn_invert scratch needs not met. */
ip = scratch;
tp = scratch + in + 1;
@@ -187,7 +174,7 @@ mpn_mu_div_qr2 (mp_ptr qp,
{
MPN_COPY (tp + 1, dp, in);
tp[0] = 1;
- mpn_invertappr (ip, tp, in + 1, NULL);
+ mpn_invert (ip, tp, in + 1, NULL);
MPN_COPY_INCR (ip, ip + 1, in);
}
else
@@ -197,7 +184,7 @@ mpn_mu_div_qr2 (mp_ptr qp,
MPN_ZERO (ip, in);
else
{
- mpn_invertappr (ip, tp, in + 1, NULL);
+ mpn_invert (ip, tp, in + 1, NULL);
MPN_COPY_INCR (ip, ip + 1, in);
}
}
@@ -213,11 +200,11 @@ mpn_mu_div_qr2 (mp_ptr qp,
{
tp[in + 1] = 0;
MPN_COPY (tp + in + 2, dp, in);
- mpn_invertappr (tp, tp + in + 1, in + 1, NULL);
+ mpn_invert (tp, tp + in + 1, in + 1, NULL);
}
else
{
- mpn_invertappr (tp, dp + dn - (in + 1), in + 1, NULL);
+ mpn_invert (tp, dp + dn - (in + 1), in + 1, NULL);
}
cy = mpn_sub_1 (tp, tp, in + 1, GMP_NUMB_HIGHBIT);
if (UNLIKELY (cy != 0))
@@ -225,15 +212,24 @@ mpn_mu_div_qr2 (mp_ptr qp,
MPN_COPY (ip, tp + 1, in);
#endif
- qh = mpn_preinv_mu_div_qr (qp, rp, np, nn, dp, dn, ip, in, scratch + in);
+/* We can't really handle qh = 1 like this since we'd here clobber N, which is
+ not allowed in the way we've defined this function's API. */
+#if 0
+ qh = mpn_cmp (np + qn, dp, dn) >= 0;
+ if (qh != 0)
+ mpn_sub_n (np + qn, np + qn, dp, dn);
+#endif
- return qh;
+ mpn_preinv_mu_div_qr (qp, rp, np, nn, dp, dn, ip, in, scratch + in);
+
+/* return qh; */
+ return 0;
}
-mp_limb_t
+void
mpn_preinv_mu_div_qr (mp_ptr qp,
mp_ptr rp,
- mp_srcptr np,
+ mp_ptr np,
mp_size_t nn,
mp_srcptr dp,
mp_size_t dn,
@@ -242,26 +238,24 @@ mpn_preinv_mu_div_qr (mp_ptr qp,
mp_ptr scratch)
{
mp_size_t qn;
- mp_limb_t cy, cx, qh;
+ mp_limb_t cy;
+ mp_ptr tp;
mp_limb_t r;
- mp_size_t tn, wn;
-
-#define tp scratch
-#define scratch_out (scratch + tn)
qn = nn - dn;
+ if (qn == 0)
+ {
+ MPN_COPY (rp, np, dn);
+ return;
+ }
+
+ tp = scratch;
+
np += qn;
qp += qn;
- qh = mpn_cmp (np, dp, dn) >= 0;
- if (qh != 0)
- mpn_sub_n (rp, np, dp, dn);
- else
- MPN_COPY_INCR (rp, np, dn);
-
- if (qn == 0)
- return qh; /* Degenerate use. Should we allow this? */
+ MPN_COPY (rp, np, dn);
while (qn > 0)
{
@@ -277,30 +271,36 @@ mpn_preinv_mu_div_qr (mp_ptr qp,
by the upper part of the partial remainder R. */
mpn_mul_n (tp, rp + dn - in, ip, in); /* mulhi */
cy = mpn_add_n (qp, tp + in, rp + dn - in, in); /* I's msb implicit */
- ASSERT_ALWAYS (cy == 0);
-
- qn -= in;
+ ASSERT_ALWAYS (cy == 0); /* FIXME */
/* Compute the product of the quotient block and the divisor D, to be
subtracted from the partial remainder combined with new limbs from the
- dividend N. We only really need the low dn+1 limbs. */
-
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */
- else
+ dividend N. We only really need the low dn limbs. */
+#if WANT_FFT
+ if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD))
{
- tn = mpn_mulmod_bnm1_next_size (dn + 1);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out);
- wn = dn + in - tn; /* number of wrapped limbs */
+ /* Use the wrap-around trick. */
+ mp_size_t m, wn;
+ int k;
+
+ k = mpn_fft_best_k (dn + 1, 0);
+ m = mpn_fft_next_size (dn + 1, k);
+ wn = dn + in - m; /* number of wrapped limbs */
+
+ mpn_mul_fft (tp, m, dp, dn, qp, in, k);
+
if (wn > 0)
{
- cy = mpn_sub_n (tp, tp, rp + dn - wn, wn);
- cy = mpn_sub_1 (tp + wn, tp + wn, tn - wn, cy);
- cx = mpn_cmp (rp + dn - in, tp + dn, tn - dn) < 0;
- ASSERT_ALWAYS (cx >= cy);
- mpn_incr_u (tp, cx - cy);
+ cy = mpn_add_n (tp, tp, rp + dn - wn, wn);
+ mpn_incr_u (tp + wn, cy);
+
+ cy = mpn_cmp (rp + dn - in, tp + dn, m - dn) < 0;
+ mpn_decr_u (tp, cy);
}
}
+ else
+#endif
+ mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */
r = rp[dn - in] - tp[dn];
@@ -352,65 +352,112 @@ mpn_preinv_mu_div_qr (mp_ptr qp,
printf ("\n");
}
);
- }
- return qh;
+ qn -= in;
+ }
}
-/* In case k=0 (automatic choice), we distinguish 3 cases:
- (a) dn < qn: in = ceil(qn / ceil(qn/dn))
- (b) dn/3 < qn <= dn: in = ceil(qn / 2)
- (c) qn < dn/3: in = qn
- In all cases we have in <= dn.
- */
-mp_size_t
-mpn_mu_div_qr_choose_in (mp_size_t qn, mp_size_t dn, int k)
+#define THRES 100 /* FIXME: somewhat arbitrary */
+
+#ifdef CHECK
+#undef THRES
+#define THRES 1
+#endif
+
+mp_limb_t
+mpn_mu_div_qr (mp_ptr qp,
+ mp_ptr rp,
+ mp_ptr np,
+ mp_size_t nn,
+ mp_srcptr dp,
+ mp_size_t dn,
+ mp_ptr scratch)
{
- mp_size_t in;
+ mp_size_t qn;
- if (k == 0)
+ qn = nn - dn;
+ if (qn + THRES < dn)
{
- mp_size_t b;
- if (qn > dn)
- {
- /* Compute an inverse size that is a nice partition of the quotient. */
- b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
- in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
- }
- else if (3 * qn > dn)
+ /* |______________|________| dividend nn
+ |_______|________| divisor dn
+
+ |______| quotient (prel) qn
+
+ |_______________| quotient * ignored-part-of(divisor) dn-1
+ */
+
+ mp_limb_t cy, x;
+
+ if (mpn_cmp (np + nn - (qn + 1), dp + dn - (qn + 1), qn + 1) >= 0)
{
- in = (qn - 1) / 2 + 1; /* b = 2 */
+ /* Quotient is 111...111, could optimize this rare case at some point. */
+ mpn_mu_div_qr2 (qp, rp, np, nn, dp, dn, scratch);
+ return 0;
}
+
+ /* Compute a preliminary quotient and a partial remainder by dividing the
+ most significant limbs of each operand. */
+ mpn_mu_div_qr2 (qp, rp + nn - (2 * qn + 1),
+ np + nn - (2 * qn + 1), 2 * qn + 1,
+ dp + dn - (qn + 1), qn + 1,
+ scratch);
+
+ /* Multiply the quotient by the divisor limbs ignored above. */
+ if (dn - (qn + 1) > qn)
+ mpn_mul (scratch, dp, dn - (qn + 1), qp, qn); /* prod is dn-1 limbs */
else
+ mpn_mul (scratch, qp, qn, dp, dn - (qn + 1)); /* prod is dn-1 limbs */
+
+ cy = mpn_sub_n (rp, np, scratch, nn - (2 * qn + 1));
+ cy = mpn_sub_nc (rp + nn - (2 * qn + 1),
+ rp + nn - (2 * qn + 1),
+ scratch + nn - (2 * qn + 1),
+ qn, cy);
+ x = rp[dn - 1];
+ rp[dn - 1] = x - cy;
+ if (cy > x)
{
- in = (qn - 1) / 1 + 1; /* b = 1 */
+ mpn_decr_u (qp, 1);
+ mpn_add_n (rp, rp, dp, dn);
}
}
else
{
- mp_size_t xn;
- xn = MIN (dn, qn);
- in = (xn - 1) / k + 1;
+ return mpn_mu_div_qr2 (qp, rp, np, nn, dp, dn, scratch);
}
- return in;
+ return 0; /* FIXME */
}
mp_size_t
mpn_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, int mua_k)
{
- mp_size_t itch_local = mpn_mulmod_bnm1_next_size (dn + 1);
- mp_size_t in = mpn_mu_div_qr_choose_in (nn - dn, dn, mua_k);
- mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in);
+ mp_size_t qn, m;
+ int k;
- return in + itch_local + itch_out;
-}
+ /* FIXME: This isn't very carefully written, and might grossly overestimate
+ the amount of scratch needed, and might perhaps also underestimate it,
+ leading to potential buffer overruns. In particular k=0 might lead to
+ gross overestimates. */
-mp_size_t
-mpn_preinv_mu_div_qr_itch (mp_size_t nn, mp_size_t dn, mp_size_t in)
-{
- mp_size_t itch_local = mpn_mulmod_bnm1_next_size (dn + 1);
- mp_size_t itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in);
+ if (dn == 1)
+ return nn;
- return itch_local + itch_out;
+ qn = nn - dn;
+ if (qn >= dn)
+ {
+ k = mpn_fft_best_k (dn + 1, 0);
+ m = mpn_fft_next_size (dn + 1, k);
+ return (mua_k <= 1
+ ? 6 * dn
+ : m + 2 * dn);
+ }
+ else
+ {
+ k = mpn_fft_best_k (dn + 1, 0);
+ m = mpn_fft_next_size (dn + 1, k);
+ return (mua_k <= 1
+ ? m + 4 * qn
+ : m + 2 * qn);
+ }
}
diff --git a/gmp/mpn/generic/mu_divappr_q.c b/gmp/mpn/generic/mu_divappr_q.c
index c218b59fee..0a0434399f 100644
--- a/gmp/mpn/generic/mu_divappr_q.c
+++ b/gmp/mpn/generic/mu_divappr_q.c
@@ -7,63 +7,87 @@
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 GMP RELEASE.
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
-Copyright 2005-2007, 2009, 2010 Free Software Foundation, Inc.
+Copyright 2005, 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+/* We use the "misunderstanding algorithm" (MUA), discovered by Paul Zimmermann
+ and Torbjorn Granlund when Torbjorn misunderstood Paul's explanation of
+ Jebelean's bidirectional exact division algorithm.
-/*
- The idea of the algorithm used herein is to compute a smaller inverted value
- than used in the standard Barrett algorithm, and thus save time in the
- Newton iterations, and pay just a small price when using the inverted value
- for developing quotient bits. This algorithm was presented at ICMS 2006.
+ The idea of this algorithm is to compute a smaller inverted value than used
+ in the standard Barrett algorithm, and thus save time in the Newton
+ iterations, and pay just a small price when using the inverted value for
+ developing quotient bits.
+
+ Written by Torbjorn Granlund. Paul Zimmermann suggested the use of the
+ "wrap around" trick. Based on the GMP divexact code and inspired by code
+ contributed to GMP by Karl Hasselstroem.
*/
-/* CAUTION: This code and the code in mu_div_qr.c should be edited in sync.
+
+/* CAUTION: This code and the code in mu_div_qr.c should be edited in lockstep.
Things to work on:
+ * Passing k isn't a great interface. Either 'in' should be passed, or
+ determined by the code.
+
+ * The current mpn_mu_div_qr_itch isn't exactly scientifically written.
+ Scratch space buffer overruns are not unlikely before some analysis is
+ applied. Since scratch requirements are expected to change, such an
+ analysis will have to wait til things settle.
+
+ * This isn't optimal when the remainder isn't needed, since the final
+ multiplication could be made special and take O(1) time on average, in that
+ case. This is particularly bad when qn << dn. At some level, code as in
+ GMP 4 mpn_tdiv_qr should be used, effectively dividing the leading 2qn
+ dividend limbs by the qn divisor limbs.
+
+ * This isn't optimal when the quotient isn't needed, as it might take a lot
+ of space. The computation is always needed, though, so there is not time
+ to save with special code.
+
* The itch/scratch scheme isn't perhaps such a good idea as it once seemed,
- demonstrated by the fact that the mpn_invertappr function's scratch needs
- mean that we need to keep a large allocation long after it is needed.
- Things are worse as mpn_mul_fft does not accept any scratch parameter,
- which means we'll have a large memory hole while in mpn_mul_fft. In
- general, a peak scratch need in the beginning of a function isn't
- well-handled by the itch/scratch scheme.
+ demonstrated by the fact that the mpn_inv function's scratch needs means
+ that we need to keep a large allocation long after it is needed. Things
+ are worse as mpn_mul_fft does not accept any scratch parameter, which means
+ we'll have a large memory hole while in mpn_mul_fft. In general, a peak
+ scratch need in the beginning of a function isn't well-handled by the
+ itch/scratch scheme.
+
+ * Some ideas from comments in divexact.c apply to this code too.
*/
+/* the NOSTAT stuff handles properly the case where files are concatenated */
+#ifdef NOSTAT
+#undef STAT
+#endif
+
#ifdef STAT
#undef STAT
#define STAT(x) x
#else
+#define NOSTAT
#define STAT(x)
#endif
@@ -72,22 +96,68 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
+/* In case k=0 (automatic choice), we distinguish 3 cases:
+ (a) dn < qn: in = ceil(qn / ceil(qn/dn))
+ (b) dn/3 < qn <= dn: in = ceil(qn / 2)
+ (c) qn < dn/3: in = qn
+ In all cases we have in <= dn.
+ */
+mp_size_t
+mpn_mu_divappr_q_choose_in (mp_size_t qn, mp_size_t dn, int k)
+{
+ mp_size_t in;
+
+ if (k == 0)
+ {
+ mp_size_t b;
+ if (qn > dn)
+ {
+ /* Compute an inverse size that is a nice partition of the quotient. */
+ b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
+ in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
+ }
+ else if (3 * qn > dn)
+ {
+ in = (qn - 1) / 2 + 1; /* b = 2 */
+ }
+ else
+ {
+ in = (qn - 1) / 1 + 1; /* b = 1 */
+ }
+ }
+ else
+ {
+ mp_size_t xn;
+ xn = MIN (dn, qn);
+ in = (xn - 1) / k + 1;
+ }
+
+ return in;
+}
+
mp_limb_t
mpn_mu_divappr_q (mp_ptr qp,
- mp_srcptr np,
+ mp_ptr np,
mp_size_t nn,
mp_srcptr dp,
mp_size_t dn,
mp_ptr scratch)
{
mp_size_t qn, in;
- mp_limb_t cy, qh;
+ mp_limb_t cy;
mp_ptr ip, tp;
- ASSERT (dn > 1);
+ /* FIXME: We should probably not handle tiny operands, but do it for now. */
+ if (dn == 1)
+ {
+ mpn_divrem_1 (scratch, 0L, np, nn, dp[0]);
+ MPN_COPY (qp, scratch, nn - 1);
+ return scratch[nn - 1];
+ }
qn = nn - dn;
+#if 1
/* If Q is smaller than D, truncate operands. */
if (qn + 1 < dn)
{
@@ -95,7 +165,18 @@ mpn_mu_divappr_q (mp_ptr qp,
nn -= dn - (qn + 1);
dp += dn - (qn + 1);
dn = qn + 1;
+
+ /* Since D is cut here, we can have a carry in N'/D' even if we don't
+ have it for N/D. */
+ if (mpn_cmp (np + nn - (qn + 1), dp, qn + 1) >= 0)
+ { /* quotient is 111...111 */
+ mp_size_t i;
+ for (i = 0; i <= qn; i ++)
+ qp[i] = ~ (mp_limb_t) 0;
+ return 0;
+ }
}
+#endif
/* Compute the inverse size. */
in = mpn_mu_divappr_q_choose_in (qn, dn, 0);
@@ -104,7 +185,7 @@ mpn_mu_divappr_q (mp_ptr qp,
#if 1
/* This alternative inverse computation method gets slightly more accurate
results. FIXMEs: (1) Temp allocation needs not analysed (2) itch function
- not adapted (3) mpn_invertappr scratch needs not met. */
+ not adapted (3) mpn_invert scratch needs not met. */
ip = scratch;
tp = scratch + in + 1;
@@ -113,7 +194,7 @@ mpn_mu_divappr_q (mp_ptr qp,
{
MPN_COPY (tp + 1, dp, in);
tp[0] = 1;
- mpn_invertappr (ip, tp, in + 1, NULL);
+ mpn_invert (ip, tp, in + 1, NULL);
MPN_COPY_INCR (ip, ip + 1, in);
}
else
@@ -123,7 +204,7 @@ mpn_mu_divappr_q (mp_ptr qp,
MPN_ZERO (ip, in);
else
{
- mpn_invertappr (ip, tp, in + 1, NULL);
+ mpn_invert (ip, tp, in + 1, NULL);
MPN_COPY_INCR (ip, ip + 1, in);
}
}
@@ -139,11 +220,11 @@ mpn_mu_divappr_q (mp_ptr qp,
{
tp[in + 1] = 0;
MPN_COPY (tp + in + 2, dp, in);
- mpn_invertappr (tp, tp + in + 1, in + 1, NULL);
+ mpn_invert (tp, tp + in + 1, in + 1, NULL);
}
else
{
- mpn_invertappr (tp, dp + dn - (in + 1), in + 1, NULL);
+ mpn_invert (tp, dp + dn - (in + 1), in + 1, NULL);
}
cy = mpn_sub_1 (tp, tp, in + 1, GMP_NUMB_HIGHBIT);
if (UNLIKELY (cy != 0))
@@ -151,14 +232,23 @@ mpn_mu_divappr_q (mp_ptr qp,
MPN_COPY (ip, tp + 1, in);
#endif
- qh = mpn_preinv_mu_divappr_q (qp, np, nn, dp, dn, ip, in, scratch + in);
+/* We can't really handle qh = 1 like this since we'd here clobber N, which is
+ not allowed in the way we've defined this function's API. */
+#if 0
+ qh = mpn_cmp (np + qn, dp, dn) >= 0;
+ if (qh != 0)
+ mpn_sub_n (np + qn, np + qn, dp, dn);
+#endif
+
+ mpn_preinv_mu_divappr_q (qp, np, nn, dp, dn, ip, in, scratch + in);
- return qh;
+/* return qh; */
+ return 0;
}
-mp_limb_t
+void
mpn_preinv_mu_divappr_q (mp_ptr qp,
- mp_srcptr np,
+ mp_ptr np,
mp_size_t nn,
mp_srcptr dp,
mp_size_t dn,
@@ -166,28 +256,24 @@ mpn_preinv_mu_divappr_q (mp_ptr qp,
mp_size_t in,
mp_ptr scratch)
{
+ mp_ptr rp;
mp_size_t qn;
- mp_limb_t cy, cx, qh;
+ mp_limb_t cy;
+ mp_ptr tp;
mp_limb_t r;
- mp_size_t tn, wn;
-
-#define rp scratch
-#define tp (scratch + dn)
-#define scratch_out (scratch + dn + tn)
qn = nn - dn;
+ if (qn == 0)
+ return;
+
+ rp = scratch;
+ tp = scratch + dn;
+
np += qn;
qp += qn;
- qh = mpn_cmp (np, dp, dn) >= 0;
- if (qh != 0)
- mpn_sub_n (rp, np, dp, dn);
- else
- MPN_COPY (rp, np, dn);
-
- if (qn == 0)
- return qh; /* Degenerate use. Should we allow this? */
+ MPN_COPY (rp, np, dn);
while (qn > 0)
{
@@ -203,7 +289,7 @@ mpn_preinv_mu_divappr_q (mp_ptr qp,
by the upper part of the partial remainder R. */
mpn_mul_n (tp, rp + dn - in, ip, in); /* mulhi */
cy = mpn_add_n (qp, tp + in, rp + dn - in, in); /* I's msb implicit */
- ASSERT_ALWAYS (cy == 0);
+ ASSERT_ALWAYS (cy == 0); /* FIXME */
qn -= in;
if (qn == 0)
@@ -212,23 +298,31 @@ mpn_preinv_mu_divappr_q (mp_ptr qp,
/* Compute the product of the quotient block and the divisor D, to be
subtracted from the partial remainder combined with new limbs from the
dividend N. We only really need the low dn limbs. */
-
- if (BELOW_THRESHOLD (in, MUL_TO_MULMOD_BNM1_FOR_2NXN_THRESHOLD))
- mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */
- else
+#if WANT_FFT
+ if (ABOVE_THRESHOLD (dn, MUL_FFT_MODF_THRESHOLD))
{
- tn = mpn_mulmod_bnm1_next_size (dn + 1);
- mpn_mulmod_bnm1 (tp, tn, dp, dn, qp, in, scratch_out);
- wn = dn + in - tn; /* number of wrapped limbs */
+ /* Use the wrap-around trick. */
+ mp_size_t m, wn;
+ int k;
+
+ k = mpn_fft_best_k (dn + 1, 0);
+ m = mpn_fft_next_size (dn + 1, k);
+ wn = dn + in - m; /* number of wrapped limbs */
+
+ mpn_mul_fft (tp, m, dp, dn, qp, in, k);
+
if (wn > 0)
{
- cy = mpn_sub_n (tp, tp, rp + dn - wn, wn);
- cy = mpn_sub_1 (tp + wn, tp + wn, tn - wn, cy);
- cx = mpn_cmp (rp + dn - in, tp + dn, tn - dn) < 0;
- ASSERT_ALWAYS (cx >= cy);
- mpn_incr_u (tp, cx - cy);
+ cy = mpn_add_n (tp, tp, rp + dn - wn, wn);
+ mpn_incr_u (tp + wn, cy);
+
+ cy = mpn_cmp (rp + dn - in, tp + dn, m - dn) < 0;
+ mpn_decr_u (tp, cy);
}
}
+ else
+#endif
+ mpn_mul (tp, dp, dn, qp, in); /* dn+in limbs, high 'in' cancels */
r = rp[dn - in] - tp[dn];
@@ -284,80 +378,45 @@ mpn_preinv_mu_divappr_q (mp_ptr qp,
/* FIXME: We should perhaps be somewhat more elegant in our rounding of the
quotient. For now, just make sure the returned quotient is >= the real
- quotient; add 3 with saturating arithmetic. */
+ quotient. */
qn = nn - dn;
- cy += mpn_add_1 (qp, qp, qn, 3);
+ cy = mpn_add_1 (qp, qp, qn, 3);
if (cy != 0)
{
- if (qh != 0)
- {
- /* Return a quotient of just 1-bits, with qh set. */
- mp_size_t i;
- for (i = 0; i < qn; i++)
- qp[i] = GMP_NUMB_MAX;
- }
- else
- {
- /* Propagate carry into qh. */
- qh = 1;
- }
+ MPN_ZERO (qp, qn);
+ mpn_sub_1 (qp, qp, qn, 1);
}
-
- return qh;
}
-/* In case k=0 (automatic choice), we distinguish 3 cases:
- (a) dn < qn: in = ceil(qn / ceil(qn/dn))
- (b) dn/3 < qn <= dn: in = ceil(qn / 2)
- (c) qn < dn/3: in = qn
- In all cases we have in <= dn.
- */
mp_size_t
-mpn_mu_divappr_q_choose_in (mp_size_t qn, mp_size_t dn, int k)
+mpn_mu_divappr_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
{
- mp_size_t in;
+ mp_size_t qn, m;
+ int k;
- if (k == 0)
- {
- mp_size_t b;
- if (qn > dn)
- {
- /* Compute an inverse size that is a nice partition of the quotient. */
- b = (qn - 1) / dn + 1; /* ceil(qn/dn), number of blocks */
- in = (qn - 1) / b + 1; /* ceil(qn/b) = ceil(qn / ceil(qn/dn)) */
- }
- else if (3 * qn > dn)
- {
- in = (qn - 1) / 2 + 1; /* b = 2 */
- }
- else
- {
- in = (qn - 1) / 1 + 1; /* b = 1 */
- }
- }
- else
- {
- mp_size_t xn;
- xn = MIN (dn, qn);
- in = (xn - 1) / k + 1;
- }
+ /* FIXME: This isn't very carefully written, and might grossly overestimate
+ the amount of scratch needed, and might perhaps also underestimate it,
+ leading to potential buffer overruns. In particular k=0 might lead to
+ gross overestimates. */
- return in;
-}
-
-mp_size_t
-mpn_mu_divappr_q_itch (mp_size_t nn, mp_size_t dn, int mua_k)
-{
- mp_size_t qn, in, itch_local, itch_out;
+ if (dn == 1)
+ return nn;
qn = nn - dn;
- if (qn + 1 < dn)
+ if (qn >= dn)
{
- dn = qn + 1;
+ k = mpn_fft_best_k (dn + 1, 0);
+ m = mpn_fft_next_size (dn + 1, k);
+ return dn + (mua_k <= 1
+ ? 6 * dn
+ : m + 2 * dn);
+ }
+ else
+ {
+ k = mpn_fft_best_k (dn + 1, 0);
+ m = mpn_fft_next_size (dn + 1, k);
+ return dn + (mua_k <= 1
+ ? m + 4 * qn
+ : m + 2 * qn);
}
- in = mpn_mu_divappr_q_choose_in (qn, dn, mua_k);
-
- itch_local = mpn_mulmod_bnm1_next_size (dn + 1);
- itch_out = mpn_mulmod_bnm1_itch (itch_local, dn, in);
- return in + dn + itch_local + itch_out;
}
diff --git a/gmp/mpn/generic/mul.c b/gmp/mpn/generic/mul.c
index 2d72df3d4d..489e1f524f 100644
--- a/gmp/mpn/generic/mul.c
+++ b/gmp/mpn/generic/mul.c
@@ -2,34 +2,23 @@
Contributed to the GNU project by Torbjorn Granlund.
-Copyright 1991, 1993, 1994, 1996, 1997, 1999-2003, 2005-2007, 2009, 2010, 2012
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2005,
+2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -39,42 +28,6 @@ see https://www.gnu.org/licenses/. */
#define MUL_BASECASE_MAX_UN 500
#endif
-/* Areas where the different toom algorithms can be called (extracted
- from the t-toom*.c files, and ignoring small constant offsets):
-
- 1/6 1/5 1/4 4/13 1/3 3/8 2/5 5/11 1/2 3/5 2/3 3/4 4/5 1 vn/un
- 4/7 6/7
- 6/11
- |--------------------| toom22 (small)
- || toom22 (large)
- |xxxx| toom22 called
- |-------------------------------------| toom32
- |xxxxxxxxxxxxxxxx| | toom32 called
- |------------| toom33
- |x| toom33 called
- |---------------------------------| | toom42
- |xxxxxxxxxxxxxxxxxxxxxxxx| | toom42 called
- |--------------------| toom43
- |xxxxxxxxxx| toom43 called
- |-----------------------------| toom52 (unused)
- |--------| toom44
- |xxxxxxxx| toom44 called
- |--------------------| | toom53
- |xxxxxx| toom53 called
- |-------------------------| toom62 (unused)
- |----------------| toom54 (unused)
- |--------------------| toom63
- |xxxxxxxxx| | toom63 called
- |---------------------------------| toom6h
- |xxxxxxxx| toom6h called
- |-------------------------| toom8h (32 bit)
- |------------------------------------------| toom8h (64 bit)
- |xxxxxxxx| toom8h called
-*/
-
-#define TOOM33_OK(an,bn) (6 + 2 * an < 3 * bn)
-#define TOOM44_OK(an,bn) (12 + 3 * an < 4 * bn)
-
/* Multiply the natural numbers u (pointed to by UP, with UN limbs) and v
(pointed to by VP, with VN limbs), and store the result at PRODP. The
result is UN + VN limbs. Return the most significant limb of the result.
@@ -87,34 +40,6 @@ see https://www.gnu.org/licenses/. */
2. PRODP != UP and PRODP != VP, i.e. the destination must be distinct from
the multiplier and the multiplicand. */
-/*
- * The cutoff lines in the toomX2 and toomX3 code are now exactly between the
- ideal lines of the surrounding algorithms. Is that optimal?
-
- * The toomX3 code now uses a structure similar to the one of toomX2, except
- that it loops longer in the unbalanced case. The result is that the
- remaining area might have un < vn. Should we fix the toomX2 code in a
- similar way?
-
- * The toomX3 code is used for the largest non-FFT unbalanced operands. It
- therefore calls mpn_mul recursively for certain cases.
-
- * Allocate static temp space using THRESHOLD variables (except for toom44
- when !WANT_FFT). That way, we can typically have no TMP_ALLOC at all.
-
- * We sort ToomX2 algorithms together, assuming the toom22, toom32, toom42
- have the same vn threshold. This is not true, we should actually use
- mul_basecase for slightly larger operands for toom32 than for toom22, and
- even larger for toom42.
-
- * That problem is even more prevalent for toomX3. We therefore use special
- THRESHOLD variables there.
-
- * Is our ITCH allocation correct?
-*/
-
-#define ITCH (16*vn + 100)
-
mp_limb_t
mpn_mul (mp_ptr prodp,
mp_srcptr up, mp_size_t un,
@@ -128,11 +53,13 @@ mpn_mul (mp_ptr prodp,
if (un == vn)
{
if (up == vp)
- mpn_sqr (prodp, up, un);
+ mpn_sqr_n (prodp, up, un);
else
mpn_mul_n (prodp, up, vp, un);
+ return prodp[2 * un - 1];
}
- else if (vn < MUL_TOOM22_THRESHOLD)
+
+ if (vn < MUL_KARATSUBA_THRESHOLD)
{ /* plain schoolbook multiplication */
/* Unless un is very large, or else if have an applicable mpn_mul_N,
@@ -171,9 +98,9 @@ mpn_mul (mp_ptr prodp,
The parts marked with X are the parts whose sums are copied into
the temporary buffer. */
- mp_limb_t tp[MUL_TOOM22_THRESHOLD_LIMIT];
+ mp_limb_t tp[MUL_KARATSUBA_THRESHOLD_LIMIT];
mp_limb_t cy;
- ASSERT (MUL_TOOM22_THRESHOLD <= MUL_TOOM22_THRESHOLD_LIMIT);
+ ASSERT (MUL_KARATSUBA_THRESHOLD <= MUL_KARATSUBA_THRESHOLD_LIMIT);
mpn_mul_basecase (prodp, up, MUL_BASECASE_MAX_UN, vp, vn);
prodp += MUL_BASECASE_MAX_UN;
@@ -184,7 +111,7 @@ mpn_mul (mp_ptr prodp,
{
mpn_mul_basecase (prodp, up, MUL_BASECASE_MAX_UN, vp, vn);
cy = mpn_add_n (prodp, prodp, tp, vn); /* add back preserved triangle */
- mpn_incr_u (prodp + vn, cy);
+ mpn_incr_u (prodp + vn, cy); /* safe? */
prodp += MUL_BASECASE_MAX_UN;
MPN_COPY (tp, prodp, vn); /* preserve high triangle */
up += MUL_BASECASE_MAX_UN;
@@ -196,233 +123,100 @@ mpn_mul (mp_ptr prodp,
}
else
{
- ASSERT (un > 0);
+ ASSERT_ALWAYS (un > 0);
mpn_mul_basecase (prodp, vp, vn, up, un);
}
cy = mpn_add_n (prodp, prodp, tp, vn); /* add back preserved triangle */
- mpn_incr_u (prodp + vn, cy);
+ mpn_incr_u (prodp + vn, cy); /* safe? */
}
+ return prodp[un + vn - 1];
}
- else if (BELOW_THRESHOLD (vn, MUL_TOOM33_THRESHOLD))
- {
- /* Use ToomX2 variants */
- mp_ptr scratch;
- TMP_SDECL; TMP_SMARK;
-
- scratch = TMP_SALLOC_LIMBS (ITCH);
-
- /* FIXME: This condition (repeated in the loop below) leaves from a vn*vn
- square to a (3vn-1)*vn rectangle. Leaving such a rectangle is hardly
- wise; we would get better balance by slightly moving the bound. We
- will sometimes end up with un < vn, like in the X3 arm below. */
- if (un >= 3 * vn)
- {
- mp_limb_t cy;
- mp_ptr ws;
-
- /* The maximum ws usage is for the mpn_mul result. */
- ws = TMP_SALLOC_LIMBS (4 * vn);
- mpn_toom42_mul (prodp, up, 2 * vn, vp, vn, scratch);
- un -= 2 * vn;
- up += 2 * vn;
- prodp += 2 * vn;
-
- while (un >= 3 * vn)
- {
- mpn_toom42_mul (ws, up, 2 * vn, vp, vn, scratch);
- un -= 2 * vn;
- up += 2 * vn;
- cy = mpn_add_n (prodp, prodp, ws, vn);
- MPN_COPY (prodp + vn, ws + vn, 2 * vn);
- mpn_incr_u (prodp + vn, cy);
- prodp += 2 * vn;
- }
-
- /* vn <= un < 3vn */
-
- if (4 * un < 5 * vn)
- mpn_toom22_mul (ws, up, un, vp, vn, scratch);
- else if (4 * un < 7 * vn)
- mpn_toom32_mul (ws, up, un, vp, vn, scratch);
- else
- mpn_toom42_mul (ws, up, un, vp, vn, scratch);
-
- cy = mpn_add_n (prodp, prodp, ws, vn);
- MPN_COPY (prodp + vn, ws + vn, un);
- mpn_incr_u (prodp + vn, cy);
- }
- else
- {
- if (4 * un < 5 * vn)
- mpn_toom22_mul (prodp, up, un, vp, vn, scratch);
- else if (4 * un < 7 * vn)
- mpn_toom32_mul (prodp, up, un, vp, vn, scratch);
- else
- mpn_toom42_mul (prodp, up, un, vp, vn, scratch);
- }
- TMP_SFREE;
- }
- else if (BELOW_THRESHOLD ((un + vn) >> 1, MUL_FFT_THRESHOLD) ||
- BELOW_THRESHOLD (3 * vn, MUL_FFT_THRESHOLD))
+ if (ABOVE_THRESHOLD ((un + vn) >> 1, MUL_FFT_THRESHOLD) &&
+ ABOVE_THRESHOLD (vn, MUL_FFT_THRESHOLD / 3)) /* FIXME */
{
- /* Handle the largest operands that are not in the FFT range. The 2nd
- condition makes very unbalanced operands avoid the FFT code (except
- perhaps as coefficient products of the Toom code. */
-
- if (BELOW_THRESHOLD (vn, MUL_TOOM44_THRESHOLD) || !TOOM44_OK (un, vn))
- {
- /* Use ToomX3 variants */
- mp_ptr scratch;
- TMP_SDECL; TMP_SMARK;
-
- scratch = TMP_SALLOC_LIMBS (ITCH);
-
- if (2 * un >= 5 * vn)
- {
- mp_limb_t cy;
- mp_ptr ws;
-
- /* The maximum ws usage is for the mpn_mul result. */
- ws = TMP_SALLOC_LIMBS (7 * vn >> 1);
-
- if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM63_THRESHOLD))
- mpn_toom42_mul (prodp, up, 2 * vn, vp, vn, scratch);
- else
- mpn_toom63_mul (prodp, up, 2 * vn, vp, vn, scratch);
- un -= 2 * vn;
- up += 2 * vn;
- prodp += 2 * vn;
-
- while (2 * un >= 5 * vn) /* un >= 2.5vn */
- {
- if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM63_THRESHOLD))
- mpn_toom42_mul (ws, up, 2 * vn, vp, vn, scratch);
- else
- mpn_toom63_mul (ws, up, 2 * vn, vp, vn, scratch);
- un -= 2 * vn;
- up += 2 * vn;
- cy = mpn_add_n (prodp, prodp, ws, vn);
- MPN_COPY (prodp + vn, ws + vn, 2 * vn);
- mpn_incr_u (prodp + vn, cy);
- prodp += 2 * vn;
- }
-
- /* vn / 2 <= un < 2.5vn */
-
- if (un < vn)
- mpn_mul (ws, vp, vn, up, un);
- else
- mpn_mul (ws, up, un, vp, vn);
-
- cy = mpn_add_n (prodp, prodp, ws, vn);
- MPN_COPY (prodp + vn, ws + vn, un);
- mpn_incr_u (prodp + vn, cy);
- }
- else
- {
- if (6 * un < 7 * vn)
- mpn_toom33_mul (prodp, up, un, vp, vn, scratch);
- else if (2 * un < 3 * vn)
- {
- if (BELOW_THRESHOLD (vn, MUL_TOOM32_TO_TOOM43_THRESHOLD))
- mpn_toom32_mul (prodp, up, un, vp, vn, scratch);
- else
- mpn_toom43_mul (prodp, up, un, vp, vn, scratch);
- }
- else if (6 * un < 11 * vn)
- {
- if (4 * un < 7 * vn)
- {
- if (BELOW_THRESHOLD (vn, MUL_TOOM32_TO_TOOM53_THRESHOLD))
- mpn_toom32_mul (prodp, up, un, vp, vn, scratch);
- else
- mpn_toom53_mul (prodp, up, un, vp, vn, scratch);
- }
- else
- {
- if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM53_THRESHOLD))
- mpn_toom42_mul (prodp, up, un, vp, vn, scratch);
- else
- mpn_toom53_mul (prodp, up, un, vp, vn, scratch);
- }
- }
- else
- {
- if (BELOW_THRESHOLD (vn, MUL_TOOM42_TO_TOOM63_THRESHOLD))
- mpn_toom42_mul (prodp, up, un, vp, vn, scratch);
- else
- mpn_toom63_mul (prodp, up, un, vp, vn, scratch);
- }
- }
- TMP_SFREE;
- }
- else
- {
- mp_ptr scratch;
- TMP_DECL; TMP_MARK;
-
- if (BELOW_THRESHOLD (vn, MUL_TOOM6H_THRESHOLD))
- {
- scratch = TMP_ALLOC_LIMBS (mpn_toom44_mul_itch (un, vn));
- mpn_toom44_mul (prodp, up, un, vp, vn, scratch);
- }
- else if (BELOW_THRESHOLD (vn, MUL_TOOM8H_THRESHOLD))
- {
- scratch = TMP_ALLOC_LIMBS (mpn_toom6h_mul_itch (un, vn));
- mpn_toom6h_mul (prodp, up, un, vp, vn, scratch);
- }
- else
- {
- scratch = TMP_ALLOC_LIMBS (mpn_toom8h_mul_itch (un, vn));
- mpn_toom8h_mul (prodp, up, un, vp, vn, scratch);
- }
- TMP_FREE;
- }
+ mpn_mul_fft_full (prodp, up, un, vp, vn);
+ return prodp[un + vn - 1];
}
- else
- {
- if (un >= 8 * vn)
- {
- mp_limb_t cy;
- mp_ptr ws;
- TMP_DECL; TMP_MARK;
-
- /* The maximum ws usage is for the mpn_mul result. */
- ws = TMP_BALLOC_LIMBS (9 * vn >> 1);
-
- mpn_fft_mul (prodp, up, 3 * vn, vp, vn);
- un -= 3 * vn;
- up += 3 * vn;
- prodp += 3 * vn;
- while (2 * un >= 7 * vn) /* un >= 3.5vn */
- {
- mpn_fft_mul (ws, up, 3 * vn, vp, vn);
- un -= 3 * vn;
- up += 3 * vn;
- cy = mpn_add_n (prodp, prodp, ws, vn);
- MPN_COPY (prodp + vn, ws + vn, 3 * vn);
- mpn_incr_u (prodp + vn, cy);
- prodp += 3 * vn;
- }
-
- /* vn / 2 <= un < 3.5vn */
-
- if (un < vn)
- mpn_mul (ws, vp, vn, up, un);
- else
- mpn_mul (ws, up, un, vp, vn);
-
- cy = mpn_add_n (prodp, prodp, ws, vn);
- MPN_COPY (prodp + vn, ws + vn, un);
- mpn_incr_u (prodp + vn, cy);
-
- TMP_FREE;
- }
- else
- mpn_fft_mul (prodp, up, un, vp, vn);
- }
+ {
+ mp_ptr ws;
+ mp_ptr scratch;
+#if WANT_ASSERT
+ mp_ptr ssssp;
+#endif
+ TMP_DECL;
+ TMP_MARK;
+
+#define WSALL (4 * vn)
+ ws = TMP_SALLOC_LIMBS (WSALL + 1);
+
+#define ITCH ((un + vn) * 4 + 100)
+ scratch = TMP_ALLOC_LIMBS (ITCH + 1);
+#if WANT_ASSERT
+ ssssp = scratch + ITCH;
+ ws[WSALL] = 0xbabecafe;
+ ssssp[0] = 0xbeef;
+#endif
- return prodp[un + vn - 1]; /* historic */
+ if (un >= 3 * vn)
+ {
+ mp_limb_t cy;
+
+ mpn_toom42_mul (prodp, up, 2 * vn, vp, vn, scratch);
+ un -= 2 * vn;
+ up += 2 * vn;
+ prodp += 2 * vn;
+
+ while (un >= 3 * vn)
+ {
+ mpn_toom42_mul (ws, up, 2 * vn, vp, vn, scratch);
+ un -= 2 * vn;
+ up += 2 * vn;
+ cy = mpn_add_n (prodp, prodp, ws, vn);
+ MPN_COPY (prodp + vn, ws + vn, 2 * vn);
+ mpn_incr_u (prodp + vn, cy);
+ prodp += 2 * vn;
+ }
+
+ if (5 * un > 9 * vn)
+ {
+ mpn_toom42_mul (ws, up, un, vp, vn, scratch);
+ cy = mpn_add_n (prodp, prodp, ws, vn);
+ MPN_COPY (prodp + vn, ws + vn, un);
+ mpn_incr_u (prodp + vn, cy);
+ }
+ else if (9 * un > 10 * vn)
+ {
+ mpn_toom32_mul (ws, up, un, vp, vn, scratch);
+ cy = mpn_add_n (prodp, prodp, ws, vn);
+ MPN_COPY (prodp + vn, ws + vn, un);
+ mpn_incr_u (prodp + vn, cy);
+ }
+ else
+ {
+ mpn_toom22_mul (ws, up, un, vp, vn, scratch);
+ cy = mpn_add_n (prodp, prodp, ws, vn);
+ MPN_COPY (prodp + vn, ws + vn, un);
+ mpn_incr_u (prodp + vn, cy);
+ }
+
+ ASSERT (ws[WSALL] == 0xbabecafe);
+ ASSERT (ssssp[0] == 0xbeef);
+ TMP_FREE;
+ return prodp[un + vn - 1];
+ }
+
+ if (un * 5 > vn * 9)
+ mpn_toom42_mul (prodp, up, un, vp, vn, scratch);
+ else if (9 * un > 10 * vn)
+ mpn_toom32_mul (prodp, up, un, vp, vn, scratch);
+ else
+ mpn_toom22_mul (prodp, up, un, vp, vn, scratch);
+
+ ASSERT (ws[WSALL] == 0xbabecafe);
+ ASSERT (ssssp[0] == 0xbeef);
+ TMP_FREE;
+ return prodp[un + vn - 1];
+ }
}
diff --git a/gmp/mpn/generic/mul_1.c b/gmp/mpn/generic/mul_1.c
index 6b2ee59a2c..b8290cc6af 100644
--- a/gmp/mpn/generic/mul_1.c
+++ b/gmp/mpn/generic/mul_1.c
@@ -1,33 +1,23 @@
/* mpn_mul_1 -- Multiply a limb vector with a single limb and store the
product in a second limb vector.
-Copyright 1991-1994, 1996, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1992, 1993, 1994, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/mul_basecase.c b/gmp/mpn/generic/mul_basecase.c
index 9309ef72c8..4f02545d57 100644
--- a/gmp/mpn/generic/mul_basecase.c
+++ b/gmp/mpn/generic/mul_basecase.c
@@ -4,33 +4,24 @@
THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-Copyright 1991-1994, 1996, 1997, 2000-2002 Free Software Foundation, Inc.
+
+Copyright 1991, 1992, 1993, 1994, 1996, 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -42,7 +33,7 @@ see https://www.gnu.org/licenses/. */
Note that prodp gets usize+vsize limbs stored, even if the actual result
only needs usize+vsize-1.
- There's no good reason to call here with vsize>=MUL_TOOM22_THRESHOLD.
+ There's no good reason to call here with vsize>=MUL_KARATSUBA_THRESHOLD.
Currently this is allowed, but it might not be in the future.
This is the most critical code for multiplication. All multiplies rely
diff --git a/gmp/mpn/generic/mul_fft.c b/gmp/mpn/generic/mul_fft.c
index 5e763a3a73..836a89a001 100644
--- a/gmp/mpn/generic/mul_fft.c
+++ b/gmp/mpn/generic/mul_fft.c
@@ -6,33 +6,23 @@
SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1998-2010, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* References:
@@ -70,79 +60,76 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#ifdef WANT_ADDSUB
-#include "generic/add_n_sub_n.c"
-#define HAVE_NATIVE_mpn_add_n_sub_n 1
+#include "generic/addsub_n.c"
+#define HAVE_NATIVE_mpn_addsub_n 1
#endif
-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 *, mp_size_t, mp_size_t, mp_srcptr,
- mp_size_t, mp_size_t, mp_size_t, mp_ptr);
+static mp_limb_t mpn_mul_fft_internal
+__GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, int, int, mp_ptr *, mp_ptr *,
+ mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_size_t, int **, mp_ptr,
+ int));
/* Find the best k to use for a mod 2^(m*GMP_NUMB_BITS)+1 FFT for m >= n.
- We have sqr=0 if for a multiply, sqr=1 for a square.
- There are three generations of this code; we keep the old ones as long as
- some gmp-mparam.h is not updated. */
-
-
-/*****************************************************************************/
-
-#if TUNE_PROGRAM_BUILD || (defined (MUL_FFT_TABLE3) && defined (SQR_FFT_TABLE3))
+ sqr==0 if for a multiply, sqr==1 for a square.
+ Don't declare it static since it is needed by tuneup.
+*/
+#ifdef MUL_FFT_TABLE2
-#ifndef FFT_TABLE3_SIZE /* When tuning this is defined in gmp-impl.h */
-#if defined (MUL_FFT_TABLE3_SIZE) && defined (SQR_FFT_TABLE3_SIZE)
-#if MUL_FFT_TABLE3_SIZE > SQR_FFT_TABLE3_SIZE
-#define FFT_TABLE3_SIZE MUL_FFT_TABLE3_SIZE
+#if defined (MUL_FFT_TABLE2_SIZE) && defined (SQR_FFT_TABLE2_SIZE)
+#if MUL_FFT_TABLE2_SIZE > SQR_FFT_TABLE2_SIZE
+#define FFT_TABLE2_SIZE MUL_FFT_TABLE2_SIZE
#else
-#define FFT_TABLE3_SIZE SQR_FFT_TABLE3_SIZE
-#endif
+#define FFT_TABLE2_SIZE SQR_FFT_TABLE2_SIZE
#endif
#endif
-#ifndef FFT_TABLE3_SIZE
-#define FFT_TABLE3_SIZE 200
+#ifndef FFT_TABLE2_SIZE
+#define FFT_TABLE2_SIZE 200
#endif
-FFT_TABLE_ATTRS struct fft_table_nk mpn_fft_table3[2][FFT_TABLE3_SIZE] =
+/* FIXME: The format of this should change to need less space.
+ Perhaps put n and k in the same 32-bit word, with n shifted-down
+ (k-2) steps, and k using the 4-5 lowest bits. That's possible since
+ n-1 is highly divisible.
+ Alternatively, separate n and k out into separate arrays. */
+struct nk {
+ unsigned int n:27;
+ unsigned int k:5;
+};
+
+static struct nk mpn_fft_table2[2][FFT_TABLE2_SIZE] =
{
- MUL_FFT_TABLE3,
- SQR_FFT_TABLE3
+ MUL_FFT_TABLE2,
+ SQR_FFT_TABLE2
};
int
mpn_fft_best_k (mp_size_t n, int sqr)
{
- FFT_TABLE_ATTRS struct fft_table_nk *fft_tab, *tab;
- mp_size_t tab_n, thres;
+ struct nk *tab;
int last_k;
- fft_tab = mpn_fft_table3[sqr];
- last_k = fft_tab->k;
- for (tab = fft_tab + 1; ; tab++)
+ last_k = 4;
+ for (tab = mpn_fft_table2[sqr] + 1; ; tab++)
{
- tab_n = tab->n;
- thres = tab_n << last_k;
- if (n <= thres)
+ if (n < tab->n)
break;
last_k = tab->k;
}
return last_k;
}
-
-#define MPN_FFT_BEST_READY 1
#endif
-/*****************************************************************************/
-
-#if ! defined (MPN_FFT_BEST_READY)
+#if !defined (MUL_FFT_TABLE2) || TUNE_PROGRAM_BUILD
FFT_TABLE_ATTRS mp_size_t mpn_fft_table[2][MPN_FFT_TABLE_SIZE] =
{
MUL_FFT_TABLE,
SQR_FFT_TABLE
};
+#endif
+#if !defined (MUL_FFT_TABLE2)
int
mpn_fft_best_k (mp_size_t n, int sqr)
{
@@ -160,9 +147,6 @@ mpn_fft_best_k (mp_size_t n, int sqr)
}
#endif
-/*****************************************************************************/
-
-
/* Returns smallest possible number of limbs >= pl for a fft of size 2^k,
i.e. smallest multiple of 2^k >= pl.
@@ -196,97 +180,137 @@ mpn_fft_initl (int **l, int k)
}
}
+/* Shift {up, n} of cnt bits to the left, store the complemented result
+ in {rp, n}, and output the shifted bits (not complemented).
+ Same as:
+ cc = mpn_lshift (rp, up, n, cnt);
+ mpn_com_n (rp, rp, n);
+ return cc;
-/* r <- a*2^d mod 2^(n*GMP_NUMB_BITS)+1 with a = {a, n+1}
+ Assumes n >= 1, 1 < cnt < GMP_NUMB_BITS, rp >= up.
+*/
+#ifndef HAVE_NATIVE_mpn_lshiftc
+#undef mpn_lshiftc
+static mp_limb_t
+mpn_lshiftc (mp_ptr rp, mp_srcptr up, mp_size_t n, unsigned int cnt)
+{
+ mp_limb_t high_limb, low_limb;
+ unsigned int tnc;
+ mp_size_t i;
+ mp_limb_t retval;
+
+ up += n;
+ rp += n;
+
+ tnc = GMP_NUMB_BITS - cnt;
+ low_limb = *--up;
+ retval = low_limb >> tnc;
+ high_limb = (low_limb << cnt);
+
+ for (i = n - 1; i != 0; i--)
+ {
+ low_limb = *--up;
+ *--rp = (~(high_limb | (low_limb >> tnc))) & GMP_NUMB_MASK;
+ high_limb = low_limb << cnt;
+ }
+ *--rp = (~high_limb) & GMP_NUMB_MASK;
+
+ return retval;
+}
+#endif
+
+/* r <- a*2^e mod 2^(n*GMP_NUMB_BITS)+1 with a = {a, n+1}
Assumes a is semi-normalized, i.e. a[n] <= 1.
r and a must have n+1 limbs, and not overlap.
*/
static void
-mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t d, mp_size_t n)
+mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, unsigned int d, mp_size_t n)
{
- unsigned int sh;
- mp_size_t m;
+ int sh, negate;
mp_limb_t cc, rd;
sh = d % GMP_NUMB_BITS;
- m = d / GMP_NUMB_BITS;
+ d /= GMP_NUMB_BITS;
+ negate = d >= n;
+ if (negate)
+ d -= n;
- if (m >= n) /* negate */
+ if (negate)
{
- /* r[0..m-1] <-- lshift(a[n-m]..a[n-1], sh)
- r[m..n-1] <-- -lshift(a[0]..a[n-m-1], sh) */
-
- m -= n;
+ /* r[0..d-1] <-- lshift(a[n-d]..a[n-1], sh)
+ r[d..n-1] <-- -lshift(a[0]..a[n-d-1], sh) */
if (sh != 0)
{
/* no out shift below since a[n] <= 1 */
- mpn_lshift (r, a + n - m, m + 1, sh);
- rd = r[m];
- cc = mpn_lshiftc (r + m, a, n - m, sh);
+ mpn_lshift (r, a + n - d, d + 1, sh);
+ rd = r[d];
+ cc = mpn_lshiftc (r + d, a, n - d, sh);
}
else
{
- MPN_COPY (r, a + n - m, m);
+ MPN_COPY (r, a + n - d, d);
rd = a[n];
- mpn_com (r + m, a, n - m);
+ mpn_com_n (r + d, a, n - d);
cc = 0;
}
- /* add cc to r[0], and add rd to r[m] */
+ /* add cc to r[0], and add rd to r[d] */
- /* now add 1 in r[m], subtract 1 in r[n], i.e. add 1 in r[0] */
+ /* now add 1 in r[d], 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 */
cc++;
mpn_incr_u (r, cc);
- rd++;
+ rd ++;
/* rd might overflow when sh=GMP_NUMB_BITS-1 */
cc = (rd == 0) ? 1 : rd;
- r = r + m + (rd == 0);
+ r = r + d + (rd == 0);
mpn_incr_u (r, cc);
+
+ return;
+ }
+
+ /* if negate=0,
+ r[0..d-1] <-- -lshift(a[n-d]..a[n-1], sh)
+ r[d..n-1] <-- lshift(a[0]..a[n-d-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 */
}
else
{
- /* 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 - 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[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 + m, a, n - m);
- cc = 0;
- }
+ /* r[d] is not used below, but we save a test for d=0 */
+ mpn_com_n (r, a + n - d, d + 1);
+ rd = a[n];
+ MPN_COPY (r + d, a, n - d);
+ cc = 0;
+ }
- /* now complement {r, m}, subtract cc from r[0], subtract rd from r[m] */
+ /* now complement {r, d}, subtract cc from r[0], subtract rd from r[d] */
- /* if m=0 we just have r[0]=a[n] << sh */
- if (m != 0)
- {
- /* 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, m, cc) + 1;
- /* add 1 to cc instead of rd since rd might overflow */
- }
+ /* if d=0 we just have r[0]=a[n] << sh */
+ if (d != 0)
+ {
+ /* now add 1 in r[0], subtract 1 in r[d] */
+ 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;
+ /* add 1 to cc instead of rd since rd might overflow */
+ }
- /* now subtract cc and rd from r[m..n] */
+ /* now subtract cc and rd from r[d..n] */
- 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));
- }
+ r[n] = -mpn_sub_1 (r + d, r + d, n - d, cc);
+ r[n] -= mpn_sub_1 (r + d, r + d, n - d, rd);
+ if (r[n] & GMP_LIMB_HIGHBIT)
+ r[n] = mpn_add_1 (r, r, n, CNST_LIMB(1));
}
@@ -294,7 +318,7 @@ mpn_fft_mul_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t 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, mp_size_t n)
+mpn_fft_add_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, int n)
{
mp_limb_t c, x;
@@ -325,7 +349,7 @@ mpn_fft_add_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, mp_size_t n)
Assumes a and b are semi-normalized.
*/
static inline void
-mpn_fft_sub_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, mp_size_t n)
+mpn_fft_sub_modF (mp_ptr r, mp_srcptr a, mp_srcptr b, int n)
{
mp_limb_t c, x;
@@ -363,8 +387,8 @@ mpn_fft_fft (mp_ptr *Ap, mp_size_t K, int **ll,
if (K == 2)
{
mp_limb_t cy;
-#if HAVE_NATIVE_mpn_add_n_sub_n
- cy = mpn_add_n_sub_n (Ap[0], Ap[inc], Ap[0], Ap[inc], n + 1) & 1;
+#if HAVE_NATIVE_mpn_addsub_n
+ cy = mpn_addsub_n (Ap[0], Ap[inc], Ap[0], Ap[inc], n + 1) & 1;
#else
MPN_COPY (tp, Ap[0], n + 1);
mpn_add_n (Ap[0], Ap[0], Ap[inc], n + 1);
@@ -377,14 +401,14 @@ mpn_fft_fft (mp_ptr *Ap, mp_size_t K, int **ll,
}
else
{
- mp_size_t j, K2 = K >> 1;
+ int j;
int *lk = *ll;
- 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);
+ 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);
/* 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 < K2; j++, lk += 2, Ap += 2 * inc)
+ for (j = 0; j < (K >> 1); 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) */
@@ -429,7 +453,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, mp_size_t K)
+mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, int K)
{
int i;
int sqr = (ap == bp);
@@ -439,13 +463,12 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, mp_size_t K)
if (n >= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
{
- mp_size_t K2, nprime2, Nprime2, M2, maxLK, l, Mp2;
- int k;
- int **fft_l, *tmp;
+ int k, K2, nprime2, Nprime2, M2, maxLK, l, Mp2;
+ int **_fft_l;
mp_ptr *Ap, *Bp, A, B, T;
k = mpn_fft_best_k (n, sqr);
- K2 = (mp_size_t) 1 << k;
+ K2 = 1 << k;
ASSERT_ALWAYS((n & (K2 - 1)) == 0);
maxLK = (K2 > GMP_NUMB_BITS) ? K2 : GMP_NUMB_BITS;
M2 = n * GMP_NUMB_BITS >> k;
@@ -457,10 +480,10 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, mp_size_t K)
/* we should ensure that nprime2 is a multiple of the next K */
if (nprime2 >= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
{
- mp_size_t K3;
+ unsigned long K3;
for (;;)
{
- K3 = (mp_size_t) 1 << mpn_fft_best_k (nprime2, sqr);
+ K3 = 1L << mpn_fft_best_k (nprime2, sqr);
if ((nprime2 & (K3 - 1)) == 0)
break;
nprime2 = (nprime2 + K3 - 1) & -K3;
@@ -472,53 +495,41 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, mp_size_t K)
Mp2 = Nprime2 >> k;
- 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_BALLOC_TYPE (k + 1, int *);
- tmp = TMP_BALLOC_TYPE ((size_t) 2 << k, int);
+ Ap = TMP_ALLOC_MP_PTRS (K2);
+ Bp = TMP_ALLOC_MP_PTRS (K2);
+ A = TMP_ALLOC_LIMBS (2 * K2 * (nprime2 + 1));
+ T = TMP_ALLOC_LIMBS (2 * (nprime2 + 1));
+ B = A + K2 * (nprime2 + 1);
+ _fft_l = TMP_ALLOC_TYPE (k + 1, int *);
for (i = 0; i <= k; i++)
- {
- fft_l[i] = tmp;
- tmp += (mp_size_t) 1 << i;
- }
+ _fft_l[i] = TMP_ALLOC_TYPE (1<<i, int);
+ mpn_fft_initl (_fft_l, k);
- mpn_fft_initl (fft_l, k);
-
- TRACE (printf ("recurse: %ldx%ld limbs -> %ld times %ldx%ld (%1.2f)\n", n,
+ TRACE (printf ("recurse: %ldx%ld limbs -> %d times %dx%d (%1.2f)\n", n,
n, K2, nprime2, nprime2, 2.0*(double)n/nprime2/K2));
for (i = 0; i < K; i++, ap++, bp++)
{
- mp_limb_t cy;
mpn_fft_normalize (*ap, n);
if (!sqr)
mpn_fft_normalize (*bp, n);
-
- mpn_mul_fft_decompose (A, Ap, K2, nprime2, *ap, (l << k) + 1, l, Mp2, T);
- if (!sqr)
- mpn_mul_fft_decompose (B, Bp, K2, nprime2, *bp, (l << k) + 1, l, Mp2, T);
-
- cy = mpn_mul_fft_internal (*ap, n, k, Ap, Bp, A, B, nprime2,
- l, Mp2, fft_l, T, sqr);
- (*ap)[n] = cy;
+ mpn_mul_fft_internal (*ap, *ap, *bp, n, k, K2, Ap, Bp, A, B, nprime2,
+ l, Mp2, _fft_l, T, 1);
}
}
else
{
mp_ptr a, b, tp, tpn;
mp_limb_t cc;
- mp_size_t n2 = 2 * n;
- tp = TMP_BALLOC_LIMBS (n2);
+ int n2 = 2 * n;
+ tp = TMP_ALLOC_LIMBS (n2);
tpn = tp + n;
- TRACE (printf (" mpn_mul_n %ld of %ld limbs\n", K, n));
+ TRACE (printf (" mpn_mul_n %d of %ld limbs\n", K, n));
for (i = 0; i < K; i++)
{
a = *ap++;
b = *bp++;
if (sqr)
- mpn_sqr (tp, a, n);
+ mpn_sqr_n (tp, a, n);
else
mpn_mul_n (tp, b, a, n);
if (a[n] != 0)
@@ -546,13 +557,13 @@ mpn_fft_mul_modF_K (mp_ptr *ap, mp_ptr *bp, mp_size_t n, mp_size_t K)
This condition is also fulfilled at exit.
*/
static void
-mpn_fft_fftinv (mp_ptr *Ap, mp_size_t K, mp_size_t omega, mp_size_t n, mp_ptr tp)
+mpn_fft_fftinv (mp_ptr *Ap, int K, mp_size_t omega, mp_size_t n, mp_ptr tp)
{
if (K == 2)
{
mp_limb_t cy;
-#if HAVE_NATIVE_mpn_add_n_sub_n
- cy = mpn_add_n_sub_n (Ap[0], Ap[1], Ap[0], Ap[1], n + 1) & 1;
+#if HAVE_NATIVE_mpn_addsub_n
+ cy = mpn_addsub_n (Ap[0], Ap[1], Ap[0], Ap[1], n + 1) & 1;
#else
MPN_COPY (tp, Ap[0], n + 1);
mpn_add_n (Ap[0], Ap[0], Ap[1], n + 1);
@@ -565,7 +576,7 @@ mpn_fft_fftinv (mp_ptr *Ap, mp_size_t K, mp_size_t omega, mp_size_t n, mp_ptr tp
}
else
{
- mp_size_t j, K2 = K >> 1;
+ int j, K2 = K >> 1;
mpn_fft_fftinv (Ap, K2, 2 * omega, n, tp);
mpn_fft_fftinv (Ap + K2, K2, 2 * omega, n, tp);
@@ -583,14 +594,15 @@ mpn_fft_fftinv (mp_ptr *Ap, mp_size_t K, mp_size_t omega, mp_size_t n, mp_ptr tp
}
-/* R <- A/2^k mod 2^(n*GMP_NUMB_BITS)+1 */
+/* A <- A/2^k mod 2^(n*GMP_NUMB_BITS)+1 */
static void
-mpn_fft_div_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t k, mp_size_t n)
+mpn_fft_div_2exp_modF (mp_ptr r, mp_srcptr a, int k, mp_size_t n)
{
- mp_bitcnt_t i;
+ int i;
ASSERT (r != a);
- i = (mp_bitcnt_t) 2 * n * GMP_NUMB_BITS - k;
+ i = 2 * n * GMP_NUMB_BITS;
+ i = (i - k) % i; /* FIXME: This % looks superfluous */
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 */
@@ -602,11 +614,13 @@ mpn_fft_div_2exp_modF (mp_ptr r, mp_srcptr a, mp_bitcnt_t 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 mp_size_t
+static int
mpn_fft_norm_modF (mp_ptr rp, mp_size_t n, mp_ptr ap, mp_size_t an)
{
- mp_size_t l, m, rpn;
+ mp_size_t l;
+ long int m;
mp_limb_t cc;
+ int rpn;
ASSERT ((n <= an) && (an <= 3 * n));
m = an - 2 * n;
@@ -640,11 +654,10 @@ 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, 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)
+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)
{
- mp_size_t i, j;
+ int i, j;
mp_ptr tmp;
mp_size_t Kl = K * l;
TMP_DECL;
@@ -655,7 +668,7 @@ mpn_mul_fft_decompose (mp_ptr A, mp_ptr *Ap, mp_size_t K, mp_size_t nprime,
mp_size_t dif = nl - Kl;
mp_limb_signed_t cy;
- tmp = TMP_BALLOC_LIMBS(Kl + 1);
+ tmp = TMP_ALLOC_LIMBS(Kl + 1);
if (dif > Kl)
{
@@ -717,30 +730,48 @@ mpn_mul_fft_decompose (mp_ptr A, mp_ptr *Ap, mp_size_t K, mp_size_t nprime,
}
/* op <- n*m mod 2^N+1 with fft of size 2^k where N=pl*GMP_NUMB_BITS
- op is pl limbs, its high bit is returned.
+ n and m have respectively nl and ml limbs
+ op must have space for pl+1 limbs if rec=1 (and pl limbs if rec=0).
One must have pl = mpn_fft_next_size (pl, k).
T must have space for 2 * (nprime + 1) limbs.
+
+ If rec=0, then store only the pl low bits of the result, and return
+ the out carry.
*/
static mp_limb_t
-mpn_mul_fft_internal (mp_ptr op, mp_size_t pl, int k,
- mp_ptr *Ap, mp_ptr *Bp, mp_ptr A, mp_ptr B,
+mpn_mul_fft_internal (mp_ptr op, mp_srcptr n, mp_srcptr m, mp_size_t pl,
+ int k, int K,
+ mp_ptr *Ap, mp_ptr *Bp,
+ mp_ptr A, mp_ptr B,
mp_size_t nprime, mp_size_t l, mp_size_t Mp,
- int **fft_l, mp_ptr T, int sqr)
+ int **_fft_l,
+ mp_ptr T, int rec)
{
- mp_size_t K, i, pla, lo, sh, j;
+ int i, sqr, pla, lo, sh, j;
mp_ptr p;
mp_limb_t cc;
- K = (mp_size_t) 1 << k;
+ sqr = n == m;
+
+ TRACE (printf ("pl=%ld k=%d K=%d np=%ld l=%ld Mp=%ld rec=%d sqr=%d\n",
+ pl,k,K,nprime,l,Mp,rec,sqr));
+
+ /* decomposition of inputs into arrays Ap[i] and Bp[i] */
+ if (rec)
+ {
+ mpn_mul_fft_decompose (A, Ap, K, nprime, n, K * l + 1, l, Mp, T);
+ if (!sqr)
+ mpn_mul_fft_decompose (B, Bp, K, nprime, m, K * l + 1, l, Mp, T);
+ }
/* direct fft's */
- mpn_fft_fft (Ap, K, fft_l + k, 2 * Mp, nprime, 1, T);
+ mpn_fft_fft (Ap, K, _fft_l + k, 2 * Mp, nprime, 1, T);
if (!sqr)
- mpn_fft_fft (Bp, K, fft_l + k, 2 * Mp, nprime, 1, T);
+ mpn_fft_fft (Bp, K, _fft_l + k, 2 * Mp, nprime, 1, T);
/* term to term multiplications */
- mpn_fft_mul_modF_K (Ap, sqr ? Ap : Bp, nprime, K);
+ mpn_fft_mul_modF_K (Ap, (sqr) ? Ap : Bp, nprime, K);
/* inverse fft's */
mpn_fft_fftinv (Ap, K, 2 * Mp, nprime, T);
@@ -804,14 +835,18 @@ mpn_mul_fft_internal (mp_ptr op, mp_size_t pl, int k,
/* here p < 2^(2M) [K 2^(M(K-1)) + (K-1) 2^(M(K-2)) + ... ]
< K 2^(2M) [2^(M(K-1)) + 2^(M(K-2)) + ... ]
< K 2^(2M) 2^(M(K-1))*2 = 2^(M*K+M+k+1) */
- return mpn_fft_norm_modF (op, pl, p, pla);
+ i = mpn_fft_norm_modF (op, pl, p, pla);
+ if (rec) /* store the carry out */
+ op[pl] = i;
+
+ return i;
}
/* return the lcm of a and 2^k */
-static mp_bitcnt_t
-mpn_mul_fft_lcm (mp_bitcnt_t a, int k)
+static unsigned long int
+mpn_mul_fft_lcm (unsigned long int a, unsigned int k)
{
- mp_bitcnt_t l = k;
+ unsigned long int l = k;
while (a % 2 == 0 && k > 0)
{
@@ -828,11 +863,10 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl,
mp_srcptr m, mp_size_t ml,
int k)
{
- int i;
- mp_size_t K, maxLK;
+ int K, maxLK, i;
mp_size_t N, Nprime, nprime, M, Mp, l;
mp_ptr *Ap, *Bp, A, T, B;
- int **fft_l, *tmp;
+ int **_fft_l;
int sqr = (n == m && nl == ml);
mp_limb_t h;
TMP_DECL;
@@ -842,72 +876,63 @@ mpn_mul_fft (mp_ptr op, mp_size_t pl,
TMP_MARK;
N = pl * GMP_NUMB_BITS;
- fft_l = TMP_BALLOC_TYPE (k + 1, int *);
- tmp = TMP_BALLOC_TYPE ((size_t) 2 << k, int);
+ _fft_l = TMP_ALLOC_TYPE (k + 1, int *);
for (i = 0; i <= k; i++)
- {
- fft_l[i] = tmp;
- tmp += (mp_size_t) 1 << i;
- }
-
- mpn_fft_initl (fft_l, k);
- K = (mp_size_t) 1 << k;
+ _fft_l[i] = TMP_ALLOC_TYPE (1 << i, int);
+ mpn_fft_initl (_fft_l, k);
+ K = 1 << k;
M = N >> k; /* N = 2^k M */
l = 1 + (M - 1) / GMP_NUMB_BITS;
- maxLK = mpn_mul_fft_lcm (GMP_NUMB_BITS, k); /* lcm (GMP_NUMB_BITS, 2^k) */
+ maxLK = mpn_mul_fft_lcm ((unsigned long) 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=%ld, M=%ld, l=%ld, maxLK=%ld, Np=%ld, np=%ld\n",
+ TRACE (printf ("N=%ld K=%d, M=%ld, l=%ld, maxLK=%d, 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))
{
- mp_size_t K2;
+ unsigned long K2;
for (;;)
{
- K2 = (mp_size_t) 1 << mpn_fft_best_k (nprime, sqr);
+ K2 = 1L << 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=%ld, Np=%ld, np=%ld\n", maxLK, Nprime, nprime));
+ TRACE (printf ("new maxLK=%d, Np=%ld, np=%ld\n", maxLK, Nprime, nprime));
}
ASSERT_ALWAYS (nprime < pl); /* otherwise we'll loop */
- T = TMP_BALLOC_LIMBS (2 * (nprime + 1));
+ T = TMP_ALLOC_LIMBS (2 * (nprime + 1));
Mp = Nprime >> k;
- TRACE (printf ("%ldx%ld limbs -> %ld times %ldx%ld limbs (%1.2f)\n",
+ TRACE (printf ("%ldx%ld limbs -> %d 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_BALLOC_LIMBS (K * (nprime + 1));
- Ap = TMP_BALLOC_MP_PTRS (K);
+ A = __GMP_ALLOCATE_FUNC_LIMBS (2 * K * (nprime + 1));
+ B = A + K * (nprime + 1);
+ Ap = TMP_ALLOC_MP_PTRS (K);
+ Bp = TMP_ALLOC_MP_PTRS (K);
+
+ /* special decomposition for main call */
+ /* nl is the number of significant limbs in n */
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_BALLOC_LIMBS (pla);
- Bp = TMP_BALLOC_MP_PTRS (K);
- }
- else
- {
- 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);
+ if (n != m)
+ mpn_mul_fft_decompose (B, Bp, K, nprime, m, ml, l, Mp, T);
+
+ h = mpn_mul_fft_internal (op, n, m, pl, k, K, Ap, Bp, A, B, nprime, l, Mp, _fft_l, T, 0);
TMP_FREE;
+ __GMP_FREE_FUNC_LIMBS (A, 2 * K * (nprime + 1));
+
return h;
}
-#if WANT_OLD_FFT_FULL
/* multiply {n, nl} by {m, ml}, and put the result in {op, nl+ml} */
void
mpn_mul_fft_full (mp_ptr op,
@@ -916,9 +941,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 */
@@ -935,7 +960,7 @@ mpn_mul_fft_full (mp_ptr op,
pl2 = (2 * pl - 1) / 5; /* ceil (2pl/5) - 1 */
do
{
- pl2++;
+ pl2 ++;
k2 = mpn_fft_best_k (pl2, sqr); /* best fft size for pl2 limbs */
pl2 = mpn_fft_next_size (pl2, k2);
pl3 = 3 * pl2 / 2; /* since k>=FFT_FIRST_K=4, pl2 is a multiple of 2^4,
@@ -949,23 +974,23 @@ mpn_mul_fft_full (mp_ptr op,
ASSERT_ALWAYS(pl3 <= pl);
cc = mpn_mul_fft (op, pl3, n, nl, m, ml, k3); /* mu */
- ASSERT(cc == 0);
+ ASSERT_ALWAYS(cc == 0);
pad_op = __GMP_ALLOCATE_FUNC_LIMBS (pl2);
cc = mpn_mul_fft (pad_op, pl2, n, nl, m, ml, k2); /* lambda */
cc = -cc + mpn_sub_n (pad_op, pad_op, op, pl2); /* lambda - low(mu) */
/* 0 <= cc <= 1 */
- ASSERT(0 <= cc && cc <= 1);
+ ASSERT_ALWAYS(0 <= cc && cc <= 1);
l = pl3 - pl2; /* l = pl2 / 2 since pl3 = 3/2 * pl2 */
c2 = mpn_add_n (pad_op, pad_op, op + pl2, l);
cc = mpn_add_1 (pad_op + l, pad_op + l, l, (mp_limb_t) c2) - cc;
- ASSERT(-1 <= cc && cc <= 1);
+ ASSERT_ALWAYS(-1 <= cc && cc <= 1);
if (cc < 0)
cc = mpn_add_1 (pad_op, pad_op, pl2, (mp_limb_t) -cc);
- ASSERT(0 <= cc && cc <= 1);
+ ASSERT_ALWAYS(0 <= cc && cc <= 1);
/* now lambda-mu = {pad_op, pl2} - cc mod 2^(pl2*GMP_NUMB_BITS)+1 */
oldcc = cc;
-#if HAVE_NATIVE_mpn_add_n_sub_n
- c2 = mpn_add_n_sub_n (pad_op + l, pad_op, pad_op, pad_op + l, l);
+#if HAVE_NATIVE_mpn_addsub_n
+ c2 = mpn_addsub_n (pad_op + l, pad_op, pad_op, pad_op + l, l);
/* c2 & 1 is the borrow, c2 & 2 is the carry */
cc += c2 >> 1; /* carry out from high <- low + high */
c2 = c2 & 1; /* borrow out from low <- low - high */
@@ -975,7 +1000,7 @@ mpn_mul_fft_full (mp_ptr op,
TMP_DECL;
TMP_MARK;
- tmp = TMP_BALLOC_LIMBS (l);
+ tmp = TMP_ALLOC_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);
@@ -1011,4 +1036,3 @@ mpn_mul_fft_full (mp_ptr op,
/* since the final result has at most pl limbs, no carry out below */
mpn_add_1 (op + pl2, op + pl2, pl - pl2, (mp_limb_t) c2);
}
-#endif
diff --git a/gmp/mpn/generic/mul_n.c b/gmp/mpn/generic/mul_n.c
index 5df8b16fa0..4aa25f9b58 100644
--- a/gmp/mpn/generic/mul_n.c
+++ b/gmp/mpn/generic/mul_n.c
@@ -1,38 +1,695 @@
-/* mpn_mul_n -- multiply natural numbers.
+/* mpn_mul_n and helper function -- Multiply/square natural numbers.
-Copyright 1991, 1993, 1994, 1996-2003, 2005, 2008, 2009 Free Software
-Foundation, Inc.
+ THE HELPER FUNCTIONS IN THIS FILE (meaning everything except mpn_mul_n) 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 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+
+/* Multiplies using 3 half-sized mults and so on recursively.
+ * p[0..2*n-1] := product of a[0..n-1] and b[0..n-1].
+ * No overlap of p[...] with a[...] or b[...].
+ * ws is workspace.
+ */
+
+void
+mpn_kara_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n, mp_ptr ws)
+{
+ mp_limb_t w, w0, w1;
+ mp_size_t n2;
+ mp_srcptr x, y;
+ mp_size_t i;
+ int sign;
+
+ n2 = n >> 1;
+ ASSERT (n2 > 0);
+
+ if ((n & 1) != 0)
+ {
+ /* Odd length. */
+ mp_size_t n1, n3, nm1;
+
+ n3 = n - n2;
+
+ sign = 0;
+ w = a[n2];
+ if (w != 0)
+ w -= mpn_sub_n (p, a, a + n3, n2);
+ else
+ {
+ i = n2;
+ do
+ {
+ --i;
+ w0 = a[i];
+ w1 = a[n3 + i];
+ }
+ while (w0 == w1 && i != 0);
+ if (w0 < w1)
+ {
+ x = a + n3;
+ y = a;
+ sign = ~0;
+ }
+ else
+ {
+ x = a;
+ y = a + n3;
+ }
+ mpn_sub_n (p, x, y, n2);
+ }
+ p[n2] = w;
+
+ w = b[n2];
+ if (w != 0)
+ w -= mpn_sub_n (p + n3, b, b + n3, n2);
+ else
+ {
+ i = n2;
+ do
+ {
+ --i;
+ w0 = b[i];
+ w1 = b[n3 + i];
+ }
+ while (w0 == w1 && i != 0);
+ if (w0 < w1)
+ {
+ x = b + n3;
+ y = b;
+ sign = ~sign;
+ }
+ else
+ {
+ x = b;
+ y = b + n3;
+ }
+ mpn_sub_n (p + n3, x, y, n2);
+ }
+ p[n] = w;
+
+ n1 = n + 1;
+ if (n2 < MUL_KARATSUBA_THRESHOLD)
+ {
+ if (n3 < MUL_KARATSUBA_THRESHOLD)
+ {
+ mpn_mul_basecase (ws, p, n3, p + n3, n3);
+ mpn_mul_basecase (p, a, n3, b, n3);
+ }
+ else
+ {
+ mpn_kara_mul_n (ws, p, p + n3, n3, ws + n1);
+ mpn_kara_mul_n (p, a, b, n3, ws + n1);
+ }
+ mpn_mul_basecase (p + n1, a + n3, n2, b + n3, n2);
+ }
+ else
+ {
+ mpn_kara_mul_n (ws, p, p + n3, n3, ws + n1);
+ mpn_kara_mul_n (p, a, b, n3, ws + n1);
+ mpn_kara_mul_n (p + n1, a + n3, b + n3, n2, ws + n1);
+ }
+
+ if (sign)
+ mpn_add_n (ws, p, ws, n1);
+ else
+ mpn_sub_n (ws, p, ws, n1);
+
+ nm1 = n - 1;
+ if (mpn_add_n (ws, p + n1, ws, nm1))
+ {
+ mp_limb_t x = (ws[nm1] + 1) & GMP_NUMB_MASK;
+ ws[nm1] = x;
+ if (x == 0)
+ ws[n] = (ws[n] + 1) & GMP_NUMB_MASK;
+ }
+ if (mpn_add_n (p + n3, p + n3, ws, n1))
+ {
+ mpn_incr_u (p + n1 + n3, 1);
+ }
+ }
+ else
+ {
+ /* Even length. */
+ i = n2;
+ do
+ {
+ --i;
+ w0 = a[i];
+ w1 = a[n2 + i];
+ }
+ while (w0 == w1 && i != 0);
+ sign = 0;
+ if (w0 < w1)
+ {
+ x = a + n2;
+ y = a;
+ sign = ~0;
+ }
+ else
+ {
+ x = a;
+ y = a + n2;
+ }
+ mpn_sub_n (p, x, y, n2);
+
+ i = n2;
+ do
+ {
+ --i;
+ w0 = b[i];
+ w1 = b[n2 + i];
+ }
+ while (w0 == w1 && i != 0);
+ if (w0 < w1)
+ {
+ x = b + n2;
+ y = b;
+ sign = ~sign;
+ }
+ else
+ {
+ x = b;
+ y = b + n2;
+ }
+ mpn_sub_n (p + n2, x, y, n2);
+
+ /* Pointwise products. */
+ if (n2 < MUL_KARATSUBA_THRESHOLD)
+ {
+ mpn_mul_basecase (ws, p, n2, p + n2, n2);
+ mpn_mul_basecase (p, a, n2, b, n2);
+ mpn_mul_basecase (p + n, a + n2, n2, b + n2, n2);
+ }
+ else
+ {
+ mpn_kara_mul_n (ws, p, p + n2, n2, ws + n);
+ mpn_kara_mul_n (p, a, b, n2, ws + n);
+ mpn_kara_mul_n (p + n, a + n2, b + n2, n2, ws + n);
+ }
+
+ /* Interpolate. */
+ if (sign)
+ w = mpn_add_n (ws, p, ws, n);
+ else
+ w = -mpn_sub_n (ws, p, ws, n);
+ w += mpn_add_n (ws, p + n, ws, n);
+ w += mpn_add_n (p + n2, p + n2, ws, n);
+ MPN_INCR_U (p + n2 + n, 2 * n - (n2 + n), w);
+ }
+}
+
+void
+mpn_kara_sqr_n (mp_ptr p, mp_srcptr a, mp_size_t n, mp_ptr ws)
+{
+ mp_limb_t w, w0, w1;
+ mp_size_t n2;
+ mp_srcptr x, y;
+ mp_size_t i;
+
+ n2 = n >> 1;
+ ASSERT (n2 > 0);
+
+ if ((n & 1) != 0)
+ {
+ /* Odd length. */
+ mp_size_t n1, n3, nm1;
+
+ n3 = n - n2;
+
+ w = a[n2];
+ if (w != 0)
+ w -= mpn_sub_n (p, a, a + n3, n2);
+ else
+ {
+ i = n2;
+ do
+ {
+ --i;
+ w0 = a[i];
+ w1 = a[n3 + i];
+ }
+ while (w0 == w1 && i != 0);
+ if (w0 < w1)
+ {
+ x = a + n3;
+ y = a;
+ }
+ else
+ {
+ x = a;
+ y = a + n3;
+ }
+ mpn_sub_n (p, x, y, n2);
+ }
+ p[n2] = w;
+
+ n1 = n + 1;
+
+ /* n2 is always either n3 or n3-1 so maybe the two sets of tests here
+ could be combined. But that's not important, since the tests will
+ take a miniscule amount of time compared to the function calls. */
+ if (BELOW_THRESHOLD (n3, SQR_BASECASE_THRESHOLD))
+ {
+ mpn_mul_basecase (ws, p, n3, p, n3);
+ mpn_mul_basecase (p, a, n3, a, n3);
+ }
+ else if (BELOW_THRESHOLD (n3, SQR_KARATSUBA_THRESHOLD))
+ {
+ mpn_sqr_basecase (ws, p, n3);
+ mpn_sqr_basecase (p, a, n3);
+ }
+ else
+ {
+ mpn_kara_sqr_n (ws, p, n3, ws + n1); /* (x-y)^2 */
+ mpn_kara_sqr_n (p, a, n3, ws + n1); /* x^2 */
+ }
+ if (BELOW_THRESHOLD (n2, SQR_BASECASE_THRESHOLD))
+ mpn_mul_basecase (p + n1, a + n3, n2, a + n3, n2);
+ else if (BELOW_THRESHOLD (n2, SQR_KARATSUBA_THRESHOLD))
+ mpn_sqr_basecase (p + n1, a + n3, n2);
+ else
+ mpn_kara_sqr_n (p + n1, a + n3, n2, ws + n1); /* y^2 */
+
+ /* Since x^2+y^2-(x-y)^2 = 2xy >= 0 there's no need to track the
+ borrow from mpn_sub_n. If it occurs then it'll be cancelled by a
+ carry from ws[n]. Further, since 2xy fits in n1 limbs there won't
+ be any carry out of ws[n] other than cancelling that borrow. */
+
+ mpn_sub_n (ws, p, ws, n1); /* x^2-(x-y)^2 */
+
+ nm1 = n - 1;
+ if (mpn_add_n (ws, p + n1, ws, nm1)) /* x^2+y^2-(x-y)^2 = 2xy */
+ {
+ mp_limb_t x = (ws[nm1] + 1) & GMP_NUMB_MASK;
+ ws[nm1] = x;
+ if (x == 0)
+ ws[n] = (ws[n] + 1) & GMP_NUMB_MASK;
+ }
+ if (mpn_add_n (p + n3, p + n3, ws, n1))
+ {
+ mpn_incr_u (p + n1 + n3, 1);
+ }
+ }
+ else
+ {
+ /* Even length. */
+ i = n2;
+ do
+ {
+ --i;
+ w0 = a[i];
+ w1 = a[n2 + i];
+ }
+ while (w0 == w1 && i != 0);
+ if (w0 < w1)
+ {
+ x = a + n2;
+ y = a;
+ }
+ else
+ {
+ x = a;
+ y = a + n2;
+ }
+ mpn_sub_n (p, x, y, n2);
+
+ /* Pointwise products. */
+ if (BELOW_THRESHOLD (n2, SQR_BASECASE_THRESHOLD))
+ {
+ mpn_mul_basecase (ws, p, n2, p, n2);
+ mpn_mul_basecase (p, a, n2, a, n2);
+ mpn_mul_basecase (p + n, a + n2, n2, a + n2, n2);
+ }
+ else if (BELOW_THRESHOLD (n2, SQR_KARATSUBA_THRESHOLD))
+ {
+ mpn_sqr_basecase (ws, p, n2);
+ mpn_sqr_basecase (p, a, n2);
+ mpn_sqr_basecase (p + n, a + n2, n2);
+ }
+ else
+ {
+ mpn_kara_sqr_n (ws, p, n2, ws + n);
+ mpn_kara_sqr_n (p, a, n2, ws + n);
+ mpn_kara_sqr_n (p + n, a + n2, n2, ws + n);
+ }
+
+ /* Interpolate. */
+ w = -mpn_sub_n (ws, p, ws, n);
+ w += mpn_add_n (ws, p + n, ws, n);
+ w += mpn_add_n (p + n2, p + n2, ws, n);
+ MPN_INCR_U (p + n2 + n, 2 * n - (n2 + n), w);
+ }
+}
+
+/******************************************************************************
+ * *
+ * Toom 3-way multiplication and squaring *
+ * *
+ *****************************************************************************/
+
+/* Starts from:
+ {v0,2k} (stored in {c,2k})
+ {vm1,2k+1} (which sign is sa, and absolute value is stored in {vm1,2k+1})
+ {v1,2k+1} (stored in {c+2k,2k+1})
+ {v2,2k+1}
+ {vinf,twor} (stored in {c+4k,twor}, except the first limb, saved in vinf0)
+
+ ws is temporary space, and should have at least twor limbs.
+
+ put in {c, 2n} where n = 2k+twor the value of {v0,2k} (already in place)
+ + B^k * {tm1, 2k+1}
+ + B^(2k) * {t1, 2k+1}
+ + B^(3k) * {t2, 2k+1}
+ + B^(4k) * {vinf,twor} (high twor-1 limbs already in place)
+ where {t1, 2k+1} = ({v1, 2k+1} + sa * {vm1, 2k+1}- 2*{v0,2k})/2-*{vinf,twor}
+ {t2, 2k+1} = (3*({v1,2k+1}-{v0,2k})-sa*{vm1,2k+1}+{v2,2k+1})/6-2*{vinf,twor}
+ {tm1,2k+1} = ({v1,2k+1}-sa*{vm1,2k+1}/2-{t2,2k+1}
+
+ Exact sequence described in a comment in mpn_toom3_mul_n.
+ mpn_toom3_mul_n() and mpn_toom3_sqr_n() implement steps 1-2.
+ mpn_toom_interpolate_5pts() implements steps 3-4.
+
+ Reference: What About Toom-Cook Matrices Optimality? Marco Bodrato
+ and Alberto Zanoni, October 19, 2006, http://bodrato.it/papers/#CIVV2006
+
+ ************* saved note ****************
+ Think about:
+
+ The evaluated point a-b+c stands a good chance of having a zero carry
+ limb, a+b+c would have a 1/4 chance, and 4*a+2*b+c a 1/8 chance, roughly.
+ Perhaps this could be tested and stripped. Doing so before recursing
+ would be better than stripping at the start of mpn_toom3_mul_n/sqr_n,
+ since then the recursion could be based on the new size. Although in
+ truth the kara vs toom3 crossover is never so exact that one limb either
+ way makes a difference.
+
+ A small value like 1 or 2 for the carry could perhaps also be handled
+ with an add_n or addlsh1_n. Would that be faster than an extra limb on a
+ (recursed) multiply/square?
+*/
+
+#define TOOM3_MUL_REC(p, a, b, n, ws) \
+ do { \
+ if (MUL_TOOM3_THRESHOLD / 3 < MUL_KARATSUBA_THRESHOLD \
+ && BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \
+ mpn_mul_basecase (p, a, n, b, n); \
+ else if (BELOW_THRESHOLD (n, MUL_TOOM3_THRESHOLD)) \
+ mpn_kara_mul_n (p, a, b, n, ws); \
+ else \
+ mpn_toom3_mul_n (p, a, b, n, ws); \
+ } while (0)
+
+#define TOOM3_SQR_REC(p, a, n, ws) \
+ do { \
+ if (SQR_TOOM3_THRESHOLD / 3 < SQR_BASECASE_THRESHOLD \
+ && BELOW_THRESHOLD (n, SQR_BASECASE_THRESHOLD)) \
+ mpn_mul_basecase (p, a, n, a, n); \
+ else if (SQR_TOOM3_THRESHOLD / 3 < SQR_KARATSUBA_THRESHOLD \
+ && BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \
+ mpn_sqr_basecase (p, a, n); \
+ else if (BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) \
+ mpn_kara_sqr_n (p, a, n, ws); \
+ else \
+ mpn_toom3_sqr_n (p, a, n, ws); \
+ } while (0)
+
+/* The necessary temporary space T(n) satisfies T(n)=0 for n < THRESHOLD,
+ and T(n) <= max(2n+2, 6k+3, 4k+3+T(k+1)) otherwise, where k = ceil(n/3).
+
+ Assuming T(n) >= 2n, 6k+3 <= 4k+3+T(k+1).
+ Similarly, 2n+2 <= 6k+2 <= 4k+3+T(k+1).
+
+ With T(n) = 2n+S(n), this simplifies to S(n) <= 9 + S(k+1).
+ Since THRESHOLD >= 17, we have n/(k+1) >= 19/8
+ thus S(n) <= S(n/(19/8)) + 9 thus S(n) <= 9*log(n)/log(19/8) <= 8*log2(n).
+*/
+
+void
+mpn_toom3_mul_n (mp_ptr c, mp_srcptr a, mp_srcptr b, mp_size_t n, mp_ptr t)
+{
+ mp_size_t k, k1, kk1, r, twok, twor;
+ mp_limb_t cy, cc, saved, vinf0;
+ mp_ptr trec;
+ int sa, sb;
+ mp_ptr c1, c2, c3, c4, c5;
+
+ ASSERT(GMP_NUMB_BITS >= 6);
+ ASSERT(n >= 17); /* so that r <> 0 and 5k+3 <= 2n */
+
+ /*
+ The algorithm is the following:
+
+ 0. k = ceil(n/3), r = n - 2k, B = 2^(GMP_NUMB_BITS), t = B^k
+ 1. split a and b in three parts each a0, a1, a2 and b0, b1, b2
+ with a0, a1, b0, b1 of k limbs, and a2, b2 of r limbs
+ 2. Evaluation: vm1 may be negative, the other can not.
+ v0 <- a0*b0
+ v1 <- (a0+a1+a2)*(b0+b1+b2)
+ v2 <- (a0+2*a1+4*a2)*(b0+2*b1+4*b2)
+ vm1 <- (a0-a1+a2)*(b0-b1+b2)
+ vinf <- a2*b2
+ 3. Interpolation: every result is positive, all divisions are exact
+ t2 <- (v2 - vm1)/3
+ tm1 <- (v1 - vm1)/2
+ t1 <- (v1 - v0)
+ t2 <- (t2 - t1)/2
+ t1 <- (t1 - tm1 - vinf)
+ t2 <- (t2 - 2*vinf)
+ tm1 <- (tm1 - t2)
+ 4. result is c0+c1*t+c2*t^2+c3*t^3+c4*t^4 where
+ c0 <- v0
+ c1 <- tm1
+ c2 <- t1
+ c3 <- t2
+ c4 <- vinf
+ */
+
+ k = (n + 2) / 3; /* ceil(n/3) */
+ twok = 2 * k;
+ k1 = k + 1;
+ kk1 = k + k1;
+ r = n - twok; /* last chunk */
+ twor = 2 * r;
+
+ c1 = c + k;
+ c2 = c1 + k;
+ c3 = c2 + k;
+ c4 = c3 + k;
+ c5 = c4 + k;
+
+ trec = t + 4 * k + 3; /* trec = v2 + (2k+2) */
+
+ /* put a0+a2 in {c, k+1}, and b0+b2 in {c+4k+2, k+1};
+ put a0+a1+a2 in {t, k+1} and b0+b1+b2 in {t+k+1,k+1}
+ [????requires 5k+3 <= 2n, ie. n >= 9] */
+ cy = mpn_add_n (c, a, a + twok, r);
+ cc = mpn_add_n (c4 + 2, b, b + twok, r);
+ if (r < k)
+ {
+ __GMPN_ADD_1 (cy, c + r, a + r, k - r, cy);
+ __GMPN_ADD_1 (cc, c4 + 2 + r, b + r, k - r, cc);
+ }
+
+ /* Put in {t, k+1} the sum
+ * (a_0+a_2) - stored in {c, k+1} -
+ * +
+ * a_1 - stored in {a+k, k} */
+ t[k] = (c1[0] = cy) + mpn_add_n (t, c, a + k, k);
+ /* ^ ^
+ * carry of a_0 + a_2 carry of (a_0+a_2) + a_1
+
+ */
+
+ /* Put in {t+k+1, k+1} the sum of the two values
+ * (b_0+b_2) - stored in {c1+1, k+1} -
+ * +
+ * b_1 - stored in {b+k, k} */
+ t[kk1] = (c5[3] = cc) + mpn_add_n (t + k1, c4 + 2, b + k, k);
+ /* ^ ^
+ * carry of b_0 + b_2 carry of (b_0+b_2) + b_1 */
+
+#define v2 (t+2*k+1)
+
+ /* compute v1 := (a0+a1+a2)*(b0+b1+b2) in {t, 2k+1};
+ since v1 < 9*B^(2k), v1 uses only 2k+1 words if GMP_NUMB_BITS >= 4 */
+ TOOM3_MUL_REC (c2, t, t + k1, k1, trec);
+
+ /* c c2 c4 t
+ {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v1 */
+
+ /* put |a0-a1+a2| in {c, k+1} and |b0-b1+b2| in {c+4k+2,k+1} */
+ /* (They're already there, actually) */
+
+ /* sa = sign(a0-a1+a2) */
+ sa = (cy != 0) ? 1 : mpn_cmp (c, a + k, k);
+ c[k] = (sa >= 0) ? cy - mpn_sub_n (c, c, a + k, k)
+ : mpn_sub_n (c, a + k, c, k);
+
+ sb = (cc != 0) ? 1 : mpn_cmp (c4 + 2, b + k, k);
+ c5[2] = (sb >= 0) ? cc - mpn_sub_n (c4 + 2, c4 + 2, b + k, k)
+ : mpn_sub_n (c4 + 2, b + k, c4 + 2, k);
+ sa *= sb; /* sign of vm1 */
+
+ /* compute vm1 := (a0-a1+a2)*(b0-b1+b2) in {t, 2k+1};
+ since |vm1| < 4*B^(2k), vm1 uses only 2k+1 limbs */
+ TOOM3_MUL_REC (t, c, c4 + 2, k1, trec);
+
+ /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v1 vm1
+ */
+
+ /* compute a0+2a1+4a2 in {c, k+1} and b0+2b1+4b2 in {c+4k+2, k+1}
+ [requires 5k+3 <= 2n, i.e. n >= 17] */
+#ifdef HAVE_NATIVE_mpn_addlsh1_n
+ c1[0] = mpn_addlsh1_n (c, a + k, a + twok, r);
+ c5[2] = mpn_addlsh1_n (c4 + 2, b + k, b + twok, r);
+ if (r < k)
+ {
+ __GMPN_ADD_1 (c1[0], c + r, a + k + r, k - r, c1[0]);
+ __GMPN_ADD_1 (c5[2], c4 + 2 + r, b + k + r, k - r, c5[2]);
+ }
+ c1[0] = 2 * c1[0] + mpn_addlsh1_n (c, a, c, k);
+ c5[2] = 2 * c5[2] + mpn_addlsh1_n (c4 + 2, b, c4 + 2, k);
+#else
+ c[r] = mpn_lshift (c, a + twok, r, 1);
+ c4[r + 2] = mpn_lshift (c4 + 2, b + twok, r, 1);
+ if (r < k)
+ {
+ MPN_ZERO(c + r + 1, k - r);
+ MPN_ZERO(c4 + r + 3, k - r);
+ }
+ c1[0] += mpn_add_n (c, c, a + k, k);
+ c5[2] += mpn_add_n (c4 + 2, c4 + 2, b + k, k);
+ mpn_lshift (c, c, k1, 1);
+ mpn_lshift (c4 + 2, c4 + 2, k1, 1);
+ c1[0] += mpn_add_n (c, c, a, k);
+ c5[2] += mpn_add_n (c4 + 2, c4 + 2, b, k);
+#endif
+
+ /* compute v2 := (a0+2a1+4a2)*(b0+2b1+4b2) in {t+2k+1, 2k+1}
+ v2 < 49*B^k so v2 uses at most 2k+1 limbs if GMP_NUMB_BITS >= 6 */
+ TOOM3_MUL_REC (v2, c, c4 + 2, k1, trec);
+
+ /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v1 vm1 v2
+ */
+
+ /* compute v0 := a0*b0 in {c, 2k} */
+ TOOM3_MUL_REC (c, a, b, k, trec);
+
+ /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v0 v1 vm1 v2 */
+
+ /* compute vinf := a2*b2 in {t+4k+2, 2r}: in {c4, 2r} */
+
+ saved = c4[0]; /* Remember v1's highest byte (will be overwritten). */
+ TOOM3_MUL_REC (c4, a + twok, b + twok, r, trec); /* Overwrites c4[0]. */
+ vinf0 = c4[0]; /* Remember vinf's lowest byte (will be overwritten).*/
+ c4[0] = saved; /* Overwriting. Now v1 value is correct. */
+
+ /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v0 v1 vinf[1..] vm1 v2 */
+
+ mpn_toom_interpolate_5pts (c, v2, t, k, 2*r, sa, vinf0, trec);
+
+#undef v2
+}
+
+void
+mpn_toom3_sqr_n (mp_ptr c, mp_srcptr a, mp_size_t n, mp_ptr t)
+{
+ mp_size_t k, k1, kk1, r, twok, twor;
+ mp_limb_t cy, saved, vinf0;
+ mp_ptr trec;
+ int sa;
+ mp_ptr c1, c2, c3, c4;
+
+ ASSERT(GMP_NUMB_BITS >= 6);
+ ASSERT(n >= 17); /* so that r <> 0 and 5k+3 <= 2n */
+
+ /* the algorithm is the same as mpn_toom3_mul_n, with b=a */
+
+ k = (n + 2) / 3; /* ceil(n/3) */
+ twok = 2 * k;
+ k1 = k + 1;
+ kk1 = k + k1;
+ r = n - twok; /* last chunk */
+ twor = 2 * r;
+
+ c1 = c + k;
+ c2 = c1 + k;
+ c3 = c2 + k;
+ c4 = c3 + k;
+
+ trec = t + 4 * k + 3; /* trec = v2 + (2k+2) */
+
+ cy = mpn_add_n (c, a, a + twok, r);
+ if (r < k)
+ __GMPN_ADD_1 (cy, c + r, a + r, k - r, cy);
+ t[k] = (c1[0] = cy) + mpn_add_n (t, c, a + k, k);
+
+#define v2 (t+2*k+1)
+
+ TOOM3_SQR_REC (c2, t, k1, trec);
+
+ sa = (cy != 0) ? 1 : mpn_cmp (c, a + k, k);
+ c[k] = (sa >= 0) ? cy - mpn_sub_n (c, c, a + k, k)
+ : mpn_sub_n (c, a + k, c, k);
+
+ TOOM3_SQR_REC (t, c, k1, trec);
+
+#ifdef HAVE_NATIVE_mpn_addlsh1_n
+ c1[0] = mpn_addlsh1_n (c, a + k, a + twok, r);
+ if (r < k)
+ __GMPN_ADD_1 (c1[0], c + r, a + k + r, k - r, c1[0]);
+ c1[0] = 2 * c1[0] + mpn_addlsh1_n (c, a, c, k);
+#else
+ c[r] = mpn_lshift (c, a + twok, r, 1);
+ if (r < k)
+ MPN_ZERO(c + r + 1, k - r);
+ c1[0] += mpn_add_n (c, c, a + k, k);
+ mpn_lshift (c, c, k1, 1);
+ c1[0] += mpn_add_n (c, c, a, k);
+#endif
+
+ TOOM3_SQR_REC (v2, c, k1, trec);
+
+ TOOM3_SQR_REC (c, a, k, trec);
+
+ saved = c4[0];
+ TOOM3_SQR_REC (c4, a + twok, r, trec);
+ vinf0 = c4[0];
+ c4[0] = saved;
+
+ mpn_toom_interpolate_5pts (c, v2, t, k, 2*r, 1, vinf0, trec);
+
+#undef v2
+}
+
void
mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n)
{
@@ -40,28 +697,31 @@ mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n)
ASSERT (! MPN_OVERLAP_P (p, 2 * n, a, n));
ASSERT (! MPN_OVERLAP_P (p, 2 * n, b, n));
- if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD))
+ if (BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD))
{
mpn_mul_basecase (p, a, n, b, n);
}
- else if (BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD))
+ else if (BELOW_THRESHOLD (n, MUL_TOOM3_THRESHOLD))
{
/* Allocate workspace of fixed size on stack: fast! */
- mp_limb_t ws[mpn_toom22_mul_itch (MUL_TOOM33_THRESHOLD_LIMIT-1,
- MUL_TOOM33_THRESHOLD_LIMIT-1)];
- ASSERT (MUL_TOOM33_THRESHOLD <= MUL_TOOM33_THRESHOLD_LIMIT);
- mpn_toom22_mul (p, a, n, b, n, ws);
+ mp_limb_t ws[MPN_KARA_MUL_N_TSIZE (MUL_TOOM3_THRESHOLD_LIMIT-1)];
+ ASSERT (MUL_TOOM3_THRESHOLD <= MUL_TOOM3_THRESHOLD_LIMIT);
+ mpn_kara_mul_n (p, a, b, n, ws);
}
else if (BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD))
{
mp_ptr ws;
TMP_SDECL;
TMP_SMARK;
- ws = TMP_SALLOC_LIMBS (mpn_toom33_mul_itch (n, n));
- mpn_toom33_mul (p, a, n, b, n, ws);
+ ws = TMP_SALLOC_LIMBS (MPN_TOOM3_MUL_N_TSIZE (n));
+ mpn_toom3_mul_n (p, a, b, n, ws);
TMP_SFREE;
}
- else if (BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD))
+#if WANT_FFT || TUNE_PROGRAM_BUILD
+ else if (BELOW_THRESHOLD (n, MUL_FFT_THRESHOLD))
+#else
+ else if (BELOW_THRESHOLD (n, MPN_TOOM44_MAX_N))
+#endif
{
mp_ptr ws;
TMP_SDECL;
@@ -70,28 +730,91 @@ mpn_mul_n (mp_ptr p, mp_srcptr a, mp_srcptr b, mp_size_t n)
mpn_toom44_mul (p, a, n, b, n, ws);
TMP_SFREE;
}
- else if (BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD))
+ else
+#if WANT_FFT || TUNE_PROGRAM_BUILD
+ {
+ /* The current FFT code allocates its own space. That should probably
+ change. */
+ mpn_mul_fft_full (p, a, n, b, n);
+ }
+#else
+ {
+ /* Toom4 for large operands. */
+ mp_ptr ws;
+ TMP_DECL;
+ TMP_MARK;
+ ws = TMP_BALLOC_LIMBS (mpn_toom44_mul_itch (n, n));
+ mpn_toom44_mul (p, a, n, b, n, ws);
+ TMP_FREE;
+ }
+#endif
+}
+
+void
+mpn_sqr (mp_ptr p, mp_srcptr a, mp_size_t n)
+{
+ ASSERT (n >= 1);
+ ASSERT (! MPN_OVERLAP_P (p, 2 * n, a, n));
+
+#if 0
+ /* FIXME: Can this be removed? */
+ if (n == 0)
+ return;
+#endif
+
+ if (BELOW_THRESHOLD (n, SQR_BASECASE_THRESHOLD))
+ { /* mul_basecase is faster than sqr_basecase on small sizes sometimes */
+ mpn_mul_basecase (p, a, n, a, n);
+ }
+ else if (BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD))
+ {
+ mpn_sqr_basecase (p, a, n);
+ }
+ else if (BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD))
+ {
+ /* Allocate workspace of fixed size on stack: fast! */
+ mp_limb_t ws[MPN_KARA_SQR_N_TSIZE (SQR_TOOM3_THRESHOLD_LIMIT-1)];
+ ASSERT (SQR_TOOM3_THRESHOLD <= SQR_TOOM3_THRESHOLD_LIMIT);
+ mpn_kara_sqr_n (p, a, n, ws);
+ }
+ else if (BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD))
{
mp_ptr ws;
TMP_SDECL;
TMP_SMARK;
- ws = TMP_SALLOC_LIMBS (mpn_toom6_mul_n_itch (n));
- mpn_toom6h_mul (p, a, n, b, n, ws);
+ ws = TMP_SALLOC_LIMBS (MPN_TOOM3_SQR_N_TSIZE (n));
+ mpn_toom3_sqr_n (p, a, n, ws);
TMP_SFREE;
}
- else if (BELOW_THRESHOLD (n, MUL_FFT_THRESHOLD))
+#if WANT_FFT || TUNE_PROGRAM_BUILD
+ else if (BELOW_THRESHOLD (n, SQR_FFT_THRESHOLD))
+#else
+ else if (BELOW_THRESHOLD (n, MPN_TOOM44_MAX_N))
+#endif
{
mp_ptr ws;
- TMP_DECL;
- TMP_MARK;
- ws = TMP_ALLOC_LIMBS (mpn_toom8_mul_n_itch (n));
- mpn_toom8h_mul (p, a, n, b, n, ws);
- TMP_FREE;
+ TMP_SDECL;
+ TMP_SMARK;
+ ws = TMP_SALLOC_LIMBS (mpn_toom4_sqr_itch (n));
+ mpn_toom4_sqr (p, a, n, ws);
+ TMP_SFREE;
}
else
+#if WANT_FFT || TUNE_PROGRAM_BUILD
{
/* The current FFT code allocates its own space. That should probably
change. */
- mpn_fft_mul (p, a, n, b, n);
+ mpn_mul_fft_full (p, a, n, a, n);
+ }
+#else
+ {
+ /* Toom4 for large operands. */
+ mp_ptr ws;
+ TMP_DECL;
+ TMP_MARK;
+ ws = TMP_BALLOC_LIMBS (mpn_toom4_sqr_itch (n));
+ mpn_toom4_sqr (p, a, n, ws);
+ TMP_FREE;
}
+#endif
}
diff --git a/gmp/mpn/generic/mullo_basecase.c b/gmp/mpn/generic/mullo_basecase.c
deleted file mode 100644
index 2120f44c3d..0000000000
--- a/gmp/mpn/generic/mullo_basecase.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* mpn_mullo_basecase -- Internal routine to multiply two natural
- numbers of length m and n and return the low part.
-
- THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
- SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- FIXME: Should use mpn_addmul_2 (and higher).
-*/
-
-void
-mpn_mullo_basecase (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
-{
- mp_size_t i;
-
- mpn_mul_1 (rp, up, n, vp[0]);
-
- for (i = 1; i < n; i++)
- mpn_addmul_1 (rp + i, up, n - i, vp[i]);
-}
diff --git a/gmp/mpn/generic/mullo_n.c b/gmp/mpn/generic/mullo_n.c
deleted file mode 100644
index dad75ee8f7..0000000000
--- a/gmp/mpn/generic/mullo_n.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* mpn_mullo_n -- multiply two n-limb numbers and return the low n limbs
- of their products.
-
- Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-
- THIS IS (FOR NOW) AN INTERNAL FUNCTION. IT IS ONLY SAFE TO REACH THIS
- FUNCTION THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED
- THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-#ifndef MULLO_BASECASE_THRESHOLD
-#define MULLO_BASECASE_THRESHOLD 0 /* never use mpn_mul_basecase */
-#endif
-
-#ifndef MULLO_DC_THRESHOLD
-#define MULLO_DC_THRESHOLD 3*MUL_TOOM22_THRESHOLD
-#endif
-
-#ifndef MULLO_MUL_N_THRESHOLD
-#define MULLO_MUL_N_THRESHOLD MUL_FFT_THRESHOLD
-#endif
-
-#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
-#define MAYBE_range_basecase 1
-#define MAYBE_range_toom22 1
-#else
-#define MAYBE_range_basecase \
- ((MULLO_DC_THRESHOLD == 0 ? MULLO_BASECASE_THRESHOLD : MULLO_DC_THRESHOLD) < MUL_TOOM22_THRESHOLD*36/(36-11))
-#define MAYBE_range_toom22 \
- ((MULLO_DC_THRESHOLD == 0 ? MULLO_BASECASE_THRESHOLD : MULLO_DC_THRESHOLD) < MUL_TOOM33_THRESHOLD*36/(36-11) )
-#endif
-
-/* THINK: The DC strategy uses different constants in different Toom's
- ranges. Something smoother?
-*/
-
-/*
- Compute the least significant half of the product {xy,n}*{yp,n}, or
- formally {rp,n} = {xy,n}*{yp,n} Mod (B^n).
-
- Above the given threshold, the Divide and Conquer strategy is used.
- The operands are split in two, and a full product plus two mullo
- are used to obtain the final result. The more natural strategy is to
- split in two halves, but this is far from optimal when a
- sub-quadratic multiplication is used.
-
- Mulders suggests an unbalanced split in favour of the full product,
- split n = n1 + n2, where an = n1 <= n2 = (1-a)n; i.e. 0 < a <= 1/2.
-
- To compute the value of a, we assume that the cost of mullo for a
- given size ML(n) is a fraction of the cost of a full product with
- same size M(n), and the cost M(n)=n^e for some exponent 1 < e <= 2;
- then we can write:
-
- ML(n) = 2*ML(an) + M((1-a)n) => k*M(n) = 2*k*M(n)*a^e + M(n)*(1-a)^e
-
- Given a value for e, want to minimise the value of k, i.e. the
- function k=(1-a)^e/(1-2*a^e).
-
- With e=2, the exponent for schoolbook multiplication, the minimum is
- given by the values a=1-a=1/2.
-
- With e=log(3)/log(2), the exponent for Karatsuba (aka toom22),
- Mulders compute (1-a) = 0.694... and we approximate a with 11/36.
-
- Other possible approximations follow:
- e=log(5)/log(3) [Toom-3] -> a ~= 9/40
- e=log(7)/log(4) [Toom-4] -> a ~= 7/39
- e=log(11)/log(6) [Toom-6] -> a ~= 1/8
- e=log(15)/log(8) [Toom-8] -> a ~= 1/10
-
- The values above where obtained with the following trivial commands
- in the gp-pari shell:
-
-fun(e,a)=(1-a)^e/(1-2*a^e)
-mul(a,b,c)={local(m,x,p);if(b-c<1/10000,(b+c)/2,m=1;x=b;forstep(p=c,b,(b-c)/8,if(fun(a,p)<m,m=fun(a,p);x=p));mul(a,(b+x)/2,(c+x)/2))}
-contfracpnqn(contfrac(mul(log(2*2-1)/log(2),1/2,0),5))
-contfracpnqn(contfrac(mul(log(3*2-1)/log(3),1/2,0),5))
-contfracpnqn(contfrac(mul(log(4*2-1)/log(4),1/2,0),5))
-contfracpnqn(contfrac(mul(log(6*2-1)/log(6),1/2,0),3))
-contfracpnqn(contfrac(mul(log(8*2-1)/log(8),1/2,0),3))
-
- ,
- |\
- | \
- +----,
- | |
- | |
- | |\
- | | \
- +----+--`
- ^ n2 ^n1^
-
- For an actual implementation, the assumption that M(n)=n^e is
- incorrect, as a consequence also the assumption that ML(n)=k*M(n)
- with a constant k is wrong.
-
- But theory suggest us two things:
- - the best the multiplication product is (lower e), the more k
- approaches 1, and a approaches 0.
-
- - A value for a smaller than optimal is probably less bad than a
- bigger one: e.g. let e=log(3)/log(2), a=0.3058_ the optimal
- value, and k(a)=0.808_ the mul/mullo speed ratio. We get
- k(a+1/6)=0.929_ but k(a-1/6)=0.865_.
-*/
-
-static mp_size_t
-mpn_mullo_n_itch (mp_size_t n)
-{
- return 2*n;
-}
-
-/*
- mpn_dc_mullo_n requires a scratch space of 2*n limbs at tp.
- It accepts tp == rp.
-*/
-static void
-mpn_dc_mullo_n (mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n, mp_ptr tp)
-{
- mp_size_t n2, n1;
- ASSERT (n >= 2);
- ASSERT (! MPN_OVERLAP_P (rp, n, xp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp, n));
- ASSERT (MPN_SAME_OR_SEPARATE2_P(rp, n, tp, 2*n));
-
- /* Divide-and-conquer */
-
- /* We need fractional approximation of the value 0 < a <= 1/2
- giving the minimum in the function k=(1-a)^e/(1-2*a^e).
- */
- if (MAYBE_range_basecase && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD*36/(36-11)))
- n1 = n >> 1;
- else if (MAYBE_range_toom22 && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD*36/(36-11)))
- n1 = n * 11 / (size_t) 36; /* n1 ~= n*(1-.694...) */
- else if (BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD*40/(40-9)))
- n1 = n * 9 / (size_t) 40; /* n1 ~= n*(1-.775...) */
- else if (BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD*10/9))
- n1 = n * 7 / (size_t) 39; /* n1 ~= n*(1-.821...) */
- /* n1 = n * 4 / (size_t) 31; // n1 ~= n*(1-.871...) [TOOM66] */
- else
- n1 = n / (size_t) 10; /* n1 ~= n*(1-.899...) [TOOM88] */
-
- n2 = n - n1;
-
- /* Split as x = x1 2^(n2 GMP_NUMB_BITS) + x0,
- y = y1 2^(n2 GMP_NUMB_BITS) + y0 */
-
- /* x0 * y0 */
- mpn_mul_n (tp, xp, yp, n2);
- MPN_COPY (rp, tp, n2);
-
- /* x1 * y0 * 2^(n2 GMP_NUMB_BITS) */
- if (BELOW_THRESHOLD (n1, MULLO_BASECASE_THRESHOLD))
- mpn_mul_basecase (tp + n, xp + n2, n1, yp, n1);
- else if (BELOW_THRESHOLD (n1, MULLO_DC_THRESHOLD))
- mpn_mullo_basecase (tp + n, xp + n2, yp, n1);
- else
- mpn_dc_mullo_n (tp + n, xp + n2, yp, n1, tp + n);
- mpn_add_n (rp + n2, tp + n2, tp + n, n1);
-
- /* x0 * y1 * 2^(n2 GMP_NUMB_BITS) */
- if (BELOW_THRESHOLD (n1, MULLO_BASECASE_THRESHOLD))
- mpn_mul_basecase (tp + n, xp, n1, yp + n2, n1);
- else if (BELOW_THRESHOLD (n1, MULLO_DC_THRESHOLD))
- mpn_mullo_basecase (tp + n, xp, yp + n2, n1);
- else
- mpn_dc_mullo_n (tp + n, xp, yp + n2, n1, tp + n);
- mpn_add_n (rp + n2, rp + n2, tp + n, n1);
-}
-
-/* Avoid zero allocations when MULLO_BASECASE_THRESHOLD is 0. */
-#define MUL_BASECASE_ALLOC \
- (MULLO_BASECASE_THRESHOLD_LIMIT == 0 ? 1 : 2*MULLO_BASECASE_THRESHOLD_LIMIT)
-
-/* FIXME: This function should accept a temporary area; dc_mullow_n
- accepts a pointer tp, and handle the case tp == rp, do the same here.
- Maybe recombine the two functions.
- THINK: If mpn_mul_basecase is always faster than mpn_mullo_basecase
- (typically thanks to mpn_addmul_2) should we unconditionally use
- mpn_mul_n?
-*/
-
-void
-mpn_mullo_n (mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n)
-{
- ASSERT (n >= 1);
- ASSERT (! MPN_OVERLAP_P (rp, n, xp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp, n));
-
- if (BELOW_THRESHOLD (n, MULLO_BASECASE_THRESHOLD))
- {
- /* Allocate workspace of fixed size on stack: fast! */
- mp_limb_t tp[MUL_BASECASE_ALLOC];
- mpn_mul_basecase (tp, xp, n, yp, n);
- MPN_COPY (rp, tp, n);
- }
- else if (BELOW_THRESHOLD (n, MULLO_DC_THRESHOLD))
- {
- mpn_mullo_basecase (rp, xp, yp, n);
- }
- else
- {
- mp_ptr tp;
- TMP_DECL;
- TMP_MARK;
- tp = TMP_ALLOC_LIMBS (mpn_mullo_n_itch (n));
- if (BELOW_THRESHOLD (n, MULLO_MUL_N_THRESHOLD))
- {
- mpn_dc_mullo_n (rp, xp, yp, n, tp);
- }
- else
- {
- /* For really large operands, use plain mpn_mul_n but throw away upper n
- limbs of result. */
-#if !TUNE_PROGRAM_BUILD && (MULLO_MUL_N_THRESHOLD > MUL_FFT_THRESHOLD)
- mpn_fft_mul (tp, xp, n, yp, n);
-#else
- mpn_mul_n (tp, xp, yp, n);
-#endif
- MPN_COPY (rp, tp, n);
- }
- TMP_FREE;
- }
-}
diff --git a/gmp/mpn/generic/mullow_basecase.c b/gmp/mpn/generic/mullow_basecase.c
new file mode 100644
index 0000000000..72c48f65b4
--- /dev/null
+++ b/gmp/mpn/generic/mullow_basecase.c
@@ -0,0 +1,41 @@
+/* mpn_mullow_basecase -- Internal routine to multiply two natural
+ numbers of length m and n and return the low part.
+
+ THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
+ SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
+
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+/*
+ FIXME: Should use mpn_addmul_2 (and higher).
+*/
+
+void
+mpn_mullow_basecase (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
+{
+ mp_size_t i;
+
+ mpn_mul_1 (rp, up, n, vp[0]);
+
+ for (i = 1; i < n; i++)
+ mpn_addmul_1 (rp + i, up, n - i, vp[i]);
+}
diff --git a/gmp/mpn/generic/mullow_n.c b/gmp/mpn/generic/mullow_n.c
new file mode 100644
index 0000000000..e92a554616
--- /dev/null
+++ b/gmp/mpn/generic/mullow_n.c
@@ -0,0 +1,111 @@
+/* mpn_mullow_n -- multiply two n-limb nunbers and return the low n limbs
+ of their products.
+
+ THIS IS (FOR NOW) AN INTERNAL FUNCTION. IT IS ONLY SAFE TO REACH THIS
+ FUNCTION THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST GUARANTEED
+ THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
+
+Copyright 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 distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+
+#ifndef MULLOW_BASECASE_THRESHOLD
+#define MULLOW_BASECASE_THRESHOLD 0 /* never use mpn_mul_basecase */
+#endif
+
+#ifndef MULLOW_DC_THRESHOLD
+#define MULLOW_DC_THRESHOLD 3*MUL_KARATSUBA_THRESHOLD
+#endif
+
+#ifndef MULLOW_MUL_N_THRESHOLD
+#define MULLOW_MUL_N_THRESHOLD 10*MULLOW_DC_THRESHOLD
+#endif
+
+/* Avoid zero allocations when MULLOW_BASECASE_THRESHOLD is 0. */
+#define MUL_BASECASE_ALLOC \
+ (MULLOW_BASECASE_THRESHOLD_LIMIT == 0 ? 1 : 2*MULLOW_BASECASE_THRESHOLD_LIMIT)
+
+/*
+ FIXME: This function should accept a temporary area.
+ FIXME: Perhaps call mpn_kara_mul_n instead of mpn_mul_n?
+ THINK: If mpn_mul_basecase is always faster than mpn_mullow_basecase
+ (typically thanks to mpn_addmul_2) should we unconditionally use
+ mpn_mul_n?
+ FIXME: The recursive calls to mpn_mullow_n use sizes n/2 (one uses floor(n/2)
+ and the other ceil(n/2)). Depending on the values of the various
+ _THRESHOLDs, this may never trigger MULLOW_BASECASE_THRESHOLD.
+ Should we worry about this overhead?
+*/
+
+void
+mpn_mullow_n (mp_ptr rp, mp_srcptr xp, mp_srcptr yp, mp_size_t n)
+{
+ if (BELOW_THRESHOLD (n, MULLOW_BASECASE_THRESHOLD))
+ {
+ /* Allocate workspace of fixed size on stack: fast! */
+ mp_limb_t ws[MUL_BASECASE_ALLOC];
+ mpn_mul_basecase (ws, xp, n, yp, n);
+ MPN_COPY (rp, ws, n);
+ }
+ else if (BELOW_THRESHOLD (n, MULLOW_DC_THRESHOLD))
+ {
+ mpn_mullow_basecase (rp, xp, yp, n);
+ }
+ else if (BELOW_THRESHOLD (n, MULLOW_MUL_N_THRESHOLD))
+ {
+ /* Divide-and-conquer */
+ mp_size_t n2 = n >> 1; /* floor(n/2) */
+ mp_size_t n1 = n - n2; /* ceil(n/2) */
+ mp_ptr tp;
+ TMP_SDECL;
+ TMP_SMARK;
+ tp = TMP_SALLOC_LIMBS (n1);
+
+ /* Split as x = x1 2^(n1 GMP_NUMB_BITS) + x0,
+ y = y1 2^(n2 GMP_NUMB_BITS) + y0 */
+
+ /* x0 * y0 */
+ mpn_mul_n (rp, xp, yp, n2);
+ if (n1 != n2)
+ rp[2 * n2] = mpn_addmul_1 (rp + n2, yp, n2, xp[n2]);
+
+ /* x1 * y0 * 2^(n1 GMP_NUMB_BITS) */
+ mpn_mullow_n (tp, xp + n1, yp, n2);
+ mpn_add_n (rp + n1, rp + n1, tp, n2);
+
+ /* x0 * y1 * 2^(n2 GMP_NUMB_BITS) */
+ mpn_mullow_n (tp, yp + n2, xp, n1);
+ mpn_add_n (rp + n2, rp + n2, tp, n1);
+ TMP_SFREE;
+ }
+ else
+ {
+ /* For really large operands, use plain mpn_mul_n but throw away upper n
+ limbs of result. */
+ mp_ptr tp;
+ TMP_DECL;
+ TMP_MARK;
+ tp = TMP_ALLOC_LIMBS (2 * n);
+
+ mpn_mul_n (tp, xp, yp, n);
+ MPN_COPY (rp, tp, n);
+ TMP_FREE;
+ }
+}
diff --git a/gmp/mpn/generic/mulmid.c b/gmp/mpn/generic/mulmid.c
deleted file mode 100644
index 6b4ea3253d..0000000000
--- a/gmp/mpn/generic/mulmid.c
+++ /dev/null
@@ -1,256 +0,0 @@
-/* mpn_mulmid -- middle product
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-#define CHUNK (200 + MULMID_TOOM42_THRESHOLD)
-
-
-void
-mpn_mulmid (mp_ptr rp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn)
-{
- mp_size_t rn, k;
- mp_ptr scratch, temp;
-
- ASSERT (an >= bn);
- ASSERT (bn >= 1);
- ASSERT (! MPN_OVERLAP_P (rp, an - bn + 3, ap, an));
- ASSERT (! MPN_OVERLAP_P (rp, an - bn + 3, bp, bn));
-
- if (bn < MULMID_TOOM42_THRESHOLD)
- {
- /* region not tall enough to make toom42 worthwhile for any portion */
-
- if (an < CHUNK)
- {
- /* region not too wide either, just call basecase directly */
- mpn_mulmid_basecase (rp, ap, an, bp, bn);
- return;
- }
-
- /* Region quite wide. For better locality, use basecase on chunks:
-
- AAABBBCC..
- .AAABBBCC.
- ..AAABBBCC
- */
-
- k = CHUNK - bn + 1; /* number of diagonals per chunk */
-
- /* first chunk (marked A in the above diagram) */
- mpn_mulmid_basecase (rp, ap, CHUNK, bp, bn);
-
- /* remaining chunks (B, C, etc) */
- an -= k;
-
- while (an >= CHUNK)
- {
- mp_limb_t t0, t1, cy;
- ap += k, rp += k;
- t0 = rp[0], t1 = rp[1];
- mpn_mulmid_basecase (rp, ap, CHUNK, bp, bn);
- ADDC_LIMB (cy, rp[0], rp[0], t0); /* add back saved limbs */
- MPN_INCR_U (rp + 1, k + 1, t1 + cy);
- an -= k;
- }
-
- if (an >= bn)
- {
- /* last remaining chunk */
- mp_limb_t t0, t1, cy;
- ap += k, rp += k;
- t0 = rp[0], t1 = rp[1];
- mpn_mulmid_basecase (rp, ap, an, bp, bn);
- ADDC_LIMB (cy, rp[0], rp[0], t0);
- MPN_INCR_U (rp + 1, an - bn + 2, t1 + cy);
- }
-
- return;
- }
-
- /* region is tall enough for toom42 */
-
- rn = an - bn + 1;
-
- if (rn < MULMID_TOOM42_THRESHOLD)
- {
- /* region not wide enough to make toom42 worthwhile for any portion */
-
- TMP_DECL;
-
- if (bn < CHUNK)
- {
- /* region not too tall either, just call basecase directly */
- mpn_mulmid_basecase (rp, ap, an, bp, bn);
- return;
- }
-
- /* Region quite tall. For better locality, use basecase on chunks:
-
- AAAAA....
- .AAAAA...
- ..BBBBB..
- ...BBBBB.
- ....CCCCC
- */
-
- TMP_MARK;
-
- temp = TMP_ALLOC_LIMBS (rn + 2);
-
- /* first chunk (marked A in the above diagram) */
- bp += bn - CHUNK, an -= bn - CHUNK;
- mpn_mulmid_basecase (rp, ap, an, bp, CHUNK);
-
- /* remaining chunks (B, C, etc) */
- bn -= CHUNK;
-
- while (bn >= CHUNK)
- {
- ap += CHUNK, bp -= CHUNK;
- mpn_mulmid_basecase (temp, ap, an, bp, CHUNK);
- mpn_add_n (rp, rp, temp, rn + 2);
- bn -= CHUNK;
- }
-
- if (bn)
- {
- /* last remaining chunk */
- ap += CHUNK, bp -= bn;
- mpn_mulmid_basecase (temp, ap, rn + bn - 1, bp, bn);
- mpn_add_n (rp, rp, temp, rn + 2);
- }
-
- TMP_FREE;
- return;
- }
-
- /* we're definitely going to use toom42 somewhere */
-
- if (bn > rn)
- {
- /* slice region into chunks, use toom42 on all chunks except possibly
- the last:
-
- AA....
- .AA...
- ..BB..
- ...BB.
- ....CC
- */
-
- TMP_DECL;
- TMP_MARK;
-
- temp = TMP_ALLOC_LIMBS (rn + 2 + mpn_toom42_mulmid_itch (rn));
- scratch = temp + rn + 2;
-
- /* first chunk (marked A in the above diagram) */
- bp += bn - rn;
- mpn_toom42_mulmid (rp, ap, bp, rn, scratch);
-
- /* remaining chunks (B, C, etc) */
- bn -= rn;
-
- while (bn >= rn)
- {
- ap += rn, bp -= rn;
- mpn_toom42_mulmid (temp, ap, bp, rn, scratch);
- mpn_add_n (rp, rp, temp, rn + 2);
- bn -= rn;
- }
-
- if (bn)
- {
- /* last remaining chunk */
- ap += rn, bp -= bn;
- mpn_mulmid (temp, ap, rn + bn - 1, bp, bn);
- mpn_add_n (rp, rp, temp, rn + 2);
- }
-
- TMP_FREE;
- }
- else
- {
- /* slice region into chunks, use toom42 on all chunks except possibly
- the last:
-
- AAABBBCC..
- .AAABBBCC.
- ..AAABBBCC
- */
-
- TMP_DECL;
- TMP_MARK;
-
- scratch = TMP_ALLOC_LIMBS (mpn_toom42_mulmid_itch (bn));
-
- /* first chunk (marked A in the above diagram) */
- mpn_toom42_mulmid (rp, ap, bp, bn, scratch);
-
- /* remaining chunks (B, C, etc) */
- rn -= bn;
-
- while (rn >= bn)
- {
- mp_limb_t t0, t1, cy;
- ap += bn, rp += bn;
- t0 = rp[0], t1 = rp[1];
- mpn_toom42_mulmid (rp, ap, bp, bn, scratch);
- ADDC_LIMB (cy, rp[0], rp[0], t0); /* add back saved limbs */
- MPN_INCR_U (rp + 1, bn + 1, t1 + cy);
- rn -= bn;
- }
-
- TMP_FREE;
-
- if (rn)
- {
- /* last remaining chunk */
- mp_limb_t t0, t1, cy;
- ap += bn, rp += bn;
- t0 = rp[0], t1 = rp[1];
- mpn_mulmid (rp, ap, rn + bn - 1, bp, bn);
- ADDC_LIMB (cy, rp[0], rp[0], t0);
- MPN_INCR_U (rp + 1, rn + 1, t1 + cy);
- }
- }
-}
diff --git a/gmp/mpn/generic/mulmid_basecase.c b/gmp/mpn/generic/mulmid_basecase.c
deleted file mode 100644
index 400e976424..0000000000
--- a/gmp/mpn/generic/mulmid_basecase.c
+++ /dev/null
@@ -1,83 +0,0 @@
-/* mpn_mulmid_basecase -- classical middle product algorithm
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Middle product of {up,un} and {vp,vn}, write result to {rp,un-vn+3}.
- Must have un >= vn >= 1.
-
- Neither input buffer may overlap with the output buffer. */
-
-void
-mpn_mulmid_basecase (mp_ptr rp,
- mp_srcptr up, mp_size_t un,
- mp_srcptr vp, mp_size_t vn)
-{
- mp_limb_t lo, hi; /* last two limbs of output */
- mp_limb_t cy;
-
- ASSERT (un >= vn);
- ASSERT (vn >= 1);
- ASSERT (! MPN_OVERLAP_P (rp, un - vn + 3, up, un));
- ASSERT (! MPN_OVERLAP_P (rp, un - vn + 3, vp, vn));
-
- up += vn - 1;
- un -= vn - 1;
-
- /* multiply by first limb, store result */
- lo = mpn_mul_1 (rp, up, un, vp[0]);
- hi = 0;
-
- /* accumulate remaining rows */
- for (vn--; vn; vn--)
- {
- up--, vp++;
- cy = mpn_addmul_1 (rp, up, un, vp[0]);
- add_ssaaaa (hi, lo, hi, lo, CNST_LIMB(0), cy);
- }
-
- /* store final limbs */
-#if GMP_NAIL_BITS != 0
- hi = (hi << GMP_NAIL_BITS) + (lo >> GMP_NUMB_BITS);
- lo &= GMP_NUMB_MASK;
-#endif
-
- rp[un] = lo;
- rp[un + 1] = hi;
-}
diff --git a/gmp/mpn/generic/mulmid_n.c b/gmp/mpn/generic/mulmid_n.c
deleted file mode 100644
index 2280ba3a36..0000000000
--- a/gmp/mpn/generic/mulmid_n.c
+++ /dev/null
@@ -1,62 +0,0 @@
-/* mpn_mulmid_n -- balanced middle product
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_mulmid_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
-{
- ASSERT (n >= 1);
- ASSERT (! MPN_OVERLAP_P (rp, n + 2, ap, 2*n - 1));
- ASSERT (! MPN_OVERLAP_P (rp, n + 2, bp, n));
-
- if (n < MULMID_TOOM42_THRESHOLD)
- {
- mpn_mulmid_basecase (rp, ap, 2*n - 1, bp, n);
- }
- else
- {
- mp_ptr scratch;
- TMP_DECL;
- TMP_MARK;
- scratch = TMP_ALLOC_LIMBS (mpn_toom42_mulmid_itch (n));
- mpn_toom42_mulmid (rp, ap, bp, n, scratch);
- TMP_FREE;
- }
-}
diff --git a/gmp/mpn/generic/mulmod_bnm1.c b/gmp/mpn/generic/mulmod_bnm1.c
deleted file mode 100644
index 8710324583..0000000000
--- a/gmp/mpn/generic/mulmod_bnm1.c
+++ /dev/null
@@ -1,355 +0,0 @@
-/* mulmod_bnm1.c -- multiplication mod B^n-1.
-
- 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, 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"
-
-/* Inputs are {ap,rn} and {bp,rn}; output is {rp,rn}, computation is
- mod B^rn - 1, and values are semi-normalised; zero is represented
- as either 0 or B^n - 1. Needs a scratch of 2rn limbs at tp.
- tp==rp is allowed. */
-void
-mpn_bc_mulmod_bnm1 (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t rn,
- mp_ptr tp)
-{
- mp_limb_t cy;
-
- ASSERT (0 < rn);
-
- mpn_mul_n (tp, ap, bp, rn);
- cy = mpn_add_n (rp, tp, tp + rn, rn);
- /* If cy == 1, then the value of rp is at most B^rn - 2, so there can
- * be no overflow when adding in the carry. */
- MPN_INCR_U (rp, rn, cy);
-}
-
-
-/* Inputs are {ap,rn+1} and {bp,rn+1}; output is {rp,rn+1}, in
- semi-normalised representation, computation is mod B^rn + 1. Needs
- a scratch area of 2rn + 2 limbs at tp; tp == rp is allowed.
- Output is normalised. */
-static void
-mpn_bc_mulmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t rn,
- mp_ptr tp)
-{
- mp_limb_t cy;
-
- ASSERT (0 < rn);
-
- mpn_mul_n (tp, ap, bp, rn + 1);
- ASSERT (tp[2*rn+1] == 0);
- ASSERT (tp[2*rn] < GMP_NUMB_MAX);
- cy = tp[2*rn] + mpn_sub_n (rp, tp, tp+rn, rn);
- rp[rn] = 0;
- MPN_INCR_U (rp, rn+1, cy );
-}
-
-
-/* Computes {rp,MIN(rn,an+bn)} <- {ap,an}*{bp,bn} Mod(B^rn-1)
- *
- * The result is expected to be ZERO if and only if one of the operand
- * already is. Otherwise the class [0] Mod(B^rn-1) is represented by
- * B^rn-1. This should not be a problem if mulmod_bnm1 is used to
- * combine results and obtain a natural number when one knows in
- * advance that the final value is less than (B^rn-1).
- * Moreover it should not be a problem if mulmod_bnm1 is used to
- * compute the full product with an+bn <= rn, because this condition
- * implies (B^an-1)(B^bn-1) < (B^rn-1) .
- *
- * Requires 0 < bn <= an <= rn and an + bn > rn/2
- * Scratch need: rn + (need for recursive call OR rn + 4). This gives
- *
- * S(n) <= rn + MAX (rn + 4, S(n/2)) <= 2rn + 4
- */
-void
-mpn_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn, mp_ptr tp)
-{
- ASSERT (0 < bn);
- ASSERT (bn <= an);
- ASSERT (an <= rn);
-
- if ((rn & 1) != 0 || BELOW_THRESHOLD (rn, MULMOD_BNM1_THRESHOLD))
- {
- if (UNLIKELY (bn < rn))
- {
- if (UNLIKELY (an + bn <= rn))
- {
- mpn_mul (rp, ap, an, bp, bn);
- }
- else
- {
- mp_limb_t cy;
- mpn_mul (tp, ap, an, bp, bn);
- cy = mpn_add (rp, tp, rn, tp + rn, an + bn - rn);
- MPN_INCR_U (rp, rn, cy);
- }
- }
- else
- mpn_bc_mulmod_bnm1 (rp, ap, bp, rn, tp);
- }
- else
- {
- mp_size_t n;
- mp_limb_t cy;
- mp_limb_t hi;
-
- n = rn >> 1;
-
- /* We need at least an + bn >= n, to be able to fit one of the
- recursive products at rp. Requiring strict inequality makes
- the coded slightly simpler. If desired, we could avoid this
- restriction by initially halving rn as long as rn is even and
- an + bn <= rn/2. */
-
- ASSERT (an + bn > n);
-
- /* Compute xm = a*b mod (B^n - 1), xp = a*b mod (B^n + 1)
- and crt together as
-
- x = -xp * B^n + (B^n + 1) * [ (xp + xm)/2 mod (B^n-1)]
- */
-
-#define a0 ap
-#define a1 (ap + n)
-#define b0 bp
-#define b1 (bp + n)
-
-#define xp tp /* 2n + 2 */
- /* am1 maybe in {xp, n} */
- /* bm1 maybe in {xp + n, n} */
-#define sp1 (tp + 2*n + 2)
- /* ap1 maybe in {sp1, n + 1} */
- /* bp1 maybe in {sp1 + n + 1, n + 1} */
-
- {
- mp_srcptr am1, bm1;
- 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 = so;
- cy = mpn_add (so, b0, n, b1, bn - n);
- MPN_INCR_U (so, n, cy);
- bnm = n;
- so += n;
- }
- }
- else
- {
- so = xp;
- am1 = a0;
- anm = an;
- }
-
- mpn_mulmod_bnm1 (rp, n, am1, anm, bm1, bnm, so);
- }
-
- {
- int k;
- 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 (BELOW_THRESHOLD (n, MUL_FFT_MODF_THRESHOLD))
- k=0;
- else
- {
- int mask;
- k = mpn_fft_best_k (n, 0);
- mask = (1<<k) - 1;
- while (n & mask) {k--; mask >>=1;};
- }
- if (k >= FFT_FIRST_K)
- xp[n] = mpn_mul_fft (xp, n, ap1, anp, bp1, bnp, k);
- else if (UNLIKELY (bp1 == b0))
- {
- ASSERT (anp + bnp <= 2*n+1);
- ASSERT (anp + bnp > n);
- ASSERT (anp >= bnp);
- mpn_mul (xp, ap1, anp, bp1, bnp);
- anp = anp + bnp - n;
- ASSERT (anp <= n || xp[2*n]==0);
- anp-= anp > n;
- cy = mpn_sub (xp, xp, n, xp + n, anp);
- xp[n] = 0;
- MPN_INCR_U (xp, n+1, cy);
- }
- else
- mpn_bc_mulmod_bnp1 (xp, ap1, bp1, n, xp);
- }
-
- /* Here the CRT recomposition begins.
-
- xm <- (xp + xm)/2 = (xp + xm)B^n/2 mod (B^n-1)
- Division by 2 is a bitwise rotation.
-
- Assumes xp normalised mod (B^n+1).
-
- The residue class [0] is represented by [B^n-1]; except when
- both input are ZERO.
- */
-
-#if HAVE_NATIVE_mpn_rsh1add_n || HAVE_NATIVE_mpn_rsh1add_nc
-#if HAVE_NATIVE_mpn_rsh1add_nc
- cy = mpn_rsh1add_nc(rp, rp, xp, n, xp[n]); /* B^n = 1 */
- hi = cy << (GMP_NUMB_BITS - 1);
- cy = 0;
- /* next update of rp[n-1] will set cy = 1 only if rp[n-1]+=hi
- overflows, i.e. a further increment will not overflow again. */
-#else /* ! _nc */
- cy = xp[n] + mpn_rsh1add_n(rp, rp, xp, n); /* B^n = 1 */
- hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */
- cy >>= 1;
- /* cy = 1 only if xp[n] = 1 i.e. {xp,n} = ZERO, this implies that
- 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);
-#else
- cy += (hi & rp[n-1]) >> (GMP_NUMB_BITS-1);
- rp[n-1] ^= hi;
-#endif
-#else /* ! HAVE_NATIVE_mpn_rsh1add_n */
-#if HAVE_NATIVE_mpn_add_nc
- cy = mpn_add_nc(rp, rp, xp, n, xp[n]);
-#else /* ! _nc */
- cy = xp[n] + mpn_add_n(rp, rp, xp, n); /* xp[n] == 1 implies {xp,n} == ZERO */
-#endif
- cy += (rp[0]&1);
- mpn_rshift(rp, rp, n, 1);
- ASSERT (cy <= 2);
- hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */
- cy >>= 1;
- /* We can have cy != 0 only if hi = 0... */
- ASSERT ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0);
- rp[n-1] |= hi;
- /* ... rp[n-1] + cy can not overflow, the following INCR is correct. */
-#endif
- ASSERT (cy <= 1);
- /* Next increment can not overflow, read the previous comments about cy. */
- ASSERT ((cy == 0) || ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0));
- MPN_INCR_U(rp, n, cy);
-
- /* Compute the highest half:
- ([(xp + xm)/2 mod (B^n-1)] - xp ) * B^n
- */
- if (UNLIKELY (an + bn < rn))
- {
- /* Note that in this case, the only way the result can equal
- zero mod B^{rn} - 1 is if one of the inputs is zero, and
- then the output of both the recursive calls and this CRT
- reconstruction is zero, not B^{rn} - 1. Which is good,
- since the latter representation doesn't fit in the output
- area.*/
- cy = mpn_sub_n (rp + n, rp, xp, an + bn - n);
-
- /* FIXME: This subtraction of the high parts is not really
- necessary, we do it to get the carry out, and for sanity
- checking. */
- cy = xp[n] + mpn_sub_nc (xp + an + bn - n, rp + an + bn - n,
- xp + an + bn - n, rn - (an + bn), cy);
- ASSERT (an + bn == rn - 1 ||
- mpn_zero_p (xp + an + bn - n + 1, rn - 1 - (an + bn)));
- cy = mpn_sub_1 (rp, rp, an + bn, cy);
- ASSERT (cy == (xp + an + bn - n)[0]);
- }
- else
- {
- cy = xp[n] + mpn_sub_n (rp + n, rp, xp, n);
- /* cy = 1 only if {xp,n+1} is not ZERO, i.e. {rp,n} is not ZERO.
- DECR will affect _at most_ the lowest n limbs. */
- MPN_DECR_U (rp, 2*n, cy);
- }
-#undef a0
-#undef a1
-#undef b0
-#undef b1
-#undef xp
-#undef sp1
- }
-}
-
-mp_size_t
-mpn_mulmod_bnm1_next_size (mp_size_t n)
-{
- mp_size_t nh;
-
- if (BELOW_THRESHOLD (n, MULMOD_BNM1_THRESHOLD))
- return n;
- if (BELOW_THRESHOLD (n, 4 * (MULMOD_BNM1_THRESHOLD - 1) + 1))
- return (n + (2-1)) & (-2);
- if (BELOW_THRESHOLD (n, 8 * (MULMOD_BNM1_THRESHOLD - 1) + 1))
- return (n + (4-1)) & (-4);
-
- nh = (n + 1) >> 1;
-
- if (BELOW_THRESHOLD (nh, MUL_FFT_MODF_THRESHOLD))
- return (n + (8-1)) & (-8);
-
- return 2 * mpn_fft_next_size (nh, mpn_fft_best_k (nh, 0));
-}
diff --git a/gmp/mpn/generic/neg.c b/gmp/mpn/generic/neg.c
deleted file mode 100644
index 2d752e912d..0000000000
--- a/gmp/mpn/generic/neg.c
+++ /dev/null
@@ -1,34 +0,0 @@
-/* mpn_neg - negate an mpn.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_FORCE_mpn_neg 1
-
-#include "gmp.h"
-#include "gmp-impl.h"
diff --git a/gmp/mpn/generic/neg_n.c b/gmp/mpn/generic/neg_n.c
new file mode 100644
index 0000000000..1609204c90
--- /dev/null
+++ b/gmp/mpn/generic/neg_n.c
@@ -0,0 +1,23 @@
+/* mpn_neg_n - negate an mpn.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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_FORCE_mpn_neg_n 1
+
+#include "gmp.h"
+#include "gmp-impl.h"
diff --git a/gmp/mpn/generic/nussbaumer_mul.c b/gmp/mpn/generic/nussbaumer_mul.c
deleted file mode 100644
index d2bf19ad56..0000000000
--- a/gmp/mpn/generic/nussbaumer_mul.c
+++ /dev/null
@@ -1,71 +0,0 @@
-/* mpn_nussbaumer_mul -- Multiply {ap,an} and {bp,bn} using
- Nussbaumer's negacyclic convolution.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Multiply {ap,an} by {bp,bn}, and put the result in {pp, an+bn} */
-void
-mpn_nussbaumer_mul (mp_ptr pp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn)
-{
- mp_size_t rn;
- mp_ptr tp;
- TMP_DECL;
-
- ASSERT (an >= bn);
- ASSERT (bn > 0);
-
- TMP_MARK;
-
- if ((ap == bp) && (an == bn))
- {
- rn = mpn_sqrmod_bnm1_next_size (2*an);
- tp = TMP_ALLOC_LIMBS (mpn_sqrmod_bnm1_itch (rn, an));
- mpn_sqrmod_bnm1 (pp, rn, ap, an, tp);
- }
- else
- {
- rn = mpn_mulmod_bnm1_next_size (an + bn);
- tp = TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (rn, an, bn));
- mpn_mulmod_bnm1 (pp, rn, ap, an, bp, bn, tp);
- }
-
- TMP_FREE;
-}
diff --git a/gmp/mpn/generic/perfpow.c b/gmp/mpn/generic/perfpow.c
deleted file mode 100644
index bbed6309d5..0000000000
--- a/gmp/mpn/generic/perfpow.c
+++ /dev/null
@@ -1,417 +0,0 @@
-/* mpn_perfect_power_p -- mpn perfect power detection.
-
- Contributed to the GNU project by Martin Boij.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-#define SMALL 20
-#define MEDIUM 100
-
-/* Return non-zero if {np,nn} == {xp,xn} ^ k.
- Algorithm:
- For s = 1, 2, 4, ..., s_max, compute the s least significant limbs of
- {xp,xn}^k. Stop if they don't match the s least significant limbs of
- {np,nn}.
-
- FIXME: Low xn limbs can be expected to always match, if computed as a mod
- B^{xn} root. So instead of using mpn_powlo, compute an approximation of the
- most significant (normalized) limb of {xp,xn} ^ k (and an error bound), and
- compare to {np, nn}. Or use an even cruder approximation based on fix-point
- base 2 logarithm. */
-static int
-pow_equals (mp_srcptr np, mp_size_t n,
- mp_srcptr xp,mp_size_t xn,
- mp_limb_t k, mp_bitcnt_t f,
- mp_ptr tp)
-{
- mp_limb_t *tp2;
- mp_bitcnt_t y, z;
- mp_size_t i, bn;
- int ans;
- mp_limb_t h, l;
- TMP_DECL;
-
- ASSERT (n > 1 || (n == 1 && np[0] > 1));
- ASSERT (np[n - 1] > 0);
- ASSERT (xn > 0);
-
- if (xn == 1 && xp[0] == 1)
- return 0;
-
- z = 1 + (n >> 1);
- for (bn = 1; bn < z; bn <<= 1)
- {
- mpn_powlo (tp, xp, &k, 1, bn, tp + bn);
- if (mpn_cmp (tp, np, bn) != 0)
- return 0;
- }
-
- TMP_MARK;
-
- /* Final check. Estimate the size of {xp,xn}^k before computing the power
- with full precision. Optimization: It might pay off to make a more
- accurate estimation of the logarithm of {xp,xn}, rather than using the
- index of the MSB. */
-
- MPN_SIZEINBASE_2EXP(y, xp, xn, 1);
- y -= 1; /* msb_index (xp, xn) */
-
- umul_ppmm (h, l, k, y);
- h -= l == 0; l--; /* two-limb decrement */
-
- z = f - 1; /* msb_index (np, n) */
- if (h == 0 && l <= z)
- {
- mp_limb_t size;
- size = l + k;
- ASSERT_ALWAYS (size >= k);
-
- y = 2 + size / GMP_LIMB_BITS;
- tp2 = TMP_ALLOC_LIMBS (y);
-
- i = mpn_pow_1 (tp, xp, xn, k, tp2);
- if (i == n && mpn_cmp (tp, np, n) == 0)
- ans = 1;
- else
- ans = 0;
- }
- else
- {
- ans = 0;
- }
-
- TMP_FREE;
- return ans;
-}
-
-
-/* Return non-zero if N = {np,n} is a kth power.
- I = {ip,n} = N^(-1) mod B^n. */
-static int
-is_kth_power (mp_ptr rp, mp_srcptr np,
- mp_limb_t k, mp_srcptr ip,
- mp_size_t n, mp_bitcnt_t f,
- mp_ptr tp)
-{
- mp_bitcnt_t b;
- mp_size_t rn, xn;
-
- ASSERT (n > 0);
- ASSERT ((k & 1) != 0 || k == 2);
- ASSERT ((np[0] & 1) != 0);
-
- if (k == 2)
- {
- b = (f + 1) >> 1;
- rn = 1 + b / GMP_LIMB_BITS;
- if (mpn_bsqrtinv (rp, ip, b, tp) != 0)
- {
- rp[rn - 1] &= (CNST_LIMB(1) << (b % GMP_LIMB_BITS)) - 1;
- xn = rn;
- MPN_NORMALIZE (rp, xn);
- if (pow_equals (np, n, rp, xn, k, f, tp) != 0)
- return 1;
-
- /* Check if (2^b - r)^2 == n */
- mpn_neg (rp, rp, rn);
- rp[rn - 1] &= (CNST_LIMB(1) << (b % GMP_LIMB_BITS)) - 1;
- MPN_NORMALIZE (rp, rn);
- if (pow_equals (np, n, rp, rn, k, f, tp) != 0)
- return 1;
- }
- }
- else
- {
- b = 1 + (f - 1) / k;
- rn = 1 + (b - 1) / GMP_LIMB_BITS;
- mpn_brootinv (rp, ip, rn, k, tp);
- if ((b % GMP_LIMB_BITS) != 0)
- rp[rn - 1] &= (CNST_LIMB(1) << (b % GMP_LIMB_BITS)) - 1;
- MPN_NORMALIZE (rp, rn);
- if (pow_equals (np, n, rp, rn, k, f, tp) != 0)
- return 1;
- }
- MPN_ZERO (rp, rn); /* Untrash rp */
- return 0;
-}
-
-static int
-perfpow (mp_srcptr np, mp_size_t n,
- mp_limb_t ub, mp_limb_t g,
- mp_bitcnt_t f, int neg)
-{
- mp_ptr ip, tp, rp;
- mp_limb_t k;
- int ans;
- mp_bitcnt_t b;
- gmp_primesieve_t ps;
- TMP_DECL;
-
- ASSERT (n > 0);
- ASSERT ((np[0] & 1) != 0);
- ASSERT (ub > 0);
-
- TMP_MARK;
- gmp_init_primesieve (&ps);
- b = (f + 3) >> 1;
-
- ip = TMP_ALLOC_LIMBS (n);
- rp = TMP_ALLOC_LIMBS (n);
- tp = TMP_ALLOC_LIMBS (5 * n); /* FIXME */
- MPN_ZERO (rp, n);
-
- /* FIXME: It seems the inverse in ninv is needed only to get non-inverted
- roots. I.e., is_kth_power computes n^{1/2} as (n^{-1})^{-1/2} and
- similarly for nth roots. It should be more efficient to compute n^{1/2} as
- n * n^{-1/2}, with a mullo instead of a binvert. And we can do something
- similar for kth roots if we switch to an iteration converging to n^{1/k -
- 1}, and we can then eliminate this binvert call. */
- mpn_binvert (ip, np, 1 + (b - 1) / GMP_LIMB_BITS, tp);
- if (b % GMP_LIMB_BITS)
- ip[(b - 1) / GMP_LIMB_BITS] &= (CNST_LIMB(1) << (b % GMP_LIMB_BITS)) - 1;
-
- if (neg)
- gmp_nextprime (&ps);
-
- ans = 0;
- if (g > 0)
- {
- ub = MIN (ub, g + 1);
- while ((k = gmp_nextprime (&ps)) < ub)
- {
- if ((g % k) == 0)
- {
- if (is_kth_power (rp, np, k, ip, n, f, tp) != 0)
- {
- ans = 1;
- goto ret;
- }
- }
- }
- }
- else
- {
- while ((k = gmp_nextprime (&ps)) < ub)
- {
- if (is_kth_power (rp, np, k, ip, n, f, tp) != 0)
- {
- ans = 1;
- goto ret;
- }
- }
- }
- ret:
- TMP_FREE;
- return ans;
-}
-
-static const unsigned short nrtrial[] = { 100, 500, 1000 };
-
-/* Table of (log_{p_i} 2) values, where p_i is the (nrtrial[i] + 1)'th prime
- number. */
-static const double logs[] =
- { 0.1099457228193620, 0.0847016403115322, 0.0772048195144415 };
-
-int
-mpn_perfect_power_p (mp_srcptr np, mp_size_t n)
-{
- mp_size_t ncn, s, pn, xn;
- mp_limb_t *nc, factor, g;
- mp_limb_t exp, *prev, *next, d, l, r, c, *tp, cry;
- mp_bitcnt_t twos, count;
- int ans, where, neg, trial;
- TMP_DECL;
-
- nc = (mp_ptr) np;
-
- neg = 0;
- if (n < 0)
- {
- neg = 1;
- n = -n;
- }
-
- if (n == 0 || (n == 1 && np[0] == 1))
- return 1;
-
- TMP_MARK;
-
- g = 0;
-
- ncn = n;
- twos = mpn_scan1 (np, 0);
- if (twos > 0)
- {
- if (twos == 1)
- {
- ans = 0;
- goto ret;
- }
- s = twos / GMP_LIMB_BITS;
- if (s + 1 == n && POW2_P (np[s]))
- {
- ans = ! (neg && POW2_P (twos));
- goto ret;
- }
- count = twos % GMP_LIMB_BITS;
- ncn = n - s;
- nc = TMP_ALLOC_LIMBS (ncn);
- if (count > 0)
- {
- mpn_rshift (nc, np + s, ncn, count);
- ncn -= (nc[ncn - 1] == 0);
- }
- else
- {
- MPN_COPY (nc, np + s, ncn);
- }
- g = twos;
- }
-
- if (ncn <= SMALL)
- trial = 0;
- else if (ncn <= MEDIUM)
- trial = 1;
- else
- trial = 2;
-
- where = 0;
- factor = mpn_trialdiv (nc, ncn, nrtrial[trial], &where);
-
- if (factor != 0)
- {
- if (twos == 0)
- {
- nc = TMP_ALLOC_LIMBS (ncn);
- MPN_COPY (nc, np, ncn);
- }
-
- /* Remove factors found by trialdiv. Optimization: Perhaps better to use
- the strategy in mpz_remove (). */
- prev = TMP_ALLOC_LIMBS (ncn + 2);
- next = TMP_ALLOC_LIMBS (ncn + 2);
- tp = TMP_ALLOC_LIMBS (4 * ncn);
-
- do
- {
- binvert_limb (d, factor);
- prev[0] = d;
- pn = 1;
- exp = 1;
- while (2 * pn - 1 <= ncn)
- {
- mpn_sqr (next, prev, pn);
- xn = 2 * pn;
- xn -= (next[xn - 1] == 0);
-
- if (mpn_divisible_p (nc, ncn, next, xn) == 0)
- break;
-
- exp <<= 1;
- pn = xn;
- MP_PTR_SWAP (next, prev);
- }
-
- /* Binary search for the exponent */
- l = exp + 1;
- r = 2 * exp - 1;
- while (l <= r)
- {
- c = (l + r) >> 1;
- if (c - exp > 1)
- {
- xn = mpn_pow_1 (tp, &d, 1, c - exp, next);
- if (pn + xn - 1 > ncn)
- {
- r = c - 1;
- continue;
- }
- mpn_mul (next, prev, pn, tp, xn);
- xn += pn;
- xn -= (next[xn - 1] == 0);
- }
- else
- {
- cry = mpn_mul_1 (next, prev, pn, d);
- next[pn] = cry;
- xn = pn + (cry != 0);
- }
-
- if (mpn_divisible_p (nc, ncn, next, xn) == 0)
- {
- r = c - 1;
- }
- else
- {
- exp = c;
- l = c + 1;
- MP_PTR_SWAP (next, prev);
- pn = xn;
- }
- }
-
- if (g == 0)
- g = exp;
- else
- g = mpn_gcd_1 (&g, 1, exp);
-
- if (g == 1)
- {
- ans = 0;
- goto ret;
- }
-
- mpn_divexact (next, nc, ncn, prev, pn);
- ncn = ncn - pn;
- ncn += next[ncn] != 0;
- MPN_COPY (nc, next, ncn);
-
- if (ncn == 1 && nc[0] == 1)
- {
- ans = ! (neg && POW2_P (g));
- goto ret;
- }
-
- factor = mpn_trialdiv (nc, ncn, nrtrial[trial], &where);
- }
- while (factor != 0);
- }
-
- MPN_SIZEINBASE_2EXP(count, nc, ncn, 1); /* log (nc) + 1 */
- d = (mp_limb_t) (count * logs[trial] + 1e-9) + 1;
- ans = perfpow (nc, ncn, d, g, count, neg);
-
- ret:
- TMP_FREE;
- return ans;
-}
diff --git a/gmp/mpn/generic/perfsqr.c b/gmp/mpn/generic/perfsqr.c
index bdd82ccd96..1995a944df 100644
--- a/gmp/mpn/generic/perfsqr.c
+++ b/gmp/mpn/generic/perfsqr.c
@@ -1,34 +1,23 @@
/* mpn_perfect_square_p(u,usize) -- Return non-zero if U is a perfect square,
zero otherwise.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -113,20 +102,20 @@ see https://www.gnu.org/licenses/. */
/* FIXME: The %= here isn't good, and might destroy any savings from keeping
the PERFSQR_MOD_IDX stuff within a limb (rather than needing umul_ppmm).
Maybe a new sort of mpn_preinv_mod_1 could accept an unnormalized divisor
- and a shift count, like mpn_preinv_divrem_1. But mod_34lsub1 is our
- normal case, so lets not worry too much about mod_1. */
-#define PERFSQR_MOD_PP(r, up, usize) \
- do { \
- if (BELOW_THRESHOLD (usize, PREINV_MOD_1_TO_MOD_1_THRESHOLD)) \
- { \
- (r) = mpn_preinv_mod_1 (up, usize, PERFSQR_PP_NORM, \
- PERFSQR_PP_INVERTED); \
- (r) %= PERFSQR_PP; \
- } \
- else \
- { \
- (r) = mpn_mod_1 (up, usize, PERFSQR_PP); \
- } \
+ and a shift count, like mpn_preinv_divrem_1. But mod_34lsub1 is our
+ normal case, so lets not worry too much about mod_1. */
+#define PERFSQR_MOD_PP(r, up, usize) \
+ do { \
+ if (USE_PREINV_MOD_1) \
+ { \
+ (r) = mpn_preinv_mod_1 (up, usize, PERFSQR_PP_NORM, \
+ PERFSQR_PP_INVERTED); \
+ (r) %= PERFSQR_PP; \
+ } \
+ else \
+ { \
+ (r) = mpn_mod_1 (up, usize, PERFSQR_PP); \
+ } \
} while (0)
#define PERFSQR_MOD_IDX(idx, r, d, inv) \
@@ -156,7 +145,7 @@ see https://www.gnu.org/licenses/. */
} while (0)
/* The expression "(int) idx - GMP_LIMB_BITS < 0" lets the compiler use the
- sign bit from "idx-GMP_LIMB_BITS", which might help avoid a branch. */
+ sign bit from "idx-GMP_LIMB_BITS", which might help avoid a branch. */
#define PERFSQR_MOD_2(r, d, inv, mhi, mlo) \
do { \
mp_limb_t m; \
@@ -196,7 +185,7 @@ mpn_perfect_square_p (mp_srcptr up, mp_size_t usize)
/* Check that we have even multiplicity of 2, and then check that the rest is
a possible perfect square. Leave disabled until we can determine this
really is an improvement. It it is, it could completely replace the
- simple probe above, since this should throw out more non-squares, but at
+ simple probe above, since this should through out more non-squares, but at
the expense of somewhat more cycles. */
{
mp_limb_t lo;
@@ -229,7 +218,7 @@ mpn_perfect_square_p (mp_srcptr up, mp_size_t usize)
TMP_DECL;
TMP_MARK;
- root_ptr = TMP_ALLOC_LIMBS ((usize + 1) / 2);
+ root_ptr = (mp_ptr) TMP_ALLOC ((usize + 1) / 2 * BYTES_PER_MP_LIMB);
/* Iff mpn_sqrtrem returns zero, the square is perfect. */
res = ! mpn_sqrtrem (root_ptr, NULL, up, usize);
diff --git a/gmp/mpn/generic/popham.c b/gmp/mpn/generic/popham.c
index 13e529b7cd..be7c525036 100644
--- a/gmp/mpn/generic/popham.c
+++ b/gmp/mpn/generic/popham.c
@@ -1,33 +1,21 @@
/* mpn_popcount, mpn_hamdist -- mpn bit population count/hamming distance.
-Copyright 1994, 1996, 2000-2002, 2005, 2011, 2012 Free Software Foundation,
-Inc.
+Copyright 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -42,14 +30,14 @@ see https://www.gnu.org/licenses/. */
#define POPHAM(u,v) u ^ v
#endif
-mp_bitcnt_t
+unsigned long
FNAME (mp_srcptr up,
#if OPERATION_hamdist
mp_srcptr vp,
#endif
- mp_size_t n) __GMP_NOTHROW
+ mp_size_t n)
{
- mp_bitcnt_t result = 0;
+ unsigned long result = 0;
mp_limb_t p0, p1, p2, p3, x, p01, p23;
mp_size_t i;
diff --git a/gmp/mpn/generic/pow_1.c b/gmp/mpn/generic/pow_1.c
index 2333206554..4bc9f434bc 100644
--- a/gmp/mpn/generic/pow_1.c
+++ b/gmp/mpn/generic/pow_1.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2002, 2014 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have 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"
@@ -45,9 +34,6 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
mp_size_t rn;
int par;
- ASSERT (bn >= 1);
- /* FIXME: Add operand overlap criteria */
-
if (exp <= 1)
{
if (exp == 0)
@@ -68,13 +54,11 @@ 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;
- x = exp;
- do
+ for (x = exp; x != 0; x >>= 1)
{
- par ^= x;
+ par ^= x & 1;
cnt--;
- x >>= 1;
- } while (x != 0);
+ }
exp <<= cnt;
if (bn == 1)
@@ -84,7 +68,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
if ((cnt & 1) != 0)
MP_PTR_SWAP (rp, tp);
- mpn_sqr (rp, bp, bn);
+ mpn_sqr_n (rp, bp, bn);
rn = 2 * bn; rn -= rp[rn - 1] == 0;
for (i = GMP_LIMB_BITS - cnt - 1;;)
@@ -99,7 +83,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
if (--i == 0)
break;
- mpn_sqr (tp, rp, rn);
+ mpn_sqr_n (tp, rp, rn);
rn = 2 * rn; rn -= tp[rn - 1] == 0;
MP_PTR_SWAP (rp, tp);
}
@@ -109,7 +93,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
if (((par ^ cnt) & 1) == 0)
MP_PTR_SWAP (rp, tp);
- mpn_sqr (rp, bp, bn);
+ mpn_sqr_n (rp, bp, bn);
rn = 2 * bn; rn -= rp[rn - 1] == 0;
for (i = GMP_LIMB_BITS - cnt - 1;;)
@@ -124,7 +108,7 @@ mpn_pow_1 (mp_ptr rp, mp_srcptr bp, mp_size_t bn, mp_limb_t exp, mp_ptr tp)
if (--i == 0)
break;
- mpn_sqr (tp, rp, rn);
+ mpn_sqr_n (tp, rp, rn);
rn = 2 * rn; rn -= tp[rn - 1] == 0;
MP_PTR_SWAP (rp, tp);
}
diff --git a/gmp/mpn/generic/powlo.c b/gmp/mpn/generic/powlo.c
index adcd96eb51..ca3e1e9448 100644
--- a/gmp/mpn/generic/powlo.c
+++ b/gmp/mpn/generic/powlo.c
@@ -1,32 +1,21 @@
-/* mpn_powlo -- Compute R = U^E mod B^n, where B is the limb base.
+/* mpn_powlo -- Compute R = U^E mod R^n, where R is the limb base.
-Copyright 2007-2009, 2012 Free Software Foundation, Inc.
+Copyright 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,7 +27,7 @@ see https://www.gnu.org/licenses/. */
((p[(bi - 1) / GMP_LIMB_BITS] >> (bi - 1) % GMP_LIMB_BITS) & 1)
static inline mp_limb_t
-getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
+getbits (const mp_limb_t *p, unsigned long bi, int nbits)
{
int nbits_in_r;
mp_limb_t r;
@@ -51,10 +40,10 @@ getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
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 */
+ i = bi / GMP_LIMB_BITS; /* word index of low bit to extract */
+ bi %= GMP_LIMB_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 */
+ nbits_in_r = GMP_LIMB_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);
@@ -62,16 +51,16 @@ getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
}
static inline int
-win_size (mp_bitcnt_t eb)
+win_size (unsigned long eb)
{
int k;
- static mp_bitcnt_t x[] = {1,7,25,81,241,673,1793,4609,11521,28161,~(mp_bitcnt_t)0};
+ static unsigned long x[] = {1,7,25,81,241,673,1793,4609,11521,28161,~0ul};
for (k = 0; eb > x[k]; k++)
;
return k;
}
-/* rp[n-1..0] = bp[n-1..0] ^ ep[en-1..0] mod B^n, B is the limb base.
+/* rp[n-1..0] = bp[n-1..0] ^ ep[en-1..0] mod R^n, R is the limb base.
Requires that ep[en-1] is non-zero.
Uses scratch space tp[3n-1..0], i.e., 3n words. */
void
@@ -80,7 +69,7 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
mp_size_t n, mp_ptr tp)
{
int cnt;
- mp_bitcnt_t ebi;
+ long ebi;
int windowsize, this_windowsize;
mp_limb_t expbits;
mp_limb_t *pp, *this_pp, *last_pp;
@@ -92,11 +81,12 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
TMP_MARK;
- MPN_SIZEINBASE_2EXP(ebi, ep, en, 1);
+ count_leading_zeros (cnt, ep[en - 1]);
+ ebi = en * GMP_LIMB_BITS - cnt;
windowsize = win_size (ebi);
- pp = TMP_ALLOC_LIMBS ((n << (windowsize - 1)) + n); /* + n is for mullo ign part */
+ pp = TMP_ALLOC_LIMBS ((n << (windowsize - 1)) + n); /* + n is for mullow ign part */
this_pp = pp;
@@ -105,7 +95,7 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
b2p = tp + 2*n;
/* Store b^2 in b2. */
- mpn_sqr (tp, bp, n); /* FIXME: Use "mpn_sqrlo" */
+ mpn_sqr_n (tp, bp, n); /* FIXME: Use "mpn_sqrlo" */
MPN_COPY (b2p, tp, n);
/* Precompute odd powers of b and put them in the temporary area at pp. */
@@ -113,14 +103,13 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
{
last_pp = this_pp;
this_pp += n;
- mpn_mullo_n (this_pp, last_pp, b2p, n);
+ mpn_mullow_n (this_pp, last_pp, b2p, n);
}
expbits = getbits (ep, ebi, windowsize);
- if (ebi < windowsize)
+ ebi -= windowsize;
+ if (ebi < 0)
ebi = 0;
- else
- ebi -= windowsize;
count_trailing_zeros (cnt, expbits);
ebi += cnt;
@@ -132,7 +121,7 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
{
while (getbit (ep, ebi) == 0)
{
- mpn_sqr (tp, rp, n); /* FIXME: Use "mpn_sqrlo" */
+ mpn_sqr_n (tp, rp, n); /* FIXME: Use "mpn_sqrlo" */
MPN_COPY (rp, tp, n);
ebi--;
if (ebi == 0)
@@ -143,14 +132,13 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
bits <= windowsize, and such that the least significant bit is 1. */
expbits = getbits (ep, ebi, windowsize);
+ ebi -= windowsize;
this_windowsize = windowsize;
- if (ebi < windowsize)
+ if (ebi < 0)
{
- this_windowsize -= windowsize - ebi;
+ this_windowsize += ebi;
ebi = 0;
}
- else
- ebi -= windowsize;
count_trailing_zeros (cnt, expbits);
this_windowsize -= cnt;
@@ -159,13 +147,13 @@ mpn_powlo (mp_ptr rp, mp_srcptr bp,
do
{
- mpn_sqr (tp, rp, n);
+ mpn_sqr_n (tp, rp, n);
MPN_COPY (rp, tp, n);
this_windowsize--;
}
while (this_windowsize != 0);
- mpn_mullo_n (tp, rp, pp + n * (expbits >> 1), n);
+ mpn_mullow_n (tp, rp, pp + n * (expbits >> 1), n);
MPN_COPY (rp, tp, n);
}
diff --git a/gmp/mpn/generic/powm.c b/gmp/mpn/generic/powm.c
index 9968116016..c057ec2156 100644
--- a/gmp/mpn/generic/powm.c
+++ b/gmp/mpn/generic/powm.c
@@ -1,51 +1,37 @@
/* mpn_powm -- Compute R = U^E mod M.
- 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-2012 Free Software Foundation, Inc.
+Copyright 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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.
+ BASIC ALGORITHM, Compute b^e mod n, where n is odd.
- 1. W <- U
+ 1. w <- b
- 2. T <- (B^n * U) mod M Convert to REDC form
+ 2. While w^2 < n (and there are more bits in e)
+ w <- power left-to-right base-2 without reduction
- 3. Compute table U^1, U^3, U^5... of E-dependent size
+ 3. t <- (B^n * b) / n Convert to REDC form
- 4. While there are more bits in E
- W <- power left-to-right base-k
+ 4. Compute power table of e-dependent size
+
+ 5. While there are more bits in e
+ w <- power left-to-right base-k with reduction
TODO:
@@ -54,64 +40,51 @@ see https://www.gnu.org/licenses/. */
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?
+ * Write an itch function.
* Choose window size without looping. (Superoptimize or think(tm).)
- * Handle small bases with initial, reduction-free exponentiation.
+ * How do we handle small bases?
+
+ * This is slower than old mpz code, in particular if we base it on redc_1
+ (use: #undef HAVE_NATIVE_mpn_addmul_2). Why?
+
+ * Make it sub-quadratic.
* Call new division functions, not mpn_tdiv_qr.
+ * Is redc obsolete with improved SB division?
+
* Consider special code for one-limb M.
- * How should we handle the redc1/redc2/redc_n choice?
- - redc1: T(binvert_1limb) + e * (n) * (T(mullo-1x1) + n*T(addmul_1))
- - redc2: T(binvert_2limbs) + e * (n/2) * (T(mullo-2x2) + n*T(addmul_2))
- - redc_n: T(binvert_nlimbs) + e * (T(mullo-nxn) + T(M(n)))
+ * CRT for N = odd*2^t:
+ Using Newton's method and 2-adic arithmetic:
+ m1_inv_m2 = 1/odd mod 2^t
+ Plain 2-adic (REDC) modexp:
+ r1 = a ^ b mod odd
+ Mullo+sqrlo-based modexp:
+ r2 = a ^ b mod 2^t
+ mullo, mul, add:
+ r = ((r2 - r1) * m1_i_m2 mod 2^t) * odd + r1
+
+ * How should we handle the redc1/redc2/redc2/redc4/redc_subquad choice?
+ - redc1: T(binvert_1limb) + e * (n) * (T(mullo1x1) + n*T(addmul_1))
+ - redc2: T(binvert_2limbs) + e * (n/2) * (T(mullo2x2) + n*T(addmul_2))
+ - redc3: T(binvert_3limbs) + e * (n/3) * (T(mullo3x3) + n*T(addmul_3))
This disregards the addmul_N constant term, but we could think of
- that as part of the respective mullo.
-
- * When U (the base) is small, we should start the exponentiation with plain
- operations, then convert that partial result to REDC form.
-
- * When U is just one limb, should it be handled without the k-ary tricks?
- We could keep a factor of B^n in W, but use U' = BU as base. After
- multiplying by this (pseudo two-limb) number, we need to multiply by 1/B
- mod M.
+ that as part of the respective mulloNxN.
*/
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
-#undef MPN_REDC_1
-#define MPN_REDC_1(rp, up, mp, n, invm) \
- do { \
- mp_limb_t cy; \
- cy = mpn_redc_1 (rp, up, mp, n, invm); \
- if (cy != 0) \
- mpn_sub_n (rp, rp, mp, n); \
- } while (0)
-
-#undef MPN_REDC_2
-#define MPN_REDC_2(rp, up, mp, n, mip) \
- do { \
- mp_limb_t cy; \
- cy = mpn_redc_2 (rp, up, mp, n, mip); \
- if (cy != 0) \
- mpn_sub_n (rp, rp, mp, n); \
- } while (0)
-
-#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
-#define WANT_REDC_2 1
-#endif
#define getbit(p,bi) \
((p[(bi - 1) / GMP_LIMB_BITS] >> (bi - 1) % GMP_LIMB_BITS) & 1)
static inline mp_limb_t
-getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
+getbits (const mp_limb_t *p, unsigned long bi, int nbits)
{
int nbits_in_r;
mp_limb_t r;
@@ -124,27 +97,49 @@ getbits (const mp_limb_t *p, mp_bitcnt_t bi, int nbits)
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 */
+ i = bi / GMP_LIMB_BITS; /* word index of low bit to extract */
+ bi %= GMP_LIMB_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 */
+ nbits_in_r = GMP_LIMB_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);
}
}
+#undef HAVE_NATIVE_mpn_addmul_2
+
+#ifndef HAVE_NATIVE_mpn_addmul_2
+#define REDC_2_THRESHOLD MP_SIZE_T_MAX
+#endif
+
+#ifndef REDC_2_THRESHOLD
+#define REDC_2_THRESHOLD 4
+#endif
+
+static void mpn_redc_n () {ASSERT_ALWAYS(0);}
+
static inline int
-win_size (mp_bitcnt_t eb)
+win_size (unsigned long eb)
{
int k;
- static mp_bitcnt_t x[] = {0,7,25,81,241,673,1793,4609,11521,28161,~(mp_bitcnt_t)0};
- for (k = 1; eb > x[k]; k++)
+ static unsigned long x[] = {1,7,25,81,241,673,1793,4609,11521,28161,~0ul};
+ for (k = 0; eb > x[k]; k++)
;
return k;
}
-/* Convert U to REDC form, U_r = B^n * U mod M */
+#define MPN_REDC_X(rp, tp, mp, n, mip) \
+ do { \
+ if (redc_x == 1) \
+ mpn_redc_1 (rp, tp, mp, n, mip[0]); \
+ else if (redc_x == 2) \
+ mpn_redc_2 (rp, tp, mp, n, mip); \
+ else \
+ mpn_redc_n (rp, tp, mp, n, mip); \
+ } while (0)
+
+ /* Convert U to REDC form, U_r = B^n * U mod M */
static void
redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n)
{
@@ -164,19 +159,21 @@ redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n)
/* 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] is > 1.
- Uses scratch space at tp of MAX(mpn_binvert_itch(n),2n) limbs. */
+ Uses scratch space tp[3n..0], i.e., 3n+1 words. */
void
mpn_powm (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_limb_t mip[2];
int cnt;
- mp_bitcnt_t ebi;
+ long ebi;
int windowsize, this_windowsize;
mp_limb_t expbits;
- mp_ptr pp, this_pp;
+ mp_ptr pp, this_pp, last_pp;
+ mp_ptr b2p;
long i;
+ int redc_x;
TMP_DECL;
ASSERT (en > 1 || (en == 1 && ep[0] > 1));
@@ -184,7 +181,8 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
TMP_MARK;
- MPN_SIZEINBASE_2EXP(ebi, ep, en, 1);
+ count_leading_zeros (cnt, ep[en - 1]);
+ ebi = en * GMP_LIMB_BITS - cnt;
#if 0
if (bn < n)
@@ -193,7 +191,7 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
until the result is greater than the mod argument. */
for (;;)
{
- mpn_sqr (tp, this_pp, tn);
+ mpn_sqr_n (tp, this_pp, tn);
tn = tn * 2 - 1, tn += tp[tn] != 0;
if (getbit (ep, ebi) != 0)
mpn_mul (..., tp, tn, bp, bn);
@@ -204,75 +202,49 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
windowsize = win_size (ebi);
-#if WANT_REDC_2
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
+ if (BELOW_THRESHOLD (n, REDC_2_THRESHOLD))
{
- mip = ip;
binvert_limb (mip[0], mp[0]);
mip[0] = -mip[0];
+ redc_x = 1;
}
- else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD))
+#if defined (HAVE_NATIVE_mpn_addmul_2)
+ else
{
- mip = ip;
mpn_binvert (mip, mp, 2, tp);
mip[0] = -mip[0]; mip[1] = ~mip[1];
- }
-#else
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD))
- {
- mip = ip;
- binvert_limb (mip[0], mp[0]);
- mip[0] = -mip[0];
+ redc_x = 2;
}
#endif
- else
- {
- mip = TMP_ALLOC_LIMBS (n);
- mpn_binvert (mip, mp, n, tp);
- }
+#if 0
+ mpn_binvert (mip, mp, n, tp);
+ redc_x = 0;
+#endif
pp = TMP_ALLOC_LIMBS (n << (windowsize - 1));
this_pp = pp;
redcify (this_pp, bp, bn, mp, n);
- /* Store b^2 at rp. */
- mpn_sqr (tp, this_pp, n);
-#if WANT_REDC_2
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
- MPN_REDC_1 (rp, tp, mp, n, mip[0]);
- else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD))
- MPN_REDC_2 (rp, tp, mp, n, mip);
-#else
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD))
- MPN_REDC_1 (rp, tp, mp, n, mip[0]);
-#endif
- else
- mpn_redc_n (rp, tp, mp, n, mip);
+ b2p = tp + 2*n;
+
+ /* Store b^2 in b2. */
+ mpn_sqr_n (tp, this_pp, n);
+ MPN_REDC_X (b2p, tp, mp, n, mip);
/* Precompute odd powers of b and put them in the temporary area at pp. */
for (i = (1 << (windowsize - 1)) - 1; i > 0; i--)
{
- mpn_mul_n (tp, this_pp, rp, n);
+ last_pp = this_pp;
this_pp += n;
-#if WANT_REDC_2
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
- MPN_REDC_1 (this_pp, tp, mp, n, mip[0]);
- else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD))
- MPN_REDC_2 (this_pp, tp, mp, n, mip);
-#else
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD))
- MPN_REDC_1 (this_pp, tp, mp, n, mip[0]);
-#endif
- else
- mpn_redc_n (this_pp, tp, mp, n, mip);
+ mpn_mul_n (tp, last_pp, b2p, n);
+ MPN_REDC_X (this_pp, tp, mp, n, mip);
}
expbits = getbits (ep, ebi, windowsize);
- if (ebi < windowsize)
+ ebi -= windowsize;
+ if (ebi < 0)
ebi = 0;
- else
- ebi -= windowsize;
count_trailing_zeros (cnt, expbits);
ebi += cnt;
@@ -280,311 +252,51 @@ mpn_powm (mp_ptr rp, mp_srcptr bp, mp_size_t bn,
MPN_COPY (rp, pp + n * (expbits >> 1), n);
-#define INNERLOOP \
- while (ebi != 0) \
- { \
- while (getbit (ep, ebi) == 0) \
- { \
- MPN_SQR (tp, rp, n); \
- MPN_REDUCE (rp, tp, mp, n, mip); \
- ebi--; \
- if (ebi == 0) \
- goto done; \
- } \
- \
- /* The next bit of the exponent is 1. Now extract the largest \
- block of bits <= windowsize, and such that the least \
- significant bit is 1. */ \
- \
- expbits = getbits (ep, ebi, windowsize); \
- this_windowsize = windowsize; \
- if (ebi < windowsize) \
- { \
- this_windowsize -= windowsize - ebi; \
- ebi = 0; \
- } \
- else \
- ebi -= windowsize; \
- \
- count_trailing_zeros (cnt, expbits); \
- this_windowsize -= cnt; \
- ebi += cnt; \
- expbits >>= cnt; \
- \
- do \
- { \
- MPN_SQR (tp, rp, n); \
- MPN_REDUCE (rp, tp, mp, n, mip); \
- this_windowsize--; \
- } \
- while (this_windowsize != 0); \
- \
- MPN_MUL_N (tp, rp, pp + n * (expbits >> 1), n); \
- MPN_REDUCE (rp, tp, mp, n, mip); \
- }
-
-
-#if WANT_REDC_2
- if (REDC_1_TO_REDC_2_THRESHOLD < MUL_TOOM22_THRESHOLD)
- {
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_2_THRESHOLD))
- {
- if (REDC_1_TO_REDC_2_THRESHOLD < SQR_BASECASE_THRESHOLD
- || BELOW_THRESHOLD (n, SQR_BASECASE_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_mul_basecase (r,a,n,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1 (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_1 (rp, tp, mp, n, mip[0])
- INNERLOOP;
- }
- }
- else if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD))
- {
- if (MUL_TOOM22_THRESHOLD < SQR_BASECASE_THRESHOLD
- || BELOW_THRESHOLD (n, SQR_BASECASE_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_mul_basecase (r,a,n,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_2 (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_2 (rp, tp, mp, n, mip)
- INNERLOOP;
- }
- }
- else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD))
- {
-#undef MPN_MUL_N
-#undef MPN_SQR
-#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_2 (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_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip)
- INNERLOOP;
- }
- }
- else
+ while (ebi != 0)
{
- if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD))
+ while (getbit (ep, ebi) == 0)
{
- if (MUL_TOOM22_THRESHOLD < SQR_BASECASE_THRESHOLD
- || BELOW_THRESHOLD (n, SQR_BASECASE_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_mul_basecase (r,a,n,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1 (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_1 (rp, tp, mp, n, mip[0])
- INNERLOOP;
- }
- }
- else 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_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1 (rp, tp, mp, n, mip[0])
- INNERLOOP;
- }
- else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD))
- {
-#undef MPN_MUL_N
-#undef MPN_SQR
-#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_2 (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_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip)
- INNERLOOP;
+ mpn_sqr_n (tp, rp, n);
+ MPN_REDC_X (rp, tp, mp, n, mip);
+ ebi--;
+ if (ebi == 0)
+ goto done;
}
- }
-#else /* WANT_REDC_2 */
+ /* The next bit of the exponent is 1. Now extract the largest block of
+ bits <= windowsize, and such that the least significant bit is 1. */
- if (REDC_1_TO_REDC_N_THRESHOLD < MUL_TOOM22_THRESHOLD)
- {
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD))
- {
- if (REDC_1_TO_REDC_N_THRESHOLD < SQR_BASECASE_THRESHOLD
- || BELOW_THRESHOLD (n, SQR_BASECASE_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_mul_basecase (r,a,n,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1 (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_1 (rp, tp, mp, n, mip[0])
- INNERLOOP;
- }
- }
- else if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD))
+ expbits = getbits (ep, ebi, windowsize);
+ ebi -= windowsize;
+ this_windowsize = windowsize;
+ if (ebi < 0)
{
- if (MUL_TOOM22_THRESHOLD < SQR_BASECASE_THRESHOLD
- || BELOW_THRESHOLD (n, SQR_BASECASE_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_mul_basecase (r,a,n,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (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_n (rp, tp, mp, n, mip)
- INNERLOOP;
- }
+ this_windowsize += ebi;
+ ebi = 0;
}
- else
- {
-#undef MPN_MUL_N
-#undef MPN_SQR
-#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip)
- INNERLOOP;
- }
- }
- else
- {
- if (BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD))
- {
- if (MUL_TOOM22_THRESHOLD < SQR_BASECASE_THRESHOLD
- || BELOW_THRESHOLD (n, SQR_BASECASE_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_mul_basecase (r,a,n,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1 (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_1 (rp, tp, mp, n, mip[0])
- INNERLOOP;
- }
- }
- else if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD))
- {
-#undef MPN_MUL_N
-#undef MPN_SQR
-#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) MPN_REDC_1 (rp, tp, mp, n, mip[0])
- INNERLOOP;
- }
- else
+
+ count_trailing_zeros (cnt, expbits);
+ this_windowsize -= cnt;
+ ebi += cnt;
+ expbits >>= cnt;
+
+ do
{
-#undef MPN_MUL_N
-#undef MPN_SQR
-#undef MPN_REDUCE
-#define MPN_MUL_N(r,a,b,n) mpn_mul_n (r,a,b,n)
-#define MPN_SQR(r,a,n) mpn_sqr (r,a,n)
-#define MPN_REDUCE(rp,tp,mp,n,mip) mpn_redc_n (rp, tp, mp, n, mip)
- INNERLOOP;
+ mpn_sqr_n (tp, rp, n);
+ MPN_REDC_X (rp, tp, mp, n, mip);
+ this_windowsize--;
}
+ while (this_windowsize != 0);
+
+ mpn_mul_n (tp, rp, pp + n * (expbits >> 1), n);
+ MPN_REDC_X (rp, tp, mp, n, mip);
}
-#endif /* WANT_REDC_2 */
done:
-
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 (rp, tp, mp, n, mip[0]);
- else if (BELOW_THRESHOLD (n, REDC_2_TO_REDC_N_THRESHOLD))
- MPN_REDC_2 (rp, tp, mp, n, mip);
-#else
- if (BELOW_THRESHOLD (n, REDC_1_TO_REDC_N_THRESHOLD))
- MPN_REDC_1 (rp, tp, mp, n, mip[0]);
-#endif
- else
- mpn_redc_n (rp, tp, mp, n, mip);
-
+ MPN_REDC_X (rp, tp, mp, n, mip);
if (mpn_cmp (rp, mp, n) >= 0)
mpn_sub_n (rp, rp, mp, n);
-
TMP_FREE;
}
diff --git a/gmp/mpn/generic/powm_sec.c b/gmp/mpn/generic/powm_sec.c
new file mode 100644
index 0000000000..26d77b5c81
--- /dev/null
+++ b/gmp/mpn/generic/powm_sec.c
@@ -0,0 +1,272 @@
+/* mpn_powm_sec -- Compute R = U^E mod M. Safe variant, not leaking time info.
+
+Copyright 2007, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 b^e mod n, where n is odd.
+
+ 1. w <- b
+
+ 2. While w^2 < n (and there are more bits in e)
+ w <- power left-to-right base-2 without reduction
+
+ 3. t <- (B^n * b) / n Convert to REDC form
+
+ 4. Compute power table of e-dependent size
+
+ 5. While there are more bits in e
+ w <- power left-to-right base-k with reduction
+
+
+ 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.
+
+ * Choose window size without looping. (Superoptimize or think(tm).)
+
+ * Make it sub-quadratic.
+
+ * Call new division functions, not mpn_tdiv_qr.
+
+ * Is redc obsolete with improved SB division?
+
+ * Consider special code for one-limb M.
+
+ * Handle even M (in mpz_powm_sec) with two modexps and CRT.
+*/
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+#define WANT_CACHE_SECURITY 1
+
+
+#define getbit(p,bi) \
+ ((p[(bi - 1) / GMP_LIMB_BITS] >> (bi - 1) % GMP_LIMB_BITS) & 1)
+
+static inline mp_limb_t
+getbits (const mp_limb_t *p, unsigned long 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_LIMB_BITS; /* word index of low bit to extract */
+ bi %= GMP_LIMB_BITS; /* bit index in low word */
+ r = p[i] >> bi; /* extract (low) bits */
+ nbits_in_r = GMP_LIMB_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);
+ }
+}
+
+#undef HAVE_NATIVE_mpn_addmul_2
+
+#ifndef HAVE_NATIVE_mpn_addmul_2
+#define REDC_2_THRESHOLD MP_SIZE_T_MAX
+#endif
+
+#ifndef REDC_2_THRESHOLD
+#define REDC_2_THRESHOLD 4
+#endif
+
+static void mpn_redc_n () {ASSERT_ALWAYS(0);}
+
+static inline int
+win_size (unsigned long eb)
+{
+ int k;
+ static unsigned long x[] = {1,4,27,100,325,1026,2905,7848,20457,51670,~0ul};
+ for (k = 0; eb > x[k]; k++)
+ ;
+ return k;
+}
+
+#define MPN_REDC_X(rp, tp, mp, n, mip) \
+ do { \
+ if (redc_x == 1) \
+ mpn_redc_1 (rp, tp, mp, n, mip[0]); \
+ else if (redc_x == 2) \
+ mpn_redc_2 (rp, tp, mp, n, mip); \
+ else \
+ mpn_redc_n (rp, tp, mp, n, mip); \
+ } while (0)
+
+ /* Convert U to REDC form, U_r = B^n * U mod M */
+static void
+redcify (mp_ptr rp, mp_srcptr up, mp_size_t un, mp_srcptr mp, mp_size_t n)
+{
+ mp_ptr tp, qp;
+ TMP_DECL;
+ TMP_MARK;
+
+ tp = TMP_ALLOC_LIMBS (un + n);
+ qp = TMP_ALLOC_LIMBS (un + 1); /* FIXME: Put at tp+? */
+
+ MPN_ZERO (tp, n);
+ MPN_COPY (tp + n, up, un);
+ mpn_tdiv_qr (qp, rp, 0L, tp, un + n, mp, n);
+ TMP_FREE;
+}
+
+/* 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] is > 1.
+ Uses scratch space tp[3n..0], i.e., 3n+1 words. */
+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 mip[2];
+ int cnt;
+ long ebi;
+ int windowsize, this_windowsize;
+ mp_limb_t expbits;
+ mp_ptr pp, this_pp, last_pp;
+ long i;
+ int redc_x;
+ TMP_DECL;
+
+ ASSERT (en > 1 || (en == 1 && ep[0] > 1));
+ ASSERT (n >= 1 && ((mp[0] & 1) != 0));
+
+ TMP_MARK;
+
+ count_leading_zeros (cnt, ep[en - 1]);
+ ebi = en * GMP_LIMB_BITS - cnt;
+
+ windowsize = win_size (ebi);
+
+ if (BELOW_THRESHOLD (n, REDC_2_THRESHOLD))
+ {
+ binvert_limb (mip[0], mp[0]);
+ mip[0] = -mip[0];
+ redc_x = 1;
+ }
+#if defined (HAVE_NATIVE_mpn_addmul_2)
+ else
+ {
+ mpn_binvert (mip, mp, 2, tp);
+ mip[0] = -mip[0]; mip[1] = ~mip[1];
+ redc_x = 2;
+ }
+#endif
+#if 0
+ mpn_binvert (mip, mp, n, tp);
+ redc_x = 0;
+#endif
+
+ pp = TMP_ALLOC_LIMBS (n << windowsize);
+
+ this_pp = pp;
+ this_pp[n] = 1;
+ redcify (this_pp, this_pp + n, 1, mp, n);
+ this_pp += n;
+ redcify (this_pp, bp, bn, mp, n);
+
+ /* Precompute powers of b and put them in the temporary area at pp. */
+ for (i = (1 << windowsize) - 2; i > 0; i--)
+ {
+ last_pp = this_pp;
+ this_pp += n;
+ mpn_mul_n (tp, last_pp, pp + n, n);
+ MPN_REDC_X (this_pp, tp, mp, n, mip);
+ }
+
+ expbits = getbits (ep, ebi, windowsize);
+ ebi -= windowsize;
+ if (ebi < 0)
+ ebi = 0;
+
+ MPN_COPY (rp, pp + n * expbits, n);
+
+ while (ebi != 0)
+ {
+ expbits = getbits (ep, ebi, windowsize);
+ ebi -= windowsize;
+ this_windowsize = windowsize;
+ if (ebi < 0)
+ {
+ this_windowsize += ebi;
+ ebi = 0;
+ }
+
+ do
+ {
+ mpn_sqr_n (tp, rp, n);
+ MPN_REDC_X (rp, tp, mp, n, mip);
+ this_windowsize--;
+ }
+ while (this_windowsize != 0);
+
+#if WANT_CACHE_SECURITY
+ mpn_tabselect (tp + 2*n, pp, n, 1 << windowsize, expbits);
+ mpn_mul_n (tp, rp, tp + 2*n, n);
+#else
+ mpn_mul_n (tp, rp, pp + n * expbits, n);
+#endif
+ MPN_REDC_X (rp, tp, mp, n, mip);
+ }
+
+ MPN_COPY (tp, rp, n);
+ MPN_ZERO (tp + n, n);
+ MPN_REDC_X (rp, tp, mp, n, mip);
+ if (mpn_cmp (rp, mp, n) >= 0)
+ mpn_sub_n (rp, rp, mp, n);
+ TMP_FREE;
+}
+
+#if ! HAVE_NATIVE_mpn_tabselect
+/* Select entry `which' from table `tab', which has nents entries, each `n'
+ limbs. Store the selected entry at rp. Reads entire table to avoid
+ sideband information leaks. O(n*nents). */
+
+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);
+ }
+ }
+}
+#endif
diff --git a/gmp/mpn/generic/pre_divrem_1.c b/gmp/mpn/generic/pre_divrem_1.c
index 8027f0216e..6badf63192 100644
--- a/gmp/mpn/generic/pre_divrem_1.c
+++ b/gmp/mpn/generic/pre_divrem_1.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2003 Free Software Foundation, Inc.
+Copyright 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -43,8 +32,8 @@ see https://www.gnu.org/licenses/. */
/* Same test here for skipping one divide step as in mpn_divrem_1.
The main reason for a separate shift==0 case is that not all CPUs give
- zero for "n0 >> GMP_LIMB_BITS" which would arise in the general case
- code used on shift==0. shift==0 is also reasonably common in mp_bases
+ zero for "n0 >> BITS_PER_MP_LIMB" which would arise in the general case
+ code used on shift==0. shift==0 is also reasonably common in __mp_bases
big_base, for instance base==10 on a 64-bit limb.
Under shift!=0 it would be possible to call mpn_lshift to adjust the
@@ -117,14 +106,14 @@ mpn_preinv_divrem_1 (mp_ptr qp, mp_size_t xsize,
}
n1 = ap[size-1];
- r |= n1 >> (GMP_LIMB_BITS - shift);
+ r |= n1 >> (BITS_PER_MP_LIMB - shift);
for (i = size-2; i >= 0; i--)
{
ASSERT (r < d);
n0 = ap[i];
udiv_qrnnd_preinv (*qp, r, r,
- ((n1 << shift) | (n0 >> (GMP_LIMB_BITS - shift))),
+ ((n1 << shift) | (n0 >> (BITS_PER_MP_LIMB - shift))),
d, dinv);
qp--;
n1 = n0;
diff --git a/gmp/mpn/generic/pre_mod_1.c b/gmp/mpn/generic/pre_mod_1.c
index cb38f4a48f..961733ba34 100644
--- a/gmp/mpn/generic/pre_mod_1.c
+++ b/gmp/mpn/generic/pre_mod_1.c
@@ -2,34 +2,23 @@
DINV should be 2^(2*GMP_LIMB_BITS) / D - 2^GMP_LIMB_BITS.
Return the single-limb remainder.
-Copyright 1991, 1993, 1994, 2000-2002, 2004, 2005 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have 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"
@@ -45,6 +34,7 @@ mpn_preinv_mod_1 (mp_srcptr up, mp_size_t un, mp_limb_t d, mp_limb_t dinv)
{
mp_size_t i;
mp_limb_t n0, r;
+ mp_limb_t dummy;
ASSERT (un >= 1);
ASSERT (d & GMP_LIMB_HIGHBIT);
@@ -56,7 +46,7 @@ mpn_preinv_mod_1 (mp_srcptr up, mp_size_t un, mp_limb_t d, mp_limb_t dinv)
for (i = un - 2; i >= 0; i--)
{
n0 = up[i];
- udiv_rnnd_preinv (r, r, n0, d, dinv);
+ udiv_qrnnd_preinv (dummy, r, r, n0, d, dinv);
}
return r;
}
diff --git a/gmp/mpn/generic/random.c b/gmp/mpn/generic/random.c
index 5489becf4d..c0b85ea075 100644
--- a/gmp/mpn/generic/random.c
+++ b/gmp/mpn/generic/random.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/random2.c b/gmp/mpn/generic/random2.c
index 980b15367f..e29238c514 100644
--- a/gmp/mpn/generic/random2.c
+++ b/gmp/mpn/generic/random2.c
@@ -1,38 +1,28 @@
/* mpn_random2 -- Generate random numbers with relatively long strings
of ones and zeroes. Suitable for border testing.
-Copyright 1992-1994, 1996, 2000-2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 1992, 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-static void gmp_rrandomb (mp_ptr, gmp_randstate_t, mp_bitcnt_t);
+static void gmp_rrandomb __GMP_PROTO ((mp_ptr, gmp_randstate_t, unsigned long int));
/* Ask _gmp_rand for 32 bits per call unless that's more than a limb can hold.
Thus, we get the same random number sequence in the common cases.
@@ -64,15 +54,15 @@ mpn_random2 (mp_ptr rp, mp_size_t n)
}
static void
-gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits)
+gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, unsigned long int nbits)
{
- mp_bitcnt_t bi;
+ unsigned long int bi;
mp_limb_t ranm; /* buffer for random bits */
unsigned cap_chunksize, chunksize;
mp_size_t i;
/* Set entire result to 111..1 */
- i = BITS_TO_LIMBS (nbits) - 1;
+ i = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS - 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;
diff --git a/gmp/mpn/generic/redc_1.c b/gmp/mpn/generic/redc_1.c
index 0d33421f63..47bee8220b 100644
--- a/gmp/mpn/generic/redc_1.c
+++ b/gmp/mpn/generic/redc_1.c
@@ -1,57 +1,43 @@
-/* mpn_redc_1. Set rp[] <- up[]/R^n mod mp[]. Clobber up[].
+/* mpn_redc_1. Set cp[] <- up[]/R^n mod mp[]. Clobber up[].
mp[] is n limbs; up[] is 2n limbs.
THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-Copyright (C) 2000-2002, 2004, 2008, 2009, 2012 Free Software Foundation, Inc.
+Copyright (C) 2000, 2001, 2002, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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
+void
mpn_redc_1 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm)
{
mp_size_t j;
mp_limb_t cy;
- ASSERT (n > 0);
ASSERT_MPN (up, 2*n);
for (j = n - 1; j >= 0; j--)
{
- cy = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK);
- ASSERT (up[0] == 0);
- up[0] = cy;
+ up[0] = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK);
up++;
}
-
cy = mpn_add_n (rp, up, up - n, n);
- return cy;
+ if (cy != 0)
+ mpn_sub_n (rp, rp, mp, n);
}
diff --git a/gmp/mpn/generic/redc_2.c b/gmp/mpn/generic/redc_2.c
index 07d90fa20d..0efbd9d4c7 100644
--- a/gmp/mpn/generic/redc_2.c
+++ b/gmp/mpn/generic/redc_2.c
@@ -1,36 +1,25 @@
-/* mpn_redc_2. Set rp[] <- up[]/R^n mod mp[]. Clobber up[].
+/* mpn_redc_2. Set cp[] <- up[]/R^n mod mp[]. Clobber up[].
mp[] is n limbs; up[] is 2n limbs.
THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-Copyright (C) 2000-2002, 2004, 2008, 2012 Free Software Foundation, Inc.
+Copyright (C) 2000, 2001, 2002, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -44,8 +33,7 @@ you lose
/* For testing purposes, define our own mpn_addmul_2 if there is none already
available. */
#ifndef HAVE_NATIVE_mpn_addmul_2
-#undef mpn_addmul_2
-static mp_limb_t
+mp_limb_t
mpn_addmul_2 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_srcptr vp)
{
rp[n] = mpn_addmul_1 (rp, up, n, vp[0]);
@@ -53,7 +41,7 @@ mpn_addmul_2 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_srcptr vp)
}
#endif
-#if defined (__GNUC__) && defined (__ia64) && W_TYPE_SIZE == 64
+#if defined (__ia64) && W_TYPE_SIZE == 64
#define umul2low(ph, pl, uh, ul, vh, vl) \
do { \
mp_limb_t _ph, _pl; \
@@ -78,7 +66,7 @@ mpn_addmul_2 (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_srcptr vp)
} while (0)
#endif
-mp_limb_t
+void
mpn_redc_2 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr mip)
{
mp_limb_t q[2];
@@ -86,7 +74,6 @@ mpn_redc_2 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr mip)
mp_limb_t upn;
mp_limb_t cy;
- ASSERT (n > 0);
ASSERT_MPN (up, 2*n);
if ((n & 1) != 0)
@@ -104,7 +91,7 @@ mpn_redc_2 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr mip)
up[n] = upn;
up += 2;
}
-
cy = mpn_add_n (rp, up, up - n, n);
- return cy;
+ if (cy != 0)
+ mpn_sub_n (rp, rp, mp, n);
}
diff --git a/gmp/mpn/generic/redc_n.c b/gmp/mpn/generic/redc_n.c
deleted file mode 100644
index c3d0cfe7fa..0000000000
--- a/gmp/mpn/generic/redc_n.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* mpn_redc_n. Set rp[] <- up[]/R^n mod mp[]. Clobber up[].
- mp[] is n limbs; up[] is 2n limbs, the inverse ip[] is n limbs.
-
- THIS IS AN INTERNAL FUNCTION WITH A MUTABLE INTERFACE. IT IS ONLY
- SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- TODO
-
- * We assume mpn_mulmod_bnm1 is always faster than plain mpn_mul_n (or a
- future mpn_mulhi) for the range we will be called. Follow up that
- assumption.
-
- * Decrease scratch usage.
-
- * Consider removing the residue canonicalisation.
-*/
-
-void
-mpn_redc_n (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_srcptr ip)
-{
- mp_ptr xp, yp, scratch;
- mp_limb_t cy;
- mp_size_t rn;
- TMP_DECL;
- TMP_MARK;
-
- ASSERT (n > 8);
-
- rn = mpn_mulmod_bnm1_next_size (n);
-
- scratch = TMP_ALLOC_LIMBS (n + rn + mpn_mulmod_bnm1_itch (rn, n, n));
-
- xp = scratch;
- mpn_mullo_n (xp, up, ip, n);
-
- yp = scratch + n;
- mpn_mulmod_bnm1 (yp, rn, xp, n, mp, n, scratch + n + rn);
-
- ASSERT_ALWAYS (2 * n > rn); /* could handle this */
-
- cy = mpn_sub_n (yp + rn, yp, up, 2*n - rn); /* undo wrap around */
- MPN_DECR_U (yp + 2*n - rn, rn, cy);
-
- cy = mpn_sub_n (rp, up + n, yp + n, n);
- if (cy != 0)
- mpn_add_n (rp, rp, mp, n);
-
- TMP_FREE;
-}
diff --git a/gmp/mpn/generic/remove.c b/gmp/mpn/generic/remove.c
deleted file mode 100644
index ef1a06ea14..0000000000
--- a/gmp/mpn/generic/remove.c
+++ /dev/null
@@ -1,172 +0,0 @@
-/* mpn_remove -- divide out all multiples of odd mpn number from another mpn
- number.
-
- Contributed to the GNU project by Torbjorn Granlund.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 GMP_LIMB_BITS > 50
-#define LOG 50
-#else
-#define LOG GMP_LIMB_BITS
-#endif
-
-
-/* Input: U = {up,un}, V = {vp,vn} must be odd, cap
- Ouput W = {wp,*wn} allocation need is exactly *wn
-
- Set W = U / V^k, where k is the largest integer <= cap such that the
- division yields an integer.
-
- 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 + 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
- indicates a flaw in the current itch mechanism: Which operands not greater
- than un,un will incur the worst itch? We need a parallel foo_maxitch set
- of functions. */
-static void
-mpn_bdiv_qr_wrap (mp_ptr qp, mp_ptr rp,
- mp_srcptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn)
-{
- mp_ptr scratch_out;
- TMP_DECL;
-
- TMP_MARK;
- scratch_out = TMP_ALLOC_LIMBS (mpn_bdiv_qr_itch (nn, dn));
- mpn_bdiv_qr (qp, rp, np, nn, dp, dn, scratch_out);
-
- TMP_FREE;
-}
-
-mp_bitcnt_t
-mpn_remove (mp_ptr wp, mp_size_t *wn,
- mp_ptr up, mp_size_t un, mp_ptr vp, mp_size_t vn,
- mp_bitcnt_t cap)
-{
- mp_ptr pwpsp[LOG];
- mp_size_t pwpsn[LOG];
- mp_size_t npowers;
- mp_ptr tp, qp, np, pp, qp2;
- mp_size_t pn, nn, qn, i;
- mp_bitcnt_t pwr;
- TMP_DECL;
-
- ASSERT (un > 0);
- ASSERT (vn > 0);
- ASSERT (vp[0] % 2 != 0); /* 2-adic division wants odd numbers */
- ASSERT (vn > 1 || vp[0] > 1); /* else we would loop indefinitely */
-
- TMP_MARK;
-
- 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 */
- pp = vp;
- pn = vn;
-
- MPN_COPY (qp, up, un);
- qn = un;
-
- npowers = 0;
- while (qn >= pn)
- {
- qp[qn] = 0;
- mpn_bdiv_qr_wrap (qp2, tp, qp, qn + 1, pp, pn);
- if (!mpn_zero_p (tp, pn))
- break; /* could not divide by V^npowers */
-
- MP_PTR_SWAP (qp, qp2);
- qn = qn - pn;
- qn += qp[qn] != 0;
-
- pwpsp[npowers] = pp;
- pwpsn[npowers] = pn;
- npowers++;
-
- if (((mp_bitcnt_t) 2 << npowers) - 1 > cap)
- break;
-
- nn = 2 * pn - 1; /* next power will be at least this large */
- 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);
- pn = nn + (np[nn] != 0);
- pp = np;
- }
-
- pwr = ((mp_bitcnt_t) 1 << npowers) - 1;
-
- for (i = npowers - 1; i >= 0; i--)
- {
- pn = pwpsn[i];
- if (qn < pn)
- continue;
-
- if (pwr + ((mp_bitcnt_t) 1 << i) > cap)
- continue; /* V^i would bring us past cap */
-
- qp[qn] = 0;
- mpn_bdiv_qr_wrap (qp2, tp, qp, qn + 1, pwpsp[i], pn);
- if (!mpn_zero_p (tp, pn))
- continue; /* could not divide by V^i */
-
- MP_PTR_SWAP (qp, qp2);
- qn = qn - pn;
- qn += qp[qn] != 0;
-
- pwr += (mp_bitcnt_t) 1 << i;
- }
-
- MPN_COPY (wp, qp, qn);
- *wn = qn;
-
- TMP_FREE;
-
- return pwr;
-}
diff --git a/gmp/mpn/generic/rootrem.c b/gmp/mpn/generic/rootrem.c
index 2edc74baa3..657e543ab3 100644
--- a/gmp/mpn/generic/rootrem.c
+++ b/gmp/mpn/generic/rootrem.c
@@ -8,37 +8,29 @@
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-2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* FIXME:
- This implementation is not optimal when remp == NULL, since the complexity
- is M(n), whereas it should be M(n/k) on average.
+ (a) Once there is a native mpn_tdiv_q function in GMP (division without
+ remainder), replace the quick-and-dirty implementation below by it.
+ (b) The implementation below is not optimal when remp == NULL, since the
+ complexity is M(n) where n is the input size, whereas it should be
+ only M(n/k) on average.
*/
#include <stdio.h> /* for NULL */
@@ -49,6 +41,8 @@ see https://www.gnu.org/licenses/. */
static mp_size_t mpn_rootrem_internal (mp_ptr, mp_ptr, mp_srcptr, mp_size_t,
mp_limb_t, int);
+static void mpn_tdiv_q (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t,
+ mp_srcptr, mp_size_t);
#define MPN_RSHIFT(cy,rp,up,un,cnt) \
do { \
@@ -90,15 +84,14 @@ mp_size_t
mpn_rootrem (mp_ptr rootp, mp_ptr remp,
mp_srcptr up, mp_size_t un, mp_limb_t k)
{
- mp_size_t m;
ASSERT (un > 0);
ASSERT (up[un - 1] != 0);
ASSERT (k > 1);
- m = (un - 1) / k; /* ceil(un/k) - 1 */
- if (remp == NULL && m > 2)
- /* Pad {up,un} with k zero limbs. This will produce an approximate root
- with one more limb, allowing us to compute the exact integral result. */
+ if ((remp == NULL) && (un / k > 2))
+ /* call mpn_rootrem recursively, padding {up,un} with k zero limbs,
+ which will produce an approximate root with one more limb,
+ so that in most cases we can conclude. */
{
mp_ptr sp, wp;
mp_size_t rn, sn, wn;
@@ -106,21 +99,21 @@ mpn_rootrem (mp_ptr rootp, mp_ptr remp,
TMP_MARK;
wn = un + k;
wp = TMP_ALLOC_LIMBS (wn); /* will contain the padded input */
- sn = m + 2; /* ceil(un/k) + 1 */
+ sn = (un - 1) / k + 2; /* ceil(un/k) + 1 */
sp = TMP_ALLOC_LIMBS (sn); /* approximate root of padded input */
MPN_COPY (wp + k, up, un);
MPN_ZERO (wp, k);
rn = mpn_rootrem_internal (sp, NULL, wp, wn, k, 1);
- /* The approximate root S = {sp,sn} is either the correct root of
- {sp,sn}, or 1 too large. Thus unless the least significant limb of
- S is 0 or 1, we can deduce the root of {up,un} is S truncated by one
- limb. (In case sp[0]=1, we can deduce the root, but not decide
+ /* the approximate root S = {sp,sn} is either the correct root of
+ {sp,sn}, or one too large. Thus unless the least significant limb
+ of S is 0 or 1, we can deduce the root of {up,un} is S truncated by
+ one limb. (In case sp[0]=1, we can deduce the root, but not decide
whether it is exact or not.) */
MPN_COPY (rootp, sp + 1, sn - 1);
TMP_FREE;
return rn;
}
- else
+ else /* remp <> NULL */
{
return mpn_rootrem_internal (rootp, remp, up, un, k, 0);
}
@@ -131,11 +124,12 @@ static mp_size_t
mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un,
mp_limb_t k, int approx)
{
- mp_ptr qp, rp, sp, wp, scratch;
+ mp_ptr qp, rp, sp, wp;
mp_size_t qn, rn, sn, wn, nl, bn;
mp_limb_t save, save2, cy;
unsigned long int unb; /* number of significant bits of {up,un} */
unsigned long int xnb; /* number of significant bits of the result */
+ unsigned int cnt;
unsigned long b, kk;
unsigned long sizes[GMP_NUMB_BITS + 1];
int ni, i;
@@ -145,19 +139,25 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un,
TMP_MARK;
+ /* qp and wp need enough space to store S'^k where S' is an approximate
+ root. Since S' can be as large as S+2, the worst case is when S=2 and
+ S'=4. But then since we know the number of bits of S in advance, S'
+ can only be 3 at most. Similarly for S=4, then S' can be 6 at most.
+ So the worst case is S'/S=3/2, thus S'^k <= (3/2)^k * S^k. Since S^k
+ fits in un limbs, the number of extra limbs needed is bounded by
+ ceil(k*log2(3/2)/GMP_NUMB_BITS). */
+#define EXTRA 2 + (mp_size_t) (0.585 * (double) k / (double) GMP_NUMB_BITS)
+ qp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain quotient and remainder
+ of R/(k*S^(k-1)), and S^k */
if (remp == NULL)
- {
- rp = TMP_ALLOC_LIMBS (un + 1); /* will contain the remainder */
- scratch = rp; /* used by mpn_div_q */
- }
+ rp = TMP_ALLOC_LIMBS (un); /* will contain the remainder */
else
- {
- scratch = TMP_ALLOC_LIMBS (un + 1); /* used by mpn_div_q */
- rp = remp;
- }
+ rp = remp;
sp = rootp;
-
- MPN_SIZEINBASE_2EXP(unb, up, un, 1);
+ wp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain S^(k-1), k*S^(k-1),
+ and temporary for mpn_pow_1 */
+ count_leading_zeros (cnt, up[un - 1]);
+ unb = un * GMP_NUMB_BITS - cnt + GMP_NAIL_BITS;
/* unb is the number of bits of the input U */
xnb = (unb - 1) / k + 1; /* ceil (unb / k) */
@@ -216,19 +216,6 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un,
Newton iteration will first compute sizes[ni-1] extra bits,
then sizes[ni-2], ..., then sizes[0] = b. */
- /* qp and wp need enough space to store S'^k where S' is an approximate
- root. Since S' can be as large as S+2, the worst case is when S=2 and
- S'=4. But then since we know the number of bits of S in advance, S'
- can only be 3 at most. Similarly for S=4, then S' can be 6 at most.
- So the worst case is S'/S=3/2, thus S'^k <= (3/2)^k * S^k. Since S^k
- fits in un limbs, the number of extra limbs needed is bounded by
- ceil(k*log2(3/2)/GMP_NUMB_BITS). */
-#define EXTRA 2 + (mp_size_t) (0.585 * (double) k / (double) GMP_NUMB_BITS)
- qp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain quotient and remainder
- of R/(k*S^(k-1)), and S^k */
- wp = TMP_ALLOC_LIMBS (un + EXTRA); /* will contain S^(k-1), k*S^(k-1),
- and temporary for mpn_pow_1 */
-
wp[0] = 1; /* {sp,sn}^(k-1) = 1 */
wn = 1;
for (i = ni; i != 0; i--)
@@ -304,8 +291,13 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un,
}
else
{
+ mp_ptr tp;
qn = rn - wn; /* expected quotient size */
- mpn_div_q (qp, rp, rn, wp, wn, scratch);
+ /* tp must have space for wn limbs.
+ The quotient needs rn-wn+1 limbs, thus quotient+remainder
+ need altogether rn+1 limbs. */
+ tp = qp + qn + 1; /* put remainder in Q buffer */
+ mpn_tdiv_q (qp, tp, 0, rp, rn, wp, wn);
qn += qp[qn] != 0;
}
@@ -400,7 +392,7 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un,
ASSERT_ALWAYS (rn >= qn);
/* R = R - Q = floor(U/2^kk) - S^k */
- if (i > 1 || approx == 0)
+ if ((i > 1) || (approx == 0))
{
mpn_sub (rp, rp, rn, qp, qn);
MPN_NORMALIZE (rp, rn);
@@ -413,3 +405,47 @@ mpn_rootrem_internal (mp_ptr rootp, mp_ptr remp, mp_srcptr up, mp_size_t un,
TMP_FREE;
return rn;
}
+
+/* return the quotient Q = {np, nn} divided by {dp, dn} only */
+static void
+mpn_tdiv_q (mp_ptr qp, mp_ptr rp, mp_size_t qxn, mp_srcptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn)
+{
+ mp_size_t qn = nn - dn; /* expected quotient size is qn+1 */
+ mp_size_t cut;
+
+ ASSERT_ALWAYS (qxn == 0);
+ if (dn <= qn + 3)
+ {
+ mpn_tdiv_qr (qp, rp, 0, np, nn, dp, dn);
+ }
+ else
+ {
+ mp_ptr tp;
+ TMP_DECL;
+ TMP_MARK;
+ tp = TMP_ALLOC_LIMBS (qn + 2);
+ cut = dn - (qn + 3);
+ /* perform a first division with divisor cut to dn-cut=qn+3 limbs
+ and dividend to nn-(cut-1) limbs, i.e. the quotient will be one
+ limb more than the final quotient.
+ The quotient will have qn+2 < dn-cut limbs,
+ and the remainder dn-cut = qn+3 limbs. */
+ mpn_tdiv_qr (tp, rp, 0, np + cut - 1, nn - cut + 1, dp + cut, dn - cut);
+ /* let Q' be the quotient of B * {np, nn} by {dp, dn} [qn+2 limbs]
+ and T be the approximation of Q' computed above, where
+ B = 2^GMP_NUMB_BITS.
+ We have Q' <= T <= Q'+1, and since floor(Q'/B) = Q, we have
+ Q = floor(T/B), unless the last limb of T only consists of zeroes. */
+ if (tp[0] != 0)
+ {
+ /* simply truncate one limb of T */
+ MPN_COPY (qp, tp + 1, qn + 1);
+ }
+ else /* too bad: perform the expensive division */
+ {
+ mpn_tdiv_qr (qp, rp, 0, np, nn, dp, dn);
+ }
+ TMP_FREE;
+ }
+}
diff --git a/gmp/mpn/generic/rshift.c b/gmp/mpn/generic/rshift.c
index ec61f2f7e2..62256656de 100644
--- a/gmp/mpn/generic/rshift.c
+++ b/gmp/mpn/generic/rshift.c
@@ -1,32 +1,22 @@
/* mpn_rshift -- Shift right low level.
-Copyright 1991, 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/sb_bdiv_q.c b/gmp/mpn/generic/sb_bdiv_q.c
new file mode 100644
index 0000000000..474c804d48
--- /dev/null
+++ b/gmp/mpn/generic/sb_bdiv_q.c
@@ -0,0 +1,91 @@
+/* mpn_sb_bdiv_q -- schoolbook Hensel division with precomputed inverse,
+ returning quotient only.
+
+ 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
+ ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
+
+Copyright 2005, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+
+/* Computes Q = N / D mod B^nn, destroys N.
+ Clobbers N.
+
+ D must be odd. dinv is (-D)^-1 mod B.
+
+
+ The straightforward way to compute Q is to cancel one limb at a time, using
+
+ qp[i] = D^{-1} * np[i] (mod B)
+ N -= B^i * qp[i] * D
+
+ But we prefer addition to subtraction, since mpn_addmul_1 is often faster
+ than mpn_submul_1. Q = - N / D can be computed by iterating
+
+ qp[i] = (-D)^{-1} * np[i] (mod B)
+ N += B^i * qp[i] * D
+
+ And then we flip the sign, -Q = (not Q) + 1.
+*/
+
+void
+mpn_sb_bdiv_q (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_limb_t dinv)
+{
+ mp_size_t i;
+ mp_limb_t qh;
+
+ ASSERT (nn > 0);
+ ASSERT (dn > 0);
+ ASSERT (nn >= dn);
+ ASSERT (dp[0] & 1);
+
+ for (i = 0; i < nn - dn; i++)
+ {
+ mp_limb_t cy;
+ mp_limb_t q;
+
+ q = dinv * np[i];
+ qp[i] = ~q;
+ cy = mpn_addmul_1 (np + i, dp, dn, q);
+ mpn_add_1 (np + i + dn, np + i + dn, nn - i - dn, cy);
+ ASSERT (np[i] == 0);
+ }
+
+ for (; i < nn - 1; i++)
+ {
+ mp_limb_t q;
+
+ q = dinv * np[i];
+ qp[i] = ~q;
+ mpn_addmul_1 (np + i, dp, nn - i, q);
+
+ ASSERT (np[i] == 0);
+ }
+
+ /* Final limb */
+ qp[nn - 1] = ~(dinv * np[nn - 1]);
+ qh = mpn_add_1 (qp, qp, nn, 1); /* FIXME: can we get carry? */
+}
diff --git a/gmp/mpn/generic/sbpi1_bdiv_qr.c b/gmp/mpn/generic/sb_bdiv_qr.c
index 0e56f58148..d1cd0dee32 100644
--- a/gmp/mpn/generic/sbpi1_bdiv_qr.c
+++ b/gmp/mpn/generic/sb_bdiv_qr.c
@@ -1,39 +1,27 @@
-/* mpn_sbpi1_bdiv_qr -- schoolbook Hensel division with precomputed inverse,
+/* mpn_sb_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
- ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
+ IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.
-Copyright 2006, 2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -52,20 +40,19 @@ see https://www.gnu.org/licenses/. */
D must be odd. dinv is (-D)^-1 mod B. */
mp_limb_t
-mpn_sbpi1_bdiv_qr (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn, mp_limb_t dinv)
+mpn_sb_bdiv_qr (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn, mp_limb_t dinv)
{
mp_size_t qn;
mp_size_t i;
mp_limb_t rh;
mp_limb_t ql;
+ ASSERT (nn > 0);
ASSERT (dn > 0);
ASSERT (nn > dn);
- ASSERT ((dp[0] & 1) != 0);
- /* FIXME: Add ASSERTs for allowable overlapping; i.e., that qp = np is OK,
- but some over N/Q overlaps will not work. */
+ ASSERT (dp[0] & 1);
qn = nn - dn;
@@ -80,8 +67,9 @@ mpn_sbpi1_bdiv_qr (mp_ptr qp,
mp_limb_t q;
q = dinv * np[i];
- np[i] = mpn_addmul_1 (np + i, dp, dn, q);
qp[i] = ~q;
+
+ np[i] = mpn_addmul_1 (np + i, dp, dn, q);
}
rh += mpn_add (np + dn, np + dn, qn, np, dn);
ql = mpn_add_1 (qp, qp, dn, ql);
@@ -95,8 +83,9 @@ mpn_sbpi1_bdiv_qr (mp_ptr qp,
mp_limb_t q;
q = dinv * np[i];
- np[i] = mpn_addmul_1 (np + i, dp, dn, q);
qp[i] = ~q;
+
+ np[i] = mpn_addmul_1 (np + i, dp, dn, q);
}
rh += mpn_add_n (np + dn, np + dn, np, qn);
diff --git a/gmp/mpn/generic/sb_div_q.c b/gmp/mpn/generic/sb_div_q.c
new file mode 100644
index 0000000000..609c4ae7f2
--- /dev/null
+++ b/gmp/mpn/generic/sb_div_q.c
@@ -0,0 +1,240 @@
+/* mpn_sb_div_q -- schoolbook division with 2-limb sloppy non-greater
+ precomputed inverse, returning an accurate quotient.
+
+ Contributed to the GNU project by Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
+
+Copyright 2006, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+/*
+ CAVEATS:
+ 1. Should it demand normalized operands like now, or normalize on-the-fly?
+ 2. Overwrites {np,nn}.
+ 3. Uses mpn_submul_1. It would be nice to somehow make it use mpn_addmul_1
+ instead. (That would open for mpn_addmul_2 straightforwardly.)
+*/
+
+mp_limb_t
+mpn_sb_div_q (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_srcptr dip)
+{
+ mp_limb_t q, q10, q01a, q00a, q01b, q00b;
+ mp_limb_t cy;
+ mp_size_t i;
+ mp_limb_t qh;
+ mp_limb_t di1, di0;
+ mp_size_t qn;
+
+ mp_size_t dn_orig = dn;
+ mp_srcptr dp_orig = dp;
+ mp_ptr np_orig = np;
+
+ ASSERT (dn > 0);
+ ASSERT (nn >= dn);
+ ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0);
+ ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np);
+ ASSERT_MPN (np, nn);
+ ASSERT_MPN (dp, dn);
+
+ np += nn;
+ qn = nn - dn;
+ if (qn + 1 < dn)
+ {
+ dp += dn - (qn + 1);
+ dn = qn + 1;
+ }
+
+ qh = mpn_cmp (np - dn, dp, dn) >= 0;
+ if (qh != 0)
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+
+ qp += qn;
+ di1 = dip[1]; di0 = dip[0];
+ for (i = qn; i >= dn; i--)
+ {
+ np--;
+ umul_ppmm (q, q10, np[0], di1);
+ umul_ppmm (q01a, q00a, np[-1], di1);
+ add_ssaaaa (q, q10, q, q10, np[0], q01a);
+ umul_ppmm (q01b, q00b, np[0], di0);
+ add_ssaaaa (q, q10, q, q10, 0, q01b);
+ add_ssaaaa (q, q10, q, q10, 0, np[-1]);
+
+ cy = mpn_submul_1 (np - dn, dp, dn, q);
+
+ if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0))
+ {
+ q = q + 1;
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+ }
+
+ *--qp = q;
+ }
+
+ for (i = dn - 1; i > 0; i--)
+ {
+ np--;
+ umul_ppmm (q, q10, np[0], di1);
+ umul_ppmm (q01a, q00a, np[-1], di1);
+ add_ssaaaa (q, q10, q, q10, np[0], q01a);
+ umul_ppmm (q01b, q00b, np[0], di0);
+ add_ssaaaa (q, q10, q, q10, 0, q01b);
+ add_ssaaaa (q, q10, q, q10, 0, np[-1]);
+
+ cy = mpn_submul_1 (np - dn, dp, dn, q);
+
+ if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0))
+ {
+ q = q + 1;
+ if (q == 0)
+ q = GMP_NUMB_MAX;
+ else
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+ }
+
+ *--qp = q;
+
+ /* Truncate operands. */
+ dn--;
+ dp++;
+
+ /* The partial remainder might be equal to the truncated divisor,
+ thus non-canonical. When that happens, the rest of the quotient
+ should be all ones. */
+ if (UNLIKELY (mpn_cmp (np - dn, dp, dn) == 0))
+ {
+ while (--i)
+ *--qp = GMP_NUMB_MAX;
+ break;
+ }
+ }
+
+ dn = dn_orig;
+ if (UNLIKELY (np[-1] < dn))
+ {
+ mp_limb_t q, x;
+
+ /* The quotient may be too large if the remainder is small. Recompute
+ for above ignored operand parts, until the remainder spills.
+
+ FIXME: The quality of this code isn't the same as the code above.
+ 1. We don't compute things in an optimal order, high-to-low, in order
+ to terminate as quickly as possible.
+ 2. We mess with pointers and sizes, adding and subtracting and
+ adjusting to get things right. It surely could be streamlined.
+ 3. The only termination criteria are that we determine that the
+ quotient needs to be adjusted, or that we have recomputed
+ everything. We should stop when the remainder is so large
+ that no additional subtracting could make it spill.
+ 4. If nothing else, we should not do two loops of submul_1 over the
+ data, instead handle both the triangularization and chopping at
+ once. */
+
+ x = np[-1];
+
+ if (dn > 2)
+ {
+ /* Compensate for triangularization. */
+ mp_limb_t y;
+
+ dp = dp_orig;
+ if (qn + 1 < dn)
+ {
+ dp += dn - (qn + 1);
+ dn = qn + 1;
+ }
+
+ y = np[-2];
+
+ for (i = dn - 3; i >= 0; i--)
+ {
+ q = qp[i];
+ cy = mpn_submul_1 (np - (dn - i), dp, dn - i - 2, q);
+
+ if (y < cy)
+ {
+ if (x == 0)
+ {
+ cy = mpn_sub_1 (qp, qp, qn, 1);
+ ASSERT_ALWAYS (cy == 0);
+ return qh - cy;
+ }
+ x--;
+ }
+ y -= cy;
+ }
+ np[-2] = y;
+ }
+
+ dn = dn_orig;
+ if (qn + 1 < dn)
+ {
+ /* Compensate for ignored dividend and divisor tails. */
+
+ if (qn == 0)
+ return qh;
+
+ dp = dp_orig;
+ np = np_orig;
+
+ if (qh != 0)
+ {
+ cy = mpn_sub_n (np + qn, np + qn, dp, dn - (qn + 1));
+ if (cy != 0)
+ {
+ if (x == 0)
+ {
+ cy = mpn_sub_1 (qp, qp, qn, 1);
+ return qh - cy;
+ }
+ x--;
+ }
+ }
+
+ for (i = dn - qn - 2; i >= 0; i--)
+ {
+ cy = mpn_submul_1 (np + i, qp, qn, dp[i]);
+ cy = mpn_sub_1 (np + qn + i, np + qn + i, dn - qn - i - 1, cy);
+ if (cy != 0)
+ {
+ if (x == 0)
+ {
+ cy = mpn_sub_1 (qp, qp, qn, 1);
+ ASSERT_ALWAYS (cy == 0);
+ return qh - cy;
+ }
+ x--;
+ }
+ }
+ }
+ }
+
+ return qh;
+}
diff --git a/gmp/mpn/generic/sb_div_qr.c b/gmp/mpn/generic/sb_div_qr.c
new file mode 100644
index 0000000000..40e4442e21
--- /dev/null
+++ b/gmp/mpn/generic/sb_div_qr.c
@@ -0,0 +1,91 @@
+/* mpn_sb_div_qr -- schoolbook division with 2-limb sloppy non-greater
+ precomputed inverse, returning quotient and remainder.
+
+ Contributed to the GNU project by Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
+
+Copyright 2006, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+/*
+ CAVEATS:
+ 1. Should it demand normalized operands like now, or normalize on-the-fly?
+ 2. Overwrites {np,nn} instead of writing remainder to a designated area.
+ 3. Uses mpn_submul_1. It would be nice to somehow make it use mpn_addmul_1
+ instead. (That would open for mpn_addmul_2 straightforwardly.)
+*/
+
+mp_limb_t
+mpn_sb_div_qr (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_srcptr dip)
+{
+ mp_limb_t q, q10, q01a, q00a, q01b, q00b;
+ mp_limb_t cy;
+ mp_size_t i;
+ mp_limb_t qh;
+ mp_limb_t di1, di0;
+
+ ASSERT (dn > 0);
+ ASSERT (nn >= dn);
+ ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0);
+ ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np);
+ ASSERT_MPN (np, nn);
+ ASSERT_MPN (dp, dn);
+
+ np += nn;
+
+ qh = mpn_cmp (np - dn, dp, dn) >= 0;
+ if (qh != 0)
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+
+ qp += nn - dn;
+ di1 = dip[1]; di0 = dip[0];
+ for (i = nn - dn; i > 0; i--)
+ {
+ np--;
+ umul_ppmm (q, q10, np[0], di1);
+ umul_ppmm (q01a, q00a, np[-1], di1);
+ add_ssaaaa (q, q10, q, q10, np[0], q01a);
+ umul_ppmm (q01b, q00b, np[0], di0);
+ add_ssaaaa (q, q10, q, q10, 0, q01b);
+ add_ssaaaa (q, q10, q, q10, 0, np[-1]);
+
+ cy = mpn_submul_1 (np - dn, dp, dn, q);
+
+ if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0))
+ {
+ q = q + 1;
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+ }
+
+ *--qp = q;
+ }
+
+ return qh;
+}
diff --git a/gmp/mpn/generic/sb_divappr_q.c b/gmp/mpn/generic/sb_divappr_q.c
new file mode 100644
index 0000000000..42a39be009
--- /dev/null
+++ b/gmp/mpn/generic/sb_divappr_q.c
@@ -0,0 +1,136 @@
+/* mpn_sb_divappr_q -- schoolbook division with 2-limb sloppy non-greater
+ precomputed inverse, returning approximate quotient.
+
+ Contributed to the GNU project by Torbjörn Granlund.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL WITH A MUTABLE INTERFACE. IT IS
+ ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS
+ ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE GMP
+ RELEASE.
+
+Copyright 2006, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+/*
+ CAVEATS:
+ 1. Should it demand normalized operands like now, or normalize on-the-fly?
+ 2. Overwrites {np,nn}.
+ 3. Uses mpn_submul_1. It would be nice to somehow make it use mpn_addmul_1
+ instead. (That would open for mpn_addmul_2 straightforwardly.)
+*/
+
+mp_limb_t
+mpn_sb_divappr_q (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn,
+ mp_srcptr dip)
+{
+ mp_limb_t q, q10, q01a, q00a, q01b, q00b;
+ mp_limb_t cy;
+ mp_size_t i;
+ mp_limb_t qh;
+ mp_limb_t di1, di0;
+ mp_size_t qn;
+
+ ASSERT (dn > 0);
+ ASSERT (nn >= dn);
+ ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0);
+ ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np);
+ ASSERT_MPN (np, nn);
+ ASSERT_MPN (dp, dn);
+
+ np += nn;
+ qn = nn - dn;
+ if (qn + 1 < dn)
+ {
+ dp += dn - (qn + 1);
+ dn = qn + 1;
+ }
+
+ qh = mpn_cmp (np - dn, dp, dn) >= 0;
+ if (qh != 0)
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+
+ qp += qn;
+ di1 = dip[1]; di0 = dip[0];
+ for (i = qn; i >= dn; i--)
+ {
+ np--;
+ umul_ppmm (q, q10, np[0], di1);
+ umul_ppmm (q01a, q00a, np[-1], di1);
+ add_ssaaaa (q, q10, q, q10, np[0], q01a);
+ umul_ppmm (q01b, q00b, np[0], di0);
+ add_ssaaaa (q, q10, q, q10, 0, q01b);
+ add_ssaaaa (q, q10, q, q10, 0, np[-1]);
+
+ cy = mpn_submul_1 (np - dn, dp, dn, q);
+
+ if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0))
+ {
+ q = q + 1;
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+ }
+
+ *--qp = q;
+ }
+
+ for (i = dn - 1; i > 0; i--)
+ {
+ np--;
+ umul_ppmm (q, q10, np[0], di1);
+ umul_ppmm (q01a, q00a, np[-1], di1);
+ add_ssaaaa (q, q10, q, q10, np[0], q01a);
+ umul_ppmm (q01b, q00b, np[0], di0);
+ add_ssaaaa (q, q10, q, q10, 0, q01b);
+ add_ssaaaa (q, q10, q, q10, 0, np[-1]);
+
+ cy = mpn_submul_1 (np - dn, dp, dn, q);
+
+ if (UNLIKELY (np[0] > cy || mpn_cmp (np - dn, dp, dn) >= 0))
+ {
+ q = q + 1;
+ if (q == 0)
+ q = GMP_NUMB_MAX;
+ else
+ mpn_sub_n (np - dn, np - dn, dp, dn);
+ }
+
+ *--qp = q;
+
+ /* Truncate operands. */
+ dn--;
+ dp++;
+
+ /* The partial remainder might be equal to the truncated divisor,
+ thus non-canonical. When that happens, the rest of the quotient
+ should be all ones. */
+ if (UNLIKELY (mpn_cmp (np - dn, dp, dn) == 0))
+ {
+ while (--i)
+ *--qp = GMP_NUMB_MAX;
+ break;
+ }
+ }
+
+ return qh;
+}
diff --git a/gmp/mpn/generic/sb_divrem_mn.c b/gmp/mpn/generic/sb_divrem_mn.c
new file mode 100644
index 0000000000..06e2f4ca0d
--- /dev/null
+++ b/gmp/mpn/generic/sb_divrem_mn.c
@@ -0,0 +1,205 @@
+/* mpn_sb_divrem_mn -- Divide natural numbers, producing both remainder and
+ quotient.
+
+ THE FUNCTIONS IN THIS FILE ARE INTERNAL FUNCTIONS WITH MUTABLE
+ INTERFACES. IT IS ONLY SAFE TO REACH THEM THROUGH DOCUMENTED INTERFACES.
+ IN FACT, IT IS ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A
+ FUTURE GNU MP RELEASE.
+
+
+Copyright 1993, 1994, 1995, 1996, 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/. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "longlong.h"
+
+
+/* The size where udiv_qrnnd_preinv should be used rather than udiv_qrnnd,
+ meaning the quotient size where that should happen, the quotient size
+ being how many udiv divisions will be done.
+
+ The default is to use preinv always, CPUs where this doesn't suit have
+ tuned thresholds. Note in particular that preinv should certainly be
+ used if that's the only division available (USE_PREINV_ALWAYS). */
+
+#ifndef DIV_SB_PREINV_THRESHOLD
+#define DIV_SB_PREINV_THRESHOLD 0
+#endif
+
+
+/* Divide num (NP/NSIZE) by den (DP/DSIZE) and write
+ the NSIZE-DSIZE least significant quotient limbs at QP
+ and the DSIZE long remainder at NP.
+ Return the most significant limb of the quotient, this is always 0 or 1.
+
+ Preconditions:
+ 0. NSIZE >= DSIZE.
+ 1. The most significant bit of the divisor must be set.
+ 2. QP must either not overlap with the input operands at all, or
+ QP + DSIZE >= NP must hold true. (This means that it's
+ possible to put the quotient in the high part of NUM, right after the
+ remainder in NUM.
+ 3. NSIZE >= DSIZE.
+ 4. DSIZE > 2. */
+
+
+mp_limb_t
+mpn_sb_divrem_mn (mp_ptr qp,
+ mp_ptr np, mp_size_t nn,
+ mp_srcptr dp, mp_size_t dn)
+{
+ mp_limb_t most_significant_q_limb = 0;
+ mp_size_t qn = nn - dn;
+ mp_size_t i;
+ mp_limb_t dx, d1, n0;
+ mp_limb_t dxinv;
+ int use_preinv;
+
+ ASSERT (dn > 2);
+ ASSERT (nn >= dn);
+ ASSERT (dp[dn-1] & GMP_NUMB_HIGHBIT);
+ ASSERT (! MPN_OVERLAP_P (np, nn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, dp, dn));
+ ASSERT (! MPN_OVERLAP_P (qp, nn-dn, np, nn) || qp+dn >= np);
+ ASSERT_MPN (np, nn);
+ ASSERT_MPN (dp, dn);
+
+ np += qn;
+ dx = dp[dn - 1];
+ d1 = dp[dn - 2];
+ n0 = np[dn - 1];
+
+ if (n0 >= dx)
+ {
+ if (n0 > dx || mpn_cmp (np, dp, dn - 1) >= 0)
+ {
+ mpn_sub_n (np, np, dp, dn);
+ most_significant_q_limb = 1;
+ }
+ }
+
+ use_preinv = ABOVE_THRESHOLD (qn, DIV_SB_PREINV_THRESHOLD);
+ if (use_preinv)
+ invert_limb (dxinv, dx);
+
+ for (i = qn - 1; i >= 0; i--)
+ {
+ mp_limb_t q;
+ mp_limb_t nx;
+ mp_limb_t cy_limb;
+
+ nx = np[dn - 1]; /* FIXME: could get value from r1 */
+ np--;
+
+ if (nx == dx)
+ {
+ /* This might over-estimate q, but it's probably not worth
+ the extra code here to find out. */
+ q = GMP_NUMB_MASK;
+
+#if 1
+ cy_limb = mpn_submul_1 (np, dp, dn, q);
+#else
+ /* This should be faster on many machines */
+ cy_limb = mpn_sub_n (np + 1, np + 1, dp, dn);
+ cy = mpn_add_n (np, np, dp, dn);
+ np[dn] += cy;
+#endif
+
+ if (nx != cy_limb)
+ {
+ mpn_add_n (np, np, dp, dn);
+ q--;
+ }
+
+ qp[i] = q;
+ }
+ else
+ {
+ mp_limb_t rx, r1, r0, p1, p0;
+
+ /* "workaround" avoids a problem with gcc 2.7.2.3 i386 register usage
+ when np[dn-1] is used in an asm statement like umul_ppmm in
+ udiv_qrnnd_preinv. The symptom is seg faults due to registers
+ being clobbered. gcc 2.95 i386 doesn't have the problem. */
+ {
+ mp_limb_t workaround = np[dn - 1];
+ if (CACHED_ABOVE_THRESHOLD (use_preinv, DIV_SB_PREINV_THRESHOLD))
+ udiv_qrnnd_preinv (q, r1, nx, workaround, dx, dxinv);
+ else
+ {
+ udiv_qrnnd (q, r1, nx, workaround << GMP_NAIL_BITS,
+ dx << GMP_NAIL_BITS);
+ r1 >>= GMP_NAIL_BITS;
+ }
+ }
+ umul_ppmm (p1, p0, d1, q << GMP_NAIL_BITS);
+ p0 >>= GMP_NAIL_BITS;
+
+ r0 = np[dn - 2];
+ rx = 0;
+ if (r1 < p1 || (r1 == p1 && r0 < p0))
+ {
+ p1 -= p0 < d1;
+ p0 = (p0 - d1) & GMP_NUMB_MASK;
+ q--;
+ r1 = (r1 + dx) & GMP_NUMB_MASK;
+ rx = r1 < dx;
+ }
+
+ p1 += r0 < p0; /* cannot carry! */
+ rx -= r1 < p1; /* may become 11..1 if q is still too large */
+ r1 = (r1 - p1) & GMP_NUMB_MASK;
+ r0 = (r0 - p0) & GMP_NUMB_MASK;
+
+ cy_limb = mpn_submul_1 (np, dp, dn - 2, q);
+
+ /* Check if we've over-estimated q, and adjust as needed. */
+ {
+ mp_limb_t cy1, cy2;
+ cy1 = r0 < cy_limb;
+ r0 = (r0 - cy_limb) & GMP_NUMB_MASK;
+ cy2 = r1 < cy1;
+ r1 -= cy1;
+ np[dn - 1] = r1;
+ np[dn - 2] = r0;
+ if (cy2 != rx)
+ {
+ mpn_add_n (np, np, dp, dn);
+ q--;
+ }
+ }
+ qp[i] = q;
+ }
+ }
+
+ /* ______ ______ ______
+ |__rx__|__r1__|__r0__| partial remainder
+ ______ ______
+ - |__p1__|__p0__| partial product to subtract
+ ______ ______
+ - |______|cylimb|
+
+ rx is -1, 0 or 1. If rx=1, then q is correct (it should match
+ carry out). If rx=-1 then q is too large. If rx=0, then q might
+ be too large, but it is most likely correct.
+ */
+
+ return most_significant_q_limb;
+}
diff --git a/gmp/mpn/generic/sbpi1_bdiv_q.c b/gmp/mpn/generic/sbpi1_bdiv_q.c
deleted file mode 100644
index 645b1d9b6a..0000000000
--- a/gmp/mpn/generic/sbpi1_bdiv_q.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* mpn_sbpi1_bdiv_q -- schoolbook Hensel division with precomputed inverse,
- returning quotient only.
-
- 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
- ALMOST GUARANTEED THAT THEY'LL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-/* Computes Q = N / D mod B^nn, destroys N.
-
- D must be odd. dinv is (-D)^-1 mod B.
-
-
- The straightforward way to compute Q is to cancel one limb at a time, using
-
- qp[i] = D^{-1} * np[i] (mod B)
- N -= B^i * qp[i] * D
-
- But we prefer addition to subtraction, since mpn_addmul_1 is often faster
- than mpn_submul_1. Q = - N / D can be computed by iterating
-
- qp[i] = (-D)^{-1} * np[i] (mod B)
- N += B^i * qp[i] * D
-
- And then we flip the sign, -Q = (not Q) + 1. */
-
-void
-mpn_sbpi1_bdiv_q (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_limb_t dinv)
-{
- mp_size_t i;
- mp_limb_t cy, q;
-
- ASSERT (dn > 0);
- ASSERT (nn >= dn);
- ASSERT ((dp[0] & 1) != 0);
- /* FIXME: Add ASSERTs for allowable overlapping; i.e., that qp = np is OK,
- but some over N/Q overlaps will not work. */
-
- for (i = nn - dn; i > 0; i--)
- {
- q = dinv * np[0];
- cy = mpn_addmul_1 (np, dp, dn, q);
- mpn_add_1 (np + dn, np + dn, i, cy);
- ASSERT (np[0] == 0);
- qp[0] = ~q;
- qp++;
- np++;
- }
-
- for (i = dn; i > 1; i--)
- {
- q = dinv * np[0];
- mpn_addmul_1 (np, dp, i, q);
- ASSERT (np[0] == 0);
- qp[0] = ~q;
- qp++;
- np++;
- }
-
- /* Final limb */
- q = dinv * np[0];
- qp[0] = ~q;
- mpn_add_1 (qp - nn + 1, qp - nn + 1, nn, 1);
-}
diff --git a/gmp/mpn/generic/sbpi1_div_q.c b/gmp/mpn/generic/sbpi1_div_q.c
deleted file mode 100644
index 3abbd57933..0000000000
--- a/gmp/mpn/generic/sbpi1_div_q.c
+++ /dev/null
@@ -1,303 +0,0 @@
-/* mpn_sbpi1_div_q -- Schoolbook division using the Möller-Granlund 3/2
- division algorithm.
-
- Contributed to the GNU project by Torbjorn Granlund.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-mp_limb_t
-mpn_sbpi1_div_q (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_limb_t dinv)
-{
- mp_limb_t qh;
- mp_size_t qn, i;
- mp_limb_t n1, n0;
- mp_limb_t d1, d0;
- mp_limb_t cy, cy1;
- mp_limb_t q;
- mp_limb_t flag;
-
- mp_size_t dn_orig = dn;
- mp_srcptr dp_orig = dp;
- mp_ptr np_orig = np;
-
- ASSERT (dn > 2);
- ASSERT (nn >= dn);
- ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0);
-
- np += nn;
-
- qn = nn - dn;
- if (qn + 1 < dn)
- {
- dp += dn - (qn + 1);
- dn = qn + 1;
- }
-
- qh = mpn_cmp (np - dn, dp, dn) >= 0;
- if (qh != 0)
- mpn_sub_n (np - dn, np - dn, dp, dn);
-
- qp += qn;
-
- dn -= 2; /* offset dn by 2 for main division loops,
- saving two iterations in mpn_submul_1. */
- d1 = dp[dn + 1];
- d0 = dp[dn + 0];
-
- np -= 2;
-
- n1 = np[1];
-
- for (i = qn - (dn + 2); i >= 0; i--)
- {
- np--;
- if (UNLIKELY (n1 == d1) && np[1] == d0)
- {
- q = GMP_NUMB_MASK;
- mpn_submul_1 (np - dn, dp, dn + 2, q);
- n1 = np[1]; /* update n1, last loop's value will now be invalid */
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
-
- cy = mpn_submul_1 (np - dn, dp, dn, q);
-
- cy1 = n0 < cy;
- n0 = (n0 - cy) & GMP_NUMB_MASK;
- cy = n1 < cy1;
- n1 -= cy1;
- np[0] = n0;
-
- if (UNLIKELY (cy != 0))
- {
- n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1);
- q--;
- }
- }
-
- *--qp = q;
- }
-
- flag = ~CNST_LIMB(0);
-
- if (dn >= 0)
- {
- for (i = dn; i > 0; i--)
- {
- np--;
- if (UNLIKELY (n1 >= (d1 & flag)))
- {
- q = GMP_NUMB_MASK;
- cy = mpn_submul_1 (np - dn, dp, dn + 2, q);
-
- if (UNLIKELY (n1 != cy))
- {
- if (n1 < (cy & flag))
- {
- q--;
- mpn_add_n (np - dn, np - dn, dp, dn + 2);
- }
- else
- flag = 0;
- }
- n1 = np[1];
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
-
- cy = mpn_submul_1 (np - dn, dp, dn, q);
-
- cy1 = n0 < cy;
- n0 = (n0 - cy) & GMP_NUMB_MASK;
- cy = n1 < cy1;
- n1 -= cy1;
- np[0] = n0;
-
- if (UNLIKELY (cy != 0))
- {
- n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1);
- q--;
- }
- }
-
- *--qp = q;
-
- /* Truncate operands. */
- dn--;
- dp++;
- }
-
- np--;
- if (UNLIKELY (n1 >= (d1 & flag)))
- {
- q = GMP_NUMB_MASK;
- cy = mpn_submul_1 (np, dp, 2, q);
-
- if (UNLIKELY (n1 != cy))
- {
- if (n1 < (cy & flag))
- {
- q--;
- add_ssaaaa (np[1], np[0], np[1], np[0], dp[1], dp[0]);
- }
- else
- flag = 0;
- }
- n1 = np[1];
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
-
- np[0] = n0;
- np[1] = n1;
- }
-
- *--qp = q;
- }
- ASSERT_ALWAYS (np[1] == n1);
- np += 2;
-
-
- dn = dn_orig;
- if (UNLIKELY (n1 < (dn & flag)))
- {
- mp_limb_t q, x;
-
- /* The quotient may be too large if the remainder is small. Recompute
- for above ignored operand parts, until the remainder spills.
-
- FIXME: The quality of this code isn't the same as the code above.
- 1. We don't compute things in an optimal order, high-to-low, in order
- to terminate as quickly as possible.
- 2. We mess with pointers and sizes, adding and subtracting and
- adjusting to get things right. It surely could be streamlined.
- 3. The only termination criteria are that we determine that the
- quotient needs to be adjusted, or that we have recomputed
- everything. We should stop when the remainder is so large
- that no additional subtracting could make it spill.
- 4. If nothing else, we should not do two loops of submul_1 over the
- data, instead handle both the triangularization and chopping at
- once. */
-
- x = n1;
-
- if (dn > 2)
- {
- /* Compensate for triangularization. */
- mp_limb_t y;
-
- dp = dp_orig;
- if (qn + 1 < dn)
- {
- dp += dn - (qn + 1);
- dn = qn + 1;
- }
-
- y = np[-2];
-
- for (i = dn - 3; i >= 0; i--)
- {
- q = qp[i];
- cy = mpn_submul_1 (np - (dn - i), dp, dn - i - 2, q);
-
- if (y < cy)
- {
- if (x == 0)
- {
- cy = mpn_sub_1 (qp, qp, qn, 1);
- ASSERT_ALWAYS (cy == 0);
- return qh - cy;
- }
- x--;
- }
- y -= cy;
- }
- np[-2] = y;
- }
-
- dn = dn_orig;
- if (qn + 1 < dn)
- {
- /* Compensate for ignored dividend and divisor tails. */
-
- dp = dp_orig;
- np = np_orig;
-
- if (qh != 0)
- {
- cy = mpn_sub_n (np + qn, np + qn, dp, dn - (qn + 1));
- if (cy != 0)
- {
- if (x == 0)
- {
- if (qn != 0)
- cy = mpn_sub_1 (qp, qp, qn, 1);
- return qh - cy;
- }
- x--;
- }
- }
-
- if (qn == 0)
- return qh;
-
- for (i = dn - qn - 2; i >= 0; i--)
- {
- cy = mpn_submul_1 (np + i, qp, qn, dp[i]);
- cy = mpn_sub_1 (np + qn + i, np + qn + i, dn - qn - i - 1, cy);
- if (cy != 0)
- {
- if (x == 0)
- {
- cy = mpn_sub_1 (qp, qp, qn, 1);
- return qh;
- }
- x--;
- }
- }
- }
- }
-
- return qh;
-}
diff --git a/gmp/mpn/generic/sbpi1_div_qr.c b/gmp/mpn/generic/sbpi1_div_qr.c
deleted file mode 100644
index 0c3e4cb729..0000000000
--- a/gmp/mpn/generic/sbpi1_div_qr.c
+++ /dev/null
@@ -1,110 +0,0 @@
-/* mpn_sbpi1_div_qr -- Schoolbook division using the Möller-Granlund 3/2
- division algorithm.
-
- Contributed to the GNU project by Torbjorn Granlund.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-mp_limb_t
-mpn_sbpi1_div_qr (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_limb_t dinv)
-{
- mp_limb_t qh;
- mp_size_t i;
- mp_limb_t n1, n0;
- mp_limb_t d1, d0;
- mp_limb_t cy, cy1;
- mp_limb_t q;
-
- ASSERT (dn > 2);
- ASSERT (nn >= dn);
- ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0);
-
- np += nn;
-
- qh = mpn_cmp (np - dn, dp, dn) >= 0;
- if (qh != 0)
- mpn_sub_n (np - dn, np - dn, dp, dn);
-
- qp += nn - dn;
-
- dn -= 2; /* offset dn by 2 for main division loops,
- saving two iterations in mpn_submul_1. */
- d1 = dp[dn + 1];
- d0 = dp[dn + 0];
-
- np -= 2;
-
- n1 = np[1];
-
- for (i = nn - (dn + 2); i > 0; i--)
- {
- np--;
- if (UNLIKELY (n1 == d1) && np[1] == d0)
- {
- q = GMP_NUMB_MASK;
- mpn_submul_1 (np - dn, dp, dn + 2, q);
- n1 = np[1]; /* update n1, last loop's value will now be invalid */
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
-
- cy = mpn_submul_1 (np - dn, dp, dn, q);
-
- cy1 = n0 < cy;
- n0 = (n0 - cy) & GMP_NUMB_MASK;
- cy = n1 < cy1;
- n1 = (n1 - cy1) & GMP_NUMB_MASK;
- np[0] = n0;
-
- if (UNLIKELY (cy != 0))
- {
- n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1);
- q--;
- }
- }
-
- *--qp = q;
- }
- np[1] = n1;
-
- return qh;
-}
diff --git a/gmp/mpn/generic/sbpi1_divappr_q.c b/gmp/mpn/generic/sbpi1_divappr_q.c
deleted file mode 100644
index 3e7cf91ba6..0000000000
--- a/gmp/mpn/generic/sbpi1_divappr_q.c
+++ /dev/null
@@ -1,199 +0,0 @@
-/* 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.
-
- Contributed to the GNU project by Torbjorn Granlund.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GMP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-mp_limb_t
-mpn_sbpi1_divappr_q (mp_ptr qp,
- mp_ptr np, mp_size_t nn,
- mp_srcptr dp, mp_size_t dn,
- mp_limb_t dinv)
-{
- mp_limb_t qh;
- mp_size_t qn, i;
- mp_limb_t n1, n0;
- mp_limb_t d1, d0;
- mp_limb_t cy, cy1;
- mp_limb_t q;
- mp_limb_t flag;
-
- ASSERT (dn > 2);
- ASSERT (nn >= dn);
- ASSERT ((dp[dn-1] & GMP_NUMB_HIGHBIT) != 0);
-
- np += nn;
-
- qn = nn - dn;
- if (qn + 1 < dn)
- {
- dp += dn - (qn + 1);
- dn = qn + 1;
- }
-
- qh = mpn_cmp (np - dn, dp, dn) >= 0;
- if (qh != 0)
- mpn_sub_n (np - dn, np - dn, dp, dn);
-
- qp += qn;
-
- dn -= 2; /* offset dn by 2 for main division loops,
- saving two iterations in mpn_submul_1. */
- d1 = dp[dn + 1];
- d0 = dp[dn + 0];
-
- np -= 2;
-
- n1 = np[1];
-
- for (i = qn - (dn + 2); i >= 0; i--)
- {
- np--;
- if (UNLIKELY (n1 == d1) && np[1] == d0)
- {
- q = GMP_NUMB_MASK;
- mpn_submul_1 (np - dn, dp, dn + 2, q);
- n1 = np[1]; /* update n1, last loop's value will now be invalid */
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
-
- cy = mpn_submul_1 (np - dn, dp, dn, q);
-
- cy1 = n0 < cy;
- n0 = (n0 - cy) & GMP_NUMB_MASK;
- cy = n1 < cy1;
- n1 -= cy1;
- np[0] = n0;
-
- if (UNLIKELY (cy != 0))
- {
- n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1);
- q--;
- }
- }
-
- *--qp = q;
- }
-
- flag = ~CNST_LIMB(0);
-
- if (dn >= 0)
- {
- for (i = dn; i > 0; i--)
- {
- np--;
- if (UNLIKELY (n1 >= (d1 & flag)))
- {
- q = GMP_NUMB_MASK;
- cy = mpn_submul_1 (np - dn, dp, dn + 2, q);
-
- if (UNLIKELY (n1 != cy))
- {
- if (n1 < (cy & flag))
- {
- q--;
- mpn_add_n (np - dn, np - dn, dp, dn + 2);
- }
- else
- flag = 0;
- }
- n1 = np[1];
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
-
- cy = mpn_submul_1 (np - dn, dp, dn, q);
-
- cy1 = n0 < cy;
- n0 = (n0 - cy) & GMP_NUMB_MASK;
- cy = n1 < cy1;
- n1 -= cy1;
- np[0] = n0;
-
- if (UNLIKELY (cy != 0))
- {
- n1 += d1 + mpn_add_n (np - dn, np - dn, dp, dn + 1);
- q--;
- }
- }
-
- *--qp = q;
-
- /* Truncate operands. */
- dn--;
- dp++;
- }
-
- np--;
- if (UNLIKELY (n1 >= (d1 & flag)))
- {
- q = GMP_NUMB_MASK;
- cy = mpn_submul_1 (np, dp, 2, q);
-
- if (UNLIKELY (n1 != cy))
- {
- if (n1 < (cy & flag))
- {
- q--;
- add_ssaaaa (np[1], np[0], np[1], np[0], dp[1], dp[0]);
- }
- else
- flag = 0;
- }
- n1 = np[1];
- }
- else
- {
- udiv_qr_3by2 (q, n1, n0, n1, np[1], np[0], d1, d0, dinv);
-
- np[1] = n1;
- np[0] = n0;
- }
-
- *--qp = q;
- }
-
- ASSERT_ALWAYS (np[1] == n1);
-
- return qh;
-}
diff --git a/gmp/mpn/generic/scan0.c b/gmp/mpn/generic/scan0.c
index 8171fd5afe..2e9f3a43da 100644
--- a/gmp/mpn/generic/scan0.c
+++ b/gmp/mpn/generic/scan0.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -36,8 +25,9 @@ see https://www.gnu.org/licenses/. */
1. U must sooner or later have a limb with a clear bit.
*/
-mp_bitcnt_t
-mpn_scan0 (mp_srcptr up, mp_bitcnt_t starting_bit)
+unsigned long int
+mpn_scan0 (register mp_srcptr up,
+ register unsigned long int starting_bit)
{
mp_size_t starting_word;
mp_limb_t alimb;
diff --git a/gmp/mpn/generic/scan1.c b/gmp/mpn/generic/scan1.c
index e22ad5d827..d0d9a3feea 100644
--- a/gmp/mpn/generic/scan1.c
+++ b/gmp/mpn/generic/scan1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -36,8 +25,9 @@ see https://www.gnu.org/licenses/. */
1. U must sooner or later have a limb != 0.
*/
-mp_bitcnt_t
-mpn_scan1 (mp_srcptr up, mp_bitcnt_t starting_bit)
+unsigned long int
+mpn_scan1 (register mp_srcptr up,
+ register unsigned long int starting_bit)
{
mp_size_t starting_word;
mp_limb_t alimb;
diff --git a/gmp/mpn/generic/sec_aors_1.c b/gmp/mpn/generic/sec_aors_1.c
deleted file mode 100644
index d789a5792e..0000000000
--- a/gmp/mpn/generic/sec_aors_1.c
+++ /dev/null
@@ -1,60 +0,0 @@
-/* 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/gmp/mpn/generic/sec_div.c b/gmp/mpn/generic/sec_div.c
deleted file mode 100644
index 483b118d0d..0000000000
--- a/gmp/mpn/generic/sec_div.c
+++ /dev/null
@@ -1,133 +0,0 @@
-/* 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/gmp/mpn/generic/sec_invert.c b/gmp/mpn/generic/sec_invert.c
deleted file mode 100644
index 43a578b2a1..0000000000
--- a/gmp/mpn/generic/sec_invert.c
+++ /dev/null
@@ -1,195 +0,0 @@
-/* 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/gmp/mpn/generic/sec_mul.c b/gmp/mpn/generic/sec_mul.c
deleted file mode 100644
index 2cd87fab1d..0000000000
--- a/gmp/mpn/generic/sec_mul.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* 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/gmp/mpn/generic/sec_pi1_div.c b/gmp/mpn/generic/sec_pi1_div.c
deleted file mode 100644
index 1e075daf73..0000000000
--- a/gmp/mpn/generic/sec_pi1_div.c
+++ /dev/null
@@ -1,173 +0,0 @@
-/* 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/gmp/mpn/generic/sec_powm.c b/gmp/mpn/generic/sec_powm.c
deleted file mode 100644
index 67de44e10a..0000000000
--- a/gmp/mpn/generic/sec_powm.c
+++ /dev/null
@@ -1,438 +0,0 @@
-/* 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/gmp/mpn/generic/sec_sqr.c b/gmp/mpn/generic/sec_sqr.c
deleted file mode 100644
index 736924cc22..0000000000
--- a/gmp/mpn/generic/sec_sqr.c
+++ /dev/null
@@ -1,48 +0,0 @@
-/* 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/gmp/mpn/generic/sec_tabselect.c b/gmp/mpn/generic/sec_tabselect.c
deleted file mode 100644
index a79c73a575..0000000000
--- a/gmp/mpn/generic/sec_tabselect.c
+++ /dev/null
@@ -1,55 +0,0 @@
-/* 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);
- }
- }
-}
diff --git a/gmp/mpn/generic/set_str.c b/gmp/mpn/generic/set_str.c
index 71034e34bf..975cfb0dad 100644
--- a/gmp/mpn/generic/set_str.c
+++ b/gmp/mpn/generic/set_str.c
@@ -9,34 +9,23 @@
FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR DISAPPEAR IN A FUTURE
GNU MP RELEASE.
-Copyright 1991-1994, 1996, 2000-2002, 2004, 2006-2008, 2012, 2013 Free
-Software Foundation, Inc.
+Copyright 1991, 1992, 1993, 1994, 1996, 2000, 2001, 2002, 2004, 2006, 2007,
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* TODO:
@@ -80,7 +69,7 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
int next_bitpos;
mp_limb_t res_digit;
mp_size_t size;
- int bits_per_indigit = mp_bases[base].big_base;
+ int bits_per_indigit = __mp_bases[base].big_base;
size = 0;
res_digit = 0;
@@ -118,7 +107,7 @@ mpn_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
TMP_MARK;
- chars_per_limb = mp_bases[base].chars_per_limb;
+ chars_per_limb = __mp_bases[base].chars_per_limb;
un = str_len / chars_per_limb + 1;
@@ -142,15 +131,18 @@ mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, i
long i, pi;
mp_size_t n;
mp_ptr p, t;
- mp_limb_t big_base;
+ unsigned normalization_steps;
+ mp_limb_t big_base, big_base_inverted;
int chars_per_limb;
size_t digits_in_base;
mp_size_t shift;
powtab_mem_ptr = powtab_mem;
- chars_per_limb = mp_bases[base].chars_per_limb;
- big_base = mp_bases[base].big_base;
+ chars_per_limb = __mp_bases[base].chars_per_limb;
+ big_base = __mp_bases[base].big_base;
+ big_base_inverted = __mp_bases[base].big_base_inverted;
+ count_leading_zeros (normalization_steps, big_base);
p = powtab_mem_ptr;
powtab_mem_ptr += 1;
@@ -177,7 +169,7 @@ mpn_set_str_compute_powtab (powers_t *powtab, mp_ptr powtab_mem, mp_size_t un, i
ASSERT_ALWAYS (powtab_mem_ptr < powtab_mem + mpn_dc_set_str_powtab_alloc (un));
- mpn_sqr (t, p, n);
+ mpn_sqr_n (t, p, n);
n = 2 * n - 1; n += t[n] != 0;
digits_in_base *= 2;
#if 1
@@ -247,9 +239,7 @@ mpn_dc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len,
if (hn == 0)
{
- /* Zero +1 limb here, to avoid reading an allocated but uninitialised
- limb in mpn_incr_u below. */
- MPN_ZERO (rp, powtab->n + sn + 1);
+ MPN_ZERO (rp, powtab->n + sn);
}
else
{
@@ -288,11 +278,11 @@ mpn_bc_set_str (mp_ptr rp, const unsigned char *str, size_t str_len, int base)
mp_limb_t res_digit;
ASSERT (base >= 2);
- ASSERT (base < numberof (mp_bases));
+ ASSERT (base < numberof (__mp_bases));
ASSERT (str_len >= 1);
- big_base = mp_bases[base].big_base;
- chars_per_limb = mp_bases[base].chars_per_limb;
+ big_base = __mp_bases[base].big_base;
+ chars_per_limb = __mp_bases[base].chars_per_limb;
size = 0;
for (i = chars_per_limb; i < str_len; i += chars_per_limb)
diff --git a/gmp/mpn/generic/sizeinbase.c b/gmp/mpn/generic/sizeinbase.c
index 16633569ec..edd10b544e 100644
--- a/gmp/mpn/generic/sizeinbase.c
+++ b/gmp/mpn/generic/sizeinbase.c
@@ -4,34 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 1991, 1993-1995, 2001, 2002, 2011, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -44,7 +32,27 @@ see https://www.gnu.org/licenses/. */
size_t
mpn_sizeinbase (mp_srcptr xp, mp_size_t xsize, int base)
{
- size_t result;
- MPN_SIZEINBASE (result, xp, xsize, base);
- return result;
+ int lb_base, cnt;
+ mp_size_t totbits;
+
+ ASSERT (xsize >= 0);
+ ASSERT (base >= 2);
+ ASSERT (base < numberof (__mp_bases));
+
+ /* Special case for X == 0. */
+ if (xsize == 0)
+ return 1;
+
+ /* Calculate the total number of significant bits of X. */
+ count_leading_zeros (cnt, xp[xsize-1]);
+ totbits = xsize * BITS_PER_MP_LIMB - cnt;
+
+ if (POW2_P (base))
+ {
+ /* Special case for powers of 2, giving exact result. */
+ lb_base = __mp_bases[base].big_base;
+ return (totbits + lb_base - 1) / lb_base;
+ }
+ else
+ return (size_t) (totbits * __mp_bases[base].chars_per_bit_exactly) + 1;
}
diff --git a/gmp/mpn/generic/sqr.c b/gmp/mpn/generic/sqr.c
deleted file mode 100644
index 3743761f78..0000000000
--- a/gmp/mpn/generic/sqr.c
+++ /dev/null
@@ -1,99 +0,0 @@
-/* mpn_sqr -- square natural numbers.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-void
-mpn_sqr (mp_ptr p, mp_srcptr a, mp_size_t n)
-{
- ASSERT (n >= 1);
- ASSERT (! MPN_OVERLAP_P (p, 2 * n, a, n));
-
- if (BELOW_THRESHOLD (n, SQR_BASECASE_THRESHOLD))
- { /* mul_basecase is faster than sqr_basecase on small sizes sometimes */
- mpn_mul_basecase (p, a, n, a, n);
- }
- else if (BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD))
- {
- mpn_sqr_basecase (p, a, n);
- }
- else if (BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD))
- {
- /* Allocate workspace of fixed size on stack: fast! */
- mp_limb_t ws[mpn_toom2_sqr_itch (SQR_TOOM3_THRESHOLD_LIMIT-1)];
- ASSERT (SQR_TOOM3_THRESHOLD <= SQR_TOOM3_THRESHOLD_LIMIT);
- mpn_toom2_sqr (p, a, n, ws);
- }
- else if (BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD))
- {
- mp_ptr ws;
- TMP_SDECL;
- TMP_SMARK;
- ws = TMP_SALLOC_LIMBS (mpn_toom3_sqr_itch (n));
- mpn_toom3_sqr (p, a, n, ws);
- TMP_SFREE;
- }
- else if (BELOW_THRESHOLD (n, SQR_TOOM6_THRESHOLD))
- {
- mp_ptr ws;
- TMP_SDECL;
- TMP_SMARK;
- ws = TMP_SALLOC_LIMBS (mpn_toom4_sqr_itch (n));
- mpn_toom4_sqr (p, a, n, ws);
- TMP_SFREE;
- }
- else if (BELOW_THRESHOLD (n, SQR_TOOM8_THRESHOLD))
- {
- mp_ptr ws;
- TMP_SDECL;
- TMP_SMARK;
- ws = TMP_SALLOC_LIMBS (mpn_toom6_sqr_itch (n));
- mpn_toom6_sqr (p, a, n, ws);
- TMP_SFREE;
- }
- else if (BELOW_THRESHOLD (n, SQR_FFT_THRESHOLD))
- {
- mp_ptr ws;
- TMP_DECL;
- TMP_MARK;
- ws = TMP_ALLOC_LIMBS (mpn_toom8_sqr_itch (n));
- mpn_toom8_sqr (p, a, n, ws);
- TMP_FREE;
- }
- else
- {
- /* The current FFT code allocates its own space. That should probably
- change. */
- mpn_fft_mul (p, a, n, a, n);
- }
-}
diff --git a/gmp/mpn/generic/sqr_basecase.c b/gmp/mpn/generic/sqr_basecase.c
index fc6a043a94..56d22216f6 100644
--- a/gmp/mpn/generic/sqr_basecase.c
+++ b/gmp/mpn/generic/sqr_basecase.c
@@ -5,34 +5,23 @@
SAFE TO REACH THIS FUNCTION THROUGH DOCUMENTED INTERFACES.
-Copyright 1991-1994, 1996, 1997, 2000-2005, 2008, 2010, 2011 Free Software
-Foundation, Inc.
+Copyright 1991, 1992, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004,
+2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -56,30 +45,6 @@ see https://www.gnu.org/licenses/. */
} while (0)
#endif
-#if HAVE_NATIVE_mpn_sqr_diag_addlsh1
-#define MPN_SQR_DIAG_ADDLSH1(rp, tp, up, n) \
- mpn_sqr_diag_addlsh1 (rp, tp, up, n)
-#else
-#if HAVE_NATIVE_mpn_addlsh1_n
-#define MPN_SQR_DIAG_ADDLSH1(rp, tp, up, n) \
- do { \
- mp_limb_t cy; \
- MPN_SQR_DIAGONAL (rp, up, n); \
- cy = mpn_addlsh1_n (rp + 1, rp + 1, tp, 2 * n - 2); \
- rp[2 * n - 1] += cy; \
- } while (0)
-#else
-#define MPN_SQR_DIAG_ADDLSH1(rp, tp, up, n) \
- do { \
- mp_limb_t cy; \
- MPN_SQR_DIAGONAL (rp, up, n); \
- cy = mpn_lshift (tp, tp, 2 * n - 2, 1); \
- cy += mpn_add_n (rp + 1, rp + 1, tp, 2 * n - 2); \
- rp[2 * n - 1] += cy; \
- } while (0)
-#endif
-#endif
-
#undef READY_WITH_mpn_sqr_basecase
@@ -89,12 +54,12 @@ void
mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
{
mp_size_t i;
- mp_limb_t tarr[2 * SQR_TOOM2_THRESHOLD];
+ mp_limb_t tarr[2 * SQR_KARATSUBA_THRESHOLD];
mp_ptr tp = tarr;
mp_limb_t cy;
/* must fit 2*n limbs in tarr */
- ASSERT (n <= SQR_TOOM2_THRESHOLD);
+ ASSERT (n <= SQR_KARATSUBA_THRESHOLD);
if ((n & 1) != 0)
{
@@ -119,13 +84,9 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
{
if (n == 2)
{
-#if HAVE_NATIVE_mpn_mul_2
- rp[3] = mpn_mul_2 (rp, up, 2, up);
-#else
rp[0] = 0;
rp[1] = 0;
rp[3] = mpn_addmul_2 (rp, up, 2, up);
-#endif
return;
}
@@ -140,7 +101,15 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
tp[2 * n - 3] = cy;
}
- MPN_SQR_DIAG_ADDLSH1 (rp, tp, up, n);
+ MPN_SQR_DIAGONAL (rp, up, n);
+
+#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;
}
#define READY_WITH_mpn_sqr_basecase
#endif
@@ -167,12 +136,12 @@ void
mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
{
mp_size_t i;
- mp_limb_t tarr[2 * SQR_TOOM2_THRESHOLD];
+ mp_limb_t tarr[2 * SQR_KARATSUBA_THRESHOLD];
mp_ptr tp = tarr;
mp_limb_t cy;
/* must fit 2*n limbs in tarr */
- ASSERT (n <= SQR_TOOM2_THRESHOLD);
+ ASSERT (n <= SQR_KARATSUBA_THRESHOLD);
if ((n & 1) != 0)
{
@@ -225,13 +194,9 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
if (n == 2)
{
-#if HAVE_NATIVE_mpn_mul_2
- rp[3] = mpn_mul_2 (rp, up, 2, up);
-#else
rp[0] = 0;
rp[1] = 0;
rp[3] = mpn_addmul_2 (rp, up, 2, up);
-#endif
return;
}
@@ -303,12 +268,12 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
}
if (n > 1)
{
- mp_limb_t tarr[2 * SQR_TOOM2_THRESHOLD];
+ mp_limb_t tarr[2 * SQR_KARATSUBA_THRESHOLD];
mp_ptr tp = tarr;
mp_limb_t cy;
/* must fit 2*n limbs in tarr */
- ASSERT (n <= SQR_TOOM2_THRESHOLD);
+ ASSERT (n <= SQR_KARATSUBA_THRESHOLD);
cy = mpn_mul_1 (tp, up + 1, n - 1, up[0]);
tp[n - 1] = cy;
@@ -318,8 +283,18 @@ mpn_sqr_basecase (mp_ptr rp, mp_srcptr up, mp_size_t n)
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);
- MPN_SQR_DIAG_ADDLSH1 (rp, tp, up, n);
+ {
+ 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
diff --git a/gmp/mpn/generic/sqrmod_bnm1.c b/gmp/mpn/generic/sqrmod_bnm1.c
deleted file mode 100644
index fd0868b90b..0000000000
--- a/gmp/mpn/generic/sqrmod_bnm1.c
+++ /dev/null
@@ -1,313 +0,0 @@
-/* sqrmod_bnm1.c -- squaring mod B^n-1.
-
- 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.
-
-This file is part 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"
-
-/* Input is {ap,rn}; output is {rp,rn}, computation is
- mod B^rn - 1, and values are semi-normalised; zero is represented
- as either 0 or B^n - 1. Needs a scratch of 2rn limbs at tp.
- tp==rp is allowed. */
-static void
-mpn_bc_sqrmod_bnm1 (mp_ptr rp, mp_srcptr ap, mp_size_t rn, mp_ptr tp)
-{
- mp_limb_t cy;
-
- ASSERT (0 < rn);
-
- mpn_sqr (tp, ap, rn);
- cy = mpn_add_n (rp, tp, tp + rn, rn);
- /* If cy == 1, then the value of rp is at most B^rn - 2, so there can
- * be no overflow when adding in the carry. */
- MPN_INCR_U (rp, rn, cy);
-}
-
-
-/* Input is {ap,rn+1}; output is {rp,rn+1}, in
- semi-normalised representation, computation is mod B^rn + 1. Needs
- a scratch area of 2rn + 2 limbs at tp; tp == rp is allowed.
- Output is normalised. */
-static void
-mpn_bc_sqrmod_bnp1 (mp_ptr rp, mp_srcptr ap, mp_size_t rn, mp_ptr tp)
-{
- mp_limb_t cy;
-
- ASSERT (0 < rn);
-
- mpn_sqr (tp, ap, rn + 1);
- ASSERT (tp[2*rn+1] == 0);
- ASSERT (tp[2*rn] < GMP_NUMB_MAX);
- cy = tp[2*rn] + mpn_sub_n (rp, tp, tp+rn, rn);
- rp[rn] = 0;
- MPN_INCR_U (rp, rn+1, cy );
-}
-
-
-/* Computes {rp,MIN(rn,2an)} <- {ap,an}^2 Mod(B^rn-1)
- *
- * The result is expected to be ZERO if and only if the operand
- * already is. Otherwise the class [0] Mod(B^rn-1) is represented by
- * B^rn-1.
- * It should not be a problem if sqrmod_bnm1 is used to
- * compute the full square with an <= 2*rn, because this condition
- * implies (B^an-1)^2 < (B^rn-1) .
- *
- * Requires rn/4 < an <= rn
- * Scratch need: rn/2 + (need for recursive call OR rn + 3). This gives
- *
- * S(n) <= rn/2 + MAX (rn + 4, S(n/2)) <= 3/2 rn + 4
- */
-void
-mpn_sqrmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_ptr tp)
-{
- ASSERT (0 < an);
- ASSERT (an <= rn);
-
- if ((rn & 1) != 0 || BELOW_THRESHOLD (rn, SQRMOD_BNM1_THRESHOLD))
- {
- if (UNLIKELY (an < rn))
- {
- if (UNLIKELY (2*an <= rn))
- {
- mpn_sqr (rp, ap, an);
- }
- else
- {
- mp_limb_t cy;
- mpn_sqr (tp, ap, an);
- cy = mpn_add (rp, tp, rn, tp + rn, 2*an - rn);
- MPN_INCR_U (rp, rn, cy);
- }
- }
- else
- mpn_bc_sqrmod_bnm1 (rp, ap, rn, tp);
- }
- else
- {
- mp_size_t n;
- mp_limb_t cy;
- mp_limb_t hi;
-
- n = rn >> 1;
-
- ASSERT (2*an > n);
-
- /* Compute xm = a^2 mod (B^n - 1), xp = a^2 mod (B^n + 1)
- and crt together as
-
- x = -xp * B^n + (B^n + 1) * [ (xp + xm)/2 mod (B^n-1)]
- */
-
-#define a0 ap
-#define a1 (ap + n)
-
-#define xp tp /* 2n + 2 */
- /* am1 maybe in {xp, n} */
-#define sp1 (tp + 2*n + 2)
- /* ap1 maybe in {sp1, n + 1} */
-
- {
- mp_srcptr am1;
- mp_size_t anm;
- mp_ptr so;
-
- if (LIKELY (an > n))
- {
- so = xp + n;
- am1 = xp;
- cy = mpn_add (xp, a0, n, a1, an - n);
- MPN_INCR_U (xp, n, cy);
- anm = n;
- }
- else
- {
- so = xp;
- am1 = a0;
- anm = an;
- }
-
- mpn_sqrmod_bnm1 (rp, n, am1, anm, so);
- }
-
- {
- int k;
- mp_srcptr ap1;
- mp_size_t anp;
-
- 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];
- } else {
- ap1 = a0;
- anp = an;
- }
-
- if (BELOW_THRESHOLD (n, MUL_FFT_MODF_THRESHOLD))
- k=0;
- else
- {
- int mask;
- k = mpn_fft_best_k (n, 1);
- mask = (1<<k) -1;
- while (n & mask) {k--; mask >>=1;};
- }
- if (k >= FFT_FIRST_K)
- xp[n] = mpn_mul_fft (xp, n, ap1, anp, ap1, anp, k);
- else if (UNLIKELY (ap1 == a0))
- {
- ASSERT (anp <= n);
- ASSERT (2*anp > n);
- mpn_sqr (xp, a0, an);
- anp = 2*an - n;
- cy = mpn_sub (xp, xp, n, xp + n, anp);
- xp[n] = 0;
- MPN_INCR_U (xp, n+1, cy);
- }
- else
- mpn_bc_sqrmod_bnp1 (xp, ap1, n, xp);
- }
-
- /* Here the CRT recomposition begins.
-
- xm <- (xp + xm)/2 = (xp + xm)B^n/2 mod (B^n-1)
- Division by 2 is a bitwise rotation.
-
- Assumes xp normalised mod (B^n+1).
-
- The residue class [0] is represented by [B^n-1]; except when
- both input are ZERO.
- */
-
-#if HAVE_NATIVE_mpn_rsh1add_n || HAVE_NATIVE_mpn_rsh1add_nc
-#if HAVE_NATIVE_mpn_rsh1add_nc
- cy = mpn_rsh1add_nc(rp, rp, xp, n, xp[n]); /* B^n = 1 */
- hi = cy << (GMP_NUMB_BITS - 1);
- cy = 0;
- /* next update of rp[n-1] will set cy = 1 only if rp[n-1]+=hi
- overflows, i.e. a further increment will not overflow again. */
-#else /* ! _nc */
- cy = xp[n] + mpn_rsh1add_n(rp, rp, xp, n); /* B^n = 1 */
- hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */
- cy >>= 1;
- /* cy = 1 only if xp[n] = 1 i.e. {xp,n} = ZERO, this implies that
- 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], CNST_LIMB(0), hi);
-#else
- cy += (hi & rp[n-1]) >> (GMP_NUMB_BITS-1);
- rp[n-1] ^= hi;
-#endif
-#else /* ! HAVE_NATIVE_mpn_rsh1add_n */
-#if HAVE_NATIVE_mpn_add_nc
- cy = mpn_add_nc(rp, rp, xp, n, xp[n]);
-#else /* ! _nc */
- cy = xp[n] + mpn_add_n(rp, rp, xp, n); /* xp[n] == 1 implies {xp,n} == ZERO */
-#endif
- cy += (rp[0]&1);
- mpn_rshift(rp, rp, n, 1);
- ASSERT (cy <= 2);
- hi = (cy<<(GMP_NUMB_BITS-1))&GMP_NUMB_MASK; /* (cy&1) << ... */
- cy >>= 1;
- /* We can have cy != 0 only if hi = 0... */
- ASSERT ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0);
- rp[n-1] |= hi;
- /* ... rp[n-1] + cy can not overflow, the following INCR is correct. */
-#endif
- ASSERT (cy <= 1);
- /* Next increment can not overflow, read the previous comments about cy. */
- ASSERT ((cy == 0) || ((rp[n-1] & GMP_NUMB_HIGHBIT) == 0));
- MPN_INCR_U(rp, n, cy);
-
- /* Compute the highest half:
- ([(xp + xm)/2 mod (B^n-1)] - xp ) * B^n
- */
- if (UNLIKELY (2*an < rn))
- {
- /* Note that in this case, the only way the result can equal
- zero mod B^{rn} - 1 is if the input is zero, and
- then the output of both the recursive calls and this CRT
- reconstruction is zero, not B^{rn} - 1. */
- cy = mpn_sub_n (rp + n, rp, xp, 2*an - n);
-
- /* FIXME: This subtraction of the high parts is not really
- necessary, we do it to get the carry out, and for sanity
- checking. */
- cy = xp[n] + mpn_sub_nc (xp + 2*an - n, rp + 2*an - n,
- xp + 2*an - n, rn - 2*an, cy);
- ASSERT (mpn_zero_p (xp + 2*an - n+1, rn - 1 - 2*an));
- cy = mpn_sub_1 (rp, rp, 2*an, cy);
- ASSERT (cy == (xp + 2*an - n)[0]);
- }
- else
- {
- cy = xp[n] + mpn_sub_n (rp + n, rp, xp, n);
- /* cy = 1 only if {xp,n+1} is not ZERO, i.e. {rp,n} is not ZERO.
- DECR will affect _at most_ the lowest n limbs. */
- MPN_DECR_U (rp, 2*n, cy);
- }
-#undef a0
-#undef a1
-#undef xp
-#undef sp1
- }
-}
-
-mp_size_t
-mpn_sqrmod_bnm1_next_size (mp_size_t n)
-{
- mp_size_t nh;
-
- if (BELOW_THRESHOLD (n, SQRMOD_BNM1_THRESHOLD))
- return n;
- if (BELOW_THRESHOLD (n, 4 * (SQRMOD_BNM1_THRESHOLD - 1) + 1))
- return (n + (2-1)) & (-2);
- if (BELOW_THRESHOLD (n, 8 * (SQRMOD_BNM1_THRESHOLD - 1) + 1))
- return (n + (4-1)) & (-4);
-
- nh = (n + 1) >> 1;
-
- if (BELOW_THRESHOLD (nh, SQR_FFT_MODF_THRESHOLD))
- return (n + (8-1)) & (-8);
-
- return 2 * mpn_fft_next_size (nh, mpn_fft_best_k (nh, 1));
-}
diff --git a/gmp/mpn/generic/sqrtrem.c b/gmp/mpn/generic/sqrtrem.c
index 7d0f120001..ac878c5083 100644
--- a/gmp/mpn/generic/sqrtrem.c
+++ b/gmp/mpn/generic/sqrtrem.c
@@ -8,34 +8,23 @@
INTERFACES. IN FACT, IT IS ALMOST GUARANTEED THAT THEY WILL CHANGE OR
DISAPPEAR IN A FUTURE GMP RELEASE.
-Copyright 1999-2002, 2004, 2005, 2008, 2010, 2012 Free Software Foundation,
+Copyright 1999, 2000, 2001, 2002, 2004, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* See "Karatsuba Square Root", reference in gmp.texi. */
@@ -48,64 +37,64 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "longlong.h"
-static const unsigned char invsqrttab[384] = /* The common 0x100 was removed */
+static const unsigned short invsqrttab[384] =
{
- 0xff,0xfd,0xfb,0xf9,0xf7,0xf5,0xf3,0xf2, /* sqrt(1/80)..sqrt(1/87) */
- 0xf0,0xee,0xec,0xea,0xe9,0xe7,0xe5,0xe4, /* sqrt(1/88)..sqrt(1/8f) */
- 0xe2,0xe0,0xdf,0xdd,0xdb,0xda,0xd8,0xd7, /* sqrt(1/90)..sqrt(1/97) */
- 0xd5,0xd4,0xd2,0xd1,0xcf,0xce,0xcc,0xcb, /* sqrt(1/98)..sqrt(1/9f) */
- 0xc9,0xc8,0xc6,0xc5,0xc4,0xc2,0xc1,0xc0, /* sqrt(1/a0)..sqrt(1/a7) */
- 0xbe,0xbd,0xbc,0xba,0xb9,0xb8,0xb7,0xb5, /* sqrt(1/a8)..sqrt(1/af) */
- 0xb4,0xb3,0xb2,0xb0,0xaf,0xae,0xad,0xac, /* sqrt(1/b0)..sqrt(1/b7) */
- 0xaa,0xa9,0xa8,0xa7,0xa6,0xa5,0xa4,0xa3, /* sqrt(1/b8)..sqrt(1/bf) */
- 0xa2,0xa0,0x9f,0x9e,0x9d,0x9c,0x9b,0x9a, /* sqrt(1/c0)..sqrt(1/c7) */
- 0x99,0x98,0x97,0x96,0x95,0x94,0x93,0x92, /* sqrt(1/c8)..sqrt(1/cf) */
- 0x91,0x90,0x8f,0x8e,0x8d,0x8c,0x8c,0x8b, /* sqrt(1/d0)..sqrt(1/d7) */
- 0x8a,0x89,0x88,0x87,0x86,0x85,0x84,0x83, /* sqrt(1/d8)..sqrt(1/df) */
- 0x83,0x82,0x81,0x80,0x7f,0x7e,0x7e,0x7d, /* sqrt(1/e0)..sqrt(1/e7) */
- 0x7c,0x7b,0x7a,0x79,0x79,0x78,0x77,0x76, /* sqrt(1/e8)..sqrt(1/ef) */
- 0x76,0x75,0x74,0x73,0x72,0x72,0x71,0x70, /* sqrt(1/f0)..sqrt(1/f7) */
- 0x6f,0x6f,0x6e,0x6d,0x6d,0x6c,0x6b,0x6a, /* sqrt(1/f8)..sqrt(1/ff) */
- 0x6a,0x69,0x68,0x68,0x67,0x66,0x66,0x65, /* sqrt(1/100)..sqrt(1/107) */
- 0x64,0x64,0x63,0x62,0x62,0x61,0x60,0x60, /* sqrt(1/108)..sqrt(1/10f) */
- 0x5f,0x5e,0x5e,0x5d,0x5c,0x5c,0x5b,0x5a, /* sqrt(1/110)..sqrt(1/117) */
- 0x5a,0x59,0x59,0x58,0x57,0x57,0x56,0x56, /* sqrt(1/118)..sqrt(1/11f) */
- 0x55,0x54,0x54,0x53,0x53,0x52,0x52,0x51, /* sqrt(1/120)..sqrt(1/127) */
- 0x50,0x50,0x4f,0x4f,0x4e,0x4e,0x4d,0x4d, /* sqrt(1/128)..sqrt(1/12f) */
- 0x4c,0x4b,0x4b,0x4a,0x4a,0x49,0x49,0x48, /* sqrt(1/130)..sqrt(1/137) */
- 0x48,0x47,0x47,0x46,0x46,0x45,0x45,0x44, /* sqrt(1/138)..sqrt(1/13f) */
- 0x44,0x43,0x43,0x42,0x42,0x41,0x41,0x40, /* sqrt(1/140)..sqrt(1/147) */
- 0x40,0x3f,0x3f,0x3e,0x3e,0x3d,0x3d,0x3c, /* sqrt(1/148)..sqrt(1/14f) */
- 0x3c,0x3b,0x3b,0x3a,0x3a,0x39,0x39,0x39, /* sqrt(1/150)..sqrt(1/157) */
- 0x38,0x38,0x37,0x37,0x36,0x36,0x35,0x35, /* sqrt(1/158)..sqrt(1/15f) */
- 0x35,0x34,0x34,0x33,0x33,0x32,0x32,0x32, /* sqrt(1/160)..sqrt(1/167) */
- 0x31,0x31,0x30,0x30,0x2f,0x2f,0x2f,0x2e, /* sqrt(1/168)..sqrt(1/16f) */
- 0x2e,0x2d,0x2d,0x2d,0x2c,0x2c,0x2b,0x2b, /* sqrt(1/170)..sqrt(1/177) */
- 0x2b,0x2a,0x2a,0x29,0x29,0x29,0x28,0x28, /* sqrt(1/178)..sqrt(1/17f) */
- 0x27,0x27,0x27,0x26,0x26,0x26,0x25,0x25, /* sqrt(1/180)..sqrt(1/187) */
- 0x24,0x24,0x24,0x23,0x23,0x23,0x22,0x22, /* sqrt(1/188)..sqrt(1/18f) */
- 0x21,0x21,0x21,0x20,0x20,0x20,0x1f,0x1f, /* sqrt(1/190)..sqrt(1/197) */
- 0x1f,0x1e,0x1e,0x1e,0x1d,0x1d,0x1d,0x1c, /* sqrt(1/198)..sqrt(1/19f) */
- 0x1c,0x1b,0x1b,0x1b,0x1a,0x1a,0x1a,0x19, /* sqrt(1/1a0)..sqrt(1/1a7) */
- 0x19,0x19,0x18,0x18,0x18,0x18,0x17,0x17, /* sqrt(1/1a8)..sqrt(1/1af) */
- 0x17,0x16,0x16,0x16,0x15,0x15,0x15,0x14, /* sqrt(1/1b0)..sqrt(1/1b7) */
- 0x14,0x14,0x13,0x13,0x13,0x12,0x12,0x12, /* sqrt(1/1b8)..sqrt(1/1bf) */
- 0x12,0x11,0x11,0x11,0x10,0x10,0x10,0x0f, /* sqrt(1/1c0)..sqrt(1/1c7) */
- 0x0f,0x0f,0x0f,0x0e,0x0e,0x0e,0x0d,0x0d, /* sqrt(1/1c8)..sqrt(1/1cf) */
- 0x0d,0x0c,0x0c,0x0c,0x0c,0x0b,0x0b,0x0b, /* sqrt(1/1d0)..sqrt(1/1d7) */
- 0x0a,0x0a,0x0a,0x0a,0x09,0x09,0x09,0x09, /* sqrt(1/1d8)..sqrt(1/1df) */
- 0x08,0x08,0x08,0x07,0x07,0x07,0x07,0x06, /* sqrt(1/1e0)..sqrt(1/1e7) */
- 0x06,0x06,0x06,0x05,0x05,0x05,0x04,0x04, /* sqrt(1/1e8)..sqrt(1/1ef) */
- 0x04,0x04,0x03,0x03,0x03,0x03,0x02,0x02, /* sqrt(1/1f0)..sqrt(1/1f7) */
- 0x02,0x02,0x01,0x01,0x01,0x01,0x00,0x00 /* sqrt(1/1f8)..sqrt(1/1ff) */
+ 0x1ff,0x1fd,0x1fb,0x1f9,0x1f7,0x1f5,0x1f3,0x1f2, /* sqrt(1/80)..sqrt(1/87) */
+ 0x1f0,0x1ee,0x1ec,0x1ea,0x1e9,0x1e7,0x1e5,0x1e4, /* sqrt(1/88)..sqrt(1/8f) */
+ 0x1e2,0x1e0,0x1df,0x1dd,0x1db,0x1da,0x1d8,0x1d7, /* sqrt(1/90)..sqrt(1/97) */
+ 0x1d5,0x1d4,0x1d2,0x1d1,0x1cf,0x1ce,0x1cc,0x1cb, /* sqrt(1/98)..sqrt(1/9f) */
+ 0x1c9,0x1c8,0x1c6,0x1c5,0x1c4,0x1c2,0x1c1,0x1c0, /* sqrt(1/a0)..sqrt(1/a7) */
+ 0x1be,0x1bd,0x1bc,0x1ba,0x1b9,0x1b8,0x1b7,0x1b5, /* sqrt(1/a8)..sqrt(1/af) */
+ 0x1b4,0x1b3,0x1b2,0x1b0,0x1af,0x1ae,0x1ad,0x1ac, /* sqrt(1/b0)..sqrt(1/b7) */
+ 0x1aa,0x1a9,0x1a8,0x1a7,0x1a6,0x1a5,0x1a4,0x1a3, /* sqrt(1/b8)..sqrt(1/bf) */
+ 0x1a2,0x1a0,0x19f,0x19e,0x19d,0x19c,0x19b,0x19a, /* sqrt(1/c0)..sqrt(1/c7) */
+ 0x199,0x198,0x197,0x196,0x195,0x194,0x193,0x192, /* sqrt(1/c8)..sqrt(1/cf) */
+ 0x191,0x190,0x18f,0x18e,0x18d,0x18c,0x18c,0x18b, /* sqrt(1/d0)..sqrt(1/d7) */
+ 0x18a,0x189,0x188,0x187,0x186,0x185,0x184,0x183, /* sqrt(1/d8)..sqrt(1/df) */
+ 0x183,0x182,0x181,0x180,0x17f,0x17e,0x17e,0x17d, /* sqrt(1/e0)..sqrt(1/e7) */
+ 0x17c,0x17b,0x17a,0x179,0x179,0x178,0x177,0x176, /* sqrt(1/e8)..sqrt(1/ef) */
+ 0x176,0x175,0x174,0x173,0x172,0x172,0x171,0x170, /* sqrt(1/f0)..sqrt(1/f7) */
+ 0x16f,0x16f,0x16e,0x16d,0x16d,0x16c,0x16b,0x16a, /* sqrt(1/f8)..sqrt(1/ff) */
+ 0x16a,0x169,0x168,0x168,0x167,0x166,0x166,0x165, /* sqrt(1/100)..sqrt(1/107) */
+ 0x164,0x164,0x163,0x162,0x162,0x161,0x160,0x160, /* sqrt(1/108)..sqrt(1/10f) */
+ 0x15f,0x15e,0x15e,0x15d,0x15c,0x15c,0x15b,0x15a, /* sqrt(1/110)..sqrt(1/117) */
+ 0x15a,0x159,0x159,0x158,0x157,0x157,0x156,0x156, /* sqrt(1/118)..sqrt(1/11f) */
+ 0x155,0x154,0x154,0x153,0x153,0x152,0x152,0x151, /* sqrt(1/120)..sqrt(1/127) */
+ 0x150,0x150,0x14f,0x14f,0x14e,0x14e,0x14d,0x14d, /* sqrt(1/128)..sqrt(1/12f) */
+ 0x14c,0x14b,0x14b,0x14a,0x14a,0x149,0x149,0x148, /* sqrt(1/130)..sqrt(1/137) */
+ 0x148,0x147,0x147,0x146,0x146,0x145,0x145,0x144, /* sqrt(1/138)..sqrt(1/13f) */
+ 0x144,0x143,0x143,0x142,0x142,0x141,0x141,0x140, /* sqrt(1/140)..sqrt(1/147) */
+ 0x140,0x13f,0x13f,0x13e,0x13e,0x13d,0x13d,0x13c, /* sqrt(1/148)..sqrt(1/14f) */
+ 0x13c,0x13b,0x13b,0x13a,0x13a,0x139,0x139,0x139, /* sqrt(1/150)..sqrt(1/157) */
+ 0x138,0x138,0x137,0x137,0x136,0x136,0x135,0x135, /* sqrt(1/158)..sqrt(1/15f) */
+ 0x135,0x134,0x134,0x133,0x133,0x132,0x132,0x132, /* sqrt(1/160)..sqrt(1/167) */
+ 0x131,0x131,0x130,0x130,0x12f,0x12f,0x12f,0x12e, /* sqrt(1/168)..sqrt(1/16f) */
+ 0x12e,0x12d,0x12d,0x12d,0x12c,0x12c,0x12b,0x12b, /* sqrt(1/170)..sqrt(1/177) */
+ 0x12b,0x12a,0x12a,0x129,0x129,0x129,0x128,0x128, /* sqrt(1/178)..sqrt(1/17f) */
+ 0x127,0x127,0x127,0x126,0x126,0x126,0x125,0x125, /* sqrt(1/180)..sqrt(1/187) */
+ 0x124,0x124,0x124,0x123,0x123,0x123,0x122,0x122, /* sqrt(1/188)..sqrt(1/18f) */
+ 0x121,0x121,0x121,0x120,0x120,0x120,0x11f,0x11f, /* sqrt(1/190)..sqrt(1/197) */
+ 0x11f,0x11e,0x11e,0x11e,0x11d,0x11d,0x11d,0x11c, /* sqrt(1/198)..sqrt(1/19f) */
+ 0x11c,0x11b,0x11b,0x11b,0x11a,0x11a,0x11a,0x119, /* sqrt(1/1a0)..sqrt(1/1a7) */
+ 0x119,0x119,0x118,0x118,0x118,0x118,0x117,0x117, /* sqrt(1/1a8)..sqrt(1/1af) */
+ 0x117,0x116,0x116,0x116,0x115,0x115,0x115,0x114, /* sqrt(1/1b0)..sqrt(1/1b7) */
+ 0x114,0x114,0x113,0x113,0x113,0x112,0x112,0x112, /* sqrt(1/1b8)..sqrt(1/1bf) */
+ 0x112,0x111,0x111,0x111,0x110,0x110,0x110,0x10f, /* sqrt(1/1c0)..sqrt(1/1c7) */
+ 0x10f,0x10f,0x10f,0x10e,0x10e,0x10e,0x10d,0x10d, /* sqrt(1/1c8)..sqrt(1/1cf) */
+ 0x10d,0x10c,0x10c,0x10c,0x10c,0x10b,0x10b,0x10b, /* sqrt(1/1d0)..sqrt(1/1d7) */
+ 0x10a,0x10a,0x10a,0x10a,0x109,0x109,0x109,0x109, /* sqrt(1/1d8)..sqrt(1/1df) */
+ 0x108,0x108,0x108,0x107,0x107,0x107,0x107,0x106, /* sqrt(1/1e0)..sqrt(1/1e7) */
+ 0x106,0x106,0x106,0x105,0x105,0x105,0x104,0x104, /* sqrt(1/1e8)..sqrt(1/1ef) */
+ 0x104,0x104,0x103,0x103,0x103,0x103,0x102,0x102, /* sqrt(1/1f0)..sqrt(1/1f7) */
+ 0x102,0x102,0x101,0x101,0x101,0x101,0x100,0x100 /* sqrt(1/1f8)..sqrt(1/1ff) */
};
/* Compute s = floor(sqrt(a0)), and *rp = a0 - s^2. */
#if GMP_NUMB_BITS > 32
-#define MAGIC CNST_LIMB(0x10000000000) /* 0xffe7debbfc < MAGIC < 0x232b1850f410 */
+#define MAGIC 0x10000000000 /* 0xffe7debbfc < MAGIC < 0x232b1850f410 */
#else
-#define MAGIC CNST_LIMB(0x100000) /* 0xfee6f < MAGIC < 0x29cbc8 */
+#define MAGIC 0x100000 /* 0xfee6f < MAGIC < 0x29cbc8 */
#endif
static mp_limb_t
@@ -126,16 +115,16 @@ mpn_sqrtrem1 (mp_ptr rp, mp_limb_t a0)
iteration convert from 1/sqrt(a) to sqrt(a). */
abits = a0 >> (GMP_LIMB_BITS - 1 - 8); /* extract bits for table lookup */
- x0 = 0x100 | invsqrttab[abits - 0x80]; /* initial 1/sqrt(a) */
+ x0 = invsqrttab[abits - 0x80]; /* initial 1/sqrt(a) */
/* x0 is now an 8 bits approximation of 1/sqrt(a0) */
#if GMP_NUMB_BITS > 32
a1 = a0 >> (GMP_LIMB_BITS - 1 - 32);
- t = (mp_limb_signed_t) (CNST_LIMB(0x2000000000000) - 0x30000 - a1 * x0 * x0) >> 16;
+ t = (mp_limb_signed_t) (0x2000000000000l - 0x30000 - a1 * x0 * x0) >> 16;
x0 = (x0 << 16) + ((mp_limb_signed_t) (x0 * t) >> (16+2));
- /* x0 is now a 16 bits approximation of 1/sqrt(a0) */
+ /* x0 is now an 16 bits approximation of 1/sqrt(a0) */
t2 = x0 * (a0 >> (32-8));
t = t2 >> 25;
@@ -250,18 +239,14 @@ mpn_dc_sqrtrem (mp_ptr sp, mp_ptr np, mp_size_t n)
q >>= 1;
if (c != 0)
c = mpn_add_n (np + l, np + l, sp + l, h);
- mpn_sqr (np + n, sp, l);
+ mpn_sqr_n (np + n, sp, l);
b = q + mpn_sub_n (np, np, np + n, 2 * l);
c -= (l == h) ? b : mpn_sub_1 (np + 2 * l, np + 2 * l, 1, (mp_limb_t) b);
q = mpn_add_1 (sp + l, sp + l, h, q);
if (c < 0)
{
-#if HAVE_NATIVE_mpn_addlsh1_n
- c += mpn_addlsh1_n (np, np, sp, n) + 2 * q;
-#else
c += mpn_addmul_1 (np, sp, n, CNST_LIMB(2)) + 2 * q;
-#endif
c -= mpn_sub_1 (np, np, n, CNST_LIMB(1));
q -= mpn_sub_1 (sp, sp, n, CNST_LIMB(1));
}
diff --git a/gmp/mpn/generic/sub.c b/gmp/mpn/generic/sub.c
index 3fbcbbe98b..ada3e91b83 100644
--- a/gmp/mpn/generic/sub.c
+++ b/gmp/mpn/generic/sub.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpn_sub 1
diff --git a/gmp/mpn/generic/sub_1.c b/gmp/mpn/generic/sub_1.c
index db2e6f948f..4ed2eabccb 100644
--- a/gmp/mpn/generic/sub_1.c
+++ b/gmp/mpn/generic/sub_1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpn_sub_1 1
diff --git a/gmp/mpn/generic/sub_err1_n.c b/gmp/mpn/generic/sub_err1_n.c
deleted file mode 100644
index 340313a323..0000000000
--- a/gmp/mpn/generic/sub_err1_n.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* mpn_sub_err1_n -- sub_n with one error term
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- Computes:
-
- (1) {rp,n} := {up,n} - {vp,n} (just like mpn_sub_n) with incoming borrow cy,
- return value is borrow out.
-
- (2) Let c[i+1] = borrow from i-th limb subtraction (c[0] = cy).
- Computes c[1]*yp[n-1] + ... + c[n]*yp[0], stores two-limb result at ep.
-
- Requires n >= 1.
-
- None of the outputs may overlap each other or any of the inputs, except
- that {rp,n} may be equal to {up,n} or {vp,n}.
-*/
-mp_limb_t
-mpn_sub_err1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_ptr ep, mp_srcptr yp,
- mp_size_t n, mp_limb_t cy)
-{
- mp_limb_t el, eh, ul, vl, yl, zl, rl, sl, cy1, cy2;
-
- ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, up, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, vp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, yp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 2, rp, n));
-
- yp += n - 1;
- el = eh = 0;
-
- do
- {
- yl = *yp--;
- ul = *up++;
- vl = *vp++;
-
- /* ordinary sub_n */
- SUBC_LIMB (cy1, sl, ul, vl);
- SUBC_LIMB (cy2, rl, sl, cy);
- cy = cy1 | cy2;
- *rp++ = rl;
-
- /* update (eh:el) */
- zl = (-cy) & yl;
- el += zl;
- eh += el < zl;
- }
- while (--n);
-
-#if GMP_NAIL_BITS != 0
- eh = (eh << GMP_NAIL_BITS) + (el >> GMP_NUMB_BITS);
- el &= GMP_NUMB_MASK;
-#endif
-
- ep[0] = el;
- ep[1] = eh;
-
- return cy;
-}
diff --git a/gmp/mpn/generic/sub_err2_n.c b/gmp/mpn/generic/sub_err2_n.c
deleted file mode 100644
index 63ea2451b4..0000000000
--- a/gmp/mpn/generic/sub_err2_n.c
+++ /dev/null
@@ -1,117 +0,0 @@
-/* mpn_sub_err2_n -- sub_n with two error terms
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- Computes:
-
- (1) {rp,n} := {up,n} - {vp,n} (just like mpn_sub_n) with incoming borrow cy,
- return value is borrow out.
-
- (2) Let c[i+1] = borrow from i-th limb subtraction (c[0] = cy).
- Computes c[1]*yp1[n-1] + ... + c[n]*yp1[0],
- c[1]*yp2[n-1] + ... + c[n]*yp2[0],
- stores two-limb results at {ep,2} and {ep+2,2} respectively.
-
- Requires n >= 1.
-
- None of the outputs may overlap each other or any of the inputs, except
- that {rp,n} may be equal to {up,n} or {vp,n}.
-*/
-mp_limb_t
-mpn_sub_err2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_ptr ep, mp_srcptr yp1, mp_srcptr yp2,
- mp_size_t n, mp_limb_t cy)
-{
- mp_limb_t el1, eh1, el2, eh2, ul, vl, yl1, yl2, zl1, zl2, rl, sl, cy1, cy2;
-
- ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp1, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp2, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, up, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, vp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, yp1, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, yp2, n));
- ASSERT (! MPN_OVERLAP_P (ep, 4, rp, n));
-
- yp1 += n - 1;
- yp2 += n - 1;
- el1 = eh1 = 0;
- el2 = eh2 = 0;
-
- do
- {
- yl1 = *yp1--;
- yl2 = *yp2--;
- ul = *up++;
- vl = *vp++;
-
- /* ordinary sub_n */
- SUBC_LIMB (cy1, sl, ul, vl);
- SUBC_LIMB (cy2, rl, sl, cy);
- cy = cy1 | cy2;
- *rp++ = rl;
-
- /* update (eh1:el1) */
- zl1 = (-cy) & yl1;
- el1 += zl1;
- eh1 += el1 < zl1;
-
- /* update (eh2:el2) */
- zl2 = (-cy) & yl2;
- el2 += zl2;
- eh2 += el2 < zl2;
- }
- while (--n);
-
-#if GMP_NAIL_BITS != 0
- eh1 = (eh1 << GMP_NAIL_BITS) + (el1 >> GMP_NUMB_BITS);
- el1 &= GMP_NUMB_MASK;
- eh2 = (eh2 << GMP_NAIL_BITS) + (el2 >> GMP_NUMB_BITS);
- el2 &= GMP_NUMB_MASK;
-#endif
-
- ep[0] = el1;
- ep[1] = eh1;
- ep[2] = el2;
- ep[3] = eh2;
-
- return cy;
-}
diff --git a/gmp/mpn/generic/sub_err3_n.c b/gmp/mpn/generic/sub_err3_n.c
deleted file mode 100644
index a80e05d0d9..0000000000
--- a/gmp/mpn/generic/sub_err3_n.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* mpn_sub_err3_n -- sub_n with three error terms
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*
- Computes:
-
- (1) {rp,n} := {up,n} - {vp,n} (just like mpn_sub_n) with incoming borrow cy,
- return value is borrow out.
-
- (2) Let c[i+1] = borrow from i-th limb subtraction (c[0] = cy).
- Computes c[1]*yp1[n-1] + ... + c[n]*yp1[0],
- c[1]*yp2[n-1] + ... + c[n]*yp2[0],
- c[1]*yp3[n-1] + ... + c[n]*yp3[0],
- stores two-limb results at {ep,2}, {ep+2,2} and {ep+4,2} respectively.
-
- Requires n >= 1.
-
- None of the outputs may overlap each other or any of the inputs, except
- that {rp,n} may be equal to {up,n} or {vp,n}.
-*/
-mp_limb_t
-mpn_sub_err3_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_ptr ep, mp_srcptr yp1, mp_srcptr yp2, mp_srcptr yp3,
- mp_size_t n, mp_limb_t cy)
-{
- mp_limb_t el1, eh1, el2, eh2, el3, eh3, ul, vl, yl1, yl2, yl3, zl1, zl2, zl3, rl, sl, cy1, cy2;
-
- ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
- ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp1, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp2, n));
- ASSERT (! MPN_OVERLAP_P (rp, n, yp3, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, up, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, vp, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, yp1, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, yp2, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, yp3, n));
- ASSERT (! MPN_OVERLAP_P (ep, 6, rp, n));
-
- yp1 += n - 1;
- yp2 += n - 1;
- yp3 += n - 1;
- el1 = eh1 = 0;
- el2 = eh2 = 0;
- el3 = eh3 = 0;
-
- do
- {
- yl1 = *yp1--;
- yl2 = *yp2--;
- yl3 = *yp3--;
- ul = *up++;
- vl = *vp++;
-
- /* ordinary sub_n */
- SUBC_LIMB (cy1, sl, ul, vl);
- SUBC_LIMB (cy2, rl, sl, cy);
- cy = cy1 | cy2;
- *rp++ = rl;
-
- /* update (eh1:el1) */
- zl1 = (-cy) & yl1;
- el1 += zl1;
- eh1 += el1 < zl1;
-
- /* update (eh2:el2) */
- zl2 = (-cy) & yl2;
- el2 += zl2;
- eh2 += el2 < zl2;
-
- /* update (eh3:el3) */
- zl3 = (-cy) & yl3;
- el3 += zl3;
- eh3 += el3 < zl3;
- }
- while (--n);
-
-#if GMP_NAIL_BITS != 0
- eh1 = (eh1 << GMP_NAIL_BITS) + (el1 >> GMP_NUMB_BITS);
- el1 &= GMP_NUMB_MASK;
- eh2 = (eh2 << GMP_NAIL_BITS) + (el2 >> GMP_NUMB_BITS);
- el2 &= GMP_NUMB_MASK;
- eh3 = (eh3 << GMP_NAIL_BITS) + (el3 >> GMP_NUMB_BITS);
- el3 &= GMP_NUMB_MASK;
-#endif
-
- ep[0] = el1;
- ep[1] = eh1;
- ep[2] = el2;
- ep[3] = eh2;
- ep[4] = el3;
- ep[5] = eh3;
-
- return cy;
-}
diff --git a/gmp/mpn/generic/sub_n.c b/gmp/mpn/generic/sub_n.c
index 29de2d2d89..d33668fa86 100644
--- a/gmp/mpn/generic/sub_n.c
+++ b/gmp/mpn/generic/sub_n.c
@@ -1,32 +1,21 @@
/* mpn_sub_n -- Subtract equal length limb vectors.
-Copyright 1992-1994, 1996, 2000, 2002, 2009 Free Software Foundation, Inc.
+Copyright 1992, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,8 +29,8 @@ mpn_sub_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
mp_limb_t ul, vl, sl, rl, cy, cy1, cy2;
ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_INCR_P (rp, up, n));
- ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
cy = 0;
do
@@ -70,8 +59,8 @@ mpn_sub_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
mp_limb_t ul, vl, rl, cy;
ASSERT (n >= 1);
- ASSERT (MPN_SAME_OR_INCR_P (rp, up, n));
- ASSERT (MPN_SAME_OR_INCR_P (rp, vp, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, up, n));
+ ASSERT (MPN_SAME_OR_SEPARATE_P (rp, vp, n));
cy = 0;
do
diff --git a/gmp/mpn/generic/subcnd_n.c b/gmp/mpn/generic/subcnd_n.c
new file mode 100644
index 0000000000..0dcc45641d
--- /dev/null
+++ b/gmp/mpn/generic/subcnd_n.c
@@ -0,0 +1,85 @@
+/* mpn_subcnd_n -- Compute R = U - V if CND != 0 or R = U if CND == 0.
+
+ 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 Free Software
+Foundation, Inc.
+
+This file is part of the GNU MP Library.
+
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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"
+
+
+#if GMP_NAIL_BITS == 0
+
+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;
+ sl = ul - vl;
+ cy1 = sl > ul;
+ rl = sl - cy;
+ cy2 = rl > sl;
+ cy = cy1 | cy2;
+ *rp++ = rl;
+ }
+ while (--n != 0);
+
+ return cy;
+}
+
+#endif
+
+#if GMP_NAIL_BITS >= 1
+
+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, rl, cy, 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;
+ rl = ul - vl - cy;
+ cy = rl >> (GMP_LIMB_BITS - 1);
+ *rp++ = rl & GMP_NUMB_MASK;
+ }
+ while (--n != 0);
+
+ return cy;
+}
+
+#endif
diff --git a/gmp/mpn/generic/submul_1.c b/gmp/mpn/generic/submul_1.c
index fbc3501389..3e8e74302d 100644
--- a/gmp/mpn/generic/submul_1.c
+++ b/gmp/mpn/generic/submul_1.c
@@ -3,33 +3,23 @@
vector pointed to by RP. Return the most significant limb of the
product, adjusted for carry-out from the subtraction.
-Copyright 1992-1994, 1996, 2000, 2002, 2004 Free Software Foundation, Inc.
+Copyright 1992, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/generic/tdiv_qr.c b/gmp/mpn/generic/tdiv_qr.c
index be213b0467..8ac4d38813 100644
--- a/gmp/mpn/generic/tdiv_qr.c
+++ b/gmp/mpn/generic/tdiv_qr.c
@@ -1,43 +1,33 @@
/* mpn_tdiv_qr -- Divide the numerator (np,nn) by the denominator (dp,dn) and
write the nn-dn+1 quotient limbs at qp and the dn remainder limbs at rp. If
qxn is non-zero, generate that many fraction limbs and append them after the
- other quotient limbs, and update the remainder accordingly. The input
+ other quotient limbs, and update the remainder accordningly. The input
operands are unaffected.
Preconditions:
1. The most significant limb of of the divisor must be non-zero.
- 2. nn >= dn, even if qxn is non-zero. (??? relax this ???)
+ 2. No argument overlap is permitted. (??? relax this ???)
+ 3. nn >= dn, even if qxn is non-zero. (??? relax this ???)
The time complexity of this is O(qn*qn+M(dn,qn)), where M(m,n) is the time
complexity of multiplication.
-Copyright 1997, 2000-2002, 2005, 2009 Free Software Foundation, Inc.
+Copyright 1997, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -48,8 +38,13 @@ void
mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn)
{
+ /* FIXME:
+ 1. qxn
+ 2. pass allocated storage in additional parameter?
+ */
ASSERT_ALWAYS (qxn == 0);
+ ASSERT (qxn >= 0);
ASSERT (nn >= 0);
ASSERT (dn >= 0);
ASSERT (dn == 0 || dp[dn - 1] != 0);
@@ -63,7 +58,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
case 1:
{
- rp[0] = mpn_divrem_1 (qp, (mp_size_t) 0, np, nn, dp[0]);
+ rp[0] = mpn_divmod_1 (qp, np, nn, dp[0]);
return;
}
@@ -82,7 +77,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
d2p = dtmp;
d2p[1] = (dp[1] << cnt) | (dp[0] >> (GMP_NUMB_BITS - cnt));
d2p[0] = (dp[0] << cnt) & GMP_NUMB_MASK;
- n2p = TMP_ALLOC_LIMBS (nn + 1);
+ n2p = (mp_ptr) TMP_ALLOC ((nn + 1) * BYTES_PER_MP_LIMB);
cy = mpn_lshift (n2p, np, nn, cnt);
n2p[nn] = cy;
qhl = mpn_divrem_2 (qp, 0L, n2p, nn + (cy != 0), d2p);
@@ -95,7 +90,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
else
{
d2p = (mp_ptr) dp;
- n2p = TMP_ALLOC_LIMBS (nn);
+ n2p = (mp_ptr) TMP_ALLOC (nn * BYTES_PER_MP_LIMB);
MPN_COPY (n2p, np, nn);
qhl = mpn_divrem_2 (qp, 0L, n2p, nn, d2p);
qp[nn - 2] = qhl; /* always store nn-2+1 quotient limbs */
@@ -109,13 +104,12 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
default:
{
int adjust;
- gmp_pi1_t dinv;
TMP_DECL;
TMP_MARK;
adjust = np[nn - 1] >= dp[dn - 1]; /* conservative tests for quotient size */
if (nn + adjust >= 2 * dn)
{
- mp_ptr n2p, d2p;
+ mp_ptr n2p, d2p, q2p;
mp_limb_t cy;
int cnt;
@@ -124,9 +118,9 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
{
count_leading_zeros (cnt, dp[dn - 1]);
cnt -= GMP_NAIL_BITS;
- d2p = TMP_ALLOC_LIMBS (dn);
+ d2p = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB);
mpn_lshift (d2p, dp, dn, cnt);
- n2p = TMP_ALLOC_LIMBS (nn + 1);
+ n2p = (mp_ptr) TMP_ALLOC ((nn + 1) * BYTES_PER_MP_LIMB);
cy = mpn_lshift (n2p, np, nn, cnt);
n2p[nn] = cy;
nn += adjust;
@@ -135,28 +129,51 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
{
cnt = 0;
d2p = (mp_ptr) dp;
- n2p = TMP_ALLOC_LIMBS (nn + 1);
+ n2p = (mp_ptr) TMP_ALLOC ((nn + 1) * BYTES_PER_MP_LIMB);
MPN_COPY (n2p, np, nn);
n2p[nn] = 0;
nn += adjust;
}
- invert_pi1 (dinv, d2p[dn - 1], d2p[dn - 2]);
- if (BELOW_THRESHOLD (dn, DC_DIV_QR_THRESHOLD))
- mpn_sbpi1_div_qr (qp, n2p, nn, d2p, 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... */
- + (double) MUPI_DIV_QR_THRESHOLD * nn > (double) dn * nn) /* ...condition */
- mpn_dcpi1_div_qr (qp, n2p, nn, d2p, dn, &dinv);
+ if (dn < DIV_DC_THRESHOLD)
+ mpn_sb_divrem_mn (qp, n2p, nn, d2p, dn);
else
{
- mp_size_t itch = mpn_mu_div_qr_itch (nn, dn, 0);
- mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
- mpn_mu_div_qr (qp, rp, n2p, nn, d2p, dn, scratch);
- n2p = rp;
+ /* Divide 2*dn / dn limbs as long as the limbs in np last. */
+ q2p = qp + nn - dn;
+ n2p += nn - dn;
+ do
+ {
+ q2p -= dn; n2p -= dn;
+ mpn_dc_divrem_n (q2p, n2p, d2p, dn);
+ nn -= dn;
+ }
+ while (nn >= 2 * dn);
+
+ if (nn != dn)
+ {
+ mp_limb_t ql;
+ n2p -= nn - dn;
+
+ /* We have now dn < nn - dn < 2dn. Make a recursive call,
+ since falling out to the code below isn't pretty.
+ Unfortunately, mpn_tdiv_qr returns nn-dn+1 quotient
+ limbs, which would overwrite one already generated
+ quotient limbs. Preserve it with an ugly hack. */
+ /* FIXME: This suggests that we should have an
+ mpn_tdiv_qr_internal that instead returns the most
+ significant quotient limb and move the meat of this
+ function there. */
+ /* FIXME: Perhaps call mpn_sb_divrem_mn here for certain
+ operand ranges, to decrease overhead for small
+ operands? */
+ ql = qp[nn - dn]; /* preserve quotient limb... */
+ mpn_tdiv_qr (qp, n2p, 0L, n2p, nn, d2p, dn);
+ qp[nn - dn] = ql; /* ...restore it again */
+ }
}
+
if (cnt != 0)
mpn_rshift (rp, n2p, dn, cnt);
else
@@ -229,11 +246,11 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
count_leading_zeros (cnt, dp[dn - 1]);
cnt -= GMP_NAIL_BITS;
- d2p = TMP_ALLOC_LIMBS (qn);
+ d2p = (mp_ptr) TMP_ALLOC (qn * BYTES_PER_MP_LIMB);
mpn_lshift (d2p, dp + in, qn, cnt);
d2p[0] |= dp[in - 1] >> (GMP_NUMB_BITS - cnt);
- n2p = TMP_ALLOC_LIMBS (2 * qn + 1);
+ n2p = (mp_ptr) TMP_ALLOC ((2 * qn + 1) * BYTES_PER_MP_LIMB);
cy = mpn_lshift (n2p, np + nn - 2 * qn, 2 * qn, cnt);
if (adjust)
{
@@ -250,7 +267,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
cnt = 0;
d2p = (mp_ptr) dp + in;
- n2p = TMP_ALLOC_LIMBS (2 * qn + 1);
+ n2p = (mp_ptr) TMP_ALLOC ((2 * qn + 1) * BYTES_PER_MP_LIMB);
MPN_COPY (n2p, np + nn - 2 * qn, 2 * qn);
if (adjust)
{
@@ -263,30 +280,25 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
if (qn == 1)
{
mp_limb_t q0, r0;
- udiv_qrnnd (q0, r0, n2p[1], n2p[0] << GMP_NAIL_BITS, d2p[0] << GMP_NAIL_BITS);
- n2p[0] = r0 >> GMP_NAIL_BITS;
+ mp_limb_t gcc272bug_n1, gcc272bug_n0, gcc272bug_d0;
+ /* Due to a gcc 2.7.2.3 reload pass bug, we have to use some
+ temps here. This doesn't hurt code quality on any machines
+ so we do it unconditionally. */
+ gcc272bug_n1 = n2p[1];
+ gcc272bug_n0 = n2p[0];
+ gcc272bug_d0 = d2p[0];
+ udiv_qrnnd (q0, r0, gcc272bug_n1, gcc272bug_n0 << GMP_NAIL_BITS,
+ gcc272bug_d0 << GMP_NAIL_BITS);
+ r0 >>= GMP_NAIL_BITS;
+ n2p[0] = r0;
qp[0] = q0;
}
else if (qn == 2)
- mpn_divrem_2 (qp, 0L, n2p, 4L, d2p); /* FIXME: obsolete function */
+ mpn_divrem_2 (qp, 0L, n2p, 4L, d2p);
+ else if (qn < DIV_DC_THRESHOLD)
+ mpn_sb_divrem_mn (qp, n2p, 2 * qn, d2p, qn);
else
- {
- invert_pi1 (dinv, d2p[qn - 1], d2p[qn - 2]);
- if (BELOW_THRESHOLD (qn, DC_DIV_QR_THRESHOLD))
- mpn_sbpi1_div_qr (qp, n2p, 2 * qn, d2p, qn, dinv.inv32);
- else if (BELOW_THRESHOLD (qn, MU_DIV_QR_THRESHOLD))
- mpn_dcpi1_div_qr (qp, n2p, 2 * qn, d2p, qn, &dinv);
- else
- {
- mp_size_t itch = mpn_mu_div_qr_itch (2 * qn, qn, 0);
- mp_ptr scratch = TMP_ALLOC_LIMBS (itch);
- mp_ptr r2p = rp;
- if (np == r2p) /* If N and R share space, put ... */
- r2p += nn - qn; /* intermediate remainder at N's upper end. */
- mpn_mu_div_qr (qp, r2p, n2p, 2 * qn, d2p, qn, scratch);
- MPN_COPY (n2p, r2p, qn);
- }
- }
+ mpn_dc_divrem_n (qp, n2p, d2p, qn);
rn = qn;
/* Multiply the first ignored divisor limb by the most significant
@@ -304,7 +316,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
dl = dp[in - 2];
#if GMP_NAIL_BITS == 0
- x = (dp[in - 1] << cnt) | ((dl >> 1) >> ((~cnt) % GMP_LIMB_BITS));
+ x = (dp[in - 1] << cnt) | ((dl >> 1) >> ((~cnt) % BITS_PER_MP_LIMB));
#else
x = (dp[in - 1] << cnt) & GMP_NUMB_MASK;
if (cnt != 0)
@@ -354,7 +366,7 @@ mpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
}
/* True: partial remainder now is neutral, i.e., it is not shifted up. */
- tp = TMP_ALLOC_LIMBS (dn);
+ tp = (mp_ptr) TMP_ALLOC (dn * BYTES_PER_MP_LIMB);
if (in < qn)
{
diff --git a/gmp/mpn/generic/toom22_mul.c b/gmp/mpn/generic/toom22_mul.c
index 36ac29b72d..6407bbeb96 100644
--- a/gmp/mpn/generic/toom22_mul.c
+++ b/gmp/mpn/generic/toom22_mul.c
@@ -7,33 +7,22 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2010, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -52,7 +41,7 @@ see https://www.gnu.org/licenses/. */
vinf= a1 * b1 # A(inf)*B(inf)
*/
-#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
+#if TUNE_PROGRAM_BUILD
#define MAYBE_mul_toom22 1
#else
#define MAYBE_mul_toom22 \
@@ -62,36 +51,18 @@ see https://www.gnu.org/licenses/. */
#define TOOM22_MUL_N_REC(p, a, b, n, ws) \
do { \
if (! MAYBE_mul_toom22 \
- || BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \
+ || BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \
mpn_mul_basecase (p, a, n, b, n); \
else \
mpn_toom22_mul (p, a, n, b, n, ws); \
} while (0)
-/* Normally, this calls mul_basecase or toom22_mul. But when when the fraction
- MUL_TOOM33_THRESHOLD / MUL_TOOM22_THRESHOLD is large, an initially small
- relative unbalance will become a larger and larger relative unbalance with
- each recursion (the difference s-t will be invariant over recursive calls).
- Therefore, we need to call toom32_mul. FIXME: Suppress depending on
- MUL_TOOM33_THRESHOLD / MUL_TOOM22_THRESHOLD and on MUL_TOOM22_THRESHOLD. */
-#define TOOM22_MUL_REC(p, a, an, b, bn, ws) \
- do { \
- if (! MAYBE_mul_toom22 \
- || BELOW_THRESHOLD (bn, MUL_TOOM22_THRESHOLD)) \
- mpn_mul_basecase (p, a, an, b, bn); \
- else if (4 * an < 5 * bn) \
- mpn_toom22_mul (p, a, an, b, bn, ws); \
- else \
- mpn_toom32_mul (p, a, an, b, bn, ws); \
- } while (0)
-
void
mpn_toom22_mul (mp_ptr pp,
mp_srcptr ap, mp_size_t an,
mp_srcptr bp, mp_size_t bn,
mp_ptr scratch)
{
- const int __gmpn_cpuvec_initialized = 1;
mp_size_t n, s, t;
int vm1_neg;
mp_limb_t cy, cy2;
@@ -179,8 +150,8 @@ mpn_toom22_mul (mp_ptr pp,
/* vm1, 2n limbs */
TOOM22_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out);
- if (s > t) TOOM22_MUL_REC (vinf, a1, s, b1, t, scratch_out);
- else TOOM22_MUL_N_REC (vinf, a1, b1, s, scratch_out);
+ /* vinf, s+t limbs */
+ mpn_mul (vinf, a1, s, b1, t);
/* v0, 2n limbs */
TOOM22_MUL_N_REC (v0, ap, bp, n, scratch_out);
diff --git a/gmp/mpn/generic/toom2_sqr.c b/gmp/mpn/generic/toom2_sqr.c
index 2f2fdaee6f..445cff8f5d 100644
--- a/gmp/mpn/generic/toom2_sqr.c
+++ b/gmp/mpn/generic/toom2_sqr.c
@@ -6,33 +6,22 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2010, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -43,23 +32,25 @@ see https://www.gnu.org/licenses/. */
<-s--><--n-->
____ ______
|_a1_|___a0_|
+ |b1_|___b0_|
+ <-t-><--n-->
- v0 = a0 ^2 # A(0)^2
- vm1 = (a0- a1)^2 # A(-1)^2
- vinf= a1 ^2 # A(inf)^2
+ v0 = a0 * b0 # A(0)*B(0)
+ vm1 = (a0- a1)*(b0- b1) # A(-1)*B(-1)
+ vinf= a1 * b1 # A(inf)*B(inf)
*/
-#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
+#if TUNE_PROGRAM_BUILD
#define MAYBE_sqr_toom2 1
#else
#define MAYBE_sqr_toom2 \
(SQR_TOOM3_THRESHOLD >= 2 * SQR_TOOM2_THRESHOLD)
#endif
-#define TOOM2_SQR_REC(p, a, n, ws) \
+#define TOOM2_SQR_N_REC(p, a, n, ws) \
do { \
if (! MAYBE_sqr_toom2 \
- || BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD)) \
+ || BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \
mpn_sqr_basecase (p, a, n); \
else \
mpn_toom2_sqr (p, a, n, ws); \
@@ -70,7 +61,6 @@ mpn_toom2_sqr (mp_ptr pp,
mp_srcptr ap, mp_size_t an,
mp_ptr scratch)
{
- const int __gmpn_cpuvec_initialized = 1;
mp_size_t n, s;
mp_limb_t cy, cy2;
mp_ptr asm1;
@@ -113,16 +103,15 @@ mpn_toom2_sqr (mp_ptr pp,
#define v0 pp /* 2n */
#define vinf (pp + 2 * n) /* s+s */
#define vm1 scratch /* 2n */
-#define scratch_out scratch + 2 * n
/* vm1, 2n limbs */
- TOOM2_SQR_REC (vm1, asm1, n, scratch_out);
+ TOOM2_SQR_N_REC (vm1, asm1, n, scratch);
/* vinf, s+s limbs */
- TOOM2_SQR_REC (vinf, a1, s, scratch_out);
+ TOOM2_SQR_N_REC (vinf, a1, s, scratch);
/* v0, 2n limbs */
- TOOM2_SQR_REC (v0, ap, n, scratch_out);
+ TOOM2_SQR_N_REC (v0, ap, n, scratch);
/* H(v0) + L(vinf) */
cy = mpn_add_n (pp + 2 * n, v0 + n, vinf, n);
diff --git a/gmp/mpn/generic/toom32_mul.c b/gmp/mpn/generic/toom32_mul.c
index 0b05669cc4..7bdd688a53 100644
--- a/gmp/mpn/generic/toom32_mul.c
+++ b/gmp/mpn/generic/toom32_mul.c
@@ -2,7 +2,6 @@
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.
The idea of applying toom to unbalanced multiplication is due to Marco
Bodrato and Alberto Zanoni.
@@ -11,34 +10,32 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2010 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
+it under the terms of the GNU 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 Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License as published by the Free Software
- Foundation; either version 2 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 both in parallel, as here.
-The GNU MP Library is distributed in the hope that 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.
+/*
+ Things to work on:
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+ 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be
+ avoided by instead reusing the pp area and the scratch allocation.
+ 2. Apply optimizations also to mul_toom42.c.
+*/
#include "gmp.h"
#include "gmp-impl.h"
@@ -57,9 +54,20 @@ see https://www.gnu.org/licenses/. */
vinf= a2 * b1 # A(inf)*B(inf)
*/
-#define TOOM32_MUL_N_REC(p, a, b, n, ws) \
+#if TUNE_PROGRAM_BUILD
+#define MAYBE_mul_toom22 1
+#else
+#define MAYBE_mul_toom22 \
+ (MUL_TOOM33_THRESHOLD >= 2 * MUL_TOOM22_THRESHOLD)
+#endif
+
+#define TOOM22_MUL_N_REC(p, a, b, n, ws) \
do { \
- mpn_mul_n (p, a, b, n); \
+ if (! MAYBE_mul_toom22 \
+ || BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \
+ mpn_mul_basecase (p, a, n, b, n); \
+ else \
+ mpn_toom22_mul (p, a, n, b, n, ws); \
} while (0)
void
@@ -70,9 +78,15 @@ mpn_toom32_mul (mp_ptr pp,
{
mp_size_t n, s, t;
int vm1_neg;
+#if HAVE_NATIVE_mpn_add_nc
mp_limb_t cy;
- mp_limb_signed_t hi;
- mp_limb_t ap1_hi, bp1_hi;
+#else
+ mp_limb_t cy, cy2;
+#endif
+ mp_ptr a0_a2;
+ mp_ptr as1, asm1;
+ mp_ptr bs1, bsm1;
+ TMP_DECL;
#define a0 ap
#define a1 (ap + n)
@@ -80,9 +94,6 @@ mpn_toom32_mul (mp_ptr pp,
#define b0 bp
#define b1 (bp + n)
- /* Required, to ensure that s + t >= n. */
- ASSERT (bn + 2 <= an && an + 6 <= 3*bn);
-
n = 1 + (2 * an >= 3 * bn ? (an - 1) / (size_t) 3 : (bn - 1) >> 1);
s = an - 2 * n;
@@ -90,234 +101,191 @@ mpn_toom32_mul (mp_ptr pp,
ASSERT (0 < s && s <= n);
ASSERT (0 < t && t <= n);
- ASSERT (s + t >= n);
- /* Product area of size an + bn = 3*n + s + t >= 4*n + 2. */
-#define ap1 (pp) /* n, most significant limb in ap1_hi */
-#define bp1 (pp + n) /* n, most significant bit in bp1_hi */
-#define am1 (pp + 2*n) /* n, most significant bit in hi */
-#define bm1 (pp + 3*n) /* n */
-#define v1 (scratch) /* 2n + 1 */
-#define vm1 (pp) /* 2n + 1 */
-#define scratch_out (scratch + 2*n + 1) /* Currently unused. */
+ TMP_MARK;
+
+ as1 = TMP_SALLOC_LIMBS (n + 1);
+ asm1 = TMP_SALLOC_LIMBS (n + 1);
- /* Scratch need: 2*n + 1 + scratch for the recursive multiplications. */
+ bs1 = TMP_SALLOC_LIMBS (n + 1);
+ bsm1 = TMP_SALLOC_LIMBS (n);
- /* FIXME: Keep v1[2*n] and vm1[2*n] in scalar variables? */
+ a0_a2 = pp;
- /* Compute ap1 = a0 + a1 + a3, am1 = a0 - a1 + a3 */
- ap1_hi = mpn_add (ap1, a0, n, a2, s);
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (ap1_hi == 0 && mpn_cmp (ap1, a1, n) < 0)
+ /* Compute as1 and asm1. */
+ a0_a2[n] = mpn_add (a0_a2, a0, n, a2, s);
+#if HAVE_NATIVE_mpn_addsub_n
+ if (a0_a2[n] == 0 && mpn_cmp (a0_a2, a1, n) < 0)
{
- ap1_hi = mpn_add_n_sub_n (ap1, am1, a1, ap1, n) >> 1;
- hi = 0;
+ cy = mpn_addsub_n (as1, asm1, a1, a0_a2, n);
+ as1[n] = cy >> 1;
+ asm1[n] = 0;
vm1_neg = 1;
}
else
{
- cy = mpn_add_n_sub_n (ap1, am1, ap1, a1, n);
- hi = ap1_hi - (cy & 1);
- ap1_hi += (cy >> 1);
+ cy = mpn_addsub_n (as1, asm1, a0_a2, a1, n);
+ as1[n] = a0_a2[n] + (cy >> 1);
+ asm1[n] = a0_a2[n] - (cy & 1);
vm1_neg = 0;
}
#else
- if (ap1_hi == 0 && mpn_cmp (ap1, a1, n) < 0)
+ as1[n] = a0_a2[n] + mpn_add_n (as1, a0_a2, a1, n);
+ if (a0_a2[n] == 0 && mpn_cmp (a0_a2, a1, n) < 0)
{
- ASSERT_NOCARRY (mpn_sub_n (am1, a1, ap1, n));
- hi = 0;
+ mpn_sub_n (asm1, a1, a0_a2, n);
+ asm1[n] = 0;
vm1_neg = 1;
}
else
{
- hi = ap1_hi - mpn_sub_n (am1, ap1, a1, n);
+ cy = mpn_sub_n (asm1, a0_a2, a1, n);
+ asm1[n] = a0_a2[n] - cy;
vm1_neg = 0;
}
- ap1_hi += mpn_add_n (ap1, ap1, a1, n);
#endif
- /* Compute bp1 = b0 + b1 and bm1 = b0 - b1. */
+ /* Compute bs1 and bsm1. */
if (t == n)
{
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
if (mpn_cmp (b0, b1, n) < 0)
{
- cy = mpn_add_n_sub_n (bp1, bm1, b1, b0, n);
+ cy = mpn_addsub_n (bs1, bsm1, b1, b0, n);
vm1_neg ^= 1;
}
else
{
- cy = mpn_add_n_sub_n (bp1, bm1, b0, b1, n);
+ cy = mpn_addsub_n (bs1, bsm1, b0, b1, n);
}
- bp1_hi = cy >> 1;
+ bs1[n] = cy >> 1;
#else
- bp1_hi = mpn_add_n (bp1, b0, b1, n);
+ bs1[n] = mpn_add_n (bs1, b0, b1, n);
if (mpn_cmp (b0, b1, n) < 0)
{
- ASSERT_NOCARRY (mpn_sub_n (bm1, b1, b0, n));
+ mpn_sub_n (bsm1, b1, b0, n);
vm1_neg ^= 1;
}
else
{
- ASSERT_NOCARRY (mpn_sub_n (bm1, b0, b1, n));
+ mpn_sub_n (bsm1, b0, b1, n);
}
#endif
}
else
{
- /* FIXME: Should still use mpn_add_n_sub_n for the main part. */
- bp1_hi = mpn_add (bp1, b0, n, b1, t);
+ bs1[n] = mpn_add (bs1, b0, n, b1, t);
if (mpn_zero_p (b0 + t, n - t) && mpn_cmp (b0, b1, t) < 0)
{
- ASSERT_NOCARRY (mpn_sub_n (bm1, b1, b0, t));
- MPN_ZERO (bm1 + t, n - t);
+ mpn_sub_n (bsm1, b1, b0, t);
+ MPN_ZERO (bsm1 + t, n - t);
vm1_neg ^= 1;
}
else
{
- ASSERT_NOCARRY (mpn_sub (bm1, b0, n, b1, t));
+ mpn_sub (bsm1, b0, n, b1, t);
}
}
- TOOM32_MUL_N_REC (v1, ap1, bp1, n, scratch_out);
- if (ap1_hi == 1)
+ ASSERT (as1[n] <= 2);
+ ASSERT (bs1[n] <= 1);
+ ASSERT (asm1[n] <= 1);
+/*ASSERT (bsm1[n] == 0); */
+
+#define v0 pp /* 2n */
+#define v1 (scratch) /* 2n+1 */
+#define vinf (pp + 3 * n) /* s+t */
+#define vm1 (scratch + 2 * n + 1) /* 2n+1 */
+#define scratch_out scratch + 4 * n + 2
+
+ /* vm1, 2n+1 limbs */
+ TOOM22_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out);
+ cy = 0;
+ if (asm1[n] != 0)
+ cy = mpn_add_n (vm1 + n, vm1 + n, bsm1, n);
+ vm1[2 * n] = cy;
+
+ /* vinf, s+t limbs */
+ if (s > t) mpn_mul (vinf, a2, s, b1, t);
+ else mpn_mul (vinf, b1, t, a2, s);
+
+ /* v1, 2n+1 limbs */
+ TOOM22_MUL_N_REC (v1, as1, bs1, n, scratch_out);
+ if (as1[n] == 1)
{
- cy = bp1_hi + mpn_add_n (v1 + n, v1 + n, bp1, n);
+ cy = bs1[n] + mpn_add_n (v1 + n, v1 + n, bs1, n);
}
- else if (ap1_hi == 2)
+ else if (as1[n] == 2)
{
#if HAVE_NATIVE_mpn_addlsh1_n
- cy = 2 * bp1_hi + mpn_addlsh1_n (v1 + n, v1 + n, bp1, n);
+ cy = 2 * bs1[n] + mpn_addlsh1_n (v1 + n, v1 + n, bs1, n);
#else
- cy = 2 * bp1_hi + mpn_addmul_1 (v1 + n, bp1, n, CNST_LIMB(2));
+ cy = 2 * bs1[n] + mpn_addmul_1 (v1 + n, bs1, n, CNST_LIMB(2));
#endif
}
else
cy = 0;
- if (bp1_hi != 0)
- cy += mpn_add_n (v1 + n, v1 + n, ap1, n);
+ if (bs1[n] != 0)
+ cy += mpn_add_n (v1 + n, v1 + n, as1, n);
v1[2 * n] = cy;
- TOOM32_MUL_N_REC (vm1, am1, bm1, n, scratch_out);
- if (hi)
- hi = mpn_add_n (vm1+n, vm1+n, bm1, n);
+ mpn_mul_n (v0, ap, bp, n); /* v0, 2n limbs */
- vm1[2*n] = hi;
+ /* Interpolate */
- /* v1 <-- (v1 + vm1) / 2 = x0 + x2 */
if (vm1_neg)
{
-#if HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (v1, v1, vm1, 2*n+1);
+#if HAVE_NATIVE_mpn_rsh1add_n
+ mpn_rsh1add_n (vm1, v1, vm1, 2 * n + 1);
#else
- mpn_sub_n (v1, v1, vm1, 2*n+1);
- ASSERT_NOCARRY (mpn_rshift (v1, v1, 2*n+1, 1));
+ mpn_add_n (vm1, v1, vm1, 2 * n + 1);
+ mpn_rshift (vm1, vm1, 2 * n + 1, 1);
#endif
}
else
{
-#if HAVE_NATIVE_mpn_rsh1add_n
- mpn_rsh1add_n (v1, v1, vm1, 2*n+1);
+#if HAVE_NATIVE_mpn_rsh1sub_n
+ mpn_rsh1sub_n (vm1, v1, vm1, 2 * n + 1);
#else
- mpn_add_n (v1, v1, vm1, 2*n+1);
- ASSERT_NOCARRY (mpn_rshift (v1, v1, 2*n+1, 1));
+ mpn_sub_n (vm1, v1, vm1, 2 * n + 1);
+ mpn_rshift (vm1, vm1, 2 * n + 1, 1);
#endif
}
- /* We get x1 + x3 = (x0 + x2) - (x0 - x1 + x2 - x3), and hence
-
- y = x1 + x3 + (x0 + x2) * B
- = (x0 + x2) * B + (x0 + x2) - vm1.
-
- y is 3*n + 1 limbs, y = y0 + y1 B + y2 B^2. We store them as
- follows: y0 at scratch, y1 at pp + 2*n, and y2 at scratch + n
- (already in place, except for carry propagation).
+ mpn_sub_n (v1, v1, vm1, 2 * n + 1);
+ v1[2 * n] -= mpn_sub_n (v1, v1, v0, 2 * n);
- We thus add
+ /*
+ pp[] prior to operations:
+ |_H vinf|_L vinf|_______|_______|_______|
- B^3 B^2 B 1
- | | | |
- +-----+----+
- + | x0 + x2 |
- +----+-----+----+
- + | x0 + x2 |
- +----------+
- - | vm1 |
- --+----++----+----+-
- | y2 | y1 | y0 |
- +-----+----+----+
-
- Since we store y0 at the same location as the low half of x0 + x2, we
- need to do the middle sum first. */
-
- hi = vm1[2*n];
- cy = mpn_add_n (pp + 2*n, v1, v1 + n, n);
- MPN_INCR_U (v1 + n, n + 1, cy + v1[2*n]);
-
- /* FIXME: Can we get rid of this second vm1_neg conditional by
- swapping the location of +1 and -1 values? */
- if (vm1_neg)
- {
- cy = mpn_add_n (v1, v1, vm1, n);
- hi += mpn_add_nc (pp + 2*n, pp + 2*n, vm1 + n, n, cy);
- MPN_INCR_U (v1 + n, n+1, hi);
- }
- else
- {
- cy = mpn_sub_n (v1, v1, vm1, n);
- hi += mpn_sub_nc (pp + 2*n, pp + 2*n, vm1 + n, n, cy);
- MPN_DECR_U (v1 + n, n+1, hi);
- }
-
- TOOM32_MUL_N_REC (pp, a0, b0, n, scratch_out);
- /* vinf, s+t limbs. Use mpn_mul for now, to handle unbalanced operands */
- if (s > t) mpn_mul (pp+3*n, a2, s, b1, t);
- else mpn_mul (pp+3*n, b1, t, a2, s);
-
- /* Remaining interpolation.
-
- y * B + x0 + x3 B^3 - x0 B^2 - x3 B
- = (x1 + x3) B + (x0 + x2) B^2 + x0 + x3 B^3 - x0 B^2 - x3 B
- = y0 B + y1 B^2 + y3 B^3 + Lx0 + H x0 B
- + L x3 B^3 + H x3 B^4 - Lx0 B^2 - H x0 B^3 - L x3 B - H x3 B^2
- = L x0 + (y0 + H x0 - L x3) B + (y1 - L x0 - H x3) B^2
- + (y2 - (H x0 - L x3)) B^3 + H x3 B^4
-
- B^4 B^3 B^2 B 1
- | | | | | |
- +-------+ +---------+---------+
- | Hx3 | | Hx0-Lx3 | Lx0 |
- +------+----------+---------+---------+---------+
- | y2 | y1 | y0 |
- ++---------+---------+---------+
- -| Hx0-Lx3 | - Lx0 |
- +---------+---------+
- | - Hx3 |
- +--------+
-
- We must take into account the carry from Hx0 - Lx3.
+ summation scheme for remaining operations:
+ |_______|_______|_______|_______|_______|
+ |_Hvinf_|_Lvinf_| |_H v0__|_L v0__|
+ | H vm1 | L vm1 |
+ |-H vinf|-L vinf|
+ | H v1 | L v1 |
*/
- cy = mpn_sub_n (pp + n, pp + n, pp+3*n, n);
- hi = scratch[2*n] + cy;
-
- cy = mpn_sub_nc (pp + 2*n, pp + 2*n, pp, n, cy);
- hi -= mpn_sub_nc (pp + 3*n, scratch + n, pp + n, n, cy);
-
- hi += mpn_add (pp + n, pp + n, 3*n, scratch, n);
-
- /* FIXME: Is support for s + t == n needed? */
- if (LIKELY (s + t > n))
- {
- hi -= mpn_sub (pp + 2*n, pp + 2*n, 2*n, pp + 4*n, s+t-n);
+ mpn_sub (vm1, vm1, 2 * n + 1, vinf, s + t);
+#if HAVE_NATIVE_mpn_add_nc
+ cy = mpn_add_n (pp + n, pp + n, vm1, n);
+ cy = mpn_add_nc (pp + 2 * n, v1, vm1 + n, n, cy);
+ cy = mpn_add_nc (pp + 3 * n, pp + 3 * n, v1 + n, n, cy);
+ mpn_incr_u (pp + 3 * n, vm1[2 * n]);
+ if (LIKELY (n != s + t)) /* FIXME: Limit operand range to avoid condition */
+ mpn_incr_u (pp + 4 * n, cy + v1[2 * n]);
+#else
+ cy2 = mpn_add_n (pp + n, pp + n, vm1, n);
+ cy = mpn_add_n (pp + 2 * n, v1, vm1 + n, n);
+ mpn_incr_u (pp + 2 * n, cy2);
+ mpn_incr_u (pp + 3 * n, cy + vm1[2 * n]);
+ cy = mpn_add_n (pp + 3 * n, pp + 3 * n, v1 + n, n);
+ if (LIKELY (n != s + t)) /* FIXME: Limit operand range to avoid condition */
+ mpn_incr_u (pp + 4 * n, cy + v1[2 * n]);
+#endif
- if (hi < 0)
- MPN_DECR_U (pp + 4*n, s+t-n, -hi);
- else
- MPN_INCR_U (pp + 4*n, s+t-n, hi);
- }
- else
- ASSERT (hi == 0);
+ TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom33_mul.c b/gmp/mpn/generic/toom33_mul.c
index 655355c39a..5fa2813c31 100644
--- a/gmp/mpn/generic/toom33_mul.c
+++ b/gmp/mpn/generic/toom33_mul.c
@@ -1,52 +1,48 @@
-/* mpn_toom33_mul -- Multiply {ap,an} and {p,bn} where an and bn are close in
+/* mpn_toom33_mul -- Multiply {ap,an} and {bp,bn} where an and bn are close in
size. Or more accurately, bn <= an < (3/2)bn.
Contributed to the GNU project by Torbjorn Granlund.
- Additional improvements by 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
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2008, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+/*
+ Things to work on:
+
+ 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be
+ avoided by instead reusing the pp area and the scratch area.
+ 2. Use new toom functions for the recursive calls.
+*/
#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +1, +2, +inf
- <-s--><--n--><--n-->
- ____ ______ ______
- |_a2_|___a1_|___a0_|
- |b2_|___b1_|___b0_|
- <-t-><--n--><--n-->
+ <-s-><--n--><--n--><--n-->
+ ___ ______ ______ ______
+ |a3_|___a2_|___a1_|___a0_|
+ |_b1_|___b0_|
+ <-t--><--n-->
v0 = a0 * b0 # A(0)*B(0)
v1 = (a0+ a1+ a2)*(b0+ b1+ b2) # A(1)*B(1) ah <= 2 bh <= 2
@@ -55,33 +51,26 @@ see https://www.gnu.org/licenses/. */
vinf= a2 * b2 # A(inf)*B(inf)
*/
-#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
+#if TUNE_PROGRAM_BUILD
#define MAYBE_mul_basecase 1
#define MAYBE_mul_toom33 1
#else
#define MAYBE_mul_basecase \
- (MUL_TOOM33_THRESHOLD < 3 * MUL_TOOM22_THRESHOLD)
+ (MUL_TOOM33_THRESHOLD < 3 * MUL_KARATSUBA_THRESHOLD)
#define MAYBE_mul_toom33 \
(MUL_TOOM44_THRESHOLD >= 3 * MUL_TOOM33_THRESHOLD)
#endif
-/* FIXME: TOOM33_MUL_N_REC is not quite right for a balanced
- multiplication at the infinity point. We may have
- MAYBE_mul_basecase == 0, and still get s just below
- MUL_TOOM22_THRESHOLD. If MUL_TOOM33_THRESHOLD == 7, we can even get
- s == 1 and mpn_toom22_mul will crash.
-*/
-
#define TOOM33_MUL_N_REC(p, a, b, n, ws) \
do { \
if (MAYBE_mul_basecase \
- && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \
+ && BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \
mpn_mul_basecase (p, a, n, b, n); \
else if (! MAYBE_mul_toom33 \
|| BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) \
- mpn_toom22_mul (p, a, n, b, n, ws); \
+ mpn_kara_mul_n (p, a, b, n, ws); \
else \
- mpn_toom33_mul (p, a, n, b, n, ws); \
+ mpn_toom3_mul_n (p, a, b, n, ws); \
} while (0)
void
@@ -90,13 +79,13 @@ mpn_toom33_mul (mp_ptr pp,
mp_srcptr bp, mp_size_t bn,
mp_ptr scratch)
{
- const int __gmpn_cpuvec_initialized = 1;
mp_size_t n, s, t;
int vm1_neg;
mp_limb_t cy, vinf0;
mp_ptr gp;
mp_ptr as1, asm1, as2;
mp_ptr bs1, bsm1, bs2;
+ TMP_DECL;
#define a0 ap
#define a1 (ap + n)
@@ -115,34 +104,35 @@ mpn_toom33_mul (mp_ptr pp,
ASSERT (0 < s && s <= n);
ASSERT (0 < t && t <= n);
- as1 = scratch + 4 * n + 4;
- asm1 = scratch + 2 * n + 2;
- as2 = pp + n + 1;
+ TMP_MARK;
+
+ as1 = TMP_SALLOC_LIMBS (n + 1);
+ asm1 = TMP_SALLOC_LIMBS (n + 1);
+ as2 = TMP_SALLOC_LIMBS (n + 1);
- bs1 = pp;
- bsm1 = scratch + 3 * n + 3; /* we need 4n+4 <= 4n+s+t */
- bs2 = pp + 2 * n + 2;
+ bs1 = TMP_SALLOC_LIMBS (n + 1);
+ bsm1 = TMP_SALLOC_LIMBS (n + 1);
+ bs2 = TMP_SALLOC_LIMBS (n + 1);
- gp = scratch;
+ gp = pp;
vm1_neg = 0;
/* Compute as1 and asm1. */
cy = mpn_add (gp, a0, n, a2, s);
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
if (cy == 0 && mpn_cmp (gp, a1, n) < 0)
{
- cy = mpn_add_n_sub_n (as1, asm1, a1, gp, n);
- as1[n] = cy >> 1;
+ cy = mpn_addsub_n (as1, asm1, a1, gp, n);
+ as1[n] = 0;
asm1[n] = 0;
vm1_neg = 1;
}
else
{
- mp_limb_t cy2;
- cy2 = mpn_add_n_sub_n (as1, asm1, gp, a1, n);
+ cy2 = mpn_addsub_n (as1, asm1, gp, a1, n);
as1[n] = cy + (cy2 >> 1);
- asm1[n] = cy - (cy2 & 1);
+ asm1[n] = cy - (cy & 1);
}
#else
as1[n] = cy + mpn_add_n (as1, gp, a1, n);
@@ -160,45 +150,36 @@ mpn_toom33_mul (mp_ptr pp,
#endif
/* Compute as2. */
-#if HAVE_NATIVE_mpn_rsblsh1_n
- cy = mpn_add_n (as2, a2, as1, s);
- if (s != n)
- cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy);
- cy += as1[n];
- cy = 2 * cy + mpn_rsblsh1_n (as2, a0, as2, n);
-#else
#if HAVE_NATIVE_mpn_addlsh1_n
cy = mpn_addlsh1_n (as2, a1, a2, s);
if (s != n)
cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy);
cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n);
#else
- cy = mpn_add_n (as2, a2, as1, s);
+ cy = mpn_lshift (as2, a2, s, 1);
+ cy += mpn_add_n (as2, a1, as2, s);
if (s != n)
- cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy);
- cy += as1[n];
+ cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy);
cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
- cy -= mpn_sub_n (as2, as2, a0, n);
-#endif
+ cy += mpn_add_n (as2, a0, as2, n);
#endif
as2[n] = cy;
/* Compute bs1 and bsm1. */
cy = mpn_add (gp, b0, n, b2, t);
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
if (cy == 0 && mpn_cmp (gp, b1, n) < 0)
{
- cy = mpn_add_n_sub_n (bs1, bsm1, b1, gp, n);
- bs1[n] = cy >> 1;
+ cy = mpn_addsub_n (bs1, bsm1, b1, gp, n);
+ bs1[n] = 0;
bsm1[n] = 0;
vm1_neg ^= 1;
}
else
{
- mp_limb_t cy2;
- cy2 = mpn_add_n_sub_n (bs1, bsm1, gp, b1, n);
+ cy2 = mpn_addsub_n (bs1, bsm1, gp, b1, n);
bs1[n] = cy + (cy2 >> 1);
- bsm1[n] = cy - (cy2 & 1);
+ bsm1[n] = cy - (cy & 1);
}
#else
bs1[n] = cy + mpn_add_n (bs1, gp, b1, n);
@@ -216,26 +197,18 @@ mpn_toom33_mul (mp_ptr pp,
#endif
/* Compute bs2. */
-#if HAVE_NATIVE_mpn_rsblsh1_n
- cy = mpn_add_n (bs2, b2, bs1, t);
- if (t != n)
- cy = mpn_add_1 (bs2 + t, bs1 + t, n - t, cy);
- cy += bs1[n];
- cy = 2 * cy + mpn_rsblsh1_n (bs2, b0, bs2, n);
-#else
#if HAVE_NATIVE_mpn_addlsh1_n
cy = mpn_addlsh1_n (bs2, b1, b2, t);
if (t != n)
cy = mpn_add_1 (bs2 + t, b1 + t, n - t, cy);
cy = 2 * cy + mpn_addlsh1_n (bs2, b0, bs2, n);
#else
- cy = mpn_add_n (bs2, bs1, b2, t);
+ cy = mpn_lshift (bs2, b2, t, 1);
+ cy += mpn_add_n (bs2, b1, bs2, t);
if (t != n)
- cy = mpn_add_1 (bs2 + t, bs1 + t, n - t, cy);
- cy += bs1[n];
+ cy = mpn_add_1 (bs2 + t, b1 + t, n - t, cy);
cy = 2 * cy + mpn_lshift (bs2, bs2, n, 1);
- cy -= mpn_sub_n (bs2, bs2, b0, n);
-#endif
+ cy += mpn_add_n (bs2, b0, bs2, n);
#endif
bs2[n] = cy;
@@ -251,7 +224,7 @@ mpn_toom33_mul (mp_ptr pp,
#define vinf (pp + 4 * n) /* s+t */
#define vm1 scratch /* 2n+1 */
#define v2 (scratch + 2 * n + 1) /* 2n+2 */
-#define scratch_out (scratch + 5 * n + 5)
+#define scratch_out (scratch + 4 * n + 4)
/* vm1, 2n+1 limbs */
#ifdef SMALLER_RECURSION
@@ -312,5 +285,7 @@ mpn_toom33_mul (mp_ptr pp,
TOOM33_MUL_N_REC (v0, ap, bp, n, scratch_out); /* v0, 2n limbs */
- mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, vm1_neg, vinf0);
+ mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, 1^vm1_neg, vinf0, scratch_out);
+
+ TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom3_sqr.c b/gmp/mpn/generic/toom3_sqr.c
index 6117c67ca6..0c8a4ff74d 100644
--- a/gmp/mpn/generic/toom3_sqr.c
+++ b/gmp/mpn/generic/toom3_sqr.c
@@ -1,77 +1,75 @@
/* mpn_toom3_sqr -- Square {ap,an}.
Contributed to the GNU project by Torbjorn Granlund.
- Additional improvements by 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
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2010, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
+/*
+ Things to work on:
+
+ 1. Trim allocation. The allocations for as1 and asm1 could be
+ avoided by instead reusing the pp area and the scratch area.
+ 2. Use new toom functions for the recursive calls.
+*/
+
#include "gmp.h"
#include "gmp-impl.h"
/* Evaluate in: -1, 0, +1, +2, +inf
- <-s--><--n--><--n-->
- ____ ______ ______
- |_a2_|___a1_|___a0_|
-
- v0 = a0 ^2 # A(0)^2
- v1 = (a0+ a1+ a2)^2 # A(1)^2 ah <= 2
- vm1 = (a0- a1+ a2)^2 # A(-1)^2 |ah| <= 1
- v2 = (a0+2a1+4a2)^2 # A(2)^2 ah <= 6
- vinf= a2 ^2 # A(inf)^2
+ <-s-><--n--><--n--><--n-->
+ ___ ______ ______ ______
+ |a3_|___a2_|___a1_|___a0_|
+ |_b1_|___b0_|
+ <-t--><--n-->
+
+ v0 = a0 * b0 # A(0)*B(0)
+ v1 = (a0+ a1+ a2)*(b0+ b1+ b2) # A(1)*B(1) ah <= 2 bh <= 2
+ vm1 = (a0- a1+ a2)*(b0- b1+ b2) # A(-1)*B(-1) |ah| <= 1 bh <= 1
+ v2 = (a0+2a1+4a2)*(b0+2b1+4b2) # A(2)*B(2) ah <= 6 bh <= 6
+ vinf= a2 * b2 # A(inf)*B(inf)
*/
-#if TUNE_PROGRAM_BUILD || WANT_FAT_BINARY
+#if TUNE_PROGRAM_BUILD
#define MAYBE_sqr_basecase 1
#define MAYBE_sqr_toom3 1
#else
#define MAYBE_sqr_basecase \
- (SQR_TOOM3_THRESHOLD < 3 * SQR_TOOM2_THRESHOLD)
+ (SQR_TOOM3_THRESHOLD < 3 * SQR_KARATSUBA_THRESHOLD)
#define MAYBE_sqr_toom3 \
(SQR_TOOM4_THRESHOLD >= 3 * SQR_TOOM3_THRESHOLD)
#endif
-#define TOOM3_SQR_REC(p, a, n, ws) \
+#define TOOM3_SQR_N_REC(p, a, n, ws) \
do { \
if (MAYBE_sqr_basecase \
- && BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD)) \
+ && BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \
mpn_sqr_basecase (p, a, n); \
else if (! MAYBE_sqr_toom3 \
|| BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) \
- mpn_toom2_sqr (p, a, n, ws); \
+ mpn_kara_sqr_n (p, a, n, ws); \
else \
- mpn_toom3_sqr (p, a, n, ws); \
+ mpn_toom3_sqr_n (p, a, n, ws); \
} while (0)
void
@@ -79,11 +77,11 @@ mpn_toom3_sqr (mp_ptr pp,
mp_srcptr ap, mp_size_t an,
mp_ptr scratch)
{
- const int __gmpn_cpuvec_initialized = 1;
mp_size_t n, s;
mp_limb_t cy, vinf0;
mp_ptr gp;
mp_ptr as1, asm1, as2;
+ TMP_DECL;
#define a0 ap
#define a1 (ap + n)
@@ -95,27 +93,28 @@ mpn_toom3_sqr (mp_ptr pp,
ASSERT (0 < s && s <= n);
- as1 = scratch + 4 * n + 4;
- asm1 = scratch + 2 * n + 2;
- as2 = pp + n + 1;
+ TMP_MARK;
+
+ as1 = TMP_SALLOC_LIMBS (n + 1);
+ asm1 = TMP_SALLOC_LIMBS (n + 1);
+ as2 = TMP_SALLOC_LIMBS (n + 1);
- gp = scratch;
+ gp = pp;
/* Compute as1 and asm1. */
cy = mpn_add (gp, a0, n, a2, s);
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
if (cy == 0 && mpn_cmp (gp, a1, n) < 0)
{
- cy = mpn_add_n_sub_n (as1, asm1, a1, gp, n);
- as1[n] = cy >> 1;
+ cy = mpn_addsub_n (as1, asm1, a1, gp, n);
+ as1[n] = 0;
asm1[n] = 0;
}
else
{
- mp_limb_t cy2;
- cy2 = mpn_add_n_sub_n (as1, asm1, gp, a1, n);
+ cy2 = mpn_addsub_n (as1, asm1, gp, a1, n);
as1[n] = cy + (cy2 >> 1);
- asm1[n] = cy - (cy2 & 1);
+ asm1[n] = cy - (cy & 1);
}
#else
as1[n] = cy + mpn_add_n (as1, gp, a1, n);
@@ -132,26 +131,18 @@ mpn_toom3_sqr (mp_ptr pp,
#endif
/* Compute as2. */
-#if HAVE_NATIVE_mpn_rsblsh1_n
- cy = mpn_add_n (as2, a2, as1, s);
- if (s != n)
- cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy);
- cy += as1[n];
- cy = 2 * cy + mpn_rsblsh1_n (as2, a0, as2, n);
-#else
#if HAVE_NATIVE_mpn_addlsh1_n
cy = mpn_addlsh1_n (as2, a1, a2, s);
if (s != n)
cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy);
cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n);
#else
- cy = mpn_add_n (as2, a2, as1, s);
+ cy = mpn_lshift (as2, a2, s, 1);
+ cy += mpn_add_n (as2, a1, as2, s);
if (s != n)
- cy = mpn_add_1 (as2 + s, as1 + s, n - s, cy);
- cy += as1[n];
+ cy = mpn_add_1 (as2 + s, a1 + s, n - s, cy);
cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
- cy -= mpn_sub_n (as2, as2, a0, n);
-#endif
+ cy += mpn_add_n (as2, a0, as2, n);
#endif
as2[n] = cy;
@@ -163,11 +154,11 @@ mpn_toom3_sqr (mp_ptr pp,
#define vinf (pp + 4 * n) /* s+s */
#define vm1 scratch /* 2n+1 */
#define v2 (scratch + 2 * n + 1) /* 2n+2 */
-#define scratch_out (scratch + 5 * n + 5)
+#define scratch_out (scratch + 4 * n + 4)
/* vm1, 2n+1 limbs */
#ifdef SMALLER_RECURSION
- TOOM3_SQR_REC (vm1, asm1, n, scratch_out);
+ TOOM3_SQR_N_REC (vm1, asm1, n, scratch_out);
cy = 0;
if (asm1[n] != 0)
cy = asm1[n] + mpn_add_n (vm1 + n, vm1 + n, asm1, n);
@@ -175,18 +166,18 @@ mpn_toom3_sqr (mp_ptr pp,
cy += mpn_add_n (vm1 + n, vm1 + n, asm1, n);
vm1[2 * n] = cy;
#else
- TOOM3_SQR_REC (vm1, asm1, n + 1, scratch_out);
+ TOOM3_SQR_N_REC (vm1, asm1, n + 1, scratch_out);
#endif
- TOOM3_SQR_REC (v2, as2, n + 1, scratch_out); /* v2, 2n+1 limbs */
+ TOOM3_SQR_N_REC (v2, as2, n + 1, scratch_out); /* v2, 2n+1 limbs */
- TOOM3_SQR_REC (vinf, a2, s, scratch_out); /* vinf, s+s limbs */
+ TOOM3_SQR_N_REC (vinf, a2, s, scratch_out); /* vinf, s+s limbs */
vinf0 = vinf[0]; /* v1 overlaps with this */
#ifdef SMALLER_RECURSION
/* v1, 2n+1 limbs */
- TOOM3_SQR_REC (v1, as1, n, scratch_out);
+ TOOM3_SQR_N_REC (v1, as1, n, scratch_out);
if (as1[n] == 1)
{
cy = as1[n] + mpn_add_n (v1 + n, v1 + n, as1, n);
@@ -216,11 +207,13 @@ mpn_toom3_sqr (mp_ptr pp,
v1[2 * n] = cy;
#else
cy = vinf[1];
- TOOM3_SQR_REC (v1, as1, n + 1, scratch_out);
+ TOOM3_SQR_N_REC (v1, as1, n + 1, scratch_out);
vinf[1] = cy;
#endif
- TOOM3_SQR_REC (v0, ap, n, scratch_out); /* v0, 2n limbs */
+ TOOM3_SQR_N_REC (v0, ap, n, scratch_out); /* v0, 2n limbs */
+
+ mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + s, 1, vinf0, scratch_out);
- mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + s, 0, vinf0);
+ TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom42_mul.c b/gmp/mpn/generic/toom42_mul.c
index 9b1e7d491b..981b45df83 100644
--- a/gmp/mpn/generic/toom42_mul.c
+++ b/gmp/mpn/generic/toom42_mul.c
@@ -11,34 +11,32 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2008, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
+it under the terms of the GNU 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 Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License as published by the Free Software
- Foundation; either version 2 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 both in parallel, as here.
-The GNU MP Library is distributed in the hope that 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.
+/*
+ Things to work on:
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+ 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be
+ avoided by instead reusing the pp area and the scratch allocation.
+ 2. Apply optimizations also to mul_toom32.c.
+*/
#include "gmp.h"
#include "gmp-impl.h"
@@ -58,9 +56,20 @@ see https://www.gnu.org/licenses/. */
vinf= a3 * b1 # A(inf)*B(inf)
*/
-#define TOOM42_MUL_N_REC(p, a, b, n, ws) \
+#if TUNE_PROGRAM_BUILD
+#define MAYBE_mul_toom22 1
+#else
+#define MAYBE_mul_toom22 \
+ (MUL_TOOM33_THRESHOLD >= 2 * MUL_TOOM22_THRESHOLD)
+#endif
+
+#define TOOM22_MUL_N_REC(p, a, b, n, ws) \
do { \
- mpn_mul_n (p, a, b, n); \
+ if (! MAYBE_mul_toom22 \
+ || BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \
+ mpn_mul_basecase (p, a, n, b, n); \
+ else \
+ mpn_toom22_mul (p, a, n, b, n, ws); \
} while (0)
void
@@ -72,7 +81,7 @@ mpn_toom42_mul (mp_ptr pp,
mp_size_t n, s, t;
int vm1_neg;
mp_limb_t cy, vinf0;
- mp_ptr a0_a2;
+ mp_ptr a0_a2, a1_a3;
mp_ptr as1, asm1, as2;
mp_ptr bs1, bsm1, bs2;
TMP_DECL;
@@ -103,9 +112,35 @@ mpn_toom42_mul (mp_ptr pp,
bs2 = TMP_SALLOC_LIMBS (n + 1);
a0_a2 = pp;
+ a1_a3 = pp + n + 1;
/* Compute as1 and asm1. */
- vm1_neg = mpn_toom_eval_dgr3_pm1 (as1, asm1, ap, n, s, a0_a2) & 1;
+ a0_a2[n] = mpn_add_n (a0_a2, a0, a2, n);
+ a1_a3[n] = mpn_add (a1_a3, a1, n, a3, s);
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0)
+ {
+ mpn_addsub_n (as1, asm1, a1_a3, a0_a2, n + 1);
+ vm1_neg = 1;
+ }
+ else
+ {
+ mpn_addsub_n (as1, asm1, a0_a2, a1_a3, n + 1);
+ vm1_neg = 0;
+ }
+#else
+ mpn_add_n (as1, a0_a2, a1_a3, n + 1);
+ if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0)
+ {
+ mpn_sub_n (asm1, a1_a3, a0_a2, n + 1);
+ vm1_neg = 1;
+ }
+ else
+ {
+ mpn_sub_n (asm1, a0_a2, a1_a3, n + 1);
+ vm1_neg = 0;
+ }
+#endif
/* Compute as2. */
#if HAVE_NATIVE_mpn_addlsh1_n
@@ -129,15 +164,15 @@ mpn_toom42_mul (mp_ptr pp,
/* Compute bs1 and bsm1. */
if (t == n)
{
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
if (mpn_cmp (b0, b1, n) < 0)
{
- cy = mpn_add_n_sub_n (bs1, bsm1, b1, b0, n);
+ cy = mpn_addsub_n (bs1, bsm1, b1, b0, n);
vm1_neg ^= 1;
}
else
{
- cy = mpn_add_n_sub_n (bs1, bsm1, b0, b1, n);
+ cy = mpn_addsub_n (bs1, bsm1, b0, b1, n);
}
bs1[n] = cy >> 1;
#else
@@ -185,16 +220,16 @@ mpn_toom42_mul (mp_ptr pp,
#define vinf (pp + 4 * n) /* s+t */
#define vm1 scratch /* 2n+1 */
#define v2 (scratch + 2 * n + 1) /* 2n+2 */
-#define scratch_out scratch + 4 * n + 4 /* Currently unused. */
+#define scratch_out scratch + 4 * n + 4
/* vm1, 2n+1 limbs */
- TOOM42_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out);
+ TOOM22_MUL_N_REC (vm1, asm1, bsm1, n, scratch_out);
cy = 0;
if (asm1[n] != 0)
cy = mpn_add_n (vm1 + n, vm1 + n, bsm1, n);
vm1[2 * n] = cy;
- TOOM42_MUL_N_REC (v2, as2, bs2, n + 1, scratch_out); /* v2, 2n+1 limbs */
+ TOOM22_MUL_N_REC (v2, as2, bs2, n + 1, scratch_out); /* v2, 2n+1 limbs */
/* vinf, s+t limbs */
if (s > t) mpn_mul (vinf, a3, s, b1, t);
@@ -203,7 +238,7 @@ mpn_toom42_mul (mp_ptr pp,
vinf0 = vinf[0]; /* v1 overlaps with this */
/* v1, 2n+1 limbs */
- TOOM42_MUL_N_REC (v1, as1, bs1, n, scratch_out);
+ TOOM22_MUL_N_REC (v1, as1, bs1, n, scratch_out);
if (as1[n] == 1)
{
cy = bs1[n] + mpn_add_n (v1 + n, v1 + n, bs1, n);
@@ -226,9 +261,9 @@ mpn_toom42_mul (mp_ptr pp,
cy += mpn_add_n (v1 + n, v1 + n, as1, n);
v1[2 * n] = cy;
- TOOM42_MUL_N_REC (v0, ap, bp, n, scratch_out); /* v0, 2n limbs */
+ TOOM22_MUL_N_REC (v0, ap, bp, n, scratch_out); /* v0, 2n limbs */
- mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, vm1_neg, vinf0);
+ mpn_toom_interpolate_5pts (pp, v2, vm1, n, s + t, 1^vm1_neg, vinf0, scratch + 4 * n + 4);
TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom42_mulmid.c b/gmp/mpn/generic/toom42_mulmid.c
deleted file mode 100644
index 0251a6d7ed..0000000000
--- a/gmp/mpn/generic/toom42_mulmid.c
+++ /dev/null
@@ -1,238 +0,0 @@
-/* mpn_toom42_mulmid -- toom42 middle product
-
- Contributed by David Harvey.
-
- 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
- GUARANTEED THAT IT'LL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-
-/*
- Middle product of {ap,2n-1} and {bp,n}, output written to {rp,n+2}.
-
- Neither ap nor bp may overlap rp.
-
- Must have n >= 4.
-
- Amount of scratch space required is given by mpn_toom42_mulmid_itch().
-
- FIXME: this code assumes that n is small compared to GMP_NUMB_MAX. The exact
- requirements should be clarified.
-*/
-void
-mpn_toom42_mulmid (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n,
- mp_ptr scratch)
-{
- mp_limb_t cy, e[12], zh, zl;
- mp_size_t m;
- int neg;
-
- ASSERT (n >= 4);
- ASSERT (! MPN_OVERLAP_P (rp, n + 2, ap, 2*n - 1));
- ASSERT (! MPN_OVERLAP_P (rp, n + 2, bp, n));
-
- ap += n & 1; /* handle odd row and diagonal later */
- m = n / 2;
-
- /* (e0h:e0l) etc are correction terms, in 2's complement */
-#define e0l (e[0])
-#define e0h (e[1])
-#define e1l (e[2])
-#define e1h (e[3])
-#define e2l (e[4])
-#define e2h (e[5])
-#define e3l (e[6])
-#define e3h (e[7])
-#define e4l (e[8])
-#define e4h (e[9])
-#define e5l (e[10])
-#define e5h (e[11])
-
-#define s (scratch + 2)
-#define t (rp + m + 2)
-#define p0 rp
-#define p1 scratch
-#define p2 (rp + m)
-#define next_scratch (scratch + 3*m + 1)
-
- /*
- rp scratch
- |---------|-----------| |---------|---------|----------|
- 0 m 2m+2 0 m 2m 3m+1
- <----p2----> <-------------s------------->
- <----p0----><---t----> <----p1---->
- */
-
- /* compute {s,3m-1} = {a,3m-1} + {a+m,3m-1} and error terms e0, e1, e2, e3 */
- cy = mpn_add_err1_n (s, ap, ap + m, &e0l, bp + m, m - 1, 0);
- cy = mpn_add_err2_n (s + m - 1, ap + m - 1, ap + 2*m - 1, &e1l,
- bp + m, bp, m, cy);
- mpn_add_err1_n (s + 2*m - 1, ap + 2*m - 1, ap + 3*m - 1, &e3l, bp, m, cy);
-
- /* compute t = (-1)^neg * ({b,m} - {b+m,m}) and error terms e4, e5 */
- if (mpn_cmp (bp + m, bp, m) < 0)
- {
- ASSERT_NOCARRY (mpn_sub_err2_n (t, bp, bp + m, &e4l,
- ap + m - 1, ap + 2*m - 1, m, 0));
- neg = 1;
- }
- else
- {
- ASSERT_NOCARRY (mpn_sub_err2_n (t, bp + m, bp, &e4l,
- ap + m - 1, ap + 2*m - 1, m, 0));
- neg = 0;
- }
-
- /* recursive middle products. The picture is:
-
- b[2m-1] A A A B B B - - - - -
- ... - A A A B B B - - - -
- b[m] - - A A A B B B - - -
- b[m-1] - - - C C C D D D - -
- ... - - - - C C C D D D -
- b[0] - - - - - C C C D D D
- a[0] ... a[m] ... a[2m] ... a[4m-2]
- */
-
- if (m < MULMID_TOOM42_THRESHOLD)
- {
- /* A + B */
- mpn_mulmid_basecase (p0, s, 2*m - 1, bp + m, m);
- /* accumulate high limbs of p0 into e1 */
- ADDC_LIMB (cy, e1l, e1l, p0[m]);
- e1h += p0[m + 1] + cy;
- /* (-1)^neg * (B - C) (overwrites first m limbs of s) */
- mpn_mulmid_basecase (p1, ap + m, 2*m - 1, t, m);
- /* C + D (overwrites t) */
- mpn_mulmid_basecase (p2, s + m, 2*m - 1, bp, m);
- }
- else
- {
- /* as above, but use toom42 instead */
- mpn_toom42_mulmid (p0, s, bp + m, m, next_scratch);
- ADDC_LIMB (cy, e1l, e1l, p0[m]);
- e1h += p0[m + 1] + cy;
- mpn_toom42_mulmid (p1, ap + m, t, m, next_scratch);
- mpn_toom42_mulmid (p2, s + m, bp, m, next_scratch);
- }
-
- /* apply error terms */
-
- /* -e0 at rp[0] */
- SUBC_LIMB (cy, rp[0], rp[0], e0l);
- SUBC_LIMB (cy, rp[1], rp[1], e0h + cy);
- if (UNLIKELY (cy))
- {
- cy = (m > 2) ? mpn_sub_1 (rp + 2, rp + 2, m - 2, 1) : 1;
- SUBC_LIMB (cy, e1l, e1l, cy);
- e1h -= cy;
- }
-
- /* z = e1 - e2 + high(p0) */
- SUBC_LIMB (cy, zl, e1l, e2l);
- zh = e1h - e2h - cy;
-
- /* z at rp[m] */
- ADDC_LIMB (cy, rp[m], rp[m], zl);
- zh = (zh + cy) & GMP_NUMB_MASK;
- ADDC_LIMB (cy, rp[m + 1], rp[m + 1], zh);
- cy -= (zh >> (GMP_NUMB_BITS - 1));
- if (UNLIKELY (cy))
- {
- if (cy == 1)
- mpn_add_1 (rp + m + 2, rp + m + 2, m, 1);
- else /* cy == -1 */
- mpn_sub_1 (rp + m + 2, rp + m + 2, m, 1);
- }
-
- /* e3 at rp[2*m] */
- ADDC_LIMB (cy, rp[2*m], rp[2*m], e3l);
- rp[2*m + 1] = (rp[2*m + 1] + e3h + cy) & GMP_NUMB_MASK;
-
- /* e4 at p1[0] */
- ADDC_LIMB (cy, p1[0], p1[0], e4l);
- ADDC_LIMB (cy, p1[1], p1[1], e4h + cy);
- if (UNLIKELY (cy))
- mpn_add_1 (p1 + 2, p1 + 2, m, 1);
-
- /* -e5 at p1[m] */
- SUBC_LIMB (cy, p1[m], p1[m], e5l);
- p1[m + 1] = (p1[m + 1] - e5h - cy) & GMP_NUMB_MASK;
-
- /* adjustment if p1 ends up negative */
- cy = (p1[m + 1] >> (GMP_NUMB_BITS - 1));
-
- /* add (-1)^neg * (p1 - B^m * p1) to output */
- if (neg)
- {
- mpn_sub_1 (rp + m + 2, rp + m + 2, m, cy);
- mpn_add (rp, rp, 2*m + 2, p1, m + 2); /* A + C */
- mpn_sub_n (rp + m, rp + m, p1, m + 2); /* B + D */
- }
- else
- {
- mpn_add_1 (rp + m + 2, rp + m + 2, m, cy);
- mpn_sub (rp, rp, 2*m + 2, p1, m + 2); /* A + C */
- mpn_add_n (rp + m, rp + m, p1, m + 2); /* B + D */
- }
-
- /* odd row and diagonal */
- if (n & 1)
- {
- /*
- Products marked E are already done. We need to do products marked O.
-
- OOOOO----
- -EEEEO---
- --EEEEO--
- ---EEEEO-
- ----EEEEO
- */
-
- /* first row of O's */
- cy = mpn_addmul_1 (rp, ap - 1, n, bp[n - 1]);
- ADDC_LIMB (rp[n + 1], rp[n], rp[n], cy);
-
- /* O's on diagonal */
- /* 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 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);
- }
-}
diff --git a/gmp/mpn/generic/toom43_mul.c b/gmp/mpn/generic/toom43_mul.c
deleted file mode 100644
index 59d45576b8..0000000000
--- a/gmp/mpn/generic/toom43_mul.c
+++ /dev/null
@@ -1,234 +0,0 @@
-/* mpn_toom43_mul -- Multiply {ap,an} and {bp,bn} where an is nominally 4/3
- times as large as bn. Or more accurately, bn < an < 2 bn.
-
- Contributed to the GNU project by Marco Bodrato.
-
- The idea of applying toom to unbalanced multiplication is due to Marco
- Bodrato and Alberto Zanoni.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Evaluate in: -2, -1, 0, +1, +2, +inf
-
- <-s-><--n--><--n--><--n-->
- ___ ______ ______ ______
- |a3_|___a2_|___a1_|___a0_|
- |_b2_|___b1_|___b0_|
- <-t--><--n--><--n-->
-
- v0 = a0 * b0 # A(0)*B(0)
- v1 = (a0+ a1+ a2+ a3)*(b0+ b1+ b2) # A(1)*B(1) ah <= 3 bh <= 2
- vm1 = (a0- a1+ a2- a3)*(b0- b1+ b2) # A(-1)*B(-1) |ah| <= 1 |bh|<= 1
- v2 = (a0+2a1+4a2+8a3)*(b0+2b1+4b2) # A(2)*B(2) ah <= 14 bh <= 6
- vm2 = (a0-2a1+4a2-8a3)*(b0-2b1+4b2) # A(-2)*B(-2) |ah| <= 9 |bh|<= 4
- vinf= a3 * b2 # A(inf)*B(inf)
-*/
-
-void
-mpn_toom43_mul (mp_ptr pp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn, mp_ptr scratch)
-{
- mp_size_t n, s, t;
- enum toom6_flags flags;
- mp_limb_t cy;
-
-#define a0 ap
-#define a1 (ap + n)
-#define a2 (ap + 2 * n)
-#define a3 (ap + 3 * n)
-#define b0 bp
-#define b1 (bp + n)
-#define b2 (bp + 2 * n)
-
- n = 1 + (3 * an >= 4 * bn ? (an - 1) >> 2 : (bn - 1) / (size_t) 3);
-
- s = an - 3 * n;
- t = bn - 2 * n;
-
- ASSERT (0 < s && s <= n);
- ASSERT (0 < t && t <= n);
-
- /* This is true whenever an >= 25 or bn >= 19, I think. It
- guarantees that we can fit 5 values of size n+1 in the product
- area. */
- ASSERT (s+t >= 5);
-
-#define v0 pp /* 2n */
-#define vm1 (scratch) /* 2n+1 */
-#define v1 (pp + 2*n) /* 2n+1 */
-#define vm2 (scratch + 2 * n + 1) /* 2n+1 */
-#define v2 (scratch + 4 * n + 2) /* 2n+1 */
-#define vinf (pp + 5 * n) /* s+t */
-#define bs1 pp /* n+1 */
-#define bsm1 (scratch + 2 * n + 2) /* n+1 */
-#define asm1 (scratch + 3 * n + 3) /* n+1 */
-#define asm2 (scratch + 4 * n + 4) /* n+1 */
-#define bsm2 (pp + n + 1) /* n+1 */
-#define bs2 (pp + 2 * n + 2) /* n+1 */
-#define as2 (pp + 3 * n + 3) /* n+1 */
-#define as1 (pp + 4 * n + 4) /* n+1 */
-
- /* Total sccratch need is 6 * n + 3 + 1; we allocate one extra
- limb, because products will overwrite 2n+2 limbs. */
-
-#define a0a2 scratch
-#define b0b2 scratch
-#define a1a3 asm1
-#define b1d bsm1
-
- /* Compute as2 and asm2. */
- flags = (enum toom6_flags) (toom6_vm2_neg & mpn_toom_eval_dgr3_pm2 (as2, asm2, ap, n, s, a1a3));
-
- /* Compute bs2 and bsm2. */
- b1d[n] = mpn_lshift (b1d, b1, n, 1); /* 2b1 */
- cy = mpn_lshift (b0b2, b2, t, 2); /* 4b2 */
- cy += mpn_add_n (b0b2, b0b2, b0, t); /* 4b2 + b0 */
- if (t != n)
- cy = mpn_add_1 (b0b2 + t, b0 + t, n - t, cy);
- b0b2[n] = cy;
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (mpn_cmp (b0b2, b1d, n+1) < 0)
- {
- mpn_add_n_sub_n (bs2, bsm2, b1d, b0b2, n+1);
- flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
- }
- else
- {
- mpn_add_n_sub_n (bs2, bsm2, b0b2, b1d, n+1);
- }
-#else
- mpn_add_n (bs2, b0b2, b1d, n+1);
- if (mpn_cmp (b0b2, b1d, n+1) < 0)
- {
- mpn_sub_n (bsm2, b1d, b0b2, n+1);
- flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
- }
- else
- {
- mpn_sub_n (bsm2, b0b2, b1d, n+1);
- }
-#endif
-
- /* Compute as1 and asm1. */
- flags = (enum toom6_flags) (flags ^ toom6_vm1_neg & mpn_toom_eval_dgr3_pm1 (as1, asm1, ap, n, s, a0a2));
-
- /* Compute bs1 and bsm1. */
- bsm1[n] = mpn_add (bsm1, b0, n, b2, t);
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (bsm1[n] == 0 && mpn_cmp (bsm1, b1, n) < 0)
- {
- cy = mpn_add_n_sub_n (bs1, bsm1, b1, bsm1, n);
- bs1[n] = cy >> 1;
- flags = (enum toom6_flags) (flags ^ toom6_vm1_neg);
- }
- else
- {
- cy = mpn_add_n_sub_n (bs1, bsm1, bsm1, b1, n);
- bs1[n] = bsm1[n] + (cy >> 1);
- bsm1[n]-= cy & 1;
- }
-#else
- bs1[n] = bsm1[n] + mpn_add_n (bs1, bsm1, b1, n);
- if (bsm1[n] == 0 && mpn_cmp (bsm1, b1, n) < 0)
- {
- mpn_sub_n (bsm1, b1, bsm1, n);
- flags = (enum toom6_flags) (flags ^ toom6_vm1_neg);
- }
- else
- {
- bsm1[n] -= mpn_sub_n (bsm1, bsm1, b1, n);
- }
-#endif
-
- ASSERT (as1[n] <= 3);
- ASSERT (bs1[n] <= 2);
- ASSERT (asm1[n] <= 1);
- ASSERT (bsm1[n] <= 1);
- ASSERT (as2[n] <=14);
- ASSERT (bs2[n] <= 6);
- ASSERT (asm2[n] <= 9);
- ASSERT (bsm2[n] <= 4);
-
- /* vm1, 2n+1 limbs */
- mpn_mul_n (vm1, asm1, bsm1, n+1); /* W4 */
-
- /* vm2, 2n+1 limbs */
- mpn_mul_n (vm2, asm2, bsm2, n+1); /* W2 */
-
- /* v2, 2n+1 limbs */
- mpn_mul_n (v2, as2, bs2, n+1); /* W1 */
-
- /* v1, 2n+1 limbs */
- mpn_mul_n (v1, as1, bs1, n+1); /* W3 */
-
- /* vinf, s+t limbs */ /* W0 */
- if (s > t) mpn_mul (vinf, a3, s, b2, t);
- else mpn_mul (vinf, b2, t, a3, s);
-
- /* v0, 2n limbs */
- mpn_mul_n (v0, ap, bp, n); /* W5 */
-
- mpn_toom_interpolate_6pts (pp, n, flags, vm1, vm2, v2, t + s);
-
-#undef v0
-#undef vm1
-#undef v1
-#undef vm2
-#undef v2
-#undef vinf
-#undef bs1
-#undef bs2
-#undef bsm1
-#undef bsm2
-#undef asm1
-#undef asm2
-/* #undef as1 */
-/* #undef as2 */
-#undef a0a2
-#undef b0b2
-#undef a1a3
-#undef b1d
-#undef a0
-#undef a1
-#undef a2
-#undef a3
-#undef b0
-#undef b1
-#undef b2
-}
diff --git a/gmp/mpn/generic/toom44_mul.c b/gmp/mpn/generic/toom44_mul.c
index 5abf2d14a9..37ff45279d 100644
--- a/gmp/mpn/generic/toom44_mul.c
+++ b/gmp/mpn/generic/toom44_mul.c
@@ -7,39 +7,36 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2008, 2013 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+/*
+ Things to work on:
+
+ 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be
+ avoided by instead reusing the pp area and the scratch area.
+ 2. Use new toom functions for the recursive calls.
+*/
#include "gmp.h"
#include "gmp-impl.h"
-/* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf
+/* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf
<-s--><--n--><--n--><--n-->
____ ______ ______ ______
@@ -51,8 +48,8 @@ see https://www.gnu.org/licenses/. */
v1 = ( a0+ a1+ a2+ a3)*( b0+ b1+ b2+ b3) # A(1)*B(1) ah <= 3 bh <= 3
vm1 = ( a0- a1+ a2- a3)*( b0- b1+ b2- b3) # A(-1)*B(-1) |ah| <= 1 |bh| <= 1
v2 = ( a0+2a1+4a2+8a3)*( b0+2b1+4b2+8b3) # A(2)*B(2) ah <= 14 bh <= 14
- vm2 = ( a0-2a1+4a2-8a3)*( b0-2b1+4b2-8b3) # A(2)*B(2) ah <= 9 |bh| <= 9
vh = (8a0+4a1+2a2+ a3)*(8b0+4b1+2b2+ b3) # A(1/2)*B(1/2) ah <= 14 bh <= 14
+ vmh = (8a0-4a1+2a2- a3)*(8b0-4b1+2b2- b3) # A(-1/2)*B(-1/2) -4<=ah<=9 -4<=bh<=9
vinf= a3 * b2 # A(inf)*B(inf)
*/
@@ -62,51 +59,28 @@ see https://www.gnu.org/licenses/. */
#define MAYBE_mul_toom44 1
#else
#define MAYBE_mul_basecase \
- (MUL_TOOM44_THRESHOLD < 4 * MUL_TOOM22_THRESHOLD)
+ (MUL_TOOM44_THRESHOLD < 4 * MUL_KARATSUBA_THRESHOLD)
#define MAYBE_mul_toom22 \
(MUL_TOOM44_THRESHOLD < 4 * MUL_TOOM33_THRESHOLD)
#define MAYBE_mul_toom44 \
- (MUL_TOOM6H_THRESHOLD >= 4 * MUL_TOOM44_THRESHOLD)
+ (MUL_FFT_THRESHOLD >= 4 * MUL_TOOM44_THRESHOLD)
#endif
#define TOOM44_MUL_N_REC(p, a, b, n, ws) \
do { \
if (MAYBE_mul_basecase \
- && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) \
+ && BELOW_THRESHOLD (n, MUL_KARATSUBA_THRESHOLD)) \
mpn_mul_basecase (p, a, n, b, n); \
else if (MAYBE_mul_toom22 \
&& BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) \
- mpn_toom22_mul (p, a, n, b, n, ws); \
+ mpn_kara_mul_n (p, a, b, n, ws); \
else if (! MAYBE_mul_toom44 \
|| BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) \
- mpn_toom33_mul (p, a, n, b, n, ws); \
+ mpn_toom3_mul_n (p, a, b, n, ws); \
else \
mpn_toom44_mul (p, a, n, b, n, ws); \
} while (0)
-/* Use of scratch space. In the product area, we store
-
- ___________________
- |vinf|____|_v1_|_v0_|
- s+t 2n-1 2n+1 2n
-
- The other recursive products, vm1, v2, vm2, vh are stored in the
- scratch area. When computing them, we use the product area for
- intermediate values.
-
- Next, we compute v1. We can store the intermediate factors at v0
- and at vh + 2n + 2.
-
- Finally, for v0 and vinf, factors are parts of the input operands,
- and we need scratch space only for the recursive multiplication.
-
- In all, if S(an) is the scratch need, the needed space is bounded by
-
- S(an) <= 4 (2*ceil(an/4) + 1) + 1 + S(ceil(an/4) + 1)
-
- which should give S(n) = 8 n/3 + c log(n) for some constant c.
-*/
-
void
mpn_toom44_mul (mp_ptr pp,
mp_srcptr ap, mp_size_t an,
@@ -115,7 +89,11 @@ mpn_toom44_mul (mp_ptr pp,
{
mp_size_t n, s, t;
mp_limb_t cy;
- enum toom7_flags flags;
+ mp_ptr gp, hp;
+ mp_ptr as1, asm1, as2, ash, asmh;
+ mp_ptr bs1, bsm1, bs2, bsh, bsmh;
+ enum toom4_flags flags;
+ TMP_DECL;
#define a0 ap
#define a1 (ap + n)
@@ -126,111 +104,227 @@ mpn_toom44_mul (mp_ptr pp,
#define b2 (bp + 2*n)
#define b3 (bp + 3*n)
- ASSERT (an >= bn);
-
n = (an + 3) >> 2;
s = an - 3 * n;
t = bn - 3 * n;
+ ASSERT (an >= bn);
+
ASSERT (0 < s && s <= n);
ASSERT (0 < t && t <= n);
- ASSERT (s >= t);
-
- /* NOTE: The multiplications to v2, vm2, vh and vm1 overwrites the
- * following limb, so these must be computed in order, and we need a
- * one limb gap to tp. */
-#define v0 pp /* 2n */
-#define v1 (pp + 2 * n) /* 2n+1 */
-#define vinf (pp + 6 * n) /* s+t */
-#define v2 scratch /* 2n+1 */
-#define vm2 (scratch + 2 * n + 1) /* 2n+1 */
-#define vh (scratch + 4 * n + 2) /* 2n+1 */
-#define vm1 (scratch + 6 * n + 3) /* 2n+1 */
-#define tp (scratch + 8*n + 5)
-
- /* apx and bpx must not overlap with v1 */
-#define apx pp /* n+1 */
-#define amx (pp + n + 1) /* n+1 */
-#define bmx (pp + 2*n + 2) /* n+1 */
-#define bpx (pp + 4*n + 2) /* n+1 */
- /* Total scratch need: 8*n + 5 + scratch for recursive calls. This
- gives roughly 32 n/3 + log term. */
-
- /* Compute apx = a0 + 2 a1 + 4 a2 + 8 a3 and amx = a0 - 2 a1 + 4 a2 - 8 a3. */
- flags = (enum toom7_flags) (toom7_w1_neg & mpn_toom_eval_dgr3_pm2 (apx, amx, ap, n, s, tp));
-
- /* Compute bpx = b0 + 2 b1 + 4 b2 + 8 b3 and bmx = b0 - 2 b1 + 4 b2 - 8 b3. */
- flags = (enum toom7_flags) (flags ^ toom7_w1_neg & mpn_toom_eval_dgr3_pm2 (bpx, bmx, bp, n, t, tp));
+ TMP_MARK;
+
+ as1 = TMP_ALLOC_LIMBS (10 * n + 10);
+ asm1 = as1 + n + 1;
+ as2 = asm1 + n + 1;
+ ash = as2 + n + 1;
+ asmh = ash + n + 1;
+ bs1 = asmh + n + 1;
+ bsm1 = bs1 + n + 1;
+ bs2 = bsm1 + n + 1;
+ bsh = bs2 + n + 1;
+ bsmh = bsh + n + 1;
+
+ gp = pp;
+ hp = pp + n + 1;
+
+ flags = 0;
+
+ /* Compute as1 and asm1. */
+ gp[n] = mpn_add_n (gp, a0, a2, n);
+ hp[n] = mpn_add (hp, a1, n, a3, s);
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_addsub_n (as1, asm1, hp, gp, n + 1);
+ flags ^= toom4_w3_neg;
+ }
+ else
+ {
+ mpn_addsub_n (as1, asm1, gp, hp, n + 1);
+ }
+#else
+ mpn_add_n (as1, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (asm1, hp, gp, n + 1);
+ flags ^= toom4_w3_neg;
+ }
+ else
+ {
+ mpn_sub_n (asm1, gp, hp, n + 1);
+ }
+#endif
- TOOM44_MUL_N_REC (v2, apx, bpx, n + 1, tp); /* v2, 2n+1 limbs */
- TOOM44_MUL_N_REC (vm2, amx, bmx, n + 1, tp); /* vm2, 2n+1 limbs */
+ /* Compute as2. */
+#if HAVE_NATIVE_mpn_addlsh1_n
+ cy = mpn_addlsh1_n (as2, a2, a3, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n);
+#else
+ cy = mpn_lshift (as2, a3, s, 1);
+ cy += mpn_add_n (as2, a2, as2, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a1, as2, n);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a0, as2, n);
+#endif
+ as2[n] = cy;
- /* Compute apx = 8 a0 + 4 a1 + 2 a2 + a3 = (((2*a0 + a1) * 2 + a2) * 2 + a3 */
+ /* Compute ash and asmh. */
+ cy = mpn_lshift (gp, a0, n, 3); /* 8a0 */
#if HAVE_NATIVE_mpn_addlsh1_n
- cy = mpn_addlsh1_n (apx, a1, a0, n);
- cy = 2*cy + mpn_addlsh1_n (apx, a2, apx, n);
- if (s < n)
+ gp[n] = cy + mpn_addlsh1_n (gp, gp, a2, n); /* 8a0 + 2a2 */
+#else
+ cy += mpn_lshift (hp, a2, n, 1); /* 2a2 */
+ gp[n] = cy + mpn_add_n (gp, gp, hp, n); /* 8a0 + 2a2 */
+#endif
+ cy = mpn_lshift (hp, a1, n, 2); /* 4a1 */
+ hp[n] = cy + mpn_add (hp, hp, n, a3, s); /* 4a1 + a3 */
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
{
- mp_limb_t cy2;
- cy2 = mpn_addlsh1_n (apx, a3, apx, s);
- apx[n] = 2*cy + mpn_lshift (apx + s, apx + s, n - s, 1);
- MPN_INCR_U (apx + s, n+1-s, cy2);
+ mpn_addsub_n (ash, asmh, hp, gp, n + 1);
+ flags ^= toom4_w1_neg;
}
else
- apx[n] = 2*cy + mpn_addlsh1_n (apx, a3, apx, n);
+ {
+ mpn_addsub_n (ash, asmh, gp, hp, n + 1);
+ }
#else
- cy = mpn_lshift (apx, a0, n, 1);
- cy += mpn_add_n (apx, apx, a1, n);
- cy = 2*cy + mpn_lshift (apx, apx, n, 1);
- cy += mpn_add_n (apx, apx, a2, n);
- cy = 2*cy + mpn_lshift (apx, apx, n, 1);
- apx[n] = cy + mpn_add (apx, apx, n, a3, s);
+ mpn_add_n (ash, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (asmh, hp, gp, n + 1);
+ flags ^= toom4_w1_neg;
+ }
+ else
+ {
+ mpn_sub_n (asmh, gp, hp, n + 1);
+ }
+#endif
+
+ /* Compute bs1 and bsm1. */
+ gp[n] = mpn_add_n (gp, b0, b2, n);
+ hp[n] = mpn_add (hp, b1, n, b3, t);
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_addsub_n (bs1, bsm1, hp, gp, n + 1);
+ flags ^= toom4_w3_neg;
+ }
+ else
+ {
+ mpn_addsub_n (bs1, bsm1, gp, hp, n + 1);
+ }
+#else
+ mpn_add_n (bs1, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (bsm1, hp, gp, n + 1);
+ flags ^= toom4_w3_neg;
+ }
+ else
+ {
+ mpn_sub_n (bsm1, gp, hp, n + 1);
+ }
#endif
- /* Compute bpx = 8 b0 + 4 b1 + 2 b2 + b3 = (((2*b0 + b1) * 2 + b2) * 2 + b3 */
+ /* Compute bs2. */
#if HAVE_NATIVE_mpn_addlsh1_n
- cy = mpn_addlsh1_n (bpx, b1, b0, n);
- cy = 2*cy + mpn_addlsh1_n (bpx, b2, bpx, n);
- if (t < n)
+ cy = mpn_addlsh1_n (bs2, b2, b3, t);
+ if (t != n)
+ cy = mpn_add_1 (bs2 + t, b2 + t, n - t, cy);
+ cy = 2 * cy + mpn_addlsh1_n (bs2, b1, bs2, n);
+ cy = 2 * cy + mpn_addlsh1_n (bs2, b0, bs2, n);
+#else
+ cy = mpn_lshift (bs2, b3, t, 1);
+ cy += mpn_add_n (bs2, b2, bs2, t);
+ if (t != n)
+ cy = mpn_add_1 (bs2 + t, b2 + t, n - t, cy);
+ cy = 2 * cy + mpn_lshift (bs2, bs2, n, 1);
+ cy += mpn_add_n (bs2, b1, bs2, n);
+ cy = 2 * cy + mpn_lshift (bs2, bs2, n, 1);
+ cy += mpn_add_n (bs2, b0, bs2, n);
+#endif
+ bs2[n] = cy;
+
+ /* Compute bsh and bsmh. */
+ cy = mpn_lshift (gp, b0, n, 3); /* 8b0 */
+#if HAVE_NATIVE_mpn_addlsh1_n
+ gp[n] = cy + mpn_addlsh1_n (gp, gp, b2, n); /* 8b0 + 2b2 */
+#else
+ cy += mpn_lshift (hp, b2, n, 1); /* 2b2 */
+ gp[n] = cy + mpn_add_n (gp, gp, hp, n); /* 8b0 + 2b2 */
+#endif
+ cy = mpn_lshift (hp, b1, n, 2); /* 4b1 */
+ hp[n] = cy + mpn_add (hp, hp, n, b3, t); /* 4b1 + b3 */
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
{
- mp_limb_t cy2;
- cy2 = mpn_addlsh1_n (bpx, b3, bpx, t);
- bpx[n] = 2*cy + mpn_lshift (bpx + t, bpx + t, n - t, 1);
- MPN_INCR_U (bpx + t, n+1-t, cy2);
+ mpn_addsub_n (bsh, bsmh, hp, gp, n + 1);
+ flags ^= toom4_w1_neg;
}
else
- bpx[n] = 2*cy + mpn_addlsh1_n (bpx, b3, bpx, n);
+ {
+ mpn_addsub_n (bsh, bsmh, gp, hp, n + 1);
+ }
#else
- cy = mpn_lshift (bpx, b0, n, 1);
- cy += mpn_add_n (bpx, bpx, b1, n);
- cy = 2*cy + mpn_lshift (bpx, bpx, n, 1);
- cy += mpn_add_n (bpx, bpx, b2, n);
- cy = 2*cy + mpn_lshift (bpx, bpx, n, 1);
- bpx[n] = cy + mpn_add (bpx, bpx, n, b3, t);
+ mpn_add_n (bsh, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (bsmh, hp, gp, n + 1);
+ flags ^= toom4_w1_neg;
+ }
+ else
+ {
+ mpn_sub_n (bsmh, gp, hp, n + 1);
+ }
#endif
- ASSERT (apx[n] < 15);
- ASSERT (bpx[n] < 15);
+ ASSERT (as1[n] <= 3);
+ ASSERT (bs1[n] <= 3);
+ ASSERT (asm1[n] <= 1);
+ ASSERT (bsm1[n] <= 1);
+ ASSERT (as2[n] <= 14);
+ ASSERT (bs2[n] <= 14);
+ ASSERT (ash[n] <= 14);
+ ASSERT (bsh[n] <= 14);
+ ASSERT (asmh[n] <= 9);
+ ASSERT (bsmh[n] <= 9);
+
+#define v0 pp /* 2n */
+#define v1 (scratch + 6 * n + 6) /* 2n+1 */
+#define vm1 scratch /* 2n+1 */
+#define v2 (scratch + 2 * n + 2) /* 2n+1 */
+#define vinf (pp + 6 * n) /* s+t */
+#define vh (pp + 2 * n) /* 2n+1 */
+#define vmh (scratch + 4 * n + 4)
+#define scratch_out (scratch + 8 * n + 8)
+
+ /* vm1, 2n+1 limbs */
+ TOOM44_MUL_N_REC (vm1, asm1, bsm1, n + 1, scratch_out); /* vm1, 2n+1 limbs */
- TOOM44_MUL_N_REC (vh, apx, bpx, n + 1, tp); /* vh, 2n+1 limbs */
+ TOOM44_MUL_N_REC (v2 , as2 , bs2 , n + 1, scratch_out); /* v2, 2n+1 limbs */
- /* Compute apx = a0 + a1 + a2 + a3 and amx = a0 - a1 + a2 - a3. */
- flags = (enum toom7_flags) (flags | toom7_w3_neg & mpn_toom_eval_dgr3_pm1 (apx, amx, ap, n, s, tp));
+ if (s > t) mpn_mul (vinf, a3, s, b3, t);
+ else TOOM44_MUL_N_REC (vinf, a3, b3, s, scratch_out); /* vinf, s+t limbs */
- /* Compute bpx = b0 + b1 + b2 + b3 bnd bmx = b0 - b1 + b2 - b3. */
- flags = (enum toom7_flags) (flags ^ toom7_w3_neg & mpn_toom_eval_dgr3_pm1 (bpx, bmx, bp, n, t, tp));
+ TOOM44_MUL_N_REC (v1 , as1 , bs1 , n + 1, scratch_out); /* v1, 2n+1 limbs */
- TOOM44_MUL_N_REC (vm1, amx, bmx, n + 1, tp); /* vm1, 2n+1 limbs */
- /* Clobbers amx, bmx. */
- TOOM44_MUL_N_REC (v1, apx, bpx, n + 1, tp); /* v1, 2n+1 limbs */
+ TOOM44_MUL_N_REC (vh , ash , bsh , n + 1, scratch_out);
- TOOM44_MUL_N_REC (v0, a0, b0, n, tp);
- if (s > t)
- mpn_mul (vinf, a3, s, b3, t);
- else
- TOOM44_MUL_N_REC (vinf, a3, b3, s, tp); /* vinf, s+t limbs */
+ TOOM44_MUL_N_REC (vmh, asmh, bsmh, n + 1, scratch_out);
+
+ TOOM44_MUL_N_REC (v0 , ap , bp , n , scratch_out); /* v0, 2n limbs */
+
+ mpn_toom_interpolate_7pts (pp, n, flags, vmh, vm1, v1, v2, s + t, scratch_out);
- mpn_toom_interpolate_7pts (pp, n, flags, vm2, vm1, v2, vh, s + t, tp);
+ TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom4_sqr.c b/gmp/mpn/generic/toom4_sqr.c
index b4154ba83f..911b5548d7 100644
--- a/gmp/mpn/generic/toom4_sqr.c
+++ b/gmp/mpn/generic/toom4_sqr.c
@@ -6,34 +6,31 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2010, 2013 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+/*
+ Things to work on:
+
+ 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be
+ avoided by instead reusing the pp area and the scratch area.
+ 2. Use new toom functions for the recursive calls.
+*/
#include "gmp.h"
#include "gmp-impl.h"
@@ -43,14 +40,16 @@ see https://www.gnu.org/licenses/. */
<-s--><--n--><--n--><--n-->
____ ______ ______ ______
|_a3_|___a2_|___a1_|___a0_|
-
- v0 = a0 ^2 # A(0)^2
- v1 = ( a0+ a1+ a2+ a3)^2 # A(1)^2 ah <= 3
- vm1 = ( a0- a1+ a2- a3)^2 # A(-1)^2 |ah| <= 1
- v2 = ( a0+2a1+4a2+8a3)^2 # A(2)^2 ah <= 14
- vh = (8a0+4a1+2a2+ a3)^2 # A(1/2)^2 ah <= 14
- vmh = (8a0-4a1+2a2- a3)^2 # A(-1/2)^2 -4<=ah<=9
- vinf= a3 ^2 # A(inf)^2
+ |b3_|___b2_|___b1_|___b0_|
+ <-t-><--n--><--n--><--n-->
+
+ v0 = a0 * b0 # A(0)*B(0)
+ v1 = ( a0+ a1+ a2+ a3)*( b0+ b1+ b2+ b3) # A(1)*B(1) ah <= 3 bh <= 3
+ vm1 = ( a0- a1+ a2- a3)*( b0- b1+ b2- b3) # A(-1)*B(-1) |ah| <= 1 |bh| <= 1
+ v2 = ( a0+2a1+4a2+8a3)*( b0+2b1+4b2+8b3) # A(2)*B(2) ah <= 14 bh <= 14
+ vh = (8a0+4a1+2a2+ a3)*(8b0+4b1+2b2+ b3) # A(1/2)*B(1/2) ah <= 14 bh <= 14
+ vmh = (8a0-4a1+2a2- a3)*(8b0-4b1+2b2- b3) # A(-1/2)*B(-1/2) -4<=ah<=9 -4<=bh<=9
+ vinf= a3 * b2 # A(inf)*B(inf)
*/
#if TUNE_PROGRAM_BUILD
@@ -59,24 +58,24 @@ see https://www.gnu.org/licenses/. */
#define MAYBE_sqr_toom4 1
#else
#define MAYBE_sqr_basecase \
- (SQR_TOOM4_THRESHOLD < 4 * SQR_TOOM2_THRESHOLD)
+ (SQR_TOOM4_THRESHOLD < 4 * SQR_KARATSUBA_THRESHOLD)
#define MAYBE_sqr_toom2 \
(SQR_TOOM4_THRESHOLD < 4 * SQR_TOOM3_THRESHOLD)
#define MAYBE_sqr_toom4 \
- (SQR_TOOM6_THRESHOLD >= 4 * SQR_TOOM4_THRESHOLD)
+ (SQR_FFT_THRESHOLD >= 4 * SQR_TOOM4_THRESHOLD)
#endif
-#define TOOM4_SQR_REC(p, a, n, ws) \
+#define TOOM4_SQR_N_REC(p, a, n, ws) \
do { \
if (MAYBE_sqr_basecase \
- && BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD)) \
+ && BELOW_THRESHOLD (n, SQR_KARATSUBA_THRESHOLD)) \
mpn_sqr_basecase (p, a, n); \
else if (MAYBE_sqr_toom2 \
&& BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD)) \
- mpn_toom2_sqr (p, a, n, ws); \
+ mpn_kara_sqr_n (p, a, n, ws); \
else if (! MAYBE_sqr_toom4 \
|| BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD)) \
- mpn_toom3_sqr (p, a, n, ws); \
+ mpn_toom3_sqr_n (p, a, n, ws); \
else \
mpn_toom4_sqr (p, a, n, ws); \
} while (0)
@@ -88,6 +87,9 @@ mpn_toom4_sqr (mp_ptr pp,
{
mp_size_t n, s;
mp_limb_t cy;
+ mp_ptr gp, hp;
+ mp_ptr as1, asm1, as2, ash, asmh;
+ TMP_DECL;
#define a0 ap
#define a1 (ap + n)
@@ -100,65 +102,122 @@ mpn_toom4_sqr (mp_ptr pp,
ASSERT (0 < s && s <= n);
- /* NOTE: The multiplications to v2, vm2, vh and vm1 overwrites the
- * following limb, so these must be computed in order, and we need a
- * one limb gap to tp. */
-#define v0 pp /* 2n */
-#define v1 (pp + 2 * n) /* 2n+1 */
-#define vinf (pp + 6 * n) /* s+t */
-#define v2 scratch /* 2n+1 */
-#define vm2 (scratch + 2 * n + 1) /* 2n+1 */
-#define vh (scratch + 4 * n + 2) /* 2n+1 */
-#define vm1 (scratch + 6 * n + 3) /* 2n+1 */
-#define tp (scratch + 8*n + 5)
+ TMP_MARK;
- /* No overlap with v1 */
-#define apx pp /* n+1 */
-#define amx (pp + 4*n + 2) /* n+1 */
+ as1 = TMP_SALLOC_LIMBS (n + 1);
+ asm1 = TMP_SALLOC_LIMBS (n + 1);
+ as2 = TMP_SALLOC_LIMBS (n + 1);
+ ash = TMP_SALLOC_LIMBS (n + 1);
+ asmh = TMP_SALLOC_LIMBS (n + 1);
- /* Total scratch need: 8*n + 5 + scratch for recursive calls. This
- gives roughly 32 n/3 + log term. */
+ gp = pp;
+ hp = pp + n + 1;
- /* Compute apx = a0 + 2 a1 + 4 a2 + 8 a3 and amx = a0 - 2 a1 + 4 a2 - 8 a3. */
- mpn_toom_eval_dgr3_pm2 (apx, amx, ap, n, s, tp);
+ /* Compute as1 and asm1. */
+ gp[n] = mpn_add_n (gp, a0, a2, n);
+ hp[n] = mpn_add (hp, a1, n, a3, s);
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_addsub_n (as1, asm1, hp, gp, n + 1);
+ }
+ else
+ {
+ mpn_addsub_n (as1, asm1, gp, hp, n + 1);
+ }
+#else
+ mpn_add_n (as1, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (asm1, hp, gp, n + 1);
+ }
+ else
+ {
+ mpn_sub_n (asm1, gp, hp, n + 1);
+ }
+#endif
- TOOM4_SQR_REC (v2, apx, n + 1, tp); /* v2, 2n+1 limbs */
- TOOM4_SQR_REC (vm2, amx, n + 1, tp); /* vm2, 2n+1 limbs */
+ /* Compute as2. */
+#if HAVE_NATIVE_mpn_addlsh1_n
+ cy = mpn_addlsh1_n (as2, a2, a3, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n);
+#else
+ cy = mpn_lshift (as2, a3, s, 1);
+ cy += mpn_add_n (as2, a2, as2, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a2 + s, n - s, cy);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a1, as2, n);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a0, as2, n);
+#endif
+ as2[n] = cy;
- /* Compute apx = 8 a0 + 4 a1 + 2 a2 + a3 = (((2*a0 + a1) * 2 + a2) * 2 + a3 */
+ /* Compute ash and asmh. */
+ cy = mpn_lshift (gp, a0, n, 3); /* 8a0 */
#if HAVE_NATIVE_mpn_addlsh1_n
- cy = mpn_addlsh1_n (apx, a1, a0, n);
- cy = 2*cy + mpn_addlsh1_n (apx, a2, apx, n);
- if (s < n)
+ gp[n] = cy + mpn_addlsh1_n (gp, gp, a2, n); /* 8a0 + 2a2 */
+#else
+ cy += mpn_lshift (hp, a2, n, 1); /* 2a2 */
+ gp[n] = cy + mpn_add_n (gp, gp, hp, n); /* 8a0 + 2a2 */
+#endif
+ cy = mpn_lshift (hp, a1, n, 2); /* 4a1 */
+ hp[n] = cy + mpn_add (hp, hp, n, a3, s); /* 4a1 + a3 */
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
{
- mp_limb_t cy2;
- cy2 = mpn_addlsh1_n (apx, a3, apx, s);
- apx[n] = 2*cy + mpn_lshift (apx + s, apx + s, n - s, 1);
- MPN_INCR_U (apx + s, n+1-s, cy2);
+ mpn_addsub_n (ash, asmh, hp, gp, n + 1);
}
else
- apx[n] = 2*cy + mpn_addlsh1_n (apx, a3, apx, n);
+ {
+ mpn_addsub_n (ash, asmh, gp, hp, n + 1);
+ }
#else
- cy = mpn_lshift (apx, a0, n, 1);
- cy += mpn_add_n (apx, apx, a1, n);
- cy = 2*cy + mpn_lshift (apx, apx, n, 1);
- cy += mpn_add_n (apx, apx, a2, n);
- cy = 2*cy + mpn_lshift (apx, apx, n, 1);
- apx[n] = cy + mpn_add (apx, apx, n, a3, s);
+ mpn_add_n (ash, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (asmh, hp, gp, n + 1);
+ }
+ else
+ {
+ mpn_sub_n (asmh, gp, hp, n + 1);
+ }
#endif
- ASSERT (apx[n] < 15);
+ ASSERT (as1[n] <= 3);
+ ASSERT (asm1[n] <= 1);
+ ASSERT (as2[n] <= 14);
+ ASSERT (ash[n] <= 14);
+ ASSERT (asmh[n] <= 9);
+
+#define v0 pp /* 2n */
+#define v1 (scratch + 6 * n + 6) /* 2n+1 */
+#define vm1 scratch /* 2n+1 */
+#define v2 (scratch + 2 * n + 2) /* 2n+1 */
+#define vinf (pp + 6 * n) /* s+t */
+#define vh (pp + 2 * n) /* 2n+1 */
+#define vmh (scratch + 4 * n + 4)
+#define scratch_out (scratch + 8 * n + 8)
+
+ /* vm1, 2n+1 limbs */
+ TOOM4_SQR_N_REC (vm1, asm1, n + 1, scratch_out); /* vm1, 2n+1 limbs */
+
+ TOOM4_SQR_N_REC (v2 , as2 , n + 1, scratch_out); /* v2, 2n+1 limbs */
+
+ TOOM4_SQR_N_REC (vinf, a3 , s, scratch_out); /* vinf, 2s limbs */
+
+ TOOM4_SQR_N_REC (v1 , as1 , n + 1, scratch_out); /* v1, 2n+1 limbs */
- TOOM4_SQR_REC (vh, apx, n + 1, tp); /* vh, 2n+1 limbs */
+ TOOM4_SQR_N_REC (vh , ash , n + 1, scratch_out);
- /* Compute apx = a0 + a1 + a2 + a3 and amx = a0 - a1 + a2 - a3. */
- mpn_toom_eval_dgr3_pm1 (apx, amx, ap, n, s, tp);
+ TOOM4_SQR_N_REC (vmh, asmh, n + 1, scratch_out);
- TOOM4_SQR_REC (v1, apx, n + 1, tp); /* v1, 2n+1 limbs */
- TOOM4_SQR_REC (vm1, amx, n + 1, tp); /* vm1, 2n+1 limbs */
+ TOOM4_SQR_N_REC (v0 , ap , n , scratch_out); /* v0, 2n limbs */
- TOOM4_SQR_REC (v0, a0, n, tp);
- TOOM4_SQR_REC (vinf, a3, s, tp); /* vinf, 2s limbs */
+ mpn_toom_interpolate_7pts (pp, n, 0, vmh, vm1, v1, v2, s + s, scratch_out);
- mpn_toom_interpolate_7pts (pp, n, (enum toom7_flags) 0, vm2, vm1, v2, vh, 2*s, tp);
+ TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom52_mul.c b/gmp/mpn/generic/toom52_mul.c
deleted file mode 100644
index e15b5833aa..0000000000
--- a/gmp/mpn/generic/toom52_mul.c
+++ /dev/null
@@ -1,257 +0,0 @@
-/* mpn_toom52_mul -- Multiply {ap,an} and {bp,bn} where an is nominally 4/3
- times as large as bn. Or more accurately, bn < an < 2 bn.
-
- Contributed to the GNU project by Marco Bodrato.
-
- The idea of applying toom to unbalanced multiplication is due to Marco
- Bodrato and Alberto Zanoni.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Evaluate in: -2, -1, 0, +1, +2, +inf
-
- <-s-><--n--><--n--><--n--><--n-->
- ___ ______ ______ ______ ______
- |a4_|___a3_|___a2_|___a1_|___a0_|
- |b1|___b0_|
- <t-><--n-->
-
- v0 = a0 * b0 # A(0)*B(0)
- v1 = (a0+ a1+ a2+ a3+ a4)*(b0+ b1) # A(1)*B(1) ah <= 4 bh <= 1
- vm1 = (a0- a1+ a2- a3+ a4)*(b0- b1) # A(-1)*B(-1) |ah| <= 2 bh = 0
- v2 = (a0+2a1+4a2+8a3+16a4)*(b0+2b1) # A(2)*B(2) ah <= 30 bh <= 2
- vm2 = (a0-2a1+4a2-8a3+16a4)*(b0-2b1) # A(-2)*B(-2) |ah| <= 20 |bh|<= 1
- vinf= a4 * b1 # A(inf)*B(inf)
-
- Some slight optimization in evaluation are taken from the paper:
- "Towards Optimal Toom-Cook Multiplication for Univariate and
- Multivariate Polynomials in Characteristic 2 and 0."
-*/
-
-void
-mpn_toom52_mul (mp_ptr pp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn, mp_ptr scratch)
-{
- mp_size_t n, s, t;
- enum toom6_flags flags;
-
-#define a0 ap
-#define a1 (ap + n)
-#define a2 (ap + 2 * n)
-#define a3 (ap + 3 * n)
-#define a4 (ap + 4 * n)
-#define b0 bp
-#define b1 (bp + n)
-
- n = 1 + (2 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) >> 1);
-
- s = an - 4 * n;
- t = bn - n;
-
- ASSERT (0 < s && s <= n);
- ASSERT (0 < t && t <= n);
-
- /* Ensures that 5 values of n+1 limbs each fits in the product area.
- Borderline cases are an = 32, bn = 8, n = 7, and an = 36, bn = 9,
- n = 8. */
- ASSERT (s+t >= 5);
-
-#define v0 pp /* 2n */
-#define vm1 (scratch) /* 2n+1 */
-#define v1 (pp + 2 * n) /* 2n+1 */
-#define vm2 (scratch + 2 * n + 1) /* 2n+1 */
-#define v2 (scratch + 4 * n + 2) /* 2n+1 */
-#define vinf (pp + 5 * n) /* s+t */
-#define bs1 pp /* n+1 */
-#define bsm1 (scratch + 2 * n + 2) /* n */
-#define asm1 (scratch + 3 * n + 3) /* n+1 */
-#define asm2 (scratch + 4 * n + 4) /* n+1 */
-#define bsm2 (pp + n + 1) /* n+1 */
-#define bs2 (pp + 2 * n + 2) /* n+1 */
-#define as2 (pp + 3 * n + 3) /* n+1 */
-#define as1 (pp + 4 * n + 4) /* n+1 */
-
- /* Scratch need is 6 * n + 3 + 1. We need one extra limb, because
- products will overwrite 2n+2 limbs. */
-
-#define a0a2 scratch
-#define a1a3 asm1
-
- /* Compute as2 and asm2. */
- flags = (enum toom6_flags) (toom6_vm2_neg & mpn_toom_eval_pm2 (as2, asm2, 4, ap, n, s, a1a3));
-
- /* Compute bs1 and bsm1. */
- if (t == n)
- {
-#if HAVE_NATIVE_mpn_add_n_sub_n
- mp_limb_t cy;
-
- if (mpn_cmp (b0, b1, n) < 0)
- {
- cy = mpn_add_n_sub_n (bs1, bsm1, b1, b0, n);
- flags = (enum toom6_flags) (flags ^ toom6_vm1_neg);
- }
- else
- {
- cy = mpn_add_n_sub_n (bs1, bsm1, b0, b1, n);
- }
- bs1[n] = cy >> 1;
-#else
- bs1[n] = mpn_add_n (bs1, b0, b1, n);
- if (mpn_cmp (b0, b1, n) < 0)
- {
- mpn_sub_n (bsm1, b1, b0, n);
- flags = (enum toom6_flags) (flags ^ toom6_vm1_neg);
- }
- else
- {
- mpn_sub_n (bsm1, b0, b1, n);
- }
-#endif
- }
- else
- {
- bs1[n] = mpn_add (bs1, b0, n, b1, t);
- if (mpn_zero_p (b0 + t, n - t) && mpn_cmp (b0, b1, t) < 0)
- {
- mpn_sub_n (bsm1, b1, b0, t);
- MPN_ZERO (bsm1 + t, n - t);
- flags = (enum toom6_flags) (flags ^ toom6_vm1_neg);
- }
- else
- {
- mpn_sub (bsm1, b0, n, b1, t);
- }
- }
-
- /* Compute bs2 and bsm2, recycling bs1 and bsm1. bs2=bs1+b1; bsm2=bsm1-b1 */
- mpn_add (bs2, bs1, n+1, b1, t);
- if (flags & toom6_vm1_neg )
- {
- bsm2[n] = mpn_add (bsm2, bsm1, n, b1, t);
- flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
- }
- else
- {
- bsm2[n] = 0;
- if (t == n)
- {
- if (mpn_cmp (bsm1, b1, n) < 0)
- {
- mpn_sub_n (bsm2, b1, bsm1, n);
- flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
- }
- else
- {
- mpn_sub_n (bsm2, bsm1, b1, n);
- }
- }
- else
- {
- if (mpn_zero_p (bsm1 + t, n - t) && mpn_cmp (bsm1, b1, t) < 0)
- {
- mpn_sub_n (bsm2, b1, bsm1, t);
- MPN_ZERO (bsm2 + t, n - t);
- flags = (enum toom6_flags) (flags ^ toom6_vm2_neg);
- }
- else
- {
- mpn_sub (bsm2, bsm1, n, b1, t);
- }
- }
- }
-
- /* Compute as1 and asm1. */
- flags = (enum toom6_flags) (flags ^ toom6_vm1_neg & mpn_toom_eval_pm1 (as1, asm1, 4, ap, n, s, a0a2));
-
- ASSERT (as1[n] <= 4);
- ASSERT (bs1[n] <= 1);
- ASSERT (asm1[n] <= 2);
-/* ASSERT (bsm1[n] <= 1); */
- ASSERT (as2[n] <=30);
- ASSERT (bs2[n] <= 2);
- ASSERT (asm2[n] <= 20);
- ASSERT (bsm2[n] <= 1);
-
- /* vm1, 2n+1 limbs */
- mpn_mul (vm1, asm1, n+1, bsm1, n); /* W4 */
-
- /* vm2, 2n+1 limbs */
- mpn_mul_n (vm2, asm2, bsm2, n+1); /* W2 */
-
- /* v2, 2n+1 limbs */
- mpn_mul_n (v2, as2, bs2, n+1); /* W1 */
-
- /* v1, 2n+1 limbs */
- mpn_mul_n (v1, as1, bs1, n+1); /* W3 */
-
- /* vinf, s+t limbs */ /* W0 */
- if (s > t) mpn_mul (vinf, a4, s, b1, t);
- else mpn_mul (vinf, b1, t, a4, s);
-
- /* v0, 2n limbs */
- mpn_mul_n (v0, ap, bp, n); /* W5 */
-
- mpn_toom_interpolate_6pts (pp, n, flags, vm1, vm2, v2, t + s);
-
-#undef v0
-#undef vm1
-#undef v1
-#undef vm2
-#undef v2
-#undef vinf
-#undef bs1
-#undef bs2
-#undef bsm1
-#undef bsm2
-#undef asm1
-#undef asm2
-#undef as1
-#undef as2
-#undef a0a2
-#undef b0b2
-#undef a1a3
-#undef a0
-#undef a1
-#undef a2
-#undef a3
-#undef b0
-#undef b1
-#undef b2
-
-}
diff --git a/gmp/mpn/generic/toom53_mul.c b/gmp/mpn/generic/toom53_mul.c
index 41274d48e0..4483d4dfb7 100644
--- a/gmp/mpn/generic/toom53_mul.c
+++ b/gmp/mpn/generic/toom53_mul.c
@@ -10,39 +10,35 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2008, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
+/*
+ Things to work on:
+
+ 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be
+ avoided by instead reusing the pp area and the scratch allocation.
+*/
+
#include "gmp.h"
#include "gmp-impl.h"
-/* Evaluate in: 0, +1, -1, +2, -2, 1/2, +inf
+/* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf
<-s-><--n--><--n--><--n--><--n-->
___ ______ ______ ______ ______
@@ -54,8 +50,8 @@ see https://www.gnu.org/licenses/. */
v1 = ( a0+ a1+ a2+ a3+ a4)*( b0+ b1+ b2) # A(1)*B(1) ah <= 4 bh <= 2
vm1 = ( a0- a1+ a2- a3+ a4)*( b0- b1+ b2) # A(-1)*B(-1) |ah| <= 2 bh <= 1
v2 = ( a0+2a1+4a2+8a3+16a4)*( b0+2b1+4b2) # A(2)*B(2) ah <= 30 bh <= 6
- vm2 = ( a0-2a1+4a2-8a3+16a4)*( b0-2b1+4b2) # A(2)*B(2) -9<=ah<=20 -1<=bh<=4
vh = (16a0+8a1+4a2+2a3+ a4)*(4b0+2b1+ b2) # A(1/2)*B(1/2) ah <= 30 bh <= 6
+ vmh = (16a0-8a1+4a2-2a3+ a4)*(4b0-2b1+ b2) # A(-1/2)*B(-1/2) -9<=ah<=20 -1<=bh<=4
vinf= a4 * b2 # A(inf)*B(inf)
*/
@@ -66,11 +62,12 @@ mpn_toom53_mul (mp_ptr pp,
mp_ptr scratch)
{
mp_size_t n, s, t;
+ int vm1_neg, vmh_neg;
mp_limb_t cy;
- mp_ptr gp;
- mp_ptr as1, asm1, as2, asm2, ash;
- mp_ptr bs1, bsm1, bs2, bsm2, bsh;
- enum toom7_flags flags;
+ mp_ptr gp, hp;
+ mp_ptr as1, asm1, as2, ash, asmh;
+ mp_ptr bs1, bsm1, bs2, bsh, bsmh;
+ enum toom4_flags flags;
TMP_DECL;
#define a0 ap
@@ -95,61 +92,124 @@ mpn_toom53_mul (mp_ptr pp,
as1 = TMP_SALLOC_LIMBS (n + 1);
asm1 = TMP_SALLOC_LIMBS (n + 1);
as2 = TMP_SALLOC_LIMBS (n + 1);
- asm2 = TMP_SALLOC_LIMBS (n + 1);
ash = TMP_SALLOC_LIMBS (n + 1);
+ asmh = TMP_SALLOC_LIMBS (n + 1);
bs1 = TMP_SALLOC_LIMBS (n + 1);
bsm1 = TMP_SALLOC_LIMBS (n + 1);
bs2 = TMP_SALLOC_LIMBS (n + 1);
- bsm2 = TMP_SALLOC_LIMBS (n + 1);
bsh = TMP_SALLOC_LIMBS (n + 1);
+ bsmh = TMP_SALLOC_LIMBS (n + 1);
gp = pp;
+ hp = pp + n + 1;
/* Compute as1 and asm1. */
- flags = (enum toom7_flags) (toom7_w3_neg & mpn_toom_eval_pm1 (as1, asm1, 4, ap, n, s, gp));
-
- /* Compute as2 and asm2. */
- flags = (enum toom7_flags) (flags | toom7_w1_neg & mpn_toom_eval_pm2 (as2, asm2, 4, ap, n, s, gp));
+ gp[n] = mpn_add_n (gp, a0, a2, n);
+ gp[n] += mpn_add (gp, gp, n, a4, s);
+ hp[n] = mpn_add_n (hp, a1, a3, n);
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_addsub_n (as1, asm1, hp, gp, n + 1);
+ vm1_neg = 1;
+ }
+ else
+ {
+ mpn_addsub_n (as1, asm1, gp, hp, n + 1);
+ vm1_neg = 0;
+ }
+#else
+ mpn_add_n (as1, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (asm1, hp, gp, n + 1);
+ vm1_neg = 1;
+ }
+ else
+ {
+ mpn_sub_n (asm1, gp, hp, n + 1);
+ vm1_neg = 0;
+ }
+#endif
- /* Compute ash = 16 a0 + 8 a1 + 4 a2 + 2 a3 + a4
- = 2*(2*(2*(2*a0 + a1) + a2) + a3) + a4 */
+ /* Compute as2. */
+#if !HAVE_NATIVE_mpn_addlsh_n
+ ash[n] = mpn_lshift (ash, a2, n, 2); /* 4a2 */
+#endif
#if HAVE_NATIVE_mpn_addlsh1_n
- cy = mpn_addlsh1_n (ash, a1, a0, n);
- cy = 2*cy + mpn_addlsh1_n (ash, a2, ash, n);
- cy = 2*cy + mpn_addlsh1_n (ash, a3, ash, n);
- if (s < n)
+ cy = mpn_addlsh1_n (as2, a3, a4, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a3 + s, n - s, cy);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a2, as2, n);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n);
+ as2[n] = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n);
+#else
+ cy = mpn_lshift (as2, a4, s, 1);
+ cy += mpn_add_n (as2, a3, as2, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a3 + s, n - s, cy);
+ cy = 4 * cy + mpn_lshift (as2, as2, n, 2);
+ cy += mpn_add_n (as2, a1, as2, n);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ as2[n] = cy + mpn_add_n (as2, a0, as2, n);
+ mpn_add_n (as2, ash, as2, n + 1);
+#endif
+
+ /* Compute ash and asmh. */
+#if HAVE_NATIVE_mpn_addlsh_n
+ cy = mpn_addlsh_n (gp, a2, a0, n, 2); /* 4a0 + a2 */
+ cy = 4 * cy + mpn_addlsh_n (gp, a4, gp, n, 2); /* 16a0 + 4a2 + a4 */ /* FIXME s */
+ gp[n] = cy;
+ cy = mpn_addlsh_n (hp, a3, a1, n, 2); /* 4a1 + a3 */
+ cy = 2 * cy + mpn_lshift (hp, hp, n, 1); /* 8a1 + 2a3 */
+ hp[n] = cy;
+#else
+ gp[n] = mpn_lshift (gp, a0, n, 4); /* 16a0 */
+ mpn_add (gp, gp, n + 1, a4, s); /* 16a0 + a4 */
+ mpn_add_n (gp, ash, gp, n+1); /* 16a0 + 4a2 + a4 */
+ cy = mpn_lshift (hp, a1, n, 3); /* 8a1 */
+ cy += mpn_lshift (ash, a3, n, 1); /* 2a3 */
+ cy += mpn_add_n (hp, ash, hp, n); /* 8a1 + 2a3 */
+ hp[n] = cy;
+#endif
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
{
- mp_limb_t cy2;
- cy2 = mpn_addlsh1_n (ash, a4, ash, s);
- ash[n] = 2*cy + mpn_lshift (ash + s, ash + s, n - s, 1);
- MPN_INCR_U (ash + s, n+1-s, cy2);
+ mpn_addsub_n (ash, asmh, hp, gp, n + 1);
+ vmh_neg = 1;
}
else
- ash[n] = 2*cy + mpn_addlsh1_n (ash, a4, ash, n);
+ {
+ mpn_addsub_n (ash, asmh, gp, hp, n + 1);
+ vmh_neg = 0;
+ }
#else
- cy = mpn_lshift (ash, a0, n, 1);
- cy += mpn_add_n (ash, ash, a1, n);
- cy = 2*cy + mpn_lshift (ash, ash, n, 1);
- cy += mpn_add_n (ash, ash, a2, n);
- cy = 2*cy + mpn_lshift (ash, ash, n, 1);
- cy += mpn_add_n (ash, ash, a3, n);
- cy = 2*cy + mpn_lshift (ash, ash, n, 1);
- ash[n] = cy + mpn_add (ash, ash, n, a4, s);
+ mpn_add_n (ash, gp, hp, n + 1);
+ if (mpn_cmp (gp, hp, n + 1) < 0)
+ {
+ mpn_sub_n (asmh, hp, gp, n + 1);
+ vmh_neg = 1;
+ }
+ else
+ {
+ mpn_sub_n (asmh, gp, hp, n + 1);
+ vmh_neg = 0;
+ }
#endif
/* Compute bs1 and bsm1. */
bs1[n] = mpn_add (bs1, b0, n, b2, t); /* b0 + b2 */
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
if (bs1[n] == 0 && mpn_cmp (bs1, b1, n) < 0)
{
- bs1[n] = mpn_add_n_sub_n (bs1, bsm1, b1, bs1, n) >> 1;
+ bs1[n] = mpn_addsub_n (bs1, bsm1, b1, bs1, n) >> 1;
bsm1[n] = 0;
- flags = (enum toom7_flags) (flags ^ toom7_w3_neg);
+ vm1_neg ^= 1;
}
else
{
- cy = mpn_add_n_sub_n (bs1, bsm1, bs1, b1, n);
+ cy = mpn_addsub_n (bs1, bsm1, bs1, b1, n);
bsm1[n] = bs1[n] - (cy & 1);
bs1[n] += (cy >> 1);
}
@@ -158,7 +218,7 @@ mpn_toom53_mul (mp_ptr pp,
{
mpn_sub_n (bsm1, b1, bs1, n);
bsm1[n] = 0;
- flags = (enum toom7_flags) (flags ^ toom7_w3_neg);
+ vm1_neg ^= 1;
}
else
{
@@ -167,64 +227,46 @@ mpn_toom53_mul (mp_ptr pp,
bs1[n] += mpn_add_n (bs1, bs1, b1, n); /* b0+b1+b2 */
#endif
- /* Compute bs2 and bsm2. */
-#if HAVE_NATIVE_mpn_addlsh_n || HAVE_NATIVE_mpn_addlsh2_n
-#if HAVE_NATIVE_mpn_addlsh2_n
- cy = mpn_addlsh2_n (bs2, b0, b2, t);
-#else /* HAVE_NATIVE_mpn_addlsh_n */
- cy = mpn_addlsh_n (bs2, b0, b2, t, 2);
-#endif
- if (t < n)
- cy = mpn_add_1 (bs2 + t, b0 + t, n - t, cy);
- bs2[n] = cy;
+ /* Compute bs2 */
+ hp[n] = mpn_lshift (hp, b1, n, 1); /* 2b1 */
+
+#ifdef HAVE_NATIVE_mpn_addlsh1_n
+ cy = mpn_addlsh1_n (bs2, b1, b2, t);
+ if (t != n)
+ cy = mpn_add_1 (bs2 + t, b1 + t, n - t, cy);
+ bs2[n] = 2 * cy + mpn_addlsh1_n (bs2, b0, bs2, n);
#else
- cy = mpn_lshift (gp, b2, t, 2);
- bs2[n] = mpn_add (bs2, b0, n, gp, t);
- MPN_INCR_U (bs2 + t, n+1-t, cy);
+ bs2[t] = mpn_lshift (bs2, b2, t, 2);
+ mpn_add (bs2, hp, n + 1, bs2, t + 1);
+ bs2[n] += mpn_add_n (bs2, bs2, b0, n);
#endif
- gp[n] = mpn_lshift (gp, b1, n, 1);
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (mpn_cmp (bs2, gp, n+1) < 0)
+ /* Compute bsh and bsmh. */
+#if HAVE_NATIVE_mpn_addlsh_n
+ gp[n] = mpn_addlsh_n (gp, b2, b0, n, 2); /* 4a0 + a2 */
+#else
+ cy = mpn_lshift (gp, b0, n, 2); /* 4b0 */
+ gp[n] = cy + mpn_add (gp, gp, n, b2, t); /* 4b0 + b2 */
+#endif
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (gp, hp, n + 1) < 0)
{
- ASSERT_NOCARRY (mpn_add_n_sub_n (bs2, bsm2, gp, bs2, n+1));
- flags = (enum toom7_flags) (flags ^ toom7_w1_neg);
+ mpn_addsub_n (bsh, bsmh, hp, gp, n + 1);
+ vmh_neg^= 1;
}
else
- {
- ASSERT_NOCARRY (mpn_add_n_sub_n (bs2, bsm2, bs2, gp, n+1));
- }
+ mpn_addsub_n (bsh, bsmh, gp, hp, n + 1);
#else
- if (mpn_cmp (bs2, gp, n+1) < 0)
+ mpn_add_n (bsh, gp, hp, n + 1); /* 4b0 + 2b1 + b2 */
+ if (mpn_cmp (gp, hp, n + 1) < 0)
{
- ASSERT_NOCARRY (mpn_sub_n (bsm2, gp, bs2, n+1));
- flags = (enum toom7_flags) (flags ^ toom7_w1_neg);
+ mpn_sub_n (bsmh, hp, gp, n + 1);
+ vmh_neg ^= 1;
}
else
{
- ASSERT_NOCARRY (mpn_sub_n (bsm2, bs2, gp, n+1));
+ mpn_sub_n (bsmh, gp, hp, n + 1);
}
- mpn_add_n (bs2, bs2, gp, n+1);
-#endif
-
- /* Compute bsh = 4 b0 + 2 b1 + b2 = 2*(2*b0 + b1)+b2. */
-#if HAVE_NATIVE_mpn_addlsh1_n
- cy = mpn_addlsh1_n (bsh, b1, b0, n);
- if (t < n)
- {
- mp_limb_t cy2;
- cy2 = mpn_addlsh1_n (bsh, b2, bsh, t);
- bsh[n] = 2*cy + mpn_lshift (bsh + t, bsh + t, n - t, 1);
- MPN_INCR_U (bsh + t, n+1-t, cy2);
- }
- else
- bsh[n] = 2*cy + mpn_addlsh1_n (bsh, b2, bsh, n);
-#else
- cy = mpn_lshift (bsh, b0, n, 1);
- cy += mpn_add_n (bsh, bsh, b1, n);
- cy = 2*cy + mpn_lshift (bsh, bsh, n, 1);
- bsh[n] = cy + mpn_add (bsh, bsh, n, b2, t);
#endif
ASSERT (as1[n] <= 4);
@@ -233,26 +275,18 @@ mpn_toom53_mul (mp_ptr pp,
ASSERT (bsm1[n] <= 1);
ASSERT (as2[n] <= 30);
ASSERT (bs2[n] <= 6);
- ASSERT (asm2[n] <= 20);
- ASSERT (bsm2[n] <= 4);
ASSERT (ash[n] <= 30);
ASSERT (bsh[n] <= 6);
+ ASSERT (asmh[n] <= 20);
+ ASSERT (bsmh[n] <= 4);
#define v0 pp /* 2n */
-#define v1 (pp + 2 * n) /* 2n+1 */
+#define v1 (scratch + 6 * n + 6) /* 2n+1 */
+#define vm1 scratch /* 2n+1 */
+#define v2 (scratch + 2 * n + 2) /* 2n+1 */
#define vinf (pp + 6 * n) /* s+t */
-#define v2 scratch /* 2n+1 */
-#define vm2 (scratch + 2 * n + 1) /* 2n+1 */
-#define vh (scratch + 4 * n + 2) /* 2n+1 */
-#define vm1 (scratch + 6 * n + 3) /* 2n+1 */
-#define scratch_out (scratch + 8 * n + 4) /* 2n+1 */
- /* Total scratch need: 10*n+5 */
-
- /* Must be in allocation order, as they overwrite one limb beyond
- * 2n+1. */
- mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */
- mpn_mul_n (vm2, asm2, bsm2, n + 1); /* vm2, 2n+1 limbs */
- mpn_mul_n (vh, ash, bsh, n + 1); /* vh, 2n+1 limbs */
+#define vh (pp + 2 * n) /* 2n+1 */
+#define vmh (scratch + 4 * n + 4)
/* vm1, 2n+1 limbs */
#ifdef SMALLER_RECURSION
@@ -279,6 +313,12 @@ mpn_toom53_mul (mp_ptr pp,
mpn_mul_n (vm1, asm1, bsm1, n + ((asm1[n] | bsm1[n]) != 0));
#endif /* SMALLER_RECURSION */
+ mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */
+
+ /* vinf, s+t limbs */
+ if (s > t) mpn_mul (vinf, a4, s, b2, t);
+ else mpn_mul (vinf, b2, t, a4, s);
+
/* v1, 2n+1 limbs */
#ifdef SMALLER_RECURSION
mpn_mul_n (v1, as1, bs1, n);
@@ -318,14 +358,16 @@ mpn_toom53_mul (mp_ptr pp,
mpn_mul_n (v1, as1, bs1, n + ((as1[n] | bs1[n]) != 0));
#endif /* SMALLER_RECURSION */
- mpn_mul_n (v0, a0, b0, n); /* v0, 2n limbs */
+ mpn_mul_n (vh, ash, bsh, n + 1);
- /* vinf, s+t limbs */
- if (s > t) mpn_mul (vinf, a4, s, b2, t);
- else mpn_mul (vinf, b2, t, a4, s);
+ mpn_mul_n (vmh, asmh, bsmh, n + 1);
+
+ mpn_mul_n (v0, ap, bp, n); /* v0, 2n limbs */
+
+ flags = vm1_neg ? toom4_w3_neg : 0;
+ flags |= vmh_neg ? toom4_w1_neg : 0;
- mpn_toom_interpolate_7pts (pp, n, flags, vm2, vm1, v2, vh, s + t,
- scratch_out);
+ mpn_toom_interpolate_7pts (pp, n, flags, vmh, vm1, v1, v2, s + t, scratch + 8 * n + 8);
TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom54_mul.c b/gmp/mpn/generic/toom54_mul.c
deleted file mode 100644
index 939bb53ab6..0000000000
--- a/gmp/mpn/generic/toom54_mul.c
+++ /dev/null
@@ -1,143 +0,0 @@
-/* Implementation of the algorithm for Toom-Cook 4.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-
-/* Toom-4.5, the splitting 5x4 unbalanced version.
- Evaluate in: infinity, +4, -4, +2, -2, +1, -1, 0.
-
- <--s-><--n--><--n--><--n--><--n-->
- ____ ______ ______ ______ ______
- |_a4_|__a3__|__a2__|__a1__|__a0__|
- |b3_|__b2__|__b1__|__b0__|
- <-t-><--n--><--n--><--n-->
-
-*/
-#define TOOM_54_MUL_N_REC(p, a, b, n, ws) \
- do { mpn_mul_n (p, a, b, n); \
- } while (0)
-
-#define TOOM_54_MUL_REC(p, a, na, b, nb, ws) \
- do { mpn_mul (p, a, na, b, nb); \
- } while (0)
-
-void
-mpn_toom54_mul (mp_ptr pp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn, mp_ptr scratch)
-{
- mp_size_t n, s, t;
- int sign;
-
- /***************************** decomposition *******************************/
-#define a4 (ap + 4 * n)
-#define b3 (bp + 3 * n)
-
- ASSERT (an >= bn);
- n = 1 + (4 * an >= 5 * bn ? (an - 1) / (size_t) 5 : (bn - 1) / (size_t) 4);
-
- s = an - 4 * n;
- t = bn - 3 * n;
-
- ASSERT (0 < s && s <= n);
- ASSERT (0 < t && t <= n);
- /* Required by mpn_toom_interpolate_8pts. */
- ASSERT ( s + t >= n );
- ASSERT ( s + t > 4);
- ASSERT ( n > 2);
-
-#define r8 pp /* 2n */
-#define r7 scratch /* 3n+1 */
-#define r5 (pp + 3*n) /* 3n+1 */
-#define v0 (pp + 3*n) /* n+1 */
-#define v1 (pp + 4*n+1) /* n+1 */
-#define v2 (pp + 5*n+2) /* n+1 */
-#define v3 (pp + 6*n+3) /* n+1 */
-#define r3 (scratch + 3 * n + 1) /* 3n+1 */
-#define r1 (pp + 7*n) /* s+t <= 2*n */
-#define ws (scratch + 6 * n + 2) /* ??? */
-
- /* Alloc also 3n+1 limbs for ws... mpn_toom_interpolate_8pts may
- need all of them, when DO_mpn_sublsh_n usea a scratch */
- /********************** evaluation and recursive calls *********************/
- /* $\pm4$ */
- sign = mpn_toom_eval_pm2exp (v2, v0, 4, ap, n, s, 2, pp)
- ^ mpn_toom_eval_pm2exp (v3, v1, 3, bp, n, t, 2, pp);
- TOOM_54_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-4)*B(-4) */
- TOOM_54_MUL_N_REC(r3, v2, v3, n + 1, ws); /* A(+4)*B(+4) */
- mpn_toom_couple_handling (r3, 2*n+1, pp, sign, n, 2, 4);
-
- /* $\pm1$ */
- sign = mpn_toom_eval_pm1 (v2, v0, 4, ap, n, s, pp)
- ^ mpn_toom_eval_dgr3_pm1 (v3, v1, bp, n, t, pp);
- TOOM_54_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-1)*B(-1) */
- TOOM_54_MUL_N_REC(r7, v2, v3, n + 1, ws); /* A(1)*B(1) */
- mpn_toom_couple_handling (r7, 2*n+1, pp, sign, n, 0, 0);
-
- /* $\pm2$ */
- sign = mpn_toom_eval_pm2 (v2, v0, 4, ap, n, s, pp)
- ^ mpn_toom_eval_dgr3_pm2 (v3, v1, bp, n, t, pp);
- TOOM_54_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-2)*B(-2) */
- TOOM_54_MUL_N_REC(r5, v2, v3, n + 1, ws); /* A(+2)*B(+2) */
- mpn_toom_couple_handling (r5, 2*n+1, pp, sign, n, 1, 2);
-
- /* A(0)*B(0) */
- TOOM_54_MUL_N_REC(pp, ap, bp, n, ws);
-
- /* Infinity */
- if (s > t) {
- TOOM_54_MUL_REC(r1, a4, s, b3, t, ws);
- } else {
- TOOM_54_MUL_REC(r1, b3, t, a4, s, ws);
- };
-
- mpn_toom_interpolate_8pts (pp, n, r3, r7, s + t, ws);
-
-#undef a4
-#undef b3
-#undef r1
-#undef r3
-#undef r5
-#undef v0
-#undef v1
-#undef v2
-#undef v3
-#undef r7
-#undef r8
-#undef ws
-}
diff --git a/gmp/mpn/generic/toom62_mul.c b/gmp/mpn/generic/toom62_mul.c
index 3759e3cb3c..944b3feffd 100644
--- a/gmp/mpn/generic/toom62_mul.c
+++ b/gmp/mpn/generic/toom62_mul.c
@@ -10,42 +10,38 @@
SAFE TO REACH IT THROUGH DOCUMENTED INTERFACES. IN FACT, IT IS ALMOST
GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 2006-2008, 2012 Free Software Foundation, Inc.
+Copyright 2006, 2007, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
+/*
+ Things to work on:
+
+ 1. Trim allocation. The allocations for as1, asm1, bs1, and bsm1 could be
+ avoided by instead reusing the pp area and the scratch allocation.
+*/
+
#include "gmp.h"
#include "gmp-impl.h"
-/* Evaluate in:
- 0, +1, -1, +2, -2, 1/2, +inf
- <-s-><--n--><--n--><--n--><--n--><--n-->
+/* Evaluate in: -1, -1/2, 0, +1/2, +1, +2, +inf
+
+ <-s-><--n--><--n--><--n-->
___ ______ ______ ______ ______ ______
|a5_|___a4_|___a3_|___a2_|___a1_|___a0_|
|_b1_|___b0_|
@@ -55,8 +51,8 @@ see https://www.gnu.org/licenses/. */
v1 = ( a0+ a1+ a2+ a3+ a4+ a5)*( b0+ b1) # A(1)*B(1) ah <= 5 bh <= 1
vm1 = ( a0- a1+ a2- a3+ a4- a5)*( b0- b1) # A(-1)*B(-1) |ah| <= 2 bh = 0
v2 = ( a0+ 2a1+4a2+8a3+16a4+32a5)*( b0+2b1) # A(2)*B(2) ah <= 62 bh <= 2
- vm2 = ( a0- 2a1+4a2-8a3+16a4-32a5)*( b0-2b1) # A(-2)*B(-2) -41<=ah<=20 -1<=bh<=0
vh = (32a0+16a1+8a2+4a3+ 2a4+ a5)*(2b0+ b1) # A(1/2)*B(1/2) ah <= 62 bh <= 2
+ vmh = (32a0-16a1+8a2-4a3+ 2a4- a5)*(2b0- b1) # A(-1/2)*B(-1/2) -20<=ah<=41 0<=bh<=1
vinf= a5 * b1 # A(inf)*B(inf)
*/
@@ -67,11 +63,12 @@ mpn_toom62_mul (mp_ptr pp,
mp_ptr scratch)
{
mp_size_t n, s, t;
+ int vm1_neg, vmh_neg, bsm_neg;
mp_limb_t cy;
- mp_ptr as1, asm1, as2, asm2, ash;
- mp_ptr bs1, bsm1, bs2, bsm2, bsh;
- mp_ptr gp;
- enum toom7_flags aflags, bflags;
+ mp_ptr a0_a2, a1_a3;
+ mp_ptr as1, asm1, as2, ash, asmh;
+ mp_ptr bs1, bsm1, bs2, bsh, bsmh;
+ enum toom4_flags flags;
TMP_DECL;
#define a0 ap
@@ -83,7 +80,7 @@ mpn_toom62_mul (mp_ptr pp,
#define b0 bp
#define b1 (bp + n)
- n = 1 + (an >= 3 * bn ? (an - 1) / (size_t) 6 : (bn - 1) >> 1);
+ n = 1 + (an >= 3 * bn ? (an - 1) / (unsigned long) 6 : (bn - 1) >> 1);
s = an - 5 * n;
t = bn - n;
@@ -96,66 +93,133 @@ mpn_toom62_mul (mp_ptr pp,
as1 = TMP_SALLOC_LIMBS (n + 1);
asm1 = TMP_SALLOC_LIMBS (n + 1);
as2 = TMP_SALLOC_LIMBS (n + 1);
- asm2 = TMP_SALLOC_LIMBS (n + 1);
ash = TMP_SALLOC_LIMBS (n + 1);
+ asmh = TMP_SALLOC_LIMBS (n + 1);
bs1 = TMP_SALLOC_LIMBS (n + 1);
bsm1 = TMP_SALLOC_LIMBS (n);
bs2 = TMP_SALLOC_LIMBS (n + 1);
- bsm2 = TMP_SALLOC_LIMBS (n + 1);
bsh = TMP_SALLOC_LIMBS (n + 1);
+ bsmh = TMP_SALLOC_LIMBS (n + 1);
- gp = pp;
+ a0_a2 = pp;
+ a1_a3 = pp + n + 1;
/* Compute as1 and asm1. */
- aflags = (enum toom7_flags) (toom7_w3_neg & mpn_toom_eval_pm1 (as1, asm1, 5, ap, n, s, gp));
-
- /* Compute as2 and asm2. */
- aflags = (enum toom7_flags) (aflags | toom7_w1_neg & mpn_toom_eval_pm2 (as2, asm2, 5, ap, n, s, gp));
-
- /* Compute ash = 32 a0 + 16 a1 + 8 a2 + 4 a3 + 2 a4 + a5
- = 2*(2*(2*(2*(2*a0 + a1) + a2) + a3) + a4) + a5 */
+ a0_a2[n] = mpn_add_n (a0_a2, a0, a2, n);
+ a0_a2[n] += mpn_add_n (a0_a2, a0_a2, a4, n);
+ a1_a3[n] = mpn_add_n (a1_a3, a1, a3, n);
+ a1_a3[n] += mpn_add (a1_a3, a1_a3, n, a5, s);
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0)
+ {
+ mpn_addsub_n (as1, asm1, a1_a3, a0_a2, n + 1);
+ vm1_neg = 1;
+ }
+ else
+ {
+ mpn_addsub_n (as1, asm1, a0_a2, a1_a3, n + 1);
+ vm1_neg = 0;
+ }
+#else
+ mpn_add_n (as1, a0_a2, a1_a3, n + 1);
+ if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0)
+ {
+ mpn_sub_n (asm1, a1_a3, a0_a2, n + 1);
+ vm1_neg = 1;
+ }
+ else
+ {
+ mpn_sub_n (asm1, a0_a2, a1_a3, n + 1);
+ vm1_neg = 0;
+ }
+#endif
+ /* Compute as2. */
#if HAVE_NATIVE_mpn_addlsh1_n
- cy = mpn_addlsh1_n (ash, a1, a0, n);
- cy = 2*cy + mpn_addlsh1_n (ash, a2, ash, n);
- cy = 2*cy + mpn_addlsh1_n (ash, a3, ash, n);
- cy = 2*cy + mpn_addlsh1_n (ash, a4, ash, n);
- if (s < n)
+ cy = mpn_addlsh1_n (as2, a4, a5, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a4 + s, n - s, cy);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a3, as2, n);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a2, as2, n);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a1, as2, n);
+ cy = 2 * cy + mpn_addlsh1_n (as2, a0, as2, n);
+#else
+ cy = mpn_lshift (as2, a5, s, 1);
+ cy += mpn_add_n (as2, a4, as2, s);
+ if (s != n)
+ cy = mpn_add_1 (as2 + s, a4 + s, n - s, cy);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a3, as2, n);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a2, as2, n);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a1, as2, n);
+ cy = 2 * cy + mpn_lshift (as2, as2, n, 1);
+ cy += mpn_add_n (as2, a0, as2, n);
+#endif
+ as2[n] = cy;
+
+ /* Compute ash and asmh. */
+#if HAVE_NATIVE_mpn_addlsh_n
+ cy = mpn_addlsh_n (a0_a2, a2, a0, n, 2); /* 4a0 + a2 */
+ cy = 4 * cy + mpn_addlsh_n (a0_a2, a4, a0_a2, n, 2); /* 16a0 + 4a2 + a4 */
+ cy = 2 * cy + mpn_lshift (a0_a2, a0_a2, n, 1); /* 32a0 + 8a2 + 2a4 */
+ a0_a2[n] = cy;
+ cy = mpn_addlsh_n (a1_a3, a3, a1, n, 2); /* 4a1 */
+ cy = 4 * cy + mpn_addlsh_n (a1_a3, a5, a1_a3, n, 2); /* 16a1 + 4a3 */
+ a1_a3[n] = cy;
+#else
+ cy = mpn_lshift (a0_a2, a0, n, 2); /* 4a0 */
+ cy += mpn_add_n (a0_a2, a2, a0_a2, n); /* 4a0 + a2 */
+ cy = 4 * cy + mpn_lshift (a0_a2, a0_a2, n, 2); /* 16a0 + 4a2 */
+ cy += mpn_add_n (a0_a2, a4, a0_a2, n); /* 16a0 + 4a2 + a4 */
+ cy = 2 * cy + mpn_lshift (a0_a2, a0_a2, n, 1); /* 32a0 + 8a2 + 2a4 */
+ a0_a2[n] = cy;
+ cy = mpn_lshift (a1_a3, a1, n, 2); /* 4a1 */
+ cy += mpn_add_n (a1_a3, a3, a1_a3, n); /* 4a1 + a3 */
+ cy = 4 * cy + mpn_lshift (a1_a3, a1_a3, n, 2); /* 16a1 + 4a3 */
+ cy += mpn_add (a1_a3, a1_a3, n, a5, s); /* 16a1 + 4a3 + a5 */
+ a1_a3[n] = cy;
+#endif
+#if HAVE_NATIVE_mpn_addsub_n
+ if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0)
{
- mp_limb_t cy2;
- cy2 = mpn_addlsh1_n (ash, a5, ash, s);
- ash[n] = 2*cy + mpn_lshift (ash + s, ash + s, n - s, 1);
- MPN_INCR_U (ash + s, n+1-s, cy2);
+ mpn_addsub_n (ash, asmh, a1_a3, a0_a2, n + 1);
+ vmh_neg = 1;
}
else
- ash[n] = 2*cy + mpn_addlsh1_n (ash, a5, ash, n);
+ {
+ mpn_addsub_n (ash, asmh, a0_a2, a1_a3, n + 1);
+ vmh_neg = 0;
+ }
#else
- cy = mpn_lshift (ash, a0, n, 1);
- cy += mpn_add_n (ash, ash, a1, n);
- cy = 2*cy + mpn_lshift (ash, ash, n, 1);
- cy += mpn_add_n (ash, ash, a2, n);
- cy = 2*cy + mpn_lshift (ash, ash, n, 1);
- cy += mpn_add_n (ash, ash, a3, n);
- cy = 2*cy + mpn_lshift (ash, ash, n, 1);
- cy += mpn_add_n (ash, ash, a4, n);
- cy = 2*cy + mpn_lshift (ash, ash, n, 1);
- ash[n] = cy + mpn_add (ash, ash, n, a5, s);
+ mpn_add_n (ash, a0_a2, a1_a3, n + 1);
+ if (mpn_cmp (a0_a2, a1_a3, n + 1) < 0)
+ {
+ mpn_sub_n (asmh, a1_a3, a0_a2, n + 1);
+ vmh_neg = 1;
+ }
+ else
+ {
+ mpn_sub_n (asmh, a0_a2, a1_a3, n + 1);
+ vmh_neg = 0;
+ }
#endif
/* Compute bs1 and bsm1. */
if (t == n)
{
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
if (mpn_cmp (b0, b1, n) < 0)
{
- cy = mpn_add_n_sub_n (bs1, bsm1, b1, b0, n);
- bflags = toom7_w3_neg;
+ cy = mpn_addsub_n (bs1, bsm1, b1, b0, n);
+ bsm_neg = 1;
}
else
{
- cy = mpn_add_n_sub_n (bs1, bsm1, b0, b1, n);
- bflags = (enum toom7_flags) 0;
+ cy = mpn_addsub_n (bs1, bsm1, b0, b1, n);
+ bsm_neg = 0;
}
bs1[n] = cy >> 1;
#else
@@ -163,12 +227,12 @@ mpn_toom62_mul (mp_ptr pp,
if (mpn_cmp (b0, b1, n) < 0)
{
mpn_sub_n (bsm1, b1, b0, n);
- bflags = toom7_w3_neg;
+ bsm_neg = 1;
}
else
{
mpn_sub_n (bsm1, b0, b1, n);
- bflags = (enum toom7_flags) 0;
+ bsm_neg = 0;
}
#endif
}
@@ -179,83 +243,56 @@ mpn_toom62_mul (mp_ptr pp,
{
mpn_sub_n (bsm1, b1, b0, t);
MPN_ZERO (bsm1 + t, n - t);
- bflags = toom7_w3_neg;
+ bsm_neg = 1;
}
else
{
mpn_sub (bsm1, b0, n, b1, t);
- bflags = (enum toom7_flags) 0;
+ bsm_neg = 0;
}
}
- /* Compute bs2 and bsm2. Recycling bs1 and bsm1; bs2=bs1+b1, bsm2 =
- bsm1 - b1 */
+ vm1_neg ^= bsm_neg;
+
+ /* Compute bs2, recycling bs1. bs2=bs1+b1 */
mpn_add (bs2, bs1, n + 1, b1, t);
- if (bflags & toom7_w3_neg)
- {
- bsm2[n] = mpn_add (bsm2, bsm1, n, b1, t);
- bflags = (enum toom7_flags) (bflags | toom7_w1_neg);
- }
- else
+
+ /* Compute bsh and bsmh, recycling bs1 and bsm1. bsh=bs1+b0; bsmh=bsmh+b0 */
+ if (bsm_neg == 1)
{
- /* FIXME: Simplify this logic? */
- if (t < n)
+ bsmh[n] = 0;
+ if (mpn_cmp (bsm1, b0, n) < 0)
{
- if (mpn_zero_p (bsm1 + t, n - t) && mpn_cmp (bsm1, b1, t) < 0)
- {
- ASSERT_NOCARRY (mpn_sub_n (bsm2, b1, bsm1, t));
- MPN_ZERO (bsm2 + t, n + 1 - t);
- bflags = (enum toom7_flags) (bflags | toom7_w1_neg);
- }
- else
- {
- ASSERT_NOCARRY (mpn_sub (bsm2, bsm1, n, b1, t));
- bsm2[n] = 0;
- }
+ bsm_neg = 0;
+ mpn_sub_n (bsmh, b0, bsm1, n);
}
else
- {
- if (mpn_cmp (bsm1, b1, n) < 0)
- {
- ASSERT_NOCARRY (mpn_sub_n (bsm2, b1, bsm1, n));
- bflags = (enum toom7_flags) (bflags | toom7_w1_neg);
- }
- else
- {
- ASSERT_NOCARRY (mpn_sub_n (bsm2, bsm1, b1, n));
- }
- bsm2[n] = 0;
- }
+ mpn_sub_n (bsmh, bsm1, b0, n);
}
+ else
+ bsmh[n] = mpn_add_n (bsmh, bsm1, b0, n);
+ mpn_add (bsh, bs1, n + 1, b0, n);
+ vmh_neg ^= bsm_neg;
- /* Compute bsh, recycling bs1. bsh=bs1+b0; */
- bsh[n] = bs1[n] + mpn_add_n (bsh, bs1, b0, n);
ASSERT (as1[n] <= 5);
ASSERT (bs1[n] <= 1);
ASSERT (asm1[n] <= 2);
+/*ASSERT (bsm1[n] == 0);*/
ASSERT (as2[n] <= 62);
ASSERT (bs2[n] <= 2);
- ASSERT (asm2[n] <= 41);
- ASSERT (bsm2[n] <= 1);
ASSERT (ash[n] <= 62);
ASSERT (bsh[n] <= 2);
+ ASSERT (asmh[n] <= 41);
+ ASSERT (bsmh[n] <= 1);
#define v0 pp /* 2n */
-#define v1 (pp + 2 * n) /* 2n+1 */
+#define v1 (scratch + 6 * n + 6) /* 2n+1 */
#define vinf (pp + 6 * n) /* s+t */
-#define v2 scratch /* 2n+1 */
-#define vm2 (scratch + 2 * n + 1) /* 2n+1 */
-#define vh (scratch + 4 * n + 2) /* 2n+1 */
-#define vm1 (scratch + 6 * n + 3) /* 2n+1 */
-#define scratch_out (scratch + 8 * n + 4) /* 2n+1 */
- /* Total scratch need: 10*n+5 */
-
- /* Must be in allocation order, as they overwrite one limb beyond
- * 2n+1. */
- mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */
- mpn_mul_n (vm2, asm2, bsm2, n + 1); /* vm2, 2n+1 limbs */
- mpn_mul_n (vh, ash, bsh, n + 1); /* vh, 2n+1 limbs */
+#define vm1 scratch /* 2n+1 */
+#define v2 (scratch + 2 * n + 2) /* 2n+1 */
+#define vh (pp + 2 * n) /* 2n+1 */
+#define vmh (scratch + 4 * n + 4)
/* vm1, 2n+1 limbs */
mpn_mul_n (vm1, asm1, bsm1, n);
@@ -274,6 +311,12 @@ mpn_toom62_mul (mp_ptr pp,
}
vm1[2 * n] = cy;
+ mpn_mul_n (v2, as2, bs2, n + 1); /* v2, 2n+1 limbs */
+
+ /* vinf, s+t limbs */
+ if (s > t) mpn_mul (vinf, a5, s, b1, t);
+ else mpn_mul (vinf, b1, t, a5, s);
+
/* v1, 2n+1 limbs */
mpn_mul_n (v1, as1, bs1, n);
if (as1[n] == 1)
@@ -298,14 +341,16 @@ mpn_toom62_mul (mp_ptr pp,
cy += mpn_add_n (v1 + n, v1 + n, as1, n);
v1[2 * n] = cy;
- mpn_mul_n (v0, a0, b0, n); /* v0, 2n limbs */
+ mpn_mul_n (vh, ash, bsh, n + 1);
- /* vinf, s+t limbs */
- if (s > t) mpn_mul (vinf, a5, s, b1, t);
- else mpn_mul (vinf, b1, t, a5, s);
+ mpn_mul_n (vmh, asmh, bsmh, n + 1);
+
+ mpn_mul_n (v0, ap, bp, n); /* v0, 2n limbs */
+
+ flags = vm1_neg ? toom4_w3_neg : 0;
+ flags |= vmh_neg ? toom4_w1_neg : 0;
- mpn_toom_interpolate_7pts (pp, n, (enum toom7_flags) (aflags ^ bflags),
- vm2, vm1, v2, vh, s + t, scratch_out);
+ mpn_toom_interpolate_7pts (pp, n, flags, vmh, vm1, v1, v2, s + t, scratch + 8 * n + 8);
TMP_FREE;
}
diff --git a/gmp/mpn/generic/toom63_mul.c b/gmp/mpn/generic/toom63_mul.c
deleted file mode 100644
index 57c5d3e3dd..0000000000
--- a/gmp/mpn/generic/toom63_mul.c
+++ /dev/null
@@ -1,232 +0,0 @@
-/* Implementation of the algorithm for Toom-Cook 4.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Stores |{ap,n}-{bp,n}| in {rp,n}, returns the sign. */
-static int
-abs_sub_n (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n)
-{
- mp_limb_t x, y;
- while (--n >= 0)
- {
- x = ap[n];
- y = bp[n];
- if (x != y)
- {
- n++;
- if (x > y)
- {
- mpn_sub_n (rp, ap, bp, n);
- return 0;
- }
- else
- {
- mpn_sub_n (rp, bp, ap, n);
- return ~0;
- }
- }
- rp[n] = 0;
- }
- return 0;
-}
-
-static int
-abs_sub_add_n (mp_ptr rm, mp_ptr rp, mp_srcptr rs, mp_size_t n) {
- int result;
- result = abs_sub_n (rm, rp, rs, n);
- ASSERT_NOCARRY(mpn_add_n (rp, rp, rs, n));
- return result;
-}
-
-
-/* Toom-4.5, the splitting 6x3 unbalanced version.
- Evaluate in: infinity, +4, -4, +2, -2, +1, -1, 0.
-
- <--s-><--n--><--n--><--n--><--n--><--n-->
- ____ ______ ______ ______ ______ ______
- |_a5_|__a4__|__a3__|__a2__|__a1__|__a0__|
- |b2_|__b1__|__b0__|
- <-t-><--n--><--n-->
-
-*/
-#define TOOM_63_MUL_N_REC(p, a, b, n, ws) \
- do { mpn_mul_n (p, a, b, n); \
- } while (0)
-
-#define TOOM_63_MUL_REC(p, a, na, b, nb, ws) \
- do { mpn_mul (p, a, na, b, nb); \
- } while (0)
-
-void
-mpn_toom63_mul (mp_ptr pp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn, mp_ptr scratch)
-{
- mp_size_t n, s, t;
- mp_limb_t cy;
- int sign;
-
- /***************************** decomposition *******************************/
-#define a5 (ap + 5 * n)
-#define b0 (bp + 0 * n)
-#define b1 (bp + 1 * n)
-#define b2 (bp + 2 * n)
-
- ASSERT (an >= bn);
- n = 1 + (an >= 2 * bn ? (an - 1) / (size_t) 6 : (bn - 1) / (size_t) 3);
-
- s = an - 5 * n;
- t = bn - 2 * n;
-
- ASSERT (0 < s && s <= n);
- ASSERT (0 < t && t <= n);
- /* WARNING! it assumes s+t>=n */
- ASSERT ( s + t >= n );
- ASSERT ( s + t > 4);
- /* WARNING! it assumes n>1 */
- ASSERT ( n > 2);
-
-#define r8 pp /* 2n */
-#define r7 scratch /* 3n+1 */
-#define r5 (pp + 3*n) /* 3n+1 */
-#define v0 (pp + 3*n) /* n+1 */
-#define v1 (pp + 4*n+1) /* n+1 */
-#define v2 (pp + 5*n+2) /* n+1 */
-#define v3 (pp + 6*n+3) /* n+1 */
-#define r3 (scratch + 3 * n + 1) /* 3n+1 */
-#define r1 (pp + 7*n) /* s+t <= 2*n */
-#define ws (scratch + 6 * n + 2) /* ??? */
-
- /* Alloc also 3n+1 limbs for ws... mpn_toom_interpolate_8pts may
- need all of them, when DO_mpn_sublsh_n usea a scratch */
-/* if (scratch == NULL) scratch = TMP_SALLOC_LIMBS (9 * n + 3); */
-
- /********************** evaluation and recursive calls *********************/
- /* $\pm4$ */
- sign = mpn_toom_eval_pm2exp (v2, v0, 5, ap, n, s, 2, pp);
- pp[n] = mpn_lshift (pp, b1, n, 2); /* 4b1 */
- /* FIXME: use addlsh */
- v3[t] = mpn_lshift (v3, b2, t, 4);/* 16b2 */
- if ( n == t )
- v3[n]+= mpn_add_n (v3, v3, b0, n); /* 16b2+b0 */
- else
- v3[n] = mpn_add (v3, b0, n, v3, t+1); /* 16b2+b0 */
- sign ^= abs_sub_add_n (v1, v3, pp, n + 1);
- TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-4)*B(-4) */
- TOOM_63_MUL_N_REC(r3, v2, v3, n + 1, ws); /* A(+4)*B(+4) */
- mpn_toom_couple_handling (r3, 2*n+1, pp, sign, n, 2, 4);
-
- /* $\pm1$ */
- sign = mpn_toom_eval_pm1 (v2, v0, 5, ap, n, s, pp);
- /* Compute bs1 and bsm1. Code taken from toom33 */
- cy = mpn_add (ws, b0, n, b2, t);
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (cy == 0 && mpn_cmp (ws, b1, n) < 0)
- {
- cy = mpn_add_n_sub_n (v3, v1, b1, ws, n);
- v3[n] = cy >> 1;
- v1[n] = 0;
- sign = ~sign;
- }
- else
- {
- mp_limb_t cy2;
- cy2 = mpn_add_n_sub_n (v3, v1, ws, b1, n);
- v3[n] = cy + (cy2 >> 1);
- v1[n] = cy - (cy2 & 1);
- }
-#else
- v3[n] = cy + mpn_add_n (v3, ws, b1, n);
- if (cy == 0 && mpn_cmp (ws, b1, n) < 0)
- {
- mpn_sub_n (v1, b1, ws, n);
- v1[n] = 0;
- sign = ~sign;
- }
- else
- {
- cy -= mpn_sub_n (v1, ws, b1, n);
- v1[n] = cy;
- }
-#endif
- TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-1)*B(-1) */
- TOOM_63_MUL_N_REC(r7, v2, v3, n + 1, ws); /* A(1)*B(1) */
- mpn_toom_couple_handling (r7, 2*n+1, pp, sign, n, 0, 0);
-
- /* $\pm2$ */
- sign = mpn_toom_eval_pm2 (v2, v0, 5, ap, n, s, pp);
- pp[n] = mpn_lshift (pp, b1, n, 1); /* 2b1 */
- /* FIXME: use addlsh or addlsh2 */
- v3[t] = mpn_lshift (v3, b2, t, 2);/* 4b2 */
- if ( n == t )
- v3[n]+= mpn_add_n (v3, v3, b0, n); /* 4b2+b0 */
- else
- v3[n] = mpn_add (v3, b0, n, v3, t+1); /* 4b2+b0 */
- sign ^= abs_sub_add_n (v1, v3, pp, n + 1);
- TOOM_63_MUL_N_REC(pp, v0, v1, n + 1, ws); /* A(-2)*B(-2) */
- TOOM_63_MUL_N_REC(r5, v2, v3, n + 1, ws); /* A(+2)*B(+2) */
- mpn_toom_couple_handling (r5, 2*n+1, pp, sign, n, 1, 2);
-
- /* A(0)*B(0) */
- TOOM_63_MUL_N_REC(pp, ap, bp, n, ws);
-
- /* Infinity */
- if (s > t) {
- TOOM_63_MUL_REC(r1, a5, s, b2, t, ws);
- } else {
- TOOM_63_MUL_REC(r1, b2, t, a5, s, ws);
- };
-
- mpn_toom_interpolate_8pts (pp, n, r3, r7, s + t, ws);
-
-#undef a5
-#undef b0
-#undef b1
-#undef b2
-#undef r1
-#undef r3
-#undef r5
-#undef v0
-#undef v1
-#undef v2
-#undef v3
-#undef r7
-#undef r8
-#undef ws
-}
diff --git a/gmp/mpn/generic/toom6_sqr.c b/gmp/mpn/generic/toom6_sqr.c
deleted file mode 100644
index e5ab7dcd1d..0000000000
--- a/gmp/mpn/generic/toom6_sqr.c
+++ /dev/null
@@ -1,182 +0,0 @@
-/* Implementation of the squaring algorithm with Toom-Cook 6.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 GMP_NUMB_BITS < 21
-#error Not implemented.
-#endif
-
-
-#if TUNE_PROGRAM_BUILD
-#define MAYBE_sqr_basecase 1
-#define MAYBE_sqr_above_basecase 1
-#define MAYBE_sqr_toom2 1
-#define MAYBE_sqr_above_toom2 1
-#define MAYBE_sqr_toom3 1
-#define MAYBE_sqr_above_toom3 1
-#define MAYBE_sqr_above_toom4 1
-#else
-#ifdef SQR_TOOM8_THRESHOLD
-#define SQR_TOOM6_MAX ((SQR_TOOM8_THRESHOLD+6*2-1+5)/6)
-#else
-#define SQR_TOOM6_MAX \
- ((SQR_FFT_THRESHOLD <= MP_SIZE_T_MAX - (6*2-1+5)) ? \
- ((SQR_FFT_THRESHOLD+6*2-1+5)/6) \
- : MP_SIZE_T_MAX )
-#endif
-#define MAYBE_sqr_basecase \
- (SQR_TOOM6_THRESHOLD < 6 * SQR_TOOM2_THRESHOLD)
-#define MAYBE_sqr_above_basecase \
- (SQR_TOOM6_MAX >= SQR_TOOM2_THRESHOLD)
-#define MAYBE_sqr_toom2 \
- (SQR_TOOM6_THRESHOLD < 6 * SQR_TOOM3_THRESHOLD)
-#define MAYBE_sqr_above_toom2 \
- (SQR_TOOM6_MAX >= SQR_TOOM3_THRESHOLD)
-#define MAYBE_sqr_toom3 \
- (SQR_TOOM6_THRESHOLD < 6 * SQR_TOOM4_THRESHOLD)
-#define MAYBE_sqr_above_toom3 \
- (SQR_TOOM6_MAX >= SQR_TOOM4_THRESHOLD)
-#define MAYBE_sqr_above_toom4 \
- (SQR_TOOM6_MAX >= SQR_TOOM6_THRESHOLD)
-#endif
-
-#define TOOM6_SQR_REC(p, a, n, ws) \
- do { \
- if (MAYBE_sqr_basecase && ( !MAYBE_sqr_above_basecase \
- || BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD))) \
- mpn_sqr_basecase (p, a, n); \
- else if (MAYBE_sqr_toom2 && ( !MAYBE_sqr_above_toom2 \
- || BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD))) \
- mpn_toom2_sqr (p, a, n, ws); \
- else if (MAYBE_sqr_toom3 && ( !MAYBE_sqr_above_toom3 \
- || BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD))) \
- mpn_toom3_sqr (p, a, n, ws); \
- else if (! MAYBE_sqr_above_toom4 \
- || BELOW_THRESHOLD (n, SQR_TOOM6_THRESHOLD)) \
- mpn_toom4_sqr (p, a, n, ws); \
- else \
- mpn_toom6_sqr (p, a, n, ws); \
- } while (0)
-
-void
-mpn_toom6_sqr (mp_ptr pp, mp_srcptr ap, mp_size_t an, mp_ptr scratch)
-{
- mp_size_t n, s;
-
- /***************************** decomposition *******************************/
-
- ASSERT( an >= 18 );
-
- n = 1 + (an - 1) / (size_t) 6;
-
- s = an - 5 * n;
-
- ASSERT (0 < s && s <= n);
-
-#define r4 (pp + 3 * n) /* 3n+1 */
-#define r2 (pp + 7 * n) /* 3n+1 */
-#define r0 (pp +11 * n) /* s+t <= 2*n */
-#define r5 (scratch) /* 3n+1 */
-#define r3 (scratch + 3 * n + 1) /* 3n+1 */
-#define r1 (scratch + 6 * n + 2) /* 3n+1 */
-#define v0 (pp + 7 * n) /* n+1 */
-#define v2 (pp + 9 * n+2) /* n+1 */
-#define wse (scratch + 9 * n + 3) /* 3n+1 */
-
- /* Alloc also 3n+1 limbs for ws... toom_interpolate_12pts may
- need all of them, when DO_mpn_sublsh_n usea a scratch */
-/* if (scratch== NULL) */
-/* scratch = TMP_SALLOC_LIMBS (12 * n + 6); */
-
- /********************** evaluation and recursive calls *********************/
- /* $\pm1/2$ */
- mpn_toom_eval_pm2rexp (v2, v0, 5, ap, n, s, 1, pp);
- TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-1/2)*B(-1/2)*2^. */
- TOOM6_SQR_REC(r5, v2, n + 1, wse); /* A(+1/2)*B(+1/2)*2^. */
- mpn_toom_couple_handling (r5, 2 * n + 1, pp, 0, n, 1, 0);
-
- /* $\pm1$ */
- mpn_toom_eval_pm1 (v2, v0, 5, ap, n, s, pp);
- TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-1)*B(-1) */
- TOOM6_SQR_REC(r3, v2, n + 1, wse); /* A(1)*B(1) */
- mpn_toom_couple_handling (r3, 2 * n + 1, pp, 0, n, 0, 0);
-
- /* $\pm4$ */
- mpn_toom_eval_pm2exp (v2, v0, 5, ap, n, s, 2, pp);
- TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-4)*B(-4) */
- TOOM6_SQR_REC(r1, v2, n + 1, wse); /* A(+4)*B(+4) */
- mpn_toom_couple_handling (r1, 2 * n + 1, pp, 0, n, 2, 4);
-
- /* $\pm1/4$ */
- mpn_toom_eval_pm2rexp (v2, v0, 5, ap, n, s, 2, pp);
- TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-1/4)*B(-1/4)*4^. */
- TOOM6_SQR_REC(r4, v2, n + 1, wse); /* A(+1/4)*B(+1/4)*4^. */
- mpn_toom_couple_handling (r4, 2 * n + 1, pp, 0, n, 2, 0);
-
- /* $\pm2$ */
- mpn_toom_eval_pm2 (v2, v0, 5, ap, n, s, pp);
- TOOM6_SQR_REC(pp, v0, n + 1, wse); /* A(-2)*B(-2) */
- TOOM6_SQR_REC(r2, v2, n + 1, wse); /* A(+2)*B(+2) */
- mpn_toom_couple_handling (r2, 2 * n + 1, pp, 0, n, 1, 2);
-
-#undef v0
-#undef v2
-
- /* A(0)*B(0) */
- TOOM6_SQR_REC(pp, ap, n, wse);
-
- mpn_toom_interpolate_12pts (pp, r1, r3, r5, n, 2 * s, 0, wse);
-
-#undef r0
-#undef r1
-#undef r2
-#undef r3
-#undef r4
-#undef r5
-
-}
-#undef TOOM6_SQR_REC
-#undef MAYBE_sqr_basecase
-#undef MAYBE_sqr_above_basecase
-#undef MAYBE_sqr_toom2
-#undef MAYBE_sqr_above_toom2
-#undef MAYBE_sqr_toom3
-#undef MAYBE_sqr_above_toom3
-#undef MAYBE_sqr_above_toom4
diff --git a/gmp/mpn/generic/toom6h_mul.c b/gmp/mpn/generic/toom6h_mul.c
deleted file mode 100644
index 420895be8f..0000000000
--- a/gmp/mpn/generic/toom6h_mul.c
+++ /dev/null
@@ -1,263 +0,0 @@
-/* Implementation of the multiplication algorithm for Toom-Cook 6.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 GMP_NUMB_BITS < 21
-#error Not implemented.
-#endif
-
-#if TUNE_PROGRAM_BUILD
-#define MAYBE_mul_basecase 1
-#define MAYBE_mul_toom22 1
-#define MAYBE_mul_toom33 1
-#define MAYBE_mul_toom6h 1
-#else
-#define MAYBE_mul_basecase \
- (MUL_TOOM6H_THRESHOLD < 6 * MUL_TOOM22_THRESHOLD)
-#define MAYBE_mul_toom22 \
- (MUL_TOOM6H_THRESHOLD < 6 * MUL_TOOM33_THRESHOLD)
-#define MAYBE_mul_toom33 \
- (MUL_TOOM6H_THRESHOLD < 6 * MUL_TOOM44_THRESHOLD)
-#define MAYBE_mul_toom6h \
- (MUL_FFT_THRESHOLD >= 6 * MUL_TOOM6H_THRESHOLD)
-#endif
-
-#define TOOM6H_MUL_N_REC(p, a, b, f, p2, a2, b2, n, ws) \
- do { \
- if (MAYBE_mul_basecase \
- && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) { \
- mpn_mul_basecase (p, a, n, b, n); \
- if (f) \
- mpn_mul_basecase (p2, a2, n, b2, n); \
- } else if (MAYBE_mul_toom22 \
- && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) { \
- mpn_toom22_mul (p, a, n, b, n, ws); \
- if (f) \
- mpn_toom22_mul (p2, a2, n, b2, n, ws); \
- } else if (MAYBE_mul_toom33 \
- && BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) { \
- mpn_toom33_mul (p, a, n, b, n, ws); \
- if (f) \
- mpn_toom33_mul (p2, a2, n, b2, n, ws); \
- } else if (! MAYBE_mul_toom6h \
- || BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD)) { \
- mpn_toom44_mul (p, a, n, b, n, ws); \
- if (f) \
- mpn_toom44_mul (p2, a2, n, b2, n, ws); \
- } else { \
- mpn_toom6h_mul (p, a, n, b, n, ws); \
- if (f) \
- mpn_toom6h_mul (p2, a2, n, b2, n, ws); \
- } \
- } while (0)
-
-#define TOOM6H_MUL_REC(p, a, na, b, nb, ws) \
- do { mpn_mul (p, a, na, b, nb); \
- } while (0)
-
-/* Toom-6.5 , compute the product {pp,an+bn} <- {ap,an} * {bp,bn}
- With: an >= bn >= 46, an*6 < bn * 17.
- It _may_ work with bn<=46 and bn*17 < an*6 < bn*18
-
- Evaluate in: infinity, +4, -4, +2, -2, +1, -1, +1/2, -1/2, +1/4, -1/4, 0.
-*/
-/* Estimate on needed scratch:
- S(n) <= (n+5)\6*10+4+MAX(S((n+5)\6),1+2*(n+5)\6),
- since n>42; S(n) <= ceil(log(n)/log(6))*(10+4)+n*12\6 < n*2 + lg2(n)*6
- */
-
-void
-mpn_toom6h_mul (mp_ptr pp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn, mp_ptr scratch)
-{
- mp_size_t n, s, t;
- int p, q, half;
- int sign;
-
- /***************************** decomposition *******************************/
-
- ASSERT (an >= bn);
- /* Can not handle too much unbalancement */
- ASSERT (bn >= 42);
- /* Can not handle too much unbalancement */
- ASSERT ((an*3 < bn * 8) || (bn >= 46 && an * 6 < bn * 17));
-
- /* Limit num/den is a rational number between
- (12/11)^(log(4)/log(2*4-1)) and (12/11)^(log(6)/log(2*6-1)) */
-#define LIMIT_numerator (18)
-#define LIMIT_denominat (17)
-
- if (LIKELY (an * LIMIT_denominat < LIMIT_numerator * bn)) /* is 6*... < 6*... */
- {
- n = 1 + (an - 1) / (size_t) 6;
- p = q = 5;
- half = 0;
-
- s = an - 5 * n;
- t = bn - 5 * n;
- }
- else {
- if (an * 5 * LIMIT_numerator < LIMIT_denominat * 7 * bn)
- { p = 7; q = 6; }
- else if (an * 5 * LIMIT_denominat < LIMIT_numerator * 7 * bn)
- { p = 7; q = 5; }
- else if (an * LIMIT_numerator < LIMIT_denominat * 2 * bn) /* is 4*... < 8*... */
- { p = 8; q = 5; }
- else if (an * LIMIT_denominat < LIMIT_numerator * 2 * bn) /* is 4*... < 8*... */
- { p = 8; q = 4; }
- else
- { p = 9; q = 4; }
-
- half = (p ^ q) & 1;
- n = 1 + (q * an >= p * bn ? (an - 1) / (size_t) p : (bn - 1) / (size_t) q);
- p--; q--;
-
- s = an - p * n;
- t = bn - q * n;
-
- /* With LIMIT = 16/15, the following recover is needed only if bn<=73*/
- if (half) { /* Recover from badly chosen splitting */
- if (UNLIKELY (s<1)) {p--; s+=n; half=0;}
- else if (UNLIKELY (t<1)) {q--; t+=n; half=0;}
- }
- }
-#undef LIMIT_numerator
-#undef LIMIT_denominat
-
- ASSERT (0 < s && s <= n);
- ASSERT (0 < t && t <= n);
- ASSERT (half || s + t > 3);
- ASSERT (n > 2);
-
-#define r4 (pp + 3 * n) /* 3n+1 */
-#define r2 (pp + 7 * n) /* 3n+1 */
-#define r0 (pp +11 * n) /* s+t <= 2*n */
-#define r5 (scratch) /* 3n+1 */
-#define r3 (scratch + 3 * n + 1) /* 3n+1 */
-#define r1 (scratch + 6 * n + 2) /* 3n+1 */
-#define v0 (pp + 7 * n) /* n+1 */
-#define v1 (pp + 8 * n+1) /* n+1 */
-#define v2 (pp + 9 * n+2) /* n+1 */
-#define v3 (scratch + 9 * n + 3) /* n+1 */
-#define wsi (scratch + 9 * n + 3) /* 3n+1 */
-#define wse (scratch +10 * n + 4) /* 2n+1 */
-
- /* Alloc also 3n+1 limbs for wsi... toom_interpolate_12pts may
- need all of them */
-/* if (scratch == NULL) */
-/* scratch = TMP_SALLOC_LIMBS(mpn_toom6_sqr_itch(n * 6)); */
- ASSERT (12 * n + 6 <= mpn_toom6h_mul_itch(an,bn));
- ASSERT (12 * n + 6 <= mpn_toom6_sqr_itch(n * 6));
-
- /********************** evaluation and recursive calls *********************/
- /* $\pm1/2$ */
- sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 1, pp) ^
- mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 1, pp);
- /* A(-1/2)*B(-1/2)*2^. */ /* A(+1/2)*B(+1/2)*2^. */
- TOOM6H_MUL_N_REC(pp, v0, v1, 2, r5, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r5, 2 * n + 1, pp, sign, n, 1+half , half);
-
- /* $\pm1$ */
- sign = mpn_toom_eval_pm1 (v2, v0, p, ap, n, s, pp);
- if (UNLIKELY (q == 3))
- sign ^= mpn_toom_eval_dgr3_pm1 (v3, v1, bp, n, t, pp);
- else
- sign ^= mpn_toom_eval_pm1 (v3, v1, q, bp, n, t, pp);
- /* A(-1)*B(-1) */ /* A(1)*B(1) */
- TOOM6H_MUL_N_REC(pp, v0, v1, 2, r3, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r3, 2 * n + 1, pp, sign, n, 0, 0);
-
- /* $\pm4$ */
- sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 2, pp) ^
- mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 2, pp);
- /* A(-4)*B(-4) */
- TOOM6H_MUL_N_REC(pp, v0, v1, 2, r1, v2, v3, n + 1, wse); /* A(+4)*B(+4) */
- mpn_toom_couple_handling (r1, 2 * n + 1, pp, sign, n, 2, 4);
-
- /* $\pm1/4$ */
- sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 2, pp) ^
- mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 2, pp);
- /* A(-1/4)*B(-1/4)*4^. */ /* A(+1/4)*B(+1/4)*4^. */
- TOOM6H_MUL_N_REC(pp, v0, v1, 2, r4, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r4, 2 * n + 1, pp, sign, n, 2*(1+half), 2*(half));
-
- /* $\pm2$ */
- sign = mpn_toom_eval_pm2 (v2, v0, p, ap, n, s, pp) ^
- mpn_toom_eval_pm2 (v3, v1, q, bp, n, t, pp);
- /* A(-2)*B(-2) */ /* A(+2)*B(+2) */
- TOOM6H_MUL_N_REC(pp, v0, v1, 2, r2, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r2, 2 * n + 1, pp, sign, n, 1, 2);
-
-#undef v0
-#undef v1
-#undef v2
-#undef v3
-#undef wse
-
- /* A(0)*B(0) */
- TOOM6H_MUL_N_REC(pp, ap, bp, 0, pp, ap, bp, n, wsi);
-
- /* Infinity */
- if (UNLIKELY (half != 0)) {
- if (s > t) {
- TOOM6H_MUL_REC(r0, ap + p * n, s, bp + q * n, t, wsi);
- } else {
- TOOM6H_MUL_REC(r0, bp + q * n, t, ap + p * n, s, wsi);
- };
- };
-
- mpn_toom_interpolate_12pts (pp, r1, r3, r5, n, s+t, half, wsi);
-
-#undef r0
-#undef r1
-#undef r2
-#undef r3
-#undef r4
-#undef r5
-#undef wsi
-}
-
-#undef TOOM6H_MUL_N_REC
-#undef TOOM6H_MUL_REC
-#undef MAYBE_mul_basecase
-#undef MAYBE_mul_toom22
-#undef MAYBE_mul_toom33
-#undef MAYBE_mul_toom6h
diff --git a/gmp/mpn/generic/toom8_sqr.c b/gmp/mpn/generic/toom8_sqr.c
deleted file mode 100644
index 0c93678815..0000000000
--- a/gmp/mpn/generic/toom8_sqr.c
+++ /dev/null
@@ -1,226 +0,0 @@
-/* Implementation of the squaring algorithm with Toom-Cook 8.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 GMP_NUMB_BITS < 29
-#error Not implemented.
-#endif
-
-#if GMP_NUMB_BITS < 43
-#define BIT_CORRECTION 1
-#define CORRECTION_BITS GMP_NUMB_BITS
-#else
-#define BIT_CORRECTION 0
-#define CORRECTION_BITS 0
-#endif
-
-#ifndef SQR_TOOM8_THRESHOLD
-#define SQR_TOOM8_THRESHOLD MUL_TOOM8H_THRESHOLD
-#endif
-
-#ifndef SQR_TOOM6_THRESHOLD
-#define SQR_TOOM6_THRESHOLD MUL_TOOM6H_THRESHOLD
-#endif
-
-#if TUNE_PROGRAM_BUILD
-#define MAYBE_sqr_basecase 1
-#define MAYBE_sqr_above_basecase 1
-#define MAYBE_sqr_toom2 1
-#define MAYBE_sqr_above_toom2 1
-#define MAYBE_sqr_toom3 1
-#define MAYBE_sqr_above_toom3 1
-#define MAYBE_sqr_toom4 1
-#define MAYBE_sqr_above_toom4 1
-#define MAYBE_sqr_above_toom6 1
-#else
-#define SQR_TOOM8_MAX \
- ((SQR_FFT_THRESHOLD <= MP_SIZE_T_MAX - (8*2-1+7)) ? \
- ((SQR_FFT_THRESHOLD+8*2-1+7)/8) \
- : MP_SIZE_T_MAX )
-#define MAYBE_sqr_basecase \
- (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM2_THRESHOLD)
-#define MAYBE_sqr_above_basecase \
- (SQR_TOOM8_MAX >= SQR_TOOM2_THRESHOLD)
-#define MAYBE_sqr_toom2 \
- (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM3_THRESHOLD)
-#define MAYBE_sqr_above_toom2 \
- (SQR_TOOM8_MAX >= SQR_TOOM3_THRESHOLD)
-#define MAYBE_sqr_toom3 \
- (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM4_THRESHOLD)
-#define MAYBE_sqr_above_toom3 \
- (SQR_TOOM8_MAX >= SQR_TOOM4_THRESHOLD)
-#define MAYBE_sqr_toom4 \
- (SQR_TOOM8_THRESHOLD < 8 * SQR_TOOM6_THRESHOLD)
-#define MAYBE_sqr_above_toom4 \
- (SQR_TOOM8_MAX >= SQR_TOOM6_THRESHOLD)
-#define MAYBE_sqr_above_toom6 \
- (SQR_TOOM8_MAX >= SQR_TOOM8_THRESHOLD)
-#endif
-
-#define TOOM8_SQR_REC(p, a, f, p2, a2, n, ws) \
- do { \
- if (MAYBE_sqr_basecase && ( !MAYBE_sqr_above_basecase \
- || BELOW_THRESHOLD (n, SQR_TOOM2_THRESHOLD))) { \
- mpn_sqr_basecase (p, a, n); \
- if (f) mpn_sqr_basecase (p2, a2, n); \
- } else if (MAYBE_sqr_toom2 && ( !MAYBE_sqr_above_toom2 \
- || BELOW_THRESHOLD (n, SQR_TOOM3_THRESHOLD))) { \
- mpn_toom2_sqr (p, a, n, ws); \
- if (f) mpn_toom2_sqr (p2, a2, n, ws); \
- } else if (MAYBE_sqr_toom3 && ( !MAYBE_sqr_above_toom3 \
- || BELOW_THRESHOLD (n, SQR_TOOM4_THRESHOLD))) { \
- mpn_toom3_sqr (p, a, n, ws); \
- if (f) mpn_toom3_sqr (p2, a2, n, ws); \
- } else if (MAYBE_sqr_toom4 && ( !MAYBE_sqr_above_toom4 \
- || BELOW_THRESHOLD (n, SQR_TOOM6_THRESHOLD))) { \
- mpn_toom4_sqr (p, a, n, ws); \
- if (f) mpn_toom4_sqr (p2, a2, n, ws); \
- } else if (! MAYBE_sqr_above_toom6 \
- || BELOW_THRESHOLD (n, SQR_TOOM8_THRESHOLD)) { \
- mpn_toom6_sqr (p, a, n, ws); \
- if (f) mpn_toom6_sqr (p2, a2, n, ws); \
- } else { \
- mpn_toom8_sqr (p, a, n, ws); \
- if (f) mpn_toom8_sqr (p2, a2, n, ws); \
- } \
- } while (0)
-
-void
-mpn_toom8_sqr (mp_ptr pp, mp_srcptr ap, mp_size_t an, mp_ptr scratch)
-{
- mp_size_t n, s;
-
- /***************************** decomposition *******************************/
-
- ASSERT ( an >= 40 );
-
- n = 1 + ((an - 1)>>3);
-
- s = an - 7 * n;
-
- ASSERT (0 < s && s <= n);
- ASSERT ( s + s > 3 );
-
-#define r6 (pp + 3 * n) /* 3n+1 */
-#define r4 (pp + 7 * n) /* 3n+1 */
-#define r2 (pp +11 * n) /* 3n+1 */
-#define r0 (pp +15 * n) /* s+t <= 2*n */
-#define r7 (scratch) /* 3n+1 */
-#define r5 (scratch + 3 * n + 1) /* 3n+1 */
-#define r3 (scratch + 6 * n + 2) /* 3n+1 */
-#define r1 (scratch + 9 * n + 3) /* 3n+1 */
-#define v0 (pp +11 * n) /* n+1 */
-#define v2 (pp +13 * n+2) /* n+1 */
-#define wse (scratch +12 * n + 4) /* 3n+1 */
-
- /* Alloc also 3n+1 limbs for ws... toom_interpolate_16pts may
- need all of them, when DO_mpn_sublsh_n usea a scratch */
-/* if (scratch == NULL) */
-/* scratch = TMP_SALLOC_LIMBS (30 * n + 6); */
-
- /********************** evaluation and recursive calls *********************/
- /* $\pm1/8$ */
- mpn_toom_eval_pm2rexp (v2, v0, 7, ap, n, s, 3, pp);
- /* A(-1/8)*B(-1/8)*8^. */ /* A(+1/8)*B(+1/8)*8^. */
- TOOM8_SQR_REC(pp, v0, 2, r7, v2, n + 1, wse);
- mpn_toom_couple_handling (r7, 2 * n + 1 + BIT_CORRECTION, pp, 0, n, 3, 0);
-
- /* $\pm1/4$ */
- mpn_toom_eval_pm2rexp (v2, v0, 7, ap, n, s, 2, pp);
- /* A(-1/4)*B(-1/4)*4^. */ /* A(+1/4)*B(+1/4)*4^. */
- TOOM8_SQR_REC(pp, v0, 2, r5, v2, n + 1, wse);
- mpn_toom_couple_handling (r5, 2 * n + 1, pp, 0, n, 2, 0);
-
- /* $\pm2$ */
- mpn_toom_eval_pm2 (v2, v0, 7, ap, n, s, pp);
- /* A(-2)*B(-2) */ /* A(+2)*B(+2) */
- TOOM8_SQR_REC(pp, v0, 2, r3, v2, n + 1, wse);
- mpn_toom_couple_handling (r3, 2 * n + 1, pp, 0, n, 1, 2);
-
- /* $\pm8$ */
- mpn_toom_eval_pm2exp (v2, v0, 7, ap, n, s, 3, pp);
- /* A(-8)*B(-8) */ /* A(+8)*B(+8) */
- TOOM8_SQR_REC(pp, v0, 2, r1, v2, n + 1, wse);
- mpn_toom_couple_handling (r1, 2 * n + 1 + BIT_CORRECTION, pp, 0, n, 3, 6);
-
- /* $\pm1/2$ */
- mpn_toom_eval_pm2rexp (v2, v0, 7, ap, n, s, 1, pp);
- /* A(-1/2)*B(-1/2)*2^. */ /* A(+1/2)*B(+1/2)*2^. */
- TOOM8_SQR_REC(pp, v0, 2, r6, v2, n + 1, wse);
- mpn_toom_couple_handling (r6, 2 * n + 1, pp, 0, n, 1, 0);
-
- /* $\pm1$ */
- mpn_toom_eval_pm1 (v2, v0, 7, ap, n, s, pp);
- /* A(-1)*B(-1) */ /* A(1)*B(1) */
- TOOM8_SQR_REC(pp, v0, 2, r4, v2, n + 1, wse);
- mpn_toom_couple_handling (r4, 2 * n + 1, pp, 0, n, 0, 0);
-
- /* $\pm4$ */
- mpn_toom_eval_pm2exp (v2, v0, 7, ap, n, s, 2, pp);
- /* A(-4)*B(-4) */ /* A(+4)*B(+4) */
- TOOM8_SQR_REC(pp, v0, 2, r2, v2, n + 1, wse);
- mpn_toom_couple_handling (r2, 2 * n + 1, pp, 0, n, 2, 4);
-
-#undef v0
-#undef v2
-
- /* A(0)*B(0) */
- TOOM8_SQR_REC(pp, ap, 0, pp, ap, n, wse);
-
- mpn_toom_interpolate_16pts (pp, r1, r3, r5, r7, n, 2 * s, 0, wse);
-
-#undef r0
-#undef r1
-#undef r2
-#undef r3
-#undef r4
-#undef r5
-#undef r6
-#undef wse
-
-}
-
-#undef TOOM8_SQR_REC
-#undef MAYBE_sqr_basecase
-#undef MAYBE_sqr_above_basecase
-#undef MAYBE_sqr_toom2
-#undef MAYBE_sqr_above_toom2
-#undef MAYBE_sqr_toom3
-#undef MAYBE_sqr_above_toom3
-#undef MAYBE_sqr_above_toom4
diff --git a/gmp/mpn/generic/toom8h_mul.c b/gmp/mpn/generic/toom8h_mul.c
deleted file mode 100644
index 8f593903f5..0000000000
--- a/gmp/mpn/generic/toom8h_mul.c
+++ /dev/null
@@ -1,306 +0,0 @@
-/* Implementation of the multiplication algorithm for Toom-Cook 8.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 GMP_NUMB_BITS < 29
-#error Not implemented.
-#endif
-
-#if GMP_NUMB_BITS < 43
-#define BIT_CORRECTION 1
-#define CORRECTION_BITS GMP_NUMB_BITS
-#else
-#define BIT_CORRECTION 0
-#define CORRECTION_BITS 0
-#endif
-
-
-#if TUNE_PROGRAM_BUILD
-#define MAYBE_mul_basecase 1
-#define MAYBE_mul_toom22 1
-#define MAYBE_mul_toom33 1
-#define MAYBE_mul_toom44 1
-#define MAYBE_mul_toom8h 1
-#else
-#define MAYBE_mul_basecase \
- (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM22_THRESHOLD)
-#define MAYBE_mul_toom22 \
- (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM33_THRESHOLD)
-#define MAYBE_mul_toom33 \
- (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM44_THRESHOLD)
-#define MAYBE_mul_toom44 \
- (MUL_TOOM8H_THRESHOLD < 8 * MUL_TOOM6H_THRESHOLD)
-#define MAYBE_mul_toom8h \
- (MUL_FFT_THRESHOLD >= 8 * MUL_TOOM8H_THRESHOLD)
-#endif
-
-#define TOOM8H_MUL_N_REC(p, a, b, f, p2, a2, b2, n, ws) \
- do { \
- if (MAYBE_mul_basecase \
- && BELOW_THRESHOLD (n, MUL_TOOM22_THRESHOLD)) { \
- mpn_mul_basecase (p, a, n, b, n); \
- if (f) mpn_mul_basecase (p2, a2, n, b2, n); \
- } else if (MAYBE_mul_toom22 \
- && BELOW_THRESHOLD (n, MUL_TOOM33_THRESHOLD)) { \
- mpn_toom22_mul (p, a, n, b, n, ws); \
- if (f) mpn_toom22_mul (p2, a2, n, b2, n, ws); \
- } else if (MAYBE_mul_toom33 \
- && BELOW_THRESHOLD (n, MUL_TOOM44_THRESHOLD)) { \
- mpn_toom33_mul (p, a, n, b, n, ws); \
- if (f) mpn_toom33_mul (p2, a2, n, b2, n, ws); \
- } else if (MAYBE_mul_toom44 \
- && BELOW_THRESHOLD (n, MUL_TOOM6H_THRESHOLD)) { \
- mpn_toom44_mul (p, a, n, b, n, ws); \
- if (f) mpn_toom44_mul (p2, a2, n, b2, n, ws); \
- } else if (! MAYBE_mul_toom8h \
- || BELOW_THRESHOLD (n, MUL_TOOM8H_THRESHOLD)) { \
- mpn_toom6h_mul (p, a, n, b, n, ws); \
- if (f) mpn_toom6h_mul (p2, a2, n, b2, n, ws); \
- } else { \
- mpn_toom8h_mul (p, a, n, b, n, ws); \
- if (f) mpn_toom8h_mul (p2, a2, n, b2, n, ws); \
- } \
- } while (0)
-
-#define TOOM8H_MUL_REC(p, a, na, b, nb, ws) \
- do { mpn_mul (p, a, na, b, nb); } while (0)
-
-/* Toom-8.5 , compute the product {pp,an+bn} <- {ap,an} * {bp,bn}
- With: an >= bn >= 86, an*5 < bn * 11.
- It _may_ work with bn<=?? and bn*?? < an*? < bn*??
-
- Evaluate in: infinity, +8,-8,+4,-4,+2,-2,+1,-1,+1/2,-1/2,+1/4,-1/4,+1/8,-1/8,0.
-*/
-/* Estimate on needed scratch:
- S(n) <= (n+7)\8*13+5+MAX(S((n+7)\8),1+2*(n+7)\8),
- since n>80; S(n) <= ceil(log(n/10)/log(8))*(13+5)+n*15\8 < n*15\8 + lg2(n)*6
- */
-
-void
-mpn_toom8h_mul (mp_ptr pp,
- mp_srcptr ap, mp_size_t an,
- mp_srcptr bp, mp_size_t bn, mp_ptr scratch)
-{
- mp_size_t n, s, t;
- int p, q, half;
- int sign;
-
- /***************************** decomposition *******************************/
-
- ASSERT (an >= bn);
- /* Can not handle too small operands */
- ASSERT (bn >= 86);
- /* Can not handle too much unbalancement */
- ASSERT (an <= bn*4);
- ASSERT (GMP_NUMB_BITS > 11*3 || an*4 <= bn*11);
- ASSERT (GMP_NUMB_BITS > 10*3 || an*1 <= bn* 2);
- ASSERT (GMP_NUMB_BITS > 9*3 || an*2 <= bn* 3);
-
- /* Limit num/den is a rational number between
- (16/15)^(log(6)/log(2*6-1)) and (16/15)^(log(8)/log(2*8-1)) */
-#define LIMIT_numerator (21)
-#define LIMIT_denominat (20)
-
- if (LIKELY (an == bn) || an * (LIMIT_denominat>>1) < LIMIT_numerator * (bn>>1) ) /* is 8*... < 8*... */
- {
- half = 0;
- n = 1 + ((an - 1)>>3);
- p = q = 7;
- s = an - 7 * n;
- t = bn - 7 * n;
- }
- else
- {
- if (an * 13 < 16 * bn) /* (an*7*LIMIT_numerator<LIMIT_denominat*9*bn) */
- { p = 9; q = 8; }
- else if (GMP_NUMB_BITS <= 9*3 ||
- an *(LIMIT_denominat>>1) < (LIMIT_numerator/7*9) * (bn>>1))
- { p = 9; q = 7; }
- else if (an * 10 < 33 * (bn>>1)) /* (an*3*LIMIT_numerator<LIMIT_denominat*5*bn) */
- { p =10; q = 7; }
- else if (GMP_NUMB_BITS <= 10*3 ||
- an * (LIMIT_denominat/5) < (LIMIT_numerator/3) * bn)
- { p =10; q = 6; }
- else if (an * 6 < 13 * bn) /*(an * 5 * LIMIT_numerator < LIMIT_denominat *11 * bn)*/
- { p =11; q = 6; }
- else if (GMP_NUMB_BITS <= 11*3 ||
- an * 4 < 9 * bn)
- { p =11; q = 5; }
- else if (an *(LIMIT_numerator/3) < LIMIT_denominat * bn) /* is 4*... <12*... */
- { p =12; q = 5; }
- else if (GMP_NUMB_BITS <= 12*3 ||
- an * 9 < 28 * bn ) /* is 4*... <12*... */
- { p =12; q = 4; }
- else
- { p =13; q = 4; }
-
- half = (p+q)&1;
- n = 1 + (q * an >= p * bn ? (an - 1) / (size_t) p : (bn - 1) / (size_t) q);
- p--; q--;
-
- s = an - p * n;
- t = bn - q * n;
-
- if(half) { /* Recover from badly chosen splitting */
- if (UNLIKELY (s<1)) {p--; s+=n; half=0;}
- else if (UNLIKELY (t<1)) {q--; t+=n; half=0;}
- }
- }
-#undef LIMIT_numerator
-#undef LIMIT_denominat
-
- ASSERT (0 < s && s <= n);
- ASSERT (0 < t && t <= n);
- ASSERT (half || s + t > 3);
- ASSERT (n > 2);
-
-#define r6 (pp + 3 * n) /* 3n+1 */
-#define r4 (pp + 7 * n) /* 3n+1 */
-#define r2 (pp +11 * n) /* 3n+1 */
-#define r0 (pp +15 * n) /* s+t <= 2*n */
-#define r7 (scratch) /* 3n+1 */
-#define r5 (scratch + 3 * n + 1) /* 3n+1 */
-#define r3 (scratch + 6 * n + 2) /* 3n+1 */
-#define r1 (scratch + 9 * n + 3) /* 3n+1 */
-#define v0 (pp +11 * n) /* n+1 */
-#define v1 (pp +12 * n+1) /* n+1 */
-#define v2 (pp +13 * n+2) /* n+1 */
-#define v3 (scratch +12 * n + 4) /* n+1 */
-#define wsi (scratch +12 * n + 4) /* 3n+1 */
-#define wse (scratch +13 * n + 5) /* 2n+1 */
-
- /* Alloc also 3n+1 limbs for wsi... toom_interpolate_16pts may
- need all of them */
-/* if (scratch == NULL) */
-/* scratch = TMP_SALLOC_LIMBS(mpn_toom8_sqr_itch(n * 8)); */
- ASSERT (15 * n + 6 <= mpn_toom8h_mul_itch (an, bn));
- ASSERT (15 * n + 6 <= mpn_toom8_sqr_itch (n * 8));
-
- /********************** evaluation and recursive calls *********************/
-
- /* $\pm1/8$ */
- sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 3, pp) ^
- mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 3, pp);
- /* A(-1/8)*B(-1/8)*8^. */ /* A(+1/8)*B(+1/8)*8^. */
- TOOM8H_MUL_N_REC(pp, v0, v1, 2, r7, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r7, 2 * n + 1 + BIT_CORRECTION, pp, sign, n, 3*(1+half), 3*(half));
-
- /* $\pm1/4$ */
- sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 2, pp) ^
- mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 2, pp);
- /* A(-1/4)*B(-1/4)*4^. */ /* A(+1/4)*B(+1/4)*4^. */
- TOOM8H_MUL_N_REC(pp, v0, v1, 2, r5, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r5, 2 * n + 1, pp, sign, n, 2*(1+half), 2*(half));
-
- /* $\pm2$ */
- sign = mpn_toom_eval_pm2 (v2, v0, p, ap, n, s, pp) ^
- mpn_toom_eval_pm2 (v3, v1, q, bp, n, t, pp);
- /* A(-2)*B(-2) */ /* A(+2)*B(+2) */
- TOOM8H_MUL_N_REC(pp, v0, v1, 2, r3, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r3, 2 * n + 1, pp, sign, n, 1, 2);
-
- /* $\pm8$ */
- sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 3, pp) ^
- mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 3, pp);
- /* A(-8)*B(-8) */ /* A(+8)*B(+8) */
- TOOM8H_MUL_N_REC(pp, v0, v1, 2, r1, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r1, 2 * n + 1 + BIT_CORRECTION, pp, sign, n, 3, 6);
-
- /* $\pm1/2$ */
- sign = mpn_toom_eval_pm2rexp (v2, v0, p, ap, n, s, 1, pp) ^
- mpn_toom_eval_pm2rexp (v3, v1, q, bp, n, t, 1, pp);
- /* A(-1/2)*B(-1/2)*2^. */ /* A(+1/2)*B(+1/2)*2^. */
- TOOM8H_MUL_N_REC(pp, v0, v1, 2, r6, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r6, 2 * n + 1, pp, sign, n, 1+half, half);
-
- /* $\pm1$ */
- sign = mpn_toom_eval_pm1 (v2, v0, p, ap, n, s, pp);
- if (GMP_NUMB_BITS > 12*3 && UNLIKELY (q == 3))
- sign ^= mpn_toom_eval_dgr3_pm1 (v3, v1, bp, n, t, pp);
- else
- sign ^= mpn_toom_eval_pm1 (v3, v1, q, bp, n, t, pp);
- /* A(-1)*B(-1) */ /* A(1)*B(1) */
- TOOM8H_MUL_N_REC(pp, v0, v1, 2, r4, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r4, 2 * n + 1, pp, sign, n, 0, 0);
-
- /* $\pm4$ */
- sign = mpn_toom_eval_pm2exp (v2, v0, p, ap, n, s, 2, pp) ^
- mpn_toom_eval_pm2exp (v3, v1, q, bp, n, t, 2, pp);
- /* A(-4)*B(-4) */ /* A(+4)*B(+4) */
- TOOM8H_MUL_N_REC(pp, v0, v1, 2, r2, v2, v3, n + 1, wse);
- mpn_toom_couple_handling (r2, 2 * n + 1, pp, sign, n, 2, 4);
-
-#undef v0
-#undef v1
-#undef v2
-#undef v3
-#undef wse
-
- /* A(0)*B(0) */
- TOOM8H_MUL_N_REC(pp, ap, bp, 0, pp, ap, bp, n, wsi);
-
- /* Infinity */
- if (UNLIKELY (half != 0)) {
- if (s > t) {
- TOOM8H_MUL_REC(r0, ap + p * n, s, bp + q * n, t, wsi);
- } else {
- TOOM8H_MUL_REC(r0, bp + q * n, t, ap + p * n, s, wsi);
- };
- };
-
- mpn_toom_interpolate_16pts (pp, r1, r3, r5, r7, n, s+t, half, wsi);
-
-#undef r0
-#undef r1
-#undef r2
-#undef r3
-#undef r4
-#undef r5
-#undef r6
-#undef wsi
-}
-
-#undef TOOM8H_MUL_N_REC
-#undef TOOM8H_MUL_REC
-#undef MAYBE_mul_basecase
-#undef MAYBE_mul_toom22
-#undef MAYBE_mul_toom33
-#undef MAYBE_mul_toom44
-#undef MAYBE_mul_toom8h
diff --git a/gmp/mpn/generic/toom_couple_handling.c b/gmp/mpn/generic/toom_couple_handling.c
deleted file mode 100644
index 9e62bcba1c..0000000000
--- a/gmp/mpn/generic/toom_couple_handling.c
+++ /dev/null
@@ -1,81 +0,0 @@
-/* Helper function for high degree Toom-Cook algorithms.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Gets {pp,n} and (sign?-1:1)*{np,n}. Computes at once:
- {pp,n} <- ({pp,n}+{np,n})/2^{ps+1}
- {pn,n} <- ({pp,n}-{np,n})/2^{ns+1}
- Finally recompose them obtaining:
- {pp,n+off} <- {pp,n}+{np,n}*2^{off*GMP_NUMB_BITS}
-*/
-void
-mpn_toom_couple_handling (mp_ptr pp, mp_size_t n, mp_ptr np,
- int nsign, mp_size_t off, int ps, int ns)
-{
- if (nsign) {
-#ifdef HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (np, pp, np, n);
-#else
- mpn_sub_n (np, pp, np, n);
- mpn_rshift (np, np, n, 1);
-#endif
- } else {
-#ifdef HAVE_NATIVE_mpn_rsh1add_n
- mpn_rsh1add_n (np, pp, np, n);
-#else
- mpn_add_n (np, pp, np, n);
- mpn_rshift (np, np, n, 1);
-#endif
- }
-
-#ifdef HAVE_NATIVE_mpn_rsh1sub_n
- if (ps == 1)
- mpn_rsh1sub_n (pp, pp, np, n);
- else
-#endif
- {
- mpn_sub_n (pp, pp, np, n);
- if (ps > 0)
- mpn_rshift (pp, pp, n, ps);
- }
- if (ns > 0)
- mpn_rshift (np, np, n, ns);
- pp[n] = mpn_add_n (pp+off, pp+off, np, n-off);
- ASSERT_NOCARRY (mpn_add_1(pp+n, np+n-off, off, pp[n]) );
-}
diff --git a/gmp/mpn/generic/toom_eval_dgr3_pm1.c b/gmp/mpn/generic/toom_eval_dgr3_pm1.c
deleted file mode 100644
index 50411bd3ca..0000000000
--- a/gmp/mpn/generic/toom_eval_dgr3_pm1.c
+++ /dev/null
@@ -1,73 +0,0 @@
-/* mpn_toom_eval_dgr3_pm1 -- Evaluate a degree 3 polynomial in +1 and -1
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-int
-mpn_toom_eval_dgr3_pm1 (mp_ptr xp1, mp_ptr xm1,
- mp_srcptr xp, mp_size_t n, mp_size_t x3n, mp_ptr tp)
-{
- int neg;
-
- ASSERT (x3n > 0);
- ASSERT (x3n <= n);
-
- xp1[n] = mpn_add_n (xp1, xp, xp + 2*n, n);
- tp[n] = mpn_add (tp, xp + n, n, xp + 3*n, x3n);
-
- neg = (mpn_cmp (xp1, tp, n + 1) < 0) ? ~0 : 0;
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (neg)
- mpn_add_n_sub_n (xp1, xm1, tp, xp1, n + 1);
- else
- mpn_add_n_sub_n (xp1, xm1, xp1, tp, n + 1);
-#else
- if (neg)
- mpn_sub_n (xm1, tp, xp1, n + 1);
- else
- mpn_sub_n (xm1, xp1, tp, n + 1);
-
- mpn_add_n (xp1, xp1, tp, n + 1);
-#endif
-
- ASSERT (xp1[n] <= 3);
- ASSERT (xm1[n] <= 1);
-
- return neg;
-}
diff --git a/gmp/mpn/generic/toom_eval_dgr3_pm2.c b/gmp/mpn/generic/toom_eval_dgr3_pm2.c
deleted file mode 100644
index 3ba6d15f3d..0000000000
--- a/gmp/mpn/generic/toom_eval_dgr3_pm2.c
+++ /dev/null
@@ -1,98 +0,0 @@
-/* mpn_toom_eval_dgr3_pm2 -- Evaluate a degree 3 polynomial in +2 and -2
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Needs n+1 limbs of temporary storage. */
-int
-mpn_toom_eval_dgr3_pm2 (mp_ptr xp2, mp_ptr xm2,
- mp_srcptr xp, mp_size_t n, mp_size_t x3n, mp_ptr tp)
-{
- mp_limb_t cy;
- int neg;
-
- ASSERT (x3n > 0);
- ASSERT (x3n <= n);
-
- /* (x0 + 4 * x2) +/- (2 x1 + 8 x_3) */
-#if HAVE_NATIVE_mpn_addlsh_n || HAVE_NATIVE_mpn_addlsh2_n
-#if HAVE_NATIVE_mpn_addlsh2_n
- xp2[n] = mpn_addlsh2_n (xp2, xp, xp + 2*n, n);
-
- cy = mpn_addlsh2_n (tp, xp + n, xp + 3*n, x3n);
-#else /* HAVE_NATIVE_mpn_addlsh_n */
- xp2[n] = mpn_addlsh_n (xp2, xp, xp + 2*n, n, 2);
-
- cy = mpn_addlsh_n (tp, xp + n, xp + 3*n, x3n, 2);
-#endif
- if (x3n < n)
- cy = mpn_add_1 (tp + x3n, xp + n + x3n, n - x3n, cy);
- tp[n] = cy;
-#else
- cy = mpn_lshift (tp, xp + 2*n, n, 2);
- xp2[n] = cy + mpn_add_n (xp2, tp, xp, n);
-
- tp[x3n] = mpn_lshift (tp, xp + 3*n, x3n, 2);
- if (x3n < n)
- tp[n] = mpn_add (tp, xp + n, n, tp, x3n + 1);
- else
- tp[n] += mpn_add_n (tp, xp + n, tp, n);
-#endif
- mpn_lshift (tp, tp, n+1, 1);
-
- neg = (mpn_cmp (xp2, tp, n + 1) < 0) ? ~0 : 0;
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (neg)
- mpn_add_n_sub_n (xp2, xm2, tp, xp2, n + 1);
- else
- mpn_add_n_sub_n (xp2, xm2, xp2, tp, n + 1);
-#else
- if (neg)
- mpn_sub_n (xm2, tp, xp2, n + 1);
- else
- mpn_sub_n (xm2, xp2, tp, n + 1);
-
- mpn_add_n (xp2, xp2, tp, n + 1);
-#endif
-
- ASSERT (xp2[n] < 15);
- ASSERT (xm2[n] < 10);
-
- return neg;
-}
diff --git a/gmp/mpn/generic/toom_eval_pm1.c b/gmp/mpn/generic/toom_eval_pm1.c
deleted file mode 100644
index 2334b0aff4..0000000000
--- a/gmp/mpn/generic/toom_eval_pm1.c
+++ /dev/null
@@ -1,90 +0,0 @@
-/* mpn_toom_eval_pm1 -- Evaluate a polynomial in +1 and -1
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Evaluates a polynomial of degree k > 3, in the points +1 and -1. */
-int
-mpn_toom_eval_pm1 (mp_ptr xp1, mp_ptr xm1, unsigned k,
- mp_srcptr xp, mp_size_t n, mp_size_t hn, mp_ptr tp)
-{
- unsigned i;
- int neg;
-
- ASSERT (k >= 4);
-
- ASSERT (hn > 0);
- ASSERT (hn <= n);
-
- /* The degree k is also the number of full-size coefficients, so
- * that last coefficient, of size hn, starts at xp + k*n. */
-
- xp1[n] = mpn_add_n (xp1, xp, xp + 2*n, n);
- for (i = 4; i < k; i += 2)
- ASSERT_NOCARRY (mpn_add (xp1, xp1, n+1, xp+i*n, n));
-
- tp[n] = mpn_add_n (tp, xp + n, xp + 3*n, n);
- for (i = 5; i < k; i += 2)
- ASSERT_NOCARRY (mpn_add (tp, tp, n+1, xp+i*n, n));
-
- if (k & 1)
- ASSERT_NOCARRY (mpn_add (tp, tp, n+1, xp+k*n, hn));
- else
- ASSERT_NOCARRY (mpn_add (xp1, xp1, n+1, xp+k*n, hn));
-
- neg = (mpn_cmp (xp1, tp, n + 1) < 0) ? ~0 : 0;
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (neg)
- mpn_add_n_sub_n (xp1, xm1, tp, xp1, n + 1);
- else
- mpn_add_n_sub_n (xp1, xm1, xp1, tp, n + 1);
-#else
- if (neg)
- mpn_sub_n (xm1, tp, xp1, n + 1);
- else
- mpn_sub_n (xm1, xp1, tp, n + 1);
-
- mpn_add_n (xp1, xp1, tp, n + 1);
-#endif
-
- ASSERT (xp1[n] <= k);
- ASSERT (xm1[n] <= k/2 + 1);
-
- return neg;
-}
diff --git a/gmp/mpn/generic/toom_eval_pm2.c b/gmp/mpn/generic/toom_eval_pm2.c
deleted file mode 100644
index 67afcc638e..0000000000
--- a/gmp/mpn/generic/toom_eval_pm2.c
+++ /dev/null
@@ -1,131 +0,0 @@
-/* mpn_toom_eval_pm2 -- Evaluate a polynomial in +2 and -2
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* DO_addlsh2(d,a,b,n,cy) computes cy,{d,n} <- {a,n} + 4*(cy,{b,n}), it
- can be used as DO_addlsh2(d,a,d,n,d[n]), for accumulation on {d,n+1}. */
-#if HAVE_NATIVE_mpn_addlsh2_n
-#define DO_addlsh2(d, a, b, n, cy) \
-do { \
- (cy) <<= 2; \
- (cy) += mpn_addlsh2_n(d, a, b, n); \
-} while (0)
-#else
-#if HAVE_NATIVE_mpn_addlsh_n
-#define DO_addlsh2(d, a, b, n, cy) \
-do { \
- (cy) <<= 2; \
- (cy) += mpn_addlsh_n(d, a, b, n, 2); \
-} while (0)
-#else
-/* The following is not a general substitute for addlsh2.
- It is correct if d == b, but it is not if d == a. */
-#define DO_addlsh2(d, a, b, n, cy) \
-do { \
- (cy) <<= 2; \
- (cy) += mpn_lshift(d, b, n, 2); \
- (cy) += mpn_add_n(d, d, a, n); \
-} while (0)
-#endif
-#endif
-
-/* Evaluates a polynomial of degree 2 < k < GMP_NUMB_BITS, in the
- points +2 and -2. */
-int
-mpn_toom_eval_pm2 (mp_ptr xp2, mp_ptr xm2, unsigned k,
- mp_srcptr xp, mp_size_t n, mp_size_t hn, mp_ptr tp)
-{
- int i;
- int neg;
- mp_limb_t cy;
-
- ASSERT (k >= 3);
- ASSERT (k < GMP_NUMB_BITS);
-
- ASSERT (hn > 0);
- ASSERT (hn <= n);
-
- /* The degree k is also the number of full-size coefficients, so
- * that last coefficient, of size hn, starts at xp + k*n. */
-
- cy = 0;
- DO_addlsh2 (xp2, xp + (k-2) * n, xp + k * n, hn, cy);
- if (hn != n)
- cy = mpn_add_1 (xp2 + hn, xp + (k-2) * n + hn, n - hn, cy);
- for (i = k - 4; i >= 0; i -= 2)
- DO_addlsh2 (xp2, xp + i * n, xp2, n, cy);
- xp2[n] = cy;
-
- k--;
-
- cy = 0;
- DO_addlsh2 (tp, xp + (k-2) * n, xp + k * n, n, cy);
- for (i = k - 4; i >= 0; i -= 2)
- DO_addlsh2 (tp, xp + i * n, tp, n, cy);
- tp[n] = cy;
-
- if (k & 1)
- ASSERT_NOCARRY(mpn_lshift (tp , tp , n + 1, 1));
- else
- ASSERT_NOCARRY(mpn_lshift (xp2, xp2, n + 1, 1));
-
- neg = (mpn_cmp (xp2, tp, n + 1) < 0) ? ~0 : 0;
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (neg)
- mpn_add_n_sub_n (xp2, xm2, tp, xp2, n + 1);
- else
- mpn_add_n_sub_n (xp2, xm2, xp2, tp, n + 1);
-#else /* !HAVE_NATIVE_mpn_add_n_sub_n */
- if (neg)
- mpn_sub_n (xm2, tp, xp2, n + 1);
- else
- mpn_sub_n (xm2, xp2, tp, n + 1);
-
- mpn_add_n (xp2, xp2, tp, n + 1);
-#endif /* !HAVE_NATIVE_mpn_add_n_sub_n */
-
- ASSERT (xp2[n] < (1<<(k+2))-1);
- ASSERT (xm2[n] < ((1<<(k+3))-1 - (1^k&1))/3);
-
- neg ^= ((k & 1) - 1);
-
- return neg;
-}
-
-#undef DO_addlsh2
diff --git a/gmp/mpn/generic/toom_eval_pm2exp.c b/gmp/mpn/generic/toom_eval_pm2exp.c
deleted file mode 100644
index b178fcac24..0000000000
--- a/gmp/mpn/generic/toom_eval_pm2exp.c
+++ /dev/null
@@ -1,128 +0,0 @@
-/* mpn_toom_eval_pm2exp -- Evaluate a polynomial in +2^k and -2^k
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* Evaluates a polynomial of degree k > 2, in the points +2^shift and -2^shift. */
-int
-mpn_toom_eval_pm2exp (mp_ptr xp2, mp_ptr xm2, unsigned k,
- mp_srcptr xp, mp_size_t n, mp_size_t hn, unsigned shift,
- mp_ptr tp)
-{
- unsigned i;
- int neg;
-#if HAVE_NATIVE_mpn_addlsh_n
- mp_limb_t cy;
-#endif
-
- ASSERT (k >= 3);
- ASSERT (shift*k < GMP_NUMB_BITS);
-
- ASSERT (hn > 0);
- ASSERT (hn <= n);
-
- /* The degree k is also the number of full-size coefficients, so
- * that last coefficient, of size hn, starts at xp + k*n. */
-
-#if HAVE_NATIVE_mpn_addlsh_n
- xp2[n] = mpn_addlsh_n (xp2, xp, xp + 2*n, n, 2*shift);
- for (i = 4; i < k; i += 2)
- xp2[n] += mpn_addlsh_n (xp2, xp2, xp + i*n, n, i*shift);
-
- tp[n] = mpn_lshift (tp, xp+n, n, shift);
- for (i = 3; i < k; i+= 2)
- tp[n] += mpn_addlsh_n (tp, tp, xp+i*n, n, i*shift);
-
- if (k & 1)
- {
- cy = mpn_addlsh_n (tp, tp, xp+k*n, hn, k*shift);
- MPN_INCR_U (tp + hn, n+1 - hn, cy);
- }
- else
- {
- cy = mpn_addlsh_n (xp2, xp2, xp+k*n, hn, k*shift);
- MPN_INCR_U (xp2 + hn, n+1 - hn, cy);
- }
-
-#else /* !HAVE_NATIVE_mpn_addlsh_n */
- xp2[n] = mpn_lshift (tp, xp+2*n, n, 2*shift);
- xp2[n] += mpn_add_n (xp2, xp, tp, n);
- for (i = 4; i < k; i += 2)
- {
- xp2[n] += mpn_lshift (tp, xp + i*n, n, i*shift);
- xp2[n] += mpn_add_n (xp2, xp2, tp, n);
- }
-
- tp[n] = mpn_lshift (tp, xp+n, n, shift);
- for (i = 3; i < k; i+= 2)
- {
- tp[n] += mpn_lshift (xm2, xp + i*n, n, i*shift);
- tp[n] += mpn_add_n (tp, tp, xm2, n);
- }
-
- xm2[hn] = mpn_lshift (xm2, xp + k*n, hn, k*shift);
- if (k & 1)
- mpn_add (tp, tp, n+1, xm2, hn+1);
- else
- mpn_add (xp2, xp2, n+1, xm2, hn+1);
-#endif /* !HAVE_NATIVE_mpn_addlsh_n */
-
- neg = (mpn_cmp (xp2, tp, n + 1) < 0) ? ~0 : 0;
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (neg)
- mpn_add_n_sub_n (xp2, xm2, tp, xp2, n + 1);
- else
- mpn_add_n_sub_n (xp2, xm2, xp2, tp, n + 1);
-#else /* !HAVE_NATIVE_mpn_add_n_sub_n */
- if (neg)
- mpn_sub_n (xm2, tp, xp2, n + 1);
- else
- mpn_sub_n (xm2, xp2, tp, n + 1);
-
- mpn_add_n (xp2, xp2, tp, n + 1);
-#endif /* !HAVE_NATIVE_mpn_add_n_sub_n */
-
- /* FIXME: the following asserts are useless if (k+1)*shift >= GMP_LIMB_BITS */
- ASSERT ((k+1)*shift >= GMP_LIMB_BITS ||
- xp2[n] < ((CNST_LIMB(1)<<((k+1)*shift))-1)/((CNST_LIMB(1)<<shift)-1));
- ASSERT ((k+2)*shift >= GMP_LIMB_BITS ||
- xm2[n] < ((CNST_LIMB(1)<<((k+2)*shift))-((k&1)?(CNST_LIMB(1)<<shift):1))/((CNST_LIMB(1)<<(2*shift))-1));
-
- return neg;
-}
diff --git a/gmp/mpn/generic/toom_eval_pm2rexp.c b/gmp/mpn/generic/toom_eval_pm2rexp.c
deleted file mode 100644
index 3cac46bd90..0000000000
--- a/gmp/mpn/generic/toom_eval_pm2rexp.c
+++ /dev/null
@@ -1,102 +0,0 @@
-/* mpn_toom_eval_pm2rexp -- Evaluate a polynomial in +2^-k and -2^-k
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 HAVE_NATIVE_mpn_addlsh_n
-#define DO_mpn_addlsh_n(dst,src,n,s,ws) mpn_addlsh_n(dst,dst,src,n,s)
-#else
-static mp_limb_t
-DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
-{
-#if USE_MUL_1 && 0
- return mpn_addmul_1(dst,src,n,CNST_LIMB(1) <<(s));
-#else
- mp_limb_t __cy;
- __cy = mpn_lshift(ws,src,n,s);
- return __cy + mpn_add_n(dst,dst,ws,n);
-#endif
-}
-#endif
-
-/* Evaluates a polynomial of degree k >= 3. */
-int
-mpn_toom_eval_pm2rexp (mp_ptr rp, mp_ptr rm,
- unsigned int q, mp_srcptr ap, mp_size_t n, mp_size_t t,
- unsigned int s, mp_ptr ws)
-{
- unsigned int i;
- int neg;
- /* {ap,q*n+t} -> {rp,n+1} {rm,n+1} , with {ws, n+1}*/
- ASSERT (n >= t);
- ASSERT (s != 0); /* or _eval_pm1 should be used */
- ASSERT (q > 1);
- ASSERT (s*q < GMP_NUMB_BITS);
- rp[n] = mpn_lshift(rp, ap, n, s*q);
- ws[n] = mpn_lshift(ws, ap+n, n, s*(q-1));
- if( (q & 1) != 0) {
- ASSERT_NOCARRY(mpn_add(ws,ws,n+1,ap+n*q,t));
- rp[n] += DO_mpn_addlsh_n(rp, ap+n*(q-1), n, s, rm);
- } else {
- ASSERT_NOCARRY(mpn_add(rp,rp,n+1,ap+n*q,t));
- }
- for(i=2; i<q-1; i++)
- {
- rp[n] += DO_mpn_addlsh_n(rp, ap+n*i, n, s*(q-i), rm);
- i++;
- ws[n] += DO_mpn_addlsh_n(ws, ap+n*i, n, s*(q-i), rm);
- };
-
- neg = (mpn_cmp (rp, ws, n + 1) < 0) ? ~0 : 0;
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- if (neg)
- mpn_add_n_sub_n (rp, rm, ws, rp, n + 1);
- else
- mpn_add_n_sub_n (rp, rm, rp, ws, n + 1);
-#else /* !HAVE_NATIVE_mpn_add_n_sub_n */
- if (neg)
- mpn_sub_n (rm, ws, rp, n + 1);
- else
- mpn_sub_n (rm, rp, ws, n + 1);
-
- ASSERT_NOCARRY (mpn_add_n (rp, rp, ws, n + 1));
-#endif /* !HAVE_NATIVE_mpn_add_n_sub_n */
-
- return neg;
-}
diff --git a/gmp/mpn/generic/toom_interpolate_12pts.c b/gmp/mpn/generic/toom_interpolate_12pts.c
deleted file mode 100644
index 180b0329a3..0000000000
--- a/gmp/mpn/generic/toom_interpolate_12pts.c
+++ /dev/null
@@ -1,361 +0,0 @@
-/* Interpolation for the algorithm Toom-Cook 6.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 HAVE_NATIVE_mpn_sublsh_n
-#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n(dst,dst,src,n,s)
-#else
-static mp_limb_t
-DO_mpn_sublsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
-{
-#if USE_MUL_1 && 0
- return mpn_submul_1(dst,src,n,CNST_LIMB(1) <<(s));
-#else
- mp_limb_t __cy;
- __cy = mpn_lshift(ws,src,n,s);
- return __cy + mpn_sub_n(dst,dst,ws,n);
-#endif
-}
-#endif
-
-#if HAVE_NATIVE_mpn_addlsh_n
-#define DO_mpn_addlsh_n(dst,src,n,s,ws) mpn_addlsh_n(dst,dst,src,n,s)
-#else
-static mp_limb_t
-DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
-{
-#if USE_MUL_1 && 0
- return mpn_addmul_1(dst,src,n,CNST_LIMB(1) <<(s));
-#else
- mp_limb_t __cy;
- __cy = mpn_lshift(ws,src,n,s);
- return __cy + mpn_add_n(dst,dst,ws,n);
-#endif
-}
-#endif
-
-#if HAVE_NATIVE_mpn_subrsh
-#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) mpn_subrsh(dst,nd,src,ns,s)
-#else
-/* FIXME: This is not a correct definition, it assumes no carry */
-#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) \
-do { \
- mp_limb_t __cy; \
- MPN_DECR_U (dst, nd, src[0] >> s); \
- __cy = DO_mpn_sublsh_n (dst, src + 1, ns - 1, GMP_NUMB_BITS - s, ws); \
- MPN_DECR_U (dst + ns - 1, nd - ns + 1, __cy); \
-} while (0)
-#endif
-
-
-#if GMP_NUMB_BITS < 21
-#error Not implemented: Both sublsh_n(,,,20) should be corrected.
-#endif
-
-#if GMP_NUMB_BITS < 16
-#error Not implemented: divexact_by42525 needs splitting.
-#endif
-
-#if GMP_NUMB_BITS < 12
-#error Not implemented: Hard to adapt...
-#endif
-
-/* FIXME: tuneup should decide the best variant */
-#ifndef AORSMUL_FASTER_AORS_AORSLSH
-#define AORSMUL_FASTER_AORS_AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_AORS_2AORSLSH
-#define AORSMUL_FASTER_AORS_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_2AORSLSH
-#define AORSMUL_FASTER_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_3AORSLSH
-#define AORSMUL_FASTER_3AORSLSH 1
-#endif
-
-#define BINVERT_9 \
- ((((GMP_NUMB_MAX / 9) << (6 - GMP_NUMB_BITS % 6)) * 8 & GMP_NUMB_MAX) | 0x39)
-
-#define BINVERT_255 \
- (GMP_NUMB_MAX - ((GMP_NUMB_MAX / 255) << (8 - GMP_NUMB_BITS % 8)))
-
- /* FIXME: find some more general expressions for 2835^-1, 42525^-1 */
-#if GMP_LIMB_BITS == 32
-#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x53E3771B))
-#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0x9F314C35))
-#else
-#if GMP_LIMB_BITS == 64
-#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x938CC70553E3771B))
-#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0xE7B40D449F314C35))
-#endif
-#endif
-
-#ifndef mpn_divexact_by255
-#if GMP_NUMB_BITS % 8 == 0
-#define mpn_divexact_by255(dst,src,size) \
- (255 & 1 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 255)))
-#else
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by255(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(255),BINVERT_255,0)
-#else
-#define mpn_divexact_by255(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(255))
-#endif
-#endif
-#endif
-
-#ifndef mpn_divexact_by9x4
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by9x4(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(9),BINVERT_9,2)
-#else
-#define mpn_divexact_by9x4(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(9)<<2)
-#endif
-#endif
-
-#ifndef mpn_divexact_by42525
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_42525)
-#define mpn_divexact_by42525(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(42525),BINVERT_42525,0)
-#else
-#define mpn_divexact_by42525(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(42525))
-#endif
-#endif
-
-#ifndef mpn_divexact_by2835x4
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_2835)
-#define mpn_divexact_by2835x4(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(2835),BINVERT_2835,2)
-#else
-#define mpn_divexact_by2835x4(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(2835)<<2)
-#endif
-#endif
-
-/* Interpolation for Toom-6.5 (or Toom-6), using the evaluation
- points: infinity(6.5 only), +-4, +-2, +-1, +-1/4, +-1/2, 0. More precisely,
- we want to compute f(2^(GMP_NUMB_BITS * n)) for a polynomial f of
- degree 11 (or 10), given the 12 (rsp. 11) values:
-
- r0 = limit at infinity of f(x) / x^7,
- r1 = f(4),f(-4),
- r2 = f(2),f(-2),
- r3 = f(1),f(-1),
- r4 = f(1/4),f(-1/4),
- r5 = f(1/2),f(-1/2),
- r6 = f(0).
-
- All couples of the form f(n),f(-n) must be already mixed with
- toom_couple_handling(f(n),...,f(-n),...)
-
- The result is stored in {pp, spt + 7*n (or 6*n)}.
- At entry, r6 is stored at {pp, 2n},
- r4 is stored at {pp + 3n, 3n + 1}.
- r2 is stored at {pp + 7n, 3n + 1}.
- r0 is stored at {pp +11n, spt}.
-
- The other values are 3n+1 limbs each (with most significant limbs small).
-
- Negative intermediate results are stored two-complemented.
- Inputs are destroyed.
-*/
-
-void
-mpn_toom_interpolate_12pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5,
- mp_size_t n, mp_size_t spt, int half, mp_ptr wsi)
-{
- mp_limb_t cy;
- mp_size_t n3;
- mp_size_t n3p1;
- n3 = 3 * n;
- n3p1 = n3 + 1;
-
-#define r4 (pp + n3) /* 3n+1 */
-#define r2 (pp + 7 * n) /* 3n+1 */
-#define r0 (pp +11 * n) /* s+t <= 2*n */
-
- /******************************* interpolation *****************************/
- if (half != 0) {
- cy = mpn_sub_n (r3, r3, r0, spt);
- MPN_DECR_U (r3 + spt, n3p1 - spt, cy);
-
- cy = DO_mpn_sublsh_n (r2, r0, spt, 10, wsi);
- MPN_DECR_U (r2 + spt, n3p1 - spt, cy);
- DO_mpn_subrsh(r5, n3p1, r0, spt, 2, wsi);
-
- cy = DO_mpn_sublsh_n (r1, r0, spt, 20, wsi);
- MPN_DECR_U (r1 + spt, n3p1 - spt, cy);
- DO_mpn_subrsh(r4, n3p1, r0, spt, 4, wsi);
- };
-
- r4[n3] -= DO_mpn_sublsh_n (r4 + n, pp, 2 * n, 20, wsi);
- DO_mpn_subrsh(r1 + n, 2 * n + 1, pp, 2 * n, 4, wsi);
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- mpn_add_n_sub_n (r1, r4, r4, r1, n3p1);
-#else
- ASSERT_NOCARRY(mpn_add_n (wsi, r1, r4, n3p1));
- mpn_sub_n (r4, r4, r1, n3p1); /* can be negative */
- MP_PTR_SWAP(r1, wsi);
-#endif
-
- r5[n3] -= DO_mpn_sublsh_n (r5 + n, pp, 2 * n, 10, wsi);
- DO_mpn_subrsh(r2 + n, 2 * n + 1, pp, 2 * n, 2, wsi);
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- mpn_add_n_sub_n (r2, r5, r5, r2, n3p1);
-#else
- mpn_sub_n (wsi, r5, r2, n3p1); /* can be negative */
- ASSERT_NOCARRY(mpn_add_n (r2, r2, r5, n3p1));
- MP_PTR_SWAP(r5, wsi);
-#endif
-
- r3[n3] -= mpn_sub_n (r3+n, r3+n, pp, 2 * n);
-
-#if AORSMUL_FASTER_AORS_AORSLSH
- mpn_submul_1 (r4, r5, n3p1, 257); /* can be negative */
-#else
- mpn_sub_n (r4, r4, r5, n3p1); /* can be negative */
- DO_mpn_sublsh_n (r4, r5, n3p1, 8, wsi); /* can be negative */
-#endif
- /* A division by 2835x4 follows. Warning: the operand can be negative! */
- mpn_divexact_by2835x4(r4, r4, n3p1);
- if ((r4[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-3))) != 0)
- r4[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-2));
-
-#if AORSMUL_FASTER_2AORSLSH
- mpn_addmul_1 (r5, r4, n3p1, 60); /* can be negative */
-#else
- DO_mpn_sublsh_n (r5, r4, n3p1, 2, wsi); /* can be negative */
- DO_mpn_addlsh_n (r5, r4, n3p1, 6, wsi); /* can give a carry */
-#endif
- mpn_divexact_by255(r5, r5, n3p1);
-
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r2, r3, n3p1, 5, wsi));
-
-#if AORSMUL_FASTER_3AORSLSH
- ASSERT_NOCARRY(mpn_submul_1 (r1, r2, n3p1, 100));
-#else
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r2, n3p1, 6, wsi));
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r2, n3p1, 5, wsi));
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r2, n3p1, 2, wsi));
-#endif
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r1, r3, n3p1, 9, wsi));
- mpn_divexact_by42525(r1, r1, n3p1);
-
-#if AORSMUL_FASTER_AORS_2AORSLSH
- ASSERT_NOCARRY(mpn_submul_1 (r2, r1, n3p1, 225));
-#else
- ASSERT_NOCARRY(mpn_sub_n (r2, r2, r1, n3p1));
- ASSERT_NOCARRY(DO_mpn_addlsh_n (r2, r1, n3p1, 5, wsi));
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r2, r1, n3p1, 8, wsi));
-#endif
- mpn_divexact_by9x4(r2, r2, n3p1);
-
- ASSERT_NOCARRY(mpn_sub_n (r3, r3, r2, n3p1));
-
- mpn_sub_n (r4, r2, r4, n3p1);
- ASSERT_NOCARRY(mpn_rshift(r4, r4, n3p1, 1));
- ASSERT_NOCARRY(mpn_sub_n (r2, r2, r4, n3p1));
-
- mpn_add_n (r5, r5, r1, n3p1);
- ASSERT_NOCARRY(mpn_rshift(r5, r5, n3p1, 1));
-
- /* last interpolation steps... */
- ASSERT_NOCARRY(mpn_sub_n (r3, r3, r1, n3p1));
- ASSERT_NOCARRY(mpn_sub_n (r1, r1, r5, n3p1));
- /* ... could be mixed with recomposition
- ||H-r5|M-r5|L-r5| ||H-r1|M-r1|L-r1|
- */
-
- /***************************** recomposition *******************************/
- /*
- pp[] prior to operations:
- |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|____|H_r6|L r6|pp
-
- summation scheme for remaining operations:
- |__12|n_11|n_10|n__9|n__8|n__7|n__6|n__5|n__4|n__3|n__2|n___|n___|pp
- |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|____|H_r6|L r6|pp
- ||H r1|M r1|L r1| ||H r3|M r3|L r3| ||H_r5|M_r5|L_r5|
- */
-
- cy = mpn_add_n (pp + n, pp + n, r5, n);
- cy = mpn_add_1 (pp + 2 * n, r5 + n, n, cy);
-#if HAVE_NATIVE_mpn_add_nc
- cy = r5[n3] + mpn_add_nc(pp + n3, pp + n3, r5 + 2 * n, n, cy);
-#else
- MPN_INCR_U (r5 + 2 * n, n + 1, cy);
- cy = r5[n3] + mpn_add_n (pp + n3, pp + n3, r5 + 2 * n, n);
-#endif
- MPN_INCR_U (pp + n3 + n, 2 * n + 1, cy);
-
- pp[2 * n3]+= mpn_add_n (pp + 5 * n, pp + 5 * n, r3, n);
- cy = mpn_add_1 (pp + 2 * n3, r3 + n, n, pp[2 * n3]);
-#if HAVE_NATIVE_mpn_add_nc
- cy = r3[n3] + mpn_add_nc(pp + 7 * n, pp + 7 * n, r3 + 2 * n, n, cy);
-#else
- MPN_INCR_U (r3 + 2 * n, n + 1, cy);
- cy = r3[n3] + mpn_add_n (pp + 7 * n, pp + 7 * n, r3 + 2 * n, n);
-#endif
- MPN_INCR_U (pp + 8 * n, 2 * n + 1, cy);
-
- pp[10*n]+=mpn_add_n (pp + 9 * n, pp + 9 * n, r1, n);
- if (half) {
- cy = mpn_add_1 (pp + 10 * n, r1 + n, n, pp[10 * n]);
-#if HAVE_NATIVE_mpn_add_nc
- if (LIKELY (spt > n)) {
- cy = r1[n3] + mpn_add_nc(pp + 11 * n, pp + 11 * n, r1 + 2 * n, n, cy);
- MPN_INCR_U (pp + 4 * n3, spt - n, cy);
- } else {
- ASSERT_NOCARRY(mpn_add_nc(pp + 11 * n, pp + 11 * n, r1 + 2 * n, spt, cy));
- }
-#else
- MPN_INCR_U (r1 + 2 * n, n + 1, cy);
- if (LIKELY (spt > n)) {
- cy = r1[n3] + mpn_add_n (pp + 11 * n, pp + 11 * n, r1 + 2 * n, n);
- MPN_INCR_U (pp + 4 * n3, spt - n, cy);
- } else {
- ASSERT_NOCARRY(mpn_add_n (pp + 11 * n, pp + 11 * n, r1 + 2 * n, spt));
- }
-#endif
- } else {
- ASSERT_NOCARRY(mpn_add_1 (pp + 10 * n, r1 + n, spt, pp[10 * n]));
- }
-
-#undef r0
-#undef r2
-#undef r4
-}
diff --git a/gmp/mpn/generic/toom_interpolate_16pts.c b/gmp/mpn/generic/toom_interpolate_16pts.c
deleted file mode 100644
index 5afe6641f6..0000000000
--- a/gmp/mpn/generic/toom_interpolate_16pts.c
+++ /dev/null
@@ -1,527 +0,0 @@
-/* Interpolation for the algorithm Toom-Cook 8.5-way.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 GMP_NUMB_BITS < 29
-#error Not implemented: Both sublsh_n(,,,28) should be corrected; r2 and r5 need one more LIMB.
-#endif
-
-#if GMP_NUMB_BITS < 28
-#error Not implemented: divexact_by188513325 and _by182712915 will not work.
-#endif
-
-
-#if HAVE_NATIVE_mpn_sublsh_n
-#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n(dst,dst,src,n,s)
-#else
-static mp_limb_t
-DO_mpn_sublsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
-{
-#if USE_MUL_1 && 0
- return mpn_submul_1(dst,src,n,CNST_LIMB(1) <<(s));
-#else
- mp_limb_t __cy;
- __cy = mpn_lshift(ws,src,n,s);
- return __cy + mpn_sub_n(dst,dst,ws,n);
-#endif
-}
-#endif
-
-#if HAVE_NATIVE_mpn_addlsh_n
-#define DO_mpn_addlsh_n(dst,src,n,s,ws) mpn_addlsh_n(dst,dst,src,n,s)
-#else
-static mp_limb_t
-DO_mpn_addlsh_n(mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
-{
-#if USE_MUL_1 && 0
- return mpn_addmul_1(dst,src,n,CNST_LIMB(1) <<(s));
-#else
- mp_limb_t __cy;
- __cy = mpn_lshift(ws,src,n,s);
- return __cy + mpn_add_n(dst,dst,ws,n);
-#endif
-}
-#endif
-
-#if HAVE_NATIVE_mpn_subrsh
-#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) mpn_subrsh(dst,nd,src,ns,s)
-#else
-/* FIXME: This is not a correct definition, it assumes no carry */
-#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) \
-do { \
- mp_limb_t __cy; \
- MPN_DECR_U (dst, nd, src[0] >> s); \
- __cy = DO_mpn_sublsh_n (dst, src + 1, ns - 1, GMP_NUMB_BITS - s, ws); \
- MPN_DECR_U (dst + ns - 1, nd - ns + 1, __cy); \
-} while (0)
-#endif
-
-
-/* FIXME: tuneup should decide the best variant */
-#ifndef AORSMUL_FASTER_AORS_AORSLSH
-#define AORSMUL_FASTER_AORS_AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_AORS_2AORSLSH
-#define AORSMUL_FASTER_AORS_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_2AORSLSH
-#define AORSMUL_FASTER_2AORSLSH 1
-#endif
-#ifndef AORSMUL_FASTER_3AORSLSH
-#define AORSMUL_FASTER_3AORSLSH 1
-#endif
-
-#if GMP_NUMB_BITS < 43
-#define BIT_CORRECTION 1
-#define CORRECTION_BITS GMP_NUMB_BITS
-#else
-#define BIT_CORRECTION 0
-#define CORRECTION_BITS 0
-#endif
-
-#define BINVERT_9 \
- ((((GMP_NUMB_MAX / 9) << (6 - GMP_NUMB_BITS % 6)) * 8 & GMP_NUMB_MAX) | 0x39)
-
-#define BINVERT_255 \
- (GMP_NUMB_MAX - ((GMP_NUMB_MAX / 255) << (8 - GMP_NUMB_BITS % 8)))
-
- /* FIXME: find some more general expressions for inverses */
-#if GMP_LIMB_BITS == 32
-#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x53E3771B))
-#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0x9F314C35))
-#define BINVERT_182712915 (GMP_NUMB_MASK & CNST_LIMB(0x550659DB))
-#define BINVERT_188513325 (GMP_NUMB_MASK & CNST_LIMB(0xFBC333A5))
-#define BINVERT_255x182712915L (GMP_NUMB_MASK & CNST_LIMB(0x6FC4CB25))
-#define BINVERT_255x188513325L (GMP_NUMB_MASK & CNST_LIMB(0x6864275B))
-#if GMP_NAIL_BITS == 0
-#define BINVERT_255x182712915H CNST_LIMB(0x1B649A07)
-#define BINVERT_255x188513325H CNST_LIMB(0x06DB993A)
-#else /* GMP_NAIL_BITS != 0 */
-#define BINVERT_255x182712915H \
- (GMP_NUMB_MASK & CNST_LIMB((0x1B649A07<<GMP_NAIL_BITS) | (0x6FC4CB25>>GMP_NUMB_BITS)))
-#define BINVERT_255x188513325H \
- (GMP_NUMB_MASK & CNST_LIMB((0x06DB993A<<GMP_NAIL_BITS) | (0x6864275B>>GMP_NUMB_BITS)))
-#endif
-#else
-#if GMP_LIMB_BITS == 64
-#define BINVERT_2835 (GMP_NUMB_MASK & CNST_LIMB(0x938CC70553E3771B))
-#define BINVERT_42525 (GMP_NUMB_MASK & CNST_LIMB(0xE7B40D449F314C35))
-#define BINVERT_255x182712915 (GMP_NUMB_MASK & CNST_LIMB(0x1B649A076FC4CB25))
-#define BINVERT_255x188513325 (GMP_NUMB_MASK & CNST_LIMB(0x06DB993A6864275B))
-#endif
-#endif
-
-#ifndef mpn_divexact_by255
-#if GMP_NUMB_BITS % 8 == 0
-#define mpn_divexact_by255(dst,src,size) \
- (255 & 1 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 255)))
-#else
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by255(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(255),BINVERT_255,0)
-#else
-#define mpn_divexact_by255(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(255))
-#endif
-#endif
-#endif
-
-#ifndef mpn_divexact_by255x4
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by255x4(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(255),BINVERT_255,2)
-#else
-#define mpn_divexact_by255x4(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(255)<<2)
-#endif
-#endif
-
-#ifndef mpn_divexact_by9x16
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by9x16(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(9),BINVERT_9,4)
-#else
-#define mpn_divexact_by9x16(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(9)<<4)
-#endif
-#endif
-
-#ifndef mpn_divexact_by42525x16
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_42525)
-#define mpn_divexact_by42525x16(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(42525),BINVERT_42525,4)
-#else
-#define mpn_divexact_by42525x16(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(42525)<<4)
-#endif
-#endif
-
-#ifndef mpn_divexact_by2835x64
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_2835)
-#define mpn_divexact_by2835x64(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(2835),BINVERT_2835,6)
-#else
-#define mpn_divexact_by2835x64(dst,src,size) mpn_divexact_1(dst,src,size,CNST_LIMB(2835)<<6)
-#endif
-#endif
-
-#ifndef mpn_divexact_by255x182712915
-#if GMP_NUMB_BITS < 36
-#if HAVE_NATIVE_mpn_bdiv_q_2_pi2 && defined(BINVERT_255x182712915H)
-/* FIXME: use mpn_bdiv_q_2_pi2 */
-#endif
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_182712915)
-#define mpn_divexact_by255x182712915(dst,src,size) \
- do { \
- mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(182712915),BINVERT_182712915,0); \
- mpn_divexact_by255(dst,dst,size); \
- } while(0)
-#else
-#define mpn_divexact_by255x182712915(dst,src,size) \
- do { \
- mpn_divexact_1(dst,src,size,CNST_LIMB(182712915)); \
- mpn_divexact_by255(dst,dst,size); \
- } while(0)
-#endif
-#else /* GMP_NUMB_BITS > 35 */
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_255x182712915)
-#define mpn_divexact_by255x182712915(dst,src,size) \
- mpn_pi1_bdiv_q_1(dst,src,size,255*CNST_LIMB(182712915),BINVERT_255x182712915,0)
-#else
-#define mpn_divexact_by255x182712915(dst,src,size) mpn_divexact_1(dst,src,size,255*CNST_LIMB(182712915))
-#endif
-#endif /* GMP_NUMB_BITS >?< 36 */
-#endif
-
-#ifndef mpn_divexact_by255x188513325
-#if GMP_NUMB_BITS < 36
-#if HAVE_NATIVE_mpn_bdiv_q_1_pi2 && defined(BINVERT_255x188513325H)
-/* FIXME: use mpn_bdiv_q_1_pi2 */
-#endif
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_188513325)
-#define mpn_divexact_by255x188513325(dst,src,size) \
- do { \
- mpn_pi1_bdiv_q_1(dst,src,size,CNST_LIMB(188513325),BINVERT_188513325,0); \
- mpn_divexact_by255(dst,dst,size); \
- } while(0)
-#else
-#define mpn_divexact_by255x188513325(dst,src,size) \
- do { \
- mpn_divexact_1(dst,src,size,CNST_LIMB(188513325)); \
- mpn_divexact_by255(dst,dst,size); \
- } while(0)
-#endif
-#else /* GMP_NUMB_BITS > 35 */
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && defined(BINVERT_255x188513325)
-#define mpn_divexact_by255x188513325(dst,src,size) \
- mpn_pi1_bdiv_q_1(dst,src,size,255*CNST_LIMB(188513325),BINVERT_255x188513325,0)
-#else
-#define mpn_divexact_by255x188513325(dst,src,size) mpn_divexact_1(dst,src,size,255*CNST_LIMB(188513325))
-#endif
-#endif /* GMP_NUMB_BITS >?< 36 */
-#endif
-
-/* Interpolation for Toom-8.5 (or Toom-8), using the evaluation
- points: infinity(8.5 only), +-8, +-4, +-2, +-1, +-1/4, +-1/2,
- +-1/8, 0. More precisely, we want to compute
- f(2^(GMP_NUMB_BITS * n)) for a polynomial f of degree 15 (or
- 14), given the 16 (rsp. 15) values:
-
- r0 = limit at infinity of f(x) / x^7,
- r1 = f(8),f(-8),
- r2 = f(4),f(-4),
- r3 = f(2),f(-2),
- r4 = f(1),f(-1),
- r5 = f(1/4),f(-1/4),
- r6 = f(1/2),f(-1/2),
- r7 = f(1/8),f(-1/8),
- r8 = f(0).
-
- All couples of the form f(n),f(-n) must be already mixed with
- toom_couple_handling(f(n),...,f(-n),...)
-
- The result is stored in {pp, spt + 7*n (or 8*n)}.
- At entry, r8 is stored at {pp, 2n},
- r6 is stored at {pp + 3n, 3n + 1}.
- r4 is stored at {pp + 7n, 3n + 1}.
- r2 is stored at {pp +11n, 3n + 1}.
- r0 is stored at {pp +15n, spt}.
-
- The other values are 3n+1 limbs each (with most significant limbs small).
-
- Negative intermediate results are stored two-complemented.
- Inputs are destroyed.
-*/
-
-void
-mpn_toom_interpolate_16pts (mp_ptr pp, mp_ptr r1, mp_ptr r3, mp_ptr r5, mp_ptr r7,
- mp_size_t n, mp_size_t spt, int half, mp_ptr wsi)
-{
- mp_limb_t cy;
- mp_size_t n3;
- mp_size_t n3p1;
- n3 = 3 * n;
- n3p1 = n3 + 1;
-
-#define r6 (pp + n3) /* 3n+1 */
-#define r4 (pp + 7 * n) /* 3n+1 */
-#define r2 (pp +11 * n) /* 3n+1 */
-#define r0 (pp +15 * n) /* s+t <= 2*n */
-
- ASSERT( spt <= 2 * n );
- /******************************* interpolation *****************************/
- if( half != 0) {
- cy = mpn_sub_n (r4, r4, r0, spt);
- MPN_DECR_U (r4 + spt, n3p1 - spt, cy);
-
- cy = DO_mpn_sublsh_n (r3, r0, spt, 14, wsi);
- MPN_DECR_U (r3 + spt, n3p1 - spt, cy);
- DO_mpn_subrsh(r6, n3p1, r0, spt, 2, wsi);
-
- cy = DO_mpn_sublsh_n (r2, r0, spt, 28, wsi);
- MPN_DECR_U (r2 + spt, n3p1 - spt, cy);
- DO_mpn_subrsh(r5, n3p1, r0, spt, 4, wsi);
-
- cy = DO_mpn_sublsh_n (r1 + BIT_CORRECTION, r0, spt, 42 - CORRECTION_BITS, wsi);
-#if BIT_CORRECTION
- cy = mpn_sub_1 (r1 + spt + BIT_CORRECTION, r1 + spt + BIT_CORRECTION,
- n3p1 - spt - BIT_CORRECTION, cy);
- ASSERT (BIT_CORRECTION > 0 || cy == 0);
- /* FIXME: assumes r7[n3p1] is writable (it is if r5 follows). */
- cy = r7[n3p1];
- r7[n3p1] = 0x80;
-#else
- MPN_DECR_U (r1 + spt + BIT_CORRECTION, n3p1 - spt - BIT_CORRECTION, cy);
-#endif
- DO_mpn_subrsh(r7, n3p1 + BIT_CORRECTION, r0, spt, 6, wsi);
-#if BIT_CORRECTION
- /* FIXME: assumes r7[n3p1] is writable. */
- ASSERT ( BIT_CORRECTION > 0 || r7[n3p1] == 0x80 );
- r7[n3p1] = cy;
-#endif
- };
-
- r5[n3] -= DO_mpn_sublsh_n (r5 + n, pp, 2 * n, 28, wsi);
- DO_mpn_subrsh(r2 + n, 2 * n + 1, pp, 2 * n, 4, wsi);
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- mpn_add_n_sub_n (r2, r5, r5, r2, n3p1);
-#else
- mpn_sub_n (wsi, r5, r2, n3p1); /* can be negative */
- ASSERT_NOCARRY(mpn_add_n (r2, r2, r5, n3p1));
- MP_PTR_SWAP(r5, wsi);
-#endif
-
- r6[n3] -= DO_mpn_sublsh_n (r6 + n, pp, 2 * n, 14, wsi);
- DO_mpn_subrsh(r3 + n, 2 * n + 1, pp, 2 * n, 2, wsi);
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- mpn_add_n_sub_n (r3, r6, r6, r3, n3p1);
-#else
- ASSERT_NOCARRY(mpn_add_n (wsi, r3, r6, n3p1));
- mpn_sub_n (r6, r6, r3, n3p1); /* can be negative */
- MP_PTR_SWAP(r3, wsi);
-#endif
-
- cy = DO_mpn_sublsh_n (r7 + n + BIT_CORRECTION, pp, 2 * n, 42 - CORRECTION_BITS, wsi);
-#if BIT_CORRECTION
- MPN_DECR_U (r1 + n, 2 * n + 1, pp[0] >> 6);
- cy = DO_mpn_sublsh_n (r1 + n, pp + 1, 2 * n - 1, GMP_NUMB_BITS - 6, wsi);
- cy = mpn_sub_1(r1 + 3 * n - 1, r1 + 3 * n - 1, 2, cy);
- ASSERT ( BIT_CORRECTION > 0 || cy != 0 );
-#else
- r7[n3] -= cy;
- DO_mpn_subrsh(r1 + n, 2 * n + 1, pp, 2 * n, 6, wsi);
-#endif
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- mpn_add_n_sub_n (r1, r7, r7, r1, n3p1);
-#else
- mpn_sub_n (wsi, r7, r1, n3p1); /* can be negative */
- mpn_add_n (r1, r1, r7, n3p1); /* if BIT_CORRECTION != 0, can give a carry. */
- MP_PTR_SWAP(r7, wsi);
-#endif
-
- r4[n3] -= mpn_sub_n (r4+n, r4+n, pp, 2 * n);
-
-#if AORSMUL_FASTER_2AORSLSH
- mpn_submul_1 (r5, r6, n3p1, 1028); /* can be negative */
-#else
- DO_mpn_sublsh_n (r5, r6, n3p1, 2, wsi); /* can be negative */
- DO_mpn_sublsh_n (r5, r6, n3p1,10, wsi); /* can be negative */
-#endif
-
- mpn_submul_1 (r7, r5, n3p1, 1300); /* can be negative */
-#if AORSMUL_FASTER_3AORSLSH
- mpn_submul_1 (r7, r6, n3p1, 1052688); /* can be negative */
-#else
- DO_mpn_sublsh_n (r7, r6, n3p1, 4, wsi); /* can be negative */
- DO_mpn_sublsh_n (r7, r6, n3p1,12, wsi); /* can be negative */
- DO_mpn_sublsh_n (r7, r6, n3p1,20, wsi); /* can be negative */
-#endif
- mpn_divexact_by255x188513325(r7, r7, n3p1);
-
- mpn_submul_1 (r5, r7, n3p1, 12567555); /* can be negative */
- /* A division by 2835x64 follows. Warning: the operand can be negative! */
- mpn_divexact_by2835x64(r5, r5, n3p1);
- if ((r5[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-7))) != 0)
- r5[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-6));
-
-#if AORSMUL_FASTER_AORS_AORSLSH
- mpn_submul_1 (r6, r7, n3p1, 4095); /* can be negative */
-#else
- mpn_add_n (r6, r6, r7, n3p1); /* can give a carry */
- DO_mpn_sublsh_n (r6, r7, n3p1, 12, wsi); /* can be negative */
-#endif
-#if AORSMUL_FASTER_2AORSLSH
- mpn_addmul_1 (r6, r5, n3p1, 240); /* can be negative */
-#else
- DO_mpn_addlsh_n (r6, r5, n3p1, 8, wsi); /* can give a carry */
- DO_mpn_sublsh_n (r6, r5, n3p1, 4, wsi); /* can be negative */
-#endif
- /* A division by 255x4 follows. Warning: the operand can be negative! */
- mpn_divexact_by255x4(r6, r6, n3p1);
- if ((r6[n3] & (GMP_NUMB_MAX << (GMP_NUMB_BITS-3))) != 0)
- r6[n3] |= (GMP_NUMB_MAX << (GMP_NUMB_BITS-2));
-
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r3, r4, n3p1, 7, wsi));
-
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r2, r4, n3p1, 13, wsi));
- ASSERT_NOCARRY(mpn_submul_1 (r2, r3, n3p1, 400));
-
- /* If GMP_NUMB_BITS < 42 next operations on r1 can give a carry!*/
- DO_mpn_sublsh_n (r1, r4, n3p1, 19, wsi);
- mpn_submul_1 (r1, r2, n3p1, 1428);
- mpn_submul_1 (r1, r3, n3p1, 112896);
- mpn_divexact_by255x182712915(r1, r1, n3p1);
-
- ASSERT_NOCARRY(mpn_submul_1 (r2, r1, n3p1, 15181425));
- mpn_divexact_by42525x16(r2, r2, n3p1);
-
-#if AORSMUL_FASTER_AORS_2AORSLSH
- ASSERT_NOCARRY(mpn_submul_1 (r3, r1, n3p1, 3969));
-#else
- ASSERT_NOCARRY(mpn_sub_n (r3, r3, r1, n3p1));
- ASSERT_NOCARRY(DO_mpn_addlsh_n (r3, r1, n3p1, 7, wsi));
- ASSERT_NOCARRY(DO_mpn_sublsh_n (r3, r1, n3p1, 12, wsi));
-#endif
- ASSERT_NOCARRY(mpn_submul_1 (r3, r2, n3p1, 900));
- mpn_divexact_by9x16(r3, r3, n3p1);
-
- ASSERT_NOCARRY(mpn_sub_n (r4, r4, r1, n3p1));
- ASSERT_NOCARRY(mpn_sub_n (r4, r4, r3, n3p1));
- ASSERT_NOCARRY(mpn_sub_n (r4, r4, r2, n3p1));
-
- mpn_add_n (r6, r2, r6, n3p1);
- ASSERT_NOCARRY(mpn_rshift(r6, r6, n3p1, 1));
- ASSERT_NOCARRY(mpn_sub_n (r2, r2, r6, n3p1));
-
- mpn_sub_n (r5, r3, r5, n3p1);
- ASSERT_NOCARRY(mpn_rshift(r5, r5, n3p1, 1));
- ASSERT_NOCARRY(mpn_sub_n (r3, r3, r5, n3p1));
-
- mpn_add_n (r7, r1, r7, n3p1);
- ASSERT_NOCARRY(mpn_rshift(r7, r7, n3p1, 1));
- ASSERT_NOCARRY(mpn_sub_n (r1, r1, r7, n3p1));
-
- /* last interpolation steps... */
- /* ... could be mixed with recomposition
- ||H-r7|M-r7|L-r7| ||H-r5|M-r5|L-r5|
- */
-
- /***************************** recomposition *******************************/
- /*
- pp[] prior to operations:
- |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|___||H r6|M r6|L r6|____|H_r8|L r8|pp
-
- summation scheme for remaining operations:
- |__16|n_15|n_14|n_13|n_12|n_11|n_10|n__9|n__8|n__7|n__6|n__5|n__4|n__3|n__2|n___|n___|pp
- |M r0|L r0|___||H r2|M r2|L r2|___||H r4|M r4|L r4|___||H r6|M r6|L r6|____|H_r8|L r8|pp
- ||H r1|M r1|L r1| ||H r3|M r3|L r3| ||H_r5|M_r5|L_r5| ||H r7|M r7|L r7|
- */
-
- cy = mpn_add_n (pp + n, pp + n, r7, n);
- cy = mpn_add_1 (pp + 2 * n, r7 + n, n, cy);
-#if HAVE_NATIVE_mpn_add_nc
- cy = r7[n3] + mpn_add_nc(pp + n3, pp + n3, r7 + 2 * n, n, cy);
-#else
- MPN_INCR_U (r7 + 2 * n, n + 1, cy);
- cy = r7[n3] + mpn_add_n (pp + n3, pp + n3, r7 + 2 * n, n);
-#endif
- MPN_INCR_U (pp + 4 * n, 2 * n + 1, cy);
-
- pp[2 * n3]+= mpn_add_n (pp + 5 * n, pp + 5 * n, r5, n);
- cy = mpn_add_1 (pp + 2 * n3, r5 + n, n, pp[2 * n3]);
-#if HAVE_NATIVE_mpn_add_nc
- cy = r5[n3] + mpn_add_nc(pp + 7 * n, pp + 7 * n, r5 + 2 * n, n, cy);
-#else
- MPN_INCR_U (r5 + 2 * n, n + 1, cy);
- cy = r5[n3] + mpn_add_n (pp + 7 * n, pp + 7 * n, r5 + 2 * n, n);
-#endif
- MPN_INCR_U (pp + 8 * n, 2 * n + 1, cy);
-
- pp[10 * n]+= mpn_add_n (pp + 9 * n, pp + 9 * n, r3, n);
- cy = mpn_add_1 (pp + 10 * n, r3 + n, n, pp[10 * n]);
-#if HAVE_NATIVE_mpn_add_nc
- cy = r3[n3] + mpn_add_nc(pp +11 * n, pp +11 * n, r3 + 2 * n, n, cy);
-#else
- MPN_INCR_U (r3 + 2 * n, n + 1, cy);
- cy = r3[n3] + mpn_add_n (pp +11 * n, pp +11 * n, r3 + 2 * n, n);
-#endif
- MPN_INCR_U (pp +12 * n, 2 * n + 1, cy);
-
- pp[14 * n]+=mpn_add_n (pp +13 * n, pp +13 * n, r1, n);
- if ( half ) {
- cy = mpn_add_1 (pp + 14 * n, r1 + n, n, pp[14 * n]);
-#if HAVE_NATIVE_mpn_add_nc
- if(LIKELY(spt > n)) {
- cy = r1[n3] + mpn_add_nc(pp + 15 * n, pp + 15 * n, r1 + 2 * n, n, cy);
- MPN_INCR_U (pp + 16 * n, spt - n, cy);
- } else {
- ASSERT_NOCARRY(mpn_add_nc(pp + 15 * n, pp + 15 * n, r1 + 2 * n, spt, cy));
- }
-#else
- MPN_INCR_U (r1 + 2 * n, n + 1, cy);
- if(LIKELY(spt > n)) {
- cy = r1[n3] + mpn_add_n (pp + 15 * n, pp + 15 * n, r1 + 2 * n, n);
- MPN_INCR_U (pp + 16 * n, spt - n, cy);
- } else {
- ASSERT_NOCARRY(mpn_add_n (pp + 15 * n, pp + 15 * n, r1 + 2 * n, spt));
- }
-#endif
- } else {
- ASSERT_NOCARRY(mpn_add_1 (pp + 14 * n, r1 + n, spt, pp[14 * n]));
- }
-
-#undef r0
-#undef r2
-#undef r4
-#undef r6
-}
diff --git a/gmp/mpn/generic/toom_interpolate_5pts.c b/gmp/mpn/generic/toom_interpolate_5pts.c
index 9fa5f0b7a6..67260cc3d5 100644
--- a/gmp/mpn/generic/toom_interpolate_5pts.c
+++ b/gmp/mpn/generic/toom_interpolate_5pts.c
@@ -7,33 +7,23 @@
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-2003, 2005-2007, 2009 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 2005, 2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have 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"
@@ -41,29 +31,28 @@ see https://www.gnu.org/licenses/. */
void
mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1,
mp_size_t k, mp_size_t twor, int sa,
- mp_limb_t vinf0)
+ mp_limb_t vinf0, mp_ptr ws)
{
mp_limb_t cy, saved;
- mp_size_t twok;
- mp_size_t kk1;
- mp_ptr c1, v1, c3, vinf;
-
- twok = k + k;
- kk1 = twok + 1;
+ mp_size_t twok = k + k;
+ mp_size_t kk1 = twok + 1;
+ mp_ptr c1, v1, c3, vinf, c5;
+ mp_limb_t cout; /* final carry, should be zero at the end */
c1 = c + k;
v1 = c1 + k;
c3 = v1 + k;
vinf = c3 + k;
+ c5 = vinf + k;
#define v0 (c)
/* (1) v2 <- v2-vm1 < v2+|vm1|, (16 8 4 2 1) - (1 -1 1 -1 1) =
thus 0 <= v2 < 50*B^(2k) < 2^6*B^(2k) (15 9 3 3 0)
*/
- if (sa)
- ASSERT_NOCARRY (mpn_add_n (v2, v2, vm1, kk1));
+ if (sa <= 0)
+ mpn_add_n (v2, v2, vm1, kk1);
else
- ASSERT_NOCARRY (mpn_sub_n (v2, v2, vm1, kk1));
+ mpn_sub_n (v2, v2, vm1, kk1);
/* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
v0 v1 hi(vinf) |vm1| v2-vm1 EMPTY */
@@ -74,18 +63,17 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1,
/* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
v0 v1 hi(vinf) |vm1| (v2-vm1)/3 EMPTY */
- /* (2) vm1 <- tm1 := (v1 - vm1) / 2 [(1 1 1 1 1) - (1 -1 1 -1 1)] / 2 =
- tm1 >= 0 (0 1 0 1 0)
+ /* (2) vm1 <- tm1 := (v1 - sa*vm1) / 2 [(1 1 1 1 1) - (1 -1 1 -1 1)] / 2 =
+ tm1 >= 0 (0 1 0 1 0)
No carry comes out from {v1, kk1} +/- {vm1, kk1},
- and the division by two is exact.
- If (sa!=0) the sign of vm1 is negative */
- if (sa)
+ and the division by two is exact */
+ if (sa <= 0)
{
#ifdef HAVE_NATIVE_mpn_rsh1add_n
mpn_rsh1add_n (vm1, v1, vm1, kk1);
#else
- ASSERT_NOCARRY (mpn_add_n (vm1, v1, vm1, kk1));
- ASSERT_NOCARRY (mpn_rshift (vm1, vm1, kk1, 1));
+ mpn_add_n (vm1, v1, vm1, kk1);
+ mpn_rshift (vm1, vm1, kk1, 1);
#endif
}
else
@@ -93,8 +81,8 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1,
#ifdef HAVE_NATIVE_mpn_rsh1sub_n
mpn_rsh1sub_n (vm1, v1, vm1, kk1);
#else
- ASSERT_NOCARRY (mpn_sub_n (vm1, v1, vm1, kk1));
- ASSERT_NOCARRY (mpn_rshift (vm1, vm1, kk1, 1));
+ mpn_sub_n (vm1, v1, vm1, kk1);
+ mpn_rshift (vm1, vm1, kk1, 1);
#endif
}
@@ -115,8 +103,8 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1,
#ifdef HAVE_NATIVE_mpn_rsh1sub_n
mpn_rsh1sub_n (v2, v2, v1, kk1);
#else
- ASSERT_NOCARRY (mpn_sub_n (v2, v2, v1, kk1));
- ASSERT_NOCARRY (mpn_rshift (v2, v2, kk1, 1));
+ mpn_sub_n (v2, v2, v1, kk1);
+ mpn_rshift (v2, v2, kk1, 1);
#endif
/* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
@@ -125,75 +113,58 @@ mpn_toom_interpolate_5pts (mp_ptr c, mp_ptr v2, mp_ptr vm1,
/* (5) v1 <- t1-tm1 (1 1 1 1 0) - (0 1 0 1 0) = (1 0 1 0 0)
result is v1 >= 0
*/
- ASSERT_NOCARRY (mpn_sub_n (v1, v1, vm1, kk1));
+ mpn_sub_n (v1, v1, vm1, kk1);
- /* We do not need to read the value in vm1, so we add it in {c+k, ...} */
- cy = mpn_add_n (c1, c1, vm1, kk1);
- MPN_INCR_U (c3 + 1, twor + k - 1, cy); /* 2n-(3k+1) = 2r+k-1 */
- /* Memory allocated for vm1 is now free, it can be recycled ...*/
+ /* {c,2k} {c+2k,2k+1} {c+4k+1,2r-1} {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v0 v1-v0-tm1 hi(vinf) tm1 (v2-vm1-3t1)/6 EMPTY */
/* (6) v2 <- v2 - 2*vinf, (2 1 0 0 0) - 2*(1 0 0 0 0) = (0 1 0 0 0)
result is v2 >= 0 */
saved = vinf[0]; /* Remember v1's highest byte (will be overwritten). */
vinf[0] = vinf0; /* Set the right value for vinf0 */
-#ifdef HAVE_NATIVE_mpn_sublsh1_n_ip1
- cy = mpn_sublsh1_n_ip1 (v2, vinf, twor);
+#ifdef HAVE_NATIVE_mpn_sublsh1_n
+ cy = mpn_sublsh1_n (v2, v2, vinf, twor);
#else
- /* Overwrite unused vm1 */
- cy = mpn_lshift (vm1, vinf, twor, 1);
- cy += mpn_sub_n (v2, v2, vm1, twor);
+ cy = mpn_lshift (ws, vinf, twor, 1);
+ cy += mpn_sub_n (v2, v2, ws, twor);
#endif
MPN_DECR_U (v2 + twor, kk1 - twor, cy);
- /* Current matrix is
- [1 0 0 0 0; vinf
- 0 1 0 0 0; v2
- 1 0 1 0 0; v1
- 0 1 0 1 0; vm1
- 0 0 0 0 1] v0
- Some values already are in-place (we added vm1 in the correct position)
- | vinf| v1 | v0 |
- | vm1 |
- One still is in a separated area
- | +v2 |
- We have to compute v1-=vinf; vm1 -= v2,
- |-vinf|
- | -v2 |
- Carefully reordering operations we can avoid to compute twice the sum
- of the high half of v2 plus the low half of vinf.
- */
-
- /* Add the high half of t2 in {vinf} */
- if ( LIKELY(twor > k + 1) ) { /* This is the expected flow */
- cy = mpn_add_n (vinf, vinf, v2 + k, k + 1);
- MPN_INCR_U (c3 + kk1, twor - k - 1, cy); /* 2n-(5k+1) = 2r-k-1 */
- } else { /* triggered only by very unbalanced cases like
- (k+k+(k-2))x(k+k+1) , should be handled by toom32 */
- ASSERT_NOCARRY (mpn_add_n (vinf, vinf, v2 + k, twor));
- }
/* (7) v1 <- v1 - vinf, (1 0 1 0 0) - (1 0 0 0 0) = (0 0 1 0 0)
result is >= 0 */
- /* Side effect: we also subtracted (high half) vm1 -= v2 */
cy = mpn_sub_n (v1, v1, vinf, twor); /* vinf is at most twor long. */
- vinf0 = vinf[0]; /* Save again the right value for vinf0 */
vinf[0] = saved;
MPN_DECR_U (v1 + twor, kk1 - twor, cy); /* Treat the last bytes. */
+ __GMPN_ADD_1 (cout, vinf, vinf, twor, vinf0); /* Add vinf0, propagate carry. */
- /* (8) vm1 <- vm1-v2 (0 1 0 1 0) - (0 1 0 0 0) = (0 0 0 1 0)
- Operate only on the low half.
+ /* (8) vm1 <- vm1-t2 (0 1 0 1 0) - (0 1 0 0 0) = (0 0 0 1 0)
+ vm1 >= 0
*/
- cy = mpn_sub_n (c1, c1, v2, k);
- MPN_DECR_U (v1, kk1, cy);
+ mpn_sub_n (vm1, vm1, v2, kk1); /* No overlapping here. */
/********************* Beginning the final phase **********************/
- /* Most of the recomposition was done */
+ /* {c,2k} {c+2k,2k } {c+4k ,2r } {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v0 t1 hi(t1)+vinf tm1 (v2-vm1-3t1)/6 EMPTY */
+
+ /* (9) add t2 in {c+3k, ...} */
+ cy = mpn_add_n (c3, c3, v2, kk1);
+ __GMPN_ADD_1 (cout, c5 + 1, c5 + 1, twor - k - 1, cy); /* 2n-(5k+1) = 2r-k-1 */
+
+ /* {c,2k} {c+2k,2k } {c+4k ,2r } {t,2k+1} {t+2k+1,2k+1} {t+4k+2,2r}
+ v0 t1 hi(t1)+vinf tm1 (v2-vm1-3t1)/6 EMPTY */
+ /* c c+k c+2k c+3k c+4k t t+2k+1 t+4k+2
+ v0 t1 vinf tm1 t2
+ +t2 */
+
+ /* add vm1 in {c+k, ...} */
+ cy = mpn_add_n (c1, c1, vm1, kk1);
+ __GMPN_ADD_1 (cout, c3 + 1, c3 + 1, twor + k - 1, cy); /* 2n-(3k+1) = 2r+k-1 */
- /* add t2 in {c+3k, ...}, but only the low half */
- cy = mpn_add_n (c3, c3, v2, k);
- vinf[0] += cy;
- ASSERT(vinf[0] >= cy); /* No carry */
- MPN_INCR_U (vinf, twor, vinf0); /* Add vinf0, propagate carry. */
+ /* c c+k c+2k c+3k c+4k t t+2k+1 t+4k+2
+ v0 t1 vinf tm1 t2
+ +tm1 +t2 */
#undef v0
+#undef t2
}
diff --git a/gmp/mpn/generic/toom_interpolate_6pts.c b/gmp/mpn/generic/toom_interpolate_6pts.c
deleted file mode 100644
index bdb2e95b89..0000000000
--- a/gmp/mpn/generic/toom_interpolate_6pts.c
+++ /dev/null
@@ -1,240 +0,0 @@
-/* mpn_toom_interpolate_6pts -- Interpolate for toom43, 52
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* For odd divisors, mpn_divexact_1 works fine with two's complement. */
-#ifndef mpn_divexact_by3
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1 && MODLIMB_INVERSE_3
-#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,MODLIMB_INVERSE_3,0)
-#else
-#define mpn_divexact_by3(dst,src,size) mpn_divexact_1(dst,src,size,3)
-#endif
-#endif
-
-/* Interpolation for Toom-3.5, using the evaluation points: infinity,
- 1, -1, 2, -2. More precisely, we want to compute
- f(2^(GMP_NUMB_BITS * n)) for a polynomial f of degree 5, given the
- six values
-
- w5 = f(0),
- w4 = f(-1),
- w3 = f(1)
- w2 = f(-2),
- w1 = f(2),
- w0 = limit at infinity of f(x) / x^5,
-
- The result is stored in {pp, 5*n + w0n}. At entry, w5 is stored at
- {pp, 2n}, w3 is stored at {pp + 2n, 2n+1}, and w0 is stored at
- {pp + 5n, w0n}. The other values are 2n + 1 limbs each (with most
- significant limbs small). f(-1) and f(-2) may be negative, signs
- determined by the flag bits. All intermediate results are positive.
- Inputs are destroyed.
-
- Interpolation sequence was taken from the paper: "Integer and
- Polynomial Multiplication: Towards Optimal Toom-Cook Matrices".
- Some slight variations were introduced: adaptation to "gmp
- instruction set", and a final saving of an operation by interlacing
- interpolation and recomposition phases.
-*/
-
-void
-mpn_toom_interpolate_6pts (mp_ptr pp, mp_size_t n, enum toom6_flags flags,
- mp_ptr w4, mp_ptr w2, mp_ptr w1,
- mp_size_t w0n)
-{
- mp_limb_t cy;
- /* cy6 can be stored in w1[2*n], cy4 in w4[0], embankment in w2[0] */
- mp_limb_t cy4, cy6, embankment;
-
- ASSERT( n > 0 );
- ASSERT( 2*n >= w0n && w0n > 0 );
-
-#define w5 pp /* 2n */
-#define w3 (pp + 2 * n) /* 2n+1 */
-#define w0 (pp + 5 * n) /* w0n */
-
- /* Interpolate with sequence:
- W2 =(W1 - W2)>>2
- W1 =(W1 - W5)>>1
- W1 =(W1 - W2)>>1
- W4 =(W3 - W4)>>1
- W2 =(W2 - W4)/3
- W3 = W3 - W4 - W5
- W1 =(W1 - W3)/3
- // Last steps are mixed with recomposition...
- W2 = W2 - W0<<2
- W4 = W4 - W2
- W3 = W3 - W1
- W2 = W2 - W0
- */
-
- /* W2 =(W1 - W2)>>2 */
- if (flags & toom6_vm2_neg)
- mpn_add_n (w2, w1, w2, 2 * n + 1);
- else
- mpn_sub_n (w2, w1, w2, 2 * n + 1);
- mpn_rshift (w2, w2, 2 * n + 1, 2);
-
- /* W1 =(W1 - W5)>>1 */
- w1[2*n] -= mpn_sub_n (w1, w1, w5, 2*n);
- mpn_rshift (w1, w1, 2 * n + 1, 1);
-
- /* W1 =(W1 - W2)>>1 */
-#if HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (w1, w1, w2, 2 * n + 1);
-#else
- mpn_sub_n (w1, w1, w2, 2 * n + 1);
- mpn_rshift (w1, w1, 2 * n + 1, 1);
-#endif
-
- /* W4 =(W3 - W4)>>1 */
- if (flags & toom6_vm1_neg)
- {
-#if HAVE_NATIVE_mpn_rsh1add_n
- mpn_rsh1add_n (w4, w3, w4, 2 * n + 1);
-#else
- mpn_add_n (w4, w3, w4, 2 * n + 1);
- mpn_rshift (w4, w4, 2 * n + 1, 1);
-#endif
- }
- else
- {
-#if HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (w4, w3, w4, 2 * n + 1);
-#else
- mpn_sub_n (w4, w3, w4, 2 * n + 1);
- mpn_rshift (w4, w4, 2 * n + 1, 1);
-#endif
- }
-
- /* W2 =(W2 - W4)/3 */
- mpn_sub_n (w2, w2, w4, 2 * n + 1);
- mpn_divexact_by3 (w2, w2, 2 * n + 1);
-
- /* W3 = W3 - W4 - W5 */
- mpn_sub_n (w3, w3, w4, 2 * n + 1);
- w3[2 * n] -= mpn_sub_n (w3, w3, w5, 2 * n);
-
- /* W1 =(W1 - W3)/3 */
- mpn_sub_n (w1, w1, w3, 2 * n + 1);
- mpn_divexact_by3 (w1, w1, 2 * n + 1);
-
- /*
- [1 0 0 0 0 0;
- 0 1 0 0 0 0;
- 1 0 1 0 0 0;
- 0 1 0 1 0 0;
- 1 0 1 0 1 0;
- 0 0 0 0 0 1]
-
- pp[] prior to operations:
- |_H w0__|_L w0__|______||_H w3__|_L w3__|_H w5__|_L w5__|
-
- summation scheme for remaining operations:
- |______________5|n_____4|n_____3|n_____2|n______|n______|pp
- |_H w0__|_L w0__|______||_H w3__|_L w3__|_H w5__|_L w5__|
- || H w4 | L w4 |
- || H w2 | L w2 |
- || H w1 | L w1 |
- ||-H w1 |-L w1 |
- |-H w0 |-L w0 ||-H w2 |-L w2 |
- */
- cy = mpn_add_n (pp + n, pp + n, w4, 2 * n + 1);
- MPN_INCR_U (pp + 3 * n + 1, n, cy);
-
- /* W2 -= W0<<2 */
-#if HAVE_NATIVE_mpn_sublsh_n || HAVE_NATIVE_mpn_sublsh2_n_ip1
-#if HAVE_NATIVE_mpn_sublsh2_n_ip1
- cy = mpn_sublsh2_n_ip1 (w2, w0, w0n);
-#else
- cy = mpn_sublsh_n (w2, w2, w0, w0n, 2);
-#endif
-#else
- /* {W4,2*n+1} is now free and can be overwritten. */
- cy = mpn_lshift(w4, w0, w0n, 2);
- cy+= mpn_sub_n(w2, w2, w4, w0n);
-#endif
- MPN_DECR_U (w2 + w0n, 2 * n + 1 - w0n, cy);
-
- /* W4L = W4L - W2L */
- cy = mpn_sub_n (pp + n, pp + n, w2, n);
- MPN_DECR_U (w3, 2 * n + 1, cy);
-
- /* W3H = W3H + W2L */
- cy4 = w3[2 * n] + mpn_add_n (pp + 3 * n, pp + 3 * n, w2, n);
- /* W1L + W2H */
- cy = w2[2 * n] + mpn_add_n (pp + 4 * n, w1, w2 + n, n);
- MPN_INCR_U (w1 + n, n + 1, cy);
-
- /* W0 = W0 + W1H */
- if (LIKELY (w0n > n))
- cy6 = w1[2 * n] + mpn_add_n (w0, w0, w1 + n, n);
- else
- cy6 = mpn_add_n (w0, w0, w1 + n, w0n);
-
- /*
- summation scheme for the next operation:
- |...____5|n_____4|n_____3|n_____2|n______|n______|pp
- |...w0___|_w1_w2_|_H w3__|_L w3__|_H w5__|_L w5__|
- ...-w0___|-w1_w2 |
- */
- /* if(LIKELY(w0n>n)) the two operands below DO overlap! */
- cy = mpn_sub_n (pp + 2 * n, pp + 2 * n, pp + 4 * n, n + w0n);
-
- /* embankment is a "dirty trick" to avoid carry/borrow propagation
- beyond allocated memory */
- embankment = w0[w0n - 1] - 1;
- w0[w0n - 1] = 1;
- if (LIKELY (w0n > n)) {
- if (cy4 > cy6)
- MPN_INCR_U (pp + 4 * n, w0n + n, cy4 - cy6);
- else
- MPN_DECR_U (pp + 4 * n, w0n + n, cy6 - cy4);
- MPN_DECR_U (pp + 3 * n + w0n, 2 * n, cy);
- MPN_INCR_U (w0 + n, w0n - n, cy6);
- } else {
- MPN_INCR_U (pp + 4 * n, w0n + n, cy4);
- MPN_DECR_U (pp + 3 * n + w0n, 2 * n, cy + cy6);
- }
- w0[w0n - 1] += embankment;
-
-#undef w5
-#undef w3
-#undef w0
-
-}
diff --git a/gmp/mpn/generic/toom_interpolate_7pts.c b/gmp/mpn/generic/toom_interpolate_7pts.c
index 2a67dba82f..872da26309 100644
--- a/gmp/mpn/generic/toom_interpolate_7pts.c
+++ b/gmp/mpn/generic/toom_interpolate_7pts.c
@@ -1,7 +1,6 @@
/* mpn_toom_interpolate_7pts -- Interpolate for toom44, 53, 62.
- Contributed to the GNU project by Niels Möller.
- Improvements by Marco Bodrato.
+ 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
@@ -12,216 +11,149 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-#define BINVERT_3 MODLIMB_INVERSE_3
-
-#define BINVERT_9 \
- ((((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)
-
-/* 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
- many faster if it is native. For now, since mpn_divexact_1 is native on
- several platforms where mpn_pi1_bdiv_q_1 does not yet exist, do not use
- mpn_pi1_bdiv_q_1 unconditionally. FIXME. */
+/* Arithmetic right shift, requiring that the shifted out bits are zero. */
+static inline void
+divexact_2exp (mp_ptr rp, mp_srcptr sp, mp_size_t n, unsigned shift)
+{
+ mp_limb_t sign;
+ sign = LIMB_HIGHBIT_TO_MASK (sp[n-1] << GMP_NAIL_BITS) << (GMP_NUMB_BITS - shift);
+ ASSERT_NOCARRY (mpn_rshift (rp, sp, n, shift));
+ rp[n-1] |= sign & GMP_NUMB_MASK;
+}
/* For odd divisors, mpn_divexact_1 works fine with two's complement. */
#ifndef mpn_divexact_by3
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,BINVERT_3,0)
-#else
#define mpn_divexact_by3(dst,src,size) mpn_divexact_1(dst,src,size,3)
#endif
-#endif
-
#ifndef mpn_divexact_by9
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by9(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,9,BINVERT_9,0)
-#else
#define mpn_divexact_by9(dst,src,size) mpn_divexact_1(dst,src,size,9)
#endif
-#endif
-
#ifndef mpn_divexact_by15
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by15(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,15,BINVERT_15,0)
-#else
#define mpn_divexact_by15(dst,src,size) mpn_divexact_1(dst,src,size,15)
#endif
-#endif
-/* Interpolation for toom4, using the evaluation points 0, infinity,
- 1, -1, 2, -2, 1/2. More precisely, we want to compute
+/* Interpolation for toom4, using the evaluation points infinity, 2,
+ 1, -1, 1/2, -1/2. More precisely, we want to compute
f(2^(GMP_NUMB_BITS * n)) for a polynomial f of degree 6, given the
seven values
w0 = f(0),
- w1 = f(-2),
- w2 = f(1),
+ w1 = 64 f(-1/2),
+ w2 = 64 f(1/2),
w3 = f(-1),
- w4 = f(2)
- w5 = 64 * f(1/2)
+ w4 = f(1)
+ w5 = f(2)
w6 = limit at infinity of f(x) / x^6,
The result is 6*n + w6n limbs. At entry, w0 is stored at {rp, 2n },
w2 is stored at { rp + 2n, 2n+1 }, and w6 is stored at { rp + 6n,
w6n }. The other values are 2n + 1 limbs each (with most
significant limbs small). f(-1) and f(-1/2) may be negative, signs
- determined by the flag bits. Inputs are destroyed.
+ determined by the flag bits. All intermediate results are
+ represented in two's complement. Inputs are destroyed.
Needs (2*n + 1) limbs of temporary storage.
*/
void
-mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom7_flags flags,
+mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom4_flags flags,
mp_ptr w1, mp_ptr w3, mp_ptr w4, mp_ptr w5,
mp_size_t w6n, mp_ptr tp)
{
- mp_size_t m;
+ mp_size_t m = 2*n + 1;
+ mp_ptr w2 = rp + 2*n;
+ mp_ptr w6 = rp + 6*n;
mp_limb_t cy;
- m = 2*n + 1;
-#define w0 rp
-#define w2 (rp + 2*n)
-#define w6 (rp + 6*n)
-
ASSERT (w6n > 0);
ASSERT (w6n <= 2*n);
- /* Using formulas similar to Marco Bodrato's
+ /* Using Marco Bodrato's formulas
- W5 = W5 + W4
- W1 =(W4 - W1)/2
- W4 = W4 - W0
- W4 =(W4 - W1)/4 - W6*16
- W3 =(W2 - W3)/2
- W2 = W2 - W3
+ W5 = W5 + W2
+ W3 =(W3 + W4)/2
+ W1 = W1 + W2
+ W2 = W2 - W6 - W0*64
+ W2 =(W2*2 - W1)/8
+ W4 = W4 - W3
- W5 = W5 - W2*65 May be negative.
- W2 = W2 - W6 - W0
- W5 =(W5 + W2*45)/2 Now >= 0 again.
- W4 =(W4 - W2)/3
- W2 = W2 - W4
+ W5 = W5 - W4*65
+ W4 = W4 - W6 - W0
+ W5 = W5 + W4*45
+ W2 =(W2 - W4)/3
+ W4 = W4 - W2
- W1 = W5 - W1 May be negative.
- W5 =(W5 - W3*8)/9
+ W1 = W1 - W5
+ W5 =(W5 - W3*16)/ 18
W3 = W3 - W5
- W1 =(W1/15 + W5)/2 Now >= 0 again.
+ W1 =(W1/30 + W5)/ 2
W5 = W5 - W1
- where W0 = f(0), W1 = f(-2), W2 = f(1), W3 = f(-1),
- W4 = f(2), W5 = f(1/2), W6 = f(oo),
-
- Note that most intermediate results are positive; the ones that
- may be negative are represented in two's complement. We must
- never shift right a value that may be negative, since that would
- invalidate the sign bit. On the other hand, divexact by odd
- numbers work fine with two's complement.
+ where W0 = f(0), W1 = 64 f(-1/2), W2 = 64 f(1/2), W3 = f(-1),
+ W4 = f(1), W5 = f(2), W6 = f(oo),
*/
- mpn_add_n (w5, w5, w4, m);
- if (flags & toom7_w1_neg)
- {
-#ifdef HAVE_NATIVE_mpn_rsh1add_n
- mpn_rsh1add_n (w1, w1, w4, m);
-#else
- mpn_add_n (w1, w1, w4, m); ASSERT (!(w1[0] & 1));
- mpn_rshift (w1, w1, m, 1);
-#endif
- }
+ mpn_add_n (w5, w5, w2, m);
+ if (flags & toom4_w3_neg)
+ mpn_add_n (w3, w3, w4, m);
else
- {
-#ifdef HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (w1, w4, w1, m);
-#else
- mpn_sub_n (w1, w4, w1, m); ASSERT (!(w1[0] & 1));
- mpn_rshift (w1, w1, m, 1);
-#endif
- }
- mpn_sub (w4, w4, m, w0, 2*n);
- mpn_sub_n (w4, w4, w1, m); ASSERT (!(w4[0] & 3));
- mpn_rshift (w4, w4, m, 2); /* w4>=0 */
-
- tp[w6n] = mpn_lshift (tp, w6, w6n, 4);
- mpn_sub (w4, w4, m, tp, w6n+1);
-
- if (flags & toom7_w3_neg)
- {
-#ifdef HAVE_NATIVE_mpn_rsh1add_n
- mpn_rsh1add_n (w3, w3, w2, m);
-#else
- mpn_add_n (w3, w3, w2, m); ASSERT (!(w3[0] & 1));
- mpn_rshift (w3, w3, m, 1);
-#endif
- }
+ mpn_sub_n (w3, w4, w3, m);
+ divexact_2exp (w3, w3, m, 1);
+ if (flags & toom4_w1_neg)
+ mpn_add_n (w1, w1, w2, m);
else
- {
-#ifdef HAVE_NATIVE_mpn_rsh1sub_n
- mpn_rsh1sub_n (w3, w2, w3, m);
-#else
- mpn_sub_n (w3, w2, w3, m); ASSERT (!(w3[0] & 1));
- mpn_rshift (w3, w3, m, 1);
-#endif
- }
-
- mpn_sub_n (w2, w2, w3, m);
-
- mpn_submul_1 (w5, w2, m, 65);
+ mpn_sub_n (w1, w2, w1, m);
mpn_sub (w2, w2, m, w6, w6n);
- mpn_sub (w2, w2, m, w0, 2*n);
-
- mpn_addmul_1 (w5, w2, m, 45); ASSERT (!(w5[0] & 1));
- mpn_rshift (w5, w5, m, 1);
- mpn_sub_n (w4, w4, w2, m);
-
- mpn_divexact_by3 (w4, w4, m);
+ tp[2*n] = mpn_lshift (tp, rp, 2*n, 6);
+ mpn_sub_n (w2, w2, tp, m);
+ mpn_lshift (w2, w2, m, 1);
+ mpn_sub_n (w2, w2, w1, m);
+ divexact_2exp (w2, w2, m, 3);
+ mpn_sub_n (w4, w4, w3, m);
+
+ mpn_submul_1 (w5, w4, m, 65);
+ mpn_sub (w4, w4, m, w6, w6n);
+ mpn_sub (w4, w4, m, rp, 2*n);
+ mpn_addmul_1 (w5, w4, m, 45);
mpn_sub_n (w2, w2, w4, m);
+ /* Rely on divexact working with two's complement */
+ mpn_divexact_by3 (w2, w2, m);
+ mpn_sub_n (w4, w4, w2, m);
- mpn_sub_n (w1, w5, w1, m);
- mpn_lshift (tp, w3, m, 3);
+ mpn_sub_n (w1, w1, w5, m);
+ mpn_lshift (tp, w3, m, 4);
mpn_sub_n (w5, w5, tp, m);
+ divexact_2exp (w5, w5, m, 1);
mpn_divexact_by9 (w5, w5, m);
mpn_sub_n (w3, w3, w5, m);
-
+ divexact_2exp (w1, w1, m, 1);
mpn_divexact_by15 (w1, w1, m);
- mpn_add_n (w1, w1, w5, m); ASSERT (!(w1[0] & 1));
- mpn_rshift (w1, w1, m, 1); /* w1>=0 now */
+ mpn_add_n (w1, w1, w5, m);
+ divexact_2exp (w1, w1, m, 1);
mpn_sub_n (w5, w5, w1, m);
- /* These bounds are valid for the 4x4 polynomial product of toom44,
- * and they are conservative for toom53 and toom62. */
- ASSERT (w1[2*n] < 2);
- ASSERT (w2[2*n] < 3);
- ASSERT (w3[2*n] < 4);
- ASSERT (w4[2*n] < 3);
- ASSERT (w5[2*n] < 2);
+ /* Two's complement coefficients must be non-negative at the end of
+ this procedure. */
+ ASSERT ( !(w1[2*n] & GMP_LIMB_HIGHBIT));
+ ASSERT ( !(w2[2*n] & GMP_LIMB_HIGHBIT));
+ ASSERT ( !(w3[2*n] & GMP_LIMB_HIGHBIT));
+ ASSERT ( !(w4[2*n] & GMP_LIMB_HIGHBIT));
+ ASSERT ( !(w5[2*n] & GMP_LIMB_HIGHBIT));
/* Addition chain. Note carries and the 2n'th limbs that need to be
* added in.
@@ -242,8 +174,8 @@ mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom7_flags flags,
* c7 c6 c5 c4 c3 Carries to propagate
*/
- cy = mpn_add_n (rp + n, rp + n, w1, m);
- MPN_INCR_U (w2 + n + 1, n , cy);
+ cy = mpn_add_n (rp + n, rp + n, w1, 2*n);
+ MPN_INCR_U (w2 + n, n + 1, w1[2*n] + cy);
cy = mpn_add_n (rp + 3*n, rp + 3*n, w3, n);
MPN_INCR_U (w3 + n, n + 1, w2[2*n] + cy);
cy = mpn_add_n (rp + 4*n, w3 + n, w4, n);
@@ -251,7 +183,10 @@ mpn_toom_interpolate_7pts (mp_ptr rp, mp_size_t n, enum toom7_flags flags,
cy = mpn_add_n (rp + 5*n, w4 + n, w5, n);
MPN_INCR_U (w5 + n, n + 1, w4[2*n] + cy);
if (w6n > n + 1)
- ASSERT_NOCARRY (mpn_add (rp + 6*n, rp + 6*n, w6n, w5 + n, n + 1));
+ {
+ mp_limb_t c7 = mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, n + 1);
+ MPN_INCR_U (rp + 7*n + 1, w6n - n - 1, c7);
+ }
else
{
ASSERT_NOCARRY (mpn_add_n (rp + 6*n, rp + 6*n, w5 + n, w6n));
diff --git a/gmp/mpn/generic/toom_interpolate_8pts.c b/gmp/mpn/generic/toom_interpolate_8pts.c
deleted file mode 100644
index 9e8808334e..0000000000
--- a/gmp/mpn/generic/toom_interpolate_8pts.c
+++ /dev/null
@@ -1,212 +0,0 @@
-/* mpn_toom_interpolate_8pts -- Interpolate for toom54, 63, 72.
-
- Contributed to the GNU project by 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-#define BINVERT_3 MODLIMB_INVERSE_3
-
-#define BINVERT_15 \
- ((((GMP_NUMB_MAX >> (GMP_NUMB_BITS % 4)) / 15) * 14 * 16 & GMP_NUMB_MAX) + 15)
-
-#define BINVERT_45 ((BINVERT_15 * BINVERT_3) & GMP_NUMB_MASK)
-
-#ifndef mpn_divexact_by3
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by3(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,3,BINVERT_3,0)
-#else
-#define mpn_divexact_by3(dst,src,size) mpn_divexact_1(dst,src,size,3)
-#endif
-#endif
-
-#ifndef mpn_divexact_by45
-#if GMP_NUMB_BITS % 12 == 0
-#define mpn_divexact_by45(dst,src,size) \
- (63 & 19 * mpn_bdiv_dbm1 (dst, src, size, __GMP_CAST (mp_limb_t, GMP_NUMB_MASK / 45)))
-#else
-#if HAVE_NATIVE_mpn_pi1_bdiv_q_1
-#define mpn_divexact_by45(dst,src,size) mpn_pi1_bdiv_q_1(dst,src,size,45,BINVERT_45,0)
-#else
-#define mpn_divexact_by45(dst,src,size) mpn_divexact_1(dst,src,size,45)
-#endif
-#endif
-#endif
-
-#if HAVE_NATIVE_mpn_sublsh2_n_ip1
-#define DO_mpn_sublsh2_n(dst,src,n,ws) mpn_sublsh2_n_ip1(dst,src,n)
-#else
-#define DO_mpn_sublsh2_n(dst,src,n,ws) DO_mpn_sublsh_n(dst,src,n,2,ws)
-#endif
-
-#if HAVE_NATIVE_mpn_sublsh_n
-#define DO_mpn_sublsh_n(dst,src,n,s,ws) mpn_sublsh_n (dst,dst,src,n,s)
-#else
-static mp_limb_t
-DO_mpn_sublsh_n (mp_ptr dst, mp_srcptr src, mp_size_t n, unsigned int s, mp_ptr ws)
-{
-#if USE_MUL_1 && 0
- return mpn_submul_1(dst,src,n,CNST_LIMB(1) <<(s));
-#else
- mp_limb_t __cy;
- __cy = mpn_lshift (ws,src,n,s);
- return __cy + mpn_sub_n (dst,dst,ws,n);
-#endif
-}
-#endif
-
-
-#if HAVE_NATIVE_mpn_subrsh
-#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) mpn_subrsh (dst,nd,src,ns,s)
-#else
-/* This is not a correct definition, it assumes no carry */
-#define DO_mpn_subrsh(dst,nd,src,ns,s,ws) \
-do { \
- mp_limb_t __cy; \
- MPN_DECR_U (dst, nd, src[0] >> s); \
- __cy = DO_mpn_sublsh_n (dst, src + 1, ns - 1, GMP_NUMB_BITS - s, ws); \
- MPN_DECR_U (dst + ns - 1, nd - ns + 1, __cy); \
-} while (0)
-#endif
-
-/* Interpolation for Toom-4.5 (or Toom-4), using the evaluation
- points: infinity(4.5 only), 4, -4, 2, -2, 1, -1, 0. More precisely,
- we want to compute f(2^(GMP_NUMB_BITS * n)) for a polynomial f of
- degree 7 (or 6), given the 8 (rsp. 7) values:
-
- r1 = limit at infinity of f(x) / x^7,
- r2 = f(4),
- r3 = f(-4),
- r4 = f(2),
- r5 = f(-2),
- r6 = f(1),
- r7 = f(-1),
- r8 = f(0).
-
- All couples of the form f(n),f(-n) must be already mixed with
- toom_couple_handling(f(n),...,f(-n),...)
-
- The result is stored in {pp, spt + 7*n (or 6*n)}.
- At entry, r8 is stored at {pp, 2n},
- r5 is stored at {pp + 3n, 3n + 1}.
-
- The other values are 2n+... limbs each (with most significant limbs small).
-
- All intermediate results are positive.
- Inputs are destroyed.
-*/
-
-void
-mpn_toom_interpolate_8pts (mp_ptr pp, mp_size_t n,
- mp_ptr r3, mp_ptr r7,
- mp_size_t spt, mp_ptr ws)
-{
- mp_limb_signed_t cy;
- mp_ptr r5, r1;
- r5 = (pp + 3 * n); /* 3n+1 */
- r1 = (pp + 7 * n); /* spt */
-
- /******************************* interpolation *****************************/
-
- DO_mpn_subrsh(r3+n, 2 * n + 1, pp, 2 * n, 4, ws);
- cy = DO_mpn_sublsh_n (r3, r1, spt, 12, ws);
- MPN_DECR_U (r3 + spt, 3 * n + 1 - spt, cy);
-
- DO_mpn_subrsh(r5+n, 2 * n + 1, pp, 2 * n, 2, ws);
- cy = DO_mpn_sublsh_n (r5, r1, spt, 6, ws);
- MPN_DECR_U (r5 + spt, 3 * n + 1 - spt, cy);
-
- r7[3*n] -= mpn_sub_n (r7+n, r7+n, pp, 2 * n);
- cy = mpn_sub_n (r7, r7, r1, spt);
- MPN_DECR_U (r7 + spt, 3 * n + 1 - spt, cy);
-
- ASSERT_NOCARRY(mpn_sub_n (r3, r3, r5, 3 * n + 1));
- ASSERT_NOCARRY(mpn_rshift(r3, r3, 3 * n + 1, 2));
-
- ASSERT_NOCARRY(mpn_sub_n (r5, r5, r7, 3 * n + 1));
-
- ASSERT_NOCARRY(mpn_sub_n (r3, r3, r5, 3 * n + 1));
-
- mpn_divexact_by45 (r3, r3, 3 * n + 1);
-
- ASSERT_NOCARRY(mpn_divexact_by3 (r5, r5, 3 * n + 1));
-
- ASSERT_NOCARRY(DO_mpn_sublsh2_n (r5, r3, 3 * n + 1, ws));
-
- /* last interpolation steps... */
- /* ... are mixed with recomposition */
-
- /***************************** recomposition *******************************/
- /*
- pp[] prior to operations:
- |_H r1|_L r1|____||_H r5|_M_r5|_L r5|_____|_H r8|_L r8|pp
-
- summation scheme for remaining operations:
- |____8|n___7|n___6|n___5|n___4|n___3|n___2|n____|n____|pp
- |_H r1|_L r1|____||_H*r5|_M r5|_L r5|_____|_H_r8|_L r8|pp
- ||_H r3|_M r3|_L*r3|
- ||_H_r7|_M_r7|_L_r7|
- ||-H r3|-M r3|-L*r3|
- ||-H*r5|-M_r5|-L_r5|
- */
-
- cy = mpn_add_n (pp + n, pp + n, r7, n); /* Hr8+Lr7-Lr5 */
- cy-= mpn_sub_n (pp + n, pp + n, r5, n);
- if (0 > cy)
- MPN_DECR_U (r7 + n, 2*n + 1, 1);
- else
- MPN_INCR_U (r7 + n, 2*n + 1, cy);
-
- cy = mpn_sub_n (pp + 2*n, r7 + n, r5 + n, n); /* Mr7-Mr5 */
- MPN_DECR_U (r7 + 2*n, n + 1, cy);
-
- cy = mpn_add_n (pp + 3*n, r5, r7+ 2*n, n+1); /* Hr7+Lr5 */
- r5[3*n]+= mpn_add_n (r5 + 2*n, r5 + 2*n, r3, n); /* Hr5+Lr3 */
- cy-= mpn_sub_n (pp + 3*n, pp + 3*n, r5 + 2*n, n+1); /* Hr7-Hr5+Lr5-Lr3 */
- if (UNLIKELY(0 > cy))
- MPN_DECR_U (r5 + n + 1, 2*n, 1);
- else
- MPN_INCR_U (r5 + n + 1, 2*n, cy);
-
- ASSERT_NOCARRY(mpn_sub_n(pp + 4*n, r5 + n, r3 + n, 2*n +1)); /* Mr5-Mr3,Hr5-Hr3 */
-
- cy = mpn_add_1 (pp + 6*n, r3 + n, n, pp[6*n]);
- MPN_INCR_U (r3 + 2*n, n + 1, cy);
- cy = mpn_add_n (pp + 7*n, pp + 7*n, r3 + 2*n, n);
- if (LIKELY(spt != n))
- MPN_INCR_U (pp + 8*n, spt - n, cy + r3[3*n]);
- else
- ASSERT (r3[3*n] | cy == 0);
-}
diff --git a/gmp/mpn/generic/trialdiv.c b/gmp/mpn/generic/trialdiv.c
deleted file mode 100644
index cad159c3a0..0000000000
--- a/gmp/mpn/generic/trialdiv.c
+++ /dev/null
@@ -1,132 +0,0 @@
-/* mpn_trialdiv -- find small factors of an mpn number using trial division.
-
- Contributed to the GNU project by Torbjorn Granlund.
-
- 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
- GUARANTEED THAT IT WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/*
- This function finds the first (smallest) factor represented in
- trialdivtab.h. It does not stop the factoring effort just because it has
- reached some sensible limit, such as the square root of the input number.
-
- The caller can limit the factoring effort by passing NPRIMES. The function
- will then divide until that limit, or perhaps a few primes more. A position
- which only mpn_trialdiv can make sense of is returned in the WHERE
- parameter. It can be used for restarting the factoring effort; the first
- call should pass 0 here.
-
- Input: 1. A non-negative number T = {tp,tn}
- 2. NPRIMES as described above,
- 3. *WHERE as described above.
- Output: 1. *WHERE updated as described above.
- 2. Return value is non-zero if we found a factor, else zero
- To get the actual prime factor, compute the mod B inverse
- of the return value.
-*/
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-struct gmp_primes_dtab {
- mp_limb_t binv;
- mp_limb_t lim;
-};
-
-struct gmp_primes_ptab {
- mp_limb_t ppp; /* primes, multiplied together */
- mp_limb_t cps[7]; /* ppp values pre-computed for mpn_mod_1s_4p */
- unsigned int idx:24; /* index of first primes in dtab */
- 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]))
-
-/* FIXME: We could optimize out one of the outer loop conditions if we
- had a final ptab entry with a huge nd field. */
-mp_limb_t
-mpn_trialdiv (mp_srcptr tp, mp_size_t tn, mp_size_t nprimes, int *where)
-{
- mp_limb_t ppp;
- const mp_limb_t *cps;
- const struct gmp_primes_dtab *dp;
- long i, j, idx, np;
- mp_limb_t r, q;
-
- ASSERT (tn >= 1);
-
- for (i = *where; i < PTAB_LINES; i++)
- {
- ppp = gmp_primes_ptab[i].ppp;
- cps = gmp_primes_ptab[i].cps;
-
- r = mpn_mod_1s_4p (tp, tn, ppp << cps[1], cps);
-
- idx = gmp_primes_ptab[i].idx;
- np = gmp_primes_ptab[i].np;
-
- /* Check divisibility by individual primes. */
- dp = &gmp_primes_dtab[idx] + np;
- for (j = -np; j < 0; j++)
- {
- q = r * dp[j].binv;
- if (q <= dp[j].lim)
- {
- *where = i;
- return dp[j].binv;
- }
- }
-
- nprimes -= np;
- if (nprimes <= 0)
- return 0;
- }
- return 0;
-}
diff --git a/gmp/mpn/generic/udiv_w_sdiv.c b/gmp/mpn/generic/udiv_w_sdiv.c
index 7136429f0f..f876aa5734 100644
--- a/gmp/mpn/generic/udiv_w_sdiv.c
+++ b/gmp/mpn/generic/udiv_w_sdiv.c
@@ -9,40 +9,30 @@
GNU MP RELEASE.
-Copyright 1992, 1994, 1996, 2000, 2011, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
mp_limb_t
-mpn_udiv_w_sdiv (mp_limb_t *rp, mp_limb_t a1, mp_limb_t a0, mp_limb_t d)
+mpn_udiv_w_sdiv (rp, a1, a0, d)
+ mp_limb_t *rp, a1, a0, d;
{
mp_limb_t q, r;
mp_limb_t c0, c1, b1;
@@ -52,7 +42,7 @@ mpn_udiv_w_sdiv (mp_limb_t *rp, mp_limb_t a1, mp_limb_t a0, mp_limb_t d)
if ((mp_limb_signed_t) d >= 0)
{
- if (a1 < d - a1 - (a0 >> (GMP_LIMB_BITS - 1)))
+ if (a1 < d - a1 - (a0 >> (BITS_PER_MP_LIMB - 1)))
{
/* dividend, divisor, and quotient are nonnegative */
sdiv_qrnnd (q, r, a1, a0, d);
@@ -60,18 +50,18 @@ mpn_udiv_w_sdiv (mp_limb_t *rp, mp_limb_t a1, mp_limb_t a0, mp_limb_t d)
else
{
/* Compute c1*2^32 + c0 = a1*2^32 + a0 - 2^31*d */
- sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (GMP_LIMB_BITS - 1));
+ sub_ddmmss (c1, c0, a1, a0, d >> 1, d << (BITS_PER_MP_LIMB - 1));
/* Divide (c1*2^32 + c0) by d */
sdiv_qrnnd (q, r, c1, c0, d);
/* Add 2^31 to quotient */
- q += (mp_limb_t) 1 << (GMP_LIMB_BITS - 1);
+ q += (mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1);
}
}
else
{
b1 = d >> 1; /* d/2, between 2^30 and 2^31 - 1 */
c1 = a1 >> 1; /* A/2 */
- c0 = (a1 << (GMP_LIMB_BITS - 1)) + (a0 >> 1);
+ c0 = (a1 << (BITS_PER_MP_LIMB - 1)) + (a0 >> 1);
if (a1 < b1) /* A < 2^32*b1, so A/2 < 2^31*b1 */
{
@@ -126,12 +116,12 @@ mpn_udiv_w_sdiv (mp_limb_t *rp, mp_limb_t a1, mp_limb_t a0, mp_limb_t d)
{ /* Hence a1 = d - 1 = 2*b1 - 1 */
if (a0 >= -d)
{
- q = -CNST_LIMB(1);
+ q = -1;
r = a0 + d;
}
else
{
- q = -CNST_LIMB(2);
+ q = -2;
r = a0 + 2*d;
}
}
diff --git a/gmp/mpn/generic/zero.c b/gmp/mpn/generic/zero.c
deleted file mode 100644
index e6e7fd3101..0000000000
--- a/gmp/mpn/generic/zero.c
+++ /dev/null
@@ -1,42 +0,0 @@
-/* mpn_zero
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_zero (mp_ptr rp, mp_size_t n)
-{
- mp_size_t i;
-
- rp += n;
- for (i = -n; i != 0; i++)
- rp[i] = 0;
-}
diff --git a/gmp/mpn/i960/README b/gmp/mpn/i960/README
new file mode 100644
index 0000000000..d68a0a83eb
--- /dev/null
+++ b/gmp/mpn/i960/README
@@ -0,0 +1,9 @@
+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/gmp/mpn/i960/add_n.s b/gmp/mpn/i960/add_n.s
new file mode 100644
index 0000000000..24abc6b0c9
--- /dev/null
+++ b/gmp/mpn/i960/add_n.s
@@ -0,0 +1,41 @@
+# 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/gmp/mpn/i960/addmul_1.s b/gmp/mpn/i960/addmul_1.s
new file mode 100644
index 0000000000..984f540f7b
--- /dev/null
+++ b/gmp/mpn/i960/addmul_1.s
@@ -0,0 +1,46 @@
+# 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/gmp/mpn/i960/mul_1.s b/gmp/mpn/i960/mul_1.s
new file mode 100644
index 0000000000..7912aa1fb7
--- /dev/null
+++ b/gmp/mpn/i960/mul_1.s
@@ -0,0 +1,43 @@
+# 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/gmp/mpn/i960/sub_n.s b/gmp/mpn/i960/sub_n.s
new file mode 100644
index 0000000000..87adcbf6a2
--- /dev/null
+++ b/gmp/mpn/i960/sub_n.s
@@ -0,0 +1,41 @@
+# 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
diff --git a/gmp/mpn/ia64/README b/gmp/mpn/ia64/README
index 45c2d6337f..9252271ab7 100644
--- a/gmp/mpn/ia64/README
+++ b/gmp/mpn/ia64/README
@@ -1,30 +1,19 @@
-Copyright 2000-2005 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -166,7 +155,7 @@ ldfp8 with all alignment headache that implies.
================================================================
mpn_addmul_N
-For best speed, we need to give up using mpn_addmul_2 as the main multiply
+For best speed, we need to give up using mpn_addmul_1 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.
@@ -248,7 +237,7 @@ loops, since that will allow us to do better load-use scheduling without too
much unrolling.
Depending on size or operand alignment, we get 1 c/l or 0.5 c/l on Itanium
-2, according to tune/speed. Cache bank conflicts?
+2, according to tests/devel/try. Cache bank conflicts?
@@ -279,3 +268,10 @@ Optimization, Intel document 251110-003, May 2004.
All the above documents can be found online at
http://developer.intel.com/design/itanium/manuals.htm
+
+
+----------------
+Local variables:
+mode: text
+fill-column: 76
+End:
diff --git a/gmp/mpn/ia64/add_n_sub_n.asm b/gmp/mpn/ia64/add_n_sub_n.asm
deleted file mode 100644
index 34a506568f..0000000000
--- a/gmp/mpn/ia64/add_n_sub_n.asm
+++ /dev/null
@@ -1,309 +0,0 @@
-dnl IA-64 mpn_add_n_sub_n -- mpn parallel addition and subtraction.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.25
-
-C INPUT PARAMETERS
-define(`sp', `r32')
-define(`dp', `r33')
-define(`up', `r34')
-define(`vp', `r35')
-define(`n', `r36')
-
-C Some useful aliases for registers we use
-define(`u0',`r16') define(`u1',`r17') define(`u2',`r18') define(`u3',`r19')
-define(`v0',`r20') define(`v1',`r21') define(`v2',`r22') define(`v3',`r23')
-define(`s0',`r24') define(`s1',`r25') define(`s2',`r26') define(`s3',`r27')
-define(`d0',`r28') define(`d1',`r29') define(`d2',`r30') define(`d3',`r31')
-define(`up0',`up')
-define(`up1',`r14')
-define(`vp0',`vp')
-define(`vp1',`r15')
-
-define(`cmpltu', `cmp.ltu')
-define(`cmpeqor', `cmp.eq.or')
-
-ASM_START()
-PROLOGUE(mpn_add_n_sub_n)
- .prologue
- .save ar.lc, r2
- .body
-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
- ;;
-')
-
- and r9 = 3, n C M I
- mov.i r2 = ar.lc C I0
- add up1 = 8, up0 C M I
- add vp1 = 8, vp0 C M I
- add r8 = -2, n C M I
- add r10 = 256, up C M I
- ;;
- shr.u r8 = r8, 2 C I0
- cmp.eq p10, p0 = 0, r9 C M I
- cmp.eq p11, p0 = 2, r9 C M I
- cmp.eq p12, p0 = 3, r9 C M I
- add r11 = 256, vp C M I
- ;;
- mov.i ar.lc = r8 C I0
- (p10) br L(b0) C B
- (p11) br L(b2) C B
- (p12) br L(b3) C B
-
-L(b1): ld8 u3 = [up0], 8 C M01
- add up1 = 8, up1 C M I
- cmpltu p14, p15 = 4, n C M I
- ld8 v3 = [vp0], 8 C M01
- add vp1 = 8, vp1 C M I
- ;;
- add s3 = u3, v3 C M I
- sub d3 = u3, v3 C M I
- mov r8 = 0 C M I
- ;;
- cmpltu p9, p0 = s3, v3 C carry from add3 M I
- cmpltu p13, p0 = u3, v3 C borrow from sub3 M I
- (p15) br L(cj1) C B
- st8 [sp] = s3, 8 C M23
- st8 [dp] = d3, 8 C M23
- br L(c0) C B
-
-L(b0): cmp.ne p9, p0 = r0, r0 C M I
- cmp.ne p13, p0 = r0, r0 C M I
-L(c0): ld8 u0 = [up0], 16 C M01
- ld8 u1 = [up1], 16 C M01
- ;;
- ld8 v0 = [vp0], 16 C M01
- ld8 v1 = [vp1], 16 C M01
- ;;
- ld8 u2 = [up0], 16 C M01
- ld8 u3 = [up1], 16 C M01
- ;;
- ld8 v2 = [vp0], 16 C M01
- ld8 v3 = [vp1], 16 C M01
- ;;
- add s0 = u0, v0 C M I
- add s1 = u1, v1 C M I
- sub d0 = u0, v0 C M I
- sub d1 = u1, v1 C M I
- ;;
- cmpltu p6, p0 = s0, v0 C carry from add0 M I
- cmpltu p7, p0 = s1, v1 C carry from add1 M I
- cmpltu p10, p0 = u0, v0 C borrow from sub0 M I
- cmpltu p11, p0 = u1, v1 C borrow from sub1 M I
- ;;
- nop 0 C
- br.cloop.dptk L(top) C B
- br L(end) C B
-
-L(b3): ld8 u1 = [up0], 8 C M01
- add up1 = 8, up1 C M I
- ld8 v1 = [vp0], 8 C M01
- ;;
- add vp1 = 8, vp1 C M I
- add s1 = u1, v1 C M I
- sub d1 = u1, v1 C M I
- ;;
- cmpltu p7, p0 = s1, v1 C carry from add1 M I
- cmpltu p11, p0 = u1, v1 C borrow from sub1 M I
- ;;
- st8 [sp] = s1, 8 C M23
- st8 [dp] = d1, 8 C M23
- br L(c2) C B
-
- ALIGN(32)
-L(b2): cmp.ne p7, p0 = r0, r0 C M I
- cmp.ne p11, p0 = r0, r0 C M I
- nop 0
-L(c2): ld8 u2 = [up0], 16 C M01
- ld8 u3 = [up1], 16 C M01
- cmpltu p14, p0 = 4, n C M I
- ;;
- ld8 v2 = [vp0], 16 C M01
- ld8 v3 = [vp1], 16 C M01
- (p14) br L(gt4) C B
- ;;
- add s2 = u2, v2 C M I
- add s3 = u3, v3 C M I
- sub d2 = u2, v2 C M I
- sub d3 = u3, v3 C M I
- ;;
- cmpltu p8, p0 = s2, v2 C carry from add0 M I
- cmpltu p9, p0 = s3, v3 C carry from add3 M I
- cmpltu p12, p0 = u2, v2 C borrow from sub2 M I
- cmpltu p13, p0 = u3, v3 C borrow from sub3 M I
- br L(cj2) C B
- ;;
-L(gt4): ld8 u0 = [up0], 16 C M01
- ld8 u1 = [up1], 16 C M01
- ;;
- ld8 v0 = [vp0], 16 C M01
- ld8 v1 = [vp1], 16 C M01
- ;;
- add s2 = u2, v2 C M I
- add s3 = u3, v3 C M I
- sub d2 = u2, v2 C M I
- sub d3 = u3, v3 C M I
- ;;
- cmpltu p8, p0 = s2, v2 C carry from add0 M I
- cmpltu p9, p0 = s3, v3 C carry from add1 M I
- cmpltu p12, p0 = u2, v2 C borrow from sub0 M I
- cmpltu p13, p0 = u3, v3 C borrow from sub1 M I
- br.cloop.dptk L(mid) C B
-
- ALIGN(32)
-L(top):
- ld8 u0 = [up0], 16 C M01
- ld8 u1 = [up1], 16 C M01
- (p9) cmpeqor p6, p0 = -1, s0 C M I
- (p9) add s0 = 1, s0 C M I
- (p13) cmpeqor p10, p0 = 0, d0 C M I
- (p13) add d0 = -1, d0 C M I
- ;;
- ld8 v0 = [vp0], 16 C M01
- ld8 v1 = [vp1], 16 C M01
- (p6) cmpeqor p7, p0 = -1, s1 C M I
- (p6) add s1 = 1, s1 C M I
- (p10) cmpeqor p11, p0 = 0, d1 C M I
- (p10) add d1 = -1, d1 C M I
- ;;
- st8 [sp] = s0, 8 C M23
- st8 [dp] = d0, 8 C M23
- add s2 = u2, v2 C M I
- add s3 = u3, v3 C M I
- sub d2 = u2, v2 C M I
- sub d3 = u3, v3 C M I
- ;;
- st8 [sp] = s1, 8 C M23
- st8 [dp] = d1, 8 C M23
- cmpltu p8, p0 = s2, v2 C carry from add2 M I
- cmpltu p9, p0 = s3, v3 C carry from add3 M I
- cmpltu p12, p0 = u2, v2 C borrow from sub2 M I
- cmpltu p13, p0 = u3, v3 C borrow from sub3 M I
- ;;
-L(mid):
- ld8 u2 = [up0], 16 C M01
- ld8 u3 = [up1], 16 C M01
- (p7) cmpeqor p8, p0 = -1, s2 C M I
- (p7) add s2 = 1, s2 C M I
- (p11) cmpeqor p12, p0 = 0, d2 C M I
- (p11) add d2 = -1, d2 C M I
- ;;
- ld8 v2 = [vp0], 16 C M01
- ld8 v3 = [vp1], 16 C M01
- (p8) cmpeqor p9, p0 = -1, s3 C M I
- (p8) add s3 = 1, s3 C M I
- (p12) cmpeqor p13, p0 = 0, d3 C M I
- (p12) add d3 = -1, d3 C M I
- ;;
- st8 [sp] = s2, 8 C M23
- st8 [dp] = d2, 8 C M23
- add s0 = u0, v0 C M I
- add s1 = u1, v1 C M I
- sub d0 = u0, v0 C M I
- sub d1 = u1, v1 C M I
- ;;
- st8 [sp] = s3, 8 C M23
- st8 [dp] = d3, 8 C M23
- cmpltu p6, p0 = s0, v0 C carry from add0 M I
- cmpltu p7, p0 = s1, v1 C carry from add1 M I
- cmpltu p10, p0 = u0, v0 C borrow from sub0 M I
- cmpltu p11, p0 = u1, v1 C borrow from sub1 M I
- ;;
- lfetch [r10], 32 C M?
- lfetch [r11], 32 C M?
- br.cloop.dptk L(top) C B
- ;;
-
-L(end):
- nop 0
- nop 0
- (p9) cmpeqor p6, p0 = -1, s0 C M I
- (p9) add s0 = 1, s0 C M I
- (p13) cmpeqor p10, p0 = 0, d0 C M I
- (p13) add d0 = -1, d0 C M I
- ;;
- nop 0
- nop 0
- (p6) cmpeqor p7, p0 = -1, s1 C M I
- (p6) add s1 = 1, s1 C M I
- (p10) cmpeqor p11, p0 = 0, d1 C M I
- (p10) add d1 = -1, d1 C M I
- ;;
- st8 [sp] = s0, 8 C M23
- st8 [dp] = d0, 8 C M23
- add s2 = u2, v2 C M I
- add s3 = u3, v3 C M I
- sub d2 = u2, v2 C M I
- sub d3 = u3, v3 C M I
- ;;
- st8 [sp] = s1, 8 C M23
- st8 [dp] = d1, 8 C M23
- cmpltu p8, p0 = s2, v2 C carry from add2 M I
- cmpltu p9, p0 = s3, v3 C carry from add3 M I
- cmpltu p12, p0 = u2, v2 C borrow from sub2 M I
- cmpltu p13, p0 = u3, v3 C borrow from sub3 M I
- ;;
-L(cj2):
- (p7) cmpeqor p8, p0 = -1, s2 C M I
- (p7) add s2 = 1, s2 C M I
- (p11) cmpeqor p12, p0 = 0, d2 C M I
- (p11) add d2 = -1, d2 C M I
- mov r8 = 0 C M I
- nop 0
- ;;
- st8 [sp] = s2, 8 C M23
- st8 [dp] = d2, 8 C M23
- (p8) cmpeqor p9, p0 = -1, s3 C M I
- (p8) add s3 = 1, s3 C M I
- (p12) cmpeqor p13, p0 = 0, d3 C M I
- (p12) add d3 = -1, d3 C M I
- ;;
-L(cj1):
- (p9) mov r8 = 2 C M I
- ;;
- mov.i ar.lc = r2 C I0
- (p13) add r8 = 1, r8 C M I
- st8 [sp] = s3 C M23
- st8 [dp] = d3 C M23
- br.ret.sptk.many b0 C B
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/ia64/addmul_1.asm b/gmp/mpn/ia64/addmul_1.asm
index ffa3297763..6cd9d2b755 100644
--- a/gmp/mpn/ia64/addmul_1.asm
+++ b/gmp/mpn/ia64/addmul_1.asm
@@ -1,35 +1,23 @@
dnl IA-64 mpn_addmul_1 -- Multiply a limb vector with a limb and add the
dnl result to a second limb vector.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2000-2005, 2007 Free Software Foundation, Inc.
+dnl Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2007 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/ia64/addmul_2.asm b/gmp/mpn/ia64/addmul_2.asm
index f5bc46b75d..2c258022ae 100644
--- a/gmp/mpn/ia64/addmul_2.asm
+++ b/gmp/mpn/ia64/addmul_2.asm
@@ -1,35 +1,22 @@
dnl IA-64 mpn_addmul_2 -- Multiply a n-limb number with a 2-limb number and
dnl add the result to a (n+1)-limb number.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2004, 2005, 2011 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -37,11 +24,16 @@ C cycles/limb
C Itanium: 3.65
C Itanium 2: 1.625
+C Note that this is very similar to mul_2.asm. If you change this file,
+C please change that file too.
+
C TODO
C * Clean up variable names, and try to decrease the number of distinct
C registers used.
-C * Clean up feed-in code to not require zeroing several registers.
-C * Make sure we don't depend on uninitialised predicate registers.
+C * Cleanup feed-in code to not require zeroing several registers.
+C * Make sure we don't depend on uninitialized predicate registers.
+C * We currently cross-jump very aggressively, at the expense of a few cycles
+C per operation. Consider changing that.
C * Could perhaps save a few cycles by using 1 c/l carry propagation in
C wind-down code.
C * Ultimately rewrite. The problem with this code is that it first uses a
@@ -102,607 +94,564 @@ define(`ry',`f50')
define(`uy',`f51')
ASM_START()
-PROLOGUE(mpn_addmul_2s)
- .prologue
- .save ar.lc, r2
- .body
-
-ifdef(`HAVE_ABI_32',`
-.mmi; addp4 rp = 0, rp C M I
- addp4 up = 0, up C M I
- addp4 vp = 0, vp C M I
-.mmi; nop 1
- nop 1
- zxt4 n = n C I
- ;;')
-
-.mmi; ldf8 ux = [up], 8 C M
- ldf8 v0 = [vp], 8 C M
- mov r2 = ar.lc C I0
-.mmi; ldf8 rx = [rp], 8 C M
- and r14 = 3, n C M I
- add n = -2, n C M I
- ;;
-.mmi; ldf8 uy = [up], 8 C M
- ldf8 v1 = [vp] C M
- shr.u n = n, 2 C I0
-.mmi; ldf8 ry = [rp], -8 C M
- cmp.eq p14, p0 = 1, r14 C M I
- cmp.eq p11, p0 = 2, r14 C M I
- ;;
-.mmi; add srp = 16, rp C M I
- cmp.eq p15, p0 = 3, r14 C M I
- mov ar.lc = n C I0
-.bbb; (p14) br.dptk L(x01) C B
- (p11) br.dptk L(x10) C B
- (p15) br.dptk L(x11) C B
- ;;
-
-L(x00): cmp.ne p6, p0 = r0, r0 C suppress initial xma pair
- mov fp2a_3 = f0
- br L(b00)
-L(x01): cmp.ne p14, p0 = r0, r0 C suppress initial xma pair
- mov fp2a_2 = f0
- br L(b01)
-L(x10): cmp.ne p11, p0 = r0, r0 C suppress initial xma pair
- mov fp2a_1 = f0
- br L(b10)
-L(x11): cmp.ne p15, p0 = r0, r0 C suppress initial xma pair
- mov fp2a_0 = f0
- br L(b11)
-
-EPILOGUE()
-
PROLOGUE(mpn_addmul_2)
.prologue
.save ar.lc, r2
.body
-ifdef(`HAVE_ABI_32',`
-.mmi; addp4 rp = 0, rp C M I
- addp4 up = 0, up C M I
- addp4 vp = 0, vp C M I
-.mmi; nop 1
- nop 1
- zxt4 n = n C I
+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; ldf8 ux = [up], 8 C M
- ldf8 v0 = [vp], 8 C M
- mov r2 = ar.lc C I0
-.mmi; ldf8 rx = [rp], 8 C M
- and r14 = 3, n C M I
- add n = -2, n C M I
- ;;
-.mmi; ldf8 uy = [up], 8 C M
- ldf8 v1 = [vp] C M
- shr.u n = n, 2 C I0
-.mmi; ldf8 ry = [rp], -8 C M
- cmp.eq p14, p0 = 1, r14 C M I
- cmp.eq p11, p0 = 2, r14 C M I
- ;;
-.mmi; add srp = 16, rp C M I
- cmp.eq p15, p6 = 3, r14 C M I
- mov ar.lc = n C I0
-.bbb; (p14) br.dptk L(b01) C B
- (p11) br.dptk L(b10) C B
- (p15) br.dptk L(b11) C B
- ;;
+{.mmi C 00
+ ldf8 ux = [up], 8 C M
+ ldf8 v0 = [vp], 8 C M
+ mov.i r2 = ar.lc C I0
+}{.mmi
+ ldf8 rx = [rp], 8 C M
+ and r14 = 3, n C M I
+ add n = -2, n C M I
+ ;;
+}{.mmi C 01
+ ldf8 uy = [up], 8 C M
+ ldf8 v1 = [vp] C M
+ shr.u n = n, 2 C I0
+}{.mmi
+ ldf8 ry = [rp], -8 C M
+ cmp.eq p10, p0 = 1, r14 C M I
+ cmp.eq p11, p0 = 2, r14 C M I
+ ;;
+}{.mmi C 02
+ add srp = 16, rp C M I
+ cmp.eq p12, p0 = 3, r14 C M I
+ mov.i ar.lc = n C I0
+}{.bbb
+ (p10) br.dptk .Lb01 C B
+ (p11) br.dptk .Lb10 C B
+ (p12) br.dptk .Lb11 C B
+ ;;
+}
ALIGN(32)
-L(b00):
-.mmi; ldf8 r_1 = [srp], 8
- ldf8 u_1 = [up], 8
- mov acc1_2 = 0
-.mmi; mov pr1_2 = 0
- mov pr0_3 = 0
- cmp.ne p8, p9 = r0, r0
- ;;
-.mfi; ldf8 r_2 = [srp], 8
- xma.l fp0b_3 = ux, v0, rx
- cmp.ne p12, p13 = r0, r0
-.mfb; ldf8 u_2 = [up], 8
- xma.hu fp1b_3 = ux, v0, rx
- br.cloop.dptk L(gt4)
-
- xma.l fp0b_0 = uy, v0, ry
- xma.hu fp1a_0 = uy, v0, ry
- ;;
- getfsig acc0 = fp0b_3
- (p6) xma.hu fp2a_3 = ux, v1, fp1b_3 C suppressed for addmul_2s
- (p6) xma.l fp1b_3 = ux, v1, fp1b_3 C suppressed for addmul_2s
- ;;
- xma.l fp0b_1 = u_1, v0, r_1
- xma.hu fp1a_1 = u_1, v0, r_1
- ;;
- getfsig pr0_0 = fp0b_0
- xma.l fp1b_0 = uy, v1, fp1a_0
- xma.hu fp2a_0 = uy, v1, fp1a_0
- ;;
- getfsig pr1_3 = fp1b_3
- getfsig acc1_3 = fp2a_3
- xma.l fp0b_2 = u_2, v0, r_2
- xma.hu fp1a_2 = u_2, v0, r_2
- br L(cj4)
-
-L(gt4): xma.l fp0b_0 = uy, v0, ry
- xma.hu fp1a_0 = uy, v0, ry
- ;;
- ldf8 r_3 = [srp], 8
- getfsig acc0 = fp0b_3
- (p6) xma.hu fp2a_3 = ux, v1, fp1b_3 C suppressed for addmul_2s
- ldf8 u_3 = [up], 8
- (p6) xma.l fp1b_3 = ux, v1, fp1b_3 C suppressed for addmul_2s
- ;;
- xma.l fp0b_1 = u_1, v0, r_1
- xma.hu fp1a_1 = u_1, v0, r_1
- ;;
- ldf8 r_0 = [srp], 8
- getfsig pr0_0 = fp0b_0
- xma.l fp1b_0 = uy, v1, fp1a_0
- xma.hu fp2a_0 = uy, v1, fp1a_0
- ;;
- ldf8 u_0 = [up], 8
- getfsig pr1_3 = fp1b_3
- xma.l fp0b_2 = u_2, v0, r_2
- ;;
- getfsig acc1_3 = fp2a_3
- xma.hu fp1a_2 = u_2, v0, r_2
- br L(00)
+.Lb00: ldf8 r_1 = [srp], 8
+ ldf8 u_1 = [up], 8
+ mov acc1_2 = 0
+ mov pr1_2 = 0
+ mov pr0_3 = 0
+ cmp.ne p8, p9 = r0, r0
+ ;;
+ ldf8 r_2 = [srp], 8
+ xma.l fp0b_3 = ux, v0, rx
+ cmp.ne p12, p13 = r0, r0
+ ldf8 u_2 = [up], 8
+ xma.hu fp1a_3 = ux, v0, rx
+ br.cloop.dptk .grt4
+
+ xma.l fp0b_0 = uy, v0, ry
+ xma.hu fp1a_0 = uy, v0, ry
+ ;;
+ getf.sig acc0 = fp0b_3
+ xma.l fp1b_3 = ux, v1, fp1a_3
+ xma.hu fp2a_3 = ux, v1, fp1a_3
+ ;;
+ xma.l fp0b_1 = u_1, v0, r_1
+ xma.hu fp1a_1 = u_1, v0, r_1
+ ;;
+ getf.sig pr0_0 = fp0b_0
+ xma.l fp1b_0 = uy, v1, fp1a_0
+ xma.hu fp2a_0 = uy, v1, fp1a_0
+ ;;
+ getf.sig pr1_3 = fp1b_3
+ getf.sig acc1_3 = fp2a_3
+ xma.l fp0b_2 = u_2, v0, r_2
+ xma.hu fp1a_2 = u_2, v0, r_2
+ br .Lcj4
+
+.grt4: xma.l fp0b_0 = uy, v0, ry
+ xma.hu fp1a_0 = uy, v0, ry
+ ;;
+ ldf8 r_3 = [srp], 8
+ getf.sig acc0 = fp0b_3
+ xma.l fp1b_3 = ux, v1, fp1a_3
+ ldf8 u_3 = [up], 8
+ xma.hu fp2a_3 = ux, v1, fp1a_3
+ ;;
+ xma.l fp0b_1 = u_1, v0, r_1
+ xma.hu fp1a_1 = u_1, v0, r_1
+ ;;
+ ldf8 r_0 = [srp], 8
+ getf.sig pr0_0 = fp0b_0
+ xma.l fp1b_0 = uy, v1, fp1a_0
+ xma.hu fp2a_0 = uy, v1, fp1a_0
+ ;;
+ ldf8 u_0 = [up], 8
+ getf.sig pr1_3 = fp1b_3
+ ;;
+ getf.sig acc1_3 = fp2a_3
+ xma.l fp0b_2 = u_2, v0, r_2
+ xma.hu fp1a_2 = u_2, v0, r_2
+ br .LL00
ALIGN(32)
-L(b01):
-.mmi; ldf8 r_0 = [srp], 8 C M
- ldf8 u_0 = [up], 8 C M
- mov acc1_1 = 0 C M I
-.mmi; mov pr1_1 = 0 C M I
- mov pr0_2 = 0 C M I
- cmp.ne p6, p7 = r0, r0 C M I
- ;;
-.mfi; ldf8 r_1 = [srp], 8 C M
- xma.l fp0b_2 = ux, v0, rx C F
- cmp.ne p10, p11 = r0, r0 C M I
-.mfi; ldf8 u_1 = [up], 8 C M
- xma.hu fp1b_2 = ux, v0, rx C F
- nop 1
- ;;
- xma.l fp0b_3 = uy, v0, ry C F
- xma.hu fp1a_3 = uy, v0, ry C F
- ;;
-.mmf; getfsig acc0 = fp0b_2 C M
- ldf8 r_2 = [srp], 8 C M
- (p14) xma.hu fp2a_2 = ux, v1,fp1b_2 C F suppressed for addmul_2s
-.mfb; ldf8 u_2 = [up], 8 C M
- (p14) xma.l fp1b_2 = ux, v1,fp1b_2 C F suppressed for addmul_2s
- br.cloop.dptk L(gt5)
-
- xma.l fp0b_0 = u_0, v0, r_0 C F
- xma.hu fp1a_0 = u_0, v0, r_0 C F
- ;;
- getfsig pr0_3 = fp0b_3 C M
- xma.l fp1b_3 = uy, v1,fp1a_3 C F
- xma.hu fp2a_3 = uy, v1,fp1a_3 C F
- ;;
- getfsig pr1_2 = fp1b_2 C M
- getfsig acc1_2 = fp2a_2 C M
- xma.l fp0b_1 = u_1, v0, r_1 C F
- xma.hu fp1a_1 = u_1, v0, r_1 C F
- br L(cj5)
-
-L(gt5): xma.l fp0b_0 = u_0, v0, r_0
- xma.hu fp1a_0 = u_0, v0, r_0
- ;;
- getfsig pr0_3 = fp0b_3
- ldf8 r_3 = [srp], 8
- xma.l fp1b_3 = uy, v1, fp1a_3
- xma.hu fp2a_3 = uy, v1, fp1a_3
- ;;
- ldf8 u_3 = [up], 8
- getfsig pr1_2 = fp1b_2
- xma.l fp0b_1 = u_1, v0, r_1
- ;;
- getfsig acc1_2 = fp2a_2
- xma.hu fp1a_1 = u_1, v0, r_1
- br L(01)
+.Lb01: ldf8 r_0 = [srp], 8 C M
+ ldf8 u_0 = [up], 8 C M
+ mov acc1_1 = 0 C M I
+ mov pr1_1 = 0 C M I
+ mov pr0_2 = 0 C M I
+ cmp.ne p6, p7 = r0, r0 C M I
+ ;;
+ ldf8 r_1 = [srp], 8 C M
+ xma.l fp0b_2 = ux, v0, rx C F
+ cmp.ne p10, p11 = r0, r0 C M I
+ ldf8 u_1 = [up], 8 C M
+ xma.hu fp1a_2 = ux, v0, rx C F
+ ;;
+ xma.l fp0b_3 = uy, v0, ry C F
+ xma.hu fp1a_3 = uy, v0, ry C F
+ ;;
+ getf.sig acc0 = fp0b_2 C M
+ ldf8 r_2 = [srp], 8 C M
+ xma.l fp1b_2 = ux, v1,fp1a_2 C F
+ xma.hu fp2a_2 = ux, v1,fp1a_2 C F
+ ldf8 u_2 = [up], 8 C M
+ br.cloop.dptk .grt5
+
+ xma.l fp0b_0 = u_0, v0, r_0 C F
+ xma.hu fp1a_0 = u_0, v0, r_0 C F
+ ;;
+ getf.sig pr0_3 = fp0b_3 C M
+ xma.l fp1b_3 = uy, v1,fp1a_3 C F
+ xma.hu fp2a_3 = uy, v1,fp1a_3 C F
+ ;;
+ getf.sig pr1_2 = fp1b_2 C M
+ getf.sig acc1_2 = fp2a_2 C M
+ xma.l fp0b_1 = u_1, v0, r_1 C F
+ xma.hu fp1a_1 = u_1, v0, r_1 C F
+ br .Lcj5
+
+.grt5: xma.l fp0b_0 = u_0, v0, r_0
+ xma.hu fp1a_0 = u_0, v0, r_0
+ ;;
+ getf.sig pr0_3 = fp0b_3
+ ldf8 r_3 = [srp], 8
+ xma.l fp1b_3 = uy, v1, fp1a_3
+ xma.hu fp2a_3 = uy, v1, fp1a_3
+ ;;
+ ldf8 u_3 = [up], 8
+ getf.sig pr1_2 = fp1b_2
+ ;;
+ getf.sig acc1_2 = fp2a_2
+ xma.l fp0b_1 = u_1, v0, r_1
+ xma.hu fp1a_1 = u_1, v0, r_1
+ br .LL01
ALIGN(32)
-L(b10): br.cloop.dptk L(gt2)
- xma.l fp0b_1 = ux, v0, rx
- xma.hu fp1b_1 = ux, v0, rx
- ;;
- xma.l fp0b_2 = uy, v0, ry
- xma.hu fp1a_2 = uy, v0, ry
- ;;
- stf8 [rp] = fp0b_1, 8
- (p11) xma.hu fp2a_1 = ux, v1, fp1b_1 C suppressed for addmul_2s
- (p11) xma.l fp1b_1 = ux, v1, fp1b_1 C suppressed for addmul_2s
- ;;
- getfsig acc0 = fp0b_2
- xma.l fp1b_2 = uy, v1, fp1a_2
- xma.hu fp2a_2 = uy, v1, fp1a_2
- ;;
- getfsig pr1_1 = fp1b_1
- getfsig acc1_1 = fp2a_1
- mov ar.lc = r2
- getfsig pr1_2 = fp1b_2
- getfsig r8 = fp2a_2
- ;;
- add s0 = pr1_1, acc0
- ;;
- st8 [rp] = s0, 8
- cmp.ltu p8, p9 = s0, pr1_1
- sub r31 = -1, acc1_1
- ;;
- .pred.rel "mutex", p8, p9
- (p8) add acc0 = pr1_2, acc1_1, 1
- (p9) add acc0 = pr1_2, acc1_1
- (p8) cmp.leu p10, p0 = r31, pr1_2
- (p9) cmp.ltu p10, p0 = r31, pr1_2
- ;;
- st8 [rp] = acc0, 8
- (p10) add r8 = 1, r8
- br.ret.sptk.many b0
-
-
-L(gt2):
-.mmi; ldf8 r_3 = [srp], 8
- ldf8 u_3 = [up], 8
- mov acc1_0 = 0
- ;;
-.mfi; ldf8 r_0 = [srp], 8
- xma.l fp0b_1 = ux, v0, rx
- mov pr1_0 = 0
-.mfi; ldf8 u_0 = [up], 8
- xma.hu fp1b_1 = ux, v0, rx
- mov pr0_1 = 0
- ;;
- xma.l fp0b_2 = uy, v0, ry
- xma.hu fp1a_2 = uy, v0, ry
- ;;
- getfsig acc0 = fp0b_1
- ldf8 r_1 = [srp], 8
- (p11) xma.hu fp2a_1 = ux, v1, fp1b_1 C suppressed for addmul_2s
- (p11) xma.l fp1b_1 = ux, v1, fp1b_1 C suppressed for addmul_2s
- ;;
- ldf8 u_1 = [up], 8
- xma.l fp0b_3 = u_3, v0, r_3
- xma.hu fp1a_3 = u_3, v0, r_3
- ;;
- getfsig pr0_2 = fp0b_2
- ldf8 r_2 = [srp], 8
- xma.l fp1b_2 = uy, v1, fp1a_2
- xma.hu fp2a_2 = uy, v1, fp1a_2
- ;;
- ldf8 u_2 = [up], 8
- getfsig pr1_1 = fp1b_1
- ;;
-.mfi; getfsig acc1_1 = fp2a_1
- xma.l fp0b_0 = u_0, v0, r_0
- cmp.ne p8, p9 = r0, r0
-.mfb; cmp.ne p12, p13 = r0, r0
- xma.hu fp1a_0 = u_0, v0, r_0
- br.cloop.sptk.clr L(top)
- br.many L(end)
+.Lb10: C 03
+ br.cloop.dptk .grt2
+ C 04
+ C 05
+ C 06
+ xma.l fp0b_1 = ux, v0, rx
+ xma.hu fp1a_1 = ux, v0, rx
+ ;; C 07
+ xma.l fp0b_2 = uy, v0, ry
+ xma.hu fp1a_2 = uy, v0, ry
+ ;; C 08
+ C 09
+ C 10
+ stf8 [rp] = fp0b_1, 8
+ xma.l fp1b_1 = ux, v1, fp1a_1
+ xma.hu fp2a_1 = ux, v1, fp1a_1
+ ;; C 11
+ getf.sig acc0 = fp0b_2
+ xma.l fp1b_2 = uy, v1, fp1a_2
+ xma.hu fp2a_2 = uy, v1, fp1a_2
+ ;; C 12
+ C 13
+ C 14
+ getf.sig pr1_1 = fp1b_1
+ C 15
+ getf.sig acc1_1 = fp2a_1
+ C 16
+ getf.sig pr1_2 = fp1b_2
+ C 17
+ getf.sig r8 = fp2a_2
+ ;; C 18
+ C 19
+ add s0 = pr1_1, acc0
+ ;; C 20
+ st8 [rp] = s0, 8
+ cmp.ltu p8, p9 = s0, pr1_1
+ sub r31 = -1, acc1_1
+ ;; C 21
+ .pred.rel "mutex", p8, p9
+ (p8) add acc0 = pr1_2, acc1_1, 1
+ (p9) add acc0 = pr1_2, acc1_1
+ (p8) cmp.leu p10, p0 = r31, pr1_2
+ (p9) cmp.ltu p10, p0 = r31, pr1_2
+ ;; C 22
+ st8 [rp] = acc0, 8
+ mov.i ar.lc = r2
+ (p10) add r8 = 1, r8
+ br.ret.sptk.many b0
+
+
+.grt2: ldf8 r_3 = [srp], 8
+ ldf8 u_3 = [up], 8
+ mov acc1_0 = 0
+ ;;
+ ldf8 r_0 = [srp], 8
+ xma.l fp0b_1 = ux, v0, rx
+ mov pr1_0 = 0
+ ldf8 u_0 = [up], 8
+ xma.hu fp1a_1 = ux, v0, rx
+ mov pr0_1 = 0
+ ;;
+ xma.l fp0b_2 = uy, v0, ry
+ xma.hu fp1a_2 = uy, v0, ry
+ ;;
+ getf.sig acc0 = fp0b_1
+ ldf8 r_1 = [srp], 8
+ xma.l fp1b_1 = ux, v1, fp1a_1
+ xma.hu fp2a_1 = ux, v1, fp1a_1
+ ;;
+ ldf8 u_1 = [up], 8
+ xma.l fp0b_3 = u_3, v0, r_3
+ xma.hu fp1a_3 = u_3, v0, r_3
+ ;;
+ getf.sig pr0_2 = fp0b_2
+ ldf8 r_2 = [srp], 8
+ xma.l fp1b_2 = uy, v1, fp1a_2
+ xma.hu fp2a_2 = uy, v1, fp1a_2
+ ;;
+ ldf8 u_2 = [up], 8
+ getf.sig pr1_1 = fp1b_1
+ ;;
+ getf.sig acc1_1 = fp2a_1
+ xma.l fp0b_0 = u_0, v0, r_0
+ cmp.ne p8, p9 = r0, r0
+ cmp.ne p12, p13 = r0, r0
+ xma.hu fp1a_0 = u_0, v0, r_0
+ br .LL10
ALIGN(32)
-L(b11): ldf8 r_2 = [srp], 8
- mov pr1_3 = 0
- mov pr0_0 = 0
+.Lb11: mov acc1_3 = 0
+ mov pr1_3 = 0
+ mov pr0_0 = 0
+ cmp.ne p6, p7 = r0, r0
;;
- ldf8 u_2 = [up], 8
- mov acc1_3 = 0
- br.cloop.dptk L(gt3)
+ ldf8 r_2 = [srp], 8
+ ldf8 u_2 = [up], 8
+ br.cloop.dptk .grt3
;;
- cmp.ne p6, p7 = r0, r0
- xma.l fp0b_0 = ux, v0, rx
- xma.hu fp1b_0 = ux, v0, rx
+ xma.l fp0b_0 = ux, v0, rx
+ xma.hu fp1a_0 = ux, v0, rx
;;
- cmp.ne p10, p11 = r0, r0
- xma.l fp0b_1 = uy, v0, ry
- xma.hu fp1a_1 = uy, v0, ry
+ cmp.ne p10, p11 = r0, r0
+ xma.l fp0b_1 = uy, v0, ry
+ xma.hu fp1a_1 = uy, v0, ry
;;
- getfsig acc0 = fp0b_0
- (p15) xma.hu fp2a_0 = ux, v1, fp1b_0 C suppressed for addmul_2s
- (p15) xma.l fp1b_0 = ux, v1, fp1b_0 C suppressed for addmul_2s
+ getf.sig acc0 = fp0b_0
+ xma.l fp1b_0 = ux, v1, fp1a_0
+ xma.hu fp2a_0 = ux, v1, fp1a_0
;;
- xma.l fp0b_2 = uy, v1, r_2
- xma.hu fp1a_2 = uy, v1, r_2
+ xma.l fp0b_2 = u_2, v0, r_2
+ xma.hu fp1a_2 = u_2, v0, r_2
;;
- getfsig pr0_1 = fp0b_1
- xma.l fp1b_1 = u_2, v0, fp1a_1
- xma.hu fp2a_1 = u_2, v0, fp1a_1
+ getf.sig pr0_1 = fp0b_1
+ xma.l fp1b_1 = uy, v1, fp1a_1
+ xma.hu fp2a_1 = uy, v1, fp1a_1
;;
- getfsig pr1_0 = fp1b_0
- getfsig acc1_0 = fp2a_0
- br L(cj3)
+ getf.sig pr1_0 = fp1b_0
+ getf.sig acc1_0 = fp2a_0
+ br .Lcj3
-L(gt3): ldf8 r_3 = [srp], 8
- xma.l fp0b_0 = ux, v0, rx
- cmp.ne p10, p11 = r0, r0
- ldf8 u_3 = [up], 8
- xma.hu fp1b_0 = ux, v0, rx
- cmp.ne p6, p7 = r0, r0
+.grt3: ldf8 r_3 = [srp], 8
+ xma.l fp0b_0 = ux, v0, rx
+ cmp.ne p10, p11 = r0, r0
+ ldf8 u_3 = [up], 8
+ xma.hu fp1a_0 = ux, v0, rx
;;
- xma.l fp0b_1 = uy, v0, ry
- xma.hu fp1a_1 = uy, v0, ry
+ xma.l fp0b_1 = uy, v0, ry
+ xma.hu fp1a_1 = uy, v0, ry
;;
- getfsig acc0 = fp0b_0
- ldf8 r_0 = [srp], 8
- (p15) xma.hu fp2a_0 = ux, v1, fp1b_0 C suppressed for addmul_2s
- ldf8 u_0 = [up], 8
- (p15) xma.l fp1b_0 = ux, v1, fp1b_0 C suppressed for addmul_2s
+ getf.sig acc0 = fp0b_0
+ ldf8 r_0 = [srp], 8
+ xma.l fp1b_0 = ux, v1, fp1a_0
+ ldf8 u_0 = [up], 8
+ xma.hu fp2a_0 = ux, v1, fp1a_0
;;
- xma.l fp0b_2 = u_2, v0, r_2
- xma.hu fp1a_2 = u_2, v0, r_2
+ xma.l fp0b_2 = u_2, v0, r_2
+ xma.hu fp1a_2 = u_2, v0, r_2
;;
- getfsig pr0_1 = fp0b_1
- ldf8 r_1 = [srp], 8
- xma.l fp1b_1 = uy, v1, fp1a_1
- xma.hu fp2a_1 = uy, v1, fp1a_1
+ getf.sig pr0_1 = fp0b_1
+ ldf8 r_1 = [srp], 8
+ xma.l fp1b_1 = uy, v1, fp1a_1
+ xma.hu fp2a_1 = uy, v1, fp1a_1
;;
- ldf8 u_1 = [up], 8
- getfsig pr1_0 = fp1b_0
+ ldf8 u_1 = [up], 8
+ getf.sig pr1_0 = fp1b_0
;;
- getfsig acc1_0 = fp2a_0
- xma.l fp0b_3 = u_3, v0, r_3
- xma.hu fp1a_3 = u_3, v0, r_3
- br L(11)
+ getf.sig acc1_0 = fp2a_0
+ xma.l fp0b_3 = u_3, v0, r_3
+ xma.hu fp1a_3 = u_3, v0, r_3
+ br .LL11
C *** MAIN LOOP START ***
ALIGN(32)
-L(top): C 00
- .pred.rel "mutex", p12, p13
- getfsig pr0_3 = fp0b_3
- ldf8 r_3 = [srp], 8
- xma.l fp1b_3 = u_3, v1, fp1a_3
- (p12) add s0 = pr1_0, acc0, 1
- (p13) add s0 = pr1_0, acc0
- xma.hu fp2a_3 = u_3, v1, fp1a_3
+.Loop: C 00
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_3 = fp0b_3
+ ldf8 r_3 = [srp], 8
+ xma.l fp1b_3 = u_3, v1, fp1a_3
+ (p12) add s0 = pr1_0, acc0, 1
+ (p13) add s0 = pr1_0, acc0
+ xma.hu fp2a_3 = u_3, v1, fp1a_3
;; C 01
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
- ldf8 u_3 = [up], 8
- getfsig pr1_2 = fp1b_2
- (p8) cmp.leu p6, p7 = acc0, pr0_1
- (p9) cmp.ltu p6, p7 = acc0, pr0_1
- (p12) cmp.leu p10, p11 = s0, pr1_0
- (p13) cmp.ltu p10, p11 = s0, pr1_0
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ ldf8 u_3 = [up], 8
+ getf.sig pr1_2 = fp1b_2
+ (p8) cmp.leu p6, p7 = acc0, pr0_1
+ (p9) cmp.ltu p6, p7 = acc0, pr0_1
+ (p12) cmp.leu p10, p11 = s0, pr1_0
+ (p13) cmp.ltu p10, p11 = s0, pr1_0
;; C 02
- .pred.rel "mutex", p6, p7
- getfsig acc1_2 = fp2a_2
- st8 [rp] = s0, 8
- xma.l fp0b_1 = u_1, v0, r_1
- (p6) add acc0 = pr0_2, acc1_0, 1
- (p7) add acc0 = pr0_2, acc1_0
- xma.hu fp1a_1 = u_1, v0, r_1
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_2 = fp2a_2
+ st8 [rp] = s0, 8
+ xma.l fp0b_1 = u_1, v0, r_1
+ (p6) add acc0 = pr0_2, acc1_0, 1
+ (p7) add acc0 = pr0_2, acc1_0
+ xma.hu fp1a_1 = u_1, v0, r_1
;; C 03
-L(01):
- .pred.rel "mutex", p10, p11
- getfsig pr0_0 = fp0b_0
- ldf8 r_0 = [srp], 8
- xma.l fp1b_0 = u_0, v1, fp1a_0
- (p10) add s0 = pr1_1, acc0, 1
- (p11) add s0 = pr1_1, acc0
- xma.hu fp2a_0 = u_0, v1, fp1a_0
+.LL01:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_0 = fp0b_0
+ ldf8 r_0 = [srp], 8
+ xma.l fp1b_0 = u_0, v1, fp1a_0
+ (p10) add s0 = pr1_1, acc0, 1
+ (p11) add s0 = pr1_1, acc0
+ xma.hu fp2a_0 = u_0, v1, fp1a_0
;; C 04
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
- ldf8 u_0 = [up], 8
- getfsig pr1_3 = fp1b_3
- (p6) cmp.leu p8, p9 = acc0, pr0_2
- (p7) cmp.ltu p8, p9 = acc0, pr0_2
- (p10) cmp.leu p12, p13 = s0, pr1_1
- (p11) cmp.ltu p12, p13 = s0, pr1_1
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ ldf8 u_0 = [up], 8
+ getf.sig pr1_3 = fp1b_3
+ (p6) cmp.leu p8, p9 = acc0, pr0_2
+ (p7) cmp.ltu p8, p9 = acc0, pr0_2
+ (p10) cmp.leu p12, p13 = s0, pr1_1
+ (p11) cmp.ltu p12, p13 = s0, pr1_1
;; C 05
- .pred.rel "mutex", p8, p9
- getfsig acc1_3 = fp2a_3
- st8 [rp] = s0, 8
- xma.l fp0b_2 = u_2, v0, r_2
- (p8) add acc0 = pr0_3, acc1_1, 1
- (p9) add acc0 = pr0_3, acc1_1
- xma.hu fp1a_2 = u_2, v0, r_2
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_3 = fp2a_3
+ st8 [rp] = s0, 8
+ xma.l fp0b_2 = u_2, v0, r_2
+ (p8) add acc0 = pr0_3, acc1_1, 1
+ (p9) add acc0 = pr0_3, acc1_1
+ xma.hu fp1a_2 = u_2, v0, r_2
;; C 06
-L(00):
- .pred.rel "mutex", p12, p13
- getfsig pr0_1 = fp0b_1
- ldf8 r_1 = [srp], 8
- xma.l fp1b_1 = u_1, v1, fp1a_1
- (p12) add s0 = pr1_2, acc0, 1
- (p13) add s0 = pr1_2, acc0
- xma.hu fp2a_1 = u_1, v1, fp1a_1
+.LL00:
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_1 = fp0b_1
+ ldf8 r_1 = [srp], 8
+ xma.l fp1b_1 = u_1, v1, fp1a_1
+ (p12) add s0 = pr1_2, acc0, 1
+ (p13) add s0 = pr1_2, acc0
+ xma.hu fp2a_1 = u_1, v1, fp1a_1
;; C 07
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
- ldf8 u_1 = [up], 8
- getfsig pr1_0 = fp1b_0
- (p8) cmp.leu p6, p7 = acc0, pr0_3
- (p9) cmp.ltu p6, p7 = acc0, pr0_3
- (p12) cmp.leu p10, p11 = s0, pr1_2
- (p13) cmp.ltu p10, p11 = s0, pr1_2
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ ldf8 u_1 = [up], 8
+ getf.sig pr1_0 = fp1b_0
+ (p8) cmp.leu p6, p7 = acc0, pr0_3
+ (p9) cmp.ltu p6, p7 = acc0, pr0_3
+ (p12) cmp.leu p10, p11 = s0, pr1_2
+ (p13) cmp.ltu p10, p11 = s0, pr1_2
;; C 08
- .pred.rel "mutex", p6, p7
- getfsig acc1_0 = fp2a_0
- st8 [rp] = s0, 8
- xma.l fp0b_3 = u_3, v0, r_3
- (p6) add acc0 = pr0_0, acc1_2, 1
- (p7) add acc0 = pr0_0, acc1_2
- xma.hu fp1a_3 = u_3, v0, r_3
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_0 = fp2a_0
+ st8 [rp] = s0, 8
+ xma.l fp0b_3 = u_3, v0, r_3
+ (p6) add acc0 = pr0_0, acc1_2, 1
+ (p7) add acc0 = pr0_0, acc1_2
+ xma.hu fp1a_3 = u_3, v0, r_3
;; C 09
-L(11):
- .pred.rel "mutex", p10, p11
- getfsig pr0_2 = fp0b_2
- ldf8 r_2 = [srp], 8
- xma.l fp1b_2 = u_2, v1, fp1a_2
- (p10) add s0 = pr1_3, acc0, 1
- (p11) add s0 = pr1_3, acc0
- xma.hu fp2a_2 = u_2, v1, fp1a_2
+.LL11:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_2 = fp0b_2
+ ldf8 r_2 = [srp], 8
+ xma.l fp1b_2 = u_2, v1, fp1a_2
+ (p10) add s0 = pr1_3, acc0, 1
+ (p11) add s0 = pr1_3, acc0
+ xma.hu fp2a_2 = u_2, v1, fp1a_2
;; C 10
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
- ldf8 u_2 = [up], 8
- getfsig pr1_1 = fp1b_1
- (p6) cmp.leu p8, p9 = acc0, pr0_0
- (p7) cmp.ltu p8, p9 = acc0, pr0_0
- (p10) cmp.leu p12, p13 = s0, pr1_3
- (p11) cmp.ltu p12, p13 = s0, pr1_3
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ ldf8 u_2 = [up], 8
+ getf.sig pr1_1 = fp1b_1
+ (p6) cmp.leu p8, p9 = acc0, pr0_0
+ (p7) cmp.ltu p8, p9 = acc0, pr0_0
+ (p10) cmp.leu p12, p13 = s0, pr1_3
+ (p11) cmp.ltu p12, p13 = s0, pr1_3
;; C 11
- .pred.rel "mutex", p8, p9
- getfsig acc1_1 = fp2a_1
- st8 [rp] = s0, 8
- xma.l fp0b_0 = u_0, v0, r_0
- (p8) add acc0 = pr0_1, acc1_3, 1
- (p9) add acc0 = pr0_1, acc1_3
- xma.hu fp1a_0 = u_0, v0, r_0
-L(10): br.cloop.sptk.clr L(top) C 12
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_1 = fp2a_1
+ st8 [rp] = s0, 8
+ xma.l fp0b_0 = u_0, v0, r_0
+ (p8) add acc0 = pr0_1, acc1_3, 1
+ (p9) add acc0 = pr0_1, acc1_3
+ xma.hu fp1a_0 = u_0, v0, r_0
+.LL10: br.cloop.dptk .Loop C 12
;;
C *** MAIN LOOP END ***
-L(end):
- .pred.rel "mutex", p12, p13
-.mfi; getfsig pr0_3 = fp0b_3
- xma.l fp1b_3 = u_3, v1, fp1a_3
- (p12) add s0 = pr1_0, acc0, 1
-.mfi; (p13) add s0 = pr1_0, acc0
- xma.hu fp2a_3 = u_3, v1, fp1a_3
- nop 1
- ;;
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
-.mmi; getfsig pr1_2 = fp1b_2
- st8 [rp] = s0, 8
- (p8) cmp.leu p6, p7 = acc0, pr0_1
-.mmi; (p9) cmp.ltu p6, p7 = acc0, pr0_1
- (p12) cmp.leu p10, p11 = s0, pr1_0
- (p13) cmp.ltu p10, p11 = s0, pr1_0
- ;;
- .pred.rel "mutex", p6, p7
-.mfi; getfsig acc1_2 = fp2a_2
- xma.l fp0b_1 = u_1, v0, r_1
- nop 1
-.mmf; (p6) add acc0 = pr0_2, acc1_0, 1
- (p7) add acc0 = pr0_2, acc1_0
- xma.hu fp1a_1 = u_1, v0, r_1
- ;;
-L(cj5):
- .pred.rel "mutex", p10, p11
-.mfi; getfsig pr0_0 = fp0b_0
- xma.l fp1b_0 = u_0, v1, fp1a_0
- (p10) add s0 = pr1_1, acc0, 1
-.mfi; (p11) add s0 = pr1_1, acc0
- xma.hu fp2a_0 = u_0, v1, fp1a_0
- nop 1
- ;;
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
-.mmi; getfsig pr1_3 = fp1b_3
- st8 [rp] = s0, 8
- (p6) cmp.leu p8, p9 = acc0, pr0_2
-.mmi; (p7) cmp.ltu p8, p9 = acc0, pr0_2
- (p10) cmp.leu p12, p13 = s0, pr1_1
- (p11) cmp.ltu p12, p13 = s0, pr1_1
- ;;
- .pred.rel "mutex", p8, p9
-.mfi; getfsig acc1_3 = fp2a_3
- xma.l fp0b_2 = u_2, v0, r_2
- nop 1
-.mmf; (p8) add acc0 = pr0_3, acc1_1, 1
- (p9) add acc0 = pr0_3, acc1_1
- xma.hu fp1a_2 = u_2, v0, r_2
- ;;
-L(cj4):
- .pred.rel "mutex", p12, p13
-.mfi; getfsig pr0_1 = fp0b_1
- xma.l fp1b_1 = u_1, v1, fp1a_1
- (p12) add s0 = pr1_2, acc0, 1
-.mfi; (p13) add s0 = pr1_2, acc0
- xma.hu fp2a_1 = u_1, v1, fp1a_1
- nop 1
- ;;
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
-.mmi; getfsig pr1_0 = fp1b_0
- st8 [rp] = s0, 8
- (p8) cmp.leu p6, p7 = acc0, pr0_3
-.mmi; (p9) cmp.ltu p6, p7 = acc0, pr0_3
- (p12) cmp.leu p10, p11 = s0, pr1_2
- (p13) cmp.ltu p10, p11 = s0, pr1_2
- ;;
- .pred.rel "mutex", p6, p7
-.mmi; getfsig acc1_0 = fp2a_0
- (p6) add acc0 = pr0_0, acc1_2, 1
- (p7) add acc0 = pr0_0, acc1_2
- ;;
-L(cj3):
- .pred.rel "mutex", p10, p11
-.mfi; getfsig pr0_2 = fp0b_2
- xma.l fp1b_2 = u_2, v1, fp1a_2
- (p10) add s0 = pr1_3, acc0, 1
-.mfi; (p11) add s0 = pr1_3, acc0
- xma.hu fp2a_2 = u_2, v1, fp1a_2
- nop 1
- ;;
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
-.mmi; getfsig pr1_1 = fp1b_1
- st8 [rp] = s0, 8
- (p6) cmp.leu p8, p9 = acc0, pr0_0
-.mmi; (p7) cmp.ltu p8, p9 = acc0, pr0_0
- (p10) cmp.leu p12, p13 = s0, pr1_3
- (p11) cmp.ltu p12, p13 = s0, pr1_3
- ;;
- .pred.rel "mutex", p8, p9
-.mmi; getfsig acc1_1 = fp2a_1
- (p8) add acc0 = pr0_1, acc1_3, 1
- (p9) add acc0 = pr0_1, acc1_3
- ;;
- .pred.rel "mutex", p12, p13
-.mmi; (p12) add s0 = pr1_0, acc0, 1
- (p13) add s0 = pr1_0, acc0
- nop 1
- ;;
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
-.mmi; getfsig pr1_2 = fp1b_2
- st8 [rp] = s0, 8
- (p8) cmp.leu p6, p7 = acc0, pr0_1
-.mmi; (p9) cmp.ltu p6, p7 = acc0, pr0_1
- (p12) cmp.leu p10, p11 = s0, pr1_0
- (p13) cmp.ltu p10, p11 = s0, pr1_0
- ;;
- .pred.rel "mutex", p6, p7
-.mmi; getfsig r8 = fp2a_2
- (p6) add acc0 = pr0_2, acc1_0, 1
- (p7) add acc0 = pr0_2, acc1_0
- ;;
- .pred.rel "mutex", p10, p11
-.mmi; (p10) add s0 = pr1_1, acc0, 1
- (p11) add s0 = pr1_1, acc0
- (p6) cmp.leu p8, p9 = acc0, pr0_2
- ;;
- .pred.rel "mutex", p10, p11
-.mmi; (p7) cmp.ltu p8, p9 = acc0, pr0_2
- (p10) cmp.leu p12, p13 = s0, pr1_1
- (p11) cmp.ltu p12, p13 = s0, pr1_1
- ;;
- .pred.rel "mutex", p8, p9
-.mmi; st8 [rp] = s0, 8
- (p8) add acc0 = pr1_2, acc1_1, 1
- (p9) add acc0 = pr1_2, acc1_1
- ;;
- .pred.rel "mutex", p8, p9
-.mmi; (p8) cmp.leu p10, p11 = acc0, pr1_2
- (p9) cmp.ltu p10, p11 = acc0, pr1_2
- (p12) add acc0 = 1, acc0
- ;;
-.mmi; st8 [rp] = acc0, 8
- (p12) cmpeqor p10, p0 = 0, acc0
- nop 1
- ;;
-.mib; (p10) add r8 = 1, r8
- mov ar.lc = r2
- br.ret.sptk.many b0
+
+.Lcj6:
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_3 = fp0b_3
+ xma.l fp1b_3 = u_3, v1, fp1a_3
+ (p12) add s0 = pr1_0, acc0, 1
+ (p13) add s0 = pr1_0, acc0
+ xma.hu fp2a_3 = u_3, v1, fp1a_3
+ ;;
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ getf.sig pr1_2 = fp1b_2
+ (p8) cmp.leu p6, p7 = acc0, pr0_1
+ (p9) cmp.ltu p6, p7 = acc0, pr0_1
+ (p12) cmp.leu p10, p11 = s0, pr1_0
+ (p13) cmp.ltu p10, p11 = s0, pr1_0
+ ;;
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_2 = fp2a_2
+ st8 [rp] = s0, 8
+ xma.l fp0b_1 = u_1, v0, r_1
+ (p6) add acc0 = pr0_2, acc1_0, 1
+ (p7) add acc0 = pr0_2, acc1_0
+ xma.hu fp1a_1 = u_1, v0, r_1
+ ;;
+.Lcj5:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_0 = fp0b_0
+ xma.l fp1b_0 = u_0, v1, fp1a_0
+ (p10) add s0 = pr1_1, acc0, 1
+ (p11) add s0 = pr1_1, acc0
+ xma.hu fp2a_0 = u_0, v1, fp1a_0
+ ;;
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ getf.sig pr1_3 = fp1b_3
+ (p6) cmp.leu p8, p9 = acc0, pr0_2
+ (p7) cmp.ltu p8, p9 = acc0, pr0_2
+ (p10) cmp.leu p12, p13 = s0, pr1_1
+ (p11) cmp.ltu p12, p13 = s0, pr1_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_3 = fp2a_3
+ st8 [rp] = s0, 8
+ xma.l fp0b_2 = u_2, v0, r_2
+ (p8) add acc0 = pr0_3, acc1_1, 1
+ (p9) add acc0 = pr0_3, acc1_1
+ xma.hu fp1a_2 = u_2, v0, r_2
+ ;;
+.Lcj4:
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_1 = fp0b_1
+ xma.l fp1b_1 = u_1, v1, fp1a_1
+ (p12) add s0 = pr1_2, acc0, 1
+ (p13) add s0 = pr1_2, acc0
+ xma.hu fp2a_1 = u_1, v1, fp1a_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ getf.sig pr1_0 = fp1b_0
+ (p8) cmp.leu p6, p7 = acc0, pr0_3
+ (p9) cmp.ltu p6, p7 = acc0, pr0_3
+ (p12) cmp.leu p10, p11 = s0, pr1_2
+ (p13) cmp.ltu p10, p11 = s0, pr1_2
+ ;;
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_0 = fp2a_0
+ st8 [rp] = s0, 8
+ (p6) add acc0 = pr0_0, acc1_2, 1
+ (p7) add acc0 = pr0_0, acc1_2
+ ;;
+.Lcj3:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_2 = fp0b_2
+ xma.l fp1b_2 = u_2, v1, fp1a_2
+ (p10) add s0 = pr1_3, acc0, 1
+ (p11) add s0 = pr1_3, acc0
+ xma.hu fp2a_2 = u_2, v1, fp1a_2
+ ;;
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ getf.sig pr1_1 = fp1b_1
+ (p6) cmp.leu p8, p9 = acc0, pr0_0
+ (p7) cmp.ltu p8, p9 = acc0, pr0_0
+ (p10) cmp.leu p12, p13 = s0, pr1_3
+ (p11) cmp.ltu p12, p13 = s0, pr1_3
+ ;;
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_1 = fp2a_1
+ st8 [rp] = s0, 8
+ (p8) add acc0 = pr0_1, acc1_3, 1
+ (p9) add acc0 = pr0_1, acc1_3
+ ;;
+.Lcj2:
+ .pred.rel "mutex", p12, p13
+ (p12) add s0 = pr1_0, acc0, 1
+ (p13) add s0 = pr1_0, acc0
+ ;;
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ getf.sig pr1_2 = fp1b_2
+ (p8) cmp.leu p6, p7 = acc0, pr0_1
+ (p9) cmp.ltu p6, p7 = acc0, pr0_1
+ (p12) cmp.leu p10, p11 = s0, pr1_0
+ (p13) cmp.ltu p10, p11 = s0, pr1_0
+ ;;
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_2 = fp2a_2
+ st8 [rp] = s0, 8
+ (p6) add acc0 = pr0_2, acc1_0, 1
+ (p7) add acc0 = pr0_2, acc1_0
+ ;;
+ .pred.rel "mutex", p10, p11
+ (p10) add s0 = pr1_1, acc0, 1
+ (p11) add s0 = pr1_1, acc0
+ ;;
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ (p6) cmp.leu p8, p9 = acc0, pr0_2
+ (p7) cmp.ltu p8, p9 = acc0, pr0_2
+ (p10) cmp.leu p12, p13 = s0, pr1_1
+ (p11) cmp.ltu p12, p13 = s0, pr1_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ st8 [rp] = s0, 8
+ (p8) add acc0 = pr1_2, acc1_1, 1
+ (p9) add acc0 = pr1_2, acc1_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ (p8) cmp.leu p10, p11 = acc0, pr1_2
+ (p9) cmp.ltu p10, p11 = acc0, pr1_2
+ (p12) add acc0 = 1, acc0
+ ;;
+ st8 [rp] = acc0, 8
+ (p12) cmp.eq.or p10, p0 = 0, acc0
+ mov r8 = acc1_2
+ ;;
+ .pred.rel "mutex", p10, p11
+ (p10) add r8 = 1, r8
+ mov.i ar.lc = r2
+ br.ret.sptk.many b0
EPILOGUE()
ASM_END()
diff --git a/gmp/mpn/ia64/aors_n.asm b/gmp/mpn/ia64/aors_n.asm
index 81be606190..fd3aaac460 100644
--- a/gmp/mpn/ia64/aors_n.asm
+++ b/gmp/mpn/ia64/aors_n.asm
@@ -1,34 +1,21 @@
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-2005, 2010, 2011 Free Software Foundation, Inc.
+dnl Copyright 2003, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -39,818 +26,586 @@ C Itanium 2: 1.25
C TODO
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 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.
C INPUT PARAMETERS
-define(`rp', `r32')
-define(`up', `r33')
-define(`vp', `r34')
-define(`n', `r35')
-define(`cy', `r36')
+define(`rp',`r32')
+define(`up',`r33')
+define(`vp',`r34')
+define(`n',`r35')
ifdef(`OPERATION_add_n',`
define(ADDSUB, add)
- define(CND, ltu)
+ define(PRED, ltu)
define(INCR, 1)
define(LIM, -1)
- define(LIM2, 0)
- define(func, mpn_add_n)
- define(func_nc, mpn_add_nc)
+ define(func, mpn_add_n)
')
ifdef(`OPERATION_sub_n',`
define(ADDSUB, sub)
- define(CND, gtu)
+ define(PRED, gtu)
define(INCR, -1)
define(LIM, 0)
- define(LIM2, -1)
- define(func, mpn_sub_n)
- define(func_nc, mpn_sub_nc)
+ define(func, mpn_sub_n)
')
-define(cmpeqor, `cmp.eq.or')
-define(PFDIST, 500)
-
C Some useful aliases for registers we use
define(`u0',`r14') define(`u1',`r15') define(`u2',`r16') define(`u3',`r17')
+define(`u4',`r18') define(`u5',`r19') define(`u6',`r20') define(`u7',`r21')
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(`v4',`r28') define(`v5',`r29') define(`v6',`r30') define(`v7',`r31')
+define(`w0',`r22') define(`w1',`r9') define(`w2',`r8') define(`w3',`r23')
+define(`w4',`r22') define(`w5',`r9') define(`w6',`r8') define(`w7',`r23')
define(`rpx',`r3')
-define(`upadv',`r20') define(`vpadv',`r21')
-MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+MULFUNC_PROLOGUE(mpn_add_n mpn_sub_n)
ASM_START()
-PROLOGUE(func_nc)
+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
+ 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 r2 = ar.lc C I0
-}{.mmi; and r14 = 7, n C M I
- cmp.lt p15, p14 = 8, n C M I
- add n = -6, n C M I
+{.mmi C 00
+ ld8 r11 = [vp], 8 C M01
+ ld8 r10 = [up], 8 C M01
+ mov.i r2 = ar.lc C I0
+}
+{.mmi
+ and r14 = 7, n C M I
+ cmp.lt p15, p14 = 8, n C M I
+ add n = -8, n C M I
;;
}
-.mmi; add upadv = PFDIST, up C Merging these lines into the feed-in
- add vpadv = PFDIST, vp C code could save a cycle per call at
- mov r23 = cy C the expense of code size.
- ;;
-{.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 .Lc001 C B
- (p7) br.dptk .Lc010 C B
- (p8) br.dptk .Lc011 C B
- ;;
-}{.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
- (p9) br.dptk .Lc100 C B
- (p10) br.dptk .Lc101 C B
- (p11) br.dptk .Lc110 C B
- ;;
-}{.mmi; ld8 r19 = [vp], 8 C M01
- ld8 r18 = [up], 8 C M01
- cmp.ne p13, p0 = 0, cy C copy cy to p13 M I
-}{.mmb; cmp.eq p12, p0 = 7, r14 C M I
- nop 0
- (p12) br.dptk .Lc111 C B
+{.mmi C 01
+ 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 .Lb001 C B
+ (p7) br.dptk .Lb010 C B
+ (p8) br.dptk .Lb011 C B
;;
}
+{.mmi C 02
+ 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
+ (p9) br.dptk .Lb100 C B
+ (p10) br.dptk .Lb101 C B
+ (p11) br.dptk .Lb110 C B
+ ;;
+} C 03
+{.mmb
+ cmp.eq p12, p0 = 7, r14 C M I
+ add n = -1, n C loop count M I
+ (p12) br.dptk .Lb111 C B
+}
-.Lc000:
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; add vpadv = PFDIST, vp C M I
- ld8 v0 = [vp], 8 C M01
- mov ar.lc = n C I0
-.mmi; ld8 u0 = [up], 8 C M01
- ADDSUB w1 = r10, r11 C M I
- nop 0
- ;;
-.mmi; add upadv = PFDIST, up C M I
- ld8 v1 = [vp], 8 C M01
- cmp.CND p7, p0 = w1, r10 C M I
-.mmi; ld8 u1 = [up], 8 C M01
- ADDSUB w2 = r18, r19 C M I
- add rpx = 8, rp C M I
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- cmp.CND p8, p0 = w2, r18 C M I
- (p13) cmpeqor p7, p0 = LIM, w1 C M I
-.mmi; ld8 u2 = [up], 8 C M01
- (p13) add w1 = INCR, w1 C M I
- ADDSUB w3 = u3, v3 C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
-.mmb; ld8 u3 = [up], 8 C M01
- (p7) add w2 = INCR, w2 C M I
- br L(m0)
-
-
-.Lc001:
-.mmi;
- (p15) ld8 v1 = [vp], 8 C M01
- (p15) ld8 u1 = [up], 8 C M01
- ADDSUB w0 = r10, r11 C M I
-.mmb; nop 0
- nop 0
- (p15) br 1f
- ;;
-.mmi; cmp.ne p9, p0 = 0, r23 C M I
- mov r8 = 0
- cmp.CND p6, p0 = w0, r10 C M I
- ;;
-.mmb;
- (p9) cmpeqor p6, p0 = LIM, w0 C M I
- (p9) add w0 = INCR, w0 C M I
- br L(cj1) C B
-1:
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- mov ar.lc = n C I0
-.mmi; nop 0
- cmp.ne p9, p0 = 0, r23 C M I
- nop 0
- ;;
-.mmi; ld8 v0 = [vp], 8 C M01
- cmp.CND p6, p0 = w0, r10 C M I
- add rpx = 16, rp C M I
-.mmb; ld8 u0 = [up], 8 C M01
- ADDSUB w1 = u1, v1 C M I
- br L(c1) C B
-
-
-.Lc010:
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- mov r8 = 0 C M I
-.mmb; ADDSUB w3 = r10, r11 C M I
- cmp.ne p8, p0 = 0, r23 C M I
- (p15) br 1f C B
- ;;
-.mmi; cmp.CND p9, p0 = w3, r10 C M I
- ADDSUB w0 = u0, v0 C M I
- (p8) add w3 = INCR, w3 C M I
- ;;
-.mmb; cmp.CND p6, p0 = w0, u0 C M I
- (p8) cmpeqor p9, p0 = LIM2, w3 C M I
- br L(cj2) C B
-1:
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- mov ar.lc = n C I0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- cmp.CND p9, p0 = w3, r10 C M I
- ;;
-.mmi;
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
- (p8) add w3 = INCR, w3 C M I
- ADDSUB w0 = u0, v0 C M I
-.mmb; add rpx = 24, rp C M I
- nop 0
- br L(m23) C B
-
-
-.Lc011:
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- shr.u n = n, 3 C I0
-.mmi; ADDSUB w2 = r10, r11 C M I
- cmp.ne p7, p0 = 0, r23 C M I
- nop 0
- ;;
-.mmb; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- (p15) br 1f C B
-.mmi; cmp.CND p8, p0 = w2, r10 C M I
- ADDSUB w3 = u3, v3 C M I
- nop 0
- ;;
-.mmb;
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
- (p7) add w2 = INCR, w2 C M I
- br L(cj3) C B
-1:
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- ADDSUB w3 = u3, v3 C M I
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- cmp.CND p8, p0 = w2, r10 C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- mov ar.lc = n C I0
-.mmi; ld8 u3 = [up], 8 C M01
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
- (p7) add w2 = INCR, w2 C M I
- ;;
-.mmi; add rpx = 32, rp C M I
- st8 [rp] = w2, 8 C M23
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
-.mmb;
- (p8) add w3 = INCR, w3 C M I
- ADDSUB w0 = u0, v0 C M I
- br L(m23)
-
-
-.Lc100:
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- shr.u n = n, 3 C I0
-.mmi; ADDSUB w1 = r10, r11 C M I
- nop 0
- nop 0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- add rpx = 8, rp C M I
-.mmi; cmp.ne p6, p0 = 0, r23 C M I
- cmp.CND p7, p0 = w1, r10 C M I
- nop 0
- ;;
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- ADDSUB w2 = u2, v2 C M I
-.mmb;
- (p6) cmpeqor p7, p0 = LIM, w1 C M I
- (p6) add w1 = INCR, w1 C M I
- (p14) br L(cj4)
- ;;
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- mov ar.lc = n C I0
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- cmp.CND p8, p0 = w2, u2 C M I
- nop 0
-.mmi; ld8 u2 = [up], 8 C M01
- nop 0
- ADDSUB w3 = u3, v3 C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
-.mmb; ld8 u3 = [up], 8 C M01
- (p7) add w2 = INCR, w2 C M I
- br L(m4)
-
-
-.Lc101:
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- mov ar.lc = n C I0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- ADDSUB w0 = r10, r11 C M I
-.mmi; cmp.ne p9, p0 = 0, r23 C M I
- add rpx = 16, rp C M I
- nop 0
- ;;
-.mmi; ld8 v0 = [vp], 8 C M01
- 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
-
-
-.Lc110:
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; add upadv = PFDIST, up C M I
- add vpadv = PFDIST, vp C M I
- mov ar.lc = n C I0
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- ADDSUB w3 = r10, r11 C M I
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- ADDSUB w0 = u0, v0 C M I
-.mmi; cmp.CND p9, p0 = w3, r10 C M I
- cmp.ne p8, p0 = 0, r23 C M I
- add rpx = 24, rp C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- nop 0
-.mmb;
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
- (p8) add w3 = INCR, w3 C M I
- br L(m67) C B
-
-
-.Lc111:
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; add upadv = PFDIST, up C M I
- ld8 v1 = [vp], 8 C M01
- mov ar.lc = n C I0
-.mmi; ld8 u1 = [up], 8 C M01
- ADDSUB w2 = r10, r11 C M I
- nop 0
- ;;
-.mmi; add vpadv = PFDIST, vp C M I
- ld8 v2 = [vp], 8 C M01
- cmp.CND p8, p0 = w2, r10 C M I
-.mmi; ld8 u2 = [up], 8 C M01
- ADDSUB w3 = r18, r19 C M I
- nop 0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, r18 C M I
- (p13) cmpeqor p8, p0 = LIM, w2 C M I
-.mmi; ld8 u3 = [up], 8 C M01
- (p13) add w2 = INCR, w2 C M I
- nop 0
- ;;
-.mmi; add rpx = 32, rp C M I
- st8 [rp] = w2, 8 C M23
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
-.mmb;
- (p8) add w3 = INCR, w3 C M I
- ADDSUB w0 = u0, v0 C M I
- br L(m67)
-EPILOGUE()
-
-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
+.Lb000: ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ add rpx = 8, rp C M I
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ ADDSUB w1 = r10, r11 C M I
;;
-')
-
- {.mmi; ld8 r11 = [vp], 8 C M01
- ld8 r10 = [up], 8 C M01
- mov r2 = ar.lc C I0
-}{.mmi; and r14 = 7, n C M I
- cmp.lt p15, p14 = 8, n C M I
- add n = -6, 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 .Lb001 C B
- (p7) br.dptk .Lb010 C B
- (p8) br.dptk .Lb011 C B
- ;;
-}{.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
- (p9) br.dptk .Lb100 C B
- (p10) br.dptk .Lb101 C B
- (p11) br.dptk .Lb110 C B
- ;;
-}{.mmi; ld8 r19 = [vp], 8 C M01
- ld8 r18 = [up], 8 C M01
- cmp.ne p13, p0 = r0, r0 C clear "CF" M I
-}{.mmb; cmp.eq p12, p0 = 7, r14 C M I
- mov r23 = 0 C M I
- (p12) br.dptk .Lb111 C B
+ ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ cmp.PRED p7, p0 = w1, r10 C M I
;;
-}
-
-.Lb000:
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- ADDSUB w1 = r10, r11 C M I
- ;;
-.mmi; ld8 v1 = [vp], 8 C M01
- cmp.CND p7, p0 = w1, r10 C M I
- mov ar.lc = n C I0
-.mmi; ld8 u1 = [up], 8 C M01
- ADDSUB w2 = r18, r19 C M I
- add rpx = 8, rp C M I
- ;;
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- cmp.CND p8, p0 = w2, r18 C M I
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- ADDSUB w3 = u3, v3 C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
-.mmb; ld8 u3 = [up], 8 C M01
- (p7) add w2 = INCR, w2 C M I
- br L(m0) C B
-
-
- ALIGN(32)
-.Lb001:
-.mmi; ADDSUB w0 = r10, r11 C M I
- (p15) ld8 v1 = [vp], 8 C M01
- mov r8 = 0 C M I
- ;;
-.mmb; cmp.CND p6, p0 = w0, r10 C M I
- (p15) ld8 u1 = [up], 8 C M01
- (p14) br L(cj1) C B
- ;;
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- shr.u n = n, 3 C I0
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- cmp.CND p6, p0 = w0, r10 C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- mov ar.lc = n C I0
- ;;
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- ADDSUB w1 = u1, v1 C M I
- ;;
-.mmi; ld8 v1 = [vp], 8 C M01
- cmp.CND p7, p0 = w1, u1 C M I
- ADDSUB w2 = u2, v2 C M I
-.mmb; ld8 u1 = [up], 8 C M01
- add rpx = 16, rp C M I
- br L(m1) C B
-
-
- ALIGN(32)
-.Lb010:
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- shr.u n = n, 3 C I0
-.mmb; ADDSUB w3 = r10, r11 C M I
- nop 0
- (p15) br L(gt2) C B
- ;;
-.mmi; cmp.CND p9, p0 = w3, r10 C M I
- ADDSUB w0 = u0, v0 C M I
- mov r8 = 0 C M I
- ;;
-.mmb; nop 0
- cmp.CND p6, p0 = w0, u0 C M I
- br L(cj2) C B
-L(gt2):
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- nop 0
- ;;
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- mov ar.lc = n C I0
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- nop 0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, r10 C M I
- ADDSUB w0 = u0, v0 C M I
-.mmb; ld8 u3 = [up], 8 C M01
- add rpx = 24, rp C M I
- br L(m23) C B
-
-
- ALIGN(32)
-.Lb011:
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- ADDSUB w2 = r10, r11 C M I
- ;;
-.mmb; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- (p15) br 1f C B
-.mmb; cmp.CND p8, p0 = w2, r10 C M I
- ADDSUB w3 = u3, v3 C M I
- br L(cj3) C B
-1:
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- ADDSUB w3 = u3, v3 C M I
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- cmp.CND p8, p0 = w2, r10 C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- mov ar.lc = n C I0
-.mmi; ld8 u3 = [up], 8 C M01
- nop 0
- nop 0
- ;;
-.mmi; add rpx = 32, rp C M I
- st8 [rp] = w2, 8 C M23
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
-.mmb;
- (p8) add w3 = INCR, w3 C M I
- ADDSUB w0 = u0, v0 C M I
- br L(m23) C B
-
-
- ALIGN(32)
-.Lb100:
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- ADDSUB w1 = r10, r11 C M I
- ;;
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- cmp.CND p7, p0 = w1, r10 C M I
-.mmb; nop 0
- ADDSUB w2 = u2, v2 C M I
- (p14) br L(cj4) C B
- ;;
-L(gt4):
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- mov ar.lc = n C I0
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- nop 0
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- cmp.CND p8, p0 = w2, u2 C M I
- nop 0
-.mmi; ld8 u2 = [up], 8 C M01
- ADDSUB w3 = u3, v3 C M I
- add rpx = 8, rp C M I
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
-.mmb; ld8 u3 = [up], 8 C M01
- (p7) add w2 = INCR, w2 C M I
- br L(m4) C B
-
-
- ALIGN(32)
-.Lb101:
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- ADDSUB w0 = r10, r11 C M I
- ;;
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- add rpx = 16, rp C M I
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- nop 0
- ;;
-.mmi; ld8 v0 = [vp], 8 C M01
- cmp.CND p6, p0 = w0, r10 C M I
- nop 0
-.mmb; ld8 u0 = [up], 8 C M01
- ADDSUB w1 = u1, v1 C M I
- (p14) br L(cj5) C B
- ;;
-L(gt5):
-.mmi; ld8 v1 = [vp], 8 C M01
- cmp.CND p7, p0 = w1, u1 C M I
- mov ar.lc = n C I0
-.mmb; ld8 u1 = [up], 8 C M01
- ADDSUB w2 = u2, v2 C M I
- br L(m5) C B
-
-
- ALIGN(32)
-.Lb110:
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- ADDSUB w3 = r10, r11 C M I
- ;;
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- mov ar.lc = n C I0
-.mmi; ld8 v2 = [vp], 8 C M01
- ld8 u2 = [up], 8 C M01
- nop 0
- ;;
-.mmi; ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, r10 C M I
- ADDSUB w0 = u0, v0 C M I
-.mmb; ld8 u3 = [up], 8 C M01
- add rpx = 24, rp C M I
- br L(m67) C B
-
+ ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ ADDSUB w2 = u2, v2 C M I
+ ;;
+ ld8 v6 = [vp], 8 C M01
+ ld8 u6 = [up], 8 C M01
+ cmp.PRED p8, p0 = w2, u2 C M I
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ ADDSUB w3 = u3, v3 C M I
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ cmp.PRED p9, p0 = w3, u3 C M I
+ (p7) cmp.eq.or p8, p0 = LIM, w2 C M I
+ (p7) add w2 = INCR, w2 C M I
+ (p14) br.cond.dptk .Lcj8 C B
+ ;;
+
+.grt8: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ shr.u n = n, 3 C I0
+ ;;
+ add r11 = 512, vp
+ ld8 v2 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u2 = [up], 8 C M01
+ nop.i 0
+ nop.b 0
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ br .LL000 C B
- ALIGN(32)
-.Lb111:
-.mmi; ld8 v0 = [vp], 8 C M01
- ld8 u0 = [up], 8 C M01
- shr.u n = n, 3 C I0
- ;;
-.mmi; ld8 v1 = [vp], 8 C M01
- ld8 u1 = [up], 8 C M01
- ADDSUB w2 = r10, r11 C M I
- ;;
-.mmi; ld8 v2 = [vp], 8 C M01
- cmp.CND p8, p0 = w2, r10 C M I
- mov ar.lc = n C I0
-.mmi; ld8 u2 = [up], 8 C M01
- ADDSUB w3 = r18, r19 C M I
- nop 0
- ;;
-.mmi; add upadv = PFDIST, up
- add vpadv = PFDIST, vp
- nop 0
-.mmi; ld8 v3 = [vp], 8 C M01
- ld8 u3 = [up], 8 C M01
- cmp.CND p9, p0 = w3, r18 C M I
- ;;
-.mmi; add rpx = 32, rp C M I
- st8 [rp] = w2, 8 C M23
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
-.mmb;
- (p8) add w3 = INCR, w3 C M I
- ADDSUB w0 = u0, v0 C M I
- br L(m67) C B
+.Lb001: add rpx = 16, rp C M I
+ ADDSUB w0 = r10, r11 C M I
+ (p15) br.cond.dpnt .grt1 C B
+ ;;
+ cmp.PRED p6, p0 = w0, r10 C M I
+ mov r8 = 0 C M I
+ br .Lcj1 C B
+.grt1: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ shr.u n = n, 3 C I0
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ cmp.ne p9, p0 = r0, r0 C read near Loop
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ ;;
+ ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ cmp.PRED p6, p0 = w0, r10 C M I
+ ;;
+ ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ ADDSUB w1 = u1, v1 C M I
+ ;;
+ ld8 v6 = [vp], 8 C M01
+ ld8 u6 = [up], 8 C M01
+ cmp.PRED p7, p0 = w1, u1 C M I
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ ADDSUB w2 = u2, v2 C M I
+ ;;
+ add r11 = 512, vp
+ ld8 v0 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u0 = [up], 8 C M01
+ br.cloop.dptk .Loop C B
+ br .Lcj9 C B
+
+.Lb010: ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ add rpx = 24, rp C M I
+ ADDSUB w7 = r10, r11 C M I
+ (p15) br.cond.dpnt .grt2 C B
+ ;;
+ cmp.PRED p9, p0 = w7, r10 C M I
+ ADDSUB w0 = u0, v0 C M I
+ br .Lcj2 C B
+
+.grt2: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ shr.u n = n, 3 C I0
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ ;;
+ ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ ;;
+ ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ cmp.PRED p9, p0 = w7, r10 C M I
+ ;;
+ ld8 v6 = [vp], 8 C M01
+ ld8 u6 = [up], 8 C M01
+ ADDSUB w0 = u0, v0 C M I
+ ;;
+ add r11 = 512, vp
+ ld8 v7 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u7 = [up], 8 C M01
+ br .LL01x C B
+
+.Lb011: ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ ADDSUB w6 = r10, r11 C M I
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ (p15) br.cond.dpnt .grt3 C B
+ ;;
+ cmp.PRED p8, p0 = w6, r10 C M I
+ ADDSUB w7 = u7, v7 C M I
+ ;;
+ st8 [rp] = w6, 8 C M23
+ cmp.PRED p9, p0 = w7, u7 C M I
+ br .Lcj3 C B
+
+.grt3: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ add rpx = 32, rp C M I
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ shr.u n = n, 3 C I0
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ cmp.PRED p8, p0 = w6, r10 C M I
+ ;;
+ ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ ADDSUB w7 = u7, v7 C M I
+ nop.i 0
+ nop.b 0
+ ;;
+ ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ cmp.PRED p9, p0 = w7, u7 C M I
+ ;;
+ add r11 = 512, vp
+ ld8 v6 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u6 = [up], 8 C M01
+ (p8) cmp.eq.or p9, p0 = LIM, w7 C M I
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ (p8) add w7 = INCR, w7 C M I
+ st8 [rp] = w6, 8 C M23
+ ADDSUB w0 = u0, v0 C M I
+ br .LL01x C B
+
+.Lb100: ld8 v6 = [vp], 8 C M01
+ ld8 u6 = [up], 8 C M01
+ add rpx = 8, rp C M I
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ ADDSUB w5 = r10, r11 C M I
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ (p15) br.cond.dpnt .grt4 C B
+ ;;
+ cmp.PRED p7, p0 = w5, r10 C M I
+ ADDSUB w6 = u6, v6 C M I
+ ;;
+ cmp.PRED p8, p0 = w6, u6 C M I
+ ADDSUB w7 = u7, v7 C M I
+ br .Lcj4 C B
+
+.grt4: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ shr.u n = n, 3 C I0
+ cmp.PRED p7, p0 = w5, r10 C M I
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ ADDSUB w6 = u6, v6 C M I
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ cmp.PRED p8, p0 = w6, u6 C M I
+ ;;
+ ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ ;;
+ ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ ADDSUB w7 = u7, v7 C M I
+ ;;
+ add r11 = 512, vp
+ ld8 v6 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u6 = [up], 8 C M01
+ cmp.PRED p9, p0 = w7, u7 C M I
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ (p7) cmp.eq.or p8, p0 = LIM, w6 C M I
+ (p7) add w6 = INCR, w6 C M I
+ br .LL100 C B
+
+.Lb101: ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ add rpx = 16, rp C M I
+ ;;
+ ld8 v6 = [vp], 8 C M01
+ ld8 u6 = [up], 8 C M01
+ ADDSUB w4 = r10, r11 C M I
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ cmp.PRED p6, p0 = w4, r10 C M I
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w5 = u5, v5 C M I
+ shr.u n = n, 3 C I0
+ (p15) br.cond.dpnt .grt5 C B
+ ;;
+ cmp.PRED p7, p0 = w5, u5 C M I
+ ADDSUB w6 = u6, v6 C M I
+ br .Lcj5 C B
+
+.grt5: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ cmp.PRED p7, p0 = w5, u5 C M I
+ ;;
+ ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ ADDSUB w6 = u6, v6 C M I
+ ;;
+ add r11 = 512, vp
+ ld8 v5 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u5 = [up], 8 C M01
+ br .LL101 C B
+
+.Lb110: ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ add rpx = 24, rp C M I
+ ;;
+ ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ ADDSUB w3 = r10, r11 C M I
+ ;;
+ ld8 v6 = [vp], 8 C M01
+ ld8 u6 = [up], 8 C M01
+ shr.u n = n, 3 C I0
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ cmp.PRED p9, p0 = w3, r10 C M I
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w4 = u4, v4 C M I
+ (p14) br.cond.dptk .Lcj67 C B
+ ;;
+
+.grt6: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ cmp.PRED p9, p0 = w3, r10 C M I
+ nop.i 0
+ nop.b 0
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ ADDSUB w4 = u4, v4 C M I
+ ;;
+ add r11 = 512, vp
+ ld8 v3 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u3 = [up], 8 C M01
+ br .LL11x C B
+
+.Lb111: ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ add rpx = 32, rp C M I
+ ;;
+ ld8 v4 = [vp], 8 C M01
+ ld8 u4 = [up], 8 C M01
+ ADDSUB w2 = r10, r11 C M I
+ ;;
+ ld8 v5 = [vp], 8 C M01
+ ld8 u5 = [up], 8 C M01
+ cmp.PRED p8, p0 = w2, r10 C M I
+ ;;
+ ld8 v6 = [vp], 8 C M01
+ ld8 u6 = [up], 8 C M01
+ ADDSUB w3 = u3, v3 C M I
+ ;;
+ ld8 v7 = [vp], 8 C M01
+ ld8 u7 = [up], 8 C M01
+ cmp.PRED p9, p0 = w3, u3 C M I
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ (p15) br.cond.dpnt .grt7 C B
+ ;;
+ st8 [rp] = w2, 8 C M23
+ (p8) cmp.eq.or p9, p0 = LIM, w3 C M I
+ (p8) add w3 = INCR, w3 C M I
+ ADDSUB w4 = u4, v4 C M I
+ br .Lcj67 C B
+
+.grt7: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ shr.u n = n, 3 C I0
+ (p8) cmp.eq.or p9, p0 = LIM, w3 C M I
+ nop.i 0
+ nop.b 0
+ ;;
+ add r11 = 512, vp
+ ld8 v2 = [vp], 8 C M01
+ add r10 = 512, up
+ ld8 u2 = [up], 8 C M01
+ (p8) add w3 = INCR, w3 C M I
+ nop.b 0
+ ;;
+ ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ st8 [rp] = w2, 8 C M23
+ ADDSUB w4 = u4, v4 C M I
+ br .LL11x C B
C *** MAIN LOOP START ***
ALIGN(32)
-L(top):
-L(c5): ld8 v1 = [vp], 8 C M01
- cmp.CND p7, p0 = w1, u1 C M I
- (p9) cmpeqor p6, p0 = LIM, w0 C M I
- ld8 u1 = [up], 8 C M01
- (p9) add w0 = INCR, w0 C M I
- ADDSUB w2 = u2, v2 C M I
- ;;
-L(m5): ld8 v2 = [vp], 8 C M01
- cmp.CND p8, p0 = w2, u2 C M I
- (p6) cmpeqor p7, p0 = LIM, w1 C M I
- ld8 u2 = [up], 8 C M01
- (p6) add w1 = INCR, w1 C M I
- ADDSUB w3 = u3, v3 C M I
- ;;
- st8 [rp] = w0, 8 C M23
- ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
- ld8 u3 = [up], 8 C M01
- (p7) add w2 = INCR, w2 C M I
- ;;
-L(m4): st8 [rp] = w1, 16 C M23
- st8 [rpx] = w2, 32 C M23
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
- lfetch [upadv], 64
- (p8) add w3 = INCR, w3 C M I
- ADDSUB w0 = u0, v0 C M I
- ;;
-L(m23): st8 [rp] = w3, 8 C M23
- ld8 v0 = [vp], 8 C M01
- cmp.CND p6, p0 = w0, u0 C M I
- ld8 u0 = [up], 8 C M01
- ADDSUB w1 = u1, v1 C M I
- nop.b 0
- ;;
-L(c1): ld8 v1 = [vp], 8 C M01
- cmp.CND p7, p0 = w1, u1 C M I
- (p9) cmpeqor p6, p0 = LIM, w0 C M I
- ld8 u1 = [up], 8 C M01
- (p9) add w0 = INCR, w0 C M I
- ADDSUB w2 = u2, v2 C M I
- ;;
-L(m1): ld8 v2 = [vp], 8 C M01
- cmp.CND p8, p0 = w2, u2 C M I
- (p6) cmpeqor p7, p0 = LIM, w1 C M I
- ld8 u2 = [up], 8 C M01
- (p6) add w1 = INCR, w1 C M I
- ADDSUB w3 = u3, v3 C M I
- ;;
- st8 [rp] = w0, 8 C M23
- ld8 v3 = [vp], 8 C M01
- cmp.CND p9, p0 = w3, u3 C M I
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
- ld8 u3 = [up], 8 C M01
- (p7) add w2 = INCR, w2 C M I
- ;;
-L(m0): st8 [rp] = w1, 16 C M23
- st8 [rpx] = w2, 32 C M23
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
- lfetch [vpadv], 64
- (p8) add w3 = INCR, w3 C M I
- ADDSUB w0 = u0, v0 C M I
- ;;
-L(m67): st8 [rp] = w3, 8 C M23
- ld8 v0 = [vp], 8 C M01
- cmp.CND p6, p0 = w0, u0 C M I
- ld8 u0 = [up], 8 C M01
- ADDSUB w1 = u1, v1 C M I
- br.cloop.dptk L(top) C B
+.Loop: ld8 v1 = [vp], 8 C M01
+ cmp.PRED p7, p0 = w1, u1 C M I
+ (p9) cmp.eq.or p6, p0 = LIM, w0 C M I
+ ld8 u1 = [up], 8 C M01
+ (p9) add w0 = INCR, w0 C M I
+ ADDSUB w2 = u2, v2 C M I
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ cmp.PRED p8, p0 = w2, u2 C M I
+ (p6) cmp.eq.or p7, p0 = LIM, w1 C M I
+ ld8 u2 = [up], 8 C M01
+ (p6) add w1 = INCR, w1 C M I
+ ADDSUB w3 = u3, v3 C M I
+ ;;
+ st8 [rp] = w0, 8 C M23
+ ld8 v3 = [vp], 8 C M01
+ cmp.PRED p9, p0 = w3, u3 C M I
+ (p7) cmp.eq.or p8, p0 = LIM, w2 C M I
+ ld8 u3 = [up], 8 C M01
+ (p7) add w2 = INCR, w2 C M I
+ ;;
+.LL000: st8 [rp] = w1, 16 C M23
+ st8 [rpx] = w2, 32 C M23
+ (p8) cmp.eq.or p9, p0 = LIM, w3 C M I
+ lfetch [r10], 64
+ (p8) add w3 = INCR, w3 C M I
+ ADDSUB w4 = u4, v4 C M I
+ ;;
+.LL11x: st8 [rp] = w3, 8 C M23
+ ld8 v4 = [vp], 8 C M01
+ cmp.PRED p6, p0 = w4, u4 C M I
+ ld8 u4 = [up], 8 C M01
+ ADDSUB w5 = u5, v5 C M I
+ ;;
+ ld8 v5 = [vp], 8 C M01
+ cmp.PRED p7, p0 = w5, u5 C M I
+ (p9) cmp.eq.or p6, p0 = LIM, w4 C M I
+ ld8 u5 = [up], 8 C M01
+ (p9) add w4 = INCR, w4 C M I
+ ADDSUB w6 = u6, v6 C M I
+ ;;
+.LL101: ld8 v6 = [vp], 8 C M01
+ cmp.PRED p8, p0 = w6, u6 C M I
+ (p6) cmp.eq.or p7, p0 = LIM, w5 C M I
+ ld8 u6 = [up], 8 C M01
+ (p6) add w5 = INCR, w5 C M I
+ ADDSUB w7 = u7, v7 C M I
+ ;;
+ st8 [rp] = w4, 8 C M23
+ ld8 v7 = [vp], 8 C M01
+ cmp.PRED p9, p0 = w7, u7 C M I
+ (p7) cmp.eq.or p8, p0 = LIM, w6 C M I
+ ld8 u7 = [up], 8 C M01
+ (p7) add w6 = INCR, w6 C M I
+ ;;
+.LL100: st8 [rp] = w5, 16 C M23
+ st8 [rpx] = w6, 32 C M23
+ (p8) cmp.eq.or p9, p0 = LIM, w7 C M I
+ lfetch [r11], 64
+ (p8) add w7 = INCR, w7 C M I
+ ADDSUB w0 = u0, v0 C M I
+ ;;
+.LL01x: st8 [rp] = w7, 8 C M23
+ ld8 v0 = [vp], 8 C M01
+ cmp.PRED p6, p0 = w0, u0 C M I
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w1 = u1, v1 C M I
+ br.cloop.dptk .Loop C B
;;
C *** MAIN LOOP END ***
-L(end):
-.mmi;
- (p9) cmpeqor p6, p0 = LIM, w0 C M I
- (p9) add w0 = INCR, w0 C M I
- mov ar.lc = r2 C I0
-L(cj5):
-.mmi; cmp.CND p7, p0 = w1, u1 C M I
- ADDSUB w2 = u2, v2 C M I
- nop 0
- ;;
-.mmi; st8 [rp] = w0, 8 C M23
- (p6) cmpeqor p7, p0 = LIM, w1 C M I
- (p6) add w1 = INCR, w1 C M I
-L(cj4):
-.mmi; cmp.CND p8, p0 = w2, u2 C M I
- ADDSUB w3 = u3, v3 C M I
- nop 0
- ;;
-.mmi; st8 [rp] = w1, 8 C M23
- (p7) cmpeqor p8, p0 = LIM, w2 C M I
- (p7) add w2 = INCR, w2 C M I
-L(cj3):
-.mmi; cmp.CND p9, p0 = w3, u3 C M I
- ADDSUB w0 = u0, v0 C M I
- nop 0
- ;;
-.mmi; st8 [rp] = w2, 8 C M23
- (p8) cmpeqor p9, p0 = LIM, w3 C M I
- (p8) add w3 = INCR, w3 C M I
-.mmi; cmp.CND p6, p0 = w0, u0 C M I
- nop 0
- mov r8 = 0 C M I
- ;;
-L(cj2):
-.mmi; st8 [rp] = w3, 8 C M23
- (p9) cmpeqor p6, p0 = LIM, w0 C M I
- (p9) add w0 = INCR, w0 C M I
- ;;
-L(cj1):
-.mmb; st8 [rp] = w0, 8 C M23
- (p6) mov r8 = 1 C M I
- br.ret.sptk.many b0 C B
+ cmp.PRED p7, p0 = w1, u1 C M I
+ (p9) cmp.eq.or p6, p0 = LIM, w0 C M I
+ (p9) add w0 = INCR, w0 C M I
+ ADDSUB w2 = u2, v2 C M I
+ ;;
+.Lcj9: cmp.PRED p8, p0 = w2, u2 C M I
+ (p6) cmp.eq.or p7, p0 = LIM, w1 C M I
+ st8 [rp] = w0, 8 C M23
+ (p6) add w1 = INCR, w1 C M I
+ ADDSUB w3 = u3, v3 C M I
+ ;;
+ cmp.PRED p9, p0 = w3, u3 C M I
+ (p7) cmp.eq.or p8, p0 = LIM, w2 C M I
+ (p7) add w2 = INCR, w2 C M I
+ ;;
+.Lcj8: st8 [rp] = w1, 16 C M23
+ st8 [rpx] = w2, 32 C M23
+ (p8) cmp.eq.or p9, p0 = LIM, w3 C M I
+ (p8) add w3 = INCR, w3 C M I
+ ADDSUB w4 = u4, v4 C M I
+ ;;
+.Lcj67: st8 [rp] = w3, 8 C M23
+ cmp.PRED p6, p0 = w4, u4 C M I
+ ADDSUB w5 = u5, v5 C M I
+ ;;
+ cmp.PRED p7, p0 = w5, u5 C M I
+ (p9) cmp.eq.or p6, p0 = LIM, w4 C M I
+ (p9) add w4 = INCR, w4 C M I
+ ADDSUB w6 = u6, v6 C M I
+ ;;
+.Lcj5: cmp.PRED p8, p0 = w6, u6 C M I
+ (p6) cmp.eq.or p7, p0 = LIM, w5 C M I
+ st8 [rp] = w4, 8 C M23
+ (p6) add w5 = INCR, w5 C M I
+ ADDSUB w7 = u7, v7 C M I
+ ;;
+.Lcj4: cmp.PRED p9, p0 = w7, u7 C M I
+ (p7) cmp.eq.or p8, p0 = LIM, w6 C M I
+ (p7) add w6 = INCR, w6 C M I
+ ;;
+ st8 [rp] = w5, 16 C M23
+ st8 [rpx] = w6, 32 C M23
+.Lcj3:
+ (p8) cmp.eq.or p9, p0 = LIM, w7 C M I
+ (p8) add w7 = INCR, w7 C M I
+ ADDSUB w0 = u0, v0 C M I
+ ;;
+.Lcj2: st8 [rp] = w7, 8 C M23
+ cmp.PRED p6, p0 = w0, u0 C M I
+ ;;
+ (p9) cmp.eq.or p6, p0 = LIM, w0 C M I
+ (p9) add w0 = INCR, w0 C M I
+ mov r8 = 0 C M I
+ ;;
+.Lcj1: st8 [rp] = w0, 8 C M23
+ mov.i ar.lc = r2 C I0
+ (p6) mov r8 = 1 C M I
+ br.ret.sptk.many b0 C B
EPILOGUE()
ASM_END()
diff --git a/gmp/mpn/ia64/aorslsh1_n.asm b/gmp/mpn/ia64/aorslsh1_n.asm
new file mode 100644
index 0000000000..5348149c87
--- /dev/null
+++ b/gmp/mpn/ia64/aorslsh1_n.asm
@@ -0,0 +1,323 @@
+dnl IA-64 mpn_addlsh1_n/mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1).
+
+dnl Copyright 2003, 2004, 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 Itanium: 3.0
+C Itanium 2: 1.5
+
+C TODO
+C * Use shladd in feed-in code (for mpn_addlsh1_n).
+
+C INPUT PARAMETERS
+define(`rp',`r32')
+define(`up',`r33')
+define(`vp',`r34')
+define(`n',`r35')
+
+ifdef(`OPERATION_addlsh1_n',`
+ define(ADDSUB, add)
+ define(PRED, ltu)
+ define(INCR, 1)
+ define(LIM, -1)
+ define(func, mpn_addlsh1_n)
+')
+ifdef(`OPERATION_sublsh1_n',`
+ define(ADDSUB, sub)
+ define(PRED, gtu)
+ define(INCR, -1)
+ define(LIM, 0)
+ define(func, mpn_sublsh1_n)
+')
+
+C Some useful aliases for registers we use
+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')
+
+MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_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
+ 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 = -4, 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
+ ;;
+ ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ add x3 = r11, r11 C M I
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ ADDSUB w3 = r10, x3 C M I
+ (p15) br.dpnt .grt4 C B
+ ;;
+ shrp x0 = v0, r11, 63 C I0
+ cmp.PRED p8, p0 = w3, r10 C M I
+ ;;
+ shrp x1 = v1, v0, 63 C I0
+ ADDSUB w0 = u0, x0 C M I
+ ;;
+ cmp.PRED p6, p0 = w0, u0 C M I
+ ADDSUB w1 = u1, x1 C M I
+ br .Lcj4 C B
+
+.grt4: ld8 v3 = [vp], 8 C M01
+ shrp x0 = v0, r11, 63 C I0
+ cmp.PRED p8, p0 = w3, r10 C M I
+ add n = -1, n
+ ;;
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ shrp x1 = v1, v0, 63 C I0
+ ld8 v0 = [vp], 8 C M01
+ ADDSUB w0 = u0, x0 C M I
+ ;;
+ cmp.PRED p6, p0 = w0, u0 C M I
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w1 = u1, x1 C M I
+ br .LL00 C B
+
+.Lb01: add x2 = r11, r11 C M I
+ shr.u n = n, 2 C I0
+ (p15) br.dpnt .grt1 C B
+ ;;
+ ADDSUB w2 = r10, x2 C M I
+ shr.u r8 = r11, 63 C retval I0
+ ;;
+ cmp.PRED p6, p0 = w2, r10 C M I
+ ;;
+ st8 [rp] = w2, 8 C M23
+ (p6) add r8 = 1, r8 C M I
+ br.ret.sptk.many b0 C B
+
+.grt1: ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C FIXME swap with next I0
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w2 = r10, x2
+ ;;
+ ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ shrp x3 = v3, r11, 63 C I0
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ cmp.PRED p6, p0 = w2, r10 C M I
+ ADDSUB w3 = u3, x3 C M I
+ br.cloop.dptk .grt5 C B
+ ;;
+ shrp x0 = v0, v3, 63 C I0
+ cmp.PRED p8, p0 = w3, u3 C M I
+ br .Lcj5 C B
+
+.grt5: shrp x0 = v0, v3, 63 C I0
+ ld8 v3 = [vp], 8 C M01
+ cmp.PRED p8, p0 = w3, u3 C M I
+ br .LL01 C B
+
+.Lb10: ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ shr.u n = n, 2 C I0
+ add x1 = r11, r11 C M I
+ (p15) br.dpnt .grt2 C B
+ ;;
+ ADDSUB w1 = r10, x1 C M I
+ shrp x2 = v2, r11, 63 C I0
+ ;;
+ cmp.PRED p8, p0 = w1, r10 C M I
+ ADDSUB w2 = u2, x2 C M I
+ shr.u r8 = v2, 63 C retval I0
+ ;;
+ cmp.PRED p6, p0 = w2, u2 C M I
+ br .Lcj2 C B
+
+.grt2: ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w1 = r10, x1 C M I
+ ;;
+ ld8 v1 = [vp], 8 C M01
+ shrp x2 = v2, r11, 63 C I0
+ cmp.PRED p8, p0 = w1, r10 C M I
+ ;;
+ ld8 u1 = [up], 8 C M01
+ shrp x3 = v3, v2, 63 C I0
+ ld8 v2 = [vp], 8 C M01
+ ADDSUB w2 = u2, x2 C M I
+ ;;
+ cmp.PRED p6, p0 = w2, u2 C M I
+ ld8 u2 = [up], 8 C M01
+ ADDSUB w3 = u3, x3 C M I
+ br.cloop.dpnt .Loop C B
+ br .Lskip C B
+
+.Lb11: ld8 v1 = [vp], 8 C M01
+ ld8 u1 = [up], 8 C M01
+ shr.u n = n, 2 C I0
+ add x0 = r11, r11 C M I
+ ;;
+ ld8 v2 = [vp], 8 C M01
+ ld8 u2 = [up], 8 C M01
+ (p15) br.dpnt .grt3 C B
+ ;;
+
+ shrp x1 = v1, r11, 63 C I0
+ ADDSUB w0 = r10, x0 C M I
+ ;;
+ cmp.PRED p6, p0 = w0, r10 C M I
+ ADDSUB w1 = u1, x1 C M I
+ ;;
+ shrp x2 = v2, v1, 63 C I0
+ cmp.PRED p8, p0 = w1, u1 C M I
+ br .Lcj3 C B
+
+.grt3: ld8 v3 = [vp], 8 C M01
+ ld8 u3 = [up], 8 C M01
+ mov.i ar.lc = n C I0
+ shrp x1 = v1, r11, 63 C I0
+ ADDSUB w0 = r10, x0 C M I
+ ;;
+ ld8 v0 = [vp], 8 C M01
+ cmp.PRED p6, p0 = w0, r10 C M I
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w1 = u1, x1 C M I
+ ;;
+ shrp x2 = v2, v1, 63 C I0
+ ld8 v1 = [vp], 8 C M01
+ cmp.PRED p8, p0 = w1, u1 C M I
+ br .LL11 C B
+
+
+C *** MAIN LOOP START ***
+ ALIGN(32)
+.Loop: st8 [rp] = w1, 8 C M23
+ shrp x0 = v0, v3, 63 C I0
+ (p8) cmp.eq.or p6, p0 = LIM, w2 C M I
+ (p8) add w2 = INCR, w2 C M I
+ ld8 v3 = [vp], 8 C M01
+ cmp.PRED p8, p0 = w3, u3 C M I
+ ;;
+.LL01: ld8 u3 = [up], 8 C M01
+ shrp x1 = v1, v0, 63 C I0
+ (p6) cmp.eq.or 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.PRED p6, p0 = w0, u0 C M I
+ ld8 u0 = [up], 8 C M01
+ ADDSUB w1 = u1, x1 C M I
+ ;;
+.LL00: st8 [rp] = w3, 8 C M23
+ shrp x2 = v2, v1, 63 C I0
+ (p8) cmp.eq.or p6, p0 = LIM, w0 C M I
+ (p8) add w0 = INCR, w0 C M I
+ ld8 v1 = [vp], 8 C M01
+ cmp.PRED p8, p0 = w1, u1 C M I
+ ;;
+.LL11: ld8 u1 = [up], 8 C M01
+ shrp x3 = v3, v2, 63 C I0
+ (p6) cmp.eq.or 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
+ ;;
+ st8 [rp] = w0, 8 C M23
+ cmp.PRED p6, p0 = w2, u2 C M I
+ ld8 u2 = [up], 8 C M01
+ ADDSUB w3 = u3, x3 C M I
+ br.cloop.dptk .Loop C B
+ ;;
+C *** MAIN LOOP END ***
+
+.Lskip: st8 [rp] = w1, 8 C M23
+ shrp x0 = v0, v3, 63 C I0
+ (p8) cmp.eq.or p6, p0 = LIM, w2 C M I
+ (p8) add w2 = INCR, w2 C M I
+ cmp.PRED p8, p0 = w3, u3 C M I
+ ;;
+.Lcj5: shrp x1 = v1, v0, 63 C I0
+ (p6) cmp.eq.or p8, p0 = LIM, w3 C M I
+ (p6) add w3 = INCR, w3 C M I
+ ADDSUB w0 = u0, x0 C M I
+ ;;
+ st8 [rp] = w2, 8 C M23
+ cmp.PRED p6, p0 = w0, u0 C M I
+ ADDSUB w1 = u1, x1 C M I
+ ;;
+.Lcj4: st8 [rp] = w3, 8 C M23
+ shrp x2 = v2, v1, 63 C I0
+ (p8) cmp.eq.or p6, p0 = LIM, w0 C M I
+ (p8) add w0 = INCR, w0 C M I
+ cmp.PRED p8, p0 = w1, u1 C M I
+ ;;
+.Lcj3: shr.u r8 = v2, 63 C I0
+ (p6) cmp.eq.or p8, p0 = LIM, w1 C M I
+ (p6) add w1 = INCR, w1 C M I
+ ADDSUB w2 = u2, x2 C M I
+ ;;
+ st8 [rp] = w0, 8 C M23
+ cmp.PRED p6, p0 = w2, u2 C M I
+ ;;
+.Lcj2: st8 [rp] = w1, 8 C M23
+ (p8) cmp.eq.or p6, p0 = LIM, w2 C M I
+ (p8) add w2 = INCR, w2 C M I
+ ;;
+.Lcj1: st8 [rp] = w2, 8 C M23
+ mov.i ar.lc = r2 C I0
+ (p6) add r8 = 1, r8 C M I
+ br.ret.sptk.many b0 C B
+EPILOGUE()
+ASM_END()
diff --git a/gmp/mpn/ia64/aorsorrlsh1_n.asm b/gmp/mpn/ia64/aorsorrlsh1_n.asm
deleted file mode 100644
index 9b58b9e11f..0000000000
--- a/gmp/mpn/ia64/aorsorrlsh1_n.asm
+++ /dev/null
@@ -1,48 +0,0 @@
-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/gmp/mpn/ia64/aorsorrlsh2_n.asm b/gmp/mpn/ia64/aorsorrlsh2_n.asm
deleted file mode 100644
index 39b384a91b..0000000000
--- a/gmp/mpn/ia64/aorsorrlsh2_n.asm
+++ /dev/null
@@ -1,48 +0,0 @@
-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/gmp/mpn/ia64/aorsorrlshC_n.asm b/gmp/mpn/ia64/aorsorrlshC_n.asm
deleted file mode 100644
index d327838402..0000000000
--- a/gmp/mpn/ia64/aorsorrlshC_n.asm
+++ /dev/null
@@ -1,397 +0,0 @@
-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()
diff --git a/gmp/mpn/ia64/bdiv_dbm1c.asm b/gmp/mpn/ia64/bdiv_dbm1c.asm
index 47e4553cda..6ff4fdaaf9 100644
--- a/gmp/mpn/ia64/bdiv_dbm1c.asm
+++ b/gmp/mpn/ia64/bdiv_dbm1c.asm
@@ -1,34 +1,21 @@
dnl IA-64 mpn_bdiv_dbm1.
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/ia64/cnd_aors_n.asm b/gmp/mpn/ia64/cnd_aors_n.asm
deleted file mode 100644
index dc4a937403..0000000000
--- a/gmp/mpn/ia64/cnd_aors_n.asm
+++ /dev/null
@@ -1,259 +0,0 @@
-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()
diff --git a/gmp/mpn/ia64/copyd.asm b/gmp/mpn/ia64/copyd.asm
index b94a1af362..759629e4a7 100644
--- a/gmp/mpn/ia64/copyd.asm
+++ b/gmp/mpn/ia64/copyd.asm
@@ -1,34 +1,21 @@
dnl IA-64 mpn_copyd -- copy limb vector, decrementing.
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/ia64/copyi.asm b/gmp/mpn/ia64/copyi.asm
index 49ed192021..11451dc08d 100644
--- a/gmp/mpn/ia64/copyi.asm
+++ b/gmp/mpn/ia64/copyi.asm
@@ -1,34 +1,21 @@
dnl IA-64 mpn_copyi -- copy limb vector, incrementing.
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/ia64/dive_1.asm b/gmp/mpn/ia64/dive_1.asm
index 5e4a273530..9b9d085c0c 100644
--- a/gmp/mpn/ia64/dive_1.asm
+++ b/gmp/mpn/ia64/dive_1.asm
@@ -1,34 +1,21 @@
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-2005, 2010 Free Software Foundation, Inc.
+dnl Copyright 2003, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -49,7 +36,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_trailing_zeros code and the downshift.
+C the initial count_traling_zeros code and the downshift.
C Possible improvement: Merge more of the feed-in code into the inverse
C computation.
@@ -190,28 +177,22 @@ ifdef(`HAVE_ABI_32',
ld8 r21 = [up], 8
br .Lent
-.Ltop: ld8 r21 = [up], 8
+.Loop: ld8 r21 = [up], 8
xma.l f12 = f9, f8, f10 C q = c * -inverse + si
- nop.b 0
;;
.Lent: add r16 = 160, up
shl r22 = r21, lshift
- nop.b 0
;;
stf8 [rp] = f12, 8
xma.hu f9 = f12, f6, f9 C c = high(q * divisor + c)
- nop.b 0
- nop.m 0
xmpy.l f10 = f11, f7 C si = ulimb * inverse
- nop.b 0
;;
or r31 = r22, r23
shr.u r23 = r21, rshift
- nop.b 0
;;
lfetch [r16]
setf.sig f11 = r31
- br.cloop.sptk.few.clr .Ltop
+ br.cloop.sptk.few.clr .Loop
xma.l f12 = f9, f8, f10 C q = c * -inverse + si
diff --git a/gmp/mpn/ia64/divrem_1.asm b/gmp/mpn/ia64/divrem_1.asm
index e8878209db..aa50ac902b 100644
--- a/gmp/mpn/ia64/divrem_1.asm
+++ b/gmp/mpn/ia64/divrem_1.asm
@@ -1,35 +1,22 @@
dnl IA-64 mpn_divrem_1 and mpn_preinv_divrem_1 -- Divide an mpn number by an
dnl unnormalized limb.
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/ia64/divrem_2.asm b/gmp/mpn/ia64/divrem_2.asm
index 9864311278..da3e9d64b7 100644
--- a/gmp/mpn/ia64/divrem_2.asm
+++ b/gmp/mpn/ia64/divrem_2.asm
@@ -1,45 +1,59 @@
-dnl IA-64 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
+dnl IA-64 mpn_divrem_2 -- Divide an n-limb number by a 2-limb number.
-dnl Copyright 2010, 2013 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 norm frac
-C itanium 1
-C itanium 2 29 29
+C cycles/limb
+C Itanium: 63
+C Itanium 2: 46
C TODO
-C * Inline and interleave limb inversion code with loop setup code.
-C * We should use explicit bundling in much of the code, since it typically
-C cuts some cycles with the GNU assembler.
+C * Further optimize the loop. We could probably do some more trickery with
+C arithmetic in the FPU, or perhaps use a non-zero addend of xma in more
+C places.
+C * Software pipeline for perhaps 5 saved cycles, around the end and start of
+C the loop.
+C * Schedule code outside of loop better.
+C * Update the comments. They are now using the same name for the same
+C logical quantity.
+C * Handle conditional zeroing of r31 in loop more cleanly.
+C * Inline mpn_invert_limb and schedule its insns across the entire init code.
+C * Ultimately, use 2-limb, or perhaps 3-limb or 4-limb inverse.
+
+define(`qp',`r32')
+define(`qxn',`r33')
+define(`np',`r34')
+define(`nn',`r35')
+define(`dp',`r36')
+define(`fnh',`f11')
+define(`fminus1',`f10')
+define(`fd0',`f13')
+define(`fd1',`f14')
+define(`d0',`r39')
+define(`d1',`r36')
+define(`fnl',`f32')
+define(`fdinv',`f12')
+
+define(`R1',`r38') define(`R0',`r37')
+define(`P1',`r28') define(`P0',`r27')
ASM_START()
@@ -47,234 +61,204 @@ C HP's assembler requires these declarations for importing mpn_invert_limb
.global mpn_invert_limb
.type mpn_invert_limb,@function
-C INPUT PARAMETERS
-C qp = r32
-C fn = r33
-C np = r34
-C nn = r35
-C dp = r36
-
-define(`f0x1', `f15')
-
-ASM_START()
PROLOGUE(mpn_divrem_2)
.prologue
-ifdef(`HAVE_ABI_32',
-` addp4 r32 = 0, r32 C M I
- addp4 r34 = 0, r34 C M I
- zxt4 r35 = r35 C I
- addp4 r36 = 0, r36 C M I
- nop.m 0
- zxt4 r33 = r33 C I
- ;;
-')
.save ar.pfs, r42
- alloc r42 = ar.pfs, 5, 9, 1, 0
- shladd r34 = r35, 3, r34
- adds r14 = 8, r36
- mov r43 = r1
- ;;
- adds r15 = -8, r34
- ld8 r39 = [r14]
- .save ar.lc, r45
- mov r45 = ar.lc
- adds r14 = -16, r34
- mov r40 = r0
- adds r34 = -24, r34
- ;;
- ld8 r38 = [r15]
+ .save ar.lc, r44
.save rp, r41
- mov r41 = b0
- .body
- ld8 r36 = [r36]
- ld8 r37 = [r14]
- ;;
- cmp.gtu p6, p7 = r39, r38
- (p6) br.cond.dptk .L8
- ;;
- cmp.leu p8, p9 = r36, r37
- cmp.geu p6, p7 = r39, r38
- ;;
- (p8) cmp4.ne.and.orcm p6, p7 = 0, r0
- (p7) br.cond.dptk .L51
-.L8:
- add r14 = r33, r35 // un + fn
- mov r46 = r39 // argument to mpn_invert_limb
- ;;
- adds r35 = -3, r14
- ;;
- cmp.gt p12, p0 = r0, r35
- (p12) br.cond.dpnt L(end)
- br.call.sptk.many b0 = mpn_invert_limb
- ;;
- setf.sig f11 = r8 // di (non-final)
- setf.sig f34 = r39 // d1
- setf.sig f33 = r36 // d0
- mov r1 = r43
- ;;
- mov r17 = 1
- setf.sig f9 = r38 // n2
- xma.l f6 = f11, f34, f0 // t0 = LO(di * d1)
- ;;
- setf.sig f10 = r37 // n1
- setf.sig f15 = r17 // 1
- xma.hu f8 = f11, f33, f0 // s0 = HI(di * d0)
- ;;
- getf.sig r17 = f6
- getf.sig r16 = f8
- mov ar.lc = r35
- ;;
- sub r18 = r0, r39 // -d1
- add r14 = r17, r36
- ;;
- setf.sig f14 = r18 // -d1
- cmp.leu p8, p9 = r17, r14
- add r16 = r14, r16
- ;;
- (p9) adds r19 = 0, r0
- (p8) adds r19 = -1, r0
- cmp.gtu p6, p7 = r14, r16
- ;;
- (p6) adds r19 = 1, r19
- ;;
-ifelse(1,1,`
- cmp.gt p7, p6 = r0, r19
- ;;
- (p6) adds r8 = -1, r8 // di--
- (p6) sub r14 = r16, r39 // t0 -= d1
- (p6) cmp.ltu p6, p7 = r16, r39 // cy for: t0 - d1
- ;;
- (p6) cmp.gt p9, p8 = 1, r19
- (p7) cmp.gt p9, p8 = 0, r19
- (p6) adds r19 = -1, r19 // t1 -= cy
- mov r16 = r14
- ;;
- (p8) adds r8 = -1, r8 // di--
- (p8) sub r14 = r16, r39 // t0 -= d1
- (p8) cmp.ltu p8, p9 = r16, r39 // cy for: t0 - d1
- ;;
- (p8) cmp.gt p7, p6 = 1, r19
- (p9) cmp.gt p7, p6 = 0, r19
- (p8) adds r19 = -1, r19 // t1 -= cy
- mov r16 = r14
- ;;
- (p6) adds r8 = -1, r8 // di--
- (p6) sub r14 = r16, r39 // t0 -= d1
- (p6) cmp.ltu p6, p7 = r16, r39 // cy for: t0 - d1
- ;;
- (p6) cmp.gt p9, p8 = 1, r19
- (p7) cmp.gt p9, p8 = 0, r19
- (p6) adds r19 = -1, r19 // t1 -= cy
- mov r16 = r14
- ;;
- (p8) adds r8 = -1, r8 // di--
- (p8) sub r14 = r16, r39 // t0 -= d1
- (p8) cmp.ltu p8, p9 = r16, r39 // cy for: t0 - d1
- ;;
- (p8) adds r19 = -1, r19 // t1 -= cy
- mov r16 = r14
-',`
- cmp.gt p8, p9 = r0, r19
- (p8) br.cond.dpnt .L46
-.L52:
- cmp.leu p6, p7 = r39, r16
- sub r14 = r16, r39
- adds r8 = -1, r8
- ;;
- (p7) adds r19 = -1, r19
- mov r16 = r14
+ifdef(`HAVE_ABI_32',
+` addp4 qp = 0, qp C M I
+ addp4 np = 0, np C M I
+ addp4 dp = 0, dp C M I
+ zxt4 nn = nn C I
+ zxt4 qxn = qxn C I
;;
- (p7) cmp.gt p8, p9 = r0, r19
- (p9) br.cond.dptk .L52
-.L46:
')
- setf.sig f32 = r8 // di
- shladd r32 = r35, 3, r32
- ;;
- ALIGN(16)
-L(top): nop 0
- nop 0
- cmp.gt p8, p9 = r33, r35
- ;;
- (p8) mov r37 = r0
- (p9) ld8 r37 = [r34], -8
- xma.hu f8 = f9, f32, f10 // 0,29
- xma.l f12 = f9, f32, f10 // 0
- ;;
- getf.sig r20 = f12 // q0 4
- xma.l f13 = f15, f8, f9 // q += n2 4
- sub r8 = -1, r36 // bitnot d0
- ;;
- getf.sig r18 = f13 // 8
- xma.l f7 = f14, f13, f10 // 8
- xma.l f6 = f33, f13, f33 // t0 = LO(d0*q+d0) 8
- xma.hu f9 = f33, f13, f33 // t1 = HI(d0*q+d0) 9
- ;;
- getf.sig r38 = f7 // n1 12
- getf.sig r16 = f6 // 13
- getf.sig r19 = f9 // 14
- ;;
- sub r38 = r38, r39 // n1 -= d1 17
- ;;
- cmp.ne p9, p0 = r0, r0 // clear p9
- cmp.leu p10, p11 = r16, r37 // cy for: n0 - t0 18
- ;;
- sub r37 = r37, r16 // n0 -= t0 19
- (p11) sub r38 = r38, r19, 1 // n1 -= t1 - cy 19
- (p10) sub r38 = r38, r19 // n1 -= t1 19
- ;;
- cmp.gtu p6, p7 = r20, r38 // n1 >= q0 20
- ;;
- (p7) cmp.ltu p9, p0 = r8, r37 // 21
- (p6) add r18 = 1, r18 //
- (p7) add r37 = r37, r36 // 21
- (p7) add r38 = r38, r39 // 21
+ alloc r42 = ar.pfs, 5,8,1,0 C M2
+ ld8 d0 = [dp], 8 C M0M1 d0
+ mov r44 = ar.lc C I0
+ shladd np = nn, 3, np C M I
+ ;;
+ ld8 d1 = [dp] C M0M1 d1
+ mov r41 = b0 C I0
+ add r15 = -8, np C M I
+ add np = -16, np C M I
+ mov r40 = r0 C M I
+ ;;
+ ld8 R1 = [r15] C M0M1 n1
+ ld8 R0 = [r34], -8 C M0M1 n0
+ ;;
+ cmp.ltu p6, p0 = d1, R1 C M I
+ cmp.eq p8, p0 = d1, R1 C M I
+ ;;
+ (p8) cmp.leu p6, p0 = d0, R0
+ cmp.ltu p8, p9 = R0, d0
+ (p6) br.cond.dpnt .L_high_limb_1 C FIXME: inline!
+.L8:
+
+ mov r45 = d1
+ br.call.sptk.many b0 = mpn_invert_limb C FIXME: inline+schedule
;;
- setf.sig f10 = r37 // n1 22
- (p9) add r38 = 1, r38 // 22
+ setf.sig fd1 = d1 C d1
+ setf.sig fd0 = d0 C d0
+ add r14 = r33, r35 C nn + qxn
;;
- setf.sig f9 = r38 // n2 23
- cmp.gtu p6, p7 = r39, r38 // 23
- (p7) br.cond.spnt L(fix)
-L(bck): st8 [r32] = r18, -8
- adds r35 = -1, r35
- br.cloop.sptk.few L(top)
+ setf.sig fdinv = r8 C dinv
+ mov r9 = -1
+ add r35 = -3, r14
;;
-
-L(end): add r14 = 8, r34
- add r15 = 16, r34
- mov b0 = r41
+ setf.sig fminus1 = r9
+ cmp.gt p6, p0 = r0, r35
+ shladd qp = r35, 3, qp
+ mov ar.lc = r35
+ mov r31 = 0 C n0
+ (p6) br.cond.dpnt .Ldone
;;
- st8 [r14] = r37
- st8 [r15] = r38
- mov ar.pfs = r42
- mov r8 = r40
- mov ar.lc = r45
+ ALIGN(16)
+C *** MAIN LOOP START ***
+.Loop: C 00
+ mov r15 = R0 C nadj = n10
+ cmp.le p14, p15 = 0, R0 C check high bit of R0
+ cmp.le p8, p0 = r33, r35 C dividend limbs remaining?
+ ;; C 01
+ .pred.rel "mutex", p14, p15
+ (p8) ld8 r31 = [r34], -8 C n0
+ (p15) add r15 = d1, R0 C nadj = n10 + d1
+ (p15) add r14 = 1, R1 C nh + (nl:63)
+ (p14) mov r14 = R1 C nh
+ cmp.eq p6, p0 = d1, R1 C nh == d1
+ (p6) br.cond.spnt .L_R1_eq_d1
+ ;; C 02
+ setf.sig f8 = r14 C n2 + (nl:63)
+ setf.sig f15 = r15 C nadj
+ sub r23 = -1, R1 C r23 = ~nh
+ ;; C 03
+ setf.sig fnh = r23
+ setf.sig fnl = R0
+ ;; C 08
+ xma.hu f7 = fdinv, f8, f15 C xh = HI(dinv*(nh-nmask)+nadj)
+ ;; C 12
+ xma.l f7 = f7, fminus1, fnh C nh + xh
+ ;; C 16
+ getf.sig r14 = f7
+ xma.hu f9 = f7, fd1, fnl C xh = HI(q1*d1+nl)
+ xma.l f33 = f7, fd1, fnl C xh = LO(q1*d1+nl)
+ ;; C 20
+ getf.sig r16 = f9
+ sub r24 = d1, R1
+ C 21
+ getf.sig r17 = f33
+ ;; C 25
+ cmp.eq p6, p7 = r16, r24
+ ;; C 26
+ .pred.rel "mutex", p6, p7
+ (p6) xma.l f8 = f7, fminus1, f0 C f8 = -f7
+ (p7) xma.l f8 = f7,fminus1,fminus1 C f8 = -f7-1
+ ;; C 27
+ .pred.rel "mutex", p6, p7
+ (p6) sub r18 = 0, r14 C q = -q1
+ (p7) sub r18 = -1, r14 C q = -q1-1
+ (p6) add r14 = 0, r17 C n1 = xl
+ (p7) add r14 = d1, r17 C n1 = xl + d1
+ ;; C 30
+ xma.hu f9 = fd0, f8, f0 C d0*(-f7-1) = -d0*f7-d0
+ xma.l f35 = fd0, f8, f0
+ ;; C 34
+ getf.sig P1 = f9 C P1
+ C 35
+ getf.sig P0 = f35 C P0
+ ;;
+.L_adj: C 40
+ cmp.ltu p8, p0 = r31, P0 C p8 = cy from low limb
+ cmp.ltu p6, p0 = r14, P1 C p6 = prel cy from high limb
+ sub R0 = r31, P0
+ sub R1 = r14, P1
+ ;; C 41
+ (p8) cmp.eq.or p6, p0 = 0, R1 C p6 = final cy from high limb
+ (p8) add R1 = -1, R1
+ cmp.ne p10, p0 = r0, r0 C clear p10 FIXME: use unc below!
+ cmp.ne p13, p0 = r0, r0 C clear p13 FIXME: use unc below!
+ ;; C 42
+ (p6) add R0 = R0, d0
+ (p6) add R1 = R1, d1
+ (p6) add r18 = -1, r18 C q--
+ ;; C 43
+ (p6) cmp.ltu p10, p0 = R0, d0
+ (p6) cmp.ltu p0, p13 = R1, d1
+ ;; C 44
+ (p10) cmp.ne.and p0, p13 = -1, R1 C p13 = !cy
+ (p10) add R1 = 1, R1
+ (p13) br.cond.spnt .L_two_too_big C jump if not cy
+ ;; C 45
+ st8 [qp] = r18, -8
+ add r35 = -1, r35
+ mov r31 = 0 C n0, next iteration
+ br.cloop.sptk .Loop
+C *** MAIN LOOP END ***
+ ;;
+.Ldone:
+ mov r8 = r40
+ mov b0 = r41
+ add r21 = 8, r34
+ add r22 = 16, r34
+ ;;
+ st8 [r21] = R0
+ st8 [r22] = R1
+ mov ar.pfs = r42
+ mov ar.lc = r44
br.ret.sptk.many b0
- ;;
-.L51:
+
+.L_high_limb_1:
.pred.rel "mutex", p8, p9
- sub r37 = r37, r36
- (p9) sub r38 = r38, r39, 1
- (p8) sub r38 = r38, r39
- adds r40 = 1, r0
- br .L8
+ sub R0 = R0, d0
+ (p8) sub R1 = R1, d1, 1
+ (p9) sub R1 = R1, d1
+ mov r40 = 1
+ br.sptk .L8
;;
-L(fix): cmp.geu p6, p7 = r39, r38
- cmp.leu p8, p9 = r36, r37
+.L_two_too_big:
+ add R0 = R0, d0
+ add R1 = R1, d1
+ ;;
+ add r18 = -1, r18 C q--
+ cmp.ltu p10, p0 = R0, d0
+ ;;
+ (p10) add R1 = 1, R1
+ st8 [qp] = r18, -8
+ add r35 = -1, r35
+ mov r31 = 0 C n0, next iteration
+ br.cloop.sptk .Loop
+ br.sptk .Ldone
+
+.L_R1_eq_d1:
+ add r14 = R0, d1 C r = R0 + d1
+ mov r18 = -1 C q = -1
;;
- (p8) cmp4.ne.and.orcm p6, p7 = 0, r0
- (p6) br.cond.dptk L(bck)
- sub r37 = r37, r36
- (p9) sub r38 = r38, r39, 1
- (p8) sub r38 = r38, r39
- adds r18 = 1, r18
+ cmp.leu p6, p0 = R0, r14
+ (p6) br.cond.spnt .L20 C jump unless cy
;;
- setf.sig f9 = r38 // n2
- setf.sig f10 = r37 // n1
- br L(bck)
-
+ sub P1 = r14, d0
+ add R0 = r31, d0
+ ;;
+ cmp.ltu p8, p9 = R0, r31
+ ;;
+ .pred.rel "mutex", p8, p9
+ st8 [qp] = r18, -8
+ (p8) add R1 = r0, P1, 1 C R1 = n1 - P1 - cy
+ (p9) add R1 = r0, P1 C R1 = n1 - P1
+ add r35 = -1, r35
+ mov r31 = 0 C n0, next iteration
+ br.cloop.sptk .Loop
+ br.sptk .Ldone
+ ;;
+.L20: cmp.ne p6, p7 = 0, d0
+ ;;
+ .pred.rel "mutex", p6, p7
+ (p6) add P1 = -1, d0
+ (p7) mov P1 = d0
+ sub P0 = r0, d0
+ br.sptk .L_adj
EPILOGUE()
ASM_END()
diff --git a/gmp/mpn/ia64/gcd_1.asm b/gmp/mpn/ia64/gcd_1.asm
index 28e9a63ca3..d3840a6bd8 100644
--- a/gmp/mpn/ia64/gcd_1.asm
+++ b/gmp/mpn/ia64/gcd_1.asm
@@ -1,42 +1,28 @@
dnl Itanium-2 mpn_gcd_1 -- mpn by 1 gcd.
-dnl Contributed to the GNU project by Kevin Ryde, innerloop by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2002-2005, 2012, 2013 Free Software Foundation, Inc.
+dnl Copyright 2002, 2003, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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/bitpair (1x1 gcd)
-C Itanium: ?
-C Itanium 2: 5.1
+C itanium2: 6.3
+C itanium: 14 (approx)
C mpn_gcd_1 (mp_srcptr xp, mp_size_t xsize, mp_limb_t y);
@@ -59,13 +45,29 @@ C The main loop consists of transforming x,y to abs(x-y),min(x,y), and then
C stripping factors of 2 from abs(x-y). Those factors of two are
C determined from just y-x, without the abs(), since there's the same
C number of trailing zeros on n or -n in twos complement. That makes the
-C dependent chain 8 cycles deep.
+C dependent chain
+C
+C cycles
+C 1 sub x-y and x-y-1
+C 3 andcm (x-y-1)&~(x-y)
+C 2 popcnt trailing zeros
+C 3 shr.u strip abs(x-y)
+C ---
+C 9
C
C The selection of x-y versus y-x for abs(x-y), and the selection of the
-C minimum of x and y, is done in parallel with the critical path.
+C minimum of x and y, is done in parallel with the above.
C
C The algorithm takes about 0.68 iterations per bit (two N bit operands) on
-C average, hence the final 5.8 cycles/bitpair.
+C average, hence the final 6.3 cycles/bitpair.
+C
+C The loop is not as fast as one might hope, since there's extra latency
+C from andcm going across to the `multimedia' popcnt, and vice versa from
+C multimedia shr.u back to the integer sub.
+C
+C The loop branch is .sptk.clr since we usually expect a good number of
+C iterations, and the iterations are data dependent so it's unlikely past
+C results will predict anything much about the future.
C
C Not done:
C
@@ -86,10 +88,13 @@ C only going down I0), perhaps it'd be possible to shift left instead,
C using add. That would mean keeping track of the lowest not-yet-zeroed
C bit, using some sort of mask.
C
-C TODO:
-C * Once mod_1_N exists in assembly for Itanium, add conditional calls.
-C * Call bmod_1 even for n=1 when up[0] >> v0 (like other gcd_1 impls).
-C * Probably avoid popcnt also outside of loop, instead use ctz_table.
+C Itanium-1:
+C
+C This code is not designed for itanium-1 and in fact doesn't run well on
+C that chip. The loop seems to be about 21 cycles, probably because we end
+C up with a 10 cycle replay for not forcibly scheduling the shr.u latency.
+C Lack of branch hints might introduce a couple of bubbles too.
+C
ASM_START()
.explicit C What does this mean?
@@ -98,19 +103,6 @@ C HP's assembler requires these declarations for importing mpn_modexact_1c_odd
.global mpn_modexact_1c_odd
.type mpn_modexact_1c_odd,@function
-C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
-
-deflit(MAXSHIFT, 7)
-deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
-
- .section ".rodata"
- ALIGN(m4_lshift(1,MAXSHIFT)) C align table to allow using dep
-ctz_table:
- .byte MAXSHIFT
-forloop(i,1,MASK,
-` .byte m4_count_trailing_zeros(i)
-')
-
PROLOGUE(mpn_gcd_1)
C r32 xp
@@ -154,9 +146,13 @@ ifdef(`HAVE_ABI_32',
mov out_carry = 0
+ C
+
popcnt y_twos = y_twos C I0 y twos
;;
+ C
+
{ .mmi; add x_orig_one = -1, x_orig C M0 orig x-1
shr.u out_divisor = y, y_twos C I0 y without twos
}{ shr.u y = y, y_twos C I1 y without twos
@@ -173,62 +169,63 @@ ifdef(`HAVE_ABI_32',
mov b0 = save_rp C I0
} ;;
+ C
+
popcnt x_orig = x_orig C I0 orig x twos
+
popcnt r9 = r9 C I0 x twos
;;
+ C
+
{ cmp.lt p7,p0 = x_orig, y_twos C M0 orig x_twos < y_twos
shr.u x = x, r9 C I0 x odd
} ;;
{ (p7) mov y_twos = x_orig C M0 common twos
add r10 = -1, y C I0 y-1
- (p6) br.dpnt.few L(done_y) C B0 x%y==0 then result y
+ (p6) br.dpnt.few .Ldone_y C B0 x%y==0 then result y
} ;;
- 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; (p7) mov y = x
- (p6) sub x = x, y
- dep r21 = r19, r22, 0, MAXSHIFT C concat(table,lowbits)
-.mmi; and r20 = MASK, r19
- (p7) mov x = r19
- nop 0
- ;;
-L(mid):
-.mmb; ld1 r16 = [r21]
- cmp.eq p10,p0 = 0, r20
- (p10) br.spnt.few.clr L(shift_alot)
- ;;
-.mmi; nop 0
- nop 0
- shr.u x = x, r16
+ C
+
+
+ C No noticable difference in speed for the loop aligned to
+ C 32 or just 16.
+.Ltop:
+ C r8 x
+ C r10 y-1
+ C r34 y
+ C r38 common twos, for use at end
+
+{ .mmi; cmp.gtu p8,p9 = x, y C M0 x>y
+ cmp.ne p10,p0 = x, y C M1 x==y
+ sub r9 = y, x C I0 d = y - x
+}{ .mmi; sub r10 = r10, x C M2 d-1 = y - x - 1
+} ;;
+
+{ .mmi; .pred.rel "mutex", p8, p9
+ (p8) sub x = x, y C M0 x>y use x=x-y, y unchanged
+ (p9) mov y = x C M1 y>=x use y=x
+ (p9) mov x = r9 C I0 y>=x use x=y-x
+}{ .mmi; andcm r9 = r10, r9 C M2 (d-1)&~d
;;
-L(ent):
-.mmi; sub r19 = y, x
- cmp.gtu p6,p7 = x, y
- cmp.ne p8,p0 = x, y
-.mmb; nop 0
- nop 0
- (p8) br.sptk.few.clr L(top)
+
+ add r10 = -1, y C M0 new y-1
+ popcnt r9 = r9 C I0 twos on x-y
+} ;;
+
+{ shr.u x = x, r9 C I0 new x without twos
+ (p10) br.sptk.few.clr .Ltop
+} ;;
+
C result is y
-L(done_y):
- mov ar.pfs = save_pfs C I0
+.Ldone_y:
shl r8 = y, y_twos C I common factors of 2
+ ;;
+ mov ar.pfs = save_pfs C I0
br.ret.sptk.many b0
-L(shift_alot):
- and r20 = x, r25
- shr.u x = x, MAXSHIFT
- ;;
- dep r21 = x, r22, 0, MAXSHIFT
- br L(mid)
EPILOGUE()
diff --git a/gmp/mpn/ia64/gmp-mparam.h b/gmp/mpn/ia64/gmp-mparam.h
index bdbd62d974..9391887e10 100644
--- a/gmp/mpn/ia64/gmp-mparam.h
+++ b/gmp/mpn/ia64/gmp-mparam.h
@@ -1,204 +1,72 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2000-2005, 2009-2011, 2014 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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
-
-/* 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 */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 26
-#define MOD_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 40
-#define MUL_TOOM33_THRESHOLD 129
-#define MUL_TOOM44_THRESHOLD 212
-#define MUL_TOOM6H_THRESHOLD 318
-#define MUL_TOOM8H_THRESHOLD 430
-
-#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 82
-#define SQR_TOOM3_THRESHOLD 131
-#define SQR_TOOM4_THRESHOLD 494
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 0 /* always */
-
-#define MULMID_TOOM42_THRESHOLD 98
-
-#define MULMOD_BNM1_THRESHOLD 23
-#define SQRMOD_BNM1_THRESHOLD 19
-
-#define MUL_FFT_MODF_THRESHOLD 500 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, { 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}, { 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}, \
- { 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}, { 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 468 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 468, 5}, { 29, 6}, { 15, 5}, { 31, 6}, \
- { 35, 7}, { 18, 6}, { 37, 7}, { 37, 8}, \
- { 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 11616
-
-#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 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 148
-
-#define MU_DIV_QR_THRESHOLD 1187
-#define MU_DIVAPPR_Q_THRESHOLD 1142
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#define MU_BDIV_QR_THRESHOLD 1308
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define POWM_SEC_TABLE 1,28,251,1925
-
-#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 14
-#define GET_STR_PRECOMPUTE_THRESHOLD 20
-#define SET_STR_DC_THRESHOLD 1216
-#define SET_STR_PRECOMPUTE_THRESHOLD 3170
-
-#define FAC_DSC_THRESHOLD 746
-#define FAC_ODD_THRESHOLD 0 /* always */
+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 BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+
+/* 1300MHz Itanium2 (babe.fsffrance.org) */
+
+/* Generated by tuneup.c, 2009-03-04, gcc 4.2 */
+
+#define MUL_KARATSUBA_THRESHOLD 44
+#define MUL_TOOM3_THRESHOLD 137
+#define MUL_TOOM44_THRESHOLD 230
+
+#define SQR_BASECASE_THRESHOLD 25
+#define SQR_KARATSUBA_THRESHOLD 119
+#define SQR_TOOM3_THRESHOLD 146
+#define SQR_TOOM4_THRESHOLD 284
+
+#define MULLOW_BASECASE_THRESHOLD 19
+#define MULLOW_DC_THRESHOLD 120
+#define MULLOW_MUL_N_THRESHOLD 357
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* preinv always */
+#define DIV_DC_THRESHOLD 70
+#define POWM_THRESHOLD 312
+
+#define MATRIX22_STRASSEN_THRESHOLD 29
+#define HGCD_THRESHOLD 118
+#define GCD_DC_THRESHOLD 595
+#define GCDEXT_DC_THRESHOLD 584
+#define JACOBI_BASE_METHOD 1
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 8
+#define MOD_1_2_THRESHOLD 9
+#define MOD_1_4_THRESHOLD 20
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1 /* preinv always */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 17
+#define GET_STR_PRECOMPUTE_THRESHOLD 25
+#define SET_STR_DC_THRESHOLD 1488
+#define SET_STR_PRECOMPUTE_THRESHOLD 3590
+
+#define MUL_FFT_TABLE { 528, 1184, 1856, 3840, 11264, 28672, 114688, 327680, 0 }
+#define MUL_FFT_MODF_THRESHOLD 784
+#define MUL_FFT_THRESHOLD 6656
+
+#define SQR_FFT_TABLE { 592, 1248, 2368, 3840, 11264, 28672, 81920, 327680, 0 }
+#define SQR_FFT_MODF_THRESHOLD 608
+#define SQR_FFT_THRESHOLD 4992
diff --git a/gmp/mpn/ia64/hamdist.asm b/gmp/mpn/ia64/hamdist.asm
index 477df4cd71..b150a429cb 100644
--- a/gmp/mpn/ia64/hamdist.asm
+++ b/gmp/mpn/ia64/hamdist.asm
@@ -1,39 +1,25 @@
dnl IA-64 mpn_hamdist -- mpn hamming distance.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2003-2005 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
+dnl Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
dnl
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 2
C Itanium 2: 1
C INPUT PARAMETERS
diff --git a/gmp/mpn/ia64/ia64-defs.m4 b/gmp/mpn/ia64/ia64-defs.m4
index f71d280b17..65ade991d0 100644
--- a/gmp/mpn/ia64/ia64-defs.m4
+++ b/gmp/mpn/ia64/ia64-defs.m4
@@ -2,32 +2,21 @@ divert(-1)
dnl Copyright 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl ia64 assembler comments are C++ style "//" to the end of line. gas
@@ -86,7 +75,7 @@ dnl
dnl Emit a ".align" directive. "bytes" is eval()ed, so can be an
dnl expression.
dnl
-dnl This version overrides the definition in mpn/asm-defs.m4. We suppress
+dnl This version overrides the definition in mpn/asm-defs.m4. We supress
dnl any .align if the gas byte-swapped-nops bug was detected by configure
dnl GMP_ASM_IA64_ALIGN_OK.
@@ -99,7 +88,7 @@ m4_assert_defined(`IA64_ALIGN_OK')
dnl Usage: ASSERT([pr] [,code])
dnl
-dnl Require that the given predicate register is true after executing the
+dnl Require that the given predictate register is true after executing the
dnl test code. For example,
dnl
dnl ASSERT(p6,
@@ -131,17 +120,5 @@ define(`ASSERT_label_counter',eval(ASSERT_label_counter+1))
')')
define(`ASSERT_label_counter',1)
-define(`getfsig', `getf.sig')
-define(`setfsig', `setf.sig')
-define(`cmpeq', `cmp.eq')
-define(`cmpne', `cmp.ne')
-define(`cmpltu', `cmp.ltu')
-define(`cmpleu', `cmp.leu')
-define(`cmpgtu', `cmp.gtu')
-define(`cmpgeu', `cmp.geu')
-define(`cmple', `cmp.le')
-define(`cmpgt', `cmp.gt')
-define(`cmpeqor', `cmp.eq.or')
-define(`cmpequc', `cmp.eq.unc')
divert
diff --git a/gmp/mpn/ia64/invert_limb.asm b/gmp/mpn/ia64/invert_limb.asm
index 5effdda815..982886e549 100644
--- a/gmp/mpn/ia64/invert_limb.asm
+++ b/gmp/mpn/ia64/invert_limb.asm
@@ -1,34 +1,21 @@
dnl IA-64 mpn_invert_limb -- Invert a normalized limb.
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -36,7 +23,7 @@ C INPUT PARAMETERS
C d = r32
C cycles
-C Itanium: 74
+C Itanium: ?
C Itanium 2: 50+6
C It should be possible to avoid the xmpy.hu and the following tests by
diff --git a/gmp/mpn/ia64/logops_n.asm b/gmp/mpn/ia64/logops_n.asm
index e4a2f61cce..3ab9d2518b 100644
--- a/gmp/mpn/ia64/logops_n.asm
+++ b/gmp/mpn/ia64/logops_n.asm
@@ -1,35 +1,22 @@
dnl IA-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 Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2003-2005 Free Software Foundation, Inc.
-
+dnl Copyright 2003, 2004, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
@@ -91,8 +78,6 @@ 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/gmp/mpn/ia64/lorrshift.asm b/gmp/mpn/ia64/lorrshift.asm
index 694aaf0f40..59badebc6a 100644
--- a/gmp/mpn/ia64/lorrshift.asm
+++ b/gmp/mpn/ia64/lorrshift.asm
@@ -1,57 +1,40 @@
dnl IA-64 mpn_lshift/mpn_rshift.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2000-2005 Free Software Foundation, Inc.
+dnl Copyright 2000, 2001, 2002, 2003, 2004, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 2
-C Itanium 2: 1
+C Itanium: 2.0
+C Itanium 2: 1.0
C This code is scheduled deeply since the plain shift instructions shr and shl
C have a latency of 4 (on Itanium) or 3 (on Itanium 2). Poor scheduling of
C these instructions cause a 10 cycle replay trap on Itanium.
-C The ld8 scheduling should probably be decreased to make the function smaller.
-C Good lfetch will make sure we never stall anyway.
-
-C We should actually issue the first ld8 at cycle 0, and the first BSH/FSH pair
-C at cycle 2. Judicious use of predicates could allow us to issue more ld8's
-C in the prologue.
-
+C TODO
+C * Optimize function entry and feed-in code.
C INPUT PARAMETERS
-define(`rp', `r32')
-define(`up', `r33')
-define(`n', `r34')
+define(`rp',`r32')
+define(`up',`r33')
+define(`n',`r34')
define(`cnt',`r35')
define(`tnc',`r9')
@@ -78,281 +61,284 @@ MULFUNC_PROLOGUE(mpn_lshift mpn_rshift)
ASM_START()
PROLOGUE(func)
.prologue
- .save ar.lc, r2
+ .save ar.lc, r2
.body
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
+` addp4 rp = 0, rp C M I
+ addp4 up = 0, up C M I
+ sxt4 n = n C M I
+ zxt4 cnt = cnt C I
;;
')
- {.mmi; cmp.lt p14, p15 = 4, n C M I
- and r14 = 3, n C M I
- mov.i r2 = ar.lc C I0
-}{.mmi; add r15 = -1, n C M I
- sub tnc = 64, cnt C M I
- add r16 = -5, n
- ;;
-}{.mmi; cmp.eq p6, p0 = 1, r14 C M I
- cmp.eq p7, p0 = 2, r14 C M I
- shr.u n = r16, 2 C I0
-}{.mmi; cmp.eq p8, p0 = 3, r14 C M I
+ {.mmi; cmp.lt p14, p15 = 4, n C M I
+ and r14 = 3, n C M I
+ mov.i r2 = ar.lc C I0
+}{.mmi; add r15 = -1, n C M I
+ sub tnc = 64, cnt C M I
+ add r16 = -5, n
+ ;;
+}{.mmi; cmp.eq p6, p0 = 1, r14 C M I
+ cmp.eq p7, p0 = 2, r14 C M I
+ shr.u n = r16, 2 C I0
+}{.mmi; cmp.eq p8, p0 = 3, r14 C M I
ifdef(`OPERATION_lshift',
-` shladd up = r15, 3, up C M I
- shladd rp = r15, 3, rp') C M I
+` shladd up = r15, 3, up C M I
+ shladd rp = r15, 3, rp') C M I
;;
-}{.mmi; add r11 = POFF, up C M I
- ld8 r10 = [up], UPD C M01
- mov.i ar.lc = n C I0
+}{.mmi; add r11 = POFF, up C M I
+ ld8 r10 = [up], UPD C M01
+ mov.i ar.lc = n C I0
}{.bbb;
- (p6) br.dptk .Lb01
- (p7) br.dptk .Lb10
- (p8) br.dptk .Lb11
- ;; }
-
-.Lb00: ld8 r19 = [up], UPD
+ (p6) br.dptk .Lb01
+ (p7) br.dptk .Lb10
+ (p8) br.dptk .Lb11
;;
- ld8 r16 = [up], UPD
+}
+
+.Lb00: ld8 r19 = [up], UPD
;;
- ld8 r17 = [up], UPD
- BSH r8 = r10, tnc C function return value
+ ld8 r16 = [up], UPD
;;
- FSH r24 = r10, cnt
- BSH r25 = r19, tnc
+ ld8 r17 = [up], UPD
+ BSH r8 = r10, tnc C function return value
(p14) br.cond.dptk .grt4
+
+ FSH r24 = r10, cnt
+ BSH r25 = r19, tnc
;;
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
+ FSH r26 = r19, cnt
+ BSH r27 = r16, tnc
;;
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
+ FSH r20 = r16, cnt
+ BSH r21 = r17, tnc
;;
- or r14 = r25, r24
- FSH r22 = r17, cnt
- BSH r23 = r10, tnc
- br .Lr4
+ or r14 = r25, r24
+ FSH r22 = r17, cnt
+ BSH r23 = r10, tnc
+ br .Lr4
-.grt4: ld8 r18 = [up], UPD
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
+.grt4: FSH r24 = r10, cnt
+ BSH r25 = r19, tnc
;;
- ld8 r19 = [up], UPD
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
+ ld8 r18 = [up], UPD
+ FSH r26 = r19, cnt
+ BSH r27 = r16, tnc
;;
- ld8 r16 = [up], UPD
- FSH r22 = r17, cnt
- BSH r23 = r18, tnc
+ ld8 r19 = [up], UPD
+ FSH r20 = r16, cnt
+ BSH r21 = r17, tnc
;;
- or r14 = r25, r24
- ld8 r17 = [up], UPD
+ ld8 r16 = [up], UPD
+ FSH r22 = r17, cnt
+ BSH r23 = r18, tnc
+ ;;
+ or r14 = r25, r24
+ ld8 r17 = [up], UPD
br.cloop.dpnt .Ltop
- br .Lbot
+ br .Lbot
.Lb01:
- (p15) BSH r8 = r10, tnc C function return value I
- (p15) FSH r22 = r10, cnt C I
- (p15) br.cond.dptk .Lr1 C return B
+ (p15) BSH r8 = r10, tnc C function return value I
+ (p15) FSH r22 = r10, cnt C I
+ (p15) br.cond.dptk .Lr1 C return B
-.grt1: ld8 r18 = [up], UPD
+.grt1: ld8 r18 = [up], UPD
;;
- ld8 r19 = [up], UPD
- BSH r8 = r10, tnc C function return value
+ ld8 r19 = [up], UPD
+ BSH r8 = r10, tnc C function return value
;;
- ld8 r16 = [up], UPD
- FSH r22 = r10, cnt
- BSH r23 = r18, tnc
+ ld8 r16 = [up], UPD
+ FSH r22 = r10, cnt
+ BSH r23 = r18, tnc
;;
- ld8 r17 = [up], UPD
- FSH r24 = r18, cnt
- BSH r25 = r19, tnc
+ ld8 r17 = [up], UPD
br.cloop.dpnt .grt5
;;
- or r15 = r23, r22
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
+
+ FSH r24 = r18, cnt
+ BSH r25 = r19, tnc
+ ;;
+ or r15 = r23, r22
+ FSH r26 = r19, cnt
+ BSH r27 = r16, tnc
;;
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
- br .Lr5
+ FSH r20 = r16, cnt
+ BSH r21 = r17, tnc
+ br .Lr5
-.grt5: ld8 r18 = [up], UPD
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
+.grt5: FSH r24 = r18, cnt
+ BSH r25 = r19, tnc
;;
- ld8 r19 = [up], UPD
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
+ ld8 r18 = [up], UPD
+ FSH r26 = r19, cnt
+ BSH r27 = r16, tnc
;;
- or r15 = r23, r22
- ld8 r16 = [up], UPD
- br .LL01
+ ld8 r19 = [up], UPD
+ FSH r20 = r16, cnt
+ BSH r21 = r17, tnc
+ ;;
+ or r15 = r23, r22
+ ld8 r16 = [up], UPD
+ br .LL01
-.Lb10: ld8 r17 = [up], UPD
+.Lb10: ld8 r17 = [up], UPD
(p14) br.cond.dptk .grt2
- BSH r8 = r10, tnc C function return value
+ BSH r8 = r10, tnc C function return value
;;
- FSH r20 = r10, cnt
- BSH r21 = r17, tnc
+ FSH r20 = r10, cnt
+ BSH r21 = r17, tnc
;;
- or r14 = r21, r20
- FSH r22 = r17, cnt
- br .Lr2 C return
+ or r14 = r21, r20
+ FSH r22 = r17, cnt
+ br .Lr2 C return
-.grt2: ld8 r18 = [up], UPD
- BSH r8 = r10, tnc C function return value
+.grt2: ld8 r18 = [up], UPD
+ BSH r8 = r10, tnc C function return value
;;
- ld8 r19 = [up], UPD
- FSH r20 = r10, cnt
- BSH r21 = r17, tnc
+ ld8 r19 = [up], UPD
+ FSH r20 = r10, cnt
+ BSH r21 = r17, tnc
;;
- ld8 r16 = [up], UPD
- FSH r22 = r17, cnt
- BSH r23 = r18, tnc
+ ld8 r16 = [up], UPD
+ FSH r22 = r17, cnt
+ BSH r23 = r18, tnc
;;
- {.mmi; ld8 r17 = [up], UPD
- or r14 = r21, r20
- FSH r24 = r18, cnt
-}{.mib; nop 0
- BSH r25 = r19, tnc
+ ld8 r17 = [up], UPD
br.cloop.dpnt .grt6
- ;; }
+ ;;
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
- br .Lr6
+ or r14 = r21, r20
+ FSH r24 = r18, cnt
+ BSH r25 = r19, tnc
+ ;;
+ FSH r26 = r19, cnt
+ BSH r27 = r16, tnc
+ br .Lr6
-.grt6: ld8 r18 = [up], UPD
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
+.grt6: or r14 = r21, r20
+ FSH r24 = r18, cnt
+ BSH r25 = r19, tnc
;;
- ld8 r19 = [up], UPD
- br .LL10
+ ld8 r18 = [up], UPD
+ FSH r26 = r19, cnt
+ BSH r27 = r16, tnc
+ ;;
+ ld8 r19 = [up], UPD
+ br .LL10
-.Lb11: ld8 r16 = [up], UPD
+.Lb11: ld8 r16 = [up], UPD
;;
- ld8 r17 = [up], UPD
- BSH r8 = r10, tnc C function return value
+ ld8 r17 = [up], UPD
+ BSH r8 = r10, tnc C function return value
(p14) br.cond.dptk .grt3
;;
- FSH r26 = r10, cnt
- BSH r27 = r16, tnc
+ FSH r26 = r10, cnt
+ BSH r27 = r16, tnc
;;
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
+ FSH r20 = r16, cnt
+ BSH r21 = r17, tnc
;;
- or r15 = r27, r26
- FSH r22 = r17, cnt
- br .Lr3 C return
+ or r15 = r27, r26
+ FSH r22 = r17, cnt
+ br .Lr3 C return
-.grt3: ld8 r18 = [up], UPD
- FSH r26 = r10, cnt
- BSH r27 = r16, tnc
+.grt3: ld8 r18 = [up], UPD
+ FSH r26 = r10, cnt
+ BSH r27 = r16, tnc
;;
- ld8 r19 = [up], UPD
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
+ ld8 r19 = [up], UPD
+ FSH r20 = r16, cnt
+ BSH r21 = r17, tnc
;;
- ld8 r16 = [up], UPD
- FSH r22 = r17, cnt
- BSH r23 = r18, tnc
+ ld8 r16 = [up], UPD
+ FSH r22 = r17, cnt
+ BSH r23 = r18, tnc
;;
- ld8 r17 = [up], UPD
+ ld8 r17 = [up], UPD
br.cloop.dpnt .grt7
- or r15 = r27, r26
- FSH r24 = r18, cnt
- BSH r25 = r19, tnc
- br .Lr7
+ or r15 = r27, r26
+ FSH r24 = r18, cnt
+ BSH r25 = r19, tnc
+ br .Lr7
-.grt7: or r15 = r27, r26
- FSH r24 = r18, cnt
- BSH r25 = r19, tnc
- ld8 r18 = [up], UPD
- br .LL11
+.grt7: or r15 = r27, r26
+ FSH r24 = r18, cnt
+ BSH r25 = r19, tnc
+ ld8 r18 = [up], UPD
+ br .LL11
C *** MAIN LOOP START ***
ALIGN(32)
.Ltop:
- {.mmi; st8 [rp] = r14, UPD C M2
- or r15 = r27, r26 C M3
- FSH r24 = r18, cnt C I0
-}{.mmi; ld8 r18 = [up], UPD C M1
- lfetch [r11], PUPD
- BSH r25 = r19, tnc C I1
+ {.mmi; st8 [rp] = r14, UPD C M2
+ or r15 = r27, r26 C M3
+ FSH r24 = r18, cnt C I0
+}{.mmi; ld8 r18 = [up], UPD C M1
+ lfetch [r11], PUPD
+ BSH r25 = r19, tnc C I1
;; }
.LL11:
- {.mmi; st8 [rp] = r15, UPD
- or r14 = r21, r20
- FSH r26 = r19, cnt
-}{.mmi; ld8 r19 = [up], UPD
- nop.m 0
- BSH r27 = r16, tnc
+ {.mmi; st8 [rp] = r15, UPD
+ or r14 = r21, r20
+ FSH r26 = r19, cnt
+}{.mmi; ld8 r19 = [up], UPD
+ nop.m 0
+ BSH r27 = r16, tnc
;; }
.LL10:
- {.mmi; st8 [rp] = r14, UPD
- or r15 = r23, r22
- FSH r20 = r16, cnt
-}{.mmi; ld8 r16 = [up], UPD
- nop.m 0
- BSH r21 = r17, tnc
+ {.mmi; st8 [rp] = r14, UPD
+ or r15 = r23, r22
+ FSH r20 = r16, cnt
+}{.mmi; ld8 r16 = [up], UPD
+ nop.m 0
+ BSH r21 = r17, tnc
;; }
.LL01:
- {.mmi; st8 [rp] = r15, UPD
- or r14 = r25, r24
- FSH r22 = r17, cnt
-}{.mib; ld8 r17 = [up], UPD
- BSH r23 = r18, tnc
+ {.mmi; st8 [rp] = r15, UPD
+ or r14 = r25, r24
+ FSH r22 = r17, cnt
+}{.mib; ld8 r17 = [up], UPD
+ BSH r23 = r18, tnc
br.cloop.dptk .Ltop
;; }
+
C *** MAIN LOOP END ***
-.Lbot:
- {.mmi; st8 [rp] = r14, UPD
- or r15 = r27, r26
- FSH r24 = r18, cnt
-}{.mib; nop 0
- BSH r25 = r19, tnc
- nop 0
- ;; }
-.Lr7:
- {.mmi; st8 [rp] = r15, UPD
- or r14 = r21, r20
- FSH r26 = r19, cnt
-}{.mib; nop 0
- BSH r27 = r16, tnc
- nop 0
- ;; }
-.Lr6:
- {.mmi; st8 [rp] = r14, UPD
- or r15 = r23, r22
- FSH r20 = r16, cnt
-}{.mib; nop 0
- BSH r21 = r17, tnc
- nop 0
- ;; }
-.Lr5: st8 [rp] = r15, UPD
- or r14 = r25, r24
- FSH r22 = r17, cnt
+.Lbot: or r15 = r27, r26
+ FSH r24 = r18, cnt
+ BSH r25 = r19, tnc
+ st8 [rp] = r14, UPD
+ ;;
+.Lr7: or r14 = r21, r20
+ FSH r26 = r19, cnt
+ BSH r27 = r16, tnc
+ st8 [rp] = r15, UPD
+ ;;
+.Lr6: or r15 = r23, r22
+ FSH r20 = r16, cnt
+ BSH r21 = r17, tnc
+ st8 [rp] = r14, UPD
+ ;;
+.Lr5: st8 [rp] = r15, UPD
+ or r14 = r25, r24
+ FSH r22 = r17, cnt
;;
-.Lr4: st8 [rp] = r14, UPD
- or r15 = r27, r26
+.Lr4: or r15 = r27, r26
+ st8 [rp] = r14, UPD
;;
-.Lr3: st8 [rp] = r15, UPD
- or r14 = r21, r20
+.Lr3: or r14 = r21, r20
+ st8 [rp] = r15, UPD
;;
-.Lr2: st8 [rp] = r14, UPD
+.Lr2: st8 [rp] = r14, UPD
;;
-.Lr1: st8 [rp] = r22, UPD C M23
- mov ar.lc = r2 C I0
- br.ret.sptk.many b0 C B
+.Lr1: st8 [rp] = r22, UPD C M23
+ mov ar.lc = r2 C I0
+ br.ret.sptk.many b0 C B
EPILOGUE(func)
ASM_END()
diff --git a/gmp/mpn/ia64/lshiftc.asm b/gmp/mpn/ia64/lshiftc.asm
deleted file mode 100644
index c402486484..0000000000
--- a/gmp/mpn/ia64/lshiftc.asm
+++ /dev/null
@@ -1,463 +0,0 @@
-dnl IA-64 mpn_lshiftc.
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.25
-
-C This code is scheduled deeply since the plain shift instructions shr and shl
-C have a latency of 4 (on Itanium) or 3 (on Itanium 2). Poor scheduling of
-C these instructions cause a 10 cycle replay trap on Itanium.
-
-C The ld8 scheduling should probably be decreased to make the function smaller.
-C Good lfetch will make sure we never stall anyway.
-
-C We should actually issue the first ld8 at cycle 0, and the first BSH/FSH pair
-C at cycle 2. Judicious use of predicates could allow us to issue more ld8's
-C in the prologue.
-
-
-C INPUT PARAMETERS
-define(`rp', `r32')
-define(`up', `r33')
-define(`n', `r34')
-define(`cnt',`r35')
-
-define(`tnc',`r9')
-
-define(`FSH',`shl')
-define(`BSH',`shr.u')
-define(`UPD',`-8')
-define(`POFF',`-512')
-define(`PUPD',`-32')
-define(`func',`mpn_lshiftc')
-
-ASM_START()
-PROLOGUE(mpn_lshiftc)
- .prologue
- .save ar.lc, r2
- .body
-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
- ;;
-')
-
- {.mmi; nop 0 C M I
- and r14 = 3, n C M I
- mov.i r2 = ar.lc C I0
-}{.mmi; add r15 = -1, n C M I
- sub tnc = 64, cnt C M I
- nop 0
- ;;
-}{.mmi; cmp.eq p6, p0 = 1, r14 C M I
- cmp.eq p7, p0 = 2, r14 C M I
- shr.u n = r15, 2 C I0
-}{.mmi; cmp.eq p8, p0 = 3, r14 C M I
- shladd up = r15, 3, up C M I
- shladd rp = r15, 3, rp C M I
- ;;
-}{.mmi; add r11 = POFF, up C M I
- ld8 r10 = [up], UPD C M01
- mov.i ar.lc = n C I0
-}{.bbb;
- (p6) br.dptk .Lb01
- (p7) br.dptk .Lb10
- (p8) br.dptk .Lb11
- ;; }
-
-.Lb00:
- ld8 r19 = [up], UPD
- ;;
- ld8 r16 = [up], UPD
- ;;
- ld8 r17 = [up], UPD
- BSH r8 = r10, tnc
- br.cloop.dptk L(gt4)
- ;;
- FSH r24 = r10, cnt
- BSH r25 = r19, tnc
- ;;
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
- ;;
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
- ;;
- or r14 = r25, r24
- FSH r22 = r17, cnt
- ;;
- or r15 = r27, r26
- sub r31 = -1, r14
- br .Lr4
-
-L(gt4):
- {.mmi; nop 0
- nop 0
- FSH r24 = r10, cnt
-}{.mmi; ld8 r18 = [up], UPD
- nop 0
- BSH r25 = r19, tnc
- ;; }
- {.mmi; nop 0
- nop 0
- FSH r26 = r19, cnt
-}{.mmi; ld8 r19 = [up], UPD
- nop 0
- BSH r27 = r16, tnc
- ;; }
- {.mmi; nop 0
- nop 0
- FSH r20 = r16, cnt
-}{.mmi; ld8 r16 = [up], UPD
- nop 0
- BSH r21 = r17, tnc
- ;; }
- {.mmi; nop 0
- or r14 = r25, r24
- FSH r22 = r17, cnt
-}{.mib; ld8 r17 = [up], UPD
- BSH r23 = r18, tnc
- br.cloop.dptk L(gt8)
- ;; }
- {.mmi; nop 0
- or r15 = r27, r26
- FSH r24 = r18, cnt
-}{.mib; sub r31 = -1, r14
- BSH r25 = r19, tnc
- br .Lr8 }
-
-L(gt8):
- or r15 = r27, r26
- FSH r24 = r18, cnt
- ld8 r18 = [up], UPD
- sub r31 = -1, r14
- BSH r25 = r19, tnc
- br .LL00
-
-.Lb01:
- br.cloop.dptk L(gt1)
- ;;
- BSH r8 = r10, tnc
- FSH r22 = r10, cnt
- ;;
- sub r31 = -1, r22
- br .Lr1
- ;;
-L(gt1):
- ld8 r18 = [up], UPD
- BSH r8 = r10, tnc
- FSH r22 = r10, cnt
- ;;
- ld8 r19 = [up], UPD
- ;;
- ld8 r16 = [up], UPD
- ;;
- ld8 r17 = [up], UPD
- BSH r23 = r18, tnc
- br.cloop.dptk L(gt5)
- ;;
- nop 0
- FSH r24 = r18, cnt
- BSH r25 = r19, tnc
- ;;
- nop 0
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
- ;;
- or r15 = r23, r22
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
- ;;
- or r14 = r25, r24
- FSH r22 = r17, cnt
- sub r31 = -1, r15
- br .Lr5
-
-L(gt5):
- {.mmi; nop 0
- nop 0
- FSH r24 = r18, cnt
-}{.mmi; ld8 r18 = [up], UPD
- nop 0
- BSH r25 = r19, tnc
- ;; }
- {.mmi; nop 0
- nop 0
- FSH r26 = r19, cnt
-}{.mmi; ld8 r19 = [up], UPD
- nop 0
- BSH r27 = r16, tnc
- ;; }
- {.mmi; nop 0
- or r15 = r23, r22
- FSH r20 = r16, cnt
-}{.mmi; ld8 r16 = [up], UPD
- nop 0
- BSH r21 = r17, tnc
- ;; }
- {.mmi; or r14 = r25, r24
- sub r31 = -1, r15
- FSH r22 = r17, cnt
-}{.mib; ld8 r17 = [up], UPD
- BSH r23 = r18, tnc
- br L(end)
- ;; }
-
-.Lb10:
- ld8 r17 = [up], UPD
- br.cloop.dptk L(gt2)
- ;;
- BSH r8 = r10, tnc
- FSH r20 = r10, cnt
- ;;
- BSH r21 = r17, tnc
- FSH r22 = r17, cnt
- ;;
- or r14 = r21, r20
- ;;
- sub r31 = -1, r14
- br .Lr2
- ;;
-L(gt2):
- ld8 r18 = [up], UPD
- BSH r8 = r10, tnc
- FSH r20 = r10, cnt
- ;;
- ld8 r19 = [up], UPD
- ;;
- ld8 r16 = [up], UPD
- BSH r21 = r17, tnc
- FSH r22 = r17, cnt
- ;;
- ld8 r17 = [up], UPD
- BSH r23 = r18, tnc
- br.cloop.dptk L(gt6)
- ;;
- nop 0
- FSH r24 = r18, cnt
- BSH r25 = r19, tnc
- ;;
- or r14 = r21, r20
- FSH r26 = r19, cnt
- BSH r27 = r16, tnc
- ;;
- {.mmi; nop 0
- or r15 = r23, r22
- FSH r20 = r16, cnt
-}{.mib; sub r31 = -1, r14
- BSH r21 = r17, tnc
- br .Lr6
- ;; }
-L(gt6):
- {.mmi; nop 0
- nop 0
- FSH r24 = r18, cnt
-}{.mmi; ld8 r18 = [up], UPD
- nop 0
- BSH r25 = r19, tnc
- ;; }
- {.mmi; nop 0
- or r14 = r21, r20
- FSH r26 = r19, cnt
-}{.mmi; ld8 r19 = [up], UPD
- nop 0
- BSH r27 = r16, tnc
- ;; }
- {.mmi; or r15 = r23, r22
- sub r31 = -1, r14
- FSH r20 = r16, cnt
-}{.mib; ld8 r16 = [up], UPD
- BSH r21 = r17, tnc
- br .LL10
-}
-
-.Lb11:
- ld8 r16 = [up], UPD
- ;;
- ld8 r17 = [up], UPD
- BSH r8 = r10, tnc
- FSH r26 = r10, cnt
- br.cloop.dptk L(gt3)
- ;;
- BSH r27 = r16, tnc
- ;;
- FSH r20 = r16, cnt
- BSH r21 = r17, tnc
- ;;
- FSH r22 = r17, cnt
- ;;
- or r15 = r27, r26
- ;;
- or r14 = r21, r20
- sub r31 = -1, r15
- br .Lr3
- ;;
-L(gt3):
- ld8 r18 = [up], UPD
- ;;
- ld8 r19 = [up], UPD
- BSH r27 = r16, tnc
- ;;
- {.mmi; nop 0
- nop 0
- FSH r20 = r16, cnt
-}{.mmi; ld8 r16 = [up], UPD
- nop 0
- BSH r21 = r17, tnc
- ;; }
- {.mmi nop 0
- nop 0
- FSH r22 = r17, cnt
-}{.mib; ld8 r17 = [up], UPD
- BSH r23 = r18, tnc
- br.cloop.dptk L(gt7)
- ;; }
- or r15 = r27, r26
- FSH r24 = r18, cnt
- BSH r25 = r19, tnc
- ;;
- {.mmi; nop 0
- or r14 = r21, r20
- FSH r26 = r19, cnt
-}{.mib; sub r31 = -1, r15
- BSH r27 = r16, tnc
- br .Lr7
-}
-L(gt7):
- {.mmi; nop 0
- or r15 = r27, r26
- FSH r24 = r18, cnt
-}{.mmi; ld8 r18 = [up], UPD
- nop 0
- BSH r25 = r19, tnc
- ;; }
- {.mmi; or r14 = r21, r20
- sub r31 = -1, r15
- FSH r26 = r19, cnt
-}{.mib; ld8 r19 = [up], UPD
- BSH r27 = r16, tnc
- br .LL11
-}
-
-C *** MAIN LOOP START ***
- ALIGN(32)
-L(top):
-.LL01:
- {.mmi; st8 [rp] = r31, UPD C M2
- or r15 = r27, r26 C M3
- FSH r24 = r18, cnt C I0
-}{.mmi; ld8 r18 = [up], UPD C M0
- sub r31 = -1, r14 C M1
- BSH r25 = r19, tnc C I1
- ;; }
-.LL00:
- {.mmi; st8 [rp] = r31, UPD
- or r14 = r21, r20
- FSH r26 = r19, cnt
-}{.mmi; ld8 r19 = [up], UPD
- sub r31 = -1, r15
- BSH r27 = r16, tnc
- ;; }
-.LL11:
- {.mmi; st8 [rp] = r31, UPD
- or r15 = r23, r22
- FSH r20 = r16, cnt
-}{.mmi; ld8 r16 = [up], UPD
- sub r31 = -1, r14
- BSH r21 = r17, tnc
- ;; }
-.LL10:
- {.mmi; st8 [rp] = r31, UPD
- or r14 = r25, r24
- FSH r22 = r17, cnt
-}{.mmi; ld8 r17 = [up], UPD
- sub r31 = -1, r15
- BSH r23 = r18, tnc
- ;; }
-L(end): lfetch [r11], PUPD
- br.cloop.dptk L(top)
-C *** MAIN LOOP END ***
-
- {.mmi; st8 [rp] = r31, UPD
- or r15 = r27, r26
- FSH r24 = r18, cnt
-}{.mib; sub r31 = -1, r14
- BSH r25 = r19, tnc
- nop 0
- ;; }
-.Lr8:
- {.mmi; st8 [rp] = r31, UPD
- or r14 = r21, r20
- FSH r26 = r19, cnt
-}{.mib; sub r31 = -1, r15
- BSH r27 = r16, tnc
- nop 0
- ;; }
-.Lr7:
- {.mmi; st8 [rp] = r31, UPD
- or r15 = r23, r22
- FSH r20 = r16, cnt
-}{.mib; sub r31 = -1, r14
- BSH r21 = r17, tnc
- nop 0
- ;; }
-.Lr6: st8 [rp] = r31, UPD
- or r14 = r25, r24
- FSH r22 = r17, cnt
- sub r31 = -1, r15
- ;;
-.Lr5: st8 [rp] = r31, UPD
- or r15 = r27, r26
- sub r31 = -1, r14
- ;;
-.Lr4: st8 [rp] = r31, UPD
- or r14 = r21, r20
- sub r31 = -1, r15
- ;;
-.Lr3: st8 [rp] = r31, UPD
- sub r31 = -1, r14
- ;;
-.Lr2: st8 [rp] = r31, UPD
- sub r31 = -1, r22
- ;;
-.Lr1: st8 [rp] = r31, UPD C M23
- mov ar.lc = r2 C I0
- br.ret.sptk.many b0 C B
-EPILOGUE(func)
-ASM_END()
diff --git a/gmp/mpn/ia64/mod_34lsub1.asm b/gmp/mpn/ia64/mod_34lsub1.asm
deleted file mode 100644
index edf3602c4c..0000000000
--- a/gmp/mpn/ia64/mod_34lsub1.asm
+++ /dev/null
@@ -1,236 +0,0 @@
-dnl IA-64 mpn_mod_34lsub1
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-
-
-C INPUT PARAMETERS
-define(`up', `r32')
-define(`n', `r33')
-
-C Some useful aliases for registers we use
-define(`u0',`r14') define(`u1',`r15') define(`u2',`r16')
-define(`a0',`r17') define(`a1',`r18') define(`a2',`r19')
-define(`c0',`r20') define(`c1',`r21') define(`c2',`r22')
-
-C This is a fairly simple-minded implementation. One could approach 0.67 c/l
-C with a more sophisticated implementation. If we're really crazy, we could
-C super-unroll, storing carries just in predicate registers, then copy them to
-C a general register, and population count them from there. That'd bring us
-C close to 3 insn/limb, for nearly 0.5 c/l.
-
-C Computing n/3 needs 16 cycles, which is a lot of startup overhead.
-C We therefore use a plain while-style loop:
-C add n = -3, n
-C cmp.le p9, p0 = 3, n
-C (p9) br.cond .Loop
-C Alternatively, we could table n/3 for, say, n < 256, and predicate the
-C 16-cycle code.
-
-C The summing-up code at the end was written quickly, and could surely be
-C vastly improved.
-
-ASM_START()
-PROLOGUE(mpn_mod_34lsub1)
- .prologue
- .save ar.lc, r2
- .body
-ifdef(`HAVE_ABI_32',`
- addp4 up = 0, up C M I
- nop.m 0
- zxt4 n = n C I
- ;;
-')
-
-ifelse(0,1,`
- movl r14 = 0xAAAAAAAAAAAAAAAB
- ;;
- setf.sig f6 = r14
- setf.sig f7 = r33
- ;;
- xmpy.hu f6 = f6, f7
- ;;
- getf.sig r8 = f6
- ;;
- shr.u r8 = r8, 1 C Loop count
- ;;
- mov.i ar.lc = r8
-')
-
- ld8 u0 = [up], 8
- cmp.ne p9, p0 = 1, n
- (p9) br L(gt1)
- ;;
- shr.u r8 = u0, 48
- dep.z r27 = u0, 0, 48
- ;;
- add r8 = r8, r27
- br.ret.sptk.many b0
-
-
-L(gt1):
-.mmi; nop.m 0
- mov a0 = 0
- add n = -2, n
-.mmi; mov c0 = 0
- mov c1 = 0
- mov c2 = 0
- ;;
-.mmi; ld8 u1 = [up], 8
- mov a1 = 0
- cmp.ltu p6, p0 = r0, r0 C clear p6
-.mmb; cmp.gt p9, p0 = 3, n
- mov a2 = 0
- (p9) br.cond.dptk L(end)
- ;;
-
- ALIGN(32)
-L(top):
-.mmi; ld8 u2 = [up], 8
- (p6) add c0 = 1, c0
- cmp.ltu p7, p0 = a0, u0
-.mmb; sub a0 = a0, u0
- add n = -3, n
- nop.b 0
- ;;
-.mmi; ld8 u0 = [up], 8
- (p7) add c1 = 1, c1
- cmp.ltu p8, p0 = a1, u1
-.mmb; sub a1 = a1, u1
- cmp.le p9, p0 = 3, n
- nop.b 0
- ;;
-.mmi; ld8 u1 = [up], 8
- (p8) add c2 = 1, c2
- cmp.ltu p6, p0 = a2, u2
-.mmb; sub a2 = a2, u2
- nop.m 0
-dnl br.cloop.dptk L(top)
- (p9) br.cond.dptk L(top)
- ;;
-
-L(end):
- cmp.eq p10, p0 = 0, n
- cmp.eq p11, p0 = 1, n
- (p10) br L(0)
-
-L(2):
-.mmi; ld8 u2 = [up], 8
- (p6) add c0 = 1, c0
- cmp.ltu p7, p0 = a0, u0
-.mmb; sub a0 = a0, u0
- nop.m 0
- (p11) br L(1)
- ;;
- ld8 u0 = [up], 8
- (p7) add c1 = 1, c1
- cmp.ltu p8, p0 = a1, u1
- sub a1 = a1, u1
- ;;
- (p8) add c2 = 1, c2
- cmp.ltu p6, p0 = a2, u2
- sub a2 = a2, u2
- ;;
- (p6) add c0 = 1, c0
- cmp.ltu p7, p0 = a0, u0
- sub a0 = a0, u0
- ;;
- (p7) add c1 = 1, c1
- br L(com)
-
-
-L(1):
- (p7) add c1 = 1, c1
- cmp.ltu p8, p0 = a1, u1
- sub a1 = a1, u1
- ;;
- (p8) add c2 = 1, c2
- cmp.ltu p6, p0 = a2, u2
- sub a2 = a2, u2
- ;;
- (p6) add c0 = 1, c0
- br L(com)
-
-
-L(0):
- (p6) add c0 = 1, c0
- cmp.ltu p7, p0 = a0, u0
- sub a0 = a0, u0
- ;;
- (p7) add c1 = 1, c1
- cmp.ltu p8, p0 = a1, u1
- sub a1 = a1, u1
- ;;
- (p8) add c2 = 1, c2
-
-L(com):
-C | a2 | a1 | a0 |
-C | | | | |
- shr.u r24 = a0, 48 C 16 bits
- shr.u r25 = a1, 32 C 32 bits
- shr.u r26 = a2, 16 C 48 bits
- ;;
- shr.u r10 = c0, 48 C 16 bits, always zero
- shr.u r11 = c1, 32 C 32 bits
- shr.u r30 = c2, 16 C 48 bits
- ;;
- dep.z r27 = a0, 0, 48 C 48 bits
- dep.z r28 = a1, 16, 32 C 48 bits
- dep.z r29 = a2, 32, 16 C 48 bits
- dep.z r31 = c0, 0, 48 C 48 bits
- dep.z r14 = c1, 16, 32 C 48 bits
- dep.z r15 = c2, 32, 16 C 48 bits
- ;;
-.mmi; add r24 = r24, r25
- add r26 = r26, r27
- add r28 = r28, r29
-.mmi; add r10 = r10, r11
- add r30 = r30, r31
- add r14 = r14, r15
- ;;
- movl r8 = 0xffffffffffff0
- add r24 = r24, r26
- add r10 = r10, r30
- ;;
- add r24 = r24, r28
- add r10 = r10, r14
- ;;
- sub r8 = r8, r24
- ;;
- add r8 = r8, r10
- br.ret.sptk.many b0
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/ia64/mode1o.asm b/gmp/mpn/ia64/mode1o.asm
index 14d5e81602..6b3626ebe6 100644
--- a/gmp/mpn/ia64/mode1o.asm
+++ b/gmp/mpn/ia64/mode1o.asm
@@ -1,34 +1,21 @@
dnl Itanium-2 mpn_modexact_1c_odd -- mpn by 1 exact remainder.
-dnl Contributed to the GNU project by Kevin Ryde.
-
-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 either:
+dnl Copyright 2003, 2004, 2005 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/ia64/mul_1.asm b/gmp/mpn/ia64/mul_1.asm
index 21bf6d0e14..8df8d93f8e 100644
--- a/gmp/mpn/ia64/mul_1.asm
+++ b/gmp/mpn/ia64/mul_1.asm
@@ -1,35 +1,23 @@
dnl IA-64 mpn_mul_1, mpn_mul_1c -- Multiply a limb vector with a limb and
dnl store the result in a second limb vector.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2000-2004, 2006, 2007 Free Software Foundation, Inc.
+dnl Copyright 2000, 2001, 2002, 2003, 2004, 2006, 2007 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -553,6 +541,7 @@ C *** MAIN LOOP END ***
(p6) cmp.leu p8, p9 = r24, r17
(p7) cmp.ltu p8, p9 = r24, r17
;;
+ .pred.rel "mutex",p8,p9
(p8) add r8 = 1, r8
mov.i ar.lc = r2
br.ret.sptk.many b0
diff --git a/gmp/mpn/ia64/mul_2.asm b/gmp/mpn/ia64/mul_2.asm
index 2bbce97267..b0d4ef70a1 100644
--- a/gmp/mpn/ia64/mul_2.asm
+++ b/gmp/mpn/ia64/mul_2.asm
@@ -1,47 +1,39 @@
dnl IA-64 mpn_mul_2 -- Multiply a n-limb number with a 2-limb number and store
dnl store the result to a (n+1)-limb number.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2004, 2011 Free Software Foundation, Inc.
+dnl Copyright 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: 1.5
+C Itanium: 3.15
+C Itanium 2: 1.625
+
+C Note that this is very similar to addmul_2.asm. If you change this file,
+C please change that file too.
C TODO
C * Clean up variable names, and try to decrease the number of distinct
C registers used.
-C * Clean up feed-in code to not require zeroing several registers.
+C * Cleanup feed-in code to not require zeroing several registers.
C * Make sure we don't depend on uninitialized predicate registers.
+C * We currently cross-jump very aggressively, at the expense of a few cycles
+C per operation. Consider changing that.
C * Could perhaps save a few cycles by using 1 c/l carry propagation in
C wind-down code.
C * Ultimately rewrite. The problem with this code is that it first uses a
@@ -102,519 +94,598 @@ PROLOGUE(mpn_mul_2)
.save ar.lc, r2
.body
-ifdef(`HAVE_ABI_32',`
-.mmi; addp4 rp = 0, rp C M I
- addp4 up = 0, up C M I
- addp4 vp = 0, vp C M I
-.mmi; nop 1
- nop 1
- zxt4 n = n C I
+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; ldf8 ux = [up], 8 C M
- ldf8 v0 = [vp], 8 C M
- mov r2 = ar.lc C I0
-.mmi; nop 1 C M
- and r14 = 3, n C M I
- add n = -2, n C M I
- ;;
-.mmi; ldf8 uy = [up], 8 C M
- ldf8 v1 = [vp] C M
- 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
- ;;
-.mmi; nop 1 C M
- cmp.eq p12, p0 = 3, r14 C M I
- mov ar.lc = n C I0
-.bbb; (p10) br.dptk L(b01) C B
- (p11) br.dptk L(b10) C B
- (p12) br.dptk L(b11) C B
- ;;
+{.mmi C 00
+ ldf8 ux = [up], 8 C M
+ ldf8 v0 = [vp], 8 C M
+ mov.i r2 = ar.lc C I0
+}{.mmi
+ nop 0 C M
+ and r14 = 3, n C M I
+ add n = -2, n C M I
+ ;;
+}{.mmi C 01
+ ldf8 uy = [up], 8 C M
+ ldf8 v1 = [vp] C M
+ shr.u n = n, 2 C I
+}{.mmi
+ nop 0 C M
+ cmp.eq p10, p0 = 1, r14 C M I
+ cmp.eq p11, p0 = 2, r14 C M I
+ ;;
+}{.mmi C 02
+ nop 0 C M
+ cmp.eq p12, p0 = 3, r14 C M I
+ mov.i ar.lc = n C I0
+}{.bbb
+ (p10) br.dptk .Lb01 C B
+ (p11) br.dptk .Lb10 C B
+ (p12) br.dptk .Lb11 C B
+ ;;
+}
ALIGN(32)
-L(b00): ldf8 u_1 = [up], 8
- mov acc1_2 = 0
- mov pr1_2 = 0
- mov pr0_3 = 0
- cmp.ne p8, p9 = r0, r0
+.Lb00: ldf8 u_1 = [up], 8
+ mov acc1_2 = 0
+ mov pr1_2 = 0
+ mov pr0_3 = 0
+ cmp.ne p8, p9 = r0, r0
;;
- xma.l fp0b_3 = ux, v0, f0
- cmp.ne p12, p13 = r0, r0
- ldf8 u_2 = [up], 8
- xma.hu fp1a_3 = ux, v0, f0
- br.cloop.dptk L(gt4)
+ xma.l fp0b_3 = ux, v0, f0
+ cmp.ne p12, p13 = r0, r0
+ ldf8 u_2 = [up], 8
+ xma.hu fp1a_3 = ux, v0, f0
+ br.cloop.dptk .grt4
- xma.l fp0b_0 = uy, v0, f0
- xma.hu fp1a_0 = uy, v0, f0
+ xma.l fp0b_0 = uy, v0, f0
+ xma.hu fp1a_0 = uy, v0, f0
;;
- getfsig acc0 = fp0b_3
- xma.l fp1b_3 = ux, v1, fp1a_3
- xma.hu fp2a_3 = ux, v1, fp1a_3
+ getf.sig acc0 = fp0b_3
+ xma.l fp1b_3 = ux, v1, fp1a_3
+ xma.hu fp2a_3 = ux, v1, fp1a_3
;;
- xma.l fp0b_1 = u_1, v0, f0
- xma.hu fp1a_1 = u_1, v0, f0
+ xma.l fp0b_1 = u_1, v0, f0
+ xma.hu fp1a_1 = u_1, v0, f0
;;
- getfsig pr0_0 = fp0b_0
- xma.l fp1b_0 = uy, v1, fp1a_0
- xma.hu fp2a_0 = uy, v1, fp1a_0
+ getf.sig pr0_0 = fp0b_0
+ xma.l fp1b_0 = uy, v1, fp1a_0
+ xma.hu fp2a_0 = uy, v1, fp1a_0
;;
- getfsig pr1_3 = fp1b_3
- getfsig acc1_3 = fp2a_3
- xma.l fp0b_2 = u_2, v0, f0
- xma.hu fp1a_2 = u_2, v0, f0
- br L(cj4)
+ getf.sig pr1_3 = fp1b_3
+ getf.sig acc1_3 = fp2a_3
+ xma.l fp0b_2 = u_2, v0, f0
+ xma.hu fp1a_2 = u_2, v0, f0
+ br .Lcj4
-L(gt4): xma.l fp0b_0 = uy, v0, f0
- xma.hu fp1a_0 = uy, v0, f0
+.grt4: xma.l fp0b_0 = uy, v0, f0
+ xma.hu fp1a_0 = uy, v0, f0
;;
- getfsig acc0 = fp0b_3
- xma.l fp1b_3 = ux, v1, fp1a_3
- ldf8 u_3 = [up], 8
- xma.hu fp2a_3 = ux, v1, fp1a_3
+ getf.sig acc0 = fp0b_3
+ xma.l fp1b_3 = ux, v1, fp1a_3
+ ldf8 u_3 = [up], 8
+ xma.hu fp2a_3 = ux, v1, fp1a_3
;;
- xma.l fp0b_1 = u_1, v0, f0
- xma.hu fp1a_1 = u_1, v0, f0
+ xma.l fp0b_1 = u_1, v0, f0
+ xma.hu fp1a_1 = u_1, v0, f0
;;
- getfsig pr0_0 = fp0b_0
- xma.l fp1b_0 = uy, v1, fp1a_0
- xma.hu fp2a_0 = uy, v1, fp1a_0
+ getf.sig pr0_0 = fp0b_0
+ xma.l fp1b_0 = uy, v1, fp1a_0
+ xma.hu fp2a_0 = uy, v1, fp1a_0
;;
- ldf8 u_0 = [up], 8
- getfsig pr1_3 = fp1b_3
- xma.l fp0b_2 = u_2, v0, f0
+ ldf8 u_0 = [up], 8
+ getf.sig pr1_3 = fp1b_3
;;
- getfsig acc1_3 = fp2a_3
- xma.hu fp1a_2 = u_2, v0, f0
- br L(00)
+ getf.sig acc1_3 = fp2a_3
+ xma.l fp0b_2 = u_2, v0, f0
+ xma.hu fp1a_2 = u_2, v0, f0
+ br .LL00
ALIGN(32)
-L(b01): ldf8 u_0 = [up], 8 C M
- mov acc1_1 = 0 C M I
- mov pr1_1 = 0 C M I
- mov pr0_2 = 0 C M I
- cmp.ne p6, p7 = r0, r0 C M I
+.Lb01: ldf8 u_0 = [up], 8 C M
+ mov acc1_1 = 0 C M I
+ mov pr1_1 = 0 C M I
+ mov pr0_2 = 0 C M I
+ cmp.ne p6, p7 = r0, r0 C M I
;;
- xma.l fp0b_2 = ux, v0, f0 C F
- cmp.ne p10, p11 = r0, r0 C M I
- ldf8 u_1 = [up], 8 C M
- xma.hu fp1a_2 = ux, v0, f0 C F
+ xma.l fp0b_2 = ux, v0, f0 C F
+ cmp.ne p10, p11 = r0, r0 C M I
+ ldf8 u_1 = [up], 8 C M
+ xma.hu fp1a_2 = ux, v0, f0 C F
;;
- xma.l fp0b_3 = uy, v0, f0 C F
- xma.hu fp1a_3 = uy, v0, f0 C F
+ xma.l fp0b_3 = uy, v0, f0 C F
+ xma.hu fp1a_3 = uy, v0, f0 C F
;;
- getfsig acc0 = fp0b_2 C M
- xma.l fp1b_2 = ux, v1,fp1a_2 C F
- ldf8 u_2 = [up], 8 C M
- xma.hu fp2a_2 = ux, v1,fp1a_2 C F
- br.cloop.dptk L(gt5)
+ getf.sig acc0 = fp0b_2 C M
+ xma.l fp1b_2 = ux, v1,fp1a_2 C F
+ xma.hu fp2a_2 = ux, v1,fp1a_2 C F
+ ldf8 u_2 = [up], 8 C M
+ br.cloop.dptk .grt5
- xma.l fp0b_0 = u_0, v0, f0 C F
- xma.hu fp1a_0 = u_0, v0, f0 C F
+ xma.l fp0b_0 = u_0, v0, f0 C F
+ xma.hu fp1a_0 = u_0, v0, f0 C F
;;
- getfsig pr0_3 = fp0b_3 C M
- xma.l fp1b_3 = uy, v1,fp1a_3 C F
- xma.hu fp2a_3 = uy, v1,fp1a_3 C F
+ getf.sig pr0_3 = fp0b_3 C M
+ xma.l fp1b_3 = uy, v1,fp1a_3 C F
+ xma.hu fp2a_3 = uy, v1,fp1a_3 C F
;;
- getfsig pr1_2 = fp1b_2 C M
- getfsig acc1_2 = fp2a_2 C M
- xma.l fp0b_1 = u_1, v0, f0 C F
- xma.hu fp1a_1 = u_1, v0, f0 C F
- br L(cj5)
+ getf.sig pr1_2 = fp1b_2 C M
+ getf.sig acc1_2 = fp2a_2 C M
+ xma.l fp0b_1 = u_1, v0, f0 C F
+ xma.hu fp1a_1 = u_1, v0, f0 C F
+ br .Lcj5
-L(gt5): xma.l fp0b_0 = u_0, v0, f0
- xma.hu fp1a_0 = u_0, v0, f0
+.grt5: xma.l fp0b_0 = u_0, v0, f0
+ xma.hu fp1a_0 = u_0, v0, f0
;;
- getfsig pr0_3 = fp0b_3
- xma.l fp1b_3 = uy, v1, fp1a_3
- xma.hu fp2a_3 = uy, v1, fp1a_3
+ getf.sig pr0_3 = fp0b_3
+ xma.l fp1b_3 = uy, v1, fp1a_3
+ xma.hu fp2a_3 = uy, v1, fp1a_3
;;
- ldf8 u_3 = [up], 8
- getfsig pr1_2 = fp1b_2
- xma.l fp0b_1 = u_1, v0, f0
+ ldf8 u_3 = [up], 8
+ getf.sig pr1_2 = fp1b_2
;;
- getfsig acc1_2 = fp2a_2
- xma.hu fp1a_1 = u_1, v0, f0
- br L(01)
+ getf.sig acc1_2 = fp2a_2
+ xma.l fp0b_1 = u_1, v0, f0
+ xma.hu fp1a_1 = u_1, v0, f0
+ br .LL01
+C We have two variants for n = 2. They turn out to run at exactly the same
+C speed. But the first, odd variant might allow one cycle to be trimmed.
ALIGN(32)
-L(b10): br.cloop.dptk L(gt2)
- xma.l fp0b_1 = ux, v0, f0
- xma.hu fp1a_1 = ux, v0, f0
- ;;
- xma.l fp0b_2 = uy, v0, f0
- xma.hu fp1a_2 = uy, v0, f0
- ;;
- stf8 [rp] = fp0b_1, 8
- xma.l fp1b_1 = ux, v1, fp1a_1
- xma.hu fp2a_1 = ux, v1, fp1a_1
- ;;
- getfsig acc0 = fp0b_2
- xma.l fp1b_2 = uy, v1, fp1a_2
- xma.hu fp2a_2 = uy, v1, fp1a_2
- ;;
- getfsig pr1_1 = fp1b_1
- getfsig acc1_1 = fp2a_1
- mov ar.lc = r2
- getfsig pr1_2 = fp1b_2
- getfsig r8 = fp2a_2
- ;;
- add s0 = pr1_1, acc0
- ;;
- st8 [rp] = s0, 8
- cmp.ltu p8, p9 = s0, pr1_1
- sub r31 = -1, acc1_1
- ;;
- .pred.rel "mutex", p8, p9
- (p8) add acc0 = pr1_2, acc1_1, 1
- (p9) add acc0 = pr1_2, acc1_1
- (p8) cmp.leu p10, p0 = r31, pr1_2
- (p9) cmp.ltu p10, p0 = r31, pr1_2
- ;;
- st8 [rp] = acc0, 8
- (p10) add r8 = 1, r8
- br.ret.sptk.many b0
-
-L(gt2): ldf8 u_3 = [up], 8
- mov acc1_0 = 0
- mov pr1_0 = 0
- ;;
- mov pr0_1 = 0
- xma.l fp0b_1 = ux, v0, f0
- ldf8 u_0 = [up], 8
- xma.hu fp1a_1 = ux, v0, f0
- ;;
- xma.l fp0b_2 = uy, v0, f0
- xma.hu fp1a_2 = uy, v0, f0
- ;;
- getfsig acc0 = fp0b_1
- xma.l fp1b_1 = ux, v1, fp1a_1
- xma.hu fp2a_1 = ux, v1, fp1a_1
- ;;
- ldf8 u_1 = [up], 8
- xma.l fp0b_3 = u_3, v0, f0
- xma.hu fp1a_3 = u_3, v0, f0
- ;;
- getfsig pr0_2 = fp0b_2
- xma.l fp1b_2 = uy, v1, fp1a_2
- xma.hu fp2a_2 = uy, v1, fp1a_2
- ;;
- ldf8 u_2 = [up], 8
- getfsig pr1_1 = fp1b_1
- ;;
-.mfi; getfsig acc1_1 = fp2a_1
- xma.l fp0b_0 = u_0, v0, f0
- cmp.ne p8, p9 = r0, r0
-.mfb; cmp.ne p12, p13 = r0, r0
- xma.hu fp1a_0 = u_0, v0, f0
- br L(10)
+ifdef(`',`
+.Lb10: C 03
+ br.cloop.dptk .grt2
+ C 04
+ C 05
+ C 06
+ xma.l fp0b_1 = ux, v0, f0 C 0
+ xma.hu fp1a_1 = ux, v0, f0 C 1
+ ;; C 07
+ xma.l fp0b_2 = uy, v0, f0 C 1
+ xma.l fp1b_1 = ux, v1, f0 C 1
+ ;; C 08
+ xma.hu fp1a_2 = uy, v0, f0 C 2
+ xma.hu fp2a_1 = ux, v1, f0 C 2
+ ;; C 09
+ xma.l fp1b_2 = uy, v1, f0 C 2
+ xma.hu fp2a_2 = uy, v1, f0 C 3
+ ;; C 10
+ getf.sig r16 = fp1a_1
+ stf8 [rp] = fp0b_1, 8
+ ;; C 11
+ getf.sig r17 = fp0b_2
+ C 12
+ getf.sig r18 = fp1b_1
+ C 13
+ getf.sig r19 = fp1a_2
+ C 14
+ getf.sig r20 = fp2a_1
+ C 15
+ getf.sig r21 = fp1b_2
+ ;; C 16
+ getf.sig r8 = fp2a_2
+ add r24 = r16, r17
+ ;; C 17
+ cmp.ltu p6, p7 = r24, r16
+ add r26 = r24, r18
+ ;; C 18
+ cmp.ltu p8, p9 = r26, r24
+ ;; C 19
+ st8 [rp] = r26, 8
+ (p6) add r25 = r19, r20, 1
+ (p7) add r25 = r19, r20
+ ;; C 20
+ (p8) add r27 = r25, r21, 1
+ (p9) add r27 = r25, r21
+ (p6) cmp.leu p10, p0 = r25, r19
+ (p7) cmp.ltu p10, p0 = r25, r19
+ ;; C 21
+ (p10) add r8 = 1, r8
+ (p8) cmp.leu p12, p0 = r27, r25
+ (p9) cmp.ltu p12, p0 = r27, r25
+ ;; C 22
+ st8 [rp] = r27, 8
+ mov.i ar.lc = r2
+ (p12) add r8 = 1, r8
+ br.ret.sptk.many b0
+')
+
+.Lb10: C 03
+ br.cloop.dptk .grt2
+ C 04
+ C 05
+ C 06
+ xma.l fp0b_1 = ux, v0, f0
+ xma.hu fp1a_1 = ux, v0, f0
+ ;; C 07
+ xma.l fp0b_2 = uy, v0, f0
+ xma.hu fp1a_2 = uy, v0, f0
+ ;; C 08
+ C 09
+ C 10
+ stf8 [rp] = fp0b_1, 8
+ xma.l fp1b_1 = ux, v1, fp1a_1
+ xma.hu fp2a_1 = ux, v1, fp1a_1
+ ;; C 11
+ getf.sig acc0 = fp0b_2
+ xma.l fp1b_2 = uy, v1, fp1a_2
+ xma.hu fp2a_2 = uy, v1, fp1a_2
+ ;; C 12
+ C 13
+ C 14
+ getf.sig pr1_1 = fp1b_1
+ C 15
+ getf.sig acc1_1 = fp2a_1
+ C 16
+ getf.sig pr1_2 = fp1b_2
+ C 17
+ getf.sig r8 = fp2a_2
+ ;; C 18
+ C 19
+ add s0 = pr1_1, acc0
+ ;; C 20
+ st8 [rp] = s0, 8
+ cmp.ltu p8, p9 = s0, pr1_1
+ sub r31 = -1, acc1_1
+ ;; C 21
+ .pred.rel "mutex", p8, p9
+ (p8) add acc0 = pr1_2, acc1_1, 1
+ (p9) add acc0 = pr1_2, acc1_1
+ (p8) cmp.leu p10, p0 = r31, pr1_2
+ (p9) cmp.ltu p10, p0 = r31, pr1_2
+ ;; C 22
+ st8 [rp] = acc0, 8
+ mov.i ar.lc = r2
+ (p10) add r8 = 1, r8
+ br.ret.sptk.many b0
+
+
+.grt2: ldf8 u_3 = [up], 8
+ mov acc1_0 = 0
+ mov pr1_0 = 0
+ ;;
+ mov pr0_1 = 0
+ xma.l fp0b_1 = ux, v0, f0
+ ldf8 u_0 = [up], 8
+ xma.hu fp1a_1 = ux, v0, f0
+ ;;
+ xma.l fp0b_2 = uy, v0, f0
+ xma.hu fp1a_2 = uy, v0, f0
+ ;;
+ getf.sig acc0 = fp0b_1
+ xma.l fp1b_1 = ux, v1, fp1a_1
+ xma.hu fp2a_1 = ux, v1, fp1a_1
+ ;;
+ ldf8 u_1 = [up], 8
+ xma.l fp0b_3 = u_3, v0, f0
+ xma.hu fp1a_3 = u_3, v0, f0
+ ;;
+ getf.sig pr0_2 = fp0b_2
+ xma.l fp1b_2 = uy, v1, fp1a_2
+ xma.hu fp2a_2 = uy, v1, fp1a_2
+ ;;
+ ldf8 u_2 = [up], 8
+ getf.sig pr1_1 = fp1b_1
+ ;;
+ getf.sig acc1_1 = fp2a_1
+ xma.l fp0b_0 = u_0, v0, f0
+ cmp.ne p8, p9 = r0, r0
+ cmp.ne p12, p13 = r0, r0
+ xma.hu fp1a_0 = u_0, v0, f0
+ br .LL10
ALIGN(32)
-L(b11): mov acc1_3 = 0
- mov pr1_3 = 0
- mov pr0_0 = 0
- ldf8 u_2 = [up], 8
- cmp.ne p6, p7 = r0, r0
- br.cloop.dptk L(gt3)
+.Lb11: mov acc1_3 = 0
+ mov pr1_3 = 0
+ mov pr0_0 = 0
+ cmp.ne p6, p7 = r0, r0
+ ;;
+ ldf8 u_2 = [up], 8
+ br.cloop.dptk .grt3
;;
- xma.l fp0b_0 = ux, v0, f0
- xma.hu fp1a_0 = ux, v0, f0
+ xma.l fp0b_0 = ux, v0, f0
+ xma.hu fp1a_0 = ux, v0, f0
;;
- cmp.ne p10, p11 = r0, r0
- xma.l fp0b_1 = uy, v0, f0
- xma.hu fp1a_1 = uy, v0, f0
+ cmp.ne p10, p11 = r0, r0
+ xma.l fp0b_1 = uy, v0, f0
+ xma.hu fp1a_1 = uy, v0, f0
;;
- getfsig acc0 = fp0b_0
- xma.l fp1b_0 = ux, v1, fp1a_0
- xma.hu fp2a_0 = ux, v1, fp1a_0
+ getf.sig acc0 = fp0b_0
+ xma.l fp1b_0 = ux, v1, fp1a_0
+ xma.hu fp2a_0 = ux, v1, fp1a_0
;;
- xma.l fp0b_2 = u_2, v0, f0
- xma.hu fp1a_2 = u_2, v0, f0
+ xma.l fp0b_2 = u_2, v0, f0
+ xma.hu fp1a_2 = u_2, v0, f0
;;
- getfsig pr0_1 = fp0b_1
- xma.l fp1b_1 = uy, v1, fp1a_1
- xma.hu fp2a_1 = uy, v1, fp1a_1
+ getf.sig pr0_1 = fp0b_1
+ xma.l fp1b_1 = uy, v1, fp1a_1
+ xma.hu fp2a_1 = uy, v1, fp1a_1
;;
- getfsig pr1_0 = fp1b_0
- getfsig acc1_0 = fp2a_0
- br L(cj3)
+ getf.sig pr1_0 = fp1b_0
+ getf.sig acc1_0 = fp2a_0
+ br .Lcj3
-L(gt3): xma.l fp0b_0 = ux, v0, f0
- cmp.ne p10, p11 = r0, r0
- ldf8 u_3 = [up], 8
- xma.hu fp1a_0 = ux, v0, f0
+.grt3: xma.l fp0b_0 = ux, v0, f0
+ cmp.ne p10, p11 = r0, r0
+ ldf8 u_3 = [up], 8
+ xma.hu fp1a_0 = ux, v0, f0
;;
- xma.l fp0b_1 = uy, v0, f0
- xma.hu fp1a_1 = uy, v0, f0
+ xma.l fp0b_1 = uy, v0, f0
+ xma.hu fp1a_1 = uy, v0, f0
;;
- getfsig acc0 = fp0b_0
- xma.l fp1b_0 = ux, v1, fp1a_0
- ldf8 u_0 = [up], 8
- xma.hu fp2a_0 = ux, v1, fp1a_0
+ getf.sig acc0 = fp0b_0
+ xma.l fp1b_0 = ux, v1, fp1a_0
+ ldf8 u_0 = [up], 8
+ xma.hu fp2a_0 = ux, v1, fp1a_0
;;
- xma.l fp0b_2 = u_2, v0, f0
- xma.hu fp1a_2 = u_2, v0, f0
+ xma.l fp0b_2 = u_2, v0, f0
+ xma.hu fp1a_2 = u_2, v0, f0
;;
- getfsig pr0_1 = fp0b_1
- xma.l fp1b_1 = uy, v1, fp1a_1
- xma.hu fp2a_1 = uy, v1, fp1a_1
+ getf.sig pr0_1 = fp0b_1
+ xma.l fp1b_1 = uy, v1, fp1a_1
+ xma.hu fp2a_1 = uy, v1, fp1a_1
;;
- ldf8 u_1 = [up], 8
- getfsig pr1_0 = fp1b_0
+ ldf8 u_1 = [up], 8
+ getf.sig pr1_0 = fp1b_0
;;
- getfsig acc1_0 = fp2a_0
- xma.l fp0b_3 = u_3, v0, f0
- xma.hu fp1a_3 = u_3, v0, f0
- br L(11)
+ getf.sig acc1_0 = fp2a_0
+ xma.l fp0b_3 = u_3, v0, f0
+ xma.hu fp1a_3 = u_3, v0, f0
+ br .LL11
C *** MAIN LOOP START ***
ALIGN(32)
-L(top): C 00
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
- ldf8 u_3 = [up], 8
- getfsig pr1_2 = fp1b_2
- (p8) cmp.leu p6, p7 = acc0, pr0_1
- (p9) cmp.ltu p6, p7 = acc0, pr0_1
- (p12) cmp.leu p10, p11 = s0, pr1_0
- (p13) cmp.ltu p10, p11 = s0, pr1_0
+.Loop: C 00
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_3 = fp0b_3
+ xma.l fp1b_3 = u_3, v1, fp1a_3
+ (p12) add s0 = pr1_0, acc0, 1
+ (p13) add s0 = pr1_0, acc0
+ xma.hu fp2a_3 = u_3, v1, fp1a_3
;; C 01
- .pred.rel "mutex", p6, p7
- getfsig acc1_2 = fp2a_2
- st8 [rp] = s0, 8
- xma.l fp0b_1 = u_1, v0, f0
- (p6) add acc0 = pr0_2, acc1_0, 1
- (p7) add acc0 = pr0_2, acc1_0
- xma.hu fp1a_1 = u_1, v0, f0
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ ldf8 u_3 = [up], 8
+ getf.sig pr1_2 = fp1b_2
+ (p8) cmp.leu p6, p7 = acc0, pr0_1
+ (p9) cmp.ltu p6, p7 = acc0, pr0_1
+ (p12) cmp.leu p10, p11 = s0, pr1_0
+ (p13) cmp.ltu p10, p11 = s0, pr1_0
;; C 02
-L(01):
- .pred.rel "mutex", p10, p11
- getfsig pr0_0 = fp0b_0
- xma.l fp1b_0 = u_0, v1, fp1a_0
- (p10) add s0 = pr1_1, acc0, 1
- (p11) add s0 = pr1_1, acc0
- xma.hu fp2a_0 = u_0, v1, fp1a_0
- nop 1
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_2 = fp2a_2
+ st8 [rp] = s0, 8
+ xma.l fp0b_1 = u_1, v0, f0
+ (p6) add acc0 = pr0_2, acc1_0, 1
+ (p7) add acc0 = pr0_2, acc1_0
+ xma.hu fp1a_1 = u_1, v0, f0
;; C 03
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
- ldf8 u_0 = [up], 8
- getfsig pr1_3 = fp1b_3
- (p6) cmp.leu p8, p9 = acc0, pr0_2
- (p7) cmp.ltu p8, p9 = acc0, pr0_2
- (p10) cmp.leu p12, p13 = s0, pr1_1
- (p11) cmp.ltu p12, p13 = s0, pr1_1
+.LL01:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_0 = fp0b_0
+ xma.l fp1b_0 = u_0, v1, fp1a_0
+ (p10) add s0 = pr1_1, acc0, 1
+ (p11) add s0 = pr1_1, acc0
+ xma.hu fp2a_0 = u_0, v1, fp1a_0
;; C 04
- .pred.rel "mutex", p8, p9
- getfsig acc1_3 = fp2a_3
- st8 [rp] = s0, 8
- xma.l fp0b_2 = u_2, v0, f0
- (p8) add acc0 = pr0_3, acc1_1, 1
- (p9) add acc0 = pr0_3, acc1_1
- xma.hu fp1a_2 = u_2, v0, f0
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ ldf8 u_0 = [up], 8
+ getf.sig pr1_3 = fp1b_3
+ (p6) cmp.leu p8, p9 = acc0, pr0_2
+ (p7) cmp.ltu p8, p9 = acc0, pr0_2
+ (p10) cmp.leu p12, p13 = s0, pr1_1
+ (p11) cmp.ltu p12, p13 = s0, pr1_1
;; C 05
-L(00):
- .pred.rel "mutex", p12, p13
- getfsig pr0_1 = fp0b_1
- xma.l fp1b_1 = u_1, v1, fp1a_1
- (p12) add s0 = pr1_2, acc0, 1
- (p13) add s0 = pr1_2, acc0
- xma.hu fp2a_1 = u_1, v1, fp1a_1
- nop 1
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_3 = fp2a_3
+ st8 [rp] = s0, 8
+ xma.l fp0b_2 = u_2, v0, f0
+ (p8) add acc0 = pr0_3, acc1_1, 1
+ (p9) add acc0 = pr0_3, acc1_1
+ xma.hu fp1a_2 = u_2, v0, f0
;; C 06
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
- ldf8 u_1 = [up], 8
- getfsig pr1_0 = fp1b_0
- (p8) cmp.leu p6, p7 = acc0, pr0_3
- (p9) cmp.ltu p6, p7 = acc0, pr0_3
- (p12) cmp.leu p10, p11 = s0, pr1_2
- (p13) cmp.ltu p10, p11 = s0, pr1_2
+.LL00:
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_1 = fp0b_1
+ xma.l fp1b_1 = u_1, v1, fp1a_1
+ (p12) add s0 = pr1_2, acc0, 1
+ (p13) add s0 = pr1_2, acc0
+ xma.hu fp2a_1 = u_1, v1, fp1a_1
;; C 07
- .pred.rel "mutex", p6, p7
- getfsig acc1_0 = fp2a_0
- st8 [rp] = s0, 8
- xma.l fp0b_3 = u_3, v0, f0
- (p6) add acc0 = pr0_0, acc1_2, 1
- (p7) add acc0 = pr0_0, acc1_2
- xma.hu fp1a_3 = u_3, v0, f0
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ ldf8 u_1 = [up], 8
+ getf.sig pr1_0 = fp1b_0
+ (p8) cmp.leu p6, p7 = acc0, pr0_3
+ (p9) cmp.ltu p6, p7 = acc0, pr0_3
+ (p12) cmp.leu p10, p11 = s0, pr1_2
+ (p13) cmp.ltu p10, p11 = s0, pr1_2
;; C 08
-L(11):
- .pred.rel "mutex", p10, p11
- getfsig pr0_2 = fp0b_2
- xma.l fp1b_2 = u_2, v1, fp1a_2
- (p10) add s0 = pr1_3, acc0, 1
- (p11) add s0 = pr1_3, acc0
- xma.hu fp2a_2 = u_2, v1, fp1a_2
- nop 1
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_0 = fp2a_0
+ st8 [rp] = s0, 8
+ xma.l fp0b_3 = u_3, v0, f0
+ (p6) add acc0 = pr0_0, acc1_2, 1
+ (p7) add acc0 = pr0_0, acc1_2
+ xma.hu fp1a_3 = u_3, v0, f0
;; C 09
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
- ldf8 u_2 = [up], 8
- getfsig pr1_1 = fp1b_1
- (p6) cmp.leu p8, p9 = acc0, pr0_0
- (p7) cmp.ltu p8, p9 = acc0, pr0_0
- (p10) cmp.leu p12, p13 = s0, pr1_3
- (p11) cmp.ltu p12, p13 = s0, pr1_3
+.LL11:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_2 = fp0b_2
+ xma.l fp1b_2 = u_2, v1, fp1a_2
+ (p10) add s0 = pr1_3, acc0, 1
+ (p11) add s0 = pr1_3, acc0
+ xma.hu fp2a_2 = u_2, v1, fp1a_2
;; C 10
- .pred.rel "mutex", p8, p9
- getfsig acc1_1 = fp2a_1
- st8 [rp] = s0, 8
- xma.l fp0b_0 = u_0, v0, f0
- (p8) add acc0 = pr0_1, acc1_3, 1
- (p9) add acc0 = pr0_1, acc1_3
- xma.hu fp1a_0 = u_0, v0, f0
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ ldf8 u_2 = [up], 8
+ getf.sig pr1_1 = fp1b_1
+ (p6) cmp.leu p8, p9 = acc0, pr0_0
+ (p7) cmp.ltu p8, p9 = acc0, pr0_0
+ (p10) cmp.leu p12, p13 = s0, pr1_3
+ (p11) cmp.ltu p12, p13 = s0, pr1_3
;; C 11
-L(10):
- .pred.rel "mutex", p12, p13
- getfsig pr0_3 = fp0b_3
- xma.l fp1b_3 = u_3, v1, fp1a_3
- (p12) add s0 = pr1_0, acc0, 1
- (p13) add s0 = pr1_0, acc0
- xma.hu fp2a_3 = u_3, v1, fp1a_3
- br.cloop.dptk L(top)
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_1 = fp2a_1
+ st8 [rp] = s0, 8
+ xma.l fp0b_0 = u_0, v0, f0
+ (p8) add acc0 = pr0_1, acc1_3, 1
+ (p9) add acc0 = pr0_1, acc1_3
+ xma.hu fp1a_0 = u_0, v0, f0
+.LL10: br.cloop.dptk .Loop C 12
;;
C *** MAIN LOOP END ***
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
-.mmi; getfsig pr1_2 = fp1b_2
- st8 [rp] = s0, 8
- (p8) cmp.leu p6, p7 = acc0, pr0_1
-.mmi; (p9) cmp.ltu p6, p7 = acc0, pr0_1
- (p12) cmp.leu p10, p11 = s0, pr1_0
- (p13) cmp.ltu p10, p11 = s0, pr1_0
- ;;
- .pred.rel "mutex", p6, p7
-.mfi; getfsig acc1_2 = fp2a_2
- xma.l fp0b_1 = u_1, v0, f0
- nop 1
-.mmf; (p6) add acc0 = pr0_2, acc1_0, 1
- (p7) add acc0 = pr0_2, acc1_0
- xma.hu fp1a_1 = u_1, v0, f0
- ;;
-L(cj5):
- .pred.rel "mutex", p10, p11
-.mfi; getfsig pr0_0 = fp0b_0
- xma.l fp1b_0 = u_0, v1, fp1a_0
- (p10) add s0 = pr1_1, acc0, 1
-.mfi; (p11) add s0 = pr1_1, acc0
- xma.hu fp2a_0 = u_0, v1, fp1a_0
- nop 1
- ;;
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
-.mmi; getfsig pr1_3 = fp1b_3
- st8 [rp] = s0, 8
- (p6) cmp.leu p8, p9 = acc0, pr0_2
-.mmi; (p7) cmp.ltu p8, p9 = acc0, pr0_2
- (p10) cmp.leu p12, p13 = s0, pr1_1
- (p11) cmp.ltu p12, p13 = s0, pr1_1
- ;;
- .pred.rel "mutex", p8, p9
-.mfi; getfsig acc1_3 = fp2a_3
- xma.l fp0b_2 = u_2, v0, f0
- nop 1
-.mmf; (p8) add acc0 = pr0_3, acc1_1, 1
- (p9) add acc0 = pr0_3, acc1_1
- xma.hu fp1a_2 = u_2, v0, f0
- ;;
-L(cj4):
- .pred.rel "mutex", p12, p13
-.mfi; getfsig pr0_1 = fp0b_1
- xma.l fp1b_1 = u_1, v1, fp1a_1
- (p12) add s0 = pr1_2, acc0, 1
-.mfi; (p13) add s0 = pr1_2, acc0
- xma.hu fp2a_1 = u_1, v1, fp1a_1
- nop 1
- ;;
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
-.mmi; getfsig pr1_0 = fp1b_0
- st8 [rp] = s0, 8
- (p8) cmp.leu p6, p7 = acc0, pr0_3
-.mmi; (p9) cmp.ltu p6, p7 = acc0, pr0_3
- (p12) cmp.leu p10, p11 = s0, pr1_2
- (p13) cmp.ltu p10, p11 = s0, pr1_2
- ;;
- .pred.rel "mutex", p6, p7
-.mmi; getfsig acc1_0 = fp2a_0
- (p6) add acc0 = pr0_0, acc1_2, 1
- (p7) add acc0 = pr0_0, acc1_2
- ;;
-L(cj3):
- .pred.rel "mutex", p10, p11
-.mfi; getfsig pr0_2 = fp0b_2
- xma.l fp1b_2 = u_2, v1, fp1a_2
- (p10) add s0 = pr1_3, acc0, 1
-.mfi; (p11) add s0 = pr1_3, acc0
- xma.hu fp2a_2 = u_2, v1, fp1a_2
- nop 1
- ;;
- .pred.rel "mutex", p6, p7
- .pred.rel "mutex", p10, p11
-.mmi; getfsig pr1_1 = fp1b_1
- st8 [rp] = s0, 8
- (p6) cmp.leu p8, p9 = acc0, pr0_0
-.mmi; (p7) cmp.ltu p8, p9 = acc0, pr0_0
- (p10) cmp.leu p12, p13 = s0, pr1_3
- (p11) cmp.ltu p12, p13 = s0, pr1_3
- ;;
- .pred.rel "mutex", p8, p9
-.mmi; getfsig acc1_1 = fp2a_1
- (p8) add acc0 = pr0_1, acc1_3, 1
- (p9) add acc0 = pr0_1, acc1_3
- ;;
- .pred.rel "mutex", p12, p13
-.mmi; (p12) add s0 = pr1_0, acc0, 1
- (p13) add s0 = pr1_0, acc0
- nop 1
- ;;
- .pred.rel "mutex", p8, p9
- .pred.rel "mutex", p12, p13
-.mmi; getfsig pr1_2 = fp1b_2
- st8 [rp] = s0, 8
- (p8) cmp.leu p6, p7 = acc0, pr0_1
-.mmi; (p9) cmp.ltu p6, p7 = acc0, pr0_1
- (p12) cmp.leu p10, p11 = s0, pr1_0
- (p13) cmp.ltu p10, p11 = s0, pr1_0
- ;;
- .pred.rel "mutex", p6, p7
-.mmi; getfsig r8 = fp2a_2
- (p6) add acc0 = pr0_2, acc1_0, 1
- (p7) add acc0 = pr0_2, acc1_0
- ;;
- .pred.rel "mutex", p10, p11
-.mmi; (p10) add s0 = pr1_1, acc0, 1
- (p11) add s0 = pr1_1, acc0
- (p6) cmp.leu p8, p9 = acc0, pr0_2
- ;;
- .pred.rel "mutex", p10, p11
-.mmi; (p7) cmp.ltu p8, p9 = acc0, pr0_2
- (p10) cmp.leu p12, p13 = s0, pr1_1
- (p11) cmp.ltu p12, p13 = s0, pr1_1
- ;;
- .pred.rel "mutex", p8, p9
-.mmi; st8 [rp] = s0, 8
- (p8) add acc0 = pr1_2, acc1_1, 1
- (p9) add acc0 = pr1_2, acc1_1
- ;;
- .pred.rel "mutex", p8, p9
-.mmi; (p8) cmp.leu p10, p11 = acc0, pr1_2
- (p9) cmp.ltu p10, p11 = acc0, pr1_2
- (p12) add acc0 = 1, acc0
- ;;
-.mmi; st8 [rp] = acc0, 8
- (p12) cmpeqor p10, p0 = 0, acc0
- nop 1
- ;;
-.mib; (p10) add r8 = 1, r8
- mov ar.lc = r2
- br.ret.sptk.many b0
+.Lcj6:
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_3 = fp0b_3
+ xma.l fp1b_3 = u_3, v1, fp1a_3
+ (p12) add s0 = pr1_0, acc0, 1
+ (p13) add s0 = pr1_0, acc0
+ xma.hu fp2a_3 = u_3, v1, fp1a_3
+ ;;
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ getf.sig pr1_2 = fp1b_2
+ (p8) cmp.leu p6, p7 = acc0, pr0_1
+ (p9) cmp.ltu p6, p7 = acc0, pr0_1
+ (p12) cmp.leu p10, p11 = s0, pr1_0
+ (p13) cmp.ltu p10, p11 = s0, pr1_0
+ ;;
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_2 = fp2a_2
+ st8 [rp] = s0, 8
+ xma.l fp0b_1 = u_1, v0, f0
+ (p6) add acc0 = pr0_2, acc1_0, 1
+ (p7) add acc0 = pr0_2, acc1_0
+ xma.hu fp1a_1 = u_1, v0, f0
+ ;;
+.Lcj5:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_0 = fp0b_0
+ xma.l fp1b_0 = u_0, v1, fp1a_0
+ (p10) add s0 = pr1_1, acc0, 1
+ (p11) add s0 = pr1_1, acc0
+ xma.hu fp2a_0 = u_0, v1, fp1a_0
+ ;;
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ getf.sig pr1_3 = fp1b_3
+ (p6) cmp.leu p8, p9 = acc0, pr0_2
+ (p7) cmp.ltu p8, p9 = acc0, pr0_2
+ (p10) cmp.leu p12, p13 = s0, pr1_1
+ (p11) cmp.ltu p12, p13 = s0, pr1_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_3 = fp2a_3
+ st8 [rp] = s0, 8
+ xma.l fp0b_2 = u_2, v0, f0
+ (p8) add acc0 = pr0_3, acc1_1, 1
+ (p9) add acc0 = pr0_3, acc1_1
+ xma.hu fp1a_2 = u_2, v0, f0
+ ;;
+.Lcj4:
+ .pred.rel "mutex", p12, p13
+ getf.sig pr0_1 = fp0b_1
+ xma.l fp1b_1 = u_1, v1, fp1a_1
+ (p12) add s0 = pr1_2, acc0, 1
+ (p13) add s0 = pr1_2, acc0
+ xma.hu fp2a_1 = u_1, v1, fp1a_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ getf.sig pr1_0 = fp1b_0
+ (p8) cmp.leu p6, p7 = acc0, pr0_3
+ (p9) cmp.ltu p6, p7 = acc0, pr0_3
+ (p12) cmp.leu p10, p11 = s0, pr1_2
+ (p13) cmp.ltu p10, p11 = s0, pr1_2
+ ;;
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_0 = fp2a_0
+ st8 [rp] = s0, 8
+ (p6) add acc0 = pr0_0, acc1_2, 1
+ (p7) add acc0 = pr0_0, acc1_2
+ ;;
+.Lcj3:
+ .pred.rel "mutex", p10, p11
+ getf.sig pr0_2 = fp0b_2
+ xma.l fp1b_2 = u_2, v1, fp1a_2
+ (p10) add s0 = pr1_3, acc0, 1
+ (p11) add s0 = pr1_3, acc0
+ xma.hu fp2a_2 = u_2, v1, fp1a_2
+ ;;
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ getf.sig pr1_1 = fp1b_1
+ (p6) cmp.leu p8, p9 = acc0, pr0_0
+ (p7) cmp.ltu p8, p9 = acc0, pr0_0
+ (p10) cmp.leu p12, p13 = s0, pr1_3
+ (p11) cmp.ltu p12, p13 = s0, pr1_3
+ ;;
+ .pred.rel "mutex", p8, p9
+ getf.sig acc1_1 = fp2a_1
+ st8 [rp] = s0, 8
+ (p8) add acc0 = pr0_1, acc1_3, 1
+ (p9) add acc0 = pr0_1, acc1_3
+ ;;
+ .pred.rel "mutex", p12, p13
+ (p12) add s0 = pr1_0, acc0, 1
+ (p13) add s0 = pr1_0, acc0
+ ;;
+ .pred.rel "mutex", p8, p9
+ .pred.rel "mutex", p12, p13
+ getf.sig pr1_2 = fp1b_2
+ (p8) cmp.leu p6, p7 = acc0, pr0_1
+ (p9) cmp.ltu p6, p7 = acc0, pr0_1
+ (p12) cmp.leu p10, p11 = s0, pr1_0
+ (p13) cmp.ltu p10, p11 = s0, pr1_0
+ ;;
+ .pred.rel "mutex", p6, p7
+ getf.sig acc1_2 = fp2a_2
+ st8 [rp] = s0, 8
+ (p6) add acc0 = pr0_2, acc1_0, 1
+ (p7) add acc0 = pr0_2, acc1_0
+ ;;
+ .pred.rel "mutex", p10, p11
+ (p10) add s0 = pr1_1, acc0, 1
+ (p11) add s0 = pr1_1, acc0
+ ;;
+ .pred.rel "mutex", p6, p7
+ .pred.rel "mutex", p10, p11
+ (p6) cmp.leu p8, p9 = acc0, pr0_2
+ (p7) cmp.ltu p8, p9 = acc0, pr0_2
+ (p10) cmp.leu p12, p13 = s0, pr1_1
+ (p11) cmp.ltu p12, p13 = s0, pr1_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ st8 [rp] = s0, 8
+ (p8) add acc0 = pr1_2, acc1_1, 1
+ (p9) add acc0 = pr1_2, acc1_1
+ ;;
+ .pred.rel "mutex", p8, p9
+ (p8) cmp.leu p10, p11 = acc0, pr1_2
+ (p9) cmp.ltu p10, p11 = acc0, pr1_2
+ (p12) add acc0 = 1, acc0
+ ;;
+ st8 [rp] = acc0, 8
+ (p12) cmp.eq.or p10, p0 = 0, acc0
+ mov r8 = acc1_2
+ ;;
+ .pred.rel "mutex", p10, p11
+ (p10) add r8 = 1, r8
+ mov.i ar.lc = r2
+ br.ret.sptk.many b0
EPILOGUE()
ASM_END()
diff --git a/gmp/mpn/ia64/popcount.asm b/gmp/mpn/ia64/popcount.asm
index c0b5c5c1cf..a02bf4346c 100644
--- a/gmp/mpn/ia64/popcount.asm
+++ b/gmp/mpn/ia64/popcount.asm
@@ -1,34 +1,22 @@
dnl IA-64 mpn_popcount -- mpn population count.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2000-2005 Free Software Foundation, Inc.
+dnl Copyright 2000, 2001, 2002, 2003, 2004, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -50,7 +38,6 @@ PROLOGUE(mpn_popcount)
.prologue
ifdef(`HAVE_ABI_32',
` addp4 up = 0, up C M I
- nop.m 0
zxt4 n = n C I
;;
')
diff --git a/gmp/mpn/ia64/rsh1aors_n.asm b/gmp/mpn/ia64/rsh1aors_n.asm
index 3c7defb0ba..366b5c50bb 100644
--- a/gmp/mpn/ia64/rsh1aors_n.asm
+++ b/gmp/mpn/ia64/rsh1aors_n.asm
@@ -1,34 +1,21 @@
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-2005 Free Software Foundation, Inc.
+dnl Copyright 2003, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -78,8 +65,6 @@ 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/gmp/mpn/ia64/sec_tabselect.asm b/gmp/mpn/ia64/sec_tabselect.asm
deleted file mode 100644
index f116ea3843..0000000000
--- a/gmp/mpn/ia64/sec_tabselect.asm
+++ /dev/null
@@ -1,150 +0,0 @@
-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()
diff --git a/gmp/mpn/ia64/sqr_diag_addlsh1.asm b/gmp/mpn/ia64/sqr_diag_addlsh1.asm
deleted file mode 100644
index f9288298b3..0000000000
--- a/gmp/mpn/ia64/sqr_diag_addlsh1.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-dnl IA-64 mpn_sqr_diag_addlsh1
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Unrolling could bring it to 1.5 + epsilon
-
-C Exact performance table. The 2nd line is this code, the 3rd line is ctop-
-C less code. In an assembly sqr_basecase, the ctop-full numbers will become a
-C few cycles better since we can mitigate the many I0 instructions.
-C
-C 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
-C - 20 22 24 26 28 30 32 34 36 38 40 42 44 46 48 50 52 54 56 Needs updating
-C - 13 16 17 18 20 21 23 25 26 30 31 31 33 34 36 38 39 42 43
-
-C We should keep in mind that this code takes linear time in a O(n^2) context
-C and that it will only be used under SQR_TOOM2_THRESHOLD, which might become
-C around 60. Keeping overhead down for smallish operands (< 10) is more
-C important than optimal cycle counts.
-
-C TODO
-C * Make sure we don't depend on uninitialised r-registers, f-registers, or
-C * p-registers.
-C * Optimise by doing first two loop iterations in function header.
-
-C INPUT PARAMETERS
-define(`rp_param', `r32') define(`rp', `r14') C size: 2n
-define(`tp_param', `r33') define(`tp', `r15') C size: 2n - 2
-define(`up_param', `r34') define(`up', `r31') C size: n
-define(`n', `r35')
-
-
-ASM_START()
-PROLOGUE(mpn_sqr_diag_addlsh1)
-
- .prologue
- .save ar.pfs, r2
- .save ar.lc, r3
- .body
-
-.mmi; alloc r2 = ar.pfs, 4,24,0,24 C M
- nop 4711
- mov r3 = ar.lc C I0
-.mmi; mov tp = tp_param C M I
- mov up = up_param C M I
- mov rp = rp_param C M I
- ;;
-.mmi; ld8 r36 = [tp], 8 C M
- add r20 = -2, n C M I
- mov r9 = ar.ec C I0
- ;;
-.mmi; ld8 r32 = [tp], 8 C M
- mov r16 = 0 C M I
- mov ar.ec = 7 C I0
- ;;
-.mmi; nop 4711
- mov r44 = 0 C M I
- mov ar.lc = r20 C I0
- ;;
-.mii; mov r33 = 0
- mov r10 = pr C I0
- mov pr.rot = 0x30000 C I0
- ;;
- br.cexit.spnt.few.clr L(end)
-
-dnl *** MAIN LOOP START ***
- ALIGN(32)
-L(top):
-.mfi; (p18) ldf8 f33 = [up], 8 C M
- (p20) xma.l f36 = f35, f35, f42 C F
- (p41) cmpequc p50, p0 = -1, r44 C M I
-.mfi; setfsig f40 = r16 C M23
- (p20) xma.hu f38 = f35, f35, f42 C F
- (p23) add r50 = r41, r49 C M I
- ;;
-.mmi; (p16) ld8 r36 = [tp], 8 C M
- (p23) cmpltu p40, p0 = r50, r41 C cyout hi M I
- (p19) shrp r45 = r38, r35, 63 C non-critical I0
-.mmi; (p21) getfsig r39 = f39 C hi M2
- (p24) st8 [rp] = r51, 8 C hi M23
- (p41) add r44 = 1, r44 C M I
- ;;
-.mmi; (p16) ld8 r32 = [tp], 8 C M
- (p50) cmpeqor p40, p0 = -1, r50 C cyout hi M I
- (p17) shrp r16 = r33, r37, 63 C critical I0
-.mmi; (p21) getfsig r42 = f37 C lo M2
- (p23) st8 [rp] = r44, 8 C lo M23
- (p50) add r50 = 1, r50 C M I
- ;;
- br.ctop.sptk.few.clr L(top) C B
-dnl *** MAIN LOOP END ***
- ;;
-L(end):
-.mmi; nop 4711
- (p41) add r44 = 1, r44 C M I
- shr.u r48 = r39, 63 C I0
- ;;
-.mmi; st8 [rp] = r51, 8 C M23
- (p41) cmpequc p6, p0 = 0, r44 C M I
- add r50 = r41, r48 C M I
- ;;
-.mmi; st8 [rp] = r44, 8 C M23
- (p6) add r50 = 1, r50 C M I
- mov ar.lc = r3 C I0
- ;;
-.mii; st8 [rp] = r50 C M23
- mov ar.ec = r9 C I0
- mov pr = r10 C I0
- ;;
-.mib; nop 4711
- mov ar.pfs = r2 C I0
- br.ret.sptk.many b0 C B
-EPILOGUE()
diff --git a/gmp/mpn/ia64/sqr_diagonal.asm b/gmp/mpn/ia64/sqr_diagonal.asm
new file mode 100644
index 0000000000..50307d4bb5
--- /dev/null
+++ b/gmp/mpn/ia64/sqr_diagonal.asm
@@ -0,0 +1,79 @@
+dnl IA-64 mpn_sqr_diagonal. Helper for sqr_basecase.
+
+dnl Copyright 2001, 2002, 2004 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: 4
+C Itanium 2: 2
+
+C TODO
+C * Perhaps avoid ctop loop. Unfortunately, a cloop loop running at 1 c/l
+C would need prohibitive 8-way unrolling.
+C * Instead of messing too much with this, write a nifty mpn_sqr_basecase.
+
+C INPUT PARAMETERS
+C rp = r32
+C sp = r33
+C n = r34
+
+ASM_START()
+PROLOGUE(mpn_sqr_diagonal)
+ .prologue
+ .save ar.lc, r2
+ .save pr, r15
+ .body
+ifdef(`HAVE_ABI_32',
+` addp4 r32 = 0, r32
+ addp4 r33 = 0, r33
+ zxt4 r34 = r34
+ ;;
+')
+ ldf8 f32 = [r33], 8 C M load rp[0] early
+ mov r2 = ar.lc C I0
+ mov r14 = ar.ec C I0
+ mov r15 = pr C I0
+ add r19 = -1, r34 C M I decr n
+ add r18 = 8, r32 C M I rp for high limb
+ ;;
+ mov ar.lc = r19 C I0
+ mov ar.ec = 5 C I0
+ mov pr.rot = 1<<16 C I0
+ ;;
+ br.cexit.spnt .Ldone C B
+ ;;
+ ALIGN(32)
+.Loop:
+ (p16) ldf8 f32 = [r33], 8 C M
+ (p19) xma.l f36 = f35, f35, f0 C F
+ (p21) stf8 [r32] = f38, 16 C M2 M3
+ (p19) xma.hu f40 = f35, f35, f0 C F
+ (p21) stf8 [r18] = f42, 16 C M2 M3
+ br.ctop.dptk .Loop C B
+ ;;
+.Ldone:
+ stf8 [r32] = f38 C M2 M3
+ stf8 [r18] = f42 C M2 M3
+ mov ar.ec = r14 C I0
+ ;;
+ mov pr = r15, 0x1ffff C I0
+ mov ar.lc = r2 C I0
+ br.ret.sptk.many b0 C B
+EPILOGUE(mpn_sqr_diagonal)
+ASM_END()
diff --git a/gmp/mpn/ia64/submul_1.asm b/gmp/mpn/ia64/submul_1.asm
index cb2a5525b5..ae46e55d75 100644
--- a/gmp/mpn/ia64/submul_1.asm
+++ b/gmp/mpn/ia64/submul_1.asm
@@ -1,35 +1,22 @@
dnl IA-64 mpn_submul_1 -- Multiply a limb vector with a limb and subtract the
dnl result from a second limb vector.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2000-2004 Free Software Foundation, Inc.
+dnl Copyright 2000, 2001, 2002, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/lisp/gmpasm-mode.el b/gmp/mpn/lisp/gmpasm-mode.el
index 06b74bd6ce..31a9b48cbe 100644
--- a/gmp/mpn/lisp/gmpasm-mode.el
+++ b/gmp/mpn/lisp/gmpasm-mode.el
@@ -1,33 +1,22 @@
;;; gmpasm-mode.el -- GNU MP asm and m4 editing mode.
-;; 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/.
+;; 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/.
;;; Commentary:
diff --git a/gmp/mpn/m4-ccas b/gmp/mpn/m4-ccas
index 16d80c6f51..984e8e9b0e 100755
--- a/gmp/mpn/m4-ccas
+++ b/gmp/mpn/m4-ccas
@@ -4,31 +4,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: m4-ccas --m4=M4 CC ... file.asm ...
diff --git a/gmp/mpn/m68k/README b/gmp/mpn/m68k/README
index 5261564df2..8838f8d41f 100644
--- a/gmp/mpn/m68k/README
+++ b/gmp/mpn/m68k/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/m68k/aors_n.asm b/gmp/mpn/m68k/aors_n.asm
index f7d379ec01..da9bb415b2 100644
--- a/gmp/mpn/m68k/aors_n.asm
+++ b/gmp/mpn/m68k/aors_n.asm
@@ -1,32 +1,22 @@
dnl mc68020 mpn_add_n, mpn_sub_n -- add or subtract limb vectors
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002, 2003, 2005 Free
+dnl Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/m68k/gmp-mparam.h b/gmp/mpn/m68k/gmp-mparam.h
index 9ac7b41019..c623046535 100644
--- a/gmp/mpn/m68k/gmp-mparam.h
+++ b/gmp/mpn/m68k/gmp-mparam.h
@@ -1,47 +1,36 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2000-2004 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* 25MHz 68040 */
/* Generated by tuneup.c, 2004-02-05, gcc 3.2 */
-#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 90
+#define MUL_KARATSUBA_THRESHOLD 14
+#define MUL_TOOM3_THRESHOLD 90
#define SQR_BASECASE_THRESHOLD 5
-#define SQR_TOOM2_THRESHOLD 28
+#define SQR_KARATSUBA_THRESHOLD 28
#define SQR_TOOM3_THRESHOLD 98
#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX /* never */
diff --git a/gmp/mpn/m68k/lshift.asm b/gmp/mpn/m68k/lshift.asm
index f202abfe43..9d7a5ed0f6 100644
--- a/gmp/mpn/m68k/lshift.asm
+++ b/gmp/mpn/m68k/lshift.asm
@@ -1,32 +1,22 @@
dnl mc68020 mpn_lshift -- mpn left shift.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1996, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -114,14 +104,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
@@ -133,7 +123,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.
diff --git a/gmp/mpn/m68k/m68k-defs.m4 b/gmp/mpn/m68k/m68k-defs.m4
index 15289f676f..17a345998a 100644
--- a/gmp/mpn/m68k/m68k-defs.m4
+++ b/gmp/mpn/m68k/m68k-defs.m4
@@ -2,33 +2,22 @@ divert(-1)
dnl m4 macros for 68k assembler.
-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 either:
+dnl Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a 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 default m4 `#' commenting interferes with the assembler syntax for
diff --git a/gmp/mpn/m68k/mc68020/aorsmul_1.asm b/gmp/mpn/m68k/mc68020/aorsmul_1.asm
index 4ee30ad9b3..17866602f8 100644
--- a/gmp/mpn/m68k/mc68020/aorsmul_1.asm
+++ b/gmp/mpn/m68k/mc68020/aorsmul_1.asm
@@ -1,32 +1,22 @@
dnl mc68020 mpn_addmul_1, mpn_submul_1 -- add or subtract mpn multiple.
-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 either:
+dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -55,7 +45,6 @@ define(s1_ptr, `a1')
define(s1_size, `d2')
define(s2_limb, `d4')
-MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
PROLOGUE(M4_function_1)
diff --git a/gmp/mpn/m68k/mc68020/mul_1.asm b/gmp/mpn/m68k/mc68020/mul_1.asm
index f5fbb3063b..d24f6d1d9a 100644
--- a/gmp/mpn/m68k/mc68020/mul_1.asm
+++ b/gmp/mpn/m68k/mc68020/mul_1.asm
@@ -1,32 +1,22 @@
dnl mc68020 mpn_mul_1 -- mpn by limb multiply
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/m68k/mc68020/udiv.asm b/gmp/mpn/m68k/mc68020/udiv.asm
index aadeab999a..ebc1ef26db 100644
--- a/gmp/mpn/m68k/mc68020/udiv.asm
+++ b/gmp/mpn/m68k/mc68020/udiv.asm
@@ -1,32 +1,21 @@
dnl mc68020 mpn_udiv_qrnnd -- 2x1 limb division
-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 either:
+dnl Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/m68k/mc68020/umul.asm b/gmp/mpn/m68k/mc68020/umul.asm
index f19314e9bb..4d6e8a8eb8 100644
--- a/gmp/mpn/m68k/mc68020/umul.asm
+++ b/gmp/mpn/m68k/mc68020/umul.asm
@@ -1,32 +1,21 @@
dnl mc68020 mpn_umul_ppmm -- limb by limb multiplication
-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 either:
+dnl Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/m68k/rshift.asm b/gmp/mpn/m68k/rshift.asm
index 21b5f89f48..1bf58ac310 100644
--- a/gmp/mpn/m68k/rshift.asm
+++ b/gmp/mpn/m68k/rshift.asm
@@ -1,32 +1,22 @@
dnl mc68020 mpn_rshift -- mpn right shift.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1996, 1999, 2000, 2001, 2002, 2003 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -89,7 +79,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
@@ -104,14 +94,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
@@ -123,7 +113,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.
@@ -134,7 +124,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
@@ -151,11 +141,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)
@@ -167,7 +157,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
diff --git a/gmp/mpn/m68k/t-m68k-defs.pl b/gmp/mpn/m68k/t-m68k-defs.pl
index 91c21fa1f8..226afc5449 100644
--- a/gmp/mpn/m68k/t-m68k-defs.pl
+++ b/gmp/mpn/m68k/t-m68k-defs.pl
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: perl t-m68k-defs.pl [-t]
diff --git a/gmp/mpn/m88k/README b/gmp/mpn/m88k/README
index 1b51e83079..046e3bf19a 100644
--- a/gmp/mpn/m88k/README
+++ b/gmp/mpn/m88k/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/m88k/add_n.s b/gmp/mpn/m88k/add_n.s
index dbdb22f888..db2fffff3e 100644
--- a/gmp/mpn/m88k/add_n.s
+++ b/gmp/mpn/m88k/add_n.s
@@ -3,31 +3,20 @@
; 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 either:
-;
-; * the GNU Lesser General Public License as published by the Free
-; Software Foundation; either version 3 of the License, or (at your
-; option) any later version.
-;
-; or
-;
-; * the GNU General Public License as published by the Free Software
-; Foundation; either version 2 of the License, or (at your option) any
-; later version.
-;
-; or both in parallel, as here.
-;
-; The GNU MP Library is distributed in the hope that 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/.
+; This file is part of the GNU MP Library.
+
+; The GNU MP Library is free software; you can redistribute it and/or modify
+; it under the terms of the GNU 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
diff --git a/gmp/mpn/m88k/mc88110/add_n.S b/gmp/mpn/m88k/mc88110/add_n.S
index c3b12b3cd0..3b627c01a7 100644
--- a/gmp/mpn/m88k/mc88110/add_n.S
+++ b/gmp/mpn/m88k/mc88110/add_n.S
@@ -3,31 +3,20 @@
; 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 either:
-;
-; * the GNU Lesser General Public License as published by the Free
-; Software Foundation; either version 3 of the License, or (at your
-; option) any later version.
-;
-; or
-;
-; * the GNU General Public License as published by the Free Software
-; Foundation; either version 2 of the License, or (at your option) any
-; later version.
-;
-; or both in parallel, as here.
-;
-; The GNU MP Library is distributed in the hope that 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/.
+; This file is part of the GNU MP Library.
+
+; The GNU MP Library is free software; you can redistribute it and/or modify
+; it under the terms of the GNU 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
diff --git a/gmp/mpn/m88k/mc88110/addmul_1.s b/gmp/mpn/m88k/mc88110/addmul_1.s
index 321221f23c..f41283395d 100644
--- a/gmp/mpn/m88k/mc88110/addmul_1.s
+++ b/gmp/mpn/m88k/mc88110/addmul_1.s
@@ -3,31 +3,20 @@
; 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 either:
-;
-; * the GNU Lesser General Public License as published by the Free
-; Software Foundation; either version 3 of the License, or (at your
-; option) any later version.
-;
-; or
-;
-; * the GNU General Public License as published by the Free Software
-; Foundation; either version 2 of the License, or (at your option) any
-; later version.
-;
-; or both in parallel, as here.
-;
-; The GNU MP Library is distributed in the hope that 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/.
+; This file is part of the GNU MP Library.
+
+; The GNU MP Library is free software; you can redistribute it and/or modify
+; it under the terms of the GNU 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
diff --git a/gmp/mpn/m88k/mc88110/mul_1.s b/gmp/mpn/m88k/mc88110/mul_1.s
index 28fd14b77b..e8e88790a7 100644
--- a/gmp/mpn/m88k/mc88110/mul_1.s
+++ b/gmp/mpn/m88k/mc88110/mul_1.s
@@ -3,31 +3,20 @@
; 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 either:
-;
-; * the GNU Lesser General Public License as published by the Free
-; Software Foundation; either version 3 of the License, or (at your
-; option) any later version.
-;
-; or
-;
-; * the GNU General Public License as published by the Free Software
-; Foundation; either version 2 of the License, or (at your option) any
-; later version.
-;
-; or both in parallel, as here.
-;
-; The GNU MP Library is distributed in the hope that 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/.
+; This file is part of the GNU MP Library.
+
+; The GNU MP Library is free software; you can redistribute it and/or modify
+; it under the terms of the GNU 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
diff --git a/gmp/mpn/m88k/mc88110/sub_n.S b/gmp/mpn/m88k/mc88110/sub_n.S
index f0a8ecb3f0..a21a2cc0c0 100644
--- a/gmp/mpn/m88k/mc88110/sub_n.S
+++ b/gmp/mpn/m88k/mc88110/sub_n.S
@@ -3,31 +3,20 @@
; 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 either:
-;
-; * the GNU Lesser General Public License as published by the Free
-; Software Foundation; either version 3 of the License, or (at your
-; option) any later version.
-;
-; or
-;
-; * the GNU General Public License as published by the Free Software
-; Foundation; either version 2 of the License, or (at your option) any
-; later version.
-;
-; or both in parallel, as here.
-;
-; The GNU MP Library is distributed in the hope that 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/.
+; This file is part of the GNU MP Library.
+
+; The GNU MP Library is free software; you can redistribute it and/or modify
+; it under the terms of the GNU 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
diff --git a/gmp/mpn/m88k/mul_1.s b/gmp/mpn/m88k/mul_1.s
index c8abdc0b7f..5c385bd351 100644
--- a/gmp/mpn/m88k/mul_1.s
+++ b/gmp/mpn/m88k/mul_1.s
@@ -3,31 +3,20 @@
; 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 either:
-;
-; * the GNU Lesser General Public License as published by the Free
-; Software Foundation; either version 3 of the License, or (at your
-; option) any later version.
-;
-; or
-;
-; * the GNU General Public License as published by the Free Software
-; Foundation; either version 2 of the License, or (at your option) any
-; later version.
-;
-; or both in parallel, as here.
-;
-; The GNU MP Library is distributed in the hope that 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/.
+; This file is part of the GNU MP Library.
+
+; The GNU MP Library is free software; you can redistribute it and/or modify
+; it under the terms of the GNU 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
diff --git a/gmp/mpn/m88k/sub_n.s b/gmp/mpn/m88k/sub_n.s
index 2bd8f09ca3..9ea78ff3a1 100644
--- a/gmp/mpn/m88k/sub_n.s
+++ b/gmp/mpn/m88k/sub_n.s
@@ -3,31 +3,20 @@
; 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 either:
-;
-; * the GNU Lesser General Public License as published by the Free
-; Software Foundation; either version 3 of the License, or (at your
-; option) any later version.
-;
-; or
-;
-; * the GNU General Public License as published by the Free Software
-; Foundation; either version 2 of the License, or (at your option) any
-; later version.
-;
-; or both in parallel, as here.
-;
-; The GNU MP Library is distributed in the hope that 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/.
+; This file is part of the GNU MP Library.
+
+; The GNU MP Library is free software; you can redistribute it and/or modify
+; it under the terms of the GNU 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
diff --git a/gmp/mpn/minithres/gmp-mparam.h b/gmp/mpn/minithres/gmp-mparam.h
index 1b8f311516..cf5970b7d1 100644
--- a/gmp/mpn/minithres/gmp-mparam.h
+++ b/gmp/mpn/minithres/gmp-mparam.h
@@ -1,109 +1,64 @@
/* Minimal values gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000, 2006, 2008-2010, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 values in this file are not currently minimal.
Trimming them further would be good. */
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 2
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 3
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 4
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 1
-#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 3
-
-#define MUL_TOOM22_THRESHOLD 8
-#define MUL_TOOM33_THRESHOLD 20
-#define MUL_TOOM44_THRESHOLD 24
-#define MUL_TOOM6H_THRESHOLD 70 /* FIXME */
-#define MUL_TOOM8H_THRESHOLD 86
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 50 /* FIXME */
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 50 /* FIXME */
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 50 /* FIXME */
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 50 /* FIXME */
-
-#define SQR_BASECASE_THRESHOLD 0
-#define SQR_TOOM2_THRESHOLD 8
-#define SQR_TOOM3_THRESHOLD 20
-#define SQR_TOOM4_THRESHOLD 24
-#define SQR_TOOM6H_THRESHOLD 70 /* FIXME */
-#define SQR_TOOM8H_THRESHOLD 86
-
-#define MULMOD_BNM1_THRESHOLD 10
-#define SQRMOD_BNM1_THRESHOLD 10
-
-#define MUL_FFT_TABLE {64, 256, 1024, 4096, 8192, 65536, 0}
+#define MUL_KARATSUBA_THRESHOLD 8
+#define MUL_TOOM3_THRESHOLD 20
+#define MUL_TOOM44_THRESHOLD 24
+
+#define SQR_BASECASE_THRESHOLD 0
+#define SQR_KARATSUBA_THRESHOLD 8
+#define SQR_TOOM3_THRESHOLD 20
+#define SQR_TOOM4_THRESHOLD 24
+
+#define MULLOW_BASECASE_THRESHOLD 0
+#define MULLOW_DC_THRESHOLD 2
+#define MULLOW_MUL_N_THRESHOLD 4
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 6
+#define POWM_THRESHOLD 4
+
+#define HGCD_THRESHOLD 10
+#define GCD_DC_THRESHOLD 20
+#define GCDEXT_SCHOENHAGE_THRESHOLD 20
+#define JACOBI_BASE_METHOD 1
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1
+#define DIVREM_2_THRESHOLD 0 /* always */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 4
+#define GET_STR_PRECOMPUTE_THRESHOLD 10
+#define SET_STR_THRESHOLD 64
+#define SET_STR_PRECOMPUTE_THRESHOLD 100
+
+#define MUL_FFT_TABLE {64-1, 256-1, 1024-1, 4096-1, 8192-1, 65536-1, 0}
#define MUL_FFT_MODF_THRESHOLD 65
#define MUL_FFT_THRESHOLD 200
-#define SQR_FFT_TABLE {64, 256, 1024, 4096, 8192, 65536, 0}
+#define SQR_FFT_TABLE {64-1, 256-1, 1024-1, 4096-1, 8192-1, 65536-1, 0}
#define SQR_FFT_MODF_THRESHOLD 65
#define SQR_FFT_THRESHOLD 200
-
-#define MULLO_BASECASE_THRESHOLD 0
-#define MULLO_DC_THRESHOLD 2
-#define MULLO_MUL_N_THRESHOLD 4
-
-#define DC_DIV_QR_THRESHOLD 6
-#define DC_DIVAPPR_Q_THRESHOLD 6
-#define DC_BDIV_QR_THRESHOLD 4
-#define DC_BDIV_Q_THRESHOLD 4
-
-#define INV_MULMOD_BNM1_THRESHOLD 2
-#define INV_NEWTON_THRESHOLD 6
-#define INV_APPR_THRESHOLD 4
-
-#define BINV_NEWTON_THRESHOLD 6
-#define REDC_1_TO_REDC_N_THRESHOLD 9
-
-#define MU_DIV_QR_THRESHOLD 8
-#define MU_DIVAPPR_Q_THRESHOLD 8
-#define MUPI_DIV_QR_THRESHOLD 8
-#define MU_BDIV_QR_THRESHOLD 8
-#define MU_BDIV_Q_THRESHOLD 8
-
-#define MATRIX22_STRASSEN_THRESHOLD 2
-#define HGCD_THRESHOLD 10
-#define GCD_DC_THRESHOLD 20
-#define GCDEXT_SCHOENHAGE_THRESHOLD 20
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 4
-#define GET_STR_PRECOMPUTE_THRESHOLD 10
-#define SET_STR_THRESHOLD 64
-#define SET_STR_PRECOMPUTE_THRESHOLD 100
-
-#define FAC_ODD_THRESHOLD 0 /* always */
-#define FAC_DSC_THRESHOLD 70
diff --git a/gmp/mpn/mips32/add_n.asm b/gmp/mpn/mips32/add_n.asm
index e7d4c48f48..f7dc7efab9 100644
--- a/gmp/mpn/mips32/add_n.asm
+++ b/gmp/mpn/mips32/add_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips32/addmul_1.asm b/gmp/mpn/mips32/addmul_1.asm
index 9aa9e163ce..f43e3c638b 100644
--- a/gmp/mpn/mips32/addmul_1.asm
+++ b/gmp/mpn/mips32/addmul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips32/gmp-mparam.h b/gmp/mpn/mips32/gmp-mparam.h
index 986135df96..d86fd3f019 100644
--- a/gmp/mpn/mips32/gmp-mparam.h
+++ b/gmp/mpn/mips32/gmp-mparam.h
@@ -1,45 +1,35 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* Generated by tuneup.c, 2002-02-20, gcc 2.95 (R3000) */
-#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 50
+#define MUL_KARATSUBA_THRESHOLD 20
+#define MUL_TOOM3_THRESHOLD 50
#define SQR_BASECASE_THRESHOLD 7
-#define SQR_TOOM2_THRESHOLD 57
+#define SQR_KARATSUBA_THRESHOLD 57
#define SQR_TOOM3_THRESHOLD 78
#define DIV_SB_PREINV_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/mips32/lshift.asm b/gmp/mpn/mips32/lshift.asm
index 6a58bb4579..8a27951775 100644
--- a/gmp/mpn/mips32/lshift.asm
+++ b/gmp/mpn/mips32/lshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips32/mips-defs.m4 b/gmp/mpn/mips32/mips-defs.m4
index 5fa89eca35..a30e8df090 100644
--- a/gmp/mpn/mips32/mips-defs.m4
+++ b/gmp/mpn/mips32/mips-defs.m4
@@ -3,33 +3,22 @@ divert(-1)
dnl m4 macros for MIPS assembly code (both 32-bit and 64-bit).
-dnl Copyright 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 2000, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Usage: ASM_START()
diff --git a/gmp/mpn/mips32/mips.m4 b/gmp/mpn/mips32/mips.m4
index 8b49e575e4..37c6ca8f72 100644
--- a/gmp/mpn/mips32/mips.m4
+++ b/gmp/mpn/mips32/mips.m4
@@ -3,33 +3,22 @@ divert(-1)
dnl m4 macros for MIPS assembly code.
-dnl Copyright 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 2000, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Usage: ASM_START()
diff --git a/gmp/mpn/mips32/mul_1.asm b/gmp/mpn/mips32/mul_1.asm
index 4337bc2bd4..1e1a275f66 100644
--- a/gmp/mpn/mips32/mul_1.asm
+++ b/gmp/mpn/mips32/mul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips32/rshift.asm b/gmp/mpn/mips32/rshift.asm
index 4b54510408..23d1e780e6 100644
--- a/gmp/mpn/mips32/rshift.asm
+++ b/gmp/mpn/mips32/rshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips32/sub_n.asm b/gmp/mpn/mips32/sub_n.asm
index a962ce1b79..ed41271676 100644
--- a/gmp/mpn/mips32/sub_n.asm
+++ b/gmp/mpn/mips32/sub_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips32/submul_1.asm b/gmp/mpn/mips32/submul_1.asm
index 335722b4e5..4e43654e0a 100644
--- a/gmp/mpn/mips32/submul_1.asm
+++ b/gmp/mpn/mips32/submul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips32/umul.asm b/gmp/mpn/mips32/umul.asm
index 1ced0eb883..04ecbe5095 100644
--- a/gmp/mpn/mips32/umul.asm
+++ b/gmp/mpn/mips32/umul.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips64/README b/gmp/mpn/mips64/README
index 7ddd0e572c..65a1af1668 100644
--- a/gmp/mpn/mips64/README
+++ b/gmp/mpn/mips64/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -41,7 +30,7 @@ RELEVANT OPTIMIZATION ISSUES
On the R4600, branches takes a single cycle
- On the R8000, branches often take no noticeable cycles, as they are
+ On the R8000, branches often take no noticable cycles, as they are
executed in a separate function unit..
2. The R4000 and R4400 have a load latency of 4 cycles.
diff --git a/gmp/mpn/mips64/add_n.asm b/gmp/mpn/mips64/add_n.asm
index 6856407efd..1a3978c3f9 100644
--- a/gmp/mpn/mips64/add_n.asm
+++ b/gmp/mpn/mips64/add_n.asm
@@ -1,33 +1,22 @@
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-2002, 2011 Free Software Foundation, Inc.
+dnl Copyright 1995, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -38,17 +27,6 @@ C s2_ptr $6
C size $7
ASM_START()
-PROLOGUE(mpn_add_nc)
- ld $10,0($5)
- ld $11,0($6)
-
- daddiu $7,$7,-1
- and $9,$7,4-1 C number of limbs in first loop
- beq $9,$0,.L0 C if multiple of 4 limbs, skip first loop
- move $2,$8
- b .Loop0
- dsubu $7,$7,$9
-EPILOGUE()
PROLOGUE(mpn_add_n)
ld $10,0($5)
ld $11,0($6)
@@ -131,4 +109,4 @@ PROLOGUE(mpn_add_n)
sd $11,0($4)
j $31
or $2,$2,$8
-EPILOGUE()
+EPILOGUE(mpn_add_n)
diff --git a/gmp/mpn/mips64/addmul_1.asm b/gmp/mpn/mips64/addmul_1.asm
index 8ff0976e25..a116298a76 100644
--- a/gmp/mpn/mips64/addmul_1.asm
+++ b/gmp/mpn/mips64/addmul_1.asm
@@ -1,33 +1,23 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1995, 2000, 2001, 2002 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips64/gmp-mparam.h b/gmp/mpn/mips64/gmp-mparam.h
index b7fcf24a41..d189e895c5 100644
--- a/gmp/mpn/mips64/gmp-mparam.h
+++ b/gmp/mpn/mips64/gmp-mparam.h
@@ -1,45 +1,35 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2004 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
/* Generated by tuneup.c, 2004-02-10, gcc 3.2 & MIPSpro C 7.2.1 (R1x000) */
-#define MUL_TOOM22_THRESHOLD 16
-#define MUL_TOOM33_THRESHOLD 89
+#define MUL_KARATSUBA_THRESHOLD 16
+#define MUL_TOOM3_THRESHOLD 89
#define SQR_BASECASE_THRESHOLD 6
-#define SQR_TOOM2_THRESHOLD 32
+#define SQR_KARATSUBA_THRESHOLD 32
#define SQR_TOOM3_THRESHOLD 98
#define DIV_SB_PREINV_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/mips64/lshift.asm b/gmp/mpn/mips64/lshift.asm
index 3440eaf80b..16da93c5ab 100644
--- a/gmp/mpn/mips64/lshift.asm
+++ b/gmp/mpn/mips64/lshift.asm
@@ -1,32 +1,21 @@
dnl MIPS64 mpn_lshift -- Left shift.
-dnl Copyright 1995, 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 1995, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips64/mul_1.asm b/gmp/mpn/mips64/mul_1.asm
index 77acf0ac25..d16e08d594 100644
--- a/gmp/mpn/mips64/mul_1.asm
+++ b/gmp/mpn/mips64/mul_1.asm
@@ -1,33 +1,23 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1995, 2000, 2001, 2002 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips64/rshift.asm b/gmp/mpn/mips64/rshift.asm
index 9253cb51d8..5294875621 100644
--- a/gmp/mpn/mips64/rshift.asm
+++ b/gmp/mpn/mips64/rshift.asm
@@ -1,32 +1,21 @@
dnl MIPS64 mpn_rshift -- Right shift.
-dnl Copyright 1995, 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 1995, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips64/sqr_diagonal.asm b/gmp/mpn/mips64/sqr_diagonal.asm
index dcb87dc21f..511a7552c9 100644
--- a/gmp/mpn/mips64/sqr_diagonal.asm
+++ b/gmp/mpn/mips64/sqr_diagonal.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/mips64/sub_n.asm b/gmp/mpn/mips64/sub_n.asm
index 6a698976eb..b28c1ced9c 100644
--- a/gmp/mpn/mips64/sub_n.asm
+++ b/gmp/mpn/mips64/sub_n.asm
@@ -1,33 +1,22 @@
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-2002, 2011 Free Software Foundation, Inc.
+dnl Copyright 1995, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -38,17 +27,6 @@ C s2_ptr $6
C size $7
ASM_START()
-PROLOGUE(mpn_sub_nc)
- ld $10,0($5)
- ld $11,0($6)
-
- daddiu $7,$7,-1
- and $9,$7,4-1 C number of limbs in first loop
- beq $9,$0,.L0 C if multiple of 4 limbs, skip first loop
- move $2,$8
- b .Loop0
- dsubu $7,$7,$9
-EPILOGUE()
PROLOGUE(mpn_sub_n)
ld $10,0($5)
ld $11,0($6)
@@ -131,4 +109,4 @@ PROLOGUE(mpn_sub_n)
sd $11,0($4)
j $31
or $2,$2,$8
-EPILOGUE()
+EPILOGUE(mpn_sub_n)
diff --git a/gmp/mpn/mips64/submul_1.asm b/gmp/mpn/mips64/submul_1.asm
index 089589cd73..11e17370c0 100644
--- a/gmp/mpn/mips64/submul_1.asm
+++ b/gmp/mpn/mips64/submul_1.asm
@@ -1,33 +1,23 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1995, 2000, 2001, 2002 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/mips64/umul.asm b/gmp/mpn/mips64/umul.asm
index b9aac57591..1792d97fdb 100644
--- a/gmp/mpn/mips64/umul.asm
+++ b/gmp/mpn/mips64/umul.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/ns32k/add_n.s b/gmp/mpn/ns32k/add_n.s
new file mode 100644
index 0000000000..962cc1657b
--- /dev/null
+++ b/gmp/mpn/ns32k/add_n.s
@@ -0,0 +1,44 @@
+# 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/gmp/mpn/ns32k/addmul_1.s b/gmp/mpn/ns32k/addmul_1.s
new file mode 100644
index 0000000000..1dd8791be3
--- /dev/null
+++ b/gmp/mpn/ns32k/addmul_1.s
@@ -0,0 +1,46 @@
+# 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/gmp/mpn/ns32k/mul_1.s b/gmp/mpn/ns32k/mul_1.s
new file mode 100644
index 0000000000..abc911e0c9
--- /dev/null
+++ b/gmp/mpn/ns32k/mul_1.s
@@ -0,0 +1,45 @@
+# 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/gmp/mpn/ns32k/sub_n.s b/gmp/mpn/ns32k/sub_n.s
new file mode 100644
index 0000000000..5252ddf5c6
--- /dev/null
+++ b/gmp/mpn/ns32k/sub_n.s
@@ -0,0 +1,44 @@
+# 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/gmp/mpn/ns32k/submul_1.s b/gmp/mpn/ns32k/submul_1.s
new file mode 100644
index 0000000000..7a0ba9a73c
--- /dev/null
+++ b/gmp/mpn/ns32k/submul_1.s
@@ -0,0 +1,46 @@
+# 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
diff --git a/gmp/mpn/pa32/README b/gmp/mpn/pa32/README
index 4323390c9b..72158d30ea 100644
--- a/gmp/mpn/pa32/README
+++ b/gmp/mpn/pa32/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/pa32/add_n.asm b/gmp/mpn/pa32/add_n.asm
index 46f39377ea..1bb27ae883 100644
--- a/gmp/mpn/pa32/add_n.asm
+++ b/gmp/mpn/pa32/add_n.asm
@@ -1,33 +1,22 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/gmp-mparam.h b/gmp/mpn/pa32/gmp-mparam.h
index 377efcb156..005539c0d7 100644
--- a/gmp/mpn/pa32/gmp-mparam.h
+++ b/gmp/mpn/pa32/gmp-mparam.h
@@ -1,61 +1,53 @@
/* HP-PA 1.0 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* These values are for the PA7100 using GCC. */
/* Generated by tuneup.c, 2000-10-27. */
-#ifndef MUL_TOOM22_THRESHOLD
-#define MUL_TOOM22_THRESHOLD 30
+#ifndef MUL_KARATSUBA_THRESHOLD
+#define MUL_KARATSUBA_THRESHOLD 30
#endif
-#ifndef MUL_TOOM33_THRESHOLD
-#define MUL_TOOM33_THRESHOLD 141
+#ifndef MUL_TOOM3_THRESHOLD
+#define MUL_TOOM3_THRESHOLD 141
#endif
-#ifndef SQR_TOOM2_THRESHOLD
-#define SQR_TOOM2_THRESHOLD 59
+#ifndef SQR_KARATSUBA_THRESHOLD
+#define SQR_KARATSUBA_THRESHOLD 59
#endif
#ifndef SQR_TOOM3_THRESHOLD
#define SQR_TOOM3_THRESHOLD 177
#endif
#ifndef DIV_DC_THRESHOLD
-#define DIV_DC_THRESHOLD 108
+#define DIV_DC_THRESHOLD 108
#endif
#ifndef POWM_THRESHOLD
#define POWM_THRESHOLD 18
#endif
-#ifndef GCDEXT_THRESHOLD
+#ifndef GCD_ACCEL_THRESHOLD
+#define GCD_ACCEL_THRESHOLD 46
+#endif
#define GCDEXT_THRESHOLD 33
#endif
diff --git a/gmp/mpn/pa32/hppa1_1/addmul_1.asm b/gmp/mpn/pa32/hppa1_1/addmul_1.asm
index ec2f2198e8..c50e4e10f7 100644
--- a/gmp/mpn/pa32/hppa1_1/addmul_1.asm
+++ b/gmp/mpn/pa32/hppa1_1/addmul_1.asm
@@ -1,33 +1,23 @@
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-1994, 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 1994, 2000, 2001, 2002 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/gmp-mparam.h b/gmp/mpn/pa32/hppa1_1/gmp-mparam.h
index 1261b24c83..5ced745486 100644
--- a/gmp/mpn/pa32/hppa1_1/gmp-mparam.h
+++ b/gmp/mpn/pa32/hppa1_1/gmp-mparam.h
@@ -1,43 +1,33 @@
/* HP-PA 1.1 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* Generated by tuneup.c, 2004-02-07, gcc 2.8 (pa7100/100MHz) */
-#define MUL_TOOM22_THRESHOLD 30
-#define MUL_TOOM33_THRESHOLD 89
+#define MUL_KARATSUBA_THRESHOLD 30
+#define MUL_TOOM3_THRESHOLD 89
#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 55
+#define SQR_KARATSUBA_THRESHOLD 55
#define SQR_TOOM3_THRESHOLD 101
#define DIV_SB_PREINV_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/pa32/hppa1_1/mul_1.asm b/gmp/mpn/pa32/hppa1_1/mul_1.asm
index 6e60c2f61f..9e17c2d023 100644
--- a/gmp/mpn/pa32/hppa1_1/mul_1.asm
+++ b/gmp/mpn/pa32/hppa1_1/mul_1.asm
@@ -1,33 +1,23 @@
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-1994, 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 1994, 2000, 2001, 2002 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/pa7100/add_n.asm b/gmp/mpn/pa32/hppa1_1/pa7100/add_n.asm
index b96d403826..326a133984 100644
--- a/gmp/mpn/pa32/hppa1_1/pa7100/add_n.asm
+++ b/gmp/mpn/pa32/hppa1_1/pa7100/add_n.asm
@@ -2,33 +2,23 @@ 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-2003 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 2001, 2002, 2003 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/pa7100/addmul_1.asm b/gmp/mpn/pa32/hppa1_1/pa7100/addmul_1.asm
index fb16100d83..57f4d76745 100644
--- a/gmp/mpn/pa32/hppa1_1/pa7100/addmul_1.asm
+++ b/gmp/mpn/pa32/hppa1_1/pa7100/addmul_1.asm
@@ -1,33 +1,22 @@
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-2003 Free Software Foundation, Inc.
+dnl Copyright 1995, 2000, 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/pa7100/lshift.asm b/gmp/mpn/pa32/hppa1_1/pa7100/lshift.asm
index d65db2a76b..f6b4068cfa 100644
--- a/gmp/mpn/pa32/hppa1_1/pa7100/lshift.asm
+++ b/gmp/mpn/pa32/hppa1_1/pa7100/lshift.asm
@@ -1,33 +1,23 @@
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-2003 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 2001, 2002, 2003 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/pa7100/rshift.asm b/gmp/mpn/pa32/hppa1_1/pa7100/rshift.asm
index f7896fc949..ed7313b5fc 100644
--- a/gmp/mpn/pa32/hppa1_1/pa7100/rshift.asm
+++ b/gmp/mpn/pa32/hppa1_1/pa7100/rshift.asm
@@ -1,33 +1,23 @@
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-2003 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 2001, 2002, 2003 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/pa7100/sub_n.asm b/gmp/mpn/pa32/hppa1_1/pa7100/sub_n.asm
index df3f6e8b81..38ea0e197e 100644
--- a/gmp/mpn/pa32/hppa1_1/pa7100/sub_n.asm
+++ b/gmp/mpn/pa32/hppa1_1/pa7100/sub_n.asm
@@ -2,33 +2,23 @@ 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-2003 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 2001, 2002, 2003 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/pa7100/submul_1.asm b/gmp/mpn/pa32/hppa1_1/pa7100/submul_1.asm
index 5ea08cbee5..aee9d9033e 100644
--- a/gmp/mpn/pa32/hppa1_1/pa7100/submul_1.asm
+++ b/gmp/mpn/pa32/hppa1_1/pa7100/submul_1.asm
@@ -1,33 +1,22 @@
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-2003 Free Software Foundation, Inc.
+dnl Copyright 1995, 2000, 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/sqr_diagonal.asm b/gmp/mpn/pa32/hppa1_1/sqr_diagonal.asm
index 1c7a18e37d..4eba989276 100644
--- a/gmp/mpn/pa32/hppa1_1/sqr_diagonal.asm
+++ b/gmp/mpn/pa32/hppa1_1/sqr_diagonal.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/submul_1.asm b/gmp/mpn/pa32/hppa1_1/submul_1.asm
index a9b11d24a8..c6bc38394b 100644
--- a/gmp/mpn/pa32/hppa1_1/submul_1.asm
+++ b/gmp/mpn/pa32/hppa1_1/submul_1.asm
@@ -1,33 +1,23 @@
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-1994, 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 1994, 2000, 2001, 2002 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/udiv.asm b/gmp/mpn/pa32/hppa1_1/udiv.asm
index 626ecd202b..e6a9927edf 100644
--- a/gmp/mpn/pa32/hppa1_1/udiv.asm
+++ b/gmp/mpn/pa32/hppa1_1/udiv.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa1_1/umul.asm b/gmp/mpn/pa32/hppa1_1/umul.asm
index 18b923cd5a..7f1cb93949 100644
--- a/gmp/mpn/pa32/hppa1_1/umul.asm
+++ b/gmp/mpn/pa32/hppa1_1/umul.asm
@@ -1,30 +1,19 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa2_0/add_n.asm b/gmp/mpn/pa32/hppa2_0/add_n.asm
index 8d881b8b08..685c4c91ae 100644
--- a/gmp/mpn/pa32/hppa2_0/add_n.asm
+++ b/gmp/mpn/pa32/hppa2_0/add_n.asm
@@ -1,33 +1,22 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1997, 1998, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa2_0/gmp-mparam.h b/gmp/mpn/pa32/hppa2_0/gmp-mparam.h
index 6016274714..c356b4acce 100644
--- a/gmp/mpn/pa32/hppa2_0/gmp-mparam.h
+++ b/gmp/mpn/pa32/hppa2_0/gmp-mparam.h
@@ -1,167 +1,73 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2009, 2010 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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
-
-/* 552 MHz PA8600 (gcc61.fsffrance.org) */
-
-#define DIVREM_1_NORM_THRESHOLD 3
-#define DIVREM_1_UNNORM_THRESHOLD 3
-#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 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 22
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 28
-#define USE_PREINV_DIVREM_1 1
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 36
-
-#define MUL_TOOM22_THRESHOLD 18
-#define MUL_TOOM33_THRESHOLD 65
-#define MUL_TOOM44_THRESHOLD 166
-#define MUL_TOOM6H_THRESHOLD 202
-#define MUL_TOOM8H_THRESHOLD 333
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 105
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 138
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 102
-
-#define SQR_BASECASE_THRESHOLD 7
-#define SQR_TOOM2_THRESHOLD 55
-#define SQR_TOOM3_THRESHOLD 93
-#define SQR_TOOM4_THRESHOLD 250
-#define SQR_TOOM6_THRESHOLD 306
-#define SQR_TOOM8_THRESHOLD 527
-
-#define MULMOD_BNM1_THRESHOLD 13
-#define SQRMOD_BNM1_THRESHOLD 15
-
-#define MUL_FFT_MODF_THRESHOLD 244 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 244, 5}, { 8, 4}, { 17, 5}, { 13, 6}, \
- { 7, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 13, 7}, { 7, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 11, 6}, { 24, 7}, { 13, 8}, \
- { 7, 7}, { 19, 8}, { 11, 7}, { 25, 8}, \
- { 15, 7}, { 33, 8}, { 23, 9}, { 15, 8}, \
- { 39, 9}, { 23,10}, { 15, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 79, 9}, { 47,10}, \
- { 31, 9}, { 71, 8}, { 143, 9}, { 79,10}, \
- { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255, 9}, { 135, 8}, { 271, 9}, { 143,10}, \
- { 79, 9}, { 159, 8}, { 319, 9}, { 175, 8}, \
- { 351,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, 9}, \
- { 351,11}, { 95,10}, { 191, 9}, { 383,10}, \
- { 207, 9}, { 415,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271, 9}, { 543, 8}, \
- { 1087,10}, { 287, 9}, { 575,10}, { 303,11}, \
- { 159,10}, { 351, 9}, { 703, 8}, { 1407,11}, \
- { 191,10}, { 415, 9}, { 831,11}, { 223, 9}, \
- { 895,10}, { 479,12}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,11}, { 351,10}, { 703, 9}, { 1407,12}, \
- { 191,11}, { 415,10}, { 831,11}, { 479,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 107
-#define MUL_FFT_THRESHOLD 2112
-
-#define SQR_FFT_MODF_THRESHOLD 240 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 240, 5}, { 8, 4}, { 17, 5}, { 19, 6}, \
- { 17, 7}, { 9, 6}, { 20, 7}, { 11, 6}, \
- { 23, 7}, { 13, 8}, { 7, 7}, { 19, 8}, \
- { 11, 7}, { 25, 8}, { 15, 7}, { 33, 8}, \
- { 19, 7}, { 39, 8}, { 23, 9}, { 15, 8}, \
- { 39, 9}, { 23,10}, { 15, 9}, { 31, 8}, \
- { 63, 9}, { 47,10}, { 31, 9}, { 63, 8}, \
- { 127, 9}, { 71, 8}, { 143, 9}, { 79,10}, \
- { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255, 7}, { 511, 9}, { 135, 8}, { 271, 9}, \
- { 143,10}, { 79, 9}, { 159, 8}, { 319, 9}, \
- { 175, 8}, { 351, 7}, { 703,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, 9}, { 351, 8}, { 703,11}, \
- { 95,10}, { 191, 9}, { 383,10}, { 207, 9}, \
- { 415,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, 8}, { 1407,11}, \
- { 191,10}, { 415, 9}, { 831,11}, { 223, 8}, \
- { 1791,10}, { 479, 9}, { 959,12}, { 127,11}, \
- { 255,10}, { 543,11}, { 287,10}, { 607,11}, \
- { 319,10}, { 639,11}, { 351,10}, { 703, 9}, \
- { 1407,12}, { 191,11}, { 415,10}, { 831,11}, \
- { 479,10}, { 959,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 109
-#define SQR_FFT_THRESHOLD 1600
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 116
-#define MULLO_MUL_N_THRESHOLD 3574
-
-#define DC_DIV_QR_THRESHOLD 100
-#define DC_DIVAPPR_Q_THRESHOLD 348
-#define DC_BDIV_QR_THRESHOLD 109
-#define DC_BDIV_Q_THRESHOLD 254
-
-#define INV_MULMOD_BNM1_THRESHOLD 34
-#define INV_NEWTON_THRESHOLD 276
-#define INV_APPR_THRESHOLD 276
-
-#define BINV_NEWTON_THRESHOLD 278
-#define REDC_1_TO_REDC_N_THRESHOLD 78
-
-#define MU_DIV_QR_THRESHOLD 979
-#define MU_DIVAPPR_Q_THRESHOLD 263
-#define MUPI_DIV_QR_THRESHOLD 102
-#define MU_BDIV_QR_THRESHOLD 807
-#define MU_BDIV_Q_THRESHOLD 1187
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 100
-#define GCD_DC_THRESHOLD 379
-#define GCDEXT_DC_THRESHOLD 249
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 7
-#define GET_STR_PRECOMPUTE_THRESHOLD 16
-#define SET_STR_DC_THRESHOLD 270
-#define SET_STR_PRECOMPUTE_THRESHOLD 782
+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 BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
+
+/* Generated by tuneup.c, 2009-03-05, gcc 4.3 */
+
+#define MUL_KARATSUBA_THRESHOLD 15
+#define MUL_TOOM3_THRESHOLD 98
+#define MUL_TOOM44_THRESHOLD 158
+
+#define SQR_BASECASE_THRESHOLD 6
+#define SQR_KARATSUBA_THRESHOLD 48
+#define SQR_TOOM3_THRESHOLD 97
+#define SQR_TOOM4_THRESHOLD 232
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 92
+#define MULLOW_MUL_N_THRESHOLD 363
+
+#define DIV_SB_PREINV_THRESHOLD 4
+#define DIV_DC_THRESHOLD 92
+#define POWM_THRESHOLD 142
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD_THRESHOLD 100
+#define GCD_DC_THRESHOLD 365
+#define GCDEXT_DC_THRESHOLD 339
+#define JACOBI_BASE_METHOD 2
+
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 5
+#define MOD_1_NORM_THRESHOLD 4
+#define MOD_1_UNNORM_THRESHOLD 5
+#define MOD_1_1_THRESHOLD 6
+#define MOD_1_2_THRESHOLD 9
+#define MOD_1_4_THRESHOLD 24
+#define USE_PREINV_DIVREM_1 1
+#define USE_PREINV_MOD_1 1
+#define DIVREM_2_THRESHOLD 0 /* always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD MP_SIZE_T_MAX /* never */
+
+#define GET_STR_DC_THRESHOLD 8
+#define GET_STR_PRECOMPUTE_THRESHOLD 13
+#define SET_STR_DC_THRESHOLD 224
+#define SET_STR_PRECOMPUTE_THRESHOLD 702
+
+#define MUL_FFT_TABLE { 272, 672, 896, 2560, 6144, 24576, 98304, 393216, 0 }
+#define MUL_FFT_MODF_THRESHOLD 232
+#define MUL_FFT_THRESHOLD 1792
+
+#define SQR_FFT_TABLE { 304, 672, 1152, 2560, 10240, 24576, 98304, 393216, 0 }
+#define SQR_FFT_MODF_THRESHOLD 232
+#define SQR_FFT_THRESHOLD 1792
diff --git a/gmp/mpn/pa32/hppa2_0/sqr_diagonal.asm b/gmp/mpn/pa32/hppa2_0/sqr_diagonal.asm
index c55112fac5..3493c87322 100644
--- a/gmp/mpn/pa32/hppa2_0/sqr_diagonal.asm
+++ b/gmp/mpn/pa32/hppa2_0/sqr_diagonal.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/hppa2_0/sub_n.asm b/gmp/mpn/pa32/hppa2_0/sub_n.asm
index 47b3163fe3..b0aefb4abb 100644
--- a/gmp/mpn/pa32/hppa2_0/sub_n.asm
+++ b/gmp/mpn/pa32/hppa2_0/sub_n.asm
@@ -1,33 +1,22 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1997, 1998, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/lshift.asm b/gmp/mpn/pa32/lshift.asm
index 5ea497c1f1..2128fbeed4 100644
--- a/gmp/mpn/pa32/lshift.asm
+++ b/gmp/mpn/pa32/lshift.asm
@@ -1,32 +1,21 @@
dnl HP-PA mpn_lshift -- Shift a number left.
-dnl Copyright 1992, 1994, 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/pa-defs.m4 b/gmp/mpn/pa32/pa-defs.m4
index b26e715fc5..affaef897a 100644
--- a/gmp/mpn/pa32/pa-defs.m4
+++ b/gmp/mpn/pa32/pa-defs.m4
@@ -3,37 +3,26 @@ divert(-1)
dnl m4 macros for HPPA assembler.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl hppa assembler comments are introduced with ";".
dnl
-dnl For cooperation with cpp, apparently lines "# 123" set the line number,
+dnl For cooperation with cpp, aparently lines "# 123" set the line number,
dnl and other lines starting with a "#" are ignored.
changecom(;)
diff --git a/gmp/mpn/pa32/rshift.asm b/gmp/mpn/pa32/rshift.asm
index c5eac830c9..238b0be7ed 100644
--- a/gmp/mpn/pa32/rshift.asm
+++ b/gmp/mpn/pa32/rshift.asm
@@ -1,32 +1,21 @@
dnl HP-PA mpn_rshift -- Shift a number right.
-dnl Copyright 1992, 1994, 2000-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/sub_n.asm b/gmp/mpn/pa32/sub_n.asm
index 9c71655b98..d07ebb5bb6 100644
--- a/gmp/mpn/pa32/sub_n.asm
+++ b/gmp/mpn/pa32/sub_n.asm
@@ -1,33 +1,22 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa32/udiv.asm b/gmp/mpn/pa32/udiv.asm
index addbf41ef5..86886e484c 100644
--- a/gmp/mpn/pa32/udiv.asm
+++ b/gmp/mpn/pa32/udiv.asm
@@ -1,33 +1,22 @@
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-2002 Free Software Foundation, Inc.
+dnl Copyright 1993, 1994, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa64/README b/gmp/mpn/pa64/README
index a51ce028a4..6234a407f2 100644
--- a/gmp/mpn/pa64/README
+++ b/gmp/mpn/pa64/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/pa64/add_n.asm b/gmp/mpn/pa64/add_n.asm
new file mode 100644
index 0000000000..1c2055590c
--- /dev/null
+++ b/gmp/mpn/pa64/add_n.asm
@@ -0,0 +1,93 @@
+dnl HP-PA 2.0 mpn_add_n -- Add two limb vectors of the same length > 0 and
+dnl store sum in a third limb vector.
+
+dnl Copyright 1997, 2000, 2002, 2003 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/.
+
+
+dnl This runs at 2 cycles/limb on PA8000 and 1.6875 cycles/limb on PA8500. It
+dnl should be possible to reach the cache bandwith 1.5 cycles/limb at least
+dnl with PA8500. The problem now is stalling of the first ADD,DC after LDO,
+dnl where the processor gets confused about where carry comes from.
+
+include(`../config.m4')
+
+dnl INPUT PARAMETERS
+define(`rp',`%r26')
+define(`up',`%r25')
+define(`vp',`%r24')
+define(`n',`%r23')
+
+ifdef(`HAVE_ABI_2_0w',
+` .level 2.0w
+',` .level 2.0
+')
+PROLOGUE(mpn_add_n)
+ sub %r0, n, %r22
+ depw,z %r22, 30, 3, %r28 C r28 = 2 * (-n & 7)
+ depw,z %r22, 28, 3, %r22 C r22 = 8 * (-n & 7)
+ sub up, %r22, up C offset up
+ sub vp, %r22, vp C offset vp
+ sub rp, %r22, rp C offset rp
+ blr %r28, %r0 C branch into loop
+ add %r0, %r0, %r0 C reset carry
+
+LDEF(loop)
+ ldd 0(up), %r20
+ ldd 0(vp), %r31
+ add,dc %r20, %r31, %r20
+ std %r20, 0(rp)
+LDEF(7) ldd 8(up), %r21
+ ldd 8(vp), %r19
+ add,dc %r21, %r19, %r21
+ std %r21, 8(rp)
+LDEF(6) ldd 16(up), %r20
+ ldd 16(vp), %r31
+ add,dc %r20, %r31, %r20
+ std %r20, 16(rp)
+LDEF(5) ldd 24(up), %r21
+ ldd 24(vp), %r19
+ add,dc %r21, %r19, %r21
+ std %r21, 24(rp)
+LDEF(4) ldd 32(up), %r20
+ ldd 32(vp), %r31
+ add,dc %r20, %r31, %r20
+ std %r20, 32(rp)
+LDEF(3) ldd 40(up), %r21
+ ldd 40(vp), %r19
+ add,dc %r21, %r19, %r21
+ std %r21, 40(rp)
+LDEF(2) ldd 48(up), %r20
+ ldd 48(vp), %r31
+ add,dc %r20, %r31, %r20
+ std %r20, 48(rp)
+LDEF(1) ldd 56(up), %r21
+ ldd 56(vp), %r19
+ add,dc %r21, %r19, %r21
+ ldo 64(up), up
+ std %r21, 56(rp)
+ ldo 64(vp), vp
+ addib,> -8, n, L(loop)
+ ldo 64(rp), rp
+
+ add,dc %r0, %r0, %r29
+ bve (%r2)
+ifdef(`HAVE_ABI_2_0w',
+` copy %r29, %r28
+',` ldi 0, %r28
+')
+EPILOGUE(mpn_add_n)
diff --git a/gmp/mpn/pa64/addmul_1.asm b/gmp/mpn/pa64/addmul_1.asm
index 2cb9af9f14..4e76546050 100644
--- a/gmp/mpn/pa64/addmul_1.asm
+++ b/gmp/mpn/pa64/addmul_1.asm
@@ -1,33 +1,22 @@
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-2000, 2002, 2003 Free Software Foundation, Inc.
+dnl Copyright 1998, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa64/aors_n.asm b/gmp/mpn/pa64/aors_n.asm
deleted file mode 100644
index ab4536fefb..0000000000
--- a/gmp/mpn/pa64/aors_n.asm
+++ /dev/null
@@ -1,130 +0,0 @@
-dnl HP-PA 2.0 mpn_add_n, mpn_sub_n
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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
-dnl should be possible to reach the cache bandwidth 1.5 cycles/limb at least
-dnl with PA8500. The problem now is stalling of the first ADD,DC after LDO,
-dnl where the processor gets confused about where carry comes from.
-
-include(`../config.m4')
-
-dnl INPUT PARAMETERS
-define(`rp',`%r26')
-define(`up',`%r25')
-define(`vp',`%r24')
-define(`n',`%r23')
-
-ifdef(`OPERATION_add_n', `
- define(ADCSBC, `add,dc')
- define(INITCY, `addi -1,%r22,%r0')
- define(func, mpn_add_n)
- define(func_nc, mpn_add_nc)')
-ifdef(`OPERATION_sub_n', `
- define(ADCSBC, `sub,db')
- define(INITCY, `subi 0,%r22,%r0')
- 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)
-
-ifdef(`HAVE_ABI_2_0w',
-` .level 2.0w
-',` .level 2.0
-')
-PROLOGUE(func_nc)
-ifdef(`HAVE_ABI_2_0w',
-` b L(com)
- nop
-',` b L(com)
- ldw -52(%r30), %r22
-')
-EPILOGUE()
-PROLOGUE(func)
- ldi 0, %r22
-LDEF(com)
- sub %r0, n, %r21
- depw,z %r21, 30, 3, %r28 C r28 = 2 * (-n & 7)
- depw,z %r21, 28, 3, %r21 C r21 = 8 * (-n & 7)
- sub up, %r21, up C offset up
- sub vp, %r21, vp C offset vp
- sub rp, %r21, rp C offset rp
- blr %r28, %r0 C branch into loop
- INITCY
-
-LDEF(loop)
- ldd 0(up), %r20
- ldd 0(vp), %r31
- ADCSBC %r20, %r31, %r20
- std %r20, 0(rp)
-LDEF(7) ldd 8(up), %r21
- ldd 8(vp), %r19
- ADCSBC %r21, %r19, %r21
- std %r21, 8(rp)
-LDEF(6) ldd 16(up), %r20
- ldd 16(vp), %r31
- ADCSBC %r20, %r31, %r20
- std %r20, 16(rp)
-LDEF(5) ldd 24(up), %r21
- ldd 24(vp), %r19
- ADCSBC %r21, %r19, %r21
- std %r21, 24(rp)
-LDEF(4) ldd 32(up), %r20
- ldd 32(vp), %r31
- ADCSBC %r20, %r31, %r20
- std %r20, 32(rp)
-LDEF(3) ldd 40(up), %r21
- ldd 40(vp), %r19
- ADCSBC %r21, %r19, %r21
- std %r21, 40(rp)
-LDEF(2) ldd 48(up), %r20
- ldd 48(vp), %r31
- ADCSBC %r20, %r31, %r20
- std %r20, 48(rp)
-LDEF(1) ldd 56(up), %r21
- ldd 56(vp), %r19
- ADCSBC %r21, %r19, %r21
- ldo 64(up), up
- std %r21, 56(rp)
- ldo 64(vp), vp
- addib,> -8, n, L(loop)
- ldo 64(rp), rp
-
- add,dc %r0, %r0, %r29
-ifdef(`OPERATION_sub_n',`
- subi 1, %r29, %r29
-')
- bve (%r2)
-ifdef(`HAVE_ABI_2_0w',
-` copy %r29, %r28
-',` ldi 0, %r28
-')
-EPILOGUE()
diff --git a/gmp/mpn/pa64/aorslsh1_n.asm b/gmp/mpn/pa64/aorslsh1_n.asm
index 2a55ddea30..b2cca7a356 100644
--- a/gmp/mpn/pa64/aorslsh1_n.asm
+++ b/gmp/mpn/pa64/aorslsh1_n.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa64/gmp-mparam.h b/gmp/mpn/pa64/gmp-mparam.h
index c2719c3c89..aa92cb9191 100644
--- a/gmp/mpn/pa64/gmp-mparam.h
+++ b/gmp/mpn/pa64/gmp-mparam.h
@@ -1,247 +1,72 @@
/* gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2004, 2008-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
/* 440MHz PA8200 */
-#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 4
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 10
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 14
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
-#define USE_PREINV_DIVREM_1 1
-#define DIV_QR_2_PI2_THRESHOLD 21
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-
-#define MUL_TOOM22_THRESHOLD 31
-#define MUL_TOOM33_THRESHOLD 114
-#define MUL_TOOM44_THRESHOLD 179
-#define MUL_TOOM6H_THRESHOLD 222
-#define MUL_TOOM8H_THRESHOLD 296
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 130
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 229
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 129
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 54
-
-#define SQR_BASECASE_THRESHOLD 5
-#define SQR_TOOM2_THRESHOLD 58
-#define SQR_TOOM3_THRESHOLD 153
-#define SQR_TOOM4_THRESHOLD 278
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 0 /* always */
-
-#define MULMID_TOOM42_THRESHOLD 56
-
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 19
-
-#define POWM_SEC_TABLE 2,23,228,1084
-
-#define MUL_FFT_MODF_THRESHOLD 336 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 336, 5}, { 11, 4}, { 23, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
- { 23, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
- { 11, 7}, { 24, 8}, { 13, 7}, { 27, 8}, \
- { 15, 7}, { 31, 8}, { 19, 7}, { 39, 8}, \
- { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 51,10}, \
- { 31, 9}, { 67,10}, { 39, 9}, { 79,10}, \
- { 47, 9}, { 95,10}, { 55,11}, { 31,10}, \
- { 63, 9}, { 127,10}, { 71, 8}, { 287,10}, \
- { 79,11}, { 47,10}, { 95, 9}, { 191, 8}, \
- { 383, 7}, { 767,10}, { 103, 9}, { 207, 8}, \
- { 415, 7}, { 831,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 543, 7}, { 1087, 6}, \
- { 2175,10}, { 143, 9}, { 287, 8}, { 575,11}, \
- { 79, 9}, { 319, 8}, { 639, 7}, { 1279, 9}, \
- { 335, 8}, { 671,10}, { 175, 9}, { 351, 8}, \
- { 703,11}, { 95,10}, { 191, 9}, { 383, 8}, \
- { 767,10}, { 207, 9}, { 415, 8}, { 831, 7}, \
- { 1663,11}, { 111,10}, { 223, 9}, { 447, 8}, \
- { 895,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 543, 8}, { 1087, 7}, { 2175,10}, { 287, 9}, \
- { 575, 8}, { 1215, 7}, { 2431,10}, { 319, 9}, \
- { 639, 8}, { 1279,10}, { 335, 9}, { 671, 8}, \
- { 1343, 9}, { 703, 8}, { 1407,12}, { 95,11}, \
- { 191,10}, { 383,11}, { 207, 9}, { 831, 8}, \
- { 1663,11}, { 223,10}, { 447, 9}, { 959,13}, \
- { 63,12}, { 127,11}, { 255, 8}, { 2047,11}, \
- { 271,10}, { 543, 9}, { 1087, 8}, { 2175,11}, \
- { 287,10}, { 575, 9}, { 1215, 8}, { 2431,11}, \
- { 319,10}, { 671, 9}, { 1343, 8}, { 2687,11}, \
- { 351,10}, { 703, 9}, { 1471, 8}, { 2943,12}, \
- { 191,11}, { 383, 8}, { 3071,11}, { 415,10}, \
- { 831, 9}, { 1663,11}, { 479,10}, { 959, 9}, \
- { 1919, 8}, { 3839,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087, 9}, { 2175,12}, { 287,11}, \
- { 607,10}, { 1215, 9}, { 2431, 8}, { 4863,12}, \
- { 319,11}, { 671,10}, { 1343,13}, { 191, 9}, \
- { 3071,12}, { 415,11}, { 831,10}, { 1663, 8}, \
- { 6655, 9}, { 3455,12}, { 447, 9}, { 3583,13}, \
- { 255,12}, { 511,11}, { 1023,10}, { 2175,13}, \
- { 319,11}, { 1279,12}, { 671,10}, { 2815,12}, \
- { 735,10}, { 2943, 9}, { 5887,13}, { 383,12}, \
- { 767,11}, { 1535,10}, { 3071,13}, { 447,10}, \
- { 3583,12}, { 959,13}, { 511,12}, { 1087,13}, \
- { 639,12}, { 1343,13}, { 767,11}, { 3071,13}, \
- { 831,12}, { 1663,11}, { 3455,10}, { 6911,13}, \
- { 895,14}, { 511,13}, { 1023,12}, { 2047,13}, \
- { 1087,12}, { 2303,13}, { 1215,12}, { 2431,14}, \
- { 639,13}, { 1279,12}, { 2559,13}, { 1343,12}, \
- { 2687,11}, { 5375,13}, { 1407,12}, { 2815,11}, \
- { 5631,12}, { 2943,13}, { 1535,12}, { 3199,13}, \
- { 1663,12}, { 3327,13}, { 1727,14}, { 895,13}, \
- { 1791,12}, { 3583,13}, { 1919,15}, { 511,14}, \
- { 1023,13}, { 2047,12}, { 4095,14}, { 1151,13}, \
- { 2431,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
- { 2815,12}, { 5631,15}, { 767,14}, { 1535,13}, \
- { 3071,14}, { 1663,13}, { 3327,14}, { 1791,13}, \
- { 3583,14}, { 1919,15}, { 1023,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 252
-#define MUL_FFT_THRESHOLD 2368
-
-#define SQR_FFT_MODF_THRESHOLD 284 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 284, 5}, { 9, 4}, { 21, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 25, 7}, { 25, 8}, \
- { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
- { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 63, 8}, { 255, 7}, { 511,10}, \
- { 71, 8}, { 287, 7}, { 575,10}, { 79,11}, \
- { 47,10}, { 95, 9}, { 191, 8}, { 383, 7}, \
- { 767,10}, { 103, 9}, { 207, 8}, { 415,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255, 8}, \
- { 543, 7}, { 1087, 8}, { 575, 7}, { 1151,11}, \
- { 79, 8}, { 639, 7}, { 1279, 9}, { 335, 8}, \
- { 671, 7}, { 1343,10}, { 175, 8}, { 703, 7}, \
- { 1407,11}, { 95,10}, { 191, 9}, { 383, 8}, \
- { 767,10}, { 207, 9}, { 415, 8}, { 831, 7}, \
- { 1663, 9}, { 447, 8}, { 895,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 543, 8}, { 1087, 7}, \
- { 2175, 9}, { 575, 8}, { 1151,10}, { 303, 9}, \
- { 607, 8}, { 1215, 7}, { 2431,10}, { 319, 9}, \
- { 639, 8}, { 1279, 9}, { 671, 8}, { 1343, 7}, \
- { 2687,10}, { 351, 9}, { 703, 8}, { 1407,12}, \
- { 95,11}, { 191,10}, { 383, 9}, { 767,11}, \
- { 207,10}, { 415, 9}, { 831, 8}, { 1663,11}, \
- { 223,10}, { 447, 9}, { 895,13}, { 63,11}, \
- { 255,10}, { 543, 8}, { 2175,11}, { 287,10}, \
- { 575, 9}, { 1151,10}, { 607, 9}, { 1215, 8}, \
- { 2431,11}, { 319, 9}, { 1279,10}, { 671, 9}, \
- { 1343, 8}, { 2687,11}, { 351,10}, { 703, 9}, \
- { 1407,10}, { 735,12}, { 191,11}, { 383,10}, \
- { 831, 9}, { 1663,12}, { 223,11}, { 447,10}, \
- { 895,11}, { 479, 9}, { 1919, 8}, { 3839,12}, \
- { 255,11}, { 511,10}, { 1023,11}, { 543,10}, \
- { 1087, 9}, { 2175,12}, { 287,11}, { 575,10}, \
- { 1151,11}, { 607,10}, { 1215, 9}, { 2431, 8}, \
- { 4863,10}, { 1279,11}, { 671,10}, { 1343, 9}, \
- { 2687,12}, { 351,11}, { 703,10}, { 1407,11}, \
- { 735,13}, { 191, 9}, { 3071, 7}, { 12287,11}, \
- { 799,12}, { 415,11}, { 831,10}, { 1663,12}, \
- { 447, 8}, { 7167,12}, { 479, 9}, { 3839,14}, \
- { 127,13}, { 255,12}, { 511,11}, { 1023,12}, \
- { 543,10}, { 2175, 9}, { 4607,11}, { 1215,10}, \
- { 2431,11}, { 1279,10}, { 2559,13}, { 383,12}, \
- { 767,11}, { 1535,12}, { 799,10}, { 3199, 9}, \
- { 6399,12}, { 895,13}, { 511,12}, { 1023,11}, \
- { 2047,12}, { 1087,13}, { 575,12}, { 1151,10}, \
- { 4607,13}, { 639,12}, { 1279,11}, { 2687,14}, \
- { 383,13}, { 767,11}, { 3071,12}, { 1599,13}, \
- { 895,12}, { 1791,11}, { 3583,13}, { 959,15}, \
- { 255,12}, { 2175,13}, { 1215,14}, { 639,13}, \
- { 1279,12}, { 2559,13}, { 1343,12}, { 2687,13}, \
- { 1471,11}, { 5887,14}, { 767,13}, { 1535,12}, \
- { 3071,13}, { 1599,12}, { 3199,13}, { 1663,12}, \
- { 3327,13}, { 1727,14}, { 895,13}, { 1791,12}, \
- { 3583,15}, { 511,14}, { 1023,13}, { 2175,14}, \
- { 1151,12}, { 4607,13}, { 2431,14}, { 1279,13}, \
- { 2687,14}, { 1407,13}, { 2815,15}, { 767,13}, \
- { 3199,14}, { 1663,13}, { 3327,14}, { 1791,13}, \
- { 3583,14}, { 1919,15}, { 1023,14}, { 2047,13}, \
- { 4095,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 257
-#define SQR_FFT_THRESHOLD 1856
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 113
-#define MULLO_MUL_N_THRESHOLD 4658
-
-#define DC_DIV_QR_THRESHOLD 123
-#define DC_DIVAPPR_Q_THRESHOLD 372
-#define DC_BDIV_QR_THRESHOLD 142
-#define DC_BDIV_Q_THRESHOLD 312
-
-#define INV_MULMOD_BNM1_THRESHOLD 58
-#define INV_NEWTON_THRESHOLD 315
-#define INV_APPR_THRESHOLD 315
-
-#define BINV_NEWTON_THRESHOLD 360
-#define REDC_1_TO_REDC_N_THRESHOLD 101
-
-#define MU_DIV_QR_THRESHOLD 979
-#define MU_DIVAPPR_Q_THRESHOLD 1142
-#define MUPI_DIV_QR_THRESHOLD 93
-#define MU_BDIV_QR_THRESHOLD 889
-#define MU_BDIV_Q_THRESHOLD 1187
-
-#define MATRIX22_STRASSEN_THRESHOLD 9
-#define HGCD_THRESHOLD 234
-#define HGCD_APPR_THRESHOLD 300
-#define HGCD_REDUCE_THRESHOLD 1553
-#define GCD_DC_THRESHOLD 684
-#define GCDEXT_DC_THRESHOLD 525
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 21
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 1951
-#define SET_STR_PRECOMPUTE_THRESHOLD 4034
+/* Generated by tuneup.c, 2009-01-04, system compiler */
+
+#define MUL_KARATSUBA_THRESHOLD 30
+#define MUL_TOOM3_THRESHOLD 114
+#define MUL_TOOM44_THRESHOLD 244
+
+#define SQR_BASECASE_THRESHOLD 4
+#define SQR_KARATSUBA_THRESHOLD 58
+#define SQR_TOOM3_THRESHOLD 174
+#define SQR_TOOM4_THRESHOLD 312
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 142
+#define MULLOW_MUL_N_THRESHOLD 507
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 124
+#define POWM_THRESHOLD 224
+
+#define MATRIX22_STRASSEN_THRESHOLD 11
+#define HGCD_THRESHOLD 294
+#define GCD_DC_THRESHOLD 913
+#define GCDEXT_DC_THRESHOLD 830
+#define JACOBI_BASE_METHOD 2
+
+#define DIVREM_1_NORM_THRESHOLD 0 /* always */
+#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define USE_PREINV_DIVREM_1 1
+#define USE_PREINV_MOD_1 1
+#define DIVREM_2_THRESHOLD 0 /* always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 23
+#define GET_STR_PRECOMPUTE_THRESHOLD 26
+#define SET_STR_DC_THRESHOLD 2743
+#define SET_STR_PRECOMPUTE_THRESHOLD 5147
+
+#define MUL_FFT_TABLE { 400, 800, 1600, 2816, 7168, 20480, 81920, 327680, 0 }
+#define MUL_FFT_MODF_THRESHOLD 280
+#define MUL_FFT_THRESHOLD 1664
+
+#define SQR_FFT_TABLE { 368, 800, 1728, 3328, 7168, 20480, 81920, 327680, 786432, 0 }
+#define SQR_FFT_MODF_THRESHOLD 264
+#define SQR_FFT_THRESHOLD 1632
diff --git a/gmp/mpn/pa64/lshift.asm b/gmp/mpn/pa64/lshift.asm
index c0fc2921c1..0dceba20c1 100644
--- a/gmp/mpn/pa64/lshift.asm
+++ b/gmp/mpn/pa64/lshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl This runs at 1.5 cycles/limb on PA8000 and 1.0 cycles/limb on PA8500.
diff --git a/gmp/mpn/pa64/mul_1.asm b/gmp/mpn/pa64/mul_1.asm
index 6935c23ccd..fbb5f174ae 100644
--- a/gmp/mpn/pa64/mul_1.asm
+++ b/gmp/mpn/pa64/mul_1.asm
@@ -1,33 +1,22 @@
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-2000, 2002, 2003 Free Software Foundation, Inc.
+dnl Copyright 1998, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa64/rshift.asm b/gmp/mpn/pa64/rshift.asm
index cfc242ea9c..80470c9892 100644
--- a/gmp/mpn/pa64/rshift.asm
+++ b/gmp/mpn/pa64/rshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl This runs at 1.5 cycles/limb on PA8000 and 1.0 cycles/limb on PA8500.
diff --git a/gmp/mpn/pa64/sqr_diagonal.asm b/gmp/mpn/pa64/sqr_diagonal.asm
index f6fadc93c6..73c64b06ed 100644
--- a/gmp/mpn/pa64/sqr_diagonal.asm
+++ b/gmp/mpn/pa64/sqr_diagonal.asm
@@ -1,32 +1,21 @@
dnl HP-PA 2.0 64-bit mpn_sqr_diagonal.
-dnl Copyright 2001-2003 Free Software Foundation, Inc.
+dnl Copyright 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl This code runs at 7.25 cycles/limb on PA8000 and 7.75 cycles/limb on
diff --git a/gmp/mpn/pa64/sub_n.asm b/gmp/mpn/pa64/sub_n.asm
new file mode 100644
index 0000000000..8ad524da01
--- /dev/null
+++ b/gmp/mpn/pa64/sub_n.asm
@@ -0,0 +1,93 @@
+dnl HP-PA 2.0 mpn_sub_n -- Subtract two limb vectors of the same length > 0
+dnl and store difference in a third limb vector.
+
+dnl Copyright 1997, 2000, 2002, 2003 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/.
+
+
+dnl This runs at 2 cycles/limb on PA8000 and 1.6875 cycles/limb on PA8500. It
+dnl should be possible to reach the cache bandwith 1.5 cycles/limb at least
+dnl with PA8500. The problem now is stalling of the first SUB,DB after LDO,
+dnl where the processor gets confused about where carry comes from.
+
+include(`../config.m4')
+
+dnl INPUT PARAMETERS
+define(`rp',`%r26')
+define(`up',`%r25')
+define(`vp',`%r24')
+define(`n',`%r23')
+
+ifdef(`HAVE_ABI_2_0w',
+` .level 2.0w
+',` .level 2.0
+')
+PROLOGUE(mpn_sub_n)
+ sub %r0, n, %r22
+ depw,z %r22, 30, 3, %r28 C r28 = 2 * (-n & 7)
+ depw,z %r22, 28, 3, %r22 C r22 = 8 * (-n & 7)
+ sub up, %r22, up C offset up
+ sub vp, %r22, vp C offset vp
+ blr %r28, %r0 C branch into loop
+ sub rp, %r22, rp C offset rp and set carry
+
+LDEF(loop)
+ ldd 0(up), %r20
+ ldd 0(vp), %r31
+ sub,db %r20, %r31, %r20
+ std %r20, 0(rp)
+LDEF(7) ldd 8(up), %r21
+ ldd 8(vp), %r19
+ sub,db %r21, %r19, %r21
+ std %r21, 8(rp)
+LDEF(6) ldd 16(up), %r20
+ ldd 16(vp), %r31
+ sub,db %r20, %r31, %r20
+ std %r20, 16(rp)
+LDEF(5) ldd 24(up), %r21
+ ldd 24(vp), %r19
+ sub,db %r21, %r19, %r21
+ std %r21, 24(rp)
+LDEF(4) ldd 32(up), %r20
+ ldd 32(vp), %r31
+ sub,db %r20, %r31, %r20
+ std %r20, 32(rp)
+LDEF(3) ldd 40(up), %r21
+ ldd 40(vp), %r19
+ sub,db %r21, %r19, %r21
+ std %r21, 40(rp)
+LDEF(2) ldd 48(up), %r20
+ ldd 48(vp), %r31
+ sub,db %r20, %r31, %r20
+ std %r20, 48(rp)
+LDEF(1) ldd 56(up), %r21
+ ldd 56(vp),%r19
+ sub,db %r21, %r19, %r21
+ ldo 64(up), up
+ std %r21, 56(rp)
+ ldo 64(vp), vp
+ addib,> -8, n, L(loop)
+ ldo 64(rp), rp
+
+ add,dc %r0, %r0, %r29
+ subi 1, %r29, %r29
+ bve (%r2)
+ifdef(`HAVE_ABI_2_0w',
+` copy %r29, %r28
+',` ldi 0, %r28
+')
+EPILOGUE(mpn_sub_n)
diff --git a/gmp/mpn/pa64/submul_1.asm b/gmp/mpn/pa64/submul_1.asm
index f8a1968e45..40678239fa 100644
--- a/gmp/mpn/pa64/submul_1.asm
+++ b/gmp/mpn/pa64/submul_1.asm
@@ -1,33 +1,22 @@
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-2000, 2002, 2003 Free Software Foundation, Inc.
+dnl Copyright 1998, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa64/udiv.asm b/gmp/mpn/pa64/udiv.asm
index 1380a85932..3775783a05 100644
--- a/gmp/mpn/pa64/udiv.asm
+++ b/gmp/mpn/pa64/udiv.asm
@@ -1,32 +1,21 @@
dnl HP-PA 2.0 64-bit mpn_udiv_qrnnd_r.
-dnl Copyright 2001-2003 Free Software Foundation, Inc.
+dnl Copyright 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/pa64/umul.asm b/gmp/mpn/pa64/umul.asm
index c3341ecfe6..635e44fea0 100644
--- a/gmp/mpn/pa64/umul.asm
+++ b/gmp/mpn/pa64/umul.asm
@@ -1,36 +1,26 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://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 parameters could be used.
+dnl * Don't allocate any stack, "home" positions for parameteters could be
+dnl used.
include(`../config.m4')
diff --git a/gmp/mpn/power/add_n.asm b/gmp/mpn/power/add_n.asm
index 6d6ca73da9..4fcafab7e1 100644
--- a/gmp/mpn/power/add_n.asm
+++ b/gmp/mpn/power/add_n.asm
@@ -1,32 +1,22 @@
dnl IBM POWER mpn_add_n -- Add two limb vectors of equal, non-zero length.
-dnl Copyright 1992, 1994-1996, 1999-2001, 2005 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2005 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/power/addmul_1.asm b/gmp/mpn/power/addmul_1.asm
index 76d8df3c76..fcda2c1263 100644
--- a/gmp/mpn/power/addmul_1.asm
+++ b/gmp/mpn/power/addmul_1.asm
@@ -1,33 +1,22 @@
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-2001 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1999, 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 * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/power/gmp-mparam.h b/gmp/mpn/power/gmp-mparam.h
index 7cb36f963e..f9b10e6a47 100644
--- a/gmp/mpn/power/gmp-mparam.h
+++ b/gmp/mpn/power/gmp-mparam.h
@@ -1,40 +1,29 @@
/* POWER gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2002-2004 Free Software Foundation, Inc.
+Copyright 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Generated by tuneup.c, 2003-02-10, gcc 3.2, POWER2 66.7MHz */
-#define MUL_TOOM22_THRESHOLD 12
-#define MUL_TOOM33_THRESHOLD 75
+#define MUL_KARATSUBA_THRESHOLD 12
+#define MUL_TOOM3_THRESHOLD 75
#define SQR_BASECASE_THRESHOLD 7
-#define SQR_TOOM2_THRESHOLD 28
+#define SQR_KARATSUBA_THRESHOLD 28
#define SQR_TOOM3_THRESHOLD 86
#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX /* never */
diff --git a/gmp/mpn/power/lshift.asm b/gmp/mpn/power/lshift.asm
index efa210556d..a4adb7aad5 100644
--- a/gmp/mpn/power/lshift.asm
+++ b/gmp/mpn/power/lshift.asm
@@ -1,32 +1,21 @@
dnl IBM POWER mpn_lshift -- Shift a number left.
-dnl Copyright 1992, 1994, 1999-2001 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1999, 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 * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/power/mul_1.asm b/gmp/mpn/power/mul_1.asm
index 38b7b66be0..bd33942adf 100644
--- a/gmp/mpn/power/mul_1.asm
+++ b/gmp/mpn/power/mul_1.asm
@@ -1,33 +1,22 @@
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-2001 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1999, 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 * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/power/rshift.asm b/gmp/mpn/power/rshift.asm
index 1d1815ccb5..4645015ccd 100644
--- a/gmp/mpn/power/rshift.asm
+++ b/gmp/mpn/power/rshift.asm
@@ -1,32 +1,21 @@
dnl IBM POWER mpn_rshift -- Shift a number right.
-dnl Copyright 1992, 1994, 1999-2001 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1999, 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 * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/power/sdiv.asm b/gmp/mpn/power/sdiv.asm
index 4a9ed143b8..7a798022cd 100644
--- a/gmp/mpn/power/sdiv.asm
+++ b/gmp/mpn/power/sdiv.asm
@@ -1,30 +1,19 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/power/sub_n.asm b/gmp/mpn/power/sub_n.asm
index 390c802d8b..d34415d7e4 100644
--- a/gmp/mpn/power/sub_n.asm
+++ b/gmp/mpn/power/sub_n.asm
@@ -1,33 +1,23 @@
dnl IBM POWER mpn_sub_n -- Subtract two limb vectors of equal, non-zero
dnl length.
-dnl Copyright 1992, 1994-1996, 1999-2001, 2005 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2005 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/power/submul_1.asm b/gmp/mpn/power/submul_1.asm
index 1788e0d4f4..3c3492d00c 100644
--- a/gmp/mpn/power/submul_1.asm
+++ b/gmp/mpn/power/submul_1.asm
@@ -1,33 +1,22 @@
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-2001 Free Software Foundation, Inc.
+dnl Copyright 1992, 1994, 1999, 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 * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl INPUT PARAMETERS
diff --git a/gmp/mpn/power/umul.asm b/gmp/mpn/power/umul.asm
index 5a0599e21d..996f2e6cb1 100644
--- a/gmp/mpn/power/umul.asm
+++ b/gmp/mpn/power/umul.asm
@@ -1,30 +1,19 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/750/com.asm b/gmp/mpn/powerpc32/750/com.asm
deleted file mode 100644
index 1b8b574b9c..0000000000
--- a/gmp/mpn/powerpc32/750/com.asm
+++ /dev/null
@@ -1,79 +0,0 @@
-dnl PowerPC 750 mpn_com -- mpn bitwise one's complement
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 3.0
-C 75x (G3): 2.0
-C 7400,7410 (G4): 2.0
-C 744x,745x (G4+): 3.0
-
-C void mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
-C
-C This loop form is necessary for the claimed speed.
-
-ASM_START()
-PROLOGUE(mpn_com)
-
- C r3 dst
- C r4 src
- C r5 size
-
- mtctr r5 C size
- lwz r5, 0(r4) C src low limb
-
- sub r4, r4, r3 C src-dst
- subi r3, r3, 4 C dst-4
-
- addi r4, r4, 8 C src-dst+8
- bdz L(one)
-
-L(top):
- C r3 &dst[i-1]
- C r4 src-dst
- C r5 src[i]
- C r6 scratch
-
- not r6, r5 C ~src[i]
- lwzx r5, r4,r3 C src[i+1]
-
- stwu r6, 4(r3) C dst[i]
- bdnz L(top)
-
-L(one):
- not r6, r5
-
- stw r6, 4(r3) C dst[size-1]
- blr
-
-EPILOGUE()
diff --git a/gmp/mpn/powerpc32/750/com_n.asm b/gmp/mpn/powerpc32/750/com_n.asm
new file mode 100644
index 0000000000..02fc4b6587
--- /dev/null
+++ b/gmp/mpn/powerpc32/750/com_n.asm
@@ -0,0 +1,68 @@
+dnl PowerPC 750 mpn_com_n -- 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
+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 603e: ?
+C 604e: 3.0
+C 75x (G3): 2.0
+C 7400,7410 (G4): 2.0
+C 744x,745x (G4+): 3.0
+
+C void mpn_com_n (mp_ptr dst, mp_srcptr src, mp_size_t size);
+C
+C This loop form is necessary for the claimed speed.
+
+ASM_START()
+PROLOGUE(mpn_com_n)
+
+ C r3 dst
+ C r4 src
+ C r5 size
+
+ mtctr r5 C size
+ lwz r5, 0(r4) C src low limb
+
+ sub r4, r4, r3 C src-dst
+ subi r3, r3, 4 C dst-4
+
+ addi r4, r4, 8 C src-dst+8
+ bdz L(one)
+
+L(top):
+ C r3 &dst[i-1]
+ C r4 src-dst
+ C r5 src[i]
+ C r6 scratch
+
+ not r6, r5 C ~src[i]
+ lwzx r5, r4,r3 C src[i+1]
+
+ stwu r6, 4(r3) C dst[i]
+ bdnz L(top)
+
+L(one):
+ not r6, r5
+
+ stw r6, 4(r3) C dst[size-1]
+ blr
+
+EPILOGUE()
diff --git a/gmp/mpn/powerpc32/750/gmp-mparam.h b/gmp/mpn/powerpc32/750/gmp-mparam.h
index 3667e8596d..448f2676df 100644
--- a/gmp/mpn/powerpc32/750/gmp-mparam.h
+++ b/gmp/mpn/powerpc32/750/gmp-mparam.h
@@ -1,35 +1,24 @@
/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2002, 2004, 2009, 2010 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* This file is used for 75x (G3) and for 7400/7410 (G4), both which have
@@ -37,156 +26,49 @@ see https://www.gnu.org/licenses/. */
/* 450 MHz PPC 7400 */
-#define DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_NORM_THRESHOLD 3
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 11
-#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 18
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 38
-#define USE_PREINV_DIVREM_1 1
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-
-#define MUL_TOOM22_THRESHOLD 10
-#define MUL_TOOM33_THRESHOLD 38
-#define MUL_TOOM44_THRESHOLD 99
-#define MUL_TOOM6H_THRESHOLD 141
-#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 65
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 66
-
-#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 18
-#define SQR_TOOM3_THRESHOLD 57
-#define SQR_TOOM4_THRESHOLD 142
-#define SQR_TOOM6_THRESHOLD 173
-#define SQR_TOOM8_THRESHOLD 309
-
-#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 11
-
-#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 220, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 8, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 13, 7}, { 7, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 11, 6}, { 23, 7}, { 13, 8}, \
- { 7, 7}, { 19, 8}, { 11, 7}, { 23, 9}, \
- { 7, 8}, { 15, 7}, { 33, 8}, { 19, 7}, \
- { 39, 8}, { 23, 9}, { 15, 8}, { 39, 9}, \
- { 23, 8}, { 47,10}, { 15, 9}, { 31, 8}, \
- { 67, 9}, { 55,10}, { 31, 9}, { 63, 8}, \
- { 127, 7}, { 255, 9}, { 71, 8}, { 143, 7}, \
- { 287, 9}, { 79,10}, { 47, 9}, { 95,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,10}, \
- { 111,11}, { 63,10}, { 127, 9}, { 255,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}, { 511,10}, { 271, 9}, { 543,10}, \
- { 287, 9}, { 575,11}, { 159,10}, { 351, 9}, \
- { 703, 8}, { 1407,11}, { 191,10}, { 415, 9}, \
- { 831,11}, { 223,10}, { 447, 9}, { 895,12}, \
- { 127,11}, { 255,10}, { 543,11}, { 287,10}, \
- { 575,11}, { 351,10}, { 703, 9}, { 1407,12}, \
- { 191,11}, { 415,10}, { 831,11}, { 447,10}, \
- { 895,13}, { 127,12}, { 255,11}, { 543,10}, \
- { 1087,11}, { 575,12}, { 319,11}, { 703,10}, \
- { 1407,12}, { 383,11}, { 831,12}, { 447,11}, \
- { 895,10}, { 1791,11}, { 959,13}, { 255,12}, \
- { 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
- { 703,11}, { 1407,13}, { 383,12}, { 895,11}, \
- { 1791,12}, { 959,14}, { 255,13}, { 511,12}, \
- { 1215,13}, { 639,12}, { 1407,13}, { 895,12}, \
- { 1919,14}, { 511,13}, { 1023,12}, { 2047,13}, \
- { 1151,12}, { 2303,13}, { 1407,14}, { 767,13}, \
- { 1919,10}, { 15359,12}, { 4096,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 154
-#define MUL_FFT_THRESHOLD 2688
-
-#define SQR_FFT_MODF_THRESHOLD 184 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 184, 5}, { 6, 4}, { 13, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 13, 7}, { 7, 6}, \
- { 16, 7}, { 9, 6}, { 19, 7}, { 11, 6}, \
- { 23, 7}, { 13, 8}, { 7, 7}, { 19, 8}, \
- { 11, 7}, { 25, 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, 8}, { 95,10}, { 31, 9}, { 63, 8}, \
- { 127, 7}, { 255, 9}, { 71, 8}, { 143, 7}, \
- { 287, 9}, { 79, 8}, { 159,10}, { 47, 9}, \
- { 95,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255, 9}, { 143, 8}, { 287, 7}, { 575,10}, \
- { 79, 9}, { 159, 8}, { 319, 9}, { 175, 8}, \
- { 351,10}, { 95, 9}, { 191, 8}, { 383, 9}, \
- { 207,10}, { 111,11}, { 63,10}, { 127, 9}, \
- { 255,10}, { 143, 9}, { 287, 8}, { 575,10}, \
- { 159, 9}, { 319,10}, { 175, 9}, { 351,11}, \
- { 95,10}, { 191, 9}, { 383,10}, { 207, 9}, \
- { 415, 8}, { 831,10}, { 223,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 351, 9}, { 703,11}, \
- { 191,10}, { 415, 9}, { 831,11}, { 223,10}, \
- { 447, 9}, { 895,12}, { 127,11}, { 255,10}, \
- { 511,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,13}, { 127,12}, \
- { 255,11}, { 511,10}, { 1023,11}, { 575,12}, \
- { 319,11}, { 703,10}, { 1407,12}, { 383,11}, \
- { 831,12}, { 447,11}, { 895,10}, { 1791,11}, \
- { 959,13}, { 255,12}, { 511,11}, { 1023,12}, \
- { 575,11}, { 1215,12}, { 703,11}, { 1407,13}, \
- { 383,12}, { 895,11}, { 1791,12}, { 959,14}, \
- { 255,13}, { 511,12}, { 1215,13}, { 639,12}, \
- { 1471,13}, { 767,12}, { 1535,13}, { 895,12}, \
- { 1919,14}, { 511,13}, { 1151,12}, { 2431,13}, \
- { 1407,14}, { 767,13}, { 1919,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 152
-#define SQR_FFT_THRESHOLD 1728
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 33
-#define MULLO_MUL_N_THRESHOLD 5240
-
-#define DC_DIV_QR_THRESHOLD 31
-#define DC_DIVAPPR_Q_THRESHOLD 108
-#define DC_BDIV_QR_THRESHOLD 35
-#define DC_BDIV_Q_THRESHOLD 88
-
-#define INV_MULMOD_BNM1_THRESHOLD 42
-#define INV_NEWTON_THRESHOLD 149
-#define INV_APPR_THRESHOLD 125
-
-#define BINV_NEWTON_THRESHOLD 156
-#define REDC_1_TO_REDC_N_THRESHOLD 39
-
-#define MU_DIV_QR_THRESHOLD 807
-#define MU_DIVAPPR_Q_THRESHOLD 807
-#define MUPI_DIV_QR_THRESHOLD 66
-#define MU_BDIV_QR_THRESHOLD 667
-#define MU_BDIV_Q_THRESHOLD 807
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 87
-#define GCD_DC_THRESHOLD 233
-#define GCDEXT_DC_THRESHOLD 198
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 390
-#define SET_STR_PRECOMPUTE_THRESHOLD 814
+/* Generated by tuneup.c, 2008-12-23, gcc 4.0 */
+
+#define MUL_KARATSUBA_THRESHOLD 10
+#define MUL_TOOM3_THRESHOLD 41
+#define MUL_TOOM44_THRESHOLD 88
+
+#define SQR_BASECASE_THRESHOLD 4
+#define SQR_KARATSUBA_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 57
+#define SQR_TOOM4_THRESHOLD 88
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 32
+#define MULLOW_MUL_N_THRESHOLD 194
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 33
+#define POWM_THRESHOLD 48
+
+#define MATRIX22_STRASSEN_THRESHOLD 13
+#define HGCD_THRESHOLD 91
+#define GCD_DC_THRESHOLD 256
+#define GCDEXT_DC_THRESHOLD 256
+#define JACOBI_BASE_METHOD 1
+
+#define DIVREM_1_NORM_THRESHOLD 0 /* always */
+#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define USE_PREINV_DIVREM_1 1
+#define USE_PREINV_MOD_1 1
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 27
+#define SET_STR_DC_THRESHOLD 390
+#define SET_STR_PRECOMPUTE_THRESHOLD 814
+
+#define MUL_FFT_TABLE { 240, 608, 896, 2560, 6144, 40960, 0 }
+#define MUL_FFT_MODF_THRESHOLD 232
+#define MUL_FFT_THRESHOLD 1792
+
+#define SQR_FFT_TABLE { 240, 544, 896, 2560, 6144, 24576, 0 }
+#define SQR_FFT_MODF_THRESHOLD 216
+#define SQR_FFT_THRESHOLD 1792
diff --git a/gmp/mpn/powerpc32/750/lshift.asm b/gmp/mpn/powerpc32/750/lshift.asm
index 3a1c1a7212..9298793f27 100644
--- a/gmp/mpn/powerpc32/750/lshift.asm
+++ b/gmp/mpn/powerpc32/750/lshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/750/rshift.asm b/gmp/mpn/powerpc32/750/rshift.asm
index 4825fee618..944e8690a7 100644
--- a/gmp/mpn/powerpc32/750/rshift.asm
+++ b/gmp/mpn/powerpc32/750/rshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/README b/gmp/mpn/powerpc32/README
index 887e78b290..43aca466c2 100644
--- a/gmp/mpn/powerpc32/README
+++ b/gmp/mpn/powerpc32/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/powerpc32/addlsh1_n.asm b/gmp/mpn/powerpc32/addlsh1_n.asm
index 71645c3ec3..db627a0a31 100644
--- a/gmp/mpn/powerpc32/addlsh1_n.asm
+++ b/gmp/mpn/powerpc32/addlsh1_n.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/addmul_1.asm b/gmp/mpn/powerpc32/addmul_1.asm
index 7f47ab2ce7..6260691b34 100644
--- a/gmp/mpn/powerpc32/addmul_1.asm
+++ b/gmp/mpn/powerpc32/addmul_1.asm
@@ -1,33 +1,23 @@
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-2003, 2005 Free Software Foundation, Inc.
+dnl Copyright 1995, 1997, 1998, 2000, 2001, 2002, 2003, 2005 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/aix.m4 b/gmp/mpn/powerpc32/aix.m4
index fde20200b2..81199c78d4 100644
--- a/gmp/mpn/powerpc32/aix.m4
+++ b/gmp/mpn/powerpc32/aix.m4
@@ -1,33 +1,22 @@
divert(-1)
dnl m4 macros for AIX 32-bit assembly.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`ASM_START',
` .toc')
diff --git a/gmp/mpn/powerpc32/aors_n.asm b/gmp/mpn/powerpc32/aors_n.asm
index 25ece0966e..f9e9b50d52 100644
--- a/gmp/mpn/powerpc32/aors_n.asm
+++ b/gmp/mpn/powerpc32/aors_n.asm
@@ -3,44 +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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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: ? old: 3.25
-C 75x (G3): ? old: 3.5
-C 7400,7410 (G4): 3.25
-C 744x,745x (G4+): 4
-C POWER3/PPC630 2
-C POWER4/PPC970 2.4
-C POWER5 2.75
-C POWER6 40-140
-C POWER7 3
+C cycles/limb
+C 603e: ?
+C 604e: ? old: 3.25
+C 75x (G3): ? old: 3.5
+C 7400,7410 (G4): 3.25
+C 744x,745x (G4+): 4
+C power4/ppc970: ? old: 2.0
+C power5: ? old: 2.5
C INPUT PARAMETERS
define(`rp', `r3')
diff --git a/gmp/mpn/powerpc32/bdiv_dbm1c.asm b/gmp/mpn/powerpc32/bdiv_dbm1c.asm
index 72b2c482e4..41870fbe8a 100644
--- a/gmp/mpn/powerpc32/bdiv_dbm1c.asm
+++ b/gmp/mpn/powerpc32/bdiv_dbm1c.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/darwin.m4 b/gmp/mpn/powerpc32/darwin.m4
index db4226800b..b76103a8ca 100644
--- a/gmp/mpn/powerpc32/darwin.m4
+++ b/gmp/mpn/powerpc32/darwin.m4
@@ -2,44 +2,31 @@ divert(-1)
dnl m4 macros for Mac OS 32-bit assembly.
dnl Copyright 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`ASM_START',`')
-dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
+dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
dnl
define(`PROLOGUE_cpu',
-m4_assert_numargs_range(1,2)
-`ifelse(`$2',toc,,
-`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
- .text
+m4_assert_numargs(1)
+` .text
.globl $1
.align 3
$1:')
diff --git a/gmp/mpn/powerpc32/diveby3.asm b/gmp/mpn/powerpc32/diveby3.asm
index 288a7d30ac..cf11a19824 100644
--- a/gmp/mpn/powerpc32/diveby3.asm
+++ b/gmp/mpn/powerpc32/diveby3.asm
@@ -1,32 +1,21 @@
dnl PowerPC-32 mpn_divexact_by3 -- mpn by 3 exact division
dnl Copyright 2002, 2003, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/powerpc32/divrem_2.asm b/gmp/mpn/powerpc32/divrem_2.asm
index c6e64efe23..3261cbd727 100644
--- a/gmp/mpn/powerpc32/divrem_2.asm
+++ b/gmp/mpn/powerpc32/divrem_2.asm
@@ -1,32 +1,21 @@
dnl PPC-32 mpn_divrem_2 -- Divide an mpn number by a normalized 2-limb number.
-dnl Copyright 2007, 2008, 2012 Free Software Foundation, Inc.
+dnl Copyright 2007, 2008 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -95,9 +84,9 @@ C Compute di from d1
bge- cr7, L(9)
add r0, r0, r10
cmplw cr7, r0, r10
- cmplw cr6, r6, r0
+ cmplw cr6, r0, r6
addi r31, r31, -1 C q1--
- crorc 28, 28, 25
+ cror 28, 28, 25
bc+ 12, 28, L(9)
addi r31, r31, -1 C q1--
add r0, r0, r10
@@ -112,9 +101,9 @@ L(9): subf r0, r6, r0
bge- cr7, L(13)
add r0, r0, r10
cmplw cr7, r0, r10
- cmplw cr6, r11, r0
+ cmplw cr6, r0, r11
addi r6, r6, -1 C q0--
- crorc 28, 28, 25
+ cror 28, 28, 25
bc+ 12, 28, L(13)
C add r0, r0, r10 C final remainder
addi r6, r6, -1 C q0--
diff --git a/gmp/mpn/powerpc32/eabi.m4 b/gmp/mpn/powerpc32/eabi.m4
index cd7633c633..20f9a2f327 100644
--- a/gmp/mpn/powerpc32/eabi.m4
+++ b/gmp/mpn/powerpc32/eabi.m4
@@ -2,32 +2,21 @@ divert(-1)
dnl m4 macros for powerpc32 eABI assembly.
dnl Copyright 2003, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`ASM_START',`')
diff --git a/gmp/mpn/powerpc32/elf.m4 b/gmp/mpn/powerpc32/elf.m4
index a64a1271ff..ab1559ebd4 100644
--- a/gmp/mpn/powerpc32/elf.m4
+++ b/gmp/mpn/powerpc32/elf.m4
@@ -2,43 +2,31 @@ divert(-1)
dnl m4 macros for powerpc32 GNU/Linux assembly.
dnl Copyright 2003, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`ASM_START',`')
-dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
+dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
dnl
define(`PROLOGUE_cpu',
-m4_assert_numargs_range(1,2)
-`ifelse(`$2',toc,,
-`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
+m4_assert_numargs(1)
+ `
.section ".text"
.align 3
.globl $1
diff --git a/gmp/mpn/powerpc32/gmp-mparam.h b/gmp/mpn/powerpc32/gmp-mparam.h
index 784a6d7b74..1676317a40 100644
--- a/gmp/mpn/powerpc32/gmp-mparam.h
+++ b/gmp/mpn/powerpc32/gmp-mparam.h
@@ -1,36 +1,25 @@
/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2004, 2008-2010, 2014 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* This file is supposed to be used for 604, 604e, 744x/745x/747x (G4+), i.e.,
@@ -42,176 +31,53 @@ see https://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 */
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 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 69
-
-#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 73
-#define MUL_TOOM44_THRESHOLD 106
-#define MUL_TOOM6H_THRESHOLD 156
-#define MUL_TOOM8H_THRESHOLD 236
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#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 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
-
-#define MULMID_TOOM42_THRESHOLD 32
-
-#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 14
-
-#define MUL_FFT_MODF_THRESHOLD 284 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, \
- { 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}, \
- { 191, 9}, { 383,10}, { 207, 9}, { 415, 8}, \
- { 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,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 44
-#define DC_DIVAPPR_Q_THRESHOLD 142
-#define DC_BDIV_QR_THRESHOLD 54
-#define DC_BDIV_Q_THRESHOLD 124
-
-#define INV_MULMOD_BNM1_THRESHOLD 43
-#define INV_NEWTON_THRESHOLD 179
-#define INV_APPR_THRESHOLD 157
-
-#define BINV_NEWTON_THRESHOLD 214
-#define REDC_1_TO_REDC_N_THRESHOLD 55
-
-#define MU_DIV_QR_THRESHOLD 998
-#define MU_DIVAPPR_Q_THRESHOLD 1078
-#define MUPI_DIV_QR_THRESHOLD 84
-#define MU_BDIV_QR_THRESHOLD 872
-#define MU_BDIV_Q_THRESHOLD 1078
-
-#define POWM_SEC_TABLE 1,19,102,428,1378
-
-#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
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 27
-#define SET_STR_DC_THRESHOLD 781
-#define SET_STR_PRECOMPUTE_THRESHOLD 1505
-
-#define FAC_DSC_THRESHOLD 141
-#define FAC_ODD_THRESHOLD 29
+
+/* Generated by tuneup.c, 2009-01-14, gcc 4.3 */
+
+#define MUL_KARATSUBA_THRESHOLD 14
+#define MUL_TOOM3_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 106
+
+#define SQR_BASECASE_THRESHOLD 4
+#define SQR_KARATSUBA_THRESHOLD 24
+#define SQR_TOOM3_THRESHOLD 77
+#define SQR_TOOM4_THRESHOLD 130
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 52
+#define MULLOW_MUL_N_THRESHOLD 292
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 46
+#define POWM_THRESHOLD 87
+
+#define MATRIX22_STRASSEN_THRESHOLD 15
+#define HGCD_THRESHOLD 127
+#define GCD_DC_THRESHOLD 361
+#define GCDEXT_DC_THRESHOLD 382
+#define JACOBI_BASE_METHOD 1
+
+#define DIVREM_1_NORM_THRESHOLD 0 /* always */
+#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 7
+#define MOD_1_2_THRESHOLD 21
+#define MOD_1_4_THRESHOLD 68
+#define USE_PREINV_DIVREM_1 1
+#define USE_PREINV_MOD_1 1
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 22
+#define GET_STR_PRECOMPUTE_THRESHOLD 42
+#define SET_STR_DC_THRESHOLD 788
+#define SET_STR_PRECOMPUTE_THRESHOLD 1554
+
+#define MUL_FFT_TABLE { 304, 672, 1152, 2560, 6144, 24576, 0 }
+#define MUL_FFT_MODF_THRESHOLD 320
+#define MUL_FFT_THRESHOLD 2816
+
+#define SQR_FFT_TABLE { 272, 672, 1152, 2560, 10240, 24576, 0 }
+#define SQR_FFT_MODF_THRESHOLD 288
+#define SQR_FFT_THRESHOLD 2304
diff --git a/gmp/mpn/powerpc32/invert_limb.asm b/gmp/mpn/powerpc32/invert_limb.asm
deleted file mode 100644
index 612bfe523c..0000000000
--- a/gmp/mpn/powerpc32/invert_limb.asm
+++ /dev/null
@@ -1,142 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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+): 32
-C power4/ppc970: ?
-C power5: ?
-
-EXTERN(approx_tab)
-
-ASM_START()
-PROLOGUE(mpn_invert_limb)
- rlwinm r6, r3, 11, 22, 30 C extract bits 30..22 to pos 2^1
- srwi r10, r3, 11 C extract bits 31..11
- LEA( r9, approx_tab) C N.B. clobbers r0 for ELF and Darwin
- lhzx r9, r9, r6 C w2
- addi r0, r10, 1
- mullw r11, r9, r9
- slwi r9, r9, 4
- mulhwu r7, r11, r0
- rlwinm r11, r3, 0, 31, 31 C extract bit 0
- addi r0, r9, -1
- srwi r9, r3, 1 C d >> 1
- subf r0, r7, r0 C w1
- add r9, r9, r11 C d31
- mullw r9, r0, r9 C w1 * d31
- srwi r10, r0, 1 C w1 >> 1
- neg r11, r11
- and r11, r10, r11
- subf r11, r9, r11
- mulhwu r9, r11, r0
- slwi r0, r0, 15
- srwi r9, r9, 1
- add r0, r9, r0 C w0
- mullw r10, r0, r3
- mulhwu r9, r0, r3
- addc r11, r10, r3
- adde r3, r9, r3
- subf r3, r3, r0
- blr
-EPILOGUE()
-
-DEF_OBJECT(approx_tab)
- .short 0x7fe1,0x7fa1,0x7f61,0x7f22,0x7ee3,0x7ea4,0x7e65,0x7e27
- .short 0x7de9,0x7dab,0x7d6d,0x7d30,0x7cf3,0x7cb6,0x7c79,0x7c3d
- .short 0x7c00,0x7bc4,0x7b89,0x7b4d,0x7b12,0x7ad7,0x7a9c,0x7a61
- .short 0x7a27,0x79ec,0x79b2,0x7979,0x793f,0x7906,0x78cc,0x7894
- .short 0x785b,0x7822,0x77ea,0x77b2,0x777a,0x7742,0x770b,0x76d3
- .short 0x769c,0x7665,0x762f,0x75f8,0x75c2,0x758c,0x7556,0x7520
- .short 0x74ea,0x74b5,0x7480,0x744b,0x7416,0x73e2,0x73ad,0x7379
- .short 0x7345,0x7311,0x72dd,0x72aa,0x7277,0x7243,0x7210,0x71de
- .short 0x71ab,0x7179,0x7146,0x7114,0x70e2,0x70b1,0x707f,0x704e
- .short 0x701c,0x6feb,0x6fba,0x6f8a,0x6f59,0x6f29,0x6ef9,0x6ec8
- .short 0x6e99,0x6e69,0x6e39,0x6e0a,0x6ddb,0x6dab,0x6d7d,0x6d4e
- .short 0x6d1f,0x6cf1,0x6cc2,0x6c94,0x6c66,0x6c38,0x6c0a,0x6bdd
- .short 0x6bb0,0x6b82,0x6b55,0x6b28,0x6afb,0x6acf,0x6aa2,0x6a76
- .short 0x6a49,0x6a1d,0x69f1,0x69c6,0x699a,0x696e,0x6943,0x6918
- .short 0x68ed,0x68c2,0x6897,0x686c,0x6842,0x6817,0x67ed,0x67c3
- .short 0x6799,0x676f,0x6745,0x671b,0x66f2,0x66c8,0x669f,0x6676
- .short 0x664d,0x6624,0x65fc,0x65d3,0x65aa,0x6582,0x655a,0x6532
- .short 0x650a,0x64e2,0x64ba,0x6493,0x646b,0x6444,0x641c,0x63f5
- .short 0x63ce,0x63a7,0x6381,0x635a,0x6333,0x630d,0x62e7,0x62c1
- .short 0x629a,0x6275,0x624f,0x6229,0x6203,0x61de,0x61b8,0x6193
- .short 0x616e,0x6149,0x6124,0x60ff,0x60da,0x60b6,0x6091,0x606d
- .short 0x6049,0x6024,0x6000,0x5fdc,0x5fb8,0x5f95,0x5f71,0x5f4d
- .short 0x5f2a,0x5f07,0x5ee3,0x5ec0,0x5e9d,0x5e7a,0x5e57,0x5e35
- .short 0x5e12,0x5def,0x5dcd,0x5dab,0x5d88,0x5d66,0x5d44,0x5d22
- .short 0x5d00,0x5cde,0x5cbd,0x5c9b,0x5c7a,0x5c58,0x5c37,0x5c16
- .short 0x5bf5,0x5bd4,0x5bb3,0x5b92,0x5b71,0x5b51,0x5b30,0x5b10
- .short 0x5aef,0x5acf,0x5aaf,0x5a8f,0x5a6f,0x5a4f,0x5a2f,0x5a0f
- .short 0x59ef,0x59d0,0x59b0,0x5991,0x5972,0x5952,0x5933,0x5914
- .short 0x58f5,0x58d6,0x58b7,0x5899,0x587a,0x585b,0x583d,0x581f
- .short 0x5800,0x57e2,0x57c4,0x57a6,0x5788,0x576a,0x574c,0x572e
- .short 0x5711,0x56f3,0x56d5,0x56b8,0x569b,0x567d,0x5660,0x5643
- .short 0x5626,0x5609,0x55ec,0x55cf,0x55b2,0x5596,0x5579,0x555d
- .short 0x5540,0x5524,0x5507,0x54eb,0x54cf,0x54b3,0x5497,0x547b
- .short 0x545f,0x5443,0x5428,0x540c,0x53f0,0x53d5,0x53b9,0x539e
- .short 0x5383,0x5368,0x534c,0x5331,0x5316,0x52fb,0x52e0,0x52c6
- .short 0x52ab,0x5290,0x5276,0x525b,0x5240,0x5226,0x520c,0x51f1
- .short 0x51d7,0x51bd,0x51a3,0x5189,0x516f,0x5155,0x513b,0x5121
- .short 0x5108,0x50ee,0x50d5,0x50bb,0x50a2,0x5088,0x506f,0x5056
- .short 0x503c,0x5023,0x500a,0x4ff1,0x4fd8,0x4fbf,0x4fa6,0x4f8e
- .short 0x4f75,0x4f5c,0x4f44,0x4f2b,0x4f13,0x4efa,0x4ee2,0x4eca
- .short 0x4eb1,0x4e99,0x4e81,0x4e69,0x4e51,0x4e39,0x4e21,0x4e09
- .short 0x4df1,0x4dda,0x4dc2,0x4daa,0x4d93,0x4d7b,0x4d64,0x4d4d
- .short 0x4d35,0x4d1e,0x4d07,0x4cf0,0x4cd8,0x4cc1,0x4caa,0x4c93
- .short 0x4c7d,0x4c66,0x4c4f,0x4c38,0x4c21,0x4c0b,0x4bf4,0x4bde
- .short 0x4bc7,0x4bb1,0x4b9a,0x4b84,0x4b6e,0x4b58,0x4b41,0x4b2b
- .short 0x4b15,0x4aff,0x4ae9,0x4ad3,0x4abd,0x4aa8,0x4a92,0x4a7c
- .short 0x4a66,0x4a51,0x4a3b,0x4a26,0x4a10,0x49fb,0x49e5,0x49d0
- .short 0x49bb,0x49a6,0x4990,0x497b,0x4966,0x4951,0x493c,0x4927
- .short 0x4912,0x48fe,0x48e9,0x48d4,0x48bf,0x48ab,0x4896,0x4881
- .short 0x486d,0x4858,0x4844,0x482f,0x481b,0x4807,0x47f3,0x47de
- .short 0x47ca,0x47b6,0x47a2,0x478e,0x477a,0x4766,0x4752,0x473e
- .short 0x472a,0x4717,0x4703,0x46ef,0x46db,0x46c8,0x46b4,0x46a1
- .short 0x468d,0x467a,0x4666,0x4653,0x4640,0x462c,0x4619,0x4606
- .short 0x45f3,0x45e0,0x45cd,0x45ba,0x45a7,0x4594,0x4581,0x456e
- .short 0x455b,0x4548,0x4536,0x4523,0x4510,0x44fe,0x44eb,0x44d8
- .short 0x44c6,0x44b3,0x44a1,0x448f,0x447c,0x446a,0x4458,0x4445
- .short 0x4433,0x4421,0x440f,0x43fd,0x43eb,0x43d9,0x43c7,0x43b5
- .short 0x43a3,0x4391,0x437f,0x436d,0x435c,0x434a,0x4338,0x4327
- .short 0x4315,0x4303,0x42f2,0x42e0,0x42cf,0x42bd,0x42ac,0x429b
- .short 0x4289,0x4278,0x4267,0x4256,0x4244,0x4233,0x4222,0x4211
- .short 0x4200,0x41ef,0x41de,0x41cd,0x41bc,0x41ab,0x419a,0x418a
- .short 0x4179,0x4168,0x4157,0x4147,0x4136,0x4125,0x4115,0x4104
- .short 0x40f4,0x40e3,0x40d3,0x40c2,0x40b2,0x40a2,0x4091,0x4081
- .short 0x4071,0x4061,0x4050,0x4040,0x4030,0x4020,0x4010,0x4000
-END_OBJECT(approx_tab)
-ASM_END()
diff --git a/gmp/mpn/powerpc32/lshift.asm b/gmp/mpn/powerpc32/lshift.asm
index 948f8c6cf3..e306173146 100644
--- a/gmp/mpn/powerpc32/lshift.asm
+++ b/gmp/mpn/powerpc32/lshift.asm
@@ -1,32 +1,22 @@
dnl PowerPC-32 mpn_lshift -- Shift a number left.
-dnl Copyright 1995, 1998, 2000, 2002-2005 Free Software Foundation, Inc.
+dnl Copyright 1995, 1998, 2000, 2002, 2003, 2004, 2005 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -48,7 +38,7 @@ C cnt r6
ASM_START()
PROLOGUE(mpn_lshift)
- cmpwi cr0, r5, 30 C more than 30 limbs?
+ cmpwi cr0, r5, 12 C more than 12 limbs?
slwi r0, r5, 2
add r4, r4, r0 C make r4 point at end of s1
add r7, r3, r0 C make r7 point at end of res
@@ -163,4 +153,4 @@ L(loopU):
stw r12, -20(r7)
lmw r24, -32(r1) C restore registers
blr
-EPILOGUE()
+EPILOGUE(mpn_lshift)
diff --git a/gmp/mpn/powerpc32/lshiftc.asm b/gmp/mpn/powerpc32/lshiftc.asm
deleted file mode 100644
index 61606d1b66..0000000000
--- a/gmp/mpn/powerpc32/lshiftc.asm
+++ /dev/null
@@ -1,168 +0,0 @@
-dnl PowerPC-32 mpn_lshiftc.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 3.0
-C 75x (G3): 3.0
-C 7400,7410 (G4): 3.0
-C 7445,7455 (G4+): 2.5
-C 7447,7457 (G4+): 2.25
-C power4/ppc970: 2.5
-C power5: 2.5
-
-C INPUT PARAMETERS
-C rp r3
-C up r4
-C n r5
-C cnt r6
-
-ASM_START()
-PROLOGUE(mpn_lshiftc)
- cmpwi cr0, r5, 30 C more than 30 limbs?
- slwi r0, r5, 2
- add r4, r4, r0 C make r4 point at end of s1
- add r7, r3, r0 C make r7 point at end of res
- bgt L(BIG) C branch if more than 12 limbs
-
- mtctr r5 C copy size into CTR
- subfic r8, r6, 32
- lwzu r11, -4(r4) C load first s1 limb
- srw r3, r11, r8 C compute function return value
- bdz L(end1)
-
-L(oop): lwzu r10, -4(r4)
- slw r9, r11, r6
- srw r12, r10, r8
- nor r9, r9, r12
- stwu r9, -4(r7)
- bdz L(end2)
- lwzu r11, -4(r4)
- slw r9, r10, r6
- srw r12, r11, r8
- nor r9, r9, r12
- stwu r9, -4(r7)
- bdnz L(oop)
-
-L(end1):
- slw r0, r11, r6
- nor r0, r0, r0
- stw r0, -4(r7)
- blr
-L(end2):
- slw r0, r10, r6
- nor r0, r0, r0
- stw r0, -4(r7)
- blr
-
-L(BIG):
- stmw r24, -32(r1) C save registers we are supposed to preserve
- lwzu r9, -4(r4)
- subfic r8, r6, 32
- srw r3, r9, r8 C compute function return value
- slw r0, r9, r6
- addi r5, r5, -1
-
- andi. r10, r5, 3 C count for spill loop
- beq L(e)
- mtctr r10
- lwzu r28, -4(r4)
- bdz L(xe0)
-
-L(loop0):
- slw r12, r28, r6
- srw r24, r28, r8
- lwzu r28, -4(r4)
- nor r24, r0, r24
- stwu r24, -4(r7)
- mr r0, r12
- bdnz L(loop0) C taken at most once!
-
-L(xe0): slw r12, r28, r6
- srw r24, r28, r8
- nor r24, r0, r24
- stwu r24, -4(r7)
- mr r0, r12
-
-L(e): srwi r5, r5, 2 C count for unrolled loop
- addi r5, r5, -1
- mtctr r5
- lwz r28, -4(r4)
- lwz r29, -8(r4)
- lwz r30, -12(r4)
- lwzu r31, -16(r4)
-
-L(loopU):
- slw r9, r28, r6
- srw r24, r28, r8
- lwz r28, -4(r4)
- slw r10, r29, r6
- srw r25, r29, r8
- lwz r29, -8(r4)
- slw r11, r30, r6
- srw r26, r30, r8
- lwz r30, -12(r4)
- slw r12, r31, r6
- srw r27, r31, r8
- lwzu r31, -16(r4)
- nor r24, r0, r24
- stw r24, -4(r7)
- nor r25, r9, r25
- stw r25, -8(r7)
- nor r26, r10, r26
- stw r26, -12(r7)
- nor r27, r11, r27
- stwu r27, -16(r7)
- mr r0, r12
- bdnz L(loopU)
-
- slw r9, r28, r6
- srw r24, r28, r8
- slw r10, r29, r6
- srw r25, r29, r8
- slw r11, r30, r6
- srw r26, r30, r8
- slw r12, r31, r6
- srw r27, r31, r8
- nor r24, r0, r24
- stw r24, -4(r7)
- nor r25, r9, r25
- stw r25, -8(r7)
- nor r26, r10, r26
- stw r26, -12(r7)
- nor r27, r11, r27
- stw r27, -16(r7)
- nor r12, r12, r12
- stw r12, -20(r7)
- lmw r24, -32(r1) C restore registers
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc32/mod_34lsub1.asm b/gmp/mpn/powerpc32/mod_34lsub1.asm
index 6d7fe4d089..fa0f0139ee 100644
--- a/gmp/mpn/powerpc32/mod_34lsub1.asm
+++ b/gmp/mpn/powerpc32/mod_34lsub1.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/mode1o.asm b/gmp/mpn/powerpc32/mode1o.asm
index e8a6b5e28a..ba9a393b09 100644
--- a/gmp/mpn/powerpc32/mode1o.asm
+++ b/gmp/mpn/powerpc32/mode1o.asm
@@ -1,32 +1,21 @@
dnl PowerPC-32 mpn_modexact_1_odd -- mpn by limb exact remainder.
dnl Copyright 2002, 2003, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/powerpc32/mul_1.asm b/gmp/mpn/powerpc32/mul_1.asm
index e42087cfa8..e6f44e21d9 100644
--- a/gmp/mpn/powerpc32/mul_1.asm
+++ b/gmp/mpn/powerpc32/mul_1.asm
@@ -5,30 +5,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/p3-p7/aors_n.asm b/gmp/mpn/powerpc32/p3-p7/aors_n.asm
deleted file mode 100644
index c44df8fa50..0000000000
--- a/gmp/mpn/powerpc32/p3-p7/aors_n.asm
+++ /dev/null
@@ -1,186 +0,0 @@
-dnl PowerPC-32 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.5
-C POWER4/PPC970 2
-C POWER5 2
-C POWER6 2.78
-C POWER7 2.15-2.87
-
-C This code is based on powerpc64/aors_n.asm.
-
-C INPUT PARAMETERS
-C rp r3
-C up r4
-C vp r5
-C n r6
-
-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)
-
-ASM_START()
-PROLOGUE(func_nc)
- SETCBR(r7)
- b L(ent)
-EPILOGUE()
-
-PROLOGUE(func)
- CLRCB
-L(ent): stw r31, -4(r1)
- stw r30, -8(r1)
- stw r29, -12(r1)
- stw r28, -16(r1)
-
- rlwinm. r0, r6, 0,30,31 C r0 = n & 3, set cr0
- cmpwi cr6, r0, 2
- addi r6, r6, 3 C compute count...
- srwi 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): lwz r8, 0(r4) C load s1 limb
- lwz r9, 0(r5) C load s2 limb
- lwz r10, 4(r4) C load s1 limb
- lwz r11, 4(r5) C load s2 limb
- lwz r12, 8(r4) C load s1 limb
- addi r4, r4, 12
- lwz r0, 8(r5) C load s2 limb
- addi r5, r5, 12
- ADDSUBC r29, r9, r8
- ADDSUBC r30, r11, r10
- ADDSUBC r31, r0, r12
- stw r29, 0(r3)
- stw r30, 4(r3)
- stw r31, 8(r3)
- addi r3, r3, 12
- bdnz L(go)
- b L(ret)
-
-L(b01): lwz r12, 0(r4) C load s1 limb
- addi r4, r4, 4
- lwz r0, 0(r5) C load s2 limb
- addi r5, r5, 4
- ADDSUBC r31, r0, r12 C add
- stw r31, 0(r3)
- addi r3, r3, 4
- bdnz L(go)
- b L(ret)
-
-L(b10): lwz r10, 0(r4) C load s1 limb
- lwz r11, 0(r5) C load s2 limb
- lwz r12, 4(r4) C load s1 limb
- addi r4, r4, 8
- lwz r0, 4(r5) C load s2 limb
- addi r5, r5, 8
- ADDSUBC r30, r11, r10 C add
- ADDSUBC r31, r0, r12 C add
- stw r30, 0(r3)
- stw r31, 4(r3)
- addi r3, r3, 8
- bdnz L(go)
- b L(ret)
-
-L(b00): C INITCY C clear/set cy
-L(go): lwz r6, 0(r4) C load s1 limb
- lwz r7, 0(r5) C load s2 limb
- lwz r8, 4(r4) C load s1 limb
- lwz r9, 4(r5) C load s2 limb
- lwz r10, 8(r4) C load s1 limb
- lwz r11, 8(r5) C load s2 limb
- lwz r12, 12(r4) C load s1 limb
- lwz r0, 12(r5) C load s2 limb
- bdz L(end)
-
- addi r4, r4, 16
- addi r5, r5, 16
-
- ALIGN(16)
-L(top): ADDSUBC r28, r7, r6
- lwz r6, 0(r4) C load s1 limb
- lwz r7, 0(r5) C load s2 limb
- ADDSUBC r29, r9, r8
- lwz r8, 4(r4) C load s1 limb
- lwz r9, 4(r5) C load s2 limb
- ADDSUBC r30, r11, r10
- lwz r10, 8(r4) C load s1 limb
- lwz r11, 8(r5) C load s2 limb
- ADDSUBC r31, r0, r12
- lwz r12, 12(r4) C load s1 limb
- lwz r0, 12(r5) C load s2 limb
- stw r28, 0(r3)
- addi r4, r4, 16
- stw r29, 4(r3)
- addi r5, r5, 16
- stw r30, 8(r3)
- stw r31, 12(r3)
- addi r3, r3, 16
- bdnz L(top) C decrement ctr and loop back
-
-L(end): ADDSUBC r28, r7, r6
- ADDSUBC r29, r9, r8
- ADDSUBC r30, r11, r10
- ADDSUBC r31, r0, r12
- stw r28, 0(r3)
- stw r29, 4(r3)
- stw r30, 8(r3)
- stw r31, 12(r3)
-
-L(ret): lwz r31, -4(r1)
- lwz r30, -8(r1)
- lwz r29, -12(r1)
- lwz r28, -16(r1)
-
- subfe r3, r0, r0 C -cy
- GENRVAL
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc32/p3/gmp-mparam.h b/gmp/mpn/powerpc32/p3/gmp-mparam.h
deleted file mode 100644
index 33826956a2..0000000000
--- a/gmp/mpn/powerpc32/p3/gmp-mparam.h
+++ /dev/null
@@ -1,155 +0,0 @@
-/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 450 MHz POWER3 */
-
-#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 3
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 12
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 18
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
-#define USE_PREINV_DIVREM_1 1
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-
-#define MUL_TOOM22_THRESHOLD 10
-#define MUL_TOOM33_THRESHOLD 38
-#define MUL_TOOM44_THRESHOLD 58
-#define MUL_TOOM6H_THRESHOLD 129
-#define MUL_TOOM8H_THRESHOLD 212
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 63
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 59
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 64
-
-#define SQR_BASECASE_THRESHOLD 0 /* always */
-#define SQR_TOOM2_THRESHOLD 14
-#define SQR_TOOM3_THRESHOLD 53
-#define SQR_TOOM4_THRESHOLD 76
-#define SQR_TOOM6_THRESHOLD 106
-#define SQR_TOOM8_THRESHOLD 284
-
-#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 9
-
-#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 220, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 9, 5}, { 19, 6}, { 13, 7}, { 7, 6}, \
- { 16, 7}, { 13, 8}, { 7, 7}, { 19, 8}, \
- { 11, 7}, { 23, 9}, { 7, 8}, { 15, 7}, \
- { 33, 8}, { 23, 9}, { 15, 8}, { 35, 9}, \
- { 23,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47,10}, { 31, 9}, \
- { 63, 8}, { 127, 9}, { 71, 8}, { 143, 9}, \
- { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255, 9}, { 143,10}, { 79, 9}, \
- { 159, 8}, { 319, 9}, { 175, 8}, { 351,10}, \
- { 95, 9}, { 191, 8}, { 383,10}, { 111,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
- { 287, 8}, { 575,10}, { 159, 9}, { 319,10}, \
- { 175, 9}, { 351,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 207, 9}, { 415,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 351, 9}, { 703, 8}, \
- { 1407,11}, { 191,10}, { 415,11}, { 223,10}, \
- { 447, 9}, { 895,12}, { 4096,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 82
-#define MUL_FFT_THRESHOLD 2688
-
-#define SQR_FFT_MODF_THRESHOLD 176 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 176, 5}, { 13, 6}, { 7, 5}, { 15, 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}, { 23, 9}, \
- { 15, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
- { 31, 8}, { 63, 9}, { 39, 8}, { 79, 9}, \
- { 47, 8}, { 95,10}, { 31, 9}, { 63, 8}, \
- { 127, 9}, { 71, 8}, { 143, 7}, { 287, 6}, \
- { 575, 9}, { 79, 8}, { 159,10}, { 47, 9}, \
- { 95,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255, 9}, { 143, 8}, { 287, 7}, { 575,10}, \
- { 79, 9}, { 159, 8}, { 319, 9}, { 175,10}, \
- { 95, 9}, { 191, 8}, { 383,10}, { 111, 9}, \
- { 223,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 143, 9}, { 287, 8}, { 575,10}, { 159, 9}, \
- { 319,10}, { 175,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 223,12}, { 63,11}, { 127,10}, \
- { 287, 9}, { 575,11}, { 159,10}, { 351, 9}, \
- { 703, 8}, { 1407,11}, { 191,10}, { 383,11}, \
- { 223,10}, { 447, 9}, { 895,12}, { 4096,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 87
-#define SQR_FFT_THRESHOLD 1728
-
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 33
-#define MULLO_MUL_N_THRESHOLD 5240
-
-#define DC_DIV_QR_THRESHOLD 32
-#define DC_DIVAPPR_Q_THRESHOLD 123
-#define DC_BDIV_QR_THRESHOLD 34
-#define DC_BDIV_Q_THRESHOLD 84
-
-#define INV_MULMOD_BNM1_THRESHOLD 42
-#define INV_NEWTON_THRESHOLD 129
-#define INV_APPR_THRESHOLD 124
-
-#define BINV_NEWTON_THRESHOLD 148
-#define REDC_1_TO_REDC_N_THRESHOLD 38
-
-#define MU_DIV_QR_THRESHOLD 748
-#define MU_DIVAPPR_Q_THRESHOLD 748
-#define MUPI_DIV_QR_THRESHOLD 59
-#define MU_BDIV_QR_THRESHOLD 562
-#define MU_BDIV_Q_THRESHOLD 654
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 76
-#define GCD_DC_THRESHOLD 205
-#define GCDEXT_DC_THRESHOLD 174
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 14
-#define GET_STR_PRECOMPUTE_THRESHOLD 27
-#define SET_STR_DC_THRESHOLD 181
-#define SET_STR_PRECOMPUTE_THRESHOLD 525
diff --git a/gmp/mpn/powerpc32/p4/gmp-mparam.h b/gmp/mpn/powerpc32/p4/gmp-mparam.h
deleted file mode 100644
index 20830a0bd7..0000000000
--- a/gmp/mpn/powerpc32/p4/gmp-mparam.h
+++ /dev/null
@@ -1,204 +0,0 @@
-/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/* 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 */
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 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 45
-
-#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 73
-#define MUL_TOOM44_THRESHOLD 130
-#define MUL_TOOM6H_THRESHOLD 222
-#define MUL_TOOM8H_THRESHOLD 333
-
-#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 5
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 85
-#define SQR_TOOM4_THRESHOLD 160
-#define SQR_TOOM6_THRESHOLD 197
-#define SQR_TOOM8_THRESHOLD 357
-
-#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}, { 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}, { 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 \
- { { 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}, \
- { 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 55
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#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 50
-#define INV_NEWTON_THRESHOLD 226
-#define INV_APPR_THRESHOLD 202
-
-#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 998
-#define MU_BDIV_Q_THRESHOLD 1142
-
-#define POWM_SEC_TABLE 3,28,78,480,1099
-
-#define MATRIX22_STRASSEN_THRESHOLD 9
-#define HGCD_THRESHOLD 93
-#define HGCD_APPR_THRESHOLD 109
-#define HGCD_REDUCE_THRESHOLD 2479
-#define GCD_DC_THRESHOLD 379
-#define GCDEXT_DC_THRESHOLD 273
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 11
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 381
-#define SET_STR_PRECOMPUTE_THRESHOLD 1002
-
-#define FAC_DSC_THRESHOLD 179
-#define FAC_ODD_THRESHOLD 28
diff --git a/gmp/mpn/powerpc32/p5/gmp-mparam.h b/gmp/mpn/powerpc32/p5/gmp-mparam.h
deleted file mode 100644
index faa1e81da4..0000000000
--- a/gmp/mpn/powerpc32/p5/gmp-mparam.h
+++ /dev/null
@@ -1,156 +0,0 @@
-/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 1650 MHz POWER5 */
-
-#define DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 8
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 6
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 9
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 50
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 18
-#define USE_PREINV_DIVREM_1 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 61
-
-#define MUL_TOOM22_THRESHOLD 22
-#define MUL_TOOM33_THRESHOLD 57
-#define MUL_TOOM44_THRESHOLD 130
-#define MUL_TOOM6H_THRESHOLD 189
-#define MUL_TOOM8H_THRESHOLD 309
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 99
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 83
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 88
-
-#define SQR_BASECASE_THRESHOLD 6
-#define SQR_TOOM2_THRESHOLD 40
-#define SQR_TOOM3_THRESHOLD 77
-#define SQR_TOOM4_THRESHOLD 124
-#define SQR_TOOM6_THRESHOLD 140
-#define SQR_TOOM8_THRESHOLD 238
-
-#define MULMID_TOOM42_THRESHOLD 40
-
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 16
-
-#define POWM_SEC_TABLE 4,29,252,840,2080
-
-#define MUL_FFT_MODF_THRESHOLD 412 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 412, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 12, 5}, { 25, 6}, { 21, 7}, { 11, 6}, \
- { 25, 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}, \
- { 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}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 143, 9}, { 287,10}, { 159,11}, { 95,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,10}, { 287,11}, \
- { 159,10}, { 335, 9}, { 671,10}, { 351, 9}, \
- { 703,11}, { 191,10}, { 383, 9}, { 767,10}, \
- { 415, 9}, { 831,11}, { 223,12}, { 4096,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 71
-#define MUL_FFT_THRESHOLD 4736
-
-#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 340, 5}, { 21, 6}, { 11, 5}, { 23, 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}, { 67, 9}, { 47,10}, { 31, 9}, \
- { 71,10}, { 47,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, 9}, { 303,10}, \
- { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543,10}, { 287, 9}, { 575,10}, { 303,11}, \
- { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
- { 671,10}, { 351,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 415,11}, { 223,10}, { 447,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 76
-#define SQR_FFT_THRESHOLD 3712
-
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 68
-#define MULLO_MUL_N_THRESHOLD 9236
-
-#define DC_DIV_QR_THRESHOLD 69
-#define DC_DIVAPPR_Q_THRESHOLD 220
-#define DC_BDIV_QR_THRESHOLD 75
-#define DC_BDIV_Q_THRESHOLD 188
-
-#define INV_MULMOD_BNM1_THRESHOLD 54
-#define INV_NEWTON_THRESHOLD 230
-#define INV_APPR_THRESHOLD 230
-
-#define BINV_NEWTON_THRESHOLD 278
-#define REDC_1_TO_REDC_N_THRESHOLD 87
-
-#define MU_DIV_QR_THRESHOLD 1210
-#define MU_DIVAPPR_Q_THRESHOLD 1308
-#define MUPI_DIV_QR_THRESHOLD 106
-#define MU_BDIV_QR_THRESHOLD 1017
-#define MU_BDIV_Q_THRESHOLD 1210
-
-#define MATRIX22_STRASSEN_THRESHOLD 14
-#define HGCD_THRESHOLD 110
-#define HGCD_APPR_THRESHOLD 138
-#define HGCD_REDUCE_THRESHOLD 2578
-#define GCD_DC_THRESHOLD 408
-#define GCDEXT_DC_THRESHOLD 298
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 527
-#define SET_STR_PRECOMPUTE_THRESHOLD 1090
diff --git a/gmp/mpn/powerpc32/p6/gmp-mparam.h b/gmp/mpn/powerpc32/p6/gmp-mparam.h
deleted file mode 100644
index c9504b63b3..0000000000
--- a/gmp/mpn/powerpc32/p6/gmp-mparam.h
+++ /dev/null
@@ -1,165 +0,0 @@
-/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 3500 MHz POWER6 */
-
-#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 3
-#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 MP_SIZE_T_MAX
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
-#define USE_PREINV_DIVREM_1 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 19
-#define MUL_TOOM33_THRESHOLD 55
-#define MUL_TOOM44_THRESHOLD 88
-#define MUL_TOOM6H_THRESHOLD 137
-#define MUL_TOOM8H_THRESHOLD 181
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 57
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 56
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 57
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 56
-
-#define SQR_BASECASE_THRESHOLD 0 /* always */
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 56
-#define SQR_TOOM4_THRESHOLD 130
-#define SQR_TOOM6_THRESHOLD 189
-#define SQR_TOOM8_THRESHOLD 296
-
-#define MULMID_TOOM42_THRESHOLD 26
-
-#define MULMOD_BNM1_THRESHOLD 7
-#define SQRMOD_BNM1_THRESHOLD 12
-
-#define POWM_SEC_TABLE 2,26,127,453,1068
-
-#define MUL_FFT_MODF_THRESHOLD 212 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 212, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 13, 7}, { 7, 6}, { 16, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 19, 8}, \
- { 11, 7}, { 25, 9}, { 7, 8}, { 15, 7}, \
- { 31, 8}, { 19, 7}, { 39, 8}, { 23, 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, 7}, { 287, 9}, \
- { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255, 7}, { 511, 9}, { 143, 8}, \
- { 287,10}, { 79, 9}, { 159, 8}, { 319, 9}, \
- { 175, 8}, { 351,10}, { 95, 9}, { 191, 8}, \
- { 383, 9}, { 207,10}, { 111,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
- { 287, 8}, { 575,10}, { 159, 9}, { 319,10}, \
- { 175, 9}, { 351,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 207, 9}, { 415,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 351, 9}, { 703,11}, \
- { 191,10}, { 415, 9}, { 831,11}, { 223,10}, \
- { 447,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 89
-#define MUL_FFT_THRESHOLD 1728
-
-#define SQR_FFT_MODF_THRESHOLD 184 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 184, 5}, { 6, 4}, { 13, 5}, { 13, 6}, \
- { 7, 5}, { 15, 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}, { 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, 7}, \
- { 255, 9}, { 71, 8}, { 143, 7}, { 287, 6}, \
- { 575, 9}, { 79,10}, { 47,11}, { 31,10}, \
- { 63, 9}, { 127, 8}, { 255, 9}, { 143, 8}, \
- { 287, 7}, { 575,10}, { 79, 9}, { 159, 8}, \
- { 319, 9}, { 175, 8}, { 351,10}, { 95, 9}, \
- { 191, 8}, { 383, 9}, { 207,10}, { 111, 9}, \
- { 223,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 143, 9}, { 287, 8}, { 575,10}, { 159, 9}, \
- { 319,10}, { 175, 9}, { 351,11}, { 95,10}, \
- { 191, 9}, { 383,10}, { 207, 9}, { 415,10}, \
- { 223,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 287, 9}, { 575,11}, { 159,10}, \
- { 351, 9}, { 703, 8}, { 1407,11}, { 191,10}, \
- { 415,11}, { 223,10}, { 447, 9}, { 895,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 92
-#define SQR_FFT_THRESHOLD 1600
-
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 57
-#define MULLO_MUL_N_THRESHOLD 3176
-
-#define DC_DIV_QR_THRESHOLD 52
-#define DC_DIVAPPR_Q_THRESHOLD 187
-#define DC_BDIV_QR_THRESHOLD 64
-#define DC_BDIV_Q_THRESHOLD 146
-
-#define INV_MULMOD_BNM1_THRESHOLD 68
-#define INV_NEWTON_THRESHOLD 182
-#define INV_APPR_THRESHOLD 182
-
-#define BINV_NEWTON_THRESHOLD 186
-#define REDC_1_TO_REDC_N_THRESHOLD 60
-
-#define MU_DIV_QR_THRESHOLD 924
-#define MU_DIVAPPR_Q_THRESHOLD 807
-#define MUPI_DIV_QR_THRESHOLD 73
-#define MU_BDIV_QR_THRESHOLD 667
-#define MU_BDIV_Q_THRESHOLD 823
-
-#define MATRIX22_STRASSEN_THRESHOLD 8
-#define HGCD_THRESHOLD 61
-#define HGCD_APPR_THRESHOLD 50
-#define HGCD_REDUCE_THRESHOLD 974
-#define GCD_DC_THRESHOLD 195
-#define GCDEXT_DC_THRESHOLD 134
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 9
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 190
-#define SET_STR_PRECOMPUTE_THRESHOLD 411
diff --git a/gmp/mpn/powerpc32/p7/gmp-mparam.h b/gmp/mpn/powerpc32/p7/gmp-mparam.h
deleted file mode 100644
index 35bb61dca2..0000000000
--- a/gmp/mpn/powerpc32/p7/gmp-mparam.h
+++ /dev/null
@@ -1,159 +0,0 @@
-/* PowerPC-32 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 3550 MHz POWER7/T4 */
-
-#define DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 34
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 15
-#define USE_PREINV_DIVREM_1 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 34
-
-#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 89
-#define MUL_TOOM44_THRESHOLD 130
-#define MUL_TOOM6H_THRESHOLD 286
-#define MUL_TOOM8H_THRESHOLD 363
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 121
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 89
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
-
-#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 50
-#define SQR_TOOM3_THRESHOLD 89
-#define SQR_TOOM4_THRESHOLD 154
-#define SQR_TOOM6_THRESHOLD 222
-#define SQR_TOOM8_THRESHOLD 381
-
-#define MULMID_TOOM42_THRESHOLD 40
-
-#define MULMOD_BNM1_THRESHOLD 18
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define POWM_SEC_TABLE 4,35,225,780,2212
-
-#define MUL_FFT_MODF_THRESHOLD 476 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 476, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 14, 5}, { 29, 6}, { 21, 7}, { 11, 6}, \
- { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 27, 9}, { 15, 8}, { 39, 9}, { 23, 8}, \
- { 51,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
- { 159,11}, { 95,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271, 9}, { 543, 8}, \
- { 1087,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671, 8}, { 1343,10}, { 351,11}, \
- { 191,10}, { 415, 9}, { 831,10}, { 431,11}, \
- { 223,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 77
-#define MUL_FFT_THRESHOLD 5312
-
-#define SQR_FFT_MODF_THRESHOLD 344 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 344, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 21, 7}, { 11, 6}, { 24, 7}, { 13, 6}, \
- { 27, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
- { 11, 7}, { 27, 8}, { 15, 7}, { 33, 8}, \
- { 19, 7}, { 39, 8}, { 27, 9}, { 15, 8}, \
- { 39, 9}, { 23, 8}, { 47,10}, { 15, 9}, \
- { 31, 8}, { 63, 9}, { 39, 8}, { 79, 9}, \
- { 47,10}, { 31, 9}, { 79,10}, { 47,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511, 9}, { 271,10}, \
- { 143, 9}, { 287, 8}, { 575, 9}, { 303,10}, \
- { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543, 8}, { 1087,10}, { 287, 9}, { 575,10}, \
- { 303,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671,10}, { 351, 9}, { 703,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 415, 9}, \
- { 831,11}, { 223,10}, { 447,12}, { 4096,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 79
-#define SQR_FFT_THRESHOLD 3712
-
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 34
-#define MULLO_MUL_N_THRESHOLD 10323
-
-#define DC_DIV_QR_THRESHOLD 52
-#define DC_DIVAPPR_Q_THRESHOLD 202
-#define DC_BDIV_QR_THRESHOLD 68
-#define DC_BDIV_Q_THRESHOLD 152
-
-#define INV_MULMOD_BNM1_THRESHOLD 66
-#define INV_NEWTON_THRESHOLD 226
-#define INV_APPR_THRESHOLD 189
-
-#define BINV_NEWTON_THRESHOLD 292
-#define REDC_1_TO_REDC_N_THRESHOLD 79
-
-#define MU_DIV_QR_THRESHOLD 1442
-#define MU_DIVAPPR_Q_THRESHOLD 1442
-#define MUPI_DIV_QR_THRESHOLD 91
-#define MU_BDIV_QR_THRESHOLD 1308
-#define MU_BDIV_Q_THRESHOLD 1442
-
-#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 126
-#define HGCD_APPR_THRESHOLD 139
-#define HGCD_REDUCE_THRESHOLD 2681
-#define GCD_DC_THRESHOLD 573
-#define GCDEXT_DC_THRESHOLD 448
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 9
-#define GET_STR_PRECOMPUTE_THRESHOLD 20
-#define SET_STR_DC_THRESHOLD 834
-#define SET_STR_PRECOMPUTE_THRESHOLD 1888
diff --git a/gmp/mpn/powerpc32/powerpc-defs.m4 b/gmp/mpn/powerpc32/powerpc-defs.m4
index 0c142a2e0c..33cf97e387 100644
--- a/gmp/mpn/powerpc32/powerpc-defs.m4
+++ b/gmp/mpn/powerpc32/powerpc-defs.m4
@@ -3,32 +3,21 @@ divert(-1)
dnl m4 macros for PowerPC assembler (32 and 64 bit).
dnl Copyright 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
diff --git a/gmp/mpn/powerpc32/rshift.asm b/gmp/mpn/powerpc32/rshift.asm
index cb0046d5ee..b069a93d12 100644
--- a/gmp/mpn/powerpc32/rshift.asm
+++ b/gmp/mpn/powerpc32/rshift.asm
@@ -1,32 +1,22 @@
dnl PowerPC-32 mpn_rshift -- Shift a number right.
-dnl Copyright 1995, 1998, 2000, 2002-2005 Free Software Foundation, Inc.
+dnl Copyright 1995, 1998, 2000, 2002, 2003, 2004, 2005 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -48,7 +38,7 @@ C cnt r6
ASM_START()
PROLOGUE(mpn_rshift)
- cmpwi cr0, r5, 30 C more than 30 limbs?
+ cmpwi cr0, r5, 12 C more than 12 limbs?
addi r7, r3, -4 C dst-4
bgt L(BIG) C branch if more than 12 limbs
@@ -161,4 +151,4 @@ L(loopU):
stw r12, 20(r7)
lmw r24, -32(r1) C restore registers
blr
-EPILOGUE()
+EPILOGUE(mpn_rshift)
diff --git a/gmp/mpn/powerpc32/sec_tabselect.asm b/gmp/mpn/powerpc32/sec_tabselect.asm
deleted file mode 100644
index a3f24d5678..0000000000
--- a/gmp/mpn/powerpc32/sec_tabselect.asm
+++ /dev/null
@@ -1,141 +0,0 @@
-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/gmp/mpn/powerpc32/sqr_diag_addlsh1.asm b/gmp/mpn/powerpc32/sqr_diag_addlsh1.asm
deleted file mode 100644
index f7aba33ee5..0000000000
--- a/gmp/mpn/powerpc32/sqr_diag_addlsh1.asm
+++ /dev/null
@@ -1,80 +0,0 @@
-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/gmp/mpn/powerpc32/sqr_diagonal.asm b/gmp/mpn/powerpc32/sqr_diagonal.asm
new file mode 100644
index 0000000000..d315349f63
--- /dev/null
+++ b/gmp/mpn/powerpc32/sqr_diagonal.asm
@@ -0,0 +1,103 @@
+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)
diff --git a/gmp/mpn/powerpc32/sublsh1_n.asm b/gmp/mpn/powerpc32/sublsh1_n.asm
index 6dc6460016..c8711d09a6 100644
--- a/gmp/mpn/powerpc32/sublsh1_n.asm
+++ b/gmp/mpn/powerpc32/sublsh1_n.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/submul_1.asm b/gmp/mpn/powerpc32/submul_1.asm
index 9fcdaa291b..ae40bb4473 100644
--- a/gmp/mpn/powerpc32/submul_1.asm
+++ b/gmp/mpn/powerpc32/submul_1.asm
@@ -5,30 +5,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/umul.asm b/gmp/mpn/powerpc32/umul.asm
index a5811e1651..400f009337 100644
--- a/gmp/mpn/powerpc32/umul.asm
+++ b/gmp/mpn/powerpc32/umul.asm
@@ -1,32 +1,21 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+dnl Copyright 2000, 2001 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/powerpc32/vmx/copyd.asm b/gmp/mpn/powerpc32/vmx/copyd.asm
index 6aac6b8389..e345eef01f 100644
--- a/gmp/mpn/powerpc32/vmx/copyd.asm
+++ b/gmp/mpn/powerpc32/vmx/copyd.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -48,7 +37,7 @@ C read-modify-write tricks.
C * The VMX code is used from the smallest sizes it handles, but measurements
C show a large speed bump at the cutoff points. Small copying (perhaps
C using some read-modify-write technique) should be optimized.
-C * Make a mpn_com based on this code.
+C * Make a mpn_com_n based on this code.
define(`GMP_LIMB_BYTES', eval(GMP_LIMB_BITS/8))
define(`LIMBS_PER_VR', eval(16/GMP_LIMB_BYTES))
diff --git a/gmp/mpn/powerpc32/vmx/copyi.asm b/gmp/mpn/powerpc32/vmx/copyi.asm
index a97a0fa6dc..b6b2e7ea8d 100644
--- a/gmp/mpn/powerpc32/vmx/copyi.asm
+++ b/gmp/mpn/powerpc32/vmx/copyi.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -48,7 +37,7 @@ C read-modify-write tricks.
C * The VMX code is used from the smallest sizes it handles, but measurements
C show a large speed bump at the cutoff points. Small copying (perhaps
C using some read-modify-write technique) should be optimized.
-C * Make a mpn_com based on this code.
+C * Make a mpn_com_n based on this code.
define(`GMP_LIMB_BYTES', eval(GMP_LIMB_BITS/8))
define(`LIMBS_PER_VR', eval(16/GMP_LIMB_BYTES))
diff --git a/gmp/mpn/powerpc32/vmx/logops_n.asm b/gmp/mpn/powerpc32/vmx/logops_n.asm
index d656d3b73f..7ed731e483 100644
--- a/gmp/mpn/powerpc32/vmx/logops_n.asm
+++ b/gmp/mpn/powerpc32/vmx/logops_n.asm
@@ -5,30 +5,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc32/vmx/mod_34lsub1.asm b/gmp/mpn/powerpc32/vmx/mod_34lsub1.asm
index 9b7e4f1a50..8aee6f81de 100644
--- a/gmp/mpn/powerpc32/vmx/mod_34lsub1.asm
+++ b/gmp/mpn/powerpc32/vmx/mod_34lsub1.asm
@@ -1,32 +1,21 @@
dnl PowerPC-32 mpn_mod_34lsub1 -- mpn remainder mod 2^24-1.
-dnl Copyright 2002, 2003, 2005-2007, 2012 Free Software Foundation, Inc.
+dnl Copyright 2002, 2003, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -146,15 +135,15 @@ L(large):
andi. r7, up, 15
vxor a0, v0, v0
- lis r9, 0xaaaa
+ lis r0, 0xaaaa
vxor a1, v0, v0
- ori r9, r9, 0xaaab
+ ori r0, r0, 0xaaab
vxor a2, v0, v0
li r5, 16
vxor c0, v0, v0
li r6, 32
vxor c1, v0, v0
- LEAL( r11, cnsts) C CAUTION clobbers r0 for elf, darwin
+ LEAL( r11, cnsts)
vxor c2, v0, v0
vxor z, v0, v0
@@ -169,7 +158,7 @@ L(large):
vsldoi a2, z, a2, 12
addi n, n, 9
- mulhwu r0, n, r9
+ mulhwu r0, n, r0
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0
@@ -185,7 +174,7 @@ L(na4): bne cr7, L(na8)
vsldoi a1, z, a1, 8
addi n, n, 6
- mulhwu r0, n, r9
+ mulhwu r0, n, r0
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0
@@ -199,7 +188,7 @@ L(na8):
vsldoi a0, z, a0, 4
addi n, n, 3
- mulhwu r0, n, r9
+ mulhwu r0, n, r0
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0
@@ -208,7 +197,7 @@ L(na8):
b L(0)
L(aligned16):
- mulhwu r0, n, r9
+ mulhwu r0, n, r0
srwi r0, r0, 3 C r0 = floor(n/12)
mtctr r0
diff --git a/gmp/mpn/powerpc32/vmx/popcount.asm b/gmp/mpn/powerpc32/vmx/popcount.asm
index 943c92d127..62fcaaee4a 100644
--- a/gmp/mpn/powerpc32/vmx/popcount.asm
+++ b/gmp/mpn/powerpc32/vmx/popcount.asm
@@ -3,32 +3,26 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
MULFUNC_PROLOGUE(mpn_popcount)
include_mpn(`powerpc64/vmx/popcount.asm')
+
+C cycles/limb
+C 7400,7410 (G4): 2.75
+C 744x,745x (G4+): 2.25
+C 970 (G5): 5.3
diff --git a/gmp/mpn/powerpc64/README b/gmp/mpn/powerpc64/README
index 50dd3995c3..757357b4d8 100644
--- a/gmp/mpn/powerpc64/README
+++ b/gmp/mpn/powerpc64/README
@@ -1,30 +1,19 @@
-Copyright 1999-2001, 2003-2005 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2003, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -124,7 +113,7 @@ Memory: 2 ld/st. Stores go to the L2 cache, which can sustain just
one store per cycle.
L1 load latency: to gregs 3-4 cycles, to fregs 5-6 cycles.
Operations that modify the address register might be split
- to use also an integer issue slot.
+ to use also a an integer issue slot.
Simple integer: 2 operations every cycle, latency 2.
Integer multiply: 2 operations every 6th cycle, latency 7 cycles.
Integer divide: ?
@@ -150,7 +139,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 cancellation. (Other part after given by
+and add well-chosen constants to get cancelation. (Other part after given by
subsequent subtraction.)
Possible code mix for load-via-intregs variant:
diff --git a/gmp/mpn/powerpc64/aix.m4 b/gmp/mpn/powerpc64/aix.m4
index bf6517d69d..589686a868 100644
--- a/gmp/mpn/powerpc64/aix.m4
+++ b/gmp/mpn/powerpc64/aix.m4
@@ -1,53 +1,42 @@
divert(-1)
dnl m4 macros for AIX 64-bit assembly.
-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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+dnl Copyright 2000, 2001, 2002, 2005, 2006 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`ASM_START',
- `.machine "any"
+ `.machine "ppc64"
.toc')
-dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
+dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
dnl
dnl Don't want ELF style .size in the epilogue.
define(`PROLOGUE_cpu',
-m4_assert_numargs_range(1,2)
-`ifelse(`$2',toc,,
-`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
+m4_assert_numargs(1)
+ `
.globl $1
.globl .$1
.csect [DS], 3
$1:
.llong .$1, TOC[tc0], 0
- .csect .$1[PR], 6
+ .csect [PR]
+ .align 4
.$1:')
define(`EPILOGUE_cpu',
@@ -92,6 +81,4 @@ define(`CALL',
define(`ASM_END', `TOC_ENTRY')
-undefine(`EXTRA_REGISTER')
-
divert
diff --git a/gmp/mpn/powerpc64/com.asm b/gmp/mpn/powerpc64/com.asm
deleted file mode 100644
index 074b7ff6e4..0000000000
--- a/gmp/mpn/powerpc64/com.asm
+++ /dev/null
@@ -1,136 +0,0 @@
-dnl PowerPC-64 mpn_com.
-
-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 1.25
-C POWER5 ?
-C POWER6 1.32
-C POWER7 1.13
-
-C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`n', `r5')
-
-ASM_START()
-PROLOGUE(mpn_com)
-
-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
- nor r6, r6, r6
- 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, 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()
diff --git a/gmp/mpn/powerpc64/com_n.asm b/gmp/mpn/powerpc64/com_n.asm
new file mode 100644
index 0000000000..0c43d06cfe
--- /dev/null
+++ b/gmp/mpn/powerpc64/com_n.asm
@@ -0,0 +1,74 @@
+dnl PowerPC-64 mpn_com_n.
+
+dnl Copyright 2003, 2004, 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 POWER3/PPC630: 1?
+C POWER4/PPC970: 1.6
+
+C TODO
+C * 8-way unrolling brings timing down to about 1.3 cycles/limb.
+
+C INPUT PARAMETERS
+C rp r3
+C up r4
+C n r5
+
+ASM_START()
+PROLOGUE(mpn_com_n)
+ 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
+
+ add r4, r4, r0 C offset up
+ add r3, r3, r0 C offset rp
+
+ beq cr0, L(L00)
+ blt cr6, L(L01)
+ beq cr6, L(L10)
+ b L(L11)
+
+L(L00): addi r4, r4, 32
+ addi r3, r3, 32
+
+ ALIGN(16)
+L(oop): ld r6, -32(r4)
+ nor r6, r6, r6
+ std r6, -32(r3)
+L(L11): ld r6, -24(r4)
+ 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)
+
+ blr
+EPILOGUE()
diff --git a/gmp/mpn/powerpc64/copyd.asm b/gmp/mpn/powerpc64/copyd.asm
index c6ce9309f1..6a46a433c9 100644
--- a/gmp/mpn/powerpc64/copyd.asm
+++ b/gmp/mpn/powerpc64/copyd.asm
@@ -3,39 +3,25 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1
-C POWER4/PPC970 1
-C POWER5 ?
-C POWER6 ?
-C POWER7 1.4
+C cycles/limb
+C POWER3/PPC630: 1
+C POWER4/PPC970: 1
C INPUT PARAMETERS
C rp r3
diff --git a/gmp/mpn/powerpc64/copyi.asm b/gmp/mpn/powerpc64/copyi.asm
index 9a86cb21cc..5cb7e48565 100644
--- a/gmp/mpn/powerpc64/copyi.asm
+++ b/gmp/mpn/powerpc64/copyi.asm
@@ -3,39 +3,25 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1
-C POWER4/PPC970 1
-C POWER5 ?
-C POWER6 ?
-C POWER7 1.4
+C cycles/limb
+C POWER3/PPC630: 1
+C POWER4/PPC970: 1
C INPUT PARAMETERS
C rp r3
diff --git a/gmp/mpn/powerpc64/darwin.m4 b/gmp/mpn/powerpc64/darwin.m4
index a3180e48fd..10055be13a 100644
--- a/gmp/mpn/powerpc64/darwin.m4
+++ b/gmp/mpn/powerpc64/darwin.m4
@@ -2,48 +2,35 @@ divert(-1)
dnl m4 macros for Mac OS 64-bit assembly.
dnl Copyright 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`ASM_START',`')
-dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
+dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
dnl
define(`DARWIN')
define(`PROLOGUE_cpu',
-m4_assert_numargs_range(1,2)
-`ifelse(`$2',toc,,
-`ifelse(`$2',,,`m4_error(`Unrecognised PROLOGUE parameter')')')dnl
- .text
+m4_assert_numargs(1)
+` .text
.globl $1
- .align 5
+ .align 4
$1:')
define(`EPILOGUE_cpu',
@@ -114,6 +101,4 @@ define(`CALL',
define(`ASM_END', `dnl')
-define(`EXTRA_REGISTER', r2)
-
divert
diff --git a/gmp/mpn/powerpc64/elf.m4 b/gmp/mpn/powerpc64/elf.m4
index ddb5a8ed79..e6da11f90c 100644
--- a/gmp/mpn/powerpc64/elf.m4
+++ b/gmp/mpn/powerpc64/elf.m4
@@ -2,60 +2,31 @@ divert(-1)
dnl m4 macros for powerpc64 GNU/Linux assembly.
dnl Copyright 2003, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
-define(`ASM_START',
-`ifdef(`ELFv2_ABI',
-`
- .abiversion 2
-')')
+define(`ASM_START',`')
-dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo[,toc])
+dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
dnl EPILOGUE_cpu(GSYM_PREFIX`'foo)
dnl
define(`PROLOGUE_cpu',
-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
-',)
-',`
+m4_assert_numargs(1)
+ `
.globl $1
.globl .$1
.section ".opd","aw"
@@ -65,17 +36,12 @@ $1:
.size $1, 24
.type .$1, @function
.section ".text"
- .align 5
-.$1:
-')')
+ .align 4
+.$1:')
define(`EPILOGUE_cpu',
m4_assert_numargs(1)
-`ifdef(`ELFv2_ABI',`
- .size $1, .-$1
-',`
- .size .$1, .-.$1
-')')
+` .size .$1, .-.$1')
define(`TOC_ENTRY', `')
@@ -118,6 +84,4 @@ define(`CALL',
define(`ASM_END', `TOC_ENTRY')
-undefine(`EXTRA_REGISTER')
-
divert
diff --git a/gmp/mpn/powerpc64/gmp-mparam.h b/gmp/mpn/powerpc64/gmp-mparam.h
new file mode 100644
index 0000000000..e0ab478e3e
--- /dev/null
+++ b/gmp/mpn/powerpc64/gmp-mparam.h
@@ -0,0 +1,63 @@
+/* PowerPC-64 gmp-mparam.h -- Compiler/machine parameter header file.
+
+Copyright 1991, 1993, 1994, 1995, 1999, 2000, 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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+
+
+/* ???MHz ppc630 */
+
+/* Generated by tuneup.c, 2004-02-10, gcc "2.9" */
+
+#define MUL_KARATSUBA_THRESHOLD 8
+#define MUL_TOOM3_THRESHOLD 41
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_KARATSUBA_THRESHOLD 14
+#define SQR_TOOM3_THRESHOLD 48
+
+#define DIV_SB_PREINV_THRESHOLD 0
+#define DIV_DC_THRESHOLD 28
+#define POWM_THRESHOLD 40
+
+#define HGCD_THRESHOLD 56
+#define GCD_ACCEL_THRESHOLD 3
+#define GCD_DC_THRESHOLD 408
+#define JACOBI_BASE_METHOD 1
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define USE_PREINV_DIVREM_1 0
+#define USE_PREINV_MOD_1 1
+#define DIVREM_2_THRESHOLD 0 /* always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 22
+#define SET_STR_THRESHOLD 1815
+
+#define MUL_FFT_TABLE { 272, 544, 1344, 2304, 5120, 20480, 49152, 0 }
+#define MUL_FFT_MODF_THRESHOLD 216
+#define MUL_FFT_THRESHOLD 1408
+
+#define SQR_FFT_TABLE { 272, 608, 1344, 2304, 7168, 20480, 49152, 0 }
+#define SQR_FFT_MODF_THRESHOLD 200
+#define SQR_FFT_THRESHOLD 1408
diff --git a/gmp/mpn/powerpc64/logops_n.asm b/gmp/mpn/powerpc64/logops_n.asm
index 2fa6985d7a..917b59f455 100644
--- a/gmp/mpn/powerpc64/logops_n.asm
+++ b/gmp/mpn/powerpc64/logops_n.asm
@@ -1,42 +1,28 @@
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-2005 Free Software Foundation, Inc.
+dnl Copyright 2003, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1.75
-C POWER4/PPC970 2.10
-C POWER5 ?
-C POWER6 ?
-C POWER7 1.75
+C cycles/limb
+C POWER3/PPC630: 1.75
+C POWER4/PPC970: 2.10
C n POWER3/PPC630 POWER4/PPC970
C 1 15.00 15.33
diff --git a/gmp/mpn/powerpc64/lshift.asm b/gmp/mpn/powerpc64/lshift.asm
index 880944a4ae..41e5ddd8e5 100644
--- a/gmp/mpn/powerpc64/lshift.asm
+++ b/gmp/mpn/powerpc64/lshift.asm
@@ -1,207 +1,116 @@
dnl PowerPC-64 mpn_lshift -- rp[] = up[] << cnt
-dnl Copyright 2003, 2005, 2010, 2011 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
-include(`../config.m4')
+dnl You should have received 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 ?
-C POWER4/PPC970 ?
-C POWER5 2.25
-C POWER6 9.75
-C POWER7 2.15
+include(`../config.m4')
-C TODO
-C * Try to reduce the number of needed live registers
-C * Micro-optimise header code
-C * Keep in synch with rshift.asm and lshiftc.asm
+C cycles/limb
+C POWER3/PPC630: 1.5
+C POWER4/PPC970: 3.0
C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`n', `r5')
-define(`cnt', `r6')
+define(`rp',`r3')
+define(`up',`r4')
+define(`n',`r5')
+define(`cnt',`r6')
+
+define(`tnc',`r5')
+define(`v0',`r0')
+define(`v1',`r7')
+define(`u0',`r8')
+define(`u1',`r9')
+define(`h0',`r10')
+define(`h1',`r11')
-define(`tnc',`r0')
-define(`u0',`r30')
-define(`u1',`r31')
-define(`retval',`r5')
ASM_START()
PROLOGUE(mpn_lshift)
- std r31, -8(r1)
- std r30, -16(r1)
- subfic tnc, cnt, 64
- sldi r7, n, 3 C byte count corresponding to n
- add up, up, r7 C up = up + n
- add rp, rp, r7 C rp = rp + n
- rldicl. r30, n, 0,62 C r30 = n & 3, set cr0
- cmpdi cr6, r30, 2
- addi r31, n, 3 C compute count...
- ld r10, -8(up) C load 1st limb for b00...b11
- srd retval, r10, tnc
ifdef(`HAVE_ABI_mode32',
-` rldicl r31, r31, 62,34', C ...branch count
-` srdi r31, r31, 2') C ...for ctr
- mtctr r31 C copy count into ctr
- beq cr0, L(b00)
- blt cr6, L(b01)
- ld r11, -16(up) C load 2nd limb for b10 and b11
- beq cr6, L(b10)
-
- ALIGN(16)
-L(b11): sld r8, r10, cnt
- srd r9, r11, tnc
- ld u1, -24(up)
- addi up, up, -24
- sld r12, r11, cnt
- srd r7, u1, tnc
- addi rp, rp, 16
- bdnz L(gt3)
-
- or r11, r8, r9
- sld r8, u1, cnt
- b L(cj3)
-
- ALIGN(16)
-L(gt3): ld u0, -8(up)
- or r11, r8, r9
- sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -16(up)
- or r10, r12, r7
- b L(L11)
-
- ALIGN(32)
-L(b10): sld r12, r10, cnt
- addi rp, rp, 24
- srd r7, r11, tnc
- bdnz L(gt2)
-
- sld r8, r11, cnt
- or r10, r12, r7
- b L(cj2)
-
-L(gt2): ld u0, -24(up)
- sld r8, r11, cnt
- srd r9, u0, tnc
- ld u1, -32(up)
- or r10, r12, r7
- sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -40(up)
- or r11, r8, r9
- addi up, up, -16
- b L(L10)
-
- ALIGN(16)
-L(b00): ld u1, -16(up)
- sld r12, r10, cnt
- srd r7, u1, tnc
- ld u0, -24(up)
- sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -32(up)
- or r10, r12, r7
- sld r12, u0, cnt
- srd r7, u1, tnc
- addi rp, rp, 8
- bdz L(cj4)
-
-L(gt4): addi up, up, -32
- ld u0, -8(up)
- or r11, r8, r9
- b L(L00)
-
- ALIGN(16)
-L(b01): bdnz L(gt1)
- sld r8, r10, cnt
- std r8, -8(rp)
- b L(ret)
-
-L(gt1): ld u0, -16(up)
- sld r8, r10, cnt
- srd r9, u0, tnc
- ld u1, -24(up)
- sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -32(up)
- or r11, r8, r9
- sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -40(up)
- addi up, up, -40
- or r10, r12, r7
- bdz L(end)
-
- ALIGN(32)
-L(top): sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -8(up)
- std r11, -8(rp)
- or r11, r8, r9
-L(L00): sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -16(up)
- std r10, -16(rp)
- or r10, r12, r7
-L(L11): sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -24(up)
- std r11, -24(rp)
- or r11, r8, r9
-L(L10): sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -32(up)
- addi up, up, -32
- std r10, -32(rp)
- addi rp, rp, -32
- or r10, r12, r7
- bdnz L(top)
-
- ALIGN(32)
-L(end): sld r12, u0, cnt
- srd r7, u1, tnc
- std r11, -8(rp)
-L(cj4): or r11, r8, r9
- sld r8, u1, cnt
- std r10, -16(rp)
-L(cj3): or r10, r12, r7
- std r11, -24(rp)
-L(cj2): std r10, -32(rp)
- std r8, -40(rp)
-
-L(ret): ld r31, -8(r1)
- ld r30, -16(r1)
+` rldicl r7, r5, 0, 32 C zero extend n
+ mtctr r7', C copy n to count register
+` mtctr n') C copy n to count register
+
+ifdef(`HAVE_ABI_mode32',
+` rldic r0, n, 3, 32', C byte count corresponding to n
+` rldicr r0, n, 3, 60') C byte count corresponding to n
+
+ add rp, rp, r0 C rp = rp + n
+ add up, up, r0 C up = up + n
+ addi rp, rp, 8 C rp now points 16 beyond end
+ addi up, up, -8 C up now points to last limb
+ subfic tnc, cnt, 64 C reverse shift count
+
+ ld u0, 0(up)
+ sld h0, u0, cnt
+ srd r12, u0, tnc C return value
+ bdz L(1) C jump for n = 1
+
+ ld u1, -8(up)
+ bdz L(2) C jump for n = 2
+
+ ldu u0, -16(up)
+ bdz L(end) C jump for n = 3
+
+L(oop): srd v1, u1, tnc
+ sld h1, u1, cnt
+ ld u1, -8(up)
+ or h0, v1, h0
+ stdu h0, -16(rp)
+
+ bdz L(exit)
+
+ srd v0, u0, tnc
+ sld h0, u0, cnt
+ ldu u0, -16(up)
+ or h1, v0, h1
+ std h1, -8(rp)
+
+ bdnz L(oop)
+
+L(end): srd v1, u1, tnc
+ sld h1, u1, cnt
+ or h0, v1, h0
+ stdu h0, -16(rp)
+ srd v0, u0, tnc
+ sld h0, u0, cnt
+ or h1, v0, h1
+ std h1, -8(rp)
+L(1): std h0, -16(rp)
+ifdef(`HAVE_ABI_mode32',
+` srdi r3, r12, 32
+ mr r4, r12
+',` mr r3, r12
+')
+ blr
+
+L(exit): srd v0, u0, tnc
+ sld h0, u0, cnt
+ or h1, v0, h1
+ std h1, -8(rp)
+L(2): srd v1, u1, tnc
+ sld h1, u1, cnt
+ or h0, v1, h0
+ stdu h0, -16(rp)
+ std h1, -8(rp)
ifdef(`HAVE_ABI_mode32',
-` srdi r3, retval, 32
- mr r4, retval
-',` mr r3, retval')
+` srdi r3, r12, 32
+ mr r4, r12
+',` mr r3, r12
+')
blr
EPILOGUE()
diff --git a/gmp/mpn/powerpc64/lshiftc.asm b/gmp/mpn/powerpc64/lshiftc.asm
deleted file mode 100644
index 7cf6a83428..0000000000
--- a/gmp/mpn/powerpc64/lshiftc.asm
+++ /dev/null
@@ -1,210 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 2.25
-C POWER6 9.5
-C POWER7 2.15
-
-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')
-define(`up', `r4')
-define(`n', `r5')
-define(`cnt', `r6')
-
-define(`tnc',`r0')
-define(`u0',`r30')
-define(`u1',`r31')
-define(`retval',`r5')
-
-ASM_START()
-PROLOGUE(mpn_lshiftc)
- std r31, -8(r1)
- std r30, -16(r1)
- subfic tnc, cnt, 64
- sldi r7, n, 3 C byte count corresponding to n
- add up, up, r7 C up = up + n
- add rp, rp, r7 C rp = rp + n
- rldicl. r30, n, 0,62 C r30 = n & 3, set cr0
- cmpdi cr6, r30, 2
- addi r31, n, 3 C compute count...
- ld r10, -8(up) C load 1st limb for b00...b11
- srd retval, r10, tnc
- srdi r31, r31, 2 C ...for ctr
- mtctr r31 C copy count into ctr
- beq cr0, L(b00)
- blt cr6, L(b01)
- ld r11, -16(up) C load 2nd limb for b10 and b11
- beq cr6, L(b10)
-
- ALIGN(16)
-L(b11): sld r8, r10, cnt
- srd r9, r11, tnc
- ld u1, -24(up)
- addi up, up, -24
- sld r12, r11, cnt
- srd r7, u1, tnc
- addi rp, rp, 16
- bdnz L(gt3)
-
- nor r11, r8, r9
- sld r8, u1, cnt
- nor r8, r8, r8
- b L(cj3)
-
- ALIGN(16)
-L(gt3): ld u0, -8(up)
- nor r11, r8, r9
- sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -16(up)
- nor r10, r12, r7
- b L(L11)
-
- ALIGN(32)
-L(b10): sld r12, r10, cnt
- addi rp, rp, 24
- srd r7, r11, tnc
- bdnz L(gt2)
-
- sld r8, r11, cnt
- nor r10, r12, r7
- nor r8, r8, r8
- b L(cj2)
-
-L(gt2): ld u0, -24(up)
- sld r8, r11, cnt
- srd r9, u0, tnc
- ld u1, -32(up)
- nor r10, r12, r7
- sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -40(up)
- nor r11, r8, r9
- addi up, up, -16
- b L(L10)
-
- ALIGN(16)
-L(b00): ld u1, -16(up)
- sld r12, r10, cnt
- srd r7, u1, tnc
- ld u0, -24(up)
- sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -32(up)
- nor r10, r12, r7
- sld r12, u0, cnt
- srd r7, u1, tnc
- addi rp, rp, 8
- bdz L(cj4)
-
-L(gt4): addi up, up, -32
- ld u0, -8(up)
- nor r11, r8, r9
- b L(L00)
-
- ALIGN(16)
-L(b01): bdnz L(gt1)
- sld r8, r10, cnt
- nor r8, r8, r8
- std r8, -8(rp)
- b L(ret)
-
-L(gt1): ld u0, -16(up)
- sld r8, r10, cnt
- srd r9, u0, tnc
- ld u1, -24(up)
- sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -32(up)
- nor r11, r8, r9
- sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -40(up)
- addi up, up, -40
- nor r10, r12, r7
- bdz L(end)
-
- ALIGN(32)
-L(top): sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -8(up)
- std r11, -8(rp)
- nor r11, r8, r9
-L(L00): sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -16(up)
- std r10, -16(rp)
- nor r10, r12, r7
-L(L11): sld r12, u0, cnt
- srd r7, u1, tnc
- ld u0, -24(up)
- std r11, -24(rp)
- nor r11, r8, r9
-L(L10): sld r8, u1, cnt
- srd r9, u0, tnc
- ld u1, -32(up)
- addi up, up, -32
- std r10, -32(rp)
- addi rp, rp, -32
- nor r10, r12, r7
- bdnz L(top)
-
- ALIGN(32)
-L(end): sld r12, u0, cnt
- srd r7, u1, tnc
- std r11, -8(rp)
-L(cj4): nor r11, r8, r9
- sld r8, u1, cnt
- std r10, -16(rp)
- nor r8, r8, r8
-L(cj3): nor r10, r12, r7
- std r11, -24(rp)
-L(cj2): std r10, -32(rp)
- std r8, -40(rp)
-
-L(ret): ld r31, -8(r1)
- ld r30, -16(r1)
-ifdef(`HAVE_ABI_mode32',
-` srdi r3, retval, 32
- mr r4, retval
-',` mr r3, retval')
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode32/add_n.asm b/gmp/mpn/powerpc64/mode32/add_n.asm
index 1da8087fe1..4c62041e73 100644
--- a/gmp/mpn/powerpc64/mode32/add_n.asm
+++ b/gmp/mpn/powerpc64/mode32/add_n.asm
@@ -1,33 +1,22 @@
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-2001, 2003, 2005 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc64/mode32/addmul_1.asm b/gmp/mpn/powerpc64/mode32/addmul_1.asm
index bdc39512ac..41a90781a5 100644
--- a/gmp/mpn/powerpc64/mode32/addmul_1.asm
+++ b/gmp/mpn/powerpc64/mode32/addmul_1.asm
@@ -1,33 +1,22 @@
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-2001, 2003, 2005 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc64/mode32/mul_1.asm b/gmp/mpn/powerpc64/mode32/mul_1.asm
index 3a17e98797..091be4d272 100644
--- a/gmp/mpn/powerpc64/mode32/mul_1.asm
+++ b/gmp/mpn/powerpc64/mode32/mul_1.asm
@@ -1,33 +1,22 @@
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-2001, 2003, 2005 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc64/mode32/p4/gmp-mparam.h b/gmp/mpn/powerpc64/mode32/p4/gmp-mparam.h
deleted file mode 100644
index a7271381c5..0000000000
--- a/gmp/mpn/powerpc64/mode32/p4/gmp-mparam.h
+++ /dev/null
@@ -1,173 +0,0 @@
-/* PowerPC-64 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/* 1800 MHz PPC970 */
-
-#define DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 6
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 46
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 14
-#define USE_PREINV_DIVREM_1 1
-#define DIV_QR_2_PI2_THRESHOLD 12
-#define DIVEXACT_1_THRESHOLD 0 /* always */
-#define BMOD_1_TO_MOD_1_THRESHOLD 90
-
-#define MUL_TOOM22_THRESHOLD 16
-#define MUL_TOOM33_THRESHOLD 57
-#define MUL_TOOM44_THRESHOLD 94
-#define MUL_TOOM6H_THRESHOLD 125
-#define MUL_TOOM8H_THRESHOLD 187
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 99
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 61
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 56
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 70
-
-#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 98
-#define SQR_TOOM4_THRESHOLD 136
-#define SQR_TOOM6_THRESHOLD 180
-#define SQR_TOOM8_THRESHOLD 272
-
-#define MULMID_TOOM42_THRESHOLD 34
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 13
-
-#define MUL_FFT_MODF_THRESHOLD 244 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 244, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 15, 7}, { 8, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 20, 8}, { 11, 7}, { 23, 8}, \
- { 13, 7}, { 29, 8}, { 19, 9}, { 11, 8}, \
- { 27,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
- { 19, 8}, { 39, 9}, { 23, 8}, { 47, 9}, \
- { 27,10}, { 15, 9}, { 39,10}, { 23, 9}, \
- { 47,11}, { 15,10}, { 31, 9}, { 67,10}, \
- { 39, 9}, { 83,10}, { 47, 9}, { 95, 8}, \
- { 191, 9}, { 99,10}, { 55,11}, { 31,10}, \
- { 63, 9}, { 127, 8}, { 255,10}, { 71, 9}, \
- { 143, 8}, { 287,10}, { 79, 9}, { 159, 8}, \
- { 319,11}, { 47,10}, { 95, 9}, { 191, 8}, \
- { 383,10}, { 103,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
- { 287,11}, { 79,10}, { 159, 9}, { 319, 8}, \
- { 639,10}, { 175, 9}, { 351, 8}, { 703,11}, \
- { 95,10}, { 191, 9}, { 383, 8}, { 767,10}, \
- { 207, 9}, { 415,10}, { 223, 9}, { 447,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
- { 143,10}, { 287, 9}, { 575, 8}, { 1151,11}, \
- { 159,10}, { 319, 9}, { 639,11}, { 175,10}, \
- { 351, 9}, { 703,12}, { 95,11}, { 191,10}, \
- { 383, 9}, { 767,11}, { 207,10}, { 415, 9}, \
- { 831,11}, { 223,10}, { 447,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 106
-#define MUL_FFT_THRESHOLD 2688
-
-#define SQR_FFT_MODF_THRESHOLD 212 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 212, 5}, { 13, 6}, { 15, 7}, { 8, 6}, \
- { 17, 7}, { 9, 6}, { 19, 7}, { 13, 8}, \
- { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
- { 11, 7}, { 23, 8}, { 13, 7}, { 27, 9}, \
- { 7, 8}, { 21, 9}, { 11, 8}, { 25,10}, \
- { 7, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 67,10}, { 39, 9}, { 79, 8}, { 159,10}, \
- { 47, 9}, { 95, 8}, { 191,11}, { 31,10}, \
- { 63, 9}, { 127, 8}, { 255,10}, { 71, 9}, \
- { 143, 8}, { 287,10}, { 79, 9}, { 159, 8}, \
- { 319,11}, { 47, 9}, { 191, 8}, { 383,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255, 8}, \
- { 511,10}, { 143, 9}, { 287, 8}, { 575,11}, \
- { 79,10}, { 159, 9}, { 319, 8}, { 639,10}, \
- { 175, 9}, { 351, 8}, { 703,10}, { 191, 9}, \
- { 383, 8}, { 767,10}, { 207, 9}, { 415,11}, \
- { 111,10}, { 223,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,11}, { 143,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 319, 9}, { 639,11}, \
- { 175,10}, { 351, 9}, { 703, 8}, { 1407,11}, \
- { 191,10}, { 383, 9}, { 767,11}, { 207,10}, \
- { 415,11}, { 223,10}, { 447,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 102
-#define SQR_FFT_THRESHOLD 1984
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 55
-#define MULLO_MUL_N_THRESHOLD 5240
-
-#define DC_DIV_QR_THRESHOLD 27
-#define DC_DIVAPPR_Q_THRESHOLD 108
-#define DC_BDIV_QR_THRESHOLD 51
-#define DC_BDIV_Q_THRESHOLD 126
-
-#define INV_MULMOD_BNM1_THRESHOLD 38
-#define INV_NEWTON_THRESHOLD 129
-#define INV_APPR_THRESHOLD 116
-
-#define BINV_NEWTON_THRESHOLD 198
-#define REDC_1_TO_REDC_N_THRESHOLD 51
-
-#define MU_DIV_QR_THRESHOLD 807
-#define MU_DIVAPPR_Q_THRESHOLD 807
-#define MUPI_DIV_QR_THRESHOLD 54
-#define MU_BDIV_QR_THRESHOLD 748
-#define MU_BDIV_Q_THRESHOLD 872
-
-#define POWM_SEC_TABLE 4,35,152,780,2145
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 104
-#define HGCD_APPR_THRESHOLD 118
-#define HGCD_REDUCE_THRESHOLD 1329
-#define GCD_DC_THRESHOLD 268
-#define GCDEXT_DC_THRESHOLD 241
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 9
-#define GET_STR_PRECOMPUTE_THRESHOLD 18
-#define SET_STR_DC_THRESHOLD 996
-#define SET_STR_PRECOMPUTE_THRESHOLD 2170
-
-#define FAC_DSC_THRESHOLD 442
-#define FAC_ODD_THRESHOLD 26
diff --git a/gmp/mpn/powerpc64/mode32/sqr_diagonal.asm b/gmp/mpn/powerpc64/mode32/sqr_diagonal.asm
deleted file mode 100644
index ff5f4b3cfb..0000000000
--- a/gmp/mpn/powerpc64/mode32/sqr_diagonal.asm
+++ /dev/null
@@ -1,117 +0,0 @@
-dnl PowerPC-64 mpn_sqr_diagonal.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 18
-C POWER4/PPC970 ?
-C POWER5 7.25
-C POWER6 9.5
-
-C INPUT PARAMETERS
-define(`rp', r3)
-define(`up', r4)
-define(`n', r5)
-
-ASM_START()
-PROLOGUE(mpn_sqr_diagonal)
-ifdef(`HAVE_ABI_mode32',
-` rldicl n, n, 0, 32') C zero extend n
-
- rldicl. r0, n, 0,62 C r0 = n & 3, set cr0
- addi n, n, 3 C compute count...
- cmpdi cr6, r0, 2
- 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 r0, 0(up)
- ld r10, 8(up)
- ld r12, 16(up)
- addi rp, rp, -16
- mulld r7, r0, r0
- mulhdu r8, r0, r0
- mulld r9, r10, r10
- mulhdu r10, r10, r10
- mulld r11, r12, r12
- mulhdu r12, r12, r12
- addi up, up, 24
- b L(11)
-
- ALIGN(16)
-L(b01): ld r0, 0(up)
- addi rp, rp, -48
- addi up, up, 8
- mulld r11, r0, r0
- mulhdu r12, r0, r0
- b L(01)
-
- ALIGN(16)
-L(b10): ld r0, 0(up)
- ld r12, 8(up)
- addi rp, rp, -32
- addi up, up, 16
- mulld r9, r0, r0
- mulhdu r10, r0, r0
- mulld r11, r12, r12
- mulhdu r12, r12, r12
- b L(10)
-
- ALIGN(32)
-L(b00):
-L(top): ld r0, 0(up)
- ld r8, 8(up)
- ld r10, 16(up)
- ld r12, 24(up)
- mulld r5, r0, r0
- mulhdu r6, r0, r0
- mulld r7, r8, r8
- mulhdu r8, r8, r8
- mulld r9, r10, r10
- mulhdu r10, r10, r10
- mulld r11, r12, r12
- mulhdu r12, r12, r12
- addi up, up, 32
- std r5, 0(rp)
- std r6, 8(rp)
-L(11): std r7, 16(rp)
- std r8, 24(rp)
-L(10): std r9, 32(rp)
- std r10, 40(rp)
-L(01): std r11, 48(rp)
- std r12, 56(rp)
- addi rp, rp, 64
- bdnz L(top)
-
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode32/sub_n.asm b/gmp/mpn/powerpc64/mode32/sub_n.asm
index 6fdc1d4719..5bcc4a47b5 100644
--- a/gmp/mpn/powerpc64/mode32/sub_n.asm
+++ b/gmp/mpn/powerpc64/mode32/sub_n.asm
@@ -1,33 +1,22 @@
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-2001, 2003, 2005 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc64/mode32/submul_1.asm b/gmp/mpn/powerpc64/mode32/submul_1.asm
index 22601c417e..44ac326994 100644
--- a/gmp/mpn/powerpc64/mode32/submul_1.asm
+++ b/gmp/mpn/powerpc64/mode32/submul_1.asm
@@ -1,33 +1,22 @@
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-2001, 2003, 2005 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/powerpc64/mode64/addlsh1_n.asm b/gmp/mpn/powerpc64/mode64/addlsh1_n.asm
new file mode 100644
index 0000000000..15182e1024
--- /dev/null
+++ b/gmp/mpn/powerpc64/mode64/addlsh1_n.asm
@@ -0,0 +1,82 @@
+dnl PowerPC-64 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
+
+dnl Copyright 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 POWER3/PPC630: 2 (1.5 c/l should be possible)
+C POWER4/PPC970: 4 (2.0 c/l should be possible)
+
+C INPUT PARAMETERS
+C rp r3
+C up r4
+C vp r5
+C n r6
+
+define(`rp',`r3')
+define(`up',`r4')
+define(`vp',`r5')
+
+define(`s0',`r6')
+define(`s1',`r7')
+define(`u0',`r8')
+define(`v0',`r10')
+define(`v1',`r11')
+
+ASM_START()
+PROLOGUE(mpn_addlsh1_n)
+ mtctr r6 C copy n in ctr
+ addic r31, r31, 0 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, 1
+ bdz L(end) C If done, skip loop
+
+L(oop): ld v1, 8(vp) C load v limb
+ adde s1, s1, u0 C add limbs with cy, set cy
+ std s1, 8(rp) C store result limb
+ srdi s0, v0, 63 C shift down previous v limb
+ ldu u0, 16(up) C load u limb and update up
+ rldimi s0, v1, 1, 0 C left shift v limb and merge with prev v limb
+
+ bdz L(exit) C decrement ctr and exit if done
+
+ ldu v0, 16(vp) C load v limb and update vp
+ adde s0, s0, u0 C add limbs with cy, set cy
+ stdu s0, 16(rp) C store result limb and update rp
+ srdi s1, v1, 63 C shift down previous v limb
+ ld u0, 8(up) C load u limb
+ rldimi s1, v0, 1, 0 C left shift v limb and merge with prev v limb
+
+ bdnz L(oop) C decrement ctr and loop back
+
+L(end): adde r7, s1, u0
+ std r7, 8(rp) C store last result limb
+ srdi r3, v0, 63
+ addze r3, r3
+ blr
+L(exit): adde r7, s0, u0
+ std r7, 16(rp) C store last result limb
+ srdi r3, v1, 63
+ addze r3, r3
+ blr
+EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/addmul_1.asm b/gmp/mpn/powerpc64/mode64/addmul_1.asm
new file mode 100644
index 0000000000..cadab3adf8
--- /dev/null
+++ b/gmp/mpn/powerpc64/mode64/addmul_1.asm
@@ -0,0 +1,185 @@
+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, 2004, 2005, 2006 Free Software
+dnl 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: 6-18
+C POWER4/PPC970: 8
+C POWER5: 8
+
+C TODO
+C * Reduce the number of registers used. Some mul destination registers could
+C be coalesced.
+C * Delay std for preserving registers, and suppress them for n=1.
+C * Write faster feed-in code. If nothing else, avoid one or two up updates.
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5')
+define(`vl', `r6')
+
+ASM_START()
+PROLOGUE(mpn_addmul_1)
+ std r31, -8(r1)
+ std r30, -16(r1)
+ std r29, -24(r1)
+ std r28, -32(r1)
+ std r27, -40(r1)
+ std r26, -48(r1)
+
+ 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 r26, 0(up)
+ ld r28, 0(rp)
+ addi up, up, 8
+ nop
+ mulld r0, r26, r6
+ mulhdu r12, r26, r6
+ addc r0, r0, r28
+ std r0, 0(rp)
+ addi rp, rp, 8
+ b L(fic)
+
+L(b00): ld r26, 0(up)
+ ld r27, 8(up)
+ ld r28, 0(rp)
+ ld r29, 8(rp)
+ addi up, up, 16
+ nop
+ mulld r0, r26, r6
+ mulhdu r5, r26, r6
+ mulld r7, r27, r6
+ mulhdu r8, r27, r6
+ addc r7, r7, r5
+ addze r12, r8
+ addc r0, r0, r28
+ std r0, 0(rp)
+ adde r7, r7, r29
+ std r7, 8(rp)
+ addi rp, rp, 16
+ b L(fic)
+
+L(b01): bdnz L(gt1)
+ ld r26, 0(up)
+ ld r28, 0(rp)
+ mulld r0, r26, r6
+ mulhdu r8, r26, r6
+ addc r0, r0, r28
+ std r0, 0(rp)
+ b L(ret)
+L(gt1): ld r26, 0(up)
+ ld r27, 8(up)
+ mulld r0, r26, r6
+ mulhdu r5, r26, r6
+ ld r26, 16(up)
+ ld r28, 0(rp)
+ mulld r7, r27, r6
+ mulhdu r8, r27, r6
+ ld r29, 8(rp)
+ ld r30, 16(rp)
+ mulld r9, r26, r6
+ mulhdu r10, r26, r6
+ addc r7, r7, r5
+ adde r9, r9, r8
+ addze r12, r10
+ addc r0, r0, r28
+ std r0, 0(rp)
+ adde r7, r7, r29
+ std r7, 8(rp)
+ adde r9, r9, r30
+ std r9, 16(rp)
+ addi up, up, 24
+ addi rp, rp, 24
+ b L(fic)
+
+L(b10): addic r0, r0, 0
+ li r12, 0 C cy_limb = 0
+L(fic): ld r26, 0(up)
+ ld r27, 8(up)
+ addi up, up, 16
+ bdz L(end)
+ C registers dying
+L(top): mulld r0, r26, r6 C
+ mulhdu r5, r26, r6 C 26
+ ld r26, 0(up) C
+ ld r28, 0(rp) C
+ mulld r7, r27, r6 C
+ mulhdu r8, r27, r6 C 27
+ ld r27, 8(up) C
+ ld r29, 8(rp) C
+ adde r0, r0, r12 C 0 12
+ adde r7, r7, r5 C 5 7
+ mulld r9, r26, r6 C
+ mulhdu r10, r26, r6 C 26
+ ld r26, 16(up) C
+ ld r30, 16(rp) C
+ mulld r11, r27, r6 C
+ mulhdu r12, r27, r6 C 27
+ ld r27, 24(up) C
+ ld r31, 24(rp) C
+ adde r9, r9, r8 C 8 9
+ adde r11, r11, r10 C 10 11
+ addze r12, r12 C 12
+ addc r0, r0, r28 C 0 28
+ std r0, 0(rp) C 0
+ adde r7, r7, r29 C 7 29
+ std r7, 8(rp) C 7
+ adde r9, r9, r30 C 9 30
+ std r9, 16(rp) C 9
+ adde r11, r11, r31 C 11 31
+ std r11, 24(rp) C 11
+ addi up, up, 32 C
+ addi rp, rp, 32 C
+ bdnz L(top) C
+
+L(end): mulld r0, r26, r6
+ mulhdu r5, r26, r6
+ ld r28, 0(rp)
+ nop
+ mulld r7, r27, r6
+ mulhdu r8, r27, r6
+ ld r29, 8(rp)
+ nop
+ adde r0, r0, r12
+ adde r7, r7, r5
+ addze r8, r8
+ addc r0, r0, r28
+ std r0, 0(rp)
+ adde r7, r7, r29
+ std r7, 8(rp)
+L(ret): addze r3, r8
+ ld r31, -8(r1)
+ ld r30, -16(r1)
+ ld r29, -24(r1)
+ ld r28, -32(r1)
+ ld r27, -40(r1)
+ ld r26, -48(r1)
+ blr
+EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/aors_n.asm b/gmp/mpn/powerpc64/mode64/aors_n.asm
index 0e8474fdcc..42b6d79472 100644
--- a/gmp/mpn/powerpc64/mode64/aors_n.asm
+++ b/gmp/mpn/powerpc64/mode64/aors_n.asm
@@ -1,41 +1,56 @@
dnl PowerPC-64 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
-dnl Copyright 1999-2001, 2003-2005, 2007, 2011 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2007 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1.5
-C POWER4/PPC970 2
-C POWER5 2
-C POWER6 2.63
-C POWER7 2.25-2.87
+C cycles/limb
+C POWER3/PPC630: 1.5
+C POWER4/PPC970: 2
+
+C n POWER3/PPC630 POWER4/PPC970
+C 1 17.00 19.00
+C 2 9.00 10.49
+C 3 5.33 7.66
+C 4 4.50 5.14
+C 5 4.20 4.80
+C 6 3.83 4.33
+C 7 3.00 3.99
+C 8 2.87 3.55
+C 9 2.89 3.40
+C 10 2.60 3.42
+C 11 2.45 3.15
+C 12 2.41 2.99
+C 13 2.46 3.01
+C 14 2.42 2.97
+C 15 2.20 2.85
+C 50 1.78 2.44
+C 100 1.83 2.20
+C 200 1.55 2.12
+C 400 1.53 2.05
+C 1000 1.98 2.02#
+C 2000 1.50# 2.04
+C 4000 2.55 2.50
+C 8000 2.70 2.45
+C 16000 2.65 5.94
+C 32000 2.62 16.41
+C 64000 2.73 18.94
C This code is a little bit slower for POWER3/PPC630 than the simple code used
C previously, but it is much faster for POWER4/PPC970. The reason for the
@@ -147,8 +162,7 @@ L(go): ld r6, 0(r4) C load s1 limb
addi r4, r4, 32
addi r5, r5, 32
- ALIGN(16)
-L(top): ADDSUBC r28, r7, r6
+L(oop): ADDSUBC r28, r7, r6
ld r6, 0(r4) C load s1 limb
ld r7, 0(r5) C load s2 limb
ADDSUBC r29, r9, r8
@@ -167,7 +181,7 @@ L(top): ADDSUBC r28, r7, r6
std r30, 16(r3)
std r31, 24(r3)
addi r3, r3, 32
- bdnz L(top) C decrement ctr and loop back
+ bdnz L(oop) C decrement ctr and loop back
L(end): ADDSUBC r28, r7, r6
ADDSUBC r29, r9, r8
diff --git a/gmp/mpn/powerpc64/mode64/aorsmul_1.asm b/gmp/mpn/powerpc64/mode64/aorsmul_1.asm
deleted file mode 100644
index 0c12f9b660..0000000000
--- a/gmp/mpn/powerpc64/mode64/aorsmul_1.asm
+++ /dev/null
@@ -1,225 +0,0 @@
-dnl PowerPC-64 mpn_addmul_1 and mpn_submul_1.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 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
-C * Add support for _1c entry points
-
-C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`n', `r5')
-define(`vl', `r6')
-
-ifdef(`OPERATION_addmul_1',`
- define(ADDSUBC, adde)
- define(ADDSUB, addc)
- define(func, mpn_addmul_1)
- define(func_nc, mpn_addmul_1c) C FIXME: not really supported
- define(SM, `')
-')
-ifdef(`OPERATION_submul_1',`
- define(ADDSUBC, subfe)
- define(ADDSUB, subfc)
- define(func, mpn_submul_1)
- define(func_nc, mpn_submul_1c) C FIXME: not really supported
- define(SM, `$1')
-')
-
-MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
-
-ASM_START()
-PROLOGUE(func)
- std r31, -8(r1)
- rldicl. r0, n, 0,62 C r0 = n & 3, set cr0
- std r30, -16(r1)
- cmpdi cr6, r0, 2
- std r29, -24(r1)
- addi n, n, 3 C compute count...
- std r28, -32(r1)
- srdi n, n, 2 C ...for ctr
- std r27, -40(r1)
- mtctr n C copy count into ctr
- beq cr0, L(b00)
- blt cr6, L(b01)
- beq cr6, L(b10)
-
-L(b11): ld r9, 0(up)
- ld r28, 0(rp)
- mulld r0, r9, r6
- mulhdu r12, r9, r6
- ADDSUB r0, r0, r28
- std r0, 0(rp)
- addi rp, rp, 8
- ld r9, 8(up)
- ld r27, 16(up)
- addi up, up, 24
-SM(` subfe r11, r11, r11 ')
- b L(bot)
-
- ALIGN(16)
-L(b00): ld r9, 0(up)
- ld r27, 8(up)
- ld r28, 0(rp)
- ld r29, 8(rp)
- mulld r0, r9, r6
- mulhdu r5, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- addc r7, r7, r5
- addze r12, r8
- ADDSUB r0, r0, r28
- std r0, 0(rp)
- ADDSUBC r7, r7, r29
- std r7, 8(rp)
- addi rp, rp, 16
- ld r9, 16(up)
- ld r27, 24(up)
- addi up, up, 32
-SM(` subfe r11, r11, r11 ')
- b L(bot)
-
- ALIGN(16)
-L(b01): bdnz L(gt1)
- ld r9, 0(up)
- ld r11, 0(rp)
- mulld r0, r9, r6
- mulhdu r8, r9, r6
- ADDSUB r0, r0, r11
- std r0, 0(rp)
-SM(` subfe r11, r11, r11 ')
-SM(` addic r11, r11, 1 ')
- addze r3, r8
- blr
-L(gt1): ld r9, 0(up)
- ld r27, 8(up)
- mulld r0, r9, r6
- mulhdu r5, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r9, 16(up)
- ld r28, 0(rp)
- ld r29, 8(rp)
- ld r30, 16(rp)
- mulld r11, r9, r6
- mulhdu r10, r9, r6
- addc r7, r7, r5
- adde r11, r11, r8
- addze r12, r10
- ADDSUB r0, r0, r28
- std r0, 0(rp)
- ADDSUBC r7, r7, r29
- std r7, 8(rp)
- ADDSUBC r11, r11, r30
- std r11, 16(rp)
- addi rp, rp, 24
- ld r9, 24(up)
- ld r27, 32(up)
- addi up, up, 40
-SM(` subfe r11, r11, r11 ')
- b L(bot)
-
-L(b10): addic r0, r0, 0
- li r12, 0 C cy_limb = 0
- ld r9, 0(up)
- ld r27, 8(up)
- bdz L(end)
- addi up, up, 16
-
- ALIGN(16)
-L(top): mulld r0, r9, r6
- mulhdu r5, r9, r6 C 9
- mulld r7, r27, r6
- mulhdu r8, r27, r6 C 27
- ld r9, 0(up)
- ld r28, 0(rp)
- ld r27, 8(up)
- ld r29, 8(rp)
- adde r0, r0, r12 C 0 12
- adde r7, r7, r5 C 5 7
- mulld r5, r9, r6
- mulhdu r10, r9, r6 C 9
- mulld r11, r27, r6
- mulhdu r12, r27, r6 C 27
- ld r9, 16(up)
- ld r30, 16(rp)
- ld r27, 24(up)
- ld r31, 24(rp)
- adde r5, r5, r8 C 8 5
- adde r11, r11, r10 C 10 11
- addze r12, r12 C 12
- ADDSUB r0, r0, r28 C 0 28
- std r0, 0(rp) C 0
- ADDSUBC r7, r7, r29 C 7 29
- std r7, 8(rp) C 7
- ADDSUBC r5, r5, r30 C 5 30
- std r5, 16(rp) C 5
- ADDSUBC r11, r11, r31 C 11 31
- std r11, 24(rp) C 11
- addi up, up, 32
-SM(` subfe r11, r11, r11 ')
- addi rp, rp, 32
-L(bot):
-SM(` addic r11, r11, 1 ')
- bdnz L(top)
-
-L(end): mulld r0, r9, r6
- mulhdu r5, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r28, 0(rp)
- ld r29, 8(rp)
- adde r0, r0, r12
- adde r7, r7, r5
- addze r8, r8
- ADDSUB r0, r0, r28
- std r0, 0(rp)
- ADDSUBC r7, r7, r29
- std r7, 8(rp)
-SM(` subfe r11, r11, r11 ')
-SM(` addic r11, r11, 1 ')
- addze r3, r8
- 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/gmp/mpn/powerpc64/mode64/aorsorrlsh1_n.asm b/gmp/mpn/powerpc64/mode64/aorsorrlsh1_n.asm
deleted file mode 100644
index 2c5400ab52..0000000000
--- a/gmp/mpn/powerpc64/mode64/aorsorrlsh1_n.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/aorsorrlsh2_n.asm b/gmp/mpn/powerpc64/mode64/aorsorrlsh2_n.asm
deleted file mode 100644
index 447791abb0..0000000000
--- a/gmp/mpn/powerpc64/mode64/aorsorrlsh2_n.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/aorsorrlshC_n.asm b/gmp/mpn/powerpc64/mode64/aorsorrlshC_n.asm
deleted file mode 100644
index 6158f541fc..0000000000
--- a/gmp/mpn/powerpc64/mode64/aorsorrlshC_n.asm
+++ /dev/null
@@ -1,187 +0,0 @@
-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()
diff --git a/gmp/mpn/powerpc64/mode64/bdiv_dbm1c.asm b/gmp/mpn/powerpc64/mode64/bdiv_dbm1c.asm
index 45cded9715..8c1e87e1ee 100644
--- a/gmp/mpn/powerpc64/mode64/bdiv_dbm1c.asm
+++ b/gmp/mpn/powerpc64/mode64/bdiv_dbm1c.asm
@@ -1,41 +1,28 @@
dnl PPC64 mpn_bdiv_dbm1c.
-dnl Copyright 2008, 2010 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 6-18
-C POWER4/PPC970 8.25
-C POWER5 8.5 fluctuating as function of n % 3
-C POWER6 15
-C POWER7 4.75
+C cycles/limb
+C POWER3/PPC630: 6-18
+C POWER4/PPC970: 8.5
+C POWER5: ?
C TODO
C * Nothing to do...
@@ -61,7 +48,6 @@ PROLOGUE(mpn_bdiv_dbm1c)
blt cr6, L(b01)
beq cr6, L(b10)
- ALIGN(16)
L(b11): mulld r5, r0, r6
mulhdu r12, r0, r6
ld r0, 8(r4)
@@ -69,14 +55,13 @@ L(b11): mulld r5, r0, r6
addi r3, r3, -24
b L(3)
- ALIGN(16)
L(b00): mulld r9, r0, r6
mulhdu r8, r0, r6
+ ld r0, 8(r4)
addi r4, r4, -16
addi r3, r3, -16
b L(0)
- ALIGN(16)
L(b01): mulld r5, r0, r6
mulhdu r12, r0, r6
addi r3, r3, -8
@@ -85,43 +70,42 @@ L(b01): mulld r5, r0, r6
addi r4, r4, -8
b L(1)
- ALIGN(16)
L(b10): mulld r9, r0, r6
mulhdu r8, r0, r6
+ ld r0, 8(r4)
ble cr7, L(e2)
ALIGN(16)
-L(top): subfc r11, r9, r7
- ld r10, 8(r4)
+L(top): mulld r5, r0, r6
+ mulhdu r12, r0, r6
+ subfc r11, r9, r7
ld r0, 16(r4)
subfe r7, r8, r11
std r11, 0(r3)
- mulld r5, r10, r6
- mulhdu r12, r10, r6
L(1): mulld r9, r0, r6
mulhdu r8, r0, r6
subfc r11, r5, r7
+ ld r0, 24(r4)
subfe r7, r12, r11
std r11, 8(r3)
-L(0): subfc r11, r9, r7
- ld r10, 24(r4)
+L(0): mulld r5, r0, r6
+ mulhdu r12, r0, r6
+ subfc r11, r9, r7
ld r0, 32(r4)
subfe r7, r8, r11
std r11, 16(r3)
- mulld r5, r10, r6
- mulhdu r12, r10, r6
L(3): mulld r9, r0, r6
mulhdu r8, r0, r6
subfc r11, r5, r7
+ ld r0, 40(r4)
subfe r7, r12, r11
std r11, 24(r3)
addi r4, r4, 32
addi r3, r3, 32
bdnz L(top)
-L(e2): ld r10, 8(r4)
- mulld r5, r10, r6
- mulhdu r12, r10, r6
+L(e2): mulld r5, r0, r6
+ mulhdu r12, r0, r6
subfc r11, r9, r7
subfe r7, r8, r11
std r11, 0(r3)
diff --git a/gmp/mpn/powerpc64/mode64/cnd_aors_n.asm b/gmp/mpn/powerpc64/mode64/cnd_aors_n.asm
deleted file mode 100644
index 24968c1912..0000000000
--- a/gmp/mpn/powerpc64/mode64/cnd_aors_n.asm
+++ /dev/null
@@ -1,196 +0,0 @@
-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()
diff --git a/gmp/mpn/powerpc64/mode64/dive_1.asm b/gmp/mpn/powerpc64/mode64/dive_1.asm
index 434dde9145..a4a06da26c 100644
--- a/gmp/mpn/powerpc64/mode64/dive_1.asm
+++ b/gmp/mpn/powerpc64/mode64/dive_1.asm
@@ -1,45 +1,32 @@
dnl PowerPC-64 mpn_divexact_1 -- mpn by limb exact division.
-dnl Copyright 2006, 2010 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 norm unorm
-C POWER3/PPC630 13-19
-C POWER4/PPC970 16
-C POWER5 16 16
-C POWER6 37 46
-C POWER7 12 12
+C cycles/limb
+C POWER3/PPC630: 13-19
+C POWER4/PPC970: 16
+C POWER5: 16
C TODO
-C * Check if n=1 code is really an improvement. It probably isn't.
+C * Check if n=1 code is really an improvment. It probably isn't.
+C * Perhaps remove L(norm) code, it is currently unreachable.
C * Make more similar to mode1o.asm.
C INPUT PARAMETERS
@@ -53,7 +40,7 @@ ASM_START()
EXTERN(binvert_limb_table)
-PROLOGUE(mpn_divexact_1,toc)
+PROLOGUE(mpn_divexact_1)
addic. n, n, -1
ld r12, 0(up)
bne cr0, L(2)
@@ -74,6 +61,7 @@ L(7):
mtctr n
LEA( r5, binvert_limb_table)
rldicl r11, d, 63, 57
+C cmpdi cr7, r0, 0
lbzx r0, r5, r11
mulld r9, r0, r0
sldi r0, r0, 1
@@ -87,27 +75,26 @@ L(7):
sldi r0, r0, 1
mulld r9, d, r9
subf r7, r9, r0 C r7 = 1/d mod 2^64
- bne cr0, L(norm)
+C beq cr7, L(norm)
subfic r8, r10, 64 C set carry as side effect
li r5, 0
- srd r11, r12, r10
ALIGN(16)
L(loop0):
+ srd r11, r12, r10
ld r12, 8(up)
- nop
addi up, up, 8
sld r0, r12, r8
or r11, r11, r0
subfe r9, r5, r11
- srd r11, r12, r10
mulld r0, r7, r9
- mulhdu r5, r0, d
std r0, 0(rp)
addi rp, rp, 8
+ mulhdu r5, r0, d
bdnz L(loop0)
- subfe r0, r5, r11
+ srd r0, r12, r10
+ subfe r0, r5, r0
mulld r0, r7, r0
std r0, 0(rp)
blr
@@ -115,15 +102,14 @@ L(loop0):
ALIGN(16)
L(norm):
mulld r11, r12, r7
- mulhdu r5, r11, d
std r11, 0(rp)
ALIGN(16)
L(loop1):
+ mulhdu r5, r11, d
ld r9, 8(up)
addi up, up, 8
subfe r5, r5, r9
mulld r11, r7, r5
- mulhdu r5, r11, d C result not used
std r11, 8(rp)
addi rp, rp, 8
bdnz L(loop1)
diff --git a/gmp/mpn/powerpc64/mode64/diveby3.asm b/gmp/mpn/powerpc64/mode64/diveby3.asm
new file mode 100644
index 0000000000..d96f775d71
--- /dev/null
+++ b/gmp/mpn/powerpc64/mode64/diveby3.asm
@@ -0,0 +1,83 @@
+dnl PowerPC-64 mpn_divexact_by3 -- mpn by 3 exact division
+
+dnl Copyright 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 POWER3/PPC630: 13
+C POWER4/PPC970: 13
+C POWER5: 13
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5')
+define(`cy', `r6')
+
+define(`xAAAAAAAB',`r7')
+define(`xAAAAAAAA', `r9')
+define(`q', `r10')
+define(`ul', `r11')
+define(`one', `r12')
+
+
+ASM_START()
+PROLOGUE(mpn_divexact_by3c)
+
+ mtctr r5
+ li r7, -0x5556 C 0xFFFFFFFFFFFFAAAA
+ ld ul, 0(up)
+ rldimi r7, r7, 16, 32 C 0xFFFFFFFFAAAAAAAA
+ rldimi r7, r7, 32, 63 C 0xAAAAAAAAAAAAAAAB = 1/3
+
+ addi r9, r7, -1 C 0xAAAAAAAAAAAAAAAA
+ li one, 1
+
+ subfc ul, cy, ul C C = (cy <= up[0])
+ subfe cy, r1, r1 C cy = -(cy > up[0])
+ bdz L(end)
+
+ ALIGN(16)
+L(top): mulld q, ul, xAAAAAAAB
+
+ ld ul, 8(up)
+ addi up, up, 8
+ addc r0, xAAAAAAAA, q C set C flag if q >= 0x5555...56
+
+ subfe cy, cy, one C cy = 1-cy-1+C
+ subfc r0, q, xAAAAAAAA C set C flag if q < 0xAAAA...AA
+
+ subfe ul, cy, ul C ul = ul-cy-1+C
+ std q, 0(rp)
+ addi rp, rp, 8
+
+ subfe cy, r1, r1
+ bdnz L(top)
+
+L(end): mulld q, ul, xAAAAAAAB
+ addc r0, xAAAAAAAA, q
+
+ subfe cy, cy, one
+ subfc r0, q, xAAAAAAAA
+
+ std q, 0(rp)
+ subfe r3, r1, r1
+ subf r3, r3, cy
+ blr
+EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/divrem_1.asm b/gmp/mpn/powerpc64/mode64/divrem_1.asm
index b283877006..895badfe61 100644
--- a/gmp/mpn/powerpc64/mode64/divrem_1.asm
+++ b/gmp/mpn/powerpc64/mode64/divrem_1.asm
@@ -1,42 +1,29 @@
dnl PowerPC-64 mpn_divrem_1 -- Divide an mpn number by an unnormalized limb.
-dnl Copyright 2003-2005, 2007, 2008, 2010, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2004, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 norm unorm frac
-C POWER3/PPC630 16-34 16-34 ~11 outdated figures
-C POWER4/PPC970 28 28 19
-C POWER5 29 29 ~19
-C POWER6 49 59 ~42
-C POWER7 24.5 23 ~14
+C cycles/limb
+C norm unorm frac
+C POWER3/PPC630 16-34 16-34 ~11
+C POWER4/PPC970 29 19
+C POWER5 29 29 ~20
C INPUT PARAMETERS
C qp = r3
@@ -56,7 +43,7 @@ ASM_START()
EXTERN_FUNC(mpn_invert_limb)
-PROLOGUE(mpn_divrem_1,toc)
+PROLOGUE(mpn_divrem_1)
mfcr r12
add. r10, r6, r4
@@ -107,6 +94,7 @@ 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
@@ -122,23 +110,23 @@ L(71):
sldi r6, r6, 3
ALIGN(16)
L(uloop):
+ addi r11, r31, 1
ldx r8, r26, r6
- nop
mulld r0, r31, r3
mulhdu r10, r31, r3
- addi r11, r31, 1
- srd r9, r8, r5
addi r6, r6, -8
+ srd r9, r8, r5
or r9, r7, r9
addc r0, r0, r9
adde r10, r10, r11
mulld r31, r10, r30
subf r31, r31, r9
- subfc r0, r31, r0 C r <= ql
- subfe r0, r0, r0 C r0 = -(r <= ql)
- and r9, r30, r0
- add r31, r31, r9
- add r10, r0, r10 C qh -= (r >= ql)
+ subfc r0, r0, r31 C r >= ql
+ subfe r0, r0, r0 C r0 = -(r >= ql)
+ not r7, r0
+ add r10, r7, r10 C qh -= (r >= ql)
+ andc r0, r30, r0
+ add r31, r31, r0
cmpld cr7, r31, r30
bge- cr7, L(164)
L(123):
@@ -175,19 +163,19 @@ L(110):
L(ufloop):
addi r11, r31, 1
nop
- mulld r0, r3, r31
+ mulld r7, r3, r31
mulhdu r10, r3, r31
add r10, r10, r11
mulld r31, r9, r10
ifelse(0,1,`
- subfc r0, r0, r31
+ subfc r0, r7, r31
subfe r0, r0, r0 C r0 = -(r >= ql)
not r7, r0
add r10, r7, r10 C qh -= (r >= ql)
andc r0, r30, r0
add r31, r31, r0
',`
- cmpld cr7, r31, r0
+ cmpld cr7, r31, r7
blt cr7, L(29)
add r31, r30, r31
addi r10, r10, -1
@@ -228,11 +216,12 @@ L(162):
and r0, r0, r7
subf r31, r0, r31
L(8):
+L(10):
mr r3, r30
CALL( mpn_invert_limb)
- li r27, 0
+ nop
addic. r6, r28, -1
- blt- cr0, L(110)
+ blt- cr0, L(150)
mtctr r28
sldi r6, r6, 3
ALIGN(16)
@@ -240,25 +229,70 @@ L(nloop):
addi r11, r31, 1
ldx r8, r26, r6
mulld r0, r31, r3
- mulhdu r10, r31, r3
addi r6, r6, -8
- addc r0, r0, r8
+ mulhdu r10, r31, r3
+ addc r7, r0, r8
adde r10, r10, r11
mulld r31, r10, r30
subf r31, r31, r8 C r = nl - qh * d
- subfc r0, r31, r0 C r <= ql
- subfe r0, r0, r0 C r0 = -(r <= ql)
- and r9, r30, r0
- add r31, r31, r9
- add r10, r0, r10 C qh -= (r >= ql)
+ subfc r0, r7, r31 C r >= ql
+ subfe r0, r0, r0 C r0 = -(r >= ql)
+ not r7, r0
+ add r10, r7, r10 C qh -= (r >= ql)
+ andc r0, r30, r0
+ add r31, r31, r0
cmpld cr7, r31, r30
bge- cr7, L(167)
L(51):
std r10, 0(r29)
addi r29, r29, -8
bdnz L(nloop)
- b L(110)
+L(150):
+ addic. r9, r25, -1
+ blt- cr0, L(152)
+ mtctr r25
+ neg r9, r30
+ ALIGN(16)
+L(nfloop):
+ addi r11, r31, 1
+ nop
+ mulld r7, r3, r31
+ mulhdu r10, r3, r31
+ add r10, r10, r11
+ mulld r31, r9, r10
+ifelse(0,1,`
+ subfc r0, r7, r31
+ subfe r0, r0, r0 C r0 = -(r >= ql)
+ not r7, r0
+ add r10, r7, r10 C qh -= (r >= ql)
+ andc r0, r30, r0
+ add r31, r31, r0
+',`
+ cmpld cr7, r31, r7
+ blt cr7, L(28)
+ add r31, r30, r31
+ addi r10, r10, -1
+L(28):
+')
+ std r10, 0(r29)
+ addi r29, r29, -8
+ bdnz L(nfloop)
+L(152):
+ addi r1, r1, 176
+ mr r3, r31
+ ld r0, 16(r1)
+ lwz r12, 8(r1)
+ mtlr r0
+ ld r25, -56(r1)
+ ld r26, -48(r1)
+ mtcrf 8, r12
+ ld r27, -40(r1)
+ ld r28, -32(r1)
+ ld r29, -24(r1)
+ ld r30, -16(r1)
+ ld r31, -8(r1)
+ blr
L(164):
subf r31, r30, r31
addi r10, r10, 1
diff --git a/gmp/mpn/powerpc64/mode64/divrem_2.asm b/gmp/mpn/powerpc64/mode64/divrem_2.asm
index 73ec23c94d..369b5c1f1d 100644
--- a/gmp/mpn/powerpc64/mode64/divrem_2.asm
+++ b/gmp/mpn/powerpc64/mode64/divrem_2.asm
@@ -3,40 +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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 norm frac
+C cycles/limb
+C norm frac
C POWER3/PPC630
-C POWER4/PPC970 ? ?
-C POWER5 37 ?
-C POWER6 62 ?
-C POWER6 30.5 ?
+C POWER4/PPC970 39* 39*
+C POWER5 39* 39*
+
+C STATUS
+C * Performace fluctuates like crazy
C INPUT PARAMETERS
C qp = r3
@@ -53,7 +43,7 @@ ASM_START()
EXTERN_FUNC(mpn_invert_limb)
-PROLOGUE(mpn_divrem_2,toc)
+PROLOGUE(mpn_divrem_2)
mflr r0
std r23, -72(r1)
std r24, -64(r1)
@@ -107,6 +97,7 @@ 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
@@ -130,12 +121,12 @@ L(loop):
mulld r6, r29, r3
addc r6, r6, r31
adde r8, r8, r29
- cmpd cr7, r27, r25
mulld r0, r30, r8
+ subf r31, r0, r31
mulhdu r11, r28, r8
mulld r10, r28, r8
- subf r31, r0, r31
li r7, 0
+ cmpd cr7, r27, r25
blt cr7, L(60)
ld r7, 0(r26)
addi r26, r26, -8
diff --git a/gmp/mpn/powerpc64/mode64/gcd_1.asm b/gmp/mpn/powerpc64/mode64/gcd_1.asm
deleted file mode 100644
index 8762bbbef5..0000000000
--- a/gmp/mpn/powerpc64/mode64/gcd_1.asm
+++ /dev/null
@@ -1,122 +0,0 @@
-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()
diff --git a/gmp/mpn/powerpc64/mode64/gmp-mparam.h b/gmp/mpn/powerpc64/mode64/gmp-mparam.h
index f8305f4720..4eb8887724 100644
--- a/gmp/mpn/powerpc64/mode64/gmp-mparam.h
+++ b/gmp/mpn/powerpc64/mode64/gmp-mparam.h
@@ -5,73 +5,62 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
/* 1600MHz PPC970 */
/* Generated by tuneup.c, 2009-01-14, gcc 4.0 */
-#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 93
-#define MUL_TOOM44_THRESHOLD 135
+#define MUL_KARATSUBA_THRESHOLD 14
+#define MUL_TOOM3_THRESHOLD 57
+#define MUL_TOOM44_THRESHOLD 155
-#define SQR_BASECASE_THRESHOLD 6
-#define SQR_TOOM2_THRESHOLD 32
-#define SQR_TOOM3_THRESHOLD 74
-#define SQR_TOOM4_THRESHOLD 136
+#define SQR_BASECASE_THRESHOLD 5
+#define SQR_KARATSUBA_THRESHOLD 32
+#define SQR_TOOM3_THRESHOLD 89
+#define SQR_TOOM4_THRESHOLD 154
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 44
-#define MULLO_MUL_N_THRESHOLD 234
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 40
+#define MULLOW_MUL_N_THRESHOLD 234
#define DIV_SB_PREINV_THRESHOLD 0 /* always */
-#define DIV_DC_THRESHOLD 33
-#define POWM_THRESHOLD 89
+#define DIV_DC_THRESHOLD 32
+#define POWM_THRESHOLD 93
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 93
-#define GCD_DC_THRESHOLD 237
-#define GCDEXT_DC_THRESHOLD 273
+#define MATRIX22_STRASSEN_THRESHOLD 19
+#define HGCD_THRESHOLD 96
+#define GCD_DC_THRESHOLD 242
+#define GCDEXT_DC_THRESHOLD 353
#define JACOBI_BASE_METHOD 1
#define MOD_1_NORM_THRESHOLD 0 /* always */
#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1_1_THRESHOLD 6
+#define MOD_1_1_THRESHOLD 7
#define MOD_1_2_THRESHOLD 9
-#define MOD_1_4_THRESHOLD 23
+#define MOD_1_4_THRESHOLD 44
#define USE_PREINV_DIVREM_1 0
-#define USE_PREINV_MOD_1 0
+#define USE_PREINV_MOD_1 1
#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 650
-#define SET_STR_PRECOMPUTE_THRESHOLD 1713
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 20
+#define SET_STR_DC_THRESHOLD 532
+#define SET_STR_PRECOMPUTE_THRESHOLD 1790
#define MUL_FFT_TABLE { 336, 672, 1856, 2816, 7168, 20480, 81920, 327680, 0 }
#define MUL_FFT_MODF_THRESHOLD 304
@@ -80,3 +69,9 @@ see https://www.gnu.org/licenses/. */
#define SQR_FFT_TABLE { 272, 672, 1600, 2816, 7168, 20480, 81920, 327680, 786432, 0 }
#define SQR_FFT_MODF_THRESHOLD 272
#define SQR_FFT_THRESHOLD 2688
+
+/* These tables are now obsolete */
+
+#define MUL_FFT_TABLE2 {{1,4}, {209,5}, {513,6}, {1217,7}, {2561,8}, {3329,7}, {3457,8}, {3841,7}, {4097,8}, {6913,9}, {7681,8}, {8961,9}, {9729,8}, {10497,9}, {13825,10}, {15361,9}, {22017,10}, {23553,9}, {26113,11}, {30721,10}, {48129,9}, {50689,10}, {56321,11}, {61441,10}, {81409,11}, {96257,10}, {97281,9}, {98305,10}, {99329,9}, {101889,10}, {106241,12}, {126977,11}, {129025,10}, {146945,11}, {161793,10}, {179969,11}, {194561,10}, {212737,11}, {227329,10}, {228865,12}, {258049,11}, {359937,12}, {389121,11}, {458241,13}, {516097,12}, {520193,11}, {588801,12}, {651265,11}, {720385,12}, {782337,11}, {851457,12}, {913409,11}, {982529,12}, {MP_SIZE_T_MAX,0}}
+
+#define SQR_FFT_TABLE2 {{1,4}, {209,5}, {481,6}, {1089,7}, {3073,8}, {6913,9}, {7681,8}, {8449,9}, {13825,10}, {15361,9}, {19969,10}, {23553,9}, {26113,11}, {30721,10}, {31745,9}, {34305,10}, {56321,11}, {63489,10}, {81409,11}, {96257,9}, {96769,10}, {98049,12}, {126977,11}, {129025,10}, {146945,11}, {161793,10}, {212481,12}, {258049,11}, {267265,10}, {270337,11}, {272385,10}, {274433,11}, {424961,13}, {516097,12}, {520193,11}, {MP_SIZE_T_MAX,0}}
diff --git a/gmp/mpn/powerpc64/mode64/invert_limb.asm b/gmp/mpn/powerpc64/mode64/invert_limb.asm
index dfdba6451e..02a67a3979 100644
--- a/gmp/mpn/powerpc64/mode64/invert_limb.asm
+++ b/gmp/mpn/powerpc64/mode64/invert_limb.asm
@@ -1,88 +1,109 @@
dnl PowerPC-64 mpn_invert_limb -- Invert a normalized limb.
-dnl Copyright 2004-2006, 2008, 2010, 2013 Free Software Foundation, Inc.
+dnl Copyright 2004, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 (approximate)
-C POWER3/PPC630 80
-C POWER4/PPC970 86
-C POWER5 86
-C POWER6 170
-C POWER7 66
+C cycles/limb
+C POWER3/PPC630: ?
+C POWER4/PPC970: 75 (including call+ret)
+
+C TODO:
+C * Pair multiply instructions.
ASM_START()
-PROLOGUE(mpn_invert_limb,toc)
+PROLOGUE(mpn_invert_limb)
LEAL( r12, approx_tab)
- srdi r9, r3, 32
- rlwinm r9, r9, 10, 23, 30 C (d >> 55) & 0x1fe
- srdi r10, r3, 24 C d >> 24
- lis r11, 0x1000
- rldicl r8, r3, 0, 63 C d mod 2
- addi r10, r10, 1 C d40
- sldi r11, r11, 32 C 2^60
- srdi r7, r3, 1 C d/2
- add r7, r7, r8 C d63 = ceil(d/2)
- neg r8, r8 C mask = -(d mod 2)
- lhzx r0, r9, r12
- mullw r9, r0, r0 C v0*v0
- sldi r6, r0, 11 C v0 << 11
- addi r0, r6, -1 C (v0 << 11) - 1
- mulld r9, r9, r10 C v0*v0*d40
- srdi r9, r9, 40 C v0*v0*d40 >> 40
- subf r9, r9, r0 C v1 = (v0 << 11) - (v0*v0*d40 >> 40) - 1
- mulld r0, r9, r10 C v1*d40
- sldi r6, r9, 13 C v1 << 13
- subf r0, r0, r11 C 2^60 - v1*d40
- mulld r0, r0, r9 C v1 * (2^60 - v1*d40)
- srdi r0, r0, 47 C v1 * (2^60 - v1*d40) >> 47
- add r0, r0, r6 C v2 = (v1 << 13) + (v1 * (2^60 - v1*d40) >> 47)
- mulld r11, r0, r7 C v2 * d63
- srdi r10, r0, 1 C v2 >> 1
- sldi r9, r0, 31 C v2 << 31
- and r8, r10, r8 C (v2 >> 1) & mask
- subf r8, r11, r8 C ((v2 >> 1) & mask) - v2 * d63
- mulhdu r0, r8, r0 C p1 = v2 * (((v2 >> 1) & mask) - v2 * d63)
- srdi r0, r0, 1 C p1 >> 1
- add r0, r0, r9 C v3 = (v2 << 31) + (p1 >> 1)
- nop
- mulld r11, r0, r3
- mulhdu r9, r0, r3
- addc r10, r11, r3
- adde r3, r9, r3
- subf r3, r3, r0
+
+ srdi r11, r3, 32 C r11 = d >> 32
+ rlwinm r9, r11, 10, 23, 30 C r9 = ((d >> 55) & 0xff) << 1
+ lhzx r0, r12, r9 C load initial approximation
+ rldic r10, r0, 6, 42
+ mulld r8, r10, r10
+ sldi r9, r10, 17
+ mulld r0, r8, r11
+ srdi r0, r0, 31
+ subf r10, r0, r9
+ mulld r8, r10, r10
+ sldi r11, r10, 33
+ mulhdu r0, r8, r3
+ sldi r9, r0, 1
+ subf r10, r9, r11
+ sldi r11, r10, 2
+ mulhdu r0, r10, r10
+ mulld r8, r10, r10
+ mulhdu r10, r8, r3
+ mulld r9, r0, r3
+ mulhdu r0, r0, r3
+ addc r8, r9, r10
+ addze r10, r0
+ srdi r0, r8, 62
+ rldimi r0, r10, 2, 0
+ sldi r9, r8, 2
+ subfic r10, r9, 0
+ subfe r8, r0, r11
+ mulhdu r10, r3, r8
+ add r10, r10, r3
+ mulld r9, r3, r8
+ subf r11, r10, r8
+ addi r0, r10, 1
+ addi r8, r11, -1
+ and r0, r3, r0
+ addc r11, r9, r0
+ addze r10, r10
+ addc r0, r11, r3
+ addze r10, r10
+ subf r3, r10, r8
blr
EPILOGUE()
DEF_OBJECT(approx_tab)
-forloop(i,256,512-1,dnl
-` .short eval(0x7fd00/i)
-')dnl
+ .short 1023,1020,1016,1012,1008,1004,1000,996
+ .short 992,989,985,981,978,974,970,967
+ .short 963,960,956,953,949,946,942,939
+ .short 936,932,929,926,923,919,916,913
+ .short 910,907,903,900,897,894,891,888
+ .short 885,882,879,876,873,870,868,865
+ .short 862,859,856,853,851,848,845,842
+ .short 840,837,834,832,829,826,824,821
+ .short 819,816,814,811,809,806,804,801
+ .short 799,796,794,791,789,787,784,782
+ .short 780,777,775,773,771,768,766,764
+ .short 762,759,757,755,753,751,748,746
+ .short 744,742,740,738,736,734,732,730
+ .short 728,726,724,722,720,718,716,714
+ .short 712,710,708,706,704,702,700,699
+ .short 697,695,693,691,689,688,686,684
+ .short 682,680,679,677,675,673,672,670
+ .short 668,667,665,663,661,660,658,657
+ .short 655,653,652,650,648,647,645,644
+ .short 642,640,639,637,636,634,633,631
+ .short 630,628,627,625,624,622,621,619
+ .short 618,616,615,613,612,611,609,608
+ .short 606,605,604,602,601,599,598,597
+ .short 595,594,593,591,590,589,587,586
+ .short 585,583,582,581,579,578,577,576
+ .short 574,573,572,571,569,568,567,566
+ .short 564,563,562,561,560,558,557,556
+ .short 555,554,553,551,550,549,548,547
+ .short 546,544,543,542,541,540,539,538
+ .short 537,536,534,533,532,531,530,529
+ .short 528,527,526,525,524,523,522,521
+ .short 520,519,518,517,516,515,514,513
END_OBJECT(approx_tab)
ASM_END()
diff --git a/gmp/mpn/powerpc64/mode64/mod_1_1.asm b/gmp/mpn/powerpc64/mode64/mod_1_1.asm
deleted file mode 100644
index 873373054f..0000000000
--- a/gmp/mpn/powerpc64/mode64/mod_1_1.asm
+++ /dev/null
@@ -1,164 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 17
-C POWER5 16
-C POWER6 30
-C POWER7 10.2
-
-C TODO
-C * Optimise, in particular the cps function. This was compiler-generated and
-C then hand optimised.
-
-C INPUT PARAMETERS
-define(`ap', `r3')
-define(`n', `r4')
-define(`d', `r5')
-define(`cps', `r6')
-
-ASM_START()
-
-EXTERN_FUNC(mpn_invert_limb)
-
-PROLOGUE(mpn_mod_1_1p)
- sldi r10, r4, 3
- addi r4, r4, -1
- add r3, r3, r10
- ld r0, 16(r6) C B1modb
- ld r12, 24(r6) C B2modb
- ld r9, -8(r3)
- ld r10, -16(r3)
- mtctr r4
- mulhdu r8, r9, r0
- mulld r7, r9, r0
- addc r11, r7, r10
- addze r9, r8
- bdz L(end)
-
- ALIGN(16)
-L(top): ld r4, -24(r3)
- addi r3, r3, -8
- nop
- mulld r10, r11, r0
- mulld r8, r9, r12
- mulhdu r11, r11, r0
- mulhdu r9, r9, r12
- addc r7, r10, r4
- addze r10, r11
- addc r11, r8, r7
- adde r9, r9, r10
- bdnz L(top)
-
-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)
- subfic r10, r0, 64
- sld r9, r9, r0
- srd r10, r11, r10
- or r9, r10, r9
-L(4): subfc r10, r5, r9
- subfe r10, r10, r10
- nand r10, r10, r10
- sld r11, r11, r0
- and r10, r10, r5
- subf r9, r10, r9
- mulhdu r10, r9, r3
- mulld r3, r9, r3
- addi r9, r9, 1
- addc r8, r3, r11
- adde r3, r10, r9
- mulld r3, r3, r5
- subf r3, r3, r11
- cmpld cr7, r8, r3
- bge cr7, L(5) C FIXME: Make branch-less
- add r3, r3, r5
-L(5): cmpld cr7, r3, r5
- bge- cr7, L(10)
- srd r3, r3, r0
- blr
-
-L(10): subf r3, r5, r3
- srd r3, r3, r0
- blr
-EPILOGUE()
-
-PROLOGUE(mpn_mod_1_1p_cps,toc)
- mflr r0
- std r29, -24(r1)
- std r30, -16(r1)
- std r31, -8(r1)
- cntlzd r31, r4
- std r0, 16(r1)
- extsw r31, r31
- mr r29, r3
- stdu r1, -144(r1)
- sld r30, r4, r31
- mr r3, r30
- CALL( mpn_invert_limb)
- cmpdi cr7, r31, 0
- neg r0, r30
- beq- cr7, L(13)
- subfic r11, r31, 64
- li r0, 1
- neg r9, r30
- srd r11, r3, r11
- sld r0, r0, r31
- or r0, r11, r0
- mulld r0, r0, r9
-L(13): mulhdu r9, r0, r3
- mulld r11, r0, r3
- add r9, r0, r9
- nor r9, r9, r9
- mulld r9, r9, r30
- cmpld cr7, r11, r9
- bge cr7, L(14)
- add r9, r9, r30
-L(14): addi r1, r1, 144
- srd r0, r0, r31
- std r31, 8(r29)
- std r3, 0(r29)
- std r0, 16(r29)
- ld r0, 16(r1)
- srd r9, r9, r31
- ld r30, -16(r1)
- ld r31, -8(r1)
- std r9, 24(r29)
- ld r29, -24(r1)
- mtlr r0
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/mod_1_4.asm b/gmp/mpn/powerpc64/mode64/mod_1_4.asm
deleted file mode 100644
index 0b7d6bf699..0000000000
--- a/gmp/mpn/powerpc64/mode64/mod_1_4.asm
+++ /dev/null
@@ -1,270 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 9
-C POWER5 9
-C POWER6 13
-C POWER7 3.5
-
-C TODO
-C * Optimise, in particular the cps function. This was compiler-generated and
-C then hand optimised.
-
-C INPUT PARAMETERS
-define(`ap', `r3')
-define(`n', `r4')
-define(`d', `r5')
-define(`cps', `r6')
-
-ASM_START()
-
-EXTERN_FUNC(mpn_invert_limb)
-
-PROLOGUE(mpn_mod_1s_4p)
- std r23, -72(r1)
- ld r23, 48(cps)
- std r24, -64(r1)
- std r25, -56(r1)
- ld r24, 32(cps)
- ld r25, 24(cps)
- std r26, -48(r1)
- std r27, -40(r1)
- ld r26, 16(cps)
- std r28, -32(r1)
- std r29, -24(r1)
- std r30, -16(r1)
- std r31, -8(r1)
- ld r30, 40(cps)
-
- rldicl. r0, n, 0,62
- sldi r31, n, 3
- add ap, ap, r31 C make ap point at end of operand
-
- cmpdi cr7, r0, 2
- beq cr0, L(b00)
- blt cr7, L(b01)
- beq cr7, L(b10)
-
-L(b11): ld r11, -16(ap)
- ld r9, -8(ap)
- ld r0, -24(ap)
- mulhdu r27, r11, r26
- mulld r8, r11, r26
- mulhdu r11, r9, r25
- mulld r9, r9, r25
- addc r31, r8, r0
- addze r10, r27
- addc r0, r9, r31
- adde r9, r11, r10
- addi ap, ap, -40
- b L(6)
-
- ALIGN(16)
-L(b00): ld r11, -24(ap)
- ld r10, -16(ap)
- ld r9, -8(ap)
- ld r0, -32(ap)
- mulld r8, r11, r26
- mulhdu r7, r10, r25
- mulhdu r27, r11, r26
- mulhdu r11, r9, r24
- mulld r10, r10, r25
- mulld r9, r9, r24
- addc r31, r8, r0
- addze r0, r27
- addc r8, r31, r10
- adde r10, r0, r7
- addc r0, r9, r8
- adde r9, r11, r10
- addi ap, ap, -48
- b L(6)
-
- ALIGN(16)
-L(b01): li r9, 0
- ld r0, -8(ap)
- addi ap, ap, -24
- b L(6)
-
- ALIGN(16)
-L(b10): ld r9, -8(ap)
- ld r0, -16(ap)
- addi ap, ap, -32
-
- ALIGN(16)
-L(6): addi r10, n, 3
- srdi r7, r10, 2
- mtctr r7
- bdz L(end)
-
- ALIGN(16)
-L(top): ld r31, -16(ap)
- ld r10, -8(ap)
- ld r11, 8(ap)
- ld r12, 0(ap)
- mulld r29, r0, r30 C rl * B4modb
- mulhdu r0, r0, r30 C rl * B4modb
- mulhdu r27, r10, r26
- mulld r10, r10, r26
- mulhdu r7, r9, r23 C rh * B5modb
- mulld r9, r9, r23 C rh * B5modb
- mulhdu r28, r11, r24
- mulld r11, r11, r24
- mulhdu r4, r12, r25
- mulld r12, r12, r25
- addc r8, r10, r31
- addze r10, r27
- addi ap, ap, -32
- addc r27, r8, r12
- adde r12, r10, r4
- addc r11, r27, r11
- adde r31, r12, r28
- addc r12, r11, r29
- adde r4, r31, r0
- addc r0, r9, r12
- adde r9, r7, r4
- bdnz L(top)
-
-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
- addze r9, r9
- ld r10, 0(cps)
- subfic r8, r3, 64
- sld r9, r9, r3
- srd r8, r11, r8
- sld r11, r11, r3
- or r9, r8, r9
- mulld r0, r9, r10
- mulhdu r10, r9, r10
- addi r9, r9, 1
- addc r8, r0, r11
- adde r0, r10, r9
- mulld r0, r0, d
- subf r0, r0, r11
- cmpld cr7, r8, r0
- bge cr7, L(9)
- add r0, r0, d
-L(9): cmpld cr7, r0, d
- bge- cr7, L(16)
-L(10): srd r3, r0, r3
- ld r23, -72(r1)
- ld r24, -64(r1)
- ld r25, -56(r1)
- ld r26, -48(r1)
- ld r27, -40(r1)
- ld r28, -32(r1)
- ld r29, -24(r1)
- ld r30, -16(r1)
- ld r31, -8(r1)
- blr
-
-L(16): subf r0, d, r0
- b L(10)
-EPILOGUE()
-
-PROLOGUE(mpn_mod_1s_4p_cps,toc)
- mflr r0
- std r29, -24(r1)
- std r30, -16(r1)
- mr r29, r3
- std r0, 16(r1)
- std r31, -8(r1)
- stdu r1, -144(r1)
- cntlzd r31, r4
- sld r30, r4, r31
- mr r3, r30
- CALL( mpn_invert_limb)
- subfic r9, r31, 64
- li r10, 1
- sld r10, r10, r31
- srd r9, r3, r9
- neg r0, r30
- or r10, r10, r9
- mulld r10, r10, r0
- mulhdu r11, r10, r3
- nor r11, r11, r11
- subf r11, r10, r11
- mulld r11, r11, r30
- mulld r0, r10, r3
- cmpld cr7, r0, r11
- bge cr7, L(18)
- add r11, r11, r30
-L(18): mulhdu r9, r11, r3
- add r9, r11, r9
- nor r9, r9, r9
- mulld r9, r9, r30
- mulld r0, r11, r3
- cmpld cr7, r0, r9
- bge cr7, L(19)
- add r9, r9, r30
-L(19): mulhdu r0, r9, r3
- add r0, r9, r0
- nor r0, r0, r0
- mulld r0, r0, r30
- mulld r8, r9, r3
- cmpld cr7, r8, r0
- bge cr7, L(20)
- add r0, r0, r30
-L(20): mulhdu r8, r0, r3
- add r8, r0, r8
- nor r8, r8, r8
- mulld r8, r8, r30
- mulld r7, r0, r3
- cmpld cr7, r7, r8
- bge cr7, L(21)
- add r8, r8, r30
-L(21): srd r0, r0, r31
- addi r1, r1, 144
- srd r8, r8, r31
- srd r10, r10, r31
- srd r11, r11, r31
- std r0, 40(r29)
- std r31, 8(r29)
- srd r9, r9, r31
- ld r0, 16(r1)
- ld r30, -16(r1)
- std r8, 48(r29)
- std r3, 0(r29)
- mtlr r0
- ld r31, -8(r1)
- std r10, 16(r29)
- std r11, 24(r29)
- std r9, 32(r29)
- ld r29, -24(r1)
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/mod_34lsub1.asm b/gmp/mpn/powerpc64/mode64/mod_34lsub1.asm
index c35e0e37a4..ca46c3933b 100644
--- a/gmp/mpn/powerpc64/mode64/mod_34lsub1.asm
+++ b/gmp/mpn/powerpc64/mode64/mod_34lsub1.asm
@@ -1,41 +1,28 @@
-dnl PowerPC-64 mpn_mod_34lsub1 -- modulo 2^48-1.
+dnl PowerPC-64 mpn_mod_34lsub1 -- modulo 2^24-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1.33
-C POWER4/PPC970 1.5
-C POWER5 1.32
-C POWER6 2.35
-C POWER7 1
+C cycles/limb
+C POWER3/PPC630: 1.33
+C POWER4/PPC970: 1.5
+C POWER5: 1.57
C INPUT PARAMETERS
define(`up',`r3')
diff --git a/gmp/mpn/powerpc64/mode64/mode1o.asm b/gmp/mpn/powerpc64/mode64/mode1o.asm
index 726339a931..95aa2870da 100644
--- a/gmp/mpn/powerpc64/mode64/mode1o.asm
+++ b/gmp/mpn/powerpc64/mode64/mode1o.asm
@@ -3,43 +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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 13-19
-C POWER4/PPC970 16
-C POWER5 16
-C POWER6 ?
-C POWER7 12
+C cycles/limb
+C POWER3/PPC630: 13-19
+C POWER4/PPC970: 16
+C POWER5: 16
C TODO
-C * Check if n=1 code is really an improvement. It probably isn't.
-C * Make more similar to dive_1.asm.
+C * Check if n=1 code is really an improvment. It probably isn't.
+C * Make more similar to dive_1.asm..
C INPUT PARAMETERS
define(`up', `r3')
@@ -52,7 +39,7 @@ ASM_START()
EXTERN(binvert_limb_table)
-PROLOGUE(mpn_modexact_1c_odd,toc)
+PROLOGUE(mpn_modexact_1c_odd)
addic. n, n, -1 C set carry as side effect
ld r8, 0(up)
bne cr0, L(2)
diff --git a/gmp/mpn/powerpc64/mode64/mul_1.asm b/gmp/mpn/powerpc64/mode64/mul_1.asm
index 27a8f8fb4d..8f644d8710 100644
--- a/gmp/mpn/powerpc64/mode64/mul_1.asm
+++ b/gmp/mpn/powerpc64/mode64/mul_1.asm
@@ -1,42 +1,30 @@
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-2001, 2003-2006, 2010 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 6-18
-C POWER4/PPC970 7.25? not updated for last file revision
-C POWER5 7.25
-C POWER6 14
-C POWER7 2.9
+C cycles/limb
+C POWER3/PPC630: 6-18
+C POWER4/PPC970: 7.25
+C POWER5: 7.75
C TODO
C * Try to reduce the number of needed live registers (at least r5 and r10
@@ -130,18 +118,26 @@ L(b10): ld r27, 8(up)
L(top): mulld r0, r26, r6
mulhdu r5, r26, r6
+ ld r26, 0(up)
+ nop
+
mulld r7, r27, r6
mulhdu r8, r27, r6
- ld r26, 0(up)
ld r27, 8(up)
+ nop
+
adde r0, r0, r12
adde r7, r7, r5
+
mulld r9, r26, r6
mulhdu r10, r26, r6
+ ld r26, 16(up)
+ nop
+
mulld r11, r27, r6
mulhdu r12, r27, r6
- ld r26, 16(up)
ld r27, 24(up)
+
std r0, 0(rp)
adde r9, r9, r8
std r7, 8(rp)
@@ -155,10 +151,13 @@ L(top): mulld r0, r26, r6
L(end): mulld r0, r26, r6
mulhdu r5, r26, r6
+
mulld r7, r27, r6
mulhdu r8, r27, r6
+
adde r0, r0, r12
adde r7, r7, r5
+
std r0, 0(rp)
std r7, 8(rp)
L(ret): addze r3, r8
diff --git a/gmp/mpn/powerpc64/mode64/mul_basecase.asm b/gmp/mpn/powerpc64/mode64/mul_basecase.asm
index 18731879e4..cea5417eb2 100644
--- a/gmp/mpn/powerpc64/mode64/mul_basecase.asm
+++ b/gmp/mpn/powerpc64/mode64/mul_basecase.asm
@@ -1,40 +1,30 @@
-dnl PowerPC-64 mpn_mul_basecase.
+dnl PowerPC-64 mpn_basecase.
-dnl Copyright 1999-2001, 2003-2006, 2008 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 2001, 2003, 2004, 2005, 2006, 2008 Free Software
+dnl Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 6-18
-C POWER4/PPC970 8
-C POWER5 8
-C POWER6 24
+C cycles/limb
+C POWER3/PPC630: 6-18
+C POWER4/PPC970: 8
+C POWER5: 8
+
C INPUT PARAMETERS
define(`rp', `r3')
diff --git a/gmp/mpn/powerpc64/mode64/p3/gmp-mparam.h b/gmp/mpn/powerpc64/mode64/p3/gmp-mparam.h
deleted file mode 100644
index 61a437b6e6..0000000000
--- a/gmp/mpn/powerpc64/mode64/p3/gmp-mparam.h
+++ /dev/null
@@ -1,179 +0,0 @@
-/* POWER3/PowerPC630 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 18
-#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 0
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-
-#define MUL_TOOM22_THRESHOLD 10
-#define MUL_TOOM33_THRESHOLD 33
-#define MUL_TOOM44_THRESHOLD 46
-#define MUL_TOOM6H_THRESHOLD 77
-#define MUL_TOOM8H_THRESHOLD 139
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 49
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 47
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 49
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 49
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 34
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 14
-#define SQR_TOOM3_THRESHOLD 45
-#define SQR_TOOM4_THRESHOLD 64
-#define SQR_TOOM6_THRESHOLD 85
-#define SQR_TOOM8_THRESHOLD 139
-
-#define MULMID_TOOM42_THRESHOLD 22
-
-#define MULMOD_BNM1_THRESHOLD 8
-#define SQRMOD_BNM1_THRESHOLD 10
-
-#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 220, 5}, { 9, 6}, { 5, 5}, { 11, 6}, \
- { 13, 7}, { 7, 6}, { 15, 7}, { 13, 8}, \
- { 7, 7}, { 15, 8}, { 13, 9}, { 7, 8}, \
- { 19, 9}, { 11, 8}, { 23,10}, { 7, 9}, \
- { 15, 8}, { 33, 9}, { 23,10}, { 15, 9}, \
- { 35, 8}, { 71,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 71,10}, { 39, 9}, \
- { 79,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, 8}, \
- { 511,10}, { 143, 9}, { 287,11}, { 79,10}, \
- { 159, 9}, { 319, 8}, { 639,10}, { 175, 9}, \
- { 351,11}, { 95,10}, { 191, 9}, { 383,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}, { 223,13}, { 63,12}, \
- { 127,11}, { 255,10}, { 511,11}, { 287,10}, \
- { 575, 9}, { 1151,12}, { 159,11}, { 319,10}, \
- { 639,11}, { 351,12}, { 191,11}, { 383,10}, \
- { 767,12}, { 223,11}, { 447,10}, { 895,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,10}, { 1663,12}, \
- { 447,11}, { 895,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 120
-#define MUL_FFT_THRESHOLD 2688
-
-#define SQR_FFT_MODF_THRESHOLD 188 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 188, 5}, { 9, 6}, { 5, 5}, { 11, 6}, \
- { 13, 7}, { 13, 8}, { 7, 7}, { 16, 8}, \
- { 9, 7}, { 19, 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}, { 67,10}, { 39, 9}, \
- { 79, 8}, { 159,10}, { 47, 9}, { 95, 8}, \
- { 191,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255,10}, { 71, 9}, { 143, 8}, { 287,10}, \
- { 79, 9}, { 159,11}, { 47,10}, { 95, 9}, \
- { 191,12}, { 31,11}, { 63,10}, { 127, 9}, \
- { 255, 8}, { 511,10}, { 143, 9}, { 287,11}, \
- { 79,10}, { 159, 9}, { 319, 8}, { 639,10}, \
- { 175,11}, { 95,10}, { 191, 9}, { 383,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,12}, { 95,11}, { 191,10}, { 383, 9}, \
- { 767,11}, { 223,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 287,10}, { 575,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 351,12}, \
- { 191,11}, { 383,10}, { 767,12}, { 223,11}, \
- { 447,10}, { 895,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}, { 447,11}, { 895,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 118
-#define SQR_FFT_THRESHOLD 1728
-
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 27
-#define MULLO_MUL_N_THRESHOLD 2511
-
-#define DC_DIV_QR_THRESHOLD 23
-#define DC_DIVAPPR_Q_THRESHOLD 87
-#define DC_BDIV_QR_THRESHOLD 27
-#define DC_BDIV_Q_THRESHOLD 60
-
-#define INV_MULMOD_BNM1_THRESHOLD 27
-#define INV_NEWTON_THRESHOLD 91
-#define INV_APPR_THRESHOLD 91
-
-#define BINV_NEWTON_THRESHOLD 115
-#define REDC_1_TO_REDC_N_THRESHOLD 31
-
-#define MU_DIV_QR_THRESHOLD 551
-#define MU_DIVAPPR_Q_THRESHOLD 551
-#define MUPI_DIV_QR_THRESHOLD 42
-#define MU_BDIV_QR_THRESHOLD 483
-#define MU_BDIV_Q_THRESHOLD 492
-
-#define POWM_SEC_TABLE 2,23,140,556,713,746
-
-#define MATRIX22_STRASSEN_THRESHOLD 8
-#define HGCD_THRESHOLD 56
-#define HGCD_APPR_THRESHOLD 51
-#define HGCD_REDUCE_THRESHOLD 688
-#define GCD_DC_THRESHOLD 333
-#define GCDEXT_DC_THRESHOLD 126
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 17
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 375
-#define SET_STR_PRECOMPUTE_THRESHOLD 812
-
-#define FAC_DSC_THRESHOLD 351
-#define FAC_ODD_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/powerpc64/mode64/p4/gmp-mparam.h b/gmp/mpn/powerpc64/mode64/p4/gmp-mparam.h
deleted file mode 100644
index d909b292bb..0000000000
--- a/gmp/mpn/powerpc64/mode64/p4/gmp-mparam.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* POWER4/PowerPC970 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
-
-#define GMP_LIMB_BITS 64
-#define GMP_LIMB_BYTES 8
-
-/* 1800 MHz 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 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 34
-
-#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 53
-#define MUL_TOOM44_THRESHOLD 136
-#define MUL_TOOM6H_THRESHOLD 197
-#define MUL_TOOM8H_THRESHOLD 296
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
-#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 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 15
-
-#define MUL_FFT_MODF_THRESHOLD 380 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, \
- { 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}, { 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,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 \
- { { 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}, { 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,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 173
-
-#define BINV_NEWTON_THRESHOLD 214
-#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 92
-#define MU_BDIV_QR_THRESHOLD 889
-#define MU_BDIV_Q_THRESHOLD 1017
-
-#define POWM_SEC_TABLE 2,22,87,579,1925
-
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 109
-#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 802
-#define SET_STR_PRECOMPUTE_THRESHOLD 1712
-
-#define FAC_DSC_THRESHOLD 507
-#define FAC_ODD_THRESHOLD 25
diff --git a/gmp/mpn/powerpc64/mode64/p5/gmp-mparam.h b/gmp/mpn/powerpc64/mode64/p5/gmp-mparam.h
deleted file mode 100644
index 15b009c357..0000000000
--- a/gmp/mpn/powerpc64/mode64/p5/gmp-mparam.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* POWER5 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* POWER5 (friggms.hpc.ntnu.no) */
-
-#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 15
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 11
-#define USE_PREINV_DIVREM_1 0
-#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 21
-#define MUL_TOOM33_THRESHOLD 24
-#define MUL_TOOM44_THRESHOLD 70
-#define MUL_TOOM6H_THRESHOLD 262
-#define MUL_TOOM8H_THRESHOLD 393
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 49
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 126
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 85
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 94
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 70
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 24
-#define SQR_TOOM3_THRESHOLD 81
-#define SQR_TOOM4_THRESHOLD 142
-#define SQR_TOOM6_THRESHOLD 189
-#define SQR_TOOM8_THRESHOLD 284
-
-#define MULMID_TOOM42_THRESHOLD 36
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 15
-
-#define MUL_FFT_MODF_THRESHOLD 304 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 348, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 10, 5}, { 21, 6}, { 21, 7}, { 11, 6}, \
- { 23, 7}, { 12, 6}, { 25, 7}, { 21, 8}, \
- { 11, 7}, { 25, 8}, { 13, 7}, { 27, 8}, \
- { 15, 7}, { 31, 8}, { 21, 9}, { 11, 8}, \
- { 27, 9}, { 15, 8}, { 33, 9}, { 19, 8}, \
- { 39, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 135,11}, { 79,10}, { 159, 9}, { 319,11}, \
- { 95,10}, { 191, 9}, { 383,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271,11}, \
- { 143,10}, { 287, 9}, { 575,10}, { 319,12}, \
- { 95,11}, { 191,10}, { 383,13}, { 63,12}, \
- { 127,11}, { 255,10}, { 511,11}, { 271,10}, \
- { 543,11}, { 287,10}, { 575, 9}, { 1151,11}, \
- { 319,10}, { 639,11}, { 351,10}, { 703,12}, \
- { 191,11}, { 383,10}, { 767,11}, { 415,12}, \
- { 223,11}, { 447,13}, { 127,12}, { 255,11}, \
- { 511,10}, { 1023,11}, { 543,10}, { 1087,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,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,11}, { 1919,14}, { 255,13}, { 511,12}, \
- { 1087,11}, { 2175,13}, { 575,12}, { 1215,11}, \
- { 2431,10}, { 4863,13}, { 639,12}, { 1343,13}, \
- { 703,12}, { 1407,14}, { 383,13}, { 767,12}, \
- { 1535,13}, { 831,12}, { 1663,13}, { 959,12}, \
- { 1919,11}, { 3839,15}, { 255,14}, { 511,13}, \
- { 1087,12}, { 2175,13}, { 1215,12}, { 2431,11}, \
- { 4863,14}, { 639,13}, { 1343,12}, { 2687,13}, \
- { 1407,12}, { 2815,13}, { 1471,12}, { 2943,14}, \
- { 767,13}, { 1599,12}, { 3199,13}, { 1663,14}, \
- { 895,13}, { 1919,12}, { 3839,15}, { 511,14}, \
- { 1023,13}, { 2175,14}, { 1151,13}, { 2431,12}, \
- { 4863,14}, { 1279,13}, { 2687,14}, { 1407,13}, \
- { 2943,15}, { 767,14}, { 1535,13}, { 3199,14}, \
- { 1663,13}, { 3327,14}, { 1919,13}, { 3839,16}, \
- { 511,15}, { 1023,14}, { 2431,13}, { 4863,15}, \
- { 1279,14}, { 2943,12}, { 11775,15}, { 1535,14}, \
- { 3327,15}, { 1791,14}, { 16384,15}, { 32768,16}, \
- { 65536,17}, { 131072,18}, { 262144,19}, { 524288,20}, \
- {1048576,21}, {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 208
-#define MUL_FFT_THRESHOLD 4224
-
-#define SQR_FFT_MODF_THRESHOLD 284 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 272, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
- { 19, 7}, { 17, 8}, { 9, 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}, { 63,10}, { 47,11}, \
- { 31,10}, { 71, 9}, { 143,10}, { 79,11}, \
- { 47,10}, { 95,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511, 9}, { 271,10}, \
- { 143,11}, { 79,10}, { 159, 9}, { 319,10}, \
- { 175, 9}, { 351,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 207, 9}, { 415,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271,11}, \
- { 143,10}, { 287, 9}, { 575,11}, { 159,10}, \
- { 319,11}, { 175,10}, { 351,12}, { 95,11}, \
- { 191,10}, { 383,11}, { 207,10}, { 415,13}, \
- { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
- { 271,10}, { 543,11}, { 287,10}, { 575,12}, \
- { 159,11}, { 319,10}, { 639,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 415,12}, { 223,11}, { 447,10}, { 895,11}, \
- { 479,10}, { 959,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,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,12}, { 479,11}, \
- { 959,13}, { 255,12}, { 511,11}, { 1023,12}, \
- { 543,11}, { 1087,12}, { 575,13}, { 319,12}, \
- { 639,11}, { 1279,12}, { 703,11}, { 1407,13}, \
- { 383,12}, { 831,13}, { 447,12}, { 959,14}, \
- { 255,13}, { 511,12}, { 1087,13}, { 575,12}, \
- { 1215,13}, { 639,12}, { 1279,13}, { 703,12}, \
- { 1407,14}, { 383,13}, { 831,12}, { 1663,13}, \
- { 959,12}, { 1919,15}, { 255,14}, { 511,13}, \
- { 1023,12}, { 2047,13}, { 1087,12}, { 2175,13}, \
- { 1215,14}, { 639,13}, { 1407,12}, { 2815,14}, \
- { 767,13}, { 1663,14}, { 895,13}, { 1919,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
- { 2431,12}, { 4863,14}, { 1407,13}, { 2815,15}, \
- { 767,14}, { 1663,13}, { 3327,14}, { 1919,13}, \
- { 3839,16}, { 511,15}, { 1023,14}, { 2431,13}, \
- { 4863,15}, { 1279,14}, { 2943,13}, { 5887,12}, \
- { 11775,15}, { 1535,14}, { 3327,15}, { 1791,14}, \
- { 16384,15}, { 32768,16}, { 65536,17}, { 131072,18}, \
- { 262144,19}, { 524288,20}, {1048576,21}, {2097152,22}, \
- {4194304,23}, {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 190
-#define SQR_FFT_THRESHOLD 3264
-
-#define MULLO_BASECASE_THRESHOLD 6
-#define MULLO_DC_THRESHOLD 60
-#define MULLO_MUL_N_THRESHOLD 7463
-
-#define DC_DIV_QR_THRESHOLD 58
-#define DC_DIVAPPR_Q_THRESHOLD 232
-#define DC_BDIV_QR_THRESHOLD 78
-#define DC_BDIV_Q_THRESHOLD 238
-
-#define INV_MULMOD_BNM1_THRESHOLD 92
-#define INV_NEWTON_THRESHOLD 155
-#define INV_APPR_THRESHOLD 157
-
-#define BINV_NEWTON_THRESHOLD 155
-#define REDC_1_TO_REDC_N_THRESHOLD 61
-
-#define MU_DIV_QR_THRESHOLD 998
-#define MU_DIVAPPR_Q_THRESHOLD 979
-#define MUPI_DIV_QR_THRESHOLD 79
-#define MU_BDIV_QR_THRESHOLD 823
-#define MU_BDIV_Q_THRESHOLD 942
-
-#define MATRIX22_STRASSEN_THRESHOLD 14
-#define HGCD_THRESHOLD 74
-#define HGCD_APPR_THRESHOLD 155
-#define HGCD_REDUCE_THRESHOLD 2479
-#define GCD_DC_THRESHOLD 351
-#define GCDEXT_DC_THRESHOLD 288
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 650
-#define SET_STR_PRECOMPUTE_THRESHOLD 1585
-
-#define FAC_DSC_THRESHOLD 662
-#define FAC_ODD_THRESHOLD 28
diff --git a/gmp/mpn/powerpc64/mode64/p6/aorsmul_1.asm b/gmp/mpn/powerpc64/mode64/p6/aorsmul_1.asm
deleted file mode 100644
index 5a85f84f4a..0000000000
--- a/gmp/mpn/powerpc64/mode64/p6/aorsmul_1.asm
+++ /dev/null
@@ -1,183 +0,0 @@
-dnl PowerPC-64 mpn_addmul_1 and mpn_submul_1 optimised for power6.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C mpn_addmul_1 mpn_submul_1
-C cycles/limb cycles/limb
-C POWER3/PPC630 ? ?
-C POWER4/PPC970 ? ?
-C POWER5 ? ?
-C POWER6 12.25 12.8
-C POWER7 ? ?
-
-C TODO
-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 separately, without saving any registers.
-
-C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`n', `r5')
-define(`v0', `r6')
-
-ifdef(`OPERATION_addmul_1',`
- define(ADDSUBC, adde)
- define(ADDSUB, addc)
- define(func, mpn_addmul_1)
- define(func_nc, mpn_addmul_1c) C FIXME: not really supported
- define(AM, `$1')
- define(SM, `')
- define(CLRRSC, `addic $1, r0, 0')
-')
-ifdef(`OPERATION_submul_1',`
- define(ADDSUBC, subfe)
- define(ADDSUB, subfc)
- define(func, mpn_submul_1)
- define(func_nc, mpn_submul_1c) C FIXME: not really supported
- define(AM, `')
- define(SM, `$1')
- define(CLRRSC, `subfc $1, r0, r0')
-')
-
-ASM_START()
-PROLOGUE(func)
- std r31, -8(r1)
- std r30, -16(r1)
- std r29, -24(r1)
- std r28, -32(r1)
- std r27, -40(r1)
-
- 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 loop count into ctr
- beq cr0, L(b0)
- blt cr6, L(b1)
- beq cr6, L(b2)
-
-L(b3): ld r8, 0(up)
- ld r7, 8(up)
- ld r27, 16(up)
- addi up, up, 16
- addi rp, rp, 16
- mulld r5, r8, v0
- mulhdu r8, r8, v0
- mulld r9, r7, v0
- mulhdu r7, r7, v0
- mulld r11, r27, v0
- mulhdu r27, r27, v0
- ld r29, -16(rp)
- ld r30, -8(rp)
- ld r31, 0(rp)
- addc r9, r9, r8
- adde r11, r11, r7
- addze r12, r27
- ADDSUB r5, r5, r29
- b L(l3)
-
-L(b2): ld r7, 0(up)
- ld r27, 8(up)
- addi up, up, 8
- addi rp, rp, 8
- mulld r9, r7, v0
- mulhdu r7, r7, v0
- mulld r11, r27, v0
- mulhdu r27, r27, v0
- ld r30, -8(rp)
- ld r31, 0(rp)
- addc r11, r11, r7
- addze r12, r27
- ADDSUB r9, r9, r30
- b L(l2)
-
-L(b1): ld r27, 0(up)
- ld r31, 0(rp)
- mulld r11, r27, v0
- mulhdu r12, r27, v0
- ADDSUB r11, r11, r31
- b L(l1)
-
-L(b0): addi up, up, -8
- addi rp, rp, -8
- CLRRSC( r12) C clear r12 and clr/set cy
-
- ALIGN(32)
-L(top):
-SM(` subfe r11, r0, r0') C complement...
-SM(` addic r11, r11, 1') C ...carry flag
- ld r10, 8(up)
- ld r8, 16(up)
- ld r7, 24(up)
- ld r27, 32(up)
- addi up, up, 32
- addi rp, rp, 32
- mulld r0, r10, v0
- mulhdu r10, r10, v0
- mulld r5, r8, v0
- mulhdu r8, r8, v0
- mulld r9, r7, v0
- mulhdu r7, r7, v0
- mulld r11, r27, v0
- mulhdu r27, r27, v0
- ld r28, -24(rp)
- adde r0, r0, r12
- ld r29, -16(rp)
- adde r5, r5, r10
- ld r30, -8(rp)
- ld r31, 0(rp)
- adde r9, r9, r8
- adde r11, r11, r7
- addze r12, r27
- ADDSUB r0, r0, r28
- std r0, -24(rp)
- ADDSUBC r5, r5, r29
-L(l3): std r5, -16(rp)
- ADDSUBC r9, r9, r30
-L(l2): std r9, -8(rp)
- ADDSUBC r11, r11, r31
-L(l1): std r11, 0(rp)
- bdnz L(top)
-
-AM(` addze r3, r12')
-SM(` subfe r11, r0, r0') C complement...
- ld r31, -8(r1)
-SM(` subf r3, r11, r12')
- ld r30, -16(r1)
- ld r29, -24(r1)
- ld r28, -32(r1)
- ld r27, -40(r1)
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/p6/gmp-mparam.h b/gmp/mpn/powerpc64/mode64/p6/gmp-mparam.h
deleted file mode 100644
index c7e2f894ad..0000000000
--- a/gmp/mpn/powerpc64/mode64/p6/gmp-mparam.h
+++ /dev/null
@@ -1,160 +0,0 @@
-/* POWER6 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 3500 MHz POWER6 (kolga.bibsys.no) */
-
-#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 12
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 6
-#define USE_PREINV_DIVREM_1 0
-#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 20
-#define MUL_TOOM33_THRESHOLD 50
-#define MUL_TOOM44_THRESHOLD 106
-#define MUL_TOOM6H_THRESHOLD 274
-#define MUL_TOOM8H_THRESHOLD 339
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 62
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 76
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 66
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 88
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 24
-#define SQR_TOOM3_THRESHOLD 49
-#define SQR_TOOM4_THRESHOLD 130
-#define SQR_TOOM6_THRESHOLD 226
-#define SQR_TOOM8_THRESHOLD 272
-
-#define MULMID_TOOM42_THRESHOLD 36
-
-#define MULMOD_BNM1_THRESHOLD 14
-#define SQRMOD_BNM1_THRESHOLD 14
-
-#define MUL_FFT_MODF_THRESHOLD 380 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 340, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
- { 23, 7}, { 12, 6}, { 25, 7}, { 21, 8}, \
- { 11, 7}, { 24, 8}, { 13, 7}, { 27, 8}, \
- { 21, 9}, { 11, 8}, { 25, 9}, { 15, 8}, \
- { 33, 9}, { 23, 8}, { 47, 9}, { 27,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 63,10}, { 47,11}, \
- { 31,10}, { 71,11}, { 47,12}, { 31,11}, \
- { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
- { 135, 9}, { 271,11}, { 79, 9}, { 319, 8}, \
- { 639,10}, { 175,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 207,12}, { 63,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,11}, { 143,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}, \
- { 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 79
-#define MUL_FFT_THRESHOLD 3520
-
-#define SQR_FFT_MODF_THRESHOLD 308 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 280, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 21, 7}, { 11, 6}, { 23, 7}, { 21, 8}, \
- { 11, 7}, { 24, 8}, { 13, 7}, { 27, 8}, \
- { 21, 9}, { 11, 8}, { 25, 9}, { 15, 8}, \
- { 33, 9}, { 19, 8}, { 39, 9}, { 23, 8}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 47,11}, { 15,10}, { 31, 9}, \
- { 63,10}, { 47,11}, { 31,10}, { 71, 9}, \
- { 143,11}, { 47,12}, { 31,11}, { 63, 9}, \
- { 255, 8}, { 511, 9}, { 271,10}, { 143,11}, \
- { 79,10}, { 159, 9}, { 319,10}, { 175, 9}, \
- { 351,11}, { 95,10}, { 191, 9}, { 383,10}, \
- { 207,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511, 8}, { 1023,10}, { 271, 9}, { 543,11}, \
- { 143,10}, { 287, 9}, { 575,11}, { 159,10}, \
- { 319, 9}, { 639,11}, { 175,10}, { 351,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 80
-#define SQR_FFT_THRESHOLD 2752
-
-#define MULLO_BASECASE_THRESHOLD 5
-#define MULLO_DC_THRESHOLD 62
-#define MULLO_MUL_N_THRESHOLD 2995
-
-#define DC_DIV_QR_THRESHOLD 59
-#define DC_DIVAPPR_Q_THRESHOLD 200
-#define DC_BDIV_QR_THRESHOLD 70
-#define DC_BDIV_Q_THRESHOLD 168
-
-#define INV_MULMOD_BNM1_THRESHOLD 53
-#define INV_NEWTON_THRESHOLD 170
-#define INV_APPR_THRESHOLD 166
-
-#define BINV_NEWTON_THRESHOLD 220
-#define REDC_1_TO_REDC_N_THRESHOLD 67
-
-#define MU_DIV_QR_THRESHOLD 998
-#define MU_DIVAPPR_Q_THRESHOLD 942
-#define MUPI_DIV_QR_THRESHOLD 57
-#define MU_BDIV_QR_THRESHOLD 889
-#define MU_BDIV_Q_THRESHOLD 1078
-
-#define POWM_SEC_TABLE 4,26,216,804,1731
-
-#define MATRIX22_STRASSEN_THRESHOLD 13
-#define HGCD_THRESHOLD 106
-#define HGCD_APPR_THRESHOLD 109
-#define HGCD_REDUCE_THRESHOLD 2205
-#define GCD_DC_THRESHOLD 492
-#define GCDEXT_DC_THRESHOLD 327
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 16
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 537
-#define SET_STR_PRECOMPUTE_THRESHOLD 1576
-
-#define FAC_DSC_THRESHOLD 426
-#define FAC_ODD_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/powerpc64/mode64/p6/mul_basecase.asm b/gmp/mpn/powerpc64/mode64/p6/mul_basecase.asm
deleted file mode 100644
index 3d32b46c35..0000000000
--- a/gmp/mpn/powerpc64/mode64/p6/mul_basecase.asm
+++ /dev/null
@@ -1,589 +0,0 @@
-dnl PowerPC-64 mpn_mul_basecase.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 12.25
-
-C TODO
-C * Reduce register usage. At least 4 register less can be used.
-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 * The bdz insns for b1 and b2 will never branch,
-C * Align things better, perhaps by moving things like pointer updates from
-C before to after loops.
-
-C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`un', `r5')
-define(`vp', `r6')
-define(`vn', `r7')
-
-define(`v0', `r25')
-define(`outer_rp', `r22')
-define(`outer_up', `r23')
-
-ASM_START()
-PROLOGUE(mpn_mul_basecase)
-
-C Special code for un <= 2, for efficiency of these important cases,
-C and since it simplifies the default code.
- cmpdi cr0, un, 2
- bgt cr0, L(un_gt2)
- cmpdi cr6, vn, 1
- ld r7, 0(vp)
- ld r5, 0(up)
- mulld r8, r5, r7 C weight 0
- mulhdu r9, r5, r7 C weight 1
- std r8, 0(rp)
- beq cr0, L(2x)
- std r9, 8(rp)
- blr
- ALIGN(16)
-L(2x): ld r0, 8(up)
- mulld r8, r0, r7 C weight 1
- mulhdu r10, r0, r7 C weight 2
- addc r9, r9, r8
- addze r10, r10
- bne cr6, L(2x2)
- std r9, 8(rp)
- std r10, 16(rp)
- blr
- ALIGN(16)
-L(2x2): ld r6, 8(vp)
- nop
- mulld r8, r5, r6 C weight 1
- mulhdu r11, r5, r6 C weight 2
- mulld r12, r0, r6 C weight 2
- mulhdu r0, r0, r6 C weight 3
- addc r9, r9, r8
- std r9, 8(rp)
- adde r11, r11, r10
- addze r0, r0
- addc r11, r11, r12
- addze r0, r0
- std r11, 16(rp)
- std r0, 24(rp)
- blr
-
-L(un_gt2):
- std r31, -8(r1)
- std r30, -16(r1)
- std r29, -24(r1)
- std r28, -32(r1)
- std r27, -40(r1)
- std r26, -48(r1)
- std r25, -56(r1)
- std r24, -64(r1)
- std r23, -72(r1)
- std r22, -80(r1)
- std r21, -88(r1)
- std r20, -96(r1)
-
- mr outer_rp, rp
- mr outer_up, up
-
- ld v0, 0(vp) C new v limb
- addi vp, vp, 8
- ld r26, 0(up)
-
- rldicl. r0, un, 0,62 C r0 = n & 3, set cr0
- cmpdi cr6, r0, 2
- addi un, un, 4 C compute count...
- srdi un, un, 2 C ...for ctr
- mtctr un C copy inner loop count into ctr
- beq cr0, L(b0)
- blt cr6, L(b1)
- beq cr6, L(b2)
-
-
- ALIGN(16)
-L(b3):
- ld r27, 8(up)
- ld r20, 16(up)
- mulld r0, r26, v0
- mulhdu r31, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- mulld r9, r20, v0
- mulhdu r10, r20, v0
- addc r24, r24, r31
- adde r9, r9, r8
- addze r12, r10
- std r0, 0(rp)
- std r24, 8(rp)
- std r9, 16(rp)
- addi up, up, 16
- addi rp, rp, 16
- bdz L(end_m_3)
-
- ALIGN(32)
-L(lo_m_3):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up)
- ld r21, 32(up)
- mulld r0, r26, v0
- mulhdu r31, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- mulld r9, r20, v0
- mulhdu r27, r20, v0
- mulld r11, r21, v0
- mulhdu r26, r21, v0
- adde r0, r0, r12
- adde r24, r24, r31
- std r0, 8(rp)
- adde r9, r9, r8
- std r24, 16(rp)
- adde r11, r11, r27
- std r9, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- mr r12, r26
- bdnz L(lo_m_3)
-
- ALIGN(16)
-L(end_m_3):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- beq L(ret)
-
- ALIGN(16)
-L(outer_lo_3):
- mtctr un C copy inner loop count into ctr
- addi rp, outer_rp, 24
- addi up, outer_up, 16
- addi outer_rp, outer_rp, 8
- ld v0, 0(vp) C new v limb
- addi vp, vp, 8
- ld r26, -16(up)
- ld r27, -8(up)
- ld r20, 0(up)
- mulld r0, r26, v0
- mulhdu r31, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- mulld r9, r20, v0
- mulhdu r10, r20, v0
- ld r28, -16(rp)
- ld r29, -8(rp)
- ld r30, 0(rp)
- addc r24, r24, r31
- adde r9, r9, r8
- addze r12, r10
- addc r0, r0, r28
- std r0, -16(rp)
- adde r24, r24, r29
- std r24, -8(rp)
- adde r9, r9, r30
- std r9, 0(rp)
- bdz L(end_3)
-
- ALIGN(32) C registers dying
-L(lo_3):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up) C
- ld r21, 32(up) C
- addi up, up, 32 C
- addi rp, rp, 32 C
- mulld r0, r26, v0 C
- mulhdu r10, r26, v0 C 26
- mulld r24, r27, v0 C
- mulhdu r8, r27, v0 C 27
- mulld r9, r20, v0 C
- mulhdu r27, r20, v0 C 26
- mulld r11, r21, v0 C
- mulhdu r26, r21, v0 C 27
- ld r28, -24(rp) C
- adde r0, r0, r12 C 0 12
- ld r29, -16(rp) C
- adde r24, r24, r10 C 24 10
- ld r30, -8(rp) C
- ld r31, 0(rp) C
- adde r9, r9, r8 C 8 9
- adde r11, r11, r27 C 27 11
- addze r12, r26 C 26
- addc r0, r0, r28 C 0 28
- std r0, -24(rp) C 0
- adde r24, r24, r29 C 7 29
- std r24, -16(rp) C 7
- adde r9, r9, r30 C 9 30
- std r9, -8(rp) C 9
- adde r11, r11, r31 C 11 31
- std r11, 0(rp) C 11
- bdnz L(lo_3) C
-
- ALIGN(16)
-L(end_3):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- bne L(outer_lo_3)
- b L(ret)
-
-
- ALIGN(16)
-L(b1):
- mulld r0, r26, v0
- mulhdu r12, r26, v0
- addic r0, r0, 0
- std r0, 0(rp)
- bdz L(end_m_1)
-
- ALIGN(16)
-L(lo_m_1):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up)
- ld r21, 32(up)
- mulld r0, r26, v0
- mulhdu r31, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- mulld r9, r20, v0
- mulhdu r27, r20, v0
- mulld r11, r21, v0
- mulhdu r26, r21, v0
- adde r0, r0, r12
- adde r24, r24, r31
- std r0, 8(rp)
- adde r9, r9, r8
- std r24, 16(rp)
- adde r11, r11, r27
- std r9, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- mr r12, r26
- bdnz L(lo_m_1)
-
- ALIGN(16)
-L(end_m_1):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- beq L(ret)
-
- ALIGN(16)
-L(outer_lo_1):
- mtctr un C copy inner loop count into ctr
- addi rp, outer_rp, 8
- mr up, outer_up
- addi outer_rp, outer_rp, 8
- ld v0, 0(vp) C new v limb
- addi vp, vp, 8
- ld r26, 0(up)
- ld r28, 0(rp)
- mulld r0, r26, v0
- mulhdu r12, r26, v0
- addc r0, r0, r28
- std r0, 0(rp)
- bdz L(end_1)
-
- ALIGN(32) C registers dying
-L(lo_1):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up) C
- ld r21, 32(up) C
- addi up, up, 32 C
- addi rp, rp, 32 C
- mulld r0, r26, v0 C
- mulhdu r10, r26, v0 C 26
- mulld r24, r27, v0 C
- mulhdu r8, r27, v0 C 27
- mulld r9, r20, v0 C
- mulhdu r27, r20, v0 C 26
- mulld r11, r21, v0 C
- mulhdu r26, r21, v0 C 27
- ld r28, -24(rp) C
- adde r0, r0, r12 C 0 12
- ld r29, -16(rp) C
- adde r24, r24, r10 C 24 10
- ld r30, -8(rp) C
- ld r31, 0(rp) C
- adde r9, r9, r8 C 8 9
- adde r11, r11, r27 C 27 11
- addze r12, r26 C 26
- addc r0, r0, r28 C 0 28
- std r0, -24(rp) C 0
- adde r24, r24, r29 C 7 29
- std r24, -16(rp) C 7
- adde r9, r9, r30 C 9 30
- std r9, -8(rp) C 9
- adde r11, r11, r31 C 11 31
- std r11, 0(rp) C 11
- bdnz L(lo_1) C
-
- ALIGN(16)
-L(end_1):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- bne L(outer_lo_1)
- b L(ret)
-
-
- ALIGN(16)
-L(b0):
- addi up, up, -8
- addi rp, rp, -8
- li r12, 0
- addic r12, r12, 0
- bdz L(end_m_0)
-
- ALIGN(16)
-L(lo_m_0):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up)
- ld r21, 32(up)
- mulld r0, r26, v0
- mulhdu r31, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- mulld r9, r20, v0
- mulhdu r27, r20, v0
- mulld r11, r21, v0
- mulhdu r26, r21, v0
- adde r0, r0, r12
- adde r24, r24, r31
- std r0, 8(rp)
- adde r9, r9, r8
- std r24, 16(rp)
- adde r11, r11, r27
- std r9, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- mr r12, r26
- bdnz L(lo_m_0)
-
- ALIGN(16)
-L(end_m_0):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- beq L(ret)
-
- ALIGN(16)
-L(outer_lo_0):
- mtctr un C copy inner loop count into ctr
- addi rp, outer_rp, 0
- addi up, outer_up, -8
- addi outer_rp, outer_rp, 8
- ld v0, 0(vp) C new v limb
- addi vp, vp, 8
- li r12, 0
- addic r12, r12, 0
- bdz L(end_0)
-
- ALIGN(32) C registers dying
-L(lo_0):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up) C
- ld r21, 32(up) C
- addi up, up, 32 C
- addi rp, rp, 32 C
- mulld r0, r26, v0 C
- mulhdu r10, r26, v0 C 26
- mulld r24, r27, v0 C
- mulhdu r8, r27, v0 C 27
- mulld r9, r20, v0 C
- mulhdu r27, r20, v0 C 26
- mulld r11, r21, v0 C
- mulhdu r26, r21, v0 C 27
- ld r28, -24(rp) C
- adde r0, r0, r12 C 0 12
- ld r29, -16(rp) C
- adde r24, r24, r10 C 24 10
- ld r30, -8(rp) C
- ld r31, 0(rp) C
- adde r9, r9, r8 C 8 9
- adde r11, r11, r27 C 27 11
- addze r12, r26 C 26
- addc r0, r0, r28 C 0 28
- std r0, -24(rp) C 0
- adde r24, r24, r29 C 7 29
- std r24, -16(rp) C 7
- adde r9, r9, r30 C 9 30
- std r9, -8(rp) C 9
- adde r11, r11, r31 C 11 31
- std r11, 0(rp) C 11
- bdnz L(lo_0) C
-
- ALIGN(16)
-L(end_0):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- bne L(outer_lo_0)
- b L(ret)
-
-
- ALIGN(16)
-L(b2): ld r27, 8(up)
- addi up, up, 8
- mulld r0, r26, v0
- mulhdu r10, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- addc r24, r24, r10
- addze r12, r8
- std r0, 0(rp)
- std r24, 8(rp)
- addi rp, rp, 8
- bdz L(end_m_2)
-
- ALIGN(16)
-L(lo_m_2):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up)
- ld r21, 32(up)
- mulld r0, r26, v0
- mulhdu r31, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- mulld r9, r20, v0
- mulhdu r27, r20, v0
- mulld r11, r21, v0
- mulhdu r26, r21, v0
- adde r0, r0, r12
- adde r24, r24, r31
- std r0, 8(rp)
- adde r9, r9, r8
- std r24, 16(rp)
- adde r11, r11, r27
- std r9, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- mr r12, r26
- bdnz L(lo_m_2)
-
- ALIGN(16)
-L(end_m_2):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- beq L(ret)
-
- ALIGN(16)
-L(outer_lo_2):
- mtctr un C copy inner loop count into ctr
- addi rp, outer_rp, 16
- addi up, outer_up, 8
- addi outer_rp, outer_rp, 8
- ld v0, 0(vp) C new v limb
- addi vp, vp, 8
- ld r26, -8(up)
- ld r27, 0(up)
- ld r28, -8(rp)
- ld r29, 0(rp)
- mulld r0, r26, v0
- mulhdu r10, r26, v0
- mulld r24, r27, v0
- mulhdu r8, r27, v0
- addc r24, r24, r10
- addze r12, r8
- addc r0, r0, r28
- std r0, -8(rp)
- adde r24, r24, r29
- std r24, 0(rp)
- bdz L(end_2)
-
- ALIGN(16) C registers dying
-L(lo_2):
- ld r26, 8(up)
- ld r27, 16(up)
- ld r20, 24(up) C
- ld r21, 32(up) C
- addi up, up, 32 C
- addi rp, rp, 32 C
- mulld r0, r26, v0 C
- mulhdu r10, r26, v0 C 26
- mulld r24, r27, v0 C
- mulhdu r8, r27, v0 C 27
- mulld r9, r20, v0 C
- mulhdu r27, r20, v0 C 26
- mulld r11, r21, v0 C
- mulhdu r26, r21, v0 C 27
- ld r28, -24(rp) C
- adde r0, r0, r12 C 0 12
- ld r29, -16(rp) C
- adde r24, r24, r10 C 24 10
- ld r30, -8(rp) C
- ld r31, 0(rp) C
- adde r9, r9, r8 C 8 9
- adde r11, r11, r27 C 27 11
- addze r12, r26 C 26
- addc r0, r0, r28 C 0 28
- std r0, -24(rp) C 0
- adde r24, r24, r29 C 7 29
- std r24, -16(rp) C 7
- adde r9, r9, r30 C 9 30
- std r9, -8(rp) C 9
- adde r11, r11, r31 C 11 31
- std r11, 0(rp) C 11
- bdnz L(lo_2) C
-
- ALIGN(16)
-L(end_2):
- addze r12, r12
- addic. vn, vn, -1
- std r12, 8(rp)
- bne L(outer_lo_2)
-C b L(ret)
-
-L(ret): ld r31, -8(r1)
- ld r30, -16(r1)
- ld r29, -24(r1)
- ld r28, -32(r1)
- ld r27, -40(r1)
- ld r26, -48(r1)
- ld r25, -56(r1)
- ld r24, -64(r1)
- ld r23, -72(r1)
- ld r22, -80(r1)
- ld r21, -88(r1)
- ld r20, -96(r1)
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/p7/aormul_2.asm b/gmp/mpn/powerpc64/mode64/p7/aormul_2.asm
deleted file mode 100644
index 8731e01a89..0000000000
--- a/gmp/mpn/powerpc64/mode64/p7/aormul_2.asm
+++ /dev/null
@@ -1,135 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/p7/aors_n.asm b/gmp/mpn/powerpc64/mode64/p7/aors_n.asm
deleted file mode 100644
index 857c701dec..0000000000
--- a/gmp/mpn/powerpc64/mode64/p7/aors_n.asm
+++ /dev/null
@@ -1,128 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm b/gmp/mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm
deleted file mode 100644
index ddf5fd84b1..0000000000
--- a/gmp/mpn/powerpc64/mode64/p7/aorsorrlsh1_n.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm b/gmp/mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm
deleted file mode 100644
index 3f9d88d6ca..0000000000
--- a/gmp/mpn/powerpc64/mode64/p7/aorsorrlsh2_n.asm
+++ /dev/null
@@ -1,43 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm b/gmp/mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm
deleted file mode 100644
index 525120262f..0000000000
--- a/gmp/mpn/powerpc64/mode64/p7/aorsorrlshC_n.asm
+++ /dev/null
@@ -1,129 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/p7/gcd_1.asm b/gmp/mpn/powerpc64/mode64/p7/gcd_1.asm
deleted file mode 100644
index 47cb40bdc5..0000000000
--- a/gmp/mpn/powerpc64/mode64/p7/gcd_1.asm
+++ /dev/null
@@ -1,110 +0,0 @@
-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()
diff --git a/gmp/mpn/powerpc64/mode64/p7/gmp-mparam.h b/gmp/mpn/powerpc64/mode64/p7/gmp-mparam.h
deleted file mode 100644
index 7e719e8aac..0000000000
--- a/gmp/mpn/powerpc64/mode64/p7/gmp-mparam.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/* POWER7 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 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 6
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 8
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 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 28
-
-#define MUL_TOOM22_THRESHOLD 22
-#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 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 36
-#define SQR_TOOM3_THRESHOLD 109
-#define SQR_TOOM4_THRESHOLD 196
-#define SQR_TOOM6_THRESHOLD 414
-#define SQR_TOOM8_THRESHOLD 547
-
-#define MULMID_TOOM42_THRESHOLD 58
-
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 20
-
-#define MUL_FFT_MODF_THRESHOLD 412 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 412, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 21, 7}, { 11, 6}, { 23, 7}, { 12, 6}, \
- { 25, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
- { 13, 7}, { 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}, \
- { 47, 9}, { 27,10}, { 15, 9}, { 31, 8}, \
- { 63, 9}, { 43,10}, { 23, 9}, { 51,11}, \
- { 15,10}, { 31, 9}, { 67,10}, { 39, 9}, \
- { 79,10}, { 47, 9}, { 95,10}, { 55,11}, \
- { 31,10}, { 79,11}, { 47,10}, { 95,12}, \
- { 31,11}, { 63,10}, { 135,11}, { 79,10}, \
- { 159,11}, { 95,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 368 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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, 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,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 3
-#define MULLO_DC_THRESHOLD 34
-#define MULLO_MUL_N_THRESHOLD 9174
-
-#define DC_DIV_QR_THRESHOLD 33
-#define DC_DIVAPPR_Q_THRESHOLD 126
-#define DC_BDIV_QR_THRESHOLD 63
-#define DC_BDIV_Q_THRESHOLD 152
-
-#define INV_MULMOD_BNM1_THRESHOLD 54
-#define INV_NEWTON_THRESHOLD 155
-#define INV_APPR_THRESHOLD 125
-
-#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 1334
-#define MU_DIVAPPR_Q_THRESHOLD 1334
-#define MUPI_DIV_QR_THRESHOLD 54
-#define MU_BDIV_QR_THRESHOLD 1142
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define POWM_SEC_TABLE 1,14,62,642,960
-
-#define MATRIX22_STRASSEN_THRESHOLD 14
-#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 11
-#define GET_STR_PRECOMPUTE_THRESHOLD 17
-#define SET_STR_DC_THRESHOLD 1655
-#define SET_STR_PRECOMPUTE_THRESHOLD 3417
-
-#define FAC_DSC_THRESHOLD 1138
-#define FAC_ODD_THRESHOLD 27
diff --git a/gmp/mpn/powerpc64/mode64/rsh1add_n.asm b/gmp/mpn/powerpc64/mode64/rsh1add_n.asm
new file mode 100644
index 0000000000..0cd6cf4e8c
--- /dev/null
+++ b/gmp/mpn/powerpc64/mode64/rsh1add_n.asm
@@ -0,0 +1,104 @@
+dnl PowerPC-64 mpn_rsh1add_n -- rp[] = (up[] + vp[]) >> 1
+
+dnl Copyright 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 POWER3/PPC630: 2 (1.5 c/l should be possible)
+C POWER4/PPC970: 4 (2.0 c/l should be possible)
+
+C INPUT PARAMETERS
+C rp r3
+C up r4
+C vp r5
+C n r6
+
+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)
+
+L(oop): 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(exit)
+
+ 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(oop)
+
+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(exit): 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/gmp/mpn/powerpc64/mode64/rsh1aors_n.asm b/gmp/mpn/powerpc64/mode64/rsh1aors_n.asm
deleted file mode 100644
index 7f7734bcef..0000000000
--- a/gmp/mpn/powerpc64/mode64/rsh1aors_n.asm
+++ /dev/null
@@ -1,172 +0,0 @@
-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/gmp/mpn/powerpc64/mode64/rsh1sub_n.asm b/gmp/mpn/powerpc64/mode64/rsh1sub_n.asm
new file mode 100644
index 0000000000..e4c78ff2b5
--- /dev/null
+++ b/gmp/mpn/powerpc64/mode64/rsh1sub_n.asm
@@ -0,0 +1,102 @@
+dnl PowerPC-64 mpn_rsh1sub_n -- rp[] = (up[] - vp[]) >> 1
+
+dnl Copyright 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 POWER3/PPC630: 2 (1.5 c/l should be possible)
+C POWER4/PPC970: 4 (2.0 c/l should be possible)
+
+C INPUT PARAMETERS
+C rp r3
+C up r4
+C vp r5
+C n r6
+
+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)
+
+L(oop): 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(exit)
+
+ 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(oop)
+
+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(exit): 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()
diff --git a/gmp/mpn/powerpc64/mode64/sqr_basecase.asm b/gmp/mpn/powerpc64/mode64/sqr_basecase.asm
deleted file mode 100644
index e76bb8878d..0000000000
--- a/gmp/mpn/powerpc64/mode64/sqr_basecase.asm
+++ /dev/null
@@ -1,863 +0,0 @@
-dnl PowerPC-64 mpn_sqr_basecase.
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-C POWER5 8
-C POWER6 16.25
-C POWER7 3.77
-
-C NOTES
-C * This is very crude, cleanup!
-C * Try to reduce the number of needed live registers.
-C * Rewrite for POWER6 to use 8 consecutive muls, not 2 groups of 4. The
-C cost will be more live registers.
-C * Rewrite for POWER7 to use addmul_2 building blocks; this will reduce code
-C size a lot and speed things up perhaps 25%.
-C * Use computed goto in order to compress the code.
-C * Implement a larger final corner.
-C * Schedule callee-saves register saves into other insns. This could save
-C about 5 cycles/call. (We cannot analogously optimise the restores, since
-C the sqr_diag_addlsh1 loop has no wind-down code as currently written.)
-C * Should the alternating std/adde sequences be split? Some pipelines handle
-C adde poorly, and might sequentialise all these instructions.
-C * The sqr_diag_addlsh1 loop was written for POWER6 and its preferences for
-C adjacent integer multiply insns. Except for the multiply insns, the code
-C was not carefully optimised for POWER6 or any other CPU.
-C * Perform cross-jumping in sqr_diag_addlsh1's feed-in code, into the loop.
-
-C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`n', `r5')
-
-define(`rp_outer', `r25')
-define(`up_outer', `r21')
-define(`rp_saved', `r22')
-define(`up_saved', `r23')
-define(`n_saved', `r24')
-
-ASM_START()
-PROLOGUE(mpn_sqr_basecase)
- cmpdi cr0, n, 2
- bge cr0, L(ge2)
- ld r5, 0(up) C n = 1
- nop
- mulld r8, r5, r5 C weight 0
- mulhdu r9, r5, r5 C weight 1
- std r8, 0(rp)
- std r9, 8(rp)
- blr
- ALIGN(16)
-L(ge2): bgt cr0, L(gt2)
- ld r0, 0(up) C n = 2
- nop
- mulld r8, r0, r0 C u0 * u0
- mulhdu r9, r0, r0 C u0 * u0
- ld r6, 8(up)
- mulld r10, r6, r6 C u1 * u1
- mulhdu r11, r6, r6 C u1 * u1
- mulld r4, r6, r0 C u1 * u0
- mulhdu r5, r6, r0 C u1 * u0
- addc r4, r4, r4
- adde r5, r5, r5
- addze r11, r11
- addc r9, r9, r4
- adde r10, r10, r5
- addze r11, r11
- std r8, 0(rp)
- std r9, 8(rp)
- std r10, 16(rp)
- std r11, 24(rp)
- blr
-
- ALIGN(16)
-L(gt2): std r31, -8(r1)
- std r30, -16(r1)
- std r29, -24(r1)
- std r28, -32(r1)
- std r27, -40(r1)
- std r26, -48(r1)
- std r25, -56(r1)
- std r24, -64(r1)
- std r23, -72(r1)
- std r22, -80(r1)
- std r21, -88(r1)
-
- mr rp_saved, rp
- mr up_saved, up
- mr n_saved, n
- mr rp_outer, rp
- mr up_outer, up
-
- rldicl. r0, n, 0,62 C r0 = n & 3, set cr0
- cmpdi cr6, r0, 2
- addic r7, n, 2 C compute count...
- srdi r7, r7, 2 C ...for ctr
- mtctr r7 C copy count into ctr
- beq- cr0, L(b0)
- blt- cr6, L(b1)
- beq- cr6, L(b2)
-
-L(b3): ld r6, 0(up)
- ld r9, 8(up)
- ld r27, 16(up)
- addi up, up, 24
- li r12, 0 C carry limb
- bdz L(em3)
-
- ALIGN(16)
-L(tm3): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r9, 0(up)
- ld r27, 8(up)
- adde r0, r0, r12
- adde r7, r7, r26
- mulld r26, r9, r6
- mulhdu r10, r9, r6
- mulld r11, r27, r6
- mulhdu r12, r27, r6
- ld r9, 16(up)
- ld r27, 24(up)
- std r0, 8(rp)
- adde r26, r26, r8
- std r7, 16(rp)
- adde r11, r11, r10
- std r26, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- bdnz L(tm3)
-
-L(em3): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- adde r0, r0, r12
- adde r7, r7, r26
- std r0, 8(rp)
- std r7, 16(rp)
- addze r8, r8
- std r8, 24(rp)
- addi n, n, 2
- b L(outer_loop)
-
-L(b0): ld r6, 0(up)
- ld r27, 8(up)
- mulld r7, r27, r6
- mulhdu r12, r27, r6
- std r7, 8(rp)
- addi rp, rp, 8
- ld r9, 16(up)
- ld r27, 24(up)
- addi up, up, 32
- bdz L(em0)
-
- ALIGN(16)
-L(tm0): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r9, 0(up)
- ld r27, 8(up)
- adde r0, r0, r12
- adde r7, r7, r26
- mulld r26, r9, r6
- mulhdu r10, r9, r6
- mulld r11, r27, r6
- mulhdu r12, r27, r6
- ld r9, 16(up)
- ld r27, 24(up)
- std r0, 8(rp)
- adde r26, r26, r8
- std r7, 16(rp)
- adde r11, r11, r10
- std r26, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- bdnz L(tm0)
-
-L(em0): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- adde r0, r0, r12
- adde r7, r7, r26
- std r0, 8(rp)
- std r7, 16(rp)
- addze r8, r8
- std r8, 24(rp)
- addi n, n, 2
- b L(outer_loop_ent_2)
-
-L(b1): ld r6, 0(up)
- ld r9, 8(up)
- ld r27, 16(up)
- mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r12, r27, r6
- addc r7, r7, r26
- std r0, 8(rp)
- std r7, 16(rp)
- addi rp, rp, 16
- ld r9, 24(up)
- ld r27, 32(up)
- addi up, up, 40
- bdz L(em1)
-
- ALIGN(16)
-L(tm1): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r9, 0(up)
- ld r27, 8(up)
- adde r0, r0, r12
- adde r7, r7, r26
- mulld r26, r9, r6
- mulhdu r10, r9, r6
- mulld r11, r27, r6
- mulhdu r12, r27, r6
- ld r9, 16(up)
- ld r27, 24(up)
- std r0, 8(rp)
- adde r26, r26, r8
- std r7, 16(rp)
- adde r11, r11, r10
- std r26, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- bdnz L(tm1)
-
-L(em1): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- adde r0, r0, r12
- adde r7, r7, r26
- std r0, 8(rp)
- std r7, 16(rp)
- addze r8, r8
- std r8, 24(rp)
- addi n, n, 2
- b L(outer_loop_ent_3)
-
-L(b2): addi r7, r7, -1 C FIXME
- mtctr r7 C FIXME
- ld r6, 0(up)
- ld r9, 8(up)
- ld r27, 16(up)
- mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r9, 24(up)
- mulld r11, r9, r6
- mulhdu r10, r9, r6
- addc r7, r7, r26
- adde r11, r11, r8
- addze r12, r10
- std r0, 8(rp)
- std r7, 16(rp)
- std r11, 24(rp)
- addi rp, rp, 24
- ld r9, 32(up)
- ld r27, 40(up)
- addi up, up, 48
- bdz L(em2)
-
- ALIGN(16)
-L(tm2): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r9, 0(up)
- ld r27, 8(up)
- adde r0, r0, r12
- adde r7, r7, r26
- mulld r26, r9, r6
- mulhdu r10, r9, r6
- mulld r11, r27, r6
- mulhdu r12, r27, r6
- ld r9, 16(up)
- ld r27, 24(up)
- std r0, 8(rp)
- adde r26, r26, r8
- std r7, 16(rp)
- adde r11, r11, r10
- std r26, 24(rp)
- addi up, up, 32
- std r11, 32(rp)
- addi rp, rp, 32
- bdnz L(tm2)
-
-L(em2): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- adde r0, r0, r12
- adde r7, r7, r26
- std r0, 8(rp)
- std r7, 16(rp)
- addze r8, r8
- std r8, 24(rp)
- addi n, n, 2
- b L(outer_loop_ent_0)
-
-
-L(outer_loop):
- addi n, n, -1
- addi up_outer, up_outer, 8
- addi rp_outer, rp_outer, 16
-
- mr up, up_outer
- addi rp, rp_outer, 8
-
- srdi r0, n, 2
- mtctr r0
-
- bdz L(outer_end)
-
- ld r6, 0(up)
- ld r9, 8(up)
- ld r27, 16(up)
- mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r9, 24(up)
- ld r28, 0(rp)
- ld r29, 8(rp)
- ld r30, 16(rp)
- mulld r11, r9, r6
- mulhdu r10, r9, r6
- addc r7, r7, r26
- adde r11, r11, r8
- addze r12, r10
- addc r0, r0, r28
- std r0, 0(rp)
- adde r7, r7, r29
- std r7, 8(rp)
- adde r11, r11, r30
- std r11, 16(rp)
- addi rp, rp, 24
- ld r9, 32(up)
- ld r27, 40(up)
- addi up, up, 48
- bdz L(ea1)
-
- ALIGN(16)
-L(ta1): mulld r0, r9, r6
- mulhdu r26, r9, r6 C 9
- mulld r7, r27, r6
- mulhdu r8, r27, r6 C 27
- ld r9, 0(up)
- ld r28, 0(rp)
- ld r27, 8(up)
- ld r29, 8(rp)
- adde r0, r0, r12 C 0 12
- adde r7, r7, r26 C 5 7
- mulld r26, r9, r6
- mulhdu r10, r9, r6 C 9
- mulld r11, r27, r6
- mulhdu r12, r27, r6 C 27
- ld r9, 16(up)
- ld r30, 16(rp)
- ld r27, 24(up)
- ld r31, 24(rp)
- adde r26, r26, r8 C 8 5
- adde r11, r11, r10 C 10 11
- addze r12, r12 C 12
- addc r0, r0, r28 C 0 28
- std r0, 0(rp) C 0
- adde r7, r7, r29 C 7 29
- std r7, 8(rp) C 7
- adde r26, r26, r30 C 5 30
- std r26, 16(rp) C 5
- adde r11, r11, r31 C 11 31
- std r11, 24(rp) C 11
- addi up, up, 32
- addi rp, rp, 32
- bdnz L(ta1)
-
-L(ea1): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r28, 0(rp)
- ld r29, 8(rp)
- adde r0, r0, r12
- adde r7, r7, r26
- addze r8, r8
- addc r0, r0, r28
- std r0, 0(rp)
- adde r7, r7, r29
- std r7, 8(rp)
- addze r8, r8
- std r8, 16(rp)
-
-L(outer_loop_ent_0):
- addi n, n, -1
- addi up_outer, up_outer, 8
- addi rp_outer, rp_outer, 16
-
- mr up, up_outer
- addi rp, rp_outer, 8
-
- srdi r0, n, 2
- mtctr r0
-
- ld r6, 0(up)
- ld r9, 8(up)
- ld r27, 16(up)
- ld r28, 0(rp)
- ld r29, 8(rp)
- mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- addc r0, r0, r28
- adde r7, r7, r26
- addze r12, r8
- std r0, 0(rp)
- adde r7, r7, r29
- std r7, 8(rp)
- addi rp, rp, 16
- ld r9, 24(up)
- ld r27, 32(up)
- addi up, up, 40
- bdz L(ea0)
-
- ALIGN(16)
-L(ta0): mulld r0, r9, r6
- mulhdu r26, r9, r6 C 9
- mulld r7, r27, r6
- mulhdu r8, r27, r6 C 27
- ld r9, 0(up)
- ld r28, 0(rp)
- ld r27, 8(up)
- ld r29, 8(rp)
- adde r0, r0, r12 C 0 12
- adde r7, r7, r26 C 5 7
- mulld r26, r9, r6
- mulhdu r10, r9, r6 C 9
- mulld r11, r27, r6
- mulhdu r12, r27, r6 C 27
- ld r9, 16(up)
- ld r30, 16(rp)
- ld r27, 24(up)
- ld r31, 24(rp)
- adde r26, r26, r8 C 8 5
- adde r11, r11, r10 C 10 11
- addze r12, r12 C 12
- addc r0, r0, r28 C 0 28
- std r0, 0(rp) C 0
- adde r7, r7, r29 C 7 29
- std r7, 8(rp) C 7
- adde r26, r26, r30 C 5 30
- std r26, 16(rp) C 5
- adde r11, r11, r31 C 11 31
- std r11, 24(rp) C 11
- addi up, up, 32
- addi rp, rp, 32
- bdnz L(ta0)
-
-L(ea0): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r28, 0(rp)
- ld r29, 8(rp)
- adde r0, r0, r12
- adde r7, r7, r26
- addze r8, r8
- addc r0, r0, r28
- std r0, 0(rp)
- adde r7, r7, r29
- std r7, 8(rp)
- addze r8, r8
- std r8, 16(rp)
-
-L(outer_loop_ent_3):
- addi n, n, -1
- addi up_outer, up_outer, 8
- addi rp_outer, rp_outer, 16
-
- mr up, up_outer
- addi rp, rp_outer, 8
-
- srdi r0, n, 2
- mtctr r0
-
- ld r6, 0(up)
- ld r9, 8(up)
- ld r28, 0(rp)
- mulld r0, r9, r6
- mulhdu r12, r9, r6
- addc r0, r0, r28
- std r0, 0(rp)
- addi rp, rp, 8
- ld r9, 16(up)
- ld r27, 24(up)
- addi up, up, 32
- bdz L(ea3)
-
- ALIGN(16)
-L(ta3): mulld r0, r9, r6
- mulhdu r26, r9, r6 C 9
- mulld r7, r27, r6
- mulhdu r8, r27, r6 C 27
- ld r9, 0(up)
- ld r28, 0(rp)
- ld r27, 8(up)
- ld r29, 8(rp)
- adde r0, r0, r12 C 0 12
- adde r7, r7, r26 C 5 7
- mulld r26, r9, r6
- mulhdu r10, r9, r6 C 9
- mulld r11, r27, r6
- mulhdu r12, r27, r6 C 27
- ld r9, 16(up)
- ld r30, 16(rp)
- ld r27, 24(up)
- ld r31, 24(rp)
- adde r26, r26, r8 C 8 5
- adde r11, r11, r10 C 10 11
- addze r12, r12 C 12
- addc r0, r0, r28 C 0 28
- std r0, 0(rp) C 0
- adde r7, r7, r29 C 7 29
- std r7, 8(rp) C 7
- adde r26, r26, r30 C 5 30
- std r26, 16(rp) C 5
- adde r11, r11, r31 C 11 31
- std r11, 24(rp) C 11
- addi up, up, 32
- addi rp, rp, 32
- bdnz L(ta3)
-
-L(ea3): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r28, 0(rp)
- ld r29, 8(rp)
- adde r0, r0, r12
- adde r7, r7, r26
- addze r8, r8
- addc r0, r0, r28
- std r0, 0(rp)
- adde r7, r7, r29
- std r7, 8(rp)
- addze r8, r8
- std r8, 16(rp)
-
-
-L(outer_loop_ent_2):
- addi n, n, -1
- addi up_outer, up_outer, 8
- addi rp_outer, rp_outer, 16
-
- mr up, up_outer
- addi rp, rp_outer, 8
-
- srdi r0, n, 2
- mtctr r0
-
- addic r0, r0, 0
- li r12, 0 C cy_limb = 0
- ld r6, 0(up)
- ld r9, 8(up)
- ld r27, 16(up)
- bdz L(ea2)
- addi up, up, 24
-
- ALIGN(16)
-L(ta2): mulld r0, r9, r6
- mulhdu r26, r9, r6 C 9
- mulld r7, r27, r6
- mulhdu r8, r27, r6 C 27
- ld r9, 0(up)
- ld r28, 0(rp)
- ld r27, 8(up)
- ld r29, 8(rp)
- adde r0, r0, r12 C 0 12
- adde r7, r7, r26 C 5 7
- mulld r26, r9, r6
- mulhdu r10, r9, r6 C 9
- mulld r11, r27, r6
- mulhdu r12, r27, r6 C 27
- ld r9, 16(up)
- ld r30, 16(rp)
- ld r27, 24(up)
- ld r31, 24(rp)
- adde r26, r26, r8 C 8 5
- adde r11, r11, r10 C 10 11
- addze r12, r12 C 12
- addc r0, r0, r28 C 0 28
- std r0, 0(rp) C 0
- adde r7, r7, r29 C 7 29
- std r7, 8(rp) C 7
- adde r26, r26, r30 C 5 30
- std r26, 16(rp) C 5
- adde r11, r11, r31 C 11 31
- std r11, 24(rp) C 11
- addi up, up, 32
- addi rp, rp, 32
- bdnz L(ta2)
-
-L(ea2): mulld r0, r9, r6
- mulhdu r26, r9, r6
- mulld r7, r27, r6
- mulhdu r8, r27, r6
- ld r28, 0(rp)
- ld r29, 8(rp)
- adde r0, r0, r12
- adde r7, r7, r26
- addze r8, r8
- addc r0, r0, r28
- std r0, 0(rp)
- adde r7, r7, r29
- std r7, 8(rp)
- addze r8, r8
- std r8, 16(rp)
-
- b L(outer_loop)
-
-L(outer_end):
- ld r6, 0(up)
- ld r9, 8(up)
- ld r11, 0(rp)
- mulld r0, r9, r6
- mulhdu r8, r9, r6
- addc r0, r0, r11
- std r0, 0(rp)
- addze r8, r8
- std r8, 8(rp)
-
-define(`rp', `rp_saved')
-define(`up', `r5')
-define(`n', `r6')
-define(`climb', `r0')
-
- addi r4, rp_saved, 8
- mr r5, up_saved
- mr r6, n_saved
-
- rldicl. r0, n, 0,62 C r0 = n & 3, set cr0
- cmpdi cr6, r0, 2
- addi n, n, 2 C compute count...
- srdi n, n, 2 C ...for ctr
- mtctr n C put loop count into ctr
- beq cr0, L(xb0)
- blt cr6, L(xb1)
- beq cr6, L(xb2)
-
-L(xb3): ld r6, 0(up)
- ld r7, 8(up)
- ld r12, 16(up)
- addi up, up, 24
- mulld r24, r6, r6
- mulhdu r25, r6, r6
- mulld r26, r7, r7
- mulhdu r27, r7, r7
- mulld r28, r12, r12
- mulhdu r29, r12, r12
- ld r10, 8(rp)
- ld r11, 16(rp)
- ld r6, 24(rp)
- ld r7, 32(rp)
- addc r10, r10, r10
- adde r11, r11, r11
- adde r6, r6, r6
- adde r7, r7, r7
- addze climb, r29
- addc r10, r10, r25
- adde r11, r11, r26
- adde r6, r6, r27
- adde r7, r7, r28
- std r24, 0(rp)
- std r10, 8(rp)
- std r11, 16(rp)
- std r6, 24(rp)
- std r7, 32(rp)
- addi rp, rp, 40
- bdnz L(top)
- b L(end)
-
-L(xb2): ld r6, 0(up)
- ld r7, 8(up)
- addi up, up, 16
- mulld r24, r6, r6
- mulhdu r25, r6, r6
- mulld r26, r7, r7
- mulhdu r27, r7, r7
- ld r10, 8(rp)
- ld r11, 16(rp)
- addc r10, r10, r10
- adde r11, r11, r11
- addze climb, r27
- addc r10, r10, r25
- adde r11, r11, r26
- std r24, 0(rp)
- std r10, 8(rp)
- std r11, 16(rp)
- addi rp, rp, 24
- bdnz L(top)
- b L(end)
-
-L(xb0): ld r6, 0(up)
- ld r7, 8(up)
- ld r12, 16(up)
- ld r23, 24(up)
- addi up, up, 32
- mulld r24, r6, r6
- mulhdu r25, r6, r6
- mulld r26, r7, r7
- mulhdu r27, r7, r7
- mulld r28, r12, r12
- mulhdu r29, r12, r12
- mulld r30, r23, r23
- mulhdu r31, r23, r23
- ld r10, 8(rp)
- ld r11, 16(rp)
- ld r6, 24(rp)
- ld r7, 32(rp)
- ld r12, 40(rp)
- ld r23, 48(rp)
- addc r10, r10, r10
- adde r11, r11, r11
- adde r6, r6, r6
- adde r7, r7, r7
- adde r12, r12, r12
- adde r23, r23, r23
- addze climb, r31
- std r24, 0(rp)
- addc r10, r10, r25
- std r10, 8(rp)
- adde r11, r11, r26
- std r11, 16(rp)
- adde r6, r6, r27
- std r6, 24(rp)
- adde r7, r7, r28
- std r7, 32(rp)
- adde r12, r12, r29
- std r12, 40(rp)
- adde r23, r23, r30
- std r23, 48(rp)
- addi rp, rp, 56
- bdnz L(top)
- b L(end)
-
-L(xb1): ld r6, 0(up)
- addi up, up, 8
- mulld r24, r6, r6
- mulhdu climb, r6, r6
- std r24, 0(rp)
- addic rp, rp, 8 C clear carry as side-effect
-
- ALIGN(32)
-L(top): ld r6, 0(up)
- ld r7, 8(up)
- ld r12, 16(up)
- ld r23, 24(up)
- addi up, up, 32
- mulld r24, r6, r6
- mulhdu r25, r6, r6
- mulld r26, r7, r7
- mulhdu r27, r7, r7
- mulld r28, r12, r12
- mulhdu r29, r12, r12
- mulld r30, r23, r23
- mulhdu r31, r23, r23
- ld r8, 0(rp)
- ld r9, 8(rp)
- adde r8, r8, r8
- adde r9, r9, r9
- ld r10, 16(rp)
- ld r11, 24(rp)
- adde r10, r10, r10
- adde r11, r11, r11
- ld r6, 32(rp)
- ld r7, 40(rp)
- adde r6, r6, r6
- adde r7, r7, r7
- ld r12, 48(rp)
- ld r23, 56(rp)
- adde r12, r12, r12
- adde r23, r23, r23
- addze r31, r31
- addc r8, r8, climb
- std r8, 0(rp)
- adde r9, r9, r24
- std r9, 8(rp)
- adde r10, r10, r25
- std r10, 16(rp)
- adde r11, r11, r26
- std r11, 24(rp)
- adde r6, r6, r27
- std r6, 32(rp)
- adde r7, r7, r28
- std r7, 40(rp)
- adde r12, r12, r29
- std r12, 48(rp)
- adde r23, r23, r30
- std r23, 56(rp)
- mr climb, r31
- addi rp, rp, 64
- bdnz L(top)
-
-L(end): addze climb, climb
- std climb, 0(rp)
-
- ld r31, -8(r1)
- ld r30, -16(r1)
- ld r29, -24(r1)
- ld r28, -32(r1)
- ld r27, -40(r1)
- ld r26, -48(r1)
- ld r25, -56(r1)
- ld r24, -64(r1)
- ld r23, -72(r1)
- ld r22, -80(r1)
- ld r21, -88(r1)
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/sublsh1_n.asm b/gmp/mpn/powerpc64/mode64/sublsh1_n.asm
new file mode 100644
index 0000000000..69e0dfa5a2
--- /dev/null
+++ b/gmp/mpn/powerpc64/mode64/sublsh1_n.asm
@@ -0,0 +1,83 @@
+dnl PowerPC-64 mpn_sublsh1_n -- rp[] = up[] - (vp[] << 1)
+
+dnl Copyright 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 POWER3/PPC630: 2 (1.5 c/l should be possible)
+C POWER4/PPC970: 4 (2.0 c/l should be possible)
+
+C INPUT PARAMETERS
+C rp r3
+C up r4
+C vp r5
+C n r6
+
+define(`rp',`r3')
+define(`up',`r4')
+define(`vp',`r5')
+
+define(`s0',`r6')
+define(`s1',`r7')
+define(`u0',`r8')
+define(`v0',`r10')
+define(`v1',`r11')
+
+ASM_START()
+PROLOGUE(mpn_sublsh1_n)
+ mtctr r6 C put n in ctr
+
+ ld v0, 0(vp) C load v limb
+ ld u0, 0(up) C load u limb
+ addic up, up, -8 C update up; set cy
+ addi rp, rp, -8 C update rp
+ sldi s1, v0, 1
+ bdz L(end) C If done, skip loop
+
+L(oop): ld v1, 8(vp) C load v limb
+ subfe s1, s1, u0 C add limbs with cy, set cy
+ std s1, 8(rp) C store result limb
+ srdi s0, v0, 63 C shift down previous v limb
+ ldu u0, 16(up) C load u limb and update up
+ rldimi s0, v1, 1, 0 C left shift v limb and merge with prev v limb
+
+ bdz L(exit) C decrement ctr and exit if done
+
+ ldu v0, 16(vp) C load v limb and update vp
+ subfe s0, s0, u0 C add limbs with cy, set cy
+ stdu s0, 16(rp) C store result limb and update rp
+ srdi s1, v1, 63 C shift down previous v limb
+ ld u0, 8(up) C load u limb
+ rldimi s1, v0, 1, 0 C left shift v limb and merge with prev v limb
+
+ bdnz L(oop) C decrement ctr and loop back
+
+L(end): subfe r7, s1, u0
+ std r7, 8(rp) C store last result limb
+ srdi r3, v0, 63
+ subfze r3, r3
+ neg r3, r3
+ blr
+L(exit): subfe r7, s0, u0
+ std r7, 16(rp) C store last result limb
+ srdi r3, v1, 63
+ subfze r3, r3
+ neg r3, r3
+ blr
+EPILOGUE()
diff --git a/gmp/mpn/powerpc64/mode64/submul_1.asm b/gmp/mpn/powerpc64/mode64/submul_1.asm
new file mode 100644
index 0000000000..3c1e8a5c82
--- /dev/null
+++ b/gmp/mpn/powerpc64/mode64/submul_1.asm
@@ -0,0 +1,62 @@
+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, 2004, 2005, 2006 Free Software
+dnl 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: 6-18
+C POWER4/PPC970: 10
+C POWER5: 10.5
+
+C INPUT PARAMETERS
+define(`rp', `r3')
+define(`up', `r4')
+define(`n', `r5')
+define(`vl', `r6')
+define(`cy', `r7')
+
+ASM_START()
+PROLOGUE(mpn_submul_1)
+ li cy, 0 C cy_limb = 0
+
+PROLOGUE(mpn_submul_1c)
+ mtctr n
+ addic r0, r0, 0
+ addi rp, rp, -8
+ ALIGN(16)
+L(top):
+ ld r0, 0(up)
+ ld r10, 8(rp)
+ mulld r9, r0, vl
+ mulhdu r5, r0, vl
+ adde r9, r9, cy
+ addi up, up, 8
+ addze cy, r5
+ subf r12, r9, r10
+ not r0, r10
+ addc r11, r9, r0 C inverted carry from subf
+ stdu r12, 8(rp)
+ bdnz L(top)
+
+ addze r3, cy
+ blr
+EPILOGUE(mpn_submul_1)
+EPILOGUE(mpn_submul_1c)
diff --git a/gmp/mpn/powerpc64/p6/lshift.asm b/gmp/mpn/powerpc64/p6/lshift.asm
deleted file mode 100644
index 1a200fb346..0000000000
--- a/gmp/mpn/powerpc64/p6/lshift.asm
+++ /dev/null
@@ -1,132 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 2.25
-C POWER6 4
-
-C TODO
-C * Micro-optimise header code
-C * Perhaps do 4-way unrolling, for 2.5 c/l on POWER6. The code is 4236
-C bytes, 4-way code would become about 50% larger.
-
-C INPUT PARAMETERS
-define(`rp_param', `r3')
-define(`up', `r4')
-define(`n', `r5')
-define(`cnt', `r6')
-
-define(`tnc',`r0')
-define(`retval',`r3')
-define(`rp', `r7')
-
-ASM_START()
-PROLOGUE(mpn_lshift,toc)
-
-ifdef(`HAVE_ABI_mode32',`
- rldicl n, n, 0,32 C FIXME: avoid this zero extend
-')
- mflr r12
- sldi r8, n, 3
- sldi r10, cnt, 6 C multiply cnt by size of a SHIFT block
- LEAL( r11, L(e1)) C address of L(e1) label in SHIFT(1)
- add up, up, r8 C make up point at end of up[]
- add r11, r11, r10 C address of L(oN) for N = cnt
- srdi r10, n, 1
- add rp, rp_param, r8 C make rp point at end of rp[]
- subfic tnc, cnt, 64
- rlwinm. r8, n, 0,31,31 C extract bit 0
- mtctr r10
- beq L(evn)
-
-L(odd): ld r9, -8(up)
- cmpdi cr0, n, 1 C n = 1?
- beq L(1)
- ld r8, -16(up)
- addi r11, r11, -84 C L(o1) - L(e1) - 64
- mtlr r11
- srd r3, r9, tnc C retval
- addi up, up, 8
- addi rp, rp, -8
- blr C branch to L(oN)
-
-L(evn): ld r8, -8(up)
- ld r9, -16(up)
- addi r11, r11, -64
- mtlr r11
- srd r3, r8, tnc C retval
- blr C branch to L(eN)
-
-L(1): srd r3, r9, tnc C retval
- sld r8, r9, cnt
- std r8, -8(rp)
- mtlr r12
-ifdef(`HAVE_ABI_mode32',
-` mr r4, r3
- srdi r3, r3, 32
-')
- blr
-
-
-define(SHIFT,`
-L(lo$1):ld r8, -24(up)
- std r11, -8(rp)
- addi rp, rp, -16
-L(o$1): srdi r10, r8, eval(64-$1)
- rldimi r10, r9, $1, 0
- ld r9, -32(up)
- addi up, up, -16
- std r10, 0(rp)
-L(e$1): srdi r11, r9, eval(64-$1)
- rldimi r11, r8, $1, 0
- bdnz L(lo$1)
- std r11, -8(rp)
- sldi r10, r9, $1
- b L(com)
- nop
- nop
-')
-
- ALIGN(64)
-forloop(`i',1,63,`SHIFT(i)')
-
-L(com): std r10, -16(rp)
- mtlr r12
-ifdef(`HAVE_ABI_mode32',
-` mr r4, r3
- srdi r3, r3, 32
-')
- blr
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/powerpc64/p6/lshiftc.asm b/gmp/mpn/powerpc64/p6/lshiftc.asm
deleted file mode 100644
index e4b3caaab8..0000000000
--- a/gmp/mpn/powerpc64/p6/lshiftc.asm
+++ /dev/null
@@ -1,136 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 2.25
-C POWER6 4
-
-C TODO
-C * Micro-optimise header code
-C * Perhaps do 4-way unrolling, for 2.5 c/l on POWER6. The code is 4236
-C bytes, 4-way code would become about 50% larger.
-
-C INPUT PARAMETERS
-define(`rp_param', `r3')
-define(`up', `r4')
-define(`n', `r5')
-define(`cnt', `r6')
-
-define(`tnc',`r0')
-define(`retval',`r3')
-define(`rp', `r7')
-
-ASM_START()
-PROLOGUE(mpn_lshiftc,toc)
-
-ifdef(`HAVE_ABI_mode32',`
- rldicl n, n, 0,32 C FIXME: avoid this zero extend
-')
- mflr r12
- sldi r8, n, 3
- sldi r10, cnt, 6 C multiply cnt by size of a SHIFT block
- LEAL( r11, L(e1)) C address of L(e1) label in SHIFT(1)
- add up, up, r8 C make up point at end of up[]
- add r11, r11, r10 C address of L(oN) for N = cnt
- srdi r10, n, 1
- add rp, rp_param, r8 C make rp point at end of rp[]
- subfic tnc, cnt, 64
- rlwinm. r8, n, 0,31,31 C extract bit 0
- mtctr r10
- beq L(evn)
-
-L(odd): ld r9, -8(up)
- cmpdi cr0, n, 1 C n = 1?
- beq L(1)
- ld r8, -16(up)
- addi r11, r11, -88 C L(o1) - L(e1) - 64
- mtlr r11
- srd r3, r9, tnc C retval
- addi up, up, 8
- addi rp, rp, -8
- blr C branch to L(oN)
-
-L(evn): ld r8, -8(up)
- ld r9, -16(up)
- addi r11, r11, -64
- mtlr r11
- srd r3, r8, tnc C retval
- blr C branch to L(eN)
-
-L(1): srd r3, r9, tnc C retval
- sld r8, r9, cnt
- nor r8, r8, r8
- std r8, -8(rp)
- mtlr r12
-ifdef(`HAVE_ABI_mode32',
-` mr r4, r3
- srdi r3, r3, 32
-')
- blr
-
-
-define(SHIFT,`
-L(lo$1):ld r8, -24(up)
- nor r11, r11, r11
- std r11, -8(rp)
- addi rp, rp, -16
-L(o$1): srdi r10, r8, eval(64-$1)
- rldimi r10, r9, $1, 0
- ld r9, -32(up)
- addi up, up, -16
- nor r10, r10, r10
- std r10, 0(rp)
-L(e$1): srdi r11, r9, eval(64-$1)
- rldimi r11, r8, $1, 0
- bdnz L(lo$1)
- sldi r10, r9, $1
- b L(com)
- nop
-')
-
- ALIGN(64)
-forloop(`i',1,63,`SHIFT(i)')
-
-L(com): nor r11, r11, r11
- nor r10, r10, r10
- std r11, -8(rp)
- std r10, -16(rp)
- mtlr r12
-ifdef(`HAVE_ABI_mode32',
-` mr r4, r3
- srdi r3, r3, 32
-')
- blr
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/powerpc64/p6/rshift.asm b/gmp/mpn/powerpc64/p6/rshift.asm
deleted file mode 100644
index 9e848c1fc7..0000000000
--- a/gmp/mpn/powerpc64/p6/rshift.asm
+++ /dev/null
@@ -1,131 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 2
-C POWER6 3.5 (mysteriously 3.0 for cnt=1)
-
-C TODO
-C * Micro-optimise header code
-C * Perhaps do 4-way unrolling, for 2.5 c/l on POWER6. The code is 4248
-C bytes, 4-way code would become about 50% larger.
-
-C INPUT PARAMETERS
-define(`rp_param', `r3')
-define(`up', `r4')
-define(`n', `r5')
-define(`cnt', `r6')
-
-define(`tnc',`r0')
-define(`retval',`r3')
-define(`rp', `r7')
-
-ASM_START()
-PROLOGUE(mpn_rshift,toc)
-
-ifdef(`HAVE_ABI_mode32',`
- rldicl n, n, 0,32 C FIXME: avoid this zero extend
-')
- mflr r12
- LEAL( r11, L(e1)) C address of L(e1) label in SHIFT(1)
- sldi r10, cnt, 6 C multiply cnt by size of a SHIFT block
- add r11, r11, r10 C address of L(oN) for N = cnt
- srdi r10, n, 1
- mr rp, rp_param
- subfic tnc, cnt, 64
- rlwinm. r8, n, 0,31,31 C extract bit 0
- mtctr r10
- beq L(evn)
-
-L(odd): ld r9, 0(up)
- cmpdi cr0, n, 1 C n = 1?
- beq L(1)
- ld r8, 8(up)
- addi r11, r11, -84 C L(o1) - L(e1) - 64
- mtlr r11
- sld r3, r9, tnc C retval
- addi up, up, 8
- addi rp, rp, 8
- blr C branch to L(oN)
-
-L(evn): ld r8, 0(up)
- ld r9, 8(up)
- addi r11, r11, -64
- mtlr r11
- sld r3, r8, tnc C retval
- addi up, up, 16
- blr C branch to L(eN)
-
-L(1): sld r3, r9, tnc C retval
- srd r8, r9, cnt
- std r8, 0(rp)
- mtlr r12
-ifdef(`HAVE_ABI_mode32',
-` mr r4, r3
- srdi r3, r3, 32
-')
- blr
-
-
-define(SHIFT,`
-L(lo$1):ld r8, 0(up)
- std r11, 0(rp)
- addi rp, rp, 16
-L(o$1): srdi r10, r9, $1
- rldimi r10, r8, eval(64-$1), 0
- ld r9, 8(up)
- addi up, up, 16
- std r10, -8(rp)
-L(e$1): srdi r11, r8, $1
- rldimi r11, r9, eval(64-$1), 0
- bdnz L(lo$1)
- std r11, 0(rp)
- srdi r10, r9, $1
- b L(com)
- nop
- nop
-')
-
- ALIGN(64)
-forloop(`i',1,63,`SHIFT(i)')
-
-L(com): std r10, 8(rp)
- mtlr r12
-ifdef(`HAVE_ABI_mode32',
-` mr r4, r3
- srdi r3, r3, 32
-')
- blr
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/powerpc64/p7/copyd.asm b/gmp/mpn/powerpc64/p7/copyd.asm
deleted file mode 100644
index f04ca586e8..0000000000
--- a/gmp/mpn/powerpc64/p7/copyd.asm
+++ /dev/null
@@ -1,128 +0,0 @@
-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/gmp/mpn/powerpc64/p7/copyi.asm b/gmp/mpn/powerpc64/p7/copyi.asm
deleted file mode 100644
index 854cf9f809..0000000000
--- a/gmp/mpn/powerpc64/p7/copyi.asm
+++ /dev/null
@@ -1,129 +0,0 @@
-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()
diff --git a/gmp/mpn/powerpc64/p7/hamdist.asm b/gmp/mpn/powerpc64/p7/hamdist.asm
deleted file mode 100644
index 5af98946f7..0000000000
--- a/gmp/mpn/powerpc64/p7/hamdist.asm
+++ /dev/null
@@ -1,110 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.87
-
-define(`up', r3)
-define(`vp', r4)
-define(`n', r5)
-
-ASM_START()
-PROLOGUE(mpn_hamdist)
- std r30, -16(r1)
- std r31, -8(r1)
-
- addi r0, n, 1
-ifdef(`HAVE_ABI_mode32',
-` rldicl r0, r0, 63,33', C ...branch count
-` srdi r0, r0, 1') C ...for ctr
- mtctr r0
-
- andi. r0, n, 1
-
- li r0, 0
- li r12, 0
-
- beq L(evn)
-
-L(odd): ld r6, 0(up)
- addi up, up, 8
- ld r8, 0(vp)
- addi vp, vp, 8
- xor r10, r6, r8
- popcntd r0, r10
- bdz L(e1)
-
-L(evn): ld r6, 0(up)
- ld r8, 0(vp)
- ld r7, 8(up)
- ld r9, 8(vp)
- xor r10, r6, r8
- addi up, up, 16
- addi vp, vp, 16
- li r30, 0
- li r31, 0
- bdz L(end)
-
- nop
- nop
-C ALIGN(16)
-L(top): add r0, r0, r30
- ld r6, 0(up)
- ld r8, 0(vp)
- xor r11, r7, r9
- popcntd r30, r10
- add r12, r12, r31
- ld r7, 8(up)
- ld r9, 8(vp)
- xor r10, r6, r8
- popcntd r31, r11
- addi up, up, 16
- addi vp, vp, 16
- bdnz L(top)
-
-L(end): add r0, r0, r30
- xor r11, r7, r9
- popcntd r30, r10
- add r12, r12, r31
- popcntd r31, r11
-
- add r0, r0, r30
- add r12, r12, r31
-L(e1): add r3, r0, r12
- ld r30, -16(r1)
- ld r31, -8(r1)
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/p7/popcount.asm b/gmp/mpn/powerpc64/p7/popcount.asm
deleted file mode 100644
index eac72a6493..0000000000
--- a/gmp/mpn/powerpc64/p7/popcount.asm
+++ /dev/null
@@ -1,90 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-
-define(`up', r3)
-define(`n', r4)
-
-ASM_START()
-PROLOGUE(mpn_popcount)
- addi r0, n, 1
-ifdef(`HAVE_ABI_mode32',
-` rldicl r0, r0, 63,33', C ...branch count
-` srdi r0, r0, 1') C ...for ctr
- mtctr r0
-
- andi. r0, n, 1
-
- li r0, 0
- li r12, 0
- beq L(evn)
-
-L(odd): ld r4, 0(up)
- addi up, up, 8
- popcntd r0, r4
- bdz L(e1)
-
-L(evn): ld r4, 0(up)
- ld r5, 8(up)
- popcntd r8, r4
- popcntd r9, r5
- bdz L(e2)
-
- ld r4, 16(up)
- ld r5, 24(up)
- bdz L(e4)
- addi up, up, 32
-
-L(top): add r0, r0, r8
- popcntd r8, r4
- ld r4, 0(up)
- add r12, r12, r9
- popcntd r9, r5
- ld r5, 8(up)
- addi up, up, 16
- bdnz L(top)
-
-L(e4): add r0, r0, r8
- popcntd r8, r4
- add r12, r12, r9
- popcntd r9, r5
-L(e2): add r0, r0, r8
- add r12, r12, r9
-L(e1): add r3, r0, r12
- blr
-EPILOGUE()
diff --git a/gmp/mpn/powerpc64/rshift.asm b/gmp/mpn/powerpc64/rshift.asm
index 7654a16ae8..e73640d08c 100644
--- a/gmp/mpn/powerpc64/rshift.asm
+++ b/gmp/mpn/powerpc64/rshift.asm
@@ -1,207 +1,107 @@
dnl PowerPC-64 mpn_rshift -- rp[] = up[] >> cnt
-dnl Copyright 2003, 2005, 2010, 2011 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
-include(`../config.m4')
+dnl You should have received 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 ?
-C POWER4/PPC970 ?
-C POWER5 2.25
-C POWER6 9.75
-C POWER7 2.15
+include(`../config.m4')
-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 lshiftc.asm
+C cycles/limb
+C POWER3/PPC630: 1.5
+C POWER4/PPC970: 3.0
C INPUT PARAMETERS
-define(`rp', `r3')
-define(`up', `r4')
-define(`n', `r5')
-define(`cnt', `r6')
+define(`rp',`r3')
+define(`up',`r4')
+define(`n',`r5')
+define(`cnt',`r6')
+
+define(`tnc',`r5')
+define(`v0',`r0')
+define(`v1',`r7')
+define(`u0',`r8')
+define(`u1',`r9')
+define(`h0',`r10')
+define(`h1',`r11')
-define(`tnc',`r0')
-define(`u0',`r30')
-define(`u1',`r31')
-define(`retval',`r5')
ASM_START()
PROLOGUE(mpn_rshift)
- std r31, -8(r1)
- std r30, -16(r1)
- subfic tnc, cnt, 64
-C sldi r30, n, 3 C byte count corresponding to n
-C add rp, rp, r30 C rp = rp + n
-C add up, up, r30 C up = up + n
- rldicl. r30, n, 0,62 C r30 = n & 3, set cr0
- cmpdi cr6, r30, 2
- addi r31, n, 3 C compute count...
- ld r10, 0(up) C load 1st limb for b00...b11
- sld retval, r10, tnc
ifdef(`HAVE_ABI_mode32',
-` rldicl r31, r31, 62,34', C ...branch count
-` srdi r31, r31, 2') C ...for ctr
- mtctr r31 C copy count into ctr
- beq cr0, L(b00)
- blt cr6, L(b01)
- ld r11, 8(up) C load 2nd limb for b10 and b11
- beq cr6, L(b10)
-
- ALIGN(16)
-L(b11): srd r8, r10, cnt
- sld r9, r11, tnc
- ld u1, 16(up)
- addi up, up, 24
- srd r12, r11, cnt
- sld r7, u1, tnc
+` rldicl n, n, 0, 32') C zero extend n
+ mtctr n C copy n to count register
addi rp, rp, -16
- bdnz L(gt3)
+ subfic tnc, cnt, 64 C reverse shift count
- or r11, r8, r9
- srd r8, u1, cnt
- b L(cj3)
+ ld u0, 0(up)
+ srd h0, u0, cnt
+ sld r12, u0, tnc C return value
+ bdz L(1) C jump for n = 1
- ALIGN(16)
-L(gt3): ld u0, 0(up)
- or r11, r8, r9
- srd r8, u1, cnt
- sld r9, u0, tnc
ld u1, 8(up)
- or r10, r12, r7
- b L(L11)
-
- ALIGN(32)
-L(b10): srd r12, r10, cnt
- addi rp, rp, -24
- sld r7, r11, tnc
- bdnz L(gt2)
-
- srd r8, r11, cnt
- or r10, r12, r7
- b L(cj2)
-
-L(gt2): ld u0, 16(up)
- srd r8, r11, cnt
- sld r9, u0, tnc
- ld u1, 24(up)
- or r10, r12, r7
- srd r12, u0, cnt
- sld r7, u1, tnc
- ld u0, 32(up)
- or r11, r8, r9
- addi up, up, 16
- b L(L10)
-
- ALIGN(16)
-L(b00): ld u1, 8(up)
- srd r12, r10, cnt
- sld r7, u1, tnc
- ld u0, 16(up)
- srd r8, u1, cnt
- sld r9, u0, tnc
- ld u1, 24(up)
- or r10, r12, r7
- srd r12, u0, cnt
- sld r7, u1, tnc
- addi rp, rp, -8
- bdz L(cj4)
-
-L(gt4): addi up, up, 32
- ld u0, 0(up)
- or r11, r8, r9
- b L(L00)
-
- ALIGN(16)
-L(b01): bdnz L(gt1)
- srd r8, r10, cnt
- std r8, 0(rp)
- b L(ret)
-
-L(gt1): ld u0, 8(up)
- srd r8, r10, cnt
- sld r9, u0, tnc
- ld u1, 16(up)
- srd r12, u0, cnt
- sld r7, u1, tnc
- ld u0, 24(up)
- or r11, r8, r9
- srd r8, u1, cnt
- sld r9, u0, tnc
- ld u1, 32(up)
- addi up, up, 40
- or r10, r12, r7
- bdz L(end)
-
- ALIGN(32)
-L(top): srd r12, u0, cnt
- sld r7, u1, tnc
- ld u0, 0(up)
- std r11, 0(rp)
- or r11, r8, r9
-L(L00): srd r8, u1, cnt
- sld r9, u0, tnc
+ bdz L(2) C jump for n = 2
+
+ ldu u0, 16(up)
+ bdz L(end) C jump for n = 3
+
+L(oop): sld v1, u1, tnc
+ srd h1, u1, cnt
ld u1, 8(up)
- std r10, 8(rp)
- or r10, r12, r7
-L(L11): srd r12, u0, cnt
- sld r7, u1, tnc
- ld u0, 16(up)
- std r11, 16(rp)
- or r11, r8, r9
-L(L10): srd r8, u1, cnt
- sld r9, u0, tnc
- ld u1, 24(up)
- addi up, up, 32
- std r10, 24(rp)
- addi rp, rp, 32
- or r10, r12, r7
- bdnz L(top)
-
- ALIGN(32)
-L(end): srd r12, u0, cnt
- sld r7, u1, tnc
- std r11, 0(rp)
-L(cj4): or r11, r8, r9
- srd r8, u1, cnt
- std r10, 8(rp)
-L(cj3): or r10, r12, r7
- std r11, 16(rp)
-L(cj2): std r10, 24(rp)
- std r8, 32(rp)
-
-L(ret): ld r31, -8(r1)
- ld r30, -16(r1)
+ or h0, v1, h0
+ stdu h0, 16(rp)
+
+ bdz L(exit)
+
+ sld v0, u0, tnc
+ srd h0, u0, cnt
+ ldu u0, 16(up)
+ or h1, v0, h1
+ std h1, 8(rp)
+
+ bdnz L(oop)
+
+L(end): sld v1, u1, tnc
+ srd h1, u1, cnt
+ or h0, v1, h0
+ stdu h0, 16(rp)
+ sld v0, u0, tnc
+ srd h0, u0, cnt
+ or h1, v0, h1
+ std h1, 8(rp)
+L(1): std h0, 16(rp)
+ifdef(`HAVE_ABI_mode32',
+` srdi r3, r12, 32
+ mr r4, r12
+',` mr r3, r12
+')
+ blr
+
+L(exit): sld v0, u0, tnc
+ srd h0, u0, cnt
+ or h1, v0, h1
+ std h1, 8(rp)
+L(2): sld v1, u1, tnc
+ srd h1, u1, cnt
+ or h0, v1, h0
+ stdu h0, 16(rp)
+ std h1, 8(rp)
ifdef(`HAVE_ABI_mode32',
-` srdi r3, retval, 32
- mr r4, retval
-',` mr r3, retval')
+` srdi r3, r12, 32
+ mr r4, r12
+',` mr r3, r12
+')
blr
EPILOGUE()
diff --git a/gmp/mpn/powerpc64/sec_tabselect.asm b/gmp/mpn/powerpc64/sec_tabselect.asm
deleted file mode 100644
index 085577ca9b..0000000000
--- a/gmp/mpn/powerpc64/sec_tabselect.asm
+++ /dev/null
@@ -1,147 +0,0 @@
-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/gmp/mpn/powerpc64/sqr_diagonal.asm b/gmp/mpn/powerpc64/sqr_diagonal.asm
new file mode 100644
index 0000000000..07f60e0dd5
--- /dev/null
+++ b/gmp/mpn/powerpc64/sqr_diagonal.asm
@@ -0,0 +1,55 @@
+dnl PowerPC-64 mpn_sqr_diagonal.
+
+dnl Copyright 2001, 2002, 2003, 2005, 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 POWER3/PPC630: 18
+C POWER4/PPC970: 8
+
+C INPUT PARAMETERS
+C rp r3
+C up r4
+C n r5
+
+ASM_START()
+PROLOGUE(mpn_sqr_diagonal)
+ifdef(`HAVE_ABI_mode32',
+` rldicl r5, r5, 0, 32') C zero extend n
+ mtctr r5
+ ld r0, 0(r4)
+ bdz L(end)
+ ALIGN(16)
+
+L(top): mulld r5, r0, r0
+ mulhdu r6, r0, r0
+ ld r0, 8(r4)
+ addi r4, r4, 8
+ std r5, 0(r3)
+ std r6, 8(r3)
+ addi r3, r3, 16
+ bdnz L(top)
+
+L(end): mulld r5, r0, r0
+ mulhdu r6, r0, r0
+ std r5, 0(r3)
+ std r6, 8(r3)
+
+ blr
+EPILOGUE()
diff --git a/gmp/mpn/powerpc64/umul.asm b/gmp/mpn/powerpc64/umul.asm
index 7fcc72f18f..516be3d98b 100644
--- a/gmp/mpn/powerpc64/umul.asm
+++ b/gmp/mpn/powerpc64/umul.asm
@@ -1,32 +1,21 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+dnl Copyright 2000, 2001, 2005 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/powerpc64/vmx/popcount.asm b/gmp/mpn/powerpc64/vmx/popcount.asm
index b95fb88b1a..b9f5896fb7 100644
--- a/gmp/mpn/powerpc64/vmx/popcount.asm
+++ b/gmp/mpn/powerpc64/vmx/popcount.asm
@@ -1,43 +1,36 @@
dnl PowerPC-32/VMX and PowerPC-64/VMX mpn_popcount.
-dnl Copyright 2006, 2010 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 7400,7410 (G4): ?
-C 744x,745x (G4+): 1.125
-C 970 (G5): 2.25
+C 7400,7410 (G4): 2.75
+C 744x,745x (G4+): 2.25
+C 970 (G5): 5.3
+
+C STATUS
+C * Works for all sizes and alignments.
C TODO
-C * Rewrite the awkward huge n outer loop code.
+C * Tune the awkward huge n outer loop code.
C * Two lvx, two vperm, and two vxor could make us a similar hamdist.
+C * For the 970, a combined VMX+intop approach might be best.
C * Compress cnsts table in 64-bit mode, only half the values are needed.
define(`GMP_LIMB_BYTES', eval(GMP_LIMB_BITS/8))
@@ -46,11 +39,26 @@ define(`LIMBS_PER_2VR', eval(32/GMP_LIMB_BYTES))
define(`OPERATION_popcount')
-define(`ap', `r3')
-define(`n', `r4')
+ifdef(`OPERATION_popcount',`
+ define(`func',`mpn_popcount')
+ define(`up', `r3')
+ define(`n', `r4')
+ define(`HAM', `dnl')
+')
+ifdef(`OPERATION_hamdist',`
+ define(`func',`mpn_hamdist')
+ define(`up', `r3')
+ define(`vp', `r4')
+ define(`n', `r5')
+ define(`HAM', `$1')
+')
-define(`rtab', `v10')
-define(`cnt4', `v11')
+define(`x01010101',`v2')
+define(`x00110011',`v7')
+define(`x00001111',`v10')
+define(`cnt1',`v11')
+define(`cnt2',`v12')
+define(`cnt4',`v13')
ifelse(GMP_LIMB_BITS,32,`
define(`LIMB32',` $1')
@@ -66,7 +74,7 @@ define(`LIMBS_PER_CHUNK', 0x1000)
define(`LIMBS_CHUNK_THRES', 0x1001)
ASM_START()
-PROLOGUE(mpn_popcount,toc)
+PROLOGUE(mpn_popcount)
mfspr r10, 256
oris r0, r10, 0xfffc C Set VRSAVE bit 0-13
mtspr 256, r0
@@ -77,29 +85,30 @@ ifdef(`HAVE_ABI_mode32',
C Load various constants into vector registers
LEAL( r11, cnsts)
li r12, 16
+ vspltisb cnt1, 1 C 0x0101...01 used as shift count
+ vspltisb cnt2, 2 C 0x0202...02 used as shift count
vspltisb cnt4, 4 C 0x0404...04 used as shift count
-
- li r7, 160
- lvx rtab, 0, r11
+ lvx x01010101, 0, r11 C 0x3333...33
+ lvx x00110011, r12, r11 C 0x5555...55
+ vspltisb x00001111, 15 C 0x0f0f...0f
LIMB64(`lis r0, LIMBS_CHUNK_THRES ')
LIMB64(`cmpd cr7, n, r0 ')
- lvx v0, 0, ap
- addi r7, r11, 80
- rlwinm r6, ap, 2,26,29
+ lvx v0, 0, up
+ addi r7, r11, 96
+ rlwinm r6, up, 2,26,29
lvx v8, r7, r6
vand v0, v0, v8
-LIMB32(`rlwinm r8, ap, 30,30,31 ')
-LIMB64(`rlwinm r8, ap, 29,31,31 ')
- add n, n, r8 C compensate n for rounded down `ap'
+LIMB32(`rlwinm r8, up, 30,30,31 ')
+LIMB64(`rlwinm r8, up, 29,31,31 ')
+ add n, n, r8 C compensate n for rounded down `up'
vxor v1, v1, v1
li r8, 0 C grand total count
- vxor v12, v12, v12 C zero total count
- vxor v13, v13, v13 C zero total count
+ vxor v3, v3, v3 C zero total count
addic. n, n, -LIMBS_PER_VR
ble L(sum)
@@ -111,61 +120,82 @@ C For 64-bit machines, handle huge n that would overflow vsum4ubs
LIMB64(`ble cr7, L(small) ')
LIMB64(`addis r9, n, -LIMBS_PER_CHUNK ') C remaining n
LIMB64(`lis n, LIMBS_PER_CHUNK ')
-
- ALIGN(16)
L(small):
+
+
LIMB32(`srwi r7, n, 3 ') C loop count corresponding to n
LIMB64(`srdi r7, n, 2 ') C loop count corresponding to n
addi r7, r7, 1
mtctr r7 C copy n to count register
b L(ent)
- ALIGN(16)
-L(top):
- lvx v0, 0, ap
-L(ent): lvx v1, r12, ap
- addi ap, ap, 32
- vsrb v8, v0, cnt4
- vsrb v9, v1, cnt4
- vperm v2, rtab, rtab, v0
- vperm v3, rtab, rtab, v8
- vperm v4, rtab, rtab, v1
- vperm v5, rtab, rtab, v9
- vaddubm v6, v2, v3
- vaddubm v7, v4, v5
- vsum4ubs v12, v6, v12
- vsum4ubs v13, v7, v13
+ ALIGN(8)
+L(top): lvx v0, 0, up
+ li r7, 128 C prefetch distance
+L(ent): lvx v1, r12, up
+ addi up, up, 32
+ vsr v4, v0, cnt1
+ vsr v5, v1, cnt1
+ dcbt up, r7 C prefetch
+ vand v8, v4, x01010101
+ vand v9, v5, x01010101
+ vsububm v0, v0, v8 C 64 2-bit accumulators (0..2)
+ vsububm v1, v1, v9 C 64 2-bit accumulators (0..2)
+ vsr v4, v0, cnt2
+ vsr v5, v1, cnt2
+ vand v8, v0, x00110011
+ vand v9, v1, x00110011
+ vand v4, v4, x00110011
+ vand v5, v5, x00110011
+ vaddubm v0, v4, v8 C 32 4-bit accumulators (0..4)
+ vaddubm v1, v5, v9 C 32 4-bit accumulators (0..4)
+ vaddubm v8, v0, v1 C 32 4-bit accumulators (0..8)
+ vsr v9, v8, cnt4
+ vand v6, v8, x00001111
+ vand v9, v9, x00001111
+ vaddubm v6, v9, v6 C 16 8-bit accumulators (0..16)
+ vsum4ubs v3, v6, v3 C sum 4 x 4 bytes into 4 32-bit fields
bdnz L(top)
andi. n, n, eval(LIMBS_PER_2VR-1)
beq L(rt)
- lvx v0, 0, ap
+ lvx v0, 0, up
vxor v1, v1, v1
cmpwi n, LIMBS_PER_VR
ble L(sum)
L(lsum):
vor v1, v0, v0
- lvx v0, r12, ap
+ lvx v0, r12, up
L(sum):
LIMB32(`rlwinm r6, n, 4,26,27 ')
LIMB64(`rlwinm r6, n, 5,26,26 ')
- addi r7, r11, 16
+ addi r7, r11, 32
lvx v8, r7, r6
vand v0, v0, v8
- vsrb v8, v0, cnt4
- vsrb v9, v1, cnt4
- vperm v2, rtab, rtab, v0
- vperm v3, rtab, rtab, v8
- vperm v4, rtab, rtab, v1
- vperm v5, rtab, rtab, v9
- vaddubm v6, v2, v3
- vaddubm v7, v4, v5
- vsum4ubs v12, v6, v12
- vsum4ubs v13, v7, v13
-
- ALIGN(16)
-L(rt): vadduwm v3, v12, v13
+
+ vsr v4, v0, cnt1
+ vsr v5, v1, cnt1
+ vand v8, v4, x01010101
+ vand v9, v5, x01010101
+ vsububm v0, v0, v8 C 64 2-bit accumulators (0..2)
+ vsububm v1, v1, v9 C 64 2-bit accumulators (0..2)
+ vsr v4, v0, cnt2
+ vsr v5, v1, cnt2
+ vand v8, v0, x00110011
+ vand v9, v1, x00110011
+ vand v4, v4, x00110011
+ vand v5, v5, x00110011
+ vaddubm v0, v4, v8 C 32 4-bit accumulators (0..4)
+ vaddubm v1, v5, v9 C 32 4-bit accumulators (0..4)
+ vaddubm v8, v0, v1 C 32 4-bit accumulators (0..8)
+ vsr v9, v8, cnt4
+ vand v6, v8, x00001111
+ vand v9, v9, x00001111
+ vaddubm v6, v9, v6 C 16 8-bit accumulators (0..16)
+ vsum4ubs v3, v6, v3 C sum 4 x 4 bytes into 4 32-bit fields
+
+L(rt):
li r7, -16 C FIXME: does all ppc32 and ppc64 ABIs
stvx v3, r7, r1 C FIXME: ...support storing below sp?
@@ -180,8 +210,7 @@ L(rt): vadduwm v3, v12, v13
C Handle outer loop for huge n. We inherit cr7 and r0 from above.
LIMB64(`ble cr7, L(ret)
- vxor v12, v12, v12 C zero total count
- vxor v13, v13, v13 C zero total count
+ vxor v3, v3, v3 C zero total count
mr n, r9
cmpd cr7, n, r0
ble cr7, L(2)
@@ -192,16 +221,17 @@ L(2): srdi r7, n, 2 C loop count corresponding to n
b L(top)
')
- ALIGN(16)
L(ret): mr r3, r8
mtspr 256, r10
blr
EPILOGUE()
DEF_OBJECT(cnsts,16)
-C Counts for vperm
- .byte 0x00,0x01,0x01,0x02,0x01,0x02,0x02,0x03
- .byte 0x01,0x02,0x02,0x03,0x02,0x03,0x03,0x04
+ .byte 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
+ .byte 0x55,0x55,0x55,0x55,0x55,0x55,0x55,0x55
+
+ .byte 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33
+ .byte 0x33,0x33,0x33,0x33,0x33,0x33,0x33,0x33
C Masks for high end of number
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
.byte 0xff,0xff,0xff,0xff,0xff,0xff,0xff,0xff
diff --git a/gmp/mpn/pyr/add_n.s b/gmp/mpn/pyr/add_n.s
new file mode 100644
index 0000000000..7ac02e6b4d
--- /dev/null
+++ b/gmp/mpn/pyr/add_n.s
@@ -0,0 +1,74 @@
+# 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/gmp/mpn/pyr/addmul_1.s b/gmp/mpn/pyr/addmul_1.s
new file mode 100644
index 0000000000..d40a9e77cf
--- /dev/null
+++ b/gmp/mpn/pyr/addmul_1.s
@@ -0,0 +1,43 @@
+# 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/gmp/mpn/pyr/mul_1.s b/gmp/mpn/pyr/mul_1.s
new file mode 100644
index 0000000000..453727f6d8
--- /dev/null
+++ b/gmp/mpn/pyr/mul_1.s
@@ -0,0 +1,40 @@
+# 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/gmp/mpn/pyr/sub_n.s b/gmp/mpn/pyr/sub_n.s
new file mode 100644
index 0000000000..11f185a81a
--- /dev/null
+++ b/gmp/mpn/pyr/sub_n.s
@@ -0,0 +1,74 @@
+# 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
diff --git a/gmp/mpn/s390_32/README b/gmp/mpn/s390/README
index 59519ba538..59519ba538 100644
--- a/gmp/mpn/s390_32/README
+++ b/gmp/mpn/s390/README
diff --git a/gmp/mpn/s390_32/addmul_1.asm b/gmp/mpn/s390/addmul_1.asm
index 97189a8e76..71d49bbfca 100644
--- a/gmp/mpn/s390_32/addmul_1.asm
+++ b/gmp/mpn/s390/addmul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/s390/gmp-mparam.h b/gmp/mpn/s390/gmp-mparam.h
new file mode 100644
index 0000000000..d738846679
--- /dev/null
+++ b/gmp/mpn/s390/gmp-mparam.h
@@ -0,0 +1,54 @@
+/* IBM s370 gmp-mparam.h -- Compiler/machine parameter header file.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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/. */
+
+
+/* BITS_PER_MP_LIMB etc generated by configure */
+
+
+/* Generated by tuneup.c, 2001-12-03, gcc 2.95 */
+
+#define MUL_KARATSUBA_THRESHOLD 18
+#define MUL_TOOM3_THRESHOLD 210
+
+#define SQR_BASECASE_THRESHOLD 8
+#define SQR_KARATSUBA_THRESHOLD 40
+#define SQR_TOOM3_THRESHOLD 250
+
+#define DIV_SB_PREINV_THRESHOLD 0
+#define DIV_DC_THRESHOLD 63
+#define POWM_THRESHOLD 63
+
+#define GCD_ACCEL_THRESHOLD 3
+
+#define DIVREM_1_NORM_THRESHOLD 0
+#define DIVREM_1_UNNORM_THRESHOLD 5
+#define MOD_1_NORM_THRESHOLD 0
+#define MOD_1_UNNORM_THRESHOLD 4
+#define USE_PREINV_MOD_1 0
+#define DIVREM_2_THRESHOLD 0
+#define DIVEXACT_1_THRESHOLD 0
+#define MODEXACT_1_ODD_THRESHOLD 0
+
+#define MUL_FFT_TABLE { 432, 992, 1664, 4608, 14336, 40960, 0 }
+#define MUL_FFT_MODF_THRESHOLD 448
+#define MUL_FFT_THRESHOLD 3840
+
+#define SQR_FFT_TABLE { 400, 992, 1664, 4608, 10240, 40960, 0 }
+#define SQR_FFT_MODF_THRESHOLD 416
+#define SQR_FFT_THRESHOLD 3328
diff --git a/gmp/mpn/s390_32/mul_1.asm b/gmp/mpn/s390/mul_1.asm
index e3ad0c59d8..649671b45c 100644
--- a/gmp/mpn/s390_32/mul_1.asm
+++ b/gmp/mpn/s390/mul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/s390_32/submul_1.asm b/gmp/mpn/s390/submul_1.asm
index da7d849d5d..5301096da2 100644
--- a/gmp/mpn/s390_32/submul_1.asm
+++ b/gmp/mpn/s390/submul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/s390_32/copyd.asm b/gmp/mpn/s390_32/copyd.asm
deleted file mode 100644
index ff252bc1a6..0000000000
--- a/gmp/mpn/s390_32/copyd.asm
+++ /dev/null
@@ -1,145 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-C z900 1.65
-C z990 1.125
-C z9 ?
-C z10 ?
-C z196 ?
-
-C FIXME:
-C * Avoid saving/restoring callee-saves registers for n < 3. This could be
-C done by setting rp=r1, up=r2, i=r0 and r3,r4,r5 for clock regs.
-C We could then use r3...r10 in main loop.
-
-C INPUT PARAMETERS
-define(`rp_param', `%r2')
-define(`up_param', `%r3')
-define(`n', `%r4')
-
-define(`rp', `%r8')
-define(`up', `%r9')
-
-ASM_START()
-PROLOGUE(mpn_copyd)
- stm %r6, %r11, 24(%r15)
-
- lr %r1, n
- sll %r1, 2
- la %r10, 8(n)
- ahi %r1, -32
- srl %r10, 3
- lhi %r11, -32
-
- la rp, 0(%r1,rp_param) C FIXME use lay on z990 and later
- la up, 0(%r1,up_param) C FIXME use lay on z990 and later
-
- lhi %r7, 7
- nr %r7, n C n mod 8
- chi %r7, 2
- jh L(b34567)
- chi %r7, 1
- je L(b1)
- jh L(b2)
-
-L(b0): brct %r10, L(top)
- j L(end)
-
-L(b1): l %r0, 28(up)
- ahi up, -4
- st %r0, 28(rp)
- ahi rp, -4
- brct %r10, L(top)
- j L(end)
-
-L(b2): lm %r0, %r1, 24(up)
- ahi up, -8
- stm %r0, %r1, 24(rp)
- ahi rp, -8
- brct %r10, L(top)
- j L(end)
-
-L(b34567):
- chi %r7, 4
- jl L(b3)
- je L(b4)
- chi %r7, 6
- je L(b6)
- jh L(b7)
-
-L(b5): lm %r0, %r4, 12(up)
- ahi up, -20
- stm %r0, %r4, 12(rp)
- ahi rp, -20
- brct %r10, L(top)
- j L(end)
-
-L(b3): lm %r0, %r2, 20(up)
- ahi up, -12
- stm %r0, %r2, 20(rp)
- ahi rp, -12
- brct %r10, L(top)
- j L(end)
-
-L(b4): lm %r0, %r3, 16(up)
- ahi up, -16
- stm %r0, %r3, 16(rp)
- ahi rp, -16
- brct %r10, L(top)
- j L(end)
-
-L(b6): lm %r0, %r5, 8(up)
- ahi up, -24
- stm %r0, %r5, 8(rp)
- ahi rp, -24
- brct %r10, L(top)
- j L(end)
-
-L(b7): lm %r0, %r6, 4(up)
- ahi up, -28
- stm %r0, %r6, 4(rp)
- ahi rp, -28
- brct %r10, L(top)
- j L(end)
-
-L(top): lm %r0, %r7, 0(up)
- la up, 0(%r11,up)
- stm %r0, %r7, 0(rp)
- la rp, 0(%r11,rp)
- brct %r10, L(top)
-
-L(end): lm %r6, %r11, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/copyi.asm b/gmp/mpn/s390_32/copyi.asm
deleted file mode 100644
index 1df32f100e..0000000000
--- a/gmp/mpn/s390_32/copyi.asm
+++ /dev/null
@@ -1,69 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 0.75
-C z990 0.375
-C z9 ?
-C z10 ?
-C z196 ?
-
-C NOTE
-C * This is based on GNU libc memcpy which was written by Martin Schwidefsky.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-
-ASM_START()
-PROLOGUE(mpn_copyi)
- ltr %r4, %r4
- sll %r4, 2
- je L(rtn)
- ahi %r4, -1
- lr %r5, %r4
- srl %r5, 8
- ltr %r5, %r5 C < 256 bytes to copy?
- je L(1)
-
-L(top): mvc 0(256, rp), 0(up)
- la rp, 256(rp)
- la up, 256(up)
- brct %r5, L(top)
-
-L(1): bras %r5, L(2) C make r5 point to mvc insn
- mvc 0(1, rp), 0(up)
-L(2): ex %r4, 0(%r5) C execute mvc with length ((n-1) mod 256)+1
-L(rtn): br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/addmul_1.asm b/gmp/mpn/s390_32/esame/addmul_1.asm
deleted file mode 100644
index 4375b74ae0..0000000000
--- a/gmp/mpn/s390_32/esame/addmul_1.asm
+++ /dev/null
@@ -1,72 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 18.5
-C z990 10
-C z9 ?
-C z10 ?
-C z196 ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`v0', `%r5')
-
-define(`z', `%r9')
-
-ASM_START()
-PROLOGUE(mpn_addmul_1)
- stm %r9, %r12, 36(%r15)
- 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
-
-L(top): l %r1, 0(%r12,up)
- l %r10, 0(%r12,rp)
- mlr %r0, v0
- alcr %r1, %r10
- alcr %r0, z
- alr %r1, %r11
- lr %r11, %r0
- st %r1, 0(%r12,rp)
- la %r12, 4(%r12)
- brct n, L(top)
-
- lhi %r2, 0
- alcr %r2, %r11
-
- lm %r9, %r12, 36(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/aors_n.asm b/gmp/mpn/s390_32/esame/aors_n.asm
deleted file mode 100644
index 98b0dbc7b0..0000000000
--- a/gmp/mpn/s390_32/esame/aors_n.asm
+++ /dev/null
@@ -1,137 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 ?
-C z990 2.75-3 (fast for even n, slow for odd n)
-C z9 ?
-C z10 ?
-C z196 ?
-
-C TODO
-C * Optimise for small n
-C * Use r0 and save/restore one less register
-C * Using logops_n's v1 inner loop operand order make the loop about 20%
-C faster, at the expense of highly alignment-dependent performance.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`vp', `%r4')
-define(`n', `%r5')
-
-ifdef(`OPERATION_add_n', `
- define(ADSB, al)
- define(ADSBCR, alcr)
- define(ADSBC, alc)
- define(RETVAL,`dnl
- lhi %r2, 0
- alcr %r2, %r2')
- define(func, mpn_add_n)
- define(func_nc, mpn_add_nc)')
-ifdef(`OPERATION_sub_n', `
- define(ADSB, sl)
- define(ADSBCR, slbr)
- define(ADSBC, slb)
- define(RETVAL,`dnl
- slbr %r2, %r2
- lcr %r2, %r2')
- define(func, mpn_sub_n)
- define(func_nc, mpn_sub_nc)')
-
-MULFUNC_PROLOGUE(mpn_add_n mpn_sub_n)
-
-ASM_START()
-PROLOGUE(func)
- stm %r6, %r8, 24(%r15)
-
- ahi n, 3
- lhi %r7, 3
- lr %r1, n
- srl %r1, 2
- nr %r7, n C n mod 4
- je L(b1)
- chi %r7, 2
- jl L(b2)
- jne L(b0)
-
-L(b3): lm %r5, %r7, 0(up)
- la up, 12(up)
- ADSB %r5, 0(vp)
- ADSBC %r6, 4(vp)
- ADSBC %r7, 8(vp)
- la vp, 12(vp)
- stm %r5, %r7, 0(rp)
- la rp, 12(rp)
- brct %r1, L(top)
- j L(end)
-
-L(b0): lm %r5, %r8, 0(up) C This redundant insns is no mistake,
- la up, 16(up) C it is needed to make main loop run
- ADSB %r5, 0(vp) C fast for n = 0 (mod 4).
- ADSBC %r6, 4(vp)
- j L(m0)
-
-L(b1): l %r5, 0(up)
- la up, 4(up)
- ADSB %r5, 0(vp)
- la vp, 4(vp)
- st %r5, 0(rp)
- la rp, 4(rp)
- brct %r1, L(top)
- j L(end)
-
-L(b2): lm %r5, %r6, 0(up)
- la up, 8(up)
- ADSB %r5, 0(vp)
- ADSBC %r6, 4(vp)
- la vp, 8(vp)
- stm %r5, %r6, 0(rp)
- la rp, 8(rp)
- brct %r1, L(top)
- j L(end)
-
-L(top): lm %r5, %r8, 0(up)
- la up, 16(up)
- ADSBC %r5, 0(vp)
- ADSBC %r6, 4(vp)
-L(m0): ADSBC %r7, 8(vp)
- ADSBC %r8, 12(vp)
- la vp, 16(vp)
- stm %r5, %r8, 0(rp)
- la rp, 16(rp)
- brct %r1, L(top)
-
-L(end): RETVAL
- lm %r6, %r8, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/aorslsh1_n.asm b/gmp/mpn/s390_32/esame/aorslsh1_n.asm
deleted file mode 100644
index f2b222b121..0000000000
--- a/gmp/mpn/s390_32/esame/aorslsh1_n.asm
+++ /dev/null
@@ -1,173 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 9.25
-C z990 5
-C z9 ?
-C z10 ?
-C z196 ?
-
-C TODO
-C * Optimise for small n
-C * Compute RETVAL for sublsh1_n less stupidly
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`vp', `%r4')
-define(`n', `%r5')
-
-ifdef(`OPERATION_addlsh1_n',`
- define(ADDSUBC, alr)
- define(ADDSUBE, alcr)
- define(INITCY, `lhi %r13, -1')
- define(RETVAL, `alr %r1, %r13
- lhi %r2, 2
- alr %r2, %r1')
- define(func, mpn_addlsh1_n)
-')
-ifdef(`OPERATION_sublsh1_n',`
- define(ADDSUBC, slr)
- define(ADDSUBE, slbr)
- define(INITCY, `lhi %r13, 0')
- define(RETVAL, `slr %r1, %r13
- lhi %r2, 1
- alr %r2, %r1')
- define(func, mpn_sublsh1_n)
-')
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
-
-ASM_START()
-PROLOGUE(func)
- stm %r6, %r13, 24(%r15)
-
- la %r0, 3(n)
- lhi %r7, 3
- srl %r0, 2
- nr %r7, n C n mod 4
- je L(b0)
- chi %r7, 2
- jl L(b1)
- je L(b2)
-
-L(b3): lm %r5, %r7, 0(up)
- la up, 12(up)
- lm %r9, %r11, 0(vp)
- la vp, 12(vp)
-
- alr %r9, %r9
- alcr %r10, %r10
- alcr %r11, %r11
- slbr %r1, %r1
-
- ADDSUBC %r5, %r9
- ADDSUBE %r6, %r10
- ADDSUBE %r7, %r11
- slbr %r13, %r13
-
- stm %r5, %r7, 0(rp)
- la rp, 12(rp)
- brct %r0, L(top)
- j L(end)
-
-L(b0): lhi %r1, -1
- INITCY
- j L(top)
-
-L(b1): l %r5, 0(up)
- la up, 4(up)
- l %r9, 0(vp)
- la vp, 4(vp)
-
- alr %r9, %r9
- slbr %r1, %r1
- ADDSUBC %r5, %r9
- slbr %r13, %r13
-
- st %r5, 0(rp)
- la rp, 4(rp)
- brct %r0, L(top)
- j L(end)
-
-L(b2): lm %r5, %r6, 0(up)
- la up, 8(up)
- lm %r9, %r10, 0(vp)
- la vp, 8(vp)
-
- alr %r9, %r9
- alcr %r10, %r10
- slbr %r1, %r1
-
- ADDSUBC %r5, %r9
- ADDSUBE %r6, %r10
- slbr %r13, %r13
-
- stm %r5, %r6, 0(rp)
- la rp, 8(rp)
- brct %r0, L(top)
- j L(end)
-
-L(top): lm %r9, %r12, 0(vp)
- la vp, 16(vp)
-
- ahi %r1, 1 C restore carry
-
- alcr %r9, %r9
- alcr %r10, %r10
- alcr %r11, %r11
- alcr %r12, %r12
-
- slbr %r1, %r1 C save carry
-
- lm %r5, %r8, 0(up)
- la up, 16(up)
-
- ahi %r13, 1 C restore carry
-
- ADDSUBE %r5, %r9
- ADDSUBE %r6, %r10
- ADDSUBE %r7, %r11
- ADDSUBE %r8, %r12
-
- slbr %r13, %r13
-
- stm %r5, %r8, 0(rp)
- la rp, 16(rp)
- brct %r0, L(top)
-
-L(end):
- RETVAL
- lm %r6, %r13, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/bdiv_dbm1c.asm b/gmp/mpn/s390_32/esame/bdiv_dbm1c.asm
deleted file mode 100644
index 568a2a44e8..0000000000
--- a/gmp/mpn/s390_32/esame/bdiv_dbm1c.asm
+++ /dev/null
@@ -1,65 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 14
-C z990 10
-C z9 ?
-C z10 ?
-C z196 ?
-
-C INPUT PARAMETERS
-define(`qp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`bd', `%r5')
-define(`cy', `%r6')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_bdiv_dbm1c)
- stm %r6, %r7, 24(%r15)
- lhi %r7, 0 C zero index register
-
-L(top): l %r1, 0(%r7,up)
- mlr %r0, bd
- slr %r6, %r1
- st %r6, 0(%r7,qp)
- slbr %r6, %r0
- la %r7, 4(%r7)
- brct n, L(top)
-
- lr %r2, %r6
- lm %r6, %r7, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/gmp-mparam.h b/gmp/mpn/s390_32/esame/gmp-mparam.h
deleted file mode 100644
index a805fa1492..0000000000
--- a/gmp/mpn/s390_32/esame/gmp-mparam.h
+++ /dev/null
@@ -1,207 +0,0 @@
-/* S/390-32 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 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 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 56
-
-#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 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 14
-#define SQR_TOOM3_THRESHOLD 90
-#define SQR_TOOM4_THRESHOLD 144
-#define SQR_TOOM6_THRESHOLD 196
-#define SQR_TOOM8_THRESHOLD 309
-
-#define MULMID_TOOM42_THRESHOLD 24
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 10
-
-#define MUL_FFT_MODF_THRESHOLD 252 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 252, 5}, { 9, 6}, { 5, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 13, 7}, { 7, 6}, \
- { 15, 7}, { 9, 6}, { 19, 7}, { 11, 6}, \
- { 23, 7}, { 13, 8}, { 7, 7}, { 15, 6}, \
- { 31, 7}, { 19, 8}, { 11, 7}, { 23, 9}, \
- { 7, 8}, { 15, 7}, { 31, 8}, { 19, 7}, \
- { 39, 8}, { 27, 9}, { 15, 8}, { 39, 9}, \
- { 23,10}, { 15, 9}, { 31, 8}, { 63, 9}, \
- { 39, 8}, { 79, 9}, { 47,10}, { 31, 9}, \
- { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255,10}, { 79, 8}, { 319, 9}, \
- { 175, 8}, { 351, 7}, { 703, 6}, { 1407,10}, \
- { 95, 9}, { 191, 8}, { 383, 9}, { 207, 8}, \
- { 415, 7}, { 831, 9}, { 223,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 143, 9}, { 287, 8}, \
- { 575, 9}, { 319,10}, { 175, 9}, { 351, 8}, \
- { 703, 7}, { 1407,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 207, 9}, { 415, 8}, { 831,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 575,11}, \
- { 159,10}, { 351, 9}, { 703, 8}, { 1407,11}, \
- { 191,10}, { 415, 9}, { 831,11}, { 223,10}, \
- { 447, 9}, { 895, 8}, { 1791,10}, { 479, 9}, \
- { 959,12}, { 127,11}, { 287,10}, { 575,11}, \
- { 351,10}, { 703, 9}, { 1407,12}, { 191,11}, \
- { 415,10}, { 831,11}, { 447,10}, { 895, 9}, \
- { 1791,11}, { 479,10}, { 959,13}, { 127,12}, \
- { 255,11}, { 575,12}, { 319,11}, { 703,10}, \
- { 1407,12}, { 383,11}, { 831,12}, { 447,11}, \
- { 895,10}, { 1791,11}, { 959,10}, { 1919, 9}, \
- { 3839,13}, { 255,12}, { 575,11}, { 1215,10}, \
- { 2431,12}, { 703,11}, { 1407,13}, { 383,12}, \
- { 895,11}, { 1791,12}, { 959,11}, { 1919,10}, \
- { 3839,14}, { 255,13}, { 511,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,13}, { 895,12}, \
- { 1919,11}, { 3839,10}, { 7679,14}, { 511,13}, \
- { 1023,12}, { 2047,13}, { 1151,12}, { 2431,13}, \
- { 1407,14}, { 767,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 149
-#define MUL_FFT_THRESHOLD 2240
-
-#define SQR_FFT_MODF_THRESHOLD 244 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 244, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
- { 11, 5}, { 23, 6}, { 13, 7}, { 7, 6}, \
- { 16, 7}, { 9, 6}, { 19, 7}, { 11, 6}, \
- { 23, 7}, { 13, 8}, { 7, 7}, { 19, 8}, \
- { 11, 7}, { 23, 9}, { 7, 8}, { 15, 7}, \
- { 31, 8}, { 19, 7}, { 39, 8}, { 23, 9}, \
- { 15, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
- { 31, 8}, { 63, 9}, { 39, 8}, { 79, 9}, \
- { 47,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 71, 8}, { 143, 7}, { 287,10}, { 47,11}, \
- { 31,10}, { 63, 9}, { 127, 8}, { 255, 9}, \
- { 143, 8}, { 287,10}, { 79, 9}, { 159, 8}, \
- { 319, 9}, { 175, 8}, { 351, 7}, { 703, 6}, \
- { 1407,10}, { 95, 9}, { 191, 8}, { 383,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
- { 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
diff --git a/gmp/mpn/s390_32/esame/mul_1.asm b/gmp/mpn/s390_32/esame/mul_1.asm
deleted file mode 100644
index 04be963651..0000000000
--- a/gmp/mpn/s390_32/esame/mul_1.asm
+++ /dev/null
@@ -1,66 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 14
-C z990 9
-C z9 ?
-C z10 ?
-C z196 ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`v0', `%r5')
-
-ASM_START()
-PROLOGUE(mpn_mul_1)
- stm %r11, %r12, 44(%r15)
- lhi %r12, 0 C zero index register
- ahi %r12, 0 C clear carry flag
- lhi %r11, 0 C clear carry limb
-
-L(top): l %r1, 0(%r12,up)
- mlr %r0, v0
- alcr %r1, %r11
- lr %r11, %r0 C copy high part to carry limb
- st %r1, 0(%r12,rp)
- la %r12, 4(%r12)
- brct n, L(top)
-
- lhi %r2, 0
- alcr %r2, %r11
-
- lm %r11, %r12, 44(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/mul_basecase.asm b/gmp/mpn/s390_32/esame/mul_basecase.asm
deleted file mode 100644
index 2c8138d8d2..0000000000
--- a/gmp/mpn/s390_32/esame/mul_basecase.asm
+++ /dev/null
@@ -1,130 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 ?
-C z990 ?
-C z9 ?
-C z10 ?
-C z196 ?
-
-C TODO
-C * Perhaps add special case for un <= 2.
-C * Replace loops by faster code. The mul_1 and addmul_1 loops could be sped
-C up by about 10%.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`un', `%r4')
-define(`vp', `%r5')
-define(`vn', `%r6')
-
-define(`zero', `%r8')
-
-ASM_START()
-PROLOGUE(mpn_mul_basecase)
- chi un, 2
- jhe L(ge2)
-
-C un = vn = 1
- l %r1, 0(vp)
- ml %r0, 0(up)
- st %r1, 0(rp)
- st %r0, 4(rp)
- br %r14
-
-L(ge2): C jne L(gen)
-
-
-L(gen):
-C mul_1 =======================================================================
-
- stm %r6, %r12, 24(%r15)
- lhi zero, 0
- ahi un, -1
-
- l %r7, 0(vp)
- l %r11, 0(up)
- lhi %r12, 4 C init index register
- mlr %r10, %r7
- lr %r9, un
- st %r11, 0(rp)
- cr %r15, %r15 C clear carry flag
-
-L(tm): l %r1, 0(%r12,up)
- mlr %r0, %r7
- alcr %r1, %r10
- lr %r10, %r0 C copy high part to carry limb
- st %r1, 0(%r12,rp)
- la %r12, 4(%r12)
- brct %r9, L(tm)
-
- alcr %r0, zero
- st %r0, 0(%r12,rp)
-
-C addmul_1 loop ===============================================================
-
- ahi vn, -1
- je L(outer_end)
-L(outer_loop):
-
- la rp, 4(rp) C rp += 1
- la vp, 4(vp) C up += 1
- l %r7, 0(vp)
- l %r11, 0(up)
- lhi %r12, 4 C init index register
- mlr %r10, %r7
- lr %r9, un
- al %r11, 0(rp)
- st %r11, 0(rp)
-
-L(tam): l %r1, 0(%r12,up)
- l %r11, 0(%r12,rp)
- mlr %r0, %r7
- alcr %r1, %r11
- alcr %r0, zero
- alr %r1, %r10
- lr %r10, %r0
- st %r1, 0(%r12,rp)
- la %r12, 4(%r12)
- brct %r9, L(tam)
-
- alcr %r0, zero
- st %r0, 0(%r12,rp)
-
- brct vn, L(outer_loop)
-L(outer_end):
-
- lm %r6, %r12, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/sqr_basecase.asm b/gmp/mpn/s390_32/esame/sqr_basecase.asm
deleted file mode 100644
index dcc13112bf..0000000000
--- a/gmp/mpn/s390_32/esame/sqr_basecase.asm
+++ /dev/null
@@ -1,203 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 ?
-C z990 23
-C z9 ?
-C z10 ?
-C z196 ?
-
-C TODO
-C * Clean up.
-C * Stop iterating addmul_1 loop at latest for n = 2, implement longer tail.
-C This will ask for basecase handling of n = 3.
-C * Update counters and pointers more straightforwardly, possibly lowering
-C register usage.
-C * Should we use this allocation-free style for more sqr_basecase asm
-C implementations? The only disadvantage is that it requires R != U.
-C * Replace loops by faster code. The mul_1 and addmul_1 loops could be sped
-C up by about 10%. The sqr_diag_addlsh1 loop could probably be sped up even
-C more.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-
-define(`zero', `%r8')
-define(`rp_saved', `%r9')
-define(`up_saved', `%r13')
-define(`n_saved', `%r14')
-
-ASM_START()
-PROLOGUE(mpn_sqr_basecase)
- ahi n, -2
- jhe L(ge2)
-
-C n = 1
- l %r5, 0(up)
- mlr %r4, %r5
- st %r5, 0(rp)
- st %r4, 4(rp)
- br %r14
-
-L(ge2): jne L(gen)
-
-C n = 2
- stm %r6, %r8, 24(%r15)
- lhi zero, 0
-
- l %r5, 0(up)
- mlr %r4, %r5 C u0 * u0
- l %r1, 4(up)
- mlr %r0, %r1 C u1 * u1
- st %r5, 0(rp)
-
- l %r7, 0(up)
- ml %r6, 4(up) C u0 * u1
- alr %r7, %r7
- alcr %r6, %r6
- alcr %r0, zero
-
- alr %r4, %r7
- alcr %r1, %r6
- alcr %r0, zero
- st %r4, 4(rp)
- st %r1, 8(rp)
- st %r0, 12(rp)
-
- lm %r6, %r8, 24(%r15)
- br %r14
-
-L(gen):
-C mul_1 =======================================================================
-
- stm %r6, %r14, 24(%r15)
- lhi zero, 0
- lr up_saved, up
- lr rp_saved, rp
- lr n_saved, n
-
- l %r6, 0(up)
- l %r11, 4(up)
- lhi %r12, 8 C init index register
- mlr %r10, %r6
- lr %r5, n
- st %r11, 4(rp)
- cr %r15, %r15 C clear carry flag
-
-L(tm): l %r1, 0(%r12,up)
- mlr %r0, %r6
- alcr %r1, %r10
- lr %r10, %r0 C copy high part to carry limb
- st %r1, 0(%r12,rp)
- la %r12, 4(%r12)
- brct %r5, L(tm)
-
- alcr %r0, zero
- st %r0, 0(%r12,rp)
-
-C addmul_1 loop ===============================================================
-
- ahi n, -1
- je L(outer_end)
-L(outer_loop):
-
- la rp, 8(rp) C rp += 2
- la up, 4(up) C up += 1
- l %r6, 0(up)
- l %r11, 4(up)
- lhi %r12, 8 C init index register
- mlr %r10, %r6
- lr %r5, n
- al %r11, 4(rp)
- st %r11, 4(rp)
-
-L(tam): l %r1, 0(%r12,up)
- l %r7, 0(%r12,rp)
- mlr %r0, %r6
- alcr %r1, %r7
- alcr %r0, zero
- alr %r1, %r10
- lr %r10, %r0
- st %r1, 0(%r12,rp)
- la %r12, 4(%r12)
- brct %r5, L(tam)
-
- alcr %r0, zero
- st %r0, 0(%r12,rp)
-
- brct n, L(outer_loop)
-L(outer_end):
-
- l %r6, 4(up)
- l %r1, 8(up)
- lr %r7, %r0 C Same as: l %r7, 12(,rp)
- mlr %r0, %r6
- alr %r1, %r7
- alcr %r0, zero
- st %r1, 12(rp)
- st %r0, 16(rp)
-
-C sqr_dia_addlsh1 ============================================================
-
-define(`up', `up_saved')
-define(`rp', `rp_saved')
- la n, 1(n_saved)
-
- l %r1, 0(up)
- mlr %r0, %r1
- st %r1, 0(rp)
-C clr %r15, %r15 C clear carry (already clear per above)
-
-L(top): l %r11, 4(up)
- la up, 4(up)
- l %r6, 4(rp)
- l %r7, 8(rp)
- mlr %r10, %r11
- alcr %r6, %r6
- alcr %r7, %r7
- alcr %r10, zero C propagate carry to high product limb
- alr %r6, %r0
- alcr %r7, %r11
- stm %r6, %r7, 4(rp)
- la rp, 8(rp)
- lr %r0, %r10 C copy carry limb
- brct n, L(top)
-
- alcr %r0, zero
- st %r0, 4(rp)
-
- lm %r6, %r14, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/esame/submul_1.asm b/gmp/mpn/s390_32/esame/submul_1.asm
deleted file mode 100644
index a71e57e230..0000000000
--- a/gmp/mpn/s390_32/esame/submul_1.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 20
-C z990 11
-C z9 ?
-C z10 ?
-C z196 ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`v0', `%r5')
-
-ASM_START()
-PROLOGUE(mpn_submul_1)
- stm %r9, %r12, 36(%r15)
- lhi %r12, 0
- slr %r11, %r11
-
-L(top): l %r1, 0(%r12, up)
- l %r10, 0(%r12, rp)
- mlr %r0, v0
- slbr %r10, %r1
- slbr %r9, %r9
- slr %r0, %r9 C conditional incr
- slr %r10, %r11
- lr %r11, %r0
- st %r10, 0(%r12, rp)
- la %r12, 4(%r12)
- brct %r4, L(top)
-
- lr %r2, %r11
- slbr %r9, %r9
- slr %r2, %r9
-
- lm %r9, %r12, 36(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/gmp-mparam.h b/gmp/mpn/s390_32/gmp-mparam.h
deleted file mode 100644
index 1aca74a818..0000000000
--- a/gmp/mpn/s390_32/gmp-mparam.h
+++ /dev/null
@@ -1,138 +0,0 @@
-/* S/390-32 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 770 MHz IBM z900 running in 32-bit mode, using just traditional insns */
-
-#define DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 5
-#define MOD_1_1P_METHOD 2
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 5
-#define MOD_1N_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 15
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 30
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-#define USE_PREINV_DIVREM_1 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 19
-#define MUL_TOOM33_THRESHOLD 114
-#define MUL_TOOM44_THRESHOLD 166
-#define MUL_TOOM6H_THRESHOLD 226
-#define MUL_TOOM8H_THRESHOLD 333
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 106
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 122
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
-
-#define SQR_BASECASE_THRESHOLD 7
-#define SQR_TOOM2_THRESHOLD 40
-#define SQR_TOOM3_THRESHOLD 126
-#define SQR_TOOM4_THRESHOLD 192
-#define SQR_TOOM6_THRESHOLD 246
-#define SQR_TOOM8_THRESHOLD 357
-
-#define MULMID_TOOM42_THRESHOLD 28
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 18
-
-#define MUL_FFT_MODF_THRESHOLD 244 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 244, 5}, { 13, 6}, { 7, 5}, { 15, 6}, \
- { 8, 5}, { 17, 6}, { 13, 7}, { 7, 6}, \
- { 16, 7}, { 9, 6}, { 19, 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,11}, { 2048,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 48
-#define MUL_FFT_THRESHOLD 2688
-
-#define SQR_FFT_MODF_THRESHOLD 216 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 216, 5}, { 7, 4}, { 15, 5}, { 17, 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, 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,11}, { 2048,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 44
-#define SQR_FFT_THRESHOLD 1856
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 61
-#define MULLO_MUL_N_THRESHOLD 5240
-
-#define DC_DIV_QR_THRESHOLD 70
-#define DC_DIVAPPR_Q_THRESHOLD 234
-#define DC_BDIV_QR_THRESHOLD 59
-#define DC_BDIV_Q_THRESHOLD 137
-
-#define INV_MULMOD_BNM1_THRESHOLD 36
-#define INV_NEWTON_THRESHOLD 327
-#define INV_APPR_THRESHOLD 268
-
-#define BINV_NEWTON_THRESHOLD 324
-#define REDC_1_TO_REDC_N_THRESHOLD 63
-
-#define MU_DIV_QR_THRESHOLD 1099
-#define MU_DIVAPPR_Q_THRESHOLD 1360
-#define MUPI_DIV_QR_THRESHOLD 138
-#define MU_BDIV_QR_THRESHOLD 889
-#define MU_BDIV_Q_THRESHOLD 1234
-
-#define MATRIX22_STRASSEN_THRESHOLD 18
-#define HGCD_THRESHOLD 167
-#define GCD_DC_THRESHOLD 518
-#define GCDEXT_DC_THRESHOLD 378
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 14
-#define GET_STR_PRECOMPUTE_THRESHOLD 25
-#define SET_STR_DC_THRESHOLD 577
-#define SET_STR_PRECOMPUTE_THRESHOLD 1217
diff --git a/gmp/mpn/s390_32/logops_n.asm b/gmp/mpn/s390_32/logops_n.asm
deleted file mode 100644
index 1f2cd2a8f6..0000000000
--- a/gmp/mpn/s390_32/logops_n.asm
+++ /dev/null
@@ -1,295 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 variant 1 variant 2 variant 3
-C rp!=up rp=up
-C z900 ? ? ? ?
-C z990 2.5 1 2.75 2.75
-C z9 ? ? ?
-C z10 ? ? ?
-C z196 ? ? ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`vp', `%r4')
-define(`nn', `%r5')
-
-ifdef(`OPERATION_and_n',`
- define(`func',`mpn_and_n')
- define(`VARIANT_1')
- define(`LOGOPC',`nc')
- define(`LOGOP',`n')')
-ifdef(`OPERATION_andn_n',`
- define(`func',`mpn_andn_n')
- define(`VARIANT_2')
- define(`LOGOP',`n')')
-ifdef(`OPERATION_nand_n',`
- define(`func',`mpn_nand_n')
- define(`VARIANT_3')
- define(`LOGOP',`n')')
-ifdef(`OPERATION_ior_n',`
- define(`func',`mpn_ior_n')
- define(`VARIANT_1')
- define(`LOGOPC',`oc')
- define(`LOGOP',`o')')
-ifdef(`OPERATION_iorn_n',`
- define(`func',`mpn_iorn_n')
- define(`VARIANT_2')
- define(`LOGOP',`o')')
-ifdef(`OPERATION_nior_n',`
- define(`func',`mpn_nior_n')
- define(`VARIANT_3')
- define(`LOGOP',`o')')
-ifdef(`OPERATION_xor_n',`
- define(`func',`mpn_xor_n')
- define(`VARIANT_1')
- define(`LOGOPC',`xc')
- define(`LOGOP',`x')')
-ifdef(`OPERATION_xnor_n',`
- define(`func',`mpn_xnor_n')
- define(`VARIANT_2')
- define(`LOGOP',`x')')
-
-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)
-ifdef(`VARIANT_1',`
- cr rp, up
- jne L(normal)
-
- sll nn, 2
- ahi nn, -1
- lr %r1, nn
- srl %r1, 8
- ltr %r1, %r1 C < 256 bytes to copy?
- je L(1)
-
-L(tp): LOGOPC 0(256, rp), 0(vp)
- la rp, 256(rp)
- la vp, 256(vp)
- brct %r1, L(tp)
-
-L(1): bras %r1, L(2) C make r1 point to mvc insn
- LOGOPC 0(1, rp), 0(vp)
-L(2): ex nn, 0(%r1) C execute mvc with length ((nn-1) mod 256)+1
-L(rtn): br %r14
-
-
-L(normal):
- stm %r6, %r8, 12(%r15)
- ahi nn, 3
- lhi %r7, 3
- lr %r0, nn
- srl %r0, 2
- nr %r7, nn C nn mod 4
- je L(b1)
- chi %r7, 2
- jl L(b2)
- jne L(top)
-
-L(b3): lm %r5, %r7, 0(up)
- la up, 12(up)
- LOGOP %r5, 0(vp)
- LOGOP %r6, 4(vp)
- LOGOP %r7, 8(vp)
- stm %r5, %r7, 0(rp)
- la rp, 12(rp)
- la vp, 12(vp)
- j L(mid)
-
-L(b1): l %r5, 0(up)
- la up, 4(up)
- LOGOP %r5, 0(vp)
- st %r5, 0(rp)
- la rp, 4(rp)
- la vp, 4(vp)
- j L(mid)
-
-L(b2): lm %r5, %r6, 0(up)
- la up, 8(up)
- LOGOP %r5, 0(vp)
- LOGOP %r6, 4(vp)
- stm %r5, %r6, 0(rp)
- la rp, 8(rp)
- la vp, 8(vp)
- j L(mid)
-
-L(top): lm %r5, %r8, 0(up)
- la up, 16(up)
- LOGOP %r5, 0(vp)
- LOGOP %r6, 4(vp)
- LOGOP %r7, 8(vp)
- LOGOP %r8, 12(vp)
- stm %r5, %r8, 0(rp)
- la rp, 16(rp)
- la vp, 16(vp)
-L(mid): brct %r0, L(top)
-
- lm %r6, %r8, 12(%r15)
- br %r14
-')
-
-ifdef(`VARIANT_2',`
- stm %r6, %r8, 12(%r15)
- lhi %r1, -1
-
- ahi nn, 3
- lhi %r7, 3
- lr %r0, nn
- srl %r0, 2
- nr %r7, nn C nn mod 4
- je L(b1)
- chi %r7, 2
- jl L(b2)
- jne L(top)
-
-L(b3): lm %r5, %r7, 0(vp)
- la vp, 12(vp)
- xr %r5, %r1
- xr %r6, %r1
- xr %r7, %r1
- LOGOP %r5, 0(up)
- LOGOP %r6, 4(up)
- LOGOP %r7, 8(up)
- stm %r5, %r7, 0(rp)
- la rp, 12(rp)
- la up, 12(up)
- j L(mid)
-
-L(b1): l %r5, 0(vp)
- la vp, 4(vp)
- xr %r5, %r1
- LOGOP %r5, 0(up)
- st %r5, 0(rp)
- la rp, 4(rp)
- la up, 4(up)
- j L(mid)
-
-L(b2): lm %r5, %r6, 0(vp)
- la vp, 8(vp)
- xr %r5, %r1
- xr %r6, %r1
- LOGOP %r5, 0(up)
- LOGOP %r6, 4(up)
- stm %r5, %r6, 0(rp)
- la rp, 8(rp)
- la up, 8(up)
- j L(mid)
-
-L(top): lm %r5, %r8, 0(vp)
- la vp, 16(vp)
- xr %r5, %r1
- xr %r6, %r1
- xr %r7, %r1
- xr %r8, %r1
- LOGOP %r5, 0(up)
- LOGOP %r6, 4(up)
- LOGOP %r7, 8(up)
- LOGOP %r8, 12(up)
- la up, 16(up)
- stm %r5, %r8, 0(rp)
- la rp, 16(rp)
-L(mid): brct %r0, L(top)
-
- lm %r6, %r8, 12(%r15)
- br %r14
-')
-
-ifdef(`VARIANT_3',`
- stm %r6, %r8, 12(%r15)
- lhi %r1, -1
-
- ahi nn, 3
- lhi %r7, 3
- lr %r0, nn
- srl %r0, 2
- nr %r7, nn C nn mod 4
- je L(b1)
- chi %r7, 2
- jl L(b2)
- jne L(top)
-
-L(b3): lm %r5, %r7, 0(vp)
- la vp, 12(vp)
- LOGOP %r5, 0(up)
- LOGOP %r6, 4(up)
- xr %r5, %r1
- xr %r6, %r1
- LOGOP %r7, 8(up)
- xr %r7, %r1
- stm %r5, %r7, 0(rp)
- la rp, 12(rp)
- la up, 12(up)
- j L(mid)
-
-L(b1): l %r5, 0(vp)
- la vp, 4(vp)
- LOGOP %r5, 0(up)
- xr %r5, %r1
- st %r5, 0(rp)
- la rp, 4(rp)
- la up, 4(up)
- j L(mid)
-
-L(b2): lm %r5, %r6, 0(vp)
- la vp, 8(vp)
- LOGOP %r5, 0(up)
- LOGOP %r6, 4(up)
- xr %r5, %r1
- xr %r6, %r1
- stm %r5, %r6, 0(rp)
- la rp, 8(rp)
- la up, 8(up)
- j L(mid)
-
-L(top): lm %r5, %r8, 0(vp)
- la vp, 16(vp)
- LOGOP %r5, 0(up)
- LOGOP %r6, 4(up)
- xr %r5, %r1
- xr %r6, %r1
- LOGOP %r7, 8(up)
- LOGOP %r8, 12(up)
- xr %r7, %r1
- xr %r8, %r1
- stm %r5, %r8, 0(rp)
- la up, 16(up)
- la rp, 16(rp)
-L(mid): brct %r0, L(top)
-
- lm %r6, %r8, 12(%r15)
- br %r14
-')
-
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/lshift.asm b/gmp/mpn/s390_32/lshift.asm
deleted file mode 100644
index da7d76e844..0000000000
--- a/gmp/mpn/s390_32/lshift.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 6
-C z990 3
-C z9 ?
-C z10 ?
-C z196 ?
-
-C TODO
-C *
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`cnt', `%r5')
-
-ASM_START()
-PROLOGUE(mpn_lshift)
- lr %r1, n
- sll %r1, 2
- stm %r6, %r12, 24(%r15)
- la up, 0(%r1,up) C put up near end of U
- la rp, 0(%r1,rp) C put rp near end of R
- ahi up, -20
- ahi rp, -16
- lhi %r8, 32
- sr %r8, cnt
- l %r12, 16(up)
- srl %r12, 0(%r8) C return value
- lhi %r7, 3
- nr %r7, n
- srl n, 2
- je L(b0)
- chi %r7, 2
- jl L(b1)
- je L(b2)
-
-L(b3): l %r10, 16(up)
- l %r11, 12(up)
- l %r9, 8(up)
- ahi up, -8
- lr %r8, %r11
- sldl %r10, 0(cnt)
- sldl %r8, 0(cnt)
- st %r10, 12(rp)
- st %r8, 8(rp)
- ahi rp, -8
- ltr n, n
- je L(end)
- j L(top)
-
-L(b2): l %r10, 16(up)
- l %r11, 12(up)
- ahi up, -4
- sldl %r10, 0(cnt)
- st %r10, 12(rp)
- ahi rp, -4
- ltr n, n
- je L(end)
- j L(top)
-
-L(b1): ltr n, n
- je L(end)
- j L(top)
-
-L(b0): l %r10,16(up)
- l %r8, 12(up)
- l %r6, 8(up)
- l %r0, 4(up)
- ahi up, -12
- lr %r11, %r8
- lr %r9, %r6
- lr %r7, %r0
- sldl %r10,0(cnt)
- sldl %r8, 0(cnt)
- sldl %r6, 0(cnt)
- st %r10, 12(rp)
- st %r8, 8(rp)
- st %r6, 4(rp)
- ahi rp, -12
- ahi n, -1
- je L(end)
-
- ALIGN(8)
-L(top): l %r10, 16(up)
- l %r8, 12(up)
- l %r6, 8(up)
- l %r0, 4(up)
- l %r1, 0(up)
- lr %r11, %r8
- lr %r9, %r6
- lr %r7, %r0
- ahi up, -16
- sldl %r10, 0(cnt)
- sldl %r8, 0(cnt)
- sldl %r6, 0(cnt)
- sldl %r0, 0(cnt)
- st %r10, 12(rp)
- st %r8, 8(rp)
- st %r6, 4(rp)
- st %r0, 0(rp)
- ahi rp, -16
- brct n, L(top)
-
-L(end): l %r10, 16(up)
- sll %r10, 0(cnt)
- st %r10, 12(rp)
-
- lr %r2, %r12
- lm %r6, %r12, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/lshiftc.asm b/gmp/mpn/s390_32/lshiftc.asm
deleted file mode 100644
index f601673249..0000000000
--- a/gmp/mpn/s390_32/lshiftc.asm
+++ /dev/null
@@ -1,156 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 7
-C z990 3.375
-C z9 ?
-C z10 ?
-C z196 ?
-
-C TODO
-C *
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`cnt', `%r5')
-
-ASM_START()
-PROLOGUE(mpn_lshiftc)
- lr %r1, n
- sll %r1, 2
- stm %r6, %r13, 24(%r15)
- la up, 0(%r1,up) C put up near end of U
- la rp, 0(%r1,rp) C put rp near end of R
- ahi up, -20
- ahi rp, -16
- lhi %r8, 32
- sr %r8, cnt
- l %r12, 16(up)
- srl %r12, 0(%r8) C return value
- lhi %r13, -1
- lhi %r7, 3
- nr %r7, n
- srl n, 2
- je L(b0)
- chi %r7, 2
- jl L(b1)
- je L(b2)
-
-L(b3): l %r10, 16(up)
- l %r11, 12(up)
- l %r9, 8(up)
- ahi up, -8
- lr %r8, %r11
- sldl %r10, 0(cnt)
- sldl %r8, 0(cnt)
- xr %r10, %r13
- xr %r8, %r13
- st %r10, 12(rp)
- st %r8, 8(rp)
- ahi rp, -8
- ltr n, n
- je L(end)
- j L(top)
-
-L(b2): l %r10, 16(up)
- l %r11, 12(up)
- ahi up, -4
- sldl %r10, 0(cnt)
- xr %r10, %r13
- st %r10, 12(rp)
- ahi rp, -4
- ltr n, n
- je L(end)
- j L(top)
-
-L(b1): ltr n, n
- je L(end)
- j L(top)
-
-L(b0): l %r10,16(up)
- l %r8, 12(up)
- l %r6, 8(up)
- l %r0, 4(up)
- ahi up, -12
- lr %r11, %r8
- lr %r9, %r6
- lr %r7, %r0
- sldl %r10,0(cnt)
- sldl %r8, 0(cnt)
- sldl %r6, 0(cnt)
- xr %r10, %r13
- xr %r8, %r13
- xr %r6, %r13
- st %r10, 12(rp)
- st %r8, 8(rp)
- st %r6, 4(rp)
- ahi rp, -12
- ahi n, -1
- je L(end)
-
- ALIGN(8)
-L(top): l %r10, 16(up)
- l %r8, 12(up)
- l %r6, 8(up)
- l %r0, 4(up)
- l %r1, 0(up)
- lr %r11, %r8
- lr %r9, %r6
- lr %r7, %r0
- ahi up, -16
- sldl %r10, 0(cnt)
- sldl %r8, 0(cnt)
- sldl %r6, 0(cnt)
- sldl %r0, 0(cnt)
- xr %r10, %r13
- xr %r8, %r13
- xr %r6, %r13
- xr %r0, %r13
- st %r10, 12(rp)
- st %r8, 8(rp)
- st %r6, 4(rp)
- st %r0, 0(rp)
- ahi rp, -16
- brct n, L(top)
-
-L(end): l %r10, 16(up)
- sll %r10, 0(cnt)
- xr %r10, %r13
- st %r10, 12(rp)
-
- lr %r2, %r12
- lm %r6, %r13, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_32/rshift.asm b/gmp/mpn/s390_32/rshift.asm
deleted file mode 100644
index 5f2cf37ca0..0000000000
--- a/gmp/mpn/s390_32/rshift.asm
+++ /dev/null
@@ -1,138 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 6
-C z990 3
-C z9 ?
-C z10 ?
-C z196 ?
-
-C TODO
-C *
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`cnt', `%r5')
-
-ASM_START()
-PROLOGUE(mpn_rshift)
- stm %r6, %r12, 24(%r15)
- lhi %r8, 32
- sr %r8, cnt
- l %r12, 0(up)
- sll %r12, 0(%r8) C return value
- lhi %r7, 3
- nr %r7, n
- srl n, 2
- je L(b0)
- chi %r7, 2
- jl L(b1)
- je L(b2)
-
-L(b3): l %r11, 0(up)
- l %r10, 4(up)
- l %r8, 8(up)
- ahi up, 8
- lr %r9, %r10
- srdl %r10, 0(cnt)
- srdl %r8, 0(cnt)
- st %r11, 0(rp)
- st %r9, 4(rp)
- ahi rp, 8
- ltr n, n
- je L(end)
- j L(top)
-
-L(b2): l %r11, 0(up)
- l %r10, 4(up)
- ahi up, 4
- srdl %r10, 0(cnt)
- st %r11, 0(rp)
- ahi rp, 4
- ltr n, n
- je L(end)
- j L(top)
-
-L(b1): ltr n, n
- je L(end)
- j L(top)
-
-L(b0): l %r11, 0(up)
- l %r9, 4(up)
- l %r7, 8(up)
- l %r1, 12(up)
- ahi up, 12
- lr %r10, %r9
- lr %r8, %r7
- lr %r6, %r1
- srdl %r10, 0(cnt)
- srdl %r8, 0(cnt)
- srdl %r6, 0(cnt)
- st %r11, 0(rp)
- st %r9, 4(rp)
- st %r7, 8(rp)
- ahi rp, 12
- ahi n, -1
- je L(end)
-
- ALIGN(8)
-L(top): l %r11, 0(up)
- l %r9, 4(up)
- l %r7, 8(up)
- l %r1, 12(up)
- l %r0, 16(up)
- lr %r10, %r9
- lr %r8, %r7
- lr %r6, %r1
- ahi up, 16
- srdl %r10, 0(cnt)
- srdl %r8, 0(cnt)
- srdl %r6, 0(cnt)
- srdl %r0, 0(cnt)
- st %r11, 0(rp)
- st %r9, 4(rp)
- st %r7, 8(rp)
- st %r1, 12(rp)
- ahi rp, 16
- brct n, L(top)
-
-L(end): l %r11, 0(up)
- srl %r11, 0(cnt)
- st %r11, 0(rp)
-
- lr %r2, %r12
- lm %r6, %r12, 24(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/README b/gmp/mpn/s390_64/README
deleted file mode 100644
index 8f482a9cd2..0000000000
--- a/gmp/mpn/s390_64/README
+++ /dev/null
@@ -1,88 +0,0 @@
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/.
-
-
-
-There are 5 generations of 64-but s390 processors, z900, z990, z9,
-z10, and z196. The current GMP code was optimised for the two oldest,
-z900 and z990.
-
-
-mpn_copyi
-
-This code makes use of a loop around MVC. It almost surely runs very
-close to optimally. A small improvement could be done by using one
-MVC for size 256 bytes, now we use two (we use an extra MVC when
-copying any multiple of 256 bytes).
-
-
-mpn_copyd
-
-We have tried several feed-in variants here, branch tree, jump table
-and computed goto. The fastest (on z990) turned out to be computed
-goto.
-
-An approach not tried is EX of LMG and STMG, modifying the register set
-on-the-fly. Using that trick, we could completely avoid using
-separate feed-in paths.
-
-
-mpn_lshift, mpn_rshift
-
-The current code runs at pipeline decode bandwith on z990.
-
-
-mpn_add_n, mpn_sub_n
-
-The current code is 4-way unrolled. It should be unrolled more, at
-least 8x, in order to reach 2.5 c/l.
-
-
-mpn_mul_1, mpn_addmul_1, mpn_submul_1
-
-The current code is very naive, but due to the non-pipelined nature of
-MLGR on z900 and z990, more sophisticated code would not gain much.
-
-On z10 one would need to cluster at least 4 MLGR together, in order to
-reduce stalling.
-
-On z196, one surely want to use unrolling and pipelining, to perhaps
-reach around 12 c/l. A major issue here and on z10 is ALCGR's 3 cycle
-stalling.
-
-
-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 multiplication primitives. The newer machines might
-benefit less from this approach, perhaps in particular z10, where MLGR
-clustering is more important.
-
-With Karatsuba, one could hope for around 16 cycles per accumulated
-128 cross product, on z990.
diff --git a/gmp/mpn/s390_64/addmul_1.asm b/gmp/mpn/s390_64/addmul_1.asm
deleted file mode 100644
index 84cca12361..0000000000
--- a/gmp/mpn/s390_64/addmul_1.asm
+++ /dev/null
@@ -1,72 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 34
-C z990 23
-C z9 ?
-C z10 28
-C z196 ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`v0', `%r5')
-
-define(`z', `%r9')
-
-ASM_START()
-PROLOGUE(mpn_addmul_1)
- stmg %r9, %r12, 72(%r15)
- lghi %r12, 0 C zero index register
- aghi %r12, 0 C clear carry flag
- lghi %r11, 0 C clear carry limb
- lghi z, 0 C keep register zero
-
-L(top): lg %r1, 0(%r12,up)
- lg %r10, 0(%r12,rp)
- mlgr %r0, v0
- alcgr %r1, %r10
- alcgr %r0, z
- algr %r1, %r11
- lgr %r11, %r0
- stg %r1, 0(%r12,rp)
- la %r12, 8(%r12)
- brctg n, L(top)
-
- lghi %r2, 0
- alcgr %r2, %r11
-
- lmg %r9, %r12, 72(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/aorrlsh1_n.asm b/gmp/mpn/s390_64/aorrlsh1_n.asm
deleted file mode 100644
index 697259efef..0000000000
--- a/gmp/mpn/s390_64/aorrlsh1_n.asm
+++ /dev/null
@@ -1,168 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 9
-C z990 4.75
-C z9 ?
-C z10 11
-C z196 ?
-
-C TODO
-C * Optimise for small n, avoid 'la' like in aors_n.asm.
-C * Tune to reach 3.5 c/l. For addlsh1, we could let the main alcgr propagate
-C carry to the lsh1 alcgr.
-C * Compute RETVAL for sublsh1_n less stupidly.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`vp', `%r4')
-define(`n', `%r5')
-
-ifdef(`OPERATION_addlsh1_n',`
- define(ADSB, alg)
- define(ADSBC, alcg)
- define(INITCY, `lghi %r9, -1')
- define(RETVAL, `la %r2, 2(%r1,%r9)')
- define(func, mpn_addlsh1_n)
-')
-ifdef(`OPERATION_rsblsh1_n',`
- define(ADSB, slg)
- define(ADSBC, slbg)
- define(INITCY, `lghi %r9, 0')
- define(RETVAL,`dnl
- algr %r1, %r9
- lghi %r2, 1
- algr %r2, %r1')
- define(func, mpn_rsblsh1_n)
-')
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_rsblsh1_n)
-
-ASM_START()
-PROLOGUE(func)
- stmg %r6, %r9, 48(%r15)
-
- aghi n, 3
- lghi %r7, 3
- srlg %r0, n, 2
- ngr %r7, n C n mod 4
- je L(b1)
- cghi %r7, 2
- jl L(b2)
- jne L(b0)
-
-L(b3): lmg %r5, %r7, 0(vp)
- la vp, 24(vp)
-
- algr %r5, %r5
- alcgr %r6, %r6
- alcgr %r7, %r7
- slbgr %r1, %r1
-
- ADSB %r5, 0(up)
- ADSBC %r6, 8(up)
- ADSBC %r7, 16(up)
- la up, 24(up)
- slbgr %r9, %r9
-
- stmg %r5, %r7, 0(rp)
- la rp, 24(rp)
- brctg %r0, L(top)
- j L(end)
-
-L(b0): lghi %r1, -1
- INITCY
- j L(top)
-
-L(b1): lg %r5, 0(vp)
- la vp, 8(vp)
-
- algr %r5, %r5
- slbgr %r1, %r1
- ADSB %r5, 0(up)
- la up, 8(up)
- slbgr %r9, %r9
-
- stg %r5, 0(rp)
- la rp, 8(rp)
- brctg %r0, L(top)
- j L(end)
-
-L(b2): lmg %r5, %r6, 0(vp)
- la vp, 16(vp)
-
- algr %r5, %r5
- alcgr %r6, %r6
- slbgr %r1, %r1
-
- ADSB %r5, 0(up)
- ADSBC %r6, 8(up)
- la up, 16(up)
- slbgr %r9, %r9
-
- stmg %r5, %r6, 0(rp)
- la rp, 16(rp)
- brctg %r0, L(top)
- j L(end)
-
-L(top): lmg %r5, %r8, 0(vp)
- la vp, 32(vp)
-
- aghi %r1, 1 C restore carry
-
- alcgr %r5, %r5
- alcgr %r6, %r6
- alcgr %r7, %r7
- alcgr %r8, %r8
-
- slbgr %r1, %r1 C save carry
-
- aghi %r9, 1 C restore carry
-
- ADSBC %r5, 0(up)
- ADSBC %r6, 8(up)
- ADSBC %r7, 16(up)
- ADSBC %r8, 24(up)
- la up, 32(up)
-
- slbgr %r9, %r9 C save carry
-
- stmg %r5, %r8, 0(rp)
- la rp, 32(rp)
- brctg %r0, L(top)
-
-L(end): RETVAL
- lmg %r6, %r9, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/aors_n.asm b/gmp/mpn/s390_64/aors_n.asm
deleted file mode 100644
index a3c3ca791c..0000000000
--- a/gmp/mpn/s390_64/aors_n.asm
+++ /dev/null
@@ -1,136 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 5.5
-C z990 3
-C z9 ?
-C z10 6
-C z196 ?
-
-C TODO
-C * Optimise for small n
-C * Use r0 and save/restore one less register
-C * Using logops_n's v1 inner loop operand order make the loop about 20%
-C faster, at the expense of highly alignment-dependent performance.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`vp', `%r4')
-define(`n', `%r5')
-
-ifdef(`OPERATION_add_n', `
- define(ADSB, alg)
- define(ADSBCR, alcgr)
- define(ADSBC, alcg)
- define(RETVAL,`dnl
- lghi %r2, 0
- alcgr %r2, %r2')
- define(func, mpn_add_n)
- define(func_nc, mpn_add_nc)')
-ifdef(`OPERATION_sub_n', `
- define(ADSB, slg)
- define(ADSBCR, slbgr)
- define(ADSBC, slbg)
- define(RETVAL,`dnl
- slbgr %r2, %r2
- lcgr %r2, %r2')
- define(func, mpn_sub_n)
- define(func_nc, mpn_sub_nc)')
-
-MULFUNC_PROLOGUE(mpn_add_n mpn_sub_n)
-
-ASM_START()
-PROLOGUE(func)
- stmg %r6, %r8, 48(%r15)
-
- aghi n, 3
- lghi %r7, 3
- srlg %r1, n, 2
- ngr %r7, n C n mod 4
- je L(b1)
- cghi %r7, 2
- jl L(b2)
- jne L(b0)
-
-L(b3): lmg %r5, %r7, 0(up)
- la up, 24(up)
- ADSB %r5, 0(vp)
- ADSBC %r6, 8(vp)
- ADSBC %r7, 16(vp)
- la vp, 24(vp)
- stmg %r5, %r7, 0(rp)
- la rp, 24(rp)
- brctg %r1, L(top)
- j L(end)
-
-L(b0): lmg %r5, %r8, 0(up) C This redundant insns is no mistake,
- la up, 32(up) C it is needed to make main loop run
- ADSB %r5, 0(vp) C fast for n = 0 (mod 4).
- ADSBC %r6, 8(vp)
- j L(m0)
-
-L(b1): lg %r5, 0(up)
- la up, 8(up)
- ADSB %r5, 0(vp)
- la vp, 8(vp)
- stg %r5, 0(rp)
- la rp, 8(rp)
- brctg %r1, L(top)
- j L(end)
-
-L(b2): lmg %r5, %r6, 0(up)
- la up, 16(up)
- ADSB %r5, 0(vp)
- ADSBC %r6, 8(vp)
- la vp, 16(vp)
- stmg %r5, %r6, 0(rp)
- la rp, 16(rp)
- brctg %r1, L(top)
- j L(end)
-
-L(top): lmg %r5, %r8, 0(up)
- la up, 32(up)
- ADSBC %r5, 0(vp)
- ADSBC %r6, 8(vp)
-L(m0): ADSBC %r7, 16(vp)
- ADSBC %r8, 24(vp)
- la vp, 32(vp)
- stmg %r5, %r8, 0(rp)
- la rp, 32(rp)
- brctg %r1, L(top)
-
-L(end): RETVAL
- lmg %r6, %r8, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/bdiv_dbm1c.asm b/gmp/mpn/s390_64/bdiv_dbm1c.asm
deleted file mode 100644
index 35e900a279..0000000000
--- a/gmp/mpn/s390_64/bdiv_dbm1c.asm
+++ /dev/null
@@ -1,65 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 29
-C z990 22
-C z9 ?
-C z10 19
-C z196 ?
-
-C INPUT PARAMETERS
-define(`qp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`bd', `%r5')
-define(`cy', `%r6')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_bdiv_dbm1c)
- stmg %r6, %r7, 48(%r15)
- lghi %r7, 0 C zero index register
-
-L(top): lg %r1, 0(%r7,up)
- mlgr %r0, bd
- slgr %r6, %r1
- stg %r6, 0(%r7,qp)
- la %r7, 8(%r7)
- slbgr %r6, %r0
- brctg n, L(top)
-
- lgr %r2, %r6
- lmg %r6, %r7, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/copyd.asm b/gmp/mpn/s390_64/copyd.asm
deleted file mode 100644
index 8631e19f00..0000000000
--- a/gmp/mpn/s390_64/copyd.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 2.67
-C z990 1.5
-C z9 ?
-C z10 1.8
-C z196 ?
-
-C FIXME:
-C * Avoid saving/restoring callee-saves registers for n < 3. This could be
-C done by setting rp=r1, up=r2, i=r0 and r3,r4,r5 for clock regs.
-C We could then use r3...r10 in main loop.
-C * Could we use some EX trick, modifying lmg/stmg, for the feed-in code?
-
-C INPUT PARAMETERS
-define(`rp_param', `%r2')
-define(`up_param', `%r3')
-define(`n', `%r4')
-
-define(`rp', `%r8')
-define(`up', `%r9')
-
-ASM_START()
-PROLOGUE(mpn_copyd)
- stmg %r6, %r11, 48(%r15)
-
- sllg %r1, n, 3
- la %r10, 8(n)
- aghi %r1, -64
- srlg %r10, %r10, 3
- lghi %r11, -64
-
- la rp, 0(%r1,rp_param) C FIXME use lay on z990 and later
- la up, 0(%r1,up_param) C FIXME use lay on z990 and later
-
- lghi %r7, 7
- ngr %r7, n C n mod 8
- cghi %r7, 2
- jh L(b34567)
- cghi %r7, 1
- je L(b1)
- jh L(b2)
-
-L(b0): brctg %r10, L(top)
- j L(end)
-
-L(b1): lg %r0, 56(up)
- aghi up, -8
- stg %r0, 56(rp)
- aghi rp, -8
- brctg %r10, L(top)
- j L(end)
-
-L(b2): lmg %r0, %r1, 48(up)
- aghi up, -16
- stmg %r0, %r1, 48(rp)
- aghi rp, -16
- brctg %r10, L(top)
- j L(end)
-
-L(b34567):
- cghi %r7, 4
- jl L(b3)
- je L(b4)
- cghi %r7, 6
- je L(b6)
- jh L(b7)
-
-L(b5): lmg %r0, %r4, 24(up)
- aghi up, -40
- stmg %r0, %r4, 24(rp)
- aghi rp, -40
- brctg %r10, L(top)
- j L(end)
-
-L(b3): lmg %r0, %r2, 40(up)
- aghi up, -24
- stmg %r0, %r2, 40(rp)
- aghi rp, -24
- brctg %r10, L(top)
- j L(end)
-
-L(b4): lmg %r0, %r3, 32(up)
- aghi up, -32
- stmg %r0, %r3, 32(rp)
- aghi rp, -32
- brctg %r10, L(top)
- j L(end)
-
-L(b6): lmg %r0, %r5, 16(up)
- aghi up, -48
- stmg %r0, %r5, 16(rp)
- aghi rp, -48
- brctg %r10, L(top)
- j L(end)
-
-L(b7): lmg %r0, %r6, 8(up)
- aghi up, -56
- stmg %r0, %r6, 8(rp)
- aghi rp, -56
- brctg %r10, L(top)
- j L(end)
-
-L(top): lmg %r0, %r7, 0(up)
- la up, 0(%r11,up)
- stmg %r0, %r7, 0(rp)
- la rp, 0(%r11,rp)
- brctg %r10, L(top)
-
-L(end): lmg %r6, %r11, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/copyi.asm b/gmp/mpn/s390_64/copyi.asm
deleted file mode 100644
index bfb88814ea..0000000000
--- a/gmp/mpn/s390_64/copyi.asm
+++ /dev/null
@@ -1,68 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 1.25
-C z990 0.75
-C z9 ?
-C z10 1
-C z196 ?
-
-C NOTE
-C * This is based on GNU libc memcpy which was written by Martin Schwidefsky.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-
-ASM_START()
-PROLOGUE(mpn_copyi)
- ltgr %r4, %r4
- sllg %r4, %r4, 3
- je L(rtn)
- aghi %r4, -1
- srlg %r5, %r4, 8
- ltgr %r5, %r5 C < 256 bytes to copy?
- je L(1)
-
-L(top): mvc 0(256, rp), 0(up)
- la rp, 256(rp)
- la up, 256(up)
- brctg %r5, L(top)
-
-L(1): bras %r5, L(2) C make r5 point to mvc insn
- mvc 0(1, rp), 0(up)
-L(2): ex %r4, 0(%r5) C execute mvc with length ((n-1) mod 256)+1
-L(rtn): br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/gmp-mparam.h b/gmp/mpn/s390_64/gmp-mparam.h
deleted file mode 100644
index dacd9966a4..0000000000
--- a/gmp/mpn/s390_64/gmp-mparam.h
+++ /dev/null
@@ -1,175 +0,0 @@
-/* S/390-64 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 1200 MHz z990 */
-
-#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 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 98
-
-#define MUL_TOOM22_THRESHOLD 10
-#define MUL_TOOM33_THRESHOLD 41
-#define MUL_TOOM44_THRESHOLD 105
-#define MUL_TOOM6H_THRESHOLD 149
-#define MUL_TOOM8H_THRESHOLD 212
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 69
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 72
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 64
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 55
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 16
-#define SQR_TOOM3_THRESHOLD 57
-#define SQR_TOOM4_THRESHOLD 153
-#define SQR_TOOM6_THRESHOLD 204
-#define SQR_TOOM8_THRESHOLD 309
-
-#define MULMID_TOOM42_THRESHOLD 20
-
-#define MULMOD_BNM1_THRESHOLD 10
-#define SQRMOD_BNM1_THRESHOLD 11
-
-#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 220, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 13, 7}, { 7, 6}, \
- { 15, 7}, { 8, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 19, 8}, { 13, 9}, { 7, 8}, \
- { 19, 9}, { 11, 8}, { 23,10}, { 7, 9}, \
- { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
- { 23,10}, { 15, 9}, { 39,10}, { 23,11}, \
- { 15,10}, { 31, 9}, { 63,10}, { 39, 9}, \
- { 79,10}, { 47,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
- { 287,10}, { 79,11}, { 47,12}, { 31,11}, \
- { 63,10}, { 127, 9}, { 255, 8}, { 511,10}, \
- { 143, 9}, { 287,11}, { 79,10}, { 159, 9}, \
- { 319,10}, { 175, 9}, { 351, 8}, { 703, 7}, \
- { 1407,11}, { 95,10}, { 191, 9}, { 383,10}, \
- { 207,11}, { 111,10}, { 223,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,11}, { 143,10}, \
- { 287, 9}, { 575, 8}, { 1151,10}, { 319,11}, \
- { 175,10}, { 351, 9}, { 703,12}, { 95,11}, \
- { 191,10}, { 383, 9}, { 767,11}, { 207,10}, \
- { 415,11}, { 223,13}, { 8192,14}, { 16384,15}, \
- { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 97
-#define MUL_FFT_THRESHOLD 1728
-
-#define SQR_FFT_MODF_THRESHOLD 212 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 212, 5}, { 7, 4}, { 15, 5}, { 13, 6}, \
- { 7, 5}, { 15, 6}, { 15, 7}, { 8, 6}, \
- { 17, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 19, 8}, { 11, 7}, { 23, 8}, \
- { 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,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, 8}, \
- { 703,10}, { 191, 9}, { 383, 8}, { 767,10}, \
- { 207, 9}, { 415,11}, { 111,10}, { 223,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,11}, \
- { 143,10}, { 287, 9}, { 575, 8}, { 1151,11}, \
- { 159,10}, { 319,11}, { 175,10}, { 351, 9}, \
- { 703,11}, { 191,10}, { 383,11}, { 207,10}, \
- { 415,11}, { 223,13}, { 8192,14}, { 16384,15}, \
- { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define SQR_FFT_TABLE3_SIZE 93
-#define SQR_FFT_THRESHOLD 1600
-
-#define MULLO_BASECASE_THRESHOLD 2
-#define MULLO_DC_THRESHOLD 33
-#define MULLO_MUL_N_THRESHOLD 3176
-
-#define DC_DIV_QR_THRESHOLD 28
-#define DC_DIVAPPR_Q_THRESHOLD 107
-#define DC_BDIV_QR_THRESHOLD 31
-#define DC_BDIV_Q_THRESHOLD 78
-
-#define INV_MULMOD_BNM1_THRESHOLD 43
-#define INV_NEWTON_THRESHOLD 129
-#define INV_APPR_THRESHOLD 117
-
-#define BINV_NEWTON_THRESHOLD 149
-#define REDC_1_TO_REDC_N_THRESHOLD 38
-
-#define MU_DIV_QR_THRESHOLD 748
-#define MU_DIVAPPR_Q_THRESHOLD 748
-#define MUPI_DIV_QR_THRESHOLD 65
-#define MU_BDIV_QR_THRESHOLD 562
-#define MU_BDIV_Q_THRESHOLD 734
-
-#define POWM_SEC_TABLE 4,23,274,961,2783
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 79
-#define HGCD_APPR_THRESHOLD 70
-#define HGCD_REDUCE_THRESHOLD 1094
-#define GCD_DC_THRESHOLD 183
-#define GCDEXT_DC_THRESHOLD 148
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 30
-#define GET_STR_PRECOMPUTE_THRESHOLD 41
-#define SET_STR_DC_THRESHOLD 402
-#define SET_STR_PRECOMPUTE_THRESHOLD 1104
-
-#define FAC_DSC_THRESHOLD 842
-#define FAC_ODD_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/s390_64/invert_limb.asm b/gmp/mpn/s390_64/invert_limb.asm
deleted file mode 100644
index edcebddf1c..0000000000
--- a/gmp/mpn/s390_64/invert_limb.asm
+++ /dev/null
@@ -1,94 +0,0 @@
-dnl S/390-64 mpn_invert_limb
-
-dnl Contributed to the GNU project by Torbjorn 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 z900 142
-C z990 86
-C z9 ?
-C z10 120
-C z196 ?
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_invert_limb)
- stg %r9, 72(%r15)
- srlg %r9, %r2, 55
- agr %r9, %r9
- larl %r4, approx_tab-512
- srlg %r3, %r2, 24
- aghi %r3, 1
- lghi %r5, 1
- llgh %r4, 0(%r9, %r4)
- sllg %r9, %r4, 11
- msgr %r4, %r4
- msgr %r4, %r3
- srlg %r4, %r4, 40
- aghi %r9, -1
- sgr %r9, %r4
- sllg %r0, %r9, 60
- sllg %r1, %r9, 13
- msgr %r9, %r9
- msgr %r9, %r3
- sgr %r0, %r9
- ngr %r5, %r2
- srlg %r4, %r2, 1
- srlg %r3, %r0, 47
- agr %r3, %r1
- agr %r4, %r5
- msgr %r4, %r3
- srlg %r1, %r3, 1
- lcgr %r5, %r5
- ngr %r1, %r5
- sgr %r1, %r4
- mlgr %r0, %r3
- srlg %r9, %r0, 1
- sllg %r4, %r3, 31
- agr %r4, %r9
- lgr %r1, %r4
- mlgr %r0, %r2
- algr %r1, %r2
- alcgr %r0, %r2
- lgr %r2, %r4
- sgr %r2, %r0
- lg %r9, 72(%r15)
- br %r14
-EPILOGUE()
- RODATA
- ALIGN(2)
-approx_tab:
-forloop(i,256,512-1,dnl
-` .word eval(0x7fd00/i)
-')dnl
-ASM_END()
diff --git a/gmp/mpn/s390_64/logops_n.asm b/gmp/mpn/s390_64/logops_n.asm
deleted file mode 100644
index 914cfb6a41..0000000000
--- a/gmp/mpn/s390_64/logops_n.asm
+++ /dev/null
@@ -1,291 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 variant 1 variant 2 variant 3
-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 3.25 3.75 3.75
-C z196 ? ? ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`vp', `%r4')
-define(`n', `%r5')
-
-ifdef(`OPERATION_and_n',`
- define(`func',`mpn_and_n')
- define(`VARIANT_1')
- define(`LOGOPC',`nc')
- define(`LOGOP',`ng')')
-ifdef(`OPERATION_andn_n',`
- define(`func',`mpn_andn_n')
- define(`VARIANT_2')
- define(`LOGOP',`ng')')
-ifdef(`OPERATION_nand_n',`
- define(`func',`mpn_nand_n')
- define(`VARIANT_3')
- define(`LOGOP',`ng')')
-ifdef(`OPERATION_ior_n',`
- define(`func',`mpn_ior_n')
- define(`VARIANT_1')
- define(`LOGOPC',`oc')
- define(`LOGOP',`og')')
-ifdef(`OPERATION_iorn_n',`
- define(`func',`mpn_iorn_n')
- define(`VARIANT_2')
- define(`LOGOP',`og')')
-ifdef(`OPERATION_nior_n',`
- define(`func',`mpn_nior_n')
- define(`VARIANT_3')
- define(`LOGOP',`og')')
-ifdef(`OPERATION_xor_n',`
- define(`func',`mpn_xor_n')
- define(`VARIANT_1')
- define(`LOGOPC',`xc')
- define(`LOGOP',`xg')')
-ifdef(`OPERATION_xnor_n',`
- define(`func',`mpn_xnor_n')
- define(`VARIANT_2')
- define(`LOGOP',`xg')')
-
-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)
-ifdef(`VARIANT_1',`
- cgr rp, up
- jne L(normal)
-
- sllg n, n, 3
- aghi n, -1
- srlg %r1, n, 8
- ltgr %r1, %r1 C < 256 bytes to copy?
- je L(1)
-
-L(tp): LOGOPC 0(256, rp), 0(vp)
- la rp, 256(rp)
- la vp, 256(vp)
- brctg %r1, L(tp)
-
-L(1): bras %r1, L(2) C make r1 point to mvc insn
- LOGOPC 0(1, rp), 0(vp)
-L(2): ex n, 0(%r1) C execute mvc with length ((n-1) mod 256)+1
-L(rtn): br %r14
-
-
-L(normal):
- stmg %r6, %r8, 48(%r15)
- aghi n, 3
- lghi %r7, 3
- srlg %r0, n, 2
- ngr %r7, n C n mod 4
- je L(b1)
- cghi %r7, 2
- jl L(b2)
- jne L(top)
-
-L(b3): lmg %r5, %r7, 0(up)
- la up, 24(up)
- LOGOP %r5, 0(vp)
- LOGOP %r6, 8(vp)
- LOGOP %r7, 16(vp)
- stmg %r5, %r7, 0(rp)
- la rp, 24(rp)
- la vp, 24(vp)
- j L(mid)
-
-L(b1): lg %r5, 0(up)
- la up, 8(up)
- LOGOP %r5, 0(vp)
- stg %r5, 0(rp)
- la rp, 8(rp)
- la vp, 8(vp)
- j L(mid)
-
-L(b2): lmg %r5, %r6, 0(up)
- la up, 16(up)
- LOGOP %r5, 0(vp)
- LOGOP %r6, 8(vp)
- stmg %r5, %r6, 0(rp)
- la rp, 16(rp)
- la vp, 16(vp)
- j L(mid)
-
-L(top): lmg %r5, %r8, 0(up)
- la up, 32(up)
- LOGOP %r5, 0(vp)
- LOGOP %r6, 8(vp)
- LOGOP %r7, 16(vp)
- LOGOP %r8, 24(vp)
- stmg %r5, %r8, 0(rp)
- la rp, 32(rp)
- la vp, 32(vp)
-L(mid): brctg %r0, L(top)
-
- lmg %r6, %r8, 48(%r15)
- br %r14
-')
-
-ifdef(`VARIANT_2',`
- stmg %r6, %r8, 48(%r15)
- lghi %r1, -1
-
- aghi n, 3
- lghi %r7, 3
- srlg %r0, n, 2
- ngr %r7, n C n mod 4
- je L(b1)
- cghi %r7, 2
- jl L(b2)
- jne L(top)
-
-L(b3): lmg %r5, %r7, 0(vp)
- la vp, 24(vp)
- xgr %r5, %r1
- xgr %r6, %r1
- xgr %r7, %r1
- LOGOP %r5, 0(up)
- LOGOP %r6, 8(up)
- LOGOP %r7, 16(up)
- stmg %r5, %r7, 0(rp)
- la rp, 24(rp)
- la up, 24(up)
- j L(mid)
-
-L(b1): lg %r5, 0(vp)
- la vp, 8(vp)
- xgr %r5, %r1
- LOGOP %r5, 0(up)
- stg %r5, 0(rp)
- la rp, 8(rp)
- la up, 8(up)
- j L(mid)
-
-L(b2): lmg %r5, %r6, 0(vp)
- la vp, 16(vp)
- xgr %r5, %r1
- xgr %r6, %r1
- LOGOP %r5, 0(up)
- LOGOP %r6, 8(up)
- stmg %r5, %r6, 0(rp)
- la rp, 16(rp)
- la up, 16(up)
- j L(mid)
-
-L(top): lmg %r5, %r8, 0(vp)
- la vp, 32(vp)
- xgr %r5, %r1
- xgr %r6, %r1
- xgr %r7, %r1
- xgr %r8, %r1
- LOGOP %r5, 0(up)
- LOGOP %r6, 8(up)
- LOGOP %r7, 16(up)
- LOGOP %r8, 24(up)
- la up, 32(up)
- stmg %r5, %r8, 0(rp)
- la rp, 32(rp)
-L(mid): brctg %r0, L(top)
-
- lmg %r6, %r8, 48(%r15)
- br %r14
-')
-
-ifdef(`VARIANT_3',`
- stmg %r6, %r8, 48(%r15)
- lghi %r1, -1
-
- aghi n, 3
- lghi %r7, 3
- srlg %r0, n, 2
- ngr %r7, n C n mod 4
- je L(b1)
- cghi %r7, 2
- jl L(b2)
- jne L(top)
-
-L(b3): lmg %r5, %r7, 0(vp)
- la vp, 24(vp)
- LOGOP %r5, 0(up)
- LOGOP %r6, 8(up)
- xgr %r5, %r1
- xgr %r6, %r1
- LOGOP %r7, 16(up)
- xgr %r7, %r1
- stmg %r5, %r7, 0(rp)
- la rp, 24(rp)
- la up, 24(up)
- j L(mid)
-
-L(b1): lg %r5, 0(vp)
- la vp, 8(vp)
- LOGOP %r5, 0(up)
- xgr %r5, %r1
- stg %r5, 0(rp)
- la rp, 8(rp)
- la up, 8(up)
- j L(mid)
-
-L(b2): lmg %r5, %r6, 0(vp)
- la vp, 16(vp)
- LOGOP %r5, 0(up)
- LOGOP %r6, 8(up)
- xgr %r5, %r1
- xgr %r6, %r1
- stmg %r5, %r6, 0(rp)
- la rp, 16(rp)
- la up, 16(up)
- j L(mid)
-
-L(top): lmg %r5, %r8, 0(vp)
- la vp, 32(vp)
- LOGOP %r5, 0(up)
- LOGOP %r6, 8(up)
- xgr %r5, %r1
- xgr %r6, %r1
- LOGOP %r7, 16(up)
- LOGOP %r8, 24(up)
- xgr %r7, %r1
- xgr %r8, %r1
- stmg %r5, %r8, 0(rp)
- la up, 32(up)
- la rp, 32(rp)
-L(mid): brctg %r0, L(top)
-
- lmg %r6, %r8, 48(%r15)
- br %r14
-')
-
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/lshift.asm b/gmp/mpn/s390_64/lshift.asm
deleted file mode 100644
index 4dae035a62..0000000000
--- a/gmp/mpn/s390_64/lshift.asm
+++ /dev/null
@@ -1,196 +0,0 @@
-dnl S/390-64 mpn_lshift.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 7
-C z990 3
-C z9 ?
-C z10 6
-C z196 ?
-
-C NOTES
-C * This uses discrete loads and stores in a software pipeline. Using lmg and
-C stmg is not faster.
-C * One could assume more pipelining could approach 2.5 c/l, but we have not
-C found any 8-way loop that runs better than the current 4-way loop.
-C * Consider using the same feed-in code for 1 <= n <= 3 as for n mod 4,
-C similarly to the x86_64 sqr_basecase feed-in.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`cnt', `%r5')
-
-define(`tnc', `%r6')
-
-ASM_START()
-PROLOGUE(mpn_lshift)
- cghi n, 3
- jh L(gt1)
-
- stmg %r6, %r7, 48(%r15)
- larl %r1, L(tab)-4
- lcgr tnc, cnt
- sllg n, n, 2
- b 0(n,%r1)
-L(tab): j L(n1)
- j L(n2)
- j L(n3)
-
-L(n1): lg %r1, 0(up)
- sllg %r0, %r1, 0(cnt)
- stg %r0, 0(rp)
- srlg %r2, %r1, 0(tnc)
- lg %r6, 48(%r15) C restoring r7 not needed
- br %r14
-
-L(n2): lg %r1, 8(up)
- srlg %r4, %r1, 0(tnc)
- sllg %r0, %r1, 0(cnt)
- j L(cj)
-
-L(n3): lg %r1, 16(up)
- srlg %r4, %r1, 0(tnc)
- sllg %r0, %r1, 0(cnt)
- lg %r1, 8(up)
- srlg %r7, %r1, 0(tnc)
- ogr %r7, %r0
- sllg %r0, %r1, 0(cnt)
- stg %r7, 16(rp)
-L(cj): lg %r1, 0(up)
- srlg %r7, %r1, 0(tnc)
- ogr %r7, %r0
- sllg %r0, %r1, 0(cnt)
- stg %r7, 8(rp)
- stg %r0, 0(rp)
- lgr %r2, %r4
- lmg %r6, %r7, 48(%r15)
- br %r14
-
-L(gt1): stmg %r6, %r13, 48(%r15)
- lcgr tnc, cnt C tnc = -cnt
-
- sllg %r1, n, 3
- srlg %r0, n, 2 C loop count
-
- agr up, %r1 C point up at end of U
- agr rp, %r1 C point rp at end of R
- aghi up, -56
- aghi rp, -40
-
- lghi %r7, 3
- ngr %r7, n
- je L(b0)
- cghi %r7, 2
- jl L(b1)
- je L(b2)
-
-L(b3): lg %r7, 48(up)
- srlg %r9, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- lg %r8, 40(up)
- lg %r7, 32(up)
- srlg %r4, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- la rp, 16(rp)
- j L(lm3)
-
-L(b2): lg %r8, 48(up)
- lg %r7, 40(up)
- srlg %r9, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- la rp, 24(rp)
- la up, 8(up)
- j L(lm2)
-
-L(b1): lg %r7, 48(up)
- srlg %r9, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- lg %r8, 40(up)
- lg %r7, 32(up)
- srlg %r4, %r8, 0(tnc)
- sllg %r10, %r8, 0(cnt)
- ogr %r11, %r4
- la rp, 32(rp)
- la up, 16(up)
- j L(lm1)
-
-L(b0): lg %r8, 48(up)
- lg %r7, 40(up)
- srlg %r9, %r8, 0(tnc)
- sllg %r10, %r8, 0(cnt)
- la rp, 40(rp)
- la up, 24(up)
- j L(lm0)
-
- ALIGN(8)
-L(top): srlg %r4, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- stg %r10, 24(rp)
-L(lm3): stg %r11, 16(rp)
-L(lm2): srlg %r12, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- lg %r8, 24(up)
- lg %r7, 16(up)
- ogr %r13, %r12
- srlg %r4, %r8, 0(tnc)
- sllg %r10, %r8, 0(cnt)
- ogr %r11, %r4
- stg %r13, 8(rp)
-L(lm1): stg %r11, 0(rp)
-L(lm0): srlg %r12, %r7, 0(tnc)
- aghi rp, -32
- sllg %r11, %r7, 0(cnt)
- lg %r8, 8(up)
- lg %r7, 0(up)
- aghi up, -32
- ogr %r10, %r12
- brctg %r0, L(top)
-
-L(end): srlg %r4, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- stg %r10, 24(rp)
- stg %r11, 16(rp)
- srlg %r12, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- ogr %r13, %r12
- stg %r13, 8(rp)
- stg %r11, 0(rp)
- lgr %r2, %r9
-
- lmg %r6, %r13, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/lshiftc.asm b/gmp/mpn/s390_64/lshiftc.asm
deleted file mode 100644
index 92552d529a..0000000000
--- a/gmp/mpn/s390_64/lshiftc.asm
+++ /dev/null
@@ -1,207 +0,0 @@
-dnl S/390-64 mpn_lshiftc.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 9
-C z990 3.5
-C z9 ?
-C z10 7
-C z196 ?
-
-C NOTES
-C * See notes in lshift.asm.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`cnt', `%r5')
-
-define(`tnc', `%r6')
-
-ASM_START()
-PROLOGUE(mpn_lshiftc)
- cghi n, 3
- jh L(gt1)
-
- stmg %r6, %r8, 48(%r15)
- larl %r1, L(tab)-4
- lcgr tnc, cnt
- sllg n, n, 2
- lghi %r8, -1
- b 0(n,%r1)
-L(tab): j L(n1)
- j L(n2)
- j L(n3)
-
-L(n1): lg %r1, 0(up)
- sllg %r0, %r1, 0(cnt)
- xgr %r0, %r8
- stg %r0, 0(rp)
- srlg %r2, %r1, 0(tnc)
- lmg %r6, %r8, 48(%r15)
- br %r14
-
-L(n2): lg %r1, 8(up)
- srlg %r4, %r1, 0(tnc)
- sllg %r0, %r1, 0(cnt)
- j L(cj)
-
-L(n3): lg %r1, 16(up)
- srlg %r4, %r1, 0(tnc)
- sllg %r0, %r1, 0(cnt)
- lg %r1, 8(up)
- srlg %r7, %r1, 0(tnc)
- ogr %r7, %r0
- sllg %r0, %r1, 0(cnt)
- xgr %r7, %r8
- stg %r7, 16(rp)
-L(cj): lg %r1, 0(up)
- srlg %r7, %r1, 0(tnc)
- ogr %r7, %r0
- sllg %r0, %r1, 0(cnt)
- xgr %r7, %r8
- xgr %r0, %r8
- stg %r7, 8(rp)
- stg %r0, 0(rp)
- lgr %r2, %r4
- lmg %r6, %r8, 48(%r15)
- br %r14
-
-L(gt1): stmg %r6, %r14, 48(%r15)
- lcgr tnc, cnt C tnc = -cnt
-
- sllg %r1, n, 3
- srlg %r0, n, 2 C loop count
-
- agr up, %r1 C point up at end of U
- agr rp, %r1 C point rp at end of R
- aghi up, -56
- aghi rp, -40
-
- lghi %r7, 3
- lghi %r14, -1
- ngr %r7, n
- je L(b0)
- cghi %r7, 2
- jl L(b1)
- je L(b2)
-
-L(b3): lg %r7, 48(up)
- srlg %r9, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- lg %r8, 40(up)
- lg %r7, 32(up)
- srlg %r4, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- la rp, 16(rp)
- xgr %r11, %r14
- j L(lm3)
-
-L(b2): lg %r8, 48(up)
- lg %r7, 40(up)
- srlg %r9, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- la rp, 24(rp)
- la up, 8(up)
- j L(lm2)
-
-L(b1): lg %r7, 48(up)
- srlg %r9, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- lg %r8, 40(up)
- lg %r7, 32(up)
- srlg %r4, %r8, 0(tnc)
- sllg %r10, %r8, 0(cnt)
- ogr %r11, %r4
- la rp, 32(rp)
- la up, 16(up)
- xgr %r11, %r14
- j L(lm1)
-
-L(b0): lg %r8, 48(up)
- lg %r7, 40(up)
- srlg %r9, %r8, 0(tnc)
- sllg %r10, %r8, 0(cnt)
- la rp, 40(rp)
- la up, 24(up)
- j L(lm0)
-
- ALIGN(8)
-L(top): srlg %r4, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- xgr %r10, %r14
- xgr %r11, %r14
- stg %r10, 24(rp)
-L(lm3): stg %r11, 16(rp)
-L(lm2): srlg %r12, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- lg %r8, 24(up)
- lg %r7, 16(up)
- ogr %r13, %r12
- srlg %r4, %r8, 0(tnc)
- sllg %r10, %r8, 0(cnt)
- ogr %r11, %r4
- xgr %r13, %r14
- xgr %r11, %r14
- stg %r13, 8(rp)
-L(lm1): stg %r11, 0(rp)
-L(lm0): srlg %r12, %r7, 0(tnc)
- aghi rp, -32
- sllg %r11, %r7, 0(cnt)
- lg %r8, 8(up)
- lg %r7, 0(up)
- aghi up, -32
- ogr %r10, %r12
- brctg %r0, L(top)
-
-L(end): srlg %r4, %r8, 0(tnc)
- sllg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- xgr %r10, %r14
- xgr %r11, %r14
- stg %r10, 24(rp)
- stg %r11, 16(rp)
- srlg %r12, %r7, 0(tnc)
- sllg %r11, %r7, 0(cnt)
- ogr %r13, %r12
- xgr %r13, %r14
- xgr %r11, %r14
- stg %r13, 8(rp)
- stg %r11, 0(rp)
- lgr %r2, %r9
-
- lmg %r6, %r14, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/mod_34lsub1.asm b/gmp/mpn/s390_64/mod_34lsub1.asm
deleted file mode 100644
index fd40011a8c..0000000000
--- a/gmp/mpn/s390_64/mod_34lsub1.asm
+++ /dev/null
@@ -1,109 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 5.8
-C z990 2
-C z9 ?
-C z10 4.5
-C z196 ?
-
-C TODO
-C * Optimise summation code, see x86_64.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`n', `%r3')
-
-ASM_START()
-PROLOGUE(mpn_mod_34lsub1)
- stmg %r7, %r12, 56(%r15)
- lghi %r11, 0
- lghi %r12, 0
- lghi %r0, 0
- lghi %r8, 0
- lghi %r9, 0
- lghi %r10, 0
- lghi %r7, 0
- aghi %r3, -3
- jl .L3
-
-L(top): alg %r0, 0(%r2)
- alcg %r12, 8(%r2)
- alcg %r11, 16(%r2)
- alcgr %r8, %r7
- la %r2, 24(%r2)
- aghi %r3, -3
- jnl L(top)
-
- lgr %r7, %r8
- srlg %r1, %r11, 16
- nihh %r7, 0 C 0xffffffffffff
- agr %r7, %r1
- srlg %r8, %r8, 48
- agr %r7, %r8
- sllg %r11, %r11, 32
- nihh %r11, 0
- agr %r7, %r11
-.L3:
- cghi %r3, -3
- je .L6
- alg %r0, 0(%r2)
- alcgr %r10, %r10
- cghi %r3, -2
- je .L6
- alg %r12, 8(%r2)
- alcgr %r9, %r9
-.L6:
- srlg %r1, %r0, 48
- nihh %r0, 0 C 0xffffffffffff
- agr %r0, %r1
- agr %r0, %r7
- srlg %r1, %r12, 32
- agr %r0, %r1
- srlg %r1, %r10, 32
- agr %r0, %r1
- llgfr %r12, %r12
- srlg %r1, %r9, 16
- sllg %r12, %r12, 16
- llgfr %r10, %r10
- agr %r0, %r1
- llill %r2, 65535
- agr %r0, %r12
- sllg %r10, %r10, 16
- ngr %r2, %r9
- agr %r0, %r10
- sllg %r2, %r2, 32
- agr %r2, %r0
- lmg %r7, %r12, 56(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/mul_1.asm b/gmp/mpn/s390_64/mul_1.asm
deleted file mode 100644
index a8f6da9a0f..0000000000
--- a/gmp/mpn/s390_64/mul_1.asm
+++ /dev/null
@@ -1,66 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 29
-C z990 22
-C z9 ?
-C z10 20
-C z196 ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`v0', `%r5')
-
-ASM_START()
-PROLOGUE(mpn_mul_1)
- stmg %r11, %r12, 88(%r15)
- lghi %r12, 0 C zero index register
- aghi %r12, 0 C clear carry flag
- lghi %r11, 0 C clear carry limb
-
-L(top): lg %r1, 0(%r12,up)
- mlgr %r0, v0
- alcgr %r1, %r11
- lgr %r11, %r0 C copy high part to carry limb
- stg %r1, 0(%r12,rp)
- la %r12, 8(%r12)
- brctg n, L(top)
-
- lghi %r2, 0
- alcgr %r2, %r11
-
- lmg %r11, %r12, 88(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/mul_basecase.asm b/gmp/mpn/s390_64/mul_basecase.asm
deleted file mode 100644
index 7d14ea98d2..0000000000
--- a/gmp/mpn/s390_64/mul_basecase.asm
+++ /dev/null
@@ -1,130 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 ?
-C z990 23
-C z9 ?
-C z10 28
-C z196 ?
-
-C TODO
-C * Perhaps add special case for un <= 2.
-C * Replace loops by faster code. The mul_1 and addmul_1 loops could be sped
-C up by about 10%.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`un', `%r4')
-define(`vp', `%r5')
-define(`vn', `%r6')
-
-define(`zero', `%r8')
-
-ASM_START()
-PROLOGUE(mpn_mul_basecase)
- cghi un, 2
- jhe L(ge2)
-
-C un = vn = 1
- lg %r1, 0(vp)
- mlg %r0, 0(up)
- stg %r1, 0(rp)
- stg %r0, 8(rp)
- br %r14
-
-L(ge2): C jne L(gen)
-
-
-L(gen):
-C mul_1 =======================================================================
-
- stmg %r6, %r12, 48(%r15)
- lghi zero, 0
- aghi un, -1
-
- lg %r7, 0(vp)
- lg %r11, 0(up)
- lghi %r12, 8 C init index register
- mlgr %r10, %r7
- lgr %r9, un
- stg %r11, 0(rp)
- cr %r15, %r15 C clear carry flag
-
-L(tm): lg %r1, 0(%r12,up)
- mlgr %r0, %r7
- alcgr %r1, %r10
- lgr %r10, %r0 C copy high part to carry limb
- stg %r1, 0(%r12,rp)
- la %r12, 8(%r12)
- brctg %r9, L(tm)
-
- alcgr %r0, zero
- stg %r0, 0(%r12,rp)
-
-C addmul_1 loop ===============================================================
-
- aghi vn, -1
- je L(outer_end)
-L(outer_loop):
-
- la rp, 8(rp) C rp += 1
- la vp, 8(vp) C up += 1
- lg %r7, 0(vp)
- lg %r11, 0(up)
- lghi %r12, 8 C init index register
- mlgr %r10, %r7
- lgr %r9, un
- alg %r11, 0(rp)
- stg %r11, 0(rp)
-
-L(tam): lg %r1, 0(%r12,up)
- lg %r11, 0(%r12,rp)
- mlgr %r0, %r7
- alcgr %r1, %r11
- alcgr %r0, zero
- algr %r1, %r10
- lgr %r10, %r0
- stg %r1, 0(%r12,rp)
- la %r12, 8(%r12)
- brctg %r9, L(tam)
-
- alcgr %r0, zero
- stg %r0, 0(%r12,rp)
-
- brctg vn, L(outer_loop)
-L(outer_end):
-
- lmg %r6, %r12, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/rshift.asm b/gmp/mpn/s390_64/rshift.asm
deleted file mode 100644
index e870971650..0000000000
--- a/gmp/mpn/s390_64/rshift.asm
+++ /dev/null
@@ -1,195 +0,0 @@
-dnl S/390-64 mpn_rshift.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 7
-C z990 3
-C z9 ?
-C z10 6
-C z196 ?
-
-C NOTES
-C * See notes in lshift.asm.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`cnt', `%r5')
-
-define(`tnc', `%r6')
-
-ASM_START()
-PROLOGUE(mpn_rshift)
- cghi n, 3
- jh L(gt1)
-
- stmg %r6, %r7, 48(%r15)
- larl %r1, L(tab)-4
- lcgr tnc, cnt
- sllg n, n, 2
- b 0(n,%r1)
-L(tab): j L(n1)
- j L(n2)
- j L(n3)
-
-L(n1): lg %r1, 0(up)
- srlg %r0, %r1, 0(cnt)
- stg %r0, 0(rp)
- sllg %r2, %r1, 0(tnc)
- lg %r6, 48(%r15) C restoring r7 not needed
- br %r14
-
-L(n2): lg %r1, 0(up)
- sllg %r4, %r1, 0(tnc)
- srlg %r0, %r1, 0(cnt)
- lg %r1, 8(up)
- sllg %r7, %r1, 0(tnc)
- ogr %r7, %r0
- srlg %r0, %r1, 0(cnt)
- stg %r7, 0(rp)
- stg %r0, 8(rp)
- lgr %r2, %r4
- lmg %r6, %r7, 48(%r15)
- br %r14
-
-
-L(n3): lg %r1, 0(up)
- sllg %r4, %r1, 0(tnc)
- srlg %r0, %r1, 0(cnt)
- lg %r1, 8(up)
- sllg %r7, %r1, 0(tnc)
- ogr %r7, %r0
- srlg %r0, %r1, 0(cnt)
- stg %r7, 0(rp)
- lg %r1, 16(up)
- sllg %r7, %r1, 0(tnc)
- ogr %r7, %r0
- srlg %r0, %r1, 0(cnt)
- stg %r7, 8(rp)
- stg %r0, 16(rp)
- lgr %r2, %r4
- lmg %r6, %r7, 48(%r15)
- br %r14
-
-L(gt1): stmg %r6, %r13, 48(%r15)
- lcgr tnc, cnt C tnc = -cnt
-
- sllg %r1, n, 3
- srlg %r0, n, 2 C loop count
-
- lghi %r7, 3
- ngr %r7, n
- je L(b0)
- cghi %r7, 2
- jl L(b1)
- je L(b2)
-
-L(b3): aghi rp, -8
- lg %r7, 0(up)
- sllg %r9, %r7, 0(tnc)
- srlg %r11, %r7, 0(cnt)
- lg %r8, 8(up)
- lg %r7, 16(up)
- sllg %r4, %r8, 0(tnc)
- srlg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- la up, 24(up)
- j L(lm3)
-
-L(b2): aghi rp, -16
- lg %r8, 0(up)
- lg %r7, 8(up)
- sllg %r9, %r8, 0(tnc)
- srlg %r13, %r8, 0(cnt)
- la up, 16(up)
- j L(lm2)
-
-L(b1): aghi rp, -24
- lg %r7, 0(up)
- sllg %r9, %r7, 0(tnc)
- srlg %r11, %r7, 0(cnt)
- lg %r8, 8(up)
- lg %r7, 16(up)
- sllg %r4, %r8, 0(tnc)
- srlg %r10, %r8, 0(cnt)
- ogr %r11, %r4
- la up, 8(up)
- j L(lm1)
-
-L(b0): aghi rp, -32
- lg %r8, 0(up)
- lg %r7, 8(up)
- sllg %r9, %r8, 0(tnc)
- srlg %r10, %r8, 0(cnt)
- j L(lm0)
-
- ALIGN(8)
-L(top): sllg %r4, %r8, 0(tnc)
- srlg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- stg %r10, 0(rp)
-L(lm3): stg %r11, 8(rp)
-L(lm2): sllg %r12, %r7, 0(tnc)
- srlg %r11, %r7, 0(cnt)
- lg %r8, 0(up)
- lg %r7, 8(up)
- ogr %r13, %r12
- sllg %r4, %r8, 0(tnc)
- srlg %r10, %r8, 0(cnt)
- ogr %r11, %r4
- stg %r13, 16(rp)
-L(lm1): stg %r11, 24(rp)
-L(lm0): sllg %r12, %r7, 0(tnc)
- aghi rp, 32
- srlg %r11, %r7, 0(cnt)
- lg %r8, 16(up)
- lg %r7, 24(up)
- aghi up, 32
- ogr %r10, %r12
- brctg %r0, L(top)
-
-L(end): sllg %r4, %r8, 0(tnc)
- srlg %r13, %r8, 0(cnt)
- ogr %r11, %r4
- stg %r10, 0(rp)
- stg %r11, 8(rp)
- sllg %r12, %r7, 0(tnc)
- srlg %r11, %r7, 0(cnt)
- ogr %r13, %r12
- stg %r13, 16(rp)
- stg %r11, 24(rp)
- lgr %r2, %r9
-
- lmg %r6, %r13, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/sqr_basecase.asm b/gmp/mpn/s390_64/sqr_basecase.asm
deleted file mode 100644
index bf31bd5546..0000000000
--- a/gmp/mpn/s390_64/sqr_basecase.asm
+++ /dev/null
@@ -1,203 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 ?
-C z990 23
-C z9 ?
-C z10 28
-C z196 ?
-
-C TODO
-C * Clean up.
-C * Stop iterating addmul_1 loop at latest for n = 2, implement longer tail.
-C This will ask for basecase handling of n = 3.
-C * Update counters and pointers more straightforwardly, possibly lowering
-C register usage.
-C * Should we use this allocation-free style for more sqr_basecase asm
-C implementations? The only disadvantage is that it requires R != U.
-C * Replace loops by faster code. The mul_1 and addmul_1 loops could be sped
-C up by about 10%. The sqr_diag_addlsh1 loop could probably be sped up even
-C more.
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-
-define(`zero', `%r8')
-define(`rp_saved', `%r9')
-define(`up_saved', `%r13')
-define(`n_saved', `%r14')
-
-ASM_START()
-PROLOGUE(mpn_sqr_basecase)
- aghi n, -2
- jhe L(ge2)
-
-C n = 1
- lg %r5, 0(up)
- mlgr %r4, %r5
- stg %r5, 0(rp)
- stg %r4, 8(rp)
- br %r14
-
-L(ge2): jne L(gen)
-
-C n = 2
- stmg %r6, %r8, 48(%r15)
- lghi zero, 0
-
- lg %r5, 0(up)
- mlgr %r4, %r5 C u0 * u0
- lg %r1, 8(up)
- mlgr %r0, %r1 C u1 * u1
- stg %r5, 0(rp)
-
- lg %r7, 0(up)
- mlg %r6, 8(up) C u0 * u1
- algr %r7, %r7
- alcgr %r6, %r6
- alcgr %r0, zero
-
- algr %r4, %r7
- alcgr %r1, %r6
- alcgr %r0, zero
- stg %r4, 8(rp)
- stg %r1, 16(rp)
- stg %r0, 24(rp)
-
- lmg %r6, %r8, 48(%r15)
- br %r14
-
-L(gen):
-C mul_1 =======================================================================
-
- stmg %r6, %r14, 48(%r15)
- lghi zero, 0
- lgr up_saved, up
- lgr rp_saved, rp
- lgr n_saved, n
-
- lg %r6, 0(up)
- lg %r11, 8(up)
- lghi %r12, 16 C init index register
- mlgr %r10, %r6
- lgr %r5, n
- stg %r11, 8(rp)
- cr %r15, %r15 C clear carry flag
-
-L(tm): lg %r1, 0(%r12,up)
- mlgr %r0, %r6
- alcgr %r1, %r10
- lgr %r10, %r0 C copy high part to carry limb
- stg %r1, 0(%r12,rp)
- la %r12, 8(%r12)
- brctg %r5, L(tm)
-
- alcgr %r0, zero
- stg %r0, 0(%r12,rp)
-
-C addmul_1 loop ===============================================================
-
- aghi n, -1
- je L(outer_end)
-L(outer_loop):
-
- la rp, 16(rp) C rp += 2
- la up, 8(up) C up += 1
- lg %r6, 0(up)
- lg %r11, 8(up)
- lghi %r12, 16 C init index register
- mlgr %r10, %r6
- lgr %r5, n
- alg %r11, 8(rp)
- stg %r11, 8(rp)
-
-L(tam): lg %r1, 0(%r12,up)
- lg %r7, 0(%r12,rp)
- mlgr %r0, %r6
- alcgr %r1, %r7
- alcgr %r0, zero
- algr %r1, %r10
- lgr %r10, %r0
- stg %r1, 0(%r12,rp)
- la %r12, 8(%r12)
- brctg %r5, L(tam)
-
- alcgr %r0, zero
- stg %r0, 0(%r12,rp)
-
- brctg n, L(outer_loop)
-L(outer_end):
-
- lg %r6, 8(up)
- lg %r1, 16(up)
- lgr %r7, %r0 C Same as: lg %r7, 24(,rp)
- mlgr %r0, %r6
- algr %r1, %r7
- alcgr %r0, zero
- stg %r1, 24(rp)
- stg %r0, 32(rp)
-
-C sqr_diag_addlsh1 ============================================================
-
-define(`up', `up_saved')
-define(`rp', `rp_saved')
- la n, 1(n_saved)
-
- lg %r1, 0(up)
- mlgr %r0, %r1
- stg %r1, 0(rp)
-C clr %r15, %r15 C clear carry (already clear per above)
-
-L(top): lg %r11, 8(up)
- la up, 8(up)
- lg %r6, 8(rp)
- lg %r7, 16(rp)
- mlgr %r10, %r11
- alcgr %r6, %r6
- alcgr %r7, %r7
- alcgr %r10, zero C propagate carry to high product limb
- algr %r6, %r0
- alcgr %r7, %r11
- stmg %r6, %r7, 8(rp)
- la rp, 16(rp)
- lgr %r0, %r10 C copy carry limb
- brctg n, L(top)
-
- alcgr %r0, zero
- stg %r0, 8(rp)
-
- lmg %r6, %r14, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/sublsh1_n.asm b/gmp/mpn/s390_64/sublsh1_n.asm
deleted file mode 100644
index 50f127acef..0000000000
--- a/gmp/mpn/s390_64/sublsh1_n.asm
+++ /dev/null
@@ -1,169 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 10
-C z990 5
-C z9 ?
-C z10 12
-C z196 ?
-
-C TODO
-C * Optimise for small n
-C * Compute RETVAL for sublsh1_n less stupidly
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`vp', `%r4')
-define(`n', `%r5')
-
-ifdef(`OPERATION_addlsh1_n',`
- define(ADSBR, algr)
- define(ADSBCR, alcgr)
- define(INITCY, `lghi %r13, -1')
- define(RETVAL, `la %r2, 2(%r1,%r13)')
- define(func, mpn_addlsh1_n)
-')
-ifdef(`OPERATION_sublsh1_n',`
- define(ADSBR, slgr)
- define(ADSBCR, slbgr)
- define(INITCY, `lghi %r13, 0')
- define(RETVAL,`dnl
- slgr %r1, %r13
- lghi %r2, 1
- algr %r2, %r1')
- define(func, mpn_sublsh1_n)
-')
-
-ASM_START()
-PROLOGUE(mpn_sublsh1_n)
- stmg %r6, %r13, 48(%r15)
-
- aghi n, 3
- lghi %r7, 3
- srlg %r0, n, 2
- ngr %r7, n C n mod 4
- je L(b1)
- cghi %r7, 2
- jl L(b2)
- jne L(b0)
-
-L(b3): lmg %r5, %r7, 0(up)
- la up, 24(up)
- lmg %r9, %r11, 0(vp)
- la vp, 24(vp)
-
- algr %r9, %r9
- alcgr %r10, %r10
- alcgr %r11, %r11
- slbgr %r1, %r1
-
- ADSBR %r5, %r9
- ADSBCR %r6, %r10
- ADSBCR %r7, %r11
- slbgr %r13, %r13
-
- stmg %r5, %r7, 0(rp)
- la rp, 24(rp)
- brctg %r0, L(top)
- j L(end)
-
-L(b0): lghi %r1, -1
- INITCY
- j L(top)
-
-L(b1): lg %r5, 0(up)
- la up, 8(up)
- lg %r9, 0(vp)
- la vp, 8(vp)
-
- algr %r9, %r9
- slbgr %r1, %r1
- ADSBR %r5, %r9
- slbgr %r13, %r13
-
- stg %r5, 0(rp)
- la rp, 8(rp)
- brctg %r0, L(top)
- j L(end)
-
-L(b2): lmg %r5, %r6, 0(up)
- la up, 16(up)
- lmg %r9, %r10, 0(vp)
- la vp, 16(vp)
-
- algr %r9, %r9
- alcgr %r10, %r10
- slbgr %r1, %r1
-
- ADSBR %r5, %r9
- ADSBCR %r6, %r10
- slbgr %r13, %r13
-
- stmg %r5, %r6, 0(rp)
- la rp, 16(rp)
- brctg %r0, L(top)
- j L(end)
-
-L(top): lmg %r9, %r12, 0(vp)
- la vp, 32(vp)
-
- aghi %r1, 1 C restore carry
-
- alcgr %r9, %r9
- alcgr %r10, %r10
- alcgr %r11, %r11
- alcgr %r12, %r12
-
- slbgr %r1, %r1 C save carry
-
- lmg %r5, %r8, 0(up)
- la up, 32(up)
-
- aghi %r13, 1 C restore carry
-
- ADSBCR %r5, %r9
- ADSBCR %r6, %r10
- ADSBCR %r7, %r11
- ADSBCR %r8, %r12
-
- slbgr %r13, %r13 C save carry
-
- stmg %r5, %r8, 0(rp)
- la rp, 32(rp)
- brctg %r0, L(top)
-
-L(end): RETVAL
- lmg %r6, %r13, 48(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/submul_1.asm b/gmp/mpn/s390_64/submul_1.asm
deleted file mode 100644
index 91c4b06631..0000000000
--- a/gmp/mpn/s390_64/submul_1.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 z900 35
-C z990 24
-C z9 ?
-C z10 28
-C z196 ?
-
-C INPUT PARAMETERS
-define(`rp', `%r2')
-define(`up', `%r3')
-define(`n', `%r4')
-define(`v0', `%r5')
-
-ASM_START()
-PROLOGUE(mpn_submul_1)
- stmg %r9, %r12, 72(%r15)
- lghi %r12, 0
- slgr %r11, %r11
-
-L(top): lg %r1, 0(%r12, up)
- lg %r10, 0(%r12, rp)
- mlgr %r0, v0
- slbgr %r10, %r1
- slbgr %r9, %r9
- slgr %r0, %r9 C conditional incr
- slgr %r10, %r11
- lgr %r11, %r0
- stg %r10, 0(%r12, rp)
- la %r12, 8(%r12)
- brctg %r4, L(top)
-
- lgr %r2, %r11
- slbgr %r9, %r9
- slgr %r2, %r9
-
- lmg %r9, %r12, 72(%r15)
- br %r14
-EPILOGUE()
diff --git a/gmp/mpn/s390_64/z10/gmp-mparam.h b/gmp/mpn/s390_64/z10/gmp-mparam.h
deleted file mode 100644
index c034f9b3b6..0000000000
--- a/gmp/mpn/s390_64/z10/gmp-mparam.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* 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
diff --git a/gmp/mpn/sh/add_n.asm b/gmp/mpn/sh/add_n.asm
deleted file mode 100644
index 79d17d0129..0000000000
--- a/gmp/mpn/sh/add_n.asm
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl SH mpn_add_n -- Add two limb vectors of the same length > 0 and store sum
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-C rp r4
-C up r5
-C vp r6
-C n r7
-
-changecom(blah) C disable # to make all C comments below work
-
-ASM_START()
-PROLOGUE(mpn_add_n)
- mov #0,r3 C clear cy save reg
-
-L(top): mov.l @r5+,r1
- mov.l @r6+,r2
- shlr r3 C restore cy
- addc r2,r1
- movt r3 C save cy
- mov.l r1,@r4
- dt r7
- bf.s L(top)
- add #4,r4
-
- rts
- mov r3,r0 C return carry-out from most significant limb
-EPILOGUE()
diff --git a/gmp/mpn/sh/add_n.s b/gmp/mpn/sh/add_n.s
new file mode 100644
index 0000000000..914fb4fc70
--- /dev/null
+++ b/gmp/mpn/sh/add_n.s
@@ -0,0 +1,45 @@
+! SH __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
+! sum in a third limb vector.
+
+! Copyright 1995, 1997, 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 r4
+! s1_ptr r5
+! s2_ptr r6
+! size r7
+
+ .text
+ .align 2
+ .global ___gmpn_add_n
+___gmpn_add_n:
+ mov #0,r3 ! clear cy save reg
+
+Loop: mov.l @r5+,r1
+ mov.l @r6+,r2
+ shlr r3 ! restore cy
+ addc r2,r1
+ movt r3 ! save cy
+ mov.l r1,@r4
+ dt r7
+ bf.s Loop
+ add #4,r4
+
+ rts
+ mov r3,r0 ! return carry-out from most sign. limb
diff --git a/gmp/mpn/sh/sh2/addmul_1.asm b/gmp/mpn/sh/sh2/addmul_1.asm
deleted file mode 100644
index c914b29541..0000000000
--- a/gmp/mpn/sh/sh2/addmul_1.asm
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl SH2 mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-C res_ptr r4
-C s1_ptr r5
-C size r6
-C s2_limb r7
-
-changecom(blah) C disable # to make all C comments below work
-
-ASM_START()
-PROLOGUE(mpn_addmul_1)
- mov #0,r2 C cy_limb = 0
- mov #0,r0 C Keep r0 = 0 for entire loop
- clrt
-
-L(top): mov.l @r5+,r3
- dmulu.l r3,r7
- sts macl,r1
- addc r2,r1 C lo_prod += old cy_limb
- sts mach,r2 C new cy_limb = hi_prod
- mov.l @r4,r3
- addc r0,r2 C cy_limb += T, T = 0
- addc r3,r1
- addc r0,r2 C cy_limb += T, T = 0
- dt r6
- mov.l r1,@r4
- bf.s L(top)
- add #4,r4
-
- rts
- mov r2,r0
-EPILOGUE()
diff --git a/gmp/mpn/sh/sh2/addmul_1.s b/gmp/mpn/sh/sh2/addmul_1.s
new file mode 100644
index 0000000000..df22deaf5c
--- /dev/null
+++ b/gmp/mpn/sh/sh2/addmul_1.s
@@ -0,0 +1,51 @@
+! SH2 __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/.
+
+
+! INPUT PARAMETERS
+! res_ptr r4
+! s1_ptr r5
+! size r6
+! s2_limb r7
+
+ .text
+ .align 1
+ .global ___gmpn_addmul_1
+___gmpn_addmul_1:
+ mov #0,r2 ! cy_limb = 0
+ mov #0,r0 ! Keep r0 = 0 for entire loop
+ clrt
+
+Loop: mov.l @r5+,r3
+ dmulu.l r3,r7
+ sts macl,r1
+ addc r2,r1 ! lo_prod += old cy_limb
+ sts mach,r2 ! new cy_limb = hi_prod
+ mov.l @r4,r3
+ addc r0,r2 ! cy_limb += T, T = 0
+ addc r3,r1
+ addc r0,r2 ! cy_limb += T, T = 0
+ dt r6
+ mov.l r1,@r4
+ bf.s Loop
+ add #4,r4
+
+ rts
+ mov r2,r0
diff --git a/gmp/mpn/sh/sh2/mul_1.asm b/gmp/mpn/sh/sh2/mul_1.asm
deleted file mode 100644
index 83548a6953..0000000000
--- a/gmp/mpn/sh/sh2/mul_1.asm
+++ /dev/null
@@ -1,62 +0,0 @@
-dnl SH2 mpn_mul_1 -- Multiply a limb vector with a limb and store the result
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-C res_ptr r4
-C s1_ptr r5
-C size r6
-C s2_limb r7
-
-changecom(blah) C disable # to make all C comments below work
-
-ASM_START()
-PROLOGUE(mpn_mul_1)
- mov #0,r2 C cy_limb = 0
- mov #0,r0 C Keep r0 = 0 for entire loop
- clrt
-
-L(top): mov.l @r5+,r3
- dmulu.l r3,r7
- sts macl,r1
- addc r2,r1
- sts mach,r2
- addc r0,r2 C propagate carry to cy_limb (dt clobbers T)
- dt r6
- mov.l r1,@r4
- bf.s L(top)
- add #4,r4
-
- rts
- mov r2,r0
-EPILOGUE()
diff --git a/gmp/mpn/sh/sh2/mul_1.s b/gmp/mpn/sh/sh2/mul_1.s
new file mode 100644
index 0000000000..aa41bf2421
--- /dev/null
+++ b/gmp/mpn/sh/sh2/mul_1.s
@@ -0,0 +1,48 @@
+! SH2 __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/.
+
+
+! INPUT PARAMETERS
+! res_ptr r4
+! s1_ptr r5
+! size r6
+! s2_limb r7
+
+ .text
+ .align 1
+ .global ___gmpn_mul_1
+___gmpn_mul_1:
+ mov #0,r2 ! cy_limb = 0
+ mov #0,r0 ! Keep r0 = 0 for entire loop
+ clrt
+
+Loop: mov.l @r5+,r3
+ dmulu.l r3,r7
+ sts macl,r1
+ addc r2,r1
+ sts mach,r2
+ addc r0,r2 ! propagate carry to cy_limb (dt clobbers T)
+ dt r6
+ mov.l r1,@r4
+ bf.s Loop
+ add #4,r4
+
+ rts
+ mov r2,r0
diff --git a/gmp/mpn/sh/sh2/submul_1.asm b/gmp/mpn/sh/sh2/submul_1.asm
deleted file mode 100644
index bef2abd9b2..0000000000
--- a/gmp/mpn/sh/sh2/submul_1.asm
+++ /dev/null
@@ -1,65 +0,0 @@
-dnl SH2 mpn_submul_1 -- Multiply a limb vector with a limb and subtract the
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-C res_ptr r4
-C s1_ptr r5
-C size r6
-C s2_limb r7
-
-changecom(blah) C disable # to make all C comments below work
-
-ASM_START()
-PROLOGUE(mpn_submul_1)
- mov #0,r2 C cy_limb = 0
- mov #0,r0 C Keep r0 = 0 for entire loop
- clrt
-
-L(top): mov.l @r5+,r3
- dmulu.l r3,r7
- sts macl,r1
- addc r2,r1 C lo_prod += old cy_limb
- sts mach,r2 C new cy_limb = hi_prod
- mov.l @r4,r3
- addc r0,r2 C cy_limb += T, T = 0
- subc r1,r3
- addc r0,r2 C cy_limb += T, T = 0
- dt r6
- mov.l r3,@r4
- bf.s L(top)
- add #4,r4
-
- rts
- mov r2,r0
-EPILOGUE()
diff --git a/gmp/mpn/sh/sh2/submul_1.s b/gmp/mpn/sh/sh2/submul_1.s
new file mode 100644
index 0000000000..a1149c54fc
--- /dev/null
+++ b/gmp/mpn/sh/sh2/submul_1.s
@@ -0,0 +1,51 @@
+! SH2 __gmpn_submul_1 -- Multiply a limb vector with a limb and subtract
+! the result from 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/.
+
+
+! INPUT PARAMETERS
+! res_ptr r4
+! s1_ptr r5
+! size r6
+! s2_limb r7
+
+ .text
+ .align 1
+ .global ___gmpn_submul_1
+___gmpn_submul_1:
+ mov #0,r2 ! cy_limb = 0
+ mov #0,r0 ! Keep r0 = 0 for entire loop
+ clrt
+
+Loop: mov.l @r5+,r3
+ dmulu.l r3,r7
+ sts macl,r1
+ addc r2,r1 ! lo_prod += old cy_limb
+ sts mach,r2 ! new cy_limb = hi_prod
+ mov.l @r4,r3
+ addc r0,r2 ! cy_limb += T, T = 0
+ subc r3,r1
+ addc r0,r2 ! cy_limb += T, T = 0
+ dt r6
+ mov.l r1,@r4
+ bf.s Loop
+ add #4,r4
+
+ rts
+ mov r2,r0
diff --git a/gmp/mpn/sh/sub_n.asm b/gmp/mpn/sh/sub_n.asm
deleted file mode 100644
index 465bc806fa..0000000000
--- a/gmp/mpn/sh/sub_n.asm
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl SH mpn_sub_n -- Subtract two limb vectors of the same length > 0 and store
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-C rp r4
-C up r5
-C vp r6
-C n r7
-
-changecom(blah) C disable # to make all C comments below work
-
-ASM_START()
-PROLOGUE(mpn_sub_n)
- mov #0,r3 C clear cy save reg
-
-L(top): mov.l @r5+,r1
- mov.l @r6+,r2
- shlr r3 C restore cy
- subc r2,r1
- movt r3 C save cy
- mov.l r1,@r4
- dt r7
- bf.s L(top)
- add #4,r4
-
- rts
- mov r3,r0 C return carry-out from most significant limb
-EPILOGUE()
diff --git a/gmp/mpn/sh/sub_n.s b/gmp/mpn/sh/sub_n.s
new file mode 100644
index 0000000000..b06e09a727
--- /dev/null
+++ b/gmp/mpn/sh/sub_n.s
@@ -0,0 +1,45 @@
+! SH __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and store
+! difference in a third limb vector.
+
+! Copyright 1995, 1997, 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 r4
+! s1_ptr r5
+! s2_ptr r6
+! size r7
+
+ .text
+ .align 2
+ .global ___gmpn_sub_n
+___gmpn_sub_n:
+ mov #0,r3 ! clear cy save reg
+
+Loop: mov.l @r5+,r1
+ mov.l @r6+,r2
+ shlr r3 ! restore cy
+ subc r2,r1
+ movt r3 ! save cy
+ mov.l r1,@r4
+ dt r7
+ bf.s Loop
+ add #4,r4
+
+ rts
+ mov r3,r0 ! return carry-out from most sign. limb
diff --git a/gmp/mpn/sparc32/README b/gmp/mpn/sparc32/README
index f2dd1160f7..825a1ace8e 100644
--- a/gmp/mpn/sparc32/README
+++ b/gmp/mpn/sparc32/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/sparc32/add_n.asm b/gmp/mpn/sparc32/add_n.asm
index 8549195d92..7c8a9c41e8 100644
--- a/gmp/mpn/sparc32/add_n.asm
+++ b/gmp/mpn/sparc32/add_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/addmul_1.asm b/gmp/mpn/sparc32/addmul_1.asm
index 92d5d78d51..d73529e304 100644
--- a/gmp/mpn/sparc32/addmul_1.asm
+++ b/gmp/mpn/sparc32/addmul_1.asm
@@ -1,33 +1,22 @@
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-1994, 2000 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/gmp-mparam.h b/gmp/mpn/sparc32/gmp-mparam.h
index a3bc612543..3bc6cd6db4 100644
--- a/gmp/mpn/sparc32/gmp-mparam.h
+++ b/gmp/mpn/sparc32/gmp-mparam.h
@@ -1,40 +1,30 @@
/* SPARC v7 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Generated by tuneup.c, 2002-03-13, gcc 2.95, Weitek 8701 */
-#define MUL_TOOM22_THRESHOLD 8
-#define MUL_TOOM33_THRESHOLD 466
+#define MUL_KARATSUBA_THRESHOLD 8
+#define MUL_TOOM3_THRESHOLD 466
#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 16
+#define SQR_KARATSUBA_THRESHOLD 16
#define SQR_TOOM3_THRESHOLD 258
#define DIV_SB_PREINV_THRESHOLD 4
diff --git a/gmp/mpn/sparc32/lshift.asm b/gmp/mpn/sparc32/lshift.asm
index 8321343d6b..00004f87a7 100644
--- a/gmp/mpn/sparc32/lshift.asm
+++ b/gmp/mpn/sparc32/lshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/mul_1.asm b/gmp/mpn/sparc32/mul_1.asm
index 42b4168be1..147db11157 100644
--- a/gmp/mpn/sparc32/mul_1.asm
+++ b/gmp/mpn/sparc32/mul_1.asm
@@ -1,33 +1,22 @@
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-1994, 2000 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/rshift.asm b/gmp/mpn/sparc32/rshift.asm
index e1554766fe..26db4419d8 100644
--- a/gmp/mpn/sparc32/rshift.asm
+++ b/gmp/mpn/sparc32/rshift.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/sparc-defs.m4 b/gmp/mpn/sparc32/sparc-defs.m4
index 5a0d425204..10a4a86a63 100644
--- a/gmp/mpn/sparc32/sparc-defs.m4
+++ b/gmp/mpn/sparc32/sparc-defs.m4
@@ -3,36 +3,25 @@ divert(-1)
dnl m4 macros for SPARC assembler (32 and 64 bit).
-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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+dnl Copyright 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
-changecom(;) dnl cannot use default # since that's used in REGISTER decls
+changecom(!)
dnl Usage: REGISTER(reg,attr)
@@ -47,33 +36,4 @@ 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
diff --git a/gmp/mpn/sparc32/sub_n.asm b/gmp/mpn/sparc32/sub_n.asm
index 24a576d82b..4fc759dcbf 100644
--- a/gmp/mpn/sparc32/sub_n.asm
+++ b/gmp/mpn/sparc32/sub_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/submul_1.asm b/gmp/mpn/sparc32/submul_1.asm
index 73f9377006..9cde45fc3b 100644
--- a/gmp/mpn/sparc32/submul_1.asm
+++ b/gmp/mpn/sparc32/submul_1.asm
@@ -1,33 +1,22 @@
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-1994, 2000 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/udiv.asm b/gmp/mpn/sparc32/udiv.asm
index 23ab3de1db..fc520f67e2 100644
--- a/gmp/mpn/sparc32/udiv.asm
+++ b/gmp/mpn/sparc32/udiv.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/udiv_nfp.asm b/gmp/mpn/sparc32/udiv_nfp.asm
index ebbb820639..a7513ead6c 100644
--- a/gmp/mpn/sparc32/udiv_nfp.asm
+++ b/gmp/mpn/sparc32/udiv_nfp.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/ultrasparct1/add_n.asm b/gmp/mpn/sparc32/ultrasparct1/add_n.asm
deleted file mode 100644
index c781596dad..0000000000
--- a/gmp/mpn/sparc32/ultrasparct1/add_n.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-define(`rp', %o0)
-define(`ap', %o1)
-define(`bp', %o2)
-define(`n', %o3)
-define(`cy', %o4)
-
-define(`i', %o3)
-
-MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc)
-
-ASM_START()
-PROLOGUE(mpn_add_nc)
- b L(ent)
- srl cy, 0, cy C strip any bogus high bits
-EPILOGUE()
-
-PROLOGUE(mpn_add_n)
- mov 0, cy
-L(ent): srl n, 0, n C strip any bogus high bits
- sll n, 2, n
- add ap, n, ap
- add bp, n, bp
- add rp, n, rp
- neg n, i
-
-L(top): lduw [ap+i], %g1
- lduw [bp+i], %g2
- add %g1, %g2, %g3
- add %g3, cy, %g3
- stw %g3, [rp+i]
- add i, 4, i
- brnz i, L(top)
- srlx %g3, 32, cy
-
- retl
- mov cy, %o0 C return value
-EPILOGUE()
diff --git a/gmp/mpn/sparc32/ultrasparct1/addmul_1.asm b/gmp/mpn/sparc32/ultrasparct1/addmul_1.asm
deleted file mode 100644
index 89da186457..0000000000
--- a/gmp/mpn/sparc32/ultrasparct1/addmul_1.asm
+++ /dev/null
@@ -1,90 +0,0 @@
-dnl SPARC T1 32-bit mpn_addmul_1.
-
-dnl Contributed to the GNU project by David Miller.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 24
-C UltraSPARC T2: 19
-C UltraSPARC T3: 19
-C UltraSPARC T4: 5
-
-C INPUT PARAMETERS
-define(`rp', `%i0')
-define(`up', `%i1')
-define(`n', `%i2')
-define(`v0', `%i3')
-
-ASM_START()
-PROLOGUE(mpn_addmul_1)
- 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]
- srlx %g3, 32, %o5
-
-L(done):
- ret
- restore %o5, 0, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc32/ultrasparct1/gmp-mparam.h b/gmp/mpn/sparc32/ultrasparct1/gmp-mparam.h
deleted file mode 100644
index 6f9d5a44ca..0000000000
--- a/gmp/mpn/sparc32/ultrasparct1/gmp-mparam.h
+++ /dev/null
@@ -1,153 +0,0 @@
-/* UltraSPARC T 32-bit gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 DIVREM_1_NORM_THRESHOLD 0 /* always */
-#define DIVREM_1_UNNORM_THRESHOLD 3
-#define MOD_1_1P_METHOD 2
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 9
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 10
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 21
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 22
-#define USE_PREINV_DIVREM_1 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 35
-
-#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 98
-#define MUL_TOOM44_THRESHOLD 166
-#define MUL_TOOM6H_THRESHOLD 226
-#define MUL_TOOM8H_THRESHOLD 333
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 139
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 97
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 98
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 120
-
-#define SQR_BASECASE_THRESHOLD 6
-#define SQR_TOOM2_THRESHOLD 34
-#define SQR_TOOM3_THRESHOLD 110
-#define SQR_TOOM4_THRESHOLD 178
-#define SQR_TOOM6_THRESHOLD 240
-#define SQR_TOOM8_THRESHOLD 333
-
-#define MULMID_TOOM42_THRESHOLD 22
-
-#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 13
-
-#define MUL_FFT_MODF_THRESHOLD 280 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 280, 5}, { 15, 6}, { 8, 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}, { 21, 8}, \
- { 11, 7}, { 25, 9}, { 7, 8}, { 15, 7}, \
- { 33, 8}, { 19, 7}, { 41, 8}, { 23, 7}, \
- { 49, 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}, { 79,10}, \
- { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255,10}, { 79, 9}, { 159, 8}, { 319,10}, \
- { 95, 9}, { 191, 8}, { 383,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 143, 9}, { 287,10}, \
- { 159, 9}, { 319,10}, { 175,11}, { 95,10}, \
- { 191, 9}, { 383,12}, { 4096,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 66
-#define MUL_FFT_THRESHOLD 3712
-
-#define SQR_FFT_MODF_THRESHOLD 240 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 240, 5}, { 15, 6}, { 8, 5}, { 17, 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, 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,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255, 9}, { 143,10}, { 79, 9}, { 159, 8}, \
- { 319, 9}, { 175,10}, { 95, 9}, { 191, 8}, \
- { 383, 9}, { 207,11}, { 63,10}, { 127, 9}, \
- { 255,10}, { 143, 9}, { 287,10}, { 159, 9}, \
- { 319,10}, { 175,11}, { 95,10}, { 191, 9}, \
- { 383,10}, { 207,12}, { 4096,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 70
-#define SQR_FFT_THRESHOLD 2624
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 51
-#define MULLO_MUL_N_THRESHOLD 6633
-
-#define DC_DIV_QR_THRESHOLD 51
-#define DC_DIVAPPR_Q_THRESHOLD 202
-#define DC_BDIV_QR_THRESHOLD 47
-#define DC_BDIV_Q_THRESHOLD 124
-
-#define INV_MULMOD_BNM1_THRESHOLD 26
-#define INV_NEWTON_THRESHOLD 266
-#define INV_APPR_THRESHOLD 222
-
-#define BINV_NEWTON_THRESHOLD 296
-#define REDC_1_TO_REDC_N_THRESHOLD 59
-
-#define MU_DIV_QR_THRESHOLD 1334
-#define MU_DIVAPPR_Q_THRESHOLD 1499
-#define MUPI_DIV_QR_THRESHOLD 116
-#define MU_BDIV_QR_THRESHOLD 1057
-#define MU_BDIV_Q_THRESHOLD 1334
-
-#define POWM_SEC_TABLE 6,35,213,724,2618
-
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 84
-#define HGCD_APPR_THRESHOLD 101
-#define HGCD_REDUCE_THRESHOLD 1437
-#define GCD_DC_THRESHOLD 372
-#define GCDEXT_DC_THRESHOLD 253
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 27
-#define SET_STR_DC_THRESHOLD 399
-#define SET_STR_PRECOMPUTE_THRESHOLD 885
-
-#define FAC_DSC_THRESHOLD 179
-#define FAC_ODD_THRESHOLD 29
diff --git a/gmp/mpn/sparc32/ultrasparct1/mul_1.asm b/gmp/mpn/sparc32/ultrasparct1/mul_1.asm
deleted file mode 100644
index 0239cd28cd..0000000000
--- a/gmp/mpn/sparc32/ultrasparct1/mul_1.asm
+++ /dev/null
@@ -1,83 +0,0 @@
-dnl SPARC T1 32-bit mpn_mul_1.
-
-dnl Contributed to the GNU project by David Miller.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 20
-C UltraSPARC T2: 18
-C UltraSPARC T3: 18
-C UltraSPARC T4: 4
-
-C INPUT PARAMETERS
-define(`rp', `%o0')
-define(`up', `%o1')
-define(`n', `%o2')
-define(`v0', `%o3')
-
-ASM_START()
-PROLOGUE(mpn_mul_1)
- srl n, 0, n
- srl v0, 0, v0
- subcc n, 1, n
- be L(final_one)
- clr %o5
-
-L(top): lduw [up+0], %g1
- 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 %o5, %g3, %g3
- stw %g3, [rp+0]
- srlx %g3, 32, %o5
-
-L(done):
- retl
- mov %o5, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc32/ultrasparct1/sqr_diagonal.asm b/gmp/mpn/sparc32/ultrasparct1/sqr_diagonal.asm
deleted file mode 100644
index 3b906ef202..0000000000
--- a/gmp/mpn/sparc32/ultrasparct1/sqr_diagonal.asm
+++ /dev/null
@@ -1,55 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-define(`rp', `%o0')
-define(`up', `%o1')
-define(`n', `%o2')
-
-ASM_START()
-PROLOGUE(mpn_sqr_diagonal)
- deccc n C n--
- nop
-
-L(top): lduw [up+0], %g1
- add up, 4, up C up++
- mulx %g1, %g1, %g3
- stw %g3, [rp+0]
- srlx %g3, 32, %g4
- stw %g4, [rp+4]
- add rp, 8, rp C rp += 2
- bnz %icc, L(top)
- deccc n C n--
-
- retl
- nop
-EPILOGUE()
diff --git a/gmp/mpn/sparc32/ultrasparct1/sub_n.asm b/gmp/mpn/sparc32/ultrasparct1/sub_n.asm
deleted file mode 100644
index 946bc3ff8e..0000000000
--- a/gmp/mpn/sparc32/ultrasparct1/sub_n.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-define(`rp', %o0)
-define(`ap', %o1)
-define(`bp', %o2)
-define(`n', %o3)
-define(`cy', %o4)
-
-define(`i', %o3)
-
-MULFUNC_PROLOGUE(mpn_sub_n mpn_sub_nc)
-
-ASM_START()
-PROLOGUE(mpn_sub_nc)
- b L(ent)
- srl cy, 0, cy C strip any bogus high bits
-EPILOGUE()
-
-PROLOGUE(mpn_sub_n)
- mov 0, cy
-L(ent): srl n, 0, n C strip any bogus high bits
- sll n, 2, n
- add ap, n, ap
- add bp, n, bp
- add rp, n, rp
- neg n, i
-
-L(top): lduw [ap+i], %g1
- lduw [bp+i], %g2
- sub %g1, %g2, %g3
- sub %g3, cy, %g3
- stw %g3, [rp+i]
- add i, 4, i
- brnz i, L(top)
- srlx %g3, 63, cy
-
- retl
- mov cy, %o0 C return value
-EPILOGUE()
diff --git a/gmp/mpn/sparc32/ultrasparct1/submul_1.asm b/gmp/mpn/sparc32/ultrasparct1/submul_1.asm
deleted file mode 100644
index 89200709c4..0000000000
--- a/gmp/mpn/sparc32/ultrasparct1/submul_1.asm
+++ /dev/null
@@ -1,91 +0,0 @@
-dnl SPARC T1 32-bit mpn_submul_1.
-
-dnl Contributed to the GNU project by David Miller.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 24
-C UltraSPARC T2: 19
-C UltraSPARC T3: 19
-C UltraSPARC T4: 5
-
-C INPUT PARAMETERS
-define(`rp', `%i0')
-define(`up', `%i1')
-define(`n', `%i2')
-define(`v0', `%i3')
-
-ASM_START()
-PROLOGUE(mpn_submul_1)
- 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]
-
-L(done):
- addx %o5, 0, %o5
- ret
- restore %o5, 0, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc32/umul.asm b/gmp/mpn/sparc32/umul.asm
index 3a20b95cb5..80c82122d9 100644
--- a/gmp/mpn/sparc32/umul.asm
+++ b/gmp/mpn/sparc32/umul.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v8/addmul_1.asm b/gmp/mpn/sparc32/v8/addmul_1.asm
index 0052092784..6e5e78865b 100644
--- a/gmp/mpn/sparc32/v8/addmul_1.asm
+++ b/gmp/mpn/sparc32/v8/addmul_1.asm
@@ -1,33 +1,22 @@
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-1995, 2000 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v8/gmp-mparam.h b/gmp/mpn/sparc32/v8/gmp-mparam.h
index e57897b439..f042c19e5e 100644
--- a/gmp/mpn/sparc32/v8/gmp-mparam.h
+++ b/gmp/mpn/sparc32/v8/gmp-mparam.h
@@ -1,44 +1,34 @@
/* SPARC v8 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2004 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* Generated by tuneup.c, 2004-02-07, gcc 2.95 */
-#define MUL_TOOM22_THRESHOLD 10
-#define MUL_TOOM33_THRESHOLD 65
+#define MUL_KARATSUBA_THRESHOLD 10
+#define MUL_TOOM3_THRESHOLD 65
#define SQR_BASECASE_THRESHOLD 4
-#define SQR_TOOM2_THRESHOLD 18
+#define SQR_KARATSUBA_THRESHOLD 18
#define SQR_TOOM3_THRESHOLD 65
#define DIV_SB_PREINV_THRESHOLD 5
diff --git a/gmp/mpn/sparc32/v8/mul_1.asm b/gmp/mpn/sparc32/v8/mul_1.asm
index e26c853aed..d428debf15 100644
--- a/gmp/mpn/sparc32/v8/mul_1.asm
+++ b/gmp/mpn/sparc32/v8/mul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v8/submul_1.asm b/gmp/mpn/sparc32/v8/submul_1.asm
index 187314ecef..4dde012808 100644
--- a/gmp/mpn/sparc32/v8/submul_1.asm
+++ b/gmp/mpn/sparc32/v8/submul_1.asm
@@ -1,33 +1,22 @@
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-1994, 2000 Free Software Foundation, Inc.
+dnl Copyright 1992, 1993, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v8/supersparc/gmp-mparam.h b/gmp/mpn/sparc32/v8/supersparc/gmp-mparam.h
index 1ac9239e3c..feb90ef408 100644
--- a/gmp/mpn/sparc32/v8/supersparc/gmp-mparam.h
+++ b/gmp/mpn/sparc32/v8/supersparc/gmp-mparam.h
@@ -1,44 +1,34 @@
/* SuperSPARC gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2004 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* Generated by tuneup.c, 2004-02-10, gcc 3.3 */
-#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 81
+#define MUL_KARATSUBA_THRESHOLD 14
+#define MUL_TOOM3_THRESHOLD 81
#define SQR_BASECASE_THRESHOLD 5
-#define SQR_TOOM2_THRESHOLD 28
+#define SQR_KARATSUBA_THRESHOLD 28
#define SQR_TOOM3_THRESHOLD 86
#define DIV_SB_PREINV_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/sparc32/v8/supersparc/udiv.asm b/gmp/mpn/sparc32/v8/supersparc/udiv.asm
index 12f66ce6a2..2ce3b8f15c 100644
--- a/gmp/mpn/sparc32/v8/supersparc/udiv.asm
+++ b/gmp/mpn/sparc32/v8/supersparc/udiv.asm
@@ -5,30 +5,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v8/udiv.asm b/gmp/mpn/sparc32/v8/udiv.asm
index 12f66ce6a2..2ce3b8f15c 100644
--- a/gmp/mpn/sparc32/v8/udiv.asm
+++ b/gmp/mpn/sparc32/v8/udiv.asm
@@ -5,30 +5,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v8/umul.asm b/gmp/mpn/sparc32/v8/umul.asm
index 1a2e84b1f6..569a4e8dd3 100644
--- a/gmp/mpn/sparc32/v8/umul.asm
+++ b/gmp/mpn/sparc32/v8/umul.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v9/add_n.asm b/gmp/mpn/sparc32/v9/add_n.asm
index 7bd5974fd3..a21cf10d55 100644
--- a/gmp/mpn/sparc32/v9/add_n.asm
+++ b/gmp/mpn/sparc32/v9/add_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v9/addmul_1.asm b/gmp/mpn/sparc32/v9/addmul_1.asm
index 2adf7a8a2f..18b9a72d1a 100644
--- a/gmp/mpn/sparc32/v9/addmul_1.asm
+++ b/gmp/mpn/sparc32/v9/addmul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v9/gmp-mparam.h b/gmp/mpn/sparc32/v9/gmp-mparam.h
index f909e2cf18..5d06398192 100644
--- a/gmp/mpn/sparc32/v9/gmp-mparam.h
+++ b/gmp/mpn/sparc32/v9/gmp-mparam.h
@@ -1,204 +1,73 @@
/* SPARC v9 32-bit gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004, 2009-2011, 2014 Free Software
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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
-
-/* 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 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 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 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 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 4
-#define SQR_TOOM2_THRESHOLD 64
-#define SQR_TOOM3_THRESHOLD 85
-#define SQR_TOOM4_THRESHOLD 152
-#define SQR_TOOM6_THRESHOLD 185
-#define SQR_TOOM8_THRESHOLD 324
-
-#define MULMID_TOOM42_THRESHOLD 64
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 16
-
-#define MUL_FFT_MODF_THRESHOLD 288 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, { 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}, { 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 \
- { { 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,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 144
-#define MULLO_MUL_N_THRESHOLD 4292
-
-#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 108
-#define INV_NEWTON_THRESHOLD 351
-#define INV_APPR_THRESHOLD 303
-
-#define BINV_NEWTON_THRESHOLD 354
-#define REDC_1_TO_REDC_N_THRESHOLD 61
-
-#define MU_DIV_QR_THRESHOLD 998
-#define MU_DIVAPPR_Q_THRESHOLD 1099
-#define MUPI_DIV_QR_THRESHOLD 118
-#define MU_BDIV_QR_THRESHOLD 807
-#define MU_BDIV_Q_THRESHOLD 979
-
-#define POWM_SEC_TABLE 3,22,127,624,779,2351
-
-#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 192
-#define JACOBI_BASE_METHOD 4
-
-#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 25
+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 BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
+
+/* Generated by tuneup.c, 2009-02-12, gcc 2.95 */
+
+#define MUL_KARATSUBA_THRESHOLD 28
+#define MUL_TOOM3_THRESHOLD 97
+#define MUL_TOOM44_THRESHOLD 136
+
+#define SQR_BASECASE_THRESHOLD 8
+#define SQR_KARATSUBA_THRESHOLD 60
+#define SQR_TOOM3_THRESHOLD 138
+#define SQR_TOOM4_THRESHOLD 278
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 111
+#define MULLOW_MUL_N_THRESHOLD 434
+
+#define DIV_SB_PREINV_THRESHOLD 7
+#define DIV_DC_THRESHOLD 122
+#define POWM_THRESHOLD 154
+
+#define MATRIX22_STRASSEN_THRESHOLD 12
+#define HGCD_THRESHOLD 155
+#define GCD_DC_THRESHOLD 614
+#define GCDEXT_DC_THRESHOLD 438
+#define JACOBI_BASE_METHOD 2
+
+#define DIVREM_1_NORM_THRESHOLD 5
+#define DIVREM_1_UNNORM_THRESHOLD 14
+#define MOD_1_NORM_THRESHOLD 4
+#define MOD_1_UNNORM_THRESHOLD 5
+#define MOD_1_1_THRESHOLD 7
+#define MOD_1_2_THRESHOLD 8
+#define MOD_1_4_THRESHOLD 16
+#define USE_PREINV_DIVREM_1 1
+#define USE_PREINV_MOD_1 1
+#define DIVREM_2_THRESHOLD 0 /* always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD MP_SIZE_T_MAX /* never */
+
+#define GET_STR_DC_THRESHOLD 12
+#define GET_STR_PRECOMPUTE_THRESHOLD 19
+#define SET_STR_DC_THRESHOLD 802
+#define SET_STR_PRECOMPUTE_THRESHOLD 1647
+
+#define MUL_FFT_TABLE { 304, 736, 1152, 3584, 10240, 24576, 98304, 393216, 0 }
+#define MUL_FFT_MODF_THRESHOLD 264
+#define MUL_FFT_THRESHOLD 2304
+
+#define SQR_FFT_TABLE { 336, 800, 1408, 3584, 10240, 24576, 98304, 393216, 0 }
+#define SQR_FFT_MODF_THRESHOLD 248
+#define SQR_FFT_THRESHOLD 2304
diff --git a/gmp/mpn/sparc32/v9/mul_1.asm b/gmp/mpn/sparc32/v9/mul_1.asm
index 40aeffad4f..881f46fb62 100644
--- a/gmp/mpn/sparc32/v9/mul_1.asm
+++ b/gmp/mpn/sparc32/v9/mul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v9/sqr_diagonal.asm b/gmp/mpn/sparc32/v9/sqr_diagonal.asm
index e024279849..e4a78c5de7 100644
--- a/gmp/mpn/sparc32/v9/sqr_diagonal.asm
+++ b/gmp/mpn/sparc32/v9/sqr_diagonal.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v9/sub_n.asm b/gmp/mpn/sparc32/v9/sub_n.asm
index 636c73bf35..cea474326c 100644
--- a/gmp/mpn/sparc32/v9/sub_n.asm
+++ b/gmp/mpn/sparc32/v9/sub_n.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v9/submul_1.asm b/gmp/mpn/sparc32/v9/submul_1.asm
index 92d0ce7db9..e5823b1e4b 100644
--- a/gmp/mpn/sparc32/v9/submul_1.asm
+++ b/gmp/mpn/sparc32/v9/submul_1.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc32/v9/udiv.asm b/gmp/mpn/sparc32/v9/udiv.asm
index 61dde97a66..0957b8c225 100644
--- a/gmp/mpn/sparc32/v9/udiv.asm
+++ b/gmp/mpn/sparc32/v9/udiv.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc64/README b/gmp/mpn/sparc64/README
index e2c051a02b..19072996de 100644
--- a/gmp/mpn/sparc64/README
+++ b/gmp/mpn/sparc64/README
@@ -1,30 +1,19 @@
-Copyright 1997, 1999-2002 Free Software Foundation, Inc.
+Copyright 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -76,7 +65,7 @@ Integer conditional move instructions cannot dual-issue with other integer
instructions. No conditional move can issue 1-5 cycles after a load. (This
might have been fixed for UltraSPARC-3.)
-The UltraSPARC-3 pipeline is very simular to the one of UltraSPARC-1/2 , but is
+The UltraSPARC-3 pipeline is very simular to he one of UltraSPARC-1/2 , but is
somewhat slower. Branches execute slower, and there may be other new stalls.
But integer multiply doesn't stall the entire CPU and also has a much lower
latency. But it's still not pipelined, and thus useless for our needs.
diff --git a/gmp/mpn/sparc64/ultrasparc1234/add_n.asm b/gmp/mpn/sparc64/add_n.asm
index 92374d2552..c3e5b46ddf 100644
--- a/gmp/mpn/sparc64/ultrasparc1234/add_n.asm
+++ b/gmp/mpn/sparc64/add_n.asm
@@ -1,33 +1,22 @@
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-2003, 2011 Free Software Foundation, Inc.
+dnl Copyright 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -43,19 +32,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')
@@ -65,24 +54,14 @@ define(`fmnop',`fmuld %f0,%f0,%f4') dnl A quasi nop running in the FM pipe
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
-PROLOGUE(mpn_add_nc)
- save %sp,-160,%sp
-
- fitod %f0,%f0 C make sure f0 contains small, quiet number
- subcc n,4,%g0
- bl,pn %xcc,.Loop0
- nop
- b,a L(com)
-EPILOGUE()
-
PROLOGUE(mpn_add_n)
save %sp,-160,%sp
fitod %f0,%f0 C make sure f0 contains small, quiet number
subcc n,4,%g0
- bl,pn %xcc,.Loop0
+ bl,pn %icc,.Loop0
mov 0,cy
-L(com):
+
ldx [up+0],u0
ldx [vp+0],v0
add up,32,up
@@ -95,15 +74,15 @@ L(com):
ldx [vp-8],v3
subcc n,8,n
add u0,v0,%g1 C main add
- add %g1,cy,%g5 C carry add
+ add %g1,cy,%g4 C carry add
or u0,v0,%g2
- bl,pn %xcc,.Lend4567
+ bl,pn %icc,.Lend4567
fanop
b,a .Loop
.align 16
C START MAIN LOOP
-.Loop: andn %g2,%g5,%g2
+.Loop: andn %g2,%g4,%g2
and u0,v0,%g3
ldx [up+0],u0
fanop
@@ -115,15 +94,15 @@ C --
C --
srlx %g2,63,cy
add u1,v1,%g1
- stx %g5,[rp+0]
+ stx %g4,[rp+0]
fanop
C --
- add %g1,cy,%g5
+ add %g1,cy,%g4
or u1,v1,%g2
fmnop
fanop
C --
- andn %g2,%g5,%g2
+ andn %g2,%g4,%g2
and u1,v1,%g3
ldx [up-24],u1
fanop
@@ -135,15 +114,15 @@ C --
C --
srlx %g2,63,cy
add u2,v2,%g1
- stx %g5,[rp+8]
+ stx %g4,[rp+8]
fanop
C --
- add %g1,cy,%g5
+ add %g1,cy,%g4
or u2,v2,%g2
fmnop
fanop
C --
- andn %g2,%g5,%g2
+ andn %g2,%g4,%g2
and u2,v2,%g3
ldx [up-16],u2
fanop
@@ -155,15 +134,15 @@ C --
C --
srlx %g2,63,cy
add u3,v3,%g1
- stx %g5,[rp-16]
+ stx %g4,[rp-16]
fanop
C --
- add %g1,cy,%g5
+ add %g1,cy,%g4
or u3,v3,%g2
fmnop
fanop
C --
- andn %g2,%g5,%g2
+ andn %g2,%g4,%g2
and u3,v3,%g3
ldx [up-8],u3
fanop
@@ -175,48 +154,48 @@ C --
C --
srlx %g2,63,cy
add u0,v0,%g1
- stx %g5,[rp-8]
+ stx %g4,[rp-8]
fanop
C --
- add %g1,cy,%g5
+ add %g1,cy,%g4
or u0,v0,%g2
- bge,pt %xcc,.Loop
+ bge,pt %icc,.Loop
fanop
C END MAIN LOOP
.Lend4567:
- andn %g2,%g5,%g2
+ andn %g2,%g4,%g2
and u0,v0,%g3
or %g3,%g2,%g2
srlx %g2,63,cy
add u1,v1,%g1
- stx %g5,[rp+0]
- add %g1,cy,%g5
+ stx %g4,[rp+0]
+ add %g1,cy,%g4
or u1,v1,%g2
- andn %g2,%g5,%g2
+ andn %g2,%g4,%g2
and u1,v1,%g3
or %g3,%g2,%g2
srlx %g2,63,cy
add u2,v2,%g1
- stx %g5,[rp+8]
- add %g1,cy,%g5
+ stx %g4,[rp+8]
+ add %g1,cy,%g4
or u2,v2,%g2
- andn %g2,%g5,%g2
+ andn %g2,%g4,%g2
and u2,v2,%g3
or %g3,%g2,%g2
add rp,32,rp
srlx %g2,63,cy
add u3,v3,%g1
- stx %g5,[rp-16]
- add %g1,cy,%g5
+ stx %g4,[rp-16]
+ add %g1,cy,%g4
or u3,v3,%g2
- andn %g2,%g5,%g2
+ andn %g2,%g4,%g2
and u3,v3,%g3
or %g3,%g2,%g2
srlx %g2,63,cy
- stx %g5,[rp-8]
+ stx %g4,[rp-8]
addcc n,4,n
- bz,pn %xcc,.Lret
+ bz,pn %icc,.Lret
fanop
.Loop0: ldx [up],u0
@@ -227,15 +206,15 @@ C END MAIN LOOP
subcc n,1,n
add u0,v0,%g1
or u0,v0,%g2
- add %g1,cy,%g5
+ add %g1,cy,%g4
and u0,v0,%g3
- andn %g2,%g5,%g2
- stx %g5,[rp-8]
+ andn %g2,%g4,%g2
+ stx %g4,[rp-8]
or %g3,%g2,%g2
- bnz,pt %xcc,.Loop0
+ bnz,pt %icc,.Loop0
srlx %g2,63,cy
.Lret: mov cy,%i0
ret
restore
-EPILOGUE()
+EPILOGUE(mpn_add_n)
diff --git a/gmp/mpn/sparc64/ultrasparc1234/addmul_1.asm b/gmp/mpn/sparc64/addmul_1.asm
index 48a94146ff..bd83c6562c 100644
--- a/gmp/mpn/sparc64/ultrasparc1234/addmul_1.asm
+++ b/gmp/mpn/sparc64/addmul_1.asm
@@ -1,33 +1,23 @@
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-2004 Free Software Foundation, Inc.
+dnl Copyright 1998, 2000, 2001, 2002, 2003, 2004 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 it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -148,7 +138,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
fmuld u32, v00, r32
fmuld u00, v48, p48
addcc %i2, 8, %i2
- bnz,pt %xcc, .L_two_or_more
+ bnz,pt %icc, .L_two_or_more
fmuld u32, v16, r48
.L_one:
@@ -226,7 +216,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
faddd p16, r80, a16
fmuld u00, v48, p48
addcc %i2, 8, %i2
- bnz,pt %xcc, .L_three_or_more
+ bnz,pt %icc, .L_three_or_more
fmuld u32, v16, r48
.L_two:
@@ -308,7 +298,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
faddd p16, r80, a16
fmuld u00, v48, p48
addcc %i2, 8, %i2
- bnz,pt %xcc, .L_four_or_more
+ bnz,pt %icc, .L_four_or_more
fmuld u32, v16, r48
.L_three:
@@ -396,7 +386,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
fmuld u00, v48, p48
add cy, %g5, %o4 C x = prev(i00) + cy
addcc %i2, 8, %i2
- bnz,pt %xcc, .Loop
+ bnz,pt %icc, .Loop
fmuld u32, v16, r48
.L_four:
@@ -473,7 +463,7 @@ C 12
C 13
add cy, %g5, %o4 C x = prev(i00) + cy
addcc %i2, 8, %i2
- bnz,pt %xcc, .Loop
+ bnz,pt %icc, .Loop
fmuld u32, v16, r48
C END MAIN LOOP
diff --git a/gmp/mpn/sparc64/ultrasparc1234/addmul_2.asm b/gmp/mpn/sparc64/addmul_2.asm
index 37674d7423..65efb5159a 100644
--- a/gmp/mpn/sparc64/ultrasparc1234/addmul_2.asm
+++ b/gmp/mpn/sparc64/addmul_2.asm
@@ -4,30 +4,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc64/copyd.asm b/gmp/mpn/sparc64/copyd.asm
index ab105d39c7..8a73dba8f0 100644
--- a/gmp/mpn/sparc64/copyd.asm
+++ b/gmp/mpn/sparc64/copyd.asm
@@ -1,41 +1,27 @@
dnl SPARC v9 mpn_copyd -- Copy a limb vector, decrementing.
-dnl Copyright 1999-2003 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 UltraSPARC T1: 17
-C UltraSPARC T3: 6
-C UltraSPARC T4/T5: 2
+C UltraSPARC 1&2: 2
+C UltraSPARC 3: 2.5
C INPUT PARAMETERS
C rptr %o0
@@ -50,7 +36,7 @@ PROLOGUE(mpn_copyd)
add %g1,%o0,%o0
add %g1,%o1,%o1
addcc %o2,-8,%o2
- bl,pt %xcc,L(end01234567)
+ bl,pt %icc,L(end01234567)
nop
L(loop1):
ldx [%o1-8],%g1
@@ -71,18 +57,18 @@ L(loop1):
stx %o4,[%o0-56]
stx %o5,[%o0-64]
addcc %o2,-8,%o2
- bge,pt %xcc,L(loop1)
+ bge,pt %icc,L(loop1)
add %o0,-64,%o0
L(end01234567):
addcc %o2,8,%o2
- bz,pn %xcc,L(end)
+ bz,pn %icc,L(end)
nop
L(loop2):
ldx [%o1-8],%g1
add %o1,-8,%o1
addcc %o2,-1,%o2
stx %g1,[%o0-8]
- bg,pt %xcc,L(loop2)
+ bg,pt %icc,L(loop2)
add %o0,-8,%o0
L(end): retl
nop
diff --git a/gmp/mpn/sparc64/copyi.asm b/gmp/mpn/sparc64/copyi.asm
index 45663dc2a3..3158357c0b 100644
--- a/gmp/mpn/sparc64/copyi.asm
+++ b/gmp/mpn/sparc64/copyi.asm
@@ -1,41 +1,27 @@
dnl SPARC v9 mpn_copyi -- Copy a limb vector, incrementing.
-dnl Copyright 1999-2003 Free Software Foundation, Inc.
+dnl Copyright 1999, 2000, 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 UltraSPARC T1: 17
-C UltraSPARC T3: 6
-C UltraSPARC T4/T5: 2
+C UltraSPARC 1&2: 2
+C UltraSPARC 3: 2.5
C INPUT PARAMETERS
C rptr %o0
@@ -47,7 +33,7 @@ ASM_START()
REGISTER(%g3,#scratch)
PROLOGUE(mpn_copyi)
addcc %o2,-8,%o2
- bl,pt %xcc,L(end01234567)
+ bl,pt %icc,L(end01234567)
nop
L(loop1):
ldx [%o1+0],%g1
@@ -68,18 +54,18 @@ L(loop1):
stx %o4,[%o0+48]
stx %o5,[%o0+56]
addcc %o2,-8,%o2
- bge,pt %xcc,L(loop1)
+ bge,pt %icc,L(loop1)
add %o0,64,%o0
L(end01234567):
addcc %o2,8,%o2
- bz,pn %xcc,L(end)
+ bz,pn %icc,L(end)
nop
L(loop2):
ldx [%o1+0],%g1
add %o1,8,%o1
addcc %o2,-1,%o2
stx %g1,[%o0+0]
- bg,pt %xcc,L(loop2)
+ bg,pt %icc,L(loop2)
add %o0,8,%o0
L(end): retl
nop
diff --git a/gmp/mpn/sparc64/dive_1.c b/gmp/mpn/sparc64/dive_1.c
index c3fbf01b14..6f3d7c447c 100644
--- a/gmp/mpn/sparc64/dive_1.c
+++ b/gmp/mpn/sparc64/dive_1.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/sparc64/divrem_1.c b/gmp/mpn/sparc64/divrem_1.c
index 531494a94f..06de9a6040 100644
--- a/gmp/mpn/sparc64/divrem_1.c
+++ b/gmp/mpn/sparc64/divrem_1.c
@@ -1,33 +1,22 @@
/* UltraSparc 64 mpn_divrem_1 -- mpn by limb division.
-Copyright 1991, 1993, 1994, 1996, 1998-2001, 2003 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 1998, 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/sparc64/gcd_1.asm b/gmp/mpn/sparc64/gcd_1.asm
deleted file mode 100644
index e4d8de6a28..0000000000
--- a/gmp/mpn/sparc64/gcd_1.asm
+++ /dev/null
@@ -1,135 +0,0 @@
-dnl SPARC64 mpn_gcd_1.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for SPARC by Torbjörn
-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')
-
-
-C cycles/bit (approx)
-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.
-
-deflit(MAXSHIFT, 7)
-deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
-
- 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).
-define(`BMOD_THRES_LOG2', 14)
-
-C INPUT PARAMETERS
-define(`up', `%i0')
-define(`n', `%i1')
-define(`v0', `%i2')
-
-
-ASM_START()
- REGISTER(%g2,#scratch)
- REGISTER(%g3,#scratch)
-PROLOGUE(mpn_gcd_1)
- save %sp, -192, %sp
- ldx [up+0], %g1 C U low limb
- mov -1, %i4
- or v0, %g1, %g2 C x | y
-
-L(twos):
- inc %i4
- andcc %g2, 1, %g0
- bz,a %xcc, L(twos)
- srlx %g2, 1, %g2
-
-L(divide_strip_y):
- andcc v0, 1, %g0
- bz,a %xcc, L(divide_strip_y)
- srlx v0, 1, v0
-
- cmp n, 1 C if n > 1 we need
- bnz %xcc, L(bmod) C to call bmod_1
- nop
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- srlx %g1, BMOD_THRES_LOG2, %g2
- cmp %g2, v0
- bleu %xcc, L(noreduce)
- mov %g1, %o0
-
-L(bmod):
- mov up, %o0
- mov n, %o1
- mov v0, %o2
- call mpn_modexact_1c_odd
- mov 0, %o3
-
-L(noreduce):
-
- LEA64(ctz_table, i5, g4)
-
- cmp %o0, 0
- bnz %xcc, L(mid)
- and %o0, MASK, %g3 C
-
- return %i7+8
- sllx %o2, %o4, %o0 C CAUTION: v0 alias for o2
-
- ALIGN(16)
-L(top): movcc %xcc, %l4, v0 C v = min(u,v)
- movcc %xcc, %l2, %o0 C u = |v - u]
-L(mid): ldub [%i5+%g3], %g5 C
- brz,a,pn %g3, L(shift_alot) C
- srlx %o0, MAXSHIFT, %o0
- srlx %o0, %g5, %l4 C new u, odd
- subcc v0, %l4, %l2 C v - u, set flags for branch and movcc
- sub %l4, v0, %o0 C u - v
- bnz,pt %xcc, L(top) C
- and %l2, MASK, %g3 C extract low MAXSHIFT bits from (v-u)
-
- return %i7+8
- sllx %o2, %o4, %o0 C CAUTION: v0 alias for o2
-
-L(shift_alot):
- b L(mid)
- and %o0, MASK, %g3 C
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/gmp-mparam.h b/gmp/mpn/sparc64/gmp-mparam.h
index 5ac2c461c5..abf523951d 100644
--- a/gmp/mpn/sparc64/gmp-mparam.h
+++ b/gmp/mpn/sparc64/gmp-mparam.h
@@ -1,139 +1,80 @@
/* Sparc64 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004, 2006, 2008-2010 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 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
-
-/* 500 MHz ultrasparc2 running GNU/Linux */
-
-#define DIVREM_1_NORM_THRESHOLD 3
-#define DIVREM_1_UNNORM_THRESHOLD 4
-#define MOD_1_NORM_THRESHOLD 3
-#define MOD_1_UNNORM_THRESHOLD 3
-#define MOD_1N_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 22
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 27
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-#define USE_PREINV_DIVREM_1 1
-#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_TOOM33_THRESHOLD 187
-#define MUL_TOOM44_THRESHOLD 278
-#define MUL_TOOM6H_THRESHOLD 278
-#define MUL_TOOM8H_THRESHOLD 357
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 201
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 199
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 154
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 107
-
-#define SQR_BASECASE_THRESHOLD 13
-#define SQR_TOOM2_THRESHOLD 69
-#define SQR_TOOM3_THRESHOLD 116
-#define SQR_TOOM4_THRESHOLD 336
-#define SQR_TOOM6_THRESHOLD 336
-#define SQR_TOOM8_THRESHOLD 454
-
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 23
-
-#define MUL_FFT_MODF_THRESHOLD 248 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 248, 5}, { 9, 4}, { 19, 6}, { 5, 5}, \
- { 15, 6}, { 8, 5}, { 17, 6}, { 21, 7}, \
- { 19, 8}, { 11, 7}, { 25, 8}, { 15, 7}, \
- { 31, 8}, { 27, 9}, { 15, 8}, { 33, 9}, \
- { 19, 8}, { 39, 9}, { 27,10}, { 15, 9}, \
- { 39,10}, { 23, 9}, { 47,11}, { 15,10}, \
- { 31, 9}, { 67,10}, { 39, 9}, { 79,10}, \
- { 47,11}, { 31,10}, { 63, 9}, { 127, 8}, \
- { 255,10}, { 71, 9}, { 143, 8}, { 287,10}, \
- { 79,11}, { 47,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 50
-#define MUL_FFT_THRESHOLD 1984
-
-#define SQR_FFT_MODF_THRESHOLD 236 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 236, 5}, { 8, 4}, { 17, 5}, { 19, 6}, \
- { 10, 5}, { 21, 6}, { 19, 7}, { 10, 6}, \
- { 21, 7}, { 21, 8}, { 21, 9}, { 11, 8}, \
- { 23, 9}, { 19, 8}, { 43, 9}, { 23,10}, \
- { 15, 9}, { 43,10}, { 23,11}, { 15,10}, \
- { 31, 9}, { 63,10}, { 47, 8}, { 191,11}, \
- { 31,10}, { 63, 8}, { 255, 7}, { 511, 9}, \
- { 135, 8}, { 271,10}, { 71, 9}, { 143, 8}, \
- { 287, 7}, { 575,11}, { 47, 9}, { 191, 8}, \
- { 383,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 SQR_FFT_TABLE3_SIZE 49
-#define SQR_FFT_THRESHOLD 1120
-
-#define MULLO_BASECASE_THRESHOLD 16
-#define MULLO_DC_THRESHOLD 41
-#define MULLO_MUL_N_THRESHOLD 3791
-
-#define DC_DIV_QR_THRESHOLD 27
-#define DC_DIVAPPR_Q_THRESHOLD 100
-#define DC_BDIV_QR_THRESHOLD 47
-#define DC_BDIV_Q_THRESHOLD 174
-
-#define INV_MULMOD_BNM1_THRESHOLD 58
-#define INV_NEWTON_THRESHOLD 13
-#define INV_APPR_THRESHOLD 9
-
-#define BINV_NEWTON_THRESHOLD 187
-#define REDC_1_TO_REDC_2_THRESHOLD 10
-#define REDC_2_TO_REDC_N_THRESHOLD 115
-
-#define MU_DIV_QR_THRESHOLD 680
-#define MU_DIVAPPR_Q_THRESHOLD 618
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#define MU_BDIV_QR_THRESHOLD 748
-#define MU_BDIV_Q_THRESHOLD 889
-
-#define MATRIX22_STRASSEN_THRESHOLD 13
-#define HGCD_THRESHOLD 53
-#define GCD_DC_THRESHOLD 283
-#define GCDEXT_DC_THRESHOLD 186
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 16
-#define SET_STR_DC_THRESHOLD 390
-#define SET_STR_PRECOMPUTE_THRESHOLD 1665
+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 BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
+
+/* Tell the toom3 multiply implementation to call low-level mpn
+ functions instead of open-coding operations in C. */
+#ifndef USE_MORE_MPN
+#define USE_MORE_MPN 1
+#endif
+
+/* Generated by tuneup.c, 2009-01-15, gcc 3.4 */
+
+#define MUL_KARATSUBA_THRESHOLD 33
+#define MUL_TOOM3_THRESHOLD 189
+#define MUL_TOOM44_THRESHOLD 256
+
+#define SQR_BASECASE_THRESHOLD 9
+#define SQR_KARATSUBA_THRESHOLD 70
+#define SQR_TOOM3_THRESHOLD 226
+#define SQR_TOOM4_THRESHOLD 345
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 46
+#define MULLOW_MUL_N_THRESHOLD 143
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 34
+#define POWM_THRESHOLD 116
+
+#define MATRIX22_STRASSEN_THRESHOLD 18
+#define HGCD_THRESHOLD 51
+#define GCD_DC_THRESHOLD 293
+#define GCDEXT_DC_THRESHOLD 198
+#define JACOBI_BASE_METHOD 3
+
+#define DIVREM_1_NORM_THRESHOLD 3
+#define DIVREM_1_UNNORM_THRESHOLD 3
+#define MOD_1_NORM_THRESHOLD 3
+#define MOD_1_UNNORM_THRESHOLD 3
+#define MOD_1_1_THRESHOLD 12
+#define MOD_1_2_THRESHOLD 13
+#define MOD_1_4_THRESHOLD 16
+#define USE_PREINV_DIVREM_1 1
+#define USE_PREINV_MOD_1 1
+#define DIVREM_2_THRESHOLD 6
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 13
+#define GET_STR_PRECOMPUTE_THRESHOLD 21
+#define SET_STR_DC_THRESHOLD 638
+#define SET_STR_PRECOMPUTE_THRESHOLD 1889
+
+#define MUL_FFT_TABLE { 304, 608, 1600, 2816, 7168, 20480, 81920, 196608, 786432, 0 }
+#define MUL_FFT_MODF_THRESHOLD 216
+#define MUL_FFT_THRESHOLD 1664
+
+#define SQR_FFT_TABLE { 336, 736, 1600, 2816, 7168, 20480, 49152, 196608, 786432, 0 }
+#define SQR_FFT_MODF_THRESHOLD 216
+#define SQR_FFT_THRESHOLD 1312
+
diff --git a/gmp/mpn/sparc64/lshift.asm b/gmp/mpn/sparc64/lshift.asm
index 90bbb454f0..b3bbd9dd99 100644
--- a/gmp/mpn/sparc64/lshift.asm
+++ b/gmp/mpn/sparc64/lshift.asm
@@ -1,140 +1,152 @@
dnl SPARC v9 mpn_lshift
-dnl Contributed to the GNU project by David Miller.
-
-dnl Copyright 2013 Free Software Foundation, Inc.
+dnl Copyright 1996, 2000, 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 UltraSPARC T1: 17.5
-C UltraSPARC T3: 8
-C UltraSPARC T4: 3
+C cycles/limb
+C UltraSPARC 1&2: 2
+C UltraSPARC 3: 3.25
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')
+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
+define(`fmnop',`fmuld %f0,%f0,%f4') dnl A quasi nop running in the FM pipe
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]
-
+ 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
+ sllx u3,cnt,%g3
+ bl,pn %icc,.Lend1234
+ fanop
+
+ subcc n,4,n
+ ldx [up-16],u0
+ ldx [up-24],u1
+ add up,-32,up
+ ldx [up-0],u2
+ ldx [up-8],u3
+ srlx u0,tnc,%g2
+
+ bl,pn %icc,.Lend5678
+ fanop
+
+ 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 %icc,.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 %icc,.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 %icc,.Loop0
+ fanop
+.Lret:
+ stx %g3,[rp-8]
+ mov %i5,%i0
ret
- restore retval, 0, %o0
-EPILOGUE()
+ restore
+EPILOGUE(mpn_lshift)
diff --git a/gmp/mpn/sparc64/lshiftc.asm b/gmp/mpn/sparc64/lshiftc.asm
deleted file mode 100644
index 4a0f0a3e40..0000000000
--- a/gmp/mpn/sparc64/lshiftc.asm
+++ /dev/null
@@ -1,147 +0,0 @@
-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()
diff --git a/gmp/mpn/sparc64/mod_1.c b/gmp/mpn/sparc64/mod_1.c
index f1c51970d9..757ae01b95 100644
--- a/gmp/mpn/sparc64/mod_1.c
+++ b/gmp/mpn/sparc64/mod_1.c
@@ -1,33 +1,22 @@
/* UltraSPARC 64 mpn_mod_1 -- mpn by limb remainder.
-Copyright 1991, 1993, 1994, 1999-2001, 2003, 2010 Free Software Foundation,
+Copyright 1991, 1993, 1994, 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -57,8 +46,8 @@ see https://www.gnu.org/licenses/. */
sizes, but at size==2 it was only about the same speed and at size==3 was
slower. */
-static mp_limb_t
-mpn_mod_1_anynorm (mp_srcptr src_limbptr, mp_size_t size_limbs, mp_limb_t d_limb)
+mp_limb_t
+mpn_mod_1 (mp_srcptr src_limbptr, mp_size_t size_limbs, mp_limb_t d_limb)
{
int norm, norm_rshift;
mp_limb_t src_high_limb;
@@ -186,54 +175,3 @@ mpn_mod_1_anynorm (mp_srcptr src_limbptr, mp_size_t size_limbs, mp_limb_t d_limb
return r >> norm;
}
}
-
-mp_limb_t
-mpn_mod_1 (mp_srcptr ap, mp_size_t n, mp_limb_t b)
-{
- ASSERT (n >= 0);
- ASSERT (b != 0);
-
- /* Should this be handled at all? Rely on callers? Note un==0 is currently
- required by mpz/fdiv_r_ui.c and possibly other places. */
- if (n == 0)
- return 0;
-
- if (UNLIKELY ((b & GMP_NUMB_HIGHBIT) != 0))
- {
- if (BELOW_THRESHOLD (n, MOD_1N_TO_MOD_1_1_THRESHOLD))
- {
- return mpn_mod_1_anynorm (ap, n, b);
- }
- else
- {
- mp_limb_t pre[4];
- mpn_mod_1_1p_cps (pre, b);
- return mpn_mod_1_1p (ap, n, b, pre);
- }
- }
- else
- {
- if (BELOW_THRESHOLD (n, MOD_1U_TO_MOD_1_1_THRESHOLD))
- {
- return mpn_mod_1_anynorm (ap, n, b);
- }
- else if (BELOW_THRESHOLD (n, MOD_1_1_TO_MOD_1_2_THRESHOLD))
- {
- mp_limb_t pre[4];
- mpn_mod_1_1p_cps (pre, b);
- return mpn_mod_1_1p (ap, n, b << pre[1], pre);
- }
- else if (BELOW_THRESHOLD (n, MOD_1_2_TO_MOD_1_4_THRESHOLD) || UNLIKELY (b > GMP_NUMB_MASK / 4))
- {
- mp_limb_t pre[5];
- mpn_mod_1s_2p_cps (pre, b);
- return mpn_mod_1s_2p (ap, n, b << pre[1], pre);
- }
- else
- {
- mp_limb_t pre[7];
- mpn_mod_1s_4p_cps (pre, b);
- return mpn_mod_1s_4p (ap, n, b << pre[1], pre);
- }
- }
-}
diff --git a/gmp/mpn/sparc64/mod_1_4.c b/gmp/mpn/sparc64/mod_1_4.c
deleted file mode 100644
index cc1b9484bc..0000000000
--- a/gmp/mpn/sparc64/mod_1_4.c
+++ /dev/null
@@ -1,236 +0,0 @@
-/* mpn_mod_1s_4p (ap, n, b, cps)
- Divide (ap,,n) by b. Return the single-limb remainder.
- Requires that d < B / 4.
-
- Contributed to the GNU project by Torbjorn Granlund.
- 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-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-#include "mpn/sparc64/sparc64.h"
-
-void
-mpn_mod_1s_4p_cps (mp_limb_t cps[7], mp_limb_t b)
-{
- mp_limb_t bi;
- mp_limb_t B1modb, B2modb, B3modb, B4modb, B5modb;
- int cnt;
-
- ASSERT (b <= (~(mp_limb_t) 0) / 4);
-
- count_leading_zeros (cnt, b);
-
- b <<= cnt;
- invert_limb (bi, b);
-
- 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
- {
- int i;
- b = cps[2];
- for (i = 3; i <= 6; i++)
- {
- b += cps[i];
- ASSERT (b >= cps[i]);
- }
- }
-#endif
-}
-
-mp_limb_t
-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;
- mp_size_t i;
- int cnt;
-
- ASSERT (n >= 1);
-
- B1modb = cps[2];
- B2modb = cps[3];
- B3modb = cps[4];
- B4modb = cps[5];
- B5modb = cps[6];
-
- if ((b >> 32) == 0)
- {
- switch (n & 3)
- {
- case 0:
- umul_ppmm_s (ph, pl, ap[n - 3], B1modb);
- 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);
- add_ssaaaa (rh, rl, rh, rl, ph, pl);
- n -= 4;
- break;
- case 1:
- rh = 0;
- rl = ap[n - 1];
- n -= 1;
- break;
- case 2:
- rh = ap[n - 1];
- rl = ap[n - 2];
- n -= 2;
- break;
- case 3:
- umul_ppmm_s (ph, pl, ap[n - 2], B1modb);
- 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;
- break;
- }
-
- for (i = n - 4; i >= 0; i -= 4)
- {
- /* rr = ap[i] < B
- + ap[i+1] * (B mod b) <= (B-1)(b-1)
- + ap[i+2] * (B^2 mod b) <= (B-1)(b-1)
- + ap[i+3] * (B^3 mod b) <= (B-1)(b-1)
- + LO(rr) * (B^4 mod b) <= (B-1)(b-1)
- + 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, CNST_LIMB(0), ap[i + 0]);
-
- umul_ppmm_s (ch, cl, ap[i + 2], B2modb);
- add_ssaaaa (ph, pl, ph, pl, ch, cl);
-
- umul_ppmm_s (ch, cl, ap[i + 3], B3modb);
- add_ssaaaa (ph, pl, ph, pl, ch, cl);
-
- umul_ppmm_s (ch, cl, rl, B4modb);
- add_ssaaaa (ph, pl, ph, pl, ch, cl);
-
- umul_ppmm_s (rh, rl, rh, B5modb);
- add_ssaaaa (rh, rl, rh, rl, ph, pl);
- }
-
- umul_ppmm_s (rh, cl, rh, B1modb);
- add_ssaaaa (rh, rl, rh, rl, CNST_LIMB(0), cl);
- }
- else
- {
- switch (n & 3)
- {
- case 0:
- umul_ppmm (ph, pl, ap[n - 3], B1modb);
- add_ssaaaa (ph, pl, ph, pl, 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);
- add_ssaaaa (rh, rl, rh, rl, ph, pl);
- n -= 4;
- break;
- case 1:
- rh = 0;
- rl = ap[n - 1];
- n -= 1;
- break;
- case 2:
- rh = ap[n - 1];
- rl = ap[n - 2];
- n -= 2;
- break;
- case 3:
- umul_ppmm (ph, pl, ap[n - 2], B1modb);
- add_ssaaaa (ph, pl, ph, pl, 0, ap[n - 3]);
- umul_ppmm (rh, rl, ap[n - 1], B2modb);
- add_ssaaaa (rh, rl, rh, rl, ph, pl);
- n -= 3;
- break;
- }
-
- for (i = n - 4; i >= 0; i -= 4)
- {
- /* rr = ap[i] < B
- + ap[i+1] * (B mod b) <= (B-1)(b-1)
- + ap[i+2] * (B^2 mod b) <= (B-1)(b-1)
- + ap[i+3] * (B^3 mod b) <= (B-1)(b-1)
- + LO(rr) * (B^4 mod b) <= (B-1)(b-1)
- + 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]);
-
- umul_ppmm (ch, cl, ap[i + 2], B2modb);
- add_ssaaaa (ph, pl, ph, pl, ch, cl);
-
- umul_ppmm (ch, cl, ap[i + 3], B3modb);
- add_ssaaaa (ph, pl, ph, pl, ch, cl);
-
- umul_ppmm (ch, cl, rl, B4modb);
- add_ssaaaa (ph, pl, ph, pl, ch, cl);
-
- umul_ppmm (rh, rl, rh, B5modb);
- add_ssaaaa (rh, rl, rh, rl, ph, pl);
- }
-
- umul_ppmm (rh, cl, rh, B1modb);
- add_ssaaaa (rh, rl, rh, rl, 0, cl);
- }
-
- bi = cps[0];
- cnt = cps[1];
-
- r = (rh << cnt) | (rl >> (GMP_LIMB_BITS - cnt));
- udiv_rnnd_preinv (r, r, rl << cnt, b, bi);
-
- return r >> cnt;
-}
diff --git a/gmp/mpn/sparc64/mode1o.c b/gmp/mpn/sparc64/mode1o.c
index 7c8fc1cf3d..5ec97c5cd4 100644
--- a/gmp/mpn/sparc64/mode1o.c
+++ b/gmp/mpn/sparc64/mode1o.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2000-2003 Free Software Foundation, Inc.
+Copyright 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpn/sparc64/ultrasparc1234/mul_1.asm b/gmp/mpn/sparc64/mul_1.asm
index 871d562fcb..e57e822bae 100644
--- a/gmp/mpn/sparc64/ultrasparc1234/mul_1.asm
+++ b/gmp/mpn/sparc64/mul_1.asm
@@ -1,33 +1,22 @@
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-2003 Free Software Foundation, Inc.
+dnl Copyright 1998, 2000, 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -147,7 +136,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
fmuld u32, v00, r32
fmuld u00, v48, p48
addcc %i2, 8, %i2
- bnz,pt %xcc, .L_two_or_more
+ bnz,pt %icc, .L_two_or_more
fmuld u32, v16, r48
.L_one:
@@ -222,7 +211,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
faddd p16, r80, a16
fmuld u00, v48, p48
addcc %i2, 8, %i2
- bnz,pt %xcc, .L_three_or_more
+ bnz,pt %icc, .L_three_or_more
fmuld u32, v16, r48
.L_two:
@@ -299,7 +288,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
faddd p16, r80, a16
fmuld u00, v48, p48
addcc %i2, 8, %i2
- bnz,pt %xcc, .L_four_or_more
+ bnz,pt %icc, .L_four_or_more
fmuld u32, v16, r48
.L_three:
@@ -381,7 +370,7 @@ C The software pipeline is very deep, requiring 4 feed-in stages.
fmuld u00, v48, p48
add cy, %g5, %o4 C x = prev(i00) + cy
addcc %i2, 8, %i2
- bnz,pt %xcc, .Loop
+ bnz,pt %icc, .Loop
fmuld u32, v16, r48
.L_four:
@@ -455,7 +444,7 @@ C 12
C 13
add cy, %g5, %o4 C x = prev(i00) + cy
addcc %i2, 8, %i2
- bnz,pt %xcc, .Loop
+ bnz,pt %icc, .Loop
fmuld u32, v16, r48
C END MAIN LOOP
diff --git a/gmp/mpn/sparc64/rshift.asm b/gmp/mpn/sparc64/rshift.asm
index 3f8e11fee7..691fe012d3 100644
--- a/gmp/mpn/sparc64/rshift.asm
+++ b/gmp/mpn/sparc64/rshift.asm
@@ -1,142 +1,149 @@
dnl SPARC v9 mpn_rshift
-dnl Contributed to the GNU project by David Miller.
-
-dnl Copyright 2013 Free Software Foundation, Inc.
+dnl Copyright 1996, 2000, 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 UltraSPARC T1: 17.5
-C UltraSPARC T3: 8
-C UltraSPARC T4: 3
+C cycles/limb
+C UltraSPARC 1&2: 2
+C UltraSPARC 3: 3.25
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')
+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
+define(`fmnop',`fmuld %f0,%f0,%f4') dnl A quasi nop running in the FM pipe
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]
-
+ 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
+ srlx u3,cnt,%g3
+ bl,pn %icc,.Lend1234
+ fanop
+
+ subcc n,4,n
+ ldx [up+8],u0
+ ldx [up+16],u1
+ add up,32,up
+ ldx [up-8],u2
+ ldx [up+0],u3
+ sllx u0,tnc,%g2
+
+ bl,pn %icc,.Lend5678
+ fanop
+
+ 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 %icc,.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 %icc,.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 %icc,.Loop0
+ fanop
+.Lret:
+ stx %g3,[rp+0]
+ mov %i5,%i0
ret
- restore retval, 0, %o0
-EPILOGUE()
+ restore
+EPILOGUE(mpn_rshift)
diff --git a/gmp/mpn/sparc64/sec_tabselect.asm b/gmp/mpn/sparc64/sec_tabselect.asm
deleted file mode 100644
index 22e0dc5ef1..0000000000
--- a/gmp/mpn/sparc64/sec_tabselect.asm
+++ /dev/null
@@ -1,162 +0,0 @@
-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()
diff --git a/gmp/mpn/sparc64/sparc64.h b/gmp/mpn/sparc64/sparc64.h
index 09fc16d46a..945e422f5a 100644
--- a/gmp/mpn/sparc64/sparc64.h
+++ b/gmp/mpn/sparc64/sparc64.h
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 LOW32(x) ((x) & 0xFFFFFFFF)
@@ -140,24 +129,6 @@ Error, error, unknown limb endianness;
#endif
-/* Multiply u anv v, where v < 2^32. */
-#define umul_ppmm_s(w1, w0, u, v) \
- do { \
- UWtype __x0, __x2; \
- UWtype __ul, __vl, __uh; \
- UWtype __u = (u), __v = (v); \
- \
- __ul = __ll_lowpart (__u); \
- __uh = __ll_highpart (__u); \
- __vl = __ll_lowpart (__v); \
- \
- __x0 = (UWtype) __ul * __vl; \
- __x2 = (UWtype) __uh * __vl; \
- \
- (w1) = (__x2 + (__x0 >> W_TYPE_SIZE/2)) >> W_TYPE_SIZE/2; \
- (w0) = (__x2 << W_TYPE_SIZE/2) + __x0; \
- } while (0)
-
/* Count the leading zeros on a limb, but assuming it fits in 32 bits.
The count returned will be in the range 32 to 63.
This is the 32-bit generic C count_leading_zeros from longlong.h. */
diff --git a/gmp/mpn/sparc64/ultrasparc1234/sqr_diagonal.asm b/gmp/mpn/sparc64/sqr_diagonal.asm
index 43c69d31d1..fbbb4ff456 100644
--- a/gmp/mpn/sparc64/ultrasparc1234/sqr_diagonal.asm
+++ b/gmp/mpn/sparc64/sqr_diagonal.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc64/ultrasparc1234/sub_n.asm b/gmp/mpn/sparc64/sub_n.asm
index 9fb7f70747..e6fe9ee62c 100644
--- a/gmp/mpn/sparc64/ultrasparc1234/sub_n.asm
+++ b/gmp/mpn/sparc64/sub_n.asm
@@ -1,33 +1,22 @@
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-2003, 2011 Free Software Foundation, Inc.
+dnl Copyright 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -65,24 +54,14 @@ define(`fmnop',`fmuld %f0,%f0,%f4') dnl A quasi nop running in the FM pipe
ASM_START()
REGISTER(%g2,#scratch)
REGISTER(%g3,#scratch)
-PROLOGUE(mpn_sub_nc)
- save %sp,-160,%sp
-
- fitod %f0,%f0 C make sure f0 contains small, quiet number
- subcc n,4,%g0
- bl,pn %xcc,.Loop0
- nop
- b,a L(com)
-EPILOGUE()
-
PROLOGUE(mpn_sub_n)
save %sp,-160,%sp
fitod %f0,%f0 C make sure f0 contains small, quiet number
subcc n,4,%g0
- bl,pn %xcc,.Loop0
+ bl,pn %icc,.Loop0
mov 0,cy
-L(com):
+
ldx [up+0],u0
ldx [vp+0],v0
add up,32,up
@@ -95,15 +74,15 @@ L(com):
ldx [vp-8],v3
subcc n,8,n
sub u0,v0,%g1 C main sub
- sub %g1,cy,%g5 C carry sub
+ sub %g1,cy,%g4 C carry sub
orn u0,v0,%g2
- bl,pn %xcc,.Lend4567
+ bl,pn %icc,.Lend4567
fanop
b,a .Loop
.align 16
C START MAIN LOOP
-.Loop: orn %g5,%g2,%g2
+.Loop: orn %g4,%g2,%g2
andn u0,v0,%g3
ldx [up+0],u0
fanop
@@ -115,15 +94,15 @@ C --
C --
srlx %g2,63,cy
sub u1,v1,%g1
- stx %g5,[rp+0]
+ stx %g4,[rp+0]
fanop
C --
- sub %g1,cy,%g5
+ sub %g1,cy,%g4
orn u1,v1,%g2
fmnop
fanop
C --
- orn %g5,%g2,%g2
+ orn %g4,%g2,%g2
andn u1,v1,%g3
ldx [up-24],u1
fanop
@@ -135,15 +114,15 @@ C --
C --
srlx %g2,63,cy
sub u2,v2,%g1
- stx %g5,[rp+8]
+ stx %g4,[rp+8]
fanop
C --
- sub %g1,cy,%g5
+ sub %g1,cy,%g4
orn u2,v2,%g2
fmnop
fanop
C --
- orn %g5,%g2,%g2
+ orn %g4,%g2,%g2
andn u2,v2,%g3
ldx [up-16],u2
fanop
@@ -155,15 +134,15 @@ C --
C --
srlx %g2,63,cy
sub u3,v3,%g1
- stx %g5,[rp-16]
+ stx %g4,[rp-16]
fanop
C --
- sub %g1,cy,%g5
+ sub %g1,cy,%g4
orn u3,v3,%g2
fmnop
fanop
C --
- orn %g5,%g2,%g2
+ orn %g4,%g2,%g2
andn u3,v3,%g3
ldx [up-8],u3
fanop
@@ -175,48 +154,48 @@ C --
C --
srlx %g2,63,cy
sub u0,v0,%g1
- stx %g5,[rp-8]
+ stx %g4,[rp-8]
fanop
C --
- sub %g1,cy,%g5
+ sub %g1,cy,%g4
orn u0,v0,%g2
- bge,pt %xcc,.Loop
+ bge,pt %icc,.Loop
fanop
C END MAIN LOOP
.Lend4567:
- orn %g5,%g2,%g2
+ orn %g4,%g2,%g2
andn u0,v0,%g3
andn %g2,%g3,%g2
srlx %g2,63,cy
sub u1,v1,%g1
- stx %g5,[rp+0]
- sub %g1,cy,%g5
+ stx %g4,[rp+0]
+ sub %g1,cy,%g4
orn u1,v1,%g2
- orn %g5,%g2,%g2
+ orn %g4,%g2,%g2
andn u1,v1,%g3
andn %g2,%g3,%g2
srlx %g2,63,cy
sub u2,v2,%g1
- stx %g5,[rp+8]
- sub %g1,cy,%g5
+ stx %g4,[rp+8]
+ sub %g1,cy,%g4
orn u2,v2,%g2
- orn %g5,%g2,%g2
+ orn %g4,%g2,%g2
andn u2,v2,%g3
andn %g2,%g3,%g2
add rp,32,rp
srlx %g2,63,cy
sub u3,v3,%g1
- stx %g5,[rp-16]
- sub %g1,cy,%g5
+ stx %g4,[rp-16]
+ sub %g1,cy,%g4
orn u3,v3,%g2
- orn %g5,%g2,%g2
+ orn %g4,%g2,%g2
andn u3,v3,%g3
andn %g2,%g3,%g2
srlx %g2,63,cy
- stx %g5,[rp-8]
+ stx %g4,[rp-8]
addcc n,4,n
- bz,pn %xcc,.Lret
+ bz,pn %icc,.Lret
fanop
.Loop0: ldx [up],u0
@@ -227,12 +206,12 @@ C END MAIN LOOP
subcc n,1,n
sub u0,v0,%g1
orn u0,v0,%g2
- sub %g1,cy,%g5
+ sub %g1,cy,%g4
andn u0,v0,%g3
- orn %g5,%g2,%g2
- stx %g5,[rp-8]
+ orn %g4,%g2,%g2
+ stx %g4,[rp-8]
andn %g2,%g3,%g2
- bnz,pt %xcc,.Loop0
+ bnz,pt %icc,.Loop0
srlx %g2,63,cy
.Lret: mov cy,%i0
diff --git a/gmp/mpn/sparc64/ultrasparc1234/submul_1.asm b/gmp/mpn/sparc64/submul_1.asm
index 0bdb566b9f..ba91200315 100644
--- a/gmp/mpn/sparc64/ultrasparc1234/submul_1.asm
+++ b/gmp/mpn/sparc64/submul_1.asm
@@ -1,33 +1,22 @@
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-2003 Free Software Foundation, Inc.
+dnl Copyright 2001, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
diff --git a/gmp/mpn/sparc64/ultrasparc1234/lshiftc.asm b/gmp/mpn/sparc64/ultrasparc1234/lshiftc.asm
deleted file mode 100644
index 47286d569e..0000000000
--- a/gmp/mpn/sparc64/ultrasparc1234/lshiftc.asm
+++ /dev/null
@@ -1,165 +0,0 @@
-dnl SPARC v9 mpn_lshiftc
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 2.67
-
-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_lshiftc)
- 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
- srlx u0,tnc,%g2
- bl,pn %xcc,.Lend5678
- not %g3, %g3
-
- b,a .Loop
- ALIGN(16)
-.Loop:
- sllx u0,cnt,%g1
- andn %g3,%g2,%g3
- ldx [up-16],u0
- fanop
-C --
- srlx u1,tnc,%g2
- subcc n,4,n
- stx %g3,[rp-8]
- not %g1, %g1
-C --
- sllx u1,cnt,%g3
- andn %g1,%g2,%g1
- ldx [up-24],u1
- fanop
-C --
- srlx u2,tnc,%g2
- stx %g1,[rp-16]
- add up,-32,up
- not %g3, %g3
-C --
- sllx u2,cnt,%g1
- andn %g3,%g2,%g3
- ldx [up-0],u2
- fanop
-C --
- srlx u3,tnc,%g2
- stx %g3,[rp-24]
- add rp,-32,rp
- not %g1, %g1
-C --
- sllx u3,cnt,%g3
- andn %g1,%g2,%g1
- ldx [up-8],u3
- fanop
-C --
- srlx u0,tnc,%g2
- stx %g1,[rp-0]
- bge,pt %xcc,.Loop
- not %g3, %g3
-C --
-.Lend5678:
- sllx u0,cnt,%g1
- andn %g3,%g2,%g3
- srlx u1,tnc,%g2
- stx %g3,[rp-8]
- not %g1, %g1
- sllx u1,cnt,%g3
- andn %g1,%g2,%g1
- srlx u2,tnc,%g2
- stx %g1,[rp-16]
- not %g3, %g3
- sllx u2,cnt,%g1
- andn %g3,%g2,%g3
- srlx u3,tnc,%g2
- stx %g3,[rp-24]
- add rp,-32,rp
- not %g1, %g1
- sllx u3,cnt,%g3 C carry...
- andn %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
- not %g3, %g3
- andn %g3,%g2,%g3
- stx %g3,[rp]
- sllx u3,cnt,%g3
- bnz,pt %xcc,.Loop0
- fanop
-.Lret:
- not %g3, %g3
- stx %g3,[rp-8]
- mov %i5,%i0
- ret
- restore
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparc34/gmp-mparam.h b/gmp/mpn/sparc64/ultrasparc34/gmp-mparam.h
deleted file mode 100644
index 0c525bbdcf..0000000000
--- a/gmp/mpn/sparc64/ultrasparc34/gmp-mparam.h
+++ /dev/null
@@ -1,219 +0,0 @@
-/* ultrasparc3/4 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 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 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 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 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 93
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 104
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 85
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 51
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 67
-
-#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 15
-#define SQRMOD_BNM1_THRESHOLD 9
-
-#define MUL_FFT_MODF_THRESHOLD 220 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, { 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, 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,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}, { 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}, { 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}, { 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, 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 19
-#define MULLO_DC_THRESHOLD 0 /* never mpn_mullo_basecase */
-#define MULLO_MUL_N_THRESHOLD 4392
-
-#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 54
-#define INV_NEWTON_THRESHOLD 17
-#define INV_APPR_THRESHOLD 17
-
-#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 680
-#define MU_DIVAPPR_Q_THRESHOLD 618
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#define MU_BDIV_QR_THRESHOLD 680
-#define MU_BDIV_Q_THRESHOLD 807
-
-#define POWM_SEC_TABLE 1,16,102,386,1985,2079
-
-#define MATRIX22_STRASSEN_THRESHOLD 12
-#define HGCD_THRESHOLD 46
-#define HGCD_APPR_THRESHOLD 50
-#define HGCD_REDUCE_THRESHOLD 1012
-#define GCD_DC_THRESHOLD 124
-#define GCDEXT_DC_THRESHOLD 138
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 20
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 324
-#define SET_STR_PRECOMPUTE_THRESHOLD 1043
-
-#define FAC_DSC_THRESHOLD 422
-#define FAC_ODD_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/sparc64/ultrasparct1/add_n.asm b/gmp/mpn/sparc64/ultrasparct1/add_n.asm
deleted file mode 100644
index 954c7f6d35..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/add_n.asm
+++ /dev/null
@@ -1,68 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 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_add_nc)
- b,a L(ent)
-EPILOGUE()
-PROLOGUE(mpn_add_n)
- mov 0, cy
-L(ent): cmp %g0, cy
-L(top): ldx [up+0], %o4
- add up, 8, up
- ldx [vp+0], %o5
- add vp, 8, vp
- add rp, 8, rp
- add n, -1, n
- srlx %o4, 32, %g1
- srlx %o5, 32, %g2
- addccc %o4, %o5, %g3
- addccc %g1, %g2, %g0
- brgz n, L(top)
- stx %g3, [rp-8]
-
- retl
- addc %g0, %g0, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct1/addlsh1_n.asm b/gmp/mpn/sparc64/ultrasparct1/addlsh1_n.asm
deleted file mode 100644
index 313479773f..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/addlsh1_n.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-
-define(func, mpn_addlsh1_n)
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n)
-
-include_mpn(`sparc64/ultrasparct1/addlshC_n.asm')
diff --git a/gmp/mpn/sparc64/ultrasparct1/addlsh2_n.asm b/gmp/mpn/sparc64/ultrasparct1/addlsh2_n.asm
deleted file mode 100644
index ee1afd0116..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/addlsh2_n.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-
-define(func, mpn_addlsh2_n)
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n)
-
-include_mpn(`sparc64/ultrasparct1/addlshC_n.asm')
diff --git a/gmp/mpn/sparc64/ultrasparct1/addlshC_n.asm b/gmp/mpn/sparc64/ultrasparct1/addlshC_n.asm
deleted file mode 100644
index 5be9a0d30a..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/addlshC_n.asm
+++ /dev/null
@@ -1,69 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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
-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(func)
- mov 0, cy
- mov 0, %g5
- cmp %g0, cy
-L(top): ldx [up+0], %o4
- add up, 8, up
- ldx [vp+0], %o5
- add vp, 8, vp
- add rp, 8, rp
-
- sllx %o5, LSH, %g4
- add n, -1, n
- or %g5, %g4, %g4
- srlx %o5, RSH, %g5
-
- srlx %o4, 32, %g1
- srlx %g4, 32, %g2
- addccc %o4, %g4, %g3
- addccc %g1, %g2, %g0
- brgz n, L(top)
- stx %g3, [rp-8]
-
- retl
- addc %g5, %g0, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct1/addmul_1.asm b/gmp/mpn/sparc64/ultrasparct1/addmul_1.asm
deleted file mode 100644
index 29dba966f3..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/addmul_1.asm
+++ /dev/null
@@ -1,86 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 74
-C UltraSPARC T2: ?
-
-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_addmul_1)
- save %sp, -176, %sp
- mov 1, %o2
- mov %i0, %g2
- srlx %i3, 32, %o4
- sllx %o2, 32, %o2
- srl %i3, 0, %i3
- mov 0, %g3
- mov 0, %i0
-
-L(top): ldx [%i1+%g3], %g1
- srl %g1, 0, %g4
- mulx %g4, %i3, %o5
- srlx %g1, 32, %g1
- mulx %g1, %i3, %g5
- mulx %g4, %o4, %g4
- mulx %g1, %o4, %g1
- srlx %o5, 32, %o1
- add %g5, %o1, %o1
- addcc %o1, %g4, %g4
- srl %o5, 0, %o0
- ldx [%g2+%g3], %o5
- sllx %g4, 32, %o1
- add %g1, %o2, %l1
- movlu %xcc, %l1, %g1
- add %o1, %o0, %l0
- addcc %l0, %i0, %g5
- srlx %g4, 32, %i0
- add %i0, 1, %g4
- movlu %xcc, %g4, %i0
- addcc %o5, %g5, %g5
- stx %g5, [%g2+%g3]
- add %i0, 1, %g4
- movlu %xcc, %g4, %i0
- add %i2, -1, %i2
- add %i0, %g1, %i0
- brnz,pt %i2, L(top)
- add %g3, 8, %g3
- return %i7+8
- nop
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct1/gmp-mparam.h b/gmp/mpn/sparc64/ultrasparct1/gmp-mparam.h
deleted file mode 100644
index 99db78ac0f..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/gmp-mparam.h
+++ /dev/null
@@ -1,154 +0,0 @@
-/* Sparc64 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 1000 MHz ultrasparc t1 running GNU/Linux */
-
-#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 13
-#define MOD_1U_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 34
-#define USE_PREINV_DIVREM_1 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 8
-#define MUL_TOOM33_THRESHOLD 50
-#define MUL_TOOM44_THRESHOLD 99
-#define MUL_TOOM6H_THRESHOLD 125
-#define MUL_TOOM8H_THRESHOLD 187
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 65
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 77
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 65
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 50
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 34
-
-#define SQR_BASECASE_THRESHOLD 0 /* always */
-#define SQR_TOOM2_THRESHOLD 14
-#define SQR_TOOM3_THRESHOLD 57
-#define SQR_TOOM4_THRESHOLD 133
-#define SQR_TOOM6_THRESHOLD 156
-#define SQR_TOOM8_THRESHOLD 260
-
-#define MULMID_TOOM42_THRESHOLD 12
-
-#define MULMOD_BNM1_THRESHOLD 7
-#define SQRMOD_BNM1_THRESHOLD 7
-
-#define MUL_FFT_MODF_THRESHOLD 176 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 176, 5}, { 7, 6}, { 4, 5}, { 9, 6}, \
- { 5, 5}, { 11, 6}, { 11, 7}, { 6, 6}, \
- { 13, 7}, { 7, 6}, { 15, 7}, { 9, 8}, \
- { 5, 7}, { 13, 8}, { 7, 7}, { 15, 6}, \
- { 32, 7}, { 24, 8}, { 21, 9}, { 11, 8}, \
- { 23,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
- { 19, 8}, { 39, 9}, { 23,10}, { 15, 9}, \
- { 43,10}, { 23,11}, { 15,10}, { 31, 9}, \
- { 63, 8}, { 127, 9}, { 67,10}, { 39, 9}, \
- { 79, 8}, { 159,10}, { 47, 9}, { 95,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 53
-#define MUL_FFT_THRESHOLD 1728
-
-
-#define SQR_FFT_MODF_THRESHOLD 148 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 148, 5}, { 7, 6}, { 4, 5}, { 9, 6}, \
- { 5, 5}, { 11, 6}, { 11, 7}, { 6, 6}, \
- { 13, 7}, { 7, 6}, { 15, 7}, { 13, 8}, \
- { 7, 7}, { 16, 8}, { 9, 6}, { 38, 7}, \
- { 20, 8}, { 11, 7}, { 24, 8}, { 13, 9}, \
- { 7, 7}, { 30, 8}, { 19, 9}, { 11, 8}, \
- { 25,10}, { 7, 9}, { 15, 8}, { 31, 9}, \
- { 19, 8}, { 39, 9}, { 27,10}, { 15, 9}, \
- { 39,10}, { 23, 9}, { 47, 8}, { 95, 9}, \
- { 51,11}, { 15,10}, { 31, 8}, { 127,10}, \
- { 39, 9}, { 79, 8}, { 159,10}, { 47, 9}, \
- { 95,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 SQR_FFT_TABLE3_SIZE 58
-#define SQR_FFT_THRESHOLD 1344
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 28
-#define MULLO_MUL_N_THRESHOLD 3176
-
-#define DC_DIV_QR_THRESHOLD 27
-#define DC_DIVAPPR_Q_THRESHOLD 106
-#define DC_BDIV_QR_THRESHOLD 27
-#define DC_BDIV_Q_THRESHOLD 62
-
-#define INV_MULMOD_BNM1_THRESHOLD 14
-#define INV_NEWTON_THRESHOLD 163
-#define INV_APPR_THRESHOLD 117
-
-#define BINV_NEWTON_THRESHOLD 166
-#define REDC_1_TO_REDC_N_THRESHOLD 31
-
-#define MU_DIV_QR_THRESHOLD 734
-#define MU_DIVAPPR_Q_THRESHOLD 748
-#define MUPI_DIV_QR_THRESHOLD 67
-#define MU_BDIV_QR_THRESHOLD 562
-#define MU_BDIV_Q_THRESHOLD 734
-
-#define POWM_SEC_TABLE 4,29,188,643,2741
-
-#define MATRIX22_STRASSEN_THRESHOLD 11
-#define HGCD_THRESHOLD 58
-#define HGCD_APPR_THRESHOLD 55
-#define HGCD_REDUCE_THRESHOLD 637
-#define GCD_DC_THRESHOLD 186
-#define GCDEXT_DC_THRESHOLD 140
-#define JACOBI_BASE_METHOD 3
-
-#define GET_STR_DC_THRESHOLD 20
-#define GET_STR_PRECOMPUTE_THRESHOLD 33
-#define SET_STR_DC_THRESHOLD 268
-#define SET_STR_PRECOMPUTE_THRESHOLD 960
-
-#define FAC_DSC_THRESHOLD 268
-#define FAC_ODD_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/sparc64/ultrasparct1/mul_1.asm b/gmp/mpn/sparc64/ultrasparct1/mul_1.asm
deleted file mode 100644
index 1fea2a19ef..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/mul_1.asm
+++ /dev/null
@@ -1,82 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 68
-C UltraSPARC T2: ?
-
-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
- mov 1, %o2
- mov %i0, %g2
- srlx %i3, 32, %o4
- sllx %o2, 32, %o2
- srl %i3, 0, %i3
- mov 0, %g3
- mov 0, %i0
-
-L(top): ldx [%i1+%g3], %g1
- srl %g1, 0, %g4
- mulx %g4, %i3, %o5
- srlx %g1, 32, %g1
- mulx %g1, %i3, %g5
- mulx %g4, %o4, %g4
- mulx %g1, %o4, %g1
- srlx %o5, 32, %o1
- add %g5, %o1, %o1
- addcc %o1, %g4, %g4
- srl %o5, 0, %o0
- sllx %g4, 32, %o1
- add %g1, %o2, %l1
- movlu %xcc, %l1, %g1
- add %o1, %o0, %l0
- addcc %l0, %i0, %g5
- srlx %g4, 32, %i0
- add %i0, 1, %g4
- movlu %xcc, %g4, %i0
- stx %g5, [%g2+%g3]
- add %i2, -1, %i2
- add %i0, %g1, %i0
- brnz,pt %i2, L(top)
- add %g3, 8, %g3
- return %i7+8
- nop
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct1/rsblsh1_n.asm b/gmp/mpn/sparc64/ultrasparct1/rsblsh1_n.asm
deleted file mode 100644
index 51bd4ab45b..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/rsblsh1_n.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-
-define(func, mpn_rsblsh1_n)
-
-MULFUNC_PROLOGUE(mpn_rsblsh1_n)
-
-include_mpn(`sparc64/ultrasparct1/rsblshC_n.asm')
diff --git a/gmp/mpn/sparc64/ultrasparct1/rsblsh2_n.asm b/gmp/mpn/sparc64/ultrasparct1/rsblsh2_n.asm
deleted file mode 100644
index f0d208e198..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/rsblsh2_n.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-
-define(func, mpn_rsblsh2_n)
-
-MULFUNC_PROLOGUE(mpn_rsblsh2_n)
-
-include_mpn(`sparc64/ultrasparct1/rsblshC_n.asm')
diff --git a/gmp/mpn/sparc64/ultrasparct1/rsblshC_n.asm b/gmp/mpn/sparc64/ultrasparct1/rsblshC_n.asm
deleted file mode 100644
index 7c03e9f97f..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/rsblshC_n.asm
+++ /dev/null
@@ -1,69 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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
-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(func)
- mov 0, cy
- mov 0, %g5
- cmp %g0, cy
-L(top): ldx [up+0], %o4
- add up, 8, up
- ldx [vp+0], %o5
- add vp, 8, vp
- add rp, 8, rp
-
- sllx %o5, LSH, %g4
- add n, -1, n
- or %g5, %g4, %g4
- srlx %o5, RSH, %g5
-
- srlx %o4, 32, %g1
- srlx %g4, 32, %g2
- subccc %g4, %o4, %g3
- subccc %g2, %g1, %g0
- brgz n, L(top)
- stx %g3, [rp-8]
-
- retl
- subc %g5, %g0, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct1/sub_n.asm b/gmp/mpn/sparc64/ultrasparct1/sub_n.asm
deleted file mode 100644
index c2af89f08f..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/sub_n.asm
+++ /dev/null
@@ -1,68 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 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_sub_nc)
- b,a L(ent)
-EPILOGUE()
-PROLOGUE(mpn_sub_n)
- mov 0, cy
-L(ent): cmp %g0, cy
-L(top): ldx [up+0], %o4
- add up, 8, up
- ldx [vp+0], %o5
- add vp, 8, vp
- add rp, 8, rp
- add n, -1, n
- srlx %o4, 32, %g1
- srlx %o5, 32, %g2
- subccc %o4, %o5, %g3
- subccc %g1, %g2, %g0
- brgz n, L(top)
- stx %g3, [rp-8]
-
- retl
- addc %g0, %g0, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct1/sublsh1_n.asm b/gmp/mpn/sparc64/ultrasparct1/sublsh1_n.asm
deleted file mode 100644
index 8c8fa80401..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/sublsh1_n.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-
-define(func, mpn_sublsh1_n)
-
-MULFUNC_PROLOGUE(mpn_sublsh1_n)
-
-include_mpn(`sparc64/ultrasparct1/sublshC_n.asm')
diff --git a/gmp/mpn/sparc64/ultrasparct1/sublsh2_n.asm b/gmp/mpn/sparc64/ultrasparct1/sublsh2_n.asm
deleted file mode 100644
index 2fd5eee71a..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/sublsh2_n.asm
+++ /dev/null
@@ -1,41 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-
-define(func, mpn_sublsh2_n)
-
-MULFUNC_PROLOGUE(mpn_sublsh2_n)
-
-include_mpn(`sparc64/ultrasparct1/sublshC_n.asm')
diff --git a/gmp/mpn/sparc64/ultrasparct1/sublshC_n.asm b/gmp/mpn/sparc64/ultrasparct1/sublshC_n.asm
deleted file mode 100644
index 01eafef1bc..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/sublshC_n.asm
+++ /dev/null
@@ -1,69 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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
-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(func)
- mov 0, cy
- mov 0, %g5
- cmp %g0, cy
-L(top): ldx [up+0], %o4
- add up, 8, up
- ldx [vp+0], %o5
- add vp, 8, vp
- add rp, 8, rp
-
- sllx %o5, LSH, %g4
- add n, -1, n
- or %g5, %g4, %g4
- srlx %o5, RSH, %g5
-
- srlx %o4, 32, %g1
- srlx %g4, 32, %g2
- subccc %o4, %g4, %g3
- subccc %g1, %g2, %g0
- brgz n, L(top)
- stx %g3, [rp-8]
-
- retl
- addc %g5, %g0, %o0
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct1/submul_1.asm b/gmp/mpn/sparc64/ultrasparct1/submul_1.asm
deleted file mode 100644
index 4f553a8063..0000000000
--- a/gmp/mpn/sparc64/ultrasparct1/submul_1.asm
+++ /dev/null
@@ -1,86 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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: 74
-C UltraSPARC T2: ?
-
-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
- mov 1, %o2
- mov %i0, %g2
- srlx %i3, 32, %o4
- sllx %o2, 32, %o2
- srl %i3, 0, %i3
- mov 0, %g3
- mov 0, %i0
-
-L(top): ldx [%i1+%g3], %g1
- srl %g1, 0, %g4
- mulx %g4, %i3, %o5
- srlx %g1, 32, %g1
- mulx %g1, %i3, %g5
- mulx %g4, %o4, %g4
- mulx %g1, %o4, %g1
- srlx %o5, 32, %o1
- add %g5, %o1, %o1
- addcc %o1, %g4, %g4
- srl %o5, 0, %o0
- ldx [%g2+%g3], %o5
- sllx %g4, 32, %o1
- add %g1, %o2, %l1
- movlu %xcc, %l1, %g1
- add %o1, %o0, %l0
- addcc %l0, %i0, %g5
- srlx %g4, 32, %i0
- add %i0, 1, %g4
- movlu %xcc, %g4, %i0
- subcc %o5, %g5, %g5
- stx %g5, [%g2+%g3]
- add %i0, 1, %g4
- movlu %xcc, %g4, %i0
- add %i2, -1, %i2
- add %i0, %g1, %i0
- brnz,pt %i2, L(top)
- add %g3, 8, %g3
- return %i7+8
- nop
-EPILOGUE()
diff --git a/gmp/mpn/sparc64/ultrasparct3/add_n.asm b/gmp/mpn/sparc64/ultrasparct3/add_n.asm
deleted file mode 100644
index 0170746895..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/add_n.asm
+++ /dev/null
@@ -1,126 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/addmul_1.asm b/gmp/mpn/sparc64/ultrasparct3/addmul_1.asm
deleted file mode 100644
index 939811e1ce..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/addmul_1.asm
+++ /dev/null
@@ -1,182 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/aormul_2.asm b/gmp/mpn/sparc64/ultrasparct3/aormul_2.asm
deleted file mode 100644
index ccc6a4408d..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/aormul_2.asm
+++ /dev/null
@@ -1,228 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/aormul_4.asm b/gmp/mpn/sparc64/ultrasparct3/aormul_4.asm
deleted file mode 100644
index 845f6d6d69..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/aormul_4.asm
+++ /dev/null
@@ -1,219 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/aorslsh_n.asm b/gmp/mpn/sparc64/ultrasparct3/aorslsh_n.asm
deleted file mode 100644
index 1014b1ba23..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/aorslsh_n.asm
+++ /dev/null
@@ -1,147 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm b/gmp/mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm
deleted file mode 100644
index 550860d368..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/bdiv_dbm1c.asm
+++ /dev/null
@@ -1,147 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/cnd_aors_n.asm b/gmp/mpn/sparc64/ultrasparct3/cnd_aors_n.asm
deleted file mode 100644
index f10ee72c1f..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/cnd_aors_n.asm
+++ /dev/null
@@ -1,143 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/dive_1.asm b/gmp/mpn/sparc64/ultrasparct3/dive_1.asm
deleted file mode 100644
index d7dbdf953c..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/dive_1.asm
+++ /dev/null
@@ -1,129 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/hamdist.asm b/gmp/mpn/sparc64/ultrasparct3/hamdist.asm
deleted file mode 100644
index 20ed8bf15b..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/hamdist.asm
+++ /dev/null
@@ -1,78 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/invert_limb.asm b/gmp/mpn/sparc64/ultrasparct3/invert_limb.asm
deleted file mode 100644
index 4da49cf030..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/invert_limb.asm
+++ /dev/null
@@ -1,92 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/missing.asm b/gmp/mpn/sparc64/ultrasparct3/missing.asm
deleted file mode 100644
index c79032dd38..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/missing.asm
+++ /dev/null
@@ -1,77 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/missing.m4 b/gmp/mpn/sparc64/ultrasparct3/missing.m4
deleted file mode 100644
index e5d6d8e98e..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/missing.m4
+++ /dev/null
@@ -1,88 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/mod_1_4.asm b/gmp/mpn/sparc64/ultrasparct3/mod_1_4.asm
deleted file mode 100644
index 08facbd1cc..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/mod_1_4.asm
+++ /dev/null
@@ -1,233 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/mod_34lsub1.asm b/gmp/mpn/sparc64/ultrasparct3/mod_34lsub1.asm
deleted file mode 100644
index 874428069e..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/mod_34lsub1.asm
+++ /dev/null
@@ -1,117 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/mode1o.asm b/gmp/mpn/sparc64/ultrasparct3/mode1o.asm
deleted file mode 100644
index 494e1d3f4f..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/mode1o.asm
+++ /dev/null
@@ -1,82 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/mul_1.asm b/gmp/mpn/sparc64/ultrasparct3/mul_1.asm
deleted file mode 100644
index af05d627bc..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/mul_1.asm
+++ /dev/null
@@ -1,174 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/popcount.asm b/gmp/mpn/sparc64/ultrasparct3/popcount.asm
deleted file mode 100644
index de80f3c809..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/popcount.asm
+++ /dev/null
@@ -1,70 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm b/gmp/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm
deleted file mode 100644
index 216ddc0ba1..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/sqr_diag_addlsh1.asm
+++ /dev/null
@@ -1,93 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/sub_n.asm b/gmp/mpn/sparc64/ultrasparct3/sub_n.asm
deleted file mode 100644
index 0e4bc939e3..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/sub_n.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-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/gmp/mpn/sparc64/ultrasparct3/submul_1.asm b/gmp/mpn/sparc64/ultrasparct3/submul_1.asm
deleted file mode 100644
index 5635d1bdbd..0000000000
--- a/gmp/mpn/sparc64/ultrasparct3/submul_1.asm
+++ /dev/null
@@ -1,170 +0,0 @@
-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()
diff --git a/gmp/mpn/thumb/add_n.asm b/gmp/mpn/thumb/add_n.asm
deleted file mode 100644
index 08ed60b9be..0000000000
--- a/gmp/mpn/thumb/add_n.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-define(`rp', r0)
-define(`up', r1)
-define(`vp', r2)
-define(`n', r3)
-
-ASM_START()
- .thumb
-PROLOGUE(mpn_add_nc)
- push {r4, r5, r6}
- ldr r6, [sp, #12] C init carry save register
- sub r6, #1
- b L(top)
-EPILOGUE()
-PROLOGUE(mpn_add_n)
- push {r4, r5, r6}
- neg r6, n C init carry save register
-
-L(top): ldmia up!, {r4} C load next limb from S1
- cmp n, r6 C tricky carry restore
- ldmia vp!, {r5} C load next limb from S2
- adc r4, r5
- stmia rp!, {r4} C store result limb to RES
- sbc r6, r6 C save negated carry
- sub n, #1
- bne L(top)
-
- add r0, r6, #1
- pop {r4, r5, r6}
- bx lr
-EPILOGUE()
diff --git a/gmp/mpn/thumb/add_n.s b/gmp/mpn/thumb/add_n.s
new file mode 100644
index 0000000000..294cfe6ae2
--- /dev/null
+++ b/gmp/mpn/thumb/add_n.s
@@ -0,0 +1,48 @@
+@ ARM/Thumb mpn_add_n -- Add two limb vectors of the same length > 0 and store
+@ sum in a third limb vector.
+
+@ Copyright 1997, 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 r0
+@ S1_ptr r1
+@ S2_ptr r2
+@ SIZE r3
+
+@ NOT TESTED CODE
+
+ .text
+ .thumb
+ .align 0
+ .global ___gmpn_add_n
+___gmpn_add_n:
+ push {r4, r5, r6, lr}
+ mov r6, #1 @ init carry save register
+
+Loop: sub r6, #1 @ restore carry (set iff r6 was 0)
+ ldmia r1!, {r4} @ load next limb from S1
+ ldmia r2!, {r5} @ load next limb from S2
+ adc r4, r5
+ stmia r0!, {r4} @ store result limb to RES
+ sbc r6, r6 @ save negated carry
+ sub r3, #1
+ bge Loop @ loop back while remaining count >= 4
+
+ mov r0, r6
+ pop {r4, r5, r6, pc}
diff --git a/gmp/mpn/thumb/sub_n.asm b/gmp/mpn/thumb/sub_n.asm
deleted file mode 100644
index a38572048e..0000000000
--- a/gmp/mpn/thumb/sub_n.asm
+++ /dev/null
@@ -1,63 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C INPUT PARAMETERS
-define(`rp', r0)
-define(`up', r1)
-define(`vp', r2)
-define(`n', r3)
-
-ASM_START()
- .thumb
-PROLOGUE(mpn_sub_nc)
- push {r4, r5, r6}
- ldr r6, [sp, #12] C init carry save register
- neg r6, r6
- b L(top)
-EPILOGUE()
-PROLOGUE(mpn_sub_n)
- push {r4, r5, r6}
- mov r6, n C init carry save register
-
-L(top): ldmia up!, {r4} C load next limb from S1
- cmp n, r6 C tricky carry restore
- ldmia vp!, {r5} C load next limb from S2
- sbc r4, r5
- stmia rp!, {r4} C store result limb to RES
- sbc r6, r6 C save negated carry
- sub n, #1
- bne L(top)
-
- neg r0, r6
- pop {r4, r5, r6}
- bx lr
-EPILOGUE()
diff --git a/gmp/mpn/thumb/sub_n.s b/gmp/mpn/thumb/sub_n.s
new file mode 100644
index 0000000000..fbd4c98194
--- /dev/null
+++ b/gmp/mpn/thumb/sub_n.s
@@ -0,0 +1,48 @@
+@ ARM/Thumb mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
+@ store difference in a third limb vector.
+
+@ Copyright 1997, 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 r0
+@ S1_ptr r1
+@ S2_ptr r2
+@ SIZE r3
+
+@ NOT TESTED CODE
+
+ .text
+ .thumb
+ .align 0
+ .global ___gmpn_sub_n
+___gmpn_sub_n:
+ push {r4, r5, r6, lr}
+ mov r6, #1 @ init carry save register
+
+Loop: sub r6, #1 @ restore carry (set iff r6 was 0)
+ ldmia r1!, {r4} @ load next limb from S1
+ ldmia r2!, {r5} @ load next limb from S2
+ sbc r4, r5
+ stmia r0!, {r4} @ store result limb to RES
+ sbc r6, r6 @ save negated carry
+ sub r3, #1
+ bge Loop @ loop back while remaining count >= 4
+
+ mov r0, r6
+ pop {r4, r5, r6, pc}
diff --git a/gmp/mpn/vax/add_n.asm b/gmp/mpn/vax/add_n.asm
deleted file mode 100644
index 0a0bf78ab3..0000000000
--- a/gmp/mpn/vax/add_n.asm
+++ /dev/null
@@ -1,64 +0,0 @@
-dnl VAX mpn_add_n -- Add two limb vectors of the same length > 0 and store sum
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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(mpn_add_n)
- .word 0x0
- movl 16(ap), r0
- movl 12(ap), r1
- movl 8(ap), r2
- movl 4(ap), r3
- mnegl r0, r5
- addl2 $3, r0
- ashl $-2, r0, r0 C unroll loop count
- bicl2 $-4, r5 C mask out low 2 bits
- movaq (r5)[r5], r5 C 9x
- jmp L(top)[r5]
-
-L(top): movl (r2)+, r4
- adwc (r1)+, r4
- movl r4, (r3)+
- movl (r2)+, r4
- adwc (r1)+, r4
- movl r4, (r3)+
- movl (r2)+, r4
- adwc (r1)+, r4
- movl r4, (r3)+
- movl (r2)+, r4
- adwc (r1)+, r4
- movl r4, (r3)+
- sobgtr r0, L(top)
-
- adwc r0, r0
- ret
-EPILOGUE()
diff --git a/gmp/mpn/vax/add_n.s b/gmp/mpn/vax/add_n.s
new file mode 100644
index 0000000000..60773cc348
--- /dev/null
+++ b/gmp/mpn/vax/add_n.s
@@ -0,0 +1,59 @@
+# VAX __gmpn_add_n -- Add two limb vectors of the same length > 0 and store
+# sum in a third limb vector.
+
+# 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/.
+
+
+# INPUT PARAMETERS
+# res_ptr (sp + 4)
+# s1_ptr (sp + 8)
+# s2_ptr (sp + 12)
+# size (sp + 16)
+
+.text
+ .align 1
+.globl ___gmpn_add_n
+___gmpn_add_n:
+ .word 0x0
+ movl 16(ap),r0
+ movl 12(ap),r1
+ movl 8(ap),r2
+ movl 4(ap),r3
+ mnegl r0,r5
+ addl2 $3,r0
+ ashl $-2,r0,r0 # unroll loop count
+ bicl2 $-4,r5 # mask out low 2 bits
+ movaq (r5)[r5],r5 # 9x
+ jmp Loop(r5)
+
+Loop: movl (r2)+,r4
+ adwc (r1)+,r4
+ movl r4,(r3)+
+ movl (r2)+,r4
+ adwc (r1)+,r4
+ movl r4,(r3)+
+ movl (r2)+,r4
+ adwc (r1)+,r4
+ movl r4,(r3)+
+ movl (r2)+,r4
+ adwc (r1)+,r4
+ movl r4,(r3)+
+ sobgtr r0,Loop
+
+ adwc r0,r0
+ ret
diff --git a/gmp/mpn/vax/addmul_1.asm b/gmp/mpn/vax/addmul_1.asm
deleted file mode 100644
index 8a6f636bdf..0000000000
--- a/gmp/mpn/vax/addmul_1.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-dnl VAX mpn_addmul_1 -- Multiply a limb vector with a limb and add the result
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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(mpn_addmul_1)
- .word 0xfc0
- movl 12(ap), r4
- movl 8(ap), r8
- movl 4(ap), r9
- clrl r3
- incl r4
- ashl $-1, r4, r7
- clrl r11
- movl 16(ap), r6
- jlss L(v0_big)
- jlbc r4, L(1)
-
-C Loop for v0 < 0x80000000
-L(tp1): movl (r8)+, r1
- jlss L(1n0)
- emul r1, r6, $0, r2
- addl2 r11, r2
- adwc $0, r3
- addl2 r2, (r9)+
- adwc $0, r3
-L(1): movl (r8)+, r1
- jlss L(1n1)
-L(1p1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc $0, r11
- addl2 r10, (r9)+
- adwc $0, r11
-
- sobgtr r7, L(tp1)
- movl r11, r0
- ret
-
-L(1n0): emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r6, r3
- addl2 r2, (r9)+
- adwc $0, r3
- movl (r8)+, r1
- jgeq L(1p1)
-L(1n1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r6, r11
- addl2 r10, (r9)+
- adwc $0, r11
-
- sobgtr r7, L(tp1)
- movl r11, r0
- ret
-
-L(v0_big):
- jlbc r4, L(2)
-
-C Loop for v0 >= 0x80000000
-L(tp2): movl (r8)+, r1
- jlss L(2n0)
- emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r1, r3
- addl2 r2, (r9)+
- adwc $0, r3
-L(2): movl (r8)+, r1
- jlss L(2n1)
-L(2p1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r1, r11
- addl2 r10, (r9)+
- adwc $0, r11
-
- sobgtr r7, L(tp2)
- movl r11, r0
- ret
-
-L(2n0): emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r6, r3
- addl2 r2, (r9)+
- adwc r1, r3
- movl (r8)+, r1
- jgeq L(2p1)
-L(2n1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r6, r11
- addl2 r10, (r9)+
- adwc r1, r11
-
- sobgtr r7, L(tp2)
- movl r11, r0
- ret
-EPILOGUE()
diff --git a/gmp/mpn/vax/addmul_1.s b/gmp/mpn/vax/addmul_1.s
new file mode 100644
index 0000000000..e2f86e074d
--- /dev/null
+++ b/gmp/mpn/vax/addmul_1.s
@@ -0,0 +1,124 @@
+# VAX __gmpn_addmul_1 -- Multiply a limb vector with a limb and add
+# the result to a second limb vector.
+
+# 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/.
+
+
+# INPUT PARAMETERS
+# res_ptr (sp + 4)
+# s1_ptr (sp + 8)
+# size (sp + 12)
+# s2_limb (sp + 16)
+
+.text
+ .align 1
+.globl ___gmpn_addmul_1
+___gmpn_addmul_1:
+ .word 0xfc0
+ movl 12(ap),r4
+ movl 8(ap),r8
+ movl 4(ap),r9
+ movl 16(ap),r6
+ jlss s2_big
+
+ clrl r3
+ incl r4
+ ashl $-1,r4,r7
+ jlbc r4,L1
+ clrl r11
+
+# Loop for S2_LIMB < 0x80000000
+Loop1: movl (r8)+,r1
+ jlss L1n0
+ emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc $0,r3
+ addl2 r2,(r9)+
+ adwc $0,r3
+L1: movl (r8)+,r1
+ jlss L1n1
+L1p1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc $0,r11
+ addl2 r10,(r9)+
+ adwc $0,r11
+
+ sobgtr r7,Loop1
+ movl r11,r0
+ ret
+
+L1n0: emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r6,r3
+ addl2 r2,(r9)+
+ adwc $0,r3
+ movl (r8)+,r1
+ jgeq L1p1
+L1n1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r6,r11
+ addl2 r10,(r9)+
+ adwc $0,r11
+
+ sobgtr r7,Loop1
+ movl r11,r0
+ ret
+
+
+s2_big: clrl r3
+ incl r4
+ ashl $-1,r4,r7
+ jlbc r4,L2
+ clrl r11
+
+# Loop for S2_LIMB >= 0x80000000
+Loop2: movl (r8)+,r1
+ jlss L2n0
+ emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r1,r3
+ addl2 r2,(r9)+
+ adwc $0,r3
+L2: movl (r8)+,r1
+ jlss L2n1
+L2p1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r1,r11
+ addl2 r10,(r9)+
+ adwc $0,r11
+
+ sobgtr r7,Loop2
+ movl r11,r0
+ ret
+
+L2n0: emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r6,r3
+ addl2 r2,(r9)+
+ adwc r1,r3
+ movl (r8)+,r1
+ jgeq L2p1
+L2n1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r6,r11
+ addl2 r10,(r9)+
+ adwc r1,r11
+
+ sobgtr r7,Loop2
+ movl r11,r0
+ ret
diff --git a/gmp/mpn/vax/elf.m4 b/gmp/mpn/vax/elf.m4
deleted file mode 100644
index e04f0bafc9..0000000000
--- a/gmp/mpn/vax/elf.m4
+++ /dev/null
@@ -1,54 +0,0 @@
-divert(-1)
-
-dnl m4 macros for VAX assembler.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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')
-defreg(r1,`%r``''1')
-defreg(r2,`%r``''2')
-defreg(r3,`%r``''3')
-defreg(r4,`%r``''4')
-defreg(r5,`%r``''5')
-defreg(r6,`%r``''6')
-defreg(r7,`%r``''7')
-defreg(r8,`%r``''8')
-defreg(r9,`%r``''9')
-defreg(r10,`%r``''10')
-defreg(r11,`%r``''11')
-defreg(r12,`%r``''12')
-defreg(r13,`%r``''13')
-defreg(r14,`%r``''14')
-defreg(r15,`%r``''15')
-defreg(ap,`%a``''p')
-
-define(`foo', blablabla)
-
-divert
diff --git a/gmp/mpn/vax/gmp-mparam.h b/gmp/mpn/vax/gmp-mparam.h
index 9f20b9b783..ea262ddc40 100644
--- a/gmp/mpn/vax/gmp-mparam.h
+++ b/gmp/mpn/vax/gmp-mparam.h
@@ -1,41 +1,30 @@
/* VAX gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* These numbers were measured manually using the tune/speed program.
- The standard tune/tuneup takes too long. (VAX 8800) */
+ The standard tune/tunup takes too long. (VAX 8800) */
-#define MUL_TOOM22_THRESHOLD 14
-#define MUL_TOOM33_THRESHOLD 110
+#define MUL_KARATSUBA_THRESHOLD 14
+#define MUL_TOOM3_THRESHOLD 110
#define SQR_BASECASE_THRESHOLD 6
-#define SQR_TOOM2_THRESHOLD 42
+#define SQR_KARATSUBA_THRESHOLD 42
#define SQR_TOOM3_THRESHOLD 250
/* #define DIV_SB_PREINV_THRESHOLD */
diff --git a/gmp/mpn/vax/lshift.asm b/gmp/mpn/vax/lshift.asm
deleted file mode 100644
index 941e9994b8..0000000000
--- a/gmp/mpn/vax/lshift.asm
+++ /dev/null
@@ -1,59 +0,0 @@
-dnl VAX mpn_lshift -- left shift.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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(mpn_lshift)
- .word 0x1c0
- movl 4(ap), r7
- movl 8(ap), r6
- movl 12(ap), r1
- movl 16(ap), r8
-
- moval (r6)[r1], r6
- moval (r7)[r1], r7
- clrl r3
- movl -(r6), r2
- ashq r8, r2, r4
- movl r5, r0
- movl r2, r3
- decl r1
- jeql L(end)
-
-L(top): movl -(r6), r2
- ashq r8, r2, r4
- movl r5, -(r7)
- movl r2, r3
- sobgtr r1, L(top)
-
-L(end): movl r4, -4(r7)
- ret
-EPILOGUE()
diff --git a/gmp/mpn/vax/lshift.s b/gmp/mpn/vax/lshift.s
new file mode 100644
index 0000000000..6f3d600be0
--- /dev/null
+++ b/gmp/mpn/vax/lshift.s
@@ -0,0 +1,56 @@
+# VAX mpn_lshift -- left shift.
+
+# Copyright 1999, 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.
+
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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
+# rptr (sp + 4)
+# sptr (sp + 8)
+# size (sp + 12)
+# cnt (sp + 16)
+# r0=retval r1=size r2,r3=itmp r4,r5=otmp call-used registers
+# r6=sptr r7=rptr r8=cnt r9 r10 r11 call-saved registers
+
+.text
+ .align 1
+.globl ___gmpn_lshift
+___gmpn_lshift:
+ .word 0x1c0
+ movl 4(ap),r7
+ movl 8(ap),r6
+ movl 12(ap),r1
+ movl 16(ap),r8
+
+ moval (r6)[r1],r6
+ moval (r7)[r1],r7
+ clrl r3
+ movl -(r6),r2
+ ashq r8,r2,r4
+ movl r5,r0
+ movl r2,r3
+ decl r1
+ jeql Lend
+
+Loop: movl -(r6),r2
+ ashq r8,r2,r4
+ movl r5,-(r7)
+ movl r2,r3
+ sobgtr r1,Loop
+
+Lend: movl r4,-4(r7)
+ ret
diff --git a/gmp/mpn/vax/mul_1.asm b/gmp/mpn/vax/mul_1.asm
deleted file mode 100644
index 8e4dcd2177..0000000000
--- a/gmp/mpn/vax/mul_1.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-dnl VAX mpn_mul_1 -- Multiply a limb vector with a limb and store the result
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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(mpn_mul_1)
- .word 0xfc0
- movl 12(ap), r4
- movl 8(ap), r8
- movl 4(ap), r9
- clrl r3
- incl r4
- ashl $-1, r4, r7
- clrl r11
- movl 16(ap), r6
- jlss L(v0_big)
- jlbc r4, L(1)
-
-C Loop for v0 < 0x80000000
-L(tp1): movl (r8)+, r1
- jlss L(1n0)
- emul r1, r6, $0, r2
- addl2 r11, r2
- adwc $0, r3
- movl r2, (r9)+
-L(1): movl (r8)+, r1
- jlss L(1n1)
-L(1p1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc $0, r11
- movl r10, (r9)+
-
- sobgtr r7, L(tp1)
- movl r11, r0
- ret
-
-L(1n0): emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r6, r3
- movl r2, (r9)+
- movl (r8)+, r1
- jgeq L(1p1)
-L(1n1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r6, r11
- movl r10, (r9)+
-
- sobgtr r7, L(tp1)
- movl r11, r0
- ret
-
-L(v0_big):
- jlbc r4, L(2)
-
-C Loop for v0 >= 0x80000000
-L(tp2): movl (r8)+, r1
- jlss L(2n0)
- emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r1, r3
- movl r2, (r9)+
-L(2): movl (r8)+, r1
- jlss L(2n1)
-L(2p1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r1, r11
- movl r10, (r9)+
-
- sobgtr r7, L(tp2)
- movl r11, r0
- ret
-
-L(2n0): emul r1, r6, $0, r2
- addl2 r1, r3
- addl2 r11, r2
- adwc r6, r3
- movl r2, (r9)+
- movl (r8)+, r1
- jgeq L(2p1)
-L(2n1): emul r1, r6, $0, r10
- addl2 r1, r11
- addl2 r3, r10
- adwc r6, r11
- movl r10, (r9)+
-
- sobgtr r7, L(tp2)
- movl r11, r0
- ret
-EPILOGUE()
diff --git a/gmp/mpn/vax/mul_1.s b/gmp/mpn/vax/mul_1.s
new file mode 100644
index 0000000000..c6f4594bd8
--- /dev/null
+++ b/gmp/mpn/vax/mul_1.s
@@ -0,0 +1,121 @@
+# VAX __gmpn_mul_1 -- Multiply a limb vector with a limb and store
+# the result in a second limb vector.
+
+# 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/.
+
+
+# INPUT PARAMETERS
+# res_ptr (sp + 4)
+# s1_ptr (sp + 8)
+# size (sp + 12)
+# s2_limb (sp + 16)
+
+.text
+ .align 1
+.globl ___gmpn_mul_1
+___gmpn_mul_1:
+ .word 0xfc0
+ movl 12(ap),r4
+ movl 8(ap),r8
+ movl 4(ap),r9
+ movl 16(ap),r6
+ jlss s2_big
+
+# One might want to combine the addl2 and the store below, but that
+# is actually just slower according to my timing tests. (VAX 3600)
+
+ clrl r3
+ incl r4
+ ashl $-1,r4,r7
+ jlbc r4,L1
+ clrl r11
+
+# Loop for S2_LIMB < 0x80000000
+Loop1: movl (r8)+,r1
+ jlss L1n0
+ emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc $0,r3
+ movl r2,(r9)+
+L1: movl (r8)+,r1
+ jlss L1n1
+L1p1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc $0,r11
+ movl r10,(r9)+
+
+ sobgtr r7,Loop1
+ movl r11,r0
+ ret
+
+L1n0: emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r6,r3
+ movl r2,(r9)+
+ movl (r8)+,r1
+ jgeq L1p1
+L1n1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r6,r11
+ movl r10,(r9)+
+
+ sobgtr r7,Loop1
+ movl r11,r0
+ ret
+
+
+s2_big: clrl r3
+ incl r4
+ ashl $-1,r4,r7
+ jlbc r4,L2
+ clrl r11
+
+# Loop for S2_LIMB >= 0x80000000
+Loop2: movl (r8)+,r1
+ jlss L2n0
+ emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r1,r3
+ movl r2,(r9)+
+L2: movl (r8)+,r1
+ jlss L2n1
+L2p1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r1,r11
+ movl r10,(r9)+
+
+ sobgtr r7,Loop2
+ movl r11,r0
+ ret
+
+L2n0: emul r1,r6,$0,r2
+ addl2 r1,r3
+ addl2 r11,r2
+ adwc r6,r3
+ movl r2,(r9)+
+ movl (r8)+,r1
+ jgeq L2p1
+L2n1: emul r1,r6,$0,r10
+ addl2 r1,r11
+ addl2 r3,r10
+ adwc r6,r11
+ movl r10,(r9)+
+
+ sobgtr r7,Loop2
+ movl r11,r0
+ ret
diff --git a/gmp/mpn/vax/rshift.asm b/gmp/mpn/vax/rshift.asm
deleted file mode 100644
index 00b2daac01..0000000000
--- a/gmp/mpn/vax/rshift.asm
+++ /dev/null
@@ -1,57 +0,0 @@
-dnl VAX mpn_rshift -- right shift.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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(mpn_rshift)
- .word 0x1c0
- movl 4(ap), r7
- movl 8(ap), r6
- movl 12(ap), r1
- movl 16(ap), r8
-
- movl (r6)+, r2
- subl3 r8, $32, r8
- ashl r8, r2, r0
- decl r1
- jeql L(end)
-
-L(top): movl (r6)+, r3
- ashq r8, r2, r4
- movl r5, (r7)+
- movl r3, r2
- sobgtr r1, L(top)
-
-L(end): clrl r3
- ashq r8, r2, r4
- movl r5, (r7)
- ret
-EPILOGUE()
diff --git a/gmp/mpn/vax/rshift.s b/gmp/mpn/vax/rshift.s
new file mode 100644
index 0000000000..ae27208e2c
--- /dev/null
+++ b/gmp/mpn/vax/rshift.s
@@ -0,0 +1,54 @@
+# VAX mpn_rshift -- right shift.
+
+# Copyright 1999, 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.
+
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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
+# rptr (sp + 4)
+# sptr (sp + 8)
+# size (sp + 12)
+# cnt (sp + 16)
+# r0=retval r1=size r2,r3=itmp r4,r5=otmp call-used registers
+# r6=sptr r7=rptr r8=cnt r9 r10 r11 call-saved registers
+
+.text
+ .align 1
+.globl ___gmpn_rshift
+___gmpn_rshift:
+ .word 0x1c0
+ movl 4(ap),r7
+ movl 8(ap),r6
+ movl 12(ap),r1
+ movl 16(ap),r8
+
+ movl (r6)+,r2
+ subl3 r8,$32,r8
+ ashl r8,r2,r0
+ decl r1
+ jeql Lend
+
+Loop: movl (r6)+,r3
+ ashq r8,r2,r4
+ movl r5,(r7)+
+ movl r3,r2
+ sobgtr r1,Loop
+
+Lend: clrl r3
+ ashq r8,r2,r4
+ movl r5,(r7)
+ ret
diff --git a/gmp/mpn/vax/sub_n.asm b/gmp/mpn/vax/sub_n.asm
deleted file mode 100644
index 2844ef2cc1..0000000000
--- a/gmp/mpn/vax/sub_n.asm
+++ /dev/null
@@ -1,64 +0,0 @@
-dnl VAX mpn_sub_n -- Subtract two limb vectors of the same length > 0 and
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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(mpn_sub_n)
- .word 0x0
- movl 16(ap), r0
- movl 12(ap), r1
- movl 8(ap), r2
- movl 4(ap), r3
- mnegl r0, r5
- addl2 $3, r0
- ashl $-2, r0, r0 C unroll loop count
- bicl2 $-4, r5 C mask out low 2 bits
- movaq (r5)[r5], r5 C 9x
- jmp L(top)[r5]
-
-L(top): movl (r2)+, r4
- sbwc (r1)+, r4
- movl r4, (r3)+
- movl (r2)+, r4
- sbwc (r1)+, r4
- movl r4, (r3)+
- movl (r2)+, r4
- sbwc (r1)+, r4
- movl r4, (r3)+
- movl (r2)+, r4
- sbwc (r1)+, r4
- movl r4, (r3)+
- sobgtr r0, L(top)
-
- adwc r0, r0
- ret
-EPILOGUE()
diff --git a/gmp/mpn/vax/sub_n.s b/gmp/mpn/vax/sub_n.s
new file mode 100644
index 0000000000..c9ad1ecfb8
--- /dev/null
+++ b/gmp/mpn/vax/sub_n.s
@@ -0,0 +1,59 @@
+# VAX __gmpn_sub_n -- Subtract two limb vectors of the same length > 0 and store
+# difference in a third limb vector.
+
+# 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/.
+
+
+# INPUT PARAMETERS
+# res_ptr (sp + 4)
+# s1_ptr (sp + 8)
+# s2_ptr (sp + 12)
+# size (sp + 16)
+
+.text
+ .align 1
+.globl ___gmpn_sub_n
+___gmpn_sub_n:
+ .word 0x0
+ movl 16(ap),r0
+ movl 12(ap),r1
+ movl 8(ap),r2
+ movl 4(ap),r3
+ mnegl r0,r5
+ addl2 $3,r0
+ ashl $-2,r0,r0 # unroll loop count
+ bicl2 $-4,r5 # mask out low 2 bits
+ movaq (r5)[r5],r5 # 9x
+ jmp Loop(r5)
+
+Loop: movl (r2)+,r4
+ sbwc (r1)+,r4
+ movl r4,(r3)+
+ movl (r2)+,r4
+ sbwc (r1)+,r4
+ movl r4,(r3)+
+ movl (r2)+,r4
+ sbwc (r1)+,r4
+ movl r4,(r3)+
+ movl (r2)+,r4
+ sbwc (r1)+,r4
+ movl r4,(r3)+
+ sobgtr r0,Loop
+
+ adwc r0,r0
+ ret
diff --git a/gmp/mpn/vax/submul_1.asm b/gmp/mpn/vax/submul_1.asm
deleted file mode 100644
index 60d47fcd6f..0000000000
--- a/gmp/mpn/vax/submul_1.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-dnl VAX mpn_submul_1 -- Multiply a limb vector with a limb and subtract the
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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(mpn_submul_1)
- .word 0xfc0
- movl 12(ap), r4
- movl 8(ap), r8
- movl 4(ap), r9
- clrl r3
- incl r4
- ashl $-1, r4, r7
- clrl r11
- movl 16(ap), r6
- jlss L(v0_big)
- jlbc r4, L(1)
-
-C Loop for v0 < 0x80000000
-L(tp1): movl (r8)+, r1
- jlss L(1n0)
- emul r1, r6, $0, r2
- addl2 r11, r2
- adwc $0, r3
- subl2 r2, (r9)+
- adwc $0, r3
-L(1): movl (r8)+, r1
- jlss L(1n1)
-L(1p1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc $0, r11
- subl2 r10, (r9)+
- adwc $0, r11
-
- sobgtr r7, L(tp1)
- movl r11, r0
- ret
-
-L(1n0): emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r6, r3
- subl2 r2, (r9)+
- adwc $0, r3
- movl (r8)+, r1
- jgeq L(1p1)
-L(1n1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r6, r11
- subl2 r10, (r9)+
- adwc $0, r11
-
- sobgtr r7, L(tp1)
- movl r11, r0
- ret
-
-L(v0_big):
- jlbc r4, L(2)
-
-C Loop for v0 >= 0x80000000
-L(tp2): movl (r8)+, r1
- jlss L(2n0)
- emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r1, r3
- subl2 r2, (r9)+
- adwc $0, r3
-L(2): movl (r8)+, r1
- jlss L(2n1)
-L(2p1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r1, r11
- subl2 r10, (r9)+
- adwc $0, r11
-
- sobgtr r7, L(tp2)
- movl r11, r0
- ret
-
-L(2n0): emul r1, r6, $0, r2
- addl2 r11, r2
- adwc r6, r3
- subl2 r2, (r9)+
- adwc r1, r3
- movl (r8)+, r1
- jgeq L(2p1)
-L(2n1): emul r1, r6, $0, r10
- addl2 r3, r10
- adwc r6, r11
- subl2 r10, (r9)+
- adwc r1, r11
-
- sobgtr r7, L(tp2)
- movl r11, r0
- ret
-EPILOGUE()
diff --git a/gmp/mpn/vax/submul_1.s b/gmp/mpn/vax/submul_1.s
new file mode 100644
index 0000000000..ad0ddbbacb
--- /dev/null
+++ b/gmp/mpn/vax/submul_1.s
@@ -0,0 +1,124 @@
+# VAX __gmpn_submul_1 -- Multiply a limb vector with a limb and subtract
+# the result from a second limb vector.
+
+# 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/.
+
+
+# INPUT PARAMETERS
+# res_ptr (sp + 4)
+# s1_ptr (sp + 8)
+# size (sp + 12)
+# s2_limb (sp + 16)
+
+.text
+ .align 1
+.globl ___gmpn_submul_1
+___gmpn_submul_1:
+ .word 0xfc0
+ movl 12(ap),r4
+ movl 8(ap),r8
+ movl 4(ap),r9
+ movl 16(ap),r6
+ jlss s2_big
+
+ clrl r3
+ incl r4
+ ashl $-1,r4,r7
+ jlbc r4,L1
+ clrl r11
+
+# Loop for S2_LIMB < 0x80000000
+Loop1: movl (r8)+,r1
+ jlss L1n0
+ emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc $0,r3
+ subl2 r2,(r9)+
+ adwc $0,r3
+L1: movl (r8)+,r1
+ jlss L1n1
+L1p1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc $0,r11
+ subl2 r10,(r9)+
+ adwc $0,r11
+
+ sobgtr r7,Loop1
+ movl r11,r0
+ ret
+
+L1n0: emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r6,r3
+ subl2 r2,(r9)+
+ adwc $0,r3
+ movl (r8)+,r1
+ jgeq L1p1
+L1n1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r6,r11
+ subl2 r10,(r9)+
+ adwc $0,r11
+
+ sobgtr r7,Loop1
+ movl r11,r0
+ ret
+
+
+s2_big: clrl r3
+ incl r4
+ ashl $-1,r4,r7
+ jlbc r4,L2
+ clrl r11
+
+# Loop for S2_LIMB >= 0x80000000
+Loop2: movl (r8)+,r1
+ jlss L2n0
+ emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r1,r3
+ subl2 r2,(r9)+
+ adwc $0,r3
+L2: movl (r8)+,r1
+ jlss L2n1
+L2p1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r1,r11
+ subl2 r10,(r9)+
+ adwc $0,r11
+
+ sobgtr r7,Loop2
+ movl r11,r0
+ ret
+
+L2n0: emul r1,r6,$0,r2
+ addl2 r11,r2
+ adwc r6,r3
+ subl2 r2,(r9)+
+ adwc r1,r3
+ movl (r8)+,r1
+ jgeq L2p1
+L2n1: emul r1,r6,$0,r10
+ addl2 r3,r10
+ adwc r6,r11
+ subl2 r10,(r9)+
+ adwc r1,r11
+
+ sobgtr r7,Loop2
+ movl r11,r0
+ ret
diff --git a/gmp/mpn/x86/README b/gmp/mpn/x86/README
index 8d7ac9080d..883db227d2 100644
--- a/gmp/mpn/x86/README
+++ b/gmp/mpn/x86/README
@@ -1,30 +1,19 @@
-Copyright 1999-2002 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/x86/aors_n.asm b/gmp/mpn/x86/aors_n.asm
index 5d359f59b6..c8969995c8 100644
--- a/gmp/mpn/x86/aors_n.asm
+++ b/gmp/mpn/x86/aors_n.asm
@@ -1,42 +1,32 @@
dnl x86 mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2001, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 3.375
-C P6 3.125
-C K6 3.5
-C K7 2.25
-C P4 8.75
+C P5: 3.375
+C P6: 3.125
+C K6: 3.5
+C K7: 2.25
+C P4: 8.75
ifdef(`OPERATION_add_n',`
@@ -109,7 +99,7 @@ L(0a): leal (%eax,%eax,8),%eax
C possible to simplify.
pushl %ebp FRAME_pushl()
movl PARAM_CARRY,%ebp
- shrl %ebp C shift bit 0 into carry
+ shrl $1,%ebp C shift bit 0 into carry
popl %ebp FRAME_popl()
jmp *%eax C jump into loop
@@ -158,7 +148,7 @@ L(0b): leal (%eax,%eax,8),%eax
L(oopgo):
pushl %ebp FRAME_pushl()
movl PARAM_CARRY,%ebp
- shrl %ebp C shift bit 0 into carry
+ shrl $1,%ebp C shift bit 0 into carry
popl %ebp FRAME_popl()
ALIGN(16)
diff --git a/gmp/mpn/x86/aorsmul_1.asm b/gmp/mpn/x86/aorsmul_1.asm
index 54a8905441..b4db427657 100644
--- a/gmp/mpn/x86/aorsmul_1.asm
+++ b/gmp/mpn/x86/aorsmul_1.asm
@@ -1,51 +1,40 @@
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-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 1992, 1994, 1997, 1999, 2000, 2001, 2002, 2005 Free Software
+dnl Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 14.75
-C P6 model 0-8,10-12 7.5
-C P6 model 9 (Banias) 6.7
-C P6 model 13 (Dothan) 6.75
-C P4 model 0 (Willamette) 24.0
-C P4 model 1 (?) 24.0
-C P4 model 2 (Northwood) 24.0
+
+C cycles/limb
+C P5: 14.75
+C P6 model 0-8,10-12) 7.5
+C P6 model 9 (Banias)
+C P6 model 13 (Dothan) 6.75
+C P4 model 0 (Willamette) 24.0
+C P4 model 1 (?) 24.0
+C P4 model 2 (Northwood) 24.0
C P4 model 3 (Prescott)
C P4 model 4 (Nocona)
-C Intel Atom
-C AMD K6 12.5
-C AMD K7 5.25
-C AMD K8
-C AMD K10
+C K6: 12.5
+C K7: 5.25
+C K8:
ifdef(`OPERATION_addmul_1',`
diff --git a/gmp/mpn/x86/atom/aorrlsh1_n.asm b/gmp/mpn/x86/atom/aorrlsh1_n.asm
deleted file mode 100644
index cd1a650022..0000000000
--- a/gmp/mpn/x86/atom/aorrlsh1_n.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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, 31)
-
-ifdef(`OPERATION_addlsh1_n', `
- define(M4_inst, adc)
- define(M4_opp, sub)
- define(M4_function, mpn_addlsh1_n)
- define(M4_function_c, mpn_addlsh1_nc)
-',`ifdef(`OPERATION_rsblsh1_n', `
- define(M4_inst, sbb)
- define(M4_opp, add)
- define(M4_function, mpn_rsblsh1_n)
- define(M4_function_c, mpn_rsblsh1_nc)
-',`m4_error(`Need OPERATION_addlsh1_n or OPERATION_rsblsh1_n
-')')')
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_addlsh1_nc mpn_rsblsh1_n mpn_rsblsh1_nc)
-
-include_mpn(`x86/atom/aorrlshC_n.asm')
diff --git a/gmp/mpn/x86/atom/aorrlsh2_n.asm b/gmp/mpn/x86/atom/aorrlsh2_n.asm
deleted file mode 100644
index 10f4419de9..0000000000
--- a/gmp/mpn/x86/atom/aorrlsh2_n.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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, 30)
-
-ifdef(`OPERATION_addlsh2_n', `
- define(M4_inst, adcl)
- define(M4_opp, subl)
- define(M4_function, mpn_addlsh2_n)
- define(M4_function_c, mpn_addlsh2_nc)
-',`ifdef(`OPERATION_rsblsh2_n', `
- define(M4_inst, sbbl)
- define(M4_opp, addl)
- define(M4_function, mpn_rsblsh2_n)
- define(M4_function_c, mpn_rsblsh2_nc)
-',`m4_error(`Need OPERATION_addlsh2_n or OPERATION_rsblsh2_n
-')')')
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_addlsh2_nc mpn_rsblsh2_n mpn_rsblsh2_nc)
-
-include_mpn(`x86/atom/aorrlshC_n.asm')
diff --git a/gmp/mpn/x86/atom/aorrlshC_n.asm b/gmp/mpn/x86/atom/aorrlshC_n.asm
deleted file mode 100644
index 71cfe490d6..0000000000
--- a/gmp/mpn/x86/atom/aorrlshC_n.asm
+++ /dev/null
@@ -1,156 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 mp_limb_t mpn_addlshC_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size);
-C mp_limb_t mpn_addlshC_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size, mp_limb_t carry);
-C mp_limb_t mpn_rsblshC_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size);
-C mp_limb_t mpn_rsblshC_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size, mp_signed_limb_t carry);
-
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 6
-C AMD K6
-C AMD K7
-C AMD K8
-C AMD K10
-
-defframe(PARAM_CORB, 20)
-defframe(PARAM_SIZE, 16)
-defframe(PARAM_DBLD, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(VAR_COUNT,`PARAM_SIZE')
-define(SAVE_EBP,`PARAM_DBLD')
-define(SAVE_VP,`PARAM_SRC')
-define(SAVE_UP,`PARAM_DST')
-
-define(M, eval(m4_lshift(1,LSH)))
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`vp', `%ebx')
-
-ASM_START()
- TEXT
- ALIGN(8)
-
-PROLOGUE(M4_function_c)
-deflit(`FRAME',0)
- movl PARAM_CORB, %eax
- movl %eax, %edx
- shr $LSH, %edx
- andl $1, %edx
- M4_opp %edx, %eax
- jmp L(start_nc)
-EPILOGUE()
-
-PROLOGUE(M4_function)
-deflit(`FRAME',0)
-
- xor %eax, %eax
- xor %edx, %edx
-L(start_nc):
- push rp FRAME_pushl()
-
- mov PARAM_SIZE, %ecx C size
- mov PARAM_DST, rp
- mov up, SAVE_UP
- incl %ecx C size + 1
- mov PARAM_SRC, up
- mov vp, SAVE_VP
- shr %ecx C (size+1)\2
- mov PARAM_DBLD, vp
- mov %ebp, SAVE_EBP
- mov %ecx, VAR_COUNT
- jnc L(entry) C size odd
-
- shr %edx C size even
- mov (vp), %ecx
- lea 4(vp), vp
- lea (%eax,%ecx,M), %edx
- mov %ecx, %eax
- lea -4(up), up
- lea -4(rp), rp
- jmp L(enteven)
-
- ALIGN(16)
-L(oop):
- lea (%eax,%ecx,M), %ebp
- shr $RSH, %ecx
- mov 4(vp), %eax
- shr %edx
- lea 8(vp), vp
- M4_inst (up), %ebp
- lea (%ecx,%eax,M), %edx
- mov %ebp, (rp)
-L(enteven):
- M4_inst 4(up), %edx
- lea 8(up), up
- mov %edx, 4(rp)
- adc %edx, %edx
- shr $RSH, %eax
- lea 8(rp), rp
-L(entry):
- mov (vp), %ecx
- decl VAR_COUNT
- jnz L(oop)
-
- lea (%eax,%ecx,M), %ebp
- shr $RSH, %ecx
- shr %edx
- mov SAVE_VP, vp
- M4_inst (up), %ebp
- mov %ecx, %eax
- mov SAVE_UP, up
- M4_inst $0, %eax
- mov %ebp, (rp)
- mov SAVE_EBP, %ebp
- pop rp FRAME_popl()
- ret
-EPILOGUE()
-
-ASM_END()
diff --git a/gmp/mpn/x86/atom/aors_n.asm b/gmp/mpn/x86/atom/aors_n.asm
deleted file mode 100644
index 45ec287c3a..0000000000
--- a/gmp/mpn/x86/atom/aors_n.asm
+++ /dev/null
@@ -1,159 +0,0 @@
-dnl Intel Atom mpn_add_n/mpn_sub_n -- rp[] = up[] +- vp[].
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 3
-C AMD K6
-C AMD K7
-C AMD K8
-C AMD K10
-
-ifdef(`OPERATION_add_n', `
- define(M4_inst, adcl)
- define(M4_function_n, mpn_add_n)
- define(M4_function_nc, mpn_add_nc)
- define(M4_description, add)
-',`ifdef(`OPERATION_sub_n', `
- define(M4_inst, sbbl)
- define(M4_function_n, mpn_sub_n)
- define(M4_function_nc, mpn_sub_nc)
- define(M4_description, subtract)
-',`m4_error(`Need OPERATION_add_n or OPERATION_sub_n
-')')')
-
-MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
-
-C mp_limb_t M4_function_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size);
-C mp_limb_t M4_function_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size, mp_limb_t carry);
-C
-C Calculate src1,size M4_description src2,size, and store the result in
-C dst,size. The return value is the carry bit from the top of the result (1
-C or 0).
-C
-C The _nc version accepts 1 or 0 for an initial carry into the low limb of
-C the calculation. Note values other than 1 or 0 here will lead to garbage
-C results.
-
-defframe(PARAM_CARRY,20)
-defframe(PARAM_SIZE, 16)
-defframe(PARAM_SRC2, 12)
-defframe(PARAM_SRC1, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(SAVE_RP,`PARAM_SIZE')
-define(SAVE_VP,`PARAM_SRC1')
-define(SAVE_UP,`PARAM_DST')
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`vp', `%ebx')
-define(`cy', `%ecx')
-define(`r1', `%ecx')
-define(`r2', `%edx')
-
-ASM_START()
- TEXT
- ALIGN(16)
-deflit(`FRAME',0)
-
-PROLOGUE(M4_function_n)
- xor cy, cy C carry
-L(start):
- mov PARAM_SIZE, %eax C size
- mov rp, SAVE_RP
- mov PARAM_DST, rp
- mov up, SAVE_UP
- mov PARAM_SRC1, up
- shr %eax C size >> 1
- mov vp, SAVE_VP
- mov PARAM_SRC2, vp
- jz L(one) C size == 1
- jc L(three) C size % 2 == 1
-
- shr cy
- mov (up), r2
- lea 4(up), up
- lea 4(vp), vp
- lea -4(rp), rp
- jmp L(entry)
-L(one):
- shr cy
- mov (up), r1
- jmp L(end)
-L(three):
- shr cy
- mov (up), r1
-
- ALIGN(16)
-L(oop):
- M4_inst (vp), r1
- lea 8(up), up
- mov -4(up), r2
- lea 8(vp), vp
- mov r1, (rp)
-L(entry):
- M4_inst -4(vp), r2
- lea 8(rp), rp
- dec %eax
- mov (up), r1
- mov r2, -4(rp)
- jnz L(oop)
-
-L(end): C %eax is zero here
- mov SAVE_UP, up
- M4_inst (vp), r1
- mov SAVE_VP, vp
- mov r1, (rp)
- adc %eax, %eax
- mov SAVE_RP, rp
- ret
-EPILOGUE()
-
-PROLOGUE(M4_function_nc)
- mov PARAM_CARRY, cy C carry
- jmp L(start)
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/atom/aorslshC_n.asm b/gmp/mpn/x86/atom/aorslshC_n.asm
deleted file mode 100644
index 75ace65e51..0000000000
--- a/gmp/mpn/x86/atom/aorslshC_n.asm
+++ /dev/null
@@ -1,247 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 mp_limb_t mpn_addlshC_n_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size);
-C mp_limb_t mpn_addlshC_nc_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_limb_t carry);
-C mp_limb_t mpn_sublshC_n_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size,);
-C mp_limb_t mpn_sublshC_nc_ip1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_signed_limb_t borrow);
-
-defframe(PARAM_CORB, 16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-C mp_limb_t mpn_addlshC_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size,);
-C mp_limb_t mpn_addlshC_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size, mp_limb_t carry);
-C mp_limb_t mpn_sublshC_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size,);
-C mp_limb_t mpn_sublshC_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
-C mp_size_t size, mp_limb_t borrow);
-
-C if src1 == dst, _ip1 is used
-
-C cycles/limb
-C dst!=src1,src2 dst==src1
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 7 6
-C AMD K6
-C AMD K7
-C AMD K8
-C AMD K10
-
-defframe(GPARAM_CORB, 20)
-defframe(GPARAM_SIZE, 16)
-defframe(GPARAM_SRC2, 12)
-
-dnl re-use parameter space
-define(SAVE_EBP,`PARAM_SIZE')
-define(SAVE_EBX,`PARAM_SRC')
-define(SAVE_UP,`PARAM_DST')
-
-define(M, eval(m4_lshift(1,LSH)))
-define(`rp', `%edi')
-define(`up', `%esi')
-
-ASM_START()
- TEXT
- ALIGN(8)
-
-PROLOGUE(M4_ip_function_c)
-deflit(`FRAME',0)
- movl PARAM_CORB, %ecx
- movl %ecx, %edx
- shr $LSH, %edx
- andl $1, %edx
- M4_opp %edx, %ecx
- jmp L(start_nc)
-EPILOGUE()
-
-PROLOGUE(M4_ip_function)
-deflit(`FRAME',0)
-
- xor %ecx, %ecx
- xor %edx, %edx
-L(start_nc):
- push rp FRAME_pushl()
- mov PARAM_DST, rp
- mov up, SAVE_UP
- mov PARAM_SRC, up
- mov %ebx, SAVE_EBX
- mov PARAM_SIZE, %ebx C size
-L(inplace):
- incl %ebx C size + 1
- shr %ebx C (size+1)\2
- mov %ebp, SAVE_EBP
- jnc L(entry) C size odd
-
- add %edx, %edx C size even
- mov %ecx, %ebp
- mov (up), %ecx
- lea -4(rp), rp
- lea (%ebp,%ecx,M), %eax
- lea 4(up), up
- jmp L(enteven)
-
- ALIGN(16)
-L(oop):
- lea (%ecx,%eax,M), %ebp
- shr $RSH, %eax
- mov 4(up), %ecx
- add %edx, %edx
- lea 8(up), up
- M4_inst %ebp, (rp)
- lea (%eax,%ecx,M), %eax
-
-L(enteven):
- M4_inst %eax, 4(rp)
- lea 8(rp), rp
-
- sbb %edx, %edx
- shr $RSH, %ecx
-
-L(entry):
- mov (up), %eax
- decl %ebx
- jnz L(oop)
-
- lea (%ecx,%eax,M), %ebp
- shr $RSH, %eax
- shr %edx
- M4_inst %ebp, (rp)
- mov SAVE_UP, up
- adc $0, %eax
- mov SAVE_EBP, %ebp
- mov SAVE_EBX, %ebx
- pop rp FRAME_popl()
- ret
-EPILOGUE()
-
-PROLOGUE(M4_function_c)
-deflit(`FRAME',0)
- movl GPARAM_CORB, %ecx
- movl %ecx, %edx
- shr $LSH, %edx
- andl $1, %edx
- M4_opp %edx, %ecx
- jmp L(generic_nc)
-EPILOGUE()
-
-PROLOGUE(M4_function)
-deflit(`FRAME',0)
-
- xor %ecx, %ecx
- xor %edx, %edx
-L(generic_nc):
- push rp FRAME_pushl()
- mov PARAM_DST, rp
- mov up, SAVE_UP
- mov PARAM_SRC, up
- cmp rp, up
- mov %ebx, SAVE_EBX
- jne L(general)
- mov GPARAM_SIZE, %ebx C size
- mov GPARAM_SRC2, up
- jmp L(inplace)
-
-L(general):
- mov GPARAM_SIZE, %eax C size
- mov %ebx, SAVE_EBX
- incl %eax C size + 1
- mov up, %ebx C vp
- mov GPARAM_SRC2, up C up
- shr %eax C (size+1)\2
- mov %ebp, SAVE_EBP
- mov %eax, GPARAM_SIZE
- jnc L(entry2) C size odd
-
- add %edx, %edx C size even
- mov %ecx, %ebp
- mov (up), %ecx
- lea -4(rp), rp
- lea -4(%ebx), %ebx
- lea (%ebp,%ecx,M), %eax
- lea 4(up), up
- jmp L(enteven2)
-
- ALIGN(16)
-L(oop2):
- lea (%ecx,%eax,M), %ebp
- shr $RSH, %eax
- mov 4(up), %ecx
- add %edx, %edx
- lea 8(up), up
- mov (%ebx), %edx
- M4_inst %ebp, %edx
- lea (%eax,%ecx,M), %eax
- mov %edx, (rp)
-L(enteven2):
- mov 4(%ebx), %edx
- lea 8(%ebx), %ebx
- M4_inst %eax, %edx
- mov %edx, 4(rp)
- sbb %edx, %edx
- shr $RSH, %ecx
- lea 8(rp), rp
-L(entry2):
- mov (up), %eax
- decl GPARAM_SIZE
- jnz L(oop2)
-
- lea (%ecx,%eax,M), %ebp
- shr $RSH, %eax
- shr %edx
- mov (%ebx), %edx
- M4_inst %ebp, %edx
- mov %edx, (rp)
- mov SAVE_UP, up
- adc $0, %eax
- mov SAVE_EBP, %ebp
- mov SAVE_EBX, %ebx
- pop rp FRAME_popl()
- ret
-EPILOGUE()
-
-ASM_END()
diff --git a/gmp/mpn/x86/atom/bdiv_q_1.asm b/gmp/mpn/x86/atom/bdiv_q_1.asm
deleted file mode 100644
index 31e908ec44..0000000000
--- a/gmp/mpn/x86/atom/bdiv_q_1.asm
+++ /dev/null
@@ -1,35 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_bdiv_q_1 mpn_pi1_bdiv_q_1)
-include_mpn(`x86/pentium/bdiv_q_1.asm')
diff --git a/gmp/mpn/x86/atom/cnd_add_n.asm b/gmp/mpn/x86/atom/cnd_add_n.asm
deleted file mode 100644
index 50bf2ad64b..0000000000
--- a/gmp/mpn/x86/atom/cnd_add_n.asm
+++ /dev/null
@@ -1,113 +0,0 @@
-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/gmp/mpn/x86/atom/cnd_sub_n.asm b/gmp/mpn/x86/atom/cnd_sub_n.asm
deleted file mode 100644
index 221bedca37..0000000000
--- a/gmp/mpn/x86/atom/cnd_sub_n.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-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()
diff --git a/gmp/mpn/x86/atom/dive_1.asm b/gmp/mpn/x86/atom/dive_1.asm
deleted file mode 100644
index 71036a15a4..0000000000
--- a/gmp/mpn/x86/atom/dive_1.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_divexact_1 -- mpn by limb exact division.
-
-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')
-
-MULFUNC_PROLOGUE(mpn_divexact_1)
-include_mpn(`x86/pentium/dive_1.asm')
diff --git a/gmp/mpn/x86/atom/gmp-mparam.h b/gmp/mpn/x86/atom/gmp-mparam.h
deleted file mode 100644
index 45df12806c..0000000000
--- a/gmp/mpn/x86/atom/gmp-mparam.h
+++ /dev/null
@@ -1,201 +0,0 @@
-/* Intel Atom/32 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
-
-/* 1667 MHz Pineview (Atom D510) */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-14, gcc 4.5 */
-
-#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 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 31
-
-#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 74
-#define MUL_TOOM44_THRESHOLD 178
-#define MUL_TOOM6H_THRESHOLD 270
-#define MUL_TOOM8H_THRESHOLD 399
-
-#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 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 13
-#define SQRMOD_BNM1_THRESHOLD 18
-
-#define MUL_FFT_MODF_THRESHOLD 380 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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 150
-#define MUL_FFT_THRESHOLD 4544
-
-#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 340, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 12, 5}, { 25, 6}, { 21, 7}, { 11, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
- { 15, 7}, { 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 48
-#define MULLO_MUL_N_THRESHOLD 8907
-
-#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 38
-#define INV_NEWTON_THRESHOLD 246
-#define INV_APPR_THRESHOLD 246
-
-#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 1142
-#define MU_BDIV_Q_THRESHOLD 1334
-
-#define POWM_SEC_TABLE 1,22,98,416,1378
-
-#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 23
-#define SET_STR_DC_THRESHOLD 321
-#define SET_STR_PRECOMPUTE_THRESHOLD 1099
-
-#define FAC_DSC_THRESHOLD 198
-#define FAC_ODD_THRESHOLD 34
diff --git a/gmp/mpn/x86/atom/logops_n.asm b/gmp/mpn/x86/atom/logops_n.asm
deleted file mode 100644
index 3cb6d7310c..0000000000
--- a/gmp/mpn/x86/atom/logops_n.asm
+++ /dev/null
@@ -1,151 +0,0 @@
-dnl Intel Atom mpn_and_n,...,mpn_xnor_n -- bitwise logical operations.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 op nop opn
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 3 3.5 3.5
-C AMD K6
-C AMD K7
-C AMD K8
-C AMD K10
-
-define(M4_choose_op,
-`ifdef(`OPERATION_$1',`
-define(`M4_function', `mpn_$1')
-define(`M4_want_pre', `$4')
-define(`M4_inst', `$3')
-define(`M4_want_post',`$2')
-')')
-define(M4pre, `ifelse(M4_want_pre, yes,`$1')')
-define(M4post,`ifelse(M4_want_post,yes,`$1')')
-
-M4_choose_op( and_n, , andl, )
-M4_choose_op( andn_n, , andl, yes)
-M4_choose_op( nand_n, yes, andl, )
-M4_choose_op( ior_n, , orl, )
-M4_choose_op( iorn_n, , orl, yes)
-M4_choose_op( nior_n, yes, orl, )
-M4_choose_op( xor_n, , xorl, )
-M4_choose_op( xnor_n, yes, xorl, )
-
-ifdef(`M4_function',,
-`m4_error(`Unrecognised or undefined OPERATION symbol
-')')
-
-MULFUNC_PROLOGUE(mpn_and_n mpn_andn_n mpn_nand_n mpn_ior_n mpn_iorn_n mpn_nior_n mpn_xor_n mpn_xnor_n)
-
-C void M4_function (mp_ptr dst, mp_srcptr src2, mp_srcptr src1, mp_size_t size);
-C
-
-defframe(PARAM_SIZE, 16)
-defframe(PARAM_SRC1, 12)
-defframe(PARAM_SRC2, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(SAVE_RP,`PARAM_SIZE')
-define(SAVE_VP,`PARAM_SRC1')
-define(SAVE_UP,`PARAM_DST')
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`vp', `%ebx')
-define(`cnt', `%eax')
-define(`r1', `%ecx')
-define(`r2', `%edx')
-
-ASM_START()
- TEXT
- ALIGN(16)
-deflit(`FRAME',0)
-
-PROLOGUE(M4_function)
- mov PARAM_SIZE, cnt C size
- mov rp, SAVE_RP
- mov PARAM_DST, rp
- mov up, SAVE_UP
- mov PARAM_SRC1, up
- shr cnt C size >> 1
- mov vp, SAVE_VP
- mov PARAM_SRC2, vp
- mov (up), r1
- jz L(end) C size == 1
- jnc L(even) C size % 2 == 0
-
- ALIGN(16)
-L(oop):
-M4pre(` notl_or_xorl_GMP_NUMB_MASK(r1)')
- M4_inst (vp), r1
- lea 8(up), up
- mov -4(up), r2
-M4post(` notl_or_xorl_GMP_NUMB_MASK(r1)')
- lea 8(vp), vp
- mov r1, (rp)
-L(entry):
-M4pre(` notl_or_xorl_GMP_NUMB_MASK(r2)')
- M4_inst -4(vp), r2
- lea 8(rp), rp
-M4post(` notl_or_xorl_GMP_NUMB_MASK(r2)')
- dec cnt
- mov (up), r1
- mov r2, -4(rp)
- jnz L(oop)
-
-L(end):
-M4pre(` notl_or_xorl_GMP_NUMB_MASK(r1)')
- mov SAVE_UP, up
- M4_inst (vp), r1
-M4post(`notl_or_xorl_GMP_NUMB_MASK(r1)')
- mov SAVE_VP, vp
- mov r1, (rp)
- mov SAVE_RP, rp
- ret
-
-L(even):
- mov r1, r2
- lea 4(up), up
- lea 4(vp), vp
- lea -4(rp), rp
- jmp L(entry)
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/atom/lshift.asm b/gmp/mpn/x86/atom/lshift.asm
deleted file mode 100644
index f2c70dd3e8..0000000000
--- a/gmp/mpn/x86/atom/lshift.asm
+++ /dev/null
@@ -1,218 +0,0 @@
-dnl Intel Atom mpn_lshift -- mpn left shift.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C unsigned cnt);
-
-C cycles/limb
-C cnt!=1 cnt==1
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 5 2.5
-C AMD K6
-C AMD K7
-C AMD K8
-C AMD K10
-
-defframe(PARAM_CNT, 16)
-defframe(PARAM_SIZE,12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(SAVE_UP,`PARAM_CNT')
-define(VAR_COUNT,`PARAM_SIZE')
-define(SAVE_EBX,`PARAM_SRC')
-define(SAVE_EBP,`PARAM_DST')
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`cnt', `%ecx')
-
-ASM_START()
- TEXT
- ALIGN(8)
-deflit(`FRAME',0)
-PROLOGUE(mpn_lshift)
- mov PARAM_CNT, cnt
- mov PARAM_SIZE, %edx
- mov up, SAVE_UP
- mov PARAM_SRC, up
- push rp FRAME_pushl()
- mov PARAM_DST, rp
-
-C We can use faster code for shift-by-1 under certain conditions.
- cmp $1,cnt
- jne L(normal)
- cmpl rp, up
- jnc L(special) C jump if s_ptr + 1 >= res_ptr
- leal (up,%edx,4),%eax
- cmpl %eax,rp
- jnc L(special) C jump if res_ptr >= s_ptr + size
-
-L(normal):
- lea -4(up,%edx,4), up
- mov %ebx, SAVE_EBX
- lea -4(rp,%edx,4), rp
-
- shr %edx
- mov (up), %eax
- mov %edx, VAR_COUNT
- jnc L(evn)
-
- mov %eax, %ebx
- shl %cl, %ebx
- neg cnt
- shr %cl, %eax
- test %edx, %edx
- jnz L(gt1)
- mov %ebx, (rp)
- jmp L(quit)
-
-L(gt1): mov %ebp, SAVE_EBP
- push %eax
- mov -4(up), %eax
- mov %eax, %ebp
- shr %cl, %eax
- jmp L(lo1)
-
-L(evn): mov %ebp, SAVE_EBP
- neg cnt
- mov %eax, %ebp
- mov -4(up), %edx
- shr %cl, %eax
- mov %edx, %ebx
- shr %cl, %edx
- neg cnt
- decl VAR_COUNT
- lea 4(rp), rp
- lea -4(up), up
- jz L(end)
- push %eax FRAME_pushl()
-
- ALIGN(8)
-L(top): shl %cl, %ebp
- or %ebp, %edx
- shl %cl, %ebx
- neg cnt
- mov -4(up), %eax
- mov %eax, %ebp
- mov %edx, -4(rp)
- shr %cl, %eax
- lea -8(rp), rp
-L(lo1): mov -8(up), %edx
- or %ebx, %eax
- mov %edx, %ebx
- shr %cl, %edx
- lea -8(up), up
- neg cnt
- mov %eax, (rp)
- decl VAR_COUNT
- jg L(top)
-
- pop %eax FRAME_popl()
-L(end):
- shl %cl, %ebp
- shl %cl, %ebx
- or %ebp, %edx
- mov SAVE_EBP, %ebp
- mov %edx, -4(rp)
- mov %ebx, -8(rp)
-
-L(quit):
- mov SAVE_UP, up
- mov SAVE_EBX, %ebx
- pop rp FRAME_popl()
- ret
-
-L(special):
-deflit(`FRAME',4)
- lea 3(%edx), %eax C size + 3
- dec %edx C size - 1
- mov (up), %ecx
- shr $2, %eax C (size + 3) / 4
- and $3, %edx C (size - 1) % 4
- jz L(goloop) C jmp if size == 1 (mod 4)
- shr %edx
- jnc L(odd) C jum if size == 3 (mod 4)
-
- add %ecx, %ecx
- lea 4(up), up
- mov %ecx, (rp)
- mov (up), %ecx
- lea 4(rp), rp
-
- dec %edx
- jnz L(goloop) C jump if size == 0 (mod 4)
-L(odd): lea -8(up), up
- lea -8(rp), rp
- jmp L(sentry) C reached if size == 2 or 3 (mod 4)
-
-L(sloop):
- adc %ecx, %ecx
- mov 4(up), %edx
- mov %ecx, (rp)
- adc %edx, %edx
- mov 8(up), %ecx
- mov %edx, 4(rp)
-L(sentry):
- adc %ecx, %ecx
- mov 12(up), %edx
- mov %ecx, 8(rp)
- adc %edx, %edx
- lea 16(up), up
- mov %edx, 12(rp)
- lea 16(rp), rp
- mov (up), %ecx
-L(goloop):
- decl %eax
- jnz L(sloop)
-
-L(squit):
- adc %ecx, %ecx
- mov %ecx, (rp)
- adc %eax, %eax
-
- mov SAVE_UP, up
- pop rp FRAME_popl()
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/atom/lshiftc.asm b/gmp/mpn/x86/atom/lshiftc.asm
deleted file mode 100644
index 5be53ed19d..0000000000
--- a/gmp/mpn/x86/atom/lshiftc.asm
+++ /dev/null
@@ -1,159 +0,0 @@
-dnl Intel Atom mpn_lshiftc -- mpn left shift with complement.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 mp_limb_t mpn_lshiftc (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C unsigned cnt);
-
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 5.5
-C AMD K6
-C AMD K7
-C AMD K8
-C AMD K10
-
-defframe(PARAM_CNT, 16)
-defframe(PARAM_SIZE,12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(SAVE_UP,`PARAM_CNT')
-define(VAR_COUNT,`PARAM_SIZE')
-define(SAVE_EBX,`PARAM_SRC')
-define(SAVE_EBP,`PARAM_DST')
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`cnt', `%ecx')
-
-ASM_START()
- TEXT
-
-PROLOGUE(mpn_lshiftc)
-deflit(`FRAME',0)
- mov PARAM_CNT, cnt
- mov PARAM_SIZE, %edx
- mov up, SAVE_UP
- mov PARAM_SRC, up
- push rp FRAME_pushl()
- mov PARAM_DST, rp
-
- lea -4(up,%edx,4), up
- mov %ebx, SAVE_EBX
- lea -4(rp,%edx,4), rp
-
- shr %edx
- mov (up), %eax
- mov %edx, VAR_COUNT
- jnc L(evn)
-
- mov %eax, %ebx
- shl %cl, %ebx
- neg cnt
- shr %cl, %eax
- test %edx, %edx
- jnz L(gt1)
- not %ebx
- mov %ebx, (rp)
- jmp L(quit)
-
-L(gt1): mov %ebp, SAVE_EBP
- push %eax
- mov -4(up), %eax
- mov %eax, %ebp
- shr %cl, %eax
- jmp L(lo1)
-
-L(evn): mov %ebp, SAVE_EBP
- neg cnt
- mov %eax, %ebp
- mov -4(up), %edx
- shr %cl, %eax
- mov %edx, %ebx
- shr %cl, %edx
- neg cnt
- decl VAR_COUNT
- lea 4(rp), rp
- lea -4(up), up
- jz L(end)
- push %eax FRAME_pushl()
-
-L(top): shl %cl, %ebp
- or %ebp, %edx
- shl %cl, %ebx
- neg cnt
- not %edx
- mov -4(up), %eax
- mov %eax, %ebp
- mov %edx, -4(rp)
- shr %cl, %eax
- lea -8(rp), rp
-L(lo1): mov -8(up), %edx
- or %ebx, %eax
- mov %edx, %ebx
- shr %cl, %edx
- not %eax
- lea -8(up), up
- neg cnt
- mov %eax, (rp)
- decl VAR_COUNT
- jg L(top)
-
- pop %eax FRAME_popl()
-L(end):
- shl %cl, %ebp
- shl %cl, %ebx
- or %ebp, %edx
- mov SAVE_EBP, %ebp
- not %edx
- not %ebx
- mov %edx, -4(rp)
- mov %ebx, -8(rp)
-
-L(quit):
- mov SAVE_UP, up
- mov SAVE_EBX, %ebx
- pop rp FRAME_popl()
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/atom/mmx/copyd.asm b/gmp/mpn/x86/atom/mmx/copyd.asm
deleted file mode 100644
index b80fb033fe..0000000000
--- a/gmp/mpn/x86/atom/mmx/copyd.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_copyd -- copy limb vector, decrementing.
-
-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')
-
-MULFUNC_PROLOGUE(mpn_copyd)
-include_mpn(`x86/k7/mmx/copyd.asm')
diff --git a/gmp/mpn/x86/atom/mmx/copyi.asm b/gmp/mpn/x86/atom/mmx/copyi.asm
deleted file mode 100644
index 49b6b8d662..0000000000
--- a/gmp/mpn/x86/atom/mmx/copyi.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_copyi -- copy limb vector, incrementing.
-
-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')
-
-MULFUNC_PROLOGUE(mpn_copyi)
-include_mpn(`x86/k7/mmx/copyi.asm')
diff --git a/gmp/mpn/x86/atom/mmx/hamdist.asm b/gmp/mpn/x86/atom/mmx/hamdist.asm
deleted file mode 100644
index 3fe8253240..0000000000
--- a/gmp/mpn/x86/atom/mmx/hamdist.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_hamdist -- hamming distance.
-
-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')
-
-MULFUNC_PROLOGUE(mpn_hamdist)
-include_mpn(`x86/k7/mmx/popham.asm')
diff --git a/gmp/mpn/x86/atom/mod_34lsub1.asm b/gmp/mpn/x86/atom/mod_34lsub1.asm
deleted file mode 100644
index 6d57ba385d..0000000000
--- a/gmp/mpn/x86/atom/mod_34lsub1.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_mod_34lsub1 -- remainder modulo 2^24-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_mod_34lsub1)
-include_mpn(`x86/p6/mod_34lsub1.asm')
diff --git a/gmp/mpn/x86/atom/mode1o.asm b/gmp/mpn/x86/atom/mode1o.asm
deleted file mode 100644
index c9ee6bd2db..0000000000
--- a/gmp/mpn/x86/atom/mode1o.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_modexact_1_odd -- exact division style remainder.
-
-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')
-
-MULFUNC_PROLOGUE(mpn_modexact_1_odd mpn_modexact_1c_odd)
-include_mpn(`x86/pentium/mode1o.asm')
diff --git a/gmp/mpn/x86/atom/rshift.asm b/gmp/mpn/x86/atom/rshift.asm
deleted file mode 100644
index 1cb5dbefe9..0000000000
--- a/gmp/mpn/x86/atom/rshift.asm
+++ /dev/null
@@ -1,152 +0,0 @@
-dnl Intel Atom mpn_rshift -- mpn right shift.
-
-dnl Copyright 2011 Free Software Foundation, Inc.
-
-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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C unsigned cnt);
-
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 5
-C AMD K6
-C AMD K7
-C AMD K8
-C AMD K10
-
-defframe(PARAM_CNT, 16)
-defframe(PARAM_SIZE,12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(SAVE_UP,`PARAM_CNT')
-define(VAR_COUNT,`PARAM_SIZE')
-define(SAVE_EBX,`PARAM_SRC')
-define(SAVE_EBP,`PARAM_DST')
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`cnt', `%ecx')
-
-ASM_START()
- TEXT
- ALIGN(8)
-deflit(`FRAME',0)
-PROLOGUE(mpn_rshift)
- mov PARAM_CNT, cnt
- mov PARAM_SIZE, %edx
- mov up, SAVE_UP
- mov PARAM_SRC, up
- push rp FRAME_pushl()
- mov PARAM_DST, rp
- mov %ebx, SAVE_EBX
-
- shr %edx
- mov (up), %eax
- mov %edx, VAR_COUNT
- jnc L(evn)
-
- mov %eax, %ebx
- shr %cl, %ebx
- neg cnt
- shl %cl, %eax
- test %edx, %edx
- jnz L(gt1)
- mov %ebx, (rp)
- jmp L(quit)
-
-L(gt1): mov %ebp, SAVE_EBP
- push %eax
- mov 4(up), %eax
- mov %eax, %ebp
- shl %cl, %eax
- jmp L(lo1)
-
-L(evn): mov %ebp, SAVE_EBP
- neg cnt
- mov %eax, %ebp
- mov 4(up), %edx
- shl %cl, %eax
- mov %edx, %ebx
- shl %cl, %edx
- neg cnt
- decl VAR_COUNT
- lea -4(rp), rp
- lea 4(up), up
- jz L(end)
- push %eax FRAME_pushl()
-
- ALIGN(8)
-L(top): shr %cl, %ebp
- or %ebp, %edx
- shr %cl, %ebx
- neg cnt
- mov 4(up), %eax
- mov %eax, %ebp
- mov %edx, 4(rp)
- shl %cl, %eax
- lea 8(rp), rp
-L(lo1): mov 8(up), %edx
- or %ebx, %eax
- mov %edx, %ebx
- shl %cl, %edx
- lea 8(up), up
- neg cnt
- mov %eax, (rp)
- decl VAR_COUNT
- jg L(top)
-
- pop %eax FRAME_popl()
-L(end):
- shr %cl, %ebp
- shr %cl, %ebx
- or %ebp, %edx
- mov SAVE_EBP, %ebp
- mov %edx, 4(rp)
- mov %ebx, 8(rp)
-
-L(quit):
- mov SAVE_UP, up
- mov SAVE_EBX, %ebx
- pop rp FRAME_popl()
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/atom/sse2/aorsmul_1.asm b/gmp/mpn/x86/atom/sse2/aorsmul_1.asm
deleted file mode 100644
index 969a14a919..0000000000
--- a/gmp/mpn/x86/atom/sse2/aorsmul_1.asm
+++ /dev/null
@@ -1,174 +0,0 @@
-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 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 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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 8
-C AMD K6
-C AMD K7 -
-C AMD K8
-C AMD K10
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`n', `%ecx')
-
-ifdef(`OPERATION_addmul_1',`
- define(ADDSUB, add)
- define(func_1, mpn_addmul_1)
- define(func_1c, mpn_addmul_1c)')
-ifdef(`OPERATION_submul_1',`
- define(ADDSUB, sub)
- define(func_1, mpn_submul_1)
- define(func_1c, mpn_submul_1c)')
-
-MULFUNC_PROLOGUE(mpn_addmul_1 mpn_addmul_1c mpn_submul_1 mpn_submul_1c)
-
- TEXT
- ALIGN(16)
-PROLOGUE(func_1)
- xor %edx, %edx
-L(ent): push %edi
- push %esi
- push %ebx
- mov 16(%esp), rp
- mov 20(%esp), up
- mov 24(%esp), n
- movd 28(%esp), %mm7
- test $1, n
- jz L(fi0or2)
- movd (up), %mm0
- pmuludq %mm7, %mm0
- shr $2, n
- jnc L(fi1)
-
-L(fi3): lea -8(up), up
- lea -8(rp), rp
- movd 12(up), %mm1
- movd %mm0, %ebx
- pmuludq %mm7, %mm1
- add $1, n C increment and clear carry
- jmp L(lo3)
-
-L(fi1): movd %mm0, %ebx
- jz L(wd1)
- movd 4(up), %mm1
- pmuludq %mm7, %mm1
- jmp L(lo1)
-
-L(fi0or2):
- movd (up), %mm1
- pmuludq %mm7, %mm1
- shr $2, n
- movd 4(up), %mm0
- jc L(fi2)
- lea -4(up), up
- lea -4(rp), rp
- movd %mm1, %eax
- pmuludq %mm7, %mm0
- jmp L(lo0)
-
-L(fi2): lea 4(up), up
- add $1, n C increment and clear carry
- movd %mm1, %eax
- lea -12(rp), rp
- jmp L(lo2)
-
-C ALIGN(16) C alignment seems irrelevant
-L(top): movd 4(up), %mm1
- adc $0, %edx
- ADDSUB %eax, 12(rp)
- movd %mm0, %ebx
- pmuludq %mm7, %mm1
- lea 16(rp), rp
-L(lo1): psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- ADDSUB %ebx, (rp)
-L(lo0): psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- movd %mm0, %ebx
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- ADDSUB %eax, 4(rp)
-L(lo3): psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- ADDSUB %ebx, 8(rp)
-L(lo2): psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- dec n
- jnz L(top)
-
-L(end): adc n, %edx C n is zero here
- ADDSUB %eax, 12(rp)
- movd %mm0, %ebx
- lea 16(rp), rp
-L(wd1): psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %eax
- adc n, %eax
- ADDSUB %ebx, (rp)
- emms
- adc n, %eax
- pop %ebx
- pop %esi
- pop %edi
- ret
-EPILOGUE()
-PROLOGUE(func_1c)
- mov 20(%esp), %edx C carry
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86/atom/sse2/bdiv_dbm1c.asm b/gmp/mpn/x86/atom/sse2/bdiv_dbm1c.asm
deleted file mode 100644
index 782e914019..0000000000
--- a/gmp/mpn/x86/atom/sse2/bdiv_dbm1c.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_bdiv_dbm1.
-
-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')
-
-MULFUNC_PROLOGUE(mpn_bdiv_dbm1c)
-include_mpn(`x86/pentium4/sse2/bdiv_dbm1c.asm')
diff --git a/gmp/mpn/x86/atom/sse2/divrem_1.asm b/gmp/mpn/x86/atom/sse2/divrem_1.asm
deleted file mode 100644
index f84709a22e..0000000000
--- a/gmp/mpn/x86/atom/sse2/divrem_1.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_divrem_1 -- mpn by limb division.
-
-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')
-
-MULFUNC_PROLOGUE(mpn_preinv_divrem_1 mpn_divrem_1c mpn_divrem_1)
-include_mpn(`x86/pentium4/sse2/divrem_1.asm')
diff --git a/gmp/mpn/x86/atom/sse2/mod_1_1.asm b/gmp/mpn/x86/atom/sse2/mod_1_1.asm
deleted file mode 100644
index ae6581d9b6..0000000000
--- a/gmp/mpn/x86/atom/sse2/mod_1_1.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom/SSE2 mpn_mod_1_1.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_mod_1_1p)
-include_mpn(`x86/pentium4/sse2/mod_1_1.asm')
diff --git a/gmp/mpn/x86/atom/sse2/mod_1_4.asm b/gmp/mpn/x86/atom/sse2/mod_1_4.asm
deleted file mode 100644
index 31faa3f0a3..0000000000
--- a/gmp/mpn/x86/atom/sse2/mod_1_4.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom/SSE2 mpn_mod_1_4.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_mod_1s_4p)
-include_mpn(`x86/pentium4/sse2/mod_1_4.asm')
diff --git a/gmp/mpn/x86/atom/sse2/mul_1.asm b/gmp/mpn/x86/atom/sse2/mul_1.asm
deleted file mode 100644
index aa3bb974bb..0000000000
--- a/gmp/mpn/x86/atom/sse2/mul_1.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-dnl Intel Atom mpn_mul_1.
-
-dnl Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-
-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 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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 7.5
-C AMD K6 -
-C AMD K7 -
-C AMD K8
-C AMD K10
-
-defframe(PARAM_CARRY,20)
-defframe(PARAM_MUL, 16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-define(`rp', `%edx')
-define(`up', `%esi')
-define(`n', `%ecx')
-
-ASM_START()
- TEXT
- ALIGN(16)
-deflit(`FRAME',0)
-
-PROLOGUE(mpn_mul_1c)
- movd PARAM_CARRY, %mm6 C carry
- jmp L(ent)
-EPILOGUE()
-
- ALIGN(8) C for compact code
-PROLOGUE(mpn_mul_1)
- pxor %mm6, %mm6
-L(ent): push %esi FRAME_pushl()
- mov PARAM_SRC, up
- mov PARAM_SIZE, %eax C size
- movd PARAM_MUL, %mm7
- movd (up), %mm0
- mov %eax, n
- and $3, %eax
- pmuludq %mm7, %mm0
- mov PARAM_DST, rp
- jz L(lo0)
- cmp $2, %eax
- lea -16(up,%eax,4),up
- lea -16(rp,%eax,4),rp
- jc L(lo1)
- jz L(lo2)
- jmp L(lo3)
-
- ALIGN(16)
-L(top): movd (up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
-L(lo0): paddq %mm0, %mm6
- movd 4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, (rp)
- psrlq $32, %mm6
-L(lo3): paddq %mm0, %mm6
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 4(rp)
- psrlq $32, %mm6
-L(lo2): paddq %mm0, %mm6
- movd 12(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 8(rp)
- psrlq $32, %mm6
-L(lo1): paddq %mm0, %mm6
- sub $4, n
- movd %mm6, 12(rp)
- lea 16(up), up
- ja L(top)
-
- psrlq $32, %mm6
- movd %mm6, %eax
- emms
- pop %esi FRAME_popl()
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/atom/sse2/mul_basecase.asm b/gmp/mpn/x86/atom/sse2/mul_basecase.asm
deleted file mode 100644
index 97d3aeb5ad..0000000000
--- a/gmp/mpn/x86/atom/sse2/mul_basecase.asm
+++ /dev/null
@@ -1,501 +0,0 @@
-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 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 TODO
-C * Check if 'jmp N(%esp)' is well-predicted enough to allow us to combine the
-C 4 large loops into one; we could use it for the outer loop branch.
-C * Optimise code outside of inner loops.
-C * Write combined addmul_1 feed-in a wind-down code, and use when iterating
-C outer each loop. ("Overlapping software pipelining")
-C * Postpone push of ebx until we know vn > 1. Perhaps use caller-saves regs
-C for inlined mul_1, allowing us to postpone all pushes.
-C * Perhaps write special code for vn <= un < M, for some small M.
-
-C void mpn_mul_basecase (mp_ptr wp,
-C mp_srcptr xp, mp_size_t xn,
-C mp_srcptr yp, mp_size_t yn);
-C
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`un', `%ecx')
-define(`vp', `%ebp')
-define(`vn', `36(%esp)')
-
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mul_basecase)
- push %edi
- push %esi
- push %ebx
- push %ebp
- mov 20(%esp), rp
- mov 24(%esp), up
- mov 28(%esp), un
- mov 32(%esp), vp
-
- movd (up), %mm0
- movd (vp), %mm7
- pmuludq %mm7, %mm0
- pxor %mm6, %mm6
-
- mov un, %eax
- and $3, %eax
- jz L(of0)
- cmp $2, %eax
- jc L(of1)
- jz L(of2)
-
-C ================================================================
- jmp L(m3)
- ALIGN(16)
-L(lm3): movd -4(up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
- paddq %mm0, %mm6
- movd (up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -4(rp)
- psrlq $32, %mm6
-L(m3): paddq %mm0, %mm6
- movd 4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, (rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 4(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- sub $4, un
- movd %mm6, 8(rp)
- lea 16(up), up
- ja L(lm3)
-
- psrlq $32, %mm6
- movd %mm6, 12(rp)
-
- decl vn
- jz L(done)
- lea -8(rp), rp
-
-L(ol3): mov 28(%esp), un
- neg un
- lea 4(vp), vp
- movd (vp), %mm7 C read next V limb
- mov 24(%esp), up
- lea 16(rp,un,4), rp
-
- movd (up), %mm0
- pmuludq %mm7, %mm0
- sar $2, un
- movd 4(up), %mm1
- movd %mm0, %ebx
- pmuludq %mm7, %mm1
- lea -8(up), up
- xor %edx, %edx C zero edx and CF
- jmp L(a3)
-
-L(la3): movd 4(up), %mm1
- adc $0, %edx
- add %eax, 12(rp)
- movd %mm0, %ebx
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %ebx, (rp)
- psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- movd %mm0, %ebx
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %eax, 4(rp)
-L(a3): psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %ebx, 8(rp)
- psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- jnz L(la3)
-
- adc un, %edx C un is zero here
- add %eax, 12(rp)
- movd %mm0, %ebx
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %eax
- adc un, %eax
- add %ebx, 16(rp)
- adc un, %eax
- mov %eax, 20(rp)
-
- decl vn
- jnz L(ol3)
- jmp L(done)
-
-C ================================================================
- ALIGN(16)
-L(lm0): movd (up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
-L(of0): paddq %mm0, %mm6
- movd 4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, (rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 4(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd 12(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 8(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- sub $4, un
- movd %mm6, 12(rp)
- lea 16(up), up
- ja L(lm0)
-
- psrlq $32, %mm6
- movd %mm6, 16(rp)
-
- decl vn
- jz L(done)
- lea -4(rp), rp
-
-L(ol0): mov 28(%esp), un
- neg un
- lea 4(vp), vp
- movd (vp), %mm7 C read next V limb
- mov 24(%esp), up
- lea 20(rp,un,4), rp
-
- movd (up), %mm1
- pmuludq %mm7, %mm1
- sar $2, un
- movd 4(up), %mm0
- lea -4(up), up
- movd %mm1, %eax
- pmuludq %mm7, %mm0
- xor %edx, %edx C zero edx and CF
- jmp L(a0)
-
-L(la0): movd 4(up), %mm1
- adc $0, %edx
- add %eax, 12(rp)
- movd %mm0, %ebx
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %ebx, (rp)
-L(a0): psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- movd %mm0, %ebx
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %eax, 4(rp)
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %ebx, 8(rp)
- psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- jnz L(la0)
-
- adc un, %edx C un is zero here
- add %eax, 12(rp)
- movd %mm0, %ebx
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %eax
- adc un, %eax
- add %ebx, 16(rp)
- adc un, %eax
- mov %eax, 20(rp)
-
- decl vn
- jnz L(ol0)
- jmp L(done)
-
-C ================================================================
- ALIGN(16)
-L(lm1): movd -12(up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
- paddq %mm0, %mm6
- movd -8(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -12(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd -4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -8(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd (up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -4(rp)
- psrlq $32, %mm6
-L(of1): paddq %mm0, %mm6
- sub $4, un
- movd %mm6, (rp)
- lea 16(up), up
- ja L(lm1)
-
- psrlq $32, %mm6
- movd %mm6, 4(rp)
-
- decl vn
- jz L(done)
- lea -16(rp), rp
-
-L(ol1): mov 28(%esp), un
- neg un
- lea 4(vp), vp
- movd (vp), %mm7 C read next V limb
- mov 24(%esp), up
- lea 24(rp,un,4), rp
-
- movd (up), %mm0
- pmuludq %mm7, %mm0
- sar $2, un
- movd %mm0, %ebx
- movd 4(up), %mm1
- pmuludq %mm7, %mm1
- xor %edx, %edx C zero edx and CF
- inc un
- jmp L(a1)
-
-L(la1): movd 4(up), %mm1
- adc $0, %edx
- add %eax, 12(rp)
- movd %mm0, %ebx
- pmuludq %mm7, %mm1
- lea 16(rp), rp
-L(a1): psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %ebx, (rp)
- psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- movd %mm0, %ebx
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %eax, 4(rp)
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %ebx, 8(rp)
- psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- jnz L(la1)
-
- adc un, %edx C un is zero here
- add %eax, 12(rp)
- movd %mm0, %ebx
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %eax
- adc un, %eax
- add %ebx, 16(rp)
- adc un, %eax
- mov %eax, 20(rp)
-
- decl vn
- jnz L(ol1)
- jmp L(done)
-
-C ================================================================
- ALIGN(16)
-L(lm2): movd -8(up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
- paddq %mm0, %mm6
- movd -4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -8(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd (up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -4(rp)
- psrlq $32, %mm6
-L(of2): paddq %mm0, %mm6
- movd 4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, (rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- sub $4, un
- movd %mm6, 4(rp)
- lea 16(up), up
- ja L(lm2)
-
- psrlq $32, %mm6
- movd %mm6, 8(rp)
-
- decl vn
- jz L(done)
- lea -12(rp), rp
-
-L(ol2): mov 28(%esp), un
- neg un
- lea 4(vp), vp
- movd (vp), %mm7 C read next V limb
- mov 24(%esp), up
- lea 12(rp,un,4), rp
-
- movd (up), %mm1
- pmuludq %mm7, %mm1
- sar $2, un
- movd 4(up), %mm0
- lea 4(up), up
- movd %mm1, %eax
- xor %edx, %edx C zero edx and CF
- jmp L(lo2)
-
-L(la2): movd 4(up), %mm1
- adc $0, %edx
- add %eax, 12(rp)
- movd %mm0, %ebx
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %ebx, (rp)
- psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- movd %mm0, %ebx
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %eax, 4(rp)
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %edx
- movd %mm1, %eax
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %ebx, 8(rp)
-L(lo2): psrlq $32, %mm1
- adc %edx, %eax
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- jnz L(la2)
-
- adc un, %edx C un is zero here
- add %eax, 12(rp)
- movd %mm0, %ebx
- psrlq $32, %mm0
- adc %edx, %ebx
- movd %mm0, %eax
- adc un, %eax
- add %ebx, 16(rp)
- adc un, %eax
- mov %eax, 20(rp)
-
- decl vn
- jnz L(ol2)
-C jmp L(done)
-
-C ================================================================
-L(done):
- emms
- pop %ebp
- pop %ebx
- pop %esi
- pop %edi
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86/atom/sse2/popcount.asm b/gmp/mpn/x86/atom/sse2/popcount.asm
deleted file mode 100644
index 7847aec8e6..0000000000
--- a/gmp/mpn/x86/atom/sse2/popcount.asm
+++ /dev/null
@@ -1,35 +0,0 @@
-dnl Intel Atom mpn_popcount -- population count.
-
-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')
-
-
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86/pentium4/sse2/popcount.asm')
diff --git a/gmp/mpn/x86/atom/sse2/sqr_basecase.asm b/gmp/mpn/x86/atom/sse2/sqr_basecase.asm
deleted file mode 100644
index af19ed854d..0000000000
--- a/gmp/mpn/x86/atom/sse2/sqr_basecase.asm
+++ /dev/null
@@ -1,634 +0,0 @@
-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 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 TODO
-C * Check if 'jmp N(%esp)' is well-predicted enough to allow us to combine the
-C 4 large loops into one; we could use it for the outer loop branch.
-C * Optimise code outside of inner loops.
-C * Write combined addmul_1 feed-in a wind-down code, and use when iterating
-C outer each loop. ("Overlapping software pipelining")
-C * Perhaps use caller-saves regs for inlined mul_1, allowing us to postpone
-C all pushes.
-C * Perhaps write special code for n < M, for some small M.
-C * Replace inlined addmul_1 with smaller code from aorsmul_1.asm, or perhaps
-C with even less pipelined code.
-C * We run the outer loop until we have a 2-limb by 1-limb addmul_1 left.
-C Consider breaking out earlier, saving high the cost of short loops.
-
-C void mpn_sqr_basecase (mp_ptr wp,
-C mp_srcptr xp, mp_size_t xn);
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`n', `%ecx')
-
-define(`un', `%ebp')
-
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_sqr_basecase)
- push %edi
- push %esi
- mov 12(%esp), rp
- mov 16(%esp), up
- mov 20(%esp), n
-
- lea 4(rp), rp C write triangular product starting at rp[1]
- dec n
- movd (up), %mm7
-
- jz L(one)
- lea 4(up), up
- push %ebx
- push %ebp
- mov n, %eax
-
- movd (up), %mm0
- neg n
- pmuludq %mm7, %mm0
- pxor %mm6, %mm6
- mov n, un
-
- and $3, %eax
- jz L(of0)
- cmp $2, %eax
- jc L(of1)
- jz L(of2)
-
-C ================================================================
- jmp L(m3)
- ALIGN(16)
-L(lm3): movd -4(up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
- paddq %mm0, %mm6
- movd (up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -4(rp)
- psrlq $32, %mm6
-L(m3): paddq %mm0, %mm6
- movd 4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, (rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 4(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- add $4, un
- movd %mm6, 8(rp)
- lea 16(up), up
- js L(lm3)
-
- psrlq $32, %mm6
- movd %mm6, 12(rp)
-
- inc n
-C jz L(done)
- lea -12(up), up
- lea 4(rp), rp
- jmp L(ol2)
-
-C ================================================================
- ALIGN(16)
-L(lm0): movd (up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
-L(of0): paddq %mm0, %mm6
- movd 4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, (rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 4(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd 12(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, 8(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- add $4, un
- movd %mm6, 12(rp)
- lea 16(up), up
- js L(lm0)
-
- psrlq $32, %mm6
- movd %mm6, 16(rp)
-
- inc n
-C jz L(done)
- lea -8(up), up
- lea 8(rp), rp
- jmp L(ol3)
-
-C ================================================================
- ALIGN(16)
-L(lm1): movd -12(up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
- paddq %mm0, %mm6
- movd -8(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -12(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd -4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -8(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd (up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -4(rp)
- psrlq $32, %mm6
-L(of1): paddq %mm0, %mm6
- add $4, un
- movd %mm6, (rp)
- lea 16(up), up
- js L(lm1)
-
- psrlq $32, %mm6
- movd %mm6, 4(rp)
-
- inc n
- jz L(done) C goes away when we add special n=2 code
- lea -20(up), up
- lea -4(rp), rp
- jmp L(ol0)
-
-C ================================================================
- ALIGN(16)
-L(lm2): movd -8(up), %mm0
- pmuludq %mm7, %mm0
- psrlq $32, %mm6
- lea 16(rp), rp
- paddq %mm0, %mm6
- movd -4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -8(rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- movd (up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, -4(rp)
- psrlq $32, %mm6
-L(of2): paddq %mm0, %mm6
- movd 4(up), %mm0
- pmuludq %mm7, %mm0
- movd %mm6, (rp)
- psrlq $32, %mm6
- paddq %mm0, %mm6
- add $4, un
- movd %mm6, 4(rp)
- lea 16(up), up
- js L(lm2)
-
- psrlq $32, %mm6
- movd %mm6, 8(rp)
-
- inc n
-C jz L(done)
- lea -16(up), up
-C lea (rp), rp
-C jmp L(ol1)
-
-C ================================================================
-
-L(ol1): lea 4(up,n,4), up
- movd (up), %mm7 C read next U invariant limb
- lea 8(rp,n,4), rp
- mov n, un
-
- movd 4(up), %mm1
- pmuludq %mm7, %mm1
- sar $2, un
- movd %mm1, %ebx
- inc un
- jz L(re1)
-
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- xor %edx, %edx C zero edx and CF
- jmp L(a1)
-
-L(la1): adc $0, %edx
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %eax, (rp)
-L(a1): psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- movd %mm0, %eax
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %ebx, 4(rp)
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %eax, 8(rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- movd 4(up), %mm1
- jnz L(la1)
-
- adc un, %edx C un is zero here
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- adc un, %edx
- add %eax, (rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %eax
- adc un, %eax
- add %ebx, 4(rp)
- adc un, %eax
- mov %eax, 8(rp)
-
- inc n
-
-C ================================================================
-
-L(ol0): lea (up,n,4), up
- movd 4(up), %mm7 C read next U invariant limb
- lea 4(rp,n,4), rp
- mov n, un
-
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- sar $2, un
- movd 12(up), %mm1
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- xor %edx, %edx C zero edx and CF
- jmp L(a0)
-
-L(la0): adc $0, %edx
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %eax, (rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- movd %mm0, %eax
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %ebx, 4(rp)
-L(a0): psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %eax, 8(rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- movd 4(up), %mm1
- jnz L(la0)
-
- adc un, %edx C un is zero here
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- adc un, %edx
- add %eax, (rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %eax
- adc un, %eax
- add %ebx, 4(rp)
- adc un, %eax
- mov %eax, 8(rp)
-
- inc n
-
-C ================================================================
-
-L(ol3): lea 12(up,n,4), up
- movd -8(up), %mm7 C read next U invariant limb
- lea (rp,n,4), rp C put rp back
- mov n, un
-
- movd -4(up), %mm1
- pmuludq %mm7, %mm1
- sar $2, un
- movd %mm1, %ebx
- movd (up), %mm0
- xor %edx, %edx C zero edx and CF
- jmp L(a3)
-
-L(la3): adc $0, %edx
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %eax, (rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- movd %mm0, %eax
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %ebx, 4(rp)
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %eax, 8(rp)
-L(a3): psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- movd 4(up), %mm1
- jnz L(la3)
-
- adc un, %edx C un is zero here
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- adc un, %edx
- add %eax, (rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %eax
- adc un, %eax
- add %ebx, 4(rp)
- adc un, %eax
- mov %eax, 8(rp)
-
- inc n
-
-C ================================================================
-
-L(ol2): lea 8(up,n,4), up
- movd -4(up), %mm7 C read next U invariant limb
- lea 12(rp,n,4), rp
- mov n, un
-
- movd (up), %mm0
- pmuludq %mm7, %mm0
- xor %edx, %edx
- sar $2, un
- movd 4(up), %mm1
- test un, un C clear carry
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- inc un
- jnz L(a2)
- jmp L(re2)
-
-L(la2): adc $0, %edx
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
-L(a2): psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- movd 8(up), %mm0
- pmuludq %mm7, %mm0
- adc $0, %edx
- add %eax, (rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- movd %mm0, %eax
- movd 12(up), %mm1
- pmuludq %mm7, %mm1
- adc $0, %edx
- add %ebx, 4(rp)
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- lea 16(up), up
- movd (up), %mm0
- adc $0, %edx
- add %eax, 8(rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %edx
- pmuludq %mm7, %mm0
- inc un
- movd 4(up), %mm1
- jnz L(la2)
-
- adc un, %edx C un is zero here
- add %ebx, 12(rp)
- movd %mm0, %eax
- pmuludq %mm7, %mm1
- lea 16(rp), rp
- psrlq $32, %mm0
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- adc un, %edx
- add %eax, (rp)
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %eax
- adc un, %eax
- add %ebx, 4(rp)
- adc un, %eax
- mov %eax, 8(rp)
-
- inc n
- jmp L(ol1)
-
-C ================================================================
-L(re2): psrlq $32, %mm0
- movd (up), %mm7 C read next U invariant limb
- adc %edx, %eax
- movd %mm0, %edx
- movd %mm1, %ebx
- adc un, %edx
- add %eax, (rp)
- lea 4(rp), rp
- psrlq $32, %mm1
- adc %edx, %ebx
- movd %mm1, %eax
- movd 4(up), %mm1
- adc un, %eax
- add %ebx, (rp)
- pmuludq %mm7, %mm1
- adc un, %eax
- mov %eax, 4(rp)
- movd %mm1, %ebx
-
-L(re1): psrlq $32, %mm1
- add %ebx, 4(rp)
- movd %mm1, %eax
- adc un, %eax
- xor n, n C make n zeroness assumption below true
- mov %eax, 8(rp)
-
-L(done): C n is zero here
- mov 24(%esp), up
- mov 28(%esp), %eax
-
- movd (up), %mm0
- inc %eax
- pmuludq %mm0, %mm0
- lea 4(up), up
- mov 20(%esp), rp
- shr %eax
- movd %mm0, (rp)
- psrlq $32, %mm0
- lea -12(rp), rp
- mov %eax, 28(%esp)
- jnc L(odd)
-
- movd %mm0, %ebp
- movd (up), %mm0
- lea 8(rp), rp
- pmuludq %mm0, %mm0
- lea -4(up), up
- add 8(rp), %ebp
- movd %mm0, %edx
- adc 12(rp), %edx
- rcr n
- jmp L(ent)
-
-C ALIGN(16) C alignment seems irrelevant
-L(top): movd (up), %mm1
- adc n, n
- movd %mm0, %eax
- pmuludq %mm1, %mm1
- movd 4(up), %mm0
- adc (rp), %eax
- movd %mm1, %ebx
- pmuludq %mm0, %mm0
- psrlq $32, %mm1
- adc 4(rp), %ebx
- movd %mm1, %ebp
- movd %mm0, %edx
- adc 8(rp), %ebp
- adc 12(rp), %edx
- rcr n C FIXME: isn't this awfully slow on atom???
- adc %eax, (rp)
- adc %ebx, 4(rp)
-L(ent): lea 8(up), up
- adc %ebp, 8(rp)
- psrlq $32, %mm0
- adc %edx, 12(rp)
-L(odd): decl 28(%esp)
- lea 16(rp), rp
- jnz L(top)
-
-L(end): adc n, n
- movd %mm0, %eax
- adc n, %eax
- mov %eax, (rp)
-
-L(rtn): emms
- pop %ebp
- pop %ebx
- pop %esi
- pop %edi
- ret
-
-L(one): pmuludq %mm7, %mm7
- movq %mm7, -4(rp)
- emms
- pop %esi
- pop %edi
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86/atom/sublsh1_n.asm b/gmp/mpn/x86/atom/sublsh1_n.asm
deleted file mode 100644
index d3e7e5b5cb..0000000000
--- a/gmp/mpn/x86/atom/sublsh1_n.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel Atom mpn_sublsh1_n -- rp[] = up[] - (vp[] << 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_sublsh1_n_ip1)
-include_mpn(`x86/k7/sublsh1_n.asm')
diff --git a/gmp/mpn/x86/atom/sublsh2_n.asm b/gmp/mpn/x86/atom/sublsh2_n.asm
deleted file mode 100644
index 79405cf9f4..0000000000
--- a/gmp/mpn/x86/atom/sublsh2_n.asm
+++ /dev/null
@@ -1,57 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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, 30)
-
-ifdef(`OPERATION_addlsh2_n', `
- define(M4_inst, adcl)
- define(M4_opp, subl)
- define(M4_function, mpn_addlsh2_n)
- define(M4_function_c, mpn_addlsh2_nc)
- define(M4_ip_function_c, mpn_addlsh2_nc_ip1)
- define(M4_ip_function, mpn_addlsh2_n_ip1)
-',`ifdef(`OPERATION_sublsh2_n', `
- define(M4_inst, sbbl)
- define(M4_opp, addl)
- define(M4_function, mpn_sublsh2_n)
- define(M4_function_c, mpn_sublsh2_nc)
- define(M4_ip_function_c, mpn_sublsh2_nc_ip1)
- define(M4_ip_function, mpn_sublsh2_n_ip1)
-',`m4_error(`Need OPERATION_addlsh2_n or OPERATION_sublsh2_n
-')')')
-
-MULFUNC_PROLOGUE(mpn_sublsh2_n mpn_sublsh2_nc mpn_sublsh2_n_ip1 mpn_sublsh2_nc_ip1)
-
-include_mpn(`x86/atom/aorslshC_n.asm')
diff --git a/gmp/mpn/x86/bd1/gmp-mparam.h b/gmp/mpn/x86/bd1/gmp-mparam.h
deleted file mode 100644
index 7d80a1cb4c..0000000000
--- a/gmp/mpn/x86/bd1/gmp-mparam.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* 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/gmp/mpn/x86/bd2/gmp-mparam.h b/gmp/mpn/x86/bd2/gmp-mparam.h
deleted file mode 100644
index c5a53f2f9f..0000000000
--- a/gmp/mpn/x86/bd2/gmp-mparam.h
+++ /dev/null
@@ -1,209 +0,0 @@
-/* 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
diff --git a/gmp/mpn/x86/bdiv_dbm1c.asm b/gmp/mpn/x86/bdiv_dbm1c.asm
index 0288c475cd..dbee28fd94 100644
--- a/gmp/mpn/x86/bdiv_dbm1c.asm
+++ b/gmp/mpn/x86/bdiv_dbm1c.asm
@@ -1,51 +1,32 @@
dnl x86 mpn_bdiv_dbm1.
-dnl Copyright 2008, 2011 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
-include(`../config.m4')
+dnl You should have received 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 P5
-C P6 model 0-8,10-12)
-C P6 model 9 (Banias)
-C P6 model 13 (Dothan) 5.1
-C P4 model 0 (Willamette)
-C P4 model 1 (?)
-C P4 model 2 (Northwood) 13.67
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom
-C AMD K6
-C AMD K7 3.5
-C AMD K8
-C AMD K10
+include(`../config.m4')
+C cycles/limb
+C K7: 3.5
+C P4 m0: ?
+C P4 m1: ?
+C P4 m2: 13.67
+C P4 m3: ?
+C P4 m4: ?
+C P6-13: 5.1
C TODO
C * Optimize for more x86 processors
@@ -76,17 +57,18 @@ PROLOGUE(mpn_bdiv_dbm1c)
cmp $2, %eax
jc L(b1)
jz L(b2)
-
-L(b3): lea -8(%esi), %esi
- lea 8(%edi), %edi
- add $-3, %ebp
- jmp L(3)
+ jmp L(b3)
L(b0): mov 4(%esi), %eax
lea -4(%esi), %esi
lea 12(%edi), %edi
add $-4, %ebp
jmp L(0)
+L(b3):
+ lea -8(%esi), %esi
+ lea 8(%edi), %edi
+ add $-3, %ebp
+ jmp L(3)
L(b2): mov 4(%esi), %eax
lea 4(%esi), %esi
@@ -95,7 +77,8 @@ L(b2): mov 4(%esi), %eax
jmp L(2)
ALIGN(8)
-L(top): mov 4(%esi), %eax
+L(top):
+ mov 4(%esi), %eax
mul %ecx
lea 16(%edi), %edi
sub %eax, %ebx
diff --git a/gmp/mpn/x86/bdiv_q_1.asm b/gmp/mpn/x86/bdiv_q_1.asm
deleted file mode 100644
index 825cd296a1..0000000000
--- a/gmp/mpn/x86/bdiv_q_1.asm
+++ /dev/null
@@ -1,208 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 P54 30.0
-C P55 29.0
-C P6 13.0 odd divisor, 12.0 even (strangely)
-C K6 14.0
-C K7 12.0
-C P4 42.0
-
-MULFUNC_PROLOGUE(mpn_bdiv_q_1 mpn_pi1_bdiv_q_1)
-
-defframe(PARAM_SHIFT, 24)
-defframe(PARAM_INVERSE,20)
-defframe(PARAM_DIVISOR,16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(VAR_INVERSE,`PARAM_SRC')
-
- TEXT
-
-C mp_limb_t
-C mpn_pi1_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor,
-C mp_limb_t inverse, int shift)
-
- ALIGN(16)
-PROLOGUE(mpn_pi1_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl PARAM_SHIFT, %ecx
- pushl %ebp FRAME_pushl()
-
- movl PARAM_INVERSE, %eax
- movl PARAM_SIZE, %ebp
- pushl %ebx FRAME_pushl()
-L(common):
- pushl %edi FRAME_pushl()
- pushl %esi FRAME_pushl()
-
- movl PARAM_SRC, %esi
- movl PARAM_DST, %edi
-
- leal (%esi,%ebp,4), %esi C src end
- leal (%edi,%ebp,4), %edi C dst end
- negl %ebp C -size
-
- movl %eax, VAR_INVERSE
- movl (%esi,%ebp,4), %eax C src[0]
-
- xorl %ebx, %ebx
- xorl %edx, %edx
-
- incl %ebp
- jz L(one)
-
- movl (%esi,%ebp,4), %edx C src[1]
-
- shrdl( %cl, %edx, %eax)
-
- movl VAR_INVERSE, %edx
- jmp L(entry)
-
-
- ALIGN(8)
- nop C k6 code alignment
- nop
-L(top):
- C eax q
- C ebx carry bit, 0 or -1
- C ecx shift
- C edx carry limb
- C esi src end
- C edi dst end
- C ebp counter, limbs, negative
-
- movl -4(%esi,%ebp,4), %eax
- subl %ebx, %edx C accumulate carry bit
-
- movl (%esi,%ebp,4), %ebx
-
- shrdl( %cl, %ebx, %eax)
-
- subl %edx, %eax C apply carry limb
- movl VAR_INVERSE, %edx
-
- sbbl %ebx, %ebx
-
-L(entry):
- imull %edx, %eax
-
- movl %eax, -4(%edi,%ebp,4)
- movl PARAM_DIVISOR, %edx
-
- mull %edx
-
- incl %ebp
- jnz L(top)
-
-
- movl -4(%esi), %eax C src high limb
-L(one):
- shrl %cl, %eax
- popl %esi FRAME_popl()
-
- addl %ebx, %eax C apply carry bit
-
- subl %edx, %eax C apply carry limb
-
- imull VAR_INVERSE, %eax
-
- movl %eax, -4(%edi)
-
- popl %edi
- popl %ebx
- popl %ebp
-
- ret
-
-EPILOGUE()
-
-C mp_limb_t mpn_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_limb_t divisor);
-C
-
- ALIGN(16)
-PROLOGUE(mpn_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl PARAM_DIVISOR, %eax
- pushl %ebp FRAME_pushl()
-
- movl $-1, %ecx C shift count
- movl PARAM_SIZE, %ebp
-
- pushl %ebx FRAME_pushl()
-
-L(strip_twos):
- incl %ecx
-
- shrl %eax
- jnc L(strip_twos)
-
- leal 1(%eax,%eax), %ebx C d without twos
- andl $127, %eax C d/2, 7 bits
-
-ifdef(`PIC',`
- LEA( binvert_limb_table, %edx)
- movzbl (%eax,%edx), %eax C inv 8 bits
-',`
- movzbl binvert_limb_table(%eax), %eax C inv 8 bits
-')
-
- leal (%eax,%eax), %edx C 2*inv
- movl %ebx, PARAM_DIVISOR C d without twos
- imull %eax, %eax C inv*inv
- imull %ebx, %eax C inv*inv*d
- subl %eax, %edx C inv = 2*inv - inv*inv*d
-
- leal (%edx,%edx), %eax C 2*inv
- imull %edx, %edx C inv*inv
- imull %ebx, %edx C inv*inv*d
- subl %edx, %eax C inv = 2*inv - inv*inv*d
-
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
- pushl %eax FRAME_pushl()
- imull PARAM_DIVISOR, %eax
- cmpl $1, %eax
- popl %eax FRAME_popl()')
-
- jmp L(common)
-EPILOGUE()
-
diff --git a/gmp/mpn/x86/bobcat/gmp-mparam.h b/gmp/mpn/x86/bobcat/gmp-mparam.h
deleted file mode 100644
index 198081f9fd..0000000000
--- a/gmp/mpn/x86/bobcat/gmp-mparam.h
+++ /dev/null
@@ -1,197 +0,0 @@
-/* x86/bobcat gmp-mparam.h -- Compiler/machine parameter header file.
-
-Copyright 1991, 1993, 1994, 2000-2011, 2014 Free Software Foundation, Inc.
-
-This file is part of the GNU MP Library.
-
-The GNU MP Library is free software; you can redistribute it and/or modify
-it under the terms of either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
-
-#define GMP_LIMB_BITS 32
-#define GMP_LIMB_BYTES 4
-
-/* 1600 MHz AMD Bobcat Zacate E-350 */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
-
-#define MOD_1_NORM_THRESHOLD 0 /* always */
-#define MOD_1_UNNORM_THRESHOLD 0 /* always */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 12
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 5
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 16
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 16
-#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIV_QR_1N_PI1_METHOD 1
-#define DIV_QR_1_NORM_THRESHOLD 2
-#define DIV_QR_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIV_QR_2_PI2_THRESHOLD MP_SIZE_T_MAX /* never */
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 40
-
-#define MUL_TOOM22_THRESHOLD 28
-#define MUL_TOOM33_THRESHOLD 90
-#define MUL_TOOM44_THRESHOLD 154
-#define MUL_TOOM6H_THRESHOLD 270
-#define MUL_TOOM8H_THRESHOLD 490
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 107
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 95
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 110
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 130
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 38
-#define SQR_TOOM3_THRESHOLD 121
-#define SQR_TOOM4_THRESHOLD 212
-#define SQR_TOOM6_THRESHOLD 303
-#define SQR_TOOM8_THRESHOLD 454
-
-#define MULMID_TOOM42_THRESHOLD 74
-
-#define MULMOD_BNM1_THRESHOLD 18
-#define SQRMOD_BNM1_THRESHOLD 23
-
-#define MUL_FFT_MODF_THRESHOLD 660 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 660, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 27, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 63, 8}, { 127, 9}, { 79,10}, \
- { 47, 9}, { 103,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 511,10}, { 271, 9}, { 543,11}, \
- { 159, 9}, { 639,10}, { 335, 9}, { 671,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
- { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,10}, { 671,12}, { 191,11}, { 383,10}, \
- { 799, 9}, { 1599,11}, { 415,13}, { 127,12}, \
- { 255,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,12}, { 447,11}, { 991,13}, { 255,12}, \
- { 511,11}, { 1087,12}, { 575,11}, { 1215,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,13}, \
- { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,12}, { 959,14}, { 255,13}, { 511,12}, \
- { 1215,13}, { 639,12}, { 1471,13}, { 767,12}, \
- { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
- { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
- { 1407,14}, { 767,13}, { 1663,12}, { 3455,13}, \
- { 1919,15}, { 511,14}, { 1023,13}, { 2175,12}, \
- { 4479,13}, { 2431,14}, { 1279,13}, { 2943,12}, \
- { 5887,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 139
-#define MUL_FFT_THRESHOLD 7552
-
-#define SQR_FFT_MODF_THRESHOLD 606 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 606, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 49, 8}, \
- { 31, 7}, { 63, 8}, { 43, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,11}, { 63,10}, \
- { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543, 8}, { 1087,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671, 8}, { 1343,10}, \
- { 351,11}, { 191,10}, { 383, 9}, { 767,10}, \
- { 399, 9}, { 799,10}, { 415, 9}, { 831,12}, \
- { 127,11}, { 255,10}, { 511, 9}, { 1023,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,11}, { 319,10}, { 671, 9}, { 1343,12}, \
- { 191,11}, { 383,10}, { 799,11}, { 415,10}, \
- { 831,13}, { 127,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,10}, { 1471,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,12}, { 447,11}, { 991,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1727,12}, { 959,14}, { 255,13}, \
- { 511,12}, { 1215,13}, { 639,12}, { 1471,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2111,13}, { 1151,12}, \
- { 2431,13}, { 1407,14}, { 767,13}, { 1663,12}, \
- { 3455,13}, { 1919,15}, { 511,14}, { 1023,13}, \
- { 2175,12}, { 4479,13}, { 2431,14}, { 1279,13}, \
- { 2943,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 147
-#define SQR_FFT_THRESHOLD 5760
-
-#define MULLO_BASECASE_THRESHOLD 5
-#define MULLO_DC_THRESHOLD 45
-#define MULLO_MUL_N_THRESHOLD 14281
-
-#define DC_DIV_QR_THRESHOLD 71
-#define DC_DIVAPPR_Q_THRESHOLD 238
-#define DC_BDIV_QR_THRESHOLD 67
-#define DC_BDIV_Q_THRESHOLD 151
-
-#define INV_MULMOD_BNM1_THRESHOLD 66
-#define INV_NEWTON_THRESHOLD 228
-#define INV_APPR_THRESHOLD 222
-
-#define BINV_NEWTON_THRESHOLD 270
-#define REDC_1_TO_REDC_N_THRESHOLD 71
-
-#define MU_DIV_QR_THRESHOLD 1718
-#define MU_DIVAPPR_Q_THRESHOLD 1718
-#define MUPI_DIV_QR_THRESHOLD 91
-#define MU_BDIV_QR_THRESHOLD 1589
-#define MU_BDIV_Q_THRESHOLD 1718
-
-#define POWM_SEC_TABLE 1,16,96,416,1185
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 88
-#define HGCD_APPR_THRESHOLD 137
-#define HGCD_REDUCE_THRESHOLD 3664
-#define GCD_DC_THRESHOLD 465
-#define GCDEXT_DC_THRESHOLD 345
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 18
-#define GET_STR_PRECOMPUTE_THRESHOLD 34
-#define SET_STR_DC_THRESHOLD 270
-#define SET_STR_PRECOMPUTE_THRESHOLD 828
-
-#define FAC_DSC_THRESHOLD 256
-#define FAC_ODD_THRESHOLD 34
diff --git a/gmp/mpn/x86/cnd_aors_n.asm b/gmp/mpn/x86/cnd_aors_n.asm
deleted file mode 100644
index 74f4917ecc..0000000000
--- a/gmp/mpn/x86/cnd_aors_n.asm
+++ /dev/null
@@ -1,124 +0,0 @@
-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()
diff --git a/gmp/mpn/x86/copyd.asm b/gmp/mpn/x86/copyd.asm
index 51fa19568b..4ce3bbbc69 100644
--- a/gmp/mpn/x86/copyd.asm
+++ b/gmp/mpn/x86/copyd.asm
@@ -1,42 +1,31 @@
dnl x86 mpn_copyd -- copy limb vector, decrementing.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 startup (approx)
-C P5 1.0 40
-C P6 2.4 70
-C K6 1.0 55
-C K7 1.3 75
-C P4 2.6 175
+C P5: 1.0 40
+C P6 2.4 70
+C K6 1.0 55
+C K7: 1.3 75
+C P4: 2.6 175
C
C (Startup time includes some function call overheads.)
diff --git a/gmp/mpn/x86/copyi.asm b/gmp/mpn/x86/copyi.asm
index f6b0354b4f..c6bbaeee65 100644
--- a/gmp/mpn/x86/copyi.asm
+++ b/gmp/mpn/x86/copyi.asm
@@ -1,42 +1,31 @@
dnl x86 mpn_copyi -- copy limb vector, incrementing.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 startup (approx)
-C P5 1.0 35
-C P6 0.75 45
-C K6 1.0 30
-C K7 1.3 65
-C P4 1.0 120
+C P5: 1.0 35
+C P6 0.75 45
+C K6 1.0 30
+C K7: 1.3 65
+C P4: 1.0 120
C
C (Startup time includes some function call overheads.)
diff --git a/gmp/mpn/x86/core2/gmp-mparam.h b/gmp/mpn/x86/core2/gmp-mparam.h
deleted file mode 100644
index b370eb5877..0000000000
--- a/gmp/mpn/x86/core2/gmp-mparam.h
+++ /dev/null
@@ -1,200 +0,0 @@
-/* x86/core2 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
-
-/* 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 10
-#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 19
-
-#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 93
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 140
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 89
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 102
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 136
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 34
-#define SQR_TOOM3_THRESHOLD 114
-#define SQR_TOOM4_THRESHOLD 178
-#define SQR_TOOM6_THRESHOLD 262
-#define SQR_TOOM8_THRESHOLD 357
-
-#define MULMID_TOOM42_THRESHOLD 66
-
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 21
-
-#define MUL_FFT_MODF_THRESHOLD 600 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 600, 5}, { 25, 6}, { 13, 5}, { 28, 6}, \
- { 25, 7}, { 13, 6}, { 29, 7}, { 15, 6}, \
- { 33, 7}, { 17, 6}, { 36, 7}, { 19, 6}, \
- { 39, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 43, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
- { 47, 8}, { 95, 9}, { 55,10}, { 31, 9}, \
- { 79,10}, { 47, 9}, { 95,11}, { 31,10}, \
- { 63, 9}, { 135,10}, { 79, 9}, { 159,10}, \
- { 95, 9}, { 191,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 271, 9}, { 543, 8}, { 1087,11}, { 159,10}, \
- { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
- { 351,11}, { 191,10}, { 383, 9}, { 767,10}, \
- { 399, 9}, { 799,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 607, 9}, { 1215,11}, { 319,10}, { 671,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 799, 9}, \
- { 1599,13}, { 127,12}, { 255,11}, { 543,10}, \
- { 1087,11}, { 607,10}, { 1215,12}, { 319,11}, \
- { 671,10}, { 1343,11}, { 735,12}, { 383,11}, \
- { 799,10}, { 1599,11}, { 863,10}, { 1727,12}, \
- { 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 \
- { { 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 29
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#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 50
-#define INV_NEWTON_THRESHOLD 39
-#define INV_APPR_THRESHOLD 37
-
-#define BINV_NEWTON_THRESHOLD 318
-#define REDC_1_TO_REDC_N_THRESHOLD 87
-
-#define MU_DIV_QR_THRESHOLD 1099
-#define MU_DIVAPPR_Q_THRESHOLD 792
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#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 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/gmp/mpn/x86/coreihwl/gmp-mparam.h b/gmp/mpn/x86/coreihwl/gmp-mparam.h
deleted file mode 100644
index e2b289cc3c..0000000000
--- a/gmp/mpn/x86/coreihwl/gmp-mparam.h
+++ /dev/null
@@ -1,210 +0,0 @@
-/* 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
diff --git a/gmp/mpn/x86/coreinhm/gmp-mparam.h b/gmp/mpn/x86/coreinhm/gmp-mparam.h
deleted file mode 100644
index 13289c0c23..0000000000
--- a/gmp/mpn/x86/coreinhm/gmp-mparam.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/* x86/coreinhm 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
-
-/* 2667 MHz Core i7 Nehalem */
-/* FFT tuning limit = 100000000 */
-/* Generated by tuneup.c, 2014-03-19, gcc 4.5 */
-
-#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 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 15
-
-#define MUL_TOOM22_THRESHOLD 26
-#define MUL_TOOM33_THRESHOLD 89
-#define MUL_TOOM44_THRESHOLD 214
-#define MUL_TOOM6H_THRESHOLD 327
-#define MUL_TOOM8H_THRESHOLD 466
-
-#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 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 MUL_FFT_MODF_THRESHOLD 606 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, { 35, 8}, \
- { 19, 7}, { 43, 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, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 159,10}, { 95, 9}, { 191,10}, { 111,11}, \
- { 63,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335,11}, { 191,10}, { 383, 9}, \
- { 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 38
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#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 50
-#define INV_NEWTON_THRESHOLD 15
-#define INV_APPR_THRESHOLD 18
-
-#define BINV_NEWTON_THRESHOLD 351
-#define REDC_1_TO_REDC_N_THRESHOLD 84
-
-#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 52
-#define HGCD_APPR_THRESHOLD 51
-#define HGCD_REDUCE_THRESHOLD 3524
-#define GCD_DC_THRESHOLD 213
-#define GCDEXT_DC_THRESHOLD 249
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 145
-#define SET_STR_PRECOMPUTE_THRESHOLD 545
-
-#define FAC_DSC_THRESHOLD 91
-#define FAC_ODD_THRESHOLD 29
diff --git a/gmp/mpn/x86/coreisbr/gmp-mparam.h b/gmp/mpn/x86/coreisbr/gmp-mparam.h
deleted file mode 100644
index 9b227a71ba..0000000000
--- a/gmp/mpn/x86/coreisbr/gmp-mparam.h
+++ /dev/null
@@ -1,203 +0,0 @@
-/* x86/coreisbr 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
-
-/* 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 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 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 19
-
-#define MUL_TOOM22_THRESHOLD 28
-#define MUL_TOOM33_THRESHOLD 99
-#define MUL_TOOM44_THRESHOLD 160
-#define MUL_TOOM6H_THRESHOLD 268
-#define MUL_TOOM8H_THRESHOLD 490
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 106
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 140
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 109
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 108
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 137
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 48
-#define SQR_TOOM3_THRESHOLD 105
-#define SQR_TOOM4_THRESHOLD 256
-#define SQR_TOOM6_THRESHOLD 366
-#define SQR_TOOM8_THRESHOLD 562
-
-#define MULMID_TOOM42_THRESHOLD 98
-
-#define MULMOD_BNM1_THRESHOLD 19
-#define SQRMOD_BNM1_THRESHOLD 23
-
-#define MUL_FFT_MODF_THRESHOLD 636 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 636, 5}, { 27, 6}, { 28, 7}, { 15, 6}, \
- { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 55,10}, { 15, 9}, { 31, 8}, { 67, 9}, \
- { 39, 8}, { 79, 9}, { 47, 8}, { 95, 9}, \
- { 55,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 103,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95, 9}, { 191,11}, \
- { 63,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671,11}, { 191,10}, \
- { 383, 9}, { 767,10}, { 399, 9}, { 799,11}, \
- { 223,12}, { 127,11}, { 255,10}, { 543, 9}, \
- { 1087,11}, { 287,10}, { 607, 9}, { 1215,11}, \
- { 319,10}, { 671,12}, { 191,11}, { 383,10}, \
- { 799,11}, { 415,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,12}, { 447,11}, { 959,13}, { 255,12}, \
- { 511,11}, { 1087,12}, { 575,11}, { 1215,10}, \
- { 2431,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,13}, { 383,12}, { 767,11}, { 1599,12}, \
- { 831,11}, { 1727,12}, { 959,14}, { 255,13}, \
- { 511,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
- { 2431,13}, { 1279,12}, { 2559,13}, { 1407,12}, \
- { 2943,14}, { 767,13}, { 1535,12}, { 3071,13}, \
- { 1663,12}, { 3455,13}, { 1919,15}, { 511,14}, \
- { 1023,13}, { 2175,12}, { 4479,13}, { 2431,14}, \
- { 1279,13}, { 2943,12}, { 5887,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 149
-#define MUL_FFT_THRESHOLD 7424
-
-#define SQR_FFT_MODF_THRESHOLD 555 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 555, 5}, { 28, 6}, { 15, 5}, { 31, 6}, \
- { 29, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 36, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 29, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 47, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 43, 9}, { 23, 8}, { 51, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,10}, { 111,11}, { 63,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 543,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 335, 9}, { 671,10}, { 351,11}, \
- { 191,10}, { 383, 9}, { 767,10}, { 399, 9}, \
- { 799,10}, { 415,12}, { 127,11}, { 255,10}, \
- { 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 62
-#define MULLO_MUL_N_THRESHOLD 14281
-
-#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 14
-#define INV_APPR_THRESHOLD 13
-
-#define BINV_NEWTON_THRESHOLD 363
-#define REDC_1_TO_REDC_N_THRESHOLD 90
-
-#define MU_DIV_QR_THRESHOLD 998
-#define MU_DIVAPPR_Q_THRESHOLD 667
-#define MUPI_DIV_QR_THRESHOLD 0 /* always */
-#define MU_BDIV_QR_THRESHOLD 1787
-#define MU_BDIV_Q_THRESHOLD 2130
-
-#define POWM_SEC_TABLE 1,16,126,480,1317
-
-#define MATRIX22_STRASSEN_THRESHOLD 21
-#define HGCD_THRESHOLD 61
-#define HGCD_APPR_THRESHOLD 56
-#define HGCD_REDUCE_THRESHOLD 3810
-#define GCD_DC_THRESHOLD 283
-#define GCDEXT_DC_THRESHOLD 309
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 21
-#define SET_STR_DC_THRESHOLD 399
-#define SET_STR_PRECOMPUTE_THRESHOLD 1183
-
-#define FAC_DSC_THRESHOLD 194
-#define FAC_ODD_THRESHOLD 34
diff --git a/gmp/mpn/x86/darwin.m4 b/gmp/mpn/x86/darwin.m4
index f8363db3f7..7ef8dfc105 100644
--- a/gmp/mpn/x86/darwin.m4
+++ b/gmp/mpn/x86/darwin.m4
@@ -1,82 +1,40 @@
divert(-1)
-dnl Copyright 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 2007 Free Software Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`DARWIN')
-
dnl Usage LEA(symbol,reg)
dnl
-dnl We maintain lists of stuff to append in load_eip and darwin_bd. The
-dnl `index' stuff is needed to suppress repeated definitions. To avoid
-dnl getting fooled by "var" and "var1", we add 'bol ' (the end of
-dnl 'indirect_symbol') at the beginning and and a newline at the end. This
-dnl might be a bit fragile.
+dnl FIXME: Only handles one symbol per assembly file because of the
+dnl way EPILOGUE_cpu is handled.
-define(`LEA',
-m4_assert_numargs(2)
-`ifdef(`PIC',`
-ifelse(index(defn(`load_eip'), `$2'),-1,
-`m4append(`load_eip',
-`L(movl_eip_`'substr($2,1)):
+define(`LEA',`
+define(`EPILOGUE_cpu',
+` L(movl_eip_`'substr($2,1)):
movl (%esp), $2
ret_internal
-')')
-ifelse(index(defn(`darwin_bd'), `bol $1
-'),-1,
-`m4append(`darwin_bd',
-` .section __IMPORT,__pointers,non_lazy_symbol_pointers
+ .section __IMPORT,__pointers,non_lazy_symbol_pointers
L($1`'$non_lazy_ptr):
.indirect_symbol $1
.long 0
-')')
+')
call L(movl_eip_`'substr($2,1))
movl L($1`'$non_lazy_ptr)-.($2), $2
-',`
- movl `$'$1, $2
-')')
-
-
-dnl EPILOGUE_cpu
-
-define(`EPILOGUE_cpu',`load_eip`'darwin_bd')
-
-define(`load_eip', `') dnl updated in LEA
-define(`darwin_bd', `') dnl updated in LEA
-
-
-dnl Usage: CALL(funcname)
-dnl
-
-define(`CALL',
-m4_assert_numargs(1)
-`call GSYM_PREFIX`'$1')
-
-undefine(`PIC_WITH_EBX')
+')
divert`'dnl
diff --git a/gmp/mpn/x86/dive_1.asm b/gmp/mpn/x86/dive_1.asm
index 9a6cbb7931..d2d02f9f72 100644
--- a/gmp/mpn/x86/dive_1.asm
+++ b/gmp/mpn/x86/dive_1.asm
@@ -1,32 +1,21 @@
dnl x86 mpn_divexact_1 -- mpn by limb exact division.
dnl Copyright 2001, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -108,7 +97,7 @@ ifdef(`PIC',`
subl %edx, %eax C inv = 2*inv - inv*inv*d
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB
pushl %eax FRAME_pushl()
imull PARAM_DIVISOR, %eax
cmpl $1, %eax
diff --git a/gmp/mpn/x86/divrem_1.asm b/gmp/mpn/x86/divrem_1.asm
index 255d4935c3..a5fb88071d 100644
--- a/gmp/mpn/x86/divrem_1.asm
+++ b/gmp/mpn/x86/divrem_1.asm
@@ -1,32 +1,22 @@
dnl x86 mpn_divrem_1 -- mpn by limb division extending to fractional quotient.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/divrem_2.asm b/gmp/mpn/x86/divrem_2.asm
index 4c38ad0acb..bbadda921c 100644
--- a/gmp/mpn/x86/divrem_2.asm
+++ b/gmp/mpn/x86/divrem_2.asm
@@ -3,30 +3,19 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -92,7 +81,7 @@ PROLOGUE(mpn_divrem_2)
seta %dl
cmp 20(%esp), %ebp
setae %al
- orb %dl, %al C "orb" form to placate Sun tools
+ or %dl, %al
jne L(35)
L(8):
mov 60(%esp), %esi C fn
@@ -185,7 +174,7 @@ L(9): mov 64(%esp), %esi C up
L(fix): seta %dl
cmp 20(%esp), %ebp
setae %al
- orb %dl, %al C "orb" form to placate Sun tools
+ or %dl, %al
je L(bck)
inc %edi
sub 20(%esp), %ebp
diff --git a/gmp/mpn/x86/fat/com.c b/gmp/mpn/x86/fat/com.c
deleted file mode 100644
index d359d4ce73..0000000000
--- a/gmp/mpn/x86/fat/com.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Fat binary fallback mpn_com.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/com.c"
diff --git a/gmp/mpn/x86/fat/diveby3.c b/gmp/mpn/x86/fat/diveby3.c
new file mode 100644
index 0000000000..7ea0161b72
--- /dev/null
+++ b/gmp/mpn/x86/fat/diveby3.c
@@ -0,0 +1,21 @@
+/* Fat binary fallback mpn_divexact_by3c.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 "mpn/generic/diveby3.c"
diff --git a/gmp/mpn/x86/fat/fat.c b/gmp/mpn/x86/fat/fat.c
index 1740813886..c3d1866c69 100644
--- a/gmp/mpn/x86/fat/fat.c
+++ b/gmp/mpn/x86/fat/fat.c
@@ -4,33 +4,22 @@
THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
COMPLETELY IN FUTURE GNU MP RELEASES.
-Copyright 2003, 2004, 2011, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for printf */
#include <stdlib.h> /* for getenv */
@@ -42,10 +31,14 @@ see https://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);
-int __gmpn_cpuid_available (void);
+long __gmpn_cpuid __GMP_PROTO ((char dst[12], int id));
+int __gmpn_cpuid_available __GMP_PROTO ((void));
+
#if WANT_FAKE_CPUID
@@ -56,9 +49,8 @@ int __gmpn_cpuid_available (void);
#define __gmpn_cpuid fake_cpuid
#define __gmpn_cpuid_available fake_cpuid_available
-#define MAKE_FMS(family, model) \
- ((((family) & 0xf) << 8) + (((family) & 0xff0) << 20) \
- + (((model) & 0xf) << 4) + (((model) & 0xf0) << 12))
+#define MAKE_FMS(family, model) \
+ (((family) << 8) + ((model << 4)))
static struct {
const char *name;
@@ -72,29 +64,17 @@ static struct {
{ "pentiumpro", "GenuineIntel", MAKE_FMS (6, 0) },
{ "pentium2", "GenuineIntel", MAKE_FMS (6, 2) },
{ "pentium3", "GenuineIntel", MAKE_FMS (6, 7) },
- { "pentium4", "GenuineIntel", MAKE_FMS (15, 2) },
- { "prescott", "GenuineIntel", MAKE_FMS (15, 3) },
- { "nocona", "GenuineIntel", MAKE_FMS (15, 4) },
- { "core2", "GenuineIntel", MAKE_FMS (6, 0xf) },
- { "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 (7, 0) },
{ "k5", "AuthenticAMD", MAKE_FMS (5, 0) },
{ "k6", "AuthenticAMD", MAKE_FMS (5, 3) },
{ "k62", "AuthenticAMD", MAKE_FMS (5, 8) },
{ "k63", "AuthenticAMD", MAKE_FMS (5, 9) },
{ "athlon", "AuthenticAMD", MAKE_FMS (6, 0) },
- { "k8", "AuthenticAMD", MAKE_FMS (15, 0) },
- { "k10", "AuthenticAMD", MAKE_FMS (16, 0) },
- { "bobcat", "AuthenticAMD", MAKE_FMS (20, 1) },
- { "bulldozer", "AuthenticAMD", MAKE_FMS (21, 1) },
+ { "x86_64", "AuthenticAMD", MAKE_FMS (15, 0) },
{ "viac3", "CentaurHauls", MAKE_FMS (6, 0) },
{ "viac32", "CentaurHauls", MAKE_FMS (6, 9) },
- { "nano", "CentaurHauls", MAKE_FMS (6, 15) },
};
static int
@@ -148,46 +128,28 @@ typedef DECL_preinv_mod_1 ((*preinv_mod_1_t));
struct cpuvec_t __gmpn_cpuvec = {
__MPN(add_n_init),
- 0,
- 0,
__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),
__MPN(divexact_1_init),
+ __MPN(divexact_by3c_init),
__MPN(divrem_1_init),
__MPN(gcd_1_init),
__MPN(lshift_init),
- __MPN(lshiftc_init),
__MPN(mod_1_init),
- __MPN(mod_1_1p_init),
- __MPN(mod_1_1p_cps_init),
- __MPN(mod_1s_2p_init),
- __MPN(mod_1s_2p_cps_init),
- __MPN(mod_1s_4p_init),
- __MPN(mod_1s_4p_cps_init),
__MPN(mod_34lsub1_init),
__MPN(modexact_1c_odd_init),
__MPN(mul_1_init),
__MPN(mul_basecase_init),
- __MPN(mullo_basecase_init),
__MPN(preinv_divrem_1_init),
__MPN(preinv_mod_1_init),
- __MPN(redc_1_init),
- __MPN(redc_2_init),
__MPN(rshift_init),
__MPN(sqr_basecase_init),
__MPN(sub_n_init),
- 0,
__MPN(submul_1_init),
0
};
-int __gmpn_cpuvec_initialized = 0;
/* The following setups start with generic x86, then overwrite with
specifics for a chip, and higher versions of that chip.
@@ -257,107 +219,21 @@ __gmpn_cpuvec_init (void)
case 6:
TRACE (printf (" p6\n"));
CPUVEC_SETUP_p6;
- switch (model)
- {
- case 0x00:
- case 0x01:
- TRACE (printf (" pentiumpro\n"));
- break;
-
- case 0x02:
- case 0x03:
- case 0x04:
- case 0x05:
- case 0x06:
- TRACE (printf (" pentium2\n"));
- CPUVEC_SETUP_p6_mmx;
- break;
-
- case 0x07:
- case 0x08:
- case 0x0a:
- case 0x0b:
- case 0x0c:
- TRACE (printf (" pentium3\n"));
- CPUVEC_SETUP_p6_mmx;
- CPUVEC_SETUP_p6_p3mmx;
- break;
-
- case 0x09: /* Banias */
- case 0x0d: /* Dothan */
- case 0x0e: /* Yonah */
- TRACE (printf (" Banias/Dothan/Yonah\n"));
- CPUVEC_SETUP_p6_mmx;
- CPUVEC_SETUP_p6_p3mmx;
- CPUVEC_SETUP_p6_sse2;
- break;
-
- case 0x0f: /* Conroe Merom Kentsfield Allendale */
- case 0x10:
- case 0x11:
- case 0x12:
- case 0x13:
- case 0x14:
- case 0x15:
- case 0x16:
- case 0x17: /* PNR Wolfdale Yorkfield */
- case 0x18:
- case 0x19:
- case 0x1d: /* PNR Dunnington */
- TRACE (printf (" Conroe\n"));
- CPUVEC_SETUP_p6_mmx;
- CPUVEC_SETUP_p6_p3mmx;
- CPUVEC_SETUP_p6_sse2;
- CPUVEC_SETUP_core2;
- break;
-
- case 0x1c: /* Atom Silverthorne */
- case 0x26: /* Atom Lincroft */
- case 0x27: /* Atom Saltwell */
- case 0x36: /* Atom Cedarview/Saltwell */
- TRACE (printf (" atom\n"));
- CPUVEC_SETUP_atom;
- CPUVEC_SETUP_atom_mmx;
- CPUVEC_SETUP_atom_sse2;
- break;
-
- case 0x1a: /* NHM Gainestown */
- case 0x1b:
- case 0x1e: /* NHM Lynnfield/Jasper */
- case 0x1f:
- case 0x20:
- case 0x21:
- case 0x22:
- case 0x23:
- case 0x24:
- case 0x25: /* WSM Clarkdale/Arrandale */
- case 0x28:
- case 0x29:
- case 0x2b:
- case 0x2c: /* WSM Gulftown */
- case 0x2e: /* NHM Beckton */
- case 0x2f: /* WSM Eagleton */
- TRACE (printf (" nehalem/westmere\n"));
- CPUVEC_SETUP_p6_mmx;
- CPUVEC_SETUP_p6_p3mmx;
- CPUVEC_SETUP_p6_sse2;
- CPUVEC_SETUP_core2;
- CPUVEC_SETUP_coreinhm;
- break;
-
- case 0x2a: /* SBR */
- case 0x2d: /* SBR-EP */
- case 0x3a: /* IBR */
- case 0x3c: /* Haswell */
- TRACE (printf (" sandybridge\n"));
+ if (model >= 2)
+ {
+ TRACE (printf (" pentium2\n"));
CPUVEC_SETUP_p6_mmx;
+ }
+ if (model >= 7)
+ {
+ TRACE (printf (" pentium3\n"));
CPUVEC_SETUP_p6_p3mmx;
+ }
+ if (model >= 0xD || model == 9)
+ {
+ TRACE (printf (" p6 with sse2\n"));
CPUVEC_SETUP_p6_sse2;
- CPUVEC_SETUP_core2;
- CPUVEC_SETUP_coreinhm;
- CPUVEC_SETUP_coreisbr;
- break;
- }
+ }
break;
case 15:
@@ -395,40 +271,13 @@ __gmpn_cpuvec_init (void)
break;
case 6:
TRACE (printf (" athlon\n"));
+ athlon:
CPUVEC_SETUP_k7;
CPUVEC_SETUP_k7_mmx;
break;
-
- case 0x0f: /* k8 */
- case 0x11: /* "fam 11h", mix of k8 and k10 */
- case 0x13: /* unknown, conservatively assume k8 */
- case 0x16: /* unknown, conservatively assume k8 */
- case 0x17: /* unknown, conservatively assume k8 */
- TRACE (printf (" k8\n"));
- CPUVEC_SETUP_k7;
- CPUVEC_SETUP_k7_mmx;
- CPUVEC_SETUP_k8;
- break;
-
- case 0x10: /* k10 */
- case 0x12: /* k10 (llano) */
- TRACE (printf (" k10\n"));
- CPUVEC_SETUP_k7;
- CPUVEC_SETUP_k7_mmx;
- break;
-
- case 0x14: /* bobcat */
- TRACE (printf (" bobcat\n"));
- CPUVEC_SETUP_k7;
- CPUVEC_SETUP_k7_mmx;
- CPUVEC_SETUP_bobcat;
- break;
-
- case 0x15: /* bulldozer */
- TRACE (printf (" bulldozer\n"));
- CPUVEC_SETUP_k7;
- CPUVEC_SETUP_k7_mmx;
- break;
+ case 15:
+ TRACE (printf (" x86_64\n"));
+ goto athlon;
}
}
else if (strcmp (vendor_string, "CentaurHauls") == 0)
@@ -441,11 +290,6 @@ __gmpn_cpuvec_init (void)
{
TRACE (printf (" viac32\n"));
}
- if (model >= 15)
- {
- TRACE (printf (" nano\n"));
- CPUVEC_SETUP_nano;
- }
break;
}
}
@@ -469,5 +313,5 @@ __gmpn_cpuvec_init (void)
/* Set this once the threshold fields are ready.
Use volatile to prevent it getting moved. */
- *((volatile int *) &__gmpn_cpuvec_initialized) = 1;
+ ((volatile struct cpuvec_t *) &__gmpn_cpuvec)->initialized = 1;
}
diff --git a/gmp/mpn/x86/fat/fat_entry.asm b/gmp/mpn/x86/fat/fat_entry.asm
index 6e3cb44dd5..bd46e4e8bd 100644
--- a/gmp/mpn/x86/fat/fat_entry.asm
+++ b/gmp/mpn/x86/fat/fat_entry.asm
@@ -1,32 +1,21 @@
dnl x86 fat binary entrypoints.
-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 either:
+dnl Copyright 2003 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -129,7 +118,7 @@ EPILOGUE()
L(fat_init):
C al __gmpn_cpuvec byte offset
- movzbl %al, %eax
+ movsbl %al, %eax
pushl %eax
ifdef(`PIC',`
diff --git a/gmp/mpn/x86/fat/gcd_1.c b/gmp/mpn/x86/fat/gcd_1.c
index f809bd8092..5bd000618c 100644
--- a/gmp/mpn/x86/fat/gcd_1.c
+++ b/gmp/mpn/x86/fat/gcd_1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "mpn/generic/gcd_1.c"
diff --git a/gmp/mpn/x86/fat/gmp-mparam.h b/gmp/mpn/x86/fat/gmp-mparam.h
index 3641a6bafa..9127d1425f 100644
--- a/gmp/mpn/x86/fat/gmp-mparam.h
+++ b/gmp/mpn/x86/fat/gmp-mparam.h
@@ -1,35 +1,25 @@
/* Fat binary x86 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2003, 2011 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* mpn_divexact_1 is faster than mpn_divrem_1 at all sizes. The only time
@@ -44,17 +34,15 @@ see https://www.gnu.org/licenses/. */
preinv. */
#define USE_PREINV_DIVREM_1 1
-#define BMOD_1_TO_MOD_1_THRESHOLD 20
-
/* mpn_sqr_basecase is faster than mpn_mul_basecase at all sizes, no need
- for mpn_sqr to call the latter. */
+ for mpn_sqr_n to call the latter. */
#define SQR_BASECASE_THRESHOLD 0
/* Sensible fallbacks for these, when not taken from a cpu-specific
gmp-mparam.h. */
-#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 130
-#define SQR_TOOM2_THRESHOLD 30
+#define MUL_KARATSUBA_THRESHOLD 20
+#define MUL_TOOM3_THRESHOLD 130
+#define SQR_KARATSUBA_THRESHOLD 30
#define SQR_TOOM3_THRESHOLD 200
/* These are values more or less in the middle of what the typical x86 chips
diff --git a/gmp/mpn/x86/fat/lshiftc.c b/gmp/mpn/x86/fat/lshiftc.c
deleted file mode 100644
index 9ecf48978f..0000000000
--- a/gmp/mpn/x86/fat/lshiftc.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Fat binary fallback mpn_lshiftc.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/lshiftc.c"
diff --git a/gmp/mpn/x86/fat/mod_1.c b/gmp/mpn/x86/fat/mod_1.c
deleted file mode 100644
index 4f149cc353..0000000000
--- a/gmp/mpn/x86/fat/mod_1.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Fat binary fallback mpn_mod_1.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/mod_1.c"
diff --git a/gmp/mpn/x86/fat/mod_1_1.c b/gmp/mpn/x86/fat/mod_1_1.c
deleted file mode 100644
index 92eaa7a87f..0000000000
--- a/gmp/mpn/x86/fat/mod_1_1.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Fat binary fallback mpn_mod_1_1p.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/*
-PROLOGUE(mpn_mod_1_1p_cps)
-*/
-
-#define OPERATION_mod_1_1_cps 1
-#include "mpn/generic/mod_1_1.c"
diff --git a/gmp/mpn/x86/fat/mod_1_2.c b/gmp/mpn/x86/fat/mod_1_2.c
deleted file mode 100644
index 9095a61c93..0000000000
--- a/gmp/mpn/x86/fat/mod_1_2.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Fat binary fallback mpn_mod_1s_2p.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/*
-PROLOGUE(mpn_mod_1s_2p_cps)
-*/
-
-#define OPERATION_mod_1_2_cps 1
-#include "mpn/generic/mod_1_2.c"
diff --git a/gmp/mpn/x86/fat/mod_1_4.c b/gmp/mpn/x86/fat/mod_1_4.c
deleted file mode 100644
index 51c0def443..0000000000
--- a/gmp/mpn/x86/fat/mod_1_4.c
+++ /dev/null
@@ -1,36 +0,0 @@
-/* Fat binary fallback mpn_mod_1s_4p.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-/*
-PROLOGUE(mpn_mod_1s_4p_cps)
-*/
-
-#define OPERATION_mod_1_4_cps 1
-#include "mpn/generic/mod_1_4.c"
diff --git a/gmp/mpn/x86/fat/mode1o.c b/gmp/mpn/x86/fat/mode1o.c
index 870ddb899b..a5244cae44 100644
--- a/gmp/mpn/x86/fat/mode1o.c
+++ b/gmp/mpn/x86/fat/mode1o.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "mpn/generic/mode1o.c"
diff --git a/gmp/mpn/x86/fat/mullo_basecase.c b/gmp/mpn/x86/fat/mullo_basecase.c
deleted file mode 100644
index 7f86be64c5..0000000000
--- a/gmp/mpn/x86/fat/mullo_basecase.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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/gmp/mpn/x86/fat/redc_1.c b/gmp/mpn/x86/fat/redc_1.c
deleted file mode 100644
index 0025403353..0000000000
--- a/gmp/mpn/x86/fat/redc_1.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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"
diff --git a/gmp/mpn/x86/fat/redc_2.c b/gmp/mpn/x86/fat/redc_2.c
deleted file mode 100644
index 1932d58323..0000000000
--- a/gmp/mpn/x86/fat/redc_2.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Fat binary fallback mpn_redc_2.
-
-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_2.c"
diff --git a/gmp/mpn/x86/geode/gmp-mparam.h b/gmp/mpn/x86/geode/gmp-mparam.h
deleted file mode 100644
index cc9c9f1789..0000000000
--- a/gmp/mpn/x86/geode/gmp-mparam.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* Generic x86 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* Generated by tuneup.c, 2011-01-30, gcc 3.4 */
-
-#define MOD_1_NORM_THRESHOLD 6
-#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 17
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 9
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 14
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-#define USE_PREINV_DIVREM_1 0
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 42
-
-#define MUL_TOOM22_THRESHOLD 18
-#define MUL_TOOM33_THRESHOLD 66
-#define MUL_TOOM44_THRESHOLD 105
-#define MUL_TOOM6H_THRESHOLD 141
-#define MUL_TOOM8H_THRESHOLD 212
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 62
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 69
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 65
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 67
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 33
-#define SQR_TOOM3_THRESHOLD 60
-#define SQR_TOOM4_THRESHOLD 136
-#define SQR_TOOM6_THRESHOLD 196
-#define SQR_TOOM8_THRESHOLD 292
-
-#define MULMOD_BNM1_THRESHOLD 14
-#define SQRMOD_BNM1_THRESHOLD 16
-
-#define MUL_FFT_MODF_THRESHOLD 468 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 468, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 21, 8}, { 11, 7}, { 27, 8}, \
- { 15, 7}, { 33, 8}, { 19, 7}, { 39, 8}, \
- { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
- { 39, 9}, { 23, 8}, { 47,10}, { 15, 9}, \
- { 31, 8}, { 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}, { 143, 9}, \
- { 287,10}, { 159,11}, { 95,10}, { 191, 9}, \
- { 383,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 61
-#define MUL_FFT_THRESHOLD 5504
-
-#define SQR_FFT_MODF_THRESHOLD 396 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 396, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 21, 7}, { 11, 6}, { 24, 7}, { 13, 6}, \
- { 27, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
- { 11, 7}, { 27, 8}, { 15, 7}, { 33, 8}, \
- { 19, 7}, { 39, 8}, { 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}, { 127, 8}, \
- { 255, 9}, { 135,10}, { 79, 9}, { 159, 8}, \
- { 319,10}, { 95, 9}, { 191,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 511,10}, { 143, 9}, \
- { 287, 8}, { 575,10}, { 159,11}, { 95,10}, \
- { 191,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 61
-#define SQR_FFT_THRESHOLD 3712
-
-#define MULLO_BASECASE_THRESHOLD 3
-#define MULLO_DC_THRESHOLD 37
-#define MULLO_MUL_N_THRESHOLD 10950
-
-#define DC_DIV_QR_THRESHOLD 59
-#define DC_DIVAPPR_Q_THRESHOLD 189
-#define DC_BDIV_QR_THRESHOLD 55
-#define DC_BDIV_Q_THRESHOLD 136
-
-#define INV_MULMOD_BNM1_THRESHOLD 50
-#define INV_NEWTON_THRESHOLD 183
-#define INV_APPR_THRESHOLD 181
-
-#define BINV_NEWTON_THRESHOLD 204
-#define REDC_1_TO_REDC_N_THRESHOLD 54
-
-#define MU_DIV_QR_THRESHOLD 1142
-#define MU_DIVAPPR_Q_THRESHOLD 1142
-#define MUPI_DIV_QR_THRESHOLD 81
-#define MU_BDIV_QR_THRESHOLD 889
-#define MU_BDIV_Q_THRESHOLD 998
-
-#define MATRIX22_STRASSEN_THRESHOLD 13
-#define HGCD_THRESHOLD 133
-#define GCD_DC_THRESHOLD 451
-#define GCDEXT_DC_THRESHOLD 318
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 15
-#define GET_STR_PRECOMPUTE_THRESHOLD 30
-#define SET_STR_DC_THRESHOLD 547
-#define SET_STR_PRECOMPUTE_THRESHOLD 1049
diff --git a/gmp/mpn/x86/gmp-mparam.h b/gmp/mpn/x86/gmp-mparam.h
index 2cb1984889..22ee86f7e1 100644
--- a/gmp/mpn/x86/gmp-mparam.h
+++ b/gmp/mpn/x86/gmp-mparam.h
@@ -1,35 +1,24 @@
/* Generic x86 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* Generic x86 mpn_divexact_1 is faster than generic x86 mpn_divrem_1 on all
diff --git a/gmp/mpn/x86/i486/gmp-mparam.h b/gmp/mpn/x86/i486/gmp-mparam.h
index aa7dbad45b..aaddea9f18 100644
--- a/gmp/mpn/x86/i486/gmp-mparam.h
+++ b/gmp/mpn/x86/i486/gmp-mparam.h
@@ -1,46 +1,35 @@
/* 80486 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* 100MHz DX4 */
/* Generated by tuneup.c, 2003-02-13, gcc 2.95 */
-#define MUL_TOOM22_THRESHOLD 18
-#define MUL_TOOM33_THRESHOLD 228
+#define MUL_KARATSUBA_THRESHOLD 18
+#define MUL_TOOM3_THRESHOLD 228
#define SQR_BASECASE_THRESHOLD 13
-#define SQR_TOOM2_THRESHOLD 49
+#define SQR_KARATSUBA_THRESHOLD 49
#define SQR_TOOM3_THRESHOLD 238
#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX /* never */
diff --git a/gmp/mpn/x86/k10/gmp-mparam.h b/gmp/mpn/x86/k10/gmp-mparam.h
deleted file mode 100644
index 2a1ae5a6bb..0000000000
--- a/gmp/mpn/x86/k10/gmp-mparam.h
+++ /dev/null
@@ -1,211 +0,0 @@
-/* x86/k10 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
-
-/* 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 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 32
-
-#define MUL_TOOM22_THRESHOLD 24
-#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 130
-#define MUL_TOOM6H_THRESHOLD 189
-#define MUL_TOOM8H_THRESHOLD 430
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 81
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 82
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 90
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 112
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 38
-#define SQR_TOOM3_THRESHOLD 77
-#define SQR_TOOM4_THRESHOLD 184
-#define SQR_TOOM6_THRESHOLD 262
-#define SQR_TOOM8_THRESHOLD 369
-
-#define MULMID_TOOM42_THRESHOLD 56
-
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 18
-
-#define MUL_FFT_MODF_THRESHOLD 765 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 765, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 23, 6}, { 47, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95,10}, { 31, 9}, \
- { 63, 8}, { 127, 9}, { 79,10}, { 47, 9}, \
- { 103,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 159,10}, { 95, 9}, { 199,10}, \
- { 111,11}, { 63,10}, { 127, 9}, { 263,10}, \
- { 175,11}, { 95,10}, { 207,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 543, 8}, { 1087, 9}, \
- { 575,11}, { 159,10}, { 319, 9}, { 671, 8}, \
- { 1343, 9}, { 735,11}, { 191, 9}, { 799, 8}, \
- { 1599,10}, { 415, 9}, { 863,11}, { 223,12}, \
- { 127,11}, { 255,10}, { 543, 9}, { 1087,10}, \
- { 607, 9}, { 1215, 8}, { 2431,11}, { 319,10}, \
- { 671, 9}, { 1343,10}, { 735,12}, { 191,11}, \
- { 383,10}, { 799, 9}, { 1599,11}, { 415,10}, \
- { 863, 9}, { 1727,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215, 9}, \
- { 2431,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,10}, { 1471, 9}, { 2943, 8}, { 5887,12}, \
- { 383,11}, { 799,10}, { 1599,11}, { 863,10}, \
- { 1727,12}, { 447,11}, { 959,10}, { 1919,11}, \
- { 991,10}, { 1983,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,10}, { 2431,12}, \
- { 639,11}, { 1343,12}, { 703,11}, { 1471,10}, \
- { 2943, 9}, { 5887,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,10}, { 3455,12}, \
- { 959,11}, { 1983,14}, { 255,13}, { 511,12}, \
- { 1087,11}, { 2239,12}, { 1215,11}, { 2431,13}, \
- { 639,12}, { 1471,11}, { 2943,10}, { 5887,13}, \
- { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
- { 1983,14}, { 511,13}, { 1023,12}, { 2239,13}, \
- { 1151,12}, { 2495,13}, { 1407,12}, { 2943,11}, \
- { 5887,14}, { 767,13}, { 1663,12}, { 3455,13}, \
- { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
- { 2175,12}, { 4351,13}, { 2431,14}, { 1279,13}, \
- { 2943,12}, { 5887,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 172
-#define MUL_FFT_THRESHOLD 6784
-
-#define SQR_FFT_MODF_THRESHOLD 555 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 555, 5}, { 21, 6}, { 11, 5}, { 25, 6}, \
- { 13, 5}, { 27, 6}, { 27, 7}, { 15, 6}, \
- { 32, 7}, { 17, 6}, { 35, 7}, { 19, 6}, \
- { 39, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 39, 8}, { 23, 7}, { 47, 8}, \
- { 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 40
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#define DC_DIV_QR_THRESHOLD 59
-#define DC_DIVAPPR_Q_THRESHOLD 270
-#define DC_BDIV_QR_THRESHOLD 55
-#define DC_BDIV_Q_THRESHOLD 206
-
-#define INV_MULMOD_BNM1_THRESHOLD 62
-#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 15
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 100
-#define SET_STR_PRECOMPUTE_THRESHOLD 1360
-
-#define FAC_DSC_THRESHOLD 224
-#define FAC_ODD_THRESHOLD 29
diff --git a/gmp/mpn/x86/k6/README b/gmp/mpn/x86/k6/README
index 1d65af3851..f488cbd1d8 100644
--- a/gmp/mpn/x86/k6/README
+++ b/gmp/mpn/x86/k6/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/x86/k6/aors_n.asm b/gmp/mpn/x86/k6/aors_n.asm
index 168f9b4ae4..09afd8f688 100644
--- a/gmp/mpn/x86/k6/aors_n.asm
+++ b/gmp/mpn/x86/k6/aors_n.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_add/sub_n -- mpn addition or subtraction.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/aorsmul_1.asm b/gmp/mpn/x86/k6/aorsmul_1.asm
index eaa92ebb24..c3795e3abb 100644
--- a/gmp/mpn/x86/k6/aorsmul_1.asm
+++ b/gmp/mpn/x86/k6/aorsmul_1.asm
@@ -1,52 +1,42 @@
dnl AMD K6 mpn_addmul_1/mpn_submul_1 -- add or subtract mpn multiple.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2005 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 5.94
-C P6 model 9 (Banias) 5.51
-C P6 model 13 (Dothan) 5.57
+C cycles/limb
+C P5:
+C P6 model 0-8,10-12) 5.94
+C P6 model 9 (Banias)
+C P6 model 13 (Dothan) 5.57
C P4 model 0 (Willamette)
C P4 model 1 (?)
C P4 model 2 (Northwood)
C P4 model 3 (Prescott)
C P4 model 4 (Nocona)
-C AMD K6 7.65-8.5 (data dependent)
-C AMD K7
-C AMD K8
+C K6: 7.65-8.5 (data dependent)
+C K7:
+C K8:
-dnl K6: large multipliers small multipliers
+dnl K6: large multpliers small multpliers
dnl UNROLL_COUNT cycles/limb cycles/limb
dnl 4 9.5 7.78
dnl 8 9.0 7.78
@@ -257,7 +247,7 @@ C registers at the point of doing the mul for the initial two carry limbs.
C
C The add/adc for the initial carry in %esi is necessary only for the
C mpn_addmul/submul_1c entry points. Duplicating the startup code to
-C eliminate this for the plain mpn_add/submul_1 doesn't seem like a good
+C eliminiate this for the plain mpn_add/submul_1 doesn't seem like a good
C idea.
dnl overlapping with parameters already fetched
diff --git a/gmp/mpn/x86/k6/cross.pl b/gmp/mpn/x86/k6/cross.pl
index fc921a56b7..cf476d603b 100755
--- a/gmp/mpn/x86/k6/cross.pl
+++ b/gmp/mpn/x86/k6/cross.pl
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: cross.pl [filename.o]...
diff --git a/gmp/mpn/x86/k6/divrem_1.asm b/gmp/mpn/x86/k6/divrem_1.asm
index b4cea4fa2a..1c86d9bd6c 100644
--- a/gmp/mpn/x86/k6/divrem_1.asm
+++ b/gmp/mpn/x86/k6/divrem_1.asm
@@ -1,32 +1,22 @@
dnl AMD K6 mpn_divrem_1 -- mpn by limb division.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/gcd_1.asm b/gmp/mpn/x86/k6/gcd_1.asm
index 0c233ff362..58aff08221 100644
--- a/gmp/mpn/x86/k6/gcd_1.asm
+++ b/gmp/mpn/x86/k6/gcd_1.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_gcd_1 -- mpn by 1 gcd.
-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 either:
+dnl Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/gmp-mparam.h b/gmp/mpn/x86/k6/gmp-mparam.h
index f03f1b2d91..c04446a573 100644
--- a/gmp/mpn/x86/k6/gmp-mparam.h
+++ b/gmp/mpn/x86/k6/gmp-mparam.h
@@ -1,166 +1,68 @@
/* AMD K6 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2004, 2009, 2010 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 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 either:
+it under the terms of the GNU 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 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.
-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.
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
-or both in parallel, as here.
-The GNU MP Library is distributed in the hope that 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.
+/* 450MHz K6-2 */
-You should have received copies of the GNU 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, 2009-01-05, gcc 3.4 */
-#define GMP_LIMB_BITS 32
-#define GMP_LIMB_BYTES 4
+#define MUL_KARATSUBA_THRESHOLD 19
+#define MUL_TOOM3_THRESHOLD 73
+#define MUL_TOOM44_THRESHOLD 104
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 32
+#define SQR_TOOM3_THRESHOLD 105
+#define SQR_TOOM4_THRESHOLD 143
-/* 450MHz K6-2 */
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 64
+#define MULLOW_MUL_N_THRESHOLD 232
+
+#define DIV_SB_PREINV_THRESHOLD 4
+#define DIV_DC_THRESHOLD 67
+#define POWM_THRESHOLD 110
+
+#define MATRIX22_STRASSEN_THRESHOLD 21
+#define HGCD_THRESHOLD 195
+#define GCD_DC_THRESHOLD 602
+#define GCDEXT_DC_THRESHOLD 662
+#define JACOBI_BASE_METHOD 2
+
+#define USE_PREINV_DIVREM_1 0
+#define USE_PREINV_MOD_1 1 /* native */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 31
+#define GET_STR_PRECOMPUTE_THRESHOLD 52
+#define SET_STR_DC_THRESHOLD 1127
+#define SET_STR_PRECOMPUTE_THRESHOLD 1795
+
+#define MUL_FFT_TABLE { 336, 672, 1152, 3584, 10240, 24576, 163840, 393216, 0 }
+#define MUL_FFT_MODF_THRESHOLD 352
+#define MUL_FFT_THRESHOLD 7168
-#define MOD_1_NORM_THRESHOLD 12
-#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 41
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 32
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 3
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 128
-#define USE_PREINV_DIVREM_1 0
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD MP_SIZE_T_MAX /* never */
-
-#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 69
-#define MUL_TOOM44_THRESHOLD 106
-#define MUL_TOOM6H_THRESHOLD 157
-#define MUL_TOOM8H_THRESHOLD 199
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 69
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 65
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 64
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 32
-#define SQR_TOOM3_THRESHOLD 97
-#define SQR_TOOM4_THRESHOLD 143
-#define SQR_TOOM6_THRESHOLD 222
-#define SQR_TOOM8_THRESHOLD 272
-
-#define MULMOD_BNM1_THRESHOLD 13
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define MUL_FFT_MODF_THRESHOLD 476 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 476, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 11, 5}, { 23, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 11, 6}, { 23, 7}, { 13, 6}, \
- { 27, 7}, { 15, 6}, { 31, 7}, { 17, 6}, \
- { 35, 7}, { 21, 8}, { 11, 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}, \
- { 47,10}, { 31, 9}, { 79,10}, { 47, 9}, \
- { 95,11}, { 31,10}, { 63, 9}, { 135,10}, \
- { 79, 9}, { 167,10}, { 95, 9}, { 191,10}, \
- { 111,11}, { 63,10}, { 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}, { 351,11}, { 191,10}, \
- { 415, 9}, { 831,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 543,11}, { 287,10}, { 575,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 415,10}, \
- { 831,13}, { 127,12}, { 255,11}, { 543,10}, \
- { 1087,11}, { 575,12}, { 319,11}, { 703,12}, \
- { 383,11}, { 831,12}, { 447,11}, { 895,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1151,12}, { 703,13}, { 383,12}, { 959,14}, \
- { 255,13}, { 511,12}, { 1215,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 106
-#define MUL_FFT_THRESHOLD 7424
-
-#define SQR_FFT_MODF_THRESHOLD 432 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 432, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
- { 24, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 21, 8}, { 11, 7}, { 29, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 39, 8}, \
- { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
- { 39, 9}, { 23, 7}, { 93, 8}, { 47, 7}, \
- { 95, 8}, { 51,10}, { 15, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 71, 8}, \
- { 143, 9}, { 79,10}, { 47, 9}, { 95,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 167,10}, { 95, 9}, { 191,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 143, 9}, { 287, 8}, \
- { 575,10}, { 159, 9}, { 319,11}, { 95,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,10}, { 287,11}, \
- { 159,10}, { 319, 9}, { 639,10}, { 351, 9}, \
- { 703,11}, { 191,10}, { 415,11}, { 223,12}, \
- { 127,11}, { 255,10}, { 543,11}, { 287,10}, \
- { 607,11}, { 319,10}, { 639,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 415,10}, { 831,13}, \
- { 127,12}, { 255,11}, { 543,10}, { 1087,11}, \
- { 607,12}, { 319,11}, { 703,12}, { 383,11}, \
- { 831,12}, { 447,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,12}, { 703,13}, \
- { 383,12}, { 895,14}, { 255,13}, { 511,12}, \
- { 1215,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 112
-#define SQR_FFT_THRESHOLD 7040
-
-#define MULLO_BASECASE_THRESHOLD 3
-#define MULLO_DC_THRESHOLD 60
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#define DC_DIV_QR_THRESHOLD 78
-#define DC_DIVAPPR_Q_THRESHOLD 252
-#define DC_BDIV_QR_THRESHOLD 84
-#define DC_BDIV_Q_THRESHOLD 171
-
-#define INV_MULMOD_BNM1_THRESHOLD 55
-#define INV_NEWTON_THRESHOLD 234
-#define INV_APPR_THRESHOLD 236
-
-#define BINV_NEWTON_THRESHOLD 268
-#define REDC_1_TO_REDC_N_THRESHOLD 67
-
-#define MU_DIV_QR_THRESHOLD 1308
-#define MU_DIVAPPR_Q_THRESHOLD 1142
-#define MUPI_DIV_QR_THRESHOLD 134
-#define MU_BDIV_QR_THRESHOLD 1164
-#define MU_BDIV_Q_THRESHOLD 1164
-
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 182
-#define GCD_DC_THRESHOLD 591
-#define GCDEXT_DC_THRESHOLD 472
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 24
-#define GET_STR_PRECOMPUTE_THRESHOLD 40
-#define SET_STR_DC_THRESHOLD 834
-#define SET_STR_PRECOMPUTE_THRESHOLD 2042
+#define SQR_FFT_TABLE { 272, 672, 1408, 4608, 10240, 24576, 163840, 393216, 0 }
+#define SQR_FFT_MODF_THRESHOLD 336
+#define SQR_FFT_THRESHOLD 3840
diff --git a/gmp/mpn/x86/k6/k62mmx/copyd.asm b/gmp/mpn/x86/k6/k62mmx/copyd.asm
index f80a5a1cdb..227ed78783 100644
--- a/gmp/mpn/x86/k6/k62mmx/copyd.asm
+++ b/gmp/mpn/x86/k6/k62mmx/copyd.asm
@@ -1,32 +1,21 @@
dnl AMD K6-2 mpn_copyd -- copy limb vector, decrementing.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/k62mmx/lshift.asm b/gmp/mpn/x86/k6/k62mmx/lshift.asm
index c86575feed..e48e73e19a 100644
--- a/gmp/mpn/x86/k6/k62mmx/lshift.asm
+++ b/gmp/mpn/x86/k6/k62mmx/lshift.asm
@@ -1,32 +1,21 @@
dnl AMD K6-2 mpn_lshift -- mpn left shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/k62mmx/rshift.asm b/gmp/mpn/x86/k6/k62mmx/rshift.asm
index f604a7bd52..b3114d0e6e 100644
--- a/gmp/mpn/x86/k6/k62mmx/rshift.asm
+++ b/gmp/mpn/x86/k6/k62mmx/rshift.asm
@@ -1,32 +1,21 @@
dnl AMD K6-2 mpn_rshift -- mpn right shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/mmx/com.asm b/gmp/mpn/x86/k6/mmx/com_n.asm
index b747454627..42e6ab392a 100644
--- a/gmp/mpn/x86/k6/mmx/com.asm
+++ b/gmp/mpn/x86/k6/mmx/com_n.asm
@@ -1,32 +1,21 @@
-dnl AMD K6-2 mpn_com -- mpn bitwise one's complement.
+dnl AMD K6-2 mpn_com_n -- mpn bitwise one's complement.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -39,7 +28,7 @@ C K6-2 1.0 1.18 1.18 1.18 cycles/limb
C K6 1.5 1.85 1.75 1.85
-C void mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
+C void mpn_com_n (mp_ptr dst, mp_srcptr src, mp_size_t size);
C
C Take the bitwise ones-complement of src,size and write it to dst,size.
@@ -49,7 +38,7 @@ defframe(PARAM_DST, 4)
TEXT
ALIGN(16)
-PROLOGUE(mpn_com)
+PROLOGUE(mpn_com_n)
deflit(`FRAME',0)
movl PARAM_SIZE, %ecx
diff --git a/gmp/mpn/x86/k6/mmx/dive_1.asm b/gmp/mpn/x86/k6/mmx/dive_1.asm
index b644dca8cd..9cc90d88a5 100644
--- a/gmp/mpn/x86/k6/mmx/dive_1.asm
+++ b/gmp/mpn/x86/k6/mmx/dive_1.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_divexact_1 -- mpn by limb exact division.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -128,7 +117,7 @@ Zdisp( movzbl, 0,(%eax,%ebp), %eax)
subl %ebp, %eax C inv = 2*inv - inv*inv*d
subl $1, %edx C shift amount, and clear carry
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB
pushl %eax FRAME_pushl()
imull PARAM_DIVISOR, %eax
cmpl $1, %eax
diff --git a/gmp/mpn/x86/k6/mmx/logops_n.asm b/gmp/mpn/x86/k6/mmx/logops_n.asm
index e17930bb2d..a6272131a2 100644
--- a/gmp/mpn/x86/k6/mmx/logops_n.asm
+++ b/gmp/mpn/x86/k6/mmx/logops_n.asm
@@ -1,33 +1,22 @@
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-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/mmx/lshift.asm b/gmp/mpn/x86/k6/mmx/lshift.asm
index 45be582633..1492025171 100644
--- a/gmp/mpn/x86/k6/mmx/lshift.asm
+++ b/gmp/mpn/x86/k6/mmx/lshift.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_lshift -- mpn left shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/mmx/popham.asm b/gmp/mpn/x86/k6/mmx/popham.asm
index 2b19d0b5ee..a0a651d39c 100644
--- a/gmp/mpn/x86/k6/mmx/popham.asm
+++ b/gmp/mpn/x86/k6/mmx/popham.asm
@@ -1,33 +1,22 @@
dnl AMD K6-2 mpn_popcount, mpn_hamdist -- mpn bit population count and
dnl hamming distance.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/mmx/rshift.asm b/gmp/mpn/x86/k6/mmx/rshift.asm
index cd0382f322..80cd6fb05a 100644
--- a/gmp/mpn/x86/k6/mmx/rshift.asm
+++ b/gmp/mpn/x86/k6/mmx/rshift.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_rshift -- mpn right shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/mod_34lsub1.asm b/gmp/mpn/x86/k6/mod_34lsub1.asm
index 7e30503e54..a5b7ee1064 100644
--- a/gmp/mpn/x86/k6/mod_34lsub1.asm
+++ b/gmp/mpn/x86/k6/mod_34lsub1.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_mod_34lsub1 -- mpn remainder modulo 2**24-1.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/mode1o.asm b/gmp/mpn/x86/k6/mode1o.asm
index a13f647b81..f299877911 100644
--- a/gmp/mpn/x86/k6/mode1o.asm
+++ b/gmp/mpn/x86/k6/mode1o.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_modexact_1_odd -- exact division style remainder.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -114,7 +103,7 @@ Zdisp( movzbl, 0,(%ecx,%edi), %edi) C inv 8 bits
subl %ecx, %edi C inv = 2*inv - inv*inv*d
- ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB
pushl %eax
movl %esi, %eax
imull %edi, %eax
diff --git a/gmp/mpn/x86/k6/mul_1.asm b/gmp/mpn/x86/k6/mul_1.asm
index 3ef7ec24fe..e1c468fe34 100644
--- a/gmp/mpn/x86/k6/mul_1.asm
+++ b/gmp/mpn/x86/k6/mul_1.asm
@@ -1,49 +1,38 @@
dnl AMD K6 mpn_mul_1 -- mpn by limb multiply.
dnl Copyright 1999, 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 5.5
+C cycles/limb
+C P5:
+C P6 model 0-8,10-12) 5.5
C P6 model 9 (Banias)
-C P6 model 13 (Dothan) 4.87
+C P6 model 13 (Dothan) 4.87
C P4 model 0 (Willamette)
C P4 model 1 (?)
C P4 model 2 (Northwood)
C P4 model 3 (Prescott)
C P4 model 4 (Nocona)
-C AMD K6 6.25
-C AMD K7
-C AMD K8
+C K6: 6.25
+C K7:
+C K8:
C mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
diff --git a/gmp/mpn/x86/k6/mul_basecase.asm b/gmp/mpn/x86/k6/mul_basecase.asm
index 7030001c3f..dcd4d70082 100644
--- a/gmp/mpn/x86/k6/mul_basecase.asm
+++ b/gmp/mpn/x86/k6/mul_basecase.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_mul_basecase -- multiply two mpn numbers.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/pre_mod_1.asm b/gmp/mpn/x86/k6/pre_mod_1.asm
index 34db20d386..3231539bfd 100644
--- a/gmp/mpn/x86/k6/pre_mod_1.asm
+++ b/gmp/mpn/x86/k6/pre_mod_1.asm
@@ -1,32 +1,21 @@
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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k6/sqr_basecase.asm b/gmp/mpn/x86/k6/sqr_basecase.asm
index b7ecb5cc8a..3392d38812 100644
--- a/gmp/mpn/x86/k6/sqr_basecase.asm
+++ b/gmp/mpn/x86/k6/sqr_basecase.asm
@@ -1,32 +1,21 @@
dnl AMD K6 mpn_sqr_basecase -- square an mpn number.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -36,35 +25,35 @@ C product (measured on the speed difference between 17 and 33 limbs,
C which is roughly the Karatsuba recursing range).
-dnl SQR_TOOM2_THRESHOLD_MAX is the maximum SQR_TOOM2_THRESHOLD this
+dnl SQR_KARATSUBA_THRESHOLD_MAX is the maximum SQR_KARATSUBA_THRESHOLD this
dnl code supports. This value is used only by the tune program to know
dnl what it can go up to. (An attempt to compile with a bigger value will
dnl trigger some m4_assert()s in the code, making the build fail.)
dnl
dnl The value is determined by requiring the displacements in the unrolled
dnl addmul to fit in single bytes. This means a maximum UNROLL_COUNT of
-dnl 63, giving a maximum SQR_TOOM2_THRESHOLD of 66.
+dnl 63, giving a maximum SQR_KARATSUBA_THRESHOLD of 66.
-deflit(SQR_TOOM2_THRESHOLD_MAX, 66)
+deflit(SQR_KARATSUBA_THRESHOLD_MAX, 66)
dnl Allow a value from the tune program to override config.m4.
-ifdef(`SQR_TOOM2_THRESHOLD_OVERRIDE',
-`define(`SQR_TOOM2_THRESHOLD',SQR_TOOM2_THRESHOLD_OVERRIDE)')
+ifdef(`SQR_KARATSUBA_THRESHOLD_OVERRIDE',
+`define(`SQR_KARATSUBA_THRESHOLD',SQR_KARATSUBA_THRESHOLD_OVERRIDE)')
dnl UNROLL_COUNT is the number of code chunks in the unrolled addmul. The
-dnl number required is determined by SQR_TOOM2_THRESHOLD, since
-dnl mpn_sqr_basecase only needs to handle sizes < SQR_TOOM2_THRESHOLD.
+dnl number required is determined by SQR_KARATSUBA_THRESHOLD, since
+dnl mpn_sqr_basecase only needs to handle sizes < SQR_KARATSUBA_THRESHOLD.
dnl
dnl The first addmul is the biggest, and this takes the second least
dnl significant limb and multiplies it by the third least significant and
-dnl up. Hence for a maximum operand size of SQR_TOOM2_THRESHOLD-1
-dnl limbs, UNROLL_COUNT needs to be SQR_TOOM2_THRESHOLD-3.
+dnl up. Hence for a maximum operand size of SQR_KARATSUBA_THRESHOLD-1
+dnl limbs, UNROLL_COUNT needs to be SQR_KARATSUBA_THRESHOLD-3.
-m4_config_gmp_mparam(`SQR_TOOM2_THRESHOLD')
-deflit(UNROLL_COUNT, eval(SQR_TOOM2_THRESHOLD-3))
+m4_config_gmp_mparam(`SQR_KARATSUBA_THRESHOLD')
+deflit(UNROLL_COUNT, eval(SQR_KARATSUBA_THRESHOLD-3))
C void mpn_sqr_basecase (mp_ptr dst, mp_srcptr src, mp_size_t size);
diff --git a/gmp/mpn/x86/k7/README b/gmp/mpn/x86/k7/README
index 5711b612c5..e2c5e0c18d 100644
--- a/gmp/mpn/x86/k7/README
+++ b/gmp/mpn/x86/k7/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/x86/k7/addlsh1_n.asm b/gmp/mpn/x86/k7/addlsh1_n.asm
deleted file mode 100644
index a957b6f78e..0000000000
--- a/gmp/mpn/x86/k7/addlsh1_n.asm
+++ /dev/null
@@ -1,196 +0,0 @@
-dnl AMD K7 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 This is an attempt at an addlsh1_n for x86-32, not relying on sse2 insns.
-C The innerloop is 2*3-way unrolled, which is best we can do with the available
-C registers. It seems tricky to use the same structure for rsblsh1_n, since we
-C cannot feed carry between operations there.
-
-C cycles/limb
-C P5
-C P6 model 0-8,10-12
-C P6 model 9 (Banias)
-C P6 model 13 (Dothan) 5.4 (worse than add_n + lshift)
-C P4 model 0 (Willamette)
-C P4 model 1 (?)
-C P4 model 2 (Northwood)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 6
-C AMD K6 ?
-C AMD K7 2.5
-C AMD K8
-
-C This is a basic addlsh1_n for k7, atom, and perhaps some other x86-32
-C processors. It uses 2*3-way unrolling, for good reasons. Unfortunately,
-C that means we need an initial magic multiply.
-C
-C It is not clear how to do sublsh1_n or rsblsh1_n using the same pattern. We
-C cannot do rsblsh1_n since we feed carry from the shift blocks to the
-C add/subtract blocks, which is right for addition but reversed for
-C subtraction. We could perhaps do sublsh1_n, with some extra move insns,
-C without losing any time, since we're not issue limited but carry recurrency
-C latency.
-C
-C Breaking carry recurrency might be a good idea. We would then need separate
-C registers for the shift carry and add/subtract carry, which in turn would
-C force is to 2*2-way unrolling.
-
-defframe(PARAM_SIZE, 16)
-defframe(PARAM_DBLD, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(VAR_COUNT,`PARAM_DST')
-define(VAR_TMP,`PARAM_DBLD')
-
-ASM_START()
- TEXT
- ALIGN(8)
-PROLOGUE(mpn_addlsh1_n)
-deflit(`FRAME',0)
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`vp', `%ebp')
-
- mov $0x2aaaaaab, %eax
-
- push %ebx FRAME_pushl()
- mov PARAM_SIZE, %ebx C size
-
- push rp FRAME_pushl()
- mov PARAM_DST, rp
-
- mul %ebx
-
- push up FRAME_pushl()
- mov PARAM_SRC, up
-
- not %edx C count = -(size\8)-1
- mov %edx, VAR_COUNT
-
- push vp FRAME_pushl()
- mov PARAM_DBLD, vp
-
- lea 3(%edx,%edx,2), %ecx C count*3+3 = -(size\6)*3
- xor %edx, %edx
- lea (%ebx,%ecx,2), %ebx C size + (count*3+3)*2 = size % 6
- or %ebx, %ebx
- jz L(exact)
-
-L(oop):
-ifdef(`CPU_P6',`
- shr %edx ') C restore 2nd saved carry bit
- mov (vp), %eax
- adc %eax, %eax
- rcr %edx C restore 1st saved carry bit
- lea 4(vp), vp
- adc (up), %eax
- lea 4(up), up
- adc %edx, %edx C save a carry bit in edx
-ifdef(`CPU_P6',`
- adc %edx, %edx ') C save another carry bit in edx
- dec %ebx
- mov %eax, (rp)
- lea 4(rp), rp
- jnz L(oop)
- mov vp, VAR_TMP
-L(exact):
- incl VAR_COUNT
- jz L(end)
-
- ALIGN(16)
-L(top):
-ifdef(`CPU_P6',`
- shr %edx ') C restore 2nd saved carry bit
- mov (vp), %eax
- adc %eax, %eax
- mov 4(vp), %ebx
- adc %ebx, %ebx
- mov 8(vp), %ecx
- adc %ecx, %ecx
-
- rcr %edx C restore 1st saved carry bit
-
- adc (up), %eax
- mov %eax, (rp)
- adc 4(up), %ebx
- mov %ebx, 4(rp)
- adc 8(up), %ecx
- mov %ecx, 8(rp)
-
- mov 12(vp), %eax
- adc %eax, %eax
- mov 16(vp), %ebx
- adc %ebx, %ebx
- mov 20(vp), %ecx
- adc %ecx, %ecx
-
- lea 24(vp), vp
- adc %edx, %edx C save a carry bit in edx
-
- adc 12(up), %eax
- mov %eax, 12(rp)
- adc 16(up), %ebx
- mov %ebx, 16(rp)
- adc 20(up), %ecx
-
- lea 24(up), up
-
-ifdef(`CPU_P6',`
- adc %edx, %edx ') C save another carry bit in edx
- mov %ecx, 20(rp)
- incl VAR_COUNT
- lea 24(rp), rp
- jne L(top)
-
-L(end):
- pop vp FRAME_popl()
- pop up FRAME_popl()
-
-ifdef(`CPU_P6',`
- xor %eax, %eax
- shr $1, %edx
- adc %edx, %eax
-',`
- adc $0, %edx
- mov %edx, %eax
-')
- pop rp FRAME_popl()
- pop %ebx FRAME_popl()
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/k7/aors_n.asm b/gmp/mpn/x86/k7/aors_n.asm
index 1a08072029..d84de3ee98 100644
--- a/gmp/mpn/x86/k7/aors_n.asm
+++ b/gmp/mpn/x86/k7/aors_n.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_add_n/mpn_sub_n -- mpn add or subtract.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k7/aorsmul_1.asm b/gmp/mpn/x86/k7/aorsmul_1.asm
index eec8df6de2..b247c29131 100644
--- a/gmp/mpn/x86/k7/aorsmul_1.asm
+++ b/gmp/mpn/x86/k7/aorsmul_1.asm
@@ -1,49 +1,39 @@
dnl AMD K7 mpn_addmul_1/mpn_submul_1 -- add or subtract mpn multiple.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2005, 2008 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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) 6.5
+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)
C P4 model 3 (Prescott)
C P4 model 4 (Nocona)
-C AMD K6
-C AMD K7 3.75
-C AMD K8
+C K6:
+C K7: 3.75
+C K8:
C TODO
C * Improve feed-in and wind-down code. We beat the old code for all n != 1,
diff --git a/gmp/mpn/x86/k7/bdiv_q_1.asm b/gmp/mpn/x86/k7/bdiv_q_1.asm
deleted file mode 100644
index df3477f539..0000000000
--- a/gmp/mpn/x86/k7/bdiv_q_1.asm
+++ /dev/null
@@ -1,244 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Athlon: 11.0
-C Hammer: 9.0
-
-
-C void mpn_divexact_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_limb_t divisor);
-C
-C The dependent chain is mul+imul+sub for 11 cycles and that speed is
-C achieved with no special effort. The load and shrld latencies are hidden
-C by out of order execution.
-C
-C It's a touch faster on size==1 to use the mul-by-inverse than divl.
-
-defframe(PARAM_SHIFT, 24)
-defframe(PARAM_INVERSE,20)
-defframe(PARAM_DIVISOR,16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-defframe(SAVE_EBX, -4)
-defframe(SAVE_ESI, -8)
-defframe(SAVE_EDI, -12)
-defframe(SAVE_EBP, -16)
-defframe(VAR_INVERSE, -20)
-defframe(VAR_DST_END, -24)
-
-deflit(STACK_SPACE, 24)
-
- TEXT
-
-C mp_limb_t
-C mpn_pi1_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor,
-C mp_limb_t inverse, int shift)
- ALIGN(16)
-PROLOGUE(mpn_pi1_bdiv_q_1)
-deflit(`FRAME',0)
-
- subl $STACK_SPACE, %esp deflit(`FRAME',STACK_SPACE)
- movl PARAM_SHIFT, %ecx C shift count
-
- movl %ebp, SAVE_EBP
- movl PARAM_SIZE, %ebp
-
- movl %esi, SAVE_ESI
- movl PARAM_SRC, %esi
-
- movl %edi, SAVE_EDI
- movl PARAM_DST, %edi
-
- movl %ebx, SAVE_EBX
-
- leal (%esi,%ebp,4), %esi C src end
- leal (%edi,%ebp,4), %edi C dst end
- negl %ebp C -size
-
- movl PARAM_INVERSE, %eax C inv
-
-L(common):
- movl %eax, VAR_INVERSE
- movl (%esi,%ebp,4), %eax C src[0]
-
- incl %ebp
- jz L(one)
-
- movl (%esi,%ebp,4), %edx C src[1]
-
- shrdl( %cl, %edx, %eax)
-
- movl %edi, VAR_DST_END
- xorl %ebx, %ebx
- jmp L(entry)
-
- ALIGN(8)
-L(top):
- C eax q
- C ebx carry bit, 0 or 1
- C ecx shift
- C edx
- C esi src end
- C edi dst end
- C ebp counter, limbs, negative
-
- mull PARAM_DIVISOR C carry limb in edx
-
- movl -4(%esi,%ebp,4), %eax
- movl (%esi,%ebp,4), %edi
-
- shrdl( %cl, %edi, %eax)
-
- subl %ebx, %eax C apply carry bit
- setc %bl
- movl VAR_DST_END, %edi
-
- subl %edx, %eax C apply carry limb
- adcl $0, %ebx
-
-L(entry):
- imull VAR_INVERSE, %eax
-
- movl %eax, -4(%edi,%ebp,4)
- incl %ebp
- jnz L(top)
-
-
- mull PARAM_DIVISOR C carry limb in edx
-
- movl -4(%esi), %eax C src high limb
- shrl %cl, %eax
- movl SAVE_ESI, %esi
-
- subl %ebx, %eax C apply carry bit
- movl SAVE_EBX, %ebx
- movl SAVE_EBP, %ebp
-
- subl %edx, %eax C apply carry limb
-
- imull VAR_INVERSE, %eax
-
- movl %eax, -4(%edi)
- movl SAVE_EDI, %edi
- addl $STACK_SPACE, %esp
-
- ret
-
-L(one):
- shrl %cl, %eax
- movl SAVE_ESI, %esi
- movl SAVE_EBX, %ebx
-
- imull VAR_INVERSE, %eax
-
- movl SAVE_EBP, %ebp
-
- movl %eax, -4(%edi)
- movl SAVE_EDI, %edi
- addl $STACK_SPACE, %esp
-
- ret
-EPILOGUE()
-
-C mp_limb_t mpn_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_limb_t divisor);
-C
-
- ALIGN(16)
-PROLOGUE(mpn_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl PARAM_DIVISOR, %eax
- subl $STACK_SPACE, %esp deflit(`FRAME',STACK_SPACE)
- movl $-1, %ecx C shift count
-
- movl %ebp, SAVE_EBP
- movl PARAM_SIZE, %ebp
-
- movl %esi, SAVE_ESI
- movl %edi, SAVE_EDI
-
- C If there's usually only one or two trailing zero bits then this
- C should be faster than bsfl.
-L(strip_twos):
- incl %ecx
- shrl %eax
- jnc L(strip_twos)
-
- movl %ebx, SAVE_EBX
- leal 1(%eax,%eax), %ebx C d without twos
- andl $127, %eax C d/2, 7 bits
-
-ifdef(`PIC',`
- LEA( binvert_limb_table, %edx)
- movzbl (%eax,%edx), %eax C inv 8 bits
-',`
- movzbl binvert_limb_table(%eax), %eax C inv 8 bits
-')
-
- leal (%eax,%eax), %edx C 2*inv
- movl %ebx, PARAM_DIVISOR C d without twos
-
- imull %eax, %eax C inv*inv
-
- movl PARAM_SRC, %esi
- movl PARAM_DST, %edi
-
- imull %ebx, %eax C inv*inv*d
-
- subl %eax, %edx C inv = 2*inv - inv*inv*d
- leal (%edx,%edx), %eax C 2*inv
-
- imull %edx, %edx C inv*inv
-
- leal (%esi,%ebp,4), %esi C src end
- leal (%edi,%ebp,4), %edi C dst end
- negl %ebp C -size
-
- imull %ebx, %edx C inv*inv*d
-
- subl %edx, %eax C inv = 2*inv - inv*inv*d
-
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
- pushl %eax FRAME_pushl()
- imull PARAM_DIVISOR, %eax
- cmpl $1, %eax
- popl %eax FRAME_popl()')
-
- jmp L(common)
-EPILOGUE()
diff --git a/gmp/mpn/x86/k7/dive_1.asm b/gmp/mpn/x86/k7/dive_1.asm
index 8eb4f45ac0..c994e0fb06 100644
--- a/gmp/mpn/x86/k7/dive_1.asm
+++ b/gmp/mpn/x86/k7/dive_1.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_divexact_1 -- mpn by limb exact division.
dnl Copyright 2001, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -116,7 +105,7 @@ ifdef(`PIC',`
subl %edx, %eax C inv = 2*inv - inv*inv*d
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB
pushl %eax FRAME_pushl()
imull PARAM_DIVISOR, %eax
cmpl $1, %eax
diff --git a/gmp/mpn/x86/k7/gcd_1.asm b/gmp/mpn/x86/k7/gcd_1.asm
index c7d12c83c0..f912f43730 100644
--- a/gmp/mpn/x86/k7/gcd_1.asm
+++ b/gmp/mpn/x86/k7/gcd_1.asm
@@ -1,186 +1,369 @@
-dnl x86 mpn_gcd_1 optimised for AMD K7.
+dnl AMD K7 mpn_gcd_1 -- mpn by 1 gcd.
-dnl Contributed to the GNU project by by Kevin Ryde. Rehacked by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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/bit (approx)
-C AMD K7 5.31
-C AMD K8,K9 5.33
-C AMD K10 5.30
-C AMD bd1 ?
-C AMD bobcat 7.02
-C Intel P4-2 10.1
-C Intel P4-3/4 10.0
-C Intel P6/13 5.88
-C Intel core2 6.26
-C Intel NHM 6.83
-C Intel SBR 8.50
-C Intel atom 8.90
-C VIA nano ?
-C Numbers measured with: speed -CD -s16-32 -t16 mpn_gcd_1
-
-C TODO
-C * Tune overhead, this takes 2-3 cycles more than old code when v0 is tiny.
-C * Stream things better through registers, avoiding some copying.
-
-C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+C K7: 6.75 cycles/bit (approx) 1x1 gcd
+C 11.0 cycles/limb Nx1 reduction (modexact_1_odd)
+
+
+dnl Reduce using x%y if x is more than DIV_THRESHOLD bits bigger than y,
+dnl where x is the larger of the two. See tune/README for more.
+dnl
+dnl divl at 40 cycles compared to the gcd at about 7 cycles/bitpair
+dnl suggests 40/7*2=11.4 but 7 seems to be about right.
+
+deflit(DIV_THRESHOLD, 7)
+
+C table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
+C
+C This is mixed in with the code, but as per the k7 optimization manual it's
+C a full cache line and suitably aligned so it won't get swapped between
+C code and data. Having it in TEXT rather than RODATA saves needing a GOT
+C entry when PIC.
+C
+C Actually, there doesn't seem to be a measurable difference between this in
+C it's own cache line or plonked in the middle of the code. Presumably
+C since TEXT is read-only there's no worries about coherency.
+
+deflit(MASK, 63)
deflit(MAXSHIFT, 6)
-deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
-DEF_OBJECT(ctz_table,64)
+ TEXT
+ ALIGN(64)
+L(table):
.byte MAXSHIFT
forloop(i,1,MASK,
` .byte m4_count_trailing_zeros(i)
')
-END_OBJECT(ctz_table)
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`DIV_THRES_LOG2', 7)
+C mp_limb_t mpn_gcd_1 (mp_srcptr src, mp_size_t size, mp_limb_t limb);
+C
+
+defframe(PARAM_LIMB, 12)
+defframe(PARAM_SIZE, 8)
+defframe(PARAM_SRC, 4)
-define(`up', `%edi')
-define(`n', `%esi')
-define(`v0', `%edx')
+defframe(SAVE_EBX, -4)
+defframe(SAVE_ESI, -8)
+defframe(SAVE_EDI, -12)
+defframe(SAVE_EBP, -16)
+defframe(CALL_DIVISOR,-20)
+defframe(CALL_SIZE, -24)
+defframe(CALL_SRC, -28)
+deflit(STACK_SPACE, 28)
-ASM_START()
TEXT
ALIGN(16)
+
PROLOGUE(mpn_gcd_1)
- push %edi
- push %esi
+deflit(`FRAME',0)
+
+ ASSERT(ne, `cmpl $0, PARAM_LIMB') C y!=0
+ ASSERT(ae, `cmpl $1, PARAM_SIZE') C size>=1
+
+ movl PARAM_SRC, %eax
+ movl PARAM_LIMB, %edx
+ subl $STACK_SPACE, %esp deflit(`FRAME',STACK_SPACE)
- mov 12(%esp), up
- mov 16(%esp), n
- mov 20(%esp), v0
+ movl %esi, SAVE_ESI
+ movl %ebx, SAVE_EBX
- mov (up), %eax C U low limb
- or v0, %eax C x | y
- mov $-1, %ecx
+ movl (%eax), %esi C src low limb
+
+ifdef(`PIC',`
+ movl %edi, SAVE_EDI
+ call L(movl_eip_to_edi)
+L(here):
+ addl $L(table)-L(here), %edi
+')
+
+ movl %esi, %ebx
+ orl %edx, %esi C x|y
+ movl $-1, %ecx
L(twos):
- inc %ecx
- shr %eax
- jnc L(twos)
+ incl %ecx
+ shrl %esi
+ jnc L(twos) C 3/4 chance of x or y odd already
- shr %cl, v0
- mov %ecx, %eax C common twos
+ shrl %cl, %ebx
+ shrl %cl, %edx
+ movl %ecx, %esi C common twos
-L(divide_strip_y):
- shr v0
- jnc L(divide_strip_y)
- adc v0, v0
-
- push %eax
- push v0
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %ecx
- mov %ecx, %eax
- shr $DIV_THRES_LOG2, %ecx
- cmp %ecx, v0
- ja L(reduced)
-
- mov v0, %esi
- xor %edx, %edx
- div %esi
- mov %edx, %eax
- jmp L(reduced)
-
-L(reduce_nby1):
-ifdef(`PIC_WITH_EBX',`
- push %ebx
- call L(movl_eip_to_ebx)
- add $_GLOBAL_OFFSET_TABLE_, %ebx
+ movl PARAM_SIZE, %ecx
+ cmpl $1, %ecx
+ ja L(divide)
+
+
+ C eax
+ C ebx x
+ C ecx
+ C edx y
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp
+
+ movl %edx, %eax
+ cmpl %ebx, %edx
+
+ cmovb( %ebx, %eax) C swap to make x bigger than y
+ cmovb( %edx, %ebx)
+
+
+L(strip_y):
+ C eax x
+ C ebx y
+ C ecx
+ C edx
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp
+
+ ASSERT(nz,`orl %ebx,%ebx')
+ shrl %ebx
+ jnc L(strip_y)
+ rcll %ebx
+
+
+ C eax x
+ C ebx y (odd)
+ C ecx
+ C edx
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp
+
+ movl %eax, %ecx
+ movl %ebx, %edx
+ shrl $DIV_THRESHOLD, %eax
+
+ cmpl %eax, %ebx
+ movl %ecx, %eax
+ ja L(strip_x_entry) C do x%y if x much bigger than y
+
+
+ xorl %edx, %edx
+
+ divl %ebx
+
+ orl %edx, %edx
+ movl %edx, %eax C remainder -> x
+ movl %ebx, %edx C y
+
+ jz L(done_ebx)
+ jmp L(strip_x)
+
+
+ C Offset 0x9D here for non-PIC. About 0.4 cycles/bit is saved by
+ C ensuring the end of the jnz at the end of this loop doesn't cross
+ C into the next cache line at 0xC0.
+ C
+ C PIC on the other hand is offset 0xAC here and extends to 0xC9, so
+ C it crosses but doesn't suffer any measurable slowdown.
+
+L(top):
+ C eax x
+ C ebx y-x
+ C ecx x-y
+ C edx y
+ C esi twos, for use at end
+ C edi [PIC] L(table)
+
+ cmovc( %ebx, %ecx) C if x-y gave carry, use x and y-x
+ cmovc( %eax, %edx)
+
+L(strip_x):
+ movl %ecx, %eax
+L(strip_x_entry):
+ andl $MASK, %ecx
+
+ ASSERT(nz, `orl %eax, %eax')
+
+ifdef(`PIC',`
+ movb (%ecx,%edi), %cl
+',`
+ movb L(table) (%ecx), %cl
')
- push v0 C param 3
- push n C param 2
- push up C param 1
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
- CALL( mpn_mod_1)
- jmp L(called)
-L(bmod):
- CALL( mpn_modexact_1_odd)
-
-L(called):
- add $12, %esp C deallocate params
-ifdef(`PIC_WITH_EBX',`
- pop %ebx
+
+ shrl %cl, %eax
+ cmpb $MAXSHIFT, %cl
+
+ movl %eax, %ecx
+ movl %edx, %ebx
+ je L(strip_x)
+
+ ASSERT(nz, `testl $1, %eax') C both odd
+ ASSERT(nz, `testl $1, %edx')
+
+ subl %eax, %ebx
+ subl %edx, %ecx
+ jnz L(top)
+
+
+L(done):
+ movl %esi, %ecx
+ movl SAVE_ESI, %esi
+ifdef(`PIC',`
+ movl SAVE_EDI, %edi
')
-L(reduced):
- pop %edx
-
- LEA( ctz_table, %esi)
- test %eax, %eax
- mov %eax, %ecx
- jnz L(mid)
- jmp L(end)
-
- ALIGN(16) C K8 BC P4 NHM SBR
-L(top): cmovc( %ecx, %eax) C if x-y < 0 0
- cmovc( %edi, %edx) C use x,y-x 0
-L(mid): and $MASK, %ecx C 0
- movzbl (%esi,%ecx), %ecx C 1
- jz L(shift_alot) C 1
- shr %cl, %eax C 3
- mov %eax, %edi C 4
- mov %edx, %ecx C 3
- sub %eax, %ecx C 4
- sub %edx, %eax C 4
- jnz L(top) C 5
-
-L(end): pop %ecx
- mov %edx, %eax
- shl %cl, %eax
- pop %esi
- pop %edi
- ret
-L(shift_alot):
- shr $MAXSHIFT, %eax
- mov %eax, %ecx
- jmp L(mid)
+ shll %cl, %eax
+ movl SAVE_EBX, %ebx
+ addl $FRAME, %esp
-ifdef(`PIC_WITH_EBX',`
-L(movl_eip_to_ebx):
- mov (%esp), %ebx
ret
+
+
+
+C -----------------------------------------------------------------------------
+C two or more limbs
+
+dnl MODEXACT_THRESHOLD is the size at which it's better to call
+dnl mpn_modexact_1_odd than do an inline loop.
+
+deflit(MODEXACT_THRESHOLD, ifdef(`PIC',6,5))
+
+L(divide):
+ C eax src
+ C ebx
+ C ecx size
+ C edx y
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp
+
+L(divide_strip_y):
+ ASSERT(nz,`orl %edx,%edx')
+ shrl %edx
+ jnc L(divide_strip_y)
+ leal 1(%edx,%edx), %ebx C y now odd
+
+ movl %ebp, SAVE_EBP
+ movl %eax, %ebp
+ movl -4(%eax,%ecx,4), %eax C src high limb
+
+ cmp $MODEXACT_THRESHOLD, %ecx
+ jae L(modexact)
+
+ cmpl %ebx, %eax C high cmp divisor
+ movl $0, %edx
+
+ cmovc( %eax, %edx) C skip a div if high<divisor
+ sbbl $0, %ecx
+
+
+L(divide_top):
+ C eax scratch (quotient)
+ C ebx y
+ C ecx counter (size to 1, inclusive)
+ C edx carry (remainder)
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp src
+
+ movl -4(%ebp,%ecx,4), %eax
+
+ divl %ebx
+
+ decl %ecx
+ jnz L(divide_top)
+
+
+ C eax
+ C ebx y (odd)
+ C ecx
+ C edx x
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp
+
+ orl %edx, %edx
+ movl SAVE_EBP, %ebp
+ movl %edx, %eax
+
+ movl %edx, %ecx
+ movl %ebx, %edx
+ jnz L(strip_x_entry)
+
+
+L(done_ebx):
+ movl %ebx, %eax
+ jmp L(done)
+
+
+
+L(modexact):
+ C eax
+ C ebx y
+ C ecx size
+ C edx
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp src
+
+ifdef(`PIC',`
+ movl %ebp, CALL_SRC
+ movl %ebx, %ebp C y
+ movl %edi, %ebx C L(table)
+
+ addl $_GLOBAL_OFFSET_TABLE_+[.-L(table)], %ebx
+ movl %ebp, CALL_DIVISOR
+ movl %ecx, CALL_SIZE
+
+ call GSYM_PREFIX`'mpn_modexact_1_odd@PLT
+',`
+dnl non-PIC
+ movl %ebx, CALL_DIVISOR
+ movl %ebp, CALL_SRC
+ movl %ecx, CALL_SIZE
+
+ call GSYM_PREFIX`'mpn_modexact_1_odd
')
+
+ C eax x
+ C ebx [non-PIC] y
+ C ecx
+ C edx
+ C esi common twos
+ C edi [PIC] L(table)
+ C ebp [PIC] y
+
+ orl %eax, %eax
+ movl ifdef(`PIC',`%ebp',`%ebx'), %edx
+ movl SAVE_EBP, %ebp
+
+ movl %eax, %ecx
+ jnz L(strip_x_entry)
+
+ movl %edx, %eax
+ jmp L(done)
+
+
+ifdef(`PIC', `
+L(movl_eip_to_edi):
+ movl (%esp), %edi
+ ret_internal
+')
+
EPILOGUE()
diff --git a/gmp/mpn/x86/k7/gmp-mparam.h b/gmp/mpn/x86/k7/gmp-mparam.h
index 9977a113e2..ced0c020f7 100644
--- a/gmp/mpn/x86/k7/gmp-mparam.h
+++ b/gmp/mpn/x86/k7/gmp-mparam.h
@@ -1,241 +1,73 @@
/* AMD K7 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2005, 2008-2010, 2014 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 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 either:
+it under the terms of the GNU 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 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.
-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.
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
-or both in parallel, as here.
-The GNU MP Library is distributed in the hope that 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
-
-/* 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
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 7
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 3
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 24
-#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 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 98
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 102
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 124
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 50
-#define SQR_TOOM3_THRESHOLD 81
-#define SQR_TOOM4_THRESHOLD 216
-#define SQR_TOOM6_THRESHOLD 306
-#define SQR_TOOM8_THRESHOLD 446
-
-#define MULMID_TOOM42_THRESHOLD 56
-
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define MUL_FFT_MODF_THRESHOLD 904 /* k = 6 */
-#define MUL_FFT_TABLE3 \
- { { 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,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,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}, { 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 229
-#define SQR_FFT_THRESHOLD 7552
-
-#define MULLO_BASECASE_THRESHOLD 8
-#define MULLO_DC_THRESHOLD 36
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#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 62
-#define INV_NEWTON_THRESHOLD 204
-#define INV_APPR_THRESHOLD 204
-
-#define BINV_NEWTON_THRESHOLD 230
-#define REDC_1_TO_REDC_N_THRESHOLD 59
-
-#define MU_DIV_QR_THRESHOLD 1752
-#define MU_DIVAPPR_Q_THRESHOLD 1528
-#define MUPI_DIV_QR_THRESHOLD 82
-#define MU_BDIV_QR_THRESHOLD 1360
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define POWM_SEC_TABLE 1,16,102,336,1221
-
-#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 120
-#define HGCD_APPR_THRESHOLD 143
-#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 33
-#define SET_STR_DC_THRESHOLD 298
-#define SET_STR_PRECOMPUTE_THRESHOLD 1187
-
-#define FAC_DSC_THRESHOLD 602
-#define FAC_ODD_THRESHOLD 29
+/* 2083 MHz Athlon */
+
+/* Generated by tuneup.c, 2008-12-23, gcc 3.4 */
+
+#define MUL_KARATSUBA_THRESHOLD 28
+#define MUL_TOOM3_THRESHOLD 89
+#define MUL_TOOM44_THRESHOLD 130
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 52
+#define SQR_TOOM3_THRESHOLD 89
+#define SQR_TOOM4_THRESHOLD 196
+
+#define MULLOW_BASECASE_THRESHOLD 10
+#define MULLOW_DC_THRESHOLD 96
+#define MULLOW_MUL_N_THRESHOLD 234
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 86
+#define POWM_THRESHOLD 134
+#define MATRIX22_STRASSEN_THRESHOLD 18
+#define HGCD_THRESHOLD 163
+#define GCD_DC_THRESHOLD 665
+#define GCDEXT_DC_THRESHOLD 605
+#define JACOBI_BASE_METHOD 1
+
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1 /* native */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 19
+#define GET_STR_PRECOMPUTE_THRESHOLD 35
+#define SET_STR_DC_THRESHOLD 826
+#define SET_STR_PRECOMPUTE_THRESHOLD 1691
+
+#define MUL_FFT_TABLE { 432, 864, 1664, 4608, 10240, 40960, 163840, 655360, 0 }
+#define MUL_FFT_MODF_THRESHOLD 496
+#define MUL_FFT_THRESHOLD 4864
+
+#define SQR_FFT_TABLE { 432, 864, 1664, 4608, 10240, 40960, 98304, 655360, 0 }
+#define SQR_FFT_MODF_THRESHOLD 432
+#define SQR_FFT_THRESHOLD 3840
+
+/* These tables need to be updated. */
+
+#define MUL_FFT_TABLE2 {{1, 4}, {401, 5}, {801, 6}, {817, 5}, {865, 6}, {1025, 5}, {1057, 6}, {1601, 7}, {1633, 6}, {1729, 7}, {1921, 6}, {2113, 7}, {2177, 6}, {2241, 7}, {2433, 6}, {2497, 7}, {2945, 6}, {3009, 7}, {3457, 8}, {3521, 7}, {4481, 8}, {4865, 7}, {5249, 8}, {5889, 7}, {6017, 8}, {7553, 9}, {7681, 8}, {9985, 9}, {11777, 8}, {13057, 9}, {13825, 8}, {14081, 9}, {15873, 8}, {16641, 9}, {16897, 8}, {17153, 9}, {19969, 8}, {20225, 9}, {20737, 8}, {20993, 9}, {24065, 8}, {24577, 9}, {25089, 8}, {25345, 9}, {27393, 10}, {27649, 9}, {28161, 10}, {31745, 9}, {38913, 10}, {39425, 9}, {40449, 10}, {48129, 9}, {48641, 11}, {63489, 10}, {98305, 11}, {99329, 10}, {100353, 11}, {101377, 10}, {103425, 11}, {104449, 10}, {110593, 11}, {112641, 10}, {113665, 11}, {129025, 10}, {162817, 11}, {194561, 10}, {195585, 12}, {258049, 11}, {391169, 12}, {520193, 11}, {718849, 12}, {782337, 11}, {849921, 13}, {1040385, 12}, {2879489, 13}, {3137537, 12}, {3928065, 13}, {4186113, 12}, {4976641, 13}, {5234689, 12}, {6025217, 13}, {6283265, 12}, {MP_SIZE_T_MAX,0}}
+
+#define SQR_FFT_TABLE2 {{1, 4}, {401, 5}, {417, 4}, {433, 5}, {881, 6}, {961, 5}, {993, 6}, {1857, 7}, {1921, 6}, {2049, 7}, {2177, 6}, {2241, 7}, {2433, 6}, {2497, 7}, {3457, 8}, {3841, 7}, {4481, 8}, {4609, 7}, {4737, 8}, {4865, 7}, {5249, 8}, {5889, 7}, {6273, 8}, {7041, 9}, {7681, 8}, {9985, 9}, {10241, 8}, {10497, 9}, {11777, 8}, {13057, 9}, {15873, 8}, {16385, 9}, {16897, 8}, {17153, 9}, {19969, 8}, {20225, 9}, {20737, 8}, {20993, 9}, {24065, 8}, {24321, 9}, {24577, 10}, {24833, 9}, {25601, 10}, {27137, 9}, {27649, 10}, {31745, 9}, {38401, 10}, {38913, 9}, {40449, 10}, {48129, 9}, {48641, 11}, {63489, 10}, {99329, 11}, {101377, 10}, {103425, 11}, {104449, 10}, {107521, 11}, {110593, 10}, {113665, 11}, {129025, 10}, {154625, 11}, {155649, 10}, {162817, 11}, {194561, 12}, {258049, 11}, {391169, 12}, {520193, 11}, {718849, 12}, {727041, 11}, {729089, 12}, {782337, 11}, {849921, 13}, {1040385, 12}, {2879489, 13}, {3137537, 12}, {3928065, 13}, {4186113, 12}, {4714497, 13}, {5234689, 12}, {6025217, 13}, {6283265, 12}, {7073793, 13}, {7331841, 12}, {MP_SIZE_T_MAX,0}}
diff --git a/gmp/mpn/x86/k7/invert_limb.asm b/gmp/mpn/x86/k7/invert_limb.asm
deleted file mode 100644
index 6cce455a9d..0000000000
--- a/gmp/mpn/x86/k7/invert_limb.asm
+++ /dev/null
@@ -1,193 +0,0 @@
-dnl x86 mpn_invert_limb
-
-dnl Contributed to the GNU project by Niels Möller
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 (approx) div
-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) ?
-C P4 model 3 (Prescott) ?
-C P4 model 4 (Nocona) ?
-C AMD K6 ?
-C AMD K7 41 53
-C AMD K8 ?
-
-C TODO
-C * These c/l numbers are for a non-PIC build. Consider falling back to using
-C the 'div' instruction for PIC builds.
-C * Perhaps use this file--or at least the algorithm--for more machines than k7.
-
-C Register usage:
-C Input D in %edi
-C Current approximation is in %eax and/or %ecx
-C %ebx and %edx are temporaries
-C %esi and %ebp are unused
-
-defframe(PARAM_DIVISOR,4)
-
-ASM_START()
-
-C Make approx_tab global to work around Apple relocation bug.
-ifdef(`DARWIN',`
- deflit(`approx_tab', MPN(invert_limb_tab))
- GLOBL approx_tab')
-
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_invert_limb)
-deflit(`FRAME', 0)
- mov PARAM_DIVISOR, %eax
- C Avoid push/pop on k7.
- sub $8, %esp FRAME_subl_esp(8)
- mov %ebx, (%esp)
- mov %edi, 4(%esp)
-
- mov %eax, %edi
- shr $22, %eax
-ifdef(`PIC',`
- LEA( approx_tab, %ebx)
- movzwl -1024(%ebx, %eax, 2), %eax
-',`
- movzwl -1024+approx_tab(%eax, %eax), %eax C %eax = v0
-')
-
- C v1 = (v0 << 4) - ((v0*v0*d_21) >> 32) - 1
- mov %eax, %ecx
- imul %eax, %eax
- mov %edi, %ebx
- shr $11, %ebx
- inc %ebx
- mul %ebx
- mov %edi, %ebx C Prepare
- shr %ebx
- sbb %eax, %eax
- sub %eax, %ebx C %ebx = d_31, %eax = mask
- shl $4, %ecx
- dec %ecx
- sub %edx, %ecx C %ecx = v1
-
- C v_2 = (v1 << 15) + ((v1 *(2^48 - v1 * d31 + (v1 >> 1) & mask)) >> 33)
- imul %ecx, %ebx
- and %ecx, %eax
- shr %eax
- sub %ebx, %eax
- mul %ecx
- mov %edi, %eax C Prepare for next mul
- shl $15, %ecx
- shr %edx
- add %edx, %ecx C %ecx = v2
-
- mul %ecx
- add %edi, %eax
- mov %ecx, %eax
- adc %edi, %edx
- sub %edx, %eax C %eax = v3
-
- mov (%esp), %ebx
- mov 4(%esp), %edi
- add $8, %esp
-
- ret
-
-EPILOGUE()
-
-DEF_OBJECT(approx_tab,2)
- .value 0x7fe1,0x7fa1,0x7f61,0x7f22,0x7ee3,0x7ea4,0x7e65,0x7e27
- .value 0x7de9,0x7dab,0x7d6d,0x7d30,0x7cf3,0x7cb6,0x7c79,0x7c3d
- .value 0x7c00,0x7bc4,0x7b89,0x7b4d,0x7b12,0x7ad7,0x7a9c,0x7a61
- .value 0x7a27,0x79ec,0x79b2,0x7979,0x793f,0x7906,0x78cc,0x7894
- .value 0x785b,0x7822,0x77ea,0x77b2,0x777a,0x7742,0x770b,0x76d3
- .value 0x769c,0x7665,0x762f,0x75f8,0x75c2,0x758c,0x7556,0x7520
- .value 0x74ea,0x74b5,0x7480,0x744b,0x7416,0x73e2,0x73ad,0x7379
- .value 0x7345,0x7311,0x72dd,0x72aa,0x7277,0x7243,0x7210,0x71de
- .value 0x71ab,0x7179,0x7146,0x7114,0x70e2,0x70b1,0x707f,0x704e
- .value 0x701c,0x6feb,0x6fba,0x6f8a,0x6f59,0x6f29,0x6ef9,0x6ec8
- .value 0x6e99,0x6e69,0x6e39,0x6e0a,0x6ddb,0x6dab,0x6d7d,0x6d4e
- .value 0x6d1f,0x6cf1,0x6cc2,0x6c94,0x6c66,0x6c38,0x6c0a,0x6bdd
- .value 0x6bb0,0x6b82,0x6b55,0x6b28,0x6afb,0x6acf,0x6aa2,0x6a76
- .value 0x6a49,0x6a1d,0x69f1,0x69c6,0x699a,0x696e,0x6943,0x6918
- .value 0x68ed,0x68c2,0x6897,0x686c,0x6842,0x6817,0x67ed,0x67c3
- .value 0x6799,0x676f,0x6745,0x671b,0x66f2,0x66c8,0x669f,0x6676
- .value 0x664d,0x6624,0x65fc,0x65d3,0x65aa,0x6582,0x655a,0x6532
- .value 0x650a,0x64e2,0x64ba,0x6493,0x646b,0x6444,0x641c,0x63f5
- .value 0x63ce,0x63a7,0x6381,0x635a,0x6333,0x630d,0x62e7,0x62c1
- .value 0x629a,0x6275,0x624f,0x6229,0x6203,0x61de,0x61b8,0x6193
- .value 0x616e,0x6149,0x6124,0x60ff,0x60da,0x60b6,0x6091,0x606d
- .value 0x6049,0x6024,0x6000,0x5fdc,0x5fb8,0x5f95,0x5f71,0x5f4d
- .value 0x5f2a,0x5f07,0x5ee3,0x5ec0,0x5e9d,0x5e7a,0x5e57,0x5e35
- .value 0x5e12,0x5def,0x5dcd,0x5dab,0x5d88,0x5d66,0x5d44,0x5d22
- .value 0x5d00,0x5cde,0x5cbd,0x5c9b,0x5c7a,0x5c58,0x5c37,0x5c16
- .value 0x5bf5,0x5bd4,0x5bb3,0x5b92,0x5b71,0x5b51,0x5b30,0x5b10
- .value 0x5aef,0x5acf,0x5aaf,0x5a8f,0x5a6f,0x5a4f,0x5a2f,0x5a0f
- .value 0x59ef,0x59d0,0x59b0,0x5991,0x5972,0x5952,0x5933,0x5914
- .value 0x58f5,0x58d6,0x58b7,0x5899,0x587a,0x585b,0x583d,0x581f
- .value 0x5800,0x57e2,0x57c4,0x57a6,0x5788,0x576a,0x574c,0x572e
- .value 0x5711,0x56f3,0x56d5,0x56b8,0x569b,0x567d,0x5660,0x5643
- .value 0x5626,0x5609,0x55ec,0x55cf,0x55b2,0x5596,0x5579,0x555d
- .value 0x5540,0x5524,0x5507,0x54eb,0x54cf,0x54b3,0x5497,0x547b
- .value 0x545f,0x5443,0x5428,0x540c,0x53f0,0x53d5,0x53b9,0x539e
- .value 0x5383,0x5368,0x534c,0x5331,0x5316,0x52fb,0x52e0,0x52c6
- .value 0x52ab,0x5290,0x5276,0x525b,0x5240,0x5226,0x520c,0x51f1
- .value 0x51d7,0x51bd,0x51a3,0x5189,0x516f,0x5155,0x513b,0x5121
- .value 0x5108,0x50ee,0x50d5,0x50bb,0x50a2,0x5088,0x506f,0x5056
- .value 0x503c,0x5023,0x500a,0x4ff1,0x4fd8,0x4fbf,0x4fa6,0x4f8e
- .value 0x4f75,0x4f5c,0x4f44,0x4f2b,0x4f13,0x4efa,0x4ee2,0x4eca
- .value 0x4eb1,0x4e99,0x4e81,0x4e69,0x4e51,0x4e39,0x4e21,0x4e09
- .value 0x4df1,0x4dda,0x4dc2,0x4daa,0x4d93,0x4d7b,0x4d64,0x4d4d
- .value 0x4d35,0x4d1e,0x4d07,0x4cf0,0x4cd8,0x4cc1,0x4caa,0x4c93
- .value 0x4c7d,0x4c66,0x4c4f,0x4c38,0x4c21,0x4c0b,0x4bf4,0x4bde
- .value 0x4bc7,0x4bb1,0x4b9a,0x4b84,0x4b6e,0x4b58,0x4b41,0x4b2b
- .value 0x4b15,0x4aff,0x4ae9,0x4ad3,0x4abd,0x4aa8,0x4a92,0x4a7c
- .value 0x4a66,0x4a51,0x4a3b,0x4a26,0x4a10,0x49fb,0x49e5,0x49d0
- .value 0x49bb,0x49a6,0x4990,0x497b,0x4966,0x4951,0x493c,0x4927
- .value 0x4912,0x48fe,0x48e9,0x48d4,0x48bf,0x48ab,0x4896,0x4881
- .value 0x486d,0x4858,0x4844,0x482f,0x481b,0x4807,0x47f3,0x47de
- .value 0x47ca,0x47b6,0x47a2,0x478e,0x477a,0x4766,0x4752,0x473e
- .value 0x472a,0x4717,0x4703,0x46ef,0x46db,0x46c8,0x46b4,0x46a1
- .value 0x468d,0x467a,0x4666,0x4653,0x4640,0x462c,0x4619,0x4606
- .value 0x45f3,0x45e0,0x45cd,0x45ba,0x45a7,0x4594,0x4581,0x456e
- .value 0x455b,0x4548,0x4536,0x4523,0x4510,0x44fe,0x44eb,0x44d8
- .value 0x44c6,0x44b3,0x44a1,0x448f,0x447c,0x446a,0x4458,0x4445
- .value 0x4433,0x4421,0x440f,0x43fd,0x43eb,0x43d9,0x43c7,0x43b5
- .value 0x43a3,0x4391,0x437f,0x436d,0x435c,0x434a,0x4338,0x4327
- .value 0x4315,0x4303,0x42f2,0x42e0,0x42cf,0x42bd,0x42ac,0x429b
- .value 0x4289,0x4278,0x4267,0x4256,0x4244,0x4233,0x4222,0x4211
- .value 0x4200,0x41ef,0x41de,0x41cd,0x41bc,0x41ab,0x419a,0x418a
- .value 0x4179,0x4168,0x4157,0x4147,0x4136,0x4125,0x4115,0x4104
- .value 0x40f4,0x40e3,0x40d3,0x40c2,0x40b2,0x40a2,0x4091,0x4081
- .value 0x4071,0x4061,0x4050,0x4040,0x4030,0x4020,0x4010,0x4000
-END_OBJECT(approx_tab)
diff --git a/gmp/mpn/x86/k7/mmx/com.asm b/gmp/mpn/x86/k7/mmx/com_n.asm
index a258c224f1..068c01f076 100644
--- a/gmp/mpn/x86/k7/mmx/com.asm
+++ b/gmp/mpn/x86/k7/mmx/com_n.asm
@@ -1,32 +1,21 @@
-dnl AMD Athlon mpn_com -- mpn bitwise one's complement.
+dnl AMD Athlon mpn_com_n -- mpn bitwise one's complement.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -34,7 +23,7 @@ include(`../config.m4')
C K7: 1.0 cycles/limb
-C void mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
+C void mpn_com_n (mp_ptr dst, mp_srcptr src, mp_size_t size);
C
C The loop form below is necessary for the claimed speed. It needs to be
C aligned to a 16 byte boundary and only 16 bytes long. Maybe that's so it
@@ -62,7 +51,7 @@ defframe(PARAM_DST, 4)
TEXT
ALIGN(16)
-PROLOGUE(mpn_com)
+PROLOGUE(mpn_com_n)
deflit(`FRAME',0)
movl PARAM_DST, %edx
diff --git a/gmp/mpn/x86/k7/mmx/copyd.asm b/gmp/mpn/x86/k7/mmx/copyd.asm
index 59ece40920..4601fcd75a 100644
--- a/gmp/mpn/x86/k7/mmx/copyd.asm
+++ b/gmp/mpn/x86/k7/mmx/copyd.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_copyd -- copy limb vector, decrementing.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k7/mmx/copyi.asm b/gmp/mpn/x86/k7/mmx/copyi.asm
index 9a28f927ec..a17d575ff4 100644
--- a/gmp/mpn/x86/k7/mmx/copyi.asm
+++ b/gmp/mpn/x86/k7/mmx/copyi.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_copyi -- copy limb vector, incrementing.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k7/mmx/divrem_1.asm b/gmp/mpn/x86/k7/mmx/divrem_1.asm
index cf343280bb..fa5824c7b9 100644
--- a/gmp/mpn/x86/k7/mmx/divrem_1.asm
+++ b/gmp/mpn/x86/k7/mmx/divrem_1.asm
@@ -1,33 +1,22 @@
dnl AMD K7 mpn_divrem_1, mpn_divrem_1c, mpn_preinv_divrem_1 -- mpn by limb
dnl division.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -456,7 +445,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 occurrences of q1==0xFFFFFFFF, but
+C Branch mispredictions will hit random occurrances 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
@@ -735,12 +724,12 @@ C q1 is the high word of m*n2+b*n2 and the following shows q1<=b-2 always.
C rnd() means rounding down to a multiple of d.
C
C m*n2 + b*n2 <= m*(d-1) + b*(d-1)
-C = m*d + b*d - m - b
-C = floor((b(b-d)-1)/d)*d + b*d - m - b
-C = rnd(b(b-d)-1) + b*d - m - b
-C = rnd(b(b-d)-1 + b*d) - m - b
-C = rnd(b*b-1) - m - b
-C <= (b-2)*b
+C = m*d + b*d - m - b
+C = floor((b(b-d)-1)/d)*d + b*d - m - b
+C = rnd(b(b-d)-1) + b*d - m - b
+C = rnd(b(b-d)-1 + b*d) - m - b
+C = rnd(b*b-1) - m - b
+C <= (b-2)*b
C
C Unchanged from the general case is that the final quotient limb q can be
C either q1 or q1+1, and the q1+1 case occurs often. This can be seen from
diff --git a/gmp/mpn/x86/k7/mmx/lshift.asm b/gmp/mpn/x86/k7/mmx/lshift.asm
index b3383cf2c3..b3bff8ffd1 100644
--- a/gmp/mpn/x86/k7/mmx/lshift.asm
+++ b/gmp/mpn/x86/k7/mmx/lshift.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_lshift -- mpn left shift.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k7/mmx/mod_1.asm b/gmp/mpn/x86/k7/mmx/mod_1.asm
new file mode 100644
index 0000000000..2b42e55caf
--- /dev/null
+++ b/gmp/mpn/x86/k7/mmx/mod_1.asm
@@ -0,0 +1,509 @@
+dnl AMD K7 mpn_mod_1 -- mpn by limb remainder.
+
+dnl Copyright 1999, 2000, 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
+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 K7: 17.0 cycles/limb.
+
+
+C mp_limb_t mpn_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor);
+C mp_limb_t mpn_mod_1c (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t carry);
+C mp_limb_t mpn_preinv_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t inverse);
+C
+C The code here is the same as mpn_divrem_1, but with the quotient
+C discarded. See mpn/x86/k7/mmx/divrem_1.c for some comments.
+
+
+dnl MUL_THRESHOLD is the size at which the multiply by inverse method is
+dnl used, rather than plain "divl"s. Minimum value 2.
+dnl
+dnl The inverse takes about 50 cycles to calculate, but after that the
+dnl multiply is 17 c/l versus division at 41 c/l.
+dnl
+dnl Using mul or div is about the same speed at 3 limbs, so the threshold
+dnl is set to 4 to get the smaller div code used at 3.
+
+deflit(MUL_THRESHOLD, 4)
+
+
+defframe(PARAM_INVERSE,16) dnl mpn_preinv_mod_1
+defframe(PARAM_CARRY, 16) dnl mpn_mod_1c
+defframe(PARAM_DIVISOR,12)
+defframe(PARAM_SIZE, 8)
+defframe(PARAM_SRC, 4)
+
+defframe(SAVE_EBX, -4)
+defframe(SAVE_ESI, -8)
+defframe(SAVE_EDI, -12)
+defframe(SAVE_EBP, -16)
+
+defframe(VAR_NORM, -20)
+defframe(VAR_INVERSE, -24)
+defframe(VAR_SRC_STOP,-28)
+
+deflit(STACK_SPACE, 28)
+
+ TEXT
+
+ ALIGN(32)
+PROLOGUE(mpn_preinv_mod_1)
+deflit(`FRAME',0)
+ movl PARAM_SRC, %ecx
+ movl PARAM_SIZE, %eax
+ subl $STACK_SPACE, %esp FRAME_subl_esp(STACK_SPACE)
+
+ movl %ebp, SAVE_EBP
+ movl PARAM_DIVISOR, %ebp
+
+ movl %edi, SAVE_EDI
+ movl PARAM_INVERSE, %edx
+
+ movl %esi, SAVE_ESI
+ movl -4(%ecx,%eax,4), %edi C src high limb
+ leal -16(%ecx,%eax,4), %ecx C &src[size-4]
+
+ movl %ebx, SAVE_EBX
+ movl PARAM_INVERSE, %edx
+
+ movl $0, VAR_NORM C l==0
+
+ movl %edi, %esi
+ subl %ebp, %edi C high-divisor
+
+ cmovc( %esi, %edi) C restore if underflow
+ decl %eax
+ jz L(done_edi) C size==1, high-divisor only
+
+ movl 8(%ecx), %esi C src second high limb
+ movl %edx, VAR_INVERSE
+
+ movl $32, %ebx C 32-l
+ decl %eax
+ jz L(inverse_one_left) C size==2, one divide
+
+ movd %ebx, %mm7 C 32-l
+ decl %eax
+ jz L(inverse_two_left) C size==3, two divides
+
+ jmp L(inverse_top) C size>=4
+
+
+L(done_edi):
+ movl SAVE_ESI, %esi
+ movl SAVE_EBP, %ebp
+ movl %edi, %eax
+
+ movl SAVE_EDI, %edi
+ addl $STACK_SPACE, %esp
+
+ ret
+
+EPILOGUE()
+
+
+ ALIGN(32)
+PROLOGUE(mpn_mod_1c)
+deflit(`FRAME',0)
+ movl PARAM_CARRY, %edx
+ movl PARAM_SIZE, %ecx
+ subl $STACK_SPACE, %esp
+deflit(`FRAME',STACK_SPACE)
+
+ movl %ebp, SAVE_EBP
+ movl PARAM_DIVISOR, %ebp
+
+ movl %esi, SAVE_ESI
+ movl PARAM_SRC, %esi
+ jmp L(start_1c)
+
+EPILOGUE()
+
+
+ ALIGN(32)
+PROLOGUE(mpn_mod_1)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ movl $0, %edx C initial carry (if can't skip a div)
+ subl $STACK_SPACE, %esp
+deflit(`FRAME',STACK_SPACE)
+
+ movl %esi, SAVE_ESI
+ movl PARAM_SRC, %esi
+
+ movl %ebp, SAVE_EBP
+ movl PARAM_DIVISOR, %ebp
+
+ orl %ecx, %ecx
+ jz L(divide_done)
+
+ movl -4(%esi,%ecx,4), %eax C src high limb
+
+ cmpl %ebp, %eax C carry flag if high<divisor
+
+ cmovc( %eax, %edx) C src high limb as initial carry
+ sbbl $0, %ecx C size-1 to skip one div
+ jz L(divide_done)
+
+
+ ALIGN(16)
+L(start_1c):
+ C eax
+ C ebx
+ C ecx size
+ C edx carry
+ C esi src
+ C edi
+ C ebp divisor
+
+ cmpl $MUL_THRESHOLD, %ecx
+ jae L(mul_by_inverse)
+
+
+
+C With a MUL_THRESHOLD of 4, this "loop" only ever does 1 to 3 iterations,
+C but it's already fast and compact, and there's nothing to gain by
+C expanding it out.
+C
+C Using PARAM_DIVISOR in the divl is a couple of cycles faster than %ebp.
+
+ orl %ecx, %ecx
+ jz L(divide_done)
+
+
+L(divide_top):
+ C eax scratch (quotient)
+ C ebx
+ C ecx counter, limbs, decrementing
+ C edx scratch (remainder)
+ C esi src
+ C edi
+ C ebp
+
+ movl -4(%esi,%ecx,4), %eax
+
+ divl PARAM_DIVISOR
+
+ decl %ecx
+ jnz L(divide_top)
+
+
+L(divide_done):
+ movl SAVE_ESI, %esi
+ movl SAVE_EBP, %ebp
+ addl $STACK_SPACE, %esp
+
+ movl %edx, %eax
+
+ ret
+
+
+
+C -----------------------------------------------------------------------------
+
+L(mul_by_inverse):
+ C eax
+ C ebx
+ C ecx size
+ C edx carry
+ C esi src
+ C edi
+ C ebp divisor
+
+ bsrl %ebp, %eax C 31-l
+
+ movl %ebx, SAVE_EBX
+ movl %ecx, %ebx C size
+
+ movl %edi, SAVE_EDI
+ movl $31, %ecx
+
+ movl %edx, %edi C carry
+ movl $-1, %edx
+
+ C
+
+ xorl %eax, %ecx C l
+ incl %eax C 32-l
+
+ shll %cl, %ebp C d normalized
+ movl %ecx, VAR_NORM
+
+ movd %eax, %mm7 C 32-l
+
+ movl $-1, %eax
+ subl %ebp, %edx C (b-d)-1 so edx:eax = b*(b-d)-1
+
+ divl %ebp C floor (b*(b-d)-1) / d
+
+ C
+
+ movl %eax, VAR_INVERSE
+ leal -12(%esi,%ebx,4), %eax C &src[size-3]
+
+ movl 8(%eax), %esi C src high limb
+ movl 4(%eax), %edx C src second highest limb
+
+ shldl( %cl, %esi, %edi) C n2 = carry,high << l
+
+ shldl( %cl, %edx, %esi) C n10 = high,second << l
+
+ movl %eax, %ecx C &src[size-3]
+
+
+ifelse(MUL_THRESHOLD,2,`
+ cmpl $2, %ebx
+ je L(inverse_two_left)
+')
+
+
+C The dependent chain here is the same as in mpn_divrem_1, but a few
+C instructions are saved by not needing to store the quotient limbs.
+C Unfortunately this doesn't get the code down to the theoretical 16 c/l.
+C
+C There's four dummy instructions in the loop, all of which are necessary
+C for the claimed 17 c/l. It's a 1 to 3 cycle slowdown if any are removed,
+C or changed from load to store or vice versa. They're not completely
+C random, since they correspond to what mpn_divrem_1 has, but there's no
+C obvious reason why they're necessary. Presumably they induce something
+C good in the out of order execution, perhaps through some load/store
+C ordering and/or decoding effects.
+C
+C The q1==0xFFFFFFFF case is handled here the same as in mpn_divrem_1. On
+C on special data that comes out as q1==0xFFFFFFFF always, the loop runs at
+C about 13.5 c/l.
+
+ ALIGN(32)
+L(inverse_top):
+ C eax scratch
+ C ebx scratch (nadj, q1)
+ C ecx src pointer, decrementing
+ C edx scratch
+ C esi n10
+ C edi n2
+ C ebp divisor
+ C
+ C mm0 scratch (src qword)
+ C mm7 rshift for normalization
+
+ cmpl $0x80000000, %esi C n1 as 0=c, 1=nc
+ movl %edi, %eax C n2
+ movl PARAM_SIZE, %ebx C dummy
+
+ leal (%ebp,%esi), %ebx
+ cmovc( %esi, %ebx) C nadj = n10 + (-n1 & d), ignoring overflow
+ sbbl $-1, %eax C n2+n1
+
+ mull VAR_INVERSE C m*(n2+n1)
+
+ movq (%ecx), %mm0 C next src limb and the one below it
+ subl $4, %ecx
+
+ movl %ecx, PARAM_SIZE C dummy
+
+ C
+
+ addl %ebx, %eax C m*(n2+n1) + nadj, low giving carry flag
+ leal 1(%edi), %ebx C n2+1
+ movl %ebp, %eax C d
+
+ C
+
+ adcl %edx, %ebx C 1 + high(n2<<32 + m*(n2+n1) + nadj) = q1+1
+ jz L(q1_ff)
+ nop C dummy
+
+ mull %ebx C (q1+1)*d
+
+ psrlq %mm7, %mm0
+ leal (%ecx), %ecx C dummy
+
+ C
+
+ C
+
+ subl %eax, %esi C low n - (q1+1)*d
+ movl PARAM_SRC, %eax
+
+ C
+
+ sbbl %edx, %edi C high n - (q1+1)*d, 0 or -1
+ movl %esi, %edi C remainder -> n2
+ leal (%ebp,%esi), %edx
+
+ movd %mm0, %esi
+
+ cmovc( %edx, %edi) C n - q1*d if underflow from using q1+1
+ cmpl %eax, %ecx
+ jae L(inverse_top)
+
+
+L(inverse_loop_done):
+
+
+C -----------------------------------------------------------------------------
+
+L(inverse_two_left):
+ C eax scratch
+ C ebx scratch (nadj, q1)
+ C ecx &src[-1]
+ C edx scratch
+ C esi n10
+ C edi n2
+ C ebp divisor
+ C
+ C mm0 scratch (src dword)
+ C mm7 rshift
+
+ cmpl $0x80000000, %esi C n1 as 0=c, 1=nc
+ movl %edi, %eax C n2
+
+ leal (%ebp,%esi), %ebx
+ cmovc( %esi, %ebx) C nadj = n10 + (-n1 & d), ignoring overflow
+ sbbl $-1, %eax C n2+n1
+
+ mull VAR_INVERSE C m*(n2+n1)
+
+ movd 4(%ecx), %mm0 C src low limb
+
+ C
+
+ C
+
+ addl %ebx, %eax C m*(n2+n1) + nadj, low giving carry flag
+ leal 1(%edi), %ebx C n2+1
+ movl %ebp, %eax C d
+
+ adcl %edx, %ebx C 1 + high(n2<<32 + m*(n2+n1) + nadj) = q1+1
+
+ sbbl $0, %ebx
+
+ mull %ebx C (q1+1)*d
+
+ psllq $32, %mm0
+
+ psrlq %mm7, %mm0
+
+ C
+
+ subl %eax, %esi
+
+ C
+
+ sbbl %edx, %edi C n - (q1+1)*d
+ movl %esi, %edi C remainder -> n2
+ leal (%ebp,%esi), %edx
+
+ movd %mm0, %esi
+
+ cmovc( %edx, %edi) C n - q1*d if underflow from using q1+1
+
+
+L(inverse_one_left):
+ C eax scratch
+ C ebx scratch (nadj, q1)
+ C ecx
+ C edx scratch
+ C esi n10
+ C edi n2
+ C ebp divisor
+ C
+ C mm0 src limb, shifted
+ C mm7 rshift
+
+ cmpl $0x80000000, %esi C n1 as 0=c, 1=nc
+ movl %edi, %eax C n2
+
+ leal (%ebp,%esi), %ebx
+ cmovc( %esi, %ebx) C nadj = n10 + (-n1 & d), ignoring overflow
+ sbbl $-1, %eax C n2+n1
+
+ mull VAR_INVERSE C m*(n2+n1)
+
+ movl VAR_NORM, %ecx C for final denorm
+
+ C
+
+ C
+
+ addl %ebx, %eax C m*(n2+n1) + nadj, low giving carry flag
+ leal 1(%edi), %ebx C n2+1
+ movl %ebp, %eax C d
+
+ C
+
+ adcl %edx, %ebx C 1 + high(n2<<32 + m*(n2+n1) + nadj) = q1+1
+
+ sbbl $0, %ebx
+
+ mull %ebx C (q1+1)*d
+
+ movl SAVE_EBX, %ebx
+
+ C
+
+ C
+
+ subl %eax, %esi
+
+ movl %esi, %eax C remainder
+ movl SAVE_ESI, %esi
+
+ sbbl %edx, %edi C n - (q1+1)*d
+ leal (%ebp,%eax), %edx
+ movl SAVE_EBP, %ebp
+
+ cmovc( %edx, %eax) C n - q1*d if underflow from using q1+1
+ movl SAVE_EDI, %edi
+
+ shrl %cl, %eax C denorm remainder
+ addl $STACK_SPACE, %esp
+ emms
+
+ ret
+
+
+C -----------------------------------------------------------------------------
+C
+C Special case for q1=0xFFFFFFFF, giving q=0xFFFFFFFF meaning the low dword
+C of q*d is simply -d and the remainder n-q*d = n10+d
+
+L(q1_ff):
+ C eax (divisor)
+ C ebx (q1+1 == 0)
+ C ecx src pointer
+ C edx
+ C esi n10
+ C edi (n2)
+ C ebp divisor
+
+ movl PARAM_SRC, %edx
+ leal (%ebp,%esi), %edi C n-q*d remainder -> next n2
+ psrlq %mm7, %mm0
+
+ movd %mm0, %esi C next n10
+
+ cmpl %edx, %ecx
+ jae L(inverse_top)
+ jmp L(inverse_loop_done)
+
+EPILOGUE()
diff --git a/gmp/mpn/x86/k7/mmx/popham.asm b/gmp/mpn/x86/k7/mmx/popham.asm
index 95965b74d4..5dc0a78c42 100644
--- a/gmp/mpn/x86/k7/mmx/popham.asm
+++ b/gmp/mpn/x86/k7/mmx/popham.asm
@@ -1,40 +1,29 @@
dnl AMD K7 mpn_popcount, mpn_hamdist -- population count and hamming
dnl distance.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 popcount hamdist
C P3 generic 6.5 7
-C P3 model 9 (Banias) 5.7 6.1
+C P3 model 9 (Banias) ? ?
C P3 model 13 (Dothan) 5.75 6
C K7 5 6
diff --git a/gmp/mpn/x86/k7/mmx/rshift.asm b/gmp/mpn/x86/k7/mmx/rshift.asm
index 345d23a25e..3566ce85d7 100644
--- a/gmp/mpn/x86/k7/mmx/rshift.asm
+++ b/gmp/mpn/x86/k7/mmx/rshift.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_rshift -- mpn right shift.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k7/mod_1_1.asm b/gmp/mpn/x86/k7/mod_1_1.asm
deleted file mode 100644
index 1bbe6f92d7..0000000000
--- a/gmp/mpn/x86/k7/mod_1_1.asm
+++ /dev/null
@@ -1,221 +0,0 @@
-dnl x86-32 mpn_mod_1_1p, requiring cmov.
-
-dnl Contributed to the GNU project by Niels Möller and 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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) ?
-C P4 model 3 (Prescott) ?
-C P4 model 4 (Nocona) ?
-C AMD K6 ?
-C AMD K7 7
-C AMD K8 ?
-
-define(`B2mb', `%ebx')
-define(`r0', `%esi')
-define(`r2', `%ebp')
-define(`t0', `%edi')
-define(`ap', `%ecx') C Also shift count
-
-C Stack frame
-C pre 36(%esp)
-C b 32(%esp)
-C n 28(%esp)
-C ap 24(%esp)
-C return 20(%esp)
-C %ebp 16(%esp)
-C %edi 12(%esp)
-C %esi 8(%esp)
-C %ebx 4(%esp)
-C B2mod (%esp)
-
-define(`B2modb', `(%esp)')
-define(`n', `28(%esp)')
-define(`b', `32(%esp)')
-define(`pre', `36(%esp)')
-
-C mp_limb_t
-C mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t pre[4])
-C
-C The pre array contains bi, cnt, B1modb, B2modb
-C Note: This implementation needs B1modb only when cnt > 0
-
-ASM_START()
- TEXT
- ALIGN(8)
-PROLOGUE(mpn_mod_1_1p)
- push %ebp
- push %edi
- push %esi
- push %ebx
- mov 32(%esp), %ebp C pre[]
-
- mov 12(%ebp), %eax C B2modb
- push %eax C Put it on stack
-
- mov n, %edx
- mov 24(%esp), ap
-
- lea (ap, %edx, 4), ap
- mov -4(ap), %eax
- cmp $3, %edx
- jnc L(first)
- mov -8(ap), r0
- jmp L(reduce_two)
-
-L(first):
- C First iteration, no r2
- mull B2modb
- mov -12(ap), r0
- add %eax, r0
- mov -8(ap), %eax
- adc %edx, %eax
- sbb r2, r2
- subl $3, n
- lea -16(ap), ap
- jz L(reduce_three)
-
- mov B2modb, B2mb
- sub b, B2mb
- lea (B2mb, r0), t0
- jmp L(mid)
-
- ALIGN(16)
-L(top): C Loopmixed to 7 c/l on k7
- add %eax, r0
- lea (B2mb, r0), t0
- mov r2, %eax
- adc %edx, %eax
- sbb r2, r2
-L(mid): mull B2modb
- and B2modb, r2
- add r0, r2
- decl n
- mov (ap), r0
- cmovc( t0, r2)
- lea -4(ap), ap
- jnz L(top)
-
- add %eax, r0
- mov r2, %eax
- adc %edx, %eax
- sbb r2, r2
-
-L(reduce_three):
- C Eliminate r2
- and b, r2
- sub r2, %eax
-
-L(reduce_two):
- mov pre, %ebp
- movb 4(%ebp), %cl
- test %cl, %cl
- jz L(normalized)
-
- C Unnormalized, use B1modb to reduce to size < B b
- mull 8(%ebp)
- xor t0, t0
- add %eax, r0
- adc %edx, t0
- mov t0, %eax
-
- C Left-shift to normalize
- shld %cl, r0, %eax C Always use shld?
-
- shl %cl, r0
- jmp L(udiv)
-
-L(normalized):
- mov %eax, t0
- sub b, t0
- cmovnc( t0, %eax)
-
-L(udiv):
- lea 1(%eax), t0
- mull (%ebp)
- mov b, %ebx C Needed in register for lea
- add r0, %eax
- adc t0, %edx
- imul %ebx, %edx
- sub %edx, r0
- cmp r0, %eax
- lea (%ebx, r0), %eax
- cmovnc( r0, %eax)
- cmp %ebx, %eax
- jnc L(fix)
-L(ok): shr %cl, %eax
-
- add $4, %esp
- pop %ebx
- pop %esi
- pop %edi
- pop %ebp
-
- ret
-L(fix): sub %ebx, %eax
- jmp L(ok)
-EPILOGUE()
-
-PROLOGUE(mpn_mod_1_1p_cps)
- push %ebp
- mov 12(%esp), %ebp
- push %esi
- bsr %ebp, %ecx
- push %ebx
- xor $31, %ecx
- mov 16(%esp), %esi
- sal %cl, %ebp
- mov %ebp, %edx
- not %edx
- mov $-1, %eax
- div %ebp C On K7, invert_limb would be a few cycles faster.
- mov %eax, (%esi) C store bi
- mov %ecx, 4(%esi) C store cnt
- neg %ebp
- mov $1, %edx
- shld %cl, %eax, %edx
- imul %ebp, %edx
- shr %cl, %edx
- imul %ebp, %eax
- mov %edx, 8(%esi) C store B1modb
- mov %eax, 12(%esi) C store B2modb
- pop %ebx
- pop %esi
- pop %ebp
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86/k7/mod_1_4.asm b/gmp/mpn/x86/k7/mod_1_4.asm
deleted file mode 100644
index bb7597edd2..0000000000
--- a/gmp/mpn/x86/k7/mod_1_4.asm
+++ /dev/null
@@ -1,260 +0,0 @@
-dnl x86-32 mpn_mod_1s_4p, requiring cmov.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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) 6
-C P4 model 0 (Willamette) ?
-C P4 model 1 (?) ?
-C P4 model 2 (Northwood) 15.5
-C P4 model 3 (Prescott) ?
-C P4 model 4 (Nocona) ?
-C AMD K6 ?
-C AMD K7 4.75
-C AMD K8 ?
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_4p)
- push %ebp
- push %edi
- push %esi
- push %ebx
- sub $28, %esp
- mov 60(%esp), %edi C cps[]
- mov 8(%edi), %eax
- mov 12(%edi), %edx
- mov 16(%edi), %ecx
- mov 20(%edi), %esi
- mov 24(%edi), %edi
- mov %eax, 4(%esp)
- mov %edx, 8(%esp)
- mov %ecx, 12(%esp)
- mov %esi, 16(%esp)
- mov %edi, 20(%esp)
- mov 52(%esp), %eax C n
- xor %edi, %edi
- mov 48(%esp), %esi C up
- lea -12(%esi,%eax,4), %esi
- and $3, %eax
- je L(b0)
- cmp $2, %eax
- jc L(b1)
- je L(b2)
-
-L(b3): mov 4(%esi), %eax
- mull 4(%esp)
- mov (%esi), %ebp
- add %eax, %ebp
- adc %edx, %edi
- mov 8(%esi), %eax
- mull 8(%esp)
- lea -12(%esi), %esi
- jmp L(m0)
-
-L(b0): mov (%esi), %eax
- mull 4(%esp)
- mov -4(%esi), %ebp
- add %eax, %ebp
- adc %edx, %edi
- mov 4(%esi), %eax
- mull 8(%esp)
- add %eax, %ebp
- adc %edx, %edi
- mov 8(%esi), %eax
- mull 12(%esp)
- lea -16(%esi), %esi
- jmp L(m0)
-
-L(b1): mov 8(%esi), %ebp
- lea -4(%esi), %esi
- jmp L(m1)
-
-L(b2): mov 8(%esi), %edi
- mov 4(%esi), %ebp
- lea -8(%esi), %esi
- jmp L(m1)
-
- ALIGN(16)
-L(top): mov (%esi), %eax
- mull 4(%esp)
- mov -4(%esi), %ebx
- xor %ecx, %ecx
- add %eax, %ebx
- adc %edx, %ecx
- mov 4(%esi), %eax
- mull 8(%esp)
- add %eax, %ebx
- adc %edx, %ecx
- mov 8(%esi), %eax
- mull 12(%esp)
- add %eax, %ebx
- adc %edx, %ecx
- lea -16(%esi), %esi
- mov 16(%esp), %eax
- mul %ebp
- add %eax, %ebx
- adc %edx, %ecx
- mov 20(%esp), %eax
- mul %edi
- mov %ebx, %ebp
- mov %ecx, %edi
-L(m0): add %eax, %ebp
- adc %edx, %edi
-L(m1): subl $4, 52(%esp)
- ja L(top)
-
-L(end): mov 4(%esp), %eax
- mul %edi
- mov 60(%esp), %edi
- add %eax, %ebp
- adc $0, %edx
- mov 4(%edi), %ecx
- mov %edx, %esi
- mov %ebp, %eax
- sal %cl, %esi
- mov %ecx, %ebx
- neg %ecx
- shr %cl, %eax
- or %esi, %eax
- lea 1(%eax), %esi
- mull (%edi)
- mov %ebx, %ecx
- mov %eax, %ebx
- mov %ebp, %eax
- mov 56(%esp), %ebp
- sal %cl, %eax
- add %eax, %ebx
- adc %esi, %edx
- imul %ebp, %edx
- sub %edx, %eax
- lea (%eax,%ebp), %edx
- cmp %eax, %ebx
- cmovc( %edx, %eax)
- mov %eax, %edx
- sub %ebp, %eax
- cmovc( %edx, %eax)
- add $28, %esp
- pop %ebx
- pop %esi
- pop %edi
- pop %ebp
- shr %cl, %eax
- ret
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_4p_cps)
-C CAUTION: This is the same code as in pentium4/sse2/mod_1_4.asm
- push %ebp
- push %edi
- push %esi
- push %ebx
- mov 20(%esp), %ebp C FIXME: avoid bp for 0-idx
- mov 24(%esp), %ebx
- bsr %ebx, %ecx
- xor $31, %ecx
- sal %cl, %ebx C b << cnt
- mov %ebx, %edx
- not %edx
- mov $-1, %eax
- div %ebx
- xor %edi, %edi
- sub %ebx, %edi
- mov $1, %esi
- mov %eax, (%ebp) C store bi
- mov %ecx, 4(%ebp) C store cnt
- shld %cl, %eax, %esi
- imul %edi, %esi
- mov %eax, %edi
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 8(%ebp) C store B1modb
-
- not %edx
- imul %ebx, %edx
- lea (%edx,%ebx), %esi
- cmp %edx, %eax
- cmovnc( %edx, %esi)
- mov %edi, %eax
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 12(%ebp) C store B2modb
-
- not %edx
- imul %ebx, %edx
- lea (%edx,%ebx), %esi
- cmp %edx, %eax
- cmovnc( %edx, %esi)
- mov %edi, %eax
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 16(%ebp) C store B3modb
-
- not %edx
- imul %ebx, %edx
- lea (%edx,%ebx), %esi
- cmp %edx, %eax
- cmovnc( %edx, %esi)
- mov %edi, %eax
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 20(%ebp) C store B4modb
-
- not %edx
- imul %ebx, %edx
- add %edx, %ebx
- cmp %edx, %eax
- cmovnc( %edx, %ebx)
-
- shr %cl, %ebx
- mov %ebx, 24(%ebp) C store B5modb
-
- pop %ebx
- pop %esi
- pop %edi
- pop %ebp
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86/k7/mod_34lsub1.asm b/gmp/mpn/x86/k7/mod_34lsub1.asm
index ee3ad04099..f00e84dc42 100644
--- a/gmp/mpn/x86/k7/mod_34lsub1.asm
+++ b/gmp/mpn/x86/k7/mod_34lsub1.asm
@@ -1,32 +1,22 @@
dnl AMD K7 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2004, 2005, 2008 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k7/mode1o.asm b/gmp/mpn/x86/k7/mode1o.asm
index 6472ec5949..ef858049a6 100644
--- a/gmp/mpn/x86/k7/mode1o.asm
+++ b/gmp/mpn/x86/k7/mode1o.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_modexact_1_odd -- exact division style remainder.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -122,7 +111,7 @@ ifdef(`PIC',`
subl %eax, %edi C inv = 2*inv - inv*inv*d
- ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB
movl %esi, %eax
imull %edi, %eax
cmpl $1, %eax')
diff --git a/gmp/mpn/x86/k7/mul_1.asm b/gmp/mpn/x86/k7/mul_1.asm
index 755cd2ed50..016262d594 100644
--- a/gmp/mpn/x86/k7/mul_1.asm
+++ b/gmp/mpn/x86/k7/mul_1.asm
@@ -1,38 +1,28 @@
dnl AMD K7 mpn_mul_1.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2005, 2008 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 cycles/limb
+C P5:
C P6 model 0-8,10-12)
C P6 model 9 (Banias)
C P6 model 13 (Dothan)
@@ -41,9 +31,9 @@ C P4 model 1 (?)
C P4 model 2 (Northwood)
C P4 model 3 (Prescott)
C P4 model 4 (Nocona)
-C AMD K6
-C AMD K7 3.25
-C AMD K8
+C K6:
+C K7: 3.25
+C K8:
C TODO
C * Improve feed-in and wind-down code. We beat the old code for all n != 1,
diff --git a/gmp/mpn/x86/k7/mul_basecase.asm b/gmp/mpn/x86/k7/mul_basecase.asm
index 4dfb500885..7f4c0002f7 100644
--- a/gmp/mpn/x86/k7/mul_basecase.asm
+++ b/gmp/mpn/x86/k7/mul_basecase.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_mul_basecase -- multiply two mpn numbers.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/k7/sqr_basecase.asm b/gmp/mpn/x86/k7/sqr_basecase.asm
index 7b6a97e0df..408a13dc9b 100644
--- a/gmp/mpn/x86/k7/sqr_basecase.asm
+++ b/gmp/mpn/x86/k7/sqr_basecase.asm
@@ -1,32 +1,21 @@
dnl AMD K7 mpn_sqr_basecase -- square an mpn number.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -39,18 +28,18 @@ C roughly the Karatsuba recursing range).
dnl These are the same as mpn/x86/k6/sqr_basecase.asm, see that code for
dnl some comments.
-deflit(SQR_TOOM2_THRESHOLD_MAX, 66)
+deflit(SQR_KARATSUBA_THRESHOLD_MAX, 66)
-ifdef(`SQR_TOOM2_THRESHOLD_OVERRIDE',
-`define(`SQR_TOOM2_THRESHOLD',SQR_TOOM2_THRESHOLD_OVERRIDE)')
+ifdef(`SQR_KARATSUBA_THRESHOLD_OVERRIDE',
+`define(`SQR_KARATSUBA_THRESHOLD',SQR_KARATSUBA_THRESHOLD_OVERRIDE)')
-m4_config_gmp_mparam(`SQR_TOOM2_THRESHOLD')
-deflit(UNROLL_COUNT, eval(SQR_TOOM2_THRESHOLD-3))
+m4_config_gmp_mparam(`SQR_KARATSUBA_THRESHOLD')
+deflit(UNROLL_COUNT, eval(SQR_KARATSUBA_THRESHOLD-3))
C void mpn_sqr_basecase (mp_ptr dst, mp_srcptr src, mp_size_t size);
C
-C With a SQR_TOOM2_THRESHOLD around 50 this code is about 1500 bytes,
+C With a SQR_KARATSUBA_THRESHOLD around 50 this code is about 1500 bytes,
C which is quite a bit, but is considered good value since squares big
C enough to use most of the code will be spending quite a few cycles in it.
diff --git a/gmp/mpn/x86/k7/sublsh1_n.asm b/gmp/mpn/x86/k7/sublsh1_n.asm
deleted file mode 100644
index 523b01218d..0000000000
--- a/gmp/mpn/x86/k7/sublsh1_n.asm
+++ /dev/null
@@ -1,173 +0,0 @@
-dnl AMD K7 mpn_sublsh1_n_ip1 -- rp[] = rp[] - (up[] << 1)
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 This is an attempt at a sublsh1_n for x86-32, not relying on sse2 insns. The
-C innerloop is 2*3-way unrolled, which is best we can do with the available
-C registers. It seems tricky to use the same structure for rsblsh1_n, since we
-C cannot feed carry between operations there.
-
-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)
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 6.75
-C AMD K6
-C AMD K7
-C AMD K8
-
-C This is a basic sublsh1_n for k7, atom, and perhaps some other x86-32
-C processors. It uses 2*4-way unrolling, for good reasons.
-C
-C Breaking carry recurrency might be a good idea. We would then need separate
-C registers for the shift carry and add/subtract carry, which in turn would
-C force is to 2*2-way unrolling.
-
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(VAR_COUNT,`PARAM_SIZE')
-define(SAVE_EBX,`PARAM_SRC')
-define(SAVE_EBP,`PARAM_DST')
-
-ASM_START()
- TEXT
- ALIGN(8)
-PROLOGUE(mpn_sublsh1_n_ip1)
-deflit(`FRAME',0)
-
-define(`rp', `%edi')
-define(`up', `%esi')
-
- mov PARAM_SIZE, %eax C size
- push up FRAME_pushl()
- push rp FRAME_pushl()
- xor %edx, %edx
- mov PARAM_SRC, up
- mov PARAM_DST, rp
- mov %ebx, SAVE_EBX
- mov %eax, %ebx
- shr $3, %eax
-
- not %eax C count = -(size\8)-i
- and $7, %ebx C size % 8
- jz L(exact)
-
-L(oop):
-ifdef(`CPU_P6',`
- shr %edx ') C restore 2nd saved carry bit
- mov (up), %ecx
- adc %ecx, %ecx
- rcr %edx C restore 1st saved carry bit
- lea 4(up), up
- sbb %ecx, (rp)
- lea 4(rp), rp
- adc %edx, %edx C save a carry bit in edx
-ifdef(`CPU_P6',`
- adc %edx, %edx ') C save another carry bit in edx
- dec %ebx
- jnz L(oop)
-L(exact):
- inc %eax
- jz L(end)
- mov %eax, VAR_COUNT
- mov %ebp, SAVE_EBP
-
- ALIGN(16)
-L(top):
-ifdef(`CPU_P6',`
- shr %edx ') C restore 2nd saved carry bit
- mov (up), %eax
- adc %eax, %eax
- mov 4(up), %ebx
- adc %ebx, %ebx
- mov 8(up), %ecx
- adc %ecx, %ecx
- mov 12(up), %ebp
- adc %ebp, %ebp
-
- rcr %edx C restore 1st saved carry bit
-
- sbb %eax, (rp)
- sbb %ebx, 4(rp)
- sbb %ecx, 8(rp)
- sbb %ebp, 12(rp)
-
- mov 16(up), %eax
- adc %eax, %eax
- mov 20(up), %ebx
- adc %ebx, %ebx
- mov 24(up), %ecx
- adc %ecx, %ecx
- mov 28(up), %ebp
- adc %ebp, %ebp
-
- lea 32(up), up
- adc %edx, %edx C save a carry bit in edx
-
- sbb %eax, 16(rp)
- sbb %ebx, 20(rp)
- sbb %ecx, 24(rp)
- sbb %ebp, 28(rp)
-
-ifdef(`CPU_P6',`
- adc %edx, %edx ') C save another carry bit in edx
- incl VAR_COUNT
- lea 32(rp), rp
- jne L(top)
-
- mov SAVE_EBP, %ebp
-L(end):
- mov SAVE_EBX, %ebx
-
-ifdef(`CPU_P6',`
- xor %eax, %eax
- shr $1, %edx
- adc %edx, %eax
-',`
- adc $0, %edx
- mov %edx, %eax
-')
- pop rp FRAME_popl()
- pop up FRAME_popl()
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/k8/gmp-mparam.h b/gmp/mpn/x86/k8/gmp-mparam.h
deleted file mode 100644
index 8d95fef80b..0000000000
--- a/gmp/mpn/x86/k8/gmp-mparam.h
+++ /dev/null
@@ -1,198 +0,0 @@
-/* x86/k8 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
-
-/* 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 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 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 24
-#define MUL_TOOM33_THRESHOLD 81
-#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 92
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 122
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 46
-#define SQR_TOOM3_THRESHOLD 78
-#define SQR_TOOM4_THRESHOLD 202
-#define SQR_TOOM6_THRESHOLD 286
-#define SQR_TOOM8_THRESHOLD 422
-
-#define MULMID_TOOM42_THRESHOLD 56
-
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 18
-
-#define MUL_FFT_MODF_THRESHOLD 848 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 848, 5}, { 27, 6}, { 25, 7}, { 13, 6}, \
- { 27, 7}, { 15, 6}, { 32, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 103,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 167,10}, { 95, 9}, { 199,10}, { 111,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
- { 287,10}, { 159,11}, { 95,10}, { 207,12}, \
- { 63,11}, { 127,10}, { 271, 9}, { 543,10}, \
- { 287,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 335, 9}, { 671,11}, { 191,10}, { 383, 9}, \
- { 799,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543,11}, { 287,10}, { 607, 9}, { 1215,11}, \
- { 319,10}, { 671, 9}, { 1343,12}, { 191,11}, \
- { 383,10}, { 799, 9}, { 1599,11}, { 415,10}, \
- { 863, 9}, { 1727,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1119,11}, { 607,10}, { 1215,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,10}, \
- { 1471, 9}, { 2943,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,10}, { 1727,12}, { 447,11}, \
- { 991,13}, { 255,12}, { 511,11}, { 1023,10}, \
- { 2111,11}, { 1119,12}, { 575,11}, { 1215,10}, \
- { 2431,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,10}, { 2943,13}, { 383,12}, { 767,11}, \
- { 1599,12}, { 831,11}, { 1727,12}, { 959,11}, \
- { 1919,14}, { 255,13}, { 511,12}, { 1023,11}, \
- { 2047,12}, { 1087,11}, { 2239,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1983,14}, \
- { 511,13}, { 1023,12}, { 2239,13}, { 1151,12}, \
- { 4096,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 144
-#define MUL_FFT_THRESHOLD 7552
-
-#define SQR_FFT_MODF_THRESHOLD 618 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 618, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 28, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 8}, { 15, 7}, { 35, 8}, \
- { 19, 7}, { 41, 8}, { 23, 7}, { 47, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 51, 9}, { 31, 8}, { 67, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 79,10}, { 47, 9}, { 95,11}, \
- { 31,10}, { 63, 9}, { 135,10}, { 79, 9}, \
- { 167,10}, { 95, 9}, { 191,10}, { 111,11}, \
- { 63,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543, 8}, { 1087,10}, { 287,11}, \
- { 159,10}, { 319, 9}, { 639,10}, { 335, 9}, \
- { 671, 8}, { 1343,10}, { 351,11}, { 191,10}, \
- { 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
-#define DC_BDIV_QR_THRESHOLD 87
-#define DC_BDIV_Q_THRESHOLD 222
-
-#define INV_MULMOD_BNM1_THRESHOLD 62
-#define INV_NEWTON_THRESHOLD 268
-#define INV_APPR_THRESHOLD 270
-
-#define BINV_NEWTON_THRESHOLD 260
-#define REDC_1_TO_REDC_N_THRESHOLD 79
-
-#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 1,22,114,416,1464
-
-#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 149
-#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 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 270
-#define SET_STR_PRECOMPUTE_THRESHOLD 1367
-
-#define FAC_DSC_THRESHOLD 348
-#define FAC_ODD_THRESHOLD 24
diff --git a/gmp/mpn/x86/lshift.asm b/gmp/mpn/x86/lshift.asm
index 6ee6153cc2..5598599f8b 100644
--- a/gmp/mpn/x86/lshift.asm
+++ b/gmp/mpn/x86/lshift.asm
@@ -1,43 +1,33 @@
dnl x86 mpn_lshift -- mpn left shift.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 P54 7.5
-C P55 7.0
-C P6 2.5
-C K6 4.5
-C K7 5.0
-C P4 14.5
+C P54: 7.5
+C P55: 7.0
+C P6: 2.5
+C K6: 4.5
+C K7: 5.0
+C P4: 14.5
C mp_limb_t mpn_lshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
diff --git a/gmp/mpn/x86/mmx/sec_tabselect.asm b/gmp/mpn/x86/mmx/sec_tabselect.asm
deleted file mode 100644
index aae158abf7..0000000000
--- a/gmp/mpn/x86/mmx/sec_tabselect.asm
+++ /dev/null
@@ -1,163 +0,0 @@
-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()
diff --git a/gmp/mpn/x86/mod_1.asm b/gmp/mpn/x86/mod_1.asm
new file mode 100644
index 0000000000..0fa3ce0def
--- /dev/null
+++ b/gmp/mpn/x86/mod_1.asm
@@ -0,0 +1,163 @@
+dnl x86 mpn_mod_1 -- mpn by limb remainder.
+
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2007 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
+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 486 42 approx, maybe
+C P5 44
+C P6 39
+C K6 20
+C K7 41
+C P4 58
+
+
+C mp_limb_t mpn_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor);
+C mp_limb_t mpn_mod_1c (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t carry);
+C
+C Essentially this code is the same as the division based part of
+C mpn/generic/mod_1.c, but has the advantage that we get the desired divl
+C instruction even when gcc is not being used (where longlong.h only has the
+C rather slow generic C udiv_qrnnd().
+C
+C A test is done to see if the high limb is less than the divisor, and if so
+C one less div is done. A div is between 20 and 40 cycles on the various
+C x86s, so assuming high<divisor about half the time, then this test saves
+C half that amount. The branch misprediction penalty on each chip is less
+C than half a div.
+C
+C
+C Notes for K6:
+C
+C Back-to-back div instructions take 20 cycles, the same as the loop here,
+C so it seems there's nothing to gain by rearranging. Pairing the mov and
+C loop instructions was found to gain nothing. Normally we use a loop
+C instruction rather than decl/jnz, but it gains nothing here.
+C
+C A multiply-by-inverse is used in mpn/x86/k6/pre_mod_1.asm, but it saves
+C only 2 c/l so currently we haven't bothered with the same for mpn_mod_1.
+C If an inverse takes about 40 cycles for normalized or perhaps 60 for
+C unnormalized (due to bsfl being slow on k6) then the threshold would be at
+C least 20 or 30 limbs.
+C
+
+defframe(PARAM_CARRY, 16)
+defframe(PARAM_DIVISOR,12)
+defframe(PARAM_SIZE, 8)
+defframe(PARAM_SRC, 4)
+
+ TEXT
+
+ ALIGN(16)
+PROLOGUE(mpn_mod_1)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ pushl %ebx FRAME_pushl()
+
+ movl PARAM_SRC, %ebx
+ pushl %esi FRAME_pushl()
+
+ orl %ecx, %ecx
+ jz L(done_zero)
+
+ movl PARAM_DIVISOR, %esi
+ movl -4(%ebx,%ecx,4), %eax C src high limb
+
+ cmpl %esi, %eax
+
+ sbbl %edx, %edx C -1 if high<divisor
+
+ addl %edx, %ecx C skip one division if high<divisor
+ jz L(done_eax)
+
+ andl %eax, %edx C carry if high<divisor
+
+
+L(top):
+ C eax scratch (quotient)
+ C ebx src
+ C ecx counter
+ C edx carry (remainder)
+ C esi divisor
+ C edi
+ C ebp
+
+ movl -4(%ebx,%ecx,4), %eax
+
+ divl %esi
+
+ decl %ecx
+ jnz L(top)
+
+
+ movl %edx, %eax
+L(done_eax):
+ popl %esi
+
+ popl %ebx
+
+ ret
+
+EPILOGUE()
+
+
+ C This code located after mpn_mod_1, so the jump to L(top) here is
+ C back and hence will be predicted as taken. (size==0 is considered
+ C unlikely.)
+
+ ALIGN(16)
+PROLOGUE(mpn_mod_1c)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ pushl %ebx FRAME_pushl()
+
+ movl PARAM_SRC, %ebx
+ pushl %esi FRAME_pushl()
+
+ movl PARAM_DIVISOR, %esi
+ orl %ecx, %ecx
+
+ movl PARAM_CARRY, %edx
+ jnz L(top)
+
+ popl %esi
+ movl %edx, %eax
+
+ popl %ebx
+
+ ret
+
+
+ C This code is for mpn_mod_1, but is positioned here to save some
+ C space in the alignment padding.
+ C
+L(done_zero):
+ popl %esi
+ xorl %eax, %eax
+
+ popl %ebx
+
+ ret
+
+EPILOGUE()
diff --git a/gmp/mpn/x86/mod_34lsub1.asm b/gmp/mpn/x86/mod_34lsub1.asm
index e09e702c6f..68b4a73dbc 100644
--- a/gmp/mpn/x86/mod_34lsub1.asm
+++ b/gmp/mpn/x86/mod_34lsub1.asm
@@ -1,42 +1,31 @@
dnl Generic x86 mpn_mod_34lsub1 -- mpn remainder modulo 2^24-1.
-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 either:
+dnl Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 3.0
-C P6 3.66
-C K6 3.0
-C K7 1.3
-C P4 9
+C P5: 3.0
+C P6: 3.66
+C K6: 3.0
+C K7: 1.3
+C P4: 9
C mp_limb_t mpn_mod_34lsub1 (mp_srcptr src, mp_size_t size)
diff --git a/gmp/mpn/x86/mul_1.asm b/gmp/mpn/x86/mul_1.asm
index 421de62225..1d715ece7e 100644
--- a/gmp/mpn/x86/mul_1.asm
+++ b/gmp/mpn/x86/mul_1.asm
@@ -1,50 +1,40 @@
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-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 either:
+dnl Copyright 1992, 1994, 1997, 1998, 1999, 2000, 2001, 2002, 2005 Free
+dnl Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 12.5
-C P6 model 0-8,10-12 5.5
+C cycles/limb
+C P5: 12.5
+C P6 model 0-8,10-12) 5.5
C P6 model 9 (Banias)
-C P6 model 13 (Dothan) 5.25
-C P4 model 0 (Willamette) 19.0
-C P4 model 1 (?) 19.0
-C P4 model 2 (Northwood) 19.0
+C P6 model 13 (Dothan) 5.25
+C P4 model 0 (Willamette) 19.0
+C P4 model 1 (?) 19.0
+C P4 model 2 (Northwood) 19.0
C P4 model 3 (Prescott)
C P4 model 4 (Nocona)
-C AMD K6 10.5
-C AMD K7 4.5
-C AMD K8
+C K6: 10.5
+C K7: 4.5
+C K8:
C mp_limb_t mpn_mul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
diff --git a/gmp/mpn/x86/mul_basecase.asm b/gmp/mpn/x86/mul_basecase.asm
index 8339732a80..7918ea07f3 100644
--- a/gmp/mpn/x86/mul_basecase.asm
+++ b/gmp/mpn/x86/mul_basecase.asm
@@ -1,43 +1,33 @@
dnl x86 mpn_mul_basecase -- Multiply two limb vectors and store the result
dnl in a third limb vector.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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/crossproduct
-C P5 15
-C P6 7.5
-C K6 12.5
-C K7 5.5
-C P4 24
+C P5: 15
+C P6: 7.5
+C K6: 12.5
+C K7: 5.5
+C P4: 24
C void mpn_mul_basecase (mp_ptr wp,
diff --git a/gmp/mpn/x86/nano/gmp-mparam.h b/gmp/mpn/x86/nano/gmp-mparam.h
deleted file mode 100644
index cd8ac4e1d6..0000000000
--- a/gmp/mpn/x86/nano/gmp-mparam.h
+++ /dev/null
@@ -1,162 +0,0 @@
-/* x86/nano gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* Generated by tuneup.c, 2011-11-25, gcc 4.2 */
-
-#define MOD_1_1P_METHOD 1
-#define MOD_1_NORM_THRESHOLD 3
-#define MOD_1_UNNORM_THRESHOLD 3
-#define MOD_1N_TO_MOD_1_1_THRESHOLD 10
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 9
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0 /* never mpn_mod_1_1p */
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 53
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 12
-#define USE_PREINV_DIVREM_1 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 32
-
-#define MUL_TOOM22_THRESHOLD 16
-#define MUL_TOOM33_THRESHOLD 132
-#define MUL_TOOM44_THRESHOLD 195
-#define MUL_TOOM6H_THRESHOLD 270
-#define MUL_TOOM8H_THRESHOLD 478
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 129
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 138
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 130
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 135
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 28
-#define SQR_TOOM3_THRESHOLD 194
-#define SQR_TOOM4_THRESHOLD 502
-#define SQR_TOOM6_THRESHOLD 746
-#define SQR_TOOM8_THRESHOLD 1005
-
-#define MULMID_TOOM42_THRESHOLD 40
-
-#define MULMOD_BNM1_THRESHOLD 14
-#define SQRMOD_BNM1_THRESHOLD 19
-
-#define POWM_SEC_TABLE 4,23,258,828,2246
-
-#define MUL_FFT_MODF_THRESHOLD 308 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 308, 5}, { 13, 6}, { 7, 5}, { 17, 6}, \
- { 9, 5}, { 19, 6}, { 11, 5}, { 23, 6}, \
- { 13, 7}, { 7, 6}, { 17, 7}, { 9, 6}, \
- { 19, 7}, { 11, 6}, { 24, 7}, { 15, 6}, \
- { 31, 7}, { 19, 8}, { 11, 7}, { 25, 8}, \
- { 15, 7}, { 33, 8}, { 19, 7}, { 39, 8}, \
- { 23, 7}, { 47, 9}, { 15, 8}, { 31, 7}, \
- { 63, 8}, { 39, 9}, { 23, 8}, { 47,10}, \
- { 15, 9}, { 31, 8}, { 63, 9}, { 47,10}, \
- { 31, 9}, { 71,10}, { 47, 9}, { 95,11}, \
- { 31,10}, { 63, 9}, { 127, 8}, { 255,10}, \
- { 79, 9}, { 159,10}, { 95, 9}, { 191,11}, \
- { 63,10}, { 127, 9}, { 255, 8}, { 543, 9}, \
- { 287, 8}, { 575, 7}, { 1215,10}, { 159,11}, \
- { 95,10}, { 191,12}, { 63,11}, { 127,10}, \
- { 255, 9}, { 543, 8}, { 1087,10}, { 287, 9}, \
- { 607, 8}, { 1215,11}, { 159,10}, { 319, 9}, \
- { 639,10}, { 351, 9}, { 703, 8}, { 1407, 9}, \
- { 735, 8}, { 1471,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 415, 9}, { 831,11}, { 223,10}, \
- { 447, 9}, { 895,10}, { 479, 9}, { 959, 8}, \
- { 1919,12}, { 4096,13}, { 8192,14}, { 16384,15}, \
- { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 89
-#define MUL_FFT_THRESHOLD 1856
-
-#define SQR_FFT_MODF_THRESHOLD 396 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 396, 5}, { 13, 6}, { 7, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
- { 25, 7}, { 15, 6}, { 31, 7}, { 19, 6}, \
- { 39, 7}, { 21, 8}, { 11, 7}, { 23, 6}, \
- { 47, 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}, { 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,10}, \
- { 79, 9}, { 159,10}, { 95,11}, { 63,10}, \
- { 127, 9}, { 255, 8}, { 543,10}, { 143, 9}, \
- { 287, 8}, { 607, 7}, { 1215, 6}, { 2431,10}, \
- { 159, 8}, { 639,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 543, 8}, \
- { 1087,10}, { 287, 9}, { 607, 8}, { 1215,11}, \
- { 159,10}, { 319, 9}, { 671,10}, { 351, 9}, \
- { 703, 8}, { 1407, 9}, { 735, 8}, { 1471, 7}, \
- { 2943,11}, { 191,10}, { 383, 9}, { 799,10}, \
- { 415, 9}, { 895,10}, { 479,12}, { 4096,13}, \
- { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 87
-#define SQR_FFT_THRESHOLD 2368
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 51
-#define MULLO_MUL_N_THRESHOLD 3369
-
-#define DC_DIV_QR_THRESHOLD 56
-#define DC_DIVAPPR_Q_THRESHOLD 183
-#define DC_BDIV_QR_THRESHOLD 55
-#define DC_BDIV_Q_THRESHOLD 118
-
-#define INV_MULMOD_BNM1_THRESHOLD 30
-#define INV_NEWTON_THRESHOLD 266
-#define INV_APPR_THRESHOLD 218
-
-#define BINV_NEWTON_THRESHOLD 268
-#define REDC_1_TO_REDC_N_THRESHOLD 56
-
-#define MU_DIV_QR_THRESHOLD 1308
-#define MU_DIVAPPR_Q_THRESHOLD 1528
-#define MUPI_DIV_QR_THRESHOLD 124
-#define MU_BDIV_QR_THRESHOLD 855
-#define MU_BDIV_Q_THRESHOLD 1334
-
-#define MATRIX22_STRASSEN_THRESHOLD 14
-#define HGCD_THRESHOLD 104
-#define HGCD_APPR_THRESHOLD 139
-#define HGCD_REDUCE_THRESHOLD 2121
-#define GCD_DC_THRESHOLD 456
-#define GCDEXT_DC_THRESHOLD 321
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 11
-#define GET_STR_PRECOMPUTE_THRESHOLD 25
-#define SET_STR_DC_THRESHOLD 542
-#define SET_STR_PRECOMPUTE_THRESHOLD 840
diff --git a/gmp/mpn/x86/p6/README b/gmp/mpn/x86/p6/README
index f19d47b94f..1ded4e7177 100644
--- a/gmp/mpn/x86/p6/README
+++ b/gmp/mpn/x86/p6/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -63,7 +52,7 @@ Some of these might be able to be improved.
mpn_mul_basecase 8.2 cycles/crossproduct (approx)
mpn_sqr_basecase 4.0 cycles/crossproduct (approx)
- or 7.75 cycles/triangleproduct (approx)
+ or 7.75 cycles/triangleproduct (approx)
Pentium II and III have MMX and get the following improvements.
diff --git a/gmp/mpn/x86/p6/aors_n.asm b/gmp/mpn/x86/p6/aors_n.asm
index df51c2e6f7..f4652ec2cb 100644
--- a/gmp/mpn/x86/p6/aors_n.asm
+++ b/gmp/mpn/x86/p6/aors_n.asm
@@ -1,43 +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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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 TODO:
-C * Avoid indexed addressing, it makes us stall on the two-ported register
+C * Avoid indexed adressing, it makes us stall on the two-ported register
C file.
-C cycles/limb
-C P6 model 0-8,10-12 3.17
-C P6 model 9 (Banias) 2.15
-C P6 model 13 (Dothan) 2.25
+C cycles/limb
+C P6 model 0-8,10-12) 3.17
+C P6 model 9 (Banias) ?
+C P6 model 13 (Dothan) 2.25
define(`rp', `%edi')
diff --git a/gmp/mpn/x86/p6/aorsmul_1.asm b/gmp/mpn/x86/p6/aorsmul_1.asm
index bc8c49c62e..746bf05f12 100644
--- a/gmp/mpn/x86/p6/aorsmul_1.asm
+++ b/gmp/mpn/x86/p6/aorsmul_1.asm
@@ -1,49 +1,38 @@
dnl Intel P6 mpn_addmul_1/mpn_submul_1 -- add or subtract mpn multiple.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2005 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 6.44
-C P6 model 9 (Banias) 6.15
-C P6 model 13 (Dothan) 6.11
+C cycles/limb
+C P5:
+C P6 model 0-8,10-12) 6.44
+C P6 model 9 (Banias)
+C P6 model 13 (Dothan) 6.11
C P4 model 0 (Willamette)
C P4 model 1 (?)
C P4 model 2 (Northwood)
C P4 model 3 (Prescott)
C P4 model 4 (Nocona)
-C AMD K6
-C AMD K7
-C AMD K8
+C K6:
+C K7:
+C K8:
dnl P6 UNROLL_COUNT cycles/limb
@@ -181,7 +170,7 @@ C registers when doing the mul for the initial two carry limbs.
C
C The add/adc for the initial carry in %ebx is necessary only for the
C mpn_add/submul_1c entry points. Duplicating the startup code to
-C eliminate this for the plain mpn_add/submul_1 doesn't seem like a good
+C eliminiate this for the plain mpn_add/submul_1 doesn't seem like a good
C idea.
dnl overlapping with parameters already fetched
diff --git a/gmp/mpn/x86/p6/bdiv_q_1.asm b/gmp/mpn/x86/p6/bdiv_q_1.asm
deleted file mode 100644
index 2cc179c238..0000000000
--- a/gmp/mpn/x86/p6/bdiv_q_1.asm
+++ /dev/null
@@ -1,286 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 odd even divisor
-C P6: 10.0 12.0 cycles/limb
-
-C MULFUNC_PROLOGUE(mpn_bdiv_q_1 mpn_pi1_bdiv_q_1)
-
-C The odd case is basically the same as mpn_modexact_1_odd, just with an
-C extra store, and it runs at the same 10 cycles which is the dependent
-C chain.
-C
-C The shifts for the even case aren't on the dependent chain so in principle
-C it could run the same too, but nothing running at 10 has been found.
-C Perhaps there's too many uops (an extra 4 over the odd case).
-
-defframe(PARAM_SHIFT, 24)
-defframe(PARAM_INVERSE,20)
-defframe(PARAM_DIVISOR,16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-defframe(SAVE_EBX, -4)
-defframe(SAVE_ESI, -8)
-defframe(SAVE_EDI, -12)
-defframe(SAVE_EBP, -16)
-deflit(STACK_SPACE, 16)
-
-dnl re-use parameter space
-define(VAR_INVERSE,`PARAM_SRC')
-
- TEXT
-
-C mp_limb_t
-C mpn_pi1_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor,
-C mp_limb_t inverse, int shift)
-
- ALIGN(16)
-PROLOGUE(mpn_pi1_bdiv_q_1)
-deflit(`FRAME',0)
-
- subl $STACK_SPACE, %esp FRAME_subl_esp(STACK_SPACE)
-
- movl %esi, SAVE_ESI
- movl PARAM_SRC, %esi
-
- movl %ebx, SAVE_EBX
- movl PARAM_SIZE, %ebx
-
- movl %ebp, SAVE_EBP
- movl PARAM_INVERSE, %ebp
-
- movl PARAM_SHIFT, %ecx C trailing twos
-
-L(common):
- movl %edi, SAVE_EDI
- movl PARAM_DST, %edi
-
- leal (%esi,%ebx,4), %esi C src end
-
- leal (%edi,%ebx,4), %edi C dst end
- negl %ebx C -size
-
- movl (%esi,%ebx,4), %eax C src[0]
-
- orl %ecx, %ecx
- jz L(odd_entry)
-
- movl %edi, PARAM_DST
- movl %ebp, VAR_INVERSE
-
-L(even):
- C eax src[0]
- C ebx counter, limbs, negative
- C ecx shift
- C edx
- C esi
- C edi
- C ebp
-
- xorl %ebp, %ebp C initial carry bit
- xorl %edx, %edx C initial carry limb (for size==1)
-
- incl %ebx
- jz L(even_one)
-
- movl (%esi,%ebx,4), %edi C src[1]
-
- shrdl( %cl, %edi, %eax)
-
- jmp L(even_entry)
-
-
-L(even_top):
- C eax scratch
- C ebx counter, limbs, negative
- C ecx shift
- C edx scratch
- C esi &src[size]
- C edi &dst[size] and scratch
- C ebp carry bit
-
- movl (%esi,%ebx,4), %edi
-
- mull PARAM_DIVISOR
-
- movl -4(%esi,%ebx,4), %eax
- shrdl( %cl, %edi, %eax)
-
- subl %ebp, %eax
-
- sbbl %ebp, %ebp
- subl %edx, %eax
-
- sbbl $0, %ebp
-
-L(even_entry):
- imull VAR_INVERSE, %eax
-
- movl PARAM_DST, %edi
- negl %ebp
-
- movl %eax, -4(%edi,%ebx,4)
- incl %ebx
- jnz L(even_top)
-
- mull PARAM_DIVISOR
-
- movl -4(%esi), %eax
-
-L(even_one):
- shrl %cl, %eax
- movl SAVE_ESI, %esi
-
- subl %ebp, %eax
- movl SAVE_EBP, %ebp
-
- subl %edx, %eax
- movl SAVE_EBX, %ebx
-
- imull VAR_INVERSE, %eax
-
- movl %eax, -4(%edi)
- movl SAVE_EDI, %edi
- addl $STACK_SPACE, %esp
-
- ret
-
-C The dependent chain here is
-C
-C subl %edx, %eax 1
-C imull %ebp, %eax 4
-C mull PARAM_DIVISOR 5
-C ----
-C total 10
-C
-C and this is the measured speed. No special scheduling is necessary, out
-C of order execution hides the load latency.
-
-L(odd_top):
- C eax scratch (src limb)
- C ebx counter, limbs, negative
- C ecx carry bit
- C edx carry limb, high of last product
- C esi &src[size]
- C edi &dst[size]
- C ebp inverse
-
- mull PARAM_DIVISOR
-
- movl (%esi,%ebx,4), %eax
- subl %ecx, %eax
-
- sbbl %ecx, %ecx
- subl %edx, %eax
-
- sbbl $0, %ecx
-
-L(odd_entry):
- imull %ebp, %eax
-
- movl %eax, (%edi,%ebx,4)
- negl %ecx
-
- incl %ebx
- jnz L(odd_top)
-
-
- movl SAVE_ESI, %esi
-
- movl SAVE_EDI, %edi
-
- movl SAVE_EBP, %ebp
-
- movl SAVE_EBX, %ebx
- addl $STACK_SPACE, %esp
-
- ret
-
-EPILOGUE()
-
-C mp_limb_t mpn_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_limb_t divisor);
-C
-
- ALIGN(16)
-PROLOGUE(mpn_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl PARAM_DIVISOR, %eax
- subl $STACK_SPACE, %esp FRAME_subl_esp(STACK_SPACE)
-
- movl %esi, SAVE_ESI
- movl PARAM_SRC, %esi
-
- movl %ebx, SAVE_EBX
- movl PARAM_SIZE, %ebx
-
- bsfl %eax, %ecx C trailing twos
-
- movl %ebp, SAVE_EBP
-
- shrl %cl, %eax C d without twos
-
- movl %eax, %edx
- shrl %eax C d/2 without twos
-
- movl %edx, PARAM_DIVISOR
- andl $127, %eax
-
-ifdef(`PIC',`
- LEA( binvert_limb_table, %ebp)
- movzbl (%eax,%ebp), %ebp C inv 8 bits
-',`
- movzbl binvert_limb_table(%eax), %ebp C inv 8 bits
-')
-
- leal (%ebp,%ebp), %eax C 2*inv
-
- imull %ebp, %ebp C inv*inv
- imull %edx, %ebp C inv*inv*d
-
- subl %ebp, %eax C inv = 2*inv - inv*inv*d
- leal (%eax,%eax), %ebp C 2*inv
-
- imull %eax, %eax C inv*inv
- imull %edx, %eax C inv*inv*d
-
- subl %eax, %ebp C inv = 2*inv - inv*inv*d
-
- jmp L(common)
-
-EPILOGUE()
diff --git a/gmp/mpn/x86/p6/copyd.asm b/gmp/mpn/x86/p6/copyd.asm
index 1be7636835..2946f51e7a 100644
--- a/gmp/mpn/x86/p6/copyd.asm
+++ b/gmp/mpn/x86/p6/copyd.asm
@@ -1,32 +1,21 @@
dnl Intel P6 mpn_copyd -- copy limb vector backwards.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/dive_1.asm b/gmp/mpn/x86/p6/dive_1.asm
index aa7ba880c9..e8efc28eac 100644
--- a/gmp/mpn/x86/p6/dive_1.asm
+++ b/gmp/mpn/x86/p6/dive_1.asm
@@ -1,32 +1,21 @@
dnl Intel P6 mpn_modexact_1_odd -- exact division style remainder.
dnl Copyright 2001, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -117,7 +106,7 @@ ifdef(`PIC',`
subl %eax, %ebp C inv = 2*inv - inv*inv*d
- ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB
movl PARAM_DIVISOR, %eax
imull %ebp, %eax
cmpl $1, %eax')
@@ -138,7 +127,7 @@ C subl %edx, %eax 1
C imull %ebp, %eax 4
C mull PARAM_DIVISOR 5
C ----
-C total 10
+C total 10
C
C and this is the measured speed. No special scheduling is necessary, out
C of order execution hides the load latency.
diff --git a/gmp/mpn/x86/p6/gcd_1.asm b/gmp/mpn/x86/p6/gcd_1.asm
deleted file mode 100644
index f6518f6e19..0000000000
--- a/gmp/mpn/x86/p6/gcd_1.asm
+++ /dev/null
@@ -1,156 +0,0 @@
-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-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-
-C cycles/bit (approx)
-C AMD K7 7.80
-C AMD K8,K9 7.79
-C AMD K10 4.08
-C AMD bd1 ?
-C AMD bobcat 7.82
-C Intel P4-2 14.9
-C Intel P4-3/4 14.0
-C Intel P6/13 5.09
-C Intel core2 4.22
-C Intel NHM 5.00
-C Intel SBR 5.00
-C Intel atom 17.1
-C VIA nano ?
-C Numbers measured with: speed -CD -s16-32 -t16 mpn_gcd_1
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 6)
-
-
-define(`up', `%edi')
-define(`n', `%esi')
-define(`v0', `%edx')
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- push %edi
- push %esi
-
- mov 12(%esp), up
- mov 16(%esp), n
- mov 20(%esp), v0
-
- mov (up), %eax C U low limb
- or v0, %eax
- bsf %eax, %eax C min(ctz(u0),ctz(v0))
-
- bsf v0, %ecx
- shr %cl, v0
-
- push %eax C preserve common twos over call
- push v0 C preserve v0 argument over call
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %ecx
- mov %ecx, %eax
- shr $BMOD_THRES_LOG2, %ecx
- cmp %ecx, v0
- ja L(reduced)
- jmp L(bmod)
-
-L(reduce_nby1):
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
-ifdef(`PIC_WITH_EBX',`
- push %ebx
- call L(movl_eip_to_ebx)
- add $_GLOBAL_OFFSET_TABLE_, %ebx
-')
- push v0 C param 3
- push n C param 2
- push up C param 1
- CALL( mpn_mod_1)
- jmp L(called)
-
-L(bmod):
-ifdef(`PIC_WITH_EBX',`dnl
- push %ebx
- call L(movl_eip_to_ebx)
- add $_GLOBAL_OFFSET_TABLE_, %ebx
-')
- push v0 C param 3
- push n C param 2
- push up C param 1
- CALL( mpn_modexact_1_odd)
-
-L(called):
- add $12, %esp C deallocate params
-ifdef(`PIC_WITH_EBX',`dnl
- pop %ebx
-')
-L(reduced):
- pop %edx
-
- bsf %eax, %ecx
-C test %eax, %eax C FIXME: does this lower latency?
- jnz L(mid)
- jmp L(end)
-
- ALIGN(16) C K10 BD C2 NHM SBR
-L(top): cmovc( %esi, %eax) C if x-y < 0 0,3 0,3 0,6 0,5 0,5
- cmovc( %edi, %edx) C use x,y-x 0,3 0,3 2,8 1,7 1,7
-L(mid): shr %cl, %eax C 1,7 1,6 2,8 2,8 2,8
- mov %edx, %esi C 1 1 4 3 3
- sub %eax, %esi C 2 2 5 4 4
- bsf %esi, %ecx C 3 3 6 5 5
- mov %eax, %edi C 2 2 3 3 4
- sub %edx, %eax C 2 2 4 3 4
- jnz L(top) C
-
-L(end): pop %ecx
- mov %edx, %eax
- shl %cl, %eax
-
- pop %esi
- pop %edi
- ret
-
-ifdef(`PIC_WITH_EBX',`dnl
-L(movl_eip_to_ebx):
- mov (%esp), %ebx
- ret
-')
-EPILOGUE()
diff --git a/gmp/mpn/x86/p6/gmp-mparam.h b/gmp/mpn/x86/p6/gmp-mparam.h
index 96c96fd558..a85c500275 100644
--- a/gmp/mpn/x86/p6/gmp-mparam.h
+++ b/gmp/mpn/x86/p6/gmp-mparam.h
@@ -1,194 +1,70 @@
/* Intel P6 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2008-2010, 2012 Free Software
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 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 either:
+it under the terms of the GNU 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 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.
-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.
-or both in parallel, as here.
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
-
-
-#define GMP_LIMB_BITS 32
-#define GMP_LIMB_BYTES 4
-
-
-/* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be more than the
- value in mpn/x86/p6/gmp-mparam.h. The latter is used as a hard limit in
- mpn/x86/p6/sqr_basecase.asm. */
-
-
-/* 1867 MHz P6 model 13 */
-
-#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 11
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
-#define USE_PREINV_DIVREM_1 1 /* native */
-#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 20
-#define MUL_TOOM33_THRESHOLD 74
-#define MUL_TOOM44_THRESHOLD 181
-#define MUL_TOOM6H_THRESHOLD 252
-#define MUL_TOOM8H_THRESHOLD 363
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 115
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 80
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 101
-#define SQR_TOOM4_THRESHOLD 154
-#define SQR_TOOM6_THRESHOLD 222
-#define SQR_TOOM8_THRESHOLD 527
-
-#define MULMID_TOOM42_THRESHOLD 58
-
-#define MULMOD_BNM1_THRESHOLD 13
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define POWM_SEC_TABLE 4,23,258,768,2388
-
-#define MUL_FFT_MODF_THRESHOLD 565 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 565, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 28, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 5}, \
- { 383, 4}, { 991, 5}, { 511, 6}, { 267, 7}, \
- { 157, 8}, { 91, 9}, { 47, 8}, { 111, 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}, \
- { 143, 9}, { 287,10}, { 159,11}, { 95,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,10}, { 287,11}, \
- { 159,10}, { 335, 9}, { 671,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,11}, \
- { 319,10}, { 671,12}, { 191,11}, { 383,10}, \
- { 799,11}, { 415,10}, { 831,13}, { 127,12}, \
- { 255,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,10}, { 1471,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,12}, { 447,11}, { 959,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,13}, { 383,12}, { 831,11}, { 1727,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1215,13}, \
- { 639,12}, { 1471,11}, { 2943,13}, { 767,12}, \
- { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
- { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
- { 1407,12}, { 2815,14}, { 767,13}, { 1663,12}, \
- { 3455,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 132
-#define MUL_FFT_THRESHOLD 6784
-
-#define SQR_FFT_MODF_THRESHOLD 472 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 472, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
- { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 63, 4}, { 1023, 8}, { 67, 9}, \
- { 39, 5}, { 639, 4}, { 1471, 6}, { 383, 7}, \
- { 209, 8}, { 119, 9}, { 63, 7}, { 255, 8}, \
- { 139, 9}, { 71, 8}, { 143, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159, 8}, { 319, 9}, \
- { 167,10}, { 95,11}, { 63,10}, { 143, 9}, \
- { 287,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 543, 8}, \
- { 1087,10}, { 287, 9}, { 575,11}, { 159,10}, \
- { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
- { 351, 9}, { 703,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 399, 9}, { 799,10}, { 415, 9}, \
- { 831,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,11}, { 319,10}, { 671, 9}, { 1343,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
- { 799,11}, { 415,10}, { 831,13}, { 127,12}, \
- { 255,11}, { 543,10}, { 1087,11}, { 607,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,12}, \
- { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
- { 447,11}, { 959,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
- { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
- { 767,11}, { 1599,12}, { 831,11}, { 1727,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1215,13}, \
- { 639,12}, { 1471,13}, { 767,12}, { 1727,13}, \
- { 895,12}, { 1919,14}, { 511,13}, { 1023,12}, \
- { 2111,13}, { 1151,12}, { 2431,13}, { 1407,14}, \
- { 767,13}, { 1663,12}, { 3455,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 146
-#define SQR_FFT_THRESHOLD 5760
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 33
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#define DC_DIV_QR_THRESHOLD 20
-#define DC_DIVAPPR_Q_THRESHOLD 56
-#define DC_BDIV_QR_THRESHOLD 60
-#define DC_BDIV_Q_THRESHOLD 134
-
-#define INV_MULMOD_BNM1_THRESHOLD 38
-#define INV_NEWTON_THRESHOLD 66
-#define INV_APPR_THRESHOLD 63
-
-#define BINV_NEWTON_THRESHOLD 250
-#define REDC_1_TO_REDC_N_THRESHOLD 63
-
-#define MU_DIV_QR_THRESHOLD 1164
-#define MU_DIVAPPR_Q_THRESHOLD 979
-#define MUPI_DIV_QR_THRESHOLD 38
-#define MU_BDIV_QR_THRESHOLD 1442
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 64
-#define HGCD_APPR_THRESHOLD 105
-#define HGCD_REDUCE_THRESHOLD 3524
-#define GCD_DC_THRESHOLD 386
-#define GCDEXT_DC_THRESHOLD 309
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 26
-#define SET_STR_DC_THRESHOLD 587
-#define SET_STR_PRECOMPUTE_THRESHOLD 1104
+
+/* NOTE: In a fat binary build SQR_KARATSUBA_THRESHOLD here cannot be
+ smaller than the value in mpn/x86/p6/mmx/gmp-mparam.h. The former is
+ used as a hard limit in mpn/x86/p6/sqr_basecase.asm, and that file will
+ be run by the p6/mmx cpus (pentium2, pentium3). */
+
+
+/* 200MHz Pentium Pro */
+
+/* Generated by tuneup.c, 2003-02-12, gcc 2.95 */
+
+#define MUL_KARATSUBA_THRESHOLD 23
+#define MUL_TOOM3_THRESHOLD 140
+
+#define SQR_BASECASE_THRESHOLD 0 /* always */
+#define SQR_KARATSUBA_THRESHOLD 52
+#define SQR_TOOM3_THRESHOLD 189
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 116
+#define POWM_THRESHOLD 131
+
+#define GCD_ACCEL_THRESHOLD 3
+#define JACOBI_BASE_METHOD 1
+
+#define USE_PREINV_DIVREM_1 0
+#define USE_PREINV_MOD_1 1 /* native */
+#define DIVREM_2_THRESHOLD 0 /* always */
+#define DIVEXACT_1_THRESHOLD 0 /* always */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always */
+
+#define GET_STR_DC_THRESHOLD 18
+#define GET_STR_PRECOMPUTE_THRESHOLD 23
+#define SET_STR_THRESHOLD 6093
+
+#define MUL_FFT_TABLE { 464, 928, 1920, 3584, 10240, 40960, 0 }
+#define MUL_FFT_MODF_THRESHOLD 360
+#define MUL_FFT_THRESHOLD 2816
+
+#define SQR_FFT_TABLE { 528, 1184, 1920, 4608, 14336, 40960, 0 }
+#define SQR_FFT_MODF_THRESHOLD 440
+#define SQR_FFT_THRESHOLD 2816
+
+#define MUL_FFT_TABLE2 {{1,4}, {305,5}, {321,4}, {337,5}, {353,4}, {369,5}, {801,6}, {833,5}, {865,6}, {897,5}, {929,6}, {961,5}, {993,6}, {1345,7}, {1409,6}, {1537,7}, {1665,6}, {1729,7}, {2689,8}, {2817,7}, {3201,8}, {3329,7}, {3457,8}, {3841,7}, {3969,8}, {4097,7}, {4225,8}, {4353,7}, {4481,8}, {5889,7}, {6017,8}, {6401,7}, {6529,8}, {6913,9}, {7681,8}, {8961,9}, {9729,8}, {9985,9}, {10241,8}, {11009,9}, {11777,8}, {12289,9}, {13825,10}, {15361,9}, {15873,8}, {16129,9}, {19969,10}, {23553,9}, {24065,8}, {24321,9}, {26113,10}, {27649,11}, {28673,10}, {31745,9}, {34305,10}, {34817,9}, {35329,10}, {39937,9}, {40449,10}, {48129,11}, {55297,10}, {56321,11}, {63489,10}, {80897,11}, {96257,10}, {97281,12}, {126977,11}, {129025,10}, {130049,9}, {130561,10}, {131073,11}, {133121,10}, {134145,11}, {137217,10}, {138241,11}, {161793,10}, {162817,11}, {194561,12}, {258049,11}, {260097,10}, {261121,9}, {261633,10}, {266241,11}, {268289,10}, {277505,11}, {292865,10}, {293889,9}, {294401,10}, {310273,9}, {310785,11}, {325633,10}, {326657,12}, {389121,13}, {516097,12}, {520193,11}, {522241,10}, {523265,11}, {555009,10}, {556033,11}, {587777,10}, {588801,11}, {620545,10}, {621569,9}, {622081,11}, {622593,12}, {651265,11}, {653313,10}, {654337,11}, {655361,10}, {657409,11}, {663553,10}, {664577,11}, {686081,10}, {687105,11}, {718849,10}, {719873,11}, {720897,10}, {722945,11}, {737281,10}, {740353,11}, {745473,10}, {749569,11}, {751617,10}, {752641,9}, {753153,11}, {753665,12}, {770049,11}, {774145,12}, {782337,11}, {786433,10}, {787457,11}, {817153,10}, {818177,11}, {849921,10}, {850945,11}, {854017,10}, {855041,11}, {862209,10}, {863233,11}, {866305,10}, {867329,11}, {876545,10}, {877569,11}, {882689,10}, {883713,9}, {884225,11}, {884737,13}, {1040385,12}, {1044481,11}, {1112065,10}, {1113089,12}, {1175553,11}, {1243137,12}, {1306625,11}, {1374209,10}, {1375233,12}, {1437697,11}, {1505281,10}, {1506305,12}, {1515521,13}, {1523713,12}, {1527809,13}, {1540097,12}, {1544193,13}, {1548289,12}, {1568769,11}, {1636353,10}, {1637377,12}, {1699841,11}, {MP_SIZE_T_MAX,0}}
+
+#define SQR_FFT_TABLE2 {{1,4}, {273,5}, {289,4}, {305,5}, {673,6}, {705,5}, {737,6}, {769,5}, {801,6}, {1345,7}, {1409,6}, {1537,7}, {1665,6}, {1729,7}, {2689,8}, {2817,7}, {3201,8}, {3329,7}, {3713,8}, {3841,7}, {4225,8}, {4865,7}, {4993,9}, {5121,8}, {6657,9}, {7681,8}, {8961,9}, {11777,8}, {12033,10}, {12289,8}, {12545,9}, {13825,10}, {14337,9}, {14849,10}, {15361,9}, {19969,10}, {23553,9}, {24577,11}, {30721,10}, {31745,9}, {32257,10}, {37889,9}, {38401,10}, {39937,9}, {40449,10}, {48129,11}, {63489,10}, {80897,11}, {96257,12}, {126977,11}, {129025,10}, {130049,11}, {194561,12}, {208897,11}, {210945,12}, {258049,11}, {260097,9}, {269313,10}, {277505,9}, {278017,11}, {278529,10}, {280577,11}, {282625,10}, {283649,11}, {284673,10}, {285697,11}, {286721,10}, {289793,11}, {290817,10}, {293889,9}, {294401,10}, {310273,9}, {310785,8}, {311041,10}, {311297,11}, {315393,10}, {321537,12}, {323585,11}, {325633,10}, {326657,12}, {331777,10}, {332801,12}, {389121,10}, {392193,9}, {392705,10}, {413697,9}, {414209,10}, {418817,9}, {419841,10}, {424961,9}, {425473,10}, {441345,9}, {441857,10}, {449537,9}, {450561,10}, {452609,9}, {453121,10}, {454657,9}, {455169,10}, {490497,12}, {491521,13}, {516097,12}, {520193,10}, {523265,11}, {555009,10}, {556033,11}, {587777,10}, {588801,11}, {620545,10}, {621569,9}, {622081,11}, {624641,12}, {626689,11}, {653313,10}, {654337,11}, {686081,10}, {687105,11}, {718849,10}, {720897,11}, {722945,10}, {724993,11}, {729089,10}, {734209,11}, {737281,10}, {744449,11}, {745473,10}, {747521,11}, {749569,10}, {752641,11}, {784385,10}, {785409,11}, {808961,10}, {809985,11}, {817153,10}, {818177,11}, {849921,10}, {850945,11}, {851969,10}, {852993,11}, {858113,10}, {859137,11}, {860161,10}, {861185,11}, {882689,10}, {883713,11}, {980993,13}, {1040385,11}, {1112065,12}, {1175553,11}, {1243137,12}, {1306625,11}, {1374209,10}, {1375233,12}, {1437697,11}, {1505281,10}, {1506305,12}, {1568769,11}, {1636353,10}, {1637377,12}, {MP_SIZE_T_MAX,0}}
diff --git a/gmp/mpn/x86/p6/lshsub_n.asm b/gmp/mpn/x86/p6/lshsub_n.asm
index 7ada213644..a3086bdbc2 100644
--- a/gmp/mpn/x86/p6/lshsub_n.asm
+++ b/gmp/mpn/x86/p6/lshsub_n.asm
@@ -1,38 +1,27 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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 P6/13: 3.35 cycles/limb (separate mpn_sub_n + mpn_lshift needs 4.12)
-C (1) The loop is not scheduled in any way, and scheduling attempts have not
+C (1) The loop is 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
diff --git a/gmp/mpn/x86/p6/mmx/divrem_1.asm b/gmp/mpn/x86/p6/mmx/divrem_1.asm
index 5300616c14..8891f3a843 100644
--- a/gmp/mpn/x86/p6/mmx/divrem_1.asm
+++ b/gmp/mpn/x86/p6/mmx/divrem_1.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-II mpn_divrem_1 -- mpn by limb division.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/mmx/gmp-mparam.h b/gmp/mpn/x86/p6/mmx/gmp-mparam.h
index 35c3aadfc1..47602f562e 100644
--- a/gmp/mpn/x86/p6/mmx/gmp-mparam.h
+++ b/gmp/mpn/x86/p6/mmx/gmp-mparam.h
@@ -1,198 +1,79 @@
/* Intel P6/mmx gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2005, 2009, 2010 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 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 either:
+it under the terms of the GNU 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 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.
-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.
-or both in parallel, as here.
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
-
-
-#define GMP_LIMB_BITS 32
-#define GMP_LIMB_BYTES 4
-
-
-/* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be more than the
- value in mpn/x86/p6/gmp-mparam.h. The latter is used as a hard limit in
- mpn/x86/p6/sqr_basecase.asm. */
-
-
-/* 800 MHz P6 model 8 */
-
-#define MOD_1_NORM_THRESHOLD 4
-#define MOD_1_UNNORM_THRESHOLD 4
-#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 8
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 10
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 17
-#define USE_PREINV_DIVREM_1 1 /* native */
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 49
-
-#define MUL_TOOM22_THRESHOLD 22
-#define MUL_TOOM33_THRESHOLD 73
-#define MUL_TOOM44_THRESHOLD 193
-#define MUL_TOOM6H_THRESHOLD 254
-#define MUL_TOOM8H_THRESHOLD 381
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 122
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 80
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 81
-#define SQR_TOOM4_THRESHOLD 142
-#define SQR_TOOM6_THRESHOLD 258
-#define SQR_TOOM8_THRESHOLD 399
-
-#define MULMOD_BNM1_THRESHOLD 15
-#define SQRMOD_BNM1_THRESHOLD 18
-
-#define MUL_FFT_MODF_THRESHOLD 476 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 476, 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}, { 41, 8}, { 23, 7}, { 47, 8}, \
- { 27, 9}, { 15, 8}, { 31, 7}, { 63, 8}, \
- { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 67, 9}, { 39, 8}, { 79, 9}, \
- { 47, 8}, { 95, 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}, { 199,10}, \
- { 111,11}, { 63,10}, { 127, 9}, { 255, 8}, \
- { 511,10}, { 143, 9}, { 287, 8}, { 575,10}, \
- { 159,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}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,11}, { 319,10}, { 671,11}, { 351,10}, \
- { 703,12}, { 191,11}, { 383,10}, { 767,11}, \
- { 415,10}, { 831,11}, { 447,13}, { 127,12}, \
- { 255,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 703,10}, { 1407,11}, { 735,12}, { 383,11}, \
- { 831,12}, { 447,11}, { 959,10}, { 1919,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,10}, { 2431,12}, { 639,11}, { 1343,12}, \
- { 703,11}, { 1471,13}, { 383,12}, { 767,11}, \
- { 1535,12}, { 831,11}, { 1727,12}, { 959,11}, \
- { 1919,14}, { 255,13}, { 511,12}, { 1215,11}, \
- { 2431,13}, { 639,12}, { 1471,11}, { 2943,13}, \
- { 767,12}, { 1727,13}, { 895,12}, { 1919,11}, \
- { 3839,14}, { 511,13}, { 1023,12}, { 2111,13}, \
- { 1151,12}, { 2431,13}, { 1279,12}, { 2559,13}, \
- { 1407,12}, { 2943,14}, { 767,13}, { 1663,12}, \
- { 3327,13}, { 1919,12}, { 3839,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 160
-#define MUL_FFT_THRESHOLD 7040
-
-#define SQR_FFT_MODF_THRESHOLD 376 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 376, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 21, 7}, { 11, 6}, { 24, 7}, { 13, 6}, \
- { 27, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
- { 11, 7}, { 27, 8}, { 15, 7}, { 33, 8}, \
- { 19, 7}, { 39, 8}, { 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}, { 127, 8}, \
- { 255, 9}, { 135,10}, { 79, 9}, { 167,10}, \
- { 95, 9}, { 191, 8}, { 383,10}, { 111,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,10}, { 207,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 511,10}, \
- { 271, 9}, { 543,10}, { 287, 9}, { 575,10}, \
- { 303,11}, { 159,10}, { 319, 9}, { 639,10}, \
- { 351, 9}, { 703,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 415, 9}, { 831,11}, { 223,10}, \
- { 479,12}, { 127,11}, { 255,10}, { 543, 9}, \
- { 1087,11}, { 287,10}, { 607, 9}, { 1215,11}, \
- { 319,10}, { 671,11}, { 351,10}, { 703,12}, \
- { 191,11}, { 383,10}, { 767,11}, { 415,10}, \
- { 831,11}, { 479,13}, { 127,12}, { 255,11}, \
- { 543,10}, { 1087,11}, { 607,10}, { 1215,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 703,10}, \
- { 1407,11}, { 735,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}, { 1343,12}, { 703,11}, \
- { 1407,13}, { 383,12}, { 831,11}, { 1727,12}, \
- { 959,11}, { 1919,14}, { 255,13}, { 511,12}, \
- { 1215,11}, { 2431,13}, { 639,12}, { 1471,11}, \
- { 2943,13}, { 767,12}, { 1727,13}, { 895,12}, \
- { 1919,11}, { 3839,14}, { 511,13}, { 1023,12}, \
- { 2111,13}, { 1151,12}, { 2431,13}, { 1407,12}, \
- { 2943,14}, { 767,13}, { 1535,12}, { 3071,13}, \
- { 1663,12}, { 3455,13}, { 1919,12}, { 3839,15}, \
- { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 161
-#define SQR_FFT_THRESHOLD 3712
-
-#define MULLO_BASECASE_THRESHOLD 8
-#define MULLO_DC_THRESHOLD 60
-#define MULLO_MUL_N_THRESHOLD 13765
-
-#define DC_DIV_QR_THRESHOLD 83
-#define DC_DIVAPPR_Q_THRESHOLD 246
-#define DC_BDIV_QR_THRESHOLD 76
-#define DC_BDIV_Q_THRESHOLD 175
-
-#define INV_MULMOD_BNM1_THRESHOLD 42
-#define INV_NEWTON_THRESHOLD 268
-#define INV_APPR_THRESHOLD 250
-
-#define BINV_NEWTON_THRESHOLD 276
-#define REDC_1_TO_REDC_N_THRESHOLD 74
-
-#define MU_DIV_QR_THRESHOLD 1442
-#define MU_DIVAPPR_Q_THRESHOLD 1442
-#define MUPI_DIV_QR_THRESHOLD 132
-#define MU_BDIV_QR_THRESHOLD 1142
-#define MU_BDIV_Q_THRESHOLD 1334
-
-#define MATRIX22_STRASSEN_THRESHOLD 18
-#define HGCD_THRESHOLD 121
-#define GCD_DC_THRESHOLD 478
-#define GCDEXT_DC_THRESHOLD 361
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 26
-#define SET_STR_DC_THRESHOLD 272
-#define SET_STR_PRECOMPUTE_THRESHOLD 1074
+
+/* NOTE: In a fat binary build SQR_KARATSUBA_THRESHOLD here cannot be more
+ than the value in mpn/x86/p6/gmp-mparam.h. The latter is used as a hard
+ limit in mpn/x86/p6/sqr_basecase.asm. */
+
+
+/* 1867 MHz P6 model 13 */
+
+/* Generated by tuneup.c, 2009-03-02, gcc 4.3 */
+
+#define MUL_KARATSUBA_THRESHOLD 20
+#define MUL_TOOM3_THRESHOLD 74
+#define MUL_TOOM44_THRESHOLD 166
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 30
+#define SQR_TOOM3_THRESHOLD 101
+#define SQR_TOOM4_THRESHOLD 154
+
+#define MULLOW_BASECASE_THRESHOLD 7
+#define MULLOW_DC_THRESHOLD 39
+#define MULLOW_MUL_N_THRESHOLD 230
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 21
+#define POWM_THRESHOLD 154
+
+#define MATRIX22_STRASSEN_THRESHOLD 23
+#define HGCD_THRESHOLD 72
+#define GCD_DC_THRESHOLD 321
+#define GCDEXT_DC_THRESHOLD 416
+#define JACOBI_BASE_METHOD 1
+
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1 /* native */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 15
+#define GET_STR_PRECOMPUTE_THRESHOLD 24
+#define SET_STR_DC_THRESHOLD 587
+#define SET_STR_PRECOMPUTE_THRESHOLD 1083
+
+#define MUL_FFT_TABLE { 400, 928, 1664, 4608, 10240, 57344, 163840, 393216, 0 }
+#define MUL_FFT_MODF_THRESHOLD 496
+#define MUL_FFT_THRESHOLD 7168
+
+#define SQR_FFT_TABLE { 432, 928, 1664, 3584, 10240, 40960, 98304, 393216, 0 }
+#define SQR_FFT_MODF_THRESHOLD 448
+#define SQR_FFT_THRESHOLD 3840
+
+/* These tables need updating */
+#define MUL_FFT_TABLE2 {{1,4}, {305,5}, {321,4}, {337,5}, {353,4}, {369,5}, {801,6}, {833,5}, {865,6}, {897,5}, {929,6}, {961,5}, {993,6}, {1345,7}, {1409,6}, {1537,7}, {1665,6}, {1729,7}, {2689,8}, {2817,7}, {3201,8}, {3329,7}, {3457,8}, {3841,7}, {3969,8}, {4097,7}, {4225,8}, {4353,7}, {4481,8}, {5889,7}, {6017,8}, {6401,7}, {6529,8}, {6913,9}, {7681,8}, {8961,9}, {9729,8}, {9985,9}, {10241,8}, {11009,9}, {11777,8}, {12289,9}, {13825,10}, {15361,9}, {15873,8}, {16129,9}, {19969,10}, {23553,9}, {24065,8}, {24321,9}, {26113,10}, {27649,11}, {28673,10}, {31745,9}, {34305,10}, {34817,9}, {35329,10}, {39937,9}, {40449,10}, {48129,11}, {55297,10}, {56321,11}, {63489,10}, {80897,11}, {96257,10}, {97281,12}, {126977,11}, {129025,10}, {130049,9}, {130561,10}, {131073,11}, {133121,10}, {134145,11}, {137217,10}, {138241,11}, {161793,10}, {162817,11}, {194561,12}, {258049,11}, {260097,10}, {261121,9}, {261633,10}, {266241,11}, {268289,10}, {277505,11}, {292865,10}, {293889,9}, {294401,10}, {310273,9}, {310785,11}, {325633,10}, {326657,12}, {389121,13}, {516097,12}, {520193,11}, {522241,10}, {523265,11}, {555009,10}, {556033,11}, {587777,10}, {588801,11}, {620545,10}, {621569,9}, {622081,11}, {622593,12}, {651265,11}, {653313,10}, {654337,11}, {655361,10}, {657409,11}, {663553,10}, {664577,11}, {686081,10}, {687105,11}, {718849,10}, {719873,11}, {720897,10}, {722945,11}, {737281,10}, {740353,11}, {745473,10}, {749569,11}, {751617,10}, {752641,9}, {753153,11}, {753665,12}, {770049,11}, {774145,12}, {782337,11}, {786433,10}, {787457,11}, {817153,10}, {818177,11}, {849921,10}, {850945,11}, {854017,10}, {855041,11}, {862209,10}, {863233,11}, {866305,10}, {867329,11}, {876545,10}, {877569,11}, {882689,10}, {883713,9}, {884225,11}, {884737,13}, {1040385,12}, {1044481,11}, {1112065,10}, {1113089,12}, {1175553,11}, {1243137,12}, {1306625,11}, {1374209,10}, {1375233,12}, {1437697,11}, {1505281,10}, {1506305,12}, {1515521,13}, {1523713,12}, {1527809,13}, {1540097,12}, {1544193,13}, {1548289,12}, {1568769,11}, {1636353,10}, {1637377,12}, {1699841,11}, {MP_SIZE_T_MAX,0}}
+
+#define SQR_FFT_TABLE2 {{1,4}, {273,5}, {289,4}, {305,5}, {673,6}, {705,5}, {737,6}, {769,5}, {801,6}, {1345,7}, {1409,6}, {1537,7}, {1665,6}, {1729,7}, {2689,8}, {2817,7}, {3201,8}, {3329,7}, {3713,8}, {3841,7}, {4225,8}, {4865,7}, {4993,9}, {5121,8}, {6657,9}, {7681,8}, {8961,9}, {11777,8}, {12033,10}, {12289,8}, {12545,9}, {13825,10}, {14337,9}, {14849,10}, {15361,9}, {19969,10}, {23553,9}, {24577,11}, {30721,10}, {31745,9}, {32257,10}, {37889,9}, {38401,10}, {39937,9}, {40449,10}, {48129,11}, {63489,10}, {80897,11}, {96257,12}, {126977,11}, {129025,10}, {130049,11}, {194561,12}, {208897,11}, {210945,12}, {258049,11}, {260097,9}, {269313,10}, {277505,9}, {278017,11}, {278529,10}, {280577,11}, {282625,10}, {283649,11}, {284673,10}, {285697,11}, {286721,10}, {289793,11}, {290817,10}, {293889,9}, {294401,10}, {310273,9}, {310785,8}, {311041,10}, {311297,11}, {315393,10}, {321537,12}, {323585,11}, {325633,10}, {326657,12}, {331777,10}, {332801,12}, {389121,10}, {392193,9}, {392705,10}, {413697,9}, {414209,10}, {418817,9}, {419841,10}, {424961,9}, {425473,10}, {441345,9}, {441857,10}, {449537,9}, {450561,10}, {452609,9}, {453121,10}, {454657,9}, {455169,10}, {490497,12}, {491521,13}, {516097,12}, {520193,10}, {523265,11}, {555009,10}, {556033,11}, {587777,10}, {588801,11}, {620545,10}, {621569,9}, {622081,11}, {624641,12}, {626689,11}, {653313,10}, {654337,11}, {686081,10}, {687105,11}, {718849,10}, {720897,11}, {722945,10}, {724993,11}, {729089,10}, {734209,11}, {737281,10}, {744449,11}, {745473,10}, {747521,11}, {749569,10}, {752641,11}, {784385,10}, {785409,11}, {808961,10}, {809985,11}, {817153,10}, {818177,11}, {849921,10}, {850945,11}, {851969,10}, {852993,11}, {858113,10}, {859137,11}, {860161,10}, {861185,11}, {882689,10}, {883713,11}, {980993,13}, {1040385,11}, {1112065,12}, {1175553,11}, {1243137,12}, {1306625,11}, {1374209,10}, {1375233,12}, {1437697,11}, {1505281,10}, {1506305,12}, {1568769,11}, {1636353,10}, {1637377,12}, {MP_SIZE_T_MAX,0}}
diff --git a/gmp/mpn/x86/p6/mmx/lshift.asm b/gmp/mpn/x86/p6/mmx/lshift.asm
index febd1c0e6c..e325b67d64 100644
--- a/gmp/mpn/x86/p6/mmx/lshift.asm
+++ b/gmp/mpn/x86/p6/mmx/lshift.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-II mpn_lshift -- mpn left shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a 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 P55 code runs well on P-II/III, but could stand some minor tweaks
diff --git a/gmp/mpn/x86/p6/mmx/popham.asm b/gmp/mpn/x86/p6/mmx/popham.asm
index fd340e4b45..421daa5308 100644
--- a/gmp/mpn/x86/p6/mmx/popham.asm
+++ b/gmp/mpn/x86/p6/mmx/popham.asm
@@ -2,32 +2,21 @@ dnl Intel Pentium-II mpn_popcount, mpn_hamdist -- population count and
dnl hamming distance.
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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/mmx/rshift.asm b/gmp/mpn/x86/p6/mmx/rshift.asm
index 77aa1909fa..b1543cdf52 100644
--- a/gmp/mpn/x86/p6/mmx/rshift.asm
+++ b/gmp/mpn/x86/p6/mmx/rshift.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-II mpn_rshift -- mpn left shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a 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 P55 code runs well on P-II/III, but could stand some minor tweaks
diff --git a/gmp/mpn/x86/p6/mod_1.asm b/gmp/mpn/x86/p6/mod_1.asm
new file mode 100644
index 0000000000..b6eacf7e82
--- /dev/null
+++ b/gmp/mpn/x86/p6/mod_1.asm
@@ -0,0 +1,472 @@
+dnl Intel P6 mpn_mod_1 -- mpn by limb remainder.
+
+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
+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 P6: 21.5 cycles/limb
+
+
+C mp_limb_t mpn_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor);
+C mp_limb_t mpn_mod_1c (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t carry);
+C mp_limb_t mpn_preinv_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t inverse);
+C
+C The code here is in two parts, a simple divl loop and a mul-by-inverse.
+C The divl is used by mod_1 and mod_1c for small sizes, until the savings in
+C the mul-by-inverse can overcome the time to calculate an inverse.
+C preinv_mod_1 goes straight to the mul-by-inverse.
+C
+C The mul-by-inverse normalizes the divisor (or for preinv_mod_1 it's
+C already normalized). The calculation done is r=a%(d*2^n) followed by a
+C final (r*2^n)%(d*2^n), where a is the dividend, d the divisor, and n is
+C the number of leading zero bits on d. This means there's no bit shifts in
+C the main loop, at the cost of an extra divide step at the end.
+C
+C The simple divl for mod_1 is able to skip one divide step if high<divisor.
+C For mod_1c the carry parameter is the high of the first divide step, and
+C no attempt is make to skip that step since carry==0 will be very rare.
+C
+C The mul-by-inverse always skips one divide step, but then needs an extra
+C step at the end, unless the divisor was already normalized (n==0). This
+C leads to different mul-by-inverse thresholds for normalized and
+C unnormalized divisors, in mod_1 and mod_1c.
+C
+C Alternatives:
+C
+C If n is small then the extra divide step could be done by a few shift and
+C trial subtract steps instead of a full divide. That would probably be 3
+C or 4 cycles/bit, so say up to n=8 might benefit from that over a 21 cycle
+C divide. However it's considered that small divisors, meaning biggish n,
+C are more likely than small n, and that it's not worth the branch
+C mispredicts of a loop.
+C
+C Past:
+C
+C There used to be some MMX based code for P-II and P-III, roughly following
+C the K7 form, but it was slower (about 24.0 c/l) than the code here. That
+C code did have an advantage that mod_1 was able to do one less divide step
+C when high<divisor and the divisor unnormalized, but the speed advantage of
+C the current code soon overcomes that.
+C
+C Future:
+C
+C It's not clear whether what's here is optimal. A rough count of micro-ops
+C on the dependent chain would suggest a couple of cycles could be shaved,
+C perhaps.
+
+
+dnl The following thresholds are the sizes where the multiply by inverse
+dnl method is used instead of plain divl's. Minimum value 2 each.
+dnl
+dnl MUL_NORM_THRESHOLD is for normalized divisors (high bit set),
+dnl MUL_UNNORM_THRESHOLD for unnormalized divisors.
+dnl
+dnl With the divl loop at 39 c/l, and the inverse loop at 21.5 c/l but
+dnl setups for the inverse of about 50, the threshold should be around
+dnl 50/(39-21.5)==2.85. An unnormalized divisor gets an extra divide step
+dnl at the end, so if that's about 25 cycles then that threshold might be
+dnl around (50+25)/(39-21.5) == 4.3.
+
+deflit(MUL_NORM_THRESHOLD, 4)
+deflit(MUL_UNNORM_THRESHOLD, 5)
+
+deflit(MUL_NORM_DELTA, eval(MUL_NORM_THRESHOLD - MUL_UNNORM_THRESHOLD))
+
+
+defframe(PARAM_INVERSE, 16) dnl mpn_preinv_mod_1
+defframe(PARAM_CARRY, 16) dnl mpn_mod_1c
+defframe(PARAM_DIVISOR, 12)
+defframe(PARAM_SIZE, 8)
+defframe(PARAM_SRC, 4)
+
+defframe(SAVE_EBX, -4)
+defframe(SAVE_ESI, -8)
+defframe(SAVE_EDI, -12)
+defframe(SAVE_EBP, -16)
+
+defframe(VAR_NORM, -20)
+defframe(VAR_INVERSE, -24)
+
+deflit(STACK_SPACE, 24)
+
+ TEXT
+
+ ALIGN(16)
+PROLOGUE(mpn_preinv_mod_1)
+deflit(`FRAME',0)
+
+ movl PARAM_SRC, %edx
+ subl $STACK_SPACE, %esp FRAME_subl_esp(STACK_SPACE)
+
+ movl %ebx, SAVE_EBX
+ movl PARAM_SIZE, %ebx
+
+ movl %ebp, SAVE_EBP
+ movl PARAM_DIVISOR, %ebp
+
+ movl %esi, SAVE_ESI
+ movl PARAM_INVERSE, %eax
+
+ movl %edi, SAVE_EDI
+ movl -4(%edx,%ebx,4), %edi C src high limb
+
+ movl $0, VAR_NORM
+ leal -8(%edx,%ebx,4), %ecx C &src[size-2]
+
+ C
+
+ movl %edi, %esi
+ subl %ebp, %edi C high-divisor
+
+ cmovc( %esi, %edi) C restore if underflow
+ decl %ebx
+ jnz L(preinv_entry)
+
+ jmp L(done_edi)
+
+EPILOGUE()
+
+
+ ALIGN(16)
+PROLOGUE(mpn_mod_1c)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ subl $STACK_SPACE, %esp FRAME_subl_esp(STACK_SPACE)
+
+ movl %ebp, SAVE_EBP
+ movl PARAM_DIVISOR, %eax
+
+ movl %esi, SAVE_ESI
+ movl PARAM_CARRY, %edx
+
+ movl PARAM_SRC, %esi
+ orl %ecx, %ecx
+ jz L(done_edx) C result==carry if size==0
+
+ sarl $31, %eax
+ movl PARAM_DIVISOR, %ebp
+
+ andl $MUL_NORM_DELTA, %eax
+
+ addl $MUL_UNNORM_THRESHOLD, %eax
+
+ cmpl %eax, %ecx
+ jb L(divide_top)
+
+
+ C The carry parameter pretends to be the src high limb.
+
+ movl %ebx, SAVE_EBX
+ leal 1(%ecx), %ebx C size+1
+
+ movl %edx, %eax C carry
+ jmp L(mul_by_inverse_1c)
+
+EPILOGUE()
+
+
+ ALIGN(16)
+PROLOGUE(mpn_mod_1)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ subl $STACK_SPACE, %esp FRAME_subl_esp(STACK_SPACE)
+ movl $0, %edx C initial carry (if can't skip a div)
+
+ movl %esi, SAVE_ESI
+ movl PARAM_SRC, %eax
+
+ movl %ebp, SAVE_EBP
+ movl PARAM_DIVISOR, %ebp
+
+ movl PARAM_DIVISOR, %esi
+ orl %ecx, %ecx
+ jz L(done_edx)
+
+ movl -4(%eax,%ecx,4), %eax C src high limb
+
+ sarl $31, %ebp
+
+ andl $MUL_NORM_DELTA, %ebp
+
+ addl $MUL_UNNORM_THRESHOLD, %ebp
+ cmpl %esi, %eax C carry flag if high<divisor
+
+ cmovc( %eax, %edx) C src high limb as initial carry
+ movl PARAM_SRC, %esi
+
+ sbbl $0, %ecx C size-1 to skip one div
+ jz L(done_eax) C done if had size==1
+
+ cmpl %ebp, %ecx
+ movl PARAM_DIVISOR, %ebp
+ jae L(mul_by_inverse)
+
+
+L(divide_top):
+ C eax scratch (quotient)
+ C ebx
+ C ecx counter, limbs, decrementing
+ C edx scratch (remainder)
+ C esi src
+ C edi
+ C ebp divisor
+
+ movl -4(%esi,%ecx,4), %eax
+
+ divl %ebp
+
+ decl %ecx
+ jnz L(divide_top)
+
+
+L(done_edx):
+ movl %edx, %eax
+L(done_eax):
+ movl SAVE_ESI, %esi
+
+ movl SAVE_EBP, %ebp
+ addl $STACK_SPACE, %esp
+
+ ret
+
+
+C -----------------------------------------------------------------------------
+
+L(mul_by_inverse):
+ C eax src high limb
+ C ebx
+ C ecx
+ C edx
+ C esi src
+ C edi
+ C ebp divisor
+
+ movl %ebx, SAVE_EBX
+ movl PARAM_SIZE, %ebx
+
+L(mul_by_inverse_1c):
+ bsrl %ebp, %ecx C 31-l
+
+ movl %edi, SAVE_EDI
+ xorl $31, %ecx C l
+
+ movl %ecx, VAR_NORM
+ shll %cl, %ebp C d normalized
+
+ movl %eax, %edi C src high -> n2
+ subl %ebp, %eax
+
+ cmovnc( %eax, %edi) C n2-divisor if no underflow
+
+ movl $-1, %eax
+ movl $-1, %edx
+
+ subl %ebp, %edx C (b-d)-1 so edx:eax = b*(b-d)-1
+ leal -8(%esi,%ebx,4), %ecx C &src[size-2]
+
+ divl %ebp C floor (b*(b-d)-1) / d
+
+L(preinv_entry):
+ movl %eax, VAR_INVERSE
+
+
+
+C No special scheduling of loads is necessary in this loop, out of order
+C execution hides the latencies already.
+C
+C The way q1+1 is generated in %ebx and d is moved to %eax for the multiply
+C seems fastest. The obvious change to generate q1+1 in %eax and then just
+C multiply by %ebp (as per mpn/x86/pentium/mod_1.asm in fact) runs 1 cycle
+C slower, for no obvious reason.
+
+
+ ALIGN(16)
+L(inverse_top):
+ C eax n10 (then scratch)
+ C ebx scratch (nadj, q1)
+ C ecx src pointer, decrementing
+ C edx scratch
+ C esi n10
+ C edi n2
+ C ebp divisor
+
+ movl (%ecx), %eax C next src limb
+ movl %eax, %esi
+
+ sarl $31, %eax C -n1
+ movl %ebp, %ebx
+
+ andl %eax, %ebx C -n1 & d
+ negl %eax C n1
+
+ addl %edi, %eax C n2+n1
+
+ mull VAR_INVERSE C m*(n2+n1)
+
+ addl %esi, %ebx C nadj = n10 + (-n1 & d), ignoring overflow
+ subl $4, %ecx
+
+ C
+
+ addl %ebx, %eax C m*(n2+n1) + nadj, low giving carry flag
+ leal 1(%edi), %ebx C n2+1
+ movl %ebp, %eax C d
+
+ adcl %edx, %ebx C 1 + high(n2<<32 + m*(n2+n1) + nadj) = q1+1
+ jz L(q1_ff)
+
+ mull %ebx C (q1+1)*d
+
+ C
+
+ subl %eax, %esi C low n - (q1+1)*d
+
+ sbbl %edx, %edi C high n - (q1+1)*d, 0 or -1
+
+ andl %ebp, %edi C d if underflow
+
+ addl %esi, %edi C remainder with addback if necessary
+
+ cmpl PARAM_SRC, %ecx
+ jae L(inverse_top)
+
+
+C -----------------------------------------------------------------------------
+L(inverse_loop_done):
+
+ C %edi is the remainder modulo d*2^n and now must be reduced to
+ C 0<=r<d by calculating r*2^n mod d*2^n and then right shifting by
+ C n. If d was already normalized on entry so that n==0 then nothing
+ C is needed here. The chance of n==0 is low, but it's true of say
+ C PP from gmp-impl.h.
+ C
+ C eax
+ C ebx
+ C ecx
+ C edx
+ C esi
+ C edi remainder
+ C ebp divisor (normalized)
+
+ movl VAR_NORM, %ecx
+ movl $0, %esi
+
+ orl %ecx, %ecx
+ jz L(done_edi)
+
+
+ C Here use %edi=n10 and %esi=n2, opposite to the loop above.
+ C
+ C The q1=0xFFFFFFFF case is handled with an sbbl to adjust q1+1
+ C back, rather than q1_ff special case code. This is simpler and
+ C costs only 2 uops.
+
+ shldl( %cl, %edi, %esi)
+
+ shll %cl, %edi
+
+ movl %edi, %eax C n10
+ movl %ebp, %ebx C d
+
+ sarl $31, %eax C -n1
+
+ andl %eax, %ebx C -n1 & d
+ negl %eax C n1
+
+ addl %edi, %ebx C nadj = n10 + (-n1 & d), ignoring overflow
+ addl %esi, %eax C n2+n1
+
+ mull VAR_INVERSE C m*(n2+n1)
+
+ C
+
+ addl %ebx, %eax C m*(n2+n1) + nadj, low giving carry flag
+ leal 1(%esi), %ebx C n2+1
+
+ adcl %edx, %ebx C 1 + high(n2<<32 + m*(n2+n1) + nadj) = q1+1
+
+ sbbl $0, %ebx
+ movl %ebp, %eax C d
+
+ mull %ebx C (q1+1)*d
+
+ movl SAVE_EBX, %ebx
+
+ C
+
+ subl %eax, %edi C low n - (q1+1)*d is remainder
+
+ sbbl %edx, %esi C high n - (q1+1)*d, 0 or -1
+
+ andl %ebp, %esi
+ movl SAVE_EBP, %ebp
+
+ leal (%esi,%edi), %eax C remainder
+ movl SAVE_ESI, %esi
+
+ shrl %cl, %eax C denorm remainder
+ movl SAVE_EDI, %edi
+ addl $STACK_SPACE, %esp
+
+ ret
+
+
+L(done_edi):
+ movl SAVE_EBX, %ebx
+ movl %edi, %eax
+
+ movl SAVE_ESI, %esi
+
+ movl SAVE_EDI, %edi
+
+ movl SAVE_EBP, %ebp
+ addl $STACK_SPACE, %esp
+
+ ret
+
+
+C -----------------------------------------------------------------------------
+C
+C Special case for q1=0xFFFFFFFF, giving q=0xFFFFFFFF meaning the low dword
+C of q*d is simply -d and the remainder n-q*d = n10+d.
+C
+C This is reached only very rarely.
+
+L(q1_ff):
+ C eax (divisor)
+ C ebx (q1+1 == 0)
+ C ecx src pointer
+ C edx
+ C esi n10
+ C edi (n2)
+ C ebp divisor
+
+ leal (%ebp,%esi), %edi C n-q*d remainder -> next n2
+
+ cmpl PARAM_SRC, %ecx
+ jae L(inverse_top)
+
+ jmp L(inverse_loop_done)
+
+
+EPILOGUE()
diff --git a/gmp/mpn/x86/p6/mod_34lsub1.asm b/gmp/mpn/x86/p6/mod_34lsub1.asm
index b88ab5d17c..5e854b7274 100644
--- a/gmp/mpn/x86/p6/mod_34lsub1.asm
+++ b/gmp/mpn/x86/p6/mod_34lsub1.asm
@@ -1,32 +1,21 @@
dnl Intel P6 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
-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 either:
+dnl Copyright 2000, 2001, 2002, 2004 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/mode1o.asm b/gmp/mpn/x86/p6/mode1o.asm
index c62b676e5a..4aff48d7e6 100644
--- a/gmp/mpn/x86/p6/mode1o.asm
+++ b/gmp/mpn/x86/p6/mode1o.asm
@@ -1,32 +1,21 @@
dnl Intel P6 mpn_modexact_1_odd -- exact division style remainder.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -112,7 +101,7 @@ ifdef(`PIC',`
subl %eax, %edi C inv = 2*inv - inv*inv*d
- ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB
movl PARAM_DIVISOR, %eax
imull %edi, %eax
cmpl $1, %eax')
@@ -124,7 +113,7 @@ C subl %edx, %eax 1
C imull %edi, %eax 4
C mull PARAM_DIVISOR 5
C ----
-C total 10
+C total 10
C
C and this is the measured speed. No special scheduling is necessary, out
C of order execution hides the load latency.
diff --git a/gmp/mpn/x86/p6/mul_basecase.asm b/gmp/mpn/x86/p6/mul_basecase.asm
index d87bc12b60..fc1afbdf0e 100644
--- a/gmp/mpn/x86/p6/mul_basecase.asm
+++ b/gmp/mpn/x86/p6/mul_basecase.asm
@@ -1,32 +1,21 @@
dnl Intel P6 mpn_mul_basecase -- multiply two mpn numbers.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/p3mmx/popham.asm b/gmp/mpn/x86/p6/p3mmx/popham.asm
index db2f2601c9..2f58968a31 100644
--- a/gmp/mpn/x86/p6/p3mmx/popham.asm
+++ b/gmp/mpn/x86/p6/p3mmx/popham.asm
@@ -2,32 +2,21 @@ 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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/sqr_basecase.asm b/gmp/mpn/x86/p6/sqr_basecase.asm
index 8fc7fdf375..05a31f1a15 100644
--- a/gmp/mpn/x86/p6/sqr_basecase.asm
+++ b/gmp/mpn/x86/p6/sqr_basecase.asm
@@ -1,32 +1,21 @@
dnl Intel P6 mpn_sqr_basecase -- square an mpn number.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -38,15 +27,15 @@ C which is the Karatsuba recursing range).
dnl These are the same as in mpn/x86/k6/sqr_basecase.asm, see that file for
dnl a description. The only difference here is that UNROLL_COUNT can go up
-dnl to 64 (not 63) making SQR_TOOM2_THRESHOLD_MAX 67.
+dnl to 64 (not 63) making SQR_KARATSUBA_THRESHOLD_MAX 67.
-deflit(SQR_TOOM2_THRESHOLD_MAX, 67)
+deflit(SQR_KARATSUBA_THRESHOLD_MAX, 67)
-ifdef(`SQR_TOOM2_THRESHOLD_OVERRIDE',
-`define(`SQR_TOOM2_THRESHOLD',SQR_TOOM2_THRESHOLD_OVERRIDE)')
+ifdef(`SQR_KARATSUBA_THRESHOLD_OVERRIDE',
+`define(`SQR_KARATSUBA_THRESHOLD',SQR_KARATSUBA_THRESHOLD_OVERRIDE)')
-m4_config_gmp_mparam(`SQR_TOOM2_THRESHOLD')
-deflit(UNROLL_COUNT, eval(SQR_TOOM2_THRESHOLD-3))
+m4_config_gmp_mparam(`SQR_KARATSUBA_THRESHOLD')
+deflit(UNROLL_COUNT, eval(SQR_KARATSUBA_THRESHOLD-3))
C void mpn_sqr_basecase (mp_ptr dst, mp_srcptr src, mp_size_t size);
diff --git a/gmp/mpn/x86/p6/sse2/addmul_1.asm b/gmp/mpn/x86/p6/sse2/addmul_1.asm
index 144b627aa3..b601c54bcf 100644
--- a/gmp/mpn/x86/p6/sse2/addmul_1.asm
+++ b/gmp/mpn/x86/p6/sse2/addmul_1.asm
@@ -1,32 +1,21 @@
dnl Intel P6/SSE2 mpn_addmul_1.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/sse2/gmp-mparam.h b/gmp/mpn/x86/p6/sse2/gmp-mparam.h
index 69226289a7..843227b99a 100644
--- a/gmp/mpn/x86/p6/sse2/gmp-mparam.h
+++ b/gmp/mpn/x86/p6/sse2/gmp-mparam.h
@@ -1,197 +1,74 @@
/* Intel P6/sse2 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2003, 2008-2010 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2003, 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 either:
+it under the terms of the GNU 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 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.
-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.
-or both in parallel, as here.
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
-The GNU MP Library is distributed in the hope that 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: In a fat binary build SQR_KARATSUBA_THRESHOLD here cannot be more
+ than the value in mpn/x86/p6/gmp-mparam.h. The latter is used as a hard
+ limit in mpn/x86/p6/sqr_basecase.asm. */
-#define GMP_LIMB_BITS 32
-#define GMP_LIMB_BYTES 4
+/* 1867 MHz P6 model 13 */
+/* Generated by tuneupc, 2008-10-30, gcc 4.3 */
-/* NOTE: In a fat binary build SQR_TOOM2_THRESHOLD here cannot be more than the
- value in mpn/x86/p6/gmp-mparam.h. The latter is used as a hard limit in
- mpn/x86/p6/sqr_basecase.asm. */
+#define MUL_KARATSUBA_THRESHOLD 20
+#define MUL_TOOM3_THRESHOLD 77
+#define MUL_TOOM44_THRESHOLD 142
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 30
+#define SQR_TOOM3_THRESHOLD 101
+#define SQR_TOOM4_THRESHOLD 154
-/* 1867 MHz P6 model 13 */
+#define MULLOW_BASECASE_THRESHOLD 4
+#define MULLOW_DC_THRESHOLD 38
+#define MULLOW_MUL_N_THRESHOLD 234
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 24
+#define POWM_THRESHOLD 150
+
+#define MATRIX22_STRASSEN_THRESHOLD 23
+#define HGCD_THRESHOLD 95
+#define GCD_DC_THRESHOLD 381
+#define GCDEXT_DC_THRESHOLD 419
+#define JACOBI_BASE_METHOD 1
+
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1 /* native */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 14
+#define GET_STR_PRECOMPUTE_THRESHOLD 24
+#define SET_STR_DC_THRESHOLD 276
+#define SET_STR_PRECOMPUTE_THRESHOLD 1078
+
+#define MUL_FFT_TABLE { 400, 928, 1664, 3584, 10240, 40960, 98304, 393216, 1572864, 0 }
+#define MUL_FFT_MODF_THRESHOLD 496
+#define MUL_FFT_THRESHOLD 7168
-#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 11
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 8
-#define USE_PREINV_DIVREM_1 1 /* native */
-#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 20
-#define MUL_TOOM33_THRESHOLD 77
-#define MUL_TOOM44_THRESHOLD 169
-#define MUL_TOOM6H_THRESHOLD 246
-#define MUL_TOOM8H_THRESHOLD 381
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 114
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 97
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 80
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 106
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 101
-#define SQR_TOOM4_THRESHOLD 154
-#define SQR_TOOM6_THRESHOLD 222
-#define SQR_TOOM8_THRESHOLD 527
-
-#define MULMID_TOOM42_THRESHOLD 58
-
-#define MULMOD_BNM1_THRESHOLD 13
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define MUL_FFT_MODF_THRESHOLD 690 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 565, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 28, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 47, 8}, { 27, 9}, { 15, 8}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 5}, \
- { 383, 4}, { 991, 5}, { 511, 6}, { 267, 7}, \
- { 157, 8}, { 91, 9}, { 47, 8}, { 111, 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}, \
- { 143, 9}, { 287,10}, { 159,11}, { 95,10}, \
- { 191,12}, { 63,11}, { 127,10}, { 255, 9}, \
- { 511,10}, { 271, 9}, { 543,10}, { 287,11}, \
- { 159,10}, { 335, 9}, { 671,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,11}, \
- { 319,10}, { 671,12}, { 191,11}, { 383,10}, \
- { 799,11}, { 415,10}, { 831,13}, { 127,12}, \
- { 255,11}, { 543,10}, { 1087,11}, { 607,10}, \
- { 1215,12}, { 319,11}, { 671,10}, { 1343,11}, \
- { 735,10}, { 1471,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,12}, { 447,11}, { 959,13}, \
- { 255,12}, { 511,11}, { 1087,12}, { 575,11}, \
- { 1215,12}, { 639,11}, { 1343,12}, { 703,11}, \
- { 1471,13}, { 383,12}, { 831,11}, { 1727,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1215,13}, \
- { 639,12}, { 1471,11}, { 2943,13}, { 767,12}, \
- { 1727,13}, { 895,12}, { 1919,14}, { 511,13}, \
- { 1023,12}, { 2111,13}, { 1151,12}, { 2431,13}, \
- { 1407,12}, { 2815,14}, { 767,13}, { 1663,12}, \
- { 3455,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 132
-#define MUL_FFT_THRESHOLD 7424
-
-#define SQR_FFT_MODF_THRESHOLD 565 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 472, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 25, 7}, { 13, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 17, 6}, { 35, 7}, { 27, 8}, \
- { 15, 7}, { 35, 8}, { 19, 7}, { 41, 8}, \
- { 23, 7}, { 49, 8}, { 27, 9}, { 15, 8}, \
- { 39, 9}, { 23, 8}, { 51,10}, { 15, 9}, \
- { 31, 8}, { 63, 4}, { 1023, 8}, { 67, 9}, \
- { 39, 5}, { 639, 4}, { 1471, 6}, { 383, 7}, \
- { 209, 8}, { 119, 9}, { 63, 7}, { 255, 8}, \
- { 139, 9}, { 71, 8}, { 143, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 135,10}, { 79, 9}, { 159, 8}, { 319, 9}, \
- { 167,10}, { 95,11}, { 63,10}, { 143, 9}, \
- { 287,10}, { 159,11}, { 95,10}, { 191,12}, \
- { 63,11}, { 127,10}, { 255, 9}, { 543, 8}, \
- { 1087,10}, { 287, 9}, { 575,11}, { 159,10}, \
- { 319, 9}, { 639,10}, { 335, 9}, { 671,10}, \
- { 351, 9}, { 703,11}, { 191,10}, { 383, 9}, \
- { 767,10}, { 399, 9}, { 799,10}, { 415, 9}, \
- { 831,11}, { 223,12}, { 127,11}, { 255,10}, \
- { 543, 9}, { 1087,11}, { 287,10}, { 607, 9}, \
- { 1215,11}, { 319,10}, { 671, 9}, { 1343,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
- { 799,11}, { 415,10}, { 831,13}, { 127,12}, \
- { 255,11}, { 543,10}, { 1087,11}, { 607,12}, \
- { 319,11}, { 671,10}, { 1343,11}, { 735,12}, \
- { 383,11}, { 799,10}, { 1599,11}, { 863,12}, \
- { 447,11}, { 959,13}, { 255,12}, { 511,11}, \
- { 1087,12}, { 575,11}, { 1215,12}, { 639,11}, \
- { 1343,12}, { 703,11}, { 1471,13}, { 383,12}, \
- { 767,11}, { 1599,12}, { 831,11}, { 1727,12}, \
- { 959,14}, { 255,13}, { 511,12}, { 1215,13}, \
- { 639,12}, { 1471,13}, { 767,12}, { 1727,13}, \
- { 895,12}, { 1919,14}, { 511,13}, { 1023,12}, \
- { 2111,13}, { 1151,12}, { 2431,13}, { 1407,14}, \
- { 767,13}, { 1663,12}, { 3455,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 146
-#define SQR_FFT_THRESHOLD 5760
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 31
-#define MULLO_MUL_N_THRESHOLD 13463
-
-#define DC_DIV_QR_THRESHOLD 25
-#define DC_DIVAPPR_Q_THRESHOLD 55
-#define DC_BDIV_QR_THRESHOLD 60
-#define DC_BDIV_Q_THRESHOLD 132
-
-#define INV_MULMOD_BNM1_THRESHOLD 38
-#define INV_NEWTON_THRESHOLD 65
-#define INV_APPR_THRESHOLD 65
-
-#define BINV_NEWTON_THRESHOLD 252
-#define REDC_1_TO_REDC_N_THRESHOLD 62
-
-#define MU_DIV_QR_THRESHOLD 1164
-#define MU_DIVAPPR_Q_THRESHOLD 748
-#define MUPI_DIV_QR_THRESHOLD 38
-#define MU_BDIV_QR_THRESHOLD 1360
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define POWM_SEC_TABLE 2,23,258,879,2246
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 69
-#define HGCD_APPR_THRESHOLD 112
-#define HGCD_REDUCE_THRESHOLD 3389
-#define GCD_DC_THRESHOLD 386
-#define GCDEXT_DC_THRESHOLD 303
-#define JACOBI_BASE_METHOD 1
-
-#define GET_STR_DC_THRESHOLD 13
-#define GET_STR_PRECOMPUTE_THRESHOLD 25
-#define SET_STR_DC_THRESHOLD 582
-#define SET_STR_PRECOMPUTE_THRESHOLD 1118
-
-#define FAC_DSC_THRESHOLD 178
-#define FAC_ODD_THRESHOLD 34
+#define SQR_FFT_TABLE { 432, 928, 1664, 3584, 10240, 40960, 98304, 393216, 1572864, 0 }
+#define SQR_FFT_MODF_THRESHOLD 448
+#define SQR_FFT_THRESHOLD 3840
diff --git a/gmp/mpn/x86/p6/sse2/mod_1_1.asm b/gmp/mpn/x86/p6/sse2/mod_1_1.asm
deleted file mode 100644
index 8b7b7adaa5..0000000000
--- a/gmp/mpn/x86/p6/sse2/mod_1_1.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel P6/SSE2 mpn_mod_1_1.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_mod_1_1p)
-include_mpn(`x86/pentium4/sse2/mod_1_1.asm')
diff --git a/gmp/mpn/x86/p6/sse2/mod_1_4.asm b/gmp/mpn/x86/p6/sse2/mod_1_4.asm
deleted file mode 100644
index 49c96c60b9..0000000000
--- a/gmp/mpn/x86/p6/sse2/mod_1_4.asm
+++ /dev/null
@@ -1,34 +0,0 @@
-dnl Intel P6/SSE2 mpn_mod_1_4.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_mod_1s_4p)
-include_mpn(`x86/pentium4/sse2/mod_1_4.asm')
diff --git a/gmp/mpn/x86/p6/sse2/mul_1.asm b/gmp/mpn/x86/p6/sse2/mul_1.asm
index 50e5b6983a..fc3d4e6414 100644
--- a/gmp/mpn/x86/p6/sse2/mul_1.asm
+++ b/gmp/mpn/x86/p6/sse2/mul_1.asm
@@ -1,32 +1,21 @@
dnl Intel P6/SSE2 mpn_mul_1.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/sse2/mul_basecase.asm b/gmp/mpn/x86/p6/sse2/mul_basecase.asm
index 4687625790..f52ece025f 100644
--- a/gmp/mpn/x86/p6/sse2/mul_basecase.asm
+++ b/gmp/mpn/x86/p6/sse2/mul_basecase.asm
@@ -1,32 +1,21 @@
dnl Intel P6/SSE2 mpn_mul_basecase.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/sse2/popcount.asm b/gmp/mpn/x86/p6/sse2/popcount.asm
index 4c02b93be2..f818d6e230 100644
--- a/gmp/mpn/x86/p6/sse2/popcount.asm
+++ b/gmp/mpn/x86/p6/sse2/popcount.asm
@@ -1,32 +1,21 @@
dnl Intel P6/SSE2 mpn_popcount -- population count.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/sse2/sqr_basecase.asm b/gmp/mpn/x86/p6/sse2/sqr_basecase.asm
index 76b574b6c7..8a7f24974d 100644
--- a/gmp/mpn/x86/p6/sse2/sqr_basecase.asm
+++ b/gmp/mpn/x86/p6/sse2/sqr_basecase.asm
@@ -1,32 +1,21 @@
dnl Intel P6/SSE2 mpn_sqr_basecase.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/p6/sse2/submul_1.asm b/gmp/mpn/x86/p6/sse2/submul_1.asm
index 98a603ce93..ae97fd6346 100644
--- a/gmp/mpn/x86/p6/sse2/submul_1.asm
+++ b/gmp/mpn/x86/p6/sse2/submul_1.asm
@@ -1,32 +1,21 @@
dnl Intel P6/SSE2 mpn_submul_1.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/README b/gmp/mpn/x86/pentium/README
index 305936bbd9..6c4d872c47 100644
--- a/gmp/mpn/x86/pentium/README
+++ b/gmp/mpn/x86/pentium/README
@@ -1,30 +1,19 @@
-Copyright 1996, 1999-2001, 2003 Free Software Foundation, Inc.
+Copyright 1996, 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/x86/pentium/aors_n.asm b/gmp/mpn/x86/pentium/aors_n.asm
index 01ebfb96ae..30d0df79b0 100644
--- a/gmp/mpn/x86/pentium/aors_n.asm
+++ b/gmp/mpn/x86/pentium/aors_n.asm
@@ -1,32 +1,22 @@
dnl Intel Pentium mpn_add_n/mpn_sub_n -- mpn addition and subtraction.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -88,13 +78,13 @@ deflit(`FRAME',16)
pushl %edx
FRAME_pushl()
movl PARAM_CARRY,%eax
- shrl %eax C shift bit 0 into carry
+ shrl $1,%eax C shift bit 0 into carry
jmp L(oop)
L(endgo):
deflit(`FRAME',16)
movl PARAM_CARRY,%eax
- shrl %eax C shift bit 0 into carry
+ shrl $1,%eax C shift bit 0 into carry
jmp L(end)
EPILOGUE()
diff --git a/gmp/mpn/x86/pentium/aorsmul_1.asm b/gmp/mpn/x86/pentium/aorsmul_1.asm
index d83cc4513b..a50299b5cf 100644
--- a/gmp/mpn/x86/pentium/aorsmul_1.asm
+++ b/gmp/mpn/x86/pentium/aorsmul_1.asm
@@ -2,32 +2,21 @@ dnl Intel Pentium mpn_addmul_1 -- mpn by limb multiplication.
dnl Copyright 1992, 1994, 1996, 1999, 2000, 2002 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 This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/bdiv_q_1.asm b/gmp/mpn/x86/pentium/bdiv_q_1.asm
deleted file mode 100644
index 9fee3cb87a..0000000000
--- a/gmp/mpn/x86/pentium/bdiv_q_1.asm
+++ /dev/null
@@ -1,260 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 divisor
-C odd even
-C P54: 24.5 30.5 cycles/limb
-C P55: 23.0 28.0
-
-MULFUNC_PROLOGUE(mpn_bdiv_q_1 mpn_pi1_bdiv_q_1)
-
-C The P55 speeds noted above, 23 cycles odd or 28 cycles even, are as
-C expected. On P54 in the even case the shrdl pairing nonsense (see
-C mpn/x86/pentium/README) costs 1 cycle, but it's not clear why there's a
-C further 1.5 slowdown for both odd and even.
-
-defframe(PARAM_SHIFT, 24)
-defframe(PARAM_INVERSE,20)
-defframe(PARAM_DIVISOR,16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(VAR_INVERSE,`PARAM_DST')
-
- TEXT
-
- ALIGN(32)
-C mp_limb_t mpn_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_limb_t divisor);
-C
-PROLOGUE(mpn_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl $-1, %ecx
- movl PARAM_DIVISOR, %eax
-
-L(strip_twos):
- ASSERT(nz, `orl %eax, %eax')
- shrl %eax
- incl %ecx C shift count
-
- jnc L(strip_twos)
-
- leal 1(%eax,%eax), %edx C d
- andl $127, %eax C d/2, 7 bits
-
- pushl %ebx FRAME_pushl()
- pushl %ebp FRAME_pushl()
-
-ifdef(`PIC',`
- call L(here)
-L(here):
- popl %ebp C eip
-
- addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %ebp
- C AGI
- movl binvert_limb_table@GOT(%ebp), %ebp
- C AGI
- movzbl (%eax,%ebp), %eax
-',`
-
-dnl non-PIC
- movzbl binvert_limb_table(%eax), %eax C inv 8 bits
-')
-
- movl %eax, %ebp C inv
- addl %eax, %eax C 2*inv
-
- imull %ebp, %ebp C inv*inv
-
- imull %edx, %ebp C inv*inv*d
-
- subl %ebp, %eax C inv = 2*inv - inv*inv*d
- movl PARAM_SIZE, %ebx
-
- movl %eax, %ebp
- addl %eax, %eax C 2*inv
-
- imull %ebp, %ebp C inv*inv
-
- imull %edx, %ebp C inv*inv*d
-
- subl %ebp, %eax C inv = 2*inv - inv*inv*d
- movl %edx, PARAM_DIVISOR C d without twos
-
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
- pushl %eax FRAME_pushl()
- imull PARAM_DIVISOR, %eax
- cmpl $1, %eax
- popl %eax FRAME_popl()')
-
- jmp L(common)
-EPILOGUE()
-
-C mp_limb_t
-C mpn_pi1_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor,
-C mp_limb_t inverse, int shift)
- ALIGN(32)
-PROLOGUE(mpn_pi1_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl PARAM_SHIFT, %ecx
-
- pushl %ebx FRAME_pushl()
- pushl %ebp FRAME_pushl()
-
- movl PARAM_SIZE, %ebx
- movl PARAM_INVERSE, %eax
-
-L(common):
- pushl %esi FRAME_pushl()
- push %edi FRAME_pushl()
-
- movl PARAM_SRC, %esi
- movl PARAM_DST, %edi
- movl %eax, VAR_INVERSE
-
- leal (%esi,%ebx,4), %esi C src end
- leal (%edi,%ebx,4), %edi C dst end
-
- negl %ebx C -size
-
- xorl %ebp, %ebp C initial carry bit
-
- orl %ecx, %ecx C shift
- movl (%esi,%ebx,4), %eax C src low limb
- jz L(odd_entry)
-
- xorl %edx, %edx C initial carry limb (for even, if one)
- incl %ebx
- jz L(one)
-
- movl (%esi,%ebx,4), %edx C src second limb (for even)
- shrdl( %cl, %edx, %eax)
-
- jmp L(even_entry)
-
-
- ALIGN(8)
-L(odd_top):
- C eax scratch
- C ebx counter, limbs, negative
- C ecx
- C edx
- C esi src end
- C edi dst end
- C ebp carry bit, 0 or -1
-
- mull PARAM_DIVISOR
-
- movl (%esi,%ebx,4), %eax
- subl %ebp, %edx
-
- subl %edx, %eax
-
- sbbl %ebp, %ebp
-
-L(odd_entry):
- imull VAR_INVERSE, %eax
-
- movl %eax, (%edi,%ebx,4)
-
- incl %ebx
- jnz L(odd_top)
-
- popl %edi
- popl %esi
-
- popl %ebp
- popl %ebx
-
- ret
-
-L(even_top):
- C eax scratch
- C ebx counter, limbs, negative
- C ecx twos
- C edx
- C esi src end
- C edi dst end
- C ebp carry bit, 0 or -1
-
- mull PARAM_DIVISOR
-
- subl %ebp, %edx C carry bit
- movl -4(%esi,%ebx,4), %eax C src limb
-
- movl (%esi,%ebx,4), %ebp C and one above it
-
- shrdl( %cl, %ebp, %eax)
-
- subl %edx, %eax C carry limb
-
- sbbl %ebp, %ebp
-
-L(even_entry):
- imull VAR_INVERSE, %eax
-
- movl %eax, -4(%edi,%ebx,4)
- incl %ebx
-
- jnz L(even_top)
-
- mull PARAM_DIVISOR
-
- movl -4(%esi), %eax C src high limb
- subl %ebp, %edx
-
-L(one):
- shrl %cl, %eax
-
- subl %edx, %eax C no carry if division is exact
-
- imull VAR_INVERSE, %eax
-
- movl %eax, -4(%edi) C dst high limb
- nop C protect against cache bank clash
-
- popl %edi
- popl %esi
-
- popl %ebp
- popl %ebx
-
- ret
-
-EPILOGUE()
diff --git a/gmp/mpn/x86/pentium/com.asm b/gmp/mpn/x86/pentium/com_n.asm
index b0805452a6..c6d2d72e5e 100644
--- a/gmp/mpn/x86/pentium/com.asm
+++ b/gmp/mpn/x86/pentium/com_n.asm
@@ -1,32 +1,21 @@
-dnl Intel Pentium mpn_com -- mpn ones complement.
+dnl Intel Pentium mpn_com_n -- mpn ones complement.
dnl Copyright 1996, 2001, 2002, 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -37,7 +26,7 @@ C P5: 1.75 cycles/limb
NAILS_SUPPORT(0-31)
-C void mpn_com (mp_ptr dst, mp_srcptr src, mp_size_t size);
+C void mpn_com_n (mp_ptr dst, mp_srcptr src, mp_size_t size);
C
C This code is similar to mpn_copyi, basically there's just some "xorl
C $GMP_NUMB_MASK"s inserted.
@@ -55,7 +44,7 @@ defframe(PARAM_DST, 4)
TEXT
ALIGN(8)
-PROLOGUE(mpn_com)
+PROLOGUE(mpn_com_n)
deflit(`FRAME',0)
movl PARAM_SRC, %eax
diff --git a/gmp/mpn/x86/pentium/copyd.asm b/gmp/mpn/x86/pentium/copyd.asm
index 72a543b2a3..2be8c765ac 100644
--- a/gmp/mpn/x86/pentium/copyd.asm
+++ b/gmp/mpn/x86/pentium/copyd.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium mpn_copyd -- copy limb vector, decrementing.
dnl Copyright 1996, 2001, 2002, 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/copyi.asm b/gmp/mpn/x86/pentium/copyi.asm
index d983d6b46e..9da08e2c06 100644
--- a/gmp/mpn/x86/pentium/copyi.asm
+++ b/gmp/mpn/x86/pentium/copyi.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium mpn_copyi -- copy limb vector, incrementing.
dnl Copyright 1996, 2001, 2002, 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/dive_1.asm b/gmp/mpn/x86/pentium/dive_1.asm
index f80632f479..79885244a5 100644
--- a/gmp/mpn/x86/pentium/dive_1.asm
+++ b/gmp/mpn/x86/pentium/dive_1.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium mpn_divexact_1 -- mpn by limb exact division.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -157,7 +146,7 @@ dnl non-PIC
negl %ebx C -size
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB
pushl %eax FRAME_pushl()
imull PARAM_DIVISOR, %eax
cmpl $1, %eax
diff --git a/gmp/mpn/x86/pentium/gmp-mparam.h b/gmp/mpn/x86/pentium/gmp-mparam.h
index befa6e27a9..5c49c4e3cb 100644
--- a/gmp/mpn/x86/pentium/gmp-mparam.h
+++ b/gmp/mpn/x86/pentium/gmp-mparam.h
@@ -1,36 +1,26 @@
/* Intel P54 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* For mpn/x86/pentium/mod_1.asm */
@@ -41,11 +31,11 @@ see https://www.gnu.org/licenses/. */
/* Generated by tuneup.c, 2004-02-10, gcc 2.95 */
-#define MUL_TOOM22_THRESHOLD 16
-#define MUL_TOOM33_THRESHOLD 90
+#define MUL_KARATSUBA_THRESHOLD 16
+#define MUL_TOOM3_THRESHOLD 90
#define SQR_BASECASE_THRESHOLD 0 /* always */
-#define SQR_TOOM2_THRESHOLD 22
+#define SQR_KARATSUBA_THRESHOLD 22
#define SQR_TOOM3_THRESHOLD 122
#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX /* never */
diff --git a/gmp/mpn/x86/pentium/hamdist.asm b/gmp/mpn/x86/pentium/hamdist.asm
index 2d7bc99b12..a129030f74 100644
--- a/gmp/mpn/x86/pentium/hamdist.asm
+++ b/gmp/mpn/x86/pentium/hamdist.asm
@@ -1,32 +1,21 @@
dnl Intel P5 mpn_hamdist -- mpn hamming distance.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/logops_n.asm b/gmp/mpn/x86/pentium/logops_n.asm
index 18773172e9..0552e55809 100644
--- a/gmp/mpn/x86/pentium/logops_n.asm
+++ b/gmp/mpn/x86/pentium/logops_n.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium mpn_and_n,...,mpn_xnor_n -- bitwise logical operations.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/lshift.asm b/gmp/mpn/x86/pentium/lshift.asm
index 2a31f36c6e..ece51e06d3 100644
--- a/gmp/mpn/x86/pentium/lshift.asm
+++ b/gmp/mpn/x86/pentium/lshift.asm
@@ -1,32 +1,22 @@
dnl Intel Pentium mpn_lshift -- mpn left shift.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mmx/gmp-mparam.h b/gmp/mpn/x86/pentium/mmx/gmp-mparam.h
index 02a0def127..e443c8c300 100644
--- a/gmp/mpn/x86/pentium/mmx/gmp-mparam.h
+++ b/gmp/mpn/x86/pentium/mmx/gmp-mparam.h
@@ -1,37 +1,26 @@
/* Intel P55 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 1999-2002, 2004, 2009, 2010 Free Software
+Copyright 1991, 1993, 1994, 1999, 2000, 2001, 2002, 2004, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 32
-#define GMP_LIMB_BYTES 4
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
/* For mpn/x86/pentium/mod_1.asm */
@@ -40,124 +29,45 @@ see https://www.gnu.org/licenses/. */
/* 233MHz P55 */
-#define MOD_1_NORM_THRESHOLD 5
-#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1N_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX /* never */
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 12
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 0
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 11
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 63
-#define USE_PREINV_DIVREM_1 0
-#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
-#define BMOD_1_TO_MOD_1_THRESHOLD 51
-
-#define MUL_TOOM22_THRESHOLD 16
-#define MUL_TOOM33_THRESHOLD 53
-#define MUL_TOOM44_THRESHOLD 128
-#define MUL_TOOM6H_THRESHOLD 189
-#define MUL_TOOM8H_THRESHOLD 260
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 89
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 91
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 90
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 88
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 20
-#define SQR_TOOM3_THRESHOLD 73
-#define SQR_TOOM4_THRESHOLD 178
-#define SQR_TOOM6_THRESHOLD 210
-#define SQR_TOOM8_THRESHOLD 375
-
-#define MULMOD_BNM1_THRESHOLD 11
-#define SQRMOD_BNM1_THRESHOLD 12
-
-#define MUL_FFT_MODF_THRESHOLD 364 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 364, 5}, { 15, 6}, { 8, 5}, { 17, 6}, \
- { 9, 5}, { 19, 6}, { 17, 7}, { 9, 6}, \
- { 21, 7}, { 11, 6}, { 23, 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}, \
- { 31, 7}, { 63, 8}, { 39, 9}, { 23, 8}, \
- { 47,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, 9}, { 167,10}, \
- { 95, 9}, { 191, 8}, { 383,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 143, 9}, { 287,10}, \
- { 159, 9}, { 319,11}, { 95,10}, { 191, 9}, \
- { 383,12}, { 63,11}, { 127,10}, { 271, 9}, \
- { 543,10}, { 287,11}, { 159,10}, { 351,11}, \
- { 191,10}, { 415,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 287,10}, { 575,11}, \
- { 351,12}, { 191,11}, { 415,13}, { 127,12}, \
- { 255,11}, { 575,12}, { 319,11}, { 703,12}, \
- { 383,11}, { 831,12}, { 447,13}, { 8192,14}, \
- { 16384,15}, { 32768,16} }
-#define MUL_FFT_TABLE3_SIZE 90
-#define MUL_FFT_THRESHOLD 3520
-
-#define SQR_FFT_MODF_THRESHOLD 340 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 340, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 17, 7}, { 9, 6}, { 21, 7}, { 11, 6}, \
- { 23, 7}, { 15, 6}, { 31, 7}, { 21, 8}, \
- { 11, 7}, { 29, 8}, { 15, 7}, { 33, 8}, \
- { 19, 7}, { 39, 8}, { 27, 7}, { 55, 9}, \
- { 15, 8}, { 31, 7}, { 65, 8}, { 43, 9}, \
- { 23, 8}, { 47,10}, { 15, 9}, { 31, 8}, \
- { 67, 9}, { 39, 8}, { 83, 9}, { 47, 8}, \
- { 95,10}, { 31, 9}, { 63, 8}, { 127, 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,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,10}, { 207,12}, \
- { 63,11}, { 127,10}, { 271, 9}, { 543,10}, \
- { 287, 9}, { 575,10}, { 303,11}, { 159,10}, \
- { 351,11}, { 191,10}, { 415,11}, { 223,10}, \
- { 447,12}, { 127,11}, { 255,10}, { 543,11}, \
- { 287,10}, { 607,11}, { 351,12}, { 191,11}, \
- { 479,13}, { 127,12}, { 255,11}, { 575,12}, \
- { 319,11}, { 703,12}, { 383,11}, { 767,12}, \
- { 447,13}, { 8192,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 96
-#define SQR_FFT_THRESHOLD 5504
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 48
-#define MULLO_MUL_N_THRESHOLD 6633
-
-#define DC_DIV_QR_THRESHOLD 43
-#define DC_DIVAPPR_Q_THRESHOLD 170
-#define DC_BDIV_QR_THRESHOLD 43
-#define DC_BDIV_Q_THRESHOLD 110
-
-#define INV_MULMOD_BNM1_THRESHOLD 30
-#define INV_NEWTON_THRESHOLD 177
-#define INV_APPR_THRESHOLD 171
-
-#define BINV_NEWTON_THRESHOLD 194
-#define REDC_1_TO_REDC_N_THRESHOLD 50
-
-#define MU_DIV_QR_THRESHOLD 1142
-#define MU_DIVAPPR_Q_THRESHOLD 1142
-#define MUPI_DIV_QR_THRESHOLD 90
-#define MU_BDIV_QR_THRESHOLD 942
-#define MU_BDIV_Q_THRESHOLD 1017
-
-#define MATRIX22_STRASSEN_THRESHOLD 13
-#define HGCD_THRESHOLD 92
-#define GCD_DC_THRESHOLD 283
-#define GCDEXT_DC_THRESHOLD 221
-#define JACOBI_BASE_METHOD 2
-
-#define GET_STR_DC_THRESHOLD 18
-#define GET_STR_PRECOMPUTE_THRESHOLD 31
-#define SET_STR_DC_THRESHOLD 490
-#define SET_STR_PRECOMPUTE_THRESHOLD 994
+/* Generated by tuneup.c, 2009-01-06, gcc 3.4 */
+
+#define MUL_KARATSUBA_THRESHOLD 16
+#define MUL_TOOM3_THRESHOLD 89
+#define MUL_TOOM44_THRESHOLD 131
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 22
+#define SQR_TOOM3_THRESHOLD 77
+#define SQR_TOOM4_THRESHOLD 168
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 40
+#define MULLOW_MUL_N_THRESHOLD 266
+
+#define DIV_SB_PREINV_THRESHOLD 4
+#define DIV_DC_THRESHOLD 43
+#define POWM_THRESHOLD 64
+
+#define MATRIX22_STRASSEN_THRESHOLD 13
+#define HGCD_THRESHOLD 95
+#define GCD_DC_THRESHOLD 316
+#define GCDEXT_DC_THRESHOLD 316
+#define JACOBI_BASE_METHOD 2
+
+#define USE_PREINV_DIVREM_1 0
+#define USE_PREINV_MOD_1 1 /* native */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 17
+#define GET_STR_PRECOMPUTE_THRESHOLD 27
+#define SET_STR_DC_THRESHOLD 527
+#define SET_STR_PRECOMPUTE_THRESHOLD 1069
+
+#define MUL_FFT_TABLE { 304, 672, 1152, 3584, 10240, 40960, 0 }
+#define MUL_FFT_MODF_THRESHOLD 320
+#define MUL_FFT_THRESHOLD 3840
+
+#define SQR_FFT_TABLE { 304, 672, 1152, 4608, 10240, 24576, 0 }
+#define SQR_FFT_MODF_THRESHOLD 320
+#define SQR_FFT_THRESHOLD 3840
diff --git a/gmp/mpn/x86/pentium/mmx/hamdist.asm b/gmp/mpn/x86/pentium/mmx/hamdist.asm
index 72e3196697..185eeaee22 100644
--- a/gmp/mpn/x86/pentium/mmx/hamdist.asm
+++ b/gmp/mpn/x86/pentium/mmx/hamdist.asm
@@ -1,32 +1,21 @@
dnl Intel P55 mpn_hamdist -- mpn hamming distance.
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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mmx/lshift.asm b/gmp/mpn/x86/pentium/mmx/lshift.asm
index 04b0ddcc8f..012d794952 100644
--- a/gmp/mpn/x86/pentium/mmx/lshift.asm
+++ b/gmp/mpn/x86/pentium/mmx/lshift.asm
@@ -1,32 +1,21 @@
dnl Intel P5 mpn_lshift -- mpn left shift.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mmx/mul_1.asm b/gmp/mpn/x86/pentium/mmx/mul_1.asm
index 4ced577b13..b9fe77ed07 100644
--- a/gmp/mpn/x86/pentium/mmx/mul_1.asm
+++ b/gmp/mpn/x86/pentium/mmx/mul_1.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium MMX mpn_mul_1 -- mpn by limb multiplication.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mmx/rshift.asm b/gmp/mpn/x86/pentium/mmx/rshift.asm
index e3b274bb63..f50b8ab0e0 100644
--- a/gmp/mpn/x86/pentium/mmx/rshift.asm
+++ b/gmp/mpn/x86/pentium/mmx/rshift.asm
@@ -1,32 +1,21 @@
dnl Intel P5 mpn_rshift -- mpn right shift.
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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mod_1.asm b/gmp/mpn/x86/pentium/mod_1.asm
new file mode 100644
index 0000000000..408242e7a9
--- /dev/null
+++ b/gmp/mpn/x86/pentium/mod_1.asm
@@ -0,0 +1,454 @@
+dnl Intel P5 mpn_mod_1 -- mpn by limb remainder.
+
+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
+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 P5: 28.0 cycles/limb
+
+
+C mp_limb_t mpn_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor);
+C mp_limb_t mpn_mod_1c (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t carry);
+C mp_limb_t mpn_preinv_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t inverse);
+C
+C This code is not unlike mpn/x86/p6/mod_1.asm, it does the same sort of
+C multiply by inverse without on-the-fly shifts. See that code for some
+C general comments.
+C
+C Alternatives:
+C
+C P5 shldl is 4 cycles, so shifting on the fly would be at least 5 cycles
+C slower, probably more depending what it did to register usage. Using MMX
+C on P55 would be better, but still at least 4 or 5 instructions and so 2 or
+C 3 cycles.
+
+
+dnl These thresholds are the sizes where the multiply by inverse method is
+dnl used, rather than plain "divl"s. Minimum value 2.
+dnl
+dnl MUL_NORM_THRESHOLD is for an already normalized divisor (high bit set),
+dnl MUL_UNNORM_THRESHOLD for an unnormalized divisor.
+dnl
+dnl With the divl loop at 44 c/l and the inverse at 28 c/l with about 70
+dnl cycles to setup, the threshold should be about ceil(70/16)==5, which is
+dnl what happens in practice.
+dnl
+dnl An unnormalized divisor gets an extra 40 cycles at the end for the
+dnl final (r*2^n)%(d*2^n) and shift. This increases the threshold by about
+dnl 40/16=3.
+dnl
+dnl PIC adds between 4 and 7 cycles (not sure why it varies), but this
+dnl doesn't change the thresholds.
+dnl
+dnl The entry sequence code that chooses between MUL_NORM_THRESHOLD and
+dnl MUL_UNNORM_THRESHOLD is a bit horrible, but it adds only 2 cycles
+dnl (branch free) and ensures the choice between div or mul is optimal.
+
+deflit(MUL_NORM_THRESHOLD, ifdef(`PIC',5,5))
+deflit(MUL_UNNORM_THRESHOLD, ifdef(`PIC',8,8))
+
+deflit(MUL_NORM_DELTA, eval(MUL_NORM_THRESHOLD - MUL_UNNORM_THRESHOLD))
+
+
+defframe(PARAM_INVERSE, 16) dnl mpn_preinv_mod_1
+defframe(PARAM_CARRY, 16) dnl mpn_mod_1c
+defframe(PARAM_DIVISOR, 12)
+defframe(PARAM_SIZE, 8)
+defframe(PARAM_SRC, 4)
+
+dnl re-using parameter space
+define(VAR_NORM, `PARAM_DIVISOR')
+define(VAR_INVERSE, `PARAM_SIZE')
+
+ TEXT
+
+ ALIGN(8)
+PROLOGUE(mpn_preinv_mod_1)
+deflit(`FRAME',0)
+
+ pushl %ebp FRAME_pushl()
+ pushl %esi FRAME_pushl()
+
+ movl PARAM_SRC, %esi
+ movl PARAM_SIZE, %edx
+
+ pushl %edi FRAME_pushl()
+ pushl %ebx FRAME_pushl()
+
+ movl PARAM_DIVISOR, %ebp
+ movl PARAM_INVERSE, %eax
+
+ movl -4(%esi,%edx,4), %edi C src high limb
+ leal -8(%esi,%edx,4), %esi C &src[size-2]
+
+ movl $0, VAR_NORM
+ decl %edx
+
+ jnz L(start_preinv)
+
+ subl %ebp, %edi C src-divisor
+ popl %ebx
+
+ sbbl %ecx, %ecx C -1 if underflow
+ movl %edi, %eax C src-divisor
+
+ andl %ebp, %ecx C d if underflow
+ popl %edi
+
+ addl %ecx, %eax C remainder, with possible addback
+ popl %esi
+
+ popl %ebp
+
+ ret
+
+EPILOGUE()
+
+
+ ALIGN(8)
+PROLOGUE(mpn_mod_1c)
+deflit(`FRAME',0)
+
+ movl PARAM_DIVISOR, %eax
+ movl PARAM_SIZE, %ecx
+
+ sarl $31, %eax C d highbit
+ movl PARAM_CARRY, %edx
+
+ orl %ecx, %ecx
+ jz L(done_edx) C result==carry if size==0
+
+ andl $MUL_NORM_DELTA, %eax
+ pushl %ebp FRAME_pushl()
+
+ addl $MUL_UNNORM_THRESHOLD, %eax C norm or unnorm thresh
+ pushl %esi FRAME_pushl()
+
+ movl PARAM_SRC, %esi
+ movl PARAM_DIVISOR, %ebp
+
+ cmpl %eax, %ecx
+ jb L(divide_top)
+
+ movl %edx, %eax C carry as pretend src high limb
+ leal 1(%ecx), %edx C size+1
+
+ cmpl $0x1000000, %ebp
+ jmp L(mul_by_inverse_1c)
+
+EPILOGUE()
+
+
+ ALIGN(8)
+PROLOGUE(mpn_mod_1)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ pushl %ebp FRAME_pushl()
+
+ orl %ecx, %ecx
+ jz L(done_zero)
+
+ movl PARAM_SRC, %eax
+ movl PARAM_DIVISOR, %ebp
+
+ sarl $31, %ebp C -1 if divisor normalized
+ movl -4(%eax,%ecx,4), %eax C src high limb
+
+ movl PARAM_DIVISOR, %edx
+ pushl %esi FRAME_pushl()
+
+ andl $MUL_NORM_DELTA, %ebp
+ cmpl %edx, %eax C carry flag if high<divisor
+
+ sbbl %edx, %edx C -1 if high<divisor
+ addl $MUL_UNNORM_THRESHOLD, %ebp C norm or unnorm thresh
+
+ addl %edx, %ecx C size-1 if high<divisor
+ jz L(done_eax)
+
+ cmpl %ebp, %ecx
+ movl PARAM_DIVISOR, %ebp
+
+ movl PARAM_SRC, %esi
+ jae L(mul_by_inverse)
+
+ andl %eax, %edx C high as initial carry if high<divisor
+
+
+L(divide_top):
+ C eax scratch (quotient)
+ C ebx
+ C ecx counter, limbs, decrementing
+ C edx scratch (remainder)
+ C esi src
+ C edi
+ C ebp divisor
+
+ movl -4(%esi,%ecx,4), %eax
+
+ divl %ebp
+
+ decl %ecx
+ jnz L(divide_top)
+
+
+ popl %esi
+ popl %ebp
+
+L(done_edx):
+ movl %edx, %eax
+
+ ret
+
+
+L(done_zero):
+ xorl %eax, %eax
+ popl %ebp
+
+ ret
+
+
+C -----------------------------------------------------------------------------
+C
+C The divisor is normalized using the same code as the pentium
+C count_leading_zeros in longlong.h. Going through the GOT for PIC costs a
+C couple of cycles, but is more or less unavoidable.
+
+
+ ALIGN(8)
+L(mul_by_inverse):
+ C eax src high limb
+ C ebx
+ C ecx size or size-1
+ C edx
+ C esi src
+ C edi
+ C ebp divisor
+
+ movl PARAM_SIZE, %edx
+ cmpl $0x1000000, %ebp
+
+L(mul_by_inverse_1c):
+ sbbl %ecx, %ecx
+ cmpl $0x10000, %ebp
+
+ sbbl $0, %ecx
+ cmpl $0x100, %ebp
+
+ sbbl $0, %ecx
+ pushl %edi FRAME_pushl()
+
+ pushl %ebx FRAME_pushl()
+ movl %ebp, %ebx C d
+
+ifdef(`PIC',`
+ call L(here)
+L(here):
+ popl %edi
+ leal 25(,%ecx,8), %ecx C 0,-1,-2,-3 -> 25,17,9,1
+
+ shrl %cl, %ebx
+ addl $_GLOBAL_OFFSET_TABLE_+[.-L(here)], %edi
+
+ C AGI
+ movl __clz_tab@GOT(%edi), %edi
+ addl $-34, %ecx
+
+ C AGI
+ movb (%ebx,%edi), %bl
+
+',`
+ leal 25(,%ecx,8), %ecx C 0,-1,-2,-3 -> 25,17,9,1
+
+ shrl %cl, %ebx
+ addl $-34, %ecx
+
+ C AGI
+ movb __clz_tab(%ebx), %bl
+')
+ movl %eax, %edi C carry -> n1
+
+ addl %ebx, %ecx C -34 + c + __clz_tab[d>>c] = -clz-1
+ leal -8(%esi,%edx,4), %esi C &src[size-2]
+
+ xorl $-1, %ecx C clz
+ movl $-1, %edx
+
+ ASSERT(e,`pushl %eax C clz calculation same as bsrl
+ bsrl %ebp, %eax
+ xorl $31, %eax
+ cmpl %eax, %ecx
+ popl %eax')
+
+ shll %cl, %ebp C d normalized
+ movl %ecx, VAR_NORM
+
+ subl %ebp, %edx C (b-d)-1, so edx:eax = b*(b-d)-1
+ movl $-1, %eax
+
+ divl %ebp C floor (b*(b-d)-1) / d
+
+L(start_preinv):
+ movl %eax, VAR_INVERSE
+ movl %ebp, %eax C d
+
+ movl %ecx, %edx C fake high, will cancel
+
+
+C For mpn_mod_1 and mpn_preinv_mod_1, the initial carry in %edi is the src
+C high limb, and this may be greater than the divisor and may need one copy
+C of the divisor subtracted (only one, because the divisor is normalized).
+C This is accomplished by having the initial ecx:edi act as a fake previous
+C n2:n10. The initial edx:eax is d, acting as a fake (q1+1)*d which is
+C subtracted from ecx:edi, with the usual addback if it produces an
+C underflow.
+
+
+L(inverse_top):
+ C eax scratch (n10, n1, q1, etc)
+ C ebx scratch (nadj, src limit)
+ C ecx old n2
+ C edx scratch
+ C esi src pointer, &src[size-2] to &src[0]
+ C edi old n10
+ C ebp d
+
+ subl %eax, %edi C low n - (q1+1)*d
+ movl (%esi), %eax C new n10
+
+ sbbl %edx, %ecx C high n - (q1+1)*d, 0 or -1
+ movl %ebp, %ebx C d
+
+ sarl $31, %eax C -n1
+ andl %ebp, %ecx C d if underflow
+
+ addl %edi, %ecx C remainder -> n2, and possible addback
+ ASSERT(b,`cmpl %ebp, %ecx')
+ andl %eax, %ebx C -n1 & d
+
+ movl (%esi), %edi C n10
+ andl $1, %eax C n1
+
+ addl %ecx, %eax C n2+n1
+ addl %edi, %ebx C nadj = n10 + (-n1 & d), ignoring overflow
+
+ mull VAR_INVERSE C m*(n2+n1)
+
+ addl %eax, %ebx C low(m*(n2+n1) + nadj), giving carry flag
+ leal 1(%ecx), %eax C 1+n2
+
+ adcl %edx, %eax C 1 + high[n2<<32 + m*(n2+n1) + nadj] = q1+1
+ movl PARAM_SRC, %ebx
+
+ sbbl $0, %eax C use q1 if q1+1 overflows
+ subl $4, %esi C step src ptr
+
+ mull %ebp C (q1+1)*d
+
+ cmpl %ebx, %esi
+ jae L(inverse_top)
+
+
+
+ C %edi (after subtract and addback) is the remainder modulo d*2^n
+ C and must be reduced to 0<=r<d by calculating r*2^n mod d*2^n and
+ C right shifting by n.
+ C
+ C If d was already normalized on entry so that n==0 then nothing is
+ C needed here. This is always the case for preinv_mod_1. For mod_1
+ C or mod_1c the chance of n==0 is low, but about 40 cycles can be
+ C saved.
+
+ subl %eax, %edi C low n - (q1+1)*d
+ movl %ecx, %ebx C n2
+
+ sbbl %edx, %ebx C high n - (q1+1)*d, 0 or -1
+ xorl %esi, %esi C next n2
+
+ andl %ebp, %ebx C d if underflow
+ movl VAR_NORM, %ecx
+
+ addl %ebx, %edi C remainder, with possible addback
+ orl %ecx, %ecx
+
+ jz L(done_mul_edi)
+
+
+ C Here using %esi=n2 and %edi=n10, unlike the above
+
+ shldl( %cl, %edi, %esi) C n2
+
+ shll %cl, %edi C n10
+
+ movl %edi, %eax C n10
+ movl %edi, %ebx C n10
+
+ sarl $31, %ebx C -n1
+
+ shrl $31, %eax C n1
+ andl %ebp, %ebx C -n1 & d
+
+ addl %esi, %eax C n2+n1
+ addl %edi, %ebx C nadj = n10 + (-n1 & d), ignoring overflow
+
+ mull VAR_INVERSE C m*(n2+n1)
+
+ addl %eax, %ebx C m*(n2+n1) + nadj, low giving carry flag
+ leal 1(%esi), %eax C 1+n2
+
+ adcl %edx, %eax C 1 + high(n2<<32 + m*(n2+n1) + nadj) = q1+1
+
+ sbbl $0, %eax C use q1 if q1+1 overflows
+
+ mull %ebp C (q1+1)*d
+
+ subl %eax, %edi C low n - (q1+1)*d
+ popl %ebx
+
+ sbbl %edx, %esi C high n - (q1+1)*d, 0 or -1
+ movl %edi, %eax
+
+ andl %ebp, %esi C d if underflow
+ popl %edi
+
+ addl %esi, %eax C addback if underflow
+ popl %esi
+
+ shrl %cl, %eax C denorm remainder
+ popl %ebp
+
+ ret
+
+
+L(done_mul_edi):
+ movl %edi, %eax
+ popl %ebx
+
+ popl %edi
+L(done_eax):
+ popl %esi
+
+ popl %ebp
+
+ ret
+
+EPILOGUE()
diff --git a/gmp/mpn/x86/pentium/mod_34lsub1.asm b/gmp/mpn/x86/pentium/mod_34lsub1.asm
index 2d88223b84..201081a437 100644
--- a/gmp/mpn/x86/pentium/mod_34lsub1.asm
+++ b/gmp/mpn/x86/pentium/mod_34lsub1.asm
@@ -1,32 +1,21 @@
dnl Intel P5 mpn_mod_34lsub1 -- mpn remainder modulo 2**24-1.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mode1o.asm b/gmp/mpn/x86/pentium/mode1o.asm
index eb2790e1a0..222f64e5cb 100644
--- a/gmp/mpn/x86/pentium/mode1o.asm
+++ b/gmp/mpn/x86/pentium/mode1o.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium mpn_modexact_1_odd -- exact division style remainder.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -133,7 +122,7 @@ dnl non-PIC
subl %eax, %ecx C inv = 2*inv - inv*inv*d
pushl %esi FRAME_pushl()
- ASSERT(e,` C d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C d*inv == 1 mod 2^BITS_PER_MP_LIMB
movl %ecx, %eax
imull PARAM_DIVISOR, %eax
cmpl $1, %eax')
diff --git a/gmp/mpn/x86/pentium/mul_1.asm b/gmp/mpn/x86/pentium/mul_1.asm
index a0858af2b4..c6b255c322 100644
--- a/gmp/mpn/x86/pentium/mul_1.asm
+++ b/gmp/mpn/x86/pentium/mul_1.asm
@@ -2,32 +2,21 @@ dnl Intel Pentium mpn_mul_1 -- mpn by limb multiplication.
dnl Copyright 1992, 1994, 1996, 1999, 2000, 2002 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 This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mul_2.asm b/gmp/mpn/x86/pentium/mul_2.asm
index 4c7beb5df2..36a025c425 100644
--- a/gmp/mpn/x86/pentium/mul_2.asm
+++ b/gmp/mpn/x86/pentium/mul_2.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium mpn_mul_2 -- mpn by 2-limb multiplication.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/mul_basecase.asm b/gmp/mpn/x86/pentium/mul_basecase.asm
index 50e15d3567..fd24fdf7fa 100644
--- a/gmp/mpn/x86/pentium/mul_basecase.asm
+++ b/gmp/mpn/x86/pentium/mul_basecase.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium mpn_mul_basecase -- mpn by mpn multiplication.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1996, 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/popcount.asm b/gmp/mpn/x86/pentium/popcount.asm
index b8d84ad2e2..df53bb8842 100644
--- a/gmp/mpn/x86/pentium/popcount.asm
+++ b/gmp/mpn/x86/pentium/popcount.asm
@@ -1,32 +1,21 @@
dnl Intel P5 mpn_popcount -- mpn bit population count.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/rshift.asm b/gmp/mpn/x86/pentium/rshift.asm
index 2105c4c935..949b0d2e2f 100644
--- a/gmp/mpn/x86/pentium/rshift.asm
+++ b/gmp/mpn/x86/pentium/rshift.asm
@@ -1,32 +1,22 @@
dnl Intel Pentium mpn_rshift -- mpn right shift.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1995, 1996, 1999, 2000, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium/sqr_basecase.asm b/gmp/mpn/x86/pentium/sqr_basecase.asm
index b11d767da2..e4fca7c546 100644
--- a/gmp/mpn/x86/pentium/sqr_basecase.asm
+++ b/gmp/mpn/x86/pentium/sqr_basecase.asm
@@ -1,32 +1,21 @@
dnl Intel P5 mpn_sqr_basecase -- square an mpn number.
-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 either:
+dnl Copyright 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/README b/gmp/mpn/x86/pentium4/README
index 90f752e5d5..8dc0479f04 100644
--- a/gmp/mpn/x86/pentium4/README
+++ b/gmp/mpn/x86/pentium4/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/x86/pentium4/copyd.asm b/gmp/mpn/x86/pentium4/copyd.asm
index 82af81c522..491ad60128 100644
--- a/gmp/mpn/x86/pentium4/copyd.asm
+++ b/gmp/mpn/x86/pentium4/copyd.asm
@@ -1,32 +1,22 @@
dnl Pentium-4 mpn_copyd -- copy limb vector, decrementing.
-
-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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+
+dnl Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a 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 std/rep/movsl/cld is very slow for small blocks on pentium4. Its
diff --git a/gmp/mpn/x86/pentium4/copyi.asm b/gmp/mpn/x86/pentium4/copyi.asm
index b6148879fa..bf812c822b 100644
--- a/gmp/mpn/x86/pentium4/copyi.asm
+++ b/gmp/mpn/x86/pentium4/copyi.asm
@@ -1,32 +1,22 @@
dnl Pentium-4 mpn_copyi -- copy limb vector, incrementing.
-
-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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+
+dnl Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a 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 rep/movsl is very slow for small blocks on pentium4. Its startup
diff --git a/gmp/mpn/x86/pentium4/mmx/lshift.asm b/gmp/mpn/x86/pentium4/mmx/lshift.asm
index b5eca66698..5d316d5da4 100644
--- a/gmp/mpn/x86/pentium4/mmx/lshift.asm
+++ b/gmp/mpn/x86/pentium4/mmx/lshift.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-4 mpn_lshift -- left shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/mmx/popham.asm b/gmp/mpn/x86/pentium4/mmx/popham.asm
index 9563cb57e4..2e79816821 100644
--- a/gmp/mpn/x86/pentium4/mmx/popham.asm
+++ b/gmp/mpn/x86/pentium4/mmx/popham.asm
@@ -1,33 +1,22 @@
dnl Intel Pentium 4 mpn_popcount, mpn_hamdist -- population count and
dnl hamming distance.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2007 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/mmx/rshift.asm b/gmp/mpn/x86/pentium4/mmx/rshift.asm
index 3ac0094a5a..a7dec54a3a 100644
--- a/gmp/mpn/x86/pentium4/mmx/rshift.asm
+++ b/gmp/mpn/x86/pentium4/mmx/rshift.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-4 mpn_rshift -- right shift.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/sse2/add_n.asm b/gmp/mpn/x86/pentium4/sse2/add_n.asm
index 8e2380e493..04c0c68d0e 100644
--- a/gmp/mpn/x86/pentium4/sse2/add_n.asm
+++ b/gmp/mpn/x86/pentium4/sse2/add_n.asm
@@ -1,44 +1,36 @@
dnl Intel Pentium-4 mpn_add_n -- mpn addition.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 dst!=src1,2 dst==src1 dst==src2
-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) 4 6 6
-C P4 model 3-4 (Prescott) 4.25 7.5 7.5
+C P4 Willamette, Northwood: 4.0 cycles/limb if dst!=src1 and dst!=src2
+C 6.0 cycles/limb if dst==src1 or dst==src2
+C P4 Prescott: >= 5 cycles/limb
+
+C mp_limb_t mpn_add_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
+C mp_size_t size);
+C mp_limb_t mpn_add_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
+C mp_size_t size, mp_limb_t carry);
+C
+C The 4 c/l achieved here isn't particularly good, but is better than 9 c/l
+C for a basic adc loop.
defframe(PARAM_CARRY,20)
defframe(PARAM_SIZE, 16)
@@ -54,25 +46,29 @@ define(SAVE_EBX,`PARAM_SRC1')
PROLOGUE(mpn_add_nc)
deflit(`FRAME',0)
+
movd PARAM_CARRY, %mm0
jmp L(start_nc)
+
EPILOGUE()
ALIGN(8)
PROLOGUE(mpn_add_n)
deflit(`FRAME',0)
+
pxor %mm0, %mm0
+
L(start_nc):
- mov PARAM_SRC1, %eax
- mov %ebx, SAVE_EBX
- mov PARAM_SRC2, %ebx
- mov PARAM_DST, %edx
- mov PARAM_SIZE, %ecx
+ movl PARAM_SRC1, %eax
+ movl %ebx, SAVE_EBX
+ movl PARAM_SRC2, %ebx
+ movl PARAM_DST, %edx
+ movl 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
+ leal (%eax,%ecx,4), %eax C src1 end
+ leal (%ebx,%ecx,4), %ebx C src2 end
+ leal (%edx,%ecx,4), %edx C dst end
+ negl %ecx C -size
L(top):
C eax src1 end
@@ -90,11 +86,12 @@ L(top):
psrlq $32, %mm0
- add $1, %ecx
+ addl $1, %ecx
jnz L(top)
+
movd %mm0, %eax
- mov SAVE_EBX, %ebx
+ movl SAVE_EBX, %ebx
emms
ret
diff --git a/gmp/mpn/x86/pentium4/sse2/addlsh1_n.asm b/gmp/mpn/x86/pentium4/sse2/addlsh1_n.asm
index 93b63b2018..46b0903c50 100644
--- a/gmp/mpn/x86/pentium4/sse2/addlsh1_n.asm
+++ b/gmp/mpn/x86/pentium4/sse2/addlsh1_n.asm
@@ -1,45 +1,33 @@
dnl Intel Pentium-4 mpn_addlsh1_n -- mpn x+2*y.
-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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
+dnl Copyright 2001, 2002, 2003, 2004, 2006 Free Software Foundation, Inc.
dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 dst!=src1,2 dst==src1 dst==src2
-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) 4.25 6 6
-C P4 model 3-4 (Prescott) 5 8.5 8.5
+C cycles/limb (approx)
+C dst!=src1,2 dst==src1 dst==src2
+C P4 m2: 4.5 ?7.25 ?6.75
+C P4 m3: 5.3 ? ?
+C mp_limb_t mpn_addlsh1_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
+C mp_size_t size);
+C
C The slightly strange combination of indexing and pointer incrementing
C that's used seems to work best. Not sure why, but %ecx,4 with src1 and/or
C src2 is a slowdown.
@@ -63,18 +51,18 @@ define(SAVE_EBX,`PARAM_SRC1')
PROLOGUE(mpn_addlsh1_n)
deflit(`FRAME',0)
- mov PARAM_SRC1, %eax
- mov %ebx, SAVE_EBX
+ movl PARAM_SRC1, %eax
+ movl %ebx, SAVE_EBX
- mov PARAM_SRC2, %ebx
+ movl PARAM_SRC2, %ebx
pxor %mm0, %mm0 C initial carry
- mov PARAM_DST, %edx
+ movl PARAM_DST, %edx
- mov PARAM_SIZE, %ecx
+ movl PARAM_SIZE, %ecx
- lea (%edx,%ecx,4), %edx C dst end
- neg %ecx C -size
+ leal (%edx,%ecx,4), %edx C dst end
+ negl %ecx C -size
L(top):
C eax src1 end
@@ -83,24 +71,24 @@ L(top):
C edx dst end
C mm0 carry
- movd (%ebx), %mm2
movd (%eax), %mm1
+ movd (%ebx), %mm2
psrlq $32, %mm0
- lea 4(%eax), %eax
- lea 4(%ebx), %ebx
+ leal 4(%eax), %eax
+ leal 4(%ebx), %ebx
- psllq $1, %mm2
+ paddq %mm2, %mm1
paddq %mm2, %mm1
paddq %mm1, %mm0
movd %mm0, (%edx,%ecx,4)
- add $1, %ecx
+ addl $1, %ecx
jnz L(top)
psrlq $32, %mm0
- mov SAVE_EBX, %ebx
+ movl SAVE_EBX, %ebx
movd %mm0, %eax
emms
ret
diff --git a/gmp/mpn/x86/pentium4/sse2/addmul_1.asm b/gmp/mpn/x86/pentium4/sse2/addmul_1.asm
index 78102072bf..3a8d0bb9bd 100644
--- a/gmp/mpn/x86/pentium4/sse2/addmul_1.asm
+++ b/gmp/mpn/x86/pentium4/sse2/addmul_1.asm
@@ -1,48 +1,37 @@
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 Copyright 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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 P6 model 0-8,10-12 -
-C P6 model 9 (Banias) 5.24
-C P6 model 13 (Dothan) 5.24
-C P4 model 0-1 (Willamette) 5
-C P4 model 2 (Northwood) 5
-C P4 model 3-4 (Prescott) 5
-
C TODO:
C * Tweak eax/edx offsets in loop as to save some lea's
C * Perhaps software pipeline small-case code
+C cycles/limb
+C P6 model 0-8,10-12) -
+C P6 model 9 (Banias) ?
+C P6 model 13 (Dothan) 5.24
+C P4 model 0-1 (Willamette): 5
+C P4 model 2 (Northwood): 5
+C P4 model 3-4 (Prescott): 5
+
C INPUT PARAMETERS
C rp sp + 4
C up sp + 8
@@ -51,13 +40,22 @@ C v0 sp + 16
TEXT
ALIGN(16)
+PROLOGUE(mpn_addmul_1c)
+ mov 4(%esp), %edx
+ mov 8(%esp), %eax
+ mov 12(%esp), %ecx
+ movd 16(%esp), %mm7
+ movd 20(%esp), %mm6
+ jmp L(ent)
+EPILOGUE()
+ ALIGN(16)
PROLOGUE(mpn_addmul_1)
- pxor %mm6, %mm6
-L(ent): mov 4(%esp), %edx
+ mov 4(%esp), %edx
mov 8(%esp), %eax
mov 12(%esp), %ecx
movd 16(%esp), %mm7
- cmp $4, %ecx
+ pxor %mm6, %mm6
+L(ent): cmp $4, %ecx
jnc L(big)
L(lp0): movd (%eax), %mm0
@@ -183,7 +181,3 @@ L(end): pmuludq %mm7, %mm2
emms
ret
EPILOGUE()
-PROLOGUE(mpn_addmul_1c)
- movd 20(%esp), %mm6
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86/pentium4/sse2/bdiv_dbm1c.asm b/gmp/mpn/x86/pentium4/sse2/bdiv_dbm1c.asm
deleted file mode 100644
index 354300e4de..0000000000
--- a/gmp/mpn/x86/pentium4/sse2/bdiv_dbm1c.asm
+++ /dev/null
@@ -1,141 +0,0 @@
-dnl Intel Atom mpn_bdiv_dbm1.
-
-dnl Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-
-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 cycles/limb
-C P5 -
-C P6 model 0-8,10-12 -
-C P6 model 9 (Banias) 9.75
-C P6 model 13 (Dothan)
-C P4 model 0 (Willamette)
-C P4 model 1 (?)
-C P4 model 2 (Northwood) 8.25
-C P4 model 3 (Prescott)
-C P4 model 4 (Nocona)
-C Intel Atom 8
-C AMD K6 -
-C AMD K7 -
-C AMD K8
-C AMD K10
-
-C TODO: This code was optimised for atom-32, consider moving it back to atom
-C dir(atom currently grabs this code), and write a 4-way version(7c/l).
-
-defframe(PARAM_CARRY,20)
-defframe(PARAM_MUL, 16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
-dnl re-use parameter space
-define(SAVE_RP,`PARAM_MUL')
-define(SAVE_UP,`PARAM_SIZE')
-
-define(`rp', `%edi')
-define(`up', `%esi')
-define(`n', `%ecx')
-define(`reg', `%edx')
-define(`cy', `%eax') C contains the return value
-
-ASM_START()
- TEXT
- ALIGN(16)
-deflit(`FRAME',0)
-
-PROLOGUE(mpn_bdiv_dbm1c)
- mov PARAM_SIZE, n C size
- mov up, SAVE_UP
- mov PARAM_SRC, up
- movd PARAM_MUL, %mm7
- mov rp, SAVE_RP
- mov PARAM_DST, rp
-
- movd (up), %mm0
- pmuludq %mm7, %mm0
- shr n
- mov PARAM_CARRY, cy
- jz L(eq1)
-
- movd 4(up), %mm1
- jc L(odd)
-
- lea 4(up), up
- pmuludq %mm7, %mm1
- movd %mm0, reg
- psrlq $32, %mm0
- sub reg, cy
- movd %mm0, reg
- movq %mm1, %mm0
- dec n
- mov cy, (rp)
- lea 4(rp), rp
- jz L(end)
-
-C ALIGN(16)
-L(top): movd 4(up), %mm1
- sbb reg, cy
-L(odd): movd %mm0, reg
- psrlq $32, %mm0
- pmuludq %mm7, %mm1
- sub reg, cy
- lea 8(up), up
- movd %mm0, reg
- movd (up), %mm0
- mov cy, (rp)
- sbb reg, cy
- movd %mm1, reg
- psrlq $32, %mm1
- sub reg, cy
- movd %mm1, reg
- pmuludq %mm7, %mm0
- dec n
- mov cy, 4(rp)
- lea 8(rp), rp
- jnz L(top)
-
-L(end): sbb reg, cy
-
-L(eq1): movd %mm0, reg
- psrlq $32, %mm0
- mov SAVE_UP, up
- sub reg, cy
- movd %mm0, reg
- emms
- mov cy, (rp)
- sbb reg, cy
-
- mov SAVE_RP, rp
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86/pentium4/sse2/bdiv_q_1.asm b/gmp/mpn/x86/pentium4/sse2/bdiv_q_1.asm
deleted file mode 100644
index f7f461d56f..0000000000
--- a/gmp/mpn/x86/pentium4/sse2/bdiv_q_1.asm
+++ /dev/null
@@ -1,233 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 P4: 19.0 cycles/limb
-
-C Pairs of movd's are used to avoid unaligned loads. Despite the loads not
-C being on the dependent chain and there being plenty of cycles available,
-C using an unaligned movq on every second iteration measured about 23 c/l.
-C
-
-defframe(PARAM_SHIFT, 24)
-defframe(PARAM_INVERSE,20)
-defframe(PARAM_DIVISOR,16)
-defframe(PARAM_SIZE, 12)
-defframe(PARAM_SRC, 8)
-defframe(PARAM_DST, 4)
-
- TEXT
-
-C mp_limb_t
-C mpn_pi1_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size, mp_limb_t divisor,
-C mp_limb_t inverse, int shift)
- ALIGN(32)
-PROLOGUE(mpn_pi1_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl PARAM_SIZE, %edx
-
- movl PARAM_SRC, %eax
-
- movl PARAM_DIVISOR, %ecx
-
- movd %ecx, %mm6
- movl PARAM_SHIFT, %ecx
-
- movd %ecx, %mm7 C shift
-
- C
-
- movl PARAM_INVERSE, %ecx
- movd %ecx, %mm5 C inv
-
- movl PARAM_DST, %ecx
- pxor %mm1, %mm1 C initial carry limb
- pxor %mm0, %mm0 C initial carry bit
-
- subl $1, %edx
- jz L(done)
-
- pcmpeqd %mm4, %mm4
- psrlq $32, %mm4 C 0x00000000FFFFFFFF
-
-C The dependent chain here is as follows.
-C
-C latency
-C psubq s = (src-cbit) - climb 2
-C pmuludq q = s*inverse 8
-C pmuludq prod = q*divisor 8
-C psrlq climb = high(prod) 2
-C --
-C 20
-C
-C Yet the loop measures 19.0 c/l, so obviously there's something gained
-C there over a straight reading of the chip documentation.
-
-L(top):
- C eax src, incrementing
- C ebx
- C ecx dst, incrementing
- C edx counter, size-1 iterations
- C
- C mm0 carry bit
- C mm1 carry limb
- C mm4 0x00000000FFFFFFFF
- C mm5 inverse
- C mm6 divisor
- C mm7 shift
-
- movd (%eax), %mm2
- movd 4(%eax), %mm3
- addl $4, %eax
- punpckldq %mm3, %mm2
-
- psrlq %mm7, %mm2
- pand %mm4, %mm2 C src
- psubq %mm0, %mm2 C src - cbit
-
- psubq %mm1, %mm2 C src - cbit - climb
- movq %mm2, %mm0
- psrlq $63, %mm0 C new cbit
-
- pmuludq %mm5, %mm2 C s*inverse
- movd %mm2, (%ecx) C q
- addl $4, %ecx
-
- movq %mm6, %mm1
- pmuludq %mm2, %mm1 C q*divisor
- psrlq $32, %mm1 C new climb
-
-L(entry):
- subl $1, %edx
- jnz L(top)
-
-L(done):
- movd (%eax), %mm2
- psrlq %mm7, %mm2 C src
- psubq %mm0, %mm2 C src - cbit
-
- psubq %mm1, %mm2 C src - cbit - climb
-
- pmuludq %mm5, %mm2 C s*inverse
- movd %mm2, (%ecx) C q
-
- emms
- ret
-
-EPILOGUE()
-
- ALIGN(16)
-C mp_limb_t mpn_bdiv_q_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
-C mp_limb_t divisor);
-C
-PROLOGUE(mpn_bdiv_q_1)
-deflit(`FRAME',0)
-
- movl PARAM_SIZE, %edx
-
- movl PARAM_DIVISOR, %ecx
-
- C eax src
- C ebx
- C ecx divisor
- C edx size-1
-
- movl %ecx, %eax
- bsfl %ecx, %ecx C trailing twos
-
- shrl %cl, %eax C d = divisor without twos
- movd %eax, %mm6
- movd %ecx, %mm7 C shift
-
- shrl %eax C d/2
-
- andl $127, %eax C d/2, 7 bits
-
-ifdef(`PIC',`
- LEA( binvert_limb_table, %ecx)
- movzbl (%eax,%ecx), %eax C inv 8 bits
-',`
- movzbl binvert_limb_table(%eax), %eax C inv 8 bits
-')
-
- C
-
- movd %eax, %mm5 C inv
-
- movd %eax, %mm0 C inv
-
- pmuludq %mm5, %mm5 C inv*inv
-
- C
-
- pmuludq %mm6, %mm5 C inv*inv*d
- paddd %mm0, %mm0 C 2*inv
-
- C
-
- psubd %mm5, %mm0 C inv = 2*inv - inv*inv*d
- pxor %mm5, %mm5
-
- paddd %mm0, %mm5
- pmuludq %mm0, %mm0 C inv*inv
-
- pcmpeqd %mm4, %mm4
- psrlq $32, %mm4 C 0x00000000FFFFFFFF
-
- C
-
- pmuludq %mm6, %mm0 C inv*inv*d
- paddd %mm5, %mm5 C 2*inv
-
- movl PARAM_SRC, %eax
- movl PARAM_DST, %ecx
- pxor %mm1, %mm1 C initial carry limb
-
- C
-
- psubd %mm0, %mm5 C inv = 2*inv - inv*inv*d
-
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
- pushl %eax FRAME_pushl()
- movq %mm6, %mm0
- pmuludq %mm5, %mm0
- movd %mm0, %eax
- cmpl $1, %eax
- popl %eax FRAME_popl()')
-
- pxor %mm0, %mm0 C initial carry bit
- jmp L(entry)
-
-EPILOGUE()
diff --git a/gmp/mpn/x86/pentium4/sse2/cnd_add_n.asm b/gmp/mpn/x86/pentium4/sse2/cnd_add_n.asm
deleted file mode 100644
index b3f3474e67..0000000000
--- a/gmp/mpn/x86/pentium4/sse2/cnd_add_n.asm
+++ /dev/null
@@ -1,95 +0,0 @@
-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/gmp/mpn/x86/pentium4/sse2/cnd_sub_n.asm b/gmp/mpn/x86/pentium4/sse2/cnd_sub_n.asm
deleted file mode 100644
index 339a23e0b6..0000000000
--- a/gmp/mpn/x86/pentium4/sse2/cnd_sub_n.asm
+++ /dev/null
@@ -1,114 +0,0 @@
-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()
diff --git a/gmp/mpn/x86/pentium4/sse2/dive_1.asm b/gmp/mpn/x86/pentium4/sse2/dive_1.asm
index 238f0dd8a5..c50ef7d29e 100644
--- a/gmp/mpn/x86/pentium4/sse2/dive_1.asm
+++ b/gmp/mpn/x86/pentium4/sse2/dive_1.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-4 mpn_divexact_1 -- mpn by limb exact division.
dnl Copyright 2001, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -137,7 +126,7 @@ ifdef(`PIC',`
psubd %mm0, %mm5 C inv = 2*inv - inv*inv*d
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB
pushl %eax FRAME_pushl()
movq %mm6, %mm0
pmuludq %mm5, %mm0
@@ -150,13 +139,13 @@ ifdef(`PIC',`
C The dependent chain here is as follows.
C
-C latency
-C psubq s = (src-cbit) - climb 2
-C pmuludq q = s*inverse 8
-C pmuludq prod = q*divisor 8
-C psrlq climb = high(prod) 2
-C --
-C 20
+C latency
+C psubq s = (src-cbit) - climb 2
+C pmuludq q = s*inverse 8
+C pmuludq prod = q*divisor 8
+C psrlq climb = high(prod) 2
+C --
+C 20
C
C Yet the loop measures 19.0 c/l, so obviously there's something gained
C there over a straight reading of the chip documentation.
diff --git a/gmp/mpn/x86/pentium4/sse2/divrem_1.asm b/gmp/mpn/x86/pentium4/sse2/divrem_1.asm
index 0146fab117..7f973dbf98 100644
--- a/gmp/mpn/x86/pentium4/sse2/divrem_1.asm
+++ b/gmp/mpn/x86/pentium4/sse2/divrem_1.asm
@@ -1,32 +1,22 @@
dnl Intel Pentium-4 mpn_divrem_1 -- mpn by limb division.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/sse2/gmp-mparam.h b/gmp/mpn/x86/pentium4/sse2/gmp-mparam.h
index a94ae868b3..5071aae092 100644
--- a/gmp/mpn/x86/pentium4/sse2/gmp-mparam.h
+++ b/gmp/mpn/x86/pentium4/sse2/gmp-mparam.h
@@ -1,206 +1,68 @@
/* Intel Pentium-4 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2005, 2007-2010, 2014 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2007, 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 either:
+it under the terms of the GNU 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 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.
-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.
+#define BITS_PER_MP_LIMB 32
+#define BYTES_PER_MP_LIMB 4
-or both in parallel, as here.
-The GNU MP Library is distributed in the hope that 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
-
-/* 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 */
-#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 13
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 0 /* never mpn_mod_1s_2p */
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 2
-#define 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 113
-#define MUL_TOOM44_THRESHOLD 288
-#define MUL_TOOM6H_THRESHOLD 454
-#define MUL_TOOM8H_THRESHOLD 592
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 118
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 214
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 193
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 186
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 287
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 44
-#define SQR_TOOM3_THRESHOLD 173
-#define SQR_TOOM4_THRESHOLD 390
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 915
-
-#define MULMID_TOOM42_THRESHOLD 66
-
-#define MULMOD_BNM1_THRESHOLD 19
-#define SQRMOD_BNM1_THRESHOLD 23
-
-#define MUL_FFT_MODF_THRESHOLD 1147 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 1147, 5}, { 36, 6}, { 19, 5}, { 39, 6}, \
- { 27, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 35, 7}, { 19, 6}, { 40, 7}, { 21, 6}, \
- { 43, 7}, { 23, 6}, { 49, 7}, { 27, 6}, \
- { 55, 7}, { 31, 6}, { 63, 7}, { 35, 8}, \
- { 19, 7}, { 43, 8}, { 23, 7}, { 51, 8}, \
- { 27, 7}, { 55, 8}, { 31, 7}, { 63, 8}, \
- { 39, 7}, { 79, 8}, { 43, 9}, { 23, 8}, \
- { 55, 9}, { 31, 8}, { 71, 9}, { 39, 8}, \
- { 79, 9}, { 47, 8}, { 95, 9}, { 55,10}, \
- { 31, 9}, { 63, 8}, { 127, 9}, { 79,10}, \
- { 47, 9}, { 111,11}, { 31,10}, { 63, 9}, \
- { 143,10}, { 79, 9}, { 159,10}, { 111,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 159, 9}, \
- { 319,11}, { 95,10}, { 207,12}, { 63,11}, \
- { 127,10}, { 287,11}, { 159,10}, { 335,11}, \
- { 191,10}, { 383,11}, { 223,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 319,10}, { 671,11}, \
- { 351,12}, { 191,11}, { 383,10}, { 799,13}, \
- { 127,12}, { 255,11}, { 511,10}, { 1055, 9}, \
- { 2111,10}, { 1119, 9}, { 2239,11}, { 607,12}, \
- { 319,11}, { 671,10}, { 1407,11}, { 735,10}, \
- { 1471, 9}, { 2943,12}, { 383,11}, { 799,10}, \
- { 1599,11}, { 863,10}, { 1727, 9}, { 3455,12}, \
- { 447,11}, { 895,13}, { 255,12}, { 511,11}, \
- { 1055,10}, { 2111,11}, { 1119,10}, { 2239, 9}, \
- { 4479,12}, { 575,11}, { 1247,10}, { 2495, 9}, \
- { 4991,12}, { 639,11}, { 1471,10}, { 2943,13}, \
- { 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 896 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 896, 5}, { 28, 6}, { 15, 5}, { 33, 6}, \
- { 17, 5}, { 35, 6}, { 19, 5}, { 39, 6}, \
- { 27, 7}, { 15, 6}, { 33, 7}, { 17, 6}, \
- { 36, 7}, { 19, 6}, { 39, 7}, { 23, 6}, \
- { 47, 7}, { 27, 6}, { 55, 7}, { 31, 6}, \
- { 63, 7}, { 37, 8}, { 19, 7}, { 43, 8}, \
- { 23, 7}, { 51, 8}, { 27, 7}, { 55, 8}, \
- { 31, 7}, { 63, 8}, { 39, 7}, { 79, 8}, \
- { 43, 9}, { 23, 8}, { 55, 9}, { 31, 8}, \
- { 71, 9}, { 39, 8}, { 79, 9}, { 47, 8}, \
- { 95, 9}, { 55,10}, { 31, 9}, { 79,10}, \
- { 47, 9}, { 95,11}, { 31,10}, { 63, 9}, \
- { 127,10}, { 79, 9}, { 159,10}, { 95, 9}, \
- { 191,11}, { 63,10}, { 127, 9}, { 255,10}, \
- { 159,11}, { 95,10}, { 191,12}, { 63,11}, \
- { 127,10}, { 255, 9}, { 511,10}, { 271, 9}, \
- { 543,11}, { 159,10}, { 319, 9}, { 639,11}, \
- { 191,10}, { 383, 9}, { 767,11}, { 223,12}, \
- { 127,11}, { 255,10}, { 511, 9}, { 1055,10}, \
- { 543,11}, { 287,10}, { 607,11}, { 319,12}, \
- { 191,11}, { 383,10}, { 767,13}, { 127,12}, \
- { 255,11}, { 511,10}, { 1055,11}, { 543,10}, \
- { 1119, 9}, { 2239,11}, { 607,12}, { 319,11}, \
- { 671,10}, { 1407,11}, { 735,10}, { 1471, 9}, \
- { 2943,12}, { 383,11}, { 799,10}, { 1599,11}, \
- { 863,10}, { 1727,12}, { 447,11}, { 991,13}, \
- { 255,12}, { 511,11}, { 1055,10}, { 2111,11}, \
- { 1119,10}, { 2239,12}, { 575,11}, { 1247,10}, \
- { 2495,12}, { 639,11}, { 1471,10}, { 2943,13}, \
- { 383,12}, { 767,11}, { 1599,12}, { 831,11}, \
- { 1727,10}, { 3455,12}, { 959,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2111,12}, { 1087,11}, \
- { 2239,10}, { 4479,12}, { 1215,11}, { 2495,13}, \
- { 639,12}, { 1471,11}, { 2943,10}, { 5887,13}, \
- { 767,12}, { 1727,11}, { 3455,13}, { 895,12}, \
- { 1791,11}, { 3711,12}, { 1983,11}, { 3967,10}, \
- { 7935,14}, { 511,13}, { 1023,12}, { 2239,11}, \
- { 4479,13}, { 1151,12}, { 2495,11}, { 4991,13}, \
- { 1279,12}, { 2623,13}, { 1407,12}, { 2943,11}, \
- { 5887,14}, { 16384,15}, { 32768,16} }
-#define SQR_FFT_TABLE3_SIZE 159
-#define SQR_FFT_THRESHOLD 7296
-
-#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 51
-#define DC_BDIV_Q_THRESHOLD 85
-
-#define INV_MULMOD_BNM1_THRESHOLD 56
-#define INV_NEWTON_THRESHOLD 121
-#define INV_APPR_THRESHOLD 93
-
-#define BINV_NEWTON_THRESHOLD 366
-#define REDC_1_TO_REDC_N_THRESHOLD 64
-
-#define MU_DIV_QR_THRESHOLD 2350
-#define MU_DIVAPPR_Q_THRESHOLD 2172
-#define MUPI_DIV_QR_THRESHOLD 62
-#define MU_BDIV_QR_THRESHOLD 2172
-#define MU_BDIV_Q_THRESHOLD 2304
-
-#define POWM_SEC_TABLE 1,19,102,615,2111
-
-#define MATRIX22_STRASSEN_THRESHOLD 23
-#define HGCD_THRESHOLD 88
-#define HGCD_APPR_THRESHOLD 93
-#define HGCD_REDUCE_THRESHOLD 5010
-#define GCD_DC_THRESHOLD 379
-#define GCDEXT_DC_THRESHOLD 258
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 26
-#define SET_STR_DC_THRESHOLD 147
-#define SET_STR_PRECOMPUTE_THRESHOLD 894
-
-#define FAC_DSC_THRESHOLD 906
-#define FAC_ODD_THRESHOLD 28
+/* 2600 MHz Pentium 4 model 2 */
+
+/* Generated by tuneup.c, 2009-01-06, gcc 3.4 */
+
+#define MUL_KARATSUBA_THRESHOLD 31
+#define MUL_TOOM3_THRESHOLD 119
+#define MUL_TOOM44_THRESHOLD 178
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 49
+#define SQR_TOOM3_THRESHOLD 165
+#define SQR_TOOM4_THRESHOLD 252
+
+#define MULLOW_BASECASE_THRESHOLD 15
+#define MULLOW_DC_THRESHOLD 44
+#define MULLOW_MUL_N_THRESHOLD 363
+
+#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX /* never */
+#define DIV_DC_THRESHOLD 33
+#define POWM_THRESHOLD 95
+
+#define MATRIX22_STRASSEN_THRESHOLD 23
+#define HGCD_THRESHOLD 64
+#define GCD_DC_THRESHOLD 310
+#define GCDEXT_DC_THRESHOLD 310
+#define JACOBI_BASE_METHOD 1
+
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1 /* native */
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 11
+#define GET_STR_PRECOMPUTE_THRESHOLD 26
+#define SET_STR_DC_THRESHOLD 118
+#define SET_STR_PRECOMPUTE_THRESHOLD 1078
+
+#define MUL_FFT_TABLE { 560, 928, 1920, 5632, 14336, 40960, 0 }
+#define MUL_FFT_MODF_THRESHOLD 720
+#define MUL_FFT_THRESHOLD 9216
+
+#define SQR_FFT_TABLE { 592, 928, 1920, 4608, 14336, 40960, 0 }
+#define SQR_FFT_MODF_THRESHOLD 608
+#define SQR_FFT_THRESHOLD 5888
diff --git a/gmp/mpn/x86/pentium4/sse2/mod_1.asm b/gmp/mpn/x86/pentium4/sse2/mod_1.asm
new file mode 100644
index 0000000000..0e95f13913
--- /dev/null
+++ b/gmp/mpn/x86/pentium4/sse2/mod_1.asm
@@ -0,0 +1,391 @@
+dnl Intel Pentium-4 mpn_mod_1 -- mpn by limb remainder.
+
+dnl Copyright 2001, 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
+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')
+
+
+dnl P4: 31 cycles/limb.
+
+
+C mp_limb_t mpn_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor);
+C mp_limb_t mpn_mod_1c (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t carry);
+C mp_limb_t mpn_preinv_mod_1 (mp_srcptr src, mp_size_t size, mp_limb_t divisor,
+C mp_limb_t inverse);
+C
+C An idea was tried in the mul-by-inverse to process the last limb by a jump
+C back to the top of the loop skipping the -4(%esi) fetch. But that seemed
+C to produce slightly strange timings, like 9 and 10 limb operations about
+C the same speed. The jump would be successively taken and not-taken, which
+C in theory should predict ok, but perhaps isn't enjoyed by the chip.
+C Duplicating the loop for the last limb seems to be a couple of cycles
+C quicker too.
+C
+C Enhancements:
+C
+C The loop measures 31 cycles, but the dependent chain would suggest it
+C could be done with 30. Not sure where to start looking for the extra
+C cycle.
+
+
+dnl MUL_THRESHOLD is the size at which the multiply by inverse method is
+dnl used, rather than plain "divl"s. Minimum value 2.
+dnl
+dnl The inverse takes about 80-90 cycles to calculate, but after that the
+dnl multiply is 31 c/l versus division at about 58 c/l.
+
+deflit(MUL_THRESHOLD, 5)
+
+
+defframe(PARAM_INVERSE,16) dnl mpn_preinv_mod_1
+defframe(PARAM_CARRY, 16) dnl mpn_mod_1c
+defframe(PARAM_DIVISOR,12)
+defframe(PARAM_SIZE, 8)
+defframe(PARAM_SRC, 4)
+
+dnl re-use parameter space
+define(SAVE_ESI,`PARAM_SIZE')
+define(SAVE_EBP,`PARAM_SRC')
+
+ TEXT
+
+ ALIGN(16)
+PROLOGUE(mpn_preinv_mod_1)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ movl %esi, SAVE_ESI
+ movl $32, %eax
+
+ movd %eax, %mm6 C l = 0, so 32-l = 32
+ movl PARAM_SRC, %esi
+ movl %ebp, SAVE_EBP
+
+ movd PARAM_DIVISOR, %mm5
+ pxor %mm7, %mm7 C l = 0
+
+ movd -4(%esi,%ecx,4), %mm0 C src high limb
+ leal -8(%esi,%ecx,4), %esi C &src[size-2]
+
+ movd PARAM_INVERSE, %mm4
+ subl $2, %ecx C size-2
+
+ psubq %mm5, %mm0 C high-divisor
+ movq %mm0, %mm2
+
+ psrlq $32, %mm0 C -1 if underflow
+
+ pand %mm5, %mm0 C divisor if underflow
+
+ paddq %mm2, %mm0 C addback if underflow
+ jz L(inverse_last) C if size==2
+ ja L(inverse_top) C if size>2
+
+
+ C if size==1
+ movl SAVE_ESI, %esi
+ movd %mm0, %eax
+ emms
+ ret
+
+EPILOGUE()
+
+
+ ALIGN(16)
+PROLOGUE(mpn_mod_1c)
+deflit(`FRAME',0)
+ movl PARAM_SIZE, %ecx
+ movl %esi, SAVE_ESI
+
+ movl PARAM_SRC, %esi
+ movl %ebp, SAVE_EBP
+
+ movl PARAM_CARRY, %edx
+ orl %ecx, %ecx
+ jz L(divide_done) C result==carry if size==0
+
+ movl PARAM_DIVISOR, %ebp
+ jmp L(start_1c)
+
+EPILOGUE()
+
+
+ ALIGN(16)
+PROLOGUE(mpn_mod_1)
+deflit(`FRAME',0)
+
+ movl PARAM_SIZE, %ecx
+ movl %esi, SAVE_ESI
+
+ movl PARAM_SRC, %esi
+ movl %ebp, SAVE_EBP
+
+ movl PARAM_DIVISOR, %ebp
+ xorl %edx, %edx C result 0 if size==0
+
+ orl %ecx, %ecx
+ jz L(divide_done)
+ movl -4(%esi,%ecx,4), %eax C src high limb
+
+ leal -1(%ecx), %edx
+ cmpl %ebp, %eax C c if high<divisor
+
+ cmovc( %edx, %ecx) C size-1 if high<divisor
+
+ movl $0, %edx C initial carry
+ cmovc( %eax, %edx) C src high limb if high<divisor
+
+ orl %ecx, %ecx
+ jz L(divide_done) C if size==1 and skip div
+
+
+L(start_1c):
+ C eax
+ C ebx
+ C ecx size
+ C edx carry
+ C esi src
+ C edi
+ C ebp divisor
+
+ leal -4(%esi,%ecx,4), %esi C &src[size-1]
+ cmpl $MUL_THRESHOLD, %ecx
+ jae L(mul_by_inverse)
+
+
+L(divide_top):
+ C eax
+ C ebx
+ C ecx counter, limbs, decrementing
+ C edx remainder
+ C esi src, decrementing
+ C edi
+ C ebp divisor
+
+ movl (%esi), %eax
+ subl $4, %esi
+
+ divl %ebp
+
+ subl $1, %ecx
+ jnz L(divide_top)
+
+
+L(divide_done):
+ movl SAVE_ESI, %esi
+ movl SAVE_EBP, %ebp
+ movl %edx, %eax
+ ret
+
+
+C -----------------------------------------------------------------------------
+
+L(mul_by_inverse):
+ C eax
+ C ebx
+ C ecx size
+ C edx carry
+ C esi src
+ C edi
+ C ebp divisor
+
+ bsrl %ebp, %eax C 31-l
+
+ movd %edx, %mm1 C carry
+ movl %ecx, %edx C size
+ movl $31, %ecx
+
+ C
+
+ xorl %eax, %ecx C l = leading zeros on d
+ addl $1, %eax C 32-l
+
+ shll %cl, %ebp C normalize d
+ movd %ecx, %mm7 C l
+ leal -1(%edx), %ecx C size-1
+
+ movd %eax, %mm6 C 32-l
+ movl $-1, %edx
+ movl $-1, %eax
+
+ C
+
+ subl %ebp, %edx C (b-d)-1 so edx:eax = b*(b-d)-1
+
+ divl %ebp C floor (b*(b-d)-1 / d)
+
+ movd %ebp, %mm5 C d
+ movd (%esi), %mm0 C src high limb
+ punpckldq %mm1, %mm0
+ psrlq %mm6, %mm0 C n2 = high (carry:srchigh << l)
+
+ C
+
+ movd %eax, %mm4 C m
+
+
+C The dependent chain here consists of
+C
+C 2 paddd n1+n2
+C 8 pmuludq m*(n1+n2)
+C 2 paddq n2:nadj + m*(n1+n2)
+C 2 psrlq q1
+C 8 pmuludq d*q1
+C 2 psubq (n-d)-q1*d
+C 2 psrlq high mask
+C 2 pand d masked
+C 2 paddd n2+d addback
+C --
+C 30
+C
+C But it seems to run at 31 cycles, so presumably there's something else
+C going on.
+
+
+ ALIGN(16)
+L(inverse_top):
+ C eax
+ C ebx
+ C ecx counter, size-1 to 1
+ C edx
+ C esi src, decrementing
+ C edi
+ C ebp
+ C
+ C mm0 n2
+ C mm4 m
+ C mm5 d
+ C mm6 32-l
+ C mm7 l
+
+ ASSERT(b,`C n2<d
+ movd %mm0, %eax
+ movd %mm5, %edx
+ cmpl %edx, %eax')
+
+ movd -4(%esi), %mm1 C next src limbs
+ movd (%esi), %mm2
+ leal -4(%esi), %esi
+
+ punpckldq %mm2, %mm1
+ psrlq %mm6, %mm1 C n10
+
+ movq %mm1, %mm2 C n10
+ movq %mm1, %mm3 C n10
+ psrad $31, %mm1 C -n1
+ pand %mm5, %mm1 C -n1 & d
+ paddd %mm2, %mm1 C nadj = n10+(-n1&d), ignore overflow
+
+ psrld $31, %mm2 C n1
+ paddd %mm0, %mm2 C n2+n1
+ punpckldq %mm0, %mm1 C n2:nadj
+
+ pmuludq %mm4, %mm2 C m*(n2+n1)
+
+ paddq %mm2, %mm1 C n2:nadj + m*(n2+n1)
+
+ psrlq $32, %mm1 C q1 = high(n2:nadj + m*(n2+n1))
+
+ pmuludq %mm5, %mm1 C q1*d
+ punpckldq %mm0, %mm3 C n
+ psubq %mm5, %mm3 C n - d
+ pxor %mm0, %mm0
+
+ psubq %mm1, %mm3 C n - (q1+1)*d
+
+ por %mm3, %mm0 C remainder -> n2
+ psrlq $32, %mm3 C high n - (q1+1)*d, 0 or -1
+
+ ASSERT(be,`C 0 or -1
+ movd %mm3, %eax
+ addl $1, %eax
+ cmpl $1, %eax')
+
+ pand %mm5, %mm3 C mask & d
+
+ paddd %mm3, %mm0 C addback if necessary
+
+ subl $1, %ecx
+ jnz L(inverse_top)
+
+
+ C Least significant limb.
+ C Same code as the loop, but there's no -4(%esi) limb to fetch.
+
+L(inverse_last):
+ C eax
+ C ebx
+ C ecx
+ C edx
+ C esi &src[0]
+ C
+ C mm0 n2
+ C mm4 m
+ C mm5 d
+ C mm6 32-l
+ C mm7 l
+
+ movd (%esi), %mm1 C src[0]
+ psllq %mm7, %mm1 C n10
+
+ movq %mm1, %mm2 C n10
+ movq %mm1, %mm3 C n10
+ psrad $31, %mm1 C -n1
+ pand %mm5, %mm1 C -n1 & d
+ paddd %mm2, %mm1 C nadj = n10+(-n1&d), ignore overflow
+
+ psrld $31, %mm2 C n1
+ paddd %mm0, %mm2 C n2+n1
+ punpckldq %mm0, %mm1 C n2:nadj
+
+ pmuludq %mm4, %mm2 C m*(n2+n1)
+
+ paddq %mm2, %mm1 C n2:nadj + m*(n2+n1)
+
+ psrlq $32, %mm1 C q1 = high(n2:nadj + m*(n2+n1))
+
+ pmuludq %mm5, %mm1 C q1*d
+ punpckldq %mm0, %mm3 C n
+ psubq %mm5, %mm3 C n - d
+ pxor %mm0, %mm0
+
+ psubq %mm1, %mm3 C n - (q1+1)*d
+
+ por %mm3, %mm0 C remainder -> n2
+ psrlq $32, %mm3 C high n - (q1+1)*d, 0 or -1
+
+ ASSERT(be,`C 0 or -1
+ movd %mm3, %eax
+ addl $1, %eax
+ cmpl $1, %eax')
+
+ movl SAVE_EBP, %ebp
+ pand %mm5, %mm3 C mask & d
+
+ movl SAVE_ESI, %esi
+ paddd %mm3, %mm0 C addback if necessary
+
+ psrld %mm7, %mm0
+
+ movd %mm0, %eax
+
+ emms
+ ret
+
+EPILOGUE()
diff --git a/gmp/mpn/x86/pentium4/sse2/mod_1_1.asm b/gmp/mpn/x86/pentium4/sse2/mod_1_1.asm
deleted file mode 100644
index ee88babeee..0000000000
--- a/gmp/mpn/x86/pentium4/sse2/mod_1_1.asm
+++ /dev/null
@@ -1,166 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C TODO:
-C * Optimize. The present code was written quite straightforwardly.
-C * Optimize post-loop reduction code; it is from mod_1s_4p, thus overkill.
-C * Write a cps function that uses sse2 insns.
-
-C cycles/limb
-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) 16
-C P4 model 3-4 (Prescott) 18
-
-C INPUT PARAMETERS
-C ap sp + 4
-C n sp + 8
-C b sp + 12
-C cps sp + 16
-
-define(`B1modb', `%mm1')
-define(`B2modb', `%mm2')
-define(`ap', `%edx')
-define(`n', `%eax')
-
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mod_1_1p)
- push %ebx
- mov 8(%esp), ap
- mov 12(%esp), n
- mov 20(%esp), %ecx
- movd 8(%ecx), B1modb
- movd 12(%ecx), B2modb
-
- lea -4(ap,n,4), ap
-
-C FIXME: See comment in generic/mod_1_1.c.
- movd (ap), %mm7
- movd -4(ap), %mm4
- pmuludq B1modb, %mm7
- paddq %mm4, %mm7
- add $-2, n
- jz L(end)
-
- ALIGN(8)
-L(top): movq %mm7, %mm6
- psrlq $32, %mm7 C rh
- movd -8(ap), %mm0
- add $-4, ap
- pmuludq B2modb, %mm7
- pmuludq B1modb, %mm6
- add $-1, n
- paddq %mm0, %mm7
- paddq %mm6, %mm7
- jnz L(top)
-
-L(end): pcmpeqd %mm4, %mm4
- psrlq $32, %mm4 C 0x00000000FFFFFFFF
- pand %mm7, %mm4 C rl
- psrlq $32, %mm7 C rh
- pmuludq B1modb, %mm7 C rh,cl
- paddq %mm4, %mm7 C rh,rl
- movd 4(%ecx), %mm4 C cnt
- psllq %mm4, %mm7 C rh,rl normalized
- movq %mm7, %mm2 C rl in low half
- psrlq $32, %mm7 C rh
- movd (%ecx), %mm1 C bi
- pmuludq %mm7, %mm1 C qh,ql
- paddq %mm2, %mm1 C qh-1,ql
- movd %mm1, %ecx C ql
- psrlq $32, %mm1 C qh-1
- movd 16(%esp), %mm3 C b
- pmuludq %mm1, %mm3 C (qh-1) * b
- psubq %mm3, %mm2 C r in low half (could use psubd)
- movd %mm2, %eax C r
- mov 16(%esp), %ebx
- sub %ebx, %eax C r
- cmp %eax, %ecx
- lea (%eax,%ebx), %edx
- cmovc( %edx, %eax)
- movd %mm4, %ecx C cnt
- cmp %ebx, %eax
- jae L(fix)
- emms
- pop %ebx
- shr %cl, %eax
- ret
-
-L(fix): sub %ebx, %eax
- emms
- pop %ebx
- shr %cl, %eax
- ret
-EPILOGUE()
-
-PROLOGUE(mpn_mod_1_1p_cps)
-C CAUTION: This is the same code as in k7/mod_1_1.asm
- push %ebp
- mov 12(%esp), %ebp
- push %esi
- bsr %ebp, %ecx
- push %ebx
- xor $31, %ecx
- mov 16(%esp), %esi
- sal %cl, %ebp
- mov %ebp, %edx
- not %edx
- mov $-1, %eax
- div %ebp
- mov %eax, (%esi) C store bi
- mov %ecx, 4(%esi) C store cnt
- xor %ebx, %ebx
- sub %ebp, %ebx
- mov $1, %edx
- shld %cl, %eax, %edx
- imul %edx, %ebx
- mul %ebx
- add %ebx, %edx
- not %edx
- imul %ebp, %edx
- add %edx, %ebp
- cmp %edx, %eax
- cmovc( %ebp, %edx)
- shr %cl, %ebx
- mov %ebx, 8(%esi) C store B1modb
- shr %cl, %edx
- mov %edx, 12(%esi) C store B2modb
- pop %ebx
- pop %esi
- pop %ebp
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86/pentium4/sse2/mod_1_4.asm b/gmp/mpn/x86/pentium4/sse2/mod_1_4.asm
deleted file mode 100644
index eb2edb6297..0000000000
--- a/gmp/mpn/x86/pentium4/sse2/mod_1_4.asm
+++ /dev/null
@@ -1,269 +0,0 @@
-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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C TODO:
-C * Optimize. The present code was written quite straightforwardly.
-C * Optimize post-loop reduction code.
-C * Write a cps function that uses sse2 insns.
-
-C cycles/limb
-C P6 model 0-8,10-12 -
-C P6 model 9 (Banias) ?
-C P6 model 13 (Dothan) 3.4
-C P4 model 0-1 (Willamette) ?
-C P4 model 2 (Northwood) 4
-C P4 model 3-4 (Prescott) 4.5
-
-C INPUT PARAMETERS
-C ap sp + 4
-C n sp + 8
-C b sp + 12
-C cps sp + 16
-
-define(`B1modb', `%mm1')
-define(`B2modb', `%mm2')
-define(`B3modb', `%mm3')
-define(`B4modb', `%mm4')
-define(`B5modb', `%mm5')
-define(`ap', `%edx')
-define(`n', `%eax')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_4p)
- push %ebx
- mov 8(%esp), ap
- mov 12(%esp), n
- mov 20(%esp), %ecx
-
- movd 8(%ecx), B1modb
- movd 12(%ecx), B2modb
- movd 16(%ecx), B3modb
- movd 20(%ecx), B4modb
- movd 24(%ecx), B5modb
-
- mov n, %ebx
- lea -4(ap,n,4), ap
- and $3, %ebx
- je L(b0)
- cmp $2, %ebx
- jc L(b1)
- je L(b2)
-
-L(b3): movd -4(ap), %mm7
- pmuludq B1modb, %mm7
- movd -8(ap), %mm6
- paddq %mm6, %mm7
- movd (ap), %mm6
- pmuludq B2modb, %mm6
- paddq %mm6, %mm7
- lea -24(ap), ap
- add $-3, n
- jz L(end)
- jmp L(top)
-
-L(b0): movd -8(ap), %mm7
- pmuludq B1modb, %mm7
- movd -12(ap), %mm6
- paddq %mm6, %mm7
- movd -4(ap), %mm6
- pmuludq B2modb, %mm6
- paddq %mm6, %mm7
- movd (ap), %mm6
- pmuludq B3modb, %mm6
- paddq %mm6, %mm7
- lea -28(ap), ap
- add $-4, n
- jz L(end)
- jmp L(top)
-
-L(b1): movd (ap), %mm7
- lea -16(ap), ap
- dec n
- jz L(x)
- jmp L(top)
-
-L(b2): movd -4(ap), %mm7 C rl
- punpckldq (ap), %mm7 C rh
- lea -20(ap), ap
- add $-2, n
- jz L(end)
-
- ALIGN(8)
-L(top): movd 4(ap), %mm0
- pmuludq B1modb, %mm0
- movd 0(ap), %mm6
- paddq %mm6, %mm0
-
- movd 8(ap), %mm6
- pmuludq B2modb, %mm6
- paddq %mm6, %mm0
-
- movd 12(ap), %mm6
- pmuludq B3modb, %mm6
- paddq %mm6, %mm0
-
- movq %mm7, %mm6
- psrlq $32, %mm7 C rh
- pmuludq B5modb, %mm7
- pmuludq B4modb, %mm6
-
- paddq %mm0, %mm7
- paddq %mm6, %mm7
-
- add $-16, ap
- add $-4, n
- jnz L(top)
-
-L(end): pcmpeqd %mm4, %mm4
- psrlq $32, %mm4 C 0x00000000FFFFFFFF
- pand %mm7, %mm4 C rl
- psrlq $32, %mm7 C rh
- pmuludq B1modb, %mm7 C rh,cl
- paddq %mm4, %mm7 C rh,rl
-L(x): movd 4(%ecx), %mm4 C cnt
- psllq %mm4, %mm7 C rh,rl normalized
- movq %mm7, %mm2 C rl in low half
- psrlq $32, %mm7 C rh
- movd (%ecx), %mm1 C bi
- pmuludq %mm7, %mm1 C qh,ql
- paddq %mm2, %mm1 C qh-1,ql
- movd %mm1, %ecx C ql
- psrlq $32, %mm1 C qh-1
- movd 16(%esp), %mm3 C b
- pmuludq %mm1, %mm3 C (qh-1) * b
- psubq %mm3, %mm2 C r in low half (could use psubd)
- movd %mm2, %eax C r
- mov 16(%esp), %ebx
- sub %ebx, %eax C r
- cmp %eax, %ecx
- lea (%eax,%ebx), %edx
- cmovc( %edx, %eax)
- movd %mm4, %ecx C cnt
- cmp %ebx, %eax
- jae L(fix)
- emms
- pop %ebx
- shr %cl, %eax
- ret
-
-L(fix): sub %ebx, %eax
- emms
- pop %ebx
- shr %cl, %eax
- ret
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_4p_cps)
-C CAUTION: This is the same code as in k7/mod_1_4.asm
- push %ebp
- push %edi
- push %esi
- push %ebx
- mov 20(%esp), %ebp C FIXME: avoid bp for 0-idx
- mov 24(%esp), %ebx
- bsr %ebx, %ecx
- xor $31, %ecx
- sal %cl, %ebx C b << cnt
- mov %ebx, %edx
- not %edx
- mov $-1, %eax
- div %ebx
- xor %edi, %edi
- sub %ebx, %edi
- mov $1, %esi
- mov %eax, (%ebp) C store bi
- mov %ecx, 4(%ebp) C store cnt
- shld %cl, %eax, %esi
- imul %edi, %esi
- mov %eax, %edi
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 8(%ebp) C store B1modb
-
- not %edx
- imul %ebx, %edx
- lea (%edx,%ebx), %esi
- cmp %edx, %eax
- cmovnc( %edx, %esi)
- mov %edi, %eax
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 12(%ebp) C store B2modb
-
- not %edx
- imul %ebx, %edx
- lea (%edx,%ebx), %esi
- cmp %edx, %eax
- cmovnc( %edx, %esi)
- mov %edi, %eax
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 16(%ebp) C store B3modb
-
- not %edx
- imul %ebx, %edx
- lea (%edx,%ebx), %esi
- cmp %edx, %eax
- cmovnc( %edx, %esi)
- mov %edi, %eax
- mul %esi
-
- add %esi, %edx
- shr %cl, %esi
- mov %esi, 20(%ebp) C store B4modb
-
- not %edx
- imul %ebx, %edx
- add %edx, %ebx
- cmp %edx, %eax
- cmovnc( %edx, %ebx)
-
- shr %cl, %ebx
- mov %ebx, 24(%ebp) C store B5modb
-
- pop %ebx
- pop %esi
- pop %edi
- pop %ebp
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86/pentium4/sse2/mod_34lsub1.asm b/gmp/mpn/x86/pentium4/sse2/mod_34lsub1.asm
index 31e25b79bc..1598b41785 100644
--- a/gmp/mpn/x86/pentium4/sse2/mod_34lsub1.asm
+++ b/gmp/mpn/x86/pentium4/sse2/mod_34lsub1.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium 4 mpn_mod_34lsub1 -- remainder modulo 2^24-1.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/sse2/mode1o.asm b/gmp/mpn/x86/pentium4/sse2/mode1o.asm
index 778c478169..2f0b177a00 100644
--- a/gmp/mpn/x86/pentium4/sse2/mode1o.asm
+++ b/gmp/mpn/x86/pentium4/sse2/mode1o.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-4 mpn_modexact_1_odd -- mpn by limb exact remainder.
dnl Copyright 2001, 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 modify
-dnl it under the terms of either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -112,7 +101,7 @@ ifdef(`PIC',`
psubd %mm0, %mm6 C inv = 2*inv - inv*inv*d
- ASSERT(e,` C expect d*inv == 1 mod 2^GMP_LIMB_BITS
+ ASSERT(e,` C expect d*inv == 1 mod 2^BITS_PER_MP_LIMB
pushl %eax FRAME_pushl()
movd %mm6, %eax
imul PARAM_DIVISOR, %eax
@@ -124,13 +113,13 @@ ifdef(`PIC',`
C The dependent chain here is as follows.
C
-C latency
-C psubq s = (src-cbit) - climb 2
-C pmuludq q = s*inverse 8
-C pmuludq prod = q*divisor 8
-C psrlq climb = high(prod) 2
-C --
-C 20
+C latency
+C psubq s = (src-cbit) - climb 2
+C pmuludq q = s*inverse 8
+C pmuludq prod = q*divisor 8
+C psrlq climb = high(prod) 2
+C --
+C 20
C
C Yet the loop measures 19.0 c/l, so obviously there's something gained
C there over a straight reading of the chip documentation.
diff --git a/gmp/mpn/x86/pentium4/sse2/mul_1.asm b/gmp/mpn/x86/pentium4/sse2/mul_1.asm
index 6347b8bf62..07be951921 100644
--- a/gmp/mpn/x86/pentium4/sse2/mul_1.asm
+++ b/gmp/mpn/x86/pentium4/sse2/mul_1.asm
@@ -1,48 +1,37 @@
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 Copyright 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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 P6 model 0-8,10-12 -
-C P6 model 9 (Banias) 4.17
-C P6 model 13 (Dothan) 4.17
-C P4 model 0-1 (Willamette) 4
-C P4 model 2 (Northwood) 4
-C P4 model 3-4 (Prescott) 4.55
-
C TODO:
C * Tweak eax/edx offsets in loop as to save some lea's
C * Perhaps software pipeline small-case code
+C cycles/limb
+C P6 model 0-8,10-12) -
+C P6 model 9 (Banias) ?
+C P6 model 13 (Dothan) 4.17
+C P4 model 0-1 (Willamette): 4
+C P4 model 2 (Northwood): 4
+C P4 model 3-4 (Prescott): 4.55
+
C INPUT PARAMETERS
C rp sp + 4
C up sp + 8
@@ -51,13 +40,22 @@ C v0 sp + 16
TEXT
ALIGN(16)
+PROLOGUE(mpn_mul_1c)
+ mov 4(%esp), %edx
+ mov 8(%esp), %eax
+ mov 12(%esp), %ecx
+ movd 16(%esp), %mm7
+ movd 20(%esp), %mm6
+ jmp L(ent)
+EPILOGUE()
+ ALIGN(16)
PROLOGUE(mpn_mul_1)
- pxor %mm6, %mm6
-L(ent): mov 4(%esp), %edx
+ mov 4(%esp), %edx
mov 8(%esp), %eax
mov 12(%esp), %ecx
movd 16(%esp), %mm7
- cmp $4, %ecx
+ pxor %mm6, %mm6
+L(ent): cmp $4, %ecx
jnc L(big)
L(lp0): movd (%eax), %mm0
@@ -158,7 +156,3 @@ L(end): pmuludq %mm7, %mm2
emms
ret
EPILOGUE()
-PROLOGUE(mpn_mul_1c)
- movd 20(%esp), %mm6
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86/pentium4/sse2/mul_basecase.asm b/gmp/mpn/x86/pentium4/sse2/mul_basecase.asm
index 6e3775ae09..2628e5eb72 100644
--- a/gmp/mpn/x86/pentium4/sse2/mul_basecase.asm
+++ b/gmp/mpn/x86/pentium4/sse2/mul_basecase.asm
@@ -1,32 +1,21 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/sse2/popcount.asm b/gmp/mpn/x86/pentium4/sse2/popcount.asm
index b8238b9b66..cb982ade46 100644
--- a/gmp/mpn/x86/pentium4/sse2/popcount.asm
+++ b/gmp/mpn/x86/pentium4/sse2/popcount.asm
@@ -1,66 +1,52 @@
dnl X86-32 and X86-64 mpn_popcount using SSE2.
-dnl Copyright 2006, 2007, 2011 Free Software Foundation, Inc.
-
+dnl Copyright 2006, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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 32-bit popcount hamdist
-C cycles/limb cycles/limb
-C P5 -
-C P6 model 0-8,10-12 -
-C P6 model 9 (Banias) ?
-C P6 model 13 (Dothan) 4
-C P4 model 0 (Willamette) ?
-C P4 model 1 (?) ?
-C P4 model 2 (Northwood) 3.9
-C P4 model 3 (Prescott) ?
-C P4 model 4 (Nocona) ?
-C AMD K6 -
-C AMD K7 -
-C AMD K8 ?
-
-C 64-bit popcount hamdist
-C cycles/limb cycles/limb
-C P4 model 4 (Nocona): 8
-C AMD K8,K9 7.5
-C AMD K10 3.5
-C Intel core2 3.68
-C Intel corei 3.15
-C Intel atom 10.8
-C VIA nano 6.5
+C 32-bit popcount hamdist
+C cycles/limb cycles/limb
+C P5: -
+C P6 model 0-8,10-12) -
+C P6 model 9 (Banias) ?
+C P6 model 13 (Dothan) 4
+C P4 model 0 (Willamette) ?
+C P4 model 1 (?) ?
+C P4 model 2 (Northwood) 3.9
+C P4 model 3 (Prescott) ?
+C P4 model 4 (Nocona) ?
+C K6: -
+C K7: -
+C K8: ?
+
+C 64-bit popcount hamdist
+C cycles/limb cycles/limb
+C P4 model 4 (Nocona): 8
+C K8: 7.5
+C K10: 3.5
+C P6-15: 3.68
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 usable shift
+C shifting as we go. Unfortunately, there seem to be no useable 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.
diff --git a/gmp/mpn/x86/pentium4/sse2/rsh1add_n.asm b/gmp/mpn/x86/pentium4/sse2/rsh1add_n.asm
index f421d1323e..bbf43245cb 100644
--- a/gmp/mpn/x86/pentium4/sse2/rsh1add_n.asm
+++ b/gmp/mpn/x86/pentium4/sse2/rsh1add_n.asm
@@ -1,32 +1,21 @@
dnl Intel Pentium-4 mpn_rsh1add_n -- mpn (x+y)/2
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/pentium4/sse2/sqr_basecase.asm b/gmp/mpn/x86/pentium4/sse2/sqr_basecase.asm
index 2dd57d25d9..fc56f164ed 100644
--- a/gmp/mpn/x86/pentium4/sse2/sqr_basecase.asm
+++ b/gmp/mpn/x86/pentium4/sse2/sqr_basecase.asm
@@ -1,32 +1,21 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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')
@@ -41,7 +30,7 @@ C * Look into different loop alignment, we now expand the code about 50 bytes
C with possibly needless alignment.
C * Use OSP, should solve feed-in latency problems.
C * Address relative slowness for un<=3 for Pentium M. The old code is there
-C considerably faster. (1:20/14, 2:34:32, 3:66/57)
+C consideraly faster. (1:20/14, 2:34:32, 3:66/57)
C INPUT PARAMETERS
C rp sp + 4
diff --git a/gmp/mpn/x86/pentium4/sse2/sub_n.asm b/gmp/mpn/x86/pentium4/sse2/sub_n.asm
index 5ba1c018ec..02d5f01474 100644
--- a/gmp/mpn/x86/pentium4/sse2/sub_n.asm
+++ b/gmp/mpn/x86/pentium4/sse2/sub_n.asm
@@ -1,44 +1,37 @@
dnl Intel Pentium-4 mpn_sub_n -- mpn subtraction.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 dst!=src1,2 dst==src1 dst==src2
-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) 4 6 6
-C P4 model 3-4 (Prescott) 4.25 7.5 7.5
+C P4 Willamette, Northwood: 4.0 cycles/limb if dst!=src1 and dst!=src2
+C 6.0 cycles/limb if dst==src1 or dst==src2
+C P4 Prescott: >= 5 cycles/limb
+
+
+C mp_limb_t mpn_sub_n (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
+C mp_size_t size);
+C mp_limb_t mpn_sub_nc (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
+C mp_size_t size, mp_limb_t carry);
+C
+C The main loop code is 2x unrolled so that the carry bit can alternate
+C between mm0 and mm1.
defframe(PARAM_CARRY,20)
defframe(PARAM_SIZE, 16)
@@ -54,8 +47,10 @@ define(SAVE_EBX,`PARAM_SRC1')
PROLOGUE(mpn_sub_nc)
deflit(`FRAME',0)
+
movd PARAM_CARRY, %mm0
jmp L(start_nc)
+
EPILOGUE()
ALIGN(8)
@@ -63,16 +58,16 @@ PROLOGUE(mpn_sub_n)
deflit(`FRAME',0)
pxor %mm0, %mm0
L(start_nc):
- mov PARAM_SRC1, %eax
- mov %ebx, SAVE_EBX
- mov PARAM_SRC2, %ebx
- mov PARAM_DST, %edx
- mov PARAM_SIZE, %ecx
+ movl PARAM_SRC1, %eax
+ movl %ebx, SAVE_EBX
+ movl PARAM_SRC2, %ebx
+ movl PARAM_DST, %edx
+ movl 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
+ leal (%eax,%ecx,4), %eax C src1 end
+ leal (%ebx,%ecx,4), %ebx C src2 end
+ leal (%edx,%ecx,4), %edx C dst end
+ negl %ecx C -size
L(top):
C eax src1 end
@@ -90,7 +85,7 @@ L(top):
psrlq $63, %mm1
- add $1, %ecx
+ addl $1, %ecx
jz L(done_mm1)
movd (%eax,%ecx,4), %mm0
@@ -102,17 +97,18 @@ L(top):
psrlq $63, %mm0
- add $1, %ecx
+ addl $1, %ecx
jnz L(top)
+
movd %mm0, %eax
- mov SAVE_EBX, %ebx
+ movl SAVE_EBX, %ebx
emms
ret
L(done_mm1):
movd %mm1, %eax
- mov SAVE_EBX, %ebx
+ movl SAVE_EBX, %ebx
emms
ret
diff --git a/gmp/mpn/x86/pentium4/sse2/submul_1.asm b/gmp/mpn/x86/pentium4/sse2/submul_1.asm
index 020675bd7b..ceb41f2ac0 100644
--- a/gmp/mpn/x86/pentium4/sse2/submul_1.asm
+++ b/gmp/mpn/x86/pentium4/sse2/submul_1.asm
@@ -1,71 +1,60 @@
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 This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 2001, 2002 Free Software Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 P6 model 0-8,10-12 -
-C P6 model 9 (Banias) 6.8
-C P6 model 13 (Dothan) 6.9
-C P4 model 0-1 (Willamette) ?
-C P4 model 2 (Northwood) 5.87
-C P4 model 3-4 (Prescott) 6.5
+C P4: 7 cycles/limb, unstable timing, at least on early Pentium4 silicon
+C (stepping 10).
-C This code represents a step forwards compared to the code available before
-C GMP 5.1, but it is not carefully tuned for either P6 or P4. In fact, it is
-C not good for P6. For P4 it saved a bit over 1 c/l for both Northwood and
-C Prescott compared to the old code.
+
+C mp_limb_t mpn_submul_1 (mp_ptr dst, mp_srcptr src, mp_size_t size,
+C mp_limb_t mult);
+C mp_limb_t mpn_submul_1c (mp_ptr dst, mp_srcptr src, mp_size_t size,
+C mp_limb_t mult, mp_limb_t carry);
+C
+C This code is not particularly good at 7 c/l. The dependent chain is only
+C 4 c/l and there's only 4 MMX unit instructions, so it's not clear why that
+C speed isn't achieved.
C
C The arrangements made here to get a two instruction dependent chain are
-C slightly subtle. In the loop the carry (or borrow rather) is a negative so
-C that a paddq can be used to give a low limb ready to store, and a high limb
-C ready to become the new carry after a psrlq.
+C slightly subtle. In the loop the carry (or borrow rather) is a negative
+C so that a paddq can be used to give a low limb ready to store, and a high
+C limb ready to become the new carry after a psrlq.
C
-C If the carry was a simple twos complement negative then the psrlq shift would
-C need to bring in 0 bits or 1 bits according to whether the high was zero or
-C non-zero, since a non-zero value would represent a negative needing sign
-C extension. That wouldn't be particularly easy to arrange and certainly would
-C add an instruction to the dependent chain, so instead an offset is applied so
-C that the high limb will be 0xFFFFFFFF+c. With c in the range -0xFFFFFFFF to
-C 0, the value 0xFFFFFFFF+c is in the range 0 to 0xFFFFFFFF and is therefore
-C always positive and can always have 0 bits shifted in, which is what psrlq
-C does.
+C If the carry was a simple twos complement negative then the psrlq shift
+C would need to bring in 0 bits or 1 bits according to whether the high was
+C zero or non-zero, since a non-zero value would represent a negative
+C needing sign extension. That wouldn't be particularly easy to arrange and
+C certainly would add an instruction to the dependent chain, so instead an
+C offset is applied so that the high limb will be 0xFFFFFFFF+c. With c in
+C the range -0xFFFFFFFF to 0, the value 0xFFFFFFFF+c is in the range 0 to
+C 0xFFFFFFFF and is therefore always positive and can always have 0 bits
+C shifted in, which is what psrlq does.
C
C The extra 0xFFFFFFFF must be subtracted before c is used, but that can be
C done off the dependent chain. The total adjustment then is to add
-C 0xFFFFFFFF00000000 to offset the new carry, and subtract 0x00000000FFFFFFFF
-C to remove the offset from the current carry, for a net add of
-C 0xFFFFFFFE00000001. In the code this is applied to the destination limb when
-C fetched.
+C 0xFFFFFFFF00000000 to offset the new carry, and subtract
+C 0x00000000FFFFFFFF to remove the offset from the current carry, for a net
+C add of 0xFFFFFFFE00000001. In the code this is applied to the destination
+C limb when fetched.
C
C It's also possible to view the 0xFFFFFFFF adjustment as a ones-complement
C negative, which is how it's undone for the return value, but that doesn't
@@ -91,16 +80,16 @@ deflit(`FRAME',0)
pxor %mm1, %mm1 C initial borrow
L(start_1c):
- mov PARAM_SRC, %eax
+ movl PARAM_SRC, %eax
pcmpeqd %mm0, %mm0
movd PARAM_MULTIPLIER, %mm7
pcmpeqd %mm6, %mm6
- mov PARAM_DST, %edx
+ movl PARAM_DST, %edx
psrlq $32, %mm0 C 0x00000000FFFFFFFF
- mov PARAM_SIZE, %ecx
+ movl PARAM_SIZE, %ecx
psllq $32, %mm6 C 0xFFFFFFFF00000000
psubq %mm0, %mm6 C 0xFFFFFFFE00000001
@@ -108,75 +97,32 @@ L(start_1c):
psubq %mm1, %mm0 C 0xFFFFFFFF - borrow
- movd (%eax), %mm3 C up
- movd (%edx), %mm4 C rp
-
- add $-1, %ecx
- paddq %mm6, %mm4 C add 0xFFFFFFFE00000001
- pmuludq %mm7, %mm3
- jnz L(gt1)
- psubq %mm3, %mm4 C prod
- paddq %mm4, %mm0 C borrow
- movd %mm0, (%edx) C result
- jmp L(rt)
-
-L(gt1): movd 4(%eax), %mm1 C up
- movd 4(%edx), %mm2 C rp
-
- add $-1, %ecx
- jz L(eev)
-
- ALIGN(16)
-L(top): paddq %mm6, %mm2 C add 0xFFFFFFFE00000001
+ C eax src, incrementing
+ C ebx
+ C ecx loop counter, decrementing
+ C edx dst, incrementing
+ C
+ C mm0 0xFFFFFFFF - borrow
+ C mm6 0xFFFFFFFE00000001
+ C mm7 multiplier
+
+L(loop):
+ movd (%eax), %mm1 C src
+ leal 4(%eax), %eax
+ movd (%edx), %mm2 C dst
+ paddq %mm6, %mm2 C add 0xFFFFFFFE00000001
pmuludq %mm7, %mm1
- psubq %mm3, %mm4 C prod
- movd 8(%eax), %mm3 C up
- paddq %mm4, %mm0 C borrow
- movd 8(%edx), %mm4 C rp
- movd %mm0, (%edx) C result
- psrlq $32, %mm0
-
- add $-1, %ecx
- jz L(eod)
-
- paddq %mm6, %mm4 C add 0xFFFFFFFE00000001
- pmuludq %mm7, %mm3
psubq %mm1, %mm2 C prod
- movd 12(%eax), %mm1 C up
paddq %mm2, %mm0 C borrow
- movd 12(%edx), %mm2 C rp
- movd %mm0, 4(%edx) C result
- psrlq $32, %mm0
-
- lea 8(%eax), %eax
- lea 8(%edx), %edx
- add $-1, %ecx
- jnz L(top)
-
-
-L(eev): paddq %mm6, %mm2 C add 0xFFFFFFFE00000001
- pmuludq %mm7, %mm1
- psubq %mm3, %mm4 C prod
- paddq %mm4, %mm0 C borrow
+ subl $1, %ecx
movd %mm0, (%edx) C result
psrlq $32, %mm0
- psubq %mm1, %mm2 C prod
- paddq %mm2, %mm0 C borrow
- movd %mm0, 4(%edx) C result
-L(rt): psrlq $32, %mm0
+ leal 4(%edx), %edx
+ jnz L(loop)
+
movd %mm0, %eax
- not %eax
+ notl %eax
emms
ret
-L(eod): paddq %mm6, %mm4 C add 0xFFFFFFFE00000001
- pmuludq %mm7, %mm3
- psubq %mm1, %mm2 C prod
- paddq %mm2, %mm0 C borrow
- movd %mm0, 4(%edx) C result
- psrlq $32, %mm0
- psubq %mm3, %mm4 C prod
- paddq %mm4, %mm0 C borrow
- movd %mm0, 8(%edx) C result
- jmp L(rt)
EPILOGUE()
diff --git a/gmp/mpn/x86/rshift.asm b/gmp/mpn/x86/rshift.asm
index a60dcaa4b2..8e33eabd61 100644
--- a/gmp/mpn/x86/rshift.asm
+++ b/gmp/mpn/x86/rshift.asm
@@ -1,43 +1,33 @@
dnl x86 mpn_rshift -- mpn right shift.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1992, 1994, 1996, 1999, 2000, 2001, 2002 Free Software
+dnl Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 P54 7.5
-C P55 7.0
-C P6 2.5
-C K6 4.5
-C K7 5.0
-C P4 16.5
+C P54: 7.5
+C P55: 7.0
+C P6: 2.5
+C K6: 4.5
+C K7: 5.0
+C P4: 16.5
C mp_limb_t mpn_rshift (mp_ptr dst, mp_srcptr src, mp_size_t size,
diff --git a/gmp/mpn/x86/sec_tabselect.asm b/gmp/mpn/x86/sec_tabselect.asm
deleted file mode 100644
index c7c2e059f1..0000000000
--- a/gmp/mpn/x86/sec_tabselect.asm
+++ /dev/null
@@ -1,115 +0,0 @@
-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()
diff --git a/gmp/mpn/x86/sqr_basecase.asm b/gmp/mpn/x86/sqr_basecase.asm
index 39f8a89805..9a7e13327b 100644
--- a/gmp/mpn/x86/sqr_basecase.asm
+++ b/gmp/mpn/x86/sqr_basecase.asm
@@ -1,43 +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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
+dnl it under the terms of the GNU Lesser General Public License as published
+dnl by the Free Software Foundation; either version 3 of the License, or (at
+dnl your option) any later version.
dnl
dnl The GNU MP Library is distributed in the hope that it will be useful, but
dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
dnl
-dnl You should have received copies of the GNU General Public 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 You should have received 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/crossproduct cycles/triangleproduct
-C P5
-C P6
-C K6
-C K7
-C P4
+C P5:
+C P6:
+C K6:
+C K7:
+C P4:
C void mpn_sqr_basecase (mp_ptr dst, mp_srcptr src, mp_size_t size);
diff --git a/gmp/mpn/x86/t-zdisp.sh b/gmp/mpn/x86/t-zdisp.sh
index 61efdd6c4f..6c55067b6c 100755
--- a/gmp/mpn/x86/t-zdisp.sh
+++ b/gmp/mpn/x86/t-zdisp.sh
@@ -2,31 +2,20 @@
#
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: cd $(builddir)/mpn
diff --git a/gmp/mpn/x86/t-zdisp2.pl b/gmp/mpn/x86/t-zdisp2.pl
index b441b6579a..d5e2d93dc0 100755
--- a/gmp/mpn/x86/t-zdisp2.pl
+++ b/gmp/mpn/x86/t-zdisp2.pl
@@ -2,31 +2,20 @@
#
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: cd $(builddir)/mpn
@@ -82,7 +71,7 @@ sub process {
}
}
-# Ensure we're using the right SQR_TOOM2_THRESHOLD for the part of the
+# Ensure we're using the right SQR_KARATSUBA_THRESHOLD for the part of the
# tree being processed.
sub process_mparam {
my $file = "$File::Find::dir/gmp-mparam.h";
@@ -90,10 +79,10 @@ sub process_mparam {
print "$file\n" if $opt{'t'};
open MPARAM, "<$file" or die;
while (<MPARAM>) {
- if (/^#define SQR_TOOM2_THRESHOLD[ \t]*([0-9][0-9]*)/) {
+ if (/^#define SQR_KARATSUBA_THRESHOLD[ \t]*([0-9][0-9]*)/) {
open KARA, ">$tempfile" or die;
- print KARA "define(\`SQR_TOOM2_THRESHOLD',$1)\n\n";
- print "define(\`SQR_TOOM2_THRESHOLD',$1)\n" if $opt{'t'};
+ print KARA "define(\`SQR_KARATSUBA_THRESHOLD',$1)\n\n";
+ print "define(\`SQR_KARATSUBA_THRESHOLD',$1)\n" if $opt{'t'};
close KARA or die;
last;
}
diff --git a/gmp/mpn/x86/udiv.asm b/gmp/mpn/x86/udiv.asm
index a3ee08860f..5c7d3f3533 100644
--- a/gmp/mpn/x86/udiv.asm
+++ b/gmp/mpn/x86/udiv.asm
@@ -1,32 +1,21 @@
dnl x86 mpn_udiv_qrnnd -- 2 by 1 limb division
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/umul.asm b/gmp/mpn/x86/umul.asm
index 34fe434400..d0116de6d9 100644
--- a/gmp/mpn/x86/umul.asm
+++ b/gmp/mpn/x86/umul.asm
@@ -1,32 +1,21 @@
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/mpn/x86/x86-defs.m4 b/gmp/mpn/x86/x86-defs.m4
index 1538b6820c..5b4a8e1fad 100644
--- a/gmp/mpn/x86/x86-defs.m4
+++ b/gmp/mpn/x86/x86-defs.m4
@@ -4,33 +4,23 @@ divert(-1)
dnl m4 macros for x86 assembler.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2007 Free Software Foundation,
+dnl Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
dnl Notes:
@@ -51,7 +41,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(GMP_LIMB_BYTES, 4)
+deflit(BYTES_PER_MP_LIMB, 4)
dnl Libtool gives -DPIC -DDLL_EXPORT to indicate a cygwin or mingw DLL. We
@@ -68,41 +58,24 @@ dnl order they appear in that structure.
define(CPUVEC_FUNCS_LIST,
``add_n',
-`addlsh1_n',
-`addlsh2_n',
`addmul_1',
-`addmul_2',
-`bdiv_dbm1c',
-`cnd_add_n',
-`cnd_sub_n',
-`com',
`copyd',
`copyi',
`divexact_1',
+`divexact_by3c',
`divrem_1',
`gcd_1',
`lshift',
-`lshiftc',
`mod_1',
-`mod_1_1p',
-`mod_1_1p_cps',
-`mod_1s_2p',
-`mod_1s_2p_cps',
-`mod_1s_4p',
-`mod_1s_4p_cps',
`mod_34lsub1',
`modexact_1c_odd',
`mul_1',
`mul_basecase',
-`mullo_basecase',
`preinv_divrem_1',
`preinv_mod_1',
-`redc_1',
-`redc_2',
`rshift',
`sqr_basecase',
`sub_n',
-`sublsh1_n',
`submul_1'')
@@ -922,7 +895,7 @@ dnl movl_code_address(L(foo),%eax)
dnl
dnl This macro is only meant for use in ASSERT()s or when testing, since
dnl the PIC sequence it generates will want to be done with a ret balancing
-dnl the call on CPUs with return address branch prediction.
+dnl the call on CPUs with return address branch predition.
dnl
dnl The addl generated here has a backward reference to the label, and so
dnl won't suffer from the two forwards references bug in old gas (described
@@ -955,9 +928,7 @@ m4_assert_numargs(1)
dnl Usage LEA(symbol,reg)
-define(`LEA',
-m4_assert_numargs(2)
-`ifdef(`PIC',`
+define(`LEA',`
define(`EPILOGUE_cpu',
`
L(movl_eip_`'substr($2,1)):
@@ -965,12 +936,11 @@ L(movl_eip_`'substr($2,1)):
ret_internal
SIZE($'`1, .-$'`1)')
- call L(movl_eip_`'substr($2,1))
- addl $_GLOBAL_OFFSET_TABLE_, $2
- movl $1@GOT($2), $2
-',`
- movl `$'$1, $2
-')')
+ call L(movl_eip_`'substr($2,1))
+ addl $_GLOBAL_OFFSET_TABLE_, $2
+ movl $1@GOT($2), $2
+')
+
define(`DEF_OBJECT',
m4_assert_numargs_range(1,2)
@@ -983,17 +953,4 @@ define(`END_OBJECT',
m4_assert_numargs(1)
` SIZE(`$1',.-`$1')')
-dnl Usage: CALL(funcname)
-dnl
-
-define(`CALL',
-m4_assert_numargs(1)
-`ifdef(`PIC',
- `call GSYM_PREFIX`'$1@PLT',
- `call GSYM_PREFIX`'$1')')
-
-ifdef(`PIC',
-`define(`PIC_WITH_EBX')',
-`undefine(`PIC_WITH_EBX')')
-
divert`'dnl
diff --git a/gmp/mpn/x86_64/README b/gmp/mpn/x86_64/README
index 9c8a586622..c89f841027 100644
--- a/gmp/mpn/x86_64/README
+++ b/gmp/mpn/x86_64/README
@@ -3,28 +3,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/mpn/x86_64/addaddmul_1msb0.asm b/gmp/mpn/x86_64/addaddmul_1msb0.asm
index 87c21b4aca..89e7bed980 100644
--- a/gmp/mpn/x86_64/addaddmul_1msb0.asm
+++ b/gmp/mpn/x86_64/addaddmul_1msb0.asm
@@ -3,41 +3,26 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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.167
-C AMD K10 2.167
-C Intel P4 12.0
-C Intel core2 4.0
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
+C K8: 2.167
+C P4: 12.0
+C P6-15: 4.0
C TODO
C * Perhaps handle various n mod 3 sizes better. The code now is too large.
@@ -82,7 +67,7 @@ L(top): mul %r9
mul %r8
add %rax, %r10
mov -16(bp,n,8), %rax
- mov $0, R32(%r11)
+ mov $0, %r11d
adc %rdx, %r11
mul %r9
add %rax, %r10
@@ -92,7 +77,7 @@ L(top): mul %r9
mul %r8
add %rax, %r11
mov -8(bp,n,8), %rax
- mov $0, R32(%r12)
+ mov $0, %r12d
adc %rdx, %r12
mul %r9
add %rax, %r11
@@ -102,7 +87,7 @@ L(top): mul %r9
add %rax, %r12
mov %r11, -8(rp,n,8)
mov (bp,n,8), %rax
- mov $0, R32(%r10)
+ mov $0, %r10d
adc %rdx, %r10
add $3, n
js L(top)
@@ -119,7 +104,7 @@ L(end): cmp $1, R32(n)
mul %r8
add %rax, %r10
mov -16(bp), %rax
- mov $0, R32(%r11)
+ mov $0, %r11d
adc %rdx, %r11
mul %r9
add %rax, %r10
@@ -129,7 +114,7 @@ L(end): cmp $1, R32(n)
mul %r8
add %rax, %r11
mov -8(bp), %rax
- mov $0, R32(%r12)
+ mov $0, %r12d
adc %rdx, %r12
mul %r9
add %rax, %r11
@@ -148,7 +133,7 @@ L(end): cmp $1, R32(n)
mul %r8
add %rax, %r10
mov -8(bp), %rax
- mov $0, R32(%r11)
+ mov $0, %r11d
adc %rdx, %r11
mul %r9
add %rax, %r10
diff --git a/gmp/mpn/x86_64/aorrlsh1_n.asm b/gmp/mpn/x86_64/addlsh1_n.asm
index 6ee0872823..e142f9ef9e 100644
--- a/gmp/mpn/x86_64/aorrlsh1_n.asm
+++ b/gmp/mpn/x86_64/addlsh1_n.asm
@@ -1,55 +1,37 @@
dnl AMD64 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
-dnl AMD64 mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
-dnl Copyright 2003, 2005-2009, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2005, 2006, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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
-C AMD K10 2
-C AMD bd1 ?
-C AMD bobcat ?
-C Intel P4 13
-C Intel core2 3.45
-C Intel NHM ?
-C Intel SBR ?
-C Intel atom ?
-C VIA nano ?
+C K8,K9: 2
+C K10: 2
+C P4: 13
+C P6-15: 3.45
C Sometimes speed degenerates, supposedly related to that some operand
C alignments cause cache conflicts.
C The speed is limited by decoding/issue bandwidth. There are 22 instructions
-C in the loop, which corresponds to ceil(22/3)/4 = 1.83 c/l.
+C in the loop, which corresponds to ceil(26/3)/4 = 2.0 c/l.
C INPUT PARAMETERS
define(`rp',`%rdi')
@@ -57,25 +39,10 @@ define(`up',`%rsi')
define(`vp',`%rdx')
define(`n', `%rcx')
-ifdef(`OPERATION_addlsh1_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func, mpn_addlsh1_n)')
-ifdef(`OPERATION_rsblsh1_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func, mpn_rsblsh1_n)')
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_rsblsh1_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(16)
-PROLOGUE(func)
- FUNC_ENTRY(4)
+PROLOGUE(mpn_addlsh1_n)
push %rbp
mov (vp), %r8
@@ -97,11 +64,11 @@ L(b11): add %r8, %r8
mov 16(vp,n,8), %r10
adc %r10, %r10
sbb R32(%rax), R32(%rax) C save scy
- ADDSUB (up,n,8), %r8
- ADCSBB 8(up,n,8), %r9
+ add (up,n,8), %r8
+ adc 8(up,n,8), %r9
mov %r8, (rp,n,8)
mov %r9, 8(rp,n,8)
- ADCSBB 16(up,n,8), %r10
+ adc 16(up,n,8), %r10
mov %r10, 16(rp,n,8)
sbb R32(%rbp), R32(%rbp) C save acy
add $3, n
@@ -111,8 +78,8 @@ L(b10): add %r8, %r8
mov 8(vp,n,8), %r9
adc %r9, %r9
sbb R32(%rax), R32(%rax) C save scy
- ADDSUB (up,n,8), %r8
- ADCSBB 8(up,n,8), %r9
+ add (up,n,8), %r8
+ adc 8(up,n,8), %r9
mov %r8, (rp,n,8)
mov %r9, 8(rp,n,8)
sbb R32(%rbp), R32(%rbp) C save acy
@@ -121,7 +88,7 @@ L(b10): add %r8, %r8
L(b01): add %r8, %r8
sbb R32(%rax), R32(%rax) C save scy
- ADDSUB (up,n,8), %r8
+ add (up,n,8), %r8
mov %r8, (rp,n,8)
sbb R32(%rbp), R32(%rbp) C save acy
inc n
@@ -142,13 +109,13 @@ L(b00): adc %r8, %r8
sbb R32(%rax), R32(%rax) C save scy
add R32(%rbp), R32(%rbp) C restore acy
- ADCSBB (up,n,8), %r8
+ adc (up,n,8), %r8
nop C Hammer speedup!
- ADCSBB 8(up,n,8), %r9
+ adc 8(up,n,8), %r9
mov %r8, (rp,n,8)
mov %r9, 8(rp,n,8)
- ADCSBB 16(up,n,8), %r10
- ADCSBB 24(up,n,8), %r11
+ adc 16(up,n,8), %r10
+ adc 24(up,n,8), %r11
mov %r10, 16(rp,n,8)
mov %r11, 24(rp,n,8)
@@ -156,15 +123,9 @@ L(b00): adc %r8, %r8
add $4, n
js L(top)
-L(end):
-ifdef(`OPERATION_addlsh1_n',`
- add R32(%rbp), R32(%rax)
- neg R32(%rax)')
-ifdef(`OPERATION_rsblsh1_n',`
- sub R32(%rax), R32(%rbp)
- movslq R32(%rbp), %rax')
+L(end): add R32(%rbp), R32(%rax)
+ neg R32(%rax)
pop %rbp
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/addmul_2.asm b/gmp/mpn/x86_64/addmul_2.asm
index 18307d719f..8f133c3b00 100644
--- a/gmp/mpn/x86_64/addmul_2.asm
+++ b/gmp/mpn/x86_64/addmul_2.asm
@@ -1,51 +1,39 @@
dnl AMD64 mpn_addmul_2 -- Multiply an n-limb vector with a 2-limb vector and
dnl add the result to a third limb vector.
-dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2008 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 NHM 4.32
-C Intel SBR 3.4
-C Intel atom ?
-C VIA nano 4.4
+C K8,K9: 2.375
+C K10: 2.375
+C P4: ?
+C P6-15: 4.45
C This code is the result of running a code generation and optimization tool
C suite written by David Harvey and Torbjorn Granlund.
C TODO
-C * Tune feed-in and wind-down code.
+C * Work on feed-in and wind-down code.
+C * Convert "mov $0" to "xor".
+C * Adjust initial lea to save some bytes.
+C * Perhaps adjust n from n_param&3 value?
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -61,124 +49,119 @@ 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)
- mov n_param, n
push %rbx
push %rbp
- mov 0(vp), v0
+ mov (vp), v0
mov 8(vp), v1
- mov R32(n_param), R32(%rbx)
- mov (up), %rax
- lea -8(up,n_param,8), up
- lea -8(rp,n_param,8), rp
- mul v0
+ mov n_param, n
neg n
- and $3, R32(%rbx)
- jz L(b0)
- cmp $2, R32(%rbx)
- jc L(b1)
- jz L(b2)
-
-L(b3): mov %rax, w1
+ lea -32(up,n_param,8), up
+ lea -32(rp,n_param,8), rp
+
+ and $3, R32(n_param)
+ jz L(am2p0)
+ cmp $2, R32(n_param)
+ jc L(am2p1)
+ jz L(am2p2)
+L(am2p3):
+ mov 32(up,n,8), %rax
+ mul v0
+ mov %rax, w1
+ mov 32(up,n,8), %rax
mov %rdx, w2
xor R32(w3), R32(w3)
- mov 8(up,n,8), %rax
- dec n
- jmp L(lo3)
-
-L(b2): mov %rax, w2
- mov 8(up,n,8), %rax
- mov %rdx, w3
- xor R32(w0), R32(w0)
- add $-2, n
- jmp L(lo2)
-
-L(b1): mov %rax, w3
- mov 8(up,n,8), %rax
- mov %rdx, w0
- xor R32(w1), R32(w1)
- inc n
- jmp L(lo1)
-
-L(b0): mov $0, R32(w3)
+ add $2, n
+ jmp L(am3)
+L(am2p0):
+ mov 32(up,n,8), %rax
+ mul v0
mov %rax, w0
- mov 8(up,n,8), %rax
+ mov 32(up,n,8), %rax
mov %rdx, w1
xor R32(w2), R32(w2)
- jmp L(lo0)
+ add $3, n
+ jmp L(am0)
+L(am2p1):
+ mov 32(up,n,8), %rax
+ mul v0
+ mov %rax, w3
+ mov 32(up,n,8), %rax
+ mov %rdx, w0
+ xor R32(w1), R32(w1)
+ jmp L(am1)
+L(am2p2):
+ mov 32(up,n,8), %rax
+ mul v0
+ mov %rax, w2
+ mov 32(up,n,8), %rax
+ mov %rdx, w3
+ xor R32(w0), R32(w0)
+ xor R32(w1), R32(w1)
+ add $1, n
+ jmp L(am2)
ALIGN(32)
-L(top): mov $0, R32(w1)
- mul v0
- add %rax, w3
- mov (up,n,8), %rax
- adc %rdx, w0
- adc $0, R32(w1)
-L(lo1): mul v1
+L(top):
add w3, (rp,n,8)
- mov $0, R32(w3)
adc %rax, w0
- mov $0, R32(w2)
mov 8(up,n,8), %rax
adc %rdx, w1
+ mov $0, R32(w2)
mul v0
add %rax, w0
mov 8(up,n,8), %rax
adc %rdx, w1
adc $0, R32(w2)
-L(lo0): mul v1
+L(am0): mul v1
add w0, 8(rp,n,8)
adc %rax, w1
adc %rdx, w2
mov 16(up,n,8), %rax
+ mov $0, R32(w3)
mul v0
add %rax, w1
+ mov 16(up,n,8), %rax
adc %rdx, w2
adc $0, R32(w3)
- mov 16(up,n,8), %rax
-L(lo3): mul v1
+L(am3): mul v1
add w1, 16(rp,n,8)
adc %rax, w2
- adc %rdx, w3
- xor R32(w0), R32(w0)
mov 24(up,n,8), %rax
+ adc %rdx, w3
mul v0
+ mov $0, R32(w0)
add %rax, w2
- mov 24(up,n,8), %rax
adc %rdx, w3
+ mov $0, R32(w1)
+ mov 24(up,n,8), %rax
adc $0, R32(w0)
-L(lo2): mul v1
+L(am2): mul v1
add w2, 24(rp,n,8)
adc %rax, w3
adc %rdx, w0
mov 32(up,n,8), %rax
- add $4, n
- js L(top)
-
-L(end): xor R32(w1), R32(w1)
mul v0
add %rax, w3
- mov (up), %rax
+ mov 32(up,n,8), %rax
adc %rdx, w0
- adc R32(w1), R32(w1)
- mul v1
- add w3, (rp)
+ adc $0, R32(w1)
+L(am1): mul v1
+ add $4, n
+ js L(top)
+
+ add w3, (rp,n,8)
adc %rax, w0
adc %rdx, w1
- mov w0, 8(rp)
+ mov w0, 8(rp,n,8)
mov w1, %rax
pop %rbp
pop %rbx
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/aorrlsh2_n.asm b/gmp/mpn/x86_64/aorrlsh2_n.asm
deleted file mode 100644
index 999e972fb4..0000000000
--- a/gmp/mpn/x86_64/aorrlsh2_n.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl AMD64 mpn_addlsh2_n -- rp[] = up[] + (vp[] << 2)
-dnl AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 2) - up[]
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-define(LSH, 2)
-define(RSH, 62)
-
-ifdef(`OPERATION_addlsh2_n',`
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func, mpn_addlsh2_n)')
-ifdef(`OPERATION_rsblsh2_n',`
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func, mpn_rsblsh2_n)')
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_rsblsh2_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-include_mpn(`x86_64/aorrlshC_n.asm')
diff --git a/gmp/mpn/x86_64/aorrlshC_n.asm b/gmp/mpn/x86_64/aorrlshC_n.asm
deleted file mode 100644
index 5a9fd4dfb9..0000000000
--- a/gmp/mpn/x86_64/aorrlshC_n.asm
+++ /dev/null
@@ -1,160 +0,0 @@
-dnl AMD64 mpn_addlshC_n -- rp[] = up[] + (vp[] << C)
-dnl AMD64 mpn_rsblshC_n -- rp[] = (vp[] << C) - up[]
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 2
-C AMD K10 2
-C Intel P4 ?
-C Intel core2 3
-C Intel NHM 2.75
-C Intel SBR 2.55
-C Intel atom ?
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-
-define(M, eval(m4_lshift(1,LSH)))
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
- FUNC_ENTRY(4)
- push %r12
- push %r13
- push %r14
- push %r15
-
- mov (vp), %r8
- lea (,%r8,M), %r12
- shr $RSH, %r8
-
- mov R32(n), R32(%rax)
- lea (rp,n,8), rp
- lea (up,n,8), up
- lea (vp,n,8), vp
- neg n
- and $3, R8(%rax)
- je L(b00)
- cmp $2, R8(%rax)
- jc L(b01)
- je L(b10)
-
-L(b11): mov 8(vp,n,8), %r10
- lea (%r8,%r10,M), %r14
- shr $RSH, %r10
- mov 16(vp,n,8), %r11
- lea (%r10,%r11,M), %r15
- shr $RSH, %r11
- ADDSUB (up,n,8), %r12
- ADCSBB 8(up,n,8), %r14
- ADCSBB 16(up,n,8), %r15
- sbb R32(%rax), R32(%rax) C save carry for next
- mov %r12, (rp,n,8)
- mov %r14, 8(rp,n,8)
- mov %r15, 16(rp,n,8)
- add $3, n
- js L(top)
- jmp L(end)
-
-L(b01): mov %r8, %r11
- ADDSUB (up,n,8), %r12
- sbb R32(%rax), R32(%rax) C save carry for next
- mov %r12, (rp,n,8)
- add $1, n
- js L(top)
- jmp L(end)
-
-L(b10): mov 8(vp,n,8), %r11
- lea (%r8,%r11,M), %r15
- shr $RSH, %r11
- ADDSUB (up,n,8), %r12
- ADCSBB 8(up,n,8), %r15
- sbb R32(%rax), R32(%rax) C save carry for next
- mov %r12, (rp,n,8)
- mov %r15, 8(rp,n,8)
- add $2, n
- js L(top)
- jmp L(end)
-
-L(b00): mov 8(vp,n,8), %r9
- mov 16(vp,n,8), %r10
- jmp L(e00)
-
- ALIGN(16)
-L(top): mov 16(vp,n,8), %r10
- mov (vp,n,8), %r8
- mov 8(vp,n,8), %r9
- lea (%r11,%r8,M), %r12
- shr $RSH, %r8
-L(e00): lea (%r8,%r9,M), %r13
- shr $RSH, %r9
- mov 24(vp,n,8), %r11
- lea (%r9,%r10,M), %r14
- shr $RSH, %r10
- lea (%r10,%r11,M), %r15
- shr $RSH, %r11
- add R32(%rax), R32(%rax) C restore carry
- ADCSBB (up,n,8), %r12
- ADCSBB 8(up,n,8), %r13
- ADCSBB 16(up,n,8), %r14
- ADCSBB 24(up,n,8), %r15
- mov %r12, (rp,n,8)
- mov %r13, 8(rp,n,8)
- mov %r14, 16(rp,n,8)
- sbb R32(%rax), R32(%rax) C save carry for next
- mov %r15, 24(rp,n,8)
- add $4, n
- js L(top)
-L(end):
-
-ifelse(ADDSUB,add,`
- sub R32(%r11), R32(%rax)
- neg R32(%rax)
-',`
- add R32(%r11), R32(%rax)
- movslq R32(%rax), %rax
-')
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/aorrlsh_n.asm b/gmp/mpn/x86_64/aorrlsh_n.asm
index 5ca128fbf3..55176f7aa1 100644
--- a/gmp/mpn/x86_64/aorrlsh_n.asm
+++ b/gmp/mpn/x86_64/aorrlsh_n.asm
@@ -1,45 +1,32 @@
dnl AMD64 mpn_addlsh_n and mpn_rsblsh_n. R = V2^k +- U.
+dnl ("rsb" means reversed subtract, name mandated by mpn_sublsh1_n which
+dnl subtacts the shifted operand from the unshifted operand.)
-dnl Copyright 2006, 2010-2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 3.1 < 3.85 for lshift + add_n
-C AMD K10 3.1 < 3.85 for lshift + add_n
-C Intel P4 14.6 > 7.33 for lshift + add_n
-C Intel core2 3.87 > 3.27 for lshift + add_n
-C Intel NHM 4 > 3.75 for lshift + add_n
-C Intel SBR (5.8) > 3.46 for lshift + add_n
-C Intel atom (7.75) < 8.75 for lshift + add_n
-C VIA nano 4.7 < 6.25 for lshift + add_n
+C K8,K9: 3.25 (mpn_lshift + mpn_add_n costs about 4.1 c/l)
+C K10: 3.25 (mpn_lshift + mpn_add_n costs about 4.1 c/l)
+C P4: 14
+C P6-15: 4
C This was written quickly and not optimized at all. Surely one could get
C closer to 3 c/l or perhaps even under 3 c/l. Ideas:
@@ -54,67 +41,65 @@ define(`rp', `%rdi')
define(`up', `%rsi')
define(`vp', `%rdx')
define(`n', `%rcx')
-define(`cnt', `%r8')
+define(`cnt' `%r8')
ifdef(`OPERATION_addlsh_n',`
- define(ADCSBB, `adc')
+ define(ADDSUBC, `adc')
define(func, mpn_addlsh_n)
')
ifdef(`OPERATION_rsblsh_n',`
- define(ADCSBB, `sbb')
+ define(ADDSUBC, `sbb')
define(func, mpn_rsblsh_n)
')
MULFUNC_PROLOGUE(mpn_addlsh_n mpn_rsblsh_n)
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(func)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ')
+
push %r12
push %r13
push %r14
- push %rbp
+ push %r15
push %rbx
mov n, %rax
- xor R32(%rbx), R32(%rbx) C clear carry save register
- mov R32(%r8), R32(%rcx) C shift count
- xor R32(%rbp), R32(%rbp) C limb carry
+ xor %ebx, %ebx C clear carry save register
+ mov %r8d, %ecx C shift count
+ xor %r15d, %r15d C limb carry
- mov R32(%rax), R32(%r11)
- and $3, R32(%r11)
+ mov %eax, %r11d
+ and $3, %r11d
je L(4)
- sub $1, R32(%r11)
+ sub $1, %r11d
-L(012): mov (vp), %r8
+L(oopette):
+ mov 0(vp), %r8
mov %r8, %r12
- shl R8(%rcx), %r8
- or %rbp, %r8
- neg R8(%rcx)
- mov %r12, %rbp
- shr R8(%rcx), %rbp
- neg R8(%rcx)
- add R32(%rbx), R32(%rbx)
- ADCSBB (up), %r8
- mov %r8, (rp)
- sbb R32(%rbx), R32(%rbx)
+ shl %cl, %r8
+ or %r15, %r8
+ neg %cl
+ mov %r12, %r15
+ shr %cl, %r15
+ neg %cl
+ add %ebx, %ebx
+ ADDSUBC 0(up), %r8
+ mov %r8, 0(rp)
+ sbb %ebx, %ebx
lea 8(up), up
lea 8(vp), vp
lea 8(rp), rp
- sub $1, R32(%r11)
- jnc L(012)
+ sub $1, %r11d
+ jnc L(oopette)
-L(4): sub $4, %rax
+L(4):
+ sub $4, %rax
jc L(end)
- ALIGN(16)
-L(top): mov (vp), %r8
+L(oop):
+ mov 0(vp), %r8
mov %r8, %r12
mov 8(vp), %r9
mov %r9, %r13
@@ -122,55 +107,55 @@ L(top): mov (vp), %r8
mov %r10, %r14
mov 24(vp), %r11
- shl R8(%rcx), %r8
- shl R8(%rcx), %r9
- shl R8(%rcx), %r10
- or %rbp, %r8
- mov %r11, %rbp
- shl R8(%rcx), %r11
+ shl %cl, %r8
+ shl %cl, %r9
+ shl %cl, %r10
+ or %r15, %r8
+ mov %r11, %r15
+ shl %cl, %r11
- neg R8(%rcx)
+ neg %cl
- shr R8(%rcx), %r12
- shr R8(%rcx), %r13
- shr R8(%rcx), %r14
- shr R8(%rcx), %rbp C used next iteration
+ shr %cl, %r12
+ shr %cl, %r13
+ shr %cl, %r14
+ shr %cl, %r15 C used next loop
or %r12, %r9
or %r13, %r10
or %r14, %r11
- neg R8(%rcx)
+ neg %cl
- add R32(%rbx), R32(%rbx) C restore carry flag
+ add %ebx, %ebx C restore carry flag
- ADCSBB (up), %r8
- ADCSBB 8(up), %r9
- ADCSBB 16(up), %r10
- ADCSBB 24(up), %r11
+ ADDSUBC 0(up), %r8
+ ADDSUBC 8(up), %r9
+ ADDSUBC 16(up), %r10
+ ADDSUBC 24(up), %r11
- mov %r8, (rp)
+ mov %r8, 0(rp)
mov %r9, 8(rp)
mov %r10, 16(rp)
mov %r11, 24(rp)
- sbb R32(%rbx), R32(%rbx) C save carry flag
+ sbb %ebx, %ebx C save carry flag
lea 32(up), up
lea 32(vp), vp
lea 32(rp), rp
sub $4, %rax
- jnc L(top)
-
-L(end): add R32(%rbx), R32(%rbx)
- ADCSBB $0, %rbp
- mov %rbp, %rax
+ jnc L(oop)
+L(end):
+ add %ebx, %ebx
+ adc $0, %r15
+ mov %r15, %rax
pop %rbx
- pop %rbp
+ pop %r15
pop %r14
pop %r13
pop %r12
- FUNC_EXIT()
+
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/aors_err1_n.asm b/gmp/mpn/x86_64/aors_err1_n.asm
deleted file mode 100644
index 54d0b3f9b7..0000000000
--- a/gmp/mpn/x86_64/aors_err1_n.asm
+++ /dev/null
@@ -1,225 +0,0 @@
-dnl AMD64 mpn_add_err1_n, mpn_sub_err1_n
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 (degenerates to 3 c/l for some alignments)
-C AMD K10 ?
-C Intel P4 ?
-C Intel core2 ?
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
-
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`ep', `%rcx')
-define(`yp', `%r8')
-define(`n', `%r9')
-define(`cy_param', `8(%rsp)')
-
-define(`el', `%rbx')
-define(`eh', `%rbp')
-define(`t0', `%r10')
-define(`t1', `%r11')
-define(`t2', `%r12')
-define(`t3', `%r13')
-define(`w0', `%r14')
-define(`w1', `%r15')
-
-ifdef(`OPERATION_add_err1_n', `
- define(ADCSBB, adc)
- define(func, mpn_add_err1_n)')
-ifdef(`OPERATION_sub_err1_n', `
- define(ADCSBB, sbb)
- define(func, mpn_sub_err1_n)')
-
-MULFUNC_PROLOGUE(mpn_add_err1_n mpn_sub_err1_n)
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
- mov cy_param, %rax
-
- push %rbx
- push %rbp
- push %r12
- push %r13
- push %r14
- push %r15
-
- lea (up,n,8), up
- lea (vp,n,8), vp
- lea (rp,n,8), rp
-
- mov R32(n), R32(%r10)
- and $3, R32(%r10)
- jz L(0mod4)
- cmp $2, R32(%r10)
- jc L(1mod4)
- jz L(2mod4)
-L(3mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- xor R32(t0), R32(t0)
- xor R32(t1), R32(t1)
- 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
- mov w0, (rp,n,8)
- cmovc 16(yp), el
- 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 w0, 16(rp,n,8)
- cmovc (yp), t1
- setc %al C save carry
- add t0, el
- adc $0, eh
- add t1, el
- adc $0, eh
-
- add $3, n
- jnz L(loop)
- jmp L(end)
-
- ALIGN(16)
-L(0mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- lea (yp,n,8), yp
- neg n
- jmp L(loop)
-
- ALIGN(16)
-L(1mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- 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)
- cmovc (yp), el
- setc %al C save carry
-
- add $1, n
- jnz L(loop)
- jmp L(end)
-
- ALIGN(16)
-L(2mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- xor R32(t0), R32(t0)
- 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)
- cmovc 8(yp), el
- ADCSBB 8(vp,n,8), w1
- mov w1, 8(rp,n,8)
- cmovc (yp), t0
- setc %al C save carry
- add t0, el
- adc $0, eh
-
- add $2, n
- jnz L(loop)
- jmp L(end)
-
- 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)
-
-L(end):
- mov el, (ep)
- mov eh, 8(ep)
-
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/aors_err2_n.asm b/gmp/mpn/x86_64/aors_err2_n.asm
deleted file mode 100644
index ce5c2a49b6..0000000000
--- a/gmp/mpn/x86_64/aors_err2_n.asm
+++ /dev/null
@@ -1,172 +0,0 @@
-dnl AMD64 mpn_add_err2_n, mpn_sub_err2_n
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.5
-C AMD K10 ?
-C Intel P4 ?
-C Intel core2 6.9
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
-
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`ep', `%rcx')
-define(`yp1', `%r8')
-define(`yp2', `%r9')
-define(`n_param', `8(%rsp)')
-define(`cy_param', `16(%rsp)')
-
-define(`cy1', `%r14')
-define(`cy2', `%rax')
-
-define(`n', `%r10')
-
-define(`w', `%rbx')
-define(`e1l', `%rbp')
-define(`e1h', `%r11')
-define(`e2l', `%r12')
-define(`e2h', `%r13')
-
-
-ifdef(`OPERATION_add_err2_n', `
- define(ADCSBB, adc)
- define(func, mpn_add_err2_n)')
-ifdef(`OPERATION_sub_err2_n', `
- define(ADCSBB, sbb)
- define(func, mpn_sub_err2_n)')
-
-MULFUNC_PROLOGUE(mpn_add_err2_n mpn_sub_err2_n)
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
- mov cy_param, cy2
- mov n_param, n
-
- push %rbx
- push %rbp
- push %r12
- push %r13
- push %r14
-
- xor R32(e1l), R32(e1l)
- xor R32(e1h), R32(e1h)
- xor R32(e2l), R32(e2l)
- xor R32(e2h), R32(e2h)
-
- sub yp1, yp2
-
- lea (rp,n,8), rp
- lea (up,n,8), up
- lea (vp,n,8), vp
-
- test $1, n
- jnz L(odd)
-
- lea -8(yp1,n,8), yp1
- neg n
- jmp L(top)
-
- ALIGN(16)
-L(odd):
- lea -16(yp1,n,8), yp1
- neg n
- shr $1, cy2
- mov (up,n,8), w
- ADCSBB (vp,n,8), w
- cmovc 8(yp1), e1l
- cmovc 8(yp1,yp2), e2l
- mov w, (rp,n,8)
- sbb cy2, cy2
- inc n
- jz L(end)
-
- 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)
-L(end):
-
- mov e1l, (ep)
- mov e1h, 8(ep)
- mov e2l, 16(ep)
- mov e2h, 24(ep)
-
- and $1, %eax C return carry
-
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/aors_err3_n.asm b/gmp/mpn/x86_64/aors_err3_n.asm
deleted file mode 100644
index bb6d0c5366..0000000000
--- a/gmp/mpn/x86_64/aors_err3_n.asm
+++ /dev/null
@@ -1,156 +0,0 @@
-dnl AMD64 mpn_add_err3_n, mpn_sub_err3_n
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 7.0
-C AMD K10 ?
-C Intel P4 ?
-C Intel core2 ?
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`ep', `%rcx')
-define(`yp1', `%r8')
-define(`yp2', `%r9')
-define(`yp3_param', `8(%rsp)')
-define(`n_param', `16(%rsp)')
-define(`cy_param', `24(%rsp)')
-
-define(`n', `%r10')
-define(`yp3', `%rcx')
-define(`t', `%rbx')
-
-define(`e1l', `%rbp')
-define(`e1h', `%r11')
-define(`e2l', `%r12')
-define(`e2h', `%r13')
-define(`e3l', `%r14')
-define(`e3h', `%r15')
-
-
-
-ifdef(`OPERATION_add_err3_n', `
- define(ADCSBB, adc)
- define(func, mpn_add_err3_n)')
-ifdef(`OPERATION_sub_err3_n', `
- define(ADCSBB, sbb)
- define(func, mpn_sub_err3_n)')
-
-MULFUNC_PROLOGUE(mpn_add_err3_n mpn_sub_err3_n)
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
- mov cy_param, %rax
- mov n_param, n
-
- push %rbx
- push %rbp
- push %r12
- push %r13
- push %r14
- push %r15
-
- push ep
- mov 64(%rsp), yp3 C load from yp3_param
-
- xor R32(e1l), R32(e1l)
- xor R32(e1h), R32(e1h)
- xor R32(e2l), R32(e2l)
- xor R32(e2h), R32(e2h)
- xor R32(e3l), R32(e3l)
- xor R32(e3h), R32(e3h)
-
- sub yp1, yp2
- sub yp1, yp3
-
- lea -8(yp1,n,8), yp1
- lea (rp,n,8), rp
- lea (up,n,8), up
- lea (vp,n,8), vp
- neg n
-
- ALIGN(16)
-L(top):
- shr $1, %rax C restore carry
- mov (up,n,8), %rax
- ADCSBB (vp,n,8), %rax
- mov %rax, (rp,n,8)
- sbb %rax, %rax C save carry and generate mask
-
- mov (yp1), t
- and %rax, t
- add t, e1l
- adc $0, e1h
-
- mov (yp1,yp2), t
- and %rax, t
- add t, e2l
- adc $0, e2h
-
- mov (yp1,yp3), t
- and %rax, t
- add t, e3l
- adc $0, e3h
-
- lea -8(yp1), yp1
- inc n
- jnz L(top)
-
-L(end):
- and $1, %eax
- pop ep
-
- mov e1l, (ep)
- mov e1h, 8(ep)
- mov e2l, 16(ep)
- mov e2h, 24(ep)
- mov e3l, 32(ep)
- mov e3h, 40(ep)
-
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/aors_n.asm b/gmp/mpn/x86_64/aors_n.asm
index 8941f7a17b..dae5408ba4 100644
--- a/gmp/mpn/x86_64/aors_n.asm
+++ b/gmp/mpn/x86_64/aors_n.asm
@@ -1,57 +1,40 @@
dnl AMD64 mpn_add_n, mpn_sub_n
-dnl Copyright 2003-2005, 2007, 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2004, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1.5
-C AMD K10 1.5
-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.61
-C Intel IBR 1.61
-C Intel atom 4
-C VIA nano 3.25
-
-C The loop of this code is the result of running a code generation and
+C K8,K9: 1.5
+C K10: 1.5
+C P4: ?
+C P6-15 (Core2): 4.9
+C P6-28 (Atom): 4
+
+C The inner 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)
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`vp', `%rdx')
+define(`n', `%rcx')
+define(`cy', `%r8') C (only for mpn_add_nc)
ifdef(`OPERATION_add_n', `
define(ADCSBB, adc)
@@ -64,71 +47,29 @@ ifdef(`OPERATION_sub_n', `
MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
mov R32(n), R32(%rax)
- shr $2, n
and $3, R32(%rax)
+ shr $2, n
bt $0, %r8 C cy flag <- carry parameter
- jrcxz L(lt4)
-
- mov (up), %r8
- mov 8(up), %r9
- dec n
- jmp L(mid)
-
+ jz L(1)
+ jmp L(ent)
EPILOGUE()
ALIGN(16)
PROLOGUE(func)
- FUNC_ENTRY(4)
mov R32(n), R32(%rax)
shr $2, n
+ jz L(0)
and $3, R32(%rax)
- jrcxz L(lt4)
- mov (up), %r8
+L(ent): mov (up), %r8
mov 8(up), %r9
dec n
jmp L(mid)
-L(lt4): dec R32(%rax)
- mov (up), %r8
- jnz L(2)
- ADCSBB (vp), %r8
- mov %r8, (rp)
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
- ret
-
-L(2): dec R32(%rax)
- mov 8(up), %r9
- jnz L(3)
- ADCSBB (vp), %r8
- ADCSBB 8(vp), %r9
- mov %r8, (rp)
- mov %r9, 8(rp)
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
- ret
-
-L(3): mov 16(up), %r10
- ADCSBB (vp), %r8
- ADCSBB 8(vp), %r9
- ADCSBB 16(vp), %r10
- mov %r8, (rp)
- mov %r9, 8(rp)
- mov %r10, 16(rp)
- setc R8(%rax)
- FUNC_EXIT()
- ret
-
ALIGN(16)
L(top): ADCSBB (vp), %r8
ADCSBB 8(vp), %r9
@@ -162,8 +103,36 @@ L(end): lea 32(up), up
inc R32(%rax)
dec R32(%rax)
- jnz L(lt4)
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
+ jnz L(1)
+ adc %eax, %eax
+ ret
+
+L(0): test R32(%rax), R32(%rax)
+L(1): dec R32(%rax)
+ mov (up), %r8
+ jnz L(2)
+ ADCSBB (vp), %r8
+ mov %r8, (rp)
+ adc %eax, %eax
+ ret
+
+L(2): dec R32(%rax)
+ mov 8(up), %r9
+ jnz L(3)
+ ADCSBB (vp), %r8
+ ADCSBB 8(vp), %r9
+ mov %r8, (rp)
+ mov %r9, 8(rp)
+ adc %eax, %eax
+ ret
+
+L(3): mov 16(up), %r10
+ ADCSBB (vp), %r8
+ ADCSBB 8(vp), %r9
+ ADCSBB 16(vp), %r10
+ mov %r8, (rp)
+ mov %r9, 8(rp)
+ mov %r10, 16(rp)
+ setc %al
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/aorsmul_1.asm b/gmp/mpn/x86_64/aorsmul_1.asm
index e3fc005757..a25c74ebdc 100644
--- a/gmp/mpn/x86_64/aorsmul_1.asm
+++ b/gmp/mpn/x86_64/aorsmul_1.asm
@@ -1,60 +1,45 @@
dnl AMD64 mpn_addmul_1 and mpn_submul_1.
-dnl Copyright 2003-2005, 2007, 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2004, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 bd1 5.0
-C AMD bobcat 6.17
-C Intel P4 14.9
-C Intel core2 5.09
-C Intel NHM 4.9
-C Intel SBR 4.0
-C Intel atom 21.3
-C VIA nano 5.0
-
-C The loop of this code is the result of running a code generation and
+C K8,K9: 2.5
+C K10: 2.5
+C P4: 14.9
+C P6-15 (Core2): 5.09
+C P6-28 (Atom): 21.3
+
+C The inner 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 TODO
-C * The loop is great, but the prologue and epilogue code was quickly written.
-C Tune it!
+C TODO:
+C * The inner loop is great, but the prologue and epilogue code was
+C quickly written. Tune it!
-define(`rp', `%rdi') C rcx
-define(`up', `%rsi') C rdx
-define(`n_param', `%rdx') C r8
-define(`vl', `%rcx') C r9
+C INPUT PARAMETERS
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`n_param',`%rdx')
+define(`vl', `%rcx')
-define(`n', `%r11')
+define(`n', `%r11')
ifdef(`OPERATION_addmul_1',`
define(`ADDSUB', `add')
@@ -65,33 +50,17 @@ ifdef(`OPERATION_submul_1',`
define(`func', `mpn_submul_1')
')
-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(`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)
-
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
mov (up), %rax C read first u limb early
push %rbx
-IFSTD(` mov n_param, %rbx ') C move away n from rdx, mul uses it
-IFDOS(` mov n, %rbx ')
+ mov n_param, %rbx C move away n from rdx, mul uses it
mul vl
-IFSTD(` mov %rbx, n ')
+ mov %rbx, %r11
and $3, R32(%rbx)
jz L(b0)
@@ -143,7 +112,7 @@ L(top): ADDSUB %r10, (rp,n,8)
adc %rax, %r9
mov (up,n,8), %rax
adc %rdx, %r8
- mov $0, R32(%r10)
+ mov $0, %r10d
L(L1): mul vl
ADDSUB %r9, 8(rp,n,8)
adc %rax, %r8
@@ -156,11 +125,11 @@ L(L0): mov 8(up,n,8), %rax
L(L3): mov 16(up,n,8), %rax
mul vl
ADDSUB %rbx, 24(rp,n,8)
- mov $0, R32(%r8) C zero
- mov %r8, %rbx C zero
+ mov $0, %r8d # zero
+ mov %r8, %rbx # zero
adc %rax, %r10
mov 24(up,n,8), %rax
- mov %r8, %r9 C zero
+ mov %r8, %r9 # zero
adc %rdx, %r9
L(L2): mul vl
add $4, n
@@ -174,7 +143,5 @@ L(ret): adc $0, %rdx
mov %rdx, %rax
pop %rbx
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/addmul_2.asm b/gmp/mpn/x86_64/atom/addmul_2.asm
deleted file mode 100644
index c1dcdc44aa..0000000000
--- a/gmp/mpn/x86_64/atom/addmul_2.asm
+++ /dev/null
@@ -1,186 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/atom/aorrlsh1_n.asm b/gmp/mpn/x86_64/atom/aorrlsh1_n.asm
deleted file mode 100644
index f44de19fef..0000000000
--- a/gmp/mpn/x86_64/atom/aorrlsh1_n.asm
+++ /dev/null
@@ -1,238 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C TODO
-C * This code is slightly large at 433 bytes.
-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 ?
-C Intel SBR ?
-C Intel atom 4.875 (4.75 is probably possible)
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-define(`cy', `%r8')
-
-ifdef(`OPERATION_addlsh1_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_addlsh1_n)
- define(func_nc, mpn_addlsh1_nc)')
-ifdef(`OPERATION_rsblsh1_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsblsh1_n)
- define(func_nc, mpn_rsblsh1_nc)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_addlsh1_nc mpn_rsblsh1_n mpn_rsblsh1_nc)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
- push %rbp
- xor R32(%rbp), R32(%rbp)
-L(ent): mov R32(n), R32(%rax)
- and $3, R32(%rax)
- jz L(b0)
- cmp $2, R32(%rax)
- jz L(b2)
- jg L(b3)
-
-L(b1): mov (vp), %r8
- add %r8, %r8
- lea 8(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- ADCSBB (up), %r8
- mov %r8, (rp)
- sbb R32(%rbp), R32(%rbp) C save acy
- lea 8(up), up
- lea 8(rp), rp
- jmp L(b0)
-
-L(b2): mov (vp), %r8
- add %r8, %r8
- mov 8(vp), %r9
- adc %r9, %r9
- lea 16(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- ADCSBB (up), %r8
- mov %r8, (rp)
- ADCSBB 8(up), %r9
- mov %r9, 8(rp)
- sbb R32(%rbp), R32(%rbp) C save acy
- lea 16(up), up
- lea 16(rp), rp
- jmp L(b0)
-
-L(b3): mov (vp), %r8
- add %r8, %r8
- mov 8(vp), %r9
- adc %r9, %r9
- mov 16(vp), %r10
- adc %r10, %r10
- lea 24(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- ADCSBB (up), %r8
- mov %r8, (rp)
- ADCSBB 8(up), %r9
- mov %r9, 8(rp)
- ADCSBB 16(up), %r10
- mov %r10, 16(rp)
- sbb R32(%rbp), R32(%rbp) C save acy
- lea 24(up), up
- lea 24(rp), rp
-
-L(b0): test $4, R8(n)
- jz L(skp)
- add R32(%rax), R32(%rax) C restore scy
- mov (vp), %r8
- adc %r8, %r8
- mov 8(vp), %r9
- adc %r9, %r9
- mov 16(vp), %r10
- adc %r10, %r10
- mov 24(vp), %r11
- adc %r11, %r11
- lea 32(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- ADCSBB (up), %r8
- mov %r8, (rp)
- ADCSBB 8(up), %r9
- mov %r9, 8(rp)
- ADCSBB 16(up), %r10
- mov %r10, 16(rp)
- ADCSBB 24(up), %r11
- mov %r11, 24(rp)
- lea 32(up), up
- lea 32(rp), rp
- sbb R32(%rbp), R32(%rbp) C save acy
-
-L(skp): cmp $8, n
- jl L(rtn)
-
- push %r12
- push %r13
- push %r14
- push %rbx
- lea -64(rp), rp
- jmp L(x)
-
- ALIGN(16)
-L(top): add R32(%rax), R32(%rax) C restore scy
- lea 64(rp), rp
- mov (vp), %r8
- adc %r8, %r8
- mov 8(vp), %r9
- adc %r9, %r9
- mov 16(vp), %r10
- adc %r10, %r10
- mov 24(vp), %r11
- adc %r11, %r11
- mov 32(vp), %r12
- adc %r12, %r12
- mov 40(vp), %r13
- adc %r13, %r13
- mov 48(vp), %r14
- adc %r14, %r14
- mov 56(vp), %rbx
- adc %rbx, %rbx
- lea 64(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- ADCSBB (up), %r8
- mov %r8, (rp)
- ADCSBB 8(up), %r9
- mov %r9, 8(rp)
- ADCSBB 16(up), %r10
- mov %r10, 16(rp)
- ADCSBB 24(up), %r11
- mov %r11, 24(rp)
- ADCSBB 32(up), %r12
- mov %r12, 32(rp)
- ADCSBB 40(up), %r13
- mov %r13, 40(rp)
- ADCSBB 48(up), %r14
- mov %r14, 48(rp)
- ADCSBB 56(up), %rbx
- mov %rbx, 56(rp)
- sbb R32(%rbp), R32(%rbp) C save acy
- lea 64(up), up
-L(x): sub $8, n
- jge L(top)
-
-L(end): pop %rbx
- pop %r14
- pop %r13
- pop %r12
-L(rtn):
-ifdef(`OPERATION_addlsh1_n',`
- add R32(%rbp), R32(%rax)
- neg R32(%rax)')
-ifdef(`OPERATION_rsblsh1_n',`
- sub R32(%rax), R32(%rbp)
- movslq R32(%rbp), %rax')
-
- pop %rbp
- FUNC_EXIT()
- ret
-EPILOGUE()
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- push %rbp
- neg %r8 C set CF
- sbb R32(%rbp), R32(%rbp) C save acy
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/aorrlsh2_n.asm b/gmp/mpn/x86_64/atom/aorrlsh2_n.asm
deleted file mode 100644
index 02fb29dd74..0000000000
--- a/gmp/mpn/x86_64/atom/aorrlsh2_n.asm
+++ /dev/null
@@ -1,191 +0,0 @@
-dnl AMD64 mpn_addlsh2_n -- rp[] = up[] + (vp[] << 2)
-dnl AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 2) - up[]
-dnl Optimised for Intel Atom.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 ?
-C Intel core2 ?
-C Intel NHM ?
-C Intel SBR ?
-C Intel atom 5.75
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-
-define(`LSH', 2)
-define(`RSH', 62)
-define(M, eval(m4_lshift(1,LSH)))
-
-ifdef(`OPERATION_addlsh2_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_addlsh2_n)
- define(func_nc, mpn_addlsh2_nc)')
-ifdef(`OPERATION_rsblsh2_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsblsh2_n)
- define(func_nc, mpn_rsblsh2_nc)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_rsblsh2_n)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
- push %rbx
- push %rbp
-
- mov R32(n), R32(%rax)
- and $3, R32(%rax)
- jz L(b0) C we rely on rax = 0 at target
- cmp $2, R32(%rax)
- mov $0, R32(%rax)
- jz L(b2)
- jg L(b3)
-
-L(b1): mov (vp), %r9
- lea (%rax,%r9,M), %rbp
- shr $RSH, %r9
- sub $1, n
- lea -8(up), up
- lea -8(rp), rp
- jz L(cj1)
- mov 8(vp), %r10
- lea (%r9,%r10,M), %r9
- shr $RSH, %r10
- mov 16(vp), %r11
- lea 24(vp), vp
- mov (vp), %r8
- lea (%r10,%r11,M), %r10
- shr $RSH, %r11
- add R32(%rax), R32(%rax)
- jmp L(L1)
-
-L(b2): lea -32(rp), rp
- mov (vp), %r8
- lea -32(up), up
- lea (%rax,%r8,M), %rbx
- shr $RSH, %r8
- mov 8(vp), %r9
- sub $2, n
- jle L(end)
- jmp L(top)
-
-L(b3): lea -24(up), up
- mov (vp), %r11
- lea -24(rp), rp
- mov 8(vp), %r8
- lea (%rax,%r11,M), %r10
- shr $RSH, %r11
- lea 8(vp), vp
- lea (%r11,%r8,M), %rbx
- add $1, n
- jmp L(L3)
-
-L(b0): lea -16(up), up
- mov (vp), %r10
- lea (%rax,%r10,M), %r9
- shr $RSH, %r10
- mov 8(vp), %r11
- lea -16(rp), rp
- mov 16(vp), %r8
- lea (%r10,%r11,M), %r10
- shr $RSH, %r11
- add R32(%rax), R32(%rax)
- lea 16(vp), vp
- jmp L(L0)
-
- ALIGN(16)
-L(top): lea (%r8,%r9,M), %rbp
- shr $RSH, %r9
- lea 32(up), up
- mov 16(vp), %r10
- lea (%r9,%r10,M), %r9
- shr $RSH, %r10
- mov 24(vp), %r11
- lea 32(rp), rp
- lea 32(vp), vp
- mov (vp), %r8
- lea (%r10,%r11,M), %r10
- shr $RSH, %r11
- add R32(%rax), R32(%rax)
- ADCSBB (up), %rbx
- mov %rbx, (rp)
-L(L1): ADCSBB 8(up), %rbp
- mov %rbp, 8(rp)
-L(L0): ADCSBB 16(up), %r9
- lea (%r11,%r8,M), %rbx
- mov %r9, 16(rp)
-L(L3): ADCSBB 24(up), %r10
- sbb R32(%rax), R32(%rax)
-L(L2): shr $RSH, %r8
- mov 8(vp), %r9
- mov %r10, 24(rp)
- sub $4, n
- jg L(top)
-
-L(end): lea (%r8,%r9,M), %rbp
- shr $RSH, %r9
- lea 32(up), up
- lea 32(rp), rp
- add R32(%rax), R32(%rax)
- ADCSBB (up), %rbx
- mov %rbx, (rp)
-L(cj1): ADCSBB 8(up), %rbp
- mov %rbp, 8(rp)
-
-ifdef(`OPERATION_addlsh2_n',`
- mov R32(n), R32(%rax) C zero rax
- adc %r9, %rax')
-ifdef(`OPERATION_rsblsh2_n',`
- sbb n, %r9 C subtract 0
- mov %r9, %rax')
-
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/aors_n.asm b/gmp/mpn/x86_64/atom/aors_n.asm
index 2c0b7b31a8..32c19424f0 100644
--- a/gmp/mpn/x86_64/atom/aors_n.asm
+++ b/gmp/mpn/x86_64/atom/aors_n.asm
@@ -1,37 +1,142 @@
dnl X86-64 mpn_add_n, mpn_sub_n, optimized for Intel Atom.
-dnl Copyright 2003-2005, 2007, 2008, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2004, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+
+C cycles/limb
+C K8,K9: 1.85
+C K10: ?
+C P4: ?
+C P6-15 (Core2): ?
+C P6-28 (Atom): 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)
+
+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)
-include_mpn(`x86_64/coreisbr/aors_n.asm')
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(func_nc)
+ jmp L(ent)
+EPILOGUE()
+PROLOGUE(func)
+ xor %r8, %r8
+L(ent):
+ mov R32(%rcx), R32(%rax)
+ shr $2, %rcx
+ and $3, R32(%rax)
+ jz L(b0)
+ cmp $2, R32(%rax)
+ jz L(b2)
+ jg L(b3)
+
+L(b1): mov (%rsi), %r10
+ test R32(%rcx), R32(%rcx)
+ bt $0, R32(%r8)
+ jnz L(gt1)
+ ADCSBB (%rdx), %r10
+ mov %r10, (%rdi)
+ mov R32(%rcx), R32(%rax) C zero rax
+ adc R32(%rax), R32(%rax)
+ ret
+L(gt1): ADCSBB (%rdx), %r10
+ mov 8(%rsi), %r11
+ lea 16(%rsi), %rsi
+ lea -16(%rdx), %rdx
+ lea -16(%rdi), %rdi
+ jmp L(m1)
+
+L(b2): mov (%rsi), %r9
+ mov 8(%rsi), %r10
+ lea -8(%rdx), %rdx
+ test R32(%rcx), R32(%rcx)
+ bt $0, R32(%r8)
+ jnz L(gt2)
+ lea -40(%rdi), %rdi
+ jmp L(e2)
+L(gt2): ADCSBB 8(%rdx), %r9
+ mov 16(%rsi), %r11
+ lea -8(%rsi), %rsi
+ lea -8(%rdi), %rdi
+ jmp L(m2)
+
+L(b3): mov (%rsi), %rax
+ mov 8(%rsi), %r9
+ mov 16(%rsi), %r10
+ test R32(%rcx), R32(%rcx)
+ bt $0, %r8
+ jnz L(gt3)
+ lea -32(%rdi), %rdi
+ jmp L(e3)
+L(gt3): ADCSBB (%rdx), %rax
+ jmp L(m3)
+
+L(b0): mov (%rsi), %r11
+ neg R32(%r8)
+ lea -24(%rdx), %rdx
+ lea -24(%rdi), %rdi
+ lea 8(%rsi), %rsi
+ jmp L(m0)
+
+ ALIGN(8)
+L(top): mov %r11, 24(%rdi)
+ ADCSBB (%rdx), %rax
+ lea 32(%rdi), %rdi
+L(m3): mov %rax, (%rdi)
+ ADCSBB 8(%rdx), %r9
+ mov 24(%rsi), %r11
+L(m2): mov %r9, 8(%rdi)
+ ADCSBB 16(%rdx), %r10
+ lea 32(%rsi), %rsi
+L(m1): mov %r10, 16(%rdi)
+L(m0): ADCSBB 24(%rdx), %r11
+ mov (%rsi), %rax
+ mov 8(%rsi), %r9
+ lea 32(%rdx), %rdx
+ dec %rcx
+ mov 16(%rsi), %r10
+ jnz L(top)
+
+ mov %r11, 24(%rdi)
+L(e3): ADCSBB (%rdx), %rax
+ mov %rax, 32(%rdi)
+L(e2): ADCSBB 8(%rdx), %r9
+ mov %r9, 40(%rdi)
+L(e1): ADCSBB 16(%rdx), %r10
+ mov %r10, 48(%rdi)
+ mov R32(%rcx), R32(%rax) C zero rax
+ adc R32(%rax), R32(%rax)
+ ret
+EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/aorsmul_1.asm b/gmp/mpn/x86_64/atom/aorsmul_1.asm
deleted file mode 100644
index e95315347c..0000000000
--- a/gmp/mpn/x86_64/atom/aorsmul_1.asm
+++ /dev/null
@@ -1,190 +0,0 @@
-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/gmp/mpn/x86_64/atom/com.asm b/gmp/mpn/x86_64/atom/com.asm
deleted file mode 100644
index 6b6460fffe..0000000000
--- a/gmp/mpn/x86_64/atom/com.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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')
diff --git a/gmp/mpn/x86_64/atom/copyd.asm b/gmp/mpn/x86_64/atom/copyd.asm
deleted file mode 100644
index e3092794c0..0000000000
--- a/gmp/mpn/x86_64/atom/copyd.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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/gmp/mpn/x86_64/atom/copyi.asm b/gmp/mpn/x86_64/atom/copyi.asm
deleted file mode 100644
index 00ec3c23c6..0000000000
--- a/gmp/mpn/x86_64/atom/copyi.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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')
diff --git a/gmp/mpn/x86_64/atom/dive_1.asm b/gmp/mpn/x86_64/atom/dive_1.asm
deleted file mode 100644
index d9ba5fe6f0..0000000000
--- a/gmp/mpn/x86_64/atom/dive_1.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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_divexact_1)
-include_mpn(`x86_64/nano/dive_1.asm')
diff --git a/gmp/mpn/x86_64/atom/gmp-mparam.h b/gmp/mpn/x86_64/atom/gmp-mparam.h
index 6816dfc362..f06dab4556 100644
--- a/gmp/mpn/x86_64/atom/gmp-mparam.h
+++ b/gmp/mpn/x86_64/atom/gmp-mparam.h
@@ -1,220 +1,76 @@
-/* Intel Atom/64 gmp-mparam.h -- Compiler/machine parameter header file.
+/* Inte Atom gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2012, 2014 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+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 either:
+it under the terms of the GNU 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 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.
-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.
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
-or both in parallel, as here.
+/* Generated by tuneup.c, 2009-01-14, gcc 4.2 */
-The GNU MP Library is distributed in the hope that 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
-
-#define SHLD_SLOW 1
-#define SHRD_SLOW 1
-
-/* 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 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 /* 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 12
-#define MUL_TOOM33_THRESHOLD 74
-#define MUL_TOOM44_THRESHOLD 118
-#define MUL_TOOM6H_THRESHOLD 157
-#define MUL_TOOM8H_THRESHOLD 212
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 73
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 84
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 81
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 80
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 58
-
-#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 16
-
-#define MULMOD_BNM1_THRESHOLD 10
-#define SQRMOD_BNM1_THRESHOLD 12
-
-#define MUL_FFT_MODF_THRESHOLD 252 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 252, 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}, { 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, 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 185
-#define MUL_FFT_THRESHOLD 2240
-
-#define SQR_FFT_MODF_THRESHOLD 208 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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,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 175
-#define SQR_FFT_THRESHOLD 1600
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#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 */
+#define MUL_KARATSUBA_THRESHOLD 10
+#define MUL_TOOM3_THRESHOLD 66
+#define MUL_TOOM44_THRESHOLD 118
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 18
+#define SQR_TOOM3_THRESHOLD 98
+#define SQR_TOOM4_THRESHOLD 166
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 24
+#define MULLOW_MUL_N_THRESHOLD 170
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 30
+#define POWM_THRESHOLD 48
+
+#define MATRIX22_STRASSEN_THRESHOLD 17
+#define HGCD_THRESHOLD 86
+#define GCD_DC_THRESHOLD 196
+#define GCDEXT_DC_THRESHOLD 236
+#define JACOBI_BASE_METHOD 3
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 8
+#define MOD_1_2_THRESHOLD 9
+#define MOD_1_4_THRESHOLD 24
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 19
+#define GET_STR_PRECOMPUTE_THRESHOLD 35
+#define SET_STR_DC_THRESHOLD 268
+#define SET_STR_PRECOMPUTE_THRESHOLD 1142
+
+#define MUL_FFT_TABLE { 272, 544, 1088, 1792, 5120, 12288, 49152, 196608, 786432, 0 }
+#define MUL_FFT_MODF_THRESHOLD 240
+#define MUL_FFT_THRESHOLD 1408
+
+#define SQR_FFT_TABLE { 240, 544, 1216, 2304, 5120, 12288, 49152, 196608, 786432, 0 }
+#define SQR_FFT_MODF_THRESHOLD 240
+#define SQR_FFT_THRESHOLD 1408
+
+/* These tables need to be updated. */
+
+#define MUL_FFT_TABLE2 {{1,4}, {209,5}, {417,6}, {961,7}, {2177,8}, {4865,9}, {5633,8}, {6401,9}, {7681,8}, {8449,9}, {13825,10}, {15361,9}, {19969,10}, {23553,9}, {24065,11}, {30721,10}, {48129,11}, {63489,10}, {81409,11}, {96257,9}, {106497,10}, {107521,12}, {126977,11}, {129025,10}, {130049,9}, {130561,10}, {140289,9}, {140801,10}, {147201,11}, {161793,10}, {212481,11}, {228865,12}, {258049,11}, {457729,13}, {516097,12}, {520193,11}, {588801,12}, {651265,11}, {719873,12}, {782337,11}, {849921,12}, {916481,13}, {1040385,12}, {1439745,13}, {1564673,12}, {1830913,11}, {1832961,13}, {1835009,14}, {MP_SIZE_T_MAX, 0}}
+
+#define SQR_FFT_TABLE2 {{1,4}, {177,5}, {353,6}, {833,7}, {2177,8}, {4865,9}, {5633,8}, {6401,10}, {7169,9}, {11777,10}, {15361,9}, {19969,10}, {23553,9}, {24065,11}, {30721,10}, {48129,11}, {63489,10}, {65537,9}, {73217,8}, {73601,9}, {80129,10}, {80897,9}, {81665,11}, {96257,9}, {97793,8}, {98817,10}, {99329,12}, {126977,10}, {130049,9}, {131073,10}, {143361,9}, {144385,10}, {151041,9}, {151553,10}, {154113,9}, {154625,10}, {157697,9}, {159745,10}, {195585,9}, {196609,11}, {206849,10}, {207873,11}, {220161,10}, {222209,11}, {228865,12}, {258049,11}, {272385,10}, {274433,11}, {276481,10}, {277505,11}, {280577,10}, {282625,11}, {391169,10}, {397313,11}, {401409,10}, {423937,11}, {457729,13}, {516097,12}, {520193,11}, {588801,12}, {651265,11}, {718849,12}, {782337,11}, {845825,12}, {915457,13}, {1040385,12}, {1437697,13}, {1564673,12}, {1830913,14}, {MP_SIZE_T_MAX, 0}}
diff --git a/gmp/mpn/x86_64/atom/lshift.asm b/gmp/mpn/x86_64/atom/lshift.asm
deleted file mode 100644
index 1b37d5dccf..0000000000
--- a/gmp/mpn/x86_64/atom/lshift.asm
+++ /dev/null
@@ -1,123 +0,0 @@
-dnl AMD64 mpn_lshift -- mpn left shift, optimised for Atom.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 ?
-C Intel core2 ?
-C Intel NHM ?
-C Intel SBR ?
-C Intel atom 4.5
-C VIA nano ?
-
-C TODO
-C * Consider using 4-way unrolling. We reach 4 c/l, but the code is 2.5 times
-C larger.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_lshift)
- FUNC_ENTRY(4)
- lea -8(up,n,8), up
- lea -8(rp,n,8), rp
- shr R32(n)
- mov (up), %rax
- jnc L(evn)
-
- mov %rax, %r11
- shl R8(%rcx), %r11
- neg R8(%rcx)
- shr R8(%rcx), %rax
- test n, n
- jnz L(gt1)
- mov %r11, (rp)
- FUNC_EXIT()
- ret
-
-L(gt1): mov -8(up), %r8
- mov %r8, %r10
- shr R8(%rcx), %r8
- jmp L(lo1)
-
-L(evn): mov %rax, %r10
- neg R8(%rcx)
- shr R8(%rcx), %rax
- mov -8(up), %r9
- mov %r9, %r11
- shr R8(%rcx), %r9
- neg R8(%rcx)
- dec n
- lea 8(rp), rp
- lea -8(up), up
- jz L(end)
-
- ALIGN(8)
-L(top): shl R8(%rcx), %r10
- or %r10, %r9
- shl R8(%rcx), %r11
- neg R8(%rcx)
- mov -8(up), %r8
- mov %r8, %r10
- mov %r9, -8(rp)
- shr R8(%rcx), %r8
- lea -16(rp), rp
-L(lo1): mov -16(up), %r9
- or %r11, %r8
- mov %r9, %r11
- shr R8(%rcx), %r9
- lea -16(up), up
- neg R8(%rcx)
- mov %r8, (rp)
- dec n
- jg L(top)
-
-L(end): shl R8(%rcx), %r10
- or %r10, %r9
- shl R8(%rcx), %r11
- mov %r9, -8(rp)
- mov %r11, -16(rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/lshiftc.asm b/gmp/mpn/x86_64/atom/lshiftc.asm
deleted file mode 100644
index 7385f8fd44..0000000000
--- a/gmp/mpn/x86_64/atom/lshiftc.asm
+++ /dev/null
@@ -1,127 +0,0 @@
-dnl AMD64 mpn_lshiftc -- mpn left shift with complement, optimised for Atom.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 ?
-C Intel core2 ?
-C Intel NHM ?
-C Intel SBR ?
-C Intel atom 5
-C VIA nano ?
-
-C TODO
-C * Consider using 4-way unrolling. We reach 4.5 c/l, but the code is 2.5
-C times larger.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_lshiftc)
- FUNC_ENTRY(4)
- lea -8(up,n,8), up
- lea -8(rp,n,8), rp
- shr R32(n)
- mov (up), %rax
- jnc L(evn)
-
- mov %rax, %r11
- shl R8(%rcx), %r11
- neg R8(%rcx)
- shr R8(%rcx), %rax
- test n, n
- jnz L(gt1)
- not %r11
- mov %r11, (rp)
- FUNC_EXIT()
- ret
-
-L(gt1): mov -8(up), %r8
- mov %r8, %r10
- shr R8(%rcx), %r8
- jmp L(lo1)
-
-L(evn): mov %rax, %r10
- neg R8(%rcx)
- shr R8(%rcx), %rax
- mov -8(up), %r9
- mov %r9, %r11
- shr R8(%rcx), %r9
- neg R8(%rcx)
- lea 8(rp), rp
- lea -8(up), up
- jmp L(lo0)
-
-C ALIGN(16)
-L(top): shl R8(%rcx), %r10
- or %r10, %r9
- shl R8(%rcx), %r11
- not %r9
- neg R8(%rcx)
- mov -8(up), %r8
- lea -16(rp), rp
- mov %r8, %r10
- shr R8(%rcx), %r8
- mov %r9, 8(rp)
-L(lo1): or %r11, %r8
- mov -16(up), %r9
- mov %r9, %r11
- shr R8(%rcx), %r9
- lea -16(up), up
- neg R8(%rcx)
- not %r8
- mov %r8, (rp)
-L(lo0): dec n
- jg L(top)
-
-L(end): shl R8(%rcx), %r10
- or %r10, %r9
- not %r9
- shl R8(%rcx), %r11
- not %r11
- mov %r9, -8(rp)
- mov %r11, -16(rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/mul_1.asm b/gmp/mpn/x86_64/atom/mul_1.asm
deleted file mode 100644
index d76a3d3b8c..0000000000
--- a/gmp/mpn/x86_64/atom/mul_1.asm
+++ /dev/null
@@ -1,143 +0,0 @@
-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/gmp/mpn/x86_64/atom/mul_2.asm b/gmp/mpn/x86_64/atom/mul_2.asm
deleted file mode 100644
index f3fc3afdd1..0000000000
--- a/gmp/mpn/x86_64/atom/mul_2.asm
+++ /dev/null
@@ -1,186 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/atom/popcount.asm b/gmp/mpn/x86_64/atom/popcount.asm
deleted file mode 100644
index fb14dd3d31..0000000000
--- a/gmp/mpn/x86_64/atom/popcount.asm
+++ /dev/null
@@ -1,35 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86/pentium4/sse2/popcount.asm')
diff --git a/gmp/mpn/x86_64/atom/redc_1.asm b/gmp/mpn/x86_64/atom/redc_1.asm
deleted file mode 100644
index d93c19fdc0..0000000000
--- a/gmp/mpn/x86_64/atom/redc_1.asm
+++ /dev/null
@@ -1,574 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/atom/rsh1aors_n.asm b/gmp/mpn/x86_64/atom/rsh1aors_n.asm
deleted file mode 100644
index 6f5f6384a7..0000000000
--- a/gmp/mpn/x86_64/atom/rsh1aors_n.asm
+++ /dev/null
@@ -1,287 +0,0 @@
-dnl x86-64 mpn_rsh1add_n/mpn_rsh1sub_n.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C TODO
-C * Schedule loop less. It is now almost surely overscheduled, resulting in
-C large feed-in and wind-down code.
-
-C cycles/limb
-C AMD K8,K9 ?
-C AMD K10 ?
-C Intel P4 ?
-C Intel core2 ?
-C Intel NMH ?
-C Intel SBR ?
-C Intel atom 5.25
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`vp',`%rdx')
-define(`n',`%rcx')
-
-ifdef(`OPERATION_rsh1add_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_rsh1add_n)
- define(func_nc, mpn_rsh1add_nc)')
-ifdef(`OPERATION_rsh1sub_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsh1sub_n)
- define(func_nc, mpn_rsh1sub_nc)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1sub_n)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
- push %rbx
- push %rbp
- push %r12
- push %r13
- push %r14
- push %r15
-
- mov (up), %r15
- ADDSUB (vp), %r15
- sbb R32(%rbx), R32(%rbx)
- xor R32(%rax), R32(%rax)
- shr %r15
- adc R32(%rax), R32(%rax) C return value
-
- mov R32(n), R32(%rbp)
- and $3, R32(%rbp)
- jz L(b0)
- cmp $2, R32(%rbp)
- jae L(b23)
-
-L(b1): dec n
- jnz L(gt1)
- shl $63, %rbx
- add %rbx, %r15
- mov %r15, (rp)
- jmp L(cj1)
-L(gt1): lea 24(up), up
- lea 24(vp), vp
- mov -16(up), %r9
- add R32(%rbx), R32(%rbx)
- mov -8(up), %r10
- lea 24(rp), rp
- mov (up), %r11
- ADCSBB -16(vp), %r9
- ADCSBB -8(vp), %r10
- mov %r15, %r12
- ADCSBB (vp), %r11
- mov %r9, %r13
- sbb R32(%rbx), R32(%rbx)
- mov %r11, %r15
- mov %r10, %r14
- shl $63, %r11
- shl $63, %r10
- shl $63, %r9
- or %r9, %r12
- shr %r13
- mov 8(up), %r8
- shr %r14
- or %r10, %r13
- shr %r15
- or %r11, %r14
- sub $4, n
- jz L(cj5)
-L(gt5): mov 16(up), %r9
- add R32(%rbx), R32(%rbx)
- mov 24(up), %r10
- ADCSBB 8(vp), %r8
- mov %r15, %rbp
- mov 32(up), %r11
- jmp L(lo1)
-
-L(b23): jnz L(b3)
- mov 8(up), %r8
- sub $2, n
- jnz L(gt2)
- add R32(%rbx), R32(%rbx)
- ADCSBB 8(vp), %r8
- mov %r8, %r12
- jmp L(cj2)
-L(gt2): mov 16(up), %r9
- add R32(%rbx), R32(%rbx)
- mov 24(up), %r10
- ADCSBB 8(vp), %r8
- mov %r15, %rbp
- mov 32(up), %r11
- ADCSBB 16(vp), %r9
- lea 32(up), up
- ADCSBB 24(vp), %r10
- mov %r9, %r13
- ADCSBB 32(vp), %r11
- mov %r8, %r12
- jmp L(lo2)
-
-L(b3): lea 40(up), up
- lea 8(vp), vp
- mov %r15, %r14
- add R32(%rbx), R32(%rbx)
- mov -32(up), %r11
- ADCSBB 0(vp), %r11
- lea 8(rp), rp
- sbb R32(%rbx), R32(%rbx)
- mov %r11, %r15
- shl $63, %r11
- mov -24(up), %r8
- shr %r15
- or %r11, %r14
- sub $3, n
- jnz L(gt3)
- add R32(%rbx), R32(%rbx)
- ADCSBB 8(vp), %r8
- jmp L(cj3)
-L(gt3): mov -16(up), %r9
- add R32(%rbx), R32(%rbx)
- mov -8(up), %r10
- ADCSBB 8(vp), %r8
- mov %r15, %rbp
- mov (up), %r11
- ADCSBB 16(vp), %r9
- ADCSBB 24(vp), %r10
- mov %r8, %r12
- jmp L(lo3)
-
-L(b0): lea 48(up), up
- lea 16(vp), vp
- add R32(%rbx), R32(%rbx)
- mov -40(up), %r10
- lea 16(rp), rp
- mov -32(up), %r11
- ADCSBB -8(vp), %r10
- mov %r15, %r13
- ADCSBB (vp), %r11
- sbb R32(%rbx), R32(%rbx)
- mov %r11, %r15
- mov %r10, %r14
- shl $63, %r11
- shl $63, %r10
- mov -24(up), %r8
- shr %r14
- or %r10, %r13
- shr %r15
- or %r11, %r14
- sub $4, n
- jnz L(gt4)
- add R32(%rbx), R32(%rbx)
- ADCSBB 8(vp), %r8
- jmp L(cj4)
-L(gt4): mov -16(up), %r9
- add R32(%rbx), R32(%rbx)
- mov -8(up), %r10
- ADCSBB 8(vp), %r8
- mov %r15, %rbp
- mov (up), %r11
- ADCSBB 16(vp), %r9
- jmp L(lo0)
-
- ALIGN(8)
-L(top): mov 16(up), %r9
- shr %r14
- or %r10, %r13
- shr %r15
- or %r11, %r14
- add R32(%rbx), R32(%rbx)
- mov 24(up), %r10
- mov %rbp, (rp)
- ADCSBB 8(vp), %r8
- mov %r15, %rbp
- lea 32(rp), rp
- mov 32(up), %r11
-L(lo1): ADCSBB 16(vp), %r9
- lea 32(up), up
- mov %r12, -24(rp)
-L(lo0): ADCSBB 24(vp), %r10
- mov %r8, %r12
- mov %r13, -16(rp)
-L(lo3): ADCSBB 32(vp), %r11
- mov %r9, %r13
- mov %r14, -8(rp)
-L(lo2): sbb R32(%rbx), R32(%rbx)
- shl $63, %r8
- mov %r11, %r15
- shr %r12
- mov %r10, %r14
- shl $63, %r9
- lea 32(vp), vp
- shl $63, %r10
- or %r8, %rbp
- shl $63, %r11
- or %r9, %r12
- shr %r13
- mov 8(up), %r8
- sub $4, n
- jg L(top)
-
-L(end): shr %r14
- or %r10, %r13
- shr %r15
- or %r11, %r14
- mov %rbp, (rp)
- lea 32(rp), rp
-L(cj5): add R32(%rbx), R32(%rbx)
- ADCSBB 8(vp), %r8
- mov %r12, -24(rp)
-L(cj4): mov %r13, -16(rp)
-L(cj3): mov %r8, %r12
- mov %r14, -8(rp)
-L(cj2): sbb R32(%rbx), R32(%rbx)
- shl $63, %r8
- shr %r12
- or %r8, %r15
- shl $63, %rbx
- add %rbx, %r12
- mov %r15, (rp)
- mov %r12, 8(rp)
-L(cj1): pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/rshift.asm b/gmp/mpn/x86_64/atom/rshift.asm
deleted file mode 100644
index 29c027de49..0000000000
--- a/gmp/mpn/x86_64/atom/rshift.asm
+++ /dev/null
@@ -1,121 +0,0 @@
-dnl AMD64 mpn_rshift -- mpn right shift, optimised for Atom.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 ?
-C Intel core2 ?
-C Intel NHM ?
-C Intel SBR ?
-C Intel atom 4.5
-C VIA nano ?
-
-C TODO
-C * Consider using 4-way unrolling. We reach 4 c/l, but the code is 2.5 times
-C larger.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_rshift)
- FUNC_ENTRY(4)
- shr R32(n)
- mov (up), %rax
- jnc L(evn)
-
- mov %rax, %r11
- shr R8(cnt), %r11
- neg R8(cnt)
- shl R8(cnt), %rax
- test n, n
- jnz L(gt1)
- mov %r11, (rp)
- FUNC_EXIT()
- ret
-
-L(gt1): mov 8(up), %r8
- mov %r8, %r10
- shl R8(cnt), %r8
- jmp L(lo1)
-
-L(evn): mov %rax, %r10
- neg R8(cnt)
- shl R8(cnt), %rax
- mov 8(up), %r9
- mov %r9, %r11
- shl R8(cnt), %r9
- neg R8(cnt)
- dec n
- lea -8(rp), rp
- lea 8(up), up
- jz L(end)
-
- ALIGN(8)
-L(top): shr R8(cnt), %r10
- or %r10, %r9
- shr R8(cnt), %r11
- neg R8(cnt)
- mov 8(up), %r8
- mov %r8, %r10
- mov %r9, 8(rp)
- shl R8(cnt), %r8
- lea 16(rp), rp
-L(lo1): mov 16(up), %r9
- or %r11, %r8
- mov %r9, %r11
- shl R8(cnt), %r9
- lea 16(up), up
- neg R8(cnt)
- mov %r8, (rp)
- dec n
- jg L(top)
-
-L(end): shr R8(cnt), %r10
- or %r10, %r9
- shr R8(cnt), %r11
- mov %r9, 8(rp)
- mov %r11, 16(rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/atom/sublsh1_n.asm b/gmp/mpn/x86_64/atom/sublsh1_n.asm
deleted file mode 100644
index 1306acde2b..0000000000
--- a/gmp/mpn/x86_64/atom/sublsh1_n.asm
+++ /dev/null
@@ -1,242 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C TODO
-C * This code is slightly large at 501 bytes.
-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 ?
-C Intel SBR ?
-C Intel atom 5 (4.875 is probably possible)
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-define(`cy', `%r8')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_sublsh1_n)
- FUNC_ENTRY(4)
- push %rbp
- push %r15
- xor R32(%rbp), R32(%rbp)
-L(ent): mov R32(n), R32(%rax)
- and $3, R32(%rax)
- jz L(b0)
- cmp $2, R32(%rax)
- jz L(b2)
- jg L(b3)
-
-L(b1): mov (vp), %r8
- add %r8, %r8
- lea 8(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- mov (up), %r15
- sbb %r8, %r15
- mov %r15, (rp)
- sbb R32(%rbp), R32(%rbp) C save acy
- lea 8(up), up
- lea 8(rp), rp
- jmp L(b0)
-
-L(b2): mov (vp), %r8
- add %r8, %r8
- mov 8(vp), %r9
- adc %r9, %r9
- lea 16(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- mov (up), %r15
- sbb %r8, %r15
- mov %r15, (rp)
- mov 8(up), %r15
- sbb %r9, %r15
- mov %r15, 8(rp)
- sbb R32(%rbp), R32(%rbp) C save acy
- lea 16(up), up
- lea 16(rp), rp
- jmp L(b0)
-
-L(b3): mov (vp), %r8
- add %r8, %r8
- mov 8(vp), %r9
- adc %r9, %r9
- mov 16(vp), %r10
- adc %r10, %r10
- lea 24(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- mov (up), %r15
- sbb %r8, %r15
- mov %r15, (rp)
- mov 8(up), %r15
- sbb %r9, %r15
- mov %r15, 8(rp)
- mov 16(up), %r15
- sbb %r10, %r15
- mov %r15, 16(rp)
- sbb R32(%rbp), R32(%rbp) C save acy
- lea 24(up), up
- lea 24(rp), rp
-
-L(b0): test $4, R8(n)
- jz L(skp)
- add R32(%rax), R32(%rax) C restore scy
- mov (vp), %r8
- adc %r8, %r8
- mov 8(vp), %r9
- adc %r9, %r9
- mov 16(vp), %r10
- adc %r10, %r10
- mov 24(vp), %r11
- adc %r11, %r11
- lea 32(vp), vp
- sbb R32(%rax), R32(%rax) C save scy
- add R32(%rbp), R32(%rbp) C restore acy
- mov (up), %r15
- sbb %r8, %r15
- mov %r15, (rp)
- mov 8(up), %r15
- sbb %r9, %r15
- mov %r15, 8(rp)
- mov 16(up), %r15
- sbb %r10, %r15
- mov %r15, 16(rp)
- mov 24(up), %r15
- sbb %r11, %r15
- mov %r15, 24(rp)
- lea 32(up), up
- lea 32(rp), rp
- sbb R32(%rbp), R32(%rbp) C save acy
-
-L(skp): cmp $8, n
- jl L(rtn)
-
- push %r12
- push %r13
- push %r14
- push %rbx
- lea -64(rp), rp
- jmp L(x)
-
- ALIGN(16)
-L(top): mov (vp), %r8
- add R32(%rax), R32(%rax)
- lea 64(vp), vp
- adc %r8, %r8
- mov -56(vp), %r9
- adc %r9, %r9
- mov -48(vp), %r10
- adc %r10, %r10
- mov -40(vp), %r11
- adc %r11, %r11
- mov -32(vp), %r12
- adc %r12, %r12
- mov -24(vp), %r13
- adc %r13, %r13
- mov -16(vp), %r14
- adc %r14, %r14
- mov -8(vp), %r15
- adc %r15, %r15
- sbb R32(%rax), R32(%rax)
- add R32(%rbp), R32(%rbp)
- mov (up), %rbp
- lea 64(rp), rp
- mov 8(up), %rbx
- sbb %r8, %rbp
- mov 32(up), %r8
- mov %rbp, (rp)
- sbb %r9, %rbx
- mov 16(up), %rbp
- mov %rbx, 8(rp)
- sbb %r10, %rbp
- mov 24(up), %rbx
- mov %rbp, 16(rp)
- sbb %r11, %rbx
- mov %rbx, 24(rp)
- sbb %r12, %r8
- mov 40(up), %r9
- mov %r8, 32(rp)
- sbb %r13, %r9
- mov 48(up), %rbp
- mov %r9, 40(rp)
- sbb %r14, %rbp
- mov 56(up), %rbx
- mov %rbp, 48(rp)
- sbb %r15, %rbx
- lea 64(up), up
- mov %rbx, 56(rp)
- sbb R32(%rbp), R32(%rbp)
-L(x): sub $8, n
- jge L(top)
-
-L(end): pop %rbx
- pop %r14
- pop %r13
- pop %r12
-L(rtn):
- add R32(%rbp), R32(%rax)
- neg R32(%rax)
-
- pop %r15
- pop %rbp
- FUNC_EXIT()
- ret
-EPILOGUE()
-PROLOGUE(mpn_sublsh1_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- push %rbp
- push %r15
- neg %r8 C set CF
- sbb R32(%rbp), R32(%rbp) C save acy
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/bd1/README b/gmp/mpn/x86_64/bd1/README
deleted file mode 100644
index ccd210e0d6..0000000000
--- a/gmp/mpn/x86_64/bd1/README
+++ /dev/null
@@ -1,11 +0,0 @@
-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/gmp/mpn/x86_64/bd1/aorrlsh1_n.asm b/gmp/mpn/x86_64/bd1/aorrlsh1_n.asm
deleted file mode 100644
index c34a5fa134..0000000000
--- a/gmp/mpn/x86_64/bd1/aorrlsh1_n.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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')
diff --git a/gmp/mpn/x86_64/bd1/aorsmul_1.asm b/gmp/mpn/x86_64/bd1/aorsmul_1.asm
deleted file mode 100644
index 96fec9f5ac..0000000000
--- a/gmp/mpn/x86_64/bd1/aorsmul_1.asm
+++ /dev/null
@@ -1,181 +0,0 @@
-dnl AMD64 mpn_addmul_1 and mpn_submul_1 optimised for AMD Bulldozer.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C cycles/limb
-C AMD K8,K9
-C AMD K10
-C AMD bd1 4.5-4.7
-C AMD bobcat
-C Intel P4
-C Intel core2
-C Intel NHM
-C Intel SBR
-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 * Try to make loop run closer to 4 c/l.
-
-define(`rp', `%rdi') C rcx
-define(`up', `%rsi') C rdx
-define(`n_param', `%rdx') C r8
-define(`v0', `%rcx') C r9
-
-define(`n', `%r11')
-
-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)
-
-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(func)
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
- mov (up), %rax C read first u limb early
- push %rbx
-IFSTD(` mov n_param, %rbx ') C move away n from rdx, mul uses it
-IFDOS(` mov n, %rbx ')
- mul v0
-
-IFSTD(` mov %rbx, n ')
-
- and $3, R32(%rbx)
- lea -16(rp,n,8), rp
- jz L(b0)
- cmp $2, R32(%rbx)
- jb L(b1)
- jz L(b2)
-
-L(b3): mov $0, R32(%r8)
- mov %rax, %rbx
- mov $0, R32(%r9)
- mov 8(up), %rax
- mov %rdx, %r10
- lea (up,n,8), up
- not n
- jmp L(L3)
-
-L(b0): mov $0, R32(%r10)
- mov %rax, %r8
- mov %rdx, %rbx
- mov 8(up), %rax
- lea (up,n,8), up
- neg n
- jmp L(L0)
-
-L(b1): cmp $1, n
- jz L(n1)
- mov %rax, %r9
- mov 8(up), %rax
- mov %rdx, %r8
- mov $0, R32(%rbx)
- lea (up,n,8), up
- neg n
- inc n
- jmp L(L1)
-
-L(b2): mov $0, R32(%rbx)
- mov %rax, %r10
- mov %rdx, %r9
- mov 8(up), %rax
- mov $0, R32(%r8)
- lea (up,n,8), up
- neg n
- add $2, n
- jns L(end)
-
- ALIGN(32)
-L(top): mul v0
- ADDSUB %r10, (rp,n,8)
- adc %rax, %r9
- mov (up,n,8), %rax
- adc %rdx, %r8
-L(L1): mul v0
- mov $0, R32(%r10)
- ADDSUB %r9, 8(rp,n,8)
- adc %rax, %r8
- adc %rdx, %rbx
- mov 8(up,n,8), %rax
-L(L0): mul v0
- ADDSUB %r8, 16(rp,n,8)
- mov $0, R32(%r8)
- adc %rax, %rbx
- mov $0, R32(%r9)
- mov 16(up,n,8), %rax
- adc %rdx, %r10
-L(L3): mul v0
- ADDSUB %rbx, 24(rp,n,8)
- mov $0, R32(%rbx)
- adc %rax, %r10
- adc %rdx, %r9
- mov 24(up,n,8), %rax
- add $4, n
- js L(top)
-
-L(end): mul v0
- ADDSUB %r10, (rp)
- adc %r9, %rax
- adc %r8, %rdx
-L(n1): ADDSUB %rax, 8(rp)
- adc $0, %rdx
- mov %rdx, %rax
-
- pop %rbx
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86_64/bd1/com.asm b/gmp/mpn/x86_64/bd1/com.asm
deleted file mode 100644
index 43f356117a..0000000000
--- a/gmp/mpn/x86_64/bd1/com.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/bd1/copyd.asm b/gmp/mpn/x86_64/bd1/copyd.asm
deleted file mode 100644
index 675cdc3f6b..0000000000
--- a/gmp/mpn/x86_64/bd1/copyd.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/bd1/copyi.asm b/gmp/mpn/x86_64/bd1/copyi.asm
deleted file mode 100644
index ceef036585..0000000000
--- a/gmp/mpn/x86_64/bd1/copyi.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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')
diff --git a/gmp/mpn/x86_64/bd1/gcd_1.asm b/gmp/mpn/x86_64/bd1/gcd_1.asm
deleted file mode 100644
index 3d8e5c7ab1..0000000000
--- a/gmp/mpn/x86_64/bd1/gcd_1.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_gcd_1)
-include_mpn(`x86_64/core2/gcd_1.asm')
diff --git a/gmp/mpn/x86_64/bd1/gmp-mparam.h b/gmp/mpn/x86_64/bd1/gmp-mparam.h
deleted file mode 100644
index 5014f9f469..0000000000
--- a/gmp/mpn/x86_64/bd1/gmp-mparam.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/* AMD bd1 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
-
-/* 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 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 22
-
-#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 107
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#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 22
-#define SQR_TOOM3_THRESHOLD 85
-#define SQR_TOOM4_THRESHOLD 242
-#define SQR_TOOM6_THRESHOLD 318
-#define SQR_TOOM8_THRESHOLD 478
-
-#define MULMID_TOOM42_THRESHOLD 22
-
-#define MULMOD_BNM1_THRESHOLD 11
-#define SQRMOD_BNM1_THRESHOLD 14
-
-#define MUL_FFT_MODF_THRESHOLD 404 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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,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 \
- { { 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}, \
- { 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 39
-#define MULLO_MUL_N_THRESHOLD 7246
-
-#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 38
-#define INV_NEWTON_THRESHOLD 226
-#define INV_APPR_THRESHOLD 188
-
-#define BINV_NEWTON_THRESHOLD 248
-#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 1360
-#define MUPI_DIV_QR_THRESHOLD 108
-#define MU_BDIV_QR_THRESHOLD 1142
-#define MU_BDIV_Q_THRESHOLD 1360
-
-#define POWM_SEC_TABLE 1,16,194,386,452,2245
-
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 108
-#define HGCD_APPR_THRESHOLD 51
-#define HGCD_REDUCE_THRESHOLD 2681
-#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 21
-#define SET_STR_DC_THRESHOLD 418
-#define SET_STR_PRECOMPUTE_THRESHOLD 1289
-
-#define FAC_DSC_THRESHOLD 252
-#define FAC_ODD_THRESHOLD 23
diff --git a/gmp/mpn/x86_64/bd1/hamdist.asm b/gmp/mpn/x86_64/bd1/hamdist.asm
deleted file mode 100644
index 93e1e5632b..0000000000
--- a/gmp/mpn/x86_64/bd1/hamdist.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl AMD64 mpn_hamdist -- hamming distance.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_hamdist)
-include_mpn(`x86_64/k10/hamdist.asm')
diff --git a/gmp/mpn/x86_64/bd1/mul_1.asm b/gmp/mpn/x86_64/bd1/mul_1.asm
deleted file mode 100644
index e59667c085..0000000000
--- a/gmp/mpn/x86_64/bd1/mul_1.asm
+++ /dev/null
@@ -1,184 +0,0 @@
-dnl AMD64 mpn_mul_1 optimised for AMD Bulldozer.
-
-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 bd1 4
-C AMD bobcat
-C Intel P4
-C Intel core2
-C Intel NHM
-C Intel SBR
-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 * Move loop code into feed-in blocks, to save insn for zeroing regs.
-
-define(`rp', `%rdi') C rcx
-define(`up', `%rsi') C rdx
-define(`n_param', `%rdx') C r8
-define(`v0', `%rcx') C r9
-
-define(`n', `%rbx')
-
-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', ``rbx'') ') dnl
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mul_1c)
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
- mov (up), %rax C read first u limb early
- push %rbx
-IFSTD(` mov n_param, %r11 ') C move away n from rdx, mul uses it
-IFDOS(` mov n, %r11 ')
- mul v0
-
-IFSTD(` add %r8, %rax ')
-IFDOS(` add 64(%rsp), %rax ') C 40 + 3*8 (3 push insns)
- adc $0, %rdx
- jmp L(common)
-
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(mpn_mul_1)
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
- mov (up), %rax C read first u limb early
- push %rbx
-IFSTD(` mov n_param, %r11 ') C move away n from rdx, mul uses it
-IFDOS(` mov n, %r11 ')
- mul v0
-
-L(common):
-IFSTD(` mov %r11, n ')
-
- and $3, R32(%r11)
- lea -16(rp,n,8), rp
- jz L(b0)
- cmp $2, R32(%r11)
- jb L(b1)
- jz L(b2)
-
-L(b3): mov %rax, %r10
- mov %rdx, %r11
- mov 8(up), %rax
- mul v0
- lea (up,n,8), up
- not n
- jmp L(L3)
-
-L(b0): mov %rax, %r9
- mov %rdx, %r10
- mov 8(up), %rax
- lea (up,n,8), up
- neg n
- jmp L(L0)
-
-L(b1): mov %rax, %r8
- cmp $1, n
- jz L(n1)
- mov %rdx, %r9
- lea (up,n,8), up
- neg n
- mov %r8, 16(rp,n,8)
- inc n
- jmp L(L1)
-
-L(b2): mov %rax, %r11
- mov %rdx, %r8
- mov 8(up), %rax
- lea (up,n,8), up
- neg n
- add $2, n
- jns L(end)
-
- ALIGN(16)
-L(top): mul v0
- mov %rdx, %r9
- add %rax, %r8
- adc $0, %r9
- mov %r8, 8(rp,n,8)
- mov %r11, (rp,n,8)
-L(L1): mov (up,n,8), %rax
- mul v0
- add %rax, %r9
- mov %rdx, %r10
- mov 8(up,n,8), %rax
- adc $0, %r10
-L(L0): mul v0
- add %rax, %r10
- mov %rdx, %r11
- mov 16(up,n,8), %rax
- adc $0, %r11
- mul v0
- mov %r9, 16(rp,n,8)
-L(L3): add %rax, %r11
- mov %r10, 24(rp,n,8)
- mov %rdx, %r8
- adc $0, %r8
- add $4, n
- mov -8(up,n,8), %rax
- js L(top)
-
-L(end): mul v0
- add %rax, %r8
- adc $0, %rdx
- mov %r11, (rp)
-L(n1): mov %r8, 8(rp)
- mov %rdx, %rax
-
- pop %rbx
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86_64/bd1/mul_2.asm b/gmp/mpn/x86_64/bd1/mul_2.asm
deleted file mode 100644
index 4ed5f30561..0000000000
--- a/gmp/mpn/x86_64/bd1/mul_2.asm
+++ /dev/null
@@ -1,192 +0,0 @@
-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/gmp/mpn/x86_64/bd1/mul_basecase.asm b/gmp/mpn/x86_64/bd1/mul_basecase.asm
deleted file mode 100644
index e47ba587cd..0000000000
--- a/gmp/mpn/x86_64/bd1/mul_basecase.asm
+++ /dev/null
@@ -1,416 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/bd1/popcount.asm b/gmp/mpn/x86_64/bd1/popcount.asm
deleted file mode 100644
index 8f22a715b6..0000000000
--- a/gmp/mpn/x86_64/bd1/popcount.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl AMD64 mpn_popcount -- population count.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86_64/k10/popcount.asm')
diff --git a/gmp/mpn/x86_64/bd1/sec_tabselect.asm b/gmp/mpn/x86_64/bd1/sec_tabselect.asm
deleted file mode 100644
index e4360341d9..0000000000
--- a/gmp/mpn/x86_64/bd1/sec_tabselect.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/bd1/sublsh1_n.asm b/gmp/mpn/x86_64/bd1/sublsh1_n.asm
deleted file mode 100644
index 4ba673d15a..0000000000
--- a/gmp/mpn/x86_64/bd1/sublsh1_n.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/bd2/gmp-mparam.h b/gmp/mpn/x86_64/bd2/gmp-mparam.h
deleted file mode 100644
index 16f25c4c7b..0000000000
--- a/gmp/mpn/x86_64/bd2/gmp-mparam.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/* 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
diff --git a/gmp/mpn/x86_64/bdiv_dbm1c.asm b/gmp/mpn/x86_64/bdiv_dbm1c.asm
index a53bd52beb..8d73b9fe00 100644
--- a/gmp/mpn/x86_64/bdiv_dbm1c.asm
+++ b/gmp/mpn/x86_64/bdiv_dbm1c.asm
@@ -1,106 +1,98 @@
dnl x86_64 mpn_bdiv_dbm1.
-dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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.25
-C Intel P4 12.5
-C Intel core2 4
-C Intel NHM 3.75
-C Intel SBR 3.6
-C Intel atom 20
-C VIA nano 4
+C K8,K9: 2.25
+C K10: ?
+C P4: 12.5
+C P6-15 (Core2): 4.0
+C P6-28 (Atom): 20
C TODO
-C * Optimise feed-in code.
-
-C INPUT PARAMETERS
-define(`qp', `%rdi')
-define(`up', `%rsi')
-define(`n_param', `%rdx')
-define(`bd', `%rcx')
-define(`cy', `%r8')
+C * Do proper 4-way feed-in instead of the current epilogue
-define(`n', `%r9')
+C INPUT PARAMETERS shared
+define(`qp', `%rdi')
+define(`up', `%rsi')
+define(`n', `%rdx')
+define(`bd', `%rcx')
+define(`cy', `%r8')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_bdiv_dbm1c)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- mov (up), %rax
- mov n_param, n
- mov R32(n_param), R32(%r11)
- mul bd
- lea (up,n,8), up
- lea (qp,n,8), qp
- neg n
- and $3, R32(%r11)
- jz L(lo0)
- lea -4(n,%r11), n
- cmp $2, R32(%r11)
- jc L(lo1)
- jz L(lo2)
- jmp L(lo3)
+ mov (%rsi), %rax
+ mov %rdx, %r9 C n
+ mul %rcx
+ sub %rax, %r8
+ mov %r8, (%rdi)
+ sbb %rdx, %r8
+
+ lea (%rsi,%r9,8), %rsi
+ lea (%rdi,%r9,8), %rdi
+ neg %r9
+ add $4, %r9
+ jns L(end)
ALIGN(16)
-L(top): mov (up,n,8), %rax
- mul bd
-L(lo0): sub %rax, %r8
- mov %r8, (qp,n,8)
+L(top):
+ mov -24(%rsi,%r9,8), %rax
+ mul %rcx
+ sub %rax, %r8
+ mov %r8, -24(%rdi,%r9,8)
sbb %rdx, %r8
- mov 8(up,n,8), %rax
- mul bd
-L(lo3): sub %rax, %r8
- mov %r8, 8(qp,n,8)
+L(3):
+ mov -16(%rsi,%r9,8), %rax
+ mul %rcx
+ sub %rax, %r8
+ mov %r8, -16(%rdi,%r9,8)
sbb %rdx, %r8
- mov 16(up,n,8), %rax
- mul bd
-L(lo2): sub %rax, %r8
- mov %r8, 16(qp,n,8)
+L(2):
+ mov -8(%rsi,%r9,8), %rax
+ mul %rcx
+ sub %rax, %r8
+ mov %r8, -8(%rdi,%r9,8)
sbb %rdx, %r8
- mov 24(up,n,8), %rax
- mul bd
-L(lo1): sub %rax, %r8
- mov %r8, 24(qp,n,8)
+L(1):
+ mov (%rsi,%r9,8), %rax
+ mul %rcx
+ sub %rax, %r8
+ mov %r8, (%rdi,%r9,8)
sbb %rdx, %r8
- add $4, n
- jnz L(top)
- mov %r8, %rax
- FUNC_EXIT()
+ add $4, %r9
+ js L(top)
+L(end):
+ je L(3x)
+ cmp $2, %r9
+ jg L(ret)
+ mov $-1, %r9
+ je L(1)
+ jmp L(2)
+L(3x):
+ dec %r9
+ jmp L(3)
+
+L(ret): mov %r8, %rax
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/bdiv_q_1.asm b/gmp/mpn/x86_64/bdiv_q_1.asm
deleted file mode 100644
index 02eacbe6a8..0000000000
--- a/gmp/mpn/x86_64/bdiv_q_1.asm
+++ /dev/null
@@ -1,167 +0,0 @@
-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-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 10
-C AMD K10 10
-C Intel P4 33
-C Intel core2 13.25
-C Intel corei 14
-C Intel atom 42
-C VIA nano ?
-
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-define(`d', `%rcx')
-define(`di', `%r8') C just mpn_pi1_bdiv_q_1
-define(`ncnt', `%r9') C just mpn_pi1_bdiv_q_1
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_bdiv_q_1)
- FUNC_ENTRY(4)
- push %rbx
-
- mov %rcx, %rax
- xor R32(%rcx), R32(%rcx) C ncnt count
- mov %rdx, %r10
-
- bt $0, R32(%rax)
- jnc L(evn) C skip bsfq unless divisor is even
-
-L(odd): mov %rax, %rbx
- shr R32(%rax)
- and $127, R32(%rax) C d/2, 7 bits
-
- LEA( binvert_limb_table, %rdx)
-
- movzbl (%rdx,%rax), R32(%rax) C inv 8 bits
-
- mov %rbx, %r11 C d without twos
-
- lea (%rax,%rax), R32(%rdx) C 2*inv
- imul R32(%rax), R32(%rax) C inv*inv
- imul R32(%rbx), R32(%rax) C inv*inv*d
- sub R32(%rax), R32(%rdx) C inv = 2*inv - inv*inv*d, 16 bits
-
- lea (%rdx,%rdx), R32(%rax) C 2*inv
- imul R32(%rdx), R32(%rdx) C inv*inv
- imul R32(%rbx), R32(%rdx) C inv*inv*d
- sub R32(%rdx), R32(%rax) C inv = 2*inv - inv*inv*d, 32 bits
-
- lea (%rax,%rax), %r8 C 2*inv
- imul %rax, %rax C inv*inv
- imul %rbx, %rax C inv*inv*d
- sub %rax, %r8 C inv = 2*inv - inv*inv*d, 64 bits
-
- jmp L(com)
-
-L(evn): bsf %rax, %rcx
- shr R8(%rcx), %rax
- jmp L(odd)
-EPILOGUE()
-
-PROLOGUE(mpn_pi1_bdiv_q_1)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
-IFDOS(` mov 64(%rsp), %r9 ')
- push %rbx
-
- mov %rcx, %r11 C d
- mov %rdx, %r10 C n
- mov %r9, %rcx C ncnt
-
-L(com): mov (up), %rax C up[0]
-
- dec %r10
- jz L(one)
-
- mov 8(up), %rdx C up[1]
- lea (up,%r10,8), up C up end
- lea (rp,%r10,8), rp C rp end
- neg %r10 C -n
-
- shrd R8(%rcx), %rdx, %rax
-
- xor R32(%rbx), R32(%rbx)
- jmp L(ent)
-
- ALIGN(8)
-L(top):
- C rax q
- C rbx carry bit, 0 or 1
- C rcx ncnt
- C rdx
- C r10 counter, limbs, negative
-
- mul %r11 C carry limb in rdx
- mov (up,%r10,8), %rax
- mov 8(up,%r10,8), %r9
- shrd R8(%rcx), %r9, %rax
- nop
- sub %rbx, %rax C apply carry bit
- setc R8(%rbx)
- sub %rdx, %rax C apply carry limb
- adc $0, %rbx
-L(ent): imul %r8, %rax
- mov %rax, (rp,%r10,8)
- inc %r10
- jnz L(top)
-
- mul %r11 C carry limb in rdx
- mov (up), %rax C up high limb
- shr R8(%rcx), %rax
- sub %rbx, %rax C apply carry bit
- sub %rdx, %rax C apply carry limb
- imul %r8, %rax
- mov %rax, (rp)
- pop %rbx
- FUNC_EXIT()
- ret
-
-L(one): shr R8(%rcx), %rax
- imul %r8, %rax
- mov %rax, (rp)
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/bobcat/aors_n.asm b/gmp/mpn/x86_64/bobcat/aors_n.asm
deleted file mode 100644
index 22287b8558..0000000000
--- a/gmp/mpn/x86_64/bobcat/aors_n.asm
+++ /dev/null
@@ -1,150 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/bobcat/aorsmul_1.asm b/gmp/mpn/x86_64/bobcat/aorsmul_1.asm
deleted file mode 100644
index 415a17cb7f..0000000000
--- a/gmp/mpn/x86_64/bobcat/aorsmul_1.asm
+++ /dev/null
@@ -1,183 +0,0 @@
-dnl AMD64 mpn_addmul_1 and mpn_submul_1 optimised for AMD bobcat.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.5
-C AMD K10 4.5
-C AMD bd1 4.75
-C AMD bobcat 5
-C Intel P4 17.7
-C Intel core2 5.5
-C Intel NHM 5.43
-C Intel SBR 3.92
-C Intel atom 23
-C VIA nano 5.63
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ifdef(`OPERATION_addmul_1',`
- define(`ADDSUB', `add')
- define(`func', `mpn_addmul_1')
-')
-ifdef(`OPERATION_submul_1',`
- define(`ADDSUB', `sub')
- define(`func', `mpn_submul_1')
-')
-
-MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
-
-C Standard parameters
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n_param', `%rdx')
-define(`v0', `%rcx')
-C Standard allocations
-define(`n', `%rbx')
-define(`w0', `%r8')
-define(`w1', `%r9')
-define(`w2', `%r10')
-define(`w3', `%r11')
-
-C DOS64 parameters
-IFDOS(` define(`rp', `%rcx') ') dnl
-IFDOS(` define(`up', `%rsi') ') dnl
-IFDOS(` define(`n_param', `%r8') ') dnl
-IFDOS(` define(`v0', `%r9') ') dnl
-C DOS64 allocations
-IFDOS(` define(`n', `%rbx') ') dnl
-IFDOS(` define(`w0', `%r8') ') dnl
-IFDOS(` define(`w1', `%rdi') ') dnl
-IFDOS(` define(`w2', `%r10') ') dnl
-IFDOS(` define(`w3', `%r11') ') dnl
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
-IFDOS(` push %rsi ')
-IFDOS(` push %rdi ')
-IFDOS(` mov %rdx, %rsi ')
-
- push %rbx
- mov (up), %rax
-
- lea -16(rp,n_param,8), rp
- lea -16(up,n_param,8), up
-
- mov n_param, n
- and $3, R32(n_param)
- jz L(b0)
- cmp $2, R32(n_param)
- ja L(b3)
- jz L(b2)
-
-L(b1): mul v0
- cmp $1, n
- jz L(n1)
- mov %rax, w2
- mov %rdx, w3
- neg n
- add $3, n
- jmp L(L1)
-L(n1): ADDSUB %rax, 8(rp)
- adc $0, %rdx
- mov %rdx, %rax
- pop %rbx
-IFDOS(` pop %rdi ')
-IFDOS(` pop %rsi ')
- ret
-
-L(b3): mul v0
- mov %rax, w2
- mov %rdx, w3
- neg n
- inc n
- jmp L(L3)
-
-L(b0): mul v0
- mov %rax, w0
- mov %rdx, w1
- neg n
- add $2, n
- jmp L(L0)
-
-L(b2): mul v0
- mov %rax, w0
- mov %rdx, w1
- neg n
- jmp L(L2)
-
- ALIGN(16)
-L(top): ADDSUB w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
-L(L1): mov 0(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- ADDSUB w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
-L(L0): mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- ADDSUB w0, 0(rp,n,8)
- adc w1, w2
- adc $0, w3
-L(L3): mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- ADDSUB w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
-L(L2): mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(top)
-
-L(end): ADDSUB w0, (rp)
- adc w1, w2
- adc $0, w3
- ADDSUB w2, 8(rp)
- adc $0, w3
- mov w3, %rax
-
- pop %rbx
-IFDOS(` pop %rdi ')
-IFDOS(` pop %rsi ')
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/bobcat/copyd.asm b/gmp/mpn/x86_64/bobcat/copyd.asm
deleted file mode 100644
index 877714e903..0000000000
--- a/gmp/mpn/x86_64/bobcat/copyd.asm
+++ /dev/null
@@ -1,91 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-C AMD K10 1-2 (alignment fluctuations)
-C AMD bd1 ?
-C AMD bobcat 1.5
-C Intel P4 2.8
-C Intel core2 1
-C Intel NHM 1-1.25
-C Intel SBR 1
-C Intel atom 2.87
-C VIA nano 2
-
-C INPUT PARAMETERS
-C rp rdi
-C up rsi
-C n rdx
-
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`n',`%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_copyd)
- FUNC_ENTRY(3)
- sub $4, n
- jl L(end)
- ALIGN(16)
-L(top): mov 24(up,n,8), %r8
- mov %r8, 24(rp,n,8)
- mov 16(up,n,8), %r8
- mov %r8, 16(rp,n,8)
- mov 8(up,n,8), %r8
- mov %r8, 8(rp,n,8)
- mov (up,n,8), %r8
- mov %r8, (rp,n,8)
-L(ent): sub $4, n
- jge L(top)
-
-L(end): cmp $-4, R32(n)
- jz L(ret)
- mov 24(up,n,8), %r8
- mov %r8, 24(rp,n,8)
- cmp $-3, R32(n)
- jz L(ret)
- mov 16(up,n,8), %r8
- mov %r8, 16(rp,n,8)
- cmp $-2, R32(n)
- jz L(ret)
- mov 8(up,n,8), %r8
- mov %r8, 8(rp,n,8)
-
-L(ret): FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/bobcat/copyi.asm b/gmp/mpn/x86_64/bobcat/copyi.asm
deleted file mode 100644
index ee0f578652..0000000000
--- a/gmp/mpn/x86_64/bobcat/copyi.asm
+++ /dev/null
@@ -1,94 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-C AMD K10 1-2 (alignment fluctuations)
-C AMD bd1 ?
-C AMD bobcat 1.5
-C Intel P4 2.8
-C Intel core2 1
-C Intel NHM 1-1.25
-C Intel SBR 1
-C Intel atom 2.87
-C VIA nano 2
-
-C INPUT PARAMETERS
-C rp rdi
-C up rsi
-C n rdx
-
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`n',`%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_copyi)
- FUNC_ENTRY(3)
- lea -32(up,n,8), up
- lea -32(rp,n,8), rp
- neg n
- add $4, n
- jg L(end)
- ALIGN(16)
-L(top): mov (up,n,8), %r8
- mov %r8, (rp,n,8)
- mov 8(up,n,8), %r8
- mov %r8, 8(rp,n,8)
- mov 16(up,n,8), %r8
- mov %r8, 16(rp,n,8)
- mov 24(up,n,8), %r8
- mov %r8, 24(rp,n,8)
-L(ent): add $4, n
- jle L(top)
-
-L(end): cmp $4, R32(n)
- jz L(ret)
- mov (up,n,8), %r8
- mov %r8, (rp,n,8)
- cmp $3, R32(n)
- jz L(ret)
- mov 8(up,n,8), %r8
- mov %r8, 8(rp,n,8)
- cmp $2, R32(n)
- jz L(ret)
- mov 16(up,n,8), %r8
- mov %r8, 16(rp,n,8)
-
-L(ret): FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/bobcat/gmp-mparam.h b/gmp/mpn/x86_64/bobcat/gmp-mparam.h
deleted file mode 100644
index de4c4e4528..0000000000
--- a/gmp/mpn/x86_64/bobcat/gmp-mparam.h
+++ /dev/null
@@ -1,208 +0,0 @@
-/* AMD Bobcat gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-#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 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 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 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 26
-#define SQR_TOOM3_THRESHOLD 93
-#define SQR_TOOM4_THRESHOLD 375
-#define SQR_TOOM6_THRESHOLD 0 /* always */
-#define SQR_TOOM8_THRESHOLD 478
-
-#define MULMID_TOOM42_THRESHOLD 22
-
-#define MULMOD_BNM1_THRESHOLD 11
-#define SQRMOD_BNM1_THRESHOLD 13
-
-#define MUL_FFT_MODF_THRESHOLD 400 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 400, 5}, { 17, 6}, { 9, 5}, { 19, 6}, \
- { 10, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 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 \
- { { 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}, \
- { 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}, { 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 26
-#define MULLO_MUL_N_THRESHOLD 10950
-
-#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 46
-#define INV_NEWTON_THRESHOLD 236
-#define INV_APPR_THRESHOLD 204
-
-#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 1499
-#define MU_DIVAPPR_Q_THRESHOLD 1499
-#define MUPI_DIV_QR_THRESHOLD 84
-#define MU_BDIV_QR_THRESHOLD 1334
-#define MU_BDIV_Q_THRESHOLD 1470
-
-#define POWM_SEC_TABLE 1,16,194,904,1167
-
-#define MATRIX22_STRASSEN_THRESHOLD 15
-#define HGCD_THRESHOLD 102
-#define HGCD_APPR_THRESHOLD 50
-#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 15
-#define GET_STR_PRECOMPUTE_THRESHOLD 26
-#define SET_STR_DC_THRESHOLD 248
-#define SET_STR_PRECOMPUTE_THRESHOLD 1160
-
-#define FAC_DSC_THRESHOLD 746
-#define FAC_ODD_THRESHOLD 44
diff --git a/gmp/mpn/x86_64/bobcat/mul_1.asm b/gmp/mpn/x86_64/bobcat/mul_1.asm
deleted file mode 100644
index cb58bef0b3..0000000000
--- a/gmp/mpn/x86_64/bobcat/mul_1.asm
+++ /dev/null
@@ -1,187 +0,0 @@
-dnl AMD64 mpn_mul_1 optimised for AMD bobcat.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.5
-C AMD K10 4.5
-C AMD bd1 4.62
-C AMD bobcat 5
-C Intel P4 14
-C Intel core2 4.5
-C Intel NHM 4.23
-C Intel SBR 3.0
-C Intel atom 21
-C VIA nano 4.94
-
-C 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)
-
-C Standard parameters
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n_param', `%rdx')
-define(`v0', `%rcx')
-define(`cy', `%r8')
-C Standard allocations
-define(`n', `%rbx')
-define(`w0', `%r8')
-define(`w1', `%r9')
-define(`w2', `%r10')
-define(`w3', `%r11')
-
-C DOS64 parameters
-IFDOS(` define(`rp', `%rcx') ') dnl
-IFDOS(` define(`up', `%rsi') ') dnl
-IFDOS(` define(`n_param', `%r8') ') dnl
-IFDOS(` define(`v0', `%r9') ') dnl
-IFDOS(` define(`cy', `64(%rsp)')') dnl
-C DOS64 allocations
-IFDOS(` define(`n', `%rbx') ') dnl
-IFDOS(` define(`w0', `%r8') ') dnl
-IFDOS(` define(`w1', `%rdi') ') dnl
-IFDOS(` define(`w2', `%r10') ') dnl
-IFDOS(` define(`w3', `%r11') ') dnl
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mul_1c)
-IFDOS(` push %rsi ')
-IFDOS(` push %rdi ')
-IFDOS(` mov %rdx, %rsi ')
- mov cy, w2
- jmp L(com)
-EPILOGUE()
-
-PROLOGUE(mpn_mul_1)
-IFDOS(` push %rsi ')
-IFDOS(` push %rdi ')
-IFDOS(` mov %rdx, %rsi ')
- xor w2, w2
-L(com): push %rbx
- mov (up), %rax
-
- lea -16(rp,n_param,8), rp
- lea -16(up,n_param,8), up
-
- mov n_param, n
- and $3, R32(n_param)
- jz L(b0)
- cmp $2, R32(n_param)
- ja L(b3)
- jz L(b2)
-
-L(b1): mul v0
- cmp $1, n
- jz L(n1)
- neg n
- add $3, n
- add %rax, w2
- mov %rdx, w3
- jmp L(L1)
-L(n1): add %rax, w2
- mov %rdx, %rax
- mov w2, 8(rp)
- adc $0, %rax
- pop %rbx
-IFDOS(` pop %rdi ')
-IFDOS(` pop %rsi ')
- ret
-
-L(b3): mul v0
- neg n
- inc n
- add %rax, w2
- mov %rdx, w3
- jmp L(L3)
-
-L(b0): mul v0
- mov %rax, w0
- mov %rdx, w1
- neg n
- add $2, n
- add w2, w0
- jmp L(L0)
-
-L(b2): mul v0
- mov %rax, w0
- mov %rdx, w1
- neg n
- add w2, w0
- jmp L(L2)
-
- ALIGN(16)
-L(top): mov w0, -16(rp,n,8)
- add w1, w2
-L(L1): adc $0, w3
- mov 0(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, -8(rp,n,8)
- add w3, w0
-L(L0): adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- mov w0, 0(rp,n,8)
- add w1, w2
-L(L3): adc $0, w3
- mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, 8(rp,n,8)
- add w3, w0
-L(L2): adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(top)
-
-L(end): mov w0, (rp)
- add w1, w2
- adc $0, w3
- mov w2, 8(rp)
- mov w3, %rax
-
- pop %rbx
-IFDOS(` pop %rdi ')
-IFDOS(` pop %rsi ')
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/bobcat/mul_basecase.asm b/gmp/mpn/x86_64/bobcat/mul_basecase.asm
deleted file mode 100644
index e7d46bfcff..0000000000
--- a/gmp/mpn/x86_64/bobcat/mul_basecase.asm
+++ /dev/null
@@ -1,486 +0,0 @@
-dnl AMD64 mpn_mul_basecase optimised for AMD bobcat.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.5
-C AMD K10 4.5
-C AMD bd1 4.75
-C AMD bobcat 5
-C Intel P4 17.7
-C Intel core2 5.5
-C Intel NHM 5.43
-C Intel SBR 3.92
-C Intel atom 23
-C VIA nano 5.63
-
-C This mul_basecase is based on mul_1 and addmul_1, since these both run at the
-C multiply insn bandwidth, without any apparent loop branch exit pipeline
-C replays experienced on K8. The structure is unusual: it falls into mul_1 in
-C the same way for all n, then it splits into 4 different wind-down blocks and
-C 4 separate addmul_1 loops.
-C
-C We have not tried using the same addmul_1 loops with a switch into feed-in
-C code, as we do in other basecase implementations. Doing that could save
-C substantial code volume, but would also probably add some overhead.
-
-C TODO
-C * Tune un < 3 code.
-C * Fix slowdown for un=vn=3 (67->71) compared to default code.
-C * This is 1263 bytes, compared to 1099 bytes for default code. Consider
-C combining addmul loops like that code. Tolerable slowdown?
-C * Lots of space could be saved by replacing the "switch" code by gradual
-C jumps out from mul_1 winddown code, perhaps with no added overhead.
-C * Are the ALIGN(16) really necessary? They add about 25 bytes of padding.
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-C Standard parameters
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`un_param', `%rdx')
-define(`vp', `%rcx')
-define(`vn', `%r8')
-C Standard allocations
-define(`un', `%rbx')
-define(`w0', `%r10')
-define(`w1', `%r11')
-define(`w2', `%r12')
-define(`w3', `%r13')
-define(`n', `%rbp')
-define(`v0', `%r9')
-
-C Temp macro for allowing control over indexing.
-C Define to return $1 for more conservative ptr handling.
-define(`X',`$2')
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mul_basecase)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ')
-
- mov (up), %rax
- mov (vp), v0
-
- cmp $2, un_param
- ja L(ge3)
- jz L(u2)
-
- mul v0 C u0 x v0
- mov %rax, (rp)
- mov %rdx, 8(rp)
- FUNC_EXIT()
- ret
-
-L(u2): mul v0 C u0 x v0
- mov %rax, (rp)
- mov 8(up), %rax
- mov %rdx, w0
- mul v0
- add %rax, w0
- mov %rdx, w1
- adc $0, w1
- cmp $1, R32(vn)
- jnz L(u2v2)
- mov w0, 8(rp)
- mov w1, 16(rp)
- FUNC_EXIT()
- ret
-
-L(u2v2):mov 8(vp), v0
- mov (up), %rax
- mul v0
- add %rax, w0
- mov w0, 8(rp)
- mov %rdx, %r8 C CAUTION: r8 realloc
- adc $0, %r8
- mov 8(up), %rax
- mul v0
- add w1, %r8
- adc $0, %rdx
- add %r8, %rax
- adc $0, %rdx
- mov %rax, 16(rp)
- mov %rdx, 24(rp)
- FUNC_EXIT()
- ret
-
-
-L(ge3): push %rbx
- push %rbp
- push %r12
- push %r13
-
- lea 8(vp), vp
-
- lea -24(rp,un_param,8), rp
- lea -24(up,un_param,8), up
- xor R32(un), R32(un)
- mov $2, R32(n)
- sub un_param, un
- sub un_param, n
-
- mul v0
- mov %rax, w2
- mov %rdx, w3
- jmp L(L3)
-
- ALIGN(16)
-L(top): mov w0, -16(rp,n,8)
- add w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, -8(rp,n,8)
- add w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- mov w0, (rp,n,8)
- add w1, w2
- adc $0, w3
-L(L3): mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, 8(rp,n,8)
- add w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(top)
-
- mov w0, -16(rp,n,8)
- add w1, w2
- adc $0, w3
-
-C Switch on n into right addmul_l loop
- test n, n
- jz L(r2)
- cmp $2, R32(n)
- ja L(r3)
- jz L(r0)
- jmp L(r1)
-
-
-L(r3): mov w2, X(-8(rp,n,8),16(rp))
- mov w3, X((rp,n,8),24(rp))
- add $2, un
-
-C outer loop(3)
-L(to3): dec vn
- jz L(ret)
- mov (vp), v0
- mov 8(up,un,8), %rax
- lea 8(vp), vp
- lea 8(rp), rp
- mov un, n
- mul v0
- mov %rax, w2
- mov %rdx, w3
- jmp L(al3)
-
- ALIGN(16)
-L(ta3): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
-L(al3): mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta3)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
- jmp L(to3)
-
-
-L(r2): mov X(0(up,n,8),(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(-8(rp,n,8),-8(rp))
- add w3, w0
- adc $0, w1
- mov X(8(up,n,8),8(up)), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- mov w0, X((rp,n,8),(rp))
- add w1, w2
- adc $0, w3
- mov X(16(up,n,8),16(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(8(rp,n,8),8(rp))
- add w3, w0
- adc $0, w1
- mov w0, X(16(rp,n,8),16(rp))
- adc $0, w3
- mov w1, X(24(rp,n,8),24(rp))
- inc un
-
-C outer loop(2)
-L(to2): dec vn
- jz L(ret)
- mov (vp), v0
- mov 16(up,un,8), %rax
- lea 8(vp), vp
- lea 8(rp), rp
- mov un, n
- mul v0
- mov %rax, w0
- mov %rdx, w1
- jmp L(al2)
-
- ALIGN(16)
-L(ta2): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
- mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
-L(al2): mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta2)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
- jmp L(to2)
-
-
-L(r1): mov X(0(up,n,8),8(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(-8(rp,n,8),(rp))
- add w3, w0
- adc $0, w1
- mov X(8(up,n,8),16(up)), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- mov w0, X((rp,n,8),8(rp))
- add w1, w2
- adc $0, w3
- mov w2, X(8(rp,n,8),16(rp))
- mov w3, X(16(rp,n,8),24(rp))
- add $4, un
-
-C outer loop(1)
-L(to1): dec vn
- jz L(ret)
- mov (vp), v0
- mov -8(up,un,8), %rax
- lea 8(vp), vp
- lea 8(rp), rp
- mov un, n
- mul v0
- mov %rax, w2
- mov %rdx, w3
- jmp L(al1)
-
- ALIGN(16)
-L(ta1): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
-L(al1): mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
- mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta1)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
- jmp L(to1)
-
-
-L(r0): mov X((up,n,8),16(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(-8(rp,n,8),8(rp))
- add w3, w0
- adc $0, w1
- mov w0, X((rp,n,8),16(rp))
- mov w1, X(8(rp,n,8),24(rp))
- add $3, un
-
-C outer loop(0)
-L(to0): dec vn
- jz L(ret)
- mov (vp), v0
- mov (up,un,8), %rax
- lea 8(vp), vp
- lea 8(rp), rp
- mov un, n
- mul v0
- mov %rax, w0
- mov %rdx, w1
- jmp L(al0)
-
- ALIGN(16)
-L(ta0): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
-L(al0): mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
- mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta0)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
- jmp L(to0)
-
-
-L(ret): pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/bobcat/redc_1.asm b/gmp/mpn/x86_64/bobcat/redc_1.asm
deleted file mode 100644
index c3798021f7..0000000000
--- a/gmp/mpn/x86_64/bobcat/redc_1.asm
+++ /dev/null
@@ -1,502 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/bobcat/sqr_basecase.asm b/gmp/mpn/x86_64/bobcat/sqr_basecase.asm
deleted file mode 100644
index 0e417a1ebe..0000000000
--- a/gmp/mpn/x86_64/bobcat/sqr_basecase.asm
+++ /dev/null
@@ -1,565 +0,0 @@
-dnl AMD64 mpn_sqr_basecase optimised for AMD bobcat.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.5
-C AMD K10 4.5
-C AMD bd1 4.75
-C AMD bobcat 5
-C Intel P4 17.7
-C Intel core2 5.5
-C Intel NHM 5.43
-C Intel SBR 3.92
-C Intel atom 23
-C VIA nano 5.63
-
-C This sqr_basecase is based on mul_1 and addmul_1, since these both run at the
-C multiply insn bandwidth, without any apparent loop branch exit pipeline
-C replays experienced on K8. The structure is unusual: it falls into mul_1 in
-C the same way for all n, then it splits into 4 different wind-down blocks and
-C 4 separate addmul_1 loops.
-C
-C We have not tried using the same addmul_1 loops with a switch into feed-in
-C code, as we do in other basecase implementations. Doing that could save
-C substantial code volume, but would also probably add some overhead.
-
-C TODO
-C * Tune un < 4 code.
-C * Perhaps implement a larger final corner (it is now 2 x 1).
-C * Lots of space could be saved by replacing the "switch" code by gradual
-C jumps out from mul_1 winddown code, perhaps with no added overhead.
-C * Are the ALIGN(16) really necessary? They add about 25 bytes of padding.
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-C Standard parameters
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`un_param', `%rdx')
-C Standard allocations
-define(`un', `%rbx')
-define(`w0', `%r8')
-define(`w1', `%r9')
-define(`w2', `%r10')
-define(`w3', `%r11')
-define(`n', `%rbp')
-define(`v0', `%rcx')
-
-C Temp macro for allowing control over indexing.
-C Define to return $1 for more conservative ptr handling.
-define(`X',`$2')
-dnl define(`X',`$1')
-
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_sqr_basecase)
- FUNC_ENTRY(3)
-
- mov (up), %rax
-
- cmp $2, R32(un_param)
- jae L(ge2)
-
- mul %rax
- mov %rax, (rp)
- mov %rdx, 8(rp)
- FUNC_EXIT()
- ret
-
-L(ge2): mov (up), v0
- jnz L(g2)
-
- mul %rax
- mov %rax, (rp)
- mov 8(up), %rax
- mov %rdx, w0
- mul v0
- add %rax, w0
- mov %rdx, w1
- adc $0, w1
- mov 8(up), v0
- mov (up), %rax
- mul v0
- add %rax, w0
- mov w0, 8(rp)
- mov %rdx, w0 C CAUTION: r8 realloc
- adc $0, w0
- mov 8(up), %rax
- mul v0
- add w1, w0
- adc $0, %rdx
- add w0, %rax
- adc $0, %rdx
- mov %rax, 16(rp)
- mov %rdx, 24(rp)
- FUNC_EXIT()
- ret
-
-L(g2): cmp $3, R32(un_param)
- ja L(g3)
- mul %rax
- mov %rax, (rp)
- mov %rdx, 8(rp)
- mov 8(up), %rax
- 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 (up), v0
- mov 8(up), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov 16(up), %rax
- mul v0
- xor R32(w2), R32(w2)
- add %rax, w1
- adc %rdx, w2
-
- mov 8(up), v0
- mov 16(up), %rax
- mul v0
- xor R32(w3), R32(w3)
- add %rax, w2
- adc %rdx, w3
- add w0, w0
- adc w1, w1
- adc w2, w2
- adc w3, w3
- mov $0, R32(v0)
- adc v0, v0
- add w0, 8(rp)
- adc w1, 16(rp)
- adc w2, 24(rp)
- adc w3, 32(rp)
- adc v0, 40(rp)
- FUNC_EXIT()
- ret
-
-L(g3): push %rbx
- push %rbp
-
- mov 8(up), %rax
- lea -24(rp,un_param,8), rp
- lea -24(up,un_param,8), up
- neg un_param
- push un_param C for sqr_diag_addlsh1
- lea (un_param), un
- lea 3(un_param), n
-
- mul v0
- mov %rax, w2
- mov %rdx, w3
- jmp L(L3)
-
- ALIGN(16)
-L(top): mov w0, -16(rp,n,8)
- add w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, -8(rp,n,8)
- add w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- mov w0, (rp,n,8)
- add w1, w2
- adc $0, w3
-L(L3): mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, 8(rp,n,8)
- add w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(top)
-
- mov w0, -16(rp,n,8)
- add w1, w2
- adc $0, w3
-
- test n, n
- jz L(r2)
- cmp $2, R32(n)
- ja L(r3)
- jz L(r0)
-
-
-L(r1): mov X((up,n,8),8(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(-8(rp,n,8),(rp))
- add w3, w0
- adc $0, w1
- mov X(8(up,n,8),16(up)), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- mov w0, X((rp,n,8),8(rp))
- add w1, w2
- adc $0, w3
- mov w2, X(8(rp,n,8),16(rp))
- mov w3, X(16(rp,n,8),24(rp))
- add $5, un
- jmp L(to0)
-
-L(r2): mov X((up,n,8),(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(-8(rp,n,8),-8(rp))
- add w3, w0
- adc $0, w1
- mov X(8(up,n,8),8(up)), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- mov w0, X((rp,n,8),(rp))
- add w1, w2
- adc $0, w3
- mov X(16(up,n,8),16(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(8(rp,n,8),8(rp))
- add w3, w0
- adc $0, w1
- mov w0, X(16(rp,n,8),16(rp))
- adc $0, w3
- mov w1, X(24(rp,n,8),24(rp))
- add $6, un
- jmp L(to1)
-
-L(r3): mov w2, X(-8(rp,n,8),16(rp))
- mov w3, X((rp,n,8),24(rp))
- add $3, un
- jmp L(to2)
-
-L(r0): mov X((up,n,8),16(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov w2, X(-8(rp,n,8),8(rp))
- add w3, w0
- adc $0, w1
- mov w0, X((rp,n,8),16(rp))
- mov w1, X(8(rp,n,8),24(rp))
- add $4, un
-C jmp L(to3)
-C fall through into main loop
-
-
-L(outer):
- mov un, n
- mov (up,un,8), v0
- mov 8(up,un,8), %rax
- lea 8(rp), rp
- mul v0
- mov %rax, w2
- mov %rdx, w3
- jmp L(al3)
-
- ALIGN(16)
-L(ta3): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
-L(al3): mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta3)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
-
-
-L(to2): mov un, n
- cmp $-4, R32(un)
- jnc L(end)
- add $4, un
- mov 8(up,n,8), v0
- mov 16(up,n,8), %rax
- lea 8(rp), rp
- mul v0
- mov %rax, w0
- mov %rdx, w1
- jmp L(al2)
-
- ALIGN(16)
-L(ta2): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
- mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
-L(al2): mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta2)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
-
-
-L(to1): mov un, n
- mov -16(up,un,8), v0
- mov -8(up,un,8), %rax
- lea 8(rp), rp
- mul v0
- mov %rax, w2
- mov %rdx, w3
- jmp L(al1)
-
- ALIGN(16)
-L(ta1): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
-L(al1): mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
- mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta1)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
-
-
-L(to0): mov un, n
- mov -8(up,un,8), v0
- mov (up,un,8), %rax
- lea 8(rp), rp
- mul v0
- mov %rax, w0
- mov %rdx, w1
- jmp L(al0)
-
- ALIGN(16)
-L(ta0): add w0, -16(rp,n,8)
- adc w1, w2
- adc $0, w3
- mov (up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, -8(rp,n,8)
- adc w3, w0
- adc $0, w1
-L(al0): mov 8(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, (rp,n,8)
- adc w1, w2
- adc $0, w3
- mov 16(up,n,8), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- add w2, 8(rp,n,8)
- adc w3, w0
- adc $0, w1
- mov 24(up,n,8), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add $4, n
- js L(ta0)
-
- add w0, X(-16(rp,n,8),8(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(-8(rp,n,8),16(rp))
- adc $0, w3
- mov w3, X((rp,n,8),24(rp))
- jmp L(outer)
-
-
-L(end): mov X(8(up,un,8),(up)), v0
- mov X(16(up,un,8),8(up)), %rax
- mul v0
- mov %rax, w0
- mov %rdx, w1
- mov X(24(up,un,8),16(up)), %rax
- mul v0
- mov %rax, w2
- mov %rdx, w3
- add w0, X(24(rp,un,8),16(rp))
- adc w1, w2
- adc $0, w3
- add w2, X(32(rp,un,8),24(rp))
- adc $0, w3
- mov X(16(up,un,8),8(up)), v0
- mov X(24(up,un,8),16(up)), %rax
- mul v0
- add %rax, w3
- mov w3, X(40(rp,un,8),32(rp))
- adc $0, %rdx
- mov %rdx, X(48(rp,un,8),40(rp))
-
-
-C sqr_diag_addlsh1
-
- lea 16(up), up
- lea 40(rp), rp
- pop n
- lea 2(n,n), n
-
- mov (up,n,4), %rax
- mul %rax
- xor R32(w2), R32(w2)
-
- mov 8(rp,n,8), w0
- mov %rax, (rp,n,8)
- jmp L(lm)
-
- ALIGN(8)
-L(tsd): add %rbx, w0
- adc %rax, w1
- mov w0, -8(rp,n,8)
- mov 8(rp,n,8), w0
- mov w1, (rp,n,8)
-L(lm): mov 16(rp,n,8), w1
- adc w0, w0
- adc w1, w1
- lea (%rdx,w2), %rbx
- mov 8(up,n,4), %rax
- setc R8(w2)
- mul %rax
- add $2, n
- js L(tsd)
-
-L(esd): add %rbx, w0
- adc %rax, w1
- mov w0, X(-8(rp,n,8),-8(rp))
- mov w1, X((rp,n,8),(rp))
- adc w2, %rdx
- mov %rdx, X(8(rp,n,8),8(rp))
-
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/cnd_aors_n.asm b/gmp/mpn/x86_64/cnd_aors_n.asm
deleted file mode 100644
index 13a2ab3be9..0000000000
--- a/gmp/mpn/x86_64/cnd_aors_n.asm
+++ /dev/null
@@ -1,183 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/com.asm b/gmp/mpn/x86_64/com.asm
deleted file mode 100644
index 006acaf648..0000000000
--- a/gmp/mpn/x86_64/com.asm
+++ /dev/null
@@ -1,95 +0,0 @@
-dnl AMD64 mpn_com.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.25
-C AMD K10 1.25
-C Intel P4 2.78
-C Intel core2 1.1
-C Intel corei 1.5
-C Intel atom ?
-C VIA nano 2
-
-C INPUT PARAMETERS
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`n',`%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_com)
- FUNC_ENTRY(3)
- movq (up), %r8
- movl R32(%rdx), R32(%rax)
- leaq (up,n,8), up
- leaq (rp,n,8), rp
- negq n
- andl $3, R32(%rax)
- je L(b00)
- cmpl $2, R32(%rax)
- jc L(b01)
- je L(b10)
-
-L(b11): notq %r8
- movq %r8, (rp,n,8)
- decq n
- jmp L(e11)
-L(b10): addq $-2, n
- jmp L(e10)
- .byte 0x90,0x90,0x90,0x90,0x90,0x90
-L(b01): notq %r8
- movq %r8, (rp,n,8)
- incq n
- jz L(ret)
-
-L(oop): movq (up,n,8), %r8
-L(b00): movq 8(up,n,8), %r9
- notq %r8
- notq %r9
- movq %r8, (rp,n,8)
- movq %r9, 8(rp,n,8)
-L(e11): movq 16(up,n,8), %r8
-L(e10): movq 24(up,n,8), %r9
- notq %r8
- notq %r9
- movq %r8, 16(rp,n,8)
- movq %r9, 24(rp,n,8)
- addq $4, n
- jnc L(oop)
-L(ret): FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/com_n.asm b/gmp/mpn/x86_64/com_n.asm
new file mode 100644
index 0000000000..fba9384642
--- /dev/null
+++ b/gmp/mpn/x86_64/com_n.asm
@@ -0,0 +1,77 @@
+dnl AMD64 mpn_com_n.
+
+dnl Copyright 2004, 2005, 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 K8,K9: 1.25
+C K10: 1.25
+C P4: 2.78
+C P6-15: 1.1
+
+C INPUT PARAMETERS
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`n',`%rdx')
+
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_com_n)
+ movq (up), %r8
+ movl %edx, %eax
+ leaq (up,n,8), up
+ leaq (rp,n,8), rp
+ negq n
+ andl $3, %eax
+ je L(b00)
+ cmpl $2, %eax
+ jc L(b01)
+ je L(b10)
+
+L(b11): notq %r8
+ movq %r8, (rp,n,8)
+ decq n
+ jmp L(e11)
+L(b10): addq $-2, n
+ jmp L(e10)
+ .byte 0x90,0x90,0x90,0x90,0x90,0x90
+L(b01): notq %r8
+ movq %r8, (rp,n,8)
+ incq n
+ jz L(ret)
+
+L(oop): movq (up,n,8), %r8
+L(b00): movq 8(up,n,8), %r9
+ notq %r8
+ notq %r9
+ movq %r8, (rp,n,8)
+ movq %r9, 8(rp,n,8)
+L(e11): movq 16(up,n,8), %r8
+L(e10): movq 24(up,n,8), %r9
+ notq %r8
+ notq %r9
+ movq %r8, 16(rp,n,8)
+ movq %r9, 24(rp,n,8)
+ addq $4, n
+ jnc L(oop)
+L(ret): ret
+EPILOGUE()
diff --git a/gmp/mpn/x86_64/copyd.asm b/gmp/mpn/x86_64/copyd.asm
index a5e6e595e7..759b11d3ed 100644
--- a/gmp/mpn/x86_64/copyd.asm
+++ b/gmp/mpn/x86_64/copyd.asm
@@ -1,93 +1,74 @@
dnl AMD64 mpn_copyd -- copy limb vector, decrementing.
-dnl Copyright 2003, 2005, 2007, 2011, 2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1
-C AMD K10 1
-C AMD bd1 1.36
-C AMD bobcat 1.71
-C Intel P4 2-3
-C Intel core2 1
-C Intel NHM 1
-C Intel SBR 1
-C Intel atom 2
-C VIA nano 2
+C cycles/limb
+C K8,K9: 1
+C K10: 1
+C P4: 2.8
+C P6-15: 1.2
-IFSTD(`define(`rp',`%rdi')')
-IFSTD(`define(`up',`%rsi')')
-IFSTD(`define(`n', `%rdx')')
-IFDOS(`define(`rp',`%rcx')')
-IFDOS(`define(`up',`%rdx')')
-IFDOS(`define(`n', `%r8')')
+C INPUT PARAMETERS
+C rp rdi
+C up rsi
+C n rdx
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`n',`%rdx')
ASM_START()
TEXT
- ALIGN(64)
+ ALIGN(16)
PROLOGUE(mpn_copyd)
- lea -8(up,n,8), up
- lea (rp,n,8), rp
- sub $4, n
+ leaq -8(up,n,8), up
+ leaq (rp,n,8), rp
+ subq $4, n
jc L(end)
- nop
-
-L(top): mov (up), %rax
- mov -8(up), %r9
- lea -32(rp), rp
- mov -16(up), %r10
- mov -24(up), %r11
- lea -32(up), up
- mov %rax, 24(rp)
- mov %r9, 16(rp)
- sub $4, n
- mov %r10, 8(rp)
- mov %r11, (rp)
- jnc L(top)
+ ALIGN(16)
+L(oop): movq (up), %r8
+ movq -8(up), %r9
+ leaq -32(rp), rp
+ movq -16(up), %r10
+ movq -24(up), %r11
+ leaq -32(up), up
+ movq %r8, 24(rp)
+ movq %r9, 16(rp)
+ subq $4, n
+ movq %r10, 8(rp)
+ movq %r11, (rp)
+ jnc L(oop)
-L(end): shr R32(n)
+L(end): shrl %edx C edx = lowpart(n)
jnc 1f
- mov (up), %rax
- mov %rax, -8(rp)
- lea -8(rp), rp
- lea -8(up), up
-1: shr R32(n)
+ movq (up), %r8
+ movq %r8, -8(rp)
+ leaq -8(rp), rp
+ leaq -8(up), up
+1: shrl %edx C edx = lowpart(n)
jnc 1f
- mov (up), %rax
- mov -8(up), %r9
- mov %rax, -8(rp)
- mov %r9, -16(rp)
+ movq (up), %r8
+ movq -8(up), %r9
+ movq %r8, -8(rp)
+ movq %r9, -16(rp)
1: ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/copyi.asm b/gmp/mpn/x86_64/copyi.asm
index bafce7a09e..506142be79 100644
--- a/gmp/mpn/x86_64/copyi.asm
+++ b/gmp/mpn/x86_64/copyi.asm
@@ -1,92 +1,73 @@
dnl AMD64 mpn_copyi -- copy limb vector, incrementing.
-dnl Copyright 2003, 2005, 2007, 2011, 2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1
-C AMD K10 1
-C AMD bd1 1.36
-C AMD bobcat 1.71
-C Intel P4 2-3
-C Intel core2 1
-C Intel NHM 1
-C Intel SBR 1
-C Intel atom 2
-C VIA nano 2
+C cycles/limb
+C K8,K9: 1
+C K10: 1
+C P4: 2.8
+C P6-15: 1.2
-IFSTD(`define(`rp',`%rdi')')
-IFSTD(`define(`up',`%rsi')')
-IFSTD(`define(`n', `%rdx')')
-IFDOS(`define(`rp',`%rcx')')
-IFDOS(`define(`up',`%rdx')')
-IFDOS(`define(`n', `%r8')')
+C INPUT PARAMETERS
+C rp rdi
+C up rsi
+C n rdx
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`n',`%rdx')
ASM_START()
TEXT
- ALIGN(64)
- .byte 0,0,0,0,0,0
+ ALIGN(16)
PROLOGUE(mpn_copyi)
- lea -8(rp), rp
- sub $4, n
+ leaq -8(rp), rp
+ subq $4, n
jc L(end)
+ ALIGN(16)
+L(oop): movq (up), %r8
+ movq 8(up), %r9
+ leaq 32(rp), rp
+ movq 16(up), %r10
+ movq 24(up), %r11
+ leaq 32(up), up
+ movq %r8, -24(rp)
+ movq %r9, -16(rp)
+ subq $4, n
+ movq %r10, -8(rp)
+ movq %r11, (rp)
+ jnc L(oop)
-L(top): mov (up), %rax
- mov 8(up), %r9
- lea 32(rp), rp
- mov 16(up), %r10
- mov 24(up), %r11
- lea 32(up), up
- mov %rax, -24(rp)
- mov %r9, -16(rp)
- sub $4, n
- mov %r10, -8(rp)
- mov %r11, (rp)
- jnc L(top)
-
-L(end): shr R32(n)
+L(end): shrl %edx C edx = lowpart(n)
jnc 1f
- mov (up), %rax
- mov %rax, 8(rp)
- lea 8(rp), rp
- lea 8(up), up
-1: shr R32(n)
+ movq (up), %r8
+ movq %r8, 8(rp)
+ leaq 8(rp), rp
+ leaq 8(up), up
+1: shrl %edx C edx = lowpart(n)
jnc 1f
- mov (up), %rax
- mov 8(up), %r9
- mov %rax, 8(rp)
- mov %r9, 16(rp)
+ movq (up), %r8
+ movq 8(up), %r9
+ movq %r8, 8(rp)
+ movq %r9, 16(rp)
1: ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/aorrlsh1_n.asm b/gmp/mpn/x86_64/core2/aorrlsh1_n.asm
deleted file mode 100644
index 7066bb4372..0000000000
--- a/gmp/mpn/x86_64/core2/aorrlsh1_n.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl AMD64 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
-dnl AMD64 mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-define(LSH, 1)
-define(RSH, 63)
-
-ifdef(`OPERATION_addlsh1_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func, mpn_addlsh1_n)')
-ifdef(`OPERATION_rsblsh1_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func, mpn_rsblsh1_n)')
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_rsblsh1_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-include_mpn(`x86_64/aorrlshC_n.asm')
diff --git a/gmp/mpn/x86_64/core2/aorrlsh2_n.asm b/gmp/mpn/x86_64/core2/aorrlsh2_n.asm
deleted file mode 100644
index 5065120857..0000000000
--- a/gmp/mpn/x86_64/core2/aorrlsh2_n.asm
+++ /dev/null
@@ -1,53 +0,0 @@
-dnl AMD64 mpn_addlsh2_n -- rp[] = up[] + (vp[] << 2)
-dnl AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 2) - up[]
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-define(LSH, 2)
-define(RSH, 62)
-
-ifdef(`OPERATION_addlsh2_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func, mpn_addlsh2_n)')
-ifdef(`OPERATION_rsblsh2_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func, mpn_rsblsh2_n)')
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_rsblsh2_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-include_mpn(`x86_64/aorrlshC_n.asm')
diff --git a/gmp/mpn/x86_64/core2/aorrlsh_n.asm b/gmp/mpn/x86_64/core2/aorrlsh_n.asm
deleted file mode 100644
index 57abf31579..0000000000
--- a/gmp/mpn/x86_64/core2/aorrlsh_n.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_addlsh_n mpn_addlsh_nc mpn_rsblsh_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-include_mpn(`x86_64/coreinhm/aorrlsh_n.asm')
diff --git a/gmp/mpn/x86_64/core2/aors_err1_n.asm b/gmp/mpn/x86_64/core2/aors_err1_n.asm
deleted file mode 100644
index 3f875aefa4..0000000000
--- a/gmp/mpn/x86_64/core2/aors_err1_n.asm
+++ /dev/null
@@ -1,225 +0,0 @@
-dnl Core 2 mpn_add_err1_n, mpn_sub_err1_n
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 ?
-C Intel core2 4.14
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
-
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`ep', `%rcx')
-define(`yp', `%r8')
-define(`n', `%r9')
-define(`cy_param', `8(%rsp)')
-
-define(`el', `%rbx')
-define(`eh', `%rbp')
-define(`t0', `%r10')
-define(`t1', `%r11')
-define(`t2', `%r12')
-define(`t3', `%r13')
-define(`w0', `%r14')
-define(`w1', `%r15')
-
-ifdef(`OPERATION_add_err1_n', `
- define(ADCSBB, adc)
- define(func, mpn_add_err1_n)')
-ifdef(`OPERATION_sub_err1_n', `
- define(ADCSBB, sbb)
- define(func, mpn_sub_err1_n)')
-
-MULFUNC_PROLOGUE(mpn_add_err1_n mpn_sub_err1_n)
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
- mov cy_param, %rax
-
- push %rbx
- push %rbp
- push %r12
- push %r13
- push %r14
- push %r15
-
- lea (up,n,8), up
- lea (vp,n,8), vp
- lea (rp,n,8), rp
-
- mov R32(n), R32(%r10)
- and $3, R32(%r10)
- jz L(0mod4)
- cmp $2, R32(%r10)
- jc L(1mod4)
- jz L(2mod4)
-L(3mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- xor R32(t0), R32(t0)
- xor R32(t1), R32(t1)
- 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
- mov w0, (rp,n,8)
- cmovc 16(yp), el
- 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 w0, 16(rp,n,8)
- cmovc (yp), t1
- setc %al C save carry
- add t0, el
- adc $0, eh
- add t1, el
- adc $0, eh
-
- add $3, n
- jnz L(loop)
- jmp L(end)
-
- ALIGN(16)
-L(0mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- lea (yp,n,8), yp
- neg n
- jmp L(loop)
-
- ALIGN(16)
-L(1mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- 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)
- cmovc (yp), el
- setc %al C save carry
-
- add $1, n
- jnz L(loop)
- jmp L(end)
-
- ALIGN(16)
-L(2mod4):
- xor R32(el), R32(el)
- xor R32(eh), R32(eh)
- xor R32(t0), R32(t0)
- 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)
- cmovc 8(yp), el
- ADCSBB 8(vp,n,8), w1
- mov w1, 8(rp,n,8)
- cmovc (yp), t0
- setc %al C save carry
- add t0, el
- adc $0, eh
-
- add $2, n
- jnz L(loop)
- jmp L(end)
-
- ALIGN(32)
-L(loop):
- 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)
-
-L(end):
- mov el, (ep)
- mov eh, 8(ep)
-
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/aors_n.asm b/gmp/mpn/x86_64/core2/aors_n.asm
index 74a1bce48a..d26af866f9 100644
--- a/gmp/mpn/x86_64/core2/aors_n.asm
+++ b/gmp/mpn/x86_64/core2/aors_n.asm
@@ -1,45 +1,30 @@
-dnl Intel mpn_add_n/mpn_sub_n optimised for Conroe, Nehalem.
+dnl Intel P6-15 mpn_add_n/mpn_sub_n -- mpn add or subtract.
-dnl Copyright 2006, 2007, 2011-2013 Free Software Foundation, Inc.
+dnl Copyright 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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
-C AMD K10 2
-C Intel P4 10
-C Intel core2 2
-C Intel NHM 2
-C Intel SBR 2
-C Intel atom 9
-C VIA nano 3
+C K8,K9: 2.25
+C K10: 2
+C P4: 10
+C P6-15: 2.05
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -59,83 +44,80 @@ ifdef(`OPERATION_sub_n', `
MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
+
TEXT
ALIGN(16)
+
+PROLOGUE(func_nc)
+ jmp L(start)
+EPILOGUE()
+
PROLOGUE(func)
- FUNC_ENTRY(4)
xor %r8, %r8
L(start):
mov (up), %r10
mov (vp), %r11
- lea (up,n,8), up
- lea (vp,n,8), vp
- lea (rp,n,8), rp
- mov R32(n), R32(%rax)
+ lea -8(up,n,8), up
+ lea -8(vp,n,8), vp
+ lea -16(rp,n,8), rp
+ mov %ecx, %eax
neg n
- and $3, R32(%rax)
+ and $3, %eax
je L(b00)
- add %rax, n C clear low rcx bits for jrcxz
- cmp $2, R32(%rax)
+ add %rax, n C clear low rcx bits for jrcxz
+ cmp $2, %eax
jl L(b01)
je L(b10)
-L(b11): neg %r8 C set cy
+L(b11): shr %r8 C set cy
jmp L(e11)
-L(b00): neg %r8 C set cy
+L(b00): shr %r8 C set cy
mov %r10, %r8
mov %r11, %r9
lea 4(n), n
jmp L(e00)
- nop
- nop
- nop
-L(b01): neg %r8 C set cy
- jmp L(top)
+L(b01): shr %r8 C set cy
+ jmp L(e01)
-L(b10): neg %r8 C set cy
+L(b10): shr %r8 C set cy
mov %r10, %r8
mov %r11, %r9
jmp L(e10)
L(end): ADCSBB %r11, %r10
- mov %r10, -8(rp)
- mov R32(%rcx), R32(%rax) C clear eax, ecx contains 0
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
+ mov %r10, 8(rp)
+ mov %ecx, %eax C clear eax, ecx contains 0
+ adc %eax, %eax
ret
ALIGN(16)
-L(top): jrcxz L(end)
- mov (up,n,8), %r8
- mov (vp,n,8), %r9
- lea 4(n), n
- ADCSBB %r11, %r10
- 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, -32(rp,n,8)
-L(e11): mov -16(up,n,8), %r8
- mov -16(vp,n,8), %r9
+L(top):
+ mov -24(up,n,8), %r8
+ mov -24(vp,n,8), %r9
ADCSBB %r11, %r10
mov %r10, -24(rp,n,8)
-L(e10): mov -8(up,n,8), %r10
- mov -8(vp,n,8), %r11
+L(e00):
+ mov -16(up,n,8), %r10
+ mov -16(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
+ ADCSBB %r11, %r10
+ mov %r10, -8(rp,n,8)
+L(e10):
+ mov (up,n,8), %r10
+ mov (vp,n,8), %r11
+ ADCSBB %r9, %r8
+ mov %r8, (rp,n,8)
+L(e01):
+ jrcxz L(end)
+ lea 4(n), n
jmp L(top)
-EPILOGUE()
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- jmp L(start)
EPILOGUE()
-
diff --git a/gmp/mpn/x86_64/core2/sublshC_n.asm b/gmp/mpn/x86_64/core2/aorslsh1_n.asm
index 5acc46b032..18db7c96f8 100644
--- a/gmp/mpn/x86_64/core2/sublshC_n.asm
+++ b/gmp/mpn/x86_64/core2/aorslsh1_n.asm
@@ -1,45 +1,29 @@
-dnl AMD64 mpn_sublshC_n -- rp[] = up[] - (vp[] << 1), optimised for Core 2 and
-dnl Core iN.
+dnl x86-64 mpn_addlsh1_n and mpn_sublsh1_n, optimized for "Core" 2.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 4.25
-C AMD K10 ?
-C Intel P4 ?
-C Intel core2 3
-C Intel NHM 3.1
-C Intel SBR 2.47
-C Intel atom ?
-C VIA nano ?
+C K8,K9: 4.25
+C K10: ?
+C P4: ?
+C P6-15: 3
C INPUT PARAMETERS
define(`rp',`%rdi')
@@ -47,11 +31,21 @@ define(`up',`%rsi')
define(`vp',`%rdx')
define(`n', `%rcx')
+ifdef(`OPERATION_addlsh1_n', `
+ define(ADDSUB, add)
+ define(ADCSBB, adc)
+ define(func, mpn_addlsh1_n)')
+ifdef(`OPERATION_sublsh1_n', `
+ define(ADDSUB, sub)
+ define(ADCSBB, sbb)
+ define(func, mpn_sublsh1_n)')
+
+MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
+
ASM_START()
TEXT
ALIGN(8)
PROLOGUE(func)
- FUNC_ENTRY(4)
push %rbx
push %r12
@@ -64,7 +58,7 @@ PROLOGUE(func)
xor R32(%r11), R32(%r11)
mov -24(vp,n,8), %r8 C do first limb early
- shrd $RSH, %r8, %r11
+ shrd $63, %r8, %r11
and $3, R32(%rax)
je L(b0)
@@ -73,9 +67,9 @@ PROLOGUE(func)
je L(b2)
L(b3): mov -16(vp,n,8), %r9
- shrd $RSH, %r9, %r8
+ shrd $63, %r9, %r8
mov -8(vp,n,8), %r10
- shrd $RSH, %r10, %r9
+ shrd $63, %r10, %r9
mov -24(up,n,8), %r12
ADDSUB %r11, %r12
mov %r12, -24(rp,n,8)
@@ -101,7 +95,7 @@ L(b1): mov -24(up,n,8), %r12
jmp L(end)
L(b2): mov -16(vp,n,8), %r9
- shrd $RSH, %r9, %r8
+ shrd $63, %r9, %r8
mov -24(up,n,8), %r12
ADDSUB %r11, %r12
mov %r12, -24(rp,n,8)
@@ -116,13 +110,13 @@ L(b2): mov -16(vp,n,8), %r9
ALIGN(16)
L(top): mov -24(vp,n,8), %r8
- shrd $RSH, %r8, %r11
+ shrd $63, %r8, %r11
L(b0): mov -16(vp,n,8), %r9
- shrd $RSH, %r9, %r8
+ shrd $63, %r9, %r8
mov -8(vp,n,8), %r10
- shrd $RSH, %r10, %r9
+ shrd $63, %r10, %r9
mov (vp,n,8), %rbx
- shrd $RSH, %rbx, %r10
+ shrd $63, %rbx, %r10
add R32(%rax), R32(%rax) C restore cy
@@ -148,11 +142,10 @@ L(b0): mov -16(vp,n,8), %r9
add $4, n
js L(top)
-L(end): shr $RSH, %r11
+L(end): add %r11, %r11
pop %r12
pop %rbx
- sub R32(%r11), R32(%rax)
+ sbb $0, R32(%rax)
neg R32(%rax)
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/aorsmul_1.asm b/gmp/mpn/x86_64/core2/aorsmul_1.asm
index 6b313dd836..1d05b30b59 100644
--- a/gmp/mpn/x86_64/core2/aorsmul_1.asm
+++ b/gmp/mpn/x86_64/core2/aorsmul_1.asm
@@ -1,46 +1,29 @@
dnl x86-64 mpn_addmul_1 and mpn_submul_1, optimized for "Core 2".
-dnl Copyright 2003-2005, 2007-2009, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2004, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 4
-C AMD K10 4
-C AMD bd1 5.1
-C AMD bobcat
-C Intel P4 ?
-C Intel core2 4.3-4.5 (fluctuating)
-C Intel NHM 5.0
-C Intel SBR 4.1
-C Intel atom ?
-C VIA nano 5.25
+C K8,K9: 4
+C K10: 4
+C P4: ?
+C P6-15: 4.3-4.7 (fluctuating)
C INPUT PARAMETERS
define(`rp', `%rdi')
@@ -50,129 +33,111 @@ define(`v0', `%rcx')
ifdef(`OPERATION_addmul_1',`
define(`ADDSUB', `add')
- define(`func', `mpn_addmul_1')
- define(`func_1c', `mpn_addmul_1c')
+ define(`func', `mpn_addmul_1')
')
ifdef(`OPERATION_submul_1',`
define(`ADDSUB', `sub')
- define(`func', `mpn_submul_1')
- define(`func_1c', `mpn_submul_1c')
+ define(`func', `mpn_submul_1')
')
-MULFUNC_PROLOGUE(mpn_addmul_1 mpn_addmul_1c mpn_submul_1 mpn_submul_1c)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
- C For DOS, on the stack we have four saved registers, return address,
- C space for four register arguments, and finally the carry input.
-
-IFDOS(` define(`carry_in', `72(%rsp)')') dnl
-IFSTD(` define(`carry_in', `%r8')') dnl
+MULFUNC_PROLOGUE(mpn_addmul_1 mpn_submul_1)
ASM_START()
TEXT
ALIGN(16)
-PROLOGUE(func_1c)
- FUNC_ENTRY(4)
- push %rbx
- push %rbp
- lea (%rdx), %rbx
- neg %rbx
-
- mov (up), %rax
- mov (rp), %r10
-
- lea -16(rp,%rdx,8), rp
- lea (up,%rdx,8), up
- mul %rcx
- add carry_in, %rax
- adc $0, %rdx
- jmp L(start_nc)
-EPILOGUE()
-
- ALIGN(16)
PROLOGUE(func)
- FUNC_ENTRY(4)
- push %rbx
- push %rbp
- lea (%rdx), %rbx
- neg %rbx
+ push %r15
+ push %r12
+ push %r13
+ lea (%rdx), %r15
+ neg %r15
mov (up), %rax
- mov (rp), %r10
- lea -16(rp,%rdx,8), rp
+ bt $0, %r15
+ jc L(odd)
+
+ lea (rp,%rdx,8), rp
lea (up,%rdx,8), up
mul %rcx
-L(start_nc):
- bt $0, R32(%rbx)
- jc L(odd)
-
lea (%rax), %r11
- mov 8(up,%rbx,8), %rax
- lea (%rdx), %rbp
- mul %rcx
- add $2, %rbx
+ mov 8(up,%r15,8), %rax
+ mov (rp,%r15,8), %r13
+ lea (%rdx), %r12
+
+ add $2, %r15
jns L(n2)
+ mul %rcx
lea (%rax), %r8
- mov (up,%rbx,8), %rax
+ mov (up,%r15,8), %rax
+ mov -8(rp,%r15,8), %r10
lea (%rdx), %r9
- jmp L(mid)
+ jmp L(m)
-L(odd): add $1, %rbx
+L(odd): lea (rp,%rdx,8), rp
+ lea (up,%rdx,8), up
+ mul %rcx
+ add $1, %r15
jns L(n1)
- lea (%rax), %r8
- mov (up,%rbx,8), %rax
+L(gt1): lea (%rax), %r8
+ mov (up,%r15,8), %rax
+ mov -8(rp,%r15,8), %r10
lea (%rdx), %r9
mul %rcx
lea (%rax), %r11
- mov 8(up,%rbx,8), %rax
- lea (%rdx), %rbp
- jmp L(e)
+ mov 8(up,%r15,8), %rax
+ mov (rp,%r15,8), %r13
+ lea (%rdx), %r12
+ add $2, %r15
+ jns L(end)
ALIGN(16)
L(top): mul %rcx
ADDSUB %r8, %r10
lea (%rax), %r8
- mov (up,%rbx,8), %rax
+ mov 0(up,%r15,8), %rax
adc %r9, %r11
- mov %r10, -8(rp,%rbx,8)
- mov (rp,%rbx,8), %r10
+ mov %r10, -24(rp,%r15,8)
+ mov -8(rp,%r15,8), %r10
lea (%rdx), %r9
- adc $0, %rbp
-L(mid): mul %rcx
- ADDSUB %r11, %r10
+ adc $0, %r12
+L(m): mul %rcx
+ ADDSUB %r11, %r13
lea (%rax), %r11
- mov 8(up,%rbx,8), %rax
- adc %rbp, %r8
- mov %r10, (rp,%rbx,8)
- mov 8(rp,%rbx,8), %r10
- lea (%rdx), %rbp
+ mov 8(up,%r15,8), %rax
+ adc %r12, %r8
+ mov %r13, -16(rp,%r15,8)
+ mov 0(rp,%r15,8), %r13
+ lea (%rdx), %r12
adc $0, %r9
-L(e): add $2, %rbx
+
+ add $2, %r15
js L(top)
- mul %rcx
+L(end): mul %rcx
ADDSUB %r8, %r10
adc %r9, %r11
- mov %r10, -8(rp)
- adc $0, %rbp
-L(n2): mov (rp), %r10
- ADDSUB %r11, %r10
- adc %rbp, %rax
- mov %r10, (rp)
+ mov %r10, -24(rp,%r15,8)
+ mov -8(rp,%r15,8), %r10
+ adc $0, %r12
+L(r): ADDSUB %r11, %r13
+ adc %r12, %rax
+ mov %r13, -16(rp,%r15,8)
adc $0, %rdx
-L(n1): mov 8(rp), %r10
- ADDSUB %rax, %r10
- mov %r10, 8(rp)
- mov R32(%rbx), R32(%rax) C zero rax
+L(x): ADDSUB %rax, %r10
+ mov %r10, -8(rp,%r15,8)
+ mov $0, %eax
adc %rdx, %rax
- pop %rbp
- pop %rbx
- FUNC_EXIT()
+L(ret): pop %r13
+ pop %r12
+ pop %r15
ret
+L(n2): mul %rcx
+ mov -8(rp,%r15,8), %r10
+ jmp L(r)
+L(n1): mov -8(rp,%r15,8), %r10
+ jmp L(x)
EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/copyd.asm b/gmp/mpn/x86_64/core2/copyd.asm
deleted file mode 100644
index f0dc54a55e..0000000000
--- a/gmp/mpn/x86_64/core2/copyd.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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/gmp/mpn/x86_64/core2/copyi.asm b/gmp/mpn/x86_64/core2/copyi.asm
deleted file mode 100644
index 9c26e00c52..0000000000
--- a/gmp/mpn/x86_64/core2/copyi.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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')
diff --git a/gmp/mpn/x86_64/core2/divrem_1.asm b/gmp/mpn/x86_64/core2/divrem_1.asm
deleted file mode 100644
index 623bea386c..0000000000
--- a/gmp/mpn/x86_64/core2/divrem_1.asm
+++ /dev/null
@@ -1,237 +0,0 @@
-dnl x86-64 mpn_divrem_1 -- mpn by limb division.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 AMD K8,K9 15 15 12
-C AMD K10 15 15 12
-C Intel P4 44 44 43
-C Intel core2 24 24 19.5
-C Intel corei 19 19 18
-C Intel atom 51 51 36
-C VIA nano 46 44 22.5
-
-C mp_limb_t
-C mpn_divrem_1 (mp_ptr qp, mp_size_t fn,
-C mp_srcptr np, mp_size_t nn, mp_limb_t d)
-
-C mp_limb_t
-C mpn_preinv_divrem_1 (mp_ptr qp, mp_size_t fn,
-C mp_srcptr np, mp_size_t nn, mp_limb_t d,
-C mp_limb_t dinv, int cnt)
-
-C INPUT PARAMETERS
-define(`qp', `%rdi')
-define(`fn_param', `%rsi')
-define(`up_param', `%rdx')
-define(`un_param', `%rcx')
-define(`d', `%r8')
-define(`dinv', `%r9') C only for mpn_preinv_divrem_1
-C shift passed on stack C only for mpn_preinv_divrem_1
-
-define(`cnt', `%rcx')
-define(`up', `%rsi')
-define(`fn', `%r12')
-define(`un', `%rbx')
-
-
-C rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15
-C cnt qp d dinv
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFSTD(`define(`CNTOFF', `40($1)')')
-IFDOS(`define(`CNTOFF', `104($1)')')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_preinv_divrem_1)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
-IFDOS(` mov 64(%rsp), %r9 ')
- xor R32(%rax), R32(%rax)
- push %r13
- push %r12
- push %rbp
- push %rbx
-
- mov fn_param, fn
- mov un_param, un
- add fn_param, un_param
- mov up_param, up
-
- lea -8(qp,un_param,8), qp
-
- mov CNTOFF(%rsp), R8(cnt)
- shl R8(cnt), d
- jmp L(ent)
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(mpn_divrem_1)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- xor R32(%rax), R32(%rax)
- push %r13
- push %r12
- push %rbp
- push %rbx
-
- mov fn_param, fn
- mov un_param, un
- add fn_param, un_param
- mov up_param, up
- je L(ret)
-
- lea -8(qp,un_param,8), qp
- xor R32(%rbp), R32(%rbp)
-
-L(unnormalized):
- test un, un
- je L(44)
- mov -8(up,un,8), %rax
- cmp d, %rax
- jae L(44)
- mov %rbp, (qp)
- mov %rax, %rbp
- lea -8(qp), qp
- je L(ret)
- dec un
-L(44):
- bsr d, %rcx
- not R32(%rcx)
- sal R8(%rcx), d
- sal R8(%rcx), %rbp
-
- push %rcx
-IFSTD(` push %rdi ')
-IFSTD(` push %rsi ')
- push %r8
-IFSTD(` mov d, %rdi ')
-IFDOS(` mov d, %rcx ')
- CALL( mpn_invert_limb)
- pop %r8
-IFSTD(` pop %rsi ')
-IFSTD(` pop %rdi ')
- pop %rcx
-
- mov %rax, dinv
- mov %rbp, %rax
- test un, un
- je L(frac)
-L(ent): mov -8(up,un,8), %rbp
- shr R8(%rcx), %rax
- shld R8(%rcx), %rbp, %rax
- sub $2, un
- js L(end)
-
- ALIGN(16)
-L(top): lea 1(%rax), %r11
- mul dinv
- mov (up,un,8), %r10
- shld R8(%rcx), %r10, %rbp
- mov %rbp, %r13
- add %rax, %r13
- adc %r11, %rdx
- mov %rdx, %r11
- imul d, %rdx
- sub %rdx, %rbp
- lea (d,%rbp), %rax
- sub $8, qp
- cmp %r13, %rbp
- cmovc %rbp, %rax
- adc $-1, %r11
- cmp d, %rax
- jae L(ufx)
-L(uok): dec un
- mov %r11, 8(qp)
- mov %r10, %rbp
- jns L(top)
-
-L(end): lea 1(%rax), %r11
- sal R8(%rcx), %rbp
- mul dinv
- add %rbp, %rax
- adc %r11, %rdx
- mov %rax, %r11
- mov %rdx, %r13
- imul d, %rdx
- sub %rdx, %rbp
- mov d, %rax
- add %rbp, %rax
- cmp %r11, %rbp
- cmovc %rbp, %rax
- adc $-1, %r13
- cmp d, %rax
- jae L(efx)
-L(eok): mov %r13, (qp)
- sub $8, qp
- jmp L(frac)
-
-L(ufx): sub d, %rax
- inc %r11
- jmp L(uok)
-L(efx): sub d, %rax
- inc %r13
- jmp L(eok)
-
-L(frac):mov d, %rbp
- neg %rbp
- jmp L(fent)
-
- ALIGN(16) C K8-K10 P6-CNR P6-NHM P4
-L(ftop):mul dinv C 0,12 0,17 0,17
- add %r11, %rdx C 5 8 10
- mov %rax, %r11 C 4 8 3
- mov %rdx, %r13 C 6 9 11
- imul %rbp, %rdx C 6 9 11
- mov d, %rax C
- add %rdx, %rax C 10 14 14
- cmp %r11, %rdx C 10 14 14
- cmovc %rdx, %rax C 11 15 15
- adc $-1, %r13 C
- mov %r13, (qp) C
- sub $8, qp C
-L(fent):lea 1(%rax), %r11 C
- dec fn C
- jns L(ftop) C
-
- shr R8(%rcx), %rax
-L(ret): pop %rbx
- pop %rbp
- pop %r12
- pop %r13
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/gcd_1.asm b/gmp/mpn/x86_64/core2/gcd_1.asm
deleted file mode 100644
index e0cab9b4e4..0000000000
--- a/gmp/mpn/x86_64/core2/gcd_1.asm
+++ /dev/null
@@ -1,144 +0,0 @@
-dnl AMD64 mpn_gcd_1 optimised for Intel C2, NHM, SBR and AMD K10, BD.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-
-C cycles/bit (approx)
-C AMD K8,K9 8.50
-C AMD K10 4.30
-C AMD bd1 5.00
-C AMD bobcat 10.0
-C Intel P4 18.6
-C Intel core2 3.83
-C Intel NHM 5.17
-C Intel SBR 4.69
-C Intel atom 17.0
-C VIA nano 5.44
-C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
-
-C TODO
-C * Optimise inner-loop for specific CPUs.
-C * Use DIV for 1-by-1 reductions, at least for some CPUs.
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 6)
-
-C INPUT PARAMETERS
-define(`up', `%rdi')
-define(`n', `%rsi')
-define(`v0', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFDOS(`define(`STACK_ALLOC', 40)')
-IFSTD(`define(`STACK_ALLOC', 8)')
-
-C Undo some configure cleverness.
-C The problem is that C only defines the '1c' variant, and that configure
-C therefore considers modexact_1c to be the base function. It then adds a
-C special fat rule for mpn_modexact_1_odd, messing up things when a cpudep
-C gcd_1 exists without a corresponding cpudep mode1o.
-ifdef(`WANT_FAT_BINARY', `
- define(`mpn_modexact_1_odd', `MPN_PREFIX`modexact_1_odd_x86_64'')')
-
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- FUNC_ENTRY(3)
- mov (up), %rax C U low limb
- or v0, %rax
- bsf %rax, %rax C min(ctz(u0),ctz(v0))
-
- bsf v0, %rcx
- shr R8(%rcx), v0
-
- push %rax C preserve common twos over call
- push v0 C preserve v0 argument over call
- sub $STACK_ALLOC, %rsp C maintain ABI required rsp alignment
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %r8
- mov %r8, %rax
- shr $BMOD_THRES_LOG2, %r8
- cmp %r8, v0
- ja L(reduced)
- jmp L(bmod)
-
-L(reduce_nby1):
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- CALL( mpn_mod_1)
- jmp L(reduced)
-L(bmod):
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- CALL( mpn_modexact_1_odd)
-L(reduced):
-
- add $STACK_ALLOC, %rsp
- pop %rdx
-
- bsf %rax, %rcx
-C test %rax, %rax C FIXME: does this lower latency?
- jnz L(mid)
- jmp L(end)
-
- ALIGN(16) C K10 BD C2 NHM SBR
-L(top): cmovc %r10, %rax C if x-y < 0 0,3 0,3 0,6 0,5 0,5
- cmovc %r9, %rdx C use x,y-x 0,3 0,3 2,8 1,7 1,7
-L(mid): shr R8(%rcx), %rax C 1,7 1,6 2,8 2,8 2,8
- mov %rdx, %r10 C 1 1 4 3 3
- sub %rax, %r10 C 2 2 5 4 4
- bsf %r10, %rcx C 3 3 6 5 5
- mov %rax, %r9 C 2 2 3 3 4
- sub %rdx, %rax C 2 2 4 3 4
- jnz L(top) C
-
-L(end): pop %rcx
- mov %rdx, %rax
- shl R8(%rcx), %rax
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/gmp-mparam.h b/gmp/mpn/x86_64/core2/gmp-mparam.h
index 0f4f88f780..8207da4895 100644
--- a/gmp/mpn/x86_64/core2/gmp-mparam.h
+++ b/gmp/mpn/x86_64/core2/gmp-mparam.h
@@ -1,217 +1,78 @@
-/* Core 2 gmp-mparam.h -- Compiler/machine parameter header file.
+/* "Core 2" gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2012, 2014 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+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 either:
+it under the terms of the GNU 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 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.
-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.
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
-or both in parallel, as here.
+/* 2133 MHz "Core 2" / 65nm / 4096 Kibyte cache / socket 775 */
-The GNU MP Library is distributed in the hope that 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
-
-/* 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 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 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 24
-
-#define MUL_TOOM22_THRESHOLD 23
-#define MUL_TOOM33_THRESHOLD 65
-#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 114
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 73
-#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 102
-#define SQR_TOOM4_THRESHOLD 160
-#define SQR_TOOM6_THRESHOLD 222
-#define SQR_TOOM8_THRESHOLD 296
-
-#define MULMID_TOOM42_THRESHOLD 28
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 13
-
-#define MUL_FFT_MODF_THRESHOLD 372 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, { 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 340 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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}, \
- { 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}, \
- { 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}, \
- { 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 62
-#define MULLO_MUL_N_THRESHOLD 9174
-
-#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 48
-#define INV_NEWTON_THRESHOLD 156
-#define INV_APPR_THRESHOLD 155
-
-#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 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 1,64,131,269,466
-
-#define MATRIX22_STRASSEN_THRESHOLD 19
-#define HGCD_THRESHOLD 117
-#define HGCD_APPR_THRESHOLD 151
-#define HGCD_REDUCE_THRESHOLD 2121
-#define GCD_DC_THRESHOLD 427
-#define GCDEXT_DC_THRESHOLD 342
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 11
-#define GET_STR_PRECOMPUTE_THRESHOLD 18
-#define SET_STR_DC_THRESHOLD 552
-#define SET_STR_PRECOMPUTE_THRESHOLD 1561
-
-#define FAC_DSC_THRESHOLD 656
-#define FAC_ODD_THRESHOLD 23
+/* Generated by tuneup.c, 2009-01-14, gcc 4.2 */
+
+#define MUL_KARATSUBA_THRESHOLD 18
+#define MUL_TOOM3_THRESHOLD 65
+#define MUL_TOOM44_THRESHOLD 166
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 32
+#define SQR_TOOM3_THRESHOLD 97
+#define SQR_TOOM4_THRESHOLD 163
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 20
+#define MULLOW_MUL_N_THRESHOLD 232
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 60
+#define POWM_THRESHOLD 77
+
+#define MATRIX22_STRASSEN_THRESHOLD 25
+#define HGCD_THRESHOLD 140
+#define GCD_DC_THRESHOLD 691
+#define GCDEXT_DC_THRESHOLD 760
+#define JACOBI_BASE_METHOD 1
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 3
+#define MOD_1_2_THRESHOLD 5
+#define MOD_1_4_THRESHOLD 20
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 10
+#define GET_STR_PRECOMPUTE_THRESHOLD 16
+#define SET_STR_DC_THRESHOLD 668
+#define SET_STR_PRECOMPUTE_THRESHOLD 2052
+
+#define MUL_FFT_TABLE { 336, 672, 1600, 2816, 7168, 20480, 81920, 327680, 786432, 0 }
+#define MUL_FFT_MODF_THRESHOLD 352
+#define MUL_FFT_THRESHOLD 3456
+
+#define SQR_FFT_TABLE { 336, 736, 1728, 3328, 7168, 20480, 81920, 327680, 0 }
+#define SQR_FFT_MODF_THRESHOLD 352
+#define SQR_FFT_THRESHOLD 2432
+
+/* Generated 2009-01-12, gcc 4.2 */
+
+#define MUL_FFT_TABLE2 {{1,4}, {273,5}, {545,6}, {1217,7}, {3201,8}, {6913,9}, {7681,8}, {8449,9}, {9729,8}, {10497,9}, {13825,10}, {15361,9}, {19969,10}, {23553,9}, {28161,11}, {30721,10}, {31745,9}, {34305,10}, {39937,9}, {42497,10}, {56321,11}, {63489,10}, {81409,11}, {92161,10}, {93185,11}, {96257,12}, {126977,11}, {131073,10}, {138241,11}, {167937,10}, {169473,11}, {169985,10}, {172033,11}, {195585,9}, {196097,11}, {198657,10}, {208897,11}, {217089,12}, {258049,11}, {261121,9}, {262657,10}, {275457,11}, {302081,10}, {307201,11}, {331777,12}, {389121,11}, {425985,13}, {516097,12}, {520193,11}, {598017,12}, {610305,11}, {614401,12}, {651265,11}, {653313,10}, {654337,11}, {673793,10}, {674817,11}, {677889,10}, {679937,11}, {718849,10}, {719873,12}, {782337,11}, {850945,12}, {913409,11}, {925697,13}, {1040385,12}, {1044481,11}, {1112065,12}, {1175553,11}, {1244161,12}, {1306625,11}, {1310721,12}, {1327105,11}, {1347585,12}, {1355777,11}, {1366017,12}, {1439745,13}, {1564673,12}, {1835009,14}, {1900545,12}, {1904641,14}, {2080769,13}, {2088961,12}, {2488321,13}, {2613249,12}, {2879489,13}, {2932737,12}, {2940929,13}, {3137537,12}, {3403777,13}, {3661825,12}, {3928065,14}, {4177921,13}, {4186113,12}, {4452353,13}, {4710401,12}, {4978689,13}, {5234689,12}, {5500929,13}, {5758977,14}, {6275073,13}, {7856129,15}, {8355841,14}, {8372225,13}, {9957377,14}, {MP_SIZE_T_MAX, 0}}
+
+#define SQR_FFT_TABLE2 {{1,4}, {241,5}, {545,6}, {1345,7}, {3201,8}, {6913,9}, {7681,8}, {8961,9}, {9729,8}, {10497,9}, {13825,10}, {15361,9}, {19969,10}, {23553,9}, {28161,11}, {30721,10}, {31745,9}, {34305,10}, {55297,11}, {63489,10}, {80897,11}, {94209,10}, {97281,12}, {126977,11}, {129025,9}, {130049,10}, {138753,11}, {162817,9}, {164353,11}, {170497,10}, {178177,11}, {183297,10}, {184321,11}, {194561,10}, {208897,12}, {219137,11}, {221185,12}, {258049,11}, {261121,9}, {261633,10}, {267777,9}, {268289,11}, {270337,10}, {274945,9}, {276481,10}, {278529,11}, {292865,9}, {293377,10}, {295937,9}, {296449,10}, {306177,9}, {309249,10}, {310273,11}, {328705,12}, {331777,11}, {335873,12}, {344065,11}, {346113,12}, {352257,11}, {356353,12}, {389121,11}, {395265,10}, {398337,11}, {419841,10}, {421889,11}, {423937,13}, {516097,12}, {520193,11}, {546817,10}, {550913,11}, {561153,10}, {563201,11}, {579585,10}, {585729,11}, {621569,12}, {636929,11}, {638977,12}, {651265,11}, {714753,10}, {716801,11}, {718849,12}, {782337,11}, {849921,12}, {913409,11}, {954369,13}, {1040385,12}, {1044481,11}, {1112065,12}, {1175553,11}, {1243137,12}, {1306625,11}, {1374209,12}, {1437697,13}, {1564673,12}, {1961985,14}, {2080769,13}, {2088961,12}, {2486273,13}, {2613249,12}, {2879489,13}, {3137537,12}, {3272705,13}, {3661825,12}, {3928065,14}, {4177921,13}, {4186113,12}, {4452353,13}, {4710401,12}, {4976641,13}, {5234689,12}, {5320705,13}, {5324801,12}, {5447681,13}, {5455873,12}, {5500929,13}, {5758977,14}, {6275073,13}, {6283265,12}, {6549505,13}, {7856129,15}, {8355841,14}, {8372225,13}, {9953281,14}, {MP_SIZE_T_MAX, 0}}
diff --git a/gmp/mpn/x86_64/core2/lshift.asm b/gmp/mpn/x86_64/core2/lshift.asm
index 8ccafeca6c..60518901eb 100644
--- a/gmp/mpn/x86_64/core2/lshift.asm
+++ b/gmp/mpn/x86_64/core2/lshift.asm
@@ -1,83 +1,64 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 2007 Free Software Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 4.25
-C AMD K10 4.25
-C Intel P4 14.7
-C Intel core2 1.27
-C Intel NHM 1.375 (up to about n = 260, then 1.5)
-C Intel SBR 1.87
-C Intel atom ?
-C VIA nano ?
+C K8,K9: 4.25
+C K10: 4.25
+C P4: 14.7
+C P6-15: 1.27
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+define(`cnt', `%cl')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_lshift)
- FUNC_ENTRY(4)
lea -8(rp,n,8), rp
lea -8(up,n,8), up
- mov R32(%rdx), R32(%rax)
- and $3, R32(%rax)
+ mov %edx, %eax
+ and $3, %eax
jne L(nb00)
L(b00): C n = 4, 8, 12, ...
mov (up), %r10
mov -8(up), %r11
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r10, %rax
+ xor %eax, %eax
+ shld %cl, %r10, %rax
mov -16(up), %r8
lea 24(rp), rp
sub $4, n
jmp L(00)
L(nb00):C n = 1, 5, 9, ...
- cmp $2, R32(%rax)
+ cmp $2, %eax
jae L(nb01)
L(b01): mov (up), %r9
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r9, %rax
+ xor %eax, %eax
+ shld %cl, %r9, %rax
sub $2, n
jb L(le1)
mov -8(up), %r10
@@ -85,65 +66,62 @@ L(b01): mov (up), %r9
lea -8(up), up
lea 16(rp), rp
jmp L(01)
-L(le1): shl R8(cnt), %r9
+L(le1): shl %cl, %r9
mov %r9, (rp)
- FUNC_EXIT()
ret
L(nb01):C n = 2, 6, 10, ...
jne L(b11)
L(b10): mov (up), %r8
mov -8(up), %r9
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r8, %rax
+ xor %eax, %eax
+ shld %cl, %r8, %rax
sub $3, n
jb L(le2)
mov -16(up), %r10
lea -16(up), up
lea 8(rp), rp
jmp L(10)
-L(le2): shld R8(cnt), %r9, %r8
+L(le2): shld %cl, %r9, %r8
mov %r8, (rp)
- shl R8(cnt), %r9
+ shl %cl, %r9
mov %r9, -8(rp)
- FUNC_EXIT()
ret
ALIGN(16) C performance critical!
L(b11): C n = 3, 7, 11, ...
mov (up), %r11
mov -8(up), %r8
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r11, %rax
+ xor %eax, %eax
+ shld %cl, %r11, %rax
mov -16(up), %r9
lea -24(up), up
sub $4, n
jb L(end)
ALIGN(16)
-L(top): shld R8(cnt), %r8, %r11
+L(top): shld %cl, %r8, %r11
mov (up), %r10
mov %r11, (rp)
-L(10): shld R8(cnt), %r9, %r8
+L(10): shld %cl, %r9, %r8
mov -8(up), %r11
mov %r8, -8(rp)
-L(01): shld R8(cnt), %r10, %r9
+L(01): shld %cl, %r10, %r9
mov -16(up), %r8
mov %r9, -16(rp)
-L(00): shld R8(cnt), %r11, %r10
+L(00): shld %cl, %r11, %r10
mov -24(up), %r9
+ lea -32(up), up
mov %r10, -24(rp)
- add $-32, up
lea -32(rp), rp
sub $4, n
jnc L(top)
-L(end): shld R8(cnt), %r8, %r11
+L(end): shld %cl, %r8, %r11
mov %r11, (rp)
- shld R8(cnt), %r9, %r8
+ shld %cl, %r9, %r8
mov %r8, -8(rp)
- shl R8(cnt), %r9
+ shl %cl, %r9
mov %r9, -16(rp)
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/lshiftc.asm b/gmp/mpn/x86_64/core2/lshiftc.asm
deleted file mode 100644
index 65c7b2f1b8..0000000000
--- a/gmp/mpn/x86_64/core2/lshiftc.asm
+++ /dev/null
@@ -1,159 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 ?
-C Intel core2 1.5
-C Intel NHM 2.25 (up to about n = 260, then 1.875)
-C Intel SBR 2.25
-C Intel atom ?
-C VIA nano ?
-
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_lshiftc)
- FUNC_ENTRY(4)
- lea -8(rp,n,8), rp
- lea -8(up,n,8), up
-
- mov R32(%rdx), R32(%rax)
- and $3, R32(%rax)
- jne L(nb00)
-L(b00): C n = 4, 8, 12, ...
- mov (up), %r10
- mov -8(up), %r11
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r10, %rax
- mov -16(up), %r8
- lea 24(rp), rp
- sub $4, n
- jmp L(00)
-
-L(nb00):C n = 1, 5, 9, ...
- cmp $2, R32(%rax)
- jae L(nb01)
-L(b01): mov (up), %r9
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r9, %rax
- sub $2, n
- jb L(le1)
- mov -8(up), %r10
- mov -16(up), %r11
- lea -8(up), up
- lea 16(rp), rp
- jmp L(01)
-L(le1): shl R8(cnt), %r9
- not %r9
- mov %r9, (rp)
- FUNC_EXIT()
- ret
-
-L(nb01):C n = 2, 6, 10, ...
- jne L(b11)
-L(b10): mov (up), %r8
- mov -8(up), %r9
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r8, %rax
- sub $3, n
- jb L(le2)
- mov -16(up), %r10
- lea -16(up), up
- lea 8(rp), rp
- jmp L(10)
-L(le2): shld R8(cnt), %r9, %r8
- not %r8
- mov %r8, (rp)
- shl R8(cnt), %r9
- not %r9
- mov %r9, -8(rp)
- FUNC_EXIT()
- ret
-
- ALIGN(16) C performance critical!
-L(b11): C n = 3, 7, 11, ...
- mov (up), %r11
- mov -8(up), %r8
- xor R32(%rax), R32(%rax)
- shld R8(cnt), %r11, %rax
- mov -16(up), %r9
- lea -24(up), up
- sub $4, n
- jb L(end)
-
- ALIGN(16)
-L(top): shld R8(cnt), %r8, %r11
- mov (up), %r10
- not %r11
- mov %r11, (rp)
-L(10): shld R8(cnt), %r9, %r8
- mov -8(up), %r11
- not %r8
- mov %r8, -8(rp)
-L(01): shld R8(cnt), %r10, %r9
- mov -16(up), %r8
- not %r9
- mov %r9, -16(rp)
-L(00): shld R8(cnt), %r11, %r10
- mov -24(up), %r9
- not %r10
- mov %r10, -24(rp)
- add $-32, up
- lea -32(rp), rp
- sub $4, n
- jnc L(top)
-
-L(end): shld R8(cnt), %r8, %r11
- not %r11
- mov %r11, (rp)
- shld R8(cnt), %r9, %r8
- not %r8
- mov %r8, -8(rp)
- shl R8(cnt), %r9
- not %r9
- mov %r9, -16(rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/mul_basecase.asm b/gmp/mpn/x86_64/core2/mul_basecase.asm
deleted file mode 100644
index d16be852f7..0000000000
--- a/gmp/mpn/x86_64/core2/mul_basecase.asm
+++ /dev/null
@@ -1,975 +0,0 @@
-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/gmp/mpn/x86_64/core2/mullo_basecase.asm b/gmp/mpn/x86_64/core2/mullo_basecase.asm
deleted file mode 100644
index 0f03d867f6..0000000000
--- a/gmp/mpn/x86_64/core2/mullo_basecase.asm
+++ /dev/null
@@ -1,427 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/core2/popcount.asm b/gmp/mpn/x86_64/core2/popcount.asm
index e935cf1892..6c22999ff4 100644
--- a/gmp/mpn/x86_64/core2/popcount.asm
+++ b/gmp/mpn/x86_64/core2/popcount.asm
@@ -3,33 +3,21 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
-MULFUNC_PROLOGUE(mpn_popcount)
include_mpn(`x86/pentium4/sse2/popcount.asm')
diff --git a/gmp/mpn/x86_64/core2/redc_1.asm b/gmp/mpn/x86_64/core2/redc_1.asm
deleted file mode 100644
index d0e96ef1cb..0000000000
--- a/gmp/mpn/x86_64/core2/redc_1.asm
+++ /dev/null
@@ -1,425 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/core2/rsh1aors_n.asm b/gmp/mpn/x86_64/core2/rsh1aors_n.asm
deleted file mode 100644
index 27eed3712d..0000000000
--- a/gmp/mpn/x86_64/core2/rsh1aors_n.asm
+++ /dev/null
@@ -1,169 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 ?
-C Intel core2 3.05
-C Intel NHM 3.3
-C Intel SBR 2.5
-C Intel atom ?
-C VIA nano ?
-
-C TODO
-C * Loopmix to approach 2.5 c/l on NHM.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-
-ifdef(`OPERATION_rsh1add_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_rsh1add_n)
- define(func_nc, mpn_rsh1add_nc)')
-ifdef(`OPERATION_rsh1sub_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsh1sub_n)
- define(func_nc, mpn_rsh1sub_nc)')
-
-MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1add_nc mpn_rsh1sub_n mpn_rsh1sub_nc)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- push %rbx
- push %rbp
-
- neg %r8 C set C flag from parameter
- mov (up), %r8
- ADCSBB (vp), %r8
- jmp L(ent)
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
- push %rbx
- push %rbp
-
- mov (up), %r8
- ADDSUB (vp), %r8
-L(ent): sbb R32(%rbx), R32(%rbx) C save cy
- mov %r8, %rax
- and $1, R32(%rax) C return value
-
- lea (up,n,8), up
- lea (vp,n,8), vp
- lea (rp,n,8), rp
- mov R32(n), R32(%rbp)
- neg n
- and $3, R32(%rbp)
- jz L(b0)
- cmp $2, R32(%rbp)
- jae L(n1)
-
-L(b1): mov %r8, %rbp
- inc n
- js L(top)
- jmp L(end)
-
-L(n1): jnz L(b3)
- add R32(%rbx), R32(%rbx) C restore cy
- mov 8(up,n,8), %r11
- ADCSBB 8(vp,n,8), %r11
- sbb R32(%rbx), R32(%rbx) C save cy
- mov %r8, %r10
- add $-2, n
- jmp L(2)
-
-L(b3): add R32(%rbx), R32(%rbx) C restore cy
- mov 8(up,n,8), %r10
- mov 16(up,n,8), %r11
- ADCSBB 8(vp,n,8), %r10
- ADCSBB 16(vp,n,8), %r11
- sbb R32(%rbx), R32(%rbx) C save cy
- mov %r8, %r9
- dec n
- jmp L(3)
-
-L(b0): add R32(%rbx), R32(%rbx) C restore cy
- mov 8(up,n,8), %r9
- mov 16(up,n,8), %r10
- mov 24(up,n,8), %r11
- ADCSBB 8(vp,n,8), %r9
- ADCSBB 16(vp,n,8), %r10
- ADCSBB 24(vp,n,8), %r11
- sbb R32(%rbx), R32(%rbx) C save cy
- jmp L(4)
-
- ALIGN(16)
-
-L(top): add R32(%rbx), R32(%rbx) C restore cy
- mov (up,n,8), %r8
- mov 8(up,n,8), %r9
- mov 16(up,n,8), %r10
- mov 24(up,n,8), %r11
- ADCSBB (vp,n,8), %r8
- ADCSBB 8(vp,n,8), %r9
- ADCSBB 16(vp,n,8), %r10
- ADCSBB 24(vp,n,8), %r11
- sbb R32(%rbx), R32(%rbx) C save cy
- shrd $1, %r8, %rbp
- mov %rbp, -8(rp,n,8)
-L(4): shrd $1, %r9, %r8
- mov %r8, (rp,n,8)
-L(3): shrd $1, %r10, %r9
- mov %r9, 8(rp,n,8)
-L(2): shrd $1, %r11, %r10
- mov %r10, 16(rp,n,8)
-L(1): add $4, n
- mov %r11, %rbp
- js L(top)
-
-L(end): shrd $1, %rbx, %rbp
- mov %rbp, -8(rp)
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/rshift.asm b/gmp/mpn/x86_64/core2/rshift.asm
index ab32ec85df..9a3fc46f9a 100644
--- a/gmp/mpn/x86_64/core2/rshift.asm
+++ b/gmp/mpn/x86_64/core2/rshift.asm
@@ -1,69 +1,50 @@
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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 2007 Free Software Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 4.25
-C AMD K10 4.25
-C Intel P4 14.7
-C Intel core2 1.27
-C Intel NHM 1.375 (up to about n = 260, then 1.5)
-C Intel SBR 1.77
-C Intel atom ?
-C VIA nano ?
+C K8,K9: 4.25
+C K10: 4.25
+C P4: 14.7
+C P6-15: 1.27
C INPUT PARAMETERS
define(`rp', `%rdi')
define(`up', `%rsi')
define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+define(`cnt', `%cl')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_rshift)
- FUNC_ENTRY(4)
- mov R32(%rdx), R32(%rax)
- and $3, R32(%rax)
+ mov %edx, %eax
+ and $3, %eax
jne L(nb00)
L(b00): C n = 4, 8, 12, ...
mov (up), %r10
mov 8(up), %r11
- xor R32(%rax), R32(%rax)
- shrd R8(cnt), %r10, %rax
+ xor %eax, %eax
+ shrd %cl, %r10, %rax
mov 16(up), %r8
lea 8(up), up
lea -24(rp), rp
@@ -71,11 +52,11 @@ L(b00): C n = 4, 8, 12, ...
jmp L(00)
L(nb00):C n = 1, 5, 9, ...
- cmp $2, R32(%rax)
+ cmp $2, %eax
jae L(nb01)
L(b01): mov (up), %r9
- xor R32(%rax), R32(%rax)
- shrd R8(cnt), %r9, %rax
+ xor %eax, %eax
+ shrd %cl, %r9, %rax
sub $2, n
jb L(le1)
mov 8(up), %r10
@@ -83,65 +64,62 @@ L(b01): mov (up), %r9
lea 16(up), up
lea -16(rp), rp
jmp L(01)
-L(le1): shr R8(cnt), %r9
+L(le1): shr %cl, %r9
mov %r9, (rp)
- FUNC_EXIT()
ret
L(nb01):C n = 2, 6, 10, ...
jne L(b11)
L(b10): mov (up), %r8
mov 8(up), %r9
- xor R32(%rax), R32(%rax)
- shrd R8(cnt), %r8, %rax
+ xor %eax, %eax
+ shrd %cl, %r8, %rax
sub $3, n
jb L(le2)
mov 16(up), %r10
lea 24(up), up
lea -8(rp), rp
jmp L(10)
-L(le2): shrd R8(cnt), %r9, %r8
+L(le2): shrd %cl, %r9, %r8
mov %r8, (rp)
- shr R8(cnt), %r9
+ shr %cl, %r9
mov %r9, 8(rp)
- FUNC_EXIT()
ret
ALIGN(16)
L(b11): C n = 3, 7, 11, ...
mov (up), %r11
mov 8(up), %r8
- xor R32(%rax), R32(%rax)
- shrd R8(cnt), %r11, %rax
+ xor %eax, %eax
+ shrd %cl, %r11, %rax
mov 16(up), %r9
lea 32(up), up
sub $4, n
jb L(end)
ALIGN(16)
-L(top): shrd R8(cnt), %r8, %r11
+L(top): shrd %cl, %r8, %r11
mov -8(up), %r10
mov %r11, (rp)
-L(10): shrd R8(cnt), %r9, %r8
+L(10): shrd %cl, %r9, %r8
mov (up), %r11
mov %r8, 8(rp)
-L(01): shrd R8(cnt), %r10, %r9
+L(01): shrd %cl, %r10, %r9
mov 8(up), %r8
mov %r9, 16(rp)
-L(00): shrd R8(cnt), %r11, %r10
+L(00): shrd %cl, %r11, %r10
mov 16(up), %r9
+ lea 32(up), up
mov %r10, 24(rp)
- add $32, up
lea 32(rp), rp
sub $4, n
jnc L(top)
-L(end): shrd R8(cnt), %r8, %r11
+L(end): shrd %cl, %r8, %r11
mov %r11, (rp)
- shrd R8(cnt), %r9, %r8
+ shrd %cl, %r9, %r8
mov %r8, 8(rp)
- shr R8(cnt), %r9
+ shr %cl, %r9
mov %r9, 16(rp)
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/core2/sec_tabselect.asm b/gmp/mpn/x86_64/core2/sec_tabselect.asm
deleted file mode 100644
index e4360341d9..0000000000
--- a/gmp/mpn/x86_64/core2/sec_tabselect.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/core2/sqr_basecase.asm b/gmp/mpn/x86_64/core2/sqr_basecase.asm
deleted file mode 100644
index a112c1b52e..0000000000
--- a/gmp/mpn/x86_64/core2/sqr_basecase.asm
+++ /dev/null
@@ -1,984 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/core2/sublsh1_n.asm b/gmp/mpn/x86_64/core2/sublsh1_n.asm
deleted file mode 100644
index 46488fcafe..0000000000
--- a/gmp/mpn/x86_64/core2/sublsh1_n.asm
+++ /dev/null
@@ -1,47 +0,0 @@
-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-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')
-
-define(LSH, 1)
-define(RSH, 63)
-
-define(ADDSUB, sub)
-define(ADCSBB, sbb)
-define(func, mpn_sublsh1_n)
-
-MULFUNC_PROLOGUE(mpn_sublsh1_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-include_mpn(`x86_64/core2/sublshC_n.asm')
diff --git a/gmp/mpn/x86_64/core2/sublsh2_n.asm b/gmp/mpn/x86_64/core2/sublsh2_n.asm
deleted file mode 100644
index f3b1e28464..0000000000
--- a/gmp/mpn/x86_64/core2/sublsh2_n.asm
+++ /dev/null
@@ -1,47 +0,0 @@
-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-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')
-
-define(LSH, 2)
-define(RSH, 62)
-
-define(ADDSUB, sub)
-define(ADCSBB, sbb)
-define(func, mpn_sublsh2_n)
-
-MULFUNC_PROLOGUE(mpn_sublsh2_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-include_mpn(`x86_64/core2/sublshC_n.asm')
diff --git a/gmp/mpn/x86_64/coreihwl/addmul_2.asm b/gmp/mpn/x86_64/coreihwl/addmul_2.asm
deleted file mode 100644
index 54aebc888d..0000000000
--- a/gmp/mpn/x86_64/coreihwl/addmul_2.asm
+++ /dev/null
@@ -1,238 +0,0 @@
-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/gmp/mpn/x86_64/coreihwl/aorsmul_1.asm b/gmp/mpn/x86_64/coreihwl/aorsmul_1.asm
deleted file mode 100644
index fd5a26d00f..0000000000
--- a/gmp/mpn/x86_64/coreihwl/aorsmul_1.asm
+++ /dev/null
@@ -1,198 +0,0 @@
-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/gmp/mpn/x86_64/coreihwl/gmp-mparam.h b/gmp/mpn/x86_64/coreihwl/gmp-mparam.h
deleted file mode 100644
index eef44b3a81..0000000000
--- a/gmp/mpn/x86_64/coreihwl/gmp-mparam.h
+++ /dev/null
@@ -1,237 +0,0 @@
-/* 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/gmp/mpn/x86_64/coreihwl/mul_1.asm b/gmp/mpn/x86_64/coreihwl/mul_1.asm
deleted file mode 100644
index 1e3c338f4e..0000000000
--- a/gmp/mpn/x86_64/coreihwl/mul_1.asm
+++ /dev/null
@@ -1,155 +0,0 @@
-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/gmp/mpn/x86_64/coreihwl/mul_2.asm b/gmp/mpn/x86_64/coreihwl/mul_2.asm
deleted file mode 100644
index 5bdb1aa645..0000000000
--- a/gmp/mpn/x86_64/coreihwl/mul_2.asm
+++ /dev/null
@@ -1,173 +0,0 @@
-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/gmp/mpn/x86_64/coreihwl/mul_basecase.asm b/gmp/mpn/x86_64/coreihwl/mul_basecase.asm
deleted file mode 100644
index b2656c8e9b..0000000000
--- a/gmp/mpn/x86_64/coreihwl/mul_basecase.asm
+++ /dev/null
@@ -1,441 +0,0 @@
-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/gmp/mpn/x86_64/coreihwl/mullo_basecase.asm b/gmp/mpn/x86_64/coreihwl/mullo_basecase.asm
deleted file mode 100644
index 9986e8bcfa..0000000000
--- a/gmp/mpn/x86_64/coreihwl/mullo_basecase.asm
+++ /dev/null
@@ -1,426 +0,0 @@
-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/gmp/mpn/x86_64/coreihwl/redc_1.asm b/gmp/mpn/x86_64/coreihwl/redc_1.asm
deleted file mode 100644
index f1a475e53c..0000000000
--- a/gmp/mpn/x86_64/coreihwl/redc_1.asm
+++ /dev/null
@@ -1,433 +0,0 @@
-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/gmp/mpn/x86_64/coreihwl/sqr_basecase.asm b/gmp/mpn/x86_64/coreihwl/sqr_basecase.asm
deleted file mode 100644
index 641cdf349a..0000000000
--- a/gmp/mpn/x86_64/coreihwl/sqr_basecase.asm
+++ /dev/null
@@ -1,506 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/coreinhm/aorrlsh_n.asm b/gmp/mpn/x86_64/coreinhm/aorrlsh_n.asm
deleted file mode 100644
index eed64e701e..0000000000
--- a/gmp/mpn/x86_64/coreinhm/aorrlsh_n.asm
+++ /dev/null
@@ -1,200 +0,0 @@
-dnl AMD64 mpn_addlsh_n -- rp[] = up[] + (vp[] << k)
-dnl AMD64 mpn_rsblsh_n -- rp[] = (vp[] << k) - up[]
-dnl Optimised for Nehalem.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 4.75
-C Intel P4 ?
-C Intel core2 2.8-3
-C Intel NHM 2.8
-C Intel SBR 3.55
-C Intel atom ?
-C VIA nano ?
-
-C The inner-loop probably runs close to optimally on Nehalem (using 4-way
-C unrolling). The rest of the code is quite crude, and could perhaps be made
-C both smaller and faster.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-define(`cnt', `%r8')
-define(`cy', `%r9') C for _nc variant
-
-ifdef(`OPERATION_addlsh_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(IFRSB, )
- define(func_n, mpn_addlsh_n)
- define(func_nc, mpn_addlsh_nc)')
-ifdef(`OPERATION_rsblsh_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(IFRSB, `$1')
- define(func_n, mpn_rsblsh_n)
- define(func_nc, mpn_rsblsh_nc)')
-
-C mpn_rsblsh_nc removed below, its idea of carry-in is inconsistent with
-C refmpn_rsblsh_nc
-MULFUNC_PROLOGUE(mpn_addlsh_n mpn_addlsh_nc mpn_rsblsh_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ') C cnt
- push %rbx
- xor R32(%rbx), R32(%rbx) C clear CF save register
-L(ent): push %rbp
- mov R32(n), R32(%rbp)
- mov n, %rax
-
- mov R32(cnt), R32(%rcx)
- neg R32(%rcx)
-
- lea -8(up,%rax,8), up
- lea -8(vp,%rax,8), vp
- lea -40(rp,%rax,8), rp
- neg %rax
-
- and $3, R32(%rbp)
- jz L(b0)
- cmp $2, R32(%rbp)
- jc L(b1)
- jz L(b2)
-
-L(b3): xor R32(%r9), R32(%r9)
- mov 8(vp,%rax,8), %r10
- mov 16(vp,%rax,8), %r11
- shrd %cl, %r10, %r9
- shrd %cl, %r11, %r10
- add R32(%rbx), R32(%rbx)
- ADCSBB 8(up,%rax,8), %r9
- mov 24(vp,%rax,8), %r8
- ADCSBB 16(up,%rax,8), %r10
- sbb R32(%rbx), R32(%rbx)
- add $3, %rax
- jmp L(lo3)
-
-L(b0): mov 8(vp,%rax,8), %r9
- xor R32(%r8), R32(%r8)
- shrd %cl, %r9, %r8
- mov 16(vp,%rax,8), %r10
- mov 24(vp,%rax,8), %r11
- shrd %cl, %r10, %r9
- shrd %cl, %r11, %r10
- add R32(%rbx), R32(%rbx)
- ADCSBB 8(up,%rax,8), %r8
- mov %r8, 40(rp,%rax,8) C offset 40
- ADCSBB 16(up,%rax,8), %r9
- mov 32(vp,%rax,8), %r8
- ADCSBB 24(up,%rax,8), %r10
- sbb R32(%rbx), R32(%rbx)
- add $4, %rax
- jmp L(lo0)
-
-L(b1): mov 8(vp,%rax,8), %r8
- add $1, %rax
- jz L(1)
- mov 8(vp,%rax,8), %r9
- xor R32(%rbp), R32(%rbp)
- jmp L(lo1)
-L(1): xor R32(%r11), R32(%r11)
- jmp L(wd1)
-
-L(b2): xor %r10, %r10
- mov 8(vp,%rax,8), %r11
- shrd %cl, %r11, %r10
- add R32(%rbx), R32(%rbx)
- mov 16(vp,%rax,8), %r8
- ADCSBB 8(up,%rax,8), %r10
- sbb R32(%rbx), R32(%rbx)
- add $2, %rax
- jz L(end)
-
- ALIGN(16)
-L(top): mov 8(vp,%rax,8), %r9
- mov %r11, %rbp
-L(lo2): mov %r10, 24(rp,%rax,8) C offset 24
-L(lo1): shrd %cl, %r8, %rbp
- shrd %cl, %r9, %r8
- mov 16(vp,%rax,8), %r10
- mov 24(vp,%rax,8), %r11
- shrd %cl, %r10, %r9
- shrd %cl, %r11, %r10
- add R32(%rbx), R32(%rbx)
- ADCSBB (up,%rax,8), %rbp
- ADCSBB 8(up,%rax,8), %r8
- mov %r8, 40(rp,%rax,8) C offset 40
- ADCSBB 16(up,%rax,8), %r9
- mov 32(vp,%rax,8), %r8
- ADCSBB 24(up,%rax,8), %r10
- sbb R32(%rbx), R32(%rbx)
- add $4, %rax
- mov %rbp, (rp,%rax,8) C offset 32
-L(lo0):
-L(lo3): mov %r9, 16(rp,%rax,8) C offset 48
- jnz L(top)
-
-L(end): mov %r10, 24(rp,%rax,8)
-L(wd1): shrd %cl, %r8, %r11
- add R32(%rbx), R32(%rbx)
- ADCSBB (up,%rax,8), %r11
- mov %r11, 32(rp,%rax,8) C offset 32
- adc R32(%rax), R32(%rax) C rax is zero after loop
- shr R8(%rcx), %r8
- ADDSUB %r8, %rax
-IFRSB( neg %rax)
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ') C cnt
-IFDOS(` mov 64(%rsp), %r9 ') C cy
- push %rbx
- neg cy
- sbb R32(%rbx), R32(%rbx) C initialise CF save register
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreinhm/aorsmul_1.asm b/gmp/mpn/x86_64/coreinhm/aorsmul_1.asm
deleted file mode 100644
index b768905b93..0000000000
--- a/gmp/mpn/x86_64/coreinhm/aorsmul_1.asm
+++ /dev/null
@@ -1,187 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/coreinhm/gmp-mparam.h b/gmp/mpn/x86_64/coreinhm/gmp-mparam.h
deleted file mode 100644
index 6a7c03639f..0000000000
--- a/gmp/mpn/x86_64/coreinhm/gmp-mparam.h
+++ /dev/null
@@ -1,231 +0,0 @@
-/* Nehalem gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-/* 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 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 60
-#define MUL_TOOM44_THRESHOLD 166
-#define MUL_TOOM6H_THRESHOLD 228
-#define MUL_TOOM8H_THRESHOLD 309
-
-#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 28
-#define SQR_TOOM3_THRESHOLD 93
-#define SQR_TOOM4_THRESHOLD 250
-#define SQR_TOOM6_THRESHOLD 351
-#define SQR_TOOM8_THRESHOLD 454
-
-#define MULMID_TOOM42_THRESHOLD 28
-
-#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}, { 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,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 \
- { { 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}, \
- { 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}, \
- { 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 217
-#define SQR_FFT_THRESHOLD 2752
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 45
-#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 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
diff --git a/gmp/mpn/x86_64/coreinhm/hamdist.asm b/gmp/mpn/x86_64/coreinhm/hamdist.asm
deleted file mode 100644
index 93e1e5632b..0000000000
--- a/gmp/mpn/x86_64/coreinhm/hamdist.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl AMD64 mpn_hamdist -- hamming distance.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_hamdist)
-include_mpn(`x86_64/k10/hamdist.asm')
diff --git a/gmp/mpn/x86_64/coreinhm/popcount.asm b/gmp/mpn/x86_64/coreinhm/popcount.asm
deleted file mode 100644
index 8f22a715b6..0000000000
--- a/gmp/mpn/x86_64/coreinhm/popcount.asm
+++ /dev/null
@@ -1,38 +0,0 @@
-dnl AMD64 mpn_popcount -- population count.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86_64/k10/popcount.asm')
diff --git a/gmp/mpn/x86_64/coreinhm/redc_1.asm b/gmp/mpn/x86_64/coreinhm/redc_1.asm
deleted file mode 100644
index 4d9261d8f9..0000000000
--- a/gmp/mpn/x86_64/coreinhm/redc_1.asm
+++ /dev/null
@@ -1,544 +0,0 @@
-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/gmp/mpn/x86_64/coreinhm/sec_tabselect.asm b/gmp/mpn/x86_64/coreinhm/sec_tabselect.asm
deleted file mode 100644
index e4360341d9..0000000000
--- a/gmp/mpn/x86_64/coreinhm/sec_tabselect.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/coreisbr/addmul_2.asm b/gmp/mpn/x86_64/coreisbr/addmul_2.asm
deleted file mode 100644
index 21f0bf465f..0000000000
--- a/gmp/mpn/x86_64/coreisbr/addmul_2.asm
+++ /dev/null
@@ -1,224 +0,0 @@
-dnl AMD64 mpn_addmul_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.93 this
-C Intel IBR 2.66 this
-C Intel HWL 2.5 2.15
-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')
-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 (up), %rax
-
- mov n_param, n
- neg n
-
- lea (up,n_param,8), up
- lea 8(rp,n_param,8), rp
- mul v0
-
- 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(lo1)
-
-L(b11): dec n
- jmp L(lo3)
-
- ALIGN(32)
-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, X0 C 0
- mov %rdx, w1 C 1
- adc $0, w1 C 1
- mov (up,n,8), %rax
- mul v1
- 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, 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 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 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
-
- pop %r13
- pop %r12
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreisbr/aorrlsh1_n.asm b/gmp/mpn/x86_64/coreisbr/aorrlsh1_n.asm
deleted file mode 100644
index 2319a80060..0000000000
--- a/gmp/mpn/x86_64/coreisbr/aorrlsh1_n.asm
+++ /dev/null
@@ -1,54 +0,0 @@
-dnl AMD64 mpn_addlsh1_n -- rp[] = up[] + (vp[] << 1)
-dnl AMD64 mpn_rsblsh1_n -- rp[] = (vp[] << 1) - up[]
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-define(LSH, 1)
-define(RSH, 63)
-
-ifdef(`OPERATION_addlsh1_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_addlsh1_n)
- define(func_nc, mpn_addlsh1_nc)')
-ifdef(`OPERATION_rsblsh1_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsblsh1_n)
- define(func_nc, mpn_rsblsh1_nc)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_addlsh1_nc mpn_rsblsh1_n mpn_rsblsh1_nc)
-include_mpn(`x86_64/coreisbr/aorrlshC_n.asm')
diff --git a/gmp/mpn/x86_64/coreisbr/aorrlsh2_n.asm b/gmp/mpn/x86_64/coreisbr/aorrlsh2_n.asm
deleted file mode 100644
index 9416d5a164..0000000000
--- a/gmp/mpn/x86_64/coreisbr/aorrlsh2_n.asm
+++ /dev/null
@@ -1,56 +0,0 @@
-dnl AMD64 mpn_addlsh2_n -- rp[] = up[] + (vp[] << 1)
-dnl AMD64 mpn_rsblsh2_n -- rp[] = (vp[] << 1) - up[]
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-define(LSH, 2)
-define(RSH, 62)
-
-ifdef(`OPERATION_addlsh2_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_addlsh2_n)
- define(func_nc, mpn_addlsh2_nc)')
-ifdef(`OPERATION_rsblsh2_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsblsh2_n)
- define(func_nc, mpn_rsblsh2_nc)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-C mpn_rsblsh2_nc removed below, its idea of carry-in is inconsistent with
-C refmpn_rsblsh2_nc
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_addlsh2_nc mpn_rsblsh2_n)
-include_mpn(`x86_64/coreisbr/aorrlshC_n.asm')
diff --git a/gmp/mpn/x86_64/coreisbr/aorrlshC_n.asm b/gmp/mpn/x86_64/coreisbr/aorrlshC_n.asm
deleted file mode 100644
index 23ace41889..0000000000
--- a/gmp/mpn/x86_64/coreisbr/aorrlshC_n.asm
+++ /dev/null
@@ -1,173 +0,0 @@
-dnl AMD64 mpn_addlshC_n -- rp[] = up[] + (vp[] << C)
-dnl AMD64 mpn_rsblshC_n -- rp[] = (vp[] << C) - up[]
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 ?
-C AMD K10 ?
-C Intel P4 ?
-C Intel core2 3.25
-C Intel NHM 4
-C Intel SBR 2 C (or 1.95 when L(top)'s alignment = 16 (mod 32))
-C Intel atom ?
-C VIA nano ?
-
-C This code probably runs close to optimally on Sandy Bridge (using 4-way
-C unrolling). It also runs reasonably well on Core 2, but it runs poorly on
-C all other processors, including Nehalem.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-define(`cy', `%r8')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- push %rbp
- mov cy, %rax
- neg %rax C set msb on carry
- xor R32(%rbp), R32(%rbp) C limb carry
- mov (vp), %r8
- shrd $RSH, %r8, %rbp
- mov R32(n), R32(%r9)
- and $3, R32(%r9)
- je L(b00)
- cmp $2, R32(%r9)
- jc L(b01)
- je L(b10)
- jmp L(b11)
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
- push %rbp
- xor R32(%rbp), R32(%rbp) C limb carry
- mov (vp), %r8
- shrd $RSH, %r8, %rbp
- mov R32(n), R32(%rax)
- and $3, R32(%rax)
- je L(b00)
- cmp $2, R32(%rax)
- jc L(b01)
- je L(b10)
-
-L(b11): mov 8(vp), %r9
- shrd $RSH, %r9, %r8
- mov 16(vp), %r10
- shrd $RSH, %r10, %r9
- add R32(%rax), R32(%rax) C init carry flag
- ADCSBB (up), %rbp
- ADCSBB 8(up), %r8
- ADCSBB 16(up), %r9
- mov %rbp, (rp)
- mov %r8, 8(rp)
- mov %r9, 16(rp)
- mov %r10, %rbp
- lea 24(up), up
- lea 24(vp), vp
- lea 24(rp), rp
- sbb R32(%rax), R32(%rax) C save carry flag
- sub $3, n
- ja L(top)
- jmp L(end)
-
-L(b01): add R32(%rax), R32(%rax) C init carry flag
- ADCSBB (up), %rbp
- mov %rbp, (rp)
- mov %r8, %rbp
- lea 8(up), up
- lea 8(vp), vp
- lea 8(rp), rp
- sbb R32(%rax), R32(%rax) C save carry flag
- sub $1, n
- ja L(top)
- jmp L(end)
-
-L(b10): mov 8(vp), %r9
- shrd $RSH, %r9, %r8
- add R32(%rax), R32(%rax) C init carry flag
- ADCSBB (up), %rbp
- ADCSBB 8(up), %r8
- mov %rbp, (rp)
- mov %r8, 8(rp)
- mov %r9, %rbp
- lea 16(up), up
- lea 16(vp), vp
- lea 16(rp), rp
- sbb R32(%rax), R32(%rax) C save carry flag
- sub $2, n
- ja L(top)
- jmp L(end)
-
- ALIGN(16)
-L(top): mov (vp), %r8
- shrd $RSH, %r8, %rbp
-L(b00): mov 8(vp), %r9
- shrd $RSH, %r9, %r8
- mov 16(vp), %r10
- shrd $RSH, %r10, %r9
- mov 24(vp), %r11
- shrd $RSH, %r11, %r10
- lea 32(vp), vp
- add R32(%rax), R32(%rax) C restore carry flag
- ADCSBB (up), %rbp
- ADCSBB 8(up), %r8
- ADCSBB 16(up), %r9
- ADCSBB 24(up), %r10
- lea 32(up), up
- mov %rbp, (rp)
- mov %r8, 8(rp)
- mov %r9, 16(rp)
- mov %r10, 24(rp)
- mov %r11, %rbp
- lea 32(rp), rp
- sbb R32(%rax), R32(%rax) C save carry flag
- sub $4, n
- jnz L(top)
-
-L(end): shr $RSH, %rbp
- add R32(%rax), R32(%rax) C restore carry flag
- ADCSBB $0, %rbp
- mov %rbp, %rax
- pop %rbp
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreisbr/aorrlsh_n.asm b/gmp/mpn/x86_64/coreisbr/aorrlsh_n.asm
deleted file mode 100644
index db8ee68849..0000000000
--- a/gmp/mpn/x86_64/coreisbr/aorrlsh_n.asm
+++ /dev/null
@@ -1,215 +0,0 @@
-dnl AMD64 mpn_addlsh_n -- rp[] = up[] + (vp[] << k)
-dnl AMD64 mpn_rsblsh_n -- rp[] = (vp[] << k) - up[]
-dnl Optimised for Sandy Bridge.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 5.25
-C Intel P4 ?
-C Intel core2 3.1
-C Intel NHM 3.95
-C Intel SBR 2.75
-C Intel atom ?
-C VIA nano ?
-
-C The inner-loop probably runs close to optimally on Sandy Bridge (using 4-way
-C unrolling). The rest of the code is quite crude, and could perhaps be made
-C both smaller and faster.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-define(`cnt', `%r8')
-define(`cy', `%r9') C for _nc variant
-
-ifdef(`OPERATION_addlsh_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(IFRSB, )
- define(func_n, mpn_addlsh_n)
- define(func_nc, mpn_addlsh_nc)')
-ifdef(`OPERATION_rsblsh_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(IFRSB, `$1')
- define(func_n, mpn_rsblsh_n)
- define(func_nc, mpn_rsblsh_nc)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-C mpn_rsblsh_nc removed below, its idea of carry-in is inconsistent with
-C refmpn_rsblsh_nc
-MULFUNC_PROLOGUE(mpn_addlsh_n mpn_addlsh_nc mpn_rsblsh_n)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ') C cnt
- push %rbx
- xor R32(%rbx), R32(%rbx) C clear CF save register
-L(ent): push %rbp
- mov R32(n), R32(%rbp)
- mov n, %rax
- mov R32(cnt), R32(%rcx)
- neg R32(%rcx)
- and $3, R32(%rbp)
- jz L(b0)
- lea -32(vp,%rbp,8), vp
- lea -32(up,%rbp,8), up
- lea -32(rp,%rbp,8), rp
- cmp $2, R32(%rbp)
- jc L(b1)
- jz L(b2)
-
-L(b3): xor %r8, %r8
- mov 8(vp), %r9
- mov 16(vp), %r10
- shrd R8(%rcx), %r9, %r8
- shrd R8(%rcx), %r10, %r9
- mov 24(vp), %r11
- shrd R8(%rcx), %r11, %r10
- sub $3, %rax
- jz L(3)
- add R32(%rbx), R32(%rbx)
- lea 32(vp), vp
- ADCSBB 8(up), %r8
- ADCSBB 16(up), %r9
- ADCSBB 24(up), %r10
- lea 32(up), up
- jmp L(lo3)
-L(3): add R32(%rbx), R32(%rbx)
- lea 32(vp), vp
- ADCSBB 8(up), %r8
- ADCSBB 16(up), %r9
- ADCSBB 24(up), %r10
- jmp L(wd3)
-
-L(b0): mov (vp), %r8
- mov 8(vp), %r9
- xor R32(%rbp), R32(%rbp)
- jmp L(lo0)
-
-L(b1): xor %r10, %r10
- mov 24(vp), %r11
- shrd R8(%rcx), %r11, %r10
- sub $1, %rax
- jz L(1)
- add R32(%rbx), R32(%rbx)
- lea 32(vp), vp
- ADCSBB 24(up), %r10
- lea 32(up), up
- mov (vp), %r8
- jmp L(lo1)
-L(1): add R32(%rbx), R32(%rbx)
- ADCSBB 24(up), %r10
- jmp L(wd1)
-
-L(b2): xor %r9, %r9
- mov 16(vp), %r10
- shrd R8(%rcx), %r10, %r9
- mov 24(vp), %r11
- shrd R8(%rcx), %r11, %r10
- sub $2, %rax
- jz L(2)
- add R32(%rbx), R32(%rbx)
- lea 32(vp), vp
- ADCSBB 16(up), %r9
- ADCSBB 24(up), %r10
- lea 32(up), up
- jmp L(lo2)
-L(2): add R32(%rbx), R32(%rbx)
- ADCSBB 16(up), %r9
- ADCSBB 24(up), %r10
- jmp L(wd2)
-
- ALIGN(32) C 16-byte alignment is not enough!
-L(top): shrd R8(%rcx), %r11, %r10
- add R32(%rbx), R32(%rbx)
- lea 32(vp), vp
- ADCSBB (up), %rbp
- ADCSBB 8(up), %r8
- ADCSBB 16(up), %r9
- ADCSBB 24(up), %r10
- mov %rbp, (rp)
- lea 32(up), up
-L(lo3): mov %r8, 8(rp)
-L(lo2): mov %r9, 16(rp)
- mov (vp), %r8
-L(lo1): mov %r10, 24(rp)
- mov 8(vp), %r9
- mov %r11, %rbp
- lea 32(rp), rp
- sbb R32(%rbx), R32(%rbx)
-L(lo0): shrd R8(%rcx), %r8, %rbp
- mov 16(vp), %r10
- shrd R8(%rcx), %r9, %r8
- shrd R8(%rcx), %r10, %r9
- mov 24(vp), %r11
- sub $4, %rax
- jg L(top)
-
- shrd R8(%rcx), %r11, %r10
- add R32(%rbx), R32(%rbx)
- ADCSBB (up), %rbp
- ADCSBB 8(up), %r8
- ADCSBB 16(up), %r9
- ADCSBB 24(up), %r10
- mov %rbp, (rp)
-L(wd3): mov %r8, 8(rp)
-L(wd2): mov %r9, 16(rp)
-L(wd1): mov %r10, 24(rp)
- adc R32(%rax), R32(%rax) C rax is zero after loop
- shr R8(%rcx), %r11
- ADDSUB %r11, %rax
-IFRSB( neg %rax)
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ') C cnt
-IFDOS(` mov 64(%rsp), %r9 ') C cy
- push %rbx
- neg cy
- sbb R32(%rbx), R32(%rbx) C initialise CF save register
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreisbr/aors_n.asm b/gmp/mpn/x86_64/coreisbr/aors_n.asm
deleted file mode 100644
index 01abf78a0d..0000000000
--- a/gmp/mpn/x86_64/coreisbr/aors_n.asm
+++ /dev/null
@@ -1,198 +0,0 @@
-dnl AMD64 mpn_add_n, mpn_sub_n optimised for Sandy bridge, Ivy bridge, and
-dnl Haswell.
-
-dnl Contributed to the GNU project by Torbjörn Granlund.
-
-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 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)')
-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(32)
-PROLOGUE(func)
- FUNC_ENTRY(4)
- xor %r8, %r8
-
-L(ent): mov R32(n), R32(%rax)
- shr $2, n
-
- 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
- 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(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
- ADCSBB 8(vp), %r8
- ADCSBB 16(vp), %r9
- lea 8(vp), vp
- jmp L(lo1)
-
-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
- lea 32(up), up
- 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
- jnz L(top)
-
-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 ')
- jmp L(ent)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreisbr/aorsmul_1.asm b/gmp/mpn/x86_64/coreisbr/aorsmul_1.asm
deleted file mode 100644
index 9f01d9c061..0000000000
--- a/gmp/mpn/x86_64/coreisbr/aorsmul_1.asm
+++ /dev/null
@@ -1,209 +0,0 @@
-dnl X86-64 mpn_addmul_1 and mpn_submul_1 optimised for Intel Sandy Bridge.
-
-dnl Contributed to the GNU project by Torbjörn Granlund.
-
-dnl Copyright 2003-2005, 2007, 2008, 2011-2013 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 (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 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(`I',`$1')
-
-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)
-
-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(32)
-PROLOGUE(func)
-
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
- mov (up), %rax
- push %rbx
- lea (up,n_param,8), up
- lea (rp,n_param,8), rp
-
- test $1, R8(n_param)
- jnz L(b13)
-
-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
- mov %rdx, %r9
- mov -8(rp,n,8), %r8
- jmp L(e0)
-
- ALIGN(16)
-L(b2): mov $-1, n
- sub n_param, n
- mul v0
- mov 8(rp,n,8), %r8
- mov %rdx, %r9
- jmp L(e2)
-
- 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
- mov -16(rp,n,8), %r10
- mov %rdx, %r11
- 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
- mov -16(rp,n,8), %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
- mul v0
- ADDSUB %r9, %r10
- mov %rdx, %r9
- mov -8(rp,n,8), %r8
- adc $0, %r11
- mov %r10, -16(rp,n,8)
-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
-L(e3): mov %rdx, %r11
- ADDSUB %rax, %r10
- mov 8(up,n,8), %rax
- adc $0, %r11
- mul v0
- mov 8(rp,n,8), %r8
- ADDSUB %r9, %r10
- 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
- mov I(-8(rp),-16(rp,n,8)), %r10
- ADDSUB %r11, %r8
- 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/gmp/mpn/x86_64/coreisbr/divrem_1.asm b/gmp/mpn/x86_64/coreisbr/divrem_1.asm
deleted file mode 100644
index d9f371f785..0000000000
--- a/gmp/mpn/x86_64/coreisbr/divrem_1.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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')
diff --git a/gmp/mpn/x86_64/coreisbr/gmp-mparam.h b/gmp/mpn/x86_64/coreisbr/gmp-mparam.h
deleted file mode 100644
index 3a91b4c30e..0000000000
--- a/gmp/mpn/x86_64/coreisbr/gmp-mparam.h
+++ /dev/null
@@ -1,224 +0,0 @@
-/* Sandy Bridge 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
-
-/* 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 */
-#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 9
-#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 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 105
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 122
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 105
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 113
-#define MUL_TOOM43_TO_TOOM54_THRESHOLD 148
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 28
-#define SQR_TOOM3_THRESHOLD 93
-#define SQR_TOOM4_THRESHOLD 250
-#define SQR_TOOM6_THRESHOLD 348
-#define SQR_TOOM8_THRESHOLD 454
-
-#define MULMID_TOOM42_THRESHOLD 36
-
-#define MULMOD_BNM1_THRESHOLD 12
-#define SQRMOD_BNM1_THRESHOLD 15
-
-#define MUL_FFT_MODF_THRESHOLD 380 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 380, 5}, { 19, 6}, { 10, 5}, { 21, 6}, \
- { 11, 5}, { 23, 6}, { 21, 7}, { 11, 6}, \
- { 23, 7}, { 21, 8}, { 11, 7}, { 25, 8}, \
- { 13, 7}, { 27, 8}, { 15, 7}, { 31, 8}, \
- { 21, 9}, { 11, 8}, { 27, 9}, { 15, 8}, \
- { 33, 9}, { 19, 8}, { 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, 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}, { 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 336 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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}, { 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 190
-#define SQR_FFT_THRESHOLD 3264
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 62
-#define MULLO_MUL_N_THRESHOLD 8907
-
-#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 42
-#define INV_NEWTON_THRESHOLD 166
-#define INV_APPR_THRESHOLD 165
-
-#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 1334
-#define MU_DIVAPPR_Q_THRESHOLD 1387
-#define MUPI_DIV_QR_THRESHOLD 69
-#define MU_BDIV_QR_THRESHOLD 1187
-#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 14
-#define GET_STR_PRECOMPUTE_THRESHOLD 22
-#define SET_STR_DC_THRESHOLD 802
-#define SET_STR_PRECOMPUTE_THRESHOLD 2042
-
-#define FAC_DSC_THRESHOLD 644
-#define FAC_ODD_THRESHOLD 24
diff --git a/gmp/mpn/x86_64/coreisbr/lshift.asm b/gmp/mpn/x86_64/coreisbr/lshift.asm
deleted file mode 100644
index a1cbc31f61..0000000000
--- a/gmp/mpn/x86_64/coreisbr/lshift.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_lshift)
-include_mpn(`x86_64/fastsse/lshift-movdqu2.asm')
diff --git a/gmp/mpn/x86_64/coreisbr/lshiftc.asm b/gmp/mpn/x86_64/coreisbr/lshiftc.asm
deleted file mode 100644
index ac90edb76b..0000000000
--- a/gmp/mpn/x86_64/coreisbr/lshiftc.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_lshiftc)
-include_mpn(`x86_64/fastsse/lshiftc-movdqu2.asm')
diff --git a/gmp/mpn/x86_64/coreisbr/mul_1.asm b/gmp/mpn/x86_64/coreisbr/mul_1.asm
deleted file mode 100644
index ded7d899c2..0000000000
--- a/gmp/mpn/x86_64/coreisbr/mul_1.asm
+++ /dev/null
@@ -1,161 +0,0 @@
-dnl X86-64 mpn_mul_1 optimised for Intel Sandy Bridge.
-
-dnl Contributed to the GNU project by Torbjörn Granlund.
-
-dnl Copyright 2003-2005, 2007, 2008, 2011-2013 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 core2
-C Intel NHM
-C Intel SBR 2.5
-C Intel IBR 2.4
-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 * Add mul_1c entry point.
-C * We could preserve one less register under DOS64 calling conventions, using
-C r10 instead of rsi.
-
-define(`rp', `%rdi') C rcx
-define(`up', `%rsi') C rdx
-define(`n_param', `%rdx') C r8
-define(`v0', `%rcx') C r9
-
-define(`n', `%r11')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFDOS(` define(`up', ``%rsi'')') dnl
-IFDOS(` define(`rp', ``%rcx'')') dnl
-IFDOS(` define(`v0', ``%r9'')') dnl
-IFDOS(` define(`r9', ``rdi'')') dnl
-IFDOS(` define(`n_param',``%r8'')') dnl
-IFDOS(` define(`n', ``%r8'')') dnl
-IFDOS(` define(`r8', ``r11'')') dnl
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mul_1)
-
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
- mov (up), %rax
- mov R32(`n_param'), R32(%r10)
-IFSTD(` mov n_param, n ')
-
- lea (up,n_param,8), up
- lea -8(rp,n_param,8), rp
- neg n
- mul v0
- and $3, R32(%r10)
- jz L(b0)
- cmp $2, R32(%r10)
- jb L(b1)
- jz L(b2)
-
-L(b3): add $-1, n
- mov %rax, %r9
- mov %rdx, %r8
- mov 16(up,n,8), %rax
- jmp L(L3)
-
-L(b1): mov %rax, %r9
- mov %rdx, %r8
- add $1, n
- jnc L(L1)
- mov %rax, (rp)
- mov %rdx, %rax
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
- ret
-
-L(b2): add $-2, n
- mov %rax, %r8
- mov %rdx, %r9
- mov 24(up,n,8), %rax
- jmp L(L2)
-
-L(b0): mov %rax, %r8
- mov %rdx, %r9
- mov 8(up,n,8), %rax
- jmp L(L0)
-
- ALIGN(8)
-L(top): mov %rdx, %r8
- add %rax, %r9
-L(L1): mov 0(up,n,8), %rax
- adc $0, %r8
- mul v0
- add %rax, %r8
- mov %r9, 0(rp,n,8)
- mov 8(up,n,8), %rax
- mov %rdx, %r9
- adc $0, %r9
-L(L0): mul v0
- mov %r8, 8(rp,n,8)
- add %rax, %r9
- mov %rdx, %r8
- mov 16(up,n,8), %rax
- adc $0, %r8
-L(L3): mul v0
- mov %r9, 16(rp,n,8)
- mov %rdx, %r9
- add %rax, %r8
- mov 24(up,n,8), %rax
- adc $0, %r9
-L(L2): mul v0
- mov %r8, 24(rp,n,8)
- add $4, n
- jnc L(top)
-
-L(end): add %rax, %r9
- mov %rdx, %rax
- adc $0, %rax
- mov %r9, (rp)
-
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreisbr/mul_2.asm b/gmp/mpn/x86_64/coreisbr/mul_2.asm
deleted file mode 100644
index ffee78a385..0000000000
--- a/gmp/mpn/x86_64/coreisbr/mul_2.asm
+++ /dev/null
@@ -1,163 +0,0 @@
-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/gmp/mpn/x86_64/coreisbr/mul_basecase.asm b/gmp/mpn/x86_64/coreisbr/mul_basecase.asm
deleted file mode 100644
index f026136ea0..0000000000
--- a/gmp/mpn/x86_64/coreisbr/mul_basecase.asm
+++ /dev/null
@@ -1,407 +0,0 @@
-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/gmp/mpn/x86_64/coreisbr/mullo_basecase.asm b/gmp/mpn/x86_64/coreisbr/mullo_basecase.asm
deleted file mode 100644
index a41a8acee4..0000000000
--- a/gmp/mpn/x86_64/coreisbr/mullo_basecase.asm
+++ /dev/null
@@ -1,384 +0,0 @@
-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/gmp/mpn/x86_64/coreisbr/popcount.asm b/gmp/mpn/x86_64/coreisbr/popcount.asm
deleted file mode 100644
index a5be33e6a7..0000000000
--- a/gmp/mpn/x86_64/coreisbr/popcount.asm
+++ /dev/null
@@ -1,118 +0,0 @@
-dnl AMD64 mpn_popcount -- population count.
-
-dnl Copyright 2008, 2010-2013 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-C cycles/limb
-C AMD K8,K9 n/a
-C AMD K10 1.5 slower than 8-way non-pipelined code
-C AMD bd1 4.2
-C AMD bobcat 6.28 slower than 8-way non-pipelined code
-C Intel P4 n/a
-C Intel core2 n/a
-C Intel NHM 1.32
-C Intel SBR 1.05 fluctuating
-C Intel IBR 1.05 fluctuating
-C Intel HSW 1
-C Intel atom n/a
-C VIA nano n/a
-
-define(`up', `%rdi')
-define(`n_param', `%rsi')
-
-define(`n', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_popcount)
- FUNC_ENTRY(2)
-
- lea (up,n_param,8), up
- xor R32(%rax), R32(%rax)
-
- test $1, R8(n_param)
- jnz L(bx1)
-
-L(bx0): test $2, R8(n_param)
- jnz L(b10)
-
-L(b00): mov $0, R32(n)
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x04,0xcf C popcnt (up,n,8), %r8
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xcf,0x08 C popcnt 8(up,n,8), %r9
- jmp L(lo0)
-
-L(b10): mov $2, R32(n)
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x54,0xcf,0xf0 C popcnt -16(up,n,8), %r10
- .byte 0xf3,0x4c,0x0f,0xb8,0x5c,0xcf,0xf8 C popcnt -8(up,n,8), %r11
- test n, n
- jz L(cj2)
- jmp L(lo2)
-
-L(bx1): test $2, R8(n_param)
- jnz L(b11)
-
-L(b01): mov $1, R32(n)
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x5c,0xcf,0xf8 C popcnt -8(up,n,8), %r11
- test n, n
- jz L(cj1)
- .byte 0xf3,0x4c,0x0f,0xb8,0x04,0xcf C popcnt 0(up,n,8), %r8
- jmp L(lo1)
-
-L(b11): mov $-1, n
- sub n_param, n
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xcf,0x08 C popcnt 8(up,n,8), %r9
- .byte 0xf3,0x4c,0x0f,0xb8,0x54,0xcf,0x10 C popcnt 16(up,n,8), %r10
- jmp L(lo3)
-
- ALIGN(32)
-L(top): add %r9, %rax
-L(lo2): .byte 0xf3,0x4c,0x0f,0xb8,0x04,0xcf C popcnt 0(up,n,8), %r8
- add %r10, %rax
-L(lo1): .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xcf,0x08 C popcnt 8(up,n,8), %r9
- add %r11, %rax
-L(lo0): .byte 0xf3,0x4c,0x0f,0xb8,0x54,0xcf,0x10 C popcnt 16(up,n,8), %r10
- add %r8, %rax
-L(lo3): .byte 0xf3,0x4c,0x0f,0xb8,0x5c,0xcf,0x18 C popcnt 24(up,n,8), %r11
- add $4, n
- js L(top)
-
-L(end): add %r9, %rax
-L(cj2): add %r10, %rax
-L(cj1): add %r11, %rax
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreisbr/redc_1.asm b/gmp/mpn/x86_64/coreisbr/redc_1.asm
deleted file mode 100644
index 8a5170e3fd..0000000000
--- a/gmp/mpn/x86_64/coreisbr/redc_1.asm
+++ /dev/null
@@ -1,541 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/coreisbr/rsh1aors_n.asm b/gmp/mpn/x86_64/coreisbr/rsh1aors_n.asm
deleted file mode 100644
index fd2eaea7bb..0000000000
--- a/gmp/mpn/x86_64/coreisbr/rsh1aors_n.asm
+++ /dev/null
@@ -1,193 +0,0 @@
-dnl X86-64 mpn_rsh1add_n, mpn_rsh1sub_n optimised for Intel Sandy Bridge.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 4.25
-C Intel P4 21.5
-C Intel core2 3.2
-C Intel NHM 3.87
-C Intel SBR 2.05
-C Intel atom ?
-C VIA nano 44.9
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-
-ifdef(`OPERATION_rsh1add_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_rsh1add_n)
- define(func_nc, mpn_rsh1add_nc)')
-ifdef(`OPERATION_rsh1sub_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsh1sub_n)
- define(func_nc, mpn_rsh1sub_nc)')
-
-MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1add_nc mpn_rsh1sub_n mpn_rsh1sub_nc)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
-
- ALIGN(16)
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- push %rbx
- push %rbp
-
- neg %r8 C set C flag from parameter
- mov (up), %rbp
- ADCSBB (vp), %rbp
-
- jmp L(ent)
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
- push %rbx
- push %rbp
-
- mov (up), %rbp
- ADDSUB (vp), %rbp
-L(ent):
- sbb R32(%rbx), R32(%rbx) C save cy
- mov R32(%rbp), R32(%rax)
- and $1, R32(%rax) C return value
-
- mov R32(n), R32(%r11)
- and $3, R32(%r11)
-
- cmp $1, R32(%r11)
- je L(do) C jump if n = 1 5 9 ...
-
-L(n1): cmp $2, R32(%r11)
- jne L(n2) C jump unless n = 2 6 10 ...
- add R32(%rbx), R32(%rbx) C restore cy
- mov 8(up), %r10
- ADCSBB 8(vp), %r10
- lea 8(up), up
- lea 8(vp), vp
- lea 8(rp), rp
- sbb R32(%rbx), R32(%rbx) C save cy
-
- shrd $1, %r10, %rbp
- mov %rbp, -8(rp)
- jmp L(cj1)
-
-L(n2): cmp $3, R32(%r11)
- jne L(n3) C jump unless n = 3 7 11 ...
- add R32(%rbx), R32(%rbx) C restore cy
- mov 8(up), %r9
- mov 16(up), %r10
- ADCSBB 8(vp), %r9
- ADCSBB 16(vp), %r10
- lea 16(up), up
- lea 16(vp), vp
- lea 16(rp), rp
- sbb R32(%rbx), R32(%rbx) C save cy
-
- shrd $1, %r9, %rbp
- mov %rbp, -16(rp)
- jmp L(cj2)
-
-L(n3): dec n C come here for n = 4 8 12 ...
- add R32(%rbx), R32(%rbx) C restore cy
- mov 8(up), %r8
- mov 16(up), %r9
- ADCSBB 8(vp), %r8
- ADCSBB 16(vp), %r9
- mov 24(up), %r10
- ADCSBB 24(vp), %r10
- lea 24(up), up
- lea 24(vp), vp
- lea 24(rp), rp
- sbb R32(%rbx), R32(%rbx) C save cy
-
- shrd $1, %r8, %rbp
- mov %rbp, -24(rp)
- shrd $1, %r9, %r8
- mov %r8, -16(rp)
-L(cj2): shrd $1, %r10, %r9
- mov %r9, -8(rp)
-L(cj1): mov %r10, %rbp
-
-L(do):
- shr $2, n C 4
- je L(end) C 2
- ALIGN(16)
-L(top): add R32(%rbx), R32(%rbx) C restore cy
-
- mov 8(up), %r8
- mov 16(up), %r9
- ADCSBB 8(vp), %r8
- ADCSBB 16(vp), %r9
- mov 24(up), %r10
- mov 32(up), %r11
- ADCSBB 24(vp), %r10
- ADCSBB 32(vp), %r11
-
- lea 32(up), up
- lea 32(vp), vp
-
- sbb R32(%rbx), R32(%rbx) C save cy
-
- shrd $1, %r8, %rbp
- mov %rbp, (rp)
- shrd $1, %r9, %r8
- mov %r8, 8(rp)
- shrd $1, %r10, %r9
- mov %r9, 16(rp)
- shrd $1, %r11, %r10
- mov %r10, 24(rp)
-
- dec n
- mov %r11, %rbp
- lea 32(rp), rp
- jne L(top)
-
-L(end): shrd $1, %rbx, %rbp
- mov %rbp, (rp)
- pop %rbp
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/coreisbr/rshift.asm b/gmp/mpn/x86_64/coreisbr/rshift.asm
deleted file mode 100644
index 4c1c0d4cde..0000000000
--- a/gmp/mpn/x86_64/coreisbr/rshift.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_rshift)
-include_mpn(`x86_64/fastsse/rshift-movdqu2.asm')
diff --git a/gmp/mpn/x86_64/coreisbr/sec_tabselect.asm b/gmp/mpn/x86_64/coreisbr/sec_tabselect.asm
deleted file mode 100644
index e4360341d9..0000000000
--- a/gmp/mpn/x86_64/coreisbr/sec_tabselect.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/coreisbr/sqr_basecase.asm b/gmp/mpn/x86_64/coreisbr/sqr_basecase.asm
deleted file mode 100644
index 46a36121fe..0000000000
--- a/gmp/mpn/x86_64/coreisbr/sqr_basecase.asm
+++ /dev/null
@@ -1,484 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/darwin.m4 b/gmp/mpn/x86_64/darwin.m4
index 6f8ec7893d..9eb0f53723 100644
--- a/gmp/mpn/x86_64/darwin.m4
+++ b/gmp/mpn/x86_64/darwin.m4
@@ -1,41 +1,23 @@
divert(-1)
-dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
+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 modify
-dnl it under the terms of either:
+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 Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl 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
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
define(`DARWIN')
-define(`LEA',`dnl
-ifdef(`PIC',
- `lea $1(%rip), $2'
-,
- `movabs `$'$1, $2')
-')
-
dnl Usage: CALL(funcname)
dnl
dnl Simply override the definition in x86_64-defs.m4.
@@ -43,39 +25,6 @@ dnl Simply override the definition in x86_64-defs.m4.
define(`CALL',`call GSYM_PREFIX`'$1')
-dnl Usage: JUMPTABSECT
-dnl
-dnl CAUTION: Do not put anything sensible here, like RODATA. That works with
-dnl some Darwin tool chains, but silently breaks with other. (Note that
-dnl putting jump tables in the text segment is a really poor idea for PC many
-dnl processors, since they cannot cache the same thing in both L1D and L2I.)
-
-define(`JUMPTABSECT', `.text')
-
-
-dnl Usage: JMPENT(targlabel,tablabel)
-
-define(`JMPENT',`dnl
-ifdef(`PIC',
- `.set $1_tmp, $1-$2
- .long $1_tmp'
-,
- `.quad $1'
-)')
-
-dnl Target ABI macros. For Darwin we override IFELF (and leave default for
-dnl IFDOS and IFSTD).
-
-define(`IFELF', `')
-
-
-dnl Usage: PROTECT(symbol)
-dnl
-dnl Used for private GMP symbols that should never be overridden by users.
-dnl This can save reloc entries and improve shlib sharing as well as
-dnl application startup times
-
-define(`PROTECT', `.private_extern $1')
-
+define(`JUMPTABSECT', `DATA')
divert`'dnl
diff --git a/gmp/mpn/x86_64/div_qr_1n_pi1.asm b/gmp/mpn/x86_64/div_qr_1n_pi1.asm
deleted file mode 100644
index cb072e979d..0000000000
--- a/gmp/mpn/x86_64/div_qr_1n_pi1.asm
+++ /dev/null
@@ -1,247 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/div_qr_2n_pi1.asm b/gmp/mpn/x86_64/div_qr_2n_pi1.asm
deleted file mode 100644
index 5e59a0ac5d..0000000000
--- a/gmp/mpn/x86_64/div_qr_2n_pi1.asm
+++ /dev/null
@@ -1,158 +0,0 @@
-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-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 c/l
-C INPUT PARAMETERS
-define(`qp', `%rdi')
-define(`rp', `%rsi')
-define(`up_param', `%rdx')
-define(`un', `%rcx')
-define(`d1', `%r8')
-define(`d0', `%r9')
-define(`di_param', `8(%rsp)')
-
-define(`di', `%r10')
-define(`up', `%r11')
-define(`u2', `%rbx')
-define(`u1', `%r12')
-define(`t1', `%r13')
-define(`t0', `%r14')
-define(`md1', `%r15')
-
-C TODO
-C * Store qh in the same stack slot as di_param, instead of pushing
-C it. (we could put it in register %rbp, but then we would need to
-C save and restore that instead, which doesn't seem like a win).
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_div_qr_2n_pi1)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
-IFDOS(` mov 64(%rsp), %r9 ')
-IFDOS(`define(`di_param', `72(%rsp)')')
- mov di_param, di
- mov up_param, up
- push %r15
- push %r14
- push %r13
- push %r12
- push %rbx
-
- mov -16(up, un, 8), u1
- mov -8(up, un, 8), u2
-
- mov u1, t0
- mov u2, t1
- sub d0, t0
- sbb d1, t1
- cmovnc t0, u1
- cmovnc t1, u2
- C push qh which is !carry
- sbb %rax, %rax
- inc %rax
- push %rax
- lea -2(un), un
- mov d1, md1
- neg md1
-
- jmp L(next)
-
- ALIGN(16)
-L(loop):
- C udiv_qr_3by2 (q,u2,u1,u2,u1,n0, d1,d0,di)
- C Based on the optimized divrem_2.asm code.
-
- mov di, %rax
- mul u2
- mov u1, t0
- add %rax, t0 C q0 in t0
- adc u2, %rdx
- mov %rdx, t1 C q in t1
- imul md1, %rdx
- mov d0, %rax
- lea (%rdx, u1), u2
- mul t1
- mov (up, un, 8), u1
- sub d0, u1
- sbb d1, u2
- sub %rax, u1
- sbb %rdx, u2
- xor R32(%rax), R32(%rax)
- xor R32(%rdx), R32(%rdx)
- cmp t0, u2
- cmovnc d0, %rax
- cmovnc d1, %rdx
- adc $0, t1
- nop
- add %rax, u1
- adc %rdx, u2
- cmp d1, u2
- jae L(fix)
-L(bck):
- mov t1, (qp, un, 8)
-L(next):
- sub $1, un
- jnc L(loop)
-L(end):
- mov u2, 8(rp)
- mov u1, (rp)
-
- C qh on stack
- pop %rax
-
- pop %rbx
- pop %r12
- pop %r13
- pop %r14
- pop %r15
- FUNC_EXIT()
- ret
-
-L(fix): C Unlikely update. u2 >= d1
- seta %dl
- cmp d0, u1
- setae %al
- orb %dl, %al C "orb" form to placate Sun tools
- je L(bck)
- inc t1
- sub d0, u1
- sbb d1, u2
- jmp L(bck)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/div_qr_2u_pi1.asm b/gmp/mpn/x86_64/div_qr_2u_pi1.asm
deleted file mode 100644
index 85af96fbf6..0000000000
--- a/gmp/mpn/x86_64/div_qr_2u_pi1.asm
+++ /dev/null
@@ -1,200 +0,0 @@
-dnl x86-64 mpn_div_qr_2u_pi1
-dnl -- Divide an mpn number by an unnormalized 2-limb number,
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 INPUT PARAMETERS
-define(`qp', `%rdi')
-define(`rp', `%rsi')
-define(`up_param', `%rdx')
-define(`un_param', `%rcx') dnl %rcx needed for shift count
-define(`d1', `%r8')
-define(`d0', `%r9')
-define(`shift_param', `FRAME+8(%rsp)')
-define(`di_param', `FRAME+16(%rsp)')
-
-define(`di', `%r10')
-define(`up', `%r11')
-define(`un', `%rbp')
-define(`u2', `%rbx')
-define(`u1', `%r12')
-define(`u0', `%rsi') dnl Same as rp, which is saved and restored.
-define(`t1', `%r13')
-define(`t0', `%r14')
-define(`md1', `%r15')
-
-ASM_START()
- TEXT
- ALIGN(16)
-deflit(`FRAME', 0)
-PROLOGUE(mpn_div_qr_2u_pi1)
- mov di_param, di
- mov up_param, up
- push %r15
- push %r14
- push %r13
- push %r12
- push %rbx
- push %rbp
- push rp
-deflit(`FRAME', 56)
- lea -2(un_param), un
- mov d1, md1
- neg md1
-
- C int parameter, 32 bits only
- movl shift_param, R32(%rcx)
-
- C FIXME: Different code for SHLD_SLOW
-
- xor R32(u2), R32(u2)
- mov 8(up, un, 8), u1
- shld %cl, u1, u2
- C Remains to read (up, un, 8) and shift u1, u0
- C udiv_qr_3by2 (qh,u2,u1,u2,u1,n0, d1,d0,di)
- mov di, %rax
- mul u2
- mov (up, un, 8), u0
- shld %cl, u0, u1
- mov u1, t0
- add %rax, t0 C q0 in t0
- adc u2, %rdx
- mov %rdx, t1 C q in t1
- imul md1, %rdx
- mov d0, %rax
- lea (%rdx, u1), u2
- mul t1
- mov u0, u1
- shl %cl, u1
- sub d0, u1
- sbb d1, u2
- sub %rax, u1
- sbb %rdx, u2
- xor R32(%rax), R32(%rax)
- xor R32(%rdx), R32(%rdx)
- cmp t0, u2
- cmovnc d0, %rax
- cmovnc d1, %rdx
- adc $0, t1
- nop
- add %rax, u1
- adc %rdx, u2
- cmp d1, u2
- jae L(fix_qh)
-L(bck_qh):
- push t1 C push qh on stack
-
- jmp L(next)
-
- ALIGN(16)
-L(loop):
- C udiv_qr_3by2 (q,u2,u1,u2,u1,n0, d1,d0,di)
- C Based on the optimized divrem_2.asm code.
-
- mov di, %rax
- mul u2
- mov (up, un, 8), u0
- xor R32(t1), R32(t1)
- shld %cl, u0, t1
- or t1, u1
- mov u1, t0
- add %rax, t0 C q0 in t0
- adc u2, %rdx
- mov %rdx, t1 C q in t1
- imul md1, %rdx
- mov d0, %rax
- lea (%rdx, u1), u2
- mul t1
- mov u0, u1
- shl %cl, u1
- sub d0, u1
- sbb d1, u2
- sub %rax, u1
- sbb %rdx, u2
- xor R32(%rax), R32(%rax)
- xor R32(%rdx), R32(%rdx)
- cmp t0, u2
- cmovnc d0, %rax
- cmovnc d1, %rdx
- adc $0, t1
- nop
- add %rax, u1
- adc %rdx, u2
- cmp d1, u2
- jae L(fix)
-L(bck):
- mov t1, (qp, un, 8)
-L(next):
- sub $1, un
- jnc L(loop)
-L(end):
- C qh on stack
- pop %rax
- pop rp
- shrd %cl, u2, u1
- shr %cl, u2
- mov u2, 8(rp)
- mov u1, (rp)
-
- pop %rbp
- pop %rbx
- pop %r12
- pop %r13
- pop %r14
- pop %r15
- ret
-
-L(fix): C Unlikely update. u2 >= d1
- seta %dl
- cmp d0, u1
- setae %al
- orb %dl, %al C "orb" form to placate Sun tools
- je L(bck)
- inc t1
- sub d0, u1
- sbb d1, u2
- jmp L(bck)
-
-C Duplicated, just jumping back to a different address.
-L(fix_qh): C Unlikely update. u2 >= d1
- seta %dl
- cmp d0, u1
- setae %al
- orb %dl, %al C "orb" form to placate Sun tools
- je L(bck_qh)
- inc t1
- sub d0, u1
- sbb d1, u2
- jmp L(bck_qh)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/dive_1.asm b/gmp/mpn/x86_64/dive_1.asm
index 988bdab632..4889faccb5 100644
--- a/gmp/mpn/x86_64/dive_1.asm
+++ b/gmp/mpn/x86_64/dive_1.asm
@@ -1,44 +1,31 @@
dnl AMD64 mpn_divexact_1 -- mpn by limb exact division.
-dnl Copyright 2001, 2002, 2004-2006, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2001, 2002, 2004, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 10
-C AMD K10 10
-C Intel P4 33
-C Intel core2 13.25
-C Intel corei 14
-C Intel atom 42
-C VIA nano 43
+C K8,K9: 10
+C K10: 10
+C P4: 33
+C P6-15 (Core2):13.25
+C P6-28 (Atom): 42
C A quick adoption of the 32-bit K7 code.
@@ -49,66 +36,67 @@ C up rsi
C n rdx
C divisor rcx
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_divexact_1)
- FUNC_ENTRY(4)
- push %rbx
+ pushq %rbx
- mov %rcx, %rax
- xor R32(%rcx), R32(%rcx) C shift count
- mov %rdx, %r8
+ movq %rcx, %rax
+ movl $0, %ecx C shift count
+ movq %rdx, %r8
- bt $0, R32(%rax)
+ btl $0, %eax
jnc L(evn) C skip bsfq unless divisor is even
-L(odd): mov %rax, %rbx
- shr R32(%rax)
- and $127, R32(%rax) C d/2, 7 bits
+L(odd): movq %rax, %rbx
+ shrl %eax
+ andl $127, %eax C d/2, 7 bits
- LEA( binvert_limb_table, %rdx)
+ifdef(`PIC',`
+ movq binvert_limb_table@GOTPCREL(%rip), %rdx
+',`
+ movabsq $binvert_limb_table, %rdx
+')
- movzbl (%rdx,%rax), R32(%rax) C inv 8 bits
+ movzbl (%rax,%rdx), %eax C inv 8 bits
- mov %rbx, %r11 C d without twos
+ movq %rbx, %r11 C d without twos
- lea (%rax,%rax), R32(%rdx) C 2*inv
- imul R32(%rax), R32(%rax) C inv*inv
- imul R32(%rbx), R32(%rax) C inv*inv*d
- sub R32(%rax), R32(%rdx) C inv = 2*inv - inv*inv*d, 16 bits
+ leal (%rax,%rax), %edx C 2*inv
+ imull %eax, %eax C inv*inv
+ imull %ebx, %eax C inv*inv*d
+ subl %eax, %edx C inv = 2*inv - inv*inv*d, 16 bits
- lea (%rdx,%rdx), R32(%rax) C 2*inv
- imul R32(%rdx), R32(%rdx) C inv*inv
- imul R32(%rbx), R32(%rdx) C inv*inv*d
- sub R32(%rdx), R32(%rax) C inv = 2*inv - inv*inv*d, 32 bits
+ leal (%rdx,%rdx), %eax C 2*inv
+ imull %edx, %edx C inv*inv
+ imull %ebx, %edx C inv*inv*d
+ subl %edx, %eax C inv = 2*inv - inv*inv*d, 32 bits
- lea (%rax,%rax), %r10 C 2*inv
- imul %rax, %rax C inv*inv
- imul %rbx, %rax C inv*inv*d
- sub %rax, %r10 C inv = 2*inv - inv*inv*d, 64 bits
+ leaq (%rax,%rax), %rdx C 2*inv
+ imulq %rax, %rax C inv*inv
+ imulq %rbx, %rax C inv*inv*d
+ subq %rax, %rdx C inv = 2*inv - inv*inv*d, 64 bits
- lea (%rsi,%r8,8), %rsi C up end
- lea -8(%rdi,%r8,8), %rdi C rp end
- neg %r8 C -n
+ leaq (%rsi,%r8,8), %rsi C up end
+ leaq -8(%rdi,%r8,8), %rdi C rp end
+ negq %r8 C -n
- mov (%rsi,%r8,8), %rax C up[0]
+ movq %rdx, %r10 C final inverse
+ movq (%rsi,%r8,8), %rax C up[0]
- inc %r8
+ incq %r8
jz L(one)
- mov (%rsi,%r8,8), %rdx C up[1]
+ movq (%rsi,%r8,8), %rdx C up[1]
- shrd R8(%rcx), %rdx, %rax
+ shrdq %cl, %rdx, %rax
- xor R32(%rbx), R32(%rbx)
- jmp L(ent)
+ xorl %ebx, %ebx
+ jmp L(entry)
-L(evn): bsf %rax, %rcx
- shr R8(%rcx), %rax
+L(evn): bsfq %rax, %rcx
+ shrq %cl, %rax
jmp L(odd)
ALIGN(8)
@@ -120,39 +108,54 @@ L(top):
C rsi up end
C rdi rp end
C r8 counter, limbs, negative
- C r10 d^(-1) mod 2^64
- C r11 d, shifted down
-
- mul %r11 C carry limb in rdx 0 10
- mov -8(%rsi,%r8,8), %rax C
- mov (%rsi,%r8,8), %r9 C
- shrd R8(%rcx), %r9, %rax C
- nop C
- sub %rbx, %rax C apply carry bit
- setc %bl C
- sub %rdx, %rax C apply carry limb 5
- adc $0, %rbx C 6
-L(ent): imul %r10, %rax C 6
- mov %rax, (%rdi,%r8,8) C
- inc %r8 C
+
+ mulq %r11 C carry limb in rdx
+
+ movq -8(%rsi,%r8,8), %rax
+ movq (%rsi,%r8,8), %r9
+
+ shrdq %cl, %r9, %rax
+ nop
+
+ subq %rbx, %rax C apply carry bit
+ setc %bl
+
+ subq %rdx, %rax C apply carry limb
+ adcq $0, %rbx
+
+L(entry):
+ imulq %r10, %rax
+
+ movq %rax, (%rdi,%r8,8)
+ incq %r8
jnz L(top)
- mul %r11 C carry limb in rdx
- mov -8(%rsi), %rax C up high limb
- shr R8(%rcx), %rax
- sub %rbx, %rax C apply carry bit
- sub %rdx, %rax C apply carry limb
- imul %r10, %rax
- mov %rax, (%rdi)
- pop %rbx
- FUNC_EXIT()
+
+ mulq %r11 C carry limb in rdx
+
+ movq -8(%rsi), %rax C up high limb
+ shrq %cl, %rax
+
+ subq %rbx, %rax C apply carry bit
+
+ subq %rdx, %rax C apply carry limb
+
+ imulq %r10, %rax
+
+ movq %rax, (%rdi)
+
+ popq %rbx
ret
-L(one): shr R8(%rcx), %rax
- imul %r10, %rax
- mov %rax, (%rdi)
- pop %rbx
- FUNC_EXIT()
+
+L(one):
+ shrq %cl, %rax
+
+ imulq %r10, %rax
+
+ movq %rax, (%rdi)
+
+ popq %rbx
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/divrem_1.asm b/gmp/mpn/x86_64/divrem_1.asm
index 91928d9aa3..2f3e95a839 100644
--- a/gmp/mpn/x86_64/divrem_1.asm
+++ b/gmp/mpn/x86_64/divrem_1.asm
@@ -1,44 +1,42 @@
dnl x86-64 mpn_divrem_1 -- mpn by limb division.
-dnl Copyright 2004, 2005, 2007-2012 Free Software Foundation, Inc.
+dnl Copyright 2004, 2005, 2007, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 norm unorm frac
-C AMD K8,K9 13 13 12
-C AMD K10 13 13 12
-C Intel P4 43 44 43
-C Intel core2 24.5 24.5 19.5
-C Intel corei 20.5 19.5 18
-C Intel atom 43 46 36
-C VIA nano 25.5 25.5 24
+C K8 13 13 12
+C P4 44.2 44.2 42.3
+C P6-15 (Core2) 24.5 24.5 19.3
+C P6-15 (Atom) 42 52 37
+
+C TODO
+C * Compute the inverse without relying on the div instruction.
+C Newton's method and mulq, or perhaps the faster fdiv.
+C * Tune prologue.
+C * Optimize for Core 2.
+
+C The code for unnormalized divisors works also for normalized divisors, but
+C for some reason it runs really slowly (on K8) for that case. Use special
+C code until we can address this. The Intel Atom is also affected, but
+C understandably (shld slowness).
+define(`SPECIAL_CODE_FOR_NORMALIZED_DIVISOR',1)
C mp_limb_t
C mpn_divrem_1 (mp_ptr qp, mp_size_t fn,
@@ -67,20 +65,11 @@ define(`un', `%rbx')
C rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15
C cnt qp d dinv
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFSTD(`define(`CNTOFF', `40($1)')')
-IFDOS(`define(`CNTOFF', `104($1)')')
-
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_preinv_divrem_1)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
-IFDOS(` mov 64(%rsp), %r9 ')
- xor R32(%rax), R32(%rax)
+ xor %eax, %eax
push %r13
push %r12
push %rbp
@@ -95,17 +84,14 @@ IFDOS(` mov 64(%rsp), %r9 ')
test d, d
js L(nent)
-
- mov CNTOFF(%rsp), R8(cnt)
+ mov 40(%rsp), R8(cnt)
shl R8(cnt), d
jmp L(uent)
EPILOGUE()
ALIGN(16)
PROLOGUE(mpn_divrem_1)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- xor R32(%rax), R32(%rax)
+ xor %eax, %eax
push %r13
push %r12
push %rbp
@@ -120,6 +106,8 @@ IFDOS(` mov 56(%rsp), %r8 ')
lea -8(qp,un_param,8), qp
xor R32(%rbp), R32(%rbp)
+
+ifdef(`SPECIAL_CODE_FOR_NORMALIZED_DIVISOR',`
test d, d
jns L(unnormalized)
@@ -130,54 +118,50 @@ L(normalized):
dec un
mov %rbp, %rax
sub d, %rbp
- cmovc %rax, %rbp
- sbb R32(%rax), R32(%rax)
- inc R32(%rax)
+ cmovb %rax, %rbp
+ sbb %eax, %eax
+ inc %eax
mov %rax, (qp)
lea -8(qp), qp
L(8):
-IFSTD(` push %rdi ')
-IFSTD(` push %rsi ')
- push %r8
-IFSTD(` mov d, %rdi ')
-IFDOS(` mov d, %rcx ')
- CALL( mpn_invert_limb)
- pop %r8
-IFSTD(` pop %rsi ')
-IFSTD(` pop %rdi ')
-
+ mov d, %rdx
+ mov $-1, %rax
+ not %rdx
+ div d C FREE rax rdx rcx r9 r10 r11
mov %rax, dinv
mov %rbp, %rax
jmp L(nent)
ALIGN(16)
-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
- mov %rax, %rbp C 5 9 4 13
- mov %rdx, %r13 C 6 11 12 23
- imul d, %rdx C 6 11 11 23
- sub %rdx, %r10 C 10 16 14 33
+L(nloop): C cycK8 cycP6 cycP4
+ mov (up,un,8), %r10 C
+ lea 1(%rax), %rbp C
+ mul dinv C 0,13 0,19 0,45
+ add %r10, %rax C 4 8 12
+ adc %rbp, %rdx C 5 9 13
+ mov %rax, %rbp C 5 9 13
+ mov %rdx, %r13 C 6 11 23
+ imul d, %rdx C 6 11 23
+ sub %rdx, %r10 C 10 16 33
mov d, %rax C
- add %r10, %rax C 11 17 15 34
- cmp %rbp, %r10 C 11 17 15 34
- cmovc %r10, %rax C 12 18 16 35
+ add %r10, %rax C 11 17 34
+ cmp %rbp, %r10 C 11 17 34
+ cmovb %r10, %rax C 12 18 35
adc $-1, %r13 C
cmp d, %rax C
jae L(nfx) C
L(nok): mov %r13, (qp) C
sub $8, qp C
-L(nent):lea 1(%rax), %rbp C
- dec un C
- jns L(ntop) C
+L(nent):dec un C
+ jns L(nloop) C
- xor R32(%rcx), R32(%rcx)
+ xor %ecx, %ecx
jmp L(87)
L(nfx): sub d, %rax
inc %r13
jmp L(nok)
+')
L(unnormalized):
test un, un
@@ -192,42 +176,30 @@ L(unnormalized):
dec un
L(44):
bsr d, %rcx
- not R32(%rcx)
- shl R8(%rcx), d
- shl R8(%rcx), %rbp
-
- push %rcx
-IFSTD(` push %rdi ')
-IFSTD(` push %rsi ')
- push %r8
-IFSTD(` mov d, %rdi ')
-IFDOS(` mov d, %rcx ')
- CALL( mpn_invert_limb)
- pop %r8
-IFSTD(` pop %rsi ')
-IFSTD(` pop %rdi ')
- pop %rcx
-
+ not %ecx
+ sal %cl, d
+ sal %cl, %rbp
+ mov d, %rdx
+ mov $-1, %rax
+ not %rdx
+ div d C FREE rax rdx r9 r10 r11
+ test un, un
mov %rax, dinv
mov %rbp, %rax
- test un, un
je L(87)
-
-L(uent):dec un
- mov (up,un,8), %rbp
- neg R32(%rcx)
- shr R8(%rcx), %rbp
- neg R32(%rcx)
- or %rbp, %rax
- jmp L(ent)
+L(uent):
+ mov -8(up,un,8), %rbp
+ shr %cl, %rax
+ shld %cl, %rbp, %rax
+ sub $2, un
+ js L(ulast)
ALIGN(16)
-L(utop):mov (up,un,8), %r10
- shl R8(%rcx), %rbp
- neg R32(%rcx)
- shr R8(%rcx), %r10
- neg R32(%rcx)
- or %r10, %rbp
+L(uloop):
+ nop
+ mov (up,un,8), %r10
+ lea 1(%rax), %r11
+ shld %cl, %r10, %rbp
mul dinv
add %rbp, %rax
adc %r11, %rdx
@@ -238,18 +210,18 @@ L(utop):mov (up,un,8), %r10
mov d, %rax
add %rbp, %rax
cmp %r11, %rbp
- cmovc %rbp, %rax
+ cmovb %rbp, %rax
adc $-1, %r13
cmp d, %rax
jae L(ufx)
L(uok): mov %r13, (qp)
sub $8, qp
-L(ent): mov (up,un,8), %rbp
dec un
+ mov %r10, %rbp
+ jns L(uloop)
+L(ulast):
lea 1(%rax), %r11
- jns L(utop)
-
-L(uend):shl R8(%rcx), %rbp
+ sal %cl, %rbp
mul dinv
add %rbp, %rax
adc %r11, %rdx
@@ -260,47 +232,48 @@ L(uend):shl R8(%rcx), %rbp
mov d, %rax
add %rbp, %rax
cmp %r11, %rbp
- cmovc %rbp, %rax
+ cmovb %rbp, %rax
adc $-1, %r13
cmp d, %rax
- jae L(efx)
-L(eok): mov %r13, (qp)
+ jae L(93)
+L(69): mov %r13, (qp)
sub $8, qp
jmp L(87)
L(ufx): sub d, %rax
inc %r13
jmp L(uok)
-L(efx): sub d, %rax
+
+L(93): sub d, %rax
inc %r13
- jmp L(eok)
+ jmp L(69)
L(87): mov d, %rbp
neg %rbp
- jmp L(fent)
-
- ALIGN(16) C K8-K10 P6-CNR P6-NHM P4
-L(ftop):mul dinv C 0,12 0,17 0,17
- add %r11, %rdx C 5 8 10
- mov %rax, %r11 C 4 8 3
- mov %rdx, %r13 C 6 9 11
- imul %rbp, %rdx C 6 9 11
+ jmp L(87b)
+
+ ALIGN(16)
+L(floop): C cycK8 cycP6 cycP4
+ lea 1(%rax), %r11 C
+ mul dinv C 0,12
+ add %r11, %rdx C 5
+ mov %rax, %r11 C 4
+ mov %rdx, %r13 C 6
+ imul %rbp, %rdx C 6
mov d, %rax C
- add %rdx, %rax C 10 14 14
- cmp %r11, %rdx C 10 14 14
- cmovc %rdx, %rax C 11 15 15
+ add %rdx, %rax C 10
+ cmp %r11, %rdx C 10
+ cmovb %rdx, %rax C 11
adc $-1, %r13 C
mov %r13, (qp) C
sub $8, qp C
-L(fent):lea 1(%rax), %r11 C
- dec fn C
- jns L(ftop) C
+L(87b): dec fn C
+ jns L(floop) C
- shr R8(%rcx), %rax
+ shr %cl, %rax
L(ret): pop %rbx
pop %rbp
pop %r12
pop %r13
- FUNC_EXIT()
ret
-EPILOGUE()
+EPILOGUE(mpn_divrem_1)
diff --git a/gmp/mpn/x86_64/divrem_2.asm b/gmp/mpn/x86_64/divrem_2.asm
index 66c2da1a05..37053ba88d 100644
--- a/gmp/mpn/x86_64/divrem_2.asm
+++ b/gmp/mpn/x86_64/divrem_2.asm
@@ -1,52 +1,37 @@
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 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 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 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
+C norm frac
+C K8 20 20
+C P4 73 73
+C P6-15 37 37
+
+C TODO
+C * Perhaps compute the inverse without relying on divq? Could either use
+C Newton's method and mulq, or perhaps the faster fdiv.
+C * The loop has not been carefully tuned, nor analysed for critical path
+C length. It seems that 20 c/l is a bit long, compared to the 13 c/l for
+C mpn_divrem_1.
+C * Clean up. This code is really crude.
C INPUT PARAMETERS
@@ -56,117 +41,168 @@ define(`up_param', `%rdx')
define(`un_param', `%rcx')
define(`dp', `%r8')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+define(`dinv', `%r9')
+
+
+C rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15
+C cnt qp d dinv
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_divrem_2)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
+
push %r15
+ lea (%rdx,%rcx,8), %rax
push %r14
push %r13
- push %r12
- lea -24(%rdx,%rcx,8), %r12 C r12 = &up[un-1]
mov %rsi, %r13
+ push %r12
+ lea -24(%rax), %r12
push %rbp
mov %rdi, %rbp
push %rbx
- mov 8(%r8), %r11 C d1
- mov 16(%r12), %rbx
- mov (%r8), %r8 C d0
- mov 8(%r12), %r10
-
+ mov 8(%r8), %r11
+ mov -8(%rax), %r9
+ mov (%r8), %r8
+ mov -16(%rax), %r10
xor R32(%r15), R32(%r15)
- cmp %rbx, %r11
+ cmp %r9, %r11
ja L(2)
setb %dl
cmp %r10, %r8
setbe %al
- orb %al, %dl C "orb" form to placate Sun tools
- je L(2)
- inc R32(%r15)
- sub %r8, %r10
- sbb %r11, %rbx
+ or %al, %dl
+ jne L(23)
L(2):
- lea -3(%rcx,%r13), %r14 C un + fn - 3
- test %r14, %r14
- js L(end)
-
- push %r8
- push %r10
- push %r11
-IFSTD(` mov %r11, %rdi ')
-IFDOS(` mov %r11, %rcx ')
- CALL( mpn_invert_limb)
- pop %r11
- pop %r10
- pop %r8
-
+ lea -3(%rcx,%r13), %rbx C un + fn - 3
+ test %rbx, %rbx
+ js L(6)
+ mov %r11, %rdx
+ mov $-1, %rax
+ not %rdx
+ div %r11
mov %r11, %rdx
mov %rax, %rdi
imul %rax, %rdx
- mov %rdx, %r9
+ mov %rdx, %r14
mul %r8
- xor R32(%rcx), R32(%rcx)
- add %r8, %r9
- adc $-1, %rcx
- add %rdx, %r9
- adc $0, %rcx
- js 2f
-1: dec %rdi
- sub %r11, %r9
- sbb $0, %rcx
- jns 1b
-2:
-
- lea (%rbp,%r14,8), %rbp
+ mov %rdx, %rcx
+ mov $-1, %rdx
+ add %r8, %r14
+ adc $0, %rdx
+ add %rcx, %r14
+ adc $0, %rdx
+ js L(8)
+L(18):
+ dec %rdi
+ sub %r11, %r14
+ sbb $0, %rdx
+ jns L(18)
+L(8):
+
+C rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15
+C n2 un n1 dinv qp d0 d1 up fn msl
+C n2 un -d1 n1 dinv XX XX
+
+ifdef(`NEW',`
+ lea (%rbp,%rbx,8), %rbp
+ mov %rbx, %rcx C un
+ mov %r9, %rbx
+ mov %rdi, %r9 C di
+ mov %r10, %r14
mov %r11, %rsi
neg %rsi C -d1
-
-C rax rbx rcx rdx rsi rdi rbp r8 r9 r10 r11 r12 r13 r14 r15
-C n2 un -d1 dinv qp d0 q0 d1 up fn msl
-
ALIGN(16)
-L(top): mov %rdi, %rax C di ncp
- mul %rbx C 0, 17
- mov %r10, %rcx C
- add %rax, %rcx C 4
+L(loop):
+ mov %r9, %rax C di ncp
+ mul %rbx C 0, 18
+ add %r14, %rax C 4
+ mov %rax, %r10 C q0 5
adc %rbx, %rdx C 5
- mov %rdx, %r9 C q 6
+ mov %rdx, %rdi C q 6
imul %rsi, %rdx C 6
mov %r8, %rax C ncp
- lea (%rdx, %r10), %rbx C n1 -= ... 10
- xor R32(%r10), R32(%r10) C
- mul %r9 C 7
- cmp %r14, %r13 C
+ lea (%rdx, %r14), %rbx C n1 -= ... 7
+ mul %rdi C 7
+ xor R32(%r14), R32(%r14) C
+ cmp %rcx, %r13 C
jg L(19) C
- mov (%r12), %r10 C
+ mov (%r12), %r14 C
sub $8, %r12 C
-L(19): sub %r8, %r10 C ncp
- sbb %r11, %rbx C 11
- sub %rax, %r10 C 11
+L(19): sub %r8, %r14 C ncp
+ sbb %r11, %rbx C 9
+ sub %rax, %r14 C 11
sbb %rdx, %rbx C 12
- xor R32(%rax), R32(%rax) C
+ inc %rdi C 7
xor R32(%rdx), R32(%rdx) C
- cmp %rcx, %rbx C 13
- cmovnc %r8, %rax C 14
- cmovnc %r11, %rdx C 14
- adc $0, %r9 C adjust q 14
- nop
- add %rax, %r10 C 15
+ cmp %r10, %rbx C 13
+ mov %r8, %rax C d1 ncp
+ adc $-1, %rdx C mask 14
+ add %rdx, %rdi C q-- 15
+ and %rdx, %rax C d0 or 0 15
+ and %r11, %rdx C d1 or 0 15
+ add %rax, %r14 C 16
adc %rdx, %rbx C 16
- cmp %r11, %rbx C
+ cmp %r11, %rbx C 17
jae L(fix) C
-L(bck): mov %r9, (%rbp) C
+L(bck): mov %rdi, (%rbp) C
sub $8, %rbp C
- dec %r14
- jns L(top)
-
-L(end): mov %r10, 8(%r12)
- mov %rbx, 16(%r12)
+ dec %rcx
+ jns L(loop)
+
+ mov %r14, %r10
+ mov %rbx, %r9
+',`
+ lea (%rbp,%rbx,8), %rbp
+ mov %rbx, %rcx
+ mov %r9, %rax
+ mov %r10, %rsi
+ ALIGN(16)
+L(loop):
+ mov %rax, %r14 C 0, 19
+ mul %rdi C 0
+ mov %r11, %r9 C 1
+ add %rsi, %rax C 4
+ mov %rax, %rbx C q0 5
+ adc %r14, %rdx C q 5
+ lea 1(%rdx), %r10 C 6
+ mov %rdx, %rax C 6
+ imul %rdx, %r9 C 6
+ sub %r9, %rsi C 10
+ xor R32(%r9), R32(%r9) C
+ mul %r8 C 7
+ cmp %rcx, %r13 C
+ jg L(13) C
+ mov (%r12), %r9 C
+ sub $8, %r12 C
+L(13): sub %r8, %r9 C ncp
+ sbb %r11, %rsi C 11
+ sub %rax, %r9 C 11
+ sbb %rdx, %rsi C 12
+ cmp %rbx, %rsi C 13
+ sbb %rax, %rax C 14
+ not %rax C 15
+ add %rax, %r10 C 16
+ mov %r8, %rbx C ncp
+ and %rax, %rbx C 16
+ and %r11, %rax C 16
+ add %rbx, %r9 C 17
+ adc %rsi, %rax C 18
+ cmp %rax, %r11 C 19
+ jbe L(fix) C
+L(bck): mov %r10, (%rbp) C
+ sub $8, %rbp C
+ mov %r9, %rsi C 18
+ dec %rcx
+ jns L(loop)
+
+ mov %rsi, %r10
+ mov %rax, %r9
+')
+L(6):
+ mov %r10, 8(%r12)
+ mov %r9, 16(%r12)
pop %rbx
pop %rbp
pop %r12
@@ -174,16 +210,30 @@ L(end): mov %r10, 8(%r12)
pop %r14
mov %r15, %rax
pop %r15
- FUNC_EXIT()
ret
+L(23): inc R32(%r15)
+ sub %r8, %r10
+ sbb %r11, %r9
+ jmp L(2)
+
+ifdef(`NEW',`
L(fix): seta %dl
- cmp %r8, %r10
+ cmp %r8, %r14
setae %al
- orb %dl, %al C "orb" form to placate Sun tools
+ orb %dl, %al
je L(bck)
- inc %r9
- sub %r8, %r10
+ inc %rdi
+ sub %r8, %r14
sbb %r11, %rbx
jmp L(bck)
+',`
+L(fix): jb L(88)
+ cmp %r8, %r9
+ jb L(bck)
+L(88): inc %r10
+ sub %r8, %r9
+ sbb %r11, %rax
+ jmp L(bck)
+')
EPILOGUE()
diff --git a/gmp/mpn/x86_64/dos64.m4 b/gmp/mpn/x86_64/dos64.m4
deleted file mode 100644
index 9414623b56..0000000000
--- a/gmp/mpn/x86_64/dos64.m4
+++ /dev/null
@@ -1,100 +0,0 @@
-divert(-1)
-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/.
-
-define(`HOST_DOS64')
-
-
-dnl On DOS64 we always generate position-independent-code
-dnl
-
-define(`PIC')
-
-
-define(`LEA',`
- lea $1(%rip), $2
-')
-
-
-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')
-
-
-dnl Usage: JMPENT(targlabel,tablabel)
-
-define(`JMPENT', `.long $1-$2')
-
-
-dnl Usage: FUNC_ENTRY(nregparmas)
-dnl Usage: FUNC_EXIT()
-
-dnl FUNC_ENTRY and FUNC_EXIT provide an easy path for adoption of standard
-dnl ABI assembly to the DOS64 ABI.
-
-define(`FUNC_ENTRY',
- `push %rdi
- push %rsi
- mov %rcx, %rdi
-ifelse(eval($1>=2),1,`dnl
- mov %rdx, %rsi
-ifelse(eval($1>=3),1,`dnl
- mov %r8, %rdx
-ifelse(eval($1>=4),1,`dnl
- mov %r9, %rcx
-')')')')
-
-define(`FUNC_EXIT',
- `pop %rsi
- pop %rdi')
-
-
-dnl Target ABI macros. For DOS64 we override the defaults.
-
-define(`IFDOS', `$1')
-define(`IFSTD', `')
-define(`IFELF', `')
-
-
-dnl Usage: PROTECT(symbol)
-dnl
-dnl Used for private GMP symbols that should never be overridden by users.
-dnl This can save reloc entries and improve shlib sharing as well as
-dnl application startup times
-
-define(`PROTECT', `')
-
-
-divert`'dnl
diff --git a/gmp/mpn/x86_64/fastavx/copyd.asm b/gmp/mpn/x86_64/fastavx/copyd.asm
deleted file mode 100644
index 41c55de5ca..0000000000
--- a/gmp/mpn/x86_64/fastavx/copyd.asm
+++ /dev/null
@@ -1,171 +0,0 @@
-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/gmp/mpn/x86_64/fastavx/copyi.asm b/gmp/mpn/x86_64/fastavx/copyi.asm
deleted file mode 100644
index 97264ef837..0000000000
--- a/gmp/mpn/x86_64/fastavx/copyi.asm
+++ /dev/null
@@ -1,168 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/fastsse/README b/gmp/mpn/x86_64/fastsse/README
deleted file mode 100644
index 520551ed99..0000000000
--- a/gmp/mpn/x86_64/fastsse/README
+++ /dev/null
@@ -1,21 +0,0 @@
-This directory contains code for x86-64 processors with fast
-implementations of SSE operations, hence the name "fastsse".
-
-Current processors that might benefit from this code are:
-
- AMD K10
- AMD Bulldozer
- Intel Nocona
- Intel Nehalem/Westmere
- Intel Sandybridge/Ivybridge
- VIA Nano
-
-Current processors that do not benefit from this code are:
-
- AMD K8
- AMD Bobcat
- Intel Atom
-
-Intel Conroe/Penryn is a border case; its handling of non-aligned
-128-bit memory operands is poor. VIA Nano also have poor handling of
-non-aligned operands.
diff --git a/gmp/mpn/x86_64/fastsse/com-palignr.asm b/gmp/mpn/x86_64/fastsse/com-palignr.asm
deleted file mode 100644
index d9641e890d..0000000000
--- a/gmp/mpn/x86_64/fastsse/com-palignr.asm
+++ /dev/null
@@ -1,302 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/fastsse/com.asm b/gmp/mpn/x86_64/fastsse/com.asm
deleted file mode 100644
index 4abb076d3f..0000000000
--- a/gmp/mpn/x86_64/fastsse/com.asm
+++ /dev/null
@@ -1,161 +0,0 @@
-dnl AMD64 mpn_com optimised for CPUs with fast SSE.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 2.0 N
-C AMD K10 0.85 1.3 Y/N
-C AMD bd1 1.40 1.40 Y
-C AMD bobcat 3.1 3.1 N
-C Intel P4 2.28 illop Y
-C Intel core2 1.02 1.02 N
-C Intel NHM 0.53 0.68 Y
-C Intel SBR 0.51 0.75 Y
-C Intel atom 3.68 3.68 N
-C VIA nano 1.17 5.09 Y/N
-
-C We try to do as many 16-byte operations as possible. The top-most and
-C bottom-most writes might need 8-byte operations. We can always write using
-C aligned 16-byte operations, we read with both aligned and unaligned 16-byte
-C operations.
-
-C Instead of having separate loops for reading aligned and unaligned, we read
-C using MOVDQU. This seems to work great except for core2; there performance
-C doubles when reading using MOVDQA (for aligned source). It is unclear how to
-C best handle the unaligned case there.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_com)
- FUNC_ENTRY(3)
-
- test n, n
- jz L(don)
-
- pcmpeqb %xmm7, %xmm7 C set to 111...111
-
- test $8, R8(rp) C is rp 16-byte aligned?
- jz L(ali) C jump if rp aligned
- mov (up), %rax
- lea 8(up), up
- not %rax
- mov %rax, (rp)
- lea 8(rp), rp
- dec n
-
- sub $14, n
- jc L(sma)
-
- ALIGN(16)
-L(top): movdqu (up), %xmm0
- movdqu 16(up), %xmm1
- movdqu 32(up), %xmm2
- movdqu 48(up), %xmm3
- movdqu 64(up), %xmm4
- movdqu 80(up), %xmm5
- movdqu 96(up), %xmm6
- lea 112(up), up
- pxor %xmm7, %xmm0
- pxor %xmm7, %xmm1
- pxor %xmm7, %xmm2
- pxor %xmm7, %xmm3
- pxor %xmm7, %xmm4
- pxor %xmm7, %xmm5
- pxor %xmm7, %xmm6
- movdqa %xmm0, (rp)
- movdqa %xmm1, 16(rp)
- movdqa %xmm2, 32(rp)
- movdqa %xmm3, 48(rp)
- movdqa %xmm4, 64(rp)
- movdqa %xmm5, 80(rp)
- movdqa %xmm6, 96(rp)
- lea 112(rp), rp
-L(ali): sub $14, n
- jnc L(top)
-
-L(sma): add $14, n
- test $8, R8(n)
- jz 1f
- movdqu (up), %xmm0
- movdqu 16(up), %xmm1
- movdqu 32(up), %xmm2
- movdqu 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
-1:
- test $4, R8(n)
- jz 1f
- movdqu (up), %xmm0
- movdqu 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
- movdqu (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), %rax
- not %rax
- mov %rax, (rp)
-1:
-L(don): FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/copyd-palignr.asm b/gmp/mpn/x86_64/fastsse/copyd-palignr.asm
deleted file mode 100644
index 7430cadc09..0000000000
--- a/gmp/mpn/x86_64/fastsse/copyd-palignr.asm
+++ /dev/null
@@ -1,251 +0,0 @@
-dnl AMD64 mpn_copyd optimised for CPUs with fast SSE copying and SSSE3.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 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 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.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.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).
-C
-C For operands of < COPYD_SSE_THRESHOLD limbs, we use a plain 64-bit loop,
-C taken 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(`COPYD_SSE_THRESHOLD',`',`define(`COPYD_SSE_THRESHOLD', 7)')
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_copyd)
- FUNC_ENTRY(3)
-
- lea -8(up,n,8), up
- lea -8(rp,n,8), rp
-
- cmp $COPYD_SSE_THRESHOLD, n
- jbe L(bc)
-
- 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)
- lea -8(up), up
- lea -8(rp), rp
- dec n
-
-L(rp_aligned):
- test $8, R8(up)
- jz L(uent)
-
-ifelse(eval(COPYD_SSE_THRESHOLD >= 8),1,
-` sub $8, n',
-` jmp L(am)')
-
- ALIGN(16)
-L(atop):movdqa -8(up), %xmm0
- movdqa -24(up), %xmm1
- movdqa -40(up), %xmm2
- movdqa -56(up), %xmm3
- lea -64(up), up
- movdqa %xmm0, -8(rp)
- movdqa %xmm1, -24(rp)
- movdqa %xmm2, -40(rp)
- movdqa %xmm3, -56(rp)
- lea -64(rp), rp
-L(am): sub $8, n
- jnc L(atop)
-
- test $4, R8(n)
- jz 1f
- movdqa -8(up), %xmm0
- movdqa -24(up), %xmm1
- lea -32(up), up
- movdqa %xmm0, -8(rp)
- movdqa %xmm1, -24(rp)
- lea -32(rp), rp
-
-1: test $2, R8(n)
- jz 1f
- movdqa -8(up), %xmm0
- lea -16(up), up
- movdqa %xmm0, -8(rp)
- lea -16(rp), rp
-
-1: test $1, R8(n)
- jz 1f
- mov (up), %r8
- mov %r8, (rp)
-
-1: FUNC_EXIT()
- ret
-
-L(uent):sub $16, n
- movdqa (up), %xmm0
- jc L(uend)
-
- ALIGN(16)
-L(utop):sub $16, n
- movdqa -16(up), %xmm1
- palignr($8, %xmm1, %xmm0)
- movdqa %xmm0, -8(rp)
- movdqa -32(up), %xmm2
- palignr($8, %xmm2, %xmm1)
- movdqa %xmm1, -24(rp)
- movdqa -48(up), %xmm3
- palignr($8, %xmm3, %xmm2)
- movdqa %xmm2, -40(rp)
- movdqa -64(up), %xmm0
- palignr($8, %xmm0, %xmm3)
- movdqa %xmm3, -56(rp)
- movdqa -80(up), %xmm1
- palignr($8, %xmm1, %xmm0)
- movdqa %xmm0, -72(rp)
- movdqa -96(up), %xmm2
- palignr($8, %xmm2, %xmm1)
- movdqa %xmm1, -88(rp)
- movdqa -112(up), %xmm3
- palignr($8, %xmm3, %xmm2)
- movdqa %xmm2, -104(rp)
- movdqa -128(up), %xmm0
- palignr($8, %xmm0, %xmm3)
- movdqa %xmm3, -120(rp)
- lea -128(up), up
- lea -128(rp), rp
- jnc L(utop)
-
-L(uend):test $8, R8(n)
- jz 1f
- movdqa -16(up), %xmm1
- palignr($8, %xmm1, %xmm0)
- movdqa %xmm0, -8(rp)
- movdqa -32(up), %xmm0
- palignr($8, %xmm0, %xmm1)
- movdqa %xmm1, -24(rp)
- movdqa -48(up), %xmm1
- palignr($8, %xmm1, %xmm0)
- movdqa %xmm0, -40(rp)
- movdqa -64(up), %xmm0
- palignr($8, %xmm0, %xmm1)
- movdqa %xmm1, -56(rp)
- lea -64(up), up
- lea -64(rp), rp
-
-1: test $4, R8(n)
- jz 1f
- movdqa -16(up), %xmm1
- palignr($8, %xmm1, %xmm0)
- movdqa %xmm0, -8(rp)
- movdqa -32(up), %xmm0
- palignr($8, %xmm0, %xmm1)
- movdqa %xmm1, -24(rp)
- lea -32(up), up
- lea -32(rp), rp
-
-1: test $2, R8(n)
- jz 1f
- movdqa -16(up), %xmm1
- palignr($8, %xmm1, %xmm0)
- movdqa %xmm0, -8(rp)
- lea -16(up), up
- lea -16(rp), rp
-
-1: test $1, R8(n)
- jz 1f
- mov (up), %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): sub $4, R32(n)
- jc L(end)
-
- 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
- mov %r8, 32(rp)
- mov %r9, 24(rp)
-ifelse(eval(COPYD_SSE_THRESHOLD >= 8),1,
-` sub $4, R32(n)')
- mov %r10, 16(rp)
- mov %r11, 8(rp)
-ifelse(eval(COPYD_SSE_THRESHOLD >= 8),1,
-` jnc L(top)')
-
-L(end): test $1, R8(n)
- jz 1f
- mov (up), %r8
- mov %r8, (rp)
- lea -8(rp), rp
- lea -8(up), up
-1: test $2, R8(n)
- jz 1f
- mov (up), %r8
- mov -8(up), %r9
- mov %r8, (rp)
- mov %r9, -8(rp)
-1: FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/copyd.asm b/gmp/mpn/x86_64/fastsse/copyd.asm
deleted file mode 100644
index 5c6094c7e2..0000000000
--- a/gmp/mpn/x86_64/fastsse/copyd.asm
+++ /dev/null
@@ -1,145 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-C AMD K10 0.85 Y
-C AMD bd1 0.8 Y
-C AMD bobcat
-C Intel P4 2.28 Y
-C Intel core2 1
-C Intel NHM 0.5 Y
-C Intel SBR 0.5 Y
-C Intel atom
-C VIA nano 1.1 Y
-
-C We try to do as many 16-byte operations as possible. The top-most and
-C bottom-most writes might need 8-byte operations. We can always write using
-C aligned 16-byte operations, we read with both aligned and unaligned 16-byte
-C operations.
-
-C Instead of having separate loops for reading aligned and unaligned, we read
-C using MOVDQU. This seems to work great except for core2; there performance
-C doubles when reading using MOVDQA (for aligned source). It is unclear how to
-C best handle the unaligned case there.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_copyd)
- FUNC_ENTRY(3)
-
- test n, n
- jz L(don)
-
- lea -16(rp,n,8), rp
- lea -16(up,n,8), up
-
- test $8, R8(rp) C is rp 16-byte aligned?
- jz L(ali) C jump if rp aligned
- mov 8(up), %rax
- lea -8(up), up
- mov %rax, 8(rp)
- lea -8(rp), rp
- dec n
-
- sub $16, n
- jc L(sma)
-
- ALIGN(16)
-L(top): movdqu (up), %xmm0
- movdqu -16(up), %xmm1
- movdqu -32(up), %xmm2
- movdqu -48(up), %xmm3
- movdqu -64(up), %xmm4
- movdqu -80(up), %xmm5
- movdqu -96(up), %xmm6
- movdqu -112(up), %xmm7
- lea -128(up), up
- movdqa %xmm0, (rp)
- movdqa %xmm1, -16(rp)
- movdqa %xmm2, -32(rp)
- movdqa %xmm3, -48(rp)
- movdqa %xmm4, -64(rp)
- movdqa %xmm5, -80(rp)
- movdqa %xmm6, -96(rp)
- movdqa %xmm7, -112(rp)
- lea -128(rp), rp
-L(ali): sub $16, n
- jnc L(top)
-
-L(sma): test $8, R8(n)
- jz 1f
- movdqu (up), %xmm0
- movdqu -16(up), %xmm1
- movdqu -32(up), %xmm2
- movdqu -48(up), %xmm3
- lea -64(up), up
- movdqa %xmm0, (rp)
- movdqa %xmm1, -16(rp)
- movdqa %xmm2, -32(rp)
- movdqa %xmm3, -48(rp)
- lea -64(rp), rp
-1:
- test $4, R8(n)
- jz 1f
- movdqu (up), %xmm0
- movdqu -16(up), %xmm1
- lea -32(up), up
- movdqa %xmm0, (rp)
- movdqa %xmm1, -16(rp)
- lea -32(rp), rp
-1:
- test $2, R8(n)
- jz 1f
- movdqu (up), %xmm0
- lea -16(up), up
- movdqa %xmm0, (rp)
- lea -16(rp), rp
-1:
- test $1, R8(n)
- jz 1f
- mov 8(up), %r8
- mov %r8, 8(rp)
-1:
-L(don): FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/copyi-palignr.asm b/gmp/mpn/x86_64/fastsse/copyi-palignr.asm
deleted file mode 100644
index fda3c3500f..0000000000
--- a/gmp/mpn/x86_64/fastsse/copyi-palignr.asm
+++ /dev/null
@@ -1,295 +0,0 @@
-dnl AMD64 mpn_copyi optimised for CPUs with fast SSE copying and SSSE3.
-
-dnl Copyright 2012, 2013 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
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 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 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
-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 < COPYI_SSE_THRESHOLD limbs, we use a plain 64-bit loop,
-C taken 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.
-dnl define(`movdqa', ``movaps'')
-
-ifdef(`COPYI_SSE_THRESHOLD',`',`define(`COPYI_SSE_THRESHOLD', 7)')
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_copyi)
- FUNC_ENTRY(3)
-
- cmp $COPYI_SSE_THRESHOLD, n
- jbe L(bc)
-
- test $8, R8(rp) C is rp 16-byte aligned?
- jz L(rp_aligned) C jump if rp aligned
-
- movsq C copy one limb
- dec n
-
-L(rp_aligned):
- test $8, R8(up)
- jnz L(uent)
-
-ifelse(eval(COPYI_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
- 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
- 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
- movdqa %xmm0, (rp)
- lea 16(rp), rp
-
-1: test $1, R8(n)
- jz 1f
- mov (up), %r8
- mov %r8, (rp)
-
-1: FUNC_EXIT()
- ret
-
-L(uent):
-C Code handling up - rp = 8 (mod 16)
-
- cmp $16, n
- jc L(ued0)
-
-IFDOS(` add $-56, %rsp ')
-IFDOS(` movdqa %xmm6, (%rsp) ')
-IFDOS(` movdqa %xmm7, 16(%rsp) ')
-IFDOS(` movdqa %xmm8, 32(%rsp) ')
-
- 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):movaps -104(up), %xmm1
- sub $16, n
- 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)
- movaps 72(up), %xmm4
- movdqa %xmm3, 48(rp)
- palignr($8, %xmm1, %xmm2)
- movaps 56(up), %xmm3
- movdqa %xmm2, 32(rp)
- palignr($8, %xmm0, %xmm1)
- movaps 40(up), %xmm2
- movdqa %xmm1, 16(rp)
- palignr($8, %xmm8, %xmm0)
- lea 128(up), up
- movdqa %xmm0, (rp)
- lea 128(rp), rp
- jnc L(utop)
-
-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
-
-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 %xmm3, 48(rp)
- palignr($8, %xmm1, %xmm2)
- movdqa %xmm2, 32(rp)
- palignr($8, %xmm0, %xmm1)
- movdqa %xmm1, 16(rp)
- palignr($8, %xmm4, %xmm0)
- lea 64(up), up
- movdqa %xmm0, (rp)
- lea 64(rp), rp
-
-1: test $4, R8(n)
- jz 1f
- movaps 24(up), %xmm1
- movaps 8(up), %xmm0
- palignr($8, %xmm0, %xmm1)
- movaps -8(up), %xmm3
- movdqa %xmm1, 16(rp)
- palignr($8, %xmm3, %xmm0)
- lea 32(up), up
- 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
- movdqa %xmm0, (rp)
- lea 16(rp), rp
-
-1: test $1, R8(n)
- jz 1f
- mov (up), %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)
-
- 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
- mov %r8, -24(rp)
- mov %r9, -16(rp)
-ifelse(eval(COPYI_SSE_THRESHOLD >= 8),1,
-` sub $4, R32(n)')
- mov %r10, -8(rp)
- mov %r11, (rp)
-ifelse(eval(COPYI_SSE_THRESHOLD >= 8),1,
-` jnc L(top)')
-
-L(end): test $1, R8(n)
- jz 1f
- mov (up), %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
- mov %r8, 8(rp)
- mov %r9, 16(rp)
-1: FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/copyi.asm b/gmp/mpn/x86_64/fastsse/copyi.asm
deleted file mode 100644
index a1a1c231dc..0000000000
--- a/gmp/mpn/x86_64/fastsse/copyi.asm
+++ /dev/null
@@ -1,166 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-C AMD K10 0.85 1.64 Y/N
-C AMD bd1 1.4 1.4 Y
-C AMD bobcat
-C Intel P4 2.3 2.3 Y
-C Intel core2 1.0 1.0
-C Intel NHM 0.5 0.67 Y
-C Intel SBR 0.5 0.75 Y
-C Intel atom
-C VIA nano 1.16 5.16 Y/N
-
-C We try to do as many 16-byte operations as possible. The top-most and
-C bottom-most writes might need 8-byte operations. We can always write using
-C aligned 16-byte operations, we read with both aligned and unaligned 16-byte
-C operations.
-
-C Instead of having separate loops for reading aligned and unaligned, we read
-C using MOVDQU. This seems to work great except for core2; there performance
-C doubles when reading using MOVDQA (for aligned source). It is unclear how to
-C best handle the unaligned case there.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-dnl define(`movdqu', lddqu)
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_copyi)
- FUNC_ENTRY(3)
-
- cmp $3, n
- jc L(bc)
-
- test $8, R8(rp) C is rp 16-byte aligned?
- jz L(ali) C jump if rp aligned
- movsq C copy single limb
- dec n
-
- sub $16, n
- jc L(sma)
-
- ALIGN(16)
-L(top): movdqu (up), %xmm0
- movdqu 16(up), %xmm1
- movdqu 32(up), %xmm2
- movdqu 48(up), %xmm3
- movdqu 64(up), %xmm4
- movdqu 80(up), %xmm5
- movdqu 96(up), %xmm6
- movdqu 112(up), %xmm7
- lea 128(up), up
- movdqa %xmm0, (rp)
- movdqa %xmm1, 16(rp)
- movdqa %xmm2, 32(rp)
- movdqa %xmm3, 48(rp)
- movdqa %xmm4, 64(rp)
- movdqa %xmm5, 80(rp)
- movdqa %xmm6, 96(rp)
- movdqa %xmm7, 112(rp)
- lea 128(rp), rp
-L(ali): sub $16, n
- jnc L(top)
-
-L(sma): test $8, R8(n)
- jz 1f
- movdqu (up), %xmm0
- movdqu 16(up), %xmm1
- movdqu 32(up), %xmm2
- movdqu 48(up), %xmm3
- lea 64(up), up
- movdqa %xmm0, (rp)
- movdqa %xmm1, 16(rp)
- movdqa %xmm2, 32(rp)
- movdqa %xmm3, 48(rp)
- lea 64(rp), rp
-1:
- test $4, R8(n)
- jz 1f
- movdqu (up), %xmm0
- movdqu 16(up), %xmm1
- lea 32(up), up
- movdqa %xmm0, (rp)
- movdqa %xmm1, 16(rp)
- lea 32(rp), rp
-1:
- test $2, R8(n)
- jz 1f
- movdqu (up), %xmm0
- lea 16(up), up
- movdqa %xmm0, (rp)
- lea 16(rp), rp
- ALIGN(16)
-1:
-L(end): test $1, R8(n)
- jz 1f
- mov (up), %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): sub $2, n
- jc L(end)
- ALIGN(16)
-1: mov (up), %rax
- mov 8(up), %rcx
- lea 16(up), up
- mov %rax, (rp)
- mov %rcx, 8(rp)
- lea 16(rp), rp
- sub $2, n
- jnc 1b
-
- test $1, R8(n)
- jz L(ret)
- mov (up), %rax
- mov %rax, (rp)
-L(ret): FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/lshift-movdqu2.asm b/gmp/mpn/x86_64/fastsse/lshift-movdqu2.asm
deleted file mode 100644
index a05e850a1f..0000000000
--- a/gmp/mpn/x86_64/fastsse/lshift-movdqu2.asm
+++ /dev/null
@@ -1,182 +0,0 @@
-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-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 cycles/limb good
-C aligned unaligned best seen for cpu?
-C AMD K8,K9 3 3 2.35 no, use shl/shr
-C AMD K10 1.5-1.8 1.5-1.8 1.33 yes
-C AMD bd1 1.7-1.9 1.7-1.9 1.33 yes
-C AMD bobcat 3.17 3.17 yes, bad for n < 20
-C Intel P4 4.67 4.67 2.7 no, slow movdqu
-C Intel core2 2.15 2.15 1.25 no, use shld/shrd
-C Intel NHM 1.66 1.66 1.25 no, use shld/shrd
-C Intel SBR 1.3 1.3 1.25 yes, bad for n = 4-6
-C Intel atom 11.7 11.7 4.5 no
-C VIA nano 5.7 5.95 2.0 no, slow movdqu
-
-C We try to do as many aligned 16-byte operations as possible. The top-most
-C and bottom-most writes might need 8-byte operations.
-C
-C This variant rely on fast load movdqu, and uses it even for aligned operands,
-C in order to avoid the need for two separate loops.
-C
-C TODO
-C * Could 2-limb wind-down code be simplified?
-C * Improve basecase code, using shld/shrd for SBR, discrete integer shifts
-C for other affected CPUs.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`ap', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_lshift)
- FUNC_ENTRY(4)
- movd R32(%rcx), %xmm4
- mov $64, R32(%rax)
- sub R32(%rcx), R32(%rax)
- movd R32(%rax), %xmm5
-
- neg R32(%rcx)
- mov -8(ap,n,8), %rax
- shr R8(%rcx), %rax
-
- cmp $3, n
- jle L(bc)
-
- lea (rp,n,8), R32(%rcx)
- test $8, R8(%rcx)
- jz L(rp_aligned)
-
-C Do one initial limb in order to make rp aligned
- movq -8(ap,n,8), %xmm0
- movq -16(ap,n,8), %xmm1
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movq %xmm0, -8(rp,n,8)
- dec n
-
-L(rp_aligned):
- lea 1(n), %r8d
-
- and $6, R32(%r8)
- jz L(ba0)
- cmp $4, R32(%r8)
- jz L(ba4)
- jc L(ba2)
-L(ba6): add $-4, n
- jmp L(i56)
-L(ba0): add $-6, n
- jmp L(i70)
-L(ba4): add $-2, n
- jmp L(i34)
-L(ba2): add $-8, n
- jle L(end)
-
- ALIGN(16)
-L(top): movdqu 40(ap,n,8), %xmm1
- movdqu 48(ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, 48(rp,n,8)
-L(i70):
- movdqu 24(ap,n,8), %xmm1
- movdqu 32(ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, 32(rp,n,8)
-L(i56):
- movdqu 8(ap,n,8), %xmm1
- movdqu 16(ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, 16(rp,n,8)
-L(i34):
- movdqu -8(ap,n,8), %xmm1
- movdqu (ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, (rp,n,8)
- sub $8, n
- jg L(top)
-
-L(end): test $1, R8(n)
- jnz L(end8)
-
- movdqu (ap), %xmm1
- pxor %xmm0, %xmm0
- punpcklqdq %xmm1, %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- movdqa %xmm0, (rp)
- FUNC_EXIT()
- ret
-
-C Basecase
- ALIGN(16)
-L(bc): dec R32(n)
- jz L(end8)
-
- movq (ap,n,8), %xmm1
- movq -8(ap,n,8), %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- movq %xmm0, (rp,n,8)
- sub $2, R32(n)
- jl L(end8)
- movq 8(ap), %xmm1
- movq (ap), %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- movq %xmm0, 8(rp)
-
-L(end8):movq (ap), %xmm0
- psllq %xmm4, %xmm0
- movq %xmm0, (rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/lshift.asm b/gmp/mpn/x86_64/fastsse/lshift.asm
deleted file mode 100644
index f76972a22f..0000000000
--- a/gmp/mpn/x86_64/fastsse/lshift.asm
+++ /dev/null
@@ -1,169 +0,0 @@
-dnl AMD64 mpn_lshift optimised for CPUs with fast SSE.
-
-dnl Contributed to the GNU project by David Harvey and Torbjorn Granlund.
-
-dnl Copyright 2010-2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 good
-C 16-byte aligned 16-byte unaligned for cpu?
-C AMD K8,K9 ? ?
-C AMD K10 1.68 (1.45) 1.75 (1.49) Y
-C AMD bd1 1.82 (1.75) 1.82 (1.75) Y
-C AMD bobcat 4 4
-C Intel P4 3 (2.7) 3 (2.7) Y
-C Intel core2 2.05 (1.67) 2.55 (1.75)
-C Intel NHM 2.05 (1.75) 2.09 (2)
-C Intel SBR 1.5 (1.3125) 1.5 (1.4375) Y
-C Intel atom ? ?
-C VIA nano 2.25 (2) 2.5 (2) Y
-
-C We try to do as many 16-byte operations as possible. The top-most and
-C bottom-most writes might need 8-byte operations.
-
-C There are two inner-loops, one for when rp = ap (mod 16) and one when this is
-C not true. The aligned case reads 16+8 bytes, the unaligned case reads
-C 16+8+X bytes, where X is 8 or 16 depending on how punpcklqdq is implemented.
-
-C This is not yet great code:
-C (1) The unaligned case makes many reads.
-C (2) We should do some unrolling, at least 2-way.
-C With 2-way unrolling but no scheduling we reach 1.5 c/l on K10 and 2 c/l on
-C Nano.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`ap', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_lshift)
- movd R32(%rcx), %xmm4
- mov $64, R32(%rax)
- sub R32(%rcx), R32(%rax)
- movd R32(%rax), %xmm5
-
- neg R32(%rcx)
- mov -8(ap,n,8), %rax
- shr R8(%rcx), %rax
-
- cmp $2, n
- jle L(le2)
-
- lea (rp,n,8), R32(%rcx)
- test $8, R8(%rcx)
- je L(rp_aligned)
-
-C Do one initial limb in order to make rp aligned
- movq -8(ap,n,8), %xmm0
- movq -16(ap,n,8), %xmm1
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movq %xmm0, -8(rp,n,8)
- dec n
-
-L(rp_aligned):
- lea (ap,n,8), R32(%rcx)
- test $8, R8(%rcx)
- je L(aent)
- jmp L(uent)
-C *****************************************************************************
-
-C Handle the case when ap != rp (mod 16).
-
- ALIGN(16)
-L(utop):movdqa -8(ap,n,8), %xmm0
- movq (ap,n,8), %xmm1
- punpcklqdq 8(ap,n,8), %xmm1
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- movdqa %xmm0, (rp,n,8)
-L(uent):sub $2, n
- ja L(utop)
-
- jne L(end8)
-
- movq (ap), %xmm1
- pxor %xmm0, %xmm0
- punpcklqdq %xmm1, %xmm0
- punpcklqdq 8(ap), %xmm1
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- movdqa %xmm0, (rp)
- ret
-C *****************************************************************************
-
-C Handle the case when ap = rp (mod 16).
-
- ALIGN(16)
-L(atop):movdqa (ap,n,8), %xmm0 C xmm0 = B*ap[n-1] + ap[n-2]
- movq -8(ap,n,8), %xmm1 C xmm1 = ap[n-3]
- punpcklqdq %xmm0, %xmm1 C xmm1 = B*ap[n-2] + ap[n-3]
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, (rp,n,8)
-L(aent):
- sub $2, n
- ja L(atop)
- jne L(end8)
-
- movdqa (ap), %xmm1
- pxor %xmm0, %xmm0
- punpcklqdq %xmm1, %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- movdqa %xmm0, (rp)
- ret
-C *****************************************************************************
-
- ALIGN(16)
-L(le2): jne L(end8)
-
- movq 8(ap), %xmm0
- movq (ap), %xmm1
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- movq %xmm0, 8(rp)
-
-L(end8):movq (ap), %xmm0
- psllq %xmm4, %xmm0
- movq %xmm0, (rp)
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/lshiftc-movdqu2.asm b/gmp/mpn/x86_64/fastsse/lshiftc-movdqu2.asm
deleted file mode 100644
index 8250910c52..0000000000
--- a/gmp/mpn/x86_64/fastsse/lshiftc-movdqu2.asm
+++ /dev/null
@@ -1,193 +0,0 @@
-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-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 cycles/limb good
-C aligned unaligned best seen for cpu?
-C AMD K8,K9 3 3 ? no, use shl/shr
-C AMD K10 1.8-2.0 1.8-2.0 ? yes
-C AMD bd1 1.9 1.9 ? yes
-C AMD bobcat 3.67 3.67 yes, bad for n < 20
-C Intel P4 4.75 4.75 ? no, slow movdqu
-C Intel core2 2.27 2.27 ? no, use shld/shrd
-C Intel NHM 2.15 2.15 ? no, use shld/shrd
-C Intel SBR 1.45 1.45 ? yes, bad for n = 4-6
-C Intel atom 12.9 12.9 ? no
-C VIA nano 6.18 6.44 ? no, slow movdqu
-
-C We try to do as many aligned 16-byte operations as possible. The top-most
-C and bottom-most writes might need 8-byte operations.
-C
-C This variant rely on fast load movdqu, and uses it even for aligned operands,
-C in order to avoid the need for two separate loops.
-C
-C TODO
-C * Could 2-limb wind-down code be simplified?
-C * Improve basecase code, using shld/shrd for SBR, discrete integer shifts
-C for other affected CPUs.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`ap', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_lshiftc)
- FUNC_ENTRY(4)
- movd R32(%rcx), %xmm4
- mov $64, R32(%rax)
- sub R32(%rcx), R32(%rax)
- movd R32(%rax), %xmm5
-
- neg R32(%rcx)
- mov -8(ap,n,8), %rax
- shr R8(%rcx), %rax
-
- pcmpeqb %xmm3, %xmm3 C set to 111...111
-
- cmp $3, n
- jle L(bc)
-
- lea (rp,n,8), R32(%rcx)
- test $8, R8(%rcx)
- jz L(rp_aligned)
-
-C Do one initial limb in order to make rp aligned
- movq -8(ap,n,8), %xmm0
- movq -16(ap,n,8), %xmm1
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movq %xmm0, -8(rp,n,8)
- dec n
-
-L(rp_aligned):
- lea 1(n), %r8d
-
- and $6, R32(%r8)
- jz L(ba0)
- cmp $4, R32(%r8)
- jz L(ba4)
- jc L(ba2)
-L(ba6): add $-4, n
- jmp L(i56)
-L(ba0): add $-6, n
- jmp L(i70)
-L(ba4): add $-2, n
- jmp L(i34)
-L(ba2): add $-8, n
- jle L(end)
-
- ALIGN(16)
-L(top): movdqu 40(ap,n,8), %xmm1
- movdqu 48(ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movdqa %xmm0, 48(rp,n,8)
-L(i70):
- movdqu 24(ap,n,8), %xmm1
- movdqu 32(ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movdqa %xmm0, 32(rp,n,8)
-L(i56):
- movdqu 8(ap,n,8), %xmm1
- movdqu 16(ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movdqa %xmm0, 16(rp,n,8)
-L(i34):
- movdqu -8(ap,n,8), %xmm1
- movdqu (ap,n,8), %xmm0
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movdqa %xmm0, (rp,n,8)
- sub $8, n
- jg L(top)
-
-L(end): test $1, R8(n)
- jnz L(end8)
-
- movdqu (ap), %xmm1
- pxor %xmm0, %xmm0
- punpcklqdq %xmm1, %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movdqa %xmm0, (rp)
- FUNC_EXIT()
- ret
-
-C Basecase
- ALIGN(16)
-L(bc): dec R32(n)
- jz L(end8)
-
- movq (ap,n,8), %xmm1
- movq -8(ap,n,8), %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movq %xmm0, (rp,n,8)
- sub $2, R32(n)
- jl L(end8)
- movq 8(ap), %xmm1
- movq (ap), %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- pxor %xmm3, %xmm0
- movq %xmm0, 8(rp)
-
-L(end8):movq (ap), %xmm0
- psllq %xmm4, %xmm0
- pxor %xmm3, %xmm0
- movq %xmm0, (rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/lshiftc.asm b/gmp/mpn/x86_64/fastsse/lshiftc.asm
deleted file mode 100644
index d2520690e2..0000000000
--- a/gmp/mpn/x86_64/fastsse/lshiftc.asm
+++ /dev/null
@@ -1,179 +0,0 @@
-dnl AMD64 mpn_lshiftc optimised for CPUs with fast SSE.
-
-dnl Contributed to the GNU project by David Harvey and Torbjorn Granlund.
-
-dnl Copyright 2010-2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 good
-C 16-byte aligned 16-byte unaligned for cpu?
-C AMD K8,K9 ? ?
-C AMD K10 1.85 (1.635) 1.9 (1.67) Y
-C AMD bd1 1.82 (1.75) 1.82 (1.75) Y
-C AMD bobcat 4.5 4.5
-C Intel P4 3.6 (3.125) 3.6 (3.125) Y
-C Intel core2 2.05 (1.67) 2.55 (1.75)
-C Intel NHM 2.05 (1.875) 2.6 (2.25)
-C Intel SBR 1.55 (1.44) 2 (1.57) Y
-C Intel atom ? ?
-C VIA nano 2.5 (2.5) 2.5 (2.5) Y
-
-C We try to do as many 16-byte operations as possible. The top-most and
-C bottom-most writes might need 8-byte operations. We always write using
-C 16-byte operations, we read with both 8-byte and 16-byte operations.
-
-C There are two inner-loops, one for when rp = ap (mod 16) and one when this is
-C not true. The aligned case reads 16+8 bytes, the unaligned case reads
-C 16+8+X bytes, where X is 8 or 16 depending on how punpcklqdq is implemented.
-
-C This is not yet great code:
-C (1) The unaligned case makes too many reads.
-C (2) We should do some unrolling, at least 2-way.
-C With 2-way unrolling but no scheduling we reach 1.5 c/l on K10 and 2 c/l on
-C Nano.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`ap', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_lshiftc)
- movd R32(%rcx), %xmm4
- mov $64, R32(%rax)
- sub R32(%rcx), R32(%rax)
- movd R32(%rax), %xmm5
-
- neg R32(%rcx)
- mov -8(ap,n,8), %rax
- shr R8(%rcx), %rax
-
- pcmpeqb %xmm7, %xmm7 C set to 111...111
-
- cmp $2, n
- jle L(le2)
-
- lea (rp,n,8), R32(%rcx)
- test $8, R8(%rcx)
- je L(rp_aligned)
-
-C Do one initial limb in order to make rp aligned
- movq -8(ap,n,8), %xmm0
- movq -16(ap,n,8), %xmm1
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm7, %xmm0
- movq %xmm0, -8(rp,n,8)
- dec n
-
-L(rp_aligned):
- lea (ap,n,8), R32(%rcx)
- test $8, R8(%rcx)
- je L(aent)
- jmp L(uent)
-C *****************************************************************************
-
-C Handle the case when ap != rp (mod 16).
-
- ALIGN(16)
-L(utop):movq (ap,n,8), %xmm1
- punpcklqdq 8(ap,n,8), %xmm1
- movdqa -8(ap,n,8), %xmm0
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- pxor %xmm7, %xmm0
- movdqa %xmm0, (rp,n,8)
-L(uent):sub $2, n
- ja L(utop)
-
- jne L(end8)
-
- movq (ap), %xmm1
- pxor %xmm0, %xmm0
- punpcklqdq %xmm1, %xmm0
- punpcklqdq 8(ap), %xmm1
- psllq %xmm4, %xmm1
- psrlq %xmm5, %xmm0
- por %xmm1, %xmm0
- pxor %xmm7, %xmm0
- movdqa %xmm0, (rp)
- ret
-C *****************************************************************************
-
-C Handle the case when ap = rp (mod 16).
-
- ALIGN(16)
-L(atop):movdqa (ap,n,8), %xmm0 C xmm0 = B*ap[n-1] + ap[n-2]
- movq -8(ap,n,8), %xmm1 C xmm1 = ap[n-3]
- punpcklqdq %xmm0, %xmm1 C xmm1 = B*ap[n-2] + ap[n-3]
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm7, %xmm0
- movdqa %xmm0, (rp,n,8)
-L(aent):sub $2, n
- ja L(atop)
-
- jne L(end8)
-
- movdqa (ap), %xmm0
- pxor %xmm1, %xmm1
- punpcklqdq %xmm0, %xmm1
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm7, %xmm0
- movdqa %xmm0, (rp)
- ret
-C *****************************************************************************
-
- ALIGN(16)
-L(le2): jne L(end8)
-
- movq 8(ap), %xmm0
- movq (ap), %xmm1
- psllq %xmm4, %xmm0
- psrlq %xmm5, %xmm1
- por %xmm1, %xmm0
- pxor %xmm7, %xmm0
- movq %xmm0, 8(rp)
-
-L(end8):movq (ap), %xmm0
- psllq %xmm4, %xmm0
- pxor %xmm7, %xmm0
- movq %xmm0, (rp)
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/rshift-movdqu2.asm b/gmp/mpn/x86_64/fastsse/rshift-movdqu2.asm
deleted file mode 100644
index 1e270b13c3..0000000000
--- a/gmp/mpn/x86_64/fastsse/rshift-movdqu2.asm
+++ /dev/null
@@ -1,201 +0,0 @@
-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-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 cycles/limb good
-C aligned unaligned best seen for cpu?
-C AMD K8,K9 3 3 2.35 no, use shl/shr
-C AMD K10 1.5-1.8 1.5-1.8 1.33 yes
-C AMD bd1 1.7-1.9 1.7-1.9 1.33 yes
-C AMD bobcat 3.17 3.17 yes, bad for n < 20
-C Intel P4 4.67 4.67 2.7 no, slow movdqu
-C Intel core2 2.15 2.15 1.25 no, use shld/shrd
-C Intel NHM 1.66 1.66 1.25 no, use shld/shrd
-C Intel SBR 1.3 1.3 1.25 yes, bad for n = 4-6
-C Intel atom 11.7 11.7 4.5 no
-C VIA nano 5.7 5.95 2.0 no, slow movdqu
-
-C We try to do as many aligned 16-byte operations as possible. The top-most
-C and bottom-most writes might need 8-byte operations.
-C
-C This variant rely on fast load movdqu, and uses it even for aligned operands,
-C in order to avoid the need for two separate loops.
-C
-C TODO
-C * Could 2-limb wind-down code be simplified?
-C * Improve basecase code, using shld/shrd for SBR, discrete integer shifts
-C for other affected CPUs.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`ap', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ASM_START()
- TEXT
- ALIGN(64)
-PROLOGUE(mpn_rshift)
- FUNC_ENTRY(4)
- movd R32(%rcx), %xmm4
- mov $64, R32(%rax)
- sub R32(%rcx), R32(%rax)
- movd R32(%rax), %xmm5
-
- neg R32(%rcx)
- mov (ap), %rax
- shl R8(%rcx), %rax
-
- cmp $3, n
- jle L(bc)
-
- test $8, R8(rp)
- jz L(rp_aligned)
-
-C Do one initial limb in order to make rp aligned
- movq (ap), %xmm0
- movq 8(ap), %xmm1
- psrlq %xmm4, %xmm0
- psllq %xmm5, %xmm1
- por %xmm1, %xmm0
- movq %xmm0, (rp)
- lea 8(ap), ap
- lea 8(rp), rp
- dec n
-
-L(rp_aligned):
- lea 1(n), %r8d
- lea (ap,n,8), ap
- lea (rp,n,8), rp
- neg n
-
- and $6, R32(%r8)
- jz L(bu0)
- cmp $4, R32(%r8)
- jz L(bu4)
- jc L(bu2)
-L(bu6): add $4, n
- jmp L(i56)
-L(bu0): add $6, n
- jmp L(i70)
-L(bu4): add $2, n
- jmp L(i34)
-L(bu2): add $8, n
- jge L(end)
-
- ALIGN(16)
-L(top): movdqu -64(ap,n,8), %xmm1
- movdqu -56(ap,n,8), %xmm0
- psllq %xmm5, %xmm0
- psrlq %xmm4, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, -64(rp,n,8)
-L(i70):
- movdqu -48(ap,n,8), %xmm1
- movdqu -40(ap,n,8), %xmm0
- psllq %xmm5, %xmm0
- psrlq %xmm4, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, -48(rp,n,8)
-L(i56):
- movdqu -32(ap,n,8), %xmm1
- movdqu -24(ap,n,8), %xmm0
- psllq %xmm5, %xmm0
- psrlq %xmm4, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, -32(rp,n,8)
-L(i34):
- movdqu -16(ap,n,8), %xmm1
- movdqu -8(ap,n,8), %xmm0
- psllq %xmm5, %xmm0
- psrlq %xmm4, %xmm1
- por %xmm1, %xmm0
- movdqa %xmm0, -16(rp,n,8)
- add $8, n
- jl L(top)
-
-L(end): test $1, R8(n)
- jnz L(e1)
-
- movdqu -16(ap), %xmm1
- movq -8(ap), %xmm0
- psrlq %xmm4, %xmm1
- psllq %xmm5, %xmm0
- por %xmm1, %xmm0
- movdqa %xmm0, -16(rp)
- FUNC_EXIT()
- ret
-
-L(e1): movq -8(ap), %xmm0
- psrlq %xmm4, %xmm0
- movq %xmm0, -8(rp)
- FUNC_EXIT()
- ret
-
-C Basecase
- ALIGN(16)
-L(bc): dec R32(n)
- jnz 1f
- movq (ap), %xmm0
- psrlq %xmm4, %xmm0
- movq %xmm0, (rp)
- FUNC_EXIT()
- ret
-
-1: movq (ap), %xmm1
- movq 8(ap), %xmm0
- psrlq %xmm4, %xmm1
- psllq %xmm5, %xmm0
- por %xmm1, %xmm0
- movq %xmm0, (rp)
- dec R32(n)
- jnz 1f
- movq 8(ap), %xmm0
- psrlq %xmm4, %xmm0
- movq %xmm0, 8(rp)
- FUNC_EXIT()
- ret
-
-1: movq 8(ap), %xmm1
- movq 16(ap), %xmm0
- psrlq %xmm4, %xmm1
- psllq %xmm5, %xmm0
- por %xmm1, %xmm0
- movq %xmm0, 8(rp)
- movq 16(ap), %xmm0
- psrlq %xmm4, %xmm0
- movq %xmm0, 16(rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fastsse/sec_tabselect.asm b/gmp/mpn/x86_64/fastsse/sec_tabselect.asm
deleted file mode 100644
index e3df110be4..0000000000
--- a/gmp/mpn/x86_64/fastsse/sec_tabselect.asm
+++ /dev/null
@@ -1,192 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/fat/fat.c b/gmp/mpn/x86_64/fat/fat.c
deleted file mode 100644
index 1b3f4e48be..0000000000
--- a/gmp/mpn/x86_64/fat/fat.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* x86_64 fat binary initializers.
-
- Contributed to the GNU project by Kevin Ryde (original x86_32 code) and
- Torbjorn Granlund (port to x86_64)
-
- THE FUNCTIONS AND VARIABLES IN THIS FILE ARE FOR INTERNAL USE ONLY.
- THEY'RE ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
- COMPLETELY IN FUTURE GNU MP RELEASES.
-
-Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-for more details.
-
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
-
-#include <stdio.h> /* for printf */
-#include <stdlib.h> /* for getenv */
-#include <string.h>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-/* Change this to "#define TRACE(x) x" for some traces. */
-#define TRACE(x)
-
-
-/* fat_entry.asm */
-long __gmpn_cpuid (char [12], int);
-
-
-#if WANT_FAKE_CPUID
-/* The "name"s in the table are values for the GMP_CPU_TYPE environment
- variable. Anything can be used, but for now it's the canonical cpu types
- as per config.guess/config.sub. */
-
-#define __gmpn_cpuid fake_cpuid
-
-#define MAKE_FMS(family, model) \
- ((((family) & 0xf) << 8) + (((family) & 0xff0) << 20) \
- + (((model) & 0xf) << 4) + (((model) & 0xf0) << 12))
-
-static struct {
- const char *name;
- const char vendor[13];
- unsigned fms;
-} fake_cpuid_table[] = {
- { "core2", "GenuineIntel", MAKE_FMS (6, 0xf) },
- { "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) },
-
- { "k8", "AuthenticAMD", MAKE_FMS (15, 0) },
- { "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) },
-};
-
-static int
-fake_cpuid_lookup (void)
-{
- char *s;
- int i;
-
- s = getenv ("GMP_CPU_TYPE");
- if (s == NULL)
- {
- printf ("Need GMP_CPU_TYPE environment variable for fake cpuid\n");
- abort ();
- }
-
- for (i = 0; i < numberof (fake_cpuid_table); i++)
- if (strcmp (s, fake_cpuid_table[i].name) == 0)
- return i;
-
- printf ("GMP_CPU_TYPE=%s unknown\n", s);
- abort ();
-}
-
-static long
-fake_cpuid (char dst[12], unsigned int id)
-{
- int i = fake_cpuid_lookup();
-
- switch (id) {
- case 0:
- memcpy (dst, fake_cpuid_table[i].vendor, 12);
- 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 ();
- }
-}
-#endif
-
-
-typedef DECL_preinv_divrem_1 ((*preinv_divrem_1_t));
-typedef DECL_preinv_mod_1 ((*preinv_mod_1_t));
-
-struct cpuvec_t __gmpn_cpuvec = {
- __MPN(add_n_init),
- __MPN(addlsh1_n_init),
- __MPN(addlsh2_n_init),
- __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),
- __MPN(divexact_1_init),
- __MPN(divrem_1_init),
- __MPN(gcd_1_init),
- __MPN(lshift_init),
- __MPN(lshiftc_init),
- __MPN(mod_1_init),
- __MPN(mod_1_1p_init),
- __MPN(mod_1_1p_cps_init),
- __MPN(mod_1s_2p_init),
- __MPN(mod_1s_2p_cps_init),
- __MPN(mod_1s_4p_init),
- __MPN(mod_1s_4p_cps_init),
- __MPN(mod_34lsub1_init),
- __MPN(modexact_1c_odd_init),
- __MPN(mul_1_init),
- __MPN(mul_basecase_init),
- __MPN(mullo_basecase_init),
- __MPN(preinv_divrem_1_init),
- __MPN(preinv_mod_1_init),
- __MPN(redc_1_init),
- __MPN(redc_2_init),
- __MPN(rshift_init),
- __MPN(sqr_basecase_init),
- __MPN(sub_n_init),
- __MPN(sublsh1_n_init),
- __MPN(submul_1_init),
- 0
-};
-
-int __gmpn_cpuvec_initialized = 0;
-
-/* The following setups start with generic x86, then overwrite with
- specifics for a chip, and higher versions of that chip.
-
- The arrangement of the setups here will normally be the same as the $path
- selections in configure.in for the respective chips.
-
- This code is reentrant and thread safe. We always calculate the same
- decided_cpuvec, so if two copies of the code are running it doesn't
- matter which completes first, both write the same to __gmpn_cpuvec.
-
- We need to go via decided_cpuvec because if one thread has completed
- __gmpn_cpuvec then it may be making use of the threshold values in that
- vector. If another thread is still running __gmpn_cpuvec_init then we
- don't want it to write different values to those fields since some of the
- asm routines only operate correctly up to their own defined threshold,
- not an arbitrary value. */
-
-void
-__gmpn_cpuvec_init (void)
-{
- struct cpuvec_t decided_cpuvec;
- char vendor_string[13];
- char dummy_string[12];
- long fms;
- int family, model;
-
- TRACE (printf ("__gmpn_cpuvec_init:\n"));
-
- memset (&decided_cpuvec, '\0', sizeof (decided_cpuvec));
-
- CPUVEC_SETUP_x86_64;
- CPUVEC_SETUP_fat;
-
- __gmpn_cpuid (vendor_string, 0);
- vendor_string[12] = 0;
-
- fms = __gmpn_cpuid (dummy_string, 1);
- family = ((fms >> 8) & 0xf) + ((fms >> 20) & 0xff);
- model = ((fms >> 4) & 0xf) + ((fms >> 12) & 0xf0);
-
- /* Check extended feature flags */
- __gmpn_cpuid (dummy_string, 0x80000001);
- if ((dummy_string[4 + 29 / 8] & (1 << (29 % 8))) == 0)
- abort (); /* longmode-capable-bit turned off! */
-
- /*********************************************************/
- /*** WARNING: keep this list in sync with config.guess ***/
- /*********************************************************/
- if (strcmp (vendor_string, "GenuineIntel") == 0)
- {
- switch (family)
- {
- case 6:
- switch (model)
- {
- case 0x0f: /* Conroe Merom Kentsfield Allendale */
- case 0x10:
- case 0x11:
- case 0x12:
- case 0x13:
- case 0x14:
- case 0x15:
- case 0x16:
- case 0x17: /* PNR Wolfdale Yorkfield */
- case 0x18:
- case 0x19:
- case 0x1d: /* PNR Dunnington */
- CPUVEC_SETUP_core2;
- break;
-
- case 0x1c: /* Atom Silverthorne */
- case 0x26: /* Atom Lincroft */
- case 0x27: /* Atom Saltwell? */
- case 0x36: /* Atom Cedarview/Saltwell */
- CPUVEC_SETUP_atom;
- break;
-
- case 0x1a: /* NHM Gainestown */
- case 0x1b:
- case 0x1e: /* NHM Lynnfield/Jasper */
- case 0x1f:
- case 0x20:
- case 0x21:
- case 0x22:
- case 0x23:
- case 0x24:
- case 0x25: /* WSM Clarkdale/Arrandale */
- case 0x28:
- case 0x29:
- case 0x2b:
- 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;
-
- case 0x2a: /* SB */
- case 0x2d: /* SBC-EP */
- case 0x3a: /* IBR */
- 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;
-
- case 15:
- CPUVEC_SETUP_pentium4;
- break;
- }
- }
- else if (strcmp (vendor_string, "AuthenticAMD") == 0)
- {
- switch (family)
- {
- case 0x0f: /* k8 */
- case 0x11: /* "fam 11h", mix of k8 and k10 */
- case 0x13:
- case 0x17:
- CPUVEC_SETUP_k8;
- break;
-
- case 0x10: /* k10 */
- case 0x12: /* k10 (llano) */
- CPUVEC_SETUP_k8;
- CPUVEC_SETUP_k10;
- break;
-
- case 0x14: /* bobcat */
- case 0x16: /* jaguar */
- CPUVEC_SETUP_k8;
- CPUVEC_SETUP_k10;
- CPUVEC_SETUP_bobcat;
- break;
-
- case 0x15: /* bulldozer, piledriver, steamroller, excavator */
- CPUVEC_SETUP_k8;
- CPUVEC_SETUP_k10;
- CPUVEC_SETUP_bd1;
- }
- }
- else if (strcmp (vendor_string, "CentaurHauls") == 0)
- {
- switch (family)
- {
- case 6:
- if (model >= 15)
- CPUVEC_SETUP_nano;
- break;
- }
- }
-
- /* There's no x86 generic mpn_preinv_divrem_1 or mpn_preinv_mod_1.
- Instead default to the plain versions from whichever CPU we detected.
- The function arguments are compatible, no need for any glue code. */
- if (decided_cpuvec.preinv_divrem_1 == NULL)
- decided_cpuvec.preinv_divrem_1 =(preinv_divrem_1_t)decided_cpuvec.divrem_1;
- if (decided_cpuvec.preinv_mod_1 == NULL)
- decided_cpuvec.preinv_mod_1 =(preinv_mod_1_t) decided_cpuvec.mod_1;
-
- ASSERT_CPUVEC (decided_cpuvec);
- CPUVEC_INSTALL (decided_cpuvec);
-
- /* Set this once the threshold fields are ready.
- Use volatile to prevent it getting moved. */
- *((volatile int *) &__gmpn_cpuvec_initialized) = 1;
-}
diff --git a/gmp/mpn/x86_64/fat/fat_entry.asm b/gmp/mpn/x86_64/fat/fat_entry.asm
deleted file mode 100644
index 764e3d82f2..0000000000
--- a/gmp/mpn/x86_64/fat/fat_entry.asm
+++ /dev/null
@@ -1,204 +0,0 @@
-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-2014 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-
-dnl Forcibly disable profiling.
-dnl
-dnl The entrypoints and inits are small enough not to worry about, the real
-dnl routines arrived at will have any profiling. Also, the way the code
-dnl here ends with a jump means we won't work properly with the
-dnl "instrument" profiling scheme anyway.
-
-define(`WANT_PROFILING',no)
-
-
-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(`PRETEND_PIC')')
-ifdef(`OPENBSD',
-`define(`PRETEND_PIC')')
-ifdef(`PIC',
-`define(`PRETEND_PIC')')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
- TEXT
-
-dnl Usage: FAT_ENTRY(name, offset)
-dnl
-dnl Emit a fat binary entrypoint function of the given name. This is the
-dnl normal entry for applications, eg. __gmpn_add_n.
-dnl
-dnl The code simply jumps through the function pointer in __gmpn_cpuvec at
-dnl the given "offset" (in bytes).
-dnl
-dnl For non-PIC, the jumps are 5 bytes each, aligning them to 8 should be
-dnl fine for all x86s.
-dnl
-dnl For ELF/DARWIN PIC, the jumps are 20 bytes each, and are best aligned to
-dnl 16 to ensure at least the first two instructions don't cross a cache line
-dnl boundary.
-dnl
-dnl For DOS64, the jumps are 6 bytes. The same form works also for GNU/Linux
-dnl (at least with certain assembler/linkers) but FreeBSD 8.2 crashes. Not
-dnl tested on Darwin, Slowaris, NetBSD, etc.
-dnl
-dnl Note the extra `' ahead of PROLOGUE obscures it from the HAVE_NATIVE
-dnl grepping in configure, stopping that code trying to eval something with
-dnl $1 in it.
-
-define(FAT_ENTRY,
-m4_assert_numargs(2)
-`ifdef(`HOST_DOS64',
-` ALIGN(8)
-`'PROLOGUE($1)
- jmp *$2+GSYM_PREFIX`'__gmpn_cpuvec(%rip)
-EPILOGUE()
-',
-` ALIGN(ifdef(`PIC',16,8))
-`'PROLOGUE($1)
-ifdef(`PRETEND_PIC',
-` LEA( GSYM_PREFIX`'__gmpn_cpuvec, %rax)
- jmp *$2(%rax)
-',`dnl non-PIC
- jmp *GSYM_PREFIX`'__gmpn_cpuvec+$2
-')
-EPILOGUE()
-')')
-
-
-dnl FAT_ENTRY for each CPUVEC_FUNCS_LIST
-dnl
-
-define(`CPUVEC_offset',0)
-foreach(i,
-`FAT_ENTRY(MPN(i),CPUVEC_offset)
-define(`CPUVEC_offset',eval(CPUVEC_offset + 8))',
-CPUVEC_FUNCS_LIST)
-
-
-dnl Usage: FAT_INIT(name, offset)
-dnl
-dnl Emit a fat binary initializer function of the given name. These
-dnl functions are the initial values for the pointers in __gmpn_cpuvec.
-dnl
-dnl The code simply calls __gmpn_cpuvec_init, and then jumps back through
-dnl the __gmpn_cpuvec pointer, at the given "offset" (in bytes).
-dnl __gmpn_cpuvec_init will have stored the address of the selected
-dnl implementation there.
-dnl
-dnl Only one of these routines will be executed, and only once, since after
-dnl that all the __gmpn_cpuvec pointers go to real routines. So there's no
-dnl need for anything special here, just something small and simple. To
-dnl keep code size down, "fat_init" is a shared bit of code, arrived at
-dnl with the offset in %al. %al is used since the movb instruction is 2
-dnl bytes where %eax would be 4.
-dnl
-dnl Note having `PROLOGUE in FAT_INIT obscures that PROLOGUE from the
-dnl HAVE_NATIVE grepping in configure, preventing that code trying to eval
-dnl something with $1 in it.
-dnl
-dnl We need to preserve parameter registers over the __gmpn_cpuvec_init call
-
-define(FAT_INIT,
-m4_assert_numargs(2)
-`PROLOGUE($1)
- mov $`'$2, %al
- jmp L(fat_init)
-EPILOGUE()
-')
-
-dnl FAT_INIT for each CPUVEC_FUNCS_LIST
-dnl
-
-define(`CPUVEC_offset',0)
-foreach(i,
-`FAT_INIT(MPN(i`'_init),CPUVEC_offset)
-define(`CPUVEC_offset',eval(CPUVEC_offset + 1))',
-CPUVEC_FUNCS_LIST)
-
-L(fat_init):
- C al __gmpn_cpuvec byte offset
-
- movzbl %al, %eax
-IFSTD(` push %rdi ')
-IFSTD(` push %rsi ')
- push %rdx
- push %rcx
- push %r8
- push %r9
- push %rax
- CALL( __gmpn_cpuvec_init)
- pop %rax
- pop %r9
- pop %r8
- pop %rcx
- pop %rdx
-IFSTD(` pop %rsi ')
-IFSTD(` pop %rdi ')
-ifdef(`PRETEND_PIC',`
- LEA( GSYM_PREFIX`'__gmpn_cpuvec, %r10)
- jmp *(%r10,%rax,8)
-',`dnl non-PIC
- jmp *GSYM_PREFIX`'__gmpn_cpuvec(,%rax,8)
-')
-
-
-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')
-
-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)
- mov %ecx, 8(rp)
- mov %r8, %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/fat/gmp-mparam.h b/gmp/mpn/x86_64/fat/gmp-mparam.h
deleted file mode 100644
index 005c893635..0000000000
--- a/gmp/mpn/x86_64/fat/gmp-mparam.h
+++ /dev/null
@@ -1,72 +0,0 @@
-/* Fat binary x86_64 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-
-/* mpn_divexact_1 is faster than mpn_divrem_1 at all sizes. The only time
- this might not be true currently is for actual 80386 and 80486 chips,
- where mpn/x86/dive_1.asm might be slower than mpn/x86/divrem_1.asm, but
- that's not worth worrying about. */
-#define DIVEXACT_1_THRESHOLD 0
-
-/* Only some of the x86s have an mpn_preinv_divrem_1, but we set
- USE_PREINV_DIVREM_1 so that all callers use it, and then let the
- __gmpn_cpuvec pointer go to plain mpn_divrem_1 if there's not an actual
- preinv. */
-#define USE_PREINV_DIVREM_1 1
-
-#define BMOD_1_TO_MOD_1_THRESHOLD 20
-
-/* mpn_sqr_basecase is faster than mpn_mul_basecase at all sizes, no need
- for mpn_sqr to call the latter. */
-#define SQR_BASECASE_THRESHOLD 0
-
-/* Sensible fallbacks for these, when not taken from a cpu-specific
- gmp-mparam.h. */
-#define MUL_TOOM22_THRESHOLD 20
-#define MUL_TOOM33_THRESHOLD 130
-#define SQR_TOOM2_THRESHOLD 30
-#define SQR_TOOM3_THRESHOLD 200
-
-/* These are values more or less in the middle of what the typical x86 chips
- come out as. For a fat binary it's necessary to have values for these,
- since the defaults for MUL_FFT_TABLE and SQR_FFT_TABLE otherwise come out
- as non-constant array initializers. FIXME: Perhaps these should be done
- in the cpuvec structure like other thresholds. */
-#define MUL_FFT_TABLE { 464, 928, 1920, 3584, 10240, 40960, 0 }
-#define MUL_FFT_MODF_THRESHOLD 400
-#define MUL_FFT_THRESHOLD 2000
-
-#define SQR_FFT_TABLE { 528, 1184, 1920, 4608, 14336, 40960, 0 }
-#define SQR_FFT_MODF_THRESHOLD 500
-#define SQR_FFT_THRESHOLD 3000
diff --git a/gmp/mpn/x86_64/fat/mod_1.c b/gmp/mpn/x86_64/fat/mod_1.c
deleted file mode 100644
index 4f149cc353..0000000000
--- a/gmp/mpn/x86_64/fat/mod_1.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Fat binary fallback mpn_mod_1.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/mod_1.c"
diff --git a/gmp/mpn/x86_64/fat/mul_basecase.c b/gmp/mpn/x86_64/fat/mul_basecase.c
deleted file mode 100644
index d9eb4718c2..0000000000
--- a/gmp/mpn/x86_64/fat/mul_basecase.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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/gmp/mpn/x86_64/fat/mullo_basecase.c b/gmp/mpn/x86_64/fat/mullo_basecase.c
deleted file mode 100644
index 7f86be64c5..0000000000
--- a/gmp/mpn/x86_64/fat/mullo_basecase.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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/gmp/mpn/x86_64/fat/redc_1.c b/gmp/mpn/x86_64/fat/redc_1.c
deleted file mode 100644
index 0025403353..0000000000
--- a/gmp/mpn/x86_64/fat/redc_1.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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"
diff --git a/gmp/mpn/x86_64/fat/redc_2.c b/gmp/mpn/x86_64/fat/redc_2.c
deleted file mode 100644
index 1932d58323..0000000000
--- a/gmp/mpn/x86_64/fat/redc_2.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* Fat binary fallback mpn_redc_2.
-
-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_2.c"
diff --git a/gmp/mpn/x86_64/fat/sqr_basecase.c b/gmp/mpn/x86_64/fat/sqr_basecase.c
deleted file mode 100644
index d1c5dcd2e0..0000000000
--- a/gmp/mpn/x86_64/fat/sqr_basecase.c
+++ /dev/null
@@ -1,32 +0,0 @@
-/* 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"
diff --git a/gmp/mpn/x86_64/gcd_1.asm b/gmp/mpn/x86_64/gcd_1.asm
deleted file mode 100644
index 252d4174eb..0000000000
--- a/gmp/mpn/x86_64/gcd_1.asm
+++ /dev/null
@@ -1,163 +0,0 @@
-dnl AMD64 mpn_gcd_1 -- mpn by 1 gcd.
-
-dnl Based on the K7 gcd_1.asm, by Kevin Ryde. Rehacked for AMD64 by Torbjorn
-dnl Granlund.
-
-dnl Copyright 2000-2002, 2005, 2009, 2011, 2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-
-C cycles/bit (approx)
-C AMD K8,K9 5.21 (4.95)
-C AMD K10 5.15 (5.00)
-C AMD bd1 5.42 (5.14)
-C AMD bobcat 6.71 (6.56)
-C Intel P4 13.5 (12.75)
-C Intel core2 6.20 (6.16)
-C Intel NHM 6.49 (6.25)
-C Intel SBR 7.75 (7.57)
-C Intel atom 8.77 (8.54)
-C VIA nano 6.60 (6.20)
-C Numbers measured with: speed -CD -s16-64 -t48 mpn_gcd_1
-
-C ctz_table[n] is the number of trailing zeros on n, or MAXSHIFT if n==0.
-
-deflit(MAXSHIFT, 7)
-deflit(MASK, eval((m4_lshift(1,MAXSHIFT))-1))
-
-DEF_OBJECT(ctz_table,64)
- .byte MAXSHIFT
-forloop(i,1,MASK,
-` .byte m4_count_trailing_zeros(i)
-')
-END_OBJECT(ctz_table)
-
-C Threshold of when to call bmod when U is one limb. Should be about
-C (time_in_cycles(bmod_1,1) + call_overhead) / (cycles/bit).
-define(`BMOD_THRES_LOG2', 8)
-
-C INPUT PARAMETERS
-define(`up', `%rdi')
-define(`n', `%rsi')
-define(`v0', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFDOS(`define(`STACK_ALLOC', 40)')
-IFSTD(`define(`STACK_ALLOC', 8)')
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_gcd_1)
- FUNC_ENTRY(3)
- mov (up), %rax C U low limb
- mov $-1, R32(%rcx)
- or v0, %rax C x | y
-
-L(twos):
- inc R32(%rcx)
- shr %rax
- jnc L(twos)
-
- shr R8(%rcx), v0
- push %rcx C common twos
-
-L(divide_strip_y):
- shr v0
- jnc L(divide_strip_y)
- adc v0, v0
-
- cmp $1, n
- jnz L(reduce_nby1)
-
-C Both U and V are single limbs, reduce with bmod if u0 >> v0.
- mov (up), %r8
- mov %r8, %rax
- shr $BMOD_THRES_LOG2, %r8
- cmp %r8, v0
- ja L(noreduce)
- push v0
- sub $STACK_ALLOC, %rsp C maintain ABI required rsp alignment
-
-L(bmod):
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- CALL( mpn_modexact_1_odd)
-
-L(reduced):
- add $STACK_ALLOC, %rsp
- pop %rdx
-
-L(noreduce):
- LEA( ctz_table, %rsi)
- test %rax, %rax
- mov %rax, %rcx
- jnz L(mid)
- jmp L(end)
-
-L(reduce_nby1):
- push v0
- sub $STACK_ALLOC, %rsp C maintain ABI required rsp alignment
-
- cmp $BMOD_1_TO_MOD_1_THRESHOLD, n
- jl L(bmod)
-IFDOS(` mov %rdx, %r8 ')
-IFDOS(` mov %rsi, %rdx ')
-IFDOS(` mov %rdi, %rcx ')
- CALL( mpn_mod_1)
- jmp L(reduced)
-
- ALIGN(16) C K8 BC P4 NHM SBR
-L(top): cmovc %rcx, %rax C if x-y < 0 0
- cmovc %rdi, %rdx C use x,y-x 0
-L(mid): and $MASK, R32(%rcx) C 0
- movzbl (%rsi,%rcx), R32(%rcx) C 1
- jz L(shift_alot) C 1
- shr R8(%rcx), %rax C 3
- mov %rax, %rdi C 4
- mov %rdx, %rcx C 3
- sub %rax, %rcx C 4
- sub %rdx, %rax C 4
- jnz L(top) C 5
-
-L(end): pop %rcx
- mov %rdx, %rax
- shl R8(%rcx), %rax
- FUNC_EXIT()
- ret
-
-L(shift_alot):
- shr $MAXSHIFT, %rax
- mov %rax, %rcx
- jmp L(mid)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/gmp-mparam.h b/gmp/mpn/x86_64/gmp-mparam.h
index 0dea8c94cd..5e2ed40332 100644
--- a/gmp/mpn/x86_64/gmp-mparam.h
+++ b/gmp/mpn/x86_64/gmp-mparam.h
@@ -1,218 +1,79 @@
-/* AMD K8-K10 gmp-mparam.h -- Compiler/machine parameter header file.
+/* AMD K8 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+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 either:
+it under the terms of the GNU 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 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.
-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.
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 8
-or both in parallel, as here.
+/* 2200 MHz Opteron / rev A / 1024 Kibyte cache / socket 940 */
-The GNU MP Library is distributed in the hope that 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
-
-
-#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 14
-#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_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 27
-#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 234
-#define MUL_TOOM6H_THRESHOLD 418
-#define MUL_TOOM8H_THRESHOLD 466
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
-#define MUL_TOOM32_TO_TOOM53_THRESHOLD 160
-#define MUL_TOOM42_TO_TOOM53_THRESHOLD 145
-#define MUL_TOOM42_TO_TOOM63_THRESHOLD 175
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 36
-#define SQR_TOOM3_THRESHOLD 117
-#define SQR_TOOM4_THRESHOLD 327
-#define SQR_TOOM6_THRESHOLD 446
-#define SQR_TOOM8_THRESHOLD 547
-
-#define MULMID_TOOM42_THRESHOLD 36
-
-#define MULMOD_BNM1_THRESHOLD 17
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define POWM_SEC_TABLE 2,67,322,991
-
-#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}, \
- { 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}, \
- { 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}, \
- { 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}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 185
-#define MUL_FFT_THRESHOLD 7552
-
-#define SQR_FFT_MODF_THRESHOLD 460 /* 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}, \
- { 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
-
-#define MULLO_BASECASE_THRESHOLD 0 /* always */
-#define MULLO_DC_THRESHOLD 35
-#define MULLO_MUL_N_THRESHOLD 15604
-
-#define DC_DIV_QR_THRESHOLD 56
-#define DC_DIVAPPR_Q_THRESHOLD 220
-#define DC_BDIV_QR_THRESHOLD 52
-#define DC_BDIV_Q_THRESHOLD 152
-
-#define INV_MULMOD_BNM1_THRESHOLD 54
-#define INV_NEWTON_THRESHOLD 226
-#define INV_APPR_THRESHOLD 214
-
-#define BINV_NEWTON_THRESHOLD 327
-#define REDC_1_TO_REDC_2_THRESHOLD 4
-#define REDC_2_TO_REDC_N_THRESHOLD 79
-
-#define MU_DIV_QR_THRESHOLD 1895
-#define MU_DIVAPPR_Q_THRESHOLD 1895
-#define MUPI_DIV_QR_THRESHOLD 106
-#define MU_BDIV_QR_THRESHOLD 1589
-#define MU_BDIV_Q_THRESHOLD 1718
-
-#define MATRIX22_STRASSEN_THRESHOLD 16
-#define HGCD_THRESHOLD 125
-#define HGCD_APPR_THRESHOLD 173
-#define HGCD_REDUCE_THRESHOLD 3524
-#define GCD_DC_THRESHOLD 555
-#define GCDEXT_DC_THRESHOLD 478
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 28
-#define SET_STR_DC_THRESHOLD 248
-#define SET_STR_PRECOMPUTE_THRESHOLD 1648
-
-#define FAC_DSC_THRESHOLD 1075
-#define FAC_ODD_THRESHOLD 0 /* always */
+/* Generated by tuneup.c, 2009-01-14, gcc 3.4 */
+
+#define MUL_KARATSUBA_THRESHOLD 28
+#define MUL_TOOM3_THRESHOLD 97
+#define MUL_TOOM44_THRESHOLD 406
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 38
+#define SQR_TOOM3_THRESHOLD 133
+#define SQR_TOOM4_THRESHOLD 547
+
+#define MULLOW_BASECASE_THRESHOLD 27
+#define MULLOW_DC_THRESHOLD 28
+#define MULLOW_MUL_N_THRESHOLD 199
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 74
+#define POWM_THRESHOLD 146
+
+#define MATRIX22_STRASSEN_THRESHOLD 24
+#define HGCD_THRESHOLD 143
+#define GCD_DC_THRESHOLD 529
+#define GCDEXT_DC_THRESHOLD 639
+#define JACOBI_BASE_METHOD 1
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 4
+#define MOD_1_2_THRESHOLD 7
+#define MOD_1_4_THRESHOLD 64
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 18
+#define GET_STR_PRECOMPUTE_THRESHOLD 32
+#define SET_STR_DC_THRESHOLD 248
+#define SET_STR_PRECOMPUTE_THRESHOLD 2124
+
+#define MUL_FFT_TABLE { 432, 928, 2624, 3840, 11264, 36864, 147456, 327680, 0 }
+#define MUL_FFT_MODF_THRESHOLD 656
+#define MUL_FFT_THRESHOLD 7936
+
+#define SQR_FFT_TABLE { 432, 928, 2368, 4352, 11264, 28672, 114688, 327680, 0 }
+#define SQR_FFT_MODF_THRESHOLD 560
+#define SQR_FFT_THRESHOLD 7936
+
+#define MUL_FFT_TABLE2 {{1,4}, {337,5}, {673,6}, {1729,7}, {1793,6}, {2017,7}, {5633,8}, {11009,9}, {11777,8}, {14593,9}, {15873,8}, {16897,9}, {22017,10}, {23553,9}, {29697,10}, {31745,9}, {36353,10}, {39937,9}, {44545,10}, {48129,9}, {50689,10}, {56833,11}, {63489,10}, {78337,11}, {79873,10}, {86017,11}, {88065,10}, {92161,11}, {96257,10}, {106497,11}, {129025,10}, {141313,11}, {145409,10}, {146433,11}, {161793,10}, {167937,11}, {227329,12}, {258049,11}, {326657,12}, {389121,11}, {424961,13}, {516097,12}, {520193,11}, {528385,10}, {538625,11}, {547841,10}, {552961,11}, {587777,12}, {651265,11}, {718849,10}, {719873,12}, {782337,11}, {787457,10}, {791553,11}, {796673,10}, {802817,11}, {849921,10}, {850945,12}, {913409,11}, {915457,13}, {1040385,12}, {1044481,11}, {1112065,12}, {1175553,11}, {1243137,12}, {1306625,11}, {1374209,12}, {1437697,13}, {1564673,12}, {1568769,11}, {1581057,12}, {1585153,11}, {1595393,12}, {1597441,11}, {1630209,12}, {1699841,11}, {1761281,12}, {1830913,14}, {2080769,13}, {2088961,12}, {2486273,13}, {2613249,12}, {3010561,13}, {3137537,12}, {3534849,13}, {3661825,12}, {3928065,13}, {3964929,14}, {4014081,13}, {4046849,14}, {4136961,13}, {4186113,12}, {4452353,13}, {4710401,12}, {4976641,13}, {5234689,12}, {5238785,13}, {5349377,12}, {5353473,13}, {5758977,12}, {5763073,14}, {6275073,13}, {7856129,14}, {8372225,13}, {9953281,14}, {10469377,13}, {12050433,14}, {12566529,13}, {13623297,14}, {14663681,13}, {15196161,15}, {16744449,14}, {16760833,13}, {17293313,14}, {18857985,13}, {19394561,14}, {MP_SIZE_T_MAX,0}}
+
+#define SQR_FFT_TABLE2 {{1,4}, {305,5}, {609,6}, {1601,7}, {4737,8}, {4865,7}, {5121,8}, {11009,9}, {11777,8}, {13057,9}, {13825,10}, {15361,9}, {15873,8}, {16129,9}, {22017,10}, {23553,9}, {28161,10}, {31745,9}, {36353,10}, {39937,9}, {42497,10}, {56321,11}, {63489,10}, {89601,11}, {96257,10}, {107521,12}, {126977,11}, {129025,10}, {135169,11}, {137217,10}, {139265,11}, {163841,10}, {173057,11}, {195073,9}, {196097,11}, {196609,10}, {201729,11}, {212993,12}, {217089,11}, {221185,12}, {258049,11}, {260609,10}, {261121,9}, {261633,11}, {292865,10}, {296961,11}, {299009,10}, {302081,11}, {325633,12}, {389121,11}, {392193,9}, {392705,11}, {393217,13}, {401409,11}, {404481,13}, {421889,11}, {424961,13}, {516097,12}, {520193,11}, {526337,10}, {532481,11}, {542721,10}, {543745,11}, {593921,12}, {598017,11}, {608257,12}, {610305,11}, {616449,12}, {651265,11}, {653313,10}, {687617,11}, {718849,10}, {749569,12}, {782337,11}, {784385,10}, {788481,11}, {793601,10}, {800769,11}, {802817,10}, {813057,11}, {850945,12}, {913409,11}, {917505,13}, {1040385,12}, {1044481,11}, {1113089,12}, {1175553,11}, {1243137,12}, {1309697,11}, {1347585,12}, {1351681,11}, {1368065,12}, {1437697,11}, {1503233,13}, {1564673,12}, {1568769,11}, {1628161,12}, {1839105,14}, {1851393,12}, {1884161,14}, {2080769,13}, {2088961,12}, {2488321,13}, {2613249,12}, {3010561,13}, {3137537,12}, {3403777,13}, {3661825,12}, {3928065,14}, {4177921,13}, {4186113,12}, {4452353,13}, {4710401,12}, {4976641,13}, {5234689,12}, {5500929,13}, {5758977,12}, {5763073,14}, {6275073,13}, {6283265,12}, {6549505,13}, {7856129,15}, {8011777,14}, {8060929,15}, {8355841,14}, {8372225,13}, {9953281,14}, {10469377,13}, {12050433,14}, {12566529,13}, {13623297,14}, {14663681,13}, {15196161,15}, {16744449,14}, {16760833,13}, {17293313,14}, {23052289,15}, {25133057,14}, {29343745,16}, {MP_SIZE_T_MAX,0}}
+#define INV_NEWTON_THRESHOLD 47
+#define BINV_NEWTON_THRESHOLD 18
diff --git a/gmp/mpn/x86_64/invert_limb.asm b/gmp/mpn/x86_64/invert_limb.asm
index cc79b89a2b..44fb83bd10 100644
--- a/gmp/mpn/x86_64/invert_limb.asm
+++ b/gmp/mpn/x86_64/invert_limb.asm
@@ -1,115 +1,121 @@
dnl AMD64 mpn_invert_limb -- Invert a normalized limb.
-dnl Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
-
-dnl Copyright 2004, 2007-2009, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2004, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 (approx) div
-C AMD K8,K9 48 71
-C AMD K10 48 77
-C Intel P4 135 161
-C Intel core2 69 116
-C Intel corei 55 89
-C Intel atom 129 191
-C VIA nano 79 157
+C K8: 40 71
+C P4: 141 161
+C P6-15 (Core2): 63 116
+C P6-28 (Atom): 130 191
C rax rcx rdx rdi rsi r8
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-PROTECT(`mpn_invert_limb_table')
ASM_START()
TEXT
ALIGN(16)
-PROLOGUE(mpn_invert_limb) C Kn C2 Ci
- FUNC_ENTRY(1)
- mov %rdi, %rax C 0 0 0
- shr $55, %rax C 1 1 1
+PROLOGUE(mpn_invert_limb)
+ mov %rdi, %rax
+ shr $55, %rax
ifdef(`PIC',`
ifdef(`DARWIN',`
- mov mpn_invert_limb_table@GOTPCREL(%rip), %r8
+ mov approx_tab@GOTPCREL(%rip), %r8
add $-512, %r8
',`
- lea -512+mpn_invert_limb_table(%rip), %r8
+ lea -512+approx_tab(%rip), %r8
')',`
- movabs $-512+mpn_invert_limb_table, %r8
+ movabs $-512+approx_tab, %r8
')
- movzwl (%r8,%rax,2), R32(%rcx) C %rcx = v0
-
- C v1 = (v0 << 11) - (v0*v0*d40 >> 40) - 1
- mov %rdi, %rsi C 0 0 0
- mov R32(%rcx), R32(%rax) C 4 5 5
- imul R32(%rcx), R32(%rcx) C 4 5 5
- shr $24, %rsi C 1 1 1
- inc %rsi C %rsi = d40
- imul %rsi, %rcx C 8 10 8
- shr $40, %rcx C 12 15 11
- sal $11, R32(%rax) C 5 6 6
- dec R32(%rax)
- sub R32(%rcx), R32(%rax) C %rax = v1
-
- C v2 = (v1 << 13) + (v1 * (2^60 - v1*d40) >> 47)
- mov $0x1000000000000000, %rcx
- imul %rax, %rsi C 14 17 13
- sub %rsi, %rcx
- imul %rax, %rcx
- sal $13, %rax
- shr $47, %rcx
- add %rax, %rcx C %rcx = v2
-
- C v3 = (v2 << 31) + (v2 * (2^96 - v2 * d63 + ((v2 >> 1) & mask)) >> 65
- mov %rdi, %rsi C 0 0 0
- shr %rsi C d/2
- sbb %rax, %rax C -d0 = -(d mod 2)
- sub %rax, %rsi C d63 = ceil(d/2)
- imul %rcx, %rsi C v2 * d63
- and %rcx, %rax C v2 * d0
- shr %rax C (v2>>1) * d0
- sub %rsi, %rax C (v2>>1) * d0 - v2 * d63
- mul %rcx
- sal $31, %rcx
- shr %rdx
- add %rdx, %rcx C %rcx = v3
-
- mov %rdi, %rax
- mul %rcx
- add %rdi, %rax
+ movzwl (%r8,%rax,2), R32(%rcx)
+ mov %rdi, %rsi
+ mov R32(%rcx), R32(%rax)
+ imul R32(%rcx), R32(%rcx)
+ shr $32, %rsi
+ imul %rsi, %rcx
+ shr $31, %rcx
+ sal $17, %rax
+ sub %rcx, %rax
+ mov %rax, %r8
+ imul %rax, %rax
+ sal $33, %r8
+ mul %rdi
+ neg %rdx
+ lea (%r8,%rdx,2), %rax
+ mov %rax, %r8
+ mul %rax
+ mov %rax, %rcx
+ mov %rdx, %rax
+ mul %rdi
+ mov %rax, %rsi
mov %rcx, %rax
- adc %rdi, %rdx
- sub %rdx, %rax
-
- FUNC_EXIT()
+ mov %rdx, %rcx
+ mul %rdi
+ add %rdx, %rsi
+ sbb %rcx, %r8
+ shr $62, %rsi
+ add $1, %rsi
+ sal $2, %r8
+ sub %rsi, %r8
+ mov %rdi, %rax
+ mul %r8
+ add %rdi, %rax C xl += d
+ adc %rdi, %rdx C xh += d
+ mov %r8, %rax
+ sub %rdx, %rax C return zh - xh
ret
EPILOGUE()
+
+ RODATA
+ ALIGN(2)
+approx_tab:
+ .value 0xffc0,0xfec0,0xfdc0,0xfcc0,0xfbc0,0xfac0,0xfa00,0xf900
+ .value 0xf800,0xf700,0xf640,0xf540,0xf440,0xf380,0xf280,0xf180
+ .value 0xf0c0,0xefc0,0xef00,0xee00,0xed40,0xec40,0xeb80,0xeac0
+ .value 0xe9c0,0xe900,0xe840,0xe740,0xe680,0xe5c0,0xe500,0xe400
+ .value 0xe340,0xe280,0xe1c0,0xe100,0xe040,0xdf80,0xdec0,0xde00
+ .value 0xdd40,0xdc80,0xdbc0,0xdb00,0xda40,0xd980,0xd8c0,0xd800
+ .value 0xd740,0xd680,0xd600,0xd540,0xd480,0xd3c0,0xd340,0xd280
+ .value 0xd1c0,0xd140,0xd080,0xcfc0,0xcf40,0xce80,0xcdc0,0xcd40
+ .value 0xcc80,0xcc00,0xcb40,0xcac0,0xca00,0xc980,0xc8c0,0xc840
+ .value 0xc780,0xc700,0xc640,0xc5c0,0xc540,0xc480,0xc400,0xc380
+ .value 0xc2c0,0xc240,0xc1c0,0xc100,0xc080,0xc000,0xbf80,0xbec0
+ .value 0xbe40,0xbdc0,0xbd40,0xbc80,0xbc00,0xbb80,0xbb00,0xba80
+ .value 0xba00,0xb980,0xb900,0xb840,0xb7c0,0xb740,0xb6c0,0xb640
+ .value 0xb5c0,0xb540,0xb4c0,0xb440,0xb3c0,0xb340,0xb2c0,0xb240
+ .value 0xb1c0,0xb140,0xb0c0,0xb080,0xb000,0xaf80,0xaf00,0xae80
+ .value 0xae00,0xad80,0xad40,0xacc0,0xac40,0xabc0,0xab40,0xaac0
+ .value 0xaa80,0xaa00,0xa980,0xa900,0xa8c0,0xa840,0xa7c0,0xa740
+ .value 0xa700,0xa680,0xa600,0xa5c0,0xa540,0xa4c0,0xa480,0xa400
+ .value 0xa380,0xa340,0xa2c0,0xa240,0xa200,0xa180,0xa140,0xa0c0
+ .value 0xa080,0xa000,0x9f80,0x9f40,0x9ec0,0x9e80,0x9e00,0x9dc0
+ .value 0x9d40,0x9d00,0x9c80,0x9c40,0x9bc0,0x9b80,0x9b00,0x9ac0
+ .value 0x9a40,0x9a00,0x9980,0x9940,0x98c0,0x9880,0x9840,0x97c0
+ .value 0x9780,0x9700,0x96c0,0x9680,0x9600,0x95c0,0x9580,0x9500
+ .value 0x94c0,0x9440,0x9400,0x93c0,0x9340,0x9300,0x92c0,0x9240
+ .value 0x9200,0x91c0,0x9180,0x9100,0x90c0,0x9080,0x9000,0x8fc0
+ .value 0x8f80,0x8f40,0x8ec0,0x8e80,0x8e40,0x8e00,0x8d80,0x8d40
+ .value 0x8d00,0x8cc0,0x8c80,0x8c00,0x8bc0,0x8b80,0x8b40,0x8b00
+ .value 0x8a80,0x8a40,0x8a00,0x89c0,0x8980,0x8940,0x88c0,0x8880
+ .value 0x8840,0x8800,0x87c0,0x8780,0x8740,0x8700,0x8680,0x8640
+ .value 0x8600,0x85c0,0x8580,0x8540,0x8500,0x84c0,0x8480,0x8440
+ .value 0x8400,0x8380,0x8340,0x8300,0x82c0,0x8280,0x8240,0x8200
+ .value 0x81c0,0x8180,0x8140,0x8100,0x80c0,0x8080,0x8040,0x8000
ASM_END()
diff --git a/gmp/mpn/x86_64/invert_limb_table.asm b/gmp/mpn/x86_64/invert_limb_table.asm
deleted file mode 100644
index 739d59e46c..0000000000
--- a/gmp/mpn/x86_64/invert_limb_table.asm
+++ /dev/null
@@ -1,50 +0,0 @@
-dnl Table used for mpn_invert_limb
-
-dnl Contributed to the GNU project by Torbjorn Granlund and Niels Möller.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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)
-
-PROTECT(`mpn_invert_limb_table')
-
-ASM_START()
-C Table entry X contains floor (0x7fd00 / (0x100 + X))
-
- RODATA
- ALIGN(2)
- GLOBL mpn_invert_limb_table
-mpn_invert_limb_table:
-forloop(i,256,512-1,dnl
-` .value eval(0x7fd00/i)
-')dnl
-ASM_END()
diff --git a/gmp/mpn/x86_64/k10/gcd_1.asm b/gmp/mpn/x86_64/k10/gcd_1.asm
deleted file mode 100644
index 3d8e5c7ab1..0000000000
--- a/gmp/mpn/x86_64/k10/gcd_1.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_gcd_1)
-include_mpn(`x86_64/core2/gcd_1.asm')
diff --git a/gmp/mpn/x86_64/k10/gmp-mparam.h b/gmp/mpn/x86_64/k10/gmp-mparam.h
deleted file mode 100644
index 5881306a40..0000000000
--- a/gmp/mpn/x86_64/k10/gmp-mparam.h
+++ /dev/null
@@ -1,222 +0,0 @@
-/* AMD K10 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-#if 0
-#undef mpn_sublsh_n
-#define mpn_sublsh_n(rp,up,vp,n,c) \
- (((rp) == (up)) ? mpn_submul_1 (rp, vp, n, CNST_LIMB(1) << (c)) \
- : MPN(mpn_sublsh_n)(rp,up,vp,n,c))
-#endif
-
-/* 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
-#define MOD_1U_TO_MOD_1_1_THRESHOLD 2
-#define MOD_1_1_TO_MOD_1_2_THRESHOLD 17
-#define MOD_1_2_TO_MOD_1_4_THRESHOLD 28
-#define PREINV_MOD_1_TO_MOD_1_THRESHOLD 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
-
-#define MUL_TOOM22_THRESHOLD 28
-#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 242
-#define MUL_TOOM6H_THRESHOLD 369
-#define MUL_TOOM8H_THRESHOLD 478
-
-#define MUL_TOOM32_TO_TOOM43_THRESHOLD 97
-#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 142
-
-#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
-#define SQR_TOOM2_THRESHOLD 34
-#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 17
-#define SQRMOD_BNM1_THRESHOLD 17
-
-#define MUL_FFT_MODF_THRESHOLD 570 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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}, { 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,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}, { 1727,14}, { 895,13}, { 1855,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
- { 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}, { 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 169
-#define MUL_FFT_THRESHOLD 7808
-
-#define SQR_FFT_MODF_THRESHOLD 448 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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}, { 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 15604
-
-#define DC_DIV_QR_THRESHOLD 56
-#define DC_DIVAPPR_Q_THRESHOLD 218
-#define DC_BDIV_QR_THRESHOLD 52
-#define DC_BDIV_Q_THRESHOLD 42
-
-#define INV_MULMOD_BNM1_THRESHOLD 62
-#define INV_NEWTON_THRESHOLD 226
-#define INV_APPR_THRESHOLD 220
-
-#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 1752
-#define MU_DIVAPPR_Q_THRESHOLD 1718
-#define MUPI_DIV_QR_THRESHOLD 102
-#define MU_BDIV_QR_THRESHOLD 1528
-#define MU_BDIV_Q_THRESHOLD 1718
-
-#define POWM_SEC_TABLE 1,22,110,624,1985
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#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 268
-#define SET_STR_PRECOMPUTE_THRESHOLD 1718
-
-#define FAC_DSC_THRESHOLD 1075
-#define FAC_ODD_THRESHOLD 23
diff --git a/gmp/mpn/x86_64/k10/hamdist.asm b/gmp/mpn/x86_64/k10/hamdist.asm
deleted file mode 100644
index 44b67b5e4e..0000000000
--- a/gmp/mpn/x86_64/k10/hamdist.asm
+++ /dev/null
@@ -1,103 +0,0 @@
-dnl AMD64 mpn_hamdist -- hamming distance.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 2
-C Intel P4 n/a
-C Intel core2 n/a
-C Intel corei 2.05
-C Intel atom n/a
-C VIA nano n/a
-
-C This is very straightforward 2-way unrolled code.
-
-C TODO
-C * Write something less basic. It should not be hard to reach 1.5 c/l with
-C 4-way unrolling.
-
-define(`ap', `%rdi')
-define(`bp', `%rsi')
-define(`n', `%rdx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_hamdist)
- FUNC_ENTRY(3)
- mov (ap), %r8
- xor (bp), %r8
-
- lea (ap,n,8), ap C point at A operand end
- lea (bp,n,8), bp C point at B operand end
- neg n
-
- bt $0, R32(n)
- jnc L(2)
-
-L(1): .byte 0xf3,0x49,0x0f,0xb8,0xc0 C popcnt %r8, %rax
- xor R32(%r10), R32(%r10)
- add $1, n
- js L(top)
- FUNC_EXIT()
- ret
-
- ALIGN(16)
-L(2): mov 8(ap,n,8), %r9
- .byte 0xf3,0x49,0x0f,0xb8,0xc0 C popcnt %r8, %rax
- xor 8(bp,n,8), %r9
- .byte 0xf3,0x4d,0x0f,0xb8,0xd1 C popcnt %r9, %r10
- add $2, n
- js L(top)
- lea (%r10, %rax), %rax
- FUNC_EXIT()
- ret
-
- ALIGN(16)
-L(top): mov (ap,n,8), %r8
- lea (%r10, %rax), %rax
- mov 8(ap,n,8), %r9
- xor (bp,n,8), %r8
- xor 8(bp,n,8), %r9
- .byte 0xf3,0x49,0x0f,0xb8,0xc8 C popcnt %r8, %rcx
- lea (%rcx, %rax), %rax
- .byte 0xf3,0x4d,0x0f,0xb8,0xd1 C popcnt %r9, %r10
- add $2, n
- js L(top)
-
- lea (%r10, %rax), %rax
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/k10/lshift.asm b/gmp/mpn/x86_64/k10/lshift.asm
deleted file mode 100644
index a1cbc31f61..0000000000
--- a/gmp/mpn/x86_64/k10/lshift.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_lshift)
-include_mpn(`x86_64/fastsse/lshift-movdqu2.asm')
diff --git a/gmp/mpn/x86_64/k10/lshiftc.asm b/gmp/mpn/x86_64/k10/lshiftc.asm
deleted file mode 100644
index ac90edb76b..0000000000
--- a/gmp/mpn/x86_64/k10/lshiftc.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_lshiftc)
-include_mpn(`x86_64/fastsse/lshiftc-movdqu2.asm')
diff --git a/gmp/mpn/x86_64/k10/popcount.asm b/gmp/mpn/x86_64/k10/popcount.asm
deleted file mode 100644
index 3814aeabf4..0000000000
--- a/gmp/mpn/x86_64/k10/popcount.asm
+++ /dev/null
@@ -1,138 +0,0 @@
-dnl AMD64 mpn_popcount -- population count.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.125
-C Intel P4 n/a
-C Intel core2 n/a
-C Intel corei 1.25
-C Intel atom n/a
-C VIA nano n/a
-
-C * The zero-offset of popcount is misassembled to the offset-less form, which
-C is one byte shorter and therefore will mess up the switching code.
-C * The outdated gas used in FreeBSD and NetBSD cannot handle the POPCNT insn,
-C which is the main reason for our usage of '.byte'.
-
-C TODO
-C * Improve switching code, the current code sucks.
-
-define(`up', `%rdi')
-define(`n', `%rsi')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_popcount)
- FUNC_ENTRY(2)
-
-ifelse(1,1,`
- lea (up,n,8), up
-
-C mov R32(n), R32(%rcx)
-C neg R32(%rcx)
- imul $-1, R32(n), R32(%rcx)
- and $8-1, R32(%rcx)
-
- neg n
-
- mov R32(%rcx), R32(%rax)
- neg %rax
- lea (up,%rax,8),up
-
- xor R32(%rax), R32(%rax)
-
- lea (%rcx,%rcx,4), %rcx
-
- lea L(top)(%rip), %rdx
- lea (%rdx,%rcx,2), %rdx
- jmp *%rdx
-',`
- lea (up,n,8), up
-
- mov R32(n), R32(%rcx)
- neg R32(%rcx)
- and $8-1, R32(%rcx)
-
- neg n
-
- mov R32(%rcx), R32(%rax)
- shl $3, R32(%rax)
- sub %rax, up
-
- xor R32(%rax), R32(%rax)
-
-C add R32(%rcx), R32(%rcx) C 2x
-C lea (%rcx,%rcx,4), %rcx C 10x
- imul $10, R32(%rcx)
-
- lea L(top)(%rip), %rdx
- add %rcx, %rdx
- jmp *%rdx
-')
-
- ALIGN(32)
-L(top):
-C 0 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x44,0xf7,0x00 C popcnt 0(up,n,8), %r8
- add %r8, %rax
-C 7 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xf7,0x08 C popcnt 8(up,n,8), %r9
- add %r9, %rax
-C 6 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x44,0xf7,0x10 C popcnt 16(up,n,8), %r8
- add %r8, %rax
-C 5 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xf7,0x18 C popcnt 24(up,n,8), %r9
- add %r9, %rax
-C 4 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x44,0xf7,0x20 C popcnt 32(up,n,8), %r8
- add %r8, %rax
-C 3 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xf7,0x28 C popcnt 40(up,n,8), %r9
- add %r9, %rax
-C 2 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x44,0xf7,0x30 C popcnt 48(up,n,8), %r8
- add %r8, %rax
-C 1 = n mod 8
- .byte 0xf3,0x4c,0x0f,0xb8,0x4c,0xf7,0x38 C popcnt 56(up,n,8), %r9
- add %r9, %rax
-
- add $8, n
- js L(top)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/k10/rshift.asm b/gmp/mpn/x86_64/k10/rshift.asm
deleted file mode 100644
index 4c1c0d4cde..0000000000
--- a/gmp/mpn/x86_64/k10/rshift.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_rshift)
-include_mpn(`x86_64/fastsse/rshift-movdqu2.asm')
diff --git a/gmp/mpn/x86_64/k10/sec_tabselect.asm b/gmp/mpn/x86_64/k10/sec_tabselect.asm
deleted file mode 100644
index e4360341d9..0000000000
--- a/gmp/mpn/x86_64/k10/sec_tabselect.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/k8/aorrlsh_n.asm b/gmp/mpn/x86_64/k8/aorrlsh_n.asm
deleted file mode 100644
index ff3a1842fd..0000000000
--- a/gmp/mpn/x86_64/k8/aorrlsh_n.asm
+++ /dev/null
@@ -1,217 +0,0 @@
-dnl AMD64 mpn_addlsh_n and mpn_rsblsh_n. R = V2^k +- U.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.87 < 3.85 for lshift + add_n
-C AMD K10 2.75 < 3.85 for lshift + add_n
-C Intel P4 22 > 7.33 for lshift + add_n
-C Intel core2 4.1 > 3.27 for lshift + add_n
-C Intel NHM 4.4 > 3.75 for lshift + add_n
-C Intel SBR 3.17 < 3.46 for lshift + add_n
-C Intel atom ? ? 8.75 for lshift + add_n
-C VIA nano 4.7 < 6.25 for lshift + add_n
-
-C TODO
-C * Can we propagate carry into rdx instead of using a special carry register?
-C That could save enough insns to get to 10 cycles/iteration.
-
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp_param', `%rdx')
-define(`n_param', `%rcx')
-define(`cnt', `%r8')
-
-define(`vp', `%r12')
-define(`n', `%rbp')
-
-ifdef(`OPERATION_addlsh_n',`
- define(ADDSUB, `add')
- define(ADCSBB, `adc')
- define(func, mpn_addlsh_n)
-')
-ifdef(`OPERATION_rsblsh_n',`
- define(ADDSUB, `sub')
- define(ADCSBB, `sbb')
- define(func, mpn_rsblsh_n)
-')
-
-MULFUNC_PROLOGUE(mpn_addlsh_n mpn_rsblsh_n)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ')
- push %r12
- push %rbp
- push %rbx
-
- mov (vp_param), %rax C load first V limb early
-
- mov $0, R32(n)
- sub n_param, n
-
- lea -16(up,n_param,8), up
- lea -16(rp,n_param,8), rp
- lea 16(vp_param,n_param,8), vp
-
- mov n_param, %r9
-
- mov %r8, %rcx
- mov $1, R32(%r8)
- shl R8(%rcx), %r8
-
- mul %r8 C initial multiply
-
- and $3, R32(%r9)
- jz L(b0)
- cmp $2, R32(%r9)
- jc L(b1)
- jz L(b2)
-
-L(b3): mov %rax, %r11
- ADDSUB 16(up,n,8), %r11
- mov -8(vp,n,8), %rax
- sbb R32(%rcx), R32(%rcx)
- mov %rdx, %rbx
- mul %r8
- or %rax, %rbx
- mov (vp,n,8), %rax
- mov %rdx, %r9
- mul %r8
- or %rax, %r9
- add $3, n
- jnz L(lo3)
- jmp L(cj3)
-
-L(b2): mov %rax, %rbx
- mov -8(vp,n,8), %rax
- mov %rdx, %r9
- mul %r8
- or %rax, %r9
- add $2, n
- jz L(cj2)
- mov %rdx, %r10
- mov -16(vp,n,8), %rax
- mul %r8
- or %rax, %r10
- xor R32(%rcx), R32(%rcx) C clear carry register
- jmp L(lo2)
-
-L(b1): mov %rax, %r9
- mov %rdx, %r10
- add $1, n
- jnz L(gt1)
- ADDSUB 8(up,n,8), %r9
- jmp L(cj1)
-L(gt1): mov -16(vp,n,8), %rax
- mul %r8
- or %rax, %r10
- mov %rdx, %r11
- mov -8(vp,n,8), %rax
- mul %r8
- or %rax, %r11
- ADDSUB 8(up,n,8), %r9
- ADCSBB 16(up,n,8), %r10
- ADCSBB 24(up,n,8), %r11
- mov (vp,n,8), %rax
- sbb R32(%rcx), R32(%rcx)
- jmp L(lo1)
-
-L(b0): mov %rax, %r10
- mov %rdx, %r11
- mov -8(vp,n,8), %rax
- mul %r8
- or %rax, %r11
- ADDSUB 16(up,n,8), %r10
- ADCSBB 24(up,n,8), %r11
- mov (vp,n,8), %rax
- sbb R32(%rcx), R32(%rcx)
- mov %rdx, %rbx
- mul %r8
- or %rax, %rbx
- mov 8(vp,n,8), %rax
- add $4, n
- jz L(end)
-
- ALIGN(8)
-L(top): mov %rdx, %r9
- mul %r8
- or %rax, %r9
- mov %r10, -16(rp,n,8)
-L(lo3): mov %rdx, %r10
- mov -16(vp,n,8), %rax
- mul %r8
- or %rax, %r10
- mov %r11, -8(rp,n,8)
-L(lo2): mov %rdx, %r11
- mov -8(vp,n,8), %rax
- mul %r8
- or %rax, %r11
- add R32(%rcx), R32(%rcx)
- ADCSBB (up,n,8), %rbx
- ADCSBB 8(up,n,8), %r9
- ADCSBB 16(up,n,8), %r10
- ADCSBB 24(up,n,8), %r11
- mov (vp,n,8), %rax
- sbb R32(%rcx), R32(%rcx)
- mov %rbx, (rp,n,8)
-L(lo1): mov %rdx, %rbx
- mul %r8
- or %rax, %rbx
- mov %r9, 8(rp,n,8)
-L(lo0): mov 8(vp,n,8), %rax
- add $4, n
- jnz L(top)
-
-L(end): mov %rdx, %r9
- mul %r8
- or %rax, %r9
- mov %r10, -16(rp,n,8)
-L(cj3): mov %r11, -8(rp,n,8)
-L(cj2): add R32(%rcx), R32(%rcx)
- ADCSBB (up,n,8), %rbx
- ADCSBB 8(up,n,8), %r9
- mov %rbx, (rp,n,8)
-L(cj1): mov %r9, 8(rp,n,8)
- mov %rdx, %rax
- ADCSBB $0, %rax
- pop %rbx
- pop %rbp
- pop %r12
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/k8/div_qr_1n_pi1.asm b/gmp/mpn/x86_64/k8/div_qr_1n_pi1.asm
deleted file mode 100644
index 861402b222..0000000000
--- a/gmp/mpn/x86_64/k8/div_qr_1n_pi1.asm
+++ /dev/null
@@ -1,249 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/k8/gmp-mparam.h b/gmp/mpn/x86_64/k8/gmp-mparam.h
deleted file mode 100644
index df78c38923..0000000000
--- a/gmp/mpn/x86_64/k8/gmp-mparam.h
+++ /dev/null
@@ -1,236 +0,0 @@
-/* AMD K8 gmp-mparam.h -- Compiler/machine parameter header file.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-
-// #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 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 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 28
-#define MUL_TOOM33_THRESHOLD 81
-#define MUL_TOOM44_THRESHOLD 242
-#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 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 129
-#define SQR_TOOM4_THRESHOLD 527
-#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 22
-
-#define MUL_FFT_MODF_THRESHOLD 654 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 654, 5}, { 21, 6}, { 11, 5}, { 23, 6}, \
- { 12, 5}, { 25, 6}, { 13, 5}, { 27, 6}, \
- { 15, 5}, { 31, 6}, { 27, 7}, { 15, 6}, \
- { 31, 7}, { 19, 6}, { 39, 7}, { 29, 8}, \
- { 15, 7}, { 33, 8}, { 17, 7}, { 37, 8}, \
- { 19, 7}, { 39, 8}, { 23, 7}, { 47, 8}, \
- { 25, 7}, { 51, 8}, { 43, 9}, { 23, 8}, \
- { 51, 9}, { 27, 8}, { 57, 9}, { 31, 8}, \
- { 65, 9}, { 35, 8}, { 71, 9}, { 39, 8}, \
- { 79, 9}, { 43,10}, { 23, 9}, { 59, 8}, \
- { 119,10}, { 31, 8}, { 125, 9}, { 71,10}, \
- { 39, 9}, { 87,10}, { 47, 9}, { 99,10}, \
- { 55, 9}, { 123,11}, { 31,10}, { 63, 9}, \
- { 131,10}, { 71, 9}, { 143,10}, { 79, 9}, \
- { 159,10}, { 87,11}, { 47,10}, { 119,11}, \
- { 63,10}, { 143,11}, { 79,10}, { 175,11}, \
- { 95,10}, { 199,11}, { 111,10}, { 223,12}, \
- { 63,11}, { 143,10}, { 287, 9}, { 575,10}, \
- { 295,11}, { 159,10}, { 319,11}, { 175,12}, \
- { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
- { 415, 9}, { 831,11}, { 223,10}, { 447,13}, \
- { 63,12}, { 127,11}, { 255,10}, { 511,11}, \
- { 271,10}, { 543, 9}, { 1087,11}, { 287,10}, \
- { 575, 9}, { 1151,12}, { 159,11}, { 319,10}, \
- { 639,11}, { 335,10}, { 671,11}, { 351,10}, \
- { 703,11}, { 367,12}, { 191,11}, { 383,10}, \
- { 767,11}, { 399,10}, { 799,11}, { 415,10}, \
- { 831,12}, { 223,11}, { 447,10}, { 895,11}, \
- { 479,13}, { 127,12}, { 255,11}, { 511,10}, \
- { 1023,11}, { 543,10}, { 1087,12}, { 287,11}, \
- { 575,10}, { 1151,11}, { 607,12}, { 319,11}, \
- { 639,10}, { 1279,11}, { 671,12}, { 351,11}, \
- { 703,10}, { 1407,13}, { 191,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,12}, { 447,11}, \
- { 895,12}, { 479,11}, { 959,14}, { 127,13}, \
- { 255,12}, { 511,11}, { 1023,12}, { 543,11}, \
- { 1087,12}, { 575,11}, { 1151,12}, { 607,11}, \
- { 1215,13}, { 319,12}, { 671,11}, { 1343,12}, \
- { 735,13}, { 383,12}, { 799,11}, { 1599,12}, \
- { 863,13}, { 447,12}, { 895,11}, { 1791,12}, \
- { 991,13}, { 511,12}, { 1087,13}, { 575,12}, \
- { 1215,13}, { 639,12}, { 1343,13}, { 703,12}, \
- { 1471,14}, { 383,13}, { 767,12}, { 1599,13}, \
- { 831,12}, { 1663,13}, { 895,12}, { 1791,13}, \
- { 959,12}, { 1919,14}, { 511,13}, { 1087,12}, \
- { 2175,13}, { 1215,14}, { 639,13}, { 1471,14}, \
- { 767,13}, { 1663,14}, { 895,13}, { 1919,15}, \
- { 511,14}, { 1023,13}, { 2175,14}, { 1151,13}, \
- { 2367,14}, { 1279,13}, { 2559,14}, { 1407,15}, \
- { 32768,16}, { 65536,17}, { 131072,18}, { 262144,19}, \
- { 524288,20}, {1048576,21}, {2097152,22}, {4194304,23}, \
- {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 205
-#define MUL_FFT_THRESHOLD 11520
-
-#define SQR_FFT_MODF_THRESHOLD 570 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 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}, \
- { 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}, \
- { 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}, { 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 61
-#define MULLO_MUL_N_THRESHOLD 22906
-
-#define DC_DIV_QR_THRESHOLD 51
-#define DC_DIVAPPR_Q_THRESHOLD 264
-#define DC_BDIV_QR_THRESHOLD 38
-#define DC_BDIV_Q_THRESHOLD 170
-
-#define INV_MULMOD_BNM1_THRESHOLD 67
-#define INV_NEWTON_THRESHOLD 246
-#define INV_APPR_THRESHOLD 244
-
-#define BINV_NEWTON_THRESHOLD 252
-#define REDC_1_TO_REDC_2_THRESHOLD 35
-#define REDC_2_TO_REDC_N_THRESHOLD 84
-
-#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 2,16,194,904,2177
-
-#define MATRIX22_STRASSEN_THRESHOLD 21
-#define HGCD_THRESHOLD 148
-#define HGCD_APPR_THRESHOLD 185
-#define HGCD_REDUCE_THRESHOLD 4120
-#define GCD_DC_THRESHOLD 562
-#define GCDEXT_DC_THRESHOLD 501
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 17
-#define GET_STR_PRECOMPUTE_THRESHOLD 29
-#define SET_STR_DC_THRESHOLD 268
-#define SET_STR_PRECOMPUTE_THRESHOLD 1787
-
-#define FAC_DSC_THRESHOLD 1240
-#define FAC_ODD_THRESHOLD 0 /* always */
diff --git a/gmp/mpn/x86_64/k8/mullo_basecase.asm b/gmp/mpn/x86_64/k8/mullo_basecase.asm
deleted file mode 100644
index fa00f4234a..0000000000
--- a/gmp/mpn/x86_64/k8/mullo_basecase.asm
+++ /dev/null
@@ -1,436 +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
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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/gmp/mpn/x86_64/k8/mulmid_basecase.asm b/gmp/mpn/x86_64/k8/mulmid_basecase.asm
deleted file mode 100644
index 86f1414ed8..0000000000
--- a/gmp/mpn/x86_64/k8/mulmid_basecase.asm
+++ /dev/null
@@ -1,559 +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
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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/gmp/mpn/x86_64/k8/redc_1.asm b/gmp/mpn/x86_64/k8/redc_1.asm
deleted file mode 100644
index 74538986f9..0000000000
--- a/gmp/mpn/x86_64/k8/redc_1.asm
+++ /dev/null
@@ -1,590 +0,0 @@
-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/gmp/mpn/x86_64/logops_n.asm b/gmp/mpn/x86_64/logops_n.asm
index b277f58962..1022b61376 100644
--- a/gmp/mpn/x86_64/logops_n.asm
+++ b/gmp/mpn/x86_64/logops_n.asm
@@ -1,45 +1,30 @@
dnl AMD64 logops.
-dnl Copyright 2004-2006, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2004, 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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 1.5 with fluctuations for variant 2 and 3
-C AMD K10 1.5 with fluctuations for all variants
-C Intel P4 2.8/3.35/3.60 (variant1/variant2/variant3)
-C Intel core2 2
-C Intel NHM 2
-C Intel SBR 1.5/1.75/1.75
-C Intel atom 3.75
-C VIA nano 3.25
+C K8,K9: 1.5
+C K10: 1.75-2 (fluctuating)
+C P4: 2.8/3.35/3.60 (variant1/variant2/variant3)
+C P6-15: 2.0
ifdef(`OPERATION_and_n',`
define(`func',`mpn_and_n')
@@ -83,8 +68,6 @@ define(`up',`%rsi')
define(`vp',`%rdx')
define(`n',`%rcx')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
ASM_START()
@@ -92,16 +75,15 @@ ifdef(`VARIANT_1',`
TEXT
ALIGN(32)
PROLOGUE(func)
- FUNC_ENTRY(4)
movq (vp), %r8
- movl R32(%rcx), R32(%rax)
+ movl %ecx, %eax
leaq (vp,n,8), vp
leaq (up,n,8), up
leaq (rp,n,8), rp
negq n
- andl $3, R32(%rax)
+ andl $3, %eax
je L(b00)
- cmpl $2, R32(%rax)
+ cmpl $2, %eax
jc L(b01)
je L(b10)
@@ -131,8 +113,7 @@ L(e10): movq 24(vp,n,8), %r9
movq %r9, 24(rp,n,8)
addq $4, n
jnc L(oop)
-L(ret): FUNC_EXIT()
- ret
+L(ret): ret
EPILOGUE()
')
@@ -140,17 +121,16 @@ ifdef(`VARIANT_2',`
TEXT
ALIGN(32)
PROLOGUE(func)
- FUNC_ENTRY(4)
movq (vp), %r8
notq %r8
- movl R32(%rcx), R32(%rax)
+ movl %ecx, %eax
leaq (vp,n,8), vp
leaq (up,n,8), up
leaq (rp,n,8), rp
negq n
- andl $3, R32(%rax)
+ andl $3, %eax
je L(b00)
- cmpl $2, R32(%rax)
+ cmpl $2, %eax
jc L(b01)
je L(b10)
@@ -184,8 +164,7 @@ L(e10): movq 24(vp,n,8), %r9
movq %r9, 24(rp,n,8)
addq $4, n
jnc L(oop)
-L(ret): FUNC_EXIT()
- ret
+L(ret): ret
EPILOGUE()
')
@@ -193,16 +172,15 @@ ifdef(`VARIANT_3',`
TEXT
ALIGN(32)
PROLOGUE(func)
- FUNC_ENTRY(4)
movq (vp), %r8
- movl R32(%rcx), R32(%rax)
+ movl %ecx, %eax
leaq (vp,n,8), vp
leaq (up,n,8), up
leaq (rp,n,8), rp
negq n
- andl $3, R32(%rax)
+ andl $3, %eax
je L(b00)
- cmpl $2, R32(%rax)
+ cmpl $2, %eax
jc L(b01)
je L(b10)
@@ -238,7 +216,6 @@ L(e10): movq 24(vp,n,8), %r9
movq %r9, 24(rp,n,8)
addq $4, n
jnc L(oop)
-L(ret): FUNC_EXIT()
- ret
+L(ret): ret
EPILOGUE()
')
diff --git a/gmp/mpn/x86_64/lshift.asm b/gmp/mpn/x86_64/lshift.asm
index f368944b85..11fe59c24e 100644
--- a/gmp/mpn/x86_64/lshift.asm
+++ b/gmp/mpn/x86_64/lshift.asm
@@ -1,45 +1,31 @@
dnl AMD64 mpn_lshift -- mpn left shift.
-dnl Copyright 2003, 2005, 2007, 2009, 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 Copyright 2003, 2005, 2007 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 cycles/limb cnt=1
-C AMD K8,K9 2.375 1.375
-C AMD K10 2.375 1.375
-C Intel P4 8 10.5
-C Intel core2 2.11 4.28
-C Intel corei ? ?
-C Intel atom 5.75 3.5
-C VIA nano 3.5 2.25
+C K8,K9: 2.375 1.375
+C K10: 2.375 1.375
+C P4: 8 10.5
+C P6-15 (Core2): 2.11 4.28
+C P6-28 (Atom): 5.75 3.5
C INPUT PARAMETERS
@@ -48,19 +34,15 @@ define(`up', `%rsi')
define(`n', `%rdx')
define(`cnt', `%rcx')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_lshift)
- FUNC_ENTRY(4)
- cmp $1, R8(%rcx)
+ cmp $1, %cl
jne L(gen)
C For cnt=1 we want to work from lowest limb towards higher limbs.
-C Check for bad overlap (up=rp is OK!) up=rp+1..rp+n-1 is bad.
+C Check for bad overlap (up=rp is OK!) up=1..rp+n-1 is bad.
C FIXME: this could surely be done more cleverly.
mov rp, %rax
@@ -95,30 +77,27 @@ L(t1): mov (up), %r8
dec n
jne L(t1)
- inc R32(%rax)
- dec R32(%rax)
+ inc %eax
+ dec %eax
jne L(n00)
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
+ adc %eax, %eax
ret
-L(e1): test R32(%rax), R32(%rax) C clear cy
+L(e1): test %eax, %eax C clear cy
L(n00): mov (up), %r8
- dec R32(%rax)
+ dec %eax
jne L(n01)
adc %r8, %r8
mov %r8, (rp)
-L(ret): adc R32(%rax), R32(%rax)
- FUNC_EXIT()
+L(ret): adc %eax, %eax
ret
-L(n01): dec R32(%rax)
+L(n01): dec %eax
mov 8(up), %r9
jne L(n10)
adc %r8, %r8
adc %r9, %r9
mov %r8, (rp)
mov %r9, 8(rp)
- adc R32(%rax), R32(%rax)
- FUNC_EXIT()
+ adc %eax, %eax
ret
L(n10): mov 16(up), %r10
adc %r8, %r8
@@ -127,15 +106,14 @@ L(n10): mov 16(up), %r10
mov %r8, (rp)
mov %r9, 8(rp)
mov %r10, 16(rp)
- adc $-1, R32(%rax)
- FUNC_EXIT()
+ adc $-1, %eax
ret
-L(gen): neg R32(%rcx) C put rsh count in cl
+L(gen): neg %ecx C put rsh count in cl
mov -8(up,n,8), %rax
- shr R8(%rcx), %rax C function return value
+ shr %cl, %rax C function return value
- neg R32(%rcx) C put lsh count in cl
+ neg %ecx C put lsh count in cl
lea 1(n), R32(%r8)
and $3, R32(%r8)
je L(rlx) C jump for n = 3, 7, 11, ...
@@ -144,10 +122,10 @@ L(gen): neg R32(%rcx) C put rsh count in cl
jne L(1)
C n = 4, 8, 12, ...
mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
- neg R32(%rcx) C put rsh count in cl
+ shl %cl, %r10
+ neg %ecx C put rsh count in cl
mov -16(up,n,8), %r8
- shr R8(%rcx), %r8
+ shr %cl, %r8
or %r8, %r10
mov %r10, -8(rp,n,8)
dec n
@@ -157,91 +135,90 @@ L(1): dec R32(%r8)
je L(1x) C jump for n = 1, 5, 9, 13, ...
C n = 2, 6, 10, 16, ...
mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
- neg R32(%rcx) C put rsh count in cl
+ shl %cl, %r10
+ neg %ecx C put rsh count in cl
mov -16(up,n,8), %r8
- shr R8(%rcx), %r8
+ shr %cl, %r8
or %r8, %r10
mov %r10, -8(rp,n,8)
dec n
- neg R32(%rcx) C put lsh count in cl
+ neg %ecx C put lsh count in cl
L(1x):
cmp $1, n
je L(ast)
mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
+ shl %cl, %r10
mov -16(up,n,8), %r11
- shl R8(%rcx), %r11
- neg R32(%rcx) C put rsh count in cl
+ shl %cl, %r11
+ neg %ecx C put rsh count in cl
mov -16(up,n,8), %r8
mov -24(up,n,8), %r9
- shr R8(%rcx), %r8
+ shr %cl, %r8
or %r8, %r10
- shr R8(%rcx), %r9
+ shr %cl, %r9
or %r9, %r11
mov %r10, -8(rp,n,8)
mov %r11, -16(rp,n,8)
sub $2, n
-L(rll): neg R32(%rcx) C put lsh count in cl
+L(rll): neg %ecx C put lsh count in cl
L(rlx): mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
+ shl %cl, %r10
mov -16(up,n,8), %r11
- shl R8(%rcx), %r11
+ shl %cl, %r11
sub $4, n C 4
jb L(end) C 2
ALIGN(16)
L(top):
C finish stuff from lsh block
- neg R32(%rcx) C put rsh count in cl
+ neg %ecx C put rsh count in cl
mov 16(up,n,8), %r8
mov 8(up,n,8), %r9
- shr R8(%rcx), %r8
+ shr %cl, %r8
or %r8, %r10
- shr R8(%rcx), %r9
+ shr %cl, %r9
or %r9, %r11
mov %r10, 24(rp,n,8)
mov %r11, 16(rp,n,8)
C start two new rsh
mov 0(up,n,8), %r8
mov -8(up,n,8), %r9
- shr R8(%rcx), %r8
- shr R8(%rcx), %r9
+ shr %cl, %r8
+ shr %cl, %r9
C finish stuff from rsh block
- neg R32(%rcx) C put lsh count in cl
+ neg %ecx C put lsh count in cl
mov 8(up,n,8), %r10
mov 0(up,n,8), %r11
- shl R8(%rcx), %r10
+ shl %cl, %r10
or %r10, %r8
- shl R8(%rcx), %r11
+ shl %cl, %r11
or %r11, %r9
mov %r8, 8(rp,n,8)
mov %r9, 0(rp,n,8)
C start two new lsh
mov -8(up,n,8), %r10
mov -16(up,n,8), %r11
- shl R8(%rcx), %r10
- shl R8(%rcx), %r11
+ shl %cl, %r10
+ shl %cl, %r11
sub $4, n
jae L(top) C 2
L(end):
- neg R32(%rcx) C put rsh count in cl
- mov 8(up), %r8
- shr R8(%rcx), %r8
+ neg %ecx C put rsh count in cl
+ mov 16(up,n,8), %r8
+ shr %cl, %r8
or %r8, %r10
- mov (up), %r9
- shr R8(%rcx), %r9
+ mov 8(up,n,8), %r9
+ shr %cl, %r9
or %r9, %r11
- mov %r10, 16(rp)
- mov %r11, 8(rp)
+ mov %r10, 24(rp,n,8)
+ mov %r11, 16(rp,n,8)
- neg R32(%rcx) C put lsh count in cl
+ neg %ecx C put lsh count in cl
L(ast): mov (up), %r10
- shl R8(%rcx), %r10
+ shl %cl, %r10
mov %r10, (rp)
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/lshiftc.asm b/gmp/mpn/x86_64/lshiftc.asm
deleted file mode 100644
index c4ba04a173..0000000000
--- a/gmp/mpn/x86_64/lshiftc.asm
+++ /dev/null
@@ -1,182 +0,0 @@
-dnl AMD64 mpn_lshiftc -- mpn left shift with complement.
-
-dnl Copyright 2003, 2005, 2006, 2009, 2011, 2012 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library.
-dnl
-dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-
-C cycles/limb
-C AMD K8,K9 2.75
-C AMD K10 2.75
-C Intel P4 ?
-C Intel core2 ?
-C Intel corei ?
-C Intel atom ?
-C VIA nano 3.75
-
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`n', `%rdx')
-define(`cnt', `%rcx')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_lshiftc)
- FUNC_ENTRY(4)
- neg R32(%rcx) C put rsh count in cl
- mov -8(up,n,8), %rax
- shr R8(%rcx), %rax C function return value
-
- neg R32(%rcx) C put lsh count in cl
- lea 1(n), R32(%r8)
- and $3, R32(%r8)
- je L(rlx) C jump for n = 3, 7, 11, ...
-
- dec R32(%r8)
- jne L(1)
-C n = 4, 8, 12, ...
- mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
- neg R32(%rcx) C put rsh count in cl
- mov -16(up,n,8), %r8
- shr R8(%rcx), %r8
- or %r8, %r10
- not %r10
- mov %r10, -8(rp,n,8)
- dec n
- jmp L(rll)
-
-L(1): dec R32(%r8)
- je L(1x) C jump for n = 1, 5, 9, 13, ...
-C n = 2, 6, 10, 16, ...
- mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
- neg R32(%rcx) C put rsh count in cl
- mov -16(up,n,8), %r8
- shr R8(%rcx), %r8
- or %r8, %r10
- not %r10
- mov %r10, -8(rp,n,8)
- dec n
- neg R32(%rcx) C put lsh count in cl
-L(1x):
- cmp $1, n
- je L(ast)
- mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
- mov -16(up,n,8), %r11
- shl R8(%rcx), %r11
- neg R32(%rcx) C put rsh count in cl
- mov -16(up,n,8), %r8
- mov -24(up,n,8), %r9
- shr R8(%rcx), %r8
- or %r8, %r10
- shr R8(%rcx), %r9
- or %r9, %r11
- not %r10
- not %r11
- mov %r10, -8(rp,n,8)
- mov %r11, -16(rp,n,8)
- sub $2, n
-
-L(rll): neg R32(%rcx) C put lsh count in cl
-L(rlx): mov -8(up,n,8), %r10
- shl R8(%rcx), %r10
- mov -16(up,n,8), %r11
- shl R8(%rcx), %r11
-
- sub $4, n C 4
- jb L(end) C 2
- ALIGN(16)
-L(top):
- C finish stuff from lsh block
- neg R32(%rcx) C put rsh count in cl
- mov 16(up,n,8), %r8
- mov 8(up,n,8), %r9
- shr R8(%rcx), %r8
- or %r8, %r10
- shr R8(%rcx), %r9
- or %r9, %r11
- not %r10
- not %r11
- mov %r10, 24(rp,n,8)
- mov %r11, 16(rp,n,8)
- C start two new rsh
- mov 0(up,n,8), %r8
- mov -8(up,n,8), %r9
- shr R8(%rcx), %r8
- shr R8(%rcx), %r9
-
- C finish stuff from rsh block
- neg R32(%rcx) C put lsh count in cl
- mov 8(up,n,8), %r10
- mov 0(up,n,8), %r11
- shl R8(%rcx), %r10
- or %r10, %r8
- shl R8(%rcx), %r11
- or %r11, %r9
- not %r8
- not %r9
- mov %r8, 8(rp,n,8)
- mov %r9, 0(rp,n,8)
- C start two new lsh
- mov -8(up,n,8), %r10
- mov -16(up,n,8), %r11
- shl R8(%rcx), %r10
- shl R8(%rcx), %r11
-
- sub $4, n
- jae L(top) C 2
-L(end):
- neg R32(%rcx) C put rsh count in cl
- mov 8(up), %r8
- shr R8(%rcx), %r8
- or %r8, %r10
- mov (up), %r9
- shr R8(%rcx), %r9
- or %r9, %r11
- not %r10
- not %r11
- mov %r10, 16(rp)
- mov %r11, 8(rp)
-
- neg R32(%rcx) C put lsh count in cl
-L(ast): mov (up), %r10
- shl R8(%rcx), %r10
- not %r10
- mov %r10, (rp)
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/lshsub_n.asm b/gmp/mpn/x86_64/lshsub_n.asm
index 4d428c0bd2..dc8576b220 100644
--- a/gmp/mpn/x86_64/lshsub_n.asm
+++ b/gmp/mpn/x86_64/lshsub_n.asm
@@ -1,44 +1,30 @@
dnl AMD64 mpn_lshsub_n. R = 2^k(U - V).
-dnl Copyright 2006, 2011, 2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 3.15 (mpn_sub_n + mpn_lshift costs about 4 c/l)
-C AMD K10 3.15 (mpn_sub_n + mpn_lshift costs about 4 c/l)
-C Intel P4 16.5
-C Intel core2 4.35
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
+C K8,K9: 3.15 (mpn_sub_n + mpn_lshift costs about 4 c/l)
+C K10: 3.15 (mpn_sub_n + mpn_lshift costs about 4 c/l)
+C P4: 16.5
+C P6-15: 4.35
C This was written quickly and not optimized at all, but it runs very well on
C K8. But perhaps one could get under 3 c/l. Ideas:
@@ -53,17 +39,12 @@ define(`rp', `%rdi')
define(`up', `%rsi')
define(`vp', `%rdx')
define(`n', `%rcx')
-define(`cnt', `%r8')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+define(`cnt' `%r8')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_lshsub_n)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8d ')
push %r12
push %r13
@@ -72,32 +53,32 @@ IFDOS(` mov 56(%rsp), %r8d ')
push %rbx
mov n, %rax
- xor R32(%rbx), R32(%rbx) C clear carry save register
- mov R32(%r8), R32(%rcx) C shift count
- xor R32(%r15), R32(%r15) C limb carry
+ xor %ebx, %ebx C clear carry save register
+ mov %r8d, %ecx C shift count
+ xor %r15d, %r15d C limb carry
- mov R32(%rax), R32(%r11)
- and $3, R32(%r11)
+ mov %eax, %r11d
+ and $3, %r11d
je L(4)
- sub $1, R32(%r11)
+ sub $1, %r11d
L(oopette):
- add R32(%rbx), R32(%rbx) C restore carry flag
+ add %ebx, %ebx C restore carry flag
mov 0(up), %r8
lea 8(up), up
sbb 0(vp), %r8
mov %r8, %r12
- sbb R32(%rbx), R32(%rbx) C save carry flag
- shl R8(%rcx), %r8
+ sbb %ebx, %ebx C save carry flag
+ shl %cl, %r8
or %r15, %r8
mov %r12, %r15
lea 8(vp), vp
- neg R8(%rcx)
- shr R8(%rcx), %r15
- neg R8(%rcx)
+ neg %cl
+ shr %cl, %r15
+ neg %cl
mov %r8, 0(rp)
lea 8(rp), rp
- sub $1, R32(%r11)
+ sub $1, %r11d
jnc L(oopette)
L(4):
@@ -106,7 +87,7 @@ L(4):
ALIGN(16)
L(oop):
- add R32(%rbx), R32(%rbx) C restore carry flag
+ add %ebx, %ebx C restore carry flag
mov 0(up), %r8
mov 8(up), %r9
@@ -123,29 +104,29 @@ L(oop):
mov %r10, %r14
sbb 24(vp), %r11
- sbb R32(%rbx), R32(%rbx) C save carry flag
+ sbb %ebx, %ebx C save carry flag
- shl R8(%rcx), %r8
- shl R8(%rcx), %r9
- shl R8(%rcx), %r10
+ shl %cl, %r8
+ shl %cl, %r9
+ shl %cl, %r10
or %r15, %r8
mov %r11, %r15
- shl R8(%rcx), %r11
+ shl %cl, %r11
lea 32(vp), vp
- neg R8(%rcx)
+ neg %cl
- shr R8(%rcx), %r12
- shr R8(%rcx), %r13
- shr R8(%rcx), %r14
- shr R8(%rcx), %r15 C used next loop
+ shr %cl, %r12
+ shr %cl, %r13
+ shr %cl, %r14
+ shr %cl, %r15 C used next loop
or %r12, %r9
or %r13, %r10
or %r14, %r11
- neg R8(%rcx)
+ neg %cl
mov %r8, 0(rp)
mov %r9, 8(rp)
@@ -157,8 +138,8 @@ L(oop):
sub $4, %rax
jnc L(oop)
L(end):
- neg R32(%rbx)
- shl R8(%rcx), %rbx
+ neg %ebx
+ shl %cl, %rbx
adc %r15, %rbx
mov %rbx, %rax
pop %rbx
@@ -167,6 +148,5 @@ L(end):
pop %r13
pop %r12
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/missing-call.m4 b/gmp/mpn/x86_64/missing-call.m4
deleted file mode 100644
index c024f0ed77..0000000000
--- a/gmp/mpn/x86_64/missing-call.m4
+++ /dev/null
@@ -1,53 +0,0 @@
-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/gmp/mpn/x86_64/missing-inline.m4 b/gmp/mpn/x86_64/missing-inline.m4
deleted file mode 100644
index bd1df1313f..0000000000
--- a/gmp/mpn/x86_64/missing-inline.m4
+++ /dev/null
@@ -1,100 +0,0 @@
-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/gmp/mpn/x86_64/missing.asm b/gmp/mpn/x86_64/missing.asm
deleted file mode 100644
index 9b65c89dd4..0000000000
--- a/gmp/mpn/x86_64/missing.asm
+++ /dev/null
@@ -1,130 +0,0 @@
-
- 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)
diff --git a/gmp/mpn/x86_64/mod_1_1.asm b/gmp/mpn/x86_64/mod_1_1.asm
deleted file mode 100644
index 4a7c45a58b..0000000000
--- a/gmp/mpn/x86_64/mod_1_1.asm
+++ /dev/null
@@ -1,235 +0,0 @@
-dnl AMD64 mpn_mod_1_1p
-
-dnl Contributed to the GNU project by Torbjörn Granlund and Niels Möller.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 6
-C AMD K10 6
-C Intel P4 26
-C Intel core2 12.5
-C Intel NHM 11.3
-C Intel SBR 8.4 (slowdown, old code took 8.0)
-C Intel atom 26
-C VIA nano 13
-
-define(`B2mb', `%r10')
-define(`B2modb', `%r11')
-define(`ap', `%rdi')
-define(`n', `%rsi')
-define(`pre', `%r8')
-define(`b', `%rbx')
-
-define(`r0', `%rbp') C r1 kept in %rax
-define(`r2', `%rcx') C kept negated. Also used as shift count
-define(`t0', `%r9')
-
-C mp_limb_t
-C mpn_mod_1_1p (mp_srcptr ap, mp_size_t n, mp_limb_t b, mp_limb_t bmodb[4])
-C %rdi %rsi %rdx %rcx
-C The pre array contains bi, cnt, B1modb, B2modb
-C Note: This implementation needs B1modb only when cnt > 0
-
-C The iteration is almost as follows,
-C
-C r_2 B^3 + r_1 B^2 + r_0 B + u = r_1 B2modb + (r_0 + r_2 B2mod) B + u
-C
-C where r2 is a single bit represented as a mask. But to make sure that the
-C result fits in two limbs and a bit, carry from the addition
-C
-C r_0 + r_2 B2mod
-C
-C is handled specially. On carry, we subtract b to cancel the carry,
-C and we use instead the value
-C
-C r_0 + B2mb (mod B)
-C
-C This addition can be issued early since it doesn't depend on r2, and it is
-C the source of the cmov in the loop.
-C
-C We have the invariant that r_2 B^2 + r_1 B + r_0 < B^2 + B b
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mod_1_1p)
- FUNC_ENTRY(4)
- push %rbp
- push %rbx
- mov %rdx, b
- mov %rcx, pre
-
- mov -8(ap, n, 8), %rax
- cmp $3, n
- jnc L(first)
- mov -16(ap, n, 8), r0
- jmp L(reduce_two)
-
-L(first):
- C First iteration, no r2
- mov 24(pre), B2modb
- mul B2modb
- mov -24(ap, n, 8), r0
- add %rax, r0
- mov -16(ap, n, 8), %rax
- adc %rdx, %rax
- sbb r2, r2
- sub $4, n
- jc L(reduce_three)
-
- mov B2modb, B2mb
- sub b, B2mb
-
- ALIGN(16)
-L(top): and B2modb, r2
- lea (B2mb, r0), t0
- mul B2modb
- add r0, r2
- mov (ap, n, 8), r0
- cmovc t0, r2
- add %rax, r0
- mov r2, %rax
- adc %rdx, %rax
- sbb r2, r2
- sub $1, n
- jnc L(top)
-
-L(reduce_three):
- C Eliminate r2
- and b, r2
- sub r2, %rax
-
-L(reduce_two):
- mov 8(pre), R32(%rcx)
- test R32(%rcx), R32(%rcx)
- jz L(normalized)
-
- C Unnormalized, use B1modb to reduce to size < B (b+1)
- mulq 16(pre)
- xor t0, t0
- add %rax, r0
- adc %rdx, t0
- mov t0, %rax
-
- C Left-shift to normalize
-ifdef(`SHLD_SLOW',`
- shl R8(%rcx), %rax
- mov r0, t0
- neg R32(%rcx)
- shr R8(%rcx), t0
- or t0, %rax
- neg R32(%rcx)
-',`
- shld R8(%rcx), r0, %rax
-')
- shl R8(%rcx), r0
- jmp L(udiv)
-
-L(normalized):
- mov %rax, t0
- sub b, t0
- cmovnc t0, %rax
-
-L(udiv):
- lea 1(%rax), t0
- mulq (pre)
- add r0, %rax
- adc t0, %rdx
- imul b, %rdx
- sub %rdx, r0
- cmp r0, %rax
- lea (b, r0), %rax
- cmovnc r0, %rax
- cmp b, %rax
- jnc L(fix)
-L(ok): shr R8(%rcx), %rax
-
- pop %rbx
- pop %rbp
- FUNC_EXIT()
- ret
-L(fix): sub b, %rax
- jmp L(ok)
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(mpn_mod_1_1p_cps)
- FUNC_ENTRY(2)
- push %rbp
- bsr %rsi, %rcx
- push %rbx
- mov %rdi, %rbx
- push %r12
- xor $63, R32(%rcx)
- mov %rsi, %r12
- mov R32(%rcx), R32(%rbp)
- sal R8(%rcx), %r12
-IFSTD(` mov %r12, %rdi ') C pass parameter
-IFDOS(` mov %r12, %rcx ') C pass parameter
- CALL( mpn_invert_limb)
- neg %r12
- mov %r12, %r8
- mov %rax, (%rbx) C store bi
- mov %rbp, 8(%rbx) C store cnt
- imul %rax, %r12
- mov %r12, 24(%rbx) C store B2modb
- mov R32(%rbp), R32(%rcx)
- test R32(%rcx), R32(%rcx)
- jz L(z)
-
- mov $1, R32(%rdx)
-ifdef(`SHLD_SLOW',`
- C Destroys %rax, unlike shld. Otherwise, we could do B1modb
- C before B2modb, and get rid of the move %r12, %r8 above.
-
- shl R8(%rcx), %rdx
- neg R32(%rcx)
- shr R8(%rcx), %rax
- or %rax, %rdx
- neg R32(%rcx)
-',`
- shld R8(%rcx), %rax, %rdx
-')
- imul %rdx, %r8
- shr R8(%rcx), %r8
- mov %r8, 16(%rbx) C store B1modb
-L(z):
- pop %r12
- pop %rbx
- pop %rbp
- FUNC_EXIT()
- ret
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86_64/mod_1_2.asm b/gmp/mpn/x86_64/mod_1_2.asm
deleted file mode 100644
index 02dd917791..0000000000
--- a/gmp/mpn/x86_64/mod_1_2.asm
+++ /dev/null
@@ -1,238 +0,0 @@
-dnl AMD64 mpn_mod_1s_2p
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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
-C AMD K10 4
-C Intel P4 19
-C Intel core2 8
-C Intel NHM 6.5
-C Intel SBR 4.5
-C Intel atom 28
-C VIA nano 8
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_2p)
- FUNC_ENTRY(4)
- push %r14
- test $1, R8(%rsi)
- mov %rdx, %r14
- push %r13
- mov %rcx, %r13
- push %r12
- push %rbp
- push %rbx
- mov 16(%rcx), %r10
- mov 24(%rcx), %rbx
- mov 32(%rcx), %rbp
- je L(b0)
- dec %rsi
- je L(one)
- mov -8(%rdi,%rsi,8), %rax
- mul %r10
- mov %rax, %r9
- mov %rdx, %r8
- mov (%rdi,%rsi,8), %rax
- add -16(%rdi,%rsi,8), %r9
- adc $0, %r8
- mul %rbx
- add %rax, %r9
- adc %rdx, %r8
- jmp L(11)
-
-L(b0): mov -8(%rdi,%rsi,8), %r8
- mov -16(%rdi,%rsi,8), %r9
-
-L(11): sub $4, %rsi
- jb L(ed2)
- lea 40(%rdi,%rsi,8), %rdi
- mov -40(%rdi), %r11
- mov -32(%rdi), %rax
- jmp L(m0)
-
- ALIGN(16)
-L(top): mov -24(%rdi), %r9
- add %rax, %r11
- mov -16(%rdi), %rax
- adc %rdx, %r12
- mul %r10
- add %rax, %r9
- mov %r11, %rax
- mov %rdx, %r8
- adc $0, %r8
- mul %rbx
- add %rax, %r9
- mov %r12, %rax
- adc %rdx, %r8
- mul %rbp
- sub $2, %rsi
- jb L(ed1)
- mov -40(%rdi), %r11
- add %rax, %r9
- mov -32(%rdi), %rax
- adc %rdx, %r8
-L(m0): mul %r10
- add %rax, %r11
- mov %r9, %rax
- mov %rdx, %r12
- adc $0, %r12
- mul %rbx
- add %rax, %r11
- lea -32(%rdi), %rdi C ap -= 4
- mov %r8, %rax
- adc %rdx, %r12
- mul %rbp
- sub $2, %rsi
- jae L(top)
-
-L(ed0): mov %r11, %r9
- mov %r12, %r8
-L(ed1): add %rax, %r9
- adc %rdx, %r8
-L(ed2): mov 8(%r13), R32(%rdi) C cnt
- mov %r8, %rax
- mov %r9, %r8
- mul %r10
- add %rax, %r8
- adc $0, %rdx
-L(1): xor R32(%rcx), R32(%rcx)
- mov %r8, %r9
- sub R32(%rdi), R32(%rcx)
- shr R8(%rcx), %r9
- mov R32(%rdi), R32(%rcx)
- sal R8(%rcx), %rdx
- or %rdx, %r9
- sal R8(%rcx), %r8
- mov %r9, %rax
- mulq (%r13)
- mov %rax, %rsi
- inc %r9
- add %r8, %rsi
- adc %r9, %rdx
- imul %r14, %rdx
- sub %rdx, %r8
- lea (%r8,%r14), %rax
- cmp %r8, %rsi
- cmovc %rax, %r8
- mov %r8, %rax
- sub %r14, %rax
- cmovc %r8, %rax
- mov R32(%rdi), R32(%rcx)
- shr R8(%rcx), %rax
- pop %rbx
- pop %rbp
- pop %r12
- pop %r13
- pop %r14
- FUNC_EXIT()
- ret
-L(one):
- mov (%rdi), %r8
- mov 8(%rcx), R32(%rdi)
- xor %rdx, %rdx
- jmp L(1)
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_2p_cps)
- FUNC_ENTRY(2)
- push %rbp
- bsr %rsi, %rcx
- push %rbx
- mov %rdi, %rbx
- push %r12
- xor $63, R32(%rcx)
- mov %rsi, %r12
- mov R32(%rcx), R32(%rbp) C preserve cnt over call
- sal R8(%rcx), %r12 C b << cnt
-IFSTD(` mov %r12, %rdi ') C pass parameter
-IFDOS(` mov %r12, %rcx ') C pass parameter
- CALL( mpn_invert_limb)
- mov %r12, %r8
- mov %rax, %r11
- mov %rax, (%rbx) C store bi
- mov %rbp, 8(%rbx) C store cnt
- neg %r8
- mov R32(%rbp), R32(%rcx)
- mov $1, R32(%rsi)
-ifdef(`SHLD_SLOW',`
- shl R8(%rcx), %rsi
- neg R32(%rcx)
- mov %rax, %rbp
- shr R8(%rcx), %rax
- or %rax, %rsi
- mov %rbp, %rax
- neg R32(%rcx)
-',`
- shld R8(%rcx), %rax, %rsi C FIXME: Slow on Atom and Nano
-')
- imul %r8, %rsi
- mul %rsi
-
- add %rsi, %rdx
- shr R8(%rcx), %rsi
- mov %rsi, 16(%rbx) C store B1modb
-
- not %rdx
- imul %r12, %rdx
- lea (%rdx,%r12), %rsi
- cmp %rdx, %rax
- cmovnc %rdx, %rsi
- mov %r11, %rax
- mul %rsi
-
- add %rsi, %rdx
- shr R8(%rcx), %rsi
- mov %rsi, 24(%rbx) C store B2modb
-
- not %rdx
- imul %r12, %rdx
- add %rdx, %r12
- cmp %rdx, %rax
- cmovnc %rdx, %r12
-
- shr R8(%rcx), %r12
- mov %r12, 32(%rbx) C store B3modb
-
- pop %r12
- pop %rbx
- pop %rbp
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/mod_1_4.asm b/gmp/mpn/x86_64/mod_1_4.asm
deleted file mode 100644
index 3ce83dc42e..0000000000
--- a/gmp/mpn/x86_64/mod_1_4.asm
+++ /dev/null
@@ -1,269 +0,0 @@
-dnl AMD64 mpn_mod_1s_4p
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 3
-C AMD K10 3
-C Intel P4 15.5
-C Intel core2 5
-C Intel corei 4
-C Intel atom 23
-C VIA nano 4.75
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_4p)
- FUNC_ENTRY(4)
- push %r15
- push %r14
- push %r13
- push %r12
- push %rbp
- push %rbx
-
- mov %rdx, %r15
- mov %rcx, %r14
- mov 16(%rcx), %r11 C B1modb
- mov 24(%rcx), %rbx C B2modb
- mov 32(%rcx), %rbp C B3modb
- mov 40(%rcx), %r13 C B4modb
- mov 48(%rcx), %r12 C B5modb
- xor R32(%r8), R32(%r8)
- mov R32(%rsi), R32(%rdx)
- and $3, R32(%rdx)
- je L(b0)
- cmp $2, R32(%rdx)
- jc L(b1)
- je L(b2)
-
-L(b3): lea -24(%rdi,%rsi,8), %rdi
- mov 8(%rdi), %rax
- mul %r11
- mov (%rdi), %r9
- add %rax, %r9
- adc %rdx, %r8
- mov 16(%rdi), %rax
- mul %rbx
- jmp L(m0)
-
- ALIGN(8)
-L(b0): lea -32(%rdi,%rsi,8), %rdi
- mov 8(%rdi), %rax
- mul %r11
- mov (%rdi), %r9
- add %rax, %r9
- adc %rdx, %r8
- mov 16(%rdi), %rax
- mul %rbx
- add %rax, %r9
- adc %rdx, %r8
- mov 24(%rdi), %rax
- mul %rbp
- jmp L(m0)
-
- ALIGN(8)
-L(b1): lea -8(%rdi,%rsi,8), %rdi
- mov (%rdi), %r9
- jmp L(m1)
-
- ALIGN(8)
-L(b2): lea -16(%rdi,%rsi,8), %rdi
- mov 8(%rdi), %r8
- mov (%rdi), %r9
- jmp L(m1)
-
- ALIGN(16)
-L(top): mov -24(%rdi), %rax
- mov -32(%rdi), %r10
- mul %r11 C up[1] * B1modb
- add %rax, %r10
- mov -16(%rdi), %rax
- mov $0, R32(%rcx)
- adc %rdx, %rcx
- mul %rbx C up[2] * B2modb
- add %rax, %r10
- mov -8(%rdi), %rax
- adc %rdx, %rcx
- sub $32, %rdi
- mul %rbp C up[3] * B3modb
- add %rax, %r10
- mov %r13, %rax
- adc %rdx, %rcx
- mul %r9 C rl * B4modb
- add %rax, %r10
- mov %r12, %rax
- adc %rdx, %rcx
- mul %r8 C rh * B5modb
- mov %r10, %r9
- mov %rcx, %r8
-L(m0): add %rax, %r9
- adc %rdx, %r8
-L(m1): sub $4, %rsi
- ja L(top)
-
-L(end): mov 8(%r14), R32(%rsi)
- mov %r8, %rax
- mul %r11
- mov %rax, %r8
- add %r9, %r8
- adc $0, %rdx
- xor R32(%rcx), R32(%rcx)
- sub R32(%rsi), R32(%rcx)
- mov %r8, %rdi
- shr R8(%rcx), %rdi
- mov R32(%rsi), R32(%rcx)
- sal R8(%rcx), %rdx
- or %rdx, %rdi
- mov %rdi, %rax
- mulq (%r14)
- mov %r15, %rbx
- mov %rax, %r9
- sal R8(%rcx), %r8
- inc %rdi
- add %r8, %r9
- adc %rdi, %rdx
- imul %rbx, %rdx
- sub %rdx, %r8
- lea (%r8,%rbx), %rax
- cmp %r8, %r9
- cmovc %rax, %r8
- mov %r8, %rax
- sub %rbx, %rax
- cmovc %r8, %rax
- shr R8(%rcx), %rax
- pop %rbx
- pop %rbp
- pop %r12
- pop %r13
- pop %r14
- pop %r15
- FUNC_EXIT()
- ret
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(mpn_mod_1s_4p_cps)
- FUNC_ENTRY(2)
- push %rbp
- bsr %rsi, %rcx
- push %rbx
- mov %rdi, %rbx
- push %r12
- xor $63, R32(%rcx)
- mov %rsi, %r12
- mov R32(%rcx), R32(%rbp) C preserve cnt over call
- sal R8(%rcx), %r12 C b << cnt
-IFSTD(` mov %r12, %rdi ') C pass parameter
-IFDOS(` mov %r12, %rcx ') C pass parameter
- CALL( mpn_invert_limb)
- mov %r12, %r8
- mov %rax, %r11
- mov %rax, (%rbx) C store bi
- mov %rbp, 8(%rbx) C store cnt
- neg %r8
- mov R32(%rbp), R32(%rcx)
- mov $1, R32(%rsi)
-ifdef(`SHLD_SLOW',`
- shl R8(%rcx), %rsi
- neg R32(%rcx)
- mov %rax, %rbp
- shr R8(%rcx), %rax
- or %rax, %rsi
- mov %rbp, %rax
- neg R32(%rcx)
-',`
- shld R8(%rcx), %rax, %rsi C FIXME: Slow on Atom and Nano
-')
- imul %r8, %rsi
- mul %rsi
-
- add %rsi, %rdx
- shr R8(%rcx), %rsi
- mov %rsi, 16(%rbx) C store B1modb
-
- not %rdx
- imul %r12, %rdx
- lea (%rdx,%r12), %rsi
- cmp %rdx, %rax
- cmovnc %rdx, %rsi
- mov %r11, %rax
- mul %rsi
-
- add %rsi, %rdx
- shr R8(%rcx), %rsi
- mov %rsi, 24(%rbx) C store B2modb
-
- not %rdx
- imul %r12, %rdx
- lea (%rdx,%r12), %rsi
- cmp %rdx, %rax
- cmovnc %rdx, %rsi
- mov %r11, %rax
- mul %rsi
-
- add %rsi, %rdx
- shr R8(%rcx), %rsi
- mov %rsi, 32(%rbx) C store B3modb
-
- not %rdx
- imul %r12, %rdx
- lea (%rdx,%r12), %rsi
- cmp %rdx, %rax
- cmovnc %rdx, %rsi
- mov %r11, %rax
- mul %rsi
-
- add %rsi, %rdx
- shr R8(%rcx), %rsi
- mov %rsi, 40(%rbx) C store B4modb
-
- not %rdx
- imul %r12, %rdx
- add %rdx, %r12
- cmp %rdx, %rax
- cmovnc %rdx, %r12
-
- shr R8(%rcx), %r12
- mov %r12, 48(%rbx) C store B5modb
-
- pop %r12
- pop %rbx
- pop %rbp
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/mod_34lsub1.asm b/gmp/mpn/x86_64/mod_34lsub1.asm
index 62bdcfac69..34df5bb5b7 100644
--- a/gmp/mpn/x86_64/mod_34lsub1.asm
+++ b/gmp/mpn/x86_64/mod_34lsub1.asm
@@ -1,194 +1,155 @@
dnl AMD64 mpn_mod_34lsub1 -- remainder modulo 2^48-1.
-dnl Copyright 2000-2002, 2004, 2005, 2007, 2009-2012 Free Software Foundation,
+dnl Copyright 2000, 2001, 2002, 2004, 2005, 2007 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 This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 0.67 0.583 is possible with zero-reg instead of $0, 4-way
-C AMD K10 0.67 this seems hard to beat
-C AMD bd1 1
-C AMD bobcat 1.07
-C Intel P4 7.35 terrible, use old code
-C Intel core2 1.25 1+epsilon with huge unrolling
-C Intel NHM 1.15 this seems hard to beat
-C Intel SBR 0.93
-C Intel atom 2.5
-C VIA nano 1.25 this seems hard to beat
+C cycles/limb
+C K8,K9: 1.0
+C K10: 1.12
+C P4: 3.25
+C P6-15 (Core2): 1.5
+C P6-28 (Atom): 2.5
+
C INPUT PARAMETERS
-define(`ap', %rdi)
-define(`n', %rsi)
+C up rdi
+C n rsi
C mp_limb_t mpn_mod_34lsub1 (mp_srcptr up, mp_size_t n)
C TODO
-C * Review feed-in and wind-down code.
+C * Apply the movzwl tricks to the x86/k7 code
+C * Review feed-in and wind-down code. In particular, try to avoid adcq and
+C sbbq to placate Pentium4.
+C * More unrolling and/or index addressing could bring time to under 1 c/l
+C for Athlon64, approaching 0.67 c/l seems possible.
+C * There are recurrencies on the carry registers (r8, r9, r10) that might
+C be the limiting factor for the Pentium4 speed. Splitting these into 6
+C registers would help.
+C * For ultimate Athlon64 performance, a sequence like this might be best.
+C It should reach 0.5 c/l (limited by L1 cache bandwidth).
+C
+C addq (%rdi), %rax
+C adcq 8(%rdi), %rcx
+C adcq 16(%rdi), %rdx
+C adcq $0, %r8
+C addq 24(%rdi), %rax
+C adcq 32(%rdi), %rcx
+C adcq 40(%rdi), %rdx
+C adcq $0, %r8
+C ...
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_mod_34lsub1)
- FUNC_ENTRY(2)
mov $0x0000FFFFFFFFFFFF, %r11
- mov (ap), %rax
-
- cmp $2, %rsi
+ sub $2, %rsi
ja L(gt2)
- jb L(one)
+ mov (%rdi), %rax
+ nop
+ jb L(1)
- mov 8(ap), %rsi
+ mov 8(%rdi), %rsi
mov %rax, %rdx
shr $48, %rax C src[0] low
and %r11, %rdx C src[0] high
add %rdx, %rax
- mov R32(%rsi), R32(%rdx)
+ mov %esi, %edx
shr $32, %rsi C src[1] high
add %rsi, %rax
shl $16, %rdx C src[1] low
add %rdx, %rax
-L(one): FUNC_EXIT()
- ret
+L(1): ret
-C Don't change this, the wind-down code is not able to handle greater values
-define(UNROLL,3)
-L(gt2): mov 8(ap), %rcx
- mov 16(ap), %rdx
- xor %r9, %r9
- add $24, ap
- sub $eval(UNROLL*3+3), %rsi
- jc L(end)
ALIGN(16)
-L(top):
- add (ap), %rax
- adc 8(ap), %rcx
- adc 16(ap), %rdx
- adc $0, %r9
-forloop(i,1,UNROLL-1,`dnl
- add eval(i*24)(ap), %rax
- adc eval(i*24+8)(ap), %rcx
- adc eval(i*24+16)(ap), %rdx
- adc $0, %r9
-')dnl
- add $eval(UNROLL*24), ap
- sub $eval(UNROLL*3), %rsi
- jnc L(top)
-
-L(end):
- lea L(tab)(%rip), %r8
-ifdef(`PIC',
-` movslq 36(%r8,%rsi,4), %r10
- add %r10, %r8
- jmp *%r8
-',`
- jmp *72(%r8,%rsi,8)
-')
- JUMPTABSECT
- ALIGN(8)
-L(tab): JMPENT( L(0), L(tab))
- JMPENT( L(1), L(tab))
- JMPENT( L(2), L(tab))
- JMPENT( L(3), L(tab))
- JMPENT( L(4), L(tab))
- JMPENT( L(5), L(tab))
- JMPENT( L(6), L(tab))
- JMPENT( L(7), L(tab))
- JMPENT( L(8), L(tab))
- TEXT
+L(gt2): xor %eax, %eax
+ xor %ecx, %ecx
+ xor %edx, %edx
+ xor %r8, %r8
+ xor %r9, %r9
+ xor %r10, %r10
-L(6): add (ap), %rax
- adc 8(ap), %rcx
- adc 16(ap), %rdx
- adc $0, %r9
- add $24, ap
-L(3): add (ap), %rax
- adc 8(ap), %rcx
- adc 16(ap), %rdx
- jmp L(cj1)
-
-L(7): add (ap), %rax
- adc 8(ap), %rcx
- adc 16(ap), %rdx
+L(top): add (%rdi), %rax
+ adc $0, %r10
+ add 8(%rdi), %rcx
+ adc $0, %r8
+ add 16(%rdi), %rdx
adc $0, %r9
- add $24, ap
-L(4): add (ap), %rax
- adc 8(ap), %rcx
- adc 16(ap), %rdx
- adc $0, %r9
- add $24, ap
-L(1): add (ap), %rax
- adc $0, %rcx
- jmp L(cj2)
-
-L(8): add (ap), %rax
- adc 8(ap), %rcx
- adc 16(ap), %rdx
- adc $0, %r9
- add $24, ap
-L(5): add (ap), %rax
- adc 8(ap), %rcx
- adc 16(ap), %rdx
+
+ sub $3,%rsi
+ jng L(end)
+
+ add 24(%rdi), %rax
+ adc $0, %r10
+ add 32(%rdi), %rcx
+ adc $0, %r8
+ add 40(%rdi), %rdx
+ lea 48(%rdi), %rdi
adc $0, %r9
- add $24, ap
-L(2): add (ap), %rax
- adc 8(ap), %rcx
-L(cj2): adc $0, %rdx
-L(cj1): adc $0, %r9
-L(0): add %r9, %rax
- adc $0, %rcx
- adc $0, %rdx
- adc $0, %rax
+ sub $3,%rsi
+ jg L(top)
+
+
+ add $-24, %rdi
+L(end): add %r9, %rax
+ adc %r10, %rcx
+ adc %r8, %rdx
+
+ inc %rsi
+ mov $0x1, %r10d
+ js L(combine)
+
+ mov $0x10000, %r10d
+ adc 24(%rdi), %rax
+ dec %rsi
+ js L(combine)
+
+ adc 32(%rdi), %rcx
+ mov $0x100000000, %r10
+L(combine):
+ sbb %rsi, %rsi C carry
mov %rax, %rdi C 0mod3
shr $48, %rax C 0mod3 high
+ and %r10, %rsi C carry masked
and %r11, %rdi C 0mod3 low
- mov R32(%rcx), R32(%r10) C 1mod3
+ mov %ecx, %r10d C 1mod3
+ add %rsi, %rax C apply carry
shr $32, %rcx C 1mod3 high
add %rdi, %rax C apply 0mod3 low
- movzwl %dx, R32(%rdi) C 2mod3
+ movzwl %dx, %edi C 2mod3
shl $16, %r10 C 1mod3 low
add %rcx, %rax C apply 1mod3 high
@@ -200,6 +161,5 @@ L(0): add %r9, %rax
add %rdx, %rax C apply 2mod3 high
add %rdi, %rax C apply 2mod3 low
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/mode1o.asm b/gmp/mpn/x86_64/mode1o.asm
index 2cd2b08848..c5f2bc7990 100644
--- a/gmp/mpn/x86_64/mode1o.asm
+++ b/gmp/mpn/x86_64/mode1o.asm
@@ -1,131 +1,139 @@
-dnl AMD64 mpn_modexact_1_odd -- Hensel norm remainder.
+dnl AMD64 mpn_modexact_1_odd -- exact division style remainder.
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006 Free Software
+dnl Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 10
-C AMD K10 10
-C Intel P4 33
-C Intel core2 13
-C Intel corei 14.5
-C Intel atom 35
-C VIA nano ?
+C K8,K9: 10
+C K10: 10
+C P4: 33
+C P6-15 (Core2):13
+C P6-28 (Atom): 35
+C mp_limb_t mpn_modexact_1_odd (mp_srcptr src, mp_size_t size,
+C mp_limb_t divisor);
+C mp_limb_t mpn_modexact_1c_odd (mp_srcptr src, mp_size_t size,
+C mp_limb_t divisor, mp_limb_t carry);
+C
+C
C The dependent chain in the main loop is
C
C cycles
-C sub %rdx, %rax 1
-C imul %r9, %rax 4
-C mul %r8 5
+C subq %rdx, %rax 1
+C imulq %r9, %rax 4
+C mulq %r8 5
C ----
C total 10
C
-C The mov load from src seems to need to be scheduled back before the jz to
-C achieve this speed, out-of-order execution apparently can't completely hide
-C the latency otherwise.
+C The movq load from src seems to need to be scheduled back before the jz to
+C achieve this speed, out-of-order execution apparently can't completely
+C hide the latency otherwise.
C
-C The l=src[i]-cbit step is rotated back too, since that allows us to avoid it
-C for the first iteration (where there's no cbit).
+C The l=src[i]-cbit step is rotated back too, since that allows us to avoid
+C it for the first iteration (where there's no cbit).
C
-C The code alignment used (32-byte) for the loop also seems necessary. Without
-C that the non-PIC case has adc crossing the 0x60 offset, apparently making it
-C run at 11 cycles instead of 10.
-
+C The code alignment used (32-byte) for the loop also seems necessary.
+C Without that the non-PIC case has adcq crossing the 0x60 offset,
+C apparently making it run at 11 cycles instead of 10.
+C
+C Not done:
+C
+C divq for size==1 was measured at about 79 cycles, compared to the inverse
+C at about 25 cycles (both including function call overheads), so that's not
+C used.
+C
+C Enhancements:
+C
+C For PIC, we shouldn't really need the GOT fetch for binvert_limb_table,
+C it'll be in rodata or text in libgmp.so and can be accessed directly %rip
+C relative. This would be for small model only (something we don't
+C presently detect, but which is all that gcc 3.3.3 supports), since 8-byte
+C PC-relative relocations are apparently not available. Some rough
+C experiments with binutils 2.13 looked worrylingly like it might come out
+C with an unwanted text segment relocation though, even with ".protected".
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_modexact_1_odd)
- FUNC_ENTRY(3)
- mov $0, R32(%rcx)
-IFDOS(` jmp L(ent) ')
+
+ movl $0, %ecx
PROLOGUE(mpn_modexact_1c_odd)
- FUNC_ENTRY(4)
-L(ent):
+
C rdi src
C rsi size
C rdx divisor
C rcx carry
- mov %rdx, %r8 C d
- shr R32(%rdx) C d/2
-
- LEA( binvert_limb_table, %r9)
+ movq %rdx, %r8 C d
+ shrl %edx C d/2
+ifdef(`PIC',`
+ movq binvert_limb_table@GOTPCREL(%rip), %r9
+',`
+ movabsq $binvert_limb_table, %r9
+')
- and $127, R32(%rdx)
- mov %rcx, %r10 C initial carry
+ andl $127, %edx
+ movq %rcx, %r10 C initial carry
- movzbl (%r9,%rdx), R32(%rdx) C inv 8 bits
+ movzbl (%r9,%rdx), %edx C inv 8 bits
- mov (%rdi), %rax C src[0]
- lea (%rdi,%rsi,8), %r11 C src end
- mov %r8, %rdi C d, made available to imull
+ movq (%rdi), %rax C src[0]
+ leaq (%rdi,%rsi,8), %r11 C src end
+ movq %r8, %rdi C d, made available to imull
- lea (%rdx,%rdx), R32(%rcx) C 2*inv
- imul R32(%rdx), R32(%rdx) C inv*inv
+ leal (%rdx,%rdx), %ecx C 2*inv
+ imull %edx, %edx C inv*inv
- neg %rsi C -size
+ negq %rsi C -size
- imul R32(%rdi), R32(%rdx) C inv*inv*d
+ imull %edi, %edx C inv*inv*d
- sub R32(%rdx), R32(%rcx) C inv = 2*inv - inv*inv*d, 16 bits
+ subl %edx, %ecx C inv = 2*inv - inv*inv*d, 16 bits
- lea (%rcx,%rcx), R32(%rdx) C 2*inv
- imul R32(%rcx), R32(%rcx) C inv*inv
+ leal (%rcx,%rcx), %edx C 2*inv
+ imull %ecx, %ecx C inv*inv
- imul R32(%rdi), R32(%rcx) C inv*inv*d
+ imull %edi, %ecx C inv*inv*d
- sub R32(%rcx), R32(%rdx) C inv = 2*inv - inv*inv*d, 32 bits
- xor R32(%rcx), R32(%rcx) C initial cbit
+ subl %ecx, %edx C inv = 2*inv - inv*inv*d, 32 bits
+ xorl %ecx, %ecx C initial cbit
- lea (%rdx,%rdx), %r9 C 2*inv
- imul %rdx, %rdx C inv*inv
+ leaq (%rdx,%rdx), %r9 C 2*inv
+ imulq %rdx, %rdx C inv*inv
- imul %r8, %rdx C inv*inv*d
+ imulq %r8, %rdx C inv*inv*d
- sub %rdx, %r9 C inv = 2*inv - inv*inv*d, 64 bits
- mov %r10, %rdx C initial climb
+ subq %rdx, %r9 C inv = 2*inv - inv*inv*d, 64 bits
+ movq %r10, %rdx C initial climb
ASSERT(e,` C d*inv == 1 mod 2^64
- mov %r8, %r10
- imul %r9, %r10
- cmp $1, %r10')
+ movq %r8, %r10
+ imulq %r9, %r10
+ cmpq $1, %r10')
- inc %rsi
+ incq %rsi
jz L(one)
@@ -140,31 +148,30 @@ L(top):
C r9 inverse
C r11 src end ptr
- sub %rdx, %rax C l = src[i]-cbit - climb
+ subq %rdx, %rax C l = src[i]-cbit - climb
- adc $0, %rcx C more cbit
- imul %r9, %rax C q = l * inverse
+ adcq $0, %rcx C more cbit
+ imulq %r9, %rax C q = l * inverse
- mul %r8 C climb = high (q * d)
+ mulq %r8 C climb = high (q * d)
- mov (%r11,%rsi,8), %rax C src[i+1]
- sub %rcx, %rax C next l = src[i+1] - cbit
- setc R8(%rcx) C new cbit
+ movq (%r11,%rsi,8), %rax C src[i+1]
+ subq %rcx, %rax C next l = src[i+1] - cbit
+ setc %cl C new cbit
- inc %rsi
+ incq %rsi
jnz L(top)
L(one):
- sub %rdx, %rax C l = src[i]-cbit - climb
+ subq %rdx, %rax C l = src[i]-cbit - climb
- adc $0, %rcx C more cbit
- imul %r9, %rax C q = l * inverse
+ adcq $0, %rcx C more cbit
+ imulq %r9, %rax C q = l * inverse
- mul %r8 C climb = high (q * d)
+ mulq %r8 C climb = high (q * d)
- lea (%rcx,%rdx), %rax C climb+cbit
- FUNC_EXIT()
+ leaq (%rcx,%rdx), %rax C climb+cbit
ret
EPILOGUE(mpn_modexact_1c_odd)
diff --git a/gmp/mpn/x86_64/mul_1.asm b/gmp/mpn/x86_64/mul_1.asm
index b032afc9dd..da96a14c76 100644
--- a/gmp/mpn/x86_64/mul_1.asm
+++ b/gmp/mpn/x86_64/mul_1.asm
@@ -1,97 +1,64 @@
dnl AMD64 mpn_mul_1.
-dnl Copyright 2003-2005, 2007, 2008, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2004, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 bd1 5.0
-C AMD bobcat 5.5
-C Intel P4 12.3
-C Intel core2 4.0
-C Intel NHM 3.75
-C Intel SBR 2.95
-C Intel atom 19.8
-C VIA nano 4.25
-
-C The loop of this code is the result of running a code generation and
+C K8,K9: 2.5
+C K10: 2.5
+C P4: 12.3
+C P6-15: 4.0
+C P6-15 (Core2): 4.0
+C P6-28 (Atom): 19.8
+
+C The inner 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 TODO
-C * The loop is great, but the prologue and epilogue code was quickly written.
-C Tune it!
+C TODO:
+C * The inner loop is great, but the prologue and epilogue code was
+C quickly written. Tune it!
-define(`rp', `%rdi') C rcx
-define(`up', `%rsi') C rdx
-define(`n_param', `%rdx') C r8
-define(`vl', `%rcx') C r9
+C INPUT PARAMETERS
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`n_param',`%rdx')
+define(`vl', `%rcx')
-define(`n', `%r11')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-IFDOS(` define(`up', ``%rsi'') ') dnl
-IFDOS(` define(`rp', ``%rcx'') ') dnl
-IFDOS(` define(`vl', ``%r9'') ') dnl
-IFDOS(` define(`r9', ``rdi'') ') dnl
-IFDOS(` define(`n', ``%r8'') ') dnl
-IFDOS(` define(`r8', ``r11'') ') dnl
+define(`n', `%r11')
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_mul_1c)
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
push %rbx
-IFSTD(` mov %r8, %r10')
-IFDOS(` mov 64(%rsp), %r10') C 40 + 3*8 (3 push insns)
+ mov %r8, %r10
jmp L(common)
EPILOGUE()
PROLOGUE(mpn_mul_1)
-IFDOS(``push %rsi '')
-IFDOS(``push %rdi '')
-IFDOS(``mov %rdx, %rsi '')
-
push %rbx
xor %r10, %r10
L(common):
mov (up), %rax C read first u limb early
-IFSTD(` mov n_param, %rbx ') C move away n from rdx, mul uses it
-IFDOS(` mov n, %rbx ')
+ mov n_param, %rbx C move away n from rdx, mul uses it
mul vl
-IFSTD(` mov %rbx, n ')
+ mov %rbx, %r11
add %r10, %rax
adc $0, %rdx
@@ -146,7 +113,7 @@ L(top): mov %r10, (rp,n,8)
add %rax, %r9
mov (up,n,8), %rax
adc %rdx, %r8
- mov $0, R32(%r10)
+ mov $0, %r10d
L(L1): mul vl
mov %r9, 8(rp,n,8)
add %rax, %r8
@@ -159,11 +126,11 @@ L(L0): mov 8(up,n,8), %rax
L(L3): mov 16(up,n,8), %rax
mul vl
mov %rbx, 24(rp,n,8)
- mov $0, R32(%r8) C zero
- mov %r8, %rbx C zero
+ mov $0, %r8d # zero
+ mov %r8, %rbx # zero
add %rax, %r10
mov 24(up,n,8), %rax
- mov %r8, %r9 C zero
+ mov %r8, %r9 # zero
adc %rdx, %r9
L(L2): mul vl
add $4, n
@@ -177,7 +144,5 @@ L(L2): mul vl
L(ret): mov %rdx, %rax
pop %rbx
-IFDOS(``pop %rdi '')
-IFDOS(``pop %rsi '')
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/mul_2.asm b/gmp/mpn/x86_64/mul_2.asm
index f408c52250..a8ad00069f 100644
--- a/gmp/mpn/x86_64/mul_2.asm
+++ b/gmp/mpn/x86_64/mul_2.asm
@@ -1,44 +1,30 @@
dnl AMD64 mpn_mul_2 -- Multiply an n-limb vector with a 2-limb vector and
dnl store the result in a third limb vector.
-dnl Copyright 2008, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2008 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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.275
-C AMD K10 2.275
-C Intel P4 13.5
-C Intel core2 4.0
-C Intel corei 3.8
-C Intel atom ?
-C VIA nano ?
+C K8,K9: 2.275
+C K10: 2.275
+C P4: ?
+C P6-15: 4.0
C This code is the result of running a code generation and optimization tool
C suite written by David Harvey and Torbjorn Granlund.
@@ -64,14 +50,10 @@ 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
@@ -187,6 +169,5 @@ L(m22): mul v1
pop %rbp
pop %rbx
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/k8/mul_basecase.asm b/gmp/mpn/x86_64/mul_basecase.asm
index ca2efb9b2f..09ec4d14ae 100644
--- a/gmp/mpn/x86_64/k8/mul_basecase.asm
+++ b/gmp/mpn/x86_64/mul_basecase.asm
@@ -2,44 +2,30 @@ 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 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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 K8,K9: 2.375
+C K10: 2.375
+C P4: ?
+C P6-15: 4.45
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.
@@ -47,6 +33,7 @@ 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 * Don't align loops to a 32-byte boundaries.
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?
@@ -70,15 +57,10 @@ 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
@@ -111,13 +93,7 @@ L(mul_1):
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)
+ jmp L(mul_1_prologue_3)
L(mul_1_prologue_0):
mov %rax, w2
@@ -149,6 +125,13 @@ L(mul_1_prologue_2):
xor R32(w3), R32(w3)
jmp L(mul_1_entry_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)
+
C this loop is 10 c/loop = 2.5 c/l on K8, for all up/rp alignments
@@ -309,7 +292,7 @@ L(mul_2_entry_1):
mov w3, -32(rp,n,8)
js L(mul_2_top)
- mov -32(up,n,8), %rax C FIXME: n is constant
+ mov -32(up,n,8), %rax
mul v1
add %rax, w0
mov w0, (rp)
@@ -463,7 +446,6 @@ L(ret): pop %r15
pop %r12
pop %rbp
pop %rbx
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/mulx/adx/addmul_1.asm b/gmp/mpn/x86_64/mulx/adx/addmul_1.asm
deleted file mode 100644
index ea607899a4..0000000000
--- a/gmp/mpn/x86_64/mulx/adx/addmul_1.asm
+++ /dev/null
@@ -1,149 +0,0 @@
-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/gmp/mpn/x86_64/mulx/aorsmul_1.asm b/gmp/mpn/x86_64/mulx/aorsmul_1.asm
deleted file mode 100644
index 285c07335e..0000000000
--- a/gmp/mpn/x86_64/mulx/aorsmul_1.asm
+++ /dev/null
@@ -1,161 +0,0 @@
-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/gmp/mpn/x86_64/mulx/mul_1.asm b/gmp/mpn/x86_64/mulx/mul_1.asm
deleted file mode 100644
index 34a044dcdc..0000000000
--- a/gmp/mpn/x86_64/mulx/mul_1.asm
+++ /dev/null
@@ -1,154 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/nano/copyd.asm b/gmp/mpn/x86_64/nano/copyd.asm
deleted file mode 100644
index f0dc54a55e..0000000000
--- a/gmp/mpn/x86_64/nano/copyd.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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/gmp/mpn/x86_64/nano/copyi.asm b/gmp/mpn/x86_64/nano/copyi.asm
deleted file mode 100644
index 9c26e00c52..0000000000
--- a/gmp/mpn/x86_64/nano/copyi.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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')
diff --git a/gmp/mpn/x86_64/nano/dive_1.asm b/gmp/mpn/x86_64/nano/dive_1.asm
deleted file mode 100644
index e9a07631c4..0000000000
--- a/gmp/mpn/x86_64/nano/dive_1.asm
+++ /dev/null
@@ -1,166 +0,0 @@
-dnl AMD64 mpn_divexact_1 -- mpn by limb exact division.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-
-C cycles/limb
-C norm unorm
-C AMD K8,K9 11 11
-C AMD K10 11 11
-C Intel P4 ?
-C Intel core2 13.5 13.25
-C Intel corei 14.25
-C Intel atom 34 36
-C VIA nano 19.25 19.25
-
-
-C INPUT PARAMETERS
-C rp rdi
-C up rsi
-C n rdx
-C divisor rcx
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(mpn_divexact_1)
- FUNC_ENTRY(4)
- push %rbx
-
- mov %rcx, %rax
- xor R32(%rcx), R32(%rcx) C shift count
- mov %rdx, %r8
-
- bt $0, R32(%rax)
- jc L(odd) C skip bsfq unless divisor is even
- bsf %rax, %rcx
- shr R8(%rcx), %rax
-L(odd): mov %rax, %rbx
- shr R32(%rax)
- and $127, R32(%rax) C d/2, 7 bits
-
- LEA( binvert_limb_table, %rdx)
-
- movzbl (%rdx,%rax), R32(%rax) C inv 8 bits
-
- mov %rbx, %r11 C d without twos
-
- lea (%rax,%rax), R32(%rdx) C 2*inv
- imul R32(%rax), R32(%rax) C inv*inv
- imul R32(%rbx), R32(%rax) C inv*inv*d
- sub R32(%rax), R32(%rdx) C inv = 2*inv - inv*inv*d, 16 bits
-
- lea (%rdx,%rdx), R32(%rax) C 2*inv
- imul R32(%rdx), R32(%rdx) C inv*inv
- imul R32(%rbx), R32(%rdx) C inv*inv*d
- sub R32(%rdx), R32(%rax) C inv = 2*inv - inv*inv*d, 32 bits
-
- lea (%rax,%rax), %r10 C 2*inv
- imul %rax, %rax C inv*inv
- imul %rbx, %rax C inv*inv*d
- sub %rax, %r10 C inv = 2*inv - inv*inv*d, 64 bits
-
- lea (%rsi,%r8,8), %rsi C up end
- lea -8(%rdi,%r8,8), %rdi C rp end
- neg %r8 C -n
-
- mov (%rsi,%r8,8), %rax C up[0]
-
- inc %r8
- jz L(one)
-
- test R32(%rcx), R32(%rcx)
- jnz L(unorm) C branch if count != 0
- xor R32(%rbx), R32(%rbx)
- jmp L(nent)
-
- ALIGN(8)
-L(ntop):mul %r11 C carry limb in rdx 0 10
- mov -8(%rsi,%r8,8), %rax C
- sub %rbx, %rax C apply carry bit
- setc %bl C
- sub %rdx, %rax C apply carry limb 5
- adc $0, %rbx C 6
-L(nent):imul %r10, %rax C 6
- mov %rax, (%rdi,%r8,8) C
- inc %r8 C
- jnz L(ntop)
-
- mov -8(%rsi), %r9 C up high limb
- jmp L(com)
-
-L(unorm):
- mov (%rsi,%r8,8), %r9 C up[1]
- shr R8(%rcx), %rax C
- neg R32(%rcx)
- shl R8(%rcx), %r9 C
- neg R32(%rcx)
- or %r9, %rax
- xor R32(%rbx), R32(%rbx)
- jmp L(uent)
-
- ALIGN(8)
-L(utop):mul %r11 C carry limb in rdx 0 10
- mov (%rsi,%r8,8), %rax C
- shl R8(%rcx), %rax C
- neg R32(%rcx)
- or %r9, %rax
- sub %rbx, %rax C apply carry bit
- setc %bl C
- sub %rdx, %rax C apply carry limb 5
- adc $0, %rbx C 6
-L(uent):imul %r10, %rax C 6
- mov (%rsi,%r8,8), %r9 C
- shr R8(%rcx), %r9 C
- neg R32(%rcx)
- mov %rax, (%rdi,%r8,8) C
- inc %r8 C
- jnz L(utop)
-
-L(com): mul %r11 C carry limb in rdx
- sub %rbx, %r9 C apply carry bit
- sub %rdx, %r9 C apply carry limb
- imul %r10, %r9
- mov %r9, (%rdi)
- pop %rbx
- FUNC_EXIT()
- ret
-
-L(one): shr R8(%rcx), %rax
- imul %r10, %rax
- mov %rax, (%rdi)
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/nano/gcd_1.asm b/gmp/mpn/x86_64/nano/gcd_1.asm
deleted file mode 100644
index 3d8e5c7ab1..0000000000
--- a/gmp/mpn/x86_64/nano/gcd_1.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-include(`../config.m4')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_gcd_1)
-include_mpn(`x86_64/core2/gcd_1.asm')
diff --git a/gmp/mpn/x86_64/nano/gmp-mparam.h b/gmp/mpn/x86_64/nano/gmp-mparam.h
deleted file mode 100644
index fde69dbb7f..0000000000
--- a/gmp/mpn/x86_64/nano/gmp-mparam.h
+++ /dev/null
@@ -1,243 +0,0 @@
-/* VIA Nano 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
-
-#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 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 38
-#define MUL_TOOM44_THRESHOLD 324
-#define MUL_TOOM6H_THRESHOLD 450
-#define MUL_TOOM8H_THRESHOLD 632
-
-#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 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 32
-
-#define MULMOD_BNM1_THRESHOLD 14
-#define SQRMOD_BNM1_THRESHOLD 15
-
-#define MUL_FFT_MODF_THRESHOLD 376 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 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,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}, { 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,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 \
- { { 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, 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,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,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 1652
-#define MUPI_DIV_QR_THRESHOLD 83
-#define MU_BDIV_QR_THRESHOLD 1210
-#define MU_BDIV_Q_THRESHOLD 1499
-
-#define POWM_SEC_TABLE 1,28,129,642,2387
-
-#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 12
-#define GET_STR_PRECOMPUTE_THRESHOLD 24
-#define SET_STR_DC_THRESHOLD 802
-#define SET_STR_PRECOMPUTE_THRESHOLD 2042
-
-#define FAC_DSC_THRESHOLD 1737
-#define FAC_ODD_THRESHOLD 44
diff --git a/gmp/mpn/x86_64/nano/popcount.asm b/gmp/mpn/x86_64/nano/popcount.asm
deleted file mode 100644
index fb14dd3d31..0000000000
--- a/gmp/mpn/x86_64/nano/popcount.asm
+++ /dev/null
@@ -1,35 +0,0 @@
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-dnl GNU Lesser General Public License along with the GNU MP Library. If not,
-dnl see https://www.gnu.org/licenses/.
-
-
-include(`../config.m4')
-
-MULFUNC_PROLOGUE(mpn_popcount)
-include_mpn(`x86/pentium4/sse2/popcount.asm')
diff --git a/gmp/mpn/x86_64/pentium4/aors_n.asm b/gmp/mpn/x86_64/pentium4/aors_n.asm
index 8e6ee1bae6..90f5a219b9 100644
--- a/gmp/mpn/x86_64/pentium4/aors_n.asm
+++ b/gmp/mpn/x86_64/pentium4/aors_n.asm
@@ -1,46 +1,30 @@
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-2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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.8
-C AMD K10 2.8
-C Intel P4 4
-C Intel core2 3.6-5 (fluctuating)
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
+C K8,K9: 2.8
+C K10: 2.8
+C P4: 4
+C P6-15: 3.6-5 (fluctuating)
C INPUT PARAMETERS
@@ -59,20 +43,19 @@ ifdef(`OPERATION_sub_n', `
define(func, mpn_sub_n)
define(func_nc, mpn_sub_nc)')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
MULFUNC_PROLOGUE(mpn_add_n mpn_add_nc mpn_sub_n mpn_sub_nc)
+
ASM_START()
+
TEXT
+ ALIGN(16)
+
+PROLOGUE(func_nc)
+ jmp L(ent)
+EPILOGUE()
+
PROLOGUE(func)
- FUNC_ENTRY(4)
xor %r8, %r8
-IFDOS(` jmp L(ent) ')
-EPILOGUE()
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
L(ent): push %rbx
push %r12
@@ -191,6 +174,5 @@ L(1): mov %r11, 8(rp)
L(ret): mov R32(%rbx), R32(%rax)
pop %r12
pop %rbx
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/pentium4/aorslsh1_n.asm b/gmp/mpn/x86_64/pentium4/aorslsh1_n.asm
index 66937d3267..0723f3e6ca 100644
--- a/gmp/mpn/x86_64/pentium4/aorslsh1_n.asm
+++ b/gmp/mpn/x86_64/pentium4/aorslsh1_n.asm
@@ -1,50 +1,192 @@
dnl AMD64 mpn_addlsh1_n, mpn_sublsh1_n -- rp[] = up[] +- (vp[] << 1),
-dnl optimised for Pentium 4.
+dnl optimized for Pentium 4.
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-dnl Copyright 2008, 2010-2012 Free Software Foundation, Inc.
+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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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, 31) C 31, not 63, since we use 32-bit ops
+C cycles/limb
+C K8,K9: 3.8
+C K10: 4.8
+C P4: 5.8
+C P6-15: ?
+
+
+C INPUT PARAMETERS
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`vp',`%rdx')
+define(`n', `%rcx')
ifdef(`OPERATION_addlsh1_n', `
- define(ADDSUB, add)
- define(func, mpn_addlsh1_n)')
+ define(ADDSUB, add)
+ define(func, mpn_addlsh1_n)')
ifdef(`OPERATION_sublsh1_n', `
- define(ADDSUB, sub)
- define(func, mpn_sublsh1_n)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+ define(ADDSUB, sub)
+ define(func, mpn_sublsh1_n)')
MULFUNC_PROLOGUE(mpn_addlsh1_n mpn_sublsh1_n)
-include_mpn(`x86_64/pentium4/aorslshC_n.asm')
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+PROLOGUE(func)
+ push %rbx
+ push %r12
+ push %rbp
+
+ mov (vp), %r9
+ shl %r9
+ mov 4(vp), R32(%rbp)
+
+ xor R32(%rbx), R32(%rbx)
+
+ mov R32(n), R32(%rax)
+ and $3, R32(%rax)
+ jne L(n00) C n = 0, 4, 8, ...
+
+ mov (up), %r8
+ mov 8(up), %r10
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r8
+ mov 8(vp), %r9
+ lea (%rbp,%r9,2), %r9
+ setc R8(%rax)
+ mov 12(vp), R32(%rbp)
+ lea -16(rp), rp
+ jmp L(L00)
+
+L(n00): cmp $2, R32(%rax)
+ jnc L(n01) C n = 1, 5, 9, ...
+ mov (up), %r11
+ lea -8(rp), rp
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r11
+ setc R8(%rbx)
+ dec n
+ jz L(1) C jump for n = 1
+ mov 8(up), %r8
+ mov 8(vp), %r9
+ lea (%rbp,%r9,2), %r9
+ mov 12(vp), R32(%rbp)
+ lea 8(up), up
+ lea 8(vp), vp
+ jmp L(L01)
+
+L(n01): jne L(n10) C n = 2, 6, 10, ...
+ mov (up), %r12
+ mov 8(up), %r11
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r12
+ mov 8(vp), %r9
+ lea (%rbp,%r9,2), %r9
+ setc R8(%rax)
+ mov 12(vp), R32(%rbp)
+ lea 16(up), up
+ lea 16(vp), vp
+ jmp L(L10)
+
+L(n10): mov (up), %r10
+ mov 8(up), %r12
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r10
+ mov 8(vp), %r9
+ lea (%rbp,%r9,2), %r9
+ setc R8(%rbx)
+ mov 12(vp), R32(%rbp)
+ lea -24(rp), rp
+ lea -8(up), up
+ lea -8(vp), vp
+ jmp L(L11)
+
+L(c0): mov $1, R8(%rbx)
+ jmp L(rc0)
+L(c1): mov $1, R8(%rax)
+ jmp L(rc1)
+L(c2): mov $1, R8(%rbx)
+ jmp L(rc2)
+
+ ALIGN(16)
+L(top): mov (up), %r8 C not on critical path
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r11 C not on critical path
+ mov (vp), %r9
+ lea (%rbp,%r9,2), %r9
+ setc R8(%rbx) C save carry out
+ mov 4(vp), R32(%rbp)
+ mov %r12, (rp)
+ ADDSUB %rax, %r11 C apply previous carry out
+ jc L(c0) C jump if ripple
+L(rc0):
+L(L01): mov 8(up), %r10
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r8
+ mov 8(vp), %r9
+ lea (%rbp,%r9,2), %r9
+ setc R8(%rax)
+ mov 12(vp), R32(%rbp)
+ mov %r11, 8(rp)
+ ADDSUB %rbx, %r8
+ jc L(c1)
+L(rc1):
+L(L00): mov 16(up), %r12
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r10
+ mov 16(vp), %r9
+ lea (%rbp,%r9,2), %r9
+ setc R8(%rbx)
+ mov 20(vp), R32(%rbp)
+ mov %r8, 16(rp)
+ ADDSUB %rax, %r10
+ jc L(c2)
+L(rc2):
+L(L11): mov 24(up), %r11
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r12
+ mov 24(vp), %r9
+ lea (%rbp,%r9,2), %r9
+ lea 32(up), up
+ lea 32(vp), vp
+ setc R8(%rax)
+ mov -4(vp), R32(%rbp)
+ mov %r10, 24(rp)
+ ADDSUB %rbx, %r12
+ jc L(c3)
+L(rc3): lea 32(rp), rp
+L(L10): sub $4, n
+ ja L(top)
+
+L(end):
+ shr $31, R32(%rbp)
+ ADDSUB %r9, %r11
+ setc R8(%rbx)
+ mov %r12, (rp)
+ ADDSUB %rax, %r11
+ jnc L(1)
+ mov $1, R8(%rbx)
+L(1): mov %r11, 8(rp)
+ lea (%rbx,%rbp), R32(%rax)
+ pop %rbp
+ pop %r12
+ pop %rbx
+ emms
+ ret
+L(c3): mov $1, R8(%rax)
+ jmp L(rc3)
+EPILOGUE()
+ASM_END()
diff --git a/gmp/mpn/x86_64/pentium4/aorslsh2_n.asm b/gmp/mpn/x86_64/pentium4/aorslsh2_n.asm
deleted file mode 100644
index 001f0ac5bf..0000000000
--- a/gmp/mpn/x86_64/pentium4/aorslsh2_n.asm
+++ /dev/null
@@ -1,50 +0,0 @@
-dnl AMD64 mpn_addlsh2_n, mpn_sublsh2_n -- rp[] = up[] +- (vp[] << 2),
-dnl optimised for Pentium 4.
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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, 30) C 30, not 62, since we use 32-bit ops
-
-ifdef(`OPERATION_addlsh2_n', `
- define(ADDSUB, add)
- define(func, mpn_addlsh2_n)')
-ifdef(`OPERATION_sublsh2_n', `
- define(ADDSUB, sub)
- define(func, mpn_sublsh2_n)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_addlsh2_n mpn_sublsh2_n)
-include_mpn(`x86_64/pentium4/aorslshC_n.asm')
diff --git a/gmp/mpn/x86_64/pentium4/aorslshC_n.asm b/gmp/mpn/x86_64/pentium4/aorslshC_n.asm
deleted file mode 100644
index d03c6a3f30..0000000000
--- a/gmp/mpn/x86_64/pentium4/aorslshC_n.asm
+++ /dev/null
@@ -1,203 +0,0 @@
-dnl AMD64 mpn_addlshC_n, mpn_sublshC_n -- rp[] = up[] +- (vp[] << C), where
-dnl C is 1, 2, 3. Optimized for Pentium 4.
-
-dnl Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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
-C AMD K10 3.8
-C Intel P4 5.8
-C Intel core2 4.75
-C Intel corei 4.75
-C Intel atom ?
-C VIA nano 4.75
-
-
-C INPUT PARAMETERS
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`vp',`%rdx')
-define(`n', `%rcx')
-
-define(M, eval(m4_lshift(1,LSH)))
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func)
- FUNC_ENTRY(4)
- push %rbx
- push %r12
- push %rbp
-
- mov (vp), %r9
- shl $LSH, %r9
- mov 4(vp), R32(%rbp)
-
- xor R32(%rbx), R32(%rbx)
-
- mov R32(n), R32(%rax)
- and $3, R32(%rax)
- jne L(n00) C n = 0, 4, 8, ...
-
- mov (up), %r8
- mov 8(up), %r10
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r8
- mov 8(vp), %r9
- lea (%rbp,%r9,M), %r9
- setc R8(%rax)
- mov 12(vp), R32(%rbp)
- lea -16(rp), rp
- jmp L(L00)
-
-L(n00): cmp $2, R32(%rax)
- jnc L(n01) C n = 1, 5, 9, ...
- mov (up), %r11
- lea -8(rp), rp
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r11
- setc R8(%rbx)
- dec n
- jz L(1) C jump for n = 1
- mov 8(up), %r8
- mov 8(vp), %r9
- lea (%rbp,%r9,M), %r9
- mov 12(vp), R32(%rbp)
- lea 8(up), up
- lea 8(vp), vp
- jmp L(L01)
-
-L(n01): jne L(n10) C n = 2, 6, 10, ...
- mov (up), %r12
- mov 8(up), %r11
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r12
- mov 8(vp), %r9
- lea (%rbp,%r9,M), %r9
- setc R8(%rax)
- mov 12(vp), R32(%rbp)
- lea 16(up), up
- lea 16(vp), vp
- jmp L(L10)
-
-L(n10): mov (up), %r10
- mov 8(up), %r12
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r10
- mov 8(vp), %r9
- lea (%rbp,%r9,M), %r9
- setc R8(%rbx)
- mov 12(vp), R32(%rbp)
- lea -24(rp), rp
- lea -8(up), up
- lea -8(vp), vp
- jmp L(L11)
-
-L(c0): mov $1, R8(%rbx)
- jmp L(rc0)
-L(c1): mov $1, R8(%rax)
- jmp L(rc1)
-L(c2): mov $1, R8(%rbx)
- jmp L(rc2)
-
- ALIGN(16)
-L(top): mov (up), %r8 C not on critical path
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r11 C not on critical path
- mov (vp), %r9
- lea (%rbp,%r9,M), %r9
- setc R8(%rbx) C save carry out
- mov 4(vp), R32(%rbp)
- mov %r12, (rp)
- ADDSUB %rax, %r11 C apply previous carry out
- jc L(c0) C jump if ripple
-L(rc0):
-L(L01): mov 8(up), %r10
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r8
- mov 8(vp), %r9
- lea (%rbp,%r9,M), %r9
- setc R8(%rax)
- mov 12(vp), R32(%rbp)
- mov %r11, 8(rp)
- ADDSUB %rbx, %r8
- jc L(c1)
-L(rc1):
-L(L00): mov 16(up), %r12
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r10
- mov 16(vp), %r9
- lea (%rbp,%r9,M), %r9
- setc R8(%rbx)
- mov 20(vp), R32(%rbp)
- mov %r8, 16(rp)
- ADDSUB %rax, %r10
- jc L(c2)
-L(rc2):
-L(L11): mov 24(up), %r11
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r12
- mov 24(vp), %r9
- lea (%rbp,%r9,M), %r9
- lea 32(up), up
- lea 32(vp), vp
- setc R8(%rax)
- mov -4(vp), R32(%rbp)
- mov %r10, 24(rp)
- ADDSUB %rbx, %r12
- jc L(c3)
-L(rc3): lea 32(rp), rp
-L(L10): sub $4, n
- ja L(top)
-
-L(end):
- shr $RSH, R32(%rbp)
- ADDSUB %r9, %r11
- setc R8(%rbx)
- mov %r12, (rp)
- ADDSUB %rax, %r11
- jnc L(1)
- mov $1, R8(%rbx)
-L(1): mov %r11, 8(rp)
- lea (%rbx,%rbp), R32(%rax)
- pop %rbp
- pop %r12
- pop %rbx
- FUNC_EXIT()
- ret
-L(c3): mov $1, R8(%rax)
- jmp L(rc3)
-EPILOGUE()
-ASM_END()
diff --git a/gmp/mpn/x86_64/pentium4/gmp-mparam.h b/gmp/mpn/x86_64/pentium4/gmp-mparam.h
index 2171e230a5..ca9239775b 100644
--- a/gmp/mpn/x86_64/pentium4/gmp-mparam.h
+++ b/gmp/mpn/x86_64/pentium4/gmp-mparam.h
@@ -1,231 +1,79 @@
/* Pentium 4-64 gmp-mparam.h -- Compiler/machine parameter header file.
-Copyright 1991, 1993, 1994, 2000-2010, 2014 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007,
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 64
-#define GMP_LIMB_BYTES 8
+#define BITS_PER_MP_LIMB 64
+#define BYTES_PER_MP_LIMB 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. */
-#undef HAVE_NATIVE_mpn_rsblsh1_n
-#undef HAVE_NATIVE_mpn_rsblsh2_n
-#undef HAVE_NATIVE_mpn_addlsh_n
-#undef HAVE_NATIVE_mpn_rsblsh_n
-
-/* 3400 MHz Pentium4 Nocona / 1024 Kibyte cache */
-/* FFT tuning limit = 25000000 */
-/* Generated by tuneup.c, 2014-03-12, gcc 4.5 */
-
-#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 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 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 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 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 22
-
-#define MULMOD_BNM1_THRESHOLD 9
-#define SQRMOD_BNM1_THRESHOLD 9
-
-#define MUL_FFT_MODF_THRESHOLD 252 /* k = 5 */
-#define MUL_FFT_TABLE3 \
- { { 252, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 13, 7}, { 7, 6}, { 15, 7}, { 8, 6}, \
- { 17, 7}, { 9, 6}, { 19, 7}, { 13, 8}, \
- { 7, 7}, { 17, 8}, { 9, 7}, { 20, 8}, \
- { 11, 7}, { 23, 8}, { 13, 9}, { 7, 8}, \
- { 21, 9}, { 11, 8}, { 25,10}, { 7, 9}, \
- { 15, 8}, { 33, 9}, { 19, 8}, { 39, 9}, \
- { 23, 8}, { 47,10}, { 15, 9}, { 39,10}, \
- { 23, 9}, { 51,11}, { 15,10}, { 31, 9}, \
- { 67,10}, { 39, 9}, { 79,10}, { 47, 9}, \
- { 95,10}, { 55,11}, { 31,10}, { 63, 9}, \
- { 127, 8}, { 255,10}, { 71, 9}, { 143, 8}, \
- { 287,10}, { 79,11}, { 47,10}, { 95, 9}, \
- { 191,10}, { 103,12}, { 31,11}, { 63,10}, \
- { 127, 9}, { 255,10}, { 143, 9}, { 287,11}, \
- { 79,10}, { 159, 9}, { 319,10}, { 175, 9}, \
- { 351,11}, { 95,10}, { 191, 9}, { 383,10}, \
- { 223,12}, { 63,11}, { 127,10}, { 255,11}, \
- { 143,10}, { 287, 9}, { 575, 8}, { 1151,11}, \
- { 159,10}, { 319,11}, { 175,10}, { 351,12}, \
- { 95,11}, { 191,10}, { 383,11}, { 207,10}, \
- { 415,11}, { 223,13}, { 63,12}, { 127,11}, \
- { 255,10}, { 511,11}, { 287,10}, { 575, 9}, \
- { 1151,12}, { 159,11}, { 319,10}, { 639,11}, \
- { 351,10}, { 703,12}, { 191,11}, { 383,10}, \
- { 767,11}, { 415,12}, { 223,11}, { 447,13}, \
- { 127,12}, { 255,11}, { 511,12}, { 287,11}, \
- { 575,10}, { 1151,12}, { 319,11}, { 639,12}, \
- { 351,11}, { 703,13}, { 191,12}, { 383,11}, \
- { 767,12}, { 415,11}, { 831,12}, { 447,11}, \
- { 895,14}, { 127,13}, { 255,12}, { 511,11}, \
- { 1023,12}, { 543,11}, { 1087,10}, { 2175,12}, \
- { 575,11}, { 1151,13}, { 319,12}, { 639,11}, \
- { 1279,12}, { 703,11}, { 1407,10}, { 2815,13}, \
- { 383,12}, { 767,11}, { 1535,12}, { 831,11}, \
- { 1663,13}, { 447,12}, { 895,14}, { 255,13}, \
- { 511,12}, { 1023,11}, { 2047,12}, { 1087,11}, \
- { 2175,13}, { 575,12}, { 1151,11}, { 2303,12}, \
- { 1215,11}, { 2431,10}, { 4863,13}, { 639,12}, \
- { 1279,11}, { 2559,13}, { 703,12}, { 1407,11}, \
- { 2815,14}, { 383,13}, { 767,12}, { 1535,13}, \
- { 831,12}, { 1663,13}, { 895,15}, { 255,14}, \
- { 511,13}, { 1023,12}, { 2047,13}, { 1087,12}, \
- { 2175,13}, { 1151,12}, { 2303,13}, { 1215,12}, \
- { 2431,11}, { 4863,14}, { 639,13}, { 1279,12}, \
- { 2559,13}, { 1407,12}, { 2815,14}, { 767,13}, \
- { 1663,14}, { 895,13}, { 1791,12}, { 3583,13}, \
- { 1919,12}, { 3839,15}, { 511,14}, { 1023,13}, \
- { 2175,14}, { 1151,13}, { 2303,12}, { 4607,13}, \
- { 2431,12}, { 4863,14}, { 1279,13}, { 2559,14}, \
- { 1407,13}, { 2815,15}, { 32768,16}, { 65536,17}, \
- { 131072,18}, { 262144,19}, { 524288,20}, {1048576,21}, \
- {2097152,22}, {4194304,23}, {8388608,24} }
-#define MUL_FFT_TABLE3_SIZE 211
-#define MUL_FFT_THRESHOLD 2240
-
-#define SQR_FFT_MODF_THRESHOLD 212 /* k = 5 */
-#define SQR_FFT_TABLE3 \
- { { 212, 5}, { 11, 6}, { 6, 5}, { 13, 6}, \
- { 13, 7}, { 7, 6}, { 15, 7}, { 9, 6}, \
- { 19, 7}, { 13, 8}, { 7, 7}, { 17, 8}, \
- { 9, 7}, { 20, 8}, { 11, 7}, { 24, 8}, \
- { 13, 9}, { 7, 8}, { 21, 9}, { 11, 8}, \
- { 25,10}, { 7, 9}, { 15, 8}, { 33, 9}, \
- { 19, 8}, { 39, 9}, { 23, 8}, { 47,10}, \
- { 15, 9}, { 39,10}, { 23, 9}, { 47,11}, \
- { 15,10}, { 31, 9}, { 63, 8}, { 127, 9}, \
- { 67,10}, { 39, 9}, { 79,10}, { 55,11}, \
- { 31,10}, { 63, 9}, { 127, 8}, { 255,10}, \
- { 71, 9}, { 143, 8}, { 287,10}, { 79, 9}, \
- { 159,11}, { 47, 9}, { 191,12}, { 31,11}, \
- { 63,10}, { 127, 9}, { 255,10}, { 143, 9}, \
- { 287,11}, { 79,10}, { 159, 9}, { 319,10}, \
- { 175, 9}, { 351,10}, { 191, 9}, { 383,10}, \
- { 207,11}, { 111,10}, { 223,12}, { 63,11}, \
- { 127,10}, { 255,11}, { 143,10}, { 287, 9}, \
- { 575,11}, { 159,10}, { 319,11}, { 175,10}, \
- { 351,11}, { 191,10}, { 383,11}, { 223,13}, \
- { 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 35
-#define DC_DIVAPPR_Q_THRESHOLD 68
-#define DC_BDIV_QR_THRESHOLD 32
-#define DC_BDIV_Q_THRESHOLD 56
-
-#define INV_MULMOD_BNM1_THRESHOLD 22
-#define INV_NEWTON_THRESHOLD 195
-#define INV_APPR_THRESHOLD 116
-
-#define BINV_NEWTON_THRESHOLD 199
-#define REDC_1_TO_REDC_2_THRESHOLD 4
-#define REDC_2_TO_REDC_N_THRESHOLD 42
-
-#define MU_DIV_QR_THRESHOLD 979
-#define MU_DIVAPPR_Q_THRESHOLD 979
-#define MUPI_DIV_QR_THRESHOLD 91
-#define MU_BDIV_QR_THRESHOLD 855
-#define MU_BDIV_Q_THRESHOLD 942
-
-#define POWM_SEC_TABLE 1,16,175,692,1603
-
-#define MATRIX22_STRASSEN_THRESHOLD 17
-#define HGCD_THRESHOLD 109
-#define HGCD_APPR_THRESHOLD 119
-#define HGCD_REDUCE_THRESHOLD 1679
-#define GCD_DC_THRESHOLD 222
-#define GCDEXT_DC_THRESHOLD 238
-#define JACOBI_BASE_METHOD 4
-
-#define GET_STR_DC_THRESHOLD 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 */
+#undef HAVE_NATIVE_mpn_addlsh1_n
+#undef HAVE_NATIVE_mpn_sublsh1_n
+#undef HAVE_NATIVE_mpn_rsh1add_n
+#undef HAVE_NATIVE_mpn_rsh1sub_n
+
+/* 3200 MHz Pentium / 2048 Kibyte cache / socket 775 */
+
+/* Generated by tuneup.c, 2009-01-15, gcc 3.4 */
+
+#define MUL_KARATSUBA_THRESHOLD 12
+#define MUL_TOOM3_THRESHOLD 91
+#define MUL_TOOM44_THRESHOLD 136
+
+#define SQR_BASECASE_THRESHOLD 0 /* always (native) */
+#define SQR_KARATSUBA_THRESHOLD 28
+#define SQR_TOOM3_THRESHOLD 97
+#define SQR_TOOM4_THRESHOLD 218
+
+#define MULLOW_BASECASE_THRESHOLD 0 /* always */
+#define MULLOW_DC_THRESHOLD 28
+#define MULLOW_MUL_N_THRESHOLD 246
+
+#define DIV_SB_PREINV_THRESHOLD 0 /* always */
+#define DIV_DC_THRESHOLD 35
+#define POWM_THRESHOLD 59
+
+#define MATRIX22_STRASSEN_THRESHOLD 25
+#define HGCD_THRESHOLD 112
+#define GCD_DC_THRESHOLD 258
+#define GCDEXT_DC_THRESHOLD 311
+#define JACOBI_BASE_METHOD 1
+
+#define MOD_1_NORM_THRESHOLD 0 /* always */
+#define MOD_1_UNNORM_THRESHOLD 0 /* always */
+#define MOD_1_1_THRESHOLD 5
+#define MOD_1_2_THRESHOLD 7
+#define MOD_1_4_THRESHOLD 28
+#define USE_PREINV_DIVREM_1 1 /* native */
+#define USE_PREINV_MOD_1 1
+#define DIVEXACT_1_THRESHOLD 0 /* always (native) */
+#define MODEXACT_1_ODD_THRESHOLD 0 /* always (native) */
+
+#define GET_STR_DC_THRESHOLD 15
+#define GET_STR_PRECOMPUTE_THRESHOLD 24
+#define SET_STR_DC_THRESHOLD 866
+#define SET_STR_PRECOMPUTE_THRESHOLD 1646
+
+#define MUL_FFT_TABLE { 240, 416, 1216, 2304, 7168, 20480, 49152, 196608, 786432, 0 }
+#define MUL_FFT_MODF_THRESHOLD 256
+#define MUL_FFT_THRESHOLD 2944
+
+#define SQR_FFT_TABLE { 208, 480, 1600, 2304, 7168, 20480, 49152, 196608, 786432, 0 }
+#define SQR_FFT_MODF_THRESHOLD 224
+#define SQR_FFT_THRESHOLD 2688
diff --git a/gmp/mpn/x86_64/pentium4/lshift.asm b/gmp/mpn/x86_64/pentium4/lshift.asm
index d3b521364f..7596d9c5c0 100644
--- a/gmp/mpn/x86_64/pentium4/lshift.asm
+++ b/gmp/mpn/x86_64/pentium4/lshift.asm
@@ -1,44 +1,31 @@
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 either:
+dnl Copyright 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 ?
-C Intel P4 3.29
-C Intel core2 2.1 (fluctuates, presumably cache related)
-C Intel corei ?
-C Intel atom 14.3
-C VIA nano ?
+C K8,K9: 2.5
+C K10: ?
+C P4: 3.29
+C P6-15 (Core2): 2.1 (fluctuates, presumably cache related)
+C P6-28 (Atom): 14.3
C INPUT PARAMETERS
define(`rp',`%rdi')
@@ -46,28 +33,24 @@ define(`up',`%rsi')
define(`n',`%rdx')
define(`cnt',`%cl')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_lshift)
- FUNC_ENTRY(4)
mov -8(up,n,8), %rax
- movd R32(%rcx), %mm4
- neg R32(%rcx) C put rsh count in cl
- and $63, R32(%rcx)
- movd R32(%rcx), %mm5
+ movd %ecx, %mm4
+ neg %ecx C put rsh count in cl
+ and $63, %ecx
+ movd %ecx, %mm5
- lea 1(n), R32(%r8)
+ lea 1(n), %r8d
- shr R8(%rcx), %rax C function return value
+ shr %cl, %rax C function return value
- and $3, R32(%r8)
+ and $3, %r8d
je L(rol) C jump for n = 3, 7, 11, ...
- dec R32(%r8)
+ dec %r8d
jne L(1)
C n = 4, 8, 12, ...
movq -8(up,n,8), %mm2
@@ -79,7 +62,7 @@ C n = 4, 8, 12, ...
dec n
jmp L(rol)
-L(1): dec R32(%r8)
+L(1): dec %r8d
je L(1x) C jump for n = 1, 5, 9, 13, ...
C n = 2, 6, 10, 16, ...
movq -8(up,n,8), %mm2
@@ -148,19 +131,18 @@ L(top):
jae L(top) C 2
L(end):
- movq 8(up), %mm0
+ movq 16(up,n,8), %mm0
psrlq %mm5, %mm0
por %mm0, %mm2
- movq (up), %mm1
+ movq 8(up,n,8), %mm1
psrlq %mm5, %mm1
por %mm1, %mm3
- movq %mm2, 16(rp)
- movq %mm3, 8(rp)
+ movq %mm2, 24(rp,n,8)
+ movq %mm3, 16(rp,n,8)
L(ast): movq (up), %mm2
psllq %mm4, %mm2
movq %mm2, (rp)
emms
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/pentium4/lshiftc.asm b/gmp/mpn/x86_64/pentium4/lshiftc.asm
deleted file mode 100644
index fc64676574..0000000000
--- a/gmp/mpn/x86_64/pentium4/lshiftc.asm
+++ /dev/null
@@ -1,179 +0,0 @@
-dnl x86-64 mpn_lshiftc optimized for Pentium 4.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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 Intel P4 4.15
-C Intel core2 ?
-C Intel corei ?
-C Intel atom ?
-C VIA nano ?
-
-C INPUT PARAMETERS
-define(`rp',`%rdi')
-define(`up',`%rsi')
-define(`n',`%rdx')
-define(`cnt',`%cl')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_lshiftc)
- FUNC_ENTRY(4)
- mov -8(up,n,8), %rax
- pcmpeqd %mm6, %mm6 C 0xffff...fff
- movd R32(%rcx), %mm4
- neg R32(%rcx) C put rsh count in cl
- and $63, R32(%rcx)
- movd R32(%rcx), %mm5
-
- lea 1(n), R32(%r8)
-
- shr R8(%rcx), %rax C function return value
-
- and $3, R32(%r8)
- je L(rol) C jump for n = 3, 7, 11, ...
-
- dec R32(%r8)
- jne L(1)
-C n = 4, 8, 12, ...
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm0
- pxor %mm6, %mm2
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- movq %mm0, -8(rp,n,8)
- dec n
- jmp L(rol)
-
-L(1): dec R32(%r8)
- je L(1x) C jump for n = 1, 5, 9, 13, ...
-C n = 2, 6, 10, 16, ...
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm0
- pxor %mm6, %mm2
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- movq %mm0, -8(rp,n,8)
- dec n
-L(1x):
- cmp $1, n
- je L(ast)
- movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm3
- psllq %mm4, %mm3
- movq -16(up,n,8), %mm0
- movq -24(up,n,8), %mm1
- pxor %mm6, %mm2
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- pxor %mm6, %mm3
- psrlq %mm5, %mm1
- pandn %mm3, %mm1
- movq %mm0, -8(rp,n,8)
- movq %mm1, -16(rp,n,8)
- sub $2, n
-
-L(rol): movq -8(up,n,8), %mm2
- psllq %mm4, %mm2
- movq -16(up,n,8), %mm3
- psllq %mm4, %mm3
-
- sub $4, n
- jb L(end)
- ALIGN(32)
-L(top):
- C finish stuff from lsh block
- movq 16(up,n,8), %mm0
- pxor %mm6, %mm2
- movq 8(up,n,8), %mm1
- psrlq %mm5, %mm0
- psrlq %mm5, %mm1
- pandn %mm2, %mm0
- pxor %mm6, %mm3
- movq %mm0, 24(rp,n,8)
- movq (up,n,8), %mm0
- pandn %mm3, %mm1
- movq %mm1, 16(rp,n,8)
- movq -8(up,n,8), %mm1
- C start two new rsh
- psrlq %mm5, %mm0
- psrlq %mm5, %mm1
-
- C finish stuff from rsh block
- movq 8(up,n,8), %mm2
- pxor %mm6, %mm0
- movq (up,n,8), %mm3
- psllq %mm4, %mm2
- psllq %mm4, %mm3
- pandn %mm0, %mm2
- pxor %mm6, %mm1
- movq %mm2, 8(rp,n,8)
- movq -8(up,n,8), %mm2
- pandn %mm1, %mm3
- movq %mm3, (rp,n,8)
- movq -16(up,n,8), %mm3
- C start two new lsh
- sub $4, n
- psllq %mm4, %mm2
- psllq %mm4, %mm3
-
- jae L(top)
-
-L(end): pxor %mm6, %mm2
- movq 8(up), %mm0
- psrlq %mm5, %mm0
- pandn %mm2, %mm0
- pxor %mm6, %mm3
- movq (up), %mm1
- psrlq %mm5, %mm1
- pandn %mm3, %mm1
- movq %mm0, 16(rp)
- movq %mm1, 8(rp)
-
-L(ast): movq (up), %mm2
- psllq %mm4, %mm2
- pxor %mm6, %mm2
- movq %mm2, (rp)
- emms
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/pentium4/mod_34lsub1.asm b/gmp/mpn/x86_64/pentium4/mod_34lsub1.asm
deleted file mode 100644
index f34b3f079a..0000000000
--- a/gmp/mpn/x86_64/pentium4/mod_34lsub1.asm
+++ /dev/null
@@ -1,167 +0,0 @@
-dnl AMD64 mpn_mod_34lsub1 -- remainder modulo 2^48-1.
-
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.0
-C AMD K10 1.12
-C Intel P4 3.25
-C Intel core2 1.5
-C Intel corei 1.5
-C Intel atom 2.5
-C VIA nano 1.75
-
-
-C INPUT PARAMETERS
-define(`ap', %rdi)
-define(`n', %rsi)
-
-C mp_limb_t mpn_mod_34lsub1 (mp_srcptr up, mp_size_t n)
-
-C TODO
-C * Review feed-in and wind-down code. In particular, try to avoid adc and
-C sbb to placate Pentium4.
-C * It seems possible to reach 2.67 c/l by using a cleaner 6-way unrolling,
-C without the dual loop exits.
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(32)
-PROLOGUE(mpn_mod_34lsub1)
- FUNC_ENTRY(2)
-
- mov $0x0000FFFFFFFFFFFF, %r11
-
- sub $2, %rsi
- ja L(gt2)
-
- mov (ap), %rax
- nop
- jb L(1)
-
- mov 8(ap), %rsi
- mov %rax, %rdx
- shr $48, %rax C src[0] low
-
- and %r11, %rdx C src[0] high
- add %rdx, %rax
- mov R32(%rsi), R32(%rdx)
-
- shr $32, %rsi C src[1] high
- add %rsi, %rax
-
- shl $16, %rdx C src[1] low
- add %rdx, %rax
-
-L(1): FUNC_EXIT()
- ret
-
-
- ALIGN(16)
-L(gt2): xor R32(%rax), R32(%rax)
- xor R32(%rcx), R32(%rcx)
- xor R32(%rdx), R32(%rdx)
- xor %r8, %r8
- xor %r9, %r9
- xor %r10, %r10
-
-L(top): add (ap), %rax
- adc $0, %r10
- add 8(ap), %rcx
- adc $0, %r8
- add 16(ap), %rdx
- adc $0, %r9
-
- sub $3, %rsi
- jng L(end)
-
- add 24(ap), %rax
- adc $0, %r10
- add 32(ap), %rcx
- adc $0, %r8
- add 40(ap), %rdx
- lea 48(ap), ap
- adc $0, %r9
-
- sub $3, %rsi
- jg L(top)
-
-
- add $-24, ap
-L(end): add %r9, %rax
- adc %r10, %rcx
- adc %r8, %rdx
-
- inc %rsi
- mov $0x1, R32(%r10)
- js L(combine)
-
- mov $0x10000, R32(%r10)
- adc 24(ap), %rax
- dec %rsi
- js L(combine)
-
- adc 32(ap), %rcx
- mov $0x100000000, %r10
-
-L(combine):
- sbb %rsi, %rsi C carry
- mov %rax, %rdi C 0mod3
- shr $48, %rax C 0mod3 high
-
- and %r10, %rsi C carry masked
- and %r11, %rdi C 0mod3 low
- mov R32(%rcx), R32(%r10) C 1mod3
-
- add %rsi, %rax C apply carry
- shr $32, %rcx C 1mod3 high
-
- add %rdi, %rax C apply 0mod3 low
- movzwl %dx, R32(%rdi) C 2mod3
- shl $16, %r10 C 1mod3 low
-
- add %rcx, %rax C apply 1mod3 high
- shr $16, %rdx C 2mod3 high
-
- add %r10, %rax C apply 1mod3 low
- shl $32, %rdi C 2mod3 low
-
- add %rdx, %rax C apply 2mod3 high
- add %rdi, %rax C apply 2mod3 low
-
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/pentium4/popcount.asm b/gmp/mpn/x86_64/pentium4/popcount.asm
index 7014b39de5..b1a866bf5e 100644
--- a/gmp/mpn/x86_64/pentium4/popcount.asm
+++ b/gmp/mpn/x86_64/pentium4/popcount.asm
@@ -3,33 +3,21 @@ 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
-MULFUNC_PROLOGUE(mpn_popcount)
include_mpn(`x86/pentium4/sse2/popcount.asm')
diff --git a/gmp/mpn/x86_64/pentium4/rsh1aors_n.asm b/gmp/mpn/x86_64/pentium4/rsh1aors_n.asm
deleted file mode 100644
index 5528ce47da..0000000000
--- a/gmp/mpn/x86_64/pentium4/rsh1aors_n.asm
+++ /dev/null
@@ -1,334 +0,0 @@
-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-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 4.13
-C AMD K10 4.13
-C Intel P4 5.70
-C Intel core2 4.75
-C Intel corei 5
-C Intel atom 8.75
-C VIA nano 5.25
-
-C TODO
-C * Try to make this smaller, 746 bytes seem excessive for this 2nd class
-C function. Less sw pipelining would help, and since we now probably
-C pipeline somewhat too deeply, it might not affect performance too much.
-C * A separate small-n loop might speed things as well as make things smaller.
-C That loop should be selected before pushing registers.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n', `%rcx')
-define(`cy', `%r8')
-
-ifdef(`OPERATION_rsh1add_n', `
- define(ADDSUB, add)
- define(func, mpn_rsh1add_n)
- define(func_nc, mpn_rsh1add_nc)')
-ifdef(`OPERATION_rsh1sub_n', `
- define(ADDSUB, sub)
- define(func, mpn_rsh1sub_n)
- define(func_nc, mpn_rsh1sub_nc)')
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1add_nc mpn_rsh1sub_n mpn_rsh1sub_nc)
-
-ASM_START()
- TEXT
-PROLOGUE(func)
- FUNC_ENTRY(4)
- xor %r8, %r8
-IFDOS(` jmp L(ent) ')
-EPILOGUE()
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
-L(ent): push %rbx
- push %r12
- push %r13
- push %r14
- push %r15
-
- mov (vp), %r9
- mov (up), %r15
-
- mov R32(n), R32(%rax)
- and $3, R32(%rax)
- jne L(n00)
-
- mov R32(%r8), R32(%rbx) C n = 0, 4, 8, ...
- mov 8(up), %r10
- ADDSUB %r9, %r15
- mov 8(vp), %r9
- setc R8(%rax)
- ADDSUB %rbx, %r15 C return bit
- jnc 1f
- mov $1, R8(%rax)
-1: mov 16(up), %r12
- ADDSUB %r9, %r10
- mov 16(vp), %r9
- setc R8(%rbx)
- mov %r15, %r13
- ADDSUB %rax, %r10
- jnc 1f
- mov $1, R8(%rbx)
-1: mov 24(up), %r11
- ADDSUB %r9, %r12
- lea 32(up), up
- mov 24(vp), %r9
- lea 32(vp), vp
- setc R8(%rax)
- mov %r10, %r14
- shl $63, %r10
- shr %r13
- jmp L(L00)
-
-L(n00): cmp $2, R32(%rax)
- jnc L(n01)
- xor R32(%rbx), R32(%rbx) C n = 1, 5, 9, ...
- lea -24(rp), rp
- mov R32(%r8), R32(%rax)
- dec n
- jnz L(gt1)
- ADDSUB %r9, %r15
- setc R8(%rbx)
- ADDSUB %rax, %r15
- jnc 1f
- mov $1, R8(%rbx)
-1: mov %r15, %r14
- shl $63, %rbx
- shr %r14
- jmp L(cj1)
-L(gt1): mov 8(up), %r8
- ADDSUB %r9, %r15
- mov 8(vp), %r9
- setc R8(%rbx)
- ADDSUB %rax, %r15
- jnc 1f
- mov $1, R8(%rbx)
-1: mov 16(up), %r10
- ADDSUB %r9, %r8
- mov 16(vp), %r9
- setc R8(%rax)
- mov %r15, %r14
- ADDSUB %rbx, %r8
- jnc 1f
- mov $1, R8(%rax)
-1: mov 24(up), %r12
- ADDSUB %r9, %r10
- mov 24(vp), %r9
- setc R8(%rbx)
- mov %r8, %r13
- shl $63, %r8
- shr %r14
- lea 8(up), up
- lea 8(vp), vp
- jmp L(L01)
-
-L(n01): jne L(n10)
- lea -16(rp), rp C n = 2, 6, 10, ...
- mov R32(%r8), R32(%rbx)
- mov 8(up), %r11
- ADDSUB %r9, %r15
- mov 8(vp), %r9
- setc R8(%rax)
- ADDSUB %rbx, %r15
- jnc 1f
- mov $1, R8(%rax)
-1: sub $2, n
- jnz L(gt2)
- ADDSUB %r9, %r11
- setc R8(%rbx)
- mov %r15, %r13
- ADDSUB %rax, %r11
- jnc 1f
- mov $1, R8(%rbx)
-1: mov %r11, %r14
- shl $63, %r11
- shr %r13
- jmp L(cj2)
-L(gt2): mov 16(up), %r8
- ADDSUB %r9, %r11
- mov 16(vp), %r9
- setc R8(%rbx)
- mov %r15, %r13
- ADDSUB %rax, %r11
- jnc 1f
- mov $1, R8(%rbx)
-1: mov 24(up), %r10
- ADDSUB %r9, %r8
- mov 24(vp), %r9
- setc R8(%rax)
- mov %r11, %r14
- shl $63, %r11
- shr %r13
- lea 16(up), up
- lea 16(vp), vp
- jmp L(L10)
-
-L(n10): xor R32(%rbx), R32(%rbx) C n = 3, 7, 11, ...
- lea -8(rp), rp
- mov R32(%r8), R32(%rax)
- mov 8(up), %r12
- ADDSUB %r9, %r15
- mov 8(vp), %r9
- setc R8(%rbx)
- ADDSUB %rax, %r15
- jnc 1f
- mov $1, R8(%rbx)
-1: mov 16(up), %r11
- ADDSUB %r9, %r12
- mov 16(vp), %r9
- setc R8(%rax)
- mov %r15, %r14
- ADDSUB %rbx, %r12
- jnc 1f
- mov $1, R8(%rax)
-1: sub $3, n
- jnz L(gt3)
- ADDSUB %r9, %r11
- setc R8(%rbx)
- mov %r12, %r13
- shl $63, %r12
- shr %r14
- jmp L(cj3)
-L(gt3): mov 24(up), %r8
- ADDSUB %r9, %r11
- mov 24(vp), %r9
- setc R8(%rbx)
- mov %r12, %r13
- shl $63, %r12
- shr %r14
- lea 24(up), up
- lea 24(vp), vp
- jmp L(L11)
-
-L(c0): mov $1, R8(%rbx)
- jmp L(rc0)
-L(c1): mov $1, R8(%rax)
- jmp L(rc1)
-L(c2): mov $1, R8(%rbx)
- jmp L(rc2)
-
- ALIGN(16)
-L(top): mov (up), %r8 C not on critical path
- or %r13, %r10
- ADDSUB %r9, %r11 C not on critical path
- mov (vp), %r9 C not on critical path
- setc R8(%rbx) C save carry out
- mov %r12, %r13 C new for later
- shl $63, %r12 C shift new right
- shr %r14 C shift old left
- mov %r10, (rp)
-L(L11): ADDSUB %rax, %r11 C apply previous carry out
- jc L(c0) C jump if ripple
-L(rc0): mov 8(up), %r10
- or %r14, %r12
- ADDSUB %r9, %r8
- mov 8(vp), %r9
- setc R8(%rax)
- mov %r11, %r14
- shl $63, %r11
- shr %r13
- mov %r12, 8(rp)
-L(L10): ADDSUB %rbx, %r8
- jc L(c1)
-L(rc1): mov 16(up), %r12
- or %r13, %r11
- ADDSUB %r9, %r10
- mov 16(vp), %r9
- setc R8(%rbx)
- mov %r8, %r13
- shl $63, %r8
- shr %r14
- mov %r11, 16(rp)
-L(L01): ADDSUB %rax, %r10
- jc L(c2)
-L(rc2): mov 24(up), %r11
- or %r14, %r8
- ADDSUB %r9, %r12
- lea 32(up), up
- mov 24(vp), %r9
- lea 32(vp), vp
- setc R8(%rax)
- mov %r10, %r14
- shl $63, %r10
- shr %r13
- mov %r8, 24(rp)
- lea 32(rp), rp
-L(L00): ADDSUB %rbx, %r12
- jc L(c3)
-L(rc3): sub $4, n
- ja L(top)
-
-L(end): or %r13, %r10
- ADDSUB %r9, %r11
- setc R8(%rbx)
- mov %r12, %r13
- shl $63, %r12
- shr %r14
- mov %r10, (rp)
-L(cj3): ADDSUB %rax, %r11
- jnc 1f
- mov $1, R8(%rbx)
-1: or %r14, %r12
- mov %r11, %r14
- shl $63, %r11
- shr %r13
- mov %r12, 8(rp)
-L(cj2): or %r13, %r11
- shl $63, %rbx
- shr %r14
- mov %r11, 16(rp)
-L(cj1): or %r14, %rbx
- mov %rbx, 24(rp)
-
- mov R32(%r15), R32(%rax)
- and $1, R32(%rax)
- pop %r15
- pop %r14
- pop %r13
- pop %r12
- pop %rbx
- FUNC_EXIT()
- ret
-L(c3): mov $1, R8(%rax)
- jmp L(rc3)
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/pentium4/rshift.asm b/gmp/mpn/x86_64/pentium4/rshift.asm
index b7c1ee2cdd..61899c5ecf 100644
--- a/gmp/mpn/x86_64/pentium4/rshift.asm
+++ b/gmp/mpn/x86_64/pentium4/rshift.asm
@@ -1,44 +1,31 @@
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 either:
+dnl Copyright 2003, 2005, 2007, 2008 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 ?
-C Intel P4 3.29
-C Intel core2 2.1 (fluctuates, presumably cache related)
-C Intel corei ?
-C Intel atom 14.3
-C VIA nano ?
+C K8,K9: 2.5
+C K10: ?
+C P4: 3.29
+C P6-15 (Core2): 2.1 (fluctuates, presumably cache related)
+C P6-28 (Atom): 14.3
C INPUT PARAMETERS
define(`rp',`%rdi')
@@ -46,31 +33,27 @@ define(`up',`%rsi')
define(`n',`%rdx')
define(`cnt',`%cl')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_rshift)
- FUNC_ENTRY(4)
mov (up), %rax
- movd R32(%rcx), %mm4
- neg R32(%rcx) C put lsh count in cl
- and $63, R32(%rcx)
- movd R32(%rcx), %mm5
+ movd %ecx, %mm4
+ neg %ecx C put lsh count in cl
+ and $63, %ecx
+ movd %ecx, %mm5
lea -8(up,n,8), up
lea -8(rp,n,8), rp
- lea 1(n), R32(%r8)
+ lea 1(n), %r8d
neg n
- shl R8(%rcx), %rax C function return value
+ shl %cl, %rax C function return value
- and $3, R32(%r8)
+ and $3, %r8d
je L(rol) C jump for n = 3, 7, 11, ...
- dec R32(%r8)
+ dec %r8d
jne L(1)
C n = 4, 8, 12, ...
movq 8(up,n,8), %mm2
@@ -82,7 +65,7 @@ C n = 4, 8, 12, ...
inc n
jmp L(rol)
-L(1): dec R32(%r8)
+L(1): dec %r8d
je L(1x) C jump for n = 1, 5, 9, 13, ...
C n = 2, 6, 10, 16, ...
movq 8(up,n,8), %mm2
@@ -151,19 +134,18 @@ L(top):
jae L(top) C 2
L(end):
- movq -8(up), %mm0
+ movq -16(up,n,8), %mm0
psllq %mm5, %mm0
por %mm0, %mm2
- movq (up), %mm1
+ movq -8(up,n,8), %mm1
psllq %mm5, %mm1
por %mm1, %mm3
- movq %mm2, -16(rp)
- movq %mm3, -8(rp)
+ movq %mm2, -24(rp,n,8)
+ movq %mm3, -16(rp,n,8)
L(ast): movq (up), %mm2
psrlq %mm4, %mm2
movq %mm2, (rp)
emms
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/pentium4/sec_tabselect.asm b/gmp/mpn/x86_64/pentium4/sec_tabselect.asm
deleted file mode 100644
index e4360341d9..0000000000
--- a/gmp/mpn/x86_64/pentium4/sec_tabselect.asm
+++ /dev/null
@@ -1,37 +0,0 @@
-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/gmp/mpn/x86_64/popham.asm b/gmp/mpn/x86_64/popham.asm
index 9005f81776..e2bdb1a0b8 100644
--- a/gmp/mpn/x86_64/popham.asm
+++ b/gmp/mpn/x86_64/popham.asm
@@ -1,32 +1,21 @@
dnl AMD64 mpn_popcount, mpn_hamdist -- population count and hamming distance.
-dnl Copyright 2004, 2005, 2007, 2010-2012 Free Software Foundation, Inc.
+dnl Copyright 2004, 2005, 2007 Free Software Foundation, Inc.
dnl This file is part of the GNU MP Library.
-dnl
+
dnl The GNU MP Library is free software; you can redistribute it and/or modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -34,13 +23,10 @@ include(`../config.m4')
C popcount hamdist
C cycles/limb cycles/limb
-C AMD K8,K9 6 7
-C AMD K10 6 7
-C Intel P4 12 14.3
-C Intel core2 7 8
-C Intel corei ? 7.3
-C Intel atom 16.5 17.5
-C VIA nano 8.75 10.4
+C K8,K9: 6 7
+C K10: 6 7
+C P4: 12 14.3
+C P6-15: 7 8
C TODO
C * Tune. It should be possible to reach 5 c/l for popcount and 6 c/l for
@@ -55,7 +41,6 @@ ifdef(`OPERATION_popcount',`
define(`h33333333', `%r11')
define(`h0f0f0f0f', `%rcx')
define(`h01010101', `%rdx')
- define(`POP', `$1')
define(`HAM', `dnl')
')
ifdef(`OPERATION_hamdist',`
@@ -67,111 +52,106 @@ ifdef(`OPERATION_hamdist',`
define(`h33333333', `%r11')
define(`h0f0f0f0f', `%rcx')
define(`h01010101', `%r14')
- define(`POP', `dnl')
define(`HAM', `$1')
')
MULFUNC_PROLOGUE(mpn_popcount mpn_hamdist)
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(func)
- POP(` FUNC_ENTRY(2) ')
- HAM(` FUNC_ENTRY(3) ')
- push %r12
- push %r13
- HAM(` push %r14 ')
- mov $0x5555555555555555, h55555555
- mov $0x3333333333333333, h33333333
- mov $0x0f0f0f0f0f0f0f0f, h0f0f0f0f
- mov $0x0101010101010101, h01010101
+ pushq %r12
+ pushq %r13
+ HAM(` pushq %r14 ')
+
+ movq $0x5555555555555555, h55555555
+ movq $0x3333333333333333, h33333333
+ movq $0x0f0f0f0f0f0f0f0f, h0f0f0f0f
+ movq $0x0101010101010101, h01010101
- lea (up,n,8), up
- HAM(` lea (vp,n,8), vp ')
- neg n
+ leaq (up,n,8), up
+ HAM(` leaq (vp,n,8), vp ')
+ negq n
- xor R32(%rax), R32(%rax)
+ xorl %eax, %eax
- bt $0, R32(n)
- jnc L(top)
+ btq $0, n
+ jnc L(oop)
- mov (up,n,8), %r8
- HAM(` xor (vp,n,8), %r8 ')
+ movq (up,n,8), %r8
+ HAM(` xorq (vp,n,8), %r8 ')
- mov %r8, %r9
- shr %r8
- and h55555555, %r8
- sub %r8, %r9
+ movq %r8, %r9
+ shrq %r8
+ andq h55555555, %r8
+ subq %r8, %r9
- mov %r9, %r8
- shr $2, %r9
- and h33333333, %r8
- and h33333333, %r9
- add %r8, %r9 C 16 4-bit fields (0..4)
+ movq %r9, %r8
+ shrq $2, %r9
+ andq h33333333, %r8
+ andq h33333333, %r9
+ addq %r8, %r9 C 16 4-bit fields (0..4)
- mov %r9, %r8
- shr $4, %r9
- and h0f0f0f0f, %r8
- and h0f0f0f0f, %r9
- add %r8, %r9 C 8 8-bit fields (0..16)
+ movq %r9, %r8
+ shrq $4, %r9
+ andq h0f0f0f0f, %r8
+ andq h0f0f0f0f, %r9
+ addq %r8, %r9 C 8 8-bit fields (0..16)
- imul h01010101, %r9 C sum the 8 fields in high 8 bits
- shr $56, %r9
+ imulq h01010101, %r9 C sum the 8 fields in high 8 bits
+ shrq $56, %r9
- mov %r9, %rax C add to total
- add $1, n
- jz L(end)
+ addq %r9, %rax C add to total
+ addq $1, n
+ jz L(done)
ALIGN(16)
-L(top): mov (up,n,8), %r8
- mov 8(up,n,8), %r12
- HAM(` xor (vp,n,8), %r8 ')
- HAM(` xor 8(vp,n,8), %r12 ')
-
- mov %r8, %r9
- mov %r12, %r13
- shr %r8
- shr %r12
- and h55555555, %r8
- and h55555555, %r12
- sub %r8, %r9
- sub %r12, %r13
-
- mov %r9, %r8
- mov %r13, %r12
- shr $2, %r9
- shr $2, %r13
- and h33333333, %r8
- and h33333333, %r9
- and h33333333, %r12
- and h33333333, %r13
- add %r8, %r9 C 16 4-bit fields (0..4)
- add %r12, %r13 C 16 4-bit fields (0..4)
-
- add %r13, %r9 C 16 4-bit fields (0..8)
- mov %r9, %r8
- shr $4, %r9
- and h0f0f0f0f, %r8
- and h0f0f0f0f, %r9
- add %r8, %r9 C 8 8-bit fields (0..16)
-
- imul h01010101, %r9 C sum the 8 fields in high 8 bits
- shr $56, %r9
-
- add %r9, %rax C add to total
- add $2, n
- jnc L(top)
-
-L(end):
- HAM(` pop %r14 ')
- pop %r13
- pop %r12
- FUNC_EXIT()
+L(oop): movq (up,n,8), %r8
+ movq 8(up,n,8), %r12
+ HAM(` xorq (vp,n,8), %r8 ')
+ HAM(` xorq 8(vp,n,8), %r12 ')
+
+ movq %r8, %r9
+ movq %r12, %r13
+ shrq %r8
+ shrq %r12
+ andq h55555555, %r8
+ andq h55555555, %r12
+ subq %r8, %r9
+ subq %r12, %r13
+
+ movq %r9, %r8
+ movq %r13, %r12
+ shrq $2, %r9
+ shrq $2, %r13
+ andq h33333333, %r8
+ andq h33333333, %r9
+ andq h33333333, %r12
+ andq h33333333, %r13
+ addq %r8, %r9 C 16 4-bit fields (0..4)
+ addq %r12, %r13 C 16 4-bit fields (0..4)
+
+ addq %r13, %r9 C 16 4-bit fields (0..8)
+ movq %r9, %r8
+ shrq $4, %r9
+ andq h0f0f0f0f, %r8
+ andq h0f0f0f0f, %r9
+ addq %r8, %r9 C 8 8-bit fields (0..16)
+
+ imulq h01010101, %r9 C sum the 8 fields in high 8 bits
+ shrq $56, %r9
+
+ addq %r9, %rax C add to total
+ addq $2, n
+ jnc L(oop)
+
+L(done):
+ HAM(` popq %r14 ')
+ popq %r13
+ popq %r12
ret
+
EPILOGUE()
diff --git a/gmp/mpn/x86_64/redc_1.asm b/gmp/mpn/x86_64/redc_1.asm
new file mode 100644
index 0000000000..23ccceed67
--- /dev/null
+++ b/gmp/mpn/x86_64/redc_1.asm
@@ -0,0 +1,335 @@
+dnl AMD64 mpn_redc_1 -- Montgomery reduction with a one-limb modular inverse.
+
+dnl Copyright 2004, 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
+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 K8,K9: 2.5
+C K10: 2.5
+C P4: ?
+C P6-15 (Core2): 5.3
+C P6-28 (Atom): ?
+
+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 * The sub_n at the end leaks side-channel data. How do we fix that?
+C * Write mpn_addsub_n computing R = A + B - C. It should run at 2 c/l.
+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 fro up[], since it is at up[n].
+C * Can we combine both the add_n and sub_n into the loops, somehow?
+
+C INPUT PARAMETERS
+define(`rp', `%rdi')
+define(`up', `%rsi')
+define(`param_mp',`%rdx')
+define(`n', `%rcx')
+define(`invm', `%r8')
+
+define(`mp', `%r13')
+define(`i', `%r11')
+define(`nneg', `%r12')
+
+ASM_START()
+ TEXT
+ ALIGN(32)
+PROLOGUE(mpn_redc_1)
+ push %rbp
+ push %rbx
+ push %r12
+ push %r13
+ push %r14
+ push n
+ sub $8, %rsp C maintain ABI required rsp alignment
+
+ lea (param_mp,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 %ebx, %ebx
+ 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 %r10d, %r10d
+ 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 %r9d, %r9d
+ xor %r14d, %r14d
+ add %rbx, 24(up,i,8)
+ adc %rax, %r10
+ mov 24(mp,i,8), %rax
+ adc %rdx, %r9
+ xor %ebx, %ebx
+ mul %rbp
+ add $4, i
+ js L(lo1)
+L(ed1): add %r10, (up)
+ adc %rax, %r9
+ adc %rdx, %r14
+ xor %r10d, %r10d
+ 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)
+C lea (mp), mp
+ lea 16(up), 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 %r10d, %r10d
+ 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 %r10d, %r10d
+ 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 %r9d, %r9d
+ xor %r14d, %r14d
+ add %rbx, 24(up,i,8)
+ adc %rax, %r10
+ mov 24(mp,i,8), %rax
+ adc %rdx, %r9
+ xor %ebx, %ebx
+ mul %rbp
+ add $4, i
+ js L(lo0)
+L(ed0): add %r10, (up)
+ adc %rax, %r9
+ adc %rdx, %r14
+ xor %r10d, %r10d
+ add %r9, 8(up)
+ adc $0, %r14
+ mov %r14, 16(up,nneg,8) C up[0]
+ add $8, up
+ dec n
+ jnz L(o0)
+C lea (mp), mp
+ lea 16(up), 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 %r10d, %r10d
+ 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 %r9d, %r9d
+ xor %r14d, %r14d
+ add %rbx, 24(up,i,8)
+ adc %rax, %r10
+ mov 24(mp,i,8), %rax
+ adc %rdx, %r9
+ xor %ebx, %ebx
+ mul %rbp
+ add $4, i
+ js L(lo3)
+L(ed3): add %r10, 8(up)
+ adc %rax, %r9
+ adc %rdx, %r14
+ xor %r10d, %r10d
+ 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 8(mp), mp
+ lea 24(up), 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 %r14d, %r14d
+ 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 %r10d, %r10d
+ 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 %r9d, %r9d
+ xor %r14d, %r14d
+ add %rbx, 24(up,i,8)
+ adc %rax, %r10
+ mov 24(mp,i,8), %rax
+ adc %rdx, %r9
+L(mi2): xor %ebx, %ebx
+ mul %rbp
+ add $4, i
+ js L(lo2)
+L(ed2): add %r10, 16(up)
+ adc %rax, %r9
+ adc %rdx, %r14
+ xor %r10d, %r10d
+ 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 16(mp), mp
+ lea 32(up), up
+
+
+L(common):
+ lea (mp,nneg,8), mp C restore entry mp
+
+C cy = mpn_add_n (rp, up, up - n, n);
+C rdi rsi rdx rcx
+ lea (up,nneg,8), up C up -= n
+ lea (up,nneg,8), %rdx C rdx = up - n [up entry value]
+ mov rp, nneg C preserve rp over first call
+ mov 8(%rsp), %rcx C pass entry n
+C mov rp, %rdi
+ CALL( mpn_add_n)
+ test R32(%rax), R32(%rax)
+ jz L(ret)
+
+C mpn_sub_n (rp, rp, mp, n);
+C rdi rsi rdx rcx
+ mov nneg, %rdi
+ mov nneg, %rsi
+ mov mp, %rdx
+ mov 8(%rsp), %rcx C pass entry n
+ CALL( mpn_sub_n)
+
+L(ret):
+ add $8, %rsp
+ pop n C just increment rsp
+ pop %r14
+ pop %r13
+ pop %r12
+ pop %rbx
+ pop %rbp
+ ret
+EPILOGUE()
diff --git a/gmp/mpn/x86_64/rsh1add_n.asm b/gmp/mpn/x86_64/rsh1add_n.asm
new file mode 100644
index 0000000000..0dd46f2c48
--- /dev/null
+++ b/gmp/mpn/x86_64/rsh1add_n.asm
@@ -0,0 +1,146 @@
+dnl AMD64 mpn_rsh1add_n -- rp[] = (up[] + vp[]) >> 1
+
+dnl Copyright 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 K8,K9: 2.14 (mpn_add_n + mpn_rshift need 4.125)
+C K10: 2.14 (mpn_add_n + mpn_rshift need 4.125)
+C P4: 12.75
+C P6-15: 3.75
+
+C TODO
+C * Rewrite to use indexed addressing, like addlsh1.asm and sublsh1.asm.
+C * Try to approach the cache bandwidth 1.5 c/l. It should be possible.
+
+C INPUT PARAMETERS
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`vp',`%rdx')
+define(`n',`%rcx')
+define(`n32',`%ecx')
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+ .byte 0,0,0,0,0,0,0,0
+PROLOGUE(mpn_rsh1add_n)
+ pushq %rbx C 1
+
+ xorl %eax, %eax
+ movq (up), %rbx
+ addq (vp), %rbx
+
+ rcrq %rbx C rotate, save acy
+ adcl %eax, %eax C return value
+
+ movl n32, %r11d
+ andl $3, %r11d
+
+ cmpl $1, %r11d
+ je L(do) C jump if n = 1 5 9 ...
+
+L(n1): cmpl $2, %r11d
+ jne L(n2) C jump unless n = 2 6 10 ...
+ addq %rbx, %rbx C rotate carry limb, restore acy
+ movq 8(up), %r10
+ adcq 8(vp), %r10
+ leaq 8(up), up
+ leaq 8(vp), vp
+ leaq 8(rp), rp
+ rcrq %r10
+ rcrq %rbx
+ movq %rbx, -8(rp)
+ jmp L(cj1)
+
+L(n2): cmpl $3, %r11d
+ jne L(n3) C jump unless n = 3 7 11 ...
+ addq %rbx, %rbx C rotate carry limb, restore acy
+ movq 8(up), %r9
+ movq 16(up), %r10
+ adcq 8(vp), %r9
+ adcq 16(vp), %r10
+ leaq 16(up), up
+ leaq 16(vp), vp
+ leaq 16(rp), rp
+ rcrq %r10
+ rcrq %r9
+ rcrq %rbx
+ movq %rbx, -16(rp)
+ jmp L(cj2)
+
+L(n3): decq n C come here for n = 4 8 12 ...
+ addq %rbx, %rbx C rotate carry limb, restore acy
+ movq 8(up), %r8
+ movq 16(up), %r9
+ adcq 8(vp), %r8
+ adcq 16(vp), %r9
+ movq 24(up), %r10
+ adcq 24(vp), %r10
+ leaq 24(up), up
+ leaq 24(vp), vp
+ leaq 24(rp), rp
+ rcrq %r10
+ rcrq %r9
+ rcrq %r8
+ rcrq %rbx
+ movq %rbx, -24(rp)
+ movq %r8, -16(rp)
+L(cj2): movq %r9, -8(rp)
+L(cj1): movq %r10, %rbx
+
+L(do):
+ shrq $2, n C 4
+ je L(end) C 2
+ ALIGN(16)
+L(oop): addq %rbx, %rbx C rotate carry limb, restore acy
+
+ movq 8(up), %r8
+ movq 16(up), %r9
+ adcq 8(vp), %r8
+ adcq 16(vp), %r9
+ movq 24(up), %r10
+ movq 32(up), %r11
+ adcq 24(vp), %r10
+ adcq 32(vp), %r11
+
+ leaq 32(up), up
+ leaq 32(vp), vp
+
+ rcrq %r11 C rotate, save acy
+ rcrq %r10
+ rcrq %r9
+ rcrq %r8
+
+ rcrq %rbx
+ movq %rbx, (rp)
+ movq %r8, 8(rp)
+ movq %r9, 16(rp)
+ movq %r10, 24(rp)
+ movq %r11, %rbx
+
+ leaq 32(rp), rp
+ decq n
+ jne L(oop)
+
+L(end): movq %rbx, (rp)
+ popq %rbx
+ ret
+EPILOGUE()
diff --git a/gmp/mpn/x86_64/rsh1aors_n.asm b/gmp/mpn/x86_64/rsh1aors_n.asm
deleted file mode 100644
index a3e9cc5d23..0000000000
--- a/gmp/mpn/x86_64/rsh1aors_n.asm
+++ /dev/null
@@ -1,189 +0,0 @@
-dnl AMD64 mpn_rsh1add_n -- rp[] = (up[] + vp[]) >> 1
-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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public License and the
-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.14 (mpn_add_n + mpn_rshift need 4.125)
-C AMD K10 2.14 (mpn_add_n + mpn_rshift need 4.125)
-C Intel P4 12.75
-C Intel core2 3.75
-C Intel NMH 4.4
-C Intel SBR ?
-C Intel atom ?
-C VIA nano 3.25
-
-C TODO
-C * Rewrite to use indexed addressing, like addlsh1.asm and sublsh1.asm.
-
-C INPUT PARAMETERS
-define(`rp', `%rdi')
-define(`up', `%rsi')
-define(`vp', `%rdx')
-define(`n',` %rcx')
-
-ifdef(`OPERATION_rsh1add_n', `
- define(ADDSUB, add)
- define(ADCSBB, adc)
- define(func_n, mpn_rsh1add_n)
- define(func_nc, mpn_rsh1add_nc)')
-ifdef(`OPERATION_rsh1sub_n', `
- define(ADDSUB, sub)
- define(ADCSBB, sbb)
- define(func_n, mpn_rsh1sub_n)
- define(func_nc, mpn_rsh1sub_nc)')
-
-MULFUNC_PROLOGUE(mpn_rsh1add_n mpn_rsh1add_nc mpn_rsh1sub_n mpn_rsh1sub_nc)
-
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
-ASM_START()
- TEXT
- ALIGN(16)
-PROLOGUE(func_nc)
- FUNC_ENTRY(4)
-IFDOS(` mov 56(%rsp), %r8 ')
- push %rbx
-
- xor R32(%rax), R32(%rax)
- neg %r8 C set C flag from parameter
- mov (up), %rbx
- ADCSBB (vp), %rbx
- jmp L(ent)
-EPILOGUE()
-
- ALIGN(16)
-PROLOGUE(func_n)
- FUNC_ENTRY(4)
- push %rbx
-
- xor R32(%rax), R32(%rax)
- mov (up), %rbx
- ADDSUB (vp), %rbx
-L(ent):
- rcr %rbx C rotate, save acy
- adc R32(%rax), R32(%rax) C return value
-
- mov R32(n), R32(%r11)
- and $3, R32(%r11)
-
- cmp $1, R32(%r11)
- je L(do) C jump if n = 1 5 9 ...
-
-L(n1): cmp $2, R32(%r11)
- jne L(n2) C jump unless n = 2 6 10 ...
- add %rbx, %rbx C rotate carry limb, restore acy
- mov 8(up), %r10
- ADCSBB 8(vp), %r10
- lea 8(up), up
- lea 8(vp), vp
- lea 8(rp), rp
- rcr %r10
- rcr %rbx
- mov %rbx, -8(rp)
- jmp L(cj1)
-
-L(n2): cmp $3, R32(%r11)
- jne L(n3) C jump unless n = 3 7 11 ...
- add %rbx, %rbx C rotate carry limb, restore acy
- mov 8(up), %r9
- mov 16(up), %r10
- ADCSBB 8(vp), %r9
- ADCSBB 16(vp), %r10
- lea 16(up), up
- lea 16(vp), vp
- lea 16(rp), rp
- rcr %r10
- rcr %r9
- rcr %rbx
- mov %rbx, -16(rp)
- jmp L(cj2)
-
-L(n3): dec n C come here for n = 4 8 12 ...
- add %rbx, %rbx C rotate carry limb, restore acy
- mov 8(up), %r8
- mov 16(up), %r9
- ADCSBB 8(vp), %r8
- ADCSBB 16(vp), %r9
- mov 24(up), %r10
- ADCSBB 24(vp), %r10
- lea 24(up), up
- lea 24(vp), vp
- lea 24(rp), rp
- rcr %r10
- rcr %r9
- rcr %r8
- rcr %rbx
- mov %rbx, -24(rp)
- mov %r8, -16(rp)
-L(cj2): mov %r9, -8(rp)
-L(cj1): mov %r10, %rbx
-
-L(do):
- shr $2, n C 4
- je L(end) C 2
- ALIGN(16)
-L(top): add %rbx, %rbx C rotate carry limb, restore acy
-
- mov 8(up), %r8
- mov 16(up), %r9
- ADCSBB 8(vp), %r8
- ADCSBB 16(vp), %r9
- mov 24(up), %r10
- mov 32(up), %r11
- ADCSBB 24(vp), %r10
- ADCSBB 32(vp), %r11
-
- lea 32(up), up
- lea 32(vp), vp
-
- rcr %r11 C rotate, save acy
- rcr %r10
- rcr %r9
- rcr %r8
-
- rcr %rbx
- mov %rbx, (rp)
- mov %r8, 8(rp)
- mov %r9, 16(rp)
- mov %r10, 24(rp)
- mov %r11, %rbx
-
- lea 32(rp), rp
- dec n
- jne L(top)
-
-L(end): mov %rbx, (rp)
- pop %rbx
- FUNC_EXIT()
- ret
-EPILOGUE()
diff --git a/gmp/mpn/x86_64/rsh1sub_n.asm b/gmp/mpn/x86_64/rsh1sub_n.asm
new file mode 100644
index 0000000000..b08bba4735
--- /dev/null
+++ b/gmp/mpn/x86_64/rsh1sub_n.asm
@@ -0,0 +1,146 @@
+dnl AMD64 mpn_rsh1sub_n -- rp[] = (up[] - vp[]) >> 1
+
+dnl Copyright 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 K8,K9: 2.14 (mpn_add_n + mpn_rshift need 4.125)
+C K10: 2.14 (mpn_add_n + mpn_rshift need 4.125)
+C P4: 12.75
+C P6-15: 3.75
+
+C TODO
+C * Rewrite to use indexed addressing, like addlsh1.asm and sublsh1.asm.
+C * Try to approach the cache bandwidth 1.5 c/l. It should be possible.
+
+C INPUT PARAMETERS
+define(`rp',`%rdi')
+define(`up',`%rsi')
+define(`vp',`%rdx')
+define(`n',`%rcx')
+define(`n32',`%ecx')
+
+ASM_START()
+ TEXT
+ ALIGN(16)
+ .byte 0,0,0,0,0,0,0,0
+PROLOGUE(mpn_rsh1sub_n)
+ pushq %rbx C 1
+
+ xorl %eax, %eax
+ movq (up), %rbx
+ subq (vp), %rbx
+
+ rcrq %rbx C rotate, save acy
+ adcl %eax, %eax C return value
+
+ movl n32, %r11d
+ andl $3, %r11d
+
+ cmpl $1, %r11d
+ je L(do) C jump if n = 1 5 9 ...
+
+L(n1): cmpl $2, %r11d
+ jne L(n2) C jump unless n = 2 6 10 ...
+ addq %rbx, %rbx C rotate carry limb, restore acy
+ movq 8(up), %r10
+ sbbq 8(vp), %r10
+ leaq 8(up), up
+ leaq 8(vp), vp
+ leaq 8(rp), rp
+ rcrq %r10
+ rcrq %rbx
+ movq %rbx, -8(rp)
+ jmp L(cj1)
+
+L(n2): cmpl $3, %r11d
+ jne L(n3) C jump unless n = 3 7 11 ...
+ addq %rbx, %rbx C rotate carry limb, restore acy
+ movq 8(up), %r9
+ movq 16(up), %r10
+ sbbq 8(vp), %r9
+ sbbq 16(vp), %r10
+ leaq 16(up), up
+ leaq 16(vp), vp
+ leaq 16(rp), rp
+ rcrq %r10
+ rcrq %r9
+ rcrq %rbx
+ movq %rbx, -16(rp)
+ jmp L(cj2)
+
+L(n3): decq n C come here for n = 4 8 12 ...
+ addq %rbx, %rbx C rotate carry limb, restore acy
+ movq 8(up), %r8
+ movq 16(up), %r9
+ sbbq 8(vp), %r8
+ sbbq 16(vp), %r9
+ movq 24(up), %r10
+ sbbq 24(vp), %r10
+ leaq 24(up), up
+ leaq 24(vp), vp
+ leaq 24(rp), rp
+ rcrq %r10
+ rcrq %r9
+ rcrq %r8
+ rcrq %rbx
+ movq %rbx, -24(rp)
+ movq %r8, -16(rp)
+L(cj2): movq %r9, -8(rp)
+L(cj1): movq %r10, %rbx
+
+L(do):
+ shrq $2, n C 4
+ je L(end) C 2
+ ALIGN(16)
+L(oop): addq %rbx, %rbx C rotate carry limb, restore acy
+
+ movq 8(up), %r8
+ movq 16(up), %r9
+ sbbq 8(vp), %r8
+ sbbq 16(vp), %r9
+ movq 24(up), %r10
+ movq 32(up), %r11
+ sbbq 24(vp), %r10
+ sbbq 32(vp), %r11
+
+ leaq 32(up), up
+ leaq 32(vp), vp
+
+ rcrq %r11 C rotate, save acy
+ rcrq %r10
+ rcrq %r9
+ rcrq %r8
+
+ rcrq %rbx
+ movq %rbx, (rp)
+ movq %r8, 8(rp)
+ movq %r9, 16(rp)
+ movq %r10, 24(rp)
+ movq %r11, %rbx
+
+ leaq 32(rp), rp
+ decq n
+ jne L(oop)
+
+L(end): movq %rbx, (rp)
+ popq %rbx
+ ret
+EPILOGUE()
diff --git a/gmp/mpn/x86_64/rshift.asm b/gmp/mpn/x86_64/rshift.asm
index 3f344f1dfc..8979d29ea8 100644
--- a/gmp/mpn/x86_64/rshift.asm
+++ b/gmp/mpn/x86_64/rshift.asm
@@ -1,44 +1,31 @@
-dnl AMD64 mpn_rshift -- mpn right shift.
+dnl AMD64 mpn_rshift -- mpn left 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 either:
+dnl Copyright 2003, 2005 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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 8
-C Intel core2 2.11
-C Intel corei ?
-C Intel atom 5.75
-C VIA nano 3.5
+C K8,K9: 2.375
+C K10: 2.375
+C P4: 8
+C P6-15 (Core2): 2.11
+C P6-28 (Atom): 5.75
C INPUT PARAMETERS
@@ -47,18 +34,14 @@ define(`up', `%rsi')
define(`n', `%rdx')
define(`cnt', `%rcx')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(32)
PROLOGUE(mpn_rshift)
- FUNC_ENTRY(4)
- neg R32(%rcx) C put rsh count in cl
+ neg %ecx C put rsh count in cl
mov (up), %rax
- shl R8(%rcx), %rax C function return value
- neg R32(%rcx) C put lsh count in cl
+ shl %cl, %rax C function return value
+ neg %ecx C put lsh count in cl
lea 1(n), R32(%r8)
@@ -73,10 +56,10 @@ PROLOGUE(mpn_rshift)
jne L(1)
C n = 4, 8, 12, ...
mov 8(up,n,8), %r10
- shr R8(%rcx), %r10
- neg R32(%rcx) C put rsh count in cl
+ shr %cl, %r10
+ neg %ecx C put rsh count in cl
mov 16(up,n,8), %r8
- shl R8(%rcx), %r8
+ shl %cl, %r8
or %r8, %r10
mov %r10, 8(rp,n,8)
inc n
@@ -86,91 +69,90 @@ L(1): dec R32(%r8)
je L(1x) C jump for n = 1, 5, 9, 13, ...
C n = 2, 6, 10, 16, ...
mov 8(up,n,8), %r10
- shr R8(%rcx), %r10
- neg R32(%rcx) C put rsh count in cl
+ shr %cl, %r10
+ neg %ecx C put rsh count in cl
mov 16(up,n,8), %r8
- shl R8(%rcx), %r8
+ shl %cl, %r8
or %r8, %r10
mov %r10, 8(rp,n,8)
inc n
- neg R32(%rcx) C put lsh count in cl
+ neg %ecx C put lsh count in cl
L(1x):
cmp $-1, n
je L(ast)
mov 8(up,n,8), %r10
- shr R8(%rcx), %r10
+ shr %cl, %r10
mov 16(up,n,8), %r11
- shr R8(%rcx), %r11
- neg R32(%rcx) C put rsh count in cl
+ shr %cl, %r11
+ neg %ecx C put rsh count in cl
mov 16(up,n,8), %r8
mov 24(up,n,8), %r9
- shl R8(%rcx), %r8
+ shl %cl, %r8
or %r8, %r10
- shl R8(%rcx), %r9
+ shl %cl, %r9
or %r9, %r11
mov %r10, 8(rp,n,8)
mov %r11, 16(rp,n,8)
add $2, n
-L(rll): neg R32(%rcx) C put lsh count in cl
+L(rll): neg %ecx C put lsh count in cl
L(rlx): mov 8(up,n,8), %r10
- shr R8(%rcx), %r10
+ shr %cl, %r10
mov 16(up,n,8), %r11
- shr R8(%rcx), %r11
+ shr %cl, %r11
add $4, n C 4
jb L(end) C 2
ALIGN(16)
L(top):
C finish stuff from lsh block
- neg R32(%rcx) C put rsh count in cl
+ neg %ecx C put rsh count in cl
mov -16(up,n,8), %r8
mov -8(up,n,8), %r9
- shl R8(%rcx), %r8
+ shl %cl, %r8
or %r8, %r10
- shl R8(%rcx), %r9
+ shl %cl, %r9
or %r9, %r11
mov %r10, -24(rp,n,8)
mov %r11, -16(rp,n,8)
C start two new rsh
mov (up,n,8), %r8
mov 8(up,n,8), %r9
- shl R8(%rcx), %r8
- shl R8(%rcx), %r9
+ shl %cl, %r8
+ shl %cl, %r9
C finish stuff from rsh block
- neg R32(%rcx) C put lsh count in cl
+ neg %ecx C put lsh count in cl
mov -8(up,n,8), %r10
mov 0(up,n,8), %r11
- shr R8(%rcx), %r10
+ shr %cl, %r10
or %r10, %r8
- shr R8(%rcx), %r11
+ shr %cl, %r11
or %r11, %r9
mov %r8, -8(rp,n,8)
mov %r9, 0(rp,n,8)
C start two new lsh
mov 8(up,n,8), %r10
mov 16(up,n,8), %r11
- shr R8(%rcx), %r10
- shr R8(%rcx), %r11
+ shr %cl, %r10
+ shr %cl, %r11
add $4, n
jae L(top) C 2
L(end):
- neg R32(%rcx) C put rsh count in cl
- mov -8(up), %r8
- shl R8(%rcx), %r8
+ neg %ecx C put rsh count in cl
+ mov -16(up,n,8), %r8
+ shl %cl, %r8
or %r8, %r10
- mov (up), %r9
- shl R8(%rcx), %r9
+ mov -8(up,n,8), %r9
+ shl %cl, %r9
or %r9, %r11
- mov %r10, -16(rp)
- mov %r11, -8(rp)
+ mov %r10, -24(rp,n,8)
+ mov %r11, -16(rp,n,8)
- neg R32(%rcx) C put lsh count in cl
+ neg %ecx C put lsh count in cl
L(ast): mov (up), %r10
- shr R8(%rcx), %r10
+ shr %cl, %r10
mov %r10, (rp)
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/sec_tabselect.asm b/gmp/mpn/x86_64/sec_tabselect.asm
deleted file mode 100644
index e8aed261ef..0000000000
--- a/gmp/mpn/x86_64/sec_tabselect.asm
+++ /dev/null
@@ -1,176 +0,0 @@
-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/gmp/mpn/x86_64/k8/sqr_basecase.asm b/gmp/mpn/x86_64/sqr_basecase.asm
index 60cf945a46..3ed4be1269 100644
--- a/gmp/mpn/x86_64/k8/sqr_basecase.asm
+++ b/gmp/mpn/x86_64/sqr_basecase.asm
@@ -2,33 +2,22 @@ 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 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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')
@@ -36,21 +25,14 @@ 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 * This code only handles operands up to SQR_KARATSUBA_THRESHOLD_MAX. That
+C means we can safely use 32-bit operations for all sizes, unlike in e.g.,
+C mpn_addmul_1.
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 * The special code for n=1,2,3 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 * Consider combining small cases code so that the n=k-1 code jumps into
+C the middle of the n=k code.
C * Avoid saving registers for small cases code.
C * Needed variables:
C n r11 input size
@@ -75,6 +57,12 @@ define(`rp', `%rdi')
define(`up', `%rsi')
define(`n_param', `%rdx')
+C We should really trim this, for better spatial locality. Alternatively,
+C we could grab the upper part of the stack area, leaving the lower part
+C instead of the upper part unused.
+define(`SQR_KARATSUBA_THRESHOLD_MAX', 120)
+define(`STACK_ALLOC', eval(8*2*SQR_KARATSUBA_THRESHOLD_MAX))
+
define(`n', `%r11')
define(`tp', `%r12')
define(`i', `%r8')
@@ -86,137 +74,125 @@ define(`w1', `%rcx')
define(`w2', `%rbp')
define(`w3', `%r10')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
+define(`SPECIAL_CODE_FOR_4',1)
+
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
+PROLOGUE(mpn_sqr_basecase)
+ add $-48, %rsp
+ mov %rbx, 40(%rsp)
+ mov %rbp, 32(%rsp)
+ mov %r12, 24(%rsp)
+ mov %r13, 16(%rsp)
+ mov %r14, 8(%rsp)
+ mov R32(n_param), R32(n) C free original n register (rdx)
+ mov R32(n_param), R32(%rcx)
and $3, R32(%rcx)
+ lea 4(%rcx), %rbx
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
-',`
+ cmovg %rbx, %rcx
+ lea L(jmptab)(%rip), %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))
+L(jmptab):
+ .quad L(4)
+ .quad L(1)
+ .quad L(2)
+ .quad L(3)
+ .quad L(0m4)
+ .quad L(1m4)
+ .quad L(2m4)
+ .quad L(3m4)
TEXT
L(1): mov (up), %rax
mul %rax
- add $40, %rsp
mov %rax, (rp)
mov %rdx, 8(rp)
- FUNC_EXIT()
+ add $40, %rsp
+ pop %rbx
ret
L(2): mov (up), %rax
- mov %rax, %r8
mul %rax
- mov 8(up), %r11
mov %rax, (rp)
- mov %r11, %rax
mov %rdx, %r9
+ mov 8(up), %rax
mul %rax
- add $40, %rsp
mov %rax, %r10
- mov %r11, %rax
mov %rdx, %r11
- mul %r8
- xor %r8, %r8
+ mov 8(up), %rax
+ mov (up), %rbx
+ mul %rbx
add %rax, %r9
adc %rdx, %r10
- adc %r8, %r11
+ adc $0, %r11
add %rax, %r9
mov %r9, 8(rp)
adc %rdx, %r10
mov %r10, 16(rp)
- adc %r8, %r11
+ adc $0, %r11
mov %r11, 24(rp)
- FUNC_EXIT()
+ add $40, %rsp
+ pop %rbx
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)
+ mov 8(up), %rax
mul %rax
- mov 16(up), %rcx
mov %rax, 16(rp)
- mov %rcx, %rax
mov %rdx, 24(rp)
+ mov 16(up), %rax
mul %rax
mov %rax, 32(rp)
mov %rdx, 40(rp)
- mov %r11, %rax
- mul %r10
+ mov (up), %rbx
+ mov 8(up), %rax
+ mul %rbx
mov %rax, %r8
- mov %rcx, %rax
mov %rdx, %r9
- mul %r10
- xor %r10, %r10
+ mov 16(up), %rax
+ mul %rbx
+ xor R32(%r10), R32(%r10)
add %rax, %r9
- mov %r11, %rax
- mov %r10, %r11
adc %rdx, %r10
- mul %rcx
- add $40, %rsp
+ mov 8(up), %rbx
+ mov 16(up), %rax
+ mul %rbx
+ xor R32(%r11), R32(%r11)
add %rax, %r10
- adc %r11, %rdx
+ adc %rdx, %r11
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
- adc %rdx, %rdx
adc %r11, %r11
+ mov $0, R32(%rbx)
+ adc %rbx, %rbx
add %r8, 8(rp)
adc %r9, 16(rp)
adc %r10, 24(rp)
- adc %rdx, 32(rp)
- adc %r11, 40(rp)
- FUNC_EXIT()
+ adc %r11, 32(rp)
+ adc %rbx, 40(rp)
+ add $40, %rsp
+ pop %rbx
ret
+ifdef(`SPECIAL_CODE_FOR_4',`
L(4): mov (up), %rax
- mov %rax, %r11
mul %rax
- mov 8(up), %rbx
mov %rax, (rp)
- mov %rbx, %rax
mov %rdx, 8(rp)
+ mov 8(up), %rax
mul %rax
mov %rax, 16(rp)
mov %rdx, 24(rp)
@@ -227,71 +203,77 @@ L(4): mov (up), %rax
mov 24(up), %rax
mul %rax
mov %rax, 48(rp)
- mov %rbx, %rax
mov %rdx, 56(rp)
- mul %r11
- add $32, %rsp
+ mov (up), %rbx
+ mov 8(up), %rax
+ mul %rbx
mov %rax, %r8
mov %rdx, %r9
mov 16(up), %rax
- mul %r11
- xor %r10, %r10
+ mul %rbx
+ xor R32(%r10), R32(%r10)
add %rax, %r9
adc %rdx, %r10
mov 24(up), %rax
- mul %r11
- xor %r11, %r11
+ mul %rbx
+ xor R32(%r11), R32(%r11)
add %rax, %r10
adc %rdx, %r11
+ mov 8(up), %rbx
mov 16(up), %rax
mul %rbx
- xor %rcx, %rcx
+ xor R32(%r12), R32(%r12)
add %rax, %r10
adc %rdx, %r11
- adc $0, %rcx
+ adc $0, %r12
mov 24(up), %rax
mul %rbx
- pop %rbx
add %rax, %r11
- adc %rdx, %rcx
- mov 16(up), %rdx
+ adc %rdx, %r12
+ mov 16(up), %rbx
mov 24(up), %rax
- mul %rdx
- add %rax, %rcx
- adc $0, %rdx
+ mul %rbx
+ xor R32(%rbp), R32(%rbp)
+ add %rax, %r12
+ adc %rdx, %rbp
add %r8, %r8
adc %r9, %r9
adc %r10, %r10
adc %r11, %r11
- adc %rcx, %rcx
- mov $0, R32(%rax)
- adc %rdx, %rdx
+ adc %r12, %r12
+ mov $0, R32(%rbx)
+ adc %rbp, %rbp
- adc %rax, %rax
+ adc %rbx, %rbx
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()
+ adc %r12, 40(rp)
+ adc %rbp, 48(rp)
+ adc %rbx, 56(rp)
+ add $24, %rsp
+ pop %r12
+ pop %rbp
+ pop %rbx
ret
+')
-
-L(0m4):
- lea -16(rp,n,8), tp C point tp in middle of result operand
- mov (up), v0
- mov 8(up), %rax
+L(0m4): add $-STACK_ALLOC, %rsp
+ lea (%rsp,n,8), tp C point tp in middle of result operand
lea (up,n,8), up C point up at end of input operand
- lea -4(n), i
+ lea -1(n), i
C Function mpn_mul_1_m3(tp, up - i, i, up[-i - 1])
- xor R32(j), R32(j)
- sub n, j
+ mov $-1, j
+ sub i, j
+
+ lea -24(tp), tp C offset FIXME
+ mov (up,j,8), v0
+ mov 8(up,j,8), %rax
mul v0
xor R32(w2), R32(w2)
mov %rax, w0
@@ -333,28 +315,31 @@ L(L3): xor R32(w1), R32(w1)
adc %rdx, w1
mov w2, 8(tp)
mov w1, 16(tp)
-
- lea eval(2*8)(tp), tp C tp += 2
- lea -8(up), up
+ lea eval(24+2*8)(tp), tp C tp += 2, undo offset FIXME
+ifdef(`SPECIAL_CODE_FOR_4',`',`
+ cmp $3, R32(i)
+ je L(last)
+')
jmp L(dowhile)
+L(1m4): add $-STACK_ALLOC, %rsp
+ lea (%rsp,n,8), tp C point tp in middle of result operand
+ lea (up,n,8), up C point up at end of input operand
-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
+ lea (n), i
C Function mpn_mul_2s_m0(tp, up - i, i, up - i - 1)
- lea -3(n), j
- neg j
+ mov $3, R32(j)
+ sub i, j
+
+ lea 8(up), up C offset FIXME
- mov %rax, v1 C u1
+ mov -32(up,j,8), v0 C u0
+ mov -24(up,j,8), v1 C u1
+ mov -24(up,j,8), %rax C u1
mul v0 C u0 * u1
mov %rdx, w1
xor R32(w2), R32(w2)
- mov %rax, 8(rp)
+ mov %rax, -24(tp,j,8)
jmp L(m0)
ALIGN(16)
@@ -396,7 +381,7 @@ L(m0): mov -16(up,j,8), %rax C u2, u6 ...
add %rax, w3
mov w2, -8(tp,j,8)
adc %rdx, w0
-L(m2x): mov (up,j,8), %rax
+ mov (up,j,8), %rax
mul v0
add %rax, w3
adc %rdx, w0
@@ -412,22 +397,28 @@ L(m2x): mov (up,j,8), %rax
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)
+ lea -8(up), up C undo offset FIXME
+ lea eval(3*8)(tp), tp C tp += 3
+ add $-2, R32(i) C i -= 2
+ cmp $3, R32(i)
+ je L(last)
+ jmp L(dowhile)
-L(2m4):
- lea -16(rp,n,8), tp C point tp in middle of result operand
- mov (up), v0
- mov 8(up), %rax
+
+L(2m4): add $-STACK_ALLOC, %rsp
+ lea (%rsp,n,8), tp C point tp in middle of result operand
lea (up,n,8), up C point up at end of input operand
- lea -4(n), i
+ lea -1(n), i
C Function mpn_mul_1_m1(tp, up - (i - 1), i - 1, up[-i])
- lea -2(n), j
- neg j
+ mov $1, R32(j)
+ sub i, j
+
+ lea -24(tp), tp C offset FIXME
+ mov -16(up,j,8), v0
+ mov -8(up,j,8), %rax
mul v0
mov %rax, w2
mov (up,j,8), %rax
@@ -469,28 +460,30 @@ L(L1): xor R32(w0), R32(w0)
mov w2, 8(tp)
mov w1, 16(tp)
- lea eval(2*8)(tp), tp C tp += 2
- lea -8(up), up
+ lea eval(24+2*8)(tp), tp C tp += 2, undo offset FIXME
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
+L(3m4): add $-STACK_ALLOC, %rsp
+ lea (%rsp,n,8), tp C point tp in middle of result operand
+ lea (up,n,8), up C point up at end of input operand
+
+ lea (n), i
C Function mpn_mul_2s_m2(tp, up - i + 1, i - 1, up - i)
- lea -1(n), j
- neg j
+ mov $1, R32(j)
+ sub i, j
- mov %rax, v1 C u1
- mul v0 C u0 * u1
+ lea 8(up), up C offset FIXME
+
+ mov -16(up,j,8), v0
+ mov -8(up,j,8), v1
+ mov -8(up,j,8), %rax
+ mul v0 C v0 * u0
mov %rdx, w3
xor R32(w0), R32(w0)
xor R32(w1), R32(w1)
- mov %rax, 8(rp)
+ mov %rax, -8(tp,j,8)
jmp L(m2)
ALIGN(16)
@@ -548,13 +541,18 @@ L(m2): mov (up,j,8), %rax
mov w0, -8(tp)
mov w1, (tp)
- lea -16(up), up
+ lea -8(up), up C undo offset FIXME
+ lea eval(3*8)(tp), tp C tp += 3
+ add $-2, R32(i) C i -= 2
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 $-1, j
+ sub i, j
+
+ lea -24(tp), tp C offset FIXME
+ lea -8(up), up C offset FIXME
mov 16(up,j,8), v0
mov 24(up,j,8), v1
@@ -623,13 +621,18 @@ L(am2): mov 32(up,j,8), %rax
mov w1, 16(tp)
lea eval(2*8)(tp), tp C tp += 2
-
add $-2, R32(i) C i -= 2
+ lea 24(tp), tp C undo offset FIXME
+ lea 8(up), up C undo offset FIXME
+
L(dowhile_mid):
C Function mpn_addmul_2s_m0(tp, up - (i - 1), i - 1, up - i)
- lea 2(i), j
- neg j
+ mov $1, R32(j)
+ sub i, j
+
+ lea -24(tp), tp C offset FIXME
+ lea -8(up), up C offset FIXME
mov (up,j,8), v0
mov 8(up,j,8), v1
@@ -696,57 +699,74 @@ L(20): mov 16(up,j,8), %rax
mov w0, 8(tp)
mov w1, 16(tp)
- lea eval(2*8)(tp), tp C tp += 2
-L(dowhile_end):
+ lea 24(tp), tp C undo offset FIXME
+ lea 8(up), up C undo offset FIXME
+ lea eval(2*8)(tp), tp C tp += 2
add $-2, R32(i) C i -= 2
+
+ cmp $3, R32(i)
jne L(dowhile)
+L(last):
+
C Function mpn_addmul_2s_2
- mov -16(up), v0
- mov -8(up), v1
- mov -8(up), %rax
+ mov -24(up), v0
+ mov -16(up), v1
+ mov -16(up), %rax
mul v0
xor R32(w3), R32(w3)
- add %rax, -8(tp)
+ add %rax, -32(tp)
adc %rdx, w3
xor R32(w0), R32(w0)
xor R32(w1), R32(w1)
- mov (up), %rax
+ mov -8(up), %rax
mul v0
add %rax, w3
- mov (up), %rax
+ mov -8(up), %rax
adc %rdx, w0
mul v1
- add w3, (tp)
+ add w3, -24(tp)
adc %rax, w0
adc %rdx, w1
- mov w0, 8(tp)
- mov w1, 16(tp)
+ mov w0, -16(tp)
+ mov w1, -8(tp)
C Function mpn_sqr_diag_addlsh1
- lea -4(n,n), j
+ mov R32(n), R32(j)
+ shl $3, n
+ sub n, up
+
+ mov (%rsp), %r11
- mov 8(rp), %r11
- lea -8(up), up
- lea (rp,j,8), rp
+ bt $0, j
+ lea -4(j,j),j
+ jc L(odd)
+
+L(evn): lea (rp,j,8), rp
+ lea (up,j,4), up
+ lea 8(%rsp,j,8), tp
neg j
- mov (up,j,4), %rax
- mul %rax
- test $2, R8(j)
- jnz L(odd)
-L(evn): add %r11, %r11
+ add %r11, %r11
sbb R32(%rbx), R32(%rbx) C save CF
+ mov (up,j,4), %rax
+ mul %rax
add %rdx, %r11
mov %rax, (rp,j,8)
jmp L(d0)
-L(odd): add %r11, %r11
+L(odd): lea -16(rp,j,8), rp
+ lea -8(up,j,4), up
+ lea -8(%rsp,j,8), tp
+ neg j
+
+ add %r11, %r11
sbb R32(%rbp), R32(%rbp) C save CF
+ mov 8(up,j,4), %rax
+ mul %rax
add %rdx, %r11
- mov %rax, (rp,j,8)
- lea -2(j), j
+ mov %rax, 16(rp,j,8)
jmp L(d1)
ALIGN(16)
@@ -757,9 +777,9 @@ L(top): mov (up,j,4), %rax
adc %rdx, %r11
mov %r10, (rp,j,8)
L(d0): mov %r11, 8(rp,j,8)
- mov 16(rp,j,8), %r10
+ mov (tp,j,8), %r10
adc %r10, %r10
- mov 24(rp,j,8), %r11
+ mov 8(tp,j,8), %r11
adc %r11, %r11
nop
sbb R32(%rbp), R32(%rbp) C save CF
@@ -770,38 +790,38 @@ L(d0): mov %r11, 8(rp,j,8)
adc %rdx, %r11
mov %r10, 16(rp,j,8)
L(d1): mov %r11, 24(rp,j,8)
- mov 32(rp,j,8), %r10
+ mov 16(tp,j,8), %r10
adc %r10, %r10
- mov 40(rp,j,8), %r11
+ mov 24(tp,j,8), %r11
adc %r11, %r11
sbb R32(%rbx), R32(%rbx) C save CF
add $4, j
js L(top)
- mov (up), %rax
+L(end): mov (up,j,4), %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
+ mov %r10, (rp,j,8)
+ mov %r11, 8(rp,j,8)
+ mov (tp,j,8), %r10
adc %r10, %r10
sbb R32(%rbp), R32(%rbp) C save CF
neg R32(%rbp)
- mov 8(up), %rax
+ mov 8(up,j,4), %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)
+ mov %r10, 16(rp,j,8)
+ mov %rdx, 24(rp,j,8)
+ add $eval(8+STACK_ALLOC), %rsp
pop %r14
pop %r13
pop %r12
pop %rbp
pop %rbx
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/sqr_diag_addlsh1.asm b/gmp/mpn/x86_64/sqr_diag_addlsh1.asm
deleted file mode 100644
index 4ad034c855..0000000000
--- a/gmp/mpn/x86_64/sqr_diag_addlsh1.asm
+++ /dev/null
@@ -1,116 +0,0 @@
-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()
diff --git a/gmp/mpn/x86_64/sublsh1_n.asm b/gmp/mpn/x86_64/sublsh1_n.asm
index c6d829fcb2..a943ed1579 100644
--- a/gmp/mpn/x86_64/sublsh1_n.asm
+++ b/gmp/mpn/x86_64/sublsh1_n.asm
@@ -1,44 +1,31 @@
dnl AMD64 mpn_sublsh1_n -- rp[] = up[] - (vp[] << 1)
-dnl Copyright 2003, 2005-2007, 2011, 2012 Free Software Foundation, Inc.
+dnl Copyright 2003, 2005, 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 either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
-dnl
-dnl or both in parallel, as here.
-dnl
+dnl it under the terms of the GNU Lesser General Public 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 General Public License
-dnl for more details.
-dnl
-dnl You should have received copies of the GNU General Public 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 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public
+dnl License for more details.
+
+dnl You should have received 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.2
-C AMD K10 2.2
-C Intel P4 12.75
-C Intel core2 3.45
-C Intel corei ?
-C Intel atom ?
-C VIA nano 3.25
+C K8,K9: 2.2
+C K10: 2.2
+C P4: 12.75
+C P6-15: 3.45
+
C Sometimes speed degenerates, supposedly related to that some operand
C alignments cause cache conflicts.
@@ -52,14 +39,10 @@ define(`up',`%rsi')
define(`vp',`%rdx')
define(`n', `%rcx')
-ABI_SUPPORT(DOS64)
-ABI_SUPPORT(STD64)
-
ASM_START()
TEXT
ALIGN(16)
PROLOGUE(mpn_sublsh1_n)
- FUNC_ENTRY(4)
push %rbx
push %rbp
@@ -119,7 +102,7 @@ L(b01): add %r8, %r8
L(ent): jns L(end)
ALIGN(16)
-L(top): add R32(%rax), R32(%rax) C restore scy
+L(oop): add R32(%rax), R32(%rax) C restore scy
mov (vp,n,8), %r8
L(b00): adc %r8, %r8
@@ -148,13 +131,12 @@ L(b00): adc %r8, %r8
sbb R32(%rbp), R32(%rbp) C save acy
add $4, n
- js L(top)
+ js L(oop)
L(end): add R32(%rbp), R32(%rax)
neg R32(%rax)
pop %rbp
pop %rbx
- FUNC_EXIT()
ret
EPILOGUE()
diff --git a/gmp/mpn/x86_64/x86_64-defs.m4 b/gmp/mpn/x86_64/x86_64-defs.m4
index 366598b41d..fc296c2a1e 100644
--- a/gmp/mpn/x86_64/x86_64-defs.m4
+++ b/gmp/mpn/x86_64/x86_64-defs.m4
@@ -2,78 +2,30 @@ divert(-1)
dnl m4 macros for amd64 assembler.
-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 modify
-dnl it under the terms of either:
-dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
+dnl Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software
+dnl Foundation, Inc.
dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received a copy of the GNU Lesser General Public License
+dnl along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
-dnl Usage: CPUVEC_FUNCS_LIST
+dnl Notes:
dnl
-dnl A list of the functions from gmp-impl.h x86 struct cpuvec_t, in the
-dnl order they appear in that structure.
-
-define(CPUVEC_FUNCS_LIST,
-``add_n',
-`addlsh1_n',
-`addlsh2_n',
-`addmul_1',
-`addmul_2',
-`bdiv_dbm1c',
-`cnd_add_n',
-`cnd_sub_n',
-`com',
-`copyd',
-`copyi',
-`divexact_1',
-`divrem_1',
-`gcd_1',
-`lshift',
-`lshiftc',
-`mod_1',
-`mod_1_1p',
-`mod_1_1p_cps',
-`mod_1s_2p',
-`mod_1s_2p_cps',
-`mod_1s_4p',
-`mod_1s_4p_cps',
-`mod_34lsub1',
-`modexact_1c_odd',
-`mul_1',
-`mul_basecase',
-`mullo_basecase',
-`preinv_divrem_1',
-`preinv_mod_1',
-`redc_1',
-`redc_2',
-`rshift',
-`sqr_basecase',
-`sub_n',
-`sublsh1_n',
-`submul_1'')
+dnl The 32-bit mode x86/x86-defs.m4 has various 32bit-isms, like the
+dnl profiling calls, so it seems cleanest to start a fresh set of defines
+dnl for 64-bit mode.
dnl Called: PROLOGUE_cpu(GSYM_PREFIX`'foo)
@@ -135,11 +87,8 @@ define(`ASSERT_counter',incr(ASSERT_counter))')')')
define(ASSERT_counter,1)
-define(`LEA',`dnl
-ifdef(`PIC',
- `mov $1@GOTPCREL(%rip), $2'
-,
- `movabs `$'$1, $2')
+define(`LEA',`
+ mov $1@GOTPCREL(%rip), $2
')
@@ -192,163 +141,11 @@ define(`R8',
dnl Usage: CALL(funcname)
dnl
-define(`CALL',`dnl
ifdef(`PIC',
- `call GSYM_PREFIX`'$1@PLT'
-,
- `call GSYM_PREFIX`'$1'
-)')
+ `define(`CALL',`call GSYM_PREFIX`'$1@PLT')',
+ `define(`CALL',`call GSYM_PREFIX`'$1')')
define(`JUMPTABSECT', `.section .data.rel.ro.local,"aw",@progbits')
-
-dnl Usage: JMPENT(targlabel,tablabel)
-
-define(`JMPENT',`dnl
-ifdef(`PIC',
- `.long $1-$2'
-,
- `.quad $1'
-)')
-
-
-dnl These macros are defined just for DOS64, where they provide calling
-dnl sequence glue code.
-
-define(`FUNC_ENTRY',`')
-define(`FUNC_EXIT',`')
-
-
-dnl Target ABI macros.
-
-define(`IFDOS', `')
-define(`IFSTD', `$1')
-define(`IFELF', `$1')
-
-
-dnl Usage: PROTECT(symbol)
-dnl
-dnl Used for private GMP symbols that should never be overridden by users.
-dnl This can save reloc entries and improve shlib sharing as well as
-dnl application startup times
-
-define(`PROTECT', `.hidden $1')
-
-
-dnl Usage: x86_lookup(target, key,value, key,value, ...)
-dnl
-dnl Look for `target' among the `key' parameters.
-dnl
-dnl x86_lookup expands to the corresponding `value', or generates an error
-dnl if `target' isn't found.
-
-define(x86_lookup,
-m4_assert_numargs_range(1,999)
-`ifelse(eval($#<3),1,
-`m4_error(`unrecognised part of x86 instruction: $1
-')',
-`ifelse(`$1',`$2', `$3',
-`x86_lookup(`$1',shift(shift(shift($@))))')')')
-
-
-dnl Usage: x86_opcode_regxmm(reg)
-dnl
-dnl Validate the given xmm register, and return its number, 0 to 7.
-
-define(x86_opcode_regxmm,
-m4_assert_numargs(1)
-`x86_lookup(`$1',x86_opcode_regxmm_list)')
-
-define(x86_opcode_regxmm_list,
-``%xmm0',0,
-`%xmm1',1,
-`%xmm2',2,
-`%xmm3',3,
-`%xmm4',4,
-`%xmm5',5,
-`%xmm6',6,
-`%xmm7',7,
-`%xmm8',8,
-`%xmm9',9,
-`%xmm10',10,
-`%xmm11',11,
-`%xmm12',12,
-`%xmm13',13,
-`%xmm14',14,
-`%xmm15',15')
-
-dnl Usage: palignr($imm,%srcreg,%dstreg)
-dnl
-dnl Emit a palignr instruction, using a .byte sequence, since obsolete but
-dnl still distributed versions of gas don't know SSSE3 instructions.
-
-define(`palignr',
-m4_assert_numargs(3)
-`.byte 0x66,dnl
-ifelse(eval(x86_opcode_regxmm($3) >= 8 || x86_opcode_regxmm($2) >= 8),1,
- `eval(0x40+x86_opcode_regxmm($3)/8*4+x86_opcode_regxmm($2)/8),')dnl
-0x0f,0x3a,0x0f,dnl
-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/gmp/mpn/z8000/README b/gmp/mpn/z8000/README
new file mode 100644
index 0000000000..e1cf22df42
--- /dev/null
+++ b/gmp/mpn/z8000/README
@@ -0,0 +1,45 @@
+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.
+
+mpn/z8000x uses a 32-bit limb, this could perhaps be an ABI choice.
+Currently it's reached only by an MPN_PATH override.
+
+
+
+----------------
+Local variables:
+mode: text
+fill-column: 76
+End:
diff --git a/gmp/mpn/z8000/add_n.s b/gmp/mpn/z8000/add_n.s
new file mode 100644
index 0000000000..89fbb1a280
--- /dev/null
+++ b/gmp/mpn/z8000/add_n.s
@@ -0,0 +1,51 @@
+! 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/gmp/mpn/z8000/gmp-mparam.h b/gmp/mpn/z8000/gmp-mparam.h
new file mode 100644
index 0000000000..f42e380a70
--- /dev/null
+++ b/gmp/mpn/z8000/gmp-mparam.h
@@ -0,0 +1,21 @@
+/* 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 BITS_PER_MP_LIMB 16
+#define BYTES_PER_MP_LIMB 2
diff --git a/gmp/mpn/z8000/mul_1.s b/gmp/mpn/z8000/mul_1.s
new file mode 100644
index 0000000000..fa92bc32bf
--- /dev/null
+++ b/gmp/mpn/z8000/mul_1.s
@@ -0,0 +1,66 @@
+! 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/gmp/mpn/z8000/sub_n.s b/gmp/mpn/z8000/sub_n.s
new file mode 100644
index 0000000000..1dbd83760e
--- /dev/null
+++ b/gmp/mpn/z8000/sub_n.s
@@ -0,0 +1,52 @@
+! 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
diff --git a/gmp/mpn/z8000x/add_n.s b/gmp/mpn/z8000x/add_n.s
new file mode 100644
index 0000000000..26b47e278b
--- /dev/null
+++ b/gmp/mpn/z8000x/add_n.s
@@ -0,0 +1,54 @@
+! Z8000 (32 bit limb version) __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...
+
+ segm
+ .text
+ even
+ global ___gmpn_add_n
+___gmpn_add_n:
+ popl rr0,@r6
+ popl rr8,@r5
+ addl rr0,rr8
+ ldl @r7,rr0
+ dec r4
+ jr eq,Lend
+Loop: popl rr0,@r6
+ popl rr8,@r5
+ adc r1,r9
+ adc r0,r8
+ inc r7,#4
+ ldl @r7,rr0
+ dec r4
+ jr ne,Loop
+Lend: ld r2,r4 ! use 0 already in r4
+ ld r3,r4
+ adc r2,r2
+ ret t
diff --git a/gmp/mpn/z8000x/sub_n.s b/gmp/mpn/z8000x/sub_n.s
new file mode 100644
index 0000000000..837ecef0cf
--- /dev/null
+++ b/gmp/mpn/z8000x/sub_n.s
@@ -0,0 +1,54 @@
+! Z8000 (32 bit limb version) __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...
+
+ segm
+ .text
+ even
+ global ___gmpn_sub_n
+___gmpn_sub_n:
+ popl rr0,@r6
+ popl rr8,@r5
+ subl rr0,rr8
+ ldl @r7,rr0
+ dec r4
+ jr eq,Lend
+Loop: popl rr0,@r6
+ popl rr8,@r5
+ sbc r1,r9
+ sbc r0,r8
+ inc r7,#4
+ ldl @r7,rr0
+ dec r4
+ jr ne,Loop
+Lend: ld r2,r4 ! use 0 already in r4
+ ld r3,r4
+ adc r2,r2
+ ret t
diff --git a/gmp/mpq/Makefile.am b/gmp/mpq/Makefile.am
index 406aa9f8dc..2ce3853f07 100644
--- a/gmp/mpq/Makefile.am
+++ b/gmp/mpq/Makefile.am
@@ -1,41 +1,30 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1996, 1998, 2000-2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libmpq.la
libmpq_la_SOURCES = \
- abs.c aors.c canonicalize.c clear.c clears.c \
+ abs.c aors.c canonicalize.c clear.c \
cmp.c cmp_si.c cmp_ui.c div.c equal.c \
get_d.c get_den.c get_num.c get_str.c \
- init.c inits.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \
+ init.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \
set.c set_den.c set_num.c set_si.c set_str.c set_ui.c set_z.c set_d.c \
set_f.c swap.c
diff --git a/gmp/mpq/Makefile.in b/gmp/mpq/Makefile.in
index 8bc0a9984f..c80bafc208 100644
--- a/gmp/mpq/Makefile.in
+++ b/gmp/mpq/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,57 +14,34 @@
@SET_MAKE@
-# Copyright 1996, 1998, 2000-2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libmpq_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -77,47 +53,41 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
subdir = mpq
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libmpq_la_LIBADD =
-am_libmpq_la_OBJECTS = abs.lo aors.lo canonicalize.lo clear.lo \
- clears.lo cmp.lo cmp_si.lo cmp_ui.lo div.lo equal.lo get_d.lo \
- get_den.lo get_num.lo get_str.lo init.lo inits.lo inp_str.lo \
- inv.lo md_2exp.lo mul.lo neg.lo out_str.lo set.lo set_den.lo \
- set_num.lo set_si.lo set_str.lo set_ui.lo set_z.lo set_d.lo \
- set_f.lo swap.lo
+am_libmpq_la_OBJECTS = abs$U.lo aors$U.lo canonicalize$U.lo clear$U.lo \
+ cmp$U.lo cmp_si$U.lo cmp_ui$U.lo div$U.lo equal$U.lo \
+ get_d$U.lo get_den$U.lo get_num$U.lo get_str$U.lo init$U.lo \
+ inp_str$U.lo inv$U.lo md_2exp$U.lo mul$U.lo neg$U.lo \
+ out_str$U.lo set$U.lo set_den$U.lo set_num$U.lo set_si$U.lo \
+ set_str$U.lo set_ui$U.lo set_z$U.lo set_d$U.lo set_f$U.lo \
+ swap$U.lo
libmpq_la_OBJECTS = $(am_libmpq_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libmpq_la_SOURCES)
DIST_SOURCES = $(libmpq_la_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -131,6 +101,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -146,17 +117,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -170,12 +140,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -190,26 +158,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -219,31 +181,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -267,6 +224,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -274,19 +232,15 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libmpq.la
libmpq_la_SOURCES = \
- abs.c aors.c canonicalize.c clear.c clears.c \
+ abs.c aors.c canonicalize.c clear.c \
cmp.c cmp_si.c cmp_ui.c div.c equal.c \
get_d.c get_den.c get_num.c get_str.c \
- init.c inits.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \
+ init.c inp_str.c inv.c md_2exp.c mul.c neg.c out_str.c \
set.c set_den.c set_num.c set_si.c set_str.c set_ui.c set_z.c set_d.c \
set_f.c swap.c
@@ -298,14 +252,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpq/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps mpq/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpq/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps mpq/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -323,24 +277,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libmpq.la: $(libmpq_la_OBJECTS) $(libmpq_la_DEPENDENCIES) $(EXTRA_libmpq_la_DEPENDENCIES)
- $(LINK) $(libmpq_la_OBJECTS) $(libmpq_la_LIBADD) $(LIBS)
+libmpq.la: $(libmpq_la_OBJECTS) $(libmpq_la_DEPENDENCIES)
+ $(LINK) $(libmpq_la_LDFLAGS) $(libmpq_la_OBJECTS) $(libmpq_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -350,6 +308,80 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+abs_.c: abs.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/abs.c; then echo $(srcdir)/abs.c; else echo abs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+aors_.c: aors.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/aors.c; then echo $(srcdir)/aors.c; else echo aors.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+canonicalize_.c: canonicalize.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/canonicalize.c; then echo $(srcdir)/canonicalize.c; else echo canonicalize.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+clear_.c: clear.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clear.c; then echo $(srcdir)/clear.c; else echo clear.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_.c: cmp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_si_.c: cmp_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_si.c; then echo $(srcdir)/cmp_si.c; else echo cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_ui_.c: cmp_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_ui.c; then echo $(srcdir)/cmp_ui.c; else echo cmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+div_.c: div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/div.c; then echo $(srcdir)/div.c; else echo div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+equal_.c: equal.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/equal.c; then echo $(srcdir)/equal.c; else echo equal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_d_.c: get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_den_.c: get_den.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_den.c; then echo $(srcdir)/get_den.c; else echo get_den.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_num_.c: get_num.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_num.c; then echo $(srcdir)/get_num.c; else echo get_num.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_str_.c: get_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+init_.c: init.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init.c; then echo $(srcdir)/init.c; else echo init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+inp_str_.c: inp_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_str.c; then echo $(srcdir)/inp_str.c; else echo inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+inv_.c: inv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inv.c; then echo $(srcdir)/inv.c; else echo inv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+md_2exp_.c: md_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/md_2exp.c; then echo $(srcdir)/md_2exp.c; else echo md_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_.c: mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+neg_.c: neg.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg.c; then echo $(srcdir)/neg.c; else echo neg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+out_str_.c: out_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_str.c; then echo $(srcdir)/out_str.c; else echo out_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_.c: set.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set.c; then echo $(srcdir)/set.c; else echo set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_d_.c: set_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_d.c; then echo $(srcdir)/set_d.c; else echo set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_den_.c: set_den.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_den.c; then echo $(srcdir)/set_den.c; else echo set_den.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_f_.c: set_f.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_f.c; then echo $(srcdir)/set_f.c; else echo set_f.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_num_.c: set_num.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_num.c; then echo $(srcdir)/set_num.c; else echo set_num.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_si_.c: set_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_si.c; then echo $(srcdir)/set_si.c; else echo set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_str_.c: set_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_ui_.c: set_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_ui.c; then echo $(srcdir)/set_ui.c; else echo set_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_z_.c: set_z.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_z.c; then echo $(srcdir)/set_z.c; else echo set_z.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+swap_.c: swap.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/swap.c; then echo $(srcdir)/swap.c; else echo swap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+abs_.$(OBJEXT) abs_.lo aors_.$(OBJEXT) aors_.lo \
+canonicalize_.$(OBJEXT) canonicalize_.lo clear_.$(OBJEXT) clear_.lo \
+cmp_.$(OBJEXT) cmp_.lo cmp_si_.$(OBJEXT) cmp_si_.lo cmp_ui_.$(OBJEXT) \
+cmp_ui_.lo div_.$(OBJEXT) div_.lo equal_.$(OBJEXT) equal_.lo \
+get_d_.$(OBJEXT) get_d_.lo get_den_.$(OBJEXT) get_den_.lo \
+get_num_.$(OBJEXT) get_num_.lo get_str_.$(OBJEXT) get_str_.lo \
+init_.$(OBJEXT) init_.lo inp_str_.$(OBJEXT) inp_str_.lo inv_.$(OBJEXT) \
+inv_.lo md_2exp_.$(OBJEXT) md_2exp_.lo mul_.$(OBJEXT) mul_.lo \
+neg_.$(OBJEXT) neg_.lo out_str_.$(OBJEXT) out_str_.lo set_.$(OBJEXT) \
+set_.lo set_d_.$(OBJEXT) set_d_.lo set_den_.$(OBJEXT) set_den_.lo \
+set_f_.$(OBJEXT) set_f_.lo set_num_.$(OBJEXT) set_num_.lo \
+set_si_.$(OBJEXT) set_si_.lo set_str_.$(OBJEXT) set_str_.lo \
+set_ui_.$(OBJEXT) set_ui_.lo set_z_.$(OBJEXT) set_z_.lo \
+swap_.$(OBJEXT) swap_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -357,85 +389,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -453,22 +482,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -481,7 +504,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -489,38 +512,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -529,7 +532,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -540,23 +543,19 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/gmp/mpq/abs.c b/gmp/mpq/abs.c
index 7fe04a35bb..04b8e3418e 100644
--- a/gmp/mpq/abs.c
+++ b/gmp/mpq/abs.c
@@ -1,32 +1,21 @@
/* mpq_abs -- absolute value of a rational.
-Copyright 2000, 2001, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpq_abs 1
@@ -37,20 +26,21 @@ see https://www.gnu.org/licenses/. */
void
mpq_abs (mpq_ptr dst, mpq_srcptr src)
{
- mp_size_t num_abs_size = ABSIZ(NUM(src));
+ mp_size_t num_size = src->_mp_num._mp_size;
+ mp_size_t num_abs_size = ABS (num_size);
if (dst != src)
{
- mp_size_t den_size = SIZ(DEN(src));
- mp_ptr dp;
+ mp_size_t den_size = src->_mp_den._mp_size;
+
+ MPZ_REALLOC (mpq_numref(dst), num_abs_size);
+ MPZ_REALLOC (mpq_denref(dst), den_size);
- dp = MPZ_NEWALLOC (NUM(dst), num_abs_size);
- MPN_COPY (dp, PTR(NUM(src)), num_abs_size);
+ MPN_COPY (dst->_mp_num._mp_d, src->_mp_num._mp_d, num_abs_size);
+ MPN_COPY (dst->_mp_den._mp_d, src->_mp_den._mp_d, den_size);
- dp = MPZ_NEWALLOC (DEN(dst), den_size);
- SIZ(DEN(dst)) = den_size;
- MPN_COPY (dp, PTR(DEN(src)), den_size);
+ dst->_mp_den._mp_size = den_size;
}
- SIZ(NUM(dst)) = num_abs_size;
+ dst->_mp_num._mp_size = num_abs_size;
}
diff --git a/gmp/mpq/aors.c b/gmp/mpq/aors.c
index 81edc1fa39..5e09de533d 100644
--- a/gmp/mpq/aors.c
+++ b/gmp/mpq/aors.c
@@ -1,51 +1,40 @@
/* mpq_add, mpq_sub -- add or subtract rational numbers.
-Copyright 1991, 1994-1997, 2000, 2001, 2004, 2005 Free Software Foundation,
-Inc.
+Copyright 1991, 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-static void __gmpq_aors (REGPARM_3_1 (mpq_ptr, mpq_srcptr, mpq_srcptr, void (*) (mpz_ptr, mpz_srcptr, mpz_srcptr))) REGPARM_ATTR (1);
+static void __gmpq_aors __GMP_PROTO ((REGPARM_3_1 (mpq_ptr, mpq_srcptr, mpq_srcptr, void (*) __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr))))) REGPARM_ATTR (1);
#define mpq_aors(w,x,y,fun) __gmpq_aors (REGPARM_3_1 (w, x, y, fun))
REGPARM_ATTR (1) static void
mpq_aors (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2,
- void (*fun) (mpz_ptr, mpz_srcptr, mpz_srcptr))
+ void (*fun) __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr)))
{
mpz_t gcd;
mpz_t tmp1, tmp2;
- mp_size_t op1_num_size = ABSIZ(NUM(op1));
- mp_size_t op1_den_size = SIZ(DEN(op1));
- mp_size_t op2_num_size = ABSIZ(NUM(op2));
- mp_size_t op2_den_size = SIZ(DEN(op2));
+ mp_size_t op1_num_size = ABS (op1->_mp_num._mp_size);
+ mp_size_t op1_den_size = op1->_mp_den._mp_size;
+ mp_size_t op2_num_size = ABS (op2->_mp_num._mp_size);
+ mp_size_t op2_den_size = op2->_mp_den._mp_size;
TMP_DECL;
TMP_MARK;
@@ -58,43 +47,43 @@ mpq_aors (mpq_ptr rop, mpq_srcptr op1, mpq_srcptr op2,
dare to overwrite the numerator of ROP when we are finished
with the numerators of OP1 and OP2. */
- mpz_gcd (gcd, DEN(op1), DEN(op2));
+ mpz_gcd (gcd, &(op1->_mp_den), &(op2->_mp_den));
if (! MPZ_EQUAL_1_P (gcd))
{
mpz_t t;
- MPZ_TMP_INIT (t, MAX (op1_num_size + op2_den_size,
- op2_num_size + op1_den_size) + 2 - SIZ(gcd));
+ mpz_divexact_gcd (tmp1, &(op2->_mp_den), gcd);
+ mpz_mul (tmp1, &(op1->_mp_num), tmp1);
- mpz_divexact_gcd (t, DEN(op2), gcd);
- mpz_divexact_gcd (tmp2, DEN(op1), gcd);
+ mpz_divexact_gcd (tmp2, &(op1->_mp_den), gcd);
+ mpz_mul (tmp2, &(op2->_mp_num), tmp2);
- mpz_mul (tmp1, NUM(op1), t);
- mpz_mul (t, NUM(op2), tmp2);
+ MPZ_TMP_INIT (t, MAX (ABS (tmp1->_mp_size), ABS (tmp2->_mp_size)) + 1);
- (*fun) (t, tmp1, t);
+ (*fun) (t, tmp1, tmp2);
+ mpz_divexact_gcd (tmp2, &(op1->_mp_den), gcd);
mpz_gcd (gcd, t, gcd);
if (MPZ_EQUAL_1_P (gcd))
{
- mpz_set (NUM(rop), t);
- mpz_mul (DEN(rop), DEN(op2), tmp2);
+ mpz_set (&(rop->_mp_num), t);
+ mpz_mul (&(rop->_mp_den), &(op2->_mp_den), tmp2);
}
else
{
- mpz_divexact_gcd (NUM(rop), t, gcd);
- mpz_divexact_gcd (tmp1, DEN(op2), gcd);
- mpz_mul (DEN(rop), tmp1, tmp2);
+ mpz_divexact_gcd (&(rop->_mp_num), t, gcd);
+ mpz_divexact_gcd (tmp1, &(op2->_mp_den), gcd);
+ mpz_mul (&(rop->_mp_den), tmp1, tmp2);
}
}
else
{
/* The common divisor is 1. This is the case (for random input) with
probability 6/(pi**2), which is about 60.8%. */
- mpz_mul (tmp1, NUM(op1), DEN(op2));
- mpz_mul (tmp2, NUM(op2), DEN(op1));
- (*fun) (NUM(rop), tmp1, tmp2);
- mpz_mul (DEN(rop), DEN(op1), DEN(op2));
+ mpz_mul (tmp1, &(op1->_mp_num), &(op2->_mp_den));
+ mpz_mul (tmp2, &(op2->_mp_num), &(op1->_mp_den));
+ (*fun) (&(rop->_mp_num), tmp1, tmp2);
+ mpz_mul (&(rop->_mp_den), &(op1->_mp_den), &(op2->_mp_den));
}
TMP_FREE;
}
diff --git a/gmp/mpq/canonicalize.c b/gmp/mpq/canonicalize.c
index 882f408fb8..e5bedec4c3 100644
--- a/gmp/mpq/canonicalize.c
+++ b/gmp/mpq/canonicalize.c
@@ -1,63 +1,53 @@
/* mpq_canonicalize(op) -- Remove common factors of the denominator and
numerator in OP.
-Copyright 1991, 1994-1996, 2000, 2001, 2005 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_canonicalize (mpq_t op)
+mpq_canonicalize (MP_RAT *op)
{
mpz_t gcd;
TMP_DECL;
- if (UNLIKELY (SIZ(DEN(op)) == 0))
+ if (op->_mp_den._mp_size == 0)
DIVIDE_BY_ZERO;
TMP_MARK;
/* ??? Dunno if the 1+ is needed. */
- MPZ_TMP_INIT (gcd, 1 + MAX (ABSIZ(NUM(op)),
- ABSIZ(DEN(op))));
+ MPZ_TMP_INIT (gcd, 1 + MAX (ABS (op->_mp_num._mp_size),
+ ABS (op->_mp_den._mp_size)));
- mpz_gcd (gcd, NUM(op), DEN(op));
+ mpz_gcd (gcd, &(op->_mp_num), &(op->_mp_den));
if (! MPZ_EQUAL_1_P (gcd))
{
- mpz_divexact_gcd (NUM(op), NUM(op), gcd);
- mpz_divexact_gcd (DEN(op), DEN(op), gcd);
+ mpz_divexact_gcd (&(op->_mp_num), &(op->_mp_num), gcd);
+ mpz_divexact_gcd (&(op->_mp_den), &(op->_mp_den), gcd);
}
- if (SIZ(DEN(op)) < 0)
+ if (op->_mp_den._mp_size < 0)
{
- SIZ(NUM(op)) = -SIZ(NUM(op));
- SIZ(DEN(op)) = -SIZ(DEN(op));
+ op->_mp_num._mp_size = -op->_mp_num._mp_size;
+ op->_mp_den._mp_size = -op->_mp_den._mp_size;
}
TMP_FREE;
}
diff --git a/gmp/mpq/clear.c b/gmp/mpq/clear.c
index ce0b973f9f..d6f7d7fb08 100644
--- a/gmp/mpq/clear.c
+++ b/gmp/mpq/clear.c
@@ -1,41 +1,30 @@
-/* mpq_clear -- free the space occupied by a mpq_t.
+/* mpq_clear -- free the space occupied by a MP_RAT.
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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_clear (mpq_t m)
+mpq_clear (MP_RAT *m)
{
- (*__gmp_free_func) (PTR(NUM(m)),
- (size_t) ALLOC(NUM(m)) * GMP_LIMB_BYTES);
- (*__gmp_free_func) (PTR(DEN(m)),
- (size_t) ALLOC(DEN(m)) * GMP_LIMB_BYTES);
+ (*__gmp_free_func) (m->_mp_num._mp_d,
+ m->_mp_num._mp_alloc * BYTES_PER_MP_LIMB);
+ (*__gmp_free_func) (m->_mp_den._mp_d,
+ m->_mp_den._mp_alloc * BYTES_PER_MP_LIMB);
}
diff --git a/gmp/mpq/clears.c b/gmp/mpq/clears.c
deleted file mode 100644
index f949fe36cd..0000000000
--- a/gmp/mpq/clears.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* mpq_clears() -- Clear multiple mpq_t variables.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 <stdarg.h>
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-mpq_clears (mpq_ptr x, ...)
-{
- va_list ap;
-
- va_start (ap, x);
-
- while (x != NULL)
- {
- (*__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);
-}
diff --git a/gmp/mpq/cmp.c b/gmp/mpq/cmp.c
index e633b6f42d..2ee540cad5 100644
--- a/gmp/mpq/cmp.c
+++ b/gmp/mpq/cmp.c
@@ -6,40 +6,29 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpq_cmp (const mpq_t op1, const mpq_t op2)
+mpq_cmp (const MP_RAT *op1, const MP_RAT *op2)
{
- mp_size_t num1_size = SIZ(NUM(op1));
- mp_size_t den1_size = SIZ(DEN(op1));
- mp_size_t num2_size = SIZ(NUM(op2));
- mp_size_t den2_size = SIZ(DEN(op2));
+ mp_size_t num1_size = op1->_mp_num._mp_size;
+ mp_size_t den1_size = op1->_mp_den._mp_size;
+ mp_size_t num2_size = op2->_mp_num._mp_size;
+ mp_size_t den2_size = op2->_mp_den._mp_size;
mp_size_t tmp1_size, tmp2_size;
mp_ptr tmp1_ptr, tmp2_ptr;
mp_size_t num1_sign;
@@ -79,14 +68,14 @@ mpq_cmp (const mpq_t op1, const mpq_t op2)
/* 2. Same, but compare the number of significant bits. */
{
int cnt1, cnt2;
- mp_bitcnt_t bits1, bits2;
+ unsigned long int bits1, bits2;
- count_leading_zeros (cnt1, PTR(NUM(op1))[num1_size - 1]);
- count_leading_zeros (cnt2, PTR(DEN(op2))[den2_size - 1]);
+ count_leading_zeros (cnt1, op1->_mp_num._mp_d[num1_size - 1]);
+ count_leading_zeros (cnt2, op2->_mp_den._mp_d[den2_size - 1]);
bits1 = tmp1_size * GMP_NUMB_BITS - cnt1 - cnt2 + 2 * GMP_NAIL_BITS;
- count_leading_zeros (cnt1, PTR(NUM(op2))[num2_size - 1]);
- count_leading_zeros (cnt2, PTR(DEN(op1))[den1_size - 1]);
+ count_leading_zeros (cnt1, op2->_mp_num._mp_d[num2_size - 1]);
+ count_leading_zeros (cnt2, op1->_mp_den._mp_d[den1_size - 1]);
bits2 = tmp2_size * GMP_NUMB_BITS - cnt1 - cnt2 + 2 * GMP_NAIL_BITS;
if (bits1 > bits2 + 1)
@@ -102,21 +91,21 @@ mpq_cmp (const mpq_t op1, const mpq_t op2)
if (num1_size >= den2_size)
tmp1_size -= 0 == mpn_mul (tmp1_ptr,
- PTR(NUM(op1)), num1_size,
- PTR(DEN(op2)), den2_size);
+ op1->_mp_num._mp_d, num1_size,
+ op2->_mp_den._mp_d, den2_size);
else
tmp1_size -= 0 == mpn_mul (tmp1_ptr,
- PTR(DEN(op2)), den2_size,
- PTR(NUM(op1)), num1_size);
+ op2->_mp_den._mp_d, den2_size,
+ op1->_mp_num._mp_d, num1_size);
if (num2_size >= den1_size)
tmp2_size -= 0 == mpn_mul (tmp2_ptr,
- PTR(NUM(op2)), num2_size,
- PTR(DEN(op1)), den1_size);
+ op2->_mp_num._mp_d, num2_size,
+ op1->_mp_den._mp_d, den1_size);
else
tmp2_size -= 0 == mpn_mul (tmp2_ptr,
- PTR(DEN(op1)), den1_size,
- PTR(NUM(op2)), num2_size);
+ op1->_mp_den._mp_d, den1_size,
+ op2->_mp_num._mp_d, num2_size);
cc = tmp1_size - tmp2_size != 0
diff --git a/gmp/mpq/cmp_si.c b/gmp/mpq/cmp_si.c
index 0a31fe8c9e..a744a98429 100644
--- a/gmp/mpq/cmp_si.c
+++ b/gmp/mpq/cmp_si.c
@@ -1,32 +1,21 @@
/* _mpq_cmp_si -- compare mpq and long/ulong fraction.
-Copyright 2001, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,9 +29,9 @@ int
_mpq_cmp_si (mpq_srcptr q, long n, unsigned long d)
{
/* need canonical sign to get right result */
- ASSERT (SIZ(DEN(q)) > 0);
+ ASSERT (q->_mp_den._mp_size > 0);
- if (SIZ(NUM(q)) >= 0)
+ if (q->_mp_num._mp_size >= 0)
{
if (n >= 0)
return _mpq_cmp_ui (q, n, d); /* >=0 cmp >=0 */
@@ -56,12 +45,12 @@ _mpq_cmp_si (mpq_srcptr q, long n, unsigned long d)
else
{
mpq_t qabs;
- SIZ(NUM(qabs)) = ABSIZ(NUM(q));
- PTR(NUM(qabs)) = PTR(NUM(q));
- SIZ(DEN(qabs)) = SIZ(DEN(q));
- PTR(DEN(qabs)) = PTR(DEN(q));
+ qabs->_mp_num._mp_size = ABS (q->_mp_num._mp_size);
+ qabs->_mp_num._mp_d = q->_mp_num._mp_d;
+ qabs->_mp_den._mp_size = q->_mp_den._mp_size;
+ qabs->_mp_den._mp_d = q->_mp_den._mp_d;
- return - _mpq_cmp_ui (qabs, NEG_CAST (unsigned long, n), d); /* <0 cmp <0 */
+ return - _mpq_cmp_ui (qabs, -n, d); /* <0 cmp <0 */
}
}
}
diff --git a/gmp/mpq/cmp_ui.c b/gmp/mpq/cmp_ui.c
index a2e2d8ca81..c15640515c 100644
--- a/gmp/mpq/cmp_ui.c
+++ b/gmp/mpq/cmp_ui.c
@@ -2,42 +2,32 @@
negative based on if U > V, U == V, or U < V. Vn and Vd may have
common factors.
-Copyright 1993, 1994, 1996, 2000-2003, 2005 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-_mpq_cmp_ui (const mpq_t op1, unsigned long int num2, unsigned long int den2)
+_mpq_cmp_ui (const MP_RAT *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));
+ mp_size_t num1_size = op1->_mp_num._mp_size;
+ mp_size_t den1_size = op1->_mp_den._mp_size;
mp_size_t tmp1_size, tmp2_size;
mp_ptr tmp1_ptr, tmp2_ptr;
mp_limb_t cy_limb;
@@ -60,7 +50,7 @@ _mpq_cmp_ui (const mpq_t op1, unsigned long int num2, unsigned long int den2)
/* need canonical sign to get right result */
ASSERT (den1_size > 0);
- if (UNLIKELY (den2 == 0))
+ if (den2 == 0)
DIVIDE_BY_ZERO;
if (num1_size == 0)
@@ -80,15 +70,15 @@ _mpq_cmp_ui (const mpq_t op1, unsigned long int num2, unsigned long int den2)
return -num1_size;
TMP_MARK;
- tmp1_ptr = TMP_ALLOC_LIMBS (num1_size + 1);
- tmp2_ptr = TMP_ALLOC_LIMBS (den1_size + 1);
+ tmp1_ptr = (mp_ptr) TMP_ALLOC ((num1_size + 1) * BYTES_PER_MP_LIMB);
+ tmp2_ptr = (mp_ptr) TMP_ALLOC ((den1_size + 1) * BYTES_PER_MP_LIMB);
- cy_limb = mpn_mul_1 (tmp1_ptr, PTR(NUM(op1)), num1_size,
+ cy_limb = mpn_mul_1 (tmp1_ptr, op1->_mp_num._mp_d, num1_size,
(mp_limb_t) den2);
tmp1_ptr[num1_size] = cy_limb;
tmp1_size = num1_size + (cy_limb != 0);
- cy_limb = mpn_mul_1 (tmp2_ptr, PTR(DEN(op1)), den1_size,
+ cy_limb = mpn_mul_1 (tmp2_ptr, op1->_mp_den._mp_d, den1_size,
(mp_limb_t) num2);
tmp2_ptr[den1_size] = cy_limb;
tmp2_size = den1_size + (cy_limb != 0);
diff --git a/gmp/mpq/div.c b/gmp/mpq/div.c
index 7d91e0998a..efba32a2f3 100644
--- a/gmp/mpq/div.c
+++ b/gmp/mpq/div.c
@@ -1,32 +1,21 @@
/* mpq_div -- divide two rational numbers.
-Copyright 1991, 1994-1996, 2000, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -45,26 +34,24 @@ mpq_div (mpq_ptr quot, mpq_srcptr op1, mpq_srcptr op2)
mp_size_t alloc;
TMP_DECL;
- op2_num_size = ABSIZ(NUM(op2));
+ op1_num_size = ABS (op1->_mp_num._mp_size);
+ op1_den_size = op1->_mp_den._mp_size;
+ op2_num_size = ABS (op2->_mp_num._mp_size);
+ op2_den_size = op2->_mp_den._mp_size;
- if (UNLIKELY (op2_num_size == 0))
+ if (op2_num_size == 0)
DIVIDE_BY_ZERO;
- op1_num_size = ABSIZ(NUM(op1));
-
if (op1_num_size == 0)
{
/* We special case this to simplify allocation logic; gcd(0,x) = x
is a singular case for the allocations. */
- SIZ(NUM(quot)) = 0;
- PTR(DEN(quot))[0] = 1;
- SIZ(DEN(quot)) = 1;
+ quot->_mp_num._mp_size = 0;
+ quot->_mp_den._mp_d[0] = 1;
+ quot->_mp_den._mp_size = 1;
return;
}
- op2_den_size = SIZ(DEN(op2));
- op1_den_size = SIZ(DEN(op1));
-
TMP_MARK;
alloc = MIN (op1_num_size, op2_num_size);
@@ -87,28 +74,28 @@ mpq_div (mpq_ptr quot, mpq_srcptr op1, mpq_srcptr op2)
numerator of QUOT when we are finished with the numerators of OP1 and
OP2. */
- mpz_gcd (gcd1, NUM(op1), NUM(op2));
- mpz_gcd (gcd2, DEN(op2), DEN(op1));
+ mpz_gcd (gcd1, &(op1->_mp_num), &(op2->_mp_num));
+ mpz_gcd (gcd2, &(op2->_mp_den), &(op1->_mp_den));
- mpz_divexact_gcd (tmp1, NUM(op1), gcd1);
- mpz_divexact_gcd (tmp2, DEN(op2), gcd2);
+ mpz_divexact_gcd (tmp1, &(op1->_mp_num), gcd1);
+ mpz_divexact_gcd (tmp2, &(op2->_mp_den), gcd2);
mpz_mul (numtmp, tmp1, tmp2);
- mpz_divexact_gcd (tmp1, NUM(op2), gcd1);
- mpz_divexact_gcd (tmp2, DEN(op1), gcd2);
+ mpz_divexact_gcd (tmp1, &(op2->_mp_num), gcd1);
+ mpz_divexact_gcd (tmp2, &(op1->_mp_den), gcd2);
- mpz_mul (DEN(quot), tmp1, tmp2);
+ mpz_mul (&(quot->_mp_den), tmp1, tmp2);
/* We needed to go via NUMTMP to take care of QUOT being the same as OP2.
Now move NUMTMP to QUOT->_mp_num. */
- mpz_set (NUM(quot), numtmp);
+ mpz_set (&(quot->_mp_num), numtmp);
/* Keep the denominator positive. */
- if (SIZ(DEN(quot)) < 0)
+ if (quot->_mp_den._mp_size < 0)
{
- SIZ(DEN(quot)) = -SIZ(DEN(quot));
- SIZ(NUM(quot)) = -SIZ(NUM(quot));
+ quot->_mp_den._mp_size = -quot->_mp_den._mp_size;
+ quot->_mp_num._mp_size = -quot->_mp_num._mp_size;
}
TMP_FREE;
diff --git a/gmp/mpq/equal.c b/gmp/mpq/equal.c
index 500c2d802e..e5c5f8e5e8 100644
--- a/gmp/mpq/equal.c
+++ b/gmp/mpq/equal.c
@@ -6,34 +6,23 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpq_equal (mpq_srcptr op1, mpq_srcptr op2) __GMP_NOTHROW
+mpq_equal (mpq_srcptr op1, mpq_srcptr op2)
{
mp_size_t num1_size, num2_size, den1_size, den2_size, i;
mp_srcptr num1_ptr, num2_ptr, den1_ptr, den2_ptr;
@@ -42,25 +31,25 @@ mpq_equal (mpq_srcptr op1, mpq_srcptr op2) __GMP_NOTHROW
ASSERT_MPQ_CANONICAL (op1);
ASSERT_MPQ_CANONICAL (op2);
- num1_size = SIZ(NUM(op1));
- num2_size = SIZ(NUM(op2));
+ num1_size = op1->_mp_num._mp_size;
+ num2_size = op2->_mp_num._mp_size;
if (num1_size != num2_size)
return 0;
- num1_ptr = PTR(NUM(op1));
- num2_ptr = PTR(NUM(op2));
+ num1_ptr = op1->_mp_num._mp_d;
+ num2_ptr = op2->_mp_num._mp_d;
num1_size = ABS (num1_size);
for (i = 0; i < num1_size; i++)
if (num1_ptr[i] != num2_ptr[i])
return 0;
- den1_size = SIZ(DEN(op1));
- den2_size = SIZ(DEN(op2));
+ den1_size = op1->_mp_den._mp_size;
+ den2_size = op2->_mp_den._mp_size;
if (den1_size != den2_size)
return 0;
- den1_ptr = PTR(DEN(op1));
- den2_ptr = PTR(DEN(op2));
+ den1_ptr = op1->_mp_den._mp_d;
+ den2_ptr = op2->_mp_den._mp_d;
for (i = 0; i < den1_size; i++)
if (den1_ptr[i] != den2_ptr[i])
return 0;
diff --git a/gmp/mpq/get_d.c b/gmp/mpq/get_d.c
index 6318e22293..c8f91ca4d8 100644
--- a/gmp/mpq/get_d.c
+++ b/gmp/mpq/get_d.c
@@ -1,32 +1,22 @@
/* double mpq_get_d (mpq_t src) -- mpq to double, rounding towards zero.
-Copyright 1995, 1996, 2001-2005 Free Software Foundation, Inc.
+Copyright 1995, 1996, 2001, 2002, 2003, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -49,7 +39,7 @@ see https://www.gnu.org/licenses/. */
Enhancements:
- Use the true mantissa size in the N_QLIMBS formula, to save a divide step
+ Use the true mantissa size in the N_QLIMBS formala, to save a divide step
in nails.
Examine the high limbs of num and den to see if the highest 1 bit of the
@@ -101,17 +91,17 @@ see https://www.gnu.org/licenses/. */
like to have helping everywhere that uses a quotient-only division. */
double
-mpq_get_d (const mpq_t src)
+mpq_get_d (const MP_RAT *src)
{
double res;
mp_srcptr np, dp;
mp_ptr remp, tp;
- mp_size_t nsize = SIZ(NUM(src));
- mp_size_t dsize = SIZ(DEN(src));
+ mp_size_t nsize = src->_mp_num._mp_size;
+ mp_size_t dsize = src->_mp_den._mp_size;
mp_size_t qsize, prospective_qsize, zeros, chop, tsize;
mp_size_t sign_quotient = nsize;
long exp;
-#define N_QLIMBS (1 + (sizeof (double) + GMP_LIMB_BYTES-1) / GMP_LIMB_BYTES)
+#define N_QLIMBS (1 + (sizeof (double) + BYTES_PER_MP_LIMB-1) / BYTES_PER_MP_LIMB)
mp_limb_t qarr[N_QLIMBS + 1];
mp_ptr qp = qarr;
TMP_DECL;
@@ -125,8 +115,8 @@ mpq_get_d (const mpq_t src)
TMP_MARK;
nsize = ABS (nsize);
dsize = ABS (dsize);
- np = PTR(NUM(src));
- dp = PTR(DEN(src));
+ np = src->_mp_num._mp_d;
+ dp = src->_mp_den._mp_d;
prospective_qsize = nsize - dsize + 1; /* from using given n,d */
qsize = N_QLIMBS + 1; /* desired qsize */
diff --git a/gmp/mpq/get_den.c b/gmp/mpq/get_den.c
index 48a385c817..c3104e6a36 100644
--- a/gmp/mpq/get_den.c
+++ b/gmp/mpq/get_den.c
@@ -1,43 +1,33 @@
/* mpq_get_den(den,rat_src) -- Set DEN to the denominator of RAT_SRC.
-Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_get_den (mpz_ptr den, mpq_srcptr src)
+mpq_get_den (MP_INT *den, const MP_RAT *src)
{
- mp_size_t size = SIZ(DEN(src));
- mp_ptr dp;
+ mp_size_t size = src->_mp_den._mp_size;
+
+ if (den->_mp_alloc < size)
+ _mpz_realloc (den, size);
- dp = MPZ_NEWALLOC (den, size);
- SIZ(den) = size;
- MPN_COPY (dp, PTR(DEN(src)), size);
+ MPN_COPY (den->_mp_d, src->_mp_den._mp_d, size);
+ den->_mp_size = size;
}
diff --git a/gmp/mpq/get_num.c b/gmp/mpq/get_num.c
index cb464ccb94..c45e7ede2c 100644
--- a/gmp/mpq/get_num.c
+++ b/gmp/mpq/get_num.c
@@ -1,45 +1,34 @@
/* mpq_get_num(num,rat_src) -- Set NUM to the numerator of RAT_SRC.
-Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_get_num (mpz_ptr num, mpq_srcptr src)
+mpq_get_num (MP_INT *num, const MP_RAT *src)
{
- mp_size_t size = SIZ(NUM(src));
+ mp_size_t size = src->_mp_num._mp_size;
mp_size_t abs_size = ABS (size);
- mp_ptr dp;
- dp = MPZ_NEWALLOC (num, abs_size);
- SIZ(num) = size;
+ if (num->_mp_alloc < abs_size)
+ _mpz_realloc (num, abs_size);
- MPN_COPY (dp, PTR(NUM(src)), abs_size);
+ MPN_COPY (num->_mp_d, src->_mp_num._mp_d, abs_size);
+ num->_mp_size = size;
}
diff --git a/gmp/mpq/get_str.c b/gmp/mpq/get_str.c
index 8fa0de1cd7..9b3f7ffbb5 100644
--- a/gmp/mpq/get_str.c
+++ b/gmp/mpq/get_str.c
@@ -1,56 +1,45 @@
/* mpq_get_str -- mpq to string conversion.
-Copyright 2001, 2002, 2006, 2011 Free Software Foundation, Inc.
+Copyright 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <string.h>
#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
char *
mpq_get_str (char *str, int base, mpq_srcptr q)
{
size_t str_alloc, len;
- if (base > 62 || base < -36)
- return NULL;
+ ASSERT (ABS(base) >= 2);
+ ASSERT (ABS(base) <= 62);
str_alloc = 0;
if (str == NULL)
{
/* This is an overestimate since we don't bother checking how much of
- the high limbs of num and den are used. +2 for rounding up the
- chars per bit of num and den. +3 for sign, slash and '\0'. */
- DIGITS_IN_BASE_PER_LIMB (str_alloc, ABSIZ(NUM(q)) + SIZ(DEN(q)), ABS(base));
- str_alloc += 6;
-
+ the high limbs of num and den are used. +2 for rounding up the
+ chars per bit of num and den. +3 for sign, slash and '\0'. */
+ str_alloc = ((size_t) ((ABS (q->_mp_num._mp_size) + q->_mp_den._mp_size)
+ * BITS_PER_MP_LIMB
+ * __mp_bases[ABS(base)].chars_per_bit_exactly))
+ + 5;
str = (char *) (*__gmp_allocate_func) (str_alloc);
}
@@ -66,8 +55,8 @@ mpq_get_str (char *str, int base, mpq_srcptr q)
ASSERT (len == strlen(str));
ASSERT (str_alloc == 0 || len+1 <= str_alloc);
ASSERT (len+1 <= /* size recommended to applications */
- mpz_sizeinbase (mpq_numref(q), ABS(base)) +
- mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3);
+ mpz_sizeinbase (mpq_numref(q), ABS(base)) +
+ mpz_sizeinbase (mpq_denref(q), ABS(base)) + 3);
if (str_alloc != 0)
__GMP_REALLOCATE_FUNC_MAYBE_TYPE (str, str_alloc, len+1, char);
diff --git a/gmp/mpq/init.c b/gmp/mpq/init.c
index 0f526ef31d..4cec0c101c 100644
--- a/gmp/mpq/init.c
+++ b/gmp/mpq/init.c
@@ -1,49 +1,38 @@
/* mpq_init -- Make a new rational number with value 0/1.
-Copyright 1991, 1994, 1995, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_init (mpq_t x)
+mpq_init (MP_RAT *x)
{
- ALLOC(NUM(x)) = 1;
- 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) (GMP_LIMB_BYTES);
- PTR(DEN(x))[0] = 1;
- SIZ(DEN(x)) = 1;
+ x->_mp_num._mp_alloc = 1;
+ x->_mp_num._mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+ x->_mp_num._mp_size = 0;
+ x->_mp_den._mp_alloc = 1;
+ x->_mp_den._mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+ x->_mp_den._mp_d[0] = 1;
+ x->_mp_den._mp_size = 1;
#ifdef __CHECKER__
/* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR(NUM(x))[0] = 0;
+ x->_mp_num._mp_d[0] = 0;
#endif
}
diff --git a/gmp/mpq/inits.c b/gmp/mpq/inits.c
deleted file mode 100644
index 97c41656ff..0000000000
--- a/gmp/mpq/inits.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* mpq_inits() -- Initialize multiple mpq_t variables and set them to 0.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 <stdarg.h>
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-mpq_inits (mpq_ptr x, ...)
-{
- va_list ap;
-
- va_start (ap, x);
-
- while (x != NULL)
- {
- mpq_init (x);
- x = va_arg (ap, mpq_ptr);
- }
- va_end (ap);
-}
diff --git a/gmp/mpq/inp_str.c b/gmp/mpq/inp_str.c
index 7ba95743f8..9df6d80064 100644
--- a/gmp/mpq/inp_str.c
+++ b/gmp/mpq/inp_str.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <ctype.h>
@@ -43,8 +32,8 @@ mpq_inp_str (mpq_ptr q, FILE *fp, int base)
if (fp == NULL)
fp = stdin;
- SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ q->_mp_den._mp_size = 1;
+ q->_mp_den._mp_d[0] = 1;
nread = mpz_inp_str (mpq_numref(q), fp, base);
if (nread == 0)
@@ -60,11 +49,11 @@ mpq_inp_str (mpq_ptr q, FILE *fp, int base)
nread = mpz_inp_str_nowhite (mpq_denref(q), fp, base, c, nread);
if (nread == 0)
- {
- SIZ(NUM(q)) = 0;
- SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
- }
+ {
+ q->_mp_num._mp_size = 0;
+ q->_mp_den._mp_size = 1;
+ q->_mp_den._mp_d[0] = 1;
+ }
}
else
{
diff --git a/gmp/mpq/inv.c b/gmp/mpq/inv.c
index bd703d4860..5143686be5 100644
--- a/gmp/mpq/inv.c
+++ b/gmp/mpq/inv.c
@@ -1,71 +1,67 @@
/* mpq_inv(dest,src) -- invert a rational number, i.e. set DEST to SRC
with the numerator and denominator swapped.
-Copyright 1991, 1994, 1995, 2000, 2001, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_inv (mpq_ptr dest, mpq_srcptr src)
+mpq_inv (MP_RAT *dest, const MP_RAT *src)
{
- mp_size_t num_size = SIZ(NUM(src));
- mp_size_t den_size = SIZ(DEN(src));
+ mp_size_t num_size = src->_mp_num._mp_size;
+ mp_size_t den_size = src->_mp_den._mp_size;
+
+ if (num_size == 0)
+ DIVIDE_BY_ZERO;
if (num_size < 0)
{
num_size = -num_size;
den_size = -den_size;
}
- else if (UNLIKELY (num_size == 0))
- DIVIDE_BY_ZERO;
-
- SIZ(DEN(dest)) = num_size;
- SIZ(NUM(dest)) = den_size;
+ dest->_mp_den._mp_size = num_size;
+ dest->_mp_num._mp_size = den_size;
- /* If dest == src we may just swap the numerator and denominator;
- we ensured that the new denominator is positive. */
+ /* If dest == src we may just swap the numerator and denominator, but
+ we have to ensure the new denominator is positive. */
if (dest == src)
{
- MP_PTR_SWAP (PTR(NUM(dest)), PTR(DEN(dest)));
- MP_SIZE_T_SWAP (ALLOC(NUM(dest)), ALLOC(DEN(dest)));
+ mp_size_t alloc = dest->_mp_num._mp_alloc;
+ mp_ptr limb_ptr = dest->_mp_num._mp_d;
+
+ dest->_mp_num._mp_alloc = dest->_mp_den._mp_alloc;
+ dest->_mp_num._mp_d = dest->_mp_den._mp_d;
+
+ dest->_mp_den._mp_alloc = alloc;
+ dest->_mp_den._mp_d = limb_ptr;
}
else
{
- mp_ptr dp;
-
den_size = ABS (den_size);
- dp = MPZ_NEWALLOC (NUM(dest), den_size);
- MPN_COPY (dp, PTR(DEN(src)), den_size);
+ if (dest->_mp_num._mp_alloc < den_size)
+ _mpz_realloc (&(dest->_mp_num), den_size);
+
+ if (dest->_mp_den._mp_alloc < num_size)
+ _mpz_realloc (&(dest->_mp_den), num_size);
- dp = MPZ_NEWALLOC (DEN(dest), num_size);
- MPN_COPY (dp, PTR(NUM(src)), num_size);
+ MPN_COPY (dest->_mp_num._mp_d, src->_mp_den._mp_d, den_size);
+ MPN_COPY (dest->_mp_den._mp_d, src->_mp_num._mp_d, num_size);
}
}
diff --git a/gmp/mpq/md_2exp.c b/gmp/mpq/md_2exp.c
index a2a7e1e2fb..87eba75ac4 100644
--- a/gmp/mpq/md_2exp.c
+++ b/gmp/mpq/md_2exp.c
@@ -1,33 +1,22 @@
/* mpq_mul_2exp, mpq_div_2exp - multiply or divide by 2^N */
/*
-Copyright 2000, 2002, 2012 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ see https://www.gnu.org/licenses/. */
static void
mord_2exp (mpz_ptr ldst, mpz_ptr rdst, mpz_srcptr lsrc, mpz_srcptr rsrc,
- mp_bitcnt_t n)
+ unsigned long n)
{
mp_size_t rsrc_size = SIZ(rsrc);
mp_size_t len = ABS (rsrc_size);
@@ -59,13 +48,14 @@ mord_2exp (mpz_ptr ldst, mpz_ptr rdst, mpz_srcptr lsrc, mpz_srcptr rsrc,
/* no realloc here if rsrc==rdst, so p and rsrc_ptr remain valid */
len -= (p - rsrc_ptr);
- rdst_ptr = MPZ_REALLOC (rdst, len);
+ MPZ_REALLOC (rdst, len);
+ rdst_ptr = PTR(rdst);
if ((plow & 1) || n == 0)
{
- /* need INCR when src==dst */
+ /* need DECR when src==dst */
if (p != rdst_ptr)
- MPN_COPY_INCR (rdst_ptr, p, len);
+ MPN_COPY_DECR (rdst_ptr, p, len);
}
else
{
@@ -91,21 +81,23 @@ mord_2exp (mpz_ptr ldst, mpz_ptr rdst, mpz_srcptr lsrc, mpz_srcptr rsrc,
void
-mpq_mul_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
+mpq_mul_2exp (mpq_ptr dst, mpq_srcptr src, unsigned long n)
{
- mord_2exp (NUM(dst), DEN(dst), NUM(src), DEN(src), n);
+ mord_2exp (mpq_numref (dst), mpq_denref (dst),
+ mpq_numref (src), mpq_denref (src), n);
}
void
-mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, mp_bitcnt_t n)
+mpq_div_2exp (mpq_ptr dst, mpq_srcptr src, unsigned long n)
{
- if (SIZ(NUM(src)) == 0)
+ if (SIZ (mpq_numref(src)) == 0)
{
- SIZ(NUM(dst)) = 0;
- SIZ(DEN(dst)) = 1;
- PTR(DEN(dst))[0] = 1;
+ dst->_mp_num._mp_size = 0;
+ dst->_mp_den._mp_size = 1;
+ dst->_mp_den._mp_d[0] = 1;
return;
}
- mord_2exp (DEN(dst), NUM(dst), DEN(src), NUM(src), n);
+ mord_2exp (mpq_denref (dst), mpq_numref (dst),
+ mpq_denref (src), mpq_numref (src), n);
}
diff --git a/gmp/mpq/mul.c b/gmp/mpq/mul.c
index 49d618f3bc..0214b31d27 100644
--- a/gmp/mpq/mul.c
+++ b/gmp/mpq/mul.c
@@ -1,32 +1,22 @@
/* mpq_mul -- multiply two rational numbers.
-Copyright 1991, 1994-1996, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -52,18 +42,18 @@ mpq_mul (mpq_ptr prod, mpq_srcptr op1, mpq_srcptr op2)
return;
}
- op1_num_size = ABSIZ(NUM(op1));
- op1_den_size = SIZ(DEN(op1));
- op2_num_size = ABSIZ(NUM(op2));
- op2_den_size = SIZ(DEN(op2));
+ op1_num_size = ABS (op1->_mp_num._mp_size);
+ op1_den_size = op1->_mp_den._mp_size;
+ op2_num_size = ABS (op2->_mp_num._mp_size);
+ op2_den_size = op2->_mp_den._mp_size;
if (op1_num_size == 0 || op2_num_size == 0)
{
/* We special case this to simplify allocation logic; gcd(0,x) = x
is a singular case for the allocations. */
- SIZ(NUM(prod)) = 0;
- PTR(DEN(prod))[0] = 1;
- SIZ(DEN(prod)) = 1;
+ prod->_mp_num._mp_size = 0;
+ prod->_mp_den._mp_d[0] = 1;
+ prod->_mp_den._mp_size = 1;
return;
}
@@ -86,18 +76,18 @@ mpq_mul (mpq_ptr prod, mpq_srcptr op1, mpq_srcptr op2)
numerator of PROD when we are finished with the numerators of OP1 and
OP2. */
- mpz_gcd (gcd1, NUM(op1), DEN(op2));
- mpz_gcd (gcd2, NUM(op2), DEN(op1));
+ mpz_gcd (gcd1, &(op1->_mp_num), &(op2->_mp_den));
+ mpz_gcd (gcd2, &(op2->_mp_num), &(op1->_mp_den));
- mpz_divexact_gcd (tmp1, NUM(op1), gcd1);
- mpz_divexact_gcd (tmp2, NUM(op2), gcd2);
+ mpz_divexact_gcd (tmp1, &(op1->_mp_num), gcd1);
+ mpz_divexact_gcd (tmp2, &(op2->_mp_num), gcd2);
- mpz_mul (NUM(prod), tmp1, tmp2);
+ mpz_mul (&(prod->_mp_num), tmp1, tmp2);
- mpz_divexact_gcd (tmp1, DEN(op2), gcd1);
- mpz_divexact_gcd (tmp2, DEN(op1), gcd2);
+ mpz_divexact_gcd (tmp1, &(op2->_mp_den), gcd1);
+ mpz_divexact_gcd (tmp2, &(op1->_mp_den), gcd2);
- mpz_mul (DEN(prod), tmp1, tmp2);
+ mpz_mul (&(prod->_mp_den), tmp1, tmp2);
TMP_FREE;
}
diff --git a/gmp/mpq/neg.c b/gmp/mpq/neg.c
index 054e21ebe3..972f334702 100644
--- a/gmp/mpq/neg.c
+++ b/gmp/mpq/neg.c
@@ -1,32 +1,21 @@
/* mpq_neg -- negate a rational.
-Copyright 2000, 2001, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpq_neg 1
@@ -37,22 +26,21 @@ see https://www.gnu.org/licenses/. */
void
mpq_neg (mpq_ptr dst, mpq_srcptr src)
{
- mp_size_t num_size = SIZ(NUM(src));
+ mp_size_t num_size = src->_mp_num._mp_size;
if (src != dst)
{
- mp_size_t size;
- mp_ptr dp;
+ mp_size_t num_abs_size = ABS(num_size);
+ mp_size_t den_size = src->_mp_den._mp_size;
+
+ MPZ_REALLOC (mpq_numref(dst), num_abs_size);
+ MPZ_REALLOC (mpq_denref(dst), den_size);
- size = ABS(num_size);
- dp = MPZ_NEWALLOC (NUM(dst), size);
- MPN_COPY (dp, PTR(NUM(src)), size);
+ MPN_COPY (dst->_mp_num._mp_d, src->_mp_num._mp_d, num_abs_size);
+ MPN_COPY (dst->_mp_den._mp_d, src->_mp_den._mp_d, den_size);
- size = SIZ(DEN(src));
- dp = MPZ_NEWALLOC (DEN(dst), size);
- SIZ(DEN(dst)) = size;
- MPN_COPY (dp, PTR(DEN(src)), size);
+ dst->_mp_den._mp_size = den_size;
}
- SIZ(NUM(dst)) = -num_size;
+ dst->_mp_num._mp_size = -num_size;
}
diff --git a/gmp/mpq/out_str.c b/gmp/mpq/out_str.c
index c2bc053b21..ade8e2b199 100644
--- a/gmp/mpq/out_str.c
+++ b/gmp/mpq/out_str.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
diff --git a/gmp/mpq/set.c b/gmp/mpq/set.c
index fb7bfad49c..5d527be95a 100644
--- a/gmp/mpq/set.c
+++ b/gmp/mpq/set.c
@@ -1,51 +1,41 @@
/* mpq_set(dest,src) -- Set DEST to SRC.
-Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_set (mpq_ptr dest, mpq_srcptr src)
+mpq_set (MP_RAT *dest, const MP_RAT *src)
{
mp_size_t num_size, den_size;
mp_size_t abs_num_size;
- mp_ptr dp;
- num_size = SIZ(NUM(src));
+ num_size = src->_mp_num._mp_size;
abs_num_size = ABS (num_size);
- dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
- SIZ(NUM(dest)) = num_size;
- MPN_COPY (dp, PTR(NUM(src)), abs_num_size);
-
- den_size = SIZ(DEN(src));
- dp = MPZ_NEWALLOC (DEN(dest), den_size);
- SIZ(DEN(dest)) = den_size;
- MPN_COPY (dp, PTR(DEN(src)), den_size);
+ if (dest->_mp_num._mp_alloc < abs_num_size)
+ _mpz_realloc (&(dest->_mp_num), abs_num_size);
+ MPN_COPY (dest->_mp_num._mp_d, src->_mp_num._mp_d, abs_num_size);
+ dest->_mp_num._mp_size = num_size;
+
+ den_size = src->_mp_den._mp_size;
+ if (dest->_mp_den._mp_alloc < den_size)
+ _mpz_realloc (&(dest->_mp_den), den_size);
+ MPN_COPY (dest->_mp_den._mp_d, src->_mp_den._mp_d, den_size);
+ dest->_mp_den._mp_size = den_size;
}
diff --git a/gmp/mpq/set_d.c b/gmp/mpq/set_d.c
index 308677db40..1e806f80ab 100644
--- a/gmp/mpq/set_d.c
+++ b/gmp/mpq/set_d.c
@@ -1,32 +1,21 @@
/* mpq_set_d(mpq_t q, double d) -- Set q to d without rounding.
-Copyright 2000, 2002, 2003, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
@@ -75,14 +64,15 @@ mpq_set_d (mpq_ptr dest, double d)
{
if (d == 0.0)
{
- SIZ(NUM(dest)) = 0;
- SIZ(DEN(dest)) = 1;
- PTR(DEN(dest))[0] = 1;
+ SIZ(&(dest->_mp_num)) = 0;
+ SIZ(&(dest->_mp_den)) = 1;
+ PTR(&(dest->_mp_den))[0] = 1;
return;
}
dn = -exp;
- np = MPZ_NEWALLOC (NUM(dest), 3);
+ MPZ_REALLOC (&(dest->_mp_num), 3);
+ np = PTR(&(dest->_mp_num));
#if LIMBS_PER_DOUBLE == 4
if ((tp[0] | tp[1] | tp[2]) == 0)
np[0] = tp[3], nn = 1;
@@ -109,7 +99,8 @@ mpq_set_d (mpq_ptr dest, double d)
#endif
dn += nn + 1;
ASSERT_ALWAYS (dn > 0);
- dp = MPZ_NEWALLOC (DEN(dest), dn);
+ MPZ_REALLOC (&(dest->_mp_den), dn);
+ dp = PTR(&(dest->_mp_den));
MPN_ZERO (dp, dn - 1);
dp[dn - 1] = 1;
count_trailing_zeros (c, np[0] | dp[0]);
@@ -120,13 +111,14 @@ mpq_set_d (mpq_ptr dest, double d)
mpn_rshift (dp, dp, dn, c);
dn -= dp[dn - 1] == 0;
}
- SIZ(DEN(dest)) = dn;
- SIZ(NUM(dest)) = negative ? -nn : nn;
+ SIZ(&(dest->_mp_den)) = dn;
+ SIZ(&(dest->_mp_num)) = negative ? -nn : nn;
}
else
{
nn = exp;
- np = MPZ_NEWALLOC (NUM(dest), nn);
+ MPZ_REALLOC (&(dest->_mp_num), nn);
+ np = PTR(&(dest->_mp_num));
switch (nn)
{
default:
@@ -158,9 +150,9 @@ mpq_set_d (mpq_ptr dest, double d)
break;
#endif
}
- dp = PTR(DEN(dest));
+ dp = PTR(&(dest->_mp_den));
dp[0] = 1;
- SIZ(DEN(dest)) = 1;
- SIZ(NUM(dest)) = negative ? -nn : nn;
+ SIZ(&(dest->_mp_den)) = 1;
+ SIZ(&(dest->_mp_num)) = negative ? -nn : nn;
}
}
diff --git a/gmp/mpq/set_den.c b/gmp/mpq/set_den.c
index 4bcb86b097..641c97da64 100644
--- a/gmp/mpq/set_den.c
+++ b/gmp/mpq/set_den.c
@@ -1,45 +1,34 @@
/* mpq_set_den(dest,den) -- Set the denominator of DEST from DEN.
-Copyright 1991, 1994-1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_set_den (mpq_ptr dest, mpz_srcptr den)
+mpq_set_den (MP_RAT *dest, const MP_INT *den)
{
- mp_size_t size = SIZ (den);
+ mp_size_t size = den->_mp_size;
mp_size_t abs_size = ABS (size);
- mp_ptr dp;
- dp = MPZ_NEWALLOC (DEN(dest), abs_size);
+ if (dest->_mp_den._mp_alloc < abs_size)
+ _mpz_realloc (&(dest->_mp_den), abs_size);
- SIZ(DEN(dest)) = size;
- MPN_COPY (dp, PTR(den), abs_size);
+ MPN_COPY (dest->_mp_den._mp_d, den->_mp_d, abs_size);
+ dest->_mp_den._mp_size = size;
}
diff --git a/gmp/mpq/set_f.c b/gmp/mpq/set_f.c
index 7764a17f05..692e13c983 100644
--- a/gmp/mpq/set_f.c
+++ b/gmp/mpq/set_f.c
@@ -1,32 +1,21 @@
/* mpq_set_f -- set an mpq from an mpf.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -45,9 +34,9 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
if (fsize == 0)
{
/* set q=0 */
- SIZ(NUM(q)) = 0;
- SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ q->_mp_num._mp_size = 0;
+ q->_mp_den._mp_size = 1;
+ q->_mp_den._mp_d[0] = 1;
return;
}
@@ -60,23 +49,26 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
/* radix point is to the right of the limbs, no denominator */
mp_ptr num_ptr;
- num_ptr = MPZ_NEWALLOC (mpq_numref (q), fexp);
+ MPZ_REALLOC (mpq_numref (q), fexp);
+ num_ptr = q->_mp_num._mp_d;
MPN_ZERO (num_ptr, fexp - abs_fsize);
MPN_COPY (num_ptr + fexp - abs_fsize, fptr, abs_fsize);
- SIZ(NUM(q)) = fsize >= 0 ? fexp : -fexp;
- SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ q->_mp_num._mp_size = fsize >= 0 ? fexp : -fexp;
+ q->_mp_den._mp_size = 1;
+ q->_mp_den._mp_d[0] = 1;
}
else
{
- /* radix point is within or to the left of the limbs, use denominator */
+ /* radix point is within or to the left of the limbs, use demominator */
mp_ptr num_ptr, den_ptr;
mp_size_t den_size;
den_size = abs_fsize - fexp;
- num_ptr = MPZ_NEWALLOC (mpq_numref (q), abs_fsize);
- den_ptr = MPZ_NEWALLOC (mpq_denref (q), den_size+1);
+ MPZ_REALLOC (mpq_numref (q), abs_fsize);
+ MPZ_REALLOC (mpq_denref (q), den_size+1);
+ num_ptr = q->_mp_num._mp_d;
+ den_ptr = q->_mp_den._mp_d;
if (flow & 1)
{
@@ -101,7 +93,7 @@ mpq_set_f (mpq_ptr q, mpf_srcptr f)
den_ptr[den_size] = GMP_LIMB_HIGHBIT >> (shift-1);
}
- SIZ(NUM(q)) = fsize >= 0 ? abs_fsize : -abs_fsize;
- SIZ(DEN(q)) = den_size + 1;
+ q->_mp_num._mp_size = fsize >= 0 ? abs_fsize : -abs_fsize;
+ q->_mp_den._mp_size = den_size + 1;
}
}
diff --git a/gmp/mpq/set_num.c b/gmp/mpq/set_num.c
index c6b52ccaa1..6c3c5646ac 100644
--- a/gmp/mpq/set_num.c
+++ b/gmp/mpq/set_num.c
@@ -1,45 +1,34 @@
/* mpq_set_num(dest,num) -- Set the numerator of DEST from NUM.
-Copyright 1991, 1994, 1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2001 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_set_num (mpq_ptr dest, mpz_srcptr num)
+mpq_set_num (MP_RAT *dest, const MP_INT *num)
{
- mp_size_t size = SIZ (num);
+ mp_size_t size = num->_mp_size;
mp_size_t abs_size = ABS (size);
- mp_ptr dp;
- dp = MPZ_NEWALLOC (NUM(dest), abs_size);
+ if (dest->_mp_num._mp_alloc < abs_size)
+ _mpz_realloc (&(dest->_mp_num), abs_size);
- SIZ(NUM(dest)) = size;
- MPN_COPY (dp, PTR(num), abs_size);
+ MPN_COPY (dest->_mp_num._mp_d, num->_mp_d, abs_size);
+ dest->_mp_num._mp_size = size;
}
diff --git a/gmp/mpq/set_si.c b/gmp/mpq/set_si.c
index 0a10b3048d..1bcf329c50 100644
--- a/gmp/mpq/set_si.c
+++ b/gmp/mpq/set_si.c
@@ -1,4 +1,4 @@
-/* mpq_set_si(dest,ulong_num,ulong_den) -- Set DEST to the rational number
+/* mpq_set_si(dest,ulong_num,ulong_den) -- Set DEST to the retional number
ULONG_NUM/ULONG_DEN.
Copyright 1991, 1994, 1995, 2001, 2003 Free Software Foundation, Inc.
@@ -6,34 +6,23 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
+mpq_set_si (MP_RAT *dest, signed long int num, unsigned long int den)
{
unsigned long int abs_num;
@@ -46,20 +35,20 @@ mpq_set_si (mpq_t dest, signed long int num, unsigned long int den)
return;
}
- abs_num = ABS_CAST (unsigned long, num);
+ abs_num = ABS (num);
if (num == 0)
{
/* Canonicalize 0/d to 0/1. */
den = 1;
- SIZ(NUM(dest)) = 0;
+ dest->_mp_num._mp_size = 0;
}
else
{
- PTR(NUM(dest))[0] = abs_num;
- SIZ(NUM(dest)) = num > 0 ? 1 : -1;
+ dest->_mp_num._mp_d[0] = abs_num;
+ dest->_mp_num._mp_size = num > 0 ? 1 : -1;
}
- PTR(DEN(dest))[0] = den;
- SIZ(DEN(dest)) = (den != 0);
+ dest->_mp_den._mp_d[0] = den;
+ dest->_mp_den._mp_size = (den != 0);
}
diff --git a/gmp/mpq/set_str.c b/gmp/mpq/set_str.c
index 930fe5576c..fd1c415f98 100644
--- a/gmp/mpq/set_str.c
+++ b/gmp/mpq/set_str.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <string.h>
@@ -49,8 +38,8 @@ mpq_set_str (mpq_ptr q, const char *str, int base)
slash = strchr (str, '/');
if (slash == NULL)
{
- SIZ(DEN(q)) = 1;
- PTR(DEN(q))[0] = 1;
+ q->_mp_den._mp_size = 1;
+ q->_mp_den._mp_d[0] = 1;
return mpz_set_str (mpq_numref(q), str, base);
}
diff --git a/gmp/mpq/set_ui.c b/gmp/mpq/set_ui.c
index 4473b30bb8..8f0a9cd0cb 100644
--- a/gmp/mpq/set_ui.c
+++ b/gmp/mpq/set_ui.c
@@ -1,39 +1,28 @@
/* mpq_set_ui(dest,ulong_num,ulong_den) -- Set DEST to the rational number
ULONG_NUM/ULONG_DEN.
-Copyright 1991, 1994, 1995, 2001-2003 Free Software Foundation, Inc.
+Copyright 1991, 1994, 1995, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_set_ui (mpq_t dest, unsigned long int num, unsigned long int den)
+mpq_set_ui (MP_RAT *dest, unsigned long int num, unsigned long int den)
{
if (GMP_NUMB_BITS < BITS_PER_ULONG)
{
@@ -48,14 +37,14 @@ mpq_set_ui (mpq_t dest, unsigned long int num, unsigned long int den)
{
/* Canonicalize 0/n to 0/1. */
den = 1;
- SIZ(NUM(dest)) = 0;
+ dest->_mp_num._mp_size = 0;
}
else
{
- PTR(NUM(dest))[0] = num;
- SIZ(NUM(dest)) = 1;
+ dest->_mp_num._mp_d[0] = num;
+ dest->_mp_num._mp_size = 1;
}
- PTR(DEN(dest))[0] = den;
- SIZ(DEN(dest)) = (den != 0);
+ dest->_mp_den._mp_d[0] = den;
+ dest->_mp_den._mp_size = (den != 0);
}
diff --git a/gmp/mpq/set_z.c b/gmp/mpq/set_z.c
index 358d1ca899..8ca980c4a6 100644
--- a/gmp/mpq/set_z.c
+++ b/gmp/mpq/set_z.c
@@ -1,32 +1,21 @@
/* mpq_set_z (dest,src) -- Set DEST to SRC.
-Copyright 1996, 2001, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -36,14 +25,14 @@ mpq_set_z (mpq_ptr dest, mpz_srcptr src)
{
mp_size_t num_size;
mp_size_t abs_num_size;
- mp_ptr dp;
- num_size = SIZ (src);
+ num_size = src->_mp_size;
abs_num_size = ABS (num_size);
- dp = MPZ_NEWALLOC (NUM(dest), abs_num_size);
- SIZ(NUM(dest)) = num_size;
- MPN_COPY (dp, PTR(src), abs_num_size);
+ if (dest->_mp_num._mp_alloc < abs_num_size)
+ _mpz_realloc (&(dest->_mp_num), abs_num_size);
+ MPN_COPY (dest->_mp_num._mp_d, src->_mp_d, abs_num_size);
+ dest->_mp_num._mp_size = num_size;
- PTR(DEN(dest))[0] = 1;
- SIZ(DEN(dest)) = 1;
+ dest->_mp_den._mp_d[0] = 1;
+ dest->_mp_den._mp_size = 1;
}
diff --git a/gmp/mpq/swap.c b/gmp/mpq/swap.c
index 51fdcac7fd..507e7d51d2 100644
--- a/gmp/mpq/swap.c
+++ b/gmp/mpq/swap.c
@@ -5,67 +5,56 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpq_swap (mpq_ptr u, mpq_ptr v) __GMP_NOTHROW
+mpq_swap (mpq_ptr u, mpq_ptr v)
{
mp_ptr up, vp;
mp_size_t usize, vsize;
mp_size_t ualloc, valloc;
- ualloc = ALLOC(NUM(u));
- valloc = ALLOC(NUM(v));
- ALLOC(NUM(v)) = ualloc;
- ALLOC(NUM(u)) = valloc;
+ ualloc = u->_mp_num._mp_alloc;
+ valloc = v->_mp_num._mp_alloc;
+ v->_mp_num._mp_alloc = ualloc;
+ u->_mp_num._mp_alloc = valloc;
- usize = SIZ(NUM(u));
- vsize = SIZ(NUM(v));
- SIZ(NUM(v)) = usize;
- SIZ(NUM(u)) = vsize;
+ usize = u->_mp_num._mp_size;
+ vsize = v->_mp_num._mp_size;
+ v->_mp_num._mp_size = usize;
+ u->_mp_num._mp_size = vsize;
- up = PTR(NUM(u));
- vp = PTR(NUM(v));
- PTR(NUM(v)) = up;
- PTR(NUM(u)) = vp;
+ up = u->_mp_num._mp_d;
+ vp = v->_mp_num._mp_d;
+ v->_mp_num._mp_d = up;
+ u->_mp_num._mp_d = vp;
- ualloc = ALLOC(DEN(u));
- valloc = ALLOC(DEN(v));
- ALLOC(DEN(v)) = ualloc;
- ALLOC(DEN(u)) = valloc;
+ ualloc = u->_mp_den._mp_alloc;
+ valloc = v->_mp_den._mp_alloc;
+ v->_mp_den._mp_alloc = ualloc;
+ u->_mp_den._mp_alloc = valloc;
- usize = SIZ(DEN(u));
- vsize = SIZ(DEN(v));
- SIZ(DEN(v)) = usize;
- SIZ(DEN(u)) = vsize;
+ usize = u->_mp_den._mp_size;
+ vsize = v->_mp_den._mp_size;
+ v->_mp_den._mp_size = usize;
+ u->_mp_den._mp_size = vsize;
- up = PTR(DEN(u));
- vp = PTR(DEN(v));
- PTR(DEN(v)) = up;
- PTR(DEN(u)) = vp;
+ up = u->_mp_den._mp_d;
+ vp = v->_mp_den._mp_d;
+ v->_mp_den._mp_d = up;
+ u->_mp_den._mp_d = vp;
}
diff --git a/gmp/mpz/2fac_ui.c b/gmp/mpz/2fac_ui.c
deleted file mode 100644
index 37e6c468bc..0000000000
--- a/gmp/mpz/2fac_ui.c
+++ /dev/null
@@ -1,100 +0,0 @@
-/* mpz_2fac_ui(RESULT, N) -- Set RESULT to N!!.
-
-Contributed to the GNU project by Marco Bodrato.
-
-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 "gmp.h"
-#include "gmp-impl.h"
-
-#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
- do { \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = (P); \
- } else \
- (PR) *= (P); \
- } while (0)
-
-#define FAC_2DSC_THRESHOLD ((FAC_DSC_THRESHOLD << 1) | (FAC_DSC_THRESHOLD & 1))
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_2DSC_THRESHOLD-1)+1))
-
-/* Computes n!!, the 2-multi-factorial of n. (aka double-factorial or semi-factorial)
- WARNING: it assumes that n fits in a limb!
- */
-void
-mpz_2fac_ui (mpz_ptr x, unsigned long n)
-{
- ASSERT (n <= GMP_NUMB_MAX);
-
- if ((n & 1) == 0) { /* n is even, n = 2k, (2k)!! = k! 2^k */
- mp_limb_t count;
-
- if ((n <= TABLE_LIMIT_2N_MINUS_POPC_2N) & (n != 0))
- count = __gmp_fac2cnt_table[n / 2 - 1];
- else
- {
- popc_limb (count, n); /* popc(n) == popc(k) */
- count = n - count; /* n - popc(n) == k + k - popc(k) */
- }
- mpz_oddfac_1 (x, n >> 1, 0);
- mpz_mul_2exp (x, x, count);
- } else { /* n is odd */
- if (n <= ODD_DOUBLEFACTORIAL_TABLE_LIMIT) {
- PTR (x)[0] = __gmp_odd2fac_table[n >> 1];
- SIZ (x) = 1;
- } else if (BELOW_THRESHOLD (n, FAC_2DSC_THRESHOLD)) { /* odd basecase, */
- mp_limb_t *factors, prod, max_prod, j;
- TMP_SDECL;
-
- /* 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));
-
- factors[0] = ODD_DOUBLEFACTORIAL_TABLE_MAX;
- j = 1;
- prod = n;
-
- max_prod = GMP_NUMB_MAX / FAC_2DSC_THRESHOLD;
- while ((n -= 2) > ODD_DOUBLEFACTORIAL_TABLE_LIMIT)
- FACTOR_LIST_STORE (n, prod, max_prod, factors, j);
-
- factors[j++] = prod;
- mpz_prodlimbs (x, factors, j);
-
- TMP_SFREE;
- } else { /* for the asymptotically fast odd case, let oddfac do the job. */
- mpz_oddfac_1 (x, n, 1);
- }
- }
-}
-
-#undef FACTORS_PER_LIMB
-#undef FACTOR_LIST_STORE
-#undef FAC_2DSC_THRESHOLD
diff --git a/gmp/mpz/Makefile.am b/gmp/mpz/Makefile.am
index 1aac41b992..3a38284a2f 100644
--- a/gmp/mpz/Makefile.am
+++ b/gmp/mpz/Makefile.am
@@ -1,44 +1,33 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1996, 1998-2003, 2012 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libmpz.la
libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \
- 2fac_ui.c \
add.c add_ui.c abs.c aorsmul.c aorsmul_i.c and.c array_init.c \
bin_ui.c bin_uiui.c cdiv_q.c \
cdiv_q_ui.c cdiv_qr.c cdiv_qr_ui.c cdiv_r.c cdiv_r_ui.c cdiv_ui.c \
cfdiv_q_2exp.c cfdiv_r_2exp.c \
- clear.c clears.c clrbit.c \
+ clear.c clrbit.c \
cmp.c cmp_d.c cmp_si.c cmp_ui.c cmpabs.c cmpabs_d.c cmpabs_ui.c \
com.c combit.c \
cong.c cong_2exp.c cong_ui.c \
@@ -50,18 +39,22 @@ libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \
fits_uint.c fits_ulong.c fits_ushort.c \
gcd.c gcd_ui.c gcdext.c get_d.c get_d_2exp.c get_si.c \
get_str.c get_ui.c getlimbn.c hamdist.c \
- import.c init.c init2.c inits.c inp_raw.c inp_str.c \
+ import.c init.c init2.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 limbs_read.c limbs_write.c limbs_modify.c limbs_finish.c \
- lucnum_ui.c lucnum2_ui.c mfac_uiui.c millerrabin.c \
+ lcm.c lcm_ui.c lucnum_ui.c lucnum2_ui.c millerrabin.c \
mod.c mul.c mul_2exp.c mul_si.c mul_ui.c n_pow_ui.c neg.c nextprime.c \
- oddfac_1.c \
out_raw.c out_str.c perfpow.c perfsqr.c popcount.c pow_ui.c powm.c \
- powm_sec.c powm_ui.c pprime_p.c prodlimbs.c primorial_ui.c random.c random2.c \
- realloc.c realloc2.c remove.c roinit_n.c root.c rootrem.c rrandomb.c \
+ powm_ui.c pprime_p.c random.c random2.c \
+ realloc.c realloc2.c remove.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 \
tdiv_qr_ui.c tdiv_r.c tdiv_r_2exp.c tdiv_r_ui.c tstbit.c ui_pow_ui.c \
ui_sub.c urandomb.c urandomm.c xor.c
+
+# These are BUILT_SOURCES at the top-level, so normally they're built before
+# recursing into this directory.
+#
+fac_ui.h:
+ cd ..; $(MAKE) $(AM_MAKEFLAGS) mpz/fac_ui.h
diff --git a/gmp/mpz/Makefile.in b/gmp/mpz/Makefile.in
index fc2eb0fab7..9159c4df6d 100644
--- a/gmp/mpz/Makefile.in
+++ b/gmp/mpz/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,57 +14,35 @@
@SET_MAKE@
-# 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
+# Copyright 1996, 1998, 1999, 2000, 2001, 2002, 2003 Free Software
+# Foundation, Inc.
#
-# * the 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 file is part of the GNU MP Library.
#
-# or both in parallel, as here.
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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 Lesser 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+
+SOURCES = $(libmpz_la_SOURCES)
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -77,72 +54,68 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
subdir = mpz
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libmpz_la_LIBADD =
-am_libmpz_la_OBJECTS = 2fac_ui.lo add.lo add_ui.lo abs.lo aorsmul.lo \
- aorsmul_i.lo and.lo array_init.lo bin_ui.lo bin_uiui.lo \
- cdiv_q.lo cdiv_q_ui.lo cdiv_qr.lo cdiv_qr_ui.lo cdiv_r.lo \
- cdiv_r_ui.lo cdiv_ui.lo cfdiv_q_2exp.lo cfdiv_r_2exp.lo \
- clear.lo clears.lo clrbit.lo cmp.lo cmp_d.lo cmp_si.lo \
- cmp_ui.lo cmpabs.lo cmpabs_d.lo cmpabs_ui.lo com.lo combit.lo \
- cong.lo cong_2exp.lo cong_ui.lo divexact.lo divegcd.lo \
- dive_ui.lo divis.lo divis_ui.lo divis_2exp.lo dump.lo \
- export.lo fac_ui.lo fdiv_q.lo fdiv_q_ui.lo fdiv_qr.lo \
- fdiv_qr_ui.lo fdiv_r.lo fdiv_r_ui.lo fdiv_ui.lo fib_ui.lo \
- fib2_ui.lo fits_sint.lo fits_slong.lo fits_sshort.lo \
- fits_uint.lo fits_ulong.lo fits_ushort.lo gcd.lo gcd_ui.lo \
- gcdext.lo get_d.lo get_d_2exp.lo get_si.lo get_str.lo \
- get_ui.lo getlimbn.lo hamdist.lo import.lo init.lo init2.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 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
+am_libmpz_la_OBJECTS = add$U.lo add_ui$U.lo abs$U.lo aorsmul$U.lo \
+ aorsmul_i$U.lo and$U.lo array_init$U.lo bin_ui$U.lo \
+ bin_uiui$U.lo cdiv_q$U.lo cdiv_q_ui$U.lo cdiv_qr$U.lo \
+ cdiv_qr_ui$U.lo cdiv_r$U.lo cdiv_r_ui$U.lo cdiv_ui$U.lo \
+ cfdiv_q_2exp$U.lo cfdiv_r_2exp$U.lo clear$U.lo clrbit$U.lo \
+ cmp$U.lo cmp_d$U.lo cmp_si$U.lo cmp_ui$U.lo cmpabs$U.lo \
+ cmpabs_d$U.lo cmpabs_ui$U.lo com$U.lo combit$U.lo cong$U.lo \
+ cong_2exp$U.lo cong_ui$U.lo divexact$U.lo divegcd$U.lo \
+ dive_ui$U.lo divis$U.lo divis_ui$U.lo divis_2exp$U.lo \
+ dump$U.lo export$U.lo fac_ui$U.lo fdiv_q$U.lo fdiv_q_ui$U.lo \
+ fdiv_qr$U.lo fdiv_qr_ui$U.lo fdiv_r$U.lo fdiv_r_ui$U.lo \
+ fdiv_ui$U.lo fib_ui$U.lo fib2_ui$U.lo fits_sint$U.lo \
+ fits_slong$U.lo fits_sshort$U.lo fits_uint$U.lo \
+ fits_ulong$U.lo fits_ushort$U.lo gcd$U.lo gcd_ui$U.lo \
+ gcdext$U.lo get_d$U.lo get_d_2exp$U.lo get_si$U.lo \
+ get_str$U.lo get_ui$U.lo getlimbn$U.lo hamdist$U.lo \
+ import$U.lo init$U.lo init2$U.lo inp_raw$U.lo inp_str$U.lo \
+ invert$U.lo ior$U.lo iset$U.lo iset_d$U.lo iset_si$U.lo \
+ iset_str$U.lo iset_ui$U.lo jacobi$U.lo kronsz$U.lo kronuz$U.lo \
+ kronzs$U.lo kronzu$U.lo lcm$U.lo lcm_ui$U.lo lucnum_ui$U.lo \
+ lucnum2_ui$U.lo millerrabin$U.lo mod$U.lo mul$U.lo \
+ mul_2exp$U.lo mul_si$U.lo mul_ui$U.lo n_pow_ui$U.lo neg$U.lo \
+ nextprime$U.lo out_raw$U.lo out_str$U.lo perfpow$U.lo \
+ perfsqr$U.lo popcount$U.lo pow_ui$U.lo powm$U.lo powm_ui$U.lo \
+ pprime_p$U.lo random$U.lo random2$U.lo realloc$U.lo \
+ realloc2$U.lo remove$U.lo root$U.lo rootrem$U.lo rrandomb$U.lo \
+ scan0$U.lo scan1$U.lo set$U.lo set_d$U.lo set_f$U.lo \
+ set_q$U.lo set_si$U.lo set_str$U.lo set_ui$U.lo setbit$U.lo \
+ size$U.lo sizeinbase$U.lo sqrt$U.lo sqrtrem$U.lo sub$U.lo \
+ sub_ui$U.lo swap$U.lo tdiv_ui$U.lo tdiv_q$U.lo \
+ tdiv_q_2exp$U.lo tdiv_q_ui$U.lo tdiv_qr$U.lo tdiv_qr_ui$U.lo \
+ tdiv_r$U.lo tdiv_r_2exp$U.lo tdiv_r_ui$U.lo tstbit$U.lo \
+ ui_pow_ui$U.lo ui_sub$U.lo urandomb$U.lo urandomm$U.lo \
+ xor$U.lo
libmpz_la_OBJECTS = $(am_libmpz_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libmpz_la_SOURCES)
DIST_SOURCES = $(libmpz_la_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -156,6 +129,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -171,17 +145,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -195,12 +168,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -215,26 +186,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -244,31 +209,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -292,6 +252,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -299,21 +260,16 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libmpz.la
libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \
- 2fac_ui.c \
add.c add_ui.c abs.c aorsmul.c aorsmul_i.c and.c array_init.c \
bin_ui.c bin_uiui.c cdiv_q.c \
cdiv_q_ui.c cdiv_qr.c cdiv_qr_ui.c cdiv_r.c cdiv_r_ui.c cdiv_ui.c \
cfdiv_q_2exp.c cfdiv_r_2exp.c \
- clear.c clears.c clrbit.c \
+ clear.c clrbit.c \
cmp.c cmp_d.c cmp_si.c cmp_ui.c cmpabs.c cmpabs_d.c cmpabs_ui.c \
com.c combit.c \
cong.c cong_2exp.c cong_ui.c \
@@ -325,16 +281,14 @@ libmpz_la_SOURCES = aors.h aors_ui.h fits_s.h mul_i.h \
fits_uint.c fits_ulong.c fits_ushort.c \
gcd.c gcd_ui.c gcdext.c get_d.c get_d_2exp.c get_si.c \
get_str.c get_ui.c getlimbn.c hamdist.c \
- import.c init.c init2.c inits.c inp_raw.c inp_str.c \
+ import.c init.c init2.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 limbs_read.c limbs_write.c limbs_modify.c limbs_finish.c \
- lucnum_ui.c lucnum2_ui.c mfac_uiui.c millerrabin.c \
+ lcm.c lcm_ui.c lucnum_ui.c lucnum2_ui.c millerrabin.c \
mod.c mul.c mul_2exp.c mul_si.c mul_ui.c n_pow_ui.c neg.c nextprime.c \
- oddfac_1.c \
out_raw.c out_str.c perfpow.c perfsqr.c popcount.c pow_ui.c powm.c \
- powm_sec.c powm_ui.c pprime_p.c prodlimbs.c primorial_ui.c random.c random2.c \
- realloc.c realloc2.c remove.c roinit_n.c root.c rootrem.c rrandomb.c \
+ powm_ui.c pprime_p.c random.c random2.c \
+ realloc.c realloc2.c remove.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 \
@@ -349,14 +303,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpz/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps mpz/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps mpz/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps mpz/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -374,24 +328,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libmpz.la: $(libmpz_la_OBJECTS) $(libmpz_la_DEPENDENCIES) $(EXTRA_libmpz_la_DEPENDENCIES)
- $(LINK) $(libmpz_la_OBJECTS) $(libmpz_la_LIBADD) $(LIBS)
+libmpz.la: $(libmpz_la_OBJECTS) $(libmpz_la_DEPENDENCIES)
+ $(LINK) $(libmpz_la_LDFLAGS) $(libmpz_la_OBJECTS) $(libmpz_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -401,6 +359,367 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+abs_.c: abs.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/abs.c; then echo $(srcdir)/abs.c; else echo abs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_.c: add.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add.c; then echo $(srcdir)/add.c; else echo add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+add_ui_.c: add_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/add_ui.c; then echo $(srcdir)/add_ui.c; else echo add_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+and_.c: and.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/and.c; then echo $(srcdir)/and.c; else echo and.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+aorsmul_.c: aorsmul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/aorsmul.c; then echo $(srcdir)/aorsmul.c; else echo aorsmul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+aorsmul_i_.c: aorsmul_i.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/aorsmul_i.c; then echo $(srcdir)/aorsmul_i.c; else echo aorsmul_i.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+array_init_.c: array_init.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/array_init.c; then echo $(srcdir)/array_init.c; else echo array_init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+bin_ui_.c: bin_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bin_ui.c; then echo $(srcdir)/bin_ui.c; else echo bin_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+bin_uiui_.c: bin_uiui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bin_uiui.c; then echo $(srcdir)/bin_uiui.c; else echo bin_uiui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cdiv_q_.c: cdiv_q.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_q.c; then echo $(srcdir)/cdiv_q.c; else echo cdiv_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cdiv_q_ui_.c: cdiv_q_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_q_ui.c; then echo $(srcdir)/cdiv_q_ui.c; else echo cdiv_q_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cdiv_qr_.c: cdiv_qr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_qr.c; then echo $(srcdir)/cdiv_qr.c; else echo cdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cdiv_qr_ui_.c: cdiv_qr_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_qr_ui.c; then echo $(srcdir)/cdiv_qr_ui.c; else echo cdiv_qr_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cdiv_r_.c: cdiv_r.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_r.c; then echo $(srcdir)/cdiv_r.c; else echo cdiv_r.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cdiv_r_ui_.c: cdiv_r_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_r_ui.c; then echo $(srcdir)/cdiv_r_ui.c; else echo cdiv_r_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cdiv_ui_.c: cdiv_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cdiv_ui.c; then echo $(srcdir)/cdiv_ui.c; else echo cdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cfdiv_q_2exp_.c: cfdiv_q_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cfdiv_q_2exp.c; then echo $(srcdir)/cfdiv_q_2exp.c; else echo cfdiv_q_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cfdiv_r_2exp_.c: cfdiv_r_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cfdiv_r_2exp.c; then echo $(srcdir)/cfdiv_r_2exp.c; else echo cfdiv_r_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+clear_.c: clear.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clear.c; then echo $(srcdir)/clear.c; else echo clear.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+clrbit_.c: clrbit.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clrbit.c; then echo $(srcdir)/clrbit.c; else echo clrbit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_.c: cmp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp.c; then echo $(srcdir)/cmp.c; else echo cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_d_.c: cmp_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_d.c; then echo $(srcdir)/cmp_d.c; else echo cmp_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_si_.c: cmp_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_si.c; then echo $(srcdir)/cmp_si.c; else echo cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmp_ui_.c: cmp_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmp_ui.c; then echo $(srcdir)/cmp_ui.c; else echo cmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmpabs_.c: cmpabs.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmpabs.c; then echo $(srcdir)/cmpabs.c; else echo cmpabs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmpabs_d_.c: cmpabs_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmpabs_d.c; then echo $(srcdir)/cmpabs_d.c; else echo cmpabs_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cmpabs_ui_.c: cmpabs_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cmpabs_ui.c; then echo $(srcdir)/cmpabs_ui.c; else echo cmpabs_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+com_.c: com.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/com.c; then echo $(srcdir)/com.c; else echo com.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+combit_.c: combit.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/combit.c; then echo $(srcdir)/combit.c; else echo combit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cong_.c: cong.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cong.c; then echo $(srcdir)/cong.c; else echo cong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cong_2exp_.c: cong_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cong_2exp.c; then echo $(srcdir)/cong_2exp.c; else echo cong_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+cong_ui_.c: cong_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/cong_ui.c; then echo $(srcdir)/cong_ui.c; else echo cong_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dive_ui_.c: dive_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive_ui.c; then echo $(srcdir)/dive_ui.c; else echo dive_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divegcd_.c: divegcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divegcd.c; then echo $(srcdir)/divegcd.c; else echo divegcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divexact_.c: divexact.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divexact.c; then echo $(srcdir)/divexact.c; else echo divexact.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divis_.c: divis.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis.c; then echo $(srcdir)/divis.c; else echo divis.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divis_2exp_.c: divis_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis_2exp.c; then echo $(srcdir)/divis_2exp.c; else echo divis_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divis_ui_.c: divis_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divis_ui.c; then echo $(srcdir)/divis_ui.c; else echo divis_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dump_.c: dump.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dump.c; then echo $(srcdir)/dump.c; else echo dump.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+export_.c: export.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/export.c; then echo $(srcdir)/export.c; else echo export.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fac_ui_.c: fac_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fac_ui.c; then echo $(srcdir)/fac_ui.c; else echo fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fdiv_q_.c: fdiv_q.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_q.c; then echo $(srcdir)/fdiv_q.c; else echo fdiv_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fdiv_q_ui_.c: fdiv_q_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_q_ui.c; then echo $(srcdir)/fdiv_q_ui.c; else echo fdiv_q_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fdiv_qr_.c: fdiv_qr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_qr.c; then echo $(srcdir)/fdiv_qr.c; else echo fdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fdiv_qr_ui_.c: fdiv_qr_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_qr_ui.c; then echo $(srcdir)/fdiv_qr_ui.c; else echo fdiv_qr_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fdiv_r_.c: fdiv_r.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_r.c; then echo $(srcdir)/fdiv_r.c; else echo fdiv_r.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fdiv_r_ui_.c: fdiv_r_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_r_ui.c; then echo $(srcdir)/fdiv_r_ui.c; else echo fdiv_r_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fdiv_ui_.c: fdiv_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fdiv_ui.c; then echo $(srcdir)/fdiv_ui.c; else echo fdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fib2_ui_.c: fib2_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib2_ui.c; then echo $(srcdir)/fib2_ui.c; else echo fib2_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fib_ui_.c: fib_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fib_ui.c; then echo $(srcdir)/fib_ui.c; else echo fib_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_sint_.c: fits_sint.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sint.c; then echo $(srcdir)/fits_sint.c; else echo fits_sint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_slong_.c: fits_slong.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_slong.c; then echo $(srcdir)/fits_slong.c; else echo fits_slong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_sshort_.c: fits_sshort.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_sshort.c; then echo $(srcdir)/fits_sshort.c; else echo fits_sshort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_uint_.c: fits_uint.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_uint.c; then echo $(srcdir)/fits_uint.c; else echo fits_uint.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_ulong_.c: fits_ulong.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ulong.c; then echo $(srcdir)/fits_ulong.c; else echo fits_ulong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fits_ushort_.c: fits_ushort.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fits_ushort.c; then echo $(srcdir)/fits_ushort.c; else echo fits_ushort.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcd_.c: gcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd.c; then echo $(srcdir)/gcd.c; else echo gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcd_ui_.c: gcd_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd_ui.c; then echo $(srcdir)/gcd_ui.c; else echo gcd_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcdext_.c: gcdext.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdext.c; then echo $(srcdir)/gcdext.c; else echo gcdext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_d_.c: get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d.c; then echo $(srcdir)/get_d.c; else echo get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_d_2exp_.c: get_d_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_d_2exp.c; then echo $(srcdir)/get_d_2exp.c; else echo get_d_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_si_.c: get_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_si.c; then echo $(srcdir)/get_si.c; else echo get_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_str_.c: get_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_ui_.c: get_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_ui.c; then echo $(srcdir)/get_ui.c; else echo get_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+getlimbn_.c: getlimbn.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/getlimbn.c; then echo $(srcdir)/getlimbn.c; else echo getlimbn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+hamdist_.c: hamdist.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hamdist.c; then echo $(srcdir)/hamdist.c; else echo hamdist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+import_.c: import.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/import.c; then echo $(srcdir)/import.c; else echo import.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+init_.c: init.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init.c; then echo $(srcdir)/init.c; else echo init.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+init2_.c: init2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/init2.c; then echo $(srcdir)/init2.c; else echo init2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+inp_raw_.c: inp_raw.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_raw.c; then echo $(srcdir)/inp_raw.c; else echo inp_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+inp_str_.c: inp_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/inp_str.c; then echo $(srcdir)/inp_str.c; else echo inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+invert_.c: invert.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/invert.c; then echo $(srcdir)/invert.c; else echo invert.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ior_.c: ior.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ior.c; then echo $(srcdir)/ior.c; else echo ior.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_.c: iset.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset.c; then echo $(srcdir)/iset.c; else echo iset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_d_.c: iset_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_d.c; then echo $(srcdir)/iset_d.c; else echo iset_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_si_.c: iset_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_si.c; then echo $(srcdir)/iset_si.c; else echo iset_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_str_.c: iset_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_str.c; then echo $(srcdir)/iset_str.c; else echo iset_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+iset_ui_.c: iset_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/iset_ui.c; then echo $(srcdir)/iset_ui.c; else echo iset_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+jacobi_.c: jacobi.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jacobi.c; then echo $(srcdir)/jacobi.c; else echo jacobi.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+kronsz_.c: kronsz.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronsz.c; then echo $(srcdir)/kronsz.c; else echo kronsz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+kronuz_.c: kronuz.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronuz.c; then echo $(srcdir)/kronuz.c; else echo kronuz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+kronzs_.c: kronzs.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronzs.c; then echo $(srcdir)/kronzs.c; else echo kronzs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+kronzu_.c: kronzu.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/kronzu.c; then echo $(srcdir)/kronzu.c; else echo kronzu.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+lcm_.c: lcm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lcm.c; then echo $(srcdir)/lcm.c; else echo lcm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+lcm_ui_.c: lcm_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lcm_ui.c; then echo $(srcdir)/lcm_ui.c; else echo lcm_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+lucnum2_ui_.c: lucnum2_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lucnum2_ui.c; then echo $(srcdir)/lucnum2_ui.c; else echo lucnum2_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+lucnum_ui_.c: lucnum_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/lucnum_ui.c; then echo $(srcdir)/lucnum_ui.c; else echo lucnum_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+millerrabin_.c: millerrabin.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/millerrabin.c; then echo $(srcdir)/millerrabin.c; else echo millerrabin.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_.c: mod.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod.c; then echo $(srcdir)/mod.c; else echo mod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_.c: mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_2exp_.c: mul_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_2exp.c; then echo $(srcdir)/mul_2exp.c; else echo mul_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_si_.c: mul_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_si.c; then echo $(srcdir)/mul_si.c; else echo mul_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_ui_.c: mul_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_ui.c; then echo $(srcdir)/mul_ui.c; else echo mul_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+n_pow_ui_.c: n_pow_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/n_pow_ui.c; then echo $(srcdir)/n_pow_ui.c; else echo n_pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+neg_.c: neg.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/neg.c; then echo $(srcdir)/neg.c; else echo neg.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+nextprime_.c: nextprime.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/nextprime.c; then echo $(srcdir)/nextprime.c; else echo nextprime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+out_raw_.c: out_raw.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_raw.c; then echo $(srcdir)/out_raw.c; else echo out_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+out_str_.c: out_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/out_str.c; then echo $(srcdir)/out_str.c; else echo out_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+perfpow_.c: perfpow.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/perfpow.c; then echo $(srcdir)/perfpow.c; else echo perfpow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+perfsqr_.c: perfsqr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/perfsqr.c; then echo $(srcdir)/perfsqr.c; else echo perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+popcount_.c: popcount.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/popcount.c; then echo $(srcdir)/popcount.c; else echo popcount.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pow_ui_.c: pow_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pow_ui.c; then echo $(srcdir)/pow_ui.c; else echo pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+powm_.c: powm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/powm.c; then echo $(srcdir)/powm.c; else echo powm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+powm_ui_.c: powm_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/powm_ui.c; then echo $(srcdir)/powm_ui.c; else echo powm_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pprime_p_.c: pprime_p.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pprime_p.c; then echo $(srcdir)/pprime_p.c; else echo pprime_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+random_.c: random.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random.c; then echo $(srcdir)/random.c; else echo random.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+random2_.c: random2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/random2.c; then echo $(srcdir)/random2.c; else echo random2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+realloc_.c: realloc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc.c; then echo $(srcdir)/realloc.c; else echo realloc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+realloc2_.c: realloc2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/realloc2.c; then echo $(srcdir)/realloc2.c; else echo realloc2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+remove_.c: remove.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/remove.c; then echo $(srcdir)/remove.c; else echo remove.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+root_.c: root.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/root.c; then echo $(srcdir)/root.c; else echo root.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rootrem_.c: rootrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rootrem.c; then echo $(srcdir)/rootrem.c; else echo rootrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+rrandomb_.c: rrandomb.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/rrandomb.c; then echo $(srcdir)/rrandomb.c; else echo rrandomb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+scan0_.c: scan0.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan0.c; then echo $(srcdir)/scan0.c; else echo scan0.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+scan1_.c: scan1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scan1.c; then echo $(srcdir)/scan1.c; else echo scan1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_.c: set.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set.c; then echo $(srcdir)/set.c; else echo set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_d_.c: set_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_d.c; then echo $(srcdir)/set_d.c; else echo set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_f_.c: set_f.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_f.c; then echo $(srcdir)/set_f.c; else echo set_f.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_q_.c: set_q.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_q.c; then echo $(srcdir)/set_q.c; else echo set_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_si_.c: set_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_si.c; then echo $(srcdir)/set_si.c; else echo set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_str_.c: set_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_ui_.c: set_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_ui.c; then echo $(srcdir)/set_ui.c; else echo set_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+setbit_.c: setbit.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/setbit.c; then echo $(srcdir)/setbit.c; else echo setbit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+size_.c: size.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/size.c; then echo $(srcdir)/size.c; else echo size.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sizeinbase_.c: sizeinbase.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sizeinbase.c; then echo $(srcdir)/sizeinbase.c; else echo sizeinbase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqrt_.c: sqrt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrt.c; then echo $(srcdir)/sqrt.c; else echo sqrt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqrtrem_.c: sqrtrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqrtrem.c; then echo $(srcdir)/sqrtrem.c; else echo sqrtrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_.c: sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub.c; then echo $(srcdir)/sub.c; else echo sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sub_ui_.c: sub_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sub_ui.c; then echo $(srcdir)/sub_ui.c; else echo sub_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+swap_.c: swap.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/swap.c; then echo $(srcdir)/swap.c; else echo swap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_q_.c: tdiv_q.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_q.c; then echo $(srcdir)/tdiv_q.c; else echo tdiv_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_q_2exp_.c: tdiv_q_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_q_2exp.c; then echo $(srcdir)/tdiv_q_2exp.c; else echo tdiv_q_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_q_ui_.c: tdiv_q_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_q_ui.c; then echo $(srcdir)/tdiv_q_ui.c; else echo tdiv_q_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_qr_.c: tdiv_qr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_qr.c; then echo $(srcdir)/tdiv_qr.c; else echo tdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_qr_ui_.c: tdiv_qr_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_qr_ui.c; then echo $(srcdir)/tdiv_qr_ui.c; else echo tdiv_qr_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_r_.c: tdiv_r.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_r.c; then echo $(srcdir)/tdiv_r.c; else echo tdiv_r.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_r_2exp_.c: tdiv_r_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_r_2exp.c; then echo $(srcdir)/tdiv_r_2exp.c; else echo tdiv_r_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_r_ui_.c: tdiv_r_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_r_ui.c; then echo $(srcdir)/tdiv_r_ui.c; else echo tdiv_r_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_ui_.c: tdiv_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_ui.c; then echo $(srcdir)/tdiv_ui.c; else echo tdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tstbit_.c: tstbit.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tstbit.c; then echo $(srcdir)/tstbit.c; else echo tstbit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ui_pow_ui_.c: ui_pow_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_pow_ui.c; then echo $(srcdir)/ui_pow_ui.c; else echo ui_pow_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+ui_sub_.c: ui_sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/ui_sub.c; then echo $(srcdir)/ui_sub.c; else echo ui_sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+urandomb_.c: urandomb.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/urandomb.c; then echo $(srcdir)/urandomb.c; else echo urandomb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+urandomm_.c: urandomm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/urandomm.c; then echo $(srcdir)/urandomm.c; else echo urandomm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+xor_.c: xor.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/xor.c; then echo $(srcdir)/xor.c; else echo xor.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+abs_.$(OBJEXT) abs_.lo add_.$(OBJEXT) add_.lo add_ui_.$(OBJEXT) \
+add_ui_.lo and_.$(OBJEXT) and_.lo aorsmul_.$(OBJEXT) aorsmul_.lo \
+aorsmul_i_.$(OBJEXT) aorsmul_i_.lo array_init_.$(OBJEXT) \
+array_init_.lo bin_ui_.$(OBJEXT) bin_ui_.lo bin_uiui_.$(OBJEXT) \
+bin_uiui_.lo cdiv_q_.$(OBJEXT) cdiv_q_.lo cdiv_q_ui_.$(OBJEXT) \
+cdiv_q_ui_.lo cdiv_qr_.$(OBJEXT) cdiv_qr_.lo cdiv_qr_ui_.$(OBJEXT) \
+cdiv_qr_ui_.lo cdiv_r_.$(OBJEXT) cdiv_r_.lo cdiv_r_ui_.$(OBJEXT) \
+cdiv_r_ui_.lo cdiv_ui_.$(OBJEXT) cdiv_ui_.lo cfdiv_q_2exp_.$(OBJEXT) \
+cfdiv_q_2exp_.lo cfdiv_r_2exp_.$(OBJEXT) cfdiv_r_2exp_.lo \
+clear_.$(OBJEXT) clear_.lo clrbit_.$(OBJEXT) clrbit_.lo cmp_.$(OBJEXT) \
+cmp_.lo cmp_d_.$(OBJEXT) cmp_d_.lo cmp_si_.$(OBJEXT) cmp_si_.lo \
+cmp_ui_.$(OBJEXT) cmp_ui_.lo cmpabs_.$(OBJEXT) cmpabs_.lo \
+cmpabs_d_.$(OBJEXT) cmpabs_d_.lo cmpabs_ui_.$(OBJEXT) cmpabs_ui_.lo \
+com_.$(OBJEXT) com_.lo combit_.$(OBJEXT) combit_.lo cong_.$(OBJEXT) \
+cong_.lo cong_2exp_.$(OBJEXT) cong_2exp_.lo cong_ui_.$(OBJEXT) \
+cong_ui_.lo dive_ui_.$(OBJEXT) dive_ui_.lo divegcd_.$(OBJEXT) \
+divegcd_.lo divexact_.$(OBJEXT) divexact_.lo divis_.$(OBJEXT) \
+divis_.lo divis_2exp_.$(OBJEXT) divis_2exp_.lo divis_ui_.$(OBJEXT) \
+divis_ui_.lo dump_.$(OBJEXT) dump_.lo export_.$(OBJEXT) export_.lo \
+fac_ui_.$(OBJEXT) fac_ui_.lo fdiv_q_.$(OBJEXT) fdiv_q_.lo \
+fdiv_q_ui_.$(OBJEXT) fdiv_q_ui_.lo fdiv_qr_.$(OBJEXT) fdiv_qr_.lo \
+fdiv_qr_ui_.$(OBJEXT) fdiv_qr_ui_.lo fdiv_r_.$(OBJEXT) fdiv_r_.lo \
+fdiv_r_ui_.$(OBJEXT) fdiv_r_ui_.lo fdiv_ui_.$(OBJEXT) fdiv_ui_.lo \
+fib2_ui_.$(OBJEXT) fib2_ui_.lo fib_ui_.$(OBJEXT) fib_ui_.lo \
+fits_sint_.$(OBJEXT) fits_sint_.lo fits_slong_.$(OBJEXT) \
+fits_slong_.lo fits_sshort_.$(OBJEXT) fits_sshort_.lo \
+fits_uint_.$(OBJEXT) fits_uint_.lo fits_ulong_.$(OBJEXT) \
+fits_ulong_.lo fits_ushort_.$(OBJEXT) fits_ushort_.lo gcd_.$(OBJEXT) \
+gcd_.lo gcd_ui_.$(OBJEXT) gcd_ui_.lo gcdext_.$(OBJEXT) gcdext_.lo \
+get_d_.$(OBJEXT) get_d_.lo get_d_2exp_.$(OBJEXT) get_d_2exp_.lo \
+get_si_.$(OBJEXT) get_si_.lo get_str_.$(OBJEXT) get_str_.lo \
+get_ui_.$(OBJEXT) get_ui_.lo getlimbn_.$(OBJEXT) getlimbn_.lo \
+hamdist_.$(OBJEXT) hamdist_.lo import_.$(OBJEXT) import_.lo \
+init_.$(OBJEXT) init_.lo init2_.$(OBJEXT) init2_.lo inp_raw_.$(OBJEXT) \
+inp_raw_.lo inp_str_.$(OBJEXT) inp_str_.lo invert_.$(OBJEXT) \
+invert_.lo ior_.$(OBJEXT) ior_.lo iset_.$(OBJEXT) iset_.lo \
+iset_d_.$(OBJEXT) iset_d_.lo iset_si_.$(OBJEXT) iset_si_.lo \
+iset_str_.$(OBJEXT) iset_str_.lo iset_ui_.$(OBJEXT) iset_ui_.lo \
+jacobi_.$(OBJEXT) jacobi_.lo kronsz_.$(OBJEXT) kronsz_.lo \
+kronuz_.$(OBJEXT) kronuz_.lo kronzs_.$(OBJEXT) kronzs_.lo \
+kronzu_.$(OBJEXT) kronzu_.lo lcm_.$(OBJEXT) lcm_.lo lcm_ui_.$(OBJEXT) \
+lcm_ui_.lo lucnum2_ui_.$(OBJEXT) lucnum2_ui_.lo lucnum_ui_.$(OBJEXT) \
+lucnum_ui_.lo millerrabin_.$(OBJEXT) millerrabin_.lo mod_.$(OBJEXT) \
+mod_.lo mul_.$(OBJEXT) mul_.lo mul_2exp_.$(OBJEXT) mul_2exp_.lo \
+mul_si_.$(OBJEXT) mul_si_.lo mul_ui_.$(OBJEXT) mul_ui_.lo \
+n_pow_ui_.$(OBJEXT) n_pow_ui_.lo neg_.$(OBJEXT) neg_.lo \
+nextprime_.$(OBJEXT) nextprime_.lo out_raw_.$(OBJEXT) out_raw_.lo \
+out_str_.$(OBJEXT) out_str_.lo perfpow_.$(OBJEXT) perfpow_.lo \
+perfsqr_.$(OBJEXT) perfsqr_.lo popcount_.$(OBJEXT) popcount_.lo \
+pow_ui_.$(OBJEXT) pow_ui_.lo powm_.$(OBJEXT) powm_.lo \
+powm_ui_.$(OBJEXT) powm_ui_.lo pprime_p_.$(OBJEXT) pprime_p_.lo \
+random_.$(OBJEXT) random_.lo random2_.$(OBJEXT) random2_.lo \
+realloc_.$(OBJEXT) realloc_.lo realloc2_.$(OBJEXT) realloc2_.lo \
+remove_.$(OBJEXT) remove_.lo root_.$(OBJEXT) root_.lo \
+rootrem_.$(OBJEXT) rootrem_.lo rrandomb_.$(OBJEXT) rrandomb_.lo \
+scan0_.$(OBJEXT) scan0_.lo scan1_.$(OBJEXT) scan1_.lo set_.$(OBJEXT) \
+set_.lo set_d_.$(OBJEXT) set_d_.lo set_f_.$(OBJEXT) set_f_.lo \
+set_q_.$(OBJEXT) set_q_.lo set_si_.$(OBJEXT) set_si_.lo \
+set_str_.$(OBJEXT) set_str_.lo set_ui_.$(OBJEXT) set_ui_.lo \
+setbit_.$(OBJEXT) setbit_.lo size_.$(OBJEXT) size_.lo \
+sizeinbase_.$(OBJEXT) sizeinbase_.lo sqrt_.$(OBJEXT) sqrt_.lo \
+sqrtrem_.$(OBJEXT) sqrtrem_.lo sub_.$(OBJEXT) sub_.lo \
+sub_ui_.$(OBJEXT) sub_ui_.lo swap_.$(OBJEXT) swap_.lo \
+tdiv_q_.$(OBJEXT) tdiv_q_.lo tdiv_q_2exp_.$(OBJEXT) tdiv_q_2exp_.lo \
+tdiv_q_ui_.$(OBJEXT) tdiv_q_ui_.lo tdiv_qr_.$(OBJEXT) tdiv_qr_.lo \
+tdiv_qr_ui_.$(OBJEXT) tdiv_qr_ui_.lo tdiv_r_.$(OBJEXT) tdiv_r_.lo \
+tdiv_r_2exp_.$(OBJEXT) tdiv_r_2exp_.lo tdiv_r_ui_.$(OBJEXT) \
+tdiv_r_ui_.lo tdiv_ui_.$(OBJEXT) tdiv_ui_.lo tstbit_.$(OBJEXT) \
+tstbit_.lo ui_pow_ui_.$(OBJEXT) ui_pow_ui_.lo ui_sub_.$(OBJEXT) \
+ui_sub_.lo urandomb_.$(OBJEXT) urandomb_.lo urandomm_.$(OBJEXT) \
+urandomm_.lo xor_.$(OBJEXT) xor_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -408,85 +727,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -504,22 +820,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -532,7 +842,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -540,38 +850,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -580,7 +870,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -591,24 +881,26 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
+# These are BUILT_SOURCES at the top-level, so normally they're built before
+# recursing into this directory.
+#
+fac_ui.h:
+ cd ..; $(MAKE) $(AM_MAKEFLAGS) mpz/fac_ui.h
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/mpz/abs.c b/gmp/mpz/abs.c
index 81c6b63266..1ce4c81d2c 100644
--- a/gmp/mpz/abs.c
+++ b/gmp/mpz/abs.c
@@ -1,32 +1,21 @@
/* mpz_abs(dst, src) -- Assign the absolute value of SRC to DST.
-Copyright 1991, 1993-1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_abs 1
@@ -36,20 +25,21 @@ see https://www.gnu.org/licenses/. */
void
mpz_abs (mpz_ptr w, mpz_srcptr u)
{
- mp_ptr wp;
- mp_srcptr up;
+ mp_ptr wp, up;
mp_size_t size;
- size = ABSIZ (u);
+ size = ABS (u->_mp_size);
if (u != w)
{
- wp = MPZ_NEWALLOC (w, size);
+ if (w->_mp_alloc < size)
+ _mpz_realloc (w, size);
- up = PTR (u);
+ wp = w->_mp_d;
+ up = u->_mp_d;
MPN_COPY (wp, up, size);
}
- SIZ (w) = size;
+ w->_mp_size = size;
}
diff --git a/gmp/mpz/add.c b/gmp/mpz/add.c
index f1f0ae8e16..60cc416263 100644
--- a/gmp/mpz/add.c
+++ b/gmp/mpz/add.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_add
diff --git a/gmp/mpz/add_ui.c b/gmp/mpz/add_ui.c
index 8fd15ad611..cccb929046 100644
--- a/gmp/mpz/add_ui.c
+++ b/gmp/mpz/add_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_add_ui
diff --git a/gmp/mpz/and.c b/gmp/mpz/and.c
index 5aa01a71da..d6355e97d5 100644
--- a/gmp/mpz/and.c
+++ b/gmp/mpz/and.c
@@ -1,33 +1,22 @@
/* 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 Free Software
+Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -48,6 +37,7 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
op1_ptr = PTR(op1);
op2_ptr = PTR(op2);
+ res_ptr = PTR(res);
if (op1_size >= 0)
{
@@ -62,14 +52,18 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
/* Handle allocation, now then we know exactly how much space is
needed for the result. */
- res_ptr = MPZ_REALLOC (res, res_size);
- /* Don't re-read op1_ptr and op2_ptr. Since res_size <=
- MIN(op1_size, op2_size), res is not changed when op1
- is identical to res or op2 is identical to res. */
+ if (UNLIKELY (ALLOC(res) < res_size))
+ {
+ _mpz_realloc (res, res_size);
+ res_ptr = PTR(res);
+ /* Don't re-read op1_ptr and op2_ptr. Since res_size <=
+ MIN(op1_size, op2_size), we will not reach this code when op1
+ is identical to res or op2 is identical to res. */
+ }
SIZ(res) = res_size;
- if (LIKELY (res_size != 0))
- mpn_and_n (res_ptr, op1_ptr, op2_ptr, res_size);
+ if (LIKELY (res_size != 0))
+ mpn_and_n (res_ptr, op1_ptr, op2_ptr, res_size);
return;
}
else /* op2_size < 0 */
@@ -81,8 +75,9 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
if (op2_size < 0)
{
- mp_ptr opx, opy;
+ mp_ptr opx;
mp_limb_t cy;
+ mp_size_t res_alloc;
/* Both operands are negative, so will be the result.
-((-OP1) & (-OP2)) = -(~(OP1 - 1) & ~(OP2 - 1)) =
@@ -97,29 +92,48 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
op1_size = -op1_size;
op2_size = -op2_size;
- if (op1_size > op2_size)
- MPN_SRCPTR_SWAP (op1_ptr, op1_size, op2_ptr, op2_size);
+ res_alloc = 1 + MAX (op1_size, op2_size);
- TMP_ALLOC_LIMBS_2 (opx, op1_size, opy, op2_size);
+ opx = TMP_ALLOC_LIMBS (op1_size);
mpn_sub_1 (opx, op1_ptr, op1_size, (mp_limb_t) 1);
op1_ptr = opx;
- mpn_sub_1 (opy, op2_ptr, op2_size, (mp_limb_t) 1);
- op2_ptr = opy;
-
- res_ptr = MPZ_REALLOC (res, 1 + op2_size);
- /* Don't re-read OP1_PTR and OP2_PTR. They point to temporary
- space--never to the space PTR(res) used to point to before
- reallocation. */
-
- MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
- op2_size - op1_size);
- mpn_ior_n (res_ptr, op1_ptr, op2_ptr, op1_size);
- res_size = op2_size;
+ opx = TMP_ALLOC_LIMBS (op2_size);
+ mpn_sub_1 (opx, op2_ptr, op2_size, (mp_limb_t) 1);
+ op2_ptr = opx;
+
+ if (ALLOC(res) < res_alloc)
+ {
+ _mpz_realloc (res, res_alloc);
+ res_ptr = PTR(res);
+ /* Don't re-read OP1_PTR and OP2_PTR. They point to temporary
+ space--never to the space PTR(res) used to point to before
+ reallocation. */
+ }
+
+ if (op1_size >= op2_size)
+ {
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
+ op1_size - op2_size);
+ for (i = op2_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] | op2_ptr[i];
+ res_size = op1_size;
+ }
+ else
+ {
+ MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
+ op2_size - op1_size);
+ for (i = op1_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] | op2_ptr[i];
+ res_size = op2_size;
+ }
cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
- res_ptr[res_size] = cy;
- res_size += (cy != 0);
+ if (cy)
+ {
+ res_ptr[res_size] = cy;
+ res_size++;
+ }
SIZ(res) = -res_size;
TMP_FREE;
@@ -129,7 +143,8 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
/* We should compute -OP1 & OP2. Swap OP1 and OP2 and fall
through to the code that handles OP1 & -OP2. */
- MPN_SRCPTR_SWAP (op1_ptr, op1_size, op2_ptr, op2_size);
+ MPZ_SRCPTR_SWAP (op1, op2);
+ MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
}
}
@@ -206,13 +221,18 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
/* Handle allocation, now then we know exactly how much space is
needed for the result. */
- res_ptr = MPZ_REALLOC (res, res_size);
- /* Don't re-read OP1_PTR or OP2_PTR. Since res_size = op1_size,
- op1 is not changed if it is identical to res.
- OP2_PTR points to temporary space. */
+ if (ALLOC(res) < res_size)
+ {
+ _mpz_realloc (res, res_size);
+ res_ptr = PTR(res);
+ /* Don't re-read OP1_PTR or OP2_PTR. Since res_size = op1_size,
+ we will not reach this code when op1 is identical to res.
+ OP2_PTR points to temporary space. */
+ }
MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, res_size - op2_size);
- mpn_andn_n (res_ptr, op1_ptr, op2_ptr, op2_size);
+ for (i = op2_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] & ~op2_ptr[i];
SIZ(res) = res_size;
}
@@ -227,14 +247,18 @@ mpz_and (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
/* Handle allocation, now then we know exactly how much space is
needed for the result. */
- res_ptr = MPZ_REALLOC (res, res_size);
- /* Don't re-read OP1_PTR. Since res_size <= op1_size,
- op1 is not changed if it is identical to res.
- Don't re-read OP2_PTR. It points to temporary space--never
- to the space PTR(res) used to point to before reallocation. */
-
- if (LIKELY (res_size != 0))
- mpn_andn_n (res_ptr, op1_ptr, op2_ptr, res_size);
+ if (ALLOC(res) < res_size)
+ {
+ _mpz_realloc (res, res_size);
+ res_ptr = PTR(res);
+ /* Don't re-read OP1_PTR. Since res_size <= op1_size, we will
+ not reach this code when op1 is identical to res. */
+ /* Don't re-read OP2_PTR. It points to temporary space--never
+ to the space PTR(res) used to point to before reallocation. */
+ }
+
+ for (i = res_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] & ~op2_ptr[i];
SIZ(res) = res_size;
}
diff --git a/gmp/mpz/aors.h b/gmp/mpz/aors.h
index 4d22754b23..208c515201 100644
--- a/gmp/mpz/aors.h
+++ b/gmp/mpz/aors.h
@@ -1,38 +1,41 @@
/* mpz_add, mpz_sub -- add or subtract integers.
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2011, 2012 Free Software
-Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+#ifdef BERKELEY_MP
+
+#include "mp.h"
+#ifdef OPERATION_add
+#define FUNCTION madd
+#define VARIATION
+#endif
+#ifdef OPERATION_sub
+#define FUNCTION msub
+#define VARIATION -
+#endif
+#define ARGUMENTS mpz_srcptr u, mpz_srcptr v, mpz_ptr w
+
+#else /* normal GMP */
+
#ifdef OPERATION_add
#define FUNCTION mpz_add
#define VARIATION
@@ -41,6 +44,9 @@ see https://www.gnu.org/licenses/. */
#define FUNCTION mpz_sub
#define VARIATION -
#endif
+#define ARGUMENTS mpz_ptr w, mpz_srcptr u, mpz_srcptr v
+
+#endif
#ifndef FUNCTION
Error, need OPERATION_add or OPERATION_sub
@@ -48,7 +54,7 @@ Error, need OPERATION_add or OPERATION_sub
void
-FUNCTION (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
+FUNCTION (ARGUMENTS)
{
mp_srcptr up, vp;
mp_ptr wp;
@@ -56,8 +62,8 @@ FUNCTION (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
mp_size_t abs_usize;
mp_size_t abs_vsize;
- usize = SIZ(u);
- vsize = VARIATION SIZ(v);
+ usize = u->_mp_size;
+ vsize = VARIATION v->_mp_size;
abs_usize = ABS (usize);
abs_vsize = ABS (vsize);
@@ -73,11 +79,13 @@ FUNCTION (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
/* If not space for w (and possible carry), increase space. */
wsize = abs_usize + 1;
- wp = MPZ_REALLOC (w, wsize);
+ if (w->_mp_alloc < wsize)
+ _mpz_realloc (w, wsize);
/* These must be after realloc (u or v may be the same as w). */
- up = PTR(u);
- vp = PTR(v);
+ up = u->_mp_d;
+ vp = v->_mp_d;
+ wp = w->_mp_d;
if ((usize ^ vsize) < 0)
{
@@ -120,5 +128,5 @@ FUNCTION (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
wsize = -wsize;
}
- SIZ(w) = wsize;
+ w->_mp_size = wsize;
}
diff --git a/gmp/mpz/aors_ui.h b/gmp/mpz/aors_ui.h
index 2e3c481ab7..b438b32b7a 100644
--- a/gmp/mpz/aors_ui.h
+++ b/gmp/mpz/aors_ui.h
@@ -1,34 +1,23 @@
/* mpz_add_ui, mpz_sub_ui -- Add or subtract an mpz_t and an unsigned
one-word integer.
-Copyright 1991, 1993, 1994, 1996, 1999-2002, 2004, 2012, 2013 Free Software
+Copyright 1991, 1993, 1994, 1996, 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -77,21 +66,24 @@ 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;
- }
-
+ usize = u->_mp_size;
abs_usize = ABS (usize);
/* If not space for W (and possible carry), increase space. */
- wp = MPZ_REALLOC (w, abs_usize + 1);
+ wsize = abs_usize + 1;
+ if (w->_mp_alloc < wsize)
+ _mpz_realloc (w, wsize);
/* These must be after realloc (U may be the same as W). */
- up = PTR (u);
+ up = u->_mp_d;
+ wp = w->_mp_d;
+
+ if (abs_usize == 0)
+ {
+ wp[0] = vval;
+ w->_mp_size = VARIATION_NEG (vval != 0);
+ return;
+ }
if (usize VARIATION_CMP 0)
{
@@ -117,5 +109,5 @@ FUNCTION (mpz_ptr w, mpz_srcptr u, unsigned long int vval)
}
}
- SIZ (w) = wsize;
+ w->_mp_size = wsize;
}
diff --git a/gmp/mpz/aorsmul.c b/gmp/mpz/aorsmul.c
index bf012c965c..8b145b309f 100644
--- a/gmp/mpz/aorsmul.c
+++ b/gmp/mpz/aorsmul.c
@@ -1,32 +1,21 @@
/* mpz_addmul, mpz_submul -- add or subtract multiple.
-Copyright 2001, 2004, 2005, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -45,7 +34,7 @@ see https://www.gnu.org/licenses/. */
The sign of w is retained for the result, unless the absolute value
submul underflows, in which case it flips. */
-static void __gmpz_aorsmul (REGPARM_3_1 (mpz_ptr w, mpz_srcptr x, mpz_srcptr y, mp_size_t sub)) REGPARM_ATTR (1);
+static void __gmpz_aorsmul __GMP_PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr x, mpz_srcptr y, mp_size_t sub))) REGPARM_ATTR (1);
#define mpz_aorsmul(w,x,y,sub) __gmpz_aorsmul (REGPARM_3_1 (w, x, y, sub))
REGPARM_ATTR (1) static void
@@ -87,12 +76,13 @@ mpz_aorsmul (mpz_ptr w, mpz_srcptr x, mpz_srcptr y, mp_size_t sub)
wsize = ABS(wsize_signed);
tsize = xsize + ysize;
- wp = MPZ_REALLOC (w, MAX (wsize, tsize) + 1);
+ MPZ_REALLOC (w, MAX (wsize, tsize) + 1);
+ wp = PTR(w);
if (wsize_signed == 0)
{
/* Nothing to add to, just set w=x*y. No w==x or w==y overlap here,
- since we know x,y!=0 but w==0. */
+ since we know x,y!=0 but w==0. */
high = mpn_mul (wp, PTR(x),xsize, PTR(y),ysize);
tsize -= (high == 0);
SIZ(w) = (sub >= 0 ? tsize : -tsize);
@@ -111,14 +101,14 @@ mpz_aorsmul (mpz_ptr w, mpz_srcptr x, mpz_srcptr y, mp_size_t sub)
mp_size_t usize = wsize;
if (usize < tsize)
- {
- up = tp;
- usize = tsize;
- tp = wp;
- tsize = wsize;
+ {
+ up = tp;
+ usize = tsize;
+ tp = wp;
+ tsize = wsize;
- wsize = usize;
- }
+ wsize = usize;
+ }
c = mpn_add (wp, up,usize, tp,tsize);
wp[wsize] = c;
@@ -130,15 +120,15 @@ mpz_aorsmul (mpz_ptr w, mpz_srcptr x, mpz_srcptr y, mp_size_t sub)
mp_size_t usize = wsize;
if (mpn_cmp_twosizes_lt (up,usize, tp,tsize))
- {
- up = tp;
- usize = tsize;
- tp = wp;
- tsize = wsize;
-
- wsize = usize;
- wsize_signed = -wsize_signed;
- }
+ {
+ up = tp;
+ usize = tsize;
+ tp = wp;
+ tsize = wsize;
+
+ wsize = usize;
+ wsize_signed = -wsize_signed;
+ }
ASSERT_NOCARRY (mpn_sub (wp, up,usize, tp,tsize));
wsize = usize;
diff --git a/gmp/mpz/aorsmul_i.c b/gmp/mpz/aorsmul_i.c
index eafd5f36de..c23495c405 100644
--- a/gmp/mpz/aorsmul_i.c
+++ b/gmp/mpz/aorsmul_i.c
@@ -4,33 +4,22 @@
ALMOST CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR
COMPLETELY IN FUTURE GNU MP RELEASES.
-Copyright 2001, 2002, 2004, 2005, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -58,13 +47,13 @@ see https://www.gnu.org/licenses/. */
The final w will retain its sign, unless an underflow occurs in a submul
of absolute values, in which case it's flipped.
- If x has more limbs than w, then mpn_submul_1 followed by mpn_com is
+ If x has more limbs than w, then mpn_submul_1 followed by mpn_com_n is
used. The alternative would be mpn_mul_1 into temporary space followed
by mpn_sub_n. Avoiding temporary space seem good, and submul+com stands
a chance of being faster since it involves only one set of carry
propagations, not two. Note that doing an addmul_1 with a
twos-complement negative y doesn't work, because it effectively adds an
- extra x * 2^GMP_LIMB_BITS. */
+ extra x * 2^BITS_PER_MP_LIMB. */
REGPARM_ATTR(1) void
mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub)
@@ -86,7 +75,8 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub)
if (wsize_signed == 0)
{
/* nothing to add to, just set x*y, "sub" gives the sign */
- wp = MPZ_REALLOC (w, xsize+1);
+ MPZ_REALLOC (w, xsize+1);
+ wp = PTR (w);
cy = mpn_mul_1 (wp, PTR(x), xsize, y);
wp[xsize] = cy;
xsize += (cy != 0);
@@ -98,7 +88,8 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub)
wsize = ABS (wsize_signed);
new_wsize = MAX (wsize, xsize);
- wp = MPZ_REALLOC (w, new_wsize+1);
+ MPZ_REALLOC (w, new_wsize+1);
+ wp = PTR (w);
xp = PTR (x);
min_size = MIN (wsize, xsize);
@@ -113,25 +104,25 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub)
dsize = xsize - wsize;
#if HAVE_NATIVE_mpn_mul_1c
if (dsize > 0)
- cy = mpn_mul_1c (wp, xp, dsize, y, cy);
+ cy = mpn_mul_1c (wp, xp, dsize, y, cy);
else if (dsize < 0)
- {
- dsize = -dsize;
- cy = mpn_add_1 (wp, wp, dsize, cy);
- }
+ {
+ dsize = -dsize;
+ cy = mpn_add_1 (wp, wp, dsize, cy);
+ }
#else
if (dsize != 0)
- {
- mp_limb_t cy2;
- if (dsize > 0)
- cy2 = mpn_mul_1 (wp, xp, dsize, y);
- else
- {
- dsize = -dsize;
- cy2 = 0;
- }
- cy = cy2 + mpn_add_1 (wp, wp, dsize, cy);
- }
+ {
+ mp_limb_t cy2;
+ if (dsize > 0)
+ cy2 = mpn_mul_1 (wp, xp, dsize, y);
+ else
+ {
+ dsize = -dsize;
+ cy2 = 0;
+ }
+ cy = cy2 + mpn_add_1 (wp, wp, dsize, cy);
+ }
#endif
wp[dsize] = cy;
@@ -143,52 +134,52 @@ mpz_aorsmul_1 (mpz_ptr w, mpz_srcptr x, mp_limb_t y, mp_size_t sub)
cy = mpn_submul_1 (wp, xp, min_size, y);
if (wsize >= xsize)
- {
- /* if w bigger than x, then propagate borrow through it */
- if (wsize != xsize)
- cy = mpn_sub_1 (wp+xsize, wp+xsize, wsize-xsize, cy);
-
- if (cy != 0)
- {
- /* Borrow out of w, take twos complement negative to get
- absolute value, flip sign of w. */
- wp[new_wsize] = ~-cy; /* extra limb is 0-cy */
- mpn_com (wp, wp, new_wsize);
- new_wsize++;
- MPN_INCR_U (wp, new_wsize, CNST_LIMB(1));
- wsize_signed = -wsize_signed;
- }
- }
+ {
+ /* if w bigger than x, then propagate borrow through it */
+ if (wsize != xsize)
+ cy = mpn_sub_1 (wp+xsize, wp+xsize, wsize-xsize, cy);
+
+ if (cy != 0)
+ {
+ /* Borrow out of w, take twos complement negative to get
+ absolute value, flip sign of w. */
+ wp[new_wsize] = ~-cy; /* extra limb is 0-cy */
+ mpn_com_n (wp, wp, new_wsize);
+ new_wsize++;
+ MPN_INCR_U (wp, new_wsize, CNST_LIMB(1));
+ wsize_signed = -wsize_signed;
+ }
+ }
else /* wsize < xsize */
- {
- /* x bigger than w, so want x*y-w. Submul has given w-x*y, so
- take twos complement and use an mpn_mul_1 for the rest. */
+ {
+ /* x bigger than w, so want x*y-w. Submul has given w-x*y, so
+ take twos complement and use an mpn_mul_1 for the rest. */
- mp_limb_t cy2;
+ mp_limb_t cy2;
- /* -(-cy*b^n + w-x*y) = (cy-1)*b^n + ~(w-x*y) + 1 */
- mpn_com (wp, wp, wsize);
- cy += mpn_add_1 (wp, wp, wsize, CNST_LIMB(1));
- cy -= 1;
+ /* -(-cy*b^n + w-x*y) = (cy-1)*b^n + ~(w-x*y) + 1 */
+ mpn_com_n (wp, wp, wsize);
+ cy += mpn_add_1 (wp, wp, wsize, CNST_LIMB(1));
+ cy -= 1;
- /* If cy-1 == -1 then hold that -1 for latter. mpn_submul_1 never
- returns cy==MP_LIMB_T_MAX so that value always indicates a -1. */
- cy2 = (cy == MP_LIMB_T_MAX);
- cy += cy2;
- MPN_MUL_1C (cy, wp+wsize, xp+wsize, xsize-wsize, y, cy);
- wp[new_wsize] = cy;
- new_wsize += (cy != 0);
+ /* If cy-1 == -1 then hold that -1 for latter. mpn_submul_1 never
+ returns cy==MP_LIMB_T_MAX so that value always indicates a -1. */
+ cy2 = (cy == MP_LIMB_T_MAX);
+ cy += cy2;
+ MPN_MUL_1C (cy, wp+wsize, xp+wsize, xsize-wsize, y, cy);
+ wp[new_wsize] = cy;
+ new_wsize += (cy != 0);
- /* Apply any -1 from above. The value at wp+wsize is non-zero
- because y!=0 and the high limb of x will be non-zero. */
- if (cy2)
- MPN_DECR_U (wp+wsize, new_wsize-wsize, CNST_LIMB(1));
+ /* Apply any -1 from above. The value at wp+wsize is non-zero
+ because y!=0 and the high limb of x will be non-zero. */
+ if (cy2)
+ MPN_DECR_U (wp+wsize, new_wsize-wsize, CNST_LIMB(1));
- wsize_signed = -wsize_signed;
- }
+ wsize_signed = -wsize_signed;
+ }
/* submul can produce high zero limbs due to cancellation, both when w
- has more limbs or x has more */
+ has more limbs or x has more */
MPN_NORMALIZE (wp, new_wsize);
}
diff --git a/gmp/mpz/array_init.c b/gmp/mpz/array_init.c
index b967ddbeef..0e2f9aaa53 100644
--- a/gmp/mpz/array_init.c
+++ b/gmp/mpz/array_init.c
@@ -1,32 +1,22 @@
/* mpz_array_init (array, array_size, size_per_elem) --
-Copyright 1991, 1993-1995, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -34,17 +24,17 @@ see https://www.gnu.org/licenses/. */
void
mpz_array_init (mpz_ptr arr, mp_size_t arr_size, mp_size_t nbits)
{
- mp_ptr p;
- mp_size_t i;
+ register mp_ptr p;
+ register mp_size_t i;
mp_size_t nlimbs;
- nlimbs = nbits / GMP_NUMB_BITS + 1;
- p = (mp_ptr) (*__gmp_allocate_func) ((size_t) arr_size * nlimbs * GMP_LIMB_BYTES);
+ nlimbs = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
+ p = (mp_ptr) (*__gmp_allocate_func) (arr_size * nlimbs * BYTES_PER_MP_LIMB);
for (i = 0; i < arr_size; i++)
{
- ALLOC (&arr[i]) = nlimbs + 1; /* Yes, lie a little... */
- SIZ (&arr[i]) = 0;
- PTR (&arr[i]) = p + i * nlimbs;
+ arr[i]._mp_alloc = nlimbs + 1; /* Yes, lie a little... */
+ arr[i]._mp_size = 0;
+ arr[i]._mp_d = p + i * nlimbs;
}
}
diff --git a/gmp/mpz/bin_ui.c b/gmp/mpz/bin_ui.c
index c24b21724c..c97ed7cff0 100644
--- a/gmp/mpz/bin_ui.c
+++ b/gmp/mpz/bin_ui.c
@@ -1,32 +1,21 @@
/* mpz_bin_ui - compute n over k.
-Copyright 1998-2002, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -57,23 +46,23 @@ mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
mp_limb_t kacc;
mp_size_t negate;
- if (SIZ (n) < 0)
+ if (mpz_sgn (n) < 0)
{
/* bin(n,k) = (-1)^k * bin(-n+k-1,k), and set ni = -n+k-1 - k = -n-1 */
mpz_init (ni);
- mpz_add_ui (ni, n, 1L);
- mpz_neg (ni, ni);
+ mpz_neg (ni, n);
+ mpz_sub_ui (ni, ni, 1L);
negate = (k & 1); /* (-1)^k */
}
else
{
/* bin(n,k) == 0 if k>n
- (no test for this under the n<0 case, since -n+k-1 >= k there) */
+ (no test for this under the n<0 case, since -n+k-1 >= k there) */
if (mpz_cmp_ui (n, k) < 0)
- {
- SIZ (r) = 0;
- return;
- }
+ {
+ mpz_set_ui (r, 0L);
+ return;
+ }
/* set ni = n-k */
mpz_init (ni);
@@ -83,7 +72,7 @@ mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
/* Now wanting bin(ni+k,k), with ni positive, and "negate" is the sign (0
for positive, 1 for negative). */
- SIZ (r) = 1; PTR (r)[0] = 1;
+ mpz_set_ui (r, 1L);
/* Rewrite bin(n,k) as bin(n,n-k) if that is smaller. In this case it's
whether ni+k-k < k meaning ni<k, and if so change to denominator ni+k-k
@@ -119,18 +108,19 @@ mpz_bin_ui (mpz_ptr r, mpz_srcptr n, unsigned long int k)
mpz_add_ui (ni, ni, 1L);
mpz_mul (nacc, nacc, ni);
umul_ppmm (k1, k0, kacc, i << GMP_NAIL_BITS);
+ k0 >>= GMP_NAIL_BITS;
if (k1 != 0)
{
/* Accumulator overflow. Perform bignum step. */
mpz_mul (r, r, nacc);
- SIZ (nacc) = 1; PTR (nacc)[0] = 1;
- DIVIDE ();
+ mpz_set_ui (nacc, 1L);
+ DIVIDE ();
kacc = i;
}
else
{
/* Save new products in accumulators to keep accumulating. */
- kacc = k0 >> GMP_NAIL_BITS;
+ kacc = k0;
}
}
diff --git a/gmp/mpz/bin_uiui.c b/gmp/mpz/bin_uiui.c
index 94a9dc5c75..29bbd60363 100644
--- a/gmp/mpz/bin_uiui.c
+++ b/gmp/mpz/bin_uiui.c
@@ -1,696 +1,123 @@
/* mpz_bin_uiui - compute n over k.
-Contributed to the GNU project by Torbjorn Granlund and Marco Bodrato.
-
-Copyright 2010-2012 Free Software Foundation, Inc.
+Copyright 1998, 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-#ifndef BIN_GOETGHELUCK_THRESHOLD
-#define BIN_GOETGHELUCK_THRESHOLD 1000
-#endif
-#ifndef BIN_UIUI_ENABLE_SMALLDC
-#define BIN_UIUI_ENABLE_SMALLDC 1
-#endif
-#ifndef BIN_UIUI_RECURSIVE_SMALLDC
-#define BIN_UIUI_RECURSIVE_SMALLDC (GMP_NUMB_BITS > 32)
-#endif
-
-/* Algorithm:
-
- Accumulate chunks of factors first limb-by-limb (using one of mul0-mul8)
- which are then accumulated into mpn numbers. The first inner loop
- accumulates divisor factors, the 2nd inner loop accumulates exactly the same
- number of dividend factors. We avoid accumulating more for the divisor,
- even with its smaller factors, since we else cannot guarantee divisibility.
-
- Since we know each division will yield an integer, we compute the quotient
- using Hensel norm: If the quotient is limited by 2^t, we compute A / B mod
- 2^t.
-
- Improvements:
-
- (1) An obvious improvement to this code would be to compute mod 2^t
- everywhere. Unfortunately, we cannot determine t beforehand, unless we
- invoke some approximation, such as Stirling's formula. Of course, we don't
- need t to be tight. However, it is not clear that this would help much,
- our numbers are kept reasonably small already.
-
- (2) Compute nmax/kmax semi-accurately, without scalar division or a loop.
- Extracting the 3 msb, then doing a table lookup using cnt*8+msb as index,
- would make it both reasonably accurate and fast. (We could use a table
- stored into a limb, perhaps.) The table should take the removed factors of
- 2 into account (those done on-the-fly in mulN).
-
- (3) The first time in the loop we compute the odd part of a
- factorial in kp, we might use oddfac_1 for this task.
- */
-
-/* This threshold determines how large divisor to accumulate before we call
- bdiv. Perhaps we should never call bdiv, and accumulate all we are told,
- since we are just basecase code anyway? Presumably, this depends on the
- relative speed of the asymptotically fast code and this code. */
-#define SOME_THRESHOLD 20
-
-/* Multiply-into-limb functions. These remove factors of 2 on-the-fly. FIXME:
- All versions of MAXFACS don't take this 2 removal into account now, meaning
- that then, shifting just adds some overhead. (We remove factors from the
- completed limb anyway.) */
-
-static mp_limb_t
-mul1 (mp_limb_t m)
-{
- return m;
-}
-
-static mp_limb_t
-mul2 (mp_limb_t m)
-{
- /* We need to shift before multiplying, to avoid an overflow. */
- mp_limb_t m01 = (m | 1) * ((m + 1) >> 1);
- return m01;
-}
-
-static mp_limb_t
-mul3 (mp_limb_t m)
-{
- mp_limb_t m01 = (m + 0) * (m + 1) >> 1;
- mp_limb_t m2 = (m + 2);
- return m01 * m2;
-}
-
-static mp_limb_t
-mul4 (mp_limb_t m)
-{
- mp_limb_t m01 = (m + 0) * (m + 1) >> 1;
- mp_limb_t m23 = (m + 2) * (m + 3) >> 1;
- return m01 * m23;
-}
-
-static mp_limb_t
-mul5 (mp_limb_t m)
-{
- mp_limb_t m012 = (m + 0) * (m + 1) * (m + 2) >> 1;
- mp_limb_t m34 = (m + 3) * (m + 4) >> 1;
- return m012 * m34;
-}
-static mp_limb_t
-mul6 (mp_limb_t m)
-{
- mp_limb_t m01 = (m + 0) * (m + 1);
- mp_limb_t m23 = (m + 2) * (m + 3);
- mp_limb_t m45 = (m + 4) * (m + 5) >> 1;
- mp_limb_t m0123 = m01 * m23 >> 3;
- return m0123 * m45;
-}
+/* Enhancement: It ought to be possible to calculate the size of the final
+ result in advance, to a rough approximation at least, and use it to do
+ just one realloc. Stirling's approximation n! ~= sqrt(2*pi*n)*(n/e)^n
+ (Knuth section 1.2.5) might be of use. */
+
+/* "inc" in the main loop allocates a chunk more space if not already
+ enough, so as to avoid repeated reallocs. The final step on the other
+ hand requires only one more limb. */
+#define MULDIV(inc) \
+ do { \
+ ASSERT (rsize <= ralloc); \
+ \
+ if (rsize == ralloc) \
+ { \
+ mp_size_t new_ralloc = ralloc + (inc); \
+ rp = __GMP_REALLOCATE_FUNC_LIMBS (rp, ralloc, new_ralloc); \
+ ralloc = new_ralloc; \
+ } \
+ \
+ rp[rsize] = mpn_mul_1 (rp, rp, rsize, nacc); \
+ MPN_DIVREM_OR_DIVEXACT_1 (rp, rp, rsize+1, kacc); \
+ rsize += (rp[rsize] != 0); \
+ \
+} while (0)
-static mp_limb_t
-mul7 (mp_limb_t m)
-{
- mp_limb_t m01 = (m + 0) * (m + 1);
- mp_limb_t m23 = (m + 2) * (m + 3);
- mp_limb_t m456 = (m + 4) * (m + 5) * (m + 6) >> 1;
- mp_limb_t m0123 = m01 * m23 >> 3;
- return m0123 * m456;
-}
-
-static mp_limb_t
-mul8 (mp_limb_t m)
-{
- mp_limb_t m01 = (m + 0) * (m + 1);
- mp_limb_t m23 = (m + 2) * (m + 3);
- mp_limb_t m45 = (m + 4) * (m + 5);
- mp_limb_t m67 = (m + 6) * (m + 7);
- mp_limb_t m0123 = m01 * m23 >> 3;
- mp_limb_t m4567 = m45 * m67 >> 3;
- return m0123 * m4567;
-}
-
-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 function. */
-static const unsigned char tcnttab[] = {0, 1, 1, 2, 2, 4, 4, 6};
-
-#if 1
-/* This variant is inaccurate but share the code with other functions. */
-#define MAXFACS(max,l) \
- do { \
- (max) = log_n_max (l); \
- } while (0)
-#else
-
-/* This variant is exact(?) but uses a loop. It takes the 2 removal
- of mulN into account. */
-static const unsigned long ftab[] =
-#if GMP_NUMB_BITS == 64
- /* 1 to 8 factors per iteration */
- {CNST_LIMB(0xffffffffffffffff),CNST_LIMB(0x100000000),0x32cbfe,0x16a0b,0x24c4,0xa16,0x34b,0x1b2 /*,0xdf,0x8d */};
-#endif
-#if GMP_NUMB_BITS == 32
- /* 1 to 7 factors per iteration */
- {0xffffffff,0x10000,0x801,0x16b,0x71,0x42,0x26 /* ,0x1e */};
-#endif
-
-#define MAXFACS(max,l) \
- do { \
- int __i; \
- for (__i = numberof (ftab) - 1; l > ftab[__i]; __i--) \
- ; \
- (max) = __i + 1; \
- } while (0)
-#endif
-
-/* Entry i contains (i!/2^t)^(-1) where t is chosen such that the parenthesis
- is an odd integer. */
-static const mp_limb_t facinv[] = { ONE_LIMB_ODD_FACTORIAL_INVERSES_TABLE };
-
-static void
-mpz_bdiv_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
+void
+mpz_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
{
- int nmax, kmax, nmaxnow, numfac;
- mp_ptr np, kp;
- mp_size_t nn, kn, alloc;
- mp_limb_t i, j, t, iii, jjj, cy, dinv;
- mp_bitcnt_t i2cnt, j2cnt;
- int cnt;
- mp_size_t maxn;
- TMP_DECL;
-
- ASSERT (k > ODD_FACTORIAL_TABLE_LIMIT);
- TMP_MARK;
-
- maxn = 1 + n / GMP_NUMB_BITS; /* absolutely largest result size (limbs) */
-
- /* FIXME: This allocation might be insufficient, but is usually way too
- large. */
- alloc = SOME_THRESHOLD - 1 + MAX (3 * maxn / 2, SOME_THRESHOLD);
- alloc = MIN (alloc, k) + 1;
- np = TMP_ALLOC_LIMBS (alloc);
- kp = TMP_ALLOC_LIMBS (SOME_THRESHOLD + 1);
-
- MAXFACS (nmax, n);
- ASSERT (nmax <= M);
- MAXFACS (kmax, k);
- ASSERT (kmax <= M);
- ASSERT (k >= M);
-
- i = n - k + 1;
-
- np[0] = 1; nn = 1;
-
- i2cnt = 0; /* total low zeros in dividend */
- j2cnt = __gmp_fac2cnt_table[ODD_FACTORIAL_TABLE_LIMIT / 2 - 1];
- /* total low zeros in divisor */
-
- numfac = 1;
- j = ODD_FACTORIAL_TABLE_LIMIT + 1;
- jjj = ODD_FACTORIAL_TABLE_MAX;
- ASSERT (__gmp_oddfac_table[ODD_FACTORIAL_TABLE_LIMIT] == ODD_FACTORIAL_TABLE_MAX);
-
- while (1)
+ unsigned long int i, j;
+ mp_limb_t nacc, kacc;
+ unsigned long int cnt;
+ mp_size_t rsize, ralloc;
+ mp_ptr rp;
+
+ /* bin(n,k) = 0 if k>n. */
+ if (n < k)
{
- kp[0] = jjj; /* store new factors */
- kn = 1;
- t = k - j + 1;
- kmax = MIN (kmax, t);
-
- while (kmax != 0 && kn < SOME_THRESHOLD)
- {
- jjj = mulfunc[kmax - 1] (j);
- j += kmax; /* number of factors used */
- count_trailing_zeros (cnt, jjj); /* count low zeros */
- jjj >>= cnt; /* remove remaining low zeros */
- j2cnt += tcnttab[kmax - 1] + cnt; /* update low zeros count */
- cy = mpn_mul_1 (kp, kp, kn, jjj); /* accumulate new factors */
- kp[kn] = cy;
- kn += cy != 0;
- t = k - j + 1;
- kmax = MIN (kmax, t);
- }
- numfac = j - numfac;
-
- while (numfac != 0)
- {
- nmaxnow = MIN (nmax, numfac);
- iii = mulfunc[nmaxnow - 1] (i);
- i += nmaxnow; /* number of factors used */
- count_trailing_zeros (cnt, iii); /* count low zeros */
- iii >>= cnt; /* remove remaining low zeros */
- i2cnt += tcnttab[nmaxnow - 1] + cnt; /* update low zeros count */
- cy = mpn_mul_1 (np, np, nn, iii); /* accumulate new factors */
- np[nn] = cy;
- nn += cy != 0;
- numfac -= nmaxnow;
- }
-
- ASSERT (nn < alloc);
-
- binvert_limb (dinv, kp[0]);
- nn += (np[nn - 1] >= kp[kn - 1]);
- nn -= kn;
- mpn_sbpi1_bdiv_q (np, np, nn, kp, MIN(kn,nn), -dinv);
-
- if (kmax == 0)
- break;
- numfac = j;
-
- jjj = mulfunc[kmax - 1] (j);
- j += kmax; /* number of factors used */
- count_trailing_zeros (cnt, jjj); /* count low zeros */
- jjj >>= cnt; /* remove remaining low zeros */
- j2cnt += tcnttab[kmax - 1] + cnt; /* update low zeros count */
+ SIZ(r) = 0;
+ return;
}
- /* Put back the right number of factors of 2. */
- cnt = i2cnt - j2cnt;
- if (cnt != 0)
- {
- ASSERT (cnt < GMP_NUMB_BITS); /* can happen, but not for intended use */
- cy = mpn_lshift (np, np, nn, cnt);
- np[nn] = cy;
- nn += cy != 0;
- }
+ rp = PTR(r);
- nn -= np[nn - 1] == 0; /* normalisation */
+ /* Rewrite bin(n,k) as bin(n,n-k) if that is smaller. */
+ k = MIN (k, n-k);
- kp = MPZ_NEWALLOC (r, nn);
- SIZ(r) = nn;
- MPN_COPY (kp, np, nn);
- TMP_FREE;
-}
-
-static void
-mpz_smallk_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
-{
- int nmax, numfac;
- mp_ptr rp;
- mp_size_t rn, alloc;
- mp_limb_t i, iii, cy;
- mp_bitcnt_t i2cnt, cnt;
-
- count_leading_zeros (cnt, (mp_limb_t) n);
- cnt = GMP_LIMB_BITS - cnt;
- alloc = cnt * k / GMP_NUMB_BITS + 3; /* FIXME: ensure rounding is enough. */
- rp = MPZ_NEWALLOC (r, alloc);
-
- MAXFACS (nmax, n);
- nmax = MIN (nmax, M);
-
- i = n - k + 1;
-
- nmax = MIN (nmax, k);
- rp[0] = mulfunc[nmax - 1] (i);
- rn = 1;
- i += nmax; /* number of factors used */
- i2cnt = tcnttab[nmax - 1]; /* low zeros count */
- numfac = k - nmax;
- while (numfac != 0)
+ /* bin(n,0) = 1 */
+ if (k == 0)
{
- nmax = MIN (nmax, numfac);
- iii = mulfunc[nmax - 1] (i);
- i += nmax; /* number of factors used */
- i2cnt += tcnttab[nmax - 1]; /* update low zeros count */
- cy = mpn_mul_1 (rp, rp, rn, iii); /* accumulate new factors */
- rp[rn] = cy;
- rn += cy != 0;
- numfac -= nmax;
+ SIZ(r) = 1;
+ rp[0] = 1;
+ return;
}
- ASSERT (rn < alloc);
+ j = n - k + 1;
+ rp[0] = j;
+ rsize = 1;
+ ralloc = ALLOC(r);
- mpn_pi1_bdiv_q_1 (rp, rp, rn, __gmp_oddfac_table[k], facinv[k - 2],
- __gmp_fac2cnt_table[k / 2 - 1] - i2cnt);
- /* A two-fold, branch-free normalisation is possible :*/
- /* rn -= rp[rn - 1] == 0; */
- /* rn -= rp[rn - 1] == 0; */
- MPN_NORMALIZE_NOT_ZERO (rp, rn);
+ /* Initialize accumulators. */
+ nacc = 1;
+ kacc = 1;
- SIZ(r) = rn;
-}
-
-/* Algorithm:
-
- Plain and simply multiply things together.
-
- We tabulate factorials (k!/2^t)^(-1) mod B (where t is chosen such
- that k!/2^t is odd).
-
-*/
-
-static mp_limb_t
-bc_bin_uiui (unsigned int n, unsigned int k)
-{
- return ((__gmp_oddfac_table[n] * facinv[k - 2] * facinv[n - k - 2])
- << (__gmp_fac2cnt_table[n / 2 - 1] - __gmp_fac2cnt_table[k / 2 - 1] - __gmp_fac2cnt_table[(n-k) / 2 - 1]))
- & GMP_NUMB_MASK;
-}
-
-/* Algorithm:
-
- Recursively exploit the relation
- bin(n,k) = bin(n,k>>1)*bin(n-k>>1,k-k>>1)/bin(k,k>>1) .
-
- Values for binomial(k,k>>1) that fit in a limb are precomputed
- (with inverses).
-*/
-
-/* bin2kk[i - ODD_CENTRAL_BINOMIAL_OFFSET] =
- binomial(i*2,i)/2^t (where t is chosen so that it is odd). */
-static const mp_limb_t bin2kk[] = { ONE_LIMB_ODD_CENTRAL_BINOMIAL_TABLE };
-
-/* bin2kkinv[i] = bin2kk[i]^-1 mod B */
-static const mp_limb_t bin2kkinv[] = { ONE_LIMB_ODD_CENTRAL_BINOMIAL_INVERSE_TABLE };
-
-/* bin2kk[i] = binomial((i+MIN_S)*2,i+MIN_S)/2^t. This table contains the t values. */
-static const unsigned char fac2bin[] = { CENTRAL_BINOMIAL_2FAC_TABLE };
-
-static void
-mpz_smallkdc_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
-{
- mp_ptr rp;
- mp_size_t rn;
- unsigned long int hk;
-
- hk = k >> 1;
-
- if ((! BIN_UIUI_RECURSIVE_SMALLDC) || hk <= ODD_FACTORIAL_TABLE_LIMIT)
- mpz_smallk_bin_uiui (r, n, hk);
- else
- mpz_smallkdc_bin_uiui (r, n, hk);
- k -= hk;
- n -= hk;
- if (n <= ODD_FACTORIAL_EXTTABLE_LIMIT) {
- mp_limb_t cy;
- rn = SIZ (r);
- rp = MPZ_REALLOC (r, rn + 1);
- cy = mpn_mul_1 (rp, rp, rn, bc_bin_uiui (n, k));
- rp [rn] = cy;
- rn += cy != 0;
- } else {
- mp_limb_t buffer[ODD_CENTRAL_BINOMIAL_TABLE_LIMIT + 3];
- mpz_t t;
-
- ALLOC (t) = ODD_CENTRAL_BINOMIAL_TABLE_LIMIT + 3;
- PTR (t) = buffer;
- if ((! BIN_UIUI_RECURSIVE_SMALLDC) || k <= ODD_FACTORIAL_TABLE_LIMIT)
- mpz_smallk_bin_uiui (t, n, k);
- else
- mpz_smallkdc_bin_uiui (t, n, k);
- mpz_mul (r, r, t);
- rp = PTR (r);
- rn = SIZ (r);
- }
-
- mpn_pi1_bdiv_q_1 (rp, rp, rn, bin2kk[k - ODD_CENTRAL_BINOMIAL_OFFSET],
- bin2kkinv[k - ODD_CENTRAL_BINOMIAL_OFFSET],
- fac2bin[k - ODD_CENTRAL_BINOMIAL_OFFSET] - (k != hk));
- /* A two-fold, branch-free normalisation is possible :*/
- /* rn -= rp[rn - 1] == 0; */
- /* rn -= rp[rn - 1] == 0; */
- MPN_NORMALIZE_NOT_ZERO (rp, rn);
-
- SIZ(r) = rn;
-}
-
-/* mpz_goetgheluck_bin_uiui(RESULT, N, K) -- Set RESULT to binomial(N,K).
- *
- * Contributed to the GNU project by Marco Bodrato.
- *
- * Implementation of the algorithm by P. Goetgheluck, "Computing
- * Binomial Coefficients", The American Mathematical Monthly, Vol. 94,
- * No. 4 (April 1987), pp. 360-365.
- *
- * Acknowledgment: Peter Luschny did spot the slowness of the previous
- * code and suggested the reference.
- */
-
-/* TODO: Remove duplicated constants / macros / static functions...
- */
-
-/*************************************************************/
-/* Section macros: common macros, for swing/fac/bin (&sieve) */
-/*************************************************************/
-
-#define FACTOR_LIST_APPEND(PR, MAX_PR, VEC, I) \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = 1; \
- }
-
-#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
- do { \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = (P); \
- } else \
- (PR) *= (P); \
- } while (0)
-
-#define LOOP_ON_SIEVE_CONTINUE(prime,end,sieve) \
- __max_i = (end); \
- \
- do { \
- ++__i; \
- if (((sieve)[__index] & __mask) == 0) \
- { \
- (prime) = id_to_n(__i)
-
-#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
- do { \
- mp_limb_t __mask, __index, __max_i, __i; \
- \
- __i = (start)-(off); \
- __index = __i / GMP_LIMB_BITS; \
- __mask = CNST_LIMB(1) << (__i % GMP_LIMB_BITS); \
- __i += (off); \
- \
- LOOP_ON_SIEVE_CONTINUE(prime,end,sieve)
-
-#define LOOP_ON_SIEVE_STOP \
- } \
- __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
- __index += __mask & 1; \
- } while (__i <= __max_i) \
-
-#define LOOP_ON_SIEVE_END \
- LOOP_ON_SIEVE_STOP; \
- } while (0)
-
-/*********************************************************/
-/* Section sieve: sieving functions and tools for primes */
-/*********************************************************/
-
-#if WANT_ASSERT
-static mp_limb_t
-bit_to_n (mp_limb_t bit) { return (bit*3+4)|1; }
-#endif
-
-/* id_to_n (x) = bit_to_n (x-1) = (id*3+1)|1*/
-static mp_limb_t
-id_to_n (mp_limb_t id) { return id*3+1+(id&1); }
-
-/* n_to_bit (n) = ((n-1)&(-CNST_LIMB(2)))/3U-1 */
-static mp_limb_t
-n_to_bit (mp_limb_t n) { return ((n-5)|1)/3U; }
-
-static mp_size_t
-primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
-
-/*********************************************************/
-/* Section binomial: fast binomial implementation */
-/*********************************************************/
-
-#define COUNT_A_PRIME(P, N, K, PR, MAX_PR, VEC, I) \
- do { \
- mp_limb_t __a, __b, __prime, __ma,__mb; \
- __prime = (P); \
- __a = (N); __b = (K); __mb = 0; \
- FACTOR_LIST_APPEND(PR, MAX_PR, VEC, I); \
- do { \
- __mb += __b % __prime; __b /= __prime; \
- __ma = __a % __prime; __a /= __prime; \
- if (__ma < __mb) { \
- __mb = 1; (PR) *= __prime; \
- } else __mb = 0; \
- } while (__a >= __prime); \
- } while (0)
-
-#define SH_COUNT_A_PRIME(P, N, K, PR, MAX_PR, VEC, I) \
- do { \
- mp_limb_t __prime; \
- __prime = (P); \
- if (((N) % __prime) < ((K) % __prime)) { \
- FACTOR_LIST_STORE (__prime, PR, MAX_PR, VEC, I); \
- } \
- } while (0)
-
-/* Returns an approximation of the sqare root of x. *
- * It gives: x <= limb_apprsqrt (x) ^ 2 < x * 9/4 */
-static mp_limb_t
-limb_apprsqrt (mp_limb_t x)
-{
- int s;
-
- ASSERT (x > 2);
- count_leading_zeros (s, x - 1);
- s = GMP_LIMB_BITS - 1 - s;
- return (CNST_LIMB(1) << (s >> 1)) + (CNST_LIMB(1) << ((s - 1) >> 1));
-}
-
-static void
-mpz_goetgheluck_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
-{
- mp_limb_t *sieve, *factors, count;
- mp_limb_t prod, max_prod, j;
- TMP_DECL;
-
- ASSERT (BIN_GOETGHELUCK_THRESHOLD >= 13);
- ASSERT (n >= 25);
-
- TMP_MARK;
- sieve = TMP_ALLOC_LIMBS (primesieve_size (n));
-
- count = gmp_primesieve (sieve, n) + 1;
- factors = TMP_ALLOC_LIMBS (count / log_n_max (n) + 1);
-
- max_prod = GMP_NUMB_MAX / n;
-
- /* Handle primes = 2, 3 separately. */
- popc_limb (count, n - k);
- popc_limb (j, k);
- count += j;
- popc_limb (j, n);
- count -= j;
- prod = CNST_LIMB(1) << count;
-
- j = 0;
- COUNT_A_PRIME (3, n, k, prod, max_prod, factors, j);
-
- /* Accumulate prime factors from 5 to n/2 */
+ for (i = 2; i <= k; i++)
{
- mp_limb_t s;
-
- {
- mp_limb_t prime;
- s = limb_apprsqrt(n);
- s = n_to_bit (s);
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (5), s, 0,sieve);
- COUNT_A_PRIME (prime, n, k, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- s++;
- }
-
- ASSERT (max_prod <= GMP_NUMB_MAX / 2);
- max_prod <<= 1;
- ASSERT (bit_to_n (s) * bit_to_n (s) > n);
- ASSERT (s <= n_to_bit (n >> 1));
- {
- mp_limb_t prime;
-
- LOOP_ON_SIEVE_BEGIN (prime, s, n_to_bit (n >> 1), 0,sieve);
- SH_COUNT_A_PRIME (prime, n, k, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
- max_prod >>= 1;
+ mp_limb_t n1, n0;
+
+ /* Remove common 2 factors. */
+ cnt = ((nacc | kacc) & 1) ^ 1;
+ nacc >>= cnt;
+ kacc >>= cnt;
+
+ j++;
+ /* Accumulate next multiples. */
+ umul_ppmm (n1, n0, nacc, (mp_limb_t) j << GMP_NAIL_BITS);
+ n0 >>= GMP_NAIL_BITS;
+ if (n1 == 0)
+ {
+ /* Save new products in accumulators to keep accumulating. */
+ nacc = n0;
+ kacc = kacc * i;
+ }
+ else
+ {
+ /* Accumulator overflow. Perform bignum step. */
+ MULDIV (32);
+ nacc = j;
+ kacc = i;
+ }
}
- /* Store primes from (n-k)+1 to n */
- ASSERT (n_to_bit (n - k) < n_to_bit (n));
- {
- mp_limb_t prime;
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (n - k) + 1, n_to_bit (n), 0,sieve);
- FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
-
- if (LIKELY (j != 0))
- {
- factors[j++] = prod;
- mpz_prodlimbs (r, factors, j);
- }
- else
- {
- PTR (r)[0] = prod;
- SIZ (r) = 1;
- }
- TMP_FREE;
-}
+ /* Take care of whatever is left in accumulators. */
+ MULDIV (1);
-#undef COUNT_A_PRIME
-#undef SH_COUNT_A_PRIME
-#undef LOOP_ON_SIEVE_END
-#undef LOOP_ON_SIEVE_STOP
-#undef LOOP_ON_SIEVE_BEGIN
-#undef LOOP_ON_SIEVE_CONTINUE
-
-/*********************************************************/
-/* End of implementation of Goetgheluck's algorithm */
-/*********************************************************/
-
-void
-mpz_bin_uiui (mpz_ptr r, unsigned long int n, unsigned long int k)
-{
- if (UNLIKELY (n < k)) {
- SIZ (r) = 0;
-#if BITS_PER_ULONG > GMP_NUMB_BITS
- } else if (UNLIKELY (n > GMP_NUMB_MAX)) {
- mpz_t tmp;
-
- mpz_init_set_ui (tmp, n);
- mpz_bin_ui (r, tmp, k);
- mpz_clear (tmp);
-#endif
- } else {
- ASSERT (n <= GMP_NUMB_MAX);
- /* Rewrite bin(n,k) as bin(n,n-k) if that is smaller. */
- k = MIN (k, n - k);
- if (k < 2) {
- PTR(r)[0] = k ? n : 1; /* 1 + ((-k) & (n-1)); */
- SIZ(r) = 1;
- } else if (n <= ODD_FACTORIAL_EXTTABLE_LIMIT) { /* k >= 2, n >= 4 */
- PTR(r)[0] = bc_bin_uiui (n, k);
- SIZ(r) = 1;
- } else if (k <= ODD_FACTORIAL_TABLE_LIMIT)
- mpz_smallk_bin_uiui (r, n, k);
- else if (BIN_UIUI_ENABLE_SMALLDC &&
- k <= (BIN_UIUI_RECURSIVE_SMALLDC ? ODD_CENTRAL_BINOMIAL_TABLE_LIMIT : ODD_FACTORIAL_TABLE_LIMIT)* 2)
- mpz_smallkdc_bin_uiui (r, n, k);
- else if (ABOVE_THRESHOLD (k, BIN_GOETGHELUCK_THRESHOLD) &&
- k > (n >> 4)) /* k > ODD_FACTORIAL_TABLE_LIMIT */
- mpz_goetgheluck_bin_uiui (r, n, k);
- else
- mpz_bdiv_bin_uiui (r, n, k);
- }
+ ALLOC(r) = ralloc;
+ SIZ(r) = rsize;
+ PTR(r) = rp;
}
diff --git a/gmp/mpz/cdiv_q.c b/gmp/mpz/cdiv_q.c
index 32e3200a8d..2e663637ec 100644
--- a/gmp/mpz/cdiv_q.c
+++ b/gmp/mpz/cdiv_q.c
@@ -1,33 +1,22 @@
/* mpz_cdiv_q -- Division rounding the quotient towards +infinity. The
remainder gets the opposite sign as the denominator.
-Copyright 1994-1996, 2000, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,8 +24,8 @@ see https://www.gnu.org/licenses/. */
void
mpz_cdiv_q (mpz_ptr quot, mpz_srcptr dividend, mpz_srcptr divisor)
{
- mp_size_t dividend_size = SIZ (dividend);
- mp_size_t divisor_size = SIZ (divisor);
+ mp_size_t dividend_size = dividend->_mp_size;
+ mp_size_t divisor_size = divisor->_mp_size;
mpz_t rem;
TMP_DECL;
@@ -46,7 +35,7 @@ mpz_cdiv_q (mpz_ptr quot, mpz_srcptr dividend, mpz_srcptr divisor)
mpz_tdiv_qr (quot, rem, dividend, divisor);
- if ((divisor_size ^ dividend_size) >= 0 && SIZ (rem) != 0)
+ if ((divisor_size ^ dividend_size) >= 0 && rem->_mp_size != 0)
mpz_add_ui (quot, quot, 1L);
TMP_FREE;
diff --git a/gmp/mpz/cdiv_q_ui.c b/gmp/mpz/cdiv_q_ui.c
index 63608c9043..b757ea5fa2 100644
--- a/gmp/mpz/cdiv_q_ui.c
+++ b/gmp/mpz/cdiv_q_ui.c
@@ -3,34 +3,22 @@
always fit into the return type, the negative of the true remainder is
returned.
-Copyright 1994, 1996, 1999, 2001, 2002, 2004, 2012 Free Software Foundation,
-Inc.
+Copyright 1994, 1996, 1999, 2001, 2002, 2004 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -42,7 +30,7 @@ mpz_cdiv_q_ui (mpz_ptr quot, mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np, qp;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -53,7 +41,8 @@ mpz_cdiv_q_ui (mpz_ptr quot, mpz_srcptr dividend, unsigned long int divisor)
}
nn = ABS(ns);
- qp = MPZ_REALLOC (quot, nn);
+ MPZ_REALLOC (quot, nn);
+ qp = PTR(quot);
np = PTR(dividend);
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
diff --git a/gmp/mpz/cdiv_qr.c b/gmp/mpz/cdiv_qr.c
index 45e9a2774c..197ae505e8 100644
--- a/gmp/mpz/cdiv_qr.c
+++ b/gmp/mpz/cdiv_qr.c
@@ -1,33 +1,22 @@
/* mpz_cdiv_qr -- Division rounding the quotient towards +infinity. The
remainder gets the opposite sign as the denominator.
-Copyright 1994-1996, 2000, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,7 +24,7 @@ see https://www.gnu.org/licenses/. */
void
mpz_cdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
{
- mp_size_t divisor_size = SIZ (divisor);
+ mp_size_t divisor_size = divisor->_mp_size;
mp_size_t xsize;
mpz_t temp_divisor; /* N.B.: lives until function returns! */
TMP_DECL;
@@ -52,10 +41,10 @@ mpz_cdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
divisor = temp_divisor;
}
- xsize = SIZ (dividend) ^ divisor_size;;
+ xsize = dividend->_mp_size ^ divisor_size;;
mpz_tdiv_qr (quot, rem, dividend, divisor);
- if (xsize >= 0 && SIZ (rem) != 0)
+ if (xsize >= 0 && rem->_mp_size != 0)
{
mpz_add_ui (quot, quot, 1L);
mpz_sub (rem, rem, divisor);
diff --git a/gmp/mpz/cdiv_qr_ui.c b/gmp/mpz/cdiv_qr_ui.c
index 1ccfbbe7fd..67e80b7ac7 100644
--- a/gmp/mpz/cdiv_qr_ui.c
+++ b/gmp/mpz/cdiv_qr_ui.c
@@ -3,34 +3,23 @@
always fit into the return type, the negative of the true remainder is
returned.
-Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 Free Software Foundation,
+Copyright 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -42,7 +31,7 @@ mpz_cdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
mp_ptr np, qp;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -54,7 +43,8 @@ mpz_cdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
}
nn = ABS(ns);
- qp = MPZ_REALLOC (quot, nn);
+ MPZ_REALLOC (quot, nn);
+ qp = PTR(quot);
np = PTR(dividend);
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
@@ -64,7 +54,8 @@ mpz_cdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
mp_ptr rp;
mp_size_t rn;
- rp = MPZ_REALLOC (rem, 2);
+ MPZ_REALLOC (rem, 2);
+ rp = PTR(rem);
if (nn == 1) /* tdiv_qr requirements; tested above for 0 */
{
diff --git a/gmp/mpz/cdiv_r.c b/gmp/mpz/cdiv_r.c
index 9cebab3e06..749276fbdb 100644
--- a/gmp/mpz/cdiv_r.c
+++ b/gmp/mpz/cdiv_r.c
@@ -1,33 +1,22 @@
/* mpz_cdiv_r -- Division rounding the quotient towards +infinity. The
remainder gets the opposite sign as the denominator.
-Copyright 1994-1996, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,7 +24,7 @@ see https://www.gnu.org/licenses/. */
void
mpz_cdiv_r (mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
{
- mp_size_t divisor_size = SIZ (divisor);
+ mp_size_t divisor_size = divisor->_mp_size;
mpz_t temp_divisor; /* N.B.: lives until function returns! */
TMP_DECL;
@@ -54,7 +43,7 @@ mpz_cdiv_r (mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
mpz_tdiv_r (rem, dividend, divisor);
- if ((divisor_size ^ SIZ (dividend)) >= 0 && SIZ (rem) != 0)
+ if ((divisor_size ^ dividend->_mp_size) >= 0 && rem->_mp_size != 0)
mpz_sub (rem, rem, divisor);
TMP_FREE;
diff --git a/gmp/mpz/cdiv_r_ui.c b/gmp/mpz/cdiv_r_ui.c
index 68fb149c46..e889d742a2 100644
--- a/gmp/mpz/cdiv_r_ui.c
+++ b/gmp/mpz/cdiv_r_ui.c
@@ -3,34 +3,23 @@
always fit into the return type, the negative of the true remainder is
returned.
-Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 Free Software Foundation,
+Copyright 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -42,7 +31,7 @@ mpz_cdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -62,7 +51,8 @@ mpz_cdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
mp_size_t rn;
TMP_DECL;
- rp = MPZ_REALLOC (rem, 2);
+ MPZ_REALLOC (rem, 2);
+ rp = PTR(rem);
if (nn == 1) /* tdiv_qr requirements; tested above for 0 */
{
diff --git a/gmp/mpz/cdiv_ui.c b/gmp/mpz/cdiv_ui.c
index 1f7f6e3c1b..7b99bee9a9 100644
--- a/gmp/mpz/cdiv_ui.c
+++ b/gmp/mpz/cdiv_ui.c
@@ -3,34 +3,23 @@
always fit into the return type, the negative of the true remainder is
returned.
-Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 Free Software Foundation,
+Copyright 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -42,7 +31,7 @@ mpz_cdiv_ui (mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
diff --git a/gmp/mpz/cfdiv_q_2exp.c b/gmp/mpz/cfdiv_q_2exp.c
index c69e37c605..a54ce2d33f 100644
--- a/gmp/mpz/cfdiv_q_2exp.c
+++ b/gmp/mpz/cfdiv_q_2exp.c
@@ -1,33 +1,22 @@
/* mpz_cdiv_q_2exp, mpz_fdiv_q_2exp -- quotient from mpz divided by 2^n.
-Copyright 1991, 1993, 1994, 1996, 1998, 1999, 2001, 2002, 2004, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,11 +24,11 @@ see https://www.gnu.org/licenses/. */
/* dir==1 for ceil, dir==-1 for floor */
-static void __gmpz_cfdiv_q_2exp (REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_bitcnt_t, int)) REGPARM_ATTR (1);
+static void __gmpz_cfdiv_q_2exp __GMP_PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir))) REGPARM_ATTR (1);
#define cfdiv_q_2exp(w,u,cnt,dir) __gmpz_cfdiv_q_2exp (REGPARM_3_1 (w,u,cnt,dir))
REGPARM_ATTR (1) static void
-cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
+cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir)
{
mp_size_t wsize, usize, abs_usize, limb_cnt, i;
mp_srcptr up;
@@ -84,7 +73,7 @@ cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
{
if (wsize != 0)
{
- mp_limb_t cy;
+ mp_limb_t cy;
cy = mpn_add_1 (wp, wp, wsize, CNST_LIMB(1));
wp[wsize] = cy;
wsize += cy;
@@ -101,13 +90,13 @@ cfdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
void
-mpz_cdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt)
+mpz_cdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt)
{
cfdiv_q_2exp (w, u, cnt, 1);
}
void
-mpz_fdiv_q_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt)
+mpz_fdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt)
{
cfdiv_q_2exp (w, u, cnt, -1);
}
diff --git a/gmp/mpz/cfdiv_r_2exp.c b/gmp/mpz/cfdiv_r_2exp.c
index 5466691f29..005779f15c 100644
--- a/gmp/mpz/cfdiv_r_2exp.c
+++ b/gmp/mpz/cfdiv_r_2exp.c
@@ -1,32 +1,21 @@
/* mpz_cdiv_r_2exp, mpz_fdiv_r_2exp -- remainder from mpz divided by 2^n.
-Copyright 2001, 2002, 2004, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,11 +27,11 @@ see https://www.gnu.org/licenses/. */
/* dir==1 for ceil, dir==-1 for floor */
-static void __gmpz_cfdiv_r_2exp (REGPARM_3_1 (mpz_ptr, mpz_srcptr, mp_bitcnt_t, int)) REGPARM_ATTR (1);
+static void __gmpz_cfdiv_r_2exp __GMP_PROTO ((REGPARM_3_1 (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir))) REGPARM_ATTR (1);
#define cfdiv_r_2exp(w,u,cnt,dir) __gmpz_cfdiv_r_2exp (REGPARM_3_1 (w, u, cnt, dir))
REGPARM_ATTR (1) static void
-cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
+cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt, int dir)
{
mp_size_t usize, abs_usize, limb_cnt, i;
mp_srcptr up;
@@ -69,25 +58,26 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
/* Round towards zero, means just truncate */
if (w == u)
- {
- /* if already smaller than limb_cnt then do nothing */
- if (abs_usize <= limb_cnt)
- return;
- wp = PTR(w);
- }
+ {
+ /* if already smaller than limb_cnt then do nothing */
+ if (abs_usize <= limb_cnt)
+ return;
+ wp = PTR(w);
+ }
else
- {
- i = MIN (abs_usize, limb_cnt+1);
- wp = MPZ_REALLOC (w, i);
- MPN_COPY (wp, up, i);
-
- /* if smaller than limb_cnt then only the copy is needed */
- if (abs_usize <= limb_cnt)
- {
- SIZ(w) = usize;
- return;
- }
- }
+ {
+ i = MIN (abs_usize, limb_cnt+1);
+ MPZ_REALLOC (w, i);
+ wp = PTR(w);
+ MPN_COPY (wp, up, i);
+
+ /* if smaller than limb_cnt then only the copy is needed */
+ if (abs_usize <= limb_cnt)
+ {
+ SIZ(w) = usize;
+ return;
+ }
+ }
}
else
{
@@ -95,16 +85,16 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
/* if u!=0 and smaller than divisor, then must negate */
if (abs_usize <= limb_cnt)
- goto negate;
+ goto negate;
/* if non-zero low limb, then must negate */
for (i = 0; i < limb_cnt; i++)
- if (up[i] != 0)
- goto negate;
+ if (up[i] != 0)
+ goto negate;
/* if non-zero partial limb, then must negate */
if ((up[limb_cnt] & LOW_MASK (cnt)) != 0)
- goto negate;
+ goto negate;
/* otherwise low bits of u are zero, so that's the result */
SIZ(w) = 0;
@@ -113,17 +103,18 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
negate:
/* twos complement negation to get 2**cnt-u */
- wp = MPZ_REALLOC (w, limb_cnt+1);
+ MPZ_REALLOC (w, limb_cnt+1);
up = PTR(u);
+ wp = PTR(w);
/* Ones complement */
i = MIN (abs_usize, limb_cnt+1);
- mpn_com (wp, up, i);
+ mpn_com_n (wp, up, i);
for ( ; i <= limb_cnt; i++)
- wp[i] = GMP_NUMB_MAX;
+ wp[i] = GMP_NUMB_MAX;
/* Twos complement. Since u!=0 in the relevant part, the twos
- complement never gives 0 and a carry, so can use MPN_INCR_U. */
+ complement never gives 0 and a carry, so can use MPN_INCR_U. */
MPN_INCR_U (wp, limb_cnt+1, CNST_LIMB(1));
usize = -usize;
@@ -139,10 +130,10 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
{
limb_cnt--;
if (limb_cnt < 0)
- {
- SIZ(w) = 0;
- return;
- }
+ {
+ SIZ(w) = 0;
+ return;
+ }
high = wp[limb_cnt];
}
@@ -152,13 +143,13 @@ cfdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt, int dir)
void
-mpz_cdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt)
+mpz_cdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt)
{
cfdiv_r_2exp (w, u, cnt, 1);
}
void
-mpz_fdiv_r_2exp (mpz_ptr w, mpz_srcptr u, mp_bitcnt_t cnt)
+mpz_fdiv_r_2exp (mpz_ptr w, mpz_srcptr u, unsigned long cnt)
{
cfdiv_r_2exp (w, u, cnt, -1);
}
diff --git a/gmp/mpz/clear.c b/gmp/mpz/clear.c
index 30f626c505..0902256c03 100644
--- a/gmp/mpz/clear.c
+++ b/gmp/mpz/clear.c
@@ -1,34 +1,22 @@
/* mpz_clear -- de-allocate the space occupied by the dynamic digit space of
an integer.
-Copyright 1991, 1993-1995, 2000, 2001, 2012, 2014 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -36,5 +24,5 @@ see https://www.gnu.org/licenses/. */
void
mpz_clear (mpz_ptr m)
{
- (*__gmp_free_func) (PTR (m), (size_t) ALLOC (m) * GMP_LIMB_BYTES);
+ (*__gmp_free_func) (m->_mp_d, m->_mp_alloc * BYTES_PER_MP_LIMB);
}
diff --git a/gmp/mpz/clears.c b/gmp/mpz/clears.c
deleted file mode 100644
index 193c5ade77..0000000000
--- a/gmp/mpz/clears.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* mpz_clears() -- Clear multiple mpz_t variables.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 <stdarg.h>
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-mpz_clears (mpz_ptr x, ...)
-{
- va_list ap;
-
- va_start (ap, x);
-
- while (x != NULL)
- {
- (*__gmp_free_func) (PTR (x), (size_t) ALLOC (x) * GMP_LIMB_BYTES);
- x = va_arg (ap, mpz_ptr);
- }
- va_end (ap);
-}
diff --git a/gmp/mpz/clrbit.c b/gmp/mpz/clrbit.c
index 2475efe1e5..d169ac4dae 100644
--- a/gmp/mpz/clrbit.c
+++ b/gmp/mpz/clrbit.c
@@ -1,66 +1,58 @@
/* mpz_clrbit -- clear a specified bit.
-Copyright 1991, 1993-1995, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_clrbit (mpz_ptr d, mp_bitcnt_t bit_idx)
+mpz_clrbit (mpz_ptr d, unsigned long int bit_index)
{
- mp_size_t dsize = SIZ (d);
- mp_ptr dp = PTR (d);
- mp_size_t limb_idx;
- mp_limb_t mask;
+ mp_size_t dsize = d->_mp_size;
+ mp_ptr dp = d->_mp_d;
+ mp_size_t limb_index;
- limb_idx = bit_idx / GMP_NUMB_BITS;
- mask = CNST_LIMB(1) << (bit_idx % GMP_NUMB_BITS);
+ limb_index = bit_index / GMP_NUMB_BITS;
if (dsize >= 0)
{
- if (limb_idx < dsize)
+ if (limb_index < dsize)
{
- mp_limb_t dlimb;
- dlimb = dp[limb_idx] & ~mask;
- dp[limb_idx] = dlimb;
-
- if (UNLIKELY ((dlimb == 0) + limb_idx == dsize)) /* dsize == limb_idx + 1 */
- {
- /* high limb became zero, must normalize */
- MPN_NORMALIZE (dp, limb_idx);
- SIZ (d) = limb_idx;
- }
+ mp_limb_t dlimb;
+ dlimb = dp[limb_index];
+ dlimb &= ~((mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS));
+ dp[limb_index] = dlimb;
+
+ if (UNLIKELY (dlimb == 0 && limb_index == dsize-1))
+ {
+ /* high limb became zero, must normalize */
+ do {
+ dsize--;
+ } while (dsize > 0 && dp[dsize-1] == 0);
+ d->_mp_size = dsize;
+ }
}
else
;
}
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.
@@ -68,49 +60,54 @@ mpz_clrbit (mpz_ptr d, mp_bitcnt_t bit_idx)
dsize = -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++;
+ /* No upper bound on this loop, we're sure there's a non-zero limb
+ sooner ot later. */
+ for (zero_bound = 0; ; zero_bound++)
+ if (dp[zero_bound] != 0)
+ break;
- if (limb_idx > zero_bound)
+ if (limb_index > zero_bound)
+ {
+ if (limb_index < dsize)
+ dp[limb_index] |= (mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS);
+ else
{
- dp[limb_idx] |= mask;
+ /* Ugh. The bit should be cleared outside of the end of the
+ number. We have to increase the size of the number. */
+ if (UNLIKELY (d->_mp_alloc < limb_index + 1))
+ dp = _mpz_realloc (d, limb_index + 1);
+
+ MPN_ZERO (dp + dsize, limb_index - dsize);
+ dp[limb_index] = (mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS);
+ d->_mp_size = -(limb_index + 1);
}
- else if (limb_idx == zero_bound)
+ }
+ else if (limb_index == zero_bound)
+ {
+ dp[limb_index] = ((((dp[limb_index] - 1)
+ | ((mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS))) + 1)
+ & GMP_NUMB_MASK);
+ if (dp[limb_index] == 0)
{
- mp_limb_t dlimb;
- dlimb = (((dp[limb_idx] - 1) | mask) + 1) & GMP_NUMB_MASK;
- dp[limb_idx] = dlimb;
-
- if (dlimb == 0)
+ mp_size_t i;
+ for (i = limb_index + 1; i < dsize; i++)
{
- /* 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;
+ dp[i] = (dp[i] + 1) & GMP_NUMB_MASK;
+ if (dp[i] != 0)
+ goto fin;
}
+ /* We got carry all way out beyond the end of D. Increase
+ its size (and allocation if necessary). */
+ dsize++;
+ if (UNLIKELY (d->_mp_alloc < dsize))
+ dp = _mpz_realloc (d, dsize);
+
+ dp[i] = 1;
+ d->_mp_size = -dsize;
+ fin:;
}
- 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;
- }
+ ;
}
}
diff --git a/gmp/mpz/cmp.c b/gmp/mpz/cmp.c
index b8a5eaa765..20056c682a 100644
--- a/gmp/mpz/cmp.c
+++ b/gmp/mpz/cmp.c
@@ -1,40 +1,35 @@
/* 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 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
+#ifdef BERKELEY_MP
+#include "mp.h"
+#endif
#include "gmp.h"
#include "gmp-impl.h"
int
-mpz_cmp (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
+#ifdef BERKELEY_MP
+mcmp (mpz_srcptr u, mpz_srcptr v)
+#else
+mpz_cmp (mpz_srcptr u, mpz_srcptr v)
+#endif
{
mp_size_t usize, vsize, dsize, asize;
mp_srcptr up, vp;
diff --git a/gmp/mpz/cmp_d.c b/gmp/mpz/cmp_d.c
index 45926d6d54..fd635a68e1 100644
--- a/gmp/mpz/cmp_d.c
+++ b/gmp/mpz/cmp_d.c
@@ -1,32 +1,21 @@
/* mpz_cmp_d -- compare absolute values of mpz and double.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
@@ -82,13 +71,13 @@ mpz_cmp_d (mpz_srcptr z, double d)
if (zsize >= 0)
{
if (d < 0.0)
- return 1; /* >=0 cmp <0 */
+ return 1; /* >=0 cmp <0 */
ret = 1;
}
else
{
if (d >= 0.0)
- return -1; /* <0 cmp >=0 */
+ return -1; /* <0 cmp >=0 */
ret = -1;
d = -d;
zsize = -zsize;
diff --git a/gmp/mpz/cmp_si.c b/gmp/mpz/cmp_si.c
index 86251f436a..f53932e139 100644
--- a/gmp/mpz/cmp_si.c
+++ b/gmp/mpz/cmp_si.c
@@ -1,40 +1,34 @@
/* 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-1996, 2000-2002, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-_mpz_cmp_si (mpz_srcptr u, signed long int v_digit) __GMP_NOTHROW
+_mpz_cmp_si (mpz_srcptr u, signed long int v_digit)
{
+ mp_size_t usize = u->_mp_size;
+ mp_size_t vsize;
+ mp_limb_t u_digit;
+
#if GMP_NAIL_BITS != 0
/* FIXME. This isn't very pretty. */
mpz_t tmp;
@@ -43,28 +37,30 @@ _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);
-#else
-
- mp_size_t vsize, usize;
+#endif
- usize = SIZ (u);
- vsize = (v_digit > 0) - (v_digit < 0);
+ vsize = 0;
+ if (v_digit > 0)
+ vsize = 1;
+ else if (v_digit < 0)
+ {
+ vsize = -1;
+ v_digit = -v_digit;
+ }
- if ((usize == 0) | (usize != vsize))
+ if (usize != vsize)
return usize - vsize;
- else {
- mp_limb_t u_digit, absv_digit;
- u_digit = PTR (u)[0];
- absv_digit = ABS_CAST (unsigned long, v_digit);
+ if (usize == 0)
+ return 0;
- if (u_digit == absv_digit)
- return 0;
+ u_digit = u->_mp_d[0];
- if (u_digit > absv_digit)
- return usize;
- else
- return -usize;
- }
-#endif
+ if (u_digit == (mp_limb_t) (unsigned long) v_digit)
+ return 0;
+
+ if (u_digit > (mp_limb_t) (unsigned long) v_digit)
+ return usize;
+ else
+ return -usize;
}
diff --git a/gmp/mpz/cmp_ui.c b/gmp/mpz/cmp_ui.c
index 790d8241d6..e5702c159c 100644
--- a/gmp/mpz/cmp_ui.c
+++ b/gmp/mpz/cmp_ui.c
@@ -1,39 +1,29 @@
/* 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-1996, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-_mpz_cmp_ui (mpz_srcptr u, unsigned long int v_digit) __GMP_NOTHROW
+_mpz_cmp_ui (mpz_srcptr u, unsigned long int v_digit)
{
mp_ptr up;
mp_size_t un;
diff --git a/gmp/mpz/cmpabs.c b/gmp/mpz/cmpabs.c
index 5685776abe..ec3e98e5b3 100644
--- a/gmp/mpz/cmpabs.c
+++ b/gmp/mpz/cmpabs.c
@@ -1,41 +1,30 @@
/* 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-2002 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpz_cmpabs (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
+mpz_cmpabs (mpz_srcptr u, mpz_srcptr v)
{
mp_size_t usize, vsize, dsize;
mp_srcptr up, vp;
diff --git a/gmp/mpz/cmpabs_d.c b/gmp/mpz/cmpabs_d.c
index a4b95d26aa..f7aadc2620 100644
--- a/gmp/mpz/cmpabs_d.c
+++ b/gmp/mpz/cmpabs_d.c
@@ -1,32 +1,21 @@
/* mpz_cmpabs_d -- compare absolute values of mpz and double.
-Copyright 2001-2003, 2012 Free Software Foundation, Inc.
+Copyright 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
@@ -73,7 +62,7 @@ mpz_cmpabs_d (mpz_srcptr z, double d)
if (d == 0.0)
return (zsize != 0);
if (zsize == 0)
- return -1; /* d != 0 */
+ return (d != 0 ? -1 : 0);
/* 2. Ignore signs. */
zsize = ABS(zsize);
diff --git a/gmp/mpz/cmpabs_ui.c b/gmp/mpz/cmpabs_ui.c
index fdeb061945..881692de62 100644
--- a/gmp/mpz/cmpabs_ui.c
+++ b/gmp/mpz/cmpabs_ui.c
@@ -1,39 +1,29 @@
/* 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-1995, 1997, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpz_cmpabs_ui (mpz_srcptr u, unsigned long int v_digit) __GMP_NOTHROW
+mpz_cmpabs_ui (mpz_srcptr u, unsigned long int v_digit)
{
mp_ptr up;
mp_size_t un;
diff --git a/gmp/mpz/com.c b/gmp/mpz/com.c
index 66d69ce8b2..c403b8ce6a 100644
--- a/gmp/mpz/com.c
+++ b/gmp/mpz/com.c
@@ -1,34 +1,22 @@
/* mpz_com(mpz_ptr dst, mpz_ptr src) -- Assign the bit-complemented value of
SRC to DST.
-Copyright 1991, 1993, 1994, 1996, 2001, 2003, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2003 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -36,7 +24,7 @@ see https://www.gnu.org/licenses/. */
void
mpz_com (mpz_ptr dst, mpz_srcptr src)
{
- mp_size_t size = SIZ (src);
+ mp_size_t size = src->_mp_size;
mp_srcptr src_ptr;
mp_ptr dst_ptr;
@@ -46,27 +34,33 @@ mpz_com (mpz_ptr dst, mpz_srcptr src)
But this can be simplified using the identity -x = ~x + 1.
So we're going to compute (~~x) + 1 = x + 1! */
+ if (dst->_mp_alloc < size + 1)
+ _mpz_realloc (dst, size + 1);
+
+ src_ptr = src->_mp_d;
+ dst_ptr = dst->_mp_d;
+
if (UNLIKELY (size == 0))
{
/* special case, as mpn_add_1 wants size!=0 */
- PTR (dst)[0] = 1;
- SIZ (dst) = -1;
+ dst_ptr[0] = 1;
+ dst->_mp_size = -1;
+ return;
}
- else
- {
- mp_limb_t cy;
-
- dst_ptr = MPZ_REALLOC (dst, size + 1);
- src_ptr = PTR (src);
+ {
+ mp_limb_t cy;
- cy = mpn_add_1 (dst_ptr, src_ptr, size, (mp_limb_t) 1);
- dst_ptr[size] = cy;
- size += cy;
-
- /* Store a negative size, to indicate ones-extension. */
- SIZ (dst) = -size;
+ cy = mpn_add_1 (dst_ptr, src_ptr, size, (mp_limb_t) 1);
+ if (cy)
+ {
+ dst_ptr[size] = cy;
+ size++;
+ }
}
+
+ /* Store a negative size, to indicate ones-extension. */
+ dst->_mp_size = -size;
}
else
{
@@ -75,14 +69,16 @@ mpz_com (mpz_ptr dst, mpz_srcptr src)
So we're going to compute ~~(x - 1) = x - 1! */
size = -size;
- dst_ptr = MPZ_REALLOC (dst, size);
+ if (dst->_mp_alloc < size)
+ _mpz_realloc (dst, size);
- src_ptr = PTR (src);
+ src_ptr = src->_mp_d;
+ dst_ptr = dst->_mp_d;
mpn_sub_1 (dst_ptr, src_ptr, size, (mp_limb_t) 1);
size -= dst_ptr[size - 1] == 0;
/* Store a positive size, to indicate zero-extension. */
- SIZ (dst) = size;
+ dst->_mp_size = size;
}
}
diff --git a/gmp/mpz/combit.c b/gmp/mpz/combit.c
index 85ea4c8b26..02ceaf0885 100644
--- a/gmp/mpz/combit.c
+++ b/gmp/mpz/combit.c
@@ -1,103 +1,80 @@
/* mpz_combit -- complement a specified bit.
-Copyright 2002, 2003, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_combit (mpz_ptr d, mp_bitcnt_t bit_index)
+mpz_combit (mpz_ptr d, unsigned long int bit_index)
{
- mp_size_t dsize = SIZ(d);
- mp_ptr dp = PTR(d);
+ mp_size_t dsize = ABSIZ(d);
+ mp_ptr dp = LIMBS(d);
mp_size_t limb_index = bit_index / GMP_NUMB_BITS;
- mp_limb_t bit = (CNST_LIMB (1) << (bit_index % GMP_NUMB_BITS));
-
- /* Check for the most common case: Positive input, no realloc or
- normalization needed. */
- if (limb_index + 1 < dsize)
- dp[limb_index] ^= bit;
+ mp_limb_t bit = ((mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS));
- /* Check for the hairy case. d < 0, and we have all zero bits to the
- right of the bit to toggle. */
- else if (limb_index < -dsize && mpn_zero_p (dp, limb_index)
- && (dp[limb_index] & (bit - 1)) == 0)
+ if (limb_index >= dsize)
{
- ASSERT (dsize < 0);
- dsize = -dsize;
+ MPZ_REALLOC(d, limb_index + 1);
+ dp = LIMBS(d);
- if (dp[limb_index] & bit)
- {
- /* We toggle the least significant one bit. Corresponds to
- an add, with potential carry propagation, on the absolute
- value. */
- dp = MPZ_REALLOC (d, 1 + dsize);
- dp[dsize] = 0;
- MPN_INCR_U (dp + limb_index, 1 + dsize - limb_index, bit);
- 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);
- /* The absolute value shrinked by at most one bit. */
- dsize -= dp[dsize - 1] == 0;
- ASSERT (dsize > 0 && dp[dsize - 1] != 0);
- SIZ (d) = -dsize;
- }
+ MPN_ZERO(dp + dsize, limb_index + 1 - dsize);
+ dsize = limb_index + 1;
+ }
+
+ if (SIZ(d) >= 0)
+ {
+ dp[limb_index] ^= bit;
+ MPN_NORMALIZE (dp, dsize);
+ SIZ(d) = dsize;
}
else
{
- /* Simple case: Toggle the bit in the absolute value. */
- dsize = ABS(dsize);
- if (limb_index < dsize)
+ mp_limb_t x = -dp[limb_index];
+ mp_size_t i;
+
+ /* non-zero limb below us means ones-complement */
+ for (i = limb_index-1; i >= 0; i--)
+ if (dp[i] != 0)
+ {
+ x--; /* change twos comp to ones comp */
+ break;
+ }
+
+ if (x & 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 (UNLIKELY ((dlimb == 0) + limb_index == dsize)) /* dsize == limb_index + 1 */
- {
- /* high limb became zero, must normalize */
- MPN_NORMALIZE (dp, limb_index);
- SIZ (d) = SIZ (d) >= 0 ? limb_index : -limb_index;
- }
+ mp_limb_t c;
+
+ /* Clearing the bit increases the magitude. We might need a carry. */
+ MPZ_REALLOC(d, dsize + 1);
+ dp = LIMBS(d);
+
+ __GMPN_ADD_1 (c, dp+limb_index, dp+limb_index,
+ dsize - limb_index, bit);
+ dp[dsize] = c;
+ dsize += c;
}
else
- {
- dp = MPZ_REALLOC (d, limb_index + 1);
- MPN_ZERO(dp + dsize, limb_index - dsize);
- dp[limb_index++] = bit;
- SIZ(d) = SIZ(d) >= 0 ? limb_index : -limb_index;
- }
+ /* Setting the bit decreases the magnitude */
+ mpn_sub_1(dp+limb_index, dp+limb_index, dsize + limb_index, bit);
+
+ MPN_NORMALIZE (dp, dsize);
+ SIZ(d) = -dsize;
}
}
diff --git a/gmp/mpz/cong.c b/gmp/mpz/cong.c
index 1855b5052a..7fcd6e8d52 100644
--- a/gmp/mpz/cong.c
+++ b/gmp/mpz/cong.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -105,53 +94,53 @@ mpz_congruent_p (mpz_srcptr a, mpz_srcptr c, mpz_srcptr d)
if (csize == 1)
{
if (dsize == 1)
- {
- cong_1:
- if (sign < 0)
- NEG_MOD (clow, clow, dlow);
-
- if (ABOVE_THRESHOLD (asize, BMOD_1_TO_MOD_1_THRESHOLD))
- {
- r = mpn_mod_1 (ap, asize, dlow);
- if (clow < dlow)
- return r == clow;
- else
- return r == (clow % dlow);
- }
-
- if ((dlow & 1) == 0)
- {
- /* Strip low zero bits to get odd d required by modexact. If
- d==e*2^n then a==c mod d if and only if both a==c mod e and
- a==c mod 2^n, the latter having been done above. */
- unsigned twos;
- count_trailing_zeros (twos, dlow);
- dlow >>= twos;
- }
-
- r = mpn_modexact_1c_odd (ap, asize, dlow, clow);
- return r == 0 || r == dlow;
- }
+ {
+ cong_1:
+ if (sign < 0)
+ NEG_MOD (clow, clow, dlow);
+
+ if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD))
+ {
+ r = mpn_mod_1 (ap, asize, dlow);
+ if (clow < dlow)
+ return r == clow;
+ else
+ return r == (clow % dlow);
+ }
+
+ if ((dlow & 1) == 0)
+ {
+ /* Strip low zero bits to get odd d required by modexact. If
+ d==e*2^n then a==c mod d if and only if both a==c mod e and
+ a==c mod 2^n, the latter having been done above. */
+ unsigned twos;
+ count_trailing_zeros (twos, dlow);
+ dlow >>= twos;
+ }
+
+ r = mpn_modexact_1c_odd (ap, asize, dlow, clow);
+ return r == 0 || r == dlow;
+ }
/* dlow==0 is avoided since we don't want to bother handling extra low
- zero bits if dsecond is even (would involve borrow if a,c differ in
- sign and alow,clow!=0). */
+ zero bits if dsecond is even (would involve borrow if a,c differ in
+ sign and alow,clow!=0). */
if (dsize == 2 && dlow != 0)
- {
- mp_limb_t dsecond = dp[1];
-
- if (dsecond <= dmask)
- {
- unsigned twos;
- count_trailing_zeros (twos, dlow);
- dlow = (dlow >> twos) | (dsecond << (GMP_NUMB_BITS-twos));
- ASSERT_LIMB (dlow);
-
- /* dlow will be odd here, so the test for it even under cong_1
- is unnecessary, but the rest of that code is wanted. */
- goto cong_1;
- }
- }
+ {
+ mp_limb_t dsecond = dp[1];
+
+ if (dsecond <= dmask)
+ {
+ unsigned twos;
+ count_trailing_zeros (twos, dlow);
+ dlow = (dlow >> twos) | (dsecond << (GMP_NUMB_BITS-twos));
+ ASSERT_LIMB (dlow);
+
+ /* dlow will be odd here, so the test for it even under cong_1
+ is unnecessary, but the rest of that code is wanted. */
+ goto cong_1;
+ }
+ }
}
TMP_MARK;
@@ -162,9 +151,9 @@ mpz_congruent_p (mpz_srcptr a, mpz_srcptr c, mpz_srcptr d)
{
/* same signs, subtract */
if (asize > csize || mpn_cmp (ap, cp, asize) >= 0)
- ASSERT_NOCARRY (mpn_sub (xp, ap, asize, cp, csize));
+ ASSERT_NOCARRY (mpn_sub (xp, ap, asize, cp, csize));
else
- ASSERT_NOCARRY (mpn_sub_n (xp, cp, ap, asize));
+ ASSERT_NOCARRY (mpn_sub_n (xp, cp, ap, asize));
MPN_NORMALIZE (xp, asize);
}
else
diff --git a/gmp/mpz/cong_2exp.c b/gmp/mpz/cong_2exp.c
index 8e78b17378..873f195b8f 100644
--- a/gmp/mpz/cong_2exp.c
+++ b/gmp/mpz/cong_2exp.c
@@ -1,57 +1,36 @@
/* mpz_congruent_2exp_p -- test congruence of mpz mod 2^n.
-Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
+mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, unsigned long d)
{
- mp_size_t i, dlimbs;
- unsigned dbits;
+ unsigned long i, dlimbs, dbits;
mp_ptr ap, cp;
mp_limb_t dmask, alimb, climb, sum;
- mp_size_t as, cs, asize, csize;
+ mp_size_t asize_signed, csize_signed, asize, csize;
- 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);
- }
+ if (ABSIZ(a) < ABSIZ(c))
+ MPZ_SRCPTR_SWAP (a, c);
dlimbs = d / GMP_NUMB_BITS;
dbits = d % GMP_NUMB_BITS;
@@ -60,32 +39,38 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
ap = PTR(a);
cp = PTR(c);
- if (csize == 0)
+ asize_signed = SIZ(a);
+ asize = ABS(asize_signed);
+
+ csize_signed = SIZ(c);
+ csize = ABS(csize_signed);
+
+ if (csize_signed == 0)
goto a_zeros;
- if ((cs ^ as) >= 0)
+ if ((asize_signed ^ csize_signed) >= 0)
{
/* same signs, direct comparison */
/* a==c for limbs in common */
if (mpn_cmp (ap, cp, MIN (csize, dlimbs)) != 0)
- return 0;
+ return 0;
/* if that's all of dlimbs, then a==c for remaining bits */
if (csize > dlimbs)
- return ((ap[dlimbs]-cp[dlimbs]) & dmask) == 0;
+ return ((ap[dlimbs]-cp[dlimbs]) & dmask) == 0;
a_zeros:
/* a remains, need all zero bits */
/* if d covers all of a and c, then must be exactly equal */
if (asize <= dlimbs)
- return asize == csize;
+ return asize == csize;
/* whole limbs zero */
for (i = csize; i < dlimbs; i++)
- if (ap[i] != 0)
- return 0;
+ if (ap[i] != 0)
+ return 0;
/* partial limb zero */
return (ap[dlimbs] & dmask) == 0;
@@ -95,55 +80,63 @@ mpz_congruent_2exp_p (mpz_srcptr a, mpz_srcptr c, mp_bitcnt_t d) __GMP_NOTHROW
/* different signs, negated comparison */
/* common low zero limbs, stopping at first non-zeros, which must
- match twos complement */
+ match twos complement */
i = 0;
- do
- {
- ASSERT (i < csize); /* always have a non-zero limb on c */
- alimb = ap[i];
- climb = cp[i];
- sum = (alimb + climb) & GMP_NUMB_MASK;
-
- if (i >= dlimbs)
- return (sum & dmask) == 0;
- ++i;
-
- /* require both zero, or first non-zeros as twos-complements */
- if (sum != 0)
- return 0;
- } while (alimb == 0);
+ for (;;)
+ {
+ ASSERT (i < csize); /* always have a non-zero limb on c */
+ alimb = ap[i];
+ climb = cp[i];
+ sum = (alimb + climb) & GMP_NUMB_MASK;
+
+ if (i >= dlimbs)
+ return (sum & dmask) == 0;
+ i++;
+
+ /* require both zero, or first non-zeros as twos-complements */
+ if (sum != 0)
+ return 0;
+
+ if (alimb != 0)
+ break;
+ }
/* further limbs matching as ones-complement */
- for (; i < csize; ++i)
- {
- alimb = ap[i];
- climb = cp[i];
- sum = alimb ^ climb ^ GMP_NUMB_MASK;
+ for (;;)
+ {
+ if (i >= csize)
+ break;
+
+ alimb = ap[i];
+ climb = cp[i];
+ sum = (alimb + climb + 1) & GMP_NUMB_MASK;
+
+ if (i >= dlimbs)
+ return (sum & dmask) == 0;
- if (i >= dlimbs)
- return (sum & dmask) == 0;
+ if (sum != 0)
+ return 0;
- if (sum != 0)
- return 0;
- }
+ i++;
+ }
/* no more c, so require all 1 bits in a */
if (asize < dlimbs)
- return 0; /* not enough a */
+ return 0; /* not enough a */
/* whole limbs */
for ( ; i < dlimbs; i++)
- if (ap[i] != GMP_NUMB_MAX)
- return 0;
+ if (ap[i] != GMP_NUMB_MAX)
+ return 0;
/* if only whole limbs, no further fetches from a */
if (dbits == 0)
- return 1;
+ return 1;
/* need enough a */
if (asize == dlimbs)
- return 0;
+ return 0;
return ((ap[dlimbs]+1) & dmask) == 0;
}
diff --git a/gmp/mpz/cong_ui.c b/gmp/mpz/cong_ui.c
index a9729d9a85..5969c8fd34 100644
--- a/gmp/mpz/cong_ui.c
+++ b/gmp/mpz/cong_ui.c
@@ -1,32 +1,21 @@
/* mpz_congruent_ui_p -- test congruence of mpz and ulong.
-Copyright 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -53,9 +42,9 @@ mpz_congruent_ui_p (mpz_srcptr a, unsigned long cu, unsigned long du)
if (asize == 0)
{
if (cu < du)
- return cu == 0;
+ return cu == 0;
else
- return (cu % du) == 0;
+ return (cu % du) == 0;
}
/* For nails don't try to be clever if c or d is bigger than a limb, just
@@ -87,25 +76,25 @@ mpz_congruent_ui_p (mpz_srcptr a, unsigned long cu, unsigned long du)
ap = PTR (a);
- if (ABOVE_THRESHOLD (asize, BMOD_1_TO_MOD_1_THRESHOLD))
+ if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD))
{
r = mpn_mod_1 (ap, asize, d);
if (c < d)
- return r == c;
+ return r == c;
else
- return r == (c % d);
+ return r == (c % d);
}
if ((d & 1) == 0)
{
/* Strip low zero bits to get odd d required by modexact. If
- d==e*2^n then a==c mod d if and only if both a==c mod 2^n
- and a==c mod e. */
+ d==e*2^n then a==c mod d if and only if both a==c mod 2^n
+ and a==c mod e. */
- unsigned twos;
+ unsigned twos;
if ((ap[0]-c) & LOW_ZEROS_MASK (d))
- return 0;
+ return 0;
count_trailing_zeros (twos, d);
d >>= twos;
diff --git a/gmp/mpz/dive_ui.c b/gmp/mpz/dive_ui.c
index 8a1b5a31ff..53709aa3b7 100644
--- a/gmp/mpz/dive_ui.c
+++ b/gmp/mpz/dive_ui.c
@@ -1,32 +1,21 @@
/* mpz_divexact_ui -- exact division mpz by ulong.
-Copyright 2001, 2002, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,7 +26,7 @@ mpz_divexact_ui (mpz_ptr dst, mpz_srcptr src, unsigned long divisor)
mp_size_t size, abs_size;
mp_ptr dst_ptr;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
/* For nails don't try to be clever if d is bigger than a limb, just fake
@@ -61,7 +50,8 @@ mpz_divexact_ui (mpz_ptr dst, mpz_srcptr src, unsigned long divisor)
}
abs_size = ABS (size);
- dst_ptr = MPZ_REALLOC (dst, abs_size);
+ MPZ_REALLOC (dst, abs_size);
+ dst_ptr = PTR(dst);
MPN_DIVREM_OR_DIVEXACT_1 (dst_ptr, PTR(src), abs_size, (mp_limb_t) divisor);
abs_size -= (dst_ptr[abs_size-1] == 0);
diff --git a/gmp/mpz/divegcd.c b/gmp/mpz/divegcd.c
index 3cb181c319..e4bf431526 100644
--- a/gmp/mpz/divegcd.c
+++ b/gmp/mpz/divegcd.c
@@ -3,33 +3,22 @@
THE FUNCTIONS IN THIS FILE ARE FOR INTERNAL USE AND ARE ALMOST CERTAIN TO
BE SUBJECT TO INCOMPATIBLE CHANGES IN FUTURE GNU MP RELEASES.
-Copyright 2000, 2005, 2011, 2012 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -55,53 +44,28 @@ see https://www.gnu.org/licenses/. */
implementation. */
-#if GMP_NUMB_BITS % 2 == 0
static void
mpz_divexact_by3 (mpz_ptr q, mpz_srcptr a)
{
mp_size_t size = SIZ(a);
- mp_size_t abs_size = ABS(size);
- mp_ptr qp;
-
- qp = MPZ_REALLOC (q, abs_size);
-
- mpn_bdiv_dbm1 (qp, PTR(a), abs_size, GMP_NUMB_MASK / 3);
-
- abs_size -= (qp[abs_size-1] == 0);
- SIZ(q) = (size>0 ? abs_size : -abs_size);
-}
-#endif
-
-#if GMP_NUMB_BITS % 4 == 0
-static void
-mpz_divexact_by5 (mpz_ptr q, mpz_srcptr a)
-{
- mp_size_t size = SIZ(a);
- mp_size_t abs_size = ABS(size);
- mp_ptr qp;
-
- qp = MPZ_REALLOC (q, abs_size);
-
- mpn_bdiv_dbm1 (qp, PTR(a), abs_size, GMP_NUMB_MASK / 5);
-
- abs_size -= (qp[abs_size-1] == 0);
- SIZ(q) = (size>0 ? abs_size : -abs_size);
-}
-#endif
-
-static void
-mpz_divexact_limb (mpz_ptr q, mpz_srcptr a, mp_limb_t d)
-{
- mp_size_t size = SIZ(a);
- mp_size_t abs_size = ABS(size);
- mp_ptr qp;
+ if (size == 0)
+ {
+ SIZ(q) = 0;
+ return;
+ }
+ else
+ {
+ mp_size_t abs_size = ABS(size);
+ mp_ptr qp;
- qp = MPZ_REALLOC (q, abs_size);
+ MPZ_REALLOC (q, abs_size);
- mpn_divexact_1 (qp, PTR(a), abs_size, d);
+ qp = PTR(q);
+ mpn_divexact_by3 (qp, PTR(a), abs_size);
- abs_size -= (qp[abs_size-1] == 0);
- SIZ(q) = (size>0 ? abs_size : -abs_size);
+ abs_size -= (qp[abs_size-1] == 0);
+ SIZ(q) = (size>0 ? abs_size : -abs_size);
+ }
}
void
@@ -109,48 +73,37 @@ mpz_divexact_gcd (mpz_ptr q, mpz_srcptr a, mpz_srcptr d)
{
ASSERT (mpz_sgn (d) > 0);
- if (SIZ(a) == 0)
- {
- SIZ(q) = 0;
- return;
- }
-
if (SIZ(d) == 1)
{
mp_limb_t dl = PTR(d)[0];
int twos;
- if ((dl & 1) == 0)
- {
- count_trailing_zeros (twos, dl);
- dl >>= twos;
- mpz_tdiv_q_2exp (q, a, twos);
- a = q;
- }
+ if (dl == 1)
+ {
+ if (q != a)
+ mpz_set (q, a);
+ return;
+ }
+ if (dl == 3)
+ {
+ mpz_divexact_by3 (q, a);
+ return;
+ }
+
+ count_trailing_zeros (twos, dl);
+ dl >>= twos;
if (dl == 1)
- {
- if (q != a)
- mpz_set (q, a);
- return;
- }
-#if GMP_NUMB_BITS % 2 == 0
+ {
+ mpz_tdiv_q_2exp (q, a, twos);
+ return;
+ }
if (dl == 3)
- {
- mpz_divexact_by3 (q, a);
- return;
- }
-#endif
-#if GMP_NUMB_BITS % 4 == 0
- if (dl == 5)
- {
- mpz_divexact_by5 (q, a);
- return;
- }
-#endif
-
- mpz_divexact_limb (q, a, dl);
- return;
+ {
+ mpz_tdiv_q_2exp (q, a, twos);
+ mpz_divexact_by3 (q, q);
+ return;
+ }
}
mpz_divexact (q, a, d);
diff --git a/gmp/mpz/divexact.c b/gmp/mpz/divexact.c
index e935471529..e7d9d009f9 100644
--- a/gmp/mpz/divexact.c
+++ b/gmp/mpz/divexact.c
@@ -1,36 +1,33 @@
/* mpz_divexact -- finds quotient when known that quot * den == num && den != 0.
-Contributed to the GNU project by Niels Möller.
-
-Copyright 1991, 1993-1998, 2000-2002, 2005-2007, 2009, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 1996, 1997, 1998, 2000, 2001, 2002, 2005,
+2006, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General Public License and the
-GNU Lesser General Public License along with the GNU MP Library. If not,
-see https://www.gnu.org/licenses/. */
+/* Ken Weber (kweber@mat.ufrgs.br, kweber@mcs.kent.edu)
+ Funding for this work has been partially provided by Conselho Nacional
+ de Desenvolvimento Cienti'fico e Tecnolo'gico (CNPq) do Brazil, Grant
+ 301314194-2, and was done while I was a visiting reseacher in the Instituto
+ de Matema'tica at Universidade Federal do Rio Grande do Sul (UFRGS).
+
+ References:
+ T. Jebelean, An algorithm for exact division, Journal of Symbolic
+ Computation, v. 15, 1993, pp. 169-180. */
#include "gmp.h"
#include "gmp-impl.h"
@@ -39,10 +36,10 @@ see https://www.gnu.org/licenses/. */
void
mpz_divexact (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
{
- mp_ptr qp;
- mp_size_t qn;
+ mp_ptr qp, tp;
+ mp_size_t qsize, tsize;
mp_srcptr np, dp;
- mp_size_t nn, dn;
+ mp_size_t nsize, dsize;
TMP_DECL;
#if WANT_ASSERT
@@ -55,37 +52,83 @@ mpz_divexact (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
}
#endif
- nn = ABSIZ (num);
- dn = ABSIZ (den);
+ nsize = ABS (num->_mp_size);
+ dsize = ABS (den->_mp_size);
+
+ qsize = nsize - dsize + 1;
+ if (quot->_mp_alloc < qsize)
+ _mpz_realloc (quot, qsize);
+
+ np = num->_mp_d;
+ dp = den->_mp_d;
+ qp = quot->_mp_d;
- if (nn < dn)
+ if (nsize < dsize)
{
/* This special case avoids segfaults below when the function is
incorrectly called with |N| < |D|, N != 0. It also handles the
well-defined case N = 0. */
- SIZ(quot) = 0;
+ quot->_mp_size = 0;
return;
}
- qn = nn - dn + 1;
+ if (dsize <= 1)
+ {
+ if (dsize == 1)
+ {
+ MPN_DIVREM_OR_DIVEXACT_1 (qp, np, nsize, dp[0]);
+ qsize -= qp[qsize - 1] == 0;
+ quot->_mp_size = (num->_mp_size ^ den->_mp_size) >= 0 ? qsize : -qsize;
+ return;
+ }
+
+ /* Generate divide-by-zero error since dsize == 0. */
+ DIVIDE_BY_ZERO;
+ }
+
+ /* Avoid quadratic behaviour, but do it conservatively. */
+ if (qsize > 1500)
+ {
+ mpz_tdiv_q (quot, num, den);
+ return;
+ }
TMP_MARK;
- if (quot == num || quot == den)
- qp = TMP_ALLOC_LIMBS (qn);
+ /* QUOT <-- NUM/2^r, T <-- DEN/2^r where = r number of twos in DEN. */
+ while (dp[0] == 0)
+ np += 1, nsize -= 1, dp += 1, dsize -= 1;
+ tsize = MIN (qsize, dsize);
+ if ((dp[0] & 1) != 0)
+ {
+ if (quot == den) /* QUOT and DEN overlap. */
+ {
+ tp = (mp_ptr) TMP_ALLOC (tsize * BYTES_PER_MP_LIMB);
+ MPN_COPY (tp, dp, tsize);
+ }
+ else
+ tp = (mp_ptr) dp;
+ if (qp != np)
+ MPN_COPY_INCR (qp, np, qsize);
+ }
else
- qp = MPZ_REALLOC (quot, qn);
-
- np = PTR(num);
- dp = PTR(den);
-
- mpn_divexact (qp, np, nn, dp, dn);
- MPN_NORMALIZE (qp, qn);
+ {
+ unsigned int r;
+ tp = (mp_ptr) TMP_ALLOC (tsize * BYTES_PER_MP_LIMB);
+ count_trailing_zeros (r, dp[0]);
+ mpn_rshift (tp, dp, tsize, r);
+ if (dsize > tsize)
+ tp[tsize - 1] |= (dp[tsize] << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK;
+ mpn_rshift (qp, np, qsize, r);
+ if (nsize > qsize)
+ qp[qsize - 1] |= (np[qsize] << (GMP_NUMB_BITS - r)) & GMP_NUMB_MASK;
+ }
- if (qp != PTR(quot))
- MPN_COPY (MPZ_REALLOC (quot, qn), qp, qn);
+ /* Now QUOT <-- QUOT/T. */
+ mpn_bdivmod (qp, qp, qsize, tp, tsize, qsize * GMP_NUMB_BITS);
+ MPN_NORMALIZE (qp, qsize);
- SIZ(quot) = (SIZ(num) ^ SIZ(den)) >= 0 ? qn : -qn;
+ quot->_mp_size = (num->_mp_size ^ den->_mp_size) >= 0 ? qsize : -qsize;
TMP_FREE;
}
diff --git a/gmp/mpz/divis.c b/gmp/mpz/divis.c
index cd9d406846..78ac38f410 100644
--- a/gmp/mpz/divis.c
+++ b/gmp/mpz/divis.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpz/divis_2exp.c b/gmp/mpz/divis_2exp.c
index db6cfa4433..5e07b4af18 100644
--- a/gmp/mpz/divis_2exp.c
+++ b/gmp/mpz/divis_2exp.c
@@ -5,38 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-mpz_divisible_2exp_p (mpz_srcptr a, mp_bitcnt_t d) __GMP_NOTHROW
+mpz_divisible_2exp_p (mpz_srcptr a, unsigned long d)
{
- mp_size_t i, dlimbs;
- unsigned dbits;
+ unsigned long i, dlimbs, dbits;
mp_ptr ap;
mp_limb_t dmask;
mp_size_t asize;
diff --git a/gmp/mpz/divis_ui.c b/gmp/mpz/divis_ui.c
index 41ff5f0b84..ead0ddd23b 100644
--- a/gmp/mpz/divis_ui.c
+++ b/gmp/mpz/divis_ui.c
@@ -1,32 +1,21 @@
/* mpz_divisible_ui_p -- mpz by ulong divisibility test.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -62,16 +51,16 @@ mpz_divisible_ui_p (mpz_srcptr a, unsigned long d)
ap = PTR(a);
asize = ABS(asize); /* ignore sign of a */
- if (ABOVE_THRESHOLD (asize, BMOD_1_TO_MOD_1_THRESHOLD))
+ if (BELOW_THRESHOLD (asize, MODEXACT_1_ODD_THRESHOLD))
return mpn_mod_1 (ap, asize, (mp_limb_t) d) == 0;
if (! (d & 1))
{
/* Strip low zero bits to get odd d required by modexact. If d==e*2^n
- and a is divisible by 2^n and by e, then it's divisible by d. */
+ and a is divisible by 2^n and by e, then it's divisible by d. */
if ((ap[0] & LOW_ZEROS_MASK (d)) != 0)
- return 0;
+ return 0;
count_trailing_zeros (twos, (mp_limb_t) d);
d >>= twos;
diff --git a/gmp/mpz/dump.c b/gmp/mpz/dump.c
index 282be34db7..c5656a776d 100644
--- a/gmp/mpz/dump.c
+++ b/gmp/mpz/dump.c
@@ -5,33 +5,22 @@
FUNCTION WILL CHANGE OR DISAPPEAR IN A FUTURE GNU MP RELEASE.
-Copyright 1999-2001 Free Software Foundation, Inc.
+Copyright 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <string.h> /* for strlen */
diff --git a/gmp/mpz/export.c b/gmp/mpz/export.c
index bc4c4df976..484b9d91bb 100644
--- a/gmp/mpz/export.c
+++ b/gmp/mpz/export.c
@@ -1,32 +1,21 @@
/* mpz_export -- create word data from mpz.
-Copyright 2002, 2003, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -45,9 +34,22 @@ static const mp_limb_t endian_test = (CNST_LIMB(1) << (GMP_LIMB_BITS-7)) - 1;
#define HOST_ENDIAN (* (signed char *) &endian_test)
#endif
+
+#define MPN_SIZEINBASE_2EXP(result, ptr, size, base2exp) \
+ do { \
+ int __cnt; \
+ unsigned long __totbits; \
+ ASSERT ((size) > 0); \
+ ASSERT ((ptr)[(size)-1] != 0); \
+ count_leading_zeros (__cnt, (ptr)[(size)-1]); \
+ __totbits = (size) * GMP_NUMB_BITS - (__cnt - GMP_NAIL_BITS); \
+ (result) = (__totbits + (base2exp)-1) / (base2exp); \
+ } while (0)
+
+
void *
mpz_export (void *data, size_t *countp, int order,
- size_t size, int endian, size_t nail, mpz_srcptr z)
+ size_t size, int endian, size_t nail, mpz_srcptr z)
{
mp_size_t zsize;
mp_srcptr zp;
@@ -58,7 +60,7 @@ mpz_export (void *data, size_t *countp, int order,
ASSERT (order == 1 || order == -1);
ASSERT (endian == 1 || endian == 0 || endian == -1);
ASSERT (nail <= 8*size);
- ASSERT (nail < 8*size || SIZ(z) == 0); /* nail < 8*size+(SIZ(z)==0) */
+ ASSERT (8*size-nail > 0);
if (countp == NULL)
countp = &dummy;
@@ -87,29 +89,29 @@ mpz_export (void *data, size_t *countp, int order,
if (nail == GMP_NAIL_BITS)
{
if (size == sizeof (mp_limb_t) && align == 0)
- {
- if (order == -1 && endian == HOST_ENDIAN)
- {
- MPN_COPY ((mp_ptr) data, zp, (mp_size_t) count);
- return data;
- }
- if (order == 1 && endian == HOST_ENDIAN)
- {
- MPN_REVERSE ((mp_ptr) data, zp, (mp_size_t) count);
- return data;
- }
-
- if (order == -1 && endian == -HOST_ENDIAN)
- {
- MPN_BSWAP ((mp_ptr) data, zp, (mp_size_t) count);
- return data;
- }
- if (order == 1 && endian == -HOST_ENDIAN)
- {
- MPN_BSWAP_REVERSE ((mp_ptr) data, zp, (mp_size_t) count);
- return data;
- }
- }
+ {
+ if (order == -1 && endian == HOST_ENDIAN)
+ {
+ MPN_COPY ((mp_ptr) data, zp, (mp_size_t) count);
+ return data;
+ }
+ if (order == 1 && endian == HOST_ENDIAN)
+ {
+ MPN_REVERSE ((mp_ptr) data, zp, (mp_size_t) count);
+ return data;
+ }
+
+ if (order == -1 && endian == -HOST_ENDIAN)
+ {
+ MPN_BSWAP ((mp_ptr) data, zp, (mp_size_t) count);
+ return data;
+ }
+ if (order == 1 && endian == -HOST_ENDIAN)
+ {
+ MPN_BSWAP_REVERSE ((mp_ptr) data, zp, (mp_size_t) count);
+ return data;
+ }
+ }
}
{
@@ -160,31 +162,31 @@ mpz_export (void *data, size_t *countp, int order,
limb = 0;
for (i = 0; i < count; i++)
{
- for (j = 0; j < wbytes; j++)
- {
- EXTRACT (8, + 0);
- dp -= endian;
- }
- if (wbits != 0)
- {
- EXTRACT (wbits, & wbitsmask);
- dp -= endian;
- j++;
- }
- for ( ; j < size; j++)
- {
- *dp = '\0';
- dp -= endian;
- }
- dp += woffset;
+ for (j = 0; j < wbytes; j++)
+ {
+ EXTRACT (8, + 0);
+ dp -= endian;
+ }
+ if (wbits != 0)
+ {
+ EXTRACT (wbits, & wbitsmask);
+ dp -= endian;
+ j++;
+ }
+ for ( ; j < size; j++)
+ {
+ *dp = '\0';
+ dp -= endian;
+ }
+ dp += woffset;
}
ASSERT (zp == PTR(z) + ABSIZ(z));
/* low byte of word after most significant */
ASSERT (dp == (unsigned char *) data
- + (order < 0 ? count*size : - (mp_size_t) size)
- + (endian >= 0 ? (mp_size_t) size - 1 : 0));
+ + (order < 0 ? count*size : - (mp_size_t) size)
+ + (endian >= 0 ? (mp_size_t) size - 1 : 0));
}
return data;
}
diff --git a/gmp/mpz/fac_ui.c b/gmp/mpz/fac_ui.c
index e0932272ff..7e394fcb18 100644
--- a/gmp/mpz/fac_ui.c
+++ b/gmp/mpz/fac_ui.c
@@ -1,108 +1,396 @@
-/* mpz_fac_ui(RESULT, N) -- Set RESULT to N!.
+/* mpz_fac_ui(result, n) -- Set RESULT to N!.
-Contributed to the GNU project by Marco Bodrato.
-
-Copyright 1991, 1993-1995, 2000-2003, 2011, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+
+#include "fac_ui.h"
+
+
+static void odd_product __GMP_PROTO ((unsigned long, unsigned long, mpz_t *));
+static void ap_product_small __GMP_PROTO ((mpz_t, mp_limb_t, mp_limb_t, unsigned long, unsigned long));
+
-#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
- do { \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = (P); \
- } else \
- (PR) *= (P); \
+/* must be >=2 */
+#define APCONST 5
+
+/* for single non-zero limb */
+#define MPZ_SET_1_NZ(z,n) \
+ do { \
+ mpz_ptr __z = (z); \
+ ASSERT ((n) != 0); \
+ PTR(__z)[0] = (n); \
+ SIZ(__z) = 1; \
+ } while (0)
+
+/* for src>0 and n>0 */
+#define MPZ_MUL_1_POS(dst,src,n) \
+ do { \
+ mpz_ptr __dst = (dst); \
+ mpz_srcptr __src = (src); \
+ mp_size_t __size = SIZ(__src); \
+ mp_ptr __dst_p; \
+ mp_limb_t __c; \
+ \
+ ASSERT (__size > 0); \
+ ASSERT ((n) != 0); \
+ \
+ MPZ_REALLOC (__dst, __size+1); \
+ __dst_p = PTR(__dst); \
+ \
+ __c = mpn_mul_1 (__dst_p, PTR(__src), __size, n); \
+ __dst_p[__size] = __c; \
+ SIZ(__dst) = __size + (__c != 0); \
} while (0)
-#if TUNE_PROGRAM_BUILD
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD_LIMIT-1)+1))
-#else
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_ODD_THRESHOLD)+1))
+
+#if BITS_PER_ULONG == GMP_LIMB_BITS
+#define BSWAP_ULONG(x,y) BSWAP_LIMB(x,y)
#endif
-/* Computes n!, the factorial of n.
- WARNING: it assumes that n fits in a limb!
- */
+/* We used to have a case here for limb==2*long, doing a BSWAP_LIMB followed
+ by a shift down to get the high part. But it provoked incorrect code
+ from "HP aC++/ANSI C B3910B A.05.52 [Sep 05 2003]" in ILP32 mode. This
+ case would have been nice for gcc ia64 where BSWAP_LIMB is a mux1, but we
+ can get that directly muxing a 4-byte ulong if it matters enough. */
+
+#if ! defined (BSWAP_ULONG)
+#define BSWAP_ULONG(dst, src) \
+ do { \
+ unsigned long __bswapl_src = (src); \
+ unsigned long __bswapl_dst = 0; \
+ int __i; \
+ for (__i = 0; __i < sizeof(unsigned long); __i++) \
+ { \
+ __bswapl_dst = (__bswapl_dst << 8) | (__bswapl_src & 0xFF); \
+ __bswapl_src >>= 8; \
+ } \
+ (dst) = __bswapl_dst; \
+ } while (0)
+#endif
+
+/* x is bit reverse of y */
+/* Note the divides below are all exact */
+#define BITREV_ULONG(x,y) \
+ do { \
+ unsigned long __dst; \
+ BSWAP_ULONG(__dst,y); \
+ __dst = ((__dst>>4)&(ULONG_MAX/17)) | ((__dst<<4)&((ULONG_MAX/17)*16)); \
+ __dst = ((__dst>>2)&(ULONG_MAX/5) ) | ((__dst<<2)&((ULONG_MAX/5)*4) ); \
+ __dst = ((__dst>>1)&(ULONG_MAX/3) ) | ((__dst<<1)&((ULONG_MAX/3)*2) ); \
+ (x) = __dst; \
+ } while(0)
+/* above could be improved if cpu has a nibble/bit swap/muxing instruction */
+/* above code is serialized, possible to write as a big parallel expression */
+
+
+
void
mpz_fac_ui (mpz_ptr x, unsigned long n)
{
- static const mp_limb_t table[] = { ONE_LIMB_FACTORIAL_TABLE };
+ unsigned long z, stt;
+ int i, j;
+ mpz_t t1, st[8 * sizeof (unsigned long) + 1 - APCONST];
+ mp_limb_t d[4];
- ASSERT (n <= GMP_NUMB_MAX);
+ static const mp_limb_t table[] = { ONE_LIMB_FACTORIAL_TABLE };
if (n < numberof (table))
{
- PTR (x)[0] = table[n];
- SIZ (x) = 1;
+ MPZ_SET_1_NZ (x, table[n]);
+ return;
}
- else if (BELOW_THRESHOLD (n, FAC_ODD_THRESHOLD))
+
+ /* NOTE : MUST have n>=3 here */
+ ASSERT (n >= 3);
+ /* for estimating the alloc sizes the calculation of these formula's is not
+ exact and also the formulas are only approximations, also we ignore
+ the few "side" calculations, correct allocation seems to speed up the
+ small sizes better, having very little effect on the large sizes */
+
+ /* estimate space for stack entries see below
+ number of bits for n! is
+ (1+log_2(2*pi)/2)-n*log_2(exp(1))+(n+1/2)*log_2(n)=
+ 2.325748065-n*1.442695041+(n+0.5)*log_2(n) */
+ umul_ppmm (d[1], d[0], (mp_limb_t) n, (mp_limb_t) FAC2OVERE);
+ /* d[1] is 2n/e, d[0] ignored */
+ count_leading_zeros (z, d[1]);
+ z = GMP_LIMB_BITS - z - 1; /* z=floor(log_2(2n/e)) */
+ umul_ppmm (d[1], d[0], (mp_limb_t) n, (mp_limb_t) z);
+ /* d=n*floor(log_2(2n/e)) */
+ d[0] = (d[0] >> 2) | (d[1] << (GMP_LIMB_BITS - 2));
+ d[1] >>= 2;
+ /* d=n*floor(log_2(2n/e))/4 */
+ z = d[0] + 1; /* have to ignore any overflow */
+ /* so z is the number of bits wanted for st[0] */
+
+
+ if (n <= ((unsigned long) 1) << (APCONST))
{
- mp_limb_t prod, max_prod;
- mp_size_t j;
- mp_ptr factors;
- TMP_SDECL;
-
- TMP_SMARK;
- factors = TMP_SALLOC_LIMBS (2 + (n - numberof (table)) / FACTORS_PER_LIMB);
-
- factors[0] = table[numberof (table)-1];
- j = 1;
- prod = n;
-#if TUNE_PROGRAM_BUILD
- max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD_LIMIT;
-#else
- max_prod = GMP_NUMB_MAX / (FAC_ODD_THRESHOLD | 1);
-#endif
- while (--n >= numberof (table))
- FACTOR_LIST_STORE (n, prod, max_prod, factors, j);
+ mpz_realloc2 (x, 4 * z);
+ ap_product_small (x, CNST_LIMB(2), CNST_LIMB(1), n - 1, 4L);
+ return;
+ }
+ if (n <= ((unsigned long) 1) << (APCONST + 1))
+ { /* use n!=odd(1,n)*(n/2)!*2^(n/2) */
+ mpz_init2 (t1, 2 * z);
+ mpz_realloc2 (x, 4 * z);
+ ap_product_small (x, CNST_LIMB(2), CNST_LIMB(1), n / 2 - 1, 4L);
+ ap_product_small (t1, CNST_LIMB(3), CNST_LIMB(2), (n - 1) / 2, 4L);
+ mpz_mul (x, x, t1);
+ mpz_clear (t1);
+ mpz_mul_2exp (x, x, n / 2);
+ return;
+ }
+ if (n <= ((unsigned long) 1) << (APCONST + 2))
+ {
+ /* use n!=C_2(1,n/2)^2*C_2(n/2,n)*(n/4)!*2^(n/2+n/4) all int divs
+ so need (BITS_IN_N-APCONST+1)=(APCONST+3-APCONST+1)=4 stack entries */
+ mpz_init2 (t1, 2 * z);
+ mpz_realloc2 (x, 4 * z);
+ for (i = 0; i < 4; i++)
+ {
+ mpz_init2 (st[i], z);
+ z >>= 1;
+ }
+ odd_product (1, n / 2, st);
+ mpz_set (x, st[0]);
+ odd_product (n / 2, n, st);
+ mpz_mul (x, x, x);
+ ASSERT (n / 4 <= FACMUL4 + 6);
+ ap_product_small (t1, CNST_LIMB(2), CNST_LIMB(1), n / 4 - 1, 4L);
+ /* must have 2^APCONST odd numbers max */
+ mpz_mul (t1, t1, st[0]);
+ for (i = 0; i < 4; i++)
+ mpz_clear (st[i]);
+ mpz_mul (x, x, t1);
+ mpz_clear (t1);
+ mpz_mul_2exp (x, x, n / 2 + n / 4);
+ return;
+ }
- factors[j++] = prod;
- mpz_prodlimbs (x, factors, j);
+ count_leading_zeros (stt, (mp_limb_t) n);
+ stt = GMP_LIMB_BITS - stt + 1 - APCONST;
- TMP_SFREE;
+ for (i = 0; i < (signed long) stt; i++)
+ {
+ mpz_init2 (st[i], z);
+ z >>= 1;
}
- else
+
+ count_leading_zeros (z, (mp_limb_t) (n / 3));
+ /* find z st 2^z>n/3 range for z is 1 <= z <= 8 * sizeof(unsigned long)-1 */
+ z = GMP_LIMB_BITS - z;
+
+ /*
+ n! = 2^e * PRODUCT_{i=0}^{i=z-1} C_2( n/2^{i+1}, n/2^i )^{i+1}
+ where 2^e || n! 3.2^z>n C_2(a,b)=PRODUCT of odd z such that a<z<=b
+ */
+
+
+ mpz_init_set_ui (t1, 1);
+ for (j = 8 * sizeof (unsigned long) / 2; j != 0; j >>= 1)
+ {
+ MPZ_SET_1_NZ (x, 1);
+ for (i = 8 * sizeof (unsigned long) - j; i >= j; i -= 2 * j)
+ if ((signed long) z >= i)
+ {
+ odd_product (n >> i, n >> (i - 1), st);
+ /* largest odd product when j=i=1 then we have
+ odd_product(n/2,n,st) which is approx (2n/e)^(n/4)
+ so log_base2(largest oddproduct)=n*log_base2(2n/e)/4
+ number of bits is n*log_base2(2n/e)/4+1 */
+ if (i != j)
+ mpz_pow_ui (st[0], st[0], i / j);
+ mpz_mul (x, x, st[0]);
+ }
+ if ((signed long) z >= j && j != 1)
+ {
+ mpz_mul (t1, t1, x);
+ mpz_mul (t1, t1, t1);
+ }
+ }
+ for (i = 0; i < (signed long) stt; i++)
+ mpz_clear (st[i]);
+ mpz_mul (x, x, t1);
+ mpz_clear (t1);
+ popc_limb (i, (mp_limb_t) n);
+ mpz_mul_2exp (x, x, n - i);
+ return;
+}
+
+/* start,step are mp_limb_t although they will fit in unsigned long */
+static void
+ap_product_small (mpz_t ret, mp_limb_t start, mp_limb_t step,
+ unsigned long count, unsigned long nm)
+{
+ unsigned long a;
+ mp_limb_t b;
+
+ ASSERT (count <= (((unsigned long) 1) << APCONST));
+/* count can never be zero ? check this and remove test below */
+ if (count == 0)
+ {
+ MPZ_SET_1_NZ (ret, 1);
+ return;
+ }
+ if (count == 1)
+ {
+ MPZ_SET_1_NZ (ret, start);
+ return;
+ }
+ switch (nm)
{
- mp_limb_t count;
- mpz_oddfac_1 (x, n, 0);
- if (n <= TABLE_LIMIT_2N_MINUS_POPC_2N)
- count = __gmp_fac2cnt_table[n / 2 - 1];
- else
+ case 1:
+ MPZ_SET_1_NZ (ret, start);
+ b = start + step;
+ for (a = 0; a < count - 1; b += step, a++)
+ MPZ_MUL_1_POS (ret, ret, b);
+ return;
+ case 2:
+ MPZ_SET_1_NZ (ret, start * (start + step));
+ if (count == 2)
+ return;
+ for (b = start + 2 * step, a = count / 2 - 1; a != 0;
+ a--, b += 2 * step)
+ MPZ_MUL_1_POS (ret, ret, b * (b + step));
+ if (count % 2 == 1)
+ MPZ_MUL_1_POS (ret, ret, b);
+ return;
+ case 3:
+ if (count == 2)
+ {
+ MPZ_SET_1_NZ (ret, start * (start + step));
+ return;
+ }
+ MPZ_SET_1_NZ (ret, start * (start + step) * (start + 2 * step));
+ if (count == 3)
+ return;
+ for (b = start + 3 * step, a = count / 3 - 1; a != 0;
+ a--, b += 3 * step)
+ MPZ_MUL_1_POS (ret, ret, b * (b + step) * (b + 2 * step));
+ if (count % 3 == 2)
+ b = b * (b + step);
+ if (count % 3 != 0)
+ MPZ_MUL_1_POS (ret, ret, b);
+ return;
+ default: /* ie nm=4 */
+ if (count == 2)
+ {
+ MPZ_SET_1_NZ (ret, start * (start + step));
+ return;
+ }
+ if (count == 3)
{
- popc_limb (count, n);
- count = n - count;
+ MPZ_SET_1_NZ (ret, start * (start + step) * (start + 2 * step));
+ return;
}
- mpz_mul_2exp (x, x, count);
+ MPZ_SET_1_NZ (ret,
+ start * (start + step) * (start + 2 * step) * (start +
+ 3 * step));
+ if (count == 4)
+ return;
+ for (b = start + 4 * step, a = count / 4 - 1; a != 0;
+ a--, b += 4 * step)
+ MPZ_MUL_1_POS (ret, ret,
+ b * (b + step) * (b + 2 * step) * (b + 3 * step));
+ if (count % 4 == 2)
+ b = b * (b + step);
+ if (count % 4 == 3)
+ b = b * (b + step) * (b + 2 * step);
+ if (count % 4 != 0)
+ MPZ_MUL_1_POS (ret, ret, b);
+ return;
}
}
-#undef FACTORS_PER_LIMB
-#undef FACTOR_LIST_STORE
+/* return value in st[0]
+ odd_product(l,h)=sqrt((h/e)^h/(l/e)^l) using Stirling approx and e=exp(1)
+ so st[0] needs enough bits for above, st[1] needs half these bits and
+ st[2] needs 1/4 of these bits etc */
+static void
+odd_product (unsigned long low, unsigned long high, mpz_t * st)
+{
+ unsigned long stc = 1, stn = 0, n, y, mask, a, nm = 1;
+ signed long z;
+
+ low++;
+ if (low % 2 == 0)
+ low++;
+ if (high == 0)
+ high = 1;
+ if (high % 2 == 0)
+ high--;
+/* must have high>=low ? check this and remove test below */
+ if (high < low)
+ {
+ MPZ_SET_1_NZ (st[0], 1);
+ return;
+ }
+ if (high == low)
+ {
+ MPZ_SET_1_NZ (st[0], low);
+ return;
+ }
+ if (high <= FACMUL2 + 2)
+ {
+ nm = 2;
+ if (high <= FACMUL3 + 4)
+ {
+ nm = 3;
+ if (high <= FACMUL4 + 6)
+ nm = 4;
+ }
+ }
+ high = (high - low) / 2 + 1; /* high is now count,high<=2^(BITS_PER_ULONG-1) */
+ if (high <= (((unsigned long) 1) << APCONST))
+ {
+ ap_product_small (st[0], (mp_limb_t) low, CNST_LIMB(2), high, nm);
+ return;
+ }
+ count_leading_zeros (n, (mp_limb_t) high);
+/* assumes clz above is LIMB based not NUMB based */
+ n = GMP_LIMB_BITS - n - APCONST;
+ mask = (((unsigned long) 1) << n);
+ a = mask << 1;
+ mask--;
+/* have 2^(BITS_IN_N-APCONST) iterations so need
+ (BITS_IN_N-APCONST+1) stack entries */
+ for (z = mask; z >= 0; z--)
+ {
+ BITREV_ULONG (y, z);
+ y >>= (BITS_PER_ULONG - n);
+ ap_product_small (st[stn],
+ (mp_limb_t) (low + 2 * ((~y) & mask)), (mp_limb_t) a,
+ (high + y) >> n, nm);
+ ASSERT (((high + y) >> n) <= (((unsigned long) 1) << APCONST));
+ stn++;
+ y = stc++;
+ while ((y & 1) == 0)
+ {
+ mpz_mul (st[stn - 2], st[stn - 2], st[stn - 1]);
+ stn--;
+ y >>= 1;
+ }
+ }
+ ASSERT (stn == 1);
+ return;
+}
diff --git a/gmp/mpz/fdiv_q.c b/gmp/mpz/fdiv_q.c
index 5713b905b2..6b4c2c4d63 100644
--- a/gmp/mpz/fdiv_q.c
+++ b/gmp/mpz/fdiv_q.c
@@ -1,33 +1,22 @@
/* mpz_fdiv_q -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 2000, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,8 +24,8 @@ see https://www.gnu.org/licenses/. */
void
mpz_fdiv_q (mpz_ptr quot, mpz_srcptr dividend, mpz_srcptr divisor)
{
- mp_size_t dividend_size = SIZ (dividend);
- mp_size_t divisor_size = SIZ (divisor);
+ mp_size_t dividend_size = dividend->_mp_size;
+ mp_size_t divisor_size = divisor->_mp_size;
mpz_t rem;
TMP_DECL;
@@ -46,7 +35,7 @@ mpz_fdiv_q (mpz_ptr quot, mpz_srcptr dividend, mpz_srcptr divisor)
mpz_tdiv_qr (quot, rem, dividend, divisor);
- if ((divisor_size ^ dividend_size) < 0 && SIZ (rem) != 0)
+ if ((divisor_size ^ dividend_size) < 0 && rem->_mp_size != 0)
mpz_sub_ui (quot, quot, 1L);
TMP_FREE;
diff --git a/gmp/mpz/fdiv_q_ui.c b/gmp/mpz/fdiv_q_ui.c
index 7899992d04..9554185ccc 100644
--- a/gmp/mpz/fdiv_q_ui.c
+++ b/gmp/mpz/fdiv_q_ui.c
@@ -1,34 +1,23 @@
/* mpz_fdiv_q_ui -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 Free Software Foundation,
+Copyright 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ mpz_fdiv_q_ui (mpz_ptr quot, mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np, qp;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -51,7 +40,8 @@ mpz_fdiv_q_ui (mpz_ptr quot, mpz_srcptr dividend, unsigned long int divisor)
}
nn = ABS(ns);
- qp = MPZ_REALLOC (quot, nn);
+ MPZ_REALLOC (quot, nn);
+ qp = PTR(quot);
np = PTR(dividend);
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
diff --git a/gmp/mpz/fdiv_qr.c b/gmp/mpz/fdiv_qr.c
index 36cfd367ad..0230db1725 100644
--- a/gmp/mpz/fdiv_qr.c
+++ b/gmp/mpz/fdiv_qr.c
@@ -1,33 +1,22 @@
/* mpz_fdiv_qr -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 2000, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,7 +24,7 @@ see https://www.gnu.org/licenses/. */
void
mpz_fdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
{
- mp_size_t divisor_size = SIZ (divisor);
+ mp_size_t divisor_size = divisor->_mp_size;
mp_size_t xsize;
mpz_t temp_divisor; /* N.B.: lives until function returns! */
TMP_DECL;
@@ -52,10 +41,10 @@ mpz_fdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
divisor = temp_divisor;
}
- xsize = SIZ (dividend) ^ divisor_size;;
+ xsize = dividend->_mp_size ^ divisor_size;;
mpz_tdiv_qr (quot, rem, dividend, divisor);
- if (xsize < 0 && SIZ (rem) != 0)
+ if (xsize < 0 && rem->_mp_size != 0)
{
mpz_sub_ui (quot, quot, 1L);
mpz_add (rem, rem, divisor);
diff --git a/gmp/mpz/fdiv_qr_ui.c b/gmp/mpz/fdiv_qr_ui.c
index c8435a423c..7c41fc8421 100644
--- a/gmp/mpz/fdiv_qr_ui.c
+++ b/gmp/mpz/fdiv_qr_ui.c
@@ -1,34 +1,23 @@
/* mpz_fdiv_qr_ui -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 1999, 2001, 2002, 2004, 2012 Free Software Foundation,
+Copyright 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ mpz_fdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
mp_ptr np, qp;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -52,7 +41,8 @@ mpz_fdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
}
nn = ABS(ns);
- qp = MPZ_REALLOC (quot, nn);
+ MPZ_REALLOC (quot, nn);
+ qp = PTR(quot);
np = PTR(dividend);
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
diff --git a/gmp/mpz/fdiv_r.c b/gmp/mpz/fdiv_r.c
index 35f2789b14..56bcf4cb0b 100644
--- a/gmp/mpz/fdiv_r.c
+++ b/gmp/mpz/fdiv_r.c
@@ -1,33 +1,22 @@
/* mpz_fdiv_r -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,7 +24,7 @@ see https://www.gnu.org/licenses/. */
void
mpz_fdiv_r (mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
{
- mp_size_t divisor_size = SIZ (divisor);
+ mp_size_t divisor_size = divisor->_mp_size;
mpz_t temp_divisor; /* N.B.: lives until function returns! */
TMP_DECL;
@@ -53,7 +42,7 @@ mpz_fdiv_r (mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
mpz_tdiv_r (rem, dividend, divisor);
- if ((divisor_size ^ SIZ (dividend)) < 0 && SIZ (rem) != 0)
+ if ((divisor_size ^ dividend->_mp_size) < 0 && rem->_mp_size != 0)
mpz_add (rem, rem, divisor);
TMP_FREE;
diff --git a/gmp/mpz/fdiv_r_ui.c b/gmp/mpz/fdiv_r_ui.c
index 98dd56c6f2..d16e432258 100644
--- a/gmp/mpz/fdiv_r_ui.c
+++ b/gmp/mpz/fdiv_r_ui.c
@@ -1,34 +1,23 @@
/* mpz_fdiv_r_ui -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 Free Software Foundation,
+Copyright 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ mpz_fdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -60,7 +49,8 @@ mpz_fdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
mp_size_t rn;
TMP_DECL;
- rp = MPZ_REALLOC (rem, 2);
+ MPZ_REALLOC (rem, 2);
+ rp = PTR(rem);
if (nn == 1) /* tdiv_qr requirements; tested above for 0 */
{
diff --git a/gmp/mpz/fdiv_ui.c b/gmp/mpz/fdiv_ui.c
index 532ee2cbec..566b6e7250 100644
--- a/gmp/mpz/fdiv_ui.c
+++ b/gmp/mpz/fdiv_ui.c
@@ -1,34 +1,23 @@
/* mpz_fdiv_ui -- Division rounding the quotient towards -infinity.
The remainder gets the same sign as the denominator.
-Copyright 1994-1996, 2001, 2002, 2004, 2005, 2012 Free Software Foundation,
+Copyright 1994, 1995, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ mpz_fdiv_ui (mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
diff --git a/gmp/mpz/fib2_ui.c b/gmp/mpz/fib2_ui.c
index 122db8dd51..8521136804 100644
--- a/gmp/mpz/fib2_ui.c
+++ b/gmp/mpz/fib2_ui.c
@@ -1,32 +1,21 @@
/* mpz_fib2_ui -- calculate Fibonacci numbers.
-Copyright 2001, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -40,8 +29,10 @@ mpz_fib2_ui (mpz_ptr fn, mpz_ptr fnsub1, unsigned long n)
mp_size_t size;
size = MPN_FIB2_SIZE (n);
- fp = MPZ_REALLOC (fn, size);
- f1p = MPZ_REALLOC (fnsub1, size);
+ MPZ_REALLOC (fn, size);
+ MPZ_REALLOC (fnsub1, size);
+ fp = PTR (fn);
+ f1p = PTR (fnsub1);
size = mpn_fib2_ui (fp, f1p, n);
diff --git a/gmp/mpz/fib_ui.c b/gmp/mpz/fib_ui.c
index c0f57a0dc9..3e9aa1b32d 100644
--- a/gmp/mpz/fib_ui.c
+++ b/gmp/mpz/fib_ui.c
@@ -1,32 +1,21 @@
/* mpz_fib_ui -- calculate Fibonacci numbers.
-Copyright 2000-2002, 2005, 2012 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -72,26 +61,27 @@ mpz_fib_ui (mpz_ptr fn, unsigned long n)
n2 = n/2;
xalloc = MPN_FIB2_SIZE (n2) + 1;
- fp = MPZ_REALLOC (fn, 2*xalloc+1);
+ MPZ_REALLOC (fn, 2*xalloc+1);
+ fp = PTR (fn);
TMP_MARK;
TMP_ALLOC_LIMBS_2 (xp,xalloc, yp,xalloc);
size = mpn_fib2_ui (xp, yp, n2);
TRACE (printf ("mpz_fib_ui last step n=%lu size=%ld bit=%lu\n",
- n >> 1, size, n&1);
- mpn_trace ("xp", xp, size);
- mpn_trace ("yp", yp, size));
+ n >> 1, size, n&1);
+ mpn_trace ("xp", xp, size);
+ mpn_trace ("yp", yp, size));
if (n & 1)
{
/* F[2k+1] = (2F[k]+F[k-1])*(2F[k]-F[k-1]) + 2*(-1)^k */
mp_size_t xsize, ysize;
-#if HAVE_NATIVE_mpn_add_n_sub_n
+#if HAVE_NATIVE_mpn_addsub_n
xp[size] = mpn_lshift (xp, xp, size, 1);
yp[size] = 0;
- ASSERT_NOCARRY (mpn_add_n_sub_n (xp, yp, xp, yp, size+1));
+ ASSERT_NOCARRY (mpn_addsub_n (xp, yp, xp, yp, size+1));
xsize = size + (xp[size] != 0);
ysize = size + (yp[size] != 0);
#else
@@ -114,16 +104,16 @@ mpz_fib_ui (mpz_ptr fn, unsigned long n)
fp[0] += (n & 2 ? -CNST_LIMB(2) : CNST_LIMB(2));
#else
if (n & 2)
- {
- ASSERT (fp[0] >= 2);
- fp[0] -= 2;
- }
+ {
+ ASSERT (fp[0] >= 2);
+ fp[0] -= 2;
+ }
else
- {
- ASSERT (c != GMP_NUMB_MAX); /* because it's the high of a mul */
- c += mpn_add_1 (fp, fp, size-1, CNST_LIMB(2));
- fp[size-1] = c;
- }
+ {
+ ASSERT (c != GMP_NUMB_MAX); /* because it's the high of a mul */
+ c += mpn_add_1 (fp, fp, size-1, CNST_LIMB(2));
+ fp[size-1] = c;
+ }
#endif
}
else
@@ -146,7 +136,7 @@ mpz_fib_ui (mpz_ptr fn, unsigned long n)
SIZ(fn) = size;
TRACE (printf ("done special, size=%ld\n", size);
- mpn_trace ("fp ", fp, size));
+ mpn_trace ("fp ", fp, size));
TMP_FREE;
}
diff --git a/gmp/mpz/fits_s.h b/gmp/mpz/fits_s.h
index e7f21d1b2b..a91e82189f 100644
--- a/gmp/mpz/fits_s.h
+++ b/gmp/mpz/fits_s.h
@@ -1,39 +1,28 @@
/* int mpz_fits_X_p (mpz_t z) -- test whether z fits signed type X.
-Copyright 1997, 2000-2002 Free Software Foundation, Inc.
+Copyright 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
int
-FUNCTION (mpz_srcptr z) __GMP_NOTHROW
+FUNCTION (mpz_srcptr z)
{
mp_size_t n = SIZ(z);
mp_ptr p = PTR(z);
@@ -44,7 +33,7 @@ FUNCTION (mpz_srcptr z) __GMP_NOTHROW
if (n == 1)
return limb <= MAXIMUM;
if (n == -1)
- return limb <= NEG_CAST (mp_limb_t, MINIMUM);
+ return limb <= - (mp_limb_t) MINIMUM;
#if GMP_NAIL_BITS != 0
{
if ((p[1] >> GMP_NAIL_BITS) == 0)
@@ -53,7 +42,7 @@ FUNCTION (mpz_srcptr z) __GMP_NOTHROW
if (n == 2)
return limb <= MAXIMUM;
if (n == -2)
- return limb <= NEG_CAST (mp_limb_t, MINIMUM);
+ return limb <= - (mp_limb_t) MINIMUM;
}
}
#endif
diff --git a/gmp/mpz/fits_sint.c b/gmp/mpz/fits_sint.c
index d548c45b0d..6730b6c11f 100644
--- a/gmp/mpz/fits_sint.c
+++ b/gmp/mpz/fits_sint.c
@@ -1,32 +1,21 @@
-/* int mpz_fits_sint_p (mpz_t z) -- test whether z fits an int.
+/* int mpz_fits_sint_p (mpz_t z) -- test whether z fits a int.
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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpz_fits_sint_p
diff --git a/gmp/mpz/fits_slong.c b/gmp/mpz/fits_slong.c
index 9306a00c0f..e9c88e11e5 100644
--- a/gmp/mpz/fits_slong.c
+++ b/gmp/mpz/fits_slong.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpz_fits_slong_p
diff --git a/gmp/mpz/fits_sshort.c b/gmp/mpz/fits_sshort.c
index 431d6b06ce..f973c417e1 100644
--- a/gmp/mpz/fits_sshort.c
+++ b/gmp/mpz/fits_sshort.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 FUNCTION mpz_fits_sshort_p
diff --git a/gmp/mpz/fits_uint.c b/gmp/mpz/fits_uint.c
index a37e291b6e..c2b95e5796 100644
--- a/gmp/mpz/fits_uint.c
+++ b/gmp/mpz/fits_uint.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_fits_uint_p 1
diff --git a/gmp/mpz/fits_ulong.c b/gmp/mpz/fits_ulong.c
index fa40eb5671..71013e0a56 100644
--- a/gmp/mpz/fits_ulong.c
+++ b/gmp/mpz/fits_ulong.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_fits_ulong_p 1
diff --git a/gmp/mpz/fits_ushort.c b/gmp/mpz/fits_ushort.c
index 7f6f907821..47d37cd24b 100644
--- a/gmp/mpz/fits_ushort.c
+++ b/gmp/mpz/fits_ushort.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_fits_ushort_p 1
diff --git a/gmp/mpz/gcd.c b/gmp/mpz/gcd.c
index 87c6a8f17b..4fdb48fc15 100644
--- a/gmp/mpz/gcd.c
+++ b/gmp/mpz/gcd.c
@@ -1,89 +1,83 @@
/* mpz/gcd.c: Calculate the greatest common divisor of two integers.
-Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2010 Free Software
+Copyright 1991, 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+#ifdef BERKELEY_MP
+#include "mp.h"
+#endif
void
+#ifndef BERKELEY_MP
mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
+#else /* BERKELEY_MP */
+gcd (mpz_srcptr u, mpz_srcptr v, mpz_ptr g)
+#endif /* BERKELEY_MP */
{
unsigned long int g_zero_bits, u_zero_bits, v_zero_bits;
mp_size_t g_zero_limbs, u_zero_limbs, v_zero_limbs;
mp_ptr tp;
- mp_ptr up;
- mp_size_t usize;
- mp_ptr vp;
- mp_size_t vsize;
+ mp_ptr up = u->_mp_d;
+ mp_size_t usize = ABS (u->_mp_size);
+ mp_ptr vp = v->_mp_d;
+ mp_size_t vsize = ABS (v->_mp_size);
mp_size_t gsize;
TMP_DECL;
- up = PTR(u);
- usize = ABSIZ (u);
- vp = PTR(v);
- vsize = ABSIZ (v);
/* GCD(0, V) == V. */
if (usize == 0)
{
- SIZ (g) = vsize;
+ g->_mp_size = vsize;
if (g == v)
return;
- MPZ_REALLOC (g, vsize);
- MPN_COPY (PTR (g), vp, vsize);
+ if (g->_mp_alloc < vsize)
+ _mpz_realloc (g, vsize);
+ MPN_COPY (g->_mp_d, vp, vsize);
return;
}
/* GCD(U, 0) == U. */
if (vsize == 0)
{
- SIZ (g) = usize;
+ g->_mp_size = usize;
if (g == u)
return;
- MPZ_REALLOC (g, usize);
- MPN_COPY (PTR (g), up, usize);
+ if (g->_mp_alloc < usize)
+ _mpz_realloc (g, usize);
+ MPN_COPY (g->_mp_d, up, usize);
return;
}
if (usize == 1)
{
- SIZ (g) = 1;
- PTR (g)[0] = mpn_gcd_1 (vp, vsize, up[0]);
+ g->_mp_size = 1;
+ g->_mp_d[0] = mpn_gcd_1 (vp, vsize, up[0]);
return;
}
if (vsize == 1)
{
- SIZ(g) = 1;
- PTR (g)[0] = mpn_gcd_1 (up, usize, vp[0]);
+ g->_mp_size = 1;
+ g->_mp_d[0] = mpn_gcd_1 (up, usize, vp[0]);
return;
}
@@ -92,11 +86,11 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
/* Eliminate low zero bits from U and V and move to temporary storage. */
while (*up == 0)
up++;
- u_zero_limbs = up - PTR(u);
+ u_zero_limbs = up - u->_mp_d;
usize -= u_zero_limbs;
count_trailing_zeros (u_zero_bits, *up);
tp = up;
- up = TMP_ALLOC_LIMBS (usize);
+ up = (mp_ptr) TMP_ALLOC (usize * BYTES_PER_MP_LIMB);
if (u_zero_bits != 0)
{
mpn_rshift (up, tp, usize, u_zero_bits);
@@ -107,11 +101,11 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
while (*vp == 0)
vp++;
- v_zero_limbs = vp - PTR (v);
+ v_zero_limbs = vp - v->_mp_d;
vsize -= v_zero_limbs;
count_trailing_zeros (v_zero_bits, *vp);
tp = vp;
- vp = TMP_ALLOC_LIMBS (vsize);
+ vp = (mp_ptr) TMP_ALLOC (vsize * BYTES_PER_MP_LIMB);
if (v_zero_bits != 0)
{
mpn_rshift (vp, tp, vsize, v_zero_bits);
@@ -141,27 +135,29 @@ mpz_gcd (mpz_ptr g, mpz_srcptr u, mpz_srcptr v)
? mpn_gcd (vp, vp, vsize, up, usize)
: mpn_gcd (vp, up, usize, vp, vsize);
- /* Here G <-- V << (g_zero_limbs*GMP_LIMB_BITS + g_zero_bits). */
+ /* Here G <-- V << (g_zero_limbs*BITS_PER_MP_LIMB + g_zero_bits). */
gsize = vsize + g_zero_limbs;
if (g_zero_bits != 0)
{
mp_limb_t cy_limb;
gsize += (vp[vsize - 1] >> (GMP_NUMB_BITS - g_zero_bits)) != 0;
- MPZ_REALLOC (g, gsize);
- MPN_ZERO (PTR (g), g_zero_limbs);
+ if (g->_mp_alloc < gsize)
+ _mpz_realloc (g, gsize);
+ MPN_ZERO (g->_mp_d, g_zero_limbs);
- tp = PTR(g) + g_zero_limbs;
+ tp = g->_mp_d + g_zero_limbs;
cy_limb = mpn_lshift (tp, vp, vsize, g_zero_bits);
if (cy_limb != 0)
tp[vsize] = cy_limb;
}
else
{
- MPZ_REALLOC (g, gsize);
- MPN_ZERO (PTR (g), g_zero_limbs);
- MPN_COPY (PTR (g) + g_zero_limbs, vp, vsize);
+ if (g->_mp_alloc < gsize)
+ _mpz_realloc (g, gsize);
+ MPN_ZERO (g->_mp_d, g_zero_limbs);
+ MPN_COPY (g->_mp_d + g_zero_limbs, vp, vsize);
}
- SIZ (g) = gsize;
+ g->_mp_size = gsize;
TMP_FREE;
}
diff --git a/gmp/mpz/gcd_ui.c b/gmp/mpz/gcd_ui.c
index e26d03f64a..e73890da4b 100644
--- a/gmp/mpz/gcd_ui.c
+++ b/gmp/mpz/gcd_ui.c
@@ -1,32 +1,22 @@
-/* mpz_gcd_ui -- Calculate the greatest common divisor of two integers.
+/* mpz_gcd_ui -- Calculate the greatest common divisior of two integers.
-Copyright 1994, 1996, 1999-2004 Free Software Foundation, Inc.
+Copyright 1994, 1996, 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
diff --git a/gmp/mpz/gcdext.c b/gmp/mpz/gcdext.c
index 01b1f8379a..b1001a1b64 100644
--- a/gmp/mpz/gcdext.c
+++ b/gmp/mpz/gcdext.c
@@ -1,34 +1,23 @@
/* mpz_gcdext(g, s, t, a, b) -- Set G to gcd(a, b), and S and T such that
g = as + bt.
-Copyright 1991, 1993-1997, 2000, 2001, 2005, 2011, 2012 Free Software
+Copyright 1991, 1993, 1994, 1995, 1996, 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -37,86 +26,99 @@ see https://www.gnu.org/licenses/. */
void
mpz_gcdext (mpz_ptr g, mpz_ptr s, mpz_ptr t, mpz_srcptr a, mpz_srcptr b)
{
- mp_size_t asize, bsize;
- mp_ptr tmp_ap, tmp_bp;
+ mp_size_t asize, bsize, usize, vsize;
+ mp_srcptr ap, bp;
+ mp_ptr up, vp;
mp_size_t gsize, ssize, tmp_ssize;
- mp_ptr gp, tmp_gp, tmp_sp;
+ mp_ptr gp, sp, tmp_gp, tmp_sp;
+ mpz_srcptr u, v;
+ mpz_ptr ss, tt;
+ __mpz_struct stmp, gtmp;
TMP_DECL;
- /* mpn_gcdext requires that Usize >= Vsize. Therefore, we often
- have to swap U and V. The computed cofactor will be the
- "smallest" one, which is faster to produce. The wanted one will
- be computed here; this is needed anyway when both are requested. */
+ TMP_MARK;
- asize = ABSIZ (a);
- bsize = ABSIZ (b);
+ /* mpn_gcdext requires that U >= V. Therefore, we often have to swap U and
+ V. This in turn leads to a lot of complications. The computed cofactor
+ will be the wrong one, so we have to fix that up at the end. */
- if (asize < bsize)
+ asize = ABS (SIZ (a));
+ bsize = ABS (SIZ (b));
+ ap = PTR (a);
+ bp = PTR (b);
+ if (asize > bsize || (asize == bsize && mpn_cmp (ap, bp, asize) > 0))
{
- MPZ_SRCPTR_SWAP (a, b);
- MP_SIZE_T_SWAP (asize, bsize);
- MPZ_PTR_SWAP (s, t);
+ usize = asize;
+ vsize = bsize;
+ up = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB);
+ vp = (mp_ptr) TMP_ALLOC ((vsize + 1) * BYTES_PER_MP_LIMB);
+ MPN_COPY (up, ap, usize);
+ MPN_COPY (vp, bp, vsize);
+ u = a;
+ v = b;
+ ss = s;
+ tt = t;
}
-
- if (bsize == 0)
+ else
{
- /* g = |a|, s = sgn(a), t = 0. */
- ssize = SIZ (a) >= 0 ? (asize != 0) : -1;
-
- gp = MPZ_REALLOC (g, asize);
- MPN_COPY (gp, PTR (a), asize);
- SIZ (g) = asize;
-
- if (t != NULL)
- SIZ (t) = 0;
- if (s != NULL)
- {
- SIZ (s) = ssize;
- PTR (s)[0] = 1;
- }
- return;
+ usize = bsize;
+ vsize = asize;
+ up = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB);
+ vp = (mp_ptr) TMP_ALLOC ((vsize + 1) * BYTES_PER_MP_LIMB);
+ MPN_COPY (up, bp, usize);
+ MPN_COPY (vp, ap, vsize);
+ u = b;
+ v = a;
+ ss = t;
+ tt = s;
}
- TMP_MARK;
-
- TMP_ALLOC_LIMBS_2 (tmp_ap, asize, tmp_bp, bsize);
- MPN_COPY (tmp_ap, PTR (a), asize);
- MPN_COPY (tmp_bp, PTR (b), bsize);
-
- TMP_ALLOC_LIMBS_2 (tmp_gp, bsize, tmp_sp, bsize + 1);
-
- gsize = mpn_gcdext (tmp_gp, tmp_sp, &tmp_ssize, tmp_ap, asize, tmp_bp, bsize);
+ tmp_gp = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB);
+ tmp_sp = (mp_ptr) TMP_ALLOC ((usize + 1) * BYTES_PER_MP_LIMB);
- ssize = ABS (tmp_ssize);
- tmp_ssize = SIZ (a) >= 0 ? tmp_ssize : -tmp_ssize;
-
- if (t != NULL)
+ if (vsize == 0)
{
- mpz_t x;
- __mpz_struct gtmp, stmp;
+ tmp_sp[0] = 1;
+ tmp_ssize = 1;
+ MPN_COPY (tmp_gp, up, usize);
+ gsize = usize;
+ }
+ else
+ gsize = mpn_gcdext (tmp_gp, tmp_sp, &tmp_ssize, up, usize, vp, vsize);
+ ssize = ABS (tmp_ssize);
- PTR (&gtmp) = tmp_gp;
- SIZ (&gtmp) = gsize;
+ PTR (&gtmp) = tmp_gp;
+ SIZ (&gtmp) = gsize;
- PTR (&stmp) = tmp_sp;
- SIZ (&stmp) = tmp_ssize;
+ PTR (&stmp) = tmp_sp;
+ SIZ (&stmp) = (tmp_ssize ^ SIZ (u)) >= 0 ? ssize : -ssize;
- MPZ_TMP_INIT (x, ssize + asize + 1);
- mpz_mul (x, &stmp, a);
- mpz_sub (x, &gtmp, x);
- mpz_divexact (t, x, b);
+ if (tt != NULL)
+ {
+ if (SIZ (v) == 0)
+ SIZ (tt) = 0;
+ else
+ {
+ mpz_t x;
+ MPZ_TMP_INIT (x, ssize + usize + 1);
+ mpz_mul (x, &stmp, u);
+ mpz_sub (x, &gtmp, x);
+ mpz_tdiv_q (tt, x, v);
+ }
}
- if (s != NULL)
+ if (ss != NULL)
{
- mp_ptr sp;
-
- sp = MPZ_REALLOC (s, ssize);
+ if (ALLOC (ss) < ssize)
+ _mpz_realloc (ss, ssize);
+ sp = PTR (ss);
MPN_COPY (sp, tmp_sp, ssize);
- SIZ (s) = tmp_ssize;
+ SIZ (ss) = SIZ (&stmp);
}
- gp = MPZ_REALLOC (g, gsize);
+ if (ALLOC (g) < gsize)
+ _mpz_realloc (g, gsize);
+ gp = PTR (g);
MPN_COPY (gp, tmp_gp, gsize);
SIZ (g) = gsize;
diff --git a/gmp/mpz/get_d.c b/gmp/mpz/get_d.c
index ac653c5ba0..5643e2158f 100644
--- a/gmp/mpz/get_d.c
+++ b/gmp/mpz/get_d.c
@@ -1,32 +1,21 @@
/* double mpz_get_d (mpz_t src) -- Return the double approximation to SRC.
-Copyright 1996, 1997, 2000-2003 Free Software Foundation, Inc.
+Copyright 1996, 1997, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpz/get_d_2exp.c b/gmp/mpz/get_d_2exp.c
index 96314851bf..c3cf60c9d6 100644
--- a/gmp/mpz/get_d_2exp.c
+++ b/gmp/mpz/get_d_2exp.c
@@ -1,32 +1,21 @@
/* double mpz_get_d_2exp (signed long int *exp, mpz_t src).
-Copyright 2001, 2003, 2004, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,6 +26,7 @@ mpz_get_d_2exp (signed long int *exp2, mpz_srcptr src)
{
mp_size_t size, abs_size;
mp_srcptr ptr;
+ int cnt;
long exp;
size = SIZ(src);
@@ -48,7 +38,8 @@ mpz_get_d_2exp (signed long int *exp2, mpz_srcptr src)
ptr = PTR(src);
abs_size = ABS(size);
- MPN_SIZEINBASE_2EXP(exp, ptr, abs_size, 1);
+ count_leading_zeros (cnt, ptr[abs_size - 1]);
+ exp = abs_size * GMP_NUMB_BITS - (cnt - GMP_NAIL_BITS);
*exp2 = exp;
return mpn_get_d (ptr, abs_size, size, -exp);
}
diff --git a/gmp/mpz/get_si.c b/gmp/mpz/get_si.c
index 6e9752636b..1308308fed 100644
--- a/gmp/mpz/get_si.c
+++ b/gmp/mpz/get_si.c
@@ -1,41 +1,31 @@
/* mpz_get_si(integer) -- Return the least significant digit from INTEGER.
-Copyright 1991, 1993-1995, 2000-2002, 2006, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
signed long int
-mpz_get_si (mpz_srcptr z) __GMP_NOTHROW
+mpz_get_si (mpz_srcptr z)
{
- mp_ptr zp = PTR (z);
- mp_size_t size = SIZ (z);
+ mp_ptr zp = z->_mp_d;
+ mp_size_t size = z->_mp_size;
mp_limb_t zl = zp[0];
#if GMP_NAIL_BITS != 0
@@ -44,10 +34,10 @@ mpz_get_si (mpz_srcptr z) __GMP_NOTHROW
#endif
if (size > 0)
- return zl & LONG_MAX;
+ return (long) zl & LONG_MAX;
else if (size < 0)
/* This expression is necessary to properly handle 0x80000000 */
- return -1 - (long) ((zl - 1) & LONG_MAX);
+ return ~(((long) zl - 1L) & LONG_MAX);
else
return 0;
}
diff --git a/gmp/mpz/get_str.c b/gmp/mpz/get_str.c
index 08c7cd7371..cce519365c 100644
--- a/gmp/mpz/get_str.c
+++ b/gmp/mpz/get_str.c
@@ -4,34 +4,23 @@
result. If STRING is not NULL, the caller must ensure enough space is
available to store the result.
-Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <string.h> /* for strlen */
#include "gmp.h"
@@ -42,18 +31,19 @@ char *
mpz_get_str (char *res_str, int base, mpz_srcptr x)
{
mp_ptr xp;
- mp_size_t x_size = SIZ (x);
+ mp_size_t x_size = x->_mp_size;
+ char *str;
char *return_str;
size_t str_size;
size_t alloc_size = 0;
- const char *num_to_text;
+ char *num_to_text;
int i;
TMP_DECL;
if (base >= 0)
{
num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
+ if (base == 0)
base = 10;
else if (base > 36)
{
@@ -65,10 +55,6 @@ mpz_get_str (char *res_str, int base, mpz_srcptr x)
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
- return NULL;
num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
@@ -90,19 +76,29 @@ mpz_get_str (char *res_str, int base, mpz_srcptr x)
/* mpn_get_str clobbers its input on non power-of-2 bases */
TMP_MARK;
- xp = PTR (x);
+ xp = x->_mp_d;
if (! POW2_P (base))
{
- xp = TMP_ALLOC_LIMBS (x_size | 1); /* |1 in case x_size==0 */
- MPN_COPY (xp, PTR (x), x_size);
+ xp = TMP_ALLOC_LIMBS (x_size + 1); /* +1 in case x_size==0 */
+ MPN_COPY (xp, x->_mp_d, x_size);
}
str_size = mpn_get_str ((unsigned char *) res_str, base, xp, x_size);
ASSERT (alloc_size == 0 || str_size <= alloc_size - (SIZ(x) < 0));
- /* Convert result to printable chars. */
+ /* might have a leading zero, skip it */
+ str = res_str;
+ if (*res_str == 0 && str_size != 1)
+ {
+ str_size--;
+ str++;
+ ASSERT (*str != 0); /* at most one leading zero */
+ }
+
+ /* Convert result to printable chars, and move down if there was a leading
+ zero. */
for (i = 0; i < str_size; i++)
- res_str[i] = num_to_text[(int) res_str[i]];
+ res_str[i] = num_to_text[(int) str[i]];
res_str[str_size] = 0;
TMP_FREE;
@@ -113,7 +109,7 @@ mpz_get_str (char *res_str, int base, mpz_srcptr x)
size_t actual_size = str_size + 1 + (res_str - return_str);
ASSERT (actual_size == strlen (return_str) + 1);
__GMP_REALLOCATE_FUNC_MAYBE_TYPE (return_str, alloc_size, actual_size,
- char);
+ char);
}
return return_str;
}
diff --git a/gmp/mpz/get_ui.c b/gmp/mpz/get_ui.c
index ca97788b74..a94af63303 100644
--- a/gmp/mpz/get_ui.c
+++ b/gmp/mpz/get_ui.c
@@ -1,32 +1,21 @@
/* mpz_get_ui(integer) -- Return the least significant digit from INTEGER.
-Copyright 1991, 1993-1995, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_get_ui 1
diff --git a/gmp/mpz/getlimbn.c b/gmp/mpz/getlimbn.c
index c531f7e61f..dc7771e355 100644
--- a/gmp/mpz/getlimbn.c
+++ b/gmp/mpz/getlimbn.c
@@ -1,32 +1,21 @@
/* mpz_getlimbn(integer,n) -- Return the N:th limb from INTEGER.
-Copyright 1993-1996, 2001 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_getlimbn 1
diff --git a/gmp/mpz/hamdist.c b/gmp/mpz/hamdist.c
index 146769c394..0f25361b6f 100644
--- a/gmp/mpz/hamdist.c
+++ b/gmp/mpz/hamdist.c
@@ -1,43 +1,32 @@
/* mpz_hamdist -- calculate hamming distance.
-Copyright 1994, 1996, 2001, 2002, 2009-2011 Free Software Foundation, Inc.
+Copyright 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_bitcnt_t
-mpz_hamdist (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
+unsigned long
+mpz_hamdist (mpz_srcptr u, mpz_srcptr v)
{
mp_srcptr up, vp;
mp_size_t usize, vsize;
- mp_bitcnt_t count;
+ unsigned long count;
usize = SIZ(u);
vsize = SIZ(v);
@@ -48,20 +37,20 @@ mpz_hamdist (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
if (usize >= 0)
{
if (vsize < 0)
- return ~ (mp_bitcnt_t) 0;
+ return ~ (unsigned long) 0;
/* positive/positive */
if (usize < vsize)
- MPN_SRCPTR_SWAP (up,usize, vp,vsize);
+ MPN_SRCPTR_SWAP (up,usize, vp,vsize);
count = 0;
if (vsize != 0)
- count = mpn_hamdist (up, vp, vsize);
+ count = mpn_hamdist (up, vp, vsize);
usize -= vsize;
if (usize != 0)
- count += mpn_popcount (up + vsize, usize);
+ count += mpn_popcount (up + vsize, usize);
return count;
}
@@ -71,7 +60,7 @@ mpz_hamdist (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
mp_size_t old_vsize, step;
if (vsize >= 0)
- return ~ (mp_bitcnt_t) 0;
+ return ~ (unsigned long) 0;
/* negative/negative */
@@ -80,96 +69,96 @@ mpz_hamdist (mpz_srcptr u, mpz_srcptr v) __GMP_NOTHROW
/* skip common low zeros */
for (;;)
- {
- ASSERT (usize > 0);
- ASSERT (vsize > 0);
+ {
+ ASSERT (usize > 0);
+ ASSERT (vsize > 0);
- usize--;
- vsize--;
+ usize--;
+ vsize--;
- ulimb = *up++;
- vlimb = *vp++;
+ ulimb = *up++;
+ vlimb = *vp++;
- if (ulimb != 0)
- break;
+ if (ulimb != 0)
+ break;
- if (vlimb != 0)
- {
- MPN_SRCPTR_SWAP (up,usize, vp,vsize);
- ulimb = vlimb;
- vlimb = 0;
- break;
- }
- }
+ if (vlimb != 0)
+ {
+ MPN_SRCPTR_SWAP (up,usize, vp,vsize);
+ ulimb = vlimb;
+ vlimb = 0;
+ break;
+ }
+ }
/* twos complement first non-zero limbs (ulimb is non-zero, but vlimb
- might be zero) */
+ might be zero) */
ulimb = -ulimb;
vlimb = -vlimb;
popc_limb (count, (ulimb ^ vlimb) & GMP_NUMB_MASK);
if (vlimb == 0)
- {
- mp_bitcnt_t twoscount;
-
- /* first non-zero of v */
- old_vsize = vsize;
- do
- {
- ASSERT (vsize > 0);
- vsize--;
- vlimb = *vp++;
- }
- while (vlimb == 0);
-
- /* part of u corresponding to skipped v zeros */
- step = old_vsize - vsize - 1;
- count += step * GMP_NUMB_BITS;
- step = MIN (step, usize);
- if (step != 0)
- {
- count -= mpn_popcount (up, step);
- usize -= step;
- up += step;
- }
-
- /* First non-zero vlimb as twos complement, xor with ones
- complement ulimb. Note -v^(~0^u) == (v-1)^u. */
- vlimb--;
- if (usize != 0)
- {
- usize--;
- vlimb ^= *up++;
- }
- popc_limb (twoscount, vlimb);
- count += twoscount;
- }
+ {
+ unsigned long twoscount;
+
+ /* first non-zero of v */
+ old_vsize = vsize;
+ do
+ {
+ ASSERT (vsize > 0);
+ vsize--;
+ vlimb = *vp++;
+ }
+ while (vlimb == 0);
+
+ /* part of u corresponding to skipped v zeros */
+ step = old_vsize - vsize - 1;
+ count += step * GMP_NUMB_BITS;
+ step = MIN (step, usize);
+ if (step != 0)
+ {
+ count -= mpn_popcount (up, step);
+ usize -= step;
+ up += step;
+ }
+
+ /* First non-zero vlimb as twos complement, xor with ones
+ complement ulimb. Note -v^(~0^u) == (v-1)^u. */
+ vlimb--;
+ if (usize != 0)
+ {
+ usize--;
+ vlimb ^= *up++;
+ }
+ popc_limb (twoscount, vlimb);
+ count += twoscount;
+ }
/* Overlapping part of u and v, if any. Ones complement both, so just
- plain hamdist. */
+ plain hamdist. */
step = MIN (usize, vsize);
if (step != 0)
- {
- count += mpn_hamdist (up, vp, step);
- usize -= step;
- vsize -= step;
- up += step;
- vp += step;
- }
+ {
+ count += mpn_hamdist (up, vp, step);
+ usize -= step;
+ vsize -= step;
+ up += step;
+ vp += step;
+ }
/* Remaining high part of u or v, if any, ones complement but xor
- against all ones in the other, so plain popcount. */
+ against all ones in the other, so plain popcount. */
if (usize != 0)
- {
- remaining:
- count += mpn_popcount (up, usize);
- }
+ {
+ remaining:
+ count += mpn_popcount (up, usize);
+ }
else if (vsize != 0)
- {
- up = vp;
- usize = vsize;
- goto remaining;
- }
+ {
+ up = vp;
+ usize = vsize;
+ goto remaining;
+ }
return count;
}
}
diff --git a/gmp/mpz/import.c b/gmp/mpz/import.c
index 9072830afe..17e3d58759 100644
--- a/gmp/mpz/import.c
+++ b/gmp/mpz/import.c
@@ -1,32 +1,21 @@
/* mpz_import -- set mpz from word data.
-Copyright 2002, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -48,7 +37,7 @@ static const mp_limb_t endian_test = (CNST_LIMB(1) << (GMP_LIMB_BITS-7)) - 1;
void
mpz_import (mpz_ptr z, size_t count, int order,
- size_t size, int endian, size_t nail, const void *data)
+ size_t size, int endian, size_t nail, const void *data)
{
mp_size_t zsize;
mp_ptr zp;
@@ -57,8 +46,9 @@ mpz_import (mpz_ptr z, size_t count, int order,
ASSERT (endian == 1 || endian == 0 || endian == -1);
ASSERT (nail <= 8*size);
- zsize = BITS_TO_LIMBS (count * (8*size - nail));
- zp = MPZ_NEWALLOC (z, zsize);
+ zsize = (count * (8*size - nail) + GMP_NUMB_BITS-1) / GMP_NUMB_BITS;
+ MPZ_REALLOC (z, zsize);
+ zp = PTR(z);
if (endian == 0)
endian = HOST_ENDIAN;
@@ -70,31 +60,31 @@ mpz_import (mpz_ptr z, size_t count, int order,
unsigned align = ((char *) data - (char *) NULL) % sizeof (mp_limb_t);
if (order == -1
- && size == sizeof (mp_limb_t)
- && endian == HOST_ENDIAN
- && align == 0)
- {
- MPN_COPY (zp, (mp_srcptr) data, (mp_size_t) count);
- goto done;
- }
+ && size == sizeof (mp_limb_t)
+ && endian == HOST_ENDIAN
+ && align == 0)
+ {
+ MPN_COPY (zp, (mp_srcptr) data, (mp_size_t) count);
+ goto done;
+ }
if (order == -1
- && size == sizeof (mp_limb_t)
- && endian == - HOST_ENDIAN
- && align == 0)
- {
- MPN_BSWAP (zp, (mp_srcptr) data, (mp_size_t) count);
- goto done;
- }
+ && size == sizeof (mp_limb_t)
+ && endian == - HOST_ENDIAN
+ && align == 0)
+ {
+ MPN_BSWAP (zp, (mp_srcptr) data, (mp_size_t) count);
+ goto done;
+ }
if (order == 1
- && size == sizeof (mp_limb_t)
- && endian == HOST_ENDIAN
- && align == 0)
- {
- MPN_REVERSE (zp, (mp_srcptr) data, (mp_size_t) count);
- goto done;
- }
+ && size == sizeof (mp_limb_t)
+ && endian == HOST_ENDIAN
+ && align == 0)
+ {
+ MPN_REVERSE (zp, (mp_srcptr) data, (mp_size_t) count);
+ goto done;
+ }
}
{
@@ -142,34 +132,34 @@ mpz_import (mpz_ptr z, size_t count, int order,
lbits = 0;
for (i = 0; i < count; i++)
{
- for (j = 0; j < wbytes; j++)
- {
- byte = *dp;
- dp -= endian;
- ACCUMULATE (8);
- }
- if (wbits != 0)
- {
- byte = *dp & wbitsmask;
- dp -= endian;
- ACCUMULATE (wbits);
- }
- dp += woffset;
+ for (j = 0; j < wbytes; j++)
+ {
+ byte = *dp;
+ dp -= endian;
+ ACCUMULATE (8);
+ }
+ if (wbits != 0)
+ {
+ byte = *dp & wbitsmask;
+ dp -= endian;
+ ACCUMULATE (wbits);
+ }
+ dp += woffset;
}
if (lbits != 0)
{
- ASSERT (lbits <= GMP_NUMB_BITS);
- ASSERT_LIMB (limb);
- *zp++ = limb;
+ ASSERT (lbits <= GMP_NUMB_BITS);
+ ASSERT_LIMB (limb);
+ *zp++ = limb;
}
ASSERT (zp == PTR(z) + zsize);
/* low byte of word after most significant */
ASSERT (dp == (unsigned char *) data
- + (order < 0 ? count*size : - (mp_size_t) size)
- + (endian >= 0 ? (mp_size_t) size - 1 : 0));
+ + (order < 0 ? count*size : - (mp_size_t) size)
+ + (endian >= 0 ? (mp_size_t) size - 1 : 0));
}
diff --git a/gmp/mpz/init.c b/gmp/mpz/init.c
index 09df9df5c8..5fc0ed9d8e 100644
--- a/gmp/mpz/init.c
+++ b/gmp/mpz/init.c
@@ -1,32 +1,22 @@
/* mpz_init() -- Make a new multiple precision number with value 0.
-Copyright 1991, 1993-1995, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -34,12 +24,12 @@ see https://www.gnu.org/licenses/. */
void
mpz_init (mpz_ptr x)
{
- ALLOC (x) = 1;
- PTR (x) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
- SIZ (x) = 0;
+ x->_mp_alloc = 1;
+ x->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+ x->_mp_size = 0;
#ifdef __CHECKER__
/* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR (x) = 0;
+ x->_mp_d[0] = 0;
#endif
}
diff --git a/gmp/mpz/init2.c b/gmp/mpz/init2.c
index b942e499d6..6c271bde45 100644
--- a/gmp/mpz/init2.c
+++ b/gmp/mpz/init2.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdlib.h>
#include <stdio.h>
@@ -34,7 +23,7 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
void
-mpz_init2 (mpz_ptr x, mp_bitcnt_t bits)
+mpz_init2 (mpz_ptr x, unsigned long bits)
{
mp_size_t new_alloc;
diff --git a/gmp/mpz/inits.c b/gmp/mpz/inits.c
deleted file mode 100644
index 0488edaa44..0000000000
--- a/gmp/mpz/inits.c
+++ /dev/null
@@ -1,49 +0,0 @@
-/* mpz_inits() -- Initialize multiple mpz_t variables and set them to 0.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 <stdarg.h>
-#include <stdio.h> /* for NULL */
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-mpz_inits (mpz_ptr x, ...)
-{
- va_list ap;
-
- va_start (ap, x);
-
- while (x != NULL)
- {
- mpz_init (x);
- x = va_arg (ap, mpz_ptr);
- }
- va_end (ap);
-}
diff --git a/gmp/mpz/inp_raw.c b/gmp/mpz/inp_raw.c
index d95c19ede7..497207e60a 100644
--- a/gmp/mpz/inp_raw.c
+++ b/gmp/mpz/inp_raw.c
@@ -1,32 +1,21 @@
/* mpz_inp_raw -- read an mpz_t in raw format.
-Copyright 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -51,7 +40,7 @@ see https://www.gnu.org/licenses/. */
mp_limb_t __limb; \
int __i; \
__limb = 0; \
- for (__i = 0; __i < GMP_LIMB_BYTES; __i++) \
+ for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++) \
__limb = (__limb << 8) | __p[__i]; \
(limb) = __limb; \
} while (0)
@@ -93,78 +82,79 @@ mpz_inp_raw (mpz_ptr x, FILE *fp)
abs_csize = ABS (csize);
/* round up to a multiple of limbs */
- abs_xsize = BITS_TO_LIMBS (abs_csize*8);
+ abs_xsize = (abs_csize*8 + GMP_NUMB_BITS-1) / GMP_NUMB_BITS;
if (abs_xsize != 0)
{
- xp = MPZ_NEWALLOC (x, abs_xsize);
+ MPZ_REALLOC (x, abs_xsize);
+ xp = PTR(x);
/* Get limb boundaries right in the read, for the benefit of the
- non-nails case. */
+ non-nails case. */
xp[0] = 0;
cp = (char *) (xp + abs_xsize) - abs_csize;
if (fread (cp, abs_csize, 1, fp) != 1)
- return 0;
+ return 0;
if (GMP_NAIL_BITS == 0)
- {
- /* Reverse limbs to least significant first, and byte swap. If
- abs_xsize is odd then on the last iteration elimb and slimb are
- the same. It doesn't seem extra code to handle that case
- separately, to save an NTOH. */
- sp = xp;
- ep = xp + abs_xsize-1;
- for (i = 0; i < (abs_xsize+1)/2; i++)
- {
- NTOH_LIMB_FETCH (elimb, ep);
- NTOH_LIMB_FETCH (slimb, sp);
- *sp++ = elimb;
- *ep-- = slimb;
- }
- }
+ {
+ /* Reverse limbs to least significant first, and byte swap. If
+ abs_xsize is odd then on the last iteration elimb and slimb are
+ the same. It doesn't seem extra code to handle that case
+ separately, to save an NTOH. */
+ sp = xp;
+ ep = xp + abs_xsize-1;
+ for (i = 0; i < (abs_xsize+1)/2; i++)
+ {
+ NTOH_LIMB_FETCH (elimb, ep);
+ NTOH_LIMB_FETCH (slimb, sp);
+ *sp++ = elimb;
+ *ep-- = slimb;
+ }
+ }
else
- {
- /* It ought to be possible to do the transformation in-place, but
- for now it's easier to use an extra temporary area. */
- mp_limb_t byte, limb;
- int bits;
- mp_size_t tpos;
- mp_ptr tp;
- TMP_DECL;
-
- TMP_MARK;
- tp = TMP_ALLOC_LIMBS (abs_xsize);
- limb = 0;
- bits = 0;
- tpos = 0;
- for (i = abs_csize-1; i >= 0; i--)
- {
- byte = (unsigned char) cp[i];
- limb |= (byte << bits);
- bits += 8;
- if (bits >= GMP_NUMB_BITS)
- {
- ASSERT (tpos < abs_xsize);
- tp[tpos++] = limb & GMP_NUMB_MASK;
- bits -= GMP_NUMB_BITS;
- ASSERT (bits < 8);
- limb = byte >> (8 - bits);
- }
- }
- if (bits != 0)
- {
- ASSERT (tpos < abs_xsize);
- tp[tpos++] = limb;
- }
- ASSERT (tpos == abs_xsize);
-
- MPN_COPY (xp, tp, abs_xsize);
- TMP_FREE;
- }
+ {
+ /* It ought to be possible to do the transformation in-place, but
+ for now it's easier to use an extra temporary area. */
+ mp_limb_t byte, limb;
+ int bits;
+ mp_size_t tpos;
+ mp_ptr tp;
+ TMP_DECL;
+
+ TMP_MARK;
+ tp = TMP_ALLOC_LIMBS (abs_xsize);
+ limb = 0;
+ bits = 0;
+ tpos = 0;
+ for (i = abs_csize-1; i >= 0; i--)
+ {
+ byte = (unsigned char) cp[i];
+ limb |= (byte << bits);
+ bits += 8;
+ if (bits >= GMP_NUMB_BITS)
+ {
+ ASSERT (tpos < abs_xsize);
+ tp[tpos++] = limb & GMP_NUMB_MASK;
+ bits -= GMP_NUMB_BITS;
+ ASSERT (bits < 8);
+ limb = byte >> (8 - bits);
+ }
+ }
+ if (bits != 0)
+ {
+ ASSERT (tpos < abs_xsize);
+ tp[tpos++] = limb;
+ }
+ ASSERT (tpos == abs_xsize);
+
+ MPN_COPY (xp, tp, abs_xsize);
+ TMP_FREE;
+ }
/* GMP 1.x mpz_out_raw wrote high zero bytes, strip any high zero
- limbs resulting from this. Should be a non-zero value here, but
- for safety don't assume that. */
+ limbs resulting from this. Should be a non-zero value here, but
+ for safety don't assume that. */
MPN_NORMALIZE (xp, abs_xsize);
}
diff --git a/gmp/mpz/inp_str.c b/gmp/mpz/inp_str.c
index 474bc68435..05c8cde908 100644
--- a/gmp/mpz/inp_str.c
+++ b/gmp/mpz/inp_str.c
@@ -5,41 +5,30 @@
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-2003, 2011-2013 Free Software
+Copyright 1991, 1993, 1994, 1996, 1998, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <ctype.h>
#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
+extern const unsigned char __gmp_digit_value_tab[];
#define digit_value_tab __gmp_digit_value_tab
size_t
@@ -83,7 +72,7 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
{
/* For bases > 36, use the collating sequence
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. */
- digit_value += 208;
+ digit_value += 224;
if (base > 62)
return 0; /* too large base */
}
@@ -158,16 +147,17 @@ mpz_inp_str_nowhite (mpz_ptr x, FILE *stream, int base, int c, size_t nread)
/* Make sure the string is not empty, mpn_set_str would fail. */
if (str_size == 0)
{
- SIZ (x) = 0;
+ x->_mp_size = 0;
}
else
{
- LIMBS_PER_DIGIT_IN_BASE (xsize, str_size, base);
+ xsize = 2 + (mp_size_t)
+ (str_size / (GMP_NUMB_BITS * mp_bases[base].chars_per_bit_exactly));
MPZ_REALLOC (x, xsize);
/* Convert the byte array in base BASE to our bignum format. */
- xsize = mpn_set_str (PTR (x), (unsigned char *) str, str_size, base);
- SIZ (x) = negative ? -xsize : xsize;
+ xsize = mpn_set_str (x->_mp_d, (unsigned char *) str, str_size, base);
+ x->_mp_size = negative ? -xsize : xsize;
}
(*__gmp_free_func) (str, alloc_size);
return nread;
diff --git a/gmp/mpz/invert.c b/gmp/mpz/invert.c
index 09cdd9a121..009a03c42d 100644
--- a/gmp/mpz/invert.c
+++ b/gmp/mpz/invert.c
@@ -2,33 +2,23 @@
If X has an inverse, return non-zero and store inverse in INVERSE,
otherwise, return 0 and put garbage in INVERSE.
-Copyright 1996-2001, 2005, 2012, 2014 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,10 +30,17 @@ mpz_invert (mpz_ptr inverse, mpz_srcptr x, mpz_srcptr n)
mp_size_t xsize, nsize, size;
TMP_DECL;
- xsize = ABSIZ (x);
- nsize = ABSIZ (n);
-
+ xsize = SIZ (x);
+ nsize = SIZ (n);
+ xsize = ABS (xsize);
+ nsize = ABS (nsize);
size = MAX (xsize, nsize) + 1;
+
+ /* 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;
+
TMP_MARK;
MPZ_TMP_INIT (gcd, size);
@@ -51,7 +48,7 @@ mpz_invert (mpz_ptr inverse, mpz_srcptr x, mpz_srcptr n)
mpz_gcdext (gcd, tmp, (mpz_ptr) 0, x, n);
/* If no inverse existed, return with an indication of that. */
- if (!MPZ_EQUAL_1_P (gcd))
+ if (SIZ (gcd) != 1 || PTR(gcd)[0] != 1)
{
TMP_FREE;
return 0;
diff --git a/gmp/mpz/ior.c b/gmp/mpz/ior.c
index 5c181f04c4..26362c9428 100644
--- a/gmp/mpz/ior.c
+++ b/gmp/mpz/ior.c
@@ -1,33 +1,22 @@
/* mpz_ior -- Logical inclusive or.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2005, 2012, 2013 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2005 Free Software
+Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -58,32 +47,34 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
if (ALLOC(res) < op1_size)
{
- res_ptr = MPZ_REALLOC (res, op1_size);
+ _mpz_realloc (res, op1_size);
/* No overlapping possible: op1_ptr = PTR(op1); */
op2_ptr = PTR(op2);
+ res_ptr = PTR(res);
}
if (res_ptr != op1_ptr)
MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
op1_size - op2_size);
- if (LIKELY (op2_size != 0))
- mpn_ior_n (res_ptr, op1_ptr, op2_ptr, op2_size);
+ for (i = op2_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] | op2_ptr[i];
res_size = op1_size;
}
else
{
if (ALLOC(res) < op2_size)
{
- res_ptr = MPZ_REALLOC (res, op2_size);
+ _mpz_realloc (res, op2_size);
op1_ptr = PTR(op1);
/* No overlapping possible: op2_ptr = PTR(op2); */
+ res_ptr = PTR(res);
}
if (res_ptr != op2_ptr)
MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
op2_size - op1_size);
- if (LIKELY (op1_size != 0))
- mpn_ior_n (res_ptr, op1_ptr, op2_ptr, op1_size);
+ for (i = op1_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] | op2_ptr[i];
res_size = op2_size;
}
@@ -99,7 +90,8 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
if (op2_size < 0)
{
- mp_ptr opx, opy;
+ mp_ptr opx;
+ mp_limb_t cy;
/* Both operands are negative, so will be the result.
-((-OP1) | (-OP2)) = -(~(OP1 - 1) | ~(OP2 - 1)) =
@@ -113,12 +105,20 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
/* Possible optimization: Decrease mpn_sub precision,
as we won't use the entire res of both. */
- TMP_ALLOC_LIMBS_2 (opx, res_size, opy, res_size);
+ opx = TMP_ALLOC_LIMBS (res_size);
mpn_sub_1 (opx, op1_ptr, res_size, (mp_limb_t) 1);
op1_ptr = opx;
- mpn_sub_1 (opy, op2_ptr, res_size, (mp_limb_t) 1);
- op2_ptr = opy;
+ opx = TMP_ALLOC_LIMBS (res_size);
+ mpn_sub_1 (opx, op2_ptr, res_size, (mp_limb_t) 1);
+ op2_ptr = opx;
+
+ if (ALLOC(res) < res_size)
+ {
+ _mpz_realloc (res, res_size);
+ /* op1_ptr and op2_ptr point to temporary space. */
+ res_ptr = PTR(res);
+ }
/* First loop finds the size of the result. */
for (i = res_size - 1; i >= 0; i--)
@@ -128,14 +128,16 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
if (res_size != 0)
{
- res_ptr = MPZ_NEWALLOC (res, res_size + 1);
-
/* Second loop computes the real result. */
- mpn_and_n (res_ptr, op1_ptr, op2_ptr, res_size);
+ for (i = res_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] & op2_ptr[i];
- res_ptr[res_size] = 0;
- MPN_INCR_U (res_ptr, res_size + 1, 1);
- res_size += res_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++;
+ }
}
else
{
@@ -151,8 +153,8 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
/* We should compute -OP1 | OP2. Swap OP1 and OP2 and fall
through to the code that handles OP1 | -OP2. */
- MPZ_SRCPTR_SWAP (op1, op2);
- MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
+ MPZ_SRCPTR_SWAP (op1, op2);
+ MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
}
}
@@ -208,8 +210,8 @@ mpz_ior (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
if (res_size != 0)
{
/* Second loop computes the real result. */
- if (LIKELY (count != 0))
- mpn_andn_n (res_ptr, op2_ptr, op1_ptr, count);
+ for (i = count - 1; i >= 0; i--)
+ res_ptr[i] = ~op1_ptr[i] & op2_ptr[i];
cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
if (cy)
diff --git a/gmp/mpz/iset.c b/gmp/mpz/iset.c
index b6fbf490fd..384ca797e7 100644
--- a/gmp/mpz/iset.c
+++ b/gmp/mpz/iset.c
@@ -1,34 +1,23 @@
/* mpz_init_set (src_integer) -- Make a new multiple precision number with
a value copied from SRC_INTEGER.
-Copyright 1991, 1993, 1994, 1996, 2000-2002, 2012 Free Software Foundation,
+Copyright 1991, 1993, 1994, 1996, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -39,17 +28,17 @@ mpz_init_set (mpz_ptr w, mpz_srcptr u)
mp_ptr wp, up;
mp_size_t usize, size;
- usize = SIZ (u);
+ usize = u->_mp_size;
size = ABS (usize);
- ALLOC (w) = MAX (size, 1);
- PTR (w) = (mp_ptr) (*__gmp_allocate_func) ((size_t) ALLOC (w) * GMP_LIMB_BYTES);
+ w->_mp_alloc = MAX (size, 1);
+ w->_mp_d = (mp_ptr) (*__gmp_allocate_func) (w->_mp_alloc * BYTES_PER_MP_LIMB);
- wp = PTR (w);
- up = PTR (u);
+ wp = w->_mp_d;
+ up = u->_mp_d;
MPN_COPY (wp, up, size);
- SIZ (w) = usize;
+ w->_mp_size = usize;
#ifdef __CHECKER__
/* let the low limb look initialized, for the benefit of mpz_get_ui etc */
diff --git a/gmp/mpz/iset_d.c b/gmp/mpz/iset_d.c
index a450abcb3e..004b087e54 100644
--- a/gmp/mpz/iset_d.c
+++ b/gmp/mpz/iset_d.c
@@ -1,33 +1,22 @@
/* mpz_init_set_d(integer, val) -- Initialize and assign INTEGER with a double
value VAL.
-Copyright 1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1996, 2000, 2001 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,8 +24,8 @@ see https://www.gnu.org/licenses/. */
void
mpz_init_set_d (mpz_ptr dest, double val)
{
- ALLOC (dest) = 1;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
- SIZ (dest) = 0;
+ dest->_mp_alloc = 1;
+ dest->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+ dest->_mp_size = 0;
mpz_set_d (dest, val);
}
diff --git a/gmp/mpz/iset_si.c b/gmp/mpz/iset_si.c
index 107577795a..0eb3881f45 100644
--- a/gmp/mpz/iset_si.c
+++ b/gmp/mpz/iset_si.c
@@ -1,33 +1,23 @@
/* mpz_init_set_si(dest,val) -- Make a new multiple precision in DEST and
assign VAL to the new number.
-Copyright 1991, 1993-1995, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,22 +28,22 @@ mpz_init_set_si (mpz_ptr dest, signed long int val)
mp_size_t size;
mp_limb_t vl;
- ALLOC (dest) = 1;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ dest->_mp_alloc = 1;
+ dest->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
- vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
+ vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
- PTR (dest)[0] = vl & GMP_NUMB_MASK;
+ dest->_mp_d[0] = vl & GMP_NUMB_MASK;
size = vl != 0;
#if GMP_NAIL_BITS != 0
if (vl > GMP_NUMB_MAX)
{
MPZ_REALLOC (dest, 2);
- PTR (dest)[1] = vl >> GMP_NUMB_BITS;
+ dest->_mp_d[1] = vl >> GMP_NUMB_BITS;
size = 2;
}
#endif
- SIZ (dest) = val >= 0 ? size : -size;
+ dest->_mp_size = val >= 0 ? size : -size;
}
diff --git a/gmp/mpz/iset_str.c b/gmp/mpz/iset_str.c
index e31742ce65..302126fdcf 100644
--- a/gmp/mpz/iset_str.c
+++ b/gmp/mpz/iset_str.c
@@ -1,35 +1,27 @@
-/* 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.
+/* 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.
-Copyright 1991, 1993-1995, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,15 +29,15 @@ see https://www.gnu.org/licenses/. */
int
mpz_init_set_str (mpz_ptr x, const char *str, int base)
{
- ALLOC (x) = 1;
- PTR (x) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
+ x->_mp_alloc = 1;
+ x->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
/* if str has no digits mpz_set_str leaves x->_mp_size unset */
- SIZ (x) = 0;
+ x->_mp_size = 0;
#ifdef __CHECKER__
/* let the low limb look initialized, for the benefit of mpz_get_ui etc */
- PTR (x)[0] = 0;
+ x->_mp_d[0] = 0;
#endif
return mpz_set_str (x, str, base);
diff --git a/gmp/mpz/iset_ui.c b/gmp/mpz/iset_ui.c
index 0d43c68411..841d91f996 100644
--- a/gmp/mpz/iset_ui.c
+++ b/gmp/mpz/iset_ui.c
@@ -1,33 +1,23 @@
/* mpz_init_set_ui(dest,val) -- Make a new multiple precision in DEST and
assign VAL to the new number.
-Copyright 1991, 1993-1995, 2000-2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,23 +27,20 @@ mpz_init_set_ui (mpz_ptr dest, unsigned long int val)
{
mp_size_t size;
+ dest->_mp_alloc = 1;
+ dest->_mp_d = (mp_ptr) (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+
+ dest->_mp_d[0] = val & GMP_NUMB_MASK;
+ size = val != 0;
+
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
if (val > GMP_NUMB_MAX)
{
- ALLOC (dest) = 2;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES*2);
- PTR (dest)[1] = val >> GMP_NUMB_BITS;
+ MPZ_REALLOC (dest, 2);
+ dest->_mp_d[1] = val >> GMP_NUMB_BITS;
size = 2;
}
- else
#endif
- {
- ALLOC (dest) = 1;
- PTR (dest) = (mp_ptr) (*__gmp_allocate_func) (GMP_LIMB_BYTES);
-
- size = val != 0;
- }
- PTR (dest)[0] = val & GMP_NUMB_MASK;
- SIZ (dest) = size;
+ dest->_mp_size = size;
}
diff --git a/gmp/mpz/jacobi.c b/gmp/mpz/jacobi.c
index 397fe11c9b..1d6a5a1100 100644
--- a/gmp/mpz/jacobi.c
+++ b/gmp/mpz/jacobi.c
@@ -1,32 +1,21 @@
/* mpz_jacobi, mpz_legendre, mpz_kronecker -- mpz/mpz Jacobi symbols.
-Copyright 2000-2002, 2005, 2010-2012 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+The GNU MP Library is free software; you can redistribute it and/or modify it
+under the terms of the GNU 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 General Public License
+WITHOUT ANY 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 copies of the GNU 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -34,10 +23,23 @@ see https://www.gnu.org/licenses/. */
#include "longlong.h"
-/* This code does triple duty as mpz_jacobi, mpz_legendre and
- mpz_kronecker. For ABI compatibility, the link symbol is
- __gmpz_jacobi, not __gmpz_kronecker, even though the latter would
- be more logical.
+/* Change this to "#define TRACE(x) x" for some traces. */
+#define TRACE(x)
+
+
+#define MPN_RSHIFT_OR_COPY(dst,src,size,shift) \
+ do { \
+ if ((shift) != 0) \
+ { \
+ ASSERT_NOCARRY (mpn_rshift (dst, src, size, shift)); \
+ (size) -= ((dst)[(size)-1] == 0); \
+ } \
+ else \
+ MPN_COPY (dst, src, size); \
+ } while (0)
+
+
+/* This code does triple duty as mpz_jacobi, mpz_legendre and mpz_kronecker.
mpz_jacobi could assume b is odd, but the improvements from that seem
small compared to other operations, and anything significant should be
@@ -49,163 +51,262 @@ see https://www.gnu.org/licenses/. */
multiple of b), but the checking for that takes little time compared to
other operations.
+ The main loop is just a simple binary GCD with the jacobi symbol result
+ tracked during the reduction.
+
+ The special cases for a or b fitting in one limb let mod_1 or modexact_1
+ get used, without any copying, and end up just as efficient as the mixed
+ precision mpz_kronecker_ui etc.
+
+ When tdiv_qr is called it's not necessary to make "a" odd or make a
+ working copy of it, but tdiv_qr is going to be pretty slow so it's not
+ worth bothering trying to save anything for that case.
+
Enhancements:
- mpn_bdiv_qr should be used instead of mpn_tdiv_qr.
+ mpn_bdivmod could be used instead of mpn_tdiv_qr, like in mpn_gcd.
+ Currently tdiv_qr is preferred since it's sub-quadratic on big sizes,
+ although bdivmod might be a touch quicker on small sizes. This can be
+ revised when bdivmod becomes sub-quadratic too.
+
+ Some sort of multi-step algorithm should be used. The current subtract
+ and shift for every bit is very inefficient. Lehmer (per current gcdext)
+ would need some low bits included in its calculation to apply the sign
+ change for reciprocity. Binary Lehmer keeps low bits to strip twos
+ anyway, so might be better suited. Maybe the accelerated GCD style k-ary
+ reduction would work, if sign changes due to the extra factors it
+ introduces can be accounted for (or maybe they can be ignored). */
-*/
int
mpz_jacobi (mpz_srcptr a, mpz_srcptr b)
{
mp_srcptr asrcp, bsrcp;
mp_size_t asize, bsize;
- mp_limb_t alow, blow;
mp_ptr ap, bp;
- unsigned btwos;
+ mp_limb_t alow, blow, ahigh, bhigh, asecond, bsecond;
+ unsigned atwos, btwos;
int result_bit1;
- int res;
TMP_DECL;
+ TRACE (printf ("start asize=%d bsize=%d\n", SIZ(a), SIZ(b));
+ mpz_trace (" a", a);
+ mpz_trace (" b", b));
+
asize = SIZ(a);
asrcp = PTR(a);
alow = asrcp[0];
bsize = SIZ(b);
+ if (bsize == 0)
+ return JACOBI_LS0 (alow, asize); /* (a/0) */
+
bsrcp = PTR(b);
blow = bsrcp[0];
- /* The MPN jacobi functions require positive a and b, and b odd. So
- we must to handle the cases of a or b zero, then signs, and then
- the case of even b.
- */
-
- if (bsize == 0)
- /* (a/0) = [ a = 1 or a = -1 ] */
- return JACOBI_LS0 (alow, asize);
-
if (asize == 0)
- /* (0/b) = [ b = 1 or b = - 1 ] */
- return JACOBI_0LS (blow, bsize);
+ return JACOBI_0LS (blow, bsize); /* (0/b) */
- if ( (((alow | blow) & 1) == 0))
- /* Common factor of 2 ==> (a/b) = 0 */
+ /* (even/even)=0 */
+ if (((alow | blow) & 1) == 0)
return 0;
- if (bsize < 0)
- {
- /* (a/-1) = -1 if a < 0, +1 if a >= 0 */
- result_bit1 = (asize < 0) << 1;
- bsize = -bsize;
- }
- else
- result_bit1 = 0;
+ /* account for effect of sign of b, then ignore it */
+ result_bit1 = JACOBI_BSGN_SS_BIT1 (asize, bsize);
+ bsize = ABS (bsize);
+ /* low zero limbs on b can be discarded */
JACOBI_STRIP_LOW_ZEROS (result_bit1, alow, bsrcp, bsize, blow);
count_trailing_zeros (btwos, blow);
- blow >>= btwos;
+ TRACE (printf ("b twos %u\n", btwos));
- if (bsize > 1 && btwos > 0)
+ /* establish shifted blow */
+ blow >>= btwos;
+ if (bsize > 1)
{
- mp_limb_t b1 = bsrcp[1];
- blow |= b1 << (GMP_NUMB_BITS - btwos);
- if (bsize == 2 && (b1 >> btwos) == 0)
- bsize = 1;
+ bsecond = bsrcp[1];
+ if (btwos != 0)
+ blow |= (bsecond << (GMP_NUMB_BITS - btwos)) & GMP_NUMB_MASK;
}
- if (asize < 0)
+ /* account for effect of sign of a, then ignore it */
+ result_bit1 ^= JACOBI_ASGN_SU_BIT1 (asize, blow);
+ asize = ABS (asize);
+
+ if (bsize == 1 || (bsize == 2 && (bsecond >> btwos) == 0))
{
- /* (-1/b) = -1 iff b = 3 (mod 4) */
- result_bit1 ^= JACOBI_N1B_BIT1(blow);
- asize = -asize;
+ /* special case one limb b, use modexact and no copying */
+
+ /* (a/2)=(2/a) with a odd, and if b is even then a is odd here */
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (btwos, alow);
+
+ if (blow == 1) /* (a/1)=1 always */
+ return JACOBI_BIT1_TO_PN (result_bit1);
+
+ JACOBI_MOD_OR_MODEXACT_1_ODD (result_bit1, alow, asrcp, asize, blow);
+ TRACE (printf ("base (%lu/%lu) with %d\n",
+ alow, blow, JACOBI_BIT1_TO_PN (result_bit1)));
+ return mpn_jacobi_base (alow, blow, result_bit1);
}
+ /* Discard low zero limbs of a. Usually there won't be anything to
+ strip, hence not bothering with it for the bsize==1 case. */
JACOBI_STRIP_LOW_ZEROS (result_bit1, blow, asrcp, asize, alow);
- /* Ensure asize >= bsize. Take advantage of the generalized
- reciprocity law (a/b*2^n) = (b*2^n / a) * RECIP(a,b) */
+ count_trailing_zeros (atwos, alow);
+ TRACE (printf ("a twos %u\n", atwos));
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (atwos, blow);
- if (asize < bsize)
+ /* establish shifted alow */
+ alow >>= atwos;
+ if (asize > 1)
{
- MPN_SRCPTR_SWAP (asrcp, asize, bsrcp, bsize);
- MP_LIMB_T_SWAP (alow, blow);
+ asecond = asrcp[1];
+ if (atwos != 0)
+ alow |= (asecond << (GMP_NUMB_BITS - atwos)) & GMP_NUMB_MASK;
+ }
- /* NOTE: The value of alow (old blow) is a bit subtle. For this code
- path, we get alow as the low, always odd, limb of shifted A. Which is
- what we need for the reciprocity update below.
+ /* (a/2)=(2/a) with a odd */
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (btwos, alow);
- However, all other uses of alow assumes that it is *not*
- shifted. Luckily, alow matters only when either
+ if (asize == 1 || (asize == 2 && (asecond >> atwos) == 0))
+ {
+ /* another special case with modexact and no copying */
- + btwos > 0, in which case A is always odd
+ if (alow == 1) /* (1/b)=1 always */
+ return JACOBI_BIT1_TO_PN (result_bit1);
- + asize == bsize == 1, in which case this code path is never
- taken. */
+ /* b still has its twos, so cancel out their effect */
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (btwos, alow);
+
+ result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow); /* now (b/a) */
+ JACOBI_MOD_OR_MODEXACT_1_ODD (result_bit1, blow, bsrcp, bsize, alow);
+ TRACE (printf ("base (%lu/%lu) with %d\n",
+ blow, alow, JACOBI_BIT1_TO_PN (result_bit1)));
+ return mpn_jacobi_base (blow, alow, result_bit1);
+ }
- count_trailing_zeros (btwos, blow);
- blow >>= btwos;
- if (bsize > 1 && btwos > 0)
- {
- mp_limb_t b1 = bsrcp[1];
- blow |= b1 << (GMP_NUMB_BITS - btwos);
- if (bsize == 2 && (b1 >> btwos) == 0)
- bsize = 1;
- }
+ TMP_MARK;
+ TMP_ALLOC_LIMBS_2 (ap, asize, bp, bsize);
+ MPN_RSHIFT_OR_COPY (ap, asrcp, asize, atwos);
+ ASSERT (alow == ap[0]);
+ TRACE (mpn_trace ("stripped a", ap, asize));
+
+ MPN_RSHIFT_OR_COPY (bp, bsrcp, bsize, btwos);
+ ASSERT (blow == bp[0]);
+ TRACE (mpn_trace ("stripped b", bp, bsize));
+
+ /* swap if necessary to make a longer than b */
+ if (asize < bsize)
+ {
+ TRACE (printf ("swap\n"));
+ MPN_PTR_SWAP (ap,asize, bp,bsize);
+ MP_LIMB_T_SWAP (alow, blow);
result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow);
}
- if (bsize == 1)
+ /* If a is bigger than b then reduce to a mod b.
+ Division is much faster than chipping away at "a" bit-by-bit. */
+ if (asize > bsize)
{
- result_bit1 ^= JACOBI_TWOS_U_BIT1(btwos, alow);
+ mp_ptr rp, qp;
- if (blow == 1)
- return JACOBI_BIT1_TO_PN (result_bit1);
+ TRACE (printf ("tdiv_qr asize=%ld bsize=%ld\n", asize, bsize));
- if (asize > 1)
- JACOBI_MOD_OR_MODEXACT_1_ODD (result_bit1, alow, asrcp, asize, blow);
+ TMP_ALLOC_LIMBS_2 (rp, bsize, qp, asize-bsize+1);
+ mpn_tdiv_qr (qp, rp, (mp_size_t) 0, ap, asize, bp, bsize);
+ ap = rp;
+ asize = bsize;
+ MPN_NORMALIZE (ap, asize);
- return mpn_jacobi_base (alow, blow, result_bit1);
- }
+ TRACE (printf ("tdiv_qr asize=%ld bsize=%ld\n", asize, bsize);
+ mpn_trace (" a", ap, asize);
+ mpn_trace (" b", bp, bsize));
- /* Allocation strategy: For A, we allocate a working copy only for A % B, but
- when A is much larger than B, we have to allocate space for the large
- quotient. We use the same area, pointed to by bp, for both the quotient
- A/B and the working copy of B. */
+ if (asize == 0) /* (0/b)=0 for b!=1 */
+ goto zero;
- TMP_MARK;
-
- if (asize >= 2*bsize)
- TMP_ALLOC_LIMBS_2 (ap, bsize, bp, asize - bsize + 1);
- else
- TMP_ALLOC_LIMBS_2 (ap, bsize, bp, bsize);
-
- /* In the case of even B, we conceptually shift out the powers of two first,
- and then divide A mod B. Hence, when taking those powers of two into
- account, we must use alow *before* the division. Doing the actual division
- first is ok, because the point is to remove multiples of B from A, and
- multiples of 2^k B are good enough. */
- if (asize > bsize)
- mpn_tdiv_qr (bp, ap, 0, asrcp, asize, bsrcp, bsize);
- else
- MPN_COPY (ap, asrcp, bsize);
+ alow = ap[0];
+ goto strip_a;
+ }
- if (btwos > 0)
+ for (;;)
{
- result_bit1 ^= JACOBI_TWOS_U_BIT1(btwos, alow);
-
- ASSERT_NOCARRY (mpn_rshift (bp, bsrcp, bsize, btwos));
- bsize -= (ap[bsize-1] | bp[bsize-1]) == 0;
+ ASSERT (asize >= 1); /* a,b non-empty */
+ ASSERT (bsize >= 1);
+ ASSERT (ap[asize-1] != 0); /* a,b normalized (and hence non-zero) */
+ ASSERT (bp[bsize-1] != 0);
+ ASSERT (alow == ap[0]); /* low limb copies should be correct */
+ ASSERT (blow == bp[0]);
+ ASSERT (alow & 1); /* a,b odd */
+ ASSERT (blow & 1);
+
+ TRACE (printf ("top asize=%ld bsize=%ld\n", asize, bsize);
+ mpn_trace (" a", ap, asize);
+ mpn_trace (" b", bp, bsize));
+
+ /* swap if necessary to make a>=b, applying reciprocity
+ high limbs are almost always enough to tell which is bigger */
+ if (asize < bsize
+ || (asize == bsize
+ && ((ahigh=ap[asize-1]) < (bhigh=bp[asize-1])
+ || (ahigh == bhigh
+ && mpn_cmp (ap, bp, asize-1) < 0))))
+ {
+ TRACE (printf ("swap\n"));
+ MPN_PTR_SWAP (ap,asize, bp,bsize);
+ MP_LIMB_T_SWAP (alow, blow);
+ result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow);
+ }
+
+ if (asize == 1)
+ break;
+
+ /* a = a-b */
+ ASSERT (asize >= bsize);
+ ASSERT_NOCARRY (mpn_sub (ap, ap, asize, bp, bsize));
+ MPN_NORMALIZE (ap, asize);
+ alow = ap[0];
+
+ /* (0/b)=0 for b!=1. b!=1 when a==0 because otherwise would have had
+ a==1 which is asize==1 and would have exited above. */
+ if (asize == 0)
+ goto zero;
+
+ strip_a:
+ /* low zero limbs on a can be discarded */
+ JACOBI_STRIP_LOW_ZEROS (result_bit1, blow, ap, asize, alow);
+
+ if ((alow & 1) == 0)
+ {
+ /* factors of 2 from a */
+ unsigned twos;
+ count_trailing_zeros (twos, alow);
+ TRACE (printf ("twos %u\n", twos));
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, blow);
+ ASSERT_NOCARRY (mpn_rshift (ap, ap, asize, twos));
+ asize -= (ap[asize-1] == 0);
+ alow = ap[0];
+ }
}
- else
- MPN_COPY (bp, bsrcp, bsize);
- ASSERT (blow == bp[0]);
- res = mpn_jacobi_n (ap, bp, bsize,
- mpn_jacobi_init (ap[0], blow, (result_bit1>>1) & 1));
+ ASSERT (asize == 1 && bsize == 1); /* just alow and blow left */
+ TMP_FREE;
+
+ /* (1/b)=1 always (in this case have b==1 because a>=b) */
+ if (alow == 1)
+ return JACOBI_BIT1_TO_PN (result_bit1);
+
+ /* swap with reciprocity and do (b/a) */
+ result_bit1 ^= JACOBI_RECIP_UU_BIT1 (alow, blow);
+ TRACE (printf ("base (%lu/%lu) with %d\n",
+ blow, alow, JACOBI_BIT1_TO_PN (result_bit1)));
+ return mpn_jacobi_base (blow, alow, result_bit1);
+ zero:
TMP_FREE;
- return res;
+ return 0;
}
diff --git a/gmp/mpz/kronsz.c b/gmp/mpz/kronsz.c
index 12c8fbd0aa..0c33c8d77d 100644
--- a/gmp/mpz/kronsz.c
+++ b/gmp/mpz/kronsz.c
@@ -1,32 +1,21 @@
/* mpz_si_kronecker -- long+mpz Kronecker/Jacobi symbol.
-Copyright 1999-2002 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -75,54 +64,54 @@ mpz_si_kronecker (long a, mpz_srcptr b)
a_limb = (unsigned long) ABS(a);
if ((a_limb & 1) == 0)
- {
- /* (0/b)=1 for b=+/-1, 0 otherwise */
- if (a_limb == 0)
- return (b_abs_size == 1 && b_low == 1);
-
- /* a even, b odd */
- count_trailing_zeros (twos, a_limb);
- a_limb >>= twos;
- /* (a*2^n/b) = (a/b) * twos(n,a) */
- result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, b_low);
- }
+ {
+ /* (0/b)=1 for b=+/-1, 0 otherwise */
+ if (a_limb == 0)
+ return (b_abs_size == 1 && b_low == 1);
+
+ /* a even, b odd */
+ count_trailing_zeros (twos, a_limb);
+ a_limb >>= twos;
+ /* (a*2^n/b) = (a/b) * twos(n,a) */
+ result_bit1 ^= JACOBI_TWOS_U_BIT1 (twos, b_low);
+ }
}
else
{
/* (even/even)=0, and (0/b)=0 for b!=+/-1 */
if ((a & 1) == 0)
- return 0;
+ return 0;
/* a odd, b even
- Establish shifted b_low with valid bit1 for ASGN and RECIP below.
- Zero limbs stripped are accounted for, but zero bits on b_low are
- not because they remain in {b_ptr,b_abs_size} for the
- JACOBI_MOD_OR_MODEXACT_1_ODD. */
+ Establish shifted b_low with valid bit1 for ASGN and RECIP below.
+ Zero limbs stripped are acounted for, but zero bits on b_low are
+ not because they remain in {b_ptr,b_abs_size} for the
+ JACOBI_MOD_OR_MODEXACT_1_ODD. */
JACOBI_STRIP_LOW_ZEROS (result_bit1, a, b_ptr, b_abs_size, b_low);
if ((b_low & 1) == 0)
- {
- if (UNLIKELY (b_low == GMP_NUMB_HIGHBIT))
- {
- /* need b_ptr[1] to get bit1 in b_low */
- if (b_abs_size == 1)
- {
- /* (a/0x80000000) = (a/2)^(BPML-1) */
- if ((GMP_NUMB_BITS % 2) == 0)
- result_bit1 ^= JACOBI_TWO_U_BIT1 (a);
- return JACOBI_BIT1_TO_PN (result_bit1);
- }
-
- /* b_abs_size > 1 */
- b_low = b_ptr[1] << 1;
- }
- else
- {
- count_trailing_zeros (twos, b_low);
- b_low >>= twos;
- }
- }
+ {
+ if (UNLIKELY (b_low == GMP_NUMB_HIGHBIT))
+ {
+ /* need b_ptr[1] to get bit1 in b_low */
+ if (b_abs_size == 1)
+ {
+ /* (a/0x80000000) = (a/2)^(BPML-1) */
+ if ((GMP_NUMB_BITS % 2) == 0)
+ result_bit1 ^= JACOBI_TWO_U_BIT1 (a);
+ return JACOBI_BIT1_TO_PN (result_bit1);
+ }
+
+ /* b_abs_size > 1 */
+ b_low = b_ptr[1] << 1;
+ }
+ else
+ {
+ count_trailing_zeros (twos, b_low);
+ b_low >>= twos;
+ }
+ }
result_bit1 ^= JACOBI_ASGN_SU_BIT1 (a, b_low);
a_limb = (unsigned long) ABS(a);
diff --git a/gmp/mpz/kronuz.c b/gmp/mpz/kronuz.c
index ca88250de5..82a9962836 100644
--- a/gmp/mpz/kronuz.c
+++ b/gmp/mpz/kronuz.c
@@ -1,32 +1,21 @@
/* mpz_ui_kronecker -- ulong+mpz Kronecker/Jacobi symbol.
-Copyright 1999-2002 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -67,57 +56,57 @@ mpz_ui_kronecker (unsigned long a, mpz_srcptr b)
{
/* (0/b)=0 for b!=+/-1; and (even/even)=0 */
if (! (a & 1))
- return 0;
+ return 0;
/* a odd, b even
- Establish shifted b_low with valid bit1 for the RECIP below. Zero
- limbs stripped are accounted for, but zero bits on b_low are not
- because they remain in {b_ptr,b_abs_size} for
- JACOBI_MOD_OR_MODEXACT_1_ODD. */
+ Establish shifted b_low with valid bit1 for the RECIP below. Zero
+ limbs stripped are accounted for, but zero bits on b_low are not
+ because they remain in {b_ptr,b_abs_size} for
+ JACOBI_MOD_OR_MODEXACT_1_ODD. */
JACOBI_STRIP_LOW_ZEROS (result_bit1, a, b_ptr, b_abs_size, b_low);
if (! (b_low & 1))
- {
- if (UNLIKELY (b_low == GMP_NUMB_HIGHBIT))
- {
- /* need b_ptr[1] to get bit1 in b_low */
- if (b_abs_size == 1)
- {
- /* (a/0x80...00) == (a/2)^(NUMB-1) */
- if ((GMP_NUMB_BITS % 2) == 0)
- {
- /* JACOBI_STRIP_LOW_ZEROS does nothing to result_bit1
- when GMP_NUMB_BITS is even, so it's still 0. */
- ASSERT (result_bit1 == 0);
- result_bit1 = JACOBI_TWO_U_BIT1 (a);
- }
- return JACOBI_BIT1_TO_PN (result_bit1);
- }
-
- /* b_abs_size > 1 */
- b_low = b_ptr[1] << 1;
- }
- else
- {
- count_trailing_zeros (twos, b_low);
- b_low >>= twos;
- }
- }
+ {
+ if (UNLIKELY (b_low == GMP_NUMB_HIGHBIT))
+ {
+ /* need b_ptr[1] to get bit1 in b_low */
+ if (b_abs_size == 1)
+ {
+ /* (a/0x80...00) == (a/2)^(NUMB-1) */
+ if ((GMP_NUMB_BITS % 2) == 0)
+ {
+ /* JACOBI_STRIP_LOW_ZEROS does nothing to result_bit1
+ when GMP_NUMB_BITS is even, so it's still 0. */
+ ASSERT (result_bit1 == 0);
+ result_bit1 = JACOBI_TWO_U_BIT1 (a);
+ }
+ return JACOBI_BIT1_TO_PN (result_bit1);
+ }
+
+ /* b_abs_size > 1 */
+ b_low = b_ptr[1] << 1;
+ }
+ else
+ {
+ count_trailing_zeros (twos, b_low);
+ b_low >>= twos;
+ }
+ }
}
else
{
if (a == 0) /* (0/b)=1 for b=+/-1, 0 otherwise */
- return (b_abs_size == 1 && b_low == 1);
+ return (b_abs_size == 1 && b_low == 1);
if (! (a & 1))
- {
- /* a even, b odd */
- count_trailing_zeros (twos, a);
- a >>= twos;
- /* (a*2^n/b) = (a/b) * (2/a)^n */
- result_bit1 = JACOBI_TWOS_U_BIT1 (twos, b_low);
- }
+ {
+ /* a even, b odd */
+ count_trailing_zeros (twos, a);
+ a >>= twos;
+ /* (a*2^n/b) = (a/b) * (2/a)^n */
+ result_bit1 = JACOBI_TWOS_U_BIT1 (twos, b_low);
+ }
}
if (a == 1)
diff --git a/gmp/mpz/kronzs.c b/gmp/mpz/kronzs.c
index 695cd0f283..045e5563d9 100644
--- a/gmp/mpz/kronzs.c
+++ b/gmp/mpz/kronzs.c
@@ -1,32 +1,21 @@
/* mpz_kronecker_si -- mpz+long Kronecker/Jacobi symbol.
-Copyright 1999-2002 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -61,7 +50,7 @@ mpz_kronecker_si (mpz_srcptr a, long b)
#endif
result_bit1 = JACOBI_BSGN_SS_BIT1 (a_size, b);
- b_limb = ABS_CAST (unsigned long, b);
+ b_limb = (unsigned long) ABS (b);
a_ptr = PTR(a);
if ((b_limb & 1) == 0)
@@ -70,10 +59,10 @@ mpz_kronecker_si (mpz_srcptr a, long b)
int twos;
if (b_limb == 0)
- return JACOBI_LS0 (a_low, a_size); /* (a/0) */
+ return JACOBI_LS0 (a_low, a_size); /* (a/0) */
if (! (a_low & 1))
- return 0; /* (even/even)=0 */
+ return 0; /* (even/even)=0 */
/* (a/2)=(2/a) for a odd */
count_trailing_zeros (twos, b_limb);
diff --git a/gmp/mpz/kronzu.c b/gmp/mpz/kronzu.c
index f57f92e8ba..e73a0f86ae 100644
--- a/gmp/mpz/kronzu.c
+++ b/gmp/mpz/kronzu.c
@@ -1,32 +1,21 @@
/* mpz_kronecker_ui -- mpz+ulong Kronecker/Jacobi symbol.
-Copyright 1999-2002 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -66,16 +55,16 @@ mpz_kronecker_ui (mpz_srcptr a, unsigned long b)
int twos;
if (b == 0)
- return JACOBI_LS0 (a_low, a_size); /* (a/0) */
+ return JACOBI_LS0 (a_low, a_size); /* (a/0) */
if (! (a_low & 1))
- return 0; /* (even/even)=0 */
+ return 0; /* (even/even)=0 */
/* (a/2)=(2/a) for a odd */
count_trailing_zeros (twos, b);
b >>= twos;
result_bit1 = (JACOBI_TWOS_U_BIT1 (twos, a_low)
- ^ JACOBI_ASGN_SU_BIT1 (a_size, b));
+ ^ JACOBI_ASGN_SU_BIT1 (a_size, b));
}
if (b == 1)
diff --git a/gmp/mpz/lcm.c b/gmp/mpz/lcm.c
index 805f671077..22ac041773 100644
--- a/gmp/mpz/lcm.c
+++ b/gmp/mpz/lcm.c
@@ -1,41 +1,32 @@
/* mpz_lcm -- mpz/mpz least common multiple.
-Copyright 1996, 2000, 2001, 2005, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+
void
mpz_lcm (mpz_ptr r, mpz_srcptr u, mpz_srcptr v)
{
mpz_t g;
- mp_size_t usize, vsize;
+ mp_size_t usize, vsize, size;
TMP_DECL;
usize = SIZ (u);
@@ -48,18 +39,13 @@ mpz_lcm (mpz_ptr r, mpz_srcptr u, mpz_srcptr v)
usize = ABS (usize);
vsize = ABS (vsize);
- if (vsize == 1 || usize == 1)
+ if (vsize == 1)
{
mp_limb_t vl, gl, c;
mp_srcptr up;
mp_ptr rp;
- if (usize == 1)
- {
- usize = vsize;
- MPZ_SRCPTR_SWAP (u, v);
- }
-
+ one:
MPZ_REALLOC (r, usize+1);
up = PTR(u);
@@ -75,8 +61,16 @@ mpz_lcm (mpz_ptr r, mpz_srcptr u, mpz_srcptr v)
return;
}
+ if (usize == 1)
+ {
+ usize = vsize;
+ MPZ_SRCPTR_SWAP (u, v);
+ goto one;
+ }
+
TMP_MARK;
- MPZ_TMP_INIT (g, usize); /* v != 0 implies |gcd(u,v)| <= |u| */
+ size = MAX (usize, vsize);
+ MPZ_TMP_INIT (g, size);
mpz_gcd (g, u, v);
mpz_divexact (g, u, g);
diff --git a/gmp/mpz/lcm_ui.c b/gmp/mpz/lcm_ui.c
index 362d183b42..2249aacf67 100644
--- a/gmp/mpz/lcm_ui.c
+++ b/gmp/mpz/lcm_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpz/limbs_finish.c b/gmp/mpz/limbs_finish.c
deleted file mode 100644
index ebf6dea290..0000000000
--- a/gmp/mpz/limbs_finish.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* 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/gmp/mpz/limbs_modify.c b/gmp/mpz/limbs_modify.c
deleted file mode 100644
index bafd7d88a0..0000000000
--- a/gmp/mpz/limbs_modify.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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/gmp/mpz/limbs_read.c b/gmp/mpz/limbs_read.c
deleted file mode 100644
index 6c14f18d45..0000000000
--- a/gmp/mpz/limbs_read.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* 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/gmp/mpz/limbs_write.c b/gmp/mpz/limbs_write.c
deleted file mode 100644
index 605cb5e3a3..0000000000
--- a/gmp/mpz/limbs_write.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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);
-}
diff --git a/gmp/mpz/lucnum2_ui.c b/gmp/mpz/lucnum2_ui.c
index f8e4fb356f..a6b6cfb689 100644
--- a/gmp/mpz/lucnum2_ui.c
+++ b/gmp/mpz/lucnum2_ui.c
@@ -1,32 +1,21 @@
/* mpz_lucnum2_ui -- calculate Lucas numbers.
-Copyright 2001, 2003, 2005, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -64,8 +53,10 @@ mpz_lucnum2_ui (mpz_ptr ln, mpz_ptr lnsub1, unsigned long n)
size = MPN_FIB2_SIZE (n);
f1p = TMP_ALLOC_LIMBS (size);
- lp = MPZ_REALLOC (ln, size+1);
- l1p = MPZ_REALLOC (lnsub1, size+1);
+ MPZ_REALLOC (ln, size+1);
+ MPZ_REALLOC (lnsub1, size+1);
+ lp = PTR(ln);
+ l1p = PTR(lnsub1);
size = mpn_fib2_ui (l1p, f1p, n);
diff --git a/gmp/mpz/lucnum_ui.c b/gmp/mpz/lucnum_ui.c
index d1fe6b54ce..1215a04b4d 100644
--- a/gmp/mpz/lucnum_ui.c
+++ b/gmp/mpz/lucnum_ui.c
@@ -1,32 +1,21 @@
/* mpz_lucnum_ui -- calculate Lucas number.
-Copyright 2001, 2003, 2005, 2011, 2012 Free Software Foundation, Inc.
+Copyright 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -77,7 +66,8 @@ mpz_lucnum_ui (mpz_ptr ln, unsigned long n)
since square or mul used below might need an extra limb over the true
size */
lalloc = MPN_FIB2_SIZE (n) + 2;
- lp = MPZ_REALLOC (ln, lalloc);
+ MPZ_REALLOC (ln, lalloc);
+ lp = PTR (ln);
TMP_MARK;
xalloc = lalloc;
@@ -90,85 +80,84 @@ mpz_lucnum_ui (mpz_ptr ln, unsigned long n)
for (;;)
{
if (n & 1)
- {
- /* L[2k+1] = 5*F[k-1]*(2*F[k]+F[k-1]) - 4*(-1)^k */
+ {
+ /* L[2k+1] = 5*F[k-1]*(2*F[k]+F[k-1]) - 4*(-1)^k */
- mp_size_t yalloc, ysize;
- mp_ptr yp;
+ mp_size_t yalloc, ysize;
+ mp_ptr yp;
- TRACE (printf (" initial odd n=%lu\n", n));
+ TRACE (printf (" initial odd n=%lu\n", n));
- yalloc = MPN_FIB2_SIZE (n/2);
- yp = TMP_ALLOC_LIMBS (yalloc);
- ASSERT (xalloc >= yalloc);
+ yalloc = MPN_FIB2_SIZE (n/2);
+ yp = TMP_ALLOC_LIMBS (yalloc);
+ ASSERT (xalloc >= yalloc);
- xsize = mpn_fib2_ui (xp, yp, n/2);
+ xsize = mpn_fib2_ui (xp, yp, n/2);
- /* possible high zero on F[k-1] */
- ysize = xsize;
- ysize -= (yp[ysize-1] == 0);
- ASSERT (yp[ysize-1] != 0);
+ /* possible high zero on F[k-1] */
+ ysize = xsize;
+ ysize -= (yp[ysize-1] == 0);
+ ASSERT (yp[ysize-1] != 0);
- /* xp = 2*F[k] + F[k-1] */
+ /* xp = 2*F[k] + F[k-1] */
#if HAVE_NATIVE_mpn_addlsh1_n
- c = mpn_addlsh1_n (xp, yp, xp, xsize);
+ c = mpn_addlsh1_n (xp, yp, xp, xsize);
#else
- c = mpn_lshift (xp, xp, xsize, 1);
- c += mpn_add_n (xp, xp, yp, xsize);
+ c = mpn_lshift (xp, xp, xsize, 1);
+ c += mpn_add_n (xp, xp, yp, xsize);
#endif
- ASSERT (xalloc >= xsize+1);
- xp[xsize] = c;
- xsize += (c != 0);
- ASSERT (xp[xsize-1] != 0);
-
- ASSERT (lalloc >= xsize + ysize);
- c = mpn_mul (lp, xp, xsize, yp, ysize);
- lsize = xsize + ysize;
- lsize -= (c == 0);
-
- /* lp = 5*lp */
-#if HAVE_NATIVE_mpn_addlsh2_n
- c = mpn_addlsh2_n (lp, lp, lp, lsize);
+ ASSERT (xalloc >= xsize+1);
+ xp[xsize] = c;
+ xsize += (c != 0);
+ ASSERT (xp[xsize-1] != 0);
+
+ ASSERT (lalloc >= xsize + ysize);
+ c = mpn_mul (lp, xp, xsize, yp, ysize);
+ lsize = xsize + ysize;
+ lsize -= (c == 0);
+
+ /* lp = 5*lp */
+#if HAVE_NATIVE_mpn_addlshift
+ c = mpn_addlshift (lp, lp, lsize, 2);
#else
- /* FIXME: Is this faster than mpn_mul_1 ? */
- c = mpn_lshift (xp, lp, lsize, 2);
- c += mpn_add_n (lp, lp, xp, lsize);
+ c = mpn_lshift (xp, lp, lsize, 2);
+ c += mpn_add_n (lp, lp, xp, lsize);
#endif
- ASSERT (lalloc >= lsize+1);
- lp[lsize] = c;
- lsize += (c != 0);
-
- /* lp = lp - 4*(-1)^k */
- if (n & 2)
- {
- /* no overflow, see comments above */
- ASSERT (lp[0] <= MP_LIMB_T_MAX-4);
- lp[0] += 4;
- }
- else
- {
- /* won't go negative */
- MPN_DECR_U (lp, lsize, CNST_LIMB(4));
- }
-
- TRACE (mpn_trace (" l",lp, lsize));
- break;
- }
+ ASSERT (lalloc >= lsize+1);
+ lp[lsize] = c;
+ lsize += (c != 0);
+
+ /* lp = lp - 4*(-1)^k */
+ if (n & 2)
+ {
+ /* no overflow, see comments above */
+ ASSERT (lp[0] <= MP_LIMB_T_MAX-4);
+ lp[0] += 4;
+ }
+ else
+ {
+ /* won't go negative */
+ MPN_DECR_U (lp, lsize, CNST_LIMB(4));
+ }
+
+ TRACE (mpn_trace (" l",lp, lsize));
+ break;
+ }
MP_PTR_SWAP (xp, lp); /* balance the swaps wanted in the L[2k] below */
zeros++;
n /= 2;
if (n <= FIB_TABLE_LUCNUM_LIMIT)
- {
- /* L[n] = F[n] + 2F[n-1] */
- lp[0] = FIB_TABLE (n) + 2 * FIB_TABLE ((int) n - 1);
- lsize = 1;
-
- TRACE (printf (" initial small n=%lu\n", n);
- mpn_trace (" l",lp, lsize));
- break;
- }
+ {
+ /* L[n] = F[n] + 2F[n-1] */
+ lp[0] = FIB_TABLE (n) + 2 * FIB_TABLE ((int) n - 1);
+ lsize = 1;
+
+ TRACE (printf (" initial small n=%lu\n", n);
+ mpn_trace (" l",lp, lsize));
+ break;
+ }
}
for ( ; zeros != 0; zeros--)
@@ -178,24 +167,24 @@ mpz_lucnum_ui (mpz_ptr ln, unsigned long n)
TRACE (printf (" zeros=%d\n", zeros));
ASSERT (xalloc >= 2*lsize);
- mpn_sqr (xp, lp, lsize);
+ mpn_sqr_n (xp, lp, lsize);
lsize *= 2;
lsize -= (xp[lsize-1] == 0);
/* First time around the loop k==n determines (-1)^k, after that k is
- always even and we set n=0 to indicate that. */
+ always even and we set n=0 to indicate that. */
if (n & 1)
- {
- /* L[n]^2 == 0 or 1 mod 4, like all squares, so +2 gives no carry */
- ASSERT (xp[0] <= MP_LIMB_T_MAX-2);
- xp[0] += 2;
- n = 0;
- }
+ {
+ /* L[n]^2 == 0 or 1 mod 4, like all squares, so +2 gives no carry */
+ ASSERT (xp[0] <= MP_LIMB_T_MAX-2);
+ xp[0] += 2;
+ n = 0;
+ }
else
- {
- /* won't go negative */
- MPN_DECR_U (xp, lsize, CNST_LIMB(2));
- }
+ {
+ /* won't go negative */
+ MPN_DECR_U (xp, lsize, CNST_LIMB(2));
+ }
MP_PTR_SWAP (xp, lp);
ASSERT (lp[lsize-1] != 0);
diff --git a/gmp/mpz/mfac_uiui.c b/gmp/mpz/mfac_uiui.c
deleted file mode 100644
index 3ea36bce9d..0000000000
--- a/gmp/mpz/mfac_uiui.c
+++ /dev/null
@@ -1,140 +0,0 @@
-/* mpz_mfac_uiui(RESULT, N, M) -- Set RESULT to N!^(M) = N(N-M)(N-2M)...
-
-Contributed to the GNU project by Marco Bodrato.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*************************************************************/
-/* Section macros: common macros, for swing/fac/bin (&sieve) */
-/*************************************************************/
-
-#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
- do { \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = (P); \
- } else \
- (PR) *= (P); \
- } while (0)
-
-/*********************************************************/
-/* Section oder factorials: */
-/*********************************************************/
-
-/* mpz_mfac_uiui (x, n, m) computes x = n!^(m) = n*(n-m)*(n-2m)*... */
-
-void
-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) */
- PTR (x)[0] = n + (n == 0);
- SIZ (x) = 1;
- } else { /* m < n - 1 < GMP_NUMB_MAX */
- mp_limb_t g, sn;
- mpz_t t;
-
- sn = n;
- g = mpn_gcd_1 (&sn, 1, m);
- if (g > 1) { n/=g; m/=g; }
-
- if (m <= 2) { /* fac or 2fac */
- if (m == 1) {
- if (g > 2) {
- mpz_init (t);
- mpz_fac_ui (t, n);
- sn = n;
- } else {
- if (g == 2)
- mpz_2fac_ui (x, n << 1);
- else
- mpz_fac_ui (x, n);
- return;
- }
- } else { /* m == 2 */
- if (g > 1) {
- mpz_init (t);
- mpz_2fac_ui (t, n);
- sn = n / 2 + 1;
- } else {
- mpz_2fac_ui (x, n);
- return;
- }
- }
- } else { /* m >= 3, gcd(n,m) = 1 */
- mp_limb_t *factors;
- mp_limb_t prod, max_prod, j;
- TMP_DECL;
-
- sn = n / m + 1;
-
- j = 0;
- prod = n;
- n -= m;
- max_prod = GMP_NUMB_MAX / n;
-
- 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);
-
- factors[j++] = n;
- factors[j++] = prod;
-
- if (g > 1) {
- mpz_init (t);
- mpz_prodlimbs (t, factors, j);
- } else {
- mpz_prodlimbs (x, factors, j);
- TMP_FREE;
- return;
- }
- }
-
- {
- mpz_t p;
-
- mpz_init (p);
- mpz_ui_pow_ui (p, g, sn); /* g^sn */
- mpz_mul (x, p, t);
- mpz_clear (p);
- mpz_clear (t);
- }
- }
-}
diff --git a/gmp/mpz/millerrabin.c b/gmp/mpz/millerrabin.c
index e1ce32c893..f717278b0f 100644
--- a/gmp/mpz/millerrabin.c
+++ b/gmp/mpz/millerrabin.c
@@ -9,42 +9,30 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 1991, 1993, 1994, 1996-2002, 2005 Free Software Foundation, Inc.
-
-Contributed by John Amanatides.
+Copyright 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-static int millerrabin (mpz_srcptr, mpz_srcptr,
- mpz_ptr, mpz_ptr,
- mpz_srcptr, unsigned long int);
+static int millerrabin __GMP_PROTO ((mpz_srcptr, mpz_srcptr,
+ mpz_ptr, mpz_ptr,
+ mpz_srcptr, unsigned long int));
int
mpz_millerrabin (mpz_srcptr n, int reps)
@@ -103,7 +91,7 @@ mpz_millerrabin (mpz_srcptr n, int reps)
static int
millerrabin (mpz_srcptr n, mpz_srcptr nm1, mpz_ptr x, mpz_ptr y,
- mpz_srcptr q, unsigned long int k)
+ mpz_srcptr q, unsigned long int k)
{
unsigned long int i;
diff --git a/gmp/mpz/mod.c b/gmp/mpz/mod.c
index f2de0f9783..f7b84115a7 100644
--- a/gmp/mpz/mod.c
+++ b/gmp/mpz/mod.c
@@ -1,33 +1,22 @@
/* mpz_mod -- The mathematical mod function.
-Copyright 1991, 1993-1996, 2001, 2002, 2005, 2010, 2012 Free Software
+Copyright 1991, 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -35,34 +24,34 @@ see https://www.gnu.org/licenses/. */
void
mpz_mod (mpz_ptr rem, mpz_srcptr dividend, mpz_srcptr divisor)
{
- mp_size_t rn, bn;
- mpz_t temp_divisor;
+ mp_size_t divisor_size = divisor->_mp_size;
+ mpz_t temp_divisor; /* N.B.: lives until function returns! */
TMP_DECL;
TMP_MARK;
- bn = ABSIZ(divisor);
-
/* We need the original value of the divisor after the remainder has been
preliminary calculated. We have to copy it to temporary space if it's
the same variable as REM. */
if (rem == divisor)
{
- PTR(temp_divisor) = TMP_ALLOC_LIMBS (bn);
- MPN_COPY (PTR(temp_divisor), PTR(divisor), bn);
+ MPZ_TMP_INIT (temp_divisor, ABS (divisor_size));
+ mpz_set (temp_divisor, divisor);
+ divisor = temp_divisor;
}
- else
- {
- PTR(temp_divisor) = PTR(divisor);
- }
- SIZ(temp_divisor) = bn;
- divisor = temp_divisor;
mpz_tdiv_r (rem, dividend, divisor);
- rn = SIZ (rem);
- if (rn < 0)
- mpz_add (rem, rem, divisor);
+ if (rem->_mp_size != 0)
+ {
+ if (dividend->_mp_size < 0)
+ {
+ if (divisor->_mp_size < 0)
+ mpz_sub (rem, rem, divisor);
+ else
+ mpz_add (rem, rem, divisor);
+ }
+ }
TMP_FREE;
}
diff --git a/gmp/mpz/mul.c b/gmp/mpz/mul.c
index 59a279eca6..7f4e4a3775 100644
--- a/gmp/mpz/mul.c
+++ b/gmp/mpz/mul.c
@@ -1,44 +1,40 @@
/* mpz_mul -- Multiply two integers.
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2009, 2011, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005 Free Software Foundation,
+Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
#include "gmp-impl.h"
+#ifdef BERKELEY_MP
+#include "mp.h"
+#endif
void
+#ifndef BERKELEY_MP
mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
+#else /* BERKELEY_MP */
+mult (mpz_srcptr u, mpz_srcptr v, mpz_ptr w)
+#endif /* BERKELEY_MP */
{
- mp_size_t usize;
- mp_size_t vsize;
+ mp_size_t usize = u->_mp_size;
+ mp_size_t vsize = v->_mp_size;
mp_size_t wsize;
mp_size_t sign_product;
mp_ptr up, vp;
@@ -48,8 +44,6 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
mp_limb_t cy_limb;
TMP_DECL;
- usize = SIZ (u);
- vsize = SIZ (v);
sign_product = usize ^ vsize;
usize = ABS (usize);
vsize = ABS (vsize);
@@ -62,59 +56,61 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
if (vsize == 0)
{
- SIZ (w) = 0;
+ SIZ(w) = 0;
return;
}
#if HAVE_NATIVE_mpn_mul_2
if (vsize <= 2)
{
- wp = MPZ_REALLOC (w, usize+vsize);
+ MPZ_REALLOC (w, usize+vsize);
+ wp = PTR(w);
if (vsize == 1)
- cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
+ cy_limb = mpn_mul_1 (wp, PTR(u), usize, PTR(v)[0]);
else
- {
- cy_limb = mpn_mul_2 (wp, PTR (u), usize, PTR (v));
- usize++;
- }
+ {
+ cy_limb = mpn_mul_2 (wp, PTR(u), usize, PTR(v));
+ usize++;
+ }
wp[usize] = cy_limb;
usize += (cy_limb != 0);
- SIZ (w) = (sign_product >= 0 ? usize : -usize);
+ SIZ(w) = (sign_product >= 0 ? usize : -usize);
return;
}
#else
if (vsize == 1)
{
- wp = MPZ_REALLOC (w, usize+1);
- cy_limb = mpn_mul_1 (wp, PTR (u), usize, PTR (v)[0]);
+ MPZ_REALLOC (w, usize+1);
+ wp = PTR(w);
+ cy_limb = mpn_mul_1 (wp, PTR(u), usize, PTR(v)[0]);
wp[usize] = cy_limb;
usize += (cy_limb != 0);
- SIZ (w) = (sign_product >= 0 ? usize : -usize);
+ SIZ(w) = (sign_product >= 0 ? usize : -usize);
return;
}
#endif
TMP_MARK;
free_me = NULL;
- up = PTR (u);
- vp = PTR (v);
- wp = PTR (w);
+ up = u->_mp_d;
+ vp = v->_mp_d;
+ wp = w->_mp_d;
/* Ensure W has space enough to store the result. */
wsize = usize + vsize;
- if (ALLOC (w) < wsize)
+ if (w->_mp_alloc < wsize)
{
if (wp == up || wp == vp)
{
free_me = wp;
- free_me_size = ALLOC (w);
+ free_me_size = w->_mp_alloc;
}
else
- (*__gmp_free_func) (wp, (size_t) ALLOC (w) * GMP_LIMB_BYTES);
+ (*__gmp_free_func) (wp, w->_mp_alloc * BYTES_PER_MP_LIMB);
- ALLOC (w) = wsize;
- wp = (mp_ptr) (*__gmp_allocate_func) ((size_t) wsize * GMP_LIMB_BYTES);
- PTR (w) = wp;
+ w->_mp_alloc = wsize;
+ wp = (mp_ptr) (*__gmp_allocate_func) (wsize * BYTES_PER_MP_LIMB);
+ w->_mp_d = wp;
}
else
{
@@ -122,7 +118,7 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
if (wp == up)
{
/* W and U are identical. Allocate temporary space for U. */
- up = TMP_ALLOC_LIMBS (usize);
+ up = (mp_ptr) TMP_ALLOC (usize * BYTES_PER_MP_LIMB);
/* Is V identical too? Keep it identical with U. */
if (wp == vp)
vp = up;
@@ -132,26 +128,18 @@ mpz_mul (mpz_ptr w, mpz_srcptr u, mpz_srcptr v)
else if (wp == vp)
{
/* W and V are identical. Allocate temporary space for V. */
- vp = TMP_ALLOC_LIMBS (vsize);
+ vp = (mp_ptr) TMP_ALLOC (vsize * BYTES_PER_MP_LIMB);
/* Copy to the temporary space. */
MPN_COPY (vp, wp, vsize);
}
}
- if (up == vp)
- {
- mpn_sqr (wp, up, usize);
- cy_limb = wp[wsize - 1];
- }
- else
- {
- cy_limb = mpn_mul (wp, up, usize, vp, vsize);
- }
-
+ cy_limb = mpn_mul (wp, up, usize, vp, vsize);
+ wsize = usize + vsize;
wsize -= cy_limb == 0;
- SIZ (w) = sign_product < 0 ? -wsize : wsize;
+ w->_mp_size = sign_product < 0 ? -wsize : wsize;
if (free_me != NULL)
- (*__gmp_free_func) (free_me, free_me_size * GMP_LIMB_BYTES);
+ (*__gmp_free_func) (free_me, free_me_size * BYTES_PER_MP_LIMB);
TMP_FREE;
}
diff --git a/gmp/mpz/mul_2exp.c b/gmp/mpz/mul_2exp.c
index f02fef7ee2..51885a3364 100644
--- a/gmp/mpz/mul_2exp.c
+++ b/gmp/mpz/mul_2exp.c
@@ -1,73 +1,67 @@
/* mpz_mul_2exp -- Multiply a bignum by 2**CNT
-Copyright 1991, 1993, 1994, 1996, 2001, 2002, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_mul_2exp (mpz_ptr r, mpz_srcptr u, mp_bitcnt_t cnt)
+mpz_mul_2exp (mpz_ptr w, mpz_srcptr u, unsigned long int cnt)
{
- mp_size_t un, rn;
+ mp_size_t usize = u->_mp_size;
+ mp_size_t abs_usize = ABS (usize);
+ mp_size_t wsize;
mp_size_t limb_cnt;
- mp_ptr rp;
- mp_srcptr up;
- mp_limb_t rlimb;
+ mp_ptr wp;
+ mp_limb_t wlimb;
+
+ if (usize == 0)
+ {
+ w->_mp_size = 0;
+ return;
+ }
- un = ABSIZ (u);
limb_cnt = cnt / GMP_NUMB_BITS;
- rn = un + limb_cnt;
+ wsize = abs_usize + limb_cnt + 1;
+ if (w->_mp_alloc < wsize)
+ _mpz_realloc (w, wsize);
- if (un == 0)
- rn = 0;
- else
- {
- rp = MPZ_REALLOC (r, rn + 1);
- up = PTR(u);
+ wp = w->_mp_d;
+ wsize = abs_usize + limb_cnt;
- cnt %= GMP_NUMB_BITS;
- if (cnt != 0)
- {
- rlimb = mpn_lshift (rp + limb_cnt, up, un, cnt);
- rp[rn] = rlimb;
- rn += (rlimb != 0);
- }
- else
+ cnt %= GMP_NUMB_BITS;
+ if (cnt != 0)
+ {
+ wlimb = mpn_lshift (wp + limb_cnt, u->_mp_d, abs_usize, cnt);
+ if (wlimb != 0)
{
- MPN_COPY_DECR (rp + limb_cnt, up, un);
+ wp[wsize] = wlimb;
+ wsize++;
}
-
- /* Zero all whole limbs at low end. Do it here and not before calling
- mpn_lshift, not to lose for U == R. */
- MPN_ZERO (rp, limb_cnt);
}
+ else
+ {
+ MPN_COPY_DECR (wp + limb_cnt, u->_mp_d, abs_usize);
+ }
+
+ /* Zero all whole limbs at low end. Do it here and not before calling
+ mpn_lshift, not to lose for U == W. */
+ MPN_ZERO (wp, limb_cnt);
- SIZ(r) = SIZ(u) >= 0 ? rn : -rn;
+ w->_mp_size = usize >= 0 ? wsize : -wsize;
}
diff --git a/gmp/mpz/mul_i.h b/gmp/mpz/mul_i.h
index 486a8fd63e..d86196049b 100644
--- a/gmp/mpz/mul_i.h
+++ b/gmp/mpz/mul_i.h
@@ -1,34 +1,23 @@
/* mpz_mul_ui/si (product, multiplier, small_multiplicand) -- Set PRODUCT to
MULTIPLICATOR times SMALL_MULTIPLICAND.
-Copyright 1991, 1993, 1994, 1996, 2000-2002, 2005, 2008, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,7 +26,7 @@ see https://www.gnu.org/licenses/. */
#ifdef OPERATION_mul_si
#define FUNCTION mpz_mul_si
#define MULTIPLICAND_UNSIGNED
-#define MULTIPLICAND_ABS(x) ABS_CAST(unsigned long, (x))
+#define MULTIPLICAND_ABS(x) ((unsigned long) ABS(x))
#endif
#ifdef OPERATION_mul_ui
@@ -55,27 +44,27 @@ void
FUNCTION (mpz_ptr prod, mpz_srcptr mult,
MULTIPLICAND_UNSIGNED long int small_mult)
{
- mp_size_t size;
- mp_size_t sign_product;
+ mp_size_t size = SIZ(mult);
+ mp_size_t sign_product = size;
mp_limb_t sml;
mp_limb_t cy;
mp_ptr pp;
- sign_product = SIZ(mult);
- if (sign_product == 0 || small_mult == 0)
+ if (size == 0 || small_mult == 0)
{
SIZ(prod) = 0;
return;
}
- size = ABS (sign_product);
+ size = ABS (size);
sml = MULTIPLICAND_ABS (small_mult);
if (sml <= GMP_NUMB_MAX)
{
- pp = MPZ_REALLOC (prod, size + 1);
- cy = mpn_mul_1 (pp, PTR(mult), size, sml);
+ MPZ_REALLOC (prod, size + 1);
+ pp = PTR(prod);
+ cy = mpn_mul_1 (pp, PTR(mult), size, sml & GMP_NUMB_MASK);
pp[size] = cy;
size += cy != 0;
}
@@ -90,14 +79,14 @@ FUNCTION (mpz_ptr prod, mpz_srcptr mult,
tp = TMP_ALLOC_LIMBS (size + 2);
- /* Use, maybe, mpn_mul_2? */
cy = mpn_mul_1 (tp, PTR(mult), size, sml & GMP_NUMB_MASK);
tp[size] = cy;
cy = mpn_addmul_1 (tp + 1, PTR(mult), size, sml >> GMP_NUMB_BITS);
tp[size + 1] = cy;
size += 2;
MPN_NORMALIZE_NOT_ZERO (tp, size); /* too general, need to trim one or two limb */
- pp = MPZ_REALLOC (prod, size);
+ MPZ_REALLOC (prod, size);
+ pp = PTR(prod);
MPN_COPY (pp, tp, size);
TMP_FREE;
}
diff --git a/gmp/mpz/mul_si.c b/gmp/mpz/mul_si.c
index 9f29f601e2..86d5d31a36 100644
--- a/gmp/mpz/mul_si.c
+++ b/gmp/mpz/mul_si.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_mul_si
diff --git a/gmp/mpz/mul_ui.c b/gmp/mpz/mul_ui.c
index d398c4f6f1..96303519c9 100644
--- a/gmp/mpz/mul_ui.c
+++ b/gmp/mpz/mul_ui.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_mul_ui
diff --git a/gmp/mpz/n_pow_ui.c b/gmp/mpz/n_pow_ui.c
index 6c3febe237..4f3f4979bf 100644
--- a/gmp/mpz/n_pow_ui.c
+++ b/gmp/mpz/n_pow_ui.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002, 2005, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2005 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -66,11 +55,11 @@ see https://www.gnu.org/licenses/. */
The initial powering for bsize==1 into blimb or blimb:blimb_low doesn't
form the biggest possible power of b that fits, only the biggest power of
2 power, ie. b^(2^n). It'd be possible to choose a bigger power, perhaps
- using mp_bases[b].big_base for small b, and thereby get better value
+ using __mp_bases[b].big_base for small b, and thereby get better value
from mpn_mul_1 or mpn_mul_2 in the bignum powering. It's felt that doing
so would be more complicated than it's worth, and could well end up being
a slowdown for small e. For big e on the other hand the algorithm is
- dominated by mpn_sqr so there wouldn't much of a saving. The current
+ dominated by mpn_sqr_n so there wouldn't much of a saving. The current
code can be viewed as simply doing the first few steps of the powering in
a single or double limb where possible.
@@ -90,10 +79,10 @@ see https://www.gnu.org/licenses/. */
/* The following are for convenience, they update the size and check the
alloc. */
-#define MPN_SQR(dst, alloc, src, size) \
+#define MPN_SQR_N(dst, alloc, src, size) \
do { \
ASSERT (2*(size) <= (alloc)); \
- mpn_sqr (dst, src, size); \
+ mpn_sqr_n (dst, src, size); \
(size) *= 2; \
(size) -= ((dst)[(size)-1] == 0); \
} while (0)
@@ -165,7 +154,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
mp_size_t rtwos_limbs, ralloc, rsize;
int rneg, i, cnt, btwos, r_bp_overlap;
mp_limb_t blimb, rl;
- mp_bitcnt_t rtwos_bits;
+ unsigned long rtwos_bits;
#if HAVE_NATIVE_mpn_mul_2
mp_limb_t blimb_low, rl_high;
#else
@@ -174,11 +163,11 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
TMP_DECL;
TRACE (printf ("mpz_n_pow_ui rp=0x%lX bp=0x%lX bsize=%ld e=%lu (0x%lX)\n",
- PTR(r), bp, bsize, e, e);
- mpn_trace ("b", bp, bsize));
+ PTR(r), bp, bsize, e, e);
+ mpn_trace ("b", bp, bsize));
ASSERT (bsize == 0 || bp[ABS(bsize)-1] != 0);
- ASSERT (MPN_SAME_OR_SEPARATE2_P (PTR(r), ALLOC(r), bp, ABS(bsize)));
+ ASSERT (MPN_SAME_OR_SEPARATE2_P (PTR(r), ABSIZ(r), bp, bsize));
/* b^0 == 1, including 0^0 == 1 */
if (e == 0)
@@ -218,7 +207,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
rtwos_limbs += rtwos_bits / GMP_NUMB_BITS;
rtwos_bits %= GMP_NUMB_BITS;
TRACE (printf ("trailing zero btwos=%d rtwos_limbs=%ld rtwos_bits=%lu\n",
- btwos, rtwos_limbs, rtwos_bits));
+ btwos, rtwos_limbs, rtwos_bits));
TMP_MARK;
@@ -231,25 +220,25 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
{
bsize_1:
/* Power up as far as possible within blimb. We start here with e!=0,
- but if e is small then we might reach e==0 and the whole b^e in rl.
- Notice this code works when blimb==1 too, reaching e==0. */
+ but if e is small then we might reach e==0 and the whole b^e in rl.
+ Notice this code works when blimb==1 too, reaching e==0. */
while (blimb <= GMP_NUMB_HALFMAX)
- {
- TRACE (printf ("small e=0x%lX blimb=0x%lX rl=0x%lX\n",
- e, blimb, rl));
- ASSERT (e != 0);
- if ((e & 1) != 0)
- rl *= blimb;
- e >>= 1;
- if (e == 0)
- goto got_rl;
- blimb *= blimb;
- }
+ {
+ TRACE (printf ("small e=0x%lX blimb=0x%lX rl=0x%lX\n",
+ e, blimb, rl));
+ ASSERT (e != 0);
+ if ((e & 1) != 0)
+ rl *= blimb;
+ e >>= 1;
+ if (e == 0)
+ goto got_rl;
+ blimb *= blimb;
+ }
#if HAVE_NATIVE_mpn_mul_2
TRACE (printf ("single power, e=0x%lX b=0x%lX rl=0x%lX\n",
- e, blimb, rl));
+ e, blimb, rl));
/* Can power b once more into blimb:blimb_low */
bsize = 2;
@@ -265,62 +254,62 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
got_rl:
TRACE (printf ("double power e=0x%lX blimb=0x%lX:0x%lX rl=0x%lX:%lX\n",
- e, blimb, blimb_low, rl_high, rl));
+ e, blimb, blimb_low, rl_high, rl));
/* Combine left-over rtwos_bits into rl_high:rl to be handled by the
- final mul_1 or mul_2 rather than a separate lshift.
- - rl_high:rl mustn't be 1 (since then there's no final mul)
- - rl_high mustn't overflow
- - rl_high mustn't change to non-zero, since mul_1+lshift is
- probably faster than mul_2 (FIXME: is this true?) */
+ final mul_1 or mul_2 rather than a separate lshift.
+ - rl_high:rl mustn't be 1 (since then there's no final mul)
+ - rl_high mustn't overflow
+ - rl_high mustn't change to non-zero, since mul_1+lshift is
+ probably faster than mul_2 (FIXME: is this true?) */
if (rtwos_bits != 0
- && ! (rl_high == 0 && rl == 1)
- && (rl_high >> (GMP_NUMB_BITS-rtwos_bits)) == 0)
- {
- mp_limb_t new_rl_high = (rl_high << rtwos_bits)
- | (rl >> (GMP_NUMB_BITS-rtwos_bits));
- if (! (rl_high == 0 && new_rl_high != 0))
- {
- rl_high = new_rl_high;
- rl <<= rtwos_bits;
- rtwos_bits = 0;
- TRACE (printf ("merged rtwos_bits, rl=0x%lX:%lX\n",
- rl_high, rl));
- }
- }
+ && ! (rl_high == 0 && rl == 1)
+ && (rl_high >> (GMP_NUMB_BITS-rtwos_bits)) == 0)
+ {
+ mp_limb_t new_rl_high = (rl_high << rtwos_bits)
+ | (rl >> (GMP_NUMB_BITS-rtwos_bits));
+ if (! (rl_high == 0 && new_rl_high != 0))
+ {
+ rl_high = new_rl_high;
+ rl <<= rtwos_bits;
+ rtwos_bits = 0;
+ TRACE (printf ("merged rtwos_bits, rl=0x%lX:%lX\n",
+ rl_high, rl));
+ }
+ }
#else
got_rl:
TRACE (printf ("small power e=0x%lX blimb=0x%lX rl=0x%lX\n",
- e, blimb, rl));
+ e, blimb, rl));
/* Combine left-over rtwos_bits into rl to be handled by the final
- mul_1 rather than a separate lshift.
- - rl mustn't be 1 (since then there's no final mul)
- - rl mustn't overflow */
+ mul_1 rather than a separate lshift.
+ - rl mustn't be 1 (since then there's no final mul)
+ - rl mustn't overflow */
if (rtwos_bits != 0
- && rl != 1
- && (rl >> (GMP_NUMB_BITS-rtwos_bits)) == 0)
- {
- rl <<= rtwos_bits;
- rtwos_bits = 0;
- TRACE (printf ("merged rtwos_bits, rl=0x%lX\n", rl));
- }
+ && rl != 1
+ && (rl >> (GMP_NUMB_BITS-rtwos_bits)) == 0)
+ {
+ rl <<= rtwos_bits;
+ rtwos_bits = 0;
+ TRACE (printf ("merged rtwos_bits, rl=0x%lX\n", rl));
+ }
#endif
}
else if (bsize == 2)
{
mp_limb_t bsecond = bp[1];
if (btwos != 0)
- blimb |= (bsecond << (GMP_NUMB_BITS - btwos)) & GMP_NUMB_MASK;
+ blimb |= (bsecond << (GMP_NUMB_BITS - btwos)) & GMP_NUMB_MASK;
bsecond >>= btwos;
if (bsecond == 0)
- {
- /* Two limbs became one after rshift. */
- bsize = 1;
- goto bsize_1;
- }
+ {
+ /* Two limbs became one after rshift. */
+ bsize = 1;
+ goto bsize_1;
+ }
TRACE (printf ("bsize==2 using b=0x%lX:%lX", bsecond, blimb));
#if HAVE_NATIVE_mpn_mul_2
@@ -335,12 +324,12 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
else
{
if (r_bp_overlap || btwos != 0)
- {
- mp_ptr tp = TMP_ALLOC_LIMBS (bsize);
- MPN_RSHIFT_OR_COPY (tp, bp, bsize, btwos);
- bp = tp;
- TRACE (printf ("rshift or copy bp,bsize, new bsize=%ld\n", bsize));
- }
+ {
+ mp_ptr tp = TMP_ALLOC_LIMBS (bsize);
+ MPN_RSHIFT_OR_COPY (tp, bp, bsize, btwos);
+ bp = tp;
+ TRACE (printf ("rshift or copy bp,bsize, new bsize=%ld\n", bsize));
+ }
#if HAVE_NATIVE_mpn_mul_2
/* in case 3 limbs rshift to 2 and hence use the mul_2 loop below */
blimb_low = bp[0];
@@ -348,7 +337,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
blimb = bp[bsize-1];
TRACE (printf ("big bsize=%ld ", bsize);
- mpn_trace ("b", bp, bsize));
+ mpn_trace ("b", bp, bsize));
}
/* At this point blimb is the most significant limb of the base to use.
@@ -371,8 +360,9 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
count_leading_zeros (cnt, blimb);
ralloc = (bsize*GMP_NUMB_BITS - cnt + GMP_NAIL_BITS) * e / GMP_NUMB_BITS + 5;
TRACE (printf ("ralloc %ld, from bsize=%ld blimb=0x%lX cnt=%d\n",
- ralloc, bsize, blimb, cnt));
- rp = MPZ_REALLOC (r, ralloc + rtwos_limbs);
+ ralloc, bsize, blimb, cnt));
+ MPZ_REALLOC (r, ralloc + rtwos_limbs);
+ rp = PTR(r);
/* Low zero limbs resulting from powers of 2. */
MPN_ZERO (rp, rtwos_limbs);
@@ -381,7 +371,7 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
if (e == 0)
{
/* Any e==0 other than via bsize==1 or bsize==2 is covered at the
- start. */
+ start. */
rp[0] = rl;
rsize = 1;
#if HAVE_NATIVE_mpn_mul_2
@@ -396,125 +386,125 @@ mpz_n_pow_ui (mpz_ptr r, mp_srcptr bp, mp_size_t bsize, unsigned long int e)
mp_size_t talloc;
/* In the mpn_mul_1 or mpn_mul_2 loops or in the mpn_mul loop when the
- low bit of e is zero, tp only has to hold the second last power
- step, which is half the size of the final result. There's no need
- to round up the divide by 2, since ralloc includes a +2 for rl
- which not needed by tp. In the mpn_mul loop when the low bit of e
- is 1, tp must hold nearly the full result, so just size it the same
- as rp. */
+ low bit of e is zero, tp only has to hold the second last power
+ step, which is half the size of the final result. There's no need
+ to round up the divide by 2, since ralloc includes a +2 for rl
+ which not needed by tp. In the mpn_mul loop when the low bit of e
+ is 1, tp must hold nearly the full result, so just size it the same
+ as rp. */
talloc = ralloc;
#if HAVE_NATIVE_mpn_mul_2
if (bsize <= 2 || (e & 1) == 0)
- talloc /= 2;
+ talloc /= 2;
#else
if (bsize <= 1 || (e & 1) == 0)
- talloc /= 2;
+ talloc /= 2;
#endif
TRACE (printf ("talloc %ld\n", talloc));
tp = TMP_ALLOC_LIMBS (talloc);
/* Go from high to low over the bits of e, starting with i pointing at
- the bit below the highest 1 (which will mean i==-1 if e==1). */
- count_leading_zeros (cnt, (mp_limb_t) e);
+ the bit below the highest 1 (which will mean i==-1 if e==1). */
+ count_leading_zeros (cnt, e);
i = GMP_LIMB_BITS - cnt - 2;
#if HAVE_NATIVE_mpn_mul_2
if (bsize <= 2)
- {
- mp_limb_t mult[2];
-
- /* Any bsize==1 will have been powered above to be two limbs. */
- ASSERT (bsize == 2);
- ASSERT (blimb != 0);
-
- /* Arrange the final result ends up in r, not in the temp space */
- if ((i & 1) == 0)
- SWAP_RP_TP;
-
- rp[0] = blimb_low;
- rp[1] = blimb;
- rsize = 2;
-
- mult[0] = blimb_low;
- mult[1] = blimb;
-
- for ( ; i >= 0; i--)
- {
- TRACE (printf ("mul_2 loop i=%d e=0x%lX, rsize=%ld ralloc=%ld talloc=%ld\n",
- i, e, rsize, ralloc, talloc);
- mpn_trace ("r", rp, rsize));
-
- MPN_SQR (tp, talloc, rp, rsize);
- SWAP_RP_TP;
- if ((e & (1L << i)) != 0)
- MPN_MUL_2 (rp, rsize, ralloc, mult);
- }
-
- TRACE (mpn_trace ("mul_2 before rl, r", rp, rsize));
- if (rl_high != 0)
- {
- mult[0] = rl;
- mult[1] = rl_high;
- MPN_MUL_2 (rp, rsize, ralloc, mult);
- }
- else if (rl != 1)
- MPN_MUL_1 (rp, rsize, ralloc, rl);
- }
+ {
+ mp_limb_t mult[2];
+
+ /* Any bsize==1 will have been powered above to be two limbs. */
+ ASSERT (bsize == 2);
+ ASSERT (blimb != 0);
+
+ /* Arrange the final result ends up in r, not in the temp space */
+ if ((i & 1) == 0)
+ SWAP_RP_TP;
+
+ rp[0] = blimb_low;
+ rp[1] = blimb;
+ rsize = 2;
+
+ mult[0] = blimb_low;
+ mult[1] = blimb;
+
+ for ( ; i >= 0; i--)
+ {
+ TRACE (printf ("mul_2 loop i=%d e=0x%lX, rsize=%ld ralloc=%ld talloc=%ld\n",
+ i, e, rsize, ralloc, talloc);
+ mpn_trace ("r", rp, rsize));
+
+ MPN_SQR_N (tp, talloc, rp, rsize);
+ SWAP_RP_TP;
+ if ((e & (1L << i)) != 0)
+ MPN_MUL_2 (rp, rsize, ralloc, mult);
+ }
+
+ TRACE (mpn_trace ("mul_2 before rl, r", rp, rsize));
+ if (rl_high != 0)
+ {
+ mult[0] = rl;
+ mult[1] = rl_high;
+ MPN_MUL_2 (rp, rsize, ralloc, mult);
+ }
+ else if (rl != 1)
+ MPN_MUL_1 (rp, rsize, ralloc, rl);
+ }
#else
if (bsize == 1)
- {
- /* Arrange the final result ends up in r, not in the temp space */
- if ((i & 1) == 0)
- SWAP_RP_TP;
-
- rp[0] = blimb;
- rsize = 1;
-
- for ( ; i >= 0; i--)
- {
- TRACE (printf ("mul_1 loop i=%d e=0x%lX, rsize=%ld ralloc=%ld talloc=%ld\n",
- i, e, rsize, ralloc, talloc);
- mpn_trace ("r", rp, rsize));
-
- MPN_SQR (tp, talloc, rp, rsize);
- SWAP_RP_TP;
- if ((e & (1L << i)) != 0)
- MPN_MUL_1 (rp, rsize, ralloc, blimb);
- }
-
- TRACE (mpn_trace ("mul_1 before rl, r", rp, rsize));
- if (rl != 1)
- MPN_MUL_1 (rp, rsize, ralloc, rl);
- }
+ {
+ /* Arrange the final result ends up in r, not in the temp space */
+ if ((i & 1) == 0)
+ SWAP_RP_TP;
+
+ rp[0] = blimb;
+ rsize = 1;
+
+ for ( ; i >= 0; i--)
+ {
+ TRACE (printf ("mul_1 loop i=%d e=0x%lX, rsize=%ld ralloc=%ld talloc=%ld\n",
+ i, e, rsize, ralloc, talloc);
+ mpn_trace ("r", rp, rsize));
+
+ MPN_SQR_N (tp, talloc, rp, rsize);
+ SWAP_RP_TP;
+ if ((e & (1L << i)) != 0)
+ MPN_MUL_1 (rp, rsize, ralloc, blimb);
+ }
+
+ TRACE (mpn_trace ("mul_1 before rl, r", rp, rsize));
+ if (rl != 1)
+ MPN_MUL_1 (rp, rsize, ralloc, rl);
+ }
#endif
else
- {
- int parity;
-
- /* Arrange the final result ends up in r, not in the temp space */
- ULONG_PARITY (parity, e);
- if (((parity ^ i) & 1) != 0)
- SWAP_RP_TP;
-
- MPN_COPY (rp, bp, bsize);
- rsize = bsize;
-
- for ( ; i >= 0; i--)
- {
- TRACE (printf ("mul loop i=%d e=0x%lX, rsize=%ld ralloc=%ld talloc=%ld\n",
- i, e, rsize, ralloc, talloc);
- mpn_trace ("r", rp, rsize));
-
- MPN_SQR (tp, talloc, rp, rsize);
- SWAP_RP_TP;
- if ((e & (1L << i)) != 0)
- {
- MPN_MUL (tp, talloc, rp, rsize, bp, bsize);
- SWAP_RP_TP;
- }
- }
- }
+ {
+ int parity;
+
+ /* Arrange the final result ends up in r, not in the temp space */
+ ULONG_PARITY (parity, e);
+ if (((parity ^ i) & 1) != 0)
+ SWAP_RP_TP;
+
+ MPN_COPY (rp, bp, bsize);
+ rsize = bsize;
+
+ for ( ; i >= 0; i--)
+ {
+ TRACE (printf ("mul loop i=%d e=0x%lX, rsize=%ld ralloc=%ld talloc=%ld\n",
+ i, e, rsize, ralloc, talloc);
+ mpn_trace ("r", rp, rsize));
+
+ MPN_SQR_N (tp, talloc, rp, rsize);
+ SWAP_RP_TP;
+ if ((e & (1L << i)) != 0)
+ {
+ MPN_MUL (tp, talloc, rp, rsize, bp, bsize);
+ SWAP_RP_TP;
+ }
+ }
+ }
}
ASSERT (rp == PTR(r) + rtwos_limbs);
diff --git a/gmp/mpz/neg.c b/gmp/mpz/neg.c
index eb46ab7f78..6d0f8a994d 100644
--- a/gmp/mpz/neg.c
+++ b/gmp/mpz/neg.c
@@ -1,32 +1,21 @@
/* mpz_neg(mpz_ptr dst, mpz_ptr src) -- Assign the negated value of SRC to DST.
-Copyright 1991, 1993-1995, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_neg 1
@@ -36,22 +25,23 @@ see https://www.gnu.org/licenses/. */
void
mpz_neg (mpz_ptr w, mpz_srcptr u)
{
- mp_ptr wp;
- mp_srcptr up;
+ mp_ptr wp, up;
mp_size_t usize, size;
- usize = SIZ (u);
+ usize = u->_mp_size;
if (u != w)
{
size = ABS (usize);
- wp = MPZ_NEWALLOC (w, size);
+ if (w->_mp_alloc < size)
+ _mpz_realloc (w, size);
- up = PTR (u);
+ wp = w->_mp_d;
+ up = u->_mp_d;
MPN_COPY (wp, up, size);
}
- SIZ (w) = -usize;
+ w->_mp_size = -usize;
}
diff --git a/gmp/mpz/nextprime.c b/gmp/mpz/nextprime.c
index 1493054695..0fd8da57e9 100644
--- a/gmp/mpz/nextprime.c
+++ b/gmp/mpz/nextprime.c
@@ -1,34 +1,23 @@
/* mpz_nextprime(p,t) - compute the next prime > t and store that in p.
-Copyright 1999-2001, 2008, 2009, 2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2008, 2009 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 Torbjörn 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -54,8 +43,9 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n)
int i;
unsigned prime_limit;
unsigned long prime;
+ int cnt;
mp_size_t pn;
- mp_bitcnt_t nbits;
+ unsigned long nbits;
unsigned incr;
TMP_SDECL;
@@ -72,7 +62,8 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n)
return;
pn = SIZ(p);
- MPN_SIZEINBASE_2EXP(nbits, PTR(p), pn, 1);
+ count_leading_zeros (cnt, PTR(p)[pn - 1]);
+ nbits = pn * GMP_NUMB_BITS - (cnt - GMP_NAIL_BITS);
if (nbits / 2 >= NUMBER_OF_PRIMES)
prime_limit = NUMBER_OF_PRIMES - 1;
else
@@ -116,7 +107,7 @@ mpz_nextprime (mpz_ptr p, mpz_srcptr n)
difference = 0;
/* Miller-Rabin test */
- if (mpz_millerrabin (p, 25))
+ if (mpz_millerrabin (p, 10))
goto done;
next:;
incr += 2;
diff --git a/gmp/mpz/oddfac_1.c b/gmp/mpz/oddfac_1.c
deleted file mode 100644
index cf0bff0650..0000000000
--- a/gmp/mpz/oddfac_1.c
+++ /dev/null
@@ -1,427 +0,0 @@
-/* mpz_oddfac_1(RESULT, N) -- Set RESULT to the odd factor of N!.
-
-Contributed to the GNU project by 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 GUARANTEED THAT IT WILL CHANGE OR
-DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/* TODO:
- - split this file in smaller parts with functions that can be recycled for different computations.
- */
-
-/**************************************************************/
-/* Section macros: common macros, for mswing/fac/bin (&sieve) */
-/**************************************************************/
-
-#define FACTOR_LIST_APPEND(PR, MAX_PR, VEC, I) \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = 1; \
- }
-
-#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
- do { \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = (P); \
- } else \
- (PR) *= (P); \
- } while (0)
-
-#define LOOP_ON_SIEVE_CONTINUE(prime,end,sieve) \
- __max_i = (end); \
- \
- do { \
- ++__i; \
- if (((sieve)[__index] & __mask) == 0) \
- { \
- (prime) = id_to_n(__i)
-
-#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
- do { \
- mp_limb_t __mask, __index, __max_i, __i; \
- \
- __i = (start)-(off); \
- __index = __i / GMP_LIMB_BITS; \
- __mask = CNST_LIMB(1) << (__i % GMP_LIMB_BITS); \
- __i += (off); \
- \
- LOOP_ON_SIEVE_CONTINUE(prime,end,sieve)
-
-#define LOOP_ON_SIEVE_STOP \
- } \
- __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
- __index += __mask & 1; \
- } while (__i <= __max_i) \
-
-#define LOOP_ON_SIEVE_END \
- LOOP_ON_SIEVE_STOP; \
- } while (0)
-
-/*********************************************************/
-/* Section sieve: sieving functions and tools for primes */
-/*********************************************************/
-
-#if WANT_ASSERT
-static mp_limb_t
-bit_to_n (mp_limb_t bit) { return (bit*3+4)|1; }
-#endif
-
-/* id_to_n (x) = bit_to_n (x-1) = (id*3+1)|1*/
-static mp_limb_t
-id_to_n (mp_limb_t id) { return id*3+1+(id&1); }
-
-/* n_to_bit (n) = ((n-1)&(-CNST_LIMB(2)))/3U-1 */
-static mp_limb_t
-n_to_bit (mp_limb_t n) { return ((n-5)|1)/3U; }
-
-#if WANT_ASSERT
-static mp_size_t
-primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
-#endif
-
-/*********************************************************/
-/* Section mswing: 2-multiswing factorial */
-/*********************************************************/
-
-/* Returns an approximation of the sqare root of x. *
- * It gives: x <= limb_apprsqrt (x) ^ 2 < x * 9/4 */
-static mp_limb_t
-limb_apprsqrt (mp_limb_t x)
-{
- int s;
-
- ASSERT (x > 2);
- count_leading_zeros (s, x - 1);
- s = GMP_LIMB_BITS - 1 - s;
- return (CNST_LIMB(1) << (s >> 1)) + (CNST_LIMB(1) << ((s - 1) >> 1));
-}
-
-#if 0
-/* A count-then-exponentiate variant for SWING_A_PRIME */
-#define SWING_A_PRIME(P, N, PR, MAX_PR, VEC, I) \
- do { \
- mp_limb_t __q, __prime; \
- int __exp; \
- __prime = (P); \
- __exp = 0; \
- __q = (N); \
- do { \
- __q /= __prime; \
- __exp += __q & 1; \
- } while (__q >= __prime); \
- if (__exp) { /* Store $prime^{exp}$ */ \
- for (__q = __prime; --__exp; __q *= __prime); \
- FACTOR_LIST_STORE(__q, PR, MAX_PR, VEC, I); \
- }; \
- } while (0)
-#else
-#define SWING_A_PRIME(P, N, PR, MAX_PR, VEC, I) \
- do { \
- mp_limb_t __q, __prime; \
- __prime = (P); \
- FACTOR_LIST_APPEND(PR, MAX_PR, VEC, I); \
- __q = (N); \
- do { \
- __q /= __prime; \
- if ((__q & 1) != 0) (PR) *= __prime; \
- } while (__q >= __prime); \
- } while (0)
-#endif
-
-#define SH_SWING_A_PRIME(P, N, PR, MAX_PR, VEC, I) \
- do { \
- mp_limb_t __prime; \
- __prime = (P); \
- if ((((N) / __prime) & 1) != 0) \
- FACTOR_LIST_STORE(__prime, PR, MAX_PR, VEC, I); \
- } while (0)
-
-/* mpz_2multiswing_1 computes the odd part of the 2-multiswing
- factorial of the parameter n. The result x is an odd positive
- integer so that multiswing(n,2) = x 2^a.
-
- Uses the algorithm described by Peter Luschny in "Divide, Swing and
- Conquer the Factorial!".
-
- The pointer sieve points to primesieve_size(n) limbs containing a
- bit-array where primes are marked as 0.
- Enough (FIXME: explain :-) limbs must be pointed by factors.
- */
-
-static void
-mpz_2multiswing_1 (mpz_ptr x, mp_limb_t n, mp_ptr sieve, mp_ptr factors)
-{
- mp_limb_t prod, max_prod;
- mp_size_t j;
-
- ASSERT (n >= 26);
-
- j = 0;
- prod = -(n & 1);
- n &= ~ CNST_LIMB(1); /* n-1, if n is odd */
-
- prod = (prod & n) + 1; /* the original n, if it was odd, 1 otherwise */
- max_prod = GMP_NUMB_MAX / (n-1);
-
- /* Handle prime = 3 separately. */
- SWING_A_PRIME (3, n, prod, max_prod, factors, j);
-
- /* Swing primes from 5 to n/3 */
- {
- mp_limb_t s;
-
- {
- mp_limb_t prime;
-
- s = limb_apprsqrt(n);
- ASSERT (s >= 5);
- s = n_to_bit (s);
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (5), s, 0,sieve);
- SWING_A_PRIME (prime, n, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- s++;
- }
-
- ASSERT (max_prod <= GMP_NUMB_MAX / 3);
- ASSERT (bit_to_n (s) * bit_to_n (s) > n);
- ASSERT (s <= n_to_bit (n / 3));
- {
- mp_limb_t prime;
- mp_limb_t l_max_prod = max_prod * 3;
-
- LOOP_ON_SIEVE_BEGIN (prime, s, n_to_bit (n/3), 0, sieve);
- SH_SWING_A_PRIME (prime, n, prod, l_max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
- }
-
- /* Store primes from (n+1)/2 to n */
- {
- mp_limb_t prime;
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit (n >> 1) + 1, n_to_bit (n), 0,sieve);
- FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
-
- if (LIKELY (j != 0))
- {
- factors[j++] = prod;
- mpz_prodlimbs (x, factors, j);
- }
- else
- {
- PTR (x)[0] = prod;
- SIZ (x) = 1;
- }
-}
-
-#undef SWING_A_PRIME
-#undef SH_SWING_A_PRIME
-#undef LOOP_ON_SIEVE_END
-#undef LOOP_ON_SIEVE_STOP
-#undef LOOP_ON_SIEVE_BEGIN
-#undef LOOP_ON_SIEVE_CONTINUE
-#undef FACTOR_LIST_APPEND
-
-/*********************************************************/
-/* Section oddfac: odd factorial, needed also by binomial*/
-/*********************************************************/
-
-#if TUNE_PROGRAM_BUILD
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD_LIMIT-1)+1))
-#else
-#define FACTORS_PER_LIMB (GMP_NUMB_BITS / (LOG2C(FAC_DSC_THRESHOLD-1)+1))
-#endif
-
-/* mpz_oddfac_1 computes the odd part of the factorial of the
- parameter n. I.e. n! = x 2^a, where x is the returned value: an
- odd positive integer.
-
- If flag != 0 a square is skipped in the DSC part, e.g.
- if n is odd, n > FAC_DSC_THRESHOLD and flag = 1, x is set to n!!.
-
- If n is too small, flag is ignored, and an ASSERT can be triggered.
-
- TODO: FAC_DSC_THRESHOLD is used here with two different roles:
- - to decide when prime factorisation is needed,
- - to stop the recursion, once sieving is done.
- Maybe two thresholds can do a better job.
- */
-void
-mpz_oddfac_1 (mpz_ptr x, mp_limb_t n, unsigned flag)
-{
- ASSERT (n <= GMP_NUMB_MAX);
- ASSERT (flag == 0 || (flag == 1 && n > ODD_FACTORIAL_TABLE_LIMIT && ABOVE_THRESHOLD (n, FAC_DSC_THRESHOLD)));
-
- if (n <= ODD_FACTORIAL_TABLE_LIMIT)
- {
- PTR (x)[0] = __gmp_oddfac_table[n];
- SIZ (x) = 1;
- }
- else if (n <= ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 1)
- {
- mp_ptr px;
-
- px = MPZ_NEWALLOC (x, 2);
- umul_ppmm (px[1], px[0], __gmp_odd2fac_table[(n - 1) >> 1], __gmp_oddfac_table[n >> 1]);
- SIZ (x) = 2;
- }
- else
- {
- unsigned s;
- mp_ptr factors;
-
- s = 0;
- {
- mp_limb_t tn;
- mp_limb_t prod, max_prod, i;
- mp_size_t j;
- TMP_SDECL;
-
-#if TUNE_PROGRAM_BUILD
- ASSERT (FAC_DSC_THRESHOLD_LIMIT >= FAC_DSC_THRESHOLD);
- ASSERT (FAC_DSC_THRESHOLD >= 2 * (ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 2));
-#endif
-
- /* Compute the number of recursive steps for the DSC algorithm. */
- for (tn = n; ABOVE_THRESHOLD (tn, FAC_DSC_THRESHOLD); s++)
- tn >>= 1;
-
- j = 0;
-
- TMP_SMARK;
- factors = TMP_SALLOC_LIMBS (1 + tn / FACTORS_PER_LIMB);
- ASSERT (tn >= FACTORS_PER_LIMB);
-
- prod = 1;
-#if TUNE_PROGRAM_BUILD
- max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD_LIMIT;
-#else
- max_prod = GMP_NUMB_MAX / FAC_DSC_THRESHOLD;
-#endif
-
- ASSERT (tn > ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 1);
- do {
- i = ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 2;
- factors[j++] = ODD_DOUBLEFACTORIAL_TABLE_MAX;
- do {
- FACTOR_LIST_STORE (i, prod, max_prod, factors, j);
- i += 2;
- } while (i <= tn);
- max_prod <<= 1;
- tn >>= 1;
- } while (tn > ODD_DOUBLEFACTORIAL_TABLE_LIMIT + 1);
-
- factors[j++] = prod;
- factors[j++] = __gmp_odd2fac_table[(tn - 1) >> 1];
- factors[j++] = __gmp_oddfac_table[tn >> 1];
- mpz_prodlimbs (x, factors, j);
-
- TMP_SFREE;
- }
-
- if (s != 0)
- /* Use the algorithm described by Peter Luschny in "Divide,
- Swing and Conquer the Factorial!".
-
- Improvement: there are two temporary buffers, factors and
- square, that are never used together; with a good estimate
- of the maximal needed size, they could share a single
- allocation.
- */
- {
- mpz_t mswing;
- mp_ptr sieve;
- mp_size_t size;
- TMP_DECL;
-
- TMP_MARK;
-
- flag--;
- size = n / GMP_NUMB_BITS + 4;
- ASSERT (primesieve_size (n - 1) <= size - (size / 2 + 1));
- /* 2-multiswing(n) < 2^(n-1)*sqrt(n/pi) < 2^(n+GMP_NUMB_BITS);
- one more can be overwritten by mul, another for the sieve */
- MPZ_TMP_INIT (mswing, size);
- /* Initialize size, so that ASSERT can check it correctly. */
- ASSERT_CODE (SIZ (mswing) = 0);
-
- /* Put the sieve on the second half, it will be overwritten by the last mswing. */
- sieve = PTR (mswing) + size / 2 + 1;
-
- size = (gmp_primesieve (sieve, n - 1) + 1) / log_n_max (n) + 1;
-
- factors = TMP_ALLOC_LIMBS (size);
- do {
- mp_ptr square, px;
- mp_size_t nx, ns;
- mp_limb_t cy;
- TMP_DECL;
-
- s--;
- ASSERT (ABSIZ (mswing) < ALLOC (mswing) / 2); /* Check: sieve has not been overwritten */
- mpz_2multiswing_1 (mswing, n >> s, sieve, factors);
-
- TMP_MARK;
- nx = SIZ (x);
- if (s == flag) {
- size = nx;
- square = TMP_ALLOC_LIMBS (size);
- MPN_COPY (square, PTR (x), nx);
- } else {
- size = nx << 1;
- square = TMP_ALLOC_LIMBS (size);
- mpn_sqr (square, PTR (x), nx);
- size -= (square[size - 1] == 0);
- }
- ns = SIZ (mswing);
- nx = size + ns;
- px = MPZ_NEWALLOC (x, nx);
- ASSERT (ns <= size);
- cy = mpn_mul (px, square, size, PTR(mswing), ns); /* n!= n$ * floor(n/2)!^2 */
-
- TMP_FREE;
- SIZ(x) = nx - (cy == 0);
- } while (s != 0);
- TMP_FREE;
- }
- }
-}
-
-#undef FACTORS_PER_LIMB
-#undef FACTOR_LIST_STORE
diff --git a/gmp/mpz/out_raw.c b/gmp/mpz/out_raw.c
index 3b6b0b7cb5..3eb9fab50e 100644
--- a/gmp/mpz/out_raw.c
+++ b/gmp/mpz/out_raw.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -51,8 +40,8 @@ see https://www.gnu.org/licenses/. */
mp_limb_t __limb = (limb); \
char *__p = (char *) (dst); \
int __i; \
- for (__i = 0; __i < GMP_LIMB_BYTES; __i++) \
- __p[__i] = (char) (__limb >> ((GMP_LIMB_BYTES-1 - __i) * 8)); \
+ for (__i = 0; __i < BYTES_PER_MP_LIMB; __i++) \
+ __p[__i] = (char) (__limb >> ((BYTES_PER_MP_LIMB-1 - __i) * 8)); \
} while (0)
#endif
@@ -70,10 +59,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, GMP_LIMB_BYTES) + bytes;
+ tsize = ROUND_UP_MULTIPLE ((unsigned) 4, BYTES_PER_MP_LIMB) + bytes;
tp = __GMP_ALLOCATE_FUNC_TYPE (tsize, char);
- bp = tp + ROUND_UP_MULTIPLE ((unsigned) 4, GMP_LIMB_BYTES);
+ bp = tp + ROUND_UP_MULTIPLE ((unsigned) 4, BYTES_PER_MP_LIMB);
if (bytes != 0)
{
@@ -82,70 +71,70 @@ mpz_out_raw (FILE *fp, mpz_srcptr x)
i = abs_xsize;
if (GMP_NAIL_BITS == 0)
- {
- /* reverse limb order, and byte swap if necessary */
+ {
+ /* reverse limb order, and byte swap if necessary */
#ifdef _CRAY
- _Pragma ("_CRI ivdep");
+ _Pragma ("_CRI ivdep");
#endif
- do
- {
- bp -= GMP_LIMB_BYTES;
- xlimb = *xp;
- HTON_LIMB_STORE ((mp_ptr) bp, xlimb);
- xp++;
- }
- while (--i > 0);
-
- /* strip high zero bytes (without fetching from bp) */
- count_leading_zeros (zeros, xlimb);
- zeros /= 8;
- bp += zeros;
- bytes -= zeros;
- }
+ do
+ {
+ bp -= BYTES_PER_MP_LIMB;
+ xlimb = *xp;
+ HTON_LIMB_STORE ((mp_ptr) bp, xlimb);
+ xp++;
+ }
+ while (--i > 0);
+
+ /* strip high zero bytes (without fetching from bp) */
+ count_leading_zeros (zeros, xlimb);
+ zeros /= 8;
+ bp += zeros;
+ bytes -= zeros;
+ }
else
- {
- mp_limb_t new_xlimb;
- int bits;
- ASSERT_CODE (char *bp_orig = bp - bytes);
-
- ASSERT_ALWAYS (GMP_NUMB_BITS >= 8);
-
- bits = 0;
- xlimb = 0;
- for (;;)
- {
- while (bits >= 8)
- {
- ASSERT (bp > bp_orig);
- *--bp = xlimb & 0xFF;
- xlimb >>= 8;
- bits -= 8;
- }
-
- if (i == 0)
- break;
-
- new_xlimb = *xp++;
- i--;
- ASSERT (bp > bp_orig);
- *--bp = (xlimb | (new_xlimb << bits)) & 0xFF;
- xlimb = new_xlimb >> (8 - bits);
- bits += GMP_NUMB_BITS - 8;
- }
-
- if (bits != 0)
- {
- ASSERT (bp > bp_orig);
- *--bp = xlimb;
- }
-
- ASSERT (bp == bp_orig);
- while (*bp == 0)
- {
- bp++;
- bytes--;
- }
- }
+ {
+ mp_limb_t new_xlimb;
+ int bits;
+ ASSERT_CODE (char *bp_orig = bp - bytes);
+
+ ASSERT_ALWAYS (GMP_NUMB_BITS >= 8);
+
+ bits = 0;
+ xlimb = 0;
+ for (;;)
+ {
+ while (bits >= 8)
+ {
+ ASSERT (bp > bp_orig);
+ *--bp = xlimb & 0xFF;
+ xlimb >>= 8;
+ bits -= 8;
+ }
+
+ if (i == 0)
+ break;
+
+ new_xlimb = *xp++;
+ i--;
+ ASSERT (bp > bp_orig);
+ *--bp = (xlimb | (new_xlimb << bits)) & 0xFF;
+ xlimb = new_xlimb >> (8 - bits);
+ bits += GMP_NUMB_BITS - 8;
+ }
+
+ if (bits != 0)
+ {
+ ASSERT (bp > bp_orig);
+ *--bp = xlimb;
+ }
+
+ ASSERT (bp == bp_orig);
+ while (*bp == 0)
+ {
+ bp++;
+ bytes--;
+ }
+ }
}
/* total bytes to be written */
diff --git a/gmp/mpz/out_str.c b/gmp/mpz/out_str.c
index 6c97039c64..1b96225223 100644
--- a/gmp/mpz/out_str.c
+++ b/gmp/mpz/out_str.c
@@ -1,50 +1,37 @@
/* mpz_out_str(stream, base, integer) -- Output to STREAM the multi prec.
integer INTEGER in base BASE.
-Copyright 1991, 1993, 1994, 1996, 2001, 2005, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2001, 2005 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
size_t
mpz_out_str (FILE *stream, int base, mpz_srcptr x)
{
mp_ptr xp;
- mp_size_t x_size = SIZ (x);
+ mp_size_t x_size = x->_mp_size;
unsigned char *str;
size_t str_size;
size_t i;
size_t written;
- const char *num_to_text;
+ char *num_to_text;
TMP_DECL;
if (stream == 0)
@@ -53,7 +40,7 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x)
if (base >= 0)
{
num_to_text = "0123456789abcdefghijklmnopqrstuvwxyz";
- if (base <= 1)
+ if (base == 0)
base = 10;
else if (base > 36)
{
@@ -65,13 +52,15 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x)
else
{
base = -base;
- if (base <= 1)
- base = 10;
- else if (base > 36)
- return 0;
num_to_text = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ";
}
+ if (x_size == 0)
+ {
+ fputc ('0', stream);
+ return ferror (stream) ? 0 : 1;
+ }
+
written = 0;
if (x_size < 0)
@@ -82,21 +71,25 @@ mpz_out_str (FILE *stream, int base, mpz_srcptr x)
}
TMP_MARK;
-
- DIGITS_IN_BASE_PER_LIMB (str_size, x_size, base);
- str_size += 3;
+ str_size = ((size_t) (x_size * BITS_PER_MP_LIMB
+ * __mp_bases[base].chars_per_bit_exactly)) + 3;
str = (unsigned char *) TMP_ALLOC (str_size);
- xp = PTR (x);
- if (! POW2_P (base))
- {
- xp = TMP_ALLOC_LIMBS (x_size | 1); /* |1 in case x_size==0 */
- MPN_COPY (xp, PTR (x), x_size);
- }
+ /* Move the number to convert into temporary space, since mpn_get_str
+ clobbers its argument + needs one extra high limb.... */
+ xp = (mp_ptr) TMP_ALLOC ((x_size + 1) * BYTES_PER_MP_LIMB);
+ MPN_COPY (xp, x->_mp_d, x_size);
str_size = mpn_get_str (str, base, xp, x_size);
- /* Convert result to printable chars. */
+ /* mpn_get_str might make some leading zeros. Skip them. */
+ while (*str == 0)
+ {
+ str_size--;
+ str++;
+ }
+
+ /* Translate to printable chars. */
for (i = 0; i < str_size; i++)
str[i] = num_to_text[str[i]];
str[str_size] = 0;
diff --git a/gmp/mpz/perfpow.c b/gmp/mpz/perfpow.c
index 72ff3c89ac..e667340134 100644
--- a/gmp/mpz/perfpow.c
+++ b/gmp/mpz/perfpow.c
@@ -1,39 +1,283 @@
/* mpz_perfect_power_p(arg) -- Return non-zero if ARG is a perfect power,
zero otherwise.
-Copyright 1998-2001, 2005, 2008, 2009 Free Software Foundation, Inc.
+Copyright 1998, 1999, 2000, 2001, 2005, 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 either:
+it under the terms of the GNU 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 Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License as published by the Free Software
- Foundation; either version 2 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 both in parallel, as here.
+/*
+ We are to determine if c is a perfect power, c = a ^ b.
+ Assume c is divisible by 2^n and that codd = c/2^n is odd.
+ Assume a is divisible by 2^m and that aodd = a/2^m is odd.
+ It is always true that m divides n.
-The GNU MP Library is distributed in the hope that 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.
+ * If n is prime, either 1) a is 2*aodd and b = n
+ or 2) a = c and b = 1.
+ So for n prime, we readily have a solution.
+ * If n is factorable into the non-trivial factors p1,p2,...
+ Since m divides n, m has a subset of n's factors and b = n / m.
+*/
-You should have received copies of the GNU 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 a naive approach to recognizing perfect powers.
+ Many things can be improved. In particular, we should use p-adic
+ arithmetic for computing possible roots. */
+#include <stdio.h> /* for NULL */
#include "gmp.h"
#include "gmp-impl.h"
+#include "longlong.h"
+
+static unsigned long int gcd __GMP_PROTO ((unsigned long int, unsigned long int));
+static int isprime __GMP_PROTO ((unsigned long int));
+
+static const unsigned short primes[] =
+{ 2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53,
+ 59, 61, 67, 71, 73, 79, 83, 89, 97,101,103,107,109,113,127,131,
+ 137,139,149,151,157,163,167,173,179,181,191,193,197,199,211,223,
+ 227,229,233,239,241,251,257,263,269,271,277,281,283,293,307,311,
+ 313,317,331,337,347,349,353,359,367,373,379,383,389,397,401,409,
+ 419,421,431,433,439,443,449,457,461,463,467,479,487,491,499,503,
+ 509,521,523,541,547,557,563,569,571,577,587,593,599,601,607,613,
+ 617,619,631,641,643,647,653,659,661,673,677,683,691,701,709,719,
+ 727,733,739,743,751,757,761,769,773,787,797,809,811,821,823,827,
+ 829,839,853,857,859,863,877,881,883,887,907,911,919,929,937,941,
+ 947,953,967,971,977,983,991,997,0
+};
+#define SMALLEST_OMITTED_PRIME 1009
+
+
+#define POW2P(a) (((a) & ((a) - 1)) == 0)
int
mpz_perfect_power_p (mpz_srcptr u)
{
- return mpn_perfect_power_p (PTR (u), SIZ (u));
+ unsigned long int prime;
+ unsigned long int n, n2;
+ int i;
+ unsigned long int rem;
+ mpz_t u2, q;
+ int exact;
+ mp_size_t uns;
+ mp_size_t usize = SIZ (u);
+ TMP_DECL;
+
+ if (mpz_cmpabs_ui (u, 1) <= 0)
+ return 1; /* -1, 0, and +1 are perfect powers */
+
+ n2 = mpz_scan1 (u, 0);
+ if (n2 == 1)
+ return 0; /* 2 divides exactly once. */
+
+ TMP_MARK;
+
+ uns = ABS (usize) - n2 / BITS_PER_MP_LIMB;
+ MPZ_TMP_INIT (q, uns);
+ MPZ_TMP_INIT (u2, uns);
+
+ mpz_tdiv_q_2exp (u2, u, n2);
+ mpz_abs (u2, u2);
+
+ if (mpz_cmp_ui (u2, 1) == 0)
+ {
+ TMP_FREE;
+ /* factoring completed; consistent power */
+ return ! (usize < 0 && POW2P(n2));
+ }
+
+ if (isprime (n2))
+ goto n2prime;
+
+ for (i = 1; primes[i] != 0; i++)
+ {
+ prime = primes[i];
+
+ if (mpz_cmp_ui (u2, prime) < 0)
+ break;
+
+ if (mpz_divisible_ui_p (u2, prime)) /* divisible by this prime? */
+ {
+ rem = mpz_tdiv_q_ui (q, u2, prime * prime);
+ if (rem != 0)
+ {
+ TMP_FREE;
+ return 0; /* prime divides exactly once, reject */
+ }
+ mpz_swap (q, u2);
+ for (n = 2;;)
+ {
+ rem = mpz_tdiv_q_ui (q, u2, prime);
+ if (rem != 0)
+ break;
+ mpz_swap (q, u2);
+ n++;
+ }
+
+ n2 = gcd (n2, n);
+ if (n2 == 1)
+ {
+ TMP_FREE;
+ return 0; /* we have multiplicity 1 of some factor */
+ }
+
+ if (mpz_cmp_ui (u2, 1) == 0)
+ {
+ TMP_FREE;
+ /* factoring completed; consistent power */
+ return ! (usize < 0 && POW2P(n2));
+ }
+
+ /* As soon as n2 becomes a prime number, stop factoring.
+ Either we have u=x^n2 or u is not a perfect power. */
+ if (isprime (n2))
+ goto n2prime;
+ }
+ }
+
+ if (n2 == 0)
+ {
+ /* We found no factors above; have to check all values of n. */
+ unsigned long int nth;
+ for (nth = usize < 0 ? 3 : 2;; nth++)
+ {
+ if (! isprime (nth))
+ continue;
+#if 0
+ exact = mpz_padic_root (q, u2, nth, PTH);
+ if (exact)
+#endif
+ exact = mpz_root (q, u2, nth);
+ if (exact)
+ {
+ TMP_FREE;
+ return 1;
+ }
+ if (mpz_cmp_ui (q, SMALLEST_OMITTED_PRIME) < 0)
+ {
+ TMP_FREE;
+ return 0;
+ }
+ }
+ }
+ else
+ {
+ unsigned long int nth;
+
+ if (usize < 0 && POW2P(n2))
+ {
+ TMP_FREE;
+ return 0;
+ }
+
+ /* We found some factors above. We just need to consider values of n
+ that divides n2. */
+ for (nth = 2; nth <= n2; nth++)
+ {
+ if (! isprime (nth))
+ continue;
+ if (n2 % nth != 0)
+ continue;
+#if 0
+ exact = mpz_padic_root (q, u2, nth, PTH);
+ if (exact)
+#endif
+ exact = mpz_root (q, u2, nth);
+ if (exact)
+ {
+ if (! (usize < 0 && POW2P(nth)))
+ {
+ TMP_FREE;
+ return 1;
+ }
+ }
+ if (mpz_cmp_ui (q, SMALLEST_OMITTED_PRIME) < 0)
+ {
+ TMP_FREE;
+ return 0;
+ }
+ }
+
+ TMP_FREE;
+ return 0;
+ }
+
+n2prime:
+ if (usize < 0 && POW2P(n2))
+ {
+ TMP_FREE;
+ return 0;
+ }
+
+ exact = mpz_root (NULL, u2, n2);
+ TMP_FREE;
+ return exact;
+}
+
+static unsigned long int
+gcd (unsigned long int a, unsigned long int b)
+{
+ int an2, bn2, n2;
+
+ if (a == 0)
+ return b;
+ if (b == 0)
+ return a;
+
+ count_trailing_zeros (an2, a);
+ a >>= an2;
+
+ count_trailing_zeros (bn2, b);
+ b >>= bn2;
+
+ n2 = MIN (an2, bn2);
+
+ while (a != b)
+ {
+ if (a > b)
+ {
+ a -= b;
+ do
+ a >>= 1;
+ while ((a & 1) == 0);
+ }
+ else /* b > a. */
+ {
+ b -= a;
+ do
+ b >>= 1;
+ while ((b & 1) == 0);
+ }
+ }
+
+ return a << n2;
+}
+
+static int
+isprime (unsigned long int t)
+{
+ unsigned long int q, r, d;
+
+ if (t < 3 || (t & 1) == 0)
+ return t == 2;
+
+ for (d = 3, r = 1; r != 0; d += 2)
+ {
+ q = t / d;
+ r = t - q * d;
+ if (q < d)
+ return 1;
+ }
+ return 0;
}
diff --git a/gmp/mpz/perfsqr.c b/gmp/mpz/perfsqr.c
index 534f10ff56..b4853b5703 100644
--- a/gmp/mpz/perfsqr.c
+++ b/gmp/mpz/perfsqr.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_perfect_square_p 1
diff --git a/gmp/mpz/popcount.c b/gmp/mpz/popcount.c
index 06f0f0b3a2..c8d9bec1e0 100644
--- a/gmp/mpz/popcount.c
+++ b/gmp/mpz/popcount.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_popcount 1
diff --git a/gmp/mpz/pow_ui.c b/gmp/mpz/pow_ui.c
index 4891e97877..ae0307d2c2 100644
--- a/gmp/mpz/pow_ui.c
+++ b/gmp/mpz/pow_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpz/powm.c b/gmp/mpz/powm.c
index 4d13da7396..8f3ce97cc4 100644
--- a/gmp/mpz/powm.c
+++ b/gmp/mpz/powm.c
@@ -1,99 +1,170 @@
-/* mpz_powm(res,base,exp,mod) -- Set R to (U^E) mod M.
+/* mpz_powm(res,base,exp,mod) -- Set RES to (base**exp) mod MOD.
- Contributed to the GNU project by Torbjorn Granlund.
+ Contributed by Paul Zimmermann.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2011, 2012
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+#ifdef BERKELEY_MP
+#include "mp.h"
+#endif
+
+/* Compute t = a mod m, a is defined by (ap,an), m is defined by (mp,mn), and
+ t is defined by (tp,mn). */
+static void
+reduce (mp_ptr tp, mp_srcptr ap, mp_size_t an, mp_srcptr mp, mp_size_t mn)
+{
+ mp_ptr qp;
+ TMP_DECL;
+ TMP_MARK;
+ qp = TMP_ALLOC_LIMBS (an - mn + 1);
-/* TODO
+ mpn_tdiv_qr (qp, tp, 0L, ap, an, mp, mn);
- * Improve handling of buffers. It is pretty ugly now.
+ TMP_FREE;
+}
- * For even moduli, we compute a binvert of its odd part both here and in
- mpn_powm. How can we avoid this recomputation?
-*/
+#if REDUCE_EXPONENT
+/* Return the group order of the ring mod m. */
+static mp_limb_t
+phi (mp_limb_t t)
+{
+ mp_limb_t d, m, go;
+
+ go = 1;
-/*
- b ^ e mod m res
- 0 0 0 ?
- 0 e 0 ?
- 0 0 m ?
- 0 e m 0
- b 0 0 ?
- b e 0 ?
- b 0 m 1 mod m
- b e m b^e mod m
+ if (t % 2 == 0)
+ {
+ t = t / 2;
+ while (t % 2 == 0)
+ {
+ go *= 2;
+ t = t / 2;
+ }
+ }
+ for (d = 3;; d += 2)
+ {
+ m = d - 1;
+ for (;;)
+ {
+ unsigned long int q = t / d;
+ if (q < d)
+ {
+ if (t <= 1)
+ return go;
+ if (t == d)
+ return go * m;
+ return go * (t - 1);
+ }
+ if (t != q * d)
+ break;
+ go *= m;
+ m = d;
+ t = q;
+ }
+ }
+}
+#endif
+
+/* average number of calls to redc for an exponent of n bits
+ with the sliding window algorithm of base 2^k: the optimal is
+ obtained for the value of k which minimizes 2^(k-1)+n/(k+1):
+
+ n\k 4 5 6 7 8
+ 128 156* 159 171 200 261
+ 256 309 307* 316 343 403
+ 512 617 607* 610 632 688
+ 1024 1231 1204 1195* 1207 1256
+ 2048 2461 2399 2366 2360* 2396
+ 4096 4918 4787 4707 4665* 4670
*/
+
+
+/* Use REDC instead of usual reduction for sizes < POWM_THRESHOLD. In REDC
+ each modular multiplication costs about 2*n^2 limbs operations, whereas
+ using usual reduction it costs 3*K(n), where K(n) is the cost of a
+ multiplication using Karatsuba, and a division is assumed to cost 2*K(n),
+ for example using Burnikel-Ziegler's algorithm. This gives a theoretical
+ threshold of a*SQR_KARATSUBA_THRESHOLD, with a=(3/2)^(1/(2-ln(3)/ln(2))) ~
+ 2.66. */
+/* For now, also disable REDC when MOD is even, as the inverse can't handle
+ that. At some point, we might want to make the code faster for that case,
+ perhaps using CRR. */
+
+#ifndef POWM_THRESHOLD
+#define POWM_THRESHOLD ((8 * SQR_KARATSUBA_THRESHOLD) / 3)
+#endif
#define HANDLE_NEGATIVE_EXPONENT 1
+#undef REDUCE_EXPONENT
void
+#ifndef BERKELEY_MP
mpz_powm (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
+#else /* BERKELEY_MP */
+pow (mpz_srcptr b, mpz_srcptr e, mpz_srcptr m, mpz_ptr r)
+#endif /* BERKELEY_MP */
{
- mp_size_t n, nodd, ncnt;
- int cnt;
- mp_ptr rp, tp;
+ mp_ptr xp, tp, qp, gp, this_gp;
mp_srcptr bp, ep, mp;
- mp_size_t rn, bn, es, en, itch;
- mpz_t new_b; /* note: value lives long via 'b' */
+ mp_size_t bn, es, en, mn, xn;
+ mp_limb_t invm, c;
+ unsigned long int enb;
+ mp_size_t i, K, j, l, k;
+ int m_zero_cnt, e_zero_cnt;
+ int sh;
+ int use_redc;
+#if HANDLE_NEGATIVE_EXPONENT
+ mpz_t new_b;
+#endif
+#if REDUCE_EXPONENT
+ mpz_t new_e;
+#endif
TMP_DECL;
- n = ABSIZ(m);
- if (UNLIKELY (n == 0))
- DIVIDE_BY_ZERO;
-
mp = PTR(m);
+ mn = ABSIZ (m);
+ if (mn == 0)
+ DIVIDE_BY_ZERO;
TMP_MARK;
- es = SIZ(e);
- if (UNLIKELY (es <= 0))
+ es = SIZ (e);
+ if (es <= 0)
{
if (es == 0)
{
- /* b^0 mod m, b is anything and m is non-zero.
- Result is 1 mod m, i.e., 1 or 0 depending on if m = 1. */
- SIZ(r) = n != 1 || mp[0] != 1;
+ /* Exponent is zero, result is 1 mod m, i.e., 1 or 0 depending on if
+ m equals 1. */
+ SIZ(r) = (mn == 1 && mp[0] == 1) ? 0 : 1;
PTR(r)[0] = 1;
TMP_FREE; /* we haven't really allocated anything here */
return;
}
#if HANDLE_NEGATIVE_EXPONENT
- MPZ_TMP_INIT (new_b, n + 1);
+ MPZ_TMP_INIT (new_b, mn + 1);
- if (UNLIKELY (! mpz_invert (new_b, b, m)))
+ if (! mpz_invert (new_b, b, m))
DIVIDE_BY_ZERO;
b = new_b;
es = -es;
@@ -103,181 +174,262 @@ mpz_powm (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
}
en = es;
- bn = ABSIZ(b);
-
- if (UNLIKELY (bn == 0))
+#if REDUCE_EXPONENT
+ /* Reduce exponent by dividing it by phi(m) when m small. */
+ if (mn == 1 && mp[0] < 0x7fffffffL && en * GMP_NUMB_BITS > 150)
{
- SIZ(r) = 0;
- TMP_FREE;
- return;
+ MPZ_TMP_INIT (new_e, 2);
+ mpz_mod_ui (new_e, e, phi (mp[0]));
+ e = new_e;
}
+#endif
- ep = PTR(e);
-
- /* Handle (b^1 mod m) early, since mpn_pow* do not handle that case. */
- if (UNLIKELY (en == 1 && ep[0] == 1))
+ use_redc = mn < POWM_THRESHOLD && mp[0] % 2 != 0;
+ if (use_redc)
{
- rp = TMP_ALLOC_LIMBS (n);
- bp = PTR(b);
- if (bn >= n)
- {
- mp_ptr qp = TMP_ALLOC_LIMBS (bn - n + 1);
- mpn_tdiv_qr (qp, rp, 0L, bp, bn, mp, n);
- rn = n;
- MPN_NORMALIZE (rp, rn);
-
- if (SIZ(b) < 0 && rn != 0)
- {
- mpn_sub (rp, mp, n, rp, rn);
- rn = n;
- MPN_NORMALIZE (rp, rn);
- }
- }
- else
+ /* invm = -1/m mod 2^BITS_PER_MP_LIMB, must have m odd */
+ modlimb_invert (invm, mp[0]);
+ invm = -invm;
+ }
+ else
+ {
+ /* Normalize m (i.e. make its most significant bit set) as required by
+ division functions below. */
+ count_leading_zeros (m_zero_cnt, mp[mn - 1]);
+ m_zero_cnt -= GMP_NAIL_BITS;
+ if (m_zero_cnt != 0)
{
- if (SIZ(b) < 0)
- {
- mpn_sub (rp, mp, n, bp, bn);
- rn = n;
- rn -= (rp[rn - 1] == 0);
- }
- else
- {
- MPN_COPY (rp, bp, bn);
- rn = bn;
- }
+ mp_ptr new_mp;
+ new_mp = TMP_ALLOC_LIMBS (mn);
+ mpn_lshift (new_mp, mp, mn, m_zero_cnt);
+ mp = new_mp;
}
- goto ret;
}
- /* Remove low zero limbs from M. This loop will terminate for correctly
- represented mpz numbers. */
- ncnt = 0;
- while (UNLIKELY (mp[0] == 0))
- {
- mp++;
- ncnt++;
- }
- nodd = n - ncnt;
- cnt = 0;
- if (mp[0] % 2 == 0)
+ /* Determine optimal value of k, the number of exponent bits we look at
+ at a time. */
+ count_leading_zeros (e_zero_cnt, PTR(e)[en - 1]);
+ e_zero_cnt -= GMP_NAIL_BITS;
+ enb = en * GMP_NUMB_BITS - e_zero_cnt; /* number of bits of exponent */
+ k = 1;
+ K = 2;
+ while (2 * enb > K * (2 + k * (3 + k)))
{
- mp_ptr newmp = TMP_ALLOC_LIMBS (nodd);
- count_trailing_zeros (cnt, mp[0]);
- mpn_rshift (newmp, mp, nodd, cnt);
- nodd -= newmp[nodd - 1] == 0;
- mp = newmp;
- ncnt++;
+ k++;
+ K *= 2;
+ if (k == 10) /* cap allocation */
+ break;
}
- if (ncnt != 0)
+ tp = TMP_ALLOC_LIMBS (2 * mn);
+ qp = TMP_ALLOC_LIMBS (mn + 1);
+
+ gp = __GMP_ALLOCATE_FUNC_LIMBS (K / 2 * mn);
+
+ /* Compute x*R^n where R=2^BITS_PER_MP_LIMB. */
+ bn = ABSIZ (b);
+ bp = PTR(b);
+ /* Handle |b| >= m by computing b mod m. FIXME: It is not strictly necessary
+ for speed or correctness to do this when b and m have the same number of
+ limbs, perhaps remove mpn_cmp call. */
+ if (bn > mn || (bn == mn && mpn_cmp (bp, mp, mn) >= 0))
{
- /* We will call both mpn_powm and mpn_powlo. */
- /* rp needs n, mpn_powlo needs 4n, the 2 mpn_binvert might need more */
- mp_size_t n_largest_binvert = MAX (ncnt, nodd);
- mp_size_t itch_binvert = mpn_binvert_itch (n_largest_binvert);
- itch = 3 * n + MAX (itch_binvert, 2 * n);
+ /* Reduce possibly huge base while moving it to gp[0]. Use a function
+ call to reduce, since we don't want the quotient allocation to
+ live until function return. */
+ if (use_redc)
+ {
+ reduce (tp + mn, bp, bn, mp, mn); /* b mod m */
+ MPN_ZERO (tp, mn);
+ mpn_tdiv_qr (qp, gp, 0L, tp, 2 * mn, mp, mn); /* unnormnalized! */
+ }
+ else
+ {
+ reduce (gp, bp, bn, mp, mn);
+ }
}
else
{
- /* We will call just mpn_powm. */
- mp_size_t itch_binvert = mpn_binvert_itch (nodd);
- itch = n + MAX (itch_binvert, 2 * n);
+ /* |b| < m. We pad out operands to become mn limbs, which simplifies
+ the rest of the function, but slows things down when |b| << m. */
+ if (use_redc)
+ {
+ MPN_ZERO (tp, mn);
+ MPN_COPY (tp + mn, bp, bn);
+ MPN_ZERO (tp + mn + bn, mn - bn);
+ mpn_tdiv_qr (qp, gp, 0L, tp, 2 * mn, mp, mn);
+ }
+ else
+ {
+ MPN_COPY (gp, bp, bn);
+ MPN_ZERO (gp + bn, mn - bn);
+ }
}
- tp = TMP_ALLOC_LIMBS (itch);
- rp = tp; tp += n;
+ /* Compute xx^i for odd g < 2^i. */
- bp = PTR(b);
- mpn_powm (rp, bp, bn, ep, en, mp, nodd, tp);
-
- rn = n;
-
- if (ncnt != 0)
+ xp = TMP_ALLOC_LIMBS (mn);
+ mpn_sqr_n (tp, gp, mn);
+ if (use_redc)
+ mpn_redc_1 (xp, tp, mp, mn, invm); /* xx = x^2*R^n */
+ else
+ mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
+ this_gp = gp;
+ for (i = 1; i < K / 2; i++)
{
- mp_ptr r2, xp, yp, odd_inv_2exp;
- unsigned long t;
- int bcnt;
+ mpn_mul_n (tp, this_gp, xp, mn);
+ this_gp += mn;
+ if (use_redc)
+ mpn_redc_1 (this_gp, tp, mp, mn, invm); /* g[i] = x^(2i+1)*R^n */
+ else
+ mpn_tdiv_qr (qp, this_gp, 0L, tp, 2 * mn, mp, mn);
+ }
- if (bn < ncnt)
+ /* Start the real stuff. */
+ ep = PTR (e);
+ i = en - 1; /* current index */
+ c = ep[i]; /* current limb */
+ sh = GMP_NUMB_BITS - e_zero_cnt; /* significant bits in ep[i] */
+ sh -= k; /* index of lower bit of ep[i] to take into account */
+ if (sh < 0)
+ { /* k-sh extra bits are needed */
+ if (i > 0)
{
- mp_ptr newbp = TMP_ALLOC_LIMBS (ncnt);
- MPN_COPY (newbp, bp, bn);
- MPN_ZERO (newbp + bn, ncnt - bn);
- bp = newbp;
+ i--;
+ c <<= (-sh);
+ sh += GMP_NUMB_BITS;
+ c |= ep[i] >> sh;
}
+ }
+ else
+ c >>= sh;
- r2 = tp;
+ for (j = 0; c % 2 == 0; j++)
+ c >>= 1;
+
+ MPN_COPY (xp, gp + mn * (c >> 1), mn);
+ while (--j >= 0)
+ {
+ mpn_sqr_n (tp, xp, mn);
+ if (use_redc)
+ mpn_redc_1 (xp, tp, mp, mn, invm);
+ else
+ mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
+ }
- if (bp[0] % 2 == 0)
+ while (i > 0 || sh > 0)
+ {
+ c = ep[i];
+ l = k; /* number of bits treated */
+ sh -= l;
+ if (sh < 0)
{
- if (en > 1)
+ if (i > 0)
{
- MPN_ZERO (r2, ncnt);
- goto zero;
+ i--;
+ c <<= (-sh);
+ sh += GMP_NUMB_BITS;
+ c |= ep[i] >> sh;
}
-
- ASSERT (en == 1);
- t = (ncnt - (cnt != 0)) * GMP_NUMB_BITS + cnt;
-
- /* Count number of low zero bits in B, up to 3. */
- bcnt = (0x1213 >> ((bp[0] & 7) << 1)) & 0x3;
- /* Note that ep[0] * bcnt might overflow, but that just results
- in a missed optimization. */
- if (ep[0] * bcnt >= t)
+ else
{
- MPN_ZERO (r2, ncnt);
- goto zero;
+ l += sh; /* last chunk of bits from e; l < k */
}
}
+ else
+ c >>= sh;
+ c &= ((mp_limb_t) 1 << l) - 1;
- mpn_powlo (r2, bp, ep, en, ncnt, tp + ncnt);
-
- zero:
- if (nodd < ncnt)
+ /* This while loop implements the sliding window improvement--loop while
+ the most significant bit of c is zero, squaring xx as we go. */
+ while ((c >> (l - 1)) == 0 && (i > 0 || sh > 0))
{
- mp_ptr newmp = TMP_ALLOC_LIMBS (ncnt);
- MPN_COPY (newmp, mp, nodd);
- MPN_ZERO (newmp + nodd, ncnt - nodd);
- mp = newmp;
+ mpn_sqr_n (tp, xp, mn);
+ if (use_redc)
+ mpn_redc_1 (xp, tp, mp, mn, invm);
+ else
+ mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
+ if (sh != 0)
+ {
+ sh--;
+ c = (c << 1) + ((ep[i] >> sh) & 1);
+ }
+ else
+ {
+ i--;
+ sh = GMP_NUMB_BITS - 1;
+ c = (c << 1) + (ep[i] >> sh);
+ }
}
- odd_inv_2exp = tp + n;
- mpn_binvert (odd_inv_2exp, mp, ncnt, tp + 2 * n);
-
- mpn_sub (r2, r2, ncnt, rp, nodd > ncnt ? ncnt : nodd);
-
- xp = tp + 2 * n;
- mpn_mullo_n (xp, odd_inv_2exp, r2, ncnt);
-
- if (cnt != 0)
- xp[ncnt - 1] &= (CNST_LIMB(1) << cnt) - 1;
+ /* Replace xx by xx^(2^l)*x^c. */
+ if (c != 0)
+ {
+ for (j = 0; c % 2 == 0; j++)
+ c >>= 1;
- yp = tp;
- if (ncnt > nodd)
- mpn_mul (yp, xp, ncnt, mp, nodd);
+ /* c0 = c * 2^j, i.e. xx^(2^l)*x^c = (A^(2^(l - j))*c)^(2^j) */
+ l -= j;
+ while (--l >= 0)
+ {
+ mpn_sqr_n (tp, xp, mn);
+ if (use_redc)
+ mpn_redc_1 (xp, tp, mp, mn, invm);
+ else
+ mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
+ }
+ mpn_mul_n (tp, xp, gp + mn * (c >> 1), mn);
+ if (use_redc)
+ mpn_redc_1 (xp, tp, mp, mn, invm);
+ else
+ mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
+ }
else
- mpn_mul (yp, mp, nodd, xp, ncnt);
-
- mpn_add (rp, yp, n, rp, nodd);
-
- ASSERT (nodd + ncnt >= n);
- ASSERT (nodd + ncnt <= n + 1);
+ j = l; /* case c=0 */
+ while (--j >= 0)
+ {
+ mpn_sqr_n (tp, xp, mn);
+ if (use_redc)
+ mpn_redc_1 (xp, tp, mp, mn, invm);
+ else
+ mpn_tdiv_qr (qp, xp, 0L, tp, 2 * mn, mp, mn);
+ }
}
- MPN_NORMALIZE (rp, rn);
-
- if ((ep[0] & 1) && SIZ(b) < 0 && rn != 0)
+ if (use_redc)
{
- mpn_sub (rp, PTR(m), n, rp, rn);
- rn = n;
- MPN_NORMALIZE (rp, rn);
+ /* Convert back xx to xx/R^n. */
+ MPN_COPY (tp, xp, mn);
+ MPN_ZERO (tp + mn, mn);
+ mpn_redc_1 (xp, tp, mp, mn, invm);
+ if (mpn_cmp (xp, mp, mn) >= 0)
+ mpn_sub_n (xp, xp, mp, mn);
}
+ else
+ {
+ if (m_zero_cnt != 0)
+ {
+ mp_limb_t cy;
+ cy = mpn_lshift (tp, xp, mn, m_zero_cnt);
+ tp[mn] = cy;
+ mpn_tdiv_qr (qp, xp, 0L, tp, mn + (cy != 0), mp, mn);
+ mpn_rshift (xp, xp, mn, m_zero_cnt);
+ }
+ }
+ xn = mn;
+ MPN_NORMALIZE (xp, xn);
- ret:
- MPZ_REALLOC (r, rn);
- SIZ(r) = rn;
- MPN_COPY (PTR(r), rp, rn);
+ if ((ep[0] & 1) && SIZ(b) < 0 && xn != 0)
+ {
+ mp = PTR(m); /* want original, unnormalized m */
+ mpn_sub (xp, mp, mn, xp, xn);
+ xn = mn;
+ MPN_NORMALIZE (xp, xn);
+ }
+ MPZ_REALLOC (r, xn);
+ SIZ (r) = xn;
+ MPN_COPY (PTR(r), xp, xn);
+ __GMP_FREE_FUNC_LIMBS (gp, K / 2 * mn);
TMP_FREE;
}
diff --git a/gmp/mpz/powm_sec.c b/gmp/mpz/powm_sec.c
deleted file mode 100644
index 98644ca496..0000000000
--- a/gmp/mpz/powm_sec.c
+++ /dev/null
@@ -1,104 +0,0 @@
-/* mpz_powm_sec(res,base,exp,mod) -- Set R to (U^E) mod M.
-
- Contributed to the GNU project by Torbjorn Granlund.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_powm_sec (mpz_ptr r, mpz_srcptr b, mpz_srcptr e, mpz_srcptr m)
-{
- mp_size_t n;
- mp_ptr rp, tp;
- mp_srcptr bp, ep, mp;
- mp_size_t rn, bn, es, en;
- TMP_DECL;
-
- n = ABSIZ(m);
-
- mp = PTR(m);
-
- if (UNLIKELY ((n == 0) || (mp[0] % 2 == 0)))
- DIVIDE_BY_ZERO;
-
- es = SIZ(e);
- if (UNLIKELY (es <= 0))
- {
- if (es == 0)
- {
- /* b^0 mod m, b is anything and m is non-zero.
- Result is 1 mod m, i.e., 1 or 0 depending on if m = 1. */
- SIZ(r) = n != 1 || mp[0] != 1;
- PTR(r)[0] = 1;
- return;
- }
- DIVIDE_BY_ZERO;
- }
- en = es;
-
- bn = ABSIZ(b);
-
- if (UNLIKELY (bn == 0))
- {
- SIZ(r) = 0;
- return;
- }
-
- TMP_MARK;
- 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_sec_powm (rp, bp, bn, ep, en * GMP_NUMB_BITS, mp, n, tp);
-
- rn = n;
-
- MPN_NORMALIZE (rp, rn);
-
- if ((ep[0] & 1) && SIZ(b) < 0 && rn != 0)
- {
- mpn_sub (rp, PTR(m), n, rp, rn);
- rn = n;
- MPN_NORMALIZE (rp, rn);
- }
-
- MPZ_REALLOC (r, rn);
- SIZ(r) = rn;
- MPN_COPY (PTR(r), rp, rn);
-
- TMP_FREE;
-}
diff --git a/gmp/mpz/powm_ui.c b/gmp/mpz/powm_ui.c
index 46e770ce7e..9e44301d21 100644
--- a/gmp/mpz/powm_ui.c
+++ b/gmp/mpz/powm_ui.c
@@ -1,119 +1,40 @@
-/* mpz_powm_ui(res,base,exp,mod) -- Set R to (B^E) mod M.
+/* mpz_powm_ui(res,base,exp,mod) -- Set RES to (base**exp) mod MOD.
- Contributed to the GNU project by Torbjörn Granlund.
-
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2005, 2008, 2009, 2011-2013
-Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 code is very old, and should be rewritten to current GMP standard. It
- is slower than mpz_powm for large exponents, but also for small exponents
- when the mod argument is small.
-
- As an intermediate solution, we now deflect to mpz_powm for exponents >= 20.
-*/
-
-/*
- b ^ e mod m res
- 0 0 0 ?
- 0 e 0 ?
- 0 0 m ?
- 0 e m 0
- b 0 0 ?
- b e 0 ?
- b 0 m 1 mod m
- b e m b^e mod m
-*/
-
-static void
-mod (mp_ptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, gmp_pi1_t *dinv, mp_ptr tp)
-{
- mp_ptr qp;
- TMP_DECL;
- TMP_MARK;
-
- qp = tp;
-
- if (dn == 1)
- {
- 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);
- }
- 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);
- }
- 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... */
- + (double) MUPI_DIV_QR_THRESHOLD * nn > (double) dn * nn) /* ...condition */
- {
- mpn_dcpi1_div_qr (qp, np, nn, dp, dn, dinv);
- }
- else
- {
- /* We need to allocate separate remainder area, since mpn_mu_div_qr does
- not handle overlap between the numerator and remainder areas.
- FIXME: Make it handle such overlap. */
- mp_ptr rp = TMP_BALLOC_LIMBS (dn);
- mp_size_t itch = mpn_mu_div_qr_itch (nn, dn, 0);
- mp_ptr scratch = TMP_BALLOC_LIMBS (itch);
- mpn_mu_div_qr (qp, rp, np, nn, dp, dn, scratch);
- MPN_COPY (np, rp, dn);
- }
-
- TMP_FREE;
-}
-
/* Compute t = a mod m, a is defined by (ap,an), m is defined by (mp,mn), and
t is defined by (tp,mn). */
static void
-reduce (mp_ptr tp, mp_srcptr ap, mp_size_t an, mp_srcptr mp, mp_size_t mn, gmp_pi1_t *dinv)
+reduce (mp_ptr tp, mp_srcptr ap, mp_size_t an, mp_srcptr mp, mp_size_t mn)
{
- mp_ptr rp, scratch;
+ mp_ptr qp;
TMP_DECL;
+
TMP_MARK;
+ qp = TMP_ALLOC_LIMBS (an - mn + 1);
- rp = TMP_ALLOC_LIMBS (an);
- scratch = TMP_ALLOC_LIMBS (an - mn + 1);
- MPN_COPY (rp, ap, an);
- mod (rp, an, mp, mn, dinv, scratch);
- MPN_COPY (tp, rp, mn);
+ mpn_tdiv_qr (qp, tp, 0L, ap, an, mp, mn);
TMP_FREE;
}
@@ -121,172 +42,154 @@ reduce (mp_ptr tp, mp_srcptr ap, mp_size_t an, mp_srcptr mp, mp_size_t mn, gmp_p
void
mpz_powm_ui (mpz_ptr r, mpz_srcptr b, unsigned long int el, mpz_srcptr m)
{
- if (el < 20)
+ mp_ptr xp, tp, qp, mp, bp;
+ mp_size_t xn, tn, mn, bn;
+ int m_zero_cnt;
+ int c;
+ mp_limb_t e;
+ TMP_DECL;
+
+ mp = PTR(m);
+ mn = ABSIZ(m);
+ if (mn == 0)
+ DIVIDE_BY_ZERO;
+
+ if (el == 0)
{
- mp_ptr xp, tp, mp, bp, scratch;
- mp_size_t xn, tn, mn, bn;
- int m_zero_cnt;
- int c;
- mp_limb_t e, m2;
- gmp_pi1_t dinv;
- TMP_DECL;
+ /* Exponent is zero, result is 1 mod MOD, i.e., 1 or 0
+ depending on if MOD equals 1. */
+ SIZ(r) = (mn == 1 && mp[0] == 1) ? 0 : 1;
+ PTR(r)[0] = 1;
+ return;
+ }
- mp = PTR(m);
- mn = ABSIZ(m);
- if (UNLIKELY (mn == 0))
- DIVIDE_BY_ZERO;
+ TMP_MARK;
- if (el == 0)
- {
- /* Exponent is zero, result is 1 mod M, i.e., 1 or 0 depending on if
- M equals 1. */
- SIZ(r) = (mn == 1 && mp[0] == 1) ? 0 : 1;
- PTR(r)[0] = 1;
- return;
- }
+ /* Normalize m (i.e. make its most significant bit set) as required by
+ division functions below. */
+ count_leading_zeros (m_zero_cnt, mp[mn - 1]);
+ m_zero_cnt -= GMP_NAIL_BITS;
+ if (m_zero_cnt != 0)
+ {
+ mp_ptr new_mp = TMP_ALLOC_LIMBS (mn);
+ mpn_lshift (new_mp, mp, mn, m_zero_cnt);
+ mp = new_mp;
+ }
- TMP_MARK;
+ bn = ABSIZ(b);
+ bp = PTR(b);
+ if (bn > mn)
+ {
+ /* Reduce possibly huge base. Use a function call to reduce, since we
+ don't want the quotient allocation to live until function return. */
+ mp_ptr new_bp = TMP_ALLOC_LIMBS (mn);
+ reduce (new_bp, bp, bn, mp, mn);
+ bp = new_bp;
+ bn = mn;
+ /* Canonicalize the base, since we are potentially going to multiply with
+ it quite a few times. */
+ MPN_NORMALIZE (bp, bn);
+ }
- /* Normalize m (i.e. make its most significant bit set) as required by
- division functions below. */
- count_leading_zeros (m_zero_cnt, mp[mn - 1]);
- m_zero_cnt -= GMP_NAIL_BITS;
- if (m_zero_cnt != 0)
- {
- mp_ptr new_mp = TMP_ALLOC_LIMBS (mn);
- mpn_lshift (new_mp, mp, mn, m_zero_cnt);
- mp = new_mp;
- }
+ if (bn == 0)
+ {
+ SIZ(r) = 0;
+ TMP_FREE;
+ return;
+ }
- m2 = mn == 1 ? 0 : mp[mn - 2];
- invert_pi1 (dinv, mp[mn - 1], m2);
+ tp = TMP_ALLOC_LIMBS (2 * mn + 1);
+ xp = TMP_ALLOC_LIMBS (mn);
- bn = ABSIZ(b);
- bp = PTR(b);
- if (bn > mn)
- {
- /* Reduce possibly huge base. Use a function call to reduce, since we
- don't want the quotient allocation to live until function return. */
- mp_ptr new_bp = TMP_ALLOC_LIMBS (mn);
- reduce (new_bp, bp, bn, mp, mn, &dinv);
- bp = new_bp;
- bn = mn;
- /* Canonicalize the base, since we are potentially going to multiply with
- it quite a few times. */
- MPN_NORMALIZE (bp, bn);
- }
+ qp = TMP_ALLOC_LIMBS (mn + 1);
- if (bn == 0)
- {
- SIZ(r) = 0;
- TMP_FREE;
- return;
- }
+ MPN_COPY (xp, bp, bn);
+ xn = bn;
- tp = TMP_ALLOC_LIMBS (2 * mn + 1);
- xp = TMP_ALLOC_LIMBS (mn);
- scratch = TMP_ALLOC_LIMBS (mn + 1);
+ e = el;
+ count_leading_zeros (c, e);
+ e = (e << c) << 1; /* shift the exp bits to the left, lose msb */
+ c = BITS_PER_MP_LIMB - 1 - c;
- MPN_COPY (xp, bp, bn);
- xn = bn;
+ /* Main loop. */
- e = el;
- count_leading_zeros (c, e);
- e = (e << c) << 1; /* shift the exp bits to the left, lose msb */
- c = GMP_LIMB_BITS - 1 - c;
+ /* If m is already normalized (high bit of high limb set), and b is the
+ same size, but a bigger value, and e==1, then there's no modular
+ reductions done and we can end up with a result out of range at the
+ end. */
+ if (c == 0)
+ {
+ if (xn == mn && mpn_cmp (xp, mp, mn) >= 0)
+ mpn_sub_n (xp, xp, mp, mn);
+ goto finishup;
+ }
- if (c == 0)
+ while (c != 0)
+ {
+ mpn_sqr_n (tp, xp, xn);
+ tn = 2 * xn; tn -= tp[tn - 1] == 0;
+ if (tn < mn)
{
- /* If m is already normalized (high bit of high limb set), and b is
- the same size, but a bigger value, and e==1, then there's no
- modular reductions done and we can end up with a result out of
- range at the end. */
- if (xn == mn && mpn_cmp (xp, mp, mn) >= 0)
- mpn_sub_n (xp, xp, mp, mn);
+ MPN_COPY (xp, tp, tn);
+ xn = tn;
}
else
{
- /* Main loop. */
- do
- {
- mpn_sqr (tp, xp, xn);
- tn = 2 * xn; tn -= tp[tn - 1] == 0;
- if (tn < mn)
- {
- MPN_COPY (xp, tp, tn);
- xn = tn;
- }
- else
- {
- mod (tp, tn, mp, mn, &dinv, scratch);
- MPN_COPY (xp, tp, mn);
- xn = mn;
- }
-
- if ((mp_limb_signed_t) e < 0)
- {
- mpn_mul (tp, xp, xn, bp, bn);
- tn = xn + bn; tn -= tp[tn - 1] == 0;
- if (tn < mn)
- {
- MPN_COPY (xp, tp, tn);
- xn = tn;
- }
- else
- {
- mod (tp, tn, mp, mn, &dinv, scratch);
- MPN_COPY (xp, tp, mn);
- xn = mn;
- }
- }
- e <<= 1;
- c--;
- }
- while (c != 0);
+ mpn_tdiv_qr (qp, xp, 0L, tp, tn, mp, mn);
+ xn = mn;
}
- /* We shifted m left m_zero_cnt steps. Adjust the result by reducing it
- with the original M. */
- if (m_zero_cnt != 0)
+ if ((mp_limb_signed_t) e < 0)
{
- mp_limb_t cy;
- cy = mpn_lshift (tp, xp, xn, m_zero_cnt);
- tp[xn] = cy; xn += cy != 0;
-
- if (xn < mn)
+ mpn_mul (tp, xp, xn, bp, bn);
+ tn = xn + bn; tn -= tp[tn - 1] == 0;
+ if (tn < mn)
{
- MPN_COPY (xp, tp, xn);
+ MPN_COPY (xp, tp, tn);
+ xn = tn;
}
else
{
- mod (tp, xn, mp, mn, &dinv, scratch);
- MPN_COPY (xp, tp, mn);
+ mpn_tdiv_qr (qp, xp, 0L, tp, tn, mp, mn);
xn = mn;
}
- mpn_rshift (xp, xp, xn, m_zero_cnt);
}
- MPN_NORMALIZE (xp, xn);
+ e <<= 1;
+ c--;
+ }
+
+ finishup:
+ /* We shifted m left m_zero_cnt steps. Adjust the result by reducing
+ it with the original MOD. */
+ if (m_zero_cnt != 0)
+ {
+ mp_limb_t cy;
+ cy = mpn_lshift (tp, xp, xn, m_zero_cnt);
+ tp[xn] = cy; xn += cy != 0;
- if ((el & 1) != 0 && SIZ(b) < 0 && xn != 0)
+ if (xn < mn)
{
- mp = PTR(m); /* want original, unnormalized m */
- mpn_sub (xp, mp, mn, xp, xn);
+ MPN_COPY (xp, tp, xn);
+ }
+ else
+ {
+ mpn_tdiv_qr (qp, xp, 0L, tp, xn, mp, mn);
xn = mn;
- MPN_NORMALIZE (xp, xn);
}
- MPZ_REALLOC (r, xn);
- SIZ (r) = xn;
- MPN_COPY (PTR(r), xp, xn);
-
- TMP_FREE;
+ mpn_rshift (xp, xp, xn, m_zero_cnt);
}
- else
+ MPN_NORMALIZE (xp, xn);
+
+ if ((el & 1) != 0 && SIZ(b) < 0 && xn != 0)
{
- /* For large exponents, fake a mpz_t exponent and deflect to the more
- sophisticated mpz_powm. */
- mpz_t e;
- mp_limb_t ep[LIMBS_PER_ULONG];
- MPZ_FAKE_UI (e, ep, el);
- mpz_powm (r, b, e, m);
+ mp = PTR(m); /* want original, unnormalized m */
+ mpn_sub (xp, mp, mn, xp, xn);
+ xn = mn;
+ MPN_NORMALIZE (xp, xn);
}
+ MPZ_REALLOC (r, xn);
+ SIZ (r) = xn;
+ MPN_COPY (PTR(r), xp, xn);
+
+ TMP_FREE;
}
diff --git a/gmp/mpz/pprime_p.c b/gmp/mpz/pprime_p.c
index f3d38a0821..766155fa81 100644
--- a/gmp/mpz/pprime_p.c
+++ b/gmp/mpz/pprime_p.c
@@ -6,39 +6,29 @@
positive is (1/4)**reps, where reps is the number of internal passes of the
probabilistic algorithm. Knuth indicates that 25 passes are reasonable.
-Copyright 1991, 1993, 1994, 1996-2002, 2005 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2005 Free
+Software Foundation, Inc. Miller-Rabin code 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-static int isprime (unsigned long int);
+static int isprime __GMP_PROTO ((unsigned long int));
/* MPN_MOD_OR_MODEXACT_1_ODD can be used instead of mpn_mod_1 for the trial
@@ -75,24 +65,24 @@ mpz_probab_prime_p (mpz_srcptr n, int reps)
/* Check if n has small factors. */
#if defined (PP_INVERTED)
r = MPN_MOD_OR_PREINV_MOD_1 (PTR(n), (mp_size_t) SIZ(n), (mp_limb_t) PP,
- (mp_limb_t) PP_INVERTED);
+ (mp_limb_t) PP_INVERTED);
#else
r = mpn_mod_1 (PTR(n), (mp_size_t) SIZ(n), (mp_limb_t) PP);
#endif
if (r % 3 == 0
-#if GMP_LIMB_BITS >= 4
+#if BITS_PER_MP_LIMB >= 4
|| r % 5 == 0
#endif
-#if GMP_LIMB_BITS >= 8
+#if BITS_PER_MP_LIMB >= 8
|| r % 7 == 0
#endif
-#if GMP_LIMB_BITS >= 16
+#if BITS_PER_MP_LIMB >= 16
|| r % 11 == 0 || r % 13 == 0
#endif
-#if GMP_LIMB_BITS >= 32
+#if BITS_PER_MP_LIMB >= 32
|| r % 17 == 0 || r % 19 == 0 || r % 23 == 0 || r % 29 == 0
#endif
-#if GMP_LIMB_BITS >= 64
+#if BITS_PER_MP_LIMB >= 64
|| r % 31 == 0 || r % 37 == 0 || r % 41 == 0 || r % 43 == 0
|| r % 47 == 0 || r % 53 == 0
#endif
diff --git a/gmp/mpz/primorial_ui.c b/gmp/mpz/primorial_ui.c
deleted file mode 100644
index f322edf549..0000000000
--- a/gmp/mpz/primorial_ui.c
+++ /dev/null
@@ -1,164 +0,0 @@
-/* mpz_primorial_ui(RESULT, N) -- Set RESULT to N# the product of primes <= N.
-
-Contributed to the GNU project by Marco Bodrato.
-
-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 "gmp.h"
-#include "gmp-impl.h"
-
-/* TODO: Remove duplicated constants / macros / static functions...
- */
-
-/*************************************************************/
-/* Section macros: common macros, for swing/fac/bin (&sieve) */
-/*************************************************************/
-
-#define FACTOR_LIST_STORE(P, PR, MAX_PR, VEC, I) \
- do { \
- if ((PR) > (MAX_PR)) { \
- (VEC)[(I)++] = (PR); \
- (PR) = (P); \
- } else \
- (PR) *= (P); \
- } while (0)
-
-#define LOOP_ON_SIEVE_CONTINUE(prime,end,sieve) \
- __max_i = (end); \
- \
- do { \
- ++__i; \
- if (((sieve)[__index] & __mask) == 0) \
- { \
- (prime) = id_to_n(__i)
-
-#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
- do { \
- mp_limb_t __mask, __index, __max_i, __i; \
- \
- __i = (start)-(off); \
- __index = __i / GMP_LIMB_BITS; \
- __mask = CNST_LIMB(1) << (__i % GMP_LIMB_BITS); \
- __i += (off); \
- \
- LOOP_ON_SIEVE_CONTINUE(prime,end,sieve)
-
-#define LOOP_ON_SIEVE_STOP \
- } \
- __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
- __index += __mask & 1; \
- } while (__i <= __max_i) \
-
-#define LOOP_ON_SIEVE_END \
- LOOP_ON_SIEVE_STOP; \
- } while (0)
-
-/*********************************************************/
-/* Section sieve: sieving functions and tools for primes */
-/*********************************************************/
-
-#if WANT_ASSERT
-static mp_limb_t
-bit_to_n (mp_limb_t bit) { return (bit*3+4)|1; }
-#endif
-
-/* id_to_n (x) = bit_to_n (x-1) = (id*3+1)|1*/
-static mp_limb_t
-id_to_n (mp_limb_t id) { return id*3+1+(id&1); }
-
-/* n_to_bit (n) = ((n-1)&(-CNST_LIMB(2)))/3U-1 */
-static mp_limb_t
-n_to_bit (mp_limb_t n) { return ((n-5)|1)/3U; }
-
-#if WANT_ASSERT
-static mp_size_t
-primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
-#endif
-
-/*********************************************************/
-/* Section primorial: implementation */
-/*********************************************************/
-
-void
-mpz_primorial_ui (mpz_ptr x, unsigned long n)
-{
- static const mp_limb_t table[] = { 1, 1, 2, 6, 6 };
-
- ASSERT (n <= GMP_NUMB_MAX);
-
- if (n < numberof (table))
- {
- PTR (x)[0] = table[n];
- SIZ (x) = 1;
- }
- else
- {
- mp_limb_t *sieve, *factors;
- mp_size_t size;
- mp_limb_t prod;
- mp_limb_t j;
- TMP_DECL;
-
- size = 1 + n / GMP_NUMB_BITS + n / (2*GMP_NUMB_BITS);
- ASSERT (size >= primesieve_size (n));
- sieve = MPZ_NEWALLOC (x, size);
- size = (gmp_primesieve (sieve, n) + 1) / log_n_max (n) + 1;
-
- TMP_MARK;
- factors = TMP_ALLOC_LIMBS (size);
-
- j = 0;
-
- prod = table[numberof (table)-1];
-
- /* Store primes from 5 to n */
- {
- mp_limb_t prime, max_prod;
-
- max_prod = GMP_NUMB_MAX / n;
-
- LOOP_ON_SIEVE_BEGIN (prime, n_to_bit(numberof (table)), n_to_bit (n), 0, sieve);
- FACTOR_LIST_STORE (prime, prod, max_prod, factors, j);
- LOOP_ON_SIEVE_END;
- }
-
- if (LIKELY (j != 0))
- {
- factors[j++] = prod;
- mpz_prodlimbs (x, factors, j);
- }
- else
- {
- PTR (x)[0] = prod;
- SIZ (x) = 1;
- }
-
- TMP_FREE;
- }
-}
diff --git a/gmp/mpz/prodlimbs.c b/gmp/mpz/prodlimbs.c
deleted file mode 100644
index 8d84bcb435..0000000000
--- a/gmp/mpz/prodlimbs.c
+++ /dev/null
@@ -1,109 +0,0 @@
-/* mpz_prodlimbs(RESULT, V, LEN) -- Set RESULT to V[0]*V[1]*...*V[LEN-1].
-
-Contributed to the GNU project by 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 GUARANTEED THAT IT WILL CHANGE OR
-DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/*********************************************************/
-/* Section list-prod: product of a list -> mpz_t */
-/*********************************************************/
-
-/* FIXME: should be tuned */
-#ifndef RECURSIVE_PROD_THRESHOLD
-#define RECURSIVE_PROD_THRESHOLD (MUL_TOOM22_THRESHOLD)
-#endif
-
-/* 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 strategy, to gain
- * speed by the asymptotically fast multiplication algorithms.
- *
- * The list in {factors, j} is overwritten.
- * Returns the size of the result
- */
-
-mp_size_t
-mpz_prodlimbs (mpz_ptr x, mp_ptr factors, mp_size_t j)
-{
- mp_limb_t cy;
- mp_size_t size, i;
- mp_ptr prod;
-
- ASSERT (j > 1);
- ASSERT (RECURSIVE_PROD_THRESHOLD > 3);
-
- if (BELOW_THRESHOLD (j, RECURSIVE_PROD_THRESHOLD)) {
- j--;
- size = 1;
-
- for (i = 1; i < j; i++)
- {
- cy = mpn_mul_1 (factors, factors, size, factors[i]);
- factors[size] = cy;
- size += cy != 0;
- };
-
- prod = MPZ_NEWALLOC (x, size + 1);
-
- cy = mpn_mul_1 (prod, factors, size, factors[i]);
- prod[size] = cy;
- return SIZ (x) = size + (cy != 0);
- } else {
- mpz_t x1, x2;
- TMP_DECL;
-
- i = j >> 1;
- j -= i;
- TMP_MARK;
-
- MPZ_TMP_INIT (x2, j);
-
- PTR (x1) = factors + i;
- ALLOC (x1) = j;
- j = mpz_prodlimbs (x2, factors + i, j);
- i = mpz_prodlimbs (x1, factors, i);
- size = i + j;
- prod = MPZ_NEWALLOC (x, size);
- if (i >= j)
- cy = mpn_mul (prod, PTR(x1), i, PTR(x2), j);
- else
- cy = mpn_mul (prod, PTR(x2), j, PTR(x1), i);
- TMP_FREE;
-
- return SIZ (x) = size - (cy == 0);
- }
-}
diff --git a/gmp/mpz/random.c b/gmp/mpz/random.c
index 1dca3a93cd..8bf2a369fa 100644
--- a/gmp/mpz/random.c
+++ b/gmp/mpz/random.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpz/random2.c b/gmp/mpz/random2.c
index 7f9e5f28e8..f3b85659d2 100644
--- a/gmp/mpz/random2.c
+++ b/gmp/mpz/random2.c
@@ -2,33 +2,22 @@
long runs of consecutive ones and zeros in the binary representation.
Meant for testing of other MP routines.
-Copyright 1991, 1993, 1994, 1996, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2001 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,15 +26,15 @@ void
mpz_random2 (mpz_ptr x, mp_size_t size)
{
mp_size_t abs_size;
- mp_ptr xp;
abs_size = ABS (size);
if (abs_size != 0)
{
- xp = MPZ_REALLOC (x, abs_size);
+ if (x->_mp_alloc < abs_size)
+ _mpz_realloc (x, abs_size);
- mpn_random2 (xp, abs_size);
+ mpn_random2 (x->_mp_d, abs_size);
}
- SIZ (x) = size;
+ x->_mp_size = size;
}
diff --git a/gmp/mpz/realloc.c b/gmp/mpz/realloc.c
index 3d2755ca0a..0a6d1638a5 100644
--- a/gmp/mpz/realloc.c
+++ b/gmp/mpz/realloc.c
@@ -1,32 +1,22 @@
/* _mpz_realloc -- make the mpz_t have NEW_ALLOC digits allocated.
-Copyright 1991, 1993-1995, 2000, 2001, 2008 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdlib.h>
#include <stdio.h>
diff --git a/gmp/mpz/realloc2.c b/gmp/mpz/realloc2.c
index 3ccfaab1f0..9c03c8bfc0 100644
--- a/gmp/mpz/realloc2.c
+++ b/gmp/mpz/realloc2.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdlib.h>
#include <stdio.h>
@@ -34,7 +23,7 @@ see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
void
-mpz_realloc2 (mpz_ptr m, mp_bitcnt_t bits)
+mpz_realloc2 (mpz_ptr m, unsigned long bits)
{
mp_size_t new_alloc;
diff --git a/gmp/mpz/remove.c b/gmp/mpz/remove.c
index 3d29358738..e670afc4ed 100644
--- a/gmp/mpz/remove.c
+++ b/gmp/mpz/remove.c
@@ -1,147 +1,92 @@
/* mpz_remove -- divide out a factor and return its multiplicity.
-Copyright 1998-2002, 2012 Free Software Foundation, Inc.
+Copyright 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_bitcnt_t
+unsigned long int
mpz_remove (mpz_ptr dest, mpz_srcptr src, mpz_srcptr f)
{
- mp_bitcnt_t pwr;
- mp_srcptr fp;
- mp_size_t sn, fn, afn;
- mp_limb_t fp0;
-
- sn = SIZ (src);
- fn = SIZ (f);
- fp = PTR (f);
- afn = ABS (fn);
- fp0 = fp[0];
-
- if (UNLIKELY ((afn <= (fp0 == 1)) /* mpz_cmpabs_ui (f, 1) <= 0 */
- | (sn == 0)))
+ mpz_t fpow[GMP_LIMB_BITS]; /* Really MP_SIZE_T_BITS */
+ mpz_t x, rem;
+ unsigned long int pwr;
+ int p;
+
+ if (mpz_cmp_ui (f, 1) <= 0)
+ DIVIDE_BY_ZERO;
+
+ if (SIZ (src) == 0)
{
- /* f = 0 or f = +- 1 or src = 0 */
- if (afn == 0)
- DIVIDE_BY_ZERO;
- mpz_set (dest, src);
+ if (src != dest)
+ mpz_set (dest, src);
return 0;
}
- if ((fp0 & 1) != 0)
- { /* f is odd */
- mp_ptr dp;
- mp_size_t dn;
+ if (mpz_cmp_ui (f, 2) == 0)
+ {
+ unsigned long int s0;
+ s0 = mpz_scan1 (src, 0);
+ mpz_div_2exp (dest, src, s0);
+ return s0;
+ }
+
+ /* 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. */
- dn = ABS (sn);
- dp = MPZ_REALLOC (dest, dn);
+ mpz_init (rem);
+ mpz_init (x);
- pwr = mpn_remove (dp, &dn, PTR(src), dn, PTR(f), afn, ~(mp_bitcnt_t) 0);
+ pwr = 0;
+ mpz_init (fpow[0]);
+ mpz_set (fpow[0], f);
+ mpz_set (dest, src);
- SIZ (dest) = ((pwr & (fn < 0)) ^ (sn < 0)) ? -dn : dn;
- }
- else if (afn == (fp0 == 2))
- { /* mpz_cmpabs_ui (f, 2) == 0 */
- pwr = mpz_scan1 (src, 0);
- mpz_div_2exp (dest, src, pwr);
- if (pwr & (fn < 0)) /*((pwr % 2 == 1) && (SIZ (f) < 0))*/
- mpz_neg (dest, dest);
+ /* 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, 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);
}
- else
- { /* f != +-2 */
- mpz_t x, rem;
- mpz_init (rem);
- mpz_init (x);
+ pwr = (1L << p) - 1;
- pwr = 0;
- mpz_tdiv_qr (x, rem, src, f);
+ mpz_clear (fpow[p]);
+
+ /* 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)
{
- mpz_t fpow[GMP_LIMB_BITS]; /* Really MP_SIZE_T_BITS */
- int p;
-
-#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);
-
- 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)
- {
- pwr += (mp_bitcnt_t)1 << p;
- mpz_swap (dest, x);
- }
- mpz_clear (fpow[p]);
- }
-
-#if WANT_ORIGINAL_DEST
- if (PTR (x) == dp) {
- mpz_swap (dest, x);
- mpz_set (dest, x);
- }
-#endif
+ pwr += 1L << p;
+ mpz_set (dest, x);
}
- else
- mpz_set (dest, src);
-
- mpz_clear (x);
- mpz_clear (rem);
+ mpz_clear (fpow[p]);
}
+ mpz_clear (x);
+ mpz_clear (rem);
return pwr;
}
diff --git a/gmp/mpz/roinit_n.c b/gmp/mpz/roinit_n.c
deleted file mode 100644
index 137dbda83c..0000000000
--- a/gmp/mpz/roinit_n.c
+++ /dev/null
@@ -1,44 +0,0 @@
-/* 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;
-}
diff --git a/gmp/mpz/root.c b/gmp/mpz/root.c
index 31eb440b4f..ece0a997bb 100644
--- a/gmp/mpz/root.c
+++ b/gmp/mpz/root.c
@@ -1,33 +1,22 @@
/* mpz_root(root, u, nth) -- Set ROOT to floor(U^(1/nth)).
Return an indication if the result is exact.
-Copyright 1999-2003, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -43,12 +32,12 @@ mpz_root (mpz_ptr root, mpz_srcptr u, unsigned long int nth)
us = SIZ(u);
/* even roots of negatives provoke an exception */
- if (UNLIKELY (us < 0 && (nth & 1) == 0))
+ if (us < 0 && (nth & 1) == 0)
SQRT_OF_NEGATIVE;
/* root extraction interpreted as c^(1/nth) means a zeroth root should
provoke a divide by zero, do this even if c==0 */
- if (UNLIKELY (nth == 0))
+ if (nth == 0)
DIVIDE_BY_ZERO;
if (us == 0)
diff --git a/gmp/mpz/rootrem.c b/gmp/mpz/rootrem.c
index ac4a1e030a..69988d6f25 100644
--- a/gmp/mpz/rootrem.c
+++ b/gmp/mpz/rootrem.c
@@ -1,33 +1,22 @@
-/* mpz_rootrem(root, rem, u, nth) -- Set ROOT to trunc(U^(1/nth)) and
+/* mpz_rootrem(root, rem, u, nth) -- Set ROOT to floor(U^(1/nth)) and
set REM to the remainder.
-Copyright 1999-2003, 2005, 2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -43,12 +32,12 @@ mpz_rootrem (mpz_ptr root, mpz_ptr rem, mpz_srcptr u, unsigned long int nth)
us = SIZ(u);
/* even roots of negatives provoke an exception */
- if (UNLIKELY (us < 0 && (nth & 1) == 0))
+ if (us < 0 && (nth & 1) == 0)
SQRT_OF_NEGATIVE;
/* root extraction interpreted as c^(1/nth) means a zeroth root should
provoke a divide by zero, do this even if c==0 */
- if (UNLIKELY (nth == 0))
+ if (nth == 0)
DIVIDE_BY_ZERO;
if (us == 0)
@@ -92,10 +81,10 @@ mpz_rootrem (mpz_ptr root, mpz_ptr rem, mpz_srcptr u, unsigned long int nth)
SIZ(root) = us >= 0 ? rootn : -rootn;
if (u == root)
MPN_COPY (up, rootp, rootn);
+ else if (u == rem)
+ MPN_COPY (up, remp, remn);
}
- if (u == rem)
- MPN_COPY (up, remp, remn);
- SIZ(rem) = us >= 0 ? remn : -remn;
+ SIZ(rem) = remn;
TMP_FREE;
}
diff --git a/gmp/mpz/rrandomb.c b/gmp/mpz/rrandomb.c
index 8b1803c6ba..f34aaec7ad 100644
--- a/gmp/mpz/rrandomb.c
+++ b/gmp/mpz/rrandomb.c
@@ -2,50 +2,38 @@
long runs of consecutive ones and zeros in the binary representation.
Meant for testing of other MP routines.
-Copyright 2000-2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
-static void gmp_rrandomb (mp_ptr, gmp_randstate_t, mp_bitcnt_t);
+static void gmp_rrandomb __GMP_PROTO ((mp_ptr, gmp_randstate_t, unsigned long int));
void
-mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, mp_bitcnt_t nbits)
+mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, unsigned long int nbits)
{
mp_size_t nl;
- mp_ptr xp;
- nl = BITS_TO_LIMBS (nbits);
+ nl = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS;
if (nbits != 0)
{
- xp = MPZ_NEWALLOC (x, nl);
- gmp_rrandomb (xp, rstate, nbits);
+ MPZ_REALLOC (x, nl);
+ gmp_rrandomb (PTR(x), rstate, nbits);
}
SIZ(x) = nl;
@@ -61,15 +49,15 @@ mpz_rrandomb (mpz_ptr x, gmp_randstate_t rstate, mp_bitcnt_t nbits)
#endif
static void
-gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, mp_bitcnt_t nbits)
+gmp_rrandomb (mp_ptr rp, gmp_randstate_t rstate, unsigned long int nbits)
{
- mp_bitcnt_t bi;
+ unsigned long int bi;
mp_limb_t ranm; /* buffer for random bits */
unsigned cap_chunksize, chunksize;
mp_size_t i;
/* Set entire result to 111..1 */
- i = BITS_TO_LIMBS (nbits) - 1;
+ i = (nbits + GMP_NUMB_BITS - 1) / GMP_NUMB_BITS - 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;
diff --git a/gmp/mpz/scan0.c b/gmp/mpz/scan0.c
index de24595cfe..3ad0941a32 100644
--- a/gmp/mpz/scan0.c
+++ b/gmp/mpz/scan0.c
@@ -1,32 +1,21 @@
/* mpz_scan0 -- search for a 0 bit.
-Copyright 2000-2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,14 +27,14 @@ see https://www.gnu.org/licenses/. */
search under u<0, but usually the search won't go very far so it seems
reasonable to inline that code. */
-mp_bitcnt_t
-mpz_scan0 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
+unsigned long
+mpz_scan0 (mpz_srcptr u, unsigned long starting_bit)
{
mp_srcptr u_ptr = PTR(u);
mp_size_t size = SIZ(u);
mp_size_t abs_size = ABS(size);
mp_srcptr u_end = u_ptr + abs_size;
- mp_size_t starting_limb = starting_bit / GMP_NUMB_BITS;
+ unsigned long starting_limb = starting_bit / GMP_NUMB_BITS;
mp_srcptr p = u_ptr + starting_limb;
mp_limb_t limb;
int cnt;
@@ -53,7 +42,7 @@ mpz_scan0 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
/* 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 (starting_limb >= abs_size)
- return (size >= 0 ? starting_bit : ~(mp_bitcnt_t) 0);
+ return (size >= 0 ? starting_bit : ULONG_MAX);
limb = *p;
@@ -63,14 +52,14 @@ mpz_scan0 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
limb |= (CNST_LIMB(1) << (starting_bit % GMP_NUMB_BITS)) - 1;
/* Search for a limb which isn't all ones. If the end is reached then
- the zero bit immediately past the end is returned. */
+ the zero bit immediately past the end is returned. */
while (limb == GMP_NUMB_MAX)
- {
- p++;
- if (p == u_end)
- return (mp_bitcnt_t) abs_size * GMP_NUMB_BITS;
- limb = *p;
- }
+ {
+ p++;
+ if (p == u_end)
+ return (unsigned long) abs_size * GMP_NUMB_BITS;
+ limb = *p;
+ }
/* Now seek low 1 bit. */
limb = ~limb;
@@ -80,21 +69,21 @@ mpz_scan0 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
mp_srcptr q;
/* If there's a non-zero limb before ours then we're in the ones
- complement region. Search from *(p-1) downwards since that might
- give better cache locality, and since a non-zero in the middle of a
- number is perhaps a touch more likely than at the end. */
+ complement region. Search from *(p-1) downwards since that might
+ give better cache locality, and since a non-zero in the middle of a
+ number is perhaps a touch more likely than at the end. */
q = p;
while (q != u_ptr)
- {
- q--;
- if (*q != 0)
- goto inverted;
- }
+ {
+ q--;
+ if (*q != 0)
+ goto inverted;
+ }
/* Adjust so ~limb implied by searching for 1 bit below becomes -limb.
- If limb==0 here then this isn't the beginning of twos complement
- inversion, but that doesn't matter because limb==0 is a zero bit
- immediately (-1 is all ones for below). */
+ If limb==0 here then this isn't the beginning of twos complement
+ inversion, but that doesn't matter because limb==0 is a zero bit
+ immediately (-1 is all ones for below). */
limb--;
inverted:
@@ -104,27 +93,27 @@ mpz_scan0 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
limb &= (MP_LIMB_T_MAX << (starting_bit % GMP_NUMB_BITS));
if (limb == 0)
- {
- /* If the high limb is zero after masking, then no 1 bits past
- starting_bit. */
- p++;
- if (p == u_end)
- return ~(mp_bitcnt_t) 0;
-
- /* Search further for a non-zero limb. The high limb is non-zero,
- if nothing else. */
- for (;;)
- {
- limb = *p;
- if (limb != 0)
- break;
- p++;
- ASSERT (p < u_end);
- }
- }
+ {
+ /* If the high limb is zero after masking, then no 1 bits past
+ starting_bit. */
+ p++;
+ if (p == u_end)
+ return ULONG_MAX;
+
+ /* Search further for a non-zero limb. The high limb is non-zero,
+ if nothing else. */
+ for (;;)
+ {
+ limb = *p;
+ if (limb != 0)
+ break;
+ p++;
+ ASSERT (p < u_end);
+ }
+ }
}
ASSERT (limb != 0);
count_trailing_zeros (cnt, limb);
- return (mp_bitcnt_t) (p - u_ptr) * GMP_NUMB_BITS + cnt;
+ return (p - u_ptr) * GMP_NUMB_BITS + cnt;
}
diff --git a/gmp/mpz/scan1.c b/gmp/mpz/scan1.c
index c9309de691..329177ec55 100644
--- a/gmp/mpz/scan1.c
+++ b/gmp/mpz/scan1.c
@@ -1,32 +1,21 @@
/* mpz_scan1 -- search for a 1 bit.
-Copyright 2000-2002, 2004, 2012 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,14 +27,14 @@ see https://www.gnu.org/licenses/. */
(except when in the high limb), but usually the search won't go very far
so it seems reasonable to inline that code. */
-mp_bitcnt_t
-mpz_scan1 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
+unsigned long
+mpz_scan1 (mpz_srcptr u, unsigned long starting_bit)
{
mp_srcptr u_ptr = PTR(u);
mp_size_t size = SIZ(u);
mp_size_t abs_size = ABS(size);
- mp_srcptr u_end = u_ptr + abs_size - 1;
- mp_size_t starting_limb = starting_bit / GMP_NUMB_BITS;
+ mp_srcptr u_end = u_ptr + abs_size;
+ unsigned long starting_limb = starting_bit / GMP_NUMB_BITS;
mp_srcptr p = u_ptr + starting_limb;
mp_limb_t limb;
int cnt;
@@ -53,11 +42,7 @@ mpz_scan1 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
/* Past the end there's no 1 bits for u>=0, or an immediate 1 bit for u<0.
Notice this test picks up any u==0 too. */
if (starting_limb >= abs_size)
- return (size >= 0 ? ~(mp_bitcnt_t) 0 : starting_bit);
-
- /* This is an important case, where sign is not relevant! */
- if (starting_bit == 0)
- goto short_cut;
+ return (size >= 0 ? ULONG_MAX : starting_bit);
limb = *p;
@@ -67,58 +52,86 @@ mpz_scan1 (mpz_srcptr u, mp_bitcnt_t starting_bit) __GMP_NOTHROW
limb &= (MP_LIMB_T_MAX << (starting_bit % GMP_NUMB_BITS));
if (limb == 0)
- {
- /* If it's the high limb which is zero after masking, then there's
- no 1 bits after starting_bit. */
- if (p == u_end)
- return ~(mp_bitcnt_t) 0;
-
- /* Otherwise search further for a non-zero limb. The high limb is
- non-zero, if nothing else. */
- search_nonzero:
- do
- {
- ASSERT (p != u_end);
- p++;
- short_cut:
- limb = *p;
- }
- while (limb == 0);
- }
+ {
+ /* If it's the high limb which is zero after masking, then there's
+ no 1 bits after starting_bit. */
+ p++;
+ if (p == u_end)
+ return ULONG_MAX;
+
+ /* Otherwise search further for a non-zero limb. The high limb is
+ non-zero, if nothing else. */
+ for (;;)
+ {
+ limb = *p;
+ if (limb != 0)
+ break;
+ p++;
+ ASSERT (p < u_end);
+ }
+ }
}
else
{
- /* If there's a non-zero limb before ours then we're in the ones
- complement region. */
- if (mpn_zero_p (u_ptr, starting_limb)) {
- if (limb == 0)
- /* Seeking for the first non-zero bit, it is the same for u and -u. */
- goto search_nonzero;
+ mp_srcptr q;
- /* Adjust so ~limb implied by searching for 0 bit becomes -limb. */
- limb--;
- }
+ /* If there's a non-zero limb before ours then we're in the ones
+ complement region. Search from *(p-1) downwards since that might
+ give better cache locality, and since a non-zero in the middle of a
+ number is perhaps a touch more likely than at the end. */
+ q = p;
+ while (q != u_ptr)
+ {
+ q--;
+ if (*q != 0)
+ goto inverted;
+ }
+ if (limb == 0)
+ {
+ /* Skip zero limbs, to find the start of twos complement. The
+ high limb is non-zero, if nothing else. This search is
+ necessary so the -limb is applied at the right spot. */
+ do
+ {
+ p++;
+ ASSERT (p < u_end);
+ limb = *p;
+ }
+ while (limb == 0);
+
+ /* Apply twos complement, and look for a 1 bit in that. Since
+ limb!=0 here, also have (-limb)!=0 so there's certainly a 1
+ bit. */
+ limb = -limb;
+ goto got_limb;
+ }
+
+ /* Adjust so ~limb implied by searching for 0 bit becomes -limb. */
+ limb--;
+
+ inverted:
/* Now seeking a 0 bit. */
/* Mask to 1 all bits before starting_bit, thus ignoring them. */
limb |= (CNST_LIMB(1) << (starting_bit % GMP_NUMB_BITS)) - 1;
/* Search for a limb which is not all ones. If the end is reached
- then the zero immediately past the end is the result. */
+ then the zero immediately past the end is the result. */
while (limb == GMP_NUMB_MAX)
- {
- if (p == u_end)
- return (mp_bitcnt_t) abs_size * GMP_NUMB_BITS;
- p++;
- limb = *p;
- }
+ {
+ p++;
+ if (p == u_end)
+ return abs_size * GMP_NUMB_BITS;
+ limb = *p;
+ }
/* Now seeking low 1 bit. */
limb = ~limb;
}
+ got_limb:
ASSERT (limb != 0);
count_trailing_zeros (cnt, limb);
- return (mp_bitcnt_t) (p - u_ptr) * GMP_NUMB_BITS + cnt;
+ return (p - u_ptr) * GMP_NUMB_BITS + cnt;
}
diff --git a/gmp/mpz/set.c b/gmp/mpz/set.c
index 9d7d58c8d0..d7366c837b 100644
--- a/gmp/mpz/set.c
+++ b/gmp/mpz/set.c
@@ -1,50 +1,53 @@
/* mpz_set (dest_integer, src_integer) -- Assign DEST_INTEGER from SRC_INTEGER.
-Copyright 1991, 1993-1995, 2000, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+#ifdef BERKELEY_MP
+#include "mp.h"
+#define FUNCTION move
+#define ARGUMENTS mpz_srcptr u, mpz_ptr w
+
+#else
+#define FUNCTION mpz_set
+#define ARGUMENTS mpz_ptr w, mpz_srcptr u
+
+#endif
+
+
void
-mpz_set (mpz_ptr w, mpz_srcptr u)
+FUNCTION (ARGUMENTS)
{
mp_ptr wp, up;
mp_size_t usize, size;
- usize = SIZ(u);
+ usize = u->_mp_size;
size = ABS (usize);
- wp = MPZ_REALLOC (w, size);
+ if (w->_mp_alloc < size)
+ _mpz_realloc (w, size);
- up = PTR(u);
+ wp = w->_mp_d;
+ up = u->_mp_d;
MPN_COPY (wp, up, size);
- SIZ(w) = usize;
+ w->_mp_size = usize;
}
diff --git a/gmp/mpz/set_d.c b/gmp/mpz/set_d.c
index d40ee726d2..2e7fce107f 100644
--- a/gmp/mpz/set_d.c
+++ b/gmp/mpz/set_d.c
@@ -1,32 +1,22 @@
/* mpz_set_d(integer, val) -- Assign INTEGER with a double value VAL.
-Copyright 1995, 1996, 2000-2003, 2006 Free Software Foundation, Inc.
+Copyright 1995, 1996, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
@@ -54,8 +44,8 @@ mpz_set_d (mpz_ptr r, double d)
mp_size_t rn;
DOUBLE_NAN_INF_ACTION (d,
- __gmp_invalid_operation (),
- __gmp_invalid_operation ());
+ __gmp_invalid_operation (),
+ __gmp_invalid_operation ());
negative = d < 0;
d = ABS (d);
diff --git a/gmp/mpz/set_f.c b/gmp/mpz/set_f.c
index 4eb9819837..b939b662b5 100644
--- a/gmp/mpz/set_f.c
+++ b/gmp/mpz/set_f.c
@@ -1,32 +1,21 @@
/* mpz_set_f (dest_integer, src_float) -- Assign DEST_INTEGER from SRC_FLOAT.
-Copyright 1996, 2001, 2012 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -47,7 +36,8 @@ mpz_set_f (mpz_ptr w, mpf_srcptr u)
return;
}
- wp = MPZ_REALLOC (w, exp);
+ MPZ_REALLOC (w, exp);
+ wp = PTR(w);
up = PTR(u);
size = SIZ (u);
@@ -63,7 +53,7 @@ mpz_set_f (mpz_ptr w, mpf_srcptr u)
}
else
{
- /* exp<=size, truncate to the high "exp" many limbs */
+ /* exp<=size, trucate to the high "exp" many limbs */
up += (size - exp);
size = exp;
}
diff --git a/gmp/mpz/set_q.c b/gmp/mpz/set_q.c
index 2627e82298..13e59ae44a 100644
--- a/gmp/mpz/set_q.c
+++ b/gmp/mpz/set_q.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_set_q 1
diff --git a/gmp/mpz/set_si.c b/gmp/mpz/set_si.c
index 1370368332..7c73047e30 100644
--- a/gmp/mpz/set_si.c
+++ b/gmp/mpz/set_si.c
@@ -1,32 +1,22 @@
/* mpz_set_si(dest,val) -- Assign DEST with a small value VAL.
-Copyright 1991, 1993-1995, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1995, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,19 +27,19 @@ mpz_set_si (mpz_ptr dest, signed long int val)
mp_size_t size;
mp_limb_t vl;
- vl = (mp_limb_t) ABS_CAST (unsigned long int, val);
+ vl = (mp_limb_t) (unsigned long int) (val >= 0 ? val : -val);
- PTR (dest)[0] = vl & GMP_NUMB_MASK;
+ dest->_mp_d[0] = vl & GMP_NUMB_MASK;
size = vl != 0;
#if GMP_NAIL_BITS != 0
if (vl > GMP_NUMB_MAX)
{
MPZ_REALLOC (dest, 2);
- PTR (dest)[1] = vl >> GMP_NUMB_BITS;
+ dest->_mp_d[1] = vl >> GMP_NUMB_BITS;
size = 2;
}
#endif
- SIZ (dest) = val >= 0 ? size : -size;
+ dest->_mp_size = val >= 0 ? size : -size;
}
diff --git a/gmp/mpz/set_str.c b/gmp/mpz/set_str.c
index 848d2136a0..550c4866b8 100644
--- a/gmp/mpz/set_str.c
+++ b/gmp/mpz/set_str.c
@@ -4,41 +4,30 @@
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-1998, 2000-2003, 2005, 2011-2013 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 1998, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <string.h>
#include <ctype.h>
#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
+extern const unsigned char __gmp_digit_value_tab[];
#define digit_value_tab __gmp_digit_value_tab
int
@@ -58,7 +47,7 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
{
/* For bases > 36, use the collating sequence
0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz. */
- digit_value += 208;
+ digit_value += 224;
if (base > 62)
return -1; /* too large base */
}
@@ -106,7 +95,7 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
/* Make sure the string does not become empty, mpn_set_str would fail. */
if (c == 0)
{
- SIZ (x) = 0;
+ x->_mp_size = 0;
return 0;
}
@@ -133,12 +122,13 @@ mpz_set_str (mpz_ptr x, const char *str, int base)
str_size = s - begs;
- LIMBS_PER_DIGIT_IN_BASE (xsize, str_size, base);
+ xsize = 2 + (mp_size_t)
+ (str_size / (GMP_NUMB_BITS * mp_bases[base].chars_per_bit_exactly));
MPZ_REALLOC (x, xsize);
/* Convert the byte array in base BASE to our bignum format. */
- xsize = mpn_set_str (PTR (x), (unsigned char *) begs, str_size, base);
- SIZ (x) = negative ? -xsize : xsize;
+ xsize = mpn_set_str (x->_mp_d, (unsigned char *) begs, str_size, base);
+ x->_mp_size = negative ? -xsize : xsize;
TMP_FREE;
return 0;
diff --git a/gmp/mpz/set_ui.c b/gmp/mpz/set_ui.c
index f36754cd59..13afc6a787 100644
--- a/gmp/mpz/set_ui.c
+++ b/gmp/mpz/set_ui.c
@@ -1,33 +1,22 @@
/* mpz_set_ui(integer, val) -- Assign INTEGER with a small value VAL.
-Copyright 1991, 1993-1995, 2001, 2002, 2004, 2012 Free Software Foundation,
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -37,17 +26,17 @@ mpz_set_ui (mpz_ptr dest, unsigned long int val)
{
mp_size_t size;
- PTR (dest)[0] = val & GMP_NUMB_MASK;
+ dest->_mp_d[0] = val & GMP_NUMB_MASK;
size = val != 0;
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
if (val > GMP_NUMB_MAX)
{
MPZ_REALLOC (dest, 2);
- PTR (dest)[1] = val >> GMP_NUMB_BITS;
+ dest->_mp_d[1] = val >> GMP_NUMB_BITS;
size = 2;
}
#endif
- SIZ (dest) = size;
+ dest->_mp_size = size;
}
diff --git a/gmp/mpz/setbit.c b/gmp/mpz/setbit.c
index 3c2c139f98..b4715b6a1d 100644
--- a/gmp/mpz/setbit.c
+++ b/gmp/mpz/setbit.c
@@ -1,65 +1,56 @@
/* mpz_setbit -- set a specified bit.
-Copyright 1991, 1993-1995, 1997, 1999, 2001, 2002, 2012 Free Software
+Copyright 1991, 1993, 1994, 1995, 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_setbit (mpz_ptr d, mp_bitcnt_t bit_idx)
+mpz_setbit (mpz_ptr d, unsigned long int bit_index)
{
- mp_size_t dsize = SIZ (d);
- mp_ptr dp = PTR (d);
- mp_size_t limb_idx;
- mp_limb_t mask;
+ mp_size_t dsize = d->_mp_size;
+ mp_ptr dp = d->_mp_d;
+ mp_size_t limb_index;
- limb_idx = bit_idx / GMP_NUMB_BITS;
- mask = CNST_LIMB(1) << (bit_idx % GMP_NUMB_BITS);
+ limb_index = bit_index / GMP_NUMB_BITS;
if (dsize >= 0)
{
- if (limb_idx < dsize)
+ if (limb_index < dsize)
{
- dp[limb_idx] |= mask;
+ dp[limb_index] |= (mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS);
+ d->_mp_size = dsize;
}
else
{
/* Ugh. The bit should be set 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;
+ if (UNLIKELY (d->_mp_alloc < limb_index + 1))
+ dp = _mpz_realloc (d, limb_index + 1);
+ MPN_ZERO (dp + dsize, limb_index - dsize);
+ dp[limb_index] = (mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS);
+ d->_mp_size = limb_index + 1;
}
}
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.
@@ -67,39 +58,60 @@ mpz_setbit (mpz_ptr d, mp_bitcnt_t bit_idx)
dsize = -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++;
+ /* No upper bound on this loop, we're sure there's a non-zero limb
+ sooner ot later. */
+ for (zero_bound = 0; ; zero_bound++)
+ if (dp[zero_bound] != 0)
+ break;
- if (limb_idx > zero_bound)
+ if (limb_index > zero_bound)
+ {
+ if (limb_index < dsize)
+ {
+ mp_limb_t dlimb;
+ dlimb = dp[limb_index];
+ dlimb &= ~((mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS));
+ dp[limb_index] = dlimb;
+
+ if (UNLIKELY (dlimb == 0 && limb_index == dsize-1))
+ {
+ /* high limb became zero, must normalize */
+ do {
+ dsize--;
+ } while (dsize > 0 && dp[dsize-1] == 0);
+ d->_mp_size = -dsize;
+ }
+ }
+ }
+ else if (limb_index == zero_bound)
+ {
+ dp[limb_index] = ((dp[limb_index] - 1)
+ & ~((mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS))) + 1;
+ if (dp[limb_index] == 0)
{
- mp_limb_t dlimb;
- dlimb = dp[limb_idx] & ~mask;
- dp[limb_idx] = dlimb;
-
- if (UNLIKELY ((dlimb == 0) + limb_idx == dsize)) /* dsize == limb_idx + 1 */
+ mp_size_t i;
+ for (i = limb_index + 1; i < dsize; i++)
{
- /* high limb became zero, must normalize */
- MPN_NORMALIZE (dp, limb_idx);
- SIZ (d) = -limb_idx;
+ dp[i] += 1;
+ if (dp[i] != 0)
+ goto fin;
}
+ /* We got carry all way out beyond the end of D. Increase
+ its size (and allocation if necessary). */
+ dsize++;
+ if (UNLIKELY (d->_mp_alloc < dsize))
+ dp = _mpz_realloc (d, dsize);
+ dp[i] = 1;
+ d->_mp_size = -dsize;
+ fin:;
}
- 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
+ {
+ mpn_decr_u (dp + limb_index,
+ (mp_limb_t) 1 << (bit_index % GMP_NUMB_BITS));
+ dsize -= dp[dsize - 1] == 0;
+ d->_mp_size = -dsize;
}
}
}
diff --git a/gmp/mpz/size.c b/gmp/mpz/size.c
index 2b324c3423..b310228e9d 100644
--- a/gmp/mpz/size.c
+++ b/gmp/mpz/size.c
@@ -1,33 +1,22 @@
/* mpz_size(x) -- return the number of lims currently used by the
value of integer X.
-Copyright 1991, 1993-1995, 2001 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_FORCE_mpz_size 1
diff --git a/gmp/mpz/sizeinbase.c b/gmp/mpz/sizeinbase.c
index 0f3851ea86..1b2f5b1b42 100644
--- a/gmp/mpz/sizeinbase.c
+++ b/gmp/mpz/sizeinbase.c
@@ -2,40 +2,29 @@
character the integer X would have printed in base BASE. The
approximation is never too small.
-Copyright 1991, 1993-1995, 2001, 2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
size_t
-mpz_sizeinbase (mpz_srcptr x, int base) __GMP_NOTHROW
+mpz_sizeinbase (mpz_srcptr x, int base)
{
size_t result;
MPN_SIZEINBASE (result, PTR(x), ABSIZ(x), base);
diff --git a/gmp/mpz/sqrt.c b/gmp/mpz/sqrt.c
index d906cfd59e..c067e63113 100644
--- a/gmp/mpz/sqrt.c
+++ b/gmp/mpz/sqrt.c
@@ -1,33 +1,22 @@
/* mpz_sqrt(root, u) -- Set ROOT to floor(sqrt(U)).
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005 Free Software Foundation,
+Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -38,40 +27,58 @@ mpz_sqrt (mpz_ptr root, mpz_srcptr op)
{
mp_size_t op_size, root_size;
mp_ptr root_ptr, op_ptr;
+ mp_ptr free_me = NULL;
+ mp_size_t free_me_size;
+ TMP_DECL;
- op_size = SIZ (op);
- if (UNLIKELY (op_size <= 0))
+ TMP_MARK;
+ op_size = op->_mp_size;
+ if (op_size <= 0)
{
if (op_size < 0)
- SQRT_OF_NEGATIVE;
+ SQRT_OF_NEGATIVE;
SIZ(root) = 0;
return;
}
/* The size of the root is accurate after this simple calculation. */
root_size = (op_size + 1) / 2;
- SIZ (root) = root_size;
- op_ptr = PTR (op);
+ root_ptr = root->_mp_d;
+ op_ptr = op->_mp_d;
- if (root == op)
+ if (root->_mp_alloc < root_size)
{
- /* Allocate temp space for the root, which we then copy to the
- shared OP/ROOT variable. */
- TMP_DECL;
- TMP_MARK;
-
- root_ptr = TMP_ALLOC_LIMBS (root_size);
- mpn_sqrtrem (root_ptr, NULL, op_ptr, op_size);
-
- MPN_COPY (op_ptr, root_ptr, root_size);
-
- TMP_FREE;
+ if (root_ptr == op_ptr)
+ {
+ free_me = root_ptr;
+ free_me_size = root->_mp_alloc;
+ }
+ else
+ (*__gmp_free_func) (root_ptr, root->_mp_alloc * BYTES_PER_MP_LIMB);
+
+ root->_mp_alloc = root_size;
+ root_ptr = (mp_ptr) (*__gmp_allocate_func) (root_size * BYTES_PER_MP_LIMB);
+ root->_mp_d = root_ptr;
}
else
{
- root_ptr = MPZ_REALLOC (root, root_size);
-
- mpn_sqrtrem (root_ptr, NULL, op_ptr, op_size);
+ /* Make OP not overlap with ROOT. */
+ if (root_ptr == op_ptr)
+ {
+ /* ROOT and OP are identical. Allocate temporary space for OP. */
+ op_ptr = (mp_ptr) TMP_ALLOC (op_size * BYTES_PER_MP_LIMB);
+ /* Copy to the temporary space. Hack: Avoid temporary variable
+ by using ROOT_PTR. */
+ MPN_COPY (op_ptr, root_ptr, op_size);
+ }
}
+
+ mpn_sqrtrem (root_ptr, NULL, op_ptr, op_size);
+
+ root->_mp_size = root_size;
+
+ if (free_me != NULL)
+ (*__gmp_free_func) (free_me, free_me_size * BYTES_PER_MP_LIMB);
+ TMP_FREE;
}
diff --git a/gmp/mpz/sqrtrem.c b/gmp/mpz/sqrtrem.c
index 99685354d6..9b44f45985 100644
--- a/gmp/mpz/sqrtrem.c
+++ b/gmp/mpz/sqrtrem.c
@@ -1,85 +1,101 @@
/* mpz_sqrtrem(root,rem,x) -- Set ROOT to floor(sqrt(X)) and REM
to the remainder, i.e. X - ROOT**2.
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005 Free Software Foundation,
+Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
#include "gmp-impl.h"
+#ifdef BERKELEY_MP
+#include "mp.h"
+#endif
void
+#ifndef BERKELEY_MP
mpz_sqrtrem (mpz_ptr root, mpz_ptr rem, mpz_srcptr op)
+#else /* BERKELEY_MP */
+msqrt (mpz_srcptr op, mpz_ptr root, mpz_ptr rem)
+#endif /* BERKELEY_MP */
{
mp_size_t op_size, root_size, rem_size;
- mp_ptr root_ptr, op_ptr, rem_ptr;
-
- op_size = SIZ (op);
- if (UNLIKELY (op_size <= 0))
+ mp_ptr root_ptr, op_ptr;
+ mp_ptr free_me = NULL;
+ mp_size_t free_me_size;
+ TMP_DECL;
+
+ TMP_MARK;
+ op_size = op->_mp_size;
+ if (op_size <= 0)
{
if (op_size < 0)
- SQRT_OF_NEGATIVE;
+ SQRT_OF_NEGATIVE;
SIZ(root) = 0;
SIZ(rem) = 0;
return;
}
- rem_ptr = MPZ_REALLOC (rem, op_size);
+ if (rem->_mp_alloc < op_size)
+ _mpz_realloc (rem, op_size);
/* The size of the root is accurate after this simple calculation. */
root_size = (op_size + 1) / 2;
- SIZ (root) = root_size;
- op_ptr = PTR (op);
+ root_ptr = root->_mp_d;
+ op_ptr = op->_mp_d;
- if (root == op)
+ if (root->_mp_alloc < root_size)
{
- /* Allocate temp space for the root, which we then copy to the
- shared OP/ROOT variable. */
- TMP_DECL;
- TMP_MARK;
-
- root_ptr = TMP_ALLOC_LIMBS (root_size);
- rem_size = mpn_sqrtrem (root_ptr, rem_ptr, op_ptr, op_size);
-
- if (rem != root) /* Don't overwrite remainder */
- MPN_COPY (op_ptr, root_ptr, root_size);
-
- TMP_FREE;
+ if (root_ptr == op_ptr)
+ {
+ free_me = root_ptr;
+ free_me_size = root->_mp_alloc;
+ }
+ else
+ (*__gmp_free_func) (root_ptr, root->_mp_alloc * BYTES_PER_MP_LIMB);
+
+ root->_mp_alloc = root_size;
+ root_ptr = (mp_ptr) (*__gmp_allocate_func) (root_size * BYTES_PER_MP_LIMB);
+ root->_mp_d = root_ptr;
}
else
{
- root_ptr = MPZ_REALLOC (root, root_size);
-
- rem_size = mpn_sqrtrem (root_ptr, rem_ptr, op_ptr, op_size);
+ /* Make OP not overlap with ROOT. */
+ if (root_ptr == op_ptr)
+ {
+ /* ROOT and OP are identical. Allocate temporary space for OP. */
+ op_ptr = (mp_ptr) TMP_ALLOC (op_size * BYTES_PER_MP_LIMB);
+ /* Copy to the temporary space. Hack: Avoid temporary variable
+ by using ROOT_PTR. */
+ MPN_COPY (op_ptr, root_ptr, op_size);
+ }
}
- /* Write remainder size last, to make this function give only the square root
- remainder, when passed ROOT == REM. */
- SIZ (rem) = rem_size;
+ rem_size = mpn_sqrtrem (root_ptr, rem->_mp_d, op_ptr, op_size);
+
+ root->_mp_size = root_size;
+
+ /* Write remainder size last, to enable us to define this function to
+ give only the square root remainder, if the user calls if with
+ ROOT == REM. */
+ rem->_mp_size = rem_size;
+
+ if (free_me != NULL)
+ (*__gmp_free_func) (free_me, free_me_size * BYTES_PER_MP_LIMB);
+ TMP_FREE;
}
diff --git a/gmp/mpz/sub.c b/gmp/mpz/sub.c
index 7cb022e069..1b7ac49fd2 100644
--- a/gmp/mpz/sub.c
+++ b/gmp/mpz/sub.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_sub
diff --git a/gmp/mpz/sub_ui.c b/gmp/mpz/sub_ui.c
index 3ce23d3555..d0fe3698c5 100644
--- a/gmp/mpz/sub_ui.c
+++ b/gmp/mpz/sub_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_sub_ui
diff --git a/gmp/mpz/swap.c b/gmp/mpz/swap.c
index 0fc11fb9e1..1fdfcc1100 100644
--- a/gmp/mpz/swap.c
+++ b/gmp/mpz/swap.c
@@ -1,55 +1,44 @@
/* mpz_swap (dest_integer, src_integer) -- Swap U and V.
-Copyright 1997, 1998, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1997, 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_swap (mpz_ptr u, mpz_ptr v) __GMP_NOTHROW
+mpz_swap (mpz_ptr u, mpz_ptr v)
{
mp_ptr up, vp;
mp_size_t usize, vsize;
mp_size_t ualloc, valloc;
- ualloc = ALLOC (u);
- valloc = ALLOC (v);
- ALLOC (v) = ualloc;
- ALLOC (u) = valloc;
+ ualloc = u->_mp_alloc;
+ valloc = v->_mp_alloc;
+ v->_mp_alloc = ualloc;
+ u->_mp_alloc = valloc;
- usize = SIZ (u);
- vsize = SIZ (v);
- SIZ (v) = usize;
- SIZ (u) = vsize;
+ usize = u->_mp_size;
+ vsize = v->_mp_size;
+ v->_mp_size = usize;
+ u->_mp_size = vsize;
- up = PTR (u);
- vp = PTR (v);
- PTR (v) = up;
- PTR (u) = vp;
+ up = u->_mp_d;
+ vp = v->_mp_d;
+ v->_mp_d = up;
+ u->_mp_d = vp;
}
diff --git a/gmp/mpz/tdiv_q.c b/gmp/mpz/tdiv_q.c
index 38528f35bf..75811bc3eb 100644
--- a/gmp/mpz/tdiv_q.c
+++ b/gmp/mpz/tdiv_q.c
@@ -1,33 +1,22 @@
/* mpz_tdiv_q -- divide two integers and produce a quotient.
-Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2005, 2010, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -38,7 +27,7 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
{
mp_size_t ql;
mp_size_t ns, ds, nl, dl;
- mp_ptr np, dp, qp;
+ mp_ptr np, dp, qp, rp;
TMP_DECL;
ns = SIZ (num);
@@ -47,7 +36,7 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
dl = ABS (ds);
ql = nl - dl + 1;
- if (UNLIKELY (dl == 0))
+ if (dl == 0)
DIVIDE_BY_ZERO;
if (ql <= 0)
@@ -56,17 +45,23 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
return;
}
- qp = MPZ_REALLOC (quot, ql);
+ MPZ_REALLOC (quot, ql);
TMP_MARK;
+ qp = PTR (quot);
+ rp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB);
np = PTR (num);
dp = PTR (den);
+ /* FIXME: We should think about how to handle the temporary allocation.
+ Perhaps mpn_tdiv_qr should handle it, since it anyway often needs to
+ allocate temp space. */
+
/* Copy denominator to temporary space if it overlaps with the quotient. */
if (dp == qp)
{
mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (dl);
+ tp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB);
MPN_COPY (tp, dp, dl);
dp = tp;
}
@@ -74,18 +69,13 @@ mpz_tdiv_q (mpz_ptr quot, mpz_srcptr num, mpz_srcptr den)
if (np == qp)
{
mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (nl + 1);
+ tp = (mp_ptr) TMP_ALLOC (nl * BYTES_PER_MP_LIMB);
MPN_COPY (tp, np, nl);
- /* Overlap dividend and scratch. */
- mpn_div_q (qp, tp, nl, dp, dl, tp);
- }
- else
- {
- mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (nl + 1);
- mpn_div_q (qp, np, nl, dp, dl, tp);
+ np = tp;
}
+ mpn_tdiv_qr (qp, rp, 0L, np, nl, dp, dl);
+
ql -= qp[ql - 1] == 0;
SIZ (quot) = (ns ^ ds) >= 0 ? ql : -ql;
diff --git a/gmp/mpz/tdiv_q_2exp.c b/gmp/mpz/tdiv_q_2exp.c
index 9ffcaf2bbb..7f79e1e4ef 100644
--- a/gmp/mpz/tdiv_q_2exp.c
+++ b/gmp/mpz/tdiv_q_2exp.c
@@ -1,68 +1,59 @@
/* mpz_tdiv_q_2exp -- Divide an integer by 2**CNT. Round the quotient
towards -infinity.
-Copyright 1991, 1993, 1994, 1996, 2001, 2002, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_tdiv_q_2exp (mpz_ptr r, mpz_srcptr u, mp_bitcnt_t cnt)
+mpz_tdiv_q_2exp (mpz_ptr w, mpz_srcptr u, unsigned long int cnt)
{
- mp_size_t un, rn;
+ mp_size_t usize, wsize;
mp_size_t limb_cnt;
- mp_ptr rp;
- mp_srcptr up;
- un = SIZ(u);
+ usize = u->_mp_size;
limb_cnt = cnt / GMP_NUMB_BITS;
- rn = ABS (un) - limb_cnt;
-
- if (rn <= 0)
- rn = 0;
+ wsize = ABS (usize) - limb_cnt;
+ if (wsize <= 0)
+ w->_mp_size = 0;
else
{
- rp = MPZ_REALLOC (r, rn);
- up = PTR(u) + limb_cnt;
+ mp_ptr wp;
+ mp_srcptr up;
+
+ if (w->_mp_alloc < wsize)
+ _mpz_realloc (w, wsize);
+
+ wp = w->_mp_d;
+ up = u->_mp_d;
cnt %= GMP_NUMB_BITS;
if (cnt != 0)
{
- mpn_rshift (rp, up, rn, cnt);
- rn -= rp[rn - 1] == 0;
+ mpn_rshift (wp, up + limb_cnt, wsize, cnt);
+ wsize -= wp[wsize - 1] == 0;
}
else
{
- MPN_COPY_INCR (rp, up, rn);
+ MPN_COPY_INCR (wp, up + limb_cnt, wsize);
}
- }
- SIZ(r) = un >= 0 ? rn : -rn;
+ w->_mp_size = usize >= 0 ? wsize : -wsize;
+ }
}
diff --git a/gmp/mpz/tdiv_q_ui.c b/gmp/mpz/tdiv_q_ui.c
index 88e9082529..50abb85f94 100644
--- a/gmp/mpz/tdiv_q_ui.c
+++ b/gmp/mpz/tdiv_q_ui.c
@@ -1,34 +1,23 @@
/* mpz_tdiv_q_ui(quot, dividend, divisor_limb)
-- Divide DIVIDEND by DIVISOR_LIMB and store the result in QUOT.
-Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ mpz_tdiv_q_ui (mpz_ptr quot, mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np, qp;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -51,7 +40,8 @@ mpz_tdiv_q_ui (mpz_ptr quot, mpz_srcptr dividend, unsigned long int divisor)
}
nn = ABS(ns);
- qp = MPZ_REALLOC (quot, nn);
+ MPZ_REALLOC (quot, nn);
+ qp = PTR(quot);
np = PTR(dividend);
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
diff --git a/gmp/mpz/tdiv_qr.c b/gmp/mpz/tdiv_qr.c
index ab9a37dae9..53ddae86f8 100644
--- a/gmp/mpz/tdiv_qr.c
+++ b/gmp/mpz/tdiv_qr.c
@@ -1,41 +1,36 @@
/* mpz_tdiv_qr(quot,rem,dividend,divisor) -- Set QUOT to DIVIDEND/DIVISOR,
and REM to DIVIDEND mod DIVISOR.
-Copyright 1991, 1993, 1994, 2000, 2001, 2005, 2011, 2012 Free Software
-Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
+#ifdef BERKELEY_MP
+#include "mp.h"
+#endif
void
+#ifndef BERKELEY_MP
mpz_tdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
+#else /* BERKELEY_MP */
+mdiv (mpz_srcptr num, mpz_srcptr den, mpz_ptr quot, mpz_ptr rem)
+#endif /* BERKELEY_MP */
{
mp_size_t ql;
mp_size_t ns, ds, nl, dl;
@@ -48,16 +43,18 @@ mpz_tdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
dl = ABS (ds);
ql = nl - dl + 1;
- if (UNLIKELY (dl == 0))
+ if (dl == 0)
DIVIDE_BY_ZERO;
- rp = MPZ_REALLOC (rem, dl);
+ MPZ_REALLOC (rem, dl);
if (ql <= 0)
{
if (num != rem)
{
+ mp_ptr np, rp;
np = PTR (num);
+ rp = PTR (rem);
MPN_COPY (rp, np, nl);
SIZ (rem) = SIZ (num);
}
@@ -67,9 +64,11 @@ mpz_tdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
return;
}
- qp = MPZ_REALLOC (quot, ql);
+ MPZ_REALLOC (quot, ql);
TMP_MARK;
+ qp = PTR (quot);
+ rp = PTR (rem);
np = PTR (num);
dp = PTR (den);
@@ -82,7 +81,7 @@ mpz_tdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
if (dp == rp || dp == qp)
{
mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (dl);
+ tp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB);
MPN_COPY (tp, dp, dl);
dp = tp;
}
@@ -91,7 +90,7 @@ mpz_tdiv_qr (mpz_ptr quot, mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
if (np == rp || np == qp)
{
mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (nl);
+ tp = (mp_ptr) TMP_ALLOC (nl * BYTES_PER_MP_LIMB);
MPN_COPY (tp, np, nl);
np = tp;
}
diff --git a/gmp/mpz/tdiv_qr_ui.c b/gmp/mpz/tdiv_qr_ui.c
index 4f667abe07..4f797b1801 100644
--- a/gmp/mpz/tdiv_qr_ui.c
+++ b/gmp/mpz/tdiv_qr_ui.c
@@ -2,34 +2,23 @@
Set QUOT to DIVIDEND / SHORT_DIVISOR
and REM to DIVIDEND mod SHORT_DIVISOR.
-Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -41,7 +30,7 @@ mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
mp_ptr np, qp;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -53,7 +42,8 @@ mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
}
nn = ABS(ns);
- qp = MPZ_REALLOC (quot, nn);
+ MPZ_REALLOC (quot, nn);
+ qp = PTR(quot);
np = PTR(dividend);
#if BITS_PER_ULONG > GMP_NUMB_BITS /* avoid warnings about shift amount */
@@ -72,7 +62,8 @@ mpz_tdiv_qr_ui (mpz_ptr quot, mpz_ptr rem, mpz_srcptr dividend, unsigned long in
return rl;
}
- rp = MPZ_REALLOC (rem, 2);
+ MPZ_REALLOC (rem, 2);
+ rp = PTR(rem);
dp[0] = divisor & GMP_NUMB_MASK;
dp[1] = divisor >> GMP_NUMB_BITS;
diff --git a/gmp/mpz/tdiv_r.c b/gmp/mpz/tdiv_r.c
index d9cb38c323..8c3a456dfd 100644
--- a/gmp/mpz/tdiv_r.c
+++ b/gmp/mpz/tdiv_r.c
@@ -1,33 +1,21 @@
/* mpz_tdiv_r(rem, dividend, divisor) -- Set REM to DIVIDEND mod DIVISOR.
-Copyright 1991, 1993, 1994, 2000, 2001, 2005, 2012 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -47,16 +35,18 @@ mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
dl = ABS (ds);
ql = nl - dl + 1;
- if (UNLIKELY (dl == 0))
+ if (dl == 0)
DIVIDE_BY_ZERO;
- rp = MPZ_REALLOC (rem, dl);
+ MPZ_REALLOC (rem, dl);
if (ql <= 0)
{
if (num != rem)
{
+ mp_ptr np, rp;
np = PTR (num);
+ rp = PTR (rem);
MPN_COPY (rp, np, nl);
SIZ (rem) = SIZ (num);
}
@@ -64,7 +54,8 @@ mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
}
TMP_MARK;
- qp = TMP_ALLOC_LIMBS (ql);
+ qp = (mp_ptr) TMP_ALLOC (ql * BYTES_PER_MP_LIMB);
+ rp = PTR (rem);
np = PTR (num);
dp = PTR (den);
@@ -76,7 +67,7 @@ mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
if (dp == rp)
{
mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (dl);
+ tp = (mp_ptr) TMP_ALLOC (dl * BYTES_PER_MP_LIMB);
MPN_COPY (tp, dp, dl);
dp = tp;
}
@@ -84,7 +75,7 @@ mpz_tdiv_r (mpz_ptr rem, mpz_srcptr num, mpz_srcptr den)
if (np == rp)
{
mp_ptr tp;
- tp = TMP_ALLOC_LIMBS (nl);
+ tp = (mp_ptr) TMP_ALLOC (nl * BYTES_PER_MP_LIMB);
MPN_COPY (tp, np, nl);
np = tp;
}
diff --git a/gmp/mpz/tdiv_r_2exp.c b/gmp/mpz/tdiv_r_2exp.c
index e21d90fecd..951b75d419 100644
--- a/gmp/mpz/tdiv_r_2exp.c
+++ b/gmp/mpz/tdiv_r_2exp.c
@@ -1,43 +1,32 @@
-/* mpz_tdiv_r_2exp -- Divide an integer by 2**CNT and produce a remainder.
+/* mpz_tdiv_r_2exp -- Divide a integer by 2**CNT and produce a remainder.
-Copyright 1991, 1993-1995, 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_tdiv_r_2exp (mpz_ptr res, mpz_srcptr in, mp_bitcnt_t cnt)
+mpz_tdiv_r_2exp (mpz_ptr res, mpz_srcptr in, unsigned long int cnt)
{
- mp_size_t in_size = ABSIZ (in);
+ mp_size_t in_size = ABS (in->_mp_size);
mp_size_t res_size;
mp_size_t limb_cnt = cnt / GMP_NUMB_BITS;
- mp_srcptr in_ptr = PTR (in);
+ mp_srcptr in_ptr = in->_mp_d;
if (in_size > limb_cnt)
{
@@ -48,16 +37,18 @@ mpz_tdiv_r_2exp (mpz_ptr res, mpz_srcptr in, mp_bitcnt_t cnt)
if (x != 0)
{
res_size = limb_cnt + 1;
- MPZ_REALLOC (res, res_size);
+ if (res->_mp_alloc < res_size)
+ _mpz_realloc (res, res_size);
- PTR (res)[limb_cnt] = x;
+ res->_mp_d[limb_cnt] = x;
}
else
{
res_size = limb_cnt;
MPN_NORMALIZE (in_ptr, res_size);
- MPZ_REALLOC (res, res_size);
+ if (res->_mp_alloc < res_size)
+ _mpz_realloc (res, res_size);
limb_cnt = res_size;
}
@@ -67,12 +58,13 @@ mpz_tdiv_r_2exp (mpz_ptr res, mpz_srcptr in, mp_bitcnt_t cnt)
/* The input operand is smaller than 2**CNT. We perform a no-op,
apart from that we might need to copy IN to RES. */
res_size = in_size;
- MPZ_REALLOC (res, res_size);
+ if (res->_mp_alloc < res_size)
+ _mpz_realloc (res, res_size);
limb_cnt = res_size;
}
if (res != in)
- MPN_COPY (PTR (res), PTR (in), limb_cnt);
- SIZ (res) = SIZ (in) >= 0 ? res_size : -res_size;
+ MPN_COPY (res->_mp_d, in->_mp_d, limb_cnt);
+ res->_mp_size = in->_mp_size >= 0 ? res_size : -res_size;
}
diff --git a/gmp/mpz/tdiv_r_ui.c b/gmp/mpz/tdiv_r_ui.c
index 30addd6db7..64a8b94d15 100644
--- a/gmp/mpz/tdiv_r_ui.c
+++ b/gmp/mpz/tdiv_r_ui.c
@@ -1,34 +1,23 @@
/* mpz_tdiv_r_ui(rem, dividend, divisor_limb)
-- Set REM to DIVDEND mod DIVISOR_LIMB.
-Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2005, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1998, 2001, 2002, 2004, 2005 Free Software
+Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ mpz_tdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
@@ -68,7 +57,8 @@ mpz_tdiv_r_ui (mpz_ptr rem, mpz_srcptr dividend, unsigned long int divisor)
return rl;
}
- rp = MPZ_REALLOC (rem, 2);
+ MPZ_REALLOC (rem, 2);
+ rp = PTR(rem);
TMP_MARK;
dp[0] = divisor & GMP_NUMB_MASK;
diff --git a/gmp/mpz/tdiv_ui.c b/gmp/mpz/tdiv_ui.c
index 328d67fdf8..fafd97ee0b 100644
--- a/gmp/mpz/tdiv_ui.c
+++ b/gmp/mpz/tdiv_ui.c
@@ -1,33 +1,22 @@
/* mpz_tdiv_ui(dividend, divisor_limb) -- Return DIVDEND mod DIVISOR_LIMB.
-Copyright 1991, 1993, 1994, 1996-1998, 2001, 2002, 2004, 2005, 2012 Free
+Copyright 1991, 1993, 1994, 1996, 1997, 1998, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -40,7 +29,7 @@ mpz_tdiv_ui (mpz_srcptr dividend, unsigned long int divisor)
mp_ptr np;
mp_limb_t rl;
- if (UNLIKELY (divisor == 0))
+ if (divisor == 0)
DIVIDE_BY_ZERO;
ns = SIZ(dividend);
diff --git a/gmp/mpz/tstbit.c b/gmp/mpz/tstbit.c
index db3d75a64f..37f1454a60 100644
--- a/gmp/mpz/tstbit.c
+++ b/gmp/mpz/tstbit.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -49,12 +38,12 @@ see https://www.gnu.org/licenses/. */
the limb_index >= abs_size test covers u=0 too. */
int
-mpz_tstbit (mpz_srcptr u, mp_bitcnt_t bit_index) __GMP_NOTHROW
+mpz_tstbit (mpz_srcptr u, unsigned long bit_index)
{
mp_srcptr u_ptr = PTR(u);
mp_size_t size = SIZ(u);
unsigned abs_size = ABS(size);
- mp_size_t limb_index = bit_index / GMP_NUMB_BITS;
+ unsigned long limb_index = bit_index / GMP_NUMB_BITS;
mp_srcptr p = u_ptr + limb_index;
mp_limb_t limb;
@@ -67,14 +56,14 @@ mpz_tstbit (mpz_srcptr u, mp_bitcnt_t bit_index) __GMP_NOTHROW
limb = -limb; /* twos complement */
while (p != u_ptr)
- {
- p--;
- if (*p != 0)
- {
- limb--; /* make it a ones complement instead */
- break;
- }
- }
+ {
+ p--;
+ if (*p != 0)
+ {
+ limb--; /* make it a ones complement instead */
+ break;
+ }
+ }
}
return (limb >> (bit_index % GMP_NUMB_BITS)) & 1;
diff --git a/gmp/mpz/ui_pow_ui.c b/gmp/mpz/ui_pow_ui.c
index a4f23c5655..4a0f7bd58f 100644
--- a/gmp/mpz/ui_pow_ui.c
+++ b/gmp/mpz/ui_pow_ui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpz/ui_sub.c b/gmp/mpz/ui_sub.c
index 579a300795..76d4b82308 100644
--- a/gmp/mpz/ui_sub.c
+++ b/gmp/mpz/ui_sub.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/mpz/urandomb.c b/gmp/mpz/urandomb.c
index f1295699b3..3072cd40f9 100644
--- a/gmp/mpz/urandomb.c
+++ b/gmp/mpz/urandomb.c
@@ -7,40 +7,29 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
void
-mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, mp_bitcnt_t nbits)
+mpz_urandomb (mpz_ptr rop, gmp_randstate_t rstate, unsigned long int nbits)
{
mp_ptr rp;
mp_size_t size;
size = BITS_TO_LIMBS (nbits);
- rp = MPZ_NEWALLOC (rop, size);
+ rp = MPZ_REALLOC (rop, size);
_gmp_rand (rp, rstate, nbits);
MPN_NORMALIZE (rp, size);
diff --git a/gmp/mpz/urandomm.c b/gmp/mpz/urandomm.c
index 434359cdd7..b8a6d6898c 100644
--- a/gmp/mpz/urandomm.c
+++ b/gmp/mpz/urandomm.c
@@ -2,33 +2,22 @@
integer in the range 0 to N-1, using STATE as the random state
previously initialized by a call to gmp_randinit().
-Copyright 2000, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2000, 2002 Free Software Foundation, Inc.
This file is part 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.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -48,7 +37,7 @@ mpz_urandomm (mpz_ptr rop, gmp_randstate_t rstate, mpz_srcptr n)
TMP_DECL;
size = ABSIZ (n);
- if (UNLIKELY (size == 0))
+ if (size == 0)
DIVIDE_BY_ZERO;
nlast = &PTR (n)[size - 1];
diff --git a/gmp/mpz/xor.c b/gmp/mpz/xor.c
index cd701000d5..18edd8129e 100644
--- a/gmp/mpz/xor.c
+++ b/gmp/mpz/xor.c
@@ -1,33 +1,22 @@
/* mpz_xor -- Logical xor.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2005, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 1997, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -39,6 +28,7 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
mp_size_t op1_size, op2_size;
mp_ptr res_ptr;
mp_size_t res_size, res_alloc;
+ mp_size_t i;
TMP_DECL;
TMP_MARK;
@@ -66,8 +56,8 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
if (res_ptr != op1_ptr)
MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
op1_size - op2_size);
- if (LIKELY (op2_size != 0))
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op2_size);
+ for (i = op2_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] ^ op2_ptr[i];
res_size = op1_size;
}
else
@@ -83,8 +73,8 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
if (res_ptr != op2_ptr)
MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
op2_size - op1_size);
- if (LIKELY (op1_size != 0))
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
+ for (i = op1_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] ^ op2_ptr[i];
res_size = op2_size;
}
@@ -101,7 +91,7 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
if (op2_size < 0)
{
- mp_ptr opx, opy;
+ mp_ptr opx;
/* Both operands are negative, the result will be positive.
(-OP1) ^ (-OP2) =
@@ -113,23 +103,38 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
/* Possible optimization: Decrease mpn_sub precision,
as we won't use the entire res of both. */
- TMP_ALLOC_LIMBS_2 (opx, op1_size, opy, op2_size);
+ opx = TMP_ALLOC_LIMBS (op1_size);
mpn_sub_1 (opx, op1_ptr, op1_size, (mp_limb_t) 1);
op1_ptr = opx;
- mpn_sub_1 (opy, op2_ptr, op2_size, (mp_limb_t) 1);
- op2_ptr = opy;
+ opx = TMP_ALLOC_LIMBS (op2_size);
+ mpn_sub_1 (opx, op2_ptr, op2_size, (mp_limb_t) 1);
+ op2_ptr = opx;
- if (op1_size > op2_size)
- MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
-
- res_alloc = op2_size;
- res_ptr = MPZ_REALLOC (res, res_alloc);
+ res_alloc = MAX (op1_size, op2_size);
+ if (ALLOC(res) < res_alloc)
+ {
+ _mpz_realloc (res, res_alloc);
+ res_ptr = PTR(res);
+ /* op1_ptr and op2_ptr point to temporary space. */
+ }
- MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
- op2_size - op1_size);
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
- res_size = op2_size;
+ if (op1_size > op2_size)
+ {
+ MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size,
+ op1_size - op2_size);
+ for (i = op2_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] ^ op2_ptr[i];
+ res_size = op1_size;
+ }
+ else
+ {
+ MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size,
+ op2_size - op1_size);
+ for (i = op1_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] ^ op2_ptr[i];
+ res_size = op2_size;
+ }
MPN_NORMALIZE (res_ptr, res_size);
SIZ(res) = res_size;
@@ -140,8 +145,8 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
{
/* We should compute -OP1 ^ OP2. Swap OP1 and OP2 and fall
through to the code that handles OP1 ^ -OP2. */
- MPZ_SRCPTR_SWAP (op1, op2);
- MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
+ MPZ_SRCPTR_SWAP (op1, op2);
+ MPN_SRCPTR_SWAP (op1_ptr,op1_size, op2_ptr,op2_size);
}
}
@@ -172,20 +177,24 @@ mpz_xor (mpz_ptr res, mpz_srcptr op1, mpz_srcptr op2)
if (op1_size > op2_size)
{
MPN_COPY (res_ptr + op2_size, op1_ptr + op2_size, op1_size - op2_size);
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op2_size);
+ for (i = op2_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] ^ op2_ptr[i];
res_size = op1_size;
}
else
{
MPN_COPY (res_ptr + op1_size, op2_ptr + op1_size, op2_size - op1_size);
- if (LIKELY (op1_size != 0))
- mpn_xor_n (res_ptr, op1_ptr, op2_ptr, op1_size);
+ for (i = op1_size - 1; i >= 0; i--)
+ res_ptr[i] = op1_ptr[i] ^ op2_ptr[i];
res_size = op2_size;
}
cy = mpn_add_1 (res_ptr, res_ptr, res_size, (mp_limb_t) 1);
- res_ptr[res_size] = cy;
- res_size += (cy != 0);
+ if (cy)
+ {
+ res_ptr[res_size] = cy;
+ res_size++;
+ }
MPN_NORMALIZE (res_ptr, res_size);
SIZ(res) = -res_size;
diff --git a/gmp/nextprime.c b/gmp/nextprime.c
deleted file mode 100644
index dd9ded5873..0000000000
--- a/gmp/nextprime.c
+++ /dev/null
@@ -1,167 +0,0 @@
-/* gmp_nextprime -- generate small primes reasonably efficiently for internal
- GMP needs.
-
- Contributed to the GNU project by Torbjorn Granlund. Miscellaneous
- improvements by Martin Boij.
-
- 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 Free Software Foundation, Inc.
-
-This file is part 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/. */
-
-/*
- Optimisation ideas:
-
- 1. Unroll the sieving loops. Should reach 1 write/cycle. That would be a 2x
- improvement.
-
- 2. Separate sieving with primes p < SIEVESIZE and p >= SIEVESIZE. The latter
- will need at most one write, and thus not need any inner loop.
-
- 3. For primes p >= SIEVESIZE, i.e., typically the majority of primes, we
- perform more than one division per sieving write. That might dominate the
- entire run time for the nextprime function. A incrementally initialised
- remainder table of Pi(65536) = 6542 16-bit entries could replace that
- division.
-*/
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include <string.h> /* for memset */
-
-
-unsigned long int
-gmp_nextprime (gmp_primesieve_t *ps)
-{
- unsigned long p, d, pi;
- unsigned char *sp;
- static unsigned char addtab[] =
- { 2,4,2,4,6,2,6,4,2,4,6,6,2,6,4,2,6,4,6,8,4,2,4,2,4,8,6,4,6,2,4,6,2,6,6,4,
- 2,4,6,2,6,4,2,4,2,10,2,10 };
- unsigned char *addp = addtab;
- unsigned long ai;
-
- /* Look for already sieved primes. A sentinel at the end of the sieving
- area allows us to use a very simple loop here. */
- d = ps->d;
- sp = ps->s + d;
- while (*sp != 0)
- sp++;
- if (sp != ps->s + SIEVESIZE)
- {
- d = sp - ps->s;
- ps->d = d + 1;
- return ps->s0 + 2 * d;
- }
-
- /* Handle the number 2 separately. */
- if (ps->s0 < 3)
- {
- ps->s0 = 3 - 2 * SIEVESIZE; /* Tricky */
- return 2;
- }
-
- /* Exhausted computed primes. Resieve, then call ourselves recursively. */
-
-#if 0
- for (sp = ps->s; sp < ps->s + SIEVESIZE; sp++)
- *sp = 0;
-#else
- memset (ps->s, 0, SIEVESIZE);
-#endif
-
- ps->s0 += 2 * SIEVESIZE;
-
- /* Update sqrt_s0 as needed. */
- while ((ps->sqrt_s0 + 1) * (ps->sqrt_s0 + 1) <= ps->s0 + 2 * SIEVESIZE - 1)
- ps->sqrt_s0++;
-
- pi = ((ps->s0 + 3) / 2) % 3;
- if (pi > 0)
- pi = 3 - pi;
- if (ps->s0 + 2 * pi <= 3)
- pi += 3;
- sp = ps->s + pi;
- while (sp < ps->s + SIEVESIZE)
- {
- *sp = 1, sp += 3;
- }
-
- pi = ((ps->s0 + 5) / 2) % 5;
- if (pi > 0)
- pi = 5 - pi;
- if (ps->s0 + 2 * pi <= 5)
- pi += 5;
- sp = ps->s + pi;
- while (sp < ps->s + SIEVESIZE)
- {
- *sp = 1, sp += 5;
- }
-
- pi = ((ps->s0 + 7) / 2) % 7;
- if (pi > 0)
- pi = 7 - pi;
- if (ps->s0 + 2 * pi <= 7)
- pi += 7;
- sp = ps->s + pi;
- while (sp < ps->s + SIEVESIZE)
- {
- *sp = 1, sp += 7;
- }
-
- p = 11;
- ai = 0;
- while (p <= ps->sqrt_s0)
- {
- pi = ((ps->s0 + p) / 2) % p;
- if (pi > 0)
- pi = p - pi;
- if (ps->s0 + 2 * pi <= p)
- pi += p;
- sp = ps->s + pi;
- while (sp < ps->s + SIEVESIZE)
- {
- *sp = 1, sp += p;
- }
- p += addp[ai];
- ai = (ai + 1) % 48;
- }
- ps->d = 0;
- return gmp_nextprime (ps);
-}
-
-void
-gmp_init_primesieve (gmp_primesieve_t *ps)
-{
- ps->s0 = 0;
- ps->sqrt_s0 = 0;
- ps->d = SIEVESIZE;
- ps->s[SIEVESIZE] = 0; /* sentinel */
-}
diff --git a/gmp/primesieve.c b/gmp/primesieve.c
deleted file mode 100644
index 569e4cecea..0000000000
--- a/gmp/primesieve.c
+++ /dev/null
@@ -1,295 +0,0 @@
-/* primesieve (BIT_ARRAY, N) -- Fills the BIT_ARRAY with a mask for primes up to N.
-
-Contributed to the GNU project by 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 GUARANTEED THAT IT WILL CHANGE OR
-DISAPPEAR IN A FUTURE GNU MP RELEASE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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"
-
-/**************************************************************/
-/* Section macros: common macros, for mswing/fac/bin (&sieve) */
-/**************************************************************/
-
-#define LOOP_ON_SIEVE_CONTINUE(prime,end,sieve) \
- __max_i = (end); \
- \
- do { \
- ++__i; \
- if (((sieve)[__index] & __mask) == 0) \
- { \
- (prime) = id_to_n(__i)
-
-#define LOOP_ON_SIEVE_BEGIN(prime,start,end,off,sieve) \
- do { \
- mp_limb_t __mask, __index, __max_i, __i; \
- \
- __i = (start)-(off); \
- __index = __i / GMP_LIMB_BITS; \
- __mask = CNST_LIMB(1) << (__i % GMP_LIMB_BITS); \
- __i += (off); \
- \
- LOOP_ON_SIEVE_CONTINUE(prime,end,sieve)
-
-#define LOOP_ON_SIEVE_STOP \
- } \
- __mask = __mask << 1 | __mask >> (GMP_LIMB_BITS-1); \
- __index += __mask & 1; \
- } while (__i <= __max_i) \
-
-#define LOOP_ON_SIEVE_END \
- LOOP_ON_SIEVE_STOP; \
- } while (0)
-
-/*********************************************************/
-/* Section sieve: sieving functions and tools for primes */
-/*********************************************************/
-
-#if 0
-static mp_limb_t
-bit_to_n (mp_limb_t bit) { return (bit*3+4)|1; }
-#endif
-
-/* id_to_n (x) = bit_to_n (x-1) = (id*3+1)|1*/
-static mp_limb_t
-id_to_n (mp_limb_t id) { return id*3+1+(id&1); }
-
-/* n_to_bit (n) = ((n-1)&(-CNST_LIMB(2)))/3U-1 */
-static mp_limb_t
-n_to_bit (mp_limb_t n) { return ((n-5)|1)/3U; }
-
-#if 0
-static mp_size_t
-primesieve_size (mp_limb_t n) { return n_to_bit(n) / GMP_LIMB_BITS + 1; }
-#endif
-
-#if GMP_LIMB_BITS > 61
-#define SIEVE_SEED CNST_LIMB(0x3294C9E069128480)
-#define SEED_LIMIT 202
-#else
-#if GMP_LIMB_BITS > 30
-#define SIEVE_SEED CNST_LIMB(0x69128480)
-#define SEED_LIMIT 114
-#else
-#if GMP_LIMB_BITS > 15
-#define SIEVE_SEED CNST_LIMB(0x8480)
-#define SEED_LIMIT 54
-#else
-#if GMP_LIMB_BITS > 7
-#define SIEVE_SEED CNST_LIMB(0x80)
-#define SEED_LIMIT 34
-#else
-#define SIEVE_SEED CNST_LIMB(0x0)
-#define SEED_LIMIT 24
-#endif /* 7 */
-#endif /* 15 */
-#endif /* 30 */
-#endif /* 61 */
-
-static void
-first_block_primesieve (mp_ptr bit_array, mp_limb_t n)
-{
- mp_size_t bits, limbs;
-
- ASSERT (n > 4);
-
- bits = n_to_bit(n);
- limbs = bits / GMP_LIMB_BITS + 1;
-
- /* FIXME: We can skip 5 too, filling with a 5-part pattern. */
- MPN_ZERO (bit_array, limbs);
- bit_array[0] = SIEVE_SEED;
-
- if ((bits + 1) % GMP_LIMB_BITS != 0)
- bit_array[limbs-1] |= MP_LIMB_T_MAX << ((bits + 1) % GMP_LIMB_BITS);
-
- if (n > SEED_LIMIT) {
- mp_limb_t mask, index, i;
-
- ASSERT (n > 49);
-
- mask = 1;
- index = 0;
- i = 1;
- do {
- if ((bit_array[index] & mask) == 0)
- {
- mp_size_t step, lindex;
- mp_limb_t lmask;
- unsigned maskrot;
-
- step = id_to_n(i);
-/* lindex = n_to_bit(id_to_n(i)*id_to_n(i)); */
- lindex = i*(step+1)-1+(-(i&1)&(i+1));
-/* lindex = i*(step+1+(i&1))-1+(i&1); */
- if (lindex > bits)
- break;
-
- step <<= 1;
- maskrot = step % GMP_LIMB_BITS;
-
- lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
- do {
- bit_array[lindex / GMP_LIMB_BITS] |= lmask;
- lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
- lindex += step;
- } while (lindex <= bits);
-
-/* lindex = n_to_bit(id_to_n(i)*bit_to_n(i)); */
- lindex = i*(i*3+6)+(i&1);
-
- lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
- for ( ; lindex <= bits; lindex += step) {
- bit_array[lindex / GMP_LIMB_BITS] |= lmask;
- lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
- };
- }
- mask = mask << 1 | mask >> (GMP_LIMB_BITS-1);
- index += mask & 1;
- i++;
- } while (1);
- }
-}
-
-static void
-block_resieve (mp_ptr bit_array, mp_size_t limbs, mp_limb_t offset,
- mp_srcptr sieve, mp_limb_t sieve_bits)
-{
- mp_size_t bits, step;
-
- ASSERT (limbs > 0);
-
- bits = limbs * GMP_LIMB_BITS - 1;
-
- /* FIXME: We can skip 5 too, filling with a 5-part pattern. */
- MPN_ZERO (bit_array, limbs);
-
- LOOP_ON_SIEVE_BEGIN(step,0,sieve_bits,0,sieve);
- {
- mp_size_t lindex;
- mp_limb_t lmask;
- unsigned maskrot;
-
-/* lindex = n_to_bit(id_to_n(i)*id_to_n(i)); */
- lindex = __i*(step+1)-1+(-(__i&1)&(__i+1));
-/* lindex = __i*(step+1+(__i&1))-1+(__i&1); */
- if (lindex > bits + offset)
- break;
-
- step <<= 1;
- maskrot = step % GMP_LIMB_BITS;
-
- if (lindex < offset)
- lindex += step * ((offset - lindex - 1) / step + 1);
-
- lindex -= offset;
-
- lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
- for ( ; lindex <= bits; lindex += step) {
- bit_array[lindex / GMP_LIMB_BITS] |= lmask;
- lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
- };
-
-/* lindex = n_to_bit(id_to_n(i)*bit_to_n(i)); */
- lindex = __i*(__i*3+6)+(__i&1);
- if (lindex > bits + offset)
- continue;
-
- if (lindex < offset)
- lindex += step * ((offset - lindex - 1) / step + 1);
-
- lindex -= offset;
-
- lmask = CNST_LIMB(1) << (lindex % GMP_LIMB_BITS);
- for ( ; lindex <= bits; lindex += step) {
- bit_array[lindex / GMP_LIMB_BITS] |= lmask;
- lmask = lmask << maskrot | lmask >> (GMP_LIMB_BITS - maskrot);
- };
- }
- LOOP_ON_SIEVE_END;
-}
-
-#define BLOCK_SIZE 2048
-
-/* Fills bit_array with the characteristic function of composite
- numbers up to the parameter n. I.e. a bit set to "1" represent a
- composite, a "0" represent a prime.
-
- The primesieve_size(n) limbs pointed to by bit_array are
- overwritten. The returned value counts prime integers in the
- interval [4, n]. Note that n > 4.
-
- Even numbers and multiples of 3 are excluded "a priori", only
- numbers equivalent to +/- 1 mod 6 have their bit in the array.
-
- Once sieved, if the bit b is ZERO it represent a prime, the
- represented prime is bit_to_n(b), if the LSbit is bit 0, or
- id_to_n(b), if you call "1" the first bit.
- */
-
-mp_limb_t
-gmp_primesieve (mp_ptr bit_array, mp_limb_t n)
-{
- mp_size_t size;
- mp_limb_t bits;
-
- ASSERT (n > 4);
-
- bits = n_to_bit(n);
- size = bits / GMP_LIMB_BITS + 1;
-
- if (size > BLOCK_SIZE * 2) {
- mp_size_t off;
- off = BLOCK_SIZE + (size % BLOCK_SIZE);
- first_block_primesieve (bit_array, id_to_n (off * GMP_LIMB_BITS));
- for ( ; off < size; off += BLOCK_SIZE)
- block_resieve (bit_array + off, BLOCK_SIZE, off * GMP_LIMB_BITS, bit_array, off * GMP_LIMB_BITS - 1);
- } else {
- first_block_primesieve (bit_array, n);
- }
-
- if ((bits + 1) % GMP_LIMB_BITS != 0)
- bit_array[size-1] |= MP_LIMB_T_MAX << ((bits + 1) % GMP_LIMB_BITS);
-
-
- return size * GMP_LIMB_BITS - mpn_popcount (bit_array, size);
-}
-
-#undef BLOCK_SIZE
-#undef SEED_LIMIT
-#undef SIEVE_SEED
-#undef LOOP_ON_SIEVE_END
-#undef LOOP_ON_SIEVE_STOP
-#undef LOOP_ON_SIEVE_BEGIN
-#undef LOOP_ON_SIEVE_CONTINUE
diff --git a/gmp/printf/Makefile.am b/gmp/printf/Makefile.am
index c8e3c78c6c..c4aead79be 100644
--- a/gmp/printf/Makefile.am
+++ b/gmp/printf/Makefile.am
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
diff --git a/gmp/printf/Makefile.in b/gmp/printf/Makefile.in
index ff4bdfb37c..4bb96dcd32 100644
--- a/gmp/printf/Makefile.in
+++ b/gmp/printf/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -17,55 +16,32 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libprintf_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -77,47 +53,40 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
subdir = printf
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libprintf_la_LIBADD =
-am_libprintf_la_OBJECTS = asprintf.lo asprntffuns.lo doprnt.lo \
- doprntf.lo doprnti.lo fprintf.lo obprintf.lo obvprintf.lo \
- obprntffuns.lo printf.lo printffuns.lo snprintf.lo \
- snprntffuns.lo sprintf.lo sprintffuns.lo vasprintf.lo \
- vfprintf.lo vprintf.lo vsnprintf.lo vsprintf.lo \
- repl-vsnprintf.lo
+am_libprintf_la_OBJECTS = asprintf$U.lo asprntffuns$U.lo doprnt$U.lo \
+ doprntf$U.lo doprnti$U.lo fprintf$U.lo obprintf$U.lo \
+ obvprintf$U.lo obprntffuns$U.lo printf$U.lo printffuns$U.lo \
+ snprintf$U.lo snprntffuns$U.lo sprintf$U.lo sprintffuns$U.lo \
+ vasprintf$U.lo vfprintf$U.lo vprintf$U.lo vsnprintf$U.lo \
+ vsprintf$U.lo repl-vsnprintf$U.lo
libprintf_la_OBJECTS = $(am_libprintf_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libprintf_la_SOURCES)
DIST_SOURCES = $(libprintf_la_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -131,6 +100,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -146,17 +116,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -170,12 +139,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -190,26 +157,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -219,31 +180,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -267,6 +223,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -274,12 +231,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libprintf.la
libprintf_la_SOURCES = \
@@ -297,14 +250,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps printf/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps printf/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps printf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps printf/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -322,24 +275,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libprintf.la: $(libprintf_la_OBJECTS) $(libprintf_la_DEPENDENCIES) $(EXTRA_libprintf_la_DEPENDENCIES)
- $(LINK) $(libprintf_la_OBJECTS) $(libprintf_la_LIBADD) $(LIBS)
+libprintf.la: $(libprintf_la_OBJECTS) $(libprintf_la_DEPENDENCIES)
+ $(LINK) $(libprintf_la_LDFLAGS) $(libprintf_la_OBJECTS) $(libprintf_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -349,6 +306,60 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+asprintf_.c: asprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/asprintf.c; then echo $(srcdir)/asprintf.c; else echo asprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+asprntffuns_.c: asprntffuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/asprntffuns.c; then echo $(srcdir)/asprntffuns.c; else echo asprntffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+doprnt_.c: doprnt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doprnt.c; then echo $(srcdir)/doprnt.c; else echo doprnt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+doprntf_.c: doprntf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doprntf.c; then echo $(srcdir)/doprntf.c; else echo doprntf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+doprnti_.c: doprnti.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doprnti.c; then echo $(srcdir)/doprnti.c; else echo doprnti.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fprintf_.c: fprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fprintf.c; then echo $(srcdir)/fprintf.c; else echo fprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+obprintf_.c: obprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obprintf.c; then echo $(srcdir)/obprintf.c; else echo obprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+obprntffuns_.c: obprntffuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obprntffuns.c; then echo $(srcdir)/obprntffuns.c; else echo obprntffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+obvprintf_.c: obvprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/obvprintf.c; then echo $(srcdir)/obvprintf.c; else echo obvprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+printf_.c: printf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/printf.c; then echo $(srcdir)/printf.c; else echo printf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+printffuns_.c: printffuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/printffuns.c; then echo $(srcdir)/printffuns.c; else echo printffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+repl-vsnprintf_.c: repl-vsnprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/repl-vsnprintf.c; then echo $(srcdir)/repl-vsnprintf.c; else echo repl-vsnprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+snprintf_.c: snprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/snprintf.c; then echo $(srcdir)/snprintf.c; else echo snprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+snprntffuns_.c: snprntffuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/snprntffuns.c; then echo $(srcdir)/snprntffuns.c; else echo snprntffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sprintf_.c: sprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sprintf.c; then echo $(srcdir)/sprintf.c; else echo sprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sprintffuns_.c: sprintffuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sprintffuns.c; then echo $(srcdir)/sprintffuns.c; else echo sprintffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vasprintf_.c: vasprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vasprintf.c; then echo $(srcdir)/vasprintf.c; else echo vasprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vfprintf_.c: vfprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vfprintf.c; then echo $(srcdir)/vfprintf.c; else echo vfprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vprintf_.c: vprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vprintf.c; then echo $(srcdir)/vprintf.c; else echo vprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vsnprintf_.c: vsnprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vsnprintf.c; then echo $(srcdir)/vsnprintf.c; else echo vsnprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vsprintf_.c: vsprintf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vsprintf.c; then echo $(srcdir)/vsprintf.c; else echo vsprintf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+asprintf_.$(OBJEXT) asprintf_.lo asprntffuns_.$(OBJEXT) \
+asprntffuns_.lo doprnt_.$(OBJEXT) doprnt_.lo doprntf_.$(OBJEXT) \
+doprntf_.lo doprnti_.$(OBJEXT) doprnti_.lo fprintf_.$(OBJEXT) \
+fprintf_.lo obprintf_.$(OBJEXT) obprintf_.lo obprntffuns_.$(OBJEXT) \
+obprntffuns_.lo obvprintf_.$(OBJEXT) obvprintf_.lo printf_.$(OBJEXT) \
+printf_.lo printffuns_.$(OBJEXT) printffuns_.lo \
+repl-vsnprintf_.$(OBJEXT) repl-vsnprintf_.lo snprintf_.$(OBJEXT) \
+snprintf_.lo snprntffuns_.$(OBJEXT) snprntffuns_.lo sprintf_.$(OBJEXT) \
+sprintf_.lo sprintffuns_.$(OBJEXT) sprintffuns_.lo \
+vasprintf_.$(OBJEXT) vasprintf_.lo vfprintf_.$(OBJEXT) vfprintf_.lo \
+vprintf_.$(OBJEXT) vprintf_.lo vsnprintf_.$(OBJEXT) vsnprintf_.lo \
+vsprintf_.$(OBJEXT) vsprintf_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -356,85 +367,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -452,22 +460,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -480,7 +482,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -488,38 +490,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -528,7 +510,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -539,23 +521,19 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/gmp/printf/asprintf.c b/gmp/printf/asprintf.c
index b35d9b10c8..e2edef6ee4 100644
--- a/gmp/printf/asprintf.c
+++ b/gmp/printf/asprintf.c
@@ -5,42 +5,50 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "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);
diff --git a/gmp/printf/asprntffuns.c b/gmp/printf/asprntffuns.c
index c141b7a99e..1a2b9e1e14 100644
--- a/gmp/printf/asprntffuns.c
+++ b/gmp/printf/asprntffuns.c
@@ -5,35 +5,31 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://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>
diff --git a/gmp/printf/doprnt.c b/gmp/printf/doprnt.c
index 5220feee20..c1ee0a2ae2 100644
--- a/gmp/printf/doprnt.c
+++ b/gmp/printf/doprnt.c
@@ -4,39 +4,33 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 _GNU_SOURCE /* for DECIMAL_POINT in glibc langinfo.h */
-#include "config.h" /* needed for the HAVE_, could also move gmp incls */
+#include "config.h"
+#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>
@@ -100,7 +94,7 @@ see https://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.
- Apparently GLIBC allows "L" for long long though. This doesn't affect
+ Apparentely 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.
@@ -188,7 +182,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;
- memcpy (fmt, orig_fmt, alloc_fmt_size);
+ strcpy (fmt, orig_fmt);
/* last_fmt and last_ap are just after the last output, and hence where
the next output will begin, when that's done */
diff --git a/gmp/printf/doprntf.c b/gmp/printf/doprntf.c
index c501e8d06b..0bd4ea800f 100644
--- a/gmp/printf/doprntf.c
+++ b/gmp/printf/doprntf.c
@@ -4,35 +4,31 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001, 2002, 2011 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "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>
@@ -40,7 +36,6 @@ see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
-#include "longlong.h"
/* change this to "#define TRACE(x) x" for diagnostics */
@@ -67,7 +62,7 @@ __gmp_doprnt_mpf (const struct doprnt_funs_t *funs,
int fraczeros, fraclen, preczeros;
char *s, *free_ptr;
mp_exp_t exp;
- char exponent[GMP_LIMB_BITS + 10];
+ char exponent[BITS_PER_MP_LIMB + 10];
const char *showbase;
int retval = 0;
@@ -94,11 +89,9 @@ __gmp_doprnt_mpf (const struct doprnt_funs_t *funs,
overestimate the integer part, and add prec. If f<1 then
underestimate the zeros between the radix point and the first
digit and subtract that from prec. In either case add 2 so the
- round to nearest can be applied accurately. Finally, we add 1 to
- handle the case of 1-eps where EXP(f) = 0 but mpf_get_str returns
- exp as 1. */
- ndigits = prec + 2 + 1
- + EXP(f) * (mp_bases[ABS(p->base)].chars_per_limb + (EXP(f)>=0));
+ round to nearest can be applied accurately. */
+ ndigits = prec + 2
+ + EXP(f) * (__mp_bases[ABS(p->base)].chars_per_limb + (EXP(f)>=0));
ndigits = MAX (ndigits, 1);
break;
diff --git a/gmp/printf/doprnti.c b/gmp/printf/doprnti.c
index c4cb9c8da8..df474df3e2 100644
--- a/gmp/printf/doprnti.c
+++ b/gmp/printf/doprnti.c
@@ -9,30 +9,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 <string.h>
#include <stdio.h>
#include <stdlib.h>
diff --git a/gmp/printf/fprintf.c b/gmp/printf/fprintf.c
index 2d8187d7cf..dba30b90fc 100644
--- a/gmp/printf/fprintf.c
+++ b/gmp/printf/fprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
@@ -36,12 +32,25 @@ see https://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);
diff --git a/gmp/printf/obprintf.c b/gmp/printf/obprintf.c
index fbf3ea768f..51ad703b38 100644
--- a/gmp/printf/obprintf.c
+++ b/gmp/printf/obprintf.c
@@ -5,34 +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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
#if HAVE_OBSTACK_VPRINTF
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <obstack.h>
#include <string.h>
@@ -41,12 +35,25 @@ see https://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));
diff --git a/gmp/printf/obprntffuns.c b/gmp/printf/obprntffuns.c
index 4cd1a91dec..092e6cca21 100644
--- a/gmp/printf/obprntffuns.c
+++ b/gmp/printf/obprntffuns.c
@@ -10,28 +10,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
@@ -39,7 +28,12 @@ see https://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>
diff --git a/gmp/printf/obvprintf.c b/gmp/printf/obvprintf.c
index 31eddbdf2a..4e3712f247 100644
--- a/gmp/printf/obvprintf.c
+++ b/gmp/printf/obvprintf.c
@@ -5,34 +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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
#if HAVE_OBSTACK_VPRINTF
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <obstack.h>
#include <string.h>
diff --git a/gmp/printf/printf.c b/gmp/printf/printf.c
index 7ac7b62fae..bcb0acbb86 100644
--- a/gmp/printf/printf.c
+++ b/gmp/printf/printf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
@@ -36,12 +32,23 @@ see https://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);
diff --git a/gmp/printf/printffuns.c b/gmp/printf/printffuns.c
index 058c6b9d8b..4f4e74d989 100644
--- a/gmp/printf/printffuns.c
+++ b/gmp/printf/printffuns.c
@@ -9,30 +9,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
+
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <stdio.h>
#include <string.h>
@@ -41,7 +37,7 @@ see https://www.gnu.org/licenses/. */
/* SunOS 4 stdio.h doesn't provide a prototype for this */
#if ! HAVE_DECL_VFPRINTF
-int vfprintf (FILE *, const char *, va_list);
+int vfprintf __GMP_PROTO ((FILE *, const char *, va_list));
#endif
diff --git a/gmp/printf/repl-vsnprintf.c b/gmp/printf/repl-vsnprintf.c
index a95003baa6..06809dcb82 100644
--- a/gmp/printf/repl-vsnprintf.c
+++ b/gmp/printf/repl-vsnprintf.c
@@ -10,28 +10,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
@@ -40,7 +29,12 @@ see https://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>
@@ -272,7 +266,6 @@ __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;
diff --git a/gmp/printf/snprintf.c b/gmp/printf/snprintf.c
index fde5c806eb..88afc32b8f 100644
--- a/gmp/printf/snprintf.c
+++ b/gmp/printf/snprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
+
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <string.h> /* for strlen */
#include "gmp.h"
@@ -36,16 +32,30 @@ see https://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);
diff --git a/gmp/printf/snprntffuns.c b/gmp/printf/snprntffuns.c
index 41a7670c6d..e67017469c 100644
--- a/gmp/printf/snprntffuns.c
+++ b/gmp/printf/snprntffuns.c
@@ -9,30 +9,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
+
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <stdio.h>
#include <string.h>
@@ -49,7 +45,7 @@ see https://www.gnu.org/licenses/. */
no indication how big the output would have been. It's necessary to
re-run to determine that size.
- "size-1" would mean success from a C99 vsnprintf, and the re-run is
+ "size-1" would mean sucess from a C99 vsnprintf, and the re-run is
unnecessary in this case, but we don't bother to try to detect what sort
of vsnprintf we've got. size-1 should occur rarely in normal
circumstances.
diff --git a/gmp/printf/sprintf.c b/gmp/printf/sprintf.c
index 052a2655c9..0a3294d8ea 100644
--- a/gmp/printf/sprintf.c
+++ b/gmp/printf/sprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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"
@@ -36,7 +32,12 @@ see https://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);
@@ -44,7 +45,15 @@ gmp_sprintf (char *buf, const char *fmt, ...)
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);
diff --git a/gmp/printf/sprintffuns.c b/gmp/printf/sprintffuns.c
index 40374e1a07..01fb3c98e6 100644
--- a/gmp/printf/sprintffuns.c
+++ b/gmp/printf/sprintffuns.c
@@ -9,30 +9,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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>
diff --git a/gmp/printf/vasprintf.c b/gmp/printf/vasprintf.c
index 44785dae2a..4ed4c5dbe2 100644
--- a/gmp/printf/vasprintf.c
+++ b/gmp/printf/vasprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
+
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
diff --git a/gmp/printf/vfprintf.c b/gmp/printf/vfprintf.c
index 839f133d9d..8bed6775ac 100644
--- a/gmp/printf/vfprintf.c
+++ b/gmp/printf/vfprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
diff --git a/gmp/printf/vprintf.c b/gmp/printf/vprintf.c
index 8e768978f5..f8da0efbd1 100644
--- a/gmp/printf/vprintf.c
+++ b/gmp/printf/vprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
diff --git a/gmp/printf/vsnprintf.c b/gmp/printf/vsnprintf.c
index ed6f99885d..565fdfd8dd 100644
--- a/gmp/printf/vsnprintf.c
+++ b/gmp/printf/vsnprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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"
diff --git a/gmp/printf/vsprintf.c b/gmp/printf/vsprintf.c
index 099455d325..b1a3045627 100644
--- a/gmp/printf/vsprintf.c
+++ b/gmp/printf/vsprintf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
+
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <string.h> /* for strlen */
#include "gmp.h"
diff --git a/gmp/rand.c b/gmp/rand.c
new file mode 100644
index 0000000000..31969b2981
--- /dev/null
+++ b/gmp/rand.c
@@ -0,0 +1,64 @@
+/* gmp_randinit (state, algorithm, ...) -- Initialize a random state.
+
+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/. */
+
+#include "config.h"
+
+#include <stdio.h> /* for NULL */
+
+#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
+{
+ 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:
+ if (! gmp_randinit_lc_2exp_size (rstate, va_arg (ap, unsigned long)))
+ gmp_errno |= GMP_ERROR_INVALID_ARGUMENT;
+ break;
+ default:
+ gmp_errno |= GMP_ERROR_UNSUPPORTED_ARGUMENT;
+ break;
+ }
+ va_end (ap);
+}
diff --git a/gmp/rand/Makefile.am b/gmp/rand/Makefile.am
deleted file mode 100644
index 0cee1a7623..0000000000
--- a/gmp/rand/Makefile.am
+++ /dev/null
@@ -1,38 +0,0 @@
-## Process this file with automake to generate Makefile.in
-
-# Copyright 2001, 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 either:
-#
-# * the GNU Lesser General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your
-# option) any later version.
-#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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)
-
-noinst_LTLIBRARIES = librandom.la
-
-librandom_la_SOURCES = randmt.h \
- rand.c randclr.c randdef.c randiset.c randlc2s.c randlc2x.c randmt.c \
- randmts.c rands.c randsd.c randsdui.c randbui.c randmui.c
diff --git a/gmp/rand/Makefile.in b/gmp/rand/Makefile.in
deleted file mode 100644
index 9d033e1259..0000000000
--- a/gmp/rand/Makefile.in
+++ /dev/null
@@ -1,556 +0,0 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
-# @configure_input@
-
-# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
-# This Makefile.in is free software; the Free Software Foundation
-# gives unlimited permission to copy and/or distribute it,
-# with or without modifications, as long as this notice is preserved.
-
-# This program is distributed in the hope that it will be useful,
-# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
-# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
-# PARTICULAR PURPOSE.
-
-@SET_MAKE@
-
-# Copyright 2001, 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 either:
-#
-# * the GNU Lesser General Public License as published by the Free
-# Software Foundation; either version 3 of the License, or (at your
-# option) any later version.
-#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
-pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
-pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
-am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
-install_sh_DATA = $(install_sh) -c -m 644
-install_sh_PROGRAM = $(install_sh) -c
-install_sh_SCRIPT = $(install_sh) -c
-INSTALL_HEADER = $(INSTALL_DATA)
-transform = $(program_transform_name)
-NORMAL_INSTALL = :
-PRE_INSTALL = :
-POST_INSTALL = :
-NORMAL_UNINSTALL = :
-PRE_UNINSTALL = :
-POST_UNINSTALL = :
-build_triplet = @build@
-host_triplet = @host@
-subdir = rand
-DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
-ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
-am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
- $(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
-CONFIG_HEADER = $(top_builddir)/config.h
-CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-LTLIBRARIES = $(noinst_LTLIBRARIES)
-librandom_la_LIBADD =
-am_librandom_la_OBJECTS = rand.lo randclr.lo randdef.lo randiset.lo \
- randlc2s.lo randlc2x.lo randmt.lo randmts.lo rands.lo \
- randsd.lo randsdui.lo randbui.lo randmui.lo
-librandom_la_OBJECTS = $(am_librandom_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
-depcomp =
-am__depfiles_maybe =
-COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
- $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = $(librandom_la_SOURCES)
-DIST_SOURCES = $(librandom_la_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
-ETAGS = etags
-CTAGS = ctags
-DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-ABI = @ABI@
-ACLOCAL = @ACLOCAL@
-AMTAR = @AMTAR@
-AR = @AR@
-AS = @AS@
-ASMFLAGS = @ASMFLAGS@
-AUTOCONF = @AUTOCONF@
-AUTOHEADER = @AUTOHEADER@
-AUTOMAKE = @AUTOMAKE@
-AWK = @AWK@
-CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
-CC = @CC@
-CCAS = @CCAS@
-CC_FOR_BUILD = @CC_FOR_BUILD@
-CFLAGS = @CFLAGS@
-CPP = @CPP@
-CPPFLAGS = @CPPFLAGS@
-CPP_FOR_BUILD = @CPP_FOR_BUILD@
-CXX = @CXX@
-CXXCPP = @CXXCPP@
-CXXFLAGS = @CXXFLAGS@
-CYGPATH_W = @CYGPATH_W@
-DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
-DEFS = @DEFS@
-DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
-ECHO_C = @ECHO_C@
-ECHO_N = @ECHO_N@
-ECHO_T = @ECHO_T@
-EGREP = @EGREP@
-EXEEXT = @EXEEXT@
-EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
-GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
-GMP_NAIL_BITS = @GMP_NAIL_BITS@
-GREP = @GREP@
-HAVE_CLOCK_01 = @HAVE_CLOCK_01@
-HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
-HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
-HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
-HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
-HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
-HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
-HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
-HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
-HAVE_STACK_T_01 = @HAVE_STACK_T_01@
-HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
-INSTALL_DATA = @INSTALL_DATA@
-INSTALL_PROGRAM = @INSTALL_PROGRAM@
-INSTALL_SCRIPT = @INSTALL_SCRIPT@
-INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
-LDFLAGS = @LDFLAGS@
-LEX = @LEX@
-LEXLIB = @LEXLIB@
-LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
-LIBCURSES = @LIBCURSES@
-LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
-LIBGMP_DLL = @LIBGMP_DLL@
-LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
-LIBM = @LIBM@
-LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
-LIBOBJS = @LIBOBJS@
-LIBREADLINE = @LIBREADLINE@
-LIBS = @LIBS@
-LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
-LN_S = @LN_S@
-LTLIBOBJS = @LTLIBOBJS@
-M4 = @M4@
-MAINT = @MAINT@
-MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
-OBJDUMP = @OBJDUMP@
-OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
-PACKAGE = @PACKAGE@
-PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
-PACKAGE_NAME = @PACKAGE_NAME@
-PACKAGE_STRING = @PACKAGE_STRING@
-PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
-PACKAGE_VERSION = @PACKAGE_VERSION@
-PATH_SEPARATOR = @PATH_SEPARATOR@
-RANLIB = @RANLIB@
-SED = @SED@
-SET_MAKE = @SET_MAKE@
-SHELL = @SHELL@
-SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
-STRIP = @STRIP@
-TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
-TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
-U_FOR_BUILD = @U_FOR_BUILD@
-VERSION = @VERSION@
-WITH_READLINE_01 = @WITH_READLINE_01@
-YACC = @YACC@
-YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
-ac_ct_CC = @ac_ct_CC@
-ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
-am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
-bindir = @bindir@
-build = @build@
-build_alias = @build_alias@
-build_cpu = @build_cpu@
-build_os = @build_os@
-build_vendor = @build_vendor@
-builddir = @builddir@
-datadir = @datadir@
-datarootdir = @datarootdir@
-docdir = @docdir@
-dvidir = @dvidir@
-exec_prefix = @exec_prefix@
-gmp_srclinks = @gmp_srclinks@
-host = @host@
-host_alias = @host_alias@
-host_cpu = @host_cpu@
-host_os = @host_os@
-host_vendor = @host_vendor@
-htmldir = @htmldir@
-includedir = @includedir@
-infodir = @infodir@
-install_sh = @install_sh@
-libdir = @libdir@
-libexecdir = @libexecdir@
-localedir = @localedir@
-localstatedir = @localstatedir@
-mandir = @mandir@
-mkdir_p = @mkdir_p@
-mpn_objects = @mpn_objects@
-mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
-oldincludedir = @oldincludedir@
-pdfdir = @pdfdir@
-prefix = @prefix@
-program_transform_name = @program_transform_name@
-psdir = @psdir@
-sbindir = @sbindir@
-sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
-sysconfdir = @sysconfdir@
-target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
-noinst_LTLIBRARIES = librandom.la
-librandom_la_SOURCES = randmt.h \
- rand.c randclr.c randdef.c randiset.c randlc2s.c randlc2x.c randmt.c \
- randmts.c rands.c randsd.c randsdui.c randbui.c randmui.c
-
-all: all-am
-
-.SUFFIXES:
-.SUFFIXES: .c .lo .o .obj
-$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
- @for dep in $?; do \
- case '$(am__configure_deps)' in \
- *$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
- exit 1;; \
- esac; \
- done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps rand/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps rand/Makefile
-.PRECIOUS: Makefile
-Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
- @case '$?' in \
- *config.status*) \
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
- *) \
- echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
- cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
- esac;
-
-$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-
-$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
- cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-
-clean-noinstLTLIBRARIES:
- -test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
- @list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
- dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
- echo "rm -f \"$${dir}/so_locations\""; \
- rm -f "$${dir}/so_locations"; \
- done
-librandom.la: $(librandom_la_OBJECTS) $(librandom_la_DEPENDENCIES) $(EXTRA_librandom_la_DEPENDENCIES)
- $(LINK) $(librandom_la_OBJECTS) $(librandom_la_LIBADD) $(LIBS)
-
-mostlyclean-compile:
- -rm -f *.$(OBJEXT)
-
-distclean-compile:
- -rm -f *.tab.c
-
-.c.o:
- $(COMPILE) -c $<
-
-.c.obj:
- $(COMPILE) -c `$(CYGPATH_W) '$<'`
-
-.c.lo:
- $(LTCOMPILE) -c -o $@ $<
-
-mostlyclean-libtool:
- -rm -f *.lo
-
-clean-libtool:
- -rm -rf .libs _libs
-
-ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- mkid -fID $$unique
-tags: TAGS
-
-TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- set x; \
- here=`pwd`; \
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
- fi
-ctags: CTAGS
-CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
- $(TAGS_FILES) $(LISP)
- list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
- unique=`for i in $$list; do \
- if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
- done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
- || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
-
-GTAGS:
- here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
-
-distclean-tags:
- -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
-
-distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
- if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
- if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
- else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
- || exit 1; \
- fi; \
- done
-check-am: all-am
-check: check-am
-all-am: Makefile $(LTLIBRARIES)
-installdirs:
-install: install-am
-install-exec: install-exec-am
-install-data: install-data-am
-uninstall: uninstall-am
-
-install-am: all-am
- @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
-
-installcheck: installcheck-am
-install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
-mostlyclean-generic:
-
-clean-generic:
-
-distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
-
-maintainer-clean-generic:
- @echo "This command is intended for maintainers to use"
- @echo "it deletes files that may require special tools to rebuild."
-clean: clean-am
-
-clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
- mostlyclean-am
-
-distclean: distclean-am
- -rm -f Makefile
-distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
-
-dvi: dvi-am
-
-dvi-am:
-
-html: html-am
-
-html-am:
-
-info: info-am
-
-info-am:
-
-install-data-am:
-
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
-install-exec-am:
-
-install-html: install-html-am
-
-install-html-am:
-
-install-info: install-info-am
-
-install-info-am:
-
-install-man:
-
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
-installcheck-am:
-
-maintainer-clean: maintainer-clean-am
- -rm -f Makefile
-maintainer-clean-am: distclean-am maintainer-clean-generic
-
-mostlyclean: mostlyclean-am
-
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool
-
-pdf: pdf-am
-
-pdf-am:
-
-ps: ps-am
-
-ps-am:
-
-uninstall-am:
-
-.MAKE: install-am install-strip
-
-.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
- clean-libtool clean-noinstLTLIBRARIES ctags distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
-
-# Tell versions [3.59,3.63) of GNU make to not export all variables.
-# Otherwise a system limit (for SysV at least) may be exceeded.
-.NOEXPORT:
diff --git a/gmp/rand/rand.c b/gmp/rand/rand.c
deleted file mode 100644
index 09e3b765bc..0000000000
--- a/gmp/rand/rand.c
+++ /dev/null
@@ -1,52 +0,0 @@
-/* gmp_randinit (state, algorithm, ...) -- Initialize a random state.
-
-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/. */
-
-#include <stdarg.h>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-gmp_randinit (gmp_randstate_t rstate, gmp_randalg_t alg, ...)
-{
- va_list ap;
- va_start (ap, alg);
-
- switch (alg) {
- case GMP_RAND_ALG_LC:
- if (! gmp_randinit_lc_2exp_size (rstate, va_arg (ap, unsigned long)))
- gmp_errno |= GMP_ERROR_INVALID_ARGUMENT;
- break;
- default:
- gmp_errno |= GMP_ERROR_UNSUPPORTED_ARGUMENT;
- break;
- }
- va_end (ap);
-}
diff --git a/gmp/rand/randclr.c b/gmp/rand/randclr.c
deleted file mode 100644
index fb3798b73d..0000000000
--- a/gmp/rand/randclr.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* gmp_randclear (state) -- Clear and deallocate random state STATE.
-
-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/. */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-
-void
-gmp_randclear (gmp_randstate_t rstate)
-{
- (*((gmp_randfnptr_t *) RNG_FNPTR (rstate))->randclear_fn) (rstate);
-}
diff --git a/gmp/rand/randdef.c b/gmp/rand/randdef.c
deleted file mode 100644
index 7d173f9364..0000000000
--- a/gmp/rand/randdef.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* gmp_randinit_default -- initialize a random state with a default algorithm.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-gmp_randinit_default (gmp_randstate_t rstate)
-{
- gmp_randinit_mt (rstate);
-}
diff --git a/gmp/rand/randiset.c b/gmp/rand/randiset.c
deleted file mode 100644
index 66f4bc4903..0000000000
--- a/gmp/rand/randiset.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* gmp_randinit_set -- initialize with a copy of another gmp_randstate_t.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-gmp_randinit_set (gmp_randstate_ptr dst, gmp_randstate_srcptr src)
-{
- (*((gmp_randfnptr_t *) RNG_FNPTR (src))->randiset_fn) (dst, src);
-}
diff --git a/gmp/rand/randmt.h b/gmp/rand/randmt.h
deleted file mode 100644
index d64ff59548..0000000000
--- a/gmp/rand/randmt.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* Mersenne Twister pseudo-random number generator defines.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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/. */
-
-
-/* Number of extractions used to warm the buffer up. */
-#define WARM_UP 2000
-
-/* Period parameters. */
-#define N 624
-#define M 397
-#define MATRIX_A 0x9908B0DF /* Constant vector a. */
-
-/* State structure for MT. */
-typedef struct
-{
- gmp_uint_least32_t mt[N]; /* State array. */
- int mti; /* Index of current value. */
-} gmp_rand_mt_struct;
-
-
-void __gmp_mt_recalc_buffer (gmp_uint_least32_t *);
-void __gmp_randget_mt (gmp_randstate_t, mp_ptr, unsigned long int);
-void __gmp_randclear_mt (gmp_randstate_t);
-void __gmp_randiset_mt (gmp_randstate_ptr, gmp_randstate_srcptr);
diff --git a/gmp/rand/randsd.c b/gmp/rand/randsd.c
deleted file mode 100644
index 1214d000d5..0000000000
--- a/gmp/rand/randsd.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* gmp_randseed (state, seed) -- Set initial seed SEED in random state STATE.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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
-gmp_randseed (gmp_randstate_t rstate,
- mpz_srcptr seed)
-{
- (*((gmp_randfnptr_t *) RNG_FNPTR (rstate))->randseed_fn) (rstate, seed);
-}
diff --git a/gmp/rand/randbui.c b/gmp/randbui.c
index 619ab91bd1..5fc49b27d3 100644
--- a/gmp/rand/randbui.c
+++ b/gmp/randbui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/randclr.c b/gmp/randclr.c
new file mode 100644
index 0000000000..a4e82426f0
--- /dev/null
+++ b/gmp/randclr.c
@@ -0,0 +1,27 @@
+/* gmp_randclear (state) -- Clear and deallocate random state STATE.
+
+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/. */
+
+#include "gmp.h"
+#include "gmp-impl.h"
+
+void
+gmp_randclear (gmp_randstate_t rstate)
+{
+ (*((gmp_randfnptr_t *) RNG_FNPTR (rstate))->randclear_fn) (rstate);
+}
diff --git a/gmp/randdef.c b/gmp/randdef.c
new file mode 100644
index 0000000000..171a0bd87e
--- /dev/null
+++ b/gmp/randdef.c
@@ -0,0 +1,27 @@
+/* gmp_randinit_default -- initialize a random state with a default algorithm.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+void
+gmp_randinit_default (gmp_randstate_t rstate)
+{
+ gmp_randinit_mt (rstate);
+}
diff --git a/gmp/randiset.c b/gmp/randiset.c
new file mode 100644
index 0000000000..f140a330be
--- /dev/null
+++ b/gmp/randiset.c
@@ -0,0 +1,28 @@
+/* gmp_randinit_set -- initialize with a copy of another gmp_randstate_t.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+
+void
+gmp_randinit_set (gmp_randstate_ptr dst, gmp_randstate_srcptr src)
+{
+ (*((gmp_randfnptr_t *) RNG_FNPTR (src))->randiset_fn) (dst, src);
+}
diff --git a/gmp/rand/randlc2s.c b/gmp/randlc2s.c
index 013e877286..819ebbc04a 100644
--- a/gmp/rand/randlc2s.c
+++ b/gmp/randlc2s.c
@@ -1,33 +1,22 @@
/* gmp_randinit_lc_2exp_size -- initialize a random state with a linear
congruential generator of a requested size.
-Copyright 1999-2001 Free Software Foundation, Inc.
+Copyright 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
#include "gmp.h"
@@ -73,7 +62,7 @@ static const struct __gmp_rand_lc_scheme_struct __gmp_rand_lc_scheme[] =
};
int
-gmp_randinit_lc_2exp_size (gmp_randstate_t rstate, mp_bitcnt_t size)
+gmp_randinit_lc_2exp_size (gmp_randstate_t rstate, unsigned long size)
{
const struct __gmp_rand_lc_scheme_struct *sp;
mpz_t a;
diff --git a/gmp/rand/randlc2x.c b/gmp/randlc2x.c
index 195f759327..f1994187d9 100644
--- a/gmp/rand/randlc2x.c
+++ b/gmp/randlc2x.c
@@ -1,32 +1,21 @@
/* Linear Congruential pseudo-random number generator functions.
-Copyright 1999-2003, 2005 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -103,11 +92,11 @@ lc (mp_ptr rp, gmp_randstate_t rstate)
{
mp_size_t tmp = an + seedn;
ta = tn + 1;
- tp = TMP_ALLOC_LIMBS (ta);
+ tp = (mp_ptr) TMP_ALLOC (ta * BYTES_PER_MP_LIMB);
MPN_ZERO (&tp[tmp], ta - tmp); /* mpn_mul won't zero it out. */
}
else
- tp = TMP_ALLOC_LIMBS (ta);
+ tp = (mp_ptr) TMP_ALLOC (ta * BYTES_PER_MP_LIMB);
/* t = a * seed. NOTE: an is always > 0; see initialization. */
ASSERT (seedn >= an && an > 0);
@@ -166,7 +155,7 @@ randget_lc (gmp_randstate_t rstate, mp_ptr rp, unsigned long int nbits)
chunk_nbits = p->_mp_m2exp / 2;
tn = BITS_TO_LIMBS (chunk_nbits);
- tp = TMP_ALLOC_LIMBS (tn);
+ tp = (mp_ptr) TMP_ALLOC (tn * BYTES_PER_MP_LIMB);
rbitpos = 0;
while (rbitpos + chunk_nbits <= nbits)
@@ -253,7 +242,7 @@ randclear_lc (gmp_randstate_t rstate)
(*__gmp_free_func) (p, sizeof (gmp_rand_lc_struct));
}
-static void randiset_lc (gmp_randstate_ptr, gmp_randstate_srcptr);
+static void randiset_lc __GMP_PROTO ((gmp_randstate_ptr dst, gmp_randstate_srcptr src));
static const gmp_randfnptr_t Linear_Congruential_Generator = {
randseed_lc,
@@ -268,9 +257,9 @@ randiset_lc (gmp_randstate_ptr dst, gmp_randstate_srcptr src)
gmp_rand_lc_struct *dstp, *srcp;
srcp = (gmp_rand_lc_struct *) RNG_STATE (src);
- dstp = (gmp_rand_lc_struct *) (*__gmp_allocate_func) (sizeof (gmp_rand_lc_struct));
+ dstp = (*__gmp_allocate_func) (sizeof (gmp_rand_lc_struct));
- RNG_STATE (dst) = (mp_limb_t *) (void *) dstp;
+ RNG_STATE (dst) = (void *) dstp;
RNG_FNPTR (dst) = (void *) &Linear_Congruential_Generator;
/* _mp_seed and _mp_a might be unnormalized (high zero limbs), but
@@ -294,7 +283,7 @@ void
gmp_randinit_lc_2exp (gmp_randstate_t rstate,
mpz_srcptr a,
unsigned long int c,
- mp_bitcnt_t m2exp)
+ unsigned long int m2exp)
{
gmp_rand_lc_struct *p;
mp_size_t seedn = BITS_TO_LIMBS (m2exp);
@@ -302,7 +291,7 @@ gmp_randinit_lc_2exp (gmp_randstate_t rstate,
ASSERT_ALWAYS (m2exp != 0);
p = __GMP_ALLOCATE_FUNC_TYPE (1, gmp_rand_lc_struct);
- RNG_STATE (rstate) = (mp_limb_t *) (void *) p;
+ RNG_STATE (rstate) = (void *) p;
RNG_FNPTR (rstate) = (void *) &Linear_Congruential_Generator;
/* allocate m2exp bits of space for p->_mp_seed, and initial seed "1" */
diff --git a/gmp/rand/randmt.c b/gmp/randmt.c
index f3cdc66662..ccd4a11e05 100644
--- a/gmp/rand/randmt.c
+++ b/gmp/randmt.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h> /* for NULL */
@@ -358,10 +347,10 @@ void
__gmp_randclear_mt (gmp_randstate_t rstate)
{
(*__gmp_free_func) ((void *) RNG_STATE (rstate),
- ALLOC (rstate->_mp_seed) * GMP_LIMB_BYTES);
+ ALLOC (rstate->_mp_seed) * BYTES_PER_MP_LIMB);
}
-void __gmp_randiset_mt (gmp_randstate_ptr, gmp_randstate_srcptr);
+void __gmp_randiset_mt __GMP_PROTO ((gmp_randstate_ptr dst, gmp_randstate_srcptr src));
static const gmp_randfnptr_t Mersenne_Twister_Generator_Noseed = {
NULL,
@@ -373,7 +362,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) / GMP_LIMB_BYTES) + 1;
+ const mp_size_t sz = ((sizeof (gmp_rand_mt_struct) - 1) / BYTES_PER_MP_LIMB) + 1;
gmp_rand_mt_struct *dstp, *srcp;
mp_size_t i;
@@ -396,7 +385,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) / GMP_LIMB_BYTES) + 1;
+ const mp_size_t sz = ((sizeof (gmp_rand_mt_struct) - 1) / BYTES_PER_MP_LIMB) + 1;
gmp_rand_mt_struct *dstp;
mp_size_t i;
diff --git a/gmp/randmt.h b/gmp/randmt.h
new file mode 100644
index 0000000000..fc2338105a
--- /dev/null
+++ b/gmp/randmt.h
@@ -0,0 +1,40 @@
+/* Mersenne Twister pseudo-random number generator defines.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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/. */
+
+
+/* Number of extractions used to warm the buffer up. */
+#define WARM_UP 2000
+
+/* Period parameters. */
+#define N 624
+#define M 397
+#define MATRIX_A 0x9908B0DF /* Constant vector a. */
+
+/* State structure for MT. */
+typedef struct
+{
+ gmp_uint_least32_t mt[N]; /* State array. */
+ int mti; /* Index of current value. */
+} gmp_rand_mt_struct;
+
+
+void __gmp_mt_recalc_buffer __GMP_PROTO ((gmp_uint_least32_t *));
+void __gmp_randget_mt __GMP_PROTO ((gmp_randstate_t, mp_ptr, unsigned long int));
+void __gmp_randclear_mt __GMP_PROTO ((gmp_randstate_t rstate));
+void __gmp_randiset_mt __GMP_PROTO ((gmp_randstate_ptr, gmp_randstate_srcptr));
diff --git a/gmp/rand/randmts.c b/gmp/randmts.c
index 1db7855141..e3b0338856 100644
--- a/gmp/rand/randmts.c
+++ b/gmp/randmts.c
@@ -1,32 +1,21 @@
/* Mersenne Twister pseudo-random number generator functions.
-Copyright 2002, 2003, 2013 Free Software Foundation, Inc.
+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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
@@ -36,15 +25,16 @@ see https://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)
+mangle_seed (mpz_ptr r, mpz_srcptr b_orig)
{
mpz_t t, b;
unsigned long e = 0x40118124;
unsigned long bit = 0x20000000;
- mpz_init2 (t, 19937L);
- mpz_init_set (b, r);
+ mpz_init (t);
+ mpz_init_set (b, b_orig); /* in case r==b_orig */
+ mpz_set (r, b);
do
{
mpz_mul (r, r, r);
@@ -53,7 +43,7 @@ mangle_seed (mpz_ptr r)
for (;;)
{
mpz_tdiv_q_2exp (t, r, 19937L);
- if (SIZ (t) == 0)
+ if (mpz_sgn (t) == 0)
break;
mpz_tdiv_r_2exp (r, r, 19937L);
mpz_addmul_ui (r, t, 20023L);
@@ -61,7 +51,7 @@ mangle_seed (mpz_ptr r)
if ((e & bit) != 0)
{
- e ^= bit;
+ e &= ~bit;
mpz_mul (r, r, b);
goto reduce;
}
@@ -117,15 +107,15 @@ randseed_mt (gmp_randstate_t rstate, mpz_srcptr seed)
p = (gmp_rand_mt_struct *) RNG_STATE (rstate);
- mpz_init2 (mod, 19937L);
- mpz_init2 (seed1, 19937L);
+ mpz_init (mod);
+ mpz_init (seed1);
+ 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); /* Perform the mangling by powering. */
+ mangle_seed (seed1, 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;
@@ -134,12 +124,14 @@ 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++)
diff --git a/gmp/rand/randmui.c b/gmp/randmui.c
index 2d4ef86aa3..f349d35937 100644
--- a/gmp/rand/randmui.c
+++ b/gmp/randmui.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/rand/rands.c b/gmp/rands.c
index 1701da7a2c..93eb3e70cb 100644
--- a/gmp/rand/rands.c
+++ b/gmp/rands.c
@@ -10,28 +10,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/randsd.c b/gmp/randsd.c
new file mode 100644
index 0000000000..077382eeae
--- /dev/null
+++ b/gmp/randsd.c
@@ -0,0 +1,28 @@
+/* gmp_randseed (state, seed) -- Set initial seed SEED in random state STATE.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+void
+gmp_randseed (gmp_randstate_t rstate,
+ mpz_srcptr seed)
+{
+ (*((gmp_randfnptr_t *) RNG_FNPTR (rstate))->randseed_fn) (rstate, seed);
+}
diff --git a/gmp/rand/randsdui.c b/gmp/randsdui.c
index 1c97232e30..9039edab24 100644
--- a/gmp/rand/randsdui.c
+++ b/gmp/randsdui.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/scanf/Makefile.am b/gmp/scanf/Makefile.am
index b5e0148222..5359b5e5e6 100644
--- a/gmp/scanf/Makefile.am
+++ b/gmp/scanf/Makefile.am
@@ -2,31 +2,20 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
diff --git a/gmp/scanf/Makefile.in b/gmp/scanf/Makefile.in
index 718a2c5beb..028a8c853a 100644
--- a/gmp/scanf/Makefile.in
+++ b/gmp/scanf/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -17,55 +16,32 @@
# 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libscanf_la_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -77,43 +53,37 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
subdir = scanf
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
LTLIBRARIES = $(noinst_LTLIBRARIES)
libscanf_la_LIBADD =
-am_libscanf_la_OBJECTS = doscan.lo fscanf.lo fscanffuns.lo scanf.lo \
- sscanf.lo sscanffuns.lo vfscanf.lo vscanf.lo vsscanf.lo
+am_libscanf_la_OBJECTS = doscan$U.lo fscanf$U.lo fscanffuns$U.lo \
+ scanf$U.lo sscanf$U.lo sscanffuns$U.lo vfscanf$U.lo \
+ vscanf$U.lo vsscanf$U.lo
libscanf_la_OBJECTS = $(am_libscanf_la_OBJECTS)
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libscanf_la_SOURCES)
DIST_SOURCES = $(libscanf_la_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -127,6 +97,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -142,17 +113,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -166,12 +136,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -186,26 +154,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -215,31 +177,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -263,6 +220,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -270,12 +228,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -D__GMP_WITHIN_GMP -I$(top_srcdir)
noinst_LTLIBRARIES = libscanf.la
libscanf_la_SOURCES = \
@@ -290,14 +244,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps scanf/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps scanf/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps scanf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps scanf/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -315,24 +269,28 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-noinstLTLIBRARIES:
-test -z "$(noinst_LTLIBRARIES)" || rm -f $(noinst_LTLIBRARIES)
@list='$(noinst_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libscanf.la: $(libscanf_la_OBJECTS) $(libscanf_la_DEPENDENCIES) $(EXTRA_libscanf_la_DEPENDENCIES)
- $(LINK) $(libscanf_la_OBJECTS) $(libscanf_la_LIBADD) $(LIBS)
+libscanf.la: $(libscanf_la_OBJECTS) $(libscanf_la_DEPENDENCIES)
+ $(LINK) $(libscanf_la_LDFLAGS) $(libscanf_la_OBJECTS) $(libscanf_la_LIBADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -342,6 +300,29 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+doscan_.c: doscan.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/doscan.c; then echo $(srcdir)/doscan.c; else echo doscan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fscanf_.c: fscanf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fscanf.c; then echo $(srcdir)/fscanf.c; else echo fscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+fscanffuns_.c: fscanffuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/fscanffuns.c; then echo $(srcdir)/fscanffuns.c; else echo fscanffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+scanf_.c: scanf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/scanf.c; then echo $(srcdir)/scanf.c; else echo scanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sscanf_.c: sscanf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sscanf.c; then echo $(srcdir)/sscanf.c; else echo sscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sscanffuns_.c: sscanffuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sscanffuns.c; then echo $(srcdir)/sscanffuns.c; else echo sscanffuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vfscanf_.c: vfscanf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vfscanf.c; then echo $(srcdir)/vfscanf.c; else echo vfscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vscanf_.c: vscanf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vscanf.c; then echo $(srcdir)/vscanf.c; else echo vscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+vsscanf_.c: vsscanf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/vsscanf.c; then echo $(srcdir)/vsscanf.c; else echo vsscanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+doscan_.$(OBJEXT) doscan_.lo fscanf_.$(OBJEXT) fscanf_.lo \
+fscanffuns_.$(OBJEXT) fscanffuns_.lo scanf_.$(OBJEXT) scanf_.lo \
+sscanf_.$(OBJEXT) sscanf_.lo sscanffuns_.$(OBJEXT) sscanffuns_.lo \
+vfscanf_.$(OBJEXT) vfscanf_.lo vscanf_.$(OBJEXT) vscanf_.lo \
+vsscanf_.$(OBJEXT) vsscanf_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -349,85 +330,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -445,22 +423,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -473,7 +445,7 @@ clean-am: clean-generic clean-libtool clean-noinstLTLIBRARIES \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -481,38 +453,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -521,7 +473,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -532,23 +484,19 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool clean-noinstLTLIBRARIES ctags distclean \
distclean-compile distclean-generic distclean-libtool \
distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
+ install install-am install-data install-data-am install-exec \
+ install-exec-am install-info install-info-am install-man \
install-strip installcheck installcheck-am installdirs \
maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-compile mostlyclean-generic mostlyclean-libtool \
- pdf pdf-am ps ps-am tags uninstall uninstall-am
-
+ mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags uninstall \
+ uninstall-am uninstall-info-am
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
diff --git a/gmp/scanf/doscan.c b/gmp/scanf/doscan.c
index 47b22706ce..0f70629264 100644
--- a/gmp/scanf/doscan.c
+++ b/gmp/scanf/doscan.c
@@ -4,39 +4,33 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 _GNU_SOURCE /* for DECIMAL_POINT in langinfo.h */
-#include "config.h" /* needed for the HAVE_, could also move gmp incls */
+#include "config.h"
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <ctype.h>
#include <stddef.h> /* for ptrdiff_t */
#include <stdio.h>
@@ -76,7 +70,7 @@ see https://www.gnu.org/licenses/. */
It's necessary to parse up the format string to recognise the GMP
extra types F, Q and Z. Other types and conversions are passed
across to the standard sscanf or fscanf via funs->scan, for ease of
- implementation. This is essential in the case of something like glibc
+ implemenation. This is essential in the case of something like glibc
%p where the pointer format isn't actually documented.
Because funs->scan doesn't get the whole input it can't put the right
diff --git a/gmp/scanf/fscanf.c b/gmp/scanf/fscanf.c
index 83f46169ed..596571eeb4 100644
--- a/gmp/scanf/fscanf.c
+++ b/gmp/scanf/fscanf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
@@ -36,11 +32,24 @@ see https://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);
diff --git a/gmp/scanf/fscanffuns.c b/gmp/scanf/fscanffuns.c
index 396e9a175f..236aec663f 100644
--- a/gmp/scanf/fscanffuns.c
+++ b/gmp/scanf/fscanffuns.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -39,13 +28,13 @@ see https://www.gnu.org/licenses/. */
/* SunOS 4 stdio.h doesn't provide prototypes for these */
#if ! HAVE_DECL_FGETC
-int fgetc (FILE *);
+int fgetc __GMP_PROTO ((FILE *fp));
#endif
#if ! HAVE_DECL_FSCANF
-int fscanf (FILE *, const char *, ...);
+int fscanf __GMP_PROTO ((FILE *fp, const char *fmt, ...));
#endif
#if ! HAVE_DECL_UNGETC
-int ungetc (int, FILE *);
+int ungetc __GMP_PROTO ((int c, FILE *fp));
#endif
diff --git a/gmp/scanf/scanf.c b/gmp/scanf/scanf.c
index a944a7c029..b4840d1f5a 100644
--- a/gmp/scanf/scanf.c
+++ b/gmp/scanf/scanf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
@@ -36,11 +32,22 @@ see https://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);
diff --git a/gmp/scanf/sscanf.c b/gmp/scanf/sscanf.c
index b3d12dcda6..3eb10ee389 100644
--- a/gmp/scanf/sscanf.c
+++ b/gmp/scanf/sscanf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
@@ -36,11 +32,24 @@ see https://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 */
diff --git a/gmp/scanf/sscanffuns.c b/gmp/scanf/sscanffuns.c
index ed5bdf57d3..008bad7014 100644
--- a/gmp/scanf/sscanffuns.c
+++ b/gmp/scanf/sscanffuns.c
@@ -4,33 +4,22 @@
CERTAIN TO BE SUBJECT TO INCOMPATIBLE CHANGES OR DISAPPEAR COMPLETELY IN
FUTURE GNU MP RELEASES.
-Copyright 2001-2003, 2009 Free Software Foundation, Inc.
+Copyright 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <stdarg.h>
diff --git a/gmp/scanf/vfscanf.c b/gmp/scanf/vfscanf.c
index 8011b55754..2f8684cdd8 100644
--- a/gmp/scanf/vfscanf.c
+++ b/gmp/scanf/vfscanf.c
@@ -5,30 +5,26 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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 "gmp.h"
diff --git a/gmp/scanf/vscanf.c b/gmp/scanf/vscanf.c
index 51feebf72e..a411a7c5d4 100644
--- a/gmp/scanf/vscanf.c
+++ b/gmp/scanf/vscanf.c
@@ -5,30 +5,25 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+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/. */
-You should have received copies of the GNU General 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>
diff --git a/gmp/scanf/vsscanf.c b/gmp/scanf/vsscanf.c
index 6fb043dce2..160e62dce7 100644
--- a/gmp/scanf/vsscanf.c
+++ b/gmp/scanf/vsscanf.c
@@ -5,30 +5,25 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 "config.h"
+
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
#include <string.h>
diff --git a/gmp/tal-debug.c b/gmp/tal-debug.c
index 35912af360..7e0917fe6f 100644
--- a/gmp/tal-debug.c
+++ b/gmp/tal-debug.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tal-notreent.c b/gmp/tal-notreent.c
index ed162e552b..662d4ea197 100644
--- a/gmp/tal-notreent.c
+++ b/gmp/tal-notreent.c
@@ -1,33 +1,22 @@
/* Stack allocation routines. This is intended for machines without support
for the `alloca' function.
-Copyright 1996, 1997, 1999-2001, 2006 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1999, 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tal-reent.c b/gmp/tal-reent.c
index 92f516b5ff..32db9342c9 100644
--- a/gmp/tal-reent.c
+++ b/gmp/tal-reent.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -61,7 +50,7 @@ __gmp_tmp_reentrant_alloc (struct tmp_reentrant_t **markp, size_t size)
#define P ((struct tmp_reentrant_t *) p)
total_size = size + HSIZ;
- p = (char *) (*__gmp_allocate_func) (total_size);
+ p = (*__gmp_allocate_func) (total_size);
P->size = total_size;
P->next = *markp;
*markp = P;
diff --git a/gmp/tests/Makefile.am b/gmp/tests/Makefile.am
index aa3c6c579f..30975cbf43 100644
--- a/gmp/tests/Makefile.am
+++ b/gmp/tests/Makefile.am
@@ -1,24 +1,24 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2000-2004, 2013 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
-SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx
+SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx mpbsd
include ../mpn/Makeasm.am
@@ -27,8 +27,7 @@ LDADD = libtests.la $(top_builddir)/libgmp.la
check_LTLIBRARIES = libtests.la
-EXTRA_libtests_la_SOURCES = amd64call.asm amd64check.c x86call.asm x86check.c \
- arm32call.asm arm32check.c
+EXTRA_libtests_la_SOURCES = amd64call.asm amd64check.c x86call.asm x86check.c
libtests_la_SOURCES = tests.h \
memory.c misc.c refmpf.c refmpn.c refmpq.c refmpz.c spinner.c trace.c
libtests_la_DEPENDENCIES = @CALLING_CONVENTIONS_OBJS@
diff --git a/gmp/tests/Makefile.in b/gmp/tests/Makefile.in
index 28ff1f4522..3cc852e198 100644
--- a/gmp/tests/Makefile.in
+++ b/gmp/tests/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,73 +14,51 @@
@SET_MAKE@
-# Copyright 2000-2004, 2013 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have 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 1996, 1998-2002 Free Software Foundation, Inc.
+# Copyright 1996, 1998, 1999, 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libtests_la_SOURCES) $(EXTRA_libtests_la_SOURCES) t-bswap.c t-constants.c t-count_zeros.c t-gmpmax.c t-hightomask.c t-modlinv.c t-parity.c t-popc.c t-sub.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -93,8 +70,8 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
DIST_COMMON = $(srcdir)/../mpn/Makeasm.am $(srcdir)/Makefile.am \
$(srcdir)/Makefile.in
check_PROGRAMS = t-bswap$(EXEEXT) t-constants$(EXEEXT) \
@@ -104,65 +81,63 @@ check_PROGRAMS = t-bswap$(EXEEXT) t-constants$(EXEEXT) \
subdir = tests
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
am__DEPENDENCIES_1 =
-am_libtests_la_OBJECTS = memory.lo misc.lo refmpf.lo refmpn.lo \
- refmpq.lo refmpz.lo spinner.lo trace.lo
+am_libtests_la_OBJECTS = memory$U.lo misc$U.lo refmpf$U.lo refmpn$U.lo \
+ refmpq$U.lo refmpz$U.lo spinner$U.lo trace$U.lo
libtests_la_OBJECTS = $(am_libtests_la_OBJECTS)
t_bswap_SOURCES = t-bswap.c
-t_bswap_OBJECTS = t-bswap.$(OBJEXT)
+t_bswap_OBJECTS = t-bswap$U.$(OBJEXT)
t_bswap_LDADD = $(LDADD)
t_bswap_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_constants_SOURCES = t-constants.c
-t_constants_OBJECTS = t-constants.$(OBJEXT)
+t_constants_OBJECTS = t-constants$U.$(OBJEXT)
t_constants_LDADD = $(LDADD)
t_constants_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_count_zeros_SOURCES = t-count_zeros.c
-t_count_zeros_OBJECTS = t-count_zeros.$(OBJEXT)
+t_count_zeros_OBJECTS = t-count_zeros$U.$(OBJEXT)
t_count_zeros_LDADD = $(LDADD)
t_count_zeros_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_gmpmax_SOURCES = t-gmpmax.c
-t_gmpmax_OBJECTS = t-gmpmax.$(OBJEXT)
+t_gmpmax_OBJECTS = t-gmpmax$U.$(OBJEXT)
t_gmpmax_LDADD = $(LDADD)
t_gmpmax_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_hightomask_SOURCES = t-hightomask.c
-t_hightomask_OBJECTS = t-hightomask.$(OBJEXT)
+t_hightomask_OBJECTS = t-hightomask$U.$(OBJEXT)
t_hightomask_LDADD = $(LDADD)
t_hightomask_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_modlinv_SOURCES = t-modlinv.c
-t_modlinv_OBJECTS = t-modlinv.$(OBJEXT)
+t_modlinv_OBJECTS = t-modlinv$U.$(OBJEXT)
t_modlinv_LDADD = $(LDADD)
t_modlinv_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_parity_SOURCES = t-parity.c
-t_parity_OBJECTS = t-parity.$(OBJEXT)
+t_parity_OBJECTS = t-parity$U.$(OBJEXT)
t_parity_LDADD = $(LDADD)
t_parity_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_popc_SOURCES = t-popc.c
-t_popc_OBJECTS = t-popc.$(OBJEXT)
+t_popc_OBJECTS = t-popc$U.$(OBJEXT)
t_popc_LDADD = $(LDADD)
t_popc_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
t_sub_SOURCES = t-sub.c
-t_sub_OBJECTS = t-sub.$(OBJEXT)
+t_sub_OBJECTS = t-sub$U.$(OBJEXT)
t_sub_LDADD = $(LDADD)
t_sub_DEPENDENCIES = libtests.la $(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libtests_la_SOURCES) $(EXTRA_libtests_la_SOURCES) \
t-bswap.c t-constants.c t-count_zeros.c t-gmpmax.c \
t-hightomask.c t-modlinv.c t-parity.c t-popc.c t-sub.c
@@ -171,52 +146,14 @@ DIST_SOURCES = $(libtests_la_SOURCES) $(EXTRA_libtests_la_SOURCES) \
t-hightomask.c t-modlinv.c t-parity.c t-popc.c t-sub.c
RECURSIVE_TARGETS = all-recursive check-recursive dvi-recursive \
html-recursive info-recursive install-data-recursive \
- install-dvi-recursive install-exec-recursive \
- install-html-recursive install-info-recursive \
- install-pdf-recursive install-ps-recursive install-recursive \
- installcheck-recursive installdirs-recursive pdf-recursive \
- ps-recursive uninstall-recursive
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
-RECURSIVE_CLEAN_TARGETS = mostlyclean-recursive clean-recursive \
- distclean-recursive maintainer-clean-recursive
-AM_RECURSIVE_TARGETS = $(RECURSIVE_TARGETS:-recursive=) \
- $(RECURSIVE_CLEAN_TARGETS:-recursive=) tags TAGS ctags CTAGS \
- distdir
+ install-exec-recursive install-info-recursive \
+ install-recursive installcheck-recursive installdirs-recursive \
+ pdf-recursive ps-recursive uninstall-info-recursive \
+ uninstall-recursive
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DIST_SUBDIRS = $(SUBDIRS)
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
-am__relativize = \
- dir0=`pwd`; \
- sed_first='s,^\([^/]*\)/.*$$,\1,'; \
- sed_rest='s,^[^/]*/*,,'; \
- sed_last='s,^.*/\([^/]*\)$$,\1,'; \
- sed_butlast='s,/*[^/]*$$,,'; \
- while test -n "$$dir1"; do \
- first=`echo "$$dir1" | sed -e "$$sed_first"`; \
- if test "$$first" != "."; then \
- if test "$$first" = ".."; then \
- dir2=`echo "$$dir0" | sed -e "$$sed_last"`/"$$dir2"; \
- dir0=`echo "$$dir0" | sed -e "$$sed_butlast"`; \
- else \
- first2=`echo "$$dir2" | sed -e "$$sed_first"`; \
- if test "$$first2" = "$$first"; then \
- dir2=`echo "$$dir2" | sed -e "$$sed_rest"`; \
- else \
- dir2="../$$dir2"; \
- fi; \
- dir0="$$dir0"/"$$first"; \
- fi; \
- fi; \
- dir1=`echo "$$dir1" | sed -e "$$sed_rest"`; \
- done; \
- reldir="$$dir2"
ABI = @ABI@
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -227,6 +164,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -242,17 +180,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -266,12 +203,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -286,26 +221,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -315,31 +244,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -363,6 +287,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -370,13 +295,9 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
-SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx
+SUBDIRS = . devel mpn mpz mpq mpf rand misc cxx mpbsd
# COMPILE minus CC.
#
@@ -409,9 +330,7 @@ RM_TMP = rm -f
INCLUDES = -I$(top_srcdir)
LDADD = libtests.la $(top_builddir)/libgmp.la
check_LTLIBRARIES = libtests.la
-EXTRA_libtests_la_SOURCES = amd64call.asm amd64check.c x86call.asm x86check.c \
- arm32call.asm arm32check.c
-
+EXTRA_libtests_la_SOURCES = amd64call.asm amd64check.c x86call.asm x86check.c
libtests_la_SOURCES = tests.h \
memory.c misc.c refmpf.c refmpn.c refmpq.c refmpz.c spinner.c trace.c
@@ -426,14 +345,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/..
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -443,7 +362,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
-$(srcdir)/../mpn/Makeasm.am:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -452,60 +370,62 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-checkLTLIBRARIES:
-test -z "$(check_LTLIBRARIES)" || rm -f $(check_LTLIBRARIES)
@list='$(check_LTLIBRARIES)'; for p in $$list; do \
dir="`echo $$p | sed -e 's|/[^/]*$$||'`"; \
- test "$$dir" != "$$p" || dir=.; \
+ test "$$dir" = "$$p" && dir=.; \
echo "rm -f \"$${dir}/so_locations\""; \
rm -f "$${dir}/so_locations"; \
done
-libtests.la: $(libtests_la_OBJECTS) $(libtests_la_DEPENDENCIES) $(EXTRA_libtests_la_DEPENDENCIES)
- $(LINK) $(libtests_la_OBJECTS) $(libtests_la_LIBADD) $(LIBS)
+libtests.la: $(libtests_la_OBJECTS) $(libtests_la_DEPENDENCIES)
+ $(LINK) $(libtests_la_LDFLAGS) $(libtests_la_OBJECTS) $(libtests_la_LIBADD) $(LIBS)
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-t-bswap$(EXEEXT): $(t_bswap_OBJECTS) $(t_bswap_DEPENDENCIES) $(EXTRA_t_bswap_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+t-bswap$(EXEEXT): $(t_bswap_OBJECTS) $(t_bswap_DEPENDENCIES)
@rm -f t-bswap$(EXEEXT)
- $(LINK) $(t_bswap_OBJECTS) $(t_bswap_LDADD) $(LIBS)
-t-constants$(EXEEXT): $(t_constants_OBJECTS) $(t_constants_DEPENDENCIES) $(EXTRA_t_constants_DEPENDENCIES)
+ $(LINK) $(t_bswap_LDFLAGS) $(t_bswap_OBJECTS) $(t_bswap_LDADD) $(LIBS)
+t-constants$(EXEEXT): $(t_constants_OBJECTS) $(t_constants_DEPENDENCIES)
@rm -f t-constants$(EXEEXT)
- $(LINK) $(t_constants_OBJECTS) $(t_constants_LDADD) $(LIBS)
-t-count_zeros$(EXEEXT): $(t_count_zeros_OBJECTS) $(t_count_zeros_DEPENDENCIES) $(EXTRA_t_count_zeros_DEPENDENCIES)
+ $(LINK) $(t_constants_LDFLAGS) $(t_constants_OBJECTS) $(t_constants_LDADD) $(LIBS)
+t-count_zeros$(EXEEXT): $(t_count_zeros_OBJECTS) $(t_count_zeros_DEPENDENCIES)
@rm -f t-count_zeros$(EXEEXT)
- $(LINK) $(t_count_zeros_OBJECTS) $(t_count_zeros_LDADD) $(LIBS)
-t-gmpmax$(EXEEXT): $(t_gmpmax_OBJECTS) $(t_gmpmax_DEPENDENCIES) $(EXTRA_t_gmpmax_DEPENDENCIES)
+ $(LINK) $(t_count_zeros_LDFLAGS) $(t_count_zeros_OBJECTS) $(t_count_zeros_LDADD) $(LIBS)
+t-gmpmax$(EXEEXT): $(t_gmpmax_OBJECTS) $(t_gmpmax_DEPENDENCIES)
@rm -f t-gmpmax$(EXEEXT)
- $(LINK) $(t_gmpmax_OBJECTS) $(t_gmpmax_LDADD) $(LIBS)
-t-hightomask$(EXEEXT): $(t_hightomask_OBJECTS) $(t_hightomask_DEPENDENCIES) $(EXTRA_t_hightomask_DEPENDENCIES)
+ $(LINK) $(t_gmpmax_LDFLAGS) $(t_gmpmax_OBJECTS) $(t_gmpmax_LDADD) $(LIBS)
+t-hightomask$(EXEEXT): $(t_hightomask_OBJECTS) $(t_hightomask_DEPENDENCIES)
@rm -f t-hightomask$(EXEEXT)
- $(LINK) $(t_hightomask_OBJECTS) $(t_hightomask_LDADD) $(LIBS)
-t-modlinv$(EXEEXT): $(t_modlinv_OBJECTS) $(t_modlinv_DEPENDENCIES) $(EXTRA_t_modlinv_DEPENDENCIES)
+ $(LINK) $(t_hightomask_LDFLAGS) $(t_hightomask_OBJECTS) $(t_hightomask_LDADD) $(LIBS)
+t-modlinv$(EXEEXT): $(t_modlinv_OBJECTS) $(t_modlinv_DEPENDENCIES)
@rm -f t-modlinv$(EXEEXT)
- $(LINK) $(t_modlinv_OBJECTS) $(t_modlinv_LDADD) $(LIBS)
-t-parity$(EXEEXT): $(t_parity_OBJECTS) $(t_parity_DEPENDENCIES) $(EXTRA_t_parity_DEPENDENCIES)
+ $(LINK) $(t_modlinv_LDFLAGS) $(t_modlinv_OBJECTS) $(t_modlinv_LDADD) $(LIBS)
+t-parity$(EXEEXT): $(t_parity_OBJECTS) $(t_parity_DEPENDENCIES)
@rm -f t-parity$(EXEEXT)
- $(LINK) $(t_parity_OBJECTS) $(t_parity_LDADD) $(LIBS)
-t-popc$(EXEEXT): $(t_popc_OBJECTS) $(t_popc_DEPENDENCIES) $(EXTRA_t_popc_DEPENDENCIES)
+ $(LINK) $(t_parity_LDFLAGS) $(t_parity_OBJECTS) $(t_parity_LDADD) $(LIBS)
+t-popc$(EXEEXT): $(t_popc_OBJECTS) $(t_popc_DEPENDENCIES)
@rm -f t-popc$(EXEEXT)
- $(LINK) $(t_popc_OBJECTS) $(t_popc_LDADD) $(LIBS)
-t-sub$(EXEEXT): $(t_sub_OBJECTS) $(t_sub_DEPENDENCIES) $(EXTRA_t_sub_DEPENDENCIES)
+ $(LINK) $(t_popc_LDFLAGS) $(t_popc_OBJECTS) $(t_popc_LDADD) $(LIBS)
+t-sub$(EXEEXT): $(t_sub_OBJECTS) $(t_sub_DEPENDENCIES)
@rm -f t-sub$(EXEEXT)
- $(LINK) $(t_sub_OBJECTS) $(t_sub_LDADD) $(LIBS)
+ $(LINK) $(t_sub_LDFLAGS) $(t_sub_OBJECTS) $(t_sub_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -515,6 +435,55 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+amd64check_.c: amd64check.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/amd64check.c; then echo $(srcdir)/amd64check.c; else echo amd64check.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+memory_.c: memory.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/memory.c; then echo $(srcdir)/memory.c; else echo memory.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+misc_.c: misc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/misc.c; then echo $(srcdir)/misc.c; else echo misc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+refmpf_.c: refmpf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refmpf.c; then echo $(srcdir)/refmpf.c; else echo refmpf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+refmpn_.c: refmpn.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refmpn.c; then echo $(srcdir)/refmpn.c; else echo refmpn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+refmpq_.c: refmpq.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refmpq.c; then echo $(srcdir)/refmpq.c; else echo refmpq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+refmpz_.c: refmpz.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/refmpz.c; then echo $(srcdir)/refmpz.c; else echo refmpz.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+spinner_.c: spinner.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/spinner.c; then echo $(srcdir)/spinner.c; else echo spinner.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-bswap_.c: t-bswap.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-bswap.c; then echo $(srcdir)/t-bswap.c; else echo t-bswap.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-constants_.c: t-constants.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-constants.c; then echo $(srcdir)/t-constants.c; else echo t-constants.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-count_zeros_.c: t-count_zeros.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-count_zeros.c; then echo $(srcdir)/t-count_zeros.c; else echo t-count_zeros.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-gmpmax_.c: t-gmpmax.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-gmpmax.c; then echo $(srcdir)/t-gmpmax.c; else echo t-gmpmax.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-hightomask_.c: t-hightomask.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-hightomask.c; then echo $(srcdir)/t-hightomask.c; else echo t-hightomask.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-modlinv_.c: t-modlinv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-modlinv.c; then echo $(srcdir)/t-modlinv.c; else echo t-modlinv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-parity_.c: t-parity.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-parity.c; then echo $(srcdir)/t-parity.c; else echo t-parity.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-popc_.c: t-popc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-popc.c; then echo $(srcdir)/t-popc.c; else echo t-popc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-sub_.c: t-sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sub.c; then echo $(srcdir)/t-sub.c; else echo t-sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+trace_.c: trace.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/trace.c; then echo $(srcdir)/trace.c; else echo trace.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+x86check_.c: x86check.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/x86check.c; then echo $(srcdir)/x86check.c; else echo x86check.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+amd64check_.$(OBJEXT) amd64check_.lo memory_.$(OBJEXT) memory_.lo \
+misc_.$(OBJEXT) misc_.lo refmpf_.$(OBJEXT) refmpf_.lo \
+refmpn_.$(OBJEXT) refmpn_.lo refmpq_.$(OBJEXT) refmpq_.lo \
+refmpz_.$(OBJEXT) refmpz_.lo spinner_.$(OBJEXT) spinner_.lo \
+t-bswap_.$(OBJEXT) t-bswap_.lo t-constants_.$(OBJEXT) t-constants_.lo \
+t-count_zeros_.$(OBJEXT) t-count_zeros_.lo t-gmpmax_.$(OBJEXT) \
+t-gmpmax_.lo t-hightomask_.$(OBJEXT) t-hightomask_.lo \
+t-modlinv_.$(OBJEXT) t-modlinv_.lo t-parity_.$(OBJEXT) t-parity_.lo \
+t-popc_.$(OBJEXT) t-popc_.lo t-sub_.$(OBJEXT) t-sub_.lo \
+trace_.$(OBJEXT) trace_.lo x86check_.$(OBJEXT) x86check_.lo : \
+$(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -522,6 +491,10 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
# This directory's subdirectories are mostly independent; you can cd
# into them and run `make' without going through this Makefile.
# To change the values of `make' variables: instead of editing Makefiles,
@@ -529,13 +502,7 @@ clean-libtool:
# (which will cause the Makefiles to be regenerated when you run `make');
# (2) otherwise, pass the desired values on the `make' command line.
$(RECURSIVE_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
target=`echo $@ | sed s/-recursive//`; \
list='$(SUBDIRS)'; for subdir in $$list; do \
@@ -546,21 +513,16 @@ $(RECURSIVE_TARGETS):
else \
local_target="$$target"; \
fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done; \
if test "$$dot_seen" = "no"; then \
$(MAKE) $(AM_MAKEFLAGS) "$$target-am" || exit 1; \
fi; test -z "$$fail"
-$(RECURSIVE_CLEAN_TARGETS):
- @fail= failcom='exit 1'; \
- for f in x $$MAKEFLAGS; do \
- case $$f in \
- *=* | --[!k]*);; \
- *k*) failcom='fail=yes';; \
- esac; \
- done; \
+mostlyclean-recursive clean-recursive distclean-recursive \
+maintainer-clean-recursive:
+ @set fnord $$MAKEFLAGS; amf=$$2; \
dot_seen=no; \
case "$@" in \
distclean-* | maintainer-clean-*) list='$(DIST_SUBDIRS)' ;; \
@@ -580,16 +542,16 @@ $(RECURSIVE_CLEAN_TARGETS):
else \
local_target="$$target"; \
fi; \
- ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
- || eval $$failcom; \
+ (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) $$local_target) \
+ || case "$$amf" in *=*) exit 1;; *k*) fail=yes;; *) exit 1;; esac; \
done && test -z "$$fail"
tags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) tags); \
done
ctags-recursive:
list='$(SUBDIRS)'; for subdir in $$list; do \
- test "$$subdir" = . || ($(am__cd) $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
+ test "$$subdir" = . || (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) ctags); \
done
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
@@ -597,14 +559,14 @@ ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
if ($(ETAGS) --etags-include --version) >/dev/null 2>&1; then \
include_option=--etags-include; \
@@ -615,44 +577,40 @@ TAGS: tags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
fi; \
list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- test ! -f $$subdir/TAGS || \
- set "$$@" "$$include_option=$$here/$$subdir/TAGS"; \
+ test -f $$subdir/TAGS && \
+ tags="$$tags $$include_option=$$here/$$subdir/TAGS"; \
fi; \
done; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: ctags-recursive $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -660,8 +618,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -670,137 +627,104 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ $(mkdir_p) $(distdir)/../mpn
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
- @list='$(DIST_SUBDIRS)'; for subdir in $$list; do \
+ list='$(SUBDIRS)'; for subdir in $$list; do \
if test "$$subdir" = .; then :; else \
- $(am__make_dryrun) \
- || test -d "$(distdir)/$$subdir" \
- || $(MKDIR_P) "$(distdir)/$$subdir" \
- || exit 1; \
- dir1=$$subdir; dir2="$(distdir)/$$subdir"; \
- $(am__relativize); \
- new_distdir=$$reldir; \
- dir1=$$subdir; dir2="$(top_distdir)"; \
- $(am__relativize); \
- new_top_distdir=$$reldir; \
- echo " (cd $$subdir && $(MAKE) $(AM_MAKEFLAGS) top_distdir="$$new_top_distdir" distdir="$$new_distdir" \\"; \
- echo " am__remove_distdir=: am__skip_length_check=: am__skip_mode_fix=: distdir)"; \
- ($(am__cd) $$subdir && \
+ test -d "$(distdir)/$$subdir" \
+ || mkdir "$(distdir)/$$subdir" \
+ || exit 1; \
+ (cd $$subdir && \
$(MAKE) $(AM_MAKEFLAGS) \
- top_distdir="$$new_top_distdir" \
- distdir="$$new_distdir" \
- am__remove_distdir=: \
- am__skip_length_check=: \
- am__skip_mode_fix=: \
+ top_distdir="../$(top_distdir)" \
+ distdir="../$(distdir)/$$subdir" \
distdir) \
|| exit 1; \
fi; \
@@ -822,22 +746,16 @@ install-am: all-am
installcheck: installcheck-recursive
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -850,7 +768,7 @@ clean-am: clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
distclean: distclean-recursive
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-recursive
@@ -858,38 +776,18 @@ dvi-am:
html: html-recursive
-html-am:
-
info: info-recursive
info-am:
install-data-am:
-install-dvi: install-dvi-recursive
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-recursive
-
-install-html-am:
-
install-info: install-info-recursive
-install-info-am:
-
install-man:
-install-pdf: install-pdf-recursive
-
-install-pdf-am:
-
-install-ps: install-ps-recursive
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-recursive
@@ -898,7 +796,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-recursive
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-recursive
@@ -909,26 +807,24 @@ ps: ps-recursive
ps-am:
-uninstall-am:
+uninstall-am: uninstall-info-am
-.MAKE: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) check-am \
- ctags-recursive install-am install-strip tags-recursive
+uninstall-info: uninstall-info-recursive
-.PHONY: $(RECURSIVE_CLEAN_TARGETS) $(RECURSIVE_TARGETS) CTAGS GTAGS \
- all all-am check check-TESTS check-am clean \
- clean-checkLTLIBRARIES clean-checkPROGRAMS clean-generic \
- clean-libtool ctags ctags-recursive distclean \
- distclean-compile distclean-generic distclean-libtool \
- distclean-tags distdir dvi dvi-am html html-am info info-am \
- install install-am install-data install-data-am install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- installdirs-am maintainer-clean maintainer-clean-generic \
- mostlyclean mostlyclean-compile mostlyclean-generic \
- mostlyclean-libtool pdf pdf-am ps ps-am tags tags-recursive \
- uninstall uninstall-am
+.PHONY: $(RECURSIVE_TARGETS) CTAGS GTAGS all all-am check check-TESTS \
+ check-am clean clean-checkLTLIBRARIES clean-checkPROGRAMS \
+ clean-generic clean-libtool clean-recursive ctags \
+ ctags-recursive distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-recursive distclean-tags distdir \
+ dvi dvi-am html html-am info info-am install install-am \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
+ installcheck installcheck-am installdirs installdirs-am \
+ maintainer-clean maintainer-clean-generic \
+ maintainer-clean-recursive mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool \
+ mostlyclean-recursive pdf pdf-am ps ps-am tags tags-recursive \
+ uninstall uninstall-am uninstall-info-am
# .s assembler, no preprocessing.
@@ -986,7 +882,6 @@ uninstall-am:
$(RM_TMP) tmp-$*.s
.asm.lo:
$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/amd64call.asm b/gmp/tests/amd64call.asm
index dad7763028..f23f4768a7 100644
--- a/gmp/tests/amd64call.asm
+++ b/gmp/tests/amd64call.asm
@@ -1,27 +1,23 @@
dnl AMD64 calling conventions checking.
-dnl Copyright 2000, 2003, 2004, 2006, 2007, 2010 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library test suite.
-
-dnl The GNU MP Library test suite is free software; you can redistribute it
-dnl and/or modify it under the terms of the GNU General Public License as
+dnl Copyright 2000, 2003, 2004, 2006, 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 test suite is distributed in the hope that it will be
-dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-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 https://www.gnu.org/licenses/.
+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/.
-dnl The current version of the code attempts to keep the call/return
-dnl prediction stack valid, but matching calls and returns.
-
include(`../config.m4')
@@ -30,7 +26,7 @@ C
C Execute an fldcw, setting the x87 control word to cw.
PROLOGUE(x86_fldcw)
- mov %rdi, -8(%rsp)
+ movq %rdi, -8(%rsp)
fldcw -8(%rsp)
ret
EPILOGUE()
@@ -41,17 +37,17 @@ C
C Execute an fstcw, returning the current x87 control word.
PROLOGUE(x86_fstcw)
- movq $0, -8(%rsp)
- fstcw -8(%rsp)
- mov -8(%rsp), %rax
+ movq $0, -8(%rsp)
+ fstcw -8(%rsp)
+ movq -8(%rsp), %rax
ret
EPILOGUE()
-dnl Instrumented profiling won't come out quite right below, since we don't do
-dnl an actual "ret". There's only a few instructions here, so there's no
-dnl great need to get them separately accounted, just let them get attributed
-dnl to the caller. FIXME this comment might no longer be true.
+dnl Instrumented profiling won't come out quite right below, since we don't
+dnl do an actual "ret". There's only a few instructions here, so there's
+dnl no great need to get them separately accounted, just let them get
+dnl attributed to the caller.
ifelse(WANT_PROFILING,instrument,
`define(`WANT_PROFILING',no)')
@@ -101,67 +97,69 @@ m4_assert_numargs(1)
TEXT
ALIGN(32)
PROLOGUE(calling_conventions)
- mov G(calling_conventions_values)@GOTPCREL(%rip), %rax
- pop RETADDR(%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
- 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 mov JUNK_RAX(%rax), %rax C overwritten below anyway
- mov JUNK_R10(%rax), %r10
- mov JUNK_R11(%rax), %r11
-
- mov G(calling_conventions_function)@GOTPCREL(%rip), %rax
- call *(%rax)
-
- mov G(calling_conventions_values)@GOTPCREL(%rip), %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)
-
- pushf
- pop %rbx
- mov %rbx, RFLAGS(%rcx)
-
- 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
-C mov JUNK_R8(%rcx), %r8
-C mov JUNK_RCX(%rcx), %rcx
-C mov JUNK_RDX(%rcx), %rdx
-C mov JUNK_RSI(%rcx), %rsi
-C mov JUNK_RDI(%rcx), %rdi
-
- push RETADDR(%rcx)
-
- mov G(calling_conventions_fenv)@GOTPCREL(%rip), %rcx
- fstenv (%rcx)
+ push %rdi
+ movq G(calling_conventions_values)@GOTPCREL(%rip), %rdi
+
+ movq 8(%rsp), %rax
+ movq %rax, RETADDR(%rdi)
+
+ leaq L(return)(%rip), %rax
+ movq %rax, 8(%rsp)
+
+ movq %rbx, SAVE_RBX(%rdi)
+ movq %rbp, SAVE_RBP(%rdi)
+ movq %r12, SAVE_R12(%rdi)
+ movq %r13, SAVE_R13(%rdi)
+ movq %r14, SAVE_R14(%rdi)
+ movq %r15, SAVE_R15(%rdi)
+
+ C values we expect to see unchanged, as per amd64check.c
+ movq WANT_RBX(%rdi), %rbx
+ movq WANT_RBP(%rdi), %rbp
+ movq WANT_R12(%rdi), %r12
+ movq WANT_R13(%rdi), %r13
+ movq WANT_R14(%rdi), %r14
+ movq WANT_R15(%rdi), %r15
+
+ C Try to provoke a problem by starting with junk in the registers,
+ C especially %rax which will be the return value.
+ C
+ C ENHANCE-ME: If we knew how many of the parameter registers were
+ C actually being used we could put junk in the rest. Maybe we could
+ C get try.c to communicate this to us.
+C movq JUNK_RAX(%rdi), %rax C overwritten below anyway
+ movq JUNK_R10(%rdi), %r10
+ movq JUNK_R11(%rdi), %r11
+
+ movq G(calling_conventions_function)@GOTPCREL(%rip), %rax
+ pop %rdi
+ jmp *(%rax)
+
+L(return):
+ movq G(calling_conventions_values)@GOTPCREL(%rip), %rdi
+
+ movq %rbx, RBX(%rdi)
+ movq %rbp, RBP(%rdi)
+ movq %r12, R12(%rdi)
+ movq %r13, R13(%rdi)
+ movq %r14, R14(%rdi)
+ movq %r15, R15(%rdi)
+
+ pushfq
+ popq %rbx
+ movq %rbx, RFLAGS(%rdi)
+
+ movq G(calling_conventions_fenv)@GOTPCREL(%rip), %rbx
+ fstenv (%rbx)
finit
- ret
+ movq SAVE_RBX(%rdi), %rbx
+ movq SAVE_RBP(%rdi), %rbp
+ movq SAVE_R12(%rdi), %r12
+ movq SAVE_R13(%rdi), %r13
+ movq SAVE_R14(%rdi), %r14
+ movq SAVE_R15(%rdi), %r15
+
+ jmp *RETADDR(%rdi)
EPILOGUE()
diff --git a/gmp/tests/amd64check.c b/gmp/tests/amd64check.c
index 1b28d8c7ae..14420257ef 100644
--- a/gmp/tests/amd64check.c
+++ b/gmp/tests/amd64check.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001, 2004, 2007 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include "gmp.h"
@@ -25,18 +25,18 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
/* Vector if constants and register values. We use one vector to allow access
via a base pointer, very beneficial for the PIC-enabled amd64call.asm. */
-mp_limb_t calling_conventions_values[23] =
+long calling_conventions_values[23] =
{
- CNST_LIMB(0x1234567887654321), /* want_rbx */
- CNST_LIMB(0x89ABCDEFFEDCBA98), /* want_rbp */
- CNST_LIMB(0xDEADBEEFBADECAFE), /* want_r12 */
- CNST_LIMB(0xFFEEDDCCBBAA9988), /* want_r13 */
- CNST_LIMB(0x0011223344556677), /* want_r14 */
- CNST_LIMB(0x1234432156788765), /* want_r15 */
+ 0x1234567887654321L, /* want_rbx */
+ 0x89ABCDEFFEDCBA98L, /* want_rbp */
+ 0xDEADBEEFBADECAFEL, /* want_r12 */
+ 0xFFEEDDCCBBAA9988L, /* want_r13 */
+ 0x0011223344556677L, /* want_r14 */
+ 0x1234432156788765L, /* want_r15 */
- CNST_LIMB(0xFEEDABBACAAFBEED), /* JUNK_RAX */
- CNST_LIMB(0xAB78DE89FF5125BB), /* JUNK_R10 */
- CNST_LIMB(0x1238901890189031) /* JUNK_R11 */
+ 0xFEEDABBACAAFBEED, /* JUNK_RAX */
+ 0xAB78DE89FF5125BB, /* JUNK_R10 */
+ 0x1238901890189031 /* JUNK_R11 */
/* rest of array used for dynamic values. */
};
@@ -58,7 +58,7 @@ struct {
} calling_conventions_fenv;
-const char *regname[6] = {"rbx", "rbp", "r12", "r13", "r14", "r15"};
+char *regname[6] = {"rbx", "rbp", "r12", "r13", "r14", "r15"};
#define DIR_BIT(rflags) (((rflags) & (1<<10)) != 0)
diff --git a/gmp/tests/arm32call.asm b/gmp/tests/arm32call.asm
deleted file mode 100644
index e689c5a4f0..0000000000
--- a/gmp/tests/arm32call.asm
+++ /dev/null
@@ -1,83 +0,0 @@
-dnl ARM32 calling conventions checking.
-
-dnl Copyright 2000, 2003, 2004, 2006, 2007, 2010, 2013 Free Software
-dnl Foundation, Inc.
-
-dnl This file is part of the GNU MP Library test suite.
-
-dnl The GNU MP Library test suite is free software; you can redistribute it
-dnl and/or modify it under the terms of the GNU 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 test suite is distributed in the hope that it will be
-dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-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 https://www.gnu.org/licenses/.
-
-
-dnl The current version of the code attempts to keep the call/return
-dnl prediction stack valid, but matching calls and returns.
-
-include(`../config.m4')
-
-
-C int calling_conventions (...);
-C
-C The global variable "calling_conventions_function" is the function to
-C call, with the arguments as passed here.
-
-define(`WANT_CALLEE_SAVES', eval(4*0))
-define(`SAVE_CALLEE_SAVES', eval(4*8))
-define(`RETADDR', eval(4*16))
-define(`GOT_CALLEE_SAVES', eval(4*17))
-define(`JUNK_PARAMS', eval(4*25))
-
- TEXT
- ALIGN(32)
-PROLOGUE(calling_conventions)
- LEA( r12, calling_conventions_values)
-
- C Preserve callee-saves registers, including the link register r14
- add r12, r12, #SAVE_CALLEE_SAVES
- stm r12, {r4-r11,r14}
- sub r12, r12, #SAVE_CALLEE_SAVES
-
- C Put chosen junk into callee-saves registers
- add r12, r12, #WANT_CALLEE_SAVES
- ldm r12, {r4-r11}
- sub r12, r12, #WANT_CALLEE_SAVES
-
- C No callee-saves registers on arm except r12 and parameter registers
- C
-
- C Make the actual call
- LEA( r12, calling_conventions_function)
- ldr r12, [r12]
- mov r14, pc
- bx r12
-
- LEA( r12, calling_conventions_values)
-
- C Save callee-saves registers after call
- add r12, r12, #GOT_CALLEE_SAVES
- stm r12, {r4-r11}
- sub r12, r12, #GOT_CALLEE_SAVES
-
- C Restore callee-saves registers, including the link register r14
- add r12, r12, #SAVE_CALLEE_SAVES
- ldm r12, {r4-r11,r14}
- sub r12, r12, #SAVE_CALLEE_SAVES
-
- C Overwrite parameter registers. Note that we overwrite r1, which
- C could hold one half of a 64-bit return value, since we don't use that
- C in GMP.
- add r12, r12, #JUNK_PARAMS
- ldm r12, {r1-r3}
-
- bx r14
-EPILOGUE()
diff --git a/gmp/tests/arm32check.c b/gmp/tests/arm32check.c
deleted file mode 100644
index f4bf06684c..0000000000
--- a/gmp/tests/arm32check.c
+++ /dev/null
@@ -1,96 +0,0 @@
-/* ARM32 calling conventions checking.
-
-Copyright 2000, 2001, 2004, 2007 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 "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-
-/* Vector if constants and register values. */
-mp_limb_t calling_conventions_values[29] =
-{
- 0x12345678, /* 0 want_r4 */
- 0x87654321, /* 1 want_r5 */
- 0x89ABCDEF, /* 2 want_r6 */
- 0xFEDCBA98, /* 3 want_r7 */
- 0xDEADBEEF, /* 4 want_r8 */
- 0xBADECAFE, /* 5 want_r9 */
- 0xFFEEDDCC, /* 6 want_r10 */
- 0xBBAA9988, /* 7 want_r11 */
-
- 0x00000000, /* 8 save_r4 */
- 0x00000000, /* 9 save_r5 */
- 0x00000000, /* 10 save_r6 */
- 0x00000000, /* 11 save_r7 */
- 0x00000000, /* 12 save_r8 */
- 0x00000000, /* 13 save_r9 */
- 0x00000000, /* 14 save_r10 */
- 0x00000000, /* 15 save_r11 */
- 0x00000000, /* 16 save_r14 */
-
- 0x00000000, /* 17 got_r4 */
- 0x00000000, /* 18 got_r5 */
- 0x00000000, /* 19 got_r6 */
- 0x00000000, /* 20 got_r7 */
- 0x00000000, /* 21 got_r8 */
- 0x00000000, /* 22 got_r9 */
- 0x00000000, /* 23 got_r10 */
- 0x00000000, /* 24 got_r11 */
-
- 0x00112233, /* 25 junk_r0 */
- 0x44556677, /* 26 junk_r1 */
- 0x12344321, /* 27 junk_r2 */
- 0x56788765, /* 28 junk_r3 */
-};
-
-/* Index starts for various regions in above vector. */
-#define WANT_CALLEE_SAVES 0
-#define SAVE_CALLEE_SAVES 8
-#define RETADDR 16
-#define GOT_CALLEE_SAVES 17
-#define JUNK_PARAMS 25
-
-/* Return 1 if ok, 0 if not */
-
-int
-calling_conventions_check (void)
-{
- const char *header = "Violated calling conventions:\n";
- int ret = 1;
- int i;
-
-#define CHECK(callreg, regnum, value) \
- if (callreg != value) \
- { \
- printf ("%s r%d got 0x%08lX want 0x%08lX\n", \
- header, regnum, callreg, value); \
- header = ""; \
- ret = 0; \
- }
-
- for (i = 0; i < 8; i++)
- {
- CHECK (calling_conventions_values[GOT_CALLEE_SAVES + i],
- i + 4,
- calling_conventions_values[WANT_CALLEE_SAVES + i]);
- }
-
- return ret;
-}
diff --git a/gmp/tests/cxx/Makefile.am b/gmp/tests/cxx/Makefile.am
index a5428d5d76..41764ee6cc 100644
--- a/gmp/tests/cxx/Makefile.am
+++ b/gmp/tests/cxx/Makefile.am
@@ -1,43 +1,37 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2001-2004 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# LDADD has an explicit -L of $(top_builddir)/.libs for the benefit of gcc
# 3.2 on itanium2-hp-hpux11.22. Without this option, the libgmp.sl.6
# required by libgmpxx.sl (ie. in its NEEDED records) is not found by the
# linker. FIXME: Presumably libtool should do something about this itself.
-# -lm is needed for t-ops2 which compares the results of trunc and mpf_trunc.
#
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = -L$(top_builddir)/.libs \
$(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la \
- $(top_builddir)/libgmp.la \
- -lm
+ $(top_builddir)/libgmp.la
if WANT_CXX
-check_PROGRAMS = t-binary t-cast t-cxx11 \
- t-headers t-iostream t-istream t-locale t-misc t-mix \
- t-ops t-ops2 t-ops3 t-ostream t-prec \
- t-ternary t-unary \
- t-do-exceptions-work-at-all-with-this-compiler \
- t-assign t-constr t-rand
+check_PROGRAMS = t-assign t-binary t-cast t-constr t-headers \
+ t-istream t-locale t-misc t-ops t-ostream t-prec t-rand t-ternary t-unary
TESTS = $(check_PROGRAMS)
endif
@@ -45,23 +39,16 @@ t_assign_SOURCES = t-assign.cc
t_binary_SOURCES = t-binary.cc
t_cast_SOURCES = t-cast.cc
t_constr_SOURCES = t-constr.cc
-t_cxx11_SOURCES = t-cxx11.cc
t_headers_SOURCES = t-headers.cc
-t_iostream_SOURCES= t-iostream.cc
t_istream_SOURCES = t-istream.cc
t_locale_SOURCES = t-locale.cc clocale.c
t_misc_SOURCES = t-misc.cc
-t_mix_SOURCES = t-mix.cc
t_ops_SOURCES = t-ops.cc
-t_ops2_SOURCES = t-ops2.cc
-t_ops3_SOURCES = t-ops3.cc
t_ostream_SOURCES = t-ostream.cc
t_prec_SOURCES = t-prec.cc
t_rand_SOURCES = t-rand.cc
t_ternary_SOURCES = t-ternary.cc
t_unary_SOURCES = t-unary.cc
-t_do_exceptions_work_at_all_with_this_compiler_SOURCES = \
- t-do-exceptions-work-at-all-with-this-compiler.cc
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/gmp/tests/cxx/Makefile.in b/gmp/tests/cxx/Makefile.in
index 04e7520854..1a440d0c1f 100644
--- a/gmp/tests/cxx/Makefile.in
+++ b/gmp/tests/cxx/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,45 +14,33 @@
@SET_MAKE@
-# Copyright 2001-2004 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(t_assign_SOURCES) $(t_binary_SOURCES) $(t_cast_SOURCES) $(t_constr_SOURCES) $(t_headers_SOURCES) $(t_istream_SOURCES) $(t_locale_SOURCES) $(t_misc_SOURCES) $(t_ops_SOURCES) $(t_ostream_SOURCES) $(t_prec_SOURCES) $(t_rand_SOURCES) $(t_ternary_SOURCES) $(t_unary_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,30 +52,25 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
-@WANT_CXX_TRUE@check_PROGRAMS = t-binary$(EXEEXT) t-cast$(EXEEXT) \
-@WANT_CXX_TRUE@ t-cxx11$(EXEEXT) t-headers$(EXEEXT) \
-@WANT_CXX_TRUE@ t-iostream$(EXEEXT) t-istream$(EXEEXT) \
+ANSI2KNR = $(top_builddir)/ansi2knr
+@WANT_CXX_TRUE@check_PROGRAMS = t-assign$(EXEEXT) t-binary$(EXEEXT) \
+@WANT_CXX_TRUE@ t-cast$(EXEEXT) t-constr$(EXEEXT) \
+@WANT_CXX_TRUE@ t-headers$(EXEEXT) t-istream$(EXEEXT) \
@WANT_CXX_TRUE@ t-locale$(EXEEXT) t-misc$(EXEEXT) \
-@WANT_CXX_TRUE@ t-mix$(EXEEXT) t-ops$(EXEEXT) t-ops2$(EXEEXT) \
-@WANT_CXX_TRUE@ t-ops3$(EXEEXT) t-ostream$(EXEEXT) \
-@WANT_CXX_TRUE@ t-prec$(EXEEXT) t-ternary$(EXEEXT) \
-@WANT_CXX_TRUE@ t-unary$(EXEEXT) \
-@WANT_CXX_TRUE@ t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT) \
-@WANT_CXX_TRUE@ t-assign$(EXEEXT) t-constr$(EXEEXT) \
-@WANT_CXX_TRUE@ t-rand$(EXEEXT)
+@WANT_CXX_TRUE@ t-ops$(EXEEXT) t-ostream$(EXEEXT) \
+@WANT_CXX_TRUE@ t-prec$(EXEEXT) t-rand$(EXEEXT) \
+@WANT_CXX_TRUE@ t-ternary$(EXEEXT) t-unary$(EXEEXT)
subdir = tests/cxx
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
am_t_assign_OBJECTS = t-assign.$(OBJEXT)
t_assign_OBJECTS = $(am_t_assign_OBJECTS)
t_assign_LDADD = $(LDADD)
@@ -109,35 +91,17 @@ t_constr_OBJECTS = $(am_t_constr_OBJECTS)
t_constr_LDADD = $(LDADD)
t_constr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-am_t_cxx11_OBJECTS = t-cxx11.$(OBJEXT)
-t_cxx11_OBJECTS = $(am_t_cxx11_OBJECTS)
-t_cxx11_LDADD = $(LDADD)
-t_cxx11_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-am_t_do_exceptions_work_at_all_with_this_compiler_OBJECTS = \
- t-do-exceptions-work-at-all-with-this-compiler.$(OBJEXT)
-t_do_exceptions_work_at_all_with_this_compiler_OBJECTS = \
- $(am_t_do_exceptions_work_at_all_with_this_compiler_OBJECTS)
-t_do_exceptions_work_at_all_with_this_compiler_LDADD = $(LDADD)
-t_do_exceptions_work_at_all_with_this_compiler_DEPENDENCIES = \
- $(top_builddir)/tests/libtests.la $(top_builddir)/libgmpxx.la \
- $(top_builddir)/libgmp.la
am_t_headers_OBJECTS = t-headers.$(OBJEXT)
t_headers_OBJECTS = $(am_t_headers_OBJECTS)
t_headers_LDADD = $(LDADD)
t_headers_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-am_t_iostream_OBJECTS = t-iostream.$(OBJEXT)
-t_iostream_OBJECTS = $(am_t_iostream_OBJECTS)
-t_iostream_LDADD = $(LDADD)
-t_iostream_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
am_t_istream_OBJECTS = t-istream.$(OBJEXT)
t_istream_OBJECTS = $(am_t_istream_OBJECTS)
t_istream_LDADD = $(LDADD)
t_istream_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-am_t_locale_OBJECTS = t-locale.$(OBJEXT) clocale.$(OBJEXT)
+am_t_locale_OBJECTS = t-locale.$(OBJEXT) clocale$U.$(OBJEXT)
t_locale_OBJECTS = $(am_t_locale_OBJECTS)
t_locale_LDADD = $(LDADD)
t_locale_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
@@ -147,26 +111,11 @@ t_misc_OBJECTS = $(am_t_misc_OBJECTS)
t_misc_LDADD = $(LDADD)
t_misc_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-am_t_mix_OBJECTS = t-mix.$(OBJEXT)
-t_mix_OBJECTS = $(am_t_mix_OBJECTS)
-t_mix_LDADD = $(LDADD)
-t_mix_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
am_t_ops_OBJECTS = t-ops.$(OBJEXT)
t_ops_OBJECTS = $(am_t_ops_OBJECTS)
t_ops_LDADD = $(LDADD)
t_ops_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-am_t_ops2_OBJECTS = t-ops2.$(OBJEXT)
-t_ops2_OBJECTS = $(am_t_ops2_OBJECTS)
-t_ops2_LDADD = $(LDADD)
-t_ops2_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-am_t_ops3_OBJECTS = t-ops3.$(OBJEXT)
-t_ops3_OBJECTS = $(am_t_ops3_OBJECTS)
-t_ops3_LDADD = $(LDADD)
-t_ops3_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
am_t_ostream_OBJECTS = t-ostream.$(OBJEXT)
t_ostream_OBJECTS = $(am_t_ostream_OBJECTS)
t_ostream_LDADD = $(LDADD)
@@ -192,52 +141,37 @@ t_unary_OBJECTS = $(am_t_unary_OBJECTS)
t_unary_LDADD = $(LDADD)
t_unary_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la $(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
-LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
+LTCXXCOMPILE = $(LIBTOOL) --mode=compile $(CXX) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CXXFLAGS) $(CXXFLAGS)
CXXLD = $(CXX)
-CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+CXXLINK = $(LIBTOOL) --mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(t_assign_SOURCES) $(t_binary_SOURCES) $(t_cast_SOURCES) \
- $(t_constr_SOURCES) $(t_cxx11_SOURCES) \
- $(t_do_exceptions_work_at_all_with_this_compiler_SOURCES) \
- $(t_headers_SOURCES) $(t_iostream_SOURCES) \
- $(t_istream_SOURCES) $(t_locale_SOURCES) $(t_misc_SOURCES) \
- $(t_mix_SOURCES) $(t_ops_SOURCES) $(t_ops2_SOURCES) \
- $(t_ops3_SOURCES) $(t_ostream_SOURCES) $(t_prec_SOURCES) \
- $(t_rand_SOURCES) $(t_ternary_SOURCES) $(t_unary_SOURCES)
+ $(t_constr_SOURCES) $(t_headers_SOURCES) $(t_istream_SOURCES) \
+ $(t_locale_SOURCES) $(t_misc_SOURCES) $(t_ops_SOURCES) \
+ $(t_ostream_SOURCES) $(t_prec_SOURCES) $(t_rand_SOURCES) \
+ $(t_ternary_SOURCES) $(t_unary_SOURCES)
DIST_SOURCES = $(t_assign_SOURCES) $(t_binary_SOURCES) \
- $(t_cast_SOURCES) $(t_constr_SOURCES) $(t_cxx11_SOURCES) \
- $(t_do_exceptions_work_at_all_with_this_compiler_SOURCES) \
- $(t_headers_SOURCES) $(t_iostream_SOURCES) \
+ $(t_cast_SOURCES) $(t_constr_SOURCES) $(t_headers_SOURCES) \
$(t_istream_SOURCES) $(t_locale_SOURCES) $(t_misc_SOURCES) \
- $(t_mix_SOURCES) $(t_ops_SOURCES) $(t_ops2_SOURCES) \
- $(t_ops3_SOURCES) $(t_ostream_SOURCES) $(t_prec_SOURCES) \
+ $(t_ops_SOURCES) $(t_ostream_SOURCES) $(t_prec_SOURCES) \
$(t_rand_SOURCES) $(t_ternary_SOURCES) $(t_unary_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -249,6 +183,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -264,17 +199,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -288,12 +222,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -308,26 +240,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -337,31 +263,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -385,6 +306,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -392,49 +314,35 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
# LDADD has an explicit -L of $(top_builddir)/.libs for the benefit of gcc
# 3.2 on itanium2-hp-hpux11.22. Without this option, the libgmp.sl.6
# required by libgmpxx.sl (ie. in its NEEDED records) is not found by the
# linker. FIXME: Presumably libtool should do something about this itself.
-# -lm is needed for t-ops2 which compares the results of trunc and mpf_trunc.
#
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = -L$(top_builddir)/.libs \
$(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmpxx.la \
- $(top_builddir)/libgmp.la \
- -lm
+ $(top_builddir)/libgmp.la
@WANT_CXX_TRUE@TESTS = $(check_PROGRAMS)
t_assign_SOURCES = t-assign.cc
t_binary_SOURCES = t-binary.cc
t_cast_SOURCES = t-cast.cc
t_constr_SOURCES = t-constr.cc
-t_cxx11_SOURCES = t-cxx11.cc
t_headers_SOURCES = t-headers.cc
-t_iostream_SOURCES = t-iostream.cc
t_istream_SOURCES = t-istream.cc
t_locale_SOURCES = t-locale.cc clocale.c
t_misc_SOURCES = t-misc.cc
-t_mix_SOURCES = t-mix.cc
t_ops_SOURCES = t-ops.cc
-t_ops2_SOURCES = t-ops2.cc
-t_ops3_SOURCES = t-ops3.cc
t_ostream_SOURCES = t-ostream.cc
t_prec_SOURCES = t-prec.cc
t_rand_SOURCES = t-rand.cc
t_ternary_SOURCES = t-ternary.cc
t_unary_SOURCES = t-unary.cc
-t_do_exceptions_work_at_all_with_this_compiler_SOURCES = \
- t-do-exceptions-work-at-all-with-this-compiler.cc
-
# Libtool (1.5) somehow botches its uninstalled shared library setups on
# OpenBSD 3.2, making the C++ test programs here fail. libgmpxx.so ends up
@@ -456,14 +364,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/cxx/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/cxx/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/cxx/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/cxx/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -481,82 +389,66 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-t-assign$(EXEEXT): $(t_assign_OBJECTS) $(t_assign_DEPENDENCIES) $(EXTRA_t_assign_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+t-assign$(EXEEXT): $(t_assign_OBJECTS) $(t_assign_DEPENDENCIES)
@rm -f t-assign$(EXEEXT)
- $(CXXLINK) $(t_assign_OBJECTS) $(t_assign_LDADD) $(LIBS)
-t-binary$(EXEEXT): $(t_binary_OBJECTS) $(t_binary_DEPENDENCIES) $(EXTRA_t_binary_DEPENDENCIES)
+ $(CXXLINK) $(t_assign_LDFLAGS) $(t_assign_OBJECTS) $(t_assign_LDADD) $(LIBS)
+t-binary$(EXEEXT): $(t_binary_OBJECTS) $(t_binary_DEPENDENCIES)
@rm -f t-binary$(EXEEXT)
- $(CXXLINK) $(t_binary_OBJECTS) $(t_binary_LDADD) $(LIBS)
-t-cast$(EXEEXT): $(t_cast_OBJECTS) $(t_cast_DEPENDENCIES) $(EXTRA_t_cast_DEPENDENCIES)
+ $(CXXLINK) $(t_binary_LDFLAGS) $(t_binary_OBJECTS) $(t_binary_LDADD) $(LIBS)
+t-cast$(EXEEXT): $(t_cast_OBJECTS) $(t_cast_DEPENDENCIES)
@rm -f t-cast$(EXEEXT)
- $(CXXLINK) $(t_cast_OBJECTS) $(t_cast_LDADD) $(LIBS)
-t-constr$(EXEEXT): $(t_constr_OBJECTS) $(t_constr_DEPENDENCIES) $(EXTRA_t_constr_DEPENDENCIES)
+ $(CXXLINK) $(t_cast_LDFLAGS) $(t_cast_OBJECTS) $(t_cast_LDADD) $(LIBS)
+t-constr$(EXEEXT): $(t_constr_OBJECTS) $(t_constr_DEPENDENCIES)
@rm -f t-constr$(EXEEXT)
- $(CXXLINK) $(t_constr_OBJECTS) $(t_constr_LDADD) $(LIBS)
-t-cxx11$(EXEEXT): $(t_cxx11_OBJECTS) $(t_cxx11_DEPENDENCIES) $(EXTRA_t_cxx11_DEPENDENCIES)
- @rm -f t-cxx11$(EXEEXT)
- $(CXXLINK) $(t_cxx11_OBJECTS) $(t_cxx11_LDADD) $(LIBS)
-t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT): $(t_do_exceptions_work_at_all_with_this_compiler_OBJECTS) $(t_do_exceptions_work_at_all_with_this_compiler_DEPENDENCIES) $(EXTRA_t_do_exceptions_work_at_all_with_this_compiler_DEPENDENCIES)
- @rm -f t-do-exceptions-work-at-all-with-this-compiler$(EXEEXT)
- $(CXXLINK) $(t_do_exceptions_work_at_all_with_this_compiler_OBJECTS) $(t_do_exceptions_work_at_all_with_this_compiler_LDADD) $(LIBS)
-t-headers$(EXEEXT): $(t_headers_OBJECTS) $(t_headers_DEPENDENCIES) $(EXTRA_t_headers_DEPENDENCIES)
+ $(CXXLINK) $(t_constr_LDFLAGS) $(t_constr_OBJECTS) $(t_constr_LDADD) $(LIBS)
+t-headers$(EXEEXT): $(t_headers_OBJECTS) $(t_headers_DEPENDENCIES)
@rm -f t-headers$(EXEEXT)
- $(CXXLINK) $(t_headers_OBJECTS) $(t_headers_LDADD) $(LIBS)
-t-iostream$(EXEEXT): $(t_iostream_OBJECTS) $(t_iostream_DEPENDENCIES) $(EXTRA_t_iostream_DEPENDENCIES)
- @rm -f t-iostream$(EXEEXT)
- $(CXXLINK) $(t_iostream_OBJECTS) $(t_iostream_LDADD) $(LIBS)
-t-istream$(EXEEXT): $(t_istream_OBJECTS) $(t_istream_DEPENDENCIES) $(EXTRA_t_istream_DEPENDENCIES)
+ $(CXXLINK) $(t_headers_LDFLAGS) $(t_headers_OBJECTS) $(t_headers_LDADD) $(LIBS)
+t-istream$(EXEEXT): $(t_istream_OBJECTS) $(t_istream_DEPENDENCIES)
@rm -f t-istream$(EXEEXT)
- $(CXXLINK) $(t_istream_OBJECTS) $(t_istream_LDADD) $(LIBS)
-t-locale$(EXEEXT): $(t_locale_OBJECTS) $(t_locale_DEPENDENCIES) $(EXTRA_t_locale_DEPENDENCIES)
+ $(CXXLINK) $(t_istream_LDFLAGS) $(t_istream_OBJECTS) $(t_istream_LDADD) $(LIBS)
+t-locale$(EXEEXT): $(t_locale_OBJECTS) $(t_locale_DEPENDENCIES)
@rm -f t-locale$(EXEEXT)
- $(CXXLINK) $(t_locale_OBJECTS) $(t_locale_LDADD) $(LIBS)
-t-misc$(EXEEXT): $(t_misc_OBJECTS) $(t_misc_DEPENDENCIES) $(EXTRA_t_misc_DEPENDENCIES)
+ $(CXXLINK) $(t_locale_LDFLAGS) $(t_locale_OBJECTS) $(t_locale_LDADD) $(LIBS)
+t-misc$(EXEEXT): $(t_misc_OBJECTS) $(t_misc_DEPENDENCIES)
@rm -f t-misc$(EXEEXT)
- $(CXXLINK) $(t_misc_OBJECTS) $(t_misc_LDADD) $(LIBS)
-t-mix$(EXEEXT): $(t_mix_OBJECTS) $(t_mix_DEPENDENCIES) $(EXTRA_t_mix_DEPENDENCIES)
- @rm -f t-mix$(EXEEXT)
- $(CXXLINK) $(t_mix_OBJECTS) $(t_mix_LDADD) $(LIBS)
-t-ops$(EXEEXT): $(t_ops_OBJECTS) $(t_ops_DEPENDENCIES) $(EXTRA_t_ops_DEPENDENCIES)
+ $(CXXLINK) $(t_misc_LDFLAGS) $(t_misc_OBJECTS) $(t_misc_LDADD) $(LIBS)
+t-ops$(EXEEXT): $(t_ops_OBJECTS) $(t_ops_DEPENDENCIES)
@rm -f t-ops$(EXEEXT)
- $(CXXLINK) $(t_ops_OBJECTS) $(t_ops_LDADD) $(LIBS)
-t-ops2$(EXEEXT): $(t_ops2_OBJECTS) $(t_ops2_DEPENDENCIES) $(EXTRA_t_ops2_DEPENDENCIES)
- @rm -f t-ops2$(EXEEXT)
- $(CXXLINK) $(t_ops2_OBJECTS) $(t_ops2_LDADD) $(LIBS)
-t-ops3$(EXEEXT): $(t_ops3_OBJECTS) $(t_ops3_DEPENDENCIES) $(EXTRA_t_ops3_DEPENDENCIES)
- @rm -f t-ops3$(EXEEXT)
- $(CXXLINK) $(t_ops3_OBJECTS) $(t_ops3_LDADD) $(LIBS)
-t-ostream$(EXEEXT): $(t_ostream_OBJECTS) $(t_ostream_DEPENDENCIES) $(EXTRA_t_ostream_DEPENDENCIES)
+ $(CXXLINK) $(t_ops_LDFLAGS) $(t_ops_OBJECTS) $(t_ops_LDADD) $(LIBS)
+t-ostream$(EXEEXT): $(t_ostream_OBJECTS) $(t_ostream_DEPENDENCIES)
@rm -f t-ostream$(EXEEXT)
- $(CXXLINK) $(t_ostream_OBJECTS) $(t_ostream_LDADD) $(LIBS)
-t-prec$(EXEEXT): $(t_prec_OBJECTS) $(t_prec_DEPENDENCIES) $(EXTRA_t_prec_DEPENDENCIES)
+ $(CXXLINK) $(t_ostream_LDFLAGS) $(t_ostream_OBJECTS) $(t_ostream_LDADD) $(LIBS)
+t-prec$(EXEEXT): $(t_prec_OBJECTS) $(t_prec_DEPENDENCIES)
@rm -f t-prec$(EXEEXT)
- $(CXXLINK) $(t_prec_OBJECTS) $(t_prec_LDADD) $(LIBS)
-t-rand$(EXEEXT): $(t_rand_OBJECTS) $(t_rand_DEPENDENCIES) $(EXTRA_t_rand_DEPENDENCIES)
+ $(CXXLINK) $(t_prec_LDFLAGS) $(t_prec_OBJECTS) $(t_prec_LDADD) $(LIBS)
+t-rand$(EXEEXT): $(t_rand_OBJECTS) $(t_rand_DEPENDENCIES)
@rm -f t-rand$(EXEEXT)
- $(CXXLINK) $(t_rand_OBJECTS) $(t_rand_LDADD) $(LIBS)
-t-ternary$(EXEEXT): $(t_ternary_OBJECTS) $(t_ternary_DEPENDENCIES) $(EXTRA_t_ternary_DEPENDENCIES)
+ $(CXXLINK) $(t_rand_LDFLAGS) $(t_rand_OBJECTS) $(t_rand_LDADD) $(LIBS)
+t-ternary$(EXEEXT): $(t_ternary_OBJECTS) $(t_ternary_DEPENDENCIES)
@rm -f t-ternary$(EXEEXT)
- $(CXXLINK) $(t_ternary_OBJECTS) $(t_ternary_LDADD) $(LIBS)
-t-unary$(EXEEXT): $(t_unary_OBJECTS) $(t_unary_DEPENDENCIES) $(EXTRA_t_unary_DEPENDENCIES)
+ $(CXXLINK) $(t_ternary_LDFLAGS) $(t_ternary_OBJECTS) $(t_ternary_LDADD) $(LIBS)
+t-unary$(EXEEXT): $(t_unary_OBJECTS) $(t_unary_DEPENDENCIES)
@rm -f t-unary$(EXEEXT)
- $(CXXLINK) $(t_unary_OBJECTS) $(t_unary_LDADD) $(LIBS)
+ $(CXXLINK) $(t_unary_LDFLAGS) $(t_unary_OBJECTS) $(t_unary_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -566,6 +458,9 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+clocale_.c: clocale.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/clocale.c; then echo $(srcdir)/clocale.c; else echo clocale.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+clocale_.$(OBJEXT) clocale_.lo : $(ANSI2KNR)
.cc.o:
$(CXXCOMPILE) -c -o $@ $<
@@ -582,54 +477,54 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -637,8 +532,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -647,113 +541,91 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -773,22 +645,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -801,7 +667,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -809,38 +675,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -849,7 +695,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -860,28 +706,23 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/cxx/clocale.c b/gmp/tests/cxx/clocale.c
index 1bd6ed2f14..9c942b176d 100644
--- a/gmp/tests/cxx/clocale.c
+++ b/gmp/tests/cxx/clocale.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
diff --git a/gmp/tests/cxx/t-assign.cc b/gmp/tests/cxx/t-assign.cc
index ad10edd8a8..407f726265 100644
--- a/gmp/tests/cxx/t-assign.cc
+++ b/gmp/tests/cxx/t-assign.cc
@@ -1,21 +1,21 @@
/* Test mp*_class assignment operators.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -27,8 +27,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-using std::string;
-using std::invalid_argument;
+using namespace std;
void
@@ -186,35 +185,6 @@ check_mpz (void)
} catch (invalid_argument) {
}
}
-
- // swap(mpz_class &)
- {
- mpz_class a(123);
- mpz_class b(456);
- a.swap(b);
- a.swap(a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
-
- // swap(mpz_class &, mpz_class &)
- {
- mpz_class a(123);
- mpz_class b(456);
- ::swap(a, b);
- ::swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
- {
- using std::swap;
- mpz_class a(123);
- mpz_class b(456);
- swap(a, b);
- swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
}
void
@@ -287,7 +257,7 @@ check_mpq (void)
// operator=(unsigned short int)
{
unsigned short int a = 54321u;
- mpq_class b;
+ mpz_class b;
b = a; ASSERT_ALWAYS(b == 54321u);
}
@@ -372,35 +342,6 @@ check_mpq (void)
} catch (invalid_argument) {
}
}
-
- // swap(mpq_class &)
- {
- mpq_class a(3, 2);
- mpq_class b(-1, 4);
- a.swap(b);
- a.swap(a);
- ASSERT_ALWAYS(a == -.25);
- ASSERT_ALWAYS(b == 1.5);
- }
-
- // swap(mpq_class &, mpq_class &)
- {
- mpq_class a(3, 2);
- mpq_class b(-1, 4);
- ::swap(a, b);
- ::swap(a, a);
- ASSERT_ALWAYS(a == -.25);
- ASSERT_ALWAYS(b == 1.5);
- }
- {
- using std::swap;
- mpq_class a(3, 2);
- mpq_class b(-1, 4);
- swap(a, b);
- swap(a, a);
- ASSERT_ALWAYS(a == -.25);
- ASSERT_ALWAYS(b == 1.5);
- }
}
void
@@ -558,35 +499,6 @@ check_mpf (void)
} catch (invalid_argument) {
}
}
-
- // swap(mpf_class &)
- {
- mpf_class a(123);
- mpf_class b(456);
- a.swap(b);
- a.swap(a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
-
- // swap(mpf_class &, mpf_class &)
- {
- mpf_class a(123);
- mpf_class b(456);
- ::swap(a, b);
- ::swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
- {
- using std::swap;
- mpf_class a(123);
- mpf_class b(456);
- swap(a, b);
- swap(a, a);
- ASSERT_ALWAYS(a == 456);
- ASSERT_ALWAYS(b == 123);
- }
}
diff --git a/gmp/tests/cxx/t-binary.cc b/gmp/tests/cxx/t-binary.cc
index 09d202b226..8099662698 100644
--- a/gmp/tests/cxx/t-binary.cc
+++ b/gmp/tests/cxx/t-binary.cc
@@ -1,21 +1,21 @@
/* Test mp*_class binary expressions.
-Copyright 2001-2003, 2008, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -94,7 +94,6 @@ check_mpz (void)
{
mpz_class a(3), b(4);
mpz_class c(a * (-b)); ASSERT_ALWAYS(c == -12);
- c = c * (-b); ASSERT_ALWAYS(c == 48);
}
// template <class T, class U, class Op>
@@ -103,7 +102,6 @@ check_mpz (void)
mpz_class a(3), b(2), c(1);
mpz_class d;
d = (a % b) + c; ASSERT_ALWAYS(d == 2);
- d = (a % b) + d; ASSERT_ALWAYS(d == 3);
}
// template <class T, class U, class V, class Op>
@@ -148,8 +146,6 @@ check_mpz (void)
mpz_class a(3), b(5), c(7);
mpz_class d;
d = (a - b) * (-c); ASSERT_ALWAYS(d == 14);
- d = (b - d) * (-a); ASSERT_ALWAYS(d == 27);
- d = (a - b) * (-d); ASSERT_ALWAYS(d == 54);
}
{
@@ -219,7 +215,6 @@ check_mpq (void)
double c = 2.0;
mpq_class d;
d = a * (b + c); ASSERT_ALWAYS(d == 2);
- d = d * (b + c); ASSERT_ALWAYS(d == 6);
}
// template <class T, class U, class V, class Op>
@@ -234,7 +229,6 @@ check_mpq (void)
mpz_class b(1), c(4);
mpq_class d;
d = (b - c) * a; ASSERT_ALWAYS(d == -2);
- d = (b - c) * d; ASSERT_ALWAYS(d == 6);
}
// template <class T, class U, class Op>
@@ -243,7 +237,6 @@ check_mpq (void)
mpq_class a(1, 3), b(3, 4);
mpq_class c;
c = a * (-b); ASSERT_ALWAYS(c == -0.25);
- a = a * (-b); ASSERT_ALWAYS(a == -0.25);
}
// template <class T, class U, class Op>
@@ -251,7 +244,6 @@ check_mpq (void)
{
mpq_class a(1, 3), b(2, 3), c(1, 4);
mpq_class d((a / b) + c); ASSERT_ALWAYS(d == 0.75);
- c = (a / b) + c; ASSERT_ALWAYS(c == 0.75);
}
// template <class T, class U, class V, class Op>
@@ -277,17 +269,12 @@ check_mpq (void)
mpq_class a(1, 2), b(1, 4);
mpz_class c(1);
mpq_class d((a + b) - c); ASSERT_ALWAYS(d == -0.25);
- d = (a + d) - c; ASSERT_ALWAYS(d == -0.75);
- d = (a + d) - d.get_num(); ASSERT_ALWAYS(d == 2.75);
- d = (2 * d) * d.get_den(); ASSERT_ALWAYS(d == 22);
- d = (b * d) / -d.get_num(); ASSERT_ALWAYS(d == -0.25);
}
{
mpq_class a(1, 3), b(3, 2);
mpz_class c(2), d(4);
mpq_class e;
e = (a * b) / (c - d); ASSERT_ALWAYS(e == -0.25);
- e = (2 * e) / (c - d); ASSERT_ALWAYS(e == 0.25);
}
// template <class T, class U, class V, class W, class Op>
@@ -303,7 +290,6 @@ check_mpq (void)
signed int d = 4;
mpq_class e;
e = (c % d) / (a * b); ASSERT_ALWAYS(e == 10);
- e = (e.get_num() % d) / (2 / e); ASSERT_ALWAYS(e == 10);
}
// template <class T, class U, class V, class Op>
@@ -312,8 +298,6 @@ check_mpq (void)
mpq_class a(1, 3), b(3, 4), c(2, 5);
mpq_class d;
d = (a * b) / (-c); ASSERT_ALWAYS(d == -0.625);
- d = (c * d) / (-b); ASSERT_ALWAYS(3 * d == 1);
- d = (a * c) / (-d); ASSERT_ALWAYS(5 * d == -2);
}
}
@@ -366,7 +350,6 @@ check_mpf (void)
mpz_class b(2), c(1);
mpf_class d;
d = a * (b + c); ASSERT_ALWAYS(d == 9);
- a = a * (b + c); ASSERT_ALWAYS(a == 9);
}
// template <class T, class U, class V, class Op>
@@ -383,7 +366,6 @@ check_mpf (void)
mpf_class a(2), b(-3);
mpf_class c;
c = a * (-b); ASSERT_ALWAYS(c == 6);
- c = c * (-b); ASSERT_ALWAYS(c == 18);
}
// template <class T, class U, class Op>
@@ -392,7 +374,6 @@ check_mpf (void)
mpf_class a(3), b(4), c(5);
mpf_class d;
d = (a / b) - c; ASSERT_ALWAYS(d == -4.25);
- c = (a / b) - c; ASSERT_ALWAYS(c == -4.25);
}
// template <class T, class U, class V, class Op>
diff --git a/gmp/tests/cxx/t-cast.cc b/gmp/tests/cxx/t-cast.cc
index 117fd87b80..58fda585a1 100644
--- a/gmp/tests/cxx/t-cast.cc
+++ b/gmp/tests/cxx/t-cast.cc
@@ -2,20 +2,20 @@
Copyright 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "gmpxx.h"
diff --git a/gmp/tests/cxx/t-constr.cc b/gmp/tests/cxx/t-constr.cc
index 7a87f3cb04..6d588d31d3 100644
--- a/gmp/tests/cxx/t-constr.cc
+++ b/gmp/tests/cxx/t-constr.cc
@@ -1,21 +1,21 @@
/* Test mp*_class constructors.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -320,7 +320,6 @@ check_mpq (void)
const char *a = "FFFF";
int base = 16;
mpq_class b(a, base); ASSERT_ALWAYS(b == 65535u);
- mpq_class c(0, 1); ASSERT_ALWAYS(c == 0);
}
// mpq_class(const std::string &)
diff --git a/gmp/tests/cxx/t-cxx11.cc b/gmp/tests/cxx/t-cxx11.cc
deleted file mode 100644
index 758f016386..0000000000
--- a/gmp/tests/cxx/t-cxx11.cc
+++ /dev/null
@@ -1,220 +0,0 @@
-/* Test C++11 features
-
-Copyright 2011, 2012 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 "config.h"
-
-#include "gmp.h"
-#include "gmpxx.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-#if __GMPXX_USE_CXX11
-
-#include <utility>
-#include <type_traits>
-
-void check_noexcept ()
-{
- mpz_class z1, z2;
- mpq_class q1, q2;
- mpf_class f1, f2;
- static_assert(noexcept(z1 = std::move(z2)), "sorry");
- static_assert(noexcept(q1 = std::move(q2)), "sorry");
- static_assert(noexcept(f1 = std::move(f2)), "sorry");
- static_assert(noexcept(q1 = std::move(z1)), "sorry");
-}
-
-void check_common_type ()
-{
-#define CHECK_COMMON_TYPE(T, U, Res) \
- static_assert(std::is_same<std::common_type<T, U>::type, Res>::value, "sorry")
-#define CHECK_COMMON_TYPE_BUILTIN1(T, Res) \
- CHECK_COMMON_TYPE( signed char , T, Res); \
- CHECK_COMMON_TYPE(unsigned char , T, Res); \
- CHECK_COMMON_TYPE( signed short, T, Res); \
- CHECK_COMMON_TYPE(unsigned short, T, Res); \
- CHECK_COMMON_TYPE( signed int , T, Res); \
- CHECK_COMMON_TYPE(unsigned int , T, Res); \
- CHECK_COMMON_TYPE( signed long , T, Res); \
- CHECK_COMMON_TYPE(unsigned long , T, Res); \
- CHECK_COMMON_TYPE(float , T, Res); \
- CHECK_COMMON_TYPE(double, T, Res)
-#define CHECK_COMMON_TYPE_BUILTIN2(T, Res) \
- CHECK_COMMON_TYPE(T, signed char , Res); \
- CHECK_COMMON_TYPE(T, unsigned char , Res); \
- CHECK_COMMON_TYPE(T, signed short, Res); \
- CHECK_COMMON_TYPE(T, unsigned short, Res); \
- CHECK_COMMON_TYPE(T, signed int , Res); \
- CHECK_COMMON_TYPE(T, unsigned int , Res); \
- CHECK_COMMON_TYPE(T, signed long , Res); \
- CHECK_COMMON_TYPE(T, unsigned long , Res); \
- CHECK_COMMON_TYPE(T, float , Res); \
- CHECK_COMMON_TYPE(T, double, Res)
-#define CHECK_COMMON_TYPE_BUILTIN(T, Res) \
- CHECK_COMMON_TYPE_BUILTIN1(T, Res); \
- CHECK_COMMON_TYPE_BUILTIN2(T, Res)
- /* These would just work with implicit conversions */
- CHECK_COMMON_TYPE (mpz_class, mpq_class, mpq_class);
- CHECK_COMMON_TYPE (mpz_class, mpf_class, mpf_class);
- CHECK_COMMON_TYPE (mpf_class, mpq_class, mpf_class);
-
- CHECK_COMMON_TYPE_BUILTIN (mpz_class, mpz_class);
- CHECK_COMMON_TYPE_BUILTIN (mpq_class, mpq_class);
- CHECK_COMMON_TYPE_BUILTIN (mpf_class, mpf_class);
-
- mpz_class z; mpq_class q; mpf_class f;
-
- CHECK_COMMON_TYPE (decltype(-z), mpz_class, mpz_class);
- CHECK_COMMON_TYPE (decltype(-q), mpq_class, mpq_class);
- CHECK_COMMON_TYPE (decltype(-f), mpf_class, mpf_class);
-
- CHECK_COMMON_TYPE (decltype(-z), mpq_class, mpq_class);
- CHECK_COMMON_TYPE (decltype(-z), mpf_class, mpf_class);
- CHECK_COMMON_TYPE (decltype(-q), mpf_class, mpf_class);
-
- /* These require a common_type specialization */
- CHECK_COMMON_TYPE (decltype(-z), decltype(z+z), mpz_class);
- CHECK_COMMON_TYPE (decltype(-q), decltype(q+q), mpq_class);
- CHECK_COMMON_TYPE (decltype(-f), decltype(f+f), mpf_class);
-
- CHECK_COMMON_TYPE (decltype(-q), mpz_class, mpq_class);
- CHECK_COMMON_TYPE (decltype(-f), mpz_class, mpf_class);
- CHECK_COMMON_TYPE (decltype(-f), mpq_class, mpf_class);
-
- CHECK_COMMON_TYPE (decltype(-z), decltype(-q), mpq_class);
- CHECK_COMMON_TYPE (decltype(-z), decltype(-f), mpf_class);
- CHECK_COMMON_TYPE (decltype(-q), decltype(-f), mpf_class);
-
- /* These could be broken by a naive common_type specialization */
- CHECK_COMMON_TYPE (decltype(-z), decltype(-z), decltype(-z));
- CHECK_COMMON_TYPE (decltype(-q), decltype(-q), decltype(-q));
- CHECK_COMMON_TYPE (decltype(-f), decltype(-f), decltype(-f));
-
- /* Painful */
- CHECK_COMMON_TYPE_BUILTIN (decltype(-z), mpz_class);
- CHECK_COMMON_TYPE_BUILTIN (decltype(-q), mpq_class);
- CHECK_COMMON_TYPE_BUILTIN (decltype(-f), mpf_class);
-}
-
-template<class T, class U = T>
-void check_move_init ()
-{
- {
- // Delete moved-from x1
- T x1 = 3;
- U x2 = std::move(x1);
- ASSERT_ALWAYS (x2 == 3);
- }
- {
- // Assign to moved-from x1
- T x1 = 2;
- U x2 = std::move(x1);
- x1 = -7;
- ASSERT_ALWAYS (x1 == -7);
- ASSERT_ALWAYS (x2 == 2);
- }
-}
-
-template<class T, class U = T>
-void check_move_assign ()
-{
- {
- // Delete moved-from x1
- T x1 = 3; U x2;
- x2 = std::move(x1);
- ASSERT_ALWAYS (x2 == 3);
- }
- {
- // Assign to moved-from x1
- T x1 = 2; U x2;
- x2 = std::move(x1);
- x1 = -7;
- ASSERT_ALWAYS (x1 == -7);
- ASSERT_ALWAYS (x2 == 2);
- }
- {
- // Self move-assign (not necessary, but it happens to work...)
- T x = 4;
- x = std::move(x);
- ASSERT_ALWAYS (x == 4);
- }
-}
-
-void check_user_defined_literal ()
-{
- ASSERT_ALWAYS (123_mpz % 5 == 3);
- ASSERT_ALWAYS (-11_mpq / 22 == -.5);
- ASSERT_ALWAYS (112.5e-1_mpf * 4 == 45);
- {
- mpz_class ref ( "123456789abcdef0123456789abcdef0123", 16);
- ASSERT_ALWAYS (0x123456789abcdef0123456789abcdef0123_mpz == ref);
- }
-}
-
-// Check for explicit conversion to bool
-void implicit_bool(bool);
-int implicit_bool(...);
-
-void check_bool_conversion ()
-{
- const mpz_class zn = -2;
- const mpq_class qn = -2;
- const mpf_class fn = -2;
- const mpz_class z0 = 0;
- const mpq_class q0 = 0;
- const mpf_class f0 = 0;
- const mpz_class zp = +2;
- const mpq_class qp = +2;
- const mpf_class fp = +2;
- if (zn && qn && fn && zp && qp && fp && !z0 && !q0 && !f0)
- {
- if (z0 || q0 || f0) ASSERT_ALWAYS(false);
- }
- else ASSERT_ALWAYS(false);
- decltype(implicit_bool(zn)) zi = 1;
- decltype(implicit_bool(qn)) qi = 1;
- decltype(implicit_bool(fn)) fi = 1;
- (void)(zi+qi+fi);
-}
-
-int
-main (void)
-{
- tests_start();
-
- check_noexcept();
- check_common_type();
- check_move_init<mpz_class>();
- check_move_init<mpq_class>();
- check_move_init<mpf_class>();
- check_move_assign<mpz_class>();
- check_move_assign<mpq_class>();
- check_move_assign<mpf_class>();
- check_move_init<mpz_class,mpq_class>();
- check_move_assign<mpz_class,mpq_class>();
- check_user_defined_literal();
- check_bool_conversion();
-
- tests_end();
- return 0;
-}
-
-#else
-int main () { return 0; }
-#endif
diff --git a/gmp/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc b/gmp/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc
deleted file mode 100644
index 341a818b75..0000000000
--- a/gmp/tests/cxx/t-do-exceptions-work-at-all-with-this-compiler.cc
+++ /dev/null
@@ -1,38 +0,0 @@
-/* Test if the compiler has working try / throw / catch.
-
-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 <stdexcept>
-
-inline void
-throw_expr ()
-{
- throw std::invalid_argument ("Test");
-}
-
-using namespace std;
-
-int
-main ()
-{
- try
- {
- throw_expr();
- }
- catch (invalid_argument) { }
-}
diff --git a/gmp/tests/cxx/t-headers.cc b/gmp/tests/cxx/t-headers.cc
index 35f7a25c26..0f7b74f2c7 100644
--- a/gmp/tests/cxx/t-headers.cc
+++ b/gmp/tests/cxx/t-headers.cc
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "gmpxx.h"
diff --git a/gmp/tests/cxx/t-iostream.cc b/gmp/tests/cxx/t-iostream.cc
deleted file mode 100644
index 92bd917a97..0000000000
--- a/gmp/tests/cxx/t-iostream.cc
+++ /dev/null
@@ -1,107 +0,0 @@
-/* Test stream formatted input and output on mp*_class
-
-Copyright 2011 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 <sstream>
-
-#include "gmp.h"
-#include "gmpxx.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-using namespace std;
-
-// The tests are extremely basic. These functions just forward to the
-// ones tested in t-istream.cc and t-ostream.cc; we rely on those for
-// advanced tests and only check the syntax here.
-
-void
-checki ()
-{
- {
- istringstream i("123");
- mpz_class x;
- i >> x;
- ASSERT_ALWAYS (x == 123);
- }
- {
- istringstream i("3/4");
- mpq_class x;
- i >> x;
- ASSERT_ALWAYS (x == .75);
- }
- {
- istringstream i("1.5");
- mpf_class x;
- i >> x;
- ASSERT_ALWAYS (x == 1.5);
- }
-}
-
-void
-checko ()
-{
- {
- ostringstream o;
- mpz_class x=123;
- o << x;
- ASSERT_ALWAYS (o.str() == "123");
- }
- {
- ostringstream o;
- mpz_class x=123;
- o << (x+1);
- ASSERT_ALWAYS (o.str() == "124");
- }
- {
- ostringstream o;
- mpq_class x(3,4);
- o << x;
- ASSERT_ALWAYS (o.str() == "3/4");
- }
- {
- ostringstream o;
- mpq_class x(3,4);
- o << (x+1);
- ASSERT_ALWAYS (o.str() == "7/4");
- }
- {
- ostringstream o;
- mpf_class x=1.5;
- o << x;
- ASSERT_ALWAYS (o.str() == "1.5");
- }
- {
- ostringstream o;
- mpf_class x=1.5;
- o << (x+1);
- ASSERT_ALWAYS (o.str() == "2.5");
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- tests_start ();
-
- checki ();
- checko ();
-
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/cxx/t-istream.cc b/gmp/tests/cxx/t-istream.cc
index f04ae083f8..59600be166 100644
--- a/gmp/tests/cxx/t-istream.cc
+++ b/gmp/tests/cxx/t-istream.cc
@@ -1,21 +1,21 @@
/* Test istream formatted input.
-Copyright 2001-2004 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <iostream>
#include <cstdlib>
@@ -37,7 +37,7 @@ using namespace std;
// since there's no mantissa digits, but g++ reads the whole thing and only
// then decides it's bad.
-bool option_check_standard = false;
+int option_check_standard = 0;
// On some versions of g++ 2.96 it's been observed that putback() may leave
@@ -45,7 +45,7 @@ bool option_check_standard = false;
// result of a bug, since for instance it's ok in g++ 2.95 and g++ 3.3. We
// detect the problem at runtime and disable affected checks.
-bool putback_tellg_works = true;
+int putback_tellg_works = 1;
void
check_putback_tellg (void)
@@ -63,7 +63,7 @@ check_putback_tellg (void)
{
cout << "Warning, istringstream has a bug: putback() doesn't update tellg().\n";;
cout << "Tests on tellg() will be skipped.\n";
- putback_tellg_works = false;
+ putback_tellg_works = 0;
}
}
@@ -132,8 +132,7 @@ check_mpz (void)
};
mpz_t got, want;
- bool got_ok, want_ok;
- bool got_eof, want_eof;
+ int got_ok, want_ok;
long got_si, want_si;
streampos init_tellg, got_pos, want_pos;
@@ -142,10 +141,8 @@ check_mpz (void)
for (size_t i = 0; i < numberof (data); i++)
{
- size_t input_length = strlen (data[i].input);
want_pos = (data[i].want_pos == -1
- ? input_length : data[i].want_pos);
- want_eof = (want_pos == streampos(input_length));
+ ? strlen (data[i].input) : data[i].want_pos);
want_ok = (data[i].want != NULL);
@@ -162,8 +159,7 @@ check_mpz (void)
want_si = mpz_get_si (want);
input >> got_si;
- got_ok = !input.fail();
- got_eof = input.eof();
+ got_ok = (input ? 1 : 0);
input.clear();
got_pos = input.tellg() - init_tellg;
@@ -179,12 +175,6 @@ check_mpz (void)
cout << " got_si: " << got_si << "\n";
cout << " want_si: " << want_si << "\n";
}
- if (want_ok && got_eof != want_eof)
- {
- WRONG ("stdc++ operator>> wrong EOF state, check_mpz");
- cout << " got_eof: " << got_eof << "\n";
- cout << " want_eof: " << want_eof << "\n";
- }
if (putback_tellg_works && got_pos != want_pos)
{
WRONG ("stdc++ operator>> wrong position, check_mpz");
@@ -200,8 +190,7 @@ check_mpz (void)
mpz_set_ui (got, 0xDEAD);
input >> got;
- got_ok = !input.fail();
- got_eof = input.eof();
+ got_ok = (input ? 1 : 0);
input.clear();
got_pos = input.tellg() - init_tellg;
@@ -219,13 +208,6 @@ check_mpz (void)
mpz_trace (" want", want);
abort ();
}
- if (want_ok && got_eof != want_eof)
- {
- WRONG ("mpz operator>> wrong EOF state");
- cout << " want_eof: " << want_eof << "\n";
- cout << " got_eof: " << got_eof << "\n";
- abort ();
- }
if (putback_tellg_works && got_pos != want_pos)
{
WRONG ("mpz operator>> wrong position");
@@ -289,17 +271,10 @@ check_mpq (void)
{ " 123", 0, NULL, (ios::fmtflags) 0 }, // not without skipws
{ " 123", -1, "123", ios::skipws },
-
- { "123 /456", 3, "123", (ios::fmtflags) 0 },
- { "123/ 456", 4, NULL, (ios::fmtflags) 0 },
- { "123/" , -1, NULL, (ios::fmtflags) 0 },
- { "123 /456", 3, "123", ios::skipws },
- { "123/ 456", 4, NULL, ios::skipws },
};
mpq_t got, want;
- bool got_ok, want_ok;
- bool got_eof, want_eof;
+ int got_ok, want_ok;
long got_si, want_si;
streampos init_tellg, got_pos, want_pos;
@@ -308,10 +283,8 @@ check_mpq (void)
for (size_t i = 0; i < numberof (data); i++)
{
- size_t input_length = strlen (data[i].input);
want_pos = (data[i].want_pos == -1
- ? input_length : data[i].want_pos);
- want_eof = (want_pos == streampos(input_length));
+ ? strlen (data[i].input) : data[i].want_pos);
want_ok = (data[i].want != NULL);
@@ -322,8 +295,7 @@ check_mpq (void)
if (option_check_standard
&& mpz_fits_slong_p (mpq_numref(want))
- && mpz_cmp_ui (mpq_denref(want), 1L) == 0
- && strchr (data[i].input, '/') == NULL)
+ && mpz_cmp_ui (mpq_denref(want), 1L) == 0)
{
istringstream input (data[i].input);
input.flags (data[i].flags);
@@ -331,8 +303,7 @@ check_mpq (void)
want_si = mpz_get_si (mpq_numref(want));
input >> got_si;
- got_ok = !input.fail();
- got_eof = input.eof();
+ got_ok = (input ? 1 : 0);
input.clear();
got_pos = input.tellg() - init_tellg;
@@ -348,12 +319,6 @@ check_mpq (void)
cout << " got_si: " << got_si << "\n";
cout << " want_si: " << want_si << "\n";
}
- if (want_ok && got_eof != want_eof)
- {
- WRONG ("stdc++ operator>> wrong EOF state, check_mpq");
- cout << " got_eof: " << got_eof << "\n";
- cout << " want_eof: " << want_eof << "\n";
- }
if (putback_tellg_works && got_pos != want_pos)
{
WRONG ("stdc++ operator>> wrong position, check_mpq");
@@ -369,8 +334,7 @@ check_mpq (void)
mpq_set_si (got, 0xDEAD, 0xBEEF);
input >> got;
- got_ok = !input.fail();
- got_eof = input.eof();
+ got_ok = (input ? 1 : 0);
input.clear();
got_pos = input.tellg() - init_tellg;
@@ -391,13 +355,6 @@ check_mpq (void)
mpq_trace (" want", want);
abort ();
}
- if (want_ok && got_eof != want_eof)
- {
- WRONG ("mpq operator>> wrong EOF state");
- cout << " want_eof: " << want_eof << "\n";
- cout << " got_eof: " << got_eof << "\n";
- abort ();
- }
if (putback_tellg_works && got_pos != want_pos)
{
WRONG ("mpq operator>> wrong position");
@@ -471,8 +428,7 @@ check_mpf (void)
};
mpf_t got, want;
- bool got_ok, want_ok;
- bool got_eof, want_eof;
+ int got_ok, want_ok;
double got_d, want_d;
streampos init_tellg, got_pos, want_pos;
@@ -481,10 +437,8 @@ check_mpf (void)
for (size_t i = 0; i < numberof (data); i++)
{
- size_t input_length = strlen (data[i].input);
want_pos = (data[i].want_pos == -1
- ? input_length : data[i].want_pos);
- want_eof = (want_pos == streampos(input_length));
+ ? strlen (data[i].input) : data[i].want_pos);
want_ok = (data[i].want != NULL);
@@ -501,8 +455,7 @@ check_mpf (void)
init_tellg = input.tellg();
input >> got_d;
- got_ok = !input.fail();
- got_eof = input.eof();
+ got_ok = (input ? 1 : 0);
input.clear();
got_pos = input.tellg() - init_tellg;
@@ -518,12 +471,6 @@ check_mpf (void)
cout << " got: " << got_d << "\n";
cout << " want: " << want_d << "\n";
}
- if (want_ok && got_eof != want_eof)
- {
- WRONG ("stdc++ operator>> wrong EOF state, check_mpf");
- cout << " got_eof: " << got_eof << "\n";
- cout << " want_eof: " << want_eof << "\n";
- }
if (putback_tellg_works && got_pos != want_pos)
{
WRONG ("stdc++ operator>> wrong position, check_mpf");
@@ -539,8 +486,7 @@ check_mpf (void)
mpf_set_ui (got, 0xDEAD);
input >> got;
- got_ok = !input.fail();
- got_eof = input.eof();
+ got_ok = (input ? 1 : 0);
input.clear();
got_pos = input.tellg() - init_tellg;
@@ -558,13 +504,6 @@ check_mpf (void)
mpf_trace (" want", want);
abort ();
}
- if (want_ok && got_eof != want_eof)
- {
- WRONG ("mpf operator>> wrong EOF state");
- cout << " want_eof: " << want_eof << "\n";
- cout << " got_eof: " << got_eof << "\n";
- abort ();
- }
if (putback_tellg_works && got_pos != want_pos)
{
WRONG ("mpf operator>> wrong position");
@@ -585,7 +524,7 @@ int
main (int argc, char *argv[])
{
if (argc > 1 && strcmp (argv[1], "-s") == 0)
- option_check_standard = true;
+ option_check_standard = 1;
tests_start ();
diff --git a/gmp/tests/cxx/t-locale.cc b/gmp/tests/cxx/t-locale.cc
index 01eacda9f2..24e08ff730 100644
--- a/gmp/tests/cxx/t-locale.cc
+++ b/gmp/tests/cxx/t-locale.cc
@@ -1,21 +1,21 @@
/* Test locale support in C++ functions.
-Copyright 2001-2003, 2007 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 2007 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <clocale>
#include <iostream>
@@ -105,7 +105,7 @@ check_input (void)
cout << " point " << point[i] << "\n";
cout << " str \"" << str << "\"\n";
cout << " localeconv point \""
- << GMP_DECIMAL_POINT << "\"\n";
+ << localeconv()->decimal_point << "\"\n";
abort ();
}
@@ -120,7 +120,7 @@ check_input (void)
cout << " got " << got << "\n";
cout << " want " << want << "\n";
cout << " localeconv point \""
- << GMP_DECIMAL_POINT << "\"\n";
+ << localeconv()->decimal_point << "\"\n";
abort ();
}
}
diff --git a/gmp/tests/cxx/t-misc.cc b/gmp/tests/cxx/t-misc.cc
index 07079880e7..19c54992ba 100644
--- a/gmp/tests/cxx/t-misc.cc
+++ b/gmp/tests/cxx/t-misc.cc
@@ -2,20 +2,20 @@
Copyright 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Note that we don't use <climits> for LONG_MIN, but instead our own
@@ -41,7 +41,7 @@ check_mpz (void)
{
// mpz_class::fits_sint_p
{
- bool fits;
+ int fits;
mpz_class z;
z = INT_MIN; fits = z.fits_sint_p(); ASSERT_ALWAYS (fits);
z--; fits = z.fits_sint_p(); ASSERT_ALWAYS (! fits);
@@ -51,7 +51,7 @@ check_mpz (void)
// mpz_class::fits_uint_p
{
- bool fits;
+ int fits;
mpz_class z;
z = 0; fits = z.fits_uint_p(); ASSERT_ALWAYS (fits);
z--; fits = z.fits_uint_p(); ASSERT_ALWAYS (! fits);
@@ -61,7 +61,7 @@ check_mpz (void)
// mpz_class::fits_slong_p
{
- bool fits;
+ int fits;
mpz_class z;
z = LONG_MIN; fits = z.fits_slong_p(); ASSERT_ALWAYS (fits);
z--; fits = z.fits_slong_p(); ASSERT_ALWAYS (! fits);
@@ -71,7 +71,7 @@ check_mpz (void)
// mpz_class::fits_ulong_p
{
- bool fits;
+ int fits;
mpz_class z;
z = 0; fits = z.fits_ulong_p(); ASSERT_ALWAYS (fits);
z--; fits = z.fits_ulong_p(); ASSERT_ALWAYS (! fits);
@@ -81,7 +81,7 @@ check_mpz (void)
// mpz_class::fits_sshort_p
{
- bool fits;
+ int fits;
mpz_class z;
z = SHRT_MIN; fits = z.fits_sshort_p(); ASSERT_ALWAYS (fits);
z--; fits = z.fits_sshort_p(); ASSERT_ALWAYS (! fits);
@@ -91,7 +91,7 @@ check_mpz (void)
// mpz_class::fits_ushort_p
{
- bool fits;
+ int fits;
mpz_class z;
z = 0; fits = z.fits_ushort_p(); ASSERT_ALWAYS (fits);
z--; fits = z.fits_ushort_p(); ASSERT_ALWAYS (! fits);
@@ -186,7 +186,7 @@ check_mpq (void)
// mpq_class::get_num, mpq_class::get_den
{
- const mpq_class q(4,5);
+ mpq_class q(4,5);
mpz_class z;
z = q.get_num(); ASSERT_ALWAYS (z == 4);
z = q.get_den(); ASSERT_ALWAYS (z == 5);
@@ -200,7 +200,7 @@ check_mpq (void)
p = q.get_den_mpz_t(); ASSERT_ALWAYS (mpz_cmp_ui (p, 5) == 0);
}
{
- const mpq_class q(4,5);
+ mpq_class q(4,5);
mpz_srcptr p;
p = q.get_num_mpz_t(); ASSERT_ALWAYS (mpz_cmp_ui (p, 4) == 0);
p = q.get_den_mpz_t(); ASSERT_ALWAYS (mpz_cmp_ui (p, 5) == 0);
@@ -241,7 +241,7 @@ check_mpf (void)
{
// mpf_class::fits_sint_p
{
- bool fits;
+ int fits;
mpf_class f (0, 2*8*sizeof(int));
f = INT_MIN; fits = f.fits_sint_p(); ASSERT_ALWAYS (fits);
f--; fits = f.fits_sint_p(); ASSERT_ALWAYS (! fits);
@@ -251,7 +251,7 @@ check_mpf (void)
// mpf_class::fits_uint_p
{
- bool fits;
+ int fits;
mpf_class f (0, 2*8*sizeof(int));
f = 0; fits = f.fits_uint_p(); ASSERT_ALWAYS (fits);
f--; fits = f.fits_uint_p(); ASSERT_ALWAYS (! fits);
@@ -261,7 +261,7 @@ check_mpf (void)
// mpf_class::fits_slong_p
{
- bool fits;
+ int fits;
mpf_class f (0, 2*8*sizeof(long));
f = LONG_MIN; fits = f.fits_slong_p(); ASSERT_ALWAYS (fits);
f--; fits = f.fits_slong_p(); ASSERT_ALWAYS (! fits);
@@ -271,7 +271,7 @@ check_mpf (void)
// mpf_class::fits_ulong_p
{
- bool fits;
+ int fits;
mpf_class f (0, 2*8*sizeof(long));
f = 0; fits = f.fits_ulong_p(); ASSERT_ALWAYS (fits);
f--; fits = f.fits_ulong_p(); ASSERT_ALWAYS (! fits);
@@ -281,7 +281,7 @@ check_mpf (void)
// mpf_class::fits_sshort_p
{
- bool fits;
+ int fits;
mpf_class f (0, 2*8*sizeof(short));
f = SHRT_MIN; fits = f.fits_sshort_p(); ASSERT_ALWAYS (fits);
f--; fits = f.fits_sshort_p(); ASSERT_ALWAYS (! fits);
@@ -291,7 +291,7 @@ check_mpf (void)
// mpf_class::fits_ushort_p
{
- bool fits;
+ int fits;
mpf_class f (0, 2*8*sizeof(short));
f = 0; fits = f.fits_ushort_p(); ASSERT_ALWAYS (fits);
f--; fits = f.fits_ushort_p(); ASSERT_ALWAYS (! fits);
@@ -370,18 +370,6 @@ check_mpf (void)
}
}
-// std::numeric_limits
-void
-check_limits (void)
-{
- // Check that the content is not private.
- ASSERT_ALWAYS ( std::numeric_limits<mpz_class>::is_integer);
- ASSERT_ALWAYS (!std::numeric_limits<mpf_class>::is_integer);
-
- // Check that symbols are emitted.
- ASSERT_ALWAYS (&std::numeric_limits<mpz_class>::is_integer
- != &std::numeric_limits<mpq_class>::is_integer);
-}
int
main (void)
@@ -391,7 +379,6 @@ main (void)
check_mpz();
check_mpq();
check_mpf();
- check_limits();
tests_end();
return 0;
diff --git a/gmp/tests/cxx/t-mix.cc b/gmp/tests/cxx/t-mix.cc
deleted file mode 100644
index aeb6f67589..0000000000
--- a/gmp/tests/cxx/t-mix.cc
+++ /dev/null
@@ -1,83 +0,0 @@
-/* Test legality of conversion between the different mp*_class
-
-Copyright 2011 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 "config.h"
-
-#include "gmp.h"
-#include "gmpxx.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-int f_z (mpz_class){return 0;}
-int f_q (mpq_class){return 1;}
-int f_f (mpf_class){return 2;}
-int f_zq (mpz_class){return 0;}
-int f_zq (mpq_class){return 1;}
-int f_zf (mpz_class){return 0;}
-int f_zf (mpf_class){return 2;}
-int f_qf (mpq_class){return 1;}
-int f_qf (mpf_class){return 2;}
-int f_zqf(mpz_class){return 0;}
-int f_zqf(mpq_class){return 1;}
-int f_zqf(mpf_class){return 2;}
-
-void
-check (void)
-{
- mpz_class z=42;
- mpq_class q=33;
- mpf_class f=18;
-
- ASSERT_ALWAYS(f_z (z)==0); ASSERT_ALWAYS(f_z (-z)==0);
- ASSERT_ALWAYS(f_q (z)==1); ASSERT_ALWAYS(f_q (-z)==1);
- ASSERT_ALWAYS(f_q (q)==1); ASSERT_ALWAYS(f_q (-q)==1);
- ASSERT_ALWAYS(f_f (z)==2); ASSERT_ALWAYS(f_f (-z)==2);
- ASSERT_ALWAYS(f_f (q)==2); ASSERT_ALWAYS(f_f (-q)==2);
- ASSERT_ALWAYS(f_f (f)==2); ASSERT_ALWAYS(f_f (-f)==2);
- ASSERT_ALWAYS(f_zq (z)==0);
- ASSERT_ALWAYS(f_zq (q)==1); ASSERT_ALWAYS(f_zq (-q)==1);
- ASSERT_ALWAYS(f_zf (z)==0);
- ASSERT_ALWAYS(f_zf (f)==2); ASSERT_ALWAYS(f_zf (-f)==2);
- ASSERT_ALWAYS(f_qf (q)==1);
- ASSERT_ALWAYS(f_qf (f)==2); ASSERT_ALWAYS(f_qf (-f)==2);
- ASSERT_ALWAYS(f_zqf(z)==0);
- ASSERT_ALWAYS(f_zqf(q)==1);
- ASSERT_ALWAYS(f_zqf(f)==2); ASSERT_ALWAYS(f_zqf(-f)==2);
-
- ASSERT_ALWAYS(f_zqf(mpz_class(z))==0); ASSERT_ALWAYS(f_zqf(mpz_class(-z))==0);
- ASSERT_ALWAYS(f_zqf(mpz_class(q))==0); ASSERT_ALWAYS(f_zqf(mpz_class(-q))==0);
- ASSERT_ALWAYS(f_zqf(mpz_class(f))==0); ASSERT_ALWAYS(f_zqf(mpz_class(-f))==0);
- ASSERT_ALWAYS(f_zqf(mpq_class(z))==1); ASSERT_ALWAYS(f_zqf(mpq_class(-z))==1);
- ASSERT_ALWAYS(f_zqf(mpq_class(q))==1); ASSERT_ALWAYS(f_zqf(mpq_class(-q))==1);
- ASSERT_ALWAYS(f_zqf(mpq_class(f))==1); ASSERT_ALWAYS(f_zqf(mpq_class(-f))==1);
- ASSERT_ALWAYS(f_zqf(mpf_class(z))==2); ASSERT_ALWAYS(f_zqf(mpf_class(-z))==2);
- ASSERT_ALWAYS(f_zqf(mpf_class(q))==2); ASSERT_ALWAYS(f_zqf(mpf_class(-q))==2);
- ASSERT_ALWAYS(f_zqf(mpf_class(f))==2); ASSERT_ALWAYS(f_zqf(mpf_class(-f))==2);
-}
-
-int
-main (void)
-{
- tests_start();
-
- check();
-
- tests_end();
- return 0;
-}
diff --git a/gmp/tests/cxx/t-ops.cc b/gmp/tests/cxx/t-ops.cc
index b1bf0dc4d8..01fe3b0fbc 100644
--- a/gmp/tests/cxx/t-ops.cc
+++ b/gmp/tests/cxx/t-ops.cc
@@ -1,21 +1,21 @@
/* Test mp*_class operators and functions.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -60,8 +60,6 @@ check_mpz (void)
mpz_class a(-123);
mpz_class b;
b = abs(a); ASSERT_ALWAYS(b == 123);
- a <<= 300;
- b = abs(a); ASSERT_ALWAYS(a + b == 0);
}
// sqrt
@@ -494,7 +492,6 @@ check_mpq (void)
mpq_class a(1, 3), b(3, 4);
mpq_class c;
c = a * b; ASSERT_ALWAYS(c == 0.25);
- c = b * b; ASSERT_ALWAYS(c == 0.5625);
}
// operator/
diff --git a/gmp/tests/cxx/t-ops2.cc b/gmp/tests/cxx/t-ops2.cc
deleted file mode 100644
index 3a25442aaf..0000000000
--- a/gmp/tests/cxx/t-ops2.cc
+++ /dev/null
@@ -1,256 +0,0 @@
-/* Test mp*_class operators and functions.
-
-Copyright 2011, 2012 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 "config.h"
-
-#include <math.h>
-
-#include "gmp.h"
-#include "gmpxx.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-
-#define CHECK1(Type,a,fun) \
- ASSERT_ALWAYS(fun((Type)(a))==fun(a))
-#define CHECK(Type1,Type2,a,b,op) \
- ASSERT_ALWAYS(((Type1)(a) op (Type2)(b))==((a) op (b)))
-#define CHECK_G(Type,a,b,op) \
- CHECK(Type,Type,a,b,op)
-#define CHECK_UI(Type,a,b,op) \
- CHECK(Type,unsigned long,a,b,op); \
- CHECK(unsigned long,Type,a,b,op)
-#define CHECK_SI(Type,a,b,op) \
- CHECK(Type,long,a,b,op); \
- CHECK(long,Type,a,b,op)
-#define CHECK_D(Type,a,b,op) \
- CHECK(Type,double,a,b,op); \
- CHECK(double,Type,a,b,op)
-#define CHECK_MPZ(Type,a,b,op) \
- CHECK(Type,mpz_class,a,b,op); \
- CHECK(mpz_class,Type,a,b,op)
-#define CHECK_MPQ(Type,a,b,op) \
- CHECK(Type,mpq_class,a,b,op); \
- CHECK(mpq_class,Type,a,b,op)
-#define CHECK_ALL_SIGNED(Type,a,b,op) \
- CHECK_G(Type,a,b,op); \
- CHECK_SI(Type,a,b,op); \
- CHECK_D(Type,a,b,op)
-#define CHECK_ALL_SIGNS(Type,a,b,op) \
- CHECK_ALL_SIGNED(Type,a,b,op); \
- CHECK_ALL_SIGNED(Type,-(a),b,op); \
- CHECK_ALL_SIGNED(Type,a,-(b),op); \
- CHECK_ALL_SIGNED(Type,-(a),-(b),op)
-#define CHECK_ALL(Type,a,b,op) \
- CHECK_ALL_SIGNED(Type,a,b,op); \
- CHECK_UI(Type,a,b,op)
-#define CHECK_ALL_SIGNED_COMPARISONS(Type,a,b) \
- CHECK_ALL_SIGNED(Type,a,b,<); \
- CHECK_ALL_SIGNED(Type,a,b,>); \
- CHECK_ALL_SIGNED(Type,a,b,<=); \
- CHECK_ALL_SIGNED(Type,a,b,>=); \
- CHECK_ALL_SIGNED(Type,a,b,==); \
- CHECK_ALL_SIGNED(Type,a,b,!=)
-#define CHECK_ALL_SIGNS_COMPARISONS(Type,a,b) \
- CHECK_ALL_SIGNS(Type,a,b,<); \
- CHECK_ALL_SIGNS(Type,a,b,>); \
- CHECK_ALL_SIGNS(Type,a,b,<=); \
- CHECK_ALL_SIGNS(Type,a,b,>=); \
- CHECK_ALL_SIGNS(Type,a,b,==); \
- CHECK_ALL_SIGNS(Type,a,b,!=)
-#define CHECK_ALL_COMPARISONS(Type,a,b) \
- CHECK_ALL(Type,a,b,<); \
- CHECK_ALL(Type,a,b,>); \
- CHECK_ALL(Type,a,b,<=); \
- CHECK_ALL(Type,a,b,>=); \
- CHECK_ALL(Type,a,b,==); \
- CHECK_ALL(Type,a,b,!=)
-
-
-void checkz (){
- CHECK_ALL(mpz_class,5,2,+);
- CHECK_ALL(mpz_class,5,2,-);
- CHECK_ALL(mpz_class,5,2,*);
- CHECK_ALL(mpz_class,5,2,/);
- CHECK_ALL(mpz_class,5,2,%);
- CHECK_ALL_COMPARISONS(mpz_class,5,2);
- CHECK_ALL_SIGNS(mpz_class,11,3,+);
- CHECK_ALL_SIGNS(mpz_class,11,3,-);
- CHECK_ALL_SIGNS(mpz_class,11,3,*);
- CHECK_ALL_SIGNS(mpz_class,11,3,/);
- CHECK_ALL_SIGNS(mpz_class,11,3,%);
- CHECK_ALL_SIGNS(mpz_class,17,2,*);
- CHECK_ALL_SIGNS(mpz_class,17,2,/);
- CHECK_ALL_SIGNS(mpz_class,17,2,%);
- CHECK(unsigned long,mpz_class,5,-2,/);
- CHECK(unsigned long,mpz_class,5,-2,%);
- ASSERT_ALWAYS(7ul/mpz_class(1e35)==0);
- ASSERT_ALWAYS(7ul%mpz_class(1e35)==7);
- ASSERT_ALWAYS(7ul/mpz_class(-1e35)==0);
- ASSERT_ALWAYS(7ul%mpz_class(-1e35)==7);
- CHECK_ALL_SIGNS_COMPARISONS(mpz_class,11,3);
- CHECK_ALL(mpz_class,6,3,&);
- CHECK_ALL(mpz_class,6,3,|);
- CHECK_ALL(mpz_class,6,3,^);
- CHECK(mpz_class,unsigned long,6,2,<<);
- CHECK(mpz_class,unsigned long,6,2,>>);
- CHECK(mpz_class,unsigned long,-13,2,<<);
- CHECK(mpz_class,unsigned long,-13,2,>>);
- ASSERT_ALWAYS(++mpz_class(7)==8);
- ASSERT_ALWAYS(++mpz_class(-8)==-7);
- ASSERT_ALWAYS(--mpz_class(8)==7);
- ASSERT_ALWAYS(--mpz_class(-7)==-8);
- ASSERT_ALWAYS(~mpz_class(7)==-8);
- ASSERT_ALWAYS(~mpz_class(-8)==7);
- ASSERT_ALWAYS(+mpz_class(7)==7);
- ASSERT_ALWAYS(+mpz_class(-8)==-8);
- ASSERT_ALWAYS(-mpz_class(7)==-7);
- ASSERT_ALWAYS(-mpz_class(-8)==8);
- ASSERT_ALWAYS(abs(mpz_class(7))==7);
- ASSERT_ALWAYS(abs(mpz_class(-8))==8);
- ASSERT_ALWAYS(sqrt(mpz_class(7))==2);
- ASSERT_ALWAYS(sqrt(mpz_class(0))==0);
- 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>
-void checkqf (){
- CHECK_ALL(T,5.,2,+); CHECK_MPZ(T,5.,2,+);
- CHECK_ALL(T,5.,2,-); CHECK_MPZ(T,5.,2,-);
- CHECK_ALL(T,5.,2,*); CHECK_MPZ(T,5.,2,*);
- CHECK_ALL(T,5.,2,/); CHECK_MPZ(T,5.,2,/);
- CHECK_ALL(T,0.,2,/);
- CHECK_ALL_SIGNS(T,11.,3,+);
- CHECK_ALL_SIGNS(T,11.,3,-);
- CHECK_ALL_SIGNS(T,11.,3,*);
- CHECK_ALL_SIGNS(T,11.,4,/);
- CHECK_SI(T,LONG_MIN,1,*);
- CHECK_SI(T,0,3,*);
- CHECK_ALL_COMPARISONS(T,5.,2);
- CHECK_ALL_SIGNS_COMPARISONS(T,11.,3);
- CHECK_MPZ(T,5,-2,<);
- CHECK_MPZ(T,5,-2,>);
- CHECK_MPZ(T,5,-2,<=);
- CHECK_MPZ(T,5,-2,>=);
- CHECK_MPZ(T,5,-2,==);
- CHECK_MPZ(T,5,-2,!=);
- CHECK_MPZ(T,0,0,<);
- CHECK_MPZ(T,0,0,>);
- CHECK_MPZ(T,0,0,<=);
- CHECK_MPZ(T,0,0,>=);
- CHECK_MPZ(T,0,0,==);
- CHECK_MPZ(T,0,0,!=);
- ASSERT_ALWAYS(T(6)<<2==6.*4);
- ASSERT_ALWAYS(T(6)>>2==6./4);
- ASSERT_ALWAYS(T(-13)<<2==-13.*4);
- ASSERT_ALWAYS(T(-13)>>2==-13./4);
- ASSERT_ALWAYS(++T(7)==8);
- ASSERT_ALWAYS(++T(-8)==-7);
- ASSERT_ALWAYS(--T(8)==7);
- ASSERT_ALWAYS(--T(-7)==-8);
- ASSERT_ALWAYS(+T(7)==7);
- ASSERT_ALWAYS(+T(-8)==-8);
- ASSERT_ALWAYS(-T(7)==-7);
- ASSERT_ALWAYS(-T(-8)==8);
- ASSERT_ALWAYS(abs(T(7))==7);
- ASSERT_ALWAYS(abs(T(-8))==8);
- 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 (){
- ASSERT_ALWAYS(sqrt(mpf_class(7))>2.64);
- ASSERT_ALWAYS(sqrt(mpf_class(7))<2.65);
- ASSERT_ALWAYS(sqrt(mpf_class(0))==0);
- // TODO: add some consistency checks, as described in
- // 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);
- CHECK1(mpf_class,4.3,trunc);
- CHECK1(mpf_class,4.3,floor);
- CHECK1(mpf_class,4.3,ceil);
- CHECK1(mpf_class,-7.1,trunc);
- CHECK1(mpf_class,-7.1,floor);
- CHECK1(mpf_class,-7.1,ceil);
- CHECK1(mpf_class,-2.8,trunc);
- CHECK1(mpf_class,-2.8,floor);
- CHECK1(mpf_class,-2.8,ceil);
- CHECK1(mpf_class,-1.5,trunc);
- CHECK1(mpf_class,-1.5,floor);
- CHECK1(mpf_class,-1.5,ceil);
- CHECK1(mpf_class,2.5,trunc);
- CHECK1(mpf_class,2.5,floor);
- CHECK1(mpf_class,2.5,ceil);
- ASSERT_ALWAYS(hypot(mpf_class(-3),mpf_class(4))>4.9);
- ASSERT_ALWAYS(hypot(mpf_class(-3),mpf_class(4))<5.1);
- ASSERT_ALWAYS(hypot(mpf_class(-3),4.)>4.9);
- ASSERT_ALWAYS(hypot(-3.,mpf_class(4))<5.1);
- ASSERT_ALWAYS(hypot(mpf_class(-3),4l)>4.9);
- ASSERT_ALWAYS(hypot(-3l,mpf_class(4))<5.1);
- ASSERT_ALWAYS(hypot(mpf_class(-3),4ul)>4.9);
- ASSERT_ALWAYS(hypot(3ul,mpf_class(4))<5.1);
- CHECK(mpf_class,mpq_class,1.5,2.25,+);
- CHECK(mpf_class,mpq_class,1.5,2.25,-);
- CHECK(mpf_class,mpq_class,1.5,-2.25,*);
- CHECK(mpf_class,mpq_class,1.5,-2,/);
- CHECK_MPQ(mpf_class,-5.5,-2.25,+);
- CHECK_MPQ(mpf_class,-5.5,-2.25,-);
- CHECK_MPQ(mpf_class,-5.5,-2.25,*);
- CHECK_MPQ(mpf_class,-5.25,-0.5,/);
- CHECK_MPQ(mpf_class,5,-2,<);
- CHECK_MPQ(mpf_class,5,-2,>);
- CHECK_MPQ(mpf_class,5,-2,<=);
- CHECK_MPQ(mpf_class,5,-2,>=);
- CHECK_MPQ(mpf_class,5,-2,==);
- CHECK_MPQ(mpf_class,5,-2,!=);
- CHECK_MPQ(mpf_class,0,0,<);
- CHECK_MPQ(mpf_class,0,0,>);
- CHECK_MPQ(mpf_class,0,0,<=);
- CHECK_MPQ(mpf_class,0,0,>=);
- CHECK_MPQ(mpf_class,0,0,==);
- CHECK_MPQ(mpf_class,0,0,!=);
-}
-
-int
-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>();
- checkf();
-
- tests_end();
- return 0;
-}
diff --git a/gmp/tests/cxx/t-ops3.cc b/gmp/tests/cxx/t-ops3.cc
deleted file mode 100644
index cb6a2efc7d..0000000000
--- a/gmp/tests/cxx/t-ops3.cc
+++ /dev/null
@@ -1,133 +0,0 @@
-/* Test mp*_class assignment operators (+=, -=, etc)
-
-Copyright 2011 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 "config.h"
-
-#include "gmp.h"
-#include "gmpxx.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-using namespace std;
-
-#define FOR_ALL_SIGNED_BUILTIN(F) \
- F(signed char) \
- F(signed short) \
- F(signed int) \
- F(signed long) \
- F(float) \
- F(double)
-
-#define FOR_ALL_BUILTIN(F) \
- FOR_ALL_SIGNED_BUILTIN(F) \
- F(char) \
- F(unsigned char) \
- F(unsigned short) \
- F(unsigned int) \
- F(unsigned long)
-
-#define FOR_ALL_GMPXX(F) \
- F(mpz_class) \
- F(mpq_class) \
- F(mpf_class)
-
-template<class T,class U> void f(T t, U u){
- T a=t;
- ASSERT_ALWAYS((a+=u)==(t+u)); ASSERT_ALWAYS(a==(t+u));
- ASSERT_ALWAYS((a-=u)==t); ASSERT_ALWAYS(a==t);
- ASSERT_ALWAYS((a*=u)==(t*u)); ASSERT_ALWAYS(a==(t*u));
- ASSERT_ALWAYS((a/=u)==t); ASSERT_ALWAYS(a==t);
- ASSERT_ALWAYS((a<<=5)==(t<<5)); ASSERT_ALWAYS(a==(t<<5));
- ASSERT_ALWAYS((a>>=5)==t); ASSERT_ALWAYS(a==t);
-}
-
-template<class T,class U> void g(T t, U u){
- T a=t;
- ASSERT_ALWAYS((a%=u)==(t%u)); ASSERT_ALWAYS(a==(t%u));
- a=t;
- ASSERT_ALWAYS((a&=u)==(t&u)); ASSERT_ALWAYS(a==(t&u));
- a=t;
- ASSERT_ALWAYS((a|=u)==(t|u)); ASSERT_ALWAYS(a==(t|u));
- a=t;
- ASSERT_ALWAYS((a^=u)==(t^u)); ASSERT_ALWAYS(a==(t^u));
-}
-
-template<class T> void h(T t){
- T a=t;
- ASSERT_ALWAYS((a<<=5)==(t<<5)); ASSERT_ALWAYS(a==(t<<5));
- ASSERT_ALWAYS((a>>=5)==t); ASSERT_ALWAYS(a==t);
-}
-
-template<class T, class U> void ffs(T t, U u){
-#define F(V) f(t,(V)u);
- FOR_ALL_SIGNED_BUILTIN(F)
- FOR_ALL_GMPXX(F)
-#undef F
-#define F(V) f(t,-(V)u);
- FOR_ALL_GMPXX(F)
-#undef F
-}
-
-template<class T, class U> void ff(T t, U u){
-#define F(V) f(t,(V)u);
- FOR_ALL_BUILTIN(F)
- FOR_ALL_GMPXX(F)
-#undef F
-#define F(V) f(t,-(V)u);
- FOR_ALL_GMPXX(F)
-#undef F
-}
-
-template<class U> void ggs(mpz_class t, U u){
-#define F(V) g(t,(V)u);
- FOR_ALL_SIGNED_BUILTIN(F)
-#undef F
- g(t,(mpz_class)u);
- g(t,-(mpz_class)u);
-}
-
-template<class U> void gg(mpz_class t, U u){
-#define F(V) g(t,(V)u);
- FOR_ALL_BUILTIN(F)
-#undef F
- g(t,(mpz_class)u);
- g(t,-(mpz_class)u);
-}
-
-void check(){
- mpz_class z=18;
- mpq_class q(7,2);
- mpf_class d=3.375;
- h(z); h(q); h(d);
- ff(z,13); ff(q,13); ff(d,13);
- ffs(z,-42); ffs(q,-42); ffs(d,-42);
- gg(z,33); ggs(z,-22);
-}
-
-
-int
-main (void)
-{
- tests_start();
-
- check();
-
- tests_end();
- return 0;
-}
diff --git a/gmp/tests/cxx/t-ostream.cc b/gmp/tests/cxx/t-ostream.cc
index 9b4f5e7dd7..0eeb7be62b 100644
--- a/gmp/tests/cxx/t-ostream.cc
+++ b/gmp/tests/cxx/t-ostream.cc
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <iostream>
#include <cstdlib>
@@ -27,7 +27,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
using namespace std;
-bool option_check_standard = false;
+int option_check_standard = 0;
#define CALL(expr) \
@@ -437,7 +437,7 @@ int
main (int argc, char *argv[])
{
if (argc > 1 && strcmp (argv[1], "-s") == 0)
- option_check_standard = true;
+ option_check_standard = 1;
tests_start ();
diff --git a/gmp/tests/cxx/t-prec.cc b/gmp/tests/cxx/t-prec.cc
index 8039219f21..e9f4e48139 100644
--- a/gmp/tests/cxx/t-prec.cc
+++ b/gmp/tests/cxx/t-prec.cc
@@ -1,21 +1,21 @@
/* Test precision of mpf_class expressions.
-Copyright 2001-2003, 2008 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 2008 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
diff --git a/gmp/tests/cxx/t-rand.cc b/gmp/tests/cxx/t-rand.cc
index b71c49627b..506a13789f 100644
--- a/gmp/tests/cxx/t-rand.cc
+++ b/gmp/tests/cxx/t-rand.cc
@@ -2,20 +2,20 @@
Copyright 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "gmpxx.h"
@@ -113,24 +113,13 @@ check_mpf (void)
r.seed(a);
mpf_class b;
b = r.get_f();
- mpf_class c(r.get_f());
- ASSERT_ALWAYS (c.get_prec() == mpf_get_default_prec());
- mpf_class d(r.get_f(),212);
- ASSERT_ALWAYS (d.get_prec() >= 212);
}
{
gmp_randclass r(gmp_randinit_default);
- int a = 123, b = 198;
+ int a = 123, b = 128;
r.seed(a);
mpf_class c;
c = r.get_f(b);
- ASSERT_ALWAYS (c.get_prec() == mpf_get_default_prec());
- mpf_class d(r.get_f(b));
- ASSERT_ALWAYS (d.get_prec() >= 198);
- mpf_class e(r.get_f(b)-r.get_f());
- ASSERT_ALWAYS (e.get_prec() >= 198);
- mpf_class f(r.get_f(60),300);
- ASSERT_ALWAYS (f.get_prec() >= 300);
}
}
diff --git a/gmp/tests/cxx/t-ternary.cc b/gmp/tests/cxx/t-ternary.cc
index 405f6f4981..39b734782b 100644
--- a/gmp/tests/cxx/t-ternary.cc
+++ b/gmp/tests/cxx/t-ternary.cc
@@ -1,21 +1,21 @@
/* Test mp*_class ternary expressions.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
diff --git a/gmp/tests/cxx/t-unary.cc b/gmp/tests/cxx/t-unary.cc
index d33b995d21..eda437c5b5 100644
--- a/gmp/tests/cxx/t-unary.cc
+++ b/gmp/tests/cxx/t-unary.cc
@@ -1,21 +1,21 @@
/* Test mp*_class unary expressions.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
diff --git a/gmp/tests/devel/Makefile.am b/gmp/tests/devel/Makefile.am
index 7d62115bc3..79ed8ab24a 100644
--- a/gmp/tests/devel/Makefile.am
+++ b/gmp/tests/devel/Makefile.am
@@ -1,27 +1,27 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2000-2002 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
-# add_n_sub_n add_n_sub_n_2 not yet built since mpn_add_n_sub_n doesn't yet exist
+# addsub_n addsub_n_2 not yet built since mpn_addsub_n doesn't yet exist
#
EXTRA_PROGRAMS = \
aors_n anymul_1 copy divmod_1 divrem shift logops_n tst-addsub try
diff --git a/gmp/tests/devel/Makefile.in b/gmp/tests/devel/Makefile.in
index 28a68c050b..011fd48d21 100644
--- a/gmp/tests/devel/Makefile.in
+++ b/gmp/tests/devel/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,45 +14,33 @@
@SET_MAKE@
-# Copyright 2000-2002 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = anymul_1.c aors_n.c copy.c divmod_1.c divrem.c logops_n.c shift.c try.c tst-addsub.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,8 +52,8 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
EXTRA_PROGRAMS = aors_n$(EXEEXT) anymul_1$(EXEEXT) copy$(EXEEXT) \
divmod_1$(EXEEXT) divrem$(EXEEXT) shift$(EXEEXT) \
logops_n$(EXEEXT) tst-addsub$(EXEEXT) try$(EXEEXT)
@@ -74,79 +61,72 @@ subdir = tests/devel
DIST_COMMON = README $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
anymul_1_SOURCES = anymul_1.c
-anymul_1_OBJECTS = anymul_1.$(OBJEXT)
+anymul_1_OBJECTS = anymul_1$U.$(OBJEXT)
anymul_1_LDADD = $(LDADD)
anymul_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
aors_n_SOURCES = aors_n.c
-aors_n_OBJECTS = aors_n.$(OBJEXT)
+aors_n_OBJECTS = aors_n$U.$(OBJEXT)
aors_n_LDADD = $(LDADD)
aors_n_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
copy_SOURCES = copy.c
-copy_OBJECTS = copy.$(OBJEXT)
+copy_OBJECTS = copy$U.$(OBJEXT)
copy_LDADD = $(LDADD)
copy_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
divmod_1_SOURCES = divmod_1.c
-divmod_1_OBJECTS = divmod_1.$(OBJEXT)
+divmod_1_OBJECTS = divmod_1$U.$(OBJEXT)
divmod_1_LDADD = $(LDADD)
divmod_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
divrem_SOURCES = divrem.c
-divrem_OBJECTS = divrem.$(OBJEXT)
+divrem_OBJECTS = divrem$U.$(OBJEXT)
divrem_LDADD = $(LDADD)
divrem_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
logops_n_SOURCES = logops_n.c
-logops_n_OBJECTS = logops_n.$(OBJEXT)
+logops_n_OBJECTS = logops_n$U.$(OBJEXT)
logops_n_LDADD = $(LDADD)
logops_n_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
shift_SOURCES = shift.c
-shift_OBJECTS = shift.$(OBJEXT)
+shift_OBJECTS = shift$U.$(OBJEXT)
shift_LDADD = $(LDADD)
shift_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
try_SOURCES = try.c
-try_OBJECTS = try.$(OBJEXT)
+try_OBJECTS = try$U.$(OBJEXT)
try_LDADD = $(LDADD)
try_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
tst_addsub_SOURCES = tst-addsub.c
-tst_addsub_OBJECTS = tst-addsub.$(OBJEXT)
+tst_addsub_OBJECTS = tst-addsub$U.$(OBJEXT)
tst_addsub_LDADD = $(LDADD)
tst_addsub_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = anymul_1.c aors_n.c copy.c divmod_1.c divrem.c logops_n.c \
shift.c try.c tst-addsub.c
DIST_SOURCES = anymul_1.c aors_n.c copy.c divmod_1.c divrem.c \
logops_n.c shift.c try.c tst-addsub.c
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
@@ -160,6 +140,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -175,17 +156,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -199,12 +179,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -219,26 +197,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -248,31 +220,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -296,6 +263,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -303,12 +271,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
CLEANFILES = $(EXTRA_PROGRAMS)
@@ -320,14 +284,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/devel/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/devel/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/devel/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/devel/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -345,40 +309,44 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-anymul_1$(EXEEXT): $(anymul_1_OBJECTS) $(anymul_1_DEPENDENCIES) $(EXTRA_anymul_1_DEPENDENCIES)
+anymul_1$(EXEEXT): $(anymul_1_OBJECTS) $(anymul_1_DEPENDENCIES)
@rm -f anymul_1$(EXEEXT)
- $(LINK) $(anymul_1_OBJECTS) $(anymul_1_LDADD) $(LIBS)
-aors_n$(EXEEXT): $(aors_n_OBJECTS) $(aors_n_DEPENDENCIES) $(EXTRA_aors_n_DEPENDENCIES)
+ $(LINK) $(anymul_1_LDFLAGS) $(anymul_1_OBJECTS) $(anymul_1_LDADD) $(LIBS)
+aors_n$(EXEEXT): $(aors_n_OBJECTS) $(aors_n_DEPENDENCIES)
@rm -f aors_n$(EXEEXT)
- $(LINK) $(aors_n_OBJECTS) $(aors_n_LDADD) $(LIBS)
-copy$(EXEEXT): $(copy_OBJECTS) $(copy_DEPENDENCIES) $(EXTRA_copy_DEPENDENCIES)
+ $(LINK) $(aors_n_LDFLAGS) $(aors_n_OBJECTS) $(aors_n_LDADD) $(LIBS)
+copy$(EXEEXT): $(copy_OBJECTS) $(copy_DEPENDENCIES)
@rm -f copy$(EXEEXT)
- $(LINK) $(copy_OBJECTS) $(copy_LDADD) $(LIBS)
-divmod_1$(EXEEXT): $(divmod_1_OBJECTS) $(divmod_1_DEPENDENCIES) $(EXTRA_divmod_1_DEPENDENCIES)
+ $(LINK) $(copy_LDFLAGS) $(copy_OBJECTS) $(copy_LDADD) $(LIBS)
+divmod_1$(EXEEXT): $(divmod_1_OBJECTS) $(divmod_1_DEPENDENCIES)
@rm -f divmod_1$(EXEEXT)
- $(LINK) $(divmod_1_OBJECTS) $(divmod_1_LDADD) $(LIBS)
-divrem$(EXEEXT): $(divrem_OBJECTS) $(divrem_DEPENDENCIES) $(EXTRA_divrem_DEPENDENCIES)
+ $(LINK) $(divmod_1_LDFLAGS) $(divmod_1_OBJECTS) $(divmod_1_LDADD) $(LIBS)
+divrem$(EXEEXT): $(divrem_OBJECTS) $(divrem_DEPENDENCIES)
@rm -f divrem$(EXEEXT)
- $(LINK) $(divrem_OBJECTS) $(divrem_LDADD) $(LIBS)
-logops_n$(EXEEXT): $(logops_n_OBJECTS) $(logops_n_DEPENDENCIES) $(EXTRA_logops_n_DEPENDENCIES)
+ $(LINK) $(divrem_LDFLAGS) $(divrem_OBJECTS) $(divrem_LDADD) $(LIBS)
+logops_n$(EXEEXT): $(logops_n_OBJECTS) $(logops_n_DEPENDENCIES)
@rm -f logops_n$(EXEEXT)
- $(LINK) $(logops_n_OBJECTS) $(logops_n_LDADD) $(LIBS)
-shift$(EXEEXT): $(shift_OBJECTS) $(shift_DEPENDENCIES) $(EXTRA_shift_DEPENDENCIES)
+ $(LINK) $(logops_n_LDFLAGS) $(logops_n_OBJECTS) $(logops_n_LDADD) $(LIBS)
+shift$(EXEEXT): $(shift_OBJECTS) $(shift_DEPENDENCIES)
@rm -f shift$(EXEEXT)
- $(LINK) $(shift_OBJECTS) $(shift_LDADD) $(LIBS)
-try$(EXEEXT): $(try_OBJECTS) $(try_DEPENDENCIES) $(EXTRA_try_DEPENDENCIES)
+ $(LINK) $(shift_LDFLAGS) $(shift_OBJECTS) $(shift_LDADD) $(LIBS)
+try$(EXEEXT): $(try_OBJECTS) $(try_DEPENDENCIES)
@rm -f try$(EXEEXT)
- $(LINK) $(try_OBJECTS) $(try_LDADD) $(LIBS)
-tst-addsub$(EXEEXT): $(tst_addsub_OBJECTS) $(tst_addsub_DEPENDENCIES) $(EXTRA_tst_addsub_DEPENDENCIES)
+ $(LINK) $(try_LDFLAGS) $(try_OBJECTS) $(try_LDADD) $(LIBS)
+tst-addsub$(EXEEXT): $(tst_addsub_OBJECTS) $(tst_addsub_DEPENDENCIES)
@rm -f tst-addsub$(EXEEXT)
- $(LINK) $(tst_addsub_OBJECTS) $(tst_addsub_LDADD) $(LIBS)
+ $(LINK) $(tst_addsub_LDFLAGS) $(tst_addsub_OBJECTS) $(tst_addsub_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -388,6 +356,29 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+anymul_1_.c: anymul_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/anymul_1.c; then echo $(srcdir)/anymul_1.c; else echo anymul_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+aors_n_.c: aors_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/aors_n.c; then echo $(srcdir)/aors_n.c; else echo aors_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+copy_.c: copy.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/copy.c; then echo $(srcdir)/copy.c; else echo copy.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divmod_1_.c: divmod_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divmod_1.c; then echo $(srcdir)/divmod_1.c; else echo divmod_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem_.c: divrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem.c; then echo $(srcdir)/divrem.c; else echo divrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+logops_n_.c: logops_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/logops_n.c; then echo $(srcdir)/logops_n.c; else echo logops_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+shift_.c: shift.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/shift.c; then echo $(srcdir)/shift.c; else echo shift.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+try_.c: try.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/try.c; then echo $(srcdir)/try.c; else echo try.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tst-addsub_.c: tst-addsub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tst-addsub.c; then echo $(srcdir)/tst-addsub.c; else echo tst-addsub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+anymul_1_.$(OBJEXT) anymul_1_.lo aors_n_.$(OBJEXT) aors_n_.lo \
+copy_.$(OBJEXT) copy_.lo divmod_1_.$(OBJEXT) divmod_1_.lo \
+divrem_.$(OBJEXT) divrem_.lo logops_n_.$(OBJEXT) logops_n_.lo \
+shift_.$(OBJEXT) shift_.lo try_.$(OBJEXT) try_.lo \
+tst-addsub_.$(OBJEXT) tst-addsub_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -395,85 +386,82 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -491,23 +479,17 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -519,7 +501,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -527,38 +509,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -567,7 +529,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -578,29 +540,24 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
allprogs: $(EXTRA_PROGRAMS)
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/devel/README b/gmp/tests/devel/README
index 77fa65dba3..d224f1ac70 100644
--- a/gmp/tests/devel/README
+++ b/gmp/tests/devel/README
@@ -1,19 +1,19 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
diff --git a/gmp/tests/devel/anymul_1.c b/gmp/tests/devel/anymul_1.c
index 79807b0ce5..e3cea53805 100644
--- a/gmp/tests/devel/anymul_1.c
+++ b/gmp/tests/devel/anymul_1.c
@@ -1,20 +1,21 @@
/*
-Copyright 1996-2002, 2004, 2006-2008 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2004, 2006, 2007, 2008
+Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdlib.h>
#include <string.h>
@@ -22,7 +23,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp.h"
#include "gmp-impl.h"
#include "longlong.h"
-#include "tests/tests.h"
+#include "tests.h"
#ifdef OPERATION_mul_1
#define func __gmpn_mul_1
@@ -119,12 +120,6 @@ main (int argc, char **argv)
}
#endif
-#ifdef PLAIN_RANDOM
-#define MPN_RANDOM mpn_random
-#else
-#define MPN_RANDOM mpn_random2
-#endif
-
#ifdef RANDOM
size = random () % SIZE + 1;
#else
@@ -137,7 +132,7 @@ main (int argc, char **argv)
#ifdef FIXED_XLIMB
xlimb = FIXED_XLIMB;
#else
- MPN_RANDOM (&xlimb, 1);
+ mpn_random2 (&xlimb, 1);
#endif
#if TIMES != 1
@@ -152,15 +147,15 @@ main (int argc, char **argv)
cyc = ((double) t * CLOCK) / (TIMES * size * 1000.0);
printf (funcname ": %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n",
t, cyc,
- CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9);
+ CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9);
#endif
#ifndef NOCHECK
- MPN_RANDOM (s1, size);
+ mpn_random2 (s1, size);
#ifdef ZERO
memset (rp, 0, size * sizeof *rp);
#else
- MPN_RANDOM (rp, size);
+ mpn_random2 (rp, size);
#endif
#if defined (PRINT) || defined (XPRINT)
printf ("xlimb=");
@@ -242,7 +237,7 @@ mpn_print (mp_ptr p, mp_size_t size)
{
#ifdef _LONG_LONG_LIMB
printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)),
- (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)),
+ (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)),
(int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
#else
printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]);
diff --git a/gmp/tests/devel/aors_n.c b/gmp/tests/devel/aors_n.c
index 5112d0a8d9..f6319ac0b8 100644
--- a/gmp/tests/devel/aors_n.c
+++ b/gmp/tests/devel/aors_n.c
@@ -1,23 +1,23 @@
/*
-Copyright 1996-2004, 2009, 2011 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009
+Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdlib.h>
-#include <string.h>
#include <stdio.h>
#include "gmp.h"
#include "gmp-impl.h"
@@ -84,10 +84,8 @@ cputime ()
}
#endif
-static void print_posneg (mp_limb_t);
static void mpn_print (mp_ptr, mp_size_t);
-#define LXW ((int) (2 * sizeof (mp_limb_t)))
#define M * 1000000
#ifndef CLOCK
@@ -188,26 +186,11 @@ main (int argc, char **argv)
if (cyx != cyy || mpn_cmp (dx, dy, size+2) != 0
|| dx[0] != 0x87654321 || dx[size+1] != 0x12345678)
{
- mp_size_t s, e;
- for (s = 0;; s++)
- if ((unsigned long long) (dx+1)[s] != (unsigned long long) (dy+1)[s])
- break;
- for (e = size - 1;; e--)
- if ((unsigned long long) (dx+1)[e] != (unsigned long long) (dy+1)[e])
- break;
#ifndef PRINT
- for (i = s; i <= e; i++)
- {
- printf ("%6d: ", i);
- printf ("%0*llX ", LXW, (unsigned long long) (dx+1)[i]);
- printf ("%0*llX ", LXW, (unsigned long long) (dy+1)[i]);
- print_posneg ((dy+1)[i] - (dx+1)[i]);
- printf ("\n");
- }
- printf ("%6s: ", "retval");
- printf ("%0*llX ", LXW, (unsigned long long) cyx);
- printf ("%0*llX ", LXW, (unsigned long long) cyy);
- print_posneg (cyx - cyy);
+ mpn_print (&cyx, 1);
+ mpn_print (dx+1, size);
+ mpn_print (&cyy, 1);
+ mpn_print (dy+1, size);
#endif
printf ("\n");
if (dy[0] != 0x87654321)
@@ -223,24 +206,6 @@ main (int argc, char **argv)
}
static void
-print_posneg (mp_limb_t d)
-{
- char buf[LXW + 2];
- if (d == 0)
- printf (" %*X", LXW, 0);
- else if (-d < d)
- {
- sprintf (buf, "%llX", (unsigned long long) -d);
- printf ("%*s-%s", LXW - (int) strlen (buf), "", buf);
- }
- else
- {
- sprintf (buf, "%llX", (unsigned long long) d);
- printf ("%*s+%s", LXW - (int) strlen (buf), "", buf);
- }
-}
-
-static void
mpn_print (mp_ptr p, mp_size_t size)
{
mp_size_t i;
@@ -249,8 +214,8 @@ mpn_print (mp_ptr p, mp_size_t size)
{
#ifdef _LONG_LONG_LIMB
printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)),
- (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)),
- (int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
+ (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)),
+ (int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
#else
printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]);
#endif
diff --git a/gmp/tests/devel/copy.c b/gmp/tests/devel/copy.c
index 1f951f5389..badbe9bbf9 100644
--- a/gmp/tests/devel/copy.c
+++ b/gmp/tests/devel/copy.c
@@ -1,23 +1,22 @@
/*
-Copyright 1999-2001, 2004, 2009, 2011 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2004, 2009 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdlib.h>
-#include <string.h>
#include <stdio.h>
#include "gmp.h"
#include "gmp-impl.h"
@@ -60,10 +59,8 @@ cputime ()
}
#endif
-static void print_posneg (mp_limb_t);
static void mpn_print (mp_ptr, mp_size_t);
-#define LXW ((int) (2 * sizeof (mp_limb_t)))
#define M * 1000000
#ifndef CLOCK
@@ -71,7 +68,7 @@ static void mpn_print (mp_ptr, mp_size_t);
#endif
#ifndef OPS
-#define OPS (CLOCK/5)
+#define OPS (CLOCK/2)
#endif
#ifndef SIZE
#define SIZE 496
@@ -155,22 +152,9 @@ main (int argc, char **argv)
if (mpn_cmp (dx, dy, size+2) != 0
|| dx[0] != 0x87654321 || dx[size+1] != 0x12345678)
{
- mp_size_t s, e;
- for (s = 0;; s++)
- if ((unsigned long long) (dx+1)[s] != (unsigned long long) (dy+1)[s])
- break;
- for (e = size - 1;; e--)
- if ((unsigned long long) (dx+1)[e] != (unsigned long long) (dy+1)[e])
- break;
#ifndef PRINT
- for (i = s; i <= e; i++)
- {
- printf ("%6d: ", i);
- printf ("%0*llX ", LXW, (unsigned long long) (dx+1)[i]);
- printf ("%0*llX ", LXW, (unsigned long long) (dy+1)[i]);
- print_posneg ((dy+1)[i] - (dx+1)[i]);
- printf ("\n");
- }
+ mpn_print (dx+1, size);
+ mpn_print (dy+1, size);
#endif
printf ("\n");
if (dy[0] != 0x87654321)
@@ -186,24 +170,6 @@ main (int argc, char **argv)
}
static void
-print_posneg (mp_limb_t d)
-{
- char buf[LXW + 2];
- if (d == 0)
- printf (" %*X", LXW, 0);
- else if (-d < d)
- {
- sprintf (buf, "%llX", (unsigned long long) -d);
- printf ("%*s-%s", LXW - (int) strlen (buf), "", buf);
- }
- else
- {
- sprintf (buf, "%llX", (unsigned long long) d);
- printf ("%*s+%s", LXW - (int) strlen (buf), "", buf);
- }
-}
-
-static void
mpn_print (mp_ptr p, mp_size_t size)
{
mp_size_t i;
@@ -212,8 +178,8 @@ mpn_print (mp_ptr p, mp_size_t size)
{
#ifdef _LONG_LONG_LIMB
printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)),
- (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)),
- (int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
+ (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)),
+ (int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
#else
printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]);
#endif
diff --git a/gmp/tests/devel/divmod_1.c b/gmp/tests/devel/divmod_1.c
index 54eaf36d96..03b5ba04e2 100644
--- a/gmp/tests/devel/divmod_1.c
+++ b/gmp/tests/devel/divmod_1.c
@@ -1,20 +1,20 @@
/*
Copyright 1996, 1998, 2000, 2001, 2007 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -141,7 +141,7 @@ main ()
cyc = ((double) t * CLOCK) / (TIMES * nn * 1000.0);
printf ("mpn_divrem_1 int: %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n",
t, cyc,
- CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9);
+ CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9);
t0 = cputime();
for (i = 0; i < TIMES; i++)
mpn_divrem_1 (dx + 1, fn, np, 0, dlimb);
@@ -149,7 +149,7 @@ main ()
cyc = ((double) t * CLOCK) / (TIMES * fn * 1000.0);
printf ("mpn_divrem_1 frac: %5ldms (%.3f cycles/limb) [%.2f Gb/s]\n",
t, cyc,
- CLOCK/cyc*GMP_LIMB_BITS*GMP_LIMB_BITS/1e9);
+ CLOCK/cyc*BITS_PER_MP_LIMB*BITS_PER_MP_LIMB/1e9);
#endif
retx = refmpn_divrem_1 (dx + 1, fn, np, nn, dlimb);
@@ -186,7 +186,7 @@ mpn_print (mp_ptr p, mp_size_t size)
{
#ifdef _LONG_LONG_LIMB
printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)),
- (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)),
+ (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)),
(int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
#else
printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]);
diff --git a/gmp/tests/devel/divrem.c b/gmp/tests/devel/divrem.c
index 8580789078..837e2ec446 100644
--- a/gmp/tests/devel/divrem.c
+++ b/gmp/tests/devel/divrem.c
@@ -1,20 +1,21 @@
/*
-Copyright 1996-1998, 2000, 2001, 2007, 2009 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 2000, 2001, 2007, 2009 Free Software Foundation,
+Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -87,7 +88,7 @@ main ()
mpn_random2 (nptr, nsize);
mpn_random2 (dptr, dsize);
- dptr[dsize - 1] |= (mp_limb_t) 1 << (GMP_LIMB_BITS - 1);
+ dptr[dsize - 1] |= (mp_limb_t) 1 << (BITS_PER_MP_LIMB - 1);
MPN_COPY (rptr, nptr, nsize);
qlimb = mpn_divrem (qptr, (mp_size_t) 0, rptr, nsize, dptr, dsize);
diff --git a/gmp/tests/devel/logops_n.c b/gmp/tests/devel/logops_n.c
index be53336cf5..56c84b286c 100644
--- a/gmp/tests/devel/logops_n.c
+++ b/gmp/tests/devel/logops_n.c
@@ -1,20 +1,21 @@
/*
-Copyright 1996-2004, 2009 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2009 Free
+Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdlib.h>
#include <stdio.h>
@@ -216,7 +217,7 @@ mpn_print (mp_ptr p, mp_size_t size)
{
#ifdef _LONG_LONG_LIMB
printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)),
- (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)),
+ (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)),
(int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
#else
printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]);
diff --git a/gmp/tests/devel/shift.c b/gmp/tests/devel/shift.c
index 611a776776..09a7e7f3de 100644
--- a/gmp/tests/devel/shift.c
+++ b/gmp/tests/devel/shift.c
@@ -1,24 +1,23 @@
/*
-Copyright 1996, 1998-2001, 2004, 2007, 2009, 2011 Free Software Foundation,
-Inc.
+Copyright 1996, 1998, 1999, 2000, 2001, 2004, 2007, 2009 Free Software
+Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdlib.h>
-#include <string.h>
#include <stdio.h>
#include "gmp.h"
#include "gmp-impl.h"
@@ -61,10 +60,8 @@ cputime ()
}
#endif
-static void print_posneg (mp_limb_t);
static void mpn_print (mp_ptr, mp_size_t);
-#define LXW ((int) (2 * sizeof (mp_limb_t)))
#define M * 1000000
#ifndef CLOCK
@@ -169,27 +166,11 @@ main (int argc, char **argv)
if (cyx != cyy || mpn_cmp (dx, dy, size+2) != 0
|| dx[0] != 0x87654321 || dx[size+1] != 0x12345678)
{
- mp_size_t s, e;
- for (s = 0;; s++)
- if ((unsigned long long) (dx+1)[s] != (unsigned long long) (dy+1)[s])
- break;
- for (e = size - 1;; e--)
- if ((unsigned long long) (dx+1)[e] != (unsigned long long) (dy+1)[e])
- break;
#ifndef PRINT
- printf ("cnt=%-*d\n", (int) (2 * sizeof(mp_limb_t)) - 4, cnt);
- for (i = s; i <= e; i++)
- {
- printf ("%6d: ", i);
- printf ("%0*llX ", LXW, (unsigned long long) (dx+1)[i]);
- printf ("%0*llX ", LXW, (unsigned long long) (dy+1)[i]);
- print_posneg ((dy+1)[i] - (dx+1)[i]);
- printf ("\n");
- }
- printf ("%6s: ", "retval");
- printf ("%0*llX ", LXW, (unsigned long long) cyx);
- printf ("%0*llX ", LXW, (unsigned long long) cyy);
- print_posneg (cyx - cyy);
+ mpn_print (&cyx, 1);
+ mpn_print (dx+1, size);
+ mpn_print (&cyy, 1);
+ mpn_print (dy+1, size);
#endif
printf ("\n");
if (dy[0] != 0x87654321)
@@ -205,24 +186,6 @@ main (int argc, char **argv)
}
static void
-print_posneg (mp_limb_t d)
-{
- char buf[LXW + 2];
- if (d == 0)
- printf (" %*X", LXW, 0);
- else if (-d < d)
- {
- sprintf (buf, "%llX", (unsigned long long) -d);
- printf ("%*s-%s", LXW - (int) strlen (buf), "", buf);
- }
- else
- {
- sprintf (buf, "%llX", (unsigned long long) d);
- printf ("%*s+%s", LXW - (int) strlen (buf), "", buf);
- }
-}
-
-static void
mpn_print (mp_ptr p, mp_size_t size)
{
mp_size_t i;
@@ -231,7 +194,7 @@ mpn_print (mp_ptr p, mp_size_t size)
{
#ifdef _LONG_LONG_LIMB
printf ("%0*lX%0*lX", (int) (sizeof(mp_limb_t)),
- (unsigned long) (p[i] >> (GMP_LIMB_BITS/2)),
+ (unsigned long) (p[i] >> (BITS_PER_MP_LIMB/2)),
(int) (sizeof(mp_limb_t)), (unsigned long) (p[i]));
#else
printf ("%0*lX", (int) (2 * sizeof(mp_limb_t)), p[i]);
diff --git a/gmp/tests/devel/try.c b/gmp/tests/devel/try.c
index 3911bc0091..e89b4507e3 100644
--- a/gmp/tests/devel/try.c
+++ b/gmp/tests/devel/try.c
@@ -3,22 +3,23 @@
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-2006, 2008, 2009, 2011, 2012 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2008 Free Software
+Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Usage: try [options] <function>...
@@ -95,7 +96,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
stuff common to all functions, but the exceptions get messy.
When there's no overlap, run with both src>dst and src<dst. A subtle
- calling-conventions violation occurred in a P6 copy which depended on the
+ calling-conventions violation occured in a P6 copy which depended on the
relative location of src and dst.
multiplier_N is more or less a third source region for the addmul_N
@@ -210,16 +211,16 @@ int option_data = DATA_TRAND;
mp_size_t pagesize;
-#define PAGESIZE_LIMBS (pagesize / GMP_LIMB_BYTES)
+#define PAGESIZE_LIMBS (pagesize / BYTES_PER_MP_LIMB)
/* must be a multiple of the page size */
#define REDZONE_BYTES (pagesize * 16)
-#define REDZONE_LIMBS (REDZONE_BYTES / GMP_LIMB_BYTES)
+#define REDZONE_LIMBS (REDZONE_BYTES / BYTES_PER_MP_LIMB)
#define MAX3(x,y,z) (MAX (x, MAX (y, z)))
-#if GMP_LIMB_BITS == 32
+#if BITS_PER_MP_LIMB == 32
#define DEADVAL CNST_LIMB(0xDEADBEEF)
#else
#define DEADVAL CNST_LIMB(0xDEADBEEFBADDCAFE)
@@ -239,7 +240,7 @@ struct region_t {
int trap_location = TRAP_NOWHERE;
-#define NUM_SOURCES 5
+#define NUM_SOURCES 2
#define NUM_DESTS 2
struct source_t {
@@ -288,7 +289,7 @@ struct each_t fun = { "Fun" };
#define SRC_SIZE(n) ((n) == 1 && tr->size2 ? size2 : size)
-void validate_fail (void);
+void validate_fail __GMP_PROTO ((void));
#if HAVE_TRY_NEW_C
@@ -296,41 +297,37 @@ void validate_fail (void);
#endif
-typedef mp_limb_t (*tryfun_t) (ANYARGS);
+typedef mp_limb_t (*tryfun_t) __GMP_PROTO ((ANYARGS));
struct try_t {
char retval;
- char src[NUM_SOURCES];
- char dst[NUM_DESTS];
+ char src[2];
+ char dst[2];
#define SIZE_YES 1
#define SIZE_ALLOW_ZERO 2
#define SIZE_1 3 /* 1 limb */
#define SIZE_2 4 /* 2 limbs */
#define SIZE_3 5 /* 3 limbs */
-#define SIZE_4 6 /* 4 limbs */
-#define SIZE_6 7 /* 6 limbs */
-#define SIZE_FRACTION 8 /* size2 is fraction for divrem etc */
-#define SIZE_SIZE2 9
-#define SIZE_PLUS_1 10
-#define SIZE_SUM 11
-#define SIZE_DIFF 12
-#define SIZE_DIFF_PLUS_1 13
-#define SIZE_DIFF_PLUS_3 14
-#define SIZE_RETVAL 15
-#define SIZE_CEIL_HALF 16
-#define SIZE_GET_STR 17
-#define SIZE_PLUS_MSIZE_SUB_1 18 /* size+msize-1 */
-#define SIZE_ODD 19
+#define SIZE_FRACTION 6 /* size2 is fraction for divrem etc */
+#define SIZE_SIZE2 7
+#define SIZE_PLUS_1 8
+#define SIZE_SUM 9
+#define SIZE_DIFF 10
+#define SIZE_DIFF_PLUS_1 11
+#define SIZE_RETVAL 12
+#define SIZE_CEIL_HALF 13
+#define SIZE_GET_STR 14
+#define SIZE_PLUS_MSIZE_SUB_1 15 /* size+msize-1 */
char size;
char size2;
- char dst_size[NUM_DESTS];
+ char dst_size[2];
/* multiplier_N size in limbs */
mp_size_t msize;
- char dst_bytes[NUM_DESTS];
+ char dst_bytes[2];
char dst0_from_src1;
@@ -354,14 +351,10 @@ struct try_t {
#define DATA_NON_ZERO 1
#define DATA_GCD 2
-#define DATA_SRC0_ODD 3
-#define DATA_SRC0_HIGHBIT 4
-#define DATA_SRC1_ODD 5
-#define DATA_SRC1_ODD_PRIME 6
-#define DATA_SRC1_HIGHBIT 7
-#define DATA_MULTIPLE_DIVISOR 8
-#define DATA_UDIV_QRNND 9
-#define DATA_DIV_QR_1 10
+#define DATA_SRC1_ODD 3
+#define DATA_SRC1_HIGHBIT 4
+#define DATA_MULTIPLE_DIVISOR 5
+#define DATA_UDIV_QRNND 6
char data;
/* Default is allow full overlap. */
@@ -370,13 +363,12 @@ struct try_t {
#define OVERLAP_HIGH_TO_LOW 3
#define OVERLAP_NOT_SRCS 4
#define OVERLAP_NOT_SRC2 8
-#define OVERLAP_NOT_DST2 16
char overlap;
tryfun_t reference;
const char *reference_name;
- void (*validate) (void);
+ void (*validate) __GMP_PROTO ((void));
const char *validate_name;
};
@@ -444,36 +436,6 @@ validate_divexact_1 (void)
validate_fail ();
}
-void
-validate_bdiv_q_1
- (void)
-{
- mp_srcptr src = s[0].p;
- mp_srcptr dst = fun.d[0].p;
- int error = 0;
-
- ASSERT (size >= 1);
-
- {
- mp_ptr tp = refmpn_malloc_limbs (size + 1);
-
- refmpn_mul_1 (tp, dst, size, divisor);
- /* Set ignored low bits */
- tp[0] |= (src[0] & LOW_ZEROS_MASK (divisor));
- if (! refmpn_equal_anynail (tp, src, size))
- {
- printf ("Bdiv wrong: res * divisor != src (mod B^size)\n");
- mpn_trace ("res ", dst, size);
- mpn_trace ("src ", src, size);
- error = 1;
- }
- free (tp);
- }
-
- if (error)
- validate_fail ();
-}
-
void
validate_modexact_1c_odd (void)
@@ -540,40 +502,6 @@ 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)
@@ -623,69 +551,104 @@ validate_sqrtrem (void)
as they're all distinct and within the size of param[]. Renumber
whenever necessary or desired. */
-enum {
- TYPE_ADD = 1, TYPE_ADD_N, TYPE_ADD_NC, TYPE_SUB, TYPE_SUB_N, TYPE_SUB_NC,
-
- TYPE_ADD_ERR1_N, TYPE_ADD_ERR2_N, TYPE_ADD_ERR3_N,
- TYPE_SUB_ERR1_N, TYPE_SUB_ERR2_N, TYPE_SUB_ERR3_N,
-
- TYPE_MUL_1, TYPE_MUL_1C,
-
- TYPE_MUL_2, TYPE_MUL_3, TYPE_MUL_4, TYPE_MUL_5, TYPE_MUL_6,
-
- TYPE_ADDMUL_1, TYPE_ADDMUL_1C, TYPE_SUBMUL_1, TYPE_SUBMUL_1C,
-
- TYPE_ADDMUL_2, TYPE_ADDMUL_3, TYPE_ADDMUL_4, TYPE_ADDMUL_5, TYPE_ADDMUL_6,
- TYPE_ADDMUL_7, TYPE_ADDMUL_8,
-
- TYPE_ADDSUB_N, TYPE_ADDSUB_NC,
-
- TYPE_RSHIFT, TYPE_LSHIFT, TYPE_LSHIFTC,
-
- TYPE_COPY, TYPE_COPYI, TYPE_COPYD, TYPE_COM,
-
- TYPE_ADDLSH1_N, TYPE_ADDLSH2_N, TYPE_ADDLSH_N,
- TYPE_ADDLSH1_N_IP1, TYPE_ADDLSH2_N_IP1, TYPE_ADDLSH_N_IP1,
- TYPE_ADDLSH1_N_IP2, TYPE_ADDLSH2_N_IP2, TYPE_ADDLSH_N_IP2,
- TYPE_SUBLSH1_N, TYPE_SUBLSH2_N, TYPE_SUBLSH_N,
- TYPE_SUBLSH1_N_IP1, TYPE_SUBLSH2_N_IP1, TYPE_SUBLSH_N_IP1,
- TYPE_RSBLSH1_N, TYPE_RSBLSH2_N, TYPE_RSBLSH_N,
- TYPE_RSH1ADD_N, TYPE_RSH1SUB_N,
-
- TYPE_ADDLSH1_NC, TYPE_ADDLSH2_NC, TYPE_ADDLSH_NC,
- TYPE_SUBLSH1_NC, TYPE_SUBLSH2_NC, TYPE_SUBLSH_NC,
- TYPE_RSBLSH1_NC, TYPE_RSBLSH2_NC, TYPE_RSBLSH_NC,
-
- TYPE_ADDCND_N, TYPE_SUBCND_N,
-
- 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,
- TYPE_MODEXACT_1_ODD, TYPE_MODEXACT_1C_ODD,
-
- TYPE_INVERT, TYPE_BINVERT,
-
- TYPE_GCD, TYPE_GCD_1, TYPE_GCD_FINDA, TYPE_MPZ_JACOBI, TYPE_MPZ_KRONECKER,
- TYPE_MPZ_KRONECKER_UI, TYPE_MPZ_KRONECKER_SI, TYPE_MPZ_UI_KRONECKER,
- TYPE_MPZ_SI_KRONECKER, TYPE_MPZ_LEGENDRE,
-
- TYPE_AND_N, TYPE_NAND_N, TYPE_ANDN_N, TYPE_IOR_N, TYPE_IORN_N, TYPE_NIOR_N,
- TYPE_XOR_N, TYPE_XNOR_N,
-
- TYPE_MUL_MN, TYPE_MUL_N, TYPE_SQR, TYPE_UMUL_PPMM, TYPE_UMUL_PPMM_R,
- TYPE_MULLO_N, TYPE_MULMID_MN, TYPE_MULMID_N,
-
- TYPE_SBPI1_DIV_QR, TYPE_TDIV_QR,
-
- TYPE_SQRTREM, TYPE_ZERO, TYPE_GET_STR, TYPE_POPCOUNT, TYPE_HAMDIST,
-
- TYPE_EXTRA
-};
-
-struct try_t param[TYPE_EXTRA];
+#define TYPE_ADD 1
+#define TYPE_ADD_N 2
+#define TYPE_ADD_NC 3
+#define TYPE_SUB 4
+#define TYPE_SUB_N 5
+#define TYPE_SUB_NC 6
+
+#define TYPE_MUL_1 7
+#define TYPE_MUL_1C 8
+
+#define TYPE_MUL_2 9
+#define TYPE_MUL_3 92
+#define TYPE_MUL_4 93
+
+#define TYPE_ADDMUL_1 10
+#define TYPE_ADDMUL_1C 11
+#define TYPE_SUBMUL_1 12
+#define TYPE_SUBMUL_1C 13
+
+#define TYPE_ADDMUL_2 14
+#define TYPE_ADDMUL_3 15
+#define TYPE_ADDMUL_4 16
+#define TYPE_ADDMUL_5 17
+#define TYPE_ADDMUL_6 18
+#define TYPE_ADDMUL_7 19
+#define TYPE_ADDMUL_8 20
+
+#define TYPE_ADDSUB_N 21
+#define TYPE_ADDSUB_NC 22
+
+#define TYPE_RSHIFT 23
+#define TYPE_LSHIFT 24
+
+#define TYPE_COPY 25
+#define TYPE_COPYI 26
+#define TYPE_COPYD 27
+#define TYPE_COM_N 28
+
+#define TYPE_ADDLSH1_N 30
+#define TYPE_SUBLSH1_N 31
+#define TYPE_RSH1ADD_N 32
+#define TYPE_RSH1SUB_N 33
+
+#define TYPE_MOD_1 35
+#define TYPE_MOD_1C 36
+#define TYPE_DIVMOD_1 37
+#define TYPE_DIVMOD_1C 38
+#define TYPE_DIVREM_1 39
+#define TYPE_DIVREM_1C 40
+#define TYPE_PREINV_DIVREM_1 41
+#define TYPE_PREINV_MOD_1 42
+#define TYPE_MOD_34LSUB1 43
+#define TYPE_UDIV_QRNND 44
+#define TYPE_UDIV_QRNND_R 45
+
+#define TYPE_DIVEXACT_1 50
+#define TYPE_DIVEXACT_BY3 51
+#define TYPE_DIVEXACT_BY3C 52
+#define TYPE_MODEXACT_1_ODD 53
+#define TYPE_MODEXACT_1C_ODD 54
+
+#define TYPE_GCD 60
+#define TYPE_GCD_1 61
+#define TYPE_GCD_FINDA 62
+#define TYPE_MPZ_JACOBI 63
+#define TYPE_MPZ_KRONECKER 64
+#define TYPE_MPZ_KRONECKER_UI 65
+#define TYPE_MPZ_KRONECKER_SI 66
+#define TYPE_MPZ_UI_KRONECKER 67
+#define TYPE_MPZ_SI_KRONECKER 68
+
+#define TYPE_AND_N 70
+#define TYPE_NAND_N 71
+#define TYPE_ANDN_N 72
+#define TYPE_IOR_N 73
+#define TYPE_IORN_N 74
+#define TYPE_NIOR_N 75
+#define TYPE_XOR_N 76
+#define TYPE_XNOR_N 77
+
+#define TYPE_MUL_MN 80
+#define TYPE_MUL_N 81
+#define TYPE_SQR 82
+#define TYPE_UMUL_PPMM 83
+#define TYPE_UMUL_PPMM_R 84
+
+#define TYPE_SB_DIVREM_MN 90
+#define TYPE_TDIV_QR 91
+
+#define TYPE_SQRTREM 100
+#define TYPE_ZERO 101
+#define TYPE_GET_STR 102
+#define TYPE_POPCOUNT 103
+#define TYPE_HAMDIST 104
+
+#define TYPE_EXTRA 110
+
+struct try_t param[150];
void
@@ -743,53 +706,6 @@ param_init (void)
REFERENCE (refmpn_sub);
- p = &param[TYPE_ADD_ERR1_N];
- p->retval = 1;
- p->dst[0] = 1;
- p->dst[1] = 1;
- p->src[0] = 1;
- p->src[1] = 1;
- p->src[2] = 1;
- p->dst_size[1] = SIZE_2;
- p->carry = CARRY_BIT;
- p->overlap = OVERLAP_NOT_DST2;
- REFERENCE (refmpn_add_err1_n);
-
- p = &param[TYPE_SUB_ERR1_N];
- COPY (TYPE_ADD_ERR1_N);
- REFERENCE (refmpn_sub_err1_n);
-
- p = &param[TYPE_ADD_ERR2_N];
- COPY (TYPE_ADD_ERR1_N);
- p->src[3] = 1;
- p->dst_size[1] = SIZE_4;
- REFERENCE (refmpn_add_err2_n);
-
- p = &param[TYPE_SUB_ERR2_N];
- COPY (TYPE_ADD_ERR2_N);
- REFERENCE (refmpn_sub_err2_n);
-
- p = &param[TYPE_ADD_ERR3_N];
- COPY (TYPE_ADD_ERR2_N);
- p->src[4] = 1;
- p->dst_size[1] = SIZE_6;
- REFERENCE (refmpn_add_err3_n);
-
- p = &param[TYPE_SUB_ERR3_N];
- COPY (TYPE_ADD_ERR3_N);
- REFERENCE (refmpn_sub_err3_n);
-
- p = &param[TYPE_ADDCND_N];
- COPY (TYPE_ADD_N);
- p->carry = CARRY_BIT;
- REFERENCE (refmpn_cnd_add_n);
-
- p = &param[TYPE_SUBCND_N];
- COPY (TYPE_ADD_N);
- p->carry = CARRY_BIT;
- REFERENCE (refmpn_cnd_sub_n);
-
-
p = &param[TYPE_MUL_1];
p->retval = 1;
p->dst[0] = 1;
@@ -824,16 +740,6 @@ param_init (void)
p->msize = 4;
REFERENCE (refmpn_mul_4);
- p = &param[TYPE_MUL_5];
- COPY (TYPE_MUL_2);
- p->msize = 5;
- REFERENCE (refmpn_mul_5);
-
- p = &param[TYPE_MUL_6];
- COPY (TYPE_MUL_2);
- p->msize = 6;
- REFERENCE (refmpn_mul_6);
-
p = &param[TYPE_ADDMUL_1];
p->retval = 1;
@@ -865,7 +771,7 @@ param_init (void)
p->src[1] = 1;
p->msize = 2;
p->dst0_from_src1 = 1;
- p->overlap = OVERLAP_NONE;
+ p->overlap = OVERLAP_NOT_SRC2;
REFERENCE (refmpn_addmul_2);
p = &param[TYPE_ADDMUL_3];
@@ -940,12 +846,12 @@ param_init (void)
p->dst[1] = 1;
p->src[0] = 1;
p->src[1] = 1;
- REFERENCE (refmpn_add_n_sub_n);
+ REFERENCE (refmpn_addsub_n);
p = &param[TYPE_ADDSUB_NC];
COPY (TYPE_ADDSUB_N);
p->carry = CARRY_4;
- REFERENCE (refmpn_add_n_sub_nc);
+ REFERENCE (refmpn_addsub_nc);
p = &param[TYPE_COPY];
@@ -969,89 +875,20 @@ param_init (void)
p->size = SIZE_ALLOW_ZERO;
REFERENCE (refmpn_copyd);
- p = &param[TYPE_COM];
+ p = &param[TYPE_COM_N];
p->dst[0] = 1;
p->src[0] = 1;
- REFERENCE (refmpn_com);
+ REFERENCE (refmpn_com_n);
p = &param[TYPE_ADDLSH1_N];
COPY (TYPE_ADD_N);
REFERENCE (refmpn_addlsh1_n);
- p = &param[TYPE_ADDLSH2_N];
- COPY (TYPE_ADD_N);
- REFERENCE (refmpn_addlsh2_n);
-
- p = &param[TYPE_ADDLSH_N];
- COPY (TYPE_ADD_N);
- p->shift = 1;
- REFERENCE (refmpn_addlsh_n);
-
- p = &param[TYPE_ADDLSH1_N_IP1];
- p->retval = 1;
- p->dst[0] = 1;
- p->src[0] = 1;
- p->dst0_from_src1 = 1;
- REFERENCE (refmpn_addlsh1_n_ip1);
-
- p = &param[TYPE_ADDLSH2_N_IP1];
- COPY (TYPE_ADDLSH1_N_IP1);
- REFERENCE (refmpn_addlsh2_n_ip1);
-
- p = &param[TYPE_ADDLSH_N_IP1];
- COPY (TYPE_ADDLSH1_N_IP1);
- p->shift = 1;
- REFERENCE (refmpn_addlsh_n_ip1);
-
- p = &param[TYPE_ADDLSH1_N_IP2];
- COPY (TYPE_ADDLSH1_N_IP1);
- REFERENCE (refmpn_addlsh1_n_ip2);
-
- p = &param[TYPE_ADDLSH2_N_IP2];
- COPY (TYPE_ADDLSH1_N_IP1);
- REFERENCE (refmpn_addlsh2_n_ip2);
-
- p = &param[TYPE_ADDLSH_N_IP2];
- COPY (TYPE_ADDLSH_N_IP1);
- REFERENCE (refmpn_addlsh_n_ip2);
-
p = &param[TYPE_SUBLSH1_N];
COPY (TYPE_ADD_N);
REFERENCE (refmpn_sublsh1_n);
- p = &param[TYPE_SUBLSH2_N];
- COPY (TYPE_ADD_N);
- REFERENCE (refmpn_sublsh2_n);
-
- p = &param[TYPE_SUBLSH_N];
- COPY (TYPE_ADDLSH_N);
- REFERENCE (refmpn_sublsh_n);
-
- p = &param[TYPE_SUBLSH1_N_IP1];
- COPY (TYPE_ADDLSH1_N_IP1);
- REFERENCE (refmpn_sublsh1_n_ip1);
-
- p = &param[TYPE_SUBLSH2_N_IP1];
- COPY (TYPE_ADDLSH1_N_IP1);
- REFERENCE (refmpn_sublsh2_n_ip1);
-
- p = &param[TYPE_SUBLSH_N_IP1];
- COPY (TYPE_ADDLSH_N_IP1);
- REFERENCE (refmpn_sublsh_n_ip1);
-
- p = &param[TYPE_RSBLSH1_N];
- COPY (TYPE_ADD_N);
- REFERENCE (refmpn_rsblsh1_n);
-
- p = &param[TYPE_RSBLSH2_N];
- COPY (TYPE_ADD_N);
- REFERENCE (refmpn_rsblsh2_n);
-
- p = &param[TYPE_RSBLSH_N];
- COPY (TYPE_ADDLSH_N);
- REFERENCE (refmpn_rsblsh_n);
-
p = &param[TYPE_RSH1ADD_N];
COPY (TYPE_ADD_N);
REFERENCE (refmpn_rsh1add_n);
@@ -1061,49 +898,6 @@ param_init (void)
REFERENCE (refmpn_rsh1sub_n);
- p = &param[TYPE_ADDLSH1_NC];
- COPY (TYPE_ADDLSH1_N);
- p->carry = CARRY_3;
- REFERENCE (refmpn_addlsh1_nc);
-
- p = &param[TYPE_ADDLSH2_NC];
- COPY (TYPE_ADDLSH2_N);
- p->carry = CARRY_4; /* FIXME */
- REFERENCE (refmpn_addlsh2_nc);
-
- p = &param[TYPE_ADDLSH_NC];
- COPY (TYPE_ADDLSH_N);
- p->carry = CARRY_BIT; /* FIXME */
- REFERENCE (refmpn_addlsh_nc);
-
- p = &param[TYPE_SUBLSH1_NC];
- COPY (TYPE_ADDLSH1_NC);
- REFERENCE (refmpn_sublsh1_nc);
-
- p = &param[TYPE_SUBLSH2_NC];
- COPY (TYPE_ADDLSH2_NC);
- REFERENCE (refmpn_sublsh2_nc);
-
- p = &param[TYPE_SUBLSH_NC];
- COPY (TYPE_ADDLSH_NC);
- REFERENCE (refmpn_sublsh_nc);
-
- p = &param[TYPE_RSBLSH1_NC];
- COPY (TYPE_RSBLSH1_N);
- p->carry = CARRY_BIT; /* FIXME */
- REFERENCE (refmpn_rsblsh1_nc);
-
- p = &param[TYPE_RSBLSH2_NC];
- COPY (TYPE_RSBLSH2_N);
- p->carry = CARRY_4; /* FIXME */
- REFERENCE (refmpn_rsblsh2_nc);
-
- p = &param[TYPE_RSBLSH_NC];
- COPY (TYPE_RSBLSH_N);
- p->carry = CARRY_BIT; /* FIXME */
- REFERENCE (refmpn_rsblsh_nc);
-
-
p = &param[TYPE_MOD_1];
p->retval = 1;
p->src[0] = 1;
@@ -1142,17 +936,6 @@ 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;
@@ -1187,11 +970,6 @@ param_init (void)
VALIDATE (validate_divexact_1);
REFERENCE (refmpn_divmod_1);
- p = &param[TYPE_BDIV_Q_1];
- p->dst[0] = 1;
- p->src[0] = 1;
- p->divisor = DIVISOR_LIMB;
- VALIDATE (validate_bdiv_q_1);
p = &param[TYPE_DIVEXACT_BY3];
p->retval = 1;
@@ -1236,17 +1014,6 @@ param_init (void)
REFERENCE (refmpn_gcd);
- p = &param[TYPE_MPZ_LEGENDRE];
- p->retval = 1;
- p->src[0] = 1;
- p->size = SIZE_ALLOW_ZERO;
- p->src[1] = 1;
- p->data = DATA_SRC1_ODD_PRIME;
- p->size2 = 1;
- p->carry = CARRY_BIT;
- p->carry_sign = 1;
- REFERENCE (refmpz_legendre);
-
p = &param[TYPE_MPZ_JACOBI];
p->retval = 1;
p->src[0] = 1;
@@ -1254,19 +1021,13 @@ param_init (void)
p->src[1] = 1;
p->data = DATA_SRC1_ODD;
p->size2 = 1;
- p->carry = CARRY_BIT;
+ p->carry = CARRY_4;
p->carry_sign = 1;
REFERENCE (refmpz_jacobi);
p = &param[TYPE_MPZ_KRONECKER];
- p->retval = 1;
- p->src[0] = 1;
- p->size = SIZE_ALLOW_ZERO;
- p->src[1] = 1;
- p->data = 0;
- p->size2 = 1;
- p->carry = CARRY_4;
- p->carry_sign = 1;
+ COPY (TYPE_MPZ_JACOBI);
+ p->data = 0; /* clear inherited DATA_SRC1_ODD */
REFERENCE (refmpz_kronecker);
@@ -1303,28 +1064,11 @@ param_init (void)
p->src[1] = 1;
REFERENCE (refmpn_mul_n);
- p = &param[TYPE_MULLO_N];
- COPY (TYPE_MUL_N);
- p->dst_size[0] = 0;
- REFERENCE (refmpn_mullo_n);
-
p = &param[TYPE_MUL_MN];
COPY (TYPE_MUL_N);
p->size2 = 1;
REFERENCE (refmpn_mul_basecase);
- p = &param[TYPE_MULMID_MN];
- COPY (TYPE_MUL_MN);
- p->dst_size[0] = SIZE_DIFF_PLUS_3;
- REFERENCE (refmpn_mulmid_basecase);
-
- p = &param[TYPE_MULMID_N];
- COPY (TYPE_MUL_N);
- p->size = SIZE_ODD;
- p->size2 = SIZE_CEIL_HALF;
- p->dst_size[0] = SIZE_DIFF_PLUS_3;
- REFERENCE (refmpn_mulmid_n);
-
p = &param[TYPE_UMUL_PPMM];
p->retval = 1;
p->src[0] = 1;
@@ -1351,11 +1095,6 @@ param_init (void)
p->overlap = OVERLAP_HIGH_TO_LOW;
REFERENCE (refmpn_lshift);
- p = &param[TYPE_LSHIFTC];
- COPY (TYPE_RSHIFT);
- p->overlap = OVERLAP_HIGH_TO_LOW;
- REFERENCE (refmpn_lshiftc);
-
p = &param[TYPE_POPCOUNT];
p->retval = 1;
@@ -1368,7 +1107,7 @@ param_init (void)
REFERENCE (refmpn_hamdist);
- p = &param[TYPE_SBPI1_DIV_QR];
+ p = &param[TYPE_SB_DIVREM_MN];
p->retval = 1;
p->dst[0] = 1;
p->dst[1] = 1;
@@ -1378,7 +1117,7 @@ param_init (void)
p->size2 = 1;
p->dst_size[0] = SIZE_DIFF;
p->overlap = OVERLAP_NONE;
- REFERENCE (refmpn_sb_div_qr);
+ REFERENCE (refmpn_sb_divrem_mn);
p = &param[TYPE_TDIV_QR];
p->dst[0] = 1;
@@ -1418,20 +1157,6 @@ param_init (void)
p->overlap = OVERLAP_NONE;
REFERENCE (refmpn_get_str);
- p = &param[TYPE_BINVERT];
- p->dst[0] = 1;
- p->src[0] = 1;
- p->data = DATA_SRC0_ODD;
- p->overlap = OVERLAP_NONE;
- REFERENCE (refmpn_binvert);
-
- p = &param[TYPE_INVERT];
- p->dst[0] = 1;
- p->src[0] = 1;
- p->data = DATA_SRC0_HIGHBIT;
- p->overlap = OVERLAP_NONE;
- REFERENCE (refmpn_invert);
-
#ifdef EXTRA_PARAM_INIT
EXTRA_PARAM_INIT
#endif
@@ -1464,8 +1189,8 @@ __GMPN_COPY_INCR_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
#endif
void
-mpn_com_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{ mpn_com (rp, sp, size); }
+mpn_com_n_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{ mpn_com_n (rp, sp, size); }
void
mpn_and_n_fun (mp_ptr rp, mp_srcptr s1, mp_srcptr s2, mp_size_t size)
@@ -1513,70 +1238,6 @@ mpn_divexact_by3_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
return mpn_divexact_by3 (rp, sp, size);
}
-#if HAVE_NATIVE_mpn_addlsh1_n_ip1
-mp_limb_t
-mpn_addlsh1_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{
- return mpn_addlsh1_n_ip1 (rp, sp, size);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_n_ip1
-mp_limb_t
-mpn_addlsh2_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{
- return mpn_addlsh2_n_ip1 (rp, sp, size);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip1
-mp_limb_t
-mpn_addlsh_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
-{
- return mpn_addlsh_n_ip1 (rp, sp, size, sh);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh1_n_ip2
-mp_limb_t
-mpn_addlsh1_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{
- return mpn_addlsh1_n_ip2 (rp, sp, size);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_n_ip2
-mp_limb_t
-mpn_addlsh2_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{
- return mpn_addlsh2_n_ip2 (rp, sp, size);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip2
-mp_limb_t
-mpn_addlsh_n_ip2_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
-{
- return mpn_addlsh_n_ip2 (rp, sp, size, sh);
-}
-#endif
-#if HAVE_NATIVE_mpn_sublsh1_n_ip1
-mp_limb_t
-mpn_sublsh1_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{
- return mpn_sublsh1_n_ip1 (rp, sp, size);
-}
-#endif
-#if HAVE_NATIVE_mpn_sublsh2_n_ip1
-mp_limb_t
-mpn_sublsh2_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{
- return mpn_sublsh2_n_ip1 (rp, sp, size);
-}
-#endif
-#if HAVE_NATIVE_mpn_sublsh_n_ip1
-mp_limb_t
-mpn_sublsh_n_ip1_fun (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned int sh)
-{
- return mpn_sublsh_n_ip1 (rp, sp, size, sh);
-}
-#endif
-
mp_limb_t
mpn_modexact_1_odd_fun (mp_srcptr ptr, mp_size_t size, mp_limb_t divisor)
{
@@ -1584,79 +1245,43 @@ mpn_modexact_1_odd_fun (mp_srcptr ptr, mp_size_t size, mp_limb_t divisor)
}
void
-mpn_toom22_mul_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
+mpn_kara_mul_n_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
{
mp_ptr tspace;
TMP_DECL;
TMP_MARK;
- tspace = TMP_ALLOC_LIMBS (mpn_toom22_mul_itch (size, size));
- mpn_toom22_mul (dst, src1, size, src2, size, tspace);
- TMP_FREE;
+ tspace = TMP_ALLOC_LIMBS (MPN_KARA_MUL_N_TSIZE (size));
+ mpn_kara_mul_n (dst, src1, src2, size, tspace);
}
void
-mpn_toom2_sqr_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
+mpn_kara_sqr_n_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
{
mp_ptr tspace;
TMP_DECL;
TMP_MARK;
- tspace = TMP_ALLOC_LIMBS (mpn_toom2_sqr_itch (size));
- mpn_toom2_sqr (dst, src, size, tspace);
+ tspace = TMP_ALLOC_LIMBS (MPN_KARA_SQR_N_TSIZE (size));
+ mpn_kara_sqr_n (dst, src, size, tspace);
TMP_FREE;
}
void
-mpn_toom33_mul_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
+mpn_toom3_mul_n_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
{
mp_ptr tspace;
TMP_DECL;
TMP_MARK;
- tspace = TMP_ALLOC_LIMBS (mpn_toom33_mul_itch (size, size));
- mpn_toom33_mul (dst, src1, size, src2, size, tspace);
- TMP_FREE;
-}
-void
-mpn_toom3_sqr_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
-{
- mp_ptr tspace;
- TMP_DECL;
- TMP_MARK;
- tspace = TMP_ALLOC_LIMBS (mpn_toom3_sqr_itch (size));
- mpn_toom3_sqr (dst, src, size, tspace);
- TMP_FREE;
-}
-void
-mpn_toom44_mul_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2, mp_size_t size)
-{
- mp_ptr tspace;
- TMP_DECL;
- TMP_MARK;
- tspace = TMP_ALLOC_LIMBS (mpn_toom44_mul_itch (size, size));
- mpn_toom44_mul (dst, src1, size, src2, size, tspace);
- TMP_FREE;
+ tspace = TMP_ALLOC_LIMBS (MPN_TOOM3_MUL_N_TSIZE (size));
+ mpn_toom3_mul_n (dst, src1, src2, size, tspace);
}
void
-mpn_toom4_sqr_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
+mpn_toom3_sqr_n_fun (mp_ptr dst, mp_srcptr src, mp_size_t size)
{
mp_ptr tspace;
TMP_DECL;
TMP_MARK;
- tspace = TMP_ALLOC_LIMBS (mpn_toom4_sqr_itch (size));
- mpn_toom4_sqr (dst, src, size, tspace);
+ tspace = TMP_ALLOC_LIMBS (MPN_TOOM3_SQR_N_TSIZE (size));
+ mpn_toom3_sqr_n (dst, src, size, tspace);
TMP_FREE;
}
-
-void
-mpn_toom42_mulmid_fun (mp_ptr dst, mp_srcptr src1, mp_srcptr src2,
- mp_size_t size)
-{
- mp_ptr tspace;
- mp_size_t n;
- TMP_DECL;
- TMP_MARK;
- tspace = TMP_ALLOC_LIMBS (mpn_toom42_mulmid_itch (size));
- mpn_toom42_mulmid (dst, src1, src2, size, tspace);
- TMP_FREE;
-}
-
mp_limb_t
umul_ppmm_fun (mp_limb_t *lowptr, mp_limb_t m1, mp_limb_t m2)
{
@@ -1699,20 +1324,13 @@ const struct choice_t choice_array[] = {
{ TRY(mpn_sub_nc), TYPE_SUB_NC },
#endif
-#if HAVE_NATIVE_mpn_add_n_sub_n
- { TRY(mpn_add_n_sub_n), TYPE_ADDSUB_N },
+#if HAVE_NATIVE_mpn_addsub_n
+ { TRY(mpn_addsub_n), TYPE_ADDSUB_N },
#endif
-#if HAVE_NATIVE_mpn_add_n_sub_nc
- { TRY(mpn_add_n_sub_nc), TYPE_ADDSUB_NC },
+#if HAVE_NATIVE_mpn_addsub_nc
+ { TRY(mpn_addsub_nc), TYPE_ADDSUB_NC },
#endif
- { TRY(mpn_add_err1_n), TYPE_ADD_ERR1_N },
- { TRY(mpn_sub_err1_n), TYPE_SUB_ERR1_N },
- { TRY(mpn_add_err2_n), TYPE_ADD_ERR2_N },
- { TRY(mpn_sub_err2_n), TYPE_SUB_ERR2_N },
- { TRY(mpn_add_err3_n), TYPE_ADD_ERR3_N },
- { TRY(mpn_sub_err3_n), TYPE_SUB_ERR3_N },
-
{ TRY(mpn_addmul_1), TYPE_ADDMUL_1 },
{ TRY(mpn_submul_1), TYPE_SUBMUL_1 },
#if HAVE_NATIVE_mpn_addmul_1c
@@ -1744,7 +1362,7 @@ const struct choice_t choice_array[] = {
{ TRY(mpn_addmul_8), TYPE_ADDMUL_8, 8 },
#endif
- { TRY_FUNFUN(mpn_com), TYPE_COM },
+ { TRY_FUNFUN(mpn_com_n), TYPE_COM_N },
{ TRY_FUNFUN(MPN_COPY), TYPE_COPY },
{ TRY_FUNFUN(MPN_COPY_INCR), TYPE_COPYI },
@@ -1762,62 +1380,12 @@ const struct choice_t choice_array[] = {
{ TRY(mpn_copyd), TYPE_COPYD },
#endif
- { TRY(mpn_cnd_add_n), TYPE_ADDCND_N },
- { TRY(mpn_cnd_sub_n), TYPE_SUBCND_N },
-#if HAVE_NATIVE_mpn_addlsh1_n == 1
+#if HAVE_NATIVE_mpn_addlsh1_n
{ TRY(mpn_addlsh1_n), TYPE_ADDLSH1_N },
#endif
-#if HAVE_NATIVE_mpn_addlsh2_n == 1
- { TRY(mpn_addlsh2_n), TYPE_ADDLSH2_N },
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n
- { TRY(mpn_addlsh_n), TYPE_ADDLSH_N },
-#endif
-#if HAVE_NATIVE_mpn_addlsh1_n_ip1
- { TRY_FUNFUN(mpn_addlsh1_n_ip1), TYPE_ADDLSH1_N_IP1 },
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_n_ip1
- { TRY_FUNFUN(mpn_addlsh2_n_ip1), TYPE_ADDLSH2_N_IP1 },
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip1
- { TRY_FUNFUN(mpn_addlsh_n_ip1), TYPE_ADDLSH_N_IP1 },
-#endif
-#if HAVE_NATIVE_mpn_addlsh1_n_ip2
- { TRY_FUNFUN(mpn_addlsh1_n_ip2), TYPE_ADDLSH1_N_IP2 },
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_n_ip2
- { TRY_FUNFUN(mpn_addlsh2_n_ip2), TYPE_ADDLSH2_N_IP2 },
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip2
- { TRY_FUNFUN(mpn_addlsh_n_ip2), TYPE_ADDLSH_N_IP2 },
-#endif
-#if HAVE_NATIVE_mpn_sublsh1_n == 1
+#if HAVE_NATIVE_mpn_sublsh1_n
{ TRY(mpn_sublsh1_n), TYPE_SUBLSH1_N },
#endif
-#if HAVE_NATIVE_mpn_sublsh2_n == 1
- { TRY(mpn_sublsh2_n), TYPE_SUBLSH2_N },
-#endif
-#if HAVE_NATIVE_mpn_sublsh_n
- { TRY(mpn_sublsh_n), TYPE_SUBLSH_N },
-#endif
-#if HAVE_NATIVE_mpn_sublsh1_n_ip1
- { TRY_FUNFUN(mpn_sublsh1_n_ip1), TYPE_SUBLSH1_N_IP1 },
-#endif
-#if HAVE_NATIVE_mpn_sublsh2_n_ip1
- { TRY_FUNFUN(mpn_sublsh2_n_ip1), TYPE_SUBLSH2_N_IP1 },
-#endif
-#if HAVE_NATIVE_mpn_sublsh_n_ip1
- { TRY_FUNFUN(mpn_sublsh_n_ip1), TYPE_SUBLSH_N_IP1 },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh1_n == 1
- { TRY(mpn_rsblsh1_n), TYPE_RSBLSH1_N },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh2_n == 1
- { TRY(mpn_rsblsh2_n), TYPE_RSBLSH2_N },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh_n
- { TRY(mpn_rsblsh_n), TYPE_RSBLSH_N },
-#endif
#if HAVE_NATIVE_mpn_rsh1add_n
{ TRY(mpn_rsh1add_n), TYPE_RSH1ADD_N },
#endif
@@ -1825,34 +1393,6 @@ const struct choice_t choice_array[] = {
{ TRY(mpn_rsh1sub_n), TYPE_RSH1SUB_N },
#endif
-#if HAVE_NATIVE_mpn_addlsh1_nc
- { TRY(mpn_addlsh1_nc), TYPE_ADDLSH1_NC },
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_nc
- { TRY(mpn_addlsh2_nc), TYPE_ADDLSH2_NC },
-#endif
-#if HAVE_NATIVE_mpn_addlsh_nc
- { TRY(mpn_addlsh_nc), TYPE_ADDLSH_NC },
-#endif
-#if HAVE_NATIVE_mpn_sublsh1_nc
- { TRY(mpn_sublsh1_nc), TYPE_SUBLSH1_NC },
-#endif
-#if HAVE_NATIVE_mpn_sublsh2_nc
- { TRY(mpn_sublsh2_nc), TYPE_SUBLSH2_NC },
-#endif
-#if HAVE_NATIVE_mpn_sublsh_nc
- { TRY(mpn_sublsh_nc), TYPE_SUBLSH_NC },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh1_nc
- { TRY(mpn_rsblsh1_nc), TYPE_RSBLSH1_NC },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh2_nc
- { TRY(mpn_rsblsh2_nc), TYPE_RSBLSH2_NC },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh_nc
- { TRY(mpn_rsblsh_nc), TYPE_RSBLSH_NC },
-#endif
-
{ TRY_FUNFUN(mpn_and_n), TYPE_AND_N },
{ TRY_FUNFUN(mpn_andn_n), TYPE_ANDN_N },
{ TRY_FUNFUN(mpn_nand_n), TYPE_NAND_N },
@@ -1876,7 +1416,6 @@ 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
@@ -1890,7 +1429,6 @@ const struct choice_t choice_array[] = {
#endif
{ TRY(mpn_divexact_1), TYPE_DIVEXACT_1 },
- { TRY(mpn_bdiv_q_1), TYPE_BDIV_Q_1 },
{ TRY_FUNFUN(mpn_divexact_by3), TYPE_DIVEXACT_BY3 },
{ TRY(mpn_divexact_by3c), TYPE_DIVEXACT_BY3C },
@@ -1898,7 +1436,7 @@ const struct choice_t choice_array[] = {
{ TRY(mpn_modexact_1c_odd), TYPE_MODEXACT_1C_ODD },
- { TRY(mpn_sbpi1_div_qr), TYPE_SBPI1_DIV_QR, 3},
+ { TRY(mpn_sb_divrem_mn), TYPE_SB_DIVREM_MN, 3},
{ TRY(mpn_tdiv_qr), TYPE_TDIV_QR },
{ TRY(mpn_mul_1), TYPE_MUL_1 },
@@ -1914,28 +1452,19 @@ const struct choice_t choice_array[] = {
#if HAVE_NATIVE_mpn_mul_4
{ TRY(mpn_mul_4), TYPE_MUL_4, 4 },
#endif
-#if HAVE_NATIVE_mpn_mul_5
- { TRY(mpn_mul_5), TYPE_MUL_5, 5 },
-#endif
-#if HAVE_NATIVE_mpn_mul_6
- { TRY(mpn_mul_6), TYPE_MUL_6, 6 },
-#endif
{ TRY(mpn_rshift), TYPE_RSHIFT },
{ TRY(mpn_lshift), TYPE_LSHIFT },
- { TRY(mpn_lshiftc), TYPE_LSHIFTC },
{ TRY(mpn_mul_basecase), TYPE_MUL_MN },
- { TRY(mpn_mulmid_basecase), TYPE_MULMID_MN },
- { TRY(mpn_mullo_basecase), TYPE_MULLO_N },
-#if SQR_TOOM2_THRESHOLD > 0
+#if SQR_KARATSUBA_THRESHOLD > 0
{ TRY(mpn_sqr_basecase), TYPE_SQR },
#endif
{ TRY(mpn_mul), TYPE_MUL_MN },
{ TRY(mpn_mul_n), TYPE_MUL_N },
- { TRY(mpn_sqr), TYPE_SQR },
+ { TRY(mpn_sqr_n), TYPE_SQR },
{ TRY_FUNFUN(umul_ppmm), TYPE_UMUL_PPMM, 2 },
#if HAVE_NATIVE_mpn_umul_ppmm
@@ -1945,23 +1474,14 @@ const struct choice_t choice_array[] = {
{ TRY(mpn_umul_ppmm_r), TYPE_UMUL_PPMM_R, 2 },
#endif
- { TRY_FUNFUN(mpn_toom22_mul), TYPE_MUL_N, MPN_TOOM22_MUL_MINSIZE },
- { TRY_FUNFUN(mpn_toom2_sqr), TYPE_SQR, MPN_TOOM2_SQR_MINSIZE },
- { TRY_FUNFUN(mpn_toom33_mul), TYPE_MUL_N, MPN_TOOM33_MUL_MINSIZE },
- { TRY_FUNFUN(mpn_toom3_sqr), TYPE_SQR, MPN_TOOM3_SQR_MINSIZE },
- { TRY_FUNFUN(mpn_toom44_mul), TYPE_MUL_N, MPN_TOOM44_MUL_MINSIZE },
- { TRY_FUNFUN(mpn_toom4_sqr), TYPE_SQR, MPN_TOOM4_SQR_MINSIZE },
-
- { TRY(mpn_mulmid_n), TYPE_MULMID_N, 1 },
- { TRY(mpn_mulmid), TYPE_MULMID_MN, 1 },
- { TRY_FUNFUN(mpn_toom42_mulmid), TYPE_MULMID_N,
- (2 * MPN_TOOM42_MULMID_MINSIZE - 1) },
+ { TRY_FUNFUN(mpn_kara_mul_n), TYPE_MUL_N, MPN_KARA_MUL_N_MINSIZE },
+ { TRY_FUNFUN(mpn_kara_sqr_n), TYPE_SQR, MPN_KARA_SQR_N_MINSIZE },
+ { TRY_FUNFUN(mpn_toom3_mul_n), TYPE_MUL_N, MPN_TOOM3_MUL_N_MINSIZE },
+ { TRY_FUNFUN(mpn_toom3_sqr_n), TYPE_SQR, MPN_TOOM3_SQR_N_MINSIZE },
{ TRY(mpn_gcd_1), TYPE_GCD_1 },
{ TRY(mpn_gcd), TYPE_GCD },
- { TRY(mpz_legendre), TYPE_MPZ_LEGENDRE },
{ TRY(mpz_jacobi), TYPE_MPZ_JACOBI },
- { TRY(mpz_kronecker), TYPE_MPZ_KRONECKER },
{ TRY(mpz_kronecker_ui), TYPE_MPZ_KRONECKER_UI },
{ TRY(mpz_kronecker_si), TYPE_MPZ_KRONECKER_SI },
{ TRY(mpz_ui_kronecker), TYPE_MPZ_UI_KRONECKER },
@@ -1976,9 +1496,6 @@ const struct choice_t choice_array[] = {
{ TRY(mpn_get_str), TYPE_GET_STR },
- { TRY(mpn_binvert), TYPE_BINVERT },
- { TRY(mpn_invert), TYPE_INVERT },
-
#ifdef EXTRA_ROUTINES
EXTRA_ROUTINES
#endif
@@ -2040,12 +1557,12 @@ malloc_region (struct region_t *r, mp_size_t n)
mp_ptr p;
size_t nbytes;
- ASSERT ((pagesize % GMP_LIMB_BYTES) == 0);
+ ASSERT ((pagesize % BYTES_PER_MP_LIMB) == 0);
n = round_up_multiple (n, PAGESIZE_LIMBS);
r->size = n;
- nbytes = n*GMP_LIMB_BYTES + 2*REDZONE_BYTES + pagesize;
+ nbytes = n*BYTES_PER_MP_LIMB + 2*REDZONE_BYTES + pagesize;
#if defined (MAP_ANONYMOUS) && ! defined (MAP_ANON)
#define MAP_ANON MAP_ANONYMOUS
@@ -2053,7 +1570,7 @@ malloc_region (struct region_t *r, mp_size_t n)
#if HAVE_MMAP && defined (MAP_ANON)
/* note must pass fd=-1 for MAP_ANON on BSD */
- p = (mp_ptr) mmap (NULL, nbytes, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
+ p = mmap (NULL, nbytes, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANON, -1, 0);
if (p == (void *) -1)
{
fprintf (stderr, "Cannot mmap %#x anon bytes: %s\n",
@@ -2065,7 +1582,7 @@ malloc_region (struct region_t *r, mp_size_t n)
ASSERT_ALWAYS (p != NULL);
#endif
- p = (mp_ptr) align_pointer (p, pagesize);
+ p = align_pointer (p, pagesize);
mprotect_maybe (p, REDZONE_BYTES, PROT_NONE);
p += REDZONE_LIMBS;
@@ -2176,15 +1693,15 @@ int divisor_index;
struct overlap_t {
int s[NUM_SOURCES];
} overlap_array[] = {
- { { -1, -1, -1, -1, -1 } },
- { { 0, -1, -1, -1, -1 } },
- { { -1, 0, -1, -1, -1 } },
- { { 0, 0, -1, -1, -1 } },
- { { 1, -1, -1, -1, -1 } },
- { { -1, 1, -1, -1, -1 } },
- { { 1, 1, -1, -1, -1 } },
- { { 0, 1, -1, -1, -1 } },
- { { 1, 0, -1, -1, -1 } },
+ { { -1, -1 } },
+ { { 0, -1 } },
+ { { -1, 0 } },
+ { { 0, 0 } },
+ { { 1, -1 } },
+ { { -1, 1 } },
+ { { 1, 1 } },
+ { { 0, 1 } },
+ { { 1, 0 } },
};
struct overlap_t *overlap, *overlap_limit;
@@ -2193,7 +1710,6 @@ struct overlap_t *overlap, *overlap_limit;
(tr->overlap & OVERLAP_NONE ? 1 \
: tr->overlap & OVERLAP_NOT_SRCS ? 3 \
: tr->overlap & OVERLAP_NOT_SRC2 ? 2 \
- : tr->overlap & OVERLAP_NOT_DST2 ? 4 \
: tr->dst[1] ? 9 \
: tr->src[1] ? 4 \
: tr->dst[0] ? 2 \
@@ -2273,13 +1789,13 @@ print_each (const struct each_t *e)
byte_tracen (" d[%d]", i, e->d[i].p, d[i].size);
else
mpn_tracen (" d[%d]", i, e->d[i].p, d[i].size);
- printf (" located %p\n", (void *) (e->d[i].p));
+ printf (" located %p\n", e->d[i].p);
}
}
for (i = 0; i < NUM_SOURCES; i++)
if (tr->src[i])
- printf (" s[%d] located %p\n", i, (void *) (e->s[i].p));
+ printf (" s[%d] located %p\n", i, e->s[i].p);
}
@@ -2426,59 +1942,17 @@ call (struct each_t *e, tryfun_t function)
case TYPE_ADD_N:
case TYPE_SUB_N:
case TYPE_ADDLSH1_N:
- case TYPE_ADDLSH2_N:
case TYPE_SUBLSH1_N:
- case TYPE_SUBLSH2_N:
- case TYPE_RSBLSH1_N:
- case TYPE_RSBLSH2_N:
case TYPE_RSH1ADD_N:
case TYPE_RSH1SUB_N:
e->retval = CALLING_CONVENTIONS (function)
(e->d[0].p, e->s[0].p, e->s[1].p, size);
break;
- case TYPE_ADDLSH_N:
- case TYPE_SUBLSH_N:
- case TYPE_RSBLSH_N:
- e->retval = CALLING_CONVENTIONS (function)
- (e->d[0].p, e->s[0].p, e->s[1].p, size, shift);
- break;
- case TYPE_ADDLSH_NC:
- case TYPE_SUBLSH_NC:
- case TYPE_RSBLSH_NC:
- e->retval = CALLING_CONVENTIONS (function)
- (e->d[0].p, e->s[0].p, e->s[1].p, size, shift, carry);
- break;
- case TYPE_ADDLSH1_NC:
- case TYPE_ADDLSH2_NC:
- case TYPE_SUBLSH1_NC:
- case TYPE_SUBLSH2_NC:
- case TYPE_RSBLSH1_NC:
- 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)
- (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:
- e->retval = CALLING_CONVENTIONS (function)
- (e->d[0].p, e->s[0].p, e->s[1].p, e->d[1].p, e->s[2].p, size, carry);
- break;
- case TYPE_ADD_ERR2_N:
- case TYPE_SUB_ERR2_N:
- e->retval = CALLING_CONVENTIONS (function)
- (e->d[0].p, e->s[0].p, e->s[1].p, e->d[1].p, e->s[2].p, e->s[3].p, size, carry);
- break;
- case TYPE_ADD_ERR3_N:
- case TYPE_SUB_ERR3_N:
- e->retval = CALLING_CONVENTIONS (function)
- (e->d[0].p, e->s[0].p, e->s[1].p, e->d[1].p, e->s[2].p, e->s[3].p, e->s[4].p, size, carry);
- break;
case TYPE_MUL_1:
case TYPE_ADDMUL_1:
@@ -2496,8 +1970,6 @@ call (struct each_t *e, tryfun_t function)
case TYPE_MUL_2:
case TYPE_MUL_3:
case TYPE_MUL_4:
- case TYPE_MUL_5:
- case TYPE_MUL_6:
if (size == 1)
abort ();
e->retval = CALLING_CONVENTIONS (function)
@@ -2540,16 +2012,11 @@ call (struct each_t *e, tryfun_t function)
case TYPE_COPY:
case TYPE_COPYI:
case TYPE_COPYD:
- case TYPE_COM:
+ case TYPE_COM_N:
CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size);
break;
- case TYPE_ADDLSH1_N_IP1:
- case TYPE_ADDLSH2_N_IP1:
- case TYPE_ADDLSH1_N_IP2:
- case TYPE_ADDLSH2_N_IP2:
- case TYPE_SUBLSH1_N_IP1:
- case TYPE_SUBLSH2_N_IP1:
+
case TYPE_DIVEXACT_BY3:
e->retval = CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size);
break;
@@ -2561,7 +2028,6 @@ call (struct each_t *e, tryfun_t function)
case TYPE_DIVMOD_1:
case TYPE_DIVEXACT_1:
- case TYPE_BDIV_Q_1:
e->retval = CALLING_CONVENTIONS (function)
(e->d[0].p, e->s[0].p, size, divisor);
break;
@@ -2601,14 +2067,6 @@ 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;
@@ -2622,18 +2080,13 @@ call (struct each_t *e, tryfun_t function)
(e->s[0].p[1], e->s[0].p[0], divisor, e->d[0].p);
break;
- case TYPE_SBPI1_DIV_QR:
- {
- gmp_pi1_t dinv;
- invert_pi1 (dinv, e->s[1].p[size2-1], e->s[1].p[size2-2]); /* FIXME: use refinvert_pi1 */
- refmpn_copyi (e->d[1].p, e->s[0].p, size); /* dividend */
- refmpn_fill (e->d[0].p, size-size2, 0x98765432); /* quotient */
- e->retval = CALLING_CONVENTIONS (function)
- (e->d[0].p, e->d[1].p, size, e->s[1].p, size2, dinv.inv32);
- refmpn_zero (e->d[1].p+size2, size-size2); /* excess over remainder */
- }
+ case TYPE_SB_DIVREM_MN:
+ refmpn_copyi (e->d[1].p, e->s[0].p, size); /* dividend */
+ refmpn_fill (e->d[0].p, size-size2, 0x98765432); /* quotient */
+ e->retval = CALLING_CONVENTIONS (function)
+ (e->d[0].p, e->d[1].p, size, e->s[1].p, size2);
+ refmpn_zero (e->d[1].p+size2, size-size2); /* excess over remainder */
break;
-
case TYPE_TDIV_QR:
CALLING_CONVENTIONS (function) (e->d[0].p, e->d[1].p, 0,
e->s[0].p, size, e->s[1].p, size2);
@@ -2682,15 +2135,7 @@ call (struct each_t *e, tryfun_t function)
}
break;
- case TYPE_MPZ_LEGENDRE:
case TYPE_MPZ_JACOBI:
- {
- mpz_t a, b;
- PTR(a) = e->s[0].p; SIZ(a) = (carry==0 ? size : -size);
- PTR(b) = e->s[1].p; SIZ(b) = size2;
- e->retval = CALLING_CONVENTIONS (function) (a, b);
- }
- break;
case TYPE_MPZ_KRONECKER:
{
mpz_t a, b;
@@ -2729,18 +2174,12 @@ call (struct each_t *e, tryfun_t function)
break;
case TYPE_MUL_MN:
- case TYPE_MULMID_MN:
CALLING_CONVENTIONS (function)
(e->d[0].p, e->s[0].p, size, e->s[1].p, size2);
break;
case TYPE_MUL_N:
- case TYPE_MULLO_N:
CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, e->s[1].p, size);
break;
- case TYPE_MULMID_N:
- CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, e->s[1].p,
- (size + 1) / 2);
- break;
case TYPE_SQR:
CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size);
break;
@@ -2754,11 +2193,7 @@ call (struct each_t *e, tryfun_t function)
(e->s[0].p[0], e->s[0].p[1], e->d[0].p);
break;
- case TYPE_ADDLSH_N_IP1:
- case TYPE_ADDLSH_N_IP2:
- case TYPE_SUBLSH_N_IP1:
case TYPE_LSHIFT:
- case TYPE_LSHIFTC:
case TYPE_RSHIFT:
e->retval = CALLING_CONVENTIONS (function)
(e->d[0].p, e->s[0].p, size, shift);
@@ -2810,28 +2245,7 @@ call (struct each_t *e, tryfun_t function)
e->retval = CALLING_CONVENTIONS (function) (dst, base,
e->d[1].p, size);
}
- refmpn_zero (e->d[1].p, size); /* clobbered or unused */
- }
- break;
-
- case TYPE_INVERT:
- {
- mp_ptr scratch;
- TMP_DECL;
- TMP_MARK;
- scratch = TMP_ALLOC_LIMBS (mpn_invert_itch (size));
- CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size, scratch);
- TMP_FREE;
- }
- break;
- case TYPE_BINVERT:
- {
- mp_ptr scratch;
- TMP_DECL;
- TMP_MARK;
- scratch = TMP_ALLOC_LIMBS (mpn_binvert_itch (size));
- CALLING_CONVENTIONS (function) (e->d[0].p, e->s[0].p, size, scratch);
- TMP_FREE;
+ refmpn_zero (e->d[1].p, size); /* cloberred or unused */
}
break;
@@ -2869,12 +2283,6 @@ pointer_setup (struct each_t *e)
case SIZE_3:
d[i].size = 3;
break;
- case SIZE_4:
- d[i].size = 4;
- break;
- case SIZE_6:
- d[i].size = 6;
- break;
case SIZE_PLUS_1:
d[i].size = size+1;
@@ -2902,10 +2310,6 @@ pointer_setup (struct each_t *e)
d[i].size = size - size2 + 1;
break;
- case SIZE_DIFF_PLUS_3:
- d[i].size = size - size2 + 3;
- break;
-
case SIZE_CEIL_HALF:
d[i].size = (size+1)/2;
break;
@@ -3073,46 +2477,11 @@ try_one (void)
s[i].p[0] |= 1;
break;
- case DATA_SRC0_ODD:
- if (i == 0)
- s[i].p[0] |= 1;
- break;
-
case DATA_SRC1_ODD:
if (i == 1)
s[i].p[0] |= 1;
break;
- case DATA_SRC1_ODD_PRIME:
- if (i == 1)
- {
- if (refmpn_zero_p (s[i].p+1, SRC_SIZE(i)-1)
- && s[i].p[0] <=3)
- s[i].p[0] = 3;
- else
- {
- mpz_t p;
- mpz_init (p);
- for (;;)
- {
- _mpz_realloc (p, SRC_SIZE(i));
- MPN_COPY (PTR(p), s[i].p, SRC_SIZE(i));
- SIZ(p) = SRC_SIZE(i);
- MPN_NORMALIZE (PTR(p), SIZ(p));
- mpz_nextprime (p, p);
- if (mpz_size (p) <= SRC_SIZE(i))
- break;
-
- t_random (s[i].p, SRC_SIZE(i));
- }
- MPN_COPY (s[i].p, PTR(p), SIZ(p));
- if (SIZ(p) < SRC_SIZE(i))
- MPN_ZERO (s[i].p + SIZ(p), SRC_SIZE(i) - SIZ(p));
- mpz_clear (p);
- }
- }
- break;
-
case DATA_SRC1_HIGHBIT:
if (i == 1)
{
@@ -3123,20 +2492,9 @@ try_one (void)
}
break;
- case DATA_SRC0_HIGHBIT:
- if (i == 0)
- {
- s[i].p[size-1] |= GMP_NUMB_HIGHBIT;
- }
- break;
-
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);
@@ -3219,15 +2577,13 @@ try_one (void)
#define SIZE_ITERATION \
for (size = MAX3 (option_firstsize, \
choice->minsize, \
- (tr->size == SIZE_ALLOW_ZERO) ? 0 : 1), \
- size += (tr->size == SIZE_ODD) && !(size & 1); \
+ (tr->size == SIZE_ALLOW_ZERO) ? 0 : 1); \
size <= option_lastsize; \
- size += (tr->size == SIZE_ODD) ? 2 : 1)
+ size++)
#define SIZE2_FIRST \
(tr->size2 == SIZE_2 ? 2 \
: tr->size2 == SIZE_FRACTION ? option_firstsize2 \
- : tr->size2 == SIZE_CEIL_HALF ? ((size + 1) / 2) \
: tr->size2 ? \
MAX (choice->minsize, (option_firstsize2 != 0 \
? option_firstsize2 : 1)) \
@@ -3236,7 +2592,6 @@ try_one (void)
#define SIZE2_LAST \
(tr->size2 == SIZE_2 ? 2 \
: tr->size2 == SIZE_FRACTION ? FRACTION_COUNT-1 \
- : tr->size2 == SIZE_CEIL_HALF ? ((size + 1) / 2) \
: tr->size2 ? size \
: 0)
@@ -3396,9 +2751,9 @@ Error, error, cannot get page size
{
malloc_region (&s[i].region, 2*option_lastsize+ALIGNMENTS-1);
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 * GMP_LIMB_BYTES);
+ i, s[i].region.ptr,
+ s[i].region.ptr + s[i].region.size,
+ (long) s[i].region.size * BYTES_PER_MP_LIMB);
}
#define INIT_EACH(e,es) \
@@ -3406,9 +2761,9 @@ Error, error, cannot get page size
{ \
malloc_region (&e.d[i].region, 2*option_lastsize+ALIGNMENTS-1); \
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 * GMP_LIMB_BYTES); \
+ es, i, e.d[i].region.ptr, \
+ e.d[i].region.ptr + e.d[i].region.size, \
+ (long) e.d[i].region.size * BYTES_PER_MP_LIMB); \
}
INIT_EACH(ref, "ref");
diff --git a/gmp/tests/devel/tst-addsub.c b/gmp/tests/devel/tst-addsub.c
index 50aa3a73b3..5b819e9b34 100644
--- a/gmp/tests/devel/tst-addsub.c
+++ b/gmp/tests/devel/tst-addsub.c
@@ -1,19 +1,19 @@
/* Copyright 1996, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -60,10 +60,10 @@ main (int argc, char **argv)
}
alloc_size = max_size + 32;
- 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);
+ 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);
cumul_size = 0;
for (pass = 0; pass < n_passes; pass++)
diff --git a/gmp/tests/memory.c b/gmp/tests/memory.c
index c91813ea08..a07ecc56d9 100644
--- a/gmp/tests/memory.c
+++ b/gmp/tests/memory.c
@@ -1,28 +1,27 @@
/* Memory allocation used during tests.
-Copyright 2001, 2002, 2007, 2013 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2007 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h> /* for abort */
#include <string.h> /* for memcpy, memcmp */
#include "gmp.h"
#include "gmp-impl.h"
-#include "tests.h"
#if GMP_LIMB_BITS == 64
#define PATTERN1 CNST_LIMB(0xcafebabedeadbeef)
@@ -32,12 +31,6 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#define PATTERN2 CNST_LIMB(0xdeadbeef)
#endif
-#if HAVE_INTPTR_T
-#define PTRLIMB(p) ((mp_limb_t) (intptr_t) p)
-#else
-#define PTRLIMB(p) ((mp_limb_t) (size_t) p)
-#endif
-
/* Each block allocated is a separate malloc, for the benefit of a redzoning
malloc debugger during development or when bug hunting.
@@ -95,12 +88,12 @@ tests_allocate (size_t size)
tests_memory_list = h;
rptr = __gmp_default_allocate (size + 2 * sizeof (mp_limb_t));
- ptr = (void *) ((gmp_intptr_t) rptr + sizeof (mp_limb_t));
+ ptr = (void *) ((long) rptr + sizeof (mp_limb_t));
- *((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
- = PATTERN1 - PTRLIMB (ptr);
- PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
- memcpy ((void *) ((gmp_intptr_t) ptr + size), &PATTERN2_var, sizeof (mp_limb_t));
+ *((mp_limb_t *) ((long) ptr - sizeof (mp_limb_t)))
+ = PATTERN1 - ((mp_limb_t) ptr);
+ PATTERN2_var = PATTERN2 - ((mp_limb_t) ptr);
+ memcpy ((void *) ((long) ptr + size), &PATTERN2_var, sizeof (mp_limb_t));
h->size = size;
h->ptr = ptr;
@@ -116,16 +109,16 @@ tests_reallocate (void *ptr, size_t old_size, size_t new_size)
if (new_size == 0)
{
- fprintf (stderr, "tests_reallocate(): attempt to reallocate %p to 0 bytes\n",
- ptr);
+ fprintf (stderr, "tests_reallocate(): attempt to reallocate 0x%lX to 0 bytes\n",
+ (unsigned long) ptr);
abort ();
}
hp = tests_memory_find (ptr);
if (hp == NULL)
{
- fprintf (stderr, "tests_reallocate(): attempt to reallocate bad pointer %p\n",
- ptr);
+ fprintf (stderr, "tests_reallocate(): attempt to reallocate bad pointer 0x%lX\n",
+ (unsigned long) ptr);
abort ();
}
h = *hp;
@@ -137,28 +130,28 @@ tests_reallocate (void *ptr, size_t old_size, size_t new_size)
abort ();
}
- if (*((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
- != PATTERN1 - PTRLIMB (ptr))
+ if (*((mp_limb_t *) ((long) ptr - sizeof (mp_limb_t)))
+ != PATTERN1 - ((mp_limb_t) ptr))
{
fprintf (stderr, "in realloc: redzone clobbered before block\n");
abort ();
}
- PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
- if (memcmp ((void *) ((gmp_intptr_t) ptr + h->size), &PATTERN2_var, sizeof (mp_limb_t)))
+ PATTERN2_var = PATTERN2 - ((mp_limb_t) ptr);
+ if (memcmp ((void *) ((long) ptr + h->size), &PATTERN2_var, sizeof (mp_limb_t)))
{
fprintf (stderr, "in realloc: redzone clobbered after block\n");
abort ();
}
- rptr = __gmp_default_reallocate ((void *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)),
+ rptr = __gmp_default_reallocate ((void *) ((long) ptr - sizeof (mp_limb_t)),
old_size + 2 * sizeof (mp_limb_t),
new_size + 2 * sizeof (mp_limb_t));
- ptr = (void *) ((gmp_intptr_t) rptr + sizeof (mp_limb_t));
+ ptr = (void *) ((long) rptr + sizeof (mp_limb_t));
- *((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
- = PATTERN1 - PTRLIMB (ptr);
- PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
- memcpy ((void *) ((gmp_intptr_t) ptr + new_size), &PATTERN2_var, sizeof (mp_limb_t));
+ *((mp_limb_t *) ((long) ptr - sizeof (mp_limb_t)))
+ = PATTERN1 - ((mp_limb_t) ptr);
+ PATTERN2_var = PATTERN2 - ((mp_limb_t) ptr);
+ memcpy ((void *) ((long) ptr + new_size), &PATTERN2_var, sizeof (mp_limb_t));
h->size = new_size;
h->ptr = ptr;
@@ -171,8 +164,8 @@ tests_free_find (void *ptr)
struct header **hp = tests_memory_find (ptr);
if (hp == NULL)
{
- fprintf (stderr, "tests_free(): attempt to free bad pointer %p\n",
- ptr);
+ fprintf (stderr, "tests_free(): attempt to free bad pointer 0x%lX\n",
+ (unsigned long) ptr);
abort ();
}
return hp;
@@ -187,20 +180,20 @@ tests_free_nosize (void *ptr)
*hp = h->next; /* unlink */
- if (*((mp_limb_t *) ((gmp_intptr_t) ptr - sizeof (mp_limb_t)))
- != PATTERN1 - PTRLIMB (ptr))
+ if (*((mp_limb_t *) ((long) ptr - sizeof (mp_limb_t)))
+ != PATTERN1 - ((mp_limb_t) ptr))
{
fprintf (stderr, "in free: redzone clobbered before block\n");
abort ();
}
- PATTERN2_var = PATTERN2 - PTRLIMB (ptr);
- if (memcmp ((void *) ((gmp_intptr_t) ptr + h->size), &PATTERN2_var, sizeof (mp_limb_t)))
+ PATTERN2_var = PATTERN2 - ((mp_limb_t) ptr);
+ if (memcmp ((void *) ((long) ptr + h->size), &PATTERN2_var, sizeof (mp_limb_t)))
{
fprintf (stderr, "in free: redzone clobbered after block\n");
abort ();
}
- __gmp_default_free ((void *) ((gmp_intptr_t) ptr - sizeof(mp_limb_t)),
+ __gmp_default_free ((void *) ((long) ptr - sizeof(mp_limb_t)),
h->size + 2 * sizeof (mp_limb_t));
__gmp_default_free (h, sizeof (*h));
}
diff --git a/gmp/tests/misc.c b/gmp/tests/misc.c
index 59920c2726..19c657c7fb 100644
--- a/gmp/tests/misc.c
+++ b/gmp/tests/misc.c
@@ -1,21 +1,21 @@
/* Miscellaneous test program support routines.
-Copyright 2000-2003, 2005, 2013 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -123,7 +123,7 @@ tests_rand_end (void)
/* Only used if CPU calling conventions checking is available. */
-mp_limb_t (*calling_conventions_function) (ANYARGS);
+mp_limb_t (*calling_conventions_function) __GMP_PROTO ((ANYARGS));
/* Return p advanced to the next multiple of "align" bytes. "align" must be
@@ -132,8 +132,8 @@ mp_limb_t (*calling_conventions_function) (ANYARGS);
void *
align_pointer (void *p, size_t align)
{
- gmp_intptr_t d;
- d = ((gmp_intptr_t) p) & (align-1);
+ unsigned long d;
+ d = ((unsigned long) p) & (align-1);
d = (d != 0 ? align-d : 0);
return (void *) (((char *) p) + d);
}
@@ -163,7 +163,7 @@ __gmp_allocate_strdup (const char *s)
size_t len;
char *t;
len = strlen (s);
- t = (char *) (*__gmp_allocate_func) (len+1);
+ t = (*__gmp_allocate_func) (len+1);
memcpy (t, s, len+1);
return t;
}
@@ -370,11 +370,11 @@ urandom (void)
{
#if GMP_NAIL_BITS == 0
mp_limb_t n;
- _gmp_rand (&n, RANDS, GMP_LIMB_BITS);
+ _gmp_rand (&n, RANDS, BITS_PER_MP_LIMB);
return n;
#else
mp_limb_t n[2];
- _gmp_rand (n, RANDS, GMP_LIMB_BITS);
+ _gmp_rand (n, RANDS, BITS_PER_MP_LIMB);
return n[0] + (n[1] << GMP_NUMB_BITS);
#endif
}
@@ -382,7 +382,7 @@ urandom (void)
/* Call (*func)() with various random number generators. */
void
-call_rand_algs (void (*func) (const char *, gmp_randstate_ptr))
+call_rand_algs (void (*func) __GMP_PROTO ((const char *, gmp_randstate_ptr)))
{
gmp_randstate_t rstate;
mpz_t a;
@@ -465,7 +465,7 @@ tests_isinf (double d)
int
tests_hardware_setround (int mode)
{
-#if WANT_ASSEMBLY && HAVE_HOST_CPU_FAMILY_x86
+#if HAVE_HOST_CPU_FAMILY_x86
int rc;
switch (mode) {
case 0: rc = 0; break; /* nearest */
@@ -486,7 +486,7 @@ tests_hardware_setround (int mode)
int
tests_hardware_getround (void)
{
-#if WANT_ASSEMBLY && HAVE_HOST_CPU_FAMILY_x86
+#if HAVE_HOST_CPU_FAMILY_x86
switch ((x86_fstcw () & ~0xC00) >> 10) {
case 0: return 0; break; /* nearest */
case 1: return 3; break; /* down */
diff --git a/gmp/tests/misc/Makefile.am b/gmp/tests/misc/Makefile.am
index 24f8767349..588652ea2f 100644
--- a/gmp/tests/misc/Makefile.am
+++ b/gmp/tests/misc/Makefile.am
@@ -2,20 +2,20 @@
# Copyright 2001, 2002 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
diff --git a/gmp/tests/misc/Makefile.in b/gmp/tests/misc/Makefile.in
index 07ff68475a..e37af77c0f 100644
--- a/gmp/tests/misc/Makefile.in
+++ b/gmp/tests/misc/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -17,43 +16,31 @@
# Copyright 2001, 2002 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = t-locale.c t-printf.c t-scanf.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,58 +52,49 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
check_PROGRAMS = t-printf$(EXEEXT) t-scanf$(EXEEXT) t-locale$(EXEEXT)
subdir = tests/misc
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
t_locale_SOURCES = t-locale.c
-t_locale_OBJECTS = t-locale.$(OBJEXT)
+t_locale_OBJECTS = t-locale$U.$(OBJEXT)
t_locale_LDADD = $(LDADD)
t_locale_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_printf_SOURCES = t-printf.c
-t_printf_OBJECTS = t-printf.$(OBJEXT)
+t_printf_OBJECTS = t-printf$U.$(OBJEXT)
t_printf_LDADD = $(LDADD)
t_printf_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_scanf_SOURCES = t-scanf.c
-t_scanf_OBJECTS = t-scanf.$(OBJEXT)
+t_scanf_OBJECTS = t-scanf$U.$(OBJEXT)
t_scanf_LDADD = $(LDADD)
t_scanf_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = t-locale.c t-printf.c t-scanf.c
DIST_SOURCES = t-locale.c t-printf.c t-scanf.c
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -128,6 +106,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -143,17 +122,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -167,12 +145,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -187,26 +163,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -216,31 +186,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -264,6 +229,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -271,12 +237,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
TESTS = $(check_PROGRAMS)
@@ -293,14 +255,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/misc/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/misc/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/misc/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/misc/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -318,31 +280,33 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-t-locale$(EXEEXT): $(t_locale_OBJECTS) $(t_locale_DEPENDENCIES) $(EXTRA_t_locale_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+t-locale$(EXEEXT): $(t_locale_OBJECTS) $(t_locale_DEPENDENCIES)
@rm -f t-locale$(EXEEXT)
- $(LINK) $(t_locale_OBJECTS) $(t_locale_LDADD) $(LIBS)
-t-printf$(EXEEXT): $(t_printf_OBJECTS) $(t_printf_DEPENDENCIES) $(EXTRA_t_printf_DEPENDENCIES)
+ $(LINK) $(t_locale_LDFLAGS) $(t_locale_OBJECTS) $(t_locale_LDADD) $(LIBS)
+t-printf$(EXEEXT): $(t_printf_OBJECTS) $(t_printf_DEPENDENCIES)
@rm -f t-printf$(EXEEXT)
- $(LINK) $(t_printf_OBJECTS) $(t_printf_LDADD) $(LIBS)
-t-scanf$(EXEEXT): $(t_scanf_OBJECTS) $(t_scanf_DEPENDENCIES) $(EXTRA_t_scanf_DEPENDENCIES)
+ $(LINK) $(t_printf_LDFLAGS) $(t_printf_OBJECTS) $(t_printf_LDADD) $(LIBS)
+t-scanf$(EXEEXT): $(t_scanf_OBJECTS) $(t_scanf_DEPENDENCIES)
@rm -f t-scanf$(EXEEXT)
- $(LINK) $(t_scanf_OBJECTS) $(t_scanf_LDADD) $(LIBS)
+ $(LINK) $(t_scanf_LDFLAGS) $(t_scanf_OBJECTS) $(t_scanf_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -352,6 +316,14 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+t-locale_.c: t-locale.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-locale.c; then echo $(srcdir)/t-locale.c; else echo t-locale.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-printf_.c: t-printf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-printf.c; then echo $(srcdir)/t-printf.c; else echo t-printf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-scanf_.c: t-scanf.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-scanf.c; then echo $(srcdir)/t-scanf.c; else echo t-scanf.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-locale_.$(OBJEXT) t-locale_.lo t-printf_.$(OBJEXT) t-printf_.lo \
+t-scanf_.$(OBJEXT) t-scanf_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -359,54 +331,54 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -414,8 +386,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -424,113 +395,91 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -550,23 +499,17 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -579,7 +522,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -587,38 +530,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -627,7 +550,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -638,28 +561,23 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/misc/t-locale.c b/gmp/tests/misc/t-locale.c
index 5979e27955..0294e4d051 100644
--- a/gmp/tests/misc/t-locale.c
+++ b/gmp/tests/misc/t-locale.c
@@ -1,21 +1,21 @@
/* Test locale support, or attempt to do so.
-Copyright 2001, 2002, 2011 Free Software Foundation, Inc.
+Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 _GNU_SOURCE /* for DECIMAL_POINT in glibc langinfo.h */
@@ -41,15 +41,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-#ifdef __MINGW32__
-int
-main (void)
-{
- exit (0);
-}
-#else
-const char *decimal_point;
+char *decimal_point;
/* Replace the libc localeconv with one we can manipulate. */
#if HAVE_LOCALECONV
@@ -57,7 +50,7 @@ struct lconv *
localeconv (void)
{
static struct lconv l;
- l.decimal_point = (char *) decimal_point;
+ l.decimal_point = decimal_point;
return &l;
}
#endif
@@ -69,20 +62,20 @@ nl_langinfo (nl_item n)
{
#if defined (DECIMAL_POINT)
if (n == DECIMAL_POINT)
- return (char *) decimal_point;
+ return decimal_point;
#endif
#if defined (RADIXCHAR)
if (n == RADIXCHAR)
- return (char *) decimal_point;
+ return decimal_point;
#endif
- return (char *) "";
+ return "";
}
#endif
void
check_input (void)
{
- static const char *point[] = {
+ static char *point[] = {
".", ",", "WU", "STR", "ZTV***"
};
@@ -113,7 +106,7 @@ check_input (void)
for (i = 0; i < numberof (point); i++)
{
- decimal_point = (const char *) point[i];
+ decimal_point = point[i];
for (neg = 0; neg <= 1; neg++)
{
@@ -198,4 +191,3 @@ main (void)
tests_memory_end ();
exit (0);
}
-#endif
diff --git a/gmp/tests/misc/t-printf.c b/gmp/tests/misc/t-printf.c
index 8853dcc0ff..d6026b2d02 100644
--- a/gmp/tests/misc/t-printf.c
+++ b/gmp/tests/misc/t-printf.c
@@ -1,21 +1,21 @@
/* Test gmp_printf and related functions.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Usage: t-printf [-s]
@@ -25,9 +25,14 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
faulty or strange. */
-#include "config.h" /* needed for the HAVE_, could also move gmp incls */
+#include "config.h"
+#if HAVE_STDARG
#include <stdarg.h>
+#else
+#include <varargs.h>
+#endif
+
#include <stddef.h> /* for ptrdiff_t */
#include <stdio.h>
#include <stdlib.h>
@@ -68,7 +73,12 @@ 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;
@@ -76,13 +86,21 @@ check_plain (const char *want, const char *fmt_orig, ...)
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;
fmtsize = strlen (fmt_orig) + 1;
- fmt = (char *) (*__gmp_allocate_func) (fmtsize);
+ fmt = (*__gmp_allocate_func) (fmtsize);
for (p = fmt_orig, q = fmt; *p != '\0'; p++)
{
@@ -278,7 +296,7 @@ check_obstack_vprintf (const char *want, const char *fmt, va_list ap)
obstack_init (&ob);
got_len = gmp_obstack_vprintf (&ob, fmt, ap);
- got = (char *) obstack_base (&ob);
+ got = obstack_base (&ob);
ob_len = obstack_object_size (&ob);
if (got_len != want_len
@@ -300,10 +318,23 @@ 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);
diff --git a/gmp/tests/misc/t-scanf.c b/gmp/tests/misc/t-scanf.c
index 46c0a5f77c..5a9eda1fc9 100644
--- a/gmp/tests/misc/t-scanf.c
+++ b/gmp/tests/misc/t-scanf.c
@@ -1,21 +1,21 @@
/* Test gmp_scanf and related functions.
-Copyright 2001-2004 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Usage: t-scanf [-s]
@@ -29,7 +29,13 @@ the GNU MP Library test suite. If not, see https://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>
@@ -57,7 +63,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
int option_libc_scanf = 0;
-typedef int (*fun_t) (const char *, const char *, void *, void *);
+typedef int (*fun_t) __GMP_PROTO ((const char *, const char *, void *, void *));
/* This problem was seen on powerpc7450-apple-darwin7.0.0, sscanf returns 0
@@ -123,12 +129,25 @@ 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);
@@ -210,7 +229,7 @@ fun_sscanf (const char *input, const char *fmt, void *a1, void *a2)
int ret;
size = strlen (input) + 1;
- input_writable = (char *) (*__gmp_allocate_func) (size);
+ input_writable = (*__gmp_allocate_func) (size);
memcpy (input_writable, input, size);
if (a2 == NULL)
diff --git a/gmp/tests/mpbsd/Makefile.am b/gmp/tests/mpbsd/Makefile.am
new file mode 100644
index 0000000000..f609a6a8ce
--- /dev/null
+++ b/gmp/tests/mpbsd/Makefile.am
@@ -0,0 +1,35 @@
+## Process this file with automake to generate Makefile.in
+
+# Copyright 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/.
+
+
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libmp.la
+
+if WANT_MPBSD
+MPBSD_check_OPTION = allfuns t-itom t-mtox
+endif
+
+check_PROGRAMS = $(MPBSD_check_OPTION)
+TESTS = $(check_PROGRAMS)
+
+# check linking only against libmp
+allfuns_LDADD = $(top_builddir)/libmp.la
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
diff --git a/gmp/tests/mpbsd/Makefile.in b/gmp/tests/mpbsd/Makefile.in
new file mode 100644
index 0000000000..3766e3bbb1
--- /dev/null
+++ b/gmp/tests/mpbsd/Makefile.in
@@ -0,0 +1,581 @@
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
+# @configure_input@
+
+# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
+# 2003, 2004 Free Software Foundation, Inc.
+# This Makefile.in is free software; the Free Software Foundation
+# gives unlimited permission to copy and/or distribute it,
+# with or without modifications, as long as this notice is preserved.
+
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
+# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+# PARTICULAR PURPOSE.
+
+@SET_MAKE@
+
+# Copyright 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/.
+SOURCES = allfuns.c t-itom.c t-mtox.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
+VPATH = @srcdir@
+pkgdatadir = $(datadir)/@PACKAGE@
+pkglibdir = $(libdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
+am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
+install_sh_DATA = $(install_sh) -c -m 644
+install_sh_PROGRAM = $(install_sh) -c
+install_sh_SCRIPT = $(install_sh) -c
+INSTALL_HEADER = $(INSTALL_DATA)
+transform = $(program_transform_name)
+NORMAL_INSTALL = :
+PRE_INSTALL = :
+POST_INSTALL = :
+NORMAL_UNINSTALL = :
+PRE_UNINSTALL = :
+POST_UNINSTALL = :
+host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
+check_PROGRAMS = $(am__EXEEXT_1)
+subdir = tests/mpbsd
+DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
+ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
+am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
+ $(top_srcdir)/configure.in
+am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
+ $(ACLOCAL_M4)
+mkinstalldirs = $(mkdir_p)
+CONFIG_HEADER = $(top_builddir)/config.h
+CONFIG_CLEAN_FILES =
+@WANT_MPBSD_TRUE@am__EXEEXT_1 = allfuns$(EXEEXT) t-itom$(EXEEXT) \
+@WANT_MPBSD_TRUE@ t-mtox$(EXEEXT)
+allfuns_SOURCES = allfuns.c
+allfuns_OBJECTS = allfuns$U.$(OBJEXT)
+allfuns_DEPENDENCIES = $(top_builddir)/libmp.la
+t_itom_SOURCES = t-itom.c
+t_itom_OBJECTS = t-itom$U.$(OBJEXT)
+t_itom_LDADD = $(LDADD)
+t_itom_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libmp.la
+t_mtox_SOURCES = t-mtox.c
+t_mtox_OBJECTS = t-mtox$U.$(OBJEXT)
+t_mtox_LDADD = $(LDADD)
+t_mtox_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
+ $(top_builddir)/libmp.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
+depcomp =
+am__depfiles_maybe =
+COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
+ $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
+CCLD = $(CC)
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = allfuns.c t-itom.c t-mtox.c
+DIST_SOURCES = allfuns.c t-itom.c t-mtox.c
+ETAGS = etags
+CTAGS = ctags
+DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
+ABI = @ABI@
+ACLOCAL = @ACLOCAL@
+AMTAR = @AMTAR@
+AR = @AR@
+AS = @AS@
+ASMFLAGS = @ASMFLAGS@
+AUTOCONF = @AUTOCONF@
+AUTOHEADER = @AUTOHEADER@
+AUTOMAKE = @AUTOMAKE@
+AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
+CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
+CC = @CC@
+CCAS = @CCAS@
+CC_FOR_BUILD = @CC_FOR_BUILD@
+CFLAGS = @CFLAGS@
+CPP = @CPP@
+CPPFLAGS = @CPPFLAGS@
+CPP_FOR_BUILD = @CPP_FOR_BUILD@
+CXX = @CXX@
+CXXCPP = @CXXCPP@
+CXXFLAGS = @CXXFLAGS@
+CYGPATH_W = @CYGPATH_W@
+DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
+DEFS = @DEFS@
+DLLTOOL = @DLLTOOL@
+ECHO = @ECHO@
+ECHO_C = @ECHO_C@
+ECHO_N = @ECHO_N@
+ECHO_T = @ECHO_T@
+EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
+EXEEXT = @EXEEXT@
+EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
+GMP_LDFLAGS = @GMP_LDFLAGS@
+GMP_NAIL_BITS = @GMP_NAIL_BITS@
+GREP = @GREP@
+HAVE_CLOCK_01 = @HAVE_CLOCK_01@
+HAVE_CPUTIME_01 = @HAVE_CPUTIME_01@
+HAVE_GETRUSAGE_01 = @HAVE_GETRUSAGE_01@
+HAVE_GETTIMEOFDAY_01 = @HAVE_GETTIMEOFDAY_01@
+HAVE_HOST_CPU_FAMILY_power = @HAVE_HOST_CPU_FAMILY_power@
+HAVE_HOST_CPU_FAMILY_powerpc = @HAVE_HOST_CPU_FAMILY_powerpc@
+HAVE_SIGACTION_01 = @HAVE_SIGACTION_01@
+HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
+HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
+HAVE_STACK_T_01 = @HAVE_STACK_T_01@
+HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
+INSTALL_DATA = @INSTALL_DATA@
+INSTALL_PROGRAM = @INSTALL_PROGRAM@
+INSTALL_SCRIPT = @INSTALL_SCRIPT@
+INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
+LDFLAGS = @LDFLAGS@
+LEX = @LEX@
+LEXLIB = @LEXLIB@
+LEX_OUTPUT_ROOT = @LEX_OUTPUT_ROOT@
+LIBCURSES = @LIBCURSES@
+LIBGMPXX_LDFLAGS = @LIBGMPXX_LDFLAGS@
+LIBGMP_DLL = @LIBGMP_DLL@
+LIBGMP_LDFLAGS = @LIBGMP_LDFLAGS@
+LIBM = @LIBM@
+LIBM_FOR_BUILD = @LIBM_FOR_BUILD@
+LIBOBJS = @LIBOBJS@
+LIBREADLINE = @LIBREADLINE@
+LIBS = @LIBS@
+LIBTOOL = @LIBTOOL@
+LN_S = @LN_S@
+LTLIBOBJS = @LTLIBOBJS@
+M4 = @M4@
+MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
+MAKEINFO = @MAKEINFO@
+OBJDUMP = @OBJDUMP@
+OBJEXT = @OBJEXT@
+PACKAGE = @PACKAGE@
+PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
+PACKAGE_NAME = @PACKAGE_NAME@
+PACKAGE_STRING = @PACKAGE_STRING@
+PACKAGE_TARNAME = @PACKAGE_TARNAME@
+PACKAGE_VERSION = @PACKAGE_VERSION@
+PATH_SEPARATOR = @PATH_SEPARATOR@
+RANLIB = @RANLIB@
+SED = @SED@
+SET_MAKE = @SET_MAKE@
+SHELL = @SHELL@
+SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
+STRIP = @STRIP@
+TAL_OBJECT = @TAL_OBJECT@
+TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
+U_FOR_BUILD = @U_FOR_BUILD@
+VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
+WITH_READLINE_01 = @WITH_READLINE_01@
+YACC = @YACC@
+YFLAGS = @YFLAGS@
+ac_ct_CC = @ac_ct_CC@
+ac_ct_CXX = @ac_ct_CXX@
+am__leading_dot = @am__leading_dot@
+bindir = @bindir@
+build = @build@
+build_alias = @build_alias@
+build_cpu = @build_cpu@
+build_os = @build_os@
+build_vendor = @build_vendor@
+datadir = @datadir@
+datarootdir = @datarootdir@
+docdir = @docdir@
+dvidir = @dvidir@
+exec_prefix = @exec_prefix@
+gmp_srclinks = @gmp_srclinks@
+host = @host@
+host_alias = @host_alias@
+host_cpu = @host_cpu@
+host_os = @host_os@
+host_vendor = @host_vendor@
+htmldir = @htmldir@
+includedir = @includedir@
+infodir = @infodir@
+install_sh = @install_sh@
+libdir = @libdir@
+libexecdir = @libexecdir@
+localedir = @localedir@
+localstatedir = @localstatedir@
+mandir = @mandir@
+mkdir_p = @mkdir_p@
+mpn_objects = @mpn_objects@
+mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
+oldincludedir = @oldincludedir@
+pdfdir = @pdfdir@
+prefix = @prefix@
+program_transform_name = @program_transform_name@
+psdir = @psdir@
+sbindir = @sbindir@
+sharedstatedir = @sharedstatedir@
+sysconfdir = @sysconfdir@
+target_alias = @target_alias@
+INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
+LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libmp.la
+@WANT_MPBSD_TRUE@MPBSD_check_OPTION = allfuns t-itom t-mtox
+TESTS = $(check_PROGRAMS)
+
+# check linking only against libmp
+allfuns_LDADD = $(top_builddir)/libmp.la
+all: all-am
+
+.SUFFIXES:
+.SUFFIXES: .c .lo .o .obj
+$(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__configure_deps)
+ @for dep in $?; do \
+ case '$(am__configure_deps)' in \
+ *$$dep*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
+ exit 1;; \
+ esac; \
+ done; \
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpbsd/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpbsd/Makefile
+.PRECIOUS: Makefile
+Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
+ @case '$?' in \
+ *config.status*) \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh;; \
+ *) \
+ echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
+ cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
+ esac;
+
+$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+$(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
+
+clean-checkPROGRAMS:
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+allfuns$(EXEEXT): $(allfuns_OBJECTS) $(allfuns_DEPENDENCIES)
+ @rm -f allfuns$(EXEEXT)
+ $(LINK) $(allfuns_LDFLAGS) $(allfuns_OBJECTS) $(allfuns_LDADD) $(LIBS)
+t-itom$(EXEEXT): $(t_itom_OBJECTS) $(t_itom_DEPENDENCIES)
+ @rm -f t-itom$(EXEEXT)
+ $(LINK) $(t_itom_LDFLAGS) $(t_itom_OBJECTS) $(t_itom_LDADD) $(LIBS)
+t-mtox$(EXEEXT): $(t_mtox_OBJECTS) $(t_mtox_DEPENDENCIES)
+ @rm -f t-mtox$(EXEEXT)
+ $(LINK) $(t_mtox_LDFLAGS) $(t_mtox_OBJECTS) $(t_mtox_LDADD) $(LIBS)
+
+mostlyclean-compile:
+ -rm -f *.$(OBJEXT)
+
+distclean-compile:
+ -rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
+
+.c.o:
+ $(COMPILE) -c $<
+
+.c.obj:
+ $(COMPILE) -c `$(CYGPATH_W) '$<'`
+
+.c.lo:
+ $(LTCOMPILE) -c -o $@ $<
+allfuns_.c: allfuns.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/allfuns.c; then echo $(srcdir)/allfuns.c; else echo allfuns.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-itom_.c: t-itom.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-itom.c; then echo $(srcdir)/t-itom.c; else echo t-itom.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-mtox_.c: t-mtox.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mtox.c; then echo $(srcdir)/t-mtox.c; else echo t-mtox.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+allfuns_.$(OBJEXT) allfuns_.lo t-itom_.$(OBJEXT) t-itom_.lo \
+t-mtox_.$(OBJEXT) t-mtox_.lo : $(ANSI2KNR)
+
+mostlyclean-libtool:
+ -rm -f *.lo
+
+clean-libtool:
+ -rm -rf .libs _libs
+
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
+ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ mkid -fID $$unique
+tags: TAGS
+
+TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
+ fi
+ctags: CTAGS
+CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
+ $(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
+ list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
+ unique=`for i in $$list; do \
+ if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
+ done | \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
+ || $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
+ $$tags $$unique
+
+GTAGS:
+ here=`$(am__cd) $(top_builddir) && pwd` \
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
+
+distclean-tags:
+ -rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
+
+check-TESTS: $(TESTS)
+ @failed=0; all=0; xfail=0; xpass=0; skip=0; \
+ srcdir=$(srcdir); export srcdir; \
+ list='$(TESTS)'; \
+ if test -n "$$list"; then \
+ for tst in $$list; do \
+ if test -f ./$$tst; then dir=./; \
+ elif test -f $$tst; then dir=; \
+ else dir="$(srcdir)/"; fi; \
+ if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xpass=`expr $$xpass + 1`; \
+ failed=`expr $$failed + 1`; \
+ echo "XPASS: $$tst"; \
+ ;; \
+ *) \
+ echo "PASS: $$tst"; \
+ ;; \
+ esac; \
+ elif test $$? -ne 77; then \
+ all=`expr $$all + 1`; \
+ case " $(XFAIL_TESTS) " in \
+ *" $$tst "*) \
+ xfail=`expr $$xfail + 1`; \
+ echo "XFAIL: $$tst"; \
+ ;; \
+ *) \
+ failed=`expr $$failed + 1`; \
+ echo "FAIL: $$tst"; \
+ ;; \
+ esac; \
+ else \
+ skip=`expr $$skip + 1`; \
+ echo "SKIP: $$tst"; \
+ fi; \
+ done; \
+ if test "$$failed" -eq 0; then \
+ if test "$$xfail" -eq 0; then \
+ banner="All $$all tests passed"; \
+ else \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
+ fi; \
+ else \
+ if test "$$xpass" -eq 0; then \
+ banner="$$failed of $$all tests failed"; \
+ else \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
+ fi; \
+ fi; \
+ dashes="$$banner"; \
+ skipped=""; \
+ if test "$$skip" -ne 0; then \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
+ dashes="$$skipped"; \
+ fi; \
+ report=""; \
+ if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
+ report="Please report to $(PACKAGE_BUGREPORT)"; \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
+ dashes="$$report"; \
+ fi; \
+ dashes=`echo "$$dashes" | sed s/./=/g`; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
+ test "$$failed" -eq 0; \
+ else :; fi
+
+distdir: $(DISTFILES)
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
+ if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
+ if test -d $$d/$$file; then \
+ if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
+ fi; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
+ else \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
+ || exit 1; \
+ fi; \
+ done
+check-am: all-am
+ $(MAKE) $(AM_MAKEFLAGS) $(check_PROGRAMS)
+ $(MAKE) $(AM_MAKEFLAGS) check-TESTS
+check: check-am
+all-am: Makefile
+installdirs:
+install: install-am
+install-exec: install-exec-am
+install-data: install-data-am
+uninstall: uninstall-am
+
+install-am: all-am
+ @$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
+
+installcheck: installcheck-am
+install-strip:
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
+mostlyclean-generic:
+
+clean-generic:
+
+distclean-generic:
+ -rm -f $(CONFIG_CLEAN_FILES)
+
+maintainer-clean-generic:
+ @echo "This command is intended for maintainers to use"
+ @echo "it deletes files that may require special tools to rebuild."
+clean: clean-am
+
+clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
+ mostlyclean-am
+
+distclean: distclean-am
+ -rm -f Makefile
+distclean-am: clean-am distclean-compile distclean-generic \
+ distclean-libtool distclean-tags
+
+dvi: dvi-am
+
+dvi-am:
+
+html: html-am
+
+info: info-am
+
+info-am:
+
+install-data-am:
+
+install-exec-am:
+
+install-info: install-info-am
+
+install-man:
+
+installcheck-am:
+
+maintainer-clean: maintainer-clean-am
+ -rm -f Makefile
+maintainer-clean-am: distclean-am maintainer-clean-generic
+
+mostlyclean: mostlyclean-am
+
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
+ mostlyclean-libtool
+
+pdf: pdf-am
+
+pdf-am:
+
+ps: ps-am
+
+ps-am:
+
+uninstall-am: uninstall-info-am
+
+.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
+ clean-checkPROGRAMS clean-generic clean-libtool ctags \
+ distclean distclean-compile distclean-generic \
+ distclean-libtool distclean-tags distdir dvi dvi-am html \
+ html-am info info-am install install-am install-data \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
+ installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-compile \
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
+
+
+$(top_builddir)/tests/libtests.la:
+ cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
+# Tell versions [3.59,3.63) of GNU make to not export all variables.
+# Otherwise a system limit (for SysV at least) may be exceeded.
+.NOEXPORT:
diff --git a/gmp/tests/mpbsd/allfuns.c b/gmp/tests/mpbsd/allfuns.c
new file mode 100644
index 0000000000..2aa25d333e
--- /dev/null
+++ b/gmp/tests/mpbsd/allfuns.c
@@ -0,0 +1,56 @@
+/* A test program doing nothing really, just linking to all the BSD MP
+ functions that're supposed to exist.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 <stdio.h>
+#include <stdlib.h>
+#include "mp.h"
+
+int
+main (int argc, char *argv[])
+{
+ MINT *a, *b, *c, *d;
+ short h;
+
+ mp_set_memory_functions (NULL, NULL, NULL);
+ a = itom (123);
+ b = xtom ("DEADBEEF");
+ c = itom (0);
+ d = itom (0);
+ move (a, b);
+ madd (a, b, c);
+ msub (a, b, c);
+ mult (a, b, c);
+ mdiv (b, a, c, d);
+ sdiv (b, 2, c, &h);
+ msqrt (a, c, d);
+ pow (b, a, a, c);
+ rpow (a, 3, c);
+ gcd (a, b, c);
+ mcmp (a, b);
+ if (argc > 1)
+ {
+ min (c);
+ mout (a);
+ }
+ mtox (b);
+ mfree(a);
+
+ exit (0);
+}
diff --git a/gmp/tests/mpbsd/t-itom.c b/gmp/tests/mpbsd/t-itom.c
new file mode 100644
index 0000000000..9b49cb0007
--- /dev/null
+++ b/gmp/tests/mpbsd/t-itom.c
@@ -0,0 +1,74 @@
+/* Test itom.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 <stdio.h>
+#include <stdlib.h>
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "mp.h"
+#include "tests.h"
+
+#define SGN(x) ((x) < 0 ? -1 : (x) == 0 ? 0 : 1)
+
+
+void
+check_data (void)
+{
+ static const struct {
+ short m;
+ mp_size_t want_size;
+ mp_limb_t want_limb;
+ } data[] = {
+
+ { 0L, 0 },
+ { 1L, 1, 1 },
+ { -1L, -1, 1 },
+
+ { SHRT_MAX, 1, SHRT_MAX },
+ { -SHRT_MAX, -1, SHRT_MAX },
+ { SHRT_MIN, -1, -SHRT_MIN },
+ };
+
+ MINT *m;
+ int i;
+
+ for (i = 0; i < numberof (data); i++)
+ {
+ m = itom (data[i].m);
+ if (m->_mp_size != data[i].want_size
+ || (m->_mp_size != 0 && m->_mp_d[0] != data[i].want_limb))
+ {
+ printf ("itom wrong on data[%d]\n", i);
+ abort();
+ }
+ mfree (m);
+ }
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_data ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/gmp/tests/mpbsd/t-mtox.c b/gmp/tests/mpbsd/t-mtox.c
new file mode 100644
index 0000000000..b6c489cad9
--- /dev/null
+++ b/gmp/tests/mpbsd/t-mtox.c
@@ -0,0 +1,86 @@
+/* Test mtox.
+
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 <string.h> /* for strcmp, strlen */
+#include <stdlib.h> /* for abort */
+#include <stdio.h>
+#include "gmp.h"
+#include "gmp-impl.h"
+#include "mp.h"
+#include "tests.h"
+
+
+void
+check_random (void)
+{
+ mpz_t z;
+ int i;
+ char *got, *want;
+ gmp_randstate_ptr rands = RANDS;
+
+ mpz_init (z);
+
+ for (i = 0; i < 1000; i++)
+ {
+ mpz_erandomb (z, rands, 6 * BITS_PER_MP_LIMB);
+ got = mtox (z);
+ want = mpz_get_str (NULL, 16, z);
+ if (strcmp (got, want) != 0)
+ {
+ printf ("mtox wrong result\n");
+ printf (" got \"%s\"\n", got);
+ printf (" want \"%s\"\n", want);
+ abort ();
+ }
+ (*__gmp_free_func) (got, strlen (got) + 1);
+ (*__gmp_free_func) (want, strlen (want) + 1);
+ }
+
+ mpz_clear (z);
+}
+
+void
+check_mem (void)
+{
+ MINT *m;
+ char *s;
+
+ m = itom (0);
+ s = mtox (m);
+ if (! tests_memory_valid (s))
+ {
+ printf ("Skipping t-mtox, cannot test libgmp and libmp memory together\n");
+ exit (0);
+ }
+ mfree (m);
+ (*__gmp_free_func) (s, strlen (s) + 1);
+}
+
+
+int
+main (void)
+{
+ tests_start ();
+
+ check_mem ();
+ check_random ();
+
+ tests_end ();
+ exit (0);
+}
diff --git a/gmp/tests/mpf/Makefile.am b/gmp/tests/mpf/Makefile.am
index 71bccf1a29..85c9cf45df 100644
--- a/gmp/tests/mpf/Makefile.am
+++ b/gmp/tests/mpf/Makefile.am
@@ -1,21 +1,22 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1996, 1999-2004 Free Software Foundation, Inc.
+# Copyright 1996, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+# Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
@@ -24,7 +25,7 @@ LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
check_PROGRAMS = t-add t-sub t-conv t-sqrt t-sqrt_ui t-muldiv t-dm2exp reuse \
t-cmp_d t-cmp_si t-div t-fits t-get_d t-get_d_2exp \
t-get_si t-get_ui t-gsprec t-inp_str t-int_p t-mul_ui \
- t-set t-set_q t-set_si t-set_ui t-trunc t-ui_div t-eq
+ t-set t-set_q t-set_si t-set_ui t-trunc t-ui_div
TESTS = $(check_PROGRAMS)
$(top_builddir)/tests/libtests.la:
diff --git a/gmp/tests/mpf/Makefile.in b/gmp/tests/mpf/Makefile.in
index cbc7bef05b..58b98c8542 100644
--- a/gmp/tests/mpf/Makefile.in
+++ b/gmp/tests/mpf/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,45 +14,34 @@
@SET_MAKE@
-# Copyright 1996, 1999-2004 Free Software Foundation, Inc.
+# Copyright 1996, 1999, 2000, 2001, 2002, 2003, 2004 Free Software
+# Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = reuse.c t-add.c t-cmp_d.c t-cmp_si.c t-conv.c t-div.c t-dm2exp.c t-fits.c t-get_d.c t-get_d_2exp.c t-get_si.c t-get_ui.c t-gsprec.c t-inp_str.c t-int_p.c t-mul_ui.c t-muldiv.c t-set.c t-set_q.c t-set_si.c t-set_ui.c t-sqrt.c t-sqrt_ui.c t-sub.c t-trunc.c t-ui_div.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,8 +53,8 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
check_PROGRAMS = t-add$(EXEEXT) t-sub$(EXEEXT) t-conv$(EXEEXT) \
t-sqrt$(EXEEXT) t-sqrt_ui$(EXEEXT) t-muldiv$(EXEEXT) \
t-dm2exp$(EXEEXT) reuse$(EXEEXT) t-cmp_d$(EXEEXT) \
@@ -75,184 +63,170 @@ check_PROGRAMS = t-add$(EXEEXT) t-sub$(EXEEXT) t-conv$(EXEEXT) \
t-get_ui$(EXEEXT) t-gsprec$(EXEEXT) t-inp_str$(EXEEXT) \
t-int_p$(EXEEXT) t-mul_ui$(EXEEXT) t-set$(EXEEXT) \
t-set_q$(EXEEXT) t-set_si$(EXEEXT) t-set_ui$(EXEEXT) \
- t-trunc$(EXEEXT) t-ui_div$(EXEEXT) t-eq$(EXEEXT)
+ t-trunc$(EXEEXT) t-ui_div$(EXEEXT)
subdir = tests/mpf
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
reuse_SOURCES = reuse.c
-reuse_OBJECTS = reuse.$(OBJEXT)
+reuse_OBJECTS = reuse$U.$(OBJEXT)
reuse_LDADD = $(LDADD)
reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_add_SOURCES = t-add.c
-t_add_OBJECTS = t-add.$(OBJEXT)
+t_add_OBJECTS = t-add$U.$(OBJEXT)
t_add_LDADD = $(LDADD)
t_add_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_d_SOURCES = t-cmp_d.c
-t_cmp_d_OBJECTS = t-cmp_d.$(OBJEXT)
+t_cmp_d_OBJECTS = t-cmp_d$U.$(OBJEXT)
t_cmp_d_LDADD = $(LDADD)
t_cmp_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_si_SOURCES = t-cmp_si.c
-t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT)
+t_cmp_si_OBJECTS = t-cmp_si$U.$(OBJEXT)
t_cmp_si_LDADD = $(LDADD)
t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_conv_SOURCES = t-conv.c
-t_conv_OBJECTS = t-conv.$(OBJEXT)
+t_conv_OBJECTS = t-conv$U.$(OBJEXT)
t_conv_LDADD = $(LDADD)
t_conv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_div_SOURCES = t-div.c
-t_div_OBJECTS = t-div.$(OBJEXT)
+t_div_OBJECTS = t-div$U.$(OBJEXT)
t_div_LDADD = $(LDADD)
t_div_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_dm2exp_SOURCES = t-dm2exp.c
-t_dm2exp_OBJECTS = t-dm2exp.$(OBJEXT)
+t_dm2exp_OBJECTS = t-dm2exp$U.$(OBJEXT)
t_dm2exp_LDADD = $(LDADD)
t_dm2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_eq_SOURCES = t-eq.c
-t_eq_OBJECTS = t-eq.$(OBJEXT)
-t_eq_LDADD = $(LDADD)
-t_eq_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_fits_SOURCES = t-fits.c
-t_fits_OBJECTS = t-fits.$(OBJEXT)
+t_fits_OBJECTS = t-fits$U.$(OBJEXT)
t_fits_LDADD = $(LDADD)
t_fits_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_d_SOURCES = t-get_d.c
-t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_OBJECTS = t-get_d$U.$(OBJEXT)
t_get_d_LDADD = $(LDADD)
t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_d_2exp_SOURCES = t-get_d_2exp.c
-t_get_d_2exp_OBJECTS = t-get_d_2exp.$(OBJEXT)
+t_get_d_2exp_OBJECTS = t-get_d_2exp$U.$(OBJEXT)
t_get_d_2exp_LDADD = $(LDADD)
t_get_d_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_si_SOURCES = t-get_si.c
-t_get_si_OBJECTS = t-get_si.$(OBJEXT)
+t_get_si_OBJECTS = t-get_si$U.$(OBJEXT)
t_get_si_LDADD = $(LDADD)
t_get_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_ui_SOURCES = t-get_ui.c
-t_get_ui_OBJECTS = t-get_ui.$(OBJEXT)
+t_get_ui_OBJECTS = t-get_ui$U.$(OBJEXT)
t_get_ui_LDADD = $(LDADD)
t_get_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_gsprec_SOURCES = t-gsprec.c
-t_gsprec_OBJECTS = t-gsprec.$(OBJEXT)
+t_gsprec_OBJECTS = t-gsprec$U.$(OBJEXT)
t_gsprec_LDADD = $(LDADD)
t_gsprec_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_inp_str_SOURCES = t-inp_str.c
-t_inp_str_OBJECTS = t-inp_str.$(OBJEXT)
+t_inp_str_OBJECTS = t-inp_str$U.$(OBJEXT)
t_inp_str_LDADD = $(LDADD)
t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_int_p_SOURCES = t-int_p.c
-t_int_p_OBJECTS = t-int_p.$(OBJEXT)
+t_int_p_OBJECTS = t-int_p$U.$(OBJEXT)
t_int_p_LDADD = $(LDADD)
t_int_p_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_mul_ui_SOURCES = t-mul_ui.c
-t_mul_ui_OBJECTS = t-mul_ui.$(OBJEXT)
+t_mul_ui_OBJECTS = t-mul_ui$U.$(OBJEXT)
t_mul_ui_LDADD = $(LDADD)
t_mul_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_muldiv_SOURCES = t-muldiv.c
-t_muldiv_OBJECTS = t-muldiv.$(OBJEXT)
+t_muldiv_OBJECTS = t-muldiv$U.$(OBJEXT)
t_muldiv_LDADD = $(LDADD)
t_muldiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_SOURCES = t-set.c
-t_set_OBJECTS = t-set.$(OBJEXT)
+t_set_OBJECTS = t-set$U.$(OBJEXT)
t_set_LDADD = $(LDADD)
t_set_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_q_SOURCES = t-set_q.c
-t_set_q_OBJECTS = t-set_q.$(OBJEXT)
+t_set_q_OBJECTS = t-set_q$U.$(OBJEXT)
t_set_q_LDADD = $(LDADD)
t_set_q_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_si_SOURCES = t-set_si.c
-t_set_si_OBJECTS = t-set_si.$(OBJEXT)
+t_set_si_OBJECTS = t-set_si$U.$(OBJEXT)
t_set_si_LDADD = $(LDADD)
t_set_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_ui_SOURCES = t-set_ui.c
-t_set_ui_OBJECTS = t-set_ui.$(OBJEXT)
+t_set_ui_OBJECTS = t-set_ui$U.$(OBJEXT)
t_set_ui_LDADD = $(LDADD)
t_set_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_sqrt_SOURCES = t-sqrt.c
-t_sqrt_OBJECTS = t-sqrt.$(OBJEXT)
+t_sqrt_OBJECTS = t-sqrt$U.$(OBJEXT)
t_sqrt_LDADD = $(LDADD)
t_sqrt_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_sqrt_ui_SOURCES = t-sqrt_ui.c
-t_sqrt_ui_OBJECTS = t-sqrt_ui.$(OBJEXT)
+t_sqrt_ui_OBJECTS = t-sqrt_ui$U.$(OBJEXT)
t_sqrt_ui_LDADD = $(LDADD)
t_sqrt_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_sub_SOURCES = t-sub.c
-t_sub_OBJECTS = t-sub.$(OBJEXT)
+t_sub_OBJECTS = t-sub$U.$(OBJEXT)
t_sub_LDADD = $(LDADD)
t_sub_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_trunc_SOURCES = t-trunc.c
-t_trunc_OBJECTS = t-trunc.$(OBJEXT)
+t_trunc_OBJECTS = t-trunc$U.$(OBJEXT)
t_trunc_LDADD = $(LDADD)
t_trunc_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_ui_div_SOURCES = t-ui_div.c
-t_ui_div_OBJECTS = t-ui_div.$(OBJEXT)
+t_ui_div_OBJECTS = t-ui_div$U.$(OBJEXT)
t_ui_div_LDADD = $(LDADD)
t_ui_div_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = reuse.c t-add.c t-cmp_d.c t-cmp_si.c t-conv.c t-div.c \
- t-dm2exp.c t-eq.c t-fits.c t-get_d.c t-get_d_2exp.c t-get_si.c \
+ t-dm2exp.c t-fits.c t-get_d.c t-get_d_2exp.c t-get_si.c \
t-get_ui.c t-gsprec.c t-inp_str.c t-int_p.c t-mul_ui.c \
t-muldiv.c t-set.c t-set_q.c t-set_si.c t-set_ui.c t-sqrt.c \
t-sqrt_ui.c t-sub.c t-trunc.c t-ui_div.c
DIST_SOURCES = reuse.c t-add.c t-cmp_d.c t-cmp_si.c t-conv.c t-div.c \
- t-dm2exp.c t-eq.c t-fits.c t-get_d.c t-get_d_2exp.c t-get_si.c \
+ t-dm2exp.c t-fits.c t-get_d.c t-get_d_2exp.c t-get_si.c \
t-get_ui.c t-gsprec.c t-inp_str.c t-int_p.c t-mul_ui.c \
t-muldiv.c t-set.c t-set_q.c t-set_si.c t-set_ui.c t-sqrt.c \
t-sqrt_ui.c t-sub.c t-trunc.c t-ui_div.c
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -264,6 +238,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -279,17 +254,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -303,12 +277,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -323,26 +295,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -352,31 +318,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -400,6 +361,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -407,12 +369,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
TESTS = $(check_PROGRAMS)
@@ -424,14 +382,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpf/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/mpf/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpf/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpf/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -449,103 +407,102 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES)
@rm -f reuse$(EXEEXT)
- $(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
-t-add$(EXEEXT): $(t_add_OBJECTS) $(t_add_DEPENDENCIES) $(EXTRA_t_add_DEPENDENCIES)
+ $(LINK) $(reuse_LDFLAGS) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
+t-add$(EXEEXT): $(t_add_OBJECTS) $(t_add_DEPENDENCIES)
@rm -f t-add$(EXEEXT)
- $(LINK) $(t_add_OBJECTS) $(t_add_LDADD) $(LIBS)
-t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES) $(EXTRA_t_cmp_d_DEPENDENCIES)
+ $(LINK) $(t_add_LDFLAGS) $(t_add_OBJECTS) $(t_add_LDADD) $(LIBS)
+t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES)
@rm -f t-cmp_d$(EXEEXT)
- $(LINK) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS)
-t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES)
+ $(LINK) $(t_cmp_d_LDFLAGS) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS)
+t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES)
@rm -f t-cmp_si$(EXEEXT)
- $(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
-t-conv$(EXEEXT): $(t_conv_OBJECTS) $(t_conv_DEPENDENCIES) $(EXTRA_t_conv_DEPENDENCIES)
+ $(LINK) $(t_cmp_si_LDFLAGS) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
+t-conv$(EXEEXT): $(t_conv_OBJECTS) $(t_conv_DEPENDENCIES)
@rm -f t-conv$(EXEEXT)
- $(LINK) $(t_conv_OBJECTS) $(t_conv_LDADD) $(LIBS)
-t-div$(EXEEXT): $(t_div_OBJECTS) $(t_div_DEPENDENCIES) $(EXTRA_t_div_DEPENDENCIES)
+ $(LINK) $(t_conv_LDFLAGS) $(t_conv_OBJECTS) $(t_conv_LDADD) $(LIBS)
+t-div$(EXEEXT): $(t_div_OBJECTS) $(t_div_DEPENDENCIES)
@rm -f t-div$(EXEEXT)
- $(LINK) $(t_div_OBJECTS) $(t_div_LDADD) $(LIBS)
-t-dm2exp$(EXEEXT): $(t_dm2exp_OBJECTS) $(t_dm2exp_DEPENDENCIES) $(EXTRA_t_dm2exp_DEPENDENCIES)
+ $(LINK) $(t_div_LDFLAGS) $(t_div_OBJECTS) $(t_div_LDADD) $(LIBS)
+t-dm2exp$(EXEEXT): $(t_dm2exp_OBJECTS) $(t_dm2exp_DEPENDENCIES)
@rm -f t-dm2exp$(EXEEXT)
- $(LINK) $(t_dm2exp_OBJECTS) $(t_dm2exp_LDADD) $(LIBS)
-t-eq$(EXEEXT): $(t_eq_OBJECTS) $(t_eq_DEPENDENCIES) $(EXTRA_t_eq_DEPENDENCIES)
- @rm -f t-eq$(EXEEXT)
- $(LINK) $(t_eq_OBJECTS) $(t_eq_LDADD) $(LIBS)
-t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES) $(EXTRA_t_fits_DEPENDENCIES)
+ $(LINK) $(t_dm2exp_LDFLAGS) $(t_dm2exp_OBJECTS) $(t_dm2exp_LDADD) $(LIBS)
+t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES)
@rm -f t-fits$(EXEEXT)
- $(LINK) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS)
-t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ $(LINK) $(t_fits_LDFLAGS) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS)
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES)
@rm -f t-get_d$(EXEEXT)
- $(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
-t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES) $(EXTRA_t_get_d_2exp_DEPENDENCIES)
+ $(LINK) $(t_get_d_LDFLAGS) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES)
@rm -f t-get_d_2exp$(EXEEXT)
- $(LINK) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS)
-t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES) $(EXTRA_t_get_si_DEPENDENCIES)
+ $(LINK) $(t_get_d_2exp_LDFLAGS) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS)
+t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES)
@rm -f t-get_si$(EXEEXT)
- $(LINK) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS)
-t-get_ui$(EXEEXT): $(t_get_ui_OBJECTS) $(t_get_ui_DEPENDENCIES) $(EXTRA_t_get_ui_DEPENDENCIES)
+ $(LINK) $(t_get_si_LDFLAGS) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS)
+t-get_ui$(EXEEXT): $(t_get_ui_OBJECTS) $(t_get_ui_DEPENDENCIES)
@rm -f t-get_ui$(EXEEXT)
- $(LINK) $(t_get_ui_OBJECTS) $(t_get_ui_LDADD) $(LIBS)
-t-gsprec$(EXEEXT): $(t_gsprec_OBJECTS) $(t_gsprec_DEPENDENCIES) $(EXTRA_t_gsprec_DEPENDENCIES)
+ $(LINK) $(t_get_ui_LDFLAGS) $(t_get_ui_OBJECTS) $(t_get_ui_LDADD) $(LIBS)
+t-gsprec$(EXEEXT): $(t_gsprec_OBJECTS) $(t_gsprec_DEPENDENCIES)
@rm -f t-gsprec$(EXEEXT)
- $(LINK) $(t_gsprec_OBJECTS) $(t_gsprec_LDADD) $(LIBS)
-t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES)
+ $(LINK) $(t_gsprec_LDFLAGS) $(t_gsprec_OBJECTS) $(t_gsprec_LDADD) $(LIBS)
+t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES)
@rm -f t-inp_str$(EXEEXT)
- $(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
-t-int_p$(EXEEXT): $(t_int_p_OBJECTS) $(t_int_p_DEPENDENCIES) $(EXTRA_t_int_p_DEPENDENCIES)
+ $(LINK) $(t_inp_str_LDFLAGS) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
+t-int_p$(EXEEXT): $(t_int_p_OBJECTS) $(t_int_p_DEPENDENCIES)
@rm -f t-int_p$(EXEEXT)
- $(LINK) $(t_int_p_OBJECTS) $(t_int_p_LDADD) $(LIBS)
-t-mul_ui$(EXEEXT): $(t_mul_ui_OBJECTS) $(t_mul_ui_DEPENDENCIES) $(EXTRA_t_mul_ui_DEPENDENCIES)
+ $(LINK) $(t_int_p_LDFLAGS) $(t_int_p_OBJECTS) $(t_int_p_LDADD) $(LIBS)
+t-mul_ui$(EXEEXT): $(t_mul_ui_OBJECTS) $(t_mul_ui_DEPENDENCIES)
@rm -f t-mul_ui$(EXEEXT)
- $(LINK) $(t_mul_ui_OBJECTS) $(t_mul_ui_LDADD) $(LIBS)
-t-muldiv$(EXEEXT): $(t_muldiv_OBJECTS) $(t_muldiv_DEPENDENCIES) $(EXTRA_t_muldiv_DEPENDENCIES)
+ $(LINK) $(t_mul_ui_LDFLAGS) $(t_mul_ui_OBJECTS) $(t_mul_ui_LDADD) $(LIBS)
+t-muldiv$(EXEEXT): $(t_muldiv_OBJECTS) $(t_muldiv_DEPENDENCIES)
@rm -f t-muldiv$(EXEEXT)
- $(LINK) $(t_muldiv_OBJECTS) $(t_muldiv_LDADD) $(LIBS)
-t-set$(EXEEXT): $(t_set_OBJECTS) $(t_set_DEPENDENCIES) $(EXTRA_t_set_DEPENDENCIES)
+ $(LINK) $(t_muldiv_LDFLAGS) $(t_muldiv_OBJECTS) $(t_muldiv_LDADD) $(LIBS)
+t-set$(EXEEXT): $(t_set_OBJECTS) $(t_set_DEPENDENCIES)
@rm -f t-set$(EXEEXT)
- $(LINK) $(t_set_OBJECTS) $(t_set_LDADD) $(LIBS)
-t-set_q$(EXEEXT): $(t_set_q_OBJECTS) $(t_set_q_DEPENDENCIES) $(EXTRA_t_set_q_DEPENDENCIES)
+ $(LINK) $(t_set_LDFLAGS) $(t_set_OBJECTS) $(t_set_LDADD) $(LIBS)
+t-set_q$(EXEEXT): $(t_set_q_OBJECTS) $(t_set_q_DEPENDENCIES)
@rm -f t-set_q$(EXEEXT)
- $(LINK) $(t_set_q_OBJECTS) $(t_set_q_LDADD) $(LIBS)
-t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES) $(EXTRA_t_set_si_DEPENDENCIES)
+ $(LINK) $(t_set_q_LDFLAGS) $(t_set_q_OBJECTS) $(t_set_q_LDADD) $(LIBS)
+t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES)
@rm -f t-set_si$(EXEEXT)
- $(LINK) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS)
-t-set_ui$(EXEEXT): $(t_set_ui_OBJECTS) $(t_set_ui_DEPENDENCIES) $(EXTRA_t_set_ui_DEPENDENCIES)
+ $(LINK) $(t_set_si_LDFLAGS) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS)
+t-set_ui$(EXEEXT): $(t_set_ui_OBJECTS) $(t_set_ui_DEPENDENCIES)
@rm -f t-set_ui$(EXEEXT)
- $(LINK) $(t_set_ui_OBJECTS) $(t_set_ui_LDADD) $(LIBS)
-t-sqrt$(EXEEXT): $(t_sqrt_OBJECTS) $(t_sqrt_DEPENDENCIES) $(EXTRA_t_sqrt_DEPENDENCIES)
+ $(LINK) $(t_set_ui_LDFLAGS) $(t_set_ui_OBJECTS) $(t_set_ui_LDADD) $(LIBS)
+t-sqrt$(EXEEXT): $(t_sqrt_OBJECTS) $(t_sqrt_DEPENDENCIES)
@rm -f t-sqrt$(EXEEXT)
- $(LINK) $(t_sqrt_OBJECTS) $(t_sqrt_LDADD) $(LIBS)
-t-sqrt_ui$(EXEEXT): $(t_sqrt_ui_OBJECTS) $(t_sqrt_ui_DEPENDENCIES) $(EXTRA_t_sqrt_ui_DEPENDENCIES)
+ $(LINK) $(t_sqrt_LDFLAGS) $(t_sqrt_OBJECTS) $(t_sqrt_LDADD) $(LIBS)
+t-sqrt_ui$(EXEEXT): $(t_sqrt_ui_OBJECTS) $(t_sqrt_ui_DEPENDENCIES)
@rm -f t-sqrt_ui$(EXEEXT)
- $(LINK) $(t_sqrt_ui_OBJECTS) $(t_sqrt_ui_LDADD) $(LIBS)
-t-sub$(EXEEXT): $(t_sub_OBJECTS) $(t_sub_DEPENDENCIES) $(EXTRA_t_sub_DEPENDENCIES)
+ $(LINK) $(t_sqrt_ui_LDFLAGS) $(t_sqrt_ui_OBJECTS) $(t_sqrt_ui_LDADD) $(LIBS)
+t-sub$(EXEEXT): $(t_sub_OBJECTS) $(t_sub_DEPENDENCIES)
@rm -f t-sub$(EXEEXT)
- $(LINK) $(t_sub_OBJECTS) $(t_sub_LDADD) $(LIBS)
-t-trunc$(EXEEXT): $(t_trunc_OBJECTS) $(t_trunc_DEPENDENCIES) $(EXTRA_t_trunc_DEPENDENCIES)
+ $(LINK) $(t_sub_LDFLAGS) $(t_sub_OBJECTS) $(t_sub_LDADD) $(LIBS)
+t-trunc$(EXEEXT): $(t_trunc_OBJECTS) $(t_trunc_DEPENDENCIES)
@rm -f t-trunc$(EXEEXT)
- $(LINK) $(t_trunc_OBJECTS) $(t_trunc_LDADD) $(LIBS)
-t-ui_div$(EXEEXT): $(t_ui_div_OBJECTS) $(t_ui_div_DEPENDENCIES) $(EXTRA_t_ui_div_DEPENDENCIES)
+ $(LINK) $(t_trunc_LDFLAGS) $(t_trunc_OBJECTS) $(t_trunc_LDADD) $(LIBS)
+t-ui_div$(EXEEXT): $(t_ui_div_OBJECTS) $(t_ui_div_DEPENDENCIES)
@rm -f t-ui_div$(EXEEXT)
- $(LINK) $(t_ui_div_OBJECTS) $(t_ui_div_LDADD) $(LIBS)
+ $(LINK) $(t_ui_div_LDFLAGS) $(t_ui_div_OBJECTS) $(t_ui_div_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -555,6 +512,72 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+reuse_.c: reuse.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reuse.c; then echo $(srcdir)/reuse.c; else echo reuse.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-add_.c: t-add.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-add.c; then echo $(srcdir)/t-add.c; else echo t-add.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_d_.c: t-cmp_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_d.c; then echo $(srcdir)/t-cmp_d.c; else echo t-cmp_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_si_.c: t-cmp_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_si.c; then echo $(srcdir)/t-cmp_si.c; else echo t-cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-conv_.c: t-conv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-conv.c; then echo $(srcdir)/t-conv.c; else echo t-conv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-div_.c: t-div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-div.c; then echo $(srcdir)/t-div.c; else echo t-div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-dm2exp_.c: t-dm2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-dm2exp.c; then echo $(srcdir)/t-dm2exp.c; else echo t-dm2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-fits_.c: t-fits.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fits.c; then echo $(srcdir)/t-fits.c; else echo t-fits.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_d_.c: t-get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d.c; then echo $(srcdir)/t-get_d.c; else echo t-get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_d_2exp_.c: t-get_d_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d_2exp.c; then echo $(srcdir)/t-get_d_2exp.c; else echo t-get_d_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_si_.c: t-get_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_si.c; then echo $(srcdir)/t-get_si.c; else echo t-get_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_ui_.c: t-get_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_ui.c; then echo $(srcdir)/t-get_ui.c; else echo t-get_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-gsprec_.c: t-gsprec.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-gsprec.c; then echo $(srcdir)/t-gsprec.c; else echo t-gsprec.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-inp_str_.c: t-inp_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-inp_str.c; then echo $(srcdir)/t-inp_str.c; else echo t-inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-int_p_.c: t-int_p.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-int_p.c; then echo $(srcdir)/t-int_p.c; else echo t-int_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-mul_ui_.c: t-mul_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mul_ui.c; then echo $(srcdir)/t-mul_ui.c; else echo t-mul_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-muldiv_.c: t-muldiv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-muldiv.c; then echo $(srcdir)/t-muldiv.c; else echo t-muldiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_.c: t-set.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set.c; then echo $(srcdir)/t-set.c; else echo t-set.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_q_.c: t-set_q.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_q.c; then echo $(srcdir)/t-set_q.c; else echo t-set_q.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_si_.c: t-set_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_si.c; then echo $(srcdir)/t-set_si.c; else echo t-set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_ui_.c: t-set_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_ui.c; then echo $(srcdir)/t-set_ui.c; else echo t-set_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-sqrt_.c: t-sqrt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sqrt.c; then echo $(srcdir)/t-sqrt.c; else echo t-sqrt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-sqrt_ui_.c: t-sqrt_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sqrt_ui.c; then echo $(srcdir)/t-sqrt_ui.c; else echo t-sqrt_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-sub_.c: t-sub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sub.c; then echo $(srcdir)/t-sub.c; else echo t-sub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-trunc_.c: t-trunc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-trunc.c; then echo $(srcdir)/t-trunc.c; else echo t-trunc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-ui_div_.c: t-ui_div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-ui_div.c; then echo $(srcdir)/t-ui_div.c; else echo t-ui_div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+reuse_.$(OBJEXT) reuse_.lo t-add_.$(OBJEXT) t-add_.lo \
+t-cmp_d_.$(OBJEXT) t-cmp_d_.lo t-cmp_si_.$(OBJEXT) t-cmp_si_.lo \
+t-conv_.$(OBJEXT) t-conv_.lo t-div_.$(OBJEXT) t-div_.lo \
+t-dm2exp_.$(OBJEXT) t-dm2exp_.lo t-fits_.$(OBJEXT) t-fits_.lo \
+t-get_d_.$(OBJEXT) t-get_d_.lo t-get_d_2exp_.$(OBJEXT) \
+t-get_d_2exp_.lo t-get_si_.$(OBJEXT) t-get_si_.lo t-get_ui_.$(OBJEXT) \
+t-get_ui_.lo t-gsprec_.$(OBJEXT) t-gsprec_.lo t-inp_str_.$(OBJEXT) \
+t-inp_str_.lo t-int_p_.$(OBJEXT) t-int_p_.lo t-mul_ui_.$(OBJEXT) \
+t-mul_ui_.lo t-muldiv_.$(OBJEXT) t-muldiv_.lo t-set_.$(OBJEXT) \
+t-set_.lo t-set_q_.$(OBJEXT) t-set_q_.lo t-set_si_.$(OBJEXT) \
+t-set_si_.lo t-set_ui_.$(OBJEXT) t-set_ui_.lo t-sqrt_.$(OBJEXT) \
+t-sqrt_.lo t-sqrt_ui_.$(OBJEXT) t-sqrt_ui_.lo t-sub_.$(OBJEXT) \
+t-sub_.lo t-trunc_.$(OBJEXT) t-trunc_.lo t-ui_div_.$(OBJEXT) \
+t-ui_div_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -562,54 +585,54 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -617,8 +640,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -627,113 +649,91 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -753,22 +753,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -781,7 +775,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -789,38 +783,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -829,7 +803,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -840,28 +814,23 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/mpf/reuse.c b/gmp/tests/mpf/reuse.c
index 3a382530b6..f373ac700e 100644
--- a/gmp/tests/mpf/reuse.c
+++ b/gmp/tests/mpf/reuse.c
@@ -1,21 +1,21 @@
/* Test that routines allow reusing a source variable as destination.
-Copyright 1996, 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -50,42 +50,42 @@ main (void)
#define EXPO 32
#endif
-void dump_abort (const char *, mpf_t, mpf_t);
+void dump_abort __GMP_PROTO ((char *, mpf_t, mpf_t));
-typedef void (*dss_func) (mpf_ptr, mpf_srcptr, mpf_srcptr);
+typedef void (*dss_func) __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
dss_func dss_funcs[] =
{
mpf_div, mpf_add, mpf_mul, mpf_sub,
};
-const char *dss_func_names[] =
+char *dss_func_names[] =
{
"mpf_div", "mpf_add", "mpf_mul", "mpf_sub",
};
-typedef void (*dsi_func) (mpf_ptr, mpf_srcptr, unsigned long int);
+typedef void (*dsi_func) __GMP_PROTO ((mpf_ptr, mpf_srcptr, unsigned long int));
dsi_func dsi_funcs[] =
{
mpf_div_ui, mpf_add_ui, mpf_mul_ui, mpf_sub_ui,
- mpf_mul_2exp, mpf_div_2exp, mpf_pow_ui
+ mpf_mul_2exp, mpf_div_2exp
};
-const char *dsi_func_names[] =
+char *dsi_func_names[] =
{
"mpf_div_ui", "mpf_add_ui", "mpf_mul_ui", "mpf_sub_ui",
- "mpf_mul_2exp", "mpf_div_2exp", "mpf_pow_ui"
+ "mpf_mul_2exp", "mpf_div_2exp"
};
-typedef void (*dis_func) (mpf_ptr, unsigned long int, mpf_srcptr);
+typedef void (*dis_func) __GMP_PROTO ((mpf_ptr, unsigned long int, mpf_srcptr));
dis_func dis_funcs[] =
{
mpf_ui_div, mpf_ui_sub,
};
-const char *dis_func_names[] =
+char *dis_func_names[] =
{
"mpf_ui_div", "mpf_ui_sub",
};
@@ -148,22 +148,14 @@ 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 (dsi_funcs[i] == mpf_div_ui && this_in2i == 0)
+ if (strcmp (dsi_func_names[i], "mpf_div_ui") == 0 && in2i == 0)
continue;
- /* 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);
+ (dsi_funcs[i]) (res1, in1, in2i);
mpf_set (out1, in1);
- (dsi_funcs[i]) (out1, out1, this_in2i);
+ (dsi_funcs[i]) (out1, out1, in2i);
mpf_set (res2, out1);
if (mpf_cmp (res1, res2) != 0)
@@ -174,7 +166,7 @@ main (int argc, char **argv)
for (i = 0; i < sizeof (dis_funcs) / sizeof (dis_func); i++)
{
/* Don't divide by 0. */
- if (dis_funcs[i] == mpf_ui_div
+ if (strcmp (dis_func_names[i], "mpf_ui_div") == 0
&& mpf_cmp_ui (in2, 0) == 0)
continue;
@@ -202,7 +194,7 @@ main (int argc, char **argv)
}
void
-dump_abort (const char *name, mpf_t res1, mpf_t res2)
+dump_abort (char *name, mpf_t res1, mpf_t res2)
{
printf ("failure in %s:\n", name);
mpf_dump (res1);
@@ -211,9 +203,9 @@ dump_abort (const char *name, mpf_t res1, mpf_t res2)
}
#if 0
-void mpf_abs (mpf_ptr, mpf_srcptr);
-void mpf_sqrt (mpf_ptr, mpf_srcptr);
-void mpf_neg (mpf_ptr, mpf_srcptr);
+void mpf_abs __GMP_PROTO ((mpf_ptr, mpf_srcptr));
+void mpf_sqrt __GMP_PROTO ((mpf_ptr, mpf_srcptr));
+void mpf_neg __GMP_PROTO ((mpf_ptr, mpf_srcptr));
#endif
#endif /* ! DLL_EXPORT */
diff --git a/gmp/tests/mpf/t-add.c b/gmp/tests/mpf/t-add.c
index dacc6382e4..db0dbe5b50 100644
--- a/gmp/tests/mpf/t-add.c
+++ b/gmp/tests/mpf/t-add.c
@@ -2,20 +2,20 @@
Copyright 1996, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-cmp_d.c b/gmp/tests/mpf/t-cmp_d.c
index a1cbbadb17..6b5385f605 100644
--- a/gmp/tests/mpf/t-cmp_d.c
+++ b/gmp/tests/mpf/t-cmp_d.c
@@ -2,20 +2,20 @@
Copyright 2001, 2003, 2003, 2005 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-cmp_si.c b/gmp/tests/mpf/t-cmp_si.c
index 3bf016ff28..e4b9514dc5 100644
--- a/gmp/tests/mpf/t-cmp_si.c
+++ b/gmp/tests/mpf/t-cmp_si.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-conv.c b/gmp/tests/mpf/t-conv.c
index 3b47866061..0a51fcc009 100644
--- a/gmp/tests/mpf/t-conv.c
+++ b/gmp/tests/mpf/t-conv.c
@@ -2,20 +2,20 @@
Copyright 1996, 2000, 2001, 2008 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -45,7 +45,7 @@ main (int argc, char **argv)
mp_exp_t bexp;
long size, exp;
int base;
- char buf[SIZE * GMP_LIMB_BITS + 5];
+ char buf[SIZE * BITS_PER_MP_LIMB + 5];
tests_start ();
diff --git a/gmp/tests/mpf/t-div.c b/gmp/tests/mpf/t-div.c
index 2f34eabaca..a88f1cc5b1 100644
--- a/gmp/tests/mpf/t-div.c
+++ b/gmp/tests/mpf/t-div.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-dm2exp.c b/gmp/tests/mpf/t-dm2exp.c
index 90e4c18f16..da43e28ac3 100644
--- a/gmp/tests/mpf/t-dm2exp.c
+++ b/gmp/tests/mpf/t-dm2exp.c
@@ -2,20 +2,20 @@
Copyright 1996, 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-eq.c b/gmp/tests/mpf/t-eq.c
deleted file mode 100644
index 359fec9316..0000000000
--- a/gmp/tests/mpf/t-eq.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Test mpf_eq.
-
-Copyright 2009, 2012 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>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-#define SZ (2 * sizeof(mp_limb_t))
-
-void insert_random_low_zero_limbs (mpf_t, gmp_randstate_ptr);
-void dump_abort (mpf_t, mpf_t, int, int, int, int, int, long);
-void hexdump (mpf_t);
-
-void
-check_data (void)
-{
- static const struct
- {
- struct {
- int exp, size;
- mp_limb_t d[10];
- } x, y;
- mp_bitcnt_t bits;
- int want;
-
- } data[] = {
- { { 0, 0, { 0 } }, { 0, 0, { 0 } }, 0, 1 },
-
- { { 0, 1, { 7 } }, { 0, 1, { 7 } }, 0, 1 },
- { { 0, 1, { 7 } }, { 0, 1, { 7 } }, 17, 1 },
- { { 0, 1, { 7 } }, { 0, 1, { 7 } }, 4711, 1 },
-
- { { 0, 1, { 7 } }, { 0, 1, { 6 } }, 0, 1 },
- { { 0, 1, { 7 } }, { 0, 1, { 6 } }, 2, 1 },
- { { 0, 1, { 7 } }, { 0, 1, { 6 } }, 3, 0 },
-
- { { 0, 0, { 0 } }, { 0, 1, { 1 } }, 0, 0 },
- { { 0, 1, { 1 } }, { 0,-1 ,{ 1 } }, 0, 0 },
- { { 1, 1, { 1 } }, { 0, 1, { 1 } }, 0, 0 },
-
- { { 0, 1, { 8 } }, { 0, 1, { 4 } }, 0, 0 },
-
- { { 0, 2, { 0, 3 } }, { 0, 1, { 3 } }, 1000, 1 },
- };
-
- mpf_t x, y;
- int got, got_swapped;
- int i;
- mp_trace_base = 16;
-
- for (i = 0; i < numberof (data); i++)
- {
- PTR(x) = (mp_ptr) data[i].x.d;
- SIZ(x) = data[i].x.size;
- EXP(x) = data[i].x.exp;
- PREC(x) = numberof (data[i].x.d);
- MPF_CHECK_FORMAT (x);
-
- PTR(y) = (mp_ptr) data[i].y.d;
- SIZ(y) = data[i].y.size;
- EXP(y) = data[i].y.exp;
- PREC(y) = numberof (data[i].y.d);
- MPF_CHECK_FORMAT (y);
-
- got = mpf_eq (x, y, data[i].bits);
- got_swapped = mpf_eq (y, x, data[i].bits);
-
- if (got != got_swapped || got != data[i].want)
- {
- printf ("check_data() wrong result at data[%d]\n", i);
- mpf_trace ("x ", x);
- mpf_trace ("y ", y);
- printf ("got %d\n", got);
- printf ("got_swapped %d\n", got_swapped);
- printf ("want %d\n", data[i].want);
- abort ();
- }
- }
-}
-
-void
-check_random (long reps)
-{
- unsigned long test;
- gmp_randstate_ptr rands = RANDS;
- mpf_t a, b, x;
- mpz_t ds;
- int hibits, lshift1, lshift2;
- int xtra;
-
-#define HIBITS 10
-#define LSHIFT1 10
-#define LSHIFT2 10
-
- mpf_set_default_prec ((1 << HIBITS) + (1 << LSHIFT1) + (1 << LSHIFT2));
-
- mpz_init (ds);
- mpf_inits (a, b, x, NULL);
-
- for (test = 0; test < reps; test++)
- {
- mpz_urandomb (ds, rands, HIBITS);
- hibits = mpz_get_ui (ds) + 1;
- mpz_urandomb (ds, rands, hibits);
- mpz_setbit (ds, hibits - 1); /* make sure msb is set */
- mpf_set_z (a, ds);
- mpf_set_z (b, ds);
-
- mpz_urandomb (ds, rands, LSHIFT1);
- lshift1 = mpz_get_ui (ds);
- mpf_mul_2exp (a, a, lshift1 + 1);
- mpf_mul_2exp (b, b, lshift1 + 1);
- mpf_add_ui (a, a, 1); /* make a one-bit difference */
-
- mpz_urandomb (ds, rands, LSHIFT2);
- lshift2 = mpz_get_ui (ds);
- mpf_mul_2exp (a, a, lshift2);
- mpf_mul_2exp (b, b, lshift2);
- mpz_urandomb (ds, rands, lshift2);
- mpf_set_z (x, ds);
- mpf_add (a, a, x);
- mpf_add (b, b, x);
-
- insert_random_low_zero_limbs (a, rands);
- insert_random_low_zero_limbs (b, rands);
-
- if (mpf_eq (a, b, lshift1 + hibits) == 0 ||
- mpf_eq (b, a, lshift1 + hibits) == 0)
- {
- dump_abort (a, b, lshift1 + hibits, lshift1, lshift2, hibits, 1, test);
- }
- for (xtra = 1; xtra < 100; xtra++)
- if (mpf_eq (a, b, lshift1 + hibits + xtra) != 0 ||
- mpf_eq (b, a, lshift1 + hibits + xtra) != 0)
- {
- dump_abort (a, b, lshift1 + hibits + xtra, lshift1, lshift2, hibits, 0, test);
- }
- }
-
- mpf_clears (a, b, x, NULL);
- mpz_clear (ds);
-}
-
-void
-insert_random_low_zero_limbs (mpf_t x, gmp_randstate_ptr rands)
-{
- mp_size_t max = PREC(x) - SIZ(x);
- mp_size_t s;
- mpz_t ds; mpz_init (ds);
- mpz_urandomb (ds, rands, 32);
- s = mpz_get_ui (ds) % (max + 1);
- MPN_COPY_DECR (PTR(x) + s, PTR(x), SIZ(x));
- MPN_ZERO (PTR(x), s);
- SIZ(x) += s;
- mpz_clear (ds);
-}
-
-void
-dump_abort (mpf_t a, mpf_t b, int cmp_prec, int lshift1, int lshift2, int hibits, int want, long test)
-{
- printf ("ERROR in test %ld\n", test);
- printf ("want %d got %d from mpf_eq\n", want, 1-want);
- printf ("cmp_prec = %d\n", cmp_prec);
- printf ("lshift1 = %d\n", lshift1);
- printf ("lshift2 = %d\n", lshift2);
- printf ("hibits = %d\n", hibits);
- hexdump (a); puts ("");
- hexdump (b); puts ("");
- abort ();
-}
-
-void
-hexdump (mpf_t x)
-{
- mp_size_t i;
- for (i = ABSIZ(x) - 1; i >= 0; i--)
- {
- gmp_printf ("%0*MX", SZ, PTR(x)[i]);
- if (i != 0)
- printf (" ");
- }
-}
-
-int
-main (int argc, char *argv[])
-{
- long reps = 10000;
-
- if (argc == 2)
- reps = strtol (argv[1], 0, 0);
-
- tests_start ();
-
- check_data ();
- check_random (reps);
-
- tests_end ();
- exit (0);
-}
diff --git a/gmp/tests/mpf/t-fits.c b/gmp/tests/mpf/t-fits.c
index 4b0e7c56ba..5318e4767b 100644
--- a/gmp/tests/mpf/t-fits.c
+++ b/gmp/tests/mpf/t-fits.c
@@ -1,21 +1,21 @@
/* Test mpf_fits_*_p
-Copyright 2001, 2002, 2013 Free Software Foundation, Inc.
+Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <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,15 +252,6 @@ 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);
diff --git a/gmp/tests/mpf/t-get_d.c b/gmp/tests/mpf/t-get_d.c
index 66b9623f90..8f18f44d06 100644
--- a/gmp/tests/mpf/t-get_d.c
+++ b/gmp/tests/mpf/t-get_d.c
@@ -1,28 +1,28 @@
/* Test mpf_get_d and mpf_set_d.
-Copyright 1996, 1999-2001, 2009 Free Software Foundation, Inc.
+ Copyright 1996, 1999, 2000, 2001, 2009 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+ This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+ it under the terms of the GNU 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 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.
+ The GNU MP Library is distributed in the hope that it will be useful, but
+ WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+ You should have 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 <stdio.h>
#include <stdlib.h>
#include "gmp.h"
#include "tests.h"
-#if defined (__vax) || defined (__vax__)
+#if defined (__vax__)
#define LOW_BOUND 1e-38
#define HIGH_BOUND 8e37
#endif
diff --git a/gmp/tests/mpf/t-get_d_2exp.c b/gmp/tests/mpf/t-get_d_2exp.c
index 891e51d5a5..91ab97ee51 100644
--- a/gmp/tests/mpf/t-get_d_2exp.c
+++ b/gmp/tests/mpf/t-get_d_2exp.c
@@ -2,20 +2,20 @@
Copyright 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-get_si.c b/gmp/tests/mpf/t-get_si.c
index 80362616d7..c5080411d2 100644
--- a/gmp/tests/mpf/t-get_si.c
+++ b/gmp/tests/mpf/t-get_si.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-get_ui.c b/gmp/tests/mpf/t-get_ui.c
index 2950cadaa5..f5795134d7 100644
--- a/gmp/tests/mpf/t-get_ui.c
+++ b/gmp/tests/mpf/t-get_ui.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-gsprec.c b/gmp/tests/mpf/t-gsprec.c
index 5a7615fc26..d0d7abadbb 100644
--- a/gmp/tests/mpf/t-gsprec.c
+++ b/gmp/tests/mpf/t-gsprec.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-inp_str.c b/gmp/tests/mpf/t-inp_str.c
index 38b54e6a0d..8a50816643 100644
--- a/gmp/tests/mpf/t-inp_str.c
+++ b/gmp/tests/mpf/t-inp_str.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -52,7 +52,6 @@ check_data (void)
{ "125", 10, "125", 3 },
{ "125e1", 10, "1250", 5 },
- { "12e+2", 10, "1200", 5 },
{ "125e-1", 10, "12.5", 6 },
{ "ff", 16, "255", 2 },
diff --git a/gmp/tests/mpf/t-int_p.c b/gmp/tests/mpf/t-int_p.c
index ea07668a1d..11bc90f840 100644
--- a/gmp/tests/mpf/t-int_p.c
+++ b/gmp/tests/mpf/t-int_p.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-mul_ui.c b/gmp/tests/mpf/t-mul_ui.c
index 6a25c79477..a4fd75cf79 100644
--- a/gmp/tests/mpf/t-mul_ui.c
+++ b/gmp/tests/mpf/t-mul_ui.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -118,7 +118,7 @@ void
check_various (void)
{
mpf_t u, got, want;
- const char *s;
+ char *s;
mpf_init2 (u, 2*8*sizeof(long));
mpf_init2 (got, 2*8*sizeof(long));
diff --git a/gmp/tests/mpf/t-muldiv.c b/gmp/tests/mpf/t-muldiv.c
index 2751bb9dad..0fc6449329 100644
--- a/gmp/tests/mpf/t-muldiv.c
+++ b/gmp/tests/mpf/t-muldiv.c
@@ -2,20 +2,20 @@
Copyright 1996, 2000, 2001, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -36,7 +36,7 @@ main (int argc, char **argv)
int reps = 10000;
int i;
mpf_t u, v, w, x;
- mp_size_t bprec = SIZE * GMP_LIMB_BITS;
+ mp_size_t bprec = SIZE * BITS_PER_MP_LIMB;
mpf_t rerr, limit_rerr;
unsigned long ulimb, vlimb;
int single_flag;
diff --git a/gmp/tests/mpf/t-set.c b/gmp/tests/mpf/t-set.c
index 3846d501a1..48336a890c 100644
--- a/gmp/tests/mpf/t-set.c
+++ b/gmp/tests/mpf/t-set.c
@@ -1,21 +1,21 @@
-/* Test mpf_set, mpf_init_set.
+/* Test mpf_set.
-Copyright 2004, 2012 Free Software Foundation, Inc.
+Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -40,73 +40,12 @@ check_reuse (void)
mpf_clear (f);
}
-void
-check_random (long reps)
-{
- unsigned long test;
- gmp_randstate_ptr rands;
- mpf_t a, b;
- mpz_t z;
- int precbits;
-
-#define PRECBITS 10
-
- rands = RANDS;
-
- mpz_init (z);
- mpf_init2 (a, 1 << PRECBITS);
-
- for (test = 0; test < reps; test++)
- {
- mpz_urandomb (z, rands, PRECBITS + 1);
- precbits = mpz_get_ui (z) + 1;
- mpz_urandomb (z, rands, precbits);
- mpz_setbit (z, precbits - 1); /* make sure msb is set */
- mpf_set_z (a, z);
- if (precbits & 1)
- mpf_neg (a, a);
- mpz_urandomb (z, rands, PRECBITS);
- mpf_div_2exp (a, a, mpz_get_ui (z) + 1);
- mpz_urandomb (z, rands, PRECBITS);
- precbits -= mpz_get_ui (z);
- if (precbits <= 0)
- precbits = 1 - precbits;
- mpf_set_default_prec (precbits);
-
- mpf_init_set (b, a);
- MPF_CHECK_FORMAT (b);
- if (!mpf_eq (a, b, precbits))
- {
- printf ("mpf_init_set wrong.\n");
- abort();
- }
-
- mpf_set_ui (b, 0);
- mpf_set (b, a);
- MPF_CHECK_FORMAT (b);
- if (!mpf_eq (a, b, precbits))
- {
- printf ("mpf_set wrong.\n");
- abort();
- }
-
- mpf_clear (b);
- }
-
- mpf_clear (a);
- mpz_clear (z);
-}
-
int
-main (int argc, char *argv[])
+main (void)
{
- long reps = 10000;
-
tests_start ();
- TESTS_REPS (reps, argv, argc);
check_reuse ();
- check_random (reps);
tests_end ();
exit (0);
diff --git a/gmp/tests/mpf/t-set_q.c b/gmp/tests/mpf/t-set_q.c
index 2c48b277da..9dfa04fa5b 100644
--- a/gmp/tests/mpf/t-set_q.c
+++ b/gmp/tests/mpf/t-set_q.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-set_si.c b/gmp/tests/mpf/t-set_si.c
index 8975be7bed..b9519ee913 100644
--- a/gmp/tests/mpf/t-set_si.c
+++ b/gmp/tests/mpf/t-set_si.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-set_ui.c b/gmp/tests/mpf/t-set_ui.c
index 8c49e91e67..fef529b7fd 100644
--- a/gmp/tests/mpf/t-set_ui.c
+++ b/gmp/tests/mpf/t-set_ui.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -41,7 +41,7 @@ check_data (void)
#else
{ ULONG_MAX, 2, { ULONG_MAX & GMP_NUMB_MASK,
ULONG_MAX >> GMP_NUMB_BITS } },
- { ULONG_HIGHBIT, 2, { 0,
+ { LONG_HIGHBIT, 2, { 0,
ULONG_HIGHBIT >> GMP_NUMB_BITS } },
#endif
};
diff --git a/gmp/tests/mpf/t-sqrt.c b/gmp/tests/mpf/t-sqrt.c
index 16a823d9a4..2df7bb22d9 100644
--- a/gmp/tests/mpf/t-sqrt.c
+++ b/gmp/tests/mpf/t-sqrt.c
@@ -2,20 +2,20 @@
Copyright 1996, 2001, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-sqrt_ui.c b/gmp/tests/mpf/t-sqrt_ui.c
index c9233da29c..7ae572bb7a 100644
--- a/gmp/tests/mpf/t-sqrt_ui.c
+++ b/gmp/tests/mpf/t-sqrt_ui.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-sub.c b/gmp/tests/mpf/t-sub.c
index 66281f4243..92d4f05fc6 100644
--- a/gmp/tests/mpf/t-sub.c
+++ b/gmp/tests/mpf/t-sub.c
@@ -2,20 +2,20 @@
Copyright 1996, 2001, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -179,7 +179,7 @@ check_data (void)
if (mpf_cmp (got, want) != 0)
{
- printf ("check_data() wrong result at data[%d] (operands%s swapped)\n", i, swap ? "" : " not");
+ printf ("check_data() wrong reault at data[%d] (operands%s swapped)\n", i, swap ? "" : " not");
mpf_trace ("x ", x);
mpf_trace ("y ", y);
mpf_trace ("got ", got);
diff --git a/gmp/tests/mpf/t-trunc.c b/gmp/tests/mpf/t-trunc.c
index 2eef414b00..30e3703b0e 100644
--- a/gmp/tests/mpf/t-trunc.c
+++ b/gmp/tests/mpf/t-trunc.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpf/t-ui_div.c b/gmp/tests/mpf/t-ui_div.c
index 3024efdbc4..542ecb1099 100644
--- a/gmp/tests/mpf/t-ui_div.c
+++ b/gmp/tests/mpf/t-ui_div.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpn/Makefile.am b/gmp/tests/mpn/Makefile.am
index 180c58692c..f67138a6cc 100644
--- a/gmp/tests/mpn/Makefile.am
+++ b/gmp/tests/mpn/Makefile.am
@@ -1,36 +1,28 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2001-2003, 2009-2014 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
-check_PROGRAMS = t-asmtype t-aors_1 t-divrem_1 t-mod_1 t-fat t-get_d \
- t-instrument t-iord_u t-mp_bases t-perfsqr t-scan logic \
- t-toom22 t-toom32 t-toom33 t-toom42 t-toom43 t-toom44 \
- t-toom52 t-toom53 t-toom54 t-toom62 t-toom63 t-toom6h t-toom8h \
- 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-minvert t-sizeinbase
-
-EXTRA_DIST = toom-shared.h toom-sqr-shared.h
+check_PROGRAMS = t-asmtype t-aors_1 t-divrem_1 t-fat t-get_d \
+ t-instrument t-iord_u t-mp_bases t-perfsqr t-scan t-hgcd t-matrix22
TESTS = $(check_PROGRAMS)
diff --git a/gmp/tests/mpn/Makefile.in b/gmp/tests/mpn/Makefile.in
index 5db22d4f0c..341256217b 100644
--- a/gmp/tests/mpn/Makefile.in
+++ b/gmp/tests/mpn/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,45 +14,33 @@
@SET_MAKE@
-# Copyright 2001-2003, 2009-2014 Free Software Foundation, Inc.
+# Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = t-aors_1.c t-asmtype.c t-divrem_1.c t-fat.c t-get_d.c t-hgcd.c t-instrument.c t-iord_u.c t-matrix22.c t-mp_bases.c t-perfsqr.c t-scan.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,301 +52,102 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
check_PROGRAMS = t-asmtype$(EXEEXT) t-aors_1$(EXEEXT) \
- t-divrem_1$(EXEEXT) t-mod_1$(EXEEXT) t-fat$(EXEEXT) \
- t-get_d$(EXEEXT) t-instrument$(EXEEXT) t-iord_u$(EXEEXT) \
- t-mp_bases$(EXEEXT) t-perfsqr$(EXEEXT) t-scan$(EXEEXT) \
- logic$(EXEEXT) t-toom22$(EXEEXT) t-toom32$(EXEEXT) \
- t-toom33$(EXEEXT) t-toom42$(EXEEXT) t-toom43$(EXEEXT) \
- t-toom44$(EXEEXT) t-toom52$(EXEEXT) t-toom53$(EXEEXT) \
- t-toom54$(EXEEXT) t-toom62$(EXEEXT) t-toom63$(EXEEXT) \
- t-toom6h$(EXEEXT) t-toom8h$(EXEEXT) t-toom2-sqr$(EXEEXT) \
- t-toom3-sqr$(EXEEXT) t-toom4-sqr$(EXEEXT) t-toom6-sqr$(EXEEXT) \
- t-toom8-sqr$(EXEEXT) t-mul$(EXEEXT) t-mullo$(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-minvert$(EXEEXT) t-sizeinbase$(EXEEXT)
+ t-divrem_1$(EXEEXT) t-fat$(EXEEXT) t-get_d$(EXEEXT) \
+ t-instrument$(EXEEXT) t-iord_u$(EXEEXT) t-mp_bases$(EXEEXT) \
+ t-perfsqr$(EXEEXT) t-scan$(EXEEXT) t-hgcd$(EXEEXT) \
+ t-matrix22$(EXEEXT)
subdir = tests/mpn
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-logic_SOURCES = logic.c
-logic_OBJECTS = logic.$(OBJEXT)
-logic_LDADD = $(LDADD)
-logic_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_aors_1_SOURCES = t-aors_1.c
-t_aors_1_OBJECTS = t-aors_1.$(OBJEXT)
+t_aors_1_OBJECTS = t-aors_1$U.$(OBJEXT)
t_aors_1_LDADD = $(LDADD)
t_aors_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_asmtype_SOURCES = t-asmtype.c
-t_asmtype_OBJECTS = t-asmtype.$(OBJEXT)
+t_asmtype_OBJECTS = t-asmtype$U.$(OBJEXT)
t_asmtype_LDADD = $(LDADD)
t_asmtype_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_bdiv_SOURCES = t-bdiv.c
-t_bdiv_OBJECTS = t-bdiv.$(OBJEXT)
-t_bdiv_LDADD = $(LDADD)
-t_bdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_broot_SOURCES = t-broot.c
-t_broot_OBJECTS = t-broot.$(OBJEXT)
-t_broot_LDADD = $(LDADD)
-t_broot_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_brootinv_SOURCES = t-brootinv.c
-t_brootinv_OBJECTS = t-brootinv.$(OBJEXT)
-t_brootinv_LDADD = $(LDADD)
-t_brootinv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_div_SOURCES = t-div.c
-t_div_OBJECTS = t-div.$(OBJEXT)
-t_div_LDADD = $(LDADD)
-t_div_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_divrem_1_SOURCES = t-divrem_1.c
-t_divrem_1_OBJECTS = t-divrem_1.$(OBJEXT)
+t_divrem_1_OBJECTS = t-divrem_1$U.$(OBJEXT)
t_divrem_1_LDADD = $(LDADD)
t_divrem_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_fat_SOURCES = t-fat.c
-t_fat_OBJECTS = t-fat.$(OBJEXT)
+t_fat_OBJECTS = t-fat$U.$(OBJEXT)
t_fat_LDADD = $(LDADD)
t_fat_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_d_SOURCES = t-get_d.c
-t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_OBJECTS = t-get_d$U.$(OBJEXT)
t_get_d_LDADD = $(LDADD)
t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_hgcd_SOURCES = t-hgcd.c
-t_hgcd_OBJECTS = t-hgcd.$(OBJEXT)
+t_hgcd_OBJECTS = t-hgcd$U.$(OBJEXT)
t_hgcd_LDADD = $(LDADD)
t_hgcd_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_hgcd_appr_SOURCES = t-hgcd_appr.c
-t_hgcd_appr_OBJECTS = t-hgcd_appr.$(OBJEXT)
-t_hgcd_appr_LDADD = $(LDADD)
-t_hgcd_appr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_instrument_SOURCES = t-instrument.c
-t_instrument_OBJECTS = t-instrument.$(OBJEXT)
+t_instrument_OBJECTS = t-instrument$U.$(OBJEXT)
t_instrument_LDADD = $(LDADD)
t_instrument_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_invert_SOURCES = t-invert.c
-t_invert_OBJECTS = t-invert.$(OBJEXT)
-t_invert_LDADD = $(LDADD)
-t_invert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_iord_u_SOURCES = t-iord_u.c
-t_iord_u_OBJECTS = t-iord_u.$(OBJEXT)
+t_iord_u_OBJECTS = t-iord_u$U.$(OBJEXT)
t_iord_u_LDADD = $(LDADD)
t_iord_u_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_matrix22_SOURCES = t-matrix22.c
-t_matrix22_OBJECTS = t-matrix22.$(OBJEXT)
+t_matrix22_OBJECTS = t-matrix22$U.$(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)
-t_mod_1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_mp_bases_SOURCES = t-mp_bases.c
-t_mp_bases_OBJECTS = t-mp_bases.$(OBJEXT)
+t_mp_bases_OBJECTS = t-mp_bases$U.$(OBJEXT)
t_mp_bases_LDADD = $(LDADD)
t_mp_bases_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_mul_SOURCES = t-mul.c
-t_mul_OBJECTS = t-mul.$(OBJEXT)
-t_mul_LDADD = $(LDADD)
-t_mul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_mullo_SOURCES = t-mullo.c
-t_mullo_OBJECTS = t-mullo.$(OBJEXT)
-t_mullo_LDADD = $(LDADD)
-t_mullo_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_mulmid_SOURCES = t-mulmid.c
-t_mulmid_OBJECTS = t-mulmid.$(OBJEXT)
-t_mulmid_LDADD = $(LDADD)
-t_mulmid_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_mulmod_bnm1_SOURCES = t-mulmod_bnm1.c
-t_mulmod_bnm1_OBJECTS = t-mulmod_bnm1.$(OBJEXT)
-t_mulmod_bnm1_LDADD = $(LDADD)
-t_mulmod_bnm1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_perfsqr_SOURCES = t-perfsqr.c
-t_perfsqr_OBJECTS = t-perfsqr.$(OBJEXT)
+t_perfsqr_OBJECTS = t-perfsqr$U.$(OBJEXT)
t_perfsqr_LDADD = $(LDADD)
t_perfsqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_scan_SOURCES = t-scan.c
-t_scan_OBJECTS = t-scan.$(OBJEXT)
+t_scan_OBJECTS = t-scan$U.$(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)
-t_sqrmod_bnm1_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom2_sqr_SOURCES = t-toom2-sqr.c
-t_toom2_sqr_OBJECTS = t-toom2-sqr.$(OBJEXT)
-t_toom2_sqr_LDADD = $(LDADD)
-t_toom2_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom22_SOURCES = t-toom22.c
-t_toom22_OBJECTS = t-toom22.$(OBJEXT)
-t_toom22_LDADD = $(LDADD)
-t_toom22_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom3_sqr_SOURCES = t-toom3-sqr.c
-t_toom3_sqr_OBJECTS = t-toom3-sqr.$(OBJEXT)
-t_toom3_sqr_LDADD = $(LDADD)
-t_toom3_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom32_SOURCES = t-toom32.c
-t_toom32_OBJECTS = t-toom32.$(OBJEXT)
-t_toom32_LDADD = $(LDADD)
-t_toom32_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom33_SOURCES = t-toom33.c
-t_toom33_OBJECTS = t-toom33.$(OBJEXT)
-t_toom33_LDADD = $(LDADD)
-t_toom33_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom4_sqr_SOURCES = t-toom4-sqr.c
-t_toom4_sqr_OBJECTS = t-toom4-sqr.$(OBJEXT)
-t_toom4_sqr_LDADD = $(LDADD)
-t_toom4_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom42_SOURCES = t-toom42.c
-t_toom42_OBJECTS = t-toom42.$(OBJEXT)
-t_toom42_LDADD = $(LDADD)
-t_toom42_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom43_SOURCES = t-toom43.c
-t_toom43_OBJECTS = t-toom43.$(OBJEXT)
-t_toom43_LDADD = $(LDADD)
-t_toom43_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom44_SOURCES = t-toom44.c
-t_toom44_OBJECTS = t-toom44.$(OBJEXT)
-t_toom44_LDADD = $(LDADD)
-t_toom44_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom52_SOURCES = t-toom52.c
-t_toom52_OBJECTS = t-toom52.$(OBJEXT)
-t_toom52_LDADD = $(LDADD)
-t_toom52_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom53_SOURCES = t-toom53.c
-t_toom53_OBJECTS = t-toom53.$(OBJEXT)
-t_toom53_LDADD = $(LDADD)
-t_toom53_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom54_SOURCES = t-toom54.c
-t_toom54_OBJECTS = t-toom54.$(OBJEXT)
-t_toom54_LDADD = $(LDADD)
-t_toom54_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom6_sqr_SOURCES = t-toom6-sqr.c
-t_toom6_sqr_OBJECTS = t-toom6-sqr.$(OBJEXT)
-t_toom6_sqr_LDADD = $(LDADD)
-t_toom6_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom62_SOURCES = t-toom62.c
-t_toom62_OBJECTS = t-toom62.$(OBJEXT)
-t_toom62_LDADD = $(LDADD)
-t_toom62_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom63_SOURCES = t-toom63.c
-t_toom63_OBJECTS = t-toom63.$(OBJEXT)
-t_toom63_LDADD = $(LDADD)
-t_toom63_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom6h_SOURCES = t-toom6h.c
-t_toom6h_OBJECTS = t-toom6h.$(OBJEXT)
-t_toom6h_LDADD = $(LDADD)
-t_toom6h_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom8_sqr_SOURCES = t-toom8-sqr.c
-t_toom8_sqr_OBJECTS = t-toom8-sqr.$(OBJEXT)
-t_toom8_sqr_LDADD = $(LDADD)
-t_toom8_sqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_toom8h_SOURCES = t-toom8h.c
-t_toom8h_OBJECTS = t-toom8h.$(OBJEXT)
-t_toom8h_LDADD = $(LDADD)
-t_toom8h_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-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-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-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;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = t-aors_1.c t-asmtype.c t-divrem_1.c t-fat.c t-get_d.c \
+ t-hgcd.c t-instrument.c t-iord_u.c t-matrix22.c t-mp_bases.c \
+ t-perfsqr.c t-scan.c
+DIST_SOURCES = t-aors_1.c t-asmtype.c t-divrem_1.c t-fat.c t-get_d.c \
+ t-hgcd.c t-instrument.c t-iord_u.c t-matrix22.c t-mp_bases.c \
+ t-perfsqr.c t-scan.c
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -371,6 +159,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -386,17 +175,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -410,12 +198,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -430,26 +216,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -459,31 +239,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -507,6 +282,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -514,15 +290,10 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
-EXTRA_DIST = toom-shared.h toom-sqr-shared.h
TESTS = $(check_PROGRAMS)
all: all-am
@@ -532,14 +303,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpn/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -557,157 +328,60 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES) $(EXTRA_logic_DEPENDENCIES)
- @rm -f logic$(EXEEXT)
- $(LINK) $(logic_OBJECTS) $(logic_LDADD) $(LIBS)
-t-aors_1$(EXEEXT): $(t_aors_1_OBJECTS) $(t_aors_1_DEPENDENCIES) $(EXTRA_t_aors_1_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+t-aors_1$(EXEEXT): $(t_aors_1_OBJECTS) $(t_aors_1_DEPENDENCIES)
@rm -f t-aors_1$(EXEEXT)
- $(LINK) $(t_aors_1_OBJECTS) $(t_aors_1_LDADD) $(LIBS)
-t-asmtype$(EXEEXT): $(t_asmtype_OBJECTS) $(t_asmtype_DEPENDENCIES) $(EXTRA_t_asmtype_DEPENDENCIES)
+ $(LINK) $(t_aors_1_LDFLAGS) $(t_aors_1_OBJECTS) $(t_aors_1_LDADD) $(LIBS)
+t-asmtype$(EXEEXT): $(t_asmtype_OBJECTS) $(t_asmtype_DEPENDENCIES)
@rm -f t-asmtype$(EXEEXT)
- $(LINK) $(t_asmtype_OBJECTS) $(t_asmtype_LDADD) $(LIBS)
-t-bdiv$(EXEEXT): $(t_bdiv_OBJECTS) $(t_bdiv_DEPENDENCIES) $(EXTRA_t_bdiv_DEPENDENCIES)
- @rm -f t-bdiv$(EXEEXT)
- $(LINK) $(t_bdiv_OBJECTS) $(t_bdiv_LDADD) $(LIBS)
-t-broot$(EXEEXT): $(t_broot_OBJECTS) $(t_broot_DEPENDENCIES) $(EXTRA_t_broot_DEPENDENCIES)
- @rm -f t-broot$(EXEEXT)
- $(LINK) $(t_broot_OBJECTS) $(t_broot_LDADD) $(LIBS)
-t-brootinv$(EXEEXT): $(t_brootinv_OBJECTS) $(t_brootinv_DEPENDENCIES) $(EXTRA_t_brootinv_DEPENDENCIES)
- @rm -f t-brootinv$(EXEEXT)
- $(LINK) $(t_brootinv_OBJECTS) $(t_brootinv_LDADD) $(LIBS)
-t-div$(EXEEXT): $(t_div_OBJECTS) $(t_div_DEPENDENCIES) $(EXTRA_t_div_DEPENDENCIES)
- @rm -f t-div$(EXEEXT)
- $(LINK) $(t_div_OBJECTS) $(t_div_LDADD) $(LIBS)
-t-divrem_1$(EXEEXT): $(t_divrem_1_OBJECTS) $(t_divrem_1_DEPENDENCIES) $(EXTRA_t_divrem_1_DEPENDENCIES)
+ $(LINK) $(t_asmtype_LDFLAGS) $(t_asmtype_OBJECTS) $(t_asmtype_LDADD) $(LIBS)
+t-divrem_1$(EXEEXT): $(t_divrem_1_OBJECTS) $(t_divrem_1_DEPENDENCIES)
@rm -f t-divrem_1$(EXEEXT)
- $(LINK) $(t_divrem_1_OBJECTS) $(t_divrem_1_LDADD) $(LIBS)
-t-fat$(EXEEXT): $(t_fat_OBJECTS) $(t_fat_DEPENDENCIES) $(EXTRA_t_fat_DEPENDENCIES)
+ $(LINK) $(t_divrem_1_LDFLAGS) $(t_divrem_1_OBJECTS) $(t_divrem_1_LDADD) $(LIBS)
+t-fat$(EXEEXT): $(t_fat_OBJECTS) $(t_fat_DEPENDENCIES)
@rm -f t-fat$(EXEEXT)
- $(LINK) $(t_fat_OBJECTS) $(t_fat_LDADD) $(LIBS)
-t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ $(LINK) $(t_fat_LDFLAGS) $(t_fat_OBJECTS) $(t_fat_LDADD) $(LIBS)
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES)
@rm -f t-get_d$(EXEEXT)
- $(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
-t-hgcd$(EXEEXT): $(t_hgcd_OBJECTS) $(t_hgcd_DEPENDENCIES) $(EXTRA_t_hgcd_DEPENDENCIES)
+ $(LINK) $(t_get_d_LDFLAGS) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+t-hgcd$(EXEEXT): $(t_hgcd_OBJECTS) $(t_hgcd_DEPENDENCIES)
@rm -f t-hgcd$(EXEEXT)
- $(LINK) $(t_hgcd_OBJECTS) $(t_hgcd_LDADD) $(LIBS)
-t-hgcd_appr$(EXEEXT): $(t_hgcd_appr_OBJECTS) $(t_hgcd_appr_DEPENDENCIES) $(EXTRA_t_hgcd_appr_DEPENDENCIES)
- @rm -f t-hgcd_appr$(EXEEXT)
- $(LINK) $(t_hgcd_appr_OBJECTS) $(t_hgcd_appr_LDADD) $(LIBS)
-t-instrument$(EXEEXT): $(t_instrument_OBJECTS) $(t_instrument_DEPENDENCIES) $(EXTRA_t_instrument_DEPENDENCIES)
+ $(LINK) $(t_hgcd_LDFLAGS) $(t_hgcd_OBJECTS) $(t_hgcd_LDADD) $(LIBS)
+t-instrument$(EXEEXT): $(t_instrument_OBJECTS) $(t_instrument_DEPENDENCIES)
@rm -f t-instrument$(EXEEXT)
- $(LINK) $(t_instrument_OBJECTS) $(t_instrument_LDADD) $(LIBS)
-t-invert$(EXEEXT): $(t_invert_OBJECTS) $(t_invert_DEPENDENCIES) $(EXTRA_t_invert_DEPENDENCIES)
- @rm -f t-invert$(EXEEXT)
- $(LINK) $(t_invert_OBJECTS) $(t_invert_LDADD) $(LIBS)
-t-iord_u$(EXEEXT): $(t_iord_u_OBJECTS) $(t_iord_u_DEPENDENCIES) $(EXTRA_t_iord_u_DEPENDENCIES)
+ $(LINK) $(t_instrument_LDFLAGS) $(t_instrument_OBJECTS) $(t_instrument_LDADD) $(LIBS)
+t-iord_u$(EXEEXT): $(t_iord_u_OBJECTS) $(t_iord_u_DEPENDENCIES)
@rm -f t-iord_u$(EXEEXT)
- $(LINK) $(t_iord_u_OBJECTS) $(t_iord_u_LDADD) $(LIBS)
-t-matrix22$(EXEEXT): $(t_matrix22_OBJECTS) $(t_matrix22_DEPENDENCIES) $(EXTRA_t_matrix22_DEPENDENCIES)
+ $(LINK) $(t_iord_u_LDFLAGS) $(t_iord_u_OBJECTS) $(t_iord_u_LDADD) $(LIBS)
+t-matrix22$(EXEEXT): $(t_matrix22_OBJECTS) $(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)
-t-mp_bases$(EXEEXT): $(t_mp_bases_OBJECTS) $(t_mp_bases_DEPENDENCIES) $(EXTRA_t_mp_bases_DEPENDENCIES)
+ $(LINK) $(t_matrix22_LDFLAGS) $(t_matrix22_OBJECTS) $(t_matrix22_LDADD) $(LIBS)
+t-mp_bases$(EXEEXT): $(t_mp_bases_OBJECTS) $(t_mp_bases_DEPENDENCIES)
@rm -f t-mp_bases$(EXEEXT)
- $(LINK) $(t_mp_bases_OBJECTS) $(t_mp_bases_LDADD) $(LIBS)
-t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES) $(EXTRA_t_mul_DEPENDENCIES)
- @rm -f t-mul$(EXEEXT)
- $(LINK) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS)
-t-mullo$(EXEEXT): $(t_mullo_OBJECTS) $(t_mullo_DEPENDENCIES) $(EXTRA_t_mullo_DEPENDENCIES)
- @rm -f t-mullo$(EXEEXT)
- $(LINK) $(t_mullo_OBJECTS) $(t_mullo_LDADD) $(LIBS)
-t-mulmid$(EXEEXT): $(t_mulmid_OBJECTS) $(t_mulmid_DEPENDENCIES) $(EXTRA_t_mulmid_DEPENDENCIES)
- @rm -f t-mulmid$(EXEEXT)
- $(LINK) $(t_mulmid_OBJECTS) $(t_mulmid_LDADD) $(LIBS)
-t-mulmod_bnm1$(EXEEXT): $(t_mulmod_bnm1_OBJECTS) $(t_mulmod_bnm1_DEPENDENCIES) $(EXTRA_t_mulmod_bnm1_DEPENDENCIES)
- @rm -f t-mulmod_bnm1$(EXEEXT)
- $(LINK) $(t_mulmod_bnm1_OBJECTS) $(t_mulmod_bnm1_LDADD) $(LIBS)
-t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) $(EXTRA_t_perfsqr_DEPENDENCIES)
+ $(LINK) $(t_mp_bases_LDFLAGS) $(t_mp_bases_OBJECTS) $(t_mp_bases_LDADD) $(LIBS)
+t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES)
@rm -f t-perfsqr$(EXEEXT)
- $(LINK) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS)
-t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) $(EXTRA_t_scan_DEPENDENCIES)
+ $(LINK) $(t_perfsqr_LDFLAGS) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS)
+t-scan$(EXEEXT): $(t_scan_OBJECTS) $(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)
-t-toom2-sqr$(EXEEXT): $(t_toom2_sqr_OBJECTS) $(t_toom2_sqr_DEPENDENCIES) $(EXTRA_t_toom2_sqr_DEPENDENCIES)
- @rm -f t-toom2-sqr$(EXEEXT)
- $(LINK) $(t_toom2_sqr_OBJECTS) $(t_toom2_sqr_LDADD) $(LIBS)
-t-toom22$(EXEEXT): $(t_toom22_OBJECTS) $(t_toom22_DEPENDENCIES) $(EXTRA_t_toom22_DEPENDENCIES)
- @rm -f t-toom22$(EXEEXT)
- $(LINK) $(t_toom22_OBJECTS) $(t_toom22_LDADD) $(LIBS)
-t-toom3-sqr$(EXEEXT): $(t_toom3_sqr_OBJECTS) $(t_toom3_sqr_DEPENDENCIES) $(EXTRA_t_toom3_sqr_DEPENDENCIES)
- @rm -f t-toom3-sqr$(EXEEXT)
- $(LINK) $(t_toom3_sqr_OBJECTS) $(t_toom3_sqr_LDADD) $(LIBS)
-t-toom32$(EXEEXT): $(t_toom32_OBJECTS) $(t_toom32_DEPENDENCIES) $(EXTRA_t_toom32_DEPENDENCIES)
- @rm -f t-toom32$(EXEEXT)
- $(LINK) $(t_toom32_OBJECTS) $(t_toom32_LDADD) $(LIBS)
-t-toom33$(EXEEXT): $(t_toom33_OBJECTS) $(t_toom33_DEPENDENCIES) $(EXTRA_t_toom33_DEPENDENCIES)
- @rm -f t-toom33$(EXEEXT)
- $(LINK) $(t_toom33_OBJECTS) $(t_toom33_LDADD) $(LIBS)
-t-toom4-sqr$(EXEEXT): $(t_toom4_sqr_OBJECTS) $(t_toom4_sqr_DEPENDENCIES) $(EXTRA_t_toom4_sqr_DEPENDENCIES)
- @rm -f t-toom4-sqr$(EXEEXT)
- $(LINK) $(t_toom4_sqr_OBJECTS) $(t_toom4_sqr_LDADD) $(LIBS)
-t-toom42$(EXEEXT): $(t_toom42_OBJECTS) $(t_toom42_DEPENDENCIES) $(EXTRA_t_toom42_DEPENDENCIES)
- @rm -f t-toom42$(EXEEXT)
- $(LINK) $(t_toom42_OBJECTS) $(t_toom42_LDADD) $(LIBS)
-t-toom43$(EXEEXT): $(t_toom43_OBJECTS) $(t_toom43_DEPENDENCIES) $(EXTRA_t_toom43_DEPENDENCIES)
- @rm -f t-toom43$(EXEEXT)
- $(LINK) $(t_toom43_OBJECTS) $(t_toom43_LDADD) $(LIBS)
-t-toom44$(EXEEXT): $(t_toom44_OBJECTS) $(t_toom44_DEPENDENCIES) $(EXTRA_t_toom44_DEPENDENCIES)
- @rm -f t-toom44$(EXEEXT)
- $(LINK) $(t_toom44_OBJECTS) $(t_toom44_LDADD) $(LIBS)
-t-toom52$(EXEEXT): $(t_toom52_OBJECTS) $(t_toom52_DEPENDENCIES) $(EXTRA_t_toom52_DEPENDENCIES)
- @rm -f t-toom52$(EXEEXT)
- $(LINK) $(t_toom52_OBJECTS) $(t_toom52_LDADD) $(LIBS)
-t-toom53$(EXEEXT): $(t_toom53_OBJECTS) $(t_toom53_DEPENDENCIES) $(EXTRA_t_toom53_DEPENDENCIES)
- @rm -f t-toom53$(EXEEXT)
- $(LINK) $(t_toom53_OBJECTS) $(t_toom53_LDADD) $(LIBS)
-t-toom54$(EXEEXT): $(t_toom54_OBJECTS) $(t_toom54_DEPENDENCIES) $(EXTRA_t_toom54_DEPENDENCIES)
- @rm -f t-toom54$(EXEEXT)
- $(LINK) $(t_toom54_OBJECTS) $(t_toom54_LDADD) $(LIBS)
-t-toom6-sqr$(EXEEXT): $(t_toom6_sqr_OBJECTS) $(t_toom6_sqr_DEPENDENCIES) $(EXTRA_t_toom6_sqr_DEPENDENCIES)
- @rm -f t-toom6-sqr$(EXEEXT)
- $(LINK) $(t_toom6_sqr_OBJECTS) $(t_toom6_sqr_LDADD) $(LIBS)
-t-toom62$(EXEEXT): $(t_toom62_OBJECTS) $(t_toom62_DEPENDENCIES) $(EXTRA_t_toom62_DEPENDENCIES)
- @rm -f t-toom62$(EXEEXT)
- $(LINK) $(t_toom62_OBJECTS) $(t_toom62_LDADD) $(LIBS)
-t-toom63$(EXEEXT): $(t_toom63_OBJECTS) $(t_toom63_DEPENDENCIES) $(EXTRA_t_toom63_DEPENDENCIES)
- @rm -f t-toom63$(EXEEXT)
- $(LINK) $(t_toom63_OBJECTS) $(t_toom63_LDADD) $(LIBS)
-t-toom6h$(EXEEXT): $(t_toom6h_OBJECTS) $(t_toom6h_DEPENDENCIES) $(EXTRA_t_toom6h_DEPENDENCIES)
- @rm -f t-toom6h$(EXEEXT)
- $(LINK) $(t_toom6h_OBJECTS) $(t_toom6h_LDADD) $(LIBS)
-t-toom8-sqr$(EXEEXT): $(t_toom8_sqr_OBJECTS) $(t_toom8_sqr_DEPENDENCIES) $(EXTRA_t_toom8_sqr_DEPENDENCIES)
- @rm -f t-toom8-sqr$(EXEEXT)
- $(LINK) $(t_toom8_sqr_OBJECTS) $(t_toom8_sqr_LDADD) $(LIBS)
-t-toom8h$(EXEEXT): $(t_toom8h_OBJECTS) $(t_toom8h_DEPENDENCIES) $(EXTRA_t_toom8h_DEPENDENCIES)
- @rm -f t-toom8h$(EXEEXT)
- $(LINK) $(t_toom8h_OBJECTS) $(t_toom8h_LDADD) $(LIBS)
+ $(LINK) $(t_scan_LDFLAGS) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -717,6 +391,37 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+t-aors_1_.c: t-aors_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-aors_1.c; then echo $(srcdir)/t-aors_1.c; else echo t-aors_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-asmtype_.c: t-asmtype.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-asmtype.c; then echo $(srcdir)/t-asmtype.c; else echo t-asmtype.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-divrem_1_.c: t-divrem_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-divrem_1.c; then echo $(srcdir)/t-divrem_1.c; else echo t-divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-fat_.c: t-fat.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fat.c; then echo $(srcdir)/t-fat.c; else echo t-fat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_d_.c: t-get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d.c; then echo $(srcdir)/t-get_d.c; else echo t-get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-hgcd_.c: t-hgcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-hgcd.c; then echo $(srcdir)/t-hgcd.c; else echo t-hgcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-instrument_.c: t-instrument.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-instrument.c; then echo $(srcdir)/t-instrument.c; else echo t-instrument.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-iord_u_.c: t-iord_u.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-iord_u.c; then echo $(srcdir)/t-iord_u.c; else echo t-iord_u.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-matrix22_.c: t-matrix22.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-matrix22.c; then echo $(srcdir)/t-matrix22.c; else echo t-matrix22.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-mp_bases_.c: t-mp_bases.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mp_bases.c; then echo $(srcdir)/t-mp_bases.c; else echo t-mp_bases.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-perfsqr_.c: t-perfsqr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-perfsqr.c; then echo $(srcdir)/t-perfsqr.c; else echo t-perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-scan_.c: t-scan.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-scan.c; then echo $(srcdir)/t-scan.c; else echo t-scan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-aors_1_.$(OBJEXT) t-aors_1_.lo t-asmtype_.$(OBJEXT) t-asmtype_.lo \
+t-divrem_1_.$(OBJEXT) t-divrem_1_.lo t-fat_.$(OBJEXT) t-fat_.lo \
+t-get_d_.$(OBJEXT) t-get_d_.lo t-hgcd_.$(OBJEXT) t-hgcd_.lo \
+t-instrument_.$(OBJEXT) t-instrument_.lo t-iord_u_.$(OBJEXT) \
+t-iord_u_.lo t-matrix22_.$(OBJEXT) t-matrix22_.lo \
+t-mp_bases_.$(OBJEXT) t-mp_bases_.lo t-perfsqr_.$(OBJEXT) \
+t-perfsqr_.lo t-scan_.$(OBJEXT) t-scan_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -724,54 +429,54 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -779,8 +484,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -789,113 +493,91 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -915,22 +597,16 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -943,7 +619,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -951,38 +627,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -991,7 +647,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -1002,28 +658,23 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/mpn/logic.c b/gmp/tests/mpn/logic.c
deleted file mode 100644
index 75b5dca1fc..0000000000
--- a/gmp/tests/mpn/logic.c
+++ /dev/null
@@ -1,134 +0,0 @@
-/* Test mpn_and, mpn_ior, mpn_xor, mpn_andn, mpn_iorn, mpn_xnor, mpn_nand, and
- mpn_nior.
-
-Copyright 2011-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>
-
-/* Fake native prevalence of the tested operations, so that we actually test
- the compiled functions, i.e., the ones which users will reach. The inlined
- variants will be tested through tests/mpz/logic.c. */
-#define HAVE_NATIVE_mpn_com 1
-#define HAVE_NATIVE_mpn_and_n 1
-#define HAVE_NATIVE_mpn_andn_n 1
-#define HAVE_NATIVE_mpn_nand_n 1
-#define HAVE_NATIVE_mpn_ior_n 1
-#define HAVE_NATIVE_mpn_iorn_n 1
-#define HAVE_NATIVE_mpn_nior_n 1
-#define HAVE_NATIVE_mpn_xor_n 1
-#define HAVE_NATIVE_mpn_xnor_n 1
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-
-void
-check_one (mp_srcptr refp, mp_srcptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n, char *funcname)
-{
- if (mpn_cmp (refp, rp, n))
- {
- printf ("ERROR in mpn_%s\n", funcname);
- printf ("a: "); mpn_dump (ap, n);
- printf ("b: "); mpn_dump (bp, n);
- printf ("r: "); mpn_dump (rp, n);
- printf ("ref: "); mpn_dump (refp, n);
- abort();
- }
-}
-
-int
-main (int argc, char **argv)
-{
- mpz_t a, b;
- mp_ptr ap, bp, rp, refp;
- mp_size_t max_n, n, i;
- gmp_randstate_ptr rands;
- long test, reps = 1000;
- TMP_SDECL;
- TMP_SMARK;
-
- tests_start ();
- TESTS_REPS (reps, argv, argc);
-
- mpz_inits (a, b, NULL);
-
- rands = RANDS; /* FIXME: not used */
-
- 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 (i = 1; i <= max_n; i++)
- {
- 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);
- check_one (refp, rp, ap, bp, n, "and_n");
-
- refmpn_ior_n (refp, ap, bp, n);
- mpn_ior_n (rp, ap, bp, n);
- check_one (refp, rp, ap, bp, n, "ior_n");
-
- refmpn_xor_n (refp, ap, bp, n);
- mpn_xor_n (rp, ap, bp, n);
- check_one (refp, rp, ap, bp, n, "xor_n");
-
- refmpn_andn_n (refp, ap, bp, n);
- mpn_andn_n (rp, ap, bp, n);
- check_one (refp, rp, ap, bp, n, "andn_n");
-
- refmpn_iorn_n (refp, ap, bp, n);
- mpn_iorn_n (rp, ap, bp, n);
- check_one (refp, rp, ap, bp, n, "iorn_n");
-
- refmpn_nand_n (refp, ap, bp, n);
- mpn_nand_n (rp, ap, bp, n);
- check_one (refp, rp, ap, bp, n, "nand_n");
-
- refmpn_nior_n (refp, ap, bp, n);
- mpn_nior_n (rp, ap, bp, n);
- check_one (refp, rp, ap, bp, n, "nior_n");
-
- refmpn_xnor_n (refp, ap, bp, n);
- mpn_xnor_n (rp, ap, bp, n);
- check_one (refp, rp, ap, bp, n, "xnor_n");
-
- refmpn_com (refp, ap, n);
- mpn_com (rp, ap, n);
- check_one (refp, rp, ap, bp, n, "com");
- }
- }
-
- TMP_SFREE;
- mpz_clears (a, b, NULL);
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-aors_1.c b/gmp/tests/mpn/t-aors_1.c
index 6a946f2d57..a1878bb845 100644
--- a/gmp/tests/mpn/t-aors_1.c
+++ b/gmp/tests/mpn/t-aors_1.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -48,8 +48,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
got, data[i].want, data[i].size); \
} while (0)
-typedef mp_limb_t (*mpn_aors_1_t) (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mpn_aors_1_t fudge (mpn_aors_1_t);
+typedef mp_limb_t (*mpn_aors_1_t)
+ __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_limb_t));
+mpn_aors_1_t fudge __GMP_PROTO ((mpn_aors_1_t));
void
@@ -133,8 +134,6 @@ 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++)
@@ -147,16 +146,6 @@ 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 ();
@@ -166,16 +155,6 @@ 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. */
@@ -234,8 +213,6 @@ 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++)
@@ -248,16 +225,6 @@ 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 ();
@@ -267,16 +234,6 @@ 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. */
diff --git a/gmp/tests/mpn/t-asmtype.c b/gmp/tests/mpn/t-asmtype.c
index 93960f7aef..4ee5a7ab2f 100644
--- a/gmp/tests/mpn/t-asmtype.c
+++ b/gmp/tests/mpn/t-asmtype.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpn/t-bdiv.c b/gmp/tests/mpn/t-bdiv.c
deleted file mode 100644
index 0056ca9e38..0000000000
--- a/gmp/tests/mpn/t-bdiv.c
+++ /dev/null
@@ -1,368 +0,0 @@
-/* Copyright 2006, 2007, 2009, 2010 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> /* for strtol */
-#include <stdio.h> /* for printf */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-#include "tests/tests.h"
-
-
-static void
-dumpy (mp_srcptr p, mp_size_t n)
-{
- mp_size_t i;
- if (n > 20)
- {
- for (i = n - 1; i >= n - 4; i--)
- {
- printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
- printf (" ");
- }
- printf ("... ");
- for (i = 3; i >= 0; i--)
- {
- printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
- printf (" " + (i == 0));
- }
- }
- else
- {
- for (i = n - 1; i >= 0; i--)
- {
- printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
- printf (" " + (i == 0));
- }
- }
- puts ("");
-}
-
-static unsigned long test;
-
-void
-check_one (mp_ptr qp, mp_srcptr rp, mp_limb_t rh,
- mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn, const char *fname)
-{
- mp_size_t qn;
- int cmp;
- mp_ptr tp;
- mp_limb_t cy = 4711; /* silence warnings */
- TMP_DECL;
-
- qn = nn - dn;
-
- if (qn == 0)
- return;
-
- TMP_MARK;
-
- tp = TMP_ALLOC_LIMBS (nn + 1);
-
- if (dn >= qn)
- mpn_mul (tp, dp, dn, qp, qn);
- else
- mpn_mul (tp, qp, qn, dp, dn);
-
- if (rp != NULL)
- {
- cy = mpn_add_n (tp + qn, tp + qn, rp, dn);
- cmp = cy != rh || mpn_cmp (tp, np, nn) != 0;
- }
- else
- cmp = mpn_cmp (tp, np, nn - dn) != 0;
-
- if (cmp != 0)
- {
- printf ("\r*******************************************************************************\n");
- printf ("%s inconsistent in test %lu\n", fname, test);
- printf ("N= "); dumpy (np, nn);
- printf ("D= "); dumpy (dp, dn);
- printf ("Q= "); dumpy (qp, qn);
- if (rp != NULL)
- {
- printf ("R= "); dumpy (rp, dn);
- printf ("Rb= %d, Cy=%d\n", (int) cy, (int) rh);
- }
- printf ("T= "); dumpy (tp, nn);
- printf ("nn = %ld, dn = %ld, qn = %ld", nn, dn, qn);
- printf ("\n*******************************************************************************\n");
- abort ();
- }
-
- TMP_FREE;
-}
-
-
-/* These are *bit* sizes. */
-#define SIZE_LOG 16
-#define MAX_DN (1L << SIZE_LOG)
-#define MAX_NN (1L << (SIZE_LOG + 1))
-
-#define COUNT 500
-
-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)
-{
- gmp_randstate_ptr rands;
- unsigned long maxnbits, maxdbits, nbits, dbits;
- mpz_t n, d, tz;
- mp_size_t maxnn, maxdn, nn, dn, clearn, i;
- mp_ptr np, dp, qp, rp;
- mp_limb_t rh;
- mp_limb_t t;
- mp_limb_t dinv;
- int count = COUNT;
- mp_ptr scratch;
- mp_limb_t ran;
- mp_size_t alloc, itch;
- mp_limb_t rran0, rran1, qran0, qran1;
- 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;
- }
- }
-
-
- maxdbits = MAX_DN;
- maxnbits = MAX_NN;
-
- tests_start ();
- rands = RANDS;
-
- mpz_init (n);
- mpz_init (d);
- mpz_init (tz);
-
- maxnn = maxnbits / GMP_NUMB_BITS + 1;
- maxdn = maxdbits / GMP_NUMB_BITS + 1;
-
- TMP_MARK;
-
- qp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
- rp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
-
- alloc = 1;
- scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc);
-
- for (test = 0; test < count;)
- {
- nbits = random_word (rands) % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
- if (maxdbits > nbits)
- dbits = random_word (rands) % nbits + 1;
- else
- dbits = random_word (rands) % maxdbits + 1;
-
-#if RAND_UNIFORM
-#define RANDFUNC mpz_urandomb
-#else
-#define RANDFUNC mpz_rrandomb
-#endif
-
- do
- {
- RANDFUNC (n, rands, nbits);
- do
- {
- RANDFUNC (d, rands, dbits);
- }
- while (mpz_sgn (d) == 0);
-
- np = PTR (n);
- dp = PTR (d);
- nn = SIZ (n);
- dn = SIZ (d);
- }
- while (nn < dn);
-
- dp[0] |= 1;
-
- mpz_urandomb (tz, rands, 32);
- t = mpz_get_ui (tz);
-
- if (t % 17 == 0)
- dp[0] = GMP_NUMB_MAX;
-
- switch ((int) t % 16)
- {
- case 0:
- clearn = random_word (rands) % nn;
- for (i = 0; i <= clearn; i++)
- np[i] = 0;
- break;
- case 1:
- mpn_sub_1 (np + nn - dn, dp, dn, random_word (rands));
- break;
- case 2:
- mpn_add_1 (np + nn - dn, dp, dn, random_word (rands));
- break;
- }
-
- test++;
-
- binvert_limb (dinv, dp[0]);
-
- rran0 = random_word (rands);
- rran1 = random_word (rands);
- qran0 = random_word (rands);
- qran1 = random_word (rands);
-
- qp[-1] = qran0;
- qp[nn - dn + 1] = qran1;
- rp[-1] = rran0;
-
- ran = random_word (rands);
-
- if ((double) (nn - dn) * dn < 1e5)
- {
- if (nn > dn)
- {
- /* Test mpn_sbpi1_bdiv_qr */
- MPN_ZERO (qp, nn - dn);
- MPN_ZERO (rp, dn);
- MPN_COPY (rp, np, nn);
- rh = mpn_sbpi1_bdiv_qr (qp, rp, nn, dp, dn, -dinv);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0);
- check_one (qp, rp + nn - dn, rh, np, nn, dp, dn, "mpn_sbpi1_bdiv_qr");
- }
-
- if (nn > dn)
- {
- /* Test mpn_sbpi1_bdiv_q */
- MPN_COPY (rp, np, nn);
- MPN_ZERO (qp, nn - dn);
- mpn_sbpi1_bdiv_q (qp, rp, nn - dn, dp, MIN(dn,nn-dn), -dinv);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0);
- check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_sbpi1_bdiv_q");
- }
- }
-
- if (dn >= 4 && nn - dn >= 2)
- {
- /* Test mpn_dcpi1_bdiv_qr */
- MPN_COPY (rp, np, nn);
- MPN_ZERO (qp, nn - dn);
- rh = mpn_dcpi1_bdiv_qr (qp, rp, nn, dp, dn, -dinv);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0);
- check_one (qp, rp + nn - dn, rh, np, nn, dp, dn, "mpn_dcpi1_bdiv_qr");
- }
-
- if (dn >= 4 && nn - dn >= 2)
- {
- /* Test mpn_dcpi1_bdiv_q */
- MPN_COPY (rp, np, nn);
- MPN_ZERO (qp, nn - dn);
- mpn_dcpi1_bdiv_q (qp, rp, nn - dn, dp, MIN(dn,nn-dn), -dinv);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0);
- check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_dcpi1_bdiv_q");
- }
-
- if (nn > dn)
- {
- /* Test mpn_bdiv_qr */
- itch = mpn_bdiv_qr_itch (nn, dn);
- if (itch + 1 > alloc)
- {
- scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- MPN_ZERO (qp, nn - dn);
- MPN_ZERO (rp, dn);
- rp[dn] = rran1;
- rh = mpn_bdiv_qr (qp, rp, np, nn, dp, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1);
-
- check_one (qp, rp, rh, np, nn, dp, dn, "mpn_bdiv_qr");
- }
-
- if (nn - dn < 2 || dn < 2)
- continue;
-
- /* Test mpn_mu_bdiv_qr */
- itch = mpn_mu_bdiv_qr_itch (nn, dn);
- if (itch + 1 > alloc)
- {
- scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- MPN_ZERO (qp, nn - dn);
- MPN_ZERO (rp, dn);
- rp[dn] = rran1;
- rh = mpn_mu_bdiv_qr (qp, rp, np, nn, dp, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1);
- check_one (qp, rp, rh, np, nn, dp, dn, "mpn_mu_bdiv_qr");
-
- /* Test mpn_mu_bdiv_q */
- itch = mpn_mu_bdiv_q_itch (nn, dn);
- if (itch + 1 > alloc)
- {
- scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- MPN_ZERO (qp, nn - dn + 1);
- mpn_mu_bdiv_q (qp, np, nn - dn, dp, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- check_one (qp, NULL, 0, np, nn, dp, dn, "mpn_mu_bdiv_q");
- }
-
- __GMP_FREE_FUNC_LIMBS (scratch, alloc);
-
- TMP_FREE;
-
- mpz_clear (n);
- mpz_clear (d);
- mpz_clear (tz);
-
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-broot.c b/gmp/tests/mpn/t-broot.c
deleted file mode 100644
index 1aa43319ec..0000000000
--- a/gmp/tests/mpn/t-broot.c
+++ /dev/null
@@ -1,105 +0,0 @@
-/* Copyright 2012 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> /* for strtol */
-#include <stdio.h> /* for printf */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-#include "tests/tests.h"
-
-#define MAX_LIMBS 150
-#define COUNT 500
-
-int
-main (int argc, char **argv)
-{
- gmp_randstate_ptr rands;
-
- mp_ptr ap, rp, pp, scratch;
- int count = COUNT;
- unsigned i;
- TMP_DECL;
-
- TMP_MARK;
-
- 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 ();
- rands = RANDS;
-
- ap = TMP_ALLOC_LIMBS (MAX_LIMBS);
- rp = TMP_ALLOC_LIMBS (MAX_LIMBS);
- pp = TMP_ALLOC_LIMBS (MAX_LIMBS);
- scratch = TMP_ALLOC_LIMBS (3*MAX_LIMBS); /* For mpn_powlo */
-
- for (i = 0; i < count; i++)
- {
- mp_size_t n;
- mp_limb_t k;
- int c;
-
- n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS);
-
- if (i & 1)
- mpn_random2 (ap, n);
- else
- mpn_random (ap, n);
-
- ap[0] |= 1;
-
- if (i < 100)
- k = 3 + 2*i;
- else
- {
- mpn_random (&k, 1);
- if (k < 3)
- k = 3;
- else
- k |= 1;
- }
- mpn_broot (rp, ap, n, k);
- mpn_powlo (pp, rp, &k, 1, n, scratch);
-
- MPN_CMP (c, ap, pp, n);
- if (c != 0)
- {
- gmp_fprintf (stderr,
- "mpn_broot returned bad result: %u limbs\n",
- (unsigned) n);
- gmp_fprintf (stderr, "k = %Mx\n", k);
- gmp_fprintf (stderr, "a = %Nx\n", ap, n);
- gmp_fprintf (stderr, "r = %Nx\n", rp, n);
- gmp_fprintf (stderr, "r^n = %Nx\n", pp, n);
- abort ();
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-brootinv.c b/gmp/tests/mpn/t-brootinv.c
deleted file mode 100644
index 11f40b9543..0000000000
--- a/gmp/tests/mpn/t-brootinv.c
+++ /dev/null
@@ -1,106 +0,0 @@
-/* Copyright 2012 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> /* for strtol */
-#include <stdio.h> /* for printf */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-#include "tests/tests.h"
-
-#define MAX_LIMBS 150
-#define COUNT 500
-
-int
-main (int argc, char **argv)
-{
- gmp_randstate_ptr rands;
-
- mp_ptr ap, rp, pp, app, scratch;
- int count = COUNT;
- unsigned i;
- TMP_DECL;
-
- TMP_MARK;
-
- 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 ();
- rands = RANDS;
-
- ap = TMP_ALLOC_LIMBS (MAX_LIMBS);
- rp = TMP_ALLOC_LIMBS (MAX_LIMBS);
- pp = TMP_ALLOC_LIMBS (MAX_LIMBS);
- app = TMP_ALLOC_LIMBS (MAX_LIMBS);
- scratch = TMP_ALLOC_LIMBS (5*MAX_LIMBS);
-
- for (i = 0; i < count; i++)
- {
- mp_size_t n;
- mp_limb_t k;
-
- n = 1 + gmp_urandomm_ui (rands, MAX_LIMBS);
-
- if (i & 1)
- mpn_random2 (ap, n);
- else
- mpn_random (ap, n);
-
- ap[0] |= 1;
-
- if (i < 100)
- k = 3 + 2*i;
- else
- {
- mpn_random (&k, 1);
- if (k < 3)
- k = 3;
- else
- k |= 1;
- }
- mpn_brootinv (rp, ap, n, k, scratch);
- mpn_powlo (pp, rp, &k, 1, n, scratch);
- mpn_mullo_n (app, ap, pp, n);
-
- if (app[0] != 1 || !mpn_zero_p (app+1, n-1))
- {
- gmp_fprintf (stderr,
- "mpn_brootinv returned bad result: %u limbs\n",
- (unsigned) n);
- gmp_fprintf (stderr, "k = %Mx\n", k);
- gmp_fprintf (stderr, "a = %Nx\n", ap, n);
- gmp_fprintf (stderr, "r = %Nx\n", rp, n);
- gmp_fprintf (stderr, "r^n = %Nx\n", pp, n);
- gmp_fprintf (stderr, "a r^n = %Nx\n", app, n);
- abort ();
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-div.c b/gmp/tests/mpn/t-div.c
deleted file mode 100644
index 9dbe0f8185..0000000000
--- a/gmp/tests/mpn/t-div.c
+++ /dev/null
@@ -1,505 +0,0 @@
-/* Copyright 2006, 2007, 2009, 2010, 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 <stdlib.h> /* for strtol */
-#include <stdio.h> /* for printf */
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "longlong.h"
-#include "tests/tests.h"
-
-
-static void
-dumpy (mp_srcptr p, mp_size_t n)
-{
- mp_size_t i;
- if (n > 20)
- {
- for (i = n - 1; i >= n - 4; i--)
- {
- printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
- printf (" ");
- }
- printf ("... ");
- for (i = 3; i >= 0; i--)
- {
- printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
- printf (" " + (i == 0));
- }
- }
- else
- {
- for (i = n - 1; i >= 0; i--)
- {
- printf ("%0*lx", (int) (2 * sizeof (mp_limb_t)), p[i]);
- printf (" " + (i == 0));
- }
- }
- puts ("");
-}
-
-static signed long test;
-
-static void
-check_one (mp_ptr qp, mp_srcptr rp,
- mp_srcptr np, mp_size_t nn, mp_srcptr dp, mp_size_t dn,
- const char *fname, mp_limb_t q_allowed_err)
-{
- mp_size_t qn = nn - dn + 1;
- mp_ptr tp;
- const char *msg;
- const char *tvalue;
- mp_limb_t i;
- TMP_DECL;
- TMP_MARK;
-
- tp = TMP_ALLOC_LIMBS (nn + 1);
- if (dn >= qn)
- refmpn_mul (tp, dp, dn, qp, qn);
- else
- refmpn_mul (tp, qp, qn, dp, dn);
-
- for (i = 0; i < q_allowed_err && (tp[nn] > 0 || mpn_cmp (tp, np, nn) > 0); i++)
- ASSERT_NOCARRY (refmpn_sub (tp, tp, nn+1, dp, dn));
-
- if (tp[nn] > 0 || mpn_cmp (tp, np, nn) > 0)
- {
- msg = "q too large";
- tvalue = "Q*D";
- error:
- printf ("\r*******************************************************************************\n");
- printf ("%s failed test %ld: %s\n", fname, test, msg);
- printf ("N= "); dumpy (np, nn);
- printf ("D= "); dumpy (dp, dn);
- printf ("Q= "); dumpy (qp, qn);
- if (rp)
- { printf ("R= "); dumpy (rp, dn); }
- printf ("%5s=", tvalue); dumpy (tp, nn+1);
- printf ("nn = %ld, dn = %ld, qn = %ld\n", nn, dn, qn);
- abort ();
- }
-
- ASSERT_NOCARRY (refmpn_sub_n (tp, np, tp, nn));
- tvalue = "N-Q*D";
- if (!mpn_zero_p (tp + dn, nn - dn) || mpn_cmp (tp, dp, dn) >= 0)
- {
- msg = "q too small";
- goto error;
- }
-
- if (rp && mpn_cmp (rp, tp, dn) != 0)
- {
- msg = "r incorrect";
- goto error;
- }
-
- TMP_FREE;
-}
-
-
-/* These are *bit* sizes. */
-#ifndef SIZE_LOG
-#define SIZE_LOG 17
-#endif
-#define MAX_DN (1L << SIZE_LOG)
-#define MAX_NN (1L << (SIZE_LOG + 1))
-
-#define COUNT 200
-
-int
-main (int argc, char **argv)
-{
- gmp_randstate_ptr rands;
- unsigned long maxnbits, maxdbits, nbits, dbits;
- mpz_t n, d, q, r, tz, junk;
- mp_size_t maxnn, maxdn, nn, dn, clearn, i;
- mp_ptr np, dup, dnp, qp, rp, junkp;
- mp_limb_t t;
- gmp_pi1_t dinv;
- long count = COUNT;
- mp_ptr scratch;
- mp_limb_t ran;
- mp_size_t alloc, itch;
- mp_limb_t rran0, rran1, qran0, qran1;
- 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;
- }
- }
-
- maxdbits = MAX_DN;
- maxnbits = MAX_NN;
-
- tests_start ();
- rands = RANDS;
-
- mpz_init (n);
- mpz_init (d);
- mpz_init (q);
- mpz_init (r);
- mpz_init (tz);
- mpz_init (junk);
-
- maxnn = maxnbits / GMP_NUMB_BITS + 1;
- maxdn = maxdbits / GMP_NUMB_BITS + 1;
-
- TMP_MARK;
-
- qp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
- rp = TMP_ALLOC_LIMBS (maxnn + 2) + 1;
- dnp = TMP_ALLOC_LIMBS (maxdn);
-
- alloc = 1;
- scratch = __GMP_ALLOCATE_FUNC_LIMBS (alloc);
-
- for (test = -300; test < count; test++)
- {
- nbits = urandom () % (maxnbits - GMP_NUMB_BITS) + 2 * GMP_NUMB_BITS;
-
- if (test < 0)
- dbits = (test + 300) % (nbits - 1) + 1;
- else
- dbits = urandom () % (nbits - 1) % maxdbits + 1;
-
-#if RAND_UNIFORM
-#define RANDFUNC mpz_urandomb
-#else
-#define RANDFUNC mpz_rrandomb
-#endif
-
- do
- RANDFUNC (d, rands, dbits);
- while (mpz_sgn (d) == 0);
- dn = SIZ (d);
- dup = PTR (d);
- MPN_COPY (dnp, dup, dn);
- dnp[dn - 1] |= GMP_NUMB_HIGHBIT;
-
- if (test % 2 == 0)
- {
- RANDFUNC (n, rands, nbits);
- nn = SIZ (n);
- ASSERT_ALWAYS (nn >= dn);
- }
- else
- {
- do
- {
- 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);
- }
- while (nn > maxnn || nn < dn);
- }
-
- ASSERT_ALWAYS (nn <= maxnn);
- ASSERT_ALWAYS (dn <= maxdn);
-
- mpz_urandomb (junk, rands, nbits);
- junkp = PTR (junk);
-
- np = PTR (n);
-
- mpz_urandomb (tz, rands, 32);
- t = mpz_get_ui (tz);
-
- if (t % 17 == 0)
- {
- dnp[dn - 1] = GMP_NUMB_MAX;
- dup[dn - 1] = GMP_NUMB_MAX;
- }
-
- switch ((int) t % 16)
- {
- case 0:
- clearn = urandom () % nn;
- for (i = clearn; i < nn; i++)
- np[i] = 0;
- break;
- case 1:
- mpn_sub_1 (np + nn - dn, dnp, dn, urandom ());
- break;
- case 2:
- mpn_add_1 (np + nn - dn, dnp, dn, urandom ());
- break;
- }
-
- if (dn >= 2)
- invert_pi1 (dinv, dnp[dn - 1], dnp[dn - 2]);
-
- rran0 = urandom ();
- rran1 = urandom ();
- qran0 = urandom ();
- qran1 = urandom ();
-
- qp[-1] = qran0;
- qp[nn - dn + 1] = qran1;
- rp[-1] = rran0;
-
- ran = urandom ();
-
- if ((double) (nn - dn) * dn < 1e5)
- {
- /* Test mpn_sbpi1_div_qr */
- if (dn > 2)
- {
- MPN_COPY (rp, np, nn);
- if (nn > dn)
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_sbpi1_div_qr (qp, rp, nn, dnp, dn, dinv.inv32);
- check_one (qp, rp, np, nn, dnp, dn, "mpn_sbpi1_div_qr", 0);
- }
-
- /* Test mpn_sbpi1_divappr_q */
- if (dn > 2)
- {
- MPN_COPY (rp, np, nn);
- if (nn > dn)
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_sbpi1_divappr_q (qp, rp, nn, dnp, dn, dinv.inv32);
- check_one (qp, NULL, np, nn, dnp, dn, "mpn_sbpi1_divappr_q", 1);
- }
-
- /* Test mpn_sbpi1_div_q */
- if (dn > 2)
- {
- MPN_COPY (rp, np, nn);
- if (nn > dn)
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_sbpi1_div_q (qp, rp, nn, dnp, dn, dinv.inv32);
- check_one (qp, NULL, np, nn, dnp, dn, "mpn_sbpi1_div_q", 0);
- }
-
- /* 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);
- alloc = itch + 1;
- }
- 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, dup, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- check_one (qp, rp, np, nn, dup, dn, "mpn_sec_div_qr (unnorm)", 0);
-
- /* 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);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- MPN_COPY (rp, np, nn);
- mpn_sec_div_r (rp, nn, dup, 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, 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 */
- if (dn >= 6 && nn - dn >= 3)
- {
- MPN_COPY (rp, np, nn);
- if (nn > dn)
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_dcpi1_div_qr (qp, rp, nn, dnp, dn, &dinv);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0);
- check_one (qp, rp, np, nn, dnp, dn, "mpn_dcpi1_div_qr", 0);
- }
-
- /* Test mpn_dcpi1_divappr_q */
- if (dn >= 6 && nn - dn >= 3)
- {
- MPN_COPY (rp, np, nn);
- if (nn > dn)
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_dcpi1_divappr_q (qp, rp, nn, dnp, dn, &dinv);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0);
- check_one (qp, NULL, np, nn, dnp, dn, "mpn_dcpi1_divappr_q", 1);
- }
-
- /* Test mpn_dcpi1_div_q */
- if (dn >= 6 && nn - dn >= 3)
- {
- MPN_COPY (rp, np, nn);
- if (nn > dn)
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_dcpi1_div_q (qp, rp, nn, dnp, dn, &dinv);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0);
- check_one (qp, NULL, np, nn, dnp, dn, "mpn_dcpi1_div_q", 0);
- }
-
- /* Test mpn_mu_div_qr */
- if (nn - dn > 2 && dn >= 2)
- {
- itch = mpn_mu_div_qr_itch (nn, dn, 0);
- if (itch + 1 > alloc)
- {
- scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- MPN_COPY (qp, junkp, nn - dn);
- MPN_ZERO (rp, dn);
- rp[dn] = rran1;
- qp[nn - dn] = mpn_mu_div_qr (qp, rp, np, nn, dnp, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- ASSERT_ALWAYS (rp[-1] == rran0); ASSERT_ALWAYS (rp[dn] == rran1);
- check_one (qp, rp, np, nn, dnp, dn, "mpn_mu_div_qr", 0);
- }
-
- /* Test mpn_mu_divappr_q */
- if (nn - dn > 2 && dn >= 2)
- {
- itch = mpn_mu_divappr_q_itch (nn, dn, 0);
- if (itch + 1 > alloc)
- {
- scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_mu_divappr_q (qp, np, nn, dnp, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- check_one (qp, NULL, np, nn, dnp, dn, "mpn_mu_divappr_q", 4);
- }
-
- /* Test mpn_mu_div_q */
- if (nn - dn > 2 && dn >= 2)
- {
- itch = mpn_mu_div_q_itch (nn, dn, 0);
- if (itch + 1> alloc)
- {
- scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- MPN_COPY (qp, junkp, nn - dn);
- qp[nn - dn] = mpn_mu_div_q (qp, np, nn, dnp, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- check_one (qp, NULL, np, nn, dnp, dn, "mpn_mu_div_q", 0);
- }
-
- if (1)
- {
- itch = nn + 1;
- if (itch + 1> alloc)
- {
- scratch = __GMP_REALLOCATE_FUNC_LIMBS (scratch, alloc, itch + 1);
- alloc = itch + 1;
- }
- scratch[itch] = ran;
- mpn_div_q (qp, np, nn, dup, dn, scratch);
- ASSERT_ALWAYS (ran == scratch[itch]);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - dn + 1] == qran1);
- check_one (qp, NULL, np, nn, dup, dn, "mpn_div_q", 0);
- }
-
- if (dn >= 2 && nn >= 2)
- {
- mp_limb_t qh;
-
- /* mpn_divrem_2 */
- MPN_COPY (rp, np, nn);
- qp[nn - 2] = qp[nn-1] = qran1;
-
- qh = mpn_divrem_2 (qp, 0, rp, nn, dnp + dn - 2);
- ASSERT_ALWAYS (qp[nn - 2] == qran1);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1);
- qp[nn - 2] = qh;
- check_one (qp, rp, np, nn, dnp + dn - 2, 2, "mpn_divrem_2", 0);
-
- /* Missing: divrem_2 with fraction limbs. */
-
- /* mpn_div_qr_2 */
- qp[nn - 2] = qran1;
-
- qh = mpn_div_qr_2 (qp, rp, np, nn, dup + dn - 2);
- ASSERT_ALWAYS (qp[nn - 2] == qran1);
- ASSERT_ALWAYS (qp[-1] == qran0); ASSERT_ALWAYS (qp[nn - 1] == qran1);
- 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);
-
- TMP_FREE;
-
- mpz_clear (n);
- mpz_clear (d);
- mpz_clear (q);
- mpz_clear (r);
- mpz_clear (tz);
- mpz_clear (junk);
-
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-divrem_1.c b/gmp/tests/mpn/t-divrem_1.c
index 9ffe90548f..27eba9c0b0 100644
--- a/gmp/tests/mpn/t-divrem_1.c
+++ b/gmp/tests/mpn/t-divrem_1.c
@@ -2,20 +2,20 @@
Copyright 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -42,11 +42,6 @@ check_data (void)
{ { 5 }, 1, 2, 0,
{ 2 }, 1},
- /* Exercises the q update in the nl == constant 0 case of
- udiv_qrnnd_preinv3. Test case copied from t-fat.c. */
- { { 287 }, 1, 7, 1,
- { 0, 41 }, 0 },
-
#if GMP_NUMB_BITS == 32
{ { 0x3C }, 1, 0xF2, 1,
{ 0x3F789854, 0 }, 0x98 },
diff --git a/gmp/tests/mpn/t-fat.c b/gmp/tests/mpn/t-fat.c
index abb288e4b0..9e208245fe 100644
--- a/gmp/tests/mpn/t-fat.c
+++ b/gmp/tests/mpn/t-fat.c
@@ -1,21 +1,21 @@
/* Test fat binary setups.
-Copyright 2003, 2012 Free Software Foundation, Inc.
+Copyright 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -66,7 +66,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
/* dummies when not a fat binary */
#if ! WANT_FAT_BINARY
struct cpuvec_t {
- int dummy;
+ int initialized;
};
struct cpuvec_t __gmpn_cpuvec;
#define ITERATE_FAT_THRESHOLDS() do { } while (0)
@@ -207,15 +207,6 @@ check_functions (void)
ASSERT_ALWAYS (wp[1] == 0);
}
- memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
- for (i = 0; i < 2; i++)
- {
- xp[0] = 5;
- yp[0] = 7;
- mpn_mullo_basecase (wp, xp, yp, (mp_size_t) 1);
- ASSERT_ALWAYS (wp[0] == 35);
- }
-
#if HAVE_NATIVE_mpn_preinv_divrem_1 && GMP_NAIL_BITS == 0
memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec));
for (i = 0; i < 2; i++)
@@ -278,18 +269,17 @@ check_functions (void)
}
}
-/* Expect the first use of each fat threshold to invoke the necessary
+/* Expect the first use of a each fat threshold to invoke the necessary
initialization. */
void
check_thresholds (void)
{
#define ITERATE(name,field) \
do { \
- __gmpn_cpuvec_initialized = 0; \
memcpy (&__gmpn_cpuvec, &initial_cpuvec, sizeof (__gmpn_cpuvec)); \
ASSERT_ALWAYS (name != 0); \
ASSERT_ALWAYS (name == __gmpn_cpuvec.field); \
- ASSERT_ALWAYS (__gmpn_cpuvec_initialized); \
+ ASSERT_ALWAYS (__gmpn_cpuvec.initialized); \
} while (0)
ITERATE_FAT_THRESHOLDS ();
diff --git a/gmp/tests/mpn/t-get_d.c b/gmp/tests/mpn/t-get_d.c
index 1499391e06..c3999e2a7c 100644
--- a/gmp/tests/mpn/t-get_d.c
+++ b/gmp/tests/mpn/t-get_d.c
@@ -1,21 +1,27 @@
/* Test mpn_get_d.
-Copyright 2002-2004 Free Software Foundation, Inc.
+Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. 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. */
#include "config.h"
@@ -65,7 +71,7 @@ check_onebit (void)
};
/* FIXME: It'd be better to base this on the float format. */
-#if defined (__vax) || defined (__vax__)
+#ifdef __vax
int limit = 127; /* vax fp numbers have limited range */
#else
int limit = 511;
@@ -90,7 +96,7 @@ check_onebit (void)
exp = exp_table[exp_i];
want_bit = bit + exp;
- if (want_bit >= limit || want_bit <= -limit)
+ if (want_bit > limit || want_bit < -limit)
continue;
want = 1.0;
@@ -489,9 +495,7 @@ main (void)
check_ieee_denorm ();
check_ieee_overflow ();
check_0x81c25113 ();
-#if ! (defined (__vax) || defined (__vax__))
check_rand ();
-#endif
tests_end ();
exit (0);
diff --git a/gmp/tests/mpn/t-hgcd.c b/gmp/tests/mpn/t-hgcd.c
index 64d33ef006..f2e3692fff 100644
--- a/gmp/tests/mpn/t-hgcd.c
+++ b/gmp/tests/mpn/t-hgcd.c
@@ -1,22 +1,22 @@
-/* Test mpn_hgcd.
+/* Test mpz_gcd, mpz_gcdext, and mpz_gcd_ui.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free
+Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-static mp_size_t one_test (mpz_t, mpz_t, int);
-static void debug_mp (mpz_t, int);
+static mp_size_t one_test __GMP_PROTO ((mpz_t, mpz_t, int));
+static void debug_mp __GMP_PROTO ((mpz_t, int));
#define MIN_OPERAND_SIZE 2
@@ -50,10 +50,10 @@ struct hgcd_ref
mpz_t m[2][2];
};
-static void hgcd_ref_init (struct hgcd_ref *);
-static void hgcd_ref_clear (struct hgcd_ref *);
-static int hgcd_ref (struct hgcd_ref *, mpz_t, mpz_t);
-static int hgcd_ref_equal (const struct hgcd_matrix *, const struct hgcd_ref *);
+static void hgcd_ref_init __GMP_PROTO ((struct hgcd_ref *hgcd));
+static void hgcd_ref_clear __GMP_PROTO ((struct hgcd_ref *hgcd));
+static int hgcd_ref __GMP_PROTO ((struct hgcd_ref *hgcd, mpz_t a, mpz_t b));
+static int hgcd_ref_equal __GMP_PROTO ((const struct hgcd_matrix *hgcd, const struct hgcd_ref *ref));
int
main (int argc, char **argv)
@@ -97,15 +97,17 @@ main (int argc, char **argv)
{
/* Generate plain operands with unknown gcd. These types of operands
have proven to trigger certain bugs in development versions of the
- gcd code. */
+ gcd code. The "hgcd->row[3].rsize > M" ASSERT is not triggered by
+ the division chain code below, but that is most likely just a result
+ of that other ASSERTs are triggered before it. */
mpz_urandomb (bs, rands, 32);
size_range = mpz_get_ui (bs) % 13 + 2;
mpz_urandomb (bs, rands, size_range);
- mpz_rrandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
+ mpz_urandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
mpz_urandomb (bs, rands, size_range);
- mpz_rrandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
+ mpz_urandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
if (mpz_cmp (op1, op2) < 0)
mpz_swap (op1, op2);
@@ -160,13 +162,6 @@ main (int argc, char **argv)
one_test (op1, op2, i);
}
- mpz_clear (bs);
- mpz_clear (op1);
- mpz_clear (op2);
- mpz_clear (temp1);
- mpz_clear (temp2);
-
- tests_end ();
exit (0);
}
diff --git a/gmp/tests/mpn/t-hgcd_appr.c b/gmp/tests/mpn/t-hgcd_appr.c
deleted file mode 100644
index 23ffbf0b76..0000000000
--- a/gmp/tests/mpn/t-hgcd_appr.c
+++ /dev/null
@@ -1,564 +0,0 @@
-/* Test mpn_hgcd_appr.
-
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004, 2011 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>
-#include <string.h>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-static mp_size_t one_test (mpz_t, mpz_t, int);
-static void debug_mp (mpz_t, int);
-
-#define MIN_OPERAND_SIZE 2
-
-struct hgcd_ref
-{
- mpz_t m[2][2];
-};
-
-static void hgcd_ref_init (struct hgcd_ref *hgcd);
-static void hgcd_ref_clear (struct hgcd_ref *hgcd);
-static int hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b);
-static int hgcd_ref_equal (const struct hgcd_ref *, const struct hgcd_ref *);
-static int hgcd_appr_valid_p (mpz_t, mpz_t, mp_size_t, struct hgcd_ref *,
- mpz_t, mpz_t, mp_size_t, struct hgcd_matrix *);
-
-static int verbose_flag = 0;
-
-int
-main (int argc, char **argv)
-{
- mpz_t op1, op2, temp1, temp2;
- int i, j, chain_len;
- gmp_randstate_ptr rands;
- mpz_t bs;
- unsigned long size_range;
-
- if (argc > 1)
- {
- if (strcmp (argv[1], "-v") == 0)
- verbose_flag = 1;
- else
- {
- fprintf (stderr, "Invalid argument.\n");
- return 1;
- }
- }
-
- tests_start ();
- rands = RANDS;
-
- mpz_init (bs);
- mpz_init (op1);
- mpz_init (op2);
- mpz_init (temp1);
- mpz_init (temp2);
-
- for (i = 0; i < 15; i++)
- {
- /* Generate plain operands with unknown gcd. These types of operands
- have proven to trigger certain bugs in development versions of the
- gcd code. */
-
- mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 13 + 2;
-
- mpz_urandomb (bs, rands, size_range);
- mpz_urandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
- mpz_urandomb (bs, rands, size_range);
- mpz_urandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_SIZE);
-
- if (mpz_cmp (op1, op2) < 0)
- mpz_swap (op1, op2);
-
- if (mpz_size (op1) > 0)
- one_test (op1, op2, i);
-
- /* Generate a division chain backwards, allowing otherwise
- unlikely huge quotients. */
-
- mpz_set_ui (op1, 0);
- mpz_urandomb (bs, rands, 32);
- mpz_urandomb (bs, rands, mpz_get_ui (bs) % 16 + 1);
- mpz_rrandomb (op2, rands, mpz_get_ui (bs));
- mpz_add_ui (op2, op2, 1);
-
-#if 0
- chain_len = 1000000;
-#else
- mpz_urandomb (bs, rands, 32);
- chain_len = mpz_get_ui (bs) % (GMP_NUMB_BITS * GCD_DC_THRESHOLD / 256);
-#endif
-
- for (j = 0; j < chain_len; j++)
- {
- mpz_urandomb (bs, rands, 32);
- mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
- mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
- mpz_add_ui (temp2, temp2, 1);
- mpz_mul (temp1, op2, temp2);
- mpz_add (op1, op1, temp1);
-
- /* Don't generate overly huge operands. */
- if (SIZ (op1) > 3 * GCD_DC_THRESHOLD)
- break;
-
- mpz_urandomb (bs, rands, 32);
- mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
- mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
- mpz_add_ui (temp2, temp2, 1);
- mpz_mul (temp1, op1, temp2);
- mpz_add (op2, op2, temp1);
-
- /* Don't generate overly huge operands. */
- if (SIZ (op2) > 3 * GCD_DC_THRESHOLD)
- break;
- }
- if (mpz_cmp (op1, op2) < 0)
- mpz_swap (op1, op2);
-
- if (mpz_size (op1) > 0)
- one_test (op1, op2, i);
- }
-
- mpz_clear (bs);
- mpz_clear (op1);
- mpz_clear (op2);
- mpz_clear (temp1);
- mpz_clear (temp2);
-
- tests_end ();
- exit (0);
-}
-
-static void
-debug_mp (mpz_t x, int base)
-{
- mpz_out_str (stderr, base, x); fputc ('\n', stderr);
-}
-
-static mp_size_t
-one_test (mpz_t a, mpz_t b, int i)
-{
- struct hgcd_matrix hgcd;
- struct hgcd_ref ref;
-
- mpz_t ref_r0;
- mpz_t ref_r1;
- mpz_t hgcd_r0;
- mpz_t hgcd_r1;
-
- int res[2];
- mp_size_t asize;
- mp_size_t bsize;
-
- mp_size_t hgcd_init_scratch;
- mp_size_t hgcd_scratch;
-
- mp_ptr hgcd_init_tp;
- mp_ptr hgcd_tp;
- mp_limb_t marker[4];
-
- asize = a->_mp_size;
- bsize = b->_mp_size;
-
- ASSERT (asize >= bsize);
-
- hgcd_init_scratch = MPN_HGCD_MATRIX_INIT_ITCH (asize);
- hgcd_init_tp = refmpn_malloc_limbs (hgcd_init_scratch + 2) + 1;
- mpn_hgcd_matrix_init (&hgcd, asize, hgcd_init_tp);
-
- hgcd_scratch = mpn_hgcd_appr_itch (asize);
- hgcd_tp = refmpn_malloc_limbs (hgcd_scratch + 2) + 1;
-
- mpn_random (marker, 4);
-
- hgcd_init_tp[-1] = marker[0];
- hgcd_init_tp[hgcd_init_scratch] = marker[1];
- hgcd_tp[-1] = marker[2];
- hgcd_tp[hgcd_scratch] = marker[3];
-
-#if 0
- fprintf (stderr,
- "one_test: i = %d asize = %d, bsize = %d\n",
- i, a->_mp_size, b->_mp_size);
-
- gmp_fprintf (stderr,
- "one_test: i = %d\n"
- " a = %Zx\n"
- " b = %Zx\n",
- i, a, b);
-#endif
- hgcd_ref_init (&ref);
-
- mpz_init_set (ref_r0, a);
- mpz_init_set (ref_r1, b);
- res[0] = hgcd_ref (&ref, ref_r0, ref_r1);
-
- mpz_init_set (hgcd_r0, a);
- mpz_init_set (hgcd_r1, b);
- if (bsize < asize)
- {
- _mpz_realloc (hgcd_r1, asize);
- MPN_ZERO (hgcd_r1->_mp_d + bsize, asize - bsize);
- }
- res[1] = mpn_hgcd_appr (hgcd_r0->_mp_d,
- hgcd_r1->_mp_d,
- asize,
- &hgcd, hgcd_tp);
-
- if (hgcd_init_tp[-1] != marker[0]
- || hgcd_init_tp[hgcd_init_scratch] != marker[1]
- || hgcd_tp[-1] != marker[2]
- || hgcd_tp[hgcd_scratch] != marker[3])
- {
- fprintf (stderr, "ERROR in test %d\n", i);
- fprintf (stderr, "scratch space overwritten!\n");
-
- if (hgcd_init_tp[-1] != marker[0])
- gmp_fprintf (stderr,
- "before init_tp: %Mx\n"
- "expected: %Mx\n",
- hgcd_init_tp[-1], marker[0]);
- if (hgcd_init_tp[hgcd_init_scratch] != marker[1])
- gmp_fprintf (stderr,
- "after init_tp: %Mx\n"
- "expected: %Mx\n",
- hgcd_init_tp[hgcd_init_scratch], marker[1]);
- if (hgcd_tp[-1] != marker[2])
- gmp_fprintf (stderr,
- "before tp: %Mx\n"
- "expected: %Mx\n",
- hgcd_tp[-1], marker[2]);
- if (hgcd_tp[hgcd_scratch] != marker[3])
- gmp_fprintf (stderr,
- "after tp: %Mx\n"
- "expected: %Mx\n",
- hgcd_tp[hgcd_scratch], marker[3]);
-
- abort ();
- }
-
- if (!hgcd_appr_valid_p (a, b, res[0], &ref, ref_r0, ref_r1,
- res[1], &hgcd))
- {
- fprintf (stderr, "ERROR in test %d\n", i);
- fprintf (stderr, "Invalid results for hgcd and hgcd_ref\n");
- fprintf (stderr, "op1="); debug_mp (a, -16);
- fprintf (stderr, "op2="); debug_mp (b, -16);
- fprintf (stderr, "hgcd_ref: %ld\n", (long) res[0]);
- fprintf (stderr, "mpn_hgcd_appr: %ld\n", (long) res[1]);
- abort ();
- }
-
- refmpn_free_limbs (hgcd_init_tp - 1);
- refmpn_free_limbs (hgcd_tp - 1);
- hgcd_ref_clear (&ref);
- mpz_clear (ref_r0);
- mpz_clear (ref_r1);
- mpz_clear (hgcd_r0);
- mpz_clear (hgcd_r1);
-
- return res[0];
-}
-
-static void
-hgcd_ref_init (struct hgcd_ref *hgcd)
-{
- unsigned i;
- for (i = 0; i<2; i++)
- {
- unsigned j;
- for (j = 0; j<2; j++)
- mpz_init (hgcd->m[i][j]);
- }
-}
-
-static void
-hgcd_ref_clear (struct hgcd_ref *hgcd)
-{
- unsigned i;
- for (i = 0; i<2; i++)
- {
- unsigned j;
- for (j = 0; j<2; j++)
- mpz_clear (hgcd->m[i][j]);
- }
-}
-
-static int
-sdiv_qr (mpz_t q, mpz_t r, mp_size_t s, const mpz_t a, const mpz_t b)
-{
- mpz_fdiv_qr (q, r, a, b);
- if (mpz_size (r) <= s)
- {
- mpz_add (r, r, b);
- mpz_sub_ui (q, q, 1);
- }
-
- return (mpz_sgn (q) > 0);
-}
-
-static int
-hgcd_ref (struct hgcd_ref *hgcd, mpz_t a, mpz_t b)
-{
- mp_size_t n = MAX (mpz_size (a), mpz_size (b));
- mp_size_t s = n/2 + 1;
- mpz_t q;
- int res;
-
- if (mpz_size (a) <= s || mpz_size (b) <= s)
- return 0;
-
- res = mpz_cmp (a, b);
- if (res < 0)
- {
- mpz_sub (b, b, a);
- if (mpz_size (b) <= s)
- return 0;
-
- mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 0);
- mpz_set_ui (hgcd->m[1][0], 1); mpz_set_ui (hgcd->m[1][1], 1);
- }
- else if (res > 0)
- {
- mpz_sub (a, a, b);
- if (mpz_size (a) <= s)
- return 0;
-
- mpz_set_ui (hgcd->m[0][0], 1); mpz_set_ui (hgcd->m[0][1], 1);
- mpz_set_ui (hgcd->m[1][0], 0); mpz_set_ui (hgcd->m[1][1], 1);
- }
- else
- return 0;
-
- mpz_init (q);
-
- for (;;)
- {
- ASSERT (mpz_size (a) > s);
- ASSERT (mpz_size (b) > s);
-
- if (mpz_cmp (a, b) > 0)
- {
- if (!sdiv_qr (q, a, s, a, b))
- break;
- mpz_addmul (hgcd->m[0][1], q, hgcd->m[0][0]);
- mpz_addmul (hgcd->m[1][1], q, hgcd->m[1][0]);
- }
- else
- {
- if (!sdiv_qr (q, b, s, b, a))
- break;
- mpz_addmul (hgcd->m[0][0], q, hgcd->m[0][1]);
- mpz_addmul (hgcd->m[1][0], q, hgcd->m[1][1]);
- }
- }
-
- mpz_clear (q);
-
- return 1;
-}
-
-static int
-hgcd_ref_equal (const struct hgcd_ref *A, const struct hgcd_ref *B)
-{
- unsigned i;
-
- for (i = 0; i<2; i++)
- {
- unsigned j;
-
- for (j = 0; j<2; j++)
- if (mpz_cmp (A->m[i][j], B->m[i][j]) != 0)
- return 0;
- }
-
- return 1;
-}
-
-static int
-hgcd_appr_valid_p (mpz_t a, mpz_t b, mp_size_t res0,
- struct hgcd_ref *ref, mpz_t ref_r0, mpz_t ref_r1,
- mp_size_t res1, struct hgcd_matrix *hgcd)
-{
- mp_size_t n = MAX (mpz_size (a), mpz_size (b));
- mp_size_t s = n/2 + 1;
-
- mp_bitcnt_t dbits, abits, margin;
- mpz_t appr_r0, appr_r1, t, q;
- struct hgcd_ref appr;
-
- if (!res0)
- {
- if (!res1)
- return 1;
-
- fprintf (stderr, "mpn_hgcd_appr returned 1 when no reduction possible.\n");
- return 0;
- }
-
- /* NOTE: No *_clear calls on error return, since we're going to
- abort anyway. */
- mpz_init (t);
- mpz_init (q);
- hgcd_ref_init (&appr);
- mpz_init (appr_r0);
- mpz_init (appr_r1);
-
- if (mpz_size (ref_r0) <= s)
- {
- fprintf (stderr, "ref_r0 too small!!!: "); debug_mp (ref_r0, 16);
- return 0;
- }
- if (mpz_size (ref_r1) <= s)
- {
- fprintf (stderr, "ref_r1 too small!!!: "); debug_mp (ref_r1, 16);
- return 0;
- }
-
- mpz_sub (t, ref_r0, ref_r1);
- dbits = mpz_sizeinbase (t, 2);
- if (dbits > s*GMP_NUMB_BITS)
- {
- fprintf (stderr, "ref |r0 - r1| too large!!!: "); debug_mp (t, 16);
- return 0;
- }
-
- if (!res1)
- {
- mpz_set (appr_r0, a);
- mpz_set (appr_r1, b);
- }
- else
- {
- unsigned i;
-
- for (i = 0; i<2; i++)
- {
- unsigned j;
-
- for (j = 0; j<2; j++)
- {
- mp_size_t mn = hgcd->n;
- MPN_NORMALIZE (hgcd->p[i][j], mn);
- mpz_realloc (appr.m[i][j], mn);
- MPN_COPY (PTR (appr.m[i][j]), hgcd->p[i][j], mn);
- SIZ (appr.m[i][j]) = mn;
- }
- }
- mpz_mul (appr_r0, appr.m[1][1], a);
- mpz_mul (t, appr.m[0][1], b);
- mpz_sub (appr_r0, appr_r0, t);
- if (mpz_sgn (appr_r0) <= 0
- || mpz_size (appr_r0) <= s)
- {
- fprintf (stderr, "appr_r0 too small: "); debug_mp (appr_r0, 16);
- return 0;
- }
-
- mpz_mul (appr_r1, appr.m[1][0], a);
- mpz_mul (t, appr.m[0][0], b);
- mpz_sub (appr_r1, t, appr_r1);
- if (mpz_sgn (appr_r1) <= 0
- || mpz_size (appr_r1) <= s)
- {
- fprintf (stderr, "appr_r1 too small: "); debug_mp (appr_r1, 16);
- return 0;
- }
- }
-
- mpz_sub (t, appr_r0, appr_r1);
- abits = mpz_sizeinbase (t, 2);
- if (abits < dbits)
- {
- fprintf (stderr, "|r0 - r1| too small: "); debug_mp (t, 16);
- return 0;
- }
-
- /* We lose one bit each time we discard the least significant limbs.
- For the lehmer code, that can happen at most s * (GMP_NUMB_BITS)
- / (GMP_NUMB_BITS - 1) times. For the dc code, we lose an entire
- limb (or more?) for each level of recursion. */
-
- margin = (n/2+1) * GMP_NUMB_BITS / (GMP_NUMB_BITS - 1);
- {
- mp_size_t rn;
- for (rn = n; ABOVE_THRESHOLD (rn, HGCD_APPR_THRESHOLD); rn = (rn + 1)/2)
- margin += GMP_NUMB_BITS;
- }
-
- if (verbose_flag && abits > dbits)
- 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);
-
- if (abits > s*GMP_NUMB_BITS + margin)
- {
- fprintf (stderr, "appr |r0 - r1| much larger than minimal (by %u bits, margin = %u bits)\n",
- (unsigned) (abits - s*GMP_NUMB_BITS), (unsigned) margin);
- return 0;
- }
-
- while (mpz_cmp (appr_r0, ref_r0) > 0 || mpz_cmp (appr_r1, ref_r1) > 0)
- {
- ASSERT (mpz_size (appr_r0) > s);
- ASSERT (mpz_size (appr_r1) > s);
-
- if (mpz_cmp (appr_r0, appr_r1) > 0)
- {
- if (!sdiv_qr (q, appr_r0, s, appr_r0, appr_r1))
- break;
- mpz_addmul (appr.m[0][1], q, appr.m[0][0]);
- mpz_addmul (appr.m[1][1], q, appr.m[1][0]);
- }
- else
- {
- if (!sdiv_qr (q, appr_r1, s, appr_r1, appr_r0))
- break;
- mpz_addmul (appr.m[0][0], q, appr.m[0][1]);
- mpz_addmul (appr.m[1][0], q, appr.m[1][1]);
- }
- }
-
- if (mpz_cmp (appr_r0, ref_r0) != 0
- || mpz_cmp (appr_r1, ref_r1) != 0
- || !hgcd_ref_equal (ref, &appr))
- {
- fprintf (stderr, "appr_r0: "); debug_mp (appr_r0, 16);
- fprintf (stderr, "ref_r0: "); debug_mp (ref_r0, 16);
-
- fprintf (stderr, "appr_r1: "); debug_mp (appr_r1, 16);
- fprintf (stderr, "ref_r1: "); debug_mp (ref_r1, 16);
-
- return 0;
- }
- mpz_clear (t);
- mpz_clear (q);
- hgcd_ref_clear (&appr);
- mpz_clear (appr_r0);
- mpz_clear (appr_r1);
-
- return 1;
-}
diff --git a/gmp/tests/mpn/t-instrument.c b/gmp/tests/mpn/t-instrument.c
index 338fef1773..98e35fdc14 100644
--- a/gmp/tests/mpn/t-instrument.c
+++ b/gmp/tests/mpn/t-instrument.c
@@ -2,20 +2,20 @@
Copyright 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -50,8 +50,8 @@ struct {
int ncall;
-void __cyg_profile_func_enter (void *, void *)
- __attribute__ ((no_instrument_function));
+void __cyg_profile_func_enter __GMP_PROTO ((void *this_fn, void *call_site))
+ __attribute__ ((no_instrument_function));
void
__cyg_profile_func_enter (void *this_fn, void *call_site)
@@ -74,8 +74,8 @@ __cyg_profile_func_enter (void *this_fn, void *call_site)
ncall++;
}
-void __cyg_profile_func_exit (void *, void *)
- __attribute__ ((no_instrument_function));
+void __cyg_profile_func_exit __GMP_PROTO ((void *this_fn, void *call_site))
+ __attribute__ ((no_instrument_function));
void
__cyg_profile_func_exit (void *this_fn, void *call_site)
@@ -176,9 +176,9 @@ check (void)
post ();
#endif
-#if HAVE_NATIVE_mpn_com
- pre ("mpn_com");
- mpn_com (wp, xp, size);
+#if HAVE_NATIVE_mpn_com_n
+ pre ("mpn_com_n");
+ mpn_com_n (wp, xp, size);
post ();
#endif
diff --git a/gmp/tests/mpn/t-invert.c b/gmp/tests/mpn/t-invert.c
deleted file mode 100644
index c9b0080b76..0000000000
--- a/gmp/tests/mpn/t-invert.c
+++ /dev/null
@@ -1,161 +0,0 @@
-/* Test for mpn_invert function.
-
- Contributed to the GNU project by Marco Bodrato.
-
-Copyright 2009 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"
-
-/* Sizes are up to 2^SIZE_LOG limbs */
-#ifndef SIZE_LOG
-#define SIZE_LOG 12
-#endif
-
-#ifndef COUNT
-#define COUNT 1000
-#endif
-
-#define MAX_N (1L << SIZE_LOG)
-#define MIN_N 1
-
-
-static int
-invert_valid (mp_srcptr ip, mp_srcptr dp, mp_size_t n)
-{
- mp_ptr tp;
- int cy;
- TMP_DECL;
-
- TMP_MARK;
- tp = TMP_ALLOC_LIMBS (2*n);
-
- refmpn_mul (tp, ip, n, dp, n);
- cy = refmpn_add_n (tp + n, tp + n, dp, n); /* This must not give a carry. */
- cy -= refmpn_add (tp, tp, 2*n, dp, n); /* This must give a carry. */
- TMP_FREE;
-
- return (cy == -1);
-}
-
-/*
- Check the result of the mpn_invert function in the library.
-*/
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ip, dp, scratch;
- int count = COUNT;
- int test;
- gmp_randstate_ptr rands;
- TMP_DECL;
- TMP_MARK;
-
- 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 ();
- rands = RANDS;
-
- dp = TMP_ALLOC_LIMBS (MAX_N);
- ip = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
- scratch
- = 1+TMP_ALLOC_LIMBS (mpn_invert_itch (MAX_N) + 2);
-
- for (test = 0; test < count; test++)
- {
- unsigned size_min;
- unsigned size_range;
- mp_size_t n;
- mp_size_t itch;
- mp_limb_t i_before, i_after, s_before, s_after;
-
- for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
- ;
-
- /* We generate an in the MIN_N <= n <= (1 << size_range). */
- size_range = size_min
- + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
-
- n = MIN_N
- + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
-
- mpn_random2 (dp, n);
-
- mpn_random2 (ip-1, n + 2);
- i_before = ip[-1];
- i_after = ip[n];
-
- itch = mpn_invert_itch (n);
- ASSERT_ALWAYS (itch <= mpn_invert_itch (MAX_N));
- mpn_random2 (scratch-1, itch+2);
- s_before = scratch[-1];
- s_after = scratch[itch];
-
- dp[n-1] |= GMP_NUMB_HIGHBIT;
- mpn_invert (ip, dp, n, scratch);
- if (ip[-1] != i_before || ip[n] != i_after
- || scratch[-1] != s_before || scratch[itch] != s_after
- || ! invert_valid(ip, dp, n))
- {
- printf ("ERROR in test %d, n = %d\n",
- test, (int) n);
- if (ip[-1] != i_before)
- {
- printf ("before ip:"); mpn_dump (ip -1, 1);
- printf ("keep: "); mpn_dump (&i_before, 1);
- }
- if (ip[n] != i_after)
- {
- printf ("after ip:"); mpn_dump (ip + n, 1);
- printf ("keep: "); mpn_dump (&i_after, 1);
- }
- if (scratch[-1] != s_before)
- {
- printf ("before scratch:"); mpn_dump (scratch-1, 1);
- printf ("keep: "); mpn_dump (&s_before, 1);
- }
- if (scratch[itch] != s_after)
- {
- printf ("after scratch:"); mpn_dump (scratch + itch, 1);
- printf ("keep: "); mpn_dump (&s_after, 1);
- }
- mpn_dump (dp, n);
- mpn_dump (ip, n);
-
- abort();
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-iord_u.c b/gmp/tests/mpn/t-iord_u.c
index 93e68c5c3f..3b472fd616 100644
--- a/gmp/tests/mpn/t-iord_u.c
+++ b/gmp/tests/mpn/t-iord_u.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpn/t-matrix22.c b/gmp/tests/mpn/t-matrix22.c
index e63cbe27bb..87c357b659 100644
--- a/gmp/tests/mpn/t-matrix22.c
+++ b/gmp/tests/mpn/t-matrix22.c
@@ -2,20 +2,20 @@
Copyright 2008 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -185,7 +185,7 @@ main (int argc, char **argv)
matrix_init (&B, MAX_SIZE);
mpz_init (bs);
- for (i = 0; i < 1000; i++)
+ for (i = 0; i < 17; i++)
{
mp_size_t an, bn;
mpz_urandomb (bs, rands, 32);
@@ -202,6 +202,5 @@ main (int argc, char **argv)
matrix_clear (&A);
matrix_clear (&B);
- tests_end ();
return 0;
}
diff --git a/gmp/tests/mpn/t-minvert.c b/gmp/tests/mpn/t-minvert.c
deleted file mode 100644
index ade61a1523..0000000000
--- a/gmp/tests/mpn/t-minvert.c
+++ /dev/null
@@ -1,179 +0,0 @@
-/* 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;
-}
diff --git a/gmp/tests/mpn/t-mod_1.c b/gmp/tests/mpn/t-mod_1.c
deleted file mode 100644
index 3d08a9018f..0000000000
--- a/gmp/tests/mpn/t-mod_1.c
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Test mpn_mod_1 variants.
-
-Copyright 2010, 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 <stdio.h>
-#include <stdlib.h>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-static void
-check_one (mp_srcptr ap, mp_size_t n, mp_limb_t b)
-{
- mp_limb_t r_ref = refmpn_mod_1 (ap, n, b);
- mp_limb_t r;
-
- if (n >= 2)
- {
- mp_limb_t pre[4];
- mpn_mod_1_1p_cps (pre, b);
- r = mpn_mod_1_1p (ap, n, b << pre[1], pre);
- if (r != r_ref)
- {
- printf ("mpn_mod_1_1p failed\n");
- goto fail;
- }
- }
- if ((b & GMP_NUMB_HIGHBIT) == 0)
- {
- mp_limb_t pre[5];
- mpn_mod_1s_2p_cps (pre, b);
- r = mpn_mod_1s_2p (ap, n, b << pre[1], pre);
- if (r != r_ref)
- {
- printf ("mpn_mod_1s_2p failed\n");
- goto fail;
- }
- }
- if (b <= GMP_NUMB_MASK / 3)
- {
- mp_limb_t pre[6];
- mpn_mod_1s_3p_cps (pre, b);
- r = mpn_mod_1s_3p (ap, n, b << pre[1], pre);
- if (r != r_ref)
- {
- printf ("mpn_mod_1s_3p failed\n");
- goto fail;
- }
- }
- if (b <= GMP_NUMB_MASK / 4)
- {
- mp_limb_t pre[7];
- mpn_mod_1s_4p_cps (pre, b);
- r = mpn_mod_1s_4p (ap, n, b << pre[1], pre);
- if (r != r_ref)
- {
- printf ("mpn_mod_1s_4p failed\n");
- goto fail;
- }
- }
- r = mpn_mod_1 (ap, n, b);
- if (r != r_ref)
- {
- printf ("mpn_mod_1 failed\n");
- fail:
- printf ("an = %d, a: ", (int) n); mpn_dump (ap, n);
- printf ("b : "); mpn_dump (&b, 1);
- printf ("r (expected): "); mpn_dump (&r_ref, 1);
- printf ("r (bad) : "); mpn_dump (&r, 1);
- abort();
- }
-}
-
-int
-main (int argc, char **argv)
-{
- gmp_randstate_ptr rands;
- int i;
- unsigned a_bits;
- unsigned b_bits;
- mpz_t a;
- mpz_t b;
-
- tests_start ();
- rands = RANDS;
- mpz_init (a);
- mpz_init (b);
-
- for (i = 0; i < 300; i++)
- {
- mp_size_t asize;
- a_bits = 1 + gmp_urandomm_ui (rands, 1000);
- b_bits = 1 + gmp_urandomm_ui (rands, GMP_NUMB_BITS);
-
- mpz_rrandomb (a, rands, a_bits);
- mpz_rrandomb (b, rands, b_bits);
-
- asize = SIZ(a);
- if (!asize)
- asize = 1;
- if (mpz_sgn (b) == 0)
- mpz_set_ui (b, 1);
-
- check_one (PTR(a), asize, PTR(b)[0]);
- }
-
- mpz_clear (a);
- mpz_clear (b);
-
- tests_end ();
- return 0;
-}
-
diff --git a/gmp/tests/mpn/t-mp_bases.c b/gmp/tests/mpn/t-mp_bases.c
index c0b228825a..17950ecb4e 100644
--- a/gmp/tests/mpn/t-mp_bases.c
+++ b/gmp/tests/mpn/t-mp_bases.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpn/t-mul.c b/gmp/tests/mpn/t-mul.c
deleted file mode 100644
index 26e4227334..0000000000
--- a/gmp/tests/mpn/t-mul.c
+++ /dev/null
@@ -1,101 +0,0 @@
-/* Test mpn_mul function for all sizes up to a selected limit.
-
-Copyright 2011, 2012 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"
-
-static unsigned
-isqrt (unsigned t)
-{
- unsigned s, b;
-
- for (b = 0, s = t; b++, s >>= 1; )
- ;
-
- s = 1 << (b >> 1);
- if (b & 1)
- s += s >> 1;
-
- do
- {
- b = t / s;
- s = (s + b) >> 1;
- }
- while (b < s);
-
- return s;
-}
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ap, bp, rp, refp;
- mp_size_t max_n, an, bn, rn;
- gmp_randstate_ptr rands;
- int reps;
- TMP_DECL;
- TMP_MARK;
-
- reps = 1;
-
- tests_start ();
- TESTS_REPS (reps, argv, argc);
-
- rands = RANDS;
-
- /* Re-interpret reps argument as a size argument. */
- max_n = isqrt (reps * 25000);
-
- ap = TMP_ALLOC_LIMBS (max_n + 1);
- bp = TMP_ALLOC_LIMBS (max_n + 1);
- rp = TMP_ALLOC_LIMBS (2 * max_n);
- refp = TMP_ALLOC_LIMBS (2 * max_n);
-
- for (an = 1; an <= max_n; an += 1)
- {
- for (bn = 1; bn <= an; bn += 1)
- {
- mpn_random2 (ap, an + 1);
- mpn_random2 (bp, bn + 1);
-
- refmpn_mul (refp, ap, an, bp, bn);
- mpn_mul (rp, ap, an, bp, bn);
-
- rn = an + bn;
- if (mpn_cmp (refp, rp, rn))
- {
- printf ("ERROR, an = %d, bn = %d, rn = %d\n",
- (int) an, (int) bn, (int) rn);
- printf ("a: "); mpn_dump (ap, an);
- printf ("b: "); mpn_dump (bp, bn);
- printf ("r: "); mpn_dump (rp, rn);
- printf ("ref: "); mpn_dump (refp, rn);
- abort();
- }
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-mullo.c b/gmp/tests/mpn/t-mullo.c
deleted file mode 100644
index d4789976ac..0000000000
--- a/gmp/tests/mpn/t-mullo.c
+++ /dev/null
@@ -1,142 +0,0 @@
-/* Test for mullo function.
-
-Copyright 2009 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"
-
-/* Sizes are up to 2^SIZE_LOG limbs */
-#ifndef SIZE_LOG
-#define SIZE_LOG 10
-#endif
-
-#ifndef COUNT
-#define COUNT 10000
-#endif
-
-#define MAX_N (1L << SIZE_LOG)
-#define MIN_N (1)
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ap, bp, refp, pp, scratch;
- int count = COUNT;
- int test;
- gmp_randstate_ptr rands;
- TMP_DECL;
- TMP_MARK;
-
- 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 ();
- rands = RANDS;
-
-#define mpn_mullo_itch(n) (0)
-
- ap = TMP_ALLOC_LIMBS (MAX_N);
- bp = TMP_ALLOC_LIMBS (MAX_N);
- refp = TMP_ALLOC_LIMBS (MAX_N * 2);
- pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
- scratch
- = 1+TMP_ALLOC_LIMBS (mpn_mullo_itch (MAX_N) + 2);
-
- for (test = 0; test < count; test++)
- {
- unsigned size_min;
- unsigned size_range;
- mp_size_t n;
- mp_size_t itch;
- mp_limb_t p_before, p_after, s_before, s_after;
-
- for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
- ;
-
- /* We generate an in the MIN_N <= n <= (1 << size_range). */
- size_range = size_min
- + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
-
- n = MIN_N
- + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
-
- mpn_random2 (ap, n);
- mpn_random2 (bp, n);
- mpn_random2 (pp-1, n + 2);
- p_before = pp[-1];
- p_after = pp[n];
-
- itch = mpn_mullo_itch (n);
- ASSERT_ALWAYS (itch <= mpn_mullo_itch (MAX_N));
- mpn_random2 (scratch-1, itch+2);
- s_before = scratch[-1];
- s_after = scratch[itch];
-
- mpn_mullo_n (pp, ap, bp, n);
- mpn_mul_n (refp, ap, bp, n);
- if (pp[-1] != p_before || pp[n] != p_after
- || scratch[-1] != s_before || scratch[itch] != s_after
- || mpn_cmp (refp, pp, n) != 0)
- {
- printf ("ERROR in test %d, n = %d",
- test, (int) n);
- if (pp[-1] != p_before)
- {
- printf ("before pp:"); mpn_dump (pp -1, 1);
- printf ("keep: "); mpn_dump (&p_before, 1);
- }
- if (pp[n] != p_after)
- {
- printf ("after pp:"); mpn_dump (pp + n, 1);
- printf ("keep: "); mpn_dump (&p_after, 1);
- }
- if (scratch[-1] != s_before)
- {
- printf ("before scratch:"); mpn_dump (scratch-1, 1);
- printf ("keep: "); mpn_dump (&s_before, 1);
- }
- if (scratch[itch] != s_after)
- {
- printf ("after scratch:"); mpn_dump (scratch + itch, 1);
- printf ("keep: "); mpn_dump (&s_after, 1);
- }
- mpn_dump (ap, n);
- mpn_dump (bp, n);
- mpn_dump (pp, n);
- mpn_dump (refp, n);
-
- abort();
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-mulmid.c b/gmp/tests/mpn/t-mulmid.c
deleted file mode 100644
index 8978c4c1fd..0000000000
--- a/gmp/tests/mpn/t-mulmid.c
+++ /dev/null
@@ -1,93 +0,0 @@
-/* Test for mulmid function.
-
-Copyright 2011 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"
-
-/* Sizes are up to 2^SIZE_LOG limbs */
-#ifndef SIZE_LOG
-#define SIZE_LOG 9
-#endif
-
-#ifndef COUNT
-#define COUNT 5000
-#endif
-
-#define MAX_N (1L << SIZE_LOG)
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ap, bp, rp, refp;
- gmp_randstate_ptr rands;
- int test;
- TMP_DECL;
- TMP_MARK;
-
- tests_start ();
- rands = RANDS;
-
- ap = TMP_ALLOC_LIMBS (MAX_N);
- bp = TMP_ALLOC_LIMBS (MAX_N);
- rp = TMP_ALLOC_LIMBS (MAX_N + 2);
- refp = TMP_ALLOC_LIMBS (MAX_N + 2);
-
- for (test = 0; test < COUNT; test++)
- {
- mp_size_t an, bn, rn;
- unsigned size_log;
-
- size_log = 1 + gmp_urandomm_ui (rands, SIZE_LOG);
- an = 1 + gmp_urandomm_ui(rands, 1L << size_log);
-
- size_log = 1 + gmp_urandomm_ui (rands, SIZE_LOG);
- bn = 1 + gmp_urandomm_ui(rands, 1L << size_log);
-
- /* Make sure an >= bn */
- if (an < bn)
- MP_SIZE_T_SWAP (an, bn);
-
- mpn_random2 (ap, an);
- mpn_random2 (bp, bn);
-
- refmpn_mulmid (refp, ap, an, bp, bn);
- mpn_mulmid (rp, ap, an, bp, bn);
-
- rn = an + 3 - bn;
- if (mpn_cmp (refp, rp, rn))
- {
- printf ("ERROR in test %d, an = %d, bn = %d, rn = %d\n",
- 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);
- printf("ref: "); mpn_dump (refp, rn);
-
- abort();
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-mulmod_bnm1.c b/gmp/tests/mpn/t-mulmod_bnm1.c
deleted file mode 100644
index 374b722c6b..0000000000
--- a/gmp/tests/mpn/t-mulmod_bnm1.c
+++ /dev/null
@@ -1,218 +0,0 @@
-/* Test for mulmod_bnm1 function.
-
- Contributed to the GNU project by Marco Bodrato.
-
-Copyright 2009 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"
-
-/* Sizes are up to 2^SIZE_LOG limbs */
-#ifndef SIZE_LOG
-#define SIZE_LOG 11
-#endif
-
-#ifndef COUNT
-#define COUNT 5000
-#endif
-
-#define MAX_N (1L << SIZE_LOG)
-#define MIN_N 1
-
-/*
- Reference function for multiplication modulo B^rn-1.
-
- The result is expected to be ZERO if and only if one of the operand
- already is. Otherwise the class [0] Mod(B^rn-1) is represented by
- B^rn-1. This should not be a problem if mulmod_bnm1 is used to
- combine results and obtain a natural number when one knows in
- advance that the final value is less than (B^rn-1).
-*/
-
-static void
-ref_mulmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an, mp_srcptr bp, mp_size_t bn)
-{
- mp_limb_t cy;
-
- ASSERT (0 < an && an <= rn);
- ASSERT (0 < bn && bn <= rn);
-
- if (an >= bn)
- refmpn_mul (rp, ap, an, bp, bn);
- else
- refmpn_mul (rp, bp, bn, ap, an);
- an += bn;
- if (an > rn) {
- cy = mpn_add (rp, rp, rn, rp + rn, an - rn);
- /* If cy == 1, then the value of rp is at most B^rn - 2, so there can
- * be no overflow when adding in the carry. */
- MPN_INCR_U (rp, rn, cy);
- }
-}
-
-/*
- Compare the result of the mpn_mulmod_bnm1 function in the library
- with the reference function above.
-*/
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ap, bp, refp, pp, scratch;
- int count = COUNT;
- int test;
- gmp_randstate_ptr rands;
- TMP_DECL;
- TMP_MARK;
-
- 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 ();
- rands = RANDS;
-
- ASSERT_ALWAYS (mpn_mulmod_bnm1_next_size (MAX_N) == MAX_N);
-
- ap = TMP_ALLOC_LIMBS (MAX_N);
- bp = TMP_ALLOC_LIMBS (MAX_N);
- refp = TMP_ALLOC_LIMBS (MAX_N * 4);
- pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
- scratch
- = 1+TMP_ALLOC_LIMBS (mpn_mulmod_bnm1_itch (MAX_N, MAX_N, MAX_N) + 2);
-
- for (test = 0; test < count; test++)
- {
- unsigned size_min;
- unsigned size_range;
- mp_size_t an,bn,rn,n;
- mp_size_t itch;
- mp_limb_t p_before, p_after, s_before, s_after;
-
- for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
- ;
-
- /* We generate an in the MIN_N <= n <= (1 << size_range). */
- size_range = size_min
- + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
-
- n = MIN_N
- + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
- n = mpn_mulmod_bnm1_next_size (n);
-
- if ( (test & 1) || n == 1) {
- /* Half of the tests are done with the main scenario in mind:
- both an and bn >= rn/2 */
- an = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1);
- bn = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1);
- } else {
- /* Second half of the tests are done using mulmod to compute a
- full product with n/2 < an+bn <= n. */
- an = 1 + gmp_urandomm_ui (rands, n - 1);
- if (an >= n/2)
- bn = 1 + gmp_urandomm_ui (rands, n - an);
- else
- bn = n/2 + 1 - an + gmp_urandomm_ui (rands, (n+1)/2);
- }
-
- /* Make sure an >= bn */
- if (an < bn)
- MP_SIZE_T_SWAP (an, bn);
-
- mpn_random2 (ap, an);
- mpn_random2 (bp, bn);
-
- /* Sometime trigger the borderline conditions
- A = -1,0,+1 or B = -1,0,+1 or A*B == -1,0,1 Mod(B^{n/2}+1).
- This only makes sense if there is at least a split, i.e. n is even. */
- if ((test & 0x1f) == 1 && (n & 1) == 0) {
- mp_size_t x;
- MPN_COPY (ap, ap + (n >> 1), an - (n >> 1));
- MPN_ZERO (ap + an - (n >> 1) , n - an);
- MPN_COPY (bp, bp + (n >> 1), bn - (n >> 1));
- MPN_ZERO (bp + bn - (n >> 1) , n - bn);
- x = (n == an) ? 0 : gmp_urandomm_ui (rands, n - an);
- ap[x] += gmp_urandomm_ui (rands, 3) - 1;
- x = (n >> 1) - x % (n >> 1);
- bp[x] += gmp_urandomm_ui (rands, 3) - 1;
- /* We don't propagate carry, this means that the desired condition
- is not triggered all the times. A few times are enough anyway. */
- }
- rn = MIN(n, an + bn);
- mpn_random2 (pp-1, rn + 2);
- p_before = pp[-1];
- p_after = pp[rn];
-
- itch = mpn_mulmod_bnm1_itch (n, an, bn);
- ASSERT_ALWAYS (itch <= mpn_mulmod_bnm1_itch (MAX_N, MAX_N, MAX_N));
- mpn_random2 (scratch-1, itch+2);
- s_before = scratch[-1];
- s_after = scratch[itch];
-
- mpn_mulmod_bnm1 ( pp, n, ap, an, bp, bn, scratch);
- ref_mulmod_bnm1 (refp, n, ap, an, bp, bn);
- if (pp[-1] != p_before || pp[rn] != p_after
- || scratch[-1] != s_before || scratch[itch] != s_after
- || mpn_cmp (refp, pp, rn) != 0)
- {
- printf ("ERROR in test %d, an = %d, bn = %d, n = %d\n",
- test, (int) an, (int) bn, (int) n);
- if (pp[-1] != p_before)
- {
- printf ("before pp:"); mpn_dump (pp -1, 1);
- printf ("keep: "); mpn_dump (&p_before, 1);
- }
- if (pp[rn] != p_after)
- {
- printf ("after pp:"); mpn_dump (pp + rn, 1);
- printf ("keep: "); mpn_dump (&p_after, 1);
- }
- if (scratch[-1] != s_before)
- {
- printf ("before scratch:"); mpn_dump (scratch-1, 1);
- printf ("keep: "); mpn_dump (&s_before, 1);
- }
- if (scratch[itch] != s_after)
- {
- printf ("after scratch:"); mpn_dump (scratch + itch, 1);
- printf ("keep: "); mpn_dump (&s_after, 1);
- }
- mpn_dump (ap, an);
- mpn_dump (bp, bn);
- mpn_dump (pp, rn);
- mpn_dump (refp, rn);
-
- abort();
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-perfsqr.c b/gmp/tests/mpn/t-perfsqr.c
index 322ab6c3a4..6afe708deb 100644
--- a/gmp/tests/mpn/t-perfsqr.c
+++ b/gmp/tests/mpn/t-perfsqr.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpn/t-scan.c b/gmp/tests/mpn/t-scan.c
index f4478af335..fc8d3cc650 100644
--- a/gmp/tests/mpn/t-scan.c
+++ b/gmp/tests/mpn/t-scan.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpn/t-sizeinbase.c b/gmp/tests/mpn/t-sizeinbase.c
deleted file mode 100644
index 0887815d8b..0000000000
--- a/gmp/tests/mpn/t-sizeinbase.c
+++ /dev/null
@@ -1,108 +0,0 @@
-/* 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;
-}
diff --git a/gmp/tests/mpn/t-sqrmod_bnm1.c b/gmp/tests/mpn/t-sqrmod_bnm1.c
deleted file mode 100644
index 47ccf81083..0000000000
--- a/gmp/tests/mpn/t-sqrmod_bnm1.c
+++ /dev/null
@@ -1,191 +0,0 @@
-/* Test for sqrmod_bnm1 function.
-
- Contributed to the GNU project by Marco Bodrato.
-
-Copyright 2009 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"
-
-/* Sizes are up to 2^SIZE_LOG limbs */
-#ifndef SIZE_LOG
-#define SIZE_LOG 12
-#endif
-
-#ifndef COUNT
-#define COUNT 3000
-#endif
-
-#define MAX_N (1L << SIZE_LOG)
-#define MIN_N 1
-
-/*
- Reference function for squaring modulo B^rn-1.
-
- The result is expected to be ZERO if and only if one of the operand
- already is. Otherwise the class [0] Mod(B^rn-1) is represented by
- B^rn-1. This should not be a problem if sqrmod_bnm1 is used to
- combine results and obtain a natural number when one knows in
- advance that the final value is less than (B^rn-1).
-*/
-
-static void
-ref_sqrmod_bnm1 (mp_ptr rp, mp_size_t rn, mp_srcptr ap, mp_size_t an)
-{
- mp_limb_t cy;
-
- ASSERT (0 < an && an <= rn);
-
- refmpn_mul (rp, ap, an, ap, an);
- an *= 2;
- if (an > rn) {
- cy = mpn_add (rp, rp, rn, rp + rn, an - rn);
- /* If cy == 1, then the value of rp is at most B^rn - 2, so there can
- * be no overflow when adding in the carry. */
- MPN_INCR_U (rp, rn, cy);
- }
-}
-
-/*
- Compare the result of the mpn_sqrmod_bnm1 function in the library
- with the reference function above.
-*/
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ap, refp, pp, scratch;
- int count = COUNT;
- int test;
- gmp_randstate_ptr rands;
- TMP_DECL;
- TMP_MARK;
-
- 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 ();
- rands = RANDS;
-
- ASSERT_ALWAYS (mpn_sqrmod_bnm1_next_size (MAX_N) == MAX_N);
-
- ap = TMP_ALLOC_LIMBS (MAX_N);
- refp = TMP_ALLOC_LIMBS (MAX_N * 4);
- pp = 1+TMP_ALLOC_LIMBS (MAX_N + 2);
- scratch
- = 1+TMP_ALLOC_LIMBS (mpn_sqrmod_bnm1_itch (MAX_N, MAX_N) + 2);
-
- for (test = 0; test < count; test++)
- {
- unsigned size_min;
- unsigned size_range;
- mp_size_t an,rn,n;
- mp_size_t itch;
- mp_limb_t p_before, p_after, s_before, s_after;
-
- for (size_min = 1; (1L << size_min) < MIN_N; size_min++)
- ;
-
- /* We generate an in the MIN_N <= n <= (1 << size_range). */
- size_range = size_min
- + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
-
- n = MIN_N
- + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_N);
- n = mpn_sqrmod_bnm1_next_size (n);
-
- if (n == 1)
- an = 1;
- else
- an = ((n+1) >> 1) + gmp_urandomm_ui (rands, (n+1) >> 1);
-
- mpn_random2 (ap, an);
-
- /* Sometime trigger the borderline conditions
- A = -1,0,+1 Mod(B^{n/2}+1).
- This only makes sense if there is at least a split, i.e. n is even. */
- if ((test & 0x1f) == 1 && (n & 1) == 0) {
- mp_size_t x;
- MPN_COPY (ap, ap + (n >> 1), an - (n >> 1));
- MPN_ZERO (ap + an - (n >> 1) , n - an);
- x = (n == an) ? 0 : gmp_urandomm_ui (rands, n - an);
- ap[x] += gmp_urandomm_ui (rands, 3) - 1;
- }
- rn = MIN(n, 2*an);
- mpn_random2 (pp-1, rn + 2);
- p_before = pp[-1];
- p_after = pp[rn];
-
- itch = mpn_sqrmod_bnm1_itch (n, an);
- ASSERT_ALWAYS (itch <= mpn_sqrmod_bnm1_itch (MAX_N, MAX_N));
- mpn_random2 (scratch-1, itch+2);
- s_before = scratch[-1];
- s_after = scratch[itch];
-
- mpn_sqrmod_bnm1 ( pp, n, ap, an, scratch);
- ref_sqrmod_bnm1 (refp, n, ap, an);
- if (pp[-1] != p_before || pp[rn] != p_after
- || scratch[-1] != s_before || scratch[itch] != s_after
- || mpn_cmp (refp, pp, rn) != 0)
- {
- printf ("ERROR in test %d, an = %d, n = %d\n",
- test, (int) an, (int) n);
- if (pp[-1] != p_before)
- {
- printf ("before pp:"); mpn_dump (pp -1, 1);
- printf ("keep: "); mpn_dump (&p_before, 1);
- }
- if (pp[rn] != p_after)
- {
- printf ("after pp:"); mpn_dump (pp + rn, 1);
- printf ("keep: "); mpn_dump (&p_after, 1);
- }
- if (scratch[-1] != s_before)
- {
- printf ("before scratch:"); mpn_dump (scratch-1, 1);
- printf ("keep: "); mpn_dump (&s_before, 1);
- }
- if (scratch[itch] != s_after)
- {
- printf ("after scratch:"); mpn_dump (scratch + itch, 1);
- printf ("keep: "); mpn_dump (&s_after, 1);
- }
- mpn_dump (ap, an);
- mpn_dump (pp, rn);
- mpn_dump (refp, rn);
-
- abort();
- }
- }
- TMP_FREE;
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/t-toom2-sqr.c b/gmp/tests/mpn/t-toom2-sqr.c
deleted file mode 100644
index a5cdcb5778..0000000000
--- a/gmp/tests/mpn/t-toom2-sqr.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#define mpn_toomN_sqr mpn_toom2_sqr
-#define mpn_toomN_sqr_itch mpn_toom2_sqr_itch
-#define MIN_AN MPN_TOOM2_SQR_MINSIZE
-#define MAX_AN SQR_TOOM3_THRESHOLD
-
-#include "toom-sqr-shared.h"
diff --git a/gmp/tests/mpn/t-toom22.c b/gmp/tests/mpn/t-toom22.c
deleted file mode 100644
index 939a88e9d8..0000000000
--- a/gmp/tests/mpn/t-toom22.c
+++ /dev/null
@@ -1,10 +0,0 @@
-#define mpn_toomMN_mul mpn_toom22_mul
-#define mpn_toomMN_mul_itch mpn_toom22_mul_itch
-#define MIN_AN 2
-
-#define MIN_BN(an) \
- ((an) >= 2*MUL_TOOM22_THRESHOLD \
- ? (an) + 2 - MUL_TOOM22_THRESHOLD \
- : ((an)+1)/2 + 1)
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom3-sqr.c b/gmp/tests/mpn/t-toom3-sqr.c
deleted file mode 100644
index ccc3b99504..0000000000
--- a/gmp/tests/mpn/t-toom3-sqr.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#define mpn_toomN_sqr mpn_toom3_sqr
-#define mpn_toomN_sqr_itch mpn_toom3_sqr_itch
-#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MPN_TOOM3_SQR_MINSIZE)
-#define MAX_AN SQR_TOOM4_THRESHOLD
-
-#include "toom-sqr-shared.h"
diff --git a/gmp/tests/mpn/t-toom32.c b/gmp/tests/mpn/t-toom32.c
deleted file mode 100644
index e42745da96..0000000000
--- a/gmp/tests/mpn/t-toom32.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom32_mul
-#define mpn_toomMN_mul_itch mpn_toom32_mul_itch
-
-#define MIN_AN 6
-#define MIN_BN(an) (((an) + 8) / (size_t) 3)
-#define MAX_BN(an) ((an) - 2)
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom33.c b/gmp/tests/mpn/t-toom33.c
deleted file mode 100644
index 7de82b20c9..0000000000
--- a/gmp/tests/mpn/t-toom33.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#define mpn_toomMN_mul mpn_toom33_mul
-#define mpn_toomMN_mul_itch mpn_toom33_mul_itch
-
-/* Smaller sizes not supported; may lead to recursive calls to
- toom22_mul with invalid input size. */
-#define MIN_AN MUL_TOOM33_THRESHOLD
-#define MIN_BN(an) (1 + 2*(((an)+2)/(size_t) 3))
-
-#define COUNT 1000
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom4-sqr.c b/gmp/tests/mpn/t-toom4-sqr.c
deleted file mode 100644
index ca14ab1482..0000000000
--- a/gmp/tests/mpn/t-toom4-sqr.c
+++ /dev/null
@@ -1,6 +0,0 @@
-#define mpn_toomN_sqr mpn_toom4_sqr
-#define mpn_toomN_sqr_itch mpn_toom4_sqr_itch
-#define MIN_AN MAX(SQR_TOOM3_THRESHOLD,MAX(SQR_TOOM4_THRESHOLD,MPN_TOOM4_SQR_MINSIZE))
-#define MAX_AN SQR_TOOM6_THRESHOLD
-
-#include "toom-sqr-shared.h"
diff --git a/gmp/tests/mpn/t-toom42.c b/gmp/tests/mpn/t-toom42.c
deleted file mode 100644
index 09a4a0c115..0000000000
--- a/gmp/tests/mpn/t-toom42.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom42_mul
-#define mpn_toomMN_mul_itch mpn_toom42_mul_itch
-
-#define MIN_AN 10
-#define MIN_BN(an) (((an) + 7) >> 2)
-#define MAX_BN(an) ((2*(an)-5) / (size_t) 3)
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom43.c b/gmp/tests/mpn/t-toom43.c
deleted file mode 100644
index 224a45bc38..0000000000
--- a/gmp/tests/mpn/t-toom43.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom43_mul
-#define mpn_toomMN_mul_itch mpn_toom43_mul_itch
-
-#define MIN_AN 25
-#define MIN_BN(an) (1 + 2*(((an)+3) >> 2))
-#define MAX_BN(an) ((an)-3)
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom44.c b/gmp/tests/mpn/t-toom44.c
deleted file mode 100644
index 6c627e3428..0000000000
--- a/gmp/tests/mpn/t-toom44.c
+++ /dev/null
@@ -1,11 +0,0 @@
-#define mpn_toomMN_mul mpn_toom44_mul
-#define mpn_toomMN_mul_itch mpn_toom44_mul_itch
-
-/* Smaller sizes not supported; may lead to recursive calls to
- toom22_mul or toom33_mul with invalid input size. */
-#define MIN_AN MUL_TOOM44_THRESHOLD
-#define MIN_BN(an) (1 + 3*(((an)+3)>>2))
-
-#define COUNT 1000
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom52.c b/gmp/tests/mpn/t-toom52.c
deleted file mode 100644
index d3fb134f2e..0000000000
--- a/gmp/tests/mpn/t-toom52.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom52_mul
-#define mpn_toomMN_mul_itch mpn_toom52_mul_itch
-
-#define MIN_AN 32
-#define MIN_BN(an) (((an) + 9) / (size_t) 5)
-#define MAX_BN(an) (((an) - 3) >> 1)
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom53.c b/gmp/tests/mpn/t-toom53.c
deleted file mode 100644
index ddbf177aec..0000000000
--- a/gmp/tests/mpn/t-toom53.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom53_mul
-#define mpn_toomMN_mul_itch mpn_toom53_mul_itch
-
-#define MIN_AN 17
-#define MIN_BN(an) (1 + 2*(((an) + 4) / (size_t) 5))
-#define MAX_BN(an) ((3*(an) - 11) >> 2)
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom54.c b/gmp/tests/mpn/t-toom54.c
deleted file mode 100644
index 52a2bee7b3..0000000000
--- a/gmp/tests/mpn/t-toom54.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom54_mul
-#define mpn_toomMN_mul_itch mpn_toom54_mul_itch
-
-#define MIN_AN 31
-#define MIN_BN(an) ((3*(an) + 32) / (size_t) 5) /* 3/5 */
-#define MAX_BN(an) ((an) - 6) /* 1/1 */
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom6-sqr.c b/gmp/tests/mpn/t-toom6-sqr.c
deleted file mode 100644
index 67d7a63d32..0000000000
--- a/gmp/tests/mpn/t-toom6-sqr.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomN_sqr mpn_toom6_sqr
-#define mpn_toomN_sqr_itch mpn_toom6_sqr_itch
-#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"
diff --git a/gmp/tests/mpn/t-toom62.c b/gmp/tests/mpn/t-toom62.c
deleted file mode 100644
index 1cb2aab26c..0000000000
--- a/gmp/tests/mpn/t-toom62.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom62_mul
-#define mpn_toomMN_mul_itch mpn_toom62_mul_itch
-
-#define MIN_AN 31
-#define MIN_BN(an) (((an) + 11) / (size_t) 6)
-#define MAX_BN(an) ((2*(an) - 7) / (size_t) 5)
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom63.c b/gmp/tests/mpn/t-toom63.c
deleted file mode 100644
index d79165dcbe..0000000000
--- a/gmp/tests/mpn/t-toom63.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomMN_mul mpn_toom63_mul
-#define mpn_toomMN_mul_itch mpn_toom63_mul_itch
-
-#define MIN_AN 49
-#define MIN_BN(an) (2*(((an) + 23) / (size_t) 6)) /* 2/6 */
-#define MAX_BN(an) ((3*(an) - 23) / (size_t) 5) /* 3/5 */
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom6h.c b/gmp/tests/mpn/t-toom6h.c
deleted file mode 100644
index 5cca9fc90e..0000000000
--- a/gmp/tests/mpn/t-toom6h.c
+++ /dev/null
@@ -1,13 +0,0 @@
-#define mpn_toomMN_mul mpn_toom6h_mul
-#define mpn_toomMN_mul_itch mpn_toom6h_mul_itch
-
-#define SIZE_LOG 11
-
-/* Smaller sizes not supported; may lead to recursive calls to
- toom22_mul, toom33_mul, or toom44_mul with invalid input size. */
-#define MIN_AN MUL_TOOM6H_MIN
-#define MIN_BN(an) (MAX ((an*3)>>3, 46))
-
-#define COUNT 1000
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/t-toom8-sqr.c b/gmp/tests/mpn/t-toom8-sqr.c
deleted file mode 100644
index 0eee605928..0000000000
--- a/gmp/tests/mpn/t-toom8-sqr.c
+++ /dev/null
@@ -1,8 +0,0 @@
-#define mpn_toomN_sqr mpn_toom8_sqr
-#define mpn_toomN_sqr_itch mpn_toom8_sqr_itch
-#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"
diff --git a/gmp/tests/mpn/t-toom8h.c b/gmp/tests/mpn/t-toom8h.c
deleted file mode 100644
index aeeabb274b..0000000000
--- a/gmp/tests/mpn/t-toom8h.c
+++ /dev/null
@@ -1,18 +0,0 @@
-#define mpn_toomMN_mul mpn_toom8h_mul
-#define mpn_toomMN_mul_itch mpn_toom8h_mul_itch
-
-#define SIZE_LOG 11
-
-/* Smaller sizes not supported; may lead to recursive calls to
- toom{22,33,44,6h}_mul with invalid input size. */
-#define MIN_AN MUL_TOOM8H_MIN
-
-#define MIN_BN(an) \
-(MAX(GMP_NUMB_BITS <= 10*3 ? (an*6)/10 : \
- GMP_NUMB_BITS <= 11*3 ? (an*5)/11 : \
- GMP_NUMB_BITS <= 12*3 ? (an*4)/12 : \
- (an*4)/13, 86) )
-
-#define COUNT 1000
-
-#include "toom-shared.h"
diff --git a/gmp/tests/mpn/toom-shared.h b/gmp/tests/mpn/toom-shared.h
deleted file mode 100644
index 7479e7efd9..0000000000
--- a/gmp/tests/mpn/toom-shared.h
+++ /dev/null
@@ -1,158 +0,0 @@
-/* Test for various Toom functions.
-
-Copyright 2009 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"
-
-/* Main file is expected to define mpn_toomMN_mul,
- * mpn_toomMN_mul_itch, MIN_AN, MIN_BN(an), MAX_BN(an) and then
- * include this file. */
-
-/* Sizes are up to 2^SIZE_LOG limbs */
-#ifndef SIZE_LOG
-#define SIZE_LOG 10
-#endif
-
-#ifndef COUNT
-#define COUNT 2000
-#endif
-
-#define MAX_AN (1L << SIZE_LOG)
-
-#ifndef MAX_BN
-#define MAX_BN(an) (an)
-#endif
-
-/* For general toomMN_mul, we need
- *
- * MIN_BN(an) = N + floor(((N-1)*an + M - N)/M)
- *
- * MAX_BN(an) = floor(N*(an-1)/(M-1)) - N + 1
- */
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ap, bp, refp, pp, scratch;
- int count = COUNT;
- int test;
- gmp_randstate_ptr rands;
- TMP_DECL;
- TMP_MARK;
-
- 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 ();
- rands = RANDS;
-
- ap = TMP_ALLOC_LIMBS (MAX_AN);
- bp = TMP_ALLOC_LIMBS (MAX_BN(MAX_AN));
- refp = TMP_ALLOC_LIMBS (MAX_AN + MAX_BN(MAX_AN));
- pp = 1+TMP_ALLOC_LIMBS (MAX_AN + MAX_BN(MAX_AN)+2);
- scratch
- = 1+TMP_ALLOC_LIMBS (mpn_toomMN_mul_itch (MAX_AN, MAX_BN(MAX_AN))
- + 2);
-
- for (test = 0; test < count; test++)
- {
- unsigned size_min;
- unsigned size_range;
- mp_size_t an, bn;
- mp_size_t itch;
- mp_limb_t p_before, p_after, s_before, s_after;
-
- for (size_min = 1; (1L << size_min) < MIN_AN; size_min++)
- ;
-
- /* We generate an in the MIN_AN <= an <= (1 << size_range). */
- size_range = size_min
- + gmp_urandomm_ui (rands, SIZE_LOG + 1 - size_min);
-
- an = MIN_AN
- + gmp_urandomm_ui (rands, (1L << size_range) + 1 - MIN_AN);
- bn = MIN_BN(an)
- + gmp_urandomm_ui (rands, MAX_BN(an) + 1 - MIN_BN(an));
-
- mpn_random2 (ap, an);
- mpn_random2 (bp, bn);
- mpn_random2 (pp-1, an + bn + 2);
- p_before = pp[-1];
- p_after = pp[an + bn];
-
- itch = mpn_toomMN_mul_itch (an, bn);
- ASSERT_ALWAYS (itch <= mpn_toomMN_mul_itch (MAX_AN, MAX_BN(MAX_AN)));
- mpn_random2 (scratch-1, itch+2);
- s_before = scratch[-1];
- s_after = scratch[itch];
-
- mpn_toomMN_mul (pp, ap, an, bp, bn, scratch);
- refmpn_mul (refp, ap, an, bp, bn);
- if (pp[-1] != p_before || pp[an + bn] != p_after
- || scratch[-1] != s_before || scratch[itch] != s_after
- || mpn_cmp (refp, pp, an + bn) != 0)
- {
- printf ("ERROR in test %d, an = %d, bn = %d\n",
- test, (int) an, (int) bn);
- if (pp[-1] != p_before)
- {
- printf ("before pp:"); mpn_dump (pp -1, 1);
- printf ("keep: "); mpn_dump (&p_before, 1);
- }
- if (pp[an + bn] != p_after)
- {
- printf ("after pp:"); mpn_dump (pp + an + bn, 1);
- printf ("keep: "); mpn_dump (&p_after, 1);
- }
- if (scratch[-1] != s_before)
- {
- printf ("before scratch:"); mpn_dump (scratch-1, 1);
- printf ("keep: "); mpn_dump (&s_before, 1);
- }
- if (scratch[itch] != s_after)
- {
- printf ("after scratch:"); mpn_dump (scratch + itch, 1);
- printf ("keep: "); mpn_dump (&s_after, 1);
- }
- mpn_dump (ap, an);
- mpn_dump (bp, bn);
- mpn_dump (pp, an + bn);
- mpn_dump (refp, an + bn);
-
- abort();
- }
- }
- TMP_FREE;
-
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpn/toom-sqr-shared.h b/gmp/tests/mpn/toom-sqr-shared.h
deleted file mode 100644
index 944cfab000..0000000000
--- a/gmp/tests/mpn/toom-sqr-shared.h
+++ /dev/null
@@ -1,129 +0,0 @@
-/* Test for various Toom squaring functions.
-
-Copyright 2009, 2012 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"
-
-/* Main file is expected to define mpn_toomN_mul, mpn_toomN_sqr_itch,
- * MIN_AN, MAX_AN and then include this file. */
-
-#ifndef COUNT
-#define COUNT 2000
-#endif
-
-int
-main (int argc, char **argv)
-{
- mp_ptr ap, refp, pp, scratch;
- int count = COUNT;
- int test;
- gmp_randstate_ptr rands;
- TMP_DECL;
- TMP_MARK;
-
- 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 ();
-
- if (MAX_AN > MIN_AN) {
- rands = RANDS;
-
- ap = TMP_ALLOC_LIMBS (MAX_AN);
- refp = TMP_ALLOC_LIMBS (MAX_AN * 2);
- pp = 1 + TMP_ALLOC_LIMBS (MAX_AN * 2 + 2);
- scratch
- = 1+TMP_ALLOC_LIMBS (mpn_toomN_sqr_itch (MAX_AN) + 2);
-
- for (test = 0; test < count; test++)
- {
- unsigned size_min;
- unsigned size_range;
- mp_size_t an;
- mp_size_t itch;
- mp_limb_t p_before, p_after, s_before, s_after;
-
- an = MIN_AN
- + gmp_urandomm_ui (rands, MAX_AN - MIN_AN);
-
- mpn_random2 (ap, an);
- mpn_random2 (pp-1, an * 2 + 2);
- p_before = pp[-1];
- p_after = pp[an * 2];
-
- itch = mpn_toomN_sqr_itch (an);
- ASSERT_ALWAYS (itch <= mpn_toomN_sqr_itch (MAX_AN));
- mpn_random2 (scratch-1, itch+2);
- s_before = scratch[-1];
- s_after = scratch[itch];
-
- mpn_toomN_sqr (pp, ap, an, scratch);
- refmpn_mul (refp, ap, an, ap, an);
- if (pp[-1] != p_before || pp[an * 2] != p_after
- || scratch[-1] != s_before || scratch[itch] != s_after
- || mpn_cmp (refp, pp, an * 2) != 0)
- {
- printf ("ERROR in test %d, an = %d\n",
- test, (int) an);
- if (pp[-1] != p_before)
- {
- printf ("before pp:"); mpn_dump (pp -1, 1);
- printf ("keep: "); mpn_dump (&p_before, 1);
- }
- if (pp[an * 2] != p_after)
- {
- printf ("after pp:"); mpn_dump (pp + an * 2, 1);
- printf ("keep: "); mpn_dump (&p_after, 1);
- }
- if (scratch[-1] != s_before)
- {
- printf ("before scratch:"); mpn_dump (scratch-1, 1);
- printf ("keep: "); mpn_dump (&s_before, 1);
- }
- if (scratch[itch] != s_after)
- {
- printf ("after scratch:"); mpn_dump (scratch + itch, 1);
- printf ("keep: "); mpn_dump (&s_after, 1);
- }
- mpn_dump (ap, an);
- mpn_dump (pp, an * 2);
- mpn_dump (refp, an * 2);
-
- abort();
- }
- }
- TMP_FREE;
- }
-
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpq/Makefile.am b/gmp/tests/mpq/Makefile.am
index ca8dfd9a70..57c6817f95 100644
--- a/gmp/tests/mpq/Makefile.am
+++ b/gmp/tests/mpq/Makefile.am
@@ -1,28 +1,28 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1996, 1999-2002, 2012 Free Software Foundation, Inc.
+# Copyright 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
check_PROGRAMS = t-aors t-cmp t-cmp_ui t-cmp_si t-equal t-get_d t-get_str \
- t-inp_str t-inv t-md_2exp t-set_f t-set_str io reuse
+ t-inp_str t-md_2exp t-set_f t-set_str
TESTS = $(check_PROGRAMS)
# Temporary files used by the tests. Removed automatically if the tests
diff --git a/gmp/tests/mpq/Makefile.in b/gmp/tests/mpq/Makefile.in
index 89b3c1266f..9add9e3602 100644
--- a/gmp/tests/mpq/Makefile.in
+++ b/gmp/tests/mpq/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,45 +14,33 @@
@SET_MAKE@
-# Copyright 1996, 1999-2002, 2012 Free Software Foundation, Inc.
+# Copyright 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c t-equal.c t-get_d.c t-get_str.c t-inp_str.c t-md_2exp.c t-set_f.c t-set_str.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,121 +52,95 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
check_PROGRAMS = t-aors$(EXEEXT) t-cmp$(EXEEXT) t-cmp_ui$(EXEEXT) \
t-cmp_si$(EXEEXT) t-equal$(EXEEXT) t-get_d$(EXEEXT) \
- t-get_str$(EXEEXT) t-inp_str$(EXEEXT) t-inv$(EXEEXT) \
- t-md_2exp$(EXEEXT) t-set_f$(EXEEXT) t-set_str$(EXEEXT) \
- io$(EXEEXT) reuse$(EXEEXT)
+ t-get_str$(EXEEXT) t-inp_str$(EXEEXT) t-md_2exp$(EXEEXT) \
+ t-set_f$(EXEEXT) t-set_str$(EXEEXT)
subdir = tests/mpq
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
-io_SOURCES = io.c
-io_OBJECTS = io.$(OBJEXT)
-io_LDADD = $(LDADD)
-io_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-reuse_SOURCES = reuse.c
-reuse_OBJECTS = reuse.$(OBJEXT)
-reuse_LDADD = $(LDADD)
-reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_aors_SOURCES = t-aors.c
-t_aors_OBJECTS = t-aors.$(OBJEXT)
+t_aors_OBJECTS = t-aors$U.$(OBJEXT)
t_aors_LDADD = $(LDADD)
t_aors_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_SOURCES = t-cmp.c
-t_cmp_OBJECTS = t-cmp.$(OBJEXT)
+t_cmp_OBJECTS = t-cmp$U.$(OBJEXT)
t_cmp_LDADD = $(LDADD)
t_cmp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_si_SOURCES = t-cmp_si.c
-t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT)
+t_cmp_si_OBJECTS = t-cmp_si$U.$(OBJEXT)
t_cmp_si_LDADD = $(LDADD)
t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_ui_SOURCES = t-cmp_ui.c
-t_cmp_ui_OBJECTS = t-cmp_ui.$(OBJEXT)
+t_cmp_ui_OBJECTS = t-cmp_ui$U.$(OBJEXT)
t_cmp_ui_LDADD = $(LDADD)
t_cmp_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_equal_SOURCES = t-equal.c
-t_equal_OBJECTS = t-equal.$(OBJEXT)
+t_equal_OBJECTS = t-equal$U.$(OBJEXT)
t_equal_LDADD = $(LDADD)
t_equal_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_d_SOURCES = t-get_d.c
-t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_OBJECTS = t-get_d$U.$(OBJEXT)
t_get_d_LDADD = $(LDADD)
t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_str_SOURCES = t-get_str.c
-t_get_str_OBJECTS = t-get_str.$(OBJEXT)
+t_get_str_OBJECTS = t-get_str$U.$(OBJEXT)
t_get_str_LDADD = $(LDADD)
t_get_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_inp_str_SOURCES = t-inp_str.c
-t_inp_str_OBJECTS = t-inp_str.$(OBJEXT)
+t_inp_str_OBJECTS = t-inp_str$U.$(OBJEXT)
t_inp_str_LDADD = $(LDADD)
t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_inv_SOURCES = t-inv.c
-t_inv_OBJECTS = t-inv.$(OBJEXT)
-t_inv_LDADD = $(LDADD)
-t_inv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_md_2exp_SOURCES = t-md_2exp.c
-t_md_2exp_OBJECTS = t-md_2exp.$(OBJEXT)
+t_md_2exp_OBJECTS = t-md_2exp$U.$(OBJEXT)
t_md_2exp_LDADD = $(LDADD)
t_md_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_f_SOURCES = t-set_f.c
-t_set_f_OBJECTS = t-set_f.$(OBJEXT)
+t_set_f_OBJECTS = t-set_f$U.$(OBJEXT)
t_set_f_LDADD = $(LDADD)
t_set_f_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_str_SOURCES = t-set_str.c
-t_set_str_OBJECTS = t-set_str.$(OBJEXT)
+t_set_str_OBJECTS = t-set_str$U.$(OBJEXT)
t_set_str_LDADD = $(LDADD)
t_set_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
-SOURCES = io.c reuse.c t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c \
- t-equal.c t-get_d.c t-get_str.c t-inp_str.c t-inv.c \
- t-md_2exp.c t-set_f.c t-set_str.c
-DIST_SOURCES = io.c reuse.c t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c \
- t-equal.c t-get_d.c t-get_str.c t-inp_str.c t-inv.c \
- t-md_2exp.c t-set_f.c t-set_str.c
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
+SOURCES = t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c t-equal.c t-get_d.c \
+ t-get_str.c t-inp_str.c t-md_2exp.c t-set_f.c t-set_str.c
+DIST_SOURCES = t-aors.c t-cmp.c t-cmp_si.c t-cmp_ui.c t-equal.c \
+ t-get_d.c t-get_str.c t-inp_str.c t-md_2exp.c t-set_f.c \
+ t-set_str.c
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -191,6 +152,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -206,17 +168,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -230,12 +191,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -250,26 +209,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -279,31 +232,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -327,6 +275,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -334,12 +283,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
TESTS = $(check_PROGRAMS)
@@ -356,14 +301,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpq/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -381,64 +326,57 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES) $(EXTRA_io_DEPENDENCIES)
- @rm -f io$(EXEEXT)
- $(LINK) $(io_OBJECTS) $(io_LDADD) $(LIBS)
-reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
- @rm -f reuse$(EXEEXT)
- $(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
-t-aors$(EXEEXT): $(t_aors_OBJECTS) $(t_aors_DEPENDENCIES) $(EXTRA_t_aors_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+t-aors$(EXEEXT): $(t_aors_OBJECTS) $(t_aors_DEPENDENCIES)
@rm -f t-aors$(EXEEXT)
- $(LINK) $(t_aors_OBJECTS) $(t_aors_LDADD) $(LIBS)
-t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES) $(EXTRA_t_cmp_DEPENDENCIES)
+ $(LINK) $(t_aors_LDFLAGS) $(t_aors_OBJECTS) $(t_aors_LDADD) $(LIBS)
+t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES)
@rm -f t-cmp$(EXEEXT)
- $(LINK) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS)
-t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES)
+ $(LINK) $(t_cmp_LDFLAGS) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS)
+t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES)
@rm -f t-cmp_si$(EXEEXT)
- $(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
-t-cmp_ui$(EXEEXT): $(t_cmp_ui_OBJECTS) $(t_cmp_ui_DEPENDENCIES) $(EXTRA_t_cmp_ui_DEPENDENCIES)
+ $(LINK) $(t_cmp_si_LDFLAGS) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
+t-cmp_ui$(EXEEXT): $(t_cmp_ui_OBJECTS) $(t_cmp_ui_DEPENDENCIES)
@rm -f t-cmp_ui$(EXEEXT)
- $(LINK) $(t_cmp_ui_OBJECTS) $(t_cmp_ui_LDADD) $(LIBS)
-t-equal$(EXEEXT): $(t_equal_OBJECTS) $(t_equal_DEPENDENCIES) $(EXTRA_t_equal_DEPENDENCIES)
+ $(LINK) $(t_cmp_ui_LDFLAGS) $(t_cmp_ui_OBJECTS) $(t_cmp_ui_LDADD) $(LIBS)
+t-equal$(EXEEXT): $(t_equal_OBJECTS) $(t_equal_DEPENDENCIES)
@rm -f t-equal$(EXEEXT)
- $(LINK) $(t_equal_OBJECTS) $(t_equal_LDADD) $(LIBS)
-t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ $(LINK) $(t_equal_LDFLAGS) $(t_equal_OBJECTS) $(t_equal_LDADD) $(LIBS)
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES)
@rm -f t-get_d$(EXEEXT)
- $(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
-t-get_str$(EXEEXT): $(t_get_str_OBJECTS) $(t_get_str_DEPENDENCIES) $(EXTRA_t_get_str_DEPENDENCIES)
+ $(LINK) $(t_get_d_LDFLAGS) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+t-get_str$(EXEEXT): $(t_get_str_OBJECTS) $(t_get_str_DEPENDENCIES)
@rm -f t-get_str$(EXEEXT)
- $(LINK) $(t_get_str_OBJECTS) $(t_get_str_LDADD) $(LIBS)
-t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES)
+ $(LINK) $(t_get_str_LDFLAGS) $(t_get_str_OBJECTS) $(t_get_str_LDADD) $(LIBS)
+t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES)
@rm -f t-inp_str$(EXEEXT)
- $(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
-t-inv$(EXEEXT): $(t_inv_OBJECTS) $(t_inv_DEPENDENCIES) $(EXTRA_t_inv_DEPENDENCIES)
- @rm -f t-inv$(EXEEXT)
- $(LINK) $(t_inv_OBJECTS) $(t_inv_LDADD) $(LIBS)
-t-md_2exp$(EXEEXT): $(t_md_2exp_OBJECTS) $(t_md_2exp_DEPENDENCIES) $(EXTRA_t_md_2exp_DEPENDENCIES)
+ $(LINK) $(t_inp_str_LDFLAGS) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
+t-md_2exp$(EXEEXT): $(t_md_2exp_OBJECTS) $(t_md_2exp_DEPENDENCIES)
@rm -f t-md_2exp$(EXEEXT)
- $(LINK) $(t_md_2exp_OBJECTS) $(t_md_2exp_LDADD) $(LIBS)
-t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES) $(EXTRA_t_set_f_DEPENDENCIES)
+ $(LINK) $(t_md_2exp_LDFLAGS) $(t_md_2exp_OBJECTS) $(t_md_2exp_LDADD) $(LIBS)
+t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES)
@rm -f t-set_f$(EXEEXT)
- $(LINK) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS)
-t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES) $(EXTRA_t_set_str_DEPENDENCIES)
+ $(LINK) $(t_set_f_LDFLAGS) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS)
+t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES)
@rm -f t-set_str$(EXEEXT)
- $(LINK) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS)
+ $(LINK) $(t_set_str_LDFLAGS) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -448,6 +386,34 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+t-aors_.c: t-aors.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-aors.c; then echo $(srcdir)/t-aors.c; else echo t-aors.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_.c: t-cmp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp.c; then echo $(srcdir)/t-cmp.c; else echo t-cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_si_.c: t-cmp_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_si.c; then echo $(srcdir)/t-cmp_si.c; else echo t-cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_ui_.c: t-cmp_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_ui.c; then echo $(srcdir)/t-cmp_ui.c; else echo t-cmp_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-equal_.c: t-equal.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-equal.c; then echo $(srcdir)/t-equal.c; else echo t-equal.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_d_.c: t-get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d.c; then echo $(srcdir)/t-get_d.c; else echo t-get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_str_.c: t-get_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_str.c; then echo $(srcdir)/t-get_str.c; else echo t-get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-inp_str_.c: t-inp_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-inp_str.c; then echo $(srcdir)/t-inp_str.c; else echo t-inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-md_2exp_.c: t-md_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-md_2exp.c; then echo $(srcdir)/t-md_2exp.c; else echo t-md_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_f_.c: t-set_f.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_f.c; then echo $(srcdir)/t-set_f.c; else echo t-set_f.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_str_.c: t-set_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_str.c; then echo $(srcdir)/t-set_str.c; else echo t-set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-aors_.$(OBJEXT) t-aors_.lo t-cmp_.$(OBJEXT) t-cmp_.lo \
+t-cmp_si_.$(OBJEXT) t-cmp_si_.lo t-cmp_ui_.$(OBJEXT) t-cmp_ui_.lo \
+t-equal_.$(OBJEXT) t-equal_.lo t-get_d_.$(OBJEXT) t-get_d_.lo \
+t-get_str_.$(OBJEXT) t-get_str_.lo t-inp_str_.$(OBJEXT) t-inp_str_.lo \
+t-md_2exp_.$(OBJEXT) t-md_2exp_.lo t-set_f_.$(OBJEXT) t-set_f_.lo \
+t-set_str_.$(OBJEXT) t-set_str_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -455,54 +421,54 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -510,8 +476,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -520,113 +485,91 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -646,23 +589,17 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -675,7 +612,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -683,38 +620,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -723,7 +640,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -734,28 +651,23 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/mpq/io.c b/gmp/tests/mpq/io.c
deleted file mode 100644
index a1b718d2cf..0000000000
--- a/gmp/tests/mpq/io.c
+++ /dev/null
@@ -1,137 +0,0 @@
-/* Test conversion and I/O using mpq_out_str and mpq_inp_str.
-
-Copyright 1993, 1994, 1996, 2000, 2001, 2012 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 "config.h"
-
-#include <stdio.h>
-#include <stdlib.h>
-#if HAVE_UNISTD_H
-#include <unistd.h> /* for unlink */
-#endif
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-#define FILENAME "io.tmp"
-
-void
-debug_mp (mpq_t x, int base)
-{
- mpq_out_str (stdout, base, x); fputc ('\n', stdout);
-}
-
-int
-main (int argc, char **argv)
-{
- mpq_t op1, op2;
- mp_size_t size;
- int i;
- int reps = 10000;
- FILE *fp;
- int base;
- gmp_randstate_ptr rands;
- mpz_t bs;
- unsigned long bsi, size_range;
- size_t nread;
-
- tests_start ();
- rands = RANDS;
-
- mpz_init (bs);
-
- if (argc == 2)
- reps = atoi (argv[1]);
-
- mpq_init (op1);
- mpq_init (op2);
-
- fp = fopen (FILENAME, "w+");
-
- for (i = 0; i < reps; i++)
- {
- mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 10 + 2;
-
- mpz_urandomb (bs, rands, size_range);
- size = mpz_get_ui (bs);
- mpz_errandomb (mpq_numref(op1), rands, 512L);
- mpz_errandomb_nonzero (mpq_denref(op1), rands, 512L);
- mpq_canonicalize (op1);
-
- mpz_urandomb (bs, rands, 1);
- bsi = mpz_get_ui (bs);
- if ((bsi & 1) != 0)
- mpq_neg (op1, op1);
-
- mpz_urandomb (bs, rands, 16);
- bsi = mpz_get_ui (bs);
- base = bsi % 36 + 1;
- if (base == 1)
- base = 0;
-
- rewind (fp);
- if (mpq_out_str (fp, base, op1) == 0
- || putc (' ', fp) == EOF
- || fflush (fp) != 0)
- {
- printf ("mpq_out_str write error\n");
- abort ();
- }
-
- rewind (fp);
- nread = mpq_inp_str (op2, fp, base);
- if (nread == 0)
- {
- if (ferror (fp))
- printf ("mpq_inp_str stream read error\n");
- else
- printf ("mpq_inp_str data conversion error\n");
- abort ();
- }
-
- if (nread != ftell(fp))
- {
- printf ("mpq_inp_str nread doesn't match ftell\n");
- printf (" nread %lu\n", (unsigned long) nread);
- printf (" ftell %ld\n", ftell(fp));
- abort ();
- }
-
- if (mpq_cmp (op1, op2))
- {
- printf ("ERROR\n");
- printf ("op1 = "); debug_mp (op1, -16);
- printf ("op2 = "); debug_mp (op2, -16);
- printf ("base = %d\n", base);
- abort ();
- }
- }
-
- fclose (fp);
-
- unlink (FILENAME);
-
- mpz_clear (bs);
- mpq_clear (op1);
- mpq_clear (op2);
-
- tests_end ();
- exit (0);
-}
diff --git a/gmp/tests/mpq/reuse.c b/gmp/tests/mpq/reuse.c
deleted file mode 100644
index da60bde940..0000000000
--- a/gmp/tests/mpq/reuse.c
+++ /dev/null
@@ -1,230 +0,0 @@
-/* Test that routines allow reusing a source variable as destination.
-
-Copyright 1996, 2000-2002, 2012 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>
-#include <string.h>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-#if __GMP_LIBGMP_DLL
-
-/* FIXME: When linking to a DLL libgmp, mpq_add etc can't be used as
- initializers for global variables because they're effectively global
- variables (function pointers) themselves. Perhaps calling a test
- function successively with mpq_add etc would be better. */
-
-int
-main (void)
-{
- printf ("Test suppressed for windows DLL\n");
- exit (0);
-}
-
-
-#else /* ! DLL_EXPORT */
-
-#ifndef SIZE
-#define SIZE 16
-#endif
-
-void dump_abort (const char *, mpq_t, mpq_t);
-
-typedef void (*dss_func) (mpq_ptr, mpq_srcptr, mpq_srcptr);
-
-dss_func dss_funcs[] =
-{
- mpq_div, mpq_add, mpq_mul, mpq_sub,
-};
-
-const char *dss_func_names[] =
-{
- "mpq_div", "mpq_add", "mpq_mul", "mpq_sub",
-};
-
-typedef void (*ds_func) (mpq_ptr, mpq_srcptr);
-
-ds_func ds_funcs[] =
-{
- mpq_abs, mpq_neg,
-};
-
-const char *ds_func_names[] =
-{
- "mpq_abs", "mpq_neg",
-};
-
-typedef void (*dsi_func) (mpq_ptr, mpq_srcptr, unsigned long int);
-
-dsi_func dsi_funcs[] =
-{
- mpq_mul_2exp, mpq_div_2exp
-};
-
-const char *dsi_func_names[] =
-{
- "mpq_mul_2exp", "mpq_div_2exp"
-};
-
-int
-main (int argc, char **argv)
-{
- int i;
- int pass, reps = 100;
- mpq_t in1, in2, out1;
- unsigned long int randbits, in2i;
- mpq_t res1, res2, res3;
- gmp_randstate_ptr rands;
-
- tests_start ();
-
- if (argc > 1)
- reps = strtol (argv[1], 0, 0);
-
- rands = RANDS;
-
- mpq_init (in1);
- mpq_init (in2);
- mpq_init (out1);
- mpq_init (res1);
- mpq_init (res2);
- mpq_init (res3);
-
- for (pass = 1; pass <= reps; pass++)
- {
- randbits = urandom ();
-
- if (randbits & 1)
- {
- mpq_clear (in1);
- mpq_init (in1);
- }
- randbits >>= 1;
- mpz_errandomb (mpq_numref(in1), rands, 512L);
- mpz_errandomb_nonzero (mpq_denref(in1), rands, 512L);
- if (randbits & 1)
- mpz_neg (mpq_numref(in1),mpq_numref(in1));
- randbits >>= 1;
- mpq_canonicalize (in1);
-
- if (randbits & 1)
- {
- mpq_clear (in2);
- mpq_init (in2);
- }
- randbits >>= 1;
- mpz_errandomb (mpq_numref(in2), rands, 512L);
- mpz_errandomb_nonzero (mpq_denref(in2), rands, 512L);
- if (randbits & 1)
- mpz_neg (mpq_numref(in2),mpq_numref(in2));
- randbits >>= 1;
- mpq_canonicalize (in2);
-
- for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++)
- {
- /* Don't divide by 0. */
- if (i == 0 && mpq_cmp_ui (in2, 0, 1) == 0)
- continue;
-
- if (randbits & 1)
- {
- mpq_clear (res1);
- mpq_init (res1);
- }
- randbits >>= 1;
-
- (dss_funcs[i]) (res1, in1, in2);
-
- mpq_set (out1, in1);
- (dss_funcs[i]) (out1, out1, in2);
- mpq_set (res2, out1);
-
- mpq_set (out1, in2);
- (dss_funcs[i]) (out1, in1, out1);
- mpq_set (res3, out1);
-
- if (mpq_cmp (res1, res2) != 0)
- dump_abort (dss_func_names[i], res1, res2);
- if (mpq_cmp (res1, res3) != 0)
- dump_abort (dss_func_names[i], res1, res3);
- }
-
- for (i = 0; i < sizeof (ds_funcs) / sizeof (ds_func); i++)
- {
- if (randbits & 1)
- {
- mpq_clear (res1);
- mpq_init (res1);
- }
- randbits >>= 1;
- (ds_funcs[i]) (res1, in1);
-
- mpq_set (out1, in1);
- (ds_funcs[i]) (out1, out1);
- mpq_set (res2, out1);
-
- if (mpq_cmp (res1, res2) != 0)
- dump_abort (ds_func_names[i], res1, res2);
- }
-
- in2i = urandom () % 65536;
- for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++)
- {
- if (randbits & 1)
- {
- mpq_clear (res1);
- mpq_init (res1);
- }
- randbits >>= 1;
-
- (dsi_funcs[i]) (res1, in1, in2i);
-
- mpq_set (out1, in1);
- (dsi_funcs[i]) (out1, out1, in2i);
- mpq_set (res2, out1);
-
- if (mpq_cmp (res1, res2) != 0)
- dump_abort (dsi_func_names[i], res1, res2);
- }
-
- }
-
- mpq_clear (in1);
- mpq_clear (in2);
- mpq_clear (out1);
- mpq_clear (res1);
- mpq_clear (res2);
- mpq_clear (res3);
-
- tests_end ();
- exit (0);
-}
-
-void
-dump_abort (const char *name, mpq_t res1, mpq_t res2)
-{
- printf ("failure in %s:\n", name);
- mpq_trace (" res1 ", res1);
- mpq_trace (" res2 ", res2);
- abort ();
-}
-
-#endif /* ! DLL_EXPORT */
diff --git a/gmp/tests/mpq/t-aors.c b/gmp/tests/mpq/t-aors.c
index a65f5d8ab8..df2dbe2148 100644
--- a/gmp/tests/mpq/t-aors.c
+++ b/gmp/tests/mpq/t-aors.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
diff --git a/gmp/tests/mpq/t-cmp.c b/gmp/tests/mpq/t-cmp.c
index 5858fa23c2..ac0dc72e7c 100644
--- a/gmp/tests/mpq/t-cmp.c
+++ b/gmp/tests/mpq/t-cmp.c
@@ -2,20 +2,20 @@
Copyright 1996, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -24,6 +24,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
+#define NUM(x) (&((x)->_mp_num))
+#define DEN(x) (&((x)->_mp_den))
+
#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
int
@@ -44,7 +47,7 @@ ref_mpq_cmp (mpq_t a, mpq_t b)
}
#ifndef SIZE
-#define SIZE 8 /* increasing this lowers the probability of finding an error */
+#define SIZE 8 /* increasing this lowers the probabilty of finding an error */
#endif
int
diff --git a/gmp/tests/mpq/t-cmp_si.c b/gmp/tests/mpq/t-cmp_si.c
index 15252cc7cc..89b2239bb8 100644
--- a/gmp/tests/mpq/t-cmp_si.c
+++ b/gmp/tests/mpq/t-cmp_si.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpq/t-cmp_ui.c b/gmp/tests/mpq/t-cmp_ui.c
index 9d2808393b..3768a77dd0 100644
--- a/gmp/tests/mpq/t-cmp_ui.c
+++ b/gmp/tests/mpq/t-cmp_ui.c
@@ -2,20 +2,20 @@
Copyright 1996, 1997, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -24,6 +24,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
+#define NUM(x) (&((x)->_mp_num))
+#define DEN(x) (&((x)->_mp_den))
+
#define SGN(x) ((x) < 0 ? -1 : (x) > 0 ? 1 : 0)
int
@@ -44,7 +47,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 probability of finding an error */
+#define SIZE 8 /* increasing this lowers the probabilty of finding an error */
#endif
int
@@ -87,18 +90,6 @@ 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));
diff --git a/gmp/tests/mpq/t-equal.c b/gmp/tests/mpq/t-equal.c
index 4523dd8b1e..982b143f67 100644
--- a/gmp/tests/mpq/t-equal.c
+++ b/gmp/tests/mpq/t-equal.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -125,9 +125,6 @@ check_various (void)
SET4 (x, 1,1,2,3,4, 3,88,5,6,7);
SET4 (y, 4,1,2,3,4, 3,99,5,6,7);
check_all (x, y, 0);
- SET4 (x, 4,1,2,3,4, 3,88,5,6,7);
- SET4 (y, 4,1,2,3,4, 2,99,5,6,7);
- check_all (x, y, 0);
mpq_clear (x);
mpq_clear (y);
diff --git a/gmp/tests/mpq/t-get_d.c b/gmp/tests/mpq/t-get_d.c
index aa848e029c..f116189012 100644
--- a/gmp/tests/mpq/t-get_d.c
+++ b/gmp/tests/mpq/t-get_d.c
@@ -1,22 +1,22 @@
/* Test mpq_get_d and mpq_set_d
-Copyright 1991, 1993, 1994, 1996, 2000-2003, 2012, 2013 Free Software
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002, 2003 Free Software
Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -31,7 +31,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
/* VAX D floats only have an 8 bit signed exponent, so anything 2^128 or
bigger will overflow, that being 4 limbs. */
-#if defined (__vax) || defined (__vax__) && SIZE > 4
+#if defined (__vax__) && SIZE > 4
#undef SIZE
#define SIZE 4
#define EPSIZE 3
@@ -39,7 +39,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#define EPSIZE SIZE
#endif
-void dump (mpq_t);
+void dump __GMP_PROTO ((mpq_t));
void
check_monotonic (int argc, char **argv)
@@ -153,63 +153,40 @@ my_ldexp (double d, int e)
}
}
-#define MAXEXP 500
-
-#if defined (__vax) || defined (__vax__)
-#undef MAXEXP
-#define MAXEXP 30
-#endif
-
void
check_random (int argc, char **argv)
{
- gmp_randstate_ptr rands = RANDS;
-
- double d;
+ double d, d2, nd, dd;
mpq_t q;
- mpz_t a, t;
- int exp;
-
+ mp_limb_t rp[LIMBS_PER_DOUBLE + 1];
int test, reps = 100000;
+ int i;
if (argc == 2)
reps = 100 * atoi (argv[1]);
mpq_init (q);
- mpz_init (a);
- mpz_init (t);
for (test = 0; test < reps; test++)
{
- mpz_rrandomb (a, rands, 53);
- mpz_urandomb (t, rands, 32);
- exp = mpz_get_ui (t) % (2*MAXEXP) - MAXEXP;
-
- d = my_ldexp (mpz_get_d (a), exp);
+ mpn_random2 (rp, LIMBS_PER_DOUBLE + 1);
+ d = 0.0;
+ for (i = LIMBS_PER_DOUBLE - 1; i >= 0; i--)
+ d = d * MP_BASE_AS_DOUBLE + rp[i];
+ d = my_ldexp (d, (int) (rp[LIMBS_PER_DOUBLE] % 1000) - 500);
mpq_set_d (q, d);
- /* Check that n/d = a * 2^exp, or
- d*a 2^{exp} = n */
- mpz_mul (t, a, mpq_denref (q));
- if (exp > 0)
- mpz_mul_2exp (t, t, exp);
- else
- {
- if (!mpz_divisible_2exp_p (t, -exp))
- goto fail;
- mpz_div_2exp (t, t, -exp);
- }
- if (mpz_cmp (t, mpq_numref (q)) != 0)
+ nd = mpz_get_d (mpq_numref (q));
+ dd = mpz_get_d (mpq_denref (q));
+ d2 = nd / dd;
+ if (d != d2)
{
- fail:
printf ("ERROR (check_random test %d): bad mpq_set_d results\n", test);
printf ("%.16g\n", d);
- gmp_printf ("%Qd\n", q);
+ printf ("%.16g\n", d2);
abort ();
}
}
mpq_clear (q);
- mpz_clear (t);
- mpz_clear (a);
}
void
diff --git a/gmp/tests/mpq/t-get_str.c b/gmp/tests/mpq/t-get_str.c
index c3c9dd6e91..3c52a1376f 100644
--- a/gmp/tests/mpq/t-get_str.c
+++ b/gmp/tests/mpq/t-get_str.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -65,8 +65,8 @@ check_one (mpq_srcptr q, int base, const char *want)
{
printf ("mpq_get_str wrong return value (passing non-NULL)\n");
printf (" base %d\n", base);
- printf (" got %p\n", ret);
- printf (" want %p\n", want);
+ printf (" got 0x%lX\n", (unsigned long) ret);
+ printf (" want 0x%lX\n", (unsigned long) want);
abort ();
}
if (strcmp (str, want) != 0)
diff --git a/gmp/tests/mpq/t-inp_str.c b/gmp/tests/mpq/t-inp_str.c
index 601cee3729..24d9642dcd 100644
--- a/gmp/tests/mpq/t-inp_str.c
+++ b/gmp/tests/mpq/t-inp_str.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
diff --git a/gmp/tests/mpq/t-inv.c b/gmp/tests/mpq/t-inv.c
deleted file mode 100644
index 1a0df8d728..0000000000
--- a/gmp/tests/mpq/t-inv.c
+++ /dev/null
@@ -1,61 +0,0 @@
-/* Test mpq_inv (and set/get_num/den).
-
-Copyright 2012 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 "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-int
-main (int argc, char **argv)
-{
- mpq_t a, b;
- mpz_t m, n;
- const char* s = "-420000000000000000000000";
-
- tests_start ();
-
- mpq_inits (a, b, (mpq_ptr)0);
- mpz_inits (m, n, (mpz_ptr)0);
-
- mpz_set_ui (m, 13);
- mpq_set_den (a, m);
- mpz_set_str (m, s, 0);
- mpq_set_num (a, m);
- MPQ_CHECK_FORMAT (a);
- mpq_inv (b, a);
- MPQ_CHECK_FORMAT (b);
- mpq_get_num (n, b);
- ASSERT_ALWAYS (mpz_cmp_si (n, -13) == 0);
- mpq_neg (b, b);
- mpq_inv (a, b);
- MPQ_CHECK_FORMAT (a);
- mpq_inv (b, b);
- MPQ_CHECK_FORMAT (b);
- mpq_get_den (n, b);
- ASSERT_ALWAYS (mpz_cmp_ui (n, 13) == 0);
- mpq_get_num (n, a);
- mpz_add (n, n, m);
- ASSERT_ALWAYS (mpz_sgn (n) == 0);
-
- mpq_clears (a, b, (mpq_ptr)0);
- mpz_clears (m, n, (mpz_ptr)0);
-
- tests_end ();
- return 0;
-}
diff --git a/gmp/tests/mpq/t-md_2exp.c b/gmp/tests/mpq/t-md_2exp.c
index c6e4028580..3c1f9f44ba 100644
--- a/gmp/tests/mpq/t-md_2exp.c
+++ b/gmp/tests/mpq/t-md_2exp.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -29,69 +29,8 @@ struct pair_t {
const char *den;
};
-void
-check_random ()
-{
- gmp_randstate_ptr rands;
- mpz_t bs;
- unsigned long arg_size, size_range;
- mpq_t q, r;
- int i;
- mp_bitcnt_t shift;
- int reps = 10000;
-
- rands = RANDS;
-
- mpz_init (bs);
- mpq_init (q);
- mpq_init (r);
-
- for (i = 0; i < reps; i++)
- {
- mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 11 + 2; /* 0..4096 bit operands */
-
- mpz_urandomb (bs, rands, size_range);
- arg_size = mpz_get_ui (bs);
- mpz_rrandomb (mpq_numref (q), rands, arg_size);
- do
- {
- mpz_urandomb (bs, rands, size_range);
- arg_size = mpz_get_ui (bs);
- mpz_rrandomb (mpq_denref (q), rands, arg_size);
- }
- while (mpz_sgn (mpq_denref (q)) == 0);
-
- /* We now have a random rational in q, albeit an unnormalised one. The
- lack of normalisation should not matter here, so let's save the time a
- gcd would require. */
-
- mpz_urandomb (bs, rands, 32);
- shift = mpz_get_ui (bs) % 4096;
-
- mpq_mul_2exp (r, q, shift);
-
- if (mpq_cmp (r, q) < 0)
- {
- printf ("mpq_mul_2exp wrong on random\n");
- abort ();
- }
-
- mpq_div_2exp (r, r, shift);
-
- if (mpq_cmp (r, q) != 0)
- {
- printf ("mpq_mul_2exp or mpq_div_2exp wrong on random\n");
- abort ();
- }
- }
- mpq_clear (q);
- mpq_clear (r);
- mpz_clear (bs);
-}
-
int
-main (int argc, char **argv)
+main (void)
{
static const struct {
struct pair_t left;
@@ -157,7 +96,7 @@ main (int argc, char **argv)
{ {"1","0x10000000000000000"}, 3, {"1","0x2000000000000000"} },
};
- void (*fun) (mpq_ptr, mpq_srcptr, unsigned long);
+ void (*fun) __GMP_PROTO ((mpq_ptr, mpq_srcptr, unsigned long));
const struct pair_t *p_start, *p_want;
const char *name;
mpq_t sep, got, want;
@@ -234,8 +173,6 @@ main (int argc, char **argv)
}
}
- check_random ();
-
mpq_clear (sep);
mpq_clear (got);
mpq_clear (want);
diff --git a/gmp/tests/mpq/t-set_f.c b/gmp/tests/mpq/t-set_f.c
index 76f4a68df8..2b30f5e00d 100644
--- a/gmp/tests/mpq/t-set_f.c
+++ b/gmp/tests/mpq/t-set_f.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpq/t-set_str.c b/gmp/tests/mpq/t-set_str.c
index 92cb9205a7..9f95d263bf 100644
--- a/gmp/tests/mpq/t-set_str.c
+++ b/gmp/tests/mpq/t-set_str.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/Makefile.am b/gmp/tests/mpz/Makefile.am
index 8dc5721e0a..311a53acad 100644
--- a/gmp/tests/mpz/Makefile.am
+++ b/gmp/tests/mpz/Makefile.am
@@ -1,35 +1,36 @@
## Process this file with automake to generate Makefile.in
-# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc.
+# Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2009 Free Software
+# Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
check_PROGRAMS = t-addsub t-cmp t-mul t-mul_i t-tdiv t-tdiv_ui t-fdiv \
- t-fdiv_ui t-cdiv_ui t-gcd t-gcd_ui t-lcm t-invert dive dive_ui t-sqrtrem \
- convert io t-inp_str logic bit t-powm t-powm_ui t-pow t-div_2exp reuse \
+ t-fdiv_ui t-cdiv_ui t-gcd t-gcd_ui t-lcm dive dive_ui t-sqrtrem convert io \
+ t-inp_str logic bit t-powm t-powm_ui t-pow t-div_2exp reuse \
t-root t-perfsqr t-perfpow t-jac t-bin t-get_d t-get_d_2exp t-get_si \
t-set_d t-set_si \
- t-fac_ui t-mfac_uiui t-primorial_ui t-fib_ui t-lucnum_ui t-scan t-fits \
+ t-fac_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-limbs
+ t-io_raw t-import t-export t-pprime_p t-nextprime
TESTS = $(check_PROGRAMS)
diff --git a/gmp/tests/mpz/Makefile.in b/gmp/tests/mpz/Makefile.in
index ec96613ff3..ee4c24c5a6 100644
--- a/gmp/tests/mpz/Makefile.in
+++ b/gmp/tests/mpz/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,45 +14,34 @@
@SET_MAKE@
-# Copyright 1996, 1997, 1999-2003, 2009, 2012 Free Software Foundation, Inc.
+# Copyright 1996, 1997, 1999, 2000, 2001, 2002, 2003, 2009 Free Software
+# Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c t-addsub.c t-aorsmul.c t-bin.c t-cdiv_ui.c t-cmp.c t-cmp_d.c t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c t-divis.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-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.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-root.c t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,400 +53,362 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
check_PROGRAMS = t-addsub$(EXEEXT) t-cmp$(EXEEXT) t-mul$(EXEEXT) \
t-mul_i$(EXEEXT) t-tdiv$(EXEEXT) t-tdiv_ui$(EXEEXT) \
t-fdiv$(EXEEXT) t-fdiv_ui$(EXEEXT) t-cdiv_ui$(EXEEXT) \
- t-gcd$(EXEEXT) t-gcd_ui$(EXEEXT) t-lcm$(EXEEXT) \
- t-invert$(EXEEXT) dive$(EXEEXT) dive_ui$(EXEEXT) \
- t-sqrtrem$(EXEEXT) convert$(EXEEXT) io$(EXEEXT) \
- t-inp_str$(EXEEXT) logic$(EXEEXT) bit$(EXEEXT) t-powm$(EXEEXT) \
- t-powm_ui$(EXEEXT) t-pow$(EXEEXT) t-div_2exp$(EXEEXT) \
- reuse$(EXEEXT) t-root$(EXEEXT) t-perfsqr$(EXEEXT) \
- t-perfpow$(EXEEXT) t-jac$(EXEEXT) t-bin$(EXEEXT) \
- t-get_d$(EXEEXT) t-get_d_2exp$(EXEEXT) t-get_si$(EXEEXT) \
- t-set_d$(EXEEXT) t-set_si$(EXEEXT) t-fac_ui$(EXEEXT) \
- t-mfac_uiui$(EXEEXT) t-primorial_ui$(EXEEXT) t-fib_ui$(EXEEXT) \
- t-lucnum_ui$(EXEEXT) t-scan$(EXEEXT) t-fits$(EXEEXT) \
- t-divis$(EXEEXT) t-divis_2exp$(EXEEXT) t-cong$(EXEEXT) \
- t-cong_2exp$(EXEEXT) t-sizeinbase$(EXEEXT) t-set_str$(EXEEXT) \
- t-aorsmul$(EXEEXT) t-cmp_d$(EXEEXT) t-cmp_si$(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-limbs$(EXEEXT)
+ t-gcd$(EXEEXT) t-gcd_ui$(EXEEXT) t-lcm$(EXEEXT) dive$(EXEEXT) \
+ dive_ui$(EXEEXT) t-sqrtrem$(EXEEXT) convert$(EXEEXT) \
+ io$(EXEEXT) t-inp_str$(EXEEXT) logic$(EXEEXT) bit$(EXEEXT) \
+ t-powm$(EXEEXT) t-powm_ui$(EXEEXT) t-pow$(EXEEXT) \
+ t-div_2exp$(EXEEXT) reuse$(EXEEXT) t-root$(EXEEXT) \
+ t-perfsqr$(EXEEXT) t-perfpow$(EXEEXT) t-jac$(EXEEXT) \
+ t-bin$(EXEEXT) t-get_d$(EXEEXT) t-get_d_2exp$(EXEEXT) \
+ t-get_si$(EXEEXT) t-set_d$(EXEEXT) t-set_si$(EXEEXT) \
+ t-fac_ui$(EXEEXT) t-fib_ui$(EXEEXT) t-lucnum_ui$(EXEEXT) \
+ t-scan$(EXEEXT) t-fits$(EXEEXT) t-divis$(EXEEXT) \
+ t-divis_2exp$(EXEEXT) t-cong$(EXEEXT) t-cong_2exp$(EXEEXT) \
+ t-sizeinbase$(EXEEXT) t-set_str$(EXEEXT) t-aorsmul$(EXEEXT) \
+ t-cmp_d$(EXEEXT) t-cmp_si$(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)
subdir = tests/mpz
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
bit_SOURCES = bit.c
-bit_OBJECTS = bit.$(OBJEXT)
+bit_OBJECTS = bit$U.$(OBJEXT)
bit_LDADD = $(LDADD)
bit_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
convert_SOURCES = convert.c
-convert_OBJECTS = convert.$(OBJEXT)
+convert_OBJECTS = convert$U.$(OBJEXT)
convert_LDADD = $(LDADD)
convert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
dive_SOURCES = dive.c
-dive_OBJECTS = dive.$(OBJEXT)
+dive_OBJECTS = dive$U.$(OBJEXT)
dive_LDADD = $(LDADD)
dive_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
dive_ui_SOURCES = dive_ui.c
-dive_ui_OBJECTS = dive_ui.$(OBJEXT)
+dive_ui_OBJECTS = dive_ui$U.$(OBJEXT)
dive_ui_LDADD = $(LDADD)
dive_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
io_SOURCES = io.c
-io_OBJECTS = io.$(OBJEXT)
+io_OBJECTS = io$U.$(OBJEXT)
io_LDADD = $(LDADD)
io_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
logic_SOURCES = logic.c
-logic_OBJECTS = logic.$(OBJEXT)
+logic_OBJECTS = logic$U.$(OBJEXT)
logic_LDADD = $(LDADD)
logic_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
reuse_SOURCES = reuse.c
-reuse_OBJECTS = reuse.$(OBJEXT)
+reuse_OBJECTS = reuse$U.$(OBJEXT)
reuse_LDADD = $(LDADD)
reuse_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_addsub_SOURCES = t-addsub.c
-t_addsub_OBJECTS = t-addsub.$(OBJEXT)
+t_addsub_OBJECTS = t-addsub$U.$(OBJEXT)
t_addsub_LDADD = $(LDADD)
t_addsub_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_aorsmul_SOURCES = t-aorsmul.c
-t_aorsmul_OBJECTS = t-aorsmul.$(OBJEXT)
+t_aorsmul_OBJECTS = t-aorsmul$U.$(OBJEXT)
t_aorsmul_LDADD = $(LDADD)
t_aorsmul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_bin_SOURCES = t-bin.c
-t_bin_OBJECTS = t-bin.$(OBJEXT)
+t_bin_OBJECTS = t-bin$U.$(OBJEXT)
t_bin_LDADD = $(LDADD)
t_bin_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cdiv_ui_SOURCES = t-cdiv_ui.c
-t_cdiv_ui_OBJECTS = t-cdiv_ui.$(OBJEXT)
+t_cdiv_ui_OBJECTS = t-cdiv_ui$U.$(OBJEXT)
t_cdiv_ui_LDADD = $(LDADD)
t_cdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_SOURCES = t-cmp.c
-t_cmp_OBJECTS = t-cmp.$(OBJEXT)
+t_cmp_OBJECTS = t-cmp$U.$(OBJEXT)
t_cmp_LDADD = $(LDADD)
t_cmp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_d_SOURCES = t-cmp_d.c
-t_cmp_d_OBJECTS = t-cmp_d.$(OBJEXT)
+t_cmp_d_OBJECTS = t-cmp_d$U.$(OBJEXT)
t_cmp_d_LDADD = $(LDADD)
t_cmp_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cmp_si_SOURCES = t-cmp_si.c
-t_cmp_si_OBJECTS = t-cmp_si.$(OBJEXT)
+t_cmp_si_OBJECTS = t-cmp_si$U.$(OBJEXT)
t_cmp_si_LDADD = $(LDADD)
t_cmp_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cong_SOURCES = t-cong.c
-t_cong_OBJECTS = t-cong.$(OBJEXT)
+t_cong_OBJECTS = t-cong$U.$(OBJEXT)
t_cong_LDADD = $(LDADD)
t_cong_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_cong_2exp_SOURCES = t-cong_2exp.c
-t_cong_2exp_OBJECTS = t-cong_2exp.$(OBJEXT)
+t_cong_2exp_OBJECTS = t-cong_2exp$U.$(OBJEXT)
t_cong_2exp_LDADD = $(LDADD)
t_cong_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_div_2exp_SOURCES = t-div_2exp.c
-t_div_2exp_OBJECTS = t-div_2exp.$(OBJEXT)
+t_div_2exp_OBJECTS = t-div_2exp$U.$(OBJEXT)
t_div_2exp_LDADD = $(LDADD)
t_div_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_divis_SOURCES = t-divis.c
-t_divis_OBJECTS = t-divis.$(OBJEXT)
+t_divis_OBJECTS = t-divis$U.$(OBJEXT)
t_divis_LDADD = $(LDADD)
t_divis_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_divis_2exp_SOURCES = t-divis_2exp.c
-t_divis_2exp_OBJECTS = t-divis_2exp.$(OBJEXT)
+t_divis_2exp_OBJECTS = t-divis_2exp$U.$(OBJEXT)
t_divis_2exp_LDADD = $(LDADD)
t_divis_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_export_SOURCES = t-export.c
-t_export_OBJECTS = t-export.$(OBJEXT)
+t_export_OBJECTS = t-export$U.$(OBJEXT)
t_export_LDADD = $(LDADD)
t_export_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_fac_ui_SOURCES = t-fac_ui.c
-t_fac_ui_OBJECTS = t-fac_ui.$(OBJEXT)
+t_fac_ui_OBJECTS = t-fac_ui$U.$(OBJEXT)
t_fac_ui_LDADD = $(LDADD)
t_fac_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_fdiv_SOURCES = t-fdiv.c
-t_fdiv_OBJECTS = t-fdiv.$(OBJEXT)
+t_fdiv_OBJECTS = t-fdiv$U.$(OBJEXT)
t_fdiv_LDADD = $(LDADD)
t_fdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_fdiv_ui_SOURCES = t-fdiv_ui.c
-t_fdiv_ui_OBJECTS = t-fdiv_ui.$(OBJEXT)
+t_fdiv_ui_OBJECTS = t-fdiv_ui$U.$(OBJEXT)
t_fdiv_ui_LDADD = $(LDADD)
t_fdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_fib_ui_SOURCES = t-fib_ui.c
-t_fib_ui_OBJECTS = t-fib_ui.$(OBJEXT)
+t_fib_ui_OBJECTS = t-fib_ui$U.$(OBJEXT)
t_fib_ui_LDADD = $(LDADD)
t_fib_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_fits_SOURCES = t-fits.c
-t_fits_OBJECTS = t-fits.$(OBJEXT)
+t_fits_OBJECTS = t-fits$U.$(OBJEXT)
t_fits_LDADD = $(LDADD)
t_fits_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_gcd_SOURCES = t-gcd.c
-t_gcd_OBJECTS = t-gcd.$(OBJEXT)
+t_gcd_OBJECTS = t-gcd$U.$(OBJEXT)
t_gcd_LDADD = $(LDADD)
t_gcd_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_gcd_ui_SOURCES = t-gcd_ui.c
-t_gcd_ui_OBJECTS = t-gcd_ui.$(OBJEXT)
+t_gcd_ui_OBJECTS = t-gcd_ui$U.$(OBJEXT)
t_gcd_ui_LDADD = $(LDADD)
t_gcd_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_d_SOURCES = t-get_d.c
-t_get_d_OBJECTS = t-get_d.$(OBJEXT)
+t_get_d_OBJECTS = t-get_d$U.$(OBJEXT)
t_get_d_LDADD = $(LDADD)
t_get_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_d_2exp_SOURCES = t-get_d_2exp.c
-t_get_d_2exp_OBJECTS = t-get_d_2exp.$(OBJEXT)
+t_get_d_2exp_OBJECTS = t-get_d_2exp$U.$(OBJEXT)
t_get_d_2exp_LDADD = $(LDADD)
t_get_d_2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_get_si_SOURCES = t-get_si.c
-t_get_si_OBJECTS = t-get_si.$(OBJEXT)
+t_get_si_OBJECTS = t-get_si$U.$(OBJEXT)
t_get_si_LDADD = $(LDADD)
t_get_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_hamdist_SOURCES = t-hamdist.c
-t_hamdist_OBJECTS = t-hamdist.$(OBJEXT)
+t_hamdist_OBJECTS = t-hamdist$U.$(OBJEXT)
t_hamdist_LDADD = $(LDADD)
t_hamdist_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_import_SOURCES = t-import.c
-t_import_OBJECTS = t-import.$(OBJEXT)
+t_import_OBJECTS = t-import$U.$(OBJEXT)
t_import_LDADD = $(LDADD)
t_import_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_inp_str_SOURCES = t-inp_str.c
-t_inp_str_OBJECTS = t-inp_str.$(OBJEXT)
+t_inp_str_OBJECTS = t-inp_str$U.$(OBJEXT)
t_inp_str_LDADD = $(LDADD)
t_inp_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_invert_SOURCES = t-invert.c
-t_invert_OBJECTS = t-invert.$(OBJEXT)
-t_invert_LDADD = $(LDADD)
-t_invert_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_io_raw_SOURCES = t-io_raw.c
-t_io_raw_OBJECTS = t-io_raw.$(OBJEXT)
+t_io_raw_OBJECTS = t-io_raw$U.$(OBJEXT)
t_io_raw_LDADD = $(LDADD)
t_io_raw_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_jac_SOURCES = t-jac.c
-t_jac_OBJECTS = t-jac.$(OBJEXT)
+t_jac_OBJECTS = t-jac$U.$(OBJEXT)
t_jac_LDADD = $(LDADD)
t_jac_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_lcm_SOURCES = t-lcm.c
-t_lcm_OBJECTS = t-lcm.$(OBJEXT)
+t_lcm_OBJECTS = t-lcm$U.$(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_OBJECTS = t-lucnum_ui$U.$(OBJEXT)
t_lucnum_ui_LDADD = $(LDADD)
t_lucnum_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_mfac_uiui_SOURCES = t-mfac_uiui.c
-t_mfac_uiui_OBJECTS = t-mfac_uiui.$(OBJEXT)
-t_mfac_uiui_LDADD = $(LDADD)
-t_mfac_uiui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_mul_SOURCES = t-mul.c
-t_mul_OBJECTS = t-mul.$(OBJEXT)
+t_mul_OBJECTS = t-mul$U.$(OBJEXT)
t_mul_LDADD = $(LDADD)
t_mul_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_mul_i_SOURCES = t-mul_i.c
-t_mul_i_OBJECTS = t-mul_i.$(OBJEXT)
+t_mul_i_OBJECTS = t-mul_i$U.$(OBJEXT)
t_mul_i_LDADD = $(LDADD)
t_mul_i_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_nextprime_SOURCES = t-nextprime.c
-t_nextprime_OBJECTS = t-nextprime.$(OBJEXT)
+t_nextprime_OBJECTS = t-nextprime$U.$(OBJEXT)
t_nextprime_LDADD = $(LDADD)
t_nextprime_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_oddeven_SOURCES = t-oddeven.c
-t_oddeven_OBJECTS = t-oddeven.$(OBJEXT)
+t_oddeven_OBJECTS = t-oddeven$U.$(OBJEXT)
t_oddeven_LDADD = $(LDADD)
t_oddeven_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_perfpow_SOURCES = t-perfpow.c
-t_perfpow_OBJECTS = t-perfpow.$(OBJEXT)
+t_perfpow_OBJECTS = t-perfpow$U.$(OBJEXT)
t_perfpow_LDADD = $(LDADD)
t_perfpow_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_perfsqr_SOURCES = t-perfsqr.c
-t_perfsqr_OBJECTS = t-perfsqr.$(OBJEXT)
+t_perfsqr_OBJECTS = t-perfsqr$U.$(OBJEXT)
t_perfsqr_LDADD = $(LDADD)
t_perfsqr_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_popcount_SOURCES = t-popcount.c
-t_popcount_OBJECTS = t-popcount.$(OBJEXT)
+t_popcount_OBJECTS = t-popcount$U.$(OBJEXT)
t_popcount_LDADD = $(LDADD)
t_popcount_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_pow_SOURCES = t-pow.c
-t_pow_OBJECTS = t-pow.$(OBJEXT)
+t_pow_OBJECTS = t-pow$U.$(OBJEXT)
t_pow_LDADD = $(LDADD)
t_pow_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_powm_SOURCES = t-powm.c
-t_powm_OBJECTS = t-powm.$(OBJEXT)
+t_powm_OBJECTS = t-powm$U.$(OBJEXT)
t_powm_LDADD = $(LDADD)
t_powm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_powm_ui_SOURCES = t-powm_ui.c
-t_powm_ui_OBJECTS = t-powm_ui.$(OBJEXT)
+t_powm_ui_OBJECTS = t-powm_ui$U.$(OBJEXT)
t_powm_ui_LDADD = $(LDADD)
t_powm_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_pprime_p_SOURCES = t-pprime_p.c
-t_pprime_p_OBJECTS = t-pprime_p.$(OBJEXT)
+t_pprime_p_OBJECTS = t-pprime_p$U.$(OBJEXT)
t_pprime_p_LDADD = $(LDADD)
t_pprime_p_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-t_primorial_ui_SOURCES = t-primorial_ui.c
-t_primorial_ui_OBJECTS = t-primorial_ui.$(OBJEXT)
-t_primorial_ui_LDADD = $(LDADD)
-t_primorial_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
-t_remove_SOURCES = t-remove.c
-t_remove_OBJECTS = t-remove.$(OBJEXT)
-t_remove_LDADD = $(LDADD)
-t_remove_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
- $(top_builddir)/libgmp.la
t_root_SOURCES = t-root.c
-t_root_OBJECTS = t-root.$(OBJEXT)
+t_root_OBJECTS = t-root$U.$(OBJEXT)
t_root_LDADD = $(LDADD)
t_root_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_scan_SOURCES = t-scan.c
-t_scan_OBJECTS = t-scan.$(OBJEXT)
+t_scan_OBJECTS = t-scan$U.$(OBJEXT)
t_scan_LDADD = $(LDADD)
t_scan_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_d_SOURCES = t-set_d.c
-t_set_d_OBJECTS = t-set_d.$(OBJEXT)
+t_set_d_OBJECTS = t-set_d$U.$(OBJEXT)
t_set_d_LDADD = $(LDADD)
t_set_d_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_f_SOURCES = t-set_f.c
-t_set_f_OBJECTS = t-set_f.$(OBJEXT)
+t_set_f_OBJECTS = t-set_f$U.$(OBJEXT)
t_set_f_LDADD = $(LDADD)
t_set_f_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_si_SOURCES = t-set_si.c
-t_set_si_OBJECTS = t-set_si.$(OBJEXT)
+t_set_si_OBJECTS = t-set_si$U.$(OBJEXT)
t_set_si_LDADD = $(LDADD)
t_set_si_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_set_str_SOURCES = t-set_str.c
-t_set_str_OBJECTS = t-set_str.$(OBJEXT)
+t_set_str_OBJECTS = t-set_str$U.$(OBJEXT)
t_set_str_LDADD = $(LDADD)
t_set_str_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_sizeinbase_SOURCES = t-sizeinbase.c
-t_sizeinbase_OBJECTS = t-sizeinbase.$(OBJEXT)
+t_sizeinbase_OBJECTS = t-sizeinbase$U.$(OBJEXT)
t_sizeinbase_LDADD = $(LDADD)
t_sizeinbase_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_sqrtrem_SOURCES = t-sqrtrem.c
-t_sqrtrem_OBJECTS = t-sqrtrem.$(OBJEXT)
+t_sqrtrem_OBJECTS = t-sqrtrem$U.$(OBJEXT)
t_sqrtrem_LDADD = $(LDADD)
t_sqrtrem_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_tdiv_SOURCES = t-tdiv.c
-t_tdiv_OBJECTS = t-tdiv.$(OBJEXT)
+t_tdiv_OBJECTS = t-tdiv$U.$(OBJEXT)
t_tdiv_LDADD = $(LDADD)
t_tdiv_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_tdiv_ui_SOURCES = t-tdiv_ui.c
-t_tdiv_ui_OBJECTS = t-tdiv_ui.$(OBJEXT)
+t_tdiv_ui_OBJECTS = t-tdiv_ui$U.$(OBJEXT)
t_tdiv_ui_LDADD = $(LDADD)
t_tdiv_ui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c \
t-addsub.c t-aorsmul.c t-bin.c t-cdiv_ui.c t-cmp.c t-cmp_d.c \
t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c t-divis.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-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 \
- t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c \
- t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c
+ t-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.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-root.c t-scan.c \
+ t-set_d.c t-set_f.c t-set_si.c t-set_str.c t-sizeinbase.c \
+ t-sqrtrem.c t-tdiv.c t-tdiv_ui.c
DIST_SOURCES = bit.c convert.c dive.c dive_ui.c io.c logic.c reuse.c \
t-addsub.c t-aorsmul.c t-bin.c t-cdiv_ui.c t-cmp.c t-cmp_d.c \
t-cmp_si.c t-cong.c t-cong_2exp.c t-div_2exp.c t-divis.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-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 \
- t-scan.c t-set_d.c t-set_f.c t-set_si.c t-set_str.c \
- t-sizeinbase.c t-sqrtrem.c t-tdiv.c t-tdiv_ui.c
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
+ t-io_raw.c t-jac.c t-lcm.c t-lucnum_ui.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-root.c t-scan.c \
+ t-set_d.c t-set_f.c t-set_si.c t-set_str.c t-sizeinbase.c \
+ t-sqrtrem.c t-tdiv.c t-tdiv_ui.c
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -470,6 +420,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -485,17 +436,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -509,12 +459,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -529,26 +477,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -558,31 +500,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -606,6 +543,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -613,12 +551,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
TESTS = $(check_PROGRAMS)
@@ -635,14 +569,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/mpz/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -660,211 +594,198 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-bit$(EXEEXT): $(bit_OBJECTS) $(bit_DEPENDENCIES) $(EXTRA_bit_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+bit$(EXEEXT): $(bit_OBJECTS) $(bit_DEPENDENCIES)
@rm -f bit$(EXEEXT)
- $(LINK) $(bit_OBJECTS) $(bit_LDADD) $(LIBS)
-convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES) $(EXTRA_convert_DEPENDENCIES)
+ $(LINK) $(bit_LDFLAGS) $(bit_OBJECTS) $(bit_LDADD) $(LIBS)
+convert$(EXEEXT): $(convert_OBJECTS) $(convert_DEPENDENCIES)
@rm -f convert$(EXEEXT)
- $(LINK) $(convert_OBJECTS) $(convert_LDADD) $(LIBS)
-dive$(EXEEXT): $(dive_OBJECTS) $(dive_DEPENDENCIES) $(EXTRA_dive_DEPENDENCIES)
+ $(LINK) $(convert_LDFLAGS) $(convert_OBJECTS) $(convert_LDADD) $(LIBS)
+dive$(EXEEXT): $(dive_OBJECTS) $(dive_DEPENDENCIES)
@rm -f dive$(EXEEXT)
- $(LINK) $(dive_OBJECTS) $(dive_LDADD) $(LIBS)
-dive_ui$(EXEEXT): $(dive_ui_OBJECTS) $(dive_ui_DEPENDENCIES) $(EXTRA_dive_ui_DEPENDENCIES)
+ $(LINK) $(dive_LDFLAGS) $(dive_OBJECTS) $(dive_LDADD) $(LIBS)
+dive_ui$(EXEEXT): $(dive_ui_OBJECTS) $(dive_ui_DEPENDENCIES)
@rm -f dive_ui$(EXEEXT)
- $(LINK) $(dive_ui_OBJECTS) $(dive_ui_LDADD) $(LIBS)
-io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES) $(EXTRA_io_DEPENDENCIES)
+ $(LINK) $(dive_ui_LDFLAGS) $(dive_ui_OBJECTS) $(dive_ui_LDADD) $(LIBS)
+io$(EXEEXT): $(io_OBJECTS) $(io_DEPENDENCIES)
@rm -f io$(EXEEXT)
- $(LINK) $(io_OBJECTS) $(io_LDADD) $(LIBS)
-logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES) $(EXTRA_logic_DEPENDENCIES)
+ $(LINK) $(io_LDFLAGS) $(io_OBJECTS) $(io_LDADD) $(LIBS)
+logic$(EXEEXT): $(logic_OBJECTS) $(logic_DEPENDENCIES)
@rm -f logic$(EXEEXT)
- $(LINK) $(logic_OBJECTS) $(logic_LDADD) $(LIBS)
-reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES) $(EXTRA_reuse_DEPENDENCIES)
+ $(LINK) $(logic_LDFLAGS) $(logic_OBJECTS) $(logic_LDADD) $(LIBS)
+reuse$(EXEEXT): $(reuse_OBJECTS) $(reuse_DEPENDENCIES)
@rm -f reuse$(EXEEXT)
- $(LINK) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
-t-addsub$(EXEEXT): $(t_addsub_OBJECTS) $(t_addsub_DEPENDENCIES) $(EXTRA_t_addsub_DEPENDENCIES)
+ $(LINK) $(reuse_LDFLAGS) $(reuse_OBJECTS) $(reuse_LDADD) $(LIBS)
+t-addsub$(EXEEXT): $(t_addsub_OBJECTS) $(t_addsub_DEPENDENCIES)
@rm -f t-addsub$(EXEEXT)
- $(LINK) $(t_addsub_OBJECTS) $(t_addsub_LDADD) $(LIBS)
-t-aorsmul$(EXEEXT): $(t_aorsmul_OBJECTS) $(t_aorsmul_DEPENDENCIES) $(EXTRA_t_aorsmul_DEPENDENCIES)
+ $(LINK) $(t_addsub_LDFLAGS) $(t_addsub_OBJECTS) $(t_addsub_LDADD) $(LIBS)
+t-aorsmul$(EXEEXT): $(t_aorsmul_OBJECTS) $(t_aorsmul_DEPENDENCIES)
@rm -f t-aorsmul$(EXEEXT)
- $(LINK) $(t_aorsmul_OBJECTS) $(t_aorsmul_LDADD) $(LIBS)
-t-bin$(EXEEXT): $(t_bin_OBJECTS) $(t_bin_DEPENDENCIES) $(EXTRA_t_bin_DEPENDENCIES)
+ $(LINK) $(t_aorsmul_LDFLAGS) $(t_aorsmul_OBJECTS) $(t_aorsmul_LDADD) $(LIBS)
+t-bin$(EXEEXT): $(t_bin_OBJECTS) $(t_bin_DEPENDENCIES)
@rm -f t-bin$(EXEEXT)
- $(LINK) $(t_bin_OBJECTS) $(t_bin_LDADD) $(LIBS)
-t-cdiv_ui$(EXEEXT): $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_DEPENDENCIES) $(EXTRA_t_cdiv_ui_DEPENDENCIES)
+ $(LINK) $(t_bin_LDFLAGS) $(t_bin_OBJECTS) $(t_bin_LDADD) $(LIBS)
+t-cdiv_ui$(EXEEXT): $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_DEPENDENCIES)
@rm -f t-cdiv_ui$(EXEEXT)
- $(LINK) $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_LDADD) $(LIBS)
-t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES) $(EXTRA_t_cmp_DEPENDENCIES)
+ $(LINK) $(t_cdiv_ui_LDFLAGS) $(t_cdiv_ui_OBJECTS) $(t_cdiv_ui_LDADD) $(LIBS)
+t-cmp$(EXEEXT): $(t_cmp_OBJECTS) $(t_cmp_DEPENDENCIES)
@rm -f t-cmp$(EXEEXT)
- $(LINK) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS)
-t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES) $(EXTRA_t_cmp_d_DEPENDENCIES)
+ $(LINK) $(t_cmp_LDFLAGS) $(t_cmp_OBJECTS) $(t_cmp_LDADD) $(LIBS)
+t-cmp_d$(EXEEXT): $(t_cmp_d_OBJECTS) $(t_cmp_d_DEPENDENCIES)
@rm -f t-cmp_d$(EXEEXT)
- $(LINK) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS)
-t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES) $(EXTRA_t_cmp_si_DEPENDENCIES)
+ $(LINK) $(t_cmp_d_LDFLAGS) $(t_cmp_d_OBJECTS) $(t_cmp_d_LDADD) $(LIBS)
+t-cmp_si$(EXEEXT): $(t_cmp_si_OBJECTS) $(t_cmp_si_DEPENDENCIES)
@rm -f t-cmp_si$(EXEEXT)
- $(LINK) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
-t-cong$(EXEEXT): $(t_cong_OBJECTS) $(t_cong_DEPENDENCIES) $(EXTRA_t_cong_DEPENDENCIES)
+ $(LINK) $(t_cmp_si_LDFLAGS) $(t_cmp_si_OBJECTS) $(t_cmp_si_LDADD) $(LIBS)
+t-cong$(EXEEXT): $(t_cong_OBJECTS) $(t_cong_DEPENDENCIES)
@rm -f t-cong$(EXEEXT)
- $(LINK) $(t_cong_OBJECTS) $(t_cong_LDADD) $(LIBS)
-t-cong_2exp$(EXEEXT): $(t_cong_2exp_OBJECTS) $(t_cong_2exp_DEPENDENCIES) $(EXTRA_t_cong_2exp_DEPENDENCIES)
+ $(LINK) $(t_cong_LDFLAGS) $(t_cong_OBJECTS) $(t_cong_LDADD) $(LIBS)
+t-cong_2exp$(EXEEXT): $(t_cong_2exp_OBJECTS) $(t_cong_2exp_DEPENDENCIES)
@rm -f t-cong_2exp$(EXEEXT)
- $(LINK) $(t_cong_2exp_OBJECTS) $(t_cong_2exp_LDADD) $(LIBS)
-t-div_2exp$(EXEEXT): $(t_div_2exp_OBJECTS) $(t_div_2exp_DEPENDENCIES) $(EXTRA_t_div_2exp_DEPENDENCIES)
+ $(LINK) $(t_cong_2exp_LDFLAGS) $(t_cong_2exp_OBJECTS) $(t_cong_2exp_LDADD) $(LIBS)
+t-div_2exp$(EXEEXT): $(t_div_2exp_OBJECTS) $(t_div_2exp_DEPENDENCIES)
@rm -f t-div_2exp$(EXEEXT)
- $(LINK) $(t_div_2exp_OBJECTS) $(t_div_2exp_LDADD) $(LIBS)
-t-divis$(EXEEXT): $(t_divis_OBJECTS) $(t_divis_DEPENDENCIES) $(EXTRA_t_divis_DEPENDENCIES)
+ $(LINK) $(t_div_2exp_LDFLAGS) $(t_div_2exp_OBJECTS) $(t_div_2exp_LDADD) $(LIBS)
+t-divis$(EXEEXT): $(t_divis_OBJECTS) $(t_divis_DEPENDENCIES)
@rm -f t-divis$(EXEEXT)
- $(LINK) $(t_divis_OBJECTS) $(t_divis_LDADD) $(LIBS)
-t-divis_2exp$(EXEEXT): $(t_divis_2exp_OBJECTS) $(t_divis_2exp_DEPENDENCIES) $(EXTRA_t_divis_2exp_DEPENDENCIES)
+ $(LINK) $(t_divis_LDFLAGS) $(t_divis_OBJECTS) $(t_divis_LDADD) $(LIBS)
+t-divis_2exp$(EXEEXT): $(t_divis_2exp_OBJECTS) $(t_divis_2exp_DEPENDENCIES)
@rm -f t-divis_2exp$(EXEEXT)
- $(LINK) $(t_divis_2exp_OBJECTS) $(t_divis_2exp_LDADD) $(LIBS)
-t-export$(EXEEXT): $(t_export_OBJECTS) $(t_export_DEPENDENCIES) $(EXTRA_t_export_DEPENDENCIES)
+ $(LINK) $(t_divis_2exp_LDFLAGS) $(t_divis_2exp_OBJECTS) $(t_divis_2exp_LDADD) $(LIBS)
+t-export$(EXEEXT): $(t_export_OBJECTS) $(t_export_DEPENDENCIES)
@rm -f t-export$(EXEEXT)
- $(LINK) $(t_export_OBJECTS) $(t_export_LDADD) $(LIBS)
-t-fac_ui$(EXEEXT): $(t_fac_ui_OBJECTS) $(t_fac_ui_DEPENDENCIES) $(EXTRA_t_fac_ui_DEPENDENCIES)
+ $(LINK) $(t_export_LDFLAGS) $(t_export_OBJECTS) $(t_export_LDADD) $(LIBS)
+t-fac_ui$(EXEEXT): $(t_fac_ui_OBJECTS) $(t_fac_ui_DEPENDENCIES)
@rm -f t-fac_ui$(EXEEXT)
- $(LINK) $(t_fac_ui_OBJECTS) $(t_fac_ui_LDADD) $(LIBS)
-t-fdiv$(EXEEXT): $(t_fdiv_OBJECTS) $(t_fdiv_DEPENDENCIES) $(EXTRA_t_fdiv_DEPENDENCIES)
+ $(LINK) $(t_fac_ui_LDFLAGS) $(t_fac_ui_OBJECTS) $(t_fac_ui_LDADD) $(LIBS)
+t-fdiv$(EXEEXT): $(t_fdiv_OBJECTS) $(t_fdiv_DEPENDENCIES)
@rm -f t-fdiv$(EXEEXT)
- $(LINK) $(t_fdiv_OBJECTS) $(t_fdiv_LDADD) $(LIBS)
-t-fdiv_ui$(EXEEXT): $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_DEPENDENCIES) $(EXTRA_t_fdiv_ui_DEPENDENCIES)
+ $(LINK) $(t_fdiv_LDFLAGS) $(t_fdiv_OBJECTS) $(t_fdiv_LDADD) $(LIBS)
+t-fdiv_ui$(EXEEXT): $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_DEPENDENCIES)
@rm -f t-fdiv_ui$(EXEEXT)
- $(LINK) $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_LDADD) $(LIBS)
-t-fib_ui$(EXEEXT): $(t_fib_ui_OBJECTS) $(t_fib_ui_DEPENDENCIES) $(EXTRA_t_fib_ui_DEPENDENCIES)
+ $(LINK) $(t_fdiv_ui_LDFLAGS) $(t_fdiv_ui_OBJECTS) $(t_fdiv_ui_LDADD) $(LIBS)
+t-fib_ui$(EXEEXT): $(t_fib_ui_OBJECTS) $(t_fib_ui_DEPENDENCIES)
@rm -f t-fib_ui$(EXEEXT)
- $(LINK) $(t_fib_ui_OBJECTS) $(t_fib_ui_LDADD) $(LIBS)
-t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES) $(EXTRA_t_fits_DEPENDENCIES)
+ $(LINK) $(t_fib_ui_LDFLAGS) $(t_fib_ui_OBJECTS) $(t_fib_ui_LDADD) $(LIBS)
+t-fits$(EXEEXT): $(t_fits_OBJECTS) $(t_fits_DEPENDENCIES)
@rm -f t-fits$(EXEEXT)
- $(LINK) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS)
-t-gcd$(EXEEXT): $(t_gcd_OBJECTS) $(t_gcd_DEPENDENCIES) $(EXTRA_t_gcd_DEPENDENCIES)
+ $(LINK) $(t_fits_LDFLAGS) $(t_fits_OBJECTS) $(t_fits_LDADD) $(LIBS)
+t-gcd$(EXEEXT): $(t_gcd_OBJECTS) $(t_gcd_DEPENDENCIES)
@rm -f t-gcd$(EXEEXT)
- $(LINK) $(t_gcd_OBJECTS) $(t_gcd_LDADD) $(LIBS)
-t-gcd_ui$(EXEEXT): $(t_gcd_ui_OBJECTS) $(t_gcd_ui_DEPENDENCIES) $(EXTRA_t_gcd_ui_DEPENDENCIES)
+ $(LINK) $(t_gcd_LDFLAGS) $(t_gcd_OBJECTS) $(t_gcd_LDADD) $(LIBS)
+t-gcd_ui$(EXEEXT): $(t_gcd_ui_OBJECTS) $(t_gcd_ui_DEPENDENCIES)
@rm -f t-gcd_ui$(EXEEXT)
- $(LINK) $(t_gcd_ui_OBJECTS) $(t_gcd_ui_LDADD) $(LIBS)
-t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES) $(EXTRA_t_get_d_DEPENDENCIES)
+ $(LINK) $(t_gcd_ui_LDFLAGS) $(t_gcd_ui_OBJECTS) $(t_gcd_ui_LDADD) $(LIBS)
+t-get_d$(EXEEXT): $(t_get_d_OBJECTS) $(t_get_d_DEPENDENCIES)
@rm -f t-get_d$(EXEEXT)
- $(LINK) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
-t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES) $(EXTRA_t_get_d_2exp_DEPENDENCIES)
+ $(LINK) $(t_get_d_LDFLAGS) $(t_get_d_OBJECTS) $(t_get_d_LDADD) $(LIBS)
+t-get_d_2exp$(EXEEXT): $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_DEPENDENCIES)
@rm -f t-get_d_2exp$(EXEEXT)
- $(LINK) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS)
-t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES) $(EXTRA_t_get_si_DEPENDENCIES)
+ $(LINK) $(t_get_d_2exp_LDFLAGS) $(t_get_d_2exp_OBJECTS) $(t_get_d_2exp_LDADD) $(LIBS)
+t-get_si$(EXEEXT): $(t_get_si_OBJECTS) $(t_get_si_DEPENDENCIES)
@rm -f t-get_si$(EXEEXT)
- $(LINK) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS)
-t-hamdist$(EXEEXT): $(t_hamdist_OBJECTS) $(t_hamdist_DEPENDENCIES) $(EXTRA_t_hamdist_DEPENDENCIES)
+ $(LINK) $(t_get_si_LDFLAGS) $(t_get_si_OBJECTS) $(t_get_si_LDADD) $(LIBS)
+t-hamdist$(EXEEXT): $(t_hamdist_OBJECTS) $(t_hamdist_DEPENDENCIES)
@rm -f t-hamdist$(EXEEXT)
- $(LINK) $(t_hamdist_OBJECTS) $(t_hamdist_LDADD) $(LIBS)
-t-import$(EXEEXT): $(t_import_OBJECTS) $(t_import_DEPENDENCIES) $(EXTRA_t_import_DEPENDENCIES)
+ $(LINK) $(t_hamdist_LDFLAGS) $(t_hamdist_OBJECTS) $(t_hamdist_LDADD) $(LIBS)
+t-import$(EXEEXT): $(t_import_OBJECTS) $(t_import_DEPENDENCIES)
@rm -f t-import$(EXEEXT)
- $(LINK) $(t_import_OBJECTS) $(t_import_LDADD) $(LIBS)
-t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES) $(EXTRA_t_inp_str_DEPENDENCIES)
+ $(LINK) $(t_import_LDFLAGS) $(t_import_OBJECTS) $(t_import_LDADD) $(LIBS)
+t-inp_str$(EXEEXT): $(t_inp_str_OBJECTS) $(t_inp_str_DEPENDENCIES)
@rm -f t-inp_str$(EXEEXT)
- $(LINK) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
-t-invert$(EXEEXT): $(t_invert_OBJECTS) $(t_invert_DEPENDENCIES) $(EXTRA_t_invert_DEPENDENCIES)
- @rm -f t-invert$(EXEEXT)
- $(LINK) $(t_invert_OBJECTS) $(t_invert_LDADD) $(LIBS)
-t-io_raw$(EXEEXT): $(t_io_raw_OBJECTS) $(t_io_raw_DEPENDENCIES) $(EXTRA_t_io_raw_DEPENDENCIES)
+ $(LINK) $(t_inp_str_LDFLAGS) $(t_inp_str_OBJECTS) $(t_inp_str_LDADD) $(LIBS)
+t-io_raw$(EXEEXT): $(t_io_raw_OBJECTS) $(t_io_raw_DEPENDENCIES)
@rm -f t-io_raw$(EXEEXT)
- $(LINK) $(t_io_raw_OBJECTS) $(t_io_raw_LDADD) $(LIBS)
-t-jac$(EXEEXT): $(t_jac_OBJECTS) $(t_jac_DEPENDENCIES) $(EXTRA_t_jac_DEPENDENCIES)
+ $(LINK) $(t_io_raw_LDFLAGS) $(t_io_raw_OBJECTS) $(t_io_raw_LDADD) $(LIBS)
+t-jac$(EXEEXT): $(t_jac_OBJECTS) $(t_jac_DEPENDENCIES)
@rm -f t-jac$(EXEEXT)
- $(LINK) $(t_jac_OBJECTS) $(t_jac_LDADD) $(LIBS)
-t-lcm$(EXEEXT): $(t_lcm_OBJECTS) $(t_lcm_DEPENDENCIES) $(EXTRA_t_lcm_DEPENDENCIES)
+ $(LINK) $(t_jac_LDFLAGS) $(t_jac_OBJECTS) $(t_jac_LDADD) $(LIBS)
+t-lcm$(EXEEXT): $(t_lcm_OBJECTS) $(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)
+ $(LINK) $(t_lcm_LDFLAGS) $(t_lcm_OBJECTS) $(t_lcm_LDADD) $(LIBS)
+t-lucnum_ui$(EXEEXT): $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_DEPENDENCIES)
@rm -f t-lucnum_ui$(EXEEXT)
- $(LINK) $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_LDADD) $(LIBS)
-t-mfac_uiui$(EXEEXT): $(t_mfac_uiui_OBJECTS) $(t_mfac_uiui_DEPENDENCIES) $(EXTRA_t_mfac_uiui_DEPENDENCIES)
- @rm -f t-mfac_uiui$(EXEEXT)
- $(LINK) $(t_mfac_uiui_OBJECTS) $(t_mfac_uiui_LDADD) $(LIBS)
-t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES) $(EXTRA_t_mul_DEPENDENCIES)
+ $(LINK) $(t_lucnum_ui_LDFLAGS) $(t_lucnum_ui_OBJECTS) $(t_lucnum_ui_LDADD) $(LIBS)
+t-mul$(EXEEXT): $(t_mul_OBJECTS) $(t_mul_DEPENDENCIES)
@rm -f t-mul$(EXEEXT)
- $(LINK) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS)
-t-mul_i$(EXEEXT): $(t_mul_i_OBJECTS) $(t_mul_i_DEPENDENCIES) $(EXTRA_t_mul_i_DEPENDENCIES)
+ $(LINK) $(t_mul_LDFLAGS) $(t_mul_OBJECTS) $(t_mul_LDADD) $(LIBS)
+t-mul_i$(EXEEXT): $(t_mul_i_OBJECTS) $(t_mul_i_DEPENDENCIES)
@rm -f t-mul_i$(EXEEXT)
- $(LINK) $(t_mul_i_OBJECTS) $(t_mul_i_LDADD) $(LIBS)
-t-nextprime$(EXEEXT): $(t_nextprime_OBJECTS) $(t_nextprime_DEPENDENCIES) $(EXTRA_t_nextprime_DEPENDENCIES)
+ $(LINK) $(t_mul_i_LDFLAGS) $(t_mul_i_OBJECTS) $(t_mul_i_LDADD) $(LIBS)
+t-nextprime$(EXEEXT): $(t_nextprime_OBJECTS) $(t_nextprime_DEPENDENCIES)
@rm -f t-nextprime$(EXEEXT)
- $(LINK) $(t_nextprime_OBJECTS) $(t_nextprime_LDADD) $(LIBS)
-t-oddeven$(EXEEXT): $(t_oddeven_OBJECTS) $(t_oddeven_DEPENDENCIES) $(EXTRA_t_oddeven_DEPENDENCIES)
+ $(LINK) $(t_nextprime_LDFLAGS) $(t_nextprime_OBJECTS) $(t_nextprime_LDADD) $(LIBS)
+t-oddeven$(EXEEXT): $(t_oddeven_OBJECTS) $(t_oddeven_DEPENDENCIES)
@rm -f t-oddeven$(EXEEXT)
- $(LINK) $(t_oddeven_OBJECTS) $(t_oddeven_LDADD) $(LIBS)
-t-perfpow$(EXEEXT): $(t_perfpow_OBJECTS) $(t_perfpow_DEPENDENCIES) $(EXTRA_t_perfpow_DEPENDENCIES)
+ $(LINK) $(t_oddeven_LDFLAGS) $(t_oddeven_OBJECTS) $(t_oddeven_LDADD) $(LIBS)
+t-perfpow$(EXEEXT): $(t_perfpow_OBJECTS) $(t_perfpow_DEPENDENCIES)
@rm -f t-perfpow$(EXEEXT)
- $(LINK) $(t_perfpow_OBJECTS) $(t_perfpow_LDADD) $(LIBS)
-t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES) $(EXTRA_t_perfsqr_DEPENDENCIES)
+ $(LINK) $(t_perfpow_LDFLAGS) $(t_perfpow_OBJECTS) $(t_perfpow_LDADD) $(LIBS)
+t-perfsqr$(EXEEXT): $(t_perfsqr_OBJECTS) $(t_perfsqr_DEPENDENCIES)
@rm -f t-perfsqr$(EXEEXT)
- $(LINK) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS)
-t-popcount$(EXEEXT): $(t_popcount_OBJECTS) $(t_popcount_DEPENDENCIES) $(EXTRA_t_popcount_DEPENDENCIES)
+ $(LINK) $(t_perfsqr_LDFLAGS) $(t_perfsqr_OBJECTS) $(t_perfsqr_LDADD) $(LIBS)
+t-popcount$(EXEEXT): $(t_popcount_OBJECTS) $(t_popcount_DEPENDENCIES)
@rm -f t-popcount$(EXEEXT)
- $(LINK) $(t_popcount_OBJECTS) $(t_popcount_LDADD) $(LIBS)
-t-pow$(EXEEXT): $(t_pow_OBJECTS) $(t_pow_DEPENDENCIES) $(EXTRA_t_pow_DEPENDENCIES)
+ $(LINK) $(t_popcount_LDFLAGS) $(t_popcount_OBJECTS) $(t_popcount_LDADD) $(LIBS)
+t-pow$(EXEEXT): $(t_pow_OBJECTS) $(t_pow_DEPENDENCIES)
@rm -f t-pow$(EXEEXT)
- $(LINK) $(t_pow_OBJECTS) $(t_pow_LDADD) $(LIBS)
-t-powm$(EXEEXT): $(t_powm_OBJECTS) $(t_powm_DEPENDENCIES) $(EXTRA_t_powm_DEPENDENCIES)
+ $(LINK) $(t_pow_LDFLAGS) $(t_pow_OBJECTS) $(t_pow_LDADD) $(LIBS)
+t-powm$(EXEEXT): $(t_powm_OBJECTS) $(t_powm_DEPENDENCIES)
@rm -f t-powm$(EXEEXT)
- $(LINK) $(t_powm_OBJECTS) $(t_powm_LDADD) $(LIBS)
-t-powm_ui$(EXEEXT): $(t_powm_ui_OBJECTS) $(t_powm_ui_DEPENDENCIES) $(EXTRA_t_powm_ui_DEPENDENCIES)
+ $(LINK) $(t_powm_LDFLAGS) $(t_powm_OBJECTS) $(t_powm_LDADD) $(LIBS)
+t-powm_ui$(EXEEXT): $(t_powm_ui_OBJECTS) $(t_powm_ui_DEPENDENCIES)
@rm -f t-powm_ui$(EXEEXT)
- $(LINK) $(t_powm_ui_OBJECTS) $(t_powm_ui_LDADD) $(LIBS)
-t-pprime_p$(EXEEXT): $(t_pprime_p_OBJECTS) $(t_pprime_p_DEPENDENCIES) $(EXTRA_t_pprime_p_DEPENDENCIES)
+ $(LINK) $(t_powm_ui_LDFLAGS) $(t_powm_ui_OBJECTS) $(t_powm_ui_LDADD) $(LIBS)
+t-pprime_p$(EXEEXT): $(t_pprime_p_OBJECTS) $(t_pprime_p_DEPENDENCIES)
@rm -f t-pprime_p$(EXEEXT)
- $(LINK) $(t_pprime_p_OBJECTS) $(t_pprime_p_LDADD) $(LIBS)
-t-primorial_ui$(EXEEXT): $(t_primorial_ui_OBJECTS) $(t_primorial_ui_DEPENDENCIES) $(EXTRA_t_primorial_ui_DEPENDENCIES)
- @rm -f t-primorial_ui$(EXEEXT)
- $(LINK) $(t_primorial_ui_OBJECTS) $(t_primorial_ui_LDADD) $(LIBS)
-t-remove$(EXEEXT): $(t_remove_OBJECTS) $(t_remove_DEPENDENCIES) $(EXTRA_t_remove_DEPENDENCIES)
- @rm -f t-remove$(EXEEXT)
- $(LINK) $(t_remove_OBJECTS) $(t_remove_LDADD) $(LIBS)
-t-root$(EXEEXT): $(t_root_OBJECTS) $(t_root_DEPENDENCIES) $(EXTRA_t_root_DEPENDENCIES)
+ $(LINK) $(t_pprime_p_LDFLAGS) $(t_pprime_p_OBJECTS) $(t_pprime_p_LDADD) $(LIBS)
+t-root$(EXEEXT): $(t_root_OBJECTS) $(t_root_DEPENDENCIES)
@rm -f t-root$(EXEEXT)
- $(LINK) $(t_root_OBJECTS) $(t_root_LDADD) $(LIBS)
-t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES) $(EXTRA_t_scan_DEPENDENCIES)
+ $(LINK) $(t_root_LDFLAGS) $(t_root_OBJECTS) $(t_root_LDADD) $(LIBS)
+t-scan$(EXEEXT): $(t_scan_OBJECTS) $(t_scan_DEPENDENCIES)
@rm -f t-scan$(EXEEXT)
- $(LINK) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS)
-t-set_d$(EXEEXT): $(t_set_d_OBJECTS) $(t_set_d_DEPENDENCIES) $(EXTRA_t_set_d_DEPENDENCIES)
+ $(LINK) $(t_scan_LDFLAGS) $(t_scan_OBJECTS) $(t_scan_LDADD) $(LIBS)
+t-set_d$(EXEEXT): $(t_set_d_OBJECTS) $(t_set_d_DEPENDENCIES)
@rm -f t-set_d$(EXEEXT)
- $(LINK) $(t_set_d_OBJECTS) $(t_set_d_LDADD) $(LIBS)
-t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES) $(EXTRA_t_set_f_DEPENDENCIES)
+ $(LINK) $(t_set_d_LDFLAGS) $(t_set_d_OBJECTS) $(t_set_d_LDADD) $(LIBS)
+t-set_f$(EXEEXT): $(t_set_f_OBJECTS) $(t_set_f_DEPENDENCIES)
@rm -f t-set_f$(EXEEXT)
- $(LINK) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS)
-t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES) $(EXTRA_t_set_si_DEPENDENCIES)
+ $(LINK) $(t_set_f_LDFLAGS) $(t_set_f_OBJECTS) $(t_set_f_LDADD) $(LIBS)
+t-set_si$(EXEEXT): $(t_set_si_OBJECTS) $(t_set_si_DEPENDENCIES)
@rm -f t-set_si$(EXEEXT)
- $(LINK) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS)
-t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES) $(EXTRA_t_set_str_DEPENDENCIES)
+ $(LINK) $(t_set_si_LDFLAGS) $(t_set_si_OBJECTS) $(t_set_si_LDADD) $(LIBS)
+t-set_str$(EXEEXT): $(t_set_str_OBJECTS) $(t_set_str_DEPENDENCIES)
@rm -f t-set_str$(EXEEXT)
- $(LINK) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS)
-t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES) $(EXTRA_t_sizeinbase_DEPENDENCIES)
+ $(LINK) $(t_set_str_LDFLAGS) $(t_set_str_OBJECTS) $(t_set_str_LDADD) $(LIBS)
+t-sizeinbase$(EXEEXT): $(t_sizeinbase_OBJECTS) $(t_sizeinbase_DEPENDENCIES)
@rm -f t-sizeinbase$(EXEEXT)
- $(LINK) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS)
-t-sqrtrem$(EXEEXT): $(t_sqrtrem_OBJECTS) $(t_sqrtrem_DEPENDENCIES) $(EXTRA_t_sqrtrem_DEPENDENCIES)
+ $(LINK) $(t_sizeinbase_LDFLAGS) $(t_sizeinbase_OBJECTS) $(t_sizeinbase_LDADD) $(LIBS)
+t-sqrtrem$(EXEEXT): $(t_sqrtrem_OBJECTS) $(t_sqrtrem_DEPENDENCIES)
@rm -f t-sqrtrem$(EXEEXT)
- $(LINK) $(t_sqrtrem_OBJECTS) $(t_sqrtrem_LDADD) $(LIBS)
-t-tdiv$(EXEEXT): $(t_tdiv_OBJECTS) $(t_tdiv_DEPENDENCIES) $(EXTRA_t_tdiv_DEPENDENCIES)
+ $(LINK) $(t_sqrtrem_LDFLAGS) $(t_sqrtrem_OBJECTS) $(t_sqrtrem_LDADD) $(LIBS)
+t-tdiv$(EXEEXT): $(t_tdiv_OBJECTS) $(t_tdiv_DEPENDENCIES)
@rm -f t-tdiv$(EXEEXT)
- $(LINK) $(t_tdiv_OBJECTS) $(t_tdiv_LDADD) $(LIBS)
-t-tdiv_ui$(EXEEXT): $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_DEPENDENCIES) $(EXTRA_t_tdiv_ui_DEPENDENCIES)
+ $(LINK) $(t_tdiv_LDFLAGS) $(t_tdiv_OBJECTS) $(t_tdiv_LDADD) $(LIBS)
+t-tdiv_ui$(EXEEXT): $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_DEPENDENCIES)
@rm -f t-tdiv_ui$(EXEEXT)
- $(LINK) $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_LDADD) $(LIBS)
+ $(LINK) $(t_tdiv_ui_LDFLAGS) $(t_tdiv_ui_OBJECTS) $(t_tdiv_ui_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -874,6 +795,152 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+bit_.c: bit.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/bit.c; then echo $(srcdir)/bit.c; else echo bit.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+convert_.c: convert.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/convert.c; then echo $(srcdir)/convert.c; else echo convert.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dive_.c: dive.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive.c; then echo $(srcdir)/dive.c; else echo dive.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dive_ui_.c: dive_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dive_ui.c; then echo $(srcdir)/dive_ui.c; else echo dive_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+io_.c: io.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/io.c; then echo $(srcdir)/io.c; else echo io.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+logic_.c: logic.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/logic.c; then echo $(srcdir)/logic.c; else echo logic.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+reuse_.c: reuse.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/reuse.c; then echo $(srcdir)/reuse.c; else echo reuse.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-addsub_.c: t-addsub.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-addsub.c; then echo $(srcdir)/t-addsub.c; else echo t-addsub.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-aorsmul_.c: t-aorsmul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-aorsmul.c; then echo $(srcdir)/t-aorsmul.c; else echo t-aorsmul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-bin_.c: t-bin.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-bin.c; then echo $(srcdir)/t-bin.c; else echo t-bin.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cdiv_ui_.c: t-cdiv_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cdiv_ui.c; then echo $(srcdir)/t-cdiv_ui.c; else echo t-cdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_.c: t-cmp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp.c; then echo $(srcdir)/t-cmp.c; else echo t-cmp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_d_.c: t-cmp_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_d.c; then echo $(srcdir)/t-cmp_d.c; else echo t-cmp_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cmp_si_.c: t-cmp_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cmp_si.c; then echo $(srcdir)/t-cmp_si.c; else echo t-cmp_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cong_.c: t-cong.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cong.c; then echo $(srcdir)/t-cong.c; else echo t-cong.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-cong_2exp_.c: t-cong_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-cong_2exp.c; then echo $(srcdir)/t-cong_2exp.c; else echo t-cong_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-div_2exp_.c: t-div_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-div_2exp.c; then echo $(srcdir)/t-div_2exp.c; else echo t-div_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-divis_.c: t-divis.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-divis.c; then echo $(srcdir)/t-divis.c; else echo t-divis.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-divis_2exp_.c: t-divis_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-divis_2exp.c; then echo $(srcdir)/t-divis_2exp.c; else echo t-divis_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-export_.c: t-export.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-export.c; then echo $(srcdir)/t-export.c; else echo t-export.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-fac_ui_.c: t-fac_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fac_ui.c; then echo $(srcdir)/t-fac_ui.c; else echo t-fac_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-fdiv_.c: t-fdiv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fdiv.c; then echo $(srcdir)/t-fdiv.c; else echo t-fdiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-fdiv_ui_.c: t-fdiv_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fdiv_ui.c; then echo $(srcdir)/t-fdiv_ui.c; else echo t-fdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-fib_ui_.c: t-fib_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fib_ui.c; then echo $(srcdir)/t-fib_ui.c; else echo t-fib_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-fits_.c: t-fits.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-fits.c; then echo $(srcdir)/t-fits.c; else echo t-fits.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-gcd_.c: t-gcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-gcd.c; then echo $(srcdir)/t-gcd.c; else echo t-gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-gcd_ui_.c: t-gcd_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-gcd_ui.c; then echo $(srcdir)/t-gcd_ui.c; else echo t-gcd_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_d_.c: t-get_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d.c; then echo $(srcdir)/t-get_d.c; else echo t-get_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_d_2exp_.c: t-get_d_2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_d_2exp.c; then echo $(srcdir)/t-get_d_2exp.c; else echo t-get_d_2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-get_si_.c: t-get_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-get_si.c; then echo $(srcdir)/t-get_si.c; else echo t-get_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-hamdist_.c: t-hamdist.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-hamdist.c; then echo $(srcdir)/t-hamdist.c; else echo t-hamdist.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-import_.c: t-import.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-import.c; then echo $(srcdir)/t-import.c; else echo t-import.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-inp_str_.c: t-inp_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-inp_str.c; then echo $(srcdir)/t-inp_str.c; else echo t-inp_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-io_raw_.c: t-io_raw.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-io_raw.c; then echo $(srcdir)/t-io_raw.c; else echo t-io_raw.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-jac_.c: t-jac.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-jac.c; then echo $(srcdir)/t-jac.c; else echo t-jac.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-lcm_.c: t-lcm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-lcm.c; then echo $(srcdir)/t-lcm.c; else echo t-lcm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-lucnum_ui_.c: t-lucnum_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-lucnum_ui.c; then echo $(srcdir)/t-lucnum_ui.c; else echo t-lucnum_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-mul_.c: t-mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mul.c; then echo $(srcdir)/t-mul.c; else echo t-mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-mul_i_.c: t-mul_i.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mul_i.c; then echo $(srcdir)/t-mul_i.c; else echo t-mul_i.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-nextprime_.c: t-nextprime.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-nextprime.c; then echo $(srcdir)/t-nextprime.c; else echo t-nextprime.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-oddeven_.c: t-oddeven.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-oddeven.c; then echo $(srcdir)/t-oddeven.c; else echo t-oddeven.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-perfpow_.c: t-perfpow.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-perfpow.c; then echo $(srcdir)/t-perfpow.c; else echo t-perfpow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-perfsqr_.c: t-perfsqr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-perfsqr.c; then echo $(srcdir)/t-perfsqr.c; else echo t-perfsqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-popcount_.c: t-popcount.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-popcount.c; then echo $(srcdir)/t-popcount.c; else echo t-popcount.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-pow_.c: t-pow.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-pow.c; then echo $(srcdir)/t-pow.c; else echo t-pow.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-powm_.c: t-powm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-powm.c; then echo $(srcdir)/t-powm.c; else echo t-powm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-powm_ui_.c: t-powm_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-powm_ui.c; then echo $(srcdir)/t-powm_ui.c; else echo t-powm_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-pprime_p_.c: t-pprime_p.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-pprime_p.c; then echo $(srcdir)/t-pprime_p.c; else echo t-pprime_p.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-root_.c: t-root.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-root.c; then echo $(srcdir)/t-root.c; else echo t-root.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-scan_.c: t-scan.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-scan.c; then echo $(srcdir)/t-scan.c; else echo t-scan.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_d_.c: t-set_d.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_d.c; then echo $(srcdir)/t-set_d.c; else echo t-set_d.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_f_.c: t-set_f.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_f.c; then echo $(srcdir)/t-set_f.c; else echo t-set_f.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_si_.c: t-set_si.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_si.c; then echo $(srcdir)/t-set_si.c; else echo t-set_si.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-set_str_.c: t-set_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-set_str.c; then echo $(srcdir)/t-set_str.c; else echo t-set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-sizeinbase_.c: t-sizeinbase.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sizeinbase.c; then echo $(srcdir)/t-sizeinbase.c; else echo t-sizeinbase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-sqrtrem_.c: t-sqrtrem.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-sqrtrem.c; then echo $(srcdir)/t-sqrtrem.c; else echo t-sqrtrem.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-tdiv_.c: t-tdiv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-tdiv.c; then echo $(srcdir)/t-tdiv.c; else echo t-tdiv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-tdiv_ui_.c: t-tdiv_ui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-tdiv_ui.c; then echo $(srcdir)/t-tdiv_ui.c; else echo t-tdiv_ui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+bit_.$(OBJEXT) bit_.lo convert_.$(OBJEXT) convert_.lo dive_.$(OBJEXT) \
+dive_.lo dive_ui_.$(OBJEXT) dive_ui_.lo io_.$(OBJEXT) io_.lo \
+logic_.$(OBJEXT) logic_.lo reuse_.$(OBJEXT) reuse_.lo \
+t-addsub_.$(OBJEXT) t-addsub_.lo t-aorsmul_.$(OBJEXT) t-aorsmul_.lo \
+t-bin_.$(OBJEXT) t-bin_.lo t-cdiv_ui_.$(OBJEXT) t-cdiv_ui_.lo \
+t-cmp_.$(OBJEXT) t-cmp_.lo t-cmp_d_.$(OBJEXT) t-cmp_d_.lo \
+t-cmp_si_.$(OBJEXT) t-cmp_si_.lo t-cong_.$(OBJEXT) t-cong_.lo \
+t-cong_2exp_.$(OBJEXT) t-cong_2exp_.lo t-div_2exp_.$(OBJEXT) \
+t-div_2exp_.lo t-divis_.$(OBJEXT) t-divis_.lo t-divis_2exp_.$(OBJEXT) \
+t-divis_2exp_.lo t-export_.$(OBJEXT) t-export_.lo t-fac_ui_.$(OBJEXT) \
+t-fac_ui_.lo t-fdiv_.$(OBJEXT) t-fdiv_.lo t-fdiv_ui_.$(OBJEXT) \
+t-fdiv_ui_.lo t-fib_ui_.$(OBJEXT) t-fib_ui_.lo t-fits_.$(OBJEXT) \
+t-fits_.lo t-gcd_.$(OBJEXT) t-gcd_.lo t-gcd_ui_.$(OBJEXT) t-gcd_ui_.lo \
+t-get_d_.$(OBJEXT) t-get_d_.lo t-get_d_2exp_.$(OBJEXT) \
+t-get_d_2exp_.lo t-get_si_.$(OBJEXT) t-get_si_.lo t-hamdist_.$(OBJEXT) \
+t-hamdist_.lo t-import_.$(OBJEXT) t-import_.lo t-inp_str_.$(OBJEXT) \
+t-inp_str_.lo t-io_raw_.$(OBJEXT) t-io_raw_.lo t-jac_.$(OBJEXT) \
+t-jac_.lo t-lcm_.$(OBJEXT) t-lcm_.lo t-lucnum_ui_.$(OBJEXT) \
+t-lucnum_ui_.lo t-mul_.$(OBJEXT) t-mul_.lo t-mul_i_.$(OBJEXT) \
+t-mul_i_.lo t-nextprime_.$(OBJEXT) t-nextprime_.lo \
+t-oddeven_.$(OBJEXT) t-oddeven_.lo t-perfpow_.$(OBJEXT) t-perfpow_.lo \
+t-perfsqr_.$(OBJEXT) t-perfsqr_.lo t-popcount_.$(OBJEXT) \
+t-popcount_.lo t-pow_.$(OBJEXT) t-pow_.lo t-powm_.$(OBJEXT) t-powm_.lo \
+t-powm_ui_.$(OBJEXT) t-powm_ui_.lo t-pprime_p_.$(OBJEXT) \
+t-pprime_p_.lo t-root_.$(OBJEXT) t-root_.lo t-scan_.$(OBJEXT) \
+t-scan_.lo t-set_d_.$(OBJEXT) t-set_d_.lo t-set_f_.$(OBJEXT) \
+t-set_f_.lo t-set_si_.$(OBJEXT) t-set_si_.lo t-set_str_.$(OBJEXT) \
+t-set_str_.lo t-sizeinbase_.$(OBJEXT) t-sizeinbase_.lo \
+t-sqrtrem_.$(OBJEXT) t-sqrtrem_.lo t-tdiv_.$(OBJEXT) t-tdiv_.lo \
+t-tdiv_ui_.$(OBJEXT) t-tdiv_ui_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -881,54 +948,54 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -936,8 +1003,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -946,113 +1012,91 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -1072,23 +1116,17 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -1101,7 +1139,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -1109,38 +1147,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -1149,7 +1167,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -1160,28 +1178,23 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
$(top_builddir)/tests/libtests.la:
cd $(top_builddir)/tests; $(MAKE) $(AM_MAKEFLAGS) libtests.la
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/mpz/bit.c b/gmp/tests/mpz/bit.c
index c42e9f0cc5..9eddbb4889 100644
--- a/gmp/tests/mpz/bit.c
+++ b/gmp/tests/mpz/bit.c
@@ -1,21 +1,21 @@
/* Test mpz_setbit, mpz_clrbit, mpz_tstbit.
-Copyright 1997, 2000-2003, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1997, 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -38,7 +38,6 @@ debug_mp (mpz_srcptr x, int base)
/* exercise the case where mpz_clrbit or mpz_combit ends up extending a
value like -2^(k*GMP_NUMB_BITS-1) when clearing bit k*GMP_NUMB_BITS-1. */
-/* And vice-versa. */
void
check_clr_extend (void)
{
@@ -54,7 +53,7 @@ check_clr_extend (void)
for (f = 0; f <= 1; f++)
{
/* lots of 1 bits in _mp_d */
- mpz_set_si (got, 1L);
+ mpz_set_ui (got, 1L);
mpz_mul_2exp (got, got, 10*GMP_NUMB_BITS);
mpz_sub_ui (got, got, 1L);
@@ -83,28 +82,6 @@ check_clr_extend (void)
mpz_trace ("want", want);
abort ();
}
-
- /* complement bit n, going back to ..11100..00 which is -2^(n-1) */
- if (f == 0)
- mpz_setbit (got, i*GMP_NUMB_BITS-1);
- else
- mpz_combit (got, i*GMP_NUMB_BITS-1);
- MPZ_CHECK_FORMAT (got);
-
- mpz_set_si (want, -1L);
- mpz_mul_2exp (want, want, i*GMP_NUMB_BITS - 1);
-
- if (mpz_cmp (got, want) != 0)
- {
- if (f == 0)
- printf ("mpz_setbit: ");
- else
- printf ("mpz_combit: ");
- printf ("wrong after shrinking\n");
- mpz_trace ("got ", got);
- mpz_trace ("want", want);
- abort ();
- }
}
}
@@ -188,7 +165,7 @@ check_tstbit (void)
if (low1)
pos[0] |= 1;
- refmpn_neg (neg, pos, (mp_size_t) numberof(neg));
+ refmpn_neg_n (neg, pos, (mp_size_t) numberof(neg));
mpz_set_n (z, neg, (mp_size_t) numberof(neg));
mpz_neg (z, z);
@@ -226,11 +203,11 @@ check_single (void)
{
for (offset = (limb==0 ? 0 : -2); offset <= 2; offset++)
{
- for (initial = 1; initial >= -1; initial--)
+ for (initial = 0; initial >= -1; initial--)
{
mpz_set_si (x, (long) initial);
- bit = (unsigned long) limb*GMP_LIMB_BITS + offset;
+ bit = (unsigned long) limb*BITS_PER_MP_LIMB + offset;
mpz_clrbit (x, bit);
MPZ_CHECK_FORMAT (x);
@@ -318,7 +295,7 @@ check_random (int argc, char *argv[])
mpz_set (s2, x);
bit2 = mpz_tstbit (x, bitindex);
- mpz_combit (x, bitindex);
+ mpz_setbit (x, bitindex);
MPZ_CHECK_FORMAT (x);
mpz_set (s3, x);
@@ -346,26 +323,16 @@ check_random (int argc, char *argv[])
if (mpz_cmp (s2, s3) == 0)
abort ();
- mpz_combit (x, bitindex);
- MPZ_CHECK_FORMAT (x);
- if (mpz_cmp (s2, x) != 0)
- abort ();
-
- mpz_clrbit (x, bitindex);
- MPZ_CHECK_FORMAT (x);
- if (mpz_cmp (s2, x) != 0)
- abort ();
-
mpz_ui_pow_ui (m, 2L, bitindex);
MPZ_CHECK_FORMAT (m);
- mpz_ior (x, s0, m);
+ mpz_ior (x, s2, m);
MPZ_CHECK_FORMAT (x);
if (mpz_cmp (x, s3) != 0)
abort ();
mpz_com (m, m);
MPZ_CHECK_FORMAT (m);
- mpz_and (x, s0, m);
+ mpz_and (x, s1, m);
MPZ_CHECK_FORMAT (x);
if (mpz_cmp (x, s2) != 0)
abort ();
diff --git a/gmp/tests/mpz/convert.c b/gmp/tests/mpz/convert.c
index ada6d11a16..bfe8b70b30 100644
--- a/gmp/tests/mpz/convert.c
+++ b/gmp/tests/mpz/convert.c
@@ -1,22 +1,22 @@
/* Test conversion using mpz_get_str and mpz_set_str.
-Copyright 1993, 1994, 1996, 1999-2002, 2006, 2007 Free Software Foundation,
-Inc.
+Copyright 1993, 1994, 1996, 1999, 2000, 2001, 2002, 2006, 2007 Free Software
+Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -26,7 +26,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void debug_mp (mpz_t, int);
+void debug_mp __GMP_PROTO ((mpz_t, int));
void
@@ -35,7 +35,7 @@ string_urandomb (char *bp, size_t len, int base, gmp_randstate_ptr rands)
mpz_t bs;
unsigned long bsi;
int d, l;
- const char *collseq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
+ char *collseq = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz";
mpz_init (bs);
@@ -78,12 +78,13 @@ main (int argc, char **argv)
size_t len;
tests_start ();
- TESTS_REPS (reps, argv, argc);
-
rands = RANDS;
mpz_init (bs);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
mpz_init (op1);
mpz_init (op2);
@@ -92,8 +93,8 @@ main (int argc, char **argv)
/* 1. Generate random mpz_t and convert to a string and back to mpz_t
again. */
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 17 + 2; /* 2..18 */
- mpz_urandomb (bs, rands, size_range); /* 3..262144 bits */
+ size_range = mpz_get_ui (bs) % 15 + 2; /* 2..16 */
+ mpz_urandomb (bs, rands, size_range); /* 3..65536 bits */
size = mpz_get_ui (bs);
mpz_rrandomb (op1, rands, size);
@@ -126,10 +127,10 @@ main (int argc, char **argv)
/* 2. Generate random string and convert to mpz_t and back to a string
again. */
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 16 + 1; /* 1..16 */
- mpz_urandomb (bs, rands, size_range); /* 1..65536 digits */
+ size_range = mpz_get_ui (bs) % 14 + 1; /* 1..14 */
+ mpz_urandomb (bs, rands, size_range); /* 1..16384 digits */
len = mpz_get_ui (bs) + 1;
- buf = (char *) (*__gmp_allocate_func) (len + 1);
+ buf = (*__gmp_allocate_func) (len + 1);
if (base == 0)
base = 10;
string_urandomb (buf, len, base, rands);
diff --git a/gmp/tests/mpz/dive.c b/gmp/tests/mpz/dive.c
index 7970e718a0..7b0651e63c 100644
--- a/gmp/tests/mpz/dive.c
+++ b/gmp/tests/mpz/dive.c
@@ -2,20 +2,20 @@
Copyright 1996, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -31,20 +31,21 @@ main (int argc, char **argv)
mpz_t prod, quot;
mp_size_t size;
int i;
- int reps = 5000;
+ int reps = 200000;
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long bsi, size_range;
tests_start ();
- TESTS_REPS (reps, argv, argc);
-
rands = RANDS;
mp_trace_base = -16;
mpz_init (bs);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
mpz_init (op1);
mpz_init (op2);
mpz_init (prod);
@@ -53,7 +54,7 @@ main (int argc, char **argv)
for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 17 + 2; /* 0..2047 bit operands */
+ size_range = mpz_get_ui (bs) % 10 + 2; /* 0..2047 bit operands */
mpz_urandomb (bs, rands, size_range);
size = mpz_get_ui (bs);
diff --git a/gmp/tests/mpz/dive_ui.c b/gmp/tests/mpz/dive_ui.c
index 6771677f1f..93f7a9b6e3 100644
--- a/gmp/tests/mpz/dive_ui.c
+++ b/gmp/tests/mpz/dive_ui.c
@@ -2,20 +2,20 @@
Copyright 1996, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/io.c b/gmp/tests/mpz/io.c
index 7674d69b1c..d6bbbbabe6 100644
--- a/gmp/tests/mpz/io.c
+++ b/gmp/tests/mpz/io.c
@@ -1,21 +1,21 @@
/* Test conversion and I/O using mpz_out_str and mpz_inp_str.
-Copyright 1993, 1994, 1996, 2000, 2001, 2012 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -45,7 +45,7 @@ main (int argc, char **argv)
int i;
int reps = 10000;
FILE *fp;
- int base, base_out;
+ int base;
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long bsi, size_range;
@@ -79,17 +79,12 @@ main (int argc, char **argv)
mpz_urandomb (bs, rands, 16);
bsi = mpz_get_ui (bs);
- base = bsi % 62 + 1;
+ base = bsi % 36 + 1;
if (base == 1)
base = 0;
- if (i % 2 == 0 && base <= 36)
- base_out = -base;
- else
- base_out = base;
-
rewind (fp);
- if (mpz_out_str (fp, base_out, op1) == 0
+ if (mpz_out_str (fp, base, op1) == 0
|| putc (' ', fp) == EOF
|| fflush (fp) != 0)
{
diff --git a/gmp/tests/mpz/logic.c b/gmp/tests/mpz/logic.c
index d99cadc2bd..e5d3930235 100644
--- a/gmp/tests/mpz/logic.c
+++ b/gmp/tests/mpz/logic.c
@@ -1,21 +1,21 @@
/* Test mpz_com, mpz_and, mpz_ior, and mpz_xor.
-Copyright 1993, 1994, 1996, 1997, 2001, 2013 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 1997, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -24,8 +24,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void dump_abort (void);
-void debug_mp (mpz_t, int);
+void dump_abort __GMP_PROTO (());
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
@@ -55,45 +55,6 @@ main (int argc, char **argv)
mpz_init (t2);
mpz_init (t3);
- mpz_set_si (x, -1);
- mpz_set_ui (y, 0);
- for (i = 0; i < 300; i++)
- {
- mpz_mul_2exp (x, x, 1);
-
- mpz_and (r1, x, x);
- MPZ_CHECK_FORMAT (r1);
- if (mpz_cmp (r1, x) != 0)
- dump_abort ();
-
- mpz_ior (r2, x, x);
- MPZ_CHECK_FORMAT (r2);
- if (mpz_cmp (r2, x) != 0)
- dump_abort ();
-
- mpz_xor (t1, x, x);
- MPZ_CHECK_FORMAT (t1);
- if (mpz_cmp_si (t1, 0) != 0)
- dump_abort ();
-
- mpz_ior (t1, x, y);
- MPZ_CHECK_FORMAT (t1);
- if (mpz_cmp (t1, x) != 0)
- dump_abort ();
-
- mpz_xor (t2, x, y);
- MPZ_CHECK_FORMAT (t2);
- if (mpz_cmp (t2, x) != 0)
- dump_abort ();
-
- mpz_com (t2, x);
- MPZ_CHECK_FORMAT (t2);
- mpz_xor (t3, t2, x);
- MPZ_CHECK_FORMAT (t3);
- if (mpz_cmp_si (t3, -1) != 0)
- dump_abort ();
- }
-
for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
diff --git a/gmp/tests/mpz/reuse.c b/gmp/tests/mpz/reuse.c
index 4b67fbe38b..257e9abfaa 100644
--- a/gmp/tests/mpz/reuse.c
+++ b/gmp/tests/mpz/reuse.c
@@ -6,27 +6,26 @@
mpz_mul_si
mpz_addmul_ui (should this really allow a+=a*c?)
-Copyright 1996, 1999-2002, 2009, 2012, 2013 Free Software Foundation, Inc.
+Copyright 1996, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <unistd.h>
#include "gmp.h"
#include "gmp-impl.h"
@@ -49,14 +48,14 @@ main (void)
#else /* ! DLL_EXPORT */
-void dump (const char *, mpz_t, mpz_t, mpz_t);
+void dump __GMP_PROTO ((char *, mpz_t, mpz_t, mpz_t));
-typedef void (*dss_func) (mpz_ptr, mpz_srcptr, mpz_srcptr);
-typedef void (*dsi_func) (mpz_ptr, mpz_srcptr, unsigned long int);
-typedef unsigned long int (*dsi_div_func) (mpz_ptr, mpz_srcptr, unsigned long int);
-typedef unsigned long int (*ddsi_div_func) (mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int);
-typedef void (*ddss_div_func) (mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr);
-typedef void (*ds_func) (mpz_ptr, mpz_srcptr);
+typedef void (*dss_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr));
+typedef void (*dsi_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
+typedef unsigned long int (*dsi_div_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr, unsigned long int));
+typedef unsigned long int (*ddsi_div_func) __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, unsigned long int));
+typedef void (*ddss_div_func) __GMP_PROTO ((mpz_ptr, mpz_ptr, mpz_srcptr, mpz_srcptr));
+typedef void (*ds_func) __GMP_PROTO ((mpz_ptr, mpz_srcptr));
void
@@ -68,140 +67,124 @@ mpz_xinvert (mpz_ptr r, mpz_srcptr a, mpz_srcptr b)
mpz_set_ui (r, 0);
}
-struct {
- dss_func fptr;
- const char *fname;
- int isdivision;
- int isslow;
-} dss[] =
- { { mpz_add, "mpz_add", 0, 0 },
- { mpz_sub, "mpz_sub", 0, 0 },
- { mpz_mul, "mpz_mul", 0, 0 },
- { mpz_cdiv_q, "mpz_cdiv_q", 1, 0 },
- { mpz_cdiv_r, "mpz_cdiv_r", 1, 0 },
- { mpz_fdiv_q, "mpz_fdiv_q", 1, 0 },
- { mpz_fdiv_r, "mpz_fdiv_r", 1, 0 },
- { mpz_tdiv_q, "mpz_tdiv_q", 1, 0 },
- { mpz_tdiv_r, "mpz_tdiv_r", 1, 0 },
- { mpz_mod, "mpz_mod", 1, 0 },
- { mpz_xinvert, "mpz_xinvert", 1, 1 },
- { mpz_gcd, "mpz_gcd", 0, 1 },
- { mpz_lcm, "mpz_lcm", 0, 1 },
- { mpz_and, "mpz_and", 0, 0 },
- { mpz_ior, "mpz_ior", 0, 0 },
- { mpz_xor, "mpz_xor", 0, 0 }
- };
-
-
-struct {
- dsi_func fptr;
- const char *fname;
- int mod;
-} dsi[] =
+dss_func dss_funcs[] =
{
- /* Don't change order here without changing the code in main(). */
- { mpz_add_ui, "mpz_add_ui", 0 },
- { mpz_mul_ui, "mpz_mul_ui", 0 },
- { mpz_sub_ui, "mpz_sub_ui", 0 },
- { mpz_fdiv_q_2exp, "mpz_fdiv_q_2exp", 0x1000 },
- { mpz_fdiv_r_2exp, "mpz_fdiv_r_2exp", 0x1000 },
- { mpz_cdiv_q_2exp, "mpz_cdiv_q_2exp", 0x1000 },
- { mpz_cdiv_r_2exp, "mpz_cdiv_r_2exp", 0x1000 },
- { mpz_tdiv_q_2exp, "mpz_tdiv_q_2exp", 0x1000 },
- { mpz_tdiv_r_2exp, "mpz_tdiv_r_2exp", 0x1000 },
- { mpz_mul_2exp, "mpz_mul_2exp", 0x100 },
- { mpz_pow_ui, "mpz_pow_ui", 0x10 }
+ mpz_add, mpz_sub, mpz_mul,
+ mpz_cdiv_q, mpz_cdiv_r, mpz_fdiv_q, mpz_fdiv_r, mpz_tdiv_q, mpz_tdiv_r,
+ mpz_xinvert,
+ mpz_gcd, mpz_lcm, mpz_and, mpz_ior, mpz_xor
};
-
-struct {
- dsi_div_func fptr;
- const char *fname;
-} dsi_div[] =
+char *dss_func_names[] =
{
- { mpz_cdiv_q_ui, "mpz_cdiv_q_ui" },
- { mpz_cdiv_r_ui, "mpz_cdiv_r_ui" },
- { mpz_fdiv_q_ui, "mpz_fdiv_q_ui" },
- { mpz_fdiv_r_ui, "mpz_fdiv_r_ui" },
- { mpz_tdiv_q_ui, "mpz_tdiv_q_ui" },
- { mpz_tdiv_r_ui, "mpz_tdiv_r_ui" }
+ "mpz_add", "mpz_sub", "mpz_mul",
+ "mpz_cdiv_q", "mpz_cdiv_r", "mpz_fdiv_q", "mpz_fdiv_r", "mpz_tdiv_q", "mpz_tdiv_r",
+ "mpz_xinvert",
+ "mpz_gcd", "mpz_lcm", "mpz_and", "mpz_ior", "mpz_xor"
};
+char dss_func_division[] = {0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0};
-struct {
- ddsi_div_func fptr;
- const char *fname;
- int isslow;
-} ddsi_div[] =
+dsi_func dsi_funcs[] =
{
- { mpz_cdiv_qr_ui, "mpz_cdiv_qr_ui", 0 },
- { mpz_fdiv_qr_ui, "mpz_fdiv_qr_ui", 0 },
- { mpz_tdiv_qr_ui, "mpz_tdiv_qr_ui", 0 },
+ /* Don't change order here without changing the code in main(). */
+ mpz_add_ui, mpz_mul_ui, mpz_sub_ui,
+ mpz_fdiv_q_2exp, mpz_fdiv_r_2exp,
+ mpz_cdiv_q_2exp, mpz_cdiv_r_2exp,
+ mpz_tdiv_q_2exp, mpz_tdiv_r_2exp,
+ mpz_mul_2exp,
+ mpz_pow_ui
+};
+char *dsi_func_names[] =
+{
+ "mpz_add_ui", "mpz_mul_ui", "mpz_sub_ui",
+ "mpz_fdiv_q_2exp", "mpz_fdiv_r_2exp",
+ "mpz_cdiv_q_2exp", "mpz_cdiv_r_2exp",
+ "mpz_tdiv_q_2exp", "mpz_tdiv_r_2exp",
+ "mpz_mul_2exp",
+ "mpz_pow_ui"
};
-
-struct {
- ddss_div_func fptr;
- const char *fname;
- int isslow;
-} ddss_div[] =
+dsi_div_func dsi_div_funcs[] =
{
- { mpz_cdiv_qr, "mpz_cdiv_qr", 0 },
- { mpz_fdiv_qr, "mpz_fdiv_qr", 0 },
- { mpz_tdiv_qr, "mpz_tdiv_qr", 0 },
+ mpz_cdiv_q_ui, mpz_cdiv_r_ui,
+ mpz_fdiv_q_ui, mpz_fdiv_r_ui,
+ mpz_tdiv_q_ui, mpz_tdiv_r_ui
+};
+char *dsi_div_func_names[] =
+{
+ "mpz_cdiv_q_ui", "mpz_cdiv_r_ui",
+ "mpz_fdiv_q_ui", "mpz_fdiv_r_ui",
+ "mpz_tdiv_q_ui", "mpz_tdiv_r_ui"
};
-struct {
- ds_func fptr;
- const char *fname;
- int nonneg;
-} ds[] =
+ddsi_div_func ddsi_div_funcs[] =
+{
+ mpz_cdiv_qr_ui,
+ mpz_fdiv_qr_ui,
+ mpz_tdiv_qr_ui
+};
+char *ddsi_div_func_names[] =
{
- { mpz_abs, "mpz_abs", 0 },
- { mpz_com, "mpz_com", 0 },
- { mpz_neg, "mpz_neg", 0 },
- { mpz_sqrt, "mpz_sqrt", 1 },
+ "mpz_cdiv_qr_ui",
+ "mpz_fdiv_qr_ui",
+ "mpz_tdiv_qr_ui"
};
-#define FAIL(class,indx,op1,op2,op3) \
- do { \
- dump (class[indx].fname, op1, op2, op3); \
- exit (1); \
- } while (0)
+ddss_div_func ddss_div_funcs[] =
+{
+ mpz_cdiv_qr,
+ mpz_fdiv_qr,
+ mpz_tdiv_qr
+};
+char *ddss_div_func_names[] =
+{
+ "mpz_cdiv_qr",
+ "mpz_fdiv_qr",
+ "mpz_tdiv_qr"
+};
-#define FAIL2(fname,op1,op2,op3) \
- do { \
- dump (#fname, op1, op2, op3); \
- exit (1); \
- } while (0)
+ds_func ds_funcs[] =
+{
+ mpz_abs, mpz_com, mpz_neg, mpz_sqrt
+};
+char *ds_func_names[] =
+{
+ "mpz_abs", "mpz_com", "mpz_neg", "mpz_sqrt"
+};
-#define INVOKE_RRS(desc,r1,r2,i1) \
+/* Really use `defined (__STDC__)' here; we want it to be true for Sun C */
+#if defined (__STDC__) || defined (__cplusplus)
+#define FAIL(class,indx,op1,op2,op3) \
do { \
- if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \
- if (pass & 2) _mpz_realloc (r2, ABSIZ(r2)); \
- (desc).fptr (r1, r2, i1); \
+ class##_funcs[indx] = 0; \
+ dump (class##_func_names[indx], op1, op2, op3); \
+ failures++; \
} while (0)
-#define INVOKE_RS(desc,r1,i1) \
+#define FAIL2(fname,op1,op2,op3) \
do { \
- if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \
- (desc).fptr (r1, i1); \
+ dump (#fname, op1, op2, op3); \
+ failures++; \
} while (0)
-#define INVOKE_RRSS(desc,r1,r2,i1,i2) \
+#else
+#define FAIL(class,indx,op1,op2,op3) \
do { \
- if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \
- if (pass & 2) _mpz_realloc (r2, ABSIZ(r2)); \
- (desc).fptr (r1, r2, i1, i2); \
+ class/**/_funcs[indx] = 0; \
+ dump (class/**/_func_names[indx], op1, op2, op3); \
+ failures++; \
} while (0)
-#define INVOKE_RSS(desc,r1,i1,i2) \
+#define FAIL2(fname,op1,op2,op3) \
do { \
- if (pass & 1) _mpz_realloc (r1, ABSIZ(r1)); \
- (desc).fptr (r1, i1, i2); \
+ dump ("fname", op1, op2, op3); \
+ failures++; \
} while (0)
+#endif
+
int
main (int argc, char **argv)
{
int i;
- int pass, reps = 400;
+ int pass, reps = 1000;
mpz_t in1, in2, in3;
unsigned long int in2i;
mp_size_t size;
@@ -209,17 +192,19 @@ main (int argc, char **argv)
mpz_t ref1, ref2, ref3;
mpz_t t;
unsigned long int r1, r2;
+ long failures = 0;
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long bsi, size_range;
tests_start ();
- TESTS_REPS (reps, argv, argc);
-
rands = RANDS;
mpz_init (bs);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
mpz_init (in1);
mpz_init (in2);
mpz_init (in3);
@@ -233,126 +218,106 @@ main (int argc, char **argv)
for (pass = 1; pass <= reps; pass++)
{
- if (isatty (fileno (stdout)))
- {
- printf ("\r%d/%d passes", pass, reps);
- fflush (stdout);
- }
-
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 21 + 2;
+ size_range = mpz_get_ui (bs) % 12 + 2;
- if ((pass & 1) == 0)
- {
- /* Make all input operands have quite different sizes */
- mpz_urandomb (bs, rands, 32);
- size = mpz_get_ui (bs) % size_range;
- mpz_rrandomb (in1, rands, size);
-
- mpz_urandomb (bs, rands, 32);
- size = mpz_get_ui (bs) % size_range;
- mpz_rrandomb (in2, rands, size);
-
- mpz_urandomb (bs, rands, 32);
- size = mpz_get_ui (bs) % size_range;
- mpz_rrandomb (in3, rands, size);
- }
- else
- {
- /* Make all input operands have about the same size */
- mpz_urandomb (bs, rands, size_range);
- size = mpz_get_ui (bs);
- mpz_rrandomb (in1, rands, size);
-
- mpz_urandomb (bs, rands, size_range);
- size = mpz_get_ui (bs);
- mpz_rrandomb (in2, rands, size);
-
- mpz_urandomb (bs, rands, size_range);
- size = mpz_get_ui (bs);
- mpz_rrandomb (in3, rands, size);
- }
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (in1, rands, size);
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (in2, rands, size);
+
+ mpz_urandomb (bs, rands, size_range);
+ size = mpz_get_ui (bs);
+ mpz_rrandomb (in3, rands, size);
mpz_urandomb (bs, rands, 3);
bsi = mpz_get_ui (bs);
if ((bsi & 1) != 0)
mpz_neg (in1, in1);
- if ((bsi & 2) != 0)
+ if ((bsi & 1) != 0)
mpz_neg (in2, in2);
- if ((bsi & 4) != 0)
+ if ((bsi & 1) != 0)
mpz_neg (in3, in3);
- for (i = 0; i < numberof (dss); i++)
+ for (i = 0; i < sizeof (dss_funcs) / sizeof (dss_func); i++)
{
- if (dss[i].isdivision && mpz_sgn (in2) == 0)
+ if (dss_funcs[i] == 0)
continue;
- if (dss[i].isslow && size_range > 19)
+ if (dss_func_division[i] && mpz_sgn (in2) == 0)
continue;
- (dss[i].fptr) (ref1, in1, in2);
+ (dss_funcs[i]) (ref1, in1, in2);
MPZ_CHECK_FORMAT (ref1);
mpz_set (res1, in1);
- INVOKE_RSS (dss[i], res1, res1, in2);
+ (dss_funcs[i]) (res1, res1, in2);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0)
FAIL (dss, i, in1, in2, NULL);
mpz_set (res1, in2);
- INVOKE_RSS (dss[i], res1, in1, res1);
+ (dss_funcs[i]) (res1, in1, res1);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0)
FAIL (dss, i, in1, in2, NULL);
}
- for (i = 0; i < numberof (ddss_div); i++)
+ for (i = 0; i < sizeof (ddss_div_funcs) / sizeof (ddss_div_func); i++)
{
+ if (ddss_div_funcs[i] == 0)
+ continue;
if (mpz_sgn (in2) == 0)
continue;
- (ddss_div[i].fptr) (ref1, ref2, in1, in2);
+ (ddss_div_funcs[i]) (ref1, ref2, in1, in2);
MPZ_CHECK_FORMAT (ref1);
MPZ_CHECK_FORMAT (ref2);
mpz_set (res1, in1);
- INVOKE_RRSS (ddss_div[i], res1, res2, res1, in2);
+ (ddss_div_funcs[i]) (res1, res2, res1, in2);
MPZ_CHECK_FORMAT (res1);
MPZ_CHECK_FORMAT (res2);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
FAIL (ddss_div, i, in1, in2, NULL);
mpz_set (res2, in1);
- INVOKE_RRSS (ddss_div[i], res1, res2, res2, in2);
+ (ddss_div_funcs[i]) (res1, res2, res2, in2);
MPZ_CHECK_FORMAT (res1);
MPZ_CHECK_FORMAT (res2);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
FAIL (ddss_div, i, in1, in2, NULL);
mpz_set (res1, in2);
- INVOKE_RRSS (ddss_div[i], res1, res2, in1, res1);
+ (ddss_div_funcs[i]) (res1, res2, in1, res1);
MPZ_CHECK_FORMAT (res1);
MPZ_CHECK_FORMAT (res2);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
FAIL (ddss_div, i, in1, in2, NULL);
mpz_set (res2, in2);
- INVOKE_RRSS (ddss_div[i], res1, res2, in1, res2);
+ (ddss_div_funcs[i]) (res1, res2, in1, res2);
MPZ_CHECK_FORMAT (res1);
MPZ_CHECK_FORMAT (res2);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
FAIL (ddss_div, i, in1, in2, NULL);
}
- for (i = 0; i < numberof (ds); i++)
+ for (i = 0; i < sizeof (ds_funcs) / sizeof (ds_func); i++)
{
- if (ds[i].nonneg && mpz_sgn (in1) < 0)
+ if (ds_funcs[i] == 0)
+ continue;
+ if (strcmp (ds_func_names[i], "mpz_sqrt") == 0
+ && mpz_sgn (in1) < 0)
continue;
- (ds[i].fptr) (ref1, in1);
+ (ds_funcs[i]) (ref1, in1);
MPZ_CHECK_FORMAT (ref1);
mpz_set (res1, in1);
- INVOKE_RS (ds[i], res1, res1);
+ (ds_funcs[i]) (res1, res1);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0)
FAIL (ds, i, in1, in2, NULL);
@@ -360,16 +325,27 @@ main (int argc, char **argv)
in2i = mpz_get_ui (in2);
- for (i = 0; i < numberof (dsi); i++)
+ for (i = 0; i < sizeof (dsi_funcs) / sizeof (dsi_func); i++)
{
- if (dsi[i].mod != 0)
- in2i = mpz_get_ui (in2) % dsi[i].mod;
-
- (dsi[i].fptr) (ref1, in1, in2i);
+ if (dsi_funcs[i] == 0)
+ continue;
+ if (strcmp (dsi_func_names[i], "mpz_fdiv_q_2exp") == 0)
+ /* Limit exponent to something reasonable for the division
+ functions. Without this, we'd normally shift things off
+ the end and just generate the trivial values 1, 0, -1. */
+ in2i %= 0x1000;
+ if (strcmp (dsi_func_names[i], "mpz_mul_2exp") == 0)
+ /* Limit exponent more for mpz_mul_2exp to save time. */
+ in2i %= 0x100;
+ if (strcmp (dsi_func_names[i], "mpz_pow_ui") == 0)
+ /* Limit exponent yet more for mpz_pow_ui to save time. */
+ in2i %= 0x10;
+
+ (dsi_funcs[i]) (ref1, in1, in2i);
MPZ_CHECK_FORMAT (ref1);
mpz_set (res1, in1);
- INVOKE_RRS (dsi[i], res1, res1, in2i);
+ (dsi_funcs[i]) (res1, res1, in2i);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0)
FAIL (dsi, i, in1, in2, NULL);
@@ -377,31 +353,31 @@ main (int argc, char **argv)
if (in2i != 0) /* Don't divide by 0. */
{
- for (i = 0; i < numberof (dsi_div); i++)
+ for (i = 0; i < sizeof (dsi_div_funcs) / sizeof (dsi_div_funcs); i++)
{
- r1 = (dsi_div[i].fptr) (ref1, in1, in2i);
+ r1 = (dsi_div_funcs[i]) (ref1, in1, in2i);
MPZ_CHECK_FORMAT (ref1);
mpz_set (res1, in1);
- r2 = (dsi_div[i].fptr) (res1, res1, in2i);
+ r2 = (dsi_div_funcs[i]) (res1, res1, in2i);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0 || r1 != r2)
FAIL (dsi_div, i, in1, in2, NULL);
}
- for (i = 0; i < numberof (ddsi_div); i++)
+ for (i = 0; i < sizeof (ddsi_div_funcs) / sizeof (ddsi_div_funcs); i++)
{
- r1 = (ddsi_div[i].fptr) (ref1, ref2, in1, in2i);
+ r1 = (ddsi_div_funcs[i]) (ref1, ref2, in1, in2i);
MPZ_CHECK_FORMAT (ref1);
mpz_set (res1, in1);
- r2 = (ddsi_div[i].fptr) (res1, res2, res1, in2i);
+ r2 = (ddsi_div_funcs[i]) (res1, res2, res1, in2i);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2)
FAIL (ddsi_div, i, in1, in2, NULL);
mpz_set (res2, in1);
- (ddsi_div[i].fptr) (res1, res2, res2, in2i);
+ (ddsi_div_funcs[i]) (res1, res2, res2, in2i);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0 || r1 != r2)
FAIL (ddsi_div, i, in1, in2, NULL);
@@ -427,21 +403,15 @@ main (int argc, char **argv)
MPZ_CHECK_FORMAT (res2);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
FAIL2 (mpz_sqrtrem, in1, NULL, NULL);
-
- mpz_set (res1, in1);
- mpz_sqrtrem (res1, res1, res1);
- MPZ_CHECK_FORMAT (res1);
- if (mpz_cmp (ref2, res1) != 0)
- FAIL2 (mpz_sqrtrem, in1, NULL, NULL);
}
if (mpz_sgn (in1) >= 0)
{
- mpz_root (ref1, in1, in2i % 0x100 + 1);
+ mpz_root (ref1, in1, in2i % 0x1000 + 1);
MPZ_CHECK_FORMAT (ref1);
mpz_set (res1, in1);
- mpz_root (res1, res1, in2i % 0x100 + 1);
+ mpz_root (res1, res1, in2i % 0x1000 + 1);
MPZ_CHECK_FORMAT (res1);
if (mpz_cmp (ref1, res1) != 0)
FAIL2 (mpz_root, in1, in2, NULL);
@@ -449,26 +419,26 @@ main (int argc, char **argv)
if (mpz_sgn (in1) >= 0)
{
- mpz_rootrem (ref1, ref2, in1, in2i % 0x100 + 1);
+ mpz_rootrem (ref1, ref2, in1, in2i % 0x1000 + 1);
MPZ_CHECK_FORMAT (ref1);
MPZ_CHECK_FORMAT (ref2);
mpz_set (res1, in1);
- mpz_rootrem (res1, res2, res1, in2i % 0x100 + 1);
+ mpz_rootrem (res1, res2, res1, in2i % 0x1000 + 1);
MPZ_CHECK_FORMAT (res1);
MPZ_CHECK_FORMAT (res2);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
FAIL2 (mpz_rootrem, in1, in2, NULL);
mpz_set (res2, in1);
- mpz_rootrem (res1, res2, res2, in2i % 0x100 + 1);
+ mpz_rootrem (res1, res2, res2, in2i % 0x1000 + 1);
MPZ_CHECK_FORMAT (res1);
MPZ_CHECK_FORMAT (res2);
if (mpz_cmp (ref1, res1) != 0 || mpz_cmp (ref2, res2) != 0)
FAIL2 (mpz_rootrem, in1, in2, NULL);
}
- if (size_range < 18) /* run fewer tests since gcdext is slow */
+ if (pass < reps / 2) /* run fewer tests since gcdext lots of time */
{
mpz_gcdext (ref1, ref2, ref3, in1, in2);
MPZ_CHECK_FORMAT (ref1);
@@ -563,7 +533,7 @@ main (int argc, char **argv)
}
/* Don't run mpz_powm for huge exponents or when undefined. */
- if (size_range < 17 && mpz_sizeinbase (in2, 2) < 250 && mpz_sgn (in3) != 0
+ if (mpz_sizeinbase (in2, 2) < 250 && mpz_sgn (in3) != 0
&& (mpz_sgn (in2) >= 0 || mpz_invert (t, in1, in3)))
{
mpz_powm (ref1, in1, in2, in3);
@@ -589,7 +559,7 @@ main (int argc, char **argv)
}
/* Don't run mpz_powm_ui when undefined. */
- if (size_range < 17 && mpz_sgn (in3) != 0)
+ if (mpz_sgn (in3) != 0)
{
mpz_powm_ui (ref1, in1, in2i, in3);
MPZ_CHECK_FORMAT (ref1);
@@ -618,23 +588,22 @@ main (int argc, char **argv)
FAIL2 (mpz_gcd_ui, in1, in2, NULL);
}
- if (mpz_sgn (in2) != 0)
+ if (mpz_cmp_ui (in2, 1L) > 0 && mpz_sgn (in1) != 0)
{
/* Test mpz_remove */
- mp_bitcnt_t refretval, retval;
- refretval = mpz_remove (ref1, in1, in2);
+ mpz_remove (ref1, in1, in2);
MPZ_CHECK_FORMAT (ref1);
mpz_set (res1, in1);
- retval = mpz_remove (res1, res1, in2);
+ mpz_remove (res1, res1, in2);
MPZ_CHECK_FORMAT (res1);
- if (mpz_cmp (ref1, res1) != 0 || refretval != retval)
+ if (mpz_cmp (ref1, res1) != 0)
FAIL2 (mpz_remove, in1, in2, NULL);
mpz_set (res1, in2);
- retval = mpz_remove (res1, in1, res1);
+ mpz_remove (res1, in1, res1);
MPZ_CHECK_FORMAT (res1);
- if (mpz_cmp (ref1, res1) != 0 || refretval != retval)
+ if (mpz_cmp (ref1, res1) != 0)
FAIL2 (mpz_remove, in1, in2, NULL);
}
@@ -679,8 +648,11 @@ main (int argc, char **argv)
}
}
- if (isatty (fileno (stdout)))
- printf ("\r%20s", "");
+ if (failures != 0)
+ {
+ fprintf (stderr, "mpz/reuse: %ld error%s\n", failures, "s" + (failures == 1));
+ exit (1);
+ }
mpz_clear (bs);
mpz_clear (in1);
@@ -694,27 +666,24 @@ main (int argc, char **argv)
mpz_clear (res3);
mpz_clear (t);
- if (isatty (fileno (stdout)))
- printf ("\r");
-
tests_end ();
exit (0);
}
void
-dump (const char *name, mpz_t in1, mpz_t in2, mpz_t in3)
+dump (char *name, mpz_t in1, mpz_t in2, mpz_t in3)
{
printf ("failure in %s (", name);
- 0 && mpz_out_str (stdout, -16, in1);
+ mpz_out_str (stdout, -16, in1);
if (in2 != NULL)
{
printf (" ");
- 0 && mpz_out_str (stdout, -16, in2);
+ mpz_out_str (stdout, -16, in2);
}
if (in3 != NULL)
{
printf (" ");
- 0 && mpz_out_str (stdout, -16, in3);
+ mpz_out_str (stdout, -16, in3);
}
printf (")\n");
}
diff --git a/gmp/tests/mpz/t-addsub.c b/gmp/tests/mpz/t-addsub.c
index bf89841150..815a839731 100644
--- a/gmp/tests/mpz/t-addsub.c
+++ b/gmp/tests/mpz/t-addsub.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "longlong.h"
#include "tests.h"
-void debug_mp (mpz_t, int);
-void dump_abort (int, const char *, mpz_t, mpz_t);
+void debug_mp __GMP_PROTO ((mpz_t, int));
+void dump_abort __GMP_PROTO ((int, char *, mpz_t, mpz_t));
int
main (int argc, char **argv)
@@ -107,7 +107,7 @@ main (int argc, char **argv)
}
void
-dump_abort (int i, const char *s, mpz_t op1, mpz_t op2)
+dump_abort (int i, char *s, mpz_t op1, mpz_t op2)
{
fprintf (stderr, "ERROR: %s in test %d\n", s, i);
fprintf (stderr, "op1 = "); debug_mp (op1, -16);
diff --git a/gmp/tests/mpz/t-aorsmul.c b/gmp/tests/mpz/t-aorsmul.c
index 918725fdcb..36b7933cad 100644
--- a/gmp/tests/mpz/t-aorsmul.c
+++ b/gmp/tests/mpz/t-aorsmul.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
@@ -388,14 +388,14 @@ check_random (int argc, char *argv[])
for (i = 0; i < reps; i++)
{
- mpz_errandomb (w, rands, 5*GMP_LIMB_BITS);
- mpz_errandomb (x, rands, 5*GMP_LIMB_BITS);
- mpz_errandomb (y, rands, 5*GMP_LIMB_BITS);
+ mpz_errandomb (w, rands, 5*BITS_PER_MP_LIMB);
+ mpz_errandomb (x, rands, 5*BITS_PER_MP_LIMB);
+ mpz_errandomb (y, rands, 5*BITS_PER_MP_LIMB);
check_all (w, x, y);
check_all_inplace (w, y);
- mpz_errandomb (w, rands, 5*GMP_LIMB_BITS);
- mpz_errandomb (x, rands, 5*GMP_LIMB_BITS);
+ mpz_errandomb (w, rands, 5*BITS_PER_MP_LIMB);
+ mpz_errandomb (x, rands, 5*BITS_PER_MP_LIMB);
mpz_errandomb (y, rands, BITS_PER_ULONG);
check_all (w, x, y);
check_all_inplace (w, y);
diff --git a/gmp/tests/mpz/t-bin.c b/gmp/tests/mpz/t-bin.c
index acce41df9a..6e9a34b803 100644
--- a/gmp/tests/mpz/t-bin.c
+++ b/gmp/tests/mpz/t-bin.c
@@ -1,21 +1,21 @@
/* Exercise mpz_bin_ui and mpz_bin_uiui.
-Copyright 2000, 2001, 2010, 2012 Free Software Foundation, Inc.
+Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -23,8 +23,6 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-/* Default number of generated tests. */
-#define COUNT 700
void
try_mpz_bin_ui (mpz_srcptr want, mpz_srcptr n, unsigned long k)
@@ -77,11 +75,58 @@ samples (void)
const char *want;
} data[] = {
+ { "0", 0, "1" },
+ { "0", 1, "0" },
+ { "0", 2, "0" },
+ { "0", 3, "0" },
+ { "0", 4, "0" },
{ "0", 123456, "0" },
- { "1", 543210, "0" },
- { "2", 123321, "0" },
- { "3", 234567, "0" },
- { "10", 23456, "0" },
+
+ { "1", 0, "1" },
+ { "1", 1, "1" },
+ { "1", 2, "0" },
+ { "1", 3, "0" },
+ { "1", 4, "0" },
+ { "1", 123456, "0" },
+
+ { "2", 0, "1" },
+ { "2", 1, "2" },
+ { "2", 2, "1" },
+ { "2", 3, "0" },
+ { "2", 4, "0" },
+ { "2", 123456, "0" },
+
+ { "3", 0, "1" },
+ { "3", 1, "3" },
+ { "3", 2, "3" },
+ { "3", 3, "1" },
+ { "3", 4, "0" },
+ { "3", 5, "0" },
+ { "3", 123456, "0" },
+
+ { "4", 0, "1" },
+ { "4", 1, "4" },
+ { "4", 2, "6" },
+ { "4", 3, "4" },
+ { "4", 4, "1" },
+ { "4", 5, "0" },
+ { "4", 6, "0" },
+ { "4", 123456, "0" },
+
+ { "10", 0, "1" },
+ { "10", 1, "10" },
+ { "10", 2, "45" },
+ { "10", 3, "120" },
+ { "10", 4, "210" },
+ { "10", 5, "252" },
+ { "10", 6, "210" },
+ { "10", 7, "120" },
+ { "10", 8, "45" },
+ { "10", 9, "10" },
+ { "10", 10, "1" },
+ { "10", 11, "0" },
+ { "10", 12, "0" },
+ { "10", 123456, "0" },
/* negatives, using bin(-n,k)=bin(n+k-1,k) */
{ "-1", 0, "1" },
@@ -106,11 +151,8 @@ samples (void)
{ "-3", 5, "-21" },
{ "-3", 6, "28" },
- /* A few random values */
- { "41", 20, "269128937220" },
- { "62", 37, "147405545359541742" },
- { "50", 18, "18053528883775" },
- { "149", 21, "19332950844468483467894649" },
+ { "40", 20, "137846528820" },
+ { "60", 30, "118264581564861424" },
};
mpz_t n, want;
@@ -138,7 +180,7 @@ samples (void)
/* Test some bin(2k,k) cases. This produces some biggish numbers to
exercise the limb accumulating code. */
void
-twos (int count)
+twos (void)
{
mpz_t n, want;
unsigned long k;
@@ -147,7 +189,7 @@ twos (int count)
mpz_init (want);
mpz_set_ui (want, (unsigned long) 2);
- for (k = 1; k < count; k++)
+ for (k = 1; k < 200; k++)
{
mpz_set_ui (n, 2*k);
try_mpz_bin_ui (want, n, k);
@@ -162,104 +204,14 @@ twos (int count)
mpz_clear (want);
}
-/* Test some random bin(n,k) cases. This produces some biggish
- numbers to exercise the limb accumulating code. */
-void
-randomwalk (int count)
-{
- mpz_t n_z, want;
- unsigned long n, k, i, r;
- int tests;
- gmp_randstate_ptr rands;
-
- rands = RANDS;
- mpz_init (n_z);
- mpz_init (want);
-
- k = 3;
- n = 12;
- mpz_set_ui (want, (unsigned long) 220); /* binomial(12,3) = 220 */
-
- for (tests = 1; tests < count; tests++)
- {
- r = gmp_urandomm_ui (rands, 62) + 1;
- for (i = r & 7; i > 0; i--)
- {
- n++; k++;
- mpz_mul_ui (want, want, n);
- mpz_fdiv_q_ui (want, want, k);
- }
- for (i = r >> 3; i > 0; i--)
- {
- n++;
- mpz_mul_ui (want, want, n);
- mpz_fdiv_q_ui (want, want, n - k);
- }
-
- mpz_set_ui (n_z, n);
- try_mpz_bin_ui (want, n_z, k);
-
- try_mpz_bin_uiui (want, n, k);
- }
-
- mpz_clear (n_z);
- mpz_clear (want);
-}
-
-
-/* Test all bin(n,k) cases, with 0 <= k <= n + 1 <= count. */
-void
-smallexaustive (unsigned int count)
-{
- mpz_t n_z, want;
- unsigned long n, k;
-
- mpz_init (n_z);
- mpz_init (want);
-
- for (n = 0; n < count; n++)
- {
- mpz_set_ui (want, (unsigned long) 1);
- mpz_set_ui (n_z, n);
- for (k = 0; k <= n; k++)
- {
- try_mpz_bin_ui (want, n_z, k);
- try_mpz_bin_uiui (want, n, k);
- mpz_mul_ui (want, want, n - k);
- mpz_fdiv_q_ui (want, want, k + 1);
- }
- try_mpz_bin_ui (want, n_z, k);
- try_mpz_bin_uiui (want, n, k);
- }
-
- mpz_clear (n_z);
- mpz_clear (want);
-}
int
-main (int argc, char **argv)
+main (void)
{
- int count;
-
- 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;
- }
- }
- else
- count = COUNT;
-
tests_start ();
samples ();
- smallexaustive (count >> 4);
- twos (count >> 1);
- randomwalk (count - (count >> 1));
+ twos ();
tests_end ();
exit (0);
diff --git a/gmp/tests/mpz/t-cdiv_ui.c b/gmp/tests/mpz/t-cdiv_ui.c
index 39735a92e9..1f6be7fe7a 100644
--- a/gmp/tests/mpz/t-cdiv_ui.c
+++ b/gmp/tests/mpz/t-cdiv_ui.c
@@ -1,22 +1,22 @@
/* 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-2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void dump_abort (const char *, mpz_t, unsigned long);
-void debug_mp (mpz_t, int);
+void dump_abort __GMP_PROTO ((char *, mpz_t, unsigned long));
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
@@ -144,7 +144,7 @@ main (int argc, char **argv)
}
void
-dump_abort (const char *str, mpz_t dividend, unsigned long divisor)
+dump_abort (char *str, mpz_t dividend, unsigned long divisor)
{
fprintf (stderr, "ERROR: %s\n", str);
fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
diff --git a/gmp/tests/mpz/t-cmp.c b/gmp/tests/mpz/t-cmp.c
index cf0474e7f1..40c54a1ff9 100644
--- a/gmp/tests/mpz/t-cmp.c
+++ b/gmp/tests/mpz/t-cmp.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-cmp_d.c b/gmp/tests/mpz/t-cmp_d.c
index c9877fc521..9cefd20c14 100644
--- a/gmp/tests/mpz/t-cmp_d.c
+++ b/gmp/tests/mpz/t-cmp_d.c
@@ -1,21 +1,21 @@
/* Test mpz_cmp_d and mpz_cmpabs_d.
-Copyright 2001-2003, 2005 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003, 2005 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -84,14 +84,11 @@ check_data (void)
{ "1", 0.0, 1, 1 },
{ "-1", 0.0, -1, 1 },
- { "1", 0.5, 1, 1 },
- { "-1", -0.5, -1, 1 },
-
{ "0", 1.0, -1, -1 },
{ "0", -1.0, 1, -1 },
- { "0x1000000000000000000000000000000000000000000000000", 1.0, 1, 1 },
- { "-0x1000000000000000000000000000000000000000000000000", 1.0, -1, 1 },
+ { "0x1000000000000000000000000000000000000000000000000", 0.0, 1, 1 },
+ { "-0x1000000000000000000000000000000000000000000000000", 0.0, -1, 1 },
{ "0", 1e100, -1, -1 },
{ "0", -1e100, 1, -1 },
@@ -164,7 +161,7 @@ check_low_z_one (void)
mpz_init (x);
/* FIXME: It'd be better to base this on the float format. */
-#if defined (__vax) || defined (__vax__)
+#ifdef __vax
#define LIM 127 /* vax fp numbers have limited range */
#else
#define LIM 512
diff --git a/gmp/tests/mpz/t-cmp_si.c b/gmp/tests/mpz/t-cmp_si.c
index 97fdbcaae3..25e8a3b381 100644
--- a/gmp/tests/mpz/t-cmp_si.c
+++ b/gmp/tests/mpz/t-cmp_si.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-cong.c b/gmp/tests/mpz/t-cong.c
index 1227335ec5..5ef444ca8e 100644
--- a/gmp/tests/mpz/t-cong.c
+++ b/gmp/tests/mpz/t-cong.c
@@ -1,21 +1,21 @@
/* test mpz_congruent_p and mpz_congruent_ui_p
-Copyright 2001, 2002, 2012 Free Software Foundation, Inc.
+Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -34,38 +34,38 @@ check_one (mpz_srcptr a, mpz_srcptr c, mpz_srcptr d, int want)
{
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);
- mpz_trace (" a", a);
- mpz_trace (" c", c);
- mpz_trace (" d", d);
- mp_trace_base = -16;
- mpz_trace (" a", a);
- mpz_trace (" c", c);
- mpz_trace (" d", d);
- abort ();
- }
+ {
+ printf ("mpz_congruent_p wrong\n");
+ printf (" expected %d got %d\n", want, got);
+ mpz_trace (" a", a);
+ mpz_trace (" c", c);
+ mpz_trace (" d", d);
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ mpz_trace (" c", c);
+ mpz_trace (" d", d);
+ abort ();
+ }
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);
- mpz_trace (" a", a);
- printf (" c=%lu\n", uc);
- printf (" d=%lu\n", ud);
- mp_trace_base = -16;
- mpz_trace (" a", a);
- printf (" c=0x%lX\n", uc);
- printf (" d=0x%lX\n", ud);
- abort ();
- }
- }
+ {
+ 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);
+ mpz_trace (" a", a);
+ printf (" c=%lu\n", uc);
+ printf (" d=%lu\n", ud);
+ mp_trace_base = -16;
+ mpz_trace (" a", a);
+ printf (" c=0x%lX\n", uc);
+ printf (" d=0x%lX\n", ud);
+ abort ();
+ }
+ }
MPZ_SRCPTR_SWAP (a, c);
}
@@ -83,11 +83,6 @@ check_data (void)
} 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 },
@@ -138,15 +133,11 @@ 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;
+ int reps = 50000;
if (argc >= 2)
reps = atoi (argv[1]);
- mpz_init (bs);
-
mpz_init (a);
mpz_init (c);
mpz_init (d);
@@ -155,30 +146,11 @@ check_random (int argc, char *argv[])
for (i = 0; i < reps; i++)
{
- mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 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) % 16 + 1; /* 0..65536 bit operands */
-
- mpz_urandomb (bs, rands, size_range);
- size = mpz_get_ui (bs);
- mpz_rrandomb (c, rands, size);
-
- do
- {
- mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 16 + 1; /* 0..65536 bit operands */
-
- mpz_urandomb (bs, rands, size_range);
- size = mpz_get_ui (bs);
- mpz_rrandomb (d, rands, size);
- }
- while (SIZ(d) == 0);
+ mpz_errandomb (a, rands, 8*BITS_PER_MP_LIMB);
+ MPZ_CHECK_FORMAT (a);
+ mpz_errandomb (c, rands, 8*BITS_PER_MP_LIMB);
+ MPZ_CHECK_FORMAT (c);
+ mpz_errandomb_nonzero (d, rands, 8*BITS_PER_MP_LIMB);
mpz_negrandom (a, rands);
MPZ_CHECK_FORMAT (a);
@@ -199,13 +171,11 @@ check_random (int argc, char *argv[])
if (! mpz_pow2abs_p (d))
{
- refmpz_combit (a, urandom() % (8*GMP_LIMB_BITS));
- check_one (a, c, d, 0);
+ refmpz_combit (a, urandom() % (8*BITS_PER_MP_LIMB));
+ check_one (a, c, d, 0);
}
}
- mpz_clear (bs);
-
mpz_clear (a);
mpz_clear (c);
mpz_clear (d);
diff --git a/gmp/tests/mpz/t-cong_2exp.c b/gmp/tests/mpz/t-cong_2exp.c
index 3ccb5aab04..478f782317 100644
--- a/gmp/tests/mpz/t-cong_2exp.c
+++ b/gmp/tests/mpz/t-cong_2exp.c
@@ -1,22 +1,22 @@
/* test mpz_congruent_2exp_p */
/*
-Copyright 2001, 2013 Free Software Foundation, Inc.
+Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -81,10 +81,8 @@ 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 },
};
@@ -107,12 +105,17 @@ check_data (void)
void
-check_random (int reps)
+check_random (int argc, char *argv[])
{
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);
@@ -121,12 +124,12 @@ check_random (int reps)
for (i = 0; i < reps; i++)
{
- mpz_errandomb (a, rands, 8*GMP_LIMB_BITS);
- mpz_errandomb (c, rands, 8*GMP_LIMB_BITS);
- d = urandom() % (8*GMP_LIMB_BITS);
+ mpz_errandomb (a, rands, 8*BITS_PER_MP_LIMB);
+ mpz_errandomb (c, rands, 8*BITS_PER_MP_LIMB);
+ d = urandom() % (8*BITS_PER_MP_LIMB);
- mpz_mul_2exp (a, a, urandom() % (2*GMP_LIMB_BITS));
- mpz_mul_2exp (c, c, urandom() % (2*GMP_LIMB_BITS));
+ mpz_mul_2exp (a, a, urandom() % (2*BITS_PER_MP_LIMB));
+ mpz_mul_2exp (c, c, urandom() % (2*BITS_PER_MP_LIMB));
mpz_negrandom (a, rands);
mpz_negrandom (c, rands);
@@ -134,18 +137,12 @@ check_random (int reps)
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);
- if (mpz_cmp_ui (ra, 0) != 0)
- {
- check_one (a, c, d, 0);
- mpz_sub (a, a, ra);
- }
+ 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);
@@ -154,55 +151,14 @@ check_random (int reps)
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 (reps);
- check_random_bits (reps);
+ check_random (argc, argv);
tests_end ();
exit (0);
diff --git a/gmp/tests/mpz/t-div_2exp.c b/gmp/tests/mpz/t-div_2exp.c
index 1620698b12..934ef18e47 100644
--- a/gmp/tests/mpz/t-div_2exp.c
+++ b/gmp/tests/mpz/t-div_2exp.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-divis.c b/gmp/tests/mpz/t-divis.c
index fdfedc82b3..b5f3750063 100644
--- a/gmp/tests/mpz/t-divis.c
+++ b/gmp/tests/mpz/t-divis.c
@@ -1,21 +1,22 @@
-/* test mpz_divisible_p and mpz_divisible_ui_p
+/* test mpz_divisible_p and mpz_divisible_ui_p */
-Copyright 2001, 2009 Free Software Foundation, Inc.
+/*
+Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -71,8 +72,6 @@ check_data (void)
} data[] = {
- { "0", "0", 1 },
- { "17", "0", 0 },
{ "0", "1", 1 },
{ "123", "1", 1 },
{ "-123", "1", 1 },
@@ -126,8 +125,8 @@ check_random (int reps)
for (i = 0; i < reps; i++)
{
- mpz_erandomb (a, rands, 1 << 19);
- mpz_erandomb_nonzero (d, rands, 1 << 18);
+ mpz_erandomb (a, rands, 512);
+ mpz_erandomb_nonzero (d, rands, 512);
mpz_fdiv_r (r, a, d);
@@ -153,7 +152,7 @@ check_random (int reps)
int
main (int argc, char *argv[])
{
- int reps = 100;
+ int reps = 1000;
tests_start ();
diff --git a/gmp/tests/mpz/t-divis_2exp.c b/gmp/tests/mpz/t-divis_2exp.c
index ecd7440eae..88588a3d7e 100644
--- a/gmp/tests/mpz/t-divis_2exp.c
+++ b/gmp/tests/mpz/t-divis_2exp.c
@@ -3,20 +3,20 @@
/*
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-export.c b/gmp/tests/mpz/t-export.c
index d07476486d..f2fb3bd3a7 100644
--- a/gmp/tests/mpz/t-export.c
+++ b/gmp/tests/mpz/t-export.c
@@ -2,20 +2,20 @@
Copyright 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-fac_ui.c b/gmp/tests/mpz/t-fac_ui.c
index 079bdff912..25d746e758 100644
--- a/gmp/tests/mpz/t-fac_ui.c
+++ b/gmp/tests/mpz/t-fac_ui.c
@@ -1,21 +1,21 @@
-/* Exercise mpz_fac_ui and mpz_2fac_ui.
+/* Exercise mpz_fac_ui.
-Copyright 2000-2002, 2012 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -35,9 +35,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
int
main (int argc, char *argv[])
{
- unsigned long n, m;
- unsigned long limit = 2222;
- mpz_t df[2], f, r;
+ unsigned long n;
+ unsigned long limit = 1500;
+ mpz_t f, r;
tests_start ();
@@ -49,12 +49,10 @@ main (int argc, char *argv[])
/* for small limb testing */
limit = MIN (limit, MP_LIMB_T_MAX);
- mpz_init_set_ui (df[0], 1); /* 0!! = 1 */
- mpz_init_set_ui (df[1], 1); /* -1!! = 1 */
mpz_init_set_ui (f, 1); /* 0! = 1 */
mpz_init (r);
- for (n = 0, m = 0; n < limit; n++)
+ for (n = 0; n < limit; n++)
{
mpz_fac_ui (r, n);
MPZ_CHECK_FORMAT (r);
@@ -67,36 +65,9 @@ main (int argc, char *argv[])
abort ();
}
- mpz_2fac_ui (r, n);
- MPZ_CHECK_FORMAT (r);
-
- if (mpz_cmp (df[m], r) != 0)
- {
- printf ("mpz_2fac_ui(%lu) wrong\n", n);
- printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, df[m]); printf("\n");
- abort ();
- }
-
- m ^= 1;
- mpz_mul_ui (df[m], df[m], n+1); /* (n+1)!! = (n-1)!! * (n+1) */
- mpz_mul_ui (f, f, n+1); /* (n+1)! = n! * (n+1) */
- }
-
- n = 1048573; /* a prime */
- if (n > MP_LIMB_T_MAX)
- n = 65521; /* a smaller prime :-) */
- mpz_fac_ui (f, n - 1);
- m = mpz_fdiv_ui (f, n);
- if ( m != n - 1)
- {
- printf ("mpz_fac_ui(%lu) wrong\n", n - 1);
- printf (" Wilson's theorem not verified: got %lu, expected %lu.\n",m ,n - 1);
- abort ();
+ mpz_mul_ui (f, f, n+1); /* (n+1)! = n! * n */
}
- mpz_clear (df[0]);
- mpz_clear (df[1]);
mpz_clear (f);
mpz_clear (r);
diff --git a/gmp/tests/mpz/t-fdiv.c b/gmp/tests/mpz/t-fdiv.c
index a616e5b101..c4053fab90 100644
--- a/gmp/tests/mpz/t-fdiv.c
+++ b/gmp/tests/mpz/t-fdiv.c
@@ -3,20 +3,20 @@
Copyright 1993, 1994, 1996, 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void dump_abort (mpz_t, mpz_t);
-void debug_mp (mpz_t, int);
+void dump_abort __GMP_PROTO ((mpz_t, mpz_t));
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
diff --git a/gmp/tests/mpz/t-fdiv_ui.c b/gmp/tests/mpz/t-fdiv_ui.c
index 031b519f8f..3012d9b112 100644
--- a/gmp/tests/mpz/t-fdiv_ui.c
+++ b/gmp/tests/mpz/t-fdiv_ui.c
@@ -1,22 +1,22 @@
/* 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-2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void dump_abort (const char *, mpz_t, unsigned long);
-void debug_mp (mpz_t, int);
+void dump_abort __GMP_PROTO ((char *, mpz_t, unsigned long));
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
@@ -144,7 +144,7 @@ main (int argc, char **argv)
}
void
-dump_abort (const char *str, mpz_t dividend, unsigned long divisor)
+dump_abort (char *str, mpz_t dividend, unsigned long divisor)
{
fprintf (stderr, "ERROR: %s\n", str);
fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
diff --git a/gmp/tests/mpz/t-fib_ui.c b/gmp/tests/mpz/t-fib_ui.c
index a7425b5b89..1e84a288e3 100644
--- a/gmp/tests/mpz/t-fib_ui.c
+++ b/gmp/tests/mpz/t-fib_ui.c
@@ -1,21 +1,21 @@
/* Test mpz_fib_ui and mpz_fib2_ui.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -73,7 +73,7 @@ int
main (int argc, char *argv[])
{
unsigned long n;
- unsigned long limit = 100 * GMP_LIMB_BITS;
+ unsigned long limit = 100 * BITS_PER_MP_LIMB;
mpz_t want_fn, want_fn1, got_fn, got_fn1;
tests_start ();
diff --git a/gmp/tests/mpz/t-fits.c b/gmp/tests/mpz/t-fits.c
index b1db216573..dac0851567 100644
--- a/gmp/tests/mpz/t-fits.c
+++ b/gmp/tests/mpz/t-fits.c
@@ -3,20 +3,20 @@
/*
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -84,7 +84,7 @@ main (void)
EXPECT (mpz_fits_sshort_p, 1);
mpz_set_ui (z, 1L);
- mpz_mul_2exp (z, z, 5L*GMP_LIMB_BITS);
+ mpz_mul_2exp (z, z, 5L*BITS_PER_MP_LIMB);
expr = "2^(5*BPML)";
EXPECT (mpz_fits_ulong_p, 0);
EXPECT (mpz_fits_uint_p, 0);
diff --git a/gmp/tests/mpz/t-gcd.c b/gmp/tests/mpz/t-gcd.c
index fef4fde0cf..23d7b12d32 100644
--- a/gmp/tests/mpz/t-gcd.c
+++ b/gmp/tests/mpz/t-gcd.c
@@ -1,22 +1,22 @@
/* Test mpz_gcd, mpz_gcdext, and mpz_gcd_ui.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2005, 2008, 2009, 2012 Free
-Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004, 2005,
+2008, 2009 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,29 +25,10 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void one_test (mpz_t, mpz_t, mpz_t, int);
-void debug_mp (mpz_t, int);
-
-static int gcdext_valid_p (const mpz_t, const mpz_t, const mpz_t, const mpz_t);
-
-/* Keep one_test's variables global, so that we don't need
- to reinitialize them for each test. */
-mpz_t gcd1, gcd2, s, temp1, temp2, temp3;
-
-#define MAX_SCHOENHAGE_THRESHOLD HGCD_REDUCE_THRESHOLD
-
-/* Define this to make all operands be large enough for Schoenhage gcd
- to be used. */
-#ifndef WHACK_SCHOENHAGE
-#define WHACK_SCHOENHAGE 0
-#endif
-
-#if WHACK_SCHOENHAGE
-#define MIN_OPERAND_BITSIZE (MAX_SCHOENHAGE_THRESHOLD * GMP_NUMB_BITS)
-#else
-#define MIN_OPERAND_BITSIZE 1
-#endif
+void one_test __GMP_PROTO ((mpz_t, mpz_t, mpz_t, int));
+void debug_mp __GMP_PROTO ((mpz_t, int));
+static int gcdext_valid_p __GMP_PROTO ((const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s));
void
check_data (void)
@@ -66,7 +47,10 @@ check_data (void)
mpz_t a, b, got, want;
int i;
- mpz_inits (a, b, got, want, NULL);
+ mpz_init (a);
+ mpz_init (b);
+ mpz_init (got);
+ mpz_init (want);
for (i = 0; i < numberof (data); i++)
{
@@ -88,162 +72,77 @@ check_data (void)
}
}
- mpz_clears (a, b, got, want, NULL);
-}
-
-void
-make_chain_operands (mpz_t ref, mpz_t a, mpz_t b, gmp_randstate_t rs, int nb1, int nb2, int chain_len)
-{
- mpz_t bs, temp1, temp2;
- int j;
-
- mpz_inits (bs, temp1, temp2, NULL);
-
- /* Generate a division chain backwards, allowing otherwise unlikely huge
- quotients. */
-
- mpz_set_ui (a, 0);
- mpz_urandomb (bs, rs, 32);
- mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb1 + 1);
- mpz_rrandomb (b, rs, mpz_get_ui (bs));
- mpz_add_ui (b, b, 1);
- mpz_set (ref, b);
-
- for (j = 0; j < chain_len; j++)
- {
- mpz_urandomb (bs, rs, 32);
- mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb2 + 1);
- mpz_rrandomb (temp2, rs, mpz_get_ui (bs) + 1);
- mpz_add_ui (temp2, temp2, 1);
- mpz_mul (temp1, b, temp2);
- mpz_add (a, a, temp1);
-
- mpz_urandomb (bs, rs, 32);
- mpz_urandomb (bs, rs, mpz_get_ui (bs) % nb2 + 1);
- mpz_rrandomb (temp2, rs, mpz_get_ui (bs) + 1);
- mpz_add_ui (temp2, temp2, 1);
- mpz_mul (temp1, a, temp2);
- mpz_add (b, b, temp1);
- }
-
- mpz_clears (bs, temp1, temp2, NULL);
-}
-
-/* Test operands from a table of seed data. This variant creates the operands
- using plain ol' mpz_rrandomb. This is a hack for better coverage of the gcd
- code, which depends on that the random number generators give the exact
- numbers we expect. */
-void
-check_kolmo1 (void)
-{
- static const struct {
- unsigned int seed;
- int nb;
- const char *want;
- } data[] = {
- { 59618, 38208, "5"},
- { 76521, 49024, "3"},
- { 85869, 54976, "1"},
- { 99449, 63680, "1"},
- {112453, 72000, "1"}
- };
-
- gmp_randstate_t rs;
- mpz_t bs, a, b, want;
- int i, unb, vnb, nb;
-
- gmp_randinit_default (rs);
-
- mpz_inits (bs, a, b, want, NULL);
-
- for (i = 0; i < numberof (data); i++)
- {
- nb = data[i].nb;
-
- gmp_randseed_ui (rs, data[i].seed);
-
- mpz_urandomb (bs, rs, 32);
- unb = mpz_get_ui (bs) % nb;
- mpz_urandomb (bs, rs, 32);
- vnb = mpz_get_ui (bs) % nb;
-
- mpz_rrandomb (a, rs, unb);
- mpz_rrandomb (b, rs, vnb);
-
- mpz_set_str_or_abort (want, data[i].want, 0);
-
- one_test (a, b, want, -1);
- }
-
- mpz_clears (bs, a, b, want, NULL);
- gmp_randclear (rs);
+ mpz_clear (a);
+ mpz_clear (b);
+ mpz_clear (got);
+ mpz_clear (want);
}
-/* Test operands from a table of seed data. This variant creates the operands
- using a division chain. This is a hack for better coverage of the gcd
- code, which depends on that the random number generators give the exact
- numbers we expect. */
-void
-check_kolmo2 (void)
-{
- static const struct {
- unsigned int seed;
- int nb, chain_len;
- } data[] = {
- { 917, 15, 5 },
- { 1032, 18, 6 },
- { 1167, 18, 6 },
- { 1174, 18, 6 },
- { 1192, 18, 6 },
- };
-
- gmp_randstate_t rs;
- mpz_t bs, a, b, want;
- int i;
-
- gmp_randinit_default (rs);
+/* Keep one_test's variables global, so that we don't need
+ to reinitialize them for each test. */
+mpz_t gcd1, gcd2, s, t, temp1, temp2, temp3;
- mpz_inits (bs, a, b, want, NULL);
+#if GCD_DC_THRESHOLD > GCDEXT_DC_THRESHOLD
+#define MAX_SCHOENHAGE_THRESHOLD GCD_DC_THRESHOLD
+#else
+#define MAX_SCHOENHAGE_THRESHOLD GCDEXT_DC_THRESHOLD
+#endif
- for (i = 0; i < numberof (data); i++)
- {
- gmp_randseed_ui (rs, data[i].seed);
- make_chain_operands (want, a, b, rs, data[i].nb, data[i].nb, data[i].chain_len);
- one_test (a, b, want, -1);
- }
+/* Define this to make all operands be large enough for Schoenhage gcd
+ to be used. */
+#ifndef WHACK_SCHOENHAGE
+#define WHACK_SCHOENHAGE 0
+#endif
- mpz_clears (bs, a, b, want, NULL);
- gmp_randclear (rs);
-}
+#if WHACK_SCHOENHAGE
+#define MIN_OPERAND_BITSIZE (MAX_SCHOENHAGE_THRESHOLD * GMP_NUMB_BITS)
+#else
+#define MIN_OPERAND_BITSIZE 1
+#endif
int
main (int argc, char **argv)
{
mpz_t op1, op2, ref;
- int i, chain_len;
+ int i, j, chain_len;
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long bsi, size_range;
- long int reps = 200;
+ int reps = 100;
- tests_start ();
- TESTS_REPS (reps, argv, argc);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+ tests_start ();
rands = RANDS;
- mpz_inits (bs, op1, op2, ref, gcd1, gcd2, temp1, temp2, temp3, s, NULL);
-
check_data ();
- check_kolmo1 ();
- check_kolmo2 ();
+
+ mpz_init (bs);
+ mpz_init (op1);
+ mpz_init (op2);
+ mpz_init (ref);
+ mpz_init (gcd1);
+ mpz_init (gcd2);
+ mpz_init (temp1);
+ mpz_init (temp2);
+ mpz_init (temp3);
+ mpz_init (s);
+ mpz_init (t);
/* Testcase to exercise the u0 == u1 case in mpn_gcdext_lehmer_n. */
- mpz_set_ui (op2, GMP_NUMB_MAX); /* FIXME: Huge limb doesn't always fit */
+ mpz_set_ui (op2, GMP_NUMB_MAX);
mpz_mul_2exp (op1, op2, 100);
mpz_add (op1, op1, op2);
mpz_mul_ui (op2, op2, 2);
one_test (op1, op2, NULL, -1);
+#if 0
+ mpz_set_str (op1, "4da8e405e0d2f70d6d679d3de08a5100a81ec2cff40f97b313ae75e1183f1df2b244e194ebb02a4ece50d943640a301f0f6cc7f539117b783c3f3a3f91649f8a00d2e1444d52722810562bce02fccdbbc8fe3276646e306e723dd3b", 16);
+ mpz_set_str (op2, "76429e12e4fdd8929d89c21657097fbac09d1dc08cf7f1323a34e78ca34226e1a7a29b86fee0fa7fe2cc2a183d46d50df1fe7029590974ad7da77605f35f902cb8b9b8d22dd881eaae5919675d49a337145a029c3b33fc2b0", 16);
+ one_test (op1, op2, NULL, -1);
+#endif
+
for (i = 0; i < reps; i++)
{
/* Generate plain operands with unknown gcd. These types of operands
@@ -253,12 +152,12 @@ main (int argc, char **argv)
of that other ASSERTs are triggered before it. */
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 17 + 2;
+ size_range = mpz_get_ui (bs) % 13 + 2;
mpz_urandomb (bs, rands, size_range);
- mpz_rrandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE);
+ mpz_urandomb (op1, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE);
mpz_urandomb (bs, rands, size_range);
- mpz_rrandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE);
+ mpz_urandomb (op2, rands, mpz_get_ui (bs) + MIN_OPERAND_BITSIZE);
mpz_urandomb (bs, rands, 8);
bsi = mpz_get_ui (bs);
@@ -278,17 +177,58 @@ main (int argc, char **argv)
/* Generate a division chain backwards, allowing otherwise unlikely huge
quotients. */
+ mpz_set_ui (op1, 0);
mpz_urandomb (bs, rands, 32);
- chain_len = mpz_get_ui (bs) % LOG2C (GMP_NUMB_BITS * MAX_SCHOENHAGE_THRESHOLD);
- mpz_urandomb (bs, rands, 32);
- chain_len = mpz_get_ui (bs) % (1 << chain_len) / 32;
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 16 + 1);
+ mpz_rrandomb (op2, rands, mpz_get_ui (bs));
+ mpz_add_ui (op2, op2, 1);
+ mpz_set (ref, op2);
- make_chain_operands (ref, op1, op2, rands, 16, 12, chain_len);
+#if WHACK_SCHOENHAGE
+ chain_len = 1000000;
+#else
+ mpz_urandomb (bs, rands, 32);
+ chain_len = mpz_get_ui (bs) % (GMP_NUMB_BITS * MAX_SCHOENHAGE_THRESHOLD / 256);
+#endif
+ for (j = 0; j < chain_len; j++)
+ {
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
+ mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, op2, temp2);
+ mpz_add (op1, op1, temp1);
+
+ /* Don't generate overly huge operands. */
+ if (SIZ (op1) > 3 * MAX_SCHOENHAGE_THRESHOLD)
+ break;
+
+ mpz_urandomb (bs, rands, 32);
+ mpz_urandomb (bs, rands, mpz_get_ui (bs) % 12 + 1);
+ mpz_rrandomb (temp2, rands, mpz_get_ui (bs) + 1);
+ mpz_add_ui (temp2, temp2, 1);
+ mpz_mul (temp1, op1, temp2);
+ mpz_add (op2, op2, temp1);
+
+ /* Don't generate overly huge operands. */
+ if (SIZ (op2) > 3 * MAX_SCHOENHAGE_THRESHOLD)
+ break;
+ }
one_test (op1, op2, ref, i);
}
- mpz_clears (bs, op1, op2, ref, gcd1, gcd2, temp1, temp2, temp3, s, NULL);
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+ mpz_clear (ref);
+ mpz_clear (gcd1);
+ mpz_clear (gcd2);
+ mpz_clear (temp1);
+ mpz_clear (temp2);
+ mpz_clear (temp3);
+ mpz_clear (s);
+ mpz_clear (t);
tests_end ();
exit (0);
@@ -304,7 +244,7 @@ void
one_test (mpz_t op1, mpz_t op2, mpz_t ref, int i)
{
/*
- printf ("%d %d %d\n", SIZ (op1), SIZ (op2), ref != NULL ? SIZ (ref) : 0);
+ printf ("%ld %ld %ld\n", SIZ (op1), SIZ (op2), SIZ (ref));
fflush (stdout);
*/
@@ -431,7 +371,7 @@ gcdext_valid_p (const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s)
if (mpz_cmpabs_ui (s, 1) > 0)
{
mpz_mul_2exp (temp3, s, 1);
- if (mpz_cmpabs (temp3, temp2) >= 0)
+ if (mpz_cmpabs (temp3, temp2) > 0)
return 0;
}
@@ -447,7 +387,7 @@ gcdext_valid_p (const mpz_t a, const mpz_t b, const mpz_t g, const mpz_t s)
if (mpz_cmpabs_ui (temp2, 1) > 0)
{
mpz_mul_2exp (temp2, temp2, 1);
- if (mpz_cmpabs (temp2, temp1) >= 0)
+ if (mpz_cmpabs (temp2, temp1) > 0)
return 0;
}
return 1;
diff --git a/gmp/tests/mpz/t-gcd_ui.c b/gmp/tests/mpz/t-gcd_ui.c
index 16f51e11b6..ac6431ceb2 100644
--- a/gmp/tests/mpz/t-gcd_ui.c
+++ b/gmp/tests/mpz/t-gcd_ui.c
@@ -2,20 +2,20 @@
Copyright 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-get_d.c b/gmp/tests/mpz/t-get_d.c
index 4a4a930498..41c0ba8d20 100644
--- a/gmp/tests/mpz/t-get_d.c
+++ b/gmp/tests/mpz/t-get_d.c
@@ -1,21 +1,21 @@
/* Test mpz_get_d.
-Copyright 2002, 2012 Free Software Foundation, Inc.
+Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -31,8 +31,8 @@ check_onebit (void)
mpz_t z;
double got, want;
/* FIXME: It'd be better to base this on the float format. */
-#if defined (__vax) || defined (__vax__)
- int limit = 127 - 1; /* vax fp numbers have limited range */
+#ifdef __vax
+ int limit = 127; /* vax fp numbers have limited range */
#else
int limit = 512;
#endif
diff --git a/gmp/tests/mpz/t-get_d_2exp.c b/gmp/tests/mpz/t-get_d_2exp.c
index 2f5555daf5..3b659f82c9 100644
--- a/gmp/tests/mpz/t-get_d_2exp.c
+++ b/gmp/tests/mpz/t-get_d_2exp.c
@@ -1,21 +1,21 @@
/* Test mpz_get_d_2exp.
-Copyright 2002, 2003, 2012 Free Software Foundation, Inc.
+Copyright 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,32 +25,6 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
static void
-check_zero (void)
-{
- mpz_t z;
- double got, want;
- long got_exp, want_exp;
-
- mpz_init_set_ui (z, 0);
-
- want = 0.0;
- want_exp = 0;
- got = mpz_get_d_2exp (&got_exp, z);
- if (got != want || got_exp != want_exp)
- {
- printf ("mpz_get_d_2exp wrong on zero\n");
- mpz_trace (" z ", z);
- d_trace (" want ", want);
- d_trace (" got ", got);
- printf (" want exp %ld\n", want_exp);
- printf (" got exp %ld\n", got_exp);
- abort();
- }
-
- mpz_clear (z);
-}
-
-static void
check_onebit (void)
{
static const unsigned long data[] = {
@@ -213,7 +187,6 @@ main (void)
tests_start ();
mp_trace_base = -16;
- check_zero ();
check_onebit ();
check_round ();
check_rand ();
diff --git a/gmp/tests/mpz/t-get_si.c b/gmp/tests/mpz/t-get_si.c
index 083ada7f1e..0a9739bf0e 100644
--- a/gmp/tests/mpz/t-get_si.c
+++ b/gmp/tests/mpz/t-get_si.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-hamdist.c b/gmp/tests/mpz/t-hamdist.c
index f39c8ab8c2..8109365966 100644
--- a/gmp/tests/mpz/t-hamdist.c
+++ b/gmp/tests/mpz/t-hamdist.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-import.c b/gmp/tests/mpz/t-import.c
index 8d10fdc8aa..0c7b929e33 100644
--- a/gmp/tests/mpz/t-import.c
+++ b/gmp/tests/mpz/t-import.c
@@ -2,20 +2,20 @@
Copyright 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-inp_str.c b/gmp/tests/mpz/t-inp_str.c
index f50290bff6..7c0893752b 100644
--- a/gmp/tests/mpz/t-inp_str.c
+++ b/gmp/tests/mpz/t-inp_str.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -48,31 +48,21 @@ check_data (void)
{ "0", 10, "0", 1 },
{ "abc", 10, "0", 0 },
- { "0xf", 10, "0", 1 },
{ "ghi", 16, "0", 0 },
- { "100", 90, "0", 0 },
{ "ff", 16, "255", 2 },
{ "-ff", 16, "-255", 3 },
{ "FF", 16, "255", 2 },
{ "-FF", 16, "-255", 3 },
- { "z", 36, "35", 1 },
- { "Z", 36, "35", 1 },
- { "1B", 59, "70", 2 },
- { "a", 60, "36", 1 },
- { "A", 61, "10", 1 },
+ { "z", 36, "35", 1 },
+ { "Z", 36, "35", 1 },
{ "0x0", 0, "0", 3 },
- { "0X10", 0, "16", 4 },
- { "-0X0", 0, "0", 4 },
+ { "0x10", 0, "16", 4 },
+ { "-0x0", 0, "0", 4 },
{ "-0x10", 0, "-16", 5 },
- { "0b0", 0, "0", 3 },
- { "0B10", 0, "2", 4 },
- { "-0B0", 0, "0", 4 },
- { "-0b10", 0, "-2", 5 },
-
{ "00", 0, "0", 2 },
{ "010", 0, "8", 3 },
{ "-00", 0, "0", 3 },
@@ -80,7 +70,6 @@ check_data (void)
{ "0x", 0, "0", 2 },
{ "0", 0, "0", 1 },
- { " 030", 10, "30", 4 },
};
mpz_t got, want;
diff --git a/gmp/tests/mpz/t-invert.c b/gmp/tests/mpz/t-invert.c
deleted file mode 100644
index a033409a2f..0000000000
--- a/gmp/tests/mpz/t-invert.c
+++ /dev/null
@@ -1,121 +0,0 @@
-/* Test mpz_invert.
-
-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.
-
-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>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-int
-main (int argc, char **argv)
-{
- mpz_t a, m, ainv, t;
- int test, r;
- gmp_randstate_ptr rands;
- mpz_t bs;
- unsigned long bsi, size_range;
- int reps = 1000;
-
- tests_start ();
- TESTS_REPS (reps, argv, argc);
-
- rands = RANDS;
-
- mpz_init (bs);
- mpz_init (a);
- mpz_init (m);
- mpz_init (ainv);
- mpz_init (t);
-
- for (test = 0; test < reps; test++)
- {
- mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 16 + 2;
-
- mpz_urandomb (bs, rands, size_range);
- mpz_rrandomb (a, rands, mpz_get_ui (bs));
- do {
- mpz_urandomb (bs, rands, size_range);
- mpz_rrandomb (m, rands, mpz_get_ui (bs));
- } while (mpz_sgn (m) == 0);
-
- mpz_urandomb (bs, rands, 8);
- bsi = mpz_get_ui (bs);
-
- if ((bsi & 1) != 0)
- mpz_neg (a, a);
- if ((bsi & 2) != 0)
- mpz_neg (m, m);
-
- r = mpz_invert (ainv, a, m);
- if (r != 0)
- {
- MPZ_CHECK_FORMAT (ainv);
-
- 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 ();
- }
-
- mpz_mul (t, ainv, a);
- mpz_mod (t, t, m);
-
- 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");
- gmp_fprintf (stderr, "a = %Zx\n", a);
- gmp_fprintf (stderr, "m = %Zx\n", m);
- abort ();
- }
- }
- else /* Inverse deos not exist */
- {
- if (mpz_cmpabs_ui (m, 1) <= 0)
- continue; /* OK */
-
- mpz_gcd (t, a, m);
- if (mpz_cmp_ui (t, 1) == 0)
- {
- fprintf (stderr, "ERROR in test %d\n", test);
- gmp_fprintf (stderr, "Inverse exists, but was not found.\n");
- gmp_fprintf (stderr, "a = %Zx\n", a);
- gmp_fprintf (stderr, "m = %Zx\n", m);
- abort ();
- }
- }
- }
-
- mpz_clear (bs);
- mpz_clear (a);
- mpz_clear (m);
- mpz_clear (ainv);
- mpz_clear (t);
-
- tests_end ();
- exit (0);
-}
diff --git a/gmp/tests/mpz/t-io_raw.c b/gmp/tests/mpz/t-io_raw.c
index e06e7bb14b..4fd71e4be1 100644
--- a/gmp/tests/mpz/t-io_raw.c
+++ b/gmp/tests/mpz/t-io_raw.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -233,7 +233,7 @@ check_rand (void)
for (i = 0; i < 500; i++)
{
- mpz_erandomb (want, rands, 10*GMP_LIMB_BITS);
+ mpz_erandomb (want, rands, 10*BITS_PER_MP_LIMB);
mpz_negrandom (want, rands);
fp = fopen_wplusb_or_die (FILENAME);
diff --git a/gmp/tests/mpz/t-jac.c b/gmp/tests/mpz/t-jac.c
index b6a0c33106..1b3e092888 100644
--- a/gmp/tests/mpz/t-jac.c
+++ b/gmp/tests/mpz/t-jac.c
@@ -1,21 +1,21 @@
/* Exercise mpz_*_kronecker_*() and mpz_jacobi() functions.
-Copyright 1999-2004, 2013 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* With no arguments the various Kronecker/Jacobi symbol routines are
@@ -41,6 +41,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
+
#ifdef _LONG_LONG_LIMB
#define LL(l,ll) ll
#else
@@ -198,10 +199,6 @@ try_pari (mpz_srcptr a, mpz_srcptr b, int answer)
void
try_each (mpz_srcptr a, mpz_srcptr b, int answer)
{
-#if 0
- fprintf(stderr, "asize = %d, bsize = %d\n",
- mpz_sizeinbase (a, 2), mpz_sizeinbase (b, 2));
-#endif
if (option_pari)
{
try_pari (a, b, answer);
@@ -616,33 +613,6 @@ check_data (void)
/* special values inducing a==b==1 at the end of jac_or_kron() */
{ "0x10000000000000000000000000000000000000000000000001",
"0x10000000000000000000000000000000000000000000000003", 1 },
-
- /* Test for previous bugs in jacobi_2. */
- { "0x43900000000", "0x42400000439", -1 }, /* 32-bit limbs */
- { "0x4390000000000000000", "0x4240000000000000439", -1 }, /* 64-bit limbs */
-
- { "198158408161039063", "198158360916398807", -1 },
-
- /* Some tests involving large quotients in the continued fraction
- expansion. */
- { "37200210845139167613356125645445281805",
- "451716845976689892447895811408978421929", -1 },
- { "67674091930576781943923596701346271058970643542491743605048620644676477275152701774960868941561652032482173612421015",
- "4902678867794567120224500687210807069172039735", 0 },
- { "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683283672592", "2666617146103764067061017961903284334497474492754652499788571378062969111250584288683585223600172138551198546085281683290481773", 1 },
-
- /* Exercises the case asize == 1, btwos > 0 in mpz_jacobi. */
- { "804609", "421248363205206617296534688032638102314410556521742428832362659824", 1 } ,
- { "4190209", "2239744742177804210557442048984321017460028974602978995388383905961079286530650825925074203175536427000", 1 },
-
- /* Exercises the case asize == 1, btwos = 63 in mpz_jacobi
- (relevant when GMP_LIMB_BITS == 64). */
- { "17311973299000934401", "1675975991242824637446753124775689449936871337036614677577044717424700351103148799107651171694863695242089956242888229458836426332300124417011114380886016", 1 },
- { "3220569220116583677", "41859917623035396746", -1 },
-
- /* Other test cases that triggered bugs during development. */
- { "37200210845139167613356125645445281805", "340116213441272389607827434472642576514", -1 },
- { "74400421690278335226712251290890563610", "451716845976689892447895811408978421929", -1 },
};
int i;
@@ -682,7 +652,7 @@ check_squares_zi (void)
for (i = 0; i < 50; i++)
{
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 10 + i/8 + 2;
+ size_range = mpz_get_ui (bs) % 10 + 2;
mpz_urandomb (bs, rands, size_range);
an = mpz_get_ui (bs);
@@ -749,240 +719,6 @@ check_a_zero (void)
}
-/* Assumes that b = prod p_k^e_k */
-int
-ref_jacobi (mpz_srcptr a, mpz_srcptr b, unsigned nprime,
- mpz_t prime[], unsigned *exp)
-{
- unsigned i;
- int res;
-
- for (i = 0, res = 1; i < nprime; i++)
- if (exp[i])
- {
- int legendre = refmpz_legendre (a, prime[i]);
- if (!legendre)
- return 0;
- if (exp[i] & 1)
- res *= legendre;
- }
- return res;
-}
-
-void
-check_jacobi_factored (void)
-{
-#define PRIME_N 10
-#define PRIME_MAX_SIZE 50
-#define PRIME_MAX_EXP 4
-#define PRIME_A_COUNT 10
-#define PRIME_B_COUNT 5
-#define PRIME_MAX_B_SIZE 2000
-
- gmp_randstate_ptr rands = RANDS;
- mpz_t prime[PRIME_N];
- unsigned exp[PRIME_N];
- mpz_t a, b, t, bs;
- unsigned i;
-
- mpz_init (a);
- mpz_init (b);
- mpz_init (t);
- mpz_init (bs);
-
- /* Generate primes */
- for (i = 0; i < PRIME_N; i++)
- {
- mp_size_t size;
- mpz_init (prime[i]);
- mpz_urandomb (bs, rands, 32);
- size = mpz_get_ui (bs) % PRIME_MAX_SIZE + 2;
- mpz_rrandomb (prime[i], rands, size);
- if (mpz_cmp_ui (prime[i], 3) <= 0)
- mpz_set_ui (prime[i], 3);
- else
- mpz_nextprime (prime[i], prime[i]);
- }
-
- for (i = 0; i < PRIME_B_COUNT; i++)
- {
- unsigned j, k;
- mp_bitcnt_t bsize;
-
- mpz_set_ui (b, 1);
- bsize = 1;
-
- for (j = 0; j < PRIME_N && bsize < PRIME_MAX_B_SIZE; j++)
- {
- mpz_urandomb (bs, rands, 32);
- exp[j] = mpz_get_ui (bs) % PRIME_MAX_EXP;
- mpz_pow_ui (t, prime[j], exp[j]);
- mpz_mul (b, b, t);
- bsize = mpz_sizeinbase (b, 2);
- }
- for (k = 0; k < PRIME_A_COUNT; k++)
- {
- int answer;
- mpz_rrandomb (a, rands, bsize + 2);
- answer = ref_jacobi (a, b, j, prime, exp);
- try_all (a, b, answer);
- }
- }
- for (i = 0; i < PRIME_N; i++)
- mpz_clear (prime[i]);
-
- mpz_clear (a);
- mpz_clear (b);
- mpz_clear (t);
- mpz_clear (bs);
-
-#undef PRIME_N
-#undef PRIME_MAX_SIZE
-#undef PRIME_MAX_EXP
-#undef PRIME_A_COUNT
-#undef PRIME_B_COUNT
-#undef PRIME_MAX_B_SIZE
-}
-
-/* These tests compute (a|n), where the quotient sequence includes
- large quotients, and n has a known factorization. Such inputs are
- generated as follows. First, construct a large n, as a power of a
- prime p of moderate size.
-
- Next, compute a matrix from factors (q,1;1,0), with q chosen with
- uniformly distributed size. We must stop with matrix elements of
- roughly half the size of n. Denote elements of M as M = (m00, m01;
- m10, m11).
-
- We now look for solutions to
-
- n = m00 x + m01 y
- a = m10 x + m11 y
-
- with x,y > 0. Since n >= m00 * m01, there exists a positive
- solution to the first equation. Find those x, y, and substitute in
- the second equation to get a. Then the quotient sequence for (a|n)
- is precisely the quotients used when constructing M, followed by
- the quotient sequence for (x|y).
-
- Numbers should also be large enough that we exercise hgcd_jacobi,
- which means that they should be larger than
-
- max (GCD_DC_THRESHOLD, 3 * HGCD_THRESHOLD)
-
- With an n of roughly 40000 bits, this should hold on most machines.
-*/
-
-void
-check_large_quotients (void)
-{
-#define COUNT 50
-#define PBITS 200
-#define PPOWER 201
-#define MAX_QBITS 500
-
- gmp_randstate_ptr rands = RANDS;
-
- mpz_t p, n, q, g, s, t, x, y, bs;
- mpz_t M[2][2];
- mp_bitcnt_t nsize;
- unsigned i;
-
- mpz_init (p);
- mpz_init (n);
- mpz_init (q);
- mpz_init (g);
- mpz_init (s);
- mpz_init (t);
- mpz_init (x);
- mpz_init (y);
- mpz_init (bs);
- mpz_init (M[0][0]);
- mpz_init (M[0][1]);
- mpz_init (M[1][0]);
- mpz_init (M[1][1]);
-
- /* First generate a number with known factorization, as a random
- smallish prime raised to an odd power. Then (a|n) = (a|p). */
- mpz_rrandomb (p, rands, PBITS);
- mpz_nextprime (p, p);
- mpz_pow_ui (n, p, PPOWER);
-
- nsize = mpz_sizeinbase (n, 2);
-
- for (i = 0; i < COUNT; i++)
- {
- int answer;
- mp_bitcnt_t msize;
-
- mpz_set_ui (M[0][0], 1);
- mpz_set_ui (M[0][1], 0);
- mpz_set_ui (M[1][0], 0);
- mpz_set_ui (M[1][1], 1);
-
- for (msize = 1; 2*(msize + MAX_QBITS) + 1 < nsize ;)
- {
- unsigned i;
- mpz_rrandomb (bs, rands, 32);
- mpz_rrandomb (q, rands, 1 + mpz_get_ui (bs) % MAX_QBITS);
-
- /* Multiply by (q, 1; 1,0) from the right */
- for (i = 0; i < 2; i++)
- {
- mp_bitcnt_t size;
- mpz_swap (M[i][0], M[i][1]);
- mpz_addmul (M[i][0], M[i][1], q);
- size = mpz_sizeinbase (M[i][0], 2);
- if (size > msize)
- msize = size;
- }
- }
- mpz_gcdext (g, s, t, M[0][0], M[0][1]);
- ASSERT_ALWAYS (mpz_cmp_ui (g, 1) == 0);
-
- /* Solve n = M[0][0] * x + M[0][1] * y */
- if (mpz_sgn (s) > 0)
- {
- mpz_mul (x, n, s);
- mpz_fdiv_qr (q, x, x, M[0][1]);
- mpz_mul (y, q, M[0][0]);
- mpz_addmul (y, t, n);
- ASSERT_ALWAYS (mpz_sgn (y) > 0);
- }
- else
- {
- mpz_mul (y, n, t);
- mpz_fdiv_qr (q, y, y, M[0][0]);
- mpz_mul (x, q, M[0][1]);
- mpz_addmul (x, s, n);
- ASSERT_ALWAYS (mpz_sgn (x) > 0);
- }
- mpz_mul (x, x, M[1][0]);
- mpz_addmul (x, y, M[1][1]);
-
- /* Now (x|n) has the selected large quotients */
- answer = refmpz_legendre (x, p);
- try_zi_zi (x, n, answer);
- }
- mpz_clear (p);
- mpz_clear (n);
- mpz_clear (q);
- mpz_clear (g);
- mpz_clear (s);
- mpz_clear (t);
- mpz_clear (x);
- mpz_clear (y);
- mpz_clear (bs);
- mpz_clear (M[0][0]);
- mpz_clear (M[0][1]);
- mpz_clear (M[1][0]);
- mpz_clear (M[1][1]);
-#undef COUNT
-#undef PBITS
-#undef PPOWER
-#undef MAX_QBITS
-}
-
int
main (int argc, char *argv[])
{
@@ -1005,8 +741,7 @@ try(a,b,answer) =\n\
check_data ();
check_squares_zi ();
check_a_zero ();
- check_jacobi_factored ();
- check_large_quotients ();
+
tests_end ();
exit (0);
}
diff --git a/gmp/tests/mpz/t-lcm.c b/gmp/tests/mpz/t-lcm.c
index 3cc41483ef..195f0ee2f8 100644
--- a/gmp/tests/mpz/t-lcm.c
+++ b/gmp/tests/mpz/t-lcm.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
@@ -111,13 +111,6 @@ check_primes (void)
mpz_init (x);
mpz_init (y);
- /* Check zeros. */
- mpz_set_ui (want, 0);
- mpz_set_ui (x, 1);
- check_all (want, want, want);
- check_all (want, want, x);
- check_all (want, x, want);
-
/* New prime each time. */
mpz_set_ui (want, 1L);
for (i = 0; i < numberof (prime); i++)
diff --git a/gmp/tests/mpz/t-limbs.c b/gmp/tests/mpz/t-limbs.c
deleted file mode 100644
index 43bcfb03e8..0000000000
--- a/gmp/tests/mpz/t-limbs.c
+++ /dev/null
@@ -1,233 +0,0 @@
-/* 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;
-
-}
diff --git a/gmp/tests/mpz/t-lucnum_ui.c b/gmp/tests/mpz/t-lucnum_ui.c
index 7cb734195b..83f0d93b40 100644
--- a/gmp/tests/mpz/t-lucnum_ui.c
+++ b/gmp/tests/mpz/t-lucnum_ui.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -35,7 +35,7 @@ void
check_sequence (int argc, char *argv[])
{
unsigned long n;
- unsigned long limit = 100 * GMP_LIMB_BITS;
+ unsigned long limit = 100 * BITS_PER_MP_LIMB;
mpz_t want_ln, want_ln1, got_ln, got_ln1;
if (argc > 1 && argv[1][0] == 'x')
diff --git a/gmp/tests/mpz/t-mfac_uiui.c b/gmp/tests/mpz/t-mfac_uiui.c
deleted file mode 100644
index 7bf51a5dac..0000000000
--- a/gmp/tests/mpz/t-mfac_uiui.c
+++ /dev/null
@@ -1,136 +0,0 @@
-/* Exercise mpz_mfac_uiui.
-
-Copyright 2000-2002, 2012 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>
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-
-/* Usage: t-mfac_uiui [x|num]
-
- With no arguments testing goes up to the initial value of "limit" below.
- With a number argument tests are carried that far, or with a literal "x"
- tests are continued without limit (this being meant only for development
- purposes). */
-
-#define MULTIFAC_WHEEL (2*3*11)
-#define MULTIFAC_WHEEL2 (5*13)
-
-int
-main (int argc, char *argv[])
-{
- mpz_t ref[MULTIFAC_WHEEL], ref2[MULTIFAC_WHEEL2], res;
- unsigned long n, j, m, m2;
- unsigned long limit = 2222, step = 1;
-
- tests_start ();
-
- if (argc > 1 && argv[1][0] == 'x')
- limit = ULONG_MAX;
- else if (argc > 1)
- limit = atoi (argv[1]);
-
- /* for small limb testing */
- limit = MIN (limit, MP_LIMB_T_MAX);
-
- for (m = 0; m < MULTIFAC_WHEEL; m++)
- mpz_init_set_ui(ref [m],1);
- for (m2 = 0; m2 < MULTIFAC_WHEEL2; m2++)
- mpz_init_set_ui(ref2 [m2],1);
-
- mpz_init (res);
-
- m = 0;
- m2 = 0;
- for (n = 0; n <= limit;)
- {
- mpz_mfac_uiui (res, n, MULTIFAC_WHEEL);
- MPZ_CHECK_FORMAT (res);
- if (mpz_cmp (ref[m], res) != 0)
- {
- printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL);
- printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, ref[m]); printf("\n");
- abort ();
- }
- mpz_mfac_uiui (res, n, MULTIFAC_WHEEL2);
- MPZ_CHECK_FORMAT (res);
- if (mpz_cmp (ref2[m2], res) != 0)
- {
- printf ("mpz_mfac_uiui(%lu,%d) wrong\n", n, MULTIFAC_WHEEL2);
- printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, ref2[m2]); printf("\n");
- abort ();
- }
- if (n + step <= limit)
- for (j = 0; j < step; j++) {
- n++; m++; m2++;
- if (m >= MULTIFAC_WHEEL) m -= MULTIFAC_WHEEL;
- if (m2 >= MULTIFAC_WHEEL2) m2 -= MULTIFAC_WHEEL2;
- mpz_mul_ui (ref[m], ref[m], n); /* Compute a reference, with current library */
- mpz_mul_ui (ref2[m2], ref2[m2], n); /* Compute a reference, with current library */
- }
- else n += step;
- }
- mpz_fac_ui (ref[0], n);
- mpz_mfac_uiui (res, n, 1);
- MPZ_CHECK_FORMAT (res);
- if (mpz_cmp (ref[0], res) != 0)
- {
- printf ("mpz_mfac_uiui(%lu,1) wrong\n", n);
- printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n");
- abort ();
- }
-
- mpz_2fac_ui (ref[0], n);
- mpz_mfac_uiui (res, n, 2);
- MPZ_CHECK_FORMAT (res);
- if (mpz_cmp (ref[0], res) != 0)
- {
- printf ("mpz_mfac_uiui(%lu,1) wrong\n", n);
- printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n");
- abort ();
- }
-
- n++;
- mpz_2fac_ui (ref[0], n);
- mpz_mfac_uiui (res, n, 2);
- MPZ_CHECK_FORMAT (res);
- if (mpz_cmp (ref[0], res) != 0)
- {
- printf ("mpz_mfac_uiui(%lu,2) wrong\n", n);
- printf (" got "); mpz_out_str (stdout, 10, res); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, ref[0]); printf("\n");
- abort ();
- }
-
- for (m = 0; m < MULTIFAC_WHEEL; m++)
- mpz_clear (ref[m]);
- for (m2 = 0; m2 < MULTIFAC_WHEEL2; m2++)
- mpz_clear (ref2[m2]);
- mpz_clear (res);
-
- tests_end ();
-
- exit (0);
-}
diff --git a/gmp/tests/mpz/t-mul.c b/gmp/tests/mpz/t-mul.c
index 690b89f7fd..fd8d4ec2b7 100644
--- a/gmp/tests/mpz/t-mul.c
+++ b/gmp/tests/mpz/t-mul.c
@@ -1,22 +1,22 @@
/* Test mpz_cmp, mpz_mul.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2004 Free Software Foundation,
-Inc.
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002, 2003, 2004 Free
+Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -26,9 +26,10 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "longlong.h"
#include "tests.h"
-void debug_mp (mpz_t);
-static void refmpz_mul (mpz_t, const mpz_t, const mpz_t);
-void dump_abort (int, const char *, mpz_t, mpz_t, mpz_t, mpz_t);
+void debug_mp __GMP_PROTO ((mpz_t));
+static void ref_mpn_mul __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
+static void ref_mpz_mul __GMP_PROTO ((mpz_t, const mpz_t, const mpz_t));
+void dump_abort __GMP_PROTO ((int, char *, mpz_t, mpz_t, mpz_t, mpz_t));
#define FFT_MIN_BITSIZE 100000
@@ -38,13 +39,15 @@ void
one (int i, mpz_t multiplicand, mpz_t multiplier)
{
mpz_t product, ref_product;
+ mpz_t quotient;
mpz_init (product);
mpz_init (ref_product);
+ mpz_init (quotient);
/* Test plain multiplication comparing results against reference code. */
mpz_mul (product, multiplier, multiplicand);
- refmpz_mul (ref_product, multiplier, multiplicand);
+ ref_mpz_mul (ref_product, multiplier, multiplicand);
if (mpz_cmp (product, ref_product))
dump_abort (i, "incorrect plain product",
multiplier, multiplicand, product, ref_product);
@@ -59,6 +62,7 @@ one (int i, mpz_t multiplicand, mpz_t multiplier)
mpz_clear (product);
mpz_clear (ref_product);
+ mpz_clear (quotient);
}
int
@@ -137,7 +141,7 @@ main (int argc, char **argv)
}
static void
-refmpz_mul (mpz_t w, const mpz_t u, const mpz_t v)
+ref_mpz_mul (mpz_t w, const mpz_t u, const mpz_t v)
{
mp_size_t usize = u->_mp_size;
mp_size_t vsize = v->_mp_size;
@@ -165,9 +169,9 @@ refmpz_mul (mpz_t w, const mpz_t u, const mpz_t v)
wp = __GMP_ALLOCATE_FUNC_LIMBS (talloc);
if (usize > vsize)
- refmpn_mul (wp, up, usize, vp, vsize);
+ ref_mpn_mul (wp, up, usize, vp, vsize);
else
- refmpn_mul (wp, vp, vsize, up, usize);
+ ref_mpn_mul (wp, vp, vsize, up, usize);
wsize = usize + vsize;
wsize -= wp[wsize - 1] == 0;
MPZ_REALLOC (w, wsize);
@@ -177,8 +181,123 @@ refmpz_mul (mpz_t w, const mpz_t u, const mpz_t v)
__GMP_FREE_FUNC_LIMBS (wp, talloc);
}
+static void mul_basecase __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t));
+
+#define TOOM3_THRESHOLD (MAX (MUL_TOOM3_THRESHOLD, SQR_TOOM3_THRESHOLD))
+#define FFT_THRESHOLD (MAX (MUL_FFT_THRESHOLD, SQR_FFT_THRESHOLD))
+
+static void
+ref_mpn_mul (mp_ptr wp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
+{
+ mp_ptr tp;
+ mp_size_t tn;
+ mp_limb_t cy;
+
+ if (vn < TOOM3_THRESHOLD)
+ {
+ /* In the mpn_mul_basecase and mpn_kara_mul_n range, use our own
+ mul_basecase. */
+ if (vn != 0)
+ mul_basecase (wp, up, un, vp, vn);
+ else
+ MPN_ZERO (wp, un);
+ return;
+ }
+
+ if (vn < FFT_THRESHOLD)
+ {
+ /* In the mpn_toom3_mul_n range, use mpn_kara_mul_n. */
+ tn = 2 * vn + MPN_KARA_MUL_N_TSIZE (vn);
+ tp = __GMP_ALLOCATE_FUNC_LIMBS (tn);
+ mpn_kara_mul_n (tp, up, vp, vn, tp + 2 * vn);
+ }
+ else
+ {
+ /* Finally, for the largest operands, use mpn_toom3_mul_n. */
+ /* The "- 63 + 255" tweaks the allocation to allow for huge operands.
+ See the definition of this macro in gmp-impl.h to understand this. */
+ tn = 2 * vn + MPN_TOOM3_MUL_N_TSIZE (vn) - 63 + 255;
+ tp = __GMP_ALLOCATE_FUNC_LIMBS (tn);
+ mpn_toom3_mul_n (tp, up, vp, vn, tp + 2 * vn);
+ }
+
+ if (un != vn)
+ {
+ if (un - vn < vn)
+ ref_mpn_mul (wp + vn, vp, vn, up + vn, un - vn);
+ else
+ ref_mpn_mul (wp + vn, up + vn, un - vn, vp, vn);
+
+ MPN_COPY (wp, tp, vn);
+ cy = mpn_add_n (wp + vn, wp + vn, tp + vn, vn);
+ mpn_incr_u (wp + 2 * vn, cy);
+ }
+ else
+ {
+ MPN_COPY (wp, tp, 2 * vn);
+ }
+
+ __GMP_FREE_FUNC_LIMBS (tp, tn);
+}
+
+static void
+mul_basecase (mp_ptr wp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
+{
+ mp_size_t i, j;
+ mp_limb_t prod_low, prod_high;
+ mp_limb_t cy_dig;
+ mp_limb_t v_limb;
+
+ /* Multiply by the first limb in V separately, as the result can
+ be stored (not added) to PROD. We also avoid a loop for zeroing. */
+ v_limb = vp[0];
+ cy_dig = 0;
+ for (j = un; j > 0; j--)
+ {
+ mp_limb_t u_limb, w_limb;
+ u_limb = *up++;
+ umul_ppmm (prod_high, prod_low, u_limb, v_limb << GMP_NAIL_BITS);
+ add_ssaaaa (cy_dig, w_limb, prod_high, prod_low, 0, cy_dig << GMP_NAIL_BITS);
+ *wp++ = w_limb >> GMP_NAIL_BITS;
+ }
+
+ *wp++ = cy_dig;
+ wp -= un;
+ up -= un;
+
+ /* For each iteration in the outer loop, multiply one limb from
+ U with one limb from V, and add it to PROD. */
+ for (i = 1; i < vn; i++)
+ {
+ v_limb = vp[i];
+ cy_dig = 0;
+
+ for (j = un; j > 0; j--)
+ {
+ mp_limb_t u_limb, w_limb;
+ u_limb = *up++;
+ umul_ppmm (prod_high, prod_low, u_limb, v_limb << GMP_NAIL_BITS);
+ w_limb = *wp;
+ add_ssaaaa (prod_high, prod_low, prod_high, prod_low, 0, w_limb << GMP_NAIL_BITS);
+ prod_low >>= GMP_NAIL_BITS;
+ prod_low += cy_dig;
+#if GMP_NAIL_BITS == 0
+ cy_dig = prod_high + (prod_low < cy_dig);
+#else
+ cy_dig = prod_high;
+ cy_dig += prod_low >> GMP_NUMB_BITS;
+#endif
+ *wp++ = prod_low & GMP_NUMB_MASK;
+ }
+
+ *wp++ = cy_dig;
+ wp -= un;
+ up -= un;
+ }
+}
+
void
-dump_abort (int i, const char *s,
+dump_abort (int i, char *s,
mpz_t op1, mpz_t op2, mpz_t product, mpz_t ref_product)
{
mp_size_t b, e;
diff --git a/gmp/tests/mpz/t-mul_i.c b/gmp/tests/mpz/t-mul_i.c
index cbbe54d40d..bf95a153ac 100644
--- a/gmp/tests/mpz/t-mul_i.c
+++ b/gmp/tests/mpz/t-mul_i.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-nextprime.c b/gmp/tests/mpz/t-nextprime.c
index 6e291c334d..1734f61496 100644
--- a/gmp/tests/mpz/t-nextprime.c
+++ b/gmp/tests/mpz/t-nextprime.c
@@ -2,20 +2,20 @@
Copyright 2009 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
@@ -34,7 +34,7 @@ refmpz_nextprime (mpz_ptr p, mpz_srcptr t)
}
void
-run (const char *start, int reps, const char *end, short diffs[])
+run (char *start, int reps, char *end, short diffs[])
{
mpz_t x, y;
int i;
diff --git a/gmp/tests/mpz/t-oddeven.c b/gmp/tests/mpz/t-oddeven.c
index 107f2436ab..09e2c93871 100644
--- a/gmp/tests/mpz/t-oddeven.c
+++ b/gmp/tests/mpz/t-oddeven.c
@@ -2,20 +2,20 @@
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-perfpow.c b/gmp/tests/mpz/t-perfpow.c
index 72fe5c519d..aebe1b57b1 100644
--- a/gmp/tests/mpz/t-perfpow.c
+++ b/gmp/tests/mpz/t-perfpow.c
@@ -1,23 +1,21 @@
/* Test mpz_perfect_power_p.
- Contributed to the GNU project by Torbjorn Granlund and Martin Boij.
+Copyright 2008 Free Software Foundation, Inc.
-Copyright 2008-2010 Free Software Foundation, Inc.
+This file is part of the GNU MP Library.
-This file is part of the GNU MP Library test suite.
+The GNU MP Library is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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 is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 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/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -28,7 +26,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
struct
{
- const char *num_as_str;
+ char *num_as_str;
char want;
} tests[] =
{
@@ -102,125 +100,44 @@ check_tests ()
mpz_clear (x);
}
-#define NRP 15
-
void
-check_random (int reps)
+check_random (int n_tests)
{
- mpz_t n, np, temp, primes[NRP];
- int i, j, k, unique, destroy, res;
- unsigned long int nrprimes, primebits;
- mp_limb_t g, exp[NRP], e;
+ int test;
+ mpz_t bs, op1, op2, x;
gmp_randstate_ptr rands;
+ unsigned long ex;
rands = RANDS;
- mpz_init (n);
- mpz_init (np);
- mpz_init (temp);
-
- for (i = 0; i < NRP; i++)
- mpz_init (primes[i]);
+ mpz_init (bs);
+ mpz_init (op1);
+ mpz_init (op2);
+ mpz_init (x);
- for (i = 0; i < reps; i++)
+ for (test = 0; test < n_tests; test++)
{
- mpz_urandomb (np, rands, 32);
- nrprimes = mpz_get_ui (np) % NRP + 1; /* 1-NRP unique primes */
-
- mpz_urandomb (np, rands, 32);
- g = mpz_get_ui (np) % 32 + 2; /* gcd 2-33 */
-
- for (j = 0; j < nrprimes;)
- {
- mpz_urandomb (np, rands, 32);
- primebits = mpz_get_ui (np) % 100 + 3; /* 3-102 bit primes */
- mpz_urandomb (primes[j], rands, primebits);
- mpz_nextprime (primes[j], primes[j]);
- unique = 1;
- for (k = 0; k < j; k++)
- {
- if (mpz_cmp (primes[j], primes[k]) == 0)
- {
- unique = 0;
- break;
- }
- }
- if (unique)
- {
- mpz_urandomb (np, rands, 32);
- e = 371 / (10 * primebits) + mpz_get_ui (np) % 11 + 1; /* Magic constants */
- exp[j++] = g * e;
- }
- }
-
- if (nrprimes > 1)
- {
- /* Destroy d exponents, d in [1, nrprimes - 1] */
- if (nrprimes == 2)
- {
- destroy = 1;
- }
- else
- {
- mpz_urandomb (np, rands, 32);
- destroy = mpz_get_ui (np) % (nrprimes - 2) + 1;
- }
-
- g = exp[destroy];
- for (k = destroy + 1; k < nrprimes; k++)
- g = mpn_gcd_1 (&g, 1, exp[k]);
-
- for (j = 0; j < destroy; j++)
- {
- mpz_urandomb (np, rands, 32);
- e = mpz_get_ui (np) % 50 + 1;
- while (mpn_gcd_1 (&g, 1, e) > 1)
- e++;
-
- exp[j] = e;
- }
- }
-
- /* Compute n */
- mpz_pow_ui (n, primes[0], exp[0]);
- for (j = 1; j < nrprimes; j++)
- {
- mpz_pow_ui (temp, primes[j], exp[j]);
- mpz_mul (n, n, temp);
- }
+ mpz_urandomb (bs, rands, 32);
+ mpz_rrandomb (op1, rands, mpz_get_ui (bs) % 32);
+ if (test & 1)
+ mpz_neg (op1, op1);
+ mpz_rrandomb (op2, rands, (mpz_get_ui (bs) >> 5) % 8);
- res = mpz_perfect_power_p (n);
+ ex = mpz_get_ui (op2) + 2;
+ mpz_pow_ui (x, op1, ex);
- if (nrprimes == 1)
+ if (! mpz_perfect_power_p (x))
{
- if (res == 0 && exp[0] > 1)
- {
- printf("n is a perfect power, perfpow_p disagrees\n");
- gmp_printf("n = %Zu\nprimes[0] = %Zu\nexp[0] = %lu\n", n, primes[0], exp[0]);
- abort ();
- }
- else if (res == 1 && exp[0] == 1)
- {
- gmp_printf("n = %Zu\n", n);
- printf("n is now a prime number, but perfpow_p still believes n is a perfect power\n");
- abort ();
- }
- }
- else
- {
- if (res == 1)
- {
- gmp_printf("n = %Zu\nn was destroyed, but perfpow_p still believes n is a perfect power\n", n);
- abort ();
- }
+ gmp_fprintf (stderr, "mpz_perfect_power_p rejects perfect power %Zd^%ld\n", op1, ex);
+ gmp_fprintf (stderr, "fault operand: %Zx\n", x);
+ abort ();
}
}
- mpz_clear (n);
- mpz_clear (np);
- mpz_clear (temp);
- for (i = 0; i < NRP; i++)
- mpz_clear (primes[i]);
+ mpz_clear (bs);
+ mpz_clear (op1);
+ mpz_clear (op2);
+ mpz_clear (x);
}
int
@@ -233,7 +150,7 @@ main (int argc, char **argv)
check_tests ();
- n_tests = 500;
+ n_tests = 100000;
if (argc == 2)
n_tests = atoi (argv[1]);
check_random (n_tests);
diff --git a/gmp/tests/mpz/t-perfsqr.c b/gmp/tests/mpz/t-perfsqr.c
index 2a54e59e65..f5fa15bfaa 100644
--- a/gmp/tests/mpz/t-perfsqr.c
+++ b/gmp/tests/mpz/t-perfsqr.c
@@ -1,21 +1,21 @@
/* Test mpz_perfect_square_p.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-popcount.c b/gmp/tests/mpz/t-popcount.c
index c27c4efda9..da7487d606 100644
--- a/gmp/tests/mpz/t-popcount.c
+++ b/gmp/tests/mpz/t-popcount.c
@@ -2,20 +2,20 @@
Copyright 2001, 2005 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -32,7 +32,7 @@ check_onebit (void)
unsigned long i, got;
mpz_init (n);
- for (i = 0; i < 5 * GMP_LIMB_BITS; i++)
+ for (i = 0; i < 5 * BITS_PER_MP_LIMB; i++)
{
mpz_setbit (n, i);
got = mpz_popcount (n);
@@ -84,7 +84,7 @@ check_data (void)
printf (" 0x"); mpz_out_str (stdout, 16, n); printf ("\n");
printf (" got %lu\n", got);
printf (" want %lu\n", data[i].want);
- abort ();
+ abort();
}
}
mpz_clear (n);
@@ -147,6 +147,7 @@ check_random (void)
printf (" 0x"); mpz_out_str (stdout, 16, arg); printf ("\n");
printf (" got %lu\n", got);
printf (" want %lu\n", ref);
+ abort();
abort ();
}
}
diff --git a/gmp/tests/mpz/t-pow.c b/gmp/tests/mpz/t-pow.c
index 312ef98884..d6373ea9af 100644
--- a/gmp/tests/mpz/t-pow.c
+++ b/gmp/tests/mpz/t-pow.c
@@ -1,21 +1,21 @@
/* Test mpz_pow_ui and mpz_ui_pow_ui.
-Copyright 1997, 1999-2001 Free Software Foundation, Inc.
+Copyright 1997, 1999, 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-powm.c b/gmp/tests/mpz/t-powm.c
index 240e1c89b9..662080acfe 100644
--- a/gmp/tests/mpz/t-powm.c
+++ b/gmp/tests/mpz/t-powm.c
@@ -1,47 +1,31 @@
/* Test mpz_powm, mpz_mul, mpz_mod, mpz_mod_ui, mpz_div_ui.
-Copyright 1991, 1993, 1994, 1996, 1999-2001, 2009, 2012 Free Software
+Copyright 1991, 1993, 1994, 1996, 1999, 2000, 2001, 2009 Free Software
Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
-#include <string.h>
#include "gmp.h"
#include "gmp-impl.h"
#include "tests.h"
-void debug_mp (mpz_t, int);
-
-#define SIZEM 13
-
-/* Check that all sizes up to just above MUL_TOOM22_THRESHOLD have been tested
- a few times. FIXME: If SIZEM is set too low, this will never happen. */
-int
-allsizes_seen (unsigned int *allsizes)
-{
- mp_size_t i;
-
- for (i = 1; i < MUL_TOOM22_THRESHOLD + 4; i++)
- if (allsizes[i] < 4)
- return 0;
- return 1;
-}
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
@@ -54,15 +38,15 @@ main (int argc, char **argv)
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long bsi, size_range;
- unsigned int allsizes[1 << (SIZEM + 2 - 1)];
tests_start ();
- TESTS_REPS (reps, argv, argc);
-
rands = RANDS;
mpz_init (bs);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
mpz_init (base);
mpz_init (exp);
mpz_init (mod);
@@ -72,12 +56,10 @@ main (int argc, char **argv)
mpz_init (exp2);
mpz_init (base2);
- memset (allsizes, 0, (1 << (SIZEM + 2 - 1)) * sizeof (int));
-
- for (i = 0; i < reps || ! allsizes_seen (allsizes); i++)
+ for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % SIZEM + 2;
+ size_range = mpz_get_ui (bs) % 13 + 2;
do /* Loop until mathematically well-defined. */
{
@@ -99,8 +81,6 @@ main (int argc, char **argv)
}
while (mpz_cmp_ui (mod, 0) == 0);
- allsizes[SIZ(mod)] += 1;
-
mpz_urandomb (bs, rands, 2);
bsi = mpz_get_ui (bs);
if ((bsi & 1) != 0)
@@ -108,6 +88,9 @@ main (int argc, char **argv)
/* printf ("%ld %ld %ld\n", SIZ (base), SIZ (exp), SIZ (mod)); */
+ mpz_powm (r1, base, exp, mod);
+ MPZ_CHECK_FORMAT (r1);
+
mpz_set_ui (r2, 1);
mpz_mod (base2, base, mod);
mpz_set (exp2, exp);
@@ -127,9 +110,6 @@ main (int argc, char **argv)
mpz_tdiv_q_2exp (exp2, exp2, 1);
}
- mpz_powm (r1, base, exp, mod);
- MPZ_CHECK_FORMAT (r1);
-
if (mpz_cmp (r1, r2) != 0)
{
fprintf (stderr, "\nIncorrect results in test %d for operands:\n", i);
@@ -142,25 +122,6 @@ main (int argc, char **argv)
debug_mp (r2, -16);
abort ();
}
-
- if (mpz_tdiv_ui (mod, 2) == 0)
- continue;
-
- mpz_powm_sec (r1, base, exp, mod);
- MPZ_CHECK_FORMAT (r1);
-
- if (mpz_cmp (r1, r2) != 0)
- {
- fprintf (stderr, "\nIncorrect results in test %d for operands:\n", i);
- debug_mp (base, -16);
- debug_mp (exp, -16);
- debug_mp (mod, -16);
- fprintf (stderr, "mpz_powm_sec result:\n");
- debug_mp (r1, -16);
- fprintf (stderr, "reference result:\n");
- debug_mp (r2, -16);
- abort ();
- }
}
mpz_clear (bs);
diff --git a/gmp/tests/mpz/t-powm_ui.c b/gmp/tests/mpz/t-powm_ui.c
index a95e473c32..224e60481e 100644
--- a/gmp/tests/mpz/t-powm_ui.c
+++ b/gmp/tests/mpz/t-powm_ui.c
@@ -1,22 +1,22 @@
/* Test mpz_powm_ui, mpz_mul, mpz_mod.
-Copyright 1991, 1993, 1994, 1996, 1997, 2000-2002, 2013 Free Software
+Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001, 2002 Free Software
Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,6 +25,9 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
+void dump_abort __GMP_PROTO ((mpz_t, mpz_t));
+void debug_mp __GMP_PROTO ((mpz_t, int));
+
int
main (int argc, char **argv)
{
@@ -33,7 +36,7 @@ main (int argc, char **argv)
mp_size_t base_size, exp_size, mod_size;
unsigned long int exp2;
int i;
- int reps = 100;
+ int reps = 1000;
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long bsi, size_range;
@@ -41,14 +44,22 @@ main (int argc, char **argv)
tests_start ();
rands = RANDS;
- TESTS_REPS (reps, argv, argc);
+ mpz_init (bs);
+
+ if (argc == 2)
+ reps = atoi (argv[1]);
- mpz_inits (bs, base, exp, mod, r1, r2, base2, NULL);
+ mpz_init (base);
+ mpz_init (exp);
+ mpz_init (mod);
+ mpz_init (r1);
+ mpz_init (r2);
+ mpz_init (base2);
for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 18 + 2;
+ size_range = mpz_get_ui (bs) % 13 + 2;
do /* Loop until mathematically well-defined. */
{
@@ -80,13 +91,16 @@ main (int argc, char **argv)
#if 0
putc ('\n', stderr);
- gmp_fprintf (stderr, "B = 0x%Zx\n", base);
- gmp_fprintf (stderr, "M = 0x%Zx\n", mod);
+ debug_mp (base, -16);
+ debug_mp (mod, -16);
#endif
- exp2 = mpz_getlimbn (exp, (mp_size_t) 0);
+ mpz_powm_ui (r1, base, exp2, mod);
+ MPZ_CHECK_FORMAT (r1);
+
mpz_set_ui (r2, 1);
mpz_set (base2, base);
+
mpz_mod (r2, r2, mod); /* needed when exp==0 and mod==1 */
while (exp2 != 0)
{
@@ -100,29 +114,48 @@ 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
- gmp_fprintf (stderr, "R = 0x%Zx\n", r1);
- gmp_fprintf (stderr, "REF = 0x%Zx\n", r2);
+ debug_mp (r1, -16);
+ debug_mp (r2, -16);
#endif
if (mpz_cmp (r1, r2) != 0)
{
fprintf (stderr, "\ntest %d: Incorrect results for operands:\n", i);
- 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);
+ 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);
abort ();
}
}
- mpz_clears (bs, base, exp, mod, r1, r2, base2, NULL);
+ mpz_clear (bs);
+ mpz_clear (base);
+ mpz_clear (exp);
+ mpz_clear (mod);
+ mpz_clear (r1);
+ mpz_clear (r2);
+ mpz_clear (base2);
tests_end ();
exit (0);
}
+
+void
+dump_abort (mpz_t dividend, mpz_t divisor)
+{
+ fprintf (stderr, "ERROR\n");
+ fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
+ fprintf (stderr, "divisor = "); debug_mp (divisor, -16);
+ abort();
+}
+
+void
+debug_mp (mpz_t x, int base)
+{
+ mpz_out_str (stderr, base, x); fputc ('\n', stderr);
+}
diff --git a/gmp/tests/mpz/t-pprime_p.c b/gmp/tests/mpz/t-pprime_p.c
index d437299e53..0907379681 100644
--- a/gmp/tests/mpz/t-pprime_p.c
+++ b/gmp/tests/mpz/t-pprime_p.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -101,89 +101,12 @@ 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 (int argc, char **argv)
+main (void)
{
- int count = 1000;
-
- TESTS_REPS (count, argv, argc);
-
tests_start ();
check_small ();
- check_composites (count);
- check_primes ();
tests_end ();
exit (0);
diff --git a/gmp/tests/mpz/t-primorial_ui.c b/gmp/tests/mpz/t-primorial_ui.c
deleted file mode 100644
index 253040ca1e..0000000000
--- a/gmp/tests/mpz/t-primorial_ui.c
+++ /dev/null
@@ -1,97 +0,0 @@
-/* Exercise mpz_primorial_ui.
-
-Copyright 2000-2002, 2012 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>
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-
-/* Usage: t-primorial_ui [x|num]
-
- With no arguments testing goes up to the initial value of "limit" below.
- With a number argument tests are carried that far, or with a literal "x"
- tests are continued without limit (this being meant only for development
- purposes). */
-
-static int isprime (unsigned long int t);
-
-int
-main (int argc, char *argv[])
-{
- unsigned long n;
- unsigned long limit = 2222;
- mpz_t f, r;
-
- tests_start ();
-
- if (argc > 1 && argv[1][0] == 'x')
- limit = ULONG_MAX;
- else if (argc > 1)
- limit = atoi (argv[1]);
-
- /* for small limb testing */
- limit = MIN (limit, MP_LIMB_T_MAX);
-
- mpz_init_set_ui (f, 1); /* 0# = 1 */
- mpz_init (r);
-
- for (n = 0; n < limit; n++)
- {
- mpz_primorial_ui (r, n);
- MPZ_CHECK_FORMAT (r);
-
- if (mpz_cmp (f, r) != 0)
- {
- printf ("mpz_primorial_ui(%lu) wrong\n", n);
- printf (" got "); mpz_out_str (stdout, 10, r); printf("\n");
- printf (" want "); mpz_out_str (stdout, 10, f); printf("\n");
- abort ();
- }
-
- if (isprime (n+1))
- mpz_mul_ui (f, f, n+1); /* p# = (p-1)# * (p) */
- }
-
- mpz_clear (f);
- mpz_clear (r);
-
- tests_end ();
-
- exit (0);
-}
-
-static int
-isprime (unsigned long int t)
-{
- unsigned long int q, r, d;
-
- if (t < 3 || (t & 1) == 0)
- return t == 2;
-
- for (d = 3, r = 1; r != 0; d += 2)
- {
- q = t / d;
- r = t - q * d;
- if (q < d)
- return 1;
- }
- return 0;
-}
diff --git a/gmp/tests/mpz/t-remove.c b/gmp/tests/mpz/t-remove.c
deleted file mode 100644
index 4de74675fd..0000000000
--- a/gmp/tests/mpz/t-remove.c
+++ /dev/null
@@ -1,147 +0,0 @@
-/* Test mpz_remove.
-
-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.
-
-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>
-
-#include "gmp.h"
-#include "gmp-impl.h"
-#include "tests.h"
-
-void debug_mp (mpz_t);
-unsigned long int mpz_refremove (mpz_t, const mpz_t, const mpz_t);
-
-int
-main (int argc, char **argv)
-{
- unsigned long int exp;
- mpz_t t, dest, refdest, dividend, divisor;
- mp_size_t dividend_size, divisor_size;
- int i;
- int reps = 1000;
- unsigned long int pwr, refpwr;
- gmp_randstate_ptr rands;
- mpz_t bs;
- unsigned long size_range;
-
- tests_start ();
- rands = RANDS;
-
- if (argc == 2)
- reps = atoi (argv[1]);
-
- mpz_inits (bs, t, dest, refdest, dividend, divisor, NULL);
-
- for (i = 0; i < reps; i++)
- {
- mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 18 + 1; /* 1..524288 bit operands */
-
- do
- {
- mpz_urandomb (bs, rands, size_range);
- divisor_size = mpz_get_ui (bs);
- mpz_rrandomb (divisor, rands, divisor_size);
- }
- while (mpz_sgn (divisor) == 0);
-
- mpz_urandomb (bs, rands, size_range);
- dividend_size = mpz_get_ui (bs) + divisor_size;
- mpz_rrandomb (dividend, rands, dividend_size);
-
- mpz_urandomb (bs, rands, 32);
- exp = mpz_get_ui (bs) % (5 + 10000 / mpz_sizeinbase (divisor, 2));
- if (mpz_get_ui (bs) & 2)
- mpz_neg (divisor, divisor);
- mpz_pow_ui (t, divisor, exp);
- mpz_mul (dividend, dividend, t);
-
- refpwr = mpz_refremove (refdest, dividend, divisor);
- pwr = mpz_remove (dest, dividend, divisor);
-
- if (refpwr != pwr || mpz_cmp (refdest, dest) != 0)
- {
- fprintf (stderr, "ERROR after %d tests\n", i);
- fprintf (stderr, "refpower = %lu\n", refpwr);
- fprintf (stderr, " power = %lu\n", pwr);
- fprintf (stderr, " op1 = "); debug_mp (dividend);
- fprintf (stderr, " op2 = "); debug_mp (divisor);
- fprintf (stderr, "refdest = "); debug_mp (refdest);
- fprintf (stderr, " dest = "); debug_mp (dest);
- abort ();
- }
- }
-
- mpz_clears (bs, t, dest, refdest, dividend, divisor, NULL);
-
- tests_end ();
- exit (0);
-}
-
-unsigned long int
-mpz_refremove (mpz_t dest, const mpz_t src, const mpz_t f)
-{
- unsigned long int pwr;
-
- pwr = 0;
-
- mpz_set (dest, src);
- if (mpz_cmpabs_ui (f, 1) > 0)
- {
- mpz_t rem, x;
-
- mpz_init (x);
- mpz_init (rem);
-
- for (;; pwr++)
- {
- mpz_tdiv_qr (x, rem, dest, f);
- if (mpz_cmp_ui (rem, 0) != 0)
- break;
- mpz_swap (dest, x);
- }
-
- mpz_clear (x);
- mpz_clear (rem);
- }
-
- return pwr;
-}
-
-void
-debug_mp (mpz_t x)
-{
- size_t siz = mpz_sizeinbase (x, 16);
-
- if (siz > 65)
- {
- mpz_t q;
- mpz_init (q);
- mpz_tdiv_q_2exp (q, x, 4 * (mpz_sizeinbase (x, 16) - 25));
- gmp_fprintf (stderr, "%ZX...", q);
- mpz_tdiv_r_2exp (q, x, 4 * 25);
- gmp_fprintf (stderr, "%025ZX [%d]\n", q, (int) siz);
- mpz_clear (q);
- }
- else
- {
- gmp_fprintf (stderr, "%ZX\n", x);
- }
-}
diff --git a/gmp/tests/mpz/t-root.c b/gmp/tests/mpz/t-root.c
index 17efe4cca8..22fd31c7f8 100644
--- a/gmp/tests/mpz/t-root.c
+++ b/gmp/tests/mpz/t-root.c
@@ -2,20 +2,20 @@
Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2009 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -24,7 +24,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void debug_mp (mpz_t, int);
+void debug_mp __GMP_PROTO ((mpz_t, int));
void
check_one (mpz_t root1, mpz_t x2, unsigned long nth, int i)
@@ -49,7 +49,7 @@ check_one (mpz_t root1, mpz_t x2, unsigned long nth, int i)
mpz_add (temp2, temp, rem2);
/* Is power of result > argument? */
- if (mpz_cmp (root1, root2) != 0 || mpz_cmp (x2, temp2) != 0 || mpz_cmpabs (temp, x2) > 0)
+ if (mpz_cmp (root1, root2) != 0 || mpz_cmp (x2, temp2) != 0 || mpz_cmp (temp, x2) > 0)
{
fprintf (stderr, "ERROR after test %d\n", i);
debug_mp (x2, 10);
@@ -68,7 +68,7 @@ check_one (mpz_t root1, mpz_t x2, unsigned long nth, int i)
abort ();
}
- if (nth <= 10000 && mpz_sgn(x2) > 0) /* skip too expensive test */
+ if (nth <= 10000) /* skip too expensive test */
{
mpz_add_ui (temp2, root1, 1L);
mpz_pow_ui (temp2, temp2, nth);
@@ -98,19 +98,20 @@ main (int argc, char **argv)
mpz_t root1;
mp_size_t x2_size;
int i;
- int reps = 500;
+ int reps = 5000;
unsigned long nth;
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long bsi, size_range;
tests_start ();
- TESTS_REPS (reps, argv, argc);
-
rands = RANDS;
mpz_init (bs);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
mpz_init (x2);
mpz_init (root1);
@@ -122,7 +123,7 @@ main (int argc, char **argv)
for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 17 + 2;
+ size_range = mpz_get_ui (bs) % 12 + 2;
mpz_urandomb (bs, rands, size_range);
x2_size = mpz_get_ui (bs) + 10;
@@ -150,13 +151,6 @@ main (int argc, char **argv)
}
check_one (root1, x2, nth, i);
-
- if (((nth & 1) != 0) && ((bsi & 2) != 0))
- {
- mpz_neg (x2, x2);
- mpz_neg (root1, root1);
- check_one (root1, x2, nth, i);
- }
}
mpz_clear (bs);
diff --git a/gmp/tests/mpz/t-scan.c b/gmp/tests/mpz/t-scan.c
index 95b896b1be..6598ed9639 100644
--- a/gmp/tests/mpz/t-scan.c
+++ b/gmp/tests/mpz/t-scan.c
@@ -1,21 +1,21 @@
/* Tests of mpz_scan0 and mpz_scan1.
-Copyright 2000-2003 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -79,7 +79,7 @@ check_ref (void)
for (isize = 0; isize <= size; isize++)
{
- for (oindex = 0; oindex < numberof (offset); oindex++)
+ for (oindex = 0; oindex <= numberof (offset); oindex++)
{
o = offset[oindex];
if ((int) isize*GMP_NUMB_BITS < -o)
diff --git a/gmp/tests/mpz/t-set_d.c b/gmp/tests/mpz/t-set_d.c
index d587e65442..c4d646dad1 100644
--- a/gmp/tests/mpz/t-set_d.c
+++ b/gmp/tests/mpz/t-set_d.c
@@ -1,21 +1,21 @@
/* Test mpz_set_d and mpz_init_set_d.
-Copyright 2000-2003, 2006 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 2006 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-set_f.c b/gmp/tests/mpz/t-set_f.c
index 38b5a2c438..764006fd32 100644
--- a/gmp/tests/mpz/t-set_f.c
+++ b/gmp/tests/mpz/t-set_f.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -28,7 +28,7 @@ void
check_one (mpz_srcptr z)
{
static const int shift[] = {
- 0, 1, GMP_LIMB_BITS, 2*GMP_LIMB_BITS, 5*GMP_LIMB_BITS
+ 0, 1, BITS_PER_MP_LIMB, 2*BITS_PER_MP_LIMB, 5*BITS_PER_MP_LIMB
};
int sh, shneg, neg;
@@ -101,10 +101,10 @@ check_various (void)
mpz_set_si (z, 123L);
check_one (z);
- mpz_rrandomb (z, RANDS, 2*GMP_LIMB_BITS);
+ mpz_rrandomb (z, RANDS, 2*BITS_PER_MP_LIMB);
check_one (z);
- mpz_rrandomb (z, RANDS, 5*GMP_LIMB_BITS);
+ mpz_rrandomb (z, RANDS, 5*BITS_PER_MP_LIMB);
check_one (z);
mpz_clear (z);
diff --git a/gmp/tests/mpz/t-set_si.c b/gmp/tests/mpz/t-set_si.c
index b1e55ede33..7af40e1b72 100644
--- a/gmp/tests/mpz/t-set_si.c
+++ b/gmp/tests/mpz/t-set_si.c
@@ -1,21 +1,21 @@
/* Test mpz_set_si and mpz_init_set_si.
-Copyright 2000-2002 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-set_str.c b/gmp/tests/mpz/t-set_str.c
index c6a59f2fed..cb589ca9da 100644
--- a/gmp/tests/mpz/t-set_str.c
+++ b/gmp/tests/mpz/t-set_str.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,7 +25,7 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
void
-check_one (mpz_srcptr want, int fail, int base, const char *str)
+check_one (mpz_srcptr want, int base, const char *str)
{
mpz_t got;
@@ -34,7 +34,7 @@ check_one (mpz_srcptr want, int fail, int base, const char *str)
mpz_init (got);
- if (mpz_set_str (got, str, base) != fail)
+ if (mpz_set_str (got, str, base) != 0)
{
printf ("mpz_set_str unexpectedly failed\n");
printf (" base %d\n", base);
@@ -43,7 +43,7 @@ check_one (mpz_srcptr want, int fail, int base, const char *str)
}
MPZ_CHECK_FORMAT (got);
- if (fail == 0 && mpz_cmp (got, want) != 0)
+ if (mpz_cmp (got, want) != 0)
{
printf ("mpz_set_str wrong\n");
printf (" base %d\n", base);
@@ -64,35 +64,21 @@ check_samples (void)
mpz_init (z);
mpz_set_ui (z, 0L);
- check_one (z, 0, 0, "0 ");
- check_one (z, 0, 0, " 0 0 0 ");
- check_one (z, 0, 0, " -0B 0 ");
- check_one (z, 0, 0, " 0X 0 ");
- check_one (z, 0, 10, "0 ");
- check_one (z, 0, 10, "-0 ");
- check_one (z, 0, 10, " 0 000 000 ");
+ check_one (z, 0, "0 ");
+ check_one (z, 0, "0 ");
+ check_one (z, 10, "0 ");
+ check_one (z, 10, "0 ");
+ check_one (z, 10, "0000000 ");
mpz_set_ui (z, 123L);
- check_one (z, 0, 0, "123 ");
- check_one (z, 0, 0, "123 ");
- check_one (z, 0, 0, "0173 ");
- check_one (z, 0, 0, " 0b 1 11 10 11 ");
- check_one (z, 0, 0, " 0x 7b ");
- check_one (z, 0, 0, "0x7B");
- check_one (z, 0, 10, "123 ");
- check_one (z, 0, 10, "123 ");
- check_one (z, 0, 0, " 123 ");
- check_one (z, 0, 0, " 123 ");
- check_one (z, 0, 10, " 0000123 ");
- check_one (z, 0, 10, " 123 ");
- check_one (z,-1, 10, "1%");
- check_one (z,-1, 0, "3!");
- check_one (z,-1, 0, "0123456789");
- check_one (z,-1, 0, "13579BDF");
- check_one (z,-1, 0, "0b0102");
- check_one (z,-1, 0, "0x010G");
- check_one (z,-1, 37,"0x010G");
- check_one (z,-1, 99,"0x010G");
+ check_one (z, 0, "123 ");
+ check_one (z, 0, "123 ");
+ check_one (z, 10, "123 ");
+ check_one (z, 10, "123 ");
+ check_one (z, 0, " 123 ");
+ check_one (z, 0, " 123 ");
+ check_one (z, 10, " 0000123 ");
+ check_one (z, 10, " 123 ");
mpz_clear (z);
}
diff --git a/gmp/tests/mpz/t-sizeinbase.c b/gmp/tests/mpz/t-sizeinbase.c
index b5eab8846f..c9d0f6c98c 100644
--- a/gmp/tests/mpz/t-sizeinbase.c
+++ b/gmp/tests/mpz/t-sizeinbase.c
@@ -2,20 +2,20 @@
Copyright 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/mpz/t-sqrtrem.c b/gmp/tests/mpz/t-sqrtrem.c
index 9aeb233890..976b9a6e09 100644
--- a/gmp/tests/mpz/t-sqrtrem.c
+++ b/gmp/tests/mpz/t-sqrtrem.c
@@ -1,21 +1,22 @@
/* Test mpz_add, mpz_add_ui, mpz_cmp, mpz_cmp, mpz_mul, mpz_sqrtrem.
-Copyright 1991, 1993, 1994, 1996, 2000-2002 Free Software Foundation, Inc.
+Copyright 1991, 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation,
+Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -24,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void dump_abort (mpz_t, mpz_t, mpz_t);
-void debug_mp (mpz_t, int);
+void dump_abort __GMP_PROTO ((mpz_t, mpz_t, mpz_t));
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
@@ -35,18 +36,19 @@ main (int argc, char **argv)
mpz_t temp, temp2;
mp_size_t x2_size;
int i;
- int reps = 1000;
+ int reps = 200000;
gmp_randstate_ptr rands;
mpz_t bs;
unsigned long size_range;
tests_start ();
- TESTS_REPS (reps, argv, argc);
-
rands = RANDS;
mpz_init (bs);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
mpz_init (x2);
mpz_init (x);
mpz_init (rem);
@@ -56,7 +58,7 @@ main (int argc, char **argv)
for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 17 + 2; /* 0..262144 bit operands */
+ size_range = mpz_get_ui (bs) % 12 + 2; /* 0..8191 bit operands */
mpz_urandomb (bs, rands, size_range);
x2_size = mpz_get_ui (bs);
diff --git a/gmp/tests/mpz/t-tdiv.c b/gmp/tests/mpz/t-tdiv.c
index 902b51c003..f9e2042a64 100644
--- a/gmp/tests/mpz/t-tdiv.c
+++ b/gmp/tests/mpz/t-tdiv.c
@@ -3,20 +3,20 @@
Copyright 1991, 1993, 1994, 1996, 1997, 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void dump_abort (mpz_t, mpz_t);
-void debug_mp (mpz_t, int);
+void dump_abort __GMP_PROTO ((mpz_t, mpz_t));
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
@@ -43,12 +43,13 @@ main (int argc, char **argv)
unsigned long bsi, size_range;
tests_start ();
- TESTS_REPS (reps, argv, argc);
-
rands = RANDS;
mpz_init (bs);
+ if (argc == 2)
+ reps = atoi (argv[1]);
+
mpz_init (dividend);
mpz_init (divisor);
mpz_init (quotient);
@@ -60,7 +61,7 @@ main (int argc, char **argv)
for (i = 0; i < reps; i++)
{
mpz_urandomb (bs, rands, 32);
- size_range = mpz_get_ui (bs) % 18 + 2; /* 0..524288 bit operands */
+ size_range = mpz_get_ui (bs) % 16 + 2; /* 0..131071 bit operands */
do
{
diff --git a/gmp/tests/mpz/t-tdiv_ui.c b/gmp/tests/mpz/t-tdiv_ui.c
index db266eb9d0..8ceaac1e7c 100644
--- a/gmp/tests/mpz/t-tdiv_ui.c
+++ b/gmp/tests/mpz/t-tdiv_ui.c
@@ -1,22 +1,22 @@
/* 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-2002 Free Software Foundation, Inc.
+Copyright 1993, 1994, 1996, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -25,8 +25,8 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "gmp-impl.h"
#include "tests.h"
-void dump_abort (const char *, mpz_t, unsigned long);
-void debug_mp (mpz_t, int);
+void dump_abort __GMP_PROTO ((char *, mpz_t, unsigned long));
+void debug_mp __GMP_PROTO ((mpz_t, int));
int
main (int argc, char **argv)
@@ -144,7 +144,7 @@ main (int argc, char **argv)
}
void
-dump_abort (const char *str, mpz_t dividend, unsigned long divisor)
+dump_abort (char *str, mpz_t dividend, unsigned long divisor)
{
fprintf (stderr, "ERROR: %s\n", str);
fprintf (stderr, "dividend = "); debug_mp (dividend, -16);
diff --git a/gmp/tests/rand/Makefile.am b/gmp/tests/rand/Makefile.am
index ed585b7edc..dd995db1b2 100644
--- a/gmp/tests/rand/Makefile.am
+++ b/gmp/tests/rand/Makefile.am
@@ -1,21 +1,21 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2000-2003 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
diff --git a/gmp/tests/rand/Makefile.in b/gmp/tests/rand/Makefile.in
index b902bc5586..d01fc9eea5 100644
--- a/gmp/tests/rand/Makefile.in
+++ b/gmp/tests/rand/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,45 +14,33 @@
@SET_MAKE@
-# Copyright 2000-2003 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
#
-# This file is part of the GNU MP Library test suite.
+# This file is part of the GNU MP Library.
#
-# 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 is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License along with
-# the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/.
+# You should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libstat_la_SOURCES) findlc.c gen.c $(gen_static_SOURCES) spect.c stat.c t-iset.c t-lc2exp.c t-mt.c t-rand.c t-urbui.c t-urmui.c t-urndmm.c
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ../..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -65,8 +52,8 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
check_PROGRAMS = t-iset$(EXEEXT) t-lc2exp$(EXEEXT) t-mt$(EXEEXT) \
t-rand$(EXEEXT) t-urbui$(EXEEXT) t-urmui$(EXEEXT) \
t-urndmm$(EXEEXT)
@@ -76,102 +63,90 @@ subdir = tests/rand
DIST_COMMON = $(srcdir)/Makefile.am $(srcdir)/Makefile.in
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
am__DEPENDENCIES_1 =
libstat_la_DEPENDENCIES = $(top_builddir)/libgmp.la \
$(am__DEPENDENCIES_1)
-am_libstat_la_OBJECTS = statlib.lo zdiv_round.lo
+am_libstat_la_OBJECTS = statlib$U.lo zdiv_round$U.lo
libstat_la_OBJECTS = $(am_libstat_la_OBJECTS)
findlc_SOURCES = findlc.c
-findlc_OBJECTS = findlc.$(OBJEXT)
+findlc_OBJECTS = findlc$U.$(OBJEXT)
findlc_DEPENDENCIES = libstat.la
gen_SOURCES = gen.c
-gen_OBJECTS = gen.$(OBJEXT)
+gen_OBJECTS = gen$U.$(OBJEXT)
gen_LDADD = $(LDADD)
gen_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-am_gen_static_OBJECTS = gen.$(OBJEXT)
+am_gen_static_OBJECTS = gen$U.$(OBJEXT)
gen_static_OBJECTS = $(am_gen_static_OBJECTS)
gen_static_LDADD = $(LDADD)
gen_static_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-gen_static_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(gen_static_LDFLAGS) $(LDFLAGS) -o $@
spect_SOURCES = spect.c
-spect_OBJECTS = spect.$(OBJEXT)
+spect_OBJECTS = spect$U.$(OBJEXT)
spect_DEPENDENCIES = libstat.la
stat_SOURCES = stat.c
-stat_OBJECTS = stat.$(OBJEXT)
+stat_OBJECTS = stat$U.$(OBJEXT)
stat_DEPENDENCIES = libstat.la
t_iset_SOURCES = t-iset.c
-t_iset_OBJECTS = t-iset.$(OBJEXT)
+t_iset_OBJECTS = t-iset$U.$(OBJEXT)
t_iset_LDADD = $(LDADD)
t_iset_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_lc2exp_SOURCES = t-lc2exp.c
-t_lc2exp_OBJECTS = t-lc2exp.$(OBJEXT)
+t_lc2exp_OBJECTS = t-lc2exp$U.$(OBJEXT)
t_lc2exp_LDADD = $(LDADD)
t_lc2exp_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_mt_SOURCES = t-mt.c
-t_mt_OBJECTS = t-mt.$(OBJEXT)
+t_mt_OBJECTS = t-mt$U.$(OBJEXT)
t_mt_LDADD = $(LDADD)
t_mt_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_rand_SOURCES = t-rand.c
-t_rand_OBJECTS = t-rand.$(OBJEXT)
+t_rand_OBJECTS = t-rand$U.$(OBJEXT)
t_rand_LDADD = $(LDADD)
t_rand_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_urbui_SOURCES = t-urbui.c
-t_urbui_OBJECTS = t-urbui.$(OBJEXT)
+t_urbui_OBJECTS = t-urbui$U.$(OBJEXT)
t_urbui_LDADD = $(LDADD)
t_urbui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_urmui_SOURCES = t-urmui.c
-t_urmui_OBJECTS = t-urmui.$(OBJEXT)
+t_urmui_OBJECTS = t-urmui$U.$(OBJEXT)
t_urmui_LDADD = $(LDADD)
t_urmui_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
t_urndmm_SOURCES = t-urndmm.c
-t_urndmm_OBJECTS = t-urndmm.$(OBJEXT)
+t_urndmm_OBJECTS = t-urndmm$U.$(OBJEXT)
t_urndmm_LDADD = $(LDADD)
t_urndmm_DEPENDENCIES = $(top_builddir)/tests/libtests.la \
$(top_builddir)/libgmp.la
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libstat_la_SOURCES) findlc.c gen.c $(gen_static_SOURCES) \
spect.c stat.c t-iset.c t-lc2exp.c t-mt.c t-rand.c t-urbui.c \
t-urmui.c t-urndmm.c
DIST_SOURCES = $(libstat_la_SOURCES) findlc.c gen.c \
$(gen_static_SOURCES) spect.c stat.c t-iset.c t-lc2exp.c \
t-mt.c t-rand.c t-urbui.c t-urmui.c t-urndmm.c
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
ETAGS = etags
CTAGS = ctags
-am__tty_colors = \
-red=; grn=; lgn=; blu=; std=
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ABI = @ABI@
ACLOCAL = @ACLOCAL@
@@ -183,6 +158,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -198,17 +174,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -222,12 +197,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -242,26 +215,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -271,31 +238,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -319,6 +281,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -326,12 +289,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
LDADD = $(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
TESTS = $(check_PROGRAMS)
@@ -352,14 +311,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(am__confi
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/rand/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tests/rand/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tests/rand/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tests/rand/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -377,60 +336,62 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-libstat.la: $(libstat_la_OBJECTS) $(libstat_la_DEPENDENCIES) $(EXTRA_libstat_la_DEPENDENCIES)
- $(LINK) $(libstat_la_OBJECTS) $(libstat_la_LIBADD) $(LIBS)
+libstat.la: $(libstat_la_OBJECTS) $(libstat_la_DEPENDENCIES)
+ $(LINK) $(libstat_la_LDFLAGS) $(libstat_la_OBJECTS) $(libstat_la_LIBADD) $(LIBS)
clean-checkPROGRAMS:
- @list='$(check_PROGRAMS)'; test -n "$$list" || exit 0; \
- echo " rm -f" $$list; \
- rm -f $$list || exit $$?; \
- test -n "$(EXEEXT)" || exit 0; \
- list=`for p in $$list; do echo "$$p"; done | sed 's/$(EXEEXT)$$//'`; \
- echo " rm -f" $$list; \
- rm -f $$list
-findlc$(EXEEXT): $(findlc_OBJECTS) $(findlc_DEPENDENCIES) $(EXTRA_findlc_DEPENDENCIES)
+ @list='$(check_PROGRAMS)'; for p in $$list; do \
+ f=`echo $$p|sed 's/$(EXEEXT)$$//'`; \
+ echo " rm -f $$p $$f"; \
+ rm -f $$p $$f ; \
+ done
+findlc$(EXEEXT): $(findlc_OBJECTS) $(findlc_DEPENDENCIES)
@rm -f findlc$(EXEEXT)
- $(LINK) $(findlc_OBJECTS) $(findlc_LDADD) $(LIBS)
-gen$(EXEEXT): $(gen_OBJECTS) $(gen_DEPENDENCIES) $(EXTRA_gen_DEPENDENCIES)
+ $(LINK) $(findlc_LDFLAGS) $(findlc_OBJECTS) $(findlc_LDADD) $(LIBS)
+gen$(EXEEXT): $(gen_OBJECTS) $(gen_DEPENDENCIES)
@rm -f gen$(EXEEXT)
- $(LINK) $(gen_OBJECTS) $(gen_LDADD) $(LIBS)
-gen.static$(EXEEXT): $(gen_static_OBJECTS) $(gen_static_DEPENDENCIES) $(EXTRA_gen_static_DEPENDENCIES)
+ $(LINK) $(gen_LDFLAGS) $(gen_OBJECTS) $(gen_LDADD) $(LIBS)
+gen.static$(EXEEXT): $(gen_static_OBJECTS) $(gen_static_DEPENDENCIES)
@rm -f gen.static$(EXEEXT)
- $(gen_static_LINK) $(gen_static_OBJECTS) $(gen_static_LDADD) $(LIBS)
-spect$(EXEEXT): $(spect_OBJECTS) $(spect_DEPENDENCIES) $(EXTRA_spect_DEPENDENCIES)
+ $(LINK) $(gen_static_LDFLAGS) $(gen_static_OBJECTS) $(gen_static_LDADD) $(LIBS)
+spect$(EXEEXT): $(spect_OBJECTS) $(spect_DEPENDENCIES)
@rm -f spect$(EXEEXT)
- $(LINK) $(spect_OBJECTS) $(spect_LDADD) $(LIBS)
-stat$(EXEEXT): $(stat_OBJECTS) $(stat_DEPENDENCIES) $(EXTRA_stat_DEPENDENCIES)
+ $(LINK) $(spect_LDFLAGS) $(spect_OBJECTS) $(spect_LDADD) $(LIBS)
+stat$(EXEEXT): $(stat_OBJECTS) $(stat_DEPENDENCIES)
@rm -f stat$(EXEEXT)
- $(LINK) $(stat_OBJECTS) $(stat_LDADD) $(LIBS)
-t-iset$(EXEEXT): $(t_iset_OBJECTS) $(t_iset_DEPENDENCIES) $(EXTRA_t_iset_DEPENDENCIES)
+ $(LINK) $(stat_LDFLAGS) $(stat_OBJECTS) $(stat_LDADD) $(LIBS)
+t-iset$(EXEEXT): $(t_iset_OBJECTS) $(t_iset_DEPENDENCIES)
@rm -f t-iset$(EXEEXT)
- $(LINK) $(t_iset_OBJECTS) $(t_iset_LDADD) $(LIBS)
-t-lc2exp$(EXEEXT): $(t_lc2exp_OBJECTS) $(t_lc2exp_DEPENDENCIES) $(EXTRA_t_lc2exp_DEPENDENCIES)
+ $(LINK) $(t_iset_LDFLAGS) $(t_iset_OBJECTS) $(t_iset_LDADD) $(LIBS)
+t-lc2exp$(EXEEXT): $(t_lc2exp_OBJECTS) $(t_lc2exp_DEPENDENCIES)
@rm -f t-lc2exp$(EXEEXT)
- $(LINK) $(t_lc2exp_OBJECTS) $(t_lc2exp_LDADD) $(LIBS)
-t-mt$(EXEEXT): $(t_mt_OBJECTS) $(t_mt_DEPENDENCIES) $(EXTRA_t_mt_DEPENDENCIES)
+ $(LINK) $(t_lc2exp_LDFLAGS) $(t_lc2exp_OBJECTS) $(t_lc2exp_LDADD) $(LIBS)
+t-mt$(EXEEXT): $(t_mt_OBJECTS) $(t_mt_DEPENDENCIES)
@rm -f t-mt$(EXEEXT)
- $(LINK) $(t_mt_OBJECTS) $(t_mt_LDADD) $(LIBS)
-t-rand$(EXEEXT): $(t_rand_OBJECTS) $(t_rand_DEPENDENCIES) $(EXTRA_t_rand_DEPENDENCIES)
+ $(LINK) $(t_mt_LDFLAGS) $(t_mt_OBJECTS) $(t_mt_LDADD) $(LIBS)
+t-rand$(EXEEXT): $(t_rand_OBJECTS) $(t_rand_DEPENDENCIES)
@rm -f t-rand$(EXEEXT)
- $(LINK) $(t_rand_OBJECTS) $(t_rand_LDADD) $(LIBS)
-t-urbui$(EXEEXT): $(t_urbui_OBJECTS) $(t_urbui_DEPENDENCIES) $(EXTRA_t_urbui_DEPENDENCIES)
+ $(LINK) $(t_rand_LDFLAGS) $(t_rand_OBJECTS) $(t_rand_LDADD) $(LIBS)
+t-urbui$(EXEEXT): $(t_urbui_OBJECTS) $(t_urbui_DEPENDENCIES)
@rm -f t-urbui$(EXEEXT)
- $(LINK) $(t_urbui_OBJECTS) $(t_urbui_LDADD) $(LIBS)
-t-urmui$(EXEEXT): $(t_urmui_OBJECTS) $(t_urmui_DEPENDENCIES) $(EXTRA_t_urmui_DEPENDENCIES)
+ $(LINK) $(t_urbui_LDFLAGS) $(t_urbui_OBJECTS) $(t_urbui_LDADD) $(LIBS)
+t-urmui$(EXEEXT): $(t_urmui_OBJECTS) $(t_urmui_DEPENDENCIES)
@rm -f t-urmui$(EXEEXT)
- $(LINK) $(t_urmui_OBJECTS) $(t_urmui_LDADD) $(LIBS)
-t-urndmm$(EXEEXT): $(t_urndmm_OBJECTS) $(t_urndmm_DEPENDENCIES) $(EXTRA_t_urndmm_DEPENDENCIES)
+ $(LINK) $(t_urmui_LDFLAGS) $(t_urmui_OBJECTS) $(t_urmui_LDADD) $(LIBS)
+t-urndmm$(EXEEXT): $(t_urndmm_OBJECTS) $(t_urndmm_DEPENDENCIES)
@rm -f t-urndmm$(EXEEXT)
- $(LINK) $(t_urndmm_OBJECTS) $(t_urndmm_LDADD) $(LIBS)
+ $(LINK) $(t_urndmm_LDFLAGS) $(t_urndmm_OBJECTS) $(t_urndmm_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -440,6 +401,39 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+findlc_.c: findlc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/findlc.c; then echo $(srcdir)/findlc.c; else echo findlc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gen_.c: gen.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gen.c; then echo $(srcdir)/gen.c; else echo gen.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+spect_.c: spect.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/spect.c; then echo $(srcdir)/spect.c; else echo spect.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+stat_.c: stat.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/stat.c; then echo $(srcdir)/stat.c; else echo stat.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+statlib_.c: statlib.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/statlib.c; then echo $(srcdir)/statlib.c; else echo statlib.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-iset_.c: t-iset.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-iset.c; then echo $(srcdir)/t-iset.c; else echo t-iset.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-lc2exp_.c: t-lc2exp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-lc2exp.c; then echo $(srcdir)/t-lc2exp.c; else echo t-lc2exp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-mt_.c: t-mt.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-mt.c; then echo $(srcdir)/t-mt.c; else echo t-mt.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-rand_.c: t-rand.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-rand.c; then echo $(srcdir)/t-rand.c; else echo t-rand.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-urbui_.c: t-urbui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-urbui.c; then echo $(srcdir)/t-urbui.c; else echo t-urbui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-urmui_.c: t-urmui.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-urmui.c; then echo $(srcdir)/t-urmui.c; else echo t-urmui.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+t-urndmm_.c: t-urndmm.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/t-urndmm.c; then echo $(srcdir)/t-urndmm.c; else echo t-urndmm.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+zdiv_round_.c: zdiv_round.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/zdiv_round.c; then echo $(srcdir)/zdiv_round.c; else echo zdiv_round.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+findlc_.$(OBJEXT) findlc_.lo gen_.$(OBJEXT) gen_.lo spect_.$(OBJEXT) \
+spect_.lo stat_.$(OBJEXT) stat_.lo statlib_.$(OBJEXT) statlib_.lo \
+t-iset_.$(OBJEXT) t-iset_.lo t-lc2exp_.$(OBJEXT) t-lc2exp_.lo \
+t-mt_.$(OBJEXT) t-mt_.lo t-rand_.$(OBJEXT) t-rand_.lo \
+t-urbui_.$(OBJEXT) t-urbui_.lo t-urmui_.$(OBJEXT) t-urmui_.lo \
+t-urndmm_.$(OBJEXT) t-urndmm_.lo zdiv_round_.$(OBJEXT) zdiv_round_.lo \
+: $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -447,54 +441,54 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
@@ -502,8 +496,7 @@ distclean-tags:
check-TESTS: $(TESTS)
@failed=0; all=0; xfail=0; xpass=0; skip=0; \
srcdir=$(srcdir); export srcdir; \
- list=' $(TESTS) '; \
- $(am__tty_colors); \
+ list='$(TESTS)'; \
if test -n "$$list"; then \
for tst in $$list; do \
if test -f ./$$tst; then dir=./; \
@@ -512,113 +505,91 @@ check-TESTS: $(TESTS)
if $(TESTS_ENVIRONMENT) $${dir}$$tst; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xpass=`expr $$xpass + 1`; \
failed=`expr $$failed + 1`; \
- col=$$red; res=XPASS; \
+ echo "XPASS: $$tst"; \
;; \
*) \
- col=$$grn; res=PASS; \
+ echo "PASS: $$tst"; \
;; \
esac; \
elif test $$? -ne 77; then \
all=`expr $$all + 1`; \
case " $(XFAIL_TESTS) " in \
- *[\ \ ]$$tst[\ \ ]*) \
+ *" $$tst "*) \
xfail=`expr $$xfail + 1`; \
- col=$$lgn; res=XFAIL; \
+ echo "XFAIL: $$tst"; \
;; \
*) \
failed=`expr $$failed + 1`; \
- col=$$red; res=FAIL; \
+ echo "FAIL: $$tst"; \
;; \
esac; \
else \
skip=`expr $$skip + 1`; \
- col=$$blu; res=SKIP; \
+ echo "SKIP: $$tst"; \
fi; \
- echo "$${col}$$res$${std}: $$tst"; \
done; \
- if test "$$all" -eq 1; then \
- tests="test"; \
- All=""; \
- else \
- tests="tests"; \
- All="All "; \
- fi; \
if test "$$failed" -eq 0; then \
if test "$$xfail" -eq 0; then \
- banner="$$All$$all $$tests passed"; \
+ banner="All $$all tests passed"; \
else \
- if test "$$xfail" -eq 1; then failures=failure; else failures=failures; fi; \
- banner="$$All$$all $$tests behaved as expected ($$xfail expected $$failures)"; \
+ banner="All $$all tests behaved as expected ($$xfail expected failures)"; \
fi; \
else \
if test "$$xpass" -eq 0; then \
- banner="$$failed of $$all $$tests failed"; \
+ banner="$$failed of $$all tests failed"; \
else \
- if test "$$xpass" -eq 1; then passes=pass; else passes=passes; fi; \
- banner="$$failed of $$all $$tests did not behave as expected ($$xpass unexpected $$passes)"; \
+ banner="$$failed of $$all tests did not behave as expected ($$xpass unexpected passes)"; \
fi; \
fi; \
dashes="$$banner"; \
skipped=""; \
if test "$$skip" -ne 0; then \
- if test "$$skip" -eq 1; then \
- skipped="($$skip test was not run)"; \
- else \
- skipped="($$skip tests were not run)"; \
- fi; \
- test `echo "$$skipped" | wc -c` -le `echo "$$banner" | wc -c` || \
+ skipped="($$skip tests were not run)"; \
+ test `echo "$$skipped" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$skipped"; \
fi; \
report=""; \
if test "$$failed" -ne 0 && test -n "$(PACKAGE_BUGREPORT)"; then \
report="Please report to $(PACKAGE_BUGREPORT)"; \
- test `echo "$$report" | wc -c` -le `echo "$$banner" | wc -c` || \
+ test `echo "$$report" | wc -c` -gt `echo "$$banner" | wc -c` && \
dashes="$$report"; \
fi; \
dashes=`echo "$$dashes" | sed s/./=/g`; \
- if test "$$failed" -eq 0; then \
- col="$$grn"; \
- else \
- col="$$red"; \
- fi; \
- echo "$${col}$$dashes$${std}"; \
- echo "$${col}$$banner$${std}"; \
- test -z "$$skipped" || echo "$${col}$$skipped$${std}"; \
- test -z "$$report" || echo "$${col}$$report$${std}"; \
- echo "$${col}$$dashes$${std}"; \
+ echo "$$dashes"; \
+ echo "$$banner"; \
+ test -n "$$skipped" && echo "$$skipped"; \
+ test -n "$$report" && echo "$$report"; \
+ echo "$$dashes"; \
test "$$failed" -eq 0; \
else :; fi
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -638,23 +609,17 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
maintainer-clean-generic:
@echo "This command is intended for maintainers to use"
@@ -667,7 +632,7 @@ clean-am: clean-checkPROGRAMS clean-generic clean-libtool \
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -675,38 +640,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -715,7 +660,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -726,23 +671,19 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: check-am install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-TESTS check-am clean \
clean-checkPROGRAMS clean-generic clean-libtool ctags \
distclean distclean-compile distclean-generic \
distclean-libtool distclean-tags distdir dvi dvi-am html \
html-am info info-am install install-am install-data \
- install-data-am install-dvi install-dvi-am install-exec \
- install-exec-am install-html install-html-am install-info \
- install-info-am install-man install-pdf install-pdf-am \
- install-ps install-ps-am install-strip installcheck \
+ install-data-am install-exec install-exec-am install-info \
+ install-info-am install-man install-strip installcheck \
installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
allprogs: $(EXTRA_PROGRAMS)
@@ -795,7 +736,6 @@ manual-bigtest: gen$(EXEEXT) stat$(EXEEXT)
| ./stat -2 1000 | grep '^K[mp]')
@(echo '128f: '; ./gen -f mpf_urandomb -z 128 50000 \
| ./stat -2 1000 | grep '^K[mp]')
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tests/rand/findlc.c b/gmp/tests/rand/findlc.c
index 2406c3b645..15b3458fd5 100644
--- a/gmp/tests/rand/findlc.c
+++ b/gmp/tests/rand/findlc.c
@@ -1,20 +1,20 @@
/*
Copyright 2000 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -47,7 +47,7 @@ sh_status (int sig)
signal (SIGSEGV, SIG_DFL);
}
-/* Input is a modulus (m). We shall find multiplier (a) and adder (c)
+/* Input is a modulus (m). We shall find multiplyer (a) and adder (c)
conforming to the rules found in the first comment block in file
mpz/urandom.c.
diff --git a/gmp/tests/rand/gen.c b/gmp/tests/rand/gen.c
index 65401e3751..c3f8c616a1 100644
--- a/gmp/tests/rand/gen.c
+++ b/gmp/tests/rand/gen.c
@@ -2,20 +2,20 @@
Copyright 1999, 2000, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Examples:
@@ -277,7 +277,7 @@ int main (argc, argv)
case RFUNC_mpf_urandomb:
#if 0
/* Don't init a too small generator. */
- size = PREC (f1) * GMP_LIMB_BITS;
+ size = PREC (f1) * BITS_PER_MP_LIMB;
/* Fall through. */
#endif
case RFUNC_mpz_urandomb:
diff --git a/gmp/tests/rand/gmpstat.h b/gmp/tests/rand/gmpstat.h
index 99c5cca195..1e4d6afe7d 100644
--- a/gmp/tests/rand/gmpstat.h
+++ b/gmp/tests/rand/gmpstat.h
@@ -3,20 +3,20 @@
/*
Copyright 1999 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 requires the following header files: gmp.h */
diff --git a/gmp/tests/rand/spect.c b/gmp/tests/rand/spect.c
index 596ff3a9c4..f6f872b099 100644
--- a/gmp/tests/rand/spect.c
+++ b/gmp/tests/rand/spect.c
@@ -3,20 +3,20 @@
/*
Copyright 1999 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://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;
- int f;
+ register int f;
mpz_init (a);
diff --git a/gmp/tests/rand/stat.c b/gmp/tests/rand/stat.c
index 1285ccfb9f..e6917d9354 100644
--- a/gmp/tests/rand/stat.c
+++ b/gmp/tests/rand/stat.c
@@ -3,20 +3,20 @@
/*
Copyright 1999, 2000 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Examples:
diff --git a/gmp/tests/rand/statlib.c b/gmp/tests/rand/statlib.c
index 7cecd6dee2..e429ad6fcf 100644
--- a/gmp/tests/rand/statlib.c
+++ b/gmp/tests/rand/statlib.c
@@ -4,20 +4,20 @@
/*
Copyright 1999, 2000 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 theories for these functions are taken from D. Knuth's "The Art
of Computer Programming: Volume 2, Seminumerical Algorithms", Third
@@ -298,7 +298,7 @@ Pzf (mpf_t p, unsigned long int s, void *x)
X[] must not contain numbers outside the range 0 <= X <= IMAX.
- Return value is number of observations actually used, after
+ Return value is number of observations actally used, after
discarding entries out of range.
Since X[] contains integers between zero and IMAX, inclusive, we
diff --git a/gmp/tests/rand/t-iset.c b/gmp/tests/rand/t-iset.c
index 0414037c19..b1e51e4e19 100644
--- a/gmp/tests/rand/t-iset.c
+++ b/gmp/tests/rand/t-iset.c
@@ -2,20 +2,20 @@
Copyright 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/rand/t-lc2exp.c b/gmp/tests/rand/t-lc2exp.c
index b524441f29..dc5c7d6ed0 100644
--- a/gmp/tests/rand/t-lc2exp.c
+++ b/gmp/tests/rand/t-lc2exp.c
@@ -1,21 +1,21 @@
/* Exercise the lc2exp random functions.
-Copyright 2002, 2011 Free Software Foundation, Inc.
+Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -108,7 +108,6 @@ check_bigc (void)
printf (" m2exp=%lu\n", m2exp);
gmp_printf (" rand=%#ZX\n", a);
gmp_printf (" sizeinbase2=%u\n", mpz_sizeinbase (a, 2));
- abort ();
}
}
diff --git a/gmp/tests/rand/t-mt.c b/gmp/tests/rand/t-mt.c
index 3aabffe88d..71f1e11bb2 100644
--- a/gmp/tests/rand/t-mt.c
+++ b/gmp/tests/rand/t-mt.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include "gmp.h"
diff --git a/gmp/tests/rand/t-rand.c b/gmp/tests/rand/t-rand.c
index 1265a0d0a5..d3e3c252fe 100644
--- a/gmp/tests/rand/t-rand.c
+++ b/gmp/tests/rand/t-rand.c
@@ -3,20 +3,20 @@
/*
Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdlib.h>
#include <stdio.h>
@@ -29,57 +29,57 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
/* These were generated by this very program. Do not edit! */
/* Integers. */
-const char *z1[ENTS] = {"0", "1", "1", "1", "1", "0", "1", "1", "1", "1"};
-const char *z2[ENTS] = {"0", "3", "1", "3", "3", "0", "3", "3", "3", "1"};
-const char *z3[ENTS] = {"4", "3", "1", "7", "3", "0", "3", "3", "3", "1"};
-const char *z4[ENTS] = {"c", "3", "1", "f", "b", "8", "3", "3", "3", "1"};
-const char *z5[ENTS] = {"1c", "13", "11", "1f", "b", "18", "3", "13", "3", "1"};
+char *z1[ENTS] = {"0", "1", "1", "1", "1", "0", "1", "1", "1", "1"};
+char *z2[ENTS] = {"0", "3", "1", "3", "3", "0", "3", "3", "3", "1"};
+char *z3[ENTS] = {"4", "3", "1", "7", "3", "0", "3", "3", "3", "1"};
+char *z4[ENTS] = {"c", "3", "1", "f", "b", "8", "3", "3", "3", "1"};
+char *z5[ENTS] = {"1c", "13", "11", "1f", "b", "18", "3", "13", "3", "1"};
-const char *z10[ENTS] = {"29c", "213", "f1", "17f", "12b", "178", "383", "d3", "3a3", "281"};
+char *z10[ENTS] = {"29c", "213", "f1", "17f", "12b", "178", "383", "d3", "3a3", "281"};
-const char *z15[ENTS] = {"29c", "1a13", "74f1", "257f", "592b", "4978", "4783", "7cd3", "5ba3", "4681"};
-const char *z16[ENTS] = {"29c", "9a13", "74f1", "a57f", "d92b", "4978", "c783", "fcd3", "5ba3", "c681"};
-const char *z17[ENTS] = {"51e", "f17a", "54ff", "1a335", "cf65", "5d6f", "583f", "618f", "1bc6", "98ff"};
+char *z15[ENTS] = {"29c", "1a13", "74f1", "257f", "592b", "4978", "4783", "7cd3", "5ba3", "4681"};
+char *z16[ENTS] = {"29c", "9a13", "74f1", "a57f", "d92b", "4978", "c783", "fcd3", "5ba3", "c681"};
+char *z17[ENTS] = {"51e", "f17a", "54ff", "1a335", "cf65", "5d6f", "583f", "618f", "1bc6", "98ff"};
-const char *z31[ENTS] = {"3aecd515", "13ae8ec6", "518c8090", "81ca077", "70b7134", "7ee78d71", "323a7636", "2122cb1a", "19811941", "41fd605"};
-const char *z32[ENTS] = {"baecd515", "13ae8ec6", "518c8090", "881ca077", "870b7134", "7ee78d71", "323a7636", "a122cb1a", "99811941", "841fd605"};
-const char *z33[ENTS] = {"1faf4cca", "15d6ef83b", "9095fe72", "1b6a3dff6", "b17cbddd", "16e5209d4", "6f65b12c", "493bbbc6", "abf2a5d5", "6d491a3c"};
+char *z31[ENTS] = {"3aecd515", "13ae8ec6", "518c8090", "81ca077", "70b7134", "7ee78d71", "323a7636", "2122cb1a", "19811941", "41fd605"};
+char *z32[ENTS] = {"baecd515", "13ae8ec6", "518c8090", "881ca077", "870b7134", "7ee78d71", "323a7636", "a122cb1a", "99811941", "841fd605"};
+char *z33[ENTS] = {"1faf4cca", "15d6ef83b", "9095fe72", "1b6a3dff6", "b17cbddd", "16e5209d4", "6f65b12c", "493bbbc6", "abf2a5d5", "6d491a3c"};
-const char *z63[ENTS] = {"48a74f367fa7b5c8", "3ba9e9dc1b263076", "1e0ac84e7678e0fb", "11416581728b3e35", "36ab610523f0f1f7", "3e540e8e95c0eb4b", "439ae16057dbc9d3", "734fb260db243950", "7d3a317effc289bf", "1d80301fb3d1a0d1"};
-const char *z64[ENTS] = {"48a74f367fa7b5c8", "bba9e9dc1b263076", "9e0ac84e7678e0fb", "11416581728b3e35", "b6ab610523f0f1f7", "be540e8e95c0eb4b", "439ae16057dbc9d3", "f34fb260db243950", "fd3a317effc289bf", "1d80301fb3d1a0d1"};
-const char *z65[ENTS] = {"1ff77710d846d49f0", "1b1411701d709ee10", "31ffa81a208b6af4", "446638d431d3c681", "df5c569d5baa8b55", "197d99ea9bf28e5a0", "191ade09edd94cfae", "194acefa6dde5e18d", "1afc1167c56272d92", "d092994da72f206f"};
+char *z63[ENTS] = {"48a74f367fa7b5c8", "3ba9e9dc1b263076", "1e0ac84e7678e0fb", "11416581728b3e35", "36ab610523f0f1f7", "3e540e8e95c0eb4b", "439ae16057dbc9d3", "734fb260db243950", "7d3a317effc289bf", "1d80301fb3d1a0d1"};
+char *z64[ENTS] = {"48a74f367fa7b5c8", "bba9e9dc1b263076", "9e0ac84e7678e0fb", "11416581728b3e35", "b6ab610523f0f1f7", "be540e8e95c0eb4b", "439ae16057dbc9d3", "f34fb260db243950", "fd3a317effc289bf", "1d80301fb3d1a0d1"};
+char *z65[ENTS] = {"1ff77710d846d49f0", "1b1411701d709ee10", "31ffa81a208b6af4", "446638d431d3c681", "df5c569d5baa8b55", "197d99ea9bf28e5a0", "191ade09edd94cfae", "194acefa6dde5e18d", "1afc1167c56272d92", "d092994da72f206f"};
-const char *z127[ENTS] = {"2f66ba932aaf58a071fd8f0742a99a0c", "73cfa3c664c9c1753507ca60ec6b8425", "53ea074ca131dec12cd68b8aa8e20278", "3cf5ac8c343532f8a53cc0eb47581f73", "50c11d5869e208aa1b9aa317b8c2d0a9", "b23163c892876472b1ef19642eace09", "489f4c03d41f87509c8d6c90ce674f95", "2ab8748c96aa6762ea1932b44c9d7164", "98cb5591fc05ad31afbbc1d67b90edd", "77848bb991fd0be331adcf1457fbc672"};
-const char *z128[ENTS] = {"af66ba932aaf58a071fd8f0742a99a0c", "73cfa3c664c9c1753507ca60ec6b8425", "53ea074ca131dec12cd68b8aa8e20278", "3cf5ac8c343532f8a53cc0eb47581f73", "50c11d5869e208aa1b9aa317b8c2d0a9", "8b23163c892876472b1ef19642eace09", "489f4c03d41f87509c8d6c90ce674f95", "aab8748c96aa6762ea1932b44c9d7164", "98cb5591fc05ad31afbbc1d67b90edd", "f7848bb991fd0be331adcf1457fbc672"};
+char *z127[ENTS] = {"2f66ba932aaf58a071fd8f0742a99a0c", "73cfa3c664c9c1753507ca60ec6b8425", "53ea074ca131dec12cd68b8aa8e20278", "3cf5ac8c343532f8a53cc0eb47581f73", "50c11d5869e208aa1b9aa317b8c2d0a9", "b23163c892876472b1ef19642eace09", "489f4c03d41f87509c8d6c90ce674f95", "2ab8748c96aa6762ea1932b44c9d7164", "98cb5591fc05ad31afbbc1d67b90edd", "77848bb991fd0be331adcf1457fbc672"};
+char *z128[ENTS] = {"af66ba932aaf58a071fd8f0742a99a0c", "73cfa3c664c9c1753507ca60ec6b8425", "53ea074ca131dec12cd68b8aa8e20278", "3cf5ac8c343532f8a53cc0eb47581f73", "50c11d5869e208aa1b9aa317b8c2d0a9", "8b23163c892876472b1ef19642eace09", "489f4c03d41f87509c8d6c90ce674f95", "aab8748c96aa6762ea1932b44c9d7164", "98cb5591fc05ad31afbbc1d67b90edd", "f7848bb991fd0be331adcf1457fbc672"};
/* Floats. */
-const char *f1[ENTS] = {"0.@0", "0.8@0", "0.8@0", "0.8@0", "0.8@0", "0.@0", "0.8@0", "0.8@0", "0.8@0", "0.8@0"};
-const char *f2[ENTS] = {"0.@0", "0.c@0", "0.4@0", "0.c@0", "0.c@0", "0.@0", "0.c@0", "0.c@0", "0.c@0", "0.4@0"};
-const char *f3[ENTS] = {"0.8@0", "0.6@0", "0.2@0", "0.e@0", "0.6@0", "0.@0", "0.6@0", "0.6@0", "0.6@0", "0.2@0"};
-const char *f4[ENTS] = {"0.c@0", "0.3@0", "0.1@0", "0.f@0", "0.b@0", "0.8@0", "0.3@0", "0.3@0", "0.3@0", "0.1@0"};
-const char *f5[ENTS] = {"0.e@0", "0.98@0", "0.88@0", "0.f8@0", "0.58@0", "0.c@0", "0.18@0", "0.98@0", "0.18@0", "0.8@-1"};
+char *f1[ENTS] = {"0.@0", "0.8@0", "0.8@0", "0.8@0", "0.8@0", "0.@0", "0.8@0", "0.8@0", "0.8@0", "0.8@0"};
+char *f2[ENTS] = {"0.@0", "0.c@0", "0.4@0", "0.c@0", "0.c@0", "0.@0", "0.c@0", "0.c@0", "0.c@0", "0.4@0"};
+char *f3[ENTS] = {"0.8@0", "0.6@0", "0.2@0", "0.e@0", "0.6@0", "0.@0", "0.6@0", "0.6@0", "0.6@0", "0.2@0"};
+char *f4[ENTS] = {"0.c@0", "0.3@0", "0.1@0", "0.f@0", "0.b@0", "0.8@0", "0.3@0", "0.3@0", "0.3@0", "0.1@0"};
+char *f5[ENTS] = {"0.e@0", "0.98@0", "0.88@0", "0.f8@0", "0.58@0", "0.c@0", "0.18@0", "0.98@0", "0.18@0", "0.8@-1"};
-const char *f10[ENTS] = {"0.a7@0", "0.84c@0", "0.3c4@0", "0.5fc@0", "0.4ac@0", "0.5e@0", "0.e0c@0", "0.34c@0", "0.e8c@0", "0.a04@0"};
+char *f10[ENTS] = {"0.a7@0", "0.84c@0", "0.3c4@0", "0.5fc@0", "0.4ac@0", "0.5e@0", "0.e0c@0", "0.34c@0", "0.e8c@0", "0.a04@0"};
-const char *f15[ENTS] = {"0.538@-1", "0.3426@0", "0.e9e2@0", "0.4afe@0", "0.b256@0", "0.92f@0", "0.8f06@0", "0.f9a6@0", "0.b746@0", "0.8d02@0"};
-const char *f16[ENTS] = {"0.29c@-1", "0.9a13@0", "0.74f1@0", "0.a57f@0", "0.d92b@0", "0.4978@0", "0.c783@0", "0.fcd3@0", "0.5ba3@0", "0.c681@0"};
-const char *f17[ENTS] = {"0.28f@-1", "0.78bd@0", "0.2a7f8@0", "0.d19a8@0", "0.67b28@0", "0.2eb78@0", "0.2c1f8@0", "0.30c78@0", "0.de3@-1", "0.4c7f8@0"};
+char *f15[ENTS] = {"0.538@-1", "0.3426@0", "0.e9e2@0", "0.4afe@0", "0.b256@0", "0.92f@0", "0.8f06@0", "0.f9a6@0", "0.b746@0", "0.8d02@0"};
+char *f16[ENTS] = {"0.29c@-1", "0.9a13@0", "0.74f1@0", "0.a57f@0", "0.d92b@0", "0.4978@0", "0.c783@0", "0.fcd3@0", "0.5ba3@0", "0.c681@0"};
+char *f17[ENTS] = {"0.28f@-1", "0.78bd@0", "0.2a7f8@0", "0.d19a8@0", "0.67b28@0", "0.2eb78@0", "0.2c1f8@0", "0.30c78@0", "0.de3@-1", "0.4c7f8@0"};
-const char *f31[ENTS] = {"0.75d9aa2a@0", "0.275d1d8c@0", "0.a319012@0", "0.103940ee@0", "0.e16e268@-1", "0.fdcf1ae2@0", "0.6474ec6c@0", "0.42459634@0", "0.33023282@0", "0.83fac0a@-1"};
-const char *f32[ENTS] = {"0.baecd515@0", "0.13ae8ec6@0", "0.518c809@0", "0.881ca077@0", "0.870b7134@0", "0.7ee78d71@0", "0.323a7636@0", "0.a122cb1a@0", "0.99811941@0", "0.841fd605@0"};
-const char *f33[ENTS] = {"0.fd7a665@-1", "0.aeb77c1d8@0", "0.484aff39@0", "0.db51effb@0", "0.58be5eee8@0", "0.b72904ea@0", "0.37b2d896@0", "0.249ddde3@0", "0.55f952ea8@0", "0.36a48d1e@0"};
+char *f31[ENTS] = {"0.75d9aa2a@0", "0.275d1d8c@0", "0.a319012@0", "0.103940ee@0", "0.e16e268@-1", "0.fdcf1ae2@0", "0.6474ec6c@0", "0.42459634@0", "0.33023282@0", "0.83fac0a@-1"};
+char *f32[ENTS] = {"0.baecd515@0", "0.13ae8ec6@0", "0.518c809@0", "0.881ca077@0", "0.870b7134@0", "0.7ee78d71@0", "0.323a7636@0", "0.a122cb1a@0", "0.99811941@0", "0.841fd605@0"};
+char *f33[ENTS] = {"0.fd7a665@-1", "0.aeb77c1d8@0", "0.484aff39@0", "0.db51effb@0", "0.58be5eee8@0", "0.b72904ea@0", "0.37b2d896@0", "0.249ddde3@0", "0.55f952ea8@0", "0.36a48d1e@0"};
-const char *f63[ENTS] = {"0.914e9e6cff4f6b9@0", "0.7753d3b8364c60ec@0", "0.3c15909cecf1c1f6@0", "0.2282cb02e5167c6a@0", "0.6d56c20a47e1e3ee@0", "0.7ca81d1d2b81d696@0", "0.8735c2c0afb793a6@0", "0.e69f64c1b64872a@0", "0.fa7462fdff85137e@0", "0.3b00603f67a341a2@0"};
-const char *f64[ENTS] = {"0.48a74f367fa7b5c8@0", "0.bba9e9dc1b263076@0", "0.9e0ac84e7678e0fb@0", "0.11416581728b3e35@0", "0.b6ab610523f0f1f7@0", "0.be540e8e95c0eb4b@0", "0.439ae16057dbc9d3@0", "0.f34fb260db24395@0", "0.fd3a317effc289bf@0", "0.1d80301fb3d1a0d1@0"};
-const char *f65[ENTS] = {"0.ffbbb886c236a4f8@0", "0.d8a08b80eb84f708@0", "0.18ffd40d1045b57a@0", "0.22331c6a18e9e3408@0", "0.6fae2b4eadd545aa8@0", "0.cbeccf54df9472d@0", "0.c8d6f04f6eca67d7@0", "0.ca5677d36ef2f0c68@0", "0.d7e08b3e2b1396c9@0", "0.68494ca6d39790378@0"};
+char *f63[ENTS] = {"0.914e9e6cff4f6b9@0", "0.7753d3b8364c60ec@0", "0.3c15909cecf1c1f6@0", "0.2282cb02e5167c6a@0", "0.6d56c20a47e1e3ee@0", "0.7ca81d1d2b81d696@0", "0.8735c2c0afb793a6@0", "0.e69f64c1b64872a@0", "0.fa7462fdff85137e@0", "0.3b00603f67a341a2@0"};
+char *f64[ENTS] = {"0.48a74f367fa7b5c8@0", "0.bba9e9dc1b263076@0", "0.9e0ac84e7678e0fb@0", "0.11416581728b3e35@0", "0.b6ab610523f0f1f7@0", "0.be540e8e95c0eb4b@0", "0.439ae16057dbc9d3@0", "0.f34fb260db24395@0", "0.fd3a317effc289bf@0", "0.1d80301fb3d1a0d1@0"};
+char *f65[ENTS] = {"0.ffbbb886c236a4f8@0", "0.d8a08b80eb84f708@0", "0.18ffd40d1045b57a@0", "0.22331c6a18e9e3408@0", "0.6fae2b4eadd545aa8@0", "0.cbeccf54df9472d@0", "0.c8d6f04f6eca67d7@0", "0.ca5677d36ef2f0c68@0", "0.d7e08b3e2b1396c9@0", "0.68494ca6d39790378@0"};
-const char *f127[ENTS] = {"0.5ecd7526555eb140e3fb1e0e85533418@0", "0.e79f478cc99382ea6a0f94c1d8d7084a@0", "0.a7d40e994263bd8259ad171551c404f@0", "0.79eb5918686a65f14a7981d68eb03ee6@0", "0.a1823ab0d3c411543735462f7185a152@0", "0.16462c791250ec8e563de32c85d59c12@0", "0.913e9807a83f0ea1391ad9219cce9f2a@0", "0.5570e9192d54cec5d4326568993ae2c8@0", "0.13196ab23f80b5a635f7783acf721dba@0", "0.ef09177323fa17c6635b9e28aff78ce4@0"};
-const char *f128[ENTS] = {"0.af66ba932aaf58a071fd8f0742a99a0c@0", "0.73cfa3c664c9c1753507ca60ec6b8425@0", "0.53ea074ca131dec12cd68b8aa8e20278@0", "0.3cf5ac8c343532f8a53cc0eb47581f73@0", "0.50c11d5869e208aa1b9aa317b8c2d0a9@0", "0.8b23163c892876472b1ef19642eace09@0", "0.489f4c03d41f87509c8d6c90ce674f95@0", "0.aab8748c96aa6762ea1932b44c9d7164@0", "0.98cb5591fc05ad31afbbc1d67b90edd@-1", "0.f7848bb991fd0be331adcf1457fbc672@0"};
+char *f127[ENTS] = {"0.5ecd7526555eb140e3fb1e0e85533418@0", "0.e79f478cc99382ea6a0f94c1d8d7084a@0", "0.a7d40e994263bd8259ad171551c404f@0", "0.79eb5918686a65f14a7981d68eb03ee6@0", "0.a1823ab0d3c411543735462f7185a152@0", "0.16462c791250ec8e563de32c85d59c12@0", "0.913e9807a83f0ea1391ad9219cce9f2a@0", "0.5570e9192d54cec5d4326568993ae2c8@0", "0.13196ab23f80b5a635f7783acf721dba@0", "0.ef09177323fa17c6635b9e28aff78ce4@0"};
+char *f128[ENTS] = {"0.af66ba932aaf58a071fd8f0742a99a0c@0", "0.73cfa3c664c9c1753507ca60ec6b8425@0", "0.53ea074ca131dec12cd68b8aa8e20278@0", "0.3cf5ac8c343532f8a53cc0eb47581f73@0", "0.50c11d5869e208aa1b9aa317b8c2d0a9@0", "0.8b23163c892876472b1ef19642eace09@0", "0.489f4c03d41f87509c8d6c90ce674f95@0", "0.aab8748c96aa6762ea1932b44c9d7164@0", "0.98cb5591fc05ad31afbbc1d67b90edd@-1", "0.f7848bb991fd0be331adcf1457fbc672@0"};
struct rt
{
- const char **s;
+ char **s;
int nbits;
};
@@ -129,7 +129,13 @@ static struct rt farr[] =
int
+#if __STDC__
main (int argc, char *argv[])
+#else
+main (argc, argv)
+ int argc;
+ char *argv[];
+#endif
{
static char usage[] = "\
usage: t-rand [function nbits]\n\
@@ -142,7 +148,7 @@ usage: t-rand [function nbits]\n\
enum { Z, F } func = Z;
int nbits = 1;
int verify_mode_flag = 1;
- int i;
+ register int i;
struct rt *a;
diff --git a/gmp/tests/rand/t-urbui.c b/gmp/tests/rand/t-urbui.c
index bac8b6d5a0..0251f4c335 100644
--- a/gmp/tests/rand/t-urbui.c
+++ b/gmp/tests/rand/t-urbui.c
@@ -2,20 +2,20 @@
Copyright 2003, 2005 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <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 = (1UL << bits);
+ limit = (1L << bits);
for (i = 0; i < 5; i++)
{
diff --git a/gmp/tests/rand/t-urmui.c b/gmp/tests/rand/t-urmui.c
index c58d740f4e..798286bc8e 100644
--- a/gmp/tests/rand/t-urmui.c
+++ b/gmp/tests/rand/t-urmui.c
@@ -2,20 +2,20 @@
Copyright 2003, 2005 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/rand/t-urndmm.c b/gmp/tests/rand/t-urndmm.c
index d5a9217b40..11eeef261e 100644
--- a/gmp/tests/rand/t-urndmm.c
+++ b/gmp/tests/rand/t-urndmm.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include "gmp.h"
diff --git a/gmp/tests/rand/zdiv_round.c b/gmp/tests/rand/zdiv_round.c
index 3a91e3092c..362d19c11f 100644
--- a/gmp/tests/rand/zdiv_round.c
+++ b/gmp/tests/rand/zdiv_round.c
@@ -3,20 +3,20 @@
/*
Copyright 1999 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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"
diff --git a/gmp/tests/refmpf.c b/gmp/tests/refmpf.c
index 0ba9fbca3a..90ca598321 100644
--- a/gmp/tests/refmpf.c
+++ b/gmp/tests/refmpf.c
@@ -2,20 +2,20 @@
Copyright 1996, 2001, 2004, 2005 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -40,7 +40,7 @@ refmpf_add (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
if (SIZ (u) == 0)
{
size = ABSIZ (v);
- wt = TMP_ALLOC_LIMBS (size + 1);
+ wt = (mp_ptr) TMP_ALLOC ((size+1) * BYTES_PER_MP_LIMB);
MPN_COPY (wt, PTR (v), size);
exp = EXP (v);
neg = SIZ (v) < 0;
@@ -49,7 +49,7 @@ refmpf_add (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
if (SIZ (v) == 0)
{
size = ABSIZ (u);
- wt = TMP_ALLOC_LIMBS (size + 1);
+ wt = (mp_ptr) TMP_ALLOC ((size+1) * BYTES_PER_MP_LIMB);
MPN_COPY (wt, PTR (u), size);
exp = EXP (u);
neg = SIZ (u) < 0;
@@ -70,9 +70,9 @@ refmpf_add (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
hi = MAX (EXP (u), EXP (v));
lo = MIN (EXP (u) - ABSIZ (u), EXP (v) - ABSIZ (v));
size = hi - lo;
- ut = TMP_ALLOC_LIMBS (size + 1);
- vt = TMP_ALLOC_LIMBS (size + 1);
- wt = TMP_ALLOC_LIMBS (size + 1);
+ ut = (mp_ptr) TMP_ALLOC ((size + 1) * BYTES_PER_MP_LIMB);
+ vt = (mp_ptr) TMP_ALLOC ((size + 1) * BYTES_PER_MP_LIMB);
+ wt = (mp_ptr) TMP_ALLOC ((size + 1) * BYTES_PER_MP_LIMB);
MPN_ZERO (ut, size);
MPN_ZERO (vt, size);
{int off;
@@ -211,7 +211,7 @@ refmpf_sub (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
if (SIZ (u) == 0)
{
size = ABSIZ (v);
- wt = TMP_ALLOC_LIMBS (size + 1);
+ wt = (mp_ptr) TMP_ALLOC ((size+1) * BYTES_PER_MP_LIMB);
MPN_COPY (wt, PTR (v), size);
exp = EXP (v);
neg = SIZ (v) > 0;
@@ -220,7 +220,7 @@ refmpf_sub (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
if (SIZ (v) == 0)
{
size = ABSIZ (u);
- wt = TMP_ALLOC_LIMBS (size + 1);
+ wt = (mp_ptr) TMP_ALLOC ((size+1) * BYTES_PER_MP_LIMB);
MPN_COPY (wt, PTR (u), size);
exp = EXP (u);
neg = SIZ (u) < 0;
@@ -243,9 +243,9 @@ refmpf_sub (mpf_ptr w, mpf_srcptr u, mpf_srcptr v)
hi = MAX (EXP (u), EXP (v));
lo = MIN (EXP (u) - ABSIZ (u), EXP (v) - ABSIZ (v));
size = hi - lo;
- ut = TMP_ALLOC_LIMBS (size + 1);
- vt = TMP_ALLOC_LIMBS (size + 1);
- wt = TMP_ALLOC_LIMBS (size + 1);
+ ut = (mp_ptr) TMP_ALLOC ((size + 1) * BYTES_PER_MP_LIMB);
+ vt = (mp_ptr) TMP_ALLOC ((size + 1) * BYTES_PER_MP_LIMB);
+ wt = (mp_ptr) TMP_ALLOC ((size + 1) * BYTES_PER_MP_LIMB);
MPN_ZERO (ut, size);
MPN_ZERO (vt, size);
{int off;
diff --git a/gmp/tests/refmpn.c b/gmp/tests/refmpn.c
index bcb322f352..6af830b110 100644
--- a/gmp/tests/refmpn.c
+++ b/gmp/tests/refmpn.c
@@ -1,22 +1,23 @@
/* Reference mpn functions, designed to be simple, portable and independent
of the normal gmp code. Speed isn't a consideration.
-Copyright 1996-2009, 2011-2013 Free Software Foundation, Inc.
+Copyright 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003, 2004, 2005, 2006,
+2007, 2008 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Most routines have assertions representing what the mpn routines are
@@ -45,8 +46,8 @@ int
byte_overlap_p (const void *v_xp, mp_size_t xsize,
const void *v_yp, mp_size_t ysize)
{
- const char *xp = (const char *) v_xp;
- const char *yp = (const char *) v_yp;
+ const char *xp = v_xp;
+ const char *yp = v_yp;
ASSERT (xsize >= 0);
ASSERT (ysize >= 0);
@@ -68,8 +69,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 * GMP_LIMB_BYTES,
- yp, ysize * GMP_LIMB_BYTES);
+ return byte_overlap_p (xp, xsize * BYTES_PER_MP_LIMB,
+ yp, ysize * BYTES_PER_MP_LIMB);
}
/* Check overlap for a routine defined to work low to high. */
@@ -108,7 +109,7 @@ refmpn_malloc_limbs (mp_size_t size)
ASSERT (size >= 0);
if (size == 0)
size = 1;
- p = (mp_ptr) malloc ((size_t) (size * GMP_LIMB_BYTES));
+ p = (mp_ptr) malloc ((size_t) (size * BYTES_PER_MP_LIMB));
ASSERT (p != NULL);
return p;
}
@@ -183,7 +184,7 @@ refmpn_normalize (mp_srcptr ptr, mp_size_t size)
mp_limb_t
refmpn_msbone (mp_limb_t x)
{
- mp_limb_t n = (mp_limb_t) 1 << (GMP_LIMB_BITS-1);
+ mp_limb_t n = (mp_limb_t) 1 << (BITS_PER_MP_LIMB-1);
while (n != 0)
{
@@ -336,6 +337,20 @@ refmpn_copy_extend (mp_ptr wp, mp_size_t wsize, mp_srcptr xp, mp_size_t xsize)
refmpn_zero (wp, wsize-xsize);
}
+void
+refmpn_com_n (mp_ptr rp, mp_srcptr sp, mp_size_t size)
+{
+ mp_size_t i;
+
+ ASSERT (refmpn_overlap_fullonly_p (rp, sp, size));
+ ASSERT (size >= 1);
+ ASSERT_MPN (sp, size);
+
+ for (i = 0; i < size; i++)
+ rp[i] = sp[i] ^ GMP_NUMB_MASK;
+}
+
+
int
refmpn_cmp (mp_srcptr xp, mp_srcptr yp, mp_size_t size)
{
@@ -532,7 +547,7 @@ sbb (mp_limb_t *w, mp_limb_t x, mp_limb_t y, mp_limb_t c)
#define AORS_1(operation) \
{ \
- mp_size_t i; \
+ mp_limb_t i; \
\
ASSERT (refmpn_overlap_fullonly_p (rp, sp, size)); \
ASSERT (size >= 1); \
@@ -596,419 +611,39 @@ refmpn_sub_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
}
mp_limb_t
-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);
- else
- {
- refmpn_copyi (rp, s1p, size);
- return 0;
- }
-}
-mp_limb_t
-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);
- else
- {
- refmpn_copyi (rp, s1p, size);
- return 0;
- }
-}
-
-
-#define AORS_ERR1_N(operation) \
- { \
- mp_size_t i; \
- mp_limb_t carry2; \
- \
- ASSERT (refmpn_overlap_fullonly_p (rp, s1p, size)); \
- ASSERT (refmpn_overlap_fullonly_p (rp, s2p, size)); \
- ASSERT (! refmpn_overlap_p (rp, size, yp, size)); \
- ASSERT (! refmpn_overlap_p (ep, 2, s1p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 2, s2p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 2, yp, size)); \
- ASSERT (! refmpn_overlap_p (ep, 2, rp, size)); \
- \
- ASSERT (carry == 0 || carry == 1); \
- ASSERT (size >= 1); \
- ASSERT_MPN (s1p, size); \
- ASSERT_MPN (s2p, size); \
- ASSERT_MPN (yp, size); \
- \
- ep[0] = ep[1] = CNST_LIMB(0); \
- \
- for (i = 0; i < size; i++) \
- { \
- carry = operation (&rp[i], s1p[i], s2p[i], carry); \
- if (carry == 1) \
- { \
- carry2 = ref_addc_limb (&ep[0], ep[0], yp[size - 1 - i]); \
- carry2 = ref_addc_limb (&ep[1], ep[1], carry2); \
- ASSERT (carry2 == 0); \
- } \
- } \
- return carry; \
- }
-
-mp_limb_t
-refmpn_add_err1_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
- mp_ptr ep, mp_srcptr yp,
- mp_size_t size, mp_limb_t carry)
-{
- AORS_ERR1_N (adc);
-}
-mp_limb_t
-refmpn_sub_err1_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
- mp_ptr ep, mp_srcptr yp,
- mp_size_t size, mp_limb_t carry)
-{
- AORS_ERR1_N (sbb);
-}
-
-
-#define AORS_ERR2_N(operation) \
- { \
- mp_size_t i; \
- mp_limb_t carry2; \
- \
- ASSERT (refmpn_overlap_fullonly_p (rp, s1p, size)); \
- ASSERT (refmpn_overlap_fullonly_p (rp, s2p, size)); \
- ASSERT (! refmpn_overlap_p (rp, size, y1p, size)); \
- ASSERT (! refmpn_overlap_p (rp, size, y2p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 4, s1p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 4, s2p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 4, y1p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 4, y2p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 4, rp, size)); \
- \
- ASSERT (carry == 0 || carry == 1); \
- ASSERT (size >= 1); \
- ASSERT_MPN (s1p, size); \
- ASSERT_MPN (s2p, size); \
- ASSERT_MPN (y1p, size); \
- ASSERT_MPN (y2p, size); \
- \
- ep[0] = ep[1] = CNST_LIMB(0); \
- ep[2] = ep[3] = CNST_LIMB(0); \
- \
- for (i = 0; i < size; i++) \
- { \
- carry = operation (&rp[i], s1p[i], s2p[i], carry); \
- if (carry == 1) \
- { \
- carry2 = ref_addc_limb (&ep[0], ep[0], y1p[size - 1 - i]); \
- carry2 = ref_addc_limb (&ep[1], ep[1], carry2); \
- ASSERT (carry2 == 0); \
- carry2 = ref_addc_limb (&ep[2], ep[2], y2p[size - 1 - i]); \
- carry2 = ref_addc_limb (&ep[3], ep[3], carry2); \
- ASSERT (carry2 == 0); \
- } \
- } \
- return carry; \
- }
-
-mp_limb_t
-refmpn_add_err2_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
- mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p,
- mp_size_t size, mp_limb_t carry)
-{
- AORS_ERR2_N (adc);
-}
-mp_limb_t
-refmpn_sub_err2_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
- mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p,
- mp_size_t size, mp_limb_t carry)
-{
- AORS_ERR2_N (sbb);
-}
-
-
-#define AORS_ERR3_N(operation) \
- { \
- mp_size_t i; \
- mp_limb_t carry2; \
- \
- ASSERT (refmpn_overlap_fullonly_p (rp, s1p, size)); \
- ASSERT (refmpn_overlap_fullonly_p (rp, s2p, size)); \
- ASSERT (! refmpn_overlap_p (rp, size, y1p, size)); \
- ASSERT (! refmpn_overlap_p (rp, size, y2p, size)); \
- ASSERT (! refmpn_overlap_p (rp, size, y3p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 6, s1p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 6, s2p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 6, y1p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 6, y2p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 6, y3p, size)); \
- ASSERT (! refmpn_overlap_p (ep, 6, rp, size)); \
- \
- ASSERT (carry == 0 || carry == 1); \
- ASSERT (size >= 1); \
- ASSERT_MPN (s1p, size); \
- ASSERT_MPN (s2p, size); \
- ASSERT_MPN (y1p, size); \
- ASSERT_MPN (y2p, size); \
- ASSERT_MPN (y3p, size); \
- \
- ep[0] = ep[1] = CNST_LIMB(0); \
- ep[2] = ep[3] = CNST_LIMB(0); \
- ep[4] = ep[5] = CNST_LIMB(0); \
- \
- for (i = 0; i < size; i++) \
- { \
- carry = operation (&rp[i], s1p[i], s2p[i], carry); \
- if (carry == 1) \
- { \
- carry2 = ref_addc_limb (&ep[0], ep[0], y1p[size - 1 - i]); \
- carry2 = ref_addc_limb (&ep[1], ep[1], carry2); \
- ASSERT (carry2 == 0); \
- carry2 = ref_addc_limb (&ep[2], ep[2], y2p[size - 1 - i]); \
- carry2 = ref_addc_limb (&ep[3], ep[3], carry2); \
- ASSERT (carry2 == 0); \
- carry2 = ref_addc_limb (&ep[4], ep[4], y3p[size - 1 - i]); \
- carry2 = ref_addc_limb (&ep[5], ep[5], carry2); \
- ASSERT (carry2 == 0); \
- } \
- } \
- return carry; \
- }
-
-mp_limb_t
-refmpn_add_err3_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
- mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p, mp_srcptr y3p,
- mp_size_t size, mp_limb_t carry)
-{
- AORS_ERR3_N (adc);
-}
-mp_limb_t
-refmpn_sub_err3_n (mp_ptr rp, mp_srcptr s1p, mp_srcptr s2p,
- mp_ptr ep, mp_srcptr y1p, mp_srcptr y2p, mp_srcptr y3p,
- mp_size_t size, mp_limb_t carry)
-{
- AORS_ERR3_N (sbb);
-}
-
-
-mp_limb_t
-refmpn_addlsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_size_t n, unsigned int s)
-{
- mp_limb_t cy;
- mp_ptr tp;
-
- ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
- ASSERT (n >= 1);
- ASSERT (0 < s && s < GMP_NUMB_BITS);
- ASSERT_MPN (up, n);
- ASSERT_MPN (vp, n);
-
- tp = refmpn_malloc_limbs (n);
- cy = refmpn_lshift (tp, vp, n, s);
- cy += refmpn_add_n (rp, up, tp, n);
- free (tp);
- return cy;
-}
-mp_limb_t
refmpn_addlsh1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
{
- return refmpn_addlsh_n (rp, up, vp, n, 1);
-}
-mp_limb_t
-refmpn_addlsh2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_addlsh_n (rp, up, vp, n, 2);
-}
-mp_limb_t
-refmpn_addlsh_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
-{
- return refmpn_addlsh_n (rp, rp, vp, n, s);
-}
-mp_limb_t
-refmpn_addlsh1_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_addlsh_n (rp, rp, vp, n, 1);
-}
-mp_limb_t
-refmpn_addlsh2_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_addlsh_n (rp, rp, vp, n, 2);
-}
-mp_limb_t
-refmpn_addlsh_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
-{
- return refmpn_addlsh_n (rp, vp, rp, n, s);
-}
-mp_limb_t
-refmpn_addlsh1_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_addlsh_n (rp, vp, rp, n, 1);
-}
-mp_limb_t
-refmpn_addlsh2_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_addlsh_n (rp, vp, rp, n, 2);
-}
-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_limb_t cy;
-
- ASSERT (carry <= (CNST_LIMB(1) << s));
-
- cy = refmpn_addlsh_n (rp, up, vp, n, s);
- cy += refmpn_add_1 (rp, rp, n, carry);
- return cy;
-}
-mp_limb_t
-refmpn_addlsh1_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
-{
- return refmpn_addlsh_nc (rp, up, vp, n, 1, carry);
-}
-mp_limb_t
-refmpn_addlsh2_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
-{
- return refmpn_addlsh_nc (rp, up, vp, n, 2, carry);
-}
-
-mp_limb_t
-refmpn_sublsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_size_t n, unsigned int s)
-{
mp_limb_t cy;
mp_ptr tp;
ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
ASSERT (n >= 1);
- ASSERT (0 < s && s < GMP_NUMB_BITS);
ASSERT_MPN (up, n);
ASSERT_MPN (vp, n);
tp = refmpn_malloc_limbs (n);
- cy = mpn_lshift (tp, vp, n, s);
- cy += mpn_sub_n (rp, up, tp, n);
+ cy = refmpn_lshift (tp, vp, n, 1);
+ cy += refmpn_add_n (rp, up, tp, n);
free (tp);
return cy;
}
mp_limb_t
refmpn_sublsh1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
{
- return refmpn_sublsh_n (rp, up, vp, n, 1);
-}
-mp_limb_t
-refmpn_sublsh2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_sublsh_n (rp, up, vp, n, 2);
-}
-mp_limb_t
-refmpn_sublsh_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
-{
- return refmpn_sublsh_n (rp, rp, vp, n, s);
-}
-mp_limb_t
-refmpn_sublsh1_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_sublsh_n (rp, rp, vp, n, 1);
-}
-mp_limb_t
-refmpn_sublsh2_n_ip1 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_sublsh_n (rp, rp, vp, n, 2);
-}
-mp_limb_t
-refmpn_sublsh_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n, unsigned int s)
-{
- return refmpn_sublsh_n (rp, vp, rp, n, s);
-}
-mp_limb_t
-refmpn_sublsh1_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_sublsh_n (rp, vp, rp, n, 1);
-}
-mp_limb_t
-refmpn_sublsh2_n_ip2 (mp_ptr rp, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_sublsh_n (rp, vp, rp, n, 2);
-}
-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_limb_t cy;
-
- ASSERT (carry <= (CNST_LIMB(1) << s));
-
- cy = refmpn_sublsh_n (rp, up, vp, n, s);
- cy += refmpn_sub_1 (rp, rp, n, carry);
- return cy;
-}
-mp_limb_t
-refmpn_sublsh1_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
-{
- return refmpn_sublsh_nc (rp, up, vp, n, 1, carry);
-}
-mp_limb_t
-refmpn_sublsh2_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_t carry)
-{
- return refmpn_sublsh_nc (rp, up, vp, n, 2, carry);
-}
-
-mp_limb_signed_t
-refmpn_rsblsh_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp,
- mp_size_t n, unsigned int s)
-{
- mp_limb_signed_t cy;
mp_ptr tp;
ASSERT (refmpn_overlap_fullonly_two_p (rp, up, vp, n));
ASSERT (n >= 1);
- ASSERT (0 < s && s < GMP_NUMB_BITS);
ASSERT_MPN (up, n);
ASSERT_MPN (vp, n);
tp = refmpn_malloc_limbs (n);
- cy = mpn_lshift (tp, vp, n, s);
- cy -= mpn_sub_n (rp, tp, up, n);
+ cy = mpn_lshift (tp, vp, n, 1);
+ cy += mpn_sub_n (rp, up, tp, n);
free (tp);
return cy;
}
-mp_limb_signed_t
-refmpn_rsblsh1_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_rsblsh_n (rp, up, vp, n, 1);
-}
-mp_limb_signed_t
-refmpn_rsblsh2_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
-{
- return refmpn_rsblsh_n (rp, up, vp, n, 2);
-}
-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_limb_signed_t cy;
-
- ASSERT (carry == -1 || (carry >> s) == 0);
-
- cy = refmpn_rsblsh_n (rp, up, vp, n, s);
- if (carry > 0)
- cy += refmpn_add_1 (rp, rp, n, carry);
- else
- cy -= refmpn_sub_1 (rp, rp, n, -carry);
- return cy;
-}
-mp_limb_signed_t
-refmpn_rsblsh1_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_signed_t carry)
-{
- return refmpn_rsblsh_nc (rp, up, vp, n, 1, carry);
-}
-mp_limb_signed_t
-refmpn_rsblsh2_nc (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n, mp_limb_signed_t carry)
-{
- return refmpn_rsblsh_nc (rp, up, vp, n, 2, carry);
-}
-
mp_limb_t
refmpn_rsh1add_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
{
@@ -1042,7 +677,7 @@ refmpn_rsh1sub_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
/* Twos complement, return borrow. */
mp_limb_t
-refmpn_neg (mp_ptr dst, mp_srcptr src, mp_size_t size)
+refmpn_neg_n (mp_ptr dst, mp_srcptr src, mp_size_t size)
{
mp_ptr zeros;
mp_limb_t ret;
@@ -1083,10 +718,10 @@ refmpn_sub (mp_ptr rp,
}
-#define SHIFTHIGH(x) ((x) << GMP_LIMB_BITS/2)
-#define SHIFTLOW(x) ((x) >> GMP_LIMB_BITS/2)
+#define SHIFTHIGH(x) ((x) << BITS_PER_MP_LIMB/2)
+#define SHIFTLOW(x) ((x) >> BITS_PER_MP_LIMB/2)
-#define LOWMASK (((mp_limb_t) 1 << GMP_LIMB_BITS/2)-1)
+#define LOWMASK (((mp_limb_t) 1 << BITS_PER_MP_LIMB/2)-1)
#define HIGHMASK SHIFTHIGH(LOWMASK)
#define LOWPART(x) ((x) & LOWMASK)
@@ -1196,16 +831,6 @@ refmpn_mul_4 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
{
return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 4);
}
-mp_limb_t
-refmpn_mul_5 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
-{
- return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 5);
-}
-mp_limb_t
-refmpn_mul_6 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
-{
- return refmpn_mul_N (rp, sp, size, mult, (mp_size_t) 6);
-}
#define AORSMUL_1C(operation_n) \
{ \
@@ -1311,7 +936,7 @@ refmpn_addmul_8 (mp_ptr rp, mp_srcptr sp, mp_size_t size, mp_srcptr mult)
}
mp_limb_t
-refmpn_add_n_sub_nc (mp_ptr r1p, mp_ptr r2p,
+refmpn_addsub_nc (mp_ptr r1p, mp_ptr r2p,
mp_srcptr s1p, mp_srcptr s2p, mp_size_t size,
mp_limb_t carry)
{
@@ -1336,15 +961,15 @@ refmpn_add_n_sub_nc (mp_ptr r1p, mp_ptr r2p,
}
mp_limb_t
-refmpn_add_n_sub_n (mp_ptr r1p, mp_ptr r2p,
+refmpn_addsub_n (mp_ptr r1p, mp_ptr r2p,
mp_srcptr s1p, mp_srcptr s2p, mp_size_t size)
{
- return refmpn_add_n_sub_nc (r1p, r2p, s1p, s2p, size, CNST_LIMB(0));
+ return refmpn_addsub_nc (r1p, r2p, s1p, s2p, size, CNST_LIMB(0));
}
/* Right shift hi,lo and return the low limb of the result.
- Note a shift by GMP_LIMB_BITS isn't assumed to work (doesn't on x86). */
+ Note a shift by BITS_PER_MP_LIMB isn't assumed to work (doesn't on x86). */
mp_limb_t
rshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift)
{
@@ -1356,7 +981,7 @@ rshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift)
}
/* Left shift hi,lo and return the high limb of the result.
- Note a shift by GMP_LIMB_BITS isn't assumed to work (doesn't on x86). */
+ Note a shift by BITS_PER_MP_LIMB isn't assumed to work (doesn't on x86). */
mp_limb_t
lshift_make (mp_limb_t hi, mp_limb_t lo, unsigned shift)
{
@@ -1408,29 +1033,6 @@ refmpn_lshift (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned shift)
return ret;
}
-void
-refmpn_com (mp_ptr rp, mp_srcptr sp, mp_size_t size)
-{
- mp_size_t i;
-
- /* We work downwards since mpn_lshiftc needs that. */
- ASSERT (refmpn_overlap_high_to_low_p (rp, sp, size));
-
- for (i = size - 1; i >= 0; i--)
- rp[i] = (~sp[i]) & GMP_NUMB_MASK;
-}
-
-mp_limb_t
-refmpn_lshiftc (mp_ptr rp, mp_srcptr sp, mp_size_t size, unsigned shift)
-{
- mp_limb_t res;
-
- /* No asserts here, refmpn_lshift will assert what we need. */
-
- res = refmpn_lshift (rp, sp, size, shift);
- refmpn_com (rp, rp, size);
- return res;
-}
/* accepting shift==0 and doing a plain copyi or copyd in that case */
mp_limb_t
@@ -1662,14 +1264,14 @@ refmpn_divrem_2 (mp_ptr qp, mp_size_t qxn,
tp = refmpn_malloc_limbs (nn + qxn);
refmpn_zero (tp, qxn);
refmpn_copyi (tp + qxn, np, nn);
- qh = refmpn_sb_div_qr (qp, tp, nn + qxn, dp, 2);
+ qh = refmpn_sb_divrem_mn (qp, tp, nn + qxn, dp, 2);
refmpn_copyi (np, tp, 2);
free (tp);
return qh;
}
/* Inverse is floor((b*(b-d)-1) / d), per division by invariant integers
- paper, figure 8.1 m', where b=2^GMP_LIMB_BITS. Note that -d-1 < d
+ paper, figure 8.1 m', where b=2^BITS_PER_MP_LIMB. Note that -d-1 < d
since d has the high bit set. */
mp_limb_t
@@ -1680,48 +1282,6 @@ refmpn_invert_limb (mp_limb_t d)
return refmpn_udiv_qrnnd (&r, -d-1, MP_LIMB_T_MAX, d);
}
-void
-refmpn_invert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
-{
- mp_ptr qp, tp;
- TMP_DECL;
- TMP_MARK;
-
- tp = TMP_ALLOC_LIMBS (2 * n);
- qp = TMP_ALLOC_LIMBS (n + 1);
-
- MPN_ZERO (tp, 2 * n); mpn_sub_1 (tp, tp, 2 * n, 1);
-
- refmpn_tdiv_qr (qp, rp, 0, tp, 2 * n, up, n);
- refmpn_copyi (rp, qp, n);
-
- TMP_FREE;
-}
-
-void
-refmpn_binvert (mp_ptr rp, mp_srcptr up, mp_size_t n, mp_ptr scratch)
-{
- mp_ptr tp;
- mp_limb_t binv;
- TMP_DECL;
- TMP_MARK;
-
- /* We use the library mpn_sbpi1_bdiv_q here, which isn't kosher in testing
- code. To make up for it, we check that the inverse is correct using a
- multiply. */
-
- tp = TMP_ALLOC_LIMBS (2 * n);
-
- MPN_ZERO (tp, n);
- tp[0] = 1;
- binvert_limb (binv, up[0]);
- mpn_sbpi1_bdiv_q (rp, tp, n, up, n, -binv);
-
- refmpn_mul_n (tp, rp, up, n);
- ASSERT_ALWAYS (tp[0] == 1 && mpn_zero_p (tp + 1, n - 1));
-
- TMP_FREE;
-}
/* The aim is to produce a dst quotient and return a remainder c, satisfying
c*b^n + src-i == 3*dst, where i is the incoming carry.
@@ -1797,151 +1357,16 @@ refmpn_mul_basecase (mp_ptr prodp,
prodp[usize+i] = refmpn_addmul_1 (prodp+i, up, usize, vp[i]);
}
-
-/* The same as mpn/generic/mulmid_basecase.c, but using refmpn functions. */
-void
-refmpn_mulmid_basecase (mp_ptr rp,
- mp_srcptr up, mp_size_t un,
- mp_srcptr vp, mp_size_t vn)
-{
- mp_limb_t cy;
- mp_size_t i;
-
- ASSERT (un >= vn);
- ASSERT (vn >= 1);
- ASSERT (! refmpn_overlap_p (rp, un - vn + 3, up, un));
- ASSERT (! refmpn_overlap_p (rp, un - vn + 3, vp, vn));
- ASSERT_MPN (up, un);
- ASSERT_MPN (vp, vn);
-
- rp[un - vn + 1] = refmpn_mul_1 (rp, up + vn - 1, un - vn + 1, vp[0]);
- rp[un - vn + 2] = CNST_LIMB (0);
- for (i = 1; i < vn; i++)
- {
- cy = refmpn_addmul_1 (rp, up + vn - i - 1, un - vn + 1, vp[i]);
- cy = ref_addc_limb (&rp[un - vn + 1], rp[un - vn + 1], cy);
- cy = ref_addc_limb (&rp[un - vn + 2], rp[un - vn + 2], cy);
- ASSERT (cy == 0);
- }
-}
-
-void
-refmpn_toom42_mulmid (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n,
- mp_ptr scratch)
-{
- refmpn_mulmid_basecase (rp, up, 2*n - 1, vp, n);
-}
-
-void
-refmpn_mulmid_n (mp_ptr rp, mp_srcptr up, mp_srcptr vp, mp_size_t n)
-{
- /* FIXME: this could be made faster by using refmpn_mul and then subtracting
- off products near the middle product region boundary */
- refmpn_mulmid_basecase (rp, up, 2*n - 1, vp, n);
-}
-
-void
-refmpn_mulmid (mp_ptr rp, mp_srcptr up, mp_size_t un,
- mp_srcptr vp, mp_size_t vn)
-{
- /* FIXME: this could be made faster by using refmpn_mul and then subtracting
- off products near the middle product region boundary */
- refmpn_mulmid_basecase (rp, up, un, vp, vn);
-}
-
-
-
-#define TOOM3_THRESHOLD (MAX (MUL_TOOM33_THRESHOLD, SQR_TOOM3_THRESHOLD))
-#define TOOM4_THRESHOLD (MAX (MUL_TOOM44_THRESHOLD, SQR_TOOM4_THRESHOLD))
-#define TOOM6_THRESHOLD (MAX (MUL_TOOM6H_THRESHOLD, SQR_TOOM6_THRESHOLD))
-#if WANT_FFT
-#define FFT_THRESHOLD (MAX (MUL_FFT_THRESHOLD, SQR_FFT_THRESHOLD))
-#else
-#define FFT_THRESHOLD MP_SIZE_T_MAX /* don't use toom44 here */
-#endif
-
-void
-refmpn_mul (mp_ptr wp, mp_srcptr up, mp_size_t un, mp_srcptr vp, mp_size_t vn)
-{
- mp_ptr tp;
- mp_size_t tn;
-
- if (vn < TOOM3_THRESHOLD)
- {
- /* In the mpn_mul_basecase and toom2 range, use our own mul_basecase. */
- if (vn != 0)
- refmpn_mul_basecase (wp, up, un, vp, vn);
- else
- MPN_ZERO (wp, un);
- return;
- }
-
- if (vn < TOOM4_THRESHOLD)
- {
- /* In the toom3 range, use mpn_toom22_mul. */
- tn = 2 * vn + mpn_toom22_mul_itch (vn, vn);
- tp = refmpn_malloc_limbs (tn);
- mpn_toom22_mul (tp, up, vn, vp, vn, tp + 2 * vn);
- }
- else if (vn < TOOM6_THRESHOLD)
- {
- /* In the toom4 range, use mpn_toom33_mul. */
- tn = 2 * vn + mpn_toom33_mul_itch (vn, vn);
- tp = refmpn_malloc_limbs (tn);
- mpn_toom33_mul (tp, up, vn, vp, vn, tp + 2 * vn);
- }
- else if (vn < FFT_THRESHOLD)
- {
- /* In the toom6 range, use mpn_toom44_mul. */
- tn = 2 * vn + mpn_toom44_mul_itch (vn, vn);
- tp = refmpn_malloc_limbs (tn);
- mpn_toom44_mul (tp, up, vn, vp, vn, tp + 2 * vn);
- }
- else
- {
- /* Finally, for the largest operands, use mpn_toom6h_mul. */
- tn = 2 * vn + mpn_toom6h_mul_itch (vn, vn);
- tp = refmpn_malloc_limbs (tn);
- mpn_toom6h_mul (tp, up, vn, vp, vn, tp + 2 * vn);
- }
-
- if (un != vn)
- {
- if (un - vn < vn)
- refmpn_mul (wp + vn, vp, vn, up + vn, un - vn);
- else
- refmpn_mul (wp + vn, up + vn, un - vn, vp, vn);
-
- MPN_COPY (wp, tp, vn);
- ASSERT_NOCARRY (refmpn_add (wp + vn, wp + vn, un, tp + vn, vn));
- }
- else
- {
- MPN_COPY (wp, tp, 2 * vn);
- }
-
- free (tp);
-}
-
void
refmpn_mul_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
{
- refmpn_mul (prodp, up, size, vp, size);
-}
-
-void
-refmpn_mullo_n (mp_ptr prodp, mp_srcptr up, mp_srcptr vp, mp_size_t size)
-{
- mp_ptr tp = refmpn_malloc_limbs (2*size);
- refmpn_mul (tp, up, size, vp, size);
- refmpn_copyi (prodp, tp, size);
- free (tp);
+ refmpn_mul_basecase (prodp, up, size, vp, size);
}
void
refmpn_sqr (mp_ptr dst, mp_srcptr src, mp_size_t size)
{
- refmpn_mul (dst, src, size, src, size);
+ refmpn_mul_basecase (dst, src, size, src, size);
}
/* Allowing usize<vsize, usize==0 or vsize==0. */
@@ -1970,9 +1395,9 @@ refmpn_mul_any (mp_ptr prodp,
}
if (usize >= vsize)
- refmpn_mul (prodp, up, usize, vp, vsize);
+ refmpn_mul_basecase (prodp, up, usize, vp, vsize);
else
- refmpn_mul (prodp, vp, vsize, up, usize);
+ refmpn_mul_basecase (prodp, vp, vsize, up, usize);
}
@@ -2204,12 +1629,12 @@ refmpn_mod2 (mp_limb_t r[2], const mp_limb_t a[2], const mp_limb_t d[2])
-/* Similar to the old mpn/generic/sb_divrem_mn.c, but somewhat simplified, in
+/* Similar to mpn/generic/sb_divrem_mn.c, but somewhat simplified, in
particular the trial quotient is allowed to be 2 too big. */
mp_limb_t
-refmpn_sb_div_qr (mp_ptr qp,
- mp_ptr np, mp_size_t nsize,
- mp_srcptr dp, mp_size_t dsize)
+refmpn_sb_divrem_mn (mp_ptr qp,
+ mp_ptr np, mp_size_t nsize,
+ mp_srcptr dp, mp_size_t dsize)
{
mp_limb_t retval = 0;
mp_size_t i;
@@ -2282,7 +1707,7 @@ refmpn_sb_div_qr (mp_ptr qp,
return retval;
}
-/* Similar to the old mpn/generic/sb_divrem_mn.c, but somewhat simplified, in
+/* Similar to mpn/generic/sb_divrem_mn.c, but somewhat simplified, in
particular the trial quotient is allowed to be 2 too big. */
void
refmpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
@@ -2309,7 +1734,7 @@ refmpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
n2p[nsize] = refmpn_lshift_or_copy (n2p, np, nsize, norm);
ASSERT_NOCARRY (refmpn_lshift_or_copy (d2p, dp, dsize, norm));
- refmpn_sb_div_qr (qp, n2p, nsize+1, d2p, dsize);
+ refmpn_sb_divrem_mn (qp, n2p, nsize+1, d2p, dsize);
refmpn_rshift_or_copy (rp, n2p, dsize, norm);
/* ASSERT (refmpn_zero_p (tp+dsize, nsize-dsize)); */
@@ -2318,7 +1743,7 @@ refmpn_tdiv_qr (mp_ptr qp, mp_ptr rp, mp_size_t qxn,
}
}
-mp_limb_t
+void
refmpn_redc_1 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm)
{
mp_size_t j;
@@ -2331,11 +1756,12 @@ refmpn_redc_1 (mp_ptr rp, mp_ptr up, mp_srcptr mp, mp_size_t n, mp_limb_t invm)
for (j = n - 1; j >= 0; j--)
{
- up[0] = refmpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK);
+ up[0] = mpn_addmul_1 (up, mp, n, (up[0] * invm) & GMP_NUMB_MASK);
up++;
}
cy = mpn_add_n (rp, up, up - n, n);
- return cy;
+ if (cy != 0)
+ mpn_sub_n (rp, rp, mp, n);
}
size_t
@@ -2346,13 +1772,13 @@ refmpn_get_str (unsigned char *dst, int base, mp_ptr src, mp_size_t size)
ASSERT (size >= 0);
ASSERT (base >= 2);
- ASSERT (base < numberof (mp_bases));
+ ASSERT (base < numberof (__mp_bases));
ASSERT (size == 0 || src[size-1] != 0);
ASSERT_MPN (src, size);
MPN_SIZEINBASE (dsize, src, size, base);
ASSERT (dsize >= 1);
- ASSERT (! byte_overlap_p (dst, (mp_size_t) dsize, src, size * GMP_LIMB_BYTES));
+ ASSERT (! byte_overlap_p (dst, (mp_size_t) dsize, src, size * BYTES_PER_MP_LIMB));
if (size == 0)
{
@@ -2398,7 +1824,7 @@ ref_bswap_limb (mp_limb_t src)
int i;
dst = 0;
- for (i = 0; i < GMP_LIMB_BYTES; i++)
+ for (i = 0; i < BYTES_PER_MP_LIMB; i++)
{
dst = (dst << 8) + (src & 0xFF);
src >>= 8;
@@ -2412,10 +1838,10 @@ ref_bswap_limb (mp_limb_t src)
can probably be removed when those normal routines are reliable, though
perhaps something independent would still be useful at times. */
-#if GMP_LIMB_BITS == 32
+#if BITS_PER_MP_LIMB == 32
#define RAND_A CNST_LIMB(0x29CF535)
#endif
-#if GMP_LIMB_BITS == 64
+#if BITS_PER_MP_LIMB == 64
#define RAND_A CNST_LIMB(0xBAECD515DAF0B49D)
#endif
@@ -2425,13 +1851,13 @@ mp_limb_t
refmpn_random_half (void)
{
refmpn_random_seed = refmpn_random_seed * RAND_A + 1;
- return (refmpn_random_seed >> GMP_LIMB_BITS/2);
+ return (refmpn_random_seed >> BITS_PER_MP_LIMB/2);
}
mp_limb_t
refmpn_random_limb (void)
{
- return ((refmpn_random_half () << (GMP_LIMB_BITS/2))
+ return ((refmpn_random_half () << (BITS_PER_MP_LIMB/2))
| refmpn_random_half ()) & GMP_NUMB_MASK;
}
diff --git a/gmp/tests/refmpq.c b/gmp/tests/refmpq.c
index 6ca51c4bc5..460a4801d7 100644
--- a/gmp/tests/refmpq.c
+++ b/gmp/tests/refmpq.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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"
diff --git a/gmp/tests/refmpz.c b/gmp/tests/refmpz.c
index 2aef7aaa87..b21b5b9fe1 100644
--- a/gmp/tests/refmpz.c
+++ b/gmp/tests/refmpz.c
@@ -1,21 +1,21 @@
/* Reference mpz functions.
-Copyright 1997, 1999-2002 Free Software Foundation, Inc.
+Copyright 1997, 1999, 2000, 2001, 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* always do assertion checking */
#define WANT_ASSERT 1
@@ -67,10 +67,10 @@ refmpz_hamdist (mpz_srcptr x, mpz_srcptr y)
refmpn_copy (yp, PTR(y), ysize);
if (SIZ(x) < 0)
- refmpn_neg (xp, xp, tsize);
+ refmpn_neg_n (xp, xp, tsize);
if (SIZ(x) < 0)
- refmpn_neg (yp, yp, tsize);
+ refmpn_neg_n (yp, yp, tsize);
ret = refmpn_hamdist (xp, yp, tsize);
@@ -184,46 +184,17 @@ refmpz_kronecker (mpz_srcptr a_orig, mpz_srcptr b_orig)
int
refmpz_jacobi (mpz_srcptr a, mpz_srcptr b)
{
- ASSERT_ALWAYS (mpz_sgn (b) > 0);
- ASSERT_ALWAYS (mpz_odd_p (b));
-
- return refmpz_kronecker (a, b);
+ mpz_t b_odd;
+ mpz_init_set (b_odd, b);
+ if (mpz_sgn (b_odd) != 0)
+ mpz_fdiv_q_2exp (b_odd, b_odd, mpz_scan1 (b_odd, 0L));
+ return refmpz_kronecker (a, b_odd);
}
-/* Legendre symbol via powm. p must be an odd prime. */
int
-refmpz_legendre (mpz_srcptr a, mpz_srcptr p)
+refmpz_legendre (mpz_srcptr a, mpz_srcptr b)
{
- int res;
-
- mpz_t r;
- mpz_t e;
-
- ASSERT_ALWAYS (mpz_sgn (p) > 0);
- ASSERT_ALWAYS (mpz_odd_p (p));
-
- mpz_init (r);
- mpz_init (e);
-
- mpz_fdiv_r (r, a, p);
-
- mpz_set (e, p);
- mpz_sub_ui (e, e, 1);
- mpz_fdiv_q_2exp (e, e, 1);
- mpz_powm (r, r, e, p);
-
- /* Normalize to a more or less symmetric range around zero */
- if (mpz_cmp (r, e) > 0)
- mpz_sub (r, r, p);
-
- ASSERT_ALWAYS (mpz_cmpabs_ui (r, 1) <= 0);
-
- res = mpz_sgn (r);
-
- mpz_clear (r);
- mpz_clear (e);
-
- return res;
+ return refmpz_jacobi (a, b);
}
diff --git a/gmp/tests/spinner.c b/gmp/tests/spinner.c
index 3435d20923..343ecb5503 100644
--- a/gmp/tests/spinner.c
+++ b/gmp/tests/spinner.c
@@ -1,22 +1,22 @@
/* A stupid little spinning wheel designed to make it look like useful work
is being done.
-Copyright 1999-2001 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 "config.h"
@@ -94,7 +94,7 @@ spinner_init (void)
}
alarm (1);
- /* unbuffered output so the spinner will show up */
+ /* unbufferred output so the spinner will show up */
setbuf (stdout, NULL);
}
diff --git a/gmp/tests/t-bswap.c b/gmp/tests/t-bswap.c
index 2543f9fc32..814ddfc577 100644
--- a/gmp/tests/t-bswap.c
+++ b/gmp/tests/t-bswap.c
@@ -2,20 +2,20 @@
Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/t-constants.c b/gmp/tests/t-constants.c
index 8583ccd4d6..ef63c09c99 100644
--- a/gmp/tests/t-constants.c
+++ b/gmp/tests/t-constants.c
@@ -1,21 +1,21 @@
/* Check the values of some constants.
-Copyright 2000-2003, 2014 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -24,36 +24,36 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#ifdef ULONG_MAX
-const char *ulong_max_def = "defined";
+char *ulong_max_def = "defined";
#else
-const char *ulong_max_def = "not defined";
+char *ulong_max_def = "not defined";
#endif
#ifdef LONG_MAX
-const char *long_max_def = "defined";
+char *long_max_def = "defined";
#else
-const char *long_max_def = "not defined";
+char *long_max_def = "not defined";
#endif
#ifdef UINT_MAX
-const char *uint_max_def = "defined";
+char *uint_max_def = "defined";
#else
-const char *uint_max_def = "not defined";
+char *uint_max_def = "not defined";
#endif
#ifdef INT_MAX
-const char *int_max_def = "defined";
+char *int_max_def = "defined";
#else
-const char *int_max_def = "not defined";
+char *int_max_def = "not defined";
#endif
#ifdef USHRT_MAX
-const char *ushrt_max_def = "defined";
+char *ushrt_max_def = "defined";
#else
-const char *ushrt_max_def = "not defined";
+char *ushrt_max_def = "not defined";
#endif
#ifdef SHRT_MAX
-const char *shrt_max_def = "defined";
+char *shrt_max_def = "defined";
#else
-const char *shrt_max_def = "not defined";
+char *shrt_max_def = "not defined";
#endif
#include "gmp-impl.h"
@@ -208,18 +208,19 @@ main (int argc, char *argv[])
{
int error = 0;
- CHECK_INT (GMP_LIMB_BYTES, (int) sizeof(mp_limb_t));
- CHECK_INT (mp_bits_per_limb, GMP_LIMB_BITS);
+ CHECK_INT (BYTES_PER_MP_LIMB, (int) sizeof(mp_limb_t));
+ CHECK_INT (mp_bits_per_limb, BITS_PER_MP_LIMB);
+ CHECK_INT (__GMP_BITS_PER_MP_LIMB, BITS_PER_MP_LIMB);
- CHECK_BITS (GMP_LIMB_BITS, mp_limb_t);
+ CHECK_BITS (BITS_PER_MP_LIMB, mp_limb_t);
CHECK_BITS (BITS_PER_ULONG, unsigned long);
CHECK_HIGHBIT (GMP_LIMB_HIGHBIT, mp_limb_t, LL("0x%lX","0x%llX"));
CHECK_HIGHBIT (ULONG_HIGHBIT, unsigned long, "0x%lX");
CHECK_HIGHBIT (UINT_HIGHBIT, unsigned int, "0x%X");
CHECK_HIGHBIT (USHRT_HIGHBIT, unsigned short, "0x%hX");
-#if 0 /* Bad! */
CHECK_HIGHBIT (LONG_HIGHBIT, long, "0x%lX");
+#if 0 /* Bad! */
CHECK_HIGHBIT (INT_HIGHBIT, int, "0x%X");
CHECK_HIGHBIT (SHRT_HIGHBIT, short, "0x%hX");
#endif
@@ -329,10 +330,10 @@ main (int argc, char *argv[])
printf ("INT_MAX %X\n", INT_MAX);
printf ("INT_MIN %X\n", INT_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 ("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 ("\n");
printf ("Bits\n");
diff --git a/gmp/tests/t-count_zeros.c b/gmp/tests/t-count_zeros.c
index 117babadc6..85955dcba5 100644
--- a/gmp/tests/t-count_zeros.c
+++ b/gmp/tests/t-count_zeros.c
@@ -1,21 +1,21 @@
/* Test count_leading_zeros and count_trailing_zeros.
-Copyright 2001-2003 Free Software Foundation, Inc.
+Copyright 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -63,9 +63,9 @@ check_various (void)
check_clz (COUNT_LEADING_ZEROS_0, CNST_LIMB(0));
#endif
- for (i=0; i < GMP_LIMB_BITS; i++)
+ for (i=0; i < BITS_PER_MP_LIMB; i++)
{
- check_clz (i, CNST_LIMB(1) << (GMP_LIMB_BITS-1-i));
+ check_clz (i, CNST_LIMB(1) << (BITS_PER_MP_LIMB-1-i));
check_ctz (i, CNST_LIMB(1) << i);
check_ctz (i, MP_LIMB_T_MAX << i);
diff --git a/gmp/tests/t-gmpmax.c b/gmp/tests/t-gmpmax.c
index 76fdd28e61..efe166f160 100644
--- a/gmp/tests/t-gmpmax.c
+++ b/gmp/tests/t-gmpmax.c
@@ -2,20 +2,20 @@
Copyright 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -42,8 +42,12 @@ 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 != ULONG_MAX)
+ if (__GMP_ULONG_MAX != (unsigned long) ULONG_MAX)
{
printf ("__GMP_ULONG_MAX incorrect\n");
printf (" __GMP_ULONG_MAX %lu 0x%lX\n", __GMP_ULONG_MAX, __GMP_ULONG_MAX);
@@ -56,8 +60,8 @@ main (int argc, char *argv[])
if (__GMP_USHRT_MAX != USHRT_MAX)
{
printf ("__GMP_USHRT_MAX incorrect\n");
- 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);
+ 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);
error = 1;
}
#endif
diff --git a/gmp/tests/t-hightomask.c b/gmp/tests/t-hightomask.c
index 1de20c94f6..9e6c109f0f 100644
--- a/gmp/tests/t-hightomask.c
+++ b/gmp/tests/t-hightomask.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/t-modlinv.c b/gmp/tests/t-modlinv.c
index 8e17d7787f..2baf6c7eff 100644
--- a/gmp/tests/t-modlinv.c
+++ b/gmp/tests/t-modlinv.c
@@ -1,21 +1,21 @@
/* Test binvert_limb.
-Copyright 2000-2003 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/t-parity.c b/gmp/tests/t-parity.c
index b6da112733..922dd512a5 100644
--- a/gmp/tests/t-parity.c
+++ b/gmp/tests/t-parity.c
@@ -1,21 +1,21 @@
/* Test ULONG_PARITY.
-Copyright 2002, 2014 Free Software Foundation, Inc.
+Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <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, 1UL << i);
+ check_one (1, 1L << i);
}
diff --git a/gmp/tests/t-popc.c b/gmp/tests/t-popc.c
index c3b3288607..7d0f4e0c88 100644
--- a/gmp/tests/t-popc.c
+++ b/gmp/tests/t-popc.c
@@ -1,21 +1,21 @@
/* Test popc_limb.
-Copyright 2002, 2012 Free Software Foundation, Inc.
+Copyright 2002 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
@@ -51,20 +51,6 @@ main (void)
}
}
- src = 0;
- want = 0;
- for (i = 0; i < GMP_LIMB_BITS; i++)
- {
- src += CNST_LIMB(1) << i;
- want += 1;
-
- popc_limb (got, src);
- if (got != want)
- {
- goto error;
- }
- }
-
for (i = 0; i < 100; i++)
{
mpn_random2 (&src, (mp_size_t) 1);
diff --git a/gmp/tests/t-sub.c b/gmp/tests/t-sub.c
index 331705ff6f..5eb78c9fbc 100644
--- a/gmp/tests/t-sub.c
+++ b/gmp/tests/t-sub.c
@@ -2,20 +2,20 @@
Copyright 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include <stdlib.h>
diff --git a/gmp/tests/tests.h b/gmp/tests/tests.h
index f0c3fa780b..22f6c0e33d 100644
--- a/gmp/tests/tests.h
+++ b/gmp/tests/tests.h
@@ -1,21 +1,21 @@
/* Tests support prototypes etc.
-Copyright 2000-2004, 2008-2013 Free Software Foundation, Inc.
+Copyright 2000, 2001, 2002, 2003, 2004 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#ifndef __TESTS_H__
@@ -37,28 +37,28 @@ extern "C" {
#endif
-void tests_start (void);
-void tests_end (void);
+void tests_start __GMP_PROTO ((void));
+void tests_end __GMP_PROTO ((void));
-void tests_memory_start (void);
-void tests_memory_end (void);
-void *tests_allocate (size_t);
-void *tests_reallocate (void *, size_t, size_t);
-void tests_free (void *, size_t);
-void tests_free_nosize (void *);
-int tests_memory_valid (void *);
+void tests_memory_start __GMP_PROTO ((void));
+void tests_memory_end __GMP_PROTO ((void));
+void *tests_allocate __GMP_PROTO ((size_t size));
+void *tests_reallocate __GMP_PROTO ((void *ptr, size_t old_size, size_t new_size));
+void tests_free __GMP_PROTO ((void *ptr, size_t size));
+void tests_free_nosize __GMP_PROTO ((void *ptr));
+int tests_memory_valid __GMP_PROTO ((void *ptr));
-void tests_rand_start (void);
-void tests_rand_end (void);
+void tests_rand_start __GMP_PROTO ((void));
+void tests_rand_end __GMP_PROTO ((void));
-double tests_infinity_d ();
-int tests_hardware_getround (void);
-int tests_hardware_setround (int);
-int tests_isinf (double);
-int tests_dbl_mant_bits (void);
+double tests_infinity_d __GMP_PROTO (());
+int tests_hardware_getround __GMP_PROTO ((void));
+int tests_hardware_setround __GMP_PROTO ((int));
+int tests_isinf __GMP_PROTO ((double));
+int tests_dbl_mant_bits __GMP_PROTO ((void));
-void x86_fldcw (unsigned short);
-unsigned short x86_fstcw (void);
+void x86_fldcw __GMP_PROTO ((unsigned short));
+unsigned short x86_fstcw __GMP_PROTO ((void));
/* tests_setjmp_sigfpe is like a setjmp, establishing a trap for SIGFPE.
@@ -73,15 +73,15 @@ unsigned short x86_fstcw (void);
(signal (SIGFPE, tests_sigfpe_handler), \
setjmp (tests_sigfpe_target))
-RETSIGTYPE tests_sigfpe_handler (int);
-void tests_sigfpe_done (void);
+RETSIGTYPE tests_sigfpe_handler __GMP_PROTO ((int));
+void tests_sigfpe_done __GMP_PROTO ((void));
extern jmp_buf tests_sigfpe_target;
#if HAVE_CALLING_CONVENTIONS
-extern mp_limb_t (*calling_conventions_function) (ANYARGS);
-mp_limb_t calling_conventions (ANYARGS);
-int calling_conventions_check (void);
+extern mp_limb_t (*calling_conventions_function) __GMP_PROTO ((ANYARGS));
+mp_limb_t calling_conventions __GMP_PROTO ((ANYARGS));
+int calling_conventions_check __GMP_PROTO ((void));
#define CALLING_CONVENTIONS(function) \
(calling_conventions_function = (function), calling_conventions)
#define CALLING_CONVENTIONS_CHECK() (calling_conventions_check())
@@ -92,276 +92,320 @@ int calling_conventions_check (void);
extern int mp_trace_base;
-void mp_limb_trace (const char *, mp_limb_t);
-void mpn_trace (const char *, mp_srcptr, mp_size_t);
-void mpn_tracea (const char *, const mp_ptr *, int, mp_size_t);
-void mpn_tracen (const char *, int, mp_srcptr, mp_size_t);
-void mpn_trace_file (const char *, mp_srcptr, mp_size_t);
-void mpn_tracea_file (const char *, const mp_ptr *, int, mp_size_t);
-void mpf_trace (const char *, mpf_srcptr);
-void mpq_trace (const char *, mpq_srcptr);
-void mpz_trace (const char *, mpz_srcptr);
-void mpz_tracen (const char *, int, mpz_srcptr);
-void byte_trace (const char *, const void *, mp_size_t);
-void byte_tracen (const char *, int, const void *, mp_size_t);
-void d_trace (const char *, double);
-
-
-void spinner (void);
+void mp_limb_trace __GMP_PROTO ((const char *, mp_limb_t));
+void mpn_trace __GMP_PROTO ((const char *name, mp_srcptr ptr, mp_size_t size));
+void mpn_tracea __GMP_PROTO ((const char *name, const mp_ptr *a, int count,
+ mp_size_t size));
+void mpn_tracen __GMP_PROTO ((const char *name, int num, mp_srcptr ptr,
+ mp_size_t size));
+void mpn_trace_file __GMP_PROTO ((const char *filename,
+ mp_srcptr ptr, mp_size_t size));
+void mpn_tracea_file __GMP_PROTO ((const char *filename,
+ const mp_ptr *a, int count, mp_size_t size));
+void mpf_trace __GMP_PROTO ((const char *name, mpf_srcptr z));
+void mpq_trace __GMP_PROTO ((const char *name, mpq_srcptr q));
+void mpz_trace __GMP_PROTO ((const char *name, mpz_srcptr z));
+void mpz_tracen __GMP_PROTO ((const char *name, int num, mpz_srcptr z));
+void byte_trace __GMP_PROTO ((const char *, const void *, mp_size_t));
+void byte_tracen __GMP_PROTO ((const char *, int, const void *, mp_size_t));
+void d_trace __GMP_PROTO ((const char *, double));
+
+
+void spinner __GMP_PROTO ((void));
extern unsigned long spinner_count;
extern int spinner_wanted;
extern int spinner_tick;
-void *align_pointer (void *, size_t);
-void *__gmp_allocate_func_aligned (size_t, size_t);
-void *__gmp_allocate_or_reallocate (void *, size_t, size_t);
-char *__gmp_allocate_strdup (const char *);
-char *strtoupper (char *);
-mp_limb_t urandom (void);
-void call_rand_algs (void (*func) (const char *, gmp_randstate_t));
-
-
-void mpf_set_str_or_abort (mpf_ptr, const char *, int);
-
-
-void mpq_set_str_or_abort (mpq_ptr, const char *, int);
-
-
-void mpz_erandomb (mpz_ptr, gmp_randstate_t, unsigned long);
-void mpz_erandomb_nonzero (mpz_ptr, gmp_randstate_t, unsigned long);
-void mpz_errandomb (mpz_ptr, gmp_randstate_t, unsigned long);
-void mpz_errandomb_nonzero (mpz_ptr, gmp_randstate_t, unsigned long);
-void mpz_init_set_n (mpz_ptr, mp_srcptr, mp_size_t);
-void mpz_negrandom (mpz_ptr, gmp_randstate_t);
-int mpz_pow2abs_p (mpz_srcptr) __GMP_ATTRIBUTE_PURE;
-void mpz_set_n (mpz_ptr, mp_srcptr, mp_size_t);
-void mpz_set_str_or_abort (mpz_ptr, const char *, int);
-
-mp_size_t mpn_diff_highest (mp_srcptr, mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
-mp_size_t mpn_diff_lowest (mp_srcptr, mp_srcptr, mp_size_t) __GMP_ATTRIBUTE_PURE;
-mp_size_t byte_diff_highest (const void *, const void *, mp_size_t) __GMP_ATTRIBUTE_PURE;
-mp_size_t byte_diff_lowest (const void *, const void *, mp_size_t) __GMP_ATTRIBUTE_PURE;
-
-
-mp_limb_t ref_addc_limb (mp_limb_t *, mp_limb_t, mp_limb_t);
-mp_limb_t ref_bswap_limb (mp_limb_t);
-unsigned long ref_popc_limb (mp_limb_t);
-mp_limb_t ref_subc_limb (mp_limb_t *, mp_limb_t, mp_limb_t);
-
-
-void refmpf_add (mpf_ptr, mpf_srcptr, mpf_srcptr);
-void refmpf_add_ulp (mpf_ptr );
-void refmpf_fill (mpf_ptr, mp_size_t, mp_limb_t);
-void refmpf_normalize (mpf_ptr);
-void refmpf_set_prec_limbs (mpf_ptr, unsigned long);
-unsigned long refmpf_set_overlap (mpf_ptr, mpf_srcptr);
-void refmpf_sub (mpf_ptr, mpf_srcptr, mpf_srcptr);
-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_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);
-mp_limb_t refmpn_add_err1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_add_err2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_add_err3_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_add_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_addlsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_addlsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_addlsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_addlsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_addlsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_addlsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_addlsh1_n_ip2 (mp_ptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_addlsh2_n_ip2 (mp_ptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_addlsh_n_ip2 (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_addlsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_addlsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_addlsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned, mp_limb_t);
-mp_limb_t refmpn_addmul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_addmul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_addmul_2 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_addmul_3 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_addmul_4 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_addmul_5 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_addmul_6 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_addmul_7 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_addmul_8 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-
-mp_limb_t refmpn_add_n_sub_n (mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_add_n_sub_nc (mp_ptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-void refmpn_and_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void refmpn_andn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-mp_limb_t refmpn_big_base (int);
-
-int refmpn_chars_per_limb (int);
-void refmpn_clrbit (mp_ptr, unsigned long);
-int refmpn_cmp (mp_srcptr, mp_srcptr, mp_size_t);
-int refmpn_cmp_allowzero (mp_srcptr, mp_srcptr, mp_size_t);
-int refmpn_cmp_twosizes (mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-void refmpn_com (mp_ptr, mp_srcptr, mp_size_t);
-void refmpn_copy (mp_ptr, mp_srcptr, mp_size_t);
-void refmpn_copyi (mp_ptr, mp_srcptr, mp_size_t);
-void refmpn_copyd (mp_ptr, mp_srcptr, mp_size_t);
-void refmpn_copy_extend (mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
-
-unsigned refmpn_count_leading_zeros (mp_limb_t);
-unsigned refmpn_count_trailing_zeros (mp_limb_t);
-
-mp_limb_t refmpn_divexact_by3 (mp_ptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_divexact_by3c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-
-mp_limb_t refmpn_divmod_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_divmod_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_divrem_1c (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_divrem_2 (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
-
-int refmpn_equal_anynail (mp_srcptr, mp_srcptr, mp_size_t);
-
-void refmpn_fill (mp_ptr, mp_size_t, mp_limb_t);
-
-mp_limb_t refmpn_gcd_1 (mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_gcd (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
-
-size_t refmpn_get_str (unsigned char *, int, mp_ptr, mp_size_t);
-
-unsigned long refmpn_hamdist (mp_srcptr, mp_srcptr, mp_size_t);
-
-mp_limb_t refmpn_invert_limb (mp_limb_t);
-void refmpn_ior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void refmpn_iorn_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-mp_limb_t refmpn_lshift (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_lshift_or_copy (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_lshift_or_copy_any (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_lshiftc (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-void refmpn_com (mp_ptr, mp_srcptr, mp_size_t);
-
-mp_ptr refmpn_malloc_limbs (mp_size_t);
-mp_ptr refmpn_malloc_limbs_aligned (mp_size_t, size_t);
-void refmpn_free_limbs (mp_ptr);
-mp_limb_t refmpn_msbone (mp_limb_t);
-mp_limb_t refmpn_msbone_mask (mp_limb_t);
-mp_ptr refmpn_memdup_limbs (mp_srcptr, mp_size_t);
-
-mp_limb_t refmpn_mod_1 (mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_mod_1c (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_mod_34lsub1 (mp_srcptr, mp_size_t);
-
-mp_limb_t refmpn_mul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_mul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_mul_2 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_mul_3 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_mul_4 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_mul_5 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-mp_limb_t refmpn_mul_6 (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr);
-
-void refmpn_mul_basecase (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-void refmpn_mulmid_basecase (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-void refmpn_toom42_mulmid (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr);
-void refmpn_mulmid_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void refmpn_mulmid (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-void refmpn_mullo_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void refmpn_mul_any (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-void refmpn_mul_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void refmpn_mul (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-
-void refmpn_nand_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void refmpn_nior_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_neg (mp_ptr, mp_srcptr, mp_size_t);
-mp_size_t refmpn_normalize (mp_srcptr, mp_size_t);
-
-unsigned long refmpn_popcount (mp_srcptr, mp_size_t);
-mp_limb_t refmpn_preinv_divrem_1 (mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t, unsigned);
-mp_limb_t refmpn_preinv_mod_1 (mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-
-void refmpn_random (mp_ptr, mp_size_t);
-void refmpn_random2 (mp_ptr, mp_size_t);
-mp_limb_t refmpn_random_limb (void);
-
-mp_limb_t refmpn_rsh1add_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_rsh1sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_rshift (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_rshift_or_copy (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-mp_limb_t refmpn_rshift_or_copy_any (mp_ptr, mp_srcptr, mp_size_t, unsigned);
-
-mp_limb_t refmpn_sb_div_qr (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
-unsigned long refmpn_scan0 (mp_srcptr, unsigned long);
-unsigned long refmpn_scan1 (mp_srcptr, unsigned long);
-void refmpn_setbit (mp_ptr, unsigned long);
-void refmpn_sqr (mp_ptr, mp_srcptr, mp_size_t);
-mp_size_t refmpn_sqrtrem (mp_ptr, mp_ptr, mp_srcptr, mp_size_t);
-
-void refmpn_sub_ddmmss (mp_limb_t *, mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_sub (mp_ptr, mp_srcptr, mp_size_t, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_sub_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_sub_err1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_sub_err2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_sub_err3_n (mp_ptr, mp_srcptr, mp_srcptr, mp_ptr, mp_srcptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_sub_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_sub_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_sublsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_sublsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_sublsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
-mp_limb_t refmpn_sublsh1_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_sublsh2_n_ip1 (mp_ptr, mp_srcptr, mp_size_t);
-mp_limb_t refmpn_sublsh_n_ip1 (mp_ptr, mp_srcptr, mp_size_t, unsigned int);
-mp_limb_t refmpn_sublsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_sublsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_sublsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_t);
-mp_limb_t refmpn_submul_1 (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t refmpn_submul_1c (mp_ptr, mp_srcptr, mp_size_t, mp_limb_t, mp_limb_t);
-
-mp_limb_signed_t refmpn_rsblsh1_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_signed_t refmpn_rsblsh2_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-mp_limb_signed_t refmpn_rsblsh_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int);
-mp_limb_signed_t refmpn_rsblsh1_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_signed_t);
-mp_limb_signed_t refmpn_rsblsh2_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_limb_signed_t);
-mp_limb_signed_t refmpn_rsblsh_nc (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, unsigned int, mp_limb_signed_t);
-
-void refmpn_tdiv_qr (mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
-int refmpn_tstbit (mp_srcptr, unsigned long);
-
-mp_limb_t refmpn_udiv_qrnnd (mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_udiv_qrnnd_r (mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t *);
-mp_limb_t refmpn_umul_ppmm (mp_limb_t *, mp_limb_t, mp_limb_t);
-mp_limb_t refmpn_umul_ppmm_r (mp_limb_t, mp_limb_t, mp_limb_t *);
-
-void refmpn_xnor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void refmpn_xor_n (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-
-void refmpn_zero (mp_ptr, mp_size_t);
-void refmpn_zero_extend (mp_ptr, mp_size_t, mp_size_t);
-int refmpn_zero_p (mp_srcptr, mp_size_t);
-
-void refmpn_binvert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
-void refmpn_invert (mp_ptr, mp_srcptr, mp_size_t, mp_ptr);
-
-
-void refmpq_add (mpq_ptr, mpq_srcptr, mpq_srcptr);
-void refmpq_sub (mpq_ptr, mpq_srcptr, mpq_srcptr);
-
-
-void refmpz_combit (mpz_ptr, unsigned long);
-unsigned long refmpz_hamdist (mpz_srcptr, mpz_srcptr);
-int refmpz_kronecker (mpz_srcptr, mpz_srcptr);
-int refmpz_jacobi (mpz_srcptr, mpz_srcptr);
-int refmpz_legendre (mpz_srcptr, mpz_srcptr);
-int refmpz_kronecker_si (mpz_srcptr, long);
-int refmpz_kronecker_ui (mpz_srcptr, unsigned long);
-int refmpz_si_kronecker (long, mpz_srcptr);
-int refmpz_ui_kronecker (unsigned long, mpz_srcptr);
-
-void refmpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long);
+void *align_pointer __GMP_PROTO ((void *p, size_t align));
+void *__gmp_allocate_func_aligned __GMP_PROTO ((size_t bytes, size_t align));
+void *__gmp_allocate_or_reallocate __GMP_PROTO ((void *ptr,
+ size_t oldsize, size_t newsize));
+char *__gmp_allocate_strdup __GMP_PROTO ((const char *s));
+char *strtoupper __GMP_PROTO ((char *s_orig));
+mp_limb_t urandom __GMP_PROTO ((void));
+void call_rand_algs __GMP_PROTO ((void (*func) (const char *, gmp_randstate_t)));
+
+
+void mpf_set_str_or_abort __GMP_PROTO ((mpf_ptr f, const char *str, int base));
+
+
+void mpq_set_str_or_abort __GMP_PROTO ((mpq_ptr q, const char *str, int base));
+
+
+void mpz_erandomb __GMP_PROTO ((mpz_ptr rop, gmp_randstate_t rstate,
+ unsigned long nbits));
+void mpz_erandomb_nonzero __GMP_PROTO ((mpz_ptr rop, gmp_randstate_t rstate,
+ unsigned long nbits));
+void mpz_errandomb __GMP_PROTO ((mpz_ptr rop, gmp_randstate_t rstate,
+ unsigned long nbits));
+void mpz_errandomb_nonzero __GMP_PROTO ((mpz_ptr rop, gmp_randstate_t rstate,
+ unsigned long nbits));
+void mpz_init_set_n __GMP_PROTO ((mpz_ptr z, mp_srcptr p, mp_size_t size));
+void mpz_negrandom __GMP_PROTO ((mpz_ptr rop, gmp_randstate_t rstate));
+int mpz_pow2abs_p __GMP_PROTO ((mpz_srcptr z)) __GMP_ATTRIBUTE_PURE;
+void mpz_set_n __GMP_PROTO ((mpz_ptr z, mp_srcptr p, mp_size_t size));
+void mpz_set_str_or_abort __GMP_PROTO ((mpz_ptr z, const char *str, int base));
+
+mp_size_t mpn_diff_highest __GMP_PROTO ((mp_srcptr p1, mp_srcptr p2, mp_size_t n)) __GMP_ATTRIBUTE_PURE;
+mp_size_t mpn_diff_lowest __GMP_PROTO ((mp_srcptr p1, mp_srcptr p2, mp_size_t n)) __GMP_ATTRIBUTE_PURE;
+mp_size_t byte_diff_highest __GMP_PROTO ((const void *p1, const void *p2, mp_size_t size)) __GMP_ATTRIBUTE_PURE;
+mp_size_t byte_diff_lowest __GMP_PROTO ((const void *p1, const void *p2, mp_size_t size)) __GMP_ATTRIBUTE_PURE;
+
+
+mp_limb_t ref_addc_limb __GMP_PROTO ((mp_limb_t *, mp_limb_t, mp_limb_t));
+mp_limb_t ref_bswap_limb __GMP_PROTO ((mp_limb_t src));
+unsigned long ref_popc_limb __GMP_PROTO ((mp_limb_t src));
+mp_limb_t ref_subc_limb __GMP_PROTO ((mp_limb_t *, mp_limb_t, mp_limb_t));
+
+
+void refmpf_add __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
+void refmpf_add_ulp __GMP_PROTO ((mpf_ptr f));
+void refmpf_fill __GMP_PROTO ((mpf_ptr f, mp_size_t size, mp_limb_t value));
+void refmpf_normalize __GMP_PROTO ((mpf_ptr f));
+void refmpf_set_prec_limbs __GMP_PROTO ((mpf_ptr f, unsigned long prec));
+unsigned long refmpf_set_overlap __GMP_PROTO ((mpf_ptr dst, mpf_srcptr src));
+void refmpf_sub __GMP_PROTO ((mpf_ptr, mpf_srcptr, mpf_srcptr));
+int refmpf_validate __GMP_PROTO ((const char *name, mpf_srcptr got, mpf_srcptr want));
+int refmpf_validate_division __GMP_PROTO ((const char *name, mpf_srcptr got,
+ mpf_srcptr n, mpf_srcptr d));
+
+
+mp_limb_t refmpn_add __GMP_PROTO ((mp_ptr rp,
+ mp_srcptr s1p, mp_size_t s1size,
+ mp_srcptr s2p, mp_size_t s2size));
+mp_limb_t refmpn_add_1 __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t n));
+mp_limb_t refmpn_add_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+mp_limb_t refmpn_add_nc __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size, mp_limb_t carry));
+mp_limb_t refmpn_addlsh1_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+mp_limb_t refmpn_addmul_1 __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ mp_limb_t multiplier));
+mp_limb_t refmpn_addmul_1c __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ mp_limb_t multiplier, mp_limb_t carry));
+mp_limb_t refmpn_addmul_2 __GMP_PROTO ((mp_ptr dst, mp_srcptr src,
+ mp_size_t size, mp_srcptr mult));
+mp_limb_t refmpn_addmul_3 __GMP_PROTO ((mp_ptr dst, mp_srcptr src,
+ mp_size_t size, mp_srcptr mult));
+mp_limb_t refmpn_addmul_4 __GMP_PROTO ((mp_ptr dst, mp_srcptr src,
+ mp_size_t size, mp_srcptr mult));
+mp_limb_t refmpn_addmul_5 __GMP_PROTO ((mp_ptr dst, mp_srcptr src,
+ mp_size_t size, mp_srcptr mult));
+mp_limb_t refmpn_addmul_6 __GMP_PROTO ((mp_ptr dst, mp_srcptr src,
+ mp_size_t size, mp_srcptr mult));
+mp_limb_t refmpn_addmul_7 __GMP_PROTO ((mp_ptr dst, mp_srcptr src,
+ mp_size_t size, mp_srcptr mult));
+mp_limb_t refmpn_addmul_8 __GMP_PROTO ((mp_ptr dst, mp_srcptr src,
+ mp_size_t size, mp_srcptr mult));
+
+mp_limb_t refmpn_addsub_n __GMP_PROTO ((mp_ptr r1p, mp_ptr r2p,
+ mp_srcptr s1p, mp_srcptr s2p,
+ mp_size_t size));
+mp_limb_t refmpn_addsub_nc __GMP_PROTO ((mp_ptr r1p, mp_ptr r2p,
+ mp_srcptr s1p, mp_srcptr s2p,
+ mp_size_t size, mp_limb_t carry));
+
+void refmpn_and_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+void refmpn_andn_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+
+mp_limb_t refmpn_big_base __GMP_PROTO ((int));
+
+int refmpn_chars_per_limb __GMP_PROTO ((int));
+void refmpn_clrbit __GMP_PROTO ((mp_ptr, unsigned long));
+int refmpn_cmp __GMP_PROTO ((mp_srcptr s1p, mp_srcptr s2p, mp_size_t size));
+int refmpn_cmp_allowzero __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t));
+int refmpn_cmp_twosizes __GMP_PROTO ((mp_srcptr xp, mp_size_t xsize,
+ mp_srcptr yp, mp_size_t ysize));
+
+void refmpn_com_n __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size));
+void refmpn_copy __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size));
+void refmpn_copyi __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size));
+void refmpn_copyd __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size));
+void refmpn_copy_extend __GMP_PROTO ((mp_ptr wp, mp_size_t wsize, mp_srcptr xp, mp_size_t xsize));
+
+unsigned refmpn_count_leading_zeros __GMP_PROTO ((mp_limb_t x));
+unsigned refmpn_count_trailing_zeros __GMP_PROTO ((mp_limb_t x));
+
+mp_limb_t refmpn_divexact_by3 __GMP_PROTO ((mp_ptr rp, mp_srcptr sp,
+ mp_size_t size));
+mp_limb_t refmpn_divexact_by3c __GMP_PROTO ((mp_ptr rp, mp_srcptr sp,
+ mp_size_t size, mp_limb_t carry));
+
+mp_limb_t refmpn_divmod_1 __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor));
+mp_limb_t refmpn_divmod_1c __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor, mp_limb_t carry));
+mp_limb_t refmpn_divrem_1 __GMP_PROTO ((mp_ptr rp, mp_size_t xsize,
+ mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor));
+mp_limb_t refmpn_divrem_1c __GMP_PROTO ((mp_ptr rp, mp_size_t xsize,
+ mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor, mp_limb_t carry));
+mp_limb_t refmpn_divrem_2 __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t,
+ mp_srcptr));
+
+int refmpn_equal_anynail __GMP_PROTO ((mp_srcptr, mp_srcptr, mp_size_t));
+
+void refmpn_fill __GMP_PROTO ((mp_ptr p, mp_size_t s, mp_limb_t v));
+
+mp_limb_t refmpn_gcd_1 __GMP_PROTO ((mp_srcptr xp, mp_size_t xsize, mp_limb_t y));
+mp_limb_t refmpn_gcd __GMP_PROTO ((mp_ptr gp, mp_ptr xp, mp_size_t xsize,
+ mp_ptr yp, mp_size_t ysize));
+
+size_t refmpn_get_str __GMP_PROTO ((unsigned char *, int, mp_ptr, mp_size_t));
+
+unsigned long refmpn_hamdist __GMP_PROTO ((mp_srcptr s1p, mp_srcptr s2p,
+ mp_size_t size));
+
+mp_limb_t refmpn_invert_limb __GMP_PROTO ((mp_limb_t d));
+void refmpn_ior_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+void refmpn_iorn_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+
+mp_limb_t refmpn_lshift __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ unsigned shift));
+mp_limb_t refmpn_lshift_or_copy __GMP_PROTO ((mp_ptr wp,
+ mp_srcptr xp, mp_size_t size,
+ unsigned shift));
+mp_limb_t refmpn_lshift_or_copy_any __GMP_PROTO ((mp_ptr wp,
+ mp_srcptr xp, mp_size_t size,
+ unsigned shift));
+
+mp_ptr refmpn_malloc_limbs __GMP_PROTO ((mp_size_t size));
+mp_ptr refmpn_malloc_limbs_aligned __GMP_PROTO ((mp_size_t n, size_t m));
+void refmpn_free_limbs __GMP_PROTO ((mp_ptr p));
+mp_limb_t refmpn_msbone __GMP_PROTO ((mp_limb_t x));
+mp_limb_t refmpn_msbone_mask __GMP_PROTO ((mp_limb_t x));
+mp_ptr refmpn_memdup_limbs __GMP_PROTO ((mp_srcptr ptr, mp_size_t size));
+
+mp_limb_t refmpn_mod_1 __GMP_PROTO ((mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor));
+mp_limb_t refmpn_mod_1c __GMP_PROTO ((mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor, mp_limb_t carry));
+mp_limb_t refmpn_mod_34lsub1 __GMP_PROTO ((mp_srcptr p, mp_size_t n));
+
+mp_limb_t refmpn_mul_1 __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ mp_limb_t multiplier));
+mp_limb_t refmpn_mul_1c __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ mp_limb_t multiplier, mp_limb_t carry));
+mp_limb_t refmpn_mul_2 __GMP_PROTO ((mp_ptr dst, mp_srcptr src, mp_size_t size,
+ mp_srcptr mult));
+mp_limb_t refmpn_mul_3 __GMP_PROTO ((mp_ptr dst, mp_srcptr src, mp_size_t size,
+ mp_srcptr mult));
+mp_limb_t refmpn_mul_4 __GMP_PROTO ((mp_ptr dst, mp_srcptr src, mp_size_t size,
+ mp_srcptr mult));
+
+void refmpn_mul_basecase __GMP_PROTO ((mp_ptr prodp,
+ mp_srcptr up, mp_size_t usize,
+ mp_srcptr vp, mp_size_t vsize));
+void refmpn_mul_any __GMP_PROTO ((mp_ptr prodp,
+ mp_srcptr up, mp_size_t usize,
+ mp_srcptr vp, mp_size_t vsize));
+void refmpn_mul_n __GMP_PROTO ((mp_ptr prodp, mp_srcptr up, mp_srcptr vp,
+ mp_size_t size));
+
+void refmpn_nand_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+void refmpn_nior_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+mp_limb_t refmpn_neg_n __GMP_PROTO ((mp_ptr dst, mp_srcptr src, mp_size_t size));
+mp_size_t refmpn_normalize __GMP_PROTO ((mp_srcptr, mp_size_t));
+
+unsigned long refmpn_popcount __GMP_PROTO ((mp_srcptr sp, mp_size_t size));
+mp_limb_t refmpn_preinv_divrem_1 __GMP_PROTO ((mp_ptr rp, mp_size_t xsize,
+ mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor,
+ mp_limb_t inverse, unsigned shift));
+mp_limb_t refmpn_preinv_mod_1 __GMP_PROTO ((mp_srcptr sp, mp_size_t size,
+ mp_limb_t divisor,
+ mp_limb_t divisor_inverse));
+
+void refmpn_random __GMP_PROTO ((mp_ptr, mp_size_t));
+void refmpn_random2 __GMP_PROTO ((mp_ptr, mp_size_t));
+mp_limb_t refmpn_random_limb __GMP_PROTO ((void));
+
+mp_limb_t refmpn_rsh1add_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+mp_limb_t refmpn_rsh1sub_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+mp_limb_t refmpn_rshift __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ unsigned shift));
+mp_limb_t refmpn_rshift_or_copy __GMP_PROTO ((mp_ptr wp,
+ mp_srcptr xp, mp_size_t size,
+ unsigned shift));
+mp_limb_t refmpn_rshift_or_copy_any __GMP_PROTO ((mp_ptr wp,
+ mp_srcptr xp, mp_size_t size,
+ unsigned shift));
+
+mp_limb_t refmpn_sb_divrem_mn __GMP_PROTO ((mp_ptr qp,
+ mp_ptr np, mp_size_t nsize,
+ mp_srcptr dp, mp_size_t dsize));
+unsigned long refmpn_scan0 __GMP_PROTO ((mp_srcptr, unsigned long));
+unsigned long refmpn_scan1 __GMP_PROTO ((mp_srcptr, unsigned long));
+void refmpn_setbit __GMP_PROTO ((mp_ptr, unsigned long));
+void refmpn_sqr __GMP_PROTO ((mp_ptr dst, mp_srcptr src, mp_size_t size));
+mp_size_t refmpn_sqrtrem __GMP_PROTO ((mp_ptr, mp_ptr, mp_srcptr, mp_size_t));
+
+void refmpn_sub_ddmmss __GMP_PROTO ((mp_limb_t *, mp_limb_t *,
+ mp_limb_t, mp_limb_t,
+ mp_limb_t, mp_limb_t));
+mp_limb_t refmpn_sub __GMP_PROTO ((mp_ptr rp,
+ mp_srcptr s1p, mp_size_t s1size,
+ mp_srcptr s2p, mp_size_t s2size));
+mp_limb_t refmpn_sub_1 __GMP_PROTO ((mp_ptr rp, mp_srcptr sp, mp_size_t size,
+ mp_limb_t n));
+mp_limb_t refmpn_sub_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+mp_limb_t refmpn_sub_nc __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size, mp_limb_t carry));
+mp_limb_t refmpn_sublsh1_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+mp_limb_t refmpn_submul_1 __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ mp_limb_t multiplier));
+mp_limb_t refmpn_submul_1c __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_size_t size,
+ mp_limb_t multiplier, mp_limb_t carry));
+
+void refmpn_tdiv_qr __GMP_PROTO ((mp_ptr qp, mp_ptr rp, mp_size_t qxn,
+ mp_ptr np, mp_size_t nsize,
+ mp_srcptr dp, mp_size_t dsize));
+int refmpn_tstbit __GMP_PROTO ((mp_srcptr, unsigned long));
+
+mp_limb_t refmpn_udiv_qrnnd __GMP_PROTO ((mp_limb_t *, mp_limb_t, mp_limb_t, mp_limb_t));
+mp_limb_t refmpn_udiv_qrnnd_r __GMP_PROTO ((mp_limb_t, mp_limb_t, mp_limb_t, mp_limb_t *));
+mp_limb_t refmpn_umul_ppmm __GMP_PROTO ((mp_limb_t *, mp_limb_t, mp_limb_t));
+mp_limb_t refmpn_umul_ppmm_r __GMP_PROTO ((mp_limb_t, mp_limb_t, mp_limb_t *));
+
+void refmpn_xnor_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+void refmpn_xor_n __GMP_PROTO ((mp_ptr wp, mp_srcptr xp, mp_srcptr yp,
+ mp_size_t size));
+
+void refmpn_zero __GMP_PROTO ((mp_ptr p, mp_size_t s));
+void refmpn_zero_extend __GMP_PROTO ((mp_ptr, mp_size_t, mp_size_t));
+int refmpn_zero_p __GMP_PROTO ((mp_srcptr ptr, mp_size_t size));
+
+
+void refmpq_add __GMP_PROTO ((mpq_ptr w, mpq_srcptr x, mpq_srcptr y));
+void refmpq_sub __GMP_PROTO ((mpq_ptr w, mpq_srcptr x, mpq_srcptr y));
+
+
+void refmpz_combit __GMP_PROTO ((mpz_ptr r, unsigned long bit));
+unsigned long refmpz_hamdist __GMP_PROTO ((mpz_srcptr x, mpz_srcptr y));
+int refmpz_kronecker __GMP_PROTO ((mpz_srcptr a_orig, mpz_srcptr b_orig));
+int refmpz_jacobi __GMP_PROTO ((mpz_srcptr a_orig, mpz_srcptr b_orig));
+int refmpz_legendre __GMP_PROTO ((mpz_srcptr a_orig, mpz_srcptr b_orig));
+int refmpz_kronecker_si __GMP_PROTO ((mpz_srcptr, long));
+int refmpz_kronecker_ui __GMP_PROTO ((mpz_srcptr, unsigned long));
+int refmpz_si_kronecker __GMP_PROTO ((long, mpz_srcptr));
+int refmpz_ui_kronecker __GMP_PROTO ((unsigned long, mpz_srcptr));
+
+void refmpz_pow_ui __GMP_PROTO ((mpz_ptr w, mpz_srcptr b, unsigned long e));
#if defined (__cplusplus)
@@ -377,7 +421,7 @@ void refmpz_pow_ui (mpz_ptr, mpz_srcptr, unsigned long);
full implementation, just enough for our purposes. */
#ifdef __cplusplus
-#if 1 || HAVE_SSTREAM
+#if HAVE_SSTREAM
#include <sstream>
#else /* ! HAVE_SSTREAM */
#include <string>
@@ -403,40 +447,4 @@ istringstream : public std::istrstream {
#endif /* __cplusplus */
-#define TESTS_REPS(count, argv, argc) \
- do { \
- char *envval, *end; \
- double repfactor; \
- int reps_nondefault = 0; \
- if (argc > 1) \
- { \
- count = strtol (argv[1], &end, 0); \
- if (*end || count <= 0) \
- { \
- fprintf (stderr, "Invalid test count: %s.\n", argv[1]); \
- exit (1); \
- } \
- argv++; \
- argc--; \
- reps_nondefault = 1; \
- } \
- envval = getenv ("GMP_CHECK_REPFACTOR"); \
- if (envval != NULL) \
- { \
- repfactor = strtod (envval, &end); \
- if (*end || repfactor <= 0) \
- { \
- fprintf (stderr, "Invalid repfactor: %f.\n", repfactor); \
- exit (1); \
- } \
- count *= repfactor; \
- count = MAX (count, 1); \
- reps_nondefault = 1; \
- } \
- if (reps_nondefault) \
- printf ("Running test with %ld repetitions (include this in bug reports)\n",\
- (long) count); \
- } while (0)
-
-
#endif /* __TESTS_H__ */
diff --git a/gmp/tests/trace.c b/gmp/tests/trace.c
index 4b05bdb824..93ee7351a7 100644
--- a/gmp/tests/trace.c
+++ b/gmp/tests/trace.c
@@ -1,21 +1,22 @@
/* Support for diagnostic traces.
-Copyright 1999-2005 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation,
+Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Future: Would like commas printed between limbs in hex or binary, but
@@ -264,7 +265,7 @@ mpn_tracea_file (const char *filename,
void
byte_trace (const char *name, const void *ptr, mp_size_t size)
{
- const char *fmt;
+ char *fmt;
mp_size_t i;
mp_trace_start (name);
diff --git a/gmp/tests/x86call.asm b/gmp/tests/x86call.asm
index de2fbcde2f..47af42b726 100644
--- a/gmp/tests/x86call.asm
+++ b/gmp/tests/x86call.asm
@@ -1,26 +1,22 @@
dnl x86 calling conventions checking.
-dnl Copyright 2000, 2003, 2010, 2013 Free Software Foundation, Inc.
-
-dnl This file is part of the GNU MP Library test suite.
-
-dnl The GNU MP Library test suite is free software; you can redistribute it
-dnl and/or modify it under the terms of the GNU General Public License as
+dnl Copyright 2000, 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
+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/.
-dnl The GNU MP Library test suite is distributed in the hope that it will be
-dnl useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
-dnl MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General
-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 https://www.gnu.org/licenses/.
-
-
-dnl The current version of the code attempts to keep the call/return
-dnl prediction stack valid, but matching calls and returns.
include(`../config.m4')
@@ -30,8 +26,8 @@ C
C Execute an fldcw, setting the x87 control word to cw.
PROLOGUE(x86_fldcw)
- fldcw 4(%esp)
- ret
+ fldcw 4(%esp)
+ ret
EPILOGUE()
@@ -40,18 +36,18 @@ C
C Execute an fstcw, returning the current x87 control word.
PROLOGUE(x86_fstcw)
- xor %eax, %eax
- push %eax
- fstcw (%esp)
- pop %eax
- ret
+ xorl %eax, %eax
+ pushl %eax
+ fstcw (%esp)
+ popl %eax
+ ret
EPILOGUE()
-dnl Instrumented profiling doesn't come out quite right below, since we don't
-dnl do an actual "ret". There's only a few instructions here, so there's no
-dnl great need to get them separately accounted, just let them get attributed
-dnl to the caller. FIXME this comment might no longer be true.
+dnl Instrumented profiling doesn't come out quite right below, since we
+dnl don't do an actual "ret". There's only a few instructions here, so
+dnl there's no great need to get them separately accounted, just let them
+dnl get attributed to the caller.
ifelse(WANT_PROFILING,instrument,
`define(`WANT_PROFILING',no)')
@@ -65,89 +61,55 @@ C
C Perhaps the finit should be done only if the tags word isn't clear, but
C nothing uses the rounding mode or anything at the moment.
-define(`WANT_EBX', eval(4*0)($1))
-define(`WANT_EBP', eval(4*1)($1))
-define(`WANT_ESI', eval(4*2)($1))
-define(`WANT_EDI', eval(4*3)($1))
-
-define(`JUNK_EAX', eval(4*4)($1))
-define(`JUNK_ECX', eval(4*5)($1))
-define(`JUNK_EDX', eval(4*6)($1))
-
-define(`SAVE_EBX', eval(4*7)($1))
-define(`SAVE_EBP', eval(4*8)($1))
-define(`SAVE_ESI', eval(4*9)($1))
-define(`SAVE_EDI', eval(4*10)($1))
-
-define(`RETADDR', eval(4*11)($1))
-
-define(`EBX', eval(4*12)($1))
-define(`EBP', eval(4*13)($1))
-define(`ESI', eval(4*14)($1))
-define(`EDI', eval(4*15)($1))
-define(`EFLAGS', eval(4*16)($1))
-
-
define(G,
m4_assert_numargs(1)
`GSYM_PREFIX`'$1')
- TEXT
+ .text
ALIGN(8)
PROLOGUE(calling_conventions)
- LEA( G(calling_conventions_values), %ecx)
- pop RETADDR(%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
- 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
- mov JUNK_EAX(%ecx), %eax
- mov JUNK_EDX(%ecx), %edx
-C mov JUNK_ECX(%ecx), %ecx
-
-ifdef(`PIC',`
- LEA( G(calling_conventions_function), %ecx)
- call *(%ecx)
-',`
- call *G(calling_conventions_function)
-')
-
- LEA( G(calling_conventions_values), %ecx)
-
- mov %ebx, EBX(%ecx)
- mov %ebp, EBP(%ecx)
- mov %esi, ESI(%ecx)
- mov %edi, EDI(%ecx)
+ movl (%esp), %eax
+ movl %eax, G(calling_conventions_retaddr)
- pushf
- pop %ebx
- mov %ebx, EFLAGS(%ecx)
+ movl $L(return), (%esp)
+
+ movl %ebx, G(calling_conventions_save_ebx)
+ movl %esi, G(calling_conventions_save_esi)
+ movl %edi, G(calling_conventions_save_edi)
+ movl %ebp, G(calling_conventions_save_ebp)
+
+ movl $0x01234567, %ebx
+ movl $0x89ABCDEF, %esi
+ movl $0xFEDCBA98, %edi
+ movl $0x76543210, %ebp
+
+ C try to provoke a problem by starting with junk in the registers,
+ C especially in %eax and %edx which will be return values
+ movl $0x70246135, %eax
+ movl $0x8ACE9BDF, %ecx
+ movl $0xFDB97531, %edx
- mov SAVE_EBX(%ecx), %ebx
- mov SAVE_ESI(%ecx), %esi
- mov SAVE_EDI(%ecx), %edi
- mov SAVE_EBP(%ecx), %ebp
+ jmp *G(calling_conventions_function)
- push RETADDR(%ecx)
+L(return):
+ movl %ebx, G(calling_conventions_ebx)
+ movl %esi, G(calling_conventions_esi)
+ movl %edi, G(calling_conventions_edi)
+ movl %ebp, G(calling_conventions_ebp)
+
+ pushf
+ popl %ebx
+ movl %ebx, G(calling_conventions_eflags)
-ifdef(`PIC',`
- LEA( G(calling_conventions_fenv), %ecx)
- fstenv (%ecx)
-',`
fstenv G(calling_conventions_fenv)
-')
finit
- ret
+ movl G(calling_conventions_save_ebx), %ebx
+ movl G(calling_conventions_save_esi), %esi
+ movl G(calling_conventions_save_edi), %edi
+ movl G(calling_conventions_save_ebp), %ebp
+
+ jmp *G(calling_conventions_retaddr)
EPILOGUE()
+
diff --git a/gmp/tests/x86check.c b/gmp/tests/x86check.c
index 067c8155b9..dfebd7a98c 100644
--- a/gmp/tests/x86check.c
+++ b/gmp/tests/x86check.c
@@ -1,22 +1,22 @@
/* x86 calling conventions checking. */
/*
-Copyright 2000, 2001, 2010 Free Software Foundation, Inc.
+Copyright 2000, 2001 Free Software Foundation, Inc.
-This file is part of the GNU MP Library test suite.
+This file is part of the GNU MP Library.
-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 is free software; you can redistribute it and/or modify
+it under the terms of the GNU 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 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.
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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 General Public License along with
-the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
+You should have 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 <stdio.h>
#include "gmp.h"
@@ -24,30 +24,13 @@ the GNU MP Library test suite. If not, see https://www.gnu.org/licenses/. */
#include "tests.h"
-/* Vector if constants and register values. We use one vector to allow access
- via a base pointer, very beneficial for the PIC-enabled amd64call.asm. */
-mp_limb_t calling_conventions_values[17] =
-{
- CNST_LIMB(0x12345678), /* want_ebx */
- CNST_LIMB(0x89ABCDEF), /* want_ebp */
- CNST_LIMB(0xDEADBEEF), /* want_esi */
- CNST_LIMB(0xFFEEDDCC), /* want_edi */
-
- CNST_LIMB(0xFEEDABBA), /* JUNK_EAX */
- CNST_LIMB(0xAB78DE89), /* JUNK_ECX */
- CNST_LIMB(0x12389018) /* JUNK_EDX */
-
- /* rest of array used for dynamic values. */
-};
-
-/* Index starts for various regions in above vector. */
-#define WANT 0
-#define JUNK 4
-#define SAVE 7
-#define RETADDR 11
-#define VAL 12
-#define EFLAGS 16
-
+/* temporaries */
+int calling_conventions_save_ebx;
+int calling_conventions_save_esi;
+int calling_conventions_save_edi;
+int calling_conventions_save_ebp;
+int calling_conventions_retaddr;
+int calling_conventions_retval;
/* values to check */
struct {
@@ -56,6 +39,11 @@ struct {
unsigned tag;
unsigned other[4];
} calling_conventions_fenv;
+int calling_conventions_ebx;
+int calling_conventions_esi;
+int calling_conventions_edi;
+int calling_conventions_ebp;
+int calling_conventions_eflags;
/* expected values, as per x86call.asm */
#define VALUE_EBX 0x01234567
@@ -63,9 +51,6 @@ struct {
#define VALUE_EDI 0xFEDCBA98
#define VALUE_EBP 0x76543210
-
-const char *regname[] = {"ebx", "ebp", "esi", "edi"};
-
#define DIR_BIT(eflags) (((eflags) & (1<<10)) != 0)
@@ -76,7 +61,6 @@ calling_conventions_check (void)
{
const char *header = "Violated calling conventions:\n";
int ret = 1;
- int i;
#define CHECK(callreg, regstr, value) \
if (callreg != value) \
@@ -87,15 +71,15 @@ calling_conventions_check (void)
ret = 0; \
}
- for (i = 0; i < 4; i++)
- {
- CHECK (calling_conventions_values[VAL+i], regname[i], calling_conventions_values[WANT+i]);
- }
+ CHECK (calling_conventions_ebx, "ebx", VALUE_EBX);
+ CHECK (calling_conventions_esi, "esi", VALUE_ESI);
+ CHECK (calling_conventions_edi, "edi", VALUE_EDI);
+ CHECK (calling_conventions_ebp, "ebp", VALUE_EBP);
- if (DIR_BIT (calling_conventions_values[EFLAGS]) != 0)
+ if (DIR_BIT (calling_conventions_eflags) != 0)
{
printf ("%s eflags dir bit got %d want 0\n",
- header, DIR_BIT (calling_conventions_values[EFLAGS]));
+ header, DIR_BIT (calling_conventions_eflags));
header = "";
ret = 0;
}
diff --git a/gmp/tune/Makefile.am b/gmp/tune/Makefile.am
index bbe503a201..3c7f62c820 100644
--- a/gmp/tune/Makefile.am
+++ b/gmp/tune/Makefile.am
@@ -1,32 +1,21 @@
## Process this file with automake to generate Makefile.in
-# Copyright 2000-2003, 2005-2011 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2005 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
@@ -52,14 +41,13 @@ 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 \
+ 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 \
- jacbase1.c jacbase2.c jacbase3.c jacbase4.c \
- mod_1_div.c mod_1_inv.c mod_1_1-1.c mod_1_1-2.c modlinv.c \
+ jacbase1.c jacbase2.c jacbase3.c \
+ mod_1_div.c mod_1_inv.c modlinv.c \
noop.c powm_mod.c powm_redc.c pre_divrem_1.c \
- set_strb.c set_strs.c set_strp.c time.c
+ set_strb.c set_strs.c set_strp.c time.c \
+ sb_div.c sb_inv.c
libspeed_la_DEPENDENCIES = $(SPEED_CYCLECOUNTER_OBJ) \
$(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
@@ -81,10 +69,10 @@ $(top_builddir)/tests/libtests.la:
# program. This can always be forced with "make speed_LDFLAGS=-all-static
# ..." if desired, see tune/README.
-EXTRA_PROGRAMS = speed speed-dynamic speed-ext tuneup tune-gcd-p
+EXTRA_PROGRAMS = speed speed-dynamic speed-ext tuneup
DEPENDENCIES = libspeed.la
-LDADD = $(DEPENDENCIES) $(TUNE_LIBS)
+LDADD = $(DEPENDENCIES)
speed_SOURCES = speed.c
speed_LDFLAGS = $(STATIC)
@@ -95,15 +83,11 @@ speed_ext_SOURCES = speed-ext.c
speed_ext_LDFLAGS = $(STATIC)
tuneup_SOURCES = tuneup.c
-nodist_tuneup_SOURCES = sqr_basecase.c fac_ui.c $(TUNE_MPN_SRCS)
+nodist_tuneup_SOURCES = sqr_basecase.c $(TUNE_MPN_SRCS)
tuneup_DEPENDENCIES = $(TUNE_SQR_OBJ) libspeed.la
-tuneup_LDADD = $(tuneup_DEPENDENCIES) $(TUNE_LIBS)
+tuneup_LDADD = $(tuneup_DEPENDENCIES)
tuneup_LDFLAGS = $(STATIC)
-tune_gcd_p_SOURCES = tune-gcd-p.c
-tune_gcd_p_DEPENDENCIES = ../mpn/gcd.c
-tune_gcd_p_LDFLAGS = $(STATIC)
-
tune:
$(MAKE) $(AM_MAKEFLAGS) tuneup$(EXEEXT)
@@ -113,7 +97,7 @@ allprogs: $(EXTRA_PROGRAMS)
# $(MANY_CLEAN) and $(MANY_DISTCLEAN) are hooks for many.pl
CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) \
- $(TUNE_MPN_SRCS) fac_ui.c sqr_asm.asm \
+ $(TUNE_MPN_SRCS) sqr_asm.asm \
stg.gnuplot stg.data \
mtg.gnuplot mtg.data \
fibg.gnuplot fibg.data \
@@ -139,16 +123,9 @@ DISTCLEANFILES = sqr_basecase.c $(MANY_DISTCLEAN)
# recompiled object will be rebuilt if that file changes.
TUNE_MPN_SRCS = $(TUNE_MPN_SRCS_BASIC) divrem_1.c mod_1.c
-TUNE_MPN_SRCS_BASIC = div_qr_2.c bdiv_q.c bdiv_qr.c \
- dcpi1_div_qr.c dcpi1_divappr_q.c dcpi1_bdiv_qr.c dcpi1_bdiv_q.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 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 \
- toom22_mul.c toom2_sqr.c toom33_mul.c toom3_sqr.c toom44_mul.c toom4_sqr.c
+TUNE_MPN_SRCS_BASIC = dc_divrem_n.c divrem_2.c gcd.c gcdext.c get_str.c \
+ set_str.c matrix22_mul.c hgcd.c mul_n.c toom44_mul.c toom4_sqr.c \
+ mullow_n.c mul_fft.c mul.c sb_divrem_mn.c tdiv_qr.c
$(TUNE_MPN_SRCS_BASIC):
for i in $(TUNE_MPN_SRCS_BASIC); do \
@@ -167,15 +144,60 @@ mod_1.c:
echo "#include \"mpn/generic/mod_1.c\"" >>mod_1.c
sqr_asm.asm: $(top_builddir)/mpn/sqr_basecase.asm
- echo 'define(SQR_TOOM2_THRESHOLD_OVERRIDE,SQR_TOOM2_THRESHOLD_MAX)' >sqr_asm.asm
+ echo 'define(SQR_KARATSUBA_THRESHOLD_OVERRIDE,SQR_KARATSUBA_THRESHOLD_MAX)' >sqr_asm.asm
echo 'include(../mpn/sqr_basecase.asm)' >>sqr_asm.asm
-# FIXME: Should it depend on $(top_builddir)/fac_ui.h too?
-fac_ui.c: $(top_builddir)/mpz/fac_ui.c
- echo "#define TUNE_PROGRAM_BUILD 1" >fac_ui.c
- echo "#define __gmpz_fac_ui mpz_fac_ui_tune" >>fac_ui.c
- echo "#define __gmpz_oddfac_1 mpz_oddfac_1_tune" >>fac_ui.c
- echo "#include \"mpz/oddfac_1.c\"" >>fac_ui.c
- echo "#include \"mpz/fac_ui.c\"" >>fac_ui.c
include ../mpn/Makeasm.am
+
+
+# "mk" is multiplication in the karatsuba range
+# "st" is squaring in the toom-cook range, etc
+# "g" forms produce graphs
+
+mk:
+ ./speed -s 5-40 -c mpn_mul_basecase mpn_kara_mul_n
+
+MTS = -s 50-150 -c
+mt:
+ ./speed $(MTS) mpn_kara_mul_n mpn_toom3_mul_n
+mtg:
+ ./speed $(MTS) -P mtg mpn_kara_mul_n mpn_toom3_mul_n
+
+sk:
+ ./speed -s 5-40 -c mpn_sqr_basecase mpn_kara_sqr_n
+
+STS = -s 50-150 -c
+st:
+ ./speed $(STS) mpn_kara_sqr_n mpn_toom3_sqr_n
+stg:
+ ./speed $(STS) -P stg mpn_kara_sqr_n mpn_toom3_sqr_n
+
+dc:
+ ./speed -s 5-40 -c mpn_dc_divrem_sb mpn_dc_divrem_n mpn_dc_tdiv_qr
+
+fib:
+ ./speed -s 40-60 -c mpz_fib_ui
+fibg:
+ ./speed -s 10-300 -P fibg mpz_fib_ui
+
+
+gcd:
+ ./speed -s 1-20 -c mpn_gcd
+
+udiv:
+ ./speed -s 1 -c udiv_qrnnd udiv_qrnnd_preinv udiv_qrnnd_preinv2norm invert_limb udiv_qrnnd_c
+
+divn:
+ ./speed -s 1-30 -c mpn_divrem_1_div.-1 mpn_divrem_1_inv.-1
+divun:
+ ./speed -s 1-30 -c mpn_divrem_1_div.12345 mpn_divrem_1_inv.12345
+modn:
+ ./speed -s 1-30 -c mpn_mod_1_div.-1 mpn_mod_1_inv.-1
+modun:
+ ./speed -s 1-30 -c mpn_mod_1_div.12345 mpn_mod_1_inv.12345
+
+
+graph:
+ ./speed -s 1-5000 -f 1.02 -P graph mpn_mul_n mpn_sqr
+ gnuplot graph.gnuplot
diff --git a/gmp/tune/Makefile.in b/gmp/tune/Makefile.in
index 07abb022a3..c3698319d9 100644
--- a/gmp/tune/Makefile.in
+++ b/gmp/tune/Makefile.in
@@ -1,9 +1,8 @@
-# Makefile.in generated by automake 1.11.6 from Makefile.am.
+# Makefile.in generated by automake 1.8.4 from Makefile.am.
# @configure_input@
# Copyright (C) 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002,
-# 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 Free Software
-# Foundation, Inc.
+# 2003, 2004 Free Software Foundation, Inc.
# This Makefile.in is free software; the Free Software Foundation
# gives unlimited permission to copy and/or distribute it,
# with or without modifications, as long as this notice is preserved.
@@ -15,85 +14,52 @@
@SET_MAKE@
-# Copyright 2000-2003, 2005-2011 Free Software Foundation, Inc.
+# Copyright 2000, 2001, 2002, 2003, 2005 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have 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 1996, 1998-2002 Free Software Foundation, Inc.
-#
-# This file is part of the GNU MP Library.
+# Copyright 1996, 1998, 1999, 2000, 2001, 2002 Free Software Foundation,
+# Inc.
#
-# The GNU MP Library is free software; you can redistribute it and/or modify
-# it under the terms of either:
+# This file is part of the GNU MP Library.
#
-# * the GNU 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 the GNU Lesser General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or (at your
+# option) any later version.
#
-# or
+# The GNU MP Library is distributed in the hope that it will be useful, but
+# WITHOUT ANY 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 General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
+SOURCES = $(libspeed_la_SOURCES) $(speed_SOURCES) $(speed_dynamic_SOURCES) $(speed_ext_SOURCES) $(tuneup_SOURCES) $(nodist_tuneup_SOURCES)
+
+srcdir = @srcdir@
+top_srcdir = @top_srcdir@
VPATH = @srcdir@
-am__make_dryrun = \
- { \
- am__dry=no; \
- case $$MAKEFLAGS in \
- *\\[\ \ ]*) \
- echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
- | grep '^AM OK$$' >/dev/null || am__dry=yes;; \
- *) \
- for am__flg in $$MAKEFLAGS; do \
- case $$am__flg in \
- *=*|--*) ;; \
- *n*) am__dry=yes; break;; \
- esac; \
- done;; \
- esac; \
- test $$am__dry = yes; \
- }
pkgdatadir = $(datadir)/@PACKAGE@
-pkgincludedir = $(includedir)/@PACKAGE@
pkglibdir = $(libdir)/@PACKAGE@
-pkglibexecdir = $(libexecdir)/@PACKAGE@
+pkgincludedir = $(includedir)/@PACKAGE@
+top_builddir = ..
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
+INSTALL = @INSTALL@
install_sh_DATA = $(install_sh) -c -m 644
install_sh_PROGRAM = $(install_sh) -c
install_sh_SCRIPT = $(install_sh) -c
@@ -105,110 +71,74 @@ POST_INSTALL = :
NORMAL_UNINSTALL = :
PRE_UNINSTALL = :
POST_UNINSTALL = :
-build_triplet = @build@
host_triplet = @host@
+ANSI2KNR = $(top_builddir)/ansi2knr
EXTRA_PROGRAMS = speed$(EXEEXT) speed-dynamic$(EXEEXT) \
- speed-ext$(EXEEXT) tuneup$(EXEEXT) tune-gcd-p$(EXEEXT)
+ speed-ext$(EXEEXT) tuneup$(EXEEXT)
DIST_COMMON = README $(noinst_HEADERS) $(srcdir)/../mpn/Makeasm.am \
$(srcdir)/Makefile.am $(srcdir)/Makefile.in
subdir = tune
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
am__aclocal_m4_deps = $(top_srcdir)/acinclude.m4 \
- $(top_srcdir)/configure.ac
+ $(top_srcdir)/configure.in
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
$(ACLOCAL_M4)
-mkinstalldirs = $(install_sh) -d
+mkinstalldirs = $(mkdir_p)
CONFIG_HEADER = $(top_builddir)/config.h
CONFIG_CLEAN_FILES =
-CONFIG_CLEAN_VPATH_FILES =
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 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 \
- mod_1_inv.lo mod_1_1-1.lo mod_1_1-2.lo modlinv.lo noop.lo \
- powm_mod.lo powm_redc.lo pre_divrem_1.lo set_strb.lo \
- set_strs.lo set_strp.lo time.lo
+am_libspeed_la_OBJECTS = common$U.lo divrem1div$U.lo divrem1inv$U.lo \
+ divrem2div$U.lo divrem2inv$U.lo freq$U.lo gcdext_single$U.lo \
+ gcdext_double$U.lo gcdextod$U.lo gcdextos$U.lo jacbase1$U.lo \
+ jacbase2$U.lo jacbase3$U.lo mod_1_div$U.lo mod_1_inv$U.lo \
+ modlinv$U.lo noop$U.lo powm_mod$U.lo powm_redc$U.lo \
+ pre_divrem_1$U.lo set_strb$U.lo set_strs$U.lo set_strp$U.lo \
+ time$U.lo sb_div$U.lo sb_inv$U.lo
libspeed_la_OBJECTS = $(am_libspeed_la_OBJECTS)
-libspeed_la_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(libspeed_la_LDFLAGS) $(LDFLAGS) -o $@
-am_speed_OBJECTS = speed.$(OBJEXT)
+am_speed_OBJECTS = speed$U.$(OBJEXT)
speed_OBJECTS = $(am_speed_OBJECTS)
speed_LDADD = $(LDADD)
-speed_DEPENDENCIES = $(DEPENDENCIES) $(am__DEPENDENCIES_1)
-speed_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(speed_LDFLAGS) \
- $(LDFLAGS) -o $@
-am_speed_dynamic_OBJECTS = speed.$(OBJEXT)
+am__DEPENDENCIES_3 = libspeed.la
+speed_DEPENDENCIES = $(am__DEPENDENCIES_3)
+am_speed_dynamic_OBJECTS = speed$U.$(OBJEXT)
speed_dynamic_OBJECTS = $(am_speed_dynamic_OBJECTS)
speed_dynamic_LDADD = $(LDADD)
-speed_dynamic_DEPENDENCIES = $(DEPENDENCIES) $(am__DEPENDENCIES_1)
-am_speed_ext_OBJECTS = speed-ext.$(OBJEXT)
+speed_dynamic_DEPENDENCIES = $(am__DEPENDENCIES_3)
+am_speed_ext_OBJECTS = speed-ext$U.$(OBJEXT)
speed_ext_OBJECTS = $(am_speed_ext_OBJECTS)
speed_ext_LDADD = $(LDADD)
-speed_ext_DEPENDENCIES = $(DEPENDENCIES) $(am__DEPENDENCIES_1)
-speed_ext_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(speed_ext_LDFLAGS) $(LDFLAGS) -o $@
-am_tune_gcd_p_OBJECTS = tune-gcd-p.$(OBJEXT)
-tune_gcd_p_OBJECTS = $(am_tune_gcd_p_OBJECTS)
-tune_gcd_p_LDADD = $(LDADD)
-tune_gcd_p_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) \
- $(LIBTOOLFLAGS) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
- $(tune_gcd_p_LDFLAGS) $(LDFLAGS) -o $@
-am_tuneup_OBJECTS = tuneup.$(OBJEXT)
-am__objects_1 = div_qr_2.$(OBJEXT) bdiv_q.$(OBJEXT) bdiv_qr.$(OBJEXT) \
- dcpi1_div_qr.$(OBJEXT) dcpi1_divappr_q.$(OBJEXT) \
- dcpi1_bdiv_qr.$(OBJEXT) dcpi1_bdiv_q.$(OBJEXT) \
- invertappr.$(OBJEXT) invert.$(OBJEXT) binvert.$(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) 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) \
- nussbaumer_mul.$(OBJEXT) toom6h_mul.$(OBJEXT) \
- toom8h_mul.$(OBJEXT) toom6_sqr.$(OBJEXT) toom8_sqr.$(OBJEXT) \
- toom22_mul.$(OBJEXT) toom2_sqr.$(OBJEXT) toom33_mul.$(OBJEXT) \
- toom3_sqr.$(OBJEXT) toom44_mul.$(OBJEXT) toom4_sqr.$(OBJEXT)
-am__objects_2 = $(am__objects_1) divrem_1.$(OBJEXT) mod_1.$(OBJEXT)
-nodist_tuneup_OBJECTS = sqr_basecase.$(OBJEXT) fac_ui.$(OBJEXT) \
- $(am__objects_2)
+speed_ext_DEPENDENCIES = $(am__DEPENDENCIES_3)
+am_tuneup_OBJECTS = tuneup$U.$(OBJEXT)
+am__objects_1 = dc_divrem_n$U.$(OBJEXT) divrem_2$U.$(OBJEXT) \
+ gcd$U.$(OBJEXT) gcdext$U.$(OBJEXT) get_str$U.$(OBJEXT) \
+ set_str$U.$(OBJEXT) matrix22_mul$U.$(OBJEXT) hgcd$U.$(OBJEXT) \
+ mul_n$U.$(OBJEXT) toom44_mul$U.$(OBJEXT) toom4_sqr$U.$(OBJEXT) \
+ mullow_n$U.$(OBJEXT) mul_fft$U.$(OBJEXT) mul$U.$(OBJEXT) \
+ sb_divrem_mn$U.$(OBJEXT) tdiv_qr$U.$(OBJEXT)
+am__objects_2 = $(am__objects_1) divrem_1$U.$(OBJEXT) \
+ mod_1$U.$(OBJEXT)
+nodist_tuneup_OBJECTS = sqr_basecase$U.$(OBJEXT) $(am__objects_2)
tuneup_OBJECTS = $(am_tuneup_OBJECTS) $(nodist_tuneup_OBJECTS)
-am__DEPENDENCIES_3 = $(am__DEPENDENCIES_1) libspeed.la
-tuneup_LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(tuneup_LDFLAGS) \
- $(LDFLAGS) -o $@
-DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)
+am__DEPENDENCIES_4 = $(am__DEPENDENCIES_1) libspeed.la
+DEFAULT_INCLUDES = -I. -I$(srcdir) -I$(top_builddir)
depcomp =
am__depfiles_maybe =
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
-LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
- $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
+LTCOMPILE = $(LIBTOOL) --mode=compile $(CC) $(DEFS) \
+ $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) \
+ $(AM_CFLAGS) $(CFLAGS)
CCLD = $(CC)
-LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
- --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
- $(LDFLAGS) -o $@
+LINK = $(LIBTOOL) --mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) \
+ $(AM_LDFLAGS) $(LDFLAGS) -o $@
SOURCES = $(libspeed_la_SOURCES) $(speed_SOURCES) \
$(speed_dynamic_SOURCES) $(speed_ext_SOURCES) \
- $(tune_gcd_p_SOURCES) $(tuneup_SOURCES) \
- $(nodist_tuneup_SOURCES)
+ $(tuneup_SOURCES) $(nodist_tuneup_SOURCES)
DIST_SOURCES = $(libspeed_la_SOURCES) $(speed_SOURCES) \
$(speed_dynamic_SOURCES) $(speed_ext_SOURCES) \
- $(tune_gcd_p_SOURCES) $(tuneup_SOURCES)
-am__can_run_installinfo = \
- case $$AM_UPDATE_INFO_DIR in \
- n|no|NO) false;; \
- *) (install-info --version) >/dev/null 2>&1;; \
- esac
+ $(tuneup_SOURCES)
HEADERS = $(noinst_HEADERS)
ETAGS = etags
CTAGS = ctags
@@ -223,6 +153,7 @@ AUTOCONF = @AUTOCONF@
AUTOHEADER = @AUTOHEADER@
AUTOMAKE = @AUTOMAKE@
AWK = @AWK@
+BITS_PER_MP_LIMB = @BITS_PER_MP_LIMB@
CALLING_CONVENTIONS_OBJS = @CALLING_CONVENTIONS_OBJS@
CC = @CC@
CCAS = @CCAS@
@@ -238,17 +169,16 @@ CYGPATH_W = @CYGPATH_W@
DEFN_LONG_LONG_LIMB = @DEFN_LONG_LONG_LIMB@
DEFS = @DEFS@
DLLTOOL = @DLLTOOL@
-DSYMUTIL = @DSYMUTIL@
-DUMPBIN = @DUMPBIN@
+ECHO = @ECHO@
ECHO_C = @ECHO_C@
ECHO_N = @ECHO_N@
ECHO_T = @ECHO_T@
EGREP = @EGREP@
+ENABLE_STATIC_FALSE = @ENABLE_STATIC_FALSE@
+ENABLE_STATIC_TRUE = @ENABLE_STATIC_TRUE@
EXEEXT = @EXEEXT@
EXEEXT_FOR_BUILD = @EXEEXT_FOR_BUILD@
-FGREP = @FGREP@
GMP_LDFLAGS = @GMP_LDFLAGS@
-GMP_LIMB_BITS = @GMP_LIMB_BITS@
GMP_NAIL_BITS = @GMP_NAIL_BITS@
GREP = @GREP@
HAVE_CLOCK_01 = @HAVE_CLOCK_01@
@@ -262,12 +192,10 @@ HAVE_SIGALTSTACK_01 = @HAVE_SIGALTSTACK_01@
HAVE_SIGSTACK_01 = @HAVE_SIGSTACK_01@
HAVE_STACK_T_01 = @HAVE_STACK_T_01@
HAVE_SYS_RESOURCE_H_01 = @HAVE_SYS_RESOURCE_H_01@
-INSTALL = @INSTALL@
INSTALL_DATA = @INSTALL_DATA@
INSTALL_PROGRAM = @INSTALL_PROGRAM@
INSTALL_SCRIPT = @INSTALL_SCRIPT@
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
-LD = @LD@
LDFLAGS = @LDFLAGS@
LEX = @LEX@
LEXLIB = @LEXLIB@
@@ -282,26 +210,20 @@ LIBOBJS = @LIBOBJS@
LIBREADLINE = @LIBREADLINE@
LIBS = @LIBS@
LIBTOOL = @LIBTOOL@
-LIPO = @LIPO@
LN_S = @LN_S@
LTLIBOBJS = @LTLIBOBJS@
M4 = @M4@
MAINT = @MAINT@
+MAINTAINER_MODE_FALSE = @MAINTAINER_MODE_FALSE@
+MAINTAINER_MODE_TRUE = @MAINTAINER_MODE_TRUE@
MAKEINFO = @MAKEINFO@
-MANIFEST_TOOL = @MANIFEST_TOOL@
-MKDIR_P = @MKDIR_P@
-NM = @NM@
-NMEDIT = @NMEDIT@
OBJDUMP = @OBJDUMP@
OBJEXT = @OBJEXT@
-OTOOL = @OTOOL@
-OTOOL64 = @OTOOL64@
PACKAGE = @PACKAGE@
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
PACKAGE_NAME = @PACKAGE_NAME@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
-PACKAGE_URL = @PACKAGE_URL@
PACKAGE_VERSION = @PACKAGE_VERSION@
PATH_SEPARATOR = @PATH_SEPARATOR@
RANLIB = @RANLIB@
@@ -311,31 +233,26 @@ SHELL = @SHELL@
SPEED_CYCLECOUNTER_OBJ = @SPEED_CYCLECOUNTER_OBJ@
STRIP = @STRIP@
TAL_OBJECT = @TAL_OBJECT@
-TUNE_LIBS = @TUNE_LIBS@
TUNE_SQR_OBJ = @TUNE_SQR_OBJ@
+U = @U@
U_FOR_BUILD = @U_FOR_BUILD@
VERSION = @VERSION@
+WANT_CXX_FALSE = @WANT_CXX_FALSE@
+WANT_CXX_TRUE = @WANT_CXX_TRUE@
+WANT_MPBSD_FALSE = @WANT_MPBSD_FALSE@
+WANT_MPBSD_TRUE = @WANT_MPBSD_TRUE@
WITH_READLINE_01 = @WITH_READLINE_01@
YACC = @YACC@
YFLAGS = @YFLAGS@
-abs_builddir = @abs_builddir@
-abs_srcdir = @abs_srcdir@
-abs_top_builddir = @abs_top_builddir@
-abs_top_srcdir = @abs_top_srcdir@
-ac_ct_AR = @ac_ct_AR@
ac_ct_CC = @ac_ct_CC@
ac_ct_CXX = @ac_ct_CXX@
-ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
am__leading_dot = @am__leading_dot@
-am__tar = @am__tar@
-am__untar = @am__untar@
bindir = @bindir@
build = @build@
build_alias = @build_alias@
build_cpu = @build_cpu@
build_os = @build_os@
build_vendor = @build_vendor@
-builddir = @builddir@
datadir = @datadir@
datarootdir = @datarootdir@
docdir = @docdir@
@@ -359,6 +276,7 @@ mandir = @mandir@
mkdir_p = @mkdir_p@
mpn_objects = @mpn_objects@
mpn_objs_in_libgmp = @mpn_objs_in_libgmp@
+mpn_objs_in_libmp = @mpn_objs_in_libmp@
oldincludedir = @oldincludedir@
pdfdir = @pdfdir@
prefix = @prefix@
@@ -366,12 +284,8 @@ program_transform_name = @program_transform_name@
psdir = @psdir@
sbindir = @sbindir@
sharedstatedir = @sharedstatedir@
-srcdir = @srcdir@
sysconfdir = @sysconfdir@
target_alias = @target_alias@
-top_build_prefix = @top_build_prefix@
-top_builddir = @top_builddir@
-top_srcdir = @top_srcdir@
INCLUDES = -I$(top_srcdir) -I$(top_srcdir)/tests
EXTRA_DIST = alpha.asm pentium.asm sparcv9.asm hppa.asm hppa2.asm hppa2w.asm \
ia64.asm powerpc.asm powerpc64.asm x86_64.asm many.pl
@@ -389,14 +303,13 @@ 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 \
+ 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 \
- jacbase1.c jacbase2.c jacbase3.c jacbase4.c \
- mod_1_div.c mod_1_inv.c mod_1_1-1.c mod_1_1-2.c modlinv.c \
+ jacbase1.c jacbase2.c jacbase3.c \
+ mod_1_div.c mod_1_inv.c modlinv.c \
noop.c powm_mod.c powm_redc.c pre_divrem_1.c \
- set_strb.c set_strs.c set_strp.c time.c
+ set_strb.c set_strs.c set_strp.c time.c \
+ sb_div.c sb_inv.c
libspeed_la_DEPENDENCIES = $(SPEED_CYCLECOUNTER_OBJ) \
$(top_builddir)/tests/libtests.la $(top_builddir)/libgmp.la
@@ -404,24 +317,21 @@ libspeed_la_DEPENDENCIES = $(SPEED_CYCLECOUNTER_OBJ) \
libspeed_la_LIBADD = $(libspeed_la_DEPENDENCIES) $(LIBM)
libspeed_la_LDFLAGS = $(STATIC)
DEPENDENCIES = libspeed.la
-LDADD = $(DEPENDENCIES) $(TUNE_LIBS)
+LDADD = $(DEPENDENCIES)
speed_SOURCES = speed.c
speed_LDFLAGS = $(STATIC)
speed_dynamic_SOURCES = speed.c
speed_ext_SOURCES = speed-ext.c
speed_ext_LDFLAGS = $(STATIC)
tuneup_SOURCES = tuneup.c
-nodist_tuneup_SOURCES = sqr_basecase.c fac_ui.c $(TUNE_MPN_SRCS)
+nodist_tuneup_SOURCES = sqr_basecase.c $(TUNE_MPN_SRCS)
tuneup_DEPENDENCIES = $(TUNE_SQR_OBJ) libspeed.la
-tuneup_LDADD = $(tuneup_DEPENDENCIES) $(TUNE_LIBS)
+tuneup_LDADD = $(tuneup_DEPENDENCIES)
tuneup_LDFLAGS = $(STATIC)
-tune_gcd_p_SOURCES = tune-gcd-p.c
-tune_gcd_p_DEPENDENCIES = ../mpn/gcd.c
-tune_gcd_p_LDFLAGS = $(STATIC)
# $(MANY_CLEAN) and $(MANY_DISTCLEAN) are hooks for many.pl
CLEANFILES = $(EXTRA_PROGRAMS) $(EXTRA_LTLIBRARIES) \
- $(TUNE_MPN_SRCS) fac_ui.c sqr_asm.asm \
+ $(TUNE_MPN_SRCS) sqr_asm.asm \
stg.gnuplot stg.data \
mtg.gnuplot mtg.data \
fibg.gnuplot fibg.data \
@@ -446,16 +356,9 @@ DISTCLEANFILES = sqr_basecase.c $(MANY_DISTCLEAN)
# FIXME: Would like say mul_n.c to depend on $(top_builddir)/mul_n.c so the
# recompiled object will be rebuilt if that file changes.
TUNE_MPN_SRCS = $(TUNE_MPN_SRCS_BASIC) divrem_1.c mod_1.c
-TUNE_MPN_SRCS_BASIC = div_qr_2.c bdiv_q.c bdiv_qr.c \
- dcpi1_div_qr.c dcpi1_divappr_q.c dcpi1_bdiv_qr.c dcpi1_bdiv_q.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 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 \
- toom22_mul.c toom2_sqr.c toom33_mul.c toom3_sqr.c toom44_mul.c toom4_sqr.c
+TUNE_MPN_SRCS_BASIC = dc_divrem_n.c divrem_2.c gcd.c gcdext.c get_str.c \
+ set_str.c matrix22_mul.c hgcd.c mul_n.c toom44_mul.c toom4_sqr.c \
+ mullow_n.c mul_fft.c mul.c sb_divrem_mn.c tdiv_qr.c
# COMPILE minus CC.
@@ -486,6 +389,8 @@ SUFFIXES = .s .S .asm
# can be overridden during development, eg. "make RM_TMP=: mul_1.lo"
RM_TMP = rm -f
+MTS = -s 50-150 -c
+STS = -s 50-150 -c
all: all-am
.SUFFIXES:
@@ -494,14 +399,14 @@ $(srcdir)/Makefile.in: @MAINTAINER_MODE_TRUE@ $(srcdir)/Makefile.am $(srcdir)/..
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
- ( cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh ) \
- && { if test -f $@; then exit 0; else break; fi; }; \
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh \
+ && exit 0; \
exit 1;; \
esac; \
done; \
- echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tune/Makefile'; \
- $(am__cd) $(top_srcdir) && \
- $(AUTOMAKE) --gnu --ignore-deps tune/Makefile
+ echo ' cd $(top_srcdir) && $(AUTOMAKE) --gnu --ignore-deps tune/Makefile'; \
+ cd $(top_srcdir) && \
+ $(AUTOMAKE) --gnu --ignore-deps tune/Makefile
.PRECIOUS: Makefile
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
@case '$?' in \
@@ -511,7 +416,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__depfiles_maybe);; \
esac;
-$(srcdir)/../mpn/Makeasm.am:
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -520,30 +424,31 @@ $(top_srcdir)/configure: @MAINTAINER_MODE_TRUE@ $(am__configure_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
$(ACLOCAL_M4): @MAINTAINER_MODE_TRUE@ $(am__aclocal_m4_deps)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
-$(am__aclocal_m4_deps):
-libspeed.la: $(libspeed_la_OBJECTS) $(libspeed_la_DEPENDENCIES) $(EXTRA_libspeed_la_DEPENDENCIES)
- $(libspeed_la_LINK) $(libspeed_la_OBJECTS) $(libspeed_la_LIBADD) $(LIBS)
-speed$(EXEEXT): $(speed_OBJECTS) $(speed_DEPENDENCIES) $(EXTRA_speed_DEPENDENCIES)
+libspeed.la: $(libspeed_la_OBJECTS) $(libspeed_la_DEPENDENCIES)
+ $(LINK) $(libspeed_la_LDFLAGS) $(libspeed_la_OBJECTS) $(libspeed_la_LIBADD) $(LIBS)
+speed$(EXEEXT): $(speed_OBJECTS) $(speed_DEPENDENCIES)
@rm -f speed$(EXEEXT)
- $(speed_LINK) $(speed_OBJECTS) $(speed_LDADD) $(LIBS)
-speed-dynamic$(EXEEXT): $(speed_dynamic_OBJECTS) $(speed_dynamic_DEPENDENCIES) $(EXTRA_speed_dynamic_DEPENDENCIES)
+ $(LINK) $(speed_LDFLAGS) $(speed_OBJECTS) $(speed_LDADD) $(LIBS)
+speed-dynamic$(EXEEXT): $(speed_dynamic_OBJECTS) $(speed_dynamic_DEPENDENCIES)
@rm -f speed-dynamic$(EXEEXT)
- $(LINK) $(speed_dynamic_OBJECTS) $(speed_dynamic_LDADD) $(LIBS)
-speed-ext$(EXEEXT): $(speed_ext_OBJECTS) $(speed_ext_DEPENDENCIES) $(EXTRA_speed_ext_DEPENDENCIES)
+ $(LINK) $(speed_dynamic_LDFLAGS) $(speed_dynamic_OBJECTS) $(speed_dynamic_LDADD) $(LIBS)
+speed-ext$(EXEEXT): $(speed_ext_OBJECTS) $(speed_ext_DEPENDENCIES)
@rm -f speed-ext$(EXEEXT)
- $(speed_ext_LINK) $(speed_ext_OBJECTS) $(speed_ext_LDADD) $(LIBS)
-tune-gcd-p$(EXEEXT): $(tune_gcd_p_OBJECTS) $(tune_gcd_p_DEPENDENCIES) $(EXTRA_tune_gcd_p_DEPENDENCIES)
- @rm -f tune-gcd-p$(EXEEXT)
- $(tune_gcd_p_LINK) $(tune_gcd_p_OBJECTS) $(tune_gcd_p_LDADD) $(LIBS)
-tuneup$(EXEEXT): $(tuneup_OBJECTS) $(tuneup_DEPENDENCIES) $(EXTRA_tuneup_DEPENDENCIES)
+ $(LINK) $(speed_ext_LDFLAGS) $(speed_ext_OBJECTS) $(speed_ext_LDADD) $(LIBS)
+tuneup$(EXEEXT): $(tuneup_OBJECTS) $(tuneup_DEPENDENCIES)
@rm -f tuneup$(EXEEXT)
- $(tuneup_LINK) $(tuneup_OBJECTS) $(tuneup_LDADD) $(LIBS)
+ $(LINK) $(tuneup_LDFLAGS) $(tuneup_OBJECTS) $(tuneup_LDADD) $(LIBS)
mostlyclean-compile:
-rm -f *.$(OBJEXT)
distclean-compile:
-rm -f *.tab.c
+$(top_builddir)/ansi2knr:
+ cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) ansi2knr
+
+mostlyclean-kr:
+ -test "$U" = "" || rm -f *_.c
.c.o:
$(COMPILE) -c $<
@@ -553,6 +458,127 @@ distclean-compile:
.c.lo:
$(LTCOMPILE) -c -o $@ $<
+common_.c: common.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/common.c; then echo $(srcdir)/common.c; else echo common.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+dc_divrem_n_.c: dc_divrem_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/dc_divrem_n.c; then echo $(srcdir)/dc_divrem_n.c; else echo dc_divrem_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem1div_.c: divrem1div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem1div.c; then echo $(srcdir)/divrem1div.c; else echo divrem1div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem1inv_.c: divrem1inv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem1inv.c; then echo $(srcdir)/divrem1inv.c; else echo divrem1inv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem2div_.c: divrem2div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem2div.c; then echo $(srcdir)/divrem2div.c; else echo divrem2div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem2inv_.c: divrem2inv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem2inv.c; then echo $(srcdir)/divrem2inv.c; else echo divrem2inv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem_1_.c: divrem_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem_1.c; then echo $(srcdir)/divrem_1.c; else echo divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+divrem_2_.c: divrem_2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/divrem_2.c; then echo $(srcdir)/divrem_2.c; else echo divrem_2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+freq_.c: freq.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/freq.c; then echo $(srcdir)/freq.c; else echo freq.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcd_.c: gcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcd.c; then echo $(srcdir)/gcd.c; else echo gcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcdext_.c: gcdext.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdext.c; then echo $(srcdir)/gcdext.c; else echo gcdext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcdext_double_.c: gcdext_double.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdext_double.c; then echo $(srcdir)/gcdext_double.c; else echo gcdext_double.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcdext_single_.c: gcdext_single.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdext_single.c; then echo $(srcdir)/gcdext_single.c; else echo gcdext_single.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcdextod_.c: gcdextod.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdextod.c; then echo $(srcdir)/gcdextod.c; else echo gcdextod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+gcdextos_.c: gcdextos.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/gcdextos.c; then echo $(srcdir)/gcdextos.c; else echo gcdextos.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+get_str_.c: get_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/get_str.c; then echo $(srcdir)/get_str.c; else echo get_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+hgcd_.c: hgcd.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/hgcd.c; then echo $(srcdir)/hgcd.c; else echo hgcd.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+jacbase1_.c: jacbase1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jacbase1.c; then echo $(srcdir)/jacbase1.c; else echo jacbase1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+jacbase2_.c: jacbase2.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jacbase2.c; then echo $(srcdir)/jacbase2.c; else echo jacbase2.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+jacbase3_.c: jacbase3.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/jacbase3.c; then echo $(srcdir)/jacbase3.c; else echo jacbase3.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+matrix22_mul_.c: matrix22_mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/matrix22_mul.c; then echo $(srcdir)/matrix22_mul.c; else echo matrix22_mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_.c: mod_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1.c; then echo $(srcdir)/mod_1.c; else echo mod_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_div_.c: mod_1_div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_div.c; then echo $(srcdir)/mod_1_div.c; else echo mod_1_div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mod_1_inv_.c: mod_1_inv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mod_1_inv.c; then echo $(srcdir)/mod_1_inv.c; else echo mod_1_inv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+modlinv_.c: modlinv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/modlinv.c; then echo $(srcdir)/modlinv.c; else echo modlinv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_.c: mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul.c; then echo $(srcdir)/mul.c; else echo mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_fft_.c: mul_fft.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_fft.c; then echo $(srcdir)/mul_fft.c; else echo mul_fft.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mul_n_.c: mul_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mul_n.c; then echo $(srcdir)/mul_n.c; else echo mul_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+mullow_n_.c: mullow_n.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/mullow_n.c; then echo $(srcdir)/mullow_n.c; else echo mullow_n.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+noop_.c: noop.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/noop.c; then echo $(srcdir)/noop.c; else echo noop.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+powm_mod_.c: powm_mod.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/powm_mod.c; then echo $(srcdir)/powm_mod.c; else echo powm_mod.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+powm_redc_.c: powm_redc.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/powm_redc.c; then echo $(srcdir)/powm_redc.c; else echo powm_redc.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+pre_divrem_1_.c: pre_divrem_1.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/pre_divrem_1.c; then echo $(srcdir)/pre_divrem_1.c; else echo pre_divrem_1.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sb_div_.c: sb_div.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sb_div.c; then echo $(srcdir)/sb_div.c; else echo sb_div.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sb_divrem_mn_.c: sb_divrem_mn.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sb_divrem_mn.c; then echo $(srcdir)/sb_divrem_mn.c; else echo sb_divrem_mn.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sb_inv_.c: sb_inv.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sb_inv.c; then echo $(srcdir)/sb_inv.c; else echo sb_inv.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_str_.c: set_str.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_str.c; then echo $(srcdir)/set_str.c; else echo set_str.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_strb_.c: set_strb.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_strb.c; then echo $(srcdir)/set_strb.c; else echo set_strb.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_strp_.c: set_strp.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_strp.c; then echo $(srcdir)/set_strp.c; else echo set_strp.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+set_strs_.c: set_strs.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/set_strs.c; then echo $(srcdir)/set_strs.c; else echo set_strs.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+speed_.c: speed.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/speed.c; then echo $(srcdir)/speed.c; else echo speed.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+speed-ext_.c: speed-ext.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/speed-ext.c; then echo $(srcdir)/speed-ext.c; else echo speed-ext.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+sqr_basecase_.c: sqr_basecase.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/sqr_basecase.c; then echo $(srcdir)/sqr_basecase.c; else echo sqr_basecase.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tdiv_qr_.c: tdiv_qr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tdiv_qr.c; then echo $(srcdir)/tdiv_qr.c; else echo tdiv_qr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+time_.c: time.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/time.c; then echo $(srcdir)/time.c; else echo time.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+toom44_mul_.c: toom44_mul.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/toom44_mul.c; then echo $(srcdir)/toom44_mul.c; else echo toom44_mul.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+toom4_sqr_.c: toom4_sqr.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/toom4_sqr.c; then echo $(srcdir)/toom4_sqr.c; else echo toom4_sqr.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+tuneup_.c: tuneup.c $(ANSI2KNR)
+ $(CPP) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) `if test -f $(srcdir)/tuneup.c; then echo $(srcdir)/tuneup.c; else echo tuneup.c; fi` | sed 's/^# \([0-9]\)/#line \1/' | $(ANSI2KNR) > $@ || rm -f $@
+common_.$(OBJEXT) common_.lo dc_divrem_n_.$(OBJEXT) dc_divrem_n_.lo \
+divrem1div_.$(OBJEXT) divrem1div_.lo divrem1inv_.$(OBJEXT) \
+divrem1inv_.lo divrem2div_.$(OBJEXT) divrem2div_.lo \
+divrem2inv_.$(OBJEXT) divrem2inv_.lo divrem_1_.$(OBJEXT) divrem_1_.lo \
+divrem_2_.$(OBJEXT) divrem_2_.lo freq_.$(OBJEXT) freq_.lo \
+gcd_.$(OBJEXT) gcd_.lo gcdext_.$(OBJEXT) gcdext_.lo \
+gcdext_double_.$(OBJEXT) gcdext_double_.lo gcdext_single_.$(OBJEXT) \
+gcdext_single_.lo gcdextod_.$(OBJEXT) gcdextod_.lo gcdextos_.$(OBJEXT) \
+gcdextos_.lo get_str_.$(OBJEXT) get_str_.lo hgcd_.$(OBJEXT) hgcd_.lo \
+jacbase1_.$(OBJEXT) jacbase1_.lo jacbase2_.$(OBJEXT) jacbase2_.lo \
+jacbase3_.$(OBJEXT) jacbase3_.lo matrix22_mul_.$(OBJEXT) \
+matrix22_mul_.lo mod_1_.$(OBJEXT) mod_1_.lo mod_1_div_.$(OBJEXT) \
+mod_1_div_.lo mod_1_inv_.$(OBJEXT) mod_1_inv_.lo modlinv_.$(OBJEXT) \
+modlinv_.lo mul_.$(OBJEXT) mul_.lo mul_fft_.$(OBJEXT) mul_fft_.lo \
+mul_n_.$(OBJEXT) mul_n_.lo mullow_n_.$(OBJEXT) mullow_n_.lo \
+noop_.$(OBJEXT) noop_.lo powm_mod_.$(OBJEXT) powm_mod_.lo \
+powm_redc_.$(OBJEXT) powm_redc_.lo pre_divrem_1_.$(OBJEXT) \
+pre_divrem_1_.lo sb_div_.$(OBJEXT) sb_div_.lo sb_divrem_mn_.$(OBJEXT) \
+sb_divrem_mn_.lo sb_inv_.$(OBJEXT) sb_inv_.lo set_str_.$(OBJEXT) \
+set_str_.lo set_strb_.$(OBJEXT) set_strb_.lo set_strp_.$(OBJEXT) \
+set_strp_.lo set_strs_.$(OBJEXT) set_strs_.lo speed_.$(OBJEXT) \
+speed_.lo speed-ext_.$(OBJEXT) speed-ext_.lo sqr_basecase_.$(OBJEXT) \
+sqr_basecase_.lo tdiv_qr_.$(OBJEXT) tdiv_qr_.lo time_.$(OBJEXT) \
+time_.lo toom44_mul_.$(OBJEXT) toom44_mul_.lo toom4_sqr_.$(OBJEXT) \
+toom4_sqr_.lo tuneup_.$(OBJEXT) tuneup_.lo : $(ANSI2KNR)
mostlyclean-libtool:
-rm -f *.lo
@@ -560,85 +586,83 @@ mostlyclean-libtool:
clean-libtool:
-rm -rf .libs _libs
+distclean-libtool:
+ -rm -f libtool
+uninstall-info-am:
+
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES)
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
mkid -fID $$unique
tags: TAGS
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
- set x; \
+ tags=; \
here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- shift; \
- if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
- test -n "$$unique" || unique=$$empty_fix; \
- if test $$# -gt 0; then \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- "$$@" $$unique; \
- else \
- $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
- $$unique; \
- fi; \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ if test -z "$(ETAGS_ARGS)$$tags$$unique"; then :; else \
+ test -z "$$unique" && unique=$$empty_fix; \
+ $(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
+ $$tags $$unique; \
fi
ctags: CTAGS
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
$(TAGS_FILES) $(LISP)
+ tags=; \
+ here=`pwd`; \
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
unique=`for i in $$list; do \
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
done | \
- $(AWK) '{ files[$$0] = 1; nonempty = 1; } \
- END { if (nonempty) { for (i in files) print i; }; }'`; \
- test -z "$(CTAGS_ARGS)$$unique" \
+ $(AWK) ' { files[$$0] = 1; } \
+ END { for (i in files) print i; }'`; \
+ test -z "$(CTAGS_ARGS)$$tags$$unique" \
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
- $$unique
+ $$tags $$unique
GTAGS:
here=`$(am__cd) $(top_builddir) && pwd` \
- && $(am__cd) $(top_srcdir) \
- && gtags -i $(GTAGS_ARGS) "$$here"
+ && cd $(top_srcdir) \
+ && gtags -i $(GTAGS_ARGS) $$here
distclean-tags:
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
distdir: $(DISTFILES)
- @srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
- list='$(DISTFILES)'; \
- dist_files=`for file in $$list; do echo $$file; done | \
- sed -e "s|^$$srcdirstrip/||;t" \
- -e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
- case $$dist_files in \
- */*) $(MKDIR_P) `echo "$$dist_files" | \
- sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
- sort -u` ;; \
- esac; \
- for file in $$dist_files; do \
+ $(mkdir_p) $(distdir)/../mpn
+ @srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`; \
+ topsrcdirstrip=`echo "$(top_srcdir)" | sed 's|.|.|g'`; \
+ list='$(DISTFILES)'; for file in $$list; do \
+ case $$file in \
+ $(srcdir)/*) file=`echo "$$file" | sed "s|^$$srcdirstrip/||"`;; \
+ $(top_srcdir)/*) file=`echo "$$file" | sed "s|^$$topsrcdirstrip/|$(top_builddir)/|"`;; \
+ esac; \
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
+ dir=`echo "$$file" | sed -e 's,/[^/]*$$,,'`; \
+ if test "$$dir" != "$$file" && test "$$dir" != "."; then \
+ dir="/$$dir"; \
+ $(mkdir_p) "$(distdir)$$dir"; \
+ else \
+ dir=''; \
+ fi; \
if test -d $$d/$$file; then \
- dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
- if test -d "$(distdir)/$$file"; then \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
- fi; \
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
- cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
- find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
+ cp -pR $(srcdir)/$$file $(distdir)$$dir || exit 1; \
fi; \
- cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
+ cp -pR $$d/$$file $(distdir)$$dir || exit 1; \
else \
- test -f "$(distdir)/$$file" \
- || cp -p $$d/$$file "$(distdir)/$$file" \
+ test -f $(distdir)/$$file \
+ || cp -p $$d/$$file $(distdir)/$$file \
|| exit 1; \
fi; \
done
@@ -656,23 +680,17 @@ install-am: all-am
installcheck: installcheck-am
install-strip:
- if test -z '$(STRIP)'; then \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- install; \
- else \
- $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
- install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
- "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
- fi
+ $(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
+ install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
+ `test -z '$(STRIP)' || \
+ echo "INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'"` install
mostlyclean-generic:
clean-generic:
-test -z "$(CLEANFILES)" || rm -f $(CLEANFILES)
distclean-generic:
- -test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
- -test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
+ -rm -f $(CONFIG_CLEAN_FILES)
-test -z "$(DISTCLEANFILES)" || rm -f $(DISTCLEANFILES)
maintainer-clean-generic:
@@ -685,7 +703,7 @@ clean-am: clean-generic clean-libtool mostlyclean-am
distclean: distclean-am
-rm -f Makefile
distclean-am: clean-am distclean-compile distclean-generic \
- distclean-tags
+ distclean-libtool distclean-tags
dvi: dvi-am
@@ -693,38 +711,18 @@ dvi-am:
html: html-am
-html-am:
-
info: info-am
info-am:
install-data-am:
-install-dvi: install-dvi-am
-
-install-dvi-am:
-
install-exec-am:
-install-html: install-html-am
-
-install-html-am:
-
install-info: install-info-am
-install-info-am:
-
install-man:
-install-pdf: install-pdf-am
-
-install-pdf-am:
-
-install-ps: install-ps-am
-
-install-ps-am:
-
installcheck-am:
maintainer-clean: maintainer-clean-am
@@ -733,7 +731,7 @@ maintainer-clean-am: distclean-am maintainer-clean-generic
mostlyclean: mostlyclean-am
-mostlyclean-am: mostlyclean-compile mostlyclean-generic \
+mostlyclean-am: mostlyclean-compile mostlyclean-generic mostlyclean-kr \
mostlyclean-libtool
pdf: pdf-am
@@ -744,22 +742,18 @@ ps: ps-am
ps-am:
-uninstall-am:
-
-.MAKE: install-am install-strip
+uninstall-am: uninstall-info-am
.PHONY: CTAGS GTAGS all all-am check check-am clean clean-generic \
clean-libtool ctags distclean distclean-compile \
distclean-generic distclean-libtool distclean-tags distdir dvi \
dvi-am html html-am info info-am install install-am \
- install-data install-data-am install-dvi install-dvi-am \
- install-exec install-exec-am install-html install-html-am \
- install-info install-info-am install-man install-pdf \
- install-pdf-am install-ps install-ps-am install-strip \
+ install-data install-data-am install-exec install-exec-am \
+ install-info install-info-am install-man install-strip \
installcheck installcheck-am installdirs maintainer-clean \
maintainer-clean-generic mostlyclean mostlyclean-compile \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags uninstall uninstall-am
+ mostlyclean-generic mostlyclean-kr mostlyclean-libtool pdf \
+ pdf-am ps ps-am tags uninstall uninstall-am uninstall-info-am
$(top_builddir)/tests/libtests.la:
@@ -788,17 +782,9 @@ mod_1.c:
echo "#include \"mpn/generic/mod_1.c\"" >>mod_1.c
sqr_asm.asm: $(top_builddir)/mpn/sqr_basecase.asm
- echo 'define(SQR_TOOM2_THRESHOLD_OVERRIDE,SQR_TOOM2_THRESHOLD_MAX)' >sqr_asm.asm
+ echo 'define(SQR_KARATSUBA_THRESHOLD_OVERRIDE,SQR_KARATSUBA_THRESHOLD_MAX)' >sqr_asm.asm
echo 'include(../mpn/sqr_basecase.asm)' >>sqr_asm.asm
-# FIXME: Should it depend on $(top_builddir)/fac_ui.h too?
-fac_ui.c: $(top_builddir)/mpz/fac_ui.c
- echo "#define TUNE_PROGRAM_BUILD 1" >fac_ui.c
- echo "#define __gmpz_fac_ui mpz_fac_ui_tune" >>fac_ui.c
- echo "#define __gmpz_oddfac_1 mpz_oddfac_1_tune" >>fac_ui.c
- echo "#include \"mpz/oddfac_1.c\"" >>fac_ui.c
- echo "#include \"mpz/fac_ui.c\"" >>fac_ui.c
-
# .s assembler, no preprocessing.
#
.s.o:
@@ -855,6 +841,50 @@ fac_ui.c: $(top_builddir)/mpz/fac_ui.c
.asm.lo:
$(LIBTOOL) --mode=compile --tag=CC $(top_srcdir)/mpn/m4-ccas --m4="$(M4)" $(CCAS) $(COMPILE_FLAGS) `test -f '$<' || echo '$(srcdir)/'`$<
+# "mk" is multiplication in the karatsuba range
+# "st" is squaring in the toom-cook range, etc
+# "g" forms produce graphs
+
+mk:
+ ./speed -s 5-40 -c mpn_mul_basecase mpn_kara_mul_n
+mt:
+ ./speed $(MTS) mpn_kara_mul_n mpn_toom3_mul_n
+mtg:
+ ./speed $(MTS) -P mtg mpn_kara_mul_n mpn_toom3_mul_n
+
+sk:
+ ./speed -s 5-40 -c mpn_sqr_basecase mpn_kara_sqr_n
+st:
+ ./speed $(STS) mpn_kara_sqr_n mpn_toom3_sqr_n
+stg:
+ ./speed $(STS) -P stg mpn_kara_sqr_n mpn_toom3_sqr_n
+
+dc:
+ ./speed -s 5-40 -c mpn_dc_divrem_sb mpn_dc_divrem_n mpn_dc_tdiv_qr
+
+fib:
+ ./speed -s 40-60 -c mpz_fib_ui
+fibg:
+ ./speed -s 10-300 -P fibg mpz_fib_ui
+
+gcd:
+ ./speed -s 1-20 -c mpn_gcd
+
+udiv:
+ ./speed -s 1 -c udiv_qrnnd udiv_qrnnd_preinv udiv_qrnnd_preinv2norm invert_limb udiv_qrnnd_c
+
+divn:
+ ./speed -s 1-30 -c mpn_divrem_1_div.-1 mpn_divrem_1_inv.-1
+divun:
+ ./speed -s 1-30 -c mpn_divrem_1_div.12345 mpn_divrem_1_inv.12345
+modn:
+ ./speed -s 1-30 -c mpn_mod_1_div.-1 mpn_mod_1_inv.-1
+modun:
+ ./speed -s 1-30 -c mpn_mod_1_div.12345 mpn_mod_1_inv.12345
+
+graph:
+ ./speed -s 1-5000 -f 1.02 -P graph mpn_mul_n mpn_sqr
+ gnuplot graph.gnuplot
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/gmp/tune/README b/gmp/tune/README
index f76407f7ca..994231d3be 100644
--- a/gmp/tune/README
+++ b/gmp/tune/README
@@ -1,30 +1,19 @@
-Copyright 2000-2002, 2004 Free Software Foundation, Inc.
+Copyright 2000, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
@@ -84,27 +73,6 @@ SCO OpenUNIX 8 /etc/hw
running the speed program repeatedly then set a GMP_CPU_FREQUENCY
environment variable (see TIME BASE section below).
-Timing on GNU/Linux
-
- On Linux, timing currently uses the cycle counter. This is unreliable,
- since the counter is not saved and restored at context switches (unlike
- FreeBSD and Solaris where the cycle counter is "virtualized").
-
- Using the clock_gettime method with CLOCK_PROCESS_CPUTIME_ID (posix) or
- CLOCK_VIRTUAL (BSD) should be more reliable. To get clock_gettime
- with glibc, one has to link with -lrt (which also drags in the pthreads
- threading library). configure.in must be hacked to detect this and
- arrange proper linking. Something like
-
- old_LIBS="$LIBS"
- AC_SEARCH_LIBS(clock_gettime, rt, [AC_DEFINE(HAVE_CLOCK_GETTIME)])
- TUNE_LIBS="$LIBS"
- LIBS="$old_LIBS"
-
- AC_SUBST(TUNE_LIBS)
-
- might work.
-
Low resolution timebase
Parameter tuning can be very time consuming if the only timebase
@@ -117,7 +85,7 @@ Low resolution timebase
PARAMETER TUNING
The "tuneup" program runs some tests designed to find the best settings for
-various thresholds, like MUL_TOOM22_THRESHOLD. Its output can be put
+various thresholds, like MUL_KARATSUBA_THRESHOLD. Its output can be put
into gmp-mparam.h. The program is built and run with
make tune
@@ -298,16 +266,10 @@ mpn_divrem_1, using division by 32 as an example.
EXAMPLE COMPARISONS - MULTIPLICATION
-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,
-
- ./speed -s 3-20 -c mpn_mul_basecase.3
-
-A negative ".<-r>" parameter fixes the size of the product to the absolute
-value r. For example to show speeds for 10x10 up to 19x1 in cycles,
+mul_basecase takes a ".<r>" parameter which is the first (larger) size
+parameter. For example to show speeds for 20x1 up to 20x15 in cycles,
- ./speed -s 10-19 -c mpn_mul_basecase.-20
+ ./speed -s 1-15 -c mpn_mul_basecase.20
mul_basecase with no parameter does an NxN multiply, so for example to show
speeds in cycles for 1x1, 2x2, 3x3, etc, up to 20x20, in cycles,
@@ -319,7 +281,7 @@ up to twice as fast as mul_basecase. In practice loop overheads and the
products on the diagonal mean it falls short of this. Here's an example
running the two and showing by what factor an NxN mul_basecase is slower
than an NxN sqr_basecase. (Some versions of sqr_basecase only allow sizes
-below SQR_TOOM2_THRESHOLD, so if it crashes at that point don't worry.)
+below SQR_KARATSUBA_THRESHOLD, so if it crashes at that point don't worry.)
./speed -s 1-20 -r mpn_sqr_basecase mpn_mul_basecase
@@ -465,12 +427,12 @@ normal libgmp.la.
Note further that the various routines may recurse into themselves on sizes
far enough above applicable thresholds. For example, mpn_kara_mul_n will
recurse into itself on sizes greater than twice the compiled-in
-MUL_TOOM22_THRESHOLD.
+MUL_KARATSUBA_THRESHOLD.
When doing the above comparison between mul_basecase and kara_mul_n what's
probably of interest is mul_basecase versus a kara_mul_n that does one level
of Karatsuba then calls to mul_basecase, but this only happens on sizes less
-than twice the compiled MUL_TOOM22_THRESHOLD. A larger value for that
+than twice the compiled MUL_KARATSUBA_THRESHOLD. A larger value for that
setting can be compiled-in to avoid the problem if necessary. The same
applies to toom3 and DC, though in a trickier fashion.
diff --git a/gmp/tune/alpha.asm b/gmp/tune/alpha.asm
index 888c77fe9d..b447462083 100644
--- a/gmp/tune/alpha.asm
+++ b/gmp/tune/alpha.asm
@@ -1,32 +1,21 @@
dnl Alpha time stamp counter access routine.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/common.c b/gmp/tune/common.c
index 8d06b4dc02..85a1ddef3f 100644
--- a/gmp/tune/common.c
+++ b/gmp/tune/common.c
@@ -1,32 +1,22 @@
/* Shared speed subroutines.
-Copyright 1999-2006, 2008-2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 2003, 2004, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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_NO_ATTRIBUTE_CONST_PURE
@@ -51,7 +41,6 @@ see https://www.gnu.org/licenses/. */
int speed_option_addrs = 0;
int speed_option_verbose = 0;
-int speed_option_cycles_broken = 0;
/* Provide __clz_tab even if it's not required, for the benefit of new code
@@ -72,9 +61,9 @@ pentium_wbinvd(void)
if (fd == -2)
{
- fd = open ("/dev/wbinvd", O_RDWR);
- if (fd == -1)
- perror ("open /dev/wbinvd");
+ fd = open ("/dev/wbinvd", O_RDWR);
+ if (fd == -1)
+ perror ("open /dev/wbinvd");
}
if (fd != -1)
@@ -132,9 +121,10 @@ double_cmp_ptr (const double *p, const double *q)
s->r, -1.0 should be returned. See the various base routines below. */
double
-speed_measure (double (*fun) (struct speed_params *s), struct speed_params *s)
+speed_measure (double (*fun) __GMP_PROTO ((struct speed_params *s)),
+ struct speed_params *s)
{
-#define TOLERANCE 1.01 /* 1% */
+#define TOLERANCE 1.005 /* 0.5% */
const int max_zeros = 10;
struct speed_params s_dummy;
@@ -157,77 +147,74 @@ speed_measure (double (*fun) (struct speed_params *s), struct speed_params *s)
for (i = 0; i < numberof (t); i++)
{
for (;;)
- {
- s->src_num = 0;
- s->dst_num = 0;
-
- t[i] = (*fun) (s);
-
- if (speed_option_verbose >= 3)
- gmp_printf("size=%ld reps=%u r=%Md attempt=%d %.9f\n",
- (long) s->size, s->reps, s->r, i, t[i]);
-
- if (t[i] == 0.0)
- {
- zeros++;
- if (zeros > max_zeros)
- {
- fprintf (stderr, "Fatal error: too many (%d) failed measurements (0.0)\n", zeros);
- abort ();
- }
- if (s->reps < 10000)
- s->reps *= 2;
-
- continue;
- }
-
- if (t[i] == -1.0)
- return -1.0;
-
- if (t[i] >= speed_unittime * speed_precision)
- break;
-
- /* go to a value of reps to make t[i] >= precision */
- reps_d = ceil (1.1 * s->reps
- * speed_unittime * speed_precision
- / MAX (t[i], speed_unittime));
- if (reps_d > 2e9 || reps_d < 1.0)
- {
- fprintf (stderr, "Fatal error: new reps bad: %.2f\n", reps_d);
- fprintf (stderr, " (old reps %u, unittime %.4g, precision %d, t[i] %.4g)\n",
- s->reps, speed_unittime, speed_precision, t[i]);
- abort ();
- }
- s->reps = (unsigned) reps_d;
- }
+ {
+ s->src_num = 0;
+ s->dst_num = 0;
+
+ t[i] = (*fun) (s);
+
+ if (speed_option_verbose >= 3)
+ gmp_printf("size=%ld reps=%u r=%Md attempt=%d %.9f\n",
+ (long) s->size, s->reps, s->r, i, t[i]);
+
+ if (t[i] == 0.0)
+ {
+ zeros++;
+ if (zeros > max_zeros)
+ {
+ fprintf (stderr, "Fatal error: too many (%d) failed measurements (0.0)\n", zeros);
+ abort ();
+ }
+ continue;
+ }
+
+ if (t[i] == -1.0)
+ return -1.0;
+
+ if (t[i] >= speed_unittime * speed_precision)
+ break;
+
+ /* go to a value of reps to make t[i] >= precision */
+ reps_d = ceil (1.1 * s->reps
+ * speed_unittime * speed_precision
+ / MAX (t[i], speed_unittime));
+ if (reps_d > 2e9 || reps_d < 1.0)
+ {
+ fprintf (stderr, "Fatal error: new reps bad: %.2f\n", reps_d);
+ fprintf (stderr, " (old reps %u, unittime %.4g, precision %d, t[i] %.4g)\n",
+ s->reps, speed_unittime, speed_precision, t[i]);
+ abort ();
+ }
+ s->reps = (unsigned) reps_d;
+ }
t[i] /= s->reps;
t_unsorted[i] = t[i];
if (speed_precision == 0)
- return t[i];
+ return t[i];
/* require 3 values within TOLERANCE when >= 2 secs, 4 when below */
if (t[0] >= 2.0)
- e = 3;
+ e = 3;
else
- e = 4;
+ e = 4;
/* Look for e many t[]'s within TOLERANCE of each other to consider a
- valid measurement. Return smallest among them. */
+ valid measurement. Return smallest among them. */
if (i >= e)
- {
- qsort (t, i+1, sizeof(t[0]), (qsort_function_t) double_cmp_ptr);
- for (j = e-1; j < i; j++)
- if (t[j] <= t[j-e+1] * TOLERANCE)
- return t[j-e+1] / s->time_divisor;
- }
+ {
+ qsort (t, i+1, sizeof(t[0]), (qsort_function_t) double_cmp_ptr);
+ for (j = e-1; j < i; j++)
+ if (t[j] <= t[j-e+1] * TOLERANCE)
+ return t[j-e+1] / s->time_divisor;
+ }
}
fprintf (stderr, "speed_measure() could not get %d results within %.1f%%\n",
- e, (TOLERANCE-1.0)*100.0);
+ e, (TOLERANCE-1.0)*100.0);
fprintf (stderr, " unsorted sorted\n");
fprintf (stderr, " %.12f %.12f is about 0.5%%\n",
- t_unsorted[0]*(TOLERANCE-1.0), t[0]*(TOLERANCE-1.0));
+ t_unsorted[0]*(TOLERANCE-1.0), t[0]*(TOLERANCE-1.0));
for (i = 0; i < numberof (t); i++)
fprintf (stderr, " %.09f %.09f\n", t_unsorted[i], t[i]);
@@ -318,30 +305,30 @@ speed_cache_fill (struct speed_params *s)
different = (s->dst_num != prev.dst_num || s->src_num != prev.src_num);
for (i = 0; i < s->dst_num; i++)
- different |= (s->dst[i].ptr != prev.dst[i].ptr);
+ different |= (s->dst[i].ptr != prev.dst[i].ptr);
for (i = 0; i < s->src_num; i++)
- different |= (s->src[i].ptr != prev.src[i].ptr);
+ different |= (s->src[i].ptr != prev.src[i].ptr);
if (different)
- {
- if (s->dst_num != 0)
- {
- printf ("dst");
- for (i = 0; i < s->dst_num; i++)
- printf (" %08lX", (unsigned long) s->dst[i].ptr);
- printf (" ");
- }
-
- if (s->src_num != 0)
- {
- printf ("src");
- for (i = 0; i < s->src_num; i++)
- printf (" %08lX", (unsigned long) s->src[i].ptr);
- printf (" ");
- }
- printf (" (cf sp approx %08lX)\n", (unsigned long) &different);
-
- }
+ {
+ if (s->dst_num != 0)
+ {
+ printf ("dst");
+ for (i = 0; i < s->dst_num; i++)
+ printf (" %08lX", (unsigned long) s->dst[i].ptr);
+ printf (" ");
+ }
+
+ if (s->src_num != 0)
+ {
+ printf ("src");
+ for (i = 0; i < s->src_num; i++)
+ printf (" %08lX", (unsigned long) s->src[i].ptr);
+ printf (" ");
+ }
+ printf (" (cf sp approx %08lX)\n", (unsigned long) &different);
+
+ }
memcpy (&prev, s, sizeof(prev));
}
@@ -360,7 +347,7 @@ speed_cache_fill (struct speed_params *s)
}
-/* Miscellaneous options accepted by tune and speed programs under -o. */
+/* Miscellanous options accepted by tune and speed programs under -o. */
void
speed_option_set (const char *s)
@@ -379,10 +366,6 @@ speed_option_set (const char *s)
{
speed_option_verbose = n;
}
- else if (strcmp (s, "cycles-broken") == 0)
- {
- speed_option_cycles_broken = 1;
- }
else
{
printf ("Unrecognised -o option: %s\n", s);
@@ -419,10 +402,10 @@ speed_option_set (const char *s)
code on most CPUs, thereby minimizing overhead in the measurement. It
can always be assumed s->reps >= 1.
- i = s->reps
- do
- foo();
- while (--i != 0);
+ i = s->reps
+ do
+ foo();
+ while (--i != 0);
Additional parameters might be added to "struct speed_params" in the
future. Routines should ignore anything they don't use.
@@ -469,14 +452,9 @@ speed_memcpy (struct speed_params *s)
SPEED_ROUTINE_MPN_COPY_BYTES (memcpy);
}
double
-speed_mpn_com (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_COPY (mpn_com);
-}
-double
-speed_mpn_sec_tabselect (struct speed_params *s)
+speed_mpn_com_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_TABSELECT (mpn_sec_tabselect);
+ SPEED_ROUTINE_MPN_COPY (mpn_com_n);
}
@@ -573,20 +551,6 @@ speed_mpn_mul_4 (struct speed_params *s)
SPEED_ROUTINE_MPN_UNARY_4 (mpn_mul_4);
}
#endif
-#if HAVE_NATIVE_mpn_mul_5
-double
-speed_mpn_mul_5 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_UNARY_5 (mpn_mul_5);
-}
-#endif
-#if HAVE_NATIVE_mpn_mul_6
-double
-speed_mpn_mul_6 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_UNARY_6 (mpn_mul_6);
-}
-#endif
double
@@ -595,11 +559,6 @@ speed_mpn_lshift (struct speed_params *s)
SPEED_ROUTINE_MPN_UNARY_1 (mpn_lshift);
}
double
-speed_mpn_lshiftc (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_UNARY_1 (mpn_lshiftc);
-}
-double
speed_mpn_rshift (struct speed_params *s)
{
SPEED_ROUTINE_MPN_UNARY_1 (mpn_rshift);
@@ -699,39 +658,6 @@ speed_mpn_divrem_2_inv (struct speed_params *s)
}
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)
-{
- SPEED_ROUTINE_MPN_DIV_QR_2 (mpn_div_qr_2, 1);
-}
-double
-speed_mpn_div_qr_2u (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_DIV_QR_2 (mpn_div_qr_2, 0);
-}
-
-double
speed_mpn_mod_1 (struct speed_params *s)
{
SPEED_ROUTINE_MPN_MOD_1 (mpn_mod_1);
@@ -748,36 +674,6 @@ speed_mpn_preinv_mod_1 (struct speed_params *s)
{
SPEED_ROUTINE_MPN_PREINV_MOD_1 (mpn_preinv_mod_1);
}
-double
-speed_mpn_mod_1_1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MOD_1_1 (mpn_mod_1_1p,mpn_mod_1_1p_cps);
-}
-double
-speed_mpn_mod_1_1_1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MOD_1_1 (mpn_mod_1_1p_1,mpn_mod_1_1p_cps_1);
-}
-double
-speed_mpn_mod_1_1_2 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MOD_1_1 (mpn_mod_1_1p_2,mpn_mod_1_1p_cps_2);
-}
-double
-speed_mpn_mod_1_2 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MOD_1_N (mpn_mod_1s_2p,mpn_mod_1s_2p_cps,2);
-}
-double
-speed_mpn_mod_1_3 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MOD_1_N (mpn_mod_1s_3p,mpn_mod_1s_3p_cps,3);
-}
-double
-speed_mpn_mod_1_4 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MOD_1_N (mpn_mod_1s_4p,mpn_mod_1s_4p_cps,4);
-}
double
speed_mpn_divexact_1 (struct speed_params *s)
@@ -797,18 +693,6 @@ speed_mpn_bdiv_dbm1c (struct speed_params *s)
SPEED_ROUTINE_MPN_BDIV_DBM1C (mpn_bdiv_dbm1c);
}
-double
-speed_mpn_bdiv_q_1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BDIV_Q_1 (mpn_bdiv_q_1);
-}
-
-double
-speed_mpn_pi1_bdiv_q_1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_PI1_BDIV_Q_1 (mpn_pi1_bdiv_q_1);
-}
-
#if HAVE_NATIVE_mpn_modexact_1_odd
double
speed_mpn_modexact_1_odd (struct speed_params *s)
@@ -823,145 +707,59 @@ speed_mpn_modexact_1c_odd (struct speed_params *s)
SPEED_ROUTINE_MPN_MODEXACT_1C_ODD (mpn_modexact_1c_odd);
}
-double
-speed_mpz_mod (struct speed_params *s)
-{
- SPEED_ROUTINE_MPZ_MOD (mpz_mod);
-}
double
-speed_mpn_sbpi1_div_qr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_PI1_DIV (mpn_sbpi1_div_qr, inv.inv32, 2,0);
-}
-double
-speed_mpn_dcpi1_div_qr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_PI1_DIV (mpn_dcpi1_div_qr, &inv, 6,3);
-}
-double
-speed_mpn_sbpi1_divappr_q (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_PI1_DIV (mpn_sbpi1_divappr_q, inv.inv32, 2,0);
-}
-double
-speed_mpn_dcpi1_divappr_q (struct speed_params *s)
+speed_mpn_dc_tdiv_qr (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_PI1_DIV (mpn_dcpi1_divappr_q, &inv, 6,3);
+ SPEED_ROUTINE_MPN_DC_TDIV_QR (mpn_tdiv_qr);
}
double
-speed_mpn_mu_div_qr (struct speed_params *s)
+speed_mpn_dc_divrem_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_MU_DIV_QR (mpn_mu_div_qr, mpn_mu_div_qr_itch);
+ SPEED_ROUTINE_MPN_DC_DIVREM_N (mpn_dc_divrem_n);
}
double
-speed_mpn_mu_divappr_q (struct speed_params *s)
+speed_mpn_dc_divrem_sb (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_MU_DIV_Q (mpn_mu_divappr_q, mpn_mu_divappr_q_itch);
+ SPEED_ROUTINE_MPN_DC_DIVREM_SB (mpn_sb_divrem_mn);
}
double
-speed_mpn_mu_div_q (struct speed_params *s)
+speed_mpn_dc_divrem_sb_div (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_MU_DIV_Q (mpn_mu_div_q, mpn_mu_div_q_itch);
+ SPEED_ROUTINE_MPN_DC_DIVREM_SB (mpn_sb_divrem_mn_div);
}
double
-speed_mpn_mupi_div_qr (struct speed_params *s)
+speed_mpn_dc_divrem_sb_inv (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_MUPI_DIV_QR (mpn_preinv_mu_div_qr, mpn_preinv_mu_div_qr_itch);
+ SPEED_ROUTINE_MPN_DC_DIVREM_SB (mpn_sb_divrem_mn_inv);
}
double
-speed_mpn_sbpi1_bdiv_qr (struct speed_params *s)
+speed_mpn_sb_divrem_m3 (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_PI1_BDIV_QR (mpn_sbpi1_bdiv_qr);
+ SPEED_ROUTINE_MPN_SB_DIVREM_M3 (mpn_sb_divrem_mn);
}
double
-speed_mpn_dcpi1_bdiv_qr (struct speed_params *s)
+speed_mpn_sb_divrem_m3_div (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_PI1_BDIV_QR (mpn_dcpi1_bdiv_qr);
+ SPEED_ROUTINE_MPN_SB_DIVREM_M3 (mpn_sb_divrem_mn_div);
}
double
-speed_mpn_sbpi1_bdiv_q (struct speed_params *s)
+speed_mpn_sb_divrem_m3_inv (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_PI1_BDIV_Q (mpn_sbpi1_bdiv_q);
-}
-double
-speed_mpn_dcpi1_bdiv_q (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_PI1_BDIV_Q (mpn_dcpi1_bdiv_q);
-}
-double
-speed_mpn_mu_bdiv_q (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MU_BDIV_Q (mpn_mu_bdiv_q, mpn_mu_bdiv_q_itch);
-}
-double
-speed_mpn_mu_bdiv_qr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MU_BDIV_QR (mpn_mu_bdiv_qr, mpn_mu_bdiv_qr_itch);
-}
-
-double
-speed_mpn_broot (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BROOT (mpn_broot);
-}
-double
-speed_mpn_broot_invm1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BROOT (mpn_broot_invm1);
-}
-double
-speed_mpn_brootinv (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BROOTINV (mpn_brootinv, 5*s->size);
+ SPEED_ROUTINE_MPN_SB_DIVREM_M3 (mpn_sb_divrem_mn_inv);
}
double
-speed_mpn_binvert (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINVERT (mpn_binvert, mpn_binvert_itch);
-}
-
-double
-speed_mpn_invert (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_INVERT (mpn_invert, mpn_invert_itch);
-}
-
-double
-speed_mpn_invertappr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_INVERTAPPR (mpn_invertappr, mpn_invertappr_itch);
-}
-
-double
-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_mpz_mod (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_SEC_INVERT (mpn_sec_invert, mpn_sec_invert_itch);
+ SPEED_ROUTINE_MPZ_MOD (mpz_mod);
}
-
double
speed_mpn_redc_1 (struct speed_params *s)
{
SPEED_ROUTINE_REDC_1 (mpn_redc_1);
}
-double
-speed_mpn_redc_2 (struct speed_params *s)
-{
- SPEED_ROUTINE_REDC_2 (mpn_redc_2);
-}
-double
-speed_mpn_redc_n (struct speed_params *s)
-{
- SPEED_ROUTINE_REDC_N (mpn_redc_n);
-}
double
@@ -987,172 +785,28 @@ speed_mpn_sub_n (struct speed_params *s)
SPEED_ROUTINE_MPN_BINARY_N (mpn_sub_n);
}
+#if HAVE_NATIVE_mpn_addsub_n
double
-speed_mpn_add_err1_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_ERR1_N (mpn_add_err1_n);
-}
-double
-speed_mpn_sub_err1_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_ERR1_N (mpn_sub_err1_n);
-}
-double
-speed_mpn_add_err2_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_ERR2_N (mpn_add_err2_n);
-}
-double
-speed_mpn_sub_err2_n (struct speed_params *s)
+speed_mpn_addsub_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_ERR2_N (mpn_sub_err2_n);
-}
-double
-speed_mpn_add_err3_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_ERR3_N (mpn_add_err3_n);
-}
-double
-speed_mpn_sub_err3_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_ERR3_N (mpn_sub_err3_n);
-}
-
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
-double
-speed_mpn_add_n_sub_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_ADDSUB_N_CALL (mpn_add_n_sub_n (ap, sp, s->xp, s->yp, s->size));
+ SPEED_ROUTINE_MPN_ADDSUB_N_CALL (mpn_addsub_n (ap, sp, s->xp, s->yp, s->size));
}
#endif
-#if HAVE_NATIVE_mpn_addlsh1_n == 1
+#if HAVE_NATIVE_mpn_addlsh1_n
double
speed_mpn_addlsh1_n (struct speed_params *s)
{
SPEED_ROUTINE_MPN_BINARY_N (mpn_addlsh1_n);
}
#endif
-#if HAVE_NATIVE_mpn_sublsh1_n == 1
+#if HAVE_NATIVE_mpn_sublsh1_n
double
speed_mpn_sublsh1_n (struct speed_params *s)
{
SPEED_ROUTINE_MPN_BINARY_N (mpn_sublsh1_n);
}
#endif
-#if HAVE_NATIVE_mpn_addlsh1_n_ip1
-double
-speed_mpn_addlsh1_n_ip1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_COPY (mpn_addlsh1_n_ip1);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh1_n_ip2
-double
-speed_mpn_addlsh1_n_ip2 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_COPY (mpn_addlsh1_n_ip2);
-}
-#endif
-#if HAVE_NATIVE_mpn_sublsh1_n_ip1
-double
-speed_mpn_sublsh1_n_ip1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_COPY (mpn_sublsh1_n_ip1);
-}
-#endif
-#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 == 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 == 1
-double
-speed_mpn_sublsh2_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_N (mpn_sublsh2_n);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_n_ip1
-double
-speed_mpn_addlsh2_n_ip1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_COPY (mpn_addlsh2_n_ip1);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_n_ip2
-double
-speed_mpn_addlsh2_n_ip2 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_COPY (mpn_addlsh2_n_ip2);
-}
-#endif
-#if HAVE_NATIVE_mpn_sublsh2_n_ip1
-double
-speed_mpn_sublsh2_n_ip1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_COPY (mpn_sublsh2_n_ip1);
-}
-#endif
-#if HAVE_NATIVE_mpn_rsblsh2_n == 1
-double
-speed_mpn_rsblsh2_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_N (mpn_rsblsh2_n);
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n
-double
-speed_mpn_addlsh_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_addlsh_n (wp, xp, yp, s->size, 7));
-}
-#endif
-#if HAVE_NATIVE_mpn_sublsh_n
-double
-speed_mpn_sublsh_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_sublsh_n (wp, xp, yp, s->size, 7));
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip1
-double
-speed_mpn_addlsh_n_ip1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_UNARY_1_CALL (mpn_addlsh_n_ip1 (wp, s->xp, s->size, 7));
-}
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip2
-double
-speed_mpn_addlsh_n_ip2 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_UNARY_1_CALL (mpn_addlsh_n_ip2 (wp, s->xp, s->size, 7));
-}
-#endif
-#if HAVE_NATIVE_mpn_sublsh_n_ip1
-double
-speed_mpn_sublsh_n_ip1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_UNARY_1_CALL (mpn_sublsh_n_ip1 (wp, s->xp, s->size, 7));
-}
-#endif
-#if HAVE_NATIVE_mpn_rsblsh_n
-double
-speed_mpn_rsblsh_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_rsblsh_n (wp, xp, yp, s->size, 7));
-}
-#endif
#if HAVE_NATIVE_mpn_rsh1add_n
double
speed_mpn_rsh1add_n (struct speed_params *s)
@@ -1168,58 +822,47 @@ speed_mpn_rsh1sub_n (struct speed_params *s)
}
#endif
-double
-speed_mpn_cnd_add_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_cnd_add_n (1, wp, xp, yp, s->size));
-}
-double
-speed_mpn_cnd_sub_n (struct speed_params *s)
-{
- 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
SPEED_ROUTINE_MPN_BINARY_N_CALL forms */
double
speed_mpn_and_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_and_n (wp, xp, yp, s->size));
+ SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_and_n (wp, s->xp, s->yp, s->size));
}
double
speed_mpn_andn_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_andn_n (wp, xp, yp, s->size));
+SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_andn_n (wp, s->xp, s->yp, s->size));
}
double
speed_mpn_nand_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_nand_n (wp, xp, yp, s->size));
+ SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_nand_n (wp, s->xp, s->yp, s->size));
}
double
speed_mpn_ior_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_ior_n (wp, xp, yp, s->size));
+SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_ior_n (wp, s->xp, s->yp, s->size));
}
double
speed_mpn_iorn_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_iorn_n (wp, xp, yp, s->size));
+ SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_iorn_n (wp, s->xp, s->yp, s->size));
}
double
speed_mpn_nior_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_nior_n (wp, xp, yp, s->size));
+ SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_nior_n (wp, s->xp, s->yp, s->size));
}
double
speed_mpn_xor_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_xor_n (wp, xp, yp, s->size));
+ SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_xor_n (wp, s->xp, s->yp, s->size));
}
double
speed_mpn_xnor_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_xnor_n (wp, xp, yp, s->size));
+ SPEED_ROUTINE_MPN_BINARY_N_CALL (mpn_xnor_n (wp, s->xp, s->yp, s->size));
}
@@ -1229,9 +872,9 @@ speed_mpn_mul_n (struct speed_params *s)
SPEED_ROUTINE_MPN_MUL_N (mpn_mul_n);
}
double
-speed_mpn_sqr (struct speed_params *s)
+speed_mpn_sqr_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_SQR (mpn_sqr);
+ SPEED_ROUTINE_MPN_SQR (mpn_sqr_n);
}
double
speed_mpn_mul_n_sqr (struct speed_params *s)
@@ -1264,141 +907,29 @@ speed_mpn_sqr_diagonal (struct speed_params *s)
}
#endif
-#if HAVE_NATIVE_mpn_sqr_diag_addlsh1
-double
-speed_mpn_sqr_diag_addlsh1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_SQR_DIAG_ADDLSH1_CALL (mpn_sqr_diag_addlsh1 (wp, tp, s->xp, s->size));
-}
-#endif
-
-double
-speed_mpn_toom2_sqr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM2_SQR (mpn_toom2_sqr);
-}
-double
-speed_mpn_toom3_sqr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM3_SQR (mpn_toom3_sqr);
-}
-double
-speed_mpn_toom4_sqr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM4_SQR (mpn_toom4_sqr);
-}
-double
-speed_mpn_toom6_sqr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM6_SQR (mpn_toom6_sqr);
-}
-double
-speed_mpn_toom8_sqr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM8_SQR (mpn_toom8_sqr);
-}
-double
-speed_mpn_toom22_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM22_MUL_N (mpn_toom22_mul);
-}
-double
-speed_mpn_toom33_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM33_MUL_N (mpn_toom33_mul);
-}
double
-speed_mpn_toom44_mul (struct speed_params *s)
+speed_mpn_kara_mul_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_TOOM44_MUL_N (mpn_toom44_mul);
+ SPEED_ROUTINE_MPN_KARA_MUL_N (mpn_kara_mul_n);
}
double
-speed_mpn_toom6h_mul (struct speed_params *s)
+speed_mpn_kara_sqr_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_TOOM6H_MUL_N (mpn_toom6h_mul);
-}
-double
-speed_mpn_toom8h_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM8H_MUL_N (mpn_toom8h_mul);
+ SPEED_ROUTINE_MPN_KARA_SQR_N (mpn_kara_sqr_n);
}
double
-speed_mpn_toom32_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM32_MUL (mpn_toom32_mul);
-}
-double
-speed_mpn_toom42_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM42_MUL (mpn_toom42_mul);
-}
-double
-speed_mpn_toom43_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM43_MUL (mpn_toom43_mul);
-}
-double
-speed_mpn_toom63_mul (struct speed_params *s)
+speed_mpn_toom3_mul_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_TOOM63_MUL (mpn_toom63_mul);
+ SPEED_ROUTINE_MPN_TOOM3_MUL_N (mpn_toom3_mul_n);
}
double
-speed_mpn_toom32_for_toom43_mul (struct speed_params *s)
+speed_mpn_toom3_sqr_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_TOOM32_FOR_TOOM43_MUL (mpn_toom32_mul);
-}
-double
-speed_mpn_toom43_for_toom32_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM32_MUL (mpn_toom43_mul);
-}
-double
-speed_mpn_toom32_for_toom53_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM32_FOR_TOOM53_MUL (mpn_toom32_mul);
-}
-double
-speed_mpn_toom53_for_toom32_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM53_FOR_TOOM32_MUL (mpn_toom53_mul);
-}
-double
-speed_mpn_toom42_for_toom53_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM42_FOR_TOOM53_MUL (mpn_toom42_mul);
-}
-double
-speed_mpn_toom53_for_toom42_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM53_FOR_TOOM42_MUL (mpn_toom53_mul);
-}
-double
-speed_mpn_toom43_for_toom54_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM54_MUL (mpn_toom43_mul);
-}
-double
-speed_mpn_toom54_for_toom43_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM54_FOR_TOOM43_MUL (mpn_toom54_mul);
+ SPEED_ROUTINE_MPN_TOOM3_SQR_N (mpn_toom3_sqr_n);
}
double
-speed_mpn_nussbaumer_mul (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MUL_N_CALL
- (mpn_nussbaumer_mul (wp, s->xp, s->size, s->yp, s->size));
-}
-double
-speed_mpn_nussbaumer_mul_sqr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_SQR_CALL
- (mpn_nussbaumer_mul (wp, s->xp, s->size, s->xp, s->size));
-}
-
-#if WANT_OLD_FFT_FULL
-double
speed_mpn_mul_fft_full (struct speed_params *s)
{
SPEED_ROUTINE_MPN_MUL_N_CALL
@@ -1410,7 +941,7 @@ speed_mpn_mul_fft_full_sqr (struct speed_params *s)
SPEED_ROUTINE_MPN_SQR_CALL
(mpn_mul_fft_full (wp, s->xp, s->size, s->xp, s->size));
}
-#endif
+
/* These are mod 2^N+1 multiplies and squares. If s->r is supplied it's
used as k, otherwise the best k for the size is used. If s->size isn't a
@@ -1424,31 +955,31 @@ speed_mpn_mul_fft_full_sqr (struct speed_params *s)
unsigned i; \
double t; \
TMP_DECL; \
- \
+ \
SPEED_RESTRICT_COND (s->size >= 1); \
- \
+ \
if (s->r != 0) \
k = s->r; \
else \
k = mpn_fft_best_k (s->size, sqr); \
- \
+ \
TMP_MARK; \
pl = mpn_fft_next_size (s->size, k); \
SPEED_TMP_ALLOC_LIMBS (wp, pl+1, s->align_wp); \
- \
+ \
speed_operand_src (s, s->xp, s->size); \
if (!sqr) \
speed_operand_src (s, s->yp, s->size); \
speed_operand_dst (s, wp, pl+1); \
speed_cache_fill (s); \
- \
+ \
speed_starttime (); \
i = s->reps; \
do \
call; \
while (--i != 0); \
t = speed_endtime (); \
- \
+ \
TMP_FREE; \
return t; \
}
@@ -1468,174 +999,179 @@ speed_mpn_mul_fft_sqr (struct speed_params *s)
}
double
-speed_mpn_fft_mul (struct speed_params *s)
+speed_mpn_mullow_n (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_MUL_N_CALL (mpn_fft_mul (wp, s->xp, s->size, s->yp, s->size));
+ SPEED_ROUTINE_MPN_MULLOW_N (mpn_mullow_n);
}
-
double
-speed_mpn_fft_sqr (struct speed_params *s)
+speed_mpn_mullow_basecase (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_SQR_CALL (mpn_fft_mul (wp, s->xp, s->size, s->xp, s->size));
+ SPEED_ROUTINE_MPN_MULLOW_BASECASE (mpn_mullow_basecase);
}
double
-speed_mpn_mullo_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULLO_N (mpn_mullo_n);
-}
-double
-speed_mpn_mullo_basecase (struct speed_params *s)
+speed_mpn_matrix22_mul (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_MULLO_BASECASE (mpn_mullo_basecase);
-}
+ /* Speed params only includes 2 inputs, so we have to invent the
+ other 6. */
-double
-speed_mpn_mulmid_basecase (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULMID (mpn_mulmid_basecase);
-}
+ mp_ptr a1, a2, a3;
+ mp_ptr r0, r1, r2, r3;
+ mp_ptr b1, b2, b3;
+ mp_ptr tp;
+ mp_size_t scratch;
+ unsigned i;
+ double t;
+ TMP_DECL;
-double
-speed_mpn_mulmid (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULMID (mpn_mulmid);
-}
+ TMP_MARK;
+ SPEED_TMP_ALLOC_LIMBS (a1, s->size, s->align_xp);
+ SPEED_TMP_ALLOC_LIMBS (a2, s->size, s->align_xp);
+ SPEED_TMP_ALLOC_LIMBS (a3, s->size, s->align_xp);
-double
-speed_mpn_mulmid_n (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULMID_N (mpn_mulmid_n);
-}
+ SPEED_TMP_ALLOC_LIMBS (b1, s->size, s->align_yp);
+ SPEED_TMP_ALLOC_LIMBS (b2, s->size, s->align_yp);
+ SPEED_TMP_ALLOC_LIMBS (b3, s->size, s->align_yp);
-double
-speed_mpn_toom42_mulmid (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_TOOM42_MULMID (mpn_toom42_mulmid);
-}
+ SPEED_TMP_ALLOC_LIMBS (r0, 2 * s->size +1, s->align_xp);
+ SPEED_TMP_ALLOC_LIMBS (r1, 2 * s->size +1, s->align_xp);
+ SPEED_TMP_ALLOC_LIMBS (r2, 2 * s->size +1, s->align_xp);
+ SPEED_TMP_ALLOC_LIMBS (r3, 2 * s->size +1, s->align_xp);
-double
-speed_mpn_mulmod_bnm1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL (mpn_mulmod_bnm1 (wp, s->size, s->xp, s->size, s->yp, s->size, tp));
-}
+ mpn_random (a1, s->size);
+ mpn_random (a2, s->size);
+ mpn_random (a3, s->size);
+ mpn_random (b1, s->size);
+ mpn_random (b2, s->size);
+ mpn_random (b3, s->size);
-double
-speed_mpn_bc_mulmod_bnm1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL (mpn_bc_mulmod_bnm1 (wp, s->xp, s->yp, s->size, tp));
-}
+ scratch = mpn_matrix22_mul_itch (s->size, s->size);
+ SPEED_TMP_ALLOC_LIMBS (tp, scratch, s->align_wp);
-double
-speed_mpn_mulmod_bnm1_rounded (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULMOD_BNM1_ROUNDED (mpn_mulmod_bnm1);
-}
-
-double
-speed_mpn_sqrmod_bnm1 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL (mpn_sqrmod_bnm1 (wp, s->size, s->xp, s->size, tp));
+ speed_starttime ();
+ i = s->reps;
+ do
+ {
+ MPN_COPY (r0, s->xp, s->size);
+ MPN_COPY (r1, a1, s->size);
+ MPN_COPY (r2, a2, s->size);
+ MPN_COPY (r3, a3, s->size);
+ mpn_matrix22_mul (r0, r1, r2, r3, s->size, s->yp, b1, b2, b3, s->size, tp);
+ }
+ while (--i != 0);
+ t = speed_endtime();
+ TMP_FREE;
+ return t;
}
double
-speed_mpn_matrix22_mul (struct speed_params *s)
+speed_mpn_hgcd (struct speed_params *s)
{
- /* Speed params only includes 2 inputs, so we have to invent the
- other 6. */
+ mp_ptr wp;
+ mp_size_t hgcd_init_scratch = MPN_HGCD_MATRIX_INIT_ITCH (s->size);
+ mp_size_t hgcd_scratch = mpn_hgcd_itch (s->size);
+ mp_ptr ap;
+ mp_ptr bp;
+ mp_ptr tmp1, tmp2;
- mp_ptr a;
- mp_ptr r;
- mp_ptr b;
- mp_ptr tp;
- mp_size_t itch;
+ struct hgcd_matrix hgcd;
+ int res;
unsigned i;
double t;
TMP_DECL;
+ if (s->size < 2)
+ return -1;
+
TMP_MARK;
- SPEED_TMP_ALLOC_LIMBS (a, 4 * s->size, s->align_xp);
- SPEED_TMP_ALLOC_LIMBS (b, 4 * s->size, s->align_yp);
- SPEED_TMP_ALLOC_LIMBS (r, 8 * s->size + 4, s->align_wp);
- MPN_COPY (a, s->xp, s->size);
- mpn_random (a + s->size, 3 * s->size);
- MPN_COPY (b, s->yp, s->size);
- mpn_random (b + s->size, 3 * s->size);
+ SPEED_TMP_ALLOC_LIMBS (ap, s->size + 1, s->align_xp);
+ SPEED_TMP_ALLOC_LIMBS (bp, s->size + 1, s->align_yp);
- itch = mpn_matrix22_mul_itch (s->size, s->size);
- SPEED_TMP_ALLOC_LIMBS (tp, itch, s->align_wp2);
+ s->xp[s->size - 1] |= 1;
+ s->yp[s->size - 1] |= 1;
- speed_operand_src (s, a, 4 * s->size);
- speed_operand_src (s, b, 4 * s->size);
- speed_operand_dst (s, r, 8 * s->size + 4);
- speed_operand_dst (s, tp, itch);
- speed_cache_fill (s);
+ SPEED_TMP_ALLOC_LIMBS (tmp1, hgcd_init_scratch, s->align_wp);
+ SPEED_TMP_ALLOC_LIMBS (wp, hgcd_scratch, s->align_wp);
speed_starttime ();
i = s->reps;
do
{
- mp_size_t sz = s->size;
- MPN_COPY (r + 0 * sz + 0, a + 0 * sz, sz);
- MPN_COPY (r + 2 * sz + 1, a + 1 * sz, sz);
- MPN_COPY (r + 4 * sz + 2, a + 2 * sz, sz);
- MPN_COPY (r + 6 * sz + 3, a + 3 * sz, sz);
- mpn_matrix22_mul (r, r + 2 * sz + 1, r + 4 * sz + 2, r + 6 * sz + 3, sz,
- b, b + 1 * sz, b + 2 * sz, b + 3 * sz, sz,
- tp);
+ MPN_COPY (ap, s->xp, s->size);
+ MPN_COPY (bp, s->yp, s->size);
+ mpn_hgcd_matrix_init (&hgcd, s->size, tmp1);
+ res = mpn_hgcd (ap, bp, s->size, &hgcd, wp);
}
while (--i != 0);
- t = speed_endtime();
+ t = speed_endtime ();
TMP_FREE;
return t;
}
double
-speed_mpn_hgcd (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd, mpn_hgcd_itch);
-}
-
-double
speed_mpn_hgcd_lehmer (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd_lehmer, mpn_hgcd_lehmer_itch);
-}
+ mp_ptr wp;
+ mp_size_t hgcd_init_scratch = MPN_HGCD_MATRIX_INIT_ITCH (s->size);
+ mp_size_t hgcd_scratch = MPN_HGCD_LEHMER_ITCH (s->size);
+ mp_ptr ap;
+ mp_ptr bp;
+ mp_ptr tmp1, tmp2;
-double
-speed_mpn_hgcd_appr (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd_appr, mpn_hgcd_appr_itch);
-}
+ struct hgcd_matrix hgcd;
+ int res;
+ unsigned i;
+ double t;
+ TMP_DECL;
-double
-speed_mpn_hgcd_appr_lehmer (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_HGCD_CALL (mpn_hgcd_appr_lehmer, mpn_hgcd_appr_lehmer_itch);
+ if (s->size < 2)
+ return -1;
+
+ TMP_MARK;
+
+ SPEED_TMP_ALLOC_LIMBS (ap, s->size + 1, s->align_xp);
+ SPEED_TMP_ALLOC_LIMBS (bp, s->size + 1, s->align_yp);
+
+ s->xp[s->size - 1] |= 1;
+ s->yp[s->size - 1] |= 1;
+
+ SPEED_TMP_ALLOC_LIMBS (tmp1, hgcd_init_scratch, s->align_wp);
+ SPEED_TMP_ALLOC_LIMBS (wp, hgcd_scratch, s->align_wp);
+
+ speed_starttime ();
+ i = s->reps;
+ do
+ {
+ MPN_COPY (ap, s->xp, s->size);
+ MPN_COPY (bp, s->yp, s->size);
+ mpn_hgcd_matrix_init (&hgcd, s->size, tmp1);
+ res = mpn_hgcd_lehmer (ap, bp, s->size, &hgcd, wp);
+ }
+ while (--i != 0);
+ t = speed_endtime ();
+ TMP_FREE;
+ return t;
}
double
-speed_mpn_hgcd_reduce (struct speed_params *s)
+speed_mpn_gcd (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_HGCD_REDUCE_CALL (mpn_hgcd_reduce, mpn_hgcd_reduce_itch);
+ SPEED_ROUTINE_MPN_GCD (mpn_gcd);
}
+#if 0
double
-speed_mpn_hgcd_reduce_1 (struct speed_params *s)
+speed_mpn_gcd_binary (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_HGCD_REDUCE_CALL (mpn_hgcd_reduce_1, mpn_hgcd_reduce_1_itch);
+ SPEED_ROUTINE_MPN_GCD (mpn_gcd_binary);
}
double
-speed_mpn_hgcd_reduce_2 (struct speed_params *s)
+speed_mpn_gcd_accel (struct speed_params *s)
{
- SPEED_ROUTINE_MPN_HGCD_REDUCE_CALL (mpn_hgcd_reduce_2, mpn_hgcd_reduce_2_itch);
+ SPEED_ROUTINE_MPN_GCD (mpn_gcd_accel);
}
+#endif
-double
-speed_mpn_gcd (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_GCD (mpn_gcd);
-}
double
speed_mpn_gcdext (struct speed_params *s)
@@ -1706,11 +1242,6 @@ speed_mpn_jacobi_base_3 (struct speed_params *s)
{
SPEED_ROUTINE_MPN_JACBASE (mpn_jacobi_base_3);
}
-double
-speed_mpn_jacobi_base_4 (struct speed_params *s)
-{
- SPEED_ROUTINE_MPN_JACBASE (mpn_jacobi_base_4);
-}
double
@@ -1776,11 +1307,6 @@ speed_mpz_powm_redc (struct speed_params *s)
SPEED_ROUTINE_MPZ_POWM (mpz_powm_redc);
}
double
-speed_mpz_powm_sec (struct speed_params *s)
-{
- SPEED_ROUTINE_MPZ_POWM (mpz_powm_sec);
-}
-double
speed_mpz_powm_ui (struct speed_params *s)
{
SPEED_ROUTINE_MPZ_POWM_UI (mpz_powm_ui);
@@ -1856,12 +1382,12 @@ speed_noop_wxys (struct speed_params *s)
{ \
unsigned i; \
variables; \
- \
+ \
speed_starttime (); \
i = s->reps; \
do \
{ \
- calls; \
+ calls; \
} \
while (--i != 0); \
return speed_endtime (); \
@@ -1876,39 +1402,39 @@ speed_noop_wxys (struct speed_params *s)
double
speed_malloc_free (struct speed_params *s)
{
- size_t bytes = s->size * GMP_LIMB_BYTES;
+ size_t bytes = s->size * BYTES_PER_MP_LIMB;
SPEED_ROUTINE_ALLOC_FREE (void *p,
- p = malloc (bytes);
- free (p));
+ p = malloc (bytes);
+ free (p));
}
double
speed_malloc_realloc_free (struct speed_params *s)
{
- size_t bytes = s->size * GMP_LIMB_BYTES;
+ size_t bytes = s->size * BYTES_PER_MP_LIMB;
SPEED_ROUTINE_ALLOC_FREE (void *p,
- p = malloc (GMP_LIMB_BYTES);
- p = realloc (p, bytes);
- free (p));
+ p = malloc (BYTES_PER_MP_LIMB);
+ p = realloc (p, bytes);
+ free (p));
}
double
speed_gmp_allocate_free (struct speed_params *s)
{
- size_t bytes = s->size * GMP_LIMB_BYTES;
+ size_t bytes = s->size * BYTES_PER_MP_LIMB;
SPEED_ROUTINE_ALLOC_FREE (void *p,
- p = (*__gmp_allocate_func) (bytes);
- (*__gmp_free_func) (p, bytes));
+ p = (*__gmp_allocate_func) (bytes);
+ (*__gmp_free_func) (p, bytes));
}
double
speed_gmp_allocate_reallocate_free (struct speed_params *s)
{
- size_t bytes = s->size * GMP_LIMB_BYTES;
+ size_t bytes = s->size * BYTES_PER_MP_LIMB;
SPEED_ROUTINE_ALLOC_FREE
(void *p,
- p = (*__gmp_allocate_func) (GMP_LIMB_BYTES);
- p = (*__gmp_reallocate_func) (p, bytes, GMP_LIMB_BYTES);
+ p = (*__gmp_allocate_func) (BYTES_PER_MP_LIMB);
+ p = (*__gmp_reallocate_func) (p, bytes, BYTES_PER_MP_LIMB);
(*__gmp_free_func) (p, bytes));
}
@@ -1916,38 +1442,38 @@ double
speed_mpz_init_clear (struct speed_params *s)
{
SPEED_ROUTINE_ALLOC_FREE (mpz_t z,
- mpz_init (z);
- mpz_clear (z));
+ mpz_init (z);
+ mpz_clear (z));
}
double
speed_mpz_init_realloc_clear (struct speed_params *s)
{
SPEED_ROUTINE_ALLOC_FREE (mpz_t z,
- mpz_init (z);
- _mpz_realloc (z, s->size);
- mpz_clear (z));
+ mpz_init (z);
+ _mpz_realloc (z, s->size);
+ mpz_clear (z));
}
double
speed_mpq_init_clear (struct speed_params *s)
{
SPEED_ROUTINE_ALLOC_FREE (mpq_t q,
- mpq_init (q);
- mpq_clear (q));
+ mpq_init (q);
+ mpq_clear (q));
}
double
speed_mpf_init_clear (struct speed_params *s)
{
SPEED_ROUTINE_ALLOC_FREE (mpf_t f,
- mpf_init (f);
- mpf_clear (f));
+ mpf_init (f);
+ mpf_clear (f));
}
/* Compare this to mpn_add_n to see how much overhead mpz_add adds. Note
- that repeatedly calling mpz_add with the same data gives branch prediction
+ that repeatedly calling mpz_add with the same data gives branch predition
in it an advantage. */
double
@@ -2011,40 +1537,6 @@ speed_mpz_bin_uiui (struct speed_params *s)
return t;
}
-/* If r==0, calculate binomial(2^size,size),
- otherwise calculate binomial(2^size,r). */
-
-double
-speed_mpz_bin_ui (struct speed_params *s)
-{
- mpz_t w, x;
- unsigned long k;
- unsigned i;
- double t;
-
- mpz_init (w);
- mpz_init_set_ui (x, 0);
-
- mpz_setbit (x, s->size);
-
- if (s->r != 0)
- k = s->r;
- else
- k = s->size;
-
- speed_starttime ();
- i = s->reps;
- do
- {
- mpz_bin_ui (w, x, k);
- }
- while (--i != 0);
- t = speed_endtime ();
-
- mpz_clear (w);
- mpz_clear (x);
- return t;
-}
/* The multiplies are successively dependent so the latency is measured, not
the issue rate. There's only 10 per loop so the code doesn't get too big
@@ -2072,41 +1564,41 @@ speed_mpz_bin_ui (struct speed_params *s)
mp_limb_t h, l; \
unsigned i; \
double t; \
- \
+ \
s->time_divisor = 10; \
- \
+ \
h = s->xp[0]; \
l = s->yp[0]; \
- \
+ \
if (s->r == 1) \
{ \
- speed_starttime (); \
- i = s->reps; \
- do \
- {
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ {
#define SPEED_MACRO_UMUL_PPMM_B \
- } \
- while (--i != 0); \
- t = speed_endtime (); \
+ } \
+ while (--i != 0); \
+ t = speed_endtime (); \
} \
else \
{ \
- speed_starttime (); \
- i = s->reps; \
- do \
- {
+ speed_starttime (); \
+ i = s->reps; \
+ do \
+ {
#define SPEED_MACRO_UMUL_PPMM_C \
- } \
- while (--i != 0); \
- t = speed_endtime (); \
+ } \
+ while (--i != 0); \
+ t = speed_endtime (); \
} \
- \
+ \
/* stop the compiler optimizing away the whole calculation! */ \
noop_1 (h); \
noop_1 (l); \
- \
+ \
return t; \
}
@@ -2242,25 +1734,25 @@ speed_mpn_umul_ppmm_r (struct speed_params *s)
unsigned i; \
mp_limb_t q, r, d; \
mp_limb_t dinv; \
- \
+ \
s->time_divisor = 10; \
- \
+ \
/* divisor from "r" parameter, or a default */ \
d = s->r; \
if (d == 0) \
- d = mp_bases[10].big_base; \
- \
+ d = __mp_bases[10].big_base; \
+ \
if (normalize) \
{ \
- unsigned norm; \
- count_leading_zeros (norm, d); \
- d <<= norm; \
- invert_limb (dinv, d); \
+ unsigned norm; \
+ count_leading_zeros (norm, d); \
+ d <<= norm; \
+ invert_limb (dinv, d); \
} \
- \
+ \
q = s->xp[0]; \
r = s->yp[0] % d; \
- \
+ \
speed_starttime (); \
i = s->reps; \
do \
@@ -2270,11 +1762,11 @@ speed_mpn_umul_ppmm_r (struct speed_params *s)
} \
while (--i != 0); \
t = speed_endtime (); \
- \
+ \
/* stop the compiler optimizing away the whole calculation! */ \
noop_1 (q); \
noop_1 (r); \
- \
+ \
return t; \
}
@@ -2298,6 +1790,44 @@ speed_udiv_qrnnd (struct speed_params *s)
}
double
+speed_udiv_qrnnd_preinv1 (struct speed_params *s)
+{
+ SPEED_ROUTINE_UDIV_QRNND_A (1);
+ {
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv1 (q, r, r, q, d, dinv);
+ }
+ SPEED_ROUTINE_UDIV_QRNND_B;
+}
+
+double
+speed_udiv_qrnnd_preinv2 (struct speed_params *s)
+{
+ SPEED_ROUTINE_UDIV_QRNND_A (1);
+ {
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ udiv_qrnnd_preinv2 (q, r, r, q, d, dinv);
+ }
+ SPEED_ROUTINE_UDIV_QRNND_B;
+}
+
+double
speed_udiv_qrnnd_c (struct speed_params *s)
{
SPEED_ROUTINE_UDIV_QRNND_A (1);
@@ -2380,7 +1910,7 @@ speed_operator_div (struct speed_params *s)
/* divisor from "r" parameter, or a default */
d = s->r;
if (d == 0)
- d = mp_bases[10].big_base;
+ d = __mp_bases[10].big_base;
x = s->xp[0];
q = 0;
@@ -2421,7 +1951,7 @@ speed_operator_mod (struct speed_params *s)
/* divisor from "r" parameter, or a default */
d = s->r;
if (d == 0)
- d = mp_bases[10].big_base;
+ d = __mp_bases[10].big_base;
x = s->xp[0];
r = 0;
@@ -2455,12 +1985,12 @@ speed_operator_mod (struct speed_params *s)
be typical for count_trailing_zeros in a GCD etc.
r==1 measures on data with the resultant count uniformly distributed
- between 0 and GMP_LIMB_BITS-1. This is probably sensible for
+ between 0 and BITS_PER_MP_LIMB-1. This is probably sensible for
count_leading_zeros on the high limbs of divisors. */
int
speed_routine_count_zeros_setup (struct speed_params *s,
- mp_ptr xp, int leading, int zero)
+ mp_ptr xp, int leading, int zero)
{
int i, c;
mp_limb_t n;
@@ -2468,26 +1998,26 @@ speed_routine_count_zeros_setup (struct speed_params *s,
if (s->r == 0)
{
/* Make uniformly distributed data. If zero isn't allowed then change
- it to 1 for leading, or 0x800..00 for trailing. */
+ it to 1 for leading, or 0x800..00 for trailing. */
MPN_COPY (xp, s->xp_block, SPEED_BLOCK_SIZE);
if (! zero)
- for (i = 0; i < SPEED_BLOCK_SIZE; i++)
- if (xp[i] == 0)
- xp[i] = leading ? 1 : GMP_LIMB_HIGHBIT;
+ for (i = 0; i < SPEED_BLOCK_SIZE; i++)
+ if (xp[i] == 0)
+ xp[i] = leading ? 1 : GMP_LIMB_HIGHBIT;
}
else if (s->r == 1)
{
/* Make counts uniformly distributed. A randomly chosen bit is set, and
- for leading the rest above it are cleared, or for trailing then the
- rest below. */
+ for leading the rest above it are cleared, or for trailing then the
+ rest below. */
for (i = 0; i < SPEED_BLOCK_SIZE; i++)
- {
- mp_limb_t set = CNST_LIMB(1) << (s->yp_block[i] % GMP_LIMB_BITS);
- mp_limb_t keep_below = set-1;
- mp_limb_t keep_above = MP_LIMB_T_MAX ^ keep_below;
- mp_limb_t keep = (leading ? keep_below : keep_above);
- xp[i] = (s->xp_block[i] & keep) | set;
- }
+ {
+ mp_limb_t set = CNST_LIMB(1) << (s->yp_block[i] % BITS_PER_MP_LIMB);
+ mp_limb_t keep_below = set-1;
+ mp_limb_t keep_above = MP_LIMB_T_MAX ^ keep_below;
+ mp_limb_t keep = (leading ? keep_below : keep_above);
+ xp[i] = (s->xp_block[i] & keep) | set;
+ }
}
else
{
@@ -2502,9 +2032,9 @@ speed_routine_count_zeros_setup (struct speed_params *s,
xp[i] ^= c;
if (leading)
- count_leading_zeros (c, n);
+ count_leading_zeros (c, n);
else
- count_trailing_zeros (c, n);
+ count_trailing_zeros (c, n);
}
return 1;
@@ -2620,7 +2150,7 @@ speed_gmp_randseed_ui (struct speed_params *s)
gmp_randseed_ui (rstate, (unsigned long) s->xp_block[j]);
j++;
if (j >= SPEED_BLOCK_SIZE)
- j = 0;
+ j = 0;
}
while (--i != 0);
t = speed_endtime ();
diff --git a/gmp/tune/div_qr_1_tune.c b/gmp/tune/div_qr_1_tune.c
deleted file mode 100644
index 7e928dcce9..0000000000
--- a/gmp/tune/div_qr_1_tune.c
+++ /dev/null
@@ -1,47 +0,0 @@
-/* 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/gmp/tune/div_qr_1n_pi1_1.c b/gmp/tune/div_qr_1n_pi1_1.c
deleted file mode 100644
index 6dd8ceb438..0000000000
--- a/gmp/tune/div_qr_1n_pi1_1.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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/gmp/tune/div_qr_1n_pi1_2.c b/gmp/tune/div_qr_1n_pi1_2.c
deleted file mode 100644
index acc80d4695..0000000000
--- a/gmp/tune/div_qr_1n_pi1_2.c
+++ /dev/null
@@ -1,39 +0,0 @@
-/* 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"
diff --git a/gmp/tune/divrem1div.c b/gmp/tune/divrem1div.c
index b680f9d222..5580f80578 100644
--- a/gmp/tune/divrem1div.c
+++ b/gmp/tune/divrem1div.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_divrem_1
diff --git a/gmp/tune/divrem1inv.c b/gmp/tune/divrem1inv.c
index 598c03c739..73ed57f411 100644
--- a/gmp/tune/divrem1inv.c
+++ b/gmp/tune/divrem1inv.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_divrem_1
diff --git a/gmp/tune/divrem2div.c b/gmp/tune/divrem2div.c
index cd7f3f5a88..10b50e2f83 100644
--- a/gmp/tune/divrem2div.c
+++ b/gmp/tune/divrem2div.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/divrem2inv.c b/gmp/tune/divrem2inv.c
index bd7c4268f7..05644b2560 100644
--- a/gmp/tune/divrem2inv.c
+++ b/gmp/tune/divrem2inv.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/freq.c b/gmp/tune/freq.c
index 210f42564e..f1092e2640 100644
--- a/gmp/tune/freq.c
+++ b/gmp/tune/freq.c
@@ -1,32 +1,21 @@
/* CPU frequency determination.
-Copyright 1999-2004 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Currently we don't get a CPU frequency on the following systems,
@@ -470,7 +459,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)
@@ -491,7 +480,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;
diff --git a/gmp/tune/gcdext_double.c b/gmp/tune/gcdext_double.c
index c72f07ea9f..5470f1aff5 100644
--- a/gmp/tune/gcdext_double.c
+++ b/gmp/tune/gcdext_double.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/gcdext_single.c b/gmp/tune/gcdext_single.c
index 292e9e87e0..1bc47e786e 100644
--- a/gmp/tune/gcdext_single.c
+++ b/gmp/tune/gcdext_single.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/gcdextod.c b/gmp/tune/gcdextod.c
index c08087d480..957864c5e9 100644
--- a/gmp/tune/gcdextod.c
+++ b/gmp/tune/gcdextod.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/gcdextos.c b/gmp/tune/gcdextos.c
index fb8af29279..afde776f7d 100644
--- a/gmp/tune/gcdextos.c
+++ b/gmp/tune/gcdextos.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/hgcd_appr_lehmer.c b/gmp/tune/hgcd_appr_lehmer.c
deleted file mode 100644
index 790e61e3cb..0000000000
--- a/gmp/tune/hgcd_appr_lehmer.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* mpn/generic/hgcd_appr.c forced to use Lehmer's quadratic algorithm. */
-
-/*
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 HGCD_APPR_THRESHOLD
-#define HGCD_APPR_THRESHOLD MP_SIZE_T_MAX
-#define __gmpn_hgcd_appr mpn_hgcd_appr_lehmer
-#define __gmpn_hgcd_appr_itch mpn_hgcd_appr_lehmer_itch
-
-#include "../mpn/generic/hgcd_appr.c"
diff --git a/gmp/tune/hgcd_lehmer.c b/gmp/tune/hgcd_lehmer.c
deleted file mode 100644
index 11d0ef8821..0000000000
--- a/gmp/tune/hgcd_lehmer.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* mpn/generic/hgcd.c forced to use Lehmer's quadratic algorithm. */
-
-/*
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 HGCD_THRESHOLD
-#define HGCD_THRESHOLD MP_SIZE_T_MAX
-#define __gmpn_hgcd mpn_hgcd_lehmer
-#define __gmpn_hgcd_itch mpn_hgcd_lehmer_itch
-
-#include "../mpn/generic/hgcd.c"
diff --git a/gmp/tune/hgcd_reduce_1.c b/gmp/tune/hgcd_reduce_1.c
deleted file mode 100644
index 383c2d7009..0000000000
--- a/gmp/tune/hgcd_reduce_1.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* mpn/generic/hgcd_reduce.c forced to use hgcd. */
-
-/*
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 HGCD_REDUCE_THRESHOLD
-#define HGCD_REDUCE_THRESHOLD MP_SIZE_T_MAX
-#define __gmpn_hgcd_reduce mpn_hgcd_reduce_1
-#define __gmpn_hgcd_reduce_itch mpn_hgcd_reduce_1_itch
-
-
-#include "../mpn/generic/hgcd_reduce.c"
diff --git a/gmp/tune/hgcd_reduce_2.c b/gmp/tune/hgcd_reduce_2.c
deleted file mode 100644
index ac18b6033a..0000000000
--- a/gmp/tune/hgcd_reduce_2.c
+++ /dev/null
@@ -1,40 +0,0 @@
-/* mpn/generic/hgcd_reduce.c forced to use hgcd_appr. */
-
-/*
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 HGCD_REDUCE_THRESHOLD
-#define HGCD_REDUCE_THRESHOLD 0
-#define __gmpn_hgcd_reduce mpn_hgcd_reduce_2
-#define __gmpn_hgcd_reduce_itch mpn_hgcd_reduce_2_itch
-
-#include "../mpn/generic/hgcd_reduce.c"
diff --git a/gmp/tune/hppa.asm b/gmp/tune/hppa.asm
index fc9d62e3b2..e99a399e4a 100644
--- a/gmp/tune/hppa.asm
+++ b/gmp/tune/hppa.asm
@@ -1,32 +1,21 @@
dnl HPPA 32-bit time stamp counter access routine.
dnl Copyright 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/hppa2.asm b/gmp/tune/hppa2.asm
index 57ef4c4683..9755c907d2 100644
--- a/gmp/tune/hppa2.asm
+++ b/gmp/tune/hppa2.asm
@@ -1,32 +1,21 @@
dnl HPPA 64-bit time stamp counter access routine.
dnl Copyright 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/hppa2w.asm b/gmp/tune/hppa2w.asm
index 215a0cc5c2..ddf0ea9b0a 100644
--- a/gmp/tune/hppa2w.asm
+++ b/gmp/tune/hppa2w.asm
@@ -1,32 +1,21 @@
dnl HPPA 64-bit time stamp counter access routine.
dnl Copyright 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/ia64.asm b/gmp/tune/ia64.asm
index 0651111031..ef487db8f6 100644
--- a/gmp/tune/ia64.asm
+++ b/gmp/tune/ia64.asm
@@ -1,32 +1,21 @@
dnl IA-64 time stamp counter access routine.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/jacbase1.c b/gmp/tune/jacbase1.c
index a73df8b723..2a0b859c2c 100644
--- a/gmp/tune/jacbase1.c
+++ b/gmp/tune/jacbase1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/jacbase2.c b/gmp/tune/jacbase2.c
index b99ebe9061..6bbe7e9e93 100644
--- a/gmp/tune/jacbase2.c
+++ b/gmp/tune/jacbase2.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/jacbase3.c b/gmp/tune/jacbase3.c
index 408b0fed6b..f8f89d49be 100644
--- a/gmp/tune/jacbase3.c
+++ b/gmp/tune/jacbase3.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/jacbase4.c b/gmp/tune/jacbase4.c
deleted file mode 100644
index 70d535240b..0000000000
--- a/gmp/tune/jacbase4.c
+++ /dev/null
@@ -1,38 +0,0 @@
-/* mpn/generic/jacbase.c method 4.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 JACOBI_BASE_METHOD
-#define JACOBI_BASE_METHOD 4
-#define __gmpn_jacobi_base mpn_jacobi_base_4
-
-#include "mpn/generic/jacbase.c"
diff --git a/gmp/tune/many.pl b/gmp/tune/many.pl
index 524a67dd1e..11b5cf4521 100644..100755
--- a/gmp/tune/many.pl
+++ b/gmp/tune/many.pl
@@ -1,32 +1,21 @@
#! /usr/bin/perl -w
-# Copyright 2000-2002 Free Software Foundation, Inc.
+# Copyright 2000, 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 either:
+# The GNU MP Library is free software; you can redistribute it and/or modify
+# it under the terms of the GNU 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 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.
#
-# or
-#
-# * the GNU General Public License as published by the Free Software
-# Foundation; either version 2 of the License, or (at your option) any
-# later version.
-#
-# or both in parallel, as here.
-#
-# The GNU MP Library is distributed in the hope that 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 should have received a copy of the GNU Lesser General Public License
+# along with the GNU MP Library. If not, see http://www.gnu.org/licenses/.
# Usage: cd $builddir/tune
@@ -380,14 +369,23 @@ my @table =
},
{
- 'regexp'=> 'add_n_sub_n',
+ 'regexp'=> 'addsub_n',
'ret' => 'mp_limb_t',
'args' => 'mp_ptr sum, mp_ptr diff, mp_srcptr xp, mp_srcptr yp, mp_size_t size',
'speed_flags'=> 'FLAG_R_OPTIONAL',
},
{
- 'regexp'=> 'com|copyi|copyd',
+ 'regexp'=> 'bdivmod',
+ 'ret' => 'mp_limb_t',
+ 'args' => 'mp_ptr qp, mp_ptr up, mp_size_t usize, mp_srcptr vp, mp_size_t vsize, unsigned long int d',
+ 'carrys'=> [''],
+ 'try' => 'none',
+ 'speed' => 'none',
+ },
+
+ {
+ 'regexp'=> 'com_n|copyi|copyd',
'ret' => 'void',
'args' => 'mp_ptr wp, mp_srcptr xp, mp_size_t size',
'speed' => 'SPEED_ROUTINE_MPN_COPY',
diff --git a/gmp/tune/mod_1_1-1.c b/gmp/tune/mod_1_1-1.c
deleted file mode 100644
index 7eb7fcdf79..0000000000
--- a/gmp/tune/mod_1_1-1.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* mpn/generic/mod_1_1.c method 1.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 MOD_1_1P_METHOD
-#define MOD_1_1P_METHOD 1
-#undef mpn_mod_1_1p
-#undef mpn_mod_1_1p_cps
-#define mpn_mod_1_1p mpn_mod_1_1p_1
-#define mpn_mod_1_1p_cps mpn_mod_1_1p_cps_1
-
-#include "mpn/generic/mod_1_1.c"
diff --git a/gmp/tune/mod_1_1-2.c b/gmp/tune/mod_1_1-2.c
deleted file mode 100644
index 52ca57749b..0000000000
--- a/gmp/tune/mod_1_1-2.c
+++ /dev/null
@@ -1,41 +0,0 @@
-/* mpn/generic/mod_1_1.c method 2.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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 MOD_1_1P_METHOD
-#define MOD_1_1P_METHOD 2
-#undef mpn_mod_1_1p
-#undef mpn_mod_1_1p_cps
-#define mpn_mod_1_1p mpn_mod_1_1p_2
-#define mpn_mod_1_1p_cps mpn_mod_1_1p_cps_2
-
-#include "mpn/generic/mod_1_1.c"
diff --git a/gmp/tune/mod_1_div.c b/gmp/tune/mod_1_div.c
index a0663be055..1c01e8c692 100644
--- a/gmp/tune/mod_1_div.c
+++ b/gmp/tune/mod_1_div.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_mod_1
@@ -35,12 +24,8 @@ see https://www.gnu.org/licenses/. */
#undef MOD_1_NORM_THRESHOLD
#undef MOD_1_UNNORM_THRESHOLD
-#undef MOD_1N_TO_MOD_1_1_THRESHOLD
-#undef MOD_1U_TO_MOD_1_1_THRESHOLD
#define MOD_1_NORM_THRESHOLD MP_SIZE_T_MAX
#define MOD_1_UNNORM_THRESHOLD MP_SIZE_T_MAX
-#define MOD_1N_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX
-#define MOD_1U_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX
#define __gmpn_mod_1 mpn_mod_1_div
#include "mpn/generic/mod_1.c"
diff --git a/gmp/tune/mod_1_inv.c b/gmp/tune/mod_1_inv.c
index 92c936ddcf..448d093f31 100644
--- a/gmp/tune/mod_1_inv.c
+++ b/gmp/tune/mod_1_inv.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 OPERATION_mod_1
@@ -35,12 +24,8 @@ see https://www.gnu.org/licenses/. */
#undef MOD_1_NORM_THRESHOLD
#undef MOD_1_UNNORM_THRESHOLD
-#undef MOD_1N_TO_MOD_1_1_THRESHOLD
-#undef MOD_1U_TO_MOD_1_1_THRESHOLD
#define MOD_1_NORM_THRESHOLD 0
#define MOD_1_UNNORM_THRESHOLD 0
-#define MOD_1N_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX
-#define MOD_1U_TO_MOD_1_1_THRESHOLD MP_SIZE_T_MAX
#define __gmpn_mod_1 mpn_mod_1_inv
#include "mpn/generic/mod_1.c"
diff --git a/gmp/tune/modlinv.c b/gmp/tune/modlinv.c
index e3f2063e07..3ed0c8a03f 100644
--- a/gmp/tune/modlinv.c
+++ b/gmp/tune/modlinv.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 <stdio.h>
#include "gmp.h"
@@ -41,7 +30,7 @@ see https://www.gnu.org/licenses/. */
dependent chain, whereas the "2*" in the standard version isn't.
Depending on the CPU this should be the same or a touch slower. */
-#if GMP_LIMB_BITS <= 32
+#if BITS_PER_MP_LIMB <= 32
#define binvert_limb_mul1(inv,n) \
do { \
mp_limb_t __n = (n); \
@@ -55,7 +44,7 @@ see https://www.gnu.org/licenses/. */
} while (0)
#endif
-#if GMP_LIMB_BITS > 32 && GMP_LIMB_BITS <= 64
+#if BITS_PER_MP_LIMB > 32 && BITS_PER_MP_LIMB <= 64
#define binvert_limb_mul1(inv,n) \
do { \
mp_limb_t __n = (n); \
@@ -111,7 +100,7 @@ see https://www.gnu.org/licenses/. */
\
ASSERT ((__n & 1) == 1); \
\
- __count = GMP_LIMB_BITS-1; \
+ __count = BITS_PER_MP_LIMB-1; \
do \
{ \
__inv >>= 1; \
@@ -142,11 +131,11 @@ see https://www.gnu.org/licenses/. */
\
ASSERT ((__n & 1) == 1); \
\
- __count = GMP_LIMB_BITS-1; \
+ __count = BITS_PER_MP_LIMB-1; \
do \
{ \
__lowbit = __rem & 1; \
- __inv = (__inv >> 1) | (__lowbit << (GMP_LIMB_BITS-1)); \
+ __inv = (__inv >> 1) | (__lowbit << (BITS_PER_MP_LIMB-1)); \
__rem = (__rem - (__n & -__lowbit)) >> 1; \
} \
while (-- __count); \
diff --git a/gmp/tune/noop.c b/gmp/tune/noop.c
index 5c13c96ee3..7c7f1b5fe6 100644
--- a/gmp/tune/noop.c
+++ b/gmp/tune/noop.c
@@ -9,28 +9,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/pentium.asm b/gmp/tune/pentium.asm
index fb1e8332c8..369a8ea76f 100644
--- a/gmp/tune/pentium.asm
+++ b/gmp/tune/pentium.asm
@@ -1,32 +1,21 @@
dnl x86 pentium time stamp counter access routine.
dnl Copyright 1999, 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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/powerpc.asm b/gmp/tune/powerpc.asm
index 2f4ac27bea..19ab901386 100644
--- a/gmp/tune/powerpc.asm
+++ b/gmp/tune/powerpc.asm
@@ -1,32 +1,21 @@
dnl PowerPC mftb_function -- read time base registers.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
@@ -43,7 +32,7 @@ L(again):
mftbu r4
mftb r5
mftbu r6
- cmpw cr0, r4, r6
+ cmp cr0, r4, r6
bne L(again)
stw r5, 0(r3)
diff --git a/gmp/tune/powerpc64.asm b/gmp/tune/powerpc64.asm
index 1ade99638a..eb705466da 100644
--- a/gmp/tune/powerpc64.asm
+++ b/gmp/tune/powerpc64.asm
@@ -1,32 +1,21 @@
dnl PowerPC mftb_function -- read time base registers, 64-bit integer.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 2002, 2003, 2004 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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
-dnl The GNU MP Library is distributed in the hope that it will be useful, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/powm_mod.c b/gmp/tune/powm_mod.c
index 7c20f53e70..e65f512e85 100644
--- a/gmp/tune/powm_mod.c
+++ b/gmp/tune/powm_mod.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/powm_redc.c b/gmp/tune/powm_redc.c
index c34bb2e0a5..a9e4bb502a 100644
--- a/gmp/tune/powm_redc.c
+++ b/gmp/tune/powm_redc.c
@@ -6,28 +6,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/pre_divrem_1.c b/gmp/tune/pre_divrem_1.c
index 388ca4150a..2b3fb79e22 100644
--- a/gmp/tune/pre_divrem_1.c
+++ b/gmp/tune/pre_divrem_1.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/tune/sb_div.c b/gmp/tune/sb_div.c
new file mode 100644
index 0000000000..4d52a24ce3
--- /dev/null
+++ b/gmp/tune/sb_div.c
@@ -0,0 +1,30 @@
+/* mpn/generic/sb_divrem_mn.c forced to use plain udiv_qrnnd. */
+
+/*
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+#ifdef DIV_SB_PREINV_THRESHOLD
+#undef DIV_SB_PREINV_THRESHOLD
+#endif
+#define DIV_SB_PREINV_THRESHOLD MP_SIZE_T_MAX
+#define __gmpn_sb_divrem_mn mpn_sb_divrem_mn_div
+
+#include "mpn/generic/sb_divrem_mn.c"
diff --git a/gmp/tune/sb_inv.c b/gmp/tune/sb_inv.c
new file mode 100644
index 0000000000..f8d798b43b
--- /dev/null
+++ b/gmp/tune/sb_inv.c
@@ -0,0 +1,30 @@
+/* mpn/generic/sb_divrem_mn.c forced to use udiv_qrnnd_preinv. */
+
+/*
+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.
+
+The GNU MP Library is distributed in the hope that it will be useful, but
+WITHOUT ANY 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"
+
+#ifdef DIV_SB_PREINV_THRESHOLD
+#undef DIV_SB_PREINV_THRESHOLD
+#endif
+#define DIV_SB_PREINV_THRESHOLD 0
+#define __gmpn_sb_divrem_mn mpn_sb_divrem_mn_inv
+
+#include "mpn/generic/sb_divrem_mn.c"
diff --git a/gmp/tune/set_strb.c b/gmp/tune/set_strb.c
index 842ec4cd44..c67b09ccaa 100644
--- a/gmp/tune/set_strb.c
+++ b/gmp/tune/set_strb.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 __gmpn_set_str mpn_set_str_basecase
#define __gmpn_bc_set_str mpn_bc_set_str_basecase
diff --git a/gmp/tune/set_strp.c b/gmp/tune/set_strp.c
index 5520f28696..701ab2bf2b 100644
--- a/gmp/tune/set_strp.c
+++ b/gmp/tune/set_strp.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 TUNE_PROGRAM_BUILD 1 /* for gmp-impl.h */
diff --git a/gmp/tune/set_strs.c b/gmp/tune/set_strs.c
index 75b6f39b4d..d8edc7dfde 100644
--- a/gmp/tune/set_strs.c
+++ b/gmp/tune/set_strs.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 __gmpn_set_str mpn_set_str_subquad
#define __gmpn_bc_set_str mpn_bc_set_str_subquad
diff --git a/gmp/tune/sparcv9.asm b/gmp/tune/sparcv9.asm
index f0981c70fe..b951ff3de2 100644
--- a/gmp/tune/sparcv9.asm
+++ b/gmp/tune/sparcv9.asm
@@ -1,32 +1,21 @@
dnl Sparc v9 32-bit time stamp counter access routine.
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 either:
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/tune/speed-ext.c b/gmp/tune/speed-ext.c
index e7fb8b9f60..04760a5eab 100644
--- a/gmp/tune/speed-ext.c
+++ b/gmp/tune/speed-ext.c
@@ -5,28 +5,17 @@ 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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 extension here is three versions of an mpn arithmetic mean. These
@@ -68,9 +57,9 @@ see https://www.gnu.org/licenses/. */
#define SPEED_EXTRA_PROTOS \
- double speed_mean_calls (struct speed_params *s); \
- double speed_mean_open (struct speed_params *s); \
- double speed_mean_open2 (struct speed_params *s);
+ double speed_mean_calls __GMP_PROTO ((struct speed_params *s)); \
+ double speed_mean_open __GMP_PROTO ((struct speed_params *s)); \
+ double speed_mean_open2 __GMP_PROTO ((struct speed_params *s));
#define SPEED_EXTRA_ROUTINES \
{ "mean_calls", speed_mean_calls }, \
@@ -93,8 +82,8 @@ mean_calls (mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size)
ASSERT (size >= 1);
c = mpn_add_n (wp, xp, yp, size);
- ret = mpn_rshift (wp, wp, size, 1) >> (GMP_LIMB_BITS-1);
- wp[size-1] |= (c << (GMP_LIMB_BITS-1));
+ ret = mpn_rshift (wp, wp, size, 1) >> (BITS_PER_MP_LIMB-1);
+ wp[size-1] |= (c << (BITS_PER_MP_LIMB-1));
return ret;
}
@@ -118,7 +107,7 @@ mean_open (mp_ptr wp, mp_srcptr xp, mp_srcptr yp, mp_size_t size)
c = (wprev < x);
ret = (wprev & 1);
-#define RSHIFT(hi,lo) (((lo) >> 1) | ((hi) << (GMP_LIMB_BITS-1)))
+#define RSHIFT(hi,lo) (((lo) >> 1) | ((hi) << (BITS_PER_MP_LIMB-1)))
for (i = 1; i < size; i++)
{
diff --git a/gmp/tune/speed.c b/gmp/tune/speed.c
index 12d53bcaa3..2bb7f7d933 100644
--- a/gmp/tune/speed.c
+++ b/gmp/tune/speed.c
@@ -1,32 +1,21 @@
/* Speed measuring program.
-Copyright 1999-2003, 2005, 2006, 2008-2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 2003, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Usage message is in the code below, run with no arguments to print it.
See README for interesting applications.
@@ -100,10 +89,10 @@ SPEED_EXTRA_PROTOS2
} while (0)
-#if GMP_LIMB_BITS == 32
+#if BITS_PER_MP_LIMB == 32
#define GMP_NUMB_0xAA (CNST_LIMB(0xAAAAAAAA) & GMP_NUMB_MASK)
#endif
-#if GMP_LIMB_BITS == 64
+#if BITS_PER_MP_LIMB == 64
#define GMP_NUMB_0xAA (CNST_LIMB(0xAAAAAAAAAAAAAAAA) & GMP_NUMB_MASK)
#endif
@@ -163,15 +152,8 @@ const struct routine_t {
{ "mpn_add_n", speed_mpn_add_n, FLAG_R_OPTIONAL },
{ "mpn_sub_n", speed_mpn_sub_n, FLAG_R_OPTIONAL },
- { "mpn_add_err1_n", speed_mpn_add_err1_n },
- { "mpn_add_err2_n", speed_mpn_add_err2_n },
- { "mpn_add_err3_n", speed_mpn_add_err3_n },
- { "mpn_sub_err1_n", speed_mpn_sub_err1_n },
- { "mpn_sub_err2_n", speed_mpn_sub_err2_n },
- { "mpn_sub_err3_n", speed_mpn_sub_err3_n },
-
-#if HAVE_NATIVE_mpn_add_n_sub_n
- { "mpn_add_n_sub_n", speed_mpn_add_n_sub_n, FLAG_R_OPTIONAL },
+#if HAVE_NATIVE_mpn_addsub_n
+ { "mpn_addsub_n", speed_mpn_addsub_n, FLAG_R_OPTIONAL },
#endif
{ "mpn_addmul_1", speed_mpn_addmul_1, FLAG_R },
@@ -208,12 +190,6 @@ const struct routine_t {
#if HAVE_NATIVE_mpn_mul_4
{ "mpn_mul_4", speed_mpn_mul_4, FLAG_R_OPTIONAL },
#endif
-#if HAVE_NATIVE_mpn_mul_5
- { "mpn_mul_5", speed_mpn_mul_5, FLAG_R_OPTIONAL },
-#endif
-#if HAVE_NATIVE_mpn_mul_6
- { "mpn_mul_6", speed_mpn_mul_6, FLAG_R_OPTIONAL },
-#endif
{ "mpn_divrem_1", speed_mpn_divrem_1, FLAG_R },
{ "mpn_divrem_1f", speed_mpn_divrem_1f, FLAG_R },
@@ -229,13 +205,6 @@ const struct routine_t {
{ "mpn_preinv_divrem_1f", speed_mpn_preinv_divrem_1f, FLAG_R },
{ "mpn_preinv_mod_1", speed_mpn_preinv_mod_1, FLAG_R },
- { "mpn_mod_1_1", speed_mpn_mod_1_1, FLAG_R },
- { "mpn_mod_1_1_1", speed_mpn_mod_1_1_1, FLAG_R },
- { "mpn_mod_1_1_2", speed_mpn_mod_1_1_2, FLAG_R },
- { "mpn_mod_1s_2", speed_mpn_mod_1_2, FLAG_R },
- { "mpn_mod_1s_3", speed_mpn_mod_1_3, FLAG_R },
- { "mpn_mod_1s_4", speed_mpn_mod_1_4, FLAG_R },
-
{ "mpn_divrem_1_div", speed_mpn_divrem_1_div, FLAG_R },
{ "mpn_divrem_1_inv", speed_mpn_divrem_1_inv, FLAG_R },
{ "mpn_divrem_1f_div", speed_mpn_divrem_1f_div, FLAG_R },
@@ -247,19 +216,9 @@ 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, },
-
{ "mpn_divexact_1", speed_mpn_divexact_1, FLAG_R },
{ "mpn_divexact_by3", speed_mpn_divexact_by3 },
- { "mpn_bdiv_q_1", speed_mpn_bdiv_q_1, FLAG_R },
- { "mpn_pi1_bdiv_q_1", speed_mpn_pi1_bdiv_q_1, FLAG_R_OPTIONAL },
{ "mpn_bdiv_dbm1c", speed_mpn_bdiv_dbm1c, FLAG_R_OPTIONAL },
#if HAVE_NATIVE_mpn_modexact_1_odd
@@ -271,8 +230,17 @@ const struct routine_t {
{ "mpn_mod_34lsub1", speed_mpn_mod_34lsub1 },
#endif
+ { "mpn_dc_tdiv_qr", speed_mpn_dc_tdiv_qr },
+ { "mpn_dc_divrem_n", speed_mpn_dc_divrem_n },
+ { "mpn_dc_divrem_sb", speed_mpn_dc_divrem_sb },
+ { "mpn_dc_divrem_sb_div", speed_mpn_dc_divrem_sb_div },
+ { "mpn_dc_divrem_sb_inv", speed_mpn_dc_divrem_sb_inv },
+
+ { "mpn_sb_divrem_m3", speed_mpn_sb_divrem_m3 },
+ { "mpn_sb_divrem_m3_div", speed_mpn_sb_divrem_m3_div },
+ { "mpn_sb_divrem_m3_inv", speed_mpn_sb_divrem_m3_inv },
+
{ "mpn_lshift", speed_mpn_lshift, FLAG_R },
- { "mpn_lshiftc", speed_mpn_lshiftc, FLAG_R },
{ "mpn_rshift", speed_mpn_rshift, FLAG_R },
{ "mpn_and_n", speed_mpn_and_n, FLAG_R_OPTIONAL },
@@ -283,7 +251,7 @@ const struct routine_t {
{ "mpn_nior_n", speed_mpn_nior_n, FLAG_R_OPTIONAL },
{ "mpn_xor_n", speed_mpn_xor_n, FLAG_R_OPTIONAL },
{ "mpn_xnor_n", speed_mpn_xnor_n, FLAG_R_OPTIONAL },
- { "mpn_com", speed_mpn_com },
+ { "mpn_com_n", speed_mpn_com_n },
{ "mpn_popcount", speed_mpn_popcount },
{ "mpn_hamdist", speed_mpn_hamdist },
@@ -292,17 +260,16 @@ const struct routine_t {
{ "mpn_hgcd", speed_mpn_hgcd },
{ "mpn_hgcd_lehmer", speed_mpn_hgcd_lehmer },
- { "mpn_hgcd_appr", speed_mpn_hgcd_appr },
- { "mpn_hgcd_appr_lehmer", speed_mpn_hgcd_appr_lehmer },
-
- { "mpn_hgcd_reduce", speed_mpn_hgcd_reduce },
- { "mpn_hgcd_reduce_1", speed_mpn_hgcd_reduce_1 },
- { "mpn_hgcd_reduce_2", speed_mpn_hgcd_reduce_2 },
{ "mpn_gcd_1", speed_mpn_gcd_1, FLAG_R_OPTIONAL },
{ "mpn_gcd_1N", speed_mpn_gcd_1N, FLAG_R_OPTIONAL },
{ "mpn_gcd", speed_mpn_gcd },
+#if 0
+ { "mpn_gcd_binary", speed_mpn_gcd_binary },
+ { "mpn_gcd_accel", speed_mpn_gcd_accel },
+ { "find_a", speed_find_a, FLAG_NODATA },
+#endif
{ "mpn_gcdext", speed_mpn_gcdext },
{ "mpn_gcdext_single", speed_mpn_gcdext_single },
@@ -317,7 +284,6 @@ const struct routine_t {
{ "mpn_jacobi_base_1", speed_mpn_jacobi_base_1 },
{ "mpn_jacobi_base_2", speed_mpn_jacobi_base_2 },
{ "mpn_jacobi_base_3", speed_mpn_jacobi_base_3 },
- { "mpn_jacobi_base_4", speed_mpn_jacobi_base_4 },
{ "mpn_mul", speed_mpn_mul, FLAG_R_OPTIONAL },
{ "mpn_mul_basecase", speed_mpn_mul_basecase,FLAG_R_OPTIONAL },
@@ -325,74 +291,27 @@ const struct routine_t {
#if HAVE_NATIVE_mpn_sqr_diagonal
{ "mpn_sqr_diagonal", speed_mpn_sqr_diagonal },
#endif
-#if HAVE_NATIVE_mpn_sqr_diag_addlsh1
- { "mpn_sqr_diag_addlsh1", speed_mpn_sqr_diag_addlsh1 },
-#endif
{ "mpn_mul_n", speed_mpn_mul_n },
- { "mpn_sqr", speed_mpn_sqr },
-
- { "mpn_toom2_sqr", speed_mpn_toom2_sqr },
- { "mpn_toom3_sqr", speed_mpn_toom3_sqr },
- { "mpn_toom4_sqr", speed_mpn_toom4_sqr },
- { "mpn_toom6_sqr", speed_mpn_toom6_sqr },
- { "mpn_toom8_sqr", speed_mpn_toom8_sqr },
- { "mpn_toom22_mul", speed_mpn_toom22_mul },
- { "mpn_toom33_mul", speed_mpn_toom33_mul },
- { "mpn_toom44_mul", speed_mpn_toom44_mul },
- { "mpn_toom6h_mul", speed_mpn_toom6h_mul },
- { "mpn_toom8h_mul", speed_mpn_toom8h_mul },
- { "mpn_toom32_mul", speed_mpn_toom32_mul },
- { "mpn_toom42_mul", speed_mpn_toom42_mul },
- { "mpn_toom43_mul", speed_mpn_toom43_mul },
- { "mpn_toom63_mul", speed_mpn_toom63_mul },
- { "mpn_nussbaumer_mul", speed_mpn_nussbaumer_mul },
- { "mpn_nussbaumer_mul_sqr",speed_mpn_nussbaumer_mul_sqr},
-#if WANT_OLD_FFT_FULL
+ { "mpn_sqr", speed_mpn_sqr_n },
+
+ { "mpn_kara_mul_n", speed_mpn_kara_mul_n },
+ { "mpn_kara_sqr_n", speed_mpn_kara_sqr_n },
+ { "mpn_toom3_mul_n", speed_mpn_toom3_mul_n },
+ { "mpn_toom3_sqr_n", speed_mpn_toom3_sqr_n },
{ "mpn_mul_fft_full", speed_mpn_mul_fft_full },
{ "mpn_mul_fft_full_sqr", speed_mpn_mul_fft_full_sqr },
-#endif
+
{ "mpn_mul_fft", speed_mpn_mul_fft, FLAG_R_OPTIONAL },
{ "mpn_mul_fft_sqr", speed_mpn_mul_fft_sqr, FLAG_R_OPTIONAL },
- { "mpn_mullo_n", speed_mpn_mullo_n },
- { "mpn_mullo_basecase", speed_mpn_mullo_basecase },
-
- { "mpn_mulmid_basecase", speed_mpn_mulmid_basecase, FLAG_R_OPTIONAL },
- { "mpn_toom42_mulmid", speed_mpn_toom42_mulmid },
- { "mpn_mulmid_n", speed_mpn_mulmid_n },
- { "mpn_mulmid", speed_mpn_mulmid, FLAG_R_OPTIONAL },
-
- { "mpn_bc_mulmod_bnm1", speed_mpn_bc_mulmod_bnm1 },
- { "mpn_mulmod_bnm1", speed_mpn_mulmod_bnm1 },
- { "mpn_mulmod_bnm1_rounded", speed_mpn_mulmod_bnm1_rounded },
- { "mpn_sqrmod_bnm1", speed_mpn_sqrmod_bnm1 },
-
- { "mpn_invert", speed_mpn_invert },
- { "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},
- { "mpn_mu_div_qr", speed_mpn_mu_div_qr, FLAG_R_OPTIONAL},
- { "mpn_mupi_div_qr", speed_mpn_mupi_div_qr, FLAG_R_OPTIONAL},
- { "mpn_sbpi1_divappr_q", speed_mpn_sbpi1_divappr_q, FLAG_R_OPTIONAL},
- { "mpn_dcpi1_divappr_q", speed_mpn_dcpi1_divappr_q, FLAG_R_OPTIONAL},
-
- { "mpn_sbpi1_bdiv_qr", speed_mpn_sbpi1_bdiv_qr },
- { "mpn_dcpi1_bdiv_qr", speed_mpn_dcpi1_bdiv_qr },
- { "mpn_sbpi1_bdiv_q", speed_mpn_sbpi1_bdiv_q },
- { "mpn_dcpi1_bdiv_q", speed_mpn_dcpi1_bdiv_q },
-
- { "mpn_broot", speed_mpn_broot, FLAG_R },
- { "mpn_broot_invm1", speed_mpn_broot_invm1, FLAG_R },
- { "mpn_brootinv", speed_mpn_brootinv, FLAG_R },
-
- { "mpn_get_str", speed_mpn_get_str, FLAG_R_OPTIONAL },
- { "mpn_set_str", speed_mpn_set_str, FLAG_R_OPTIONAL },
- { "mpn_set_str_basecase", speed_mpn_bc_set_str, FLAG_R_OPTIONAL },
+ { "mpn_mullow_n", speed_mpn_mullow_n },
+ { "mpn_mullow_basecase", speed_mpn_mullow_basecase},
+
+ { "mpn_get_str", speed_mpn_get_str, FLAG_R_OPTIONAL },
+
+ { "mpn_set_str", speed_mpn_set_str, FLAG_R_OPTIONAL },
+ { "mpn_set_str_basecase",speed_mpn_bc_set_str, FLAG_R_OPTIONAL },
{ "mpn_sqrtrem", speed_mpn_sqrtrem },
{ "mpn_rootrem", speed_mpn_rootrem, FLAG_R },
@@ -405,18 +324,14 @@ const struct routine_t {
{ "mpz_add", speed_mpz_add },
{ "mpz_bin_uiui", speed_mpz_bin_uiui, FLAG_NODATA | FLAG_R_OPTIONAL },
- { "mpz_bin_ui", speed_mpz_bin_ui, FLAG_NODATA | FLAG_R_OPTIONAL },
{ "mpz_fac_ui", speed_mpz_fac_ui, FLAG_NODATA },
{ "mpz_powm", speed_mpz_powm },
{ "mpz_powm_mod", speed_mpz_powm_mod },
{ "mpz_powm_redc", speed_mpz_powm_redc },
- { "mpz_powm_sec", speed_mpz_powm_sec },
{ "mpz_powm_ui", speed_mpz_powm_ui, FLAG_R_OPTIONAL },
{ "mpz_mod", speed_mpz_mod },
{ "mpn_redc_1", speed_mpn_redc_1 },
- { "mpn_redc_2", speed_mpn_redc_2 },
- { "mpn_redc_n", speed_mpn_redc_n },
{ "MPN_COPY", speed_MPN_COPY },
{ "MPN_COPY_INCR", speed_MPN_COPY_INCR },
@@ -428,71 +343,19 @@ const struct routine_t {
#if HAVE_NATIVE_mpn_copyd
{ "mpn_copyd", speed_mpn_copyd },
#endif
- { "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 == 1
- { "mpn_sublsh1_n", speed_mpn_sublsh1_n, FLAG_R_OPTIONAL },
-#endif
-#if HAVE_NATIVE_mpn_addlsh1_n_ip1
- { "mpn_addlsh1_n_ip1", speed_mpn_addlsh1_n_ip1 },
-#endif
-#if HAVE_NATIVE_mpn_addlsh1_n_ip2
- { "mpn_addlsh1_n_ip2", speed_mpn_addlsh1_n_ip2 },
-#endif
-#if HAVE_NATIVE_mpn_sublsh1_n_ip1
- { "mpn_sublsh1_n_ip1", speed_mpn_sublsh1_n_ip1 },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh1_n == 1
- { "mpn_rsblsh1_n", speed_mpn_rsblsh1_n, FLAG_R_OPTIONAL },
-#endif
-#if HAVE_NATIVE_mpn_addlsh2_n == 1
- { "mpn_addlsh2_n", speed_mpn_addlsh2_n, FLAG_R_OPTIONAL },
-#endif
-#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
- { "mpn_addlsh2_n_ip1", speed_mpn_addlsh2_n_ip1 },
+#if HAVE_NATIVE_mpn_addlsh1_n
+ { "mpn_addlsh1_n", speed_mpn_addlsh1_n },
#endif
-#if HAVE_NATIVE_mpn_addlsh2_n_ip2
- { "mpn_addlsh2_n_ip2", speed_mpn_addlsh2_n_ip2 },
-#endif
-#if HAVE_NATIVE_mpn_sublsh2_n_ip1
- { "mpn_sublsh2_n_ip1", speed_mpn_sublsh2_n_ip1 },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh2_n == 1
- { "mpn_rsblsh2_n", speed_mpn_rsblsh2_n, FLAG_R_OPTIONAL },
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n
- { "mpn_addlsh_n", speed_mpn_addlsh_n, FLAG_R_OPTIONAL },
-#endif
-#if HAVE_NATIVE_mpn_sublsh_n
- { "mpn_sublsh_n", speed_mpn_sublsh_n, FLAG_R_OPTIONAL },
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip1
- { "mpn_addlsh_n_ip1", speed_mpn_addlsh_n_ip1 },
-#endif
-#if HAVE_NATIVE_mpn_addlsh_n_ip2
- { "mpn_addlsh_n_ip2", speed_mpn_addlsh_n_ip2 },
-#endif
-#if HAVE_NATIVE_mpn_sublsh_n_ip1
- { "mpn_sublsh_n_ip1", speed_mpn_sublsh_n_ip1 },
-#endif
-#if HAVE_NATIVE_mpn_rsblsh_n
- { "mpn_rsblsh_n", speed_mpn_rsblsh_n, FLAG_R_OPTIONAL },
+#if HAVE_NATIVE_mpn_sublsh1_n
+ { "mpn_sublsh1_n", speed_mpn_sublsh1_n },
#endif
#if HAVE_NATIVE_mpn_rsh1add_n
- { "mpn_rsh1add_n", speed_mpn_rsh1add_n, FLAG_R_OPTIONAL },
+ { "mpn_rsh1add_n", speed_mpn_rsh1add_n },
#endif
#if HAVE_NATIVE_mpn_rsh1sub_n
- { "mpn_rsh1sub_n", speed_mpn_rsh1sub_n, FLAG_R_OPTIONAL },
+ { "mpn_rsh1sub_n", speed_mpn_rsh1sub_n },
#endif
- { "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 },
{ "binvert_limb", speed_binvert_limb, FLAG_NODATA },
@@ -522,6 +385,8 @@ const struct routine_t {
{ "count_trailing_zeros", speed_count_trailing_zeros, FLAG_NODATA | FLAG_R_OPTIONAL },
{ "udiv_qrnnd", speed_udiv_qrnnd, FLAG_R_OPTIONAL },
+ { "udiv_qrnnd_preinv1", speed_udiv_qrnnd_preinv1, FLAG_R_OPTIONAL },
+ { "udiv_qrnnd_preinv2", speed_udiv_qrnnd_preinv2, FLAG_R_OPTIONAL },
{ "udiv_qrnnd_c", speed_udiv_qrnnd_c, FLAG_R_OPTIONAL },
#if HAVE_NATIVE_mpn_udiv_qrnnd
{ "mpn_udiv_qrnnd", speed_mpn_udiv_qrnnd, FLAG_R_OPTIONAL },
@@ -884,7 +749,7 @@ run_gnuplot (int argc, char *argv[])
fprintf (fp, "set key left\n");
/* designed to make it possible to see crossovers easily */
- fprintf (fp, "set style data lines\n");
+ fprintf (fp, "set data style lines\n");
fprintf (fp, "plot ");
for (i = 0; i < num_choices; i++)
@@ -914,7 +779,7 @@ run_gnuplot (int argc, char *argv[])
/* Return a limb with n many one bits (starting from the least significant) */
#define LIMB_ONES(n) \
- ((n) == GMP_LIMB_BITS ? MP_LIMB_T_MAX \
+ ((n) == BITS_PER_MP_LIMB ? MP_LIMB_T_MAX \
: (n) == 0 ? CNST_LIMB(0) \
: (CNST_LIMB(1) << (n)) - 1)
@@ -941,7 +806,7 @@ r_string (const char *s)
{
if (siz > 1 || siz < -1)
printf ("Warning, r parameter %s truncated to %d bits\n",
- s_orig, GMP_LIMB_BITS);
+ s_orig, BITS_PER_MP_LIMB);
return l;
}
}
@@ -954,10 +819,10 @@ r_string (const char *s)
if (strcmp (s, "bits") == 0)
{
mp_limb_t l;
- if (n > GMP_LIMB_BITS)
+ if (n > BITS_PER_MP_LIMB)
{
fprintf (stderr, "%ld bit parameter invalid (max %d bits)\n",
- n, GMP_LIMB_BITS);
+ n, BITS_PER_MP_LIMB);
exit (1);
}
mpn_random (&l, 1);
@@ -965,10 +830,10 @@ r_string (const char *s)
}
else if (strcmp (s, "ones") == 0)
{
- if (n > GMP_LIMB_BITS)
+ if (n > BITS_PER_MP_LIMB)
{
fprintf (stderr, "%ld bit parameter invalid (max %d bits)\n",
- n, GMP_LIMB_BITS);
+ n, BITS_PER_MP_LIMB);
exit (1);
}
return LIMB_ONES (n);
diff --git a/gmp/tune/speed.h b/gmp/tune/speed.h
index d9474adb35..ca021409ef 100644
--- a/gmp/tune/speed.h
+++ b/gmp/tune/speed.h
@@ -1,32 +1,22 @@
/* Header for speed and threshold things.
-Copyright 1999-2003, 2005, 2006, 2008-2013 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 2003, 2005, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
#ifndef __SPEED_H__
#define __SPEED_H__
@@ -41,9 +31,9 @@ see https://www.gnu.org/licenses/. */
} while (0)
/* A mask of the least significant n bits. Note 1<<32 doesn't give zero on
- x86 family CPUs, hence the separate case for GMP_LIMB_BITS. */
+ x86 family CPUs, hence the separate case for BITS_PER_MP_LIMB. */
#define MP_LIMB_T_LOWBITMASK(n) \
- ((n) == GMP_LIMB_BITS ? MP_LIMB_T_MAX : ((mp_limb_t) 1 << (n)) - 1)
+ ((n) == BITS_PER_MP_LIMB ? MP_LIMB_T_MAX : ((mp_limb_t) 1 << (n)) - 1)
/* align must be a power of 2 here, usually CACHE_LINE_SIZE is a good choice */
@@ -66,7 +56,7 @@ see https://www.gnu.org/licenses/. */
*/
#define CACHE_LINE_SIZE 64 /* bytes */
-#define SPEED_TMP_ALLOC_ADJUST_MASK (CACHE_LINE_SIZE/GMP_LIMB_BYTES - 1)
+#define SPEED_TMP_ALLOC_ADJUST_MASK (CACHE_LINE_SIZE/BYTES_PER_MP_LIMB - 1)
/* Set ptr to a TMP_ALLOC block of the given limbs, with the given limb
alignment. */
@@ -75,7 +65,7 @@ see https://www.gnu.org/licenses/. */
mp_ptr __ptr; \
mp_size_t __ptr_align, __ptr_add; \
\
- ASSERT ((CACHE_LINE_SIZE % GMP_LIMB_BYTES) == 0); \
+ ASSERT ((CACHE_LINE_SIZE % BYTES_PER_MP_LIMB) == 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; \
@@ -97,13 +87,13 @@ extern double speed_unittime;
extern double speed_cycletime;
extern int speed_precision;
extern char speed_time_string[];
-void speed_time_init (void);
-void speed_cycletime_fail (const char *str);
-void speed_cycletime_init (void);
-void speed_cycletime_need_cycles (void);
-void speed_cycletime_need_seconds (void);
-void speed_starttime (void);
-double speed_endtime (void);
+void speed_time_init __GMP_PROTO ((void));
+void speed_cycletime_fail __GMP_PROTO ((const char *str));
+void speed_cycletime_init __GMP_PROTO ((void));
+void speed_cycletime_need_cycles __GMP_PROTO ((void));
+void speed_cycletime_need_seconds __GMP_PROTO ((void));
+void speed_starttime __GMP_PROTO ((void));
+double speed_endtime __GMP_PROTO ((void));
struct speed_params {
@@ -127,304 +117,203 @@ struct speed_params {
struct {
mp_ptr ptr;
mp_size_t size;
- } src[5], dst[4];
+ } src[2], dst[3];
};
-typedef double (*speed_function_t) (struct speed_params *);
+typedef double (*speed_function_t) __GMP_PROTO ((struct speed_params *s));
-double speed_measure (speed_function_t fun, struct speed_params *);
+double speed_measure __GMP_PROTO ((speed_function_t fun, struct speed_params *s));
/* Prototypes for speed measuring routines */
-double speed_back_to_back (struct speed_params *);
-double speed_count_leading_zeros (struct speed_params *);
-double speed_count_trailing_zeros (struct speed_params *);
-double speed_find_a (struct speed_params *);
-double speed_gmp_allocate_free (struct speed_params *);
-double speed_gmp_allocate_reallocate_free (struct speed_params *);
-double speed_invert_limb (struct speed_params *);
-double speed_malloc_free (struct speed_params *);
-double speed_malloc_realloc_free (struct speed_params *);
-double speed_memcpy (struct speed_params *);
-double speed_binvert_limb (struct speed_params *);
-double speed_binvert_limb_mul1 (struct speed_params *);
-double speed_binvert_limb_loop (struct speed_params *);
-double speed_binvert_limb_cond (struct speed_params *);
-double speed_binvert_limb_arith (struct speed_params *);
-
-double speed_mpf_init_clear (struct speed_params *);
-
-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_addlsh_n (struct speed_params *);
-double speed_mpn_addlsh1_n (struct speed_params *);
-double speed_mpn_addlsh2_n (struct speed_params *);
-double speed_mpn_addlsh_n_ip1 (struct speed_params *);
-double speed_mpn_addlsh1_n_ip1 (struct speed_params *);
-double speed_mpn_addlsh2_n_ip1 (struct speed_params *);
-double speed_mpn_addlsh_n_ip2 (struct speed_params *);
-double speed_mpn_addlsh1_n_ip2 (struct speed_params *);
-double speed_mpn_addlsh2_n_ip2 (struct speed_params *);
-double speed_mpn_add_n_sub_n (struct speed_params *);
-double speed_mpn_and_n (struct speed_params *);
-double speed_mpn_andn_n (struct speed_params *);
-double speed_mpn_addmul_1 (struct speed_params *);
-double speed_mpn_addmul_2 (struct speed_params *);
-double speed_mpn_addmul_3 (struct speed_params *);
-double speed_mpn_addmul_4 (struct speed_params *);
-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_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 *);
-double speed_mpn_pi1_bdiv_q_1 (struct speed_params *);
-double speed_mpn_bdiv_dbm1c (struct speed_params *);
-double speed_mpn_divrem_1 (struct speed_params *);
-double speed_mpn_divrem_1f (struct speed_params *);
-double speed_mpn_divrem_1c (struct speed_params *);
-double speed_mpn_divrem_1cf (struct speed_params *);
-double speed_mpn_divrem_1_div (struct speed_params *);
-double speed_mpn_divrem_1f_div (struct speed_params *);
-double speed_mpn_divrem_1_inv (struct speed_params *);
-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 *);
-double speed_mpn_matrix22_mul (struct speed_params *);
-double speed_mpn_hgcd (struct speed_params *);
-double speed_mpn_hgcd_lehmer (struct speed_params *);
-double speed_mpn_hgcd_appr (struct speed_params *);
-double speed_mpn_hgcd_appr_lehmer (struct speed_params *);
-double speed_mpn_hgcd_reduce (struct speed_params *);
-double speed_mpn_hgcd_reduce_1 (struct speed_params *);
-double speed_mpn_hgcd_reduce_2 (struct speed_params *);
-double speed_mpn_gcd (struct speed_params *);
-double speed_mpn_gcd_1 (struct speed_params *);
-double speed_mpn_gcd_1N (struct speed_params *);
-double speed_mpn_gcdext (struct speed_params *);
-double speed_mpn_gcdext_double (struct speed_params *);
-double speed_mpn_gcdext_one_double (struct speed_params *);
-double speed_mpn_gcdext_one_single (struct speed_params *);
-double speed_mpn_gcdext_single (struct speed_params *);
-double speed_mpn_get_str (struct speed_params *);
-double speed_mpn_hamdist (struct speed_params *);
-double speed_mpn_ior_n (struct speed_params *);
-double speed_mpn_iorn_n (struct speed_params *);
-double speed_mpn_jacobi_base (struct speed_params *);
-double speed_mpn_jacobi_base_1 (struct speed_params *);
-double speed_mpn_jacobi_base_2 (struct speed_params *);
-double speed_mpn_jacobi_base_3 (struct speed_params *);
-double speed_mpn_jacobi_base_4 (struct speed_params *);
-double speed_mpn_lshift (struct speed_params *);
-double speed_mpn_lshiftc (struct speed_params *);
-double speed_mpn_mod_1 (struct speed_params *);
-double speed_mpn_mod_1c (struct speed_params *);
-double speed_mpn_mod_1_div (struct speed_params *);
-double speed_mpn_mod_1_inv (struct speed_params *);
-double speed_mpn_mod_1_1 (struct speed_params *);
-double speed_mpn_mod_1_1_1 (struct speed_params *);
-double speed_mpn_mod_1_1_2 (struct speed_params *);
-double speed_mpn_mod_1_2 (struct speed_params *);
-double speed_mpn_mod_1_3 (struct speed_params *);
-double speed_mpn_mod_1_4 (struct speed_params *);
-double speed_mpn_mod_34lsub1 (struct speed_params *);
-double speed_mpn_modexact_1_odd (struct speed_params *);
-double speed_mpn_modexact_1c_odd (struct speed_params *);
-double speed_mpn_mul_1 (struct speed_params *);
-double speed_mpn_mul_1_inplace (struct speed_params *);
-double speed_mpn_mul_2 (struct speed_params *);
-double speed_mpn_mul_3 (struct speed_params *);
-double speed_mpn_mul_4 (struct speed_params *);
-double speed_mpn_mul_5 (struct speed_params *);
-double speed_mpn_mul_6 (struct speed_params *);
-double speed_mpn_mul (struct speed_params *);
-double speed_mpn_mul_basecase (struct speed_params *);
-double speed_mpn_mulmid (struct speed_params *);
-double speed_mpn_mulmid_basecase (struct speed_params *);
-double speed_mpn_mul_fft (struct speed_params *);
-double speed_mpn_mul_fft_sqr (struct speed_params *);
-double speed_mpn_fft_mul (struct speed_params *);
-double speed_mpn_fft_sqr (struct speed_params *);
-#if WANT_OLD_FFT_FULL
-double speed_mpn_mul_fft_full (struct speed_params *);
-double speed_mpn_mul_fft_full_sqr (struct speed_params *);
-#endif
-double speed_mpn_nussbaumer_mul (struct speed_params *);
-double speed_mpn_nussbaumer_mul_sqr (struct speed_params *);
-double speed_mpn_mul_n (struct speed_params *);
-double speed_mpn_mul_n_sqr (struct speed_params *);
-double speed_mpn_mulmid_n (struct speed_params *);
-double speed_mpn_mullo_n (struct speed_params *);
-double speed_mpn_mullo_basecase (struct speed_params *);
-double speed_mpn_nand_n (struct speed_params *);
-double speed_mpn_nior_n (struct speed_params *);
-double speed_mpn_popcount (struct speed_params *);
-double speed_mpn_preinv_divrem_1 (struct speed_params *);
-double speed_mpn_preinv_divrem_1f (struct speed_params *);
-double speed_mpn_preinv_mod_1 (struct speed_params *);
-double speed_mpn_sbpi1_div_qr (struct speed_params *);
-double speed_mpn_dcpi1_div_qr (struct speed_params *);
-double speed_mpn_sbpi1_divappr_q (struct speed_params *);
-double speed_mpn_dcpi1_divappr_q (struct speed_params *);
-double speed_mpn_mu_div_qr (struct speed_params *);
-double speed_mpn_mu_divappr_q (struct speed_params *);
-double speed_mpn_mupi_div_qr (struct speed_params *);
-double speed_mpn_mu_div_q (struct speed_params *);
-double speed_mpn_sbpi1_bdiv_qr (struct speed_params *);
-double speed_mpn_dcpi1_bdiv_qr (struct speed_params *);
-double speed_mpn_sbpi1_bdiv_q (struct speed_params *);
-double speed_mpn_dcpi1_bdiv_q (struct speed_params *);
-double speed_mpn_mu_bdiv_q (struct speed_params *);
-double speed_mpn_mu_bdiv_qr (struct speed_params *);
-double speed_mpn_broot (struct speed_params *);
-double speed_mpn_broot_invm1 (struct speed_params *);
-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 *);
-double speed_mpn_redc_n (struct speed_params *);
-double speed_mpn_rsblsh_n (struct speed_params *);
-double speed_mpn_rsblsh1_n (struct speed_params *);
-double speed_mpn_rsblsh2_n (struct speed_params *);
-double speed_mpn_rsh1add_n (struct speed_params *);
-double speed_mpn_rsh1sub_n (struct speed_params *);
-double speed_mpn_rshift (struct speed_params *);
-double speed_mpn_sb_divrem_m3 (struct speed_params *);
-double speed_mpn_sb_divrem_m3_div (struct speed_params *);
-double speed_mpn_sb_divrem_m3_inv (struct speed_params *);
-double speed_mpn_set_str (struct speed_params *);
-double speed_mpn_bc_set_str (struct speed_params *);
-double speed_mpn_dc_set_str (struct speed_params *);
-double speed_mpn_set_str_pre (struct speed_params *);
-double speed_mpn_sqr_basecase (struct speed_params *);
-double speed_mpn_sqr_diag_addlsh1 (struct speed_params *);
-double speed_mpn_sqr_diagonal (struct speed_params *);
-double speed_mpn_sqr (struct speed_params *);
-double speed_mpn_sqrtrem (struct speed_params *);
-double speed_mpn_rootrem (struct speed_params *);
-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_sublsh_n (struct speed_params *);
-double speed_mpn_sublsh1_n (struct speed_params *);
-double speed_mpn_sublsh2_n (struct speed_params *);
-double speed_mpn_sublsh_n_ip1 (struct speed_params *);
-double speed_mpn_sublsh1_n_ip1 (struct speed_params *);
-double speed_mpn_sublsh2_n_ip1 (struct speed_params *);
-double speed_mpn_submul_1 (struct speed_params *);
-double speed_mpn_toom2_sqr (struct speed_params *);
-double speed_mpn_toom3_sqr (struct speed_params *);
-double speed_mpn_toom4_sqr (struct speed_params *);
-double speed_mpn_toom6_sqr (struct speed_params *);
-double speed_mpn_toom8_sqr (struct speed_params *);
-double speed_mpn_toom22_mul (struct speed_params *);
-double speed_mpn_toom33_mul (struct speed_params *);
-double speed_mpn_toom44_mul (struct speed_params *);
-double speed_mpn_toom6h_mul (struct speed_params *);
-double speed_mpn_toom8h_mul (struct speed_params *);
-double speed_mpn_toom32_mul (struct speed_params *);
-double speed_mpn_toom42_mul (struct speed_params *);
-double speed_mpn_toom43_mul (struct speed_params *);
-double speed_mpn_toom63_mul (struct speed_params *);
-double speed_mpn_toom32_for_toom43_mul (struct speed_params *);
-double speed_mpn_toom43_for_toom32_mul (struct speed_params *);
-double speed_mpn_toom32_for_toom53_mul (struct speed_params *);
-double speed_mpn_toom53_for_toom32_mul (struct speed_params *);
-double speed_mpn_toom42_for_toom53_mul (struct speed_params *);
-double speed_mpn_toom53_for_toom42_mul (struct speed_params *);
-double speed_mpn_toom43_for_toom54_mul (struct speed_params *);
-double speed_mpn_toom54_for_toom43_mul (struct speed_params *);
-double speed_mpn_toom42_mulmid (struct speed_params *);
-double speed_mpn_mulmod_bnm1 (struct speed_params *);
-double speed_mpn_bc_mulmod_bnm1 (struct speed_params *);
-double speed_mpn_mulmod_bnm1_rounded (struct speed_params *);
-double speed_mpn_sqrmod_bnm1 (struct speed_params *);
-double speed_mpn_udiv_qrnnd (struct speed_params *);
-double speed_mpn_udiv_qrnnd_r (struct speed_params *);
-double speed_mpn_umul_ppmm (struct speed_params *);
-double speed_mpn_umul_ppmm_r (struct speed_params *);
-double speed_mpn_xnor_n (struct speed_params *);
-double speed_mpn_xor_n (struct speed_params *);
-double speed_MPN_ZERO (struct speed_params *);
-
-double speed_mpq_init_clear (struct speed_params *);
-
-double speed_mpz_add (struct speed_params *);
-double speed_mpz_bin_uiui (struct speed_params *);
-double speed_mpz_bin_ui (struct speed_params *);
-double speed_mpz_fac_ui (struct speed_params *);
-double speed_mpz_fib_ui (struct speed_params *);
-double speed_mpz_fib2_ui (struct speed_params *);
-double speed_mpz_init_clear (struct speed_params *);
-double speed_mpz_init_realloc_clear (struct speed_params *);
-double speed_mpz_jacobi (struct speed_params *);
-double speed_mpz_lucnum_ui (struct speed_params *);
-double speed_mpz_lucnum2_ui (struct speed_params *);
-double speed_mpz_mod (struct speed_params *);
-double speed_mpz_powm (struct speed_params *);
-double speed_mpz_powm_mod (struct speed_params *);
-double speed_mpz_powm_redc (struct speed_params *);
-double speed_mpz_powm_sec (struct speed_params *);
-double speed_mpz_powm_ui (struct speed_params *);
-double speed_mpz_urandomb (struct speed_params *);
-
-double speed_gmp_randseed (struct speed_params *);
-double speed_gmp_randseed_ui (struct speed_params *);
-
-double speed_noop (struct speed_params *);
-double speed_noop_wxs (struct speed_params *);
-double speed_noop_wxys (struct speed_params *);
-
-double speed_operator_div (struct speed_params *);
-double speed_operator_mod (struct speed_params *);
-
-double speed_udiv_qrnnd (struct speed_params *);
-double speed_udiv_qrnnd_preinv1 (struct speed_params *);
-double speed_udiv_qrnnd_preinv2 (struct speed_params *);
-double speed_udiv_qrnnd_preinv3 (struct speed_params *);
-double speed_udiv_qrnnd_c (struct speed_params *);
-double speed_umul_ppmm (struct speed_params *);
+double speed_back_to_back __GMP_PROTO ((struct speed_params *s));
+double speed_count_leading_zeros __GMP_PROTO ((struct speed_params *s));
+double speed_count_trailing_zeros __GMP_PROTO ((struct speed_params *s));
+double speed_find_a __GMP_PROTO ((struct speed_params *s));
+double speed_gmp_allocate_free __GMP_PROTO ((struct speed_params *s));
+double speed_gmp_allocate_reallocate_free __GMP_PROTO ((struct speed_params *s));
+double speed_invert_limb __GMP_PROTO ((struct speed_params *s));
+double speed_malloc_free __GMP_PROTO ((struct speed_params *s));
+double speed_malloc_realloc_free __GMP_PROTO ((struct speed_params *s));
+double speed_memcpy __GMP_PROTO ((struct speed_params *s));
+double speed_binvert_limb __GMP_PROTO ((struct speed_params *s));
+double speed_binvert_limb_mul1 __GMP_PROTO ((struct speed_params *s));
+double speed_binvert_limb_loop __GMP_PROTO ((struct speed_params *s));
+double speed_binvert_limb_cond __GMP_PROTO ((struct speed_params *s));
+double speed_binvert_limb_arith __GMP_PROTO ((struct speed_params *s));
+
+double speed_mpf_init_clear __GMP_PROTO ((struct speed_params *s));
+
+double speed_mpn_add_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addlsh1_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addsub_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_and_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_andn_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_2 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_3 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_4 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_5 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_6 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_7 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_addmul_8 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_com_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_copyd __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_copyi __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_dc_divrem_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_dc_divrem_sb __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_dc_divrem_sb_div __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_dc_divrem_sb_inv __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_dc_tdiv_qr __GMP_PROTO ((struct speed_params *s));
+double speed_MPN_COPY __GMP_PROTO ((struct speed_params *s));
+double speed_MPN_COPY_DECR __GMP_PROTO ((struct speed_params *s));
+double speed_MPN_COPY_INCR __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divexact_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divexact_by3 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_bdiv_dbm1c __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1f __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1c __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1cf __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1_div __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1f_div __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1_inv __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_1f_inv __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_2 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_2_div __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_divrem_2_inv __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_fib2_ui __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_matrix22_mul __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_hgcd __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_hgcd_lehmer __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcd __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcd_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcd_1N __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcd_binary __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcd_accel __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcdext __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcdext_double __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcdext_one_double __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcdext_one_single __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_gcdext_single __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_get_str __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_hamdist __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_ior_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_iorn_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_jacobi_base __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_jacobi_base_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_jacobi_base_2 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_jacobi_base_3 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_kara_mul_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_kara_sqr_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_lshift __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mod_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mod_1c __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mod_1_div __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mod_1_inv __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mod_34lsub1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_modexact_1_odd __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_modexact_1c_odd __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_1_inplace __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_2 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_3 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_4 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_basecase __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_fft __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_fft_sqr __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_fft_full __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_fft_full_sqr __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mul_n_sqr __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mullow_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_mullow_basecase __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_nand_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_nior_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_popcount __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_preinv_divrem_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_preinv_divrem_1f __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_preinv_mod_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_redc_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_rsh1add_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_rsh1sub_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_rshift __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sb_divrem_m3 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sb_divrem_m3_div __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sb_divrem_m3_inv __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_set_str __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_bc_set_str __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_dc_set_str __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_set_str_pre __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sqr_basecase __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sqr_diagonal __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sqr_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sqrtrem __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_rootrem __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sub_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_sublsh1_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_submul_1 __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_toom3_mul_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_toom3_sqr_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_udiv_qrnnd __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_udiv_qrnnd_r __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_umul_ppmm __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_umul_ppmm_r __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_xnor_n __GMP_PROTO ((struct speed_params *s));
+double speed_mpn_xor_n __GMP_PROTO ((struct speed_params *s));
+double speed_MPN_ZERO __GMP_PROTO ((struct speed_params *s));
+
+double speed_mpq_init_clear __GMP_PROTO ((struct speed_params *s));
+
+double speed_mpz_add __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_bin_uiui __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_fac_ui __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_fib_ui __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_fib2_ui __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_init_clear __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_init_realloc_clear __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_jacobi __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_lucnum_ui __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_lucnum2_ui __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_mod __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_powm __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_powm_mod __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_powm_redc __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_powm_ui __GMP_PROTO ((struct speed_params *s));
+double speed_mpz_urandomb __GMP_PROTO ((struct speed_params *s));
+
+double speed_gmp_randseed __GMP_PROTO ((struct speed_params *s));
+double speed_gmp_randseed_ui __GMP_PROTO ((struct speed_params *s));
+
+double speed_noop __GMP_PROTO ((struct speed_params *s));
+double speed_noop_wxs __GMP_PROTO ((struct speed_params *s));
+double speed_noop_wxys __GMP_PROTO ((struct speed_params *s));
+
+double speed_operator_div __GMP_PROTO ((struct speed_params *s));
+double speed_operator_mod __GMP_PROTO ((struct speed_params *s));
+
+double speed_udiv_qrnnd __GMP_PROTO ((struct speed_params *s));
+double speed_udiv_qrnnd_preinv1 __GMP_PROTO ((struct speed_params *s));
+double speed_udiv_qrnnd_preinv2 __GMP_PROTO ((struct speed_params *s));
+double speed_udiv_qrnnd_c __GMP_PROTO ((struct speed_params *s));
+double speed_umul_ppmm __GMP_PROTO ((struct speed_params *s));
/* Prototypes for other routines */
/* low 32-bits in p[0], high 32-bits in p[1] */
-void speed_cyclecounter (unsigned p[2]);
+void speed_cyclecounter __GMP_PROTO ((unsigned p[2]));
-void mftb_function (unsigned p[2]);
+void mftb_function __GMP_PROTO ((unsigned p[2]));
/* In i386 gcc -fPIC, ebx is a fixed register and can't be declared a dummy
output or a clobber for the cpuid, hence an explicit save and restore. A
clobber as such doesn't provoke an error unfortunately (gcc 3.0), so use
the dummy output style in non-PIC, so there's an error if somehow -fPIC
- is used without a -DPIC to tell us about it. */
+ is used without a -DPIC to tell us about it. */
#if defined(__GNUC__) && ! defined (NO_ASM) \
&& (defined (__i386__) || defined (__i486__))
-#if defined (PIC) || defined (__APPLE_CC__)
+#ifdef PIC
#define speed_cyclecounter(p) \
do { \
int __speed_cyclecounter__save_ebx; \
@@ -453,80 +342,71 @@ void mftb_function (unsigned p[2]);
#endif
#endif
-double speed_cyclecounter_diff (const unsigned [2], const unsigned [2]);
-int gettimeofday_microseconds_p (void);
-int getrusage_microseconds_p (void);
-int cycles_works_p (void);
-long clk_tck (void);
-double freq_measure (const char *, double (*)(void));
-
-int double_cmp_ptr (const double *, const double *);
-void pentium_wbinvd (void);
-typedef int (*qsort_function_t) (const void *, const void *);
-
-void noop (void);
-void noop_1 (mp_limb_t);
-void noop_wxs (mp_ptr, mp_srcptr, mp_size_t);
-void noop_wxys (mp_ptr, mp_srcptr, mp_srcptr, mp_size_t);
-void mpn_cache_fill (mp_srcptr, mp_size_t);
-void mpn_cache_fill_dummy (mp_limb_t);
-void speed_cache_fill (struct speed_params *);
-void speed_operand_src (struct speed_params *, mp_ptr, mp_size_t);
-void speed_operand_dst (struct speed_params *, mp_ptr, mp_size_t);
+double speed_cyclecounter_diff __GMP_PROTO ((const unsigned [2], const unsigned [2]));
+int gettimeofday_microseconds_p __GMP_PROTO ((void));
+int getrusage_microseconds_p __GMP_PROTO ((void));
+int cycles_works_p __GMP_PROTO ((void));
+long clk_tck __GMP_PROTO ((void));
+double freq_measure __GMP_PROTO ((const char *, double (*)(void)));
+
+int double_cmp_ptr __GMP_PROTO ((const double *, const double *));
+void pentium_wbinvd __GMP_PROTO ((void));
+typedef int (*qsort_function_t) __GMP_PROTO ((const void *, const void *));
+
+void noop __GMP_PROTO ((void));
+void noop_1 __GMP_PROTO ((mp_limb_t));
+void noop_wxs __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t));
+void noop_wxys __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t));
+void mpn_cache_fill __GMP_PROTO ((mp_srcptr, mp_size_t));
+void mpn_cache_fill_dummy __GMP_PROTO ((mp_limb_t));
+void speed_cache_fill __GMP_PROTO ((struct speed_params *));
+void speed_operand_src __GMP_PROTO ((struct speed_params *, mp_ptr, mp_size_t));
+void speed_operand_dst __GMP_PROTO ((struct speed_params *, mp_ptr, mp_size_t));
extern int speed_option_addrs;
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);
-mp_limb_t mpn_divrem_2_inv (mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr);
+void speed_option_set __GMP_PROTO((const char *));
-int mpn_jacobi_base_1 (mp_limb_t, mp_limb_t, int);
-int mpn_jacobi_base_2 (mp_limb_t, mp_limb_t, int);
-int mpn_jacobi_base_3 (mp_limb_t, mp_limb_t, int);
-int mpn_jacobi_base_4 (mp_limb_t, mp_limb_t, int);
+mp_limb_t mpn_divrem_1_div __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
+mp_limb_t mpn_divrem_1_inv __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
+mp_limb_t mpn_divrem_2_div __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
+mp_limb_t mpn_divrem_2_inv __GMP_PROTO ((mp_ptr, mp_size_t, mp_ptr, mp_size_t, mp_srcptr));
-mp_limb_t mpn_mod_1_div (mp_srcptr, mp_size_t, mp_limb_t);
-mp_limb_t mpn_mod_1_inv (mp_srcptr, mp_size_t, mp_limb_t);
+int mpn_jacobi_base_1 __GMP_PROTO ((mp_limb_t, mp_limb_t, int));
+int mpn_jacobi_base_2 __GMP_PROTO ((mp_limb_t, mp_limb_t, int));
+int mpn_jacobi_base_3 __GMP_PROTO ((mp_limb_t, mp_limb_t, int));
-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]);
+mp_limb_t mpn_mod_1_div __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
+mp_limb_t mpn_mod_1_inv __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
-void mpn_mod_1_1p_cps_1 (mp_limb_t [4], mp_limb_t);
-void mpn_mod_1_1p_cps_2 (mp_limb_t [4], mp_limb_t);
+mp_size_t mpn_gcd_binary
+ __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
+mp_size_t mpn_gcd_accel
+ __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
+mp_size_t mpn_gcdext_one_double
+ __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
+mp_size_t mpn_gcdext_one_single
+ __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
+mp_size_t mpn_gcdext_single
+ __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
+mp_size_t mpn_gcdext_double
+ __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t));
-mp_size_t mpn_gcdext_one_double (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
-mp_size_t mpn_gcdext_one_single (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
-mp_size_t mpn_gcdext_single (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
-mp_size_t mpn_gcdext_double (mp_ptr, mp_ptr, mp_size_t *, mp_ptr, mp_size_t, mp_ptr, mp_size_t);
-mp_size_t mpn_hgcd_lehmer (mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr);
-mp_size_t mpn_hgcd_lehmer_itch (mp_size_t);
+mp_limb_t mpn_sb_divrem_mn_div __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
+mp_limb_t mpn_sb_divrem_mn_inv __GMP_PROTO ((mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t));
-mp_size_t mpn_hgcd_appr_lehmer (mp_ptr, mp_ptr, mp_size_t, struct hgcd_matrix *, mp_ptr);
-mp_size_t mpn_hgcd_appr_lehmer_itch (mp_size_t);
+mp_size_t mpn_set_str_basecase __GMP_PROTO ((mp_ptr, const unsigned char *, size_t, int));
-mp_size_t mpn_hgcd_reduce_1 (struct hgcd_matrix *, mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_ptr);
-mp_size_t mpn_hgcd_reduce_1_itch (mp_size_t, mp_size_t);
+void mpn_toom3_mul_n_open __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr));
+void mpn_toom3_sqr_n_open __GMP_PROTO ((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
+void mpn_toom3_mul_n_mpn __GMP_PROTO ((mp_ptr, mp_srcptr, mp_srcptr, mp_size_t, mp_ptr));
+void mpn_toom3_sqr_n_mpn __GMP_PROTO((mp_ptr, mp_srcptr, mp_size_t, mp_ptr));
-mp_size_t mpn_hgcd_reduce_2 (struct hgcd_matrix *, mp_ptr, mp_ptr, mp_size_t, mp_size_t, mp_ptr);
-mp_size_t mpn_hgcd_reduce_2_itch (mp_size_t, mp_size_t);
+void mpz_powm_mod __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
+void mpz_powm_redc __GMP_PROTO ((mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr));
-mp_limb_t mpn_sb_divrem_mn_div (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
-mp_limb_t mpn_sb_divrem_mn_inv (mp_ptr, mp_ptr, mp_size_t, mp_srcptr, mp_size_t);
-
-mp_size_t mpn_set_str_basecase (mp_ptr, const unsigned char *, size_t, int);
-void mpn_pre_set_str (mp_ptr, unsigned char *, size_t, powers_t *, mp_ptr);
-
-void mpz_powm_mod (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
-void mpz_powm_redc (mpz_ptr, mpz_srcptr, mpz_srcptr, mpz_srcptr);
-
-int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
+int speed_routine_count_zeros_setup
+ __GMP_PROTO ((struct speed_params *, mp_ptr, int, int));
/* "get" is called repeatedly until it ticks over, just in case on a fast
@@ -623,7 +503,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
#define SPEED_RESTRICT_COND(cond) if (!(cond)) return -1.0;
/* For mpn_copy or similar. */
-#define SPEED_ROUTINE_MPN_COPY_CALL(call) \
+#define SPEED_ROUTINE_MPN_COPY(function) \
{ \
mp_ptr wp; \
unsigned i; \
@@ -642,47 +522,13 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
speed_starttime (); \
i = s->reps; \
do \
- call; \
+ function (wp, s->xp, s->size); \
while (--i != 0); \
t = speed_endtime (); \
\
TMP_FREE; \
return t; \
}
-#define SPEED_ROUTINE_MPN_COPY(function) \
- SPEED_ROUTINE_MPN_COPY_CALL (function (wp, s->xp, s->size))
-
-#define SPEED_ROUTINE_MPN_TABSELECT(function) \
- { \
- 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) \
{ \
@@ -712,7 +558,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
}
/* s->size is still in limbs, and it's limbs which are copied, but
- "function" takes a size in bytes not limbs. */
+ "function" takes a size in bytes not limbs. */
#define SPEED_ROUTINE_MPN_COPY_BYTES(function) \
{ \
mp_ptr wp; \
@@ -732,7 +578,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 * GMP_LIMB_BYTES); \
+ function (wp, s->xp, s->size * BYTES_PER_MP_LIMB); \
while (--i != 0); \
t = speed_endtime (); \
\
@@ -788,72 +634,6 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return t; \
}
-
-/* For mpn_aors_errK_n, where 1 <= K <= 3. */
-#define SPEED_ROUTINE_MPN_BINARY_ERR_N_CALL(call, K) \
- { \
- mp_ptr wp; \
- mp_ptr xp, yp; \
- mp_ptr zp[K]; \
- mp_limb_t ep[2*K]; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp); \
- \
- /* (don't have a mechanism to specify zp alignments) */ \
- for (i = 0; i < K; i++) \
- SPEED_TMP_ALLOC_LIMBS (zp[i], s->size, 0); \
- \
- xp = s->xp; \
- yp = s->yp; \
- \
- if (s->r == 0) ; \
- else if (s->r == 1) { xp = wp; } \
- else if (s->r == 2) { yp = wp; } \
- else if (s->r == 3) { xp = wp; yp = wp; } \
- else if (s->r == 4) { yp = xp; } \
- else { \
- TMP_FREE; \
- return -1.0; \
- } \
- \
- /* initialize wp if operand overlap */ \
- if (xp == wp || yp == wp) \
- MPN_COPY (wp, s->xp, s->size); \
- \
- speed_operand_src (s, xp, s->size); \
- speed_operand_src (s, yp, s->size); \
- for (i = 0; i < K; i++) \
- speed_operand_src (s, zp[i], s->size); \
- speed_operand_dst (s, wp, s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- call; \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_BINARY_ERR1_N(function) \
- SPEED_ROUTINE_MPN_BINARY_ERR_N_CALL ((*function) (wp, xp, yp, ep, zp[0], s->size, 0), 1)
-
-#define SPEED_ROUTINE_MPN_BINARY_ERR2_N(function) \
- SPEED_ROUTINE_MPN_BINARY_ERR_N_CALL ((*function) (wp, xp, yp, ep, zp[0], zp[1], s->size, 0), 2)
-
-#define SPEED_ROUTINE_MPN_BINARY_ERR3_N(function) \
- SPEED_ROUTINE_MPN_BINARY_ERR_N_CALL ((*function) (wp, xp, yp, ep, zp[0], zp[1], zp[2], s->size, 0), 3)
-
-
/* For mpn_add_n, mpn_sub_n, or similar. */
#define SPEED_ROUTINE_MPN_ADDSUB_N_CALL(call) \
{ \
@@ -954,26 +734,6 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
#define SPEED_ROUTINE_MPN_DIVEXACT_1(function) \
SPEED_ROUTINE_MPN_UNARY_1_CALL ((*function) (wp, s->xp, s->size, s->r))
-#define SPEED_ROUTINE_MPN_BDIV_Q_1(function) \
- SPEED_ROUTINE_MPN_UNARY_1_CALL ((*function) (wp, s->xp, s->size, s->r))
-
-#define SPEED_ROUTINE_MPN_PI1_BDIV_Q_1_CALL(call) \
- { \
- unsigned shift; \
- mp_limb_t dinv; \
- \
- SPEED_RESTRICT_COND (s->size > 0); \
- SPEED_RESTRICT_COND (s->r != 0); \
- \
- count_trailing_zeros (shift, s->r); \
- binvert_limb (dinv, s->r >> shift); \
- \
- SPEED_ROUTINE_MPN_UNARY_1_CALL (call); \
- }
-#define SPEED_ROUTINE_MPN_PI1_BDIV_Q_1(function) \
- SPEED_ROUTINE_MPN_PI1_BDIV_Q_1_CALL \
- ((*function) (wp, s->xp, s->size, s->r, dinv, shift))
-
#define SPEED_ROUTINE_MPN_BDIV_DBM1C(function) \
SPEED_ROUTINE_MPN_UNARY_1_CALL ((*function) (wp, s->xp, s->size, s->r, 0))
@@ -1069,30 +829,30 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
/* For mpn_mul, mpn_mul_basecase, xsize=r, ysize=s->size. */
#define SPEED_ROUTINE_MPN_MUL(function) \
{ \
- mp_ptr wp; \
+ mp_ptr wp, xp; \
mp_size_t size1; \
unsigned i; \
double t; \
TMP_DECL; \
\
size1 = (s->r == 0 ? s->size : s->r); \
- if (size1 < 0) size1 = -size1 - s->size; \
\
- SPEED_RESTRICT_COND (size1 >= 1); \
- SPEED_RESTRICT_COND (s->size >= size1); \
+ SPEED_RESTRICT_COND (s->size >= 1); \
+ SPEED_RESTRICT_COND (size1 >= s->size); \
\
TMP_MARK; \
SPEED_TMP_ALLOC_LIMBS (wp, size1 + s->size, s->align_wp); \
+ SPEED_TMP_ALLOC_LIMBS (xp, size1, s->align_xp); \
\
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, s->yp, size1); \
+ speed_operand_src (s, xp, size1); \
+ speed_operand_src (s, s->yp, s->size); \
speed_operand_dst (s, wp, size1 + s->size); \
speed_cache_fill (s); \
\
speed_starttime (); \
i = s->reps; \
do \
- function (wp, s->xp, s->size, s->yp, size1); \
+ function (wp, xp, size1, s->yp, s->size); \
while (--i != 0); \
t = speed_endtime (); \
\
@@ -1132,7 +892,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
#define SPEED_ROUTINE_MPN_MUL_N(function) \
SPEED_ROUTINE_MPN_MUL_N_CALL (function (wp, s->xp, s->yp, s->size));
-#define SPEED_ROUTINE_MPN_MULLO_N_CALL(call) \
+#define SPEED_ROUTINE_MPN_MULLOW_N_CALL(call) \
{ \
mp_ptr wp; \
unsigned i; \
@@ -1160,11 +920,11 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return t; \
}
-#define SPEED_ROUTINE_MPN_MULLO_N(function) \
- SPEED_ROUTINE_MPN_MULLO_N_CALL (function (wp, s->xp, s->yp, s->size));
+#define SPEED_ROUTINE_MPN_MULLOW_N(function) \
+ SPEED_ROUTINE_MPN_MULLOW_N_CALL (function (wp, s->xp, s->yp, s->size));
/* For mpn_mul_basecase, xsize=r, ysize=s->size. */
-#define SPEED_ROUTINE_MPN_MULLO_BASECASE(function) \
+#define SPEED_ROUTINE_MPN_MULLOW_BASECASE(function) \
{ \
mp_ptr wp; \
unsigned i; \
@@ -1192,172 +952,6 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return t; \
}
-/* For mpn_mulmid, mpn_mulmid_basecase, xsize=r, ysize=s->size. */
-#define SPEED_ROUTINE_MPN_MULMID(function) \
- { \
- mp_ptr wp, xp; \
- mp_size_t size1; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- size1 = (s->r == 0 ? (2 * s->size - 1) : s->r); \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- SPEED_RESTRICT_COND (size1 >= s->size); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (wp, size1 - s->size + 3, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (xp, size1, s->align_xp); \
- \
- speed_operand_src (s, xp, size1); \
- speed_operand_src (s, s->yp, s->size); \
- speed_operand_dst (s, wp, size1 - s->size + 3); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (wp, xp, size1, s->yp, s->size); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_MULMID_N(function) \
- { \
- mp_ptr wp, xp; \
- mp_size_t size1; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- size1 = 2 * s->size - 1; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (wp, size1 - s->size + 3, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (xp, size1, s->align_xp); \
- \
- speed_operand_src (s, xp, size1); \
- speed_operand_src (s, s->yp, s->size); \
- speed_operand_dst (s, wp, size1 - s->size + 3); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (wp, xp, s->yp, s->size); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_TOOM42_MULMID(function) \
- { \
- mp_ptr wp, xp, scratch; \
- mp_size_t size1, scratch_size; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- size1 = 2 * s->size - 1; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (wp, size1 - s->size + 3, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (xp, size1, s->align_xp); \
- scratch_size = mpn_toom42_mulmid_itch (s->size); \
- SPEED_TMP_ALLOC_LIMBS (scratch, scratch_size, 0); \
- \
- speed_operand_src (s, xp, size1); \
- speed_operand_src (s, s->yp, s->size); \
- speed_operand_dst (s, wp, size1 - s->size + 3); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (wp, xp, s->yp, s->size, scratch); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_MULMOD_BNM1_CALL(call) \
- { \
- mp_ptr wp, tp; \
- unsigned i; \
- double t; \
- mp_size_t itch; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- itch = mpn_mulmod_bnm1_itch (s->size, s->size, s->size); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (wp, 2 * s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, itch, s->align_wp2); \
- \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, s->yp, s->size); \
- speed_operand_dst (s, wp, 2 * s->size); \
- speed_operand_dst (s, tp, itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- call; \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_MULMOD_BNM1_ROUNDED(function) \
- { \
- mp_ptr wp, tp; \
- unsigned i; \
- double t; \
- mp_size_t size, itch; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- size = mpn_mulmod_bnm1_next_size (s->size); \
- itch = mpn_mulmod_bnm1_itch (size, size, size); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (wp, size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, itch, s->align_wp2); \
- \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, s->yp, s->size); \
- speed_operand_dst (s, wp, size); \
- speed_operand_dst (s, tp, itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (wp, size, s->xp, s->size, s->yp, s->size, tp); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
#define SPEED_ROUTINE_MPN_MUL_N_TSPACE(call, tsize, minsize) \
{ \
mp_ptr wp, tspace; \
@@ -1388,104 +982,17 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return t; \
}
-#define SPEED_ROUTINE_MPN_TOOM22_MUL_N(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size, tspace), \
- mpn_toom22_mul_itch (s->size, s->size), \
- MPN_TOOM22_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM33_MUL_N(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size, tspace), \
- mpn_toom33_mul_itch (s->size, s->size), \
- MPN_TOOM33_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM44_MUL_N(function) \
+#define SPEED_ROUTINE_MPN_KARA_MUL_N(function) \
SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size, tspace), \
- mpn_toom44_mul_itch (s->size, s->size), \
- MPN_TOOM44_MUL_MINSIZE)
+ (function (wp, s->xp, s->xp, s->size, tspace), \
+ MPN_KARA_MUL_N_TSIZE (s->size), \
+ MPN_KARA_MUL_N_MINSIZE)
-#define SPEED_ROUTINE_MPN_TOOM6H_MUL_N(function) \
+#define SPEED_ROUTINE_MPN_TOOM3_MUL_N(function) \
SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size, tspace), \
- mpn_toom6h_mul_itch (s->size, s->size), \
- MPN_TOOM6H_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM8H_MUL_N(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size, tspace), \
- mpn_toom8h_mul_itch (s->size, s->size), \
- MPN_TOOM8H_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM32_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 2*s->size/3, tspace), \
- mpn_toom32_mul_itch (s->size, 2*s->size/3), \
- MPN_TOOM32_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM42_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size/2, tspace), \
- mpn_toom42_mul_itch (s->size, s->size/2), \
- MPN_TOOM42_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM43_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size*3/4, tspace), \
- mpn_toom43_mul_itch (s->size, s->size*3/4), \
- MPN_TOOM43_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM63_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, s->size/2, tspace), \
- mpn_toom63_mul_itch (s->size, s->size/2), \
- MPN_TOOM63_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM32_FOR_TOOM43_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 17*s->size/24, tspace), \
- mpn_toom32_mul_itch (s->size, 17*s->size/24), \
- MPN_TOOM32_MUL_MINSIZE)
-#define SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM32_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 17*s->size/24, tspace), \
- mpn_toom43_mul_itch (s->size, 17*s->size/24), \
- MPN_TOOM43_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM32_FOR_TOOM53_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 19*s->size/30, tspace), \
- mpn_toom32_mul_itch (s->size, 19*s->size/30), \
- MPN_TOOM32_MUL_MINSIZE)
-#define SPEED_ROUTINE_MPN_TOOM53_FOR_TOOM32_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 19*s->size/30, tspace), \
- mpn_toom53_mul_itch (s->size, 19*s->size/30), \
- MPN_TOOM53_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM42_FOR_TOOM53_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 11*s->size/20, tspace), \
- mpn_toom42_mul_itch (s->size, 11*s->size/20), \
- MPN_TOOM42_MUL_MINSIZE)
-#define SPEED_ROUTINE_MPN_TOOM53_FOR_TOOM42_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 11*s->size/20, tspace), \
- mpn_toom53_mul_itch (s->size, 11*s->size/20), \
- MPN_TOOM53_MUL_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM43_FOR_TOOM54_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 5*s->size/6, tspace), \
- mpn_toom42_mul_itch (s->size, 5*s->size/6), \
- MPN_TOOM54_MUL_MINSIZE)
-#define SPEED_ROUTINE_MPN_TOOM54_FOR_TOOM43_MUL(function) \
- SPEED_ROUTINE_MPN_MUL_N_TSPACE \
- (function (wp, s->xp, s->size, s->yp, 5*s->size/6, tspace), \
- mpn_toom54_mul_itch (s->size, 5*s->size/6), \
- MPN_TOOM54_MUL_MINSIZE)
-
+ (function (wp, s->xp, s->yp, s->size, tspace), \
+ MPN_TOOM3_MUL_N_TSIZE (s->size), \
+ MPN_TOOM3_MUL_N_MINSIZE)
#define SPEED_ROUTINE_MPN_SQR_CALL(call) \
@@ -1518,34 +1025,9 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
#define SPEED_ROUTINE_MPN_SQR(function) \
SPEED_ROUTINE_MPN_SQR_CALL (function (wp, s->xp, s->size))
-#define SPEED_ROUTINE_MPN_SQR_DIAG_ADDLSH1_CALL(call) \
- { \
- mp_ptr wp, tp; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (tp, 2 * s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (wp, 2 * s->size, s->align_wp); \
- \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, tp, 2 * s->size); \
- speed_operand_dst (s, wp, 2 * s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- call; \
- while (--i != 0); \
- t = speed_endtime () / 2; \
- \
- TMP_FREE; \
- return t; \
- }
+#define SPEED_ROUTINE_MPN_SQR_DIAGONAL(function) \
+ SPEED_ROUTINE_MPN_SQR (function)
+
#define SPEED_ROUTINE_MPN_SQR_TSPACE(call, tsize, minsize) \
{ \
@@ -1576,32 +1058,17 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return t; \
}
-#define SPEED_ROUTINE_MPN_TOOM2_SQR(function) \
+#define SPEED_ROUTINE_MPN_KARA_SQR_N(function) \
SPEED_ROUTINE_MPN_SQR_TSPACE (function (wp, s->xp, s->size, tspace), \
- mpn_toom2_sqr_itch (s->size), \
- MPN_TOOM2_SQR_MINSIZE)
+ MPN_KARA_SQR_N_TSIZE (s->size), \
+ MPN_KARA_SQR_N_MINSIZE)
-#define SPEED_ROUTINE_MPN_TOOM3_SQR(function) \
+#define SPEED_ROUTINE_MPN_TOOM3_SQR_N(function) \
SPEED_ROUTINE_MPN_SQR_TSPACE (function (wp, s->xp, s->size, tspace), \
- mpn_toom3_sqr_itch (s->size), \
- MPN_TOOM3_SQR_MINSIZE)
+ MPN_TOOM3_SQR_N_TSIZE (s->size), \
+ MPN_TOOM3_SQR_N_MINSIZE)
-#define SPEED_ROUTINE_MPN_TOOM4_SQR(function) \
- SPEED_ROUTINE_MPN_SQR_TSPACE (function (wp, s->xp, s->size, tspace), \
- mpn_toom4_sqr_itch (s->size), \
- MPN_TOOM4_SQR_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM6_SQR(function) \
- SPEED_ROUTINE_MPN_SQR_TSPACE (function (wp, s->xp, s->size, tspace), \
- mpn_toom6_sqr_itch (s->size), \
- MPN_TOOM6_SQR_MINSIZE)
-
-#define SPEED_ROUTINE_MPN_TOOM8_SQR(function) \
- SPEED_ROUTINE_MPN_SQR_TSPACE (function (wp, s->xp, s->size, tspace), \
- mpn_toom8_sqr_itch (s->size), \
- MPN_TOOM8_SQR_MINSIZE)
-
#define SPEED_ROUTINE_MPN_MOD_CALL(call) \
{ \
unsigned i; \
@@ -1656,47 +1123,6 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return speed_endtime (); \
}
-#define SPEED_ROUTINE_MPN_MOD_1_1(function,pfunc) \
- { \
- unsigned i; \
- mp_limb_t inv[4]; \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- \
- mpn_mod_1_1p_cps (inv, s->r); \
- speed_operand_src (s, s->xp, s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- pfunc (inv, s->r); \
- function (s->xp, s->size, s->r << inv[1], inv); \
- } while (--i != 0); \
- \
- return speed_endtime (); \
- }
-#define SPEED_ROUTINE_MPN_MOD_1_N(function,pfunc,N) \
- { \
- unsigned i; \
- mp_limb_t inv[N+3]; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- SPEED_RESTRICT_COND (s->r <= ~(mp_limb_t)0 / N); \
- \
- speed_operand_src (s, s->xp, s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- pfunc (inv, s->r); \
- function (s->xp, s->size, s->r, inv); \
- } while (--i != 0); \
- \
- return speed_endtime (); \
- }
-
/* A division of 2*s->size by s->size limbs */
@@ -1705,7 +1131,6 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
unsigned i; \
mp_ptr a, d, q, r; \
double t; \
- gmp_pi1_t dinv; \
TMP_DECL; \
\
SPEED_RESTRICT_COND (s->size >= 1); \
@@ -1725,8 +1150,6 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
d[s->size-1] |= GMP_NUMB_HIGHBIT; \
a[2*s->size-1] = d[s->size-1] - 1; \
\
- invert_pi1 (dinv, d[s->size-1], d[s->size-2]); \
- \
speed_operand_src (s, a, 2*s->size); \
speed_operand_src (s, d, s->size); \
speed_operand_dst (s, q, s->size+1); \
@@ -1744,522 +1167,52 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return t; \
}
+#define SPEED_ROUTINE_MPN_DC_DIVREM_N(function) \
+ SPEED_ROUTINE_MPN_DC_DIVREM_CALL((*function) (q, a, d, s->size))
-/* A remainder 2*s->size by s->size limbs */
+#define SPEED_ROUTINE_MPN_DC_DIVREM_SB(function) \
+ SPEED_ROUTINE_MPN_DC_DIVREM_CALL \
+ ((*function) (q, a, 2*s->size, d, s->size))
-#define SPEED_ROUTINE_MPZ_MOD(function) \
- { \
- unsigned i; \
- mpz_t a, d, r; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- mpz_init_set_n (d, s->yp, s->size); \
- \
- /* high part less than d, low part a duplicate copied in */ \
- mpz_init_set_n (a, s->xp, s->size); \
- mpz_mod (a, a, d); \
- mpz_mul_2exp (a, a, GMP_LIMB_BITS * s->size); \
- MPN_COPY (PTR(a), s->xp, s->size); \
- \
- mpz_init (r); \
- \
- speed_operand_src (s, PTR(a), SIZ(a)); \
- speed_operand_src (s, PTR(d), SIZ(d)); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (r, a, d); \
- while (--i != 0); \
- return speed_endtime (); \
- }
+#define SPEED_ROUTINE_MPN_DC_TDIV_QR(function) \
+ SPEED_ROUTINE_MPN_DC_DIVREM_CALL \
+ ((*function) (q, r, 0, a, 2*s->size, d, s->size))
-#define SPEED_ROUTINE_MPN_PI1_DIV(function, INV, DMIN, QMIN) \
- { \
- unsigned i; \
- mp_ptr dp, tp, ap, qp; \
- gmp_pi1_t inv; \
- double t; \
- mp_size_t size1; \
- TMP_DECL; \
- \
- size1 = (s->r == 0 ? 2 * s->size : s->r); \
- \
- SPEED_RESTRICT_COND (s->size >= DMIN); \
- SPEED_RESTRICT_COND (size1 - s->size >= QMIN); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (ap, size1, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, size1 - s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, size1, s->align_wp2); \
- \
- /* we don't fill in dividend completely when size1 > s->size */ \
- MPN_COPY (ap, s->xp, s->size); \
- MPN_COPY (ap + size1 - s->size, s->xp, s->size); \
- \
- MPN_COPY (dp, s->yp, s->size); \
- \
- /* normalize the data */ \
- dp[s->size-1] |= GMP_NUMB_HIGHBIT; \
- ap[size1 - 1] = dp[s->size - 1] - 1; \
- \
- invert_pi1 (inv, dp[s->size-1], dp[s->size-2]); \
- \
- speed_operand_src (s, ap, size1); \
- speed_operand_dst (s, tp, size1); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_dst (s, qp, size1 - s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- MPN_COPY (tp, ap, size1); \
- function (qp, tp, size1, dp, s->size, INV); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_MU_DIV_Q(function,itchfn) \
- { \
- unsigned i; \
- mp_ptr dp, tp, qp, scratch; \
- double t; \
- mp_size_t itch; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- \
- itch = itchfn (2 * s->size, s->size, 0); \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, 2 * s->size, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (scratch, itch, s->align_wp2); \
- \
- MPN_COPY (tp, s->xp, s->size); \
- MPN_COPY (tp+s->size, s->xp, s->size); \
- \
- /* normalize the data */ \
- dp[s->size-1] |= GMP_NUMB_HIGHBIT; \
- tp[2*s->size-1] = dp[s->size-1] - 1; \
- \
- speed_operand_dst (s, qp, s->size); \
- speed_operand_src (s, tp, 2 * s->size); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_dst (s, scratch, itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- function (qp, tp, 2 * s->size, dp, s->size, scratch); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_MU_DIV_QR(function,itchfn) \
- { \
- unsigned i; \
- mp_ptr dp, tp, qp, rp, scratch; \
- double t; \
- mp_size_t size1, itch; \
- TMP_DECL; \
- \
- size1 = (s->r == 0 ? 2 * s->size : s->r); \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- SPEED_RESTRICT_COND (size1 >= s->size); \
- \
- itch = itchfn (size1, s->size, 0); \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, size1 - s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, size1, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (scratch, itch, s->align_wp2); \
- SPEED_TMP_ALLOC_LIMBS (rp, s->size, s->align_wp2); /* alignment? */ \
- \
- /* we don't fill in dividend completely when size1 > s->size */ \
- MPN_COPY (tp, s->xp, s->size); \
- MPN_COPY (tp + size1 - s->size, s->xp, s->size); \
- \
- MPN_COPY (dp, s->yp, s->size); \
- \
- /* normalize the data */ \
- dp[s->size-1] |= GMP_NUMB_HIGHBIT; \
- tp[size1 - 1] = dp[s->size - 1] - 1; \
- \
- speed_operand_dst (s, qp, size1 - s->size); \
- speed_operand_dst (s, rp, s->size); \
- speed_operand_src (s, tp, size1); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_dst (s, scratch, itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- function (qp, rp, tp, size1, dp, s->size, scratch); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_MUPI_DIV_QR(function,itchfn) \
- { \
- unsigned i; \
- mp_ptr dp, tp, qp, rp, ip, scratch, tmp; \
- double t; \
- mp_size_t size1, itch; \
- TMP_DECL; \
- \
- size1 = (s->r == 0 ? 2 * s->size : s->r); \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- SPEED_RESTRICT_COND (size1 >= s->size); \
- \
- itch = itchfn (size1, s->size, s->size); \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, size1 - s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, size1, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (scratch, itch, s->align_wp2); \
- SPEED_TMP_ALLOC_LIMBS (rp, s->size, s->align_wp2); /* alignment? */ \
- SPEED_TMP_ALLOC_LIMBS (ip, s->size, s->align_wp2); /* alignment? */ \
- \
- /* we don't fill in dividend completely when size1 > s->size */ \
- MPN_COPY (tp, s->xp, s->size); \
- MPN_COPY (tp + size1 - s->size, s->xp, s->size); \
- \
- MPN_COPY (dp, s->yp, s->size); \
- \
- /* normalize the data */ \
- dp[s->size-1] |= GMP_NUMB_HIGHBIT; \
- tp[size1 - 1] = dp[s->size-1] - 1; \
- \
- tmp = TMP_ALLOC_LIMBS (mpn_invert_itch (s->size)); \
- mpn_invert (ip, dp, s->size, tmp); \
- \
- speed_operand_dst (s, qp, size1 - s->size); \
- speed_operand_dst (s, rp, s->size); \
- speed_operand_src (s, tp, size1); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_src (s, ip, s->size); \
- speed_operand_dst (s, scratch, itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- function (qp, rp, tp, size1, dp, s->size, ip, s->size, scratch); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_PI1_BDIV_QR(function) \
- { \
- unsigned i; \
- mp_ptr dp, tp, ap, qp; \
- mp_limb_t inv; \
- double t; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (ap, 2*s->size, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, 2*s->size, s->align_wp2); \
- \
- MPN_COPY (ap, s->xp, s->size); \
- MPN_COPY (ap+s->size, s->xp, s->size); \
- \
- /* divisor must be odd */ \
- MPN_COPY (dp, s->yp, s->size); \
- dp[0] |= 1; \
- binvert_limb (inv, dp[0]); \
- inv = -inv; \
- \
- speed_operand_src (s, ap, 2*s->size); \
- speed_operand_dst (s, tp, 2*s->size); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_dst (s, qp, s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- MPN_COPY (tp, ap, 2*s->size); \
- function (qp, tp, 2*s->size, dp, s->size, inv); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_PI1_BDIV_Q(function) \
- { \
- unsigned i; \
- mp_ptr dp, tp, qp; \
- mp_limb_t inv; \
- double t; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, s->size, s->align_wp2); \
- \
- /* divisor must be odd */ \
- MPN_COPY (dp, s->yp, s->size); \
- dp[0] |= 1; \
- binvert_limb (inv, dp[0]); \
- inv = -inv; \
- \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_dst (s, tp, s->size); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_dst (s, qp, s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- MPN_COPY (tp, s->xp, s->size); \
- function (qp, tp, s->size, dp, s->size, inv); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_MU_BDIV_Q(function,itchfn) \
- { \
- unsigned i; \
- mp_ptr dp, qp, scratch; \
- double t; \
- mp_size_t itch; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- \
- itch = itchfn (s->size, s->size); \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (scratch, itch, s->align_wp2); \
- \
- /* divisor must be odd */ \
- MPN_COPY (dp, s->yp, s->size); \
- dp[0] |= 1; \
- \
- speed_operand_dst (s, qp, s->size); \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_dst (s, scratch, itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- function (qp, s->xp, s->size, dp, s->size, scratch); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_MPN_MU_BDIV_QR(function,itchfn) \
+/* A division of s->size by 3 limbs */
+
+#define SPEED_ROUTINE_MPN_SB_DIVREM_M3(function) \
{ \
unsigned i; \
- mp_ptr dp, tp, qp, rp, scratch; \
+ mp_ptr a, d, q; \
+ mp_size_t qsize; \
double t; \
- mp_size_t itch; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- \
- itch = itchfn (2 * s->size, s->size); \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (dp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (qp, s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, 2 * s->size, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (scratch, itch, s->align_wp2); \
- SPEED_TMP_ALLOC_LIMBS (rp, s->size, s->align_wp2); /* alignment? */ \
- \
- MPN_COPY (tp, s->xp, s->size); \
- MPN_COPY (tp+s->size, s->xp, s->size); \
- \
- /* divisor must be odd */ \
- MPN_COPY (dp, s->yp, s->size); \
- dp[0] |= 1; \
- \
- speed_operand_dst (s, qp, s->size); \
- speed_operand_dst (s, rp, s->size); \
- speed_operand_src (s, tp, 2 * s->size); \
- speed_operand_src (s, dp, s->size); \
- speed_operand_dst (s, scratch, itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- function (qp, rp, tp, 2 * s->size, dp, s->size, scratch); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_BROOT(function) \
- { \
- SPEED_RESTRICT_COND (s->r & 1); \
- s->xp[0] |= 1; \
- SPEED_ROUTINE_MPN_UNARY_1_CALL \
- ((*function) (wp, s->xp, s->size, s->r)); \
- }
-
-#define SPEED_ROUTINE_MPN_BROOTINV(function, itch) \
- { \
- mp_ptr wp, tp; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- TMP_MARK; \
- SPEED_RESTRICT_COND (s->size >= 1); \
- SPEED_RESTRICT_COND (s->r & 1); \
- wp = TMP_ALLOC_LIMBS (s->size); \
- tp = TMP_ALLOC_LIMBS ( (itch)); \
- s->xp[0] |= 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 \
- (*function) (wp, s->xp, s->size, s->r, tp); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_INVERT(function,itchfn) \
- { \
- long i; \
- mp_ptr up, 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 (tp, itchfn (s->size), s->align_wp); \
- \
- MPN_COPY (up, s->xp, s->size); \
- \
- /* normalize the data */ \
- up[s->size-1] |= GMP_NUMB_HIGHBIT; \
- \
- 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); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (ip, up, s->size, tp); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_INVERTAPPR(function,itchfn) \
- { \
- long i; \
- mp_ptr up, 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 (tp, itchfn (s->size), s->align_wp); \
- \
- MPN_COPY (up, s->xp, s->size); \
- \
- /* normalize the data */ \
- up[s->size-1] |= GMP_NUMB_HIGHBIT; \
- \
- 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); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (ip, up, s->size, tp); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_NI_INVERTAPPR(function,itchfn) \
- { \
- long i; \
- mp_ptr up, tp, ip; \
- double t; \
TMP_DECL; \
\
SPEED_RESTRICT_COND (s->size >= 3); \
\
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 (tp, itchfn (s->size), s->align_wp); \
+ SPEED_TMP_ALLOC_LIMBS (a, s->size, s->align_xp); \
\
- MPN_COPY (up, s->xp, s->size); \
+ SPEED_TMP_ALLOC_LIMBS (d, 3, s->align_yp); \
+ MPN_COPY (d, s->yp, 3); \
+ d[2] |= GMP_NUMB_HIGHBIT; \
\
- /* normalize the data */ \
- up[s->size-1] |= GMP_NUMB_HIGHBIT; \
+ qsize = s->size - 3; \
+ SPEED_TMP_ALLOC_LIMBS (q, qsize, 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_operand_dst (s, a, s->size); \
+ speed_operand_src (s, d, 3); \
+ speed_operand_dst (s, q, qsize); \
speed_cache_fill (s); \
\
speed_starttime (); \
i = s->reps; \
do \
- function (ip, up, s->size, tp); \
+ { \
+ MPN_COPY (a, s->xp, s->size); \
+ function (q, a, s->size, d, 3); \
+ } \
while (--i != 0); \
t = speed_endtime (); \
\
@@ -2267,83 +1220,43 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
return t; \
}
-#define SPEED_ROUTINE_MPN_BINVERT(function,itchfn) \
+/* A remainder 2*s->size by s->size limbs */
+
+#define SPEED_ROUTINE_MPZ_MOD(function) \
{ \
- long i; \
- mp_ptr up, tp, ip; \
- double t; \
- TMP_DECL; \
+ unsigned i; \
+ mpz_t a, d, r; \
\
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 (tp, itchfn (s->size), s->align_wp); \
+ mpz_init_set_n (d, s->yp, s->size); \
\
- MPN_COPY (up, s->xp, s->size); \
+ /* high part less than d, low part a duplicate copied in */ \
+ mpz_init_set_n (a, s->xp, s->size); \
+ mpz_mod (a, a, d); \
+ mpz_mul_2exp (a, a, BITS_PER_MP_LIMB * s->size); \
+ MPN_COPY (PTR(a), s->xp, s->size); \
\
- /* normalize the data */ \
- up[0] |= 1; \
+ mpz_init (r); \
\
- speed_operand_src (s, up, s->size); \
- speed_operand_dst (s, tp, s->size); \
- speed_operand_dst (s, ip, s->size); \
+ speed_operand_src (s, PTR(a), SIZ(a)); \
+ speed_operand_src (s, PTR(d), SIZ(d)); \
speed_cache_fill (s); \
\
speed_starttime (); \
i = s->reps; \
do \
- function (ip, up, s->size, tp); \
+ function (r, a, d); \
while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
+ return speed_endtime (); \
}
-#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; \
mp_ptr cp, mp, tp, ap; \
- mp_limb_t inv; \
+ mp_limb_t Nprim; \
double t; \
TMP_DECL; \
\
@@ -2361,8 +1274,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
/* modulus must be odd */ \
MPN_COPY (mp, s->yp, s->size); \
mp[0] |= 1; \
- binvert_limb (inv, mp[0]); \
- inv = -inv; \
+ binvert_limb (Nprim, mp[0]); \
\
speed_operand_src (s, ap, 2*s->size+1); \
speed_operand_dst (s, tp, 2*s->size+1); \
@@ -2374,90 +1286,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
i = s->reps; \
do { \
MPN_COPY (tp, ap, 2*s->size); \
- function (cp, tp, mp, s->size, inv); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_REDC_2(function) \
- { \
- unsigned i; \
- mp_ptr cp, mp, tp, ap; \
- mp_limb_t invp[2]; \
- double t; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 1); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (ap, 2*s->size+1, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (mp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (cp, s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, 2*s->size+1, s->align_wp2); \
- \
- MPN_COPY (ap, s->xp, s->size); \
- MPN_COPY (ap+s->size, s->xp, s->size); \
- \
- /* modulus must be odd */ \
- MPN_COPY (mp, s->yp, s->size); \
- mp[0] |= 1; \
- mpn_binvert (invp, mp, 2, tp); \
- invp[0] = -invp[0]; invp[1] = ~invp[1]; \
- \
- speed_operand_src (s, ap, 2*s->size+1); \
- speed_operand_dst (s, tp, 2*s->size+1); \
- speed_operand_src (s, mp, s->size); \
- speed_operand_dst (s, cp, s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- MPN_COPY (tp, ap, 2*s->size); \
- function (cp, tp, mp, s->size, invp); \
- } while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
-#define SPEED_ROUTINE_REDC_N(function) \
- { \
- unsigned i; \
- mp_ptr cp, mp, tp, ap, invp; \
- double t; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size > 8); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (ap, 2*s->size+1, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (mp, s->size, s->align_yp); \
- SPEED_TMP_ALLOC_LIMBS (cp, s->size, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (tp, 2*s->size+1, s->align_wp2); \
- SPEED_TMP_ALLOC_LIMBS (invp, s->size, s->align_wp2); /* align? */ \
- \
- MPN_COPY (ap, s->xp, s->size); \
- MPN_COPY (ap+s->size, s->xp, s->size); \
- \
- /* modulus must be odd */ \
- MPN_COPY (mp, s->yp, s->size); \
- mp[0] |= 1; \
- mpn_binvert (invp, mp, s->size, tp); \
- \
- speed_operand_src (s, ap, 2*s->size+1); \
- speed_operand_dst (s, tp, 2*s->size+1); \
- speed_operand_src (s, mp, s->size); \
- speed_operand_dst (s, cp, s->size); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do { \
- MPN_COPY (tp, ap, 2*s->size); \
- function (cp, tp, mp, s->size, invp); \
+ function (cp, tp, mp, s->size, Nprim); \
} while (--i != 0); \
t = speed_endtime (); \
\
@@ -2805,107 +1634,6 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
function (px[j-1], py[j-1], 0))
-#define SPEED_ROUTINE_MPN_HGCD_CALL(func, itchfunc) \
- { \
- mp_size_t hgcd_init_itch, hgcd_itch; \
- mp_ptr ap, bp, wp, tmp1; \
- struct hgcd_matrix hgcd; \
- int res; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- if (s->size < 2) \
- return -1; \
- \
- TMP_MARK; \
- \
- SPEED_TMP_ALLOC_LIMBS (ap, s->size + 1, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (bp, s->size + 1, s->align_yp); \
- \
- s->xp[s->size - 1] |= 1; \
- s->yp[s->size - 1] |= 1; \
- \
- hgcd_init_itch = MPN_HGCD_MATRIX_INIT_ITCH (s->size); \
- hgcd_itch = itchfunc (s->size); \
- \
- SPEED_TMP_ALLOC_LIMBS (tmp1, hgcd_init_itch, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (wp, hgcd_itch, s->align_wp); \
- \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, s->yp, s->size); \
- speed_operand_dst (s, ap, s->size + 1); \
- speed_operand_dst (s, bp, s->size + 1); \
- speed_operand_dst (s, wp, hgcd_itch); \
- speed_operand_dst (s, tmp1, hgcd_init_itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- { \
- MPN_COPY (ap, s->xp, s->size); \
- MPN_COPY (bp, s->yp, s->size); \
- mpn_hgcd_matrix_init (&hgcd, s->size, tmp1); \
- res = func (ap, bp, s->size, &hgcd, wp); \
- } \
- while (--i != 0); \
- t = speed_endtime (); \
- TMP_FREE; \
- return t; \
- }
-
-#define SPEED_ROUTINE_MPN_HGCD_REDUCE_CALL(func, itchfunc) \
- { \
- mp_size_t hgcd_init_itch, hgcd_step_itch; \
- mp_ptr ap, bp, wp, tmp1; \
- struct hgcd_matrix hgcd; \
- mp_size_t p = s->size/2; \
- int res; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- if (s->size < 2) \
- return -1; \
- \
- TMP_MARK; \
- \
- SPEED_TMP_ALLOC_LIMBS (ap, s->size + 1, s->align_xp); \
- SPEED_TMP_ALLOC_LIMBS (bp, s->size + 1, s->align_yp); \
- \
- s->xp[s->size - 1] |= 1; \
- s->yp[s->size - 1] |= 1; \
- \
- hgcd_init_itch = MPN_HGCD_MATRIX_INIT_ITCH (s->size); \
- hgcd_step_itch = itchfunc (s->size, p); \
- \
- SPEED_TMP_ALLOC_LIMBS (tmp1, hgcd_init_itch, s->align_wp); \
- SPEED_TMP_ALLOC_LIMBS (wp, hgcd_step_itch, s->align_wp); \
- \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, s->yp, s->size); \
- speed_operand_dst (s, ap, s->size + 1); \
- speed_operand_dst (s, bp, s->size + 1); \
- speed_operand_dst (s, wp, hgcd_step_itch); \
- speed_operand_dst (s, tmp1, hgcd_init_itch); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- { \
- MPN_COPY (ap, s->xp, s->size); \
- MPN_COPY (bp, s->yp, s->size); \
- mpn_hgcd_matrix_init (&hgcd, s->size, tmp1); \
- res = func (&hgcd, ap, bp, s->size, p, wp); \
- } \
- while (--i != 0); \
- t = speed_endtime (); \
- TMP_FREE; \
- return t; \
- }
-
/* Run some GCDs of s->size limbs each. The number of different data values
is decreased as s->size**2, since GCD is a quadratic algorithm.
SPEED_ROUTINE_MPN_GCD runs more times than SPEED_ROUTINE_MPN_GCDEXT
@@ -3169,111 +1897,6 @@ 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; \
- mp_limb_t yp[2]; \
- mp_limb_t rp[2]; \
- unsigned i; \
- double t; \
- TMP_DECL; \
- \
- SPEED_RESTRICT_COND (s->size >= 2); \
- \
- TMP_MARK; \
- SPEED_TMP_ALLOC_LIMBS (wp, s->size, s->align_wp); \
- \
- /* divisor must be normalized */ \
- MPN_COPY (yp, s->yp_block, 2); \
- if (norm) \
- yp[1] |= GMP_NUMB_HIGHBIT; \
- else \
- { \
- yp[1] &= ~GMP_NUMB_HIGHBIT; \
- if (yp[1] == 0) \
- yp[1] = 1; \
- } \
- speed_operand_src (s, s->xp, s->size); \
- speed_operand_src (s, yp, 2); \
- speed_operand_dst (s, wp, s->size); \
- speed_operand_dst (s, rp, 2); \
- speed_cache_fill (s); \
- \
- speed_starttime (); \
- i = s->reps; \
- do \
- function (wp, rp, s->xp, s->size, yp); \
- while (--i != 0); \
- t = speed_endtime (); \
- \
- TMP_FREE; \
- return t; \
- }
#define SPEED_ROUTINE_MODLIMB_INVERT(function) \
{ \
@@ -3402,7 +2025,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/GMP_LIMB_BYTES); \
+ speed_operand_dst (s, (mp_ptr) wp, wn/BYTES_PER_MP_LIMB); \
speed_cache_fill (s); \
\
speed_starttime (); \
@@ -3442,7 +2065,8 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
for (i = 0; i < s->size; i++) \
xp[i] = s->xp[i] % base; \
\
- LIMBS_PER_DIGIT_IN_BASE (wn, s->size, base); \
+ wn = ((mp_size_t) (s->size / __mp_bases[base].chars_per_bit_exactly)) \
+ / BITS_PER_MP_LIMB + 2; \
SPEED_TMP_ALLOC_LIMBS (wp, wn, s->align_wp); \
\
/* use this during development to check wn is big enough */ \
@@ -3450,7 +2074,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/GMP_LIMB_BYTES); \
+ speed_operand_src (s, (mp_ptr) xp, s->size/BYTES_PER_MP_LIMB); \
speed_operand_dst (s, wp, wn); \
speed_cache_fill (s); \
\
@@ -3466,7 +2090,7 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
}
-/* Run an accel gcd find_a() function over various data values. A set of
+/* Run an accel gcd find_a() function over various data values. A set of
values is used in case some run particularly fast or slow. The size
parameter is ignored, the amount of data tested is fixed. */
@@ -3602,6 +2226,9 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
}
+#endif
+
+
#define SPEED_ROUTINE_MPN_BACK_TO_BACK(function) \
{ \
unsigned i; \
@@ -3641,6 +2268,3 @@ int speed_routine_count_zeros_setup (struct speed_params *, mp_ptr, int, int);
#define SPEED_ROUTINE_MPN_ZERO(function) \
SPEED_ROUTINE_MPN_ZERO_CALL (function (wp, s->size))
-
-
-#endif
diff --git a/gmp/tune/time.c b/gmp/tune/time.c
index 0178b345af..865a92c758 100644
--- a/gmp/tune/time.c
+++ b/gmp/tune/time.c
@@ -1,32 +1,21 @@
-/* Time routines for speed measurements.
+/* Time routines for speed measurments.
-Copyright 1999-2004, 2010-2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 2002, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Usage:
@@ -266,7 +255,7 @@ static const int use_stck = 1; /* always use when available */
typedef uint64_t stck_t; /* gcc for s390 is quite new, always has uint64_t */
#define STCK(timestamp) \
do { \
- asm ("stck %0" : "=Q" (timestamp)); \
+ asm ("stck %0" : "=m" (timestamp)); \
} while (0)
#else
static const int have_stck = 0;
@@ -467,22 +456,9 @@ cycles_works_p (void)
if (result != -1)
goto done;
- /* FIXME: On linux, the cycle counter is not saved and restored over
- * context switches, making it almost useless for precise cputime
- * measurements. When available, it's better to use clock_gettime,
- * which seems to have reasonable accuracy (tested on x86_32,
- * linux-2.6.26, glibc-2.7). However, there are also some linux
- * systems where clock_gettime is broken in one way or the other,
- * like CLOCK_PROCESS_CPUTIME_ID not implemented (easy case) or
- * kind-of implemented but broken (needs code to detect that), and
- * on those systems a wall-clock cycle counter is the least bad
- * fallback.
- *
- * So we need some code to disable the cycle counter on some but not
- * all linux systems. */
#ifdef SIGILL
{
- RETSIGTYPE (*old_handler) (int);
+ RETSIGTYPE (*old_handler) __GMP_PROTO ((int));
unsigned cycles[2];
old_handler = signal (SIGILL, cycles_works_handler);
@@ -695,8 +671,8 @@ getrusage_backwards_p (void)
if (speed_option_verbose)
printf ("getrusage went backwards (attempt %d: %ld.%06ld -> %ld.%06ld)\n",
i,
- (long) prev.ru_utime.tv_sec, (long) prev.ru_utime.tv_usec,
- (long) next.ru_utime.tv_sec, (long) next.ru_utime.tv_usec);
+ prev.ru_utime.tv_sec, prev.ru_utime.tv_usec,
+ next.ru_utime.tv_sec, next.ru_utime.tv_usec);
result = 1;
break;
}
@@ -733,8 +709,6 @@ const int have_cgt_id = 0;
# define CGT_ID (ASSERT_FAIL (CGT_ID not determined), -1)
#endif
-#define CGT_DELAY_COUNT 1000
-
int
cgt_works_p (void)
{
@@ -776,44 +750,6 @@ cgt_works_p (void)
cgt_unittime = unit.tv_sec + unit.tv_nsec * 1e-9;
printf ("clock_gettime is %s accurate\n",
unittime_string (cgt_unittime));
-
- if (cgt_unittime < 10e-9)
- {
- /* Do we believe this? */
- struct timespec start, end;
- static volatile int counter;
- double duration;
- if (clock_gettime (CGT_ID, &start))
- {
- if (speed_option_verbose)
- printf ("clock_gettime id=%d error: %s\n", CGT_ID, strerror (errno));
- result = 0;
- return result;
- }
- /* Loop of at least 1000 memory accesses, ought to take at
- least 100 ns*/
- for (counter = 0; counter < CGT_DELAY_COUNT; counter++)
- ;
- if (clock_gettime (CGT_ID, &end))
- {
- if (speed_option_verbose)
- printf ("clock_gettime id=%d error: %s\n", CGT_ID, strerror (errno));
- result = 0;
- return result;
- }
- 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_gettime)\n",
- CGT_DELAY_COUNT, unittime_string (duration));
- if (duration < 100e-9)
- {
- if (speed_option_verbose)
- printf ("clock_gettime id=%d not believable\n", CGT_ID);
- result = 0;
- return result;
- }
- }
result = 1;
return result;
}
@@ -843,7 +779,7 @@ int
mftb_works_p (void)
{
unsigned a[2];
- RETSIGTYPE (*old_handler) (int);
+ RETSIGTYPE (*old_handler) __GMP_PROTO ((int));
double cycletime;
/* suppress a warning about a[] unused */
@@ -1005,7 +941,7 @@ speed_time_init (void)
speed_cycletime_init ();
- if (!speed_option_cycles_broken && have_cycles && cycles_works_p ())
+ if (have_cycles && cycles_works_p ())
{
use_cycles = 1;
DEFAULT (speed_cycletime, 1.0);
@@ -1136,7 +1072,7 @@ speed_time_init (void)
use_cgt = 1;
speed_unittime = cgt_unittime;
DEFAULT (speed_precision, (cgt_unittime <= 0.1e-6 ? 10000 : 1000));
- strcpy (speed_time_string, "microsecond accurate clock_gettime()");
+ strcpy (speed_time_string, "microsecond accurate getrusage()");
}
else if (have_times && clk_tck() > 1000000)
{
@@ -1353,7 +1289,7 @@ speed_mftb_diff (const unsigned end[2], const unsigned start[2])
psecs might overflow. 2^32 microseconds is only a bit over an hour, or
2^32 nanoseconds only about 4 seconds.
- The casts to "long" are for the benefit of timebasestruct_t, where the
+ The casts to "long" are for the beneifit of timebasestruct_t, where the
fields are only "unsigned int", but we want a signed difference. */
#define DIFF_SECS_ROUTINE(sec, psec, punit) \
diff --git a/gmp/tune/tune-gcd-p.c b/gmp/tune/tune-gcd-p.c
deleted file mode 100644
index 4d52f5610c..0000000000
--- a/gmp/tune/tune-gcd-p.c
+++ /dev/null
@@ -1,225 +0,0 @@
-/* tune-gcd-p
-
- Tune the choice for splitting p in divide-and-conquer gcd.
-
-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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
-
-The GNU MP Library is distributed in the hope that 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_GCD_P 1
-
-#include "../mpn/gcd.c"
-
-#include <stdio.h>
-#include <stdlib.h>
-#include <string.h>
-#include <time.h>
-
-#include "speed.h"
-
-/* Search for minimum over a range. FIXME: Implement golden-section /
- fibonacci search*/
-static int
-search (double *minp, double (*f)(void *, int), void *ctx, int start, int end)
-{
- int x[4];
- double y[4];
-
- int best_i;
-
- x[0] = start;
- x[3] = end;
-
- y[0] = f(ctx, x[0]);
- y[3] = f(ctx, x[3]);
-
- for (;;)
- {
- int i;
- int length = x[3] - x[0];
-
- x[1] = x[0] + length/3;
- x[2] = x[0] + 2*length/3;
-
- y[1] = f(ctx, x[1]);
- y[2] = f(ctx, x[2]);
-
-#if 0
- printf("%d: %f, %d: %f, %d:, %f %d: %f\n",
- x[0], y[0], x[1], y[1], x[2], y[2], x[3], y[3]);
-#endif
- for (best_i = 0, i = 1; i < 4; i++)
- if (y[i] < y[best_i])
- best_i = i;
-
- if (length <= 4)
- break;
-
- if (best_i >= 2)
- {
- x[0] = x[1];
- y[0] = y[1];
- }
- else
- {
- x[3] = x[2];
- y[3] = y[2];
- }
- }
- *minp = y[best_i];
- return x[best_i];
-}
-
-static int
-compare_double(const void *ap, const void *bp)
-{
- double a = * (const double *) ap;
- double b = * (const double *) bp;
-
- if (a < b)
- return -1;
- else if (a > b)
- return 1;
- else
- return 0;
-}
-
-static double
-median (double *v, size_t n)
-{
- qsort(v, n, sizeof(*v), compare_double);
-
- return v[n/2];
-}
-
-#define TIME(res, code) do { \
- double time_measurement[5]; \
- unsigned time_i; \
- \
- for (time_i = 0; time_i < 5; time_i++) \
- { \
- speed_starttime(); \
- code; \
- time_measurement[time_i] = speed_endtime(); \
- } \
- res = median(time_measurement, 5); \
-} while (0)
-
-struct bench_data
-{
- mp_size_t n;
- mp_ptr ap;
- mp_ptr bp;
- mp_ptr up;
- mp_ptr vp;
- mp_ptr gp;
-};
-
-static double
-bench_gcd (void *ctx, int p)
-{
- struct bench_data *data = ctx;
- double t;
-
- p_table[data->n] = p;
- TIME(t, {
- MPN_COPY (data->up, data->ap, data->n);
- MPN_COPY (data->vp, data->bp, data->n);
- mpn_gcd (data->gp, data->up, data->n, data->vp, data->n);
- });
-
- return t;
-}
-
-int
-main(int argc, char **argv)
-{
- gmp_randstate_t rands; struct bench_data data;
- mp_size_t n;
-
- TMP_DECL;
-
- /* Unbuffered so if output is redirected to a file it isn't lost if the
- program is killed part way through. */
- setbuf (stdout, NULL);
- setbuf (stderr, NULL);
-
- gmp_randinit_default (rands);
-
- TMP_MARK;
-
- data.ap = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
- data.bp = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
- data.up = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
- data.vp = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
- data.gp = TMP_ALLOC_LIMBS (P_TABLE_SIZE);
-
- mpn_random (data.ap, P_TABLE_SIZE);
- mpn_random (data.bp, P_TABLE_SIZE);
-
- memset (p_table, 0, sizeof(p_table));
-
- for (n = 100; n < P_TABLE_SIZE; n++)
- {
- mp_size_t p;
- mp_size_t best_p;
- double best_time;
- double lehmer_time;
-
- if (data.ap[n-1] == 0)
- data.ap[n-1] = 1;
-
- if (data.bp[n-1] == 0)
- data.bp[n-1] = 1;
-
- data.n = n;
-
- lehmer_time = bench_gcd (&data, 0);
-
- best_p = search (&best_time, bench_gcd, &data, n/5, 4*n/5);
- if (best_time > lehmer_time)
- best_p = 0;
-
- printf("%6d %6d %5.3g", n, best_p, (double) best_p / n);
- if (best_p > 0)
- {
- double speedup = 100 * (lehmer_time - best_time) / lehmer_time;
- printf(" %5.3g%%", speedup);
- if (speedup < 1.0)
- {
- printf(" (ignored)");
- best_p = 0;
- }
- }
- printf("\n");
-
- p_table[n] = best_p;
- }
- TMP_FREE;
- gmp_randclear(rands);
- return 0;
-}
diff --git a/gmp/tune/tuneup.c b/gmp/tune/tuneup.c
index 2fba6b2955..06cb03c583 100644
--- a/gmp/tune/tuneup.c
+++ b/gmp/tune/tuneup.c
@@ -1,32 +1,21 @@
/* Create tuned thresholds for various algorithms.
-Copyright 1999-2003, 2005, 2006, 2008-2012 Free Software Foundation, Inc.
+Copyright 1999, 2000, 2001, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have received a copy of the GNU Lesser General Public License
+along with the GNU MP Library. If not, see http://www.gnu.org/licenses/. */
/* Usage: tuneup [-t] [-t] [-p precision]
@@ -75,11 +64,11 @@ see https://www.gnu.org/licenses/. */
instead. #define TUNE_PROGRAM_BUILD does this, with help from code at
the end of gmp-impl.h, and rules in tune/Makefile.am.
- MUL_TOOM22_THRESHOLD for example uses a recompiled mpn_mul_n. The
+ MUL_KARATSUBA_THRESHOLD for example uses a recompiled mpn_mul_n. The
threshold is set to "size+1" to avoid karatsuba, or to "size" to use one
level, but recurse into the basecase.
- MUL_TOOM33_THRESHOLD makes use of the tuned MUL_TOOM22_THRESHOLD value.
+ MUL_TOOM3_THRESHOLD makes use of the tuned MUL_KARATSUBA_THRESHOLD value.
Other routines in turn will make use of both of those. Naturally the
dependants must be tuned first.
@@ -98,7 +87,7 @@ see https://www.gnu.org/licenses/. */
DIVREM_1_NORM_THRESHOLD. An assembler mpn_divrem_1 is expected to be
written and tuned all by hand. Assembler routines that might have hard
limits are recompiled though, to make them accept a bigger range of sizes
- than normal, eg. mpn_sqr_basecase to compare against mpn_toom2_sqr.
+ than normal, eg. mpn_sqr_basecase to compare against mpn_kara_sqr_n.
Limitations:
@@ -153,81 +142,46 @@ int allocdat = 0;
/* This is not defined if mpn_sqr_basecase doesn't declare a limit. In that
case use zero here, which for params.max_size means no limit. */
-#ifndef TUNE_SQR_TOOM2_MAX
-#define TUNE_SQR_TOOM2_MAX 0
+#ifndef TUNE_SQR_KARATSUBA_MAX
+#define TUNE_SQR_KARATSUBA_MAX 0
#endif
-mp_size_t mul_toom22_threshold = MP_SIZE_T_MAX;
-mp_size_t mul_toom33_threshold = MUL_TOOM33_THRESHOLD_LIMIT;
+mp_size_t mul_karatsuba_threshold = MP_SIZE_T_MAX;
+mp_size_t mul_toom3_threshold = MUL_TOOM3_THRESHOLD_LIMIT;
mp_size_t mul_toom44_threshold = MUL_TOOM44_THRESHOLD_LIMIT;
-mp_size_t mul_toom6h_threshold = MUL_TOOM6H_THRESHOLD_LIMIT;
-mp_size_t mul_toom8h_threshold = MUL_TOOM8H_THRESHOLD_LIMIT;
-mp_size_t mul_toom32_to_toom43_threshold = MP_SIZE_T_MAX;
-mp_size_t mul_toom32_to_toom53_threshold = MP_SIZE_T_MAX;
-mp_size_t mul_toom42_to_toom53_threshold = MP_SIZE_T_MAX;
-mp_size_t mul_toom42_to_toom63_threshold = MP_SIZE_T_MAX;
-mp_size_t mul_toom43_to_toom54_threshold = MP_SIZE_T_MAX;
mp_size_t mul_fft_threshold = MP_SIZE_T_MAX;
mp_size_t mul_fft_modf_threshold = MP_SIZE_T_MAX;
mp_size_t sqr_basecase_threshold = MP_SIZE_T_MAX;
-mp_size_t sqr_toom2_threshold
- = (TUNE_SQR_TOOM2_MAX == 0 ? MP_SIZE_T_MAX : TUNE_SQR_TOOM2_MAX);
+mp_size_t sqr_karatsuba_threshold
+ = (TUNE_SQR_KARATSUBA_MAX == 0 ? MP_SIZE_T_MAX : TUNE_SQR_KARATSUBA_MAX);
mp_size_t sqr_toom3_threshold = SQR_TOOM3_THRESHOLD_LIMIT;
mp_size_t sqr_toom4_threshold = SQR_TOOM4_THRESHOLD_LIMIT;
-mp_size_t sqr_toom6_threshold = SQR_TOOM6_THRESHOLD_LIMIT;
-mp_size_t sqr_toom8_threshold = SQR_TOOM8_THRESHOLD_LIMIT;
mp_size_t sqr_fft_threshold = MP_SIZE_T_MAX;
mp_size_t sqr_fft_modf_threshold = MP_SIZE_T_MAX;
-mp_size_t mullo_basecase_threshold = MP_SIZE_T_MAX;
-mp_size_t mullo_dc_threshold = MP_SIZE_T_MAX;
-mp_size_t mullo_mul_n_threshold = MP_SIZE_T_MAX;
-mp_size_t mulmid_toom42_threshold = MP_SIZE_T_MAX;
-mp_size_t mulmod_bnm1_threshold = MP_SIZE_T_MAX;
-mp_size_t sqrmod_bnm1_threshold = MP_SIZE_T_MAX;
-mp_size_t div_qr_2_pi2_threshold = MP_SIZE_T_MAX;
-mp_size_t dc_div_qr_threshold = MP_SIZE_T_MAX;
-mp_size_t dc_divappr_q_threshold = MP_SIZE_T_MAX;
-mp_size_t mu_div_qr_threshold = MP_SIZE_T_MAX;
-mp_size_t mu_divappr_q_threshold = MP_SIZE_T_MAX;
-mp_size_t mupi_div_qr_threshold = MP_SIZE_T_MAX;
-mp_size_t mu_div_q_threshold = MP_SIZE_T_MAX;
-mp_size_t dc_bdiv_qr_threshold = MP_SIZE_T_MAX;
-mp_size_t dc_bdiv_q_threshold = MP_SIZE_T_MAX;
-mp_size_t mu_bdiv_qr_threshold = MP_SIZE_T_MAX;
-mp_size_t mu_bdiv_q_threshold = MP_SIZE_T_MAX;
-mp_size_t inv_mulmod_bnm1_threshold = MP_SIZE_T_MAX;
-mp_size_t inv_newton_threshold = MP_SIZE_T_MAX;
-mp_size_t inv_appr_threshold = MP_SIZE_T_MAX;
-mp_size_t binv_newton_threshold = MP_SIZE_T_MAX;
-mp_size_t redc_1_to_redc_2_threshold = MP_SIZE_T_MAX;
-mp_size_t redc_1_to_redc_n_threshold = MP_SIZE_T_MAX;
-mp_size_t redc_2_to_redc_n_threshold = MP_SIZE_T_MAX;
+mp_size_t mullow_basecase_threshold = MP_SIZE_T_MAX;
+mp_size_t mullow_dc_threshold = MP_SIZE_T_MAX;
+mp_size_t mullow_mul_n_threshold = MP_SIZE_T_MAX;
+mp_size_t div_sb_preinv_threshold = MP_SIZE_T_MAX;
+mp_size_t div_dc_threshold = MP_SIZE_T_MAX;
+mp_size_t powm_threshold = MP_SIZE_T_MAX;
mp_size_t matrix22_strassen_threshold = MP_SIZE_T_MAX;
mp_size_t hgcd_threshold = MP_SIZE_T_MAX;
-mp_size_t hgcd_appr_threshold = MP_SIZE_T_MAX;
-mp_size_t hgcd_reduce_threshold = MP_SIZE_T_MAX;
+mp_size_t gcd_accel_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;
mp_size_t mod_1_unnorm_threshold = MP_SIZE_T_MAX;
-int mod_1_1p_method = 0;
-mp_size_t mod_1n_to_mod_1_1_threshold = MP_SIZE_T_MAX;
-mp_size_t mod_1u_to_mod_1_1_threshold = MP_SIZE_T_MAX;
-mp_size_t mod_1_1_to_mod_1_2_threshold = MP_SIZE_T_MAX;
-mp_size_t mod_1_2_to_mod_1_4_threshold = MP_SIZE_T_MAX;
-mp_size_t preinv_mod_1_to_mod_1_threshold = MP_SIZE_T_MAX;
+mp_size_t mod_1_1_threshold = MP_SIZE_T_MAX;
+mp_size_t mod_1_2_threshold = MP_SIZE_T_MAX;
+mp_size_t mod_1_3_threshold = MP_SIZE_T_MAX;
+mp_size_t mod_1_4_threshold = MP_SIZE_T_MAX;
mp_size_t divrem_2_threshold = MP_SIZE_T_MAX;
mp_size_t get_str_dc_threshold = MP_SIZE_T_MAX;
mp_size_t get_str_precompute_threshold = MP_SIZE_T_MAX;
mp_size_t set_str_dc_threshold = MP_SIZE_T_MAX;
mp_size_t set_str_precompute_threshold = MP_SIZE_T_MAX;
-mp_size_t fac_odd_threshold = 0;
-mp_size_t fac_dsc_threshold = FAC_DSC_THRESHOLD_LIMIT;
mp_size_t fft_modf_sqr_threshold = MP_SIZE_T_MAX;
mp_size_t fft_modf_mul_threshold = MP_SIZE_T_MAX;
@@ -236,8 +190,7 @@ struct param_t {
const char *name;
speed_function_t function;
speed_function_t function2;
- double step_factor; /* how much to step relatively */
- int step; /* how much to step absolutely */
+ double step_factor; /* how much to step sizes (rounded down) */
double function_fudge; /* multiplier for "function" speeds */
int stop_since_change;
double stop_factor;
@@ -263,9 +216,6 @@ 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
@@ -275,9 +225,6 @@ struct param_t {
#ifndef HAVE_NATIVE_mpn_mod_1
#define HAVE_NATIVE_mpn_mod_1 0
#endif
-#ifndef HAVE_NATIVE_mpn_mod_1_1p
-#define HAVE_NATIVE_mpn_mod_1_1p 0
-#endif
#ifndef HAVE_NATIVE_mpn_modexact_1_odd
#define HAVE_NATIVE_mpn_modexact_1_odd 0
#endif
@@ -383,13 +330,12 @@ analyze_dat (int final)
}
-/* Measuring for recompiled mpn/generic/div_qr_1.c,
- * mpn/generic/divrem_1.c, mpn/generic/mod_1.c and mpz/fac_ui.c */
+/* Measuring for recompiled mpn/generic/divrem_1.c and mpn/generic/mod_1.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);
+mp_limb_t mpn_divrem_1_tune
+ __GMP_PROTO ((mp_ptr, mp_size_t, mp_srcptr, mp_size_t, mp_limb_t));
+mp_limb_t mpn_mod_1_tune
+ __GMP_PROTO ((mp_srcptr, mp_size_t, mp_limb_t));
double
speed_mpn_mod_1_tune (struct speed_params *s)
@@ -401,16 +347,7 @@ speed_mpn_divrem_1_tune (struct speed_params *s)
{
SPEED_ROUTINE_MPN_DIVREM_1 (mpn_divrem_1_tune);
}
-double
-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,
@@ -453,7 +390,7 @@ tuneup_measure (speed_function_t fun,
}
-#define PRINT_WIDTH 31
+#define PRINT_WIDTH 28
void
print_define_start (const char *name)
@@ -477,7 +414,6 @@ print_define_end_remark (const char *name, mp_size_t value, const char *remark)
if (remark != NULL)
printf (" /* %s */", remark);
printf ("\n");
- fflush (stdout);
}
void
@@ -519,7 +455,6 @@ one (mp_size_t *threshold, struct param_t *param)
DEFAULT (param->function_fudge, 1.0);
DEFAULT (param->function2, param->function);
DEFAULT (param->step_factor, 0.01); /* small steps by default */
- DEFAULT (param->step, 1); /* small steps by default */
DEFAULT (param->stop_since_change, 80);
DEFAULT (param->stop_factor, 1.2);
DEFAULT (param->min_size, 10);
@@ -575,10 +510,21 @@ one (mp_size_t *threshold, struct param_t *param)
for (s.size = param->min_size;
s.size < param->max_size;
- s.size += MAX ((mp_size_t) floor (s.size * param->step_factor), param->step))
+ s.size += MAX ((mp_size_t) floor (s.size * param->step_factor), 1))
{
double ti, tiplus1, d;
+ /* If there's a size limit and it's reached then it should still
+ be sensible to analyze the data since we want the threshold put
+ either at or near the limit. */
+ if (s.size >= param->max_size)
+ {
+ if (option_trace)
+ printf ("Reached maximum size (%ld) without otherwise stopping\n",
+ (long) param->max_size);
+ break;
+ }
+
/*
FIXME: check minimum size requirements are met, possibly by just
checking for the -1 returns from the speed functions.
@@ -638,7 +584,7 @@ one (mp_size_t *threshold, struct param_t *param)
}
/* Stop if the threshold implied hasn't changed in a certain
- number of measurements. (It's this condition that usually
+ number of measurements. (It's this condition that ususally
stops the loop.) */
if (thresh_idx != new_thresh_idx)
since_thresh_change = 0, thresh_idx = new_thresh_idx;
@@ -713,7 +659,6 @@ struct fft_param_t {
mp_size_t first_size;
mp_size_t max_size;
speed_function_t function;
- speed_function_t mul_modf_function;
speed_function_t mul_function;
mp_size_t sqr;
};
@@ -728,7 +673,7 @@ fft_step_size (int k)
{
mp_size_t step;
- step = MAX ((mp_size_t) 1 << (k-1), GMP_LIMB_BITS) / GMP_LIMB_BITS;
+ step = MAX ((mp_size_t) 1 << (k-1), BITS_PER_MP_LIMB) / BITS_PER_MP_LIMB;
step *= (mp_size_t) 1 << k;
if (step <= 0)
@@ -754,435 +699,126 @@ fft_next_size (mp_size_t pl, int k)
return pl;
}
-#define NMAX_DEFAULT 1000000
-#define MAX_REPS 25
-#define MIN_REPS 5
-
-static inline size_t
-mpn_mul_fft_lcm (size_t a, unsigned int k)
-{
- unsigned int l = k;
-
- while (a % 2 == 0 && k > 0)
- {
- a >>= 1;
- k--;
- }
- return a << l;
-}
-
-mp_size_t
-fftfill (mp_size_t pl, int k, int sqr)
-{
- mp_size_t maxLK;
- mp_bitcnt_t N, Nprime, nprime, M;
-
- N = pl * GMP_NUMB_BITS;
- M = N >> k;
-
- maxLK = mpn_mul_fft_lcm ((unsigned long) GMP_NUMB_BITS, k);
-
- Nprime = (1 + (2 * M + k + 2) / maxLK) * maxLK;
- nprime = Nprime / GMP_NUMB_BITS;
- if (nprime >= (sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
- {
- size_t K2;
- for (;;)
- {
- K2 = 1L << mpn_fft_best_k (nprime, sqr);
- if ((nprime & (K2 - 1)) == 0)
- break;
- nprime = (nprime + K2 - 1) & -K2;
- Nprime = nprime * GMP_LIMB_BITS;
- }
- }
- ASSERT_ALWAYS (nprime < pl);
-
- return Nprime;
-}
-
-static int
-compare_double (const void *ap, const void *bp)
-{
- double a = * (const double *) ap;
- double b = * (const double *) bp;
-
- if (a < b)
- return -1;
- else if (a > b)
- return 1;
- else
- return 0;
-}
-
-double
-median (double *times, int n)
-{
- qsort (times, n, sizeof (double), compare_double);
- return times[n/2];
-}
-
-#define FFT_CACHE_SIZE 25
-typedef struct fft_cache
-{
- mp_size_t n;
- double time;
-} fft_cache_t;
-
-fft_cache_t fft_cache[FFT_CACHE_SIZE];
-
-double
-cached_measure (mp_ptr rp, mp_srcptr ap, mp_srcptr bp, mp_size_t n, int k,
- int n_measurements)
-{
- int i;
- double t, ttab[MAX_REPS];
-
- if (fft_cache[k].n == n)
- return fft_cache[k].time;
-
- for (i = 0; i < n_measurements; i++)
- {
- speed_starttime ();
- mpn_mul_fft (rp, n, ap, n, bp, n, k);
- ttab[i] = speed_endtime ();
- }
-
- t = median (ttab, n_measurements);
- fft_cache[k].n = n;
- fft_cache[k].time = t;
- return t;
-}
-
-#define INSERT_FFTTAB(idx, nval, kval) \
- do { \
- fft_tab[idx].n = nval; \
- fft_tab[idx].k = kval; \
- fft_tab[idx+1].n = -1; /* sentinel */ \
- fft_tab[idx+1].k = -1; \
- } while (0)
-
-int
-fftmes (mp_size_t nmin, mp_size_t nmax, int initial_k, struct fft_param_t *p, int idx, int print)
-{
- mp_size_t n, n1, prev_n1;
- int k, best_k, last_best_k, kmax;
- int eff, prev_eff;
- double t0, t1;
- int n_measurements;
- mp_limb_t *ap, *bp, *rp;
- mp_size_t alloc;
- char *linepref;
- struct fft_table_nk *fft_tab;
-
- fft_tab = mpn_fft_table3[p->sqr];
-
- for (k = 0; k < FFT_CACHE_SIZE; k++)
- fft_cache[k].n = 0;
-
- if (nmin < (p->sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD))
- {
- nmin = (p->sqr ? SQR_FFT_MODF_THRESHOLD : MUL_FFT_MODF_THRESHOLD);
- }
-
- if (print)
- printf ("#define %s%*s", p->table_name, 38, "");
-
- if (idx == 0)
- {
- INSERT_FFTTAB (0, nmin, initial_k);
-
- if (print)
- {
- printf ("\\\n { ");
- printf ("{%7u,%2u}", fft_tab[0].n, fft_tab[0].k);
- linepref = " ";
- }
-
- idx = 1;
- }
-
- ap = malloc (sizeof (mp_limb_t));
- if (p->sqr)
- bp = ap;
- else
- bp = malloc (sizeof (mp_limb_t));
- rp = malloc (sizeof (mp_limb_t));
- alloc = 1;
-
- /* Round n to comply to initial k value */
- n = (nmin + ((1ul << initial_k) - 1)) & (MP_SIZE_T_MAX << initial_k);
-
- n_measurements = (18 - initial_k) | 1;
- n_measurements = MAX (n_measurements, MIN_REPS);
- n_measurements = MIN (n_measurements, MAX_REPS);
-
- last_best_k = initial_k;
- best_k = initial_k;
-
- while (n < nmax)
- {
- int start_k, end_k;
-
- /* Assume the current best k is best until we hit its next FFT step. */
- t0 = 99999;
-
- prev_n1 = n + 1;
-
- start_k = MAX (4, best_k - 4);
- end_k = MIN (24, best_k + 4);
- for (k = start_k; k <= end_k; k++)
- {
- n1 = mpn_fft_next_size (prev_n1, k);
-
- eff = 200 * (n1 * GMP_NUMB_BITS >> k) / fftfill (n1, k, p->sqr);
-
- if (eff < 70) /* avoid measuring too slow fft:s */
- continue;
-
- if (n1 > alloc)
- {
- alloc = n1;
- if (p->sqr)
- {
- ap = realloc (ap, sizeof (mp_limb_t));
- rp = realloc (rp, sizeof (mp_limb_t));
- ap = bp = realloc (ap, alloc * sizeof (mp_limb_t));
- mpn_random (ap, alloc);
- rp = realloc (rp, alloc * sizeof (mp_limb_t));
- }
- else
- {
- ap = realloc (ap, sizeof (mp_limb_t));
- bp = realloc (bp, sizeof (mp_limb_t));
- rp = realloc (rp, sizeof (mp_limb_t));
- ap = realloc (ap, alloc * sizeof (mp_limb_t));
- mpn_random (ap, alloc);
- bp = realloc (bp, alloc * sizeof (mp_limb_t));
- mpn_random (bp, alloc);
- rp = realloc (rp, alloc * sizeof (mp_limb_t));
- }
- }
-
- t1 = cached_measure (rp, ap, bp, n1, k, n_measurements);
-
- if (t1 * n_measurements > 0.3)
- n_measurements -= 2;
- n_measurements = MAX (n_measurements, MIN_REPS);
-
- if (t1 < t0)
- {
- best_k = k;
- t0 = t1;
- }
- }
-
- n1 = mpn_fft_next_size (prev_n1, best_k);
-
- if (last_best_k != best_k)
- {
- ASSERT_ALWAYS ((prev_n1 & ((1ul << last_best_k) - 1)) == 1);
-
- if (idx >= FFT_TABLE3_SIZE)
- {
- printf ("FFT table exhausted, increase FFT_TABLE3_SIZE in gmp-impl.h\n");
- abort ();
- }
- INSERT_FFTTAB (idx, prev_n1 >> last_best_k, best_k);
-
- if (print)
- {
- printf (", ");
- if (idx % 4 == 0)
- printf ("\\\n ");
- printf ("{%7u,%2u}", fft_tab[idx].n, fft_tab[idx].k);
- }
-
- if (option_trace >= 2)
- {
- printf ("{%lu,%u}\n", prev_n1, best_k);
- fflush (stdout);
- }
-
- last_best_k = best_k;
- idx++;
- }
-
- for (;;)
- {
- prev_n1 = n1;
- prev_eff = fftfill (prev_n1, best_k, p->sqr);
- n1 = mpn_fft_next_size (prev_n1 + 1, best_k);
- eff = fftfill (n1, best_k, p->sqr);
-
- if (eff != prev_eff)
- break;
- }
-
- n = prev_n1;
- }
-
- kmax = sizeof (mp_size_t) * 4; /* GMP_MP_SIZE_T_BITS / 2 */
- kmax = MIN (kmax, 25-1);
- for (k = last_best_k + 1; k <= kmax; k++)
- {
- if (idx >= FFT_TABLE3_SIZE)
- {
- printf ("FFT table exhausted, increase FFT_TABLE3_SIZE in gmp-impl.h\n");
- abort ();
- }
- INSERT_FFTTAB (idx, ((1ul << (2*k-2)) + 1) >> (k-1), k);
-
- if (print)
- {
- printf (", ");
- if (idx % 4 == 0)
- printf ("\\\n ");
- printf ("{%7u,%2u}", fft_tab[idx].n, fft_tab[idx].k);
- }
-
- idx++;
- }
-
- if (print)
- printf (" }\n");
-
- free (ap);
- if (! p->sqr)
- free (bp);
- free (rp);
-
- return idx;
-}
-
void
fft (struct fft_param_t *p)
{
mp_size_t size;
- int k, idx, initial_k;
-
- /*** Generate MUL_FFT_MODF_THRESHOLD / SQR_FFT_MODF_THRESHOLD ***/
+ int i, k;
-#if 1
- {
- /* Use plain one() mechanism, for some reasonable initial values of k. The
- advantage is that we don't depend on mpn_fft_table3, which can therefore
- leave it completely uninitialized. */
+ for (i = 0; i < numberof (mpn_fft_table[p->sqr]); i++)
+ mpn_fft_table[p->sqr][i] = MP_SIZE_T_MAX;
- static struct param_t param;
- mp_size_t thres, best_thres;
- int best_k;
- char buf[20];
+ *p->p_threshold = MP_SIZE_T_MAX;
+ *p->p_modf_threshold = MP_SIZE_T_MAX;
- best_thres = MP_SIZE_T_MAX;
- best_k = -1;
+ option_trace = MAX (option_trace, option_fft_trace);
- for (k = 5; k <= 7; k++)
- {
- param.name = p->modf_threshold_name;
- param.min_size = 100;
- param.max_size = 2000;
- param.function = p->mul_function;
- param.step_factor = 0.0;
- param.step = 4;
- param.function2 = p->mul_modf_function;
- param.noprint = 1;
- s.r = k;
- one (&thres, &param);
- if (thres < best_thres)
- {
- best_thres = thres;
- best_k = k;
- }
- }
+ printf ("#define %s {", p->table_name);
+ if (option_trace >= 2)
+ printf ("\n");
- *(p->p_modf_threshold) = best_thres;
- sprintf (buf, "k = %d", best_k);
- print_define_remark (p->modf_threshold_name, best_thres, buf);
- initial_k = best_k;
- }
-#else
+ k = FFT_FIRST_K;
size = p->first_size;
for (;;)
{
- double tk, tm;
+ double tk, tk1;
- size = mpn_fft_next_size (size+1, mpn_fft_best_k (size+1, p->sqr));
- k = mpn_fft_best_k (size, p->sqr);
+ size = fft_next_size (size+1, k+1);
if (size >= p->max_size)
break;
+ if (k >= FFT_FIRST_K + numberof (mpn_fft_table[p->sqr]))
+ break;
- s.size = size + fft_step_size (k) / 2;
+ /* compare k to k+1 in the middle of the current k+1 step */
+ s.size = size + fft_step_size (k+1) / 2;
s.r = k;
- tk = tuneup_measure (p->mul_modf_function, NULL, &s);
+ tk = tuneup_measure (p->function, NULL, &s);
if (tk == -1.0)
abort ();
- tm = tuneup_measure (p->mul_function, NULL, &s);
- if (tm == -1.0)
+ s.r = k+1;
+ tk1 = tuneup_measure (p->function, NULL, &s);
+ if (tk1 == -1.0)
abort ();
if (option_trace >= 2)
- printf ("at %ld size=%ld k=%d %.9f size=%ld modf %.9f\n",
- (long) size,
- (long) size + fft_step_size (k) / 2, k, tk,
- (long) s.size, tm);
+ printf ("at %ld size=%ld k=%d %.9f k=%d %.9f\n",
+ (long) size, (long) s.size, k, tk, k+1, tk1);
- if (tk < tm)
+ /* declare the k+1 threshold as soon as it's faster at its midpoint */
+ if (tk1 < tk)
{
- *p->p_modf_threshold = s.size;
- print_define (p->modf_threshold_name, *p->p_modf_threshold);
- break;
+ mpn_fft_table[p->sqr][k-FFT_FIRST_K] = s.size;
+ printf (" %ld,", (long) s.size);
+ if (option_trace >= 2) printf ("\n");
+ k++;
}
}
- initial_k = ?;
-#endif
- /*** Generate MUL_FFT_TABLE3 / SQR_FFT_TABLE3 ***/
+ mpn_fft_table[p->sqr][k-FFT_FIRST_K] = 0;
+ printf (" 0 }\n");
- idx = fftmes (*p->p_modf_threshold, p->max_size, initial_k, p, 0, 1);
- printf ("#define %s_SIZE %d\n", p->table_name, idx);
- /*** Generate MUL_FFT_THRESHOLD / SQR_FFT_THRESHOLD ***/
+ size = p->first_size;
- size = 2 * *p->p_modf_threshold; /* OK? */
+ /* Declare an FFT faster than a plain toom4 etc multiplication found as
+ soon as one faster measurement obtained. A multiplication in the
+ middle of the FFT step is tested. */
for (;;)
{
+ int modf = (*p->p_modf_threshold == MP_SIZE_T_MAX);
double tk, tm;
- mp_size_t mulmod_size, mul_size;;
+
+ /* k=7 should be the first FFT which can beat toom4 on a full
+ multiply, so jump to that threshold and save some probing after the
+ modf threshold is found. */
+ if (!modf && size < mpn_fft_table[p->sqr][2])
+ {
+ size = mpn_fft_table[p->sqr][2];
+ if (option_trace >= 2)
+ printf ("jump to size=%ld\n", (long) size);
+ }
+
+ size = fft_next_size (size+1, mpn_fft_best_k (size, p->sqr));
+ k = mpn_fft_best_k (size, p->sqr);
if (size >= p->max_size)
break;
- mulmod_size = mpn_mulmod_bnm1_next_size (2 * (size + 1)) / 2;
- mul_size = (size + mulmod_size) / 2; /* middle of step */
-
- s.size = mulmod_size;
+ s.size = size + fft_step_size (k) / 2;
+ s.r = k;
tk = tuneup_measure (p->function, NULL, &s);
if (tk == -1.0)
abort ();
- s.size = mul_size;
+ if (!modf) s.size /= 2;
tm = tuneup_measure (p->mul_function, NULL, &s);
if (tm == -1.0)
abort ();
if (option_trace >= 2)
- printf ("at %ld size=%ld %.9f size=%ld mul %.9f\n",
+ printf ("at %ld size=%ld k=%d %.9f size=%ld %s mul %.9f\n",
(long) size,
- (long) mulmod_size, tk,
- (long) mul_size, tm);
-
- size = mulmod_size;
+ (long) size + fft_step_size (k) / 2, k, tk,
+ (long) s.size, modf ? "modf" : "full", tm);
if (tk < tm)
{
- *p->p_threshold = s.size;
- print_define (p->threshold_name, *p->p_threshold);
- break;
+ if (modf)
+ {
+ *p->p_modf_threshold = s.size;
+ print_define (p->modf_threshold_name, *p->p_modf_threshold);
+ }
+ else
+ {
+ *p->p_threshold = s.size;
+ print_define (p->threshold_name, *p->p_threshold);
+ break;
+ }
}
}
+
}
@@ -1190,232 +826,58 @@ fft (struct fft_param_t *p)
/* Start karatsuba from 4, since the Cray t90 ieee code is much faster at 2,
giving wrong results. */
void
-tune_mul_n (void)
+tune_mul (void)
{
static struct param_t param;
- mp_size_t next_toom_start;
- int something_changed;
param.function = speed_mpn_mul_n;
- param.name = "MUL_TOOM22_THRESHOLD";
- param.min_size = MAX (4, MPN_TOOM22_MUL_MINSIZE);
- param.max_size = MUL_TOOM22_THRESHOLD_LIMIT-1;
- one (&mul_toom22_threshold, &param);
+ param.name = "MUL_KARATSUBA_THRESHOLD";
+ param.min_size = MAX (4, MPN_KARA_MUL_N_MINSIZE);
+ param.max_size = MUL_KARATSUBA_THRESHOLD_LIMIT-1;
+ one (&mul_karatsuba_threshold, &param);
- param.noprint = 1;
-
- /* Threshold sequence loop. Disable functions that would be used in a very
- narrow range, re-measuring things when that happens. */
- something_changed = 1;
- while (something_changed)
- {
- something_changed = 0;
-
- next_toom_start = mul_toom22_threshold;
-
- if (mul_toom33_threshold != 0)
- {
- param.name = "MUL_TOOM33_THRESHOLD";
- param.min_size = MAX (next_toom_start, MPN_TOOM33_MUL_MINSIZE);
- param.max_size = MUL_TOOM33_THRESHOLD_LIMIT-1;
- one (&mul_toom33_threshold, &param);
-
- if (next_toom_start * 1.05 >= mul_toom33_threshold)
- {
- mul_toom33_threshold = 0;
- something_changed = 1;
- }
- }
-
- next_toom_start = MAX (next_toom_start, mul_toom33_threshold);
-
- if (mul_toom44_threshold != 0)
- {
- param.name = "MUL_TOOM44_THRESHOLD";
- param.min_size = MAX (next_toom_start, MPN_TOOM44_MUL_MINSIZE);
- param.max_size = MUL_TOOM44_THRESHOLD_LIMIT-1;
- one (&mul_toom44_threshold, &param);
-
- if (next_toom_start * 1.05 >= mul_toom44_threshold)
- {
- mul_toom44_threshold = 0;
- something_changed = 1;
- }
- }
-
- next_toom_start = MAX (next_toom_start, mul_toom44_threshold);
-
- if (mul_toom6h_threshold != 0)
- {
- param.name = "MUL_TOOM6H_THRESHOLD";
- param.min_size = MAX (next_toom_start, MPN_TOOM6H_MUL_MINSIZE);
- param.max_size = MUL_TOOM6H_THRESHOLD_LIMIT-1;
- one (&mul_toom6h_threshold, &param);
-
- if (next_toom_start * 1.05 >= mul_toom6h_threshold)
- {
- mul_toom6h_threshold = 0;
- something_changed = 1;
- }
- }
-
- next_toom_start = MAX (next_toom_start, mul_toom6h_threshold);
-
- if (mul_toom8h_threshold != 0)
- {
- param.name = "MUL_TOOM8H_THRESHOLD";
- param.min_size = MAX (next_toom_start, MPN_TOOM8H_MUL_MINSIZE);
- param.max_size = MUL_TOOM8H_THRESHOLD_LIMIT-1;
- one (&mul_toom8h_threshold, &param);
-
- if (next_toom_start * 1.05 >= mul_toom8h_threshold)
- {
- mul_toom8h_threshold = 0;
- something_changed = 1;
- }
- }
- }
+ param.name = "MUL_TOOM3_THRESHOLD";
+ param.min_size = MAX (mul_karatsuba_threshold, MPN_TOOM3_MUL_N_MINSIZE);
+ param.max_size = MUL_TOOM3_THRESHOLD_LIMIT-1;
+ one (&mul_toom3_threshold, &param);
- print_define ("MUL_TOOM33_THRESHOLD", MUL_TOOM33_THRESHOLD);
- print_define ("MUL_TOOM44_THRESHOLD", MUL_TOOM44_THRESHOLD);
- print_define ("MUL_TOOM6H_THRESHOLD", MUL_TOOM6H_THRESHOLD);
- print_define ("MUL_TOOM8H_THRESHOLD", MUL_TOOM8H_THRESHOLD);
+ param.name = "MUL_TOOM44_THRESHOLD";
+ param.min_size = MAX (mul_toom3_threshold, MPN_TOOM44_MUL_N_MINSIZE);
+ param.max_size = MUL_TOOM44_THRESHOLD_LIMIT-1;
+ one (&mul_toom44_threshold, &param);
/* disabled until tuned */
MUL_FFT_THRESHOLD = MP_SIZE_T_MAX;
}
-void
-tune_mul (void)
-{
- static struct param_t param;
- mp_size_t thres;
-
- param.noprint = 1;
-
- param.function = speed_mpn_toom32_for_toom43_mul;
- param.function2 = speed_mpn_toom43_for_toom32_mul;
- param.name = "MUL_TOOM32_TO_TOOM43_THRESHOLD";
- param.min_size = MPN_TOOM43_MUL_MINSIZE * 24 / 17;
- one (&thres, &param);
- mul_toom32_to_toom43_threshold = thres * 17 / 24;
- print_define ("MUL_TOOM32_TO_TOOM43_THRESHOLD", mul_toom32_to_toom43_threshold);
-
- param.function = speed_mpn_toom32_for_toom53_mul;
- param.function2 = speed_mpn_toom53_for_toom32_mul;
- param.name = "MUL_TOOM32_TO_TOOM53_THRESHOLD";
- param.min_size = MPN_TOOM53_MUL_MINSIZE * 30 / 19;
- one (&thres, &param);
- mul_toom32_to_toom53_threshold = thres * 19 / 30;
- print_define ("MUL_TOOM32_TO_TOOM53_THRESHOLD", mul_toom32_to_toom53_threshold);
-
- param.function = speed_mpn_toom42_for_toom53_mul;
- param.function2 = speed_mpn_toom53_for_toom42_mul;
- param.name = "MUL_TOOM42_TO_TOOM53_THRESHOLD";
- param.min_size = MPN_TOOM53_MUL_MINSIZE * 20 / 11;
- one (&thres, &param);
- mul_toom42_to_toom53_threshold = thres * 11 / 20;
- print_define ("MUL_TOOM42_TO_TOOM53_THRESHOLD", mul_toom42_to_toom53_threshold);
-
- param.function = speed_mpn_toom42_mul;
- param.function2 = speed_mpn_toom63_mul;
- param.name = "MUL_TOOM42_TO_TOOM63_THRESHOLD";
- param.min_size = MPN_TOOM63_MUL_MINSIZE * 2;
- one (&thres, &param);
- mul_toom42_to_toom63_threshold = thres / 2;
- print_define ("MUL_TOOM42_TO_TOOM63_THRESHOLD", mul_toom42_to_toom63_threshold);
-
- /* Use ratio 5/6 when measuring, the middle of the range 2/3 to 1. */
- param.function = speed_mpn_toom43_for_toom54_mul;
- param.function2 = speed_mpn_toom54_for_toom43_mul;
- param.name = "MUL_TOOM43_TO_TOOM54_THRESHOLD";
- param.min_size = MPN_TOOM54_MUL_MINSIZE * 6 / 5;
- one (&thres, &param);
- mul_toom43_to_toom54_threshold = thres * 5 / 6;
- print_define ("MUL_TOOM43_TO_TOOM54_THRESHOLD", mul_toom43_to_toom54_threshold);
-}
-
+/* This was written by the tuneup challenged tege. Kevin, please delete
+ this comment when you've reviewed/rewritten this. :-) */
void
-tune_mullo (void)
+tune_mullow (void)
{
static struct param_t param;
- param.function = speed_mpn_mullo_n;
+ param.function = speed_mpn_mullow_n;
- param.name = "MULLO_BASECASE_THRESHOLD";
- param.min_size = 1;
+ param.name = "MULLOW_BASECASE_THRESHOLD";
+ param.min_size = 3;
param.min_is_always = 1;
- param.max_size = MULLO_BASECASE_THRESHOLD_LIMIT-1;
- param.stop_factor = 1.5;
- param.noprint = 1;
- one (&mullo_basecase_threshold, &param);
-
- param.name = "MULLO_DC_THRESHOLD";
- param.min_size = 8;
- param.min_is_always = 0;
- param.max_size = 1000;
- one (&mullo_dc_threshold, &param);
+ param.max_size = MULLOW_BASECASE_THRESHOLD_LIMIT-1;
+ one (&mullow_basecase_threshold, &param);
- if (mullo_basecase_threshold >= mullo_dc_threshold)
- {
- print_define ("MULLO_BASECASE_THRESHOLD", mullo_dc_threshold);
- print_define_remark ("MULLO_DC_THRESHOLD", 0, "never mpn_mullo_basecase");
- }
- else
- {
- print_define ("MULLO_BASECASE_THRESHOLD", mullo_basecase_threshold);
- print_define ("MULLO_DC_THRESHOLD", mullo_dc_threshold);
- }
-
-#if WANT_FFT
- param.name = "MULLO_MUL_N_THRESHOLD";
- param.min_size = mullo_dc_threshold;
- param.max_size = 2 * mul_fft_threshold;
- param.noprint = 0;
- param.step_factor = 0.03;
- one (&mullo_mul_n_threshold, &param);
-#else
- print_define_remark ("MULLO_MUL_N_THRESHOLD", MP_SIZE_T_MAX,
- "without FFT use mullo forever");
-#endif
-}
-
-void
-tune_mulmid (void)
-{
- static struct param_t param;
+ param.min_is_always = 0; /* ??? */
- param.name = "MULMID_TOOM42_THRESHOLD";
- param.function = speed_mpn_mulmid_n;
- param.min_size = 4;
- param.max_size = 100;
- one (&mulmid_toom42_threshold, &param);
-}
-
-void
-tune_mulmod_bnm1 (void)
-{
- static struct param_t param;
-
- param.name = "MULMOD_BNM1_THRESHOLD";
- param.function = speed_mpn_mulmod_bnm1;
- param.min_size = 4;
- param.max_size = 100;
- one (&mulmod_bnm1_threshold, &param);
-}
-
-void
-tune_sqrmod_bnm1 (void)
-{
- static struct param_t param;
+ param.name = "MULLOW_DC_THRESHOLD";
+ param.min_size = mul_karatsuba_threshold;
+ param.max_size = 1000;
+ one (&mullow_dc_threshold, &param);
- param.name = "SQRMOD_BNM1_THRESHOLD";
- param.function = speed_mpn_sqrmod_bnm1;
- param.min_size = 4;
- param.max_size = 100;
- one (&sqrmod_bnm1_threshold, &param);
+ param.name = "MULLOW_MUL_N_THRESHOLD";
+ param.min_size = mullow_dc_threshold;
+ param.max_size = 2000;
+ one (&mullow_mul_n_threshold, &param);
}
@@ -1438,345 +900,130 @@ tune_sqr (void)
{
static struct param_t param;
param.name = "SQR_BASECASE_THRESHOLD";
- param.function = speed_mpn_sqr;
+ param.function = speed_mpn_sqr_n;
param.min_size = 3;
param.min_is_always = 1;
- param.max_size = TUNE_SQR_TOOM2_MAX;
+ param.max_size = TUNE_SQR_KARATSUBA_MAX;
param.noprint = 1;
one (&sqr_basecase_threshold, &param);
}
{
static struct param_t param;
- param.name = "SQR_TOOM2_THRESHOLD";
- param.function = speed_mpn_sqr;
- param.min_size = MAX (4, MPN_TOOM2_SQR_MINSIZE);
- param.max_size = TUNE_SQR_TOOM2_MAX;
+ param.name = "SQR_KARATSUBA_THRESHOLD";
+ param.function = speed_mpn_sqr_n;
+ param.min_size = MAX (4, MPN_KARA_SQR_N_MINSIZE);
+ param.max_size = TUNE_SQR_KARATSUBA_MAX;
param.noprint = 1;
- one (&sqr_toom2_threshold, &param);
+ one (&sqr_karatsuba_threshold, &param);
if (! HAVE_NATIVE_mpn_sqr_basecase
- && sqr_toom2_threshold < sqr_basecase_threshold)
+ && sqr_karatsuba_threshold < sqr_basecase_threshold)
{
/* Karatsuba becomes faster than mul_basecase before
sqr_basecase does. Arrange for the expression
- "BELOW_THRESHOLD (un, SQR_TOOM2_THRESHOLD))" which
- selects mpn_sqr_basecase in mpn_sqr to be false, by setting
- SQR_TOOM2_THRESHOLD to zero, making
- SQR_BASECASE_THRESHOLD the toom2 threshold. */
+ "BELOW_THRESHOLD (un, SQR_KARATSUBA_THRESHOLD))" which
+ selects mpn_sqr_basecase in mpn_sqr_n to be false, by setting
+ SQR_KARATSUBA_THRESHOLD to zero, making
+ SQR_BASECASE_THRESHOLD the karatsuba threshold. */
- sqr_basecase_threshold = SQR_TOOM2_THRESHOLD;
- SQR_TOOM2_THRESHOLD = 0;
+ sqr_basecase_threshold = SQR_KARATSUBA_THRESHOLD;
+ SQR_KARATSUBA_THRESHOLD = 0;
print_define_remark ("SQR_BASECASE_THRESHOLD", sqr_basecase_threshold,
- "toom2");
- print_define_remark ("SQR_TOOM2_THRESHOLD",SQR_TOOM2_THRESHOLD,
+ "karatsuba");
+ print_define_remark ("SQR_KARATSUBA_THRESHOLD",SQR_KARATSUBA_THRESHOLD,
"never sqr_basecase");
}
else
{
if (! HAVE_NATIVE_mpn_sqr_basecase)
print_define ("SQR_BASECASE_THRESHOLD", sqr_basecase_threshold);
- print_define ("SQR_TOOM2_THRESHOLD", SQR_TOOM2_THRESHOLD);
+ print_define ("SQR_KARATSUBA_THRESHOLD", SQR_KARATSUBA_THRESHOLD);
}
}
{
static struct param_t param;
- mp_size_t next_toom_start;
- int something_changed;
+ mp_size_t toom3_start = MAX (sqr_karatsuba_threshold, sqr_basecase_threshold);
- param.function = speed_mpn_sqr;
- param.noprint = 1;
+ param.function = speed_mpn_sqr_n;
- /* Threshold sequence loop. Disable functions that would be used in a very
- narrow range, re-measuring things when that happens. */
- something_changed = 1;
- while (something_changed)
- {
- something_changed = 0;
-
- next_toom_start = MAX (sqr_toom2_threshold, sqr_basecase_threshold);
-
- sqr_toom3_threshold = SQR_TOOM3_THRESHOLD_LIMIT;
- param.name = "SQR_TOOM3_THRESHOLD";
- param.min_size = MAX (next_toom_start, MPN_TOOM3_SQR_MINSIZE);
- param.max_size = SQR_TOOM3_THRESHOLD_LIMIT-1;
- one (&sqr_toom3_threshold, &param);
-
- next_toom_start = MAX (next_toom_start, sqr_toom3_threshold);
-
- if (sqr_toom4_threshold != 0)
- {
- param.name = "SQR_TOOM4_THRESHOLD";
- sqr_toom4_threshold = SQR_TOOM4_THRESHOLD_LIMIT;
- param.min_size = MAX (next_toom_start, MPN_TOOM4_SQR_MINSIZE);
- param.max_size = SQR_TOOM4_THRESHOLD_LIMIT-1;
- one (&sqr_toom4_threshold, &param);
-
- if (next_toom_start * 1.05 >= sqr_toom4_threshold)
- {
- sqr_toom4_threshold = 0;
- something_changed = 1;
- }
- }
-
- next_toom_start = MAX (next_toom_start, sqr_toom4_threshold);
-
- if (sqr_toom6_threshold != 0)
- {
- param.name = "SQR_TOOM6_THRESHOLD";
- sqr_toom6_threshold = SQR_TOOM6_THRESHOLD_LIMIT;
- param.min_size = MAX (next_toom_start, MPN_TOOM6_SQR_MINSIZE);
- param.max_size = SQR_TOOM6_THRESHOLD_LIMIT-1;
- one (&sqr_toom6_threshold, &param);
-
- if (next_toom_start * 1.05 >= sqr_toom6_threshold)
- {
- sqr_toom6_threshold = 0;
- something_changed = 1;
- }
- }
-
- next_toom_start = MAX (next_toom_start, sqr_toom6_threshold);
-
- if (sqr_toom8_threshold != 0)
- {
- param.name = "SQR_TOOM8_THRESHOLD";
- sqr_toom8_threshold = SQR_TOOM8_THRESHOLD_LIMIT;
- param.min_size = MAX (next_toom_start, MPN_TOOM8_SQR_MINSIZE);
- param.max_size = SQR_TOOM8_THRESHOLD_LIMIT-1;
- one (&sqr_toom8_threshold, &param);
-
- if (next_toom_start * 1.05 >= sqr_toom8_threshold)
- {
- sqr_toom8_threshold = 0;
- something_changed = 1;
- }
- }
- }
+ param.name = "SQR_TOOM3_THRESHOLD";
+ param.min_size = MAX (toom3_start, MPN_TOOM3_SQR_N_MINSIZE);
+ param.max_size = SQR_TOOM3_THRESHOLD_LIMIT-1;
+ one (&sqr_toom3_threshold, &param);
- print_define ("SQR_TOOM3_THRESHOLD", SQR_TOOM3_THRESHOLD);
- print_define ("SQR_TOOM4_THRESHOLD", SQR_TOOM4_THRESHOLD);
- print_define ("SQR_TOOM6_THRESHOLD", SQR_TOOM6_THRESHOLD);
- print_define ("SQR_TOOM8_THRESHOLD", SQR_TOOM8_THRESHOLD);
+ param.name = "SQR_TOOM4_THRESHOLD";
+ param.min_size = MAX (sqr_toom3_threshold, MPN_TOOM4_SQR_N_MINSIZE);
+ param.max_size = SQR_TOOM4_THRESHOLD_LIMIT-1;
+ one (&sqr_toom4_threshold, &param);
}
}
void
-tune_dc_div (void)
+tune_sb_preinv (void)
{
- s.r = 0; /* clear to make speed function do 2n/n */
- {
- static struct param_t param;
- param.name = "DC_DIV_QR_THRESHOLD";
- param.function = speed_mpn_sbpi1_div_qr;
- param.function2 = speed_mpn_dcpi1_div_qr;
- param.min_size = 6;
- one (&dc_div_qr_threshold, &param);
- }
- {
- static struct param_t param;
- param.name = "DC_DIVAPPR_Q_THRESHOLD";
- param.function = speed_mpn_sbpi1_divappr_q;
- param.function2 = speed_mpn_dcpi1_divappr_q;
- param.min_size = 6;
- one (&dc_divappr_q_threshold, &param);
- }
-}
+ static struct param_t param;
-static double
-speed_mpn_sbordcpi1_div_qr (struct speed_params *s)
-{
- if (s->size < DC_DIV_QR_THRESHOLD)
- return speed_mpn_sbpi1_div_qr (s);
- else
- return speed_mpn_dcpi1_div_qr (s);
-}
+ if (GMP_NAIL_BITS != 0)
+ {
+ DIV_SB_PREINV_THRESHOLD = MP_SIZE_T_MAX;
+ print_define_remark ("DIV_SB_PREINV_THRESHOLD", MP_SIZE_T_MAX,
+ "no preinv with nails");
+ return;
+ }
-void
-tune_mu_div (void)
-{
- s.r = 0; /* clear to make speed function do 2n/n */
- {
- static struct param_t param;
- param.name = "MU_DIV_QR_THRESHOLD";
- param.function = speed_mpn_dcpi1_div_qr;
- param.function2 = speed_mpn_mu_div_qr;
- param.min_size = mul_toom22_threshold;
- param.max_size = 5000;
- param.step_factor = 0.02;
- one (&mu_div_qr_threshold, &param);
- }
- {
- static struct param_t param;
- param.name = "MU_DIVAPPR_Q_THRESHOLD";
- param.function = speed_mpn_dcpi1_divappr_q;
- param.function2 = speed_mpn_mu_divappr_q;
- param.min_size = mul_toom22_threshold;
- param.max_size = 5000;
- param.step_factor = 0.02;
- one (&mu_divappr_q_threshold, &param);
- }
- {
- static struct param_t param;
- param.name = "MUPI_DIV_QR_THRESHOLD";
- param.function = speed_mpn_sbordcpi1_div_qr;
- param.function2 = speed_mpn_mupi_div_qr;
- param.min_size = 6;
- param.min_is_always = 1;
- param.max_size = 1000;
- param.step_factor = 0.02;
- one (&mupi_div_qr_threshold, &param);
- }
-}
+ if (UDIV_PREINV_ALWAYS)
+ {
+ print_define_remark ("DIV_SB_PREINV_THRESHOLD", 0L, "preinv always");
+ return;
+ }
-void
-tune_dc_bdiv (void)
-{
- s.r = 0; /* clear to make speed function do 2n/n*/
- {
- static struct param_t param;
- param.name = "DC_BDIV_QR_THRESHOLD";
- param.function = speed_mpn_sbpi1_bdiv_qr;
- param.function2 = speed_mpn_dcpi1_bdiv_qr;
- param.min_size = 4;
- one (&dc_bdiv_qr_threshold, &param);
- }
- {
- static struct param_t param;
- param.name = "DC_BDIV_Q_THRESHOLD";
- param.function = speed_mpn_sbpi1_bdiv_q;
- param.function2 = speed_mpn_dcpi1_bdiv_q;
- param.min_size = 4;
- one (&dc_bdiv_q_threshold, &param);
- }
+ param.check_size = 256;
+ param.min_size = 3;
+ param.min_is_always = 1;
+ param.size_extra = 3;
+ param.stop_factor = 2.0;
+ param.name = "DIV_SB_PREINV_THRESHOLD";
+ param.function = speed_mpn_sb_divrem_m3;
+ one (&div_sb_preinv_threshold, &param);
}
-void
-tune_mu_bdiv (void)
-{
- s.r = 0; /* clear to make speed function do 2n/n*/
- {
- static struct param_t param;
- param.name = "MU_BDIV_QR_THRESHOLD";
- param.function = speed_mpn_dcpi1_bdiv_qr;
- param.function2 = speed_mpn_mu_bdiv_qr;
- param.min_size = mul_toom22_threshold;
- param.max_size = 5000;
- param.step_factor = 0.02;
- one (&mu_bdiv_qr_threshold, &param);
- }
- {
- static struct param_t param;
- param.name = "MU_BDIV_Q_THRESHOLD";
- param.function = speed_mpn_dcpi1_bdiv_q;
- param.function2 = speed_mpn_mu_bdiv_q;
- param.min_size = mul_toom22_threshold;
- param.max_size = 5000;
- param.step_factor = 0.02;
- one (&mu_bdiv_q_threshold, &param);
- }
-}
void
-tune_invertappr (void)
+tune_dc (void)
{
static struct param_t param;
-
- param.function = speed_mpn_ni_invertappr;
- param.name = "INV_MULMOD_BNM1_THRESHOLD";
- param.min_size = 4;
- one (&inv_mulmod_bnm1_threshold, &param);
-
- param.function = speed_mpn_invertappr;
- param.name = "INV_NEWTON_THRESHOLD";
- param.min_size = 3;
- one (&inv_newton_threshold, &param);
+ param.name = "DIV_DC_THRESHOLD";
+ param.function = speed_mpn_dc_tdiv_qr;
+ param.step_factor = 0.02;
+ one (&div_dc_threshold, &param);
}
-void
-tune_invert (void)
-{
- static struct param_t param;
- param.function = speed_mpn_invert;
- param.name = "INV_APPR_THRESHOLD";
- param.min_size = 3;
- one (&inv_appr_threshold, &param);
-}
+/* This is an indirect determination, based on a comparison between redc and
+ mpz_mod. A fudge factor of 1.04 is applied to redc, to represent
+ additional overheads it gets in mpz_powm.
+
+ stop_factor is 1.1 to hopefully help cray vector systems, where otherwise
+ currently it hits the 1000 limb limit with only a factor of about 1.18
+ (threshold should be around 650). */
void
-tune_binvert (void)
+tune_powm (void)
{
static struct param_t param;
-
- param.function = speed_mpn_binvert;
- param.name = "BINV_NEWTON_THRESHOLD";
- param.min_size = 8; /* pointless with smaller operands */
- one (&binv_newton_threshold, &param);
+ param.name = "POWM_THRESHOLD";
+ param.function = speed_mpn_redc_1;
+ param.function2 = speed_mpz_mod;
+ param.step_factor = 0.03;
+ param.stop_factor = 1.1;
+ param.function_fudge = 1.04;
+ one (&powm_threshold, &param);
}
-void
-tune_redc (void)
-{
-#define TUNE_REDC_2_MAX 100
-#if HAVE_NATIVE_mpn_addmul_2 || HAVE_NATIVE_mpn_redc_2
-#define WANT_REDC_2 1
-#endif
-
-#if WANT_REDC_2
- {
- static struct param_t param;
- param.name = "REDC_1_TO_REDC_2_THRESHOLD";
- param.function = speed_mpn_redc_1;
- param.function2 = speed_mpn_redc_2;
- param.min_size = 1;
- param.min_is_always = 1;
- param.max_size = TUNE_REDC_2_MAX;
- param.noprint = 1;
- param.stop_factor = 1.5;
- one (&redc_1_to_redc_2_threshold, &param);
- }
- {
- static struct param_t param;
- param.name = "REDC_2_TO_REDC_N_THRESHOLD";
- param.function = speed_mpn_redc_2;
- param.function2 = speed_mpn_redc_n;
- param.min_size = 16;
- param.noprint = 1;
- one (&redc_2_to_redc_n_threshold, &param);
- }
- if (redc_1_to_redc_2_threshold >= redc_2_to_redc_n_threshold)
- {
- redc_2_to_redc_n_threshold = 0; /* disable redc_2 */
-
- /* Never use redc2, measure redc_1 -> redc_n cutoff, store result as
- REDC_1_TO_REDC_2_THRESHOLD. */
- {
- static struct param_t param;
- param.name = "REDC_1_TO_REDC_2_THRESHOLD";
- param.function = speed_mpn_redc_1;
- param.function2 = speed_mpn_redc_n;
- param.min_size = 16;
- param.noprint = 1;
- one (&redc_1_to_redc_2_threshold, &param);
- }
- }
- print_define ("REDC_1_TO_REDC_2_THRESHOLD", REDC_1_TO_REDC_2_THRESHOLD);
- print_define ("REDC_2_TO_REDC_N_THRESHOLD", REDC_2_TO_REDC_N_THRESHOLD);
-#else
- {
- static struct param_t param;
- param.name = "REDC_1_TO_REDC_N_THRESHOLD";
- param.function = speed_mpn_redc_1;
- param.function2 = speed_mpn_redc_n;
- param.min_size = 16;
- one (&redc_1_to_redc_n_threshold, &param);
- }
-#endif
-}
void
tune_matrix22_mul (void)
@@ -1799,30 +1046,17 @@ tune_hgcd (void)
one (&hgcd_threshold, &param);
}
+#if 0
void
-tune_hgcd_appr (void)
-{
- static struct param_t param;
- param.name = "HGCD_APPR_THRESHOLD";
- param.function = speed_mpn_hgcd_appr;
- /* We seem to get strange results for small sizes */
- param.min_size = 50;
- param.stop_since_change = 150;
- one (&hgcd_appr_threshold, &param);
-}
-
-void
-tune_hgcd_reduce (void)
+tune_gcd_accel (void)
{
static struct param_t param;
- param.name = "HGCD_REDUCE_THRESHOLD";
- param.function = speed_mpn_hgcd_reduce;
- param.min_size = 30;
- param.max_size = 7000;
- param.step_factor = 0.04;
- one (&hgcd_reduce_threshold, &param);
+ param.name = "GCD_ACCEL_THRESHOLD";
+ param.function = speed_mpn_gcd;
+ param.min_size = 1;
+ one (&gcd_accel_threshold, &param);
}
-
+#endif
void
tune_gcd_dc (void)
{
@@ -1847,139 +1081,6 @@ tune_gcdext_dc (void)
one (&gcdext_dc_threshold, &param);
}
-/* 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 granularity
- of full limbs.
-*/
-
-/* This win_size replaces the variant in the powm code, allowing us to
- control k in the k-ary algorithms. */
-int winsize;
-int
-win_size (mp_bitcnt_t eb)
-{
- return winsize;
-}
-
-void
-tune_powm_sec (void)
-{
- mp_size_t n;
- int k, i;
- mp_size_t itch;
- mp_bitcnt_t nbits, nbits_next, possible_nbits_cutoff;
- const int n_max = 3000 / GMP_NUMB_BITS;
- const int n_measurements = 5;
- mp_ptr rp, bp, ep, mp, tp;
- double ttab[n_measurements], tk, tkp1;
- TMP_DECL;
- TMP_MARK;
-
- possible_nbits_cutoff = 0;
-
- k = 1;
-
- winsize = 10; /* the itch function needs this */
- 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);
- ep = TMP_ALLOC_LIMBS (n_max);
- mp = TMP_ALLOC_LIMBS (n_max);
- tp = TMP_ALLOC_LIMBS (itch);
-
- mpn_random (bp, n_max);
- mpn_random (mp, n_max);
- mp[0] |= 1;
-
-/* How about taking the M operand size into account?
-
- An operation R=powm(B,E,N) will take time O(log(E)*M(log(N))) (assuming
- B = O(M)).
-
- Using k-ary and no sliding window, the precomputation will need time
- O(2^(k-1)*M(log(N))) and the main computation will need O(log(E)*S(N)) +
- O(log(E)/k*M(N)), for the squarings, multiplications, respectively.
-
- An operation R=powm_sec(B,E,N) will take time like powm.
-
- Using k-ary, the precomputation will need time O(2^k*M(log(N))) and the
- main computation will need O(log(E)*S(N)) + O(log(E)/k*M(N)) +
- O(log(E)/k*2^k*log(N)), for the squarings, multiplications, and full
- table reads, respectively. */
-
- printf ("#define POWM_SEC_TABLE ");
-
- /* 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;
-
- /* Generate E such that sliding-window for k and k+1 works equally
- well/poorly (but sliding is not used in powm_sec, of course). */
- for (i = 0; i < n; i++)
- ep[i] = ~CNST_LIMB(0);
-
- winsize = k;
- for (i = 0; i < n_measurements; i++)
- {
- speed_starttime ();
- mpn_sec_powm (rp, bp, n, ep, nbits, mp, n, tp);
- ttab[i] = speed_endtime ();
- }
- tk = median (ttab, n_measurements);
-
- winsize = k + 1;
- speed_starttime ();
- for (i = 0; i < n_measurements; i++)
- {
- speed_starttime ();
- mpn_sec_powm (rp, bp, n, ep, nbits, mp, n, tp);
- ttab[i] = speed_endtime ();
- }
- tkp1 = median (ttab, n_measurements);
-/*
- printf ("testing: %ld, %d", nbits, k, ep[n-1]);
- printf (" %10.5f %10.5f\n", tk, tkp1);
-*/
- if (tkp1 < tk)
- {
- 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);
- k++;
- possible_nbits_cutoff = 0;
- }
- else
- {
- /* One measurement indicate k increase, save nbits for further
- consideration. */
- /* 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
- possible_nbits_cutoff = 0;
-
- nbits_next = nbits * 65 / 64;
- nbits = nbits_next + (nbits_next == nbits);
- }
- printf ("\n");
- TMP_FREE;
-}
-
/* size_extra==1 reflects the fact that with high<divisor one division is
always skipped. Forcing high<divisor while testing ensures consistency
@@ -1999,7 +1100,7 @@ tune_powm_sec (void)
param.stop_factor = 2.0;
-double (*tuned_speed_mpn_divrem_1) (struct speed_params *);
+double (*tuned_speed_mpn_divrem_1) __GMP_PROTO ((struct speed_params *));
void
tune_divrem_1 (void)
@@ -2052,59 +1153,15 @@ 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);
- }
-}
+double (*tuned_speed_mpn_mod_1) __GMP_PROTO ((struct speed_params *));
void
tune_mod_1 (void)
{
+ /* plain version by default */
+ tuned_speed_mpn_mod_1 = speed_mpn_mod_1;
+
/* No support for tuning native assembler code, do that by hand and put
the results in the .asm file, there's no need for such thresholds to
appear in gmp-mparam.h. */
@@ -2120,27 +1177,6 @@ tune_mod_1 (void)
return;
}
- if (!HAVE_NATIVE_mpn_mod_1_1p)
- {
- static struct param_t param;
- double t1, t2;
-
- s.size = 10;
- s.r = randlimb_half ();
-
- t1 = tuneup_measure (speed_mpn_mod_1_1_1, &param, &s);
- t2 = tuneup_measure (speed_mpn_mod_1_1_2, &param, &s);
-
- if (t1 == -1.0 || t2 == -1.0)
- {
- printf ("Oops, can't measure all mpn_mod_1_1 methods at %ld\n",
- (long) s.size);
- abort ();
- }
- mod_1_1p_method = (t1 < t2) ? 1 : 2;
- print_define ("MOD_1_1P_METHOD", mod_1_1p_method);
- }
-
if (UDIV_PREINV_ALWAYS)
{
print_define ("MOD_1_NORM_THRESHOLD", 0L);
@@ -2148,6 +1184,8 @@ tune_mod_1 (void)
}
else
{
+ tuned_speed_mpn_mod_1 = speed_mpn_mod_1_tune;
+
{
static struct param_t param;
param.name = "MOD_1_NORM_THRESHOLD";
@@ -2168,80 +1206,26 @@ tune_mod_1 (void)
{
static struct param_t param;
- param.check_size = 256;
-
- s.r = randlimb_norm ();
+ s.r = GMP_NUMB_MASK / 5;
param.function = speed_mpn_mod_1_tune;
-
- param.name = "MOD_1N_TO_MOD_1_1_THRESHOLD";
- param.min_size = 2;
- one (&mod_1n_to_mod_1_1_threshold, &param);
- }
-
- {
- static struct param_t param;
-
- param.check_size = 256;
- s.r = randlimb_half ();
- param.noprint = 1;
-
- param.function = speed_mpn_mod_1_1;
- param.function2 = speed_mpn_mod_1_2;
- param.min_is_always = 1;
- param.name = "MOD_1_1_TO_MOD_1_2_THRESHOLD";
- param.min_size = 2;
- one (&mod_1_1_to_mod_1_2_threshold, &param);
-
- param.function = speed_mpn_mod_1_2;
- param.function2 = speed_mpn_mod_1_4;
- param.min_is_always = 1;
- param.name = "MOD_1_2_TO_MOD_1_4_THRESHOLD";
param.min_size = 1;
- one (&mod_1_2_to_mod_1_4_threshold, &param);
- if (mod_1_1_to_mod_1_2_threshold >= mod_1_2_to_mod_1_4_threshold)
- {
- /* Never use mod_1_2, measure mod_1_1 -> mod_1_4 */
- mod_1_2_to_mod_1_4_threshold = 0;
-
- param.function = speed_mpn_mod_1_1;
- param.function2 = speed_mpn_mod_1_4;
- param.min_is_always = 1;
- param.name = "MOD_1_1_TO_MOD_1_4_THRESHOLD fake";
- param.min_size = 2;
- one (&mod_1_1_to_mod_1_2_threshold, &param);
- }
+ param.name = "MOD_1_1_THRESHOLD";
+ one (&mod_1_1_threshold, &param);
- param.function = speed_mpn_mod_1_tune;
- param.function2 = NULL;
- param.name = "MOD_1U_TO_MOD_1_1_THRESHOLD";
- param.min_size = 2;
- param.min_is_always = 0;
- one (&mod_1u_to_mod_1_1_threshold, &param);
-
- if (mod_1u_to_mod_1_1_threshold >= mod_1_1_to_mod_1_2_threshold)
- mod_1_1_to_mod_1_2_threshold = 0;
- if (mod_1u_to_mod_1_1_threshold >= mod_1_2_to_mod_1_4_threshold)
- mod_1_2_to_mod_1_4_threshold = 0;
-
- print_define_remark ("MOD_1U_TO_MOD_1_1_THRESHOLD", mod_1u_to_mod_1_1_threshold, NULL);
- print_define_remark ("MOD_1_1_TO_MOD_1_2_THRESHOLD", mod_1_1_to_mod_1_2_threshold,
- mod_1_1_to_mod_1_2_threshold == 0 ? "never mpn_mod_1_1p" : NULL);
- print_define_remark ("MOD_1_2_TO_MOD_1_4_THRESHOLD", mod_1_2_to_mod_1_4_threshold,
- mod_1_2_to_mod_1_4_threshold == 0 ? "never mpn_mod_1s_2p" : NULL);
- }
+ param.name = "MOD_1_2_THRESHOLD";
+ param.min_size = mod_1_1_threshold + 1;
+ one (&mod_1_2_threshold, &param);
- {
- static struct param_t param;
-
- param.check_size = 256;
+#if 0
+ param.name = "MOD_1_3_THRESHOLD";
+ param.min_size = mod_1_2_threshold + 1;
+ one (&mod_1_3_threshold, &param);
+#endif
- param.name = "PREINV_MOD_1_TO_MOD_1_THRESHOLD";
- s.r = randlimb_norm ();
- param.function = speed_mpn_preinv_mod_1;
- param.function2 = speed_mpn_mod_1_tune;
- param.min_size = 1;
- one (&preinv_mod_1_to_mod_1_threshold, &param);
+ param.name = "MOD_1_4_THRESHOLD";
+ param.min_size = mod_1_2_threshold + 1;
+ one (&mod_1_4_threshold, &param);
}
}
@@ -2318,6 +1302,72 @@ tune_preinv_divrem_1 (void)
}
+/* A non-zero MOD_1_UNNORM_THRESHOLD (or MOD_1_NORM_THRESHOLD) would imply
+ that udiv_qrnnd_preinv is worth using, but it seems most straightforward
+ to compare mpn_preinv_mod_1 and mpn_mod_1_div directly. */
+
+void
+tune_preinv_mod_1 (void)
+{
+ static struct param_t param;
+ speed_function_t mod_1;
+ const char *mod_1_name;
+ double t1, t2;
+
+ /* Any native version of mpn_preinv_mod_1 is assumed to exist because it's
+ faster than mpn_mod_1. */
+ if (HAVE_NATIVE_mpn_preinv_mod_1)
+ {
+ print_define_remark ("USE_PREINV_MOD_1", 1, "native");
+ return;
+ }
+
+ if (GMP_NAIL_BITS != 0)
+ {
+ print_define_remark ("USE_PREINV_MOD_1", 0, "no preinv with nails");
+ return;
+ }
+
+ /* If udiv_qrnnd_preinv is the only division method then of course
+ mpn_preinv_mod_1 should be used. */
+ if (UDIV_PREINV_ALWAYS)
+ {
+ print_define_remark ("USE_PREINV_MOD_1", 1, "preinv always");
+ return;
+ }
+
+ /* If we've got an assembler version of mpn_mod_1, then compare against
+ that, not the mpn_mod_1_div generic C. */
+ if (HAVE_NATIVE_mpn_mod_1)
+ {
+ mod_1 = speed_mpn_mod_1;
+ mod_1_name = "mpn_mod_1";
+ }
+ else
+ {
+ mod_1 = speed_mpn_mod_1_div;
+ mod_1_name = "mpn_mod_1_div";
+ }
+
+ param.data_high = DATA_HIGH_LT_R; /* let mpn_mod_1 skip one division */
+ s.size = 200; /* generous but not too big */
+ s.r = randlimb_norm(); /* divisor */
+
+ t1 = tuneup_measure (speed_mpn_preinv_mod_1, &param, &s);
+ t2 = tuneup_measure (mod_1, &param, &s);
+ if (t1 == -1.0 || t2 == -1.0)
+ {
+ printf ("Oops, can't measure mpn_preinv_mod_1 and %s at %ld\n",
+ mod_1_name, (long) s.size);
+ abort ();
+ }
+ if (option_trace >= 1)
+ printf ("size=%ld, mpn_preinv_mod_1 %.9f, %s %.9f\n",
+ (long) s.size, t1, mod_1_name, t2);
+
+ print_define_remark ("USE_PREINV_MOD_1", (mp_size_t) (t1 < t2), NULL);
+}
+
void
tune_divrem_2 (void)
@@ -2361,16 +1411,6 @@ tune_divrem_2 (void)
one (&divrem_2_threshold, &param);
}
-void
-tune_div_qr_2 (void)
-{
- static struct param_t param;
- param.name = "DIV_QR_2_PI2_THRESHOLD";
- param.function = speed_mpn_div_qr_2n;
- param.check_size = 500;
- param.min_size = 4;
- one (&div_qr_2_pi2_threshold, &param);
-}
/* mpn_divexact_1 is vaguely expected to be used on smallish divisors, so
tune for that. Its speed can differ on odd or even divisor, so take an
@@ -2464,22 +1504,22 @@ tune_modexact_1_odd (void)
static struct param_t param;
mp_size_t thresh_lt, thresh_ge, average;
-#if 0
/* Any native mpn_modexact_1_odd is assumed to incorporate all the speed
of a full mpn_mod_1. */
if (HAVE_NATIVE_mpn_modexact_1_odd)
{
- print_define_remark ("BMOD_1_TO_MOD_1_THRESHOLD", MP_SIZE_T_MAX, "always bmod_1");
+ print_define_remark ("MODEXACT_1_ODD_THRESHOLD", 0, "always (native)");
return;
}
-#endif
- param.name = "BMOD_1_TO_MOD_1_THRESHOLD";
+ ASSERT_ALWAYS (tuned_speed_mpn_mod_1 != NULL);
+
+ param.name = "MODEXACT_1_ODD_THRESHOLD";
param.check_size = 256;
param.min_size = 2;
param.stop_factor = 1.5;
- param.function = speed_mpn_modexact_1c_odd;
- param.function2 = speed_mpn_mod_1_tune;
+ param.function = tuned_speed_mpn_mod_1;
+ param.function2 = speed_mpn_modexact_1c_odd;
param.noprint = 1;
s.r = randlimb_half () | 1;
@@ -2514,10 +1554,10 @@ void
tune_jacobi_base (void)
{
static struct param_t param;
- double t1, t2, t3, t4;
+ double t1, t2, t3;
int method;
- s.size = GMP_LIMB_BITS * 3 / 4;
+ s.size = BITS_PER_MP_LIMB * 3 / 4;
t1 = tuneup_measure (speed_mpn_jacobi_base_1, &param, &s);
if (option_trace >= 1)
@@ -2531,25 +1571,19 @@ tune_jacobi_base (void)
if (option_trace >= 1)
printf ("size=%ld, mpn_jacobi_base_3 %.9f\n", (long) s.size, t3);
- t4 = tuneup_measure (speed_mpn_jacobi_base_4, &param, &s);
- if (option_trace >= 1)
- printf ("size=%ld, mpn_jacobi_base_4 %.9f\n", (long) s.size, t4);
-
- if (t1 == -1.0 || t2 == -1.0 || t3 == -1.0 || t4 == -1.0)
+ if (t1 == -1.0 || t2 == -1.0 || t3 == -1.0)
{
printf ("Oops, can't measure all mpn_jacobi_base methods at %ld\n",
(long) s.size);
abort ();
}
- if (t1 < t2 && t1 < t3 && t1 < t4)
+ if (t1 < t2 && t1 < t3)
method = 1;
- else if (t2 < t3 && t2 < t4)
+ else if (t2 < t3)
method = 2;
- else if (t3 < t4)
- method = 3;
else
- method = 4;
+ method = 3;
print_define ("JACOBI_BASE_METHOD", method);
}
@@ -2607,7 +1641,8 @@ speed_mpn_pre_set_str (struct speed_params *s)
for (i = 0; i < s->size; i++)
str[i] = s->xp[i] % base;
- LIMBS_PER_DIGIT_IN_BASE (wn, s->size, base);
+ wn = ((mp_size_t) (s->size / __mp_bases[base].chars_per_bit_exactly))
+ / BITS_PER_MP_LIMB + 2;
SPEED_TMP_ALLOC_LIMBS (wp, wn, s->align_wp);
/* use this during development to check wn is big enough */
@@ -2615,11 +1650,11 @@ 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/GMP_LIMB_BYTES);
+ speed_operand_src (s, (mp_ptr) str, s->size/BYTES_PER_MP_LIMB);
speed_operand_dst (s, wp, wn);
speed_cache_fill (s);
- chars_per_limb = mp_bases[base].chars_per_limb;
+ chars_per_limb = __mp_bases[base].chars_per_limb;
un = s->size / chars_per_limb + 1;
powtab_mem = TMP_BALLOC_LIMBS (mpn_dc_set_str_powtab_alloc (un));
mpn_set_str_compute_powtab (powtab, powtab_mem, un, base);
@@ -2641,6 +1676,8 @@ speed_mpn_pre_set_str (struct speed_params *s)
void
tune_set_str (void)
{
+ static struct param_t param;
+
s.r = 10; /* decimal */
{
static struct param_t param;
@@ -2672,15 +1709,14 @@ tune_fft_mul (void)
if (option_fft_max_size == 0)
return;
- param.table_name = "MUL_FFT_TABLE3";
+ param.table_name = "MUL_FFT_TABLE";
param.threshold_name = "MUL_FFT_THRESHOLD";
param.p_threshold = &mul_fft_threshold;
param.modf_threshold_name = "MUL_FFT_MODF_THRESHOLD";
param.p_modf_threshold = &mul_fft_modf_threshold;
- param.first_size = MUL_TOOM33_THRESHOLD / 2;
+ param.first_size = MUL_TOOM3_THRESHOLD / 2;
param.max_size = option_fft_max_size;
- param.function = speed_mpn_fft_mul;
- param.mul_modf_function = speed_mpn_mul_fft;
+ param.function = speed_mpn_mul_fft;
param.mul_function = speed_mpn_mul_n;
param.sqr = 0;
fft (&param);
@@ -2695,38 +1731,19 @@ tune_fft_sqr (void)
if (option_fft_max_size == 0)
return;
- param.table_name = "SQR_FFT_TABLE3";
+ param.table_name = "SQR_FFT_TABLE";
param.threshold_name = "SQR_FFT_THRESHOLD";
param.p_threshold = &sqr_fft_threshold;
param.modf_threshold_name = "SQR_FFT_MODF_THRESHOLD";
param.p_modf_threshold = &sqr_fft_modf_threshold;
param.first_size = SQR_TOOM3_THRESHOLD / 2;
param.max_size = option_fft_max_size;
- param.function = speed_mpn_fft_sqr;
- param.mul_modf_function = speed_mpn_mul_fft_sqr;
- param.mul_function = speed_mpn_sqr;
- param.sqr = 1;
+ param.function = speed_mpn_mul_fft_sqr;
+ param.mul_function = speed_mpn_sqr_n;
+ param.sqr = 0;
fft (&param);
}
-void
-tune_fac_ui (void)
-{
- static struct param_t param;
-
- param.function = speed_mpz_fac_ui_tune;
-
- param.name = "FAC_DSC_THRESHOLD";
- param.min_size = 70;
- param.max_size = FAC_DSC_THRESHOLD_LIMIT;
- one (&fac_dsc_threshold, &param);
-
- param.name = "FAC_ODD_THRESHOLD";
- param.min_size = 22;
- param.stop_factor = 1.7;
- param.min_is_always = 1;
- one (&fac_odd_threshold, &param);
-}
void
all (void)
@@ -2794,81 +1811,52 @@ all (void)
}
printf ("\n");
- tune_divrem_1 ();
- tune_mod_1 ();
- tune_preinv_divrem_1 ();
- tune_div_qr_1 ();
-#if 0
- tune_divrem_2 ();
-#endif
- tune_div_qr_2 ();
- tune_divexact_1 ();
- tune_modexact_1_odd ();
- printf("\n");
-
- tune_mul_n ();
- printf("\n");
-
tune_mul ();
printf("\n");
tune_sqr ();
printf("\n");
- tune_mulmid ();
+ tune_mullow ();
printf("\n");
- tune_mulmod_bnm1 ();
- tune_sqrmod_bnm1 ();
- printf("\n");
-
- tune_fft_mul ();
- printf("\n");
-
- tune_fft_sqr ();
- printf ("\n");
-
- tune_mullo ();
- printf("\n");
-
- tune_dc_div ();
- tune_dc_bdiv ();
-
- printf("\n");
- tune_invertappr ();
- tune_invert ();
- printf("\n");
-
- tune_binvert ();
- tune_redc ();
- printf("\n");
-
- tune_mu_div ();
- tune_mu_bdiv ();
- printf("\n");
-
- tune_powm_sec ();
+ tune_sb_preinv ();
+ tune_dc ();
+ tune_powm ();
printf("\n");
tune_matrix22_mul ();
tune_hgcd ();
- tune_hgcd_appr ();
- tune_hgcd_reduce();
tune_gcd_dc ();
tune_gcdext_dc ();
+#if 0
+ tune_gcd_accel ();
+#endif
tune_jacobi_base ();
printf("\n");
+ tune_divrem_1 ();
+ tune_mod_1 ();
+ tune_preinv_divrem_1 ();
+ tune_preinv_mod_1 ();
+ tune_divrem_2 ();
+ tune_divexact_1 ();
+ tune_modexact_1_odd ();
+ printf("\n");
+
tune_get_str ();
tune_set_str ();
printf("\n");
- tune_fac_ui ();
+ tune_fft_mul ();
printf("\n");
+ tune_fft_sqr ();
+ printf ("\n");
+
time (&end_time);
printf ("/* Tuneup completed successfully, took %ld seconds */\n",
- (long) (end_time - start_time));
+ end_time - start_time);
TMP_FREE;
}
diff --git a/gmp/tune/x86_64.asm b/gmp/tune/x86_64.asm
index b7ec44c544..509909002a 100644
--- a/gmp/tune/x86_64.asm
+++ b/gmp/tune/x86_64.asm
@@ -1,32 +1,21 @@
dnl x86 pentium time stamp counter access routine.
-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 modify
-dnl it under the terms of either:
+dnl Copyright 1999, 2000, 2003, 2004, 2005 Free Software Foundation, Inc.
dnl
-dnl * the GNU Lesser General Public License as published by the Free
-dnl Software Foundation; either version 3 of the License, or (at your
-dnl option) any later version.
-dnl
-dnl or
-dnl
-dnl * the GNU General Public License as published by the Free Software
-dnl Foundation; either version 2 of the License, or (at your option) any
-dnl later version.
+dnl This file is part of the GNU MP Library.
dnl
-dnl or both in parallel, as here.
+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, but
-dnl WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
-dnl or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
-dnl for more details.
+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 copies of the GNU General Public 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 You should have received 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')
diff --git a/gmp/version.c b/gmp/version.c
index b75a3389e0..da16b7790e 100644
--- a/gmp/version.c
+++ b/gmp/version.c
@@ -1,32 +1,21 @@
/* gmp_version -- version number compiled into the library.
-Copyright 1996, 1999-2001 Free Software Foundation, Inc.
+Copyright 1996, 1999, 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 either:
-
- * the GNU Lesser General Public License as published by the Free
- Software Foundation; either version 3 of the License, or (at your
- option) any later version.
-
-or
-
- * the GNU General Public License as published by the Free Software
- Foundation; either version 2 of the License, or (at your option) any
- later version.
-
-or both in parallel, as here.
+it under the terms of the GNU 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 General Public License
-for more details.
+or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser 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 should have 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"
diff --git a/gmp/ylwrap b/gmp/ylwrap
deleted file mode 100755
index 92536350cb..0000000000
--- a/gmp/ylwrap
+++ /dev/null
@@ -1,226 +0,0 @@
-#! /bin/sh
-# ylwrap - wrapper for lex/yacc invocations.
-
-scriptversion=2011-08-25.18; # UTC
-
-# Copyright (C) 1996, 1997, 1998, 1999, 2001, 2002, 2003, 2004, 2005,
-# 2007, 2009, 2010, 2011 Free Software Foundation, Inc.
-#
-# Written by Tom Tromey <tromey@cygnus.com>.
-#
-# 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, 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 <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
-# configuration script generated by Autoconf, you may include it under
-# the same distribution terms that you use for the rest of that program.
-
-# This file is maintained in Automake, please report
-# bugs to <bug-automake@gnu.org> or send patches to
-# <automake-patches@gnu.org>.
-
-case "$1" in
- '')
- echo "$0: No files given. Try \`$0 --help' for more information." 1>&2
- exit 1
- ;;
- --basedir)
- basedir=$2
- shift 2
- ;;
- -h|--h*)
- cat <<\EOF
-Usage: ylwrap [--help|--version] INPUT [OUTPUT DESIRED]... -- PROGRAM [ARGS]...
-
-Wrapper for lex/yacc invocations, renaming files as desired.
-
- INPUT is the input file
- OUTPUT is one file PROG generates
- DESIRED is the file we actually want instead of OUTPUT
- PROGRAM is program to run
- ARGS are passed to PROG
-
-Any number of OUTPUT,DESIRED pairs may be used.
-
-Report bugs to <bug-automake@gnu.org>.
-EOF
- exit $?
- ;;
- -v|--v*)
- echo "ylwrap $scriptversion"
- exit $?
- ;;
-esac
-
-
-# The input.
-input="$1"
-shift
-case "$input" in
- [\\/]* | ?:[\\/]*)
- # Absolute path; do nothing.
- ;;
- *)
- # Relative path. Make it absolute.
- input="`pwd`/$input"
- ;;
-esac
-
-pairlist=
-while test "$#" -ne 0; do
- if test "$1" = "--"; then
- shift
- break
- fi
- pairlist="$pairlist $1"
- shift
-done
-
-# The program to run.
-prog="$1"
-shift
-# Make any relative path in $prog absolute.
-case "$prog" in
- [\\/]* | ?:[\\/]*) ;;
- *[\\/]*) prog="`pwd`/$prog" ;;
-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$$
-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
-
-case $# in
- 0) "$prog" "$input" ;;
- *) "$prog" "$@" "$input" ;;
-esac
-ret=$?
-
-if test $ret -eq 0; then
- set X $pairlist
- shift
- first=yes
- # Since DOS filename conventions don't allow two dots,
- # the DOS version of Bison writes out y_tab.c instead of y.tab.c
- # and y_tab.h instead of y.tab.h. Test to see if this is the case.
- y_tab_nodot="no"
- if test -f y_tab.c || test -f y_tab.h; then
- y_tab_nodot="yes"
- fi
-
- # The directory holding the input.
- input_dir=`echo "$input" | sed -e 's,\([\\/]\)[^\\/]*$,\1,'`
- # Quote $INPUT_DIR so we can use it in a regexp.
- # FIXME: really we should care about more than `.' and `\'.
- input_rx=`echo "$input_dir" | sed 's,\\\\,\\\\\\\\,g;s,\\.,\\\\.,g'`
-
- while test "$#" -ne 0; do
- from="$1"
- # 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"
- else
- 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";;
- esac
-
- # We do not want to overwrite a header file if it hasn't
- # changed. This avoid useless recompilations. However the
- # parser itself (the first file) should always be updated,
- # because it is the destination of the .y.c rule in the
- # 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`"
- fi
- # Edit out `#line' or `#' directives.
- #
- # We don't want the resulting debug information to point at
- # an absolute srcdir; it is better for it to just mention the
- # .y file with no path.
- #
- # We want to use the real output file name, not yy.lex.c for
- # instance.
- #
- # We want the include guards to be adjusted too.
- FROM=`echo "$from" | sed \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
- -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
- TARGET=`echo "$2" | sed \
- -e 'y/abcdefghijklmnopqrstuvwxyz/ABCDEFGHIJKLMNOPQRSTUVWXYZ/'\
- -e 's/[^ABCDEFGHIJKLMNOPQRSTUVWXYZ]/_/g'`
-
- sed -e "/^#/!b" -e "s,$input_rx,," -e "s,$from,$2," \
- -e "s,$FROM,$TARGET," "$from" >"$target" || ret=$?
-
- # 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
- echo updating "$2"
- mv -f "$target" "$realtarget"
- fi
- fi
- else
- # A missing file is only an error for the first file. This
- # is a blatant hack to let us support using "yacc -d". If -d
- # is not specified, we don't want an error when the header
- # file is "missing".
- if test $first = yes; then
- ret=1
- fi
- fi
- shift
- shift
- first=no
- done
-else
- ret=$?
-fi
-
-# Remove the directory.
-cd ..
-rm -rf $dirname
-
-exit $ret
-
-# Local Variables:
-# mode: shell-script
-# sh-indentation: 2
-# eval: (add-hook 'write-file-hooks 'time-stamp)
-# time-stamp-start: "scriptversion="
-# time-stamp-format: "%:y-%02m-%02d.%02H"
-# time-stamp-time-zone: "UTC"
-# time-stamp-end: "; # UTC"
-# End: